@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,17 +0,0 @@
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,Lt as d,P as f,T as p,Wt as ee,Xn as m,dr as h,fi as g,hn as _,j as v,k as y,n as b,ot as x,r as S,t as C,x as te,y as w}from"./src-CDCSSo0U2.js";import{t as T}from"./jsx-runtime-Bb4Xn-E0.js";import{$g as E,$s as ne,As as D,Es as O,Fb as k,Fs as A,Fx as re,Gs as ie,Hs as ae,Jg as oe,KS as j,Ms as M,Nb as se,O_ as N,Px as ce,Q_ as le,R_ as ue,Rs as P,S_ as F,Sx as I,T_ as de,US as L,V_ as fe,Vs as pe,WS as me,Xs as he,Ys as ge,Z_ as _e,_D as ve,aC as R,aO as ye,ac as z,am as be,av as xe,b_ as Se,cv as Ce,dO as we,dg as Te,e_ as Ee,ec as De,fO as Oe,fs as ke,fx as Ae,g_ as je,hO as Me,ic as Ne,ig as Pe,iv as Fe,ks as Ie,lc as Le,lv as Re,mD as ze,mO as Be,n_ as Ve,nc as He,nv as Ue,om as We,ov as Ge,ps as Ke,px as qe,qs as Je,rc as Ye,rv as Xe,sO as Ze,sc as Qe,sv as $e,tO as et,tc as tt,tv as nt,uc as rt,vD as it,vs as at,w_ as ot,xx as B,y_ as st,ys as ct}from"./loadAgentsDir-D206qwP3.js";import{C as lt,F as ut,S as dt,W as ft,a as pt,l as mt,z as ht}from"./debug-BrXObCdR.js";import{St as gt,Tt as _t,_n as vt,at as yt,c as bt,ct as xt,f as St,g as Ct,gn as wt,it as Tt,y as Et}from"./settings-BovzmwMP.js";import{g as Dt,x as Ot}from"./config-DmomySWC.js";import{c as kt,o as At,s as jt}from"./log-BMCygSzM.js";import{n as Mt,r as Nt}from"./analytics-BotDBGh0.js";import{T as Pt,x as Ft}from"./startupProfiler-xa3NmN7Z.js";import{l as It,u as Lt}from"./oauth-BqJqV-2M.js";import{l as Rt,n as zt,o as Bt}from"./stringUtils-DGLPkqJ4.js";import{Bt as Vt,jt as Ht}from"./model-CKkOnnnx.js";import{a as Ut,n as Wt,o as Gt,r as Kt}from"./pluginFlagging-D9HKAGBC.js";import{u as qt}from"./referral-CUaIo_vT.js";import{n as Jt,t as Yt}from"./browser-BmZuQom6.js";import{n as Xt,t as Zt}from"./pluginStartupCheck-BY73BMT2.js";import{a as Qt,d as $t,f as en,i as tn,l as nn,o as rn,s as an,u as on}from"./pluginOperations-EN3EKLux.js";import{a as sn,c as cn,i as ln,n as un,o as dn,s as fn,t as pn}from"./validatePlugin-DtiYlXby.js";import{i as mn,n as hn,r as gn}from"./MCPConnectionManager-CNh9dNlk.js";import{n as _n,t as vn}from"./useExitOnCtrlCDWithKeybindings-DKIqRraH.js";import{t as yn}from"./SearchBox-vfLXEPed.js";import{n as bn,t as xn}from"./useSearchInput-D1Vr2Js1.js";import{i as Sn,n as Cn}from"./pluginAutoupdate-reO2PgtQ.js";import*as wn from"path";import*as Tn from"fs/promises";function En({serverToolsCount:e,serverPromptsCount:t,serverResourcesCount:n}){let r=[];return e>0&&r.push(`tools`),n>0&&r.push(`resources`),t>0&&r.push(`prompts`),(0,Dn.jsxs)(u,{children:[(0,Dn.jsx)(f,{bold:!0,children:`Capabilities: `}),(0,Dn.jsx)(f,{color:`text`,children:r.length>0?(0,Dn.jsx)(p,{children:r}):`none`})]})}var Dn,On=e((()=>{g(),C(),Dn=T()}));function kn(e,t){switch(e.client.type){case`connected`:return{message:`Reconnected to ${t}.`,success:!0};case`needs-auth`:return{message:`${t} requires authentication. Use the 'Authenticate' option.`,success:!1};case`failed`:return{message:`Failed to reconnect to ${t}.`,success:!1};default:return{message:`Unknown result when reconnecting to ${t}.`,success:!1}}}function An(e,t){return`Error reconnecting to ${t}: ${e instanceof Error?e.message:String(e)}`}var jn=e((()=>{}));function Mn({server:e,serverToolsCount:t,onViewTools:n,onCancel:r,onComplete:i,borderless:s=!1}){let[c]=l(),m=_n(),{columns:g}=x(),[y,b]=V.useState(!1),[S,C]=V.useState(null),te=me(e=>e.mcp),w=j(),[T,E]=V.useState(null),[ne,D]=(0,V.useState)(!1),O=(0,V.useRef)(null),[k,A]=(0,V.useState)(!1),[re,ie]=(0,V.useState)(null),[ae,M]=(0,V.useState)(!1),[N,le]=(0,V.useState)(null),[ue,P]=(0,V.useState)(!1),[I,de]=(0,V.useState)(!1),L=(0,V.useRef)(void 0),fe=(0,V.useRef)(!1),[pe,he]=(0,V.useState)(``),[ge,_e]=(0,V.useState)(0),[ve,R]=(0,V.useState)(null);(0,V.useEffect)(()=>()=>{fe.current=!0,O.current?.abort(),L.current!==void 0&&clearTimeout(L.current)},[]);let ye=e.isAuthenticated||e.client.type===`connected`&&t>0,z=gn(),be=V.useCallback(async()=>{A(!1),ie(null),D(!0);try{let t=await z(e.name),n=t.client.type===`connected`;Nt(`tengu_claudeai_mcp_auth_completed`,{success:n}),n?i?.(`Authentication successful. Connected to ${e.name}.`):t.client.type===`needs-auth`?i?.(`Authentication successful, but server still requires authentication. You may need to manually restart Claude Code.`):i?.(`Authentication successful, but server reconnection failed. You may need to manually restart Claude Code for the changes to take effect.`)}catch(t){Nt(`tengu_claudeai_mcp_auth_completed`,{success:!1}),i?.(An(t,e.name))}finally{D(!1)}},[z,e.name,i]),xe=V.useCallback(async()=>{await Pe(e.name,{...e.config,scope:e.scope}),w(t=>{let n=t.mcp.clients.map(t=>t.name===e.name?{...t,type:`needs-auth`}:t),r=F(t.mcp.tools,e.name),i=st(t.mcp.commands,e.name),a=Se(t.mcp.resources,e.name);return{...t,mcp:{...t.mcp,clients:n,tools:r,commands:i,resources:a}}}),Nt(`tengu_claudeai_mcp_clear_auth_completed`,{}),i?.(`Disconnected from ${e.name}.`),M(!1),le(null),P(!1)},[e.name,e.config,e.scope,w,i]);ee(`confirm:no`,()=>{O.current?.abort(),O.current=null,b(!1),E(null)},{context:`Confirmation`,isActive:y}),ee(`confirm:no`,()=>{A(!1),ie(null)},{context:`Confirmation`,isActive:k}),ee(`confirm:no`,()=>{M(!1),le(null),P(!1)},{context:`Confirmation`,isActive:ae}),_((e,t)=>{if(t.return&&k&&be(),t.return&&ae)if(ue)xe();else{let e=`${It().CLAUDE_AI_ORIGIN}/settings/connectors`;le(e),P(!0),Jt(e)}if(e===`c`&&!I){let e=T||re||N;e&&h(e).then(e=>{fe.current||(e&&process.stdout.write(e),de(!0),L.current!==void 0&&clearTimeout(L.current),L.current=setTimeout(de,2e3,!1))})}});let Ce=zt(String(e.name)),we=ot(te.commands,e.name).length,Te=mn(),De=V.useCallback(async()=>{let t=It().CLAUDE_AI_ORIGIN,n=Ht()?.organizationUuid,r;r=n&&e.config.type===`claudeai-proxy`&&e.config.id?`${t}/api/organizations/${n}/mcp/start-auth/${e.config.id.startsWith(`mcprs`)?`mcpsrv`+e.config.id.slice(5):e.config.id}?product_surface=${encodeURIComponent(process.env.CLAUDE_CODE_ENTRYPOINT||`cli`)}`:`${t}/settings/connectors`,ie(r),A(!0),Nt(`tengu_claudeai_mcp_auth_started`,{}),await Jt(r)},[e.config]),Oe=V.useCallback(()=>{M(!0),Nt(`tengu_claudeai_mcp_clear_auth_started`,{})},[]),ke=V.useCallback(async()=>{let t=e.client.type!==`disabled`;try{await Te(e.name),e.config.type===`claudeai-proxy`&&Nt(`tengu_claudeai_mcp_toggle`,{new_state:t?`disabled`:`enabled`}),r()}catch(n){i?.(`Failed to ${t?`disable`:`enable`} MCP server '${e.name}': ${ut(n)}`)}},[e.client.type,e.config.type,e.name,Te,r,i]),Ae=V.useCallback(async()=>{if(e.config.type===`claudeai-proxy`)return;b(!0),C(null);let t=new AbortController;O.current=t;try{if(e.isAuthenticated&&e.config&&await Ve(e.name,e.config,{preserveStepUpState:!0}),e.config){await Ee(e.name,e.config,E,t.signal,{onWaitingForCallback:e=>{R(()=>e)}}),Nt(`tengu_mcp_auth_config_authenticate`,{wasAuthenticated:e.isAuthenticated});let n=await z(e.name);if(n.client.type===`connected`){let t=ye?`Authentication successful. Reconnected to ${e.name}.`:`Authentication successful. Connected to ${e.name}.`;i?.(t)}else n.client.type===`needs-auth`?i?.(`Authentication successful, but server still requires authentication. You may need to manually restart Claude Code.`):(kt(e.name,`Reconnection failed after authentication`),i?.(`Authentication successful, but server reconnection failed. You may need to manually restart Claude Code for the changes to take effect.`))}}catch(e){e instanceof Error&&!(e instanceof oe)&&C(e.message)}finally{b(!1),O.current=null,R(null),he(``)}},[e.isAuthenticated,e.config,e.name,i,z,ye]),Me=async()=>{e.config.type!==`claudeai-proxy`&&e.config&&(await Ve(e.name,e.config),Nt(`tengu_mcp_auth_config_clear`,{}),await Pe(e.name,{...e.config,scope:e.scope}),w(t=>{let n=t.mcp.clients.map(t=>t.name===e.name?{...t,type:`failed`}:t),r=F(t.mcp.tools,e.name),i=st(t.mcp.commands,e.name),a=Se(t.mcp.resources,e.name);return{...t,mcp:{...t.mcp,clients:n,tools:r,commands:i,resources:a}}}),i?.(`Authentication cleared for ${e.name}.`))};if(y){let t=e.config.type!==`claudeai-proxy`&&e.config.oauth?.xaa?` Authenticating via your identity provider`:` A browser window will open for authentication`;return(0,H.jsxs)(u,{flexDirection:`column`,gap:1,padding:1,children:[(0,H.jsxs)(f,{color:`claude`,children:[`Authenticating with `,e.name,`…`]}),(0,H.jsxs)(u,{children:[(0,H.jsx)(se,{}),(0,H.jsx)(f,{children:t})]}),T&&(0,H.jsxs)(u,{flexDirection:`column`,children:[(0,H.jsxs)(u,{children:[(0,H.jsx)(f,{dimColor:!0,children:`If your browser doesn't open automatically, copy this URL manually `}),I?(0,H.jsx)(f,{color:`success`,children:`(Copied!)`}):(0,H.jsx)(f,{dimColor:!0,children:(0,H.jsx)(o,{shortcut:`c`,action:`copy`,parens:!0})})]}),(0,H.jsx)(d,{url:T})]}),y&&T&&ve&&(0,H.jsxs)(u,{flexDirection:`column`,marginTop:1,children:[(0,H.jsx)(f,{dimColor:!0,children:`If the redirect page shows a connection error, paste the URL from your browser's address bar:`}),(0,H.jsxs)(u,{children:[(0,H.jsxs)(f,{dimColor:!0,children:[`URL `,`>`,` `]}),(0,H.jsx)(ce,{value:pe,onChange:he,onSubmit:e=>{ve(e.trim()),he(``)},cursorOffset:ge,onChangeCursorOffset:_e,columns:g-8})]})]}),(0,H.jsx)(u,{marginLeft:3,children:(0,H.jsx)(f,{dimColor:!0,children:`Return here after authenticating in your browser. Press Esc to go back.`})})]})}if(k)return(0,H.jsxs)(u,{flexDirection:`column`,gap:1,padding:1,children:[(0,H.jsxs)(f,{color:`claude`,children:[`Authenticating with `,e.name,`…`]}),(0,H.jsxs)(u,{children:[(0,H.jsx)(se,{}),(0,H.jsx)(f,{children:` A browser window will open for authentication`})]}),re&&(0,H.jsxs)(u,{flexDirection:`column`,children:[(0,H.jsxs)(u,{children:[(0,H.jsx)(f,{dimColor:!0,children:`If your browser doesn't open automatically, copy this URL manually `}),I?(0,H.jsx)(f,{color:`success`,children:`(Copied!)`}):(0,H.jsx)(f,{dimColor:!0,children:(0,H.jsx)(o,{shortcut:`c`,action:`copy`,parens:!0})})]}),(0,H.jsx)(d,{url:re})]}),(0,H.jsxs)(u,{marginLeft:3,flexDirection:`column`,children:[(0,H.jsxs)(f,{color:`permission`,children:[`Press `,(0,H.jsx)(f,{bold:!0,children:`Enter`}),` after authenticating in your browser.`]}),(0,H.jsx)(f,{dimColor:!0,italic:!0,children:(0,H.jsx)(B,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})})]})]});if(ae)return(0,H.jsxs)(u,{flexDirection:`column`,gap:1,padding:1,children:[(0,H.jsxs)(f,{color:`claude`,children:[`Clear authentication for `,e.name]}),ue?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(f,{children:`Find the MCP server in the browser and click "Disconnect".`}),N&&(0,H.jsxs)(u,{flexDirection:`column`,children:[(0,H.jsxs)(u,{children:[(0,H.jsx)(f,{dimColor:!0,children:`If your browser didn't open automatically, copy this URL manually `}),I?(0,H.jsx)(f,{color:`success`,children:`(Copied!)`}):(0,H.jsx)(f,{dimColor:!0,children:(0,H.jsx)(o,{shortcut:`c`,action:`copy`,parens:!0})})]}),(0,H.jsx)(d,{url:N})]}),(0,H.jsxs)(u,{marginLeft:3,flexDirection:`column`,children:[(0,H.jsxs)(f,{color:`permission`,children:[`Press `,(0,H.jsx)(f,{bold:!0,children:`Enter`}),` when done.`]}),(0,H.jsx)(f,{dimColor:!0,italic:!0,children:(0,H.jsx)(B,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})})]})]}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(f,{children:`This will open claude.ai in the browser. Find the MCP server in the list and click "Disconnect".`}),(0,H.jsxs)(u,{marginLeft:3,flexDirection:`column`,children:[(0,H.jsxs)(f,{color:`permission`,children:[`Press `,(0,H.jsx)(f,{bold:!0,children:`Enter`}),` to open the browser.`]}),(0,H.jsx)(f,{dimColor:!0,italic:!0,children:(0,H.jsx)(B,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})})]})]})]});if(ne)return(0,H.jsxs)(u,{flexDirection:`column`,gap:1,padding:1,children:[(0,H.jsxs)(f,{color:`text`,children:[`Connecting to `,(0,H.jsx)(f,{bold:!0,children:e.name}),`…`]}),(0,H.jsxs)(u,{children:[(0,H.jsx)(se,{}),(0,H.jsx)(f,{children:` Establishing connection to MCP server`})]}),(0,H.jsx)(f,{dimColor:!0,children:`This may take a few moments.`})]});let Ne=[];return e.client.type===`disabled`&&Ne.push({label:`Enable`,value:`toggle-enabled`}),e.client.type===`connected`&&t>0&&Ne.push({label:`View tools`,value:`tools`}),e.config.type===`claudeai-proxy`?e.client.type===`connected`?Ne.push({label:`Clear authentication`,value:`claudeai-clear-auth`}):e.client.type!==`disabled`&&Ne.push({label:`Authenticate`,value:`claudeai-auth`}):(ye&&(Ne.push({label:`Re-authenticate`,value:`reauth`}),Ne.push({label:`Clear authentication`,value:`clear-auth`})),ye||Ne.push({label:`Authenticate`,value:`auth`})),e.client.type!==`disabled`&&(e.client.type!==`needs-auth`&&Ne.push({label:`Reconnect`,value:`reconnectMcpServer`}),Ne.push({label:`Disable`,value:`toggle-enabled`})),Ne.length===0&&Ne.push({label:`Back`,value:`back`}),(0,H.jsxs)(u,{flexDirection:`column`,children:[(0,H.jsxs)(u,{flexDirection:`column`,paddingX:1,borderStyle:s?void 0:`round`,children:[(0,H.jsx)(u,{marginBottom:1,children:(0,H.jsxs)(f,{bold:!0,children:[Ce,` MCP Server`]})}),(0,H.jsxs)(u,{flexDirection:`column`,gap:0,children:[(0,H.jsxs)(u,{children:[(0,H.jsx)(f,{bold:!0,children:`Status: `}),e.client.type===`disabled`?(0,H.jsxs)(f,{children:[v(`inactive`,c)(a.radioOff),` disabled`]}):e.client.type===`connected`?(0,H.jsxs)(f,{children:[v(`success`,c)(a.tick),` connected`]}):e.client.type===`pending`?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(f,{dimColor:!0,children:a.radioOff}),(0,H.jsx)(f,{children:` connecting…`})]}):e.client.type===`needs-auth`?(0,H.jsxs)(f,{children:[v(`warning`,c)(a.triangleUpOutline),` needs authentication`]}):(0,H.jsxs)(f,{children:[v(`error`,c)(a.cross),` failed`]})]}),e.transport!==`claudeai-proxy`&&(0,H.jsxs)(u,{children:[(0,H.jsx)(f,{bold:!0,children:`Auth: `}),ye?(0,H.jsxs)(f,{children:[v(`success`,c)(a.tick),` authenticated`]}):(0,H.jsxs)(f,{children:[v(`error`,c)(a.cross),` not authenticated`]})]}),(0,H.jsxs)(u,{children:[(0,H.jsx)(f,{bold:!0,children:`URL: `}),(0,H.jsx)(f,{dimColor:!0,children:e.config.url})]}),(0,H.jsxs)(u,{children:[(0,H.jsx)(f,{bold:!0,children:`Config location: `}),(0,H.jsx)(f,{dimColor:!0,children:je(e.scope)})]}),e.client.type===`connected`&&(0,H.jsx)(En,{serverToolsCount:t,serverPromptsCount:we,serverResourcesCount:te.resources[e.name]?.length||0}),e.client.type===`connected`&&t>0&&(0,H.jsxs)(u,{children:[(0,H.jsx)(f,{bold:!0,children:`Tools: `}),(0,H.jsxs)(f,{dimColor:!0,children:[t,` tools`]})]})]}),S&&(0,H.jsx)(u,{marginTop:1,children:(0,H.jsxs)(f,{color:`error`,children:[`Error: `,S]})}),Ne.length>0&&(0,H.jsx)(u,{marginTop:1,children:(0,H.jsx)(qe,{options:Ne,onChange:async t=>{switch(t){case`tools`:n();break;case`auth`:case`reauth`:await Ae();break;case`clear-auth`:await Me();break;case`claudeai-auth`:await De();break;case`claudeai-clear-auth`:Oe();break;case`reconnectMcpServer`:D(!0);try{let t=await z(e.name);e.config.type===`claudeai-proxy`&&Nt(`tengu_claudeai_mcp_reconnect`,{success:t.client.type===`connected`});let{message:n}=kn(t,e.name);i?.(n)}catch(t){e.config.type===`claudeai-proxy`&&Nt(`tengu_claudeai_mcp_reconnect`,{success:!1}),i?.(An(t,e.name))}finally{D(!1)}break;case`toggle-enabled`:await ke();break;case`back`:r();break}},onCancel:r})})]}),(0,H.jsx)(u,{marginTop:1,children:(0,H.jsx)(f,{dimColor:!0,italic:!0,children:m.pending?(0,H.jsxs)(H.Fragment,{children:[`Press `,m.keyName,` again to exit`]}):(0,H.jsxs)(p,{children:[(0,H.jsx)(o,{shortcut:`↑↓`,action:`navigate`}),(0,H.jsx)(o,{shortcut:`Enter`,action:`select`}),(0,H.jsx)(B,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]})})})]})}var V,H,Nn=e((()=>{i(),V=t(g(),1),Mt(),Lt(),vn(),R(),C(),qt(),E(),Te(),hn(),N(),L(),Vt(),Yt(),ht(),At(),Bt(),I(),Ae(),k(),re(),On(),jn(),H=T()}));function Pn({server:e,serverToolsCount:t,onViewTools:n,onCancel:r,onComplete:i,borderless:s=!1}){let[c]=l(),d=_n(),ee=me(e=>e.mcp),m=gn(),h=mn(),[g,_]=(0,Fn.useState)(!1),y=Fn.useCallback(async()=>{let t=e.client.type!==`disabled`;try{await h(e.name),r()}catch(n){i(`Failed to ${t?`disable`:`enable`} MCP server '${e.name}': ${ut(n)}`)}},[e.client.type,e.name,h,r,i]),b=zt(String(e.name)),x=ot(ee.commands,e.name).length,S=[];return e.client.type!==`disabled`&&t>0&&S.push({label:`View tools`,value:`tools`}),e.client.type!==`disabled`&&S.push({label:`Reconnect`,value:`reconnectMcpServer`}),S.push({label:e.client.type===`disabled`?`Enable`:`Disable`,value:`toggle-enabled`}),S.length===0&&S.push({label:`Back`,value:`back`}),g?(0,U.jsxs)(u,{flexDirection:`column`,gap:1,padding:1,children:[(0,U.jsxs)(f,{color:`text`,children:[`Reconnecting to `,(0,U.jsx)(f,{bold:!0,children:e.name})]}),(0,U.jsxs)(u,{children:[(0,U.jsx)(se,{}),(0,U.jsx)(f,{children:` Restarting MCP server process`})]}),(0,U.jsx)(f,{dimColor:!0,children:`This may take a few moments.`})]}):(0,U.jsxs)(u,{flexDirection:`column`,children:[(0,U.jsxs)(u,{flexDirection:`column`,paddingX:1,borderStyle:s?void 0:`round`,children:[(0,U.jsx)(u,{marginBottom:1,children:(0,U.jsxs)(f,{bold:!0,children:[b,` MCP Server`]})}),(0,U.jsxs)(u,{flexDirection:`column`,gap:0,children:[(0,U.jsxs)(u,{children:[(0,U.jsx)(f,{bold:!0,children:`Status: `}),e.client.type===`disabled`?(0,U.jsxs)(f,{children:[v(`inactive`,c)(a.radioOff),` disabled`]}):e.client.type===`connected`?(0,U.jsxs)(f,{children:[v(`success`,c)(a.tick),` connected`]}):e.client.type===`pending`?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(f,{dimColor:!0,children:a.radioOff}),(0,U.jsx)(f,{children:` connecting…`})]}):(0,U.jsxs)(f,{children:[v(`error`,c)(a.cross),` failed`]})]}),(0,U.jsxs)(u,{children:[(0,U.jsx)(f,{bold:!0,children:`Command: `}),(0,U.jsx)(f,{dimColor:!0,children:e.config.command})]}),e.config.args&&e.config.args.length>0&&(0,U.jsxs)(u,{children:[(0,U.jsx)(f,{bold:!0,children:`Args: `}),(0,U.jsx)(f,{dimColor:!0,children:e.config.args.join(` `)})]}),(0,U.jsxs)(u,{children:[(0,U.jsx)(f,{bold:!0,children:`Config location: `}),(0,U.jsx)(f,{dimColor:!0,children:je(ue(e.name)?.scope??`dynamic`)})]}),e.client.type===`connected`&&(0,U.jsx)(En,{serverToolsCount:t,serverPromptsCount:x,serverResourcesCount:ee.resources[e.name]?.length||0}),e.client.type===`connected`&&t>0&&(0,U.jsxs)(u,{children:[(0,U.jsx)(f,{bold:!0,children:`Tools: `}),(0,U.jsxs)(f,{dimColor:!0,children:[t,` tools`]})]})]}),S.length>0&&(0,U.jsx)(u,{marginTop:1,children:(0,U.jsx)(qe,{options:S,onChange:async t=>{if(t===`tools`)n();else if(t===`reconnectMcpServer`){_(!0);try{let{message:t}=kn(await m(e.name),e.name);i?.(t)}catch(t){i?.(An(t,e.name))}finally{_(!1)}}else t===`toggle-enabled`?await y():t===`back`&&r()},onCancel:r})})]}),(0,U.jsx)(u,{marginTop:1,children:(0,U.jsx)(f,{dimColor:!0,italic:!0,children:d.pending?(0,U.jsxs)(U.Fragment,{children:[`Press `,d.keyName,` again to exit`]}):(0,U.jsxs)(p,{children:[(0,U.jsx)(o,{shortcut:`↑↓`,action:`navigate`}),(0,U.jsx)(o,{shortcut:`Enter`,action:`select`}),(0,U.jsx)(B,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]})})})]})}var Fn,U,In=e((()=>{i(),Fn=t(g(),1),vn(),C(),fe(),hn(),N(),L(),ht(),Bt(),I(),Ae(),k(),On(),jn(),U=T()}));function Ln({tool:e,server:t,onBack:n}){let[r,i]=Rn.useState(``),a=yt(e.name,t.name),o=Tt(e.userFacingName?e.userFacingName({}):a),s=e.isReadOnly?.({})??!1,c=e.isDestructive?.({})??!1,l=e.isOpenWorld?.({})??!1;return Rn.useEffect(()=>{async function t(){try{let t=await e.description({},{isNonInteractiveSession:!1,toolPermissionContext:{mode:`default`,additionalWorkingDirectories:new Map,alwaysAllowRules:{},alwaysDenyRules:{},alwaysAskRules:{},isBypassPermissionsModeAvailable:!1},tools:[]});i(t)}catch{i(`Failed to load description`)}}t()},[e]),(0,W.jsx)(w,{title:(0,W.jsxs)(W.Fragment,{children:[o,s&&(0,W.jsx)(f,{color:`success`,children:` [read-only]`}),c&&(0,W.jsx)(f,{color:`error`,children:` [destructive]`}),l&&(0,W.jsx)(f,{dimColor:!0,children:` [open-world]`})]}),subtitle:t.name,onCancel:n,inputGuide:e=>e.pending?(0,W.jsxs)(f,{children:[`Press `,e.keyName,` again to exit`]}):(0,W.jsx)(B,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`}),children:(0,W.jsxs)(u,{flexDirection:`column`,children:[(0,W.jsxs)(u,{children:[(0,W.jsx)(f,{bold:!0,children:`Tool name: `}),(0,W.jsx)(f,{dimColor:!0,children:a})]}),(0,W.jsxs)(u,{children:[(0,W.jsx)(f,{bold:!0,children:`Full name: `}),(0,W.jsx)(f,{dimColor:!0,children:e.name})]}),r&&(0,W.jsxs)(u,{flexDirection:`column`,marginTop:1,children:[(0,W.jsx)(f,{bold:!0,children:`Description:`}),(0,W.jsx)(f,{wrap:`wrap`,children:r})]}),e.inputJSONSchema&&e.inputJSONSchema.properties&&Object.keys(e.inputJSONSchema.properties).length>0&&(0,W.jsxs)(u,{flexDirection:`column`,marginTop:1,children:[(0,W.jsx)(f,{bold:!0,children:`Parameters:`}),(0,W.jsx)(u,{marginLeft:2,flexDirection:`column`,children:Object.entries(e.inputJSONSchema.properties).map(([t,n])=>{let r=(e.inputJSONSchema?.required)?.includes(t);return(0,W.jsxs)(f,{children:[`• `,t,r&&(0,W.jsx)(f,{dimColor:!0,children:` (required)`}),`:`,` `,(0,W.jsx)(f,{dimColor:!0,children:typeof n==`object`&&n&&`type`in n?String(n.type):`unknown`}),typeof n==`object`&&n&&`description`in n&&(0,W.jsxs)(f,{dimColor:!0,children:[` - `,String(n.description)]})]},t)})})]})]})})}var Rn,W,zn=e((()=>{Rn=t(g(),1),C(),xt(),I(),W=T()}));function Bn({server:e,onSelectTool:t,onBack:n}){let r=me(e=>e.mcp.tools),i=Vn.useMemo(()=>e.client.type===`connected`?de(r,e.name):[],[e,r]),a=i.map((t,n)=>{let r=yt(t.name,e.name),i=Tt(t.userFacingName?t.userFacingName({}):r),a=t.isReadOnly?.({})??!1,o=t.isDestructive?.({})??!1,s=t.isOpenWorld?.({})??!1,c=[];return a&&c.push(`read-only`),o&&c.push(`destructive`),s&&c.push(`open-world`),{label:i,value:n.toString(),description:c.length>0?c.join(`, `):void 0,descriptionColor:o?`error`:a?`success`:void 0}});return(0,Hn.jsx)(w,{title:`Tools for ${e.name}`,subtitle:`${i.length} ${Rt(i.length,`tool`)}`,onCancel:n,inputGuide:e=>e.pending?(0,Hn.jsxs)(f,{children:[`Press `,e.keyName,` again to exit`]}):(0,Hn.jsxs)(p,{children:[(0,Hn.jsx)(o,{shortcut:`↑↓`,action:`navigate`}),(0,Hn.jsx)(o,{shortcut:`Enter`,action:`select`}),(0,Hn.jsx)(B,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]}),children:i.length===0?(0,Hn.jsx)(f,{dimColor:!0,children:`No tools available`}):(0,Hn.jsx)(qe,{options:a,onChange:e=>{let n=parseInt(e,10),r=i[n];r&&t(r,n)},onCancel:n})})}var Vn,Hn,Un=e((()=>{Vn=t(g(),1),C(),xt(),N(),L(),Bt(),I(),Ae(),Hn=T()}));function Wn({inputValue:e,setInputValue:t,cursorOffset:n,setCursorOffset:r,error:i,setError:a,result:s,setResult:c,setViewState:l,onAddComplete:d,cliMode:ee=!1}){let m=(0,Gn.useRef)(!1),[h,g]=(0,Gn.useState)(!1),[_,v]=(0,Gn.useState)(``),y=async()=>{let t=e.trim();if(!t){a(`Please enter a marketplace source`);return}let n=await sn(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 A(n,e=>{v(e)});ge(e,{source:t}),Le();let r=n.source;n.source===`github`&&(r=n.repo),Nt(`tengu_marketplace_added`,{source_type:r}),d&&await d(),v(``),g(!1),ee?c(`Successfully added marketplace: ${e}`):l({type:`browse-marketplace`,targetMarketplace:e})}catch(e){let t=ft(e);jt(t),a(t.message),v(``),g(!1),c(ee?`Error: ${t.message}`:null)}};return(0,Gn.useEffect)(()=>{e&&!m.current&&!i&&!s&&(m.current=!0,y())},[]),(0,G.jsxs)(u,{flexDirection:`column`,children:[(0,G.jsxs)(u,{flexDirection:`column`,paddingX:1,borderStyle:`round`,children:[(0,G.jsx)(u,{marginBottom:1,children:(0,G.jsx)(f,{bold:!0,children:`Add Marketplace`})}),(0,G.jsxs)(u,{flexDirection:`column`,children:[(0,G.jsx)(f,{children:`Enter marketplace source:`}),(0,G.jsx)(f,{dimColor:!0,children:`Examples:`}),(0,G.jsx)(f,{dimColor:!0,children:` · owner/repo (GitHub)`}),(0,G.jsx)(f,{dimColor:!0,children:` · git@github.com:owner/repo.git (SSH)`}),(0,G.jsx)(f,{dimColor:!0,children:` · https://example.com/marketplace.json`}),(0,G.jsx)(f,{dimColor:!0,children:` · ./path/to/marketplace`}),(0,G.jsx)(u,{marginTop:1,children:(0,G.jsx)(ce,{value:e,onChange:t,onSubmit:y,columns:80,cursorOffset:n,onChangeCursorOffset:r,focus:!0,showCursor:!0})})]}),h&&(0,G.jsxs)(u,{marginTop:1,children:[(0,G.jsx)(se,{}),(0,G.jsx)(f,{children:_||`Adding marketplace to configuration…`})]}),i&&(0,G.jsx)(u,{marginTop:1,children:(0,G.jsx)(f,{color:`error`,children:i})}),s&&(0,G.jsx)(u,{marginTop:1,children:(0,G.jsx)(f,{children:s})})]}),(0,G.jsx)(u,{marginLeft:3,children:(0,G.jsx)(f,{dimColor:!0,italic:!0,children:(0,G.jsxs)(p,{children:[(0,G.jsx)(o,{shortcut:`Enter`,action:`add`}),(0,G.jsx)(B,{action:`confirm:no`,context:`Settings`,fallback:`Esc`,description:`cancel`})]})})})]})}var Gn,G,Kn=e((()=>{g(),Gn=t(g(),1),Mt(),I(),C(),k(),re(),ht(),At(),rt(),pe(),ln(),G=T()}));function qn(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 Jn({title:e,subtitle:t,configSchema:n,initialValues:r,onSave:i,onCancel:o}){let l=Object.keys(n),d=(0,Yn.useCallback)(e=>{if(n[e]?.sensitive===!0)return``;let t=r?.[e];return t===void 0?``:String(t)},[n,r]),[p,m]=(0,Yn.useState)(0),[h,g]=(0,Yn.useState)({}),[v,y]=(0,Yn.useState)(()=>l[0]?d(l[0]):``),b=l[p],x=b?n[b]:null;if(ee(`confirm:no`,o,{context:`Settings`}),c({"confirm:nextField":(0,Yn.useCallback)(()=>{if(p<l.length-1&&b){g(e=>({...e,[b]:v})),m(e=>e+1);let e=l[p+1];y(e?d(e):``)}},[p,l,b,v,d]),"confirm:yes":(0,Yn.useCallback)(()=>{if(!b)return;let e={...h,[b]:v};if(p===l.length-1)i(qn(l,e,n,r));else{g(e),m(e=>e+1);let t=l[p+1];y(t?d(t):``)}},[b,h,v,p,l,n,i,d,r])},{context:`Confirmation`}),_((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 S=x.sensitive===!0,C=x.required===!0,te=S?`*`.repeat(s(v)):v;return(0,Xn.jsxs)(w,{title:e,subtitle:t,onCancel:o,isCancelActive:!1,children:[(0,Xn.jsxs)(u,{flexDirection:`column`,children:[(0,Xn.jsxs)(f,{bold:!0,children:[x.title||b,C&&(0,Xn.jsx)(f,{color:`error`,children:` *`})]}),x.description&&(0,Xn.jsx)(f,{dimColor:!0,children:x.description}),(0,Xn.jsxs)(u,{marginTop:1,children:[(0,Xn.jsxs)(f,{children:[a.pointerSmall,` `]}),(0,Xn.jsx)(f,{children:te}),(0,Xn.jsx)(f,{children:`█`})]})]}),(0,Xn.jsxs)(u,{flexDirection:`column`,children:[(0,Xn.jsxs)(f,{dimColor:!0,children:[`Field `,p+1,` of `,l.length]}),p<l.length-1&&(0,Xn.jsx)(f,{dimColor:!0,children:`Tab: Next field · Enter: Save and continue`}),p===l.length-1&&(0,Xn.jsx)(f,{dimColor:!0,children:`Enter: Save configuration`})]})]})}var Yn,Xn,Zn=e((()=>{i(),Yn=t(g(),1),C(),qt(),r(),Xn=T()}));async function Qn(e){let{enabled:t,disabled:n}=await Ke();return[...t,...n].find(t=>t.repository===e||t.source===e)}function $n({plugin:e,pluginId:t,onDone:n}){let[r]=er.useState(()=>{let n=[],r=nt(e);Object.keys(r).length>0&&n.push({key:`top-level`,title:`Configure ${e.name}`,subtitle:`Plugin options`,schema:r,load:()=>Xe(t),save:n=>Fe(t,n,e.manifest.userConfig)});let i=_e(e);for(let r of i)n.push({key:`channel:${r.server}`,title:`Configure ${r.displayName}`,subtitle:`Plugin: ${e.name}`,schema:r.configSchema,load:()=>$e(t,r.server)??void 0,save:e=>Re(t,r.server,e,r.configSchema)});return n}),[i,a]=er.useState(0),o=er.useRef(n);if(o.current=n,er.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`,ut(e));return}let t=i+1;t<r.length?a(t):n(`configured`)}return(0,tr.jsx)(Jn,{title:s.title,subtitle:s.subtitle,configSchema:s.schema,initialValues:s.load(),onSave:c,onCancel:()=>n(`skipped`)},s.key)}var er,tr,nr=e((()=>{er=t(g(),1),ht(),xe(),le(),ke(),Ue(),Zn(),tr=T()}));function rr(){let e=Ne();return(0,ir.jsxs)(u,{marginBottom:1,children:[(0,ir.jsxs)(f,{color:`claude`,children:[a.warning,` `]}),(0,ir.jsxs)(f,{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 ir,ar=e((()=>{i(),g(),C(),z(),ir=T()}));function or(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 sr(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 cr({hasSelection:e}){return(0,lr.jsx)(u,{marginTop:1,children:(0,lr.jsx)(f,{dimColor:!0,italic:!0,children:(0,lr.jsxs)(p,{children:[e&&(0,lr.jsx)(B,{action:`plugin:install`,context:`Plugin`,fallback:`i`,description:`install`,bold:!0}),(0,lr.jsx)(B,{action:`plugin:toggle`,context:`Plugin`,fallback:`Space`,description:`toggle`}),(0,lr.jsx)(B,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`details`}),(0,lr.jsx)(B,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]})})})}var lr,ur=e((()=>{g(),I(),C(),lr=T()}));function dr({totalItems:e,maxVisible:t=pr,selectedIndex:n=0}){let r=e>t,i=(0,fr.useRef)(0),a=(0,fr.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,fr.useCallback)(e=>r?e.slice(o,s):e,[r,o,s]),l=(0,fr.useCallback)(e=>o+e,[o]),u=(0,fr.useCallback)(e=>e>=o&&e<s,[o,s]),d=(0,fr.useCallback)(e=>{},[]),f=(0,fr.useCallback)(()=>{},[]),p=(0,fr.useCallback)(()=>{},[]),ee=(0,fr.useCallback)((t,n)=>{n(Math.max(0,Math.min(t,e-1)))},[e]),m=(0,fr.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:p,handleSelectionChange:ee,handlePageNavigation:m,scrollPosition:{current:n+1,total:e,canScrollUp:a>0,canScrollDown:a+t<e}}}var fr,pr,mr=e((()=>{fr=t(g(),1),pr=5}));function hr({error:e,setError:t,result:n,setResult:r,setViewState:i,onInstallComplete:o,targetMarketplace:s,targetPlugin:l}){let[d,m]=(0,_r.useState)(`marketplace-list`),[h,g]=(0,_r.useState)(null),[_,v]=(0,_r.useState)(null),[y,b]=(0,_r.useState)([]),[x,S]=(0,_r.useState)([]),[C,te]=(0,_r.useState)(!0),[w,T]=(0,_r.useState)(null),[E,O]=(0,_r.useState)(0),[k,A]=(0,_r.useState)(new Set),[re,ie]=(0,_r.useState)(new Set),oe=dr({totalItems:x.length,selectedIndex:E}),[j,M]=(0,_r.useState)(0),[se,N]=(0,_r.useState)(!1),[ce,le]=(0,_r.useState)(null),[ue,F]=(0,_r.useState)(null);ee(`confirm:no`,gr.useCallback(()=>{d===`plugin-list`?s?i({type:`manage-marketplaces`,targetMarketplace:s}):y.length===1?i({type:`menu`}):(m(`marketplace-list`),g(null),A(new Set)):d===`plugin-details`?(m(`plugin-list`),v(null)):i({type:`menu`})},[d,s,i,y.length]),{context:`Confirmation`}),(0,_r.useEffect)(()=>{async function e(){try{let e=await ae(),{marketplaces:n,failures:r}=await Qe(e),i=[];for(let{name:e,config:t,data:r}of n)if(r){let n=wt(r.plugins,t=>D(ne(t.name,e)));i.push({name:e,totalPlugins:r.plugins.length,installedCount:n,source:Ye(t.source)})}i.sort((e,t)=>e.name===`claude-plugin-directory`?-1:+(t.name===`claude-plugin-directory`)),b(i);let a=He(r,wt(n,e=>e.data!==null));if(a)if(a.type===`warning`)F(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 P(t);if(e){let i=e.plugins.find(e=>e.name===l);if(i){let e=ne(i.name,t);n={entry:i,marketplaceName:t,pluginId:e,isInstalled:Ie(e)},r=t;break}}}if(n&&r){let e=n.pluginId;Ie(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{te(!1)}}e()},[t,s,l]),(0,_r.useEffect)(()=>{if(!h)return;let e=!1;async function n(n){te(!0);try{let t=await P(n);if(e)return;if(!t)throw Error(`Failed to load marketplace: ${n}`);let r=[];for(let e of t.plugins){let t=ne(e.name,n);We(t)||r.push({entry:e,marketplaceName:n,pluginId:t,isInstalled:Ie(t)})}try{let t=await fn();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;mt(`Failed to fetch install counts: ${ut(t)}`),r.sort((e,t)=>e.entry.name.localeCompare(t.entry.name))}S(r),O(0),A(new Set)}catch(n){if(e)return;t(n instanceof Error?n.message:`Failed to load plugins`)}finally{te(!1)}}return n(h),()=>{e=!0}},[h,t]);let I=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 ct({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),Le(),a===0?r(`✓ Installed ${n} ${Rt(n,`plugin`)}. Run /reload-plugins to activate.`):n===0?t(`Failed to install: ${tt(s,!0)}`):r(`✓ Installed ${n} of ${n+a} plugins. Failed: ${tt(s,!1)}. Run /reload-plugins to activate successfully installed plugins.`),n>0&&o&&await o(),i({type:`menu`})},de=async(e,t=`user`)=>{N(!0),le(null);let n=await ct({pluginId:e.pluginId,entry:e.entry,marketplaceName:e.marketplaceName,scope:t});if(n.success){let t=await Qn(e.pluginId);if(t){N(!1),m({type:`plugin-options`,plugin:t,pluginId:e.pluginId});return}r(n.message),o&&await o(),i({type:`menu`})}else N(!1),le(n.error)};(0,_r.useEffect)(()=>{e&&r(e)},[e,r]),c({"select:previous":()=>{E>0&&O(E-1)},"select:next":()=>{E<y.length-1&&O(E+1)},"select:accept":()=>{let e=y[E];e&&(g(e.name),m(`plugin-list`))}},{context:`Select`,isActive:d===`marketplace-list`}),c({"select:previous":()=>{E>0&&oe.handleSelectionChange(E-1,O)},"select:next":()=>{E<x.length-1&&oe.handleSelectionChange(E+1,O)},"select:accept":()=>{if(E===x.length&&k.size>0)I();else if(E<x.length){let e=x[E];e&&(e.isInstalled?i({type:`manage-plugins`,targetPlugin:e.entry.name,targetMarketplace:e.marketplaceName}):(v(e),m(`plugin-details`),M(0),le(null)))}}},{context:`Select`,isActive:d===`plugin-list`}),c({"plugin:toggle":()=>{if(E<x.length){let e=x[E];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&&I()}},{context:`Plugin`,isActive:d===`plugin-list`});let L=gr.useMemo(()=>{if(!_)return[];let e=_.entry.homepage;return sr(e,or(_))},[_]);if(c({"select:previous":()=>{j>0&&M(j-1)},"select:next":()=>{j<L.length-1&&M(j+1)},"select:accept":()=>{if(!_)return;let e=L[j]?.action,t=_.entry.homepage,n=or(_);e===`install-user`?de(_,`user`):e===`install-project`?de(_,`project`):e===`install-local`?de(_,`local`):e===`homepage`&&t?Jt(t):e===`github`&&n?Jt(`https://github.com/${n}`):e===`back`&&(m(`plugin-list`),v(null))}},{context:`Select`,isActive:d===`plugin-details`&&!!_}),typeof d==`object`&&d.type===`plugin-options`){let{plugin:e,pluginId:t}=d;function n(e){r(e),o&&o(),i({type:`menu`})}return(0,K.jsx)($n,{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(C)return(0,K.jsx)(f,{children:`Loading…`});if(e)return(0,K.jsx)(f,{color:`error`,children:e});if(d===`marketplace-list`)return y.length===0?(0,K.jsxs)(u,{flexDirection:`column`,children:[(0,K.jsx)(u,{marginBottom:1,children:(0,K.jsx)(f,{bold:!0,children:`Select marketplace`})}),(0,K.jsx)(f,{children:`No marketplaces configured.`}),(0,K.jsxs)(f,{dimColor:!0,children:[`Add a marketplace first using `,`'Add marketplace'`,`.`]}),(0,K.jsx)(u,{marginTop:1,paddingLeft:1,children:(0,K.jsx)(f,{dimColor:!0,children:(0,K.jsx)(B,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`})})})]}):(0,K.jsxs)(u,{flexDirection:`column`,children:[(0,K.jsx)(u,{marginBottom:1,children:(0,K.jsx)(f,{bold:!0,children:`Select marketplace`})}),ue&&(0,K.jsx)(u,{marginBottom:1,flexDirection:`column`,children:(0,K.jsxs)(f,{color:`warning`,children:[a.warning,` `,ue]})}),y.map((e,t)=>(0,K.jsxs)(u,{flexDirection:`column`,marginBottom:+(t<y.length-1),children:[(0,K.jsx)(u,{children:(0,K.jsxs)(f,{color:E===t?`suggestion`:void 0,children:[E===t?a.pointer:` `,` `,e.name]})}),(0,K.jsx)(u,{marginLeft:2,children:(0,K.jsxs)(f,{dimColor:!0,children:[e.totalPlugins,` `,Rt(e.totalPlugins,`plugin`),` available`,e.installedCount>0&&` · ${e.installedCount} already installed`,e.source&&` · ${e.source}`]})})]},e.name)),(0,K.jsx)(u,{marginTop:1,children:(0,K.jsx)(f,{dimColor:!0,italic:!0,children:(0,K.jsxs)(p,{children:[(0,K.jsx)(B,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`select`}),(0,K.jsx)(B,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`})]})})})]});if(d===`plugin-details`&&_){let e=_.entry.homepage,t=sr(e,or(_));return(0,K.jsxs)(u,{flexDirection:`column`,children:[(0,K.jsx)(u,{marginBottom:1,children:(0,K.jsx)(f,{bold:!0,children:`Plugin Details`})}),(0,K.jsxs)(u,{flexDirection:`column`,marginBottom:1,children:[(0,K.jsx)(f,{bold:!0,children:_.entry.name}),_.entry.version&&(0,K.jsxs)(f,{dimColor:!0,children:[`Version: `,_.entry.version]}),_.entry.description&&(0,K.jsx)(u,{marginTop:1,children:(0,K.jsx)(f,{children:_.entry.description})}),_.entry.author&&(0,K.jsx)(u,{marginTop:1,children:(0,K.jsxs)(f,{dimColor:!0,children:[`By:`,` `,typeof _.entry.author==`string`?_.entry.author:_.entry.author.name]})})]}),(0,K.jsxs)(u,{flexDirection:`column`,marginBottom:1,children:[(0,K.jsx)(f,{bold:!0,children:`Will install:`}),_.entry.commands&&(0,K.jsxs)(f,{dimColor:!0,children:[`· Commands:`,` `,Array.isArray(_.entry.commands)?_.entry.commands.join(`, `):Object.keys(_.entry.commands).join(`, `)]}),_.entry.agents&&(0,K.jsxs)(f,{dimColor:!0,children:[`· Agents:`,` `,Array.isArray(_.entry.agents)?_.entry.agents.join(`, `):Object.keys(_.entry.agents).join(`, `)]}),_.entry.hooks&&(0,K.jsxs)(f,{dimColor:!0,children:[`· Hooks: `,Object.keys(_.entry.hooks).join(`, `)]}),_.entry.mcpServers&&(0,K.jsxs)(f,{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,K.jsx)(K.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,K.jsx)(f,{dimColor:!0,children:`· Component summary not available for remote plugin`}):(0,K.jsx)(f,{dimColor:!0,children:`· Components will be discovered at installation`})})]}),(0,K.jsx)(rr,{}),ce&&(0,K.jsx)(u,{marginBottom:1,children:(0,K.jsxs)(f,{color:`error`,children:[`Error: `,ce]})}),(0,K.jsx)(u,{flexDirection:`column`,children:t.map((e,t)=>(0,K.jsxs)(u,{children:[j===t&&(0,K.jsx)(f,{children:`> `}),j!==t&&(0,K.jsx)(f,{children:` `}),(0,K.jsx)(f,{bold:j===t,children:se&&e.action===`install`?`Installing…`:e.label})]},e.action))}),(0,K.jsx)(u,{marginTop:1,paddingLeft:1,children:(0,K.jsx)(f,{dimColor:!0,children:(0,K.jsxs)(p,{children:[(0,K.jsx)(B,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`select`}),(0,K.jsx)(B,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]})})})]})}if(x.length===0)return(0,K.jsxs)(u,{flexDirection:`column`,children:[(0,K.jsx)(u,{marginBottom:1,children:(0,K.jsx)(f,{bold:!0,children:`Install plugins`})}),(0,K.jsx)(f,{dimColor:!0,children:`No new plugins available to install.`}),(0,K.jsx)(f,{dimColor:!0,children:`All plugins from this marketplace are already installed.`}),(0,K.jsx)(u,{marginLeft:3,children:(0,K.jsx)(f,{dimColor:!0,italic:!0,children:(0,K.jsx)(B,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`})})})]});let fe=oe.getVisibleItems(x);return(0,K.jsxs)(u,{flexDirection:`column`,children:[(0,K.jsx)(u,{marginBottom:1,children:(0,K.jsx)(f,{bold:!0,children:`Install Plugins`})}),oe.scrollPosition.canScrollUp&&(0,K.jsx)(u,{children:(0,K.jsxs)(f,{dimColor:!0,children:[` `,a.arrowUp,` more above`]})}),fe.map((t,n)=>{let r=oe.toActualIndex(n),i=E===r,o=k.has(t.pluginId),s=re.has(t.pluginId);return(0,K.jsxs)(u,{flexDirection:`column`,marginBottom:n===fe.length-1&&!e?0:1,children:[(0,K.jsxs)(u,{children:[(0,K.jsxs)(f,{color:i?`suggestion`:void 0,children:[i?a.pointer:` `,` `]}),(0,K.jsxs)(f,{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,K.jsxs)(f,{dimColor:!0,children:[` [`,t.entry.category,`]`]}),t.entry.tags?.includes(`community-managed`)&&(0,K.jsx)(f,{dimColor:!0,children:` [Community Managed]`}),t.isInstalled&&(0,K.jsx)(f,{dimColor:!0,children:` (installed)`}),w&&h===`claude-plugins-official`&&(0,K.jsxs)(f,{dimColor:!0,children:[` · `,dn(w.get(t.pluginId)??0),` installs`]})]})]}),t.entry.description&&(0,K.jsxs)(u,{marginLeft:4,children:[(0,K.jsx)(f,{dimColor:!0,children:Pt(t.entry.description,60)}),t.entry.version&&(0,K.jsxs)(f,{dimColor:!0,children:[` · v`,t.entry.version]})]})]},t.pluginId)}),oe.scrollPosition.canScrollDown&&(0,K.jsx)(u,{children:(0,K.jsxs)(f,{dimColor:!0,children:[` `,a.arrowDown,` more below`]})}),e&&(0,K.jsx)(u,{marginTop:1,children:(0,K.jsxs)(f,{color:`error`,children:[a.cross,` `,e]})}),(0,K.jsx)(cr,{hasSelection:k.size>0})]})}var gr,_r,K,vr=e((()=>{i(),gr=t(g(),1),_r=t(g(),1),I(),C(),qt(),vt(),Yt(),pt(),ht(),rt(),cn(),O(),z(),pe(),et(),at(),be(),Bt(),Ft(),nr(),ar(),ur(),mr(),K=T()}));function yr({error:e,setError:t,result:n,setResult:r,setViewState:i,onInstallComplete:o,onSearchModeChange:s,targetPlugin:l}){let[d,h]=(0,q.useState)(`plugin-list`),[g,v]=(0,q.useState)(null),[b,S]=(0,q.useState)([]),[C,te]=(0,q.useState)(!0),[w,T]=(0,q.useState)(null),[E,D]=(0,q.useState)(!1),O=(0,q.useCallback)(e=>{D(e),s?.(e)},[s]),{query:k,setQuery:A,cursorOffset:re}=bn({isActive:d===`plugin-list`&&E&&!C,onExit:()=>{O(!1)}}),ie=m(),{columns:oe}=x(),j=(0,q.useMemo)(()=>{if(!k)return b;let e=k.toLowerCase();return b.filter(t=>t.entry.name.toLowerCase().includes(e)||t.entry.description?.toLowerCase().includes(e)||t.marketplaceName.toLowerCase().includes(e))},[b,k]),[M,se]=(0,q.useState)(0),[N,ce]=(0,q.useState)(new Set),[le,ue]=(0,q.useState)(new Set),P=dr({totalItems:j.length,selectedIndex:M});(0,q.useEffect)(()=>{se(0)},[k]);let[F,I]=(0,q.useState)(0),[de,L]=(0,q.useState)(!1),[fe,pe]=(0,q.useState)(null),[me,he]=(0,q.useState)(null),[ge,_e]=(0,q.useState)(null);(0,q.useEffect)(()=>{async function e(){try{let e=await ae(),{marketplaces:n,failures:r}=await Qe(e),i=[];for(let{name:e,data:t}of n)if(t)for(let n of t.plugins){let t=ne(n.name,e);i.push({entry:n,marketplaceName:e,pluginId:t,isInstalled:Ie(t)})}let a=i.filter(e=>!e.isInstalled&&!We(e.pluginId));try{let e=await fn();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){mt(`Failed to fetch install counts: ${ut(e)}`),a.sort((e,t)=>e.entry.name.localeCompare(t.entry.name))}S(a);let o=Object.keys(e).length;if(a.length===0){let e=await De({configuredMarketplaceCount:o,failedMarketplaceCount:r.length});_e(e)}let s=He(r,wt(n,e=>e.data!==null));if(s)if(s.type===`warning`)he(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.`):(v(e),h(`plugin-details`)):t(`Plugin "${l}" not found in any marketplace`)}}catch(e){t(e instanceof Error?e.message:`Failed to load plugins`)}finally{te(!1)}}e()},[t,l]);let ve=async()=>{if(N.size===0)return;let e=b.filter(e=>N.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 ct({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),Le(),a===0?r(`✓ Installed ${n} ${Rt(n,`plugin`)}. Run /reload-plugins to activate.`):n===0?t(`Failed to install: ${tt(s,!0)}`):r(`✓ Installed ${n} of ${n+a} plugins. Failed: ${tt(s,!1)}. Run /reload-plugins to activate successfully installed plugins.`),n>0&&o&&await o(),i({type:`menu`})},R=async(e,t=`user`)=>{L(!0),pe(null);let n=await ct({pluginId:e.pluginId,entry:e.entry,marketplaceName:e.marketplaceName,scope:t});if(n.success){let t=await Qn(e.pluginId);if(t){L(!1),h({type:`plugin-options`,plugin:t,pluginId:e.pluginId});return}r(n.message),o&&await o(),i({type:`menu`})}else L(!1),pe(n.error)};(0,q.useEffect)(()=>{e&&r(e)},[e,r]),ee(`confirm:no`,()=>{h(`plugin-list`),v(null)},{context:`Confirmation`,isActive:d===`plugin-details`}),ee(`confirm:no`,()=>{i({type:`menu`})},{context:`Confirmation`,isActive:d===`plugin-list`&&!E}),_((e,t)=>{let n=!t.ctrl&&!t.meta;E||(e===`/`&&n?(O(!0),A(``)):n&&e.length>0&&!/^\s+$/.test(e)&&e!==`j`&&e!==`k`&&e!==`i`&&(O(!0),A(e)))},{isActive:d===`plugin-list`&&!C}),c({"select:previous":()=>{M===0?O(!0):P.handleSelectionChange(M-1,se)},"select:next":()=>{M<j.length-1&&P.handleSelectionChange(M+1,se)},"select:accept":()=>{if(M===j.length&&N.size>0)ve();else if(M<j.length){let e=j[M];e&&(e.isInstalled?i({type:`manage-plugins`,targetPlugin:e.entry.name,targetMarketplace:e.marketplaceName}):(v(e),h(`plugin-details`),I(0),pe(null)))}}},{context:`Select`,isActive:d===`plugin-list`&&!E}),c({"plugin:toggle":()=>{if(M<j.length){let e=j[M];if(e&&!e.isInstalled){let t=new Set(N);t.has(e.pluginId)?t.delete(e.pluginId):t.add(e.pluginId),ce(t)}}},"plugin:install":()=>{N.size>0&&ve()}},{context:`Plugin`,isActive:d===`plugin-list`&&!E});let ye=Sr.useMemo(()=>{if(!g)return[];let e=g.entry.homepage;return sr(e,or(g))},[g]);if(c({"select:previous":()=>{F>0&&I(F-1)},"select:next":()=>{F<ye.length-1&&I(F+1)},"select:accept":()=>{if(!g)return;let e=ye[F]?.action,t=g.entry.homepage,n=or(g);e===`install-user`?R(g,`user`):e===`install-project`?R(g,`project`):e===`install-local`?R(g,`local`):e===`homepage`&&t?Jt(t):e===`github`&&n?Jt(`https://github.com/${n}`):e===`back`&&(h(`plugin-list`),v(null))}},{context:`Select`,isActive:d===`plugin-details`&&!!g}),typeof d==`object`&&d.type===`plugin-options`){let{plugin:e,pluginId:t}=d;function n(e){r(e),o&&o(),i({type:`menu`})}return(0,J.jsx)($n,{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(C)return(0,J.jsx)(f,{children:`Loading…`});if(e)return(0,J.jsx)(f,{color:`error`,children:e});if(d===`plugin-details`&&g){let e=g.entry.homepage,t=sr(e,or(g));return(0,J.jsxs)(u,{flexDirection:`column`,children:[(0,J.jsx)(u,{marginBottom:1,children:(0,J.jsx)(f,{bold:!0,children:`Plugin details`})}),(0,J.jsxs)(u,{flexDirection:`column`,marginBottom:1,children:[(0,J.jsx)(f,{bold:!0,children:g.entry.name}),(0,J.jsxs)(f,{dimColor:!0,children:[`from `,g.marketplaceName]}),g.entry.version&&(0,J.jsxs)(f,{dimColor:!0,children:[`Version: `,g.entry.version]}),g.entry.description&&(0,J.jsx)(u,{marginTop:1,children:(0,J.jsx)(f,{children:g.entry.description})}),g.entry.author&&(0,J.jsx)(u,{marginTop:1,children:(0,J.jsxs)(f,{dimColor:!0,children:[`By:`,` `,typeof g.entry.author==`string`?g.entry.author:g.entry.author.name]})})]}),(0,J.jsx)(rr,{}),fe&&(0,J.jsx)(u,{marginBottom:1,children:(0,J.jsxs)(f,{color:`error`,children:[`Error: `,fe]})}),(0,J.jsx)(u,{flexDirection:`column`,children:t.map((e,t)=>(0,J.jsxs)(u,{children:[F===t&&(0,J.jsx)(f,{children:`> `}),F!==t&&(0,J.jsx)(f,{children:` `}),(0,J.jsx)(f,{bold:F===t,children:de&&e.action.startsWith(`install-`)?`Installing…`:e.label})]},e.action))}),(0,J.jsx)(u,{marginTop:1,children:(0,J.jsx)(f,{dimColor:!0,children:(0,J.jsxs)(p,{children:[(0,J.jsx)(B,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`select`}),(0,J.jsx)(B,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]})})})]})}if(b.length===0)return(0,J.jsxs)(u,{flexDirection:`column`,children:[(0,J.jsx)(u,{marginBottom:1,children:(0,J.jsx)(f,{bold:!0,children:`Discover plugins`})}),(0,J.jsx)(xr,{reason:ge}),(0,J.jsx)(u,{marginTop:1,children:(0,J.jsx)(f,{dimColor:!0,italic:!0,children:`Esc to go back`})})]});let z=P.getVisibleItems(j);return(0,J.jsxs)(u,{flexDirection:`column`,children:[(0,J.jsxs)(u,{children:[(0,J.jsx)(f,{bold:!0,children:`Discover plugins`}),P.needsPagination&&(0,J.jsxs)(f,{dimColor:!0,children:[` `,`(`,P.scrollPosition.current,`/`,P.scrollPosition.total,`)`]})]}),(0,J.jsx)(u,{marginBottom:1,children:(0,J.jsx)(y,{query:k,isFocused:E,isTerminalFocused:ie,width:oe-4,cursorOffset:re})}),me&&(0,J.jsx)(u,{marginBottom:1,children:(0,J.jsxs)(f,{color:`warning`,children:[a.warning,` `,me]})}),j.length===0&&k&&(0,J.jsx)(u,{marginBottom:1,children:(0,J.jsxs)(f,{dimColor:!0,children:[`No plugins match "`,k,`"`]})}),P.scrollPosition.canScrollUp&&(0,J.jsx)(u,{children:(0,J.jsxs)(f,{dimColor:!0,children:[` `,a.arrowUp,` more above`]})}),z.map((t,n)=>{let r=P.toActualIndex(n),i=M===r,o=N.has(t.pluginId),s=le.has(t.pluginId);return(0,J.jsxs)(u,{flexDirection:`column`,marginBottom:n===z.length-1&&!e?0:1,children:[(0,J.jsxs)(u,{children:[(0,J.jsxs)(f,{color:i&&!E?`suggestion`:void 0,children:[i&&!E?a.pointer:` `,` `]}),(0,J.jsxs)(f,{children:[s?a.ellipsis:o?a.radioOn:a.radioOff,` `,t.entry.name,(0,J.jsxs)(f,{dimColor:!0,children:[` · `,t.marketplaceName]}),t.entry.tags?.includes(`community-managed`)&&(0,J.jsx)(f,{dimColor:!0,children:` [Community Managed]`}),w&&t.marketplaceName===`claude-plugins-official`&&(0,J.jsxs)(f,{dimColor:!0,children:[` · `,dn(w.get(t.pluginId)??0),` installs`]})]})]}),t.entry.description&&(0,J.jsx)(u,{marginLeft:4,children:(0,J.jsx)(f,{dimColor:!0,children:Pt(t.entry.description,60)})})]},`${P.startIndex}-${t.pluginId}`)}),P.scrollPosition.canScrollDown&&(0,J.jsx)(u,{children:(0,J.jsxs)(f,{dimColor:!0,children:[` `,a.arrowDown,` more below`]})}),e&&(0,J.jsx)(u,{marginTop:1,children:(0,J.jsxs)(f,{color:`error`,children:[a.cross,` `,e]})}),(0,J.jsx)(br,{hasSelection:N.size>0,canToggle:M<j.length&&!j[M]?.isInstalled})]})}function br({hasSelection:e,canToggle:t}){return(0,J.jsx)(u,{marginTop:1,children:(0,J.jsx)(f,{dimColor:!0,italic:!0,children:(0,J.jsxs)(p,{children:[e&&(0,J.jsx)(B,{action:`plugin:install`,context:`Plugin`,fallback:`i`,description:`install`,bold:!0}),(0,J.jsx)(f,{children:`type to search`}),t&&(0,J.jsx)(B,{action:`plugin:toggle`,context:`Plugin`,fallback:`Space`,description:`toggle`}),(0,J.jsx)(B,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`details`}),(0,J.jsx)(B,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]})})})}function xr({reason:e}){switch(e){case`git-not-installed`:return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(f,{dimColor:!0,children:`Git is required to install marketplaces.`}),(0,J.jsx)(f,{dimColor:!0,children:`Please install git and restart Work Mate.`})]});case`all-blocked-by-policy`:return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(f,{dimColor:!0,children:`Your organization policy does not allow any external marketplaces.`}),(0,J.jsx)(f,{dimColor:!0,children:`Contact your administrator.`})]});case`policy-restricts-sources`:return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(f,{dimColor:!0,children:`Your organization restricts which marketplaces can be added.`}),(0,J.jsx)(f,{dimColor:!0,children:`Switch to the Marketplaces tab to view allowed sources.`})]});case`all-marketplaces-failed`:return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(f,{dimColor:!0,children:`Failed to load marketplace data.`}),(0,J.jsx)(f,{dimColor:!0,children:`Check your network connection.`})]});case`all-plugins-installed`:return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(f,{dimColor:!0,children:`All available plugins are already installed.`}),(0,J.jsx)(f,{dimColor:!0,children:`Check for new plugins later or add more marketplaces.`})]});default:return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(f,{dimColor:!0,children:`No plugins available.`}),(0,J.jsx)(f,{dimColor:!0,children:`Add a marketplace first using the Marketplaces tab.`})]})}}var Sr,q,J,Cr=e((()=>{i(),Sr=t(g(),1),q=t(g(),1),I(),yn(),C(),xn(),R(),qt(),vt(),Yt(),pt(),ht(),rt(),cn(),O(),z(),pe(),et(),at(),be(),Bt(),Ft(),nr(),ar(),ur(),mr(),J=T()}));function wr({setViewState:e,error:t,setError:n,setResult:r,exitState:i,onManageComplete:o,targetMarketplace:s,action:l}){let[d,m]=(0,Er.useState)([]),[h,g]=(0,Er.useState)(!0),[v,y]=(0,Er.useState)(0),[b,x]=(0,Er.useState)(!1),[S,C]=(0,Er.useState)(null),[te,w]=(0,Er.useState)(null),[T,E]=(0,Er.useState)(null),[D,O]=(0,Er.useState)(`list`),[k,A]=(0,Er.useState)(null),[re,oe]=(0,Er.useState)(0),j=(0,Er.useRef)(!1);(0,Er.useEffect)(()=>{async function e(){try{let e=await ae(),{enabled:r,disabled:i}=await Ke(),a=[...r,...i],{marketplaces:o,failures:c}=await Qe(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:Ye(t.source),lastUpdated:t.lastUpdated,pluginCount:n?.plugins.length,installedPlugins:r,pendingUpdate:!1,pendingRemove:!1,autoUpdate:_t(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=He(c,wt(o,e=>e.data!==null));if(d)if(d.type===`warning`)C(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(N,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`),C(e instanceof Error?e.message:`Failed to load marketplaces`)}finally{g(!1)}}e()},[s,l,t]);let M=()=>d.some(e=>e.pendingUpdate||e.pendingRemove),se=()=>({updateCount:wt(d,e=>e.pendingUpdate),removeCount:wt(d,e=>e.pendingRemove)}),N=async t=>{let i=t||d,s=D===`details`;x(!0),C(null),w(null),E(null);try{let t=bt(`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=ne(t.name,e.name);n[r]=!1}Et(`userSettings`,{enabledPlugins:n})}await Je(e.name),c++,Nt(`tengu_marketplace_removed`,{marketplace_name:e.name,plugins_uninstalled:e.installedPlugins?.length||0});continue}e.pendingUpdate&&(await ie(e.name,e=>{E(e)}),n++,l.add(e.name.toLowerCase()),Nt(`tengu_marketplace_updated`,{marketplace_name:e.name}))}let u=0;l.size>0&&(u=(await Sn(l)).length),Le(),o&&await o();let d=await ae(),{enabled:f,disabled:p}=await Ke(),ee=[...f,...p],{marketplaces:h}=await Qe(d),g=[];for(let{name:e,config:t,data:n}of h){let r=ee.filter(t=>t.source.endsWith(`@${e}`));g.push({name:e,source:Ye(t.source),lastUpdated:t.lastUpdated,pluginCount:n?.plugins.length,installedPlugins:r,pendingUpdate:!1,pendingRemove:!1,autoUpdate:_t(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} ${Rt(u,`plugin`)} bumped)`:``;_.push(`Updated ${n} ${Rt(n,`marketplace`)}${e}`)}if(c>0&&_.push(`Removed ${c} ${Rt(c,`marketplace`)}`),_.length>0){let t=`${a.tick} ${_.join(`, `)}`;s?w(t):(r(t),setTimeout(e,2e3,{type:`menu`}))}else s||e({type:`menu`})}catch(e){let t=ut(e);C(t),n&&n(t)}finally{x(!1),E(null)}},ce=async()=>{if(!k)return;let e=d.map(e=>e.name===k.name?{...e,pendingRemove:!0}:e);m(e),await N(e)},le=e=>{if(!e)return[];let t=[{label:`Browse plugins (${e.pluginCount??0})`,value:`browse`},{label:`Update marketplace`,secondaryLabel:e.lastUpdated?`(last updated ${new Date(e.lastUpdated).toLocaleDateString()})`:void 0,value:`update`}];return Ot()||t.push({label:e.autoUpdate?`Disable auto-update`:`Enable auto-update`,value:`toggle-auto-update`}),t.push({label:`Remove marketplace`,value:`remove`}),t},ue=async e=>{let t=!e.autoUpdate;try{await he(e.name,t),m(n=>n.map(n=>n.name===e.name?{...n,autoUpdate:t}:n)),A(e=>e&&{...e,autoUpdate:t})}catch(e){C(e instanceof Error?e.message:`Failed to update setting`)}};if(ee(`confirm:no`,()=>{O(`list`),oe(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=d.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())N();else{let e=d[t];e&&(A(e),O(`details`),oe(0))}}},{context:`Select`,isActive:!b&&D===`list`}),_(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=d[t];e&&(A(e),O(`confirm-remove`))}},{isActive:!b&&D===`list`}),c({"select:previous":()=>oe(e=>Math.max(0,e-1)),"select:next":()=>{let e=le(k);oe(t=>Math.min(e.length-1,t+1))},"select:accept":()=>{if(!k)return;let t=le(k)[re];if(t?.value===`browse`)e({type:`browse-marketplace`,targetMarketplace:k.name});else if(t?.value===`update`){let e=d.map(e=>e.name===k.name?{...e,pendingUpdate:!0}:e);m(e),N(e)}else t?.value===`toggle-auto-update`?ue(k):t?.value===`remove`&&O(`confirm-remove`)}},{context:`Select`,isActive:!b&&D===`details`}),_(e=>{e===`y`||e===`Y`?ce():(e===`n`||e===`N`)&&(O(`list`),A(null))},{isActive:!b&&D===`confirm-remove`}),h)return(0,Y.jsx)(f,{children:`Loading marketplaces…`});if(d.length===0)return(0,Y.jsxs)(u,{flexDirection:`column`,children:[(0,Y.jsx)(u,{marginBottom:1,children:(0,Y.jsx)(f,{bold:!0,children:`Manage marketplaces`})}),(0,Y.jsxs)(u,{flexDirection:`row`,gap:1,children:[(0,Y.jsxs)(f,{color:`suggestion`,children:[a.pointer,` +`]}),(0,Y.jsx)(f,{bold:!0,color:`suggestion`,children:`Add Marketplace`})]}),(0,Y.jsx)(u,{marginLeft:3,children:(0,Y.jsx)(f,{dimColor:!0,italic:!0,children:i.pending?(0,Y.jsxs)(Y.Fragment,{children:[`Press `,i.keyName,` again to go back`]}):(0,Y.jsxs)(p,{children:[(0,Y.jsx)(B,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`select`}),(0,Y.jsx)(B,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`})]})})})]});if(D===`confirm-remove`&&k){let e=k.installedPlugins?.length||0;return(0,Y.jsxs)(u,{flexDirection:`column`,children:[(0,Y.jsxs)(f,{bold:!0,color:`warning`,children:[`Remove marketplace `,(0,Y.jsx)(f,{italic:!0,children:k.name}),`?`]}),(0,Y.jsxs)(u,{flexDirection:`column`,children:[e>0&&(0,Y.jsx)(u,{marginTop:1,children:(0,Y.jsxs)(f,{color:`warning`,children:[`This will also uninstall `,e,` `,Rt(e,`plugin`),` from this marketplace:`]})}),k.installedPlugins&&k.installedPlugins.length>0&&(0,Y.jsx)(u,{flexDirection:`column`,marginTop:1,marginLeft:2,children:k.installedPlugins.map(e=>(0,Y.jsxs)(f,{dimColor:!0,children:[`• `,e.name]},e.name))}),(0,Y.jsx)(u,{marginTop:1,children:(0,Y.jsxs)(f,{children:[`Press `,(0,Y.jsx)(f,{bold:!0,children:`y`}),` to confirm or `,(0,Y.jsx)(f,{bold:!0,children:`n`}),` to cancel`]})})]})]})}if(D===`details`&&k){let e=k.pendingUpdate||b,t=le(k);return(0,Y.jsxs)(u,{flexDirection:`column`,children:[(0,Y.jsx)(f,{bold:!0,children:k.name}),(0,Y.jsx)(f,{dimColor:!0,children:k.source}),(0,Y.jsx)(u,{marginTop:1,children:(0,Y.jsxs)(f,{children:[k.pluginCount||0,` available `,Rt(k.pluginCount||0,`plugin`)]})}),k.installedPlugins&&k.installedPlugins.length>0&&(0,Y.jsxs)(u,{flexDirection:`column`,marginTop:1,children:[(0,Y.jsxs)(f,{bold:!0,children:[`Installed plugins (`,k.installedPlugins.length,`):`]}),(0,Y.jsx)(u,{flexDirection:`column`,marginLeft:1,children:k.installedPlugins.map(e=>(0,Y.jsxs)(u,{flexDirection:`row`,gap:1,children:[(0,Y.jsx)(f,{children:a.bullet}),(0,Y.jsxs)(u,{flexDirection:`column`,children:[(0,Y.jsx)(f,{children:e.name}),(0,Y.jsx)(f,{dimColor:!0,children:e.manifest.description})]})]},e.name))})]}),e&&(0,Y.jsxs)(u,{marginTop:1,flexDirection:`column`,children:[(0,Y.jsx)(f,{color:`claude`,children:`Updating marketplace…`}),T&&(0,Y.jsx)(f,{dimColor:!0,children:T})]}),!e&&te&&(0,Y.jsx)(u,{marginTop:1,children:(0,Y.jsx)(f,{color:`claude`,children:te})}),!e&&S&&(0,Y.jsx)(u,{marginTop:1,children:(0,Y.jsx)(f,{color:`error`,children:S})}),!e&&(0,Y.jsx)(u,{flexDirection:`column`,marginTop:1,children:t.map((e,t)=>{if(!e)return null;let n=t===re;return(0,Y.jsxs)(u,{children:[(0,Y.jsxs)(f,{color:n?`suggestion`:void 0,children:[n?a.pointer:` `,` `,e.label]}),e.secondaryLabel&&(0,Y.jsxs)(f,{dimColor:!0,children:[` `,e.secondaryLabel]})]},e.value)})}),!e&&!Ot()&&k.autoUpdate&&(0,Y.jsx)(u,{marginTop:1,children:(0,Y.jsx)(f,{dimColor:!0,children:`Auto-update enabled. Work Mate will automatically update this marketplace and its installed plugins.`})}),(0,Y.jsx)(u,{marginLeft:3,children:(0,Y.jsx)(f,{dimColor:!0,italic:!0,children:e?(0,Y.jsx)(Y.Fragment,{children:`Please wait…`}):(0,Y.jsxs)(p,{children:[(0,Y.jsx)(B,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`select`}),(0,Y.jsx)(B,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`})]})})})]})}let{updateCount:P,removeCount:F}=se();return(0,Y.jsxs)(u,{flexDirection:`column`,children:[(0,Y.jsx)(u,{marginBottom:1,children:(0,Y.jsx)(f,{bold:!0,children:`Manage marketplaces`})}),(0,Y.jsxs)(u,{flexDirection:`row`,gap:1,marginBottom:1,children:[(0,Y.jsxs)(f,{color:v===0?`suggestion`:void 0,children:[v===0?a.pointer:` `,` +`]}),(0,Y.jsx)(f,{bold:!0,color:v===0?`suggestion`:void 0,children:`Add Marketplace`})]}),(0,Y.jsx)(u,{flexDirection:`column`,children:d.map((e,t)=>{let n=t+1===v,r=[];return e.pendingUpdate&&r.push(`UPDATE`),e.pendingRemove&&r.push(`REMOVE`),(0,Y.jsxs)(u,{flexDirection:`row`,gap:1,marginBottom:1,children:[(0,Y.jsxs)(f,{color:n?`suggestion`:void 0,children:[n?a.pointer:` `,` `,e.pendingRemove?a.cross:a.bullet]}),(0,Y.jsxs)(u,{flexDirection:`column`,flexGrow:1,children:[(0,Y.jsxs)(u,{flexDirection:`row`,gap:1,children:[(0,Y.jsxs)(f,{bold:!0,strikethrough:e.pendingRemove,dimColor:e.pendingRemove,children:[e.name===`claude-plugins-official`&&(0,Y.jsx)(f,{color:`claude`,children:`✻ `}),e.name,e.name===`claude-plugins-official`&&(0,Y.jsx)(f,{color:`claude`,children:` ✻`})]}),r.length>0&&(0,Y.jsxs)(f,{color:`warning`,children:[`[`,r.join(`, `),`]`]})]}),(0,Y.jsx)(f,{dimColor:!0,children:e.source}),(0,Y.jsxs)(f,{dimColor:!0,children:[e.pluginCount!==void 0&&(0,Y.jsxs)(Y.Fragment,{children:[e.pluginCount,` available`]}),e.installedPlugins&&e.installedPlugins.length>0&&(0,Y.jsxs)(Y.Fragment,{children:[` • `,e.installedPlugins.length,` installed`]}),e.lastUpdated&&(0,Y.jsxs)(Y.Fragment,{children:[` • Updated `,new Date(e.lastUpdated).toLocaleDateString()]})]})]})]},e.name)})}),M()&&(0,Y.jsxs)(u,{marginTop:1,flexDirection:`column`,children:[(0,Y.jsxs)(f,{children:[(0,Y.jsx)(f,{bold:!0,children:`Pending changes:`}),` `,(0,Y.jsx)(f,{dimColor:!0,children:`Enter to apply`})]}),P>0&&(0,Y.jsxs)(f,{children:[`• Update `,P,` `,Rt(P,`marketplace`)]}),F>0&&(0,Y.jsxs)(f,{color:`warning`,children:[`• Remove `,F,` `,Rt(F,`marketplace`)]})]}),b&&(0,Y.jsx)(u,{marginTop:1,children:(0,Y.jsx)(f,{color:`claude`,children:`Processing changes…`})}),S&&(0,Y.jsx)(u,{marginTop:1,children:(0,Y.jsx)(f,{color:`error`,children:S})}),(0,Y.jsx)(Tr,{exitState:i,hasPendingActions:M()})]})}function Tr({exitState:e,hasPendingActions:t}){return e.pending?(0,Y.jsx)(u,{marginTop:1,children:(0,Y.jsxs)(f,{dimColor:!0,italic:!0,children:[`Press `,e.keyName,` again to go back`]})}):(0,Y.jsx)(u,{marginTop:1,children:(0,Y.jsx)(f,{dimColor:!0,italic:!0,children:(0,Y.jsxs)(p,{children:[t&&(0,Y.jsx)(B,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`apply changes`}),!t&&(0,Y.jsx)(B,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`select`}),!t&&(0,Y.jsx)(o,{shortcut:`u`,action:`update`}),!t&&(0,Y.jsx)(o,{shortcut:`r`,action:`remove`}),(0,Y.jsx)(B,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:t?`cancel`:`go back`})]})})})}var Er,Y,Dr=e((()=>{i(),g(),Er=t(g(),1),Mt(),I(),C(),qt(),vt(),Dt(),ht(),rt(),z(),pe(),Cn(),ke(),gt(),Ct(),Bt(),Y=T()}));function Or(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 Be(e)}function kr(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 Ar=e((()=>{Me()}));function jr({item:e,isSelected:t}){let[n]=l();if(e.type===`plugin`){let r,i;return e.pendingToggle?(r=v(`suggestion`,n)(a.arrowRight),i=e.pendingToggle===`will-enable`?`will enable`:`will disable`):e.errorCount>0?(r=v(`error`,n)(a.cross),i=`${e.errorCount} ${Rt(e.errorCount,`error`)}`):e.isEnabled?(r=v(`success`,n)(a.tick),i=`enabled`):(r=v(`inactive`,n)(a.radioOff),i=`disabled`),(0,X.jsxs)(u,{children:[(0,X.jsx)(f,{color:t?`suggestion`:void 0,children:t?`${a.pointer} `:` `}),(0,X.jsx)(f,{color:t?`suggestion`:void 0,children:e.name}),(0,X.jsxs)(f,{dimColor:!t,children:[` `,(0,X.jsx)(f,{backgroundColor:`userMessageBackground`,children:`Plugin`})]}),(0,X.jsxs)(f,{dimColor:!0,children:[` · `,e.marketplace]}),(0,X.jsxs)(f,{dimColor:!t,children:[` · `,r,` `]}),(0,X.jsx)(f,{dimColor:!t,children:i})]})}if(e.type===`flagged-plugin`){let r=v(`warning`,n)(a.warning);return(0,X.jsxs)(u,{children:[(0,X.jsx)(f,{color:t?`suggestion`:void 0,children:t?`${a.pointer} `:` `}),(0,X.jsx)(f,{color:t?`suggestion`:void 0,children:e.name}),(0,X.jsxs)(f,{dimColor:!t,children:[` `,(0,X.jsx)(f,{backgroundColor:`userMessageBackground`,children:`Plugin`})]}),(0,X.jsxs)(f,{dimColor:!0,children:[` · `,e.marketplace]}),(0,X.jsxs)(f,{dimColor:!t,children:[` · `,r,` `]}),(0,X.jsx)(f,{dimColor:!t,children:`removed`})]})}if(e.type===`failed-plugin`){let r=v(`error`,n)(a.cross),i=`failed to load · ${e.errorCount} ${Rt(e.errorCount,`error`)}`;return(0,X.jsxs)(u,{children:[(0,X.jsx)(f,{color:t?`suggestion`:void 0,children:t?`${a.pointer} `:` `}),(0,X.jsx)(f,{color:t?`suggestion`:void 0,children:e.name}),(0,X.jsxs)(f,{dimColor:!t,children:[` `,(0,X.jsx)(f,{backgroundColor:`userMessageBackground`,children:`Plugin`})]}),(0,X.jsxs)(f,{dimColor:!0,children:[` · `,e.marketplace]}),(0,X.jsxs)(f,{dimColor:!t,children:[` · `,r,` `]}),(0,X.jsx)(f,{dimColor:!t,children:i})]})}let r,i;return e.status===`connected`?(r=v(`success`,n)(a.tick),i=`connected`):e.status===`disabled`?(r=v(`inactive`,n)(a.radioOff),i=`disabled`):e.status===`pending`?(r=v(`inactive`,n)(a.radioOff),i=`connecting…`):e.status===`needs-auth`?(r=v(`warning`,n)(a.triangleUpOutline),i=`Enter to auth`):(r=v(`error`,n)(a.cross),i=`failed`),e.indented?(0,X.jsxs)(u,{children:[(0,X.jsx)(f,{color:t?`suggestion`:void 0,children:t?`${a.pointer} `:` `}),(0,X.jsx)(f,{dimColor:!t,children:`└ `}),(0,X.jsx)(f,{color:t?`suggestion`:void 0,children:e.name}),(0,X.jsxs)(f,{dimColor:!t,children:[` `,(0,X.jsx)(f,{backgroundColor:`userMessageBackground`,children:`MCP`})]}),(0,X.jsxs)(f,{dimColor:!t,children:[` · `,r,` `]}),(0,X.jsx)(f,{dimColor:!t,children:i})]}):(0,X.jsxs)(u,{children:[(0,X.jsx)(f,{color:t?`suggestion`:void 0,children:t?`${a.pointer} `:` `}),(0,X.jsx)(f,{color:t?`suggestion`:void 0,children:e.name}),(0,X.jsxs)(f,{dimColor:!t,children:[` `,(0,X.jsx)(f,{backgroundColor:`userMessageBackground`,children:`MCP`})]}),(0,X.jsxs)(f,{dimColor:!t,children:[` · `,r,` `]}),(0,X.jsx)(f,{dimColor:!t,children:i})]})}var X,Mr=e((()=>{i(),g(),C(),Bt(),X=T()}));async function Nr(e){try{return(await Tn.readdir(e,{withFileTypes:!0})).filter(e=>e.isFile()&&e.name.endsWith(`.md`)).map(e=>wn.basename(e.name,`.md`))}catch(t){return mt(`Failed to read plugin components from ${e}: ${ut(t)}`,{level:`error`}),jt(ft(t)),[]}}async function Pr(e){try{let t=await Tn.readdir(e,{withFileTypes:!0}),n=[];for(let r of t)if(r.isDirectory()||r.isSymbolicLink()){let t=wn.join(e,r.name,`SKILL.md`);try{(await Tn.stat(t)).isFile()&&n.push(r.name)}catch{}}return n}catch(t){return mt(`Failed to read skill directories from ${e}: ${ut(t)}`,{level:`error`}),jt(ft(t)),[]}}function Fr({plugin:e,marketplace:t}){let[n,r]=(0,Z.useState)(null),[i,a]=(0,Z.useState)(!0),[o,s]=(0,Z.useState)(null);return(0,Z.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 P(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 Nr(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 Nr(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 Pr(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,Q.jsxs)(u,{flexDirection:`column`,marginBottom:1,children:[(0,Q.jsx)(f,{bold:!0,children:`Components:`}),(0,Q.jsxs)(f,{dimColor:!0,children:[`Error: `,o]})]}):!n||!(n.commands||n.agents||n.skills||n.hooks||n.mcpServers)?null:(0,Q.jsxs)(u,{flexDirection:`column`,marginBottom:1,children:[(0,Q.jsx)(f,{bold:!0,children:`Installed components:`}),n.commands?(0,Q.jsxs)(f,{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,Q.jsxs)(f,{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,Q.jsxs)(f,{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,Q.jsxs)(f,{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,Q.jsxs)(f,{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 Ir(e,t){let n=(await P(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 Lr(e){return e.filter(e=>{let t=e.source.split(`@`)[1]||`local`;return!We(`${e.name}@${t}`)})}function Rr({setViewState:e,setResult:t,onManageComplete:n,onSearchModeChange:r,targetPlugin:i,targetMarketplace:o,action:s}){let l=me(e=>e.mcp.clients),d=me(e=>e.mcp.tools),h=me(e=>e.plugins.errors),g=Wt(),[v,b]=(0,Z.useState)(!1),S=(0,Z.useCallback)(e=>{b(e),r?.(e)},[r]),C=m(),{columns:te}=x(),[w,T]=(0,Z.useState)(`plugin-list`),{query:E,setQuery:ne,cursorOffset:D}=bn({isActive:w===`plugin-list`&&v,onExit:()=>{S(!1)}}),[O,k]=(0,Z.useState)(null),[A,re]=(0,Z.useState)([]),[ie,ae]=(0,Z.useState)([]),[oe,j]=(0,Z.useState)(!0),[se,N]=(0,Z.useState)(new Map),ce=(0,Z.useRef)(!1),le=(0,Z.useRef)(void 0),ue=mn();ee(`confirm:no`,zr.useCallback(()=>{if(w===`plugin-details`)T(`plugin-list`),k(null),z(null);else if(typeof w==`object`&&w.type===`failed-plugin-details`)T(`plugin-list`),z(null);else if(w===`configuring`)T(`plugin-details`),xe(null);else if(typeof w==`object`&&(w.type===`plugin-options`||w.type===`configuring-options`))T(`plugin-list`),k(null),t(`Plugin enabled. Configuration skipped — run /reload-plugins to apply.`),n&&n();else if(typeof w==`object`&&w.type===`flagged-detail`)T(`plugin-list`),z(null);else if(typeof w==`object`&&w.type===`mcp-detail`)T(`plugin-list`),z(null);else if(typeof w==`object`&&w.type===`mcp-tools`)T({type:`mcp-detail`,client:w.client});else if(typeof w==`object`&&w.type===`mcp-tool-detail`)T({type:`mcp-tools`,client:w.client});else{if(se.size>0){t(`Run /reload-plugins to apply plugin changes.`);return}e({type:`menu`})}},[w,e,se,t]),{context:`Confirmation`,isActive:(w!==`plugin-list`||!v)&&w!==`confirm-project-uninstall`&&!(typeof w==`object`&&w.type===`confirm-data-cleanup`)});let P=e=>e.type===`connected`?`connected`:e.type===`disabled`?`disabled`:e.type===`pending`?`pending`:e.type===`needs-auth`?`needs-auth`:`failed`,F=(0,Z.useMemo)(()=>{let e=St(),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 ie){let i=`${r.plugin.name}@${r.marketplace}`,a=e?.enabledPlugins?.[i]!==!1,o=h.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:se.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 h){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=Zt(),s=[];for(let[e,t]of a){if(e in g)continue;let n=Ze(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:P(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:P(n),client:n,indented:!0})}}for(let e of c){let t=e.scope;f.has(t)||f.set(t,[]),f.get(t).push(e)}for(let e of s){let t=e.scope;f.has(t)||f.set(t,[]),f.get(t).push(e)}for(let[e,t]of Object.entries(g)){let n=Ze(e),r=n.name||e,i=n.marketplace||`unknown`;f.has(`flagged`)||f.set(`flagged`,[]),f.get(`flagged`).push({type:`flagged-plugin`,id:e,name:r,marketplace:i,scope:`flagged`,reason:`delisted`,text:`Removed from marketplace`,flaggedAt:t.flaggedAt})}let p=[...f.keys()].sort((e,t)=>(u[e]??99)-(u[t]??99));for(let e of p){let t=f.get(e),n=[],r=[],i=0;for(;i<t.length;){let e=t[i];if(e.type===`plugin`||e.type===`failed-plugin`||e.type===`flagged-plugin`){let r=[e];i++;let a=t[i];for(;a?.type===`mcp`&&a.indented;)r.push(a),i++,a=t[i];n.push(r)}else e.type===`mcp`&&!e.indented&&r.push(e),i++}n.sort((e,t)=>e[0].name.localeCompare(t[0].name)),r.sort((e,t)=>e.name.localeCompare(t.name));for(let e of n)d.push(...e);d.push(...r)}return d},[ie,l,h,se,g]),I=(0,Z.useMemo)(()=>F.filter(e=>e.type===`flagged-plugin`).map(e=>e.id),[F]);(0,Z.useEffect)(()=>{I.length>0&&Ut(I)},[I]);let L=(0,Z.useMemo)(()=>{if(!E)return F;let e=E.toLowerCase();return F.filter(t=>t.name.toLowerCase().includes(e)||`description`in t&&t.description?.toLowerCase().includes(e))},[F,E]),[fe,pe]=(0,Z.useState)(0),he=dr({totalItems:L.length,selectedIndex:fe,maxVisible:8}),[ge,_e]=(0,Z.useState)(0),[ve,R]=(0,Z.useState)(!1),[ye,z]=(0,Z.useState)(null),[be,xe]=(0,Z.useState)(null),[Se,we]=(0,Z.useState)(!1),[Te,Ee]=(0,Z.useState)(!1);(0,Z.useEffect)(()=>{if(!O){Ee(!1);return}async function e(){let e=O.plugin.manifest.mcpServers,t=!1;if(e&&(t=typeof e==`string`&&Ge(e)||Array.isArray(e)&&e.some(e=>typeof e==`string`&&Ge(e))),!t)try{let e=wn.join(O.plugin.path,`..`),n=wn.join(e,`.claude-plugin`,`marketplace.json`),r=lt(await Tn.readFile(n,`utf-8`)).plugins?.find(e=>e.name===O.plugin.name);if(r?.mcpServers){let e=r.mcpServers;t=typeof e==`string`&&Ge(e)||Array.isArray(e)&&e.some(e=>typeof e==`string`&&Ge(e))}}catch(e){mt(`Failed to read raw marketplace.json: ${e}`)}Ee(t)}e()},[O]),(0,Z.useEffect)(()=>{async function e(){j(!0);try{let{enabled:e,disabled:t}=await Ke(),n=St(),r=Lr([...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=wt(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)),re(a);let o=[];for(let e of a)for(let t of e.installedPlugins){let n=`${t.name}@${e.name}`,r=t.isBuiltin?`builtin`:rn(n).scope;o.push({plugin:t,marketplace:e.name,scope:r,pendingEnable:void 0,pendingUpdate:!1})}ae(o),pe(0)}finally{j(!1)}}e()},[]),(0,Z.useEffect)(()=>{if(!ce.current&&i&&A.length>0&&!oe){let{name:e,marketplace:n}=Ze(i),r=o??n,a=r?A.filter(e=>e.name===r):A;for(let t of a){let n=t.installedPlugins.find(t=>t.name===e);if(n){let{scope:e}=rn(`${n.name}@${t.name}`),r={plugin:n,marketplace:t.name,scope:e,pendingEnable:void 0,pendingUpdate:!1};k(r),T(`plugin-details`),le.current=s,ce.current=!0;return}}let c=F.find(t=>t.type===`failed-plugin`&&t.name===e);c&&c.type===`failed-plugin`&&(T({type:`failed-plugin-details`,plugin:{id:c.id,name:c.name,marketplace:c.marketplace,errors:c.errors,scope:c.scope}}),ce.current=!0),!ce.current&&s&&(ce.current=!0,t(`Plugin "${i}" is not installed in this project`))}},[i,o,A,oe,F,s,t]);let De=async r=>{if(!O)return;let i=O.scope||`user`,a=i===`builtin`;if(a&&(r===`update`||r===`uninstall`)){z(`Built-in plugins cannot be updated or uninstalled.`);return}if(!a&&!nn(i)&&r!==`update`){z(`This plugin is managed by your organization. Contact your admin to disable it.`);return}R(!0),z(null);try{let o=`${O.plugin.name}@${O.marketplace}`,s;switch(r){case`enable`:{let e=await Qt(o);if(!e.success)throw Error(e.message);break}case`disable`:{let e=await tn(o);if(!e.success)throw Error(e.message);s=e.reverseDependents;break}case`uninstall`:{if(a||!nn(i))break;if(on(o)){R(!1),T(`confirm-project-uninstall`);return}let e=M().plugins[o],t=!e||e.length<=1?await ze(o):null;if(t){R(!1),T({type:`confirm-data-cleanup`,size:t});return}let n=await $t(o,i);if(!n.success)throw Error(n.message);s=n.reverseDependents;break}case`update`:{if(a)break;let r=await en(o,i);if(!r.success)throw Error(r.message);if(r.alreadyUpToDate){t(`${O.plugin.name} is already at the latest version (${r.newVersion}).`),n&&await n(),e({type:`menu`});return}break}}Le();let c=`${O.plugin.name}@${O.marketplace}`;if(St()?.enabledPlugins?.[c]!==!1){R(!1),T({type:`plugin-options`});return}let l=r===`enable`?`Enabled`:r===`disable`?`Disabled`:r===`update`?`Updated`:`Uninstalled`,u=s&&s.length>0?` · required by ${s.join(`, `)}`:``;t(`✓ ${l} ${O.plugin.name}${u}. Run /reload-plugins to apply.`),n&&await n(),e({type:`menu`})}catch(e){R(!1);let t=e instanceof Error?e.message:String(e);z(`Failed to ${r}: ${t}`),jt(ft(e))}},Oe=(0,Z.useRef)(De);Oe.current=De,(0,Z.useEffect)(()=>{if(w===`plugin-details`&&O&&le.current){let e=le.current;le.current=void 0,Oe.current(e)}},[w,O]);let ke=zr.useCallback(()=>{if(fe>=L.length)return;let e=L[fe];if(e?.type!==`flagged-plugin`)if(e?.type===`plugin`){let t=`${e.plugin.name}@${e.marketplace}`,n=St(),r=se.get(t),i=n?.enabledPlugins?.[t]!==!1,a=e.scope;if(a===`builtin`||nn(a)){let e=new Map(se);r?(e.delete(t),(async()=>{try{r===`will-disable`?await Qt(t):await tn(t),Le()}catch(e){jt(e)}})()):(e.set(t,i?`will-disable`:`will-enable`),(async()=>{try{i?await tn(t):await Qt(t),Le()}catch(e){jt(e)}})()),N(e)}}else e?.type===`mcp`&&ue(e.client.name)},[fe,L,se,ie,ue]);c({"select:previous":()=>{fe===0?S(!0):he.handleSelectionChange(fe-1,pe)},"select:next":()=>{fe<L.length-1&&he.handleSelectionChange(fe+1,pe)},"select:accept":zr.useCallback(()=>{if(fe>=L.length)return;let e=L[fe];if(e?.type===`plugin`){let t=ie.find(t=>t.plugin.name===e.plugin.name&&t.marketplace===e.marketplace);t&&(k(t),T(`plugin-details`),_e(0),z(null))}else e?.type===`flagged-plugin`?(T({type:`flagged-detail`,plugin:{id:e.id,name:e.name,marketplace:e.marketplace,reason:e.reason,text:e.text,flaggedAt:e.flaggedAt}}),z(null)):e?.type===`failed-plugin`?(T({type:`failed-plugin-details`,plugin:{id:e.id,name:e.name,marketplace:e.marketplace,errors:e.errors,scope:e.scope}}),_e(0),z(null)):e?.type===`mcp`&&(T({type:`mcp-detail`,client:e.client}),z(null))},[fe,L,ie])},{context:`Select`,isActive:w===`plugin-list`&&!v}),c({"plugin:toggle":ke},{context:`Plugin`,isActive:w===`plugin-list`&&!v}),c({"select:accept":zr.useCallback(()=>{typeof w!=`object`||w.type!==`flagged-detail`||(Gt(w.plugin.id),T(`plugin-list`))},[w])},{context:`Select`,isActive:typeof w==`object`&&w.type===`flagged-detail`});let Ae=zr.useMemo(()=>{if(w!==`plugin-details`||!O)return[];let e=St(),t=`${O.plugin.name}@${O.marketplace}`,n=e?.enabledPlugins?.[t]!==!1,r=O.marketplace===`builtin`,i=[];return i.push({label:n?`Disable plugin`:`Enable plugin`,action:()=>void De(n?`disable`:`enable`)}),r||(i.push({label:O.pendingUpdate?`Unmark for update`:`Mark for update`,action:async()=>{try{let e=await Ir(O.plugin.name,O.marketplace);if(e){z(e);return}let t=[...ie],n=t.findIndex(e=>e.plugin.name===O.plugin.name&&e.marketplace===O.marketplace);n!==-1&&(t[n].pendingUpdate=!O.pendingUpdate,ae(t),k({...O,pendingUpdate:!O.pendingUpdate}))}catch(e){z(e instanceof Error?e.message:`Failed to check plugin update availability`)}}}),Te&&i.push({label:`Configure`,action:async()=>{we(!0);try{let e=O.plugin.manifest.mcpServers,t=null;if(typeof e==`string`&&Ge(e))t=e;else if(Array.isArray(e)){for(let n of e)if(typeof n==`string`&&Ge(n)){t=n;break}}if(!t){z(`No MCPB file found in plugin`),we(!1);return}let n=`${O.plugin.name}@${O.marketplace}`,r=await Ce(t,O.plugin.path,n,void 0,void 0,!0);`status`in r&&r.status===`needs-config`?(xe(r),T(`configuring`)):z(`Failed to load MCPB for configuration`)}catch(e){let t=ut(e);z(`Failed to load configuration: ${t}`)}finally{we(!1)}}}),O.plugin.manifest.userConfig&&Object.keys(O.plugin.manifest.userConfig).length>0&&i.push({label:`Configure options`,action:()=>{T({type:`configuring-options`,schema:O.plugin.manifest.userConfig})}}),i.push({label:`Update now`,action:()=>void De(`update`)}),i.push({label:`Uninstall`,action:()=>void De(`uninstall`)})),O.plugin.manifest.homepage&&i.push({label:`Open homepage`,action:()=>void Jt(O.plugin.manifest.homepage)}),O.plugin.manifest.repository&&i.push({label:`View repository`,action:()=>void Jt(O.plugin.manifest.repository)}),i.push({label:`Back to plugin list`,action:()=>{T(`plugin-list`),k(null),z(null)}}),i},[w,O,Te,ie]);if(c({"select:previous":()=>{ge>0&&_e(ge-1)},"select:next":()=>{ge<Ae.length-1&&_e(ge+1)},"select:accept":()=>{Ae[ge]&&Ae[ge].action()}},{context:`Select`,isActive:w===`plugin-details`&&!!O}),c({"select:accept":()=>{typeof w==`object`&&w.type===`failed-plugin-details`&&(async()=>{R(!0),z(null);let e=w.plugin.id,t=w.plugin.scope,r=nn(t)?await $t(e,t,!1):await $t(e,`user`,!1),i=r.success;if(!i){for(let t of[`userSettings`,`projectSettings`,`localSettings`]){let n=bt(t);n?.enabledPlugins?.[e]!==void 0&&(Et(t,{enabledPlugins:{...n.enabledPlugins,[e]:void 0}}),i=!0)}Le()}i?(n&&await n(),R(!1),T(`plugin-list`)):(R(!1),z(r.message))})()}},{context:`Select`,isActive:typeof w==`object`&&w.type===`failed-plugin-details`&&w.plugin.scope!==`managed`}),c({"confirm:yes":()=>{if(!O)return;R(!0),z(null);let r=`${O.plugin.name}@${O.marketplace}`,{error:i}=Et(`localSettings`,{enabledPlugins:{...bt(`localSettings`)?.enabledPlugins,[r]:!1}});if(i){R(!1),z(`Failed to write settings: ${i.message}`);return}Le(),t(`✓ Disabled ${O.plugin.name} in .claude/settings.local.json. Run /reload-plugins to apply.`),n&&n(),e({type:`menu`})},"confirm:no":()=>{T(`plugin-details`),z(null)}},{context:`Confirmation`,isActive:w===`confirm-project-uninstall`&&!!O&&!ve}),_((r,i)=>{if(!O)return;let o=`${O.plugin.name}@${O.marketplace}`,s=O.scope;if(!s||s===`builtin`||!nn(s))return;let c=async r=>{R(!0),z(null);try{let i=await $t(o,s,r);if(!i.success)throw Error(i.message);Le();let c=r?``:` · data preserved`;t(`${a.tick} ${i.message}${c}`),n&&n(),e({type:`menu`})}catch(e){R(!1),z(e instanceof Error?e.message:String(e))}};r===`y`||r===`Y`?c(!0):r===`n`||r===`N`?c(!1):i.escape&&(T(`plugin-details`),z(null))},{isActive:typeof w==`object`&&w.type===`confirm-data-cleanup`&&!!O&&!ve}),zr.useEffect(()=>{pe(0)},[E]),_((e,t)=>{let n=!t.ctrl&&!t.meta;v||(e===`/`&&n?(S(!0),ne(``),pe(0)):n&&e.length>0&&!/^\s+$/.test(e)&&e!==`j`&&e!==`k`&&e!==` `&&(S(!0),ne(e),pe(0)))},{isActive:w===`plugin-list`}),oe)return(0,Q.jsx)(f,{children:`Loading installed plugins…`});if(F.length===0)return(0,Q.jsxs)(u,{flexDirection:`column`,children:[(0,Q.jsx)(u,{marginBottom:1,children:(0,Q.jsx)(f,{bold:!0,children:`Manage plugins`})}),(0,Q.jsx)(f,{children:`No plugins or MCP servers installed.`}),(0,Q.jsx)(u,{marginTop:1,children:(0,Q.jsx)(f,{dimColor:!0,children:`Esc to go back`})})]});if(typeof w==`object`&&w.type===`plugin-options`&&O){let r=`${O.plugin.name}@${O.marketplace}`;function i(r){t(r),n&&n(),e({type:`menu`})}return(0,Q.jsx)($n,{plugin:O.plugin,pluginId:r,onDone:(e,t)=>{switch(e){case`configured`:i(`✓ Enabled and configured ${O.plugin.name}. Run /reload-plugins to apply.`);break;case`skipped`:i(`✓ Enabled ${O.plugin.name}. Run /reload-plugins to apply.`);break;case`error`:i(`Failed to save configuration: ${t}`);break}}})}if(typeof w==`object`&&w.type===`configuring-options`&&O){let e=`${O.plugin.name}@${O.marketplace}`;return(0,Q.jsx)(Jn,{title:`Configure ${O.plugin.name}`,subtitle:`Plugin options`,configSchema:w.schema,initialValues:Xe(e),onSave:n=>{try{Fe(e,n,w.schema),Le(),t(`Configuration saved. Run /reload-plugins for changes to take effect.`)}catch(e){z(`Failed to save configuration: ${ut(e)}`)}T(`plugin-details`)},onCancel:()=>T(`plugin-details`)})}if(w===`configuring`&&be&&O){let e=`${O.plugin.name}@${O.marketplace}`;async function n(n){if(!(!be||!O))try{let r=O.plugin.manifest.mcpServers,i=null;if(typeof r==`string`&&Ge(r))i=r;else if(Array.isArray(r)){for(let e of r)if(typeof e==`string`&&Ge(e)){i=e;break}}if(!i){z(`No MCPB file found`),T(`plugin-details`);return}await Ce(i,O.plugin.path,e,void 0,n),z(null),xe(null),T(`plugin-details`),t(`Configuration saved. Run /reload-plugins for changes to take effect.`)}catch(e){let t=ut(e);z(`Failed to save configuration: ${t}`),T(`plugin-details`)}}function r(){xe(null),T(`plugin-details`)}return(0,Q.jsx)(Jn,{title:`Configure ${be.manifest.name}`,subtitle:`Plugin: ${O.plugin.name}`,configSchema:be.configSchema,initialValues:be.existingConfig,onSave:n,onCancel:r})}if(typeof w==`object`&&w.type===`flagged-detail`){let e=w.plugin;return(0,Q.jsxs)(u,{flexDirection:`column`,children:[(0,Q.jsx)(u,{children:(0,Q.jsxs)(f,{bold:!0,children:[e.name,` @ `,e.marketplace]})}),(0,Q.jsxs)(u,{marginBottom:1,children:[(0,Q.jsx)(f,{dimColor:!0,children:`Status: `}),(0,Q.jsx)(f,{color:`error`,children:`Removed`})]}),(0,Q.jsxs)(u,{marginBottom:1,flexDirection:`column`,children:[(0,Q.jsxs)(f,{color:`error`,children:[`Removed from marketplace · reason: `,e.reason]}),(0,Q.jsx)(f,{children:e.text}),(0,Q.jsxs)(f,{dimColor:!0,children:[`Flagged on `,new Date(e.flaggedAt).toLocaleDateString()]})]}),(0,Q.jsx)(u,{marginTop:1,flexDirection:`column`,children:(0,Q.jsxs)(u,{children:[(0,Q.jsxs)(f,{children:[a.pointer,` `]}),(0,Q.jsx)(f,{color:`suggestion`,children:`Dismiss`})]})}),(0,Q.jsxs)(p,{children:[(0,Q.jsx)(B,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`dismiss`}),(0,Q.jsx)(B,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]})]})}if(w===`confirm-project-uninstall`&&O)return(0,Q.jsxs)(u,{flexDirection:`column`,children:[(0,Q.jsxs)(f,{bold:!0,color:`warning`,children:[O.plugin.name,` is enabled in .claude/settings.json (shared with your team)`]}),(0,Q.jsxs)(u,{marginTop:1,flexDirection:`column`,children:[(0,Q.jsx)(f,{children:`Disable it just for you in .claude/settings.local.json?`}),(0,Q.jsx)(f,{dimColor:!0,children:`This has the same effect as uninstalling, without affecting other contributors.`})]}),ye&&(0,Q.jsx)(u,{marginTop:1,children:(0,Q.jsx)(f,{color:`error`,children:ye})}),(0,Q.jsx)(u,{marginTop:1,children:ve?(0,Q.jsx)(f,{dimColor:!0,children:`Disabling…`}):(0,Q.jsxs)(p,{children:[(0,Q.jsx)(B,{action:`confirm:yes`,context:`Confirmation`,fallback:`y`,description:`disable`}),(0,Q.jsx)(B,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})]})})]});if(typeof w==`object`&&w.type===`confirm-data-cleanup`&&O)return(0,Q.jsxs)(u,{flexDirection:`column`,children:[(0,Q.jsxs)(f,{bold:!0,children:[O.plugin.name,` has `,w.size.human,` of persistent data`]}),(0,Q.jsxs)(u,{marginTop:1,flexDirection:`column`,children:[(0,Q.jsx)(f,{children:`Delete it along with the plugin?`}),(0,Q.jsx)(f,{dimColor:!0,children:it(`${O.plugin.name}@${O.marketplace}`)})]}),ye&&(0,Q.jsx)(u,{marginTop:1,children:(0,Q.jsx)(f,{color:`error`,children:ye})}),(0,Q.jsx)(u,{marginTop:1,children:ve?(0,Q.jsx)(f,{dimColor:!0,children:`Uninstalling…`}):(0,Q.jsxs)(f,{children:[(0,Q.jsx)(f,{bold:!0,children:`y`}),` to delete · `,(0,Q.jsx)(f,{bold:!0,children:`n`}),` to keep · `,(0,Q.jsx)(f,{bold:!0,children:`esc`}),` to cancel`]})})]});if(w===`plugin-details`&&O){let e=St(),t=`${O.plugin.name}@${O.marketplace}`,n=e?.enabledPlugins?.[t]!==!1,r=h.filter(e=>`plugin`in e&&e.plugin===O.plugin.name||e.source===t||e.source.startsWith(`${O.plugin.name}@`)),i=r.length===0?null:(0,Q.jsxs)(u,{flexDirection:`column`,marginBottom:1,children:[(0,Q.jsxs)(f,{bold:!0,color:`error`,children:[r.length,` `,Rt(r.length,`error`),`:`]}),r.map((e,t)=>{let n=kr(e);return(0,Q.jsxs)(u,{flexDirection:`column`,marginLeft:2,children:[(0,Q.jsx)(f,{color:`error`,children:Or(e)}),n&&(0,Q.jsxs)(f,{dimColor:!0,italic:!0,children:[a.arrowRight,` `,n]})]},t)})]});return(0,Q.jsxs)(u,{flexDirection:`column`,children:[(0,Q.jsx)(u,{children:(0,Q.jsxs)(f,{bold:!0,children:[O.plugin.name,` @ `,O.marketplace]})}),(0,Q.jsxs)(u,{children:[(0,Q.jsx)(f,{dimColor:!0,children:`Scope: `}),(0,Q.jsx)(f,{children:O.scope||`user`})]}),O.plugin.manifest.version&&(0,Q.jsxs)(u,{children:[(0,Q.jsx)(f,{dimColor:!0,children:`Version: `}),(0,Q.jsx)(f,{children:O.plugin.manifest.version})]}),O.plugin.manifest.description&&(0,Q.jsx)(u,{marginBottom:1,children:(0,Q.jsx)(f,{children:O.plugin.manifest.description})}),O.plugin.manifest.author&&(0,Q.jsxs)(u,{children:[(0,Q.jsx)(f,{dimColor:!0,children:`Author: `}),(0,Q.jsx)(f,{children:O.plugin.manifest.author.name})]}),(0,Q.jsxs)(u,{marginBottom:1,children:[(0,Q.jsx)(f,{dimColor:!0,children:`Status: `}),(0,Q.jsx)(f,{color:n?`success`:`warning`,children:n?`Enabled`:`Disabled`}),O.pendingUpdate&&(0,Q.jsx)(f,{color:`suggestion`,children:` · Marked for update`})]}),(0,Q.jsx)(Fr,{plugin:O.plugin,marketplace:O.marketplace}),i,(0,Q.jsx)(u,{marginTop:1,flexDirection:`column`,children:Ae.map((e,t)=>{let n=t===ge;return(0,Q.jsxs)(u,{children:[n&&(0,Q.jsxs)(f,{children:[a.pointer,` `]}),!n&&(0,Q.jsx)(f,{children:` `}),(0,Q.jsx)(f,{bold:n,color:e.label.includes(`Uninstall`)?`error`:e.label.includes(`Update`)?`suggestion`:void 0,children:e.label})]},t)})}),ve&&(0,Q.jsx)(u,{marginTop:1,children:(0,Q.jsx)(f,{children:`Processing…`})}),ye&&(0,Q.jsx)(u,{marginTop:1,children:(0,Q.jsx)(f,{color:`error`,children:ye})}),(0,Q.jsx)(u,{marginTop:1,children:(0,Q.jsx)(f,{dimColor:!0,italic:!0,children:(0,Q.jsxs)(p,{children:[(0,Q.jsx)(B,{action:`select:previous`,context:`Select`,fallback:`↑`,description:`navigate`}),(0,Q.jsx)(B,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`select`}),(0,Q.jsx)(B,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]})})})]})}if(typeof w==`object`&&w.type===`failed-plugin-details`){let e=w.plugin,t=e.errors[0],n=t?Or(t):`Failed to load`;return(0,Q.jsxs)(u,{flexDirection:`column`,children:[(0,Q.jsxs)(f,{children:[(0,Q.jsx)(f,{bold:!0,children:e.name}),(0,Q.jsxs)(f,{dimColor:!0,children:[` @ `,e.marketplace]}),(0,Q.jsxs)(f,{dimColor:!0,children:[` (`,e.scope,`)`]})]}),(0,Q.jsx)(f,{color:`error`,children:n}),e.scope===`managed`?(0,Q.jsx)(u,{marginTop:1,children:(0,Q.jsx)(f,{dimColor:!0,children:`Managed by your organization — contact your admin`})}):(0,Q.jsxs)(u,{marginTop:1,children:[(0,Q.jsxs)(f,{color:`suggestion`,children:[a.pointer,` `]}),(0,Q.jsx)(f,{bold:!0,children:`Remove`})]}),ve&&(0,Q.jsx)(f,{children:`Processing…`}),ye&&(0,Q.jsx)(f,{color:`error`,children:ye}),(0,Q.jsx)(u,{marginTop:1,children:(0,Q.jsx)(f,{dimColor:!0,italic:!0,children:(0,Q.jsxs)(p,{children:[e.scope!==`managed`&&(0,Q.jsx)(B,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`remove`}),(0,Q.jsx)(B,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]})})})]})}if(typeof w==`object`&&w.type===`mcp-detail`){let e=w.client,n=de(d,e.name).length,r=()=>{T({type:`mcp-tools`,client:e})},i=()=>{T(`plugin-list`)},a=e=>{e&&t(e),T(`plugin-list`)},o=e.config.scope,s=e.config.type;return s===`stdio`?(0,Q.jsx)(Pn,{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,Q.jsx)(Mn,{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,Q.jsx)(Mn,{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,Q.jsx)(Mn,{server:{name:e.name,client:e,scope:o,transport:`claudeai-proxy`,isAuthenticated:void 0,config:e.config},serverToolsCount:n,onViewTools:r,onCancel:i,onComplete:a,borderless:!0}):(T(`plugin-list`),null)}if(typeof w==`object`&&w.type===`mcp-tools`){let e=w.client,t=e.config.scope,n=e.config.type,r;return r=n===`stdio`?{name:e.name,client:e,scope:t,transport:`stdio`,config:e.config}:n===`sse`?{name:e.name,client:e,scope:t,transport:`sse`,isAuthenticated:void 0,config:e.config}:n===`http`?{name:e.name,client:e,scope:t,transport:`http`,isAuthenticated:void 0,config:e.config}:{name:e.name,client:e,scope:t,transport:`claudeai-proxy`,isAuthenticated:void 0,config:e.config},(0,Q.jsx)(Bn,{server:r,onSelectTool:t=>{T({type:`mcp-tool-detail`,client:e,tool:t})},onBack:()=>T({type:`mcp-detail`,client:e})})}if(typeof w==`object`&&w.type===`mcp-tool-detail`){let{client:e,tool:t}=w,n=e.config.scope,r=e.config.type,i;return i=r===`stdio`?{name:e.name,client:e,scope:n,transport:`stdio`,config:e.config}:r===`sse`?{name:e.name,client:e,scope:n,transport:`sse`,isAuthenticated:void 0,config:e.config}:r===`http`?{name:e.name,client:e,scope:n,transport:`http`,isAuthenticated:void 0,config:e.config}:{name:e.name,client:e,scope:n,transport:`claudeai-proxy`,isAuthenticated:void 0,config:e.config},(0,Q.jsx)(Ln,{tool:t,server:i,onBack:()=>T({type:`mcp-tools`,client:e})})}let je=he.getVisibleItems(L);return(0,Q.jsxs)(u,{flexDirection:`column`,children:[(0,Q.jsx)(u,{marginBottom:1,children:(0,Q.jsx)(y,{query:E,isFocused:v,isTerminalFocused:C,width:te-4,cursorOffset:D})}),L.length===0&&E&&(0,Q.jsx)(u,{marginBottom:1,children:(0,Q.jsxs)(f,{dimColor:!0,children:[`No items match "`,E,`"`]})}),he.scrollPosition.canScrollUp&&(0,Q.jsx)(u,{children:(0,Q.jsxs)(f,{dimColor:!0,children:[` `,a.arrowUp,` more above`]})}),je.map((e,t)=>{let n=he.toActualIndex(t)===fe&&!v,r=t>0?je[t-1]:null,i=!r||r.scope!==e.scope;return(0,Q.jsxs)(zr.Fragment,{children:[i&&(0,Q.jsx)(u,{marginTop:+(t>0),paddingLeft:2,children:(0,Q.jsx)(f,{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,Q.jsx)(jr,{item:e,isSelected:n})]},e.id)}),he.scrollPosition.canScrollDown&&(0,Q.jsx)(u,{children:(0,Q.jsxs)(f,{dimColor:!0,children:[` `,a.arrowDown,` more below`]})}),(0,Q.jsx)(u,{marginTop:1,marginLeft:1,children:(0,Q.jsx)(f,{dimColor:!0,italic:!0,children:(0,Q.jsxs)(p,{children:[(0,Q.jsx)(f,{children:`type to search`}),(0,Q.jsx)(B,{action:`plugin:toggle`,context:`Plugin`,fallback:`Space`,description:`toggle`}),(0,Q.jsx)(B,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`details`}),(0,Q.jsx)(B,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]})})}),se.size>0&&(0,Q.jsx)(u,{marginLeft:1,children:(0,Q.jsx)(f,{dimColor:!0,italic:!0,children:`Run /reload-plugins to apply changes`})})]})}var zr,Z,Q,Br=e((()=>{i(),zr=t(g(),1),Z=t(g(),1),I(),C(),Nn(),In(),zn(),Un(),yn(),xn(),R(),qt(),Oe(),hn(),N(),an(),L(),vt(),Yt(),pt(),ht(),At(),rt(),O(),pe(),xe(),ve(),Kt(),ye(),ke(),Ue(),be(),Xt(),Ct(),dt(),Bt(),Ar(),Zn(),nr(),Mr(),mr(),Q=T()}));function Vr(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 Hr=e((()=>{}));function Ur({onComplete:e,path:t}){return(0,Wr.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 un(t),r=``;r+=`Validating ${n.fileType} manifest: ${n.filePath}\n\n`,n.errors.length>0&&(r+=`${a.cross} Found ${n.errors.length} ${Rt(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} ${Rt(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,jt(t),e(`${a.cross} Unexpected error during validation: ${ut(t)}`)}}n()},[e,t]),(0,Gr.jsx)(u,{flexDirection:`column`,children:(0,Gr.jsx)(f,{children:`Running validation...`})})}var Wr,Gr,Kr=e((()=>{i(),g(),Wr=t(g(),1),C(),ht(),At(),pn(),Bt(),Gr=T()}));function qr({onComplete:e}){return(0,oi.useEffect)(()=>{async function t(){try{let t=await ae(),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: ${ut(t)}`)}}t()},[e]),(0,$.jsx)(f,{children:`Loading marketplaces...`})}function Jr(){return process.env.USER_TYPE===`ant`?(0,$.jsxs)(u,{flexDirection:`row`,alignItems:`flex-start`,paddingLeft:1,marginTop:1,borderLeft:!0,borderRight:!1,borderTop:!1,borderBottom:!1,borderColor:`permission`,borderStyle:`single`,children:[(0,$.jsx)(u,{flexShrink:0,children:(0,$.jsxs)(f,{bold:!0,italic:!0,color:`permission`,children:[`i`,` `]})}),(0,$.jsx)(f,{children:`[ANT-ONLY] MCP servers are now managed in /plugins. Use /mcp no-redirect to test old UI`})]}):null}function Yr(e){let t=[];for(let{source:n,scope:r}of[{source:`userSettings`,scope:`user`},{source:`projectSettings`,scope:`project`},{source:`localSettings`,scope:`local`}])bt(n)?.extraKnownMarketplaces?.[e]&&t.push({source:n,scope:r});return{editableSources:t,isInPolicy:!!bt(`policySettings`)?.extraKnownMarketplaces?.[e]}}function Xr(e){let{editableSources:t,isInPolicy:n}=Yr(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 Zr(e){return{kind:`navigate`,tab:`installed`,viewState:{type:`manage-plugins`,targetPlugin:e,action:`uninstall`}}}function Qr(e){return si.has(e.type)}function $r(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 ei(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:Or(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=Xr(t.name),n=Yr(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=Xr(t),r=Yr(t),i=r.isInPolicy?`managed`:r.editableSources[0]?.scope;s.push({label:t,message:Or(e),guidance:n.kind===`managed-only`?`Managed by your organization — contact your admin`:kr(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=$r(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:Or(e),guidance:kr(e),action:t?Zr(t):{kind:`none`},scope:r})}for(let e of r)s.push({label:e.source,message:Or(e),guidance:kr(e),action:{kind:`none`}});return s}function ti(e,t){for(let{source:n}of t){let t=bt(n);if(!t)continue;let r={};if(t.extraKnownMarketplaces?.[e]&&(r.extraKnownMarketplaces={...t.extraKnownMarketplaces,[e]:void 0}),t.enabledPlugins){let n=`@${e}`,i=!1,a={...t.enabledPlugins};for(let e in a)e.endsWith(n)&&(a[e]=void 0,i=!0);i&&(r.enabledPlugins=a)}Object.keys(r).length>0&&Et(n,r)}}function ni({setViewState:e,setActiveTab:t,markPluginsChanged:n}){let r=me(e=>e.plugins.errors),i=me(e=>e.plugins.installationStatus),o=j(),[s,l]=(0,oi.useState)(0),[d,m]=(0,oi.useState)(null),[h,g]=(0,oi.useState)([]);(0,oi.useEffect)(()=>{(async()=>{try{let{failures:e}=await Qe(await ae());g(e)}catch{}})()},[]);let _=i.marketplaces.filter(e=>e.status===`failed`),v=new Set(_.map(e=>e.name)),y=r.filter(Qr),b=ei(_,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=>Qr(e)||e.type===`marketplace-not-found`||e.type===`marketplace-load-failed`||e.type===`marketplace-blocked-by-policy`?!1:$r(e)!==void 0),r.filter(e=>Qr(e)||e.type===`marketplace-not-found`||e.type===`marketplace-load-failed`||e.type===`marketplace-blocked-by-policy`?!1:$r(e)===void 0),h,y,Zt());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(`, `);ti(i.name,i.sources),Le(),o(e=>({...e,plugins:{...e.plugins,errors:e.plugins.errors.filter(e=>!(`marketplace`in e&&e.marketplace===i.name)),installationStatus:{...e.plugins.installationStatus,marketplaces:e.plugins.installationStatus.marketplaces.filter(e=>e.name!==i.name)}}})),m(`${a.tick} Removed "${i.name}" from ${e} settings`),n();break}case`remove-installed-marketplace`:(async()=>{try{await Je(i.name),Le(),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 S=b[x]?.action,C=S&&S.kind!==`none`&&S.kind!==`managed-only`;return b.length===0?(0,$.jsxs)(u,{flexDirection:`column`,children:[(0,$.jsx)(u,{marginLeft:1,children:(0,$.jsx)(f,{dimColor:!0,children:`No plugin errors`})}),(0,$.jsx)(u,{marginTop:1,children:(0,$.jsx)(f,{dimColor:!0,italic:!0,children:(0,$.jsx)(B,{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)(f,{children:[(0,$.jsxs)(f,{color:n?`suggestion`:`error`,children:[n?a.pointer:a.cross,` `]}),(0,$.jsx)(f,{bold:n,children:e.label}),e.scope&&(0,$.jsxs)(f,{dimColor:!0,children:[` (`,e.scope,`)`]})]}),(0,$.jsx)(u,{marginLeft:3,children:(0,$.jsx)(f,{color:`error`,children:e.message})}),e.guidance&&(0,$.jsx)(u,{marginLeft:3,children:(0,$.jsx)(f,{dimColor:!0,italic:!0,children:e.guidance})})]},t)}),d&&(0,$.jsx)(u,{marginTop:1,marginLeft:1,children:(0,$.jsx)(f,{color:`claude`,children:d})}),(0,$.jsx)(u,{marginTop:1,children:(0,$.jsx)(f,{dimColor:!0,italic:!0,children:(0,$.jsxs)(p,{children:[(0,$.jsx)(B,{action:`select:previous`,context:`Select`,fallback:`↑`,description:`navigate`}),C&&(0,$.jsx)(B,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`resolve`}),(0,$.jsx)(B,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]})})})]})}function ri(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 ii(e){return e.type===`manage-plugins`?`installed`:e.type===`manage-marketplaces`?`marketplaces`:`discover`}function ai({onComplete:e,args:t,showMcpRedirectMessage:n}){let r=Vr(t),i=ri(r),[a,o]=(0,oi.useState)(i),[s,c]=(0,oi.useState)(ii(i)),[l,d]=(0,oi.useState)(a.type===`add-marketplace`&&a.initialValue||``),[p,m]=(0,oi.useState)(0),[h,g]=(0,oi.useState)(null),[_,v]=(0,oi.useState)(null),[y,x]=(0,oi.useState)(!1),C=j(),w=me(e=>{let t=e.plugins.errors.length;for(let n of e.plugins.installationStatus.marketplaces)n.status===`failed`&&t++;return t}),T=w>0?`Errors (${w})`:`Errors`,E=_n(),ne=r.type===`marketplace`&&r.action===`add`&&r.target!==void 0,D=(0,oi.useCallback)(()=>{C(e=>e.plugins.needsRefresh?e:{...e,plugins:{...e.plugins,needsRefresh:!0}})},[C]),O=(0,oi.useCallback)(e=>{let t=e;switch(c(t),g(null),t){case`discover`:o({type:`discover-plugins`});break;case`installed`:o({type:`manage-plugins`});break;case`marketplaces`:o({type:`manage-marketplaces`});break;case`errors`:break}},[]);return(0,oi.useEffect)(()=>{a.type===`menu`&&!_&&e()},[a.type,_,e]),(0,oi.useEffect)(()=>{a.type===`browse-marketplace`&&s!==`discover`&&c(`discover`)},[a.type,s]),ee(`confirm:no`,(0,oi.useCallback)(()=>{c(`marketplaces`),o({type:`manage-marketplaces`}),d(``),g(null)},[]),{context:`Settings`,isActive:a.type===`add-marketplace`}),(0,oi.useEffect)(()=>{_&&e(_)},[_,e]),(0,oi.useEffect)(()=>{a.type===`help`&&e()},[a.type,e]),a.type===`help`?(0,$.jsxs)(u,{flexDirection:`column`,children:[(0,$.jsx)(f,{bold:!0,children:`Plugin Command Usage:`}),(0,$.jsx)(f,{children:` `}),(0,$.jsx)(f,{dimColor:!0,children:`Installation:`}),(0,$.jsx)(f,{children:` /plugin install - Browse and install plugins`}),(0,$.jsx)(f,{children:` /plugin install <marketplace> - Install from specific marketplace`}),(0,$.jsx)(f,{children:` /plugin install <plugin> - Install specific plugin`}),(0,$.jsx)(f,{children:` /plugin install <plugin>@<market> - Install plugin from marketplace`}),(0,$.jsx)(f,{children:` `}),(0,$.jsx)(f,{dimColor:!0,children:`Management:`}),(0,$.jsx)(f,{children:` /plugin manage - Manage installed plugins`}),(0,$.jsx)(f,{children:` /plugin enable <plugin> - Enable a plugin`}),(0,$.jsx)(f,{children:` /plugin disable <plugin> - Disable a plugin`}),(0,$.jsx)(f,{children:` /plugin uninstall <plugin> - Uninstall a plugin`}),(0,$.jsx)(f,{children:` `}),(0,$.jsx)(f,{dimColor:!0,children:`Marketplaces:`}),(0,$.jsx)(f,{children:` /plugin marketplace - Marketplace management menu`}),(0,$.jsx)(f,{children:` /plugin marketplace add - Add a marketplace`}),(0,$.jsx)(f,{children:` /plugin marketplace add <path/url> - Add marketplace directly`}),(0,$.jsx)(f,{children:` /plugin marketplace update - Update marketplaces`}),(0,$.jsx)(f,{children:` /plugin marketplace update <name> - Update specific marketplace`}),(0,$.jsx)(f,{children:` /plugin marketplace remove - Remove a marketplace`}),(0,$.jsx)(f,{children:` /plugin marketplace remove <name> - Remove specific marketplace`}),(0,$.jsx)(f,{children:` /plugin marketplace list - List all marketplaces`}),(0,$.jsx)(f,{children:` `}),(0,$.jsx)(f,{dimColor:!0,children:`Validation:`}),(0,$.jsx)(f,{children:` /plugin validate <path> - Validate a manifest file or directory`}),(0,$.jsx)(f,{children:` `}),(0,$.jsx)(f,{dimColor:!0,children:`Other:`}),(0,$.jsx)(f,{children:` /plugin - Main plugin menu`}),(0,$.jsx)(f,{children:` /plugin help - Show this help`}),(0,$.jsx)(f,{children:` /plugins - Alias for /plugin`})]}):a.type===`validate`?(0,$.jsx)(Ur,{onComplete:e,path:a.path}):a.type===`marketplace-menu`?(o({type:`menu`}),null):a.type===`marketplace-list`?(0,$.jsx)(qr,{onComplete:e}):a.type===`add-marketplace`?(0,$.jsx)(Wn,{inputValue:l,setInputValue:d,cursorOffset:p,setCursorOffset:m,error:h,setError:g,result:_,setResult:v,setViewState:o,onAddComplete:D,cliMode:ne}):(0,$.jsx)(te,{color:`suggestion`,children:(0,$.jsxs)(S,{title:`Plugins`,selectedTab:s,onTabChange:O,color:`suggestion`,disableNavigation:y,banner:n&&s===`installed`?(0,$.jsx)(Jr,{}):void 0,children:[(0,$.jsx)(b,{id:`discover`,title:`Discover`,children:a.type===`browse-marketplace`?(0,$.jsx)(hr,{error:h,setError:g,result:_,setResult:v,setViewState:o,onInstallComplete:D,targetMarketplace:a.targetMarketplace,targetPlugin:a.targetPlugin}):(0,$.jsx)(yr,{error:h,setError:g,result:_,setResult:v,setViewState:o,onInstallComplete:D,onSearchModeChange:x,targetPlugin:a.type===`discover-plugins`?a.targetPlugin:void 0})}),(0,$.jsx)(b,{id:`installed`,title:`Installed`,children:(0,$.jsx)(Rr,{setViewState:o,setResult:v,onManageComplete:D,onSearchModeChange:x,targetPlugin:a.type===`manage-plugins`?a.targetPlugin:void 0,targetMarketplace:a.type===`manage-plugins`?a.targetMarketplace:void 0,action:a.type===`manage-plugins`?a.action:void 0})}),(0,$.jsx)(b,{id:`marketplaces`,title:`Marketplaces`,children:(0,$.jsx)(wr,{setViewState:o,error:h,setError:g,setResult:v,exitState:E,onManageComplete:D,targetMarketplace:a.type===`manage-marketplaces`?a.targetMarketplace:void 0,action:a.type===`manage-marketplaces`?a.action:void 0})}),(0,$.jsx)(b,{id:`errors`,title:T,children:(0,$.jsx)(ni,{setViewState:o,setActiveTab:c,markPluginsChanged:D})})]})})}var oi,$,si,ci=e((()=>{i(),g(),oi=t(g(),1),I(),C(),vn(),qt(),L(),ht(),rt(),z(),pe(),Xt(),Ct(),Kn(),vr(),Cr(),Dr(),Br(),Ar(),Hr(),Kr(),$=T(),si=new Set([`git-auth-failed`,`git-timeout`,`network-error`])}));export{Ln as a,In as c,Un as i,Mn as l,ci as n,zn as o,Bn as r,Pn as s,ai as t,Nn as u};
@@ -1 +0,0 @@
1
- import{a as e}from"./rolldown-runtime-DaDcL9Zw.js";import{l as t,o as n,s as r}from"./envUtils-DSxRz_kt.js";import{n as i,t as a}from"./defineProperty-C-QyHrDq.js";import{Kr as o,qr as s}from"./src-CDCSSo0U2.js";import{Tt as c,en as l,et as u,ht as d,kt as f,tn as p}from"./state-ix0xIunV.js";import{$ as m,$C as h,$w as g,Gn as _,Gp as v,Gw as y,HT as b,Kn as ee,ME as x,NE as S,Nl as C,Pl as te,QC as ne,Qi as w,Sb as re,Sn as ie,Tb as T,VT as ae,Wp as oe,Ww as E,XC as se,Xi as ce,ZC as D,ZT as O,Zw as k,cw as A,dw as le,et as ue,fs as j,jE as de,jr as fe,lo as pe,lr as M,lt as N,ms as me,oo as he,op as P,rt as ge,si as F,ut as _e,vO as I,xn as L,yO as ve,yb as ye,zo as R}from"./loadAgentsDir-D206qwP3.js";import{n as z,t as be}from"./cwd-CYmmnQVS.js";import{N as xe,P as Se,c as Ce,g as we}from"./config-DmomySWC.js";import{Y as Te,i as Ee,o as De}from"./log-BMCygSzM.js";import{C as Oe,Y as B,_ as V,et as ke,u as Ae}from"./model-CKkOnnnx.js";import{En as je,Tn as Me,ct as H,dt as U}from"./prompt-BNHtszmZ.js";import{i as W,o as Ne}from"./fileStateCache-DDW5toIs.js";import{P as Pe,lt as G,st as Fe}from"./rcDebugLog-CUy1_F23.js";import{a as Ie,n as Le,r as Re}from"./mappers-BDMZFgKx.js";import{c as ze,n as Be,o as Ve,r as K,s as He}from"./MessageSelector-DdR6wJhh.js";import{n as Ue,t as We}from"./systemTheme-Ceakddth.js";import{randomUUID as q}from"crypto";n(),i(),o(),l(),z(),Te(),De(),Se(),Me(),we(),ke(),I(),U(),Ne(),Pe(),b(),g(),T(),P(),C(),j(),R(),w(),fe(),_(),L(),ue(),_e(),S(),y(),V(),O(),A();async function Ge({tools:e,mainLoopModel:t,additionalWorkingDirectories:n,mcpClients:r,customSystemPrompt:i}){let[a,o,s]=await Promise.all([i===void 0?N(e,t,n,r):Promise.resolve([]),x(),i===void 0?de():Promise.resolve({})]);return{defaultSystemPrompt:a,userContext:o,systemContext:s}}async function Ke({tools:e,commands:t,mcpClients:n,messages:r,readFileState:i,getAppState:a,setAppState:o,customSystemPrompt:s,appendSystemPrompt:c,thinkingConfig:l,agents:u}){let d=Ae(),f=a(),{defaultSystemPrompt:p,userContext:m,systemContext:h}=await Ge({tools:e,mainLoopModel:d,additionalWorkingDirectories:Array.from(f.toolPermissionContext.additionalWorkingDirectories.keys()),mcpClients:n,customSystemPrompt:s}),g=Fe([...s===void 0?p:[s],...c?[c]:[]]),_=r.at(-1),v=_?.type===`assistant`&&_.message.stop_reason===null?r.slice(0,-1):r;return{systemPrompt:g,userContext:m,systemContext:h,toolUseContext:{options:{commands:t,debug:!1,mainLoopModel:d,tools:e,verbose:!1,thinkingConfig:l??(le()===!1?{type:`disabled`}:{type:`adaptive`}),mcpClients:n,mcpResources:{},isNonInteractiveSession:!0,agentDefinitions:{activeAgents:u,allAgents:[]},customSystemPrompt:s,appendSystemPrompt:c},abortController:E(),readFileState:i,getAppState:a,setAppState:o,messages:v,setInProgressToolUseIDs:()=>{},setResponseLength:()=>{},updateFileHistoryState:()=>{},updateAttributionState:()=>{}},forkContextMessages:v}}y(),V(),oe(),O(),We(),A(),Le(),D();var qe=()=>{try{return K(),e(Be)}catch{return null}},J=class{constructor(e){a(this,`config`,void 0),a(this,`mutableMessages`,void 0),a(this,`abortController`,void 0),a(this,`permissionDenials`,void 0),a(this,`totalUsage`,void 0),a(this,`hasHandledOrphanedPermission`,!1),a(this,`readFileState`,void 0),a(this,`discoveredSkillNames`,new Set),a(this,`loadedNestedMemoryPaths`,new Set),this.config=e,this.mutableMessages=e.initialMessages??[],this.abortController=e.abortController??E(),this.permissionDenials=[],this.readFileState=e.readFileCache,this.totalUsage=G}async*submitMessage(e,n){let{cwd:i,commands:a,tools:o,mcpClients:l,verbose:g=!1,thinkingConfig:_,maxTurns:y,maxBudgetUsd:b,taskBudget:x,canUseTool:S,customSystemPrompt:C,appendSystemPrompt:w,userSpecifiedModel:T,fallbackModel:oe,jsonSchema:E,getAppState:D,setAppState:O,replayUserMessages:A=!1,includePartialMessages:ue=!1,agents:j=[],setSDKStatus:de,orphanedPermission:fe}=this.config;this.discoveredSkillNames.clear(),this.permissionDenials=[],v(i);let N=!p(),P=Date.now(),_e=async(e,t,n,r,i,a)=>{let o=await S(e,t,n,r,i,a);return o.behavior!==`allow`&&this.permissionDenials.push({type:`permission_denial`,tool_name:He(e.name),tool_use_id:i,tool_input:t}),o},I=D(),L=T?Oe(T):Ae(),R=_||(le()===!1?{type:`disabled`}:{type:`adaptive`});k(`before_getSystemPrompt`);let z=typeof C==`string`?C:void 0,{defaultSystemPrompt:Se,userContext:we,systemContext:Te}=await Ge({tools:o,mainLoopModel:L,additionalWorkingDirectories:Array.from(I.toolPermissionContext.additionalWorkingDirectories.keys()),mcpClients:l,customSystemPrompt:z});k(`after_getSystemPrompt`);let De={...we},V=z!==void 0&&xe()?await ee():null,ke=Fe([...z===void 0?Se:[z],...V?[V]:[],...w?[w]:[]]),Me=o.some(e=>je(e,H));E&&Me&&ie(O,d());let U={messages:this.mutableMessages,setMessages:e=>{this.mutableMessages=e(this.mutableMessages)},onChangeAPIKey:()=>{},handleElicitation:this.config.handleElicitation,options:{commands:a,debug:!1,tools:o,verbose:g,mainLoopModel:L,thinkingConfig:R,mcpClients:l,mcpResources:{},ideInstallationStatus:null,isNonInteractiveSession:!0,customSystemPrompt:C,appendSystemPrompt:w,agentDefinitions:{activeAgents:j,allAgents:[]},theme:Ue(Ce().theme),maxBudgetUsd:b},getAppState:D,setAppState:O,abortController:this.abortController,readFileState:this.readFileState,nestedMemoryAttachmentTriggers:new Set,loadedNestedMemoryPaths:this.loadedNestedMemoryPaths,dynamicSkillDirTriggers:new Set,discoveredSkillNames:this.discoveredSkillNames,setInProgressToolUseIDs:()=>{},setResponseLength:()=>{},updateFileHistoryState:e=>{O(t=>{let n=e(t.fileHistory);return n===t.fileHistory?t:{...t,fileHistory:n}})},updateAttributionState:e=>{O(t=>{let n=e(t.attribution);return n===t.attribution?t:{...t,attribution:n}})},setSDKStatus:de};if(fe&&!this.hasHandledOrphanedPermission){this.hasHandledOrphanedPermission=!0;for await(let e of se(fe,o,this.mutableMessages,U))yield e}let{messages:W,shouldQuery:Ne,allowedTools:Pe,model:Le,resultText:Be}=await ze({input:e,mode:`prompt`,setToolJSX:()=>{},context:{...U,messages:this.mutableMessages},messages:this.mutableMessages,uuid:n?.uuid,isMeta:n?.isMeta,querySource:`sdk`});this.mutableMessages.push(...W);let K=[...this.mutableMessages];if(N&&W.length>0){let e=F(K);r()||(await e,(t(process.env.CLAUDE_CODE_EAGER_FLUSH)||t(process.env.CLAUDE_CODE_IS_COWORK))&&await M())}let We=qe(),Ke=W.filter(e=>e.type===`user`&&!e.isMeta&&!e.toolUseResult&&(We?.selectableUserMessagesFilter(e)??!0)||e.type===`system`&&e.subtype===`compact_boundary`),J=A?Ke:[];O(e=>({...e,toolPermissionContext:{...e.toolPermissionContext,alwaysAllowRules:{...e.toolPermissionContext.alwaysAllowRules,command:Pe}}}));let Y=Le??L;U={messages:K,setMessages:()=>{},onChangeAPIKey:()=>{},handleElicitation:this.config.handleElicitation,options:{commands:a,debug:!1,tools:o,verbose:g,mainLoopModel:Y,thinkingConfig:R,mcpClients:l,mcpResources:{},ideInstallationStatus:null,isNonInteractiveSession:!0,customSystemPrompt:C,appendSystemPrompt:w,theme:Ue(Ce().theme),agentDefinitions:{activeAgents:j,allAgents:[]},maxBudgetUsd:b},getAppState:D,setAppState:O,abortController:this.abortController,readFileState:this.readFileState,nestedMemoryAttachmentTriggers:new Set,loadedNestedMemoryPaths:this.loadedNestedMemoryPaths,dynamicSkillDirTriggers:new Set,discoveredSkillNames:this.discoveredSkillNames,setInProgressToolUseIDs:()=>{},setResponseLength:()=>{},updateFileHistoryState:U.updateFileHistoryState,updateAttributionState:U.updateAttributionState,setSDKStatus:de},k(`before_skills_plugins`);let[Je,{enabled:Ye}]=await Promise.all([ce(be()),me()]);if(k(`after_skills_plugins`),yield Ve({tools:o,mcpClients:l,model:Y,permissionMode:I.toolPermissionContext.mode,commands:a,agents:j,skills:Je,plugins:Ye,fastMode:I.fastMode}),k(`system_message_yielded`),!Ne){for(let e of W)if(e.type===`user`&&typeof e.message.content==`string`&&(e.message.content.includes(`<local-command-stdout>`)||e.message.content.includes(`<local-command-stderr>`)||e.isCompactSummary)&&(yield{type:`user`,message:{...e.message,content:s(e.message.content)},session_id:d(),parent_tool_use_id:null,uuid:e.uuid,timestamp:e.timestamp,isReplay:!e.isCompactSummary,isSynthetic:e.isMeta||e.isVisibleInTranscriptOnly}),e.type===`system`&&e.subtype===`local_command`&&typeof e.content==`string`&&(e.content.includes(`<local-command-stdout>`)||e.content.includes(`<local-command-stderr>`))&&(yield Re(e.content,e.uuid)),e.type===`system`&&e.subtype===`compact_boundary`){let t=e;yield{type:`system`,subtype:`compact_boundary`,session_id:d(),uuid:e.uuid,compact_metadata:Ie(t.compactMetadata)}}N&&(await F(K),(t(process.env.CLAUDE_CODE_EAGER_FLUSH)||t(process.env.CLAUDE_CODE_IS_COWORK))&&await M()),yield{type:`result`,subtype:`success`,is_error:!1,duration_ms:Date.now()-P,duration_api_ms:c(),num_turns:K.length-1,result:Be??``,stop_reason:null,session_id:d(),total_cost_usd:f(),usage:this.totalUsage,modelUsage:u(),permission_denials:this.permissionDenials,fast_mode_state:B(Y,I.fastMode),uuid:q()};return}if(ye()&&N){let e=qe()?.selectableUserMessagesFilter??(e=>!0);W.filter(e).forEach(e=>{re(e=>{O(t=>({...t,fileHistory:e(t.fileHistory)}))},e.uuid)})}let X=G,Z=1,Xe=!1,Ze,Q=null,Qe=Ee().at(-1),$e=E?pe(this.mutableMessages,H):0;for await(let e of te({messages:K,systemPrompt:ke,userContext:De,systemContext:Te,canUseTool:_e,toolUseContext:U,fallbackModel:oe,querySource:`sdk`,maxTurns:y,taskBudget:x})){if(e.type===`assistant`||e.type===`user`||e.type===`system`&&e.subtype===`compact_boundary`){if(N&&e.type===`system`&&e.subtype===`compact_boundary`){let t=e.compactMetadata?.preservedSegment?.tailUuid;if(t){let e=this.mutableMessages.findLastIndex(e=>e.uuid===t);e!==-1&&await F(this.mutableMessages.slice(0,e+1))}}if(K.push(e),N&&(e.type===`assistant`?F(K):await F(K)),!Xe&&J.length>0){Xe=!0;for(let e of J)e.type===`user`&&(yield{type:`user`,message:e.message,session_id:d(),parent_tool_use_id:null,uuid:e.uuid,timestamp:e.timestamp,isReplay:!0})}}switch(e.type===`user`&&Z++,e.type){case`tombstone`:break;case`assistant`:{let t=e,n=t.message?.stop_reason;n!=null&&(Q=n),this.mutableMessages.push(t),yield*h(t);break}case`progress`:{let t=e;this.mutableMessages.push(t),N&&(K.push(t),F(K)),yield*h(t);break}case`user`:{let t=e;this.mutableMessages.push(t),yield*h(t);break}case`stream_event`:{let t=e.event;if(t.type===`message_start`){X=G;let e=t.message;X=ge(X,e.usage)}if(t.type===`message_delta`){X=ge(X,t.usage);let e=t.delta;e.stop_reason!=null&&(Q=e.stop_reason)}t.type===`message_stop`&&(this.totalUsage=m(this.totalUsage,X)),ue&&(yield{type:`stream_event`,event:t,session_id:d(),parent_tool_use_id:null,uuid:q()});break}case`attachment`:{let n=e;this.mutableMessages.push(n),N&&(K.push(n),F(K));let r=n.attachment;if(r.type===`structured_output`)Ze=r.data;else if(r.type===`max_turns_reached`){N&&(t(process.env.CLAUDE_CODE_EAGER_FLUSH)||t(process.env.CLAUDE_CODE_IS_COWORK))&&await M(),yield{type:`result`,subtype:`error_max_turns`,duration_ms:Date.now()-P,duration_api_ms:c(),is_error:!0,num_turns:r.turnCount,stop_reason:Q,session_id:d(),total_cost_usd:f(),usage:this.totalUsage,modelUsage:u(),permission_denials:this.permissionDenials,fast_mode_state:B(Y,I.fastMode),uuid:q(),errors:[`Reached maximum number of turns (${r.maxTurns})`]};return}else A&&r.type===`queued_command`&&(yield{type:`user`,message:{role:`user`,content:r.prompt},session_id:d(),parent_tool_use_id:null,uuid:r.source_uuid||n.uuid,timestamp:n.timestamp,isReplay:!0});break}case`stream_request_start`:break;case`system`:{let t=e,n=this.config.snipReplay?.(t,this.mutableMessages);if(n!==void 0){n.executed&&(this.mutableMessages.length=0,this.mutableMessages.push(...n.messages));break}if(this.mutableMessages.push(t),t.subtype===`compact_boundary`&&t.compactMetadata){let e=t,n=this.mutableMessages.length-1;n>0&&this.mutableMessages.splice(0,n);let r=K.length-1;r>0&&K.splice(0,r),yield{type:`system`,subtype:`compact_boundary`,session_id:d(),uuid:t.uuid,compact_metadata:Ie(e.compactMetadata)}}if(t.subtype===`api_error`){let e=t;yield{type:`system`,subtype:`api_retry`,attempt:e.retryAttempt,max_retries:e.maxRetries,retry_delay_ms:e.retryInMs,error_status:e.error.status??null,error:ae(e.error),session_id:d(),uuid:t.uuid}}break}case`tool_use_summary`:{let t=e;yield{type:`tool_use_summary`,summary:t.summary,preceding_tool_use_ids:t.precedingToolUseIds,session_id:d(),uuid:t.uuid};break}}if(b!==void 0&&f()>=b){N&&(t(process.env.CLAUDE_CODE_EAGER_FLUSH)||t(process.env.CLAUDE_CODE_IS_COWORK))&&await M(),yield{type:`result`,subtype:`error_max_budget_usd`,duration_ms:Date.now()-P,duration_api_ms:c(),is_error:!0,num_turns:Z,stop_reason:Q,session_id:d(),total_cost_usd:f(),usage:this.totalUsage,modelUsage:u(),permission_denials:this.permissionDenials,fast_mode_state:B(Y,I.fastMode),uuid:q(),errors:[`Reached maximum budget ($${b}). Increase the limit with --max-budget-usd or start a new session.`]};return}if(e.type===`user`&&E){let e=pe(this.mutableMessages,H)-$e,n=parseInt(process.env.MAX_STRUCTURED_OUTPUT_RETRIES||`5`,10);if(e>=n){N&&(t(process.env.CLAUDE_CODE_EAGER_FLUSH)||t(process.env.CLAUDE_CODE_IS_COWORK))&&await M(),yield{type:`result`,subtype:`error_max_structured_output_retries`,duration_ms:Date.now()-P,duration_api_ms:c(),is_error:!0,num_turns:Z,stop_reason:Q,session_id:d(),total_cost_usd:f(),usage:this.totalUsage,modelUsage:u(),permission_denials:this.permissionDenials,fast_mode_state:B(Y,I.fastMode),uuid:q(),errors:[`Failed to provide valid structured output after ${n} attempts`]};return}}}let $=K.findLast(e=>e.type===`assistant`||e.type===`user`),et=$?.type??`undefined`,tt=$?.type===`assistant`?ve($.message.content)?.type??`none`:`n/a`;if(N&&(t(process.env.CLAUDE_CODE_EAGER_FLUSH)||t(process.env.CLAUDE_CODE_IS_COWORK))&&await M(),!ne($,Q)){yield{type:`result`,subtype:`error_during_execution`,duration_ms:Date.now()-P,duration_api_ms:c(),is_error:!0,num_turns:Z,stop_reason:Q,session_id:d(),total_cost_usd:f(),usage:this.totalUsage,modelUsage:u(),permission_denials:this.permissionDenials,fast_mode_state:B(Y,I.fastMode),uuid:q(),errors:(()=>{let e=Ee(),t=Qe?e.lastIndexOf(Qe)+1:0;return[`[ede_diagnostic] result_type=${et} last_content_type=${tt} stop_reason=${Q}`,...e.slice(t).map(e=>e.error)]})()};return}let nt=``,rt=!1;if($.type===`assistant`){let e=ve($.message.content);e?.type===`text`&&!he.has(e.text)&&(nt=e.text),rt=!!$.isApiErrorMessage}yield{type:`result`,subtype:`success`,is_error:rt,duration_ms:Date.now()-P,duration_api_ms:c(),num_turns:Z,result:nt,stop_reason:Q,session_id:d(),total_cost_usd:f(),usage:this.totalUsage,modelUsage:u(),permission_denials:this.permissionDenials,structured_output:Ze,fast_mode_state:B(Y,I.fastMode),uuid:q()}}interrupt(){this.abortController.abort()}resetAbortController(){this.abortController=E()}getAbortSignal(){return this.abortController.signal}getMessages(){return this.mutableMessages}getReadFileState(){return this.readFileState}getSessionId(){return d()}setModel(e){this.config.userSpecifiedModel=e}};async function*Y({commands:e,prompt:t,promptUuid:n,isMeta:r,cwd:i,tools:a,mcpClients:o,verbose:s=!1,thinkingConfig:c,maxTurns:l,maxBudgetUsd:u,taskBudget:d,canUseTool:f,mutableMessages:p=[],getReadFileCache:m,setReadFileCache:h,customSystemPrompt:g,appendSystemPrompt:_,userSpecifiedModel:v,fallbackModel:y,jsonSchema:b,getAppState:ee,setAppState:x,abortController:S,replayUserMessages:C=!1,includePartialMessages:te=!1,handleElicitation:ne,agents:w=[],setSDKStatus:re,orphanedPermission:ie}){let T=new J({cwd:i,tools:a,commands:e,mcpClients:o,agents:w??[],canUseTool:f,getAppState:ee,setAppState:x,initialMessages:p,readFileCache:W(m()),customSystemPrompt:g,appendSystemPrompt:_,userSpecifiedModel:v,fallbackModel:y,thinkingConfig:c,maxTurns:l,maxBudgetUsd:u,taskBudget:d,jsonSchema:b,verbose:s,handleElicitation:ne,replayUserMessages:C,includePartialMessages:te,setSDKStatus:re,abortController:S,orphanedPermission:ie});try{yield*T.submitMessage(t,{uuid:n,isMeta:r})}finally{h(T.getReadFileState())}}export{Y as n,Ke as r,J as t};