@readmagic/workmate 0.0.6 → 0.0.8

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 (556) hide show
  1. package/dist/chunks/AddWorkspaceDirectory-CwLtQld4.js +1 -0
  2. package/dist/chunks/App-Ba52HvYC.js +1 -0
  3. package/dist/chunks/{ApproveApiKey-Bsy8kr2a.js → ApproveApiKey-CEIfuUh0.js} +1 -1
  4. package/dist/chunks/ApproveApiKey-D2MLQu2P.js +1 -0
  5. package/dist/chunks/BackgroundTasksDialog-IGDrkbWl.js +2 -0
  6. package/dist/chunks/{BypassPermissionsModeDialog-BKj_3Idm.js → BypassPermissionsModeDialog-GYhq--JR.js} +1 -1
  7. package/dist/chunks/{ClaudeMdExternalIncludesDialog-BD-7yAZh.js → ClaudeMdExternalIncludesDialog-C-CTa-95.js} +1 -1
  8. package/dist/chunks/ClaudeMdExternalIncludesDialog-Catv6BCJ.js +1 -0
  9. package/dist/chunks/ConsoleOAuthFlow-BeQXqUtX.js +1 -0
  10. package/dist/chunks/{DiffDialog-C4XSSjvV.js → DiffDialog-AC5DSJrq.js} +6 -6
  11. package/dist/chunks/Doctor-B9Rxsoy0.js +1 -0
  12. package/dist/chunks/Doctor-lhUBhEy5.js +3 -0
  13. package/dist/chunks/{ExitFlow-BttnAv-O.js → ExitFlow-Cu8SoQHs.js} +2 -2
  14. package/dist/chunks/Grove-Bc4CofEj.js +11 -0
  15. package/dist/chunks/{HybridTransport-B8V6O6rM.js → HybridTransport-BJPOG2wl.js} +3 -3
  16. package/dist/chunks/{InvalidConfigDialog-CHzBSJDf.js → InvalidConfigDialog-BI13il58.js} +1 -1
  17. package/dist/chunks/{InvalidSettingsDialog-BKenH3bD.js → InvalidSettingsDialog-CtOheV1K.js} +1 -1
  18. package/dist/chunks/MCPConnectionManager-ao-P3xSA.js +1 -0
  19. package/dist/chunks/MCPToolListView-dkofcJs4.js +1 -0
  20. package/dist/chunks/{McpParsingWarnings-Bj2-YL8o.js → McpParsingWarnings-BS4JoR5l.js} +1 -1
  21. package/dist/chunks/MessageSelector-B88b2ypw.js +3 -0
  22. package/dist/chunks/Messages-BPeI7lLV.js +11 -0
  23. package/dist/chunks/Onboarding-c2fQ8Io_.js +1 -0
  24. package/dist/chunks/{PromptInputFooterSuggestions-egs9VvUs.js → PromptInputFooterSuggestions-D1cH9sDX.js} +1 -1
  25. package/dist/chunks/{PromptInputHelpMenu-SieM5NoY.js → PromptInputHelpMenu-DDD5WuK0.js} +1 -1
  26. package/dist/chunks/QueryEngine-Cv_meCam.js +1 -0
  27. package/dist/chunks/REPL-BXhAQOXb.js +139 -0
  28. package/dist/chunks/REPL-YqjLnr3A.js +1 -0
  29. package/dist/chunks/RemoteSessionManager-CT7T8BaR.js +2 -0
  30. package/dist/chunks/ResumeConversation-CIZCjms9.js +1 -0
  31. package/dist/chunks/{SSETransport-DtpMDekF.js → SSETransport-CrwbKuVt.js} +3 -3
  32. package/dist/chunks/SearchExtraToolsTool-Dx6093yw.js +1 -0
  33. package/dist/chunks/Settings-CyUm0AtU.js +2 -0
  34. package/dist/chunks/{TeleportProgress-rYaHIEfe.js → TeleportProgress-C3qyp5zy.js} +1 -1
  35. package/dist/chunks/TeleportRepoMismatchDialog-BV--nyYn.js +1 -0
  36. package/dist/chunks/TeleportResumeWrapper-Blo2cZg-.js +1 -0
  37. package/dist/chunks/ThemePicker-EQ6hPUeI.js +1 -0
  38. package/dist/chunks/TrustDialog-BukWGvHZ.js +1 -0
  39. package/dist/chunks/{ValidationErrorsList-B8pRiGuy.js → ValidationErrorsList-DokTJQwi.js} +1 -1
  40. package/dist/chunks/{WelcomeV2-DqnbSdIu.js → WelcomeV2-Ci9VwPYh.js} +1 -1
  41. package/dist/chunks/{add-dir-C2Hu3oE4.js → add-dir-DPQV0qml.js} +1 -1
  42. package/dist/chunks/{agentDisplay-XoDJhr03.js → agentDisplay-DBQYOaOh.js} +1 -1
  43. package/dist/chunks/agents-DmybpgDN.js +103 -0
  44. package/dist/chunks/{agents-C4QXeHIJ.js → agents-HlKk68Qc.js} +1 -1
  45. package/dist/chunks/allErrors-BPn_2TrB.js +1 -0
  46. package/dist/chunks/analytics-CkYUHW_U.js +1 -0
  47. package/dist/chunks/ant-DjdvlLOo.js +1 -0
  48. package/dist/chunks/api-AMgj1zf_.js +1 -0
  49. package/dist/chunks/api-CF5IVtj0.js +1 -0
  50. package/dist/chunks/{asciicast-CbAjUHT_.js → asciicast-BJNYO5sh.js} +1 -1
  51. package/dist/chunks/asciicast-CH6hdK0a.js +1 -0
  52. package/dist/chunks/auth-CNjDn1VY.js +15 -0
  53. package/dist/chunks/auth-CZzP483s.js +1 -0
  54. package/dist/chunks/auth-DDSBm_Yj.js +1 -0
  55. package/dist/chunks/{autoMode-BNukrVAB.js → autoMode-Cr0AhS1G.js} +5 -5
  56. package/dist/chunks/{autonomy-BEmI7WVW.js → autonomy-ARUQt-Lu.js} +1 -1
  57. package/dist/chunks/autonomy-D4xZLOdJ.js +15 -0
  58. package/dist/chunks/{autonomyPanel-fhge09AG.js → autonomyPanel-BQK9MoeB.js} +1 -1
  59. package/dist/chunks/backgroundHousekeeping--eBgphcg.js +17 -0
  60. package/dist/chunks/backgroundHousekeeping-VV1V_Y2Z.js +1 -0
  61. package/dist/chunks/{banner-CWkrK10u.js → banner-Ca7rki2V.js} +2 -2
  62. package/dist/chunks/bg-BK_9J6F6.js +1 -0
  63. package/dist/chunks/{bg-WnYN5ifx.js → bg-DxRHF1yn.js} +2 -2
  64. package/dist/chunks/{branch-Bpe-gocq.js → branch-BYq0zpzT.js} +1 -1
  65. package/dist/chunks/{break-cache-C_p7Kmx2.js → break-cache-BKvoMOZx.js} +2 -2
  66. package/dist/chunks/bridgeConfig-C82un7rJ.js +1 -0
  67. package/dist/chunks/{bridgeConfig-BhxRF2vm.js → bridgeConfig-jDEva6Eh.js} +1 -1
  68. package/dist/chunks/bridgeMessaging-YqYdl6ej.js +1 -0
  69. package/dist/chunks/bridgePointer-DIM0sj0x.js +1 -0
  70. package/dist/chunks/btw-CUV3nRrE.js +1 -0
  71. package/dist/chunks/caches-BZ59_En6.js +1 -0
  72. package/dist/chunks/caches-Cg-HtWKG.js +1 -0
  73. package/dist/chunks/capacityWake-CKOiRELo.js +3 -0
  74. package/dist/chunks/ccrClient-BC2q3k44.js +1 -0
  75. package/dist/chunks/{claudeDesktop-Cx31Ugjp.js → claudeDesktop-DQXL5bGm.js} +1 -1
  76. package/dist/chunks/{clear-B4d38ssF.js → clear-1etSJhdg.js} +1 -1
  77. package/dist/chunks/{cliLaunch-BkPAatcs.js → cliLaunch-CQjLYRzM.js} +1 -1
  78. package/dist/chunks/client-DQXvVKND.js +1 -0
  79. package/dist/chunks/client-DQwf_b9o.js +17 -0
  80. package/dist/chunks/client-DkgC-mFB.js +1 -0
  81. package/dist/chunks/color-CBsNbt1s.js +1 -0
  82. package/dist/chunks/commands-qM5z_Uld.js +1 -0
  83. package/dist/chunks/compact-BclJiRJe.js +2 -0
  84. package/dist/chunks/completionCache-BMHAktkM.js +1 -0
  85. package/dist/chunks/config-CE058cvr.js +3 -0
  86. package/dist/chunks/config-D81avYye.js +1 -0
  87. package/dist/chunks/config-DpOOllGk.js +1 -0
  88. package/dist/chunks/context-noninteractive-Ct_ttQfP.js +29 -0
  89. package/dist/chunks/context-noninteractive-DJb8H_hN.js +1 -0
  90. package/dist/chunks/context-sR9fJmXE.js +1 -0
  91. package/dist/chunks/conversation-D48Kt3ar.js +1 -0
  92. package/dist/chunks/conversation-fOFTa7k5.js +1 -0
  93. package/dist/chunks/{createSSHSession-BM-5pbv6.js → createSSHSession-BmHXA2me.js} +1 -1
  94. package/dist/chunks/createSession-C4rukWkv.js +1 -0
  95. package/dist/chunks/createSession-CSwlW2T2.js +1 -0
  96. package/dist/chunks/crossProjectResume-lDFB2ZcY.js +40 -0
  97. package/dist/chunks/cwd-5Xr-Qka6.js +1 -0
  98. package/dist/chunks/cwd-C5ce-7WB.js +1 -0
  99. package/dist/chunks/{daemon-YtZbMQtn.js → daemon-ZtpTZWgQ.js} +1 -1
  100. package/dist/chunks/{datadog-CpqEQbHa.js → datadog-BJn5ECIu.js} +1 -1
  101. package/dist/chunks/{debug-BrXObCdR.js → debug-RZ4NuXyS.js} +1 -1
  102. package/dist/chunks/debugUtils-D30M1cbN.js +1 -0
  103. package/dist/chunks/{detached-TYk4hMFj.js → detached-jrVP11oU.js} +1 -1
  104. package/dist/chunks/{detectRepository-BPr0VWNO.js → detectRepository-CFiHe6Rv.js} +1 -1
  105. package/dist/chunks/detectRepository-DqQvyj_a.js +1 -0
  106. package/dist/chunks/{diff-CVzOodeg.js → diff-BKiK3xHv.js} +1 -1
  107. package/dist/chunks/directoryCompletion-BagQcynj.js +1 -0
  108. package/dist/chunks/doctor-BEHYm34V.js +1 -0
  109. package/dist/chunks/{entry-DHVYCR26.js → entry-BzL1MFQG.js} +4 -4
  110. package/dist/chunks/esm-BLPbfHQd.js +1 -0
  111. package/dist/chunks/{execFileNoThrow-D244NytW.js → execFileNoThrow-CCX-JY8h.js} +1 -1
  112. package/dist/chunks/{execSyncWrapper-CCMQShK-.js → execSyncWrapper-dhRSYGFW.js} +1 -1
  113. package/dist/chunks/exit-DE2YiAhQ.js +1 -0
  114. package/dist/chunks/{lazySchema-DcIJE_0i.js → external-CEp-aPkt.js} +1 -1
  115. package/dist/chunks/extraUsage-Dw7AXiH7.js +1 -0
  116. package/dist/chunks/extractMemories-DxTUMiv3.js +1 -0
  117. package/dist/chunks/fast-CHmMkIpE.js +1 -0
  118. package/dist/chunks/fast-uQASHWqR.js +1 -0
  119. package/dist/chunks/fileSuggestions-Dyu2kQtE.js +3 -0
  120. package/dist/chunks/firstPartyEventLogger-D5ohKbIe.js +5 -0
  121. package/dist/chunks/firstPartyEventLogger-LsNY6yOt.js +1 -0
  122. package/dist/chunks/flushGate-Cnsu4HET.js +1 -0
  123. package/dist/chunks/gemini-Cudre91e.js +1 -0
  124. package/dist/chunks/{generateRecap-jGDLI_wU.js → generateRecap-CiFxXlmH.js} +1 -1
  125. package/dist/chunks/generateSessionName-DitoBxJT.js +1 -0
  126. package/dist/chunks/{genericProcessUtils-CdQTApYX.js → genericProcessUtils-DVfMHhfy.js} +1 -1
  127. package/dist/chunks/git-BerW9bId.js +6 -0
  128. package/dist/chunks/git-D6dOU2mT.js +1 -0
  129. package/dist/chunks/githubRepoPathMapping-DGr0kJ8D.js +1 -0
  130. package/dist/chunks/{goal-CFx4eRkf.js → goal-DuUayfDg.js} +3 -3
  131. package/dist/chunks/grok-tRbmZzEh.js +1 -0
  132. package/dist/chunks/grove-Cv19v6Sv.js +7 -0
  133. package/dist/chunks/help-DkqxbFDM.js +1 -0
  134. package/dist/chunks/{hooks-X6J03MnA.js → hooks-BZJTWD07.js} +2 -2
  135. package/dist/chunks/hooks-CsP42iOp.js +1 -0
  136. package/dist/chunks/initReplBridge-DdsSWVqN.js +1 -0
  137. package/dist/chunks/{install-D5YORIJL.js → install-BI---dv0.js} +1 -1
  138. package/dist/chunks/{instrumentation-Bw3CxPQf.js → instrumentation-CcWzhGfE.js} +4 -4
  139. package/dist/chunks/{job-DOWtcltx.js → job-B0ftcqPF.js} +1 -1
  140. package/dist/chunks/{jwtUtils-DE2GPUcx.js → jwtUtils-C0cE-1Ey.js} +1 -1
  141. package/dist/chunks/keybindings-DZU3vwo3.js +2 -0
  142. package/dist/chunks/language-DHhXLb_Y.js +1 -0
  143. package/dist/chunks/{language-C6Fq-XOZ.js → language-s-dLbdVz.js} +1 -1
  144. package/dist/chunks/launchLocalMemory-twLxpPvg.js +3 -0
  145. package/dist/chunks/{launchOnboarding-Cc6WwPX9.js → launchOnboarding-BWz2XSb9.js} +1 -1
  146. package/dist/chunks/lazySchema-B4D4qJVE.js +1 -0
  147. package/dist/chunks/{loadAgentsDir-D206qwP3.js → loadAgentsDir-ByO8eJqU.js} +1724 -1993
  148. package/dist/chunks/loadAgentsDir-CMNFLt7R.js +1 -0
  149. package/dist/chunks/loadPluginHooks-BPnxcgrL.js +1 -0
  150. package/dist/chunks/{localSearch-CzrbOklu.js → localSearch-CHHCH16D.js} +1 -1
  151. package/dist/chunks/localSearch-DzQODFap.js +1 -0
  152. package/dist/chunks/log-CZ0zYP_c.js +1 -0
  153. package/dist/chunks/logoV2Utils-CGUJ-5gY.js +1 -0
  154. package/dist/chunks/{magicDocs-DWjL2k7P.js → magicDocs-C5i5ruuU.js} +3 -3
  155. package/dist/chunks/{main-D862LI_d.js → main-BLD4QAQg.js} +2 -2
  156. package/dist/chunks/{main-BohPzJFF.js → main-D4Uk-WUs.js} +89 -86
  157. package/dist/chunks/managedEnv-C-9XSN14.js +1 -0
  158. package/dist/chunks/managedEnv-DLVRBaA9.js +1 -0
  159. package/dist/chunks/managedEnvConstants-BPwL2aWI.js +1 -0
  160. package/dist/chunks/{mappers-BDMZFgKx.js → mappers-CHRFic5q.js} +1 -1
  161. package/dist/chunks/mcp-BMVdGknC.js +1 -0
  162. package/dist/chunks/mcp-COS5RJFS.js +6 -0
  163. package/dist/chunks/mcp-tGsOW1GN.js +2 -0
  164. package/dist/chunks/memoize-B8hfb1JN.js +1 -0
  165. package/dist/chunks/memory-DR6poqeH.js +1 -0
  166. package/dist/chunks/{mode-CUkHFkju.js → mode-QV-NW1Wd.js} +2 -2
  167. package/dist/chunks/model-BF_4ebyl.js +1 -0
  168. package/dist/chunks/{model-BY3auM2c.js → model-BNU_ulDJ.js} +1 -1
  169. package/dist/chunks/model-CwO-g1RW.js +1 -0
  170. package/dist/chunks/nativeInstaller-B-lNJjM-.js +1 -0
  171. package/dist/chunks/observationStore-BpjlK0pG.js +3 -0
  172. package/dist/chunks/omit-DZCEXri5.js +1 -0
  173. package/dist/chunks/onChangeAppState-BmfM5g-D.js +1 -0
  174. package/dist/chunks/openai-DPH6rXOZ.js +10 -0
  175. package/dist/chunks/{panel-BSZGX6jN.js → panel-mD094ALT.js} +1 -1
  176. package/dist/chunks/{panelCall-BsVoL1uF.js → panelCall-SbffM7G4.js} +1 -1
  177. package/dist/chunks/parser-DrBC8nWp.js +1 -0
  178. package/dist/chunks/{parser-DFwaTGf7.js → parser-dbHRgXb8.js} +1 -1
  179. package/dist/chunks/partition-DKuAFJkc.js +1 -0
  180. package/dist/chunks/{path-D5U-tm91.js → path-Cv9QMBAX.js} +1 -1
  181. package/dist/chunks/permissions-ey-bfanE.js +3 -0
  182. package/dist/chunks/{pidLock-D5rUnDB-.js → pidLock-DJnS_38v.js} +2 -2
  183. package/dist/chunks/{pipeTransport-CqCnc-Ys.js → pipeTransport-DVOKR4c_.js} +1 -1
  184. package/dist/chunks/{plan-SYZ4DXR8.js → plan-Brg9XnRr.js} +1 -1
  185. package/dist/chunks/{platform-BrYefG_2.js → platform-DCXXznJg.js} +1 -1
  186. package/dist/chunks/plugin-CRwa39Y1.js +17 -0
  187. package/dist/chunks/pluginAutoupdate-D0LIP7cy.js +1 -0
  188. package/dist/chunks/{pluginBlocklist-C3H2afWG.js → pluginBlocklist-PwHHD3nj.js} +1 -1
  189. package/dist/chunks/pluginCliCommands-BJM5Bdpf.js +1 -0
  190. package/dist/chunks/pluginFlagging-pBxSselw.js +1 -0
  191. package/dist/chunks/pluginOperations-C7p_Qr2r.js +2 -0
  192. package/dist/chunks/pluginStartupCheck-C0HqhG6D.js +1 -0
  193. package/dist/chunks/pluginStartupCheck-Di4LjHXf.js +1 -0
  194. package/dist/chunks/{plugins-Dn6ceWrT.js → plugins-DUKNjLq6.js} +4 -4
  195. package/dist/chunks/pollConfig-BgpfHQPJ.js +1 -0
  196. package/dist/chunks/{poorMode-DhzFKpPl.js → poorMode-CYXmr_mU.js} +1 -1
  197. package/dist/chunks/poorMode-CejPNCp-.js +1 -0
  198. package/dist/chunks/print-gyTOCJzk.js +23 -0
  199. package/dist/chunks/processBashCommand-Cze9vCm6.js +1 -0
  200. package/dist/chunks/processSlashCommand-BRajh1v7.js +5 -0
  201. package/dist/chunks/prompt-B7joRiqj.js +139 -0
  202. package/dist/chunks/prompt-DqSMh2x9.js +1 -0
  203. package/dist/chunks/prompt-Eysh8Et_.js +1 -0
  204. package/dist/chunks/{promptEditor-DeMrXUir.js → promptEditor-R_acDAgI.js} +2 -2
  205. package/dist/chunks/{protocolHandler-BHxBy84Z.js → protocolHandler-RNKkhq91.js} +1 -1
  206. package/dist/chunks/{proxy-CRN7jYIi.js → proxy-BmtEnJ02.js} +1 -1
  207. package/dist/chunks/rcDebugLog-CARUIORE.js +1 -0
  208. package/dist/chunks/reconciler-BfkO6X2X.js +4 -0
  209. package/dist/chunks/refresh-C1X3sptR.js +1 -0
  210. package/dist/chunks/registerProtocol-DoKqmqu2.js +36 -0
  211. package/dist/chunks/{reload-plugins-B9IT9CFA.js → reload-plugins-C0osFcNh.js} +1 -1
  212. package/dist/chunks/remoteBridgeCore-Cddqv2WW.js +1 -0
  213. package/dist/chunks/remoteManagedSettings-B1mnRDmA.js +1 -0
  214. package/dist/chunks/rename-B3tf-YiD.js +1 -0
  215. package/dist/chunks/{renderOptions-BUJB9nAm.js → renderOptions-ChLwxtVu.js} +1 -1
  216. package/dist/chunks/replBridgeHandle-CNwNIijW.js +1 -0
  217. package/dist/chunks/{resume-y7MCTZHJ.js → resume-Be1G_GBL.js} +2 -2
  218. package/dist/chunks/ripgrep-C2PhTJDh.js +1 -0
  219. package/dist/chunks/{ripgrep-BXmXjAzA.js → ripgrep-gaT9Njwi.js} +1 -1
  220. package/dist/chunks/{runtimeObserver-BZcJ1FbH.js → runtimeObserver-CsIwinzh.js} +1 -1
  221. package/dist/chunks/runtimeObserver-Dbxxw4ls.js +10 -0
  222. package/dist/chunks/sandbox-adapter-C6GBuJPB.js +1 -0
  223. package/dist/chunks/sandbox-toggle-jEySONTW.js +1 -0
  224. package/dist/chunks/searchExtraTools-C_UTryh_.js +1 -0
  225. package/dist/chunks/session-DDI1Eb2x.js +2 -0
  226. package/dist/chunks/sessionFileAccessHooks-DfJ7Htfl.js +1 -0
  227. package/dist/chunks/sessionIdCompat-DMayYBrf.js +1 -0
  228. package/dist/chunks/sessionMemory-CQBxPkTQ.js +1 -0
  229. package/dist/chunks/sessionMemory-s0ALUHvc.js +1 -0
  230. package/dist/chunks/sessionMemoryUtils-xt7dTHGC.js +1 -0
  231. package/dist/chunks/sessionObserver-C2sYqWL3.js +1 -0
  232. package/dist/chunks/sessionObserver-DoYc0ZOP.js +20 -0
  233. package/dist/chunks/sessionState-CjNY991n.js +11 -0
  234. package/dist/chunks/sessionStorage-DqsY-7pi.js +1 -0
  235. package/dist/chunks/{sessionTitle-coed9IuJ.js → sessionTitle-B0OYf5nM.js} +3 -3
  236. package/dist/chunks/sessionTracing-CwsXt_uA.js +11 -0
  237. package/dist/chunks/settings-BWtOA9A7.js +1 -0
  238. package/dist/chunks/settings-hQDLwPVj.js +20 -0
  239. package/dist/chunks/settingsSync-DdFagwHV.js +1 -0
  240. package/dist/chunks/setup-DzC22EkN.js +3 -0
  241. package/dist/chunks/{shadowedRuleDetection-D1wsAdpp.js → shadowedRuleDetection-C86PTj1m.js} +1 -1
  242. package/dist/chunks/{shellQuote-DkSy9MYE.js → shellQuote-BUVKMu_P.js} +1 -1
  243. package/dist/chunks/{sideQuestion-wSi38p81.js → sideQuestion-C780iYwd.js} +3 -3
  244. package/dist/chunks/sinks-5G_xhc1Q.js +1 -0
  245. package/dist/chunks/{sinks-C_Dl1p4K.js → sinks-Cftq7Es0.js} +2 -2
  246. package/dist/chunks/skillChangeDetector-plLveEbf.js +1 -0
  247. package/dist/chunks/skillGapStore-Dc1arohs.js +5 -0
  248. package/dist/chunks/skillLifecycle-DP6mY1Kp.js +8 -0
  249. package/dist/chunks/{skillSearchPanel-CErRnUwo.js → skillSearchPanel-CpLTImaL.js} +4 -4
  250. package/dist/chunks/{skills-CBKhfg_a.js → skills-zGYaYfFV.js} +1 -1
  251. package/dist/chunks/{src-D06Xyj4g.js → src-BN7QRYLl.js} +1 -1
  252. package/dist/chunks/startupProfiler-DCn_NxMH.js +3 -0
  253. package/dist/chunks/startupProfiler-JbpAkfNE.js +1 -0
  254. package/dist/chunks/{state-ix0xIunV.js → state-C2OSZkV1.js} +1 -1
  255. package/dist/chunks/state-DU9lRJ9x.js +1 -0
  256. package/dist/chunks/{stats-BY4dskVg.js → stats-Duk7_xjQ.js} +1 -1
  257. package/dist/chunks/{status-BnJIXtKl.js → status-CFw-FpZM.js} +2 -2
  258. package/dist/chunks/{status-DU-B4SMW.js → status-peiVB_2j.js} +1 -1
  259. package/dist/chunks/statusNoticeHelpers-B5U5c9PE.js +1 -0
  260. package/dist/chunks/{stringUtils-DGLPkqJ4.js → stringUtils-B6FudhoZ.js} +1 -1
  261. package/dist/chunks/switcher-BAMqSX7Z.js +1 -0
  262. package/dist/chunks/switcher-hgBgVzLb.js +1 -0
  263. package/dist/chunks/syncCache-Zl9kZRRl.js +1 -0
  264. package/dist/chunks/{tasks-CBVL005y.js → tasks-BxpyRhmD.js} +1 -1
  265. package/dist/chunks/teleport-CwxeD5vL.js +1 -0
  266. package/dist/chunks/{templateJobs-D6998LcG.js → templateJobs-DR5fKFiO.js} +1 -1
  267. package/dist/chunks/{terminalSetup-0SBdyKF5.js → terminalSetup-DgRBt-JJ.js} +1 -1
  268. package/dist/chunks/terminalSetup-DlaFWI81.js +33 -0
  269. package/dist/chunks/{theme-p0AooruD.js → theme-Bz6esfST.js} +1 -1
  270. package/dist/chunks/{tmux-BY7IdQ1f.js → tmux-DSU9tYIo.js} +1 -1
  271. package/dist/chunks/{toolEventObserver-DTccwC3c.js → toolEventObserver-BSekCkM2.js} +1 -1
  272. package/dist/chunks/toolPool-B7SIoDw5.js +1 -0
  273. package/dist/chunks/{trustedDevice-BTYoQCkC.js → trustedDevice-B0x9X0fb.js} +1 -1
  274. package/dist/chunks/trustedDevice-CjHQtVkO.js +1 -0
  275. package/dist/chunks/{types-C-MRCL8J.js → types-D7_37tP2.js} +2 -2
  276. package/dist/chunks/{udsClient-BuCtv7dN.js → udsClient-CHoMMH28.js} +1 -1
  277. package/dist/chunks/{up-BHkC97_C.js → up-B8wBSpLg.js} +1 -1
  278. package/dist/chunks/{updateCCB-DFL5Wt_I.js → updateCCB-D_kGQKPT.js} +1 -1
  279. package/dist/chunks/{upstreamproxy-DyR_eXO8.js → upstreamproxy-Hmq-n8fw.js} +1 -1
  280. package/dist/chunks/useExitOnCtrlCDWithKeybindings-Cce612uS.js +1 -0
  281. package/dist/chunks/useMainLoopModel-BICP6_Fi.js +1 -0
  282. package/dist/chunks/useManagePlugins-DtbY_vPL.js +1 -0
  283. package/dist/chunks/useMergedTools-Ckx2IEhF.js +1 -0
  284. package/dist/chunks/{useSearchInput-D1Vr2Js1.js → useSearchInput-BAgljZUl.js} +1 -1
  285. package/dist/chunks/useSettingsErrors-CAJR_wpd.js +1 -0
  286. package/dist/chunks/userAgent-BxTG7IMk.js +1 -0
  287. package/dist/chunks/{util-BaDs-wL5.js → util-DDtmyq_r.js} +1 -1
  288. package/dist/chunks/validatePlugin-AHl-g4ct.js +1 -0
  289. package/dist/chunks/{vim-C-icQDz1.js → vim-kg-mRVbu.js} +1 -1
  290. package/dist/chunks/{which-CKQnSouy.js → which-CHLNJmtJ.js} +1 -1
  291. package/dist/chunks/windowsPaths-Pmx8LDR6.js +1 -0
  292. package/dist/chunks/{windowsPaths-DtapVxOo.js → windowsPaths-o62uq6LF.js} +1 -1
  293. package/dist/chunks/{workSecret-CNWiR2uQ.js → workSecret-DG9shvG0.js} +1 -1
  294. package/dist/chunks/workerRegistry-C7H_lsQX.js +6 -0
  295. package/dist/chunks/worktree-O2p-mJdF.js +1 -0
  296. package/dist/cli.js +1 -1
  297. package/package.json +1 -1
  298. package/dist/chunks/AddWorkspaceDirectory-ClHi-Dr6.js +0 -1
  299. package/dist/chunks/App-BP06lHmf.js +0 -1
  300. package/dist/chunks/ApproveApiKey-a2ZonQ3n.js +0 -1
  301. package/dist/chunks/AssistantSessionChooser-CcocKoTJ.js +0 -1
  302. package/dist/chunks/BackgroundTasksDialog-DNeBhGCf.js +0 -2
  303. package/dist/chunks/ClaudeMdExternalIncludesDialog-DFivNFuo.js +0 -1
  304. package/dist/chunks/ConsoleOAuthFlow-CS3zjEPF.js +0 -1
  305. package/dist/chunks/DesktopHandoff-BmPmCfT3.js +0 -1
  306. package/dist/chunks/Dialog-vfLXEPed.js +0 -1
  307. package/dist/chunks/Doctor-BhD-ZzZm.js +0 -1
  308. package/dist/chunks/Doctor-DEQe2q16.js +0 -3
  309. package/dist/chunks/Feedback-BaYA8-SU.js +0 -2
  310. package/dist/chunks/Grove-BJziCbZH.js +0 -11
  311. package/dist/chunks/Grove-sWm-oLBf.js +0 -1
  312. package/dist/chunks/ListItem-vfLXEPed.js +0 -1
  313. package/dist/chunks/MCPConnectionManager-CNh9dNlk.js +0 -1
  314. package/dist/chunks/MessageSelector-DdR6wJhh.js +0 -3
  315. package/dist/chunks/Messages-Ch6cboMV.js +0 -11
  316. package/dist/chunks/Onboarding-BrAJp0aL.js +0 -1
  317. package/dist/chunks/OverageCreditUpsell-Ds1cB7RC.js +0 -1
  318. package/dist/chunks/PluginSettings-CGqEzejq.js +0 -17
  319. package/dist/chunks/QueryEngine-CZZMl3PB.js +0 -1
  320. package/dist/chunks/REPL-CG2N7E4Q.js +0 -142
  321. package/dist/chunks/REPL-DvA910N_.js +0 -1
  322. package/dist/chunks/RemoteCallout-Cs-ro8_i.js +0 -1
  323. package/dist/chunks/RemoteSessionManager-B740Dp6m.js +0 -2
  324. package/dist/chunks/ResumeConversation-DzV2zmuX.js +0 -1
  325. package/dist/chunks/SearchExtraToolsTool-C4uO-Zx3.js +0 -1
  326. package/dist/chunks/Settings-XKw6FI_m.js +0 -2
  327. package/dist/chunks/TeleportRepoMismatchDialog-DY97YZMB.js +0 -1
  328. package/dist/chunks/TeleportResumeWrapper-jaQzyTCh.js +0 -1
  329. package/dist/chunks/ThemePicker-BViWzLp3.js +0 -1
  330. package/dist/chunks/TrustDialog-DGJ_BisZ.js +0 -1
  331. package/dist/chunks/TungstenTool-Cb7gJvq4.js +0 -1
  332. package/dist/chunks/TungstenTool-CxMQVCuF.js +0 -1
  333. package/dist/chunks/agents-BIHTGDYh.js +0 -103
  334. package/dist/chunks/allErrors-1896uQA1.js +0 -1
  335. package/dist/chunks/analytics-BotDBGh0.js +0 -1
  336. package/dist/chunks/ant-B6k6cBts.js +0 -1
  337. package/dist/chunks/api-BsFW57_Q.js +0 -1
  338. package/dist/chunks/api-gqTA-D7n.js +0 -1
  339. package/dist/chunks/asciicast-BsWpcxrc.js +0 -1
  340. package/dist/chunks/assistant-C83quuNj.js +0 -1
  341. package/dist/chunks/assistant-DJ9hd4uC.js +0 -1
  342. package/dist/chunks/assistant-z2o4-UJe.js +0 -1
  343. package/dist/chunks/auth-8Vd3_U8t.js +0 -1
  344. package/dist/chunks/auth-BnSrKyJe.js +0 -15
  345. package/dist/chunks/auth-DRTjfnGy.js +0 -1
  346. package/dist/chunks/autonomy-DGcy5Rml.js +0 -15
  347. package/dist/chunks/backgroundHousekeeping-3i_d_WW5.js +0 -1
  348. package/dist/chunks/backgroundHousekeeping-BVMf_Tjn.js +0 -17
  349. package/dist/chunks/bg-B0iMGM9C.js +0 -1
  350. package/dist/chunks/bridge-D12Shbkj.js +0 -2
  351. package/dist/chunks/bridgeConfig-CqIQ_rvD.js +0 -1
  352. package/dist/chunks/bridgeEnabled-D0XC5kNh.js +0 -1
  353. package/dist/chunks/bridgeEnabled-SbB-6zdY.js +0 -1
  354. package/dist/chunks/bridgeMain-DHUpZFgL.js +0 -68
  355. package/dist/chunks/bridgeMain-DUbQjgCp.js +0 -1
  356. package/dist/chunks/bridgeMessaging-DHc5dOhB.js +0 -1
  357. package/dist/chunks/bridgePointer-MqLe5Asm.js +0 -1
  358. package/dist/chunks/browser-BmZuQom6.js +0 -1
  359. package/dist/chunks/btw-D9hMM5d2.js +0 -1
  360. package/dist/chunks/caches-CWzT7e6Y.js +0 -1
  361. package/dist/chunks/caches-UeVVM3T0.js +0 -3
  362. package/dist/chunks/capacityWake-CV_x9H8j.js +0 -1
  363. package/dist/chunks/ccrClient-Iza0L8Zw.js +0 -1
  364. package/dist/chunks/client-BzKQTXzF.js +0 -1
  365. package/dist/chunks/color-D8VOyoYl.js +0 -1
  366. package/dist/chunks/commands-DDamMmo4.js +0 -1
  367. package/dist/chunks/commitAttribution-CgohL8vD.js +0 -1
  368. package/dist/chunks/commitAttribution-ChAgixdj.js +0 -2
  369. package/dist/chunks/compact-IFHwxjZ9.js +0 -2
  370. package/dist/chunks/completionCache-MN3_MqK8.js +0 -4
  371. package/dist/chunks/completionCache-c4aiyZ_f.js +0 -1
  372. package/dist/chunks/config-DY5-_kk_.js +0 -1
  373. package/dist/chunks/config-DmomySWC.js +0 -3
  374. package/dist/chunks/config-WxgxrQoP.js +0 -1
  375. package/dist/chunks/context-Cl6BJ2vm.js +0 -1
  376. package/dist/chunks/context-noninteractive-9hELVC29.js +0 -54
  377. package/dist/chunks/context-noninteractive-Beij5MfU.js +0 -1
  378. package/dist/chunks/conversation-BBB91hEw.js +0 -1
  379. package/dist/chunks/conversation-BWVTM40Y.js +0 -1
  380. package/dist/chunks/createSession-CoQtL5Rj.js +0 -1
  381. package/dist/chunks/createSession-Cvl1Q50F.js +0 -1
  382. package/dist/chunks/cron-3LntnnhJ.js +0 -1
  383. package/dist/chunks/crossProjectResume-BasMLl2n.js +0 -40
  384. package/dist/chunks/cwd--nvsx73T.js +0 -1
  385. package/dist/chunks/cwd-CYmmnQVS.js +0 -1
  386. package/dist/chunks/debugUtils-NO5KtXqi.js +0 -1
  387. package/dist/chunks/desktop-B_L6T6jI.js +0 -1
  388. package/dist/chunks/detectRepository-BTPgN89l.js +0 -1
  389. package/dist/chunks/directoryCompletion-CW2ckkQg.js +0 -1
  390. package/dist/chunks/doctor-1L0TFuGw.js +0 -1
  391. package/dist/chunks/envLessBridgeConfig-CN0_44-p.js +0 -1
  392. package/dist/chunks/envLessBridgeConfig-Ck2-KMq0.js +0 -1
  393. package/dist/chunks/esm-D5q6s4l8.js +0 -1
  394. package/dist/chunks/exit-Bm1S_f3i.js +0 -1
  395. package/dist/chunks/extra-usage-UHAWtypK.js +0 -1
  396. package/dist/chunks/extra-usage-core-BFOolqoi.js +0 -1
  397. package/dist/chunks/extra-usage-noninteractive-cUGZy0en.js +0 -1
  398. package/dist/chunks/extra-usage-zDHVtWKZ.js +0 -1
  399. package/dist/chunks/extraUsage-Dq66zzqR.js +0 -1
  400. package/dist/chunks/extractMemories-BcaklA33.js +0 -1
  401. package/dist/chunks/fast-DALAHO3d.js +0 -1
  402. package/dist/chunks/fast-MS7WZpD8.js +0 -1
  403. package/dist/chunks/feedback-Fw4m28ZC.js +0 -1
  404. package/dist/chunks/file-DcZWPH2V.js +0 -12
  405. package/dist/chunks/fileStateCache-DDW5toIs.js +0 -1
  406. package/dist/chunks/files-Cz1-PK3r.js +0 -2
  407. package/dist/chunks/firstPartyEventLogger-CS9jVz6D.js +0 -1
  408. package/dist/chunks/firstPartyEventLogger-CoSUd0a1.js +0 -5
  409. package/dist/chunks/flushGate-De-yppeo.js +0 -1
  410. package/dist/chunks/gemini-BPziscyN.js +0 -1
  411. package/dist/chunks/generateSessionName-hDJ6HBJ1.js +0 -1
  412. package/dist/chunks/git-CbcnOf0E.js +0 -1
  413. package/dist/chunks/git-Do0wJvux.js +0 -6
  414. package/dist/chunks/githubRepoPathMapping-qAoiyj6P.js +0 -1
  415. package/dist/chunks/grok-Byblph7F.js +0 -1
  416. package/dist/chunks/grove-CpqjcGCb.js +0 -7
  417. package/dist/chunks/heapdump-C4kPlqGt.js +0 -5
  418. package/dist/chunks/help-B1h-faJ3.js +0 -1
  419. package/dist/chunks/hooks-DPLIIpAD.js +0 -1
  420. package/dist/chunks/hostGuard-BHI6Q8Mt.js +0 -1
  421. package/dist/chunks/inboundAttachments-BekVc0W-.js +0 -1
  422. package/dist/chunks/inboundAttachments-CUJE3KaU.js +0 -1
  423. package/dist/chunks/index.min-D75yiGLN.js +0 -1
  424. package/dist/chunks/initReplBridge-JQ-afRx9.js +0 -1
  425. package/dist/chunks/keybindings-BLw5J-Zj.js +0 -2
  426. package/dist/chunks/language-Cqw5gYJR.js +0 -1
  427. package/dist/chunks/launchAgentsPlatform-jWWf-Lk9.js +0 -1
  428. package/dist/chunks/launchCommand-1qkTCKpf.js +0 -1
  429. package/dist/chunks/launchLocalMemory-kHeD0I0y.js +0 -3
  430. package/dist/chunks/launchLocalVault-DLqkOjmb.js +0 -3
  431. package/dist/chunks/launchMemoryStores-Ct7AVXrO.js +0 -1
  432. package/dist/chunks/launchSchedule-ZyvuvjgU.js +0 -1
  433. package/dist/chunks/launchSkillStore-BejQnLog.js +0 -1
  434. package/dist/chunks/launchTeleport-8CuYUfIR.js +0 -3
  435. package/dist/chunks/launchVault-DIvIOuPh.js +0 -1
  436. package/dist/chunks/loadAgentsDir-TZjwTqdr.js +0 -1
  437. package/dist/chunks/loadPluginHooks-Ddhsyn0_.js +0 -1
  438. package/dist/chunks/localSearch-DrOAL6f4.js +0 -1
  439. package/dist/chunks/log-BMCygSzM.js +0 -1
  440. package/dist/chunks/logoV2Utils-8M56V7oN.js +0 -1
  441. package/dist/chunks/mcp-Bt1ITh-Z.js +0 -1
  442. package/dist/chunks/mcp-CwJ-AIpt.js +0 -6
  443. package/dist/chunks/mcp-W0LFoyFR.js +0 -2
  444. package/dist/chunks/memoize-B0zhbT8Z.js +0 -1
  445. package/dist/chunks/memory-3wV7m7UU.js +0 -1
  446. package/dist/chunks/model-CKkOnnnx.js +0 -1
  447. package/dist/chunks/model-DRXcJyU9.js +0 -1
  448. package/dist/chunks/nativeInstaller-CA5d6_G7.js +0 -1
  449. package/dist/chunks/observationStore-DzCdXq8U.js +0 -4
  450. package/dist/chunks/onChangeAppState-DBmy2Ow_.js +0 -1
  451. package/dist/chunks/openai-Cbomn0Ws.js +0 -10
  452. package/dist/chunks/output-style-BM3qAHLA.js +0 -1
  453. package/dist/chunks/overageCreditGrant-DsUrmeBh.js +0 -1
  454. package/dist/chunks/panel-Be-OxtqL.js +0 -1
  455. package/dist/chunks/parser-Bf6iasPV.js +0 -1
  456. package/dist/chunks/partition-BAakXjvj.js +0 -1
  457. package/dist/chunks/passes-CLRt7Cvm.js +0 -1
  458. package/dist/chunks/permissions-BVSFuwNP.js +0 -3
  459. package/dist/chunks/permissions-CeYKbtSC.js +0 -1
  460. package/dist/chunks/permissions-Cn_6f8CB.js +0 -1
  461. package/dist/chunks/plugin-Bfjzhmrk.js +0 -1
  462. package/dist/chunks/pluginAutoupdate-reO2PgtQ.js +0 -1
  463. package/dist/chunks/pluginCliCommands-lqdxdkQp.js +0 -1
  464. package/dist/chunks/pluginFlagging-D9HKAGBC.js +0 -1
  465. package/dist/chunks/pluginOperations-EN3EKLux.js +0 -2
  466. package/dist/chunks/pluginStartupCheck-BY73BMT2.js +0 -1
  467. package/dist/chunks/pluginStartupCheck-CwWOlveD.js +0 -1
  468. package/dist/chunks/policyLimits-CkTI5KEt.js +0 -1
  469. package/dist/chunks/pollConfig-DH2oCtFS.js +0 -1
  470. package/dist/chunks/poor-j-y-bv8o.js +0 -1
  471. package/dist/chunks/poorMode-V11s-3cf.js +0 -1
  472. package/dist/chunks/print-Db_VXmfO.js +0 -23
  473. package/dist/chunks/privacy-settings-DHMJREbb.js +0 -1
  474. package/dist/chunks/processBashCommand-BcM_fhV9.js +0 -1
  475. package/dist/chunks/processSlashCommand-DEVo3GPX.js +0 -5
  476. package/dist/chunks/prompt-BNHtszmZ.js +0 -139
  477. package/dist/chunks/prompt-CrX31AGm.js +0 -1
  478. package/dist/chunks/prompt-IAvMxKDl.js +0 -1
  479. package/dist/chunks/rate-limit-options-DIudL9fb.js +0 -1
  480. package/dist/chunks/rcDebugLog-CUy1_F23.js +0 -11
  481. package/dist/chunks/reconciler-BXpPyfSY.js +0 -4
  482. package/dist/chunks/referral-CUaIo_vT.js +0 -1
  483. package/dist/chunks/refresh-CuaVBIQ0.js +0 -1
  484. package/dist/chunks/registerProtocol-B7Fzdofu.js +0 -36
  485. package/dist/chunks/release-notes-fbfv2DC0.js +0 -4
  486. package/dist/chunks/releaseNotes-CxAHFLPl.js +0 -2
  487. package/dist/chunks/remote-env-BOklGlll.js +0 -1
  488. package/dist/chunks/remoteBridgeCore-j0bG1zjv.js +0 -1
  489. package/dist/chunks/remoteManagedSettings-Cq994lyc.js +0 -1
  490. package/dist/chunks/rename-Iev7wQsI.js +0 -1
  491. package/dist/chunks/ripgrep-BfIpz5uC.js +0 -1
  492. package/dist/chunks/runtimeObserver-CyzLASla.js +0 -10
  493. package/dist/chunks/sandbox-adapter-Cu1FYrkh.js +0 -1
  494. package/dist/chunks/sandbox-toggle-CWpBO228.js +0 -1
  495. package/dist/chunks/sanitization-DV-94a9Z.js +0 -1
  496. package/dist/chunks/searchExtraTools-BUOUds7p.js +0 -1
  497. package/dist/chunks/semver-BMRJYn3q.js +0 -1
  498. package/dist/chunks/session-DL4cA_8l.js +0 -2
  499. package/dist/chunks/sessionDiscovery-DAfNKqp1.js +0 -1
  500. package/dist/chunks/sessionFileAccessHooks-2cgIIxPk.js +0 -1
  501. package/dist/chunks/sessionMemory-BS8_TbKj.js +0 -1
  502. package/dist/chunks/sessionMemory-D5fSHXvZ.js +0 -1
  503. package/dist/chunks/sessionMemoryUtils-BWUztNh6.js +0 -1
  504. package/dist/chunks/sessionObserver-ChfQtK2m.js +0 -1
  505. package/dist/chunks/sessionObserver-ShbCwJ8x.js +0 -20
  506. package/dist/chunks/sessionStorage-Cf5wmnyB.js +0 -1
  507. package/dist/chunks/sessionTracing-D9rUyiq0.js +0 -11
  508. package/dist/chunks/settings-BovzmwMP.js +0 -19
  509. package/dist/chunks/settingsSync-PqU9XGJq.js +0 -1
  510. package/dist/chunks/setup-B_FOvNpp.js +0 -3
  511. package/dist/chunks/sinks-BpcRrN_T.js +0 -1
  512. package/dist/chunks/skill-learning-B5tmc7EX.js +0 -5
  513. package/dist/chunks/skillChangeDetector-DNqohXxz.js +0 -1
  514. package/dist/chunks/skillGapStore-D-kQKVDZ.js +0 -1
  515. package/dist/chunks/skillGapStore-Df5BWAk5.js +0 -5
  516. package/dist/chunks/skillGenerator-DbcdpAkw.js +0 -8
  517. package/dist/chunks/skillLearning-C5cXZE6_.js +0 -1
  518. package/dist/chunks/skillLearning-ClRiDcJH.js +0 -1
  519. package/dist/chunks/skillPanel-LBd4E-MM.js +0 -28
  520. package/dist/chunks/slashCommandParsing-RQb_7Xzt.js +0 -1
  521. package/dist/chunks/startupProfiler-DIWVcO4e.js +0 -1
  522. package/dist/chunks/startupProfiler-xa3NmN7Z.js +0 -3
  523. package/dist/chunks/state-BOa-3Av3.js +0 -1
  524. package/dist/chunks/statusNoticeHelpers-CzTuGNuC.js +0 -1
  525. package/dist/chunks/stickers-D5teCKMN.js +0 -1
  526. package/dist/chunks/systemPromptSections-CR_AoPIX.js +0 -1
  527. package/dist/chunks/systemPromptSections-DN0HGVye.js +0 -1
  528. package/dist/chunks/tag-B-wVW9Aj.js +0 -11
  529. package/dist/chunks/teleport-dtqQXM4x.js +0 -1
  530. package/dist/chunks/terminalSetup-CuV-qU6v.js +0 -33
  531. package/dist/chunks/thinkback-Catprqs_.js +0 -1
  532. package/dist/chunks/thinkback-DI2NpvG-.js +0 -1
  533. package/dist/chunks/thinkback-play-CqrIRx2o.js +0 -1
  534. package/dist/chunks/toolEventObserver-DlH73w-S.js +0 -1
  535. package/dist/chunks/toolPool-B64V-jmK.js +0 -1
  536. package/dist/chunks/trustedDevice-CiwjT_Y6.js +0 -1
  537. package/dist/chunks/tui-C2yuCuOU.js +0 -6
  538. package/dist/chunks/types-Bh9S_JG5.js +0 -3
  539. package/dist/chunks/types-DHkZVzJe.js +0 -1
  540. package/dist/chunks/ultrareviewCommand-BDFUS3hf.js +0 -3
  541. package/dist/chunks/undercover-XYapZ_SS.js +0 -1
  542. package/dist/chunks/undercover-vuTpCnQJ.js +0 -31
  543. package/dist/chunks/upgrade-D5qwcaWQ.js +0 -1
  544. package/dist/chunks/upgrade-DIg3j929.js +0 -1
  545. package/dist/chunks/upload-B_yADHX9.js +0 -1
  546. package/dist/chunks/usage-C0SnnC-i.js +0 -1
  547. package/dist/chunks/usage-CYJKE8N6.js +0 -1
  548. package/dist/chunks/useExitOnCtrlCDWithKeybindings-DKIqRraH.js +0 -1
  549. package/dist/chunks/useMainLoopModel-XetDUXd-.js +0 -1
  550. package/dist/chunks/useManagePlugins-B2KhKiu5.js +0 -1
  551. package/dist/chunks/useMergedTools-CKvwz_Zt.js +0 -1
  552. package/dist/chunks/useSettingsErrors-B7BXHchG.js +0 -1
  553. package/dist/chunks/validatePlugin-DtiYlXby.js +0 -1
  554. package/dist/chunks/windowsPaths-9pEkw0oV.js +0 -1
  555. package/dist/chunks/workerRegistry-ChqPPIaO.js +0 -1
  556. package/dist/chunks/worktree-DAn8ooa1.js +0 -1
