@readmagic/workmate 0.0.20 → 0.0.21

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 (420) hide show
  1. package/dist/chunks/AddWorkspaceDirectory-DgAxYgBY.js +1 -0
  2. package/dist/chunks/AgentsMdExternalIncludesDialog-DGMRVexR.js +1 -0
  3. package/dist/chunks/AgentsMdExternalIncludesDialog-Dp6CwZyI.js +1 -0
  4. package/dist/chunks/App-VWyPd524.js +1 -0
  5. package/dist/chunks/ApproveApiKey-Bolw0sPs.js +1 -0
  6. package/dist/chunks/ApproveApiKey-CyNPMd6g.js +1 -0
  7. package/dist/chunks/BackgroundTasksDialog-DxagIOOw.js +2 -0
  8. package/dist/chunks/BypassPermissionsModeDialog-OS2S66zQ.js +1 -0
  9. package/dist/chunks/{DiffDialog-DCpchgp5.js → DiffDialog-CMtml9iw.js} +3 -3
  10. package/dist/chunks/Doctor-Bk9P37mU.js +1 -0
  11. package/dist/chunks/Doctor-D9F3tKsr.js +3 -0
  12. package/dist/chunks/ExitFlow-DhRv5JPj.js +2 -0
  13. package/dist/chunks/{Grove-Dd6rjs5P.js → Grove-Bbh8PpH0.js} +1 -1
  14. package/dist/chunks/{HybridTransport-CJVkWa2u.js → HybridTransport-P1vEUwhv.js} +1 -1
  15. package/dist/chunks/InvalidConfigDialog-xAYpE-20.js +1 -0
  16. package/dist/chunks/InvalidSettingsDialog-CXFSISy3.js +1 -0
  17. package/dist/chunks/MCPConnectionManager-CoId-C__.js +1 -0
  18. package/dist/chunks/MCPToolListView-BQkQ-hyF.js +1 -0
  19. package/dist/chunks/McpParsingWarnings-6ENzOklf.js +1 -0
  20. package/dist/chunks/MessageSelector-BvRVrfg6.js +3 -0
  21. package/dist/chunks/Messages-Cykztq1O.js +10 -0
  22. package/dist/chunks/Onboarding-CfeRwPNQ.js +1 -0
  23. package/dist/chunks/PermissionDialog-BaibiQae.js +1 -0
  24. package/dist/chunks/PressEnterToContinue-DZc_s_pE.js +1 -0
  25. package/dist/chunks/PromptInputFooterSuggestions-Blzgj5yW.js +1 -0
  26. package/dist/chunks/PromptInputHelpMenu-Ckp0k8E3.js +1 -0
  27. package/dist/chunks/QueryEngine-DduzztIG.js +1 -0
  28. package/dist/chunks/REPL-B8e5UU3H.js +128 -0
  29. package/dist/chunks/REPL-C4mbOhyL.js +1 -0
  30. package/dist/chunks/{RemoteSessionManager-BfsOv4K6.js → RemoteSessionManager-BPESC6Wu.js} +2 -2
  31. package/dist/chunks/ResumeConversation-DG1sLryB.js +1 -0
  32. package/dist/chunks/{SSETransport-B3K6eH9I.js → SSETransport-CDNP2PlK.js} +1 -1
  33. package/dist/chunks/{SearchBox-CwwV0W-w.js → SearchBox-C9xxQzh1.js} +1 -1
  34. package/dist/chunks/SearchExtraToolsTool-vK2PP628.js +1 -0
  35. package/dist/chunks/Settings-B7n_dfP-.js +2 -0
  36. package/dist/chunks/TeleportProgress-QL3ibQfK.js +1 -0
  37. package/dist/chunks/TeleportRepoMismatchDialog-f-xl7biD.js +1 -0
  38. package/dist/chunks/TeleportResumeWrapper-DzVcrFuP.js +1 -0
  39. package/dist/chunks/ThemePicker-CIFKZza0.js +1 -0
  40. package/dist/chunks/TrustDialog-C0HEwZPk.js +1 -0
  41. package/dist/chunks/{ValidationErrorsList-BfZ5gcIv.js → ValidationErrorsList-2QWIs_6h.js} +1 -1
  42. package/dist/chunks/add-dir-DmEhPnvj.js +1 -0
  43. package/dist/chunks/{agentDisplay-BM4QG_RX.js → agentDisplay-1Y-N-gqz.js} +1 -1
  44. package/dist/chunks/{agents-BbDBN5l9.js → agents-CvW8XjoJ.js} +1 -1
  45. package/dist/chunks/agents-D96ng5I9.js +101 -0
  46. package/dist/chunks/allErrors-CT2dbBF3.js +1 -0
  47. package/dist/chunks/{api-DyUWfg3a.js → api-DTyrmy1O.js} +1 -1
  48. package/dist/chunks/api-DumFOErN.js +1 -0
  49. package/dist/chunks/{auth-0rn1U4Eq.js → auth-CZ4EsFWF.js} +1 -1
  50. package/dist/chunks/auth-QvonHoG9.js +1 -0
  51. package/dist/chunks/auth-jV5THRH8.js +1 -0
  52. package/dist/chunks/backgroundHousekeeping-C72oPgfD.js +17 -0
  53. package/dist/chunks/backgroundHousekeeping-D9PScHES.js +1 -0
  54. package/dist/chunks/{banner-BkUdig-T.js → banner-ChT5Ri7Q.js} +1 -1
  55. package/dist/chunks/{bg-tGgpwpYx.js → bg-qG2osBbP.js} +2 -2
  56. package/dist/chunks/{branch-CQ38cx5n.js → branch-K8X6jx0i.js} +1 -1
  57. package/dist/chunks/{break-cache-CcwOjTKt.js → break-cache-BZ_UMtEL.js} +1 -1
  58. package/dist/chunks/{bridgeConfig-C5L-7KaP.js → bridgeConfig-C-bI-slm.js} +1 -1
  59. package/dist/chunks/bridgeConfig-_xpxhGB5.js +1 -0
  60. package/dist/chunks/{bridgeMessaging-DVC3qj-C.js → bridgeMessaging-DSJlYarJ.js} +1 -1
  61. package/dist/chunks/{bridgeStatusUtil-Cex6VowM.js → bridgeStatusUtil-DaEq5c69.js} +1 -1
  62. package/dist/chunks/btw-BNs5OX7x.js +1 -0
  63. package/dist/chunks/caches-CC5NHwAz.js +1 -0
  64. package/dist/chunks/caches-nHxJWXgO.js +1 -0
  65. package/dist/chunks/{ccrClient-DO563xlf.js → ccrClient-JnhF5b3z.js} +1 -1
  66. package/dist/chunks/{clear-DmqQBNKg.js → clear-D2KRoibg.js} +1 -1
  67. package/dist/chunks/client-BtTkq0YS.js +1 -0
  68. package/dist/chunks/commands-C_rYjyQZ.js +1 -0
  69. package/dist/chunks/compact-Cqd6vKpn.js +2 -0
  70. package/dist/chunks/config-Be0BkAAr.js +1 -0
  71. package/dist/chunks/{config-DRy1I12M.js → config-DUTgj3js.js} +1 -1
  72. package/dist/chunks/{config-e0Goy478.js → config-DoEDgAfv.js} +1 -1
  73. package/dist/chunks/context-Db9tH1VF.js +1 -0
  74. package/dist/chunks/{context-noninteractive-BzDVMnWC.js → context-noninteractive-CacA9VlT.js} +2 -2
  75. package/dist/chunks/context-noninteractive-D9tJYwi7.js +1 -0
  76. package/dist/chunks/conversation-DWfE4KGH.js +1 -0
  77. package/dist/chunks/conversation-Tvo4EDpQ.js +1 -0
  78. package/dist/chunks/convert-legacy-node-http-options-BZnGSjx2.js +1 -0
  79. package/dist/chunks/{createSSHSession-LVGVXHXL.js → createSSHSession-BQ83MMtr.js} +1 -1
  80. package/dist/chunks/createSession-CqHnHhCR.js +1 -0
  81. package/dist/chunks/{createSession-Dgwxk1WA.js → createSession-DqTtBycR.js} +1 -1
  82. package/dist/chunks/crossProjectResume-DIXtiODF.js +40 -0
  83. package/dist/chunks/{datadog-Bc6wkPne.js → datadog-BuElf2EQ.js} +1 -1
  84. package/dist/chunks/detectRepository-DUJBh5s2.js +1 -0
  85. package/dist/chunks/{detectRepository-CDOJ-M7h.js → detectRepository-pRAVv8SH.js} +1 -1
  86. package/dist/chunks/{diff-DIg66U_d.js → diff-yA6v_dpP.js} +1 -1
  87. package/dist/chunks/{directoryCompletion-BDGcGDuv.js → directoryCompletion-CuA3_YIT.js} +1 -1
  88. package/dist/chunks/doctor-eNAm6OiS.js +1 -0
  89. package/dist/chunks/{entry-B-Y-AYeK.js → entry-DidpiR-D.js} +5 -5
  90. package/dist/chunks/esm-0CwQE5CJ.js +10 -0
  91. package/dist/chunks/esm-BCUC71kt.js +1 -0
  92. package/dist/chunks/esm-BCmY8V0C.js +1 -0
  93. package/dist/chunks/esm-BUJtY-Rb.js +1 -0
  94. package/dist/chunks/esm-BadZVa27.js +1 -0
  95. package/dist/chunks/esm-BbMeEYcz.js +1 -0
  96. package/dist/chunks/esm-sVMjGuep.js +1 -0
  97. package/dist/chunks/execFileNoThrow-B_KRY4cT.js +34 -0
  98. package/dist/chunks/exit-DywUeiYd.js +1 -0
  99. package/dist/chunks/extraUsage-DiAirtuk.js +1 -0
  100. package/dist/chunks/extractMemories-_xiTnX95.js +1 -0
  101. package/dist/chunks/fast-DCXZACT9.js +1 -0
  102. package/dist/chunks/fast-Qo4WVqiW.js +1 -0
  103. package/dist/chunks/{fetchModelList-Dy-x4h3G.js → fetchModelList-fQDsmR3E.js} +1 -1
  104. package/dist/chunks/fetchModelList-woVzIVde.js +1 -0
  105. package/dist/chunks/{fileSuggestions-CFkJktgc.js → fileSuggestions-CRx1D6uk.js} +3 -3
  106. package/dist/chunks/firstPartyEventLogger-B261Wksn.js +3 -0
  107. package/dist/chunks/firstPartyEventLogger-DtFTeHy-.js +1 -0
  108. package/dist/chunks/{flushGate-BjKW7PFC.js → flushGate-BA8dSr0i.js} +1 -1
  109. package/dist/chunks/fpsMetrics-wxj9GAsd.js +1 -0
  110. package/dist/chunks/{gemini-NnmxBoEp.js → gemini-BXAyy1JN.js} +1 -1
  111. package/dist/chunks/generateSessionName-Cwmk2N3F.js +1 -0
  112. package/dist/chunks/{genericProcessUtils-6E7fB1dI.js → genericProcessUtils-Cnyun_Wr.js} +3 -3
  113. package/dist/chunks/{git-By_J4XJL.js → git-Wid-XppW.js} +1 -1
  114. package/dist/chunks/git-hO-TMvXc.js +1 -0
  115. package/dist/chunks/{githubRepoPathMapping-CzgPGOHQ.js → githubRepoPathMapping-OV8U1VFK.js} +1 -1
  116. package/dist/chunks/goal-C9clrwEH.js +3 -0
  117. package/dist/chunks/{grok-BxZ4vTDw.js → grok-CjeCecsZ.js} +1 -1
  118. package/dist/chunks/{grove-CYE1Cfcz.js → grove-DqTnK9nn.js} +2 -2
  119. package/dist/chunks/help-Bb6LdzXK.js +1 -0
  120. package/dist/chunks/{hooks-7iyENdDG.js → hooks-BDgToO1Z.js} +2 -2
  121. package/dist/chunks/hooks-BX2s7aoL.js +1 -0
  122. package/dist/chunks/{initReplBridge-BEZW5PEY.js → initReplBridge-D7cuY_os.js} +1 -1
  123. package/dist/chunks/install-eCA8UACi.js +1 -0
  124. package/dist/chunks/{instrumentation-2HH15DPu.js → instrumentation-BaRKojJh.js} +6 -6
  125. package/dist/chunks/{job-CXz7SLZp.js → job-DYMfSglZ.js} +1 -1
  126. package/dist/chunks/{jwtUtils-C_LG1txt.js → jwtUtils-JE2okZ70.js} +1 -1
  127. package/dist/chunks/keybindings-iBqc1KHL.js +1 -0
  128. package/dist/chunks/launchLocalMemory-IZPGEzMk.js +3 -0
  129. package/dist/chunks/launchOnboarding-BeNf51Ig.js +8 -0
  130. package/dist/chunks/loadAgentsDir-Bpke9CtB.js +1 -0
  131. package/dist/chunks/{loadAgentsDir-DaNpxaO-.js → loadAgentsDir-C96o6gCj.js} +576 -576
  132. package/dist/chunks/loadPluginHooks-0nGlugZ4.js +1 -0
  133. package/dist/chunks/{localSearch-C2SZ9bGW.js → localSearch-DLz5IGGu.js} +1 -1
  134. package/dist/chunks/localSearch-dodgnjGn.js +1 -0
  135. package/dist/chunks/logoUtils-Cg_6QV1Z.js +1 -0
  136. package/dist/chunks/{magicDocs-CrTwULyJ.js → magicDocs-DmPNMnNY.js} +2 -2
  137. package/dist/chunks/{main-Blm02_Js.js → main-7ssnA9Yb.js} +2 -2
  138. package/dist/chunks/{main-bJXadFi0.js → main-BEv6MqMX.js} +34 -34
  139. package/dist/chunks/{managedEnv-CUsdYhAI.js → managedEnv-CHYvwXBH.js} +1 -1
  140. package/dist/chunks/managedEnv-CbjOQmEe.js +1 -0
  141. package/dist/chunks/mappers-D8VLUZ2N.js +1 -0
  142. package/dist/chunks/mcp-BUn3yqsT.js +1 -0
  143. package/dist/chunks/mcp-BskLq9iP.js +2 -0
  144. package/dist/chunks/mcp-C-0DMaXx.js +6 -0
  145. package/dist/chunks/memory-vDkJM58W.js +1 -0
  146. package/dist/chunks/modalContext-DDZdU1J8.js +1 -0
  147. package/dist/chunks/mode-Dbh21H2Y.js +2 -0
  148. package/dist/chunks/model-BaMclMXn.js +1 -0
  149. package/dist/chunks/model-atn3_JBi.js +1 -0
  150. package/dist/chunks/model-vS1Iewyq.js +1 -0
  151. package/dist/chunks/{modelOptions-B3nis9cC.js → modelOptions-Cw1ThINb.js} +1 -1
  152. package/dist/chunks/nativeInstaller-CfZ5uNTh.js +1 -0
  153. package/dist/chunks/omit-B7eQ9q0x.js +1 -0
  154. package/dist/chunks/{onChangeAppState-vKml_lit.js → onChangeAppState-kEAt8nxV.js} +1 -1
  155. package/dist/chunks/{openai-DdupGVdC.js → openai-wh8AX5iz.js} +3 -3
  156. package/dist/chunks/panel-Cm23FDVt.js +1 -0
  157. package/dist/chunks/{partition-BivH9MBJ.js → partition-CENvOfiS.js} +1 -1
  158. package/dist/chunks/permissions-ChuIx-d4.js +3 -0
  159. package/dist/chunks/{pidLock-DiKz5Tza.js → pidLock-C1hmh3YQ.js} +2 -2
  160. package/dist/chunks/plan-s228H7IU.js +1 -0
  161. package/dist/chunks/plugin-DVBEWwMP.js +17 -0
  162. package/dist/chunks/{pluginAutoupdate-C2xTKLR_.js → pluginAutoupdate-aLXhSUVD.js} +1 -1
  163. package/dist/chunks/pluginBlocklist-BprCv0En.js +1 -0
  164. package/dist/chunks/pluginCliCommands-WzzqR1Sr.js +1 -0
  165. package/dist/chunks/{pluginFlagging-DRA0m76J.js → pluginFlagging-BSLuTk3M.js} +1 -1
  166. package/dist/chunks/pluginOperations-Ca9Lup5G.js +2 -0
  167. package/dist/chunks/pluginStartupCheck-DdtxcNwH.js +1 -0
  168. package/dist/chunks/{pluginStartupCheck-BF1N4Lih.js → pluginStartupCheck-xQbHZ5gf.js} +1 -1
  169. package/dist/chunks/plugins-DdIaXpNb.js +4 -0
  170. package/dist/chunks/{poorMode-CKQfWf3S.js → poorMode-Bt_A2arj.js} +1 -1
  171. package/dist/chunks/poorMode-ZIq2oz7q.js +1 -0
  172. package/dist/chunks/print-vxrRE1O2.js +14 -0
  173. package/dist/chunks/processBashCommand-ISucgwpi.js +1 -0
  174. package/dist/chunks/processSlashCommand-BnpXO_fI.js +5 -0
  175. package/dist/chunks/prompt-2AA5W7EH.js +1 -0
  176. package/dist/chunks/prompt-AXiS2LoO.js +1 -0
  177. package/dist/chunks/{prompt-8u06WVES.js → prompt-BNNE5tsG.js} +1 -1
  178. package/dist/chunks/promptEditor-DT6egmcb.js +4 -0
  179. package/dist/chunks/{protocolHandler-DzHVaPl3.js → protocolHandler-DukQ6b4Q.js} +1 -1
  180. package/dist/chunks/{reconciler-RIKmaPg7.js → reconciler-D3zyJCnV.js} +1 -1
  181. package/dist/chunks/refresh-BSG0t4cf.js +1 -0
  182. package/dist/chunks/{registerProtocol-C0IlPEoa.js → registerProtocol-BOEYaX-X.js} +1 -1
  183. package/dist/chunks/{reload-plugins-DC-tbXVv.js → reload-plugins-BFMRhbv8.js} +1 -1
  184. package/dist/chunks/{remoteBridgeCore-NGTnhQgw.js → remoteBridgeCore-D5OwvmAz.js} +1 -1
  185. package/dist/chunks/{remoteManagedSettings-BoOYHzYP.js → remoteManagedSettings-DyGVvvcW.js} +1 -1
  186. package/dist/chunks/rename-BrEwj3Xw.js +1 -0
  187. package/dist/chunks/resume-DR5JbICs.js +2 -0
  188. package/dist/chunks/{ripgrep-C3jtZL7k.js → ripgrep-Dt4a91S5.js} +1 -1
  189. package/dist/chunks/ripgrep-KTOU5s9J.js +1 -0
  190. package/dist/chunks/{runtimeObserver-L6041elO.js → runtimeObserver-CsZw5XBt.js} +2 -2
  191. package/dist/chunks/{runtimeObserver-DzesbvgI.js → runtimeObserver-DS1PK6We.js} +1 -1
  192. package/dist/chunks/sandbox-adapter-BqDyWcol.js +1 -0
  193. package/dist/chunks/sandbox-toggle-B9f_0NQI.js +1 -0
  194. package/dist/chunks/searchExtraTools-2pIT2C8u.js +1 -0
  195. package/dist/chunks/session-wkRTfdo8.js +2 -0
  196. package/dist/chunks/sessionFileAccessHooks-DV22q9JO.js +1 -0
  197. package/dist/chunks/sessionObserver-BLJg0qm_.js +1 -0
  198. package/dist/chunks/{sessionObserver-0D8xFoRK.js → sessionObserver-N7fORFdL.js} +2 -2
  199. package/dist/chunks/{sessionState-CQhbGfmh.js → sessionState-8jutEorw.js} +1 -1
  200. package/dist/chunks/sessionStorage-DRV7IhZF.js +1 -0
  201. package/dist/chunks/sessionTracing-fIp8g04N.js +11 -0
  202. package/dist/chunks/{settings-3xZ0fsvE.js → settings-BowI3jp-.js} +2 -2
  203. package/dist/chunks/settings-CHn0gJCG.js +1 -0
  204. package/dist/chunks/settingsSync-DF4JgSNc.js +1 -0
  205. package/dist/chunks/setup-UiEO9i7F.js +3 -0
  206. package/dist/chunks/{shadowedRuleDetection-Cy9tsuKc.js → shadowedRuleDetection-DEo1hvGi.js} +1 -1
  207. package/dist/chunks/{sideQuestion-Ds7Elgs4.js → sideQuestion-C11KgNGL.js} +3 -3
  208. package/dist/chunks/sinks-DnLqRPEC.js +1 -0
  209. package/dist/chunks/{sinks-BXX72cbf.js → sinks-mGBiINp8.js} +1 -1
  210. package/dist/chunks/skillChangeDetector-Dc6YZXJE.js +1 -0
  211. package/dist/chunks/{skillGapStore-BxCxKPev.js → skillGapStore-H4MkUFUY.js} +2 -2
  212. package/dist/chunks/{skillLifecycle-CfyNC3sW.js → skillLifecycle-ADUTDK7D.js} +2 -2
  213. package/dist/chunks/{skillSearchPanel-CMNJFIEC.js → skillSearchPanel-PpfVDMGR.js} +2 -2
  214. package/dist/chunks/skills-DKtN17ch.js +1 -0
  215. package/dist/chunks/src-9vmGsuSI.js +1 -0
  216. package/dist/chunks/{src-CgZmCiiH.js → src-BacxF9BD.js} +2 -2
  217. package/dist/chunks/{startupProfiler-CbzxVmbv.js → startupProfiler-B90b5vuq.js} +1 -1
  218. package/dist/chunks/startupProfiler-DG2TN5R_.js +1 -0
  219. package/dist/chunks/staticRender-BVWx0IM1.js +1 -0
  220. package/dist/chunks/stats-D4LEtkrw.js +1 -0
  221. package/dist/chunks/status-0ZBx6Ls0.js +2 -0
  222. package/dist/chunks/status-BUJ4-omB.js +1 -0
  223. package/dist/chunks/{statusNoticeHelpers-CZoOse-_.js → statusNoticeHelpers-BrpQWj0l.js} +1 -1
  224. package/dist/chunks/{stringUtils-CKD8qDqx.js → stringUtils-D7oJIyY2.js} +1 -1
  225. package/dist/chunks/switcher-D7Ey5uIi.js +1 -0
  226. package/dist/chunks/{switcher-DQF5ZNal.js → switcher-DWfKi17X.js} +1 -1
  227. package/dist/chunks/{syncCache-qWJ_VfBo.js → syncCache-DUhciJLz.js} +1 -1
  228. package/dist/chunks/{tasks-C8pb6ftc.js → tasks-BwSsj2vI.js} +1 -1
  229. package/dist/chunks/teleport-DwZMevmQ.js +1 -0
  230. package/dist/chunks/{templateJobs-DJ4dcfcL.js → templateJobs-fiKuu4DK.js} +1 -1
  231. package/dist/chunks/{terminalSetup-7PdC4fV5.js → terminalSetup-Cte5a4hM.js} +1 -1
  232. package/dist/chunks/{terminalSetup-kWdZRKWq.js → terminalSetup-a7-BNS4T.js} +1 -1
  233. package/dist/chunks/theme-CAoGjf2D.js +1 -0
  234. package/dist/chunks/{tmux-CpGd0Aca.js → tmux-DA06aewY.js} +1 -1
  235. package/dist/chunks/{toolEventObserver-D2nk8ZbW.js → toolEventObserver-Cq_ZV7x9.js} +1 -1
  236. package/dist/chunks/toolPool-mdsxlKWR.js +1 -0
  237. package/dist/chunks/{trustedDevice-CB6rNzl-.js → trustedDevice-C1m--Yjw.js} +1 -1
  238. package/dist/chunks/trustedDevice-CeDIk_ln.js +1 -0
  239. package/dist/chunks/{udsClient-U7MEfYj7.js → udsClient-BcwsY0XE.js} +1 -1
  240. package/dist/chunks/useExitOnCtrlCDWithKeybindings-L5idX6Kz.js +1 -0
  241. package/dist/chunks/useMainLoopModel-VXeS2EC6.js +1 -0
  242. package/dist/chunks/useManagePlugins-CAXp5CfH.js +1 -0
  243. package/dist/chunks/useMergedTools-DYXrPTIA.js +1 -0
  244. package/dist/chunks/useSearchInput-Bxl4wGcZ.js +1 -0
  245. package/dist/chunks/useSettingsErrors-sbjsaT7k.js +1 -0
  246. package/dist/chunks/{userAgent-i-oGzf40.js → userAgent-NbKd-hN7.js} +1 -1
  247. package/dist/chunks/util-DU63xTwZ.js +1 -0
  248. package/dist/chunks/validatePlugin-DQ_9OCpP.js +1 -0
  249. package/dist/chunks/{vim-BagKUX4j.js → vim-xruiCyUd.js} +1 -1
  250. package/dist/chunks/which-B8rchd8P.js +1 -0
  251. package/dist/chunks/{workerRegistry-BjxoZ12l.js → workerRegistry-BBgquE8F.js} +2 -2
  252. package/dist/chunks/worktree-C28I8mFB.js +1 -0
  253. package/dist/cli.js +1 -1
  254. package/package.json +3 -21
  255. package/dist/chunks/AddWorkspaceDirectory-BYNvxNrD.js +0 -1
  256. package/dist/chunks/AgentsMdExternalIncludesDialog-BSSz86ER.js +0 -1
  257. package/dist/chunks/AgentsMdExternalIncludesDialog-CMEGV4Md.js +0 -1
  258. package/dist/chunks/App-W_9d1DjK.js +0 -1
  259. package/dist/chunks/ApproveApiKey-Bf1Rb8Ql.js +0 -1
  260. package/dist/chunks/ApproveApiKey-wpdvXpFr.js +0 -1
  261. package/dist/chunks/BackgroundTasksDialog-lGn1Wj1k.js +0 -2
  262. package/dist/chunks/BypassPermissionsModeDialog-CjVjyNf8.js +0 -1
  263. package/dist/chunks/Doctor-6SjW91rd.js +0 -1
  264. package/dist/chunks/Doctor-FPYTivHw.js +0 -3
  265. package/dist/chunks/ExitFlow-Dy8_1D8J.js +0 -2
  266. package/dist/chunks/InvalidConfigDialog-Bisj9ic_.js +0 -1
  267. package/dist/chunks/InvalidSettingsDialog-DyTPNRQR.js +0 -1
  268. package/dist/chunks/MCPConnectionManager-DfyoZaiu.js +0 -1
  269. package/dist/chunks/MCPToolListView-Dioupv8F.js +0 -1
  270. package/dist/chunks/McpParsingWarnings-BUlgpZAF.js +0 -1
  271. package/dist/chunks/MessageSelector-D8fylxPg.js +0 -3
  272. package/dist/chunks/Messages-BZDFMYBT.js +0 -10
  273. package/dist/chunks/Onboarding-BKLomZYo.js +0 -1
  274. package/dist/chunks/PermissionDialog-BPhvs5xH.js +0 -1
  275. package/dist/chunks/PressEnterToContinue-Dwoh6CaW.js +0 -1
  276. package/dist/chunks/PromptInputFooterSuggestions-DCum89fF.js +0 -1
  277. package/dist/chunks/PromptInputHelpMenu-DG2lRqis.js +0 -1
  278. package/dist/chunks/QueryEngine-CyGHpX7M.js +0 -1
  279. package/dist/chunks/REPL-BDsz8KIx.js +0 -1
  280. package/dist/chunks/REPL-CCBNfZfs.js +0 -128
  281. package/dist/chunks/ResumeConversation-pC8NLq0F.js +0 -1
  282. package/dist/chunks/SearchExtraToolsTool-DYoxHo9T.js +0 -1
  283. package/dist/chunks/Settings-CKaGmKg2.js +0 -2
  284. package/dist/chunks/TeleportProgress-CkgSp1cs.js +0 -1
  285. package/dist/chunks/TeleportRepoMismatchDialog-DdO_rECq.js +0 -1
  286. package/dist/chunks/TeleportResumeWrapper-BeG4N-2z.js +0 -1
  287. package/dist/chunks/ThemePicker-iD9ufy99.js +0 -1
  288. package/dist/chunks/TrustDialog-qO5OdQt8.js +0 -1
  289. package/dist/chunks/add-dir-C4eSVlZ6.js +0 -1
  290. package/dist/chunks/agents-D3APE_8d.js +0 -101
  291. package/dist/chunks/allErrors-BkgB7JNK.js +0 -1
  292. package/dist/chunks/api-BHBK9axp.js +0 -1
  293. package/dist/chunks/auth-BEoTPSgC.js +0 -1
  294. package/dist/chunks/auth-BPug7U_u.js +0 -1
  295. package/dist/chunks/backgroundHousekeeping-D7xAhUaE.js +0 -1
  296. package/dist/chunks/backgroundHousekeeping-km82qEh0.js +0 -17
  297. package/dist/chunks/bridgeConfig-CJMjDoaP.js +0 -1
  298. package/dist/chunks/btw-_P96ffHR.js +0 -1
  299. package/dist/chunks/caches-DH-q8Fjf.js +0 -1
  300. package/dist/chunks/caches-Dq0pJFDP.js +0 -1
  301. package/dist/chunks/client-C19cqYQS.js +0 -1
  302. package/dist/chunks/commands-BkpqHY9F.js +0 -1
  303. package/dist/chunks/compact-DuVIvqMu.js +0 -2
  304. package/dist/chunks/config-DMP6-Ccr.js +0 -1
  305. package/dist/chunks/context-DjgMzIfe.js +0 -1
  306. package/dist/chunks/context-noninteractive-DV7bIJCm.js +0 -1
  307. package/dist/chunks/conversation-BBOE_EoE.js +0 -1
  308. package/dist/chunks/conversation-WxH5pb2z.js +0 -1
  309. package/dist/chunks/createSession-BUzna9-E.js +0 -1
  310. package/dist/chunks/crossProjectResume-6B2NYy8a.js +0 -40
  311. package/dist/chunks/detectRepository-Cv9-k6dg.js +0 -1
  312. package/dist/chunks/doctor-BhUmhHQU.js +0 -1
  313. package/dist/chunks/esm-BYnFh4pG.js +0 -1
  314. package/dist/chunks/esm-Bx6rTxIs.js +0 -1
  315. package/dist/chunks/esm-C367Cyo-.js +0 -1
  316. package/dist/chunks/esm-CXM9jqO_.js +0 -1
  317. package/dist/chunks/esm-CXczu_-W.js +0 -1
  318. package/dist/chunks/esm-CXt5K8Xt.js +0 -1
  319. package/dist/chunks/esm-Cb-L4oAk.js +0 -1
  320. package/dist/chunks/esm-CvHtYRrr.js +0 -1
  321. package/dist/chunks/esm-DhRjocaU.js +0 -1
  322. package/dist/chunks/esm-DklLYEuz.js +0 -1
  323. package/dist/chunks/esm-IYgGg4wR.js +0 -1
  324. package/dist/chunks/esm-lyfry1WB.js +0 -10
  325. package/dist/chunks/execFileNoThrow-Bmb5HEFz.js +0 -34
  326. package/dist/chunks/exit-CW2eqUrR.js +0 -1
  327. package/dist/chunks/extraUsage-CkTon7ib.js +0 -1
  328. package/dist/chunks/extractMemories-CfmbvayQ.js +0 -1
  329. package/dist/chunks/fast-ByahC7Gw.js +0 -1
  330. package/dist/chunks/fast-xtIP4u4y.js +0 -1
  331. package/dist/chunks/fetchModelList-D9aePIPW.js +0 -1
  332. package/dist/chunks/firstPartyEventLogger-Bt9iG9xk.js +0 -1
  333. package/dist/chunks/firstPartyEventLogger-DqGSujCz.js +0 -3
  334. package/dist/chunks/fpsMetrics-Dk_pnSHJ.js +0 -1
  335. package/dist/chunks/generateSessionName-EpqGW-T2.js +0 -1
  336. package/dist/chunks/git-zJCasBa6.js +0 -1
  337. package/dist/chunks/goal-DbS8yJfB.js +0 -3
  338. package/dist/chunks/help-DatnwM25.js +0 -1
  339. package/dist/chunks/hooks-DjbqtbUV.js +0 -1
  340. package/dist/chunks/install-DJukI-kL.js +0 -1
  341. package/dist/chunks/keybindings-C9l5il16.js +0 -1
  342. package/dist/chunks/launchLocalMemory-BfGenqj1.js +0 -3
  343. package/dist/chunks/launchOnboarding-DjMmXeQE.js +0 -8
  344. package/dist/chunks/loadAgentsDir-DcI-8FQF.js +0 -1
  345. package/dist/chunks/loadPluginHooks-CGgpcyEC.js +0 -1
  346. package/dist/chunks/localSearch-CTTwYTU1.js +0 -1
  347. package/dist/chunks/logoUtils-CbIqOFrX.js +0 -1
  348. package/dist/chunks/managedEnv-DXeaUDSK.js +0 -1
  349. package/dist/chunks/mappers-_B-s9fNz.js +0 -1
  350. package/dist/chunks/mcp-BbbYzWpy.js +0 -6
  351. package/dist/chunks/mcp-D91sH9a8.js +0 -1
  352. package/dist/chunks/mcp-Dx-zgUgu.js +0 -2
  353. package/dist/chunks/memory-BeL7ui9m.js +0 -1
  354. package/dist/chunks/modalContext-wY9CeN4G.js +0 -1
  355. package/dist/chunks/mode-D695kgLI.js +0 -2
  356. package/dist/chunks/model-DX0TtzqX.js +0 -1
  357. package/dist/chunks/model-Do0f476p.js +0 -1
  358. package/dist/chunks/model-DpcM8dz5.js +0 -1
  359. package/dist/chunks/nativeInstaller-CymO8TNe.js +0 -1
  360. package/dist/chunks/omit-DO61BHZu.js +0 -1
  361. package/dist/chunks/panel-CVd1dzYl.js +0 -1
  362. package/dist/chunks/permissions-C9iqR4_N.js +0 -3
  363. package/dist/chunks/plan-KDN5IGWY.js +0 -1
  364. package/dist/chunks/plugin-D0rzUb8E.js +0 -17
  365. package/dist/chunks/pluginBlocklist-xdiUmUpt.js +0 -1
  366. package/dist/chunks/pluginCliCommands-CIDDvVN7.js +0 -1
  367. package/dist/chunks/pluginOperations-BEYsarAn.js +0 -2
  368. package/dist/chunks/pluginStartupCheck-DVkI4pqo.js +0 -1
  369. package/dist/chunks/plugins-CWWU4BKs.js +0 -4
  370. package/dist/chunks/poorMode-BTIe8W_H.js +0 -1
  371. package/dist/chunks/print-B5H2xbBS.js +0 -14
  372. package/dist/chunks/processBashCommand-EQ9EWaRV.js +0 -1
  373. package/dist/chunks/processSlashCommand-C4PKNyFT.js +0 -5
  374. package/dist/chunks/prompt-B9sDzLPK.js +0 -1
  375. package/dist/chunks/prompt-WsoTRhoh.js +0 -1
  376. package/dist/chunks/promptEditor-Cr4w-4Bz.js +0 -4
  377. package/dist/chunks/refresh-CCSCAjgz.js +0 -1
  378. package/dist/chunks/rename-DS1AmW-F.js +0 -1
  379. package/dist/chunks/resume-Cf5PSoPw.js +0 -2
  380. package/dist/chunks/ripgrep-CBUbn6Po.js +0 -1
  381. package/dist/chunks/sandbox-adapter-Z4Phj31K.js +0 -1
  382. package/dist/chunks/sandbox-toggle-COZE8Lo4.js +0 -1
  383. package/dist/chunks/searchExtraTools-CvkRbL2m.js +0 -1
  384. package/dist/chunks/session-BvA99K4j.js +0 -2
  385. package/dist/chunks/sessionFileAccessHooks-6XfAf6ke.js +0 -1
  386. package/dist/chunks/sessionObserver-CRWUBJEY.js +0 -1
  387. package/dist/chunks/sessionStorage-DqEuxDlb.js +0 -1
  388. package/dist/chunks/sessionTracing-BoOZsXU2.js +0 -11
  389. package/dist/chunks/settings-Crx1cI1u.js +0 -1
  390. package/dist/chunks/settingsSync-rkWmClKS.js +0 -1
  391. package/dist/chunks/setup-D8L275fT.js +0 -3
  392. package/dist/chunks/sinks-DMp6uEzM.js +0 -1
  393. package/dist/chunks/skillChangeDetector-CtithJ4a.js +0 -1
  394. package/dist/chunks/skills-DXMk-498.js +0 -1
  395. package/dist/chunks/src-D3yIF9I42.js +0 -1
  396. package/dist/chunks/src-DQOX_xI1.js +0 -1
  397. package/dist/chunks/src-Dt5IJd3C.js +0 -1
  398. package/dist/chunks/src-Dvp6-vB7.js +0 -19
  399. package/dist/chunks/src-PM8NIIu_.js +0 -1
  400. package/dist/chunks/startupProfiler-uHetQush.js +0 -1
  401. package/dist/chunks/staticRender-D9AbnQFr.js +0 -1
  402. package/dist/chunks/stats-Ce15gc3E.js +0 -1
  403. package/dist/chunks/status-CFrLuGbf.js +0 -2
  404. package/dist/chunks/status-D5OCkMZG.js +0 -1
  405. package/dist/chunks/switcher-AiMcRzoi.js +0 -1
  406. package/dist/chunks/teleport-Bi_1VFIZ.js +0 -1
  407. package/dist/chunks/theme-CEKOCSLw.js +0 -1
  408. package/dist/chunks/toolPool-Df5iUqJ-.js +0 -1
  409. package/dist/chunks/trustedDevice-DXGePUAC.js +0 -1
  410. package/dist/chunks/useExitOnCtrlCDWithKeybindings-Bw0mlTT9.js +0 -1
  411. package/dist/chunks/useMainLoopModel-CIG2cjS2.js +0 -1
  412. package/dist/chunks/useManagePlugins-MSHw-qHx.js +0 -1
  413. package/dist/chunks/useMergedTools-Bb-INJa2.js +0 -1
  414. package/dist/chunks/useSearchInput-QL_VtdJD.js +0 -1
  415. package/dist/chunks/useSettingsErrors-Dvi6zLCr.js +0 -1
  416. package/dist/chunks/util-CLQvtXuD.js +0 -1
  417. package/dist/chunks/validatePlugin-1mTZ3TJR.js +0 -1
  418. package/dist/chunks/which-BxQ1hpjp.js +0 -1
  419. package/dist/chunks/worktree-DpksgxdF.js +0 -1
  420. /package/dist/chunks/{src-DL3w8VPk2.js → src-DL3w8VPk.js} +0 -0
@@ -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-DcaKZlRU.js";import{$d as s,Qw as c,tT as ee}from"./loadAgentsDir-DaNpxaO-.js";import{n as te}from"./cwd-Nh5IZNKO.js";import{B as ne,C as re,D as ie,R as l,S as u,T as ae,U as oe,V as se,c as d,f,i as p,u as m,x as h}from"./debug-D58GQBDG.js";import{Gt as ce,Jt as le,N as ue,Yt as de,Zt as fe,h as pe,j as g,t as me}from"./settings-3xZ0fsvE.js";import{a as _,c as v,h as y,i as he}from"./config-DRy1I12M.js";import{c as ge,n as _e,o as ve,r as b,t as x}from"./execFileNoThrow-Bmb5HEFz.js";import{o as S,s as C}from"./log-CZ7ploQm.js";import{n as w,t as ye}from"./which-BxQ1hpjp.js";import{i as T,o as be}from"./platform-DMQxcm4K.js";import{n as E,t as xe}from"./bundledMode--fG1S62b.js";import{_t as Se,vt as Ce}from"./sessionState-CQhbGfmh.js";import{a as we,i as Te}from"./ripgrep-C3jtZL7k.js";import{i as Ee,r as De}from"./genericProcessUtils-6E7fB1dI.js";import{homedir as D}from"os";import{basename as Oe,delimiter as ke,join as O,posix as k,win32 as A}from"path";import{constants as Ae}from"fs";import{access as je,open as Me,readFile as j,realpath as Ne,stat as Pe}from"fs/promises";function M(){return O(i(),`local`)}function Fe(){return O(M(),`claude`)}function Ie(){return(process.argv[1]||``).includes(`/.workmate/local/node_modules/`)}async function N(){try{return await je(O(M(),`node_modules`,`.bin`,`claude`)),!0}catch{return!1}}function P(){let e=process.env.SHELL||``;return e.includes(`zsh`)?`zsh`:e.includes(`bash`)?`bash`:e.includes(`fish`)?`fish`:`unknown`}var F=e((()=>{y(),o(),l(),b(),f(),S(),h()}));function I(e){let t=e?.homedir??D();return{zsh:O((e?.env??process.env).ZDOTDIR||t,`.zshrc`),bash:O(t,`.bashrc`),fish:O(t,`.config/fish/config.fish`)}}function Le(e){let t=!1;return{filtered:e.filter(e=>{if(z.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 L(e){try{return(await j(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-DcaKZlRU.js";import{Od as s,lT as c,oT as ee}from"./loadAgentsDir-C96o6gCj.js";import{n as te}from"./cwd-Nh5IZNKO.js";import{B as ne,C as re,D as ie,R as l,S as u,T as ae,U as oe,V as se,c as d,f,i as p,u as m,x as h}from"./debug-D58GQBDG.js";import{Gt as ce,Jt as le,N as ue,Yt as de,Zt as fe,h as pe,j as g,t as me}from"./settings-BowI3jp-.js";import{a as _,c as v,h as y,i as he}from"./config-DUTgj3js.js";import{a as ge,i as b,n as _e,s as ve,t as x}from"./execFileNoThrow-B_KRY4cT.js";import{o as S,s as C}from"./log-CZ7ploQm.js";import{n as w,t as ye}from"./which-B8rchd8P.js";import{i as T,o as be}from"./platform-DMQxcm4K.js";import{n as E,t as xe}from"./bundledMode--fG1S62b.js";import{_t as Se,vt as Ce}from"./sessionState-8jutEorw.js";import{a as we,i as Te}from"./ripgrep-Dt4a91S5.js";import{i as Ee,r as De}from"./genericProcessUtils-Cnyun_Wr.js";import{homedir as D}from"os";import{basename as Oe,delimiter as ke,join as O,posix as k,win32 as A}from"path";import{constants as Ae}from"fs";import{access as je,open as Me,readFile as j,realpath as Ne,stat as Pe}from"fs/promises";function M(){return O(i(),`local`)}function Fe(){return O(M(),`claude`)}function Ie(){return(process.argv[1]||``).includes(`/.workmate/local/node_modules/`)}async function N(){try{return await je(O(M(),`node_modules`,`.bin`,`claude`)),!0}catch{return!1}}function P(){let e=process.env.SHELL||``;return e.includes(`zsh`)?`zsh`:e.includes(`bash`)?`bash`:e.includes(`fish`)?`fish`:`unknown`}var F=e((()=>{y(),o(),l(),b(),f(),S(),h()}));function I(e){let t=e?.homedir??D();return{zsh:O((e?.env??process.env).ZDOTDIR||t,`.zshrc`),bash:O(t,`.bashrc`),fish:O(t,`.config/fish/config.fish`)}}function Le(e){let t=!1;return{filtered:e.filter(e=>{if(z.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 L(e){try{return(await j(e,{encoding:`utf8`})).split(`
2
2
  `)}catch(e){if(se(e))return null;throw e}}async function Re(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 R(e){let t=I(e);for(let e of Object.values(t)){let t=await L(e);if(t){for(let e of t)if(z.test(e)){let t=e.match(/alias\s+claude=["']?([^"'\s]+)/);if(t?.[1])return t[1]}}}return null}async function ze(e){let t=await R(e);if(!t)return null;let n=e?.homedir??D(),r=t.startsWith(`~`)?t.replace(`~`,n):t;try{let e=await Pe(r);if(e.isFile()||e.isSymbolicLink())return t}catch{}return null}var z,B=e((()=>{l(),F(),z=/^\s*alias\s+claude\s*=/}));async function Be(){}function Ve(e){let t=me()?.minimumVersion;if(!t)return!1;let n=!Se(e,t);return n&&d(`Skipping update to ${e} - below minimumVersion ${t}`),n}async function He(){let e=ce.isRunningWithBun(),t=null;return t=e?await _e(`bun`,[`pm`,`bin`,`-g`],{cwd:D()}):await _e(`npm`,[`-g`,`config`,`get`,`prefix`],{cwd:D()}),t.code===0?t.stdout.trim():(C(Error(`Failed to check ${e?`bun`:`npm`} permissions`)),null)}async function Ue(){try{let e=await He();if(!e)return{hasPermissions:!1,npmPrefix:null};try{return await je(e,Ae.W_OK),{hasPermissions:!0,npmPrefix:e}}catch{return C(new We(`Insufficient permissions for global npm install.`)),{hasPermissions:!1,npmPrefix:e}}}catch(e){return C(e),{hasPermissions:!1,npmPrefix:null}}}var We,Ge=e((()=>{y(),p(),le(),o(),l(),b(),f(),s(),S(),Ce(),pe(),B(),We=class extends ie{}}));function V(e,t){return t.includes(e.id)||e.idLike.some(e=>t.includes(e))}function Ke(){let e=process.execPath||process.argv[0]||``;return/[/\\]mise[/\\]installs[/\\]/i.test(e)?(d(`Detected mise installation: ${e}`),!0):!1}function qe(){let e=process.execPath||process.argv[0]||``;return/[/\\]\.?asdf[/\\]installs[/\\]/i.test(e)?(d(`Detected asdf installation: ${e}`),!0):!1}function H(){let e=T();if(e!==`macos`&&e!==`linux`&&e!==`wsl`)return!1;let t=process.execPath||process.argv[0]||``;return t.includes(`/Caskroom/`)?(d(`Detected Homebrew cask installation: ${t}`),!0):!1}function Je(){if(T()!==`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 d(`Detected winget installation: ${e}`),!0;return!1}var U,W,G,K,q,Ye,Xe=e((()=>{n(),p(),b(),be(),U=t(async()=>{try{let e=await j(`/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}}),W=t(async()=>{if(T()!==`linux`)return!1;let e=await U();if(e&&!V(e,[`arch`]))return!1;let t=await x(`pacman`,[`-Qo`,process.execPath||process.argv[0]||``],{timeout:5e3,useCwd:!1});return t.code===0&&t.stdout?(d(`Detected pacman installation: ${t.stdout.trim()}`),!0):!1}),G=t(async()=>{if(T()!==`linux`)return!1;let e=await U();if(e&&!V(e,[`debian`]))return!1;let t=await x(`dpkg`,[`-S`,process.execPath||process.argv[0]||``],{timeout:5e3,useCwd:!1});return t.code===0&&t.stdout?(d(`Detected deb installation: ${t.stdout.trim()}`),!0):!1}),K=t(async()=>{if(T()!==`linux`)return!1;let e=await U();if(e&&!V(e,[`fedora`,`rhel`,`suse`]))return!1;let t=await x(`rpm`,[`-qf`,process.execPath||process.argv[0]||``],{timeout:5e3,useCwd:!1});return t.code===0&&t.stdout?(d(`Detected rpm installation: ${t.stdout.trim()}`),!0):!1}),q=t(async()=>{if(T()!==`linux`)return!1;let e=await U();if(e&&!V(e,[`alpine`]))return!1;let t=await x(`apk`,[`info`,`--who-owns`,process.execPath||process.argv[0]||``],{timeout:5e3,useCwd:!1});return t.code===0&&t.stdout?(d(`Detected apk installation: ${t.stdout.trim()}`),!0):!1}),Ye=t(async()=>H()?`homebrew`:Je()?`winget`:Ke()?`mise`:qe()?`asdf`:await W()?`pacman`:await q()?`apk`:await G()?`deb`:await K()?`rpm`:`unknown`)}));function Ze(){let e=process.argv[1]||``,t=process.execPath||process.argv[0]||``;return T()===`windows`&&(e=e.split(A.sep).join(k.sep),t=t.split(A.sep).join(k.sep)),[e,t]}async function Qe(){let[e]=Ze();if(E())return H()||Je()||Ke()||qe()||await W()||await G()||await K()||await q()?`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 ve(`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 $e(){if(E()){try{return await Ne(process.execPath)}catch{}try{let e=await w(`claude`);if(e)return e}catch{}try{return await m().stat(O(D(),`.local/bin/claude`)),O(D(),`.local/bin/claude`)}catch{}return`native`}try{return process.argv[0]||`unknown`}catch{return`unknown`}}function et(){try{return E()?process.execPath||`unknown`:process.argv[1]||`unknown`}catch{return`unknown`}}async function tt(){let e=m(),t=[],n=O(D(),`.workmate`,`local`);await N()&&t.push({type:`npm-local`,path:n});let r=[`@anthropic-ai/workmate`],i=await x(`npm`,[`-g`,`config`,`get`,`prefix`]);if(i.code===0&&i.stdout){let n=i.stdout.trim(),a=T()===`windows`,o=a?O(n,`claude`):O(n,`bin`,`claude`),s=!1;try{await e.stat(o),s=!0}catch{}if(s){let e=!1;try{(await Ne(o)).includes(`/Caskroom/`)&&(e=H())}catch{}e||t.push({type:`npm-global`,path:o})}else for(let i of r){let r=a?O(n,`node_modules`,i):O(n,`lib`,`node_modules`,i);try{await e.stat(r),t.push({type:`npm-global-orphan`,path:r})}catch{}}}let a=O(D(),`.local`,`bin`,`claude`);try{await e.stat(a),t.push({type:`native`,path:a})}catch{}if(v().installMethod===`native`){let n=O(D(),`.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 nt(e){let t=[];try{let e=u(await j(O(de(),`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: ${g.join(`, `)}.`});else{let e=n.filter(e=>typeof e==`string`&&!g.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: ${g.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(ke),n=O(D(),`.local`,`bin`),r=n;if(T()===`windows`&&(r=n.split(A.sep).join(k.sep)),!e.some(e=>{let t=e;T()===`windows`&&(t=e.split(A.sep).join(k.sep));let n=t.replace(/\/+$/,``),i=e.replace(/[/\\]+$/,``);return n===r||i===`~/.local/bin`||i===`$HOME/.local/bin`}))if(T()===`windows`){let e=n.split(k.sep).join(A.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=P(),n=I()[e],r=n?n.replace(D(),`~`):`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 N()&&t.push({issue:`Local installation exists but not being used`,fix:`Consider using native installation: claude install`});let r=await R(),i=await ze();return e===`npm-local`&&!await w(`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 rt(){if(T()!==`linux`)return[];let e=[],t=c.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 it(){let e=await Qe(),t=typeof MACRO<`u`?`0.0.20`:`unknown`,n=await $e(),r=et(),i=await tt(),a=await nt(e);if(a.push(...rt()),e===`native`){let e=i.filter(e=>e.type===`npm-global`||e.type===`npm-global-orphan`||e.type===`npm-local`),t=T()===`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 @anthropic-ai/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 Ue()).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=Te(),ee={working:c.working??!0,mode:c.mode,systemPath:c.mode===`system`?c.path:null,note:c.note??null},te=e===`package-manager`?await Ye():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:te,ripgrepStatus:ee}}var at=e((()=>{ge(),Ge(),xe(),y(),te(),o(),b(),f(),F(),Xe(),be(),we(),ee(),fe(),ue(),B(),h(),ye()}));function J(e){return{env:e?.env??process.env,home:e?.homedir??process.env.HOME??D()}}function Y(e,...t){return e.includes(`/`)&&!e.includes(`\\`)&&!/^[A-Za-z]:/.test(e)?k.join(e,...t):O(e,...t)}function ot(e){let{env:t,home:n}=J(e);return t.XDG_STATE_HOME??Y(n,`.local`,`state`)}function st(e){let{env:t,home:n}=J(e);return t.XDG_CACHE_HOME??Y(n,`.cache`)}function ct(e){let{env:t,home:n}=J(e);return t.XDG_DATA_HOME??Y(n,`.local`,`share`)}function lt(e){let{home:t}=J(e);return Y(t,`.local`,`bin`)}var ut=e((()=>{}));function dt(){let e=process.env.ENABLE_PID_BASED_VERSION_LOCKING;return a(e)?!0:(r(e),!1)}function X(e){if(e<=1)return!1;try{return process.kill(e,0),!0}catch{return!1}}function ft(e,t){if(!X(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 Z(e){let t=m();try{let n=t.readFileSync(e,{encoding:`utf8`});if(!n||n.trim()===``)return null;let r=u(n);return typeof r.pid!=`number`||!r.version||!r.execPath?null:r}catch{return null}}function Q(e){let t=Z(e);if(!t)return!1;let{pid:n,execPath:r}=t;if(!X(n))return!1;if(!ft(n,r))return d(`Lock PID ${n} is running but does not appear to be Work Mate - treating as stale`),!1;let i=m();try{let t=i.statSync(e);if(Date.now()-t.mtimeMs>$&&!X(n))return!1}catch{}return!0}function pt(e,t){let n=m(),r=`${e}.tmp.${process.pid}.${Date.now()}`;try{ae(r,re(t,null,2),{encoding:`utf8`,flush:!0}),n.renameSync(r,e)}catch(e){try{n.unlinkSync(r)}catch{}throw e}}async function mt(e,t){let n=m(),r=Oe(e);if(Q(t))return d(`Cannot acquire lock for ${r} - held by PID ${Z(t)?.pid}`),null;let i={pid:process.pid,version:r,execPath:process.execPath,acquiredAt:Date.now()};try{return pt(t,i),Z(t)?.pid===process.pid?(d(`Acquired PID lock for ${r} (PID ${process.pid})`),()=>{try{Z(t)?.pid===process.pid&&(n.unlinkSync(t),d(`Released PID lock for ${r}`))}catch(e){d(`Failed to release lock for ${r}: ${e}`)}}):null}catch(e){return d(`Failed to acquire lock for ${r}: ${e}`),null}}async function ht(e,t){let n=await mt(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 gt(e,t,n){let r=await mt(e,t);if(!r)return!1;try{return await n(),!0}finally{r()}}function _t(e){let t=m(),n=[];try{let r=t.readdirStringSync(e).filter(e=>e.endsWith(`.lock`));for(let t of r){let r=O(e,t),i=Z(r);i&&n.push({version:i.version,pid:i.pid,isProcessRunning:X(i.pid),execPath:i.execPath,acquiredAt:new Date(i.acquiredAt),lockFilePath:r})}}catch(e){if(ne(e))return n;C(oe(e))}return n}function vt(e){let t=m(),n=0;try{let r=t.readdirStringSync(e).filter(e=>e.endsWith(`.lock`));for(let i of r){let r=O(e,i);try{t.lstatSync(r).isDirectory()?(t.rmSync(r,{recursive:!0,force:!0}),n++,d(`Cleaned up legacy directory lock: ${i}`)):Q(r)||(t.unlinkSync(r),n++,d(`Cleaned up stale lock: ${i}`))}catch{}}}catch(e){if(ne(e))return 0;C(oe(e))}return n}var $,yt=e((()=>{p(),o(),l(),f(),Ee(),S(),h(),$=7200*1e3}));export{L as C,F as E,B as S,P as T,Be as _,Q as a,Le as b,gt as c,ct as d,ot as f,at as g,it as h,yt as i,lt as l,Qe as m,vt as n,dt as o,ut as p,_t as r,Z as s,ht as t,st as u,Ge as v,Re as w,I as x,Ve as y};
3
+ `),{encoding:`utf8`}),await n.datasync()}finally{await n.close()}}async function R(e){let t=I(e);for(let e of Object.values(t)){let t=await L(e);if(t){for(let e of t)if(z.test(e)){let t=e.match(/alias\s+claude=["']?([^"'\s]+)/);if(t?.[1])return t[1]}}}return null}async function ze(e){let t=await R(e);if(!t)return null;let n=e?.homedir??D(),r=t.startsWith(`~`)?t.replace(`~`,n):t;try{let e=await Pe(r);if(e.isFile()||e.isSymbolicLink())return t}catch{}return null}var z,B=e((()=>{l(),F(),z=/^\s*alias\s+claude\s*=/}));async function Be(){}function Ve(e){let t=me()?.minimumVersion;if(!t)return!1;let n=!Se(e,t);return n&&d(`Skipping update to ${e} - below minimumVersion ${t}`),n}async function He(){let e=ce.isRunningWithBun(),t=null;return t=e?await _e(`bun`,[`pm`,`bin`,`-g`],{cwd:D()}):await _e(`npm`,[`-g`,`config`,`get`,`prefix`],{cwd:D()}),t.code===0?t.stdout.trim():(C(Error(`Failed to check ${e?`bun`:`npm`} permissions`)),null)}async function Ue(){try{let e=await He();if(!e)return{hasPermissions:!1,npmPrefix:null};try{return await je(e,Ae.W_OK),{hasPermissions:!0,npmPrefix:e}}catch{return C(new We(`Insufficient permissions for global npm install.`)),{hasPermissions:!1,npmPrefix:e}}}catch(e){return C(e),{hasPermissions:!1,npmPrefix:null}}}var We,Ge=e((()=>{y(),p(),le(),o(),l(),b(),f(),s(),S(),Ce(),pe(),B(),We=class extends ie{}}));function V(e,t){return t.includes(e.id)||e.idLike.some(e=>t.includes(e))}function Ke(){let e=process.execPath||process.argv[0]||``;return/[/\\]mise[/\\]installs[/\\]/i.test(e)?(d(`Detected mise installation: ${e}`),!0):!1}function qe(){let e=process.execPath||process.argv[0]||``;return/[/\\]\.?asdf[/\\]installs[/\\]/i.test(e)?(d(`Detected asdf installation: ${e}`),!0):!1}function H(){let e=T();if(e!==`macos`&&e!==`linux`&&e!==`wsl`)return!1;let t=process.execPath||process.argv[0]||``;return t.includes(`/Caskroom/`)?(d(`Detected Homebrew cask installation: ${t}`),!0):!1}function Je(){if(T()!==`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 d(`Detected winget installation: ${e}`),!0;return!1}var U,W,G,K,q,Ye,Xe=e((()=>{n(),p(),b(),be(),U=t(async()=>{try{let e=await j(`/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}}),W=t(async()=>{if(T()!==`linux`)return!1;let e=await U();if(e&&!V(e,[`arch`]))return!1;let t=await x(`pacman`,[`-Qo`,process.execPath||process.argv[0]||``],{timeout:5e3,useCwd:!1});return t.code===0&&t.stdout?(d(`Detected pacman installation: ${t.stdout.trim()}`),!0):!1}),G=t(async()=>{if(T()!==`linux`)return!1;let e=await U();if(e&&!V(e,[`debian`]))return!1;let t=await x(`dpkg`,[`-S`,process.execPath||process.argv[0]||``],{timeout:5e3,useCwd:!1});return t.code===0&&t.stdout?(d(`Detected deb installation: ${t.stdout.trim()}`),!0):!1}),K=t(async()=>{if(T()!==`linux`)return!1;let e=await U();if(e&&!V(e,[`fedora`,`rhel`,`suse`]))return!1;let t=await x(`rpm`,[`-qf`,process.execPath||process.argv[0]||``],{timeout:5e3,useCwd:!1});return t.code===0&&t.stdout?(d(`Detected rpm installation: ${t.stdout.trim()}`),!0):!1}),q=t(async()=>{if(T()!==`linux`)return!1;let e=await U();if(e&&!V(e,[`alpine`]))return!1;let t=await x(`apk`,[`info`,`--who-owns`,process.execPath||process.argv[0]||``],{timeout:5e3,useCwd:!1});return t.code===0&&t.stdout?(d(`Detected apk installation: ${t.stdout.trim()}`),!0):!1}),Ye=t(async()=>H()?`homebrew`:Je()?`winget`:Ke()?`mise`:qe()?`asdf`:await W()?`pacman`:await q()?`apk`:await G()?`deb`:await K()?`rpm`:`unknown`)}));function Ze(){let e=process.argv[1]||``,t=process.execPath||process.argv[0]||``;return T()===`windows`&&(e=e.split(A.sep).join(k.sep),t=t.split(A.sep).join(k.sep)),[e,t]}async function Qe(){let[e]=Ze();if(E())return H()||Je()||Ke()||qe()||await W()||await G()||await K()||await q()?`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 ge(`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 $e(){if(E()){try{return await Ne(process.execPath)}catch{}try{let e=await w(`claude`);if(e)return e}catch{}try{return await m().stat(O(D(),`.local/bin/claude`)),O(D(),`.local/bin/claude`)}catch{}return`native`}try{return process.argv[0]||`unknown`}catch{return`unknown`}}function et(){try{return E()?process.execPath||`unknown`:process.argv[1]||`unknown`}catch{return`unknown`}}async function tt(){let e=m(),t=[],n=O(D(),`.workmate`,`local`);await N()&&t.push({type:`npm-local`,path:n});let r=[`@anthropic-ai/workmate`],i=await x(`npm`,[`-g`,`config`,`get`,`prefix`]);if(i.code===0&&i.stdout){let n=i.stdout.trim(),a=T()===`windows`,o=a?O(n,`claude`):O(n,`bin`,`claude`),s=!1;try{await e.stat(o),s=!0}catch{}if(s){let e=!1;try{(await Ne(o)).includes(`/Caskroom/`)&&(e=H())}catch{}e||t.push({type:`npm-global`,path:o})}else for(let i of r){let r=a?O(n,`node_modules`,i):O(n,`lib`,`node_modules`,i);try{await e.stat(r),t.push({type:`npm-global-orphan`,path:r})}catch{}}}let a=O(D(),`.local`,`bin`,`claude`);try{await e.stat(a),t.push({type:`native`,path:a})}catch{}if(v().installMethod===`native`){let n=O(D(),`.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 nt(e){let t=[];try{let e=u(await j(O(de(),`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: ${g.join(`, `)}.`});else{let e=n.filter(e=>typeof e==`string`&&!g.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: ${g.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(ke),n=O(D(),`.local`,`bin`),r=n;if(T()===`windows`&&(r=n.split(A.sep).join(k.sep)),!e.some(e=>{let t=e;T()===`windows`&&(t=e.split(A.sep).join(k.sep));let n=t.replace(/\/+$/,``),i=e.replace(/[/\\]+$/,``);return n===r||i===`~/.local/bin`||i===`$HOME/.local/bin`}))if(T()===`windows`){let e=n.split(k.sep).join(A.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=P(),n=I()[e],r=n?n.replace(D(),`~`):`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 N()&&t.push({issue:`Local installation exists but not being used`,fix:`Consider using native installation: claude install`});let r=await R(),i=await ze();return e===`npm-local`&&!await w(`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 rt(){if(T()!==`linux`)return[];let e=[],t=ee.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 it(){let e=await Qe(),t=typeof MACRO<`u`?`0.0.21`:`unknown`,n=await $e(),r=et(),i=await tt(),a=await nt(e);if(a.push(...rt()),e===`native`){let e=i.filter(e=>e.type===`npm-global`||e.type===`npm-global-orphan`||e.type===`npm-local`),t=T()===`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 @anthropic-ai/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 Ue()).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=Te(),ee={working:c.working??!0,mode:c.mode,systemPath:c.mode===`system`?c.path:null,note:c.note??null},te=e===`package-manager`?await Ye():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:te,ripgrepStatus:ee}}var at=e((()=>{ve(),Ge(),xe(),y(),te(),o(),b(),f(),F(),Xe(),be(),we(),c(),fe(),ue(),B(),h(),ye()}));function J(e){return{env:e?.env??process.env,home:e?.homedir??process.env.HOME??D()}}function Y(e,...t){return e.includes(`/`)&&!e.includes(`\\`)&&!/^[A-Za-z]:/.test(e)?k.join(e,...t):O(e,...t)}function ot(e){let{env:t,home:n}=J(e);return t.XDG_STATE_HOME??Y(n,`.local`,`state`)}function st(e){let{env:t,home:n}=J(e);return t.XDG_CACHE_HOME??Y(n,`.cache`)}function ct(e){let{env:t,home:n}=J(e);return t.XDG_DATA_HOME??Y(n,`.local`,`share`)}function lt(e){let{home:t}=J(e);return Y(t,`.local`,`bin`)}var ut=e((()=>{}));function dt(){let e=process.env.ENABLE_PID_BASED_VERSION_LOCKING;return a(e)?!0:(r(e),!1)}function X(e){if(e<=1)return!1;try{return process.kill(e,0),!0}catch{return!1}}function ft(e,t){if(!X(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 Z(e){let t=m();try{let n=t.readFileSync(e,{encoding:`utf8`});if(!n||n.trim()===``)return null;let r=u(n);return typeof r.pid!=`number`||!r.version||!r.execPath?null:r}catch{return null}}function Q(e){let t=Z(e);if(!t)return!1;let{pid:n,execPath:r}=t;if(!X(n))return!1;if(!ft(n,r))return d(`Lock PID ${n} is running but does not appear to be Work Mate - treating as stale`),!1;let i=m();try{let t=i.statSync(e);if(Date.now()-t.mtimeMs>$&&!X(n))return!1}catch{}return!0}function pt(e,t){let n=m(),r=`${e}.tmp.${process.pid}.${Date.now()}`;try{ae(r,re(t,null,2),{encoding:`utf8`,flush:!0}),n.renameSync(r,e)}catch(e){try{n.unlinkSync(r)}catch{}throw e}}async function mt(e,t){let n=m(),r=Oe(e);if(Q(t))return d(`Cannot acquire lock for ${r} - held by PID ${Z(t)?.pid}`),null;let i={pid:process.pid,version:r,execPath:process.execPath,acquiredAt:Date.now()};try{return pt(t,i),Z(t)?.pid===process.pid?(d(`Acquired PID lock for ${r} (PID ${process.pid})`),()=>{try{Z(t)?.pid===process.pid&&(n.unlinkSync(t),d(`Released PID lock for ${r}`))}catch(e){d(`Failed to release lock for ${r}: ${e}`)}}):null}catch(e){return d(`Failed to acquire lock for ${r}: ${e}`),null}}async function ht(e,t){let n=await mt(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 gt(e,t,n){let r=await mt(e,t);if(!r)return!1;try{return await n(),!0}finally{r()}}function _t(e){let t=m(),n=[];try{let r=t.readdirStringSync(e).filter(e=>e.endsWith(`.lock`));for(let t of r){let r=O(e,t),i=Z(r);i&&n.push({version:i.version,pid:i.pid,isProcessRunning:X(i.pid),execPath:i.execPath,acquiredAt:new Date(i.acquiredAt),lockFilePath:r})}}catch(e){if(ne(e))return n;C(oe(e))}return n}function vt(e){let t=m(),n=0;try{let r=t.readdirStringSync(e).filter(e=>e.endsWith(`.lock`));for(let i of r){let r=O(e,i);try{t.lstatSync(r).isDirectory()?(t.rmSync(r,{recursive:!0,force:!0}),n++,d(`Cleaned up legacy directory lock: ${i}`)):Q(r)||(t.unlinkSync(r),n++,d(`Cleaned up stale lock: ${i}`))}catch{}}}catch(e){if(ne(e))return 0;C(oe(e))}return n}var $,yt=e((()=>{p(),o(),l(),f(),Ee(),S(),h(),$=7200*1e3}));export{L as C,F as E,B as S,P as T,Be as _,Q as a,Le as b,gt as c,ct as d,ot as f,at as g,it as h,yt as i,lt as l,Qe as m,vt as n,dt as o,ut as p,_t as r,Z as s,ht as t,st as u,Ge as v,Re as w,I as x,Ve as y};
@@ -0,0 +1 @@
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{$T as t,D as n,Iy as r,Vy as i,_g as a,b as o,bg as s,eE as c,rE as l}from"./loadAgentsDir-C96o6gCj.js";import{I as u,P as d,t as f}from"./src-DL3w8VPk.js";import{t as p}from"./jsx-runtime-Bb4Xn-E0.js";import{Rt as m,Ut as h}from"./state-D5D6QpTX.js";import{a as g,i as _,r as v,t as y}from"./promptEditor-DT6egmcb.js";import{r as b,t as x}from"./staticRender-BVWx0IM1.js";function S({planContent:e,planPath:t,editorName:n}){return(0,w.jsxs)(u,{flexDirection:`column`,children:[(0,w.jsx)(d,{bold:!0,children:`Current Plan`}),(0,w.jsx)(d,{dimColor:!0,children:t}),(0,w.jsx)(u,{marginTop:1,children:(0,w.jsx)(d,{children:e})}),n&&(0,w.jsxs)(u,{marginTop:1,children:[(0,w.jsx)(d,{dimColor:!0,children:`"/plan open"`}),(0,w.jsx)(d,{dimColor:!0,children:` to edit this plan in `}),(0,w.jsx)(d,{bold:!0,dimColor:!0,children:n})]})]})}async function C(e,r,o){let{getAppState:s,setAppState:l}=r,u=s().toolPermissionContext.mode;if(u!==`plan`){m(u,`plan`),l(e=>({...e,toolPermissionContext:a(n(e.toolPermissionContext),{type:`setMode`,mode:`plan`,destination:`session`})}));let t=o.trim();return t&&t!==`open`?e(`Enabled plan mode`,{shouldQuery:!0}):e(`Enabled plan mode`),null}let d=t(),f=c();if(!d)return e(`Already in plan mode. No plan written yet.`),null;if(o.trim().split(/\s+/)[0]===`open`){let t=await y(f);return t.error?e(`Failed to open plan in editor: ${t.error}`):e(`Opened plan in editor: ${f}`),null}let p=_();return e(await b((0,w.jsx)(S,{planContent:d,planPath:f,editorName:p?i(p):void 0}))),null}var w;e((()=>{h(),f(),g(),r(),s(),o(),l(),v(),x(),w=p()}))();export{C 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-DcaKZlRU.js";import{n as i,t as a}from"./figures-5ThXQEtq.js";import{$C as o,$a as s,Ax as c,BC as l,Bh as u,Co as d,Cx as f,Do as p,Dx as m,Eh as h,Eo as g,Ex as _,GS as v,La as y,Lu as b,No as ee,Oh as x,Oo as S,Ox as C,Po as w,Ra as te,Ru as ne,Sx as T,Th as re,To as E,Tx as D,UC as O,Ua as k,WC as A,Wa as ie,Wb as j,Xa as M,_o as N,_x as ae,ao as oe,aw as se,bo as P,bx as ce,co as le,do as ue,eo as de,fo as fe,fw as pe,gx as me,ho as he,jo as F,ko as ge,kx as _e,lu as ve,lw as ye,no as be,np as I,pw as xe,qb as L,rp as R,rw as z,su as Se,uw as Ce,wo as we,wx as Te,xx as Ee,yo as De,zS as Oe,zh as ke}from"./loadAgentsDir-C96o6gCj.js";import{D as Ae,Gr as je,Gt as B,H as Me,I as V,P as H,T as Ne,Wt as Pe,Xn as Fe,ai as Ie,hn as Le,j as Re,k as ze,n as Be,ot as Ve,r as He,t as Ue,x as We,y as Ge}from"./src-DL3w8VPk.js";import{t as Ke}from"./jsx-runtime-Bb4Xn-E0.js";import{P as qe,R as Je,S as Ye,U as Xe,c as Ze,i as Qe,x as $e}from"./debug-D58GQBDG.js";import{In as et,Ln as tt,_t as nt,b as rt,bt as it,d as at,h as ot,s as st}from"./settings-BowI3jp-.js";import{b as ct,h as lt}from"./config-DUTgj3js.js";import{o as ut,s as dt}from"./log-CZ7ploQm.js";import{n as ft,r as pt}from"./analytics-DJobLaWP.js";import{C as mt,y as ht}from"./startupProfiler-B90b5vuq.js";import{l as gt,o as _t}from"./stringUtils-D7oJIyY2.js";import{n as vt,t as yt}from"./pluginStartupCheck-xQbHZ5gf.js";import{a as bt,d as xt,f as St,i as Ct,l as wt,o as Tt,s as Et,u as Dt}from"./pluginOperations-Ca9Lup5G.js";import{a as Ot,c as kt,i as At,n as jt,o as Mt,s as Nt,t as Pt}from"./validatePlugin-DQ_9OCpP.js";import{a as Ft,n as It,o as Lt,r as Rt}from"./pluginFlagging-BSLuTk3M.js";import{i as zt,n as Bt}from"./MCPConnectionManager-CoId-C__.js";import{n as Vt,t as Ht}from"./useExitOnCtrlCDWithKeybindings-L5idX6Kz.js";import{t as Ut}from"./SearchBox-C9xxQzh1.js";import{n as Wt,t as Gt}from"./useSearchInput-Bxl4wGcZ.js";import{a as Kt,c as qt,i as Jt,n as Yt,o as Xt,r as Zt,s as Qt,t as $t}from"./MCPToolListView-BQkQ-hyF.js";import{i as en,n as tn}from"./pluginAutoupdate-aLXhSUVD.js";import*as nn from"path";import*as rn from"fs/promises";function an({inputValue:e,setInputValue:t,cursorOffset:n,setCursorOffset:r,error:i,setError:a,result:o,setResult:s,setViewState:c,onAddComplete:l,cliMode:u=!1}){let d=(0,on.useRef)(!1),[f,p]=(0,on.useState)(!1),[m,h]=(0,on.useState)(``),g=async()=>{let t=e.trim();if(!t){a(`Please enter a marketplace source`);return}let n=await Ot(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{p(!0),h(``);let{name:e,resolvedSource:t}=await oe(n,e=>{h(e)});De(e,{source:t}),ee();let r=n.source;n.source===`github`&&(r=n.repo),pt(`tengu_marketplace_added`,{source_type:r}),l&&await l(),h(``),p(!1),u?s(`Successfully added marketplace: ${e}`):c({type:`browse-marketplace`,targetMarketplace:e})}catch(e){let t=Xe(e);dt(t),a(t.message),h(``),p(!1),s(u?`Error: ${t.message}`:null)}};return(0,on.useEffect)(()=>{e&&!d.current&&!i&&!o&&(d.current=!0,g())},[]),(0,U.jsxs)(V,{flexDirection:`column`,children:[(0,U.jsxs)(V,{flexDirection:`column`,paddingX:1,borderStyle:`round`,children:[(0,U.jsx)(V,{marginBottom:1,children:(0,U.jsx)(H,{bold:!0,children:`Add Marketplace`})}),(0,U.jsxs)(V,{flexDirection:`column`,children:[(0,U.jsx)(H,{children:`Enter marketplace source:`}),(0,U.jsx)(H,{dimColor:!0,children:`Examples:`}),(0,U.jsx)(H,{dimColor:!0,children:` · owner/repo (GitHub)`}),(0,U.jsx)(H,{dimColor:!0,children:` · git@github.com:owner/repo.git (SSH)`}),(0,U.jsx)(H,{dimColor:!0,children:` · https://example.com/marketplace.json`}),(0,U.jsx)(H,{dimColor:!0,children:` · ./path/to/marketplace`}),(0,U.jsx)(V,{marginTop:1,children:(0,U.jsx)(b,{value:e,onChange:t,onSubmit:g,columns:80,cursorOffset:n,onChangeCursorOffset:r,focus:!0,showCursor:!0})})]}),f&&(0,U.jsxs)(V,{marginTop:1,children:[(0,U.jsx)(Se,{}),(0,U.jsx)(H,{children:m||`Adding marketplace to configuration…`})]}),i&&(0,U.jsx)(V,{marginTop:1,children:(0,U.jsx)(H,{color:`error`,children:i})}),o&&(0,U.jsx)(V,{marginTop:1,children:(0,U.jsx)(H,{children:o})})]}),(0,U.jsx)(V,{marginLeft:3,children:(0,U.jsx)(H,{dimColor:!0,italic:!0,children:(0,U.jsxs)(Ne,{children:[(0,U.jsx)(Ae,{shortcut:`Enter`,action:`add`}),(0,U.jsx)(I,{action:`confirm:no`,context:`Settings`,fallback:`Esc`,description:`cancel`})]})})})]})}var on,U,sn=e((()=>{on=t(Ie(),1),ft(),R(),Ue(),ve(),ne(),Je(),ut(),w(),ue(),At(),U=Ke()}));function cn(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 ln({title:e,subtitle:t,configSchema:n,initialValues:r,onSave:i,onCancel:o}){let s=Object.keys(n),c=(0,un.useCallback)(e=>{if(n[e]?.sensitive===!0)return``;let t=r?.[e];return t===void 0?``:String(t)},[n,r]),[l,u]=(0,un.useState)(0),[d,f]=(0,un.useState)({}),[p,m]=(0,un.useState)(()=>s[0]?c(s[0]):``),h=s[l],g=h?n[h]:null;if(Pe(`confirm:no`,o,{context:`Settings`}),B({"confirm:nextField":(0,un.useCallback)(()=>{if(l<s.length-1&&h){f(e=>({...e,[h]:p})),u(e=>e+1);let e=s[l+1];m(e?c(e):``)}},[l,s,h,p,c]),"confirm:yes":(0,un.useCallback)(()=>{if(!h)return;let e={...d,[h]:p};if(l===s.length-1)i(cn(s,e,n,r));else{f(e),u(e=>e+1);let t=s[l+1];m(t?c(t):``)}},[h,d,p,l,s,n,i,c,r])},{context:`Confirmation`}),Le((e,t)=>{if(t.backspace||t.delete){m(e=>e.slice(0,-1));return}e&&!t.ctrl&&!t.meta&&!t.tab&&!t.return&&m(t=>t+e)}),!g||!h)return null;let _=g.sensitive===!0,v=g.required===!0,y=_?`*`.repeat(je(p)):p;return(0,dn.jsxs)(Ge,{title:e,subtitle:t,onCancel:o,isCancelActive:!1,children:[(0,dn.jsxs)(V,{flexDirection:`column`,children:[(0,dn.jsxs)(H,{bold:!0,children:[g.title||h,v&&(0,dn.jsx)(H,{color:`error`,children:` *`})]}),g.description&&(0,dn.jsx)(H,{dimColor:!0,children:g.description}),(0,dn.jsxs)(V,{marginTop:1,children:[(0,dn.jsxs)(H,{children:[a.pointerSmall,` `]}),(0,dn.jsx)(H,{children:y}),(0,dn.jsx)(H,{children:`█`})]})]}),(0,dn.jsxs)(V,{flexDirection:`column`,children:[(0,dn.jsxs)(H,{dimColor:!0,children:[`Field `,l+1,` of `,s.length]}),l<s.length-1&&(0,dn.jsx)(H,{dimColor:!0,children:`Tab: Next field · Enter: Save and continue`}),l===s.length-1&&(0,dn.jsx)(H,{dimColor:!0,children:`Enter: Save configuration`})]})]})}var un,dn,fn=e((()=>{i(),un=t(Ie(),1),Ue(),Oe(),r(),dn=Ke()}));async function pn(e){let{enabled:t,disabled:n}=await te();return[...t,...n].find(t=>t.repository===e||t.source===e)}function mn({plugin:e,pluginId:t,onDone:n}){let[r]=hn.useState(()=>{let n=[],r=ce(e);Object.keys(r).length>0&&n.push({key:`top-level`,title:`Configure ${e.name}`,subtitle:`Plugin options`,schema:r,load:()=>T(t),save:n=>f(t,n,e.manifest.userConfig)});let i=me(e);for(let r of i)n.push({key:`channel:${r.server}`,title:`Configure ${r.displayName}`,subtitle:`Plugin: ${e.name}`,schema:r.configSchema,load:()=>_(t,r.server)??void 0,save:e=>C(t,r.server,e,r.configSchema)});return n}),[i,a]=hn.useState(0),o=hn.useRef(n);if(o.current=n,hn.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`,qe(e));return}let t=i+1;t<r.length?a(t):n(`configured`)}return(0,gn.jsx)(ln,{title:s.title,subtitle:s.subtitle,configSchema:s.schema,initialValues:s.load(),onSave:c,onCancel:()=>n(`skipped`)},s.key)}var hn,gn,_n=e((()=>{hn=t(Ie(),1),Je(),Te(),ae(),y(),Ee(),fn(),gn=Ke()}));function vn(){let e=S();return(0,yn.jsxs)(V,{marginBottom:1,children:[(0,yn.jsxs)(H,{color:`claude`,children:[a.warning,` `]}),(0,yn.jsxs)(H,{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 yn,bn=e((()=>{i(),Ue(),ge(),yn=Ke()}));function xn(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 Sn(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 Cn({hasSelection:e}){return(0,wn.jsx)(V,{marginTop:1,children:(0,wn.jsx)(H,{dimColor:!0,italic:!0,children:(0,wn.jsxs)(Ne,{children:[e&&(0,wn.jsx)(I,{action:`plugin:install`,context:`Plugin`,fallback:`i`,description:`install`,bold:!0}),(0,wn.jsx)(I,{action:`plugin:toggle`,context:`Plugin`,fallback:`Space`,description:`toggle`}),(0,wn.jsx)(I,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`details`}),(0,wn.jsx)(I,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]})})})}var wn,Tn=e((()=>{R(),Ue(),wn=Ke()}));function En({totalItems:e,maxVisible:t=On,selectedIndex:n=0}){let r=e>t,i=(0,Dn.useRef)(0),a=(0,Dn.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,Dn.useCallback)(e=>r?e.slice(o,s):e,[r,o,s]),l=(0,Dn.useCallback)(e=>o+e,[o]),u=(0,Dn.useCallback)(e=>e>=o&&e<s,[o,s]),d=(0,Dn.useCallback)(e=>{},[]),f=(0,Dn.useCallback)(()=>{},[]),p=(0,Dn.useCallback)(()=>{},[]),m=(0,Dn.useCallback)((t,n)=>{n(Math.max(0,Math.min(t,e-1)))},[e]),h=(0,Dn.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 Dn,On,kn=e((()=>{Dn=t(Ie(),1),On=5}));function An({error:e,setError:t,result:n,setResult:r,setViewState:i,onInstallComplete:o,targetMarketplace:l,targetPlugin:f}){let[m,h]=(0,W.useState)(`marketplace-list`),[_,v]=(0,W.useState)(null),[y,b]=(0,W.useState)(null),[x,S]=(0,W.useState)([]),[C,w]=(0,W.useState)([]),[te,ne]=(0,W.useState)(!0),[T,re]=(0,W.useState)(null),[D,O]=(0,W.useState)(0),[k,A]=(0,W.useState)(new Set),[j,M]=(0,W.useState)(new Set),N=En({totalItems:C.length,selectedIndex:D}),[ae,oe]=(0,W.useState)(0),[se,P]=(0,W.useState)(!1),[ce,ue]=(0,W.useState)(null),[pe,me]=(0,W.useState)(null);Pe(`confirm:no`,jn.useCallback(()=>{m===`plugin-list`?l?i({type:`manage-marketplaces`,targetMarketplace:l}):x.length===1?i({type:`menu`}):(h(`marketplace-list`),v(null),A(new Set)):m===`plugin-details`?(h(`plugin-list`),b(null)):i({type:`menu`})},[m,l,i,x.length]),{context:`Confirmation`}),(0,W.useEffect)(()=>{async function e(){try{let e=await fe(),{marketplaces:n,failures:r}=await F(e),i=[];for(let{name:e,config:t,data:r}of n)if(r){let n=et(r.plugins,t=>de(d(t.name,e)));i.push({name:e,totalPlugins:r.plugins.length,installedCount:n,source:p(t.source)})}i.sort((e,t)=>e.name===`claude-plugin-directory`?-1:+(t.name===`claude-plugin-directory`)),S(i);let a=g(r,et(n,e=>e.data!==null));if(a)if(a.type===`warning`)me(`${a.message}. Showing available marketplaces.`);else throw Error(a.message);if(i.length===1&&!l&&!f){let e=i[0];e&&(v(e.name),h(`plugin-list`))}if(f){let n=null,r=null;for(let[t]of Object.entries(e)){let e=await le(t);if(e){let i=e.plugins.find(e=>e.name===f);if(i){let e=d(i.name,t);n={entry:i,marketplaceName:t,pluginId:e,isInstalled:s(e)},r=t;break}}}if(n&&r){let e=n.pluginId;s(e)?t(`Plugin '${e}' is already installed globally. Use '/plugin' to manage existing plugins.`):(v(r),b(n),h(`plugin-details`))}else t(`Plugin "${f}" not found in any marketplace`)}else l&&(i.some(e=>e.name===l)?(v(l),h(`plugin-list`)):t(`Marketplace "${l}" not found`))}catch(e){t(e instanceof Error?e.message:`Failed to load marketplaces`)}finally{ne(!1)}}e()},[t,l,f]),(0,W.useEffect)(()=>{if(!_)return;let e=!1;async function n(n){ne(!0);try{let t=await le(n);if(e)return;if(!t)throw Error(`Failed to load marketplace: ${n}`);let r=[];for(let e of t.plugins){let t=d(e.name,n);u(t)||r.push({entry:e,marketplaceName:n,pluginId:t,isInstalled:s(t)})}try{let t=await Nt();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;Ze(`Failed to fetch install counts: ${qe(t)}`),r.sort((e,t)=>e.entry.name.localeCompare(t.entry.name))}w(r),O(0),A(new Set)}catch(n){if(e)return;t(n instanceof Error?n.message:`Failed to load plugins`)}finally{ne(!1)}}return n(_),()=>{e=!0}},[_,t]);let he=async()=>{if(k.size===0)return;let e=C.filter(e=>k.has(e.pluginId));M(new Set(e.map(e=>e.pluginId)));let n=0,a=0,s=[];for(let t of e){let e=await ie({pluginId:t.pluginId,entry:t.entry,marketplaceName:t.marketplaceName,scope:`user`});e.success?n++:(a++,s.push({name:t.entry.name,reason:e.error}))}M(new Set),A(new Set),ee(),a===0?r(`✓ Installed ${n} ${gt(n,`plugin`)}. Run /reload-plugins to activate.`):n===0?t(`Failed to install: ${E(s,!0)}`):r(`✓ Installed ${n} of ${n+a} plugins. Failed: ${E(s,!1)}. Run /reload-plugins to activate successfully installed plugins.`),n>0&&o&&await o(),i({type:`menu`})},ge=async(e,t=`user`)=>{P(!0),ue(null);let n=await ie({pluginId:e.pluginId,entry:e.entry,marketplaceName:e.marketplaceName,scope:t});if(n.success){let t=await pn(e.pluginId);if(t){P(!1),h({type:`plugin-options`,plugin:t,pluginId:e.pluginId});return}r(n.message),o&&await o(),i({type:`menu`})}else P(!1),ue(n.error)};(0,W.useEffect)(()=>{e&&r(e)},[e,r]),B({"select:previous":()=>{D>0&&O(D-1)},"select:next":()=>{D<x.length-1&&O(D+1)},"select:accept":()=>{let e=x[D];e&&(v(e.name),h(`plugin-list`))}},{context:`Select`,isActive:m===`marketplace-list`}),B({"select:previous":()=>{D>0&&N.handleSelectionChange(D-1,O)},"select:next":()=>{D<C.length-1&&N.handleSelectionChange(D+1,O)},"select:accept":()=>{if(D===C.length&&k.size>0)he();else if(D<C.length){let e=C[D];e&&(e.isInstalled?i({type:`manage-plugins`,targetPlugin:e.entry.name,targetMarketplace:e.marketplaceName}):(b(e),h(`plugin-details`),oe(0),ue(null)))}}},{context:`Select`,isActive:m===`plugin-list`}),B({"plugin:toggle":()=>{if(D<C.length){let e=C[D];if(e&&!e.isInstalled){let t=new Set(k);t.has(e.pluginId)?t.delete(e.pluginId):t.add(e.pluginId),A(t)}}},"plugin:install":()=>{k.size>0&&he()}},{context:`Plugin`,isActive:m===`plugin-list`});let _e=jn.useMemo(()=>{if(!y)return[];let e=y.entry.homepage;return Sn(e,xn(y))},[y]);if(B({"select:previous":()=>{ae>0&&oe(ae-1)},"select:next":()=>{ae<_e.length-1&&oe(ae+1)},"select:accept":()=>{if(!y)return;let e=_e[ae]?.action,t=y.entry.homepage,n=xn(y);e===`install-user`?ge(y,`user`):e===`install-project`?ge(y,`project`):e===`install-local`?ge(y,`local`):e===`homepage`&&t?c(t):e===`github`&&n?c(`https://github.com/${n}`):e===`back`&&(h(`plugin-list`),b(null))}},{context:`Select`,isActive:m===`plugin-details`&&!!y}),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)(mn,{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)(H,{children:`Loading…`});if(e)return(0,G.jsx)(H,{color:`error`,children:e});if(m===`marketplace-list`)return x.length===0?(0,G.jsxs)(V,{flexDirection:`column`,children:[(0,G.jsx)(V,{marginBottom:1,children:(0,G.jsx)(H,{bold:!0,children:`Select marketplace`})}),(0,G.jsx)(H,{children:`No marketplaces configured.`}),(0,G.jsxs)(H,{dimColor:!0,children:[`Add a marketplace first using `,`'Add marketplace'`,`.`]}),(0,G.jsx)(V,{marginTop:1,paddingLeft:1,children:(0,G.jsx)(H,{dimColor:!0,children:(0,G.jsx)(I,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`})})})]}):(0,G.jsxs)(V,{flexDirection:`column`,children:[(0,G.jsx)(V,{marginBottom:1,children:(0,G.jsx)(H,{bold:!0,children:`Select marketplace`})}),pe&&(0,G.jsx)(V,{marginBottom:1,flexDirection:`column`,children:(0,G.jsxs)(H,{color:`warning`,children:[a.warning,` `,pe]})}),x.map((e,t)=>(0,G.jsxs)(V,{flexDirection:`column`,marginBottom:+(t<x.length-1),children:[(0,G.jsx)(V,{children:(0,G.jsxs)(H,{color:D===t?`suggestion`:void 0,children:[D===t?a.pointer:` `,` `,e.name]})}),(0,G.jsx)(V,{marginLeft:2,children:(0,G.jsxs)(H,{dimColor:!0,children:[e.totalPlugins,` `,gt(e.totalPlugins,`plugin`),` available`,e.installedCount>0&&` · ${e.installedCount} already installed`,e.source&&` · ${e.source}`]})})]},e.name)),(0,G.jsx)(V,{marginTop:1,children:(0,G.jsx)(H,{dimColor:!0,italic:!0,children:(0,G.jsxs)(Ne,{children:[(0,G.jsx)(I,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`select`}),(0,G.jsx)(I,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`})]})})})]});if(m===`plugin-details`&&y){let e=y.entry.homepage,t=Sn(e,xn(y));return(0,G.jsxs)(V,{flexDirection:`column`,children:[(0,G.jsx)(V,{marginBottom:1,children:(0,G.jsx)(H,{bold:!0,children:`Plugin Details`})}),(0,G.jsxs)(V,{flexDirection:`column`,marginBottom:1,children:[(0,G.jsx)(H,{bold:!0,children:y.entry.name}),y.entry.version&&(0,G.jsxs)(H,{dimColor:!0,children:[`Version: `,y.entry.version]}),y.entry.description&&(0,G.jsx)(V,{marginTop:1,children:(0,G.jsx)(H,{children:y.entry.description})}),y.entry.author&&(0,G.jsx)(V,{marginTop:1,children:(0,G.jsxs)(H,{dimColor:!0,children:[`By:`,` `,typeof y.entry.author==`string`?y.entry.author:y.entry.author.name]})})]}),(0,G.jsxs)(V,{flexDirection:`column`,marginBottom:1,children:[(0,G.jsx)(H,{bold:!0,children:`Will install:`}),y.entry.commands&&(0,G.jsxs)(H,{dimColor:!0,children:[`· Commands:`,` `,Array.isArray(y.entry.commands)?y.entry.commands.join(`, `):Object.keys(y.entry.commands).join(`, `)]}),y.entry.agents&&(0,G.jsxs)(H,{dimColor:!0,children:[`· Agents:`,` `,Array.isArray(y.entry.agents)?y.entry.agents.join(`, `):Object.keys(y.entry.agents).join(`, `)]}),y.entry.hooks&&(0,G.jsxs)(H,{dimColor:!0,children:[`· Hooks: `,Object.keys(y.entry.hooks).join(`, `)]}),y.entry.mcpServers&&(0,G.jsxs)(H,{dimColor:!0,children:[`· MCP Servers:`,` `,Array.isArray(y.entry.mcpServers)?y.entry.mcpServers.join(`, `):typeof y.entry.mcpServers==`object`?Object.keys(y.entry.mcpServers).join(`, `):`configured`]}),!y.entry.commands&&!y.entry.agents&&!y.entry.hooks&&!y.entry.mcpServers&&(typeof y.entry.source==`object`&&`source`in y.entry.source&&(y.entry.source.source===`github`||y.entry.source.source===`url`||y.entry.source.source===`npm`||y.entry.source.source===`pip`)?(0,G.jsx)(H,{dimColor:!0,children:`· Component summary not available for remote plugin`}):(0,G.jsx)(H,{dimColor:!0,children:`· Components will be discovered at installation`}))]}),(0,G.jsx)(vn,{}),ce&&(0,G.jsx)(V,{marginBottom:1,children:(0,G.jsxs)(H,{color:`error`,children:[`Error: `,ce]})}),(0,G.jsx)(V,{flexDirection:`column`,children:t.map((e,t)=>(0,G.jsxs)(V,{children:[ae===t&&(0,G.jsx)(H,{children:`> `}),ae!==t&&(0,G.jsx)(H,{children:` `}),(0,G.jsx)(H,{bold:ae===t,children:se&&e.action===`install`?`Installing…`:e.label})]},e.action))}),(0,G.jsx)(V,{marginTop:1,paddingLeft:1,children:(0,G.jsx)(H,{dimColor:!0,children:(0,G.jsxs)(Ne,{children:[(0,G.jsx)(I,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`select`}),(0,G.jsx)(I,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]})})})]})}if(C.length===0)return(0,G.jsxs)(V,{flexDirection:`column`,children:[(0,G.jsx)(V,{marginBottom:1,children:(0,G.jsx)(H,{bold:!0,children:`Install plugins`})}),(0,G.jsx)(H,{dimColor:!0,children:`No new plugins available to install.`}),(0,G.jsx)(H,{dimColor:!0,children:`All plugins from this marketplace are already installed.`}),(0,G.jsx)(V,{marginLeft:3,children:(0,G.jsx)(H,{dimColor:!0,italic:!0,children:(0,G.jsx)(I,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`})})})]});let ve=N.getVisibleItems(C);return(0,G.jsxs)(V,{flexDirection:`column`,children:[(0,G.jsx)(V,{marginBottom:1,children:(0,G.jsx)(H,{bold:!0,children:`Install Plugins`})}),N.scrollPosition.canScrollUp&&(0,G.jsx)(V,{children:(0,G.jsxs)(H,{dimColor:!0,children:[` `,a.arrowUp,` more above`]})}),ve.map((t,n)=>{let r=N.toActualIndex(n),i=D===r,o=k.has(t.pluginId),s=j.has(t.pluginId);return(0,G.jsxs)(V,{flexDirection:`column`,marginBottom:n===ve.length-1&&!e?0:1,children:[(0,G.jsxs)(V,{children:[(0,G.jsxs)(H,{color:i?`suggestion`:void 0,children:[i?a.pointer:` `,` `]}),(0,G.jsxs)(H,{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)(H,{dimColor:!0,children:[` [`,t.entry.category,`]`]}),t.entry.tags?.includes(`community-managed`)&&(0,G.jsx)(H,{dimColor:!0,children:` [Community Managed]`}),t.isInstalled&&(0,G.jsx)(H,{dimColor:!0,children:` (installed)`}),T&&_===`claude-plugins-official`&&(0,G.jsxs)(H,{dimColor:!0,children:[` · `,Mt(T.get(t.pluginId)??0),` installs`]})]})]}),t.entry.description&&(0,G.jsxs)(V,{marginLeft:4,children:[(0,G.jsx)(H,{dimColor:!0,children:mt(t.entry.description,60)}),t.entry.version&&(0,G.jsxs)(H,{dimColor:!0,children:[` · v`,t.entry.version]})]})]},t.pluginId)}),N.scrollPosition.canScrollDown&&(0,G.jsx)(V,{children:(0,G.jsxs)(H,{dimColor:!0,children:[` `,a.arrowDown,` more below`]})}),e&&(0,G.jsx)(V,{marginTop:1,children:(0,G.jsxs)(H,{color:`error`,children:[a.cross,` `,e]})}),(0,G.jsx)(Cn,{hasSelection:k.size>0})]})}var jn,W,G,Mn=e((()=>{i(),jn=t(Ie(),1),W=t(Ie(),1),R(),Ue(),Oe(),tt(),_e(),Qe(),Je(),w(),kt(),M(),ge(),ue(),o(),k(),ke(),_t(),ht(),_n(),bn(),Tn(),kn(),G=Ke()}));function Nn({error:e,setError:t,result:n,setResult:r,setViewState:i,onInstallComplete:o,onSearchModeChange:l,targetPlugin:f}){let[p,m]=(0,K.useState)(`plugin-list`),[h,_]=(0,K.useState)(null),[v,y]=(0,K.useState)([]),[b,x]=(0,K.useState)(!0),[S,C]=(0,K.useState)(null),[w,te]=(0,K.useState)(!1),ne=(0,K.useCallback)(e=>{te(e),l?.(e)},[l]),{query:T,setQuery:re,cursorOffset:D}=Wt({isActive:p===`plugin-list`&&w&&!b,onExit:()=>{ne(!1)}}),O=Fe(),{columns:k}=Ve(),A=(0,K.useMemo)(()=>{if(!T)return v;let e=T.toLowerCase();return v.filter(t=>t.entry.name.toLowerCase().includes(e)||t.entry.description?.toLowerCase().includes(e)||t.marketplaceName.toLowerCase().includes(e))},[v,T]),[j,M]=(0,K.useState)(0),[N,ae]=(0,K.useState)(new Set),[oe,se]=(0,K.useState)(new Set),P=En({totalItems:A.length,selectedIndex:j});(0,K.useEffect)(()=>{M(0)},[T]);let[ce,le]=(0,K.useState)(0),[ue,de]=(0,K.useState)(!1),[pe,me]=(0,K.useState)(null),[he,ge]=(0,K.useState)(null),[_e,ve]=(0,K.useState)(null);(0,K.useEffect)(()=>{async function e(){try{let e=await fe(),{marketplaces:n,failures:r}=await F(e),i=[];for(let{name:e,data:t}of n)if(t)for(let n of t.plugins){let t=d(n.name,e);i.push({entry:n,marketplaceName:e,pluginId:t,isInstalled:s(t)})}let a=i.filter(e=>!e.isInstalled&&!u(e.pluginId));try{let e=await Nt();C(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){Ze(`Failed to fetch install counts: ${qe(e)}`),a.sort((e,t)=>e.entry.name.localeCompare(t.entry.name))}y(a);let o=Object.keys(e).length;if(a.length===0){let e=await we({configuredMarketplaceCount:o,failedMarketplaceCount:r.length});ve(e)}let c=g(r,et(n,e=>e.data!==null));if(c)if(c.type===`warning`)ge(`${c.message}. Showing available plugins.`);else throw Error(c.message);if(f){let e=i.find(e=>e.entry.name===f);e?e.isInstalled?t(`Plugin '${e.pluginId}' is already installed. Use '/plugin' to manage existing plugins.`):(_(e),m(`plugin-details`)):t(`Plugin "${f}" not found in any marketplace`)}}catch(e){t(e instanceof Error?e.message:`Failed to load plugins`)}finally{x(!1)}}e()},[t,f]);let ye=async()=>{if(N.size===0)return;let e=v.filter(e=>N.has(e.pluginId));se(new Set(e.map(e=>e.pluginId)));let n=0,a=0,s=[];for(let t of e){let e=await ie({pluginId:t.pluginId,entry:t.entry,marketplaceName:t.marketplaceName,scope:`user`});e.success?n++:(a++,s.push({name:t.entry.name,reason:e.error}))}se(new Set),ae(new Set),ee(),a===0?r(`✓ Installed ${n} ${gt(n,`plugin`)}. Run /reload-plugins to activate.`):n===0?t(`Failed to install: ${E(s,!0)}`):r(`✓ Installed ${n} of ${n+a} plugins. Failed: ${E(s,!1)}. Run /reload-plugins to activate successfully installed plugins.`),n>0&&o&&await o(),i({type:`menu`})},be=async(e,t=`user`)=>{de(!0),me(null);let n=await ie({pluginId:e.pluginId,entry:e.entry,marketplaceName:e.marketplaceName,scope:t});if(n.success){let t=await pn(e.pluginId);if(t){de(!1),m({type:`plugin-options`,plugin:t,pluginId:e.pluginId});return}r(n.message),o&&await o(),i({type:`menu`})}else de(!1),me(n.error)};(0,K.useEffect)(()=>{e&&r(e)},[e,r]),Pe(`confirm:no`,()=>{m(`plugin-list`),_(null)},{context:`Confirmation`,isActive:p===`plugin-details`}),Pe(`confirm:no`,()=>{i({type:`menu`})},{context:`Confirmation`,isActive:p===`plugin-list`&&!w}),Le((e,t)=>{let n=!t.ctrl&&!t.meta;w||(e===`/`&&n?(ne(!0),re(``)):n&&e.length>0&&!/^\s+$/.test(e)&&e!==`j`&&e!==`k`&&e!==`i`&&(ne(!0),re(e)))},{isActive:p===`plugin-list`&&!b}),B({"select:previous":()=>{j===0?ne(!0):P.handleSelectionChange(j-1,M)},"select:next":()=>{j<A.length-1&&P.handleSelectionChange(j+1,M)},"select:accept":()=>{if(j===A.length&&N.size>0)ye();else if(j<A.length){let e=A[j];e&&(e.isInstalled?i({type:`manage-plugins`,targetPlugin:e.entry.name,targetMarketplace:e.marketplaceName}):(_(e),m(`plugin-details`),le(0),me(null)))}}},{context:`Select`,isActive:p===`plugin-list`&&!w}),B({"plugin:toggle":()=>{if(j<A.length){let e=A[j];if(e&&!e.isInstalled){let t=new Set(N);t.has(e.pluginId)?t.delete(e.pluginId):t.add(e.pluginId),ae(t)}}},"plugin:install":()=>{N.size>0&&ye()}},{context:`Plugin`,isActive:p===`plugin-list`&&!w});let xe=In.useMemo(()=>{if(!h)return[];let e=h.entry.homepage;return Sn(e,xn(h))},[h]);if(B({"select:previous":()=>{ce>0&&le(ce-1)},"select:next":()=>{ce<xe.length-1&&le(ce+1)},"select:accept":()=>{if(!h)return;let e=xe[ce]?.action,t=h.entry.homepage,n=xn(h);e===`install-user`?be(h,`user`):e===`install-project`?be(h,`project`):e===`install-local`?be(h,`local`):e===`homepage`&&t?c(t):e===`github`&&n?c(`https://github.com/${n}`):e===`back`&&(m(`plugin-list`),_(null))}},{context:`Select`,isActive:p===`plugin-details`&&!!h}),typeof p==`object`&&p.type===`plugin-options`){let{plugin:e,pluginId:t}=p;function n(e){r(e),o&&o(),i({type:`menu`})}return(0,q.jsx)(mn,{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(b)return(0,q.jsx)(H,{children:`Loading…`});if(e)return(0,q.jsx)(H,{color:`error`,children:e});if(p===`plugin-details`&&h){let e=h.entry.homepage,t=Sn(e,xn(h));return(0,q.jsxs)(V,{flexDirection:`column`,children:[(0,q.jsx)(V,{marginBottom:1,children:(0,q.jsx)(H,{bold:!0,children:`Plugin details`})}),(0,q.jsxs)(V,{flexDirection:`column`,marginBottom:1,children:[(0,q.jsx)(H,{bold:!0,children:h.entry.name}),(0,q.jsxs)(H,{dimColor:!0,children:[`from `,h.marketplaceName]}),h.entry.version&&(0,q.jsxs)(H,{dimColor:!0,children:[`Version: `,h.entry.version]}),h.entry.description&&(0,q.jsx)(V,{marginTop:1,children:(0,q.jsx)(H,{children:h.entry.description})}),h.entry.author&&(0,q.jsx)(V,{marginTop:1,children:(0,q.jsxs)(H,{dimColor:!0,children:[`By:`,` `,typeof h.entry.author==`string`?h.entry.author:h.entry.author.name]})})]}),(0,q.jsx)(vn,{}),pe&&(0,q.jsx)(V,{marginBottom:1,children:(0,q.jsxs)(H,{color:`error`,children:[`Error: `,pe]})}),(0,q.jsx)(V,{flexDirection:`column`,children:t.map((e,t)=>(0,q.jsxs)(V,{children:[ce===t&&(0,q.jsx)(H,{children:`> `}),ce!==t&&(0,q.jsx)(H,{children:` `}),(0,q.jsx)(H,{bold:ce===t,children:ue&&e.action.startsWith(`install-`)?`Installing…`:e.label})]},e.action))}),(0,q.jsx)(V,{marginTop:1,children:(0,q.jsx)(H,{dimColor:!0,children:(0,q.jsxs)(Ne,{children:[(0,q.jsx)(I,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`select`}),(0,q.jsx)(I,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]})})})]})}if(v.length===0)return(0,q.jsxs)(V,{flexDirection:`column`,children:[(0,q.jsx)(V,{marginBottom:1,children:(0,q.jsx)(H,{bold:!0,children:`Discover plugins`})}),(0,q.jsx)(Fn,{reason:_e}),(0,q.jsx)(V,{marginTop:1,children:(0,q.jsx)(H,{dimColor:!0,italic:!0,children:`Esc to go back`})})]});let L=P.getVisibleItems(A);return(0,q.jsxs)(V,{flexDirection:`column`,children:[(0,q.jsxs)(V,{children:[(0,q.jsx)(H,{bold:!0,children:`Discover plugins`}),P.needsPagination&&(0,q.jsxs)(H,{dimColor:!0,children:[` `,`(`,P.scrollPosition.current,`/`,P.scrollPosition.total,`)`]})]}),(0,q.jsx)(V,{marginBottom:1,children:(0,q.jsx)(ze,{query:T,isFocused:w,isTerminalFocused:O,width:k-4,cursorOffset:D})}),he&&(0,q.jsx)(V,{marginBottom:1,children:(0,q.jsxs)(H,{color:`warning`,children:[a.warning,` `,he]})}),A.length===0&&T&&(0,q.jsx)(V,{marginBottom:1,children:(0,q.jsxs)(H,{dimColor:!0,children:[`No plugins match "`,T,`"`]})}),P.scrollPosition.canScrollUp&&(0,q.jsx)(V,{children:(0,q.jsxs)(H,{dimColor:!0,children:[` `,a.arrowUp,` more above`]})}),L.map((t,n)=>{let r=P.toActualIndex(n),i=j===r,o=N.has(t.pluginId),s=oe.has(t.pluginId);return(0,q.jsxs)(V,{flexDirection:`column`,marginBottom:n===L.length-1&&!e?0:1,children:[(0,q.jsxs)(V,{children:[(0,q.jsxs)(H,{color:i&&!w?`suggestion`:void 0,children:[i&&!w?a.pointer:` `,` `]}),(0,q.jsxs)(H,{children:[s?a.ellipsis:o?a.radioOn:a.radioOff,` `,t.entry.name,(0,q.jsxs)(H,{dimColor:!0,children:[` · `,t.marketplaceName]}),t.entry.tags?.includes(`community-managed`)&&(0,q.jsx)(H,{dimColor:!0,children:` [Community Managed]`}),S&&t.marketplaceName===`claude-plugins-official`&&(0,q.jsxs)(H,{dimColor:!0,children:[` · `,Mt(S.get(t.pluginId)??0),` installs`]})]})]}),t.entry.description&&(0,q.jsx)(V,{marginLeft:4,children:(0,q.jsx)(H,{dimColor:!0,children:mt(t.entry.description,60)})})]},`${P.startIndex}-${t.pluginId}`)}),P.scrollPosition.canScrollDown&&(0,q.jsx)(V,{children:(0,q.jsxs)(H,{dimColor:!0,children:[` `,a.arrowDown,` more below`]})}),e&&(0,q.jsx)(V,{marginTop:1,children:(0,q.jsxs)(H,{color:`error`,children:[a.cross,` `,e]})}),(0,q.jsx)(Pn,{hasSelection:N.size>0,canToggle:j<A.length&&!A[j]?.isInstalled})]})}function Pn({hasSelection:e,canToggle:t}){return(0,q.jsx)(V,{marginTop:1,children:(0,q.jsx)(H,{dimColor:!0,italic:!0,children:(0,q.jsxs)(Ne,{children:[e&&(0,q.jsx)(I,{action:`plugin:install`,context:`Plugin`,fallback:`i`,description:`install`,bold:!0}),(0,q.jsx)(H,{children:`type to search`}),t&&(0,q.jsx)(I,{action:`plugin:toggle`,context:`Plugin`,fallback:`Space`,description:`toggle`}),(0,q.jsx)(I,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`details`}),(0,q.jsx)(I,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]})})})}function Fn({reason:e}){switch(e){case`git-not-installed`:return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(H,{dimColor:!0,children:`Git is required to install marketplaces.`}),(0,q.jsx)(H,{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)(H,{dimColor:!0,children:`Your organization policy does not allow any external marketplaces.`}),(0,q.jsx)(H,{dimColor:!0,children:`Contact your administrator.`})]});case`policy-restricts-sources`:return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(H,{dimColor:!0,children:`Your organization restricts which marketplaces can be added.`}),(0,q.jsx)(H,{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)(H,{dimColor:!0,children:`Failed to load marketplace data.`}),(0,q.jsx)(H,{dimColor:!0,children:`Check your network connection.`})]});case`all-plugins-installed`:return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(H,{dimColor:!0,children:`All available plugins are already installed.`}),(0,q.jsx)(H,{dimColor:!0,children:`Check for new plugins later or add more marketplaces.`})]});default:return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(H,{dimColor:!0,children:`No plugins available.`}),(0,q.jsx)(H,{dimColor:!0,children:`Add a marketplace first using the Marketplaces tab.`})]})}}var In,K,q,Ln=e((()=>{i(),In=t(Ie(),1),K=t(Ie(),1),R(),Ut(),Ue(),Gt(),v(),Oe(),tt(),_e(),Qe(),Je(),w(),kt(),M(),ge(),ue(),o(),k(),ke(),_t(),ht(),_n(),bn(),Tn(),kn(),q=Ke()}));function Rn({setViewState:e,error:t,setError:n,setResult:r,exitState:i,onManageComplete:o,targetMarketplace:s,action:c}){let[l,u]=(0,Bn.useState)([]),[f,m]=(0,Bn.useState)(!0),[h,_]=(0,Bn.useState)(0),[v,y]=(0,Bn.useState)(!1),[b,x]=(0,Bn.useState)(null),[S,C]=(0,Bn.useState)(null),[w,ne]=(0,Bn.useState)(null),[T,re]=(0,Bn.useState)(`list`),[E,D]=(0,Bn.useState)(null),[O,k]=(0,Bn.useState)(0),A=(0,Bn.useRef)(!1);(0,Bn.useEffect)(()=>{async function e(){try{let e=await fe(),{enabled:r,disabled:i}=await te(),a=[...r,...i],{marketplaces:o,failures:l}=await F(e),d=[];for(let{name:e,config:t,data:n}of o){let r=a.filter(t=>t.source.endsWith(`@${e}`));d.push({name:e,source:p(t.source),lastUpdated:t.lastUpdated,pluginCount:n?.plugins.length,installedPlugins:r,pendingUpdate:!1,pendingRemove:!1,autoUpdate:it(e,t)})}d.sort((e,t)=>e.name===`claude-plugin-directory`?-1:t.name===`claude-plugin-directory`?1:e.name.localeCompare(t.name)),u(d);let f=g(l,et(o,e=>e.data!==null));if(f)if(f.type===`warning`)x(f.message);else throw Error(f.message);if(s&&!A.current&&!t){A.current=!0;let e=d.findIndex(e=>e.name===s);if(e>=0){let t=d[e];if(c){_(e+1);let t=[...d];c===`update`?t[e].pendingUpdate=!0:c===`remove`&&(t[e].pendingRemove=!0),u(t),setTimeout(M,100,t)}else t&&(_(e+1),D(t),re(`details`))}else n&&n(`Marketplace not found: ${s}`)}}catch(e){n&&n(e instanceof Error?e.message:`Failed to load marketplaces`),x(e instanceof Error?e.message:`Failed to load marketplaces`)}finally{m(!1)}}e()},[s,c,t]);let ie=()=>l.some(e=>e.pendingUpdate||e.pendingRemove),j=()=>({updateCount:et(l,e=>e.pendingUpdate),removeCount:et(l,e=>e.pendingRemove)}),M=async t=>{let i=t||l,s=T===`details`;y(!0),x(null),C(null),ne(null);try{let t=st(`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=d(t.name,e.name);n[r]=!1}rt(`userSettings`,{enabledPlugins:n})}await N(e.name),c++,pt(`tengu_marketplace_removed`,{marketplace_name:e.name,plugins_uninstalled:e.installedPlugins?.length||0});continue}e.pendingUpdate&&(await he(e.name,e=>{ne(e)}),n++,l.add(e.name.toLowerCase()),pt(`tengu_marketplace_updated`,{marketplace_name:e.name}))}let f=0;l.size>0&&(f=(await en(l)).length),ee(),o&&await o();let m=await fe(),{enabled:h,disabled:g}=await te(),_=[...h,...g],{marketplaces:v}=await F(m),y=[];for(let{name:e,config:t,data:n}of v){let r=_.filter(t=>t.source.endsWith(`@${e}`));y.push({name:e,source:p(t.source),lastUpdated:t.lastUpdated,pluginCount:n?.plugins.length,installedPlugins:r,pendingUpdate:!1,pendingRemove:!1,autoUpdate:it(e,t)})}if(y.sort((e,t)=>e.name===`claude-plugin-directory`?-1:t.name===`claude-plugin-directory`?1:e.name.localeCompare(t.name)),u(y),s&&E){let e=y.find(e=>e.name===E.name);e&&D(e)}let b=[];if(n>0){let e=f>0?` (${f} ${gt(f,`plugin`)} bumped)`:``;b.push(`Updated ${n} ${gt(n,`marketplace`)}${e}`)}if(c>0&&b.push(`Removed ${c} ${gt(c,`marketplace`)}`),b.length>0){let t=`${a.tick} ${b.join(`, `)}`;s?C(t):(r(t),setTimeout(e,2e3,{type:`menu`}))}else s||e({type:`menu`})}catch(e){let t=qe(e);x(t),n&&n(t)}finally{y(!1),ne(null)}},ae=async()=>{if(!E)return;let e=l.map(e=>e.name===E.name?{...e,pendingRemove:!0}:e);u(e),await M(e)},oe=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 ct()||t.push({label:e.autoUpdate?`Disable auto-update`:`Enable auto-update`,value:`toggle-auto-update`}),t.push({label:`Remove marketplace`,value:`remove`}),t},se=async e=>{let t=!e.autoUpdate;try{await P(e.name,t),u(n=>n.map(n=>n.name===e.name?{...n,autoUpdate:t}:n)),D(e=>e&&{...e,autoUpdate:t})}catch(e){x(e instanceof Error?e.message:`Failed to update setting`)}};if(Pe(`confirm:no`,()=>{re(`list`),k(0)},{context:`Confirmation`,isActive:!v&&(T===`details`||T===`confirm-remove`)}),Pe(`confirm:no`,()=>{u(e=>e.map(e=>({...e,pendingUpdate:!1,pendingRemove:!1}))),_(0)},{context:`Confirmation`,isActive:!v&&T===`list`&&ie()}),Pe(`confirm:no`,()=>{e({type:`menu`})},{context:`Confirmation`,isActive:!v&&T===`list`&&!ie()}),B({"select:previous":()=>_(e=>Math.max(0,e-1)),"select:next":()=>{let e=l.length+1;_(t=>Math.min(e-1,t+1))},"select:accept":()=>{let t=h-1;if(h===0)e({type:`add-marketplace`});else if(ie())M();else{let e=l[t];e&&(D(e),re(`details`),k(0))}}},{context:`Select`,isActive:!v&&T===`list`}),Le(e=>{let t=h-1;if((e===`u`||e===`U`)&&t>=0)u(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=l[t];e&&(D(e),re(`confirm-remove`))}},{isActive:!v&&T===`list`}),B({"select:previous":()=>k(e=>Math.max(0,e-1)),"select:next":()=>{let e=oe(E);k(t=>Math.min(e.length-1,t+1))},"select:accept":()=>{if(!E)return;let t=oe(E)[O];if(t?.value===`browse`)e({type:`browse-marketplace`,targetMarketplace:E.name});else if(t?.value===`update`){let e=l.map(e=>e.name===E.name?{...e,pendingUpdate:!0}:e);u(e),M(e)}else t?.value===`toggle-auto-update`?se(E):t?.value===`remove`&&re(`confirm-remove`)}},{context:`Select`,isActive:!v&&T===`details`}),Le(e=>{e===`y`||e===`Y`?ae():(e===`n`||e===`N`)&&(re(`list`),D(null))},{isActive:!v&&T===`confirm-remove`}),f)return(0,J.jsx)(H,{children:`Loading marketplaces…`});if(l.length===0)return(0,J.jsxs)(V,{flexDirection:`column`,children:[(0,J.jsx)(V,{marginBottom:1,children:(0,J.jsx)(H,{bold:!0,children:`Manage marketplaces`})}),(0,J.jsxs)(V,{flexDirection:`row`,gap:1,children:[(0,J.jsxs)(H,{color:`suggestion`,children:[a.pointer,` +`]}),(0,J.jsx)(H,{bold:!0,color:`suggestion`,children:`Add Marketplace`})]}),(0,J.jsx)(V,{marginLeft:3,children:(0,J.jsx)(H,{dimColor:!0,italic:!0,children:i.pending?(0,J.jsxs)(J.Fragment,{children:[`Press `,i.keyName,` again to go back`]}):(0,J.jsxs)(Ne,{children:[(0,J.jsx)(I,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`select`}),(0,J.jsx)(I,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`})]})})})]});if(T===`confirm-remove`&&E){let e=E.installedPlugins?.length||0;return(0,J.jsxs)(V,{flexDirection:`column`,children:[(0,J.jsxs)(H,{bold:!0,color:`warning`,children:[`Remove marketplace `,(0,J.jsx)(H,{italic:!0,children:E.name}),`?`]}),(0,J.jsxs)(V,{flexDirection:`column`,children:[e>0&&(0,J.jsx)(V,{marginTop:1,children:(0,J.jsxs)(H,{color:`warning`,children:[`This will also uninstall `,e,` `,gt(e,`plugin`),` from this marketplace:`]})}),E.installedPlugins&&E.installedPlugins.length>0&&(0,J.jsx)(V,{flexDirection:`column`,marginTop:1,marginLeft:2,children:E.installedPlugins.map(e=>(0,J.jsxs)(H,{dimColor:!0,children:[`• `,e.name]},e.name))}),(0,J.jsx)(V,{marginTop:1,children:(0,J.jsxs)(H,{children:[`Press `,(0,J.jsx)(H,{bold:!0,children:`y`}),` to confirm or `,(0,J.jsx)(H,{bold:!0,children:`n`}),` to cancel`]})})]})]})}if(T===`details`&&E){let e=E.pendingUpdate||v,t=oe(E);return(0,J.jsxs)(V,{flexDirection:`column`,children:[(0,J.jsx)(H,{bold:!0,children:E.name}),(0,J.jsx)(H,{dimColor:!0,children:E.source}),(0,J.jsx)(V,{marginTop:1,children:(0,J.jsxs)(H,{children:[E.pluginCount||0,` available `,gt(E.pluginCount||0,`plugin`)]})}),E.installedPlugins&&E.installedPlugins.length>0&&(0,J.jsxs)(V,{flexDirection:`column`,marginTop:1,children:[(0,J.jsxs)(H,{bold:!0,children:[`Installed plugins (`,E.installedPlugins.length,`):`]}),(0,J.jsx)(V,{flexDirection:`column`,marginLeft:1,children:E.installedPlugins.map(e=>(0,J.jsxs)(V,{flexDirection:`row`,gap:1,children:[(0,J.jsx)(H,{children:a.bullet}),(0,J.jsxs)(V,{flexDirection:`column`,children:[(0,J.jsx)(H,{children:e.name}),(0,J.jsx)(H,{dimColor:!0,children:e.manifest.description})]})]},e.name))})]}),e&&(0,J.jsxs)(V,{marginTop:1,flexDirection:`column`,children:[(0,J.jsx)(H,{color:`claude`,children:`Updating marketplace…`}),w&&(0,J.jsx)(H,{dimColor:!0,children:w})]}),!e&&S&&(0,J.jsx)(V,{marginTop:1,children:(0,J.jsx)(H,{color:`claude`,children:S})}),!e&&b&&(0,J.jsx)(V,{marginTop:1,children:(0,J.jsx)(H,{color:`error`,children:b})}),!e&&(0,J.jsx)(V,{flexDirection:`column`,marginTop:1,children:t.map((e,t)=>{if(!e)return null;let n=t===O;return(0,J.jsxs)(V,{children:[(0,J.jsxs)(H,{color:n?`suggestion`:void 0,children:[n?a.pointer:` `,` `,e.label]}),e.secondaryLabel&&(0,J.jsxs)(H,{dimColor:!0,children:[` `,e.secondaryLabel]})]},e.value)})}),!e&&!ct()&&E.autoUpdate&&(0,J.jsx)(V,{marginTop:1,children:(0,J.jsx)(H,{dimColor:!0,children:`Auto-update enabled. Work Mate will automatically update this marketplace and its installed plugins.`})}),(0,J.jsx)(V,{marginLeft:3,children:(0,J.jsx)(H,{dimColor:!0,italic:!0,children:e?(0,J.jsx)(J.Fragment,{children:`Please wait…`}):(0,J.jsxs)(Ne,{children:[(0,J.jsx)(I,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`select`}),(0,J.jsx)(I,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`})]})})})]})}let{updateCount:ce,removeCount:le}=j();return(0,J.jsxs)(V,{flexDirection:`column`,children:[(0,J.jsx)(V,{marginBottom:1,children:(0,J.jsx)(H,{bold:!0,children:`Manage marketplaces`})}),(0,J.jsxs)(V,{flexDirection:`row`,gap:1,marginBottom:1,children:[(0,J.jsxs)(H,{color:h===0?`suggestion`:void 0,children:[h===0?a.pointer:` `,` +`]}),(0,J.jsx)(H,{bold:!0,color:h===0?`suggestion`:void 0,children:`Add Marketplace`})]}),(0,J.jsx)(V,{flexDirection:`column`,children:l.map((e,t)=>{let n=t+1===h,r=[];return e.pendingUpdate&&r.push(`UPDATE`),e.pendingRemove&&r.push(`REMOVE`),(0,J.jsxs)(V,{flexDirection:`row`,gap:1,marginBottom:1,children:[(0,J.jsxs)(H,{color:n?`suggestion`:void 0,children:[n?a.pointer:` `,` `,e.pendingRemove?a.cross:a.bullet]}),(0,J.jsxs)(V,{flexDirection:`column`,flexGrow:1,children:[(0,J.jsxs)(V,{flexDirection:`row`,gap:1,children:[(0,J.jsxs)(H,{bold:!0,strikethrough:e.pendingRemove,dimColor:e.pendingRemove,children:[e.name===`claude-plugins-official`&&(0,J.jsx)(H,{color:`claude`,children:`✻ `}),e.name,e.name===`claude-plugins-official`&&(0,J.jsx)(H,{color:`claude`,children:` ✻`})]}),r.length>0&&(0,J.jsxs)(H,{color:`warning`,children:[`[`,r.join(`, `),`]`]})]}),(0,J.jsx)(H,{dimColor:!0,children:e.source}),(0,J.jsxs)(H,{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)})}),ie()&&(0,J.jsxs)(V,{marginTop:1,flexDirection:`column`,children:[(0,J.jsxs)(H,{children:[(0,J.jsx)(H,{bold:!0,children:`Pending changes:`}),` `,(0,J.jsx)(H,{dimColor:!0,children:`Enter to apply`})]}),ce>0&&(0,J.jsxs)(H,{children:[`• Update `,ce,` `,gt(ce,`marketplace`)]}),le>0&&(0,J.jsxs)(H,{color:`warning`,children:[`• Remove `,le,` `,gt(le,`marketplace`)]})]}),v&&(0,J.jsx)(V,{marginTop:1,children:(0,J.jsx)(H,{color:`claude`,children:`Processing changes…`})}),b&&(0,J.jsx)(V,{marginTop:1,children:(0,J.jsx)(H,{color:`error`,children:b})}),(0,J.jsx)(zn,{exitState:i,hasPendingActions:ie()})]})}function zn({exitState:e,hasPendingActions:t}){return e.pending?(0,J.jsx)(V,{marginTop:1,children:(0,J.jsxs)(H,{dimColor:!0,italic:!0,children:[`Press `,e.keyName,` again to go back`]})}):(0,J.jsx)(V,{marginTop:1,children:(0,J.jsx)(H,{dimColor:!0,italic:!0,children:(0,J.jsxs)(Ne,{children:[t&&(0,J.jsx)(I,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`apply changes`}),!t&&(0,J.jsx)(I,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`select`}),!t&&(0,J.jsx)(Ae,{shortcut:`u`,action:`update`}),!t&&(0,J.jsx)(Ae,{shortcut:`r`,action:`remove`}),(0,J.jsx)(I,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:t?`cancel`:`go back`})]})})})}var Bn,J,Vn=e((()=>{i(),Bn=t(Ie(),1),ft(),R(),Ue(),Oe(),tt(),lt(),Je(),w(),ge(),ue(),tn(),y(),nt(),ot(),_t(),J=Ke()}));function Hn(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 pe(e)}function Un(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 Wn=e((()=>{xe()}));function Gn({item:e,isSelected:t}){let[n]=Me();if(e.type===`plugin`){let r,i;return e.pendingToggle?(r=Re(`suggestion`,n)(a.arrowRight),i=e.pendingToggle===`will-enable`?`will enable`:`will disable`):e.errorCount>0?(r=Re(`error`,n)(a.cross),i=`${e.errorCount} ${gt(e.errorCount,`error`)}`):e.isEnabled?(r=Re(`success`,n)(a.tick),i=`enabled`):(r=Re(`inactive`,n)(a.radioOff),i=`disabled`),(0,Y.jsxs)(V,{children:[(0,Y.jsx)(H,{color:t?`suggestion`:void 0,children:t?`${a.pointer} `:` `}),(0,Y.jsx)(H,{color:t?`suggestion`:void 0,children:e.name}),(0,Y.jsxs)(H,{dimColor:!t,children:[` `,(0,Y.jsx)(H,{backgroundColor:`userMessageBackground`,children:`Plugin`})]}),(0,Y.jsxs)(H,{dimColor:!0,children:[` · `,e.marketplace]}),(0,Y.jsxs)(H,{dimColor:!t,children:[` · `,r,` `]}),(0,Y.jsx)(H,{dimColor:!t,children:i})]})}if(e.type===`flagged-plugin`){let r=Re(`warning`,n)(a.warning);return(0,Y.jsxs)(V,{children:[(0,Y.jsx)(H,{color:t?`suggestion`:void 0,children:t?`${a.pointer} `:` `}),(0,Y.jsx)(H,{color:t?`suggestion`:void 0,children:e.name}),(0,Y.jsxs)(H,{dimColor:!t,children:[` `,(0,Y.jsx)(H,{backgroundColor:`userMessageBackground`,children:`Plugin`})]}),(0,Y.jsxs)(H,{dimColor:!0,children:[` · `,e.marketplace]}),(0,Y.jsxs)(H,{dimColor:!t,children:[` · `,r,` `]}),(0,Y.jsx)(H,{dimColor:!t,children:`removed`})]})}if(e.type===`failed-plugin`){let r=Re(`error`,n)(a.cross),i=`failed to load · ${e.errorCount} ${gt(e.errorCount,`error`)}`;return(0,Y.jsxs)(V,{children:[(0,Y.jsx)(H,{color:t?`suggestion`:void 0,children:t?`${a.pointer} `:` `}),(0,Y.jsx)(H,{color:t?`suggestion`:void 0,children:e.name}),(0,Y.jsxs)(H,{dimColor:!t,children:[` `,(0,Y.jsx)(H,{backgroundColor:`userMessageBackground`,children:`Plugin`})]}),(0,Y.jsxs)(H,{dimColor:!0,children:[` · `,e.marketplace]}),(0,Y.jsxs)(H,{dimColor:!t,children:[` · `,r,` `]}),(0,Y.jsx)(H,{dimColor:!t,children:i})]})}let r,i;return e.status===`connected`?(r=Re(`success`,n)(a.tick),i=`connected`):e.status===`disabled`?(r=Re(`inactive`,n)(a.radioOff),i=`disabled`):e.status===`pending`?(r=Re(`inactive`,n)(a.radioOff),i=`connecting…`):e.status===`needs-auth`?(r=Re(`warning`,n)(a.triangleUpOutline),i=`Enter to auth`):(r=Re(`error`,n)(a.cross),i=`failed`),e.indented?(0,Y.jsxs)(V,{children:[(0,Y.jsx)(H,{color:t?`suggestion`:void 0,children:t?`${a.pointer} `:` `}),(0,Y.jsx)(H,{dimColor:!t,children:`└ `}),(0,Y.jsx)(H,{color:t?`suggestion`:void 0,children:e.name}),(0,Y.jsxs)(H,{dimColor:!t,children:[` `,(0,Y.jsx)(H,{backgroundColor:`userMessageBackground`,children:`MCP`})]}),(0,Y.jsxs)(H,{dimColor:!t,children:[` · `,r,` `]}),(0,Y.jsx)(H,{dimColor:!t,children:i})]}):(0,Y.jsxs)(V,{children:[(0,Y.jsx)(H,{color:t?`suggestion`:void 0,children:t?`${a.pointer} `:` `}),(0,Y.jsx)(H,{color:t?`suggestion`:void 0,children:e.name}),(0,Y.jsxs)(H,{dimColor:!t,children:[` `,(0,Y.jsx)(H,{backgroundColor:`userMessageBackground`,children:`MCP`})]}),(0,Y.jsxs)(H,{dimColor:!t,children:[` · `,r,` `]}),(0,Y.jsx)(H,{dimColor:!t,children:i})]})}var Y,Kn=e((()=>{i(),Ue(),_t(),Y=Ke()}));async function qn(e){try{return(await rn.readdir(e,{withFileTypes:!0})).filter(e=>e.isFile()&&e.name.endsWith(`.md`)).map(e=>nn.basename(e.name,`.md`))}catch(t){return Ze(`Failed to read plugin components from ${e}: ${qe(t)}`,{level:`error`}),dt(Xe(t)),[]}}async function Jn(e){try{let t=await rn.readdir(e,{withFileTypes:!0}),n=[];for(let r of t)if(r.isDirectory()||r.isSymbolicLink()){let t=nn.join(e,r.name,`SKILL.md`);try{(await rn.stat(t)).isFile()&&n.push(r.name)}catch{}}return n}catch(t){return Ze(`Failed to read skill directories from ${e}: ${qe(t)}`,{level:`error`}),dt(Xe(t)),[]}}function Yn({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=ye(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 le(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 qn(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 qn(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 Jn(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)(V,{flexDirection:`column`,marginBottom:1,children:[(0,Z.jsx)(H,{bold:!0,children:`Components:`}),(0,Z.jsxs)(H,{dimColor:!0,children:[`Error: `,o]})]}):!n||!(n.commands||n.agents||n.skills||n.hooks||n.mcpServers)?null:(0,Z.jsxs)(V,{flexDirection:`column`,marginBottom:1,children:[(0,Z.jsx)(H,{bold:!0,children:`Installed components:`}),n.commands?(0,Z.jsxs)(H,{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)(H,{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)(H,{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)(H,{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)(H,{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 Xn(e,t){let n=(await le(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 Zn(e){return e.filter(e=>{let t=e.source.split(`@`)[1]||`local`;return!u(`${e.name}@${t}`)})}function Qn({setViewState:e,setResult:t,onManageComplete:n,onSearchModeChange:r,targetPlugin:i,targetMarketplace:o,action:s}){let u=h(e=>e.mcp.clients),d=h(e=>e.mcp.tools),p=h(e=>e.plugins.errors),g=It(),[_,v]=(0,X.useState)(!1),y=(0,X.useCallback)(e=>{v(e),r?.(e)},[r]),b=Fe(),{columns:x}=Ve(),[S,C]=(0,X.useState)(`plugin-list`),{query:w,setQuery:ne,cursorOffset:re}=Wt({isActive:S===`plugin-list`&&_,onExit:()=>{y(!1)}}),[E,O]=(0,X.useState)(null),[k,ie]=(0,X.useState)([]),[M,N]=(0,X.useState)([]),[ae,oe]=(0,X.useState)(!0),[P,ce]=(0,X.useState)(new Map),le=(0,X.useRef)(!1),ue=(0,X.useRef)(void 0),de=zt();Pe(`confirm:no`,$n.useCallback(()=>{if(S===`plugin-details`)C(`plugin-list`),O(null),z(null);else if(typeof S==`object`&&S.type===`failed-plugin-details`)C(`plugin-list`),z(null);else if(S===`configuring`)C(`plugin-details`),Ce(null);else if(typeof S==`object`&&(S.type===`plugin-options`||S.type===`configuring-options`))C(`plugin-list`),O(null),t(`Plugin enabled. Configuration skipped — run /reload-plugins to apply.`),n&&n();else if(typeof S==`object`&&S.type===`flagged-detail`)C(`plugin-list`),z(null);else if(typeof S==`object`&&S.type===`mcp-detail`)C(`plugin-list`),z(null);else if(typeof S==`object`&&S.type===`mcp-tools`)C({type:`mcp-detail`,client:S.client});else if(typeof S==`object`&&S.type===`mcp-tool-detail`)C({type:`mcp-tools`,client:S.client});else{if(P.size>0){t(`Run /reload-plugins to apply plugin changes.`);return}e({type:`menu`})}},[S,e,P,t]),{context:`Confirmation`,isActive:(S!==`plugin-list`||!_)&&S!==`confirm-project-uninstall`&&!(typeof S==`object`&&S.type===`confirm-data-cleanup`)});let fe=e=>e.type===`connected`?`connected`:e.type===`disabled`?`disabled`:e.type===`pending`?`pending`:e.type===`needs-auth`?`needs-auth`:`failed`,pe=(0,X.useMemo)(()=>{let e=at(),t=new Map;for(let e of u)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 M){let i=`${r.plugin.name}@${r.marketplace}`,a=e?.enabledPlugins?.[i]!==!1,o=p.filter(e=>`plugin`in e&&e.plugin===r.plugin.name||e.source===i||e.source.startsWith(`${r.plugin.name}@`)),s=r.plugin.isBuiltin?`builtin`:r.scope||`user`;n.push({item:{type:`plugin`,id:i,name:r.plugin.name,description:r.plugin.manifest.description,marketplace:r.marketplace,scope:s,isEnabled:a,errorCount:o.length,errors:o,plugin:r.plugin,pendingEnable:r.pendingEnable,pendingUpdate:r.pendingUpdate,pendingToggle:P.get(i)},originalScope:s,childMcps:t.get(r.plugin.name)||[]})}let r=new Set(n.map(({item:e})=>e.id)),i=new Set(n.map(({item:e})=>e.name)),a=new Map;for(let e of p){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=yt(),s=[];for(let[e,t]of a){if(e in g)continue;let n=se(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 u)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:fe(e),client:e}));let l={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:fe(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(g)){let n=se(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 m=[...f.keys()].sort((e,t)=>(l[e]??99)-(l[t]??99));for(let e of m){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},[M,u,p,P,g]),me=(0,X.useMemo)(()=>pe.filter(e=>e.type===`flagged-plugin`).map(e=>e.id),[pe]);(0,X.useEffect)(()=>{me.length>0&&Ft(me)},[me]);let he=(0,X.useMemo)(()=>{if(!w)return pe;let e=w.toLowerCase();return pe.filter(t=>t.name.toLowerCase().includes(e)||`description`in t&&t.description?.toLowerCase().includes(e))},[pe,w]),[F,ge]=(0,X.useState)(0),_e=En({totalItems:he.length,selectedIndex:F,maxVisible:8}),[ve,ye]=(0,X.useState)(0),[xe,L]=(0,X.useState)(!1),[R,z]=(0,X.useState)(null),[Se,Ce]=(0,X.useState)(null),[we,Te]=(0,X.useState)(!1),[Ee,De]=(0,X.useState)(!1);(0,X.useEffect)(()=>{if(!E){De(!1);return}async function e(){let e=E.plugin.manifest.mcpServers,t=!1;if(e&&(t=typeof e==`string`&&D(e)||Array.isArray(e)&&e.some(e=>typeof e==`string`&&D(e))),!t)try{let e=nn.join(E.plugin.path,`..`),n=nn.join(e,`.claude-plugin`,`marketplace.json`),r=Ye(await rn.readFile(n,`utf-8`)).plugins?.find(e=>e.name===E.plugin.name);if(r?.mcpServers){let e=r.mcpServers;t=typeof e==`string`&&D(e)||Array.isArray(e)&&e.some(e=>typeof e==`string`&&D(e))}}catch(e){Ze(`Failed to read raw marketplace.json: ${e}`)}De(t)}e()},[E]),(0,X.useEffect)(()=>{async function e(){oe(!0);try{let{enabled:e,disabled:t}=await te(),n=at(),r=Zn([...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=et(t,t=>{let r=`${t.name}@${e}`;return n?.enabledPlugins?.[r]!==!1}),i=t.length-r;a.push({name:e,installedPlugins:t,enabledCount:r,disabledCount:i})}a.sort((e,t)=>e.name===`claude-plugin-directory`?-1:t.name===`claude-plugin-directory`?1:e.name.localeCompare(t.name)),ie(a);let o=[];for(let e of a)for(let t of e.installedPlugins){let n=`${t.name}@${e.name}`,r=t.isBuiltin?`builtin`:Tt(n).scope;o.push({plugin:t,marketplace:e.name,scope:r,pendingEnable:void 0,pendingUpdate:!1})}N(o),ge(0)}finally{oe(!1)}}e()},[]),(0,X.useEffect)(()=>{if(!le.current&&i&&k.length>0&&!ae){let{name:e,marketplace:n}=se(i),r=o??n,a=r?k.filter(e=>e.name===r):k;for(let t of a){let n=t.installedPlugins.find(t=>t.name===e);if(n){let{scope:e}=Tt(`${n.name}@${t.name}`),r={plugin:n,marketplace:t.name,scope:e,pendingEnable:void 0,pendingUpdate:!1};O(r),C(`plugin-details`),ue.current=s,le.current=!0;return}}let c=pe.find(t=>t.type===`failed-plugin`&&t.name===e);c&&c.type===`failed-plugin`&&(C({type:`failed-plugin-details`,plugin:{id:c.id,name:c.name,marketplace:c.marketplace,errors:c.errors,scope:c.scope}}),le.current=!0),!le.current&&s&&(le.current=!0,t(`Plugin "${i}" is not installed in this project`))}},[i,o,k,ae,pe,s,t]);let Oe=async r=>{if(!E)return;let i=E.scope||`user`,a=i===`builtin`;if(a&&(r===`update`||r===`uninstall`)){z(`Built-in plugins cannot be updated or uninstalled.`);return}if(!a&&!wt(i)&&r!==`update`){z(`This plugin is managed by your organization. Contact your admin to disable it.`);return}L(!0),z(null);try{let o=`${E.plugin.name}@${E.marketplace}`,s;switch(r){case`enable`:{let e=await bt(o);if(!e.success)throw Error(e.message);break}case`disable`:{let e=await Ct(o);if(!e.success)throw Error(e.message);s=e.reverseDependents;break}case`uninstall`:{if(a||!wt(i))break;if(Dt(o)){L(!1),C(`confirm-project-uninstall`);return}let e=be().plugins[o],t=!e||e.length<=1?await l(o):null;if(t){L(!1),C({type:`confirm-data-cleanup`,size:t});return}let n=await xt(o,i);if(!n.success)throw Error(n.message);s=n.reverseDependents;break}case`update`:{if(a)break;let r=await St(o,i);if(!r.success)throw Error(r.message);if(r.alreadyUpToDate){t(`${E.plugin.name} is already at the latest version (${r.newVersion}).`),n&&await n(),e({type:`menu`});return}break}}ee();let c=`${E.plugin.name}@${E.marketplace}`;if(at()?.enabledPlugins?.[c]!==!1){L(!1),C({type:`plugin-options`});return}let u=r===`enable`?`Enabled`:r===`disable`?`Disabled`:r===`update`?`Updated`:`Uninstalled`,d=s&&s.length>0?` · required by ${s.join(`, `)}`:``;t(`✓ ${u} ${E.plugin.name}${d}. Run /reload-plugins to apply.`),n&&await n(),e({type:`menu`})}catch(e){L(!1);let t=e instanceof Error?e.message:String(e);z(`Failed to ${r}: ${t}`),dt(Xe(e))}},ke=(0,X.useRef)(Oe);ke.current=Oe,(0,X.useEffect)(()=>{if(S===`plugin-details`&&E&&ue.current){let e=ue.current;ue.current=void 0,ke.current(e)}},[S,E]);let Ae=$n.useCallback(()=>{if(F>=he.length)return;let e=he[F];if(e?.type!==`flagged-plugin`)if(e?.type===`plugin`){let t=`${e.plugin.name}@${e.marketplace}`,n=at(),r=P.get(t),i=n?.enabledPlugins?.[t]!==!1,a=e.scope;if(a===`builtin`||wt(a)){let e=new Map(P);r?(e.delete(t),(async()=>{try{r===`will-disable`?await bt(t):await Ct(t),ee()}catch(e){dt(e)}})()):(e.set(t,i?`will-disable`:`will-enable`),(async()=>{try{i?await Ct(t):await bt(t),ee()}catch(e){dt(e)}})()),ce(e)}}else e?.type===`mcp`&&de(e.client.name)},[F,he,P,M,de]);B({"select:previous":()=>{F===0?y(!0):_e.handleSelectionChange(F-1,ge)},"select:next":()=>{F<he.length-1&&_e.handleSelectionChange(F+1,ge)},"select:accept":$n.useCallback(()=>{if(F>=he.length)return;let e=he[F];if(e?.type===`plugin`){let t=M.find(t=>t.plugin.name===e.plugin.name&&t.marketplace===e.marketplace);t&&(O(t),C(`plugin-details`),ye(0),z(null))}else e?.type===`flagged-plugin`?(C({type:`flagged-detail`,plugin:{id:e.id,name:e.name,marketplace:e.marketplace,reason:e.reason,text:e.text,flaggedAt:e.flaggedAt}}),z(null)):e?.type===`failed-plugin`?(C({type:`failed-plugin-details`,plugin:{id:e.id,name:e.name,marketplace:e.marketplace,errors:e.errors,scope:e.scope}}),ye(0),z(null)):e?.type===`mcp`&&(C({type:`mcp-detail`,client:e.client}),z(null))},[F,he,M])},{context:`Select`,isActive:S===`plugin-list`&&!_}),B({"plugin:toggle":Ae},{context:`Plugin`,isActive:S===`plugin-list`&&!_}),B({"select:accept":$n.useCallback(()=>{typeof S!=`object`||S.type!==`flagged-detail`||(Lt(S.plugin.id),C(`plugin-list`))},[S])},{context:`Select`,isActive:typeof S==`object`&&S.type===`flagged-detail`});let je=$n.useMemo(()=>{if(S!==`plugin-details`||!E)return[];let e=at(),t=`${E.plugin.name}@${E.marketplace}`,n=e?.enabledPlugins?.[t]!==!1,r=E.marketplace===`builtin`,i=[];return i.push({label:n?`Disable plugin`:`Enable plugin`,action:()=>void Oe(n?`disable`:`enable`)}),r||(i.push({label:E.pendingUpdate?`Unmark for update`:`Mark for update`,action:async()=>{try{let e=await Xn(E.plugin.name,E.marketplace);if(e){z(e);return}let t=[...M],n=t.findIndex(e=>e.plugin.name===E.plugin.name&&e.marketplace===E.marketplace);n!==-1&&(t[n].pendingUpdate=!E.pendingUpdate,N(t),O({...E,pendingUpdate:!E.pendingUpdate}))}catch(e){z(e instanceof Error?e.message:`Failed to check plugin update availability`)}}}),Ee&&i.push({label:`Configure`,action:async()=>{Te(!0);try{let e=E.plugin.manifest.mcpServers,t=null;if(typeof e==`string`&&D(e))t=e;else if(Array.isArray(e)){for(let n of e)if(typeof n==`string`&&D(n)){t=n;break}}if(!t){z(`No MCPB file found in plugin`),Te(!1);return}let n=`${E.plugin.name}@${E.marketplace}`,r=await m(t,E.plugin.path,n,void 0,void 0,!0);`status`in r&&r.status===`needs-config`?(Ce(r),C(`configuring`)):z(`Failed to load MCPB for configuration`)}catch(e){let t=qe(e);z(`Failed to load configuration: ${t}`)}finally{Te(!1)}}}),E.plugin.manifest.userConfig&&Object.keys(E.plugin.manifest.userConfig).length>0&&i.push({label:`Configure options`,action:()=>{C({type:`configuring-options`,schema:E.plugin.manifest.userConfig})}}),i.push({label:`Update now`,action:()=>void Oe(`update`)}),i.push({label:`Uninstall`,action:()=>void Oe(`uninstall`)})),E.plugin.manifest.homepage&&i.push({label:`Open homepage`,action:()=>void c(E.plugin.manifest.homepage)}),E.plugin.manifest.repository&&i.push({label:`View repository`,action:()=>void c(E.plugin.manifest.repository)}),i.push({label:`Back to plugin list`,action:()=>{C(`plugin-list`),O(null),z(null)}}),i},[S,E,Ee,M]);if(B({"select:previous":()=>{ve>0&&ye(ve-1)},"select:next":()=>{ve<je.length-1&&ye(ve+1)},"select:accept":()=>{je[ve]&&je[ve].action()}},{context:`Select`,isActive:S===`plugin-details`&&!!E}),B({"select:accept":()=>{typeof S==`object`&&S.type===`failed-plugin-details`&&(async()=>{L(!0),z(null);let e=S.plugin.id,t=S.plugin.scope,r=wt(t)?await xt(e,t,!1):await xt(e,`user`,!1),i=r.success;if(!i){for(let t of[`userSettings`,`projectSettings`,`localSettings`]){let n=st(t);n?.enabledPlugins?.[e]!==void 0&&(rt(t,{enabledPlugins:{...n.enabledPlugins,[e]:void 0}}),i=!0)}ee()}i?(n&&await n(),L(!1),C(`plugin-list`)):(L(!1),z(r.message))})()}},{context:`Select`,isActive:typeof S==`object`&&S.type===`failed-plugin-details`&&S.plugin.scope!==`managed`}),B({"confirm:yes":()=>{if(!E)return;L(!0),z(null);let r=`${E.plugin.name}@${E.marketplace}`,{error:i}=rt(`localSettings`,{enabledPlugins:{...st(`localSettings`)?.enabledPlugins,[r]:!1}});if(i){L(!1),z(`Failed to write settings: ${i.message}`);return}ee(),t(`✓ Disabled ${E.plugin.name} in .workmate/settings.local.json. Run /reload-plugins to apply.`),n&&n(),e({type:`menu`})},"confirm:no":()=>{C(`plugin-details`),z(null)}},{context:`Confirmation`,isActive:S===`confirm-project-uninstall`&&!!E&&!xe}),Le((r,i)=>{if(!E)return;let o=`${E.plugin.name}@${E.marketplace}`,s=E.scope;if(!s||s===`builtin`||!wt(s))return;let c=async r=>{L(!0),z(null);try{let i=await xt(o,s,r);if(!i.success)throw Error(i.message);ee();let c=r?``:` · data preserved`;t(`${a.tick} ${i.message}${c}`),n&&n(),e({type:`menu`})}catch(e){L(!1),z(e instanceof Error?e.message:String(e))}};r===`y`||r===`Y`?c(!0):r===`n`||r===`N`?c(!1):i.escape&&(C(`plugin-details`),z(null))},{isActive:typeof S==`object`&&S.type===`confirm-data-cleanup`&&!!E&&!xe}),$n.useEffect(()=>{ge(0)},[w]),Le((e,t)=>{let n=!t.ctrl&&!t.meta;_||(e===`/`&&n?(y(!0),ne(``),ge(0)):n&&e.length>0&&!/^\s+$/.test(e)&&e!==`j`&&e!==`k`&&e!==` `&&(y(!0),ne(e),ge(0)))},{isActive:S===`plugin-list`}),ae)return(0,Z.jsx)(H,{children:`Loading installed plugins…`});if(pe.length===0)return(0,Z.jsxs)(V,{flexDirection:`column`,children:[(0,Z.jsx)(V,{marginBottom:1,children:(0,Z.jsx)(H,{bold:!0,children:`Manage plugins`})}),(0,Z.jsx)(H,{children:`No plugins or MCP servers installed.`}),(0,Z.jsx)(V,{marginTop:1,children:(0,Z.jsx)(H,{dimColor:!0,children:`Esc to go back`})})]});if(typeof S==`object`&&S.type===`plugin-options`&&E){let r=`${E.plugin.name}@${E.marketplace}`;function i(r){t(r),n&&n(),e({type:`menu`})}return(0,Z.jsx)(mn,{plugin:E.plugin,pluginId:r,onDone:(e,t)=>{switch(e){case`configured`:i(`✓ Enabled and configured ${E.plugin.name}. Run /reload-plugins to apply.`);break;case`skipped`:i(`✓ Enabled ${E.plugin.name}. Run /reload-plugins to apply.`);break;case`error`:i(`Failed to save configuration: ${t}`);break}}})}if(typeof S==`object`&&S.type===`configuring-options`&&E){let e=`${E.plugin.name}@${E.marketplace}`;return(0,Z.jsx)(ln,{title:`Configure ${E.plugin.name}`,subtitle:`Plugin options`,configSchema:S.schema,initialValues:T(e),onSave:n=>{try{f(e,n,S.schema),ee(),t(`Configuration saved. Run /reload-plugins for changes to take effect.`)}catch(e){z(`Failed to save configuration: ${qe(e)}`)}C(`plugin-details`)},onCancel:()=>C(`plugin-details`)})}if(S===`configuring`&&Se&&E){let e=`${E.plugin.name}@${E.marketplace}`;async function n(n){if(!(!Se||!E))try{let r=E.plugin.manifest.mcpServers,i=null;if(typeof r==`string`&&D(r))i=r;else if(Array.isArray(r)){for(let e of r)if(typeof e==`string`&&D(e)){i=e;break}}if(!i){z(`No MCPB file found`),C(`plugin-details`);return}await m(i,E.plugin.path,e,void 0,n),z(null),Ce(null),C(`plugin-details`),t(`Configuration saved. Run /reload-plugins for changes to take effect.`)}catch(e){let t=qe(e);z(`Failed to save configuration: ${t}`),C(`plugin-details`)}}function r(){Ce(null),C(`plugin-details`)}return(0,Z.jsx)(ln,{title:`Configure ${Se.manifest.name}`,subtitle:`Plugin: ${E.plugin.name}`,configSchema:Se.configSchema,initialValues:Se.existingConfig,onSave:n,onCancel:r})}if(typeof S==`object`&&S.type===`flagged-detail`){let e=S.plugin;return(0,Z.jsxs)(V,{flexDirection:`column`,children:[(0,Z.jsx)(V,{children:(0,Z.jsxs)(H,{bold:!0,children:[e.name,` @ `,e.marketplace]})}),(0,Z.jsxs)(V,{marginBottom:1,children:[(0,Z.jsx)(H,{dimColor:!0,children:`Status: `}),(0,Z.jsx)(H,{color:`error`,children:`Removed`})]}),(0,Z.jsxs)(V,{marginBottom:1,flexDirection:`column`,children:[(0,Z.jsxs)(H,{color:`error`,children:[`Removed from marketplace · reason: `,e.reason]}),(0,Z.jsx)(H,{children:e.text}),(0,Z.jsxs)(H,{dimColor:!0,children:[`Flagged on `,new Date(e.flaggedAt).toLocaleDateString()]})]}),(0,Z.jsx)(V,{marginTop:1,flexDirection:`column`,children:(0,Z.jsxs)(V,{children:[(0,Z.jsxs)(H,{children:[a.pointer,` `]}),(0,Z.jsx)(H,{color:`suggestion`,children:`Dismiss`})]})}),(0,Z.jsxs)(Ne,{children:[(0,Z.jsx)(I,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`dismiss`}),(0,Z.jsx)(I,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]})]})}if(S===`confirm-project-uninstall`&&E)return(0,Z.jsxs)(V,{flexDirection:`column`,children:[(0,Z.jsxs)(H,{bold:!0,color:`warning`,children:[E.plugin.name,` is enabled in .workmate/settings.json (shared with your team)`]}),(0,Z.jsxs)(V,{marginTop:1,flexDirection:`column`,children:[(0,Z.jsx)(H,{children:`Disable it just for you in .workmate/settings.local.json?`}),(0,Z.jsx)(H,{dimColor:!0,children:`This has the same effect as uninstalling, without affecting other contributors.`})]}),R&&(0,Z.jsx)(V,{marginTop:1,children:(0,Z.jsx)(H,{color:`error`,children:R})}),(0,Z.jsx)(V,{marginTop:1,children:xe?(0,Z.jsx)(H,{dimColor:!0,children:`Disabling…`}):(0,Z.jsxs)(Ne,{children:[(0,Z.jsx)(I,{action:`confirm:yes`,context:`Confirmation`,fallback:`y`,description:`disable`}),(0,Z.jsx)(I,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})]})})]});if(typeof S==`object`&&S.type===`confirm-data-cleanup`&&E)return(0,Z.jsxs)(V,{flexDirection:`column`,children:[(0,Z.jsxs)(H,{bold:!0,children:[E.plugin.name,` has `,S.size.human,` of persistent data`]}),(0,Z.jsxs)(V,{marginTop:1,flexDirection:`column`,children:[(0,Z.jsx)(H,{children:`Delete it along with the plugin?`}),(0,Z.jsx)(H,{dimColor:!0,children:A(`${E.plugin.name}@${E.marketplace}`)})]}),R&&(0,Z.jsx)(V,{marginTop:1,children:(0,Z.jsx)(H,{color:`error`,children:R})}),(0,Z.jsx)(V,{marginTop:1,children:xe?(0,Z.jsx)(H,{dimColor:!0,children:`Uninstalling…`}):(0,Z.jsxs)(H,{children:[(0,Z.jsx)(H,{bold:!0,children:`y`}),` to delete · `,(0,Z.jsx)(H,{bold:!0,children:`n`}),` to keep · `,(0,Z.jsx)(H,{bold:!0,children:`esc`}),` to cancel`]})})]});if(S===`plugin-details`&&E){let e=at(),t=`${E.plugin.name}@${E.marketplace}`,n=e?.enabledPlugins?.[t]!==!1,r=p.filter(e=>`plugin`in e&&e.plugin===E.plugin.name||e.source===t||e.source.startsWith(`${E.plugin.name}@`)),i=r.length===0?null:(0,Z.jsxs)(V,{flexDirection:`column`,marginBottom:1,children:[(0,Z.jsxs)(H,{bold:!0,color:`error`,children:[r.length,` `,gt(r.length,`error`),`:`]}),r.map((e,t)=>{let n=Un(e);return(0,Z.jsxs)(V,{flexDirection:`column`,marginLeft:2,children:[(0,Z.jsx)(H,{color:`error`,children:Hn(e)}),n&&(0,Z.jsxs)(H,{dimColor:!0,italic:!0,children:[a.arrowRight,` `,n]})]},t)})]});return(0,Z.jsxs)(V,{flexDirection:`column`,children:[(0,Z.jsx)(V,{children:(0,Z.jsxs)(H,{bold:!0,children:[E.plugin.name,` @ `,E.marketplace]})}),(0,Z.jsxs)(V,{children:[(0,Z.jsx)(H,{dimColor:!0,children:`Scope: `}),(0,Z.jsx)(H,{children:E.scope||`user`})]}),E.plugin.manifest.version&&(0,Z.jsxs)(V,{children:[(0,Z.jsx)(H,{dimColor:!0,children:`Version: `}),(0,Z.jsx)(H,{children:E.plugin.manifest.version})]}),E.plugin.manifest.description&&(0,Z.jsx)(V,{marginBottom:1,children:(0,Z.jsx)(H,{children:E.plugin.manifest.description})}),E.plugin.manifest.author&&(0,Z.jsxs)(V,{children:[(0,Z.jsx)(H,{dimColor:!0,children:`Author: `}),(0,Z.jsx)(H,{children:E.plugin.manifest.author.name})]}),(0,Z.jsxs)(V,{marginBottom:1,children:[(0,Z.jsx)(H,{dimColor:!0,children:`Status: `}),(0,Z.jsx)(H,{color:n?`success`:`warning`,children:n?`Enabled`:`Disabled`}),E.pendingUpdate&&(0,Z.jsx)(H,{color:`suggestion`,children:` · Marked for update`})]}),(0,Z.jsx)(Yn,{plugin:E.plugin,marketplace:E.marketplace}),i,(0,Z.jsx)(V,{marginTop:1,flexDirection:`column`,children:je.map((e,t)=>{let n=t===ve;return(0,Z.jsxs)(V,{children:[n&&(0,Z.jsxs)(H,{children:[a.pointer,` `]}),!n&&(0,Z.jsx)(H,{children:` `}),(0,Z.jsx)(H,{bold:n,color:e.label.includes(`Uninstall`)?`error`:e.label.includes(`Update`)?`suggestion`:void 0,children:e.label})]},t)})}),xe&&(0,Z.jsx)(V,{marginTop:1,children:(0,Z.jsx)(H,{children:`Processing…`})}),R&&(0,Z.jsx)(V,{marginTop:1,children:(0,Z.jsx)(H,{color:`error`,children:R})}),(0,Z.jsx)(V,{marginTop:1,children:(0,Z.jsx)(H,{dimColor:!0,italic:!0,children:(0,Z.jsxs)(Ne,{children:[(0,Z.jsx)(I,{action:`select:previous`,context:`Select`,fallback:`↑`,description:`navigate`}),(0,Z.jsx)(I,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`select`}),(0,Z.jsx)(I,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]})})})]})}if(typeof S==`object`&&S.type===`failed-plugin-details`){let e=S.plugin,t=e.errors[0],n=t?Hn(t):`Failed to load`;return(0,Z.jsxs)(V,{flexDirection:`column`,children:[(0,Z.jsxs)(H,{children:[(0,Z.jsx)(H,{bold:!0,children:e.name}),(0,Z.jsxs)(H,{dimColor:!0,children:[` @ `,e.marketplace]}),(0,Z.jsxs)(H,{dimColor:!0,children:[` (`,e.scope,`)`]})]}),(0,Z.jsx)(H,{color:`error`,children:n}),e.scope===`managed`?(0,Z.jsx)(V,{marginTop:1,children:(0,Z.jsx)(H,{dimColor:!0,children:`Managed by your organization — contact your admin`})}):(0,Z.jsxs)(V,{marginTop:1,children:[(0,Z.jsxs)(H,{color:`suggestion`,children:[a.pointer,` `]}),(0,Z.jsx)(H,{bold:!0,children:`Remove`})]}),xe&&(0,Z.jsx)(H,{children:`Processing…`}),R&&(0,Z.jsx)(H,{color:`error`,children:R}),(0,Z.jsx)(V,{marginTop:1,children:(0,Z.jsx)(H,{dimColor:!0,italic:!0,children:(0,Z.jsxs)(Ne,{children:[e.scope!==`managed`&&(0,Z.jsx)(I,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`remove`}),(0,Z.jsx)(I,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]})})})]})}if(typeof S==`object`&&S.type===`mcp-detail`){let e=S.client,n=j(d,e.name).length,r=()=>{C({type:`mcp-tools`,client:e})},i=()=>{C(`plugin-list`)},a=e=>{e&&t(e),C(`plugin-list`)},o=e.config.scope,s=e.config.type;return s===`stdio`?(0,Z.jsx)(Kt,{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)(Qt,{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)(Qt,{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)(Qt,{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}):(C(`plugin-list`),null)}if(typeof S==`object`&&S.type===`mcp-tools`){let e=S.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)($t,{server:r,onSelectTool:t=>{C({type:`mcp-tool-detail`,client:e,tool:t})},onBack:()=>C({type:`mcp-detail`,client:e})})}if(typeof S==`object`&&S.type===`mcp-tool-detail`){let{client:e,tool:t}=S,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)(Zt,{tool:t,server:i,onBack:()=>C({type:`mcp-tools`,client:e})})}let Me=_e.getVisibleItems(he);return(0,Z.jsxs)(V,{flexDirection:`column`,children:[(0,Z.jsx)(V,{marginBottom:1,children:(0,Z.jsx)(ze,{query:w,isFocused:_,isTerminalFocused:b,width:x-4,cursorOffset:re})}),he.length===0&&w&&(0,Z.jsx)(V,{marginBottom:1,children:(0,Z.jsxs)(H,{dimColor:!0,children:[`No items match "`,w,`"`]})}),_e.scrollPosition.canScrollUp&&(0,Z.jsx)(V,{children:(0,Z.jsxs)(H,{dimColor:!0,children:[` `,a.arrowUp,` more above`]})}),Me.map((e,t)=>{let n=_e.toActualIndex(t)===F&&!_,r=t>0?Me[t-1]:null,i=!r||r.scope!==e.scope;return(0,Z.jsxs)($n.Fragment,{children:[i&&(0,Z.jsx)(V,{marginTop:+(t>0),paddingLeft:2,children:(0,Z.jsx)(H,{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)(Gn,{item:e,isSelected:n})]},e.id)}),_e.scrollPosition.canScrollDown&&(0,Z.jsx)(V,{children:(0,Z.jsxs)(H,{dimColor:!0,children:[` `,a.arrowDown,` more below`]})}),(0,Z.jsx)(V,{marginTop:1,marginLeft:1,children:(0,Z.jsx)(H,{dimColor:!0,italic:!0,children:(0,Z.jsxs)(Ne,{children:[(0,Z.jsx)(H,{children:`type to search`}),(0,Z.jsx)(I,{action:`plugin:toggle`,context:`Plugin`,fallback:`Space`,description:`toggle`}),(0,Z.jsx)(I,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`details`}),(0,Z.jsx)(I,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]})})}),P.size>0&&(0,Z.jsx)(V,{marginLeft:1,children:(0,Z.jsx)(H,{dimColor:!0,italic:!0,children:`Run /reload-plugins to apply changes`})})]})}var $n,X,Z,er=e((()=>{i(),$n=t(Ie(),1),X=t(Ie(),1),R(),Ue(),qt(),Xt(),Jt(),Yt(),Ut(),Gt(),v(),Oe(),Ce(),Bt(),L(),Et(),re(),tt(),_e(),Qe(),Je(),ut(),w(),M(),ue(),Te(),O(),Rt(),z(),y(),Ee(),ke(),vt(),ot(),$e(),_t(),Wn(),fn(),_n(),Kn(),kn(),Z=Ke()}));function tr(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 nr=e((()=>{}));function rr({onComplete:e,path:t}){return(0,ir.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 jt(t),r=``;r+=`Validating ${n.fileType} manifest: ${n.filePath}\n\n`,n.errors.length>0&&(r+=`${a.cross} Found ${n.errors.length} ${gt(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} ${gt(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,dt(t),e(`${a.cross} Unexpected error during validation: ${qe(t)}`)}}n()},[e,t]),(0,ar.jsx)(V,{flexDirection:`column`,children:(0,ar.jsx)(H,{children:`Running validation...`})})}var ir,ar,or=e((()=>{i(),ir=t(Ie(),1),Ue(),Je(),ut(),Pt(),_t(),ar=Ke()}));function sr({onComplete:e}){return(0,Q.useEffect)(()=>{async function t(){try{let t=await fe(),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: ${qe(t)}`)}}t()},[e]),(0,$.jsx)(H,{children:`Loading marketplaces...`})}function cr(e){let t=[];for(let{source:n,scope:r}of[{source:`userSettings`,scope:`user`},{source:`projectSettings`,scope:`project`},{source:`localSettings`,scope:`local`}])st(n)?.extraKnownMarketplaces?.[e]&&t.push({source:n,scope:r});return{editableSources:t,isInPolicy:!!st(`policySettings`)?.extraKnownMarketplaces?.[e]}}function lr(e){let{editableSources:t,isInPolicy:n}=cr(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 ur(e){return{kind:`navigate`,tab:`installed`,viewState:{type:`manage-plugins`,targetPlugin:e,action:`uninstall`}}}function dr(e){return yr.has(e.type)}function fr(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 pr(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:Hn(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=lr(t.name),n=cr(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=lr(t),r=cr(t),i=r.isInPolicy?`managed`:r.editableSources[0]?.scope;s.push({label:t,message:Hn(e),guidance:n.kind===`managed-only`?`Managed by your organization — contact your admin`:Un(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=fr(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:Hn(e),guidance:Un(e),action:t?ur(t):{kind:`none`},scope:r})}for(let e of r)s.push({label:e.source,message:Hn(e),guidance:Un(e),action:{kind:`none`}});return s}function mr(e,t){for(let{source:n}of t){let t=st(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&&rt(n,r)}}function hr({setViewState:e,setActiveTab:t,markPluginsChanged:n}){let r=h(e=>e.plugins.errors),i=h(e=>e.plugins.installationStatus),o=x(),[s,c]=(0,Q.useState)(0),[l,u]=(0,Q.useState)(null),[d,f]=(0,Q.useState)([]);(0,Q.useEffect)(()=>{(async()=>{try{let{failures:e}=await F(await fe());f(e)}catch{}})()},[]);let p=i.marketplaces.filter(e=>e.status===`failed`),m=new Set(p.map(e=>e.name)),g=r.filter(dr),_=pr(p,r.filter(e=>(e.type===`marketplace-not-found`||e.type===`marketplace-load-failed`||e.type===`marketplace-blocked-by-policy`)&&!m.has(e.marketplace)),r.filter(e=>dr(e)||e.type===`marketplace-not-found`||e.type===`marketplace-load-failed`||e.type===`marketplace-blocked-by-policy`?!1:fr(e)!==void 0),r.filter(e=>dr(e)||e.type===`marketplace-not-found`||e.type===`marketplace-load-failed`||e.type===`marketplace-blocked-by-policy`?!1:fr(e)===void 0),d,g,yt());Pe(`confirm:no`,()=>{e({type:`menu`})},{context:`Confirmation`}),B({"select:previous":()=>c(e=>Math.max(0,e-1)),"select:next":()=>c(e=>Math.min(_.length-1,e+1)),"select:accept":()=>{let r=_[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(`, `);mr(i.name,i.sources),ee(),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)}}})),u(`${a.tick} Removed "${i.name}" from ${e} settings`),n();break}case`remove-installed-marketplace`:(async()=>{try{await N(i.name),ee(),f(e=>e.filter(e=>e.name!==i.name)),u(`${a.tick} Removed marketplace "${i.name}"`),n()}catch(e){u(`Failed to remove "${i.name}": ${e instanceof Error?e.message:String(e)}`)}})();break;case`managed-only`:break;case`none`:break}}},{context:`Select`,isActive:_.length>0});let v=Math.min(s,Math.max(0,_.length-1));v!==s&&c(v);let y=_[v]?.action,b=y&&y.kind!==`none`&&y.kind!==`managed-only`;return _.length===0?(0,$.jsxs)(V,{flexDirection:`column`,children:[(0,$.jsx)(V,{marginLeft:1,children:(0,$.jsx)(H,{dimColor:!0,children:`No plugin errors`})}),(0,$.jsx)(V,{marginTop:1,children:(0,$.jsx)(H,{dimColor:!0,italic:!0,children:(0,$.jsx)(I,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})})})]}):(0,$.jsxs)(V,{flexDirection:`column`,children:[_.map((e,t)=>{let n=t===v;return(0,$.jsxs)(V,{marginLeft:1,flexDirection:`column`,marginBottom:1,children:[(0,$.jsxs)(H,{children:[(0,$.jsxs)(H,{color:n?`suggestion`:`error`,children:[n?a.pointer:a.cross,` `]}),(0,$.jsx)(H,{bold:n,children:e.label}),e.scope&&(0,$.jsxs)(H,{dimColor:!0,children:[` (`,e.scope,`)`]})]}),(0,$.jsx)(V,{marginLeft:3,children:(0,$.jsx)(H,{color:`error`,children:e.message})}),e.guidance&&(0,$.jsx)(V,{marginLeft:3,children:(0,$.jsx)(H,{dimColor:!0,italic:!0,children:e.guidance})})]},t)}),l&&(0,$.jsx)(V,{marginTop:1,marginLeft:1,children:(0,$.jsx)(H,{color:`claude`,children:l})}),(0,$.jsx)(V,{marginTop:1,children:(0,$.jsx)(H,{dimColor:!0,italic:!0,children:(0,$.jsxs)(Ne,{children:[(0,$.jsx)(I,{action:`select:previous`,context:`Select`,fallback:`↑`,description:`navigate`}),b&&(0,$.jsx)(I,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`resolve`}),(0,$.jsx)(I,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]})})})]})}function gr(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 _r(e){return e.type===`manage-plugins`?`installed`:e.type===`manage-marketplaces`?`marketplaces`:`discover`}function vr({onComplete:e,args:t}){let n=tr(t),r=gr(n),[i,a]=(0,Q.useState)(r),[o,s]=(0,Q.useState)(_r(r)),[c,l]=(0,Q.useState)(i.type===`add-marketplace`&&i.initialValue||``),[u,d]=(0,Q.useState)(0),[f,p]=(0,Q.useState)(null),[m,g]=(0,Q.useState)(null),[_,v]=(0,Q.useState)(!1),y=x(),b=h(e=>{let t=e.plugins.errors.length;for(let n of e.plugins.installationStatus.marketplaces)n.status===`failed`&&t++;return t}),ee=b>0?`Errors (${b})`:`Errors`,S=Vt(),C=n.type===`marketplace`&&n.action===`add`&&n.target!==void 0,w=(0,Q.useCallback)(()=>{y(e=>e.plugins.needsRefresh?e:{...e,plugins:{...e.plugins,needsRefresh:!0}})},[y]),te=(0,Q.useCallback)(e=>{let t=e;switch(s(t),p(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`&&!m&&e()},[i.type,m,e]),(0,Q.useEffect)(()=>{i.type===`browse-marketplace`&&o!==`discover`&&s(`discover`)},[i.type,o]),Pe(`confirm:no`,(0,Q.useCallback)(()=>{s(`marketplaces`),a({type:`manage-marketplaces`}),l(``),p(null)},[]),{context:`Settings`,isActive:i.type===`add-marketplace`}),(0,Q.useEffect)(()=>{m&&e(m)},[m,e]),(0,Q.useEffect)(()=>{i.type===`help`&&e()},[i.type,e]),i.type===`help`?(0,$.jsxs)(V,{flexDirection:`column`,children:[(0,$.jsx)(H,{bold:!0,children:`Plugin Command Usage:`}),(0,$.jsx)(H,{children:` `}),(0,$.jsx)(H,{dimColor:!0,children:`Installation:`}),(0,$.jsx)(H,{children:` /plugin install - Browse and install plugins`}),(0,$.jsx)(H,{children:` /plugin install <marketplace> - Install from specific marketplace`}),(0,$.jsx)(H,{children:` /plugin install <plugin> - Install specific plugin`}),(0,$.jsx)(H,{children:` /plugin install <plugin>@<market> - Install plugin from marketplace`}),(0,$.jsx)(H,{children:` `}),(0,$.jsx)(H,{dimColor:!0,children:`Management:`}),(0,$.jsx)(H,{children:` /plugin manage - Manage installed plugins`}),(0,$.jsx)(H,{children:` /plugin enable <plugin> - Enable a plugin`}),(0,$.jsx)(H,{children:` /plugin disable <plugin> - Disable a plugin`}),(0,$.jsx)(H,{children:` /plugin uninstall <plugin> - Uninstall a plugin`}),(0,$.jsx)(H,{children:` `}),(0,$.jsx)(H,{dimColor:!0,children:`Marketplaces:`}),(0,$.jsx)(H,{children:` /plugin marketplace - Marketplace management menu`}),(0,$.jsx)(H,{children:` /plugin marketplace add - Add a marketplace`}),(0,$.jsx)(H,{children:` /plugin marketplace add <path/url> - Add marketplace directly`}),(0,$.jsx)(H,{children:` /plugin marketplace update - Update marketplaces`}),(0,$.jsx)(H,{children:` /plugin marketplace update <name> - Update specific marketplace`}),(0,$.jsx)(H,{children:` /plugin marketplace remove - Remove a marketplace`}),(0,$.jsx)(H,{children:` /plugin marketplace remove <name> - Remove specific marketplace`}),(0,$.jsx)(H,{children:` /plugin marketplace list - List all marketplaces`}),(0,$.jsx)(H,{children:` `}),(0,$.jsx)(H,{dimColor:!0,children:`Validation:`}),(0,$.jsx)(H,{children:` /plugin validate <path> - Validate a manifest file or directory`}),(0,$.jsx)(H,{children:` `}),(0,$.jsx)(H,{dimColor:!0,children:`Other:`}),(0,$.jsx)(H,{children:` /plugin - Main plugin menu`}),(0,$.jsx)(H,{children:` /plugin help - Show this help`}),(0,$.jsx)(H,{children:` /plugins - Alias for /plugin`})]}):i.type===`validate`?(0,$.jsx)(rr,{onComplete:e,path:i.path}):i.type===`marketplace-menu`?(a({type:`menu`}),null):i.type===`marketplace-list`?(0,$.jsx)(sr,{onComplete:e}):i.type===`add-marketplace`?(0,$.jsx)(an,{inputValue:c,setInputValue:l,cursorOffset:u,setCursorOffset:d,error:f,setError:p,result:m,setResult:g,setViewState:a,onAddComplete:w,cliMode:C}):(0,$.jsx)(We,{color:`suggestion`,children:(0,$.jsxs)(He,{title:`Plugins`,selectedTab:o,onTabChange:te,color:`suggestion`,disableNavigation:_,children:[(0,$.jsx)(Be,{id:`discover`,title:`Discover`,children:i.type===`browse-marketplace`?(0,$.jsx)(An,{error:f,setError:p,result:m,setResult:g,setViewState:a,onInstallComplete:w,targetMarketplace:i.targetMarketplace,targetPlugin:i.targetPlugin}):(0,$.jsx)(Nn,{error:f,setError:p,result:m,setResult:g,setViewState:a,onInstallComplete:w,onSearchModeChange:v,targetPlugin:i.type===`discover-plugins`?i.targetPlugin:void 0})}),(0,$.jsx)(Be,{id:`installed`,title:`Installed`,children:(0,$.jsx)(Qn,{setViewState:a,setResult:g,onManageComplete:w,onSearchModeChange:v,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)(Be,{id:`marketplaces`,title:`Marketplaces`,children:(0,$.jsx)(Rn,{setViewState:a,error:f,setError:p,setResult:g,exitState:S,onManageComplete:w,targetMarketplace:i.type===`manage-marketplaces`?i.targetMarketplace:void 0,action:i.type===`manage-marketplaces`?i.action:void 0})}),(0,$.jsx)(Be,{id:`errors`,title:ee,children:(0,$.jsx)(hr,{setViewState:a,setActiveTab:s,markPluginsChanged:w})})]})})}var Q,$,yr,br=e((()=>{i(),Q=t(Ie(),1),R(),Ue(),Ht(),Oe(),re(),Je(),w(),ge(),ue(),vt(),ot(),sn(),Mn(),Ln(),Vn(),er(),Wn(),nr(),or(),$=Ke(),yr=new Set([`git-auth-failed`,`git-timeout`,`network-error`])}));async function xr(e,t,n){return(0,Sr.jsx)(vr,{onComplete:e,args:n})}var Sr;e((()=>{br(),Sr=Ke()}))();export{xr as call};
@@ -1 +1 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{Aw as t,Bo as n,Co as r,Eo as i,Io as a,Lo as o,Mo as s,Ow as c,xo as l}from"./loadAgentsDir-DaNpxaO-.js";import{P as u,R as d,c as f,i as p}from"./debug-D58GQBDG.js";import{_t as m,bt as h}from"./settings-3xZ0fsvE.js";import{b as g,h as _}from"./config-DRy1I12M.js";import{o as v,s as y}from"./log-CZ7ploQm.js";import{f as b,s as x}from"./pluginOperations-BEYsarAn.js";function S(e){return O=e,k!==null&&k.length>0&&(e(k),k=null),()=>{O=null}}async function C(){let e=await o(),t=s(),n=new Set;for(let[r,i]of Object.entries(e)){let e=t[r]?.autoUpdate;(e===void 0?h(r,i):e)&&n.add(r.toLowerCase())}return n}async function w(e,t){let n=!1;for(let{scope:r}of t)try{let t=await b(e,r);t.success&&!t.alreadyUpToDate?(n=!0,f(`Plugin autoupdate: updated ${e} from ${t.oldVersion} to ${t.newVersion}`)):t.alreadyUpToDate||f(`Plugin autoupdate: failed to update ${e}: ${t.message}`,{level:`warn`})}catch(t){f(`Plugin autoupdate: error updating ${e}: ${u(t)}`,{level:`warn`})}return n?e:null}async function T(e){let n=i(),a=Object.keys(n.plugins);return a.length===0?[]:(await Promise.allSettled(a.map(async i=>{let{marketplace:a}=t(i);if(!a||!e.has(a.toLowerCase()))return null;let o=n.plugins[i];if(!o||o.length===0)return null;let s=o.filter(r);return s.length===0?null:w(i,s)}))).filter(e=>e.status===`fulfilled`&&e.value!==null).map(e=>e.value)}async function E(e){return T(e)}function D(){(async()=>{if(g()){f(`Plugin autoupdate: skipped (auto-updater disabled)`);return}try{let e=await C();if(e.size===0)return;let t=(await Promise.allSettled(Array.from(e).map(async e=>{try{await n(e,void 0,{disableCredentialHelper:!0})}catch(t){f(`Plugin autoupdate: failed to refresh marketplace ${e}: ${u(t)}`,{level:`warn`})}}))).filter(e=>e.status===`rejected`);t.length>0&&f(`Plugin autoupdate: ${t.length} marketplace refresh(es) failed`,{level:`warn`}),f(`Plugin autoupdate: checking installed plugins`);let r=await E(e);r.length>0&&(O?O(r):k=r)}catch(e){y(e)}})()}var O,k,A=e((()=>{x(),_(),p(),d(),v(),l(),a(),c(),m(),O=null,k=null}));export{T as i,A as n,S as r,D as t};
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{Qa as t,Xa as n,aw as r,do as i,fo as a,ho as o,rw as s,so as c,to as l}from"./loadAgentsDir-C96o6gCj.js";import{P as u,R as d,c as f,i as p}from"./debug-D58GQBDG.js";import{_t as m,bt as h}from"./settings-BowI3jp-.js";import{b as g,h as _}from"./config-DUTgj3js.js";import{o as v,s as y}from"./log-CZ7ploQm.js";import{f as b,s as x}from"./pluginOperations-Ca9Lup5G.js";function S(e){return O=e,k!==null&&k.length>0&&(e(k),k=null),()=>{O=null}}async function C(){let e=await a(),t=c(),n=new Set;for(let[r,i]of Object.entries(e)){let e=t[r]?.autoUpdate;(e===void 0?h(r,i):e)&&n.add(r.toLowerCase())}return n}async function w(e,t){let n=!1;for(let{scope:r}of t)try{let t=await b(e,r);t.success&&!t.alreadyUpToDate?(n=!0,f(`Plugin autoupdate: updated ${e} from ${t.oldVersion} to ${t.newVersion}`)):t.alreadyUpToDate||f(`Plugin autoupdate: failed to update ${e}: ${t.message}`,{level:`warn`})}catch(t){f(`Plugin autoupdate: error updating ${e}: ${u(t)}`,{level:`warn`})}return n?e:null}async function T(e){let n=l(),i=Object.keys(n.plugins);return i.length===0?[]:(await Promise.allSettled(i.map(async i=>{let{marketplace:a}=r(i);if(!a||!e.has(a.toLowerCase()))return null;let o=n.plugins[i];if(!o||o.length===0)return null;let s=o.filter(t);return s.length===0?null:w(i,s)}))).filter(e=>e.status===`fulfilled`&&e.value!==null).map(e=>e.value)}async function E(e){return T(e)}function D(){(async()=>{if(g()){f(`Plugin autoupdate: skipped (auto-updater disabled)`);return}try{let e=await C();if(e.size===0)return;let t=(await Promise.allSettled(Array.from(e).map(async e=>{try{await o(e,void 0,{disableCredentialHelper:!0})}catch(t){f(`Plugin autoupdate: failed to refresh marketplace ${e}: ${u(t)}`,{level:`warn`})}}))).filter(e=>e.status===`rejected`);t.length>0&&f(`Plugin autoupdate: ${t.length} marketplace refresh(es) failed`,{level:`warn`}),f(`Plugin autoupdate: checking installed plugins`);let n=await E(e);n.length>0&&(O?O(n):k=n)}catch(e){y(e)}})()}var O,k,A=e((()=>{x(),_(),p(),d(),v(),n(),i(),s(),m(),O=null,k=null}));export{T as i,A as n,S as r,D as t};
@@ -0,0 +1 @@
1
+ import{Xa as e,co as t,do as n,no as r,po as i}from"./loadAgentsDir-C96o6gCj.js";import{P as a,R as o,c as s,i as c}from"./debug-D58GQBDG.js";import{d as l,s as u}from"./pluginOperations-Ca9Lup5G.js";import{i as d,n as f,r as p,t as m}from"./pluginFlagging-BSLuTk3M.js";u(),c(),o(),e(),n(),p();function h(e,t,n){let r=new Set(t.plugins.map(e=>e.name)),i=`@${n}`,a=[];for(let t of Object.keys(e.plugins)){if(!t.endsWith(i))continue;let e=t.slice(0,-i.length);r.has(e)||a.push(t)}return a}async function g(){await d();let e=r(),n=f(),o=await i(),c=[];for(let r of Object.keys(o))try{let i=await t(r);if(!i.forceRemoveDeletedPlugins)continue;let o=h(e,i,r);for(let t of o){if(t in n)continue;let r=e.plugins[t]??[];if(r.some(e=>e.scope===`user`||e.scope===`project`||e.scope===`local`)){for(let e of r){let{scope:n}=e;if(!(n!==`user`&&n!==`project`&&n!==`local`))try{await l(t,n)}catch(e){s(`Failed to auto-uninstall delisted plugin ${t} from ${n}: ${a(e)}`,{level:`error`})}}await m(t),c.push(t)}}}catch(e){s(`Failed to check for delisted plugins in "${r}": ${a(e)}`,{level:`warn`})}return c}export{g as t};
@@ -0,0 +1 @@
1
+ import{n as e,t}from"./figures-5ThXQEtq.js";import{$d as n,Ed as r,Ja as i,Od as a,Qd as o,Ya as s,aw as c,ef as l,rw as u}from"./loadAgentsDir-C96o6gCj.js";import{P as d,R as f}from"./debug-D58GQBDG.js";import{n as p,o as m}from"./process-gEbdy6uY.js";import{o as h,s as g}from"./log-CZ7ploQm.js";import{n as _,r as v}from"./analytics-DJobLaWP.js";import{a as y,c as b,d as x,f as S,i as C,r as w,s as T}from"./pluginOperations-Ca9Lup5G.js";e(),f(),a(),h(),s(),u(),p(),l(),_(),T();function E(e,r,a){g(e);let s=a?`${r} plugin "${a}"`:r===`disable-all`?`disable all plugins`:`${r} plugins`;console.error(`${t.cross} Failed to ${s}: ${d(e)}`);let l=a?(()=>{let{name:e,marketplace:t}=c(a);return{_PROTO_plugin_name:e,...t&&{_PROTO_marketplace_name:t},...o(e,t,i())}})():{};v(`tengu_plugin_command_failed`,{command:r,error_category:n(e),...l}),process.exit(1)}async function D(e,n=`user`){try{console.log(`Installing plugin "${e}"...`);let r=await b(e,n);if(!r.success)throw Error(r.message);console.log(`${t.tick} ${r.message}`);let{name:a,marketplace:s}=c(r.pluginId||e);v(`tengu_plugin_installed_cli`,{_PROTO_plugin_name:a,...s&&{_PROTO_marketplace_name:s},scope:r.scope||n,install_source:`cli-explicit`,...o(a,s,i())}),process.exit(0)}catch(t){E(t,`install`,e)}}async function O(e,n=`user`,r=!1){try{let a=await x(e,n,!r);if(!a.success)throw Error(a.message);console.log(`${t.tick} ${a.message}`);let{name:s,marketplace:l}=c(a.pluginId||e);v(`tengu_plugin_uninstalled_cli`,{_PROTO_plugin_name:s,...l&&{_PROTO_marketplace_name:l},scope:a.scope||n,...o(s,l,i())}),process.exit(0)}catch(t){E(t,`uninstall`,e)}}async function k(e,n){try{let r=await y(e,n);if(!r.success)throw Error(r.message);console.log(`${t.tick} ${r.message}`);let{name:a,marketplace:s}=c(r.pluginId||e);v(`tengu_plugin_enabled_cli`,{_PROTO_plugin_name:a,...s&&{_PROTO_marketplace_name:s},scope:r.scope,...o(a,s,i())}),process.exit(0)}catch(t){E(t,`enable`,e)}}async function A(e,n){try{let r=await C(e,n);if(!r.success)throw Error(r.message);console.log(`${t.tick} ${r.message}`);let{name:a,marketplace:s}=c(r.pluginId||e);v(`tengu_plugin_disabled_cli`,{_PROTO_plugin_name:a,...s&&{_PROTO_marketplace_name:s},scope:r.scope,...o(a,s,i())}),process.exit(0)}catch(t){E(t,`disable`,e)}}async function j(){try{let e=await w();if(!e.success)throw Error(e.message);console.log(`${t.tick} ${e.message}`),v(`tengu_plugin_disabled_all_cli`,{}),process.exit(0)}catch(e){E(e,`disable-all`)}}async function M(e,n){try{m(`Checking for updates for plugin "${e}" at ${n} scope…\n`);let a=await S(e,n);if(!a.success)throw Error(a.message);if(m(`${t.tick} ${a.message}\n`),!a.alreadyUpToDate){let{name:t,marketplace:n}=c(a.pluginId||e);v(`tengu_plugin_updated_cli`,{_PROTO_plugin_name:t,...n&&{_PROTO_marketplace_name:n},old_version:a.oldVersion||`unknown`,new_version:a.newVersion||`unknown`,...o(t,n,i())})}await r(0)}catch(t){E(t,`update`,e)}}export{O as a,D as i,A as n,M as o,k as r,j as t};
@@ -1 +1 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{mw as t,pw as n}from"./loadAgentsDir-DaNpxaO-.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-D58GQBDG.js";import{o as u,s as d}from"./log-CZ7ploQm.js";import{join as f}from"path";import{randomBytes as p}from"crypto";import{readFile as m,rename as h,unlink as g,writeFile as _}from"fs/promises";function v(){return f(n(),D)}function y(e){let t=i(e);if(typeof t!=`object`||!t||!(`plugins`in t)||typeof t.plugins!=`object`||t.plugins===null)return{};let n=t.plugins,r={};for(let[e,t]of Object.entries(n))if(t&&typeof t==`object`&&`flaggedAt`in t&&typeof t.flaggedAt==`string`){let n={flaggedAt:t.flaggedAt};`seenAt`in t&&typeof t.seenAt==`string`&&(n.seenAt=t.seenAt),r[e]=n}return r}async function b(){try{return y(await m(v(),{encoding:`utf-8`}))}catch{return{}}}async function x(e){let t=v(),i=`${t}.${p(8).toString(`hex`)}.tmp`;try{await c().mkdir(n()),await _(i,r({plugins:e},null,2),{encoding:`utf-8`,mode:384}),await h(i,t),k=e}catch(e){d(e);try{await g(i)}catch{}}}async function S(){let e=await b(),t=Date.now(),n=!1;for(let[r,i]of Object.entries(e))i.seenAt&&t-new Date(i.seenAt).getTime()>=O&&(delete e[r],n=!0);k=e,n&&await x(e)}function C(){return k??{}}async function w(e){k===null&&(k=await b()),await x({...k,[e]:{flaggedAt:new Date().toISOString()}}),a(`Flagged plugin: ${e}`)}async function T(e){k===null&&(k=await b());let t=new Date().toISOString(),n=!1,r={...k};for(let i of e){let e=r[i];e&&!e.seenAt&&(r[i]={...e,seenAt:t},n=!0)}n&&await x(r)}async function E(e){if(k===null&&(k=await b()),!(e in k))return;let{[e]:t,...n}=k;k=n,await x(n)}var D,O,k,A=e((()=>{s(),o(),u(),l(),t(),D=`flagged-plugins.json`,O=2880*60*1e3,k=null}));export{T as a,S as i,C as n,E as o,A as r,w as t};
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{HC as t,UC as n}from"./loadAgentsDir-C96o6gCj.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-D58GQBDG.js";import{o as u,s as d}from"./log-CZ7ploQm.js";import{join as f}from"path";import{randomBytes as p}from"crypto";import{readFile as m,rename as h,unlink as g,writeFile as _}from"fs/promises";function v(){return f(t(),D)}function y(e){let t=i(e);if(typeof t!=`object`||!t||!(`plugins`in t)||typeof t.plugins!=`object`||t.plugins===null)return{};let n=t.plugins,r={};for(let[e,t]of Object.entries(n))if(t&&typeof t==`object`&&`flaggedAt`in t&&typeof t.flaggedAt==`string`){let n={flaggedAt:t.flaggedAt};`seenAt`in t&&typeof t.seenAt==`string`&&(n.seenAt=t.seenAt),r[e]=n}return r}async function b(){try{return y(await m(v(),{encoding:`utf-8`}))}catch{return{}}}async function x(e){let n=v(),i=`${n}.${p(8).toString(`hex`)}.tmp`;try{await c().mkdir(t()),await _(i,r({plugins:e},null,2),{encoding:`utf-8`,mode:384}),await h(i,n),k=e}catch(e){d(e);try{await g(i)}catch{}}}async function S(){let e=await b(),t=Date.now(),n=!1;for(let[r,i]of Object.entries(e))i.seenAt&&t-new Date(i.seenAt).getTime()>=O&&(delete e[r],n=!0);k=e,n&&await x(e)}function C(){return k??{}}async function w(e){k===null&&(k=await b()),await x({...k,[e]:{flaggedAt:new Date().toISOString()}}),a(`Flagged plugin: ${e}`)}async function T(e){k===null&&(k=await b());let t=new Date().toISOString(),n=!1,r={...k};for(let i of e){let e=r[i];e&&!e.seenAt&&(r[i]={...e,seenAt:t},n=!0)}n&&await x(r)}async function E(e){if(k===null&&(k=await b()),!(e in k))return;let{[e]:t,...n}=k;k=n,await x(n)}var D,O,k,A=e((()=>{s(),o(),u(),l(),n(),D=`flagged-plugins.json`,O=2880*60*1e3,k=null}));export{T as a,S as i,C as n,E as o,A as r,w as t};
@@ -0,0 +1,2 @@
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{Ba as t,Bh as n,Fa as r,Fo as i,Ga as a,Ha as o,Ia as s,Ka as c,La as l,Ma as u,No as d,Pa as f,Po as p,Ra as m,UC as h,Ua as g,Xa as _,aw as v,co as y,do as b,dw as x,ew as S,fo as C,io as w,no as T,nw as E,ow as D,qa as O,ro as ee,rw as te,to as k,tw as A,uo as j,uw as M,xx as ne,yx as re,zC as ie,zh as ae}from"./loadAgentsDir-C96o6gCj.js";import{$ as N,Ut as oe}from"./state-D5D6QpTX.js";import{B as P,R as se,U as ce,f as F,u as I}from"./debug-D58GQBDG.js";import{b as L,h as R,s as z}from"./settings-BowI3jp-.js";import{o as B,s as V}from"./log-CZ7ploQm.js";import{l as H,o as U}from"./stringUtils-D7oJIyY2.js";import{n as W,t as G}from"./pluginStartupCheck-xQbHZ5gf.js";import{dirname as le,join as K}from"path";function q(e){if(!Q.includes(e))throw Error(`Invalid scope "${e}". Must be one of: ${Q.join(`, `)}`)}function ue(e){return Q.includes(e)}function J(e){return e===`project`||e===`local`?N():void 0}function de(e){return z(`projectSettings`)?.enabledPlugins?.[e]===!0}function fe(e){let t=e.includes(`@`);for(let n of[`local`,`project`,`user`]){let r=z(D(n))?.enabledPlugins;if(r){for(let i of Object.keys(r))if(t?i===e:i.startsWith(`${e}@`))return{pluginId:i,scope:n}}}return null}function pe(e,t){let{name:n,marketplace:r}=v(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}=v(e),n=T();if(n.plugins[e]?.length)return{pluginId:e,pluginName:t};let r=Object.keys(n.plugins).find(e=>{let{name:r}=v(e);return r===t&&(n.plugins[e]?.length??0)>0});return r?{pluginId:r,pluginName:t}:null}function Y(e){let t=T().plugins[e];if(!t||t.length===0)return{scope:`user`};let n=N(),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 a=t.find(e=>e.scope===`user`);return a?{scope:a.scope}:{scope:t[0].scope,projectPath:t[0].projectPath}}async function he(e,t=`user`){q(t);let{name:n,marketplace:r}=v(e),i,s,c;if(r){let t=await j(e);t&&(i=t.entry,s=r,c=t.marketplaceInstallLocation)}else{let e=await C();for(let[t,r]of Object.entries(e))try{let e=(await y(t)).plugins.find(e=>e.name===n);if(e){i=e,s=t,c=r.installLocation;break}}catch(e){V(ce(e))}}if(!i||!s)return{success:!1,message:`Plugin "${n}" not found in ${r?`marketplace "${r}"`:`any configured marketplace`}`};let l=i,u=`${l.name}@${s}`,d=await a({pluginId:u,entry:l,scope:t,marketplaceInstallLocation:c});if(!d.ok){let e=d;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:o(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: ${u} (scope: ${t})${d.depNote}`,pluginId:u,pluginName:l.name,scope:t}}async function ge(e,t=`user`,n=!0){q(t);let{enabled:r,disabled:a}=await m(),o=[...r,...a],s=pe(e,o),c=D(t),l=z(c),u,f;if(s)u=Object.keys(l?.enabledPlugins??{}).find(t=>t===e||t===s.name||t.startsWith(`${s.name}@`))??(e.includes(`@`)?e:s.name),f=s.name;else{let t=me(e);if(!t)return{success:!1,message:`Plugin "${e}" not found in installed plugins`};u=t.pluginId,f=t.pluginName}let p=J(t),h=T().plugins[u],g=h?.find(e=>e.scope===t&&e.projectPath===p);if(!g){let{scope:n}=Y(u);return n!==t&&h&&h.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 _=g.installPath,v={...l?.enabledPlugins};v[u]=void 0,L(c,{enabledPlugins:v}),d(),ee(u,t,p);let y=T().plugins[u],b=!y||y.length===0;b&&_&&await i(_),b&&(re(u),n&&await ie(u));let x=S(u,o),C=A(x);return{success:!0,message:`Successfully uninstalled plugin: ${f} (scope: ${t})${C}`,pluginId:u,pluginName:f,scope:t,reverseDependents:x.length>0?x:void 0}}async function X(e,t,r){let i=t?`enable`:`disable`;if(x(e)){let{error:n}=L(`userSettings`,{enabledPlugins:{...z(`userSettings`)?.enabledPlugins,[e]:t}});if(n)return{success:!1,message:`Failed to ${i} built-in plugin: ${n.message}`};d();let{name:r}=v(e);return{success:!0,message:`Successfully ${i}d built-in plugin: ${r}`,pluginId:e,pluginName:r,scope:`user`}}r&&q(r);let a,o,s=fe(e);if(r)if(o=r,s)a=s.pluginId;else if(e.includes(`@`))a=e;else return{success:!1,message:`Plugin "${e}" not found in settings. Use plugin@marketplace format.`};else if(s)a=s.pluginId,o=s.scope;else if(e.includes(`@`))a=e,o=`user`;else return{success:!1,message:`Plugin "${e}" not found in any editable settings scope. Use plugin@marketplace format.`};if(t&&n(a))return{success:!1,message:`Plugin "${a}" is blocked by your organization's policy and cannot be enabled`};let c=D(o),l=z(c)?.enabledPlugins?.[a],u={user:0,project:1,local:2},f=r&&s&&u[r]>u[s.scope];if(r&&l===void 0&&s&&s.scope!==r&&!f)return{success:!1,message:`Plugin "${e}" is installed at ${s.scope} scope, not ${r}. Use --scope ${s.scope} or omit --scope to auto-detect.`};if(t===(r&&!f?l===!0:G().has(a)))return{success:!1,message:`Plugin "${e}" is already ${t?`enabled`:`disabled`}${r?` at ${r} scope`:``}`};let p;if(!t){let{enabled:e,disabled:t}=await m(),n=S(a,[...e,...t]);n.length>0&&(p=n)}let{error:h}=L(c,{enabledPlugins:{...z(c)?.enabledPlugins,[a]:t}});if(h)return{success:!1,message:`Failed to ${i} plugin: ${h.message}`};d();let{name:g}=v(a),_=A(p);return{success:!0,message:`Successfully ${i}d plugin: ${g} (scope: ${o})${_}`,pluginId:a,pluginName:g,scope:o,reverseDependents:p}}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}=v(e),i=r?`${n}@${r}`:e,a=await j(e);if(!a)return{success:!1,message:`Plugin "${n}" not found`,pluginId:i,scope:t};let{entry:o,marketplaceInstallLocation:s}=a,c=k().plugins[i];if(!c||c.length===0)return{success:!1,message:`Plugin "${n}" is not installed`,pluginId:i,scope:t};let l=J(t),u=c.find(e=>e.scope===t&&e.projectPath===l);return u?be({pluginId:i,pluginName:n,entry:o,marketplaceInstallLocation:s,installation:u,scope:t,projectPath:l}):{success:!1,message:`Plugin "${n}" is not installed at scope ${l?`${t} (${l})`:t}`,pluginId:i,scope:t}}async function be({pluginId:e,pluginName:n,entry:a,marketplaceInstallLocation:o,installation:l,scope:d,projectPath:p}){let m=I(),h=l.version,g,_,v=!1,y;if(typeof a.source!=`string`){let t=await u(a.source,{manifest:{name:a.name}});g=t.path,v=!0,y=t.gitCommitSha,_=await c(e,a.source,t.manifest,t.path,a.version,t.gitCommitSha)}else{let n;try{n=await m.stat(o)}catch(t){if(P(t))return{success:!1,message:`Marketplace directory not found at ${o}`,pluginId:e,scope:d};throw t}g=K(n.isDirectory()?o:le(o),a.source);try{await m.stat(g)}catch(t){if(P(t))return{success:!1,message:`Plugin source not found at ${g}`,pluginId:e,scope:d};throw t}let r,i=K(g,`.claude-plugin`,`plugin.json`);try{r=await t(i,a.name,a.source)}catch{}_=await c(e,a.source,r,g,a.version)}try{let t=r(e,_),o=s(e,_);if(l.version===_||l.installPath===t||l.installPath===o)return{success:!0,message:`${n} is already at the latest version (${_}).`,pluginId:e,newVersion:_,oldVersion:h,alreadyUpToDate:!0,scope:d};t=await f(g,e,_,a);let c=l.installPath;if(w(e,d,p,t,_,y),c&&c!==t){let e=k();Object.values(e.plugins).some(e=>e.some(e=>e.installPath===c))||await i(c)}let u=p?`${d} (${p})`:d;return{success:!0,message:`Plugin "${n}" updated from ${h||`unknown`} to ${_} for scope ${u}. Restart to apply changes.`,pluginId:e,newVersion:_,oldVersion:h,scope:d}}finally{v&&g!==r(e,_)&&await m.rm(g,{recursive:!0,force:!0})}}var Q,$,xe=e((()=>{oe(),M(),se(),F(),B(),p(),E(),_(),b(),h(),te(),g(),l(),ne(),ae(),W(),O(),R(),U(),Q=[`user`,`project`,`local`],$=[`user`,`project`,`local`,`managed`]}));export{_e as a,he as c,ge as d,ye as f,ve as i,ue as l,$ as n,Y as o,Z as r,xe as s,Q as t,de as u};
@@ -0,0 +1 @@
1
+ import{n as e,t}from"./pluginStartupCheck-xQbHZ5gf.js";e();export{t as getPluginEditableScopes};
@@ -1 +1 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{Io as t,Mw as n,Nw as r,Ow as i,mo as a,xo as o}from"./loadAgentsDir-DaNpxaO-.js";import{n as s}from"./cwd-Nh5IZNKO.js";import{c,i as l}from"./debug-D58GQBDG.js";import{_t as u,h as d,s as f}from"./settings-3xZ0fsvE.js";import{o as p}from"./log-CZ7ploQm.js";import"path";function m(){let e=new Map,t=n();for(let[n,r]of Object.entries(t))n.includes(`@`)&&(r===!0?e.set(n,`flag`):r===!1&&e.delete(n));for(let{scope:n,source:r}of[{scope:`managed`,source:`policySettings`},{scope:`user`,source:`userSettings`},{scope:`project`,source:`projectSettings`},{scope:`local`,source:`localSettings`},{scope:`flag`,source:`flagSettings`}]){let i=f(r);if(i?.enabledPlugins)for(let[a,o]of Object.entries(i.enabledPlugins))a.includes(`@`)&&(a in t&&t[a]!==o&&c(`Plugin ${a} from --add-dir (${t[a]}) overridden by ${r} (${o})`),o===!0?e.set(a,n):o===!1&&e.delete(a))}return c(`Found ${e.size} enabled plugins with scopes: ${Array.from(e.entries()).map(([e,t])=>`${e}(${t})`).join(`, `)}`),e}var h=e((()=>{s(),l(),p(),d(),r(),o(),t(),i(),a(),u()}));export{h as n,m as t};
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{Ua as t,Xa as n,cw as r,do as i,rw as a,sw as o}from"./loadAgentsDir-C96o6gCj.js";import{n as s}from"./cwd-Nh5IZNKO.js";import{c,i as l}from"./debug-D58GQBDG.js";import{_t as u,h as d,s as f}from"./settings-BowI3jp-.js";import{o as p}from"./log-CZ7ploQm.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:r}of[{scope:`managed`,source:`policySettings`},{scope:`user`,source:`userSettings`},{scope:`project`,source:`projectSettings`},{scope:`local`,source:`localSettings`},{scope:`flag`,source:`flagSettings`}]){let i=f(r);if(i?.enabledPlugins)for(let[a,o]of Object.entries(i.enabledPlugins))a.includes(`@`)&&(a in t&&t[a]!==o&&c(`Plugin ${a} from --add-dir (${t[a]}) overridden by ${r} (${o})`),o===!0?e.set(a,n):o===!1&&e.delete(a))}return c(`Found ${e.size} enabled plugins with scopes: ${Array.from(e.entries()).map(([e,t])=>`${e}(${t})`).join(`, `)}`),e}var h=e((()=>{s(),l(),p(),d(),r(),n(),i(),a(),t(),u()}));export{h as n,m as t};
@@ -0,0 +1,4 @@
1
+ import{n as e,t}from"./figures-5ThXQEtq.js";import{Co as n,La as r,No as i,Po as a,Ra as o,Xa as s,_o as c,_x as l,ao as u,aw as d,do as f,eo as p,fo as m,fw as h,ho as g,jo as _,ko as v,mo as y,no as b,ow as x,pw as S,rw as C,vx as w,yo as T}from"./loadAgentsDir-C96o6gCj.js";import{Ut as E,rr as D}from"./state-D5D6QpTX.js";import{C as O,P as k,R as ee,x as te}from"./debug-D58GQBDG.js";import{o as ne,s as A}from"./log-CZ7ploQm.js";import{n as j,r as M}from"./analytics-DJobLaWP.js";import{l as N,o as P}from"./stringUtils-D7oJIyY2.js";import{n as F,t as I}from"./exit-s9XGerrH.js";import{n as L,s as R,t as z}from"./pluginOperations-Ca9Lup5G.js";import{a as B,i as V,n as H,o as U,r as W,t as re}from"./pluginCliCommands-WzzqR1Sr.js";import{a as G,c as K,i as q,n as J,r as Y,s as X,t as ie}from"./validatePlugin-DQ_9OCpP.js";import{basename as ae,dirname as Z}from"path";e(),E(),j(),R(),S(),ee(),ne(),a(),K(),s(),v(),f(),l(),q(),C(),r(),ie(),te(),P();function Q(e,n){A(e),I(`${t.cross} Failed to ${n}: ${k(e)}`)}function $(e){e.errors.length>0&&(console.log(`${t.cross} Found ${e.errors.length} ${N(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} ${N(e.warnings.length,`warning`)}:\n`),e.warnings.forEach(e=>{console.log(` ${t.pointer} ${e.path}: ${e.message}`)}),console.log(``))}async function oe(e,n){n.cowork&&D(!0);try{let n=await J(e);console.log(`Validating ${n.fileType} manifest: ${n.filePath}\n`),$(n);let r=[];if(n.fileType===`plugin`){let e=Z(n.filePath);if(ae(e)===`.claude-plugin`){r=await Y(Z(e));for(let e of r)console.log(`Validating ${e.fileType}: ${e.filePath}\n`),$(e)}}let i=n.success&&r.every(e=>e.success),a=n.warnings.length>0||r.some(e=>e.warnings.length>0);i?F(a?`${t.tick} Validation passed with warnings`:`${t.tick} Validation passed`):(console.log(`${t.cross} Validation failed`),process.exit(1))}catch(e){A(e),console.error(`${t.cross} Unexpected error during validation: ${k(e)}`),process.exit(2)}}async function se(e){e.cowork&&D(!0),M(`tengu_plugin_list_command`,{});let r=b(),{getPluginEditableScopes:i}=await import(`./pluginStartupCheck-DdtxcNwH.js`),a=i(),s=Object.keys(r.plugins),{enabled:c,disabled:l,errors:u}=await o(),f=[...c,...l],g=f.filter(e=>e.source.endsWith(`@inline`)),v=u.filter(e=>e.source.endsWith(`@inline`)||e.source.startsWith(`inline[`));if(e.json){let t=new Map(f.map(e=>[e.source,e])),i=[];for(let e of s.sort()){let n=r.plugins[e];if(!n||n.length===0)continue;let o=d(e).name,s=u.filter(t=>t.source===e||`plugin`in t&&t.plugin===o).map(h);for(let r of n){let n=t.get(e),o;if(n){let e=n.mcpServers||await w(n);e&&Object.keys(e).length>0&&(o=e)}i.push({id:e,version:r.version||`unknown`,scope:r.scope,enabled:a.has(e),installPath:r.installPath,installedAt:r.installedAt,lastUpdated:r.lastUpdated,projectPath:r.projectPath,mcpServers:o,errors:s.length>0?s:void 0})}}for(let e of g){let t=e.mcpServers||await w(e),n=v.filter(t=>t.source===e.source||`plugin`in t&&t.plugin===e.name).map(h);i.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:n.length>0?n:void 0})}for(let e of v.filter(e=>e.source.startsWith(`inline[`)))i.push({id:e.source,version:`unknown`,scope:`session`,enabled:!1,installPath:`path`in e?e.path:``,errors:[h(e)]});if(e.available){let e=[];try{let[t,r]=await Promise.all([m(),X()]),{marketplaces:i}=await _(t);for(let{name:t,data:a}of i)if(a)for(let i of a.plugins){let a=n(i.name,t);p(a)||e.push({pluginId:a,name:i.name,description:i.description,marketplaceName:t,version:i.version,source:i.source,installCount:r?.get(a)})}}catch{}F(O({installed:i,available:e},null,2))}else F(O(i,null,2))}s.length===0&&g.length===0&&v.length===0&&F("No plugins installed. Use `claude 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=d(e).name,o=u.filter(t=>t.source===e||`plugin`in t&&t.plugin===i);for(let r of n){let n=a.has(e),i=o.length>0?`${t.cross} failed to load`:n?`${t.tick} enabled`:`${t.cross} disabled`,s=r.version||`unknown`,c=r.scope;console.log(` ${t.pointer} ${e}`),console.log(` Version: ${s}`),console.log(` Scope: ${c}`),console.log(` Status: ${i}`);for(let e of o)console.log(` Error: ${h(e)}`);console.log(``)}}if(g.length>0||v.length>0){console.log(`Session-only plugins (--plugin-dir):
3
+ `);for(let e of g){let n=v.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: ${h(e)}`);console.log(``)}for(let e of v.filter(e=>e.source.startsWith(`inline[`)))console.log(` ${t.pointer} ${e.source}: ${t.cross} ${h(e)}\n`)}F()}async function ce(e,n){n.cowork&&D(!0);try{let r=await G(e);r||I(`${t.cross} Invalid marketplace source format. Try: owner/repo, https://..., or ./path`),`error`in r&&I(`${t.cross} ${r.error}`);let a=n.scope??`user`;a!==`user`&&a!==`project`&&a!==`local`&&I(`${t.cross} Invalid scope '${a}'. Use: user, project, or local`);let o=x(a),s=r;n.sparse&&n.sparse.length>0&&(s.source===`github`||s.source===`git`?s={...s,sparsePaths:n.sparse}:I(`${t.cross} --sparse is only supported for github and git marketplace sources (got: ${s.source})`)),console.log(`Adding marketplace...`);let{name:c,alreadyMaterialized:l,resolvedSource:d}=await u(s,e=>{console.log(e)});T(c,{source:d},o),i();let f=s.source;s.source===`github`&&(f=s.repo),M(`tengu_marketplace_added`,{source_type:f}),F(l?`${t.tick} Marketplace '${c}' already on disk — declared in ${a} settings`:`${t.tick} Successfully added marketplace: ${c} (declared in ${a} settings)`)}catch(e){Q(e,`add marketplace`)}}async function le(e){e.cowork&&D(!0);try{let n=await m(),r=Object.keys(n);e.json&&F(O(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&&F(`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(``)}),F()}catch(e){Q(e,`list marketplaces`)}}async function ue(e,n){n.cowork&&D(!0);try{await c(e),i(),M(`tengu_marketplace_removed`,{marketplace_name:e}),F(`${t.tick} Successfully removed marketplace: ${e}`)}catch(e){Q(e,`remove marketplace`)}}async function de(e,n){n.cowork&&D(!0);try{if(e)console.log(`Updating marketplace: ${e}...`),await g(e,e=>{console.log(e)}),i(),M(`tengu_marketplace_updated`,{marketplace_name:e}),F(`${t.tick} Successfully updated marketplace: ${e}`);else{let e=await m(),n=Object.keys(e);n.length===0&&F(`No marketplaces configured`),console.log(`Updating ${n.length} marketplace(s)...`),await y(),i(),M(`tengu_marketplace_updated_all`,{count:n.length}),F(`${t.tick} Successfully updated ${n.length} marketplace(s)`)}}catch(e){Q(e,`update marketplace(s)`)}}async function fe(e,t){t.cowork&&D(!0);let n=t.scope||`user`;t.cowork&&n!==`user`&&I(`--cowork can only be used with user scope`),z.includes(n)||I(`Invalid scope: ${n}. Must be one of: ${z.join(`, `)}.`);let{name:r,marketplace:i}=d(e);M(`tengu_plugin_install_command`,{_PROTO_plugin_name:r,...i&&{_PROTO_marketplace_name:i},scope:n}),await V(e,n)}async function pe(e,t){t.cowork&&D(!0);let n=t.scope||`user`;t.cowork&&n!==`user`&&I(`--cowork can only be used with user scope`),z.includes(n)||I(`Invalid scope: ${n}. Must be one of: ${z.join(`, `)}.`);let{name:r,marketplace:i}=d(e);M(`tengu_plugin_uninstall_command`,{_PROTO_plugin_name:r,...i&&{_PROTO_marketplace_name:i},scope:n}),await B(e,n,t.keepData)}async function me(e,t){t.cowork&&D(!0);let n;t.scope&&(z.includes(t.scope)||I(`Invalid scope "${t.scope}". Valid scopes: ${z.join(`, `)}`),n=t.scope),t.cowork&&n!==void 0&&n!==`user`&&I(`--cowork can only be used with user scope`),t.cowork&&n===void 0&&(n=`user`);let{name:r,marketplace:i}=d(e);M(`tengu_plugin_enable_command`,{_PROTO_plugin_name:r,...i&&{_PROTO_marketplace_name:i},scope:n??`auto`}),await W(e,n)}async function he(e,t){if(t.all&&e&&I(`Cannot use --all with a specific plugin`),!t.all&&!e&&I(`Please specify a plugin name or use --all to disable all plugins`),t.cowork&&D(!0),t.all){t.scope&&I(`Cannot use --scope with --all`),M(`tengu_plugin_disable_command`,{}),await re();return}let n;t.scope&&(z.includes(t.scope)||I(`Invalid scope "${t.scope}". Valid scopes: ${z.join(`, `)}`),n=t.scope),t.cowork&&n!==void 0&&n!==`user`&&I(`--cowork can only be used with user scope`),t.cowork&&n===void 0&&(n=`user`);let{name:r,marketplace:i}=d(e);M(`tengu_plugin_disable_command`,{_PROTO_plugin_name:r,...i&&{_PROTO_marketplace_name:i},scope:n??`auto`}),await H(e,n)}async function ge(e,t){t.cowork&&D(!0);let{name:n,marketplace:r}=d(e);M(`tengu_plugin_update_command`,{_PROTO_plugin_name:n,...r&&{_PROTO_marketplace_name:r}});let i=`user`;t.scope&&(L.includes(t.scope)||I(`Invalid scope "${t.scope}". Valid scopes: ${L.join(`, `)}`),i=t.scope),t.cowork&&i!==`user`&&I(`--cowork can only be used with user scope`),await U(e,i)}export{ce as marketplaceAddHandler,le as marketplaceListHandler,ue as marketplaceRemoveHandler,de as marketplaceUpdateHandler,he as pluginDisableHandler,me as pluginEnableHandler,fe as pluginInstallHandler,se as pluginListHandler,pe as pluginUninstallHandler,ge as pluginUpdateHandler,oe as pluginValidateHandler};
@@ -1 +1 @@
1
- import{n as e,r as t}from"./rolldown-runtime-DaDcL9Zw.js";import{b as n,h as r,t as i}from"./settings-3xZ0fsvE.js";var a=t({isPoorModeActive:()=>o,setPoorMode:()=>s});function o(){return c===null&&(c=i().poorMode===!0),c}function s(e){c=e,n(`userSettings`,{poorMode:e||void 0})}var c,l=e((()=>{r(),c=null}));export{s as i,o as n,a as r,l as t};
1
+ import{n as e,r as t}from"./rolldown-runtime-DaDcL9Zw.js";import{b as n,h as r,t as i}from"./settings-BowI3jp-.js";var a=t({isPoorModeActive:()=>o,setPoorMode:()=>s});function o(){return c===null&&(c=i().poorMode===!0),c}function s(e){c=e,n(`userSettings`,{poorMode:e||void 0})}var c,l=e((()=>{r(),c=null}));export{s as i,o as n,a as r,l as t};
@@ -0,0 +1 @@
1
+ import{n as e,t}from"./poorMode-Bt_A2arj.js";t();export{e as isPoorModeActive};