@@ -1 +1 @@
1
- import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{I as n,P as r,fi as i,hn as a,t as o,y as s}from"./src-CDCSSo0U2.js";import{t as c}from"./jsx-runtime-Bb4Xn-E0.js";import{o as l,r as u}from"./break-cache-C_p7Kmx2.js";async function d(e,t){let n=await u(e);n.type===`text`&&t(n.value,{display:`system`})}function f({onDone:e}){let[t,i]=(0,m.useState)(0),o=(0,m.useMemo)(()=>[{label:`Status`,description:`Show pending marker, always mode, and break count`,run:()=>void d(`status`,e)},{label:`Once`,description:`Break prompt cache on the next API call only`,run:()=>void d(`once`,e)},{label:`Always`,description:`Break prompt cache on every API call`,run:()=>void d(`always`,e)},{label:`Off`,description:`Disable always mode and clear pending once marker`,run:()=>void d(`off`,e)},{label:`Clear Once`,description:`Cancel the pending one-time cache break`,run:()=>void d(`--clear`,e)}],[e]),c=()=>{let e=o[t];e&&e.run()};return a((e,t)=>{if(t.upArrow){i(e=>Math.max(0,e-1));return}if(t.downArrow){i(e=>Math.min(o.length-1,e+1));return}t.return&&c()}),(0,h.jsx)(s,{title:`Break Cache`,subtitle:`${o.length} actions`,onCancel:()=>e(`Break-cache panel dismissed`,{display:`system`}),color:`background`,hideInputGuide:!0,children:(0,h.jsxs)(n,{flexDirection:`column`,children:[o.map((e,i)=>(0,h.jsxs)(n,{flexDirection:`row`,children:[(0,h.jsx)(r,{children:`${i===t?`›`:` `} ${e.label}`.padEnd(g)}),(0,h.jsx)(r,{dimColor:!0,children:e.description})]},e.label)),(0,h.jsx)(n,{marginTop:1,children:(0,h.jsx)(r,{dimColor:!0,children:`↑/↓ select · Enter run · Esc close`})})]})})}async function p(e,t,n){let r=n?.trim()??``;return r?(await d(r,e),null):(0,h.jsx)(f,{onDone:e})}var m,h,g;e((()=>{m=t(i(),1),o(),l(),h=c(),g=28}))();export{p as call};
1
+ import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{I as n,P as r,fi as i,hn as a,t as o,y as s}from"./src-CDCSSo0U2.js";import{t as c}from"./jsx-runtime-Bb4Xn-E0.js";import{o as l,r as u}from"./break-cache-BKvoMOZx.js";async function d(e,t){let n=await u(e);n.type===`text`&&t(n.value,{display:`system`})}function f({onDone:e}){let[t,i]=(0,m.useState)(0),o=(0,m.useMemo)(()=>[{label:`Status`,description:`Show pending marker, always mode, and break count`,run:()=>void d(`status`,e)},{label:`Once`,description:`Break prompt cache on the next API call only`,run:()=>void d(`once`,e)},{label:`Always`,description:`Break prompt cache on every API call`,run:()=>void d(`always`,e)},{label:`Off`,description:`Disable always mode and clear pending once marker`,run:()=>void d(`off`,e)},{label:`Clear Once`,description:`Cancel the pending one-time cache break`,run:()=>void d(`--clear`,e)}],[e]),c=()=>{let e=o[t];e&&e.run()};return a((e,t)=>{if(t.upArrow){i(e=>Math.max(0,e-1));return}if(t.downArrow){i(e=>Math.min(o.length-1,e+1));return}t.return&&c()}),(0,h.jsx)(s,{title:`Break Cache`,subtitle:`${o.length} actions`,onCancel:()=>e(`Break-cache panel dismissed`,{display:`system`}),color:`background`,hideInputGuide:!0,children:(0,h.jsxs)(n,{flexDirection:`column`,children:[o.map((e,i)=>(0,h.jsxs)(n,{flexDirection:`row`,children:[(0,h.jsx)(r,{children:`${i===t?`›`:` `} ${e.label}`.padEnd(g)}),(0,h.jsx)(r,{dimColor:!0,children:e.description})]},e.label)),(0,h.jsx)(n,{marginTop:1,children:(0,h.jsx)(r,{dimColor:!0,children:`↑/↓ select · Enter run · Esc close`})})]})})}async function p(e,t,n){let r=n?.trim()??``;return r?(await d(r,e),null):(0,h.jsx)(f,{onDone:e})}var m,h,g;e((()=>{m=t(i(),1),o(),l(),h=c(),g=28}))();export{p as call};
@@ -1 +1 @@
1
- import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{I as n,P as r,fi as i,hn as a,mt as o,t as s,y as c}from"./src-CDCSSo0U2.js";import{t as l}from"./jsx-runtime-Bb4Xn-E0.js";import{$u as u,ed as d}from"./loadAgentsDir-D206qwP3.js";function f(e){return e.status===`running`?{mark:`●`,color:`warning`}:e.resultKind===`dead`?{mark:`✗`,color:`error`}:{mark:`✓`,color:`success`}}function p(e){return e?e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e):`0`}function m(e){let t=[];return e.model&&t.push(e.model),t.push(`${p(e.tokenCount)} tok`),t.push(`${e.toolCount??0} tool`),t.join(` · `)}var h,g,_,v,y,b=e((()=>{h={running:`●`,completed:`✓`,failed:`✗`,killed:`■`},g={running:`warning`,completed:`success`,failed:`error`,killed:`subtle`},_={running:`running`,completed:`done`,failed:`failed`,killed:`killed`},v={running:`●`,done:`✓`,pending:`○`},y={running:`warning`,done:`success`,pending:`subtle`}}));function x(e,t){if(e.length<=t)return e;let n=e.match(/#\d+$/);if(!n)return e.slice(0,t);let r=n[0],i=e.slice(0,e.length-r.length),a=t-r.length-1;return`${i.slice(0,a)}…${r}`}function S({agents:e,selectedIndex:t,focused:i}){let[a,s]=o(T),c=w[Math.floor(s/T)%w.length];return e.length===0?(0,C.jsx)(r,{color:`subtle`,children:`(no agents in this phase)`}):(0,C.jsx)(n,{ref:a,flexDirection:`column`,children:e.map((e,a)=>{let o=f(e),s=a===t&&i,l=e.status===`running`?c:o.mark,u=x(e.label??`agent-${e.id}`,E);return(0,C.jsxs)(n,{backgroundColor:s?`selectionBg`:void 0,justifyContent:`space-between`,children:[(0,C.jsxs)(n,{children:[(0,C.jsx)(r,{color:o.color,children:l}),(0,C.jsxs)(r,{children:[` `,u]})]}),(0,C.jsx)(r,{color:`subtle`,children:m(e)})]},e.id)})})}var C,w,T,E,D=e((()=>{i(),s(),b(),C=l(),w=[`·`,`✢`,`✱`,`✶`,`✻`,`✽`],T=120,E=18}));function O(e,t){return e?.status===`done`?`done`:t.length>0?t.every(e=>e.status===`done`)?`done`:`running`:e?.status===`running`?`running`:`pending`}function k(e){let t=new Map(e.phases.map(e=>[e.title,e])),n=new Set,r=[],i=i=>{if(n.has(i))return;n.add(i);let a=t.get(i),o=e.agents.filter(e=>e.phase===i);r.push({title:i,status:O(a,o),done:o.filter(e=>e.status===`done`).length,total:o.length})};for(let t of e.declaredPhases)i(t);for(let t of e.phases)i(t.title);for(let t of e.agents)t.phase&&i(t.phase);return r}function A(e,t){return t===void 0||t===`All`?e:e.filter(e=>e.phase===t)}function j(e){return e.filter(e=>e.status===`running`)}function M(e,t){let n=Math.max(0,Math.trunc(t)),r=e.slice(0,n);return{runs:r,overflow:Math.max(0,e.length-r.length)}}function N(e,t){return`${e}#${t.slice(-4)}`}function P(e){let t=Math.floor(e/1e3);if(t<60)return`${t}s`;let n=Math.floor(t/60),r=t%60;return n<60?`${n}m${String(r).padStart(2,`0`)}s`:`${Math.floor(n/60)}h${String(n%60).padStart(2,`0`)}m`}var F=e((()=>{}));function I({phases:e,agents:t,selectedIndex:i,focused:a}){let[s,c]=o(z),l=R[Math.floor(c/z)%R.length],u=t.length;return(0,L.jsx)(n,{ref:s,flexDirection:`column`,children:[{title:`All`,done:t.filter(e=>e.status===`done`).length,total:u},...e].map((e,t)=>{let o=t===i,s=o&&a,c=e.status===`running`?l:e.status?v[e.status]:` `,u=e.status?y[e.status]:`subtle`;return(0,L.jsxs)(n,{backgroundColor:s?`selectionBg`:void 0,justifyContent:`space-between`,children:[(0,L.jsxs)(n,{children:[(0,L.jsx)(r,{color:o?`claude`:void 0,children:s?`>`:` `}),(0,L.jsx)(r,{children:` `}),(0,L.jsx)(r,{color:u,children:c}),(0,L.jsxs)(r,{children:[` `,e.title]})]}),(0,L.jsxs)(r,{color:`subtle`,children:[e.done,`/`,e.total]})]},e.title)})})}var L,R,z,B=e((()=>{i(),s(),b(),F(),L=l(),R=[`·`,`✢`,`✱`,`✶`,`✻`,`✽`],z=120}));function V({runs:e,activeRunId:t}){if(e.length===0)return(0,H.jsx)(r,{color:`subtle`,children:`(no runs)`});let{runs:i,overflow:a}=M(e,W);return(0,H.jsxs)(n,{children:[i.map(e=>{let i=e.runId===t,a=x(N(e.workflowName,e.runId),U),o=`═`.repeat(a.length+2);return(0,H.jsxs)(n,{flexDirection:`column`,marginRight:2,children:[(0,H.jsxs)(n,{children:[(0,H.jsx)(r,{color:g[e.status],children:h[e.status]}),(0,H.jsx)(r,{children:` `}),(0,H.jsx)(r,{color:i?`claude`:void 0,bold:i,children:a})]}),(0,H.jsx)(r,{color:i?`claude`:void 0,children:i?o:``})]},e.runId)}),a>0?(0,H.jsxs)(n,{flexDirection:`column`,marginRight:2,children:[(0,H.jsxs)(r,{color:`subtle`,children:[`+`,a]}),(0,H.jsx)(r,{children:` `})]}):null]})}var H,U,W,G=e((()=>{i(),s(),b(),F(),D(),H=l(),U=18,W=6}));function K(e,t,n=`normal`){return n===`confirm`?e===`y`||e===`Y`||t.return?`confirmYes`:e===`n`||e===`N`||t.escape||e===`q`?`confirmNo`:null:t.tab||e===` `?t.shift?`prevTab`:`nextTab`:t.escape||e===`q`?`quit`:e===`K`?`killWorkflow`:e===`x`?`killAgent`:e===`r`?`resume`:e===`n`?`newRun`:t.leftArrow?`focusLeft`:t.rightArrow?`focusRight`:t.upArrow?`moveUp`:t.downArrow?`moveDown`:null}function q(e,t=`normal`){a((n,r)=>{let i=K(n,r,t);if(i!==null)switch(i){case`nextTab`:e.nextTab();break;case`prevTab`:e.prevTab();break;case`focusLeft`:e.focusLeft();break;case`focusRight`:e.focusRight();break;case`moveUp`:e.moveUp();break;case`moveDown`:e.moveDown();break;case`killAgent`:e.killAgent();break;case`killWorkflow`:e.killWorkflow();break;case`resume`:e.resumeFocused();break;case`newRun`:e.newRun();break;case`quit`:e.quit();break;case`confirmYes`:e.confirmYes();break;case`confirmNo`:e.confirmNo();break}})}var J=e((()=>{s()}));function Y(e,t){if(t===0)return 0;let n=Math.trunc(e);return Number.isNaN(n)||n<0?0:Math.min(n,t-1)}function ee(e,t){return!e||!t||e.runId!==t.runId||e.status!==`running`?!1:t.status===`completed`||t.status===`failed`||t.status===`killed`}function te({onDone:e,context:t}){let i=u(),a=(0,X.useSyncExternalStore)(i.subscribe,()=>i.listRuns(),()=>[]),s=j(a),[l,d]=(0,X.useState)(null),[f,p]=(0,X.useState)(`phases`),[m,h]=(0,X.useState)(0),[v,y]=(0,X.useState)(0),[b,x]=(0,X.useState)(null);(0,X.useEffect)(()=>{i.loadPersistedRuns()},[i]),(0,X.useEffect)(()=>{if(s.length===0){l!==null&&d(null);return}s.some(e=>e.runId===l)||d(s[0].runId)},[s,l]);let C=s.find(e=>e.runId===l),w=C?k(C):[],T=w.length+1,E=Y(m,T),D=(0,X.useRef)(null);(0,X.useEffect)(()=>{let t=C?{runId:C.runId,status:C.status}:null,n=D.current;if(D.current=t,!ee(n,t))return;let r=setTimeout(()=>e(),800);return()=>{clearTimeout(r)}},[C?.runId,C?.status,e]);let O=E===0?void 0:w[E-1]?.title,M=C?A(C.agents,O):[],N=Y(v,M.length),F=e=>{d(e),p(`phases`),h(0),y(0)};q({nextTab:()=>{if(s.length===0)return;let e=s.findIndex(e=>e.runId===l),t=s[(e+1)%s.length];F(t.runId)},prevTab:()=>{if(s.length===0)return;let e=s.findIndex(e=>e.runId===l),t=s[(e-1+s.length)%s.length];F(t.runId)},focusLeft:()=>p(`phases`),focusRight:()=>p(`agents`),moveUp:()=>{f===`phases`?h(e=>Y(e-1,T)):y(e=>Y(e-1,M.length))},moveDown:()=>{f===`phases`?h(e=>Y(e+1,T)):y(e=>Y(e+1,M.length))},killAgent:()=>{f!==`agents`||!C||M[N]&&x(`agent`)},killWorkflow:()=>{C&&x(`workflow`)},resumeFocused:()=>{if(!C)return;let n=t.canUseTool;if(!n){e(`resume needs canUseTool context; run /<name> resume from the main session.`);return}i.launch({resumeFromRunId:C.runId,name:C.workflowName},t,n).catch(t=>e(`resume failed: ${t.message}`))},newRun:()=>e(`Tip: start a named workflow with /<name>, or pass name via the Workflow tool.`),quit:()=>{if(b!==null){x(null);return}e()},confirmYes:()=>{if(b===`workflow`&&C){i.kill(C.runId),x(null),e();return}else if(b===`agent`&&C){let e=M[N];e&&i.killAgent(C.runId,e.id)}x(null)},confirmNo:()=>x(null)},b===null?`normal`:`confirm`);let L=a.filter(e=>e.status===`running`).length,R=a.length-L,z=O??`All`,B=C?C.agents.filter(e=>e.status===`done`).length:0,[H]=o(1e3),U=C?Date.now()-C.startedAt:0;return(0,Z.jsxs)(n,{ref:H,flexDirection:`column`,borderStyle:`round`,borderColor:`claude`,paddingX:1,children:[(0,Z.jsxs)(n,{justifyContent:`space-between`,children:[(0,Z.jsx)(r,{bold:!0,children:C?.workflowName??`Workflows`}),C?(0,Z.jsxs)(r,{color:`subtle`,children:[B,`/`,C.agentCount,` agents · `,P(U),` ·`,` `,(0,Z.jsx)(r,{color:g[C.status],children:_[C.status]})]}):(0,Z.jsxs)(r,{color:`subtle`,children:[L,` running · `,R,` done`]})]}),C?.description?(0,Z.jsx)(r,{color:`subtle`,children:C.description}):null,s.length>1?(0,Z.jsx)(n,{marginTop:1,children:(0,Z.jsx)(V,{runs:s,activeRunId:l})}):null,(0,Z.jsxs)(n,{flexDirection:`row`,marginTop:1,children:[(0,Z.jsxs)(n,{width:`25%`,flexDirection:`column`,children:[(0,Z.jsx)(r,{color:f===`phases`?`claude`:`subtle`,bold:!0,children:`Phases`}),(0,Z.jsx)(I,{phases:w,agents:C?.agents??[],selectedIndex:E,focused:f===`phases`})]}),(0,Z.jsx)(r,{color:`subtle`,children:`│`}),(0,Z.jsxs)(n,{flexGrow:1,flexDirection:`column`,children:[(0,Z.jsxs)(r,{color:f===`agents`?`claude`:`subtle`,bold:!0,children:[z,` · `,M.length,` agents`]}),(0,Z.jsx)(S,{agents:M,selectedIndex:N,focused:f===`agents`})]})]}),(0,Z.jsx)(n,{marginTop:1,children:(0,Z.jsx)(r,{color:`subtle`,children:b===null?`Tab switch run · ←/→ focus · ↑/↓ move · x kill agent · K kill workflow · r resume · q quit`:`Confirm: y kill · n/Esc cancel`})}),b===null?null:(0,Z.jsx)(c,{title:b===`workflow`?`Kill workflow "${C?.workflowName??``}"?`:`Kill agent "${M[N]?.label??``}"?`,subtitle:b===`workflow`?`All in-flight agents will be aborted. Resume will replay from journal.`:`Only this agent aborts; other agents in the workflow keep running.`,onCancel:()=>x(null),color:`warning`,children:(0,Z.jsx)(r,{color:`subtle`,children:`Press y to confirm, or n/Esc to cancel.`})})]})}var X,Z,ne=e((()=>{X=t(i(),1),s(),d(),D(),B(),G(),b(),J(),F(),Z=l()})),Q,$;e((()=>{ne(),Q=l(),$=async(e,t,n)=>(0,Q.jsx)(te,{onDone:e,context:t})}))();export{$ as call};
1
+ import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{I as n,P as r,fi as i,hn as a,mt as o,t as s,y as c}from"./src-CDCSSo0U2.js";import{t as l}from"./jsx-runtime-Bb4Xn-E0.js";import{vl as u,yl as d}from"./loadAgentsDir-ByO8eJqU.js";function f(e){return e.status===`running`?{mark:`●`,color:`warning`}:e.resultKind===`dead`?{mark:`✗`,color:`error`}:{mark:`✓`,color:`success`}}function p(e){return e?e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e):`0`}function m(e){let t=[];return e.model&&t.push(e.model),t.push(`${p(e.tokenCount)} tok`),t.push(`${e.toolCount??0} tool`),t.join(` · `)}var h,g,_,v,y,b=e((()=>{h={running:`●`,completed:`✓`,failed:`✗`,killed:`■`},g={running:`warning`,completed:`success`,failed:`error`,killed:`subtle`},_={running:`running`,completed:`done`,failed:`failed`,killed:`killed`},v={running:`●`,done:`✓`,pending:`○`},y={running:`warning`,done:`success`,pending:`subtle`}}));function x(e,t){if(e.length<=t)return e;let n=e.match(/#\d+$/);if(!n)return e.slice(0,t);let r=n[0],i=e.slice(0,e.length-r.length),a=t-r.length-1;return`${i.slice(0,a)}…${r}`}function S({agents:e,selectedIndex:t,focused:i}){let[a,s]=o(T),c=w[Math.floor(s/T)%w.length];return e.length===0?(0,C.jsx)(r,{color:`subtle`,children:`(no agents in this phase)`}):(0,C.jsx)(n,{ref:a,flexDirection:`column`,children:e.map((e,a)=>{let o=f(e),s=a===t&&i,l=e.status===`running`?c:o.mark,u=x(e.label??`agent-${e.id}`,E);return(0,C.jsxs)(n,{backgroundColor:s?`selectionBg`:void 0,justifyContent:`space-between`,children:[(0,C.jsxs)(n,{children:[(0,C.jsx)(r,{color:o.color,children:l}),(0,C.jsxs)(r,{children:[` `,u]})]}),(0,C.jsx)(r,{color:`subtle`,children:m(e)})]},e.id)})})}var C,w,T,E,D=e((()=>{i(),s(),b(),C=l(),w=[`·`,`✢`,`✱`,`✶`,`✻`,`✽`],T=120,E=18}));function O(e,t){return e?.status===`done`?`done`:t.length>0?t.every(e=>e.status===`done`)?`done`:`running`:e?.status===`running`?`running`:`pending`}function k(e){let t=new Map(e.phases.map(e=>[e.title,e])),n=new Set,r=[],i=i=>{if(n.has(i))return;n.add(i);let a=t.get(i),o=e.agents.filter(e=>e.phase===i);r.push({title:i,status:O(a,o),done:o.filter(e=>e.status===`done`).length,total:o.length})};for(let t of e.declaredPhases)i(t);for(let t of e.phases)i(t.title);for(let t of e.agents)t.phase&&i(t.phase);return r}function A(e,t){return t===void 0||t===`All`?e:e.filter(e=>e.phase===t)}function j(e){return e.filter(e=>e.status===`running`)}function M(e,t){let n=Math.max(0,Math.trunc(t)),r=e.slice(0,n);return{runs:r,overflow:Math.max(0,e.length-r.length)}}function N(e,t){return`${e}#${t.slice(-4)}`}function P(e){let t=Math.floor(e/1e3);if(t<60)return`${t}s`;let n=Math.floor(t/60),r=t%60;return n<60?`${n}m${String(r).padStart(2,`0`)}s`:`${Math.floor(n/60)}h${String(n%60).padStart(2,`0`)}m`}var F=e((()=>{}));function I({phases:e,agents:t,selectedIndex:i,focused:a}){let[s,c]=o(z),l=R[Math.floor(c/z)%R.length],u=t.length;return(0,L.jsx)(n,{ref:s,flexDirection:`column`,children:[{title:`All`,done:t.filter(e=>e.status===`done`).length,total:u},...e].map((e,t)=>{let o=t===i,s=o&&a,c=e.status===`running`?l:e.status?v[e.status]:` `,u=e.status?y[e.status]:`subtle`;return(0,L.jsxs)(n,{backgroundColor:s?`selectionBg`:void 0,justifyContent:`space-between`,children:[(0,L.jsxs)(n,{children:[(0,L.jsx)(r,{color:o?`claude`:void 0,children:s?`>`:` `}),(0,L.jsx)(r,{children:` `}),(0,L.jsx)(r,{color:u,children:c}),(0,L.jsxs)(r,{children:[` `,e.title]})]}),(0,L.jsxs)(r,{color:`subtle`,children:[e.done,`/`,e.total]})]},e.title)})})}var L,R,z,B=e((()=>{i(),s(),b(),F(),L=l(),R=[`·`,`✢`,`✱`,`✶`,`✻`,`✽`],z=120}));function V({runs:e,activeRunId:t}){if(e.length===0)return(0,H.jsx)(r,{color:`subtle`,children:`(no runs)`});let{runs:i,overflow:a}=M(e,W);return(0,H.jsxs)(n,{children:[i.map(e=>{let i=e.runId===t,a=x(N(e.workflowName,e.runId),U),o=`═`.repeat(a.length+2);return(0,H.jsxs)(n,{flexDirection:`column`,marginRight:2,children:[(0,H.jsxs)(n,{children:[(0,H.jsx)(r,{color:g[e.status],children:h[e.status]}),(0,H.jsx)(r,{children:` `}),(0,H.jsx)(r,{color:i?`claude`:void 0,bold:i,children:a})]}),(0,H.jsx)(r,{color:i?`claude`:void 0,children:i?o:``})]},e.runId)}),a>0?(0,H.jsxs)(n,{flexDirection:`column`,marginRight:2,children:[(0,H.jsxs)(r,{color:`subtle`,children:[`+`,a]}),(0,H.jsx)(r,{children:` `})]}):null]})}var H,U,W,G=e((()=>{i(),s(),b(),F(),D(),H=l(),U=18,W=6}));function K(e,t,n=`normal`){return n===`confirm`?e===`y`||e===`Y`||t.return?`confirmYes`:e===`n`||e===`N`||t.escape||e===`q`?`confirmNo`:null:t.tab||e===` `?t.shift?`prevTab`:`nextTab`:t.escape||e===`q`?`quit`:e===`K`?`killWorkflow`:e===`x`?`killAgent`:e===`r`?`resume`:e===`n`?`newRun`:t.leftArrow?`focusLeft`:t.rightArrow?`focusRight`:t.upArrow?`moveUp`:t.downArrow?`moveDown`:null}function q(e,t=`normal`){a((n,r)=>{let i=K(n,r,t);if(i!==null)switch(i){case`nextTab`:e.nextTab();break;case`prevTab`:e.prevTab();break;case`focusLeft`:e.focusLeft();break;case`focusRight`:e.focusRight();break;case`moveUp`:e.moveUp();break;case`moveDown`:e.moveDown();break;case`killAgent`:e.killAgent();break;case`killWorkflow`:e.killWorkflow();break;case`resume`:e.resumeFocused();break;case`newRun`:e.newRun();break;case`quit`:e.quit();break;case`confirmYes`:e.confirmYes();break;case`confirmNo`:e.confirmNo();break}})}var J=e((()=>{s()}));function Y(e,t){if(t===0)return 0;let n=Math.trunc(e);return Number.isNaN(n)||n<0?0:Math.min(n,t-1)}function ee(e,t){return!e||!t||e.runId!==t.runId||e.status!==`running`?!1:t.status===`completed`||t.status===`failed`||t.status===`killed`}function te({onDone:e,context:t}){let i=u(),a=(0,X.useSyncExternalStore)(i.subscribe,()=>i.listRuns(),()=>[]),s=j(a),[l,d]=(0,X.useState)(null),[f,p]=(0,X.useState)(`phases`),[m,h]=(0,X.useState)(0),[v,y]=(0,X.useState)(0),[b,x]=(0,X.useState)(null);(0,X.useEffect)(()=>{i.loadPersistedRuns()},[i]),(0,X.useEffect)(()=>{if(s.length===0){l!==null&&d(null);return}s.some(e=>e.runId===l)||d(s[0].runId)},[s,l]);let C=s.find(e=>e.runId===l),w=C?k(C):[],T=w.length+1,E=Y(m,T),D=(0,X.useRef)(null);(0,X.useEffect)(()=>{let t=C?{runId:C.runId,status:C.status}:null,n=D.current;if(D.current=t,!ee(n,t))return;let r=setTimeout(()=>e(),800);return()=>{clearTimeout(r)}},[C?.runId,C?.status,e]);let O=E===0?void 0:w[E-1]?.title,M=C?A(C.agents,O):[],N=Y(v,M.length),F=e=>{d(e),p(`phases`),h(0),y(0)};q({nextTab:()=>{if(s.length===0)return;let e=s.findIndex(e=>e.runId===l),t=s[(e+1)%s.length];F(t.runId)},prevTab:()=>{if(s.length===0)return;let e=s.findIndex(e=>e.runId===l),t=s[(e-1+s.length)%s.length];F(t.runId)},focusLeft:()=>p(`phases`),focusRight:()=>p(`agents`),moveUp:()=>{f===`phases`?h(e=>Y(e-1,T)):y(e=>Y(e-1,M.length))},moveDown:()=>{f===`phases`?h(e=>Y(e+1,T)):y(e=>Y(e+1,M.length))},killAgent:()=>{f!==`agents`||!C||M[N]&&x(`agent`)},killWorkflow:()=>{C&&x(`workflow`)},resumeFocused:()=>{if(!C)return;let n=t.canUseTool;if(!n){e(`resume needs canUseTool context; run /<name> resume from the main session.`);return}i.launch({resumeFromRunId:C.runId,name:C.workflowName},t,n).catch(t=>e(`resume failed: ${t.message}`))},newRun:()=>e(`Tip: start a named workflow with /<name>, or pass name via the Workflow tool.`),quit:()=>{if(b!==null){x(null);return}e()},confirmYes:()=>{if(b===`workflow`&&C){i.kill(C.runId),x(null),e();return}else if(b===`agent`&&C){let e=M[N];e&&i.killAgent(C.runId,e.id)}x(null)},confirmNo:()=>x(null)},b===null?`normal`:`confirm`);let L=a.filter(e=>e.status===`running`).length,R=a.length-L,z=O??`All`,B=C?C.agents.filter(e=>e.status===`done`).length:0,[H]=o(1e3),U=C?Date.now()-C.startedAt:0;return(0,Z.jsxs)(n,{ref:H,flexDirection:`column`,borderStyle:`round`,borderColor:`claude`,paddingX:1,children:[(0,Z.jsxs)(n,{justifyContent:`space-between`,children:[(0,Z.jsx)(r,{bold:!0,children:C?.workflowName??`Workflows`}),C?(0,Z.jsxs)(r,{color:`subtle`,children:[B,`/`,C.agentCount,` agents · `,P(U),` ·`,` `,(0,Z.jsx)(r,{color:g[C.status],children:_[C.status]})]}):(0,Z.jsxs)(r,{color:`subtle`,children:[L,` running · `,R,` done`]})]}),C?.description?(0,Z.jsx)(r,{color:`subtle`,children:C.description}):null,s.length>1?(0,Z.jsx)(n,{marginTop:1,children:(0,Z.jsx)(V,{runs:s,activeRunId:l})}):null,(0,Z.jsxs)(n,{flexDirection:`row`,marginTop:1,children:[(0,Z.jsxs)(n,{width:`25%`,flexDirection:`column`,children:[(0,Z.jsx)(r,{color:f===`phases`?`claude`:`subtle`,bold:!0,children:`Phases`}),(0,Z.jsx)(I,{phases:w,agents:C?.agents??[],selectedIndex:E,focused:f===`phases`})]}),(0,Z.jsx)(r,{color:`subtle`,children:`│`}),(0,Z.jsxs)(n,{flexGrow:1,flexDirection:`column`,children:[(0,Z.jsxs)(r,{color:f===`agents`?`claude`:`subtle`,bold:!0,children:[z,` · `,M.length,` agents`]}),(0,Z.jsx)(S,{agents:M,selectedIndex:N,focused:f===`agents`})]})]}),(0,Z.jsx)(n,{marginTop:1,children:(0,Z.jsx)(r,{color:`subtle`,children:b===null?`Tab switch run · ←/→ focus · ↑/↓ move · x kill agent · K kill workflow · r resume · q quit`:`Confirm: y kill · n/Esc cancel`})}),b===null?null:(0,Z.jsx)(c,{title:b===`workflow`?`Kill workflow "${C?.workflowName??``}"?`:`Kill agent "${M[N]?.label??``}"?`,subtitle:b===`workflow`?`All in-flight agents will be aborted. Resume will replay from journal.`:`Only this agent aborts; other agents in the workflow keep running.`,onCancel:()=>x(null),color:`warning`,children:(0,Z.jsx)(r,{color:`subtle`,children:`Press y to confirm, or n/Esc to cancel.`})})]})}var X,Z,ne=e((()=>{X=t(i(),1),s(),d(),D(),B(),G(),b(),J(),F(),Z=l()})),Q,$;e((()=>{ne(),Q=l(),$=async(e,t,n)=>(0,Q.jsx)(te,{onDone:e,context:t})}))();export{$ as call};
@@ -0,0 +1 @@
1
+ import{i as e,r as t}from"./parser-dbHRgXb8.js";t();export{e as parseCommand};
@@ -1 +1 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{a as t}from"./debug-BrXObCdR.js";var n,r=e((()=>{Promise.resolve(),n=new Set([`if`,`then`,`elif`,`else`,`fi`,`while`,`until`,`for`,`in`,`do`,`done`,`case`,`esac`,`function`,`select`])}));async function i(e){return!e||e.length,null}async function a(e){return!e||e.length,null}function o(e){if(e.type===`declaration_command`){let t=e.children[0];return t&&c.has(t.text)?[t.text]:[]}let t=[],n=!1;for(let r of e.children)if(r.type!==`variable_assignment`){if(r.type===`command_name`||!n&&r.type===`word`){n=!0,t.push(r.text);continue}if(l.has(r.type))t.push(s(r.text));else if(u.has(r.type))break}return t}function s(e){return e.length>=2&&(e[0]===`"`&&e.at(-1)===`"`||e[0]===`'`&&e.at(-1)===`'`)?e.slice(1,-1):e}var c,l,u,d,f=e((()=>{t(),r(),c=new Set([`export`,`declare`,`typeset`,`readonly`,`local`,`unset`,`unsetenv`]),l=new Set([`word`,`string`,`raw_string`,`number`]),u=new Set([`command_substitution`,`process_substitution`]),d=Symbol(`parse-aborted`)}));export{a,i,o as n,n as o,f as r,r as s,d as t};
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{a as t}from"./debug-RZ4NuXyS.js";var n,r=e((()=>{Promise.resolve(),n=new Set([`if`,`then`,`elif`,`else`,`fi`,`while`,`until`,`for`,`in`,`do`,`done`,`case`,`esac`,`function`,`select`])}));async function i(e){return!e||e.length,null}async function a(e){return!e||e.length,null}function o(e){if(e.type===`declaration_command`){let t=e.children[0];return t&&c.has(t.text)?[t.text]:[]}let t=[],n=!1;for(let r of e.children)if(r.type!==`variable_assignment`){if(r.type===`command_name`||!n&&r.type===`word`){n=!0,t.push(r.text);continue}if(l.has(r.type))t.push(s(r.text));else if(u.has(r.type))break}return t}function s(e){return e.length>=2&&(e[0]===`"`&&e.at(-1)===`"`||e[0]===`'`&&e.at(-1)===`'`)?e.slice(1,-1):e}var c,l,u,d,f=e((()=>{t(),r(),c=new Set([`export`,`declare`,`typeset`,`readonly`,`local`,`unset`,`unsetenv`]),l=new Set([`word`,`string`,`raw_string`,`number`]),u=new Set([`command_substitution`,`process_substitution`]),d=Symbol(`parse-aborted`)}));export{a,i,o as n,n as o,f as r,r as s,d as t};
@@ -0,0 +1 @@
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{Ai as t,Mr as n,Nr as r,ji as i}from"./state-C2OSZkV1.js";import{GE as a,WE as o}from"./loadAgentsDir-ByO8eJqU.js";function s(e,t,n,r){for(var i=-1,a=e==null?0:e.length;++i<a;){var o=e[i];t(r,o,n(o),e)}return r}var c=e((()=>{}));function l(e,t,n,r){return o(e,function(e,i,a){t(r,e,n(e),a)}),r}var u=e((()=>{a()}));function d(e,t){return function(r,a){var o=i(r)?s:l,c=t?t():{};return o(r,e,n(a,2),c)}}var f=e((()=>{c(),u(),r(),t()})),p,m=e((()=>{f(),p=d(function(e,t,n){e[+!n].push(t)},function(){return[[],[]]})}));export{p as n,m as t};
@@ -1 +1 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{n as t,t as n}from"./cwd-CYmmnQVS.js";import{d as r,p as i}from"./debug-BrXObCdR.js";import{i as a,o}from"./platform-BrYefG_2.js";import{a as s,i as c}from"./windowsPaths-DtapVxOo.js";import{l}from"./sessionStoragePortable-Cx6JQ5Ye.js";import{homedir as u}from"os";import{dirname as d,isAbsolute as f,join as p,normalize as m,posix as h,relative as g,resolve as _}from"path";function v(e,t){let i=t??n()??r().cwd();if(typeof e!=`string`)throw TypeError(`Path must be a string, received ${typeof e}`);if(typeof i!=`string`)throw TypeError(`Base directory must be a string, received ${typeof i}`);if(e.includes(`\0`)||i.includes(`\0`))throw Error(`Path contains null bytes`);let o=e=>e.includes(`/`)&&!e.includes(`\\`)&&!/^[A-Za-z]:/.test(e),c=e.trim();if(!c)return a()===`windows`&&o(i)?h.normalize(i).normalize(`NFC`):m(i).normalize(`NFC`);if(c===`~`)return u().normalize(`NFC`);if(c.startsWith(`~/`))return p(u(),c.slice(2)).normalize(`NFC`);let l=c;if(a()===`windows`&&c.match(/^\/[a-z]\//i))try{l=s(c)}catch{l=c}return f(l)?a()===`windows`&&o(l)?h.normalize(l).normalize(`NFC`):m(l).normalize(`NFC`):a()===`windows`&&o(i)&&!/^[A-Za-z]:/.test(l)&&!l.startsWith(`\\\\`)?h.resolve(i,l).normalize(`NFC`):_(i,l).normalize(`NFC`)}function y(e){let t=g(n(),e);return t.startsWith(`..`)?e:t}function b(e){let t=v(e);if(t.startsWith(`\\\\`)||t.startsWith(`//`))return d(t);try{if(r().statSync(t).isDirectory())return t}catch{}return d(t)}function x(e){return/(?:^|[\\/])\.\.(?:[\\/]|$)/.test(e)}function S(e){return m(e).replace(/\\/g,`/`)}var C=e((()=>{t(),i(),o(),c(),l()}));export{S as a,C as i,v as n,y as o,b as r,x as t};
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{n as t,t as n}from"./cwd-C5ce-7WB.js";import{d as r,p as i}from"./debug-RZ4NuXyS.js";import{i as a,o}from"./platform-DCXXznJg.js";import{a as s,i as c}from"./windowsPaths-o62uq6LF.js";import{l}from"./sessionStoragePortable-Cx6JQ5Ye.js";import{homedir as u}from"os";import{dirname as d,isAbsolute as f,join as p,normalize as m,posix as h,relative as g,resolve as _}from"path";function v(e,t){let i=t??n()??r().cwd();if(typeof e!=`string`)throw TypeError(`Path must be a string, received ${typeof e}`);if(typeof i!=`string`)throw TypeError(`Base directory must be a string, received ${typeof i}`);if(e.includes(`\0`)||i.includes(`\0`))throw Error(`Path contains null bytes`);let o=e=>e.includes(`/`)&&!e.includes(`\\`)&&!/^[A-Za-z]:/.test(e),c=e.trim();if(!c)return a()===`windows`&&o(i)?h.normalize(i).normalize(`NFC`):m(i).normalize(`NFC`);if(c===`~`)return u().normalize(`NFC`);if(c.startsWith(`~/`))return p(u(),c.slice(2)).normalize(`NFC`);let l=c;if(a()===`windows`&&c.match(/^\/[a-z]\//i))try{l=s(c)}catch{l=c}return f(l)?a()===`windows`&&o(l)?h.normalize(l).normalize(`NFC`):m(l).normalize(`NFC`):a()===`windows`&&o(i)&&!/^[A-Za-z]:/.test(l)&&!l.startsWith(`\\\\`)?h.resolve(i,l).normalize(`NFC`):_(i,l).normalize(`NFC`)}function y(e){let t=g(n(),e);return t.startsWith(`..`)?e:t}function b(e){let t=v(e);if(t.startsWith(`\\\\`)||t.startsWith(`//`))return d(t);try{if(r().statSync(t).isDirectory())return t}catch{}return d(t)}function x(e){return/(?:^|[\\/])\.\.(?:[\\/]|$)/.test(e)}function S(e){return m(e).replace(/\\/g,`/`)}var C=e((()=>{t(),i(),o(),c(),l()}));export{S as a,C as i,v as n,y as o,b as r,x as t};
@@ -0,0 +1,3 @@
1
+ import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{n,t as r}from"./figures-5ThXQEtq.js";import{I as i,P as a,Wt as o,Xn as s,a as c,di as l,fi as u,hn as d,k as f,kt as p,n as m,o as ee,ot as h,r as g,s as te,t as _,ui as v,x as ne,y}from"./src-CDCSSo0U2.js";import{t as b}from"./jsx-runtime-Bb4Xn-E0.js";import{$t as re,tt as x}from"./state-C2OSZkV1.js";import{B as ie,Bp as S,F_ as C,G as w,H as ae,I_ as oe,K as T,Ma as E,Pw as D,SE as O,TE as k,U as se,V as ce,_v as A,bv as le,eo as ue,f_ as j,im as M,j_ as de,p_ as N,rm as fe,vv as pe,xw as me,zp as P}from"./loadAgentsDir-ByO8eJqU.js";import{S as F,w as I}from"./debug-RZ4NuXyS.js";import{H as L,V as R,cn as he,g as z,nn as B,o as V,z as H}from"./settings-hQDLwPVj.js";import{l as ge,o as _e}from"./stringUtils-B6FudhoZ.js";import{n as ve,t as ye}from"./useExitOnCtrlCDWithKeybindings-Cce612uS.js";import{n as be,t as xe}from"./AddWorkspaceDirectory-CwLtQld4.js";import{t as Se}from"./SearchBox-vfLXEPed.js";import{n as Ce,t as we}from"./useSearchInput-BAgljZUl.js";import{n as Te,t as Ee}from"./shadowedRuleDetection-C86PTj1m.js";import{n as U,t as De}from"./autoModeDenials-BxNzGJdR.js";function Oe({ruleValue:e}){switch(e.toolName){case j.name:return e.ruleContent?e.ruleContent.endsWith(`:*`)?(0,W.jsxs)(a,{dimColor:!0,children:[`Any Bash command starting with `,(0,W.jsx)(a,{bold:!0,children:e.ruleContent.slice(0,-2)})]}):(0,W.jsxs)(a,{dimColor:!0,children:[`The Bash command `,(0,W.jsx)(a,{bold:!0,children:e.ruleContent})]}):(0,W.jsx)(a,{dimColor:!0,children:`Any Bash command`});default:return e.ruleContent?null:(0,W.jsxs)(a,{dimColor:!0,children:[`Any use of the `,(0,W.jsx)(a,{bold:!0,children:e.toolName}),` tool`]})}}var W,ke=e((()=>{u(),_(),N(),W=b()}));function Ae(e){switch(e){case`localSettings`:return{label:`Project settings (local)`,description:`Saved in ${V(`localSettings`)}`,value:e};case`projectSettings`:return{label:`Project settings`,description:`Checked in at ${V(`projectSettings`)}`,value:e};case`userSettings`:return{label:`User settings`,description:`Saved in at ~/.claude/settings.json`,value:e}}}function je({onAddRules:e,onCancel:t,ruleValues:n,ruleBehavior:r,initialContext:o,setToolPermissionContext:s}){let c=B.map(Ae),l=(0,Me.useCallback)(i=>{if(i===`cancel`){t();return}else if(B.includes(i)){let t=i,a=de(o,{type:`addRules`,rules:n,behavior:r,destination:t});oe({type:`addRules`,rules:n,behavior:r,destination:t}),s(a);let c=n.map(e=>({ruleValue:e,ruleBehavior:r,source:t})),l=Ee(a,{sandboxAutoAllowEnabled:O.isSandboxingEnabled()&&O.isAutoAllowBashIfSandboxedEnabled()}).filter(e=>n.some(t=>t.toolName===e.rule.ruleValue.toolName&&t.ruleContent===e.rule.ruleValue.ruleContent));e(c,l.length>0?l:void 0)}},[e,t,n,r,o,s]);return(0,G.jsxs)(y,{title:`Add ${r} permission ${ge(n.length,`rule`)}`,onCancel:t,color:`permission`,children:[(0,G.jsx)(i,{flexDirection:`column`,paddingX:2,children:n.map(e=>(0,G.jsxs)(i,{flexDirection:`column`,children:[(0,G.jsx)(a,{bold:!0,children:L(e)}),(0,G.jsx)(Oe,{ruleValue:e})]},L(e)))}),(0,G.jsxs)(i,{flexDirection:`column`,marginY:1,children:[(0,G.jsx)(a,{children:n.length===1?`Where should this rule be saved?`:`Where should these rules be saved?`}),(0,G.jsx)(P,{options:c,onChange:l})]})]})}var Me,G,Ne=e((()=>{u(),Me=t(u(),1),S(),_(),C(),H(),Te(),k(),he(),z(),_e(),ke(),G=b()}));function Pe({onCancel:e,onSubmit:t,ruleBehavior:n}){let[s,c]=(0,Fe.useState)(``),[l,u]=(0,Fe.useState)(0),d=ve();o(`confirm:no`,e,{context:`Settings`});let{columns:f}=h(),m=f-6;return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(i,{flexDirection:`column`,gap:1,borderStyle:`round`,paddingLeft:1,paddingRight:1,borderColor:`permission`,children:[(0,K.jsxs)(a,{bold:!0,color:`permission`,children:[`Add `,n,` permission rule`]}),(0,K.jsxs)(i,{flexDirection:`column`,children:[(0,K.jsxs)(a,{children:[`Permission rules are a tool name, optionally followed by a specifier in parentheses.`,(0,K.jsx)(p,{}),`e.g., `,(0,K.jsx)(a,{bold:!0,children:L({toolName:j.name})}),(0,K.jsx)(a,{bold:!1,children:` or `}),(0,K.jsx)(a,{bold:!0,children:L({toolName:j.name,ruleContent:`ls:*`})})]}),(0,K.jsx)(i,{borderDimColor:!0,borderStyle:`round`,marginY:1,paddingLeft:1,children:(0,K.jsx)(fe,{showCursor:!0,value:s,onChange:c,onSubmit:e=>{let r=e.trim();r.length!==0&&t(R(r),n)},placeholder:`Enter permission rule${r.ellipsis}`,columns:m,cursorOffset:l,onChangeCursorOffset:u})})]})]}),(0,K.jsx)(i,{marginLeft:3,children:d.pending?(0,K.jsxs)(a,{dimColor:!0,children:[`Press `,d.keyName,` again to exit`]}):(0,K.jsx)(a,{dimColor:!0,children:`Enter to submit · Esc to cancel`})})]})}var Fe,K,Ie=e((()=>{n(),u(),Fe=t(u(),1),M(),ye(),me(),_(),D(),N(),H(),K=b()}));function Le({onHeaderFocusChange:e,onStateChange:t}){let{headerFocused:n,focusHeader:r}=c();(0,q.useEffect)(()=>{e?.(n)},[n,e]);let[o]=(0,q.useState)(()=>De()),[s,l]=(0,q.useState)(()=>new Set),[u,f]=(0,q.useState)(()=>new Set),[p,m]=(0,q.useState)(0);(0,q.useEffect)(()=>{t({approved:s,retry:u,denials:o})},[s,u,o,t]);let ee=(0,q.useCallback)(e=>{let t=Number(e);l(e=>{let n=new Set(e);return n.has(t)?n.delete(t):n.add(t),n})},[]),h=(0,q.useCallback)(e=>{m(Number(e))},[]);if(d((e,t)=>{e===`r`&&(f(e=>{let t=new Set(e);return t.has(p)?t.delete(p):t.add(p),t}),l(e=>{if(e.has(p))return e;let t=new Set(e);return t.add(p),t}))},{isActive:o.length>0}),o.length===0)return(0,J.jsx)(a,{dimColor:!0,children:`No recent denials. Commands denied by the auto mode classifier will appear here.`});let g=o.map((e,t)=>{let n=s.has(t),r=u.has(t)?` (retry)`:``;return{label:(0,J.jsxs)(a,{children:[(0,J.jsx)(te,{status:n?`success`:`error`,withSpace:!0}),e.display,(0,J.jsx)(a,{dimColor:!0,children:r})]}),value:String(t)}});return(0,J.jsxs)(i,{flexDirection:`column`,children:[(0,J.jsx)(a,{children:`Commands recently denied by the auto mode classifier.`}),(0,J.jsx)(i,{marginTop:1,children:(0,J.jsx)(P,{options:g,onChange:ee,onFocus:h,visibleOptionCount:Math.min(10,g.length),isDisabled:n,onUpFromFirstItem:r})})]})}var q,J,Re=e((()=>{u(),q=t(u(),1),_(),U(),S(),J=b()}));function ze({directoryPath:e,onRemove:t,onCancel:n,permissionContext:r,setPermissionContext:o}){let s=(0,Be.useCallback)(()=>{o(de(r,{type:`removeDirectories`,directories:[e],destination:`session`})),t()},[e,r,o,t]),c=(0,Be.useCallback)(e=>{e===`yes`?s():n()},[s,n]);return(0,Y.jsxs)(y,{title:`Remove directory from workspace?`,onCancel:n,color:`error`,children:[(0,Y.jsx)(i,{marginX:2,flexDirection:`column`,children:(0,Y.jsx)(a,{bold:!0,children:e})}),(0,Y.jsx)(a,{children:`Claude Code will no longer have access to files in this directory.`}),(0,Y.jsx)(P,{onChange:c,onCancel:n,options:[{label:`Yes`,value:`yes`},{label:`No`,value:`no`}]})]})}var Be,Y,Ve=e((()=>{u(),Be=t(u(),1),S(),_(),C(),Y=b()}));function He({onExit:e,toolPermissionContext:t,onRequestAddDirectory:n,onRequestRemoveDirectory:o,onHeaderFocusChange:s}){let{headerFocused:l,focusHeader:u}=c();(0,X.useEffect)(()=>{s?.(l)},[l,s]);let d=Ue.useMemo(()=>Array.from(t.additionalWorkingDirectories.keys()).map(e=>({path:e,isCurrent:!1,isDeletable:!0})),[t.additionalWorkingDirectories]),f=(0,X.useCallback)(e=>{if(e===`add-directory`){n();return}let t=d.find(t=>t.path===e);t&&t.isDeletable&&o(t.path)},[d,n,o]),p=(0,X.useCallback)(()=>e(`Workspace dialog dismissed`,{display:`system`}),[e]),m=Ue.useMemo(()=>{let e=d.map(e=>({label:e.path,value:e.path}));return e.push({label:`Add directory${r.ellipsis}`,value:`add-directory`}),e},[d]);return(0,Z.jsxs)(i,{flexDirection:`column`,marginBottom:1,children:[(0,Z.jsxs)(i,{flexDirection:`row`,marginTop:1,marginLeft:2,gap:1,children:[(0,Z.jsx)(a,{children:`- ${x()}`}),(0,Z.jsx)(a,{dimColor:!0,children:`(Original working directory)`})]}),(0,Z.jsx)(P,{options:m,onChange:f,onCancel:p,visibleOptionCount:Math.min(10,m.length),onUpFromFirstItem:u,isDisabled:l})]})}var Ue,X,Z,We=e((()=>{n(),Ue=t(u(),1),X=t(u(),1),re(),S(),_(),Z=b()}));function Ge({rule:e}){return(0,$.jsx)(a,{dimColor:!0,children:`From ${T(e.source)}`})}function Ke(e){switch(e){case`allow`:return`allowed`;case`deny`:return`denied`;case`ask`:return`ask`}}function qe({rule:e,onDelete:t,onCancel:n}){let r=ve();o(`confirm:no`,n,{context:`Confirmation`});let s=(0,$.jsxs)(i,{flexDirection:`column`,marginX:2,children:[(0,$.jsx)(a,{bold:!0,children:L(e.ruleValue)}),(0,$.jsx)(Oe,{ruleValue:e.ruleValue}),(0,$.jsx)(Ge,{rule:e})]}),c=(0,$.jsx)(i,{marginLeft:3,children:r.pending?(0,$.jsxs)(a,{dimColor:!0,children:[`Press `,r.keyName,` again to exit`]}):(0,$.jsx)(a,{dimColor:!0,children:`Esc to cancel`})});return e.source===`policySettings`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(i,{flexDirection:`column`,gap:1,borderStyle:`round`,paddingLeft:1,paddingRight:1,borderColor:`permission`,children:[(0,$.jsx)(a,{bold:!0,color:`permission`,children:`Rule details`}),s,(0,$.jsxs)(a,{italic:!0,children:[`This rule is configured by managed settings and cannot be modified.`,`
2
+ `,`Contact your system administrator for more information.`]})]}),c]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(i,{flexDirection:`column`,gap:1,borderStyle:`round`,paddingLeft:1,paddingRight:1,borderColor:`error`,children:[(0,$.jsxs)(a,{bold:!0,color:`error`,children:[`Delete `,Ke(e.ruleBehavior),` tool?`]}),s,(0,$.jsx)(a,{children:`Are you sure you want to delete this permission rule?`}),(0,$.jsx)(P,{onChange:e=>e===`yes`?t():n(),onCancel:n,options:[{label:`Yes`,value:`yes`},{label:`No`,value:`no`}]})]}),c]})}function Je(e){let{options:t,searchQuery:n,isSearchMode:r,isFocused:a,onSelect:o,onCancel:s,lastFocusedRuleKey:l,cursorOffset:u,onHeaderFocusChange:d}=e,p=ee(),{headerFocused:m,focusHeader:h,blurHeader:g}=c();return(0,Q.useEffect)(()=>{r&&m&&g()},[r,m,g]),(0,Q.useEffect)(()=>{d?.(m)},[m,d]),(0,$.jsxs)(i,{flexDirection:`column`,children:[(0,$.jsx)(i,{marginBottom:1,flexDirection:`column`,children:(0,$.jsx)(f,{query:n,isFocused:r&&!m,isTerminalFocused:a,width:p,cursorOffset:u})}),(0,$.jsx)(P,{options:t,onChange:o,onCancel:s,visibleOptionCount:Math.min(10,t.length),isDisabled:r||m,defaultFocusValue:l,onUpFromFirstItem:h})]})}function Ye({tab:e,getRulesOptions:t,handleToolSelect:n,...r}){return(0,$.jsxs)(i,{flexDirection:`column`,flexShrink:e===`allow`?0:void 0,children:[(0,$.jsx)(a,{children:{allow:`Claude Code won't ask before using allowed tools.`,ask:`Claude Code will always ask for confirmation before using these tools.`,deny:`Claude Code will always reject requests to use denied tools.`}[e]}),(0,$.jsx)(Je,{options:t(e,r.searchQuery).options,onSelect:t=>n(t,e),...r})]})}function Xe({onExit:e,initialTab:t,onRetryDenials:n}){let c=De().length>0,l=t??(c?`recent`:`allow`),[u,d]=(0,Q.useState)([]),f=pe(e=>e.toolPermissionContext),p=le(),ee=s(),h=(0,Q.useRef)({approved:new Set,retry:new Set,denials:[]}),te=(0,Q.useCallback)(e=>{h.current=e},[]),[_,y]=(0,Q.useState)(),[b,re]=(0,Q.useState)(),[x,S]=(0,Q.useState)(null),[C,w]=(0,Q.useState)(null),[T,E]=(0,Q.useState)(!1),[D,O]=(0,Q.useState)(null),[k,A]=(0,Q.useState)(!1),[ue,j]=(0,Q.useState)(!0),M=(0,Q.useCallback)(e=>{j(e)},[]),N=(0,Q.useMemo)(()=>{let e=new Map;return ce(f).forEach(t=>{e.set(I(t),t)}),e},[f]),fe=(0,Q.useMemo)(()=>{let e=new Map;return se(f).forEach(t=>{e.set(I(t),t)}),e},[f]),me=(0,Q.useMemo)(()=>{let e=new Map;return ae(f).forEach(t=>{e.set(I(t),t)}),e},[f]),P=(0,Q.useCallback)((e,t=``)=>{let n=(()=>{switch(e){case`allow`:return N;case`deny`:return fe;case`ask`:return me;case`workspace`:case`recent`:return new Map}})(),i=[];e!==`workspace`&&e!==`recent`&&!t&&i.push({label:`Add a new rule${r.ellipsis}`,value:`add-new-rule`});let a=Array.from(n.keys()).sort((e,t)=>{let r=n.get(e),i=n.get(t);if(r&&i){let e=L(r.ruleValue).toLowerCase(),t=L(i.ruleValue).toLowerCase();return e.localeCompare(t)}return 0}),o=t.toLowerCase();for(let e of a){let r=n.get(e);if(r){let n=L(r.ruleValue);if(t&&!n.toLowerCase().includes(o))continue;i.push({label:n,value:e})}}return{options:i,rulesByKey:n}},[N,fe,me]),F=ve(),R=!_&&!x&&!C&&!T&&!D,{query:he,setQuery:z,cursorOffset:B}=Ce({isActive:R&&k,onExit:()=>{A(!1)}}),V=(0,Q.useCallback)(e=>{R&&(k||e.ctrl||e.meta||(e.key===`/`?(e.preventDefault(),A(!0),z(``)):e.key.length===1&&e.key!==`j`&&e.key!==`k`&&e.key!==`m`&&e.key!==`i`&&e.key!==`r`&&e.key!==` `&&(e.preventDefault(),A(!0),z(e.key))))},[R,k,z]),H=(0,Q.useCallback)((e,t)=>{let{rulesByKey:n}=P(t);if(e===`add-new-rule`){S(t);return}else{y(n.get(e));return}},[P]),ge=(0,Q.useCallback)(()=>{S(null)},[]),_e=(0,Q.useCallback)((e,t)=>{w({ruleValue:e,ruleBehavior:t}),S(null)},[]),ye=(0,Q.useCallback)((e,t)=>{w(null);for(let t of e)d(e=>[...e,`Added ${t.ruleBehavior} rule ${v.bold(L(t.ruleValue))}`]);if(t&&t.length>0)for(let e of t){let t=e.shadowType===`deny`?`blocked`:`shadowed`;d(n=>[...n,v.yellow(`${r.warning} Warning: ${L(e.rule.ruleValue)} is ${t}`),v.dim(` ${e.reason}`),v.dim(` Fix: ${e.fix}`)])}},[]),be=(0,Q.useCallback)(()=>{w(null)},[]),Se=(0,Q.useCallback)(()=>E(!0),[]),we=(0,Q.useCallback)(e=>O(e),[]),Te=(0,Q.useCallback)(()=>{let t=h.current,r=e=>Array.from(e).map(e=>t.denials[e]).filter(e=>e!==void 0),i=r(t.retry);if(i.length>0){let t=i.map(e=>e.display);n?.(t),e(void 0,{shouldQuery:!0,metaMessages:[`Permission granted for: ${t.join(`, `)}. You may now retry ${t.length===1?`this command`:`these commands`} if you would like.`]});return}let a=r(t.approved);a.length>0||u.length>0?e([...a.length>0?[`Approved ${a.map(e=>v.bold(e.display)).join(`, `)}`]:[],...u].join(`
3
+ `)):e(`Permissions dialog dismissed`,{display:`system`})},[u,e,n]);o(`confirm:no`,Te,{context:`Settings`,isActive:R&&!k});let Ee=()=>{if(!_)return;let{options:e}=P(_.ruleBehavior),t=I(_),n=e.filter(e=>e.value!==`add-new-rule`).map(e=>e.value),r=n.indexOf(t),i;r!==-1&&(r<n.length-1?i=n[r+1]:r>0&&(i=n[r-1])),re(i),ie({rule:_,initialContext:f,setToolPermissionContext(e){p(t=>({...t,toolPermissionContext:e}))}}),d(e=>[...e,`Deleted ${_.ruleBehavior} rule ${v.bold(L(_.ruleValue))}`]),y(void 0)};if(_)return(0,$.jsx)(qe,{rule:_,onDelete:Ee,onCancel:()=>y(void 0)});if(x&&x!==`workspace`&&x!==`recent`)return(0,$.jsx)(Pe,{onCancel:ge,onSubmit:_e,ruleBehavior:x});if(C)return(0,$.jsx)(je,{onAddRules:ye,onCancel:be,ruleValues:[C.ruleValue],ruleBehavior:C.ruleBehavior,initialContext:f,setToolPermissionContext:e=>{p(t=>({...t,toolPermissionContext:e}))}});if(T)return(0,$.jsx)(xe,{onAddDirectory:(e,t)=>{let n={type:`addDirectories`,directories:[e],destination:t?`localSettings`:`session`},r=de(f,n);p(e=>({...e,toolPermissionContext:r})),t&&oe(n),d(n=>[...n,`Added directory ${v.bold(e)} to workspace${t?` and saved to local settings`:` for this session`}`]),E(!1)},onCancel:()=>E(!1),permissionContext:f});if(D)return(0,$.jsx)(ze,{directoryPath:D,onRemove:()=>{d(e=>[...e,`Removed directory ${v.bold(D)} from workspace`]),O(null)},onCancel:()=>O(null),permissionContext:f,setPermissionContext:e=>{p(t=>({...t,toolPermissionContext:e}))}});let U={searchQuery:he,isSearchMode:k,isFocused:ee,onCancel:Te,lastFocusedRuleKey:b,cursorOffset:B,getRulesOptions:P,handleToolSelect:H,onHeaderFocusChange:M};return(0,$.jsx)(i,{flexDirection:`column`,onKeyDown:V,children:(0,$.jsxs)(ne,{color:`permission`,children:[(0,$.jsxs)(g,{title:`Permissions:`,color:`permission`,defaultTab:l,hidden:!!_||!!x||!!C||T||!!D,initialHeaderFocused:!c,navFromContent:!k,children:[(0,$.jsx)(m,{id:`recent`,title:`Recently denied`,children:(0,$.jsx)(Le,{onHeaderFocusChange:M,onStateChange:te})}),(0,$.jsx)(m,{id:`allow`,title:`Allow`,children:(0,$.jsx)(Ye,{tab:`allow`,...U})}),(0,$.jsx)(m,{id:`ask`,title:`Ask`,children:(0,$.jsx)(Ye,{tab:`ask`,...U})}),(0,$.jsx)(m,{id:`deny`,title:`Deny`,children:(0,$.jsx)(Ye,{tab:`deny`,...U})}),(0,$.jsx)(m,{id:`workspace`,title:`Workspace`,children:(0,$.jsxs)(i,{flexDirection:`column`,children:[(0,$.jsx)(a,{children:`Work Mate can read files in the workspace, and make edits when auto-accept edits is on.`}),(0,$.jsx)(He,{onExit:e,toolPermissionContext:f,onRequestAddDirectory:Se,onRequestRemoveDirectory:we,onHeaderFocusChange:M})]})})]}),(0,$.jsx)(i,{marginTop:1,paddingLeft:1,children:(0,$.jsx)(a,{dimColor:!0,children:F.pending?(0,$.jsxs)($.Fragment,{children:[`Press `,F.keyName,` again to exit`]}):ue?(0,$.jsx)($.Fragment,{children:`←/→ tab switch · ↓ return · Esc cancel`}):k?(0,$.jsx)($.Fragment,{children:`Type to filter · Enter/↓ select · ↑ tabs · Esc clear`}):c&&l===`recent`?(0,$.jsx)($.Fragment,{children:`Enter approve · r retry · ↑↓ navigate · ←/→ switch · Esc cancel`}):(0,$.jsx)($.Fragment,{children:`↑↓ navigate · Enter select · Type to search · ←/→ switch · Esc cancel`})})})]})})}var Q,$,Ze=e((()=>{l(),n(),u(),Q=t(u(),1),A(),C(),S(),ye(),we(),_(),D(),U(),H(),w(),F(),Se(),Ne(),be(),ke(),Ie(),Re(),Ve(),We(),$=b()})),Qe,$e;e((()=>{Ze(),ue(),Qe=b(),$e=async(e,t)=>(0,Qe.jsx)(Xe,{onExit:e,onRetryDenials:e=>{t.setMessages(t=>[...t,E(e)])}})}))();export{$e as call};
@@ -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,l as i,n as a,o}from"./envUtils-DSxRz_kt.js";import{n as s,t as c}from"./axios-DaWTGg7G.js";import{SD as ee,cC as te,yD as ne}from"./loadAgentsDir-D206qwP3.js";import{n as re}from"./cwd-CYmmnQVS.js";import{C as l,E as ie,H as ae,O as oe,S as u,V as se,W as ce,a as d,d as f,l as p,p as m,w as le,z as h}from"./debug-BrXObCdR.js";import{A as g,Jt as ue,M as de,Qt as fe,Zt as pe,en as me,g as he,n as ge}from"./settings-BovzmwMP.js";import{a as _e,c as _,g as v,i as ve}from"./config-DmomySWC.js";import{c as ye,n as y,o as be,r as b,t as x}from"./execFileNoThrow-D244NytW.js";import{o as S,s as C}from"./log-BMCygSzM.js";import{n as xe,t as Se}from"./which-CKQnSouy.js";import{i as w,o as T}from"./platform-BrYefG_2.js";import{n as E,t as Ce}from"./bundledMode--fG1S62b.js";import{i as we,r as Te}from"./genericProcessUtils-CdQTApYX.js";import{a as Ee,i as De}from"./ripgrep-BXmXjAzA.js";import{n as Oe,r as ke}from"./semver-BMRJYn3q.js";import{homedir as D}from"os";import{basename as Ae,delimiter as je,join as O,posix as k,win32 as A}from"path";import{constants as Me}from"fs";import{access as j,open as Ne,readFile as M,realpath as N,stat as Pe}from"fs/promises";function P(){return O(a(),`local`)}function Fe(){return O(P(),`claude`)}function Ie(){return(process.argv[1]||``).includes(`/.claude/local/node_modules/`)}async function F(){try{return await j(O(P(),`node_modules`,`.bin`,`claude`)),!0}catch{return!1}}function I(){let e=process.env.SHELL||``;return e.includes(`zsh`)?`zsh`:e.includes(`bash`)?`bash`:e.includes(`fish`)?`fish`:`unknown`}var L=e((()=>{v(),o(),h(),b(),m(),S(),u()}));function R(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(V.test(e)){let n=e.match(/alias\s+claude\s*=\s*["']([^"']+)["']/);if(n||(n=e.match(/alias\s+claude\s*=\s*([^#\n]+)/)),n&&n[1]&&n[1].trim()===Fe())return t=!0,!1}return!0}),hadAlias:t}}async function z(e){try{return(await M(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,l as i,n as a,o}from"./envUtils-DSxRz_kt.js";import{n as s,t as c}from"./axios-DaWTGg7G.js";import{Jm as ee,SE as te,TE as ne}from"./loadAgentsDir-ByO8eJqU.js";import{n as re}from"./cwd-C5ce-7WB.js";import{C as l,E as ie,H as ae,O as oe,S as u,V as se,W as ce,a as d,d as f,l as p,p as m,w as le,z as h}from"./debug-RZ4NuXyS.js";import{Gt as ue,Jt as de,M as g,P as fe,Yt as pe,Zt as me,g as he,n as ge}from"./settings-hQDLwPVj.js";import{a as _e,c as _,g as v,i as ve}from"./config-CE058cvr.js";import{c as ye,n as y,o as be,r as b,t as x}from"./execFileNoThrow-CCX-JY8h.js";import{o as S,s as C}from"./log-CZ0zYP_c.js";import{n as xe,t as Se}from"./which-CHLNJmtJ.js";import{i as w,o as T}from"./platform-DCXXznJg.js";import{n as E,t as Ce}from"./bundledMode--fG1S62b.js";import{B as we,z as Te}from"./sessionState-CjNY991n.js";import{i as Ee,r as De}from"./genericProcessUtils-DVfMHhfy.js";import{a as Oe,i as ke}from"./ripgrep-gaT9Njwi.js";import{homedir as D}from"os";import{basename as Ae,delimiter as je,join as O,posix as k,win32 as A}from"path";import{constants as Me}from"fs";import{access as j,open as Ne,readFile as M,realpath as N,stat as Pe}from"fs/promises";function P(){return O(a(),`local`)}function Fe(){return O(P(),`claude`)}function Ie(){return(process.argv[1]||``).includes(`/.claude/local/node_modules/`)}async function F(){try{return await j(O(P(),`node_modules`,`.bin`,`claude`)),!0}catch{return!1}}function I(){let e=process.env.SHELL||``;return e.includes(`zsh`)?`zsh`:e.includes(`bash`)?`bash`:e.includes(`fish`)?`fish`:`unknown`}var L=e((()=>{v(),o(),h(),b(),m(),S(),u()}));function R(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(V.test(e)){let n=e.match(/alias\s+claude\s*=\s*["']([^"']+)["']/);if(n||(n=e.match(/alias\s+claude\s*=\s*([^#\n]+)/)),n&&n[1]&&n[1].trim()===Fe())return t=!0,!1}return!0}),hadAlias:t}}async function z(e){try{return(await M(e,{encoding:`utf8`})).split(`
2
2
  `)}catch(e){if(ae(e))return null;throw e}}async function Re(e,t){let n=await Ne(e,`w`);try{await n.writeFile(t.join(`
3
- `),{encoding:`utf8`}),await n.datasync()}finally{await n.close()}}async function B(e){let t=R(e);for(let e of Object.values(t)){let t=await z(e);if(t){for(let e of t)if(V.test(e)){let t=e.match(/alias\s+claude=["']?([^"'\s]+)/);if(t&&t[1])return t[1]}}}return null}async function ze(e){let t=await B(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 V,H=e((()=>{h(),L(),V=/^\s*alias\s+claude\s*=/}));async function Be(){let e=await Ve();return process.env.USER_TYPE===`ant`?e.ant||void 0:e.external||void 0}async function Ve(){try{return{}}catch(e){return C(e),{}}}function He(e){let t=ge()?.minimumVersion;if(!t)return!1;let n=!Oe(e,t);return n&&p(`Skipping update to ${e} - below minimumVersion ${t}`),n}async function Ue(){let e=ue.isRunningWithBun(),t=null;return t=e?await y(`bun`,[`pm`,`bin`,`-g`],{cwd:D()}):await y(`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 We(){try{let e=await Ue();if(!e)return{hasPermissions:!1,npmPrefix:null};try{return await j(e,Me.W_OK),{hasPermissions:!0,npmPrefix:e}}catch{return C(new Ye(`Insufficient permissions for global npm install.`)),{hasPermissions:!1,npmPrefix:e}}}catch(e){return C(e),{hasPermissions:!1,npmPrefix:null}}}async function Ge(){let e=await y(`npm`,[`view`,``,`dist-tags`,`--json`,`--prefer-online`],{abortSignal:AbortSignal.timeout(5e3),cwd:D()});if(e.code!==0)return p(`npm view dist-tags failed with code ${e.code}`),{latest:null,stable:null};try{let t=l(e.stdout.trim());return{latest:typeof t.latest==`string`?t.latest:null,stable:typeof t.stable==`string`?t.stable:null}}catch(e){return p(`Failed to parse dist-tags: ${e}`),{latest:null,stable:null}}}async function Ke(e){try{return(await s.get(`${Je}/${e}`,{timeout:5e3,responseType:`text`})).data.trim()}catch(t){return p(`Failed to fetch ${e} from GCS: ${t}`),null}}async function qe(){let[e,t]=await Promise.all([Ke(`latest`),Ke(`stable`)]);return{latest:e,stable:t}}var Je,Ye,Xe=e((()=>{c(),v(),d(),pe(),o(),h(),b(),m(),te(),S(),ke(),he(),H(),u(),Je=`https://storage.googleapis.com/claude-code-dist-86c565f3-f756-42ad-8dfa-d59b1c096819/claude-code-releases`,Ye=class extends oe{}}));function U(e,t){return t.includes(e.id)||e.idLike.some(e=>t.includes(e))}function Ze(){let e=process.execPath||process.argv[0]||``;return/[/\\]mise[/\\]installs[/\\]/i.test(e)?(p(`Detected mise installation: ${e}`),!0):!1}function Qe(){let e=process.execPath||process.argv[0]||``;return/[/\\]\.?asdf[/\\]installs[/\\]/i.test(e)?(p(`Detected asdf installation: ${e}`),!0):!1}function W(){let e=w();if(e!==`macos`&&e!==`linux`&&e!==`wsl`)return!1;let t=process.execPath||process.argv[0]||``;return t.includes(`/Caskroom/`)?(p(`Detected Homebrew cask installation: ${t}`),!0):!1}function $e(){if(w()!==`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 p(`Detected winget installation: ${e}`),!0;return!1}var G,K,q,J,Y,et,tt=e((()=>{n(),d(),b(),T(),G=t(async()=>{try{let e=await M(`/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}}),K=t(async()=>{if(w()!==`linux`)return!1;let e=await G();if(e&&!U(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?(p(`Detected pacman installation: ${t.stdout.trim()}`),!0):!1}),q=t(async()=>{if(w()!==`linux`)return!1;let e=await G();if(e&&!U(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?(p(`Detected deb installation: ${t.stdout.trim()}`),!0):!1}),J=t(async()=>{if(w()!==`linux`)return!1;let e=await G();if(e&&!U(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?(p(`Detected rpm installation: ${t.stdout.trim()}`),!0):!1}),Y=t(async()=>{if(w()!==`linux`)return!1;let e=await G();if(e&&!U(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?(p(`Detected apk installation: ${t.stdout.trim()}`),!0):!1}),et=t(async()=>W()?`homebrew`:$e()?`winget`:Ze()?`mise`:Qe()?`asdf`:await K()?`pacman`:await Y()?`apk`:await q()?`deb`:await J()?`rpm`:`unknown`)}));function nt(){let e=process.argv[1]||``,t=process.execPath||process.argv[0]||``;return w()===`windows`&&(e=e.split(A.sep).join(k.sep),t=t.split(A.sep).join(k.sep)),[e,t]}async function rt(){let[e]=nt();if(E())return W()||$e()||Ze()||Qe()||await K()||await q()||await J()||await Y()?`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 be(`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 it(){if(E()){try{return await N(process.execPath)}catch{}try{let e=await xe(`claude`);if(e)return e}catch{}try{return await f().stat(O(D(),`.local/bin/claude`)),O(D(),`.local/bin/claude`)}catch{}return`native`}try{return process.argv[0]||`unknown`}catch{return`unknown`}}function at(){try{return E()?process.execPath||`unknown`:process.argv[1]||`unknown`}catch{return`unknown`}}async function ot(){let e=f(),t=[],n=O(D(),`.claude`,`local`);await F()&&t.push({type:`npm-local`,path:n});let r=[`@anthropic-ai/claude-code`],i=await x(`npm`,[`-g`,`config`,`get`,`prefix`]);if(i.code===0&&i.stdout){let n=i.stdout.trim(),a=w()===`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 N(o)).includes(`/Caskroom/`)&&(e=W())}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(_().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 st(e){let t=[];try{let e=l(await M(O(fe(),`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=_();if(e===`development`)return t;if(e===`native`){let e=(process.env.PATH||``).split(je),n=O(D(),`.local`,`bin`),r=n;if(w()===`windows`&&(r=n.split(A.sep).join(k.sep)),!e.some(e=>{let t=e;w()===`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(w()===`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=I(),n=R()[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}`})}}i(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 F()&&t.push({issue:`Local installation exists but not being used`,fix:`Consider using native installation: claude install`});let r=await B(),a=await ze();return e===`npm-local`&&!await xe(`claude`)&&!a&&(r?t.push({issue:`Local installation not accessible`,fix:`Alias exists but points to invalid target: ${r}. Update alias: alias claude="~/.claude/local/claude"`}):t.push({issue:`Local installation not accessible`,fix:`Create alias: alias claude="~/.claude/local/claude"`})),t}function ct(){if(w()!==`linux`)return[];let e=[],t=ne.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 lt(){let e=await rt(),t=typeof MACRO<`u`?`0.0.6`:`unknown`,n=await it(),r=at(),i=await ot(),a=await st(e);if(a.push(...ct()),e===`native`){let e=i.filter(e=>e.type===`npm-global`||e.type===`npm-global-orphan`||e.type===`npm-local`),t=w()===`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/claude-code`}):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=_().installMethod||`not set`,s=null;e===`npm-global`&&(s=(await We()).hasPermissions,!s&&!_e()&&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=De(),ee={working:c.working??!0,mode:c.mode,systemPath:c.mode===`system`?c.path:null,note:c.note??null},te=e===`package-manager`?await et():void 0;return{installationType:e,version:t,installationPath:n,invokedBinary:r,configInstallMethod:o,autoUpdates:(()=>{let e=_e();return e?`disabled (${ve(e)})`:`enabled`})(),hasUpdatePermissions:s,multipleInstallations:i,warnings:a,packageManager:te,ripgrepStatus:ee}}var ut=e((()=>{ye(),Xe(),Ce(),v(),re(),o(),b(),m(),L(),tt(),T(),Ee(),ee(),me(),de(),H(),u(),Se()}));function dt(){let e=process.env.ENABLE_PID_BASED_VERSION_LOCKING;return i(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=Te(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=f();try{let n=t.readFileSync(e,{encoding:`utf8`});if(!n||n.trim()===``)return null;let r=l(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 p(`Lock PID ${n} is running but does not appear to be Claude - treating as stale`),!1;let i=f();try{let t=i.statSync(e);if(Date.now()-t.mtimeMs>$&&!X(n))return!1}catch{}return!0}function pt(e,t){let n=f(),r=`${e}.tmp.${process.pid}.${Date.now()}`;try{ie(r,le(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=f(),r=Ae(e);if(Q(t))return p(`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?(p(`Acquired PID lock for ${r} (PID ${process.pid})`),()=>{try{Z(t)?.pid===process.pid&&(n.unlinkSync(t),p(`Released PID lock for ${r}`))}catch(e){p(`Failed to release lock for ${r}: ${e}`)}}):null}catch(e){return p(`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=f(),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(se(e))return n;C(ce(e))}return n}function vt(e){let t=f(),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++,p(`Cleaned up legacy directory lock: ${i}`)):Q(r)||(t.unlinkSync(r),n++,p(`Cleaned up stale lock: ${i}`))}catch{}}}catch(e){if(se(e))return 0;C(ce(e))}return n}var $,yt=e((()=>{d(),o(),h(),m(),we(),S(),u(),$=7200*1e3}));export{L as C,I as S,Le as _,Q as a,z as b,gt as c,ut as d,qe as f,He as g,Xe as h,yt as i,rt as l,Ge as m,vt as n,dt as o,Be as p,_t as r,Z as s,ht as t,lt as u,R as v,Re as x,H as y};
3
+ `),{encoding:`utf8`}),await n.datasync()}finally{await n.close()}}async function B(e){let t=R(e);for(let e of Object.values(t)){let t=await z(e);if(t){for(let e of t)if(V.test(e)){let t=e.match(/alias\s+claude=["']?([^"'\s]+)/);if(t&&t[1])return t[1]}}}return null}async function ze(e){let t=await B(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 V,H=e((()=>{h(),L(),V=/^\s*alias\s+claude\s*=/}));async function Be(){let e=await Ve();return process.env.USER_TYPE===`ant`?e.ant||void 0:e.external||void 0}async function Ve(){try{return{}}catch(e){return C(e),{}}}function He(e){let t=ge()?.minimumVersion;if(!t)return!1;let n=!Te(e,t);return n&&p(`Skipping update to ${e} - below minimumVersion ${t}`),n}async function Ue(){let e=ue.isRunningWithBun(),t=null;return t=e?await y(`bun`,[`pm`,`bin`,`-g`],{cwd:D()}):await y(`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 We(){try{let e=await Ue();if(!e)return{hasPermissions:!1,npmPrefix:null};try{return await j(e,Me.W_OK),{hasPermissions:!0,npmPrefix:e}}catch{return C(new Ye(`Insufficient permissions for global npm install.`)),{hasPermissions:!1,npmPrefix:e}}}catch(e){return C(e),{hasPermissions:!1,npmPrefix:null}}}async function Ge(){let e=await y(`npm`,[`view`,``,`dist-tags`,`--json`,`--prefer-online`],{abortSignal:AbortSignal.timeout(5e3),cwd:D()});if(e.code!==0)return p(`npm view dist-tags failed with code ${e.code}`),{latest:null,stable:null};try{let t=l(e.stdout.trim());return{latest:typeof t.latest==`string`?t.latest:null,stable:typeof t.stable==`string`?t.stable:null}}catch(e){return p(`Failed to parse dist-tags: ${e}`),{latest:null,stable:null}}}async function Ke(e){try{return(await s.get(`${Je}/${e}`,{timeout:5e3,responseType:`text`})).data.trim()}catch(t){return p(`Failed to fetch ${e} from GCS: ${t}`),null}}async function qe(){let[e,t]=await Promise.all([Ke(`latest`),Ke(`stable`)]);return{latest:e,stable:t}}var Je,Ye,Xe=e((()=>{c(),v(),d(),de(),o(),h(),b(),m(),ee(),S(),we(),he(),H(),u(),Je=`https://storage.googleapis.com/claude-code-dist-86c565f3-f756-42ad-8dfa-d59b1c096819/claude-code-releases`,Ye=class extends oe{}}));function U(e,t){return t.includes(e.id)||e.idLike.some(e=>t.includes(e))}function Ze(){let e=process.execPath||process.argv[0]||``;return/[/\\]mise[/\\]installs[/\\]/i.test(e)?(p(`Detected mise installation: ${e}`),!0):!1}function Qe(){let e=process.execPath||process.argv[0]||``;return/[/\\]\.?asdf[/\\]installs[/\\]/i.test(e)?(p(`Detected asdf installation: ${e}`),!0):!1}function W(){let e=w();if(e!==`macos`&&e!==`linux`&&e!==`wsl`)return!1;let t=process.execPath||process.argv[0]||``;return t.includes(`/Caskroom/`)?(p(`Detected Homebrew cask installation: ${t}`),!0):!1}function $e(){if(w()!==`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 p(`Detected winget installation: ${e}`),!0;return!1}var G,K,q,J,Y,et,tt=e((()=>{n(),d(),b(),T(),G=t(async()=>{try{let e=await M(`/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}}),K=t(async()=>{if(w()!==`linux`)return!1;let e=await G();if(e&&!U(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?(p(`Detected pacman installation: ${t.stdout.trim()}`),!0):!1}),q=t(async()=>{if(w()!==`linux`)return!1;let e=await G();if(e&&!U(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?(p(`Detected deb installation: ${t.stdout.trim()}`),!0):!1}),J=t(async()=>{if(w()!==`linux`)return!1;let e=await G();if(e&&!U(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?(p(`Detected rpm installation: ${t.stdout.trim()}`),!0):!1}),Y=t(async()=>{if(w()!==`linux`)return!1;let e=await G();if(e&&!U(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?(p(`Detected apk installation: ${t.stdout.trim()}`),!0):!1}),et=t(async()=>W()?`homebrew`:$e()?`winget`:Ze()?`mise`:Qe()?`asdf`:await K()?`pacman`:await Y()?`apk`:await q()?`deb`:await J()?`rpm`:`unknown`)}));function nt(){let e=process.argv[1]||``,t=process.execPath||process.argv[0]||``;return w()===`windows`&&(e=e.split(A.sep).join(k.sep),t=t.split(A.sep).join(k.sep)),[e,t]}async function rt(){let[e]=nt();if(E())return W()||$e()||Ze()||Qe()||await K()||await q()||await J()||await Y()?`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 be(`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 it(){if(E()){try{return await N(process.execPath)}catch{}try{let e=await xe(`claude`);if(e)return e}catch{}try{return await f().stat(O(D(),`.local/bin/claude`)),O(D(),`.local/bin/claude`)}catch{}return`native`}try{return process.argv[0]||`unknown`}catch{return`unknown`}}function at(){try{return E()?process.execPath||`unknown`:process.argv[1]||`unknown`}catch{return`unknown`}}async function ot(){let e=f(),t=[],n=O(D(),`.claude`,`local`);await F()&&t.push({type:`npm-local`,path:n});let r=[`@anthropic-ai/claude-code`],i=await x(`npm`,[`-g`,`config`,`get`,`prefix`]);if(i.code===0&&i.stdout){let n=i.stdout.trim(),a=w()===`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 N(o)).includes(`/Caskroom/`)&&(e=W())}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(_().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 st(e){let t=[];try{let e=l(await M(O(pe(),`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=_();if(e===`development`)return t;if(e===`native`){let e=(process.env.PATH||``).split(je),n=O(D(),`.local`,`bin`),r=n;if(w()===`windows`&&(r=n.split(A.sep).join(k.sep)),!e.some(e=>{let t=e;w()===`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(w()===`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=I(),n=R()[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}`})}}i(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 F()&&t.push({issue:`Local installation exists but not being used`,fix:`Consider using native installation: claude install`});let r=await B(),a=await ze();return e===`npm-local`&&!await xe(`claude`)&&!a&&(r?t.push({issue:`Local installation not accessible`,fix:`Alias exists but points to invalid target: ${r}. Update alias: alias claude="~/.claude/local/claude"`}):t.push({issue:`Local installation not accessible`,fix:`Create alias: alias claude="~/.claude/local/claude"`})),t}function ct(){if(w()!==`linux`)return[];let e=[],t=te.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 lt(){let e=await rt(),t=typeof MACRO<`u`?`0.0.8`:`unknown`,n=await it(),r=at(),i=await ot(),a=await st(e);if(a.push(...ct()),e===`native`){let e=i.filter(e=>e.type===`npm-global`||e.type===`npm-global-orphan`||e.type===`npm-local`),t=w()===`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/claude-code`}):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=_().installMethod||`not set`,s=null;e===`npm-global`&&(s=(await We()).hasPermissions,!s&&!_e()&&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=ke(),ee={working:c.working??!0,mode:c.mode,systemPath:c.mode===`system`?c.path:null,note:c.note??null},te=e===`package-manager`?await et():void 0;return{installationType:e,version:t,installationPath:n,invokedBinary:r,configInstallMethod:o,autoUpdates:(()=>{let e=_e();return e?`disabled (${ve(e)})`:`enabled`})(),hasUpdatePermissions:s,multipleInstallations:i,warnings:a,packageManager:te,ripgrepStatus:ee}}var ut=e((()=>{ye(),Xe(),Ce(),v(),re(),o(),b(),m(),L(),tt(),T(),Oe(),ne(),me(),fe(),H(),u(),Se()}));function dt(){let e=process.env.ENABLE_PID_BASED_VERSION_LOCKING;return i(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=f();try{let n=t.readFileSync(e,{encoding:`utf8`});if(!n||n.trim()===``)return null;let r=l(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 p(`Lock PID ${n} is running but does not appear to be Claude - treating as stale`),!1;let i=f();try{let t=i.statSync(e);if(Date.now()-t.mtimeMs>$&&!X(n))return!1}catch{}return!0}function pt(e,t){let n=f(),r=`${e}.tmp.${process.pid}.${Date.now()}`;try{ie(r,le(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=f(),r=Ae(e);if(Q(t))return p(`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?(p(`Acquired PID lock for ${r} (PID ${process.pid})`),()=>{try{Z(t)?.pid===process.pid&&(n.unlinkSync(t),p(`Released PID lock for ${r}`))}catch(e){p(`Failed to release lock for ${r}: ${e}`)}}):null}catch(e){return p(`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=f(),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(se(e))return n;C(ce(e))}return n}function vt(e){let t=f(),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++,p(`Cleaned up legacy directory lock: ${i}`)):Q(r)||(t.unlinkSync(r),n++,p(`Cleaned up stale lock: ${i}`))}catch{}}}catch(e){if(se(e))return 0;C(ce(e))}return n}var $,yt=e((()=>{d(),o(),h(),m(),Ee(),S(),u(),$=7200*1e3}));export{L as C,I as S,Le as _,Q as a,z as b,gt as c,ut as d,qe as f,He as g,Xe as h,yt as i,rt as l,Ge as m,vt as n,dt as o,Be as p,_t as r,Z as s,ht as t,lt as u,R as v,Re as x,H as y};
@@ -1 +1 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{n as t,o as n}from"./envUtils-DSxRz_kt.js";import{o as r}from"./log-BMCygSzM.js";import{join as i}from"path";import"fs/promises";import"net";import"events";function a(){return i(t(),`pipes`)}function o(e){return e?.pipeIpc??s}var s,c=e((()=>{n(),r(),s={role:`main`,subIndex:null,displayRole:`main`,serverName:null,attachedBy:null,localIp:null,hostname:null,machineId:null,mac:null,statusVisible:!1,selectorOpen:!1,selectedPipes:[],routeMode:`selected`,slaves:{},discoveredPipes:[]}}));export{a as n,c as r,o as t};
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{n as t,o as n}from"./envUtils-DSxRz_kt.js";import{o as r}from"./log-CZ0zYP_c.js";import{join as i}from"path";import"fs/promises";import"net";import"events";function a(){return i(t(),`pipes`)}function o(e){return e?.pipeIpc??s}var s,c=e((()=>{n(),r(),s={role:`main`,subIndex:null,displayRole:`main`,serverName:null,attachedBy:null,localIp:null,hostname:null,machineId:null,mac:null,statusVisible:!1,selectorOpen:!1,selectedPipes:[],routeMode:`selected`,slaves:{},discoveredPipes:[]}}));export{a as n,c as r,o as t};
@@ -1 +1 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{I as t,P as n,fi as r,t as i}from"./src-CDCSSo0U2.js";import{t as a}from"./jsx-runtime-Bb4Xn-E0.js";import{Yt as o,en as s}from"./state-ix0xIunV.js";import{A as c,C as l,Dg as u,Ew as d,Fg as f,Sw as p,cb as m,fb as h,lb as g}from"./loadAgentsDir-D206qwP3.js";import{a as _,i as v,r as y,t as b}from"./promptEditor-DeMrXUir.js";import{r as x,t as S}from"./staticRender-BIxpgNUq.js";function C({planContent:e,planPath:r,editorName:i}){return(0,T.jsxs)(t,{flexDirection:`column`,children:[(0,T.jsx)(n,{bold:!0,children:`Current Plan`}),(0,T.jsx)(n,{dimColor:!0,children:r}),(0,T.jsx)(t,{marginTop:1,children:(0,T.jsx)(n,{children:e})}),i&&(0,T.jsxs)(t,{marginTop:1,children:[(0,T.jsx)(n,{dimColor:!0,children:`"/plan open"`}),(0,T.jsx)(n,{dimColor:!0,children:` to edit this plan in `}),(0,T.jsx)(n,{bold:!0,dimColor:!0,children:i})]})]})}async function w(e,t,n){let{getAppState:r,setAppState:i}=t,a=r().toolPermissionContext.mode;if(a!==`plan`){o(a,`plan`),i(e=>({...e,toolPermissionContext:p(c(e.toolPermissionContext),{type:`setMode`,mode:`plan`,destination:`session`})}));let t=n.trim();return t&&t!==`open`?e(`Enabled plan mode`,{shouldQuery:!0}):e(`Enabled plan mode`),null}let s=m(),l=g();if(!s)return e(`Already in plan mode. No plan written yet.`),null;if(n.trim().split(/\s+/)[0]===`open`){let t=await b(l);return t.error?e(`Failed to open plan in editor: ${t.error}`):e(`Opened plan in editor: ${l}`),null}let u=v();return e(await x((0,T.jsx)(C,{planContent:s,planPath:l,editorName:u?f(u):void 0}))),null}var T;e((()=>{r(),s(),i(),_(),u(),d(),l(),h(),y(),S(),T=a()}))();export{w as call};
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{I as t,P as n,fi as r,t as i}from"./src-CDCSSo0U2.js";import{t as a}from"./jsx-runtime-Bb4Xn-E0.js";import{$t as o,Jt as s}from"./state-C2OSZkV1.js";import{A as c,BT as l,C as u,F_ as d,UT as f,hS as p,j_ as m,sS as h,zT as g}from"./loadAgentsDir-ByO8eJqU.js";import{a as _,i as v,r as y,t as b}from"./promptEditor-R_acDAgI.js";import{r as x,t as S}from"./staticRender-BIxpgNUq.js";function C({planContent:e,planPath:r,editorName:i}){return(0,T.jsxs)(t,{flexDirection:`column`,children:[(0,T.jsx)(n,{bold:!0,children:`Current Plan`}),(0,T.jsx)(n,{dimColor:!0,children:r}),(0,T.jsx)(t,{marginTop:1,children:(0,T.jsx)(n,{children:e})}),i&&(0,T.jsxs)(t,{marginTop:1,children:[(0,T.jsx)(n,{dimColor:!0,children:`"/plan open"`}),(0,T.jsx)(n,{dimColor:!0,children:` to edit this plan in `}),(0,T.jsx)(n,{bold:!0,dimColor:!0,children:i})]})]})}async function w(e,t,n){let{getAppState:r,setAppState:i}=t,a=r().toolPermissionContext.mode;if(a!==`plan`){s(a,`plan`),i(e=>({...e,toolPermissionContext:m(c(e.toolPermissionContext),{type:`setMode`,mode:`plan`,destination:`session`})}));let t=n.trim();return t&&t!==`open`?e(`Enabled plan mode`,{shouldQuery:!0}):e(`Enabled plan mode`),null}let o=g(),u=l();if(!o)return e(`Already in plan mode. No plan written yet.`),null;if(n.trim().split(/\s+/)[0]===`open`){let t=await b(u);return t.error?e(`Failed to open plan in editor: ${t.error}`):e(`Opened plan in editor: ${u}`),null}let d=v();return e(await x((0,T.jsx)(C,{planContent:o,planPath:u,editorName:d?p(d):void 0}))),null}var T;e((()=>{r(),o(),i(),_(),h(),d(),u(),f(),y(),S(),T=a()}))();export{w as call};
@@ -1,2 +1,2 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{n as t,t as n}from"./memoize-BK3gG5ob.js";import{d as r,p as i}from"./debug-BrXObCdR.js";import{o as a,s as o}from"./log-BMCygSzM.js";import{release as s}from"os";import{readFile as c,readdir as l}from"fs/promises";async function u(e){let t=new Set;process.env.P4PORT&&t.add(`perforce`);try{let n=e??r().cwd(),i=new Set(await l(n));for(let[e,n]of h)i.has(e)&&t.add(n)}catch{}return[...t]}var d,f,p,m,h,g=e((()=>{n(),i(),a(),d=[`macos`,`wsl`],f=t(()=>{try{if(process.platform===`darwin`)return`macos`;if(process.platform===`win32`)return`windows`;if(process.platform===`linux`){try{let e=r().readFileSync(`/proc/version`,{encoding:`utf8`});if(e.toLowerCase().includes(`microsoft`)||e.toLowerCase().includes(`wsl`))return`wsl`}catch(e){o(e)}return`linux`}return`unknown`}catch(e){return o(e),`unknown`}}),p=t(()=>{if(process.platform===`linux`)try{let e=r().readFileSync(`/proc/version`,{encoding:`utf8`}),t=e.match(/WSL(\d+)/i);return t&&t[1]?t[1]:e.toLowerCase().includes(`microsoft`)?`1`:void 0}catch(e){o(e);return}}),m=t(async()=>{if(process.platform!==`linux`)return;let e={linuxKernel:s()};try{let t=await c(`/etc/os-release`,`utf8`);for(let n of t.split(`
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{n as t,t as n}from"./memoize-BK3gG5ob.js";import{d as r,p as i}from"./debug-RZ4NuXyS.js";import{o as a,s as o}from"./log-CZ0zYP_c.js";import{release as s}from"os";import{readFile as c,readdir as l}from"fs/promises";async function u(e){let t=new Set;process.env.P4PORT&&t.add(`perforce`);try{let n=e??r().cwd(),i=new Set(await l(n));for(let[e,n]of h)i.has(e)&&t.add(n)}catch{}return[...t]}var d,f,p,m,h,g=e((()=>{n(),i(),a(),d=[`macos`,`wsl`],f=t(()=>{try{if(process.platform===`darwin`)return`macos`;if(process.platform===`win32`)return`windows`;if(process.platform===`linux`){try{let e=r().readFileSync(`/proc/version`,{encoding:`utf8`});if(e.toLowerCase().includes(`microsoft`)||e.toLowerCase().includes(`wsl`))return`wsl`}catch(e){o(e)}return`linux`}return`unknown`}catch(e){return o(e),`unknown`}}),p=t(()=>{if(process.platform===`linux`)try{let e=r().readFileSync(`/proc/version`,{encoding:`utf8`}),t=e.match(/WSL(\d+)/i);return t&&t[1]?t[1]:e.toLowerCase().includes(`microsoft`)?`1`:void 0}catch(e){o(e);return}}),m=t(async()=>{if(process.platform!==`linux`)return;let e={linuxKernel:s()};try{let t=await c(`/etc/os-release`,`utf8`);for(let n of t.split(`
2
2
  `)){let t=n.match(/^(ID|VERSION_ID)=(.*)$/);if(t&&t[1]&&t[2]){let n=t[2].replace(/^"|"$/g,``);t[1]===`ID`?e.linuxDistroId=n:e.linuxDistroVersion=n}}}catch{}return e}),h=[[`.git`,`git`],[`.hg`,`mercurial`],[`.svn`,`svn`],[`.p4config`,`perforce`],[`$tf`,`tfs`],[`.tfvc`,`tfs`],[`.jj`,`jujutsu`],[`.sl`,`sapling`]]}));export{p as a,f as i,u as n,g as o,m as r,d as t};
@@ -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-DSxRz_kt.js";import{n as i,t as a}from"./figures-5ThXQEtq.js";import{D as o,Gr as s,Gt as c,H as l,I as u,P as d,T as f,Wt as ee,Xn as p,fi as m,hn as h,j as g,k as _,n as v,ot as y,r as b,t as x,x as te,y as ne}from"./src-CDCSSo0U2.js";import{t as S}from"./jsx-runtime-Bb4Xn-E0.js";import{$C as C,$v as w,Bo as T,Cs as E,DC as D,Do as O,Jp as k,Ko as A,No as re,Oo as ie,Po as ae,Pw as j,Qo as M,Qv as N,Uo as oe,Wo as P,Yo as F,_D as se,_E as ce,_s as le,_v as ue,as as I,aw as de,bE as fe,bv as pe,cD as me,cw as he,dp as L,dw as R,ew as ge,fw as _e,gs as ve,hD as ye,hs as be,iD as z,im as xe,iw as B,ls as Se,lw as Ce,mD as we,ms as Te,ns as Ee,ow as De,pp as Oe,ps as ke,pw as Ae,qp as V,rm as je,rw as Me,ss as Ne,sw as Pe,ts as Fe,uD as Ie,us as Le,uw as Re,vD as ze,vs as Be,vv as Ve,wC as He,ws as Ue,xE as We,xs as Ge,xw as Ke,ys as qe}from"./loadAgentsDir-ByO8eJqU.js";import{C as Je,F as Ye,S as Xe,W as Ze,a as Qe,l as $e,z as et}from"./debug-RZ4NuXyS.js";import{In as tt,Ln as nt,c as rt,f as it,g as at,vt as ot,x as st,xt as ct}from"./settings-hQDLwPVj.js";import{g as lt,x as ut}from"./config-CE058cvr.js";import{o as dt,s as ft}from"./log-CZ0zYP_c.js";import{n as pt,r as mt}from"./analytics-CkYUHW_U.js";import{b as ht,w as gt}from"./startupProfiler-DCn_NxMH.js";import{l as H,o as _t}from"./stringUtils-B6FudhoZ.js";import{n as vt,t as yt}from"./pluginStartupCheck-Di4LjHXf.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-C7p_Qr2r.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-AHl-g4ct.js";import{a as Ft,n as It,o as Lt,r as Rt}from"./pluginFlagging-pBxSselw.js";import{i as zt,n as Bt}from"./MCPConnectionManager-ao-P3xSA.js";import{n as Vt,t as Ht}from"./useExitOnCtrlCDWithKeybindings-Cce612uS.js";import{t as Ut}from"./SearchBox-vfLXEPed.js";import{n as Wt,t as Gt}from"./useSearchInput-BAgljZUl.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-dkofcJs4.js";import{i as en,n as tn}from"./pluginAutoupdate-D0LIP7cy.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:s,setResult:c,setViewState:l,onAddComplete:ee,cliMode:p=!1}){let m=(0,on.useRef)(!1),[h,g]=(0,on.useState)(!1),[_,v]=(0,on.useState)(``),y=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{g(!0),v(``);let{name:e,resolvedSource:t}=await F(n,e=>{v(e)});Se(e,{source:t}),E();let r=n.source;n.source===`github`&&(r=n.repo),mt(`tengu_marketplace_added`,{source_type:r}),ee&&await ee(),v(``),g(!1),p?c(`Successfully added marketplace: ${e}`):l({type:`browse-marketplace`,targetMarketplace:e})}catch(e){let t=Ze(e);ft(t),a(t.message),v(``),g(!1),c(p?`Error: ${t.message}`:null)}};return(0,on.useEffect)(()=>{e&&!m.current&&!i&&!s&&(m.current=!0,y())},[]),(0,U.jsxs)(u,{flexDirection:`column`,children:[(0,U.jsxs)(u,{flexDirection:`column`,paddingX:1,borderStyle:`round`,children:[(0,U.jsx)(u,{marginBottom:1,children:(0,U.jsx)(d,{bold:!0,children:`Add Marketplace`})}),(0,U.jsxs)(u,{flexDirection:`column`,children:[(0,U.jsx)(d,{children:`Enter marketplace source:`}),(0,U.jsx)(d,{dimColor:!0,children:`Examples:`}),(0,U.jsx)(d,{dimColor:!0,children:` · owner/repo (GitHub)`}),(0,U.jsx)(d,{dimColor:!0,children:` · git@github.com:owner/repo.git (SSH)`}),(0,U.jsx)(d,{dimColor:!0,children:` · https://example.com/marketplace.json`}),(0,U.jsx)(d,{dimColor:!0,children:` · ./path/to/marketplace`}),(0,U.jsx)(u,{marginTop:1,children:(0,U.jsx)(je,{value:e,onChange:t,onSubmit:y,columns:80,cursorOffset:n,onChangeCursorOffset:r,focus:!0,showCursor:!0})})]}),h&&(0,U.jsxs)(u,{marginTop:1,children:[(0,U.jsx)(L,{}),(0,U.jsx)(d,{children:_||`Adding marketplace to configuration…`})]}),i&&(0,U.jsx)(u,{marginTop:1,children:(0,U.jsx)(d,{color:`error`,children:i})}),s&&(0,U.jsx)(u,{marginTop:1,children:(0,U.jsx)(d,{children:s})})]}),(0,U.jsx)(u,{marginLeft:3,children:(0,U.jsx)(d,{dimColor:!0,italic:!0,children:(0,U.jsxs)(f,{children:[(0,U.jsx)(o,{shortcut:`Enter`,action:`add`}),(0,U.jsx)(V,{action:`confirm:no`,context:`Settings`,fallback:`Esc`,description:`cancel`})]})})})]})}var on,U,sn=e((()=>{m(),on=t(m(),1),pt(),k(),x(),Oe(),xe(),et(),dt(),Ue(),Fe(),At(),U=S()}));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 l=Object.keys(n),f=(0,un.useCallback)(e=>{if(n[e]?.sensitive===!0)return``;let t=r?.[e];return t===void 0?``:String(t)},[n,r]),[p,m]=(0,un.useState)(0),[g,_]=(0,un.useState)({}),[v,y]=(0,un.useState)(()=>l[0]?f(l[0]):``),b=l[p],x=b?n[b]:null;if(ee(`confirm:no`,o,{context:`Settings`}),c({"confirm:nextField":(0,un.useCallback)(()=>{if(p<l.length-1&&b){_(e=>({...e,[b]:v})),m(e=>e+1);let e=l[p+1];y(e?f(e):``)}},[p,l,b,v,f]),"confirm:yes":(0,un.useCallback)(()=>{if(!b)return;let e={...g,[b]:v};if(p===l.length-1)i(cn(l,e,n,r));else{_(e),m(e=>e+1);let t=l[p+1];y(t?f(t):``)}},[b,g,v,p,l,n,i,f,r])},{context:`Confirmation`}),h((e,t)=>{if(t.backspace||t.delete){y(e=>e.slice(0,-1));return}e&&!t.ctrl&&!t.meta&&!t.tab&&!t.return&&y(t=>t+e)}),!x||!b)return null;let te=x.sensitive===!0,S=x.required===!0,C=te?`*`.repeat(s(v)):v;return(0,dn.jsxs)(ne,{title:e,subtitle:t,onCancel:o,isCancelActive:!1,children:[(0,dn.jsxs)(u,{flexDirection:`column`,children:[(0,dn.jsxs)(d,{bold:!0,children:[x.title||b,S&&(0,dn.jsx)(d,{color:`error`,children:` *`})]}),x.description&&(0,dn.jsx)(d,{dimColor:!0,children:x.description}),(0,dn.jsxs)(u,{marginTop:1,children:[(0,dn.jsxs)(d,{children:[a.pointerSmall,` `]}),(0,dn.jsx)(d,{children:C}),(0,dn.jsx)(d,{children:`█`})]})]}),(0,dn.jsxs)(u,{flexDirection:`column`,children:[(0,dn.jsxs)(d,{dimColor:!0,children:[`Field `,p+1,` of `,l.length]}),p<l.length-1&&(0,dn.jsx)(d,{dimColor:!0,children:`Tab: Next field · Enter: Save and continue`}),p===l.length-1&&(0,dn.jsx)(d,{dimColor:!0,children:`Enter: Save configuration`})]})]})}var un,dn,fn=e((()=>{i(),un=t(m(),1),x(),j(),r(),dn=S()}));async function pn(e){let{enabled:t,disabled:n}=await ie();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=Me(e);Object.keys(r).length>0&&n.push({key:`top-level`,title:`Configure ${e.name}`,subtitle:`Plugin options`,schema:r,load:()=>de(t),save:n=>De(t,n,e.manifest.userConfig)});let i=C(e);for(let r of i)n.push({key:`channel:${r.server}`,title:`Configure ${r.displayName}`,subtitle:`Plugin: ${e.name}`,schema:r.configSchema,load:()=>Ce(t,r.server)??void 0,save:e=>R(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`,Ye(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(m(),1),et(),Pe(),ge(),O(),B(),fn(),gn=S()}));function vn(){let e=Be();return(0,yn.jsxs)(u,{marginBottom:1,children:[(0,yn.jsxs)(d,{color:`claude`,children:[a.warning,` `]}),(0,yn.jsxs)(d,{dimColor:!0,italic:!0,children:[`Make sure you trust a plugin before installing, updating, or using it. We do not control what MCP servers, files, or other software are included in plugins and cannot verify that they will work as intended or that they won't change. See each plugin's homepage for more information.`,e?` ${e}`:``]})]})}var yn,bn=e((()=>{i(),m(),x(),qe(),yn=S()}));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)(u,{marginTop:1,children:(0,wn.jsx)(d,{dimColor:!0,italic:!0,children:(0,wn.jsxs)(f,{children:[e&&(0,wn.jsx)(V,{action:`plugin:install`,context:`Plugin`,fallback:`i`,description:`install`,bold:!0}),(0,wn.jsx)(V,{action:`plugin:toggle`,context:`Plugin`,fallback:`Space`,description:`toggle`}),(0,wn.jsx)(V,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`details`}),(0,wn.jsx)(V,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]})})})}var wn,Tn=e((()=>{m(),k(),x(),wn=S()}));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)(()=>{},[]),ee=(0,Dn.useCallback)(()=>{},[]),p=(0,Dn.useCallback)((t,n)=>{n(Math.max(0,Math.min(t,e-1)))},[e]),m=(0,Dn.useCallback)((e,t)=>!1,[]),h=Math.max(1,Math.ceil(e/t));return{currentPage:Math.floor(a/t),totalPages:h,startIndex:o,endIndex:s,needsPagination:r,pageSize:t,getVisibleItems:c,toActualIndex:l,isOnCurrentPage:u,goToPage:d,nextPage:f,prevPage:ee,handleSelectionChange:p,handlePageNavigation:m,scrollPosition:{current:n+1,total:e,canScrollUp:a>0,canScrollDown:a+t<e}}}var Dn,On,kn=e((()=>{Dn=t(m(),1),On=5}));function An({error:e,setError:t,result:n,setResult:r,setViewState:i,onInstallComplete:o,targetMarketplace:s,targetPlugin:l}){let[p,m]=(0,W.useState)(`marketplace-list`),[h,g]=(0,W.useState)(null),[_,v]=(0,W.useState)(null),[y,b]=(0,W.useState)([]),[x,te]=(0,W.useState)([]),[ne,S]=(0,W.useState)(!0),[C,T]=(0,W.useState)(null),[D,O]=(0,W.useState)(0),[k,A]=(0,W.useState)(new Set),[re,ie]=(0,W.useState)(new Set),j=En({totalItems:x.length,selectedIndex:D}),[N,F]=(0,W.useState)(0),[se,ce]=(0,W.useState)(!1),[ue,I]=(0,W.useState)(null),[de,fe]=(0,W.useState)(null);ee(`confirm:no`,jn.useCallback(()=>{p===`plugin-list`?s?i({type:`manage-marketplaces`,targetMarketplace:s}):y.length===1?i({type:`menu`}):(m(`marketplace-list`),g(null),A(new Set)):p===`plugin-details`?(m(`plugin-list`),v(null)):i({type:`menu`})},[p,s,i,y.length]),{context:`Confirmation`}),(0,W.useEffect)(()=>{async function e(){try{let e=await Ee(),{marketplaces:n,failures:r}=await Ge(e),i=[];for(let{name:e,config:t,data:r}of n)if(r){let n=tt(r.plugins,t=>P(ke(t.name,e)));i.push({name:e,totalPlugins:r.plugins.length,installedCount:n,source:le(t.source)})}i.sort((e,t)=>e.name===`claude-plugin-directory`?-1:+(t.name===`claude-plugin-directory`)),b(i);let a=ve(r,tt(n,e=>e.data!==null));if(a)if(a.type===`warning`)fe(a.message+`. Showing available marketplaces.`);else throw Error(a.message);if(i.length===1&&!s&&!l){let e=i[0];e&&(g(e.name),m(`plugin-list`))}if(l){let n=null,r=null;for(let[t]of Object.entries(e)){let e=await M(t);if(e){let i=e.plugins.find(e=>e.name===l);if(i){let e=ke(i.name,t);n={entry:i,marketplaceName:t,pluginId:e,isInstalled:oe(e)},r=t;break}}}if(n&&r){let e=n.pluginId;oe(e)?t(`Plugin '${e}' is already installed globally. Use '/plugin' to manage existing plugins.`):(g(r),v(n),m(`plugin-details`))}else t(`Plugin "${l}" not found in any marketplace`)}else s&&(i.some(e=>e.name===s)?(g(s),m(`plugin-list`)):t(`Marketplace "${s}" not found`))}catch(e){t(e instanceof Error?e.message:`Failed to load marketplaces`)}finally{S(!1)}}e()},[t,s,l]),(0,W.useEffect)(()=>{if(!h)return;let e=!1;async function n(n){S(!0);try{let t=await M(n);if(e)return;if(!t)throw Error(`Failed to load marketplace: ${n}`);let r=[];for(let e of t.plugins){let t=ke(e.name,n);w(t)||r.push({entry:e,marketplaceName:n,pluginId:t,isInstalled:oe(t)})}try{let t=await Nt();if(e)return;T(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;$e(`Failed to fetch install counts: ${Ye(t)}`),r.sort((e,t)=>e.entry.name.localeCompare(t.entry.name))}te(r),O(0),A(new Set)}catch(n){if(e)return;t(n instanceof Error?n.message:`Failed to load plugins`)}finally{S(!1)}}return n(h),()=>{e=!0}},[h,t]);let pe=async()=>{if(k.size===0)return;let e=x.filter(e=>k.has(e.pluginId));ie(new Set(e.map(e=>e.pluginId)));let n=0,a=0,s=[];for(let t of e){let e=await ae({pluginId:t.pluginId,entry:t.entry,marketplaceName:t.marketplaceName,scope:`user`});e.success?n++:(a++,s.push({name:t.entry.name,reason:e.error}))}ie(new Set),A(new Set),E(),a===0?r(`✓ Installed ${n} ${H(n,`plugin`)}. Run /reload-plugins to activate.`):n===0?t(`Failed to install: ${be(s,!0)}`):r(`✓ Installed ${n} of ${n+a} plugins. Failed: ${be(s,!1)}. Run /reload-plugins to activate successfully installed plugins.`),n>0&&o&&await o(),i({type:`menu`})},me=async(e,t=`user`)=>{ce(!0),I(null);let n=await ae({pluginId:e.pluginId,entry:e.entry,marketplaceName:e.marketplaceName,scope:t});if(n.success){let t=await pn(e.pluginId);if(t){ce(!1),m({type:`plugin-options`,plugin:t,pluginId:e.pluginId});return}r(n.message),o&&await o(),i({type:`menu`})}else ce(!1),I(n.error)};(0,W.useEffect)(()=>{e&&r(e)},[e,r]),c({"select:previous":()=>{D>0&&O(D-1)},"select:next":()=>{D<y.length-1&&O(D+1)},"select:accept":()=>{let e=y[D];e&&(g(e.name),m(`plugin-list`))}},{context:`Select`,isActive:p===`marketplace-list`}),c({"select:previous":()=>{D>0&&j.handleSelectionChange(D-1,O)},"select:next":()=>{D<x.length-1&&j.handleSelectionChange(D+1,O)},"select:accept":()=>{if(D===x.length&&k.size>0)pe();else if(D<x.length){let e=x[D];e&&(e.isInstalled?i({type:`manage-plugins`,targetPlugin:e.entry.name,targetMarketplace:e.marketplaceName}):(v(e),m(`plugin-details`),F(0),I(null)))}}},{context:`Select`,isActive:p===`plugin-list`}),c({"plugin:toggle":()=>{if(D<x.length){let e=x[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&&pe()}},{context:`Plugin`,isActive:p===`plugin-list`});let he=jn.useMemo(()=>{if(!_)return[];let e=_.entry.homepage;return Sn(e,xn(_))},[_]);if(c({"select:previous":()=>{N>0&&F(N-1)},"select:next":()=>{N<he.length-1&&F(N+1)},"select:accept":()=>{if(!_)return;let e=he[N]?.action,t=_.entry.homepage,n=xn(_);e===`install-user`?me(_,`user`):e===`install-project`?me(_,`project`):e===`install-local`?me(_,`local`):e===`homepage`&&t?Ae(t):e===`github`&&n?Ae(`https://github.com/${n}`):e===`back`&&(m(`plugin-list`),v(null))}},{context:`Select`,isActive:p===`plugin-details`&&!!_}),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,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(ne)return(0,G.jsx)(d,{children:`Loading…`});if(e)return(0,G.jsx)(d,{color:`error`,children:e});if(p===`marketplace-list`)return y.length===0?(0,G.jsxs)(u,{flexDirection:`column`,children:[(0,G.jsx)(u,{marginBottom:1,children:(0,G.jsx)(d,{bold:!0,children:`Select marketplace`})}),(0,G.jsx)(d,{children:`No marketplaces configured.`}),(0,G.jsxs)(d,{dimColor:!0,children:[`Add a marketplace first using `,`'Add marketplace'`,`.`]}),(0,G.jsx)(u,{marginTop:1,paddingLeft:1,children:(0,G.jsx)(d,{dimColor:!0,children:(0,G.jsx)(V,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`})})})]}):(0,G.jsxs)(u,{flexDirection:`column`,children:[(0,G.jsx)(u,{marginBottom:1,children:(0,G.jsx)(d,{bold:!0,children:`Select marketplace`})}),de&&(0,G.jsx)(u,{marginBottom:1,flexDirection:`column`,children:(0,G.jsxs)(d,{color:`warning`,children:[a.warning,` `,de]})}),y.map((e,t)=>(0,G.jsxs)(u,{flexDirection:`column`,marginBottom:+(t<y.length-1),children:[(0,G.jsx)(u,{children:(0,G.jsxs)(d,{color:D===t?`suggestion`:void 0,children:[D===t?a.pointer:` `,` `,e.name]})}),(0,G.jsx)(u,{marginLeft:2,children:(0,G.jsxs)(d,{dimColor:!0,children:[e.totalPlugins,` `,H(e.totalPlugins,`plugin`),` available`,e.installedCount>0&&` · ${e.installedCount} already installed`,e.source&&` · ${e.source}`]})})]},e.name)),(0,G.jsx)(u,{marginTop:1,children:(0,G.jsx)(d,{dimColor:!0,italic:!0,children:(0,G.jsxs)(f,{children:[(0,G.jsx)(V,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`select`}),(0,G.jsx)(V,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`})]})})})]});if(p===`plugin-details`&&_){let e=_.entry.homepage,t=Sn(e,xn(_));return(0,G.jsxs)(u,{flexDirection:`column`,children:[(0,G.jsx)(u,{marginBottom:1,children:(0,G.jsx)(d,{bold:!0,children:`Plugin Details`})}),(0,G.jsxs)(u,{flexDirection:`column`,marginBottom:1,children:[(0,G.jsx)(d,{bold:!0,children:_.entry.name}),_.entry.version&&(0,G.jsxs)(d,{dimColor:!0,children:[`Version: `,_.entry.version]}),_.entry.description&&(0,G.jsx)(u,{marginTop:1,children:(0,G.jsx)(d,{children:_.entry.description})}),_.entry.author&&(0,G.jsx)(u,{marginTop:1,children:(0,G.jsxs)(d,{dimColor:!0,children:[`By:`,` `,typeof _.entry.author==`string`?_.entry.author:_.entry.author.name]})})]}),(0,G.jsxs)(u,{flexDirection:`column`,marginBottom:1,children:[(0,G.jsx)(d,{bold:!0,children:`Will install:`}),_.entry.commands&&(0,G.jsxs)(d,{dimColor:!0,children:[`· Commands:`,` `,Array.isArray(_.entry.commands)?_.entry.commands.join(`, `):Object.keys(_.entry.commands).join(`, `)]}),_.entry.agents&&(0,G.jsxs)(d,{dimColor:!0,children:[`· Agents:`,` `,Array.isArray(_.entry.agents)?_.entry.agents.join(`, `):Object.keys(_.entry.agents).join(`, `)]}),_.entry.hooks&&(0,G.jsxs)(d,{dimColor:!0,children:[`· Hooks: `,Object.keys(_.entry.hooks).join(`, `)]}),_.entry.mcpServers&&(0,G.jsxs)(d,{dimColor:!0,children:[`· MCP Servers:`,` `,Array.isArray(_.entry.mcpServers)?_.entry.mcpServers.join(`, `):typeof _.entry.mcpServers==`object`?Object.keys(_.entry.mcpServers).join(`, `):`configured`]}),!_.entry.commands&&!_.entry.agents&&!_.entry.hooks&&!_.entry.mcpServers&&(0,G.jsx)(G.Fragment,{children:typeof _.entry.source==`object`&&`source`in _.entry.source&&(_.entry.source.source===`github`||_.entry.source.source===`url`||_.entry.source.source===`npm`||_.entry.source.source===`pip`)?(0,G.jsx)(d,{dimColor:!0,children:`· Component summary not available for remote plugin`}):(0,G.jsx)(d,{dimColor:!0,children:`· Components will be discovered at installation`})})]}),(0,G.jsx)(vn,{}),ue&&(0,G.jsx)(u,{marginBottom:1,children:(0,G.jsxs)(d,{color:`error`,children:[`Error: `,ue]})}),(0,G.jsx)(u,{flexDirection:`column`,children:t.map((e,t)=>(0,G.jsxs)(u,{children:[N===t&&(0,G.jsx)(d,{children:`> `}),N!==t&&(0,G.jsx)(d,{children:` `}),(0,G.jsx)(d,{bold:N===t,children:se&&e.action===`install`?`Installing…`:e.label})]},e.action))}),(0,G.jsx)(u,{marginTop:1,paddingLeft:1,children:(0,G.jsx)(d,{dimColor:!0,children:(0,G.jsxs)(f,{children:[(0,G.jsx)(V,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`select`}),(0,G.jsx)(V,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]})})})]})}if(x.length===0)return(0,G.jsxs)(u,{flexDirection:`column`,children:[(0,G.jsx)(u,{marginBottom:1,children:(0,G.jsx)(d,{bold:!0,children:`Install plugins`})}),(0,G.jsx)(d,{dimColor:!0,children:`No new plugins available to install.`}),(0,G.jsx)(d,{dimColor:!0,children:`All plugins from this marketplace are already installed.`}),(0,G.jsx)(u,{marginLeft:3,children:(0,G.jsx)(d,{dimColor:!0,italic:!0,children:(0,G.jsx)(V,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`})})})]});let L=j.getVisibleItems(x);return(0,G.jsxs)(u,{flexDirection:`column`,children:[(0,G.jsx)(u,{marginBottom:1,children:(0,G.jsx)(d,{bold:!0,children:`Install Plugins`})}),j.scrollPosition.canScrollUp&&(0,G.jsx)(u,{children:(0,G.jsxs)(d,{dimColor:!0,children:[` `,a.arrowUp,` more above`]})}),L.map((t,n)=>{let r=j.toActualIndex(n),i=D===r,o=k.has(t.pluginId),s=re.has(t.pluginId);return(0,G.jsxs)(u,{flexDirection:`column`,marginBottom:n===L.length-1&&!e?0:1,children:[(0,G.jsxs)(u,{children:[(0,G.jsxs)(d,{color:i?`suggestion`:void 0,children:[i?a.pointer:` `,` `]}),(0,G.jsxs)(d,{color:t.isInstalled?`success`:void 0,children:[t.isInstalled?a.tick:s?a.ellipsis:o?a.radioOn:a.radioOff,` `,t.entry.name,t.entry.category&&(0,G.jsxs)(d,{dimColor:!0,children:[` [`,t.entry.category,`]`]}),t.entry.tags?.includes(`community-managed`)&&(0,G.jsx)(d,{dimColor:!0,children:` [Community Managed]`}),t.isInstalled&&(0,G.jsx)(d,{dimColor:!0,children:` (installed)`}),C&&h===`claude-plugins-official`&&(0,G.jsxs)(d,{dimColor:!0,children:[` · `,Mt(C.get(t.pluginId)??0),` installs`]})]})]}),t.entry.description&&(0,G.jsxs)(u,{marginLeft:4,children:[(0,G.jsx)(d,{dimColor:!0,children:gt(t.entry.description,60)}),t.entry.version&&(0,G.jsxs)(d,{dimColor:!0,children:[` · v`,t.entry.version]})]})]},t.pluginId)}),j.scrollPosition.canScrollDown&&(0,G.jsx)(u,{children:(0,G.jsxs)(d,{dimColor:!0,children:[` `,a.arrowDown,` more below`]})}),e&&(0,G.jsx)(u,{marginTop:1,children:(0,G.jsxs)(d,{color:`error`,children:[a.cross,` `,e]})}),(0,G.jsx)(Cn,{hasSelection:k.size>0})]})}var jn,W,G,Mn=e((()=>{i(),jn=t(m(),1),W=t(m(),1),k(),x(),j(),nt(),_e(),Qe(),et(),Ue(),kt(),T(),qe(),Fe(),z(),re(),N(),_t(),ht(),_n(),bn(),Tn(),kn(),G=S()}));function Nn({error:e,setError:t,result:n,setResult:r,setViewState:i,onInstallComplete:o,onSearchModeChange:s,targetPlugin:l}){let[m,g]=(0,K.useState)(`plugin-list`),[v,b]=(0,K.useState)(null),[x,te]=(0,K.useState)([]),[ne,S]=(0,K.useState)(!0),[C,T]=(0,K.useState)(null),[D,O]=(0,K.useState)(!1),k=(0,K.useCallback)(e=>{O(e),s?.(e)},[s]),{query:A,setQuery:re,cursorOffset:ie}=Wt({isActive:m===`plugin-list`&&D&&!ne,onExit:()=>{k(!1)}}),j=p(),{columns:M}=y(),N=(0,K.useMemo)(()=>{if(!A)return x;let e=A.toLowerCase();return x.filter(t=>t.entry.name.toLowerCase().includes(e)||t.entry.description?.toLowerCase().includes(e)||t.marketplaceName.toLowerCase().includes(e))},[x,A]),[P,F]=(0,K.useState)(0),[se,ce]=(0,K.useState)(new Set),[le,ue]=(0,K.useState)(new Set),I=En({totalItems:N.length,selectedIndex:P});(0,K.useEffect)(()=>{F(0)},[A]);let[de,fe]=(0,K.useState)(0),[pe,me]=(0,K.useState)(!1),[he,L]=(0,K.useState)(null),[R,ge]=(0,K.useState)(null),[_e,ye]=(0,K.useState)(null);(0,K.useEffect)(()=>{async function e(){try{let e=await Ee(),{marketplaces:n,failures:r}=await Ge(e),i=[];for(let{name:e,data:t}of n)if(t)for(let n of t.plugins){let t=ke(n.name,e);i.push({entry:n,marketplaceName:e,pluginId:t,isInstalled:oe(t)})}let a=i.filter(e=>!e.isInstalled&&!w(e.pluginId));try{let e=await Nt();T(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){$e(`Failed to fetch install counts: ${Ye(e)}`),a.sort((e,t)=>e.entry.name.localeCompare(t.entry.name))}te(a);let o=Object.keys(e).length;if(a.length===0){let e=await Te({configuredMarketplaceCount:o,failedMarketplaceCount:r.length});ye(e)}let s=ve(r,tt(n,e=>e.data!==null));if(s)if(s.type===`warning`)ge(s.message+`. Showing available plugins.`);else throw Error(s.message);if(l){let e=i.find(e=>e.entry.name===l);e?e.isInstalled?t(`Plugin '${e.pluginId}' is already installed. Use '/plugin' to manage existing plugins.`):(b(e),g(`plugin-details`)):t(`Plugin "${l}" not found in any marketplace`)}}catch(e){t(e instanceof Error?e.message:`Failed to load plugins`)}finally{S(!1)}}e()},[t,l]);let z=async()=>{if(se.size===0)return;let e=x.filter(e=>se.has(e.pluginId));ue(new Set(e.map(e=>e.pluginId)));let n=0,a=0,s=[];for(let t of e){let e=await ae({pluginId:t.pluginId,entry:t.entry,marketplaceName:t.marketplaceName,scope:`user`});e.success?n++:(a++,s.push({name:t.entry.name,reason:e.error}))}ue(new Set),ce(new Set),E(),a===0?r(`✓ Installed ${n} ${H(n,`plugin`)}. Run /reload-plugins to activate.`):n===0?t(`Failed to install: ${be(s,!0)}`):r(`✓ Installed ${n} of ${n+a} plugins. Failed: ${be(s,!1)}. Run /reload-plugins to activate successfully installed plugins.`),n>0&&o&&await o(),i({type:`menu`})},xe=async(e,t=`user`)=>{me(!0),L(null);let n=await ae({pluginId:e.pluginId,entry:e.entry,marketplaceName:e.marketplaceName,scope:t});if(n.success){let t=await pn(e.pluginId);if(t){me(!1),g({type:`plugin-options`,plugin:t,pluginId:e.pluginId});return}r(n.message),o&&await o(),i({type:`menu`})}else me(!1),L(n.error)};(0,K.useEffect)(()=>{e&&r(e)},[e,r]),ee(`confirm:no`,()=>{g(`plugin-list`),b(null)},{context:`Confirmation`,isActive:m===`plugin-details`}),ee(`confirm:no`,()=>{i({type:`menu`})},{context:`Confirmation`,isActive:m===`plugin-list`&&!D}),h((e,t)=>{let n=!t.ctrl&&!t.meta;D||(e===`/`&&n?(k(!0),re(``)):n&&e.length>0&&!/^\s+$/.test(e)&&e!==`j`&&e!==`k`&&e!==`i`&&(k(!0),re(e)))},{isActive:m===`plugin-list`&&!ne}),c({"select:previous":()=>{P===0?k(!0):I.handleSelectionChange(P-1,F)},"select:next":()=>{P<N.length-1&&I.handleSelectionChange(P+1,F)},"select:accept":()=>{if(P===N.length&&se.size>0)z();else if(P<N.length){let e=N[P];e&&(e.isInstalled?i({type:`manage-plugins`,targetPlugin:e.entry.name,targetMarketplace:e.marketplaceName}):(b(e),g(`plugin-details`),fe(0),L(null)))}}},{context:`Select`,isActive:m===`plugin-list`&&!D}),c({"plugin:toggle":()=>{if(P<N.length){let e=N[P];if(e&&!e.isInstalled){let t=new Set(se);t.has(e.pluginId)?t.delete(e.pluginId):t.add(e.pluginId),ce(t)}}},"plugin:install":()=>{se.size>0&&z()}},{context:`Plugin`,isActive:m===`plugin-list`&&!D});let B=In.useMemo(()=>{if(!v)return[];let e=v.entry.homepage;return Sn(e,xn(v))},[v]);if(c({"select:previous":()=>{de>0&&fe(de-1)},"select:next":()=>{de<B.length-1&&fe(de+1)},"select:accept":()=>{if(!v)return;let e=B[de]?.action,t=v.entry.homepage,n=xn(v);e===`install-user`?xe(v,`user`):e===`install-project`?xe(v,`project`):e===`install-local`?xe(v,`local`):e===`homepage`&&t?Ae(t):e===`github`&&n?Ae(`https://github.com/${n}`):e===`back`&&(g(`plugin-list`),b(null))}},{context:`Select`,isActive:m===`plugin-details`&&!!v}),typeof m==`object`&&m.type===`plugin-options`){let{plugin:e,pluginId:t}=m;function n(e){r(e),o&&o(),i({type:`menu`})}return(0,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(ne)return(0,q.jsx)(d,{children:`Loading…`});if(e)return(0,q.jsx)(d,{color:`error`,children:e});if(m===`plugin-details`&&v){let e=v.entry.homepage,t=Sn(e,xn(v));return(0,q.jsxs)(u,{flexDirection:`column`,children:[(0,q.jsx)(u,{marginBottom:1,children:(0,q.jsx)(d,{bold:!0,children:`Plugin details`})}),(0,q.jsxs)(u,{flexDirection:`column`,marginBottom:1,children:[(0,q.jsx)(d,{bold:!0,children:v.entry.name}),(0,q.jsxs)(d,{dimColor:!0,children:[`from `,v.marketplaceName]}),v.entry.version&&(0,q.jsxs)(d,{dimColor:!0,children:[`Version: `,v.entry.version]}),v.entry.description&&(0,q.jsx)(u,{marginTop:1,children:(0,q.jsx)(d,{children:v.entry.description})}),v.entry.author&&(0,q.jsx)(u,{marginTop:1,children:(0,q.jsxs)(d,{dimColor:!0,children:[`By:`,` `,typeof v.entry.author==`string`?v.entry.author:v.entry.author.name]})})]}),(0,q.jsx)(vn,{}),he&&(0,q.jsx)(u,{marginBottom:1,children:(0,q.jsxs)(d,{color:`error`,children:[`Error: `,he]})}),(0,q.jsx)(u,{flexDirection:`column`,children:t.map((e,t)=>(0,q.jsxs)(u,{children:[de===t&&(0,q.jsx)(d,{children:`> `}),de!==t&&(0,q.jsx)(d,{children:` `}),(0,q.jsx)(d,{bold:de===t,children:pe&&e.action.startsWith(`install-`)?`Installing…`:e.label})]},e.action))}),(0,q.jsx)(u,{marginTop:1,children:(0,q.jsx)(d,{dimColor:!0,children:(0,q.jsxs)(f,{children:[(0,q.jsx)(V,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`select`}),(0,q.jsx)(V,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]})})})]})}if(x.length===0)return(0,q.jsxs)(u,{flexDirection:`column`,children:[(0,q.jsx)(u,{marginBottom:1,children:(0,q.jsx)(d,{bold:!0,children:`Discover plugins`})}),(0,q.jsx)(Fn,{reason:_e}),(0,q.jsx)(u,{marginTop:1,children:(0,q.jsx)(d,{dimColor:!0,italic:!0,children:`Esc to go back`})})]});let Se=I.getVisibleItems(N);return(0,q.jsxs)(u,{flexDirection:`column`,children:[(0,q.jsxs)(u,{children:[(0,q.jsx)(d,{bold:!0,children:`Discover plugins`}),I.needsPagination&&(0,q.jsxs)(d,{dimColor:!0,children:[` `,`(`,I.scrollPosition.current,`/`,I.scrollPosition.total,`)`]})]}),(0,q.jsx)(u,{marginBottom:1,children:(0,q.jsx)(_,{query:A,isFocused:D,isTerminalFocused:j,width:M-4,cursorOffset:ie})}),R&&(0,q.jsx)(u,{marginBottom:1,children:(0,q.jsxs)(d,{color:`warning`,children:[a.warning,` `,R]})}),N.length===0&&A&&(0,q.jsx)(u,{marginBottom:1,children:(0,q.jsxs)(d,{dimColor:!0,children:[`No plugins match "`,A,`"`]})}),I.scrollPosition.canScrollUp&&(0,q.jsx)(u,{children:(0,q.jsxs)(d,{dimColor:!0,children:[` `,a.arrowUp,` more above`]})}),Se.map((t,n)=>{let r=I.toActualIndex(n),i=P===r,o=se.has(t.pluginId),s=le.has(t.pluginId);return(0,q.jsxs)(u,{flexDirection:`column`,marginBottom:n===Se.length-1&&!e?0:1,children:[(0,q.jsxs)(u,{children:[(0,q.jsxs)(d,{color:i&&!D?`suggestion`:void 0,children:[i&&!D?a.pointer:` `,` `]}),(0,q.jsxs)(d,{children:[s?a.ellipsis:o?a.radioOn:a.radioOff,` `,t.entry.name,(0,q.jsxs)(d,{dimColor:!0,children:[` · `,t.marketplaceName]}),t.entry.tags?.includes(`community-managed`)&&(0,q.jsx)(d,{dimColor:!0,children:` [Community Managed]`}),C&&t.marketplaceName===`claude-plugins-official`&&(0,q.jsxs)(d,{dimColor:!0,children:[` · `,Mt(C.get(t.pluginId)??0),` installs`]})]})]}),t.entry.description&&(0,q.jsx)(u,{marginLeft:4,children:(0,q.jsx)(d,{dimColor:!0,children:gt(t.entry.description,60)})})]},`${I.startIndex}-${t.pluginId}`)}),I.scrollPosition.canScrollDown&&(0,q.jsx)(u,{children:(0,q.jsxs)(d,{dimColor:!0,children:[` `,a.arrowDown,` more below`]})}),e&&(0,q.jsx)(u,{marginTop:1,children:(0,q.jsxs)(d,{color:`error`,children:[a.cross,` `,e]})}),(0,q.jsx)(Pn,{hasSelection:se.size>0,canToggle:P<N.length&&!N[P]?.isInstalled})]})}function Pn({hasSelection:e,canToggle:t}){return(0,q.jsx)(u,{marginTop:1,children:(0,q.jsx)(d,{dimColor:!0,italic:!0,children:(0,q.jsxs)(f,{children:[e&&(0,q.jsx)(V,{action:`plugin:install`,context:`Plugin`,fallback:`i`,description:`install`,bold:!0}),(0,q.jsx)(d,{children:`type to search`}),t&&(0,q.jsx)(V,{action:`plugin:toggle`,context:`Plugin`,fallback:`Space`,description:`toggle`}),(0,q.jsx)(V,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`details`}),(0,q.jsx)(V,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]})})})}function Fn({reason:e}){switch(e){case`git-not-installed`:return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(d,{dimColor:!0,children:`Git is required to install marketplaces.`}),(0,q.jsx)(d,{dimColor:!0,children:`Please install git and restart Work Mate.`})]});case`all-blocked-by-policy`:return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(d,{dimColor:!0,children:`Your organization policy does not allow any external marketplaces.`}),(0,q.jsx)(d,{dimColor:!0,children:`Contact your administrator.`})]});case`policy-restricts-sources`:return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(d,{dimColor:!0,children:`Your organization restricts which marketplaces can be added.`}),(0,q.jsx)(d,{dimColor:!0,children:`Switch to the Marketplaces tab to view allowed sources.`})]});case`all-marketplaces-failed`:return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(d,{dimColor:!0,children:`Failed to load marketplace data.`}),(0,q.jsx)(d,{dimColor:!0,children:`Check your network connection.`})]});case`all-plugins-installed`:return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(d,{dimColor:!0,children:`All available plugins are already installed.`}),(0,q.jsx)(d,{dimColor:!0,children:`Check for new plugins later or add more marketplaces.`})]});default:return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(d,{dimColor:!0,children:`No plugins available.`}),(0,q.jsx)(d,{dimColor:!0,children:`Add a marketplace first using the Marketplaces tab.`})]})}}var In,K,q,Ln=e((()=>{i(),In=t(m(),1),K=t(m(),1),k(),Ut(),x(),Gt(),Ke(),j(),nt(),_e(),Qe(),et(),Ue(),kt(),T(),qe(),Fe(),z(),re(),N(),_t(),ht(),_n(),bn(),Tn(),kn(),q=S()}));function Rn({setViewState:e,error:t,setError:n,setResult:r,exitState:i,onManageComplete:o,targetMarketplace:s,action:l}){let[p,m]=(0,Bn.useState)([]),[g,_]=(0,Bn.useState)(!0),[v,y]=(0,Bn.useState)(0),[b,x]=(0,Bn.useState)(!1),[te,ne]=(0,Bn.useState)(null),[S,C]=(0,Bn.useState)(null),[w,T]=(0,Bn.useState)(null),[D,O]=(0,Bn.useState)(`list`),[k,A]=(0,Bn.useState)(null),[re,ae]=(0,Bn.useState)(0),j=(0,Bn.useRef)(!1);(0,Bn.useEffect)(()=>{async function e(){try{let e=await Ee(),{enabled:r,disabled:i}=await ie(),a=[...r,...i],{marketplaces:o,failures:c}=await Ge(e),u=[];for(let{name:e,config:t,data:n}of o){let r=a.filter(t=>t.source.endsWith(`@${e}`));u.push({name:e,source:le(t.source),lastUpdated:t.lastUpdated,pluginCount:n?.plugins.length,installedPlugins:r,pendingUpdate:!1,pendingRemove:!1,autoUpdate:ct(e,t)})}u.sort((e,t)=>e.name===`claude-plugin-directory`?-1:t.name===`claude-plugin-directory`?1:e.name.localeCompare(t.name)),m(u);let d=ve(c,tt(o,e=>e.data!==null));if(d)if(d.type===`warning`)ne(d.message);else throw Error(d.message);if(s&&!j.current&&!t){j.current=!0;let e=u.findIndex(e=>e.name===s);if(e>=0){let t=u[e];if(l){y(e+1);let t=[...u];l===`update`?t[e].pendingUpdate=!0:l===`remove`&&(t[e].pendingRemove=!0),m(t),setTimeout(oe,100,t)}else t&&(y(e+1),A(t),O(`details`))}else n&&n(`Marketplace not found: ${s}`)}}catch(e){n&&n(e instanceof Error?e.message:`Failed to load marketplaces`),ne(e instanceof Error?e.message:`Failed to load marketplaces`)}finally{_(!1)}}e()},[s,l,t]);let M=()=>p.some(e=>e.pendingUpdate||e.pendingRemove),N=()=>({updateCount:tt(p,e=>e.pendingUpdate),removeCount:tt(p,e=>e.pendingRemove)}),oe=async t=>{let i=t||p,s=D===`details`;x(!0),ne(null),C(null),T(null);try{let t=rt(`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=ke(t.name,e.name);n[r]=!1}st(`userSettings`,{enabledPlugins:n})}await Ne(e.name),c++,mt(`tengu_marketplace_removed`,{marketplace_name:e.name,plugins_uninstalled:e.installedPlugins?.length||0});continue}e.pendingUpdate&&(await I(e.name,e=>{T(e)}),n++,l.add(e.name.toLowerCase()),mt(`tengu_marketplace_updated`,{marketplace_name:e.name}))}let u=0;l.size>0&&(u=(await en(l)).length),E(),o&&await o();let d=await Ee(),{enabled:f,disabled:ee}=await ie(),p=[...f,...ee],{marketplaces:h}=await Ge(d),g=[];for(let{name:e,config:t,data:n}of h){let r=p.filter(t=>t.source.endsWith(`@${e}`));g.push({name:e,source:le(t.source),lastUpdated:t.lastUpdated,pluginCount:n?.plugins.length,installedPlugins:r,pendingUpdate:!1,pendingRemove:!1,autoUpdate:ct(e,t)})}if(g.sort((e,t)=>e.name===`claude-plugin-directory`?-1:t.name===`claude-plugin-directory`?1:e.name.localeCompare(t.name)),m(g),s&&k){let e=g.find(e=>e.name===k.name);e&&A(e)}let _=[];if(n>0){let e=u>0?` (${u} ${H(u,`plugin`)} bumped)`:``;_.push(`Updated ${n} ${H(n,`marketplace`)}${e}`)}if(c>0&&_.push(`Removed ${c} ${H(c,`marketplace`)}`),_.length>0){let t=`${a.tick} ${_.join(`, `)}`;s?C(t):(r(t),setTimeout(e,2e3,{type:`menu`}))}else s||e({type:`menu`})}catch(e){let t=Ye(e);ne(t),n&&n(t)}finally{x(!1),T(null)}},P=async()=>{if(!k)return;let e=p.map(e=>e.name===k.name?{...e,pendingRemove:!0}:e);m(e),await oe(e)},F=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 ut()||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 Le(e.name,t),m(n=>n.map(n=>n.name===e.name?{...n,autoUpdate:t}:n)),A(e=>e&&{...e,autoUpdate:t})}catch(e){ne(e instanceof Error?e.message:`Failed to update setting`)}};if(ee(`confirm:no`,()=>{O(`list`),ae(0)},{context:`Confirmation`,isActive:!b&&(D===`details`||D===`confirm-remove`)}),ee(`confirm:no`,()=>{m(e=>e.map(e=>({...e,pendingUpdate:!1,pendingRemove:!1}))),y(0)},{context:`Confirmation`,isActive:!b&&D===`list`&&M()}),ee(`confirm:no`,()=>{e({type:`menu`})},{context:`Confirmation`,isActive:!b&&D===`list`&&!M()}),c({"select:previous":()=>y(e=>Math.max(0,e-1)),"select:next":()=>{let e=p.length+1;y(t=>Math.min(e-1,t+1))},"select:accept":()=>{let t=v-1;if(v===0)e({type:`add-marketplace`});else if(M())oe();else{let e=p[t];e&&(A(e),O(`details`),ae(0))}}},{context:`Select`,isActive:!b&&D===`list`}),h(e=>{let t=v-1;if((e===`u`||e===`U`)&&t>=0)m(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=p[t];e&&(A(e),O(`confirm-remove`))}},{isActive:!b&&D===`list`}),c({"select:previous":()=>ae(e=>Math.max(0,e-1)),"select:next":()=>{let e=F(k);ae(t=>Math.min(e.length-1,t+1))},"select:accept":()=>{if(!k)return;let t=F(k)[re];if(t?.value===`browse`)e({type:`browse-marketplace`,targetMarketplace:k.name});else if(t?.value===`update`){let e=p.map(e=>e.name===k.name?{...e,pendingUpdate:!0}:e);m(e),oe(e)}else t?.value===`toggle-auto-update`?se(k):t?.value===`remove`&&O(`confirm-remove`)}},{context:`Select`,isActive:!b&&D===`details`}),h(e=>{e===`y`||e===`Y`?P():(e===`n`||e===`N`)&&(O(`list`),A(null))},{isActive:!b&&D===`confirm-remove`}),g)return(0,J.jsx)(d,{children:`Loading marketplaces…`});if(p.length===0)return(0,J.jsxs)(u,{flexDirection:`column`,children:[(0,J.jsx)(u,{marginBottom:1,children:(0,J.jsx)(d,{bold:!0,children:`Manage marketplaces`})}),(0,J.jsxs)(u,{flexDirection:`row`,gap:1,children:[(0,J.jsxs)(d,{color:`suggestion`,children:[a.pointer,` +`]}),(0,J.jsx)(d,{bold:!0,color:`suggestion`,children:`Add Marketplace`})]}),(0,J.jsx)(u,{marginLeft:3,children:(0,J.jsx)(d,{dimColor:!0,italic:!0,children:i.pending?(0,J.jsxs)(J.Fragment,{children:[`Press `,i.keyName,` again to go back`]}):(0,J.jsxs)(f,{children:[(0,J.jsx)(V,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`select`}),(0,J.jsx)(V,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`})]})})})]});if(D===`confirm-remove`&&k){let e=k.installedPlugins?.length||0;return(0,J.jsxs)(u,{flexDirection:`column`,children:[(0,J.jsxs)(d,{bold:!0,color:`warning`,children:[`Remove marketplace `,(0,J.jsx)(d,{italic:!0,children:k.name}),`?`]}),(0,J.jsxs)(u,{flexDirection:`column`,children:[e>0&&(0,J.jsx)(u,{marginTop:1,children:(0,J.jsxs)(d,{color:`warning`,children:[`This will also uninstall `,e,` `,H(e,`plugin`),` from this marketplace:`]})}),k.installedPlugins&&k.installedPlugins.length>0&&(0,J.jsx)(u,{flexDirection:`column`,marginTop:1,marginLeft:2,children:k.installedPlugins.map(e=>(0,J.jsxs)(d,{dimColor:!0,children:[`• `,e.name]},e.name))}),(0,J.jsx)(u,{marginTop:1,children:(0,J.jsxs)(d,{children:[`Press `,(0,J.jsx)(d,{bold:!0,children:`y`}),` to confirm or `,(0,J.jsx)(d,{bold:!0,children:`n`}),` to cancel`]})})]})]})}if(D===`details`&&k){let e=k.pendingUpdate||b,t=F(k);return(0,J.jsxs)(u,{flexDirection:`column`,children:[(0,J.jsx)(d,{bold:!0,children:k.name}),(0,J.jsx)(d,{dimColor:!0,children:k.source}),(0,J.jsx)(u,{marginTop:1,children:(0,J.jsxs)(d,{children:[k.pluginCount||0,` available `,H(k.pluginCount||0,`plugin`)]})}),k.installedPlugins&&k.installedPlugins.length>0&&(0,J.jsxs)(u,{flexDirection:`column`,marginTop:1,children:[(0,J.jsxs)(d,{bold:!0,children:[`Installed plugins (`,k.installedPlugins.length,`):`]}),(0,J.jsx)(u,{flexDirection:`column`,marginLeft:1,children:k.installedPlugins.map(e=>(0,J.jsxs)(u,{flexDirection:`row`,gap:1,children:[(0,J.jsx)(d,{children:a.bullet}),(0,J.jsxs)(u,{flexDirection:`column`,children:[(0,J.jsx)(d,{children:e.name}),(0,J.jsx)(d,{dimColor:!0,children:e.manifest.description})]})]},e.name))})]}),e&&(0,J.jsxs)(u,{marginTop:1,flexDirection:`column`,children:[(0,J.jsx)(d,{color:`claude`,children:`Updating marketplace…`}),w&&(0,J.jsx)(d,{dimColor:!0,children:w})]}),!e&&S&&(0,J.jsx)(u,{marginTop:1,children:(0,J.jsx)(d,{color:`claude`,children:S})}),!e&&te&&(0,J.jsx)(u,{marginTop:1,children:(0,J.jsx)(d,{color:`error`,children:te})}),!e&&(0,J.jsx)(u,{flexDirection:`column`,marginTop:1,children:t.map((e,t)=>{if(!e)return null;let n=t===re;return(0,J.jsxs)(u,{children:[(0,J.jsxs)(d,{color:n?`suggestion`:void 0,children:[n?a.pointer:` `,` `,e.label]}),e.secondaryLabel&&(0,J.jsxs)(d,{dimColor:!0,children:[` `,e.secondaryLabel]})]},e.value)})}),!e&&!ut()&&k.autoUpdate&&(0,J.jsx)(u,{marginTop:1,children:(0,J.jsx)(d,{dimColor:!0,children:`Auto-update enabled. Work Mate will automatically update this marketplace and its installed plugins.`})}),(0,J.jsx)(u,{marginLeft:3,children:(0,J.jsx)(d,{dimColor:!0,italic:!0,children:e?(0,J.jsx)(J.Fragment,{children:`Please wait…`}):(0,J.jsxs)(f,{children:[(0,J.jsx)(V,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`select`}),(0,J.jsx)(V,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`})]})})})]})}let{updateCount:ce,removeCount:ue}=N();return(0,J.jsxs)(u,{flexDirection:`column`,children:[(0,J.jsx)(u,{marginBottom:1,children:(0,J.jsx)(d,{bold:!0,children:`Manage marketplaces`})}),(0,J.jsxs)(u,{flexDirection:`row`,gap:1,marginBottom:1,children:[(0,J.jsxs)(d,{color:v===0?`suggestion`:void 0,children:[v===0?a.pointer:` `,` +`]}),(0,J.jsx)(d,{bold:!0,color:v===0?`suggestion`:void 0,children:`Add Marketplace`})]}),(0,J.jsx)(u,{flexDirection:`column`,children:p.map((e,t)=>{let n=t+1===v,r=[];return e.pendingUpdate&&r.push(`UPDATE`),e.pendingRemove&&r.push(`REMOVE`),(0,J.jsxs)(u,{flexDirection:`row`,gap:1,marginBottom:1,children:[(0,J.jsxs)(d,{color:n?`suggestion`:void 0,children:[n?a.pointer:` `,` `,e.pendingRemove?a.cross:a.bullet]}),(0,J.jsxs)(u,{flexDirection:`column`,flexGrow:1,children:[(0,J.jsxs)(u,{flexDirection:`row`,gap:1,children:[(0,J.jsxs)(d,{bold:!0,strikethrough:e.pendingRemove,dimColor:e.pendingRemove,children:[e.name===`claude-plugins-official`&&(0,J.jsx)(d,{color:`claude`,children:`✻ `}),e.name,e.name===`claude-plugins-official`&&(0,J.jsx)(d,{color:`claude`,children:` ✻`})]}),r.length>0&&(0,J.jsxs)(d,{color:`warning`,children:[`[`,r.join(`, `),`]`]})]}),(0,J.jsx)(d,{dimColor:!0,children:e.source}),(0,J.jsxs)(d,{dimColor:!0,children:[e.pluginCount!==void 0&&(0,J.jsxs)(J.Fragment,{children:[e.pluginCount,` available`]}),e.installedPlugins&&e.installedPlugins.length>0&&(0,J.jsxs)(J.Fragment,{children:[` • `,e.installedPlugins.length,` installed`]}),e.lastUpdated&&(0,J.jsxs)(J.Fragment,{children:[` • Updated `,new Date(e.lastUpdated).toLocaleDateString()]})]})]})]},e.name)})}),M()&&(0,J.jsxs)(u,{marginTop:1,flexDirection:`column`,children:[(0,J.jsxs)(d,{children:[(0,J.jsx)(d,{bold:!0,children:`Pending changes:`}),` `,(0,J.jsx)(d,{dimColor:!0,children:`Enter to apply`})]}),ce>0&&(0,J.jsxs)(d,{children:[`• Update `,ce,` `,H(ce,`marketplace`)]}),ue>0&&(0,J.jsxs)(d,{color:`warning`,children:[`• Remove `,ue,` `,H(ue,`marketplace`)]})]}),b&&(0,J.jsx)(u,{marginTop:1,children:(0,J.jsx)(d,{color:`claude`,children:`Processing changes…`})}),te&&(0,J.jsx)(u,{marginTop:1,children:(0,J.jsx)(d,{color:`error`,children:te})}),(0,J.jsx)(zn,{exitState:i,hasPendingActions:M()})]})}function zn({exitState:e,hasPendingActions:t}){return e.pending?(0,J.jsx)(u,{marginTop:1,children:(0,J.jsxs)(d,{dimColor:!0,italic:!0,children:[`Press `,e.keyName,` again to go back`]})}):(0,J.jsx)(u,{marginTop:1,children:(0,J.jsx)(d,{dimColor:!0,italic:!0,children:(0,J.jsxs)(f,{children:[t&&(0,J.jsx)(V,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`apply changes`}),!t&&(0,J.jsx)(V,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`select`}),!t&&(0,J.jsx)(o,{shortcut:`u`,action:`update`}),!t&&(0,J.jsx)(o,{shortcut:`r`,action:`remove`}),(0,J.jsx)(V,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:t?`cancel`:`go back`})]})})})}var Bn,J,Vn=e((()=>{i(),m(),Bn=t(m(),1),pt(),k(),x(),j(),nt(),lt(),et(),Ue(),qe(),Fe(),tn(),O(),ot(),at(),_t(),J=S()}));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 se(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((()=>{ze()}));function Gn({item:e,isSelected:t}){let[n]=l();if(e.type===`plugin`){let r,i;return e.pendingToggle?(r=g(`suggestion`,n)(a.arrowRight),i=e.pendingToggle===`will-enable`?`will enable`:`will disable`):e.errorCount>0?(r=g(`error`,n)(a.cross),i=`${e.errorCount} ${H(e.errorCount,`error`)}`):e.isEnabled?(r=g(`success`,n)(a.tick),i=`enabled`):(r=g(`inactive`,n)(a.radioOff),i=`disabled`),(0,Y.jsxs)(u,{children:[(0,Y.jsx)(d,{color:t?`suggestion`:void 0,children:t?`${a.pointer} `:` `}),(0,Y.jsx)(d,{color:t?`suggestion`:void 0,children:e.name}),(0,Y.jsxs)(d,{dimColor:!t,children:[` `,(0,Y.jsx)(d,{backgroundColor:`userMessageBackground`,children:`Plugin`})]}),(0,Y.jsxs)(d,{dimColor:!0,children:[` · `,e.marketplace]}),(0,Y.jsxs)(d,{dimColor:!t,children:[` · `,r,` `]}),(0,Y.jsx)(d,{dimColor:!t,children:i})]})}if(e.type===`flagged-plugin`){let r=g(`warning`,n)(a.warning);return(0,Y.jsxs)(u,{children:[(0,Y.jsx)(d,{color:t?`suggestion`:void 0,children:t?`${a.pointer} `:` `}),(0,Y.jsx)(d,{color:t?`suggestion`:void 0,children:e.name}),(0,Y.jsxs)(d,{dimColor:!t,children:[` `,(0,Y.jsx)(d,{backgroundColor:`userMessageBackground`,children:`Plugin`})]}),(0,Y.jsxs)(d,{dimColor:!0,children:[` · `,e.marketplace]}),(0,Y.jsxs)(d,{dimColor:!t,children:[` · `,r,` `]}),(0,Y.jsx)(d,{dimColor:!t,children:`removed`})]})}if(e.type===`failed-plugin`){let r=g(`error`,n)(a.cross),i=`failed to load · ${e.errorCount} ${H(e.errorCount,`error`)}`;return(0,Y.jsxs)(u,{children:[(0,Y.jsx)(d,{color:t?`suggestion`:void 0,children:t?`${a.pointer} `:` `}),(0,Y.jsx)(d,{color:t?`suggestion`:void 0,children:e.name}),(0,Y.jsxs)(d,{dimColor:!t,children:[` `,(0,Y.jsx)(d,{backgroundColor:`userMessageBackground`,children:`Plugin`})]}),(0,Y.jsxs)(d,{dimColor:!0,children:[` · `,e.marketplace]}),(0,Y.jsxs)(d,{dimColor:!t,children:[` · `,r,` `]}),(0,Y.jsx)(d,{dimColor:!t,children:i})]})}let r,i;return e.status===`connected`?(r=g(`success`,n)(a.tick),i=`connected`):e.status===`disabled`?(r=g(`inactive`,n)(a.radioOff),i=`disabled`):e.status===`pending`?(r=g(`inactive`,n)(a.radioOff),i=`connecting…`):e.status===`needs-auth`?(r=g(`warning`,n)(a.triangleUpOutline),i=`Enter to auth`):(r=g(`error`,n)(a.cross),i=`failed`),e.indented?(0,Y.jsxs)(u,{children:[(0,Y.jsx)(d,{color:t?`suggestion`:void 0,children:t?`${a.pointer} `:` `}),(0,Y.jsx)(d,{dimColor:!t,children:`└ `}),(0,Y.jsx)(d,{color:t?`suggestion`:void 0,children:e.name}),(0,Y.jsxs)(d,{dimColor:!t,children:[` `,(0,Y.jsx)(d,{backgroundColor:`userMessageBackground`,children:`MCP`})]}),(0,Y.jsxs)(d,{dimColor:!t,children:[` · `,r,` `]}),(0,Y.jsx)(d,{dimColor:!t,children:i})]}):(0,Y.jsxs)(u,{children:[(0,Y.jsx)(d,{color:t?`suggestion`:void 0,children:t?`${a.pointer} `:` `}),(0,Y.jsx)(d,{color:t?`suggestion`:void 0,children:e.name}),(0,Y.jsxs)(d,{dimColor:!t,children:[` `,(0,Y.jsx)(d,{backgroundColor:`userMessageBackground`,children:`MCP`})]}),(0,Y.jsxs)(d,{dimColor:!t,children:[` · `,r,` `]}),(0,Y.jsx)(d,{dimColor:!t,children:i})]})}var Y,Kn=e((()=>{i(),m(),x(),_t(),Y=S()}));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 $e(`Failed to read plugin components from ${e}: ${Ye(t)}`,{level:`error`}),ft(Ze(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 $e(`Failed to read skill directories from ${e}: ${Ye(t)}`,{level:`error`}),ft(Ze(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=we(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 M(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)(u,{flexDirection:`column`,marginBottom:1,children:[(0,Z.jsx)(d,{bold:!0,children:`Components:`}),(0,Z.jsxs)(d,{dimColor:!0,children:[`Error: `,o]})]}):!n||!(n.commands||n.agents||n.skills||n.hooks||n.mcpServers)?null:(0,Z.jsxs)(u,{flexDirection:`column`,marginBottom:1,children:[(0,Z.jsx)(d,{bold:!0,children:`Installed components:`}),n.commands?(0,Z.jsxs)(d,{dimColor:!0,children:[`• Commands:`,` `,typeof n.commands==`string`?n.commands:Array.isArray(n.commands)?n.commands.join(`, `):Object.keys(n.commands).join(`, `)]}):null,n.agents?(0,Z.jsxs)(d,{dimColor:!0,children:[`• Agents:`,` `,typeof n.agents==`string`?n.agents:Array.isArray(n.agents)?n.agents.join(`, `):Object.keys(n.agents).join(`, `)]}):null,n.skills?(0,Z.jsxs)(d,{dimColor:!0,children:[`• Skills:`,` `,typeof n.skills==`string`?n.skills:Array.isArray(n.skills)?n.skills.join(`, `):Object.keys(n.skills).join(`, `)]}):null,n.hooks?(0,Z.jsxs)(d,{dimColor:!0,children:[`• Hooks:`,` `,typeof n.hooks==`string`?n.hooks:Array.isArray(n.hooks)?n.hooks.map(String).join(`, `):typeof n.hooks==`object`&&n.hooks!==null?Object.keys(n.hooks).join(`, `):String(n.hooks)]}):null,n.mcpServers?(0,Z.jsxs)(d,{dimColor:!0,children:[`• MCP Servers:`,` `,typeof n.mcpServers==`string`?n.mcpServers:Array.isArray(n.mcpServers)?n.mcpServers.map(String).join(`, `):typeof n.mcpServers==`object`&&n.mcpServers!==null?Object.keys(n.mcpServers).join(`, `):String(n.mcpServers)]}):null]})}async function Xn(e,t){let n=(await M(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!w(`${e.name}@${t}`)})}function Qn({setViewState:e,setResult:t,onManageComplete:n,onSearchModeChange:r,targetPlugin:i,targetMarketplace:o,action:s}){let l=Ve(e=>e.mcp.clients),m=Ve(e=>e.mcp.tools),g=Ve(e=>e.plugins.errors),v=It(),[b,x]=(0,X.useState)(!1),te=(0,X.useCallback)(e=>{x(e),r?.(e)},[r]),ne=p(),{columns:S}=y(),[C,w]=(0,X.useState)(`plugin-list`),{query:T,setQuery:D,cursorOffset:O}=Wt({isActive:C===`plugin-list`&&b,onExit:()=>{te(!1)}}),[k,re]=(0,X.useState)(null),[ae,j]=(0,X.useState)([]),[M,N]=(0,X.useState)([]),[oe,P]=(0,X.useState)(!0),[F,se]=(0,X.useState)(new Map),le=(0,X.useRef)(!1),ue=(0,X.useRef)(void 0),I=zt();ee(`confirm:no`,$n.useCallback(()=>{if(C===`plugin-details`)w(`plugin-list`),re(null),B(null);else if(typeof C==`object`&&C.type===`failed-plugin-details`)w(`plugin-list`),B(null);else if(C===`configuring`)w(`plugin-details`),Ce(null);else if(typeof C==`object`&&(C.type===`plugin-options`||C.type===`configuring-options`))w(`plugin-list`),re(null),t(`Plugin enabled. Configuration skipped — run /reload-plugins to apply.`),n&&n();else if(typeof C==`object`&&C.type===`flagged-detail`)w(`plugin-list`),B(null);else if(typeof C==`object`&&C.type===`mcp-detail`)w(`plugin-list`),B(null);else if(typeof C==`object`&&C.type===`mcp-tools`)w({type:`mcp-detail`,client:C.client});else if(typeof C==`object`&&C.type===`mcp-tool-detail`)w({type:`mcp-tools`,client:C.client});else{if(F.size>0){t(`Run /reload-plugins to apply plugin changes.`);return}e({type:`menu`})}},[C,e,F,t]),{context:`Confirmation`,isActive:(C!==`plugin-list`||!b)&&C!==`confirm-project-uninstall`&&!(typeof C==`object`&&C.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=it(),t=new Map;for(let e of l)if(e.name.startsWith(`plugin:`)){let n=e.name.split(`:`);if(n.length>=3){let r=n[1],i=n.slice(2).join(`:`),a=t.get(r)||[];a.push({displayName:i,client:e}),t.set(r,a)}}let n=[];for(let r of M){let i=`${r.plugin.name}@${r.marketplace}`,a=e?.enabledPlugins?.[i]!==!1,o=g.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:F.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 g){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 v)continue;let n=Ie(e),r=n.name||e,i=n.marketplace||`unknown`,a=o.get(e),c=a===`flag`||a===void 0?`user`:a;s.push({type:`failed-plugin`,id:e,name:r,marketplace:i,scope:c,errorCount:t.length,errors:t})}let c=[];for(let e of l)e.name!==`ide`&&(e.name.startsWith(`plugin:`)||c.push({type:`mcp`,id:`mcp:${e.name}`,name:e.name,description:void 0,scope:e.config.scope,status:fe(e),client:e}));let u={flagged:-1,project:0,local:1,user:2,enterprise:3,managed:4,dynamic:5,builtin:6},d=[],f=new Map;for(let{item:e,originalScope:t,childMcps:r}of n){let n=e.scope;f.has(n)||f.set(n,[]),f.get(n).push(e);for(let{displayName:e,client:n}of r){let r=t===`builtin`?`user`:t;f.has(r)||f.set(r,[]),f.get(r).push({type:`mcp`,id:`mcp:${n.name}`,name:e,description:void 0,scope:r,status: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(v)){let n=Ie(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 ee=[...f.keys()].sort((e,t)=>(u[e]??99)-(u[t]??99));for(let e of ee){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,l,g,F,v]),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 L=(0,X.useMemo)(()=>{if(!T)return pe;let e=T.toLowerCase();return pe.filter(t=>t.name.toLowerCase().includes(e)||`description`in t&&t.description?.toLowerCase().includes(e))},[pe,T]),[R,ge]=(0,X.useState)(0),_e=En({totalItems:L.length,selectedIndex:R,maxVisible:8}),[ve,ye]=(0,X.useState)(0),[be,z]=(0,X.useState)(!1),[xe,B]=(0,X.useState)(null),[Se,Ce]=(0,X.useState)(null),[we,Te]=(0,X.useState)(!1),[Ee,Oe]=(0,X.useState)(!1);(0,X.useEffect)(()=>{if(!k){Oe(!1);return}async function e(){let e=k.plugin.manifest.mcpServers,t=!1;if(e&&(t=typeof e==`string`&&he(e)||Array.isArray(e)&&e.some(e=>typeof e==`string`&&he(e))),!t)try{let e=nn.join(k.plugin.path,`..`),n=nn.join(e,`.claude-plugin`,`marketplace.json`),r=Je(await rn.readFile(n,`utf-8`)).plugins?.find(e=>e.name===k.plugin.name);if(r?.mcpServers){let e=r.mcpServers;t=typeof e==`string`&&he(e)||Array.isArray(e)&&e.some(e=>typeof e==`string`&&he(e))}}catch(e){$e(`Failed to read raw marketplace.json: ${e}`)}Oe(t)}e()},[k]),(0,X.useEffect)(()=>{async function e(){P(!0);try{let{enabled:e,disabled:t}=await ie(),n=it(),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=tt(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)),j(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{P(!1)}}e()},[]),(0,X.useEffect)(()=>{if(!le.current&&i&&ae.length>0&&!oe){let{name:e,marketplace:n}=Ie(i),r=o??n,a=r?ae.filter(e=>e.name===r):ae;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};re(r),w(`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`&&(w({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,ae,oe,pe,s,t]);let ke=async r=>{if(!k)return;let i=k.scope||`user`,a=i===`builtin`;if(a&&(r===`update`||r===`uninstall`)){B(`Built-in plugins cannot be updated or uninstalled.`);return}if(!a&&!wt(i)&&r!==`update`){B(`This plugin is managed by your organization. Contact your admin to disable it.`);return}z(!0),B(null);try{let o=`${k.plugin.name}@${k.marketplace}`,s;switch(r){case`enable`:{let e=await 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)){z(!1),w(`confirm-project-uninstall`);return}let e=A().plugins[o],t=!e||e.length<=1?await ce(o):null;if(t){z(!1),w({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(`${k.plugin.name} is already at the latest version (${r.newVersion}).`),n&&await n(),e({type:`menu`});return}break}}E();let c=`${k.plugin.name}@${k.marketplace}`;if(it()?.enabledPlugins?.[c]!==!1){z(!1),w({type:`plugin-options`});return}let l=r===`enable`?`Enabled`:r===`disable`?`Disabled`:r===`update`?`Updated`:`Uninstalled`,u=s&&s.length>0?` · required by ${s.join(`, `)}`:``;t(`✓ ${l} ${k.plugin.name}${u}. Run /reload-plugins to apply.`),n&&await n(),e({type:`menu`})}catch(e){z(!1);let t=e instanceof Error?e.message:String(e);B(`Failed to ${r}: ${t}`),ft(Ze(e))}},je=(0,X.useRef)(ke);je.current=ke,(0,X.useEffect)(()=>{if(C===`plugin-details`&&k&&ue.current){let e=ue.current;ue.current=void 0,je.current(e)}},[C,k]);let Me=$n.useCallback(()=>{if(R>=L.length)return;let e=L[R];if(e?.type!==`flagged-plugin`)if(e?.type===`plugin`){let t=`${e.plugin.name}@${e.marketplace}`,n=it(),r=F.get(t),i=n?.enabledPlugins?.[t]!==!1,a=e.scope;if(a===`builtin`||wt(a)){let e=new Map(F);r?(e.delete(t),(async()=>{try{r===`will-disable`?await bt(t):await Ct(t),E()}catch(e){ft(e)}})()):(e.set(t,i?`will-disable`:`will-enable`),(async()=>{try{i?await Ct(t):await bt(t),E()}catch(e){ft(e)}})()),se(e)}}else e?.type===`mcp`&&I(e.client.name)},[R,L,F,M,I]);c({"select:previous":()=>{R===0?te(!0):_e.handleSelectionChange(R-1,ge)},"select:next":()=>{R<L.length-1&&_e.handleSelectionChange(R+1,ge)},"select:accept":$n.useCallback(()=>{if(R>=L.length)return;let e=L[R];if(e?.type===`plugin`){let t=M.find(t=>t.plugin.name===e.plugin.name&&t.marketplace===e.marketplace);t&&(re(t),w(`plugin-details`),ye(0),B(null))}else e?.type===`flagged-plugin`?(w({type:`flagged-detail`,plugin:{id:e.id,name:e.name,marketplace:e.marketplace,reason:e.reason,text:e.text,flaggedAt:e.flaggedAt}}),B(null)):e?.type===`failed-plugin`?(w({type:`failed-plugin-details`,plugin:{id:e.id,name:e.name,marketplace:e.marketplace,errors:e.errors,scope:e.scope}}),ye(0),B(null)):e?.type===`mcp`&&(w({type:`mcp-detail`,client:e.client}),B(null))},[R,L,M])},{context:`Select`,isActive:C===`plugin-list`&&!b}),c({"plugin:toggle":Me},{context:`Plugin`,isActive:C===`plugin-list`&&!b}),c({"select:accept":$n.useCallback(()=>{typeof C!=`object`||C.type!==`flagged-detail`||(Lt(C.plugin.id),w(`plugin-list`))},[C])},{context:`Select`,isActive:typeof C==`object`&&C.type===`flagged-detail`});let Ne=$n.useMemo(()=>{if(C!==`plugin-details`||!k)return[];let e=it(),t=`${k.plugin.name}@${k.marketplace}`,n=e?.enabledPlugins?.[t]!==!1,r=k.marketplace===`builtin`,i=[];return i.push({label:n?`Disable plugin`:`Enable plugin`,action:()=>void ke(n?`disable`:`enable`)}),r||(i.push({label:k.pendingUpdate?`Unmark for update`:`Mark for update`,action:async()=>{try{let e=await Xn(k.plugin.name,k.marketplace);if(e){B(e);return}let t=[...M],n=t.findIndex(e=>e.plugin.name===k.plugin.name&&e.marketplace===k.marketplace);n!==-1&&(t[n].pendingUpdate=!k.pendingUpdate,N(t),re({...k,pendingUpdate:!k.pendingUpdate}))}catch(e){B(e instanceof Error?e.message:`Failed to check plugin update availability`)}}}),Ee&&i.push({label:`Configure`,action:async()=>{Te(!0);try{let e=k.plugin.manifest.mcpServers,t=null;if(typeof e==`string`&&he(e))t=e;else if(Array.isArray(e)){for(let n of e)if(typeof n==`string`&&he(n)){t=n;break}}if(!t){B(`No MCPB file found in plugin`),Te(!1);return}let n=`${k.plugin.name}@${k.marketplace}`,r=await Re(t,k.plugin.path,n,void 0,void 0,!0);`status`in r&&r.status===`needs-config`?(Ce(r),w(`configuring`)):B(`Failed to load MCPB for configuration`)}catch(e){let t=Ye(e);B(`Failed to load configuration: ${t}`)}finally{Te(!1)}}}),k.plugin.manifest.userConfig&&Object.keys(k.plugin.manifest.userConfig).length>0&&i.push({label:`Configure options`,action:()=>{w({type:`configuring-options`,schema:k.plugin.manifest.userConfig})}}),i.push({label:`Update now`,action:()=>void ke(`update`)}),i.push({label:`Uninstall`,action:()=>void ke(`uninstall`)})),k.plugin.manifest.homepage&&i.push({label:`Open homepage`,action:()=>void Ae(k.plugin.manifest.homepage)}),k.plugin.manifest.repository&&i.push({label:`View repository`,action:()=>void Ae(k.plugin.manifest.repository)}),i.push({label:`Back to plugin list`,action:()=>{w(`plugin-list`),re(null),B(null)}}),i},[C,k,Ee,M]);if(c({"select:previous":()=>{ve>0&&ye(ve-1)},"select:next":()=>{ve<Ne.length-1&&ye(ve+1)},"select:accept":()=>{Ne[ve]&&Ne[ve].action()}},{context:`Select`,isActive:C===`plugin-details`&&!!k}),c({"select:accept":()=>{typeof C==`object`&&C.type===`failed-plugin-details`&&(async()=>{z(!0),B(null);let e=C.plugin.id,t=C.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=rt(t);n?.enabledPlugins?.[e]!==void 0&&(st(t,{enabledPlugins:{...n.enabledPlugins,[e]:void 0}}),i=!0)}E()}i?(n&&await n(),z(!1),w(`plugin-list`)):(z(!1),B(r.message))})()}},{context:`Select`,isActive:typeof C==`object`&&C.type===`failed-plugin-details`&&C.plugin.scope!==`managed`}),c({"confirm:yes":()=>{if(!k)return;z(!0),B(null);let r=`${k.plugin.name}@${k.marketplace}`,{error:i}=st(`localSettings`,{enabledPlugins:{...rt(`localSettings`)?.enabledPlugins,[r]:!1}});if(i){z(!1),B(`Failed to write settings: ${i.message}`);return}E(),t(`✓ Disabled ${k.plugin.name} in .claude/settings.local.json. Run /reload-plugins to apply.`),n&&n(),e({type:`menu`})},"confirm:no":()=>{w(`plugin-details`),B(null)}},{context:`Confirmation`,isActive:C===`confirm-project-uninstall`&&!!k&&!be}),h((r,i)=>{if(!k)return;let o=`${k.plugin.name}@${k.marketplace}`,s=k.scope;if(!s||s===`builtin`||!wt(s))return;let c=async r=>{z(!0),B(null);try{let i=await xt(o,s,r);if(!i.success)throw Error(i.message);E();let c=r?``:` · data preserved`;t(`${a.tick} ${i.message}${c}`),n&&n(),e({type:`menu`})}catch(e){z(!1),B(e instanceof Error?e.message:String(e))}};r===`y`||r===`Y`?c(!0):r===`n`||r===`N`?c(!1):i.escape&&(w(`plugin-details`),B(null))},{isActive:typeof C==`object`&&C.type===`confirm-data-cleanup`&&!!k&&!be}),$n.useEffect(()=>{ge(0)},[T]),h((e,t)=>{let n=!t.ctrl&&!t.meta;b||(e===`/`&&n?(te(!0),D(``),ge(0)):n&&e.length>0&&!/^\s+$/.test(e)&&e!==`j`&&e!==`k`&&e!==` `&&(te(!0),D(e),ge(0)))},{isActive:C===`plugin-list`}),oe)return(0,Z.jsx)(d,{children:`Loading installed plugins…`});if(pe.length===0)return(0,Z.jsxs)(u,{flexDirection:`column`,children:[(0,Z.jsx)(u,{marginBottom:1,children:(0,Z.jsx)(d,{bold:!0,children:`Manage plugins`})}),(0,Z.jsx)(d,{children:`No plugins or MCP servers installed.`}),(0,Z.jsx)(u,{marginTop:1,children:(0,Z.jsx)(d,{dimColor:!0,children:`Esc to go back`})})]});if(typeof C==`object`&&C.type===`plugin-options`&&k){let r=`${k.plugin.name}@${k.marketplace}`;function i(r){t(r),n&&n(),e({type:`menu`})}return(0,Z.jsx)(mn,{plugin:k.plugin,pluginId:r,onDone:(e,t)=>{switch(e){case`configured`:i(`✓ Enabled and configured ${k.plugin.name}. Run /reload-plugins to apply.`);break;case`skipped`:i(`✓ Enabled ${k.plugin.name}. Run /reload-plugins to apply.`);break;case`error`:i(`Failed to save configuration: ${t}`);break}}})}if(typeof C==`object`&&C.type===`configuring-options`&&k){let e=`${k.plugin.name}@${k.marketplace}`;return(0,Z.jsx)(ln,{title:`Configure ${k.plugin.name}`,subtitle:`Plugin options`,configSchema:C.schema,initialValues:de(e),onSave:n=>{try{De(e,n,C.schema),E(),t(`Configuration saved. Run /reload-plugins for changes to take effect.`)}catch(e){B(`Failed to save configuration: ${Ye(e)}`)}w(`plugin-details`)},onCancel:()=>w(`plugin-details`)})}if(C===`configuring`&&Se&&k){let e=`${k.plugin.name}@${k.marketplace}`;async function n(n){if(!(!Se||!k))try{let r=k.plugin.manifest.mcpServers,i=null;if(typeof r==`string`&&he(r))i=r;else if(Array.isArray(r)){for(let e of r)if(typeof e==`string`&&he(e)){i=e;break}}if(!i){B(`No MCPB file found`),w(`plugin-details`);return}await Re(i,k.plugin.path,e,void 0,n),B(null),Ce(null),w(`plugin-details`),t(`Configuration saved. Run /reload-plugins for changes to take effect.`)}catch(e){let t=Ye(e);B(`Failed to save configuration: ${t}`),w(`plugin-details`)}}function r(){Ce(null),w(`plugin-details`)}return(0,Z.jsx)(ln,{title:`Configure ${Se.manifest.name}`,subtitle:`Plugin: ${k.plugin.name}`,configSchema:Se.configSchema,initialValues:Se.existingConfig,onSave:n,onCancel:r})}if(typeof C==`object`&&C.type===`flagged-detail`){let e=C.plugin;return(0,Z.jsxs)(u,{flexDirection:`column`,children:[(0,Z.jsx)(u,{children:(0,Z.jsxs)(d,{bold:!0,children:[e.name,` @ `,e.marketplace]})}),(0,Z.jsxs)(u,{marginBottom:1,children:[(0,Z.jsx)(d,{dimColor:!0,children:`Status: `}),(0,Z.jsx)(d,{color:`error`,children:`Removed`})]}),(0,Z.jsxs)(u,{marginBottom:1,flexDirection:`column`,children:[(0,Z.jsxs)(d,{color:`error`,children:[`Removed from marketplace · reason: `,e.reason]}),(0,Z.jsx)(d,{children:e.text}),(0,Z.jsxs)(d,{dimColor:!0,children:[`Flagged on `,new Date(e.flaggedAt).toLocaleDateString()]})]}),(0,Z.jsx)(u,{marginTop:1,flexDirection:`column`,children:(0,Z.jsxs)(u,{children:[(0,Z.jsxs)(d,{children:[a.pointer,` `]}),(0,Z.jsx)(d,{color:`suggestion`,children:`Dismiss`})]})}),(0,Z.jsxs)(f,{children:[(0,Z.jsx)(V,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`dismiss`}),(0,Z.jsx)(V,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]})]})}if(C===`confirm-project-uninstall`&&k)return(0,Z.jsxs)(u,{flexDirection:`column`,children:[(0,Z.jsxs)(d,{bold:!0,color:`warning`,children:[k.plugin.name,` is enabled in .claude/settings.json (shared with your team)`]}),(0,Z.jsxs)(u,{marginTop:1,flexDirection:`column`,children:[(0,Z.jsx)(d,{children:`Disable it just for you in .claude/settings.local.json?`}),(0,Z.jsx)(d,{dimColor:!0,children:`This has the same effect as uninstalling, without affecting other contributors.`})]}),xe&&(0,Z.jsx)(u,{marginTop:1,children:(0,Z.jsx)(d,{color:`error`,children:xe})}),(0,Z.jsx)(u,{marginTop:1,children:be?(0,Z.jsx)(d,{dimColor:!0,children:`Disabling…`}):(0,Z.jsxs)(f,{children:[(0,Z.jsx)(V,{action:`confirm:yes`,context:`Confirmation`,fallback:`y`,description:`disable`}),(0,Z.jsx)(V,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})]})})]});if(typeof C==`object`&&C.type===`confirm-data-cleanup`&&k)return(0,Z.jsxs)(u,{flexDirection:`column`,children:[(0,Z.jsxs)(d,{bold:!0,children:[k.plugin.name,` has `,C.size.human,` of persistent data`]}),(0,Z.jsxs)(u,{marginTop:1,flexDirection:`column`,children:[(0,Z.jsx)(d,{children:`Delete it along with the plugin?`}),(0,Z.jsx)(d,{dimColor:!0,children:We(`${k.plugin.name}@${k.marketplace}`)})]}),xe&&(0,Z.jsx)(u,{marginTop:1,children:(0,Z.jsx)(d,{color:`error`,children:xe})}),(0,Z.jsx)(u,{marginTop:1,children:be?(0,Z.jsx)(d,{dimColor:!0,children:`Uninstalling…`}):(0,Z.jsxs)(d,{children:[(0,Z.jsx)(d,{bold:!0,children:`y`}),` to delete · `,(0,Z.jsx)(d,{bold:!0,children:`n`}),` to keep · `,(0,Z.jsx)(d,{bold:!0,children:`esc`}),` to cancel`]})})]});if(C===`plugin-details`&&k){let e=it(),t=`${k.plugin.name}@${k.marketplace}`,n=e?.enabledPlugins?.[t]!==!1,r=g.filter(e=>`plugin`in e&&e.plugin===k.plugin.name||e.source===t||e.source.startsWith(`${k.plugin.name}@`)),i=r.length===0?null:(0,Z.jsxs)(u,{flexDirection:`column`,marginBottom:1,children:[(0,Z.jsxs)(d,{bold:!0,color:`error`,children:[r.length,` `,H(r.length,`error`),`:`]}),r.map((e,t)=>{let n=Un(e);return(0,Z.jsxs)(u,{flexDirection:`column`,marginLeft:2,children:[(0,Z.jsx)(d,{color:`error`,children:Hn(e)}),n&&(0,Z.jsxs)(d,{dimColor:!0,italic:!0,children:[a.arrowRight,` `,n]})]},t)})]});return(0,Z.jsxs)(u,{flexDirection:`column`,children:[(0,Z.jsx)(u,{children:(0,Z.jsxs)(d,{bold:!0,children:[k.plugin.name,` @ `,k.marketplace]})}),(0,Z.jsxs)(u,{children:[(0,Z.jsx)(d,{dimColor:!0,children:`Scope: `}),(0,Z.jsx)(d,{children:k.scope||`user`})]}),k.plugin.manifest.version&&(0,Z.jsxs)(u,{children:[(0,Z.jsx)(d,{dimColor:!0,children:`Version: `}),(0,Z.jsx)(d,{children:k.plugin.manifest.version})]}),k.plugin.manifest.description&&(0,Z.jsx)(u,{marginBottom:1,children:(0,Z.jsx)(d,{children:k.plugin.manifest.description})}),k.plugin.manifest.author&&(0,Z.jsxs)(u,{children:[(0,Z.jsx)(d,{dimColor:!0,children:`Author: `}),(0,Z.jsx)(d,{children:k.plugin.manifest.author.name})]}),(0,Z.jsxs)(u,{marginBottom:1,children:[(0,Z.jsx)(d,{dimColor:!0,children:`Status: `}),(0,Z.jsx)(d,{color:n?`success`:`warning`,children:n?`Enabled`:`Disabled`}),k.pendingUpdate&&(0,Z.jsx)(d,{color:`suggestion`,children:` · Marked for update`})]}),(0,Z.jsx)(Yn,{plugin:k.plugin,marketplace:k.marketplace}),i,(0,Z.jsx)(u,{marginTop:1,flexDirection:`column`,children:Ne.map((e,t)=>{let n=t===ve;return(0,Z.jsxs)(u,{children:[n&&(0,Z.jsxs)(d,{children:[a.pointer,` `]}),!n&&(0,Z.jsx)(d,{children:` `}),(0,Z.jsx)(d,{bold:n,color:e.label.includes(`Uninstall`)?`error`:e.label.includes(`Update`)?`suggestion`:void 0,children:e.label})]},t)})}),be&&(0,Z.jsx)(u,{marginTop:1,children:(0,Z.jsx)(d,{children:`Processing…`})}),xe&&(0,Z.jsx)(u,{marginTop:1,children:(0,Z.jsx)(d,{color:`error`,children:xe})}),(0,Z.jsx)(u,{marginTop:1,children:(0,Z.jsx)(d,{dimColor:!0,italic:!0,children:(0,Z.jsxs)(f,{children:[(0,Z.jsx)(V,{action:`select:previous`,context:`Select`,fallback:`↑`,description:`navigate`}),(0,Z.jsx)(V,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`select`}),(0,Z.jsx)(V,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]})})})]})}if(typeof C==`object`&&C.type===`failed-plugin-details`){let e=C.plugin,t=e.errors[0],n=t?Hn(t):`Failed to load`;return(0,Z.jsxs)(u,{flexDirection:`column`,children:[(0,Z.jsxs)(d,{children:[(0,Z.jsx)(d,{bold:!0,children:e.name}),(0,Z.jsxs)(d,{dimColor:!0,children:[` @ `,e.marketplace]}),(0,Z.jsxs)(d,{dimColor:!0,children:[` (`,e.scope,`)`]})]}),(0,Z.jsx)(d,{color:`error`,children:n}),e.scope===`managed`?(0,Z.jsx)(u,{marginTop:1,children:(0,Z.jsx)(d,{dimColor:!0,children:`Managed by your organization — contact your admin`})}):(0,Z.jsxs)(u,{marginTop:1,children:[(0,Z.jsxs)(d,{color:`suggestion`,children:[a.pointer,` `]}),(0,Z.jsx)(d,{bold:!0,children:`Remove`})]}),be&&(0,Z.jsx)(d,{children:`Processing…`}),xe&&(0,Z.jsx)(d,{color:`error`,children:xe}),(0,Z.jsx)(u,{marginTop:1,children:(0,Z.jsx)(d,{dimColor:!0,italic:!0,children:(0,Z.jsxs)(f,{children:[e.scope!==`managed`&&(0,Z.jsx)(V,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`remove`}),(0,Z.jsx)(V,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]})})})]})}if(typeof C==`object`&&C.type===`mcp-detail`){let e=C.client,n=He(m,e.name).length,r=()=>{w({type:`mcp-tools`,client:e})},i=()=>{w(`plugin-list`)},a=e=>{e&&t(e),w(`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}):(w(`plugin-list`),null)}if(typeof C==`object`&&C.type===`mcp-tools`){let e=C.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=>{w({type:`mcp-tool-detail`,client:e,tool:t})},onBack:()=>w({type:`mcp-detail`,client:e})})}if(typeof C==`object`&&C.type===`mcp-tool-detail`){let{client:e,tool:t}=C,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:()=>w({type:`mcp-tools`,client:e})})}let Pe=_e.getVisibleItems(L);return(0,Z.jsxs)(u,{flexDirection:`column`,children:[(0,Z.jsx)(u,{marginBottom:1,children:(0,Z.jsx)(_,{query:T,isFocused:b,isTerminalFocused:ne,width:S-4,cursorOffset:O})}),L.length===0&&T&&(0,Z.jsx)(u,{marginBottom:1,children:(0,Z.jsxs)(d,{dimColor:!0,children:[`No items match "`,T,`"`]})}),_e.scrollPosition.canScrollUp&&(0,Z.jsx)(u,{children:(0,Z.jsxs)(d,{dimColor:!0,children:[` `,a.arrowUp,` more above`]})}),Pe.map((e,t)=>{let n=_e.toActualIndex(t)===R&&!b,r=t>0?Pe[t-1]:null,i=!r||r.scope!==e.scope;return(0,Z.jsxs)($n.Fragment,{children:[i&&(0,Z.jsx)(u,{marginTop:+(t>0),paddingLeft:2,children:(0,Z.jsx)(d,{dimColor:e.scope!==`flagged`,color:e.scope===`flagged`?`warning`:void 0,bold:e.scope===`flagged`,children:(e=>{switch(e){case`flagged`:return`Flagged`;case`project`:return`Project`;case`local`:return`Local`;case`user`:return`User`;case`enterprise`:return`Enterprise`;case`managed`:return`Managed`;case`builtin`:return`Built-in`;case`dynamic`:return`Built-in`;default:return e}})(e.scope)})}),(0,Z.jsx)(Gn,{item:e,isSelected:n})]},e.id)}),_e.scrollPosition.canScrollDown&&(0,Z.jsx)(u,{children:(0,Z.jsxs)(d,{dimColor:!0,children:[` `,a.arrowDown,` more below`]})}),(0,Z.jsx)(u,{marginTop:1,marginLeft:1,children:(0,Z.jsx)(d,{dimColor:!0,italic:!0,children:(0,Z.jsxs)(f,{children:[(0,Z.jsx)(d,{children:`type to search`}),(0,Z.jsx)(V,{action:`plugin:toggle`,context:`Plugin`,fallback:`Space`,description:`toggle`}),(0,Z.jsx)(V,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`details`}),(0,Z.jsx)(V,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]})})}),F.size>0&&(0,Z.jsx)(u,{marginLeft:1,children:(0,Z.jsx)(d,{dimColor:!0,italic:!0,children:`Run /reload-plugins to apply changes`})})]})}var $n,X,Z,er=e((()=>{i(),$n=t(m(),1),X=t(m(),1),k(),x(),qt(),Xt(),Jt(),Yt(),Ut(),Gt(),Ke(),j(),ye(),Bt(),D(),Et(),ue(),nt(),_e(),Qe(),et(),dt(),Ue(),T(),Fe(),Pe(),fe(),Rt(),me(),O(),B(),N(),vt(),at(),Xe(),_t(),Wn(),fn(),_n(),Kn(),kn(),Z=S()}));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} ${H(n.errors.length,`error`)}:\n\n`,n.errors.forEach(e=>{r+=` ${a.pointer} ${e.path}: ${e.message}\n`}),r+=`
15
+ `),n.warnings.length>0&&(r+=`${a.warning} Found ${n.warnings.length} ${H(n.warnings.length,`warning`)}:\n\n`,n.warnings.forEach(e=>{r+=` ${a.pointer} ${e.path}: ${e.message}\n`}),r+=`
16
+ `),n.success?(n.warnings.length>0?r+=`${a.tick} Validation passed with warnings\n`:r+=`${a.tick} Validation passed\n`,process.exitCode=0):(r+=`${a.cross} Validation failed\n`,process.exitCode=1),e(r)}catch(t){process.exitCode=2,ft(t),e(`${a.cross} Unexpected error during validation: ${Ye(t)}`)}}n()},[e,t]),(0,ar.jsx)(u,{flexDirection:`column`,children:(0,ar.jsx)(d,{children:`Running validation...`})})}var ir,ar,or=e((()=>{i(),m(),ir=t(m(),1),x(),et(),dt(),Pt(),_t(),ar=S()}));function sr({onComplete:e}){return(0,Q.useEffect)(()=>{async function t(){try{let t=await Ee(),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: ${Ye(t)}`)}}t()},[e]),(0,$.jsx)(d,{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`}])rt(n)?.extraKnownMarketplaces?.[e]&&t.push({source:n,scope:r});return{editableSources:t,isInPolicy:!!rt(`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=rt(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&&st(n,r)}}function hr({setViewState:e,setActiveTab:t,markPluginsChanged:n}){let r=Ve(e=>e.plugins.errors),i=Ve(e=>e.plugins.installationStatus),o=pe(),[s,l]=(0,Q.useState)(0),[p,m]=(0,Q.useState)(null),[h,g]=(0,Q.useState)([]);(0,Q.useEffect)(()=>{(async()=>{try{let{failures:e}=await Ge(await Ee());g(e)}catch{}})()},[]);let _=i.marketplaces.filter(e=>e.status===`failed`),v=new Set(_.map(e=>e.name)),y=r.filter(dr),b=pr(_,r.filter(e=>(e.type===`marketplace-not-found`||e.type===`marketplace-load-failed`||e.type===`marketplace-blocked-by-policy`)&&!v.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),h,y,yt());ee(`confirm:no`,()=>{e({type:`menu`})},{context:`Confirmation`}),c({"select:previous":()=>l(e=>Math.max(0,e-1)),"select:next":()=>l(e=>Math.min(b.length-1,e+1)),"select:accept":()=>{let r=b[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),E(),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)}}})),m(`${a.tick} Removed "${i.name}" from ${e} settings`),n();break}case`remove-installed-marketplace`:(async()=>{try{await Ne(i.name),E(),g(e=>e.filter(e=>e.name!==i.name)),m(`${a.tick} Removed marketplace "${i.name}"`),n()}catch(e){m(`Failed to remove "${i.name}": ${e instanceof Error?e.message:String(e)}`)}})();break;case`managed-only`:break;case`none`:break}}},{context:`Select`,isActive:b.length>0});let x=Math.min(s,Math.max(0,b.length-1));x!==s&&l(x);let te=b[x]?.action,ne=te&&te.kind!==`none`&&te.kind!==`managed-only`;return b.length===0?(0,$.jsxs)(u,{flexDirection:`column`,children:[(0,$.jsx)(u,{marginLeft:1,children:(0,$.jsx)(d,{dimColor:!0,children:`No plugin errors`})}),(0,$.jsx)(u,{marginTop:1,children:(0,$.jsx)(d,{dimColor:!0,italic:!0,children:(0,$.jsx)(V,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})})})]}):(0,$.jsxs)(u,{flexDirection:`column`,children:[b.map((e,t)=>{let n=t===x;return(0,$.jsxs)(u,{marginLeft:1,flexDirection:`column`,marginBottom:1,children:[(0,$.jsxs)(d,{children:[(0,$.jsxs)(d,{color:n?`suggestion`:`error`,children:[n?a.pointer:a.cross,` `]}),(0,$.jsx)(d,{bold:n,children:e.label}),e.scope&&(0,$.jsxs)(d,{dimColor:!0,children:[` (`,e.scope,`)`]})]}),(0,$.jsx)(u,{marginLeft:3,children:(0,$.jsx)(d,{color:`error`,children:e.message})}),e.guidance&&(0,$.jsx)(u,{marginLeft:3,children:(0,$.jsx)(d,{dimColor:!0,italic:!0,children:e.guidance})})]},t)}),p&&(0,$.jsx)(u,{marginTop:1,marginLeft:1,children:(0,$.jsx)(d,{color:`claude`,children:p})}),(0,$.jsx)(u,{marginTop:1,children:(0,$.jsx)(d,{dimColor:!0,italic:!0,children:(0,$.jsxs)(f,{children:[(0,$.jsx)(V,{action:`select:previous`,context:`Select`,fallback:`↑`,description:`navigate`}),ne&&(0,$.jsx)(V,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`resolve`}),(0,$.jsx)(V,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]})})})]})}function 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||``),[f,p]=(0,Q.useState)(0),[m,h]=(0,Q.useState)(null),[g,_]=(0,Q.useState)(null),[y,x]=(0,Q.useState)(!1),ne=pe(),S=Ve(e=>{let t=e.plugins.errors.length;for(let n of e.plugins.installationStatus.marketplaces)n.status===`failed`&&t++;return t}),C=S>0?`Errors (${S})`:`Errors`,w=Vt(),T=n.type===`marketplace`&&n.action===`add`&&n.target!==void 0,E=(0,Q.useCallback)(()=>{ne(e=>e.plugins.needsRefresh?e:{...e,plugins:{...e.plugins,needsRefresh:!0}})},[ne]),D=(0,Q.useCallback)(e=>{let t=e;switch(s(t),h(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`&&!g&&e()},[i.type,g,e]),(0,Q.useEffect)(()=>{i.type===`browse-marketplace`&&o!==`discover`&&s(`discover`)},[i.type,o]),ee(`confirm:no`,(0,Q.useCallback)(()=>{s(`marketplaces`),a({type:`manage-marketplaces`}),l(``),h(null)},[]),{context:`Settings`,isActive:i.type===`add-marketplace`}),(0,Q.useEffect)(()=>{g&&e(g)},[g,e]),(0,Q.useEffect)(()=>{i.type===`help`&&e()},[i.type,e]),i.type===`help`?(0,$.jsxs)(u,{flexDirection:`column`,children:[(0,$.jsx)(d,{bold:!0,children:`Plugin Command Usage:`}),(0,$.jsx)(d,{children:` `}),(0,$.jsx)(d,{dimColor:!0,children:`Installation:`}),(0,$.jsx)(d,{children:` /plugin install - Browse and install plugins`}),(0,$.jsx)(d,{children:` /plugin install <marketplace> - Install from specific marketplace`}),(0,$.jsx)(d,{children:` /plugin install <plugin> - Install specific plugin`}),(0,$.jsx)(d,{children:` /plugin install <plugin>@<market> - Install plugin from marketplace`}),(0,$.jsx)(d,{children:` `}),(0,$.jsx)(d,{dimColor:!0,children:`Management:`}),(0,$.jsx)(d,{children:` /plugin manage - Manage installed plugins`}),(0,$.jsx)(d,{children:` /plugin enable <plugin> - Enable a plugin`}),(0,$.jsx)(d,{children:` /plugin disable <plugin> - Disable a plugin`}),(0,$.jsx)(d,{children:` /plugin uninstall <plugin> - Uninstall a plugin`}),(0,$.jsx)(d,{children:` `}),(0,$.jsx)(d,{dimColor:!0,children:`Marketplaces:`}),(0,$.jsx)(d,{children:` /plugin marketplace - Marketplace management menu`}),(0,$.jsx)(d,{children:` /plugin marketplace add - Add a marketplace`}),(0,$.jsx)(d,{children:` /plugin marketplace add <path/url> - Add marketplace directly`}),(0,$.jsx)(d,{children:` /plugin marketplace update - Update marketplaces`}),(0,$.jsx)(d,{children:` /plugin marketplace update <name> - Update specific marketplace`}),(0,$.jsx)(d,{children:` /plugin marketplace remove - Remove a marketplace`}),(0,$.jsx)(d,{children:` /plugin marketplace remove <name> - Remove specific marketplace`}),(0,$.jsx)(d,{children:` /plugin marketplace list - List all marketplaces`}),(0,$.jsx)(d,{children:` `}),(0,$.jsx)(d,{dimColor:!0,children:`Validation:`}),(0,$.jsx)(d,{children:` /plugin validate <path> - Validate a manifest file or directory`}),(0,$.jsx)(d,{children:` `}),(0,$.jsx)(d,{dimColor:!0,children:`Other:`}),(0,$.jsx)(d,{children:` /plugin - Main plugin menu`}),(0,$.jsx)(d,{children:` /plugin help - Show this help`}),(0,$.jsx)(d,{children:` /plugins - Alias for /plugin`})]}):i.type===`validate`?(0,$.jsx)(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:f,setCursorOffset:p,error:m,setError:h,result:g,setResult:_,setViewState:a,onAddComplete:E,cliMode:T}):(0,$.jsx)(te,{color:`suggestion`,children:(0,$.jsxs)(b,{title:`Plugins`,selectedTab:o,onTabChange:D,color:`suggestion`,disableNavigation:y,children:[(0,$.jsx)(v,{id:`discover`,title:`Discover`,children:i.type===`browse-marketplace`?(0,$.jsx)(An,{error:m,setError:h,result:g,setResult:_,setViewState:a,onInstallComplete:E,targetMarketplace:i.targetMarketplace,targetPlugin:i.targetPlugin}):(0,$.jsx)(Nn,{error:m,setError:h,result:g,setResult:_,setViewState:a,onInstallComplete:E,onSearchModeChange:x,targetPlugin:i.type===`discover-plugins`?i.targetPlugin:void 0})}),(0,$.jsx)(v,{id:`installed`,title:`Installed`,children:(0,$.jsx)(Qn,{setViewState:a,setResult:_,onManageComplete:E,onSearchModeChange:x,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)(v,{id:`marketplaces`,title:`Marketplaces`,children:(0,$.jsx)(Rn,{setViewState:a,error:m,setError:h,setResult:_,exitState:w,onManageComplete:E,targetMarketplace:i.type===`manage-marketplaces`?i.targetMarketplace:void 0,action:i.type===`manage-marketplaces`?i.action:void 0})}),(0,$.jsx)(v,{id:`errors`,title:C,children:(0,$.jsx)(hr,{setViewState:a,setActiveTab:s,markPluginsChanged:E})})]})})}var Q,$,yr,br=e((()=>{i(),m(),Q=t(m(),1),k(),x(),Ht(),j(),ue(),et(),Ue(),qe(),Fe(),vt(),at(),sn(),Mn(),Ln(),Vn(),er(),Wn(),nr(),or(),$=S(),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((()=>{m(),br(),Sr=S()}))();export{xr as call};
@@ -0,0 +1 @@
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{Bo as t,Go as n,Ho as r,Zo as i,as as a,cD as o,ns as s,ts as c,uD as l}from"./loadAgentsDir-ByO8eJqU.js";import{F as u,a as d,l as f,z as p}from"./debug-RZ4NuXyS.js";import{vt as m,xt as h}from"./settings-hQDLwPVj.js";import{g,x as _}from"./config-CE058cvr.js";import{o as v,s as y}from"./log-CZ0zYP_c.js";import{f as b,s as x}from"./pluginOperations-C7p_Qr2r.js";function S(e){return O=e,k!==null&&k.length>0&&(e(k),k=null),()=>{O=null}}async function C(){let e=await s(),t=i(),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 t=n(),i=Object.keys(t.plugins);return i.length===0?[]:(await Promise.allSettled(i.map(async n=>{let{marketplace:i}=l(n);if(!i||!e.has(i.toLowerCase()))return null;let a=t.plugins[n];if(!a||a.length===0)return null;let o=a.filter(r);return o.length===0?null:w(n,o)}))).filter(e=>e.status===`fulfilled`&&e.value!==null).map(e=>e.value)}async function E(e){return T(e)}function D(){(async()=>{if(_()){f(`Plugin autoupdate: skipped (auto-updater disabled)`);return}try{let e=await C();if(e.size===0)return;let t=(await Promise.allSettled(Array.from(e).map(async e=>{try{await a(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(),g(),d(),p(),v(),t(),c(),o(),m(),O=null,k=null}));export{T as i,A as n,S as r,D as t};
@@ -1 +1 @@
1
- import{Es as e,Ms as t,Rs as n,Us as r,Vs as i}from"./loadAgentsDir-D206qwP3.js";import{F as a,a as o,l as s,z as c}from"./debug-BrXObCdR.js";import{i as l,n as u,r as d,t as f}from"./pluginFlagging-D9HKAGBC.js";import{d as p,s as m}from"./pluginOperations-EN3EKLux.js";m(),o(),c(),e(),i(),d();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 l();let e=t(),i=u(),o=await r(),c=[];for(let t of Object.keys(o))try{let r=await n(t);if(!r.forceRemoveDeletedPlugins)continue;let o=h(e,r,t);for(let t of o){if(t in i)continue;let n=e.plugins[t]??[];if(n.some(e=>e.scope===`user`||e.scope===`project`||e.scope===`local`)){for(let e of n){let{scope:n}=e;if(!(n!==`user`&&n!==`project`&&n!==`local`))try{await p(t,n)}catch(e){s(`Failed to auto-uninstall delisted plugin ${t} from ${n}: ${a(e)}`,{level:`error`})}}await f(t),c.push(t)}}}catch(e){s(`Failed to check for delisted plugins in "${t}": ${a(e)}`,{level:`warn`})}return c}export{g as t};
1
+ import{Bo as e,Ko as t,Qo as n,rs as r,ts as i}from"./loadAgentsDir-ByO8eJqU.js";import{F as a,a as o,l as s,z as c}from"./debug-RZ4NuXyS.js";import{d as l,s as u}from"./pluginOperations-C7p_Qr2r.js";import{i as d,n as f,r as p,t as m}from"./pluginFlagging-pBxSselw.js";u(),o(),c(),e(),i(),p();function h(e,t,n){let r=new Set(t.plugins.map(e=>e.name)),i=`@${n}`,a=[];for(let t of Object.keys(e.plugins)){if(!t.endsWith(i))continue;let e=t.slice(0,-i.length);r.has(e)||a.push(t)}return a}async function g(){await d();let e=t(),i=f(),o=await r(),c=[];for(let t of Object.keys(o))try{let r=await n(t);if(!r.forceRemoveDeletedPlugins)continue;let o=h(e,r,t);for(let t of o){if(t in i)continue;let n=e.plugins[t]??[];if(n.some(e=>e.scope===`user`||e.scope===`project`||e.scope===`local`)){for(let e of n){let{scope:n}=e;if(!(n!==`user`&&n!==`project`&&n!==`local`))try{await l(t,n)}catch(e){s(`Failed to auto-uninstall delisted plugin ${t} from ${n}: ${a(e)}`,{level:`error`})}}await m(t),c.push(t)}}}catch(e){s(`Failed to check for delisted plugins in "${t}": ${a(e)}`,{level:`warn`})}return c}export{g as t};
@@ -0,0 +1 @@
1
+ import{n as e,t}from"./figures-5ThXQEtq.js";import{Fu as n,Jm as r,Km as i,Nu as a,Pu as o,Ro as s,cD as c,uD as l,zo as u}from"./loadAgentsDir-ByO8eJqU.js";import{F as d,z as f}from"./debug-RZ4NuXyS.js";import{n as p,o as m}from"./process-gEbdy6uY.js";import{o as h,s as g}from"./log-CZ0zYP_c.js";import{n as _,r as v}from"./analytics-CkYUHW_U.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-C7p_Qr2r.js";e(),f(),r(),h(),u(),c(),p(),n(),_(),T();function E(e,n,r){g(e);let i=r?`${n} plugin "${r}"`:n===`disable-all`?`disable all plugins`:`${n} plugins`;console.error(`${t.cross} Failed to ${i}: ${d(e)}`);let c=r?(()=>{let{name:e,marketplace:t}=l(r);return{_PROTO_plugin_name:e,...t&&{_PROTO_marketplace_name:t},...a(e,t,s())}})():{};v(`tengu_plugin_command_failed`,{command:n,error_category:o(e),...c}),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:i,marketplace:o}=l(r.pluginId||e);v(`tengu_plugin_installed_cli`,{_PROTO_plugin_name:i,...o&&{_PROTO_marketplace_name:o},scope:r.scope||n,install_source:`cli-explicit`,...a(i,o,s())}),process.exit(0)}catch(t){E(t,`install`,e)}}async function O(e,n=`user`,r=!1){try{let i=await x(e,n,!r);if(!i.success)throw Error(i.message);console.log(`${t.tick} ${i.message}`);let{name:o,marketplace:c}=l(i.pluginId||e);v(`tengu_plugin_uninstalled_cli`,{_PROTO_plugin_name:o,...c&&{_PROTO_marketplace_name:c},scope:i.scope||n,...a(o,c,s())}),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:i,marketplace:o}=l(r.pluginId||e);v(`tengu_plugin_enabled_cli`,{_PROTO_plugin_name:i,...o&&{_PROTO_marketplace_name:o},scope:r.scope,...a(i,o,s())}),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:i,marketplace:o}=l(r.pluginId||e);v(`tengu_plugin_disabled_cli`,{_PROTO_plugin_name:i,...o&&{_PROTO_marketplace_name:o},scope:r.scope,...a(i,o,s())}),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 r=await S(e,n);if(!r.success)throw Error(r.message);if(m(`${t.tick} ${r.message}\n`),!r.alreadyUpToDate){let{name:t,marketplace:n}=l(r.pluginId||e);v(`tengu_plugin_updated_cli`,{_PROTO_plugin_name:t,...n&&{_PROTO_marketplace_name:n},old_version:r.oldVersion||`unknown`,new_version:r.newVersion||`unknown`,...a(t,n,s())})}await i(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};
@@ -0,0 +1 @@
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{bE as t,yE as n}from"./loadAgentsDir-ByO8eJqU.js";import{C as r,S as i,a,d as o,l as s,p as c,w as l}from"./debug-RZ4NuXyS.js";import{o as u,s as d}from"./log-CZ0zYP_c.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=r(e);if(typeof t!=`object`||!t||!(`plugins`in t)||typeof t.plugins!=`object`||t.plugins===null)return{};let n=t.plugins,i={};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),i[e]=n}return i}async function b(){try{return y(await m(v(),{encoding:`utf-8`}))}catch{return{}}}async function x(e){let t=v(),r=`${t}.${p(8).toString(`hex`)}.tmp`;try{await o().mkdir(n()),await _(r,l({plugins:e},null,2),{encoding:`utf-8`,mode:384}),await h(r,t),k=e}catch(e){d(e);try{await g(r)}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()}}),s(`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((()=>{a(),c(),u(),i(),t(),D=`flagged-plugins.json`,O=2880*60*1e3,k=null}));export{T as a,S as i,C as n,E as o,A as r,w as t};
@@ -0,0 +1,2 @@
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{$t as t,tt as n}from"./state-C2OSZkV1.js";import{$v as r,Ao as i,Bo as a,Cs as o,Do as s,Eo as c,Fo as l,Go as u,Io as d,Jo as f,Ko as p,Lo as m,Mo as h,No as g,Oo as _,Qo as v,Qv as y,So as b,To as x,Ts as S,aD as C,bE as w,cD as ee,dD as T,es as E,gD as te,gE as ne,hD as D,iw as O,ns as k,nw as A,oD as j,qo as re,sD as ie,ts as ae,uD as M,wo as oe,ws as se}from"./loadAgentsDir-ByO8eJqU.js";import{V as N,W as ce,d as P,p as F,z as I}from"./debug-RZ4NuXyS.js";import{c as L,g as R,x as z}from"./settings-hQDLwPVj.js";import{o as B,s as V}from"./log-CZ0zYP_c.js";import{l as H,o as U}from"./stringUtils-B6FudhoZ.js";import{n as W,t as G}from"./pluginStartupCheck-Di4LjHXf.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 L(`projectSettings`)?.enabledPlugins?.[e]===!0}function fe(e){let t=e.includes(`@`);for(let n of[`local`,`project`,`user`]){let r=L(T(n))?.enabledPlugins;if(r){for(let i of Object.keys(r))if(t?i===e:i.startsWith(`${e}@`))return{pluginId:i,scope:n}}}return null}function pe(e,t){let{name:n,marketplace:r}=M(e);return t.find(t=>t.name===e||t.name===n?!0:r&&t.source?t.name===n&&t.source.includes(`@${r}`):!1)}function me(e){let{name:t}=M(e),n=p();if(n.plugins[e]?.length)return{pluginId:e,pluginName:t};let r=Object.keys(n.plugins).find(e=>{let{name:r}=M(e);return r===t&&(n.plugins[e]?.length??0)>0});return r?{pluginId:r,pluginName:t}:null}function Y(e){let t=p().plugins[e];if(!t||t.length===0)return{scope:`user`};let r=n(),i=t.find(e=>e.scope===`local`&&e.projectPath===r);if(i)return{scope:i.scope,projectPath:i.projectPath};let a=t.find(e=>e.scope===`project`&&e.projectPath===r);if(a)return{scope:a.scope,projectPath:a.projectPath};let o=t.find(e=>e.scope===`user`);return o?{scope:o.scope}:{scope:t[0].scope,projectPath:t[0].projectPath}}async function he(e,t=`user`){q(t);let{name:n,marketplace:r}=M(e),i,a,o;if(r){let t=await E(e);t&&(i=t.entry,a=r,o=t.marketplaceInstallLocation)}else{let e=await k();for(let[t,r]of Object.entries(e))try{let e=(await v(t)).plugins.find(e=>e.name===n);if(e){i=e,a=t,o=r.installLocation;break}}catch(e){V(ce(e))}}if(!i||!a)return{success:!1,message:`Plugin "${n}" not found in ${r?`marketplace "${r}"`:`any configured marketplace`}`};let s=i,c=`${s.name}@${a}`,u=await l({pluginId:c,entry:s,scope:t,marketplaceInstallLocation:o});if(!u.ok){let e=u;switch(e.reason){case`local-source-no-location`:return{success:!1,message:`Cannot install local plugin "${e.pluginName}" without marketplace install location`};case`settings-write-failed`:return{success:!1,message:`Failed to update settings: ${e.message}`};case`resolution-failed`:return{success:!1,message:h(e.resolution)};case`blocked-by-policy`:return{success:!1,message:`Plugin "${e.pluginName}" is blocked by your organization's policy and cannot be installed`};case`dependency-blocked-by-policy`:return{success:!1,message:`Plugin "${e.pluginName}" depends on "${e.blockedDependency}", which is blocked by your organization's policy`}}}return{success:!0,message:`Successfully installed plugin: ${c} (scope: ${t})${u.depNote}`,pluginId:c,pluginName:s.name,scope:t}}async function ge(e,t=`user`,n=!0){q(t);let{enabled:r,disabled:i}=await _(),a=[...r,...i],s=pe(e,a),c=T(t),l=L(c),u,d;if(s)u=Object.keys(l?.enabledPlugins??{}).find(t=>t===e||t===s.name||t.startsWith(`${s.name}@`))??(e.includes(`@`)?e:s.name),d=s.name;else{let t=me(e);if(!t)return{success:!1,message:`Plugin "${e}" not found in installed plugins`};u=t.pluginId,d=t.pluginName}let f=J(t),m=p().plugins[u],h=m?.find(e=>e.scope===t&&e.projectPath===f);if(!h){let{scope:n}=Y(u);return n!==t&&m&&m.length>0?n===`project`?{success:!1,message:`Plugin "${e}" is enabled at project scope (.claude/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=h.installPath,v={...l?.enabledPlugins};v[u]=void 0,z(c,{enabledPlugins:v}),o(),re(u,t,f);let y=p().plugins[u],b=!y||y.length===0;b&&g&&await S(g),b&&(A(u),n&&await ne(u));let x=C(u,a),w=j(x);return{success:!0,message:`Successfully uninstalled plugin: ${d} (scope: ${t})${w}`,pluginId:u,pluginName:d,scope:t,reverseDependents:x.length>0?x:void 0}}async function X(e,t,n){let i=t?`enable`:`disable`;if(te(e)){let{error:n}=z(`userSettings`,{enabledPlugins:{...L(`userSettings`)?.enabledPlugins,[e]:t}});if(n)return{success:!1,message:`Failed to ${i} built-in plugin: ${n.message}`};o();let{name:r}=M(e);return{success:!0,message:`Successfully ${i}d built-in plugin: ${r}`,pluginId:e,pluginName:r,scope:`user`}}n&&q(n);let a,s,c=fe(e);if(n)if(s=n,c)a=c.pluginId;else if(e.includes(`@`))a=e;else return{success:!1,message:`Plugin "${e}" not found in settings. Use plugin@marketplace format.`};else if(c)a=c.pluginId,s=c.scope;else if(e.includes(`@`))a=e,s=`user`;else return{success:!1,message:`Plugin "${e}" not found in any editable settings scope. Use plugin@marketplace format.`};if(t&&r(a))return{success:!1,message:`Plugin "${a}" is blocked by your organization's policy and cannot be enabled`};let l=T(s),u=L(l)?.enabledPlugins?.[a],d={user:0,project:1,local:2},f=n&&c&&d[n]>d[c.scope];if(n&&u===void 0&&c&&c.scope!==n&&!f)return{success:!1,message:`Plugin "${e}" is installed at ${c.scope} scope, not ${n}. Use --scope ${c.scope} or omit --scope to auto-detect.`};if(t===(n&&!f?u===!0:G().has(a)))return{success:!1,message:`Plugin "${e}" is already ${t?`enabled`:`disabled`}${n?` at ${n} scope`:``}`};let p;if(!t){let{enabled:e,disabled:t}=await _(),n=C(a,[...e,...t]);n.length>0&&(p=n)}let{error:m}=z(l,{enabledPlugins:{...L(l)?.enabledPlugins,[a]:t}});if(m)return{success:!1,message:`Failed to ${i} plugin: ${m.message}`};o();let{name:h}=M(a),g=j(p);return{success:!0,message:`Successfully ${i}d plugin: ${h} (scope: ${s})${g}`,pluginId:a,pluginName:h,scope:s,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}=M(e),i=r?`${n}@${r}`:e,a=await E(e);if(!a)return{success:!1,message:`Plugin "${n}" not found`,pluginId:i,scope:t};let{entry:o,marketplaceInstallLocation:s}=a,c=u().plugins[i];if(!c||c.length===0)return{success:!1,message:`Plugin "${n}" is not installed`,pluginId:i,scope:t};let l=J(t),d=c.find(e=>e.scope===t&&e.projectPath===l);return d?be({pluginId:i,pluginName:n,entry:o,marketplaceInstallLocation:s,installation:d,scope:t,projectPath:l}):{success:!1,message:`Plugin "${n}" is not installed at scope ${l?`${t} (${l})`:t}`,pluginId:i,scope:t}}async function be({pluginId:e,pluginName:t,entry:n,marketplaceInstallLocation:r,installation:a,scope:o,projectPath:s}){let l=P(),p=a.version,m,h,g=!1,_;if(typeof n.source!=`string`){let t=await b(n.source,{manifest:{name:n.name}});m=t.path,g=!0,_=t.gitCommitSha,h=await d(e,n.source,t.manifest,t.path,n.version,t.gitCommitSha)}else{let t;try{t=await l.stat(r)}catch(t){if(N(t))return{success:!1,message:`Marketplace directory not found at ${r}`,pluginId:e,scope:o};throw t}m=K(t.isDirectory()?r:le(r),n.source);try{await l.stat(m)}catch(t){if(N(t))return{success:!1,message:`Plugin source not found at ${m}`,pluginId:e,scope:o};throw t}let a,s=K(m,`.claude-plugin`,`plugin.json`);try{a=await i(s,n.name,n.source)}catch{}h=await d(e,n.source,a,m,n.version)}try{let r=x(e,h),i=c(e,h);if(a.version===h||a.installPath===r||a.installPath===i)return{success:!0,message:`${t} is already at the latest version (${h}).`,pluginId:e,newVersion:h,oldVersion:p,alreadyUpToDate:!0,scope:o};r=await oe(m,e,h,n);let l=a.installPath;if(f(e,o,s,r,h,_),l&&l!==r){let e=u();Object.values(e.plugins).some(e=>e.some(e=>e.installPath===l))||await S(l)}let d=s?`${o} (${s})`:o;return{success:!0,message:`Plugin "${t}" updated from ${p||`unknown`} to ${h} for scope ${d}. Restart to apply changes.`,pluginId:e,newVersion:h,oldVersion:p,scope:o}}finally{g&&m!==x(e,h)&&await l.rm(m,{recursive:!0,force:!0})}}var Q,$,xe=e((()=>{t(),D(),I(),F(),B(),se(),ie(),a(),ae(),w(),ee(),g(),s(),O(),y(),W(),m(),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-Di4LjHXf.js";e();export{t as getPluginEditableScopes};
@@ -0,0 +1 @@
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{Bo as t,No as n,cD as r,fD as i,pD as a,ts as o}from"./loadAgentsDir-ByO8eJqU.js";import{n as s}from"./cwd-C5ce-7WB.js";import{a as c,l}from"./debug-RZ4NuXyS.js";import{c as u,g as d,vt as f}from"./settings-hQDLwPVj.js";import{o as p}from"./log-CZ0zYP_c.js";import"path";function m(){let e=new Map,t=i();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=u(r);if(i?.enabledPlugins)for(let[a,o]of Object.entries(i.enabledPlugins))a.includes(`@`)&&(a in t&&t[a]!==o&&l(`Plugin ${a} from --add-dir (${t[a]}) overridden by ${r} (${o})`),o===!0?e.set(a,n):o===!1&&e.delete(a))}return l(`Found ${e.size} enabled plugins with scopes: ${Array.from(e.entries()).map(([e,t])=>`${e}(${t})`).join(`, `)}`),e}var h=e((()=>{s(),c(),p(),d(),a(),t(),o(),r(),n(),f()}));export{h as n,m as t};