claude-code-best 2.6.9 → 2.6.10
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.
- package/dist/chunks/{AddWorkspaceDirectory-_RSNUS7K.js → AddWorkspaceDirectory-DYIf4o0g.js} +1 -1
- package/dist/chunks/{App-4VqMMjIu.js → App-Bw4stCcv.js} +1 -1
- package/dist/chunks/ApproveApiKey-CBEOrsej.js +1 -0
- package/dist/chunks/{ApproveApiKey-B7oSxzWc.js → ApproveApiKey-CNBKF9de.js} +1 -1
- package/dist/chunks/{AssistantSessionChooser-Lf5l_1Dh.js → AssistantSessionChooser-DU5OOPwq.js} +1 -1
- package/dist/chunks/{BackgroundTasksDialog-Ckgmqm6u.js → BackgroundTasksDialog-ChDZ6M4c.js} +1 -1
- package/dist/chunks/{BypassPermissionsModeDialog-DNqPpiPC.js → BypassPermissionsModeDialog-UOkwRr3W.js} +1 -1
- package/dist/chunks/{ClaudeInChromeOnboarding-BODZ64gw.js → ClaudeInChromeOnboarding-6UL2_PCg.js} +1 -1
- package/dist/chunks/ClaudeMdExternalIncludesDialog-CG26Jg7h.js +1 -0
- package/dist/chunks/{ClaudeMdExternalIncludesDialog-DLI6ey3G.js → ClaudeMdExternalIncludesDialog-DBfmH_dG.js} +1 -1
- package/dist/chunks/ConsoleOAuthFlow-1aq67dJV.js +1 -0
- package/dist/chunks/{DesktopHandoff--xyI5kTQ.js → DesktopHandoff-B-ySC5nP.js} +1 -1
- package/dist/chunks/{DevChannelsDialog-DJ4mHsA_.js → DevChannelsDialog-DZMsKuak.js} +1 -1
- package/dist/chunks/{DiffDialog-CVWUlOjm.js → DiffDialog-CeYcqIIw.js} +1 -1
- package/dist/chunks/{Doctor-DVoFX-9y.js → Doctor-ByQrTdef.js} +1 -1
- package/dist/chunks/Doctor-DOil8Eh7.js +1 -0
- package/dist/chunks/{ExitFlow-BKzQPr75.js → ExitFlow-gMv13EpM.js} +1 -1
- package/dist/chunks/Feedback-CGRlFB5g.js +2 -0
- package/dist/chunks/Grove-CJn8QGFo.js +1 -0
- package/dist/chunks/{Grove-G0DtwY22.js → Grove-CnHyPepC.js} +1 -1
- package/dist/chunks/{HybridTransport-xN03sWrt.js → HybridTransport-CiY6jyhx.js} +1 -1
- package/dist/chunks/{ITermBackend-DzN3ZWds.js → ITermBackend-CG-a4QYW.js} +1 -1
- package/dist/chunks/{InvalidConfigDialog-Iy4Su1Lm.js → InvalidConfigDialog-umJZVrz-.js} +1 -1
- package/dist/chunks/{InvalidSettingsDialog-dx4y_nY-.js → InvalidSettingsDialog-C62kuhHc.js} +1 -1
- package/dist/chunks/{MCPConnectionManager-kVO-4BcA.js → MCPConnectionManager-BbGFGZTr.js} +1 -1
- package/dist/chunks/{McpParsingWarnings-D420-W8M.js → McpParsingWarnings-DW0d9Lsb.js} +1 -1
- package/dist/chunks/MessageSelector-A-814zUi.js +3 -0
- package/dist/chunks/{Messages-C5gVVVmY.js → Messages-C4nIAGDL.js} +2 -2
- package/dist/chunks/{Onboarding-BkidUre_.js → Onboarding-BRePz3fJ.js} +1 -1
- package/dist/chunks/{OverageCreditUpsell-DoRUucoN.js → OverageCreditUpsell-DEZsyI6y.js} +1 -1
- package/dist/chunks/{PluginSettings-DhpNtjTm.js → PluginSettings-CuZtXDaS.js} +1 -1
- package/dist/chunks/{PromptInputFooterSuggestions-BnpXzkW9.js → PromptInputFooterSuggestions-BrpVQJVn.js} +1 -1
- package/dist/chunks/{PromptInputHelpMenu-DKbiO4C0.js → PromptInputHelpMenu-BlGRpX1Q.js} +1 -1
- package/dist/chunks/{QueryEngine-J15EOjWx.js → QueryEngine-CK9YRTZo.js} +1 -1
- package/dist/chunks/{REPL-nrJ13J1o.js → REPL-D-t0XQx2.js} +6 -6
- package/dist/chunks/REPL-DV96-Prr.js +1 -0
- package/dist/chunks/{RemoteCallout-DGXIcTKv.js → RemoteCallout-DvOZQWoG.js} +1 -1
- package/dist/chunks/{RemoteSessionManager-3KsuTCZM.js → RemoteSessionManager-BlIA65dM.js} +1 -1
- package/dist/chunks/{ResumeConversation-kS7lkjJm.js → ResumeConversation-BTccgPK8.js} +1 -1
- package/dist/chunks/{SSETransport-Cy1rXP6E.js → SSETransport-CIvM80QS.js} +1 -1
- package/dist/chunks/SearchExtraToolsTool-CmyZbRut.js +1 -0
- package/dist/chunks/SentryErrorBoundary-B9sk4zvj.js +1 -0
- package/dist/chunks/{SentryErrorBoundary-B_6MfzRa.js → SentryErrorBoundary-BK2HjzVw.js} +1 -1
- package/dist/chunks/Settings-D3Kpcb7q.js +2 -0
- package/dist/chunks/{TeleportProgress-CQUN_zoe.js → TeleportProgress-BFlMrsa_.js} +1 -1
- package/dist/chunks/{TeleportRepoMismatchDialog-CPquWrd-.js → TeleportRepoMismatchDialog-BUeyIQCH.js} +1 -1
- package/dist/chunks/{TeleportResumeWrapper-NIFNCHIO.js → TeleportResumeWrapper-CHfeyo9J.js} +1 -1
- package/dist/chunks/{ThemePicker-DnK0DStD.js → ThemePicker-a5n2EKgk.js} +1 -1
- package/dist/chunks/{TmuxBackend-C00k5RF9.js → TmuxBackend-Ct9v-J78.js} +1 -1
- package/dist/chunks/{TrustDialog-CUnvtDeS.js → TrustDialog-e1nyM-Fp.js} +1 -1
- package/dist/chunks/{ValidationErrorsList-CJbO1qub.js → ValidationErrorsList-BHCepjdO.js} +1 -1
- package/dist/chunks/WelcomeV2-BnyziLbm.js +1 -0
- package/dist/chunks/{WindowsTerminalBackend-DSsgxuNK.js → WindowsTerminalBackend-Dw6qjsBu.js} +1 -1
- package/dist/chunks/{add-dir-BPqd010H.js → add-dir-CjnY5yfR.js} +1 -1
- package/dist/chunks/{agentDisplay-C0B1b_90.js → agentDisplay-Dfx-axK9.js} +1 -1
- package/dist/chunks/{agents-DMzVeRly.js → agents-CICHEOOq.js} +1 -1
- package/dist/chunks/{agents-CYs7WGHP.js → agents-lM-cxA8_.js} +1 -1
- package/dist/chunks/{ant-BO0Hmoii.js → ant-JgExUpwJ.js} +1 -1
- package/dist/chunks/{api-DLLVkmRJ.js → api-CClu711S.js} +1 -1
- package/dist/chunks/api-DgzWK3bh.js +1 -0
- package/dist/chunks/{assistant-_dIpsqHM.js → assistant-Bih7t52W.js} +1 -1
- package/dist/chunks/{assistant-CHp4-EaF.js → assistant-D1XefK1z.js} +1 -1
- package/dist/chunks/assistant-Ojm6Wsb6.js +1 -0
- package/dist/chunks/{auth-DelyQc8g.js → auth-CU6ArDos.js} +1 -1
- package/dist/chunks/auth-lQWhUjLX.js +1 -0
- package/dist/chunks/{autoMode-D3-o7xPK.js → autoMode-DM9eDMmT.js} +1 -1
- package/dist/chunks/{autonomy-tTAucjip.js → autonomy-CZCZ9wlx.js} +1 -1
- package/dist/chunks/{autonomy-CzSRoxjl.js → autonomy-DUfXLZfq.js} +1 -1
- package/dist/chunks/{autonomyPanel-DcK8N52K.js → autonomyPanel-kUZwcjfu.js} +1 -1
- package/dist/chunks/backgroundHousekeeping-BcLV1-Ap.js +1 -0
- package/dist/chunks/{backgroundHousekeeping-Bbkz61_-.js → backgroundHousekeeping-KGRk7QeA.js} +2 -2
- package/dist/chunks/{branch-ZJF4xAh9.js → branch-Ac3HXXs2.js} +1 -1
- package/dist/chunks/{bridge-C6gSt_32.js → bridge-Drt-UmFp.js} +2 -2
- package/dist/chunks/bridgeConfig-ByjfIoJz.js +1 -0
- package/dist/chunks/{bridgeConfig-DXUNQp2l.js → bridgeConfig-GQzZVhuF.js} +1 -1
- package/dist/chunks/bridgeEnabled-C7AI9y8g.js +1 -0
- package/dist/chunks/{bridgeEnabled-G6vxQV-7.js → bridgeEnabled-CDoXbe3S.js} +1 -1
- package/dist/chunks/{bridgeMain-DlnIQOtX.js → bridgeMain-B0fLyOLC.js} +6 -6
- package/dist/chunks/bridgeMain-DKQ1u3k_.js +1 -0
- package/dist/chunks/{bridgeMessaging-mek-AaFi.js → bridgeMessaging-gRm2WcIE.js} +1 -1
- package/dist/chunks/{btw-Cz2lyle-.js → btw-B2Tq2ewP.js} +1 -1
- package/dist/chunks/{buddy-BMqKttFw.js → buddy-v00QHFZ6.js} +1 -1
- package/dist/chunks/{bypassPermissionsKillswitch-BxvX48jr.js → bypassPermissionsKillswitch-DAr5U3Ep.js} +1 -1
- package/dist/chunks/{caches-wtRUk5y5.js → caches-DHUk9KMo.js} +2 -2
- package/dist/chunks/caches-DbE9R4Zh.js +1 -0
- package/dist/chunks/{ccrClient-BOrmrmgF.js → ccrClient-1Q3C_3_r.js} +1 -1
- package/dist/chunks/changeDetector--9sSzU2e.js +1 -0
- package/dist/chunks/channelNotification-CLYOd2-R.js +1 -0
- package/dist/chunks/{channelNotification-D8do6HUN.js → channelNotification-d08DSK9u.js} +1 -1
- package/dist/chunks/{chrome-JF2BXNK6.js → chrome-CKo0_n71.js} +1 -1
- package/dist/chunks/clear-Cf1D1WkR.js +1 -0
- package/dist/chunks/client-Bzn58Ea4.js +1 -0
- package/dist/chunks/{color-oh8CGhkI.js → color-DqtpdhFx.js} +1 -1
- package/dist/chunks/commands-CJz20FMO.js +1 -0
- package/dist/chunks/{commitAttribution-CUdm_sRl.js → commitAttribution-BJvmLsVe.js} +1 -1
- package/dist/chunks/commitAttribution-BgNel6QS.js +1 -0
- package/dist/chunks/{compact-R6vMbGQQ.js → compact-DLYic2Oa.js} +1 -1
- package/dist/chunks/{companion-ClxqTyG9.js → companion-C2CBSYiF.js} +1 -1
- package/dist/chunks/{config-CPK9PlWS.js → config-Cht2x9n9.js} +1 -1
- package/dist/chunks/{config-BQ-MayP6.js → config-DnWYFpDc.js} +1 -1
- package/dist/chunks/{context-CWfsKYEB.js → context-CDz9HqRT.js} +1 -1
- package/dist/chunks/{context-noninteractive-BJ4hE3MX.js → context-noninteractive-BUIf4IMX.js} +1 -1
- package/dist/chunks/context-noninteractive-CzuLiIeO.js +1 -0
- package/dist/chunks/{conversation-DizpkPtq.js → conversation-CLRfdC_V.js} +1 -1
- package/dist/chunks/conversation-D2iFk7Te.js +1 -0
- package/dist/chunks/{copy-BuPCS2HG.js → copy-BgHTb1Z0.js} +1 -1
- package/dist/chunks/{createSSHSession-Di9Je4Th.js → createSSHSession-C_mpeqPy.js} +1 -1
- package/dist/chunks/createSession-XhPMcSns.js +1 -0
- package/dist/chunks/{createSession-D6v0lBtG.js → createSession-kVJBXQlZ.js} +1 -1
- package/dist/chunks/{cronJitterConfig-By18m-PD.js → cronJitterConfig-SI7bYvJj.js} +1 -1
- package/dist/chunks/{crossProjectResume-C4YT2T6P.js → crossProjectResume-BMWSw62A.js} +1 -1
- package/dist/chunks/datadog-B5oHSyS1.js +1 -0
- package/dist/chunks/{datadog-BFSdlK6C.js → datadog-Bd9AgZT-.js} +1 -1
- package/dist/chunks/{desktop-Bd-JHrBo.js → desktop-BeUj2fqu.js} +1 -1
- package/dist/chunks/{diff-DGmINgOc.js → diff-BzgXDp1o.js} +1 -1
- package/dist/chunks/{doctor-DQ42RQPx.js → doctor-HCOexiL5.js} +1 -1
- package/dist/chunks/{effort-E6XjzPYR.js → effort-BaJU_k2K.js} +1 -1
- package/dist/chunks/entry-BoXZIfxW.js +14 -0
- package/dist/chunks/envLessBridgeConfig-CnR1E53G.js +1 -0
- package/dist/chunks/envLessBridgeConfig-DgdkC9jO.js +1 -0
- package/dist/chunks/{exit-CVlpMwCq.js → exit-B-9k0zjK.js} +1 -1
- package/dist/chunks/{export-CXcPQd0T.js → export-p85q3g8t.js} +1 -1
- package/dist/chunks/{exportRenderer-B9WXgMV2.js → exportRenderer-CUqd8PZM.js} +1 -1
- package/dist/chunks/extra-usage-CsJ9Z2G1.js +1 -0
- package/dist/chunks/{extra-usage-core-B20tawuN.js → extra-usage-core-B9Fy8_RP.js} +1 -1
- package/dist/chunks/{extra-usage-noninteractive-DZRe98BZ.js → extra-usage-noninteractive-B4vaWh0y.js} +1 -1
- package/dist/chunks/{extra-usage-B2KmuAZe.js → extra-usage-pPprHqwq.js} +1 -1
- package/dist/chunks/{extraUsage-CxqJdnGC.js → extraUsage-CEHCMe7l.js} +1 -1
- package/dist/chunks/extractMemories-D34FfNYT.js +1 -0
- package/dist/chunks/{fast-CPmJ2bp3.js → fast-CiSIZ5FI.js} +1 -1
- package/dist/chunks/fast-CxPB-PBH.js +1 -0
- package/dist/chunks/{feedback-4GY3ahvw.js → feedback-C2QLdCfW.js} +1 -1
- package/dist/chunks/{firstPartyEventLogger-CISUrAsf.js → firstPartyEventLogger-CozFbFD9.js} +1 -1
- package/dist/chunks/{flushGate-Dr8sMjB7.js → flushGate-LXr8ynSz.js} +1 -1
- package/dist/chunks/{gates-DI4pxvrD.js → gates-BGfvIJXl.js} +1 -1
- package/dist/chunks/gates-D-kXXHiv.js +1 -0
- package/dist/chunks/{gemini-Dcfosr2Z.js → gemini-BFBrPtVM.js} +1 -1
- package/dist/chunks/{generateRecap-CH_fgtxk.js → generateRecap-CLla3Ymz.js} +1 -1
- package/dist/chunks/{generateSessionName-DO0R__8w.js → generateSessionName-DF4I7gr2.js} +1 -1
- package/dist/chunks/{githubRepoPathMapping-D5I8CVDz.js → githubRepoPathMapping-C_5RCW_Z.js} +1 -1
- package/dist/chunks/{grok-X0FzcE6Y.js → grok-Dih61WOo.js} +1 -1
- package/dist/chunks/{growthbook-DZPT2JzB.js → growthbook-C39e6Byf.js} +1 -1
- package/dist/chunks/{heapdump-Cq6i0wJH.js → heapdump-BRj4tC1y.js} +1 -1
- package/dist/chunks/{help-B8ddA-Ec.js → help-fH9LNwox.js} +1 -1
- package/dist/chunks/hooks-Cw-F-1uO.js +1 -0
- package/dist/chunks/{hooks-CvFNccdv.js → hooks-D22Uu3Vs.js} +1 -1
- package/dist/chunks/{hostAdapter-D3s4JFk-.js → hostAdapter-CbXytx4y.js} +1 -1
- package/dist/chunks/{ide-CzxV5_D7.js → ide-DM5Tw70v.js} +1 -1
- package/dist/chunks/{inboundAttachments-B3ZTyNKF.js → inboundAttachments-2QIORKsd.js} +1 -1
- package/dist/chunks/inboundAttachments-CZN_sUNx.js +1 -0
- package/dist/chunks/initReplBridge-D8sWx97P.js +1 -0
- package/dist/chunks/{insights-DiWlKgVQ.js → insights-B6ogyLuv.js} +1 -1
- package/dist/chunks/{install-BFpg1zm1.js → install-DimDiHha.js} +1 -1
- package/dist/chunks/{install-github-app-BUCGGSw0.js → install-github-app-CQ7vkhIX.js} +1 -1
- package/dist/chunks/{install-slack-app-D5JDqzbs.js → install-slack-app-By9_5YS7.js} +1 -1
- package/dist/chunks/{instrumentation--BToLJT9.js → instrumentation-DbKu2GCL.js} +3 -3
- package/dist/chunks/{job-mUyxSEc2.js → job-D_DoFtev.js} +1 -1
- package/dist/chunks/{keybindings-D4DbE4G0.js → keybindings-DYRBv1bg.js} +1 -1
- package/dist/chunks/{lang-cMcnaxAR.js → lang-CAMxxG9F.js} +1 -1
- package/dist/chunks/{language-sTn9sA3E.js → language-CoHgN7rh.js} +1 -1
- package/dist/chunks/language-DB1HIsF8.js +1 -0
- package/dist/chunks/{launchAgentsPlatform-CAfyCAsQ.js → launchAgentsPlatform-9P8K66ku.js} +1 -1
- package/dist/chunks/{launchAutofixPr-CSMamZS6.js → launchAutofixPr-BbsqqUMA.js} +1 -1
- package/dist/chunks/{launchLocalMemory-nYAwNsNT.js → launchLocalMemory-K55Yo6JM.js} +1 -1
- package/dist/chunks/{launchLocalVault-yPp8S-tG.js → launchLocalVault-rrd1Q7jP.js} +1 -1
- package/dist/chunks/{launchMemoryStores-Dk3SXucB.js → launchMemoryStores-DMZ8GNQj.js} +1 -1
- package/dist/chunks/{launchOnboarding-BoqmHyRx.js → launchOnboarding-Duz_huXl.js} +1 -1
- package/dist/chunks/{launchSchedule-C2HBjD6C.js → launchSchedule-7VlG_3M6.js} +1 -1
- package/dist/chunks/{launchSkillStore-B5Yjvi-k.js → launchSkillStore-CcJL8RT0.js} +1 -1
- package/dist/chunks/{launchTeleport-BayvAnwh.js → launchTeleport-C8h_4F_L.js} +1 -1
- package/dist/chunks/{launchVault-BszsgPbZ.js → launchVault-Bm1EeT2x.js} +1 -1
- package/dist/chunks/loadAgentsDir-DsskgPWe.js +1 -0
- package/dist/chunks/{loadAgentsDir-Cl2w3uvH.js → loadAgentsDir-HZ19tmOZ.js} +45 -45
- package/dist/chunks/{loadPluginHooks-YHtjByxm.js → loadPluginHooks-DoFtrBWf.js} +1 -1
- package/dist/chunks/{localSearch-CpeqVibs.js → localSearch-4cz5ia5a.js} +1 -1
- package/dist/chunks/localSearch-CScvVw0c.js +1 -0
- package/dist/chunks/{login-TVtq34WQ.js → login-D6ywctRr.js} +1 -1
- package/dist/chunks/login-FdPNsHJs.js +1 -0
- package/dist/chunks/{logoV2Utils-DwaRnvOY.js → logoV2Utils-jaFn88oE.js} +1 -1
- package/dist/chunks/logout-CulTqT7V.js +1 -0
- package/dist/chunks/{magicDocs-_yNWB88A.js → magicDocs-DHGtJq0K.js} +1 -1
- package/dist/chunks/{main-gTbhsbIs.js → main-Bv4AvaJk.js} +15 -15
- package/dist/chunks/{mappers-COd8OOml.js → mappers-qcXgNBi5.js} +1 -1
- package/dist/chunks/{mcp-DoraEndj.js → mcp-BXPg0RPm.js} +1 -1
- package/dist/chunks/{mcp-CChzTC5v.js → mcp-iCbCqg7w.js} +2 -2
- package/dist/chunks/mcp-yDWIJznG.js +2 -0
- package/dist/chunks/{mcpServer-CpBN77YB.js → mcpServer-DcSto-Od.js} +1 -1
- package/dist/chunks/{mcpServer-Wd9rZG_E.js → mcpServer-Do9XTs2J.js} +1 -1
- package/dist/chunks/{memory-I21QZZ9h.js → memory-B0YG4r65.js} +1 -1
- package/dist/chunks/model-DG0v1297.js +1 -0
- package/dist/chunks/{model-BrHh21Db.js → model-DwVGG0mc.js} +1 -1
- package/dist/chunks/{onChangeAppState-Cn_HSmmQ.js → onChangeAppState-CHYSALjM.js} +1 -1
- package/dist/chunks/{openai-BD2V4lHN.js → openai-Brj68CWD.js} +1 -1
- package/dist/chunks/{overageCreditGrant-B47t5a73.js → overageCreditGrant-D5X6-TcP.js} +1 -1
- package/dist/chunks/{passes-DAOPYX0C.js → passes-B1f6NHWA.js} +1 -1
- package/dist/chunks/{paths-q1-Ni8Oh.js → paths-D8Fx3kUi.js} +2 -2
- package/dist/chunks/{permissions-BmxTU-Pk.js → permissions-CYrv_WVH.js} +1 -1
- package/dist/chunks/{pipeTransport-DnHE3axn.js → pipeTransport-DAYnzvGK.js} +1 -1
- package/dist/chunks/{plan-4dmnQ9bv.js → plan-B7EPetF0.js} +1 -1
- package/dist/chunks/{plugin-CG7lJIpf.js → plugin-BRWx-_ZS.js} +1 -1
- package/dist/chunks/{pluginAutoupdate-CPLuidh-.js → pluginAutoupdate-BwxAsU2F.js} +1 -1
- package/dist/chunks/{pluginBlocklist-BHxIUqu4.js → pluginBlocklist-BiRgxFei.js} +1 -1
- package/dist/chunks/{pluginCliCommands-BcDIvxR3.js → pluginCliCommands-CXANH43C.js} +1 -1
- package/dist/chunks/{pluginFlagging-Dh6rYOvj.js → pluginFlagging-CBbUoCJ9.js} +1 -1
- package/dist/chunks/{pluginOperations-fdLcp72i.js → pluginOperations-B3gcFjVq.js} +1 -1
- package/dist/chunks/{pluginStartupCheck-Dy7EckW4.js → pluginStartupCheck-BNfv-Pf4.js} +1 -1
- package/dist/chunks/pluginStartupCheck-Ga_XiMnA.js +1 -0
- package/dist/chunks/{plugins-C3-iYKTp.js → plugins-zHTS03v8.js} +1 -1
- package/dist/chunks/policyLimits-Dsz-jkpD.js +1 -0
- package/dist/chunks/{pollConfig-BGXMaSla.js → pollConfig-BWY_xmk6.js} +1 -1
- package/dist/chunks/{poor-CxAil0Mi.js → poor-Bcu8JaV5.js} +1 -1
- package/dist/chunks/poorMode-BAuBNURJ.js +1 -0
- package/dist/chunks/{poorMode-DFcYVnMT.js → poorMode-CDhhKGBw.js} +1 -1
- package/dist/chunks/{print-Cog1o-Tw.js → print-DO52Fudu.js} +4 -4
- package/dist/chunks/{privacy-settings-D6g7p6sB.js → privacy-settings-CmHUlYoo.js} +1 -1
- package/dist/chunks/{processBashCommand-DqgujTR4.js → processBashCommand-DltW2Ubs.js} +1 -1
- package/dist/chunks/{processSlashCommand-DUPS9Xx3.js → processSlashCommand-JLJ_vF05.js} +1 -1
- package/dist/chunks/{prompt-BmOnuQfF.js → prompt-BxoRdmaw.js} +1 -1
- package/dist/chunks/prompt-D3rBUscf.js +1 -0
- package/dist/chunks/prompt-ohTcwieE.js +1 -0
- package/dist/chunks/{promptEditor-ClGwMkWl.js → promptEditor-LQu9NhbN.js} +1 -1
- package/dist/chunks/{protocolHandler--b0d38gF.js → protocolHandler-DYn2E9Yl.js} +1 -1
- package/dist/chunks/{rate-limit-options-DD2ZRREl.js → rate-limit-options-OQt6LUP8.js} +1 -1
- package/dist/chunks/{rcDebugLog-fhwD4wm-.js → rcDebugLog-5XEbz_Yg.js} +1 -1
- package/dist/chunks/{referral-rRvT6UDX.js → referral-BsAvaATn.js} +1 -1
- package/dist/chunks/{refresh-C7S_6LOQ.js → refresh-TlNezXn4.js} +1 -1
- package/dist/chunks/{registerProtocol-Bu_tz5Au.js → registerProtocol-COUVHFku.js} +1 -1
- package/dist/chunks/{registry-Bk0vdx_8.js → registry-m7JojEMY.js} +1 -1
- package/dist/chunks/{release-notes-BShc_V-B.js → release-notes-BDdughgu.js} +1 -1
- package/dist/chunks/{releaseNotes-D3wZdQVZ.js → releaseNotes-Bd3zxid3.js} +2 -2
- package/dist/chunks/{reload-plugins-CpytFAAC.js → reload-plugins-qUIybHNy.js} +1 -1
- package/dist/chunks/{remote-env-B9Of1v31.js → remote-env-GGlLNGsx.js} +1 -1
- package/dist/chunks/{remoteBridgeCore-BXp6nJ8q.js → remoteBridgeCore-DpF5alU6.js} +1 -1
- package/dist/chunks/{remoteControlServer-BvlTaHu4.js → remoteControlServer-C32rxr3F.js} +1 -1
- package/dist/chunks/{rename-DhTddAd7.js → rename-CCF7A5mG.js} +1 -1
- package/dist/chunks/{resume-DwVeFqnc.js → resume-C6ereXig.js} +1 -1
- package/dist/chunks/{runtimeObserver-BtgDP8Gz.js → runtimeObserver-DBdzsp_h.js} +1 -1
- package/dist/chunks/{runtimeObserver-dtT0QHYO.js → runtimeObserver-jrNSkZU2.js} +2 -2
- package/dist/chunks/sandbox-adapter-CQ0imVO1.js +1 -0
- package/dist/chunks/{sandbox-toggle-CG2vZNAb.js → sandbox-toggle-Bfti5GKF.js} +1 -1
- package/dist/chunks/searchExtraTools-Ntz1u-YC.js +1 -0
- package/dist/chunks/{sentry-DFk8bzvt.js → sentry-CZUyEC3A.js} +1 -1
- package/dist/chunks/{session-DifFcUdR.js → session-DCIDa5dI.js} +1 -1
- package/dist/chunks/{sessionDiscovery-CRbLIQv1.js → sessionDiscovery-5m_pul65.js} +1 -1
- package/dist/chunks/sessionFileAccessHooks-DD2a-mTZ.js +1 -0
- package/dist/chunks/{sessionMemory-BdptRKL8.js → sessionMemory-BQP_RezB.js} +1 -1
- package/dist/chunks/sessionMemory-hbxplpxs.js +1 -0
- package/dist/chunks/sessionMemoryUtils-DlW9hqOH.js +1 -0
- package/dist/chunks/{sessionObserver-D3vw6SJ_.js → sessionObserver-LBqNoak9.js} +1 -1
- package/dist/chunks/sessionObserver-Lb1c5FPy.js +1 -0
- package/dist/chunks/sessionStorage-DG68Xvsy.js +1 -0
- package/dist/chunks/{sessionTitle-DnvlYJ-c.js → sessionTitle-BIykjtKk.js} +1 -1
- package/dist/chunks/{sessionTracing-BkzKJi0v.js → sessionTracing-Da_r0mIc.js} +1 -1
- package/dist/chunks/{settingsSync-CHZVpM34.js → settingsSync-BE0PQqyo.js} +1 -1
- package/dist/chunks/{setup-GxlEx1KG.js → setup-CjA5bW6e.js} +1 -1
- package/dist/chunks/{setup-BpwYOhci.js → setup-lxzmZdw5.js} +2 -2
- package/dist/chunks/{setup-BfecYO-n.js → setup-p04XtwYu.js} +1 -1
- package/dist/chunks/{shadowedRuleDetection-FNzEipG0.js → shadowedRuleDetection-Zqp1M5St.js} +1 -1
- package/dist/chunks/{sideQuestion-Bfa0SZn5.js → sideQuestion-DzJenEES.js} +1 -1
- package/dist/chunks/sink-BdRlnpoG.js +1 -0
- package/dist/chunks/{sink-DpAjuilF.js → sink-N5XR8Zgp.js} +1 -1
- package/dist/chunks/sinks-Bn0FK_Ab.js +1 -0
- package/dist/chunks/sinks-D8erzS9D.js +2 -0
- package/dist/chunks/{skill-learning-BSeEbCnP.js → skill-learning-CbMQ8IsZ.js} +1 -1
- package/dist/chunks/{skillChangeDetector-BEDBRGbY.js → skillChangeDetector-4XWLpjQl.js} +1 -1
- package/dist/chunks/{skillGapStore-BCO6YB3H.js → skillGapStore-Bp5IVfOx.js} +1 -1
- package/dist/chunks/{skillGapStore-B4GmZRJ0.js → skillGapStore-DbiDG9Pd.js} +2 -2
- package/dist/chunks/{skillGenerator-QgDWAvzK.js → skillGenerator-Bys7U1l_.js} +2 -2
- package/dist/chunks/skillLearning-702-D6Lq.js +1 -0
- package/dist/chunks/skillLearning-Cz7qU9V6.js +1 -0
- package/dist/chunks/{skillPanel-srZjMIbC.js → skillPanel-MIHU1PPp.js} +3 -3
- package/dist/chunks/{skillSearchPanel-DTvHcwNK.js → skillSearchPanel-MFB-PzB1.js} +2 -2
- package/dist/chunks/{skills-BlVUkWg4.js → skills-D4tZYFpd.js} +1 -1
- package/dist/chunks/{sprites-QO9r_mXk.js → sprites-B479AZSz.js} +1 -1
- package/dist/chunks/{stats-DdXM-u7l.js → stats-B-ErfxCJ.js} +1 -1
- package/dist/chunks/{status-BIZWtZqI.js → status-DVACJLsK.js} +1 -1
- package/dist/chunks/{statusNoticeHelpers-9sIAjiE6.js → statusNoticeHelpers-CwSCVvxP.js} +1 -1
- package/dist/chunks/{tag-DDJ8pAsl.js → tag-YpE2D2ve.js} +1 -1
- package/dist/chunks/{tasks-DYt6udr3.js → tasks-7N7iSiEx.js} +1 -1
- package/dist/chunks/{teamHelpers-BJuKEuyS.js → teamHelpers-BFdTH57t.js} +1 -1
- package/dist/chunks/teamHelpers-CmDn2xyl.js +1 -0
- package/dist/chunks/{teammateModeSnapshot-Zp1weNIZ.js → teammateModeSnapshot-CwacsQvD.js} +1 -1
- package/dist/chunks/teammateModeSnapshot-DXtG86pG.js +1 -0
- package/dist/chunks/{teleport-DkoFG3EI.js → teleport-CPB1CHBs.js} +1 -1
- package/dist/chunks/{templateJobs-V2-TVeGE.js → templateJobs-BM98KAEH.js} +1 -1
- package/dist/chunks/{terminalSetup-DMUDhXur.js → terminalSetup-CGiIwoIX.js} +1 -1
- package/dist/chunks/{terminalSetup-l0Vv_v1c.js → terminalSetup-yQ0CoywX.js} +1 -1
- package/dist/chunks/{theme-Dm1yCDce.js → theme-C5ULGNRs.js} +1 -1
- package/dist/chunks/{thinkback-DQAZE5SA.js → thinkback-CF_sLFvX.js} +1 -1
- package/dist/chunks/thinkback-D1Fv1QYl.js +1 -0
- package/dist/chunks/{thinkback-play-BJcGmc9X.js → thinkback-play-syg_SJm8.js} +1 -1
- package/dist/chunks/{toolEventObserver-C-BImvCz.js → toolEventObserver-CcLqNRcT.js} +1 -1
- package/dist/chunks/{toolEventObserver-BgkqkNwy.js → toolEventObserver-CuJbsUL0.js} +1 -1
- package/dist/chunks/toolPool-C4CO158z.js +1 -0
- package/dist/chunks/{toolPool-DYvz_Mjt.js → toolPool-CRq0GSrk.js} +1 -1
- package/dist/chunks/{trustedDevice-CXsk3eij.js → trustedDevice-C4tvgByY.js} +1 -1
- package/dist/chunks/{trustedDevice-BDrK9AQ6.js → trustedDevice-u2HpuTkN.js} +1 -1
- package/dist/chunks/{ultrareviewCommand-Bc8hMzHz.js → ultrareviewCommand-CWLiiq-z.js} +1 -1
- package/dist/chunks/{undercover-kRoI_nlN.js → undercover-CNlN7Xzl.js} +1 -1
- package/dist/chunks/undercover-jZEIpxrJ.js +1 -0
- package/dist/chunks/{updateCCB-BPGNN7VA.js → updateCCB-BWN4mOEz.js} +1 -1
- package/dist/chunks/{upgrade-DmEGLk6v.js → upgrade-CE25mJEk.js} +1 -1
- package/dist/chunks/upgrade-C_0-l0Zo.js +1 -0
- package/dist/chunks/{upload-49qk5TBL.js → upload-YpyOX2a-.js} +1 -1
- package/dist/chunks/{usage-DhJDFJVx.js → usage-Bw-kTwHb.js} +1 -1
- package/dist/chunks/{usage-sYgTL8wR.js → usage-DNXwr_ep.js} +1 -1
- package/dist/chunks/{useMainLoopModel-CJaR_qEJ.js → useMainLoopModel-DPmF_cMn.js} +1 -1
- package/dist/chunks/{useManagePlugins-B1FpmxFo.js → useManagePlugins-hPG7UMWo.js} +1 -1
- package/dist/chunks/{useMergedTools-eMPZ95TX.js → useMergedTools-BSO1NflP.js} +1 -1
- package/dist/chunks/{useSearchInput-CR-b0Qi6.js → useSearchInput-CR9uhbA7.js} +1 -1
- package/dist/chunks/{useSettingsErrors-p-PFBeaC.js → useSettingsErrors-453j5XuO.js} +1 -1
- package/dist/chunks/{useVoice-D3PqTfCK.js → useVoice-B5DQ5Tay.js} +1 -1
- package/dist/chunks/{util-BZ2fS3PR.js → util-D_BHu06u.js} +1 -1
- package/dist/chunks/utils--ZdihcLH.js +1 -0
- package/dist/chunks/{validatePlugin-QtcXXmZu.js → validatePlugin-Dxm-5f8W.js} +1 -1
- package/dist/chunks/{vim-LmepJftY.js → vim-BGqKMQxl.js} +1 -1
- package/dist/chunks/{voice-CNRTt4gH.js → voice-B2MWrkN3.js} +1 -1
- package/dist/chunks/voiceModeEnabled-0NU5pSM-.js +1 -0
- package/dist/chunks/{voiceModeEnabled-wWM929QG.js → voiceModeEnabled-if9dV1bW.js} +1 -1
- package/dist/chunks/{voiceStreamSTT-CnK9GN6Q.js → voiceStreamSTT-CWhKAxcp.js} +1 -1
- package/dist/chunks/voiceStreamSTT-yvcTWD7i.js +1 -0
- package/dist/chunks/{workerRegistry-CrIpKIZe.js → workerRegistry-BANOcuS2.js} +1 -1
- package/dist/chunks/worktree-CRn2SbHn.js +1 -0
- package/dist/chunks/{xml-CMdTGiv6.js → xml-DZp0WcWT.js} +1 -1
- package/dist/cli.js +1 -1
- package/package.json +1 -1
- package/dist/chunks/ApproveApiKey-Bmcop2Do.js +0 -1
- package/dist/chunks/ClaudeMdExternalIncludesDialog-DO61Zz-S.js +0 -1
- package/dist/chunks/ConsoleOAuthFlow-FSHC5mxO.js +0 -1
- package/dist/chunks/Doctor-Dcntgp5Z.js +0 -1
- package/dist/chunks/Feedback-hFZwDSRp.js +0 -2
- package/dist/chunks/Grove-Cmcsx2UE.js +0 -1
- package/dist/chunks/MessageSelector-CDVC2CAj.js +0 -3
- package/dist/chunks/REPL-Dk3Ics9i.js +0 -1
- package/dist/chunks/SearchExtraToolsTool-C998WSxs.js +0 -1
- package/dist/chunks/SentryErrorBoundary-BJLT-ebr.js +0 -1
- package/dist/chunks/Settings-DBopjMkN.js +0 -2
- package/dist/chunks/WelcomeV2-BBFGft_e.js +0 -1
- package/dist/chunks/api-B2HW-oZI.js +0 -1
- package/dist/chunks/assistant-BmM44yln.js +0 -1
- package/dist/chunks/auth-ndSNSeqS.js +0 -1
- package/dist/chunks/backgroundHousekeeping-DVo3ndZr.js +0 -1
- package/dist/chunks/bridgeConfig-ZcbBdhji.js +0 -1
- package/dist/chunks/bridgeEnabled-D5qCI5v2.js +0 -1
- package/dist/chunks/bridgeMain-B4Zv8UOe.js +0 -1
- package/dist/chunks/caches-D_W3nCFE.js +0 -1
- package/dist/chunks/changeDetector-CUsHUdul.js +0 -1
- package/dist/chunks/channelNotification-CLVU5AuO.js +0 -1
- package/dist/chunks/clear-BP-G1JWa.js +0 -1
- package/dist/chunks/client-BHfY6SC5.js +0 -1
- package/dist/chunks/commands-E0eNJ_XZ.js +0 -1
- package/dist/chunks/commitAttribution-B4DOgUS7.js +0 -1
- package/dist/chunks/context-noninteractive-D1Kxn5e0.js +0 -1
- package/dist/chunks/conversation-C23rDJe3.js +0 -1
- package/dist/chunks/createSession-Bsa0VJKS.js +0 -1
- package/dist/chunks/datadog-MUvg76p3.js +0 -1
- package/dist/chunks/entry-Di8oWZUk.js +0 -14
- package/dist/chunks/envLessBridgeConfig-BNvozi46.js +0 -1
- package/dist/chunks/envLessBridgeConfig-CUTBQKDY.js +0 -1
- package/dist/chunks/extra-usage-DVtAa1zD.js +0 -1
- package/dist/chunks/extractMemories-8uB606Y0.js +0 -1
- package/dist/chunks/fast-DTGg3pRh.js +0 -1
- package/dist/chunks/gates-BbF5S-Dy.js +0 -1
- package/dist/chunks/hooks-gwB4Eotj.js +0 -1
- package/dist/chunks/inboundAttachments-DxrrrqBW.js +0 -1
- package/dist/chunks/initReplBridge-DWpGy3aE.js +0 -1
- package/dist/chunks/language-DC6bsdvI.js +0 -1
- package/dist/chunks/loadAgentsDir-6_9ZFegv.js +0 -1
- package/dist/chunks/localSearch-DbEm6f3k.js +0 -1
- package/dist/chunks/login-D2x89UCR.js +0 -1
- package/dist/chunks/logout-BBPihkXp.js +0 -1
- package/dist/chunks/mcp-D-0wE0nJ.js +0 -2
- package/dist/chunks/model-C6_WjCy0.js +0 -1
- package/dist/chunks/pluginStartupCheck-fyqW-stg.js +0 -1
- package/dist/chunks/policyLimits-DUGrXcje.js +0 -1
- package/dist/chunks/poorMode-BkPHRLuG.js +0 -1
- package/dist/chunks/prompt-B-8CD-W_.js +0 -1
- package/dist/chunks/prompt-Da3gIGA8.js +0 -1
- package/dist/chunks/sandbox-adapter-Cm8kCM_U.js +0 -1
- package/dist/chunks/searchExtraTools-D-RZ9DId.js +0 -1
- package/dist/chunks/sessionFileAccessHooks-Bixkjai4.js +0 -1
- package/dist/chunks/sessionMemory-T1K_mJRE.js +0 -1
- package/dist/chunks/sessionMemoryUtils-q3xRtP-z.js +0 -1
- package/dist/chunks/sessionObserver-i_3day_6.js +0 -1
- package/dist/chunks/sessionStorage-CusaYoh0.js +0 -1
- package/dist/chunks/sink-BSwQ045N.js +0 -1
- package/dist/chunks/sinks-C37Xl5c3.js +0 -2
- package/dist/chunks/sinks-DHHmQJi-.js +0 -1
- package/dist/chunks/skillLearning-CFYgFRPE.js +0 -1
- package/dist/chunks/skillLearning-en7AuVDZ.js +0 -1
- package/dist/chunks/teamHelpers-Cw5dPQor.js +0 -1
- package/dist/chunks/teammateModeSnapshot-BXC7ssXX.js +0 -1
- package/dist/chunks/thinkback-D1mk7cq1.js +0 -1
- package/dist/chunks/toolPool-DNH5H4Jg.js +0 -1
- package/dist/chunks/undercover-DUrQYxYo.js +0 -1
- package/dist/chunks/upgrade-BTI562Ce.js +0 -1
- package/dist/chunks/utils-hhztcb0b.js +0 -1
- package/dist/chunks/voiceModeEnabled-B57V7REx.js +0 -1
- package/dist/chunks/voiceStreamSTT-Dp-1uSjP.js +0 -1
- package/dist/chunks/worktree-YbEK6b36.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{n as e,o as t}from"./chunk-DR8-3Aex.js";import{s as n,u as r}from"./envUtils-BWeoiL4Y.js";import{n as i,t as a}from"./figures-gfT9mM8P.js";import{Cn as o,F as s,Q as c,Rn as l,T as u,Ut as d,_ as f,b as p,f as m,g as h,h as g,n as _,nt as v,p as y,r as b,t as x,tn as ee,tt as te,v as S,x as C,xt as ne}from"./src-Di342QoJ.js";import{t as w}from"./jsx-runtime-D-D469L8.js";import{Ac as T,Do as E,Fc as D,Po as O,Qa as k,Zt as A,as as j,jo as M,lo as re,ls as N,no as P,on as ie,oo as F,os as ae,ws as oe,xs as se}from"./paths-q1-Ni8Oh.js";import{K as I,L as ce,T as le,V as L,d as ue,s as de,w as fe}from"./debug-UI3T040K.js";import{n as pe,r as me}from"./analytics-DqMQntaB.js";import{l as he,u as ge}from"./oauth-CdZEzMww.js";import{c as _e,o as ve,s as ye}from"./log-CzsijfHZ.js";import{b as be,x as xe}from"./teammate-DMYOtLTK.js";import{E as Se,S as Ce}from"./startupProfiler-DnXZaX4A.js";import{$C as we,$s as Te,AC as Ee,As as De,BA as Oe,BS as R,Bw as ke,Bx as Ae,DC as je,Es as Me,Fs as Ne,Fw as Pe,Gs as Fe,Hs as Ie,Iw as Le,JC as Re,LS as ze,Lw as Be,Ms as Ve,Mw as He,NA as Ue,Nw as We,Nx as Ge,OC as Ke,Ow as qe,Pw as Je,QC as Ye,RS as Xe,Rs as Ze,Rw as Qe,SC as $e,Sx as et,Sy as tt,Uw as nt,Vs as rt,WC as it,XC as at,Xs as ot,Ys as st,aA as ct,ac as lt,by as ut,eC as z,ec as dt,fs as ft,fw as pt,hw as mt,ic as ht,ks as gt,kw as _t,kx as vt,lc as yt,my as bt,nA as xt,nc as St,nh as Ct,nw as wt,oA as Tt,ps as Et,qC as Dt,qs as Ot,rc as kt,rh as At,sc as jt,tC as Mt,tc as Nt,uc as Pt,vs as Ft,ys as It,zA as Lt,zw as Rt,zx as zt}from"./loadAgentsDir-Cl2w3uvH.js";import{i as Bt,o as Vt,p as Ht,u as Ut}from"./xml-CMdTGiv6.js";import{n as Wt,t as Gt}from"./browser-fLRXxIsQ.js";import{t as Kt}from"./useKeybinding-FsOnjW6T.js";import{l as qt,u as Jt}from"./referral-rRvT6UDX.js";import{n as Yt,t as Xt}from"./pluginStartupCheck-Dy7EckW4.js";import{a as Zt,d as Qt,f as $t,i as en,l as tn,o as nn,s as rn,u as an}from"./pluginOperations-fdLcp72i.js";import{a as on,c as sn,i as cn,n as ln,o as un,s as dn,t as fn}from"./validatePlugin-QtcXXmZu.js";import{a as pn,n as mn,o as hn,r as gn}from"./pluginFlagging-Dh6rYOvj.js";import{i as _n,n as vn,r as yn}from"./MCPConnectionManager-kVO-4BcA.js";import{t as bn}from"./SearchBox-DfOmUoaI.js";import{n as xn,t as Sn}from"./useSearchInput-CR-b0Qi6.js";import{i as Cn,n as wn}from"./pluginAutoupdate-CPLuidh-.js";import*as Tn from"path";import*as En from"fs/promises";function Dn({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,On.jsxs)(C,{children:[(0,On.jsx)(p,{bold:!0,children:`Capabilities: `}),(0,On.jsx)(p,{color:`text`,children:r.length>0?(0,On.jsx)(g,{children:r}):`none`})]})}var On,kn=e((()=>{l(),x(),On=w()}));function An(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 jn(e,t){return`Error reconnecting to ${t}: ${e instanceof Error?e.message:String(e)}`}var Mn=e((()=>{}));function Nn({server:e,serverToolsCount:t,onViewTools:n,onCancel:r,onComplete:i,borderless:o=!1}){let[l]=u(),d=Jt(),{columns:f}=s(),[m,_]=B.useState(!1),[v,y]=B.useState(null),b=Xe(e=>e.mcp),x=R(),[w,T]=B.useState(null),[D,O]=(0,B.useState)(!1),k=(0,B.useRef)(null),[j,M]=(0,B.useState)(!1),[re,N]=(0,B.useState)(null),[P,ie]=(0,B.useState)(!1),[F,ae]=(0,B.useState)(null),[oe,se]=(0,B.useState)(!1),[I,le]=(0,B.useState)(!1),L=(0,B.useRef)(void 0),ue=(0,B.useRef)(!1),[de,fe]=(0,B.useState)(``),[pe,ge]=(0,B.useState)(0),[ve,ye]=(0,B.useState)(null);(0,B.useEffect)(()=>()=>{ue.current=!0,k.current?.abort(),L.current!==void 0&&clearTimeout(L.current)},[]);let be=e.isAuthenticated||e.client.type===`connected`&&t>0,xe=yn(),Se=B.useCallback(async()=>{M(!1),N(null),O(!0);try{let t=await xe(e.name),n=t.client.type===`connected`;me(`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){me(`tengu_claudeai_mcp_auth_completed`,{success:!1}),i?.(jn(t,e.name))}finally{O(!1)}},[xe,e.name,i]),Ce=B.useCallback(async()=>{await et(e.name,{...e.config,scope:e.scope}),x(t=>{let n=t.mcp.clients.map(t=>t.name===e.name?{...t,type:`needs-auth`}:t),r=at(t.mcp.tools,e.name),i=Dt(t.mcp.commands,e.name),a=Re(t.mcp.resources,e.name);return{...t,mcp:{...t.mcp,clients:n,tools:r,commands:i,resources:a}}}),me(`tengu_claudeai_mcp_clear_auth_completed`,{}),i?.(`Disconnected from ${e.name}.`),ie(!1),ae(null),se(!1)},[e.name,e.config,e.scope,x,i]);te(`confirm:no`,()=>{k.current?.abort(),k.current=null,_(!1),T(null)},{context:`Confirmation`,isActive:m}),te(`confirm:no`,()=>{M(!1),N(null)},{context:`Confirmation`,isActive:j}),te(`confirm:no`,()=>{ie(!1),ae(null),se(!1)},{context:`Confirmation`,isActive:P}),ne((e,t)=>{if(t.return&&j&&Se(),t.return&&P)if(oe)Ce();else{let e=`${he().CLAUDE_AI_ORIGIN}/settings/connectors`;ae(e),se(!0),Wt(e)}if(e===`c`&&!I){let e=w||re||F;e&&ee(e).then(e=>{ue.current||(e&&process.stdout.write(e),le(!0),L.current!==void 0&&clearTimeout(L.current),L.current=setTimeout(le,2e3,!1))})}});let we=E(String(e.name)),Te=Ye(b.commands,e.name).length,De=_n(),Oe=B.useCallback(async()=>{let t=he().CLAUDE_AI_ORIGIN,n=A()?.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`,N(r),M(!0),me(`tengu_claudeai_mcp_auth_started`,{}),await Wt(r)},[e.config]),ke=B.useCallback(()=>{ie(!0),me(`tengu_claudeai_mcp_clear_auth_started`,{})},[]),Ae=B.useCallback(async()=>{let t=e.client.type!==`disabled`;try{await De(e.name),e.config.type===`claudeai-proxy`&&me(`tengu_claudeai_mcp_toggle`,{new_state:t?`disabled`:`enabled`}),r()}catch(n){i?.(`Failed to ${t?`disable`:`enable`} MCP server '${e.name}': ${ce(n)}`)}},[e.client.type,e.config.type,e.name,De,r,i]),je=B.useCallback(async()=>{if(e.config.type===`claudeai-proxy`)return;_(!0),y(null);let t=new AbortController;k.current=t;try{if(e.isAuthenticated&&e.config&&await Ee(e.name,e.config,{preserveStepUpState:!0}),e.config){await Ke(e.name,e.config,T,t.signal,{onWaitingForCallback:e=>{ye(()=>e)}}),me(`tengu_mcp_auth_config_authenticate`,{wasAuthenticated:e.isAuthenticated});let n=await xe(e.name);if(n.client.type===`connected`){let t=be?`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.`):(_e(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 $e)&&y(e.message)}finally{_(!1),k.current=null,ye(null),fe(``)}},[e.isAuthenticated,e.config,e.name,i,xe,be]),Me=async()=>{e.config.type!==`claudeai-proxy`&&e.config&&(await Ee(e.name,e.config),me(`tengu_mcp_auth_config_clear`,{}),await et(e.name,{...e.config,scope:e.scope}),x(t=>{let n=t.mcp.clients.map(t=>t.name===e.name?{...t,type:`failed`}:t),r=at(t.mcp.tools,e.name),i=Dt(t.mcp.commands,e.name),a=Re(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(m){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,V.jsxs)(C,{flexDirection:`column`,gap:1,padding:1,children:[(0,V.jsxs)(p,{color:`claude`,children:[`Authenticating with `,e.name,`…`]}),(0,V.jsxs)(C,{children:[(0,V.jsx)(ut,{}),(0,V.jsx)(p,{children:t})]}),w&&(0,V.jsxs)(C,{flexDirection:`column`,children:[(0,V.jsxs)(C,{children:[(0,V.jsx)(p,{dimColor:!0,children:`If your browser doesn't open automatically, copy this URL manually `}),I?(0,V.jsx)(p,{color:`success`,children:`(Copied!)`}):(0,V.jsx)(p,{dimColor:!0,children:(0,V.jsx)(h,{shortcut:`c`,action:`copy`,parens:!0})})]}),(0,V.jsx)(c,{url:w})]}),m&&w&&ve&&(0,V.jsxs)(C,{flexDirection:`column`,marginTop:1,children:[(0,V.jsx)(p,{dimColor:!0,children:`If the redirect page shows a connection error, paste the URL from your browser's address bar:`}),(0,V.jsxs)(C,{children:[(0,V.jsxs)(p,{dimColor:!0,children:[`URL `,`>`,` `]}),(0,V.jsx)(zt,{value:de,onChange:fe,onSubmit:e=>{ve(e.trim()),fe(``)},cursorOffset:pe,onChangeCursorOffset:ge,columns:f-8})]})]}),(0,V.jsx)(C,{marginLeft:3,children:(0,V.jsx)(p,{dimColor:!0,children:`Return here after authenticating in your browser. Press Esc to go back.`})})]})}if(j)return(0,V.jsxs)(C,{flexDirection:`column`,gap:1,padding:1,children:[(0,V.jsxs)(p,{color:`claude`,children:[`Authenticating with `,e.name,`…`]}),(0,V.jsxs)(C,{children:[(0,V.jsx)(ut,{}),(0,V.jsx)(p,{children:` A browser window will open for authentication`})]}),re&&(0,V.jsxs)(C,{flexDirection:`column`,children:[(0,V.jsxs)(C,{children:[(0,V.jsx)(p,{dimColor:!0,children:`If your browser doesn't open automatically, copy this URL manually `}),I?(0,V.jsx)(p,{color:`success`,children:`(Copied!)`}):(0,V.jsx)(p,{dimColor:!0,children:(0,V.jsx)(h,{shortcut:`c`,action:`copy`,parens:!0})})]}),(0,V.jsx)(c,{url:re})]}),(0,V.jsxs)(C,{marginLeft:3,flexDirection:`column`,children:[(0,V.jsxs)(p,{color:`permission`,children:[`Press `,(0,V.jsx)(p,{bold:!0,children:`Enter`}),` after authenticating in your browser.`]}),(0,V.jsx)(p,{dimColor:!0,italic:!0,children:(0,V.jsx)(z,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})})]})]});if(P)return(0,V.jsxs)(C,{flexDirection:`column`,gap:1,padding:1,children:[(0,V.jsxs)(p,{color:`claude`,children:[`Clear authentication for `,e.name]}),oe?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(p,{children:`Find the MCP server in the browser and click "Disconnect".`}),F&&(0,V.jsxs)(C,{flexDirection:`column`,children:[(0,V.jsxs)(C,{children:[(0,V.jsx)(p,{dimColor:!0,children:`If your browser didn't open automatically, copy this URL manually `}),I?(0,V.jsx)(p,{color:`success`,children:`(Copied!)`}):(0,V.jsx)(p,{dimColor:!0,children:(0,V.jsx)(h,{shortcut:`c`,action:`copy`,parens:!0})})]}),(0,V.jsx)(c,{url:F})]}),(0,V.jsxs)(C,{marginLeft:3,flexDirection:`column`,children:[(0,V.jsxs)(p,{color:`permission`,children:[`Press `,(0,V.jsx)(p,{bold:!0,children:`Enter`}),` when done.`]}),(0,V.jsx)(p,{dimColor:!0,italic:!0,children:(0,V.jsx)(z,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})})]})]}):(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(p,{children:`This will open claude.ai in the browser. Find the MCP server in the list and click "Disconnect".`}),(0,V.jsxs)(C,{marginLeft:3,flexDirection:`column`,children:[(0,V.jsxs)(p,{color:`permission`,children:[`Press `,(0,V.jsx)(p,{bold:!0,children:`Enter`}),` to open the browser.`]}),(0,V.jsx)(p,{dimColor:!0,italic:!0,children:(0,V.jsx)(z,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})})]})]})]});if(D)return(0,V.jsxs)(C,{flexDirection:`column`,gap:1,padding:1,children:[(0,V.jsxs)(p,{color:`text`,children:[`Connecting to `,(0,V.jsx)(p,{bold:!0,children:e.name}),`…`]}),(0,V.jsxs)(C,{children:[(0,V.jsx)(ut,{}),(0,V.jsx)(p,{children:` Establishing connection to MCP server`})]}),(0,V.jsx)(p,{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`}):(be&&(Ne.push({label:`Re-authenticate`,value:`reauth`}),Ne.push({label:`Clear authentication`,value:`clear-auth`})),be||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,V.jsxs)(C,{flexDirection:`column`,children:[(0,V.jsxs)(C,{flexDirection:`column`,paddingX:1,borderStyle:o?void 0:`round`,children:[(0,V.jsx)(C,{marginBottom:1,children:(0,V.jsxs)(p,{bold:!0,children:[we,` MCP Server`]})}),(0,V.jsxs)(C,{flexDirection:`column`,gap:0,children:[(0,V.jsxs)(C,{children:[(0,V.jsx)(p,{bold:!0,children:`Status: `}),e.client.type===`disabled`?(0,V.jsxs)(p,{children:[S(`inactive`,l)(a.radioOff),` disabled`]}):e.client.type===`connected`?(0,V.jsxs)(p,{children:[S(`success`,l)(a.tick),` connected`]}):e.client.type===`pending`?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(p,{dimColor:!0,children:a.radioOff}),(0,V.jsx)(p,{children:` connecting…`})]}):e.client.type===`needs-auth`?(0,V.jsxs)(p,{children:[S(`warning`,l)(a.triangleUpOutline),` needs authentication`]}):(0,V.jsxs)(p,{children:[S(`error`,l)(a.cross),` failed`]})]}),e.transport!==`claudeai-proxy`&&(0,V.jsxs)(C,{children:[(0,V.jsx)(p,{bold:!0,children:`Auth: `}),be?(0,V.jsxs)(p,{children:[S(`success`,l)(a.tick),` authenticated`]}):(0,V.jsxs)(p,{children:[S(`error`,l)(a.cross),` not authenticated`]})]}),(0,V.jsxs)(C,{children:[(0,V.jsx)(p,{bold:!0,children:`URL: `}),(0,V.jsx)(p,{dimColor:!0,children:e.config.url})]}),(0,V.jsxs)(C,{children:[(0,V.jsx)(p,{bold:!0,children:`Config location: `}),(0,V.jsx)(p,{dimColor:!0,children:it(e.scope)})]}),e.client.type===`connected`&&(0,V.jsx)(Dn,{serverToolsCount:t,serverPromptsCount:Te,serverResourcesCount:b.resources[e.name]?.length||0}),e.client.type===`connected`&&t>0&&(0,V.jsxs)(C,{children:[(0,V.jsx)(p,{bold:!0,children:`Tools: `}),(0,V.jsxs)(p,{dimColor:!0,children:[t,` tools`]})]})]}),v&&(0,V.jsx)(C,{marginTop:1,children:(0,V.jsxs)(p,{color:`error`,children:[`Error: `,v]})}),Ne.length>0&&(0,V.jsx)(C,{marginTop:1,children:(0,V.jsx)(Ge,{options:Ne,onChange:async t=>{switch(t){case`tools`:n();break;case`auth`:case`reauth`:await je();break;case`clear-auth`:await Me();break;case`claudeai-auth`:await Oe();break;case`claudeai-clear-auth`:ke();break;case`reconnectMcpServer`:O(!0);try{let t=await xe(e.name);e.config.type===`claudeai-proxy`&&me(`tengu_claudeai_mcp_reconnect`,{success:t.client.type===`connected`});let{message:n}=An(t,e.name);i?.(n)}catch(t){e.config.type===`claudeai-proxy`&&me(`tengu_claudeai_mcp_reconnect`,{success:!1}),i?.(jn(t,e.name))}finally{O(!1)}break;case`toggle-enabled`:await Ae();break;case`back`:r();break}},onCancel:r})})]}),(0,V.jsx)(C,{marginTop:1,children:(0,V.jsx)(p,{dimColor:!0,italic:!0,children:d.pending?(0,V.jsxs)(V.Fragment,{children:[`Press `,d.keyName,` again to exit`]}):(0,V.jsxs)(g,{children:[(0,V.jsx)(h,{shortcut:`↑↓`,action:`navigate`}),(0,V.jsx)(h,{shortcut:`Enter`,action:`select`}),(0,V.jsx)(z,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]})})})]})}var B,V,Pn=e((()=>{i(),B=t(l(),1),pe(),ge(),qt(),nt(),x(),Kt(),je(),vt(),vn(),wt(),ze(),ie(),Gt(),L(),ve(),M(),Mt(),bt(),tt(),Ae(),kn(),Mn(),V=w()}));function Fn({server:e,serverToolsCount:t,onViewTools:n,onCancel:r,onComplete:i,borderless:o=!1}){let[s]=u(),c=Jt(),l=Xe(e=>e.mcp),d=yn(),f=_n(),[m,_]=(0,In.useState)(!1),v=In.useCallback(async()=>{let t=e.client.type!==`disabled`;try{await f(e.name),r()}catch(n){i(`Failed to ${t?`disable`:`enable`} MCP server '${e.name}': ${ce(n)}`)}},[e.client.type,e.name,f,r,i]),y=E(String(e.name)),b=Ye(l.commands,e.name).length,x=[];return e.client.type!==`disabled`&&t>0&&x.push({label:`View tools`,value:`tools`}),e.client.type!==`disabled`&&x.push({label:`Reconnect`,value:`reconnectMcpServer`}),x.push({label:e.client.type===`disabled`?`Enable`:`Disable`,value:`toggle-enabled`}),x.length===0&&x.push({label:`Back`,value:`back`}),m?(0,H.jsxs)(C,{flexDirection:`column`,gap:1,padding:1,children:[(0,H.jsxs)(p,{color:`text`,children:[`Reconnecting to `,(0,H.jsx)(p,{bold:!0,children:e.name})]}),(0,H.jsxs)(C,{children:[(0,H.jsx)(ut,{}),(0,H.jsx)(p,{children:` Restarting MCP server process`})]}),(0,H.jsx)(p,{dimColor:!0,children:`This may take a few moments.`})]}):(0,H.jsxs)(C,{flexDirection:`column`,children:[(0,H.jsxs)(C,{flexDirection:`column`,paddingX:1,borderStyle:o?void 0:`round`,children:[(0,H.jsx)(C,{marginBottom:1,children:(0,H.jsxs)(p,{bold:!0,children:[y,` MCP Server`]})}),(0,H.jsxs)(C,{flexDirection:`column`,gap:0,children:[(0,H.jsxs)(C,{children:[(0,H.jsx)(p,{bold:!0,children:`Status: `}),e.client.type===`disabled`?(0,H.jsxs)(p,{children:[S(`inactive`,s)(a.radioOff),` disabled`]}):e.client.type===`connected`?(0,H.jsxs)(p,{children:[S(`success`,s)(a.tick),` connected`]}):e.client.type===`pending`?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(p,{dimColor:!0,children:a.radioOff}),(0,H.jsx)(p,{children:` connecting…`})]}):(0,H.jsxs)(p,{children:[S(`error`,s)(a.cross),` failed`]})]}),(0,H.jsxs)(C,{children:[(0,H.jsx)(p,{bold:!0,children:`Command: `}),(0,H.jsx)(p,{dimColor:!0,children:e.config.command})]}),e.config.args&&e.config.args.length>0&&(0,H.jsxs)(C,{children:[(0,H.jsx)(p,{bold:!0,children:`Args: `}),(0,H.jsx)(p,{dimColor:!0,children:e.config.args.join(` `)})]}),(0,H.jsxs)(C,{children:[(0,H.jsx)(p,{bold:!0,children:`Config location: `}),(0,H.jsx)(p,{dimColor:!0,children:it(pt(e.name)?.scope??`dynamic`)})]}),e.client.type===`connected`&&(0,H.jsx)(Dn,{serverToolsCount:t,serverPromptsCount:b,serverResourcesCount:l.resources[e.name]?.length||0}),e.client.type===`connected`&&t>0&&(0,H.jsxs)(C,{children:[(0,H.jsx)(p,{bold:!0,children:`Tools: `}),(0,H.jsxs)(p,{dimColor:!0,children:[t,` tools`]})]})]}),x.length>0&&(0,H.jsx)(C,{marginTop:1,children:(0,H.jsx)(Ge,{options:x,onChange:async t=>{if(t===`tools`)n();else if(t===`reconnectMcpServer`){_(!0);try{let{message:t}=An(await d(e.name),e.name);i?.(t)}catch(t){i?.(jn(t,e.name))}finally{_(!1)}}else t===`toggle-enabled`?await v():t===`back`&&r()},onCancel:r})})]}),(0,H.jsx)(C,{marginTop:1,children:(0,H.jsx)(p,{dimColor:!0,italic:!0,children:c.pending?(0,H.jsxs)(H.Fragment,{children:[`Press `,c.keyName,` again to exit`]}):(0,H.jsxs)(g,{children:[(0,H.jsx)(h,{shortcut:`↑↓`,action:`navigate`}),(0,H.jsx)(h,{shortcut:`Enter`,action:`select`}),(0,H.jsx)(z,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]})})})]})}var In,H,Ln=e((()=>{i(),In=t(l(),1),qt(),x(),mt(),vn(),wt(),ze(),L(),M(),Mt(),bt(),tt(),kn(),Mn(),H=w()}));function Rn({tool:e,server:t,onBack:n}){let[r,i]=zn.useState(``),a=ae(e.name,t.name),o=j(e.userFacingName?e.userFacingName({}):a),s=e.isReadOnly?.({})??!1,c=e.isDestructive?.({})??!1,l=e.isOpenWorld?.({})??!1;return zn.useEffect(()=>{async function t(){try{i(await e.description({},{isNonInteractiveSession:!1,toolPermissionContext:{mode:`default`,additionalWorkingDirectories:new Map,alwaysAllowRules:{},alwaysDenyRules:{},alwaysAskRules:{},isBypassPermissionsModeAvailable:!1},tools:[]}))}catch{i(`Failed to load description`)}}t()},[e]),(0,U.jsx)(m,{title:(0,U.jsxs)(U.Fragment,{children:[o,s&&(0,U.jsx)(p,{color:`success`,children:` [read-only]`}),c&&(0,U.jsx)(p,{color:`error`,children:` [destructive]`}),l&&(0,U.jsx)(p,{dimColor:!0,children:` [open-world]`})]}),subtitle:t.name,onCancel:n,inputGuide:e=>e.pending?(0,U.jsxs)(p,{children:[`Press `,e.keyName,` again to exit`]}):(0,U.jsx)(z,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`}),children:(0,U.jsxs)(C,{flexDirection:`column`,children:[(0,U.jsxs)(C,{children:[(0,U.jsx)(p,{bold:!0,children:`Tool name: `}),(0,U.jsx)(p,{dimColor:!0,children:a})]}),(0,U.jsxs)(C,{children:[(0,U.jsx)(p,{bold:!0,children:`Full name: `}),(0,U.jsx)(p,{dimColor:!0,children:e.name})]}),r&&(0,U.jsxs)(C,{flexDirection:`column`,marginTop:1,children:[(0,U.jsx)(p,{bold:!0,children:`Description:`}),(0,U.jsx)(p,{wrap:`wrap`,children:r})]}),e.inputJSONSchema&&e.inputJSONSchema.properties&&Object.keys(e.inputJSONSchema.properties).length>0&&(0,U.jsxs)(C,{flexDirection:`column`,marginTop:1,children:[(0,U.jsx)(p,{bold:!0,children:`Parameters:`}),(0,U.jsx)(C,{marginLeft:2,flexDirection:`column`,children:Object.entries(e.inputJSONSchema.properties).map(([t,n])=>{let r=(e.inputJSONSchema?.required)?.includes(t);return(0,U.jsxs)(p,{children:[`• `,t,r&&(0,U.jsx)(p,{dimColor:!0,children:` (required)`}),`:`,` `,(0,U.jsx)(p,{dimColor:!0,children:typeof n==`object`&&n&&`type`in n?String(n.type):`unknown`}),typeof n==`object`&&n&&`description`in n&&(0,U.jsxs)(p,{dimColor:!0,children:[` - `,String(n.description)]})]},t)})})]})]})})}var zn,U,Bn=e((()=>{zn=t(l(),1),x(),N(),Mt(),U=w()}));function Vn({server:e,onSelectTool:t,onBack:n}){let r=Xe(e=>e.mcp.tools),i=Hn.useMemo(()=>e.client.type===`connected`?we(r,e.name):[],[e,r]),a=i.map((t,n)=>{let r=ae(t.name,e.name),i=j(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,Un.jsx)(m,{title:`Tools for ${e.name}`,subtitle:`${i.length} ${O(i.length,`tool`)}`,onCancel:n,inputGuide:e=>e.pending?(0,Un.jsxs)(p,{children:[`Press `,e.keyName,` again to exit`]}):(0,Un.jsxs)(g,{children:[(0,Un.jsx)(h,{shortcut:`↑↓`,action:`navigate`}),(0,Un.jsx)(h,{shortcut:`Enter`,action:`select`}),(0,Un.jsx)(z,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]}),children:i.length===0?(0,Un.jsx)(p,{dimColor:!0,children:`No tools available`}):(0,Un.jsx)(Ge,{options:a,onChange:e=>{let n=parseInt(e,10),r=i[n];r&&t(r,n)},onCancel:n})})}var Hn,Un,Wn=e((()=>{Hn=t(l(),1),x(),N(),wt(),ze(),M(),Mt(),bt(),Un=w()}));function Gn({inputValue:e,setInputValue:t,cursorOffset:n,setCursorOffset:r,error:i,setError:a,result:o,setResult:s,setViewState:c,onAddComplete:l,cliMode:u=!1}){let d=(0,Kn.useRef)(!1),[f,m]=(0,Kn.useState)(!1),[_,v]=(0,Kn.useState)(``),y=async()=>{let t=e.trim();if(!t){a(`Please enter a marketplace source`);return}let n=await on(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{m(!0),v(``);let{name:e,resolvedSource:t}=await Ne(n,e=>{v(e)});st(e,{source:t}),yt();let r=n.source;n.source===`github`&&(r=n.repo),me(`tengu_marketplace_added`,{source_type:r}),l&&await l(),v(``),m(!1),u?s(`Successfully added marketplace: ${e}`):c({type:`browse-marketplace`,targetMarketplace:e})}catch(e){let t=I(e);ye(t),a(t.message),v(``),m(!1),s(u?`Error: ${t.message}`:null)}};return(0,Kn.useEffect)(()=>{e&&!d.current&&!i&&!o&&(d.current=!0,y())},[]),(0,W.jsxs)(C,{flexDirection:`column`,children:[(0,W.jsxs)(C,{flexDirection:`column`,paddingX:1,borderStyle:`round`,children:[(0,W.jsx)(C,{marginBottom:1,children:(0,W.jsx)(p,{bold:!0,children:`Add Marketplace`})}),(0,W.jsxs)(C,{flexDirection:`column`,children:[(0,W.jsx)(p,{children:`Enter marketplace source:`}),(0,W.jsx)(p,{dimColor:!0,children:`Examples:`}),(0,W.jsx)(p,{dimColor:!0,children:` · owner/repo (GitHub)`}),(0,W.jsx)(p,{dimColor:!0,children:` · git@github.com:owner/repo.git (SSH)`}),(0,W.jsx)(p,{dimColor:!0,children:` · https://example.com/marketplace.json`}),(0,W.jsx)(p,{dimColor:!0,children:` · ./path/to/marketplace`}),(0,W.jsx)(C,{marginTop:1,children:(0,W.jsx)(zt,{value:e,onChange:t,onSubmit:y,columns:80,cursorOffset:n,onChangeCursorOffset:r,focus:!0,showCursor:!0})})]}),f&&(0,W.jsxs)(C,{marginTop:1,children:[(0,W.jsx)(ut,{}),(0,W.jsx)(p,{children:_||`Adding marketplace to configuration…`})]}),i&&(0,W.jsx)(C,{marginTop:1,children:(0,W.jsx)(p,{color:`error`,children:i})}),o&&(0,W.jsx)(C,{marginTop:1,children:(0,W.jsx)(p,{children:o})})]}),(0,W.jsx)(C,{marginLeft:3,children:(0,W.jsx)(p,{dimColor:!0,italic:!0,children:(0,W.jsxs)(g,{children:[(0,W.jsx)(h,{shortcut:`Enter`,action:`add`}),(0,W.jsx)(z,{action:`confirm:no`,context:`Settings`,fallback:`Esc`,description:`cancel`})]})})})]})}var Kn,W,qn=e((()=>{l(),Kn=t(l(),1),pe(),Mt(),x(),tt(),Ae(),L(),ve(),Pt(),rt(),cn(),W=w()}));function Jn(e,t,n,i){let a={};for(let o of e){let e=n[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]=r(s):a[o]=s}return a}function Yn({title:e,subtitle:t,configSchema:n,initialValues:r,onSave:i,onCancel:s}){let c=Object.keys(n),l=(0,Xn.useCallback)(e=>{if(n[e]?.sensitive===!0)return``;let t=r?.[e];return t===void 0?``:String(t)},[n,r]),[u,d]=(0,Xn.useState)(0),[f,h]=(0,Xn.useState)({}),[g,_]=(0,Xn.useState)(()=>c[0]?l(c[0]):``),y=c[u],b=y?n[y]:null;if(te(`confirm:no`,s,{context:`Settings`}),v({"confirm:nextField":(0,Xn.useCallback)(()=>{if(u<c.length-1&&y){h(e=>({...e,[y]:g})),d(e=>e+1);let e=c[u+1];_(e?l(e):``)}},[u,c,y,g,l]),"confirm:yes":(0,Xn.useCallback)(()=>{if(!y)return;let e={...f,[y]:g};if(u===c.length-1)i(Jn(c,e,n,r));else{h(e),d(e=>e+1);let t=c[u+1];_(t?l(t):``)}},[y,f,g,u,c,n,i,l,r])},{context:`Confirmation`}),ne((e,t)=>{if(t.backspace||t.delete){_(e=>e.slice(0,-1));return}e&&!t.ctrl&&!t.meta&&!t.tab&&!t.return&&_(t=>t+e)}),!b||!y)return null;let x=b.sensitive===!0,ee=b.required===!0,S=x?`*`.repeat(o(g)):g;return(0,Zn.jsxs)(m,{title:e,subtitle:t,onCancel:s,isCancelActive:!1,children:[(0,Zn.jsxs)(C,{flexDirection:`column`,children:[(0,Zn.jsxs)(p,{bold:!0,children:[b.title||y,ee&&(0,Zn.jsx)(p,{color:`error`,children:` *`})]}),b.description&&(0,Zn.jsx)(p,{dimColor:!0,children:b.description}),(0,Zn.jsxs)(C,{marginTop:1,children:[(0,Zn.jsxs)(p,{children:[a.pointerSmall,` `]}),(0,Zn.jsx)(p,{children:S}),(0,Zn.jsx)(p,{children:`█`})]})]}),(0,Zn.jsxs)(C,{flexDirection:`column`,children:[(0,Zn.jsxs)(p,{dimColor:!0,children:[`Field `,u+1,` of `,c.length]}),u<c.length-1&&(0,Zn.jsx)(p,{dimColor:!0,children:`Tab: Next field · Enter: Save and continue`}),u===c.length-1&&(0,Zn.jsx)(p,{dimColor:!0,children:`Enter: Save configuration`})]})]})}var Xn,Zn,Qn=e((()=>{i(),Xn=t(l(),1),x(),Kt(),n(),Zn=w()}));async function $n(e){let{enabled:t,disabled:n}=await Et();return[...t,...n].find(t=>t.repository===e||t.source===e)}function er({plugin:e,pluginId:t,onDone:n}){let[r]=tr.useState(()=>{let n=[],r=He(e);Object.keys(r).length>0&&n.push({key:`top-level`,title:`Configure ${e.name}`,subtitle:`Plugin options`,schema:r,load:()=>Je(t),save:n=>Pe(t,n,e.manifest.userConfig)});let i=qe(e);for(let r of i)n.push({key:`channel:${r.server}`,title:`Configure ${r.displayName}`,subtitle:`Plugin: ${e.name}`,schema:r.configSchema,load:()=>Qe(t,r.server)??void 0,save:e=>ke(t,r.server,e,r.configSchema)});return n}),[i,a]=tr.useState(0),o=tr.useRef(n);if(o.current=n,tr.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`,ce(e));return}let t=i+1;t<r.length?a(t):n(`configured`)}return(0,nr.jsx)(Yn,{title:s.title,subtitle:s.subtitle,configSchema:s.schema,initialValues:s.load(),onSave:c,onCancel:()=>n(`skipped`)},s.key)}var tr,nr,rr=e((()=>{tr=t(l(),1),L(),Le(),_t(),ft(),We(),Qn(),nr=w()}));function ir(){let e=ht();return(0,ar.jsxs)(C,{marginBottom:1,children:[(0,ar.jsxs)(p,{color:`claude`,children:[a.warning,` `]}),(0,ar.jsxs)(p,{dimColor:!0,italic:!0,children:[`Make sure you trust a plugin before installing, updating, or using it. Anthropic does 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 ar,or=e((()=>{i(),l(),x(),lt(),ar=w()}));function sr(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 cr(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 lr({hasSelection:e}){return(0,ur.jsx)(C,{marginTop:1,children:(0,ur.jsx)(p,{dimColor:!0,italic:!0,children:(0,ur.jsxs)(g,{children:[e&&(0,ur.jsx)(z,{action:`plugin:install`,context:`Plugin`,fallback:`i`,description:`install`,bold:!0}),(0,ur.jsx)(z,{action:`plugin:toggle`,context:`Plugin`,fallback:`Space`,description:`toggle`}),(0,ur.jsx)(z,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`details`}),(0,ur.jsx)(z,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]})})})}var ur,dr=e((()=>{l(),Mt(),x(),ur=w()}));function fr({totalItems:e,maxVisible:t=mr,selectedIndex:n=0}){let r=e>t,i=(0,pr.useRef)(0),a=(0,pr.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,pr.useCallback)(e=>r?e.slice(o,s):e,[r,o,s]),l=(0,pr.useCallback)(e=>o+e,[o]),u=(0,pr.useCallback)(e=>e>=o&&e<s,[o,s]),d=(0,pr.useCallback)(e=>{},[]),f=(0,pr.useCallback)(()=>{},[]),p=(0,pr.useCallback)(()=>{},[]),m=(0,pr.useCallback)((t,n)=>{n(Math.max(0,Math.min(t,e-1)))},[e]),h=(0,pr.useCallback)((e,t)=>!1,[]),g=Math.max(1,Math.ceil(e/t));return{currentPage:Math.floor(a/t),totalPages:g,startIndex:o,endIndex:s,needsPagination:r,pageSize:t,getVisibleItems:c,toActualIndex:l,isOnCurrentPage:u,goToPage:d,nextPage:f,prevPage:p,handleSelectionChange:m,handlePageNavigation:h,scrollPosition:{current:n+1,total:e,canScrollUp:a>0,canScrollDown:a+t<e}}}var pr,mr,hr=e((()=>{pr=t(l(),1),mr=5}));function gr({error:e,setError:t,result:n,setResult:r,setViewState:i,onInstallComplete:o,targetMarketplace:s,targetPlugin:c}){let[l,u]=(0,vr.useState)(`marketplace-list`),[d,f]=(0,vr.useState)(null),[m,h]=(0,vr.useState)(null),[_,y]=(0,vr.useState)([]),[b,x]=(0,vr.useState)([]),[ee,S]=(0,vr.useState)(!0),[ne,w]=(0,vr.useState)(null),[T,E]=(0,vr.useState)(0),[D,k]=(0,vr.useState)(new Set),[A,j]=(0,vr.useState)(new Set),M=fr({totalItems:b.length,selectedIndex:T}),[re,N]=(0,vr.useState)(0),[P,ie]=(0,vr.useState)(!1),[F,ae]=(0,vr.useState)(null),[oe,se]=(0,vr.useState)(null);te(`confirm:no`,_r.useCallback(()=>{l===`plugin-list`?s?i({type:`manage-marketplaces`,targetMarketplace:s}):_.length===1?i({type:`menu`}):(u(`marketplace-list`),f(null),k(new Set)):l===`plugin-details`?(u(`plugin-list`),h(null)):i({type:`menu`})},[l,s,i,_.length]),{context:`Confirmation`}),(0,vr.useEffect)(()=>{async function e(){try{let e=await Ie(),{marketplaces:n,failures:r}=await jt(e),i=[];for(let{name:e,config:t,data:r}of n)if(r){let n=be(r.plugins,t=>De(Te(t.name,e)));i.push({name:e,totalPlugins:r.plugins.length,installedCount:n,source:kt(t.source)})}i.sort((e,t)=>e.name===`claude-plugin-directory`?-1:+(t.name===`claude-plugin-directory`)),y(i);let a=St(r,be(n,e=>e.data!==null));if(a)if(a.type===`warning`)se(a.message+`. Showing available marketplaces.`);else throw Error(a.message);if(i.length===1&&!s&&!c){let e=i[0];e&&(f(e.name),u(`plugin-list`))}if(c){let n=null,r=null;for(let[t]of Object.entries(e)){let e=await Ze(t);if(e){let i=e.plugins.find(e=>e.name===c);if(i){let e=Te(i.name,t);n={entry:i,marketplaceName:t,pluginId:e,isInstalled:gt(e)},r=t;break}}}if(n&&r){let e=n.pluginId;gt(e)?t(`Plugin '${e}' is already installed globally. Use '/plugin' to manage existing plugins.`):(f(r),h(n),u(`plugin-details`))}else t(`Plugin "${c}" not found in any marketplace`)}else s&&(i.some(e=>e.name===s)?(f(s),u(`plugin-list`)):t(`Marketplace "${s}" not found`))}catch(e){t(e instanceof Error?e.message:`Failed to load marketplaces`)}finally{S(!1)}}e()},[t,s,c]),(0,vr.useEffect)(()=>{if(!d)return;let e=!1;async function n(n){S(!0);try{let t=await Ze(n);if(e)return;if(!t)throw Error(`Failed to load marketplace: ${n}`);let r=[];for(let e of t.plugins){let t=Te(e.name,n);At(t)||r.push({entry:e,marketplaceName:n,pluginId:t,isInstalled:gt(t)})}try{let t=await dn();if(e)return;w(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;ue(`Failed to fetch install counts: ${ce(t)}`),r.sort((e,t)=>e.entry.name.localeCompare(t.entry.name))}x(r),E(0),k(new Set)}catch(n){if(e)return;t(n instanceof Error?n.message:`Failed to load plugins`)}finally{S(!1)}}return n(d),()=>{e=!0}},[d,t]);let I=async()=>{if(D.size===0)return;let e=b.filter(e=>D.has(e.pluginId));j(new Set(e.map(e=>e.pluginId)));let n=0,a=0,s=[];for(let t of e){let e=await It({pluginId:t.pluginId,entry:t.entry,marketplaceName:t.marketplaceName,scope:`user`});e.success?n++:(a++,s.push({name:t.entry.name,reason:e.error}))}j(new Set),k(new Set),yt(),a===0?r(`✓ Installed ${n} ${O(n,`plugin`)}. Run /reload-plugins to activate.`):n===0?t(`Failed to install: ${Nt(s,!0)}`):r(`✓ Installed ${n} of ${n+a} plugins. Failed: ${Nt(s,!1)}. Run /reload-plugins to activate successfully installed plugins.`),n>0&&o&&await o(),i({type:`menu`})},le=async(e,t=`user`)=>{ie(!0),ae(null);let n=await It({pluginId:e.pluginId,entry:e.entry,marketplaceName:e.marketplaceName,scope:t});if(n.success){let t=await $n(e.pluginId);if(t){ie(!1),u({type:`plugin-options`,plugin:t,pluginId:e.pluginId});return}r(n.message),o&&await o(),i({type:`menu`})}else ie(!1),ae(n.error)};(0,vr.useEffect)(()=>{e&&r(e)},[e,r]),v({"select:previous":()=>{T>0&&E(T-1)},"select:next":()=>{T<_.length-1&&E(T+1)},"select:accept":()=>{let e=_[T];e&&(f(e.name),u(`plugin-list`))}},{context:`Select`,isActive:l===`marketplace-list`}),v({"select:previous":()=>{T>0&&M.handleSelectionChange(T-1,E)},"select:next":()=>{T<b.length-1&&M.handleSelectionChange(T+1,E)},"select:accept":()=>{if(T===b.length&&D.size>0)I();else if(T<b.length){let e=b[T];e&&(e.isInstalled?i({type:`manage-plugins`,targetPlugin:e.entry.name,targetMarketplace:e.marketplaceName}):(h(e),u(`plugin-details`),N(0),ae(null)))}}},{context:`Select`,isActive:l===`plugin-list`}),v({"plugin:toggle":()=>{if(T<b.length){let e=b[T];if(e&&!e.isInstalled){let t=new Set(D);t.has(e.pluginId)?t.delete(e.pluginId):t.add(e.pluginId),k(t)}}},"plugin:install":()=>{D.size>0&&I()}},{context:`Plugin`,isActive:l===`plugin-list`});let L=_r.useMemo(()=>{if(!m)return[];let e=m.entry.homepage;return cr(e,sr(m))},[m]);if(v({"select:previous":()=>{re>0&&N(re-1)},"select:next":()=>{re<L.length-1&&N(re+1)},"select:accept":()=>{if(!m)return;let e=L[re]?.action,t=m.entry.homepage,n=sr(m);e===`install-user`?le(m,`user`):e===`install-project`?le(m,`project`):e===`install-local`?le(m,`local`):e===`homepage`&&t?Wt(t):e===`github`&&n?Wt(`https://github.com/${n}`):e===`back`&&(u(`plugin-list`),h(null))}},{context:`Select`,isActive:l===`plugin-details`&&!!m}),typeof l==`object`&&l.type===`plugin-options`){let{plugin:e,pluginId:t}=l;function n(e){r(e),o&&o(),i({type:`menu`})}return(0,G.jsx)(er,{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(ee)return(0,G.jsx)(p,{children:`Loading…`});if(e)return(0,G.jsx)(p,{color:`error`,children:e});if(l===`marketplace-list`)return _.length===0?(0,G.jsxs)(C,{flexDirection:`column`,children:[(0,G.jsx)(C,{marginBottom:1,children:(0,G.jsx)(p,{bold:!0,children:`Select marketplace`})}),(0,G.jsx)(p,{children:`No marketplaces configured.`}),(0,G.jsxs)(p,{dimColor:!0,children:[`Add a marketplace first using `,`'Add marketplace'`,`.`]}),(0,G.jsx)(C,{marginTop:1,paddingLeft:1,children:(0,G.jsx)(p,{dimColor:!0,children:(0,G.jsx)(z,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`})})})]}):(0,G.jsxs)(C,{flexDirection:`column`,children:[(0,G.jsx)(C,{marginBottom:1,children:(0,G.jsx)(p,{bold:!0,children:`Select marketplace`})}),oe&&(0,G.jsx)(C,{marginBottom:1,flexDirection:`column`,children:(0,G.jsxs)(p,{color:`warning`,children:[a.warning,` `,oe]})}),_.map((e,t)=>(0,G.jsxs)(C,{flexDirection:`column`,marginBottom:+(t<_.length-1),children:[(0,G.jsx)(C,{children:(0,G.jsxs)(p,{color:T===t?`suggestion`:void 0,children:[T===t?a.pointer:` `,` `,e.name]})}),(0,G.jsx)(C,{marginLeft:2,children:(0,G.jsxs)(p,{dimColor:!0,children:[e.totalPlugins,` `,O(e.totalPlugins,`plugin`),` available`,e.installedCount>0&&` · ${e.installedCount} already installed`,e.source&&` · ${e.source}`]})})]},e.name)),(0,G.jsx)(C,{marginTop:1,children:(0,G.jsx)(p,{dimColor:!0,italic:!0,children:(0,G.jsxs)(g,{children:[(0,G.jsx)(z,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`select`}),(0,G.jsx)(z,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`})]})})})]});if(l===`plugin-details`&&m){let e=m.entry.homepage,t=cr(e,sr(m));return(0,G.jsxs)(C,{flexDirection:`column`,children:[(0,G.jsx)(C,{marginBottom:1,children:(0,G.jsx)(p,{bold:!0,children:`Plugin Details`})}),(0,G.jsxs)(C,{flexDirection:`column`,marginBottom:1,children:[(0,G.jsx)(p,{bold:!0,children:m.entry.name}),m.entry.version&&(0,G.jsxs)(p,{dimColor:!0,children:[`Version: `,m.entry.version]}),m.entry.description&&(0,G.jsx)(C,{marginTop:1,children:(0,G.jsx)(p,{children:m.entry.description})}),m.entry.author&&(0,G.jsx)(C,{marginTop:1,children:(0,G.jsxs)(p,{dimColor:!0,children:[`By:`,` `,typeof m.entry.author==`string`?m.entry.author:m.entry.author.name]})})]}),(0,G.jsxs)(C,{flexDirection:`column`,marginBottom:1,children:[(0,G.jsx)(p,{bold:!0,children:`Will install:`}),m.entry.commands&&(0,G.jsxs)(p,{dimColor:!0,children:[`· Commands:`,` `,Array.isArray(m.entry.commands)?m.entry.commands.join(`, `):Object.keys(m.entry.commands).join(`, `)]}),m.entry.agents&&(0,G.jsxs)(p,{dimColor:!0,children:[`· Agents:`,` `,Array.isArray(m.entry.agents)?m.entry.agents.join(`, `):Object.keys(m.entry.agents).join(`, `)]}),m.entry.hooks&&(0,G.jsxs)(p,{dimColor:!0,children:[`· Hooks: `,Object.keys(m.entry.hooks).join(`, `)]}),m.entry.mcpServers&&(0,G.jsxs)(p,{dimColor:!0,children:[`· MCP Servers:`,` `,Array.isArray(m.entry.mcpServers)?m.entry.mcpServers.join(`, `):typeof m.entry.mcpServers==`object`?Object.keys(m.entry.mcpServers).join(`, `):`configured`]}),!m.entry.commands&&!m.entry.agents&&!m.entry.hooks&&!m.entry.mcpServers&&(0,G.jsx)(G.Fragment,{children:typeof m.entry.source==`object`&&`source`in m.entry.source&&(m.entry.source.source===`github`||m.entry.source.source===`url`||m.entry.source.source===`npm`||m.entry.source.source===`pip`)?(0,G.jsx)(p,{dimColor:!0,children:`· Component summary not available for remote plugin`}):(0,G.jsx)(p,{dimColor:!0,children:`· Components will be discovered at installation`})})]}),(0,G.jsx)(ir,{}),F&&(0,G.jsx)(C,{marginBottom:1,children:(0,G.jsxs)(p,{color:`error`,children:[`Error: `,F]})}),(0,G.jsx)(C,{flexDirection:`column`,children:t.map((e,t)=>(0,G.jsxs)(C,{children:[re===t&&(0,G.jsx)(p,{children:`> `}),re!==t&&(0,G.jsx)(p,{children:` `}),(0,G.jsx)(p,{bold:re===t,children:P&&e.action===`install`?`Installing…`:e.label})]},e.action))}),(0,G.jsx)(C,{marginTop:1,paddingLeft:1,children:(0,G.jsx)(p,{dimColor:!0,children:(0,G.jsxs)(g,{children:[(0,G.jsx)(z,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`select`}),(0,G.jsx)(z,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]})})})]})}if(b.length===0)return(0,G.jsxs)(C,{flexDirection:`column`,children:[(0,G.jsx)(C,{marginBottom:1,children:(0,G.jsx)(p,{bold:!0,children:`Install plugins`})}),(0,G.jsx)(p,{dimColor:!0,children:`No new plugins available to install.`}),(0,G.jsx)(p,{dimColor:!0,children:`All plugins from this marketplace are already installed.`}),(0,G.jsx)(C,{marginLeft:3,children:(0,G.jsx)(p,{dimColor:!0,italic:!0,children:(0,G.jsx)(z,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`})})})]});let de=M.getVisibleItems(b);return(0,G.jsxs)(C,{flexDirection:`column`,children:[(0,G.jsx)(C,{marginBottom:1,children:(0,G.jsx)(p,{bold:!0,children:`Install Plugins`})}),M.scrollPosition.canScrollUp&&(0,G.jsx)(C,{children:(0,G.jsxs)(p,{dimColor:!0,children:[` `,a.arrowUp,` more above`]})}),de.map((t,n)=>{let r=T===M.toActualIndex(n),i=D.has(t.pluginId),o=A.has(t.pluginId);return(0,G.jsxs)(C,{flexDirection:`column`,marginBottom:n===de.length-1&&!e?0:1,children:[(0,G.jsxs)(C,{children:[(0,G.jsxs)(p,{color:r?`suggestion`:void 0,children:[r?a.pointer:` `,` `]}),(0,G.jsxs)(p,{color:t.isInstalled?`success`:void 0,children:[t.isInstalled?a.tick:o?a.ellipsis:i?a.radioOn:a.radioOff,` `,t.entry.name,t.entry.category&&(0,G.jsxs)(p,{dimColor:!0,children:[` [`,t.entry.category,`]`]}),t.entry.tags?.includes(`community-managed`)&&(0,G.jsx)(p,{dimColor:!0,children:` [Community Managed]`}),t.isInstalled&&(0,G.jsx)(p,{dimColor:!0,children:` (installed)`}),ne&&d===`claude-plugins-official`&&(0,G.jsxs)(p,{dimColor:!0,children:[` · `,un(ne.get(t.pluginId)??0),` installs`]})]})]}),t.entry.description&&(0,G.jsxs)(C,{marginLeft:4,children:[(0,G.jsx)(p,{dimColor:!0,children:Se(t.entry.description,60)}),t.entry.version&&(0,G.jsxs)(p,{dimColor:!0,children:[` · v`,t.entry.version]})]})]},t.pluginId)}),M.scrollPosition.canScrollDown&&(0,G.jsx)(C,{children:(0,G.jsxs)(p,{dimColor:!0,children:[` `,a.arrowDown,` more below`]})}),e&&(0,G.jsx)(C,{marginTop:1,children:(0,G.jsxs)(p,{color:`error`,children:[a.cross,` `,e]})}),(0,G.jsx)(lr,{hasSelection:D.size>0})]})}var _r,vr,G,yr=e((()=>{i(),_r=t(l(),1),vr=t(l(),1),Mt(),x(),Kt(),xe(),Gt(),de(),L(),Pt(),sn(),Me(),lt(),rt(),Ue(),Ft(),Ct(),M(),Ce(),rr(),or(),dr(),hr(),G=w()}));function br({error:e,setError:t,result:n,setResult:r,setViewState:i,onInstallComplete:o,onSearchModeChange:c,targetPlugin:l}){let[u,m]=(0,K.useState)(`plugin-list`),[h,_]=(0,K.useState)(null),[y,b]=(0,K.useState)([]),[x,ee]=(0,K.useState)(!0),[S,w]=(0,K.useState)(null),[T,E]=(0,K.useState)(!1),D=(0,K.useCallback)(e=>{E(e),c?.(e)},[c]),{query:k,setQuery:A,cursorOffset:j}=xn({isActive:u===`plugin-list`&&T&&!x,onExit:()=>{D(!1)}}),M=d(),{columns:re}=s(),N=(0,K.useMemo)(()=>{if(!k)return y;let e=k.toLowerCase();return y.filter(t=>t.entry.name.toLowerCase().includes(e)||t.entry.description?.toLowerCase().includes(e)||t.marketplaceName.toLowerCase().includes(e))},[y,k]),[P,ie]=(0,K.useState)(0),[F,ae]=(0,K.useState)(new Set),[oe,se]=(0,K.useState)(new Set),I=fr({totalItems:N.length,selectedIndex:P});(0,K.useEffect)(()=>{ie(0)},[k]);let[le,L]=(0,K.useState)(0),[de,fe]=(0,K.useState)(!1),[pe,me]=(0,K.useState)(null),[he,ge]=(0,K.useState)(null),[_e,ve]=(0,K.useState)(null);(0,K.useEffect)(()=>{async function e(){try{let e=await Ie(),{marketplaces:n,failures:r}=await jt(e),i=[];for(let{name:e,data:t}of n)if(t)for(let n of t.plugins){let t=Te(n.name,e);i.push({entry:n,marketplaceName:e,pluginId:t,isInstalled:gt(t)})}let a=i.filter(e=>!e.isInstalled&&!At(e.pluginId));try{let e=await dn();w(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){ue(`Failed to fetch install counts: ${ce(e)}`),a.sort((e,t)=>e.entry.name.localeCompare(t.entry.name))}b(a);let o=Object.keys(e).length;a.length===0&&ve(await dt({configuredMarketplaceCount:o,failedMarketplaceCount:r.length}));let s=St(r,be(n,e=>e.data!==null));if(s)if(s.type===`warning`)ge(s.message+`. Showing available plugins.`);else throw Error(s.message);if(l){let e=i.find(e=>e.entry.name===l);e?e.isInstalled?t(`Plugin '${e.pluginId}' is already installed. Use '/plugin' to manage existing plugins.`):(_(e),m(`plugin-details`)):t(`Plugin "${l}" not found in any marketplace`)}}catch(e){t(e instanceof Error?e.message:`Failed to load plugins`)}finally{ee(!1)}}e()},[t,l]);let ye=async()=>{if(F.size===0)return;let e=y.filter(e=>F.has(e.pluginId));se(new Set(e.map(e=>e.pluginId)));let n=0,a=0,s=[];for(let t of e){let e=await It({pluginId:t.pluginId,entry:t.entry,marketplaceName:t.marketplaceName,scope:`user`});e.success?n++:(a++,s.push({name:t.entry.name,reason:e.error}))}se(new Set),ae(new Set),yt(),a===0?r(`✓ Installed ${n} ${O(n,`plugin`)}. Run /reload-plugins to activate.`):n===0?t(`Failed to install: ${Nt(s,!0)}`):r(`✓ Installed ${n} of ${n+a} plugins. Failed: ${Nt(s,!1)}. Run /reload-plugins to activate successfully installed plugins.`),n>0&&o&&await o(),i({type:`menu`})},xe=async(e,t=`user`)=>{fe(!0),me(null);let n=await It({pluginId:e.pluginId,entry:e.entry,marketplaceName:e.marketplaceName,scope:t});if(n.success){let t=await $n(e.pluginId);if(t){fe(!1),m({type:`plugin-options`,plugin:t,pluginId:e.pluginId});return}r(n.message),o&&await o(),i({type:`menu`})}else fe(!1),me(n.error)};(0,K.useEffect)(()=>{e&&r(e)},[e,r]),te(`confirm:no`,()=>{m(`plugin-list`),_(null)},{context:`Confirmation`,isActive:u===`plugin-details`}),te(`confirm:no`,()=>{i({type:`menu`})},{context:`Confirmation`,isActive:u===`plugin-list`&&!T}),ne((e,t)=>{let n=!t.ctrl&&!t.meta;T||(e===`/`&&n?(D(!0),A(``)):n&&e.length>0&&!/^\s+$/.test(e)&&e!==`j`&&e!==`k`&&e!==`i`&&(D(!0),A(e)))},{isActive:u===`plugin-list`&&!x}),v({"select:previous":()=>{P===0?D(!0):I.handleSelectionChange(P-1,ie)},"select:next":()=>{P<N.length-1&&I.handleSelectionChange(P+1,ie)},"select:accept":()=>{if(P===N.length&&F.size>0)ye();else if(P<N.length){let e=N[P];e&&(e.isInstalled?i({type:`manage-plugins`,targetPlugin:e.entry.name,targetMarketplace:e.marketplaceName}):(_(e),m(`plugin-details`),L(0),me(null)))}}},{context:`Select`,isActive:u===`plugin-list`&&!T}),v({"plugin:toggle":()=>{if(P<N.length){let e=N[P];if(e&&!e.isInstalled){let t=new Set(F);t.has(e.pluginId)?t.delete(e.pluginId):t.add(e.pluginId),ae(t)}}},"plugin:install":()=>{F.size>0&&ye()}},{context:`Plugin`,isActive:u===`plugin-list`&&!T});let Ce=Cr.useMemo(()=>{if(!h)return[];let e=h.entry.homepage;return cr(e,sr(h))},[h]);if(v({"select:previous":()=>{le>0&&L(le-1)},"select:next":()=>{le<Ce.length-1&&L(le+1)},"select:accept":()=>{if(!h)return;let e=Ce[le]?.action,t=h.entry.homepage,n=sr(h);e===`install-user`?xe(h,`user`):e===`install-project`?xe(h,`project`):e===`install-local`?xe(h,`local`):e===`homepage`&&t?Wt(t):e===`github`&&n?Wt(`https://github.com/${n}`):e===`back`&&(m(`plugin-list`),_(null))}},{context:`Select`,isActive:u===`plugin-details`&&!!h}),typeof u==`object`&&u.type===`plugin-options`){let{plugin:e,pluginId:t}=u;function n(e){r(e),o&&o(),i({type:`menu`})}return(0,q.jsx)(er,{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(x)return(0,q.jsx)(p,{children:`Loading…`});if(e)return(0,q.jsx)(p,{color:`error`,children:e});if(u===`plugin-details`&&h){let e=h.entry.homepage,t=cr(e,sr(h));return(0,q.jsxs)(C,{flexDirection:`column`,children:[(0,q.jsx)(C,{marginBottom:1,children:(0,q.jsx)(p,{bold:!0,children:`Plugin details`})}),(0,q.jsxs)(C,{flexDirection:`column`,marginBottom:1,children:[(0,q.jsx)(p,{bold:!0,children:h.entry.name}),(0,q.jsxs)(p,{dimColor:!0,children:[`from `,h.marketplaceName]}),h.entry.version&&(0,q.jsxs)(p,{dimColor:!0,children:[`Version: `,h.entry.version]}),h.entry.description&&(0,q.jsx)(C,{marginTop:1,children:(0,q.jsx)(p,{children:h.entry.description})}),h.entry.author&&(0,q.jsx)(C,{marginTop:1,children:(0,q.jsxs)(p,{dimColor:!0,children:[`By:`,` `,typeof h.entry.author==`string`?h.entry.author:h.entry.author.name]})})]}),(0,q.jsx)(ir,{}),pe&&(0,q.jsx)(C,{marginBottom:1,children:(0,q.jsxs)(p,{color:`error`,children:[`Error: `,pe]})}),(0,q.jsx)(C,{flexDirection:`column`,children:t.map((e,t)=>(0,q.jsxs)(C,{children:[le===t&&(0,q.jsx)(p,{children:`> `}),le!==t&&(0,q.jsx)(p,{children:` `}),(0,q.jsx)(p,{bold:le===t,children:de&&e.action.startsWith(`install-`)?`Installing…`:e.label})]},e.action))}),(0,q.jsx)(C,{marginTop:1,children:(0,q.jsx)(p,{dimColor:!0,children:(0,q.jsxs)(g,{children:[(0,q.jsx)(z,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`select`}),(0,q.jsx)(z,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]})})})]})}if(y.length===0)return(0,q.jsxs)(C,{flexDirection:`column`,children:[(0,q.jsx)(C,{marginBottom:1,children:(0,q.jsx)(p,{bold:!0,children:`Discover plugins`})}),(0,q.jsx)(Sr,{reason:_e}),(0,q.jsx)(C,{marginTop:1,children:(0,q.jsx)(p,{dimColor:!0,italic:!0,children:`Esc to go back`})})]});let we=I.getVisibleItems(N);return(0,q.jsxs)(C,{flexDirection:`column`,children:[(0,q.jsxs)(C,{children:[(0,q.jsx)(p,{bold:!0,children:`Discover plugins`}),I.needsPagination&&(0,q.jsxs)(p,{dimColor:!0,children:[` `,`(`,I.scrollPosition.current,`/`,I.scrollPosition.total,`)`]})]}),(0,q.jsx)(C,{marginBottom:1,children:(0,q.jsx)(f,{query:k,isFocused:T,isTerminalFocused:M,width:re-4,cursorOffset:j})}),he&&(0,q.jsx)(C,{marginBottom:1,children:(0,q.jsxs)(p,{color:`warning`,children:[a.warning,` `,he]})}),N.length===0&&k&&(0,q.jsx)(C,{marginBottom:1,children:(0,q.jsxs)(p,{dimColor:!0,children:[`No plugins match "`,k,`"`]})}),I.scrollPosition.canScrollUp&&(0,q.jsx)(C,{children:(0,q.jsxs)(p,{dimColor:!0,children:[` `,a.arrowUp,` more above`]})}),we.map((t,n)=>{let r=P===I.toActualIndex(n),i=F.has(t.pluginId),o=oe.has(t.pluginId);return(0,q.jsxs)(C,{flexDirection:`column`,marginBottom:n===we.length-1&&!e?0:1,children:[(0,q.jsxs)(C,{children:[(0,q.jsxs)(p,{color:r&&!T?`suggestion`:void 0,children:[r&&!T?a.pointer:` `,` `]}),(0,q.jsxs)(p,{children:[o?a.ellipsis:i?a.radioOn:a.radioOff,` `,t.entry.name,(0,q.jsxs)(p,{dimColor:!0,children:[` · `,t.marketplaceName]}),t.entry.tags?.includes(`community-managed`)&&(0,q.jsx)(p,{dimColor:!0,children:` [Community Managed]`}),S&&t.marketplaceName===`claude-plugins-official`&&(0,q.jsxs)(p,{dimColor:!0,children:[` · `,un(S.get(t.pluginId)??0),` installs`]})]})]}),t.entry.description&&(0,q.jsx)(C,{marginLeft:4,children:(0,q.jsx)(p,{dimColor:!0,children:Se(t.entry.description,60)})})]},`${I.startIndex}-${t.pluginId}`)}),I.scrollPosition.canScrollDown&&(0,q.jsx)(C,{children:(0,q.jsxs)(p,{dimColor:!0,children:[` `,a.arrowDown,` more below`]})}),e&&(0,q.jsx)(C,{marginTop:1,children:(0,q.jsxs)(p,{color:`error`,children:[a.cross,` `,e]})}),(0,q.jsx)(xr,{hasSelection:F.size>0,canToggle:P<N.length&&!N[P]?.isInstalled})]})}function xr({hasSelection:e,canToggle:t}){return(0,q.jsx)(C,{marginTop:1,children:(0,q.jsx)(p,{dimColor:!0,italic:!0,children:(0,q.jsxs)(g,{children:[e&&(0,q.jsx)(z,{action:`plugin:install`,context:`Plugin`,fallback:`i`,description:`install`,bold:!0}),(0,q.jsx)(p,{children:`type to search`}),t&&(0,q.jsx)(z,{action:`plugin:toggle`,context:`Plugin`,fallback:`Space`,description:`toggle`}),(0,q.jsx)(z,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`details`}),(0,q.jsx)(z,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]})})})}function Sr({reason:e}){switch(e){case`git-not-installed`:return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(p,{dimColor:!0,children:`Git is required to install marketplaces.`}),(0,q.jsx)(p,{dimColor:!0,children:`Please install git and restart Claude Code.`})]});case`all-blocked-by-policy`:return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(p,{dimColor:!0,children:`Your organization policy does not allow any external marketplaces.`}),(0,q.jsx)(p,{dimColor:!0,children:`Contact your administrator.`})]});case`policy-restricts-sources`:return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(p,{dimColor:!0,children:`Your organization restricts which marketplaces can be added.`}),(0,q.jsx)(p,{dimColor:!0,children:`Switch to the Marketplaces tab to view allowed sources.`})]});case`all-marketplaces-failed`:return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(p,{dimColor:!0,children:`Failed to load marketplace data.`}),(0,q.jsx)(p,{dimColor:!0,children:`Check your network connection.`})]});case`all-plugins-installed`:return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(p,{dimColor:!0,children:`All available plugins are already installed.`}),(0,q.jsx)(p,{dimColor:!0,children:`Check for new plugins later or add more marketplaces.`})]});default:return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(p,{dimColor:!0,children:`No plugins available.`}),(0,q.jsx)(p,{dimColor:!0,children:`Add a marketplace first using the Marketplaces tab.`})]})}}var Cr,K,q,wr=e((()=>{i(),Cr=t(l(),1),K=t(l(),1),Mt(),bn(),x(),Sn(),nt(),Kt(),xe(),Gt(),de(),L(),Pt(),sn(),Me(),lt(),rt(),Ue(),Ft(),Ct(),M(),Ce(),rr(),or(),dr(),hr(),q=w()}));function Tr({setViewState:e,error:t,setError:n,setResult:r,exitState:i,onManageComplete:o,targetMarketplace:s,action:c}){let[l,u]=(0,Dr.useState)([]),[d,f]=(0,Dr.useState)(!0),[m,h]=(0,Dr.useState)(0),[_,y]=(0,Dr.useState)(!1),[b,x]=(0,Dr.useState)(null),[ee,S]=(0,Dr.useState)(null),[w,T]=(0,Dr.useState)(null),[E,A]=(0,Dr.useState)(`list`),[j,M]=(0,Dr.useState)(null),[N,P]=(0,Dr.useState)(0),ie=(0,Dr.useRef)(!1);(0,Dr.useEffect)(()=>{async function e(){try{let e=await Ie(),{enabled:r,disabled:i}=await Et(),a=[...r,...i],{marketplaces:o,failures:l}=await jt(e),d=[];for(let{name:e,config:t,data:n}of o){let r=a.filter(t=>t.source.endsWith(`@${e}`));d.push({name:e,source:kt(t.source),lastUpdated:t.lastUpdated,pluginCount:n?.plugins.length,installedPlugins:r,pendingUpdate:!1,pendingRemove:!1,autoUpdate:oe(e,t)})}d.sort((e,t)=>e.name===`claude-plugin-directory`?-1:t.name===`claude-plugin-directory`?1:e.name.localeCompare(t.name)),u(d);let f=St(l,be(o,e=>e.data!==null));if(f)if(f.type===`warning`)x(f.message);else throw Error(f.message);if(s&&!ie.current&&!t){ie.current=!0;let e=d.findIndex(e=>e.name===s);if(e>=0){let t=d[e];if(c){h(e+1);let t=[...d];c===`update`?t[e].pendingUpdate=!0:c===`remove`&&(t[e].pendingRemove=!0),u(t),setTimeout(se,100,t)}else t&&(h(e+1),M(t),A(`details`))}else n&&n(`Marketplace not found: ${s}`)}}catch(e){n&&n(e instanceof Error?e.message:`Failed to load marketplaces`),x(e instanceof Error?e.message:`Failed to load marketplaces`)}finally{f(!1)}}e()},[s,c,t]);let F=()=>l.some(e=>e.pendingUpdate||e.pendingRemove),ae=()=>({updateCount:be(l,e=>e.pendingUpdate),removeCount:be(l,e=>e.pendingRemove)}),se=async t=>{let i=t||l,s=E===`details`;y(!0),x(null),S(null),T(null);try{let t=k(`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=Te(t.name,e.name);n[r]=!1}re(`userSettings`,{enabledPlugins:n})}await Ot(e.name),c++,me(`tengu_marketplace_removed`,{marketplace_name:e.name,plugins_uninstalled:e.installedPlugins?.length||0});continue}e.pendingUpdate&&(await Fe(e.name,e=>{T(e)}),n++,l.add(e.name.toLowerCase()),me(`tengu_marketplace_updated`,{marketplace_name:e.name}))}let d=0;l.size>0&&(d=(await Cn(l)).length),yt(),o&&await o();let f=await Ie(),{enabled:p,disabled:m}=await Et(),h=[...p,...m],{marketplaces:g}=await jt(f),_=[];for(let{name:e,config:t,data:n}of g){let r=h.filter(t=>t.source.endsWith(`@${e}`));_.push({name:e,source:kt(t.source),lastUpdated:t.lastUpdated,pluginCount:n?.plugins.length,installedPlugins:r,pendingUpdate:!1,pendingRemove:!1,autoUpdate:oe(e,t)})}if(_.sort((e,t)=>e.name===`claude-plugin-directory`?-1:t.name===`claude-plugin-directory`?1:e.name.localeCompare(t.name)),u(_),s&&j){let e=_.find(e=>e.name===j.name);e&&M(e)}let v=[];if(n>0){let e=d>0?` (${d} ${O(d,`plugin`)} bumped)`:``;v.push(`Updated ${n} ${O(n,`marketplace`)}${e}`)}if(c>0&&v.push(`Removed ${c} ${O(c,`marketplace`)}`),v.length>0){let t=`${a.tick} ${v.join(`, `)}`;s?S(t):(r(t),setTimeout(e,2e3,{type:`menu`}))}else s||e({type:`menu`})}catch(e){let t=ce(e);x(t),n&&n(t)}finally{y(!1),T(null)}},I=async()=>{if(!j)return;let e=l.map(e=>e.name===j.name?{...e,pendingRemove:!0}:e);u(e),await se(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 D()||t.push({label:e.autoUpdate?`Disable auto-update`:`Enable auto-update`,value:`toggle-auto-update`}),t.push({label:`Remove marketplace`,value:`remove`}),t},L=async e=>{let t=!e.autoUpdate;try{await ot(e.name,t),u(n=>n.map(n=>n.name===e.name?{...n,autoUpdate:t}:n)),M(e=>e&&{...e,autoUpdate:t})}catch(e){x(e instanceof Error?e.message:`Failed to update setting`)}};if(te(`confirm:no`,()=>{A(`list`),P(0)},{context:`Confirmation`,isActive:!_&&(E===`details`||E===`confirm-remove`)}),te(`confirm:no`,()=>{u(e=>e.map(e=>({...e,pendingUpdate:!1,pendingRemove:!1}))),h(0)},{context:`Confirmation`,isActive:!_&&E===`list`&&F()}),te(`confirm:no`,()=>{e({type:`menu`})},{context:`Confirmation`,isActive:!_&&E===`list`&&!F()}),v({"select:previous":()=>h(e=>Math.max(0,e-1)),"select:next":()=>{let e=l.length+1;h(t=>Math.min(e-1,t+1))},"select:accept":()=>{let t=m-1;if(m===0)e({type:`add-marketplace`});else if(F())se();else{let e=l[t];e&&(M(e),A(`details`),P(0))}}},{context:`Select`,isActive:!_&&E===`list`}),ne(e=>{let t=m-1;if((e===`u`||e===`U`)&&t>=0)u(e=>e.map((e,n)=>n===t?{...e,pendingUpdate:!e.pendingUpdate,pendingRemove:e.pendingUpdate?e.pendingRemove:!1}:e));else if((e===`r`||e===`R`)&&t>=0){let e=l[t];e&&(M(e),A(`confirm-remove`))}},{isActive:!_&&E===`list`}),v({"select:previous":()=>P(e=>Math.max(0,e-1)),"select:next":()=>{let e=le(j);P(t=>Math.min(e.length-1,t+1))},"select:accept":()=>{if(!j)return;let t=le(j)[N];if(t?.value===`browse`)e({type:`browse-marketplace`,targetMarketplace:j.name});else if(t?.value===`update`){let e=l.map(e=>e.name===j.name?{...e,pendingUpdate:!0}:e);u(e),se(e)}else t?.value===`toggle-auto-update`?L(j):t?.value===`remove`&&A(`confirm-remove`)}},{context:`Select`,isActive:!_&&E===`details`}),ne(e=>{e===`y`||e===`Y`?I():(e===`n`||e===`N`)&&(A(`list`),M(null))},{isActive:!_&&E===`confirm-remove`}),d)return(0,J.jsx)(p,{children:`Loading marketplaces…`});if(l.length===0)return(0,J.jsxs)(C,{flexDirection:`column`,children:[(0,J.jsx)(C,{marginBottom:1,children:(0,J.jsx)(p,{bold:!0,children:`Manage marketplaces`})}),(0,J.jsxs)(C,{flexDirection:`row`,gap:1,children:[(0,J.jsxs)(p,{color:`suggestion`,children:[a.pointer,` +`]}),(0,J.jsx)(p,{bold:!0,color:`suggestion`,children:`Add Marketplace`})]}),(0,J.jsx)(C,{marginLeft:3,children:(0,J.jsx)(p,{dimColor:!0,italic:!0,children:i.pending?(0,J.jsxs)(J.Fragment,{children:[`Press `,i.keyName,` again to go back`]}):(0,J.jsxs)(g,{children:[(0,J.jsx)(z,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`select`}),(0,J.jsx)(z,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`})]})})})]});if(E===`confirm-remove`&&j){let e=j.installedPlugins?.length||0;return(0,J.jsxs)(C,{flexDirection:`column`,children:[(0,J.jsxs)(p,{bold:!0,color:`warning`,children:[`Remove marketplace `,(0,J.jsx)(p,{italic:!0,children:j.name}),`?`]}),(0,J.jsxs)(C,{flexDirection:`column`,children:[e>0&&(0,J.jsx)(C,{marginTop:1,children:(0,J.jsxs)(p,{color:`warning`,children:[`This will also uninstall `,e,` `,O(e,`plugin`),` from this marketplace:`]})}),j.installedPlugins&&j.installedPlugins.length>0&&(0,J.jsx)(C,{flexDirection:`column`,marginTop:1,marginLeft:2,children:j.installedPlugins.map(e=>(0,J.jsxs)(p,{dimColor:!0,children:[`• `,e.name]},e.name))}),(0,J.jsx)(C,{marginTop:1,children:(0,J.jsxs)(p,{children:[`Press `,(0,J.jsx)(p,{bold:!0,children:`y`}),` to confirm or `,(0,J.jsx)(p,{bold:!0,children:`n`}),` to cancel`]})})]})]})}if(E===`details`&&j){let e=j.pendingUpdate||_,t=le(j);return(0,J.jsxs)(C,{flexDirection:`column`,children:[(0,J.jsx)(p,{bold:!0,children:j.name}),(0,J.jsx)(p,{dimColor:!0,children:j.source}),(0,J.jsx)(C,{marginTop:1,children:(0,J.jsxs)(p,{children:[j.pluginCount||0,` available `,O(j.pluginCount||0,`plugin`)]})}),j.installedPlugins&&j.installedPlugins.length>0&&(0,J.jsxs)(C,{flexDirection:`column`,marginTop:1,children:[(0,J.jsxs)(p,{bold:!0,children:[`Installed plugins (`,j.installedPlugins.length,`):`]}),(0,J.jsx)(C,{flexDirection:`column`,marginLeft:1,children:j.installedPlugins.map(e=>(0,J.jsxs)(C,{flexDirection:`row`,gap:1,children:[(0,J.jsx)(p,{children:a.bullet}),(0,J.jsxs)(C,{flexDirection:`column`,children:[(0,J.jsx)(p,{children:e.name}),(0,J.jsx)(p,{dimColor:!0,children:e.manifest.description})]})]},e.name))})]}),e&&(0,J.jsxs)(C,{marginTop:1,flexDirection:`column`,children:[(0,J.jsx)(p,{color:`claude`,children:`Updating marketplace…`}),w&&(0,J.jsx)(p,{dimColor:!0,children:w})]}),!e&&ee&&(0,J.jsx)(C,{marginTop:1,children:(0,J.jsx)(p,{color:`claude`,children:ee})}),!e&&b&&(0,J.jsx)(C,{marginTop:1,children:(0,J.jsx)(p,{color:`error`,children:b})}),!e&&(0,J.jsx)(C,{flexDirection:`column`,marginTop:1,children:t.map((e,t)=>{if(!e)return null;let n=t===N;return(0,J.jsxs)(C,{children:[(0,J.jsxs)(p,{color:n?`suggestion`:void 0,children:[n?a.pointer:` `,` `,e.label]}),e.secondaryLabel&&(0,J.jsxs)(p,{dimColor:!0,children:[` `,e.secondaryLabel]})]},e.value)})}),!e&&!D()&&j.autoUpdate&&(0,J.jsx)(C,{marginTop:1,children:(0,J.jsx)(p,{dimColor:!0,children:`Auto-update enabled. Claude Code will automatically update this marketplace and its installed plugins.`})}),(0,J.jsx)(C,{marginLeft:3,children:(0,J.jsx)(p,{dimColor:!0,italic:!0,children:e?(0,J.jsx)(J.Fragment,{children:`Please wait…`}):(0,J.jsxs)(g,{children:[(0,J.jsx)(z,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`select`}),(0,J.jsx)(z,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`})]})})})]})}let{updateCount:ue,removeCount:de}=ae();return(0,J.jsxs)(C,{flexDirection:`column`,children:[(0,J.jsx)(C,{marginBottom:1,children:(0,J.jsx)(p,{bold:!0,children:`Manage marketplaces`})}),(0,J.jsxs)(C,{flexDirection:`row`,gap:1,marginBottom:1,children:[(0,J.jsxs)(p,{color:m===0?`suggestion`:void 0,children:[m===0?a.pointer:` `,` +`]}),(0,J.jsx)(p,{bold:!0,color:m===0?`suggestion`:void 0,children:`Add Marketplace`})]}),(0,J.jsx)(C,{flexDirection:`column`,children:l.map((e,t)=>{let n=t+1===m,r=[];return e.pendingUpdate&&r.push(`UPDATE`),e.pendingRemove&&r.push(`REMOVE`),(0,J.jsxs)(C,{flexDirection:`row`,gap:1,marginBottom:1,children:[(0,J.jsxs)(p,{color:n?`suggestion`:void 0,children:[n?a.pointer:` `,` `,e.pendingRemove?a.cross:a.bullet]}),(0,J.jsxs)(C,{flexDirection:`column`,flexGrow:1,children:[(0,J.jsxs)(C,{flexDirection:`row`,gap:1,children:[(0,J.jsxs)(p,{bold:!0,strikethrough:e.pendingRemove,dimColor:e.pendingRemove,children:[e.name===`claude-plugins-official`&&(0,J.jsx)(p,{color:`claude`,children:`✻ `}),e.name,e.name===`claude-plugins-official`&&(0,J.jsx)(p,{color:`claude`,children:` ✻`})]}),r.length>0&&(0,J.jsxs)(p,{color:`warning`,children:[`[`,r.join(`, `),`]`]})]}),(0,J.jsx)(p,{dimColor:!0,children:e.source}),(0,J.jsxs)(p,{dimColor:!0,children:[e.pluginCount!==void 0&&(0,J.jsxs)(J.Fragment,{children:[e.pluginCount,` available`]}),e.installedPlugins&&e.installedPlugins.length>0&&(0,J.jsxs)(J.Fragment,{children:[` • `,e.installedPlugins.length,` installed`]}),e.lastUpdated&&(0,J.jsxs)(J.Fragment,{children:[` • Updated `,new Date(e.lastUpdated).toLocaleDateString()]})]})]})]},e.name)})}),F()&&(0,J.jsxs)(C,{marginTop:1,flexDirection:`column`,children:[(0,J.jsxs)(p,{children:[(0,J.jsx)(p,{bold:!0,children:`Pending changes:`}),` `,(0,J.jsx)(p,{dimColor:!0,children:`Enter to apply`})]}),ue>0&&(0,J.jsxs)(p,{children:[`• Update `,ue,` `,O(ue,`marketplace`)]}),de>0&&(0,J.jsxs)(p,{color:`warning`,children:[`• Remove `,de,` `,O(de,`marketplace`)]})]}),_&&(0,J.jsx)(C,{marginTop:1,children:(0,J.jsx)(p,{color:`claude`,children:`Processing changes…`})}),b&&(0,J.jsx)(C,{marginTop:1,children:(0,J.jsx)(p,{color:`error`,children:b})}),(0,J.jsx)(Er,{exitState:i,hasPendingActions:F()})]})}function Er({exitState:e,hasPendingActions:t}){return e.pending?(0,J.jsx)(C,{marginTop:1,children:(0,J.jsxs)(p,{dimColor:!0,italic:!0,children:[`Press `,e.keyName,` again to go back`]})}):(0,J.jsx)(C,{marginTop:1,children:(0,J.jsx)(p,{dimColor:!0,italic:!0,children:(0,J.jsxs)(g,{children:[t&&(0,J.jsx)(z,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`apply changes`}),!t&&(0,J.jsx)(z,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`select`}),!t&&(0,J.jsx)(h,{shortcut:`u`,action:`update`}),!t&&(0,J.jsx)(h,{shortcut:`r`,action:`remove`}),(0,J.jsx)(z,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:t?`cancel`:`go back`})]})})})}var Dr,J,Or=e((()=>{i(),l(),Dr=t(l(),1),pe(),Mt(),x(),Kt(),xe(),T(),L(),Pt(),lt(),rt(),wn(),ft(),se(),F(),M(),J=w()}));function kr(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 Lt(e)}function Ar(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 jr=e((()=>{Oe()}));function Mr({item:e,isSelected:t}){let[n]=u();if(e.type===`plugin`){let r,i;return e.pendingToggle?(r=S(`suggestion`,n)(a.arrowRight),i=e.pendingToggle===`will-enable`?`will enable`:`will disable`):e.errorCount>0?(r=S(`error`,n)(a.cross),i=`${e.errorCount} ${O(e.errorCount,`error`)}`):e.isEnabled?(r=S(`success`,n)(a.tick),i=`enabled`):(r=S(`inactive`,n)(a.radioOff),i=`disabled`),(0,Y.jsxs)(C,{children:[(0,Y.jsx)(p,{color:t?`suggestion`:void 0,children:t?`${a.pointer} `:` `}),(0,Y.jsx)(p,{color:t?`suggestion`:void 0,children:e.name}),(0,Y.jsxs)(p,{dimColor:!t,children:[` `,(0,Y.jsx)(p,{backgroundColor:`userMessageBackground`,children:`Plugin`})]}),(0,Y.jsxs)(p,{dimColor:!0,children:[` · `,e.marketplace]}),(0,Y.jsxs)(p,{dimColor:!t,children:[` · `,r,` `]}),(0,Y.jsx)(p,{dimColor:!t,children:i})]})}if(e.type===`flagged-plugin`){let r=S(`warning`,n)(a.warning);return(0,Y.jsxs)(C,{children:[(0,Y.jsx)(p,{color:t?`suggestion`:void 0,children:t?`${a.pointer} `:` `}),(0,Y.jsx)(p,{color:t?`suggestion`:void 0,children:e.name}),(0,Y.jsxs)(p,{dimColor:!t,children:[` `,(0,Y.jsx)(p,{backgroundColor:`userMessageBackground`,children:`Plugin`})]}),(0,Y.jsxs)(p,{dimColor:!0,children:[` · `,e.marketplace]}),(0,Y.jsxs)(p,{dimColor:!t,children:[` · `,r,` `]}),(0,Y.jsx)(p,{dimColor:!t,children:`removed`})]})}if(e.type===`failed-plugin`){let r=S(`error`,n)(a.cross),i=`failed to load · ${e.errorCount} ${O(e.errorCount,`error`)}`;return(0,Y.jsxs)(C,{children:[(0,Y.jsx)(p,{color:t?`suggestion`:void 0,children:t?`${a.pointer} `:` `}),(0,Y.jsx)(p,{color:t?`suggestion`:void 0,children:e.name}),(0,Y.jsxs)(p,{dimColor:!t,children:[` `,(0,Y.jsx)(p,{backgroundColor:`userMessageBackground`,children:`Plugin`})]}),(0,Y.jsxs)(p,{dimColor:!0,children:[` · `,e.marketplace]}),(0,Y.jsxs)(p,{dimColor:!t,children:[` · `,r,` `]}),(0,Y.jsx)(p,{dimColor:!t,children:i})]})}let r,i;return e.status===`connected`?(r=S(`success`,n)(a.tick),i=`connected`):e.status===`disabled`?(r=S(`inactive`,n)(a.radioOff),i=`disabled`):e.status===`pending`?(r=S(`inactive`,n)(a.radioOff),i=`connecting…`):e.status===`needs-auth`?(r=S(`warning`,n)(a.triangleUpOutline),i=`Enter to auth`):(r=S(`error`,n)(a.cross),i=`failed`),e.indented?(0,Y.jsxs)(C,{children:[(0,Y.jsx)(p,{color:t?`suggestion`:void 0,children:t?`${a.pointer} `:` `}),(0,Y.jsx)(p,{dimColor:!t,children:`└ `}),(0,Y.jsx)(p,{color:t?`suggestion`:void 0,children:e.name}),(0,Y.jsxs)(p,{dimColor:!t,children:[` `,(0,Y.jsx)(p,{backgroundColor:`userMessageBackground`,children:`MCP`})]}),(0,Y.jsxs)(p,{dimColor:!t,children:[` · `,r,` `]}),(0,Y.jsx)(p,{dimColor:!t,children:i})]}):(0,Y.jsxs)(C,{children:[(0,Y.jsx)(p,{color:t?`suggestion`:void 0,children:t?`${a.pointer} `:` `}),(0,Y.jsx)(p,{color:t?`suggestion`:void 0,children:e.name}),(0,Y.jsxs)(p,{dimColor:!t,children:[` `,(0,Y.jsx)(p,{backgroundColor:`userMessageBackground`,children:`MCP`})]}),(0,Y.jsxs)(p,{dimColor:!t,children:[` · `,r,` `]}),(0,Y.jsx)(p,{dimColor:!t,children:i})]})}var Y,Nr=e((()=>{i(),l(),x(),M(),Y=w()}));async function Pr(e){try{return(await En.readdir(e,{withFileTypes:!0})).filter(e=>e.isFile()&&e.name.endsWith(`.md`)).map(e=>Tn.basename(e.name,`.md`))}catch(t){return ue(`Failed to read plugin components from ${e}: ${ce(t)}`,{level:`error`}),ye(I(t)),[]}}async function Fr(e){try{let t=await En.readdir(e,{withFileTypes:!0}),n=[];for(let r of t)if(r.isDirectory()||r.isSymbolicLink()){let t=Tn.join(e,r.name,`SKILL.md`);try{(await En.stat(t)).isFile()&&n.push(r.name)}catch{}}return n}catch(t){return ue(`Failed to read skill directories from ${e}: ${ce(t)}`,{level:`error`}),ye(I(t)),[]}}function Ir({plugin:e,marketplace:t}){let[n,r]=(0,X.useState)(null),[i,a]=(0,X.useState)(!0),[o,s]=(0,X.useState)(null);return(0,X.useEffect)(()=>{async function n(){try{if(t===`builtin`){let t=Ut(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 Ze(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 Pr(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 Pr(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 Fr(e);c.push(...t)}let l=[];e.hooksConfig&&l.push(Object.keys(e.hooksConfig)),n.hooks&&l.push(n.hooks);let u=[];e.mcpServers&&u.push(Object.keys(e.mcpServers)),n.mcpServers&&u.push(n.mcpServers),r({commands:i.length>0?i:null,agents:o.length>0?o:null,skills:c.length>0?c:null,hooks:l.length>0?l:null,mcpServers:u.length>0?u:null})}else s(`Plugin ${e.name} not found in marketplace`)}catch(e){s(e instanceof Error?e.message:`Failed to load components`)}finally{a(!1)}}n()},[e.name,e.commandsPath,e.commandsPaths,e.agentsPath,e.agentsPaths,e.skillsPath,e.skillsPaths,e.hooksConfig,e.mcpServers,t]),i?null:o?(0,Z.jsxs)(C,{flexDirection:`column`,marginBottom:1,children:[(0,Z.jsx)(p,{bold:!0,children:`Components:`}),(0,Z.jsxs)(p,{dimColor:!0,children:[`Error: `,o]})]}):!n||!(n.commands||n.agents||n.skills||n.hooks||n.mcpServers)?null:(0,Z.jsxs)(C,{flexDirection:`column`,marginBottom:1,children:[(0,Z.jsx)(p,{bold:!0,children:`Installed components:`}),n.commands?(0,Z.jsxs)(p,{dimColor:!0,children:[`• Commands:`,` `,typeof n.commands==`string`?n.commands:Array.isArray(n.commands)?n.commands.join(`, `):Object.keys(n.commands).join(`, `)]}):null,n.agents?(0,Z.jsxs)(p,{dimColor:!0,children:[`• Agents:`,` `,typeof n.agents==`string`?n.agents:Array.isArray(n.agents)?n.agents.join(`, `):Object.keys(n.agents).join(`, `)]}):null,n.skills?(0,Z.jsxs)(p,{dimColor:!0,children:[`• Skills:`,` `,typeof n.skills==`string`?n.skills:Array.isArray(n.skills)?n.skills.join(`, `):Object.keys(n.skills).join(`, `)]}):null,n.hooks?(0,Z.jsxs)(p,{dimColor:!0,children:[`• Hooks:`,` `,typeof n.hooks==`string`?n.hooks:Array.isArray(n.hooks)?n.hooks.map(String).join(`, `):typeof n.hooks==`object`&&n.hooks!==null?Object.keys(n.hooks).join(`, `):String(n.hooks)]}):null,n.mcpServers?(0,Z.jsxs)(p,{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 Lr(e,t){let n=(await Ze(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 Rr(e){return e.filter(e=>{let t=e.source.split(`@`)[1]||`local`;return!At(`${e.name}@${t}`)})}function zr({setViewState:e,setResult:t,onManageComplete:n,onSearchModeChange:r,targetPlugin:i,targetMarketplace:o,action:c}){let l=Xe(e=>e.mcp.clients),u=Xe(e=>e.mcp.tools),m=Xe(e=>e.plugins.errors),h=mn(),[_,y]=(0,X.useState)(!1),b=(0,X.useCallback)(e=>{y(e),r?.(e)},[r]),x=d(),{columns:ee}=s(),[S,w]=(0,X.useState)(`plugin-list`),{query:T,setQuery:E,cursorOffset:D}=xn({isActive:S===`plugin-list`&&_,onExit:()=>{b(!1)}}),[A,j]=(0,X.useState)(null),[M,N]=(0,X.useState)([]),[ie,F]=(0,X.useState)([]),[ae,oe]=(0,X.useState)(!0),[se,L]=(0,X.useState)(new Map),de=(0,X.useRef)(!1),fe=(0,X.useRef)(void 0),pe=_n();te(`confirm:no`,Br.useCallback(()=>{if(S===`plugin-details`)w(`plugin-list`),j(null),R(null);else if(typeof S==`object`&&S.type===`failed-plugin-details`)w(`plugin-list`),R(null);else if(S===`configuring`)w(`plugin-details`),Ae(null);else if(typeof S==`object`&&(S.type===`plugin-options`||S.type===`configuring-options`))w(`plugin-list`),j(null),t(`Plugin enabled. Configuration skipped — run /reload-plugins to apply.`),n&&n();else if(typeof S==`object`&&S.type===`flagged-detail`)w(`plugin-list`),R(null);else if(typeof S==`object`&&S.type===`mcp-detail`)w(`plugin-list`),R(null);else if(typeof S==`object`&&S.type===`mcp-tools`)w({type:`mcp-detail`,client:S.client});else if(typeof S==`object`&&S.type===`mcp-tool-detail`)w({type:`mcp-tools`,client:S.client});else{if(se.size>0){t(`Run /reload-plugins to apply plugin changes.`);return}e({type:`menu`})}},[S,e,se,t]),{context:`Confirmation`,isActive:(S!==`plugin-list`||!_)&&S!==`confirm-project-uninstall`&&!(typeof S==`object`&&S.type===`confirm-data-cleanup`)});let me=e=>e.type===`connected`?`connected`:e.type===`disabled`?`disabled`:e.type===`pending`?`pending`:e.type===`needs-auth`?`needs-auth`:`failed`,he=(0,X.useMemo)(()=>{let e=P(),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=m.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 m){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=Xt(),s=[];for(let[e,t]of a){if(e in h)continue;let n=Vt(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:me(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:me(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(h)){let n=Vt(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,m,se,h]),ge=(0,X.useMemo)(()=>he.filter(e=>e.type===`flagged-plugin`).map(e=>e.id),[he]);(0,X.useEffect)(()=>{ge.length>0&&pn(ge)},[ge]);let _e=(0,X.useMemo)(()=>{if(!T)return he;let e=T.toLowerCase();return he.filter(t=>t.name.toLowerCase().includes(e)||`description`in t&&t.description?.toLowerCase().includes(e))},[he,T]),[ve,xe]=(0,X.useState)(0),Se=fr({totalItems:_e.length,selectedIndex:ve,maxVisible:8}),[Ce,Te]=(0,X.useState)(0),[Ee,De]=(0,X.useState)(!1),[Oe,R]=(0,X.useState)(null),[ke,Ae]=(0,X.useState)(null),[je,Me]=(0,X.useState)(!1),[Ne,Fe]=(0,X.useState)(!1);(0,X.useEffect)(()=>{if(!A){Fe(!1);return}async function e(){let e=A.plugin.manifest.mcpServers,t=!1;if(e&&(t=typeof e==`string`&&Be(e)||Array.isArray(e)&&e.some(e=>typeof e==`string`&&Be(e))),!t)try{let e=Tn.join(A.plugin.path,`..`),n=Tn.join(e,`.claude-plugin`,`marketplace.json`),r=le(await En.readFile(n,`utf-8`)).plugins?.find(e=>e.name===A.plugin.name);if(r?.mcpServers){let e=r.mcpServers;t=typeof e==`string`&&Be(e)||Array.isArray(e)&&e.some(e=>typeof e==`string`&&Be(e))}}catch(e){ue(`Failed to read raw marketplace.json: ${e}`)}Fe(t)}e()},[A]),(0,X.useEffect)(()=>{async function e(){oe(!0);try{let{enabled:e,disabled:t}=await Et(),n=P(),r=Rr([...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=be(t,t=>{let r=`${t.name}@${e}`;return n?.enabledPlugins?.[r]!==!1}),i=t.length-r;a.push({name:e,installedPlugins:t,enabledCount:r,disabledCount:i})}a.sort((e,t)=>e.name===`claude-plugin-directory`?-1:t.name===`claude-plugin-directory`?1:e.name.localeCompare(t.name)),N(a);let o=[];for(let e of a)for(let t of e.installedPlugins){let n=`${t.name}@${e.name}`,r=t.isBuiltin?`builtin`:nn(n).scope;o.push({plugin:t,marketplace:e.name,scope:r,pendingEnable:void 0,pendingUpdate:!1})}F(o),xe(0)}finally{oe(!1)}}e()},[]),(0,X.useEffect)(()=>{if(!de.current&&i&&M.length>0&&!ae){let{name:e,marketplace:n}=Vt(i),r=o??n,a=r?M.filter(e=>e.name===r):M;for(let t of a){let n=t.installedPlugins.find(t=>t.name===e);if(n){let{scope:e}=nn(`${n.name}@${t.name}`);j({plugin:n,marketplace:t.name,scope:e,pendingEnable:void 0,pendingUpdate:!1}),w(`plugin-details`),fe.current=c,de.current=!0;return}}let s=he.find(t=>t.type===`failed-plugin`&&t.name===e);s&&s.type===`failed-plugin`&&(w({type:`failed-plugin-details`,plugin:{id:s.id,name:s.name,marketplace:s.marketplace,errors:s.errors,scope:s.scope}}),de.current=!0),!de.current&&c&&(de.current=!0,t(`Plugin "${i}" is not installed in this project`))}},[i,o,M,ae,he,c,t]);let Ie=async r=>{if(!A)return;let i=A.scope||`user`,a=i===`builtin`;if(a&&(r===`update`||r===`uninstall`)){R(`Built-in plugins cannot be updated or uninstalled.`);return}if(!a&&!tn(i)&&r!==`update`){R(`This plugin is managed by your organization. Contact your admin to disable it.`);return}De(!0),R(null);try{let o=`${A.plugin.name}@${A.marketplace}`,s;switch(r){case`enable`:{let e=await Zt(o);if(!e.success)throw Error(e.message);break}case`disable`:{let e=await en(o);if(!e.success)throw Error(e.message);s=e.reverseDependents;break}case`uninstall`:{if(a||!tn(i))break;if(an(o)){De(!1),w(`confirm-project-uninstall`);return}let e=Ve().plugins[o],t=!e||e.length<=1?await xt(o):null;if(t){De(!1),w({type:`confirm-data-cleanup`,size:t});return}let n=await Qt(o,i);if(!n.success)throw Error(n.message);s=n.reverseDependents;break}case`update`:{if(a)break;let r=await $t(o,i);if(!r.success)throw Error(r.message);if(r.alreadyUpToDate){t(`${A.plugin.name} is already at the latest version (${r.newVersion}).`),n&&await n(),e({type:`menu`});return}break}}yt();let c=`${A.plugin.name}@${A.marketplace}`;if(P()?.enabledPlugins?.[c]!==!1){De(!1),w({type:`plugin-options`});return}let l=r===`enable`?`Enabled`:r===`disable`?`Disabled`:r===`update`?`Updated`:`Uninstalled`,u=s&&s.length>0?` · required by ${s.join(`, `)}`:``;t(`✓ ${l} ${A.plugin.name}${u}. Run /reload-plugins to apply.`),n&&await n(),e({type:`menu`})}catch(e){De(!1),R(`Failed to ${r}: ${e instanceof Error?e.message:String(e)}`),ye(I(e))}},Le=(0,X.useRef)(Ie);Le.current=Ie,(0,X.useEffect)(()=>{if(S===`plugin-details`&&A&&fe.current){let e=fe.current;fe.current=void 0,Le.current(e)}},[S,A]);let Re=Br.useCallback(()=>{if(ve>=_e.length)return;let e=_e[ve];if(e?.type!==`flagged-plugin`)if(e?.type===`plugin`){let t=`${e.plugin.name}@${e.marketplace}`,n=P(),r=se.get(t),i=n?.enabledPlugins?.[t]!==!1,a=e.scope;if(a===`builtin`||tn(a)){let e=new Map(se);r?(e.delete(t),(async()=>{try{r===`will-disable`?await Zt(t):await en(t),yt()}catch(e){ye(e)}})()):(e.set(t,i?`will-disable`:`will-enable`),(async()=>{try{i?await en(t):await Zt(t),yt()}catch(e){ye(e)}})()),L(e)}}else e?.type===`mcp`&&pe(e.client.name)},[ve,_e,se,ie,pe]);v({"select:previous":()=>{ve===0?b(!0):Se.handleSelectionChange(ve-1,xe)},"select:next":()=>{ve<_e.length-1&&Se.handleSelectionChange(ve+1,xe)},"select:accept":Br.useCallback(()=>{if(ve>=_e.length)return;let e=_e[ve];if(e?.type===`plugin`){let t=ie.find(t=>t.plugin.name===e.plugin.name&&t.marketplace===e.marketplace);t&&(j(t),w(`plugin-details`),Te(0),R(null))}else e?.type===`flagged-plugin`?(w({type:`flagged-detail`,plugin:{id:e.id,name:e.name,marketplace:e.marketplace,reason:e.reason,text:e.text,flaggedAt:e.flaggedAt}}),R(null)):e?.type===`failed-plugin`?(w({type:`failed-plugin-details`,plugin:{id:e.id,name:e.name,marketplace:e.marketplace,errors:e.errors,scope:e.scope}}),Te(0),R(null)):e?.type===`mcp`&&(w({type:`mcp-detail`,client:e.client}),R(null))},[ve,_e,ie])},{context:`Select`,isActive:S===`plugin-list`&&!_}),v({"plugin:toggle":Re},{context:`Plugin`,isActive:S===`plugin-list`&&!_}),v({"select:accept":Br.useCallback(()=>{typeof S!=`object`||S.type!==`flagged-detail`||(hn(S.plugin.id),w(`plugin-list`))},[S])},{context:`Select`,isActive:typeof S==`object`&&S.type===`flagged-detail`});let ze=Br.useMemo(()=>{if(S!==`plugin-details`||!A)return[];let e=P(),t=`${A.plugin.name}@${A.marketplace}`,n=e?.enabledPlugins?.[t]!==!1,r=A.marketplace===`builtin`,i=[];return i.push({label:n?`Disable plugin`:`Enable plugin`,action:()=>void Ie(n?`disable`:`enable`)}),r||(i.push({label:A.pendingUpdate?`Unmark for update`:`Mark for update`,action:async()=>{try{let e=await Lr(A.plugin.name,A.marketplace);if(e){R(e);return}let t=[...ie],n=t.findIndex(e=>e.plugin.name===A.plugin.name&&e.marketplace===A.marketplace);n!==-1&&(t[n].pendingUpdate=!A.pendingUpdate,F(t),j({...A,pendingUpdate:!A.pendingUpdate}))}catch(e){R(e instanceof Error?e.message:`Failed to check plugin update availability`)}}}),Ne&&i.push({label:`Configure`,action:async()=>{Me(!0);try{let e=A.plugin.manifest.mcpServers,t=null;if(typeof e==`string`&&Be(e))t=e;else if(Array.isArray(e)){for(let n of e)if(typeof n==`string`&&Be(n)){t=n;break}}if(!t){R(`No MCPB file found in plugin`),Me(!1);return}let n=`${A.plugin.name}@${A.marketplace}`,r=await Rt(t,A.plugin.path,n,void 0,void 0,!0);`status`in r&&r.status===`needs-config`?(Ae(r),w(`configuring`)):R(`Failed to load MCPB for configuration`)}catch(e){R(`Failed to load configuration: ${ce(e)}`)}finally{Me(!1)}}}),A.plugin.manifest.userConfig&&Object.keys(A.plugin.manifest.userConfig).length>0&&i.push({label:`Configure options`,action:()=>{w({type:`configuring-options`,schema:A.plugin.manifest.userConfig})}}),i.push({label:`Update now`,action:()=>void Ie(`update`)}),i.push({label:`Uninstall`,action:()=>void Ie(`uninstall`)})),A.plugin.manifest.homepage&&i.push({label:`Open homepage`,action:()=>void Wt(A.plugin.manifest.homepage)}),A.plugin.manifest.repository&&i.push({label:`View repository`,action:()=>void Wt(A.plugin.manifest.repository)}),i.push({label:`Back to plugin list`,action:()=>{w(`plugin-list`),j(null),R(null)}}),i},[S,A,Ne,ie]);if(v({"select:previous":()=>{Ce>0&&Te(Ce-1)},"select:next":()=>{Ce<ze.length-1&&Te(Ce+1)},"select:accept":()=>{ze[Ce]&&ze[Ce].action()}},{context:`Select`,isActive:S===`plugin-details`&&!!A}),v({"select:accept":()=>{typeof S==`object`&&S.type===`failed-plugin-details`&&(async()=>{De(!0),R(null);let e=S.plugin.id,t=S.plugin.scope,r=tn(t)?await Qt(e,t,!1):await Qt(e,`user`,!1),i=r.success;if(!i){for(let t of[`userSettings`,`projectSettings`,`localSettings`]){let n=k(t);n?.enabledPlugins?.[e]!==void 0&&(re(t,{enabledPlugins:{...n.enabledPlugins,[e]:void 0}}),i=!0)}yt()}i?(n&&await n(),De(!1),w(`plugin-list`)):(De(!1),R(r.message))})()}},{context:`Select`,isActive:typeof S==`object`&&S.type===`failed-plugin-details`&&S.plugin.scope!==`managed`}),v({"confirm:yes":()=>{if(!A)return;De(!0),R(null);let r=`${A.plugin.name}@${A.marketplace}`,{error:i}=re(`localSettings`,{enabledPlugins:{...k(`localSettings`)?.enabledPlugins,[r]:!1}});if(i){De(!1),R(`Failed to write settings: ${i.message}`);return}yt(),t(`✓ Disabled ${A.plugin.name} in .claude/settings.local.json. Run /reload-plugins to apply.`),n&&n(),e({type:`menu`})},"confirm:no":()=>{w(`plugin-details`),R(null)}},{context:`Confirmation`,isActive:S===`confirm-project-uninstall`&&!!A&&!Ee}),ne((r,i)=>{if(!A)return;let o=`${A.plugin.name}@${A.marketplace}`,s=A.scope;if(!s||s===`builtin`||!tn(s))return;let c=async r=>{De(!0),R(null);try{let i=await Qt(o,s,r);if(!i.success)throw Error(i.message);yt();let c=r?``:` · data preserved`;t(`${a.tick} ${i.message}${c}`),n&&n(),e({type:`menu`})}catch(e){De(!1),R(e instanceof Error?e.message:String(e))}};r===`y`||r===`Y`?c(!0):r===`n`||r===`N`?c(!1):i.escape&&(w(`plugin-details`),R(null))},{isActive:typeof S==`object`&&S.type===`confirm-data-cleanup`&&!!A&&!Ee}),Br.useEffect(()=>{xe(0)},[T]),ne((e,t)=>{let n=!t.ctrl&&!t.meta;_||(e===`/`&&n?(b(!0),E(``),xe(0)):n&&e.length>0&&!/^\s+$/.test(e)&&e!==`j`&&e!==`k`&&e!==` `&&(b(!0),E(e),xe(0)))},{isActive:S===`plugin-list`}),ae)return(0,Z.jsx)(p,{children:`Loading installed plugins…`});if(he.length===0)return(0,Z.jsxs)(C,{flexDirection:`column`,children:[(0,Z.jsx)(C,{marginBottom:1,children:(0,Z.jsx)(p,{bold:!0,children:`Manage plugins`})}),(0,Z.jsx)(p,{children:`No plugins or MCP servers installed.`}),(0,Z.jsx)(C,{marginTop:1,children:(0,Z.jsx)(p,{dimColor:!0,children:`Esc to go back`})})]});if(typeof S==`object`&&S.type===`plugin-options`&&A){let r=`${A.plugin.name}@${A.marketplace}`;function i(r){t(r),n&&n(),e({type:`menu`})}return(0,Z.jsx)(er,{plugin:A.plugin,pluginId:r,onDone:(e,t)=>{switch(e){case`configured`:i(`✓ Enabled and configured ${A.plugin.name}. Run /reload-plugins to apply.`);break;case`skipped`:i(`✓ Enabled ${A.plugin.name}. Run /reload-plugins to apply.`);break;case`error`:i(`Failed to save configuration: ${t}`);break}}})}if(typeof S==`object`&&S.type===`configuring-options`&&A){let e=`${A.plugin.name}@${A.marketplace}`;return(0,Z.jsx)(Yn,{title:`Configure ${A.plugin.name}`,subtitle:`Plugin options`,configSchema:S.schema,initialValues:Je(e),onSave:n=>{try{Pe(e,n,S.schema),yt(),t(`Configuration saved. Run /reload-plugins for changes to take effect.`)}catch(e){R(`Failed to save configuration: ${ce(e)}`)}w(`plugin-details`)},onCancel:()=>w(`plugin-details`)})}if(S===`configuring`&&ke&&A){let e=`${A.plugin.name}@${A.marketplace}`;async function n(n){if(!(!ke||!A))try{let r=A.plugin.manifest.mcpServers,i=null;if(typeof r==`string`&&Be(r))i=r;else if(Array.isArray(r)){for(let e of r)if(typeof e==`string`&&Be(e)){i=e;break}}if(!i){R(`No MCPB file found`),w(`plugin-details`);return}await Rt(i,A.plugin.path,e,void 0,n),R(null),Ae(null),w(`plugin-details`),t(`Configuration saved. Run /reload-plugins for changes to take effect.`)}catch(e){R(`Failed to save configuration: ${ce(e)}`),w(`plugin-details`)}}function r(){Ae(null),w(`plugin-details`)}return(0,Z.jsx)(Yn,{title:`Configure ${ke.manifest.name}`,subtitle:`Plugin: ${A.plugin.name}`,configSchema:ke.configSchema,initialValues:ke.existingConfig,onSave:n,onCancel:r})}if(typeof S==`object`&&S.type===`flagged-detail`){let e=S.plugin;return(0,Z.jsxs)(C,{flexDirection:`column`,children:[(0,Z.jsx)(C,{children:(0,Z.jsxs)(p,{bold:!0,children:[e.name,` @ `,e.marketplace]})}),(0,Z.jsxs)(C,{marginBottom:1,children:[(0,Z.jsx)(p,{dimColor:!0,children:`Status: `}),(0,Z.jsx)(p,{color:`error`,children:`Removed`})]}),(0,Z.jsxs)(C,{marginBottom:1,flexDirection:`column`,children:[(0,Z.jsxs)(p,{color:`error`,children:[`Removed from marketplace · reason: `,e.reason]}),(0,Z.jsx)(p,{children:e.text}),(0,Z.jsxs)(p,{dimColor:!0,children:[`Flagged on `,new Date(e.flaggedAt).toLocaleDateString()]})]}),(0,Z.jsx)(C,{marginTop:1,flexDirection:`column`,children:(0,Z.jsxs)(C,{children:[(0,Z.jsxs)(p,{children:[a.pointer,` `]}),(0,Z.jsx)(p,{color:`suggestion`,children:`Dismiss`})]})}),(0,Z.jsxs)(g,{children:[(0,Z.jsx)(z,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`dismiss`}),(0,Z.jsx)(z,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]})]})}if(S===`confirm-project-uninstall`&&A)return(0,Z.jsxs)(C,{flexDirection:`column`,children:[(0,Z.jsxs)(p,{bold:!0,color:`warning`,children:[A.plugin.name,` is enabled in .claude/settings.json (shared with your team)`]}),(0,Z.jsxs)(C,{marginTop:1,flexDirection:`column`,children:[(0,Z.jsx)(p,{children:`Disable it just for you in .claude/settings.local.json?`}),(0,Z.jsx)(p,{dimColor:!0,children:`This has the same effect as uninstalling, without affecting other contributors.`})]}),Oe&&(0,Z.jsx)(C,{marginTop:1,children:(0,Z.jsx)(p,{color:`error`,children:Oe})}),(0,Z.jsx)(C,{marginTop:1,children:Ee?(0,Z.jsx)(p,{dimColor:!0,children:`Disabling…`}):(0,Z.jsxs)(g,{children:[(0,Z.jsx)(z,{action:`confirm:yes`,context:`Confirmation`,fallback:`y`,description:`disable`}),(0,Z.jsx)(z,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})]})})]});if(typeof S==`object`&&S.type===`confirm-data-cleanup`&&A)return(0,Z.jsxs)(C,{flexDirection:`column`,children:[(0,Z.jsxs)(p,{bold:!0,children:[A.plugin.name,` has `,S.size.human,` of persistent data`]}),(0,Z.jsxs)(C,{marginTop:1,flexDirection:`column`,children:[(0,Z.jsx)(p,{children:`Delete it along with the plugin?`}),(0,Z.jsx)(p,{dimColor:!0,children:Tt(`${A.plugin.name}@${A.marketplace}`)})]}),Oe&&(0,Z.jsx)(C,{marginTop:1,children:(0,Z.jsx)(p,{color:`error`,children:Oe})}),(0,Z.jsx)(C,{marginTop:1,children:Ee?(0,Z.jsx)(p,{dimColor:!0,children:`Uninstalling…`}):(0,Z.jsxs)(p,{children:[(0,Z.jsx)(p,{bold:!0,children:`y`}),` to delete · `,(0,Z.jsx)(p,{bold:!0,children:`n`}),` to keep · `,(0,Z.jsx)(p,{bold:!0,children:`esc`}),` to cancel`]})})]});if(S===`plugin-details`&&A){let e=P(),t=`${A.plugin.name}@${A.marketplace}`,n=e?.enabledPlugins?.[t]!==!1,r=m.filter(e=>`plugin`in e&&e.plugin===A.plugin.name||e.source===t||e.source.startsWith(`${A.plugin.name}@`)),i=r.length===0?null:(0,Z.jsxs)(C,{flexDirection:`column`,marginBottom:1,children:[(0,Z.jsxs)(p,{bold:!0,color:`error`,children:[r.length,` `,O(r.length,`error`),`:`]}),r.map((e,t)=>{let n=Ar(e);return(0,Z.jsxs)(C,{flexDirection:`column`,marginLeft:2,children:[(0,Z.jsx)(p,{color:`error`,children:kr(e)}),n&&(0,Z.jsxs)(p,{dimColor:!0,italic:!0,children:[a.arrowRight,` `,n]})]},t)})]});return(0,Z.jsxs)(C,{flexDirection:`column`,children:[(0,Z.jsx)(C,{children:(0,Z.jsxs)(p,{bold:!0,children:[A.plugin.name,` @ `,A.marketplace]})}),(0,Z.jsxs)(C,{children:[(0,Z.jsx)(p,{dimColor:!0,children:`Scope: `}),(0,Z.jsx)(p,{children:A.scope||`user`})]}),A.plugin.manifest.version&&(0,Z.jsxs)(C,{children:[(0,Z.jsx)(p,{dimColor:!0,children:`Version: `}),(0,Z.jsx)(p,{children:A.plugin.manifest.version})]}),A.plugin.manifest.description&&(0,Z.jsx)(C,{marginBottom:1,children:(0,Z.jsx)(p,{children:A.plugin.manifest.description})}),A.plugin.manifest.author&&(0,Z.jsxs)(C,{children:[(0,Z.jsx)(p,{dimColor:!0,children:`Author: `}),(0,Z.jsx)(p,{children:A.plugin.manifest.author.name})]}),(0,Z.jsxs)(C,{marginBottom:1,children:[(0,Z.jsx)(p,{dimColor:!0,children:`Status: `}),(0,Z.jsx)(p,{color:n?`success`:`warning`,children:n?`Enabled`:`Disabled`}),A.pendingUpdate&&(0,Z.jsx)(p,{color:`suggestion`,children:` · Marked for update`})]}),(0,Z.jsx)(Ir,{plugin:A.plugin,marketplace:A.marketplace}),i,(0,Z.jsx)(C,{marginTop:1,flexDirection:`column`,children:ze.map((e,t)=>{let n=t===Ce;return(0,Z.jsxs)(C,{children:[n&&(0,Z.jsxs)(p,{children:[a.pointer,` `]}),!n&&(0,Z.jsx)(p,{children:` `}),(0,Z.jsx)(p,{bold:n,color:e.label.includes(`Uninstall`)?`error`:e.label.includes(`Update`)?`suggestion`:void 0,children:e.label})]},t)})}),Ee&&(0,Z.jsx)(C,{marginTop:1,children:(0,Z.jsx)(p,{children:`Processing…`})}),Oe&&(0,Z.jsx)(C,{marginTop:1,children:(0,Z.jsx)(p,{color:`error`,children:Oe})}),(0,Z.jsx)(C,{marginTop:1,children:(0,Z.jsx)(p,{dimColor:!0,italic:!0,children:(0,Z.jsxs)(g,{children:[(0,Z.jsx)(z,{action:`select:previous`,context:`Select`,fallback:`↑`,description:`navigate`}),(0,Z.jsx)(z,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`select`}),(0,Z.jsx)(z,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]})})})]})}if(typeof S==`object`&&S.type===`failed-plugin-details`){let e=S.plugin,t=e.errors[0],n=t?kr(t):`Failed to load`;return(0,Z.jsxs)(C,{flexDirection:`column`,children:[(0,Z.jsxs)(p,{children:[(0,Z.jsx)(p,{bold:!0,children:e.name}),(0,Z.jsxs)(p,{dimColor:!0,children:[` @ `,e.marketplace]}),(0,Z.jsxs)(p,{dimColor:!0,children:[` (`,e.scope,`)`]})]}),(0,Z.jsx)(p,{color:`error`,children:n}),e.scope===`managed`?(0,Z.jsx)(C,{marginTop:1,children:(0,Z.jsx)(p,{dimColor:!0,children:`Managed by your organization — contact your admin`})}):(0,Z.jsxs)(C,{marginTop:1,children:[(0,Z.jsxs)(p,{color:`suggestion`,children:[a.pointer,` `]}),(0,Z.jsx)(p,{bold:!0,children:`Remove`})]}),Ee&&(0,Z.jsx)(p,{children:`Processing…`}),Oe&&(0,Z.jsx)(p,{color:`error`,children:Oe}),(0,Z.jsx)(C,{marginTop:1,children:(0,Z.jsx)(p,{dimColor:!0,italic:!0,children:(0,Z.jsxs)(g,{children:[e.scope!==`managed`&&(0,Z.jsx)(z,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`remove`}),(0,Z.jsx)(z,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]})})})]})}if(typeof S==`object`&&S.type===`mcp-detail`){let e=S.client,n=we(u,e.name).length,r=()=>{w({type:`mcp-tools`,client:e})},i=()=>{w(`plugin-list`)},a=e=>{e&&t(e),w(`plugin-list`)},o=e.config.scope,s=e.config.type;return s===`stdio`?(0,Z.jsx)(Fn,{server:{name:e.name,client:e,scope:o,transport:`stdio`,config:e.config},serverToolsCount:n,onViewTools:r,onCancel:i,onComplete:a,borderless:!0}):s===`sse`?(0,Z.jsx)(Nn,{server:{name:e.name,client:e,scope:o,transport:`sse`,isAuthenticated:void 0,config:e.config},serverToolsCount:n,onViewTools:r,onCancel:i,onComplete:a,borderless:!0}):s===`http`?(0,Z.jsx)(Nn,{server:{name:e.name,client:e,scope:o,transport:`http`,isAuthenticated:void 0,config:e.config},serverToolsCount:n,onViewTools:r,onCancel:i,onComplete:a,borderless:!0}):s===`claudeai-proxy`?(0,Z.jsx)(Nn,{server:{name:e.name,client:e,scope:o,transport:`claudeai-proxy`,isAuthenticated:void 0,config:e.config},serverToolsCount:n,onViewTools:r,onCancel:i,onComplete:a,borderless:!0}):(w(`plugin-list`),null)}if(typeof S==`object`&&S.type===`mcp-tools`){let e=S.client,t=e.config.scope,n=e.config.type,r;return r=n===`stdio`?{name:e.name,client:e,scope:t,transport:`stdio`,config:e.config}:n===`sse`?{name:e.name,client:e,scope:t,transport:`sse`,isAuthenticated:void 0,config:e.config}:n===`http`?{name:e.name,client:e,scope:t,transport:`http`,isAuthenticated:void 0,config:e.config}:{name:e.name,client:e,scope:t,transport:`claudeai-proxy`,isAuthenticated:void 0,config:e.config},(0,Z.jsx)(Vn,{server:r,onSelectTool:t=>{w({type:`mcp-tool-detail`,client:e,tool:t})},onBack:()=>w({type:`mcp-detail`,client:e})})}if(typeof S==`object`&&S.type===`mcp-tool-detail`){let{client:e,tool:t}=S,n=e.config.scope,r=e.config.type,i;return i=r===`stdio`?{name:e.name,client:e,scope:n,transport:`stdio`,config:e.config}:r===`sse`?{name:e.name,client:e,scope:n,transport:`sse`,isAuthenticated:void 0,config:e.config}:r===`http`?{name:e.name,client:e,scope:n,transport:`http`,isAuthenticated:void 0,config:e.config}:{name:e.name,client:e,scope:n,transport:`claudeai-proxy`,isAuthenticated:void 0,config:e.config},(0,Z.jsx)(Rn,{tool:t,server:i,onBack:()=>w({type:`mcp-tools`,client:e})})}let He=Se.getVisibleItems(_e);return(0,Z.jsxs)(C,{flexDirection:`column`,children:[(0,Z.jsx)(C,{marginBottom:1,children:(0,Z.jsx)(f,{query:T,isFocused:_,isTerminalFocused:x,width:ee-4,cursorOffset:D})}),_e.length===0&&T&&(0,Z.jsx)(C,{marginBottom:1,children:(0,Z.jsxs)(p,{dimColor:!0,children:[`No items match "`,T,`"`]})}),Se.scrollPosition.canScrollUp&&(0,Z.jsx)(C,{children:(0,Z.jsxs)(p,{dimColor:!0,children:[` `,a.arrowUp,` more above`]})}),He.map((e,t)=>{let n=Se.toActualIndex(t)===ve&&!_,r=t>0?He[t-1]:null,i=!r||r.scope!==e.scope;return(0,Z.jsxs)(Br.Fragment,{children:[i&&(0,Z.jsx)(C,{marginTop:+(t>0),paddingLeft:2,children:(0,Z.jsx)(p,{dimColor:e.scope!==`flagged`,color:e.scope===`flagged`?`warning`:void 0,bold:e.scope===`flagged`,children:(e=>{switch(e){case`flagged`:return`Flagged`;case`project`:return`Project`;case`local`:return`Local`;case`user`:return`User`;case`enterprise`:return`Enterprise`;case`managed`:return`Managed`;case`builtin`:return`Built-in`;case`dynamic`:return`Built-in`;default:return e}})(e.scope)})}),(0,Z.jsx)(Mr,{item:e,isSelected:n})]},e.id)}),Se.scrollPosition.canScrollDown&&(0,Z.jsx)(C,{children:(0,Z.jsxs)(p,{dimColor:!0,children:[` `,a.arrowDown,` more below`]})}),(0,Z.jsx)(C,{marginTop:1,marginLeft:1,children:(0,Z.jsx)(p,{dimColor:!0,italic:!0,children:(0,Z.jsxs)(g,{children:[(0,Z.jsx)(p,{children:`type to search`}),(0,Z.jsx)(z,{action:`plugin:toggle`,context:`Plugin`,fallback:`Space`,description:`toggle`}),(0,Z.jsx)(z,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`details`}),(0,Z.jsx)(z,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]})})}),se.size>0&&(0,Z.jsx)(C,{marginLeft:1,children:(0,Z.jsx)(p,{dimColor:!0,italic:!0,children:`Run /reload-plugins to apply changes`})})]})}var Br,X,Z,Vr=e((()=>{i(),Br=t(l(),1),X=t(l(),1),Mt(),x(),Pn(),Ln(),Bn(),Wn(),bn(),Sn(),nt(),Kt(),Ht(),vn(),wt(),rn(),ze(),xe(),Gt(),de(),L(),ve(),Pt(),Me(),rt(),Le(),ct(),gn(),Bt(),ft(),We(),Ct(),Yt(),F(),fe(),M(),jr(),Qn(),rr(),Nr(),hr(),Z=w()}));function Hr(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 Ur=e((()=>{}));function Wr({onComplete:e,path:t}){return(0,Gr.useEffect)(()=>{async function n(){if(!t){e(`Usage: /plugin validate <path>
|
|
1
|
+
import{n as e,o as t}from"./chunk-DR8-3Aex.js";import{s as n,u as r}from"./envUtils-BWeoiL4Y.js";import{n as i,t as a}from"./figures-gfT9mM8P.js";import{Cn as o,F as s,Q as c,Rn as l,T as u,Ut as d,_ as f,b as p,f as m,g as h,h as g,n as _,nt as v,p as y,r as b,t as x,tn as ee,tt as te,v as S,x as C,xt as ne}from"./src-Di342QoJ.js";import{t as w}from"./jsx-runtime-D-D469L8.js";import{Ac as T,Do as E,Fc as D,Po as O,Qa as k,Zt as A,as as j,jo as M,lo as re,ls as N,no as P,on as ie,oo as F,os as ae,ws as oe,xs as se}from"./paths-D8Fx3kUi.js";import{K as I,L as ce,T as le,V as L,d as ue,s as de,w as fe}from"./debug-UI3T040K.js";import{n as pe,r as me}from"./analytics-DqMQntaB.js";import{l as he,u as ge}from"./oauth-CdZEzMww.js";import{c as _e,o as ve,s as ye}from"./log-CzsijfHZ.js";import{b as be,x as xe}from"./teammate-DMYOtLTK.js";import{E as Se,S as Ce}from"./startupProfiler-DnXZaX4A.js";import{$C as we,$s as Te,AC as Ee,As as De,BA as Oe,BS as R,Bw as ke,Bx as Ae,DC as je,Es as Me,Fs as Ne,Fw as Pe,Gs as Fe,Hs as Ie,Iw as Le,JC as Re,LS as ze,Lw as Be,Ms as Ve,Mw as He,NA as Ue,Nw as We,Nx as Ge,OC as Ke,Ow as qe,Pw as Je,QC as Ye,RS as Xe,Rs as Ze,Rw as Qe,SC as $e,Sx as et,Sy as tt,Uw as nt,Vs as rt,WC as it,XC as at,Xs as ot,Ys as st,aA as ct,ac as lt,by as ut,eC as z,ec as dt,fs as ft,fw as pt,hw as mt,ic as ht,ks as gt,kw as _t,kx as vt,lc as yt,my as bt,nA as xt,nc as St,nh as Ct,nw as wt,oA as Tt,ps as Et,qC as Dt,qs as Ot,rc as kt,rh as At,sc as jt,tC as Mt,tc as Nt,uc as Pt,vs as Ft,ys as It,zA as Lt,zw as Rt,zx as zt}from"./loadAgentsDir-HZ19tmOZ.js";import{i as Bt,o as Vt,p as Ht,u as Ut}from"./xml-DZp0WcWT.js";import{n as Wt,t as Gt}from"./browser-fLRXxIsQ.js";import{t as Kt}from"./useKeybinding-FsOnjW6T.js";import{l as qt,u as Jt}from"./referral-BsAvaATn.js";import{n as Yt,t as Xt}from"./pluginStartupCheck-BNfv-Pf4.js";import{a as Zt,d as Qt,f as $t,i as en,l as tn,o as nn,s as rn,u as an}from"./pluginOperations-B3gcFjVq.js";import{a as on,c as sn,i as cn,n as ln,o as un,s as dn,t as fn}from"./validatePlugin-Dxm-5f8W.js";import{a as pn,n as mn,o as hn,r as gn}from"./pluginFlagging-CBbUoCJ9.js";import{i as _n,n as vn,r as yn}from"./MCPConnectionManager-BbGFGZTr.js";import{t as bn}from"./SearchBox-DfOmUoaI.js";import{n as xn,t as Sn}from"./useSearchInput-CR9uhbA7.js";import{i as Cn,n as wn}from"./pluginAutoupdate-BwxAsU2F.js";import*as Tn from"path";import*as En from"fs/promises";function Dn({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,On.jsxs)(C,{children:[(0,On.jsx)(p,{bold:!0,children:`Capabilities: `}),(0,On.jsx)(p,{color:`text`,children:r.length>0?(0,On.jsx)(g,{children:r}):`none`})]})}var On,kn=e((()=>{l(),x(),On=w()}));function An(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 jn(e,t){return`Error reconnecting to ${t}: ${e instanceof Error?e.message:String(e)}`}var Mn=e((()=>{}));function Nn({server:e,serverToolsCount:t,onViewTools:n,onCancel:r,onComplete:i,borderless:o=!1}){let[l]=u(),d=Jt(),{columns:f}=s(),[m,_]=B.useState(!1),[v,y]=B.useState(null),b=Xe(e=>e.mcp),x=R(),[w,T]=B.useState(null),[D,O]=(0,B.useState)(!1),k=(0,B.useRef)(null),[j,M]=(0,B.useState)(!1),[re,N]=(0,B.useState)(null),[P,ie]=(0,B.useState)(!1),[F,ae]=(0,B.useState)(null),[oe,se]=(0,B.useState)(!1),[I,le]=(0,B.useState)(!1),L=(0,B.useRef)(void 0),ue=(0,B.useRef)(!1),[de,fe]=(0,B.useState)(``),[pe,ge]=(0,B.useState)(0),[ve,ye]=(0,B.useState)(null);(0,B.useEffect)(()=>()=>{ue.current=!0,k.current?.abort(),L.current!==void 0&&clearTimeout(L.current)},[]);let be=e.isAuthenticated||e.client.type===`connected`&&t>0,xe=yn(),Se=B.useCallback(async()=>{M(!1),N(null),O(!0);try{let t=await xe(e.name),n=t.client.type===`connected`;me(`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){me(`tengu_claudeai_mcp_auth_completed`,{success:!1}),i?.(jn(t,e.name))}finally{O(!1)}},[xe,e.name,i]),Ce=B.useCallback(async()=>{await et(e.name,{...e.config,scope:e.scope}),x(t=>{let n=t.mcp.clients.map(t=>t.name===e.name?{...t,type:`needs-auth`}:t),r=at(t.mcp.tools,e.name),i=Dt(t.mcp.commands,e.name),a=Re(t.mcp.resources,e.name);return{...t,mcp:{...t.mcp,clients:n,tools:r,commands:i,resources:a}}}),me(`tengu_claudeai_mcp_clear_auth_completed`,{}),i?.(`Disconnected from ${e.name}.`),ie(!1),ae(null),se(!1)},[e.name,e.config,e.scope,x,i]);te(`confirm:no`,()=>{k.current?.abort(),k.current=null,_(!1),T(null)},{context:`Confirmation`,isActive:m}),te(`confirm:no`,()=>{M(!1),N(null)},{context:`Confirmation`,isActive:j}),te(`confirm:no`,()=>{ie(!1),ae(null),se(!1)},{context:`Confirmation`,isActive:P}),ne((e,t)=>{if(t.return&&j&&Se(),t.return&&P)if(oe)Ce();else{let e=`${he().CLAUDE_AI_ORIGIN}/settings/connectors`;ae(e),se(!0),Wt(e)}if(e===`c`&&!I){let e=w||re||F;e&&ee(e).then(e=>{ue.current||(e&&process.stdout.write(e),le(!0),L.current!==void 0&&clearTimeout(L.current),L.current=setTimeout(le,2e3,!1))})}});let we=E(String(e.name)),Te=Ye(b.commands,e.name).length,De=_n(),Oe=B.useCallback(async()=>{let t=he().CLAUDE_AI_ORIGIN,n=A()?.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`,N(r),M(!0),me(`tengu_claudeai_mcp_auth_started`,{}),await Wt(r)},[e.config]),ke=B.useCallback(()=>{ie(!0),me(`tengu_claudeai_mcp_clear_auth_started`,{})},[]),Ae=B.useCallback(async()=>{let t=e.client.type!==`disabled`;try{await De(e.name),e.config.type===`claudeai-proxy`&&me(`tengu_claudeai_mcp_toggle`,{new_state:t?`disabled`:`enabled`}),r()}catch(n){i?.(`Failed to ${t?`disable`:`enable`} MCP server '${e.name}': ${ce(n)}`)}},[e.client.type,e.config.type,e.name,De,r,i]),je=B.useCallback(async()=>{if(e.config.type===`claudeai-proxy`)return;_(!0),y(null);let t=new AbortController;k.current=t;try{if(e.isAuthenticated&&e.config&&await Ee(e.name,e.config,{preserveStepUpState:!0}),e.config){await Ke(e.name,e.config,T,t.signal,{onWaitingForCallback:e=>{ye(()=>e)}}),me(`tengu_mcp_auth_config_authenticate`,{wasAuthenticated:e.isAuthenticated});let n=await xe(e.name);if(n.client.type===`connected`){let t=be?`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.`):(_e(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 $e)&&y(e.message)}finally{_(!1),k.current=null,ye(null),fe(``)}},[e.isAuthenticated,e.config,e.name,i,xe,be]),Me=async()=>{e.config.type!==`claudeai-proxy`&&e.config&&(await Ee(e.name,e.config),me(`tengu_mcp_auth_config_clear`,{}),await et(e.name,{...e.config,scope:e.scope}),x(t=>{let n=t.mcp.clients.map(t=>t.name===e.name?{...t,type:`failed`}:t),r=at(t.mcp.tools,e.name),i=Dt(t.mcp.commands,e.name),a=Re(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(m){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,V.jsxs)(C,{flexDirection:`column`,gap:1,padding:1,children:[(0,V.jsxs)(p,{color:`claude`,children:[`Authenticating with `,e.name,`…`]}),(0,V.jsxs)(C,{children:[(0,V.jsx)(ut,{}),(0,V.jsx)(p,{children:t})]}),w&&(0,V.jsxs)(C,{flexDirection:`column`,children:[(0,V.jsxs)(C,{children:[(0,V.jsx)(p,{dimColor:!0,children:`If your browser doesn't open automatically, copy this URL manually `}),I?(0,V.jsx)(p,{color:`success`,children:`(Copied!)`}):(0,V.jsx)(p,{dimColor:!0,children:(0,V.jsx)(h,{shortcut:`c`,action:`copy`,parens:!0})})]}),(0,V.jsx)(c,{url:w})]}),m&&w&&ve&&(0,V.jsxs)(C,{flexDirection:`column`,marginTop:1,children:[(0,V.jsx)(p,{dimColor:!0,children:`If the redirect page shows a connection error, paste the URL from your browser's address bar:`}),(0,V.jsxs)(C,{children:[(0,V.jsxs)(p,{dimColor:!0,children:[`URL `,`>`,` `]}),(0,V.jsx)(zt,{value:de,onChange:fe,onSubmit:e=>{ve(e.trim()),fe(``)},cursorOffset:pe,onChangeCursorOffset:ge,columns:f-8})]})]}),(0,V.jsx)(C,{marginLeft:3,children:(0,V.jsx)(p,{dimColor:!0,children:`Return here after authenticating in your browser. Press Esc to go back.`})})]})}if(j)return(0,V.jsxs)(C,{flexDirection:`column`,gap:1,padding:1,children:[(0,V.jsxs)(p,{color:`claude`,children:[`Authenticating with `,e.name,`…`]}),(0,V.jsxs)(C,{children:[(0,V.jsx)(ut,{}),(0,V.jsx)(p,{children:` A browser window will open for authentication`})]}),re&&(0,V.jsxs)(C,{flexDirection:`column`,children:[(0,V.jsxs)(C,{children:[(0,V.jsx)(p,{dimColor:!0,children:`If your browser doesn't open automatically, copy this URL manually `}),I?(0,V.jsx)(p,{color:`success`,children:`(Copied!)`}):(0,V.jsx)(p,{dimColor:!0,children:(0,V.jsx)(h,{shortcut:`c`,action:`copy`,parens:!0})})]}),(0,V.jsx)(c,{url:re})]}),(0,V.jsxs)(C,{marginLeft:3,flexDirection:`column`,children:[(0,V.jsxs)(p,{color:`permission`,children:[`Press `,(0,V.jsx)(p,{bold:!0,children:`Enter`}),` after authenticating in your browser.`]}),(0,V.jsx)(p,{dimColor:!0,italic:!0,children:(0,V.jsx)(z,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})})]})]});if(P)return(0,V.jsxs)(C,{flexDirection:`column`,gap:1,padding:1,children:[(0,V.jsxs)(p,{color:`claude`,children:[`Clear authentication for `,e.name]}),oe?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(p,{children:`Find the MCP server in the browser and click "Disconnect".`}),F&&(0,V.jsxs)(C,{flexDirection:`column`,children:[(0,V.jsxs)(C,{children:[(0,V.jsx)(p,{dimColor:!0,children:`If your browser didn't open automatically, copy this URL manually `}),I?(0,V.jsx)(p,{color:`success`,children:`(Copied!)`}):(0,V.jsx)(p,{dimColor:!0,children:(0,V.jsx)(h,{shortcut:`c`,action:`copy`,parens:!0})})]}),(0,V.jsx)(c,{url:F})]}),(0,V.jsxs)(C,{marginLeft:3,flexDirection:`column`,children:[(0,V.jsxs)(p,{color:`permission`,children:[`Press `,(0,V.jsx)(p,{bold:!0,children:`Enter`}),` when done.`]}),(0,V.jsx)(p,{dimColor:!0,italic:!0,children:(0,V.jsx)(z,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})})]})]}):(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(p,{children:`This will open claude.ai in the browser. Find the MCP server in the list and click "Disconnect".`}),(0,V.jsxs)(C,{marginLeft:3,flexDirection:`column`,children:[(0,V.jsxs)(p,{color:`permission`,children:[`Press `,(0,V.jsx)(p,{bold:!0,children:`Enter`}),` to open the browser.`]}),(0,V.jsx)(p,{dimColor:!0,italic:!0,children:(0,V.jsx)(z,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})})]})]})]});if(D)return(0,V.jsxs)(C,{flexDirection:`column`,gap:1,padding:1,children:[(0,V.jsxs)(p,{color:`text`,children:[`Connecting to `,(0,V.jsx)(p,{bold:!0,children:e.name}),`…`]}),(0,V.jsxs)(C,{children:[(0,V.jsx)(ut,{}),(0,V.jsx)(p,{children:` Establishing connection to MCP server`})]}),(0,V.jsx)(p,{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`}):(be&&(Ne.push({label:`Re-authenticate`,value:`reauth`}),Ne.push({label:`Clear authentication`,value:`clear-auth`})),be||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,V.jsxs)(C,{flexDirection:`column`,children:[(0,V.jsxs)(C,{flexDirection:`column`,paddingX:1,borderStyle:o?void 0:`round`,children:[(0,V.jsx)(C,{marginBottom:1,children:(0,V.jsxs)(p,{bold:!0,children:[we,` MCP Server`]})}),(0,V.jsxs)(C,{flexDirection:`column`,gap:0,children:[(0,V.jsxs)(C,{children:[(0,V.jsx)(p,{bold:!0,children:`Status: `}),e.client.type===`disabled`?(0,V.jsxs)(p,{children:[S(`inactive`,l)(a.radioOff),` disabled`]}):e.client.type===`connected`?(0,V.jsxs)(p,{children:[S(`success`,l)(a.tick),` connected`]}):e.client.type===`pending`?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(p,{dimColor:!0,children:a.radioOff}),(0,V.jsx)(p,{children:` connecting…`})]}):e.client.type===`needs-auth`?(0,V.jsxs)(p,{children:[S(`warning`,l)(a.triangleUpOutline),` needs authentication`]}):(0,V.jsxs)(p,{children:[S(`error`,l)(a.cross),` failed`]})]}),e.transport!==`claudeai-proxy`&&(0,V.jsxs)(C,{children:[(0,V.jsx)(p,{bold:!0,children:`Auth: `}),be?(0,V.jsxs)(p,{children:[S(`success`,l)(a.tick),` authenticated`]}):(0,V.jsxs)(p,{children:[S(`error`,l)(a.cross),` not authenticated`]})]}),(0,V.jsxs)(C,{children:[(0,V.jsx)(p,{bold:!0,children:`URL: `}),(0,V.jsx)(p,{dimColor:!0,children:e.config.url})]}),(0,V.jsxs)(C,{children:[(0,V.jsx)(p,{bold:!0,children:`Config location: `}),(0,V.jsx)(p,{dimColor:!0,children:it(e.scope)})]}),e.client.type===`connected`&&(0,V.jsx)(Dn,{serverToolsCount:t,serverPromptsCount:Te,serverResourcesCount:b.resources[e.name]?.length||0}),e.client.type===`connected`&&t>0&&(0,V.jsxs)(C,{children:[(0,V.jsx)(p,{bold:!0,children:`Tools: `}),(0,V.jsxs)(p,{dimColor:!0,children:[t,` tools`]})]})]}),v&&(0,V.jsx)(C,{marginTop:1,children:(0,V.jsxs)(p,{color:`error`,children:[`Error: `,v]})}),Ne.length>0&&(0,V.jsx)(C,{marginTop:1,children:(0,V.jsx)(Ge,{options:Ne,onChange:async t=>{switch(t){case`tools`:n();break;case`auth`:case`reauth`:await je();break;case`clear-auth`:await Me();break;case`claudeai-auth`:await Oe();break;case`claudeai-clear-auth`:ke();break;case`reconnectMcpServer`:O(!0);try{let t=await xe(e.name);e.config.type===`claudeai-proxy`&&me(`tengu_claudeai_mcp_reconnect`,{success:t.client.type===`connected`});let{message:n}=An(t,e.name);i?.(n)}catch(t){e.config.type===`claudeai-proxy`&&me(`tengu_claudeai_mcp_reconnect`,{success:!1}),i?.(jn(t,e.name))}finally{O(!1)}break;case`toggle-enabled`:await Ae();break;case`back`:r();break}},onCancel:r})})]}),(0,V.jsx)(C,{marginTop:1,children:(0,V.jsx)(p,{dimColor:!0,italic:!0,children:d.pending?(0,V.jsxs)(V.Fragment,{children:[`Press `,d.keyName,` again to exit`]}):(0,V.jsxs)(g,{children:[(0,V.jsx)(h,{shortcut:`↑↓`,action:`navigate`}),(0,V.jsx)(h,{shortcut:`Enter`,action:`select`}),(0,V.jsx)(z,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]})})})]})}var B,V,Pn=e((()=>{i(),B=t(l(),1),pe(),ge(),qt(),nt(),x(),Kt(),je(),vt(),vn(),wt(),ze(),ie(),Gt(),L(),ve(),M(),Mt(),bt(),tt(),Ae(),kn(),Mn(),V=w()}));function Fn({server:e,serverToolsCount:t,onViewTools:n,onCancel:r,onComplete:i,borderless:o=!1}){let[s]=u(),c=Jt(),l=Xe(e=>e.mcp),d=yn(),f=_n(),[m,_]=(0,In.useState)(!1),v=In.useCallback(async()=>{let t=e.client.type!==`disabled`;try{await f(e.name),r()}catch(n){i(`Failed to ${t?`disable`:`enable`} MCP server '${e.name}': ${ce(n)}`)}},[e.client.type,e.name,f,r,i]),y=E(String(e.name)),b=Ye(l.commands,e.name).length,x=[];return e.client.type!==`disabled`&&t>0&&x.push({label:`View tools`,value:`tools`}),e.client.type!==`disabled`&&x.push({label:`Reconnect`,value:`reconnectMcpServer`}),x.push({label:e.client.type===`disabled`?`Enable`:`Disable`,value:`toggle-enabled`}),x.length===0&&x.push({label:`Back`,value:`back`}),m?(0,H.jsxs)(C,{flexDirection:`column`,gap:1,padding:1,children:[(0,H.jsxs)(p,{color:`text`,children:[`Reconnecting to `,(0,H.jsx)(p,{bold:!0,children:e.name})]}),(0,H.jsxs)(C,{children:[(0,H.jsx)(ut,{}),(0,H.jsx)(p,{children:` Restarting MCP server process`})]}),(0,H.jsx)(p,{dimColor:!0,children:`This may take a few moments.`})]}):(0,H.jsxs)(C,{flexDirection:`column`,children:[(0,H.jsxs)(C,{flexDirection:`column`,paddingX:1,borderStyle:o?void 0:`round`,children:[(0,H.jsx)(C,{marginBottom:1,children:(0,H.jsxs)(p,{bold:!0,children:[y,` MCP Server`]})}),(0,H.jsxs)(C,{flexDirection:`column`,gap:0,children:[(0,H.jsxs)(C,{children:[(0,H.jsx)(p,{bold:!0,children:`Status: `}),e.client.type===`disabled`?(0,H.jsxs)(p,{children:[S(`inactive`,s)(a.radioOff),` disabled`]}):e.client.type===`connected`?(0,H.jsxs)(p,{children:[S(`success`,s)(a.tick),` connected`]}):e.client.type===`pending`?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(p,{dimColor:!0,children:a.radioOff}),(0,H.jsx)(p,{children:` connecting…`})]}):(0,H.jsxs)(p,{children:[S(`error`,s)(a.cross),` failed`]})]}),(0,H.jsxs)(C,{children:[(0,H.jsx)(p,{bold:!0,children:`Command: `}),(0,H.jsx)(p,{dimColor:!0,children:e.config.command})]}),e.config.args&&e.config.args.length>0&&(0,H.jsxs)(C,{children:[(0,H.jsx)(p,{bold:!0,children:`Args: `}),(0,H.jsx)(p,{dimColor:!0,children:e.config.args.join(` `)})]}),(0,H.jsxs)(C,{children:[(0,H.jsx)(p,{bold:!0,children:`Config location: `}),(0,H.jsx)(p,{dimColor:!0,children:it(pt(e.name)?.scope??`dynamic`)})]}),e.client.type===`connected`&&(0,H.jsx)(Dn,{serverToolsCount:t,serverPromptsCount:b,serverResourcesCount:l.resources[e.name]?.length||0}),e.client.type===`connected`&&t>0&&(0,H.jsxs)(C,{children:[(0,H.jsx)(p,{bold:!0,children:`Tools: `}),(0,H.jsxs)(p,{dimColor:!0,children:[t,` tools`]})]})]}),x.length>0&&(0,H.jsx)(C,{marginTop:1,children:(0,H.jsx)(Ge,{options:x,onChange:async t=>{if(t===`tools`)n();else if(t===`reconnectMcpServer`){_(!0);try{let{message:t}=An(await d(e.name),e.name);i?.(t)}catch(t){i?.(jn(t,e.name))}finally{_(!1)}}else t===`toggle-enabled`?await v():t===`back`&&r()},onCancel:r})})]}),(0,H.jsx)(C,{marginTop:1,children:(0,H.jsx)(p,{dimColor:!0,italic:!0,children:c.pending?(0,H.jsxs)(H.Fragment,{children:[`Press `,c.keyName,` again to exit`]}):(0,H.jsxs)(g,{children:[(0,H.jsx)(h,{shortcut:`↑↓`,action:`navigate`}),(0,H.jsx)(h,{shortcut:`Enter`,action:`select`}),(0,H.jsx)(z,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]})})})]})}var In,H,Ln=e((()=>{i(),In=t(l(),1),qt(),x(),mt(),vn(),wt(),ze(),L(),M(),Mt(),bt(),tt(),kn(),Mn(),H=w()}));function Rn({tool:e,server:t,onBack:n}){let[r,i]=zn.useState(``),a=ae(e.name,t.name),o=j(e.userFacingName?e.userFacingName({}):a),s=e.isReadOnly?.({})??!1,c=e.isDestructive?.({})??!1,l=e.isOpenWorld?.({})??!1;return zn.useEffect(()=>{async function t(){try{i(await e.description({},{isNonInteractiveSession:!1,toolPermissionContext:{mode:`default`,additionalWorkingDirectories:new Map,alwaysAllowRules:{},alwaysDenyRules:{},alwaysAskRules:{},isBypassPermissionsModeAvailable:!1},tools:[]}))}catch{i(`Failed to load description`)}}t()},[e]),(0,U.jsx)(m,{title:(0,U.jsxs)(U.Fragment,{children:[o,s&&(0,U.jsx)(p,{color:`success`,children:` [read-only]`}),c&&(0,U.jsx)(p,{color:`error`,children:` [destructive]`}),l&&(0,U.jsx)(p,{dimColor:!0,children:` [open-world]`})]}),subtitle:t.name,onCancel:n,inputGuide:e=>e.pending?(0,U.jsxs)(p,{children:[`Press `,e.keyName,` again to exit`]}):(0,U.jsx)(z,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`}),children:(0,U.jsxs)(C,{flexDirection:`column`,children:[(0,U.jsxs)(C,{children:[(0,U.jsx)(p,{bold:!0,children:`Tool name: `}),(0,U.jsx)(p,{dimColor:!0,children:a})]}),(0,U.jsxs)(C,{children:[(0,U.jsx)(p,{bold:!0,children:`Full name: `}),(0,U.jsx)(p,{dimColor:!0,children:e.name})]}),r&&(0,U.jsxs)(C,{flexDirection:`column`,marginTop:1,children:[(0,U.jsx)(p,{bold:!0,children:`Description:`}),(0,U.jsx)(p,{wrap:`wrap`,children:r})]}),e.inputJSONSchema&&e.inputJSONSchema.properties&&Object.keys(e.inputJSONSchema.properties).length>0&&(0,U.jsxs)(C,{flexDirection:`column`,marginTop:1,children:[(0,U.jsx)(p,{bold:!0,children:`Parameters:`}),(0,U.jsx)(C,{marginLeft:2,flexDirection:`column`,children:Object.entries(e.inputJSONSchema.properties).map(([t,n])=>{let r=(e.inputJSONSchema?.required)?.includes(t);return(0,U.jsxs)(p,{children:[`• `,t,r&&(0,U.jsx)(p,{dimColor:!0,children:` (required)`}),`:`,` `,(0,U.jsx)(p,{dimColor:!0,children:typeof n==`object`&&n&&`type`in n?String(n.type):`unknown`}),typeof n==`object`&&n&&`description`in n&&(0,U.jsxs)(p,{dimColor:!0,children:[` - `,String(n.description)]})]},t)})})]})]})})}var zn,U,Bn=e((()=>{zn=t(l(),1),x(),N(),Mt(),U=w()}));function Vn({server:e,onSelectTool:t,onBack:n}){let r=Xe(e=>e.mcp.tools),i=Hn.useMemo(()=>e.client.type===`connected`?we(r,e.name):[],[e,r]),a=i.map((t,n)=>{let r=ae(t.name,e.name),i=j(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,Un.jsx)(m,{title:`Tools for ${e.name}`,subtitle:`${i.length} ${O(i.length,`tool`)}`,onCancel:n,inputGuide:e=>e.pending?(0,Un.jsxs)(p,{children:[`Press `,e.keyName,` again to exit`]}):(0,Un.jsxs)(g,{children:[(0,Un.jsx)(h,{shortcut:`↑↓`,action:`navigate`}),(0,Un.jsx)(h,{shortcut:`Enter`,action:`select`}),(0,Un.jsx)(z,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]}),children:i.length===0?(0,Un.jsx)(p,{dimColor:!0,children:`No tools available`}):(0,Un.jsx)(Ge,{options:a,onChange:e=>{let n=parseInt(e,10),r=i[n];r&&t(r,n)},onCancel:n})})}var Hn,Un,Wn=e((()=>{Hn=t(l(),1),x(),N(),wt(),ze(),M(),Mt(),bt(),Un=w()}));function Gn({inputValue:e,setInputValue:t,cursorOffset:n,setCursorOffset:r,error:i,setError:a,result:o,setResult:s,setViewState:c,onAddComplete:l,cliMode:u=!1}){let d=(0,Kn.useRef)(!1),[f,m]=(0,Kn.useState)(!1),[_,v]=(0,Kn.useState)(``),y=async()=>{let t=e.trim();if(!t){a(`Please enter a marketplace source`);return}let n=await on(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{m(!0),v(``);let{name:e,resolvedSource:t}=await Ne(n,e=>{v(e)});st(e,{source:t}),yt();let r=n.source;n.source===`github`&&(r=n.repo),me(`tengu_marketplace_added`,{source_type:r}),l&&await l(),v(``),m(!1),u?s(`Successfully added marketplace: ${e}`):c({type:`browse-marketplace`,targetMarketplace:e})}catch(e){let t=I(e);ye(t),a(t.message),v(``),m(!1),s(u?`Error: ${t.message}`:null)}};return(0,Kn.useEffect)(()=>{e&&!d.current&&!i&&!o&&(d.current=!0,y())},[]),(0,W.jsxs)(C,{flexDirection:`column`,children:[(0,W.jsxs)(C,{flexDirection:`column`,paddingX:1,borderStyle:`round`,children:[(0,W.jsx)(C,{marginBottom:1,children:(0,W.jsx)(p,{bold:!0,children:`Add Marketplace`})}),(0,W.jsxs)(C,{flexDirection:`column`,children:[(0,W.jsx)(p,{children:`Enter marketplace source:`}),(0,W.jsx)(p,{dimColor:!0,children:`Examples:`}),(0,W.jsx)(p,{dimColor:!0,children:` · owner/repo (GitHub)`}),(0,W.jsx)(p,{dimColor:!0,children:` · git@github.com:owner/repo.git (SSH)`}),(0,W.jsx)(p,{dimColor:!0,children:` · https://example.com/marketplace.json`}),(0,W.jsx)(p,{dimColor:!0,children:` · ./path/to/marketplace`}),(0,W.jsx)(C,{marginTop:1,children:(0,W.jsx)(zt,{value:e,onChange:t,onSubmit:y,columns:80,cursorOffset:n,onChangeCursorOffset:r,focus:!0,showCursor:!0})})]}),f&&(0,W.jsxs)(C,{marginTop:1,children:[(0,W.jsx)(ut,{}),(0,W.jsx)(p,{children:_||`Adding marketplace to configuration…`})]}),i&&(0,W.jsx)(C,{marginTop:1,children:(0,W.jsx)(p,{color:`error`,children:i})}),o&&(0,W.jsx)(C,{marginTop:1,children:(0,W.jsx)(p,{children:o})})]}),(0,W.jsx)(C,{marginLeft:3,children:(0,W.jsx)(p,{dimColor:!0,italic:!0,children:(0,W.jsxs)(g,{children:[(0,W.jsx)(h,{shortcut:`Enter`,action:`add`}),(0,W.jsx)(z,{action:`confirm:no`,context:`Settings`,fallback:`Esc`,description:`cancel`})]})})})]})}var Kn,W,qn=e((()=>{l(),Kn=t(l(),1),pe(),Mt(),x(),tt(),Ae(),L(),ve(),Pt(),rt(),cn(),W=w()}));function Jn(e,t,n,i){let a={};for(let o of e){let e=n[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]=r(s):a[o]=s}return a}function Yn({title:e,subtitle:t,configSchema:n,initialValues:r,onSave:i,onCancel:s}){let c=Object.keys(n),l=(0,Xn.useCallback)(e=>{if(n[e]?.sensitive===!0)return``;let t=r?.[e];return t===void 0?``:String(t)},[n,r]),[u,d]=(0,Xn.useState)(0),[f,h]=(0,Xn.useState)({}),[g,_]=(0,Xn.useState)(()=>c[0]?l(c[0]):``),y=c[u],b=y?n[y]:null;if(te(`confirm:no`,s,{context:`Settings`}),v({"confirm:nextField":(0,Xn.useCallback)(()=>{if(u<c.length-1&&y){h(e=>({...e,[y]:g})),d(e=>e+1);let e=c[u+1];_(e?l(e):``)}},[u,c,y,g,l]),"confirm:yes":(0,Xn.useCallback)(()=>{if(!y)return;let e={...f,[y]:g};if(u===c.length-1)i(Jn(c,e,n,r));else{h(e),d(e=>e+1);let t=c[u+1];_(t?l(t):``)}},[y,f,g,u,c,n,i,l,r])},{context:`Confirmation`}),ne((e,t)=>{if(t.backspace||t.delete){_(e=>e.slice(0,-1));return}e&&!t.ctrl&&!t.meta&&!t.tab&&!t.return&&_(t=>t+e)}),!b||!y)return null;let x=b.sensitive===!0,ee=b.required===!0,S=x?`*`.repeat(o(g)):g;return(0,Zn.jsxs)(m,{title:e,subtitle:t,onCancel:s,isCancelActive:!1,children:[(0,Zn.jsxs)(C,{flexDirection:`column`,children:[(0,Zn.jsxs)(p,{bold:!0,children:[b.title||y,ee&&(0,Zn.jsx)(p,{color:`error`,children:` *`})]}),b.description&&(0,Zn.jsx)(p,{dimColor:!0,children:b.description}),(0,Zn.jsxs)(C,{marginTop:1,children:[(0,Zn.jsxs)(p,{children:[a.pointerSmall,` `]}),(0,Zn.jsx)(p,{children:S}),(0,Zn.jsx)(p,{children:`█`})]})]}),(0,Zn.jsxs)(C,{flexDirection:`column`,children:[(0,Zn.jsxs)(p,{dimColor:!0,children:[`Field `,u+1,` of `,c.length]}),u<c.length-1&&(0,Zn.jsx)(p,{dimColor:!0,children:`Tab: Next field · Enter: Save and continue`}),u===c.length-1&&(0,Zn.jsx)(p,{dimColor:!0,children:`Enter: Save configuration`})]})]})}var Xn,Zn,Qn=e((()=>{i(),Xn=t(l(),1),x(),Kt(),n(),Zn=w()}));async function $n(e){let{enabled:t,disabled:n}=await Et();return[...t,...n].find(t=>t.repository===e||t.source===e)}function er({plugin:e,pluginId:t,onDone:n}){let[r]=tr.useState(()=>{let n=[],r=He(e);Object.keys(r).length>0&&n.push({key:`top-level`,title:`Configure ${e.name}`,subtitle:`Plugin options`,schema:r,load:()=>Je(t),save:n=>Pe(t,n,e.manifest.userConfig)});let i=qe(e);for(let r of i)n.push({key:`channel:${r.server}`,title:`Configure ${r.displayName}`,subtitle:`Plugin: ${e.name}`,schema:r.configSchema,load:()=>Qe(t,r.server)??void 0,save:e=>ke(t,r.server,e,r.configSchema)});return n}),[i,a]=tr.useState(0),o=tr.useRef(n);if(o.current=n,tr.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`,ce(e));return}let t=i+1;t<r.length?a(t):n(`configured`)}return(0,nr.jsx)(Yn,{title:s.title,subtitle:s.subtitle,configSchema:s.schema,initialValues:s.load(),onSave:c,onCancel:()=>n(`skipped`)},s.key)}var tr,nr,rr=e((()=>{tr=t(l(),1),L(),Le(),_t(),ft(),We(),Qn(),nr=w()}));function ir(){let e=ht();return(0,ar.jsxs)(C,{marginBottom:1,children:[(0,ar.jsxs)(p,{color:`claude`,children:[a.warning,` `]}),(0,ar.jsxs)(p,{dimColor:!0,italic:!0,children:[`Make sure you trust a plugin before installing, updating, or using it. Anthropic does 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 ar,or=e((()=>{i(),l(),x(),lt(),ar=w()}));function sr(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 cr(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 lr({hasSelection:e}){return(0,ur.jsx)(C,{marginTop:1,children:(0,ur.jsx)(p,{dimColor:!0,italic:!0,children:(0,ur.jsxs)(g,{children:[e&&(0,ur.jsx)(z,{action:`plugin:install`,context:`Plugin`,fallback:`i`,description:`install`,bold:!0}),(0,ur.jsx)(z,{action:`plugin:toggle`,context:`Plugin`,fallback:`Space`,description:`toggle`}),(0,ur.jsx)(z,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`details`}),(0,ur.jsx)(z,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]})})})}var ur,dr=e((()=>{l(),Mt(),x(),ur=w()}));function fr({totalItems:e,maxVisible:t=mr,selectedIndex:n=0}){let r=e>t,i=(0,pr.useRef)(0),a=(0,pr.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,pr.useCallback)(e=>r?e.slice(o,s):e,[r,o,s]),l=(0,pr.useCallback)(e=>o+e,[o]),u=(0,pr.useCallback)(e=>e>=o&&e<s,[o,s]),d=(0,pr.useCallback)(e=>{},[]),f=(0,pr.useCallback)(()=>{},[]),p=(0,pr.useCallback)(()=>{},[]),m=(0,pr.useCallback)((t,n)=>{n(Math.max(0,Math.min(t,e-1)))},[e]),h=(0,pr.useCallback)((e,t)=>!1,[]),g=Math.max(1,Math.ceil(e/t));return{currentPage:Math.floor(a/t),totalPages:g,startIndex:o,endIndex:s,needsPagination:r,pageSize:t,getVisibleItems:c,toActualIndex:l,isOnCurrentPage:u,goToPage:d,nextPage:f,prevPage:p,handleSelectionChange:m,handlePageNavigation:h,scrollPosition:{current:n+1,total:e,canScrollUp:a>0,canScrollDown:a+t<e}}}var pr,mr,hr=e((()=>{pr=t(l(),1),mr=5}));function gr({error:e,setError:t,result:n,setResult:r,setViewState:i,onInstallComplete:o,targetMarketplace:s,targetPlugin:c}){let[l,u]=(0,vr.useState)(`marketplace-list`),[d,f]=(0,vr.useState)(null),[m,h]=(0,vr.useState)(null),[_,y]=(0,vr.useState)([]),[b,x]=(0,vr.useState)([]),[ee,S]=(0,vr.useState)(!0),[ne,w]=(0,vr.useState)(null),[T,E]=(0,vr.useState)(0),[D,k]=(0,vr.useState)(new Set),[A,j]=(0,vr.useState)(new Set),M=fr({totalItems:b.length,selectedIndex:T}),[re,N]=(0,vr.useState)(0),[P,ie]=(0,vr.useState)(!1),[F,ae]=(0,vr.useState)(null),[oe,se]=(0,vr.useState)(null);te(`confirm:no`,_r.useCallback(()=>{l===`plugin-list`?s?i({type:`manage-marketplaces`,targetMarketplace:s}):_.length===1?i({type:`menu`}):(u(`marketplace-list`),f(null),k(new Set)):l===`plugin-details`?(u(`plugin-list`),h(null)):i({type:`menu`})},[l,s,i,_.length]),{context:`Confirmation`}),(0,vr.useEffect)(()=>{async function e(){try{let e=await Ie(),{marketplaces:n,failures:r}=await jt(e),i=[];for(let{name:e,config:t,data:r}of n)if(r){let n=be(r.plugins,t=>De(Te(t.name,e)));i.push({name:e,totalPlugins:r.plugins.length,installedCount:n,source:kt(t.source)})}i.sort((e,t)=>e.name===`claude-plugin-directory`?-1:+(t.name===`claude-plugin-directory`)),y(i);let a=St(r,be(n,e=>e.data!==null));if(a)if(a.type===`warning`)se(a.message+`. Showing available marketplaces.`);else throw Error(a.message);if(i.length===1&&!s&&!c){let e=i[0];e&&(f(e.name),u(`plugin-list`))}if(c){let n=null,r=null;for(let[t]of Object.entries(e)){let e=await Ze(t);if(e){let i=e.plugins.find(e=>e.name===c);if(i){let e=Te(i.name,t);n={entry:i,marketplaceName:t,pluginId:e,isInstalled:gt(e)},r=t;break}}}if(n&&r){let e=n.pluginId;gt(e)?t(`Plugin '${e}' is already installed globally. Use '/plugin' to manage existing plugins.`):(f(r),h(n),u(`plugin-details`))}else t(`Plugin "${c}" not found in any marketplace`)}else s&&(i.some(e=>e.name===s)?(f(s),u(`plugin-list`)):t(`Marketplace "${s}" not found`))}catch(e){t(e instanceof Error?e.message:`Failed to load marketplaces`)}finally{S(!1)}}e()},[t,s,c]),(0,vr.useEffect)(()=>{if(!d)return;let e=!1;async function n(n){S(!0);try{let t=await Ze(n);if(e)return;if(!t)throw Error(`Failed to load marketplace: ${n}`);let r=[];for(let e of t.plugins){let t=Te(e.name,n);At(t)||r.push({entry:e,marketplaceName:n,pluginId:t,isInstalled:gt(t)})}try{let t=await dn();if(e)return;w(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;ue(`Failed to fetch install counts: ${ce(t)}`),r.sort((e,t)=>e.entry.name.localeCompare(t.entry.name))}x(r),E(0),k(new Set)}catch(n){if(e)return;t(n instanceof Error?n.message:`Failed to load plugins`)}finally{S(!1)}}return n(d),()=>{e=!0}},[d,t]);let I=async()=>{if(D.size===0)return;let e=b.filter(e=>D.has(e.pluginId));j(new Set(e.map(e=>e.pluginId)));let n=0,a=0,s=[];for(let t of e){let e=await It({pluginId:t.pluginId,entry:t.entry,marketplaceName:t.marketplaceName,scope:`user`});e.success?n++:(a++,s.push({name:t.entry.name,reason:e.error}))}j(new Set),k(new Set),yt(),a===0?r(`✓ Installed ${n} ${O(n,`plugin`)}. Run /reload-plugins to activate.`):n===0?t(`Failed to install: ${Nt(s,!0)}`):r(`✓ Installed ${n} of ${n+a} plugins. Failed: ${Nt(s,!1)}. Run /reload-plugins to activate successfully installed plugins.`),n>0&&o&&await o(),i({type:`menu`})},le=async(e,t=`user`)=>{ie(!0),ae(null);let n=await It({pluginId:e.pluginId,entry:e.entry,marketplaceName:e.marketplaceName,scope:t});if(n.success){let t=await $n(e.pluginId);if(t){ie(!1),u({type:`plugin-options`,plugin:t,pluginId:e.pluginId});return}r(n.message),o&&await o(),i({type:`menu`})}else ie(!1),ae(n.error)};(0,vr.useEffect)(()=>{e&&r(e)},[e,r]),v({"select:previous":()=>{T>0&&E(T-1)},"select:next":()=>{T<_.length-1&&E(T+1)},"select:accept":()=>{let e=_[T];e&&(f(e.name),u(`plugin-list`))}},{context:`Select`,isActive:l===`marketplace-list`}),v({"select:previous":()=>{T>0&&M.handleSelectionChange(T-1,E)},"select:next":()=>{T<b.length-1&&M.handleSelectionChange(T+1,E)},"select:accept":()=>{if(T===b.length&&D.size>0)I();else if(T<b.length){let e=b[T];e&&(e.isInstalled?i({type:`manage-plugins`,targetPlugin:e.entry.name,targetMarketplace:e.marketplaceName}):(h(e),u(`plugin-details`),N(0),ae(null)))}}},{context:`Select`,isActive:l===`plugin-list`}),v({"plugin:toggle":()=>{if(T<b.length){let e=b[T];if(e&&!e.isInstalled){let t=new Set(D);t.has(e.pluginId)?t.delete(e.pluginId):t.add(e.pluginId),k(t)}}},"plugin:install":()=>{D.size>0&&I()}},{context:`Plugin`,isActive:l===`plugin-list`});let L=_r.useMemo(()=>{if(!m)return[];let e=m.entry.homepage;return cr(e,sr(m))},[m]);if(v({"select:previous":()=>{re>0&&N(re-1)},"select:next":()=>{re<L.length-1&&N(re+1)},"select:accept":()=>{if(!m)return;let e=L[re]?.action,t=m.entry.homepage,n=sr(m);e===`install-user`?le(m,`user`):e===`install-project`?le(m,`project`):e===`install-local`?le(m,`local`):e===`homepage`&&t?Wt(t):e===`github`&&n?Wt(`https://github.com/${n}`):e===`back`&&(u(`plugin-list`),h(null))}},{context:`Select`,isActive:l===`plugin-details`&&!!m}),typeof l==`object`&&l.type===`plugin-options`){let{plugin:e,pluginId:t}=l;function n(e){r(e),o&&o(),i({type:`menu`})}return(0,G.jsx)(er,{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(ee)return(0,G.jsx)(p,{children:`Loading…`});if(e)return(0,G.jsx)(p,{color:`error`,children:e});if(l===`marketplace-list`)return _.length===0?(0,G.jsxs)(C,{flexDirection:`column`,children:[(0,G.jsx)(C,{marginBottom:1,children:(0,G.jsx)(p,{bold:!0,children:`Select marketplace`})}),(0,G.jsx)(p,{children:`No marketplaces configured.`}),(0,G.jsxs)(p,{dimColor:!0,children:[`Add a marketplace first using `,`'Add marketplace'`,`.`]}),(0,G.jsx)(C,{marginTop:1,paddingLeft:1,children:(0,G.jsx)(p,{dimColor:!0,children:(0,G.jsx)(z,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`})})})]}):(0,G.jsxs)(C,{flexDirection:`column`,children:[(0,G.jsx)(C,{marginBottom:1,children:(0,G.jsx)(p,{bold:!0,children:`Select marketplace`})}),oe&&(0,G.jsx)(C,{marginBottom:1,flexDirection:`column`,children:(0,G.jsxs)(p,{color:`warning`,children:[a.warning,` `,oe]})}),_.map((e,t)=>(0,G.jsxs)(C,{flexDirection:`column`,marginBottom:+(t<_.length-1),children:[(0,G.jsx)(C,{children:(0,G.jsxs)(p,{color:T===t?`suggestion`:void 0,children:[T===t?a.pointer:` `,` `,e.name]})}),(0,G.jsx)(C,{marginLeft:2,children:(0,G.jsxs)(p,{dimColor:!0,children:[e.totalPlugins,` `,O(e.totalPlugins,`plugin`),` available`,e.installedCount>0&&` · ${e.installedCount} already installed`,e.source&&` · ${e.source}`]})})]},e.name)),(0,G.jsx)(C,{marginTop:1,children:(0,G.jsx)(p,{dimColor:!0,italic:!0,children:(0,G.jsxs)(g,{children:[(0,G.jsx)(z,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`select`}),(0,G.jsx)(z,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`})]})})})]});if(l===`plugin-details`&&m){let e=m.entry.homepage,t=cr(e,sr(m));return(0,G.jsxs)(C,{flexDirection:`column`,children:[(0,G.jsx)(C,{marginBottom:1,children:(0,G.jsx)(p,{bold:!0,children:`Plugin Details`})}),(0,G.jsxs)(C,{flexDirection:`column`,marginBottom:1,children:[(0,G.jsx)(p,{bold:!0,children:m.entry.name}),m.entry.version&&(0,G.jsxs)(p,{dimColor:!0,children:[`Version: `,m.entry.version]}),m.entry.description&&(0,G.jsx)(C,{marginTop:1,children:(0,G.jsx)(p,{children:m.entry.description})}),m.entry.author&&(0,G.jsx)(C,{marginTop:1,children:(0,G.jsxs)(p,{dimColor:!0,children:[`By:`,` `,typeof m.entry.author==`string`?m.entry.author:m.entry.author.name]})})]}),(0,G.jsxs)(C,{flexDirection:`column`,marginBottom:1,children:[(0,G.jsx)(p,{bold:!0,children:`Will install:`}),m.entry.commands&&(0,G.jsxs)(p,{dimColor:!0,children:[`· Commands:`,` `,Array.isArray(m.entry.commands)?m.entry.commands.join(`, `):Object.keys(m.entry.commands).join(`, `)]}),m.entry.agents&&(0,G.jsxs)(p,{dimColor:!0,children:[`· Agents:`,` `,Array.isArray(m.entry.agents)?m.entry.agents.join(`, `):Object.keys(m.entry.agents).join(`, `)]}),m.entry.hooks&&(0,G.jsxs)(p,{dimColor:!0,children:[`· Hooks: `,Object.keys(m.entry.hooks).join(`, `)]}),m.entry.mcpServers&&(0,G.jsxs)(p,{dimColor:!0,children:[`· MCP Servers:`,` `,Array.isArray(m.entry.mcpServers)?m.entry.mcpServers.join(`, `):typeof m.entry.mcpServers==`object`?Object.keys(m.entry.mcpServers).join(`, `):`configured`]}),!m.entry.commands&&!m.entry.agents&&!m.entry.hooks&&!m.entry.mcpServers&&(0,G.jsx)(G.Fragment,{children:typeof m.entry.source==`object`&&`source`in m.entry.source&&(m.entry.source.source===`github`||m.entry.source.source===`url`||m.entry.source.source===`npm`||m.entry.source.source===`pip`)?(0,G.jsx)(p,{dimColor:!0,children:`· Component summary not available for remote plugin`}):(0,G.jsx)(p,{dimColor:!0,children:`· Components will be discovered at installation`})})]}),(0,G.jsx)(ir,{}),F&&(0,G.jsx)(C,{marginBottom:1,children:(0,G.jsxs)(p,{color:`error`,children:[`Error: `,F]})}),(0,G.jsx)(C,{flexDirection:`column`,children:t.map((e,t)=>(0,G.jsxs)(C,{children:[re===t&&(0,G.jsx)(p,{children:`> `}),re!==t&&(0,G.jsx)(p,{children:` `}),(0,G.jsx)(p,{bold:re===t,children:P&&e.action===`install`?`Installing…`:e.label})]},e.action))}),(0,G.jsx)(C,{marginTop:1,paddingLeft:1,children:(0,G.jsx)(p,{dimColor:!0,children:(0,G.jsxs)(g,{children:[(0,G.jsx)(z,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`select`}),(0,G.jsx)(z,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]})})})]})}if(b.length===0)return(0,G.jsxs)(C,{flexDirection:`column`,children:[(0,G.jsx)(C,{marginBottom:1,children:(0,G.jsx)(p,{bold:!0,children:`Install plugins`})}),(0,G.jsx)(p,{dimColor:!0,children:`No new plugins available to install.`}),(0,G.jsx)(p,{dimColor:!0,children:`All plugins from this marketplace are already installed.`}),(0,G.jsx)(C,{marginLeft:3,children:(0,G.jsx)(p,{dimColor:!0,italic:!0,children:(0,G.jsx)(z,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`})})})]});let de=M.getVisibleItems(b);return(0,G.jsxs)(C,{flexDirection:`column`,children:[(0,G.jsx)(C,{marginBottom:1,children:(0,G.jsx)(p,{bold:!0,children:`Install Plugins`})}),M.scrollPosition.canScrollUp&&(0,G.jsx)(C,{children:(0,G.jsxs)(p,{dimColor:!0,children:[` `,a.arrowUp,` more above`]})}),de.map((t,n)=>{let r=T===M.toActualIndex(n),i=D.has(t.pluginId),o=A.has(t.pluginId);return(0,G.jsxs)(C,{flexDirection:`column`,marginBottom:n===de.length-1&&!e?0:1,children:[(0,G.jsxs)(C,{children:[(0,G.jsxs)(p,{color:r?`suggestion`:void 0,children:[r?a.pointer:` `,` `]}),(0,G.jsxs)(p,{color:t.isInstalled?`success`:void 0,children:[t.isInstalled?a.tick:o?a.ellipsis:i?a.radioOn:a.radioOff,` `,t.entry.name,t.entry.category&&(0,G.jsxs)(p,{dimColor:!0,children:[` [`,t.entry.category,`]`]}),t.entry.tags?.includes(`community-managed`)&&(0,G.jsx)(p,{dimColor:!0,children:` [Community Managed]`}),t.isInstalled&&(0,G.jsx)(p,{dimColor:!0,children:` (installed)`}),ne&&d===`claude-plugins-official`&&(0,G.jsxs)(p,{dimColor:!0,children:[` · `,un(ne.get(t.pluginId)??0),` installs`]})]})]}),t.entry.description&&(0,G.jsxs)(C,{marginLeft:4,children:[(0,G.jsx)(p,{dimColor:!0,children:Se(t.entry.description,60)}),t.entry.version&&(0,G.jsxs)(p,{dimColor:!0,children:[` · v`,t.entry.version]})]})]},t.pluginId)}),M.scrollPosition.canScrollDown&&(0,G.jsx)(C,{children:(0,G.jsxs)(p,{dimColor:!0,children:[` `,a.arrowDown,` more below`]})}),e&&(0,G.jsx)(C,{marginTop:1,children:(0,G.jsxs)(p,{color:`error`,children:[a.cross,` `,e]})}),(0,G.jsx)(lr,{hasSelection:D.size>0})]})}var _r,vr,G,yr=e((()=>{i(),_r=t(l(),1),vr=t(l(),1),Mt(),x(),Kt(),xe(),Gt(),de(),L(),Pt(),sn(),Me(),lt(),rt(),Ue(),Ft(),Ct(),M(),Ce(),rr(),or(),dr(),hr(),G=w()}));function br({error:e,setError:t,result:n,setResult:r,setViewState:i,onInstallComplete:o,onSearchModeChange:c,targetPlugin:l}){let[u,m]=(0,K.useState)(`plugin-list`),[h,_]=(0,K.useState)(null),[y,b]=(0,K.useState)([]),[x,ee]=(0,K.useState)(!0),[S,w]=(0,K.useState)(null),[T,E]=(0,K.useState)(!1),D=(0,K.useCallback)(e=>{E(e),c?.(e)},[c]),{query:k,setQuery:A,cursorOffset:j}=xn({isActive:u===`plugin-list`&&T&&!x,onExit:()=>{D(!1)}}),M=d(),{columns:re}=s(),N=(0,K.useMemo)(()=>{if(!k)return y;let e=k.toLowerCase();return y.filter(t=>t.entry.name.toLowerCase().includes(e)||t.entry.description?.toLowerCase().includes(e)||t.marketplaceName.toLowerCase().includes(e))},[y,k]),[P,ie]=(0,K.useState)(0),[F,ae]=(0,K.useState)(new Set),[oe,se]=(0,K.useState)(new Set),I=fr({totalItems:N.length,selectedIndex:P});(0,K.useEffect)(()=>{ie(0)},[k]);let[le,L]=(0,K.useState)(0),[de,fe]=(0,K.useState)(!1),[pe,me]=(0,K.useState)(null),[he,ge]=(0,K.useState)(null),[_e,ve]=(0,K.useState)(null);(0,K.useEffect)(()=>{async function e(){try{let e=await Ie(),{marketplaces:n,failures:r}=await jt(e),i=[];for(let{name:e,data:t}of n)if(t)for(let n of t.plugins){let t=Te(n.name,e);i.push({entry:n,marketplaceName:e,pluginId:t,isInstalled:gt(t)})}let a=i.filter(e=>!e.isInstalled&&!At(e.pluginId));try{let e=await dn();w(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){ue(`Failed to fetch install counts: ${ce(e)}`),a.sort((e,t)=>e.entry.name.localeCompare(t.entry.name))}b(a);let o=Object.keys(e).length;a.length===0&&ve(await dt({configuredMarketplaceCount:o,failedMarketplaceCount:r.length}));let s=St(r,be(n,e=>e.data!==null));if(s)if(s.type===`warning`)ge(s.message+`. Showing available plugins.`);else throw Error(s.message);if(l){let e=i.find(e=>e.entry.name===l);e?e.isInstalled?t(`Plugin '${e.pluginId}' is already installed. Use '/plugin' to manage existing plugins.`):(_(e),m(`plugin-details`)):t(`Plugin "${l}" not found in any marketplace`)}}catch(e){t(e instanceof Error?e.message:`Failed to load plugins`)}finally{ee(!1)}}e()},[t,l]);let ye=async()=>{if(F.size===0)return;let e=y.filter(e=>F.has(e.pluginId));se(new Set(e.map(e=>e.pluginId)));let n=0,a=0,s=[];for(let t of e){let e=await It({pluginId:t.pluginId,entry:t.entry,marketplaceName:t.marketplaceName,scope:`user`});e.success?n++:(a++,s.push({name:t.entry.name,reason:e.error}))}se(new Set),ae(new Set),yt(),a===0?r(`✓ Installed ${n} ${O(n,`plugin`)}. Run /reload-plugins to activate.`):n===0?t(`Failed to install: ${Nt(s,!0)}`):r(`✓ Installed ${n} of ${n+a} plugins. Failed: ${Nt(s,!1)}. Run /reload-plugins to activate successfully installed plugins.`),n>0&&o&&await o(),i({type:`menu`})},xe=async(e,t=`user`)=>{fe(!0),me(null);let n=await It({pluginId:e.pluginId,entry:e.entry,marketplaceName:e.marketplaceName,scope:t});if(n.success){let t=await $n(e.pluginId);if(t){fe(!1),m({type:`plugin-options`,plugin:t,pluginId:e.pluginId});return}r(n.message),o&&await o(),i({type:`menu`})}else fe(!1),me(n.error)};(0,K.useEffect)(()=>{e&&r(e)},[e,r]),te(`confirm:no`,()=>{m(`plugin-list`),_(null)},{context:`Confirmation`,isActive:u===`plugin-details`}),te(`confirm:no`,()=>{i({type:`menu`})},{context:`Confirmation`,isActive:u===`plugin-list`&&!T}),ne((e,t)=>{let n=!t.ctrl&&!t.meta;T||(e===`/`&&n?(D(!0),A(``)):n&&e.length>0&&!/^\s+$/.test(e)&&e!==`j`&&e!==`k`&&e!==`i`&&(D(!0),A(e)))},{isActive:u===`plugin-list`&&!x}),v({"select:previous":()=>{P===0?D(!0):I.handleSelectionChange(P-1,ie)},"select:next":()=>{P<N.length-1&&I.handleSelectionChange(P+1,ie)},"select:accept":()=>{if(P===N.length&&F.size>0)ye();else if(P<N.length){let e=N[P];e&&(e.isInstalled?i({type:`manage-plugins`,targetPlugin:e.entry.name,targetMarketplace:e.marketplaceName}):(_(e),m(`plugin-details`),L(0),me(null)))}}},{context:`Select`,isActive:u===`plugin-list`&&!T}),v({"plugin:toggle":()=>{if(P<N.length){let e=N[P];if(e&&!e.isInstalled){let t=new Set(F);t.has(e.pluginId)?t.delete(e.pluginId):t.add(e.pluginId),ae(t)}}},"plugin:install":()=>{F.size>0&&ye()}},{context:`Plugin`,isActive:u===`plugin-list`&&!T});let Ce=Cr.useMemo(()=>{if(!h)return[];let e=h.entry.homepage;return cr(e,sr(h))},[h]);if(v({"select:previous":()=>{le>0&&L(le-1)},"select:next":()=>{le<Ce.length-1&&L(le+1)},"select:accept":()=>{if(!h)return;let e=Ce[le]?.action,t=h.entry.homepage,n=sr(h);e===`install-user`?xe(h,`user`):e===`install-project`?xe(h,`project`):e===`install-local`?xe(h,`local`):e===`homepage`&&t?Wt(t):e===`github`&&n?Wt(`https://github.com/${n}`):e===`back`&&(m(`plugin-list`),_(null))}},{context:`Select`,isActive:u===`plugin-details`&&!!h}),typeof u==`object`&&u.type===`plugin-options`){let{plugin:e,pluginId:t}=u;function n(e){r(e),o&&o(),i({type:`menu`})}return(0,q.jsx)(er,{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(x)return(0,q.jsx)(p,{children:`Loading…`});if(e)return(0,q.jsx)(p,{color:`error`,children:e});if(u===`plugin-details`&&h){let e=h.entry.homepage,t=cr(e,sr(h));return(0,q.jsxs)(C,{flexDirection:`column`,children:[(0,q.jsx)(C,{marginBottom:1,children:(0,q.jsx)(p,{bold:!0,children:`Plugin details`})}),(0,q.jsxs)(C,{flexDirection:`column`,marginBottom:1,children:[(0,q.jsx)(p,{bold:!0,children:h.entry.name}),(0,q.jsxs)(p,{dimColor:!0,children:[`from `,h.marketplaceName]}),h.entry.version&&(0,q.jsxs)(p,{dimColor:!0,children:[`Version: `,h.entry.version]}),h.entry.description&&(0,q.jsx)(C,{marginTop:1,children:(0,q.jsx)(p,{children:h.entry.description})}),h.entry.author&&(0,q.jsx)(C,{marginTop:1,children:(0,q.jsxs)(p,{dimColor:!0,children:[`By:`,` `,typeof h.entry.author==`string`?h.entry.author:h.entry.author.name]})})]}),(0,q.jsx)(ir,{}),pe&&(0,q.jsx)(C,{marginBottom:1,children:(0,q.jsxs)(p,{color:`error`,children:[`Error: `,pe]})}),(0,q.jsx)(C,{flexDirection:`column`,children:t.map((e,t)=>(0,q.jsxs)(C,{children:[le===t&&(0,q.jsx)(p,{children:`> `}),le!==t&&(0,q.jsx)(p,{children:` `}),(0,q.jsx)(p,{bold:le===t,children:de&&e.action.startsWith(`install-`)?`Installing…`:e.label})]},e.action))}),(0,q.jsx)(C,{marginTop:1,children:(0,q.jsx)(p,{dimColor:!0,children:(0,q.jsxs)(g,{children:[(0,q.jsx)(z,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`select`}),(0,q.jsx)(z,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]})})})]})}if(y.length===0)return(0,q.jsxs)(C,{flexDirection:`column`,children:[(0,q.jsx)(C,{marginBottom:1,children:(0,q.jsx)(p,{bold:!0,children:`Discover plugins`})}),(0,q.jsx)(Sr,{reason:_e}),(0,q.jsx)(C,{marginTop:1,children:(0,q.jsx)(p,{dimColor:!0,italic:!0,children:`Esc to go back`})})]});let we=I.getVisibleItems(N);return(0,q.jsxs)(C,{flexDirection:`column`,children:[(0,q.jsxs)(C,{children:[(0,q.jsx)(p,{bold:!0,children:`Discover plugins`}),I.needsPagination&&(0,q.jsxs)(p,{dimColor:!0,children:[` `,`(`,I.scrollPosition.current,`/`,I.scrollPosition.total,`)`]})]}),(0,q.jsx)(C,{marginBottom:1,children:(0,q.jsx)(f,{query:k,isFocused:T,isTerminalFocused:M,width:re-4,cursorOffset:j})}),he&&(0,q.jsx)(C,{marginBottom:1,children:(0,q.jsxs)(p,{color:`warning`,children:[a.warning,` `,he]})}),N.length===0&&k&&(0,q.jsx)(C,{marginBottom:1,children:(0,q.jsxs)(p,{dimColor:!0,children:[`No plugins match "`,k,`"`]})}),I.scrollPosition.canScrollUp&&(0,q.jsx)(C,{children:(0,q.jsxs)(p,{dimColor:!0,children:[` `,a.arrowUp,` more above`]})}),we.map((t,n)=>{let r=P===I.toActualIndex(n),i=F.has(t.pluginId),o=oe.has(t.pluginId);return(0,q.jsxs)(C,{flexDirection:`column`,marginBottom:n===we.length-1&&!e?0:1,children:[(0,q.jsxs)(C,{children:[(0,q.jsxs)(p,{color:r&&!T?`suggestion`:void 0,children:[r&&!T?a.pointer:` `,` `]}),(0,q.jsxs)(p,{children:[o?a.ellipsis:i?a.radioOn:a.radioOff,` `,t.entry.name,(0,q.jsxs)(p,{dimColor:!0,children:[` · `,t.marketplaceName]}),t.entry.tags?.includes(`community-managed`)&&(0,q.jsx)(p,{dimColor:!0,children:` [Community Managed]`}),S&&t.marketplaceName===`claude-plugins-official`&&(0,q.jsxs)(p,{dimColor:!0,children:[` · `,un(S.get(t.pluginId)??0),` installs`]})]})]}),t.entry.description&&(0,q.jsx)(C,{marginLeft:4,children:(0,q.jsx)(p,{dimColor:!0,children:Se(t.entry.description,60)})})]},`${I.startIndex}-${t.pluginId}`)}),I.scrollPosition.canScrollDown&&(0,q.jsx)(C,{children:(0,q.jsxs)(p,{dimColor:!0,children:[` `,a.arrowDown,` more below`]})}),e&&(0,q.jsx)(C,{marginTop:1,children:(0,q.jsxs)(p,{color:`error`,children:[a.cross,` `,e]})}),(0,q.jsx)(xr,{hasSelection:F.size>0,canToggle:P<N.length&&!N[P]?.isInstalled})]})}function xr({hasSelection:e,canToggle:t}){return(0,q.jsx)(C,{marginTop:1,children:(0,q.jsx)(p,{dimColor:!0,italic:!0,children:(0,q.jsxs)(g,{children:[e&&(0,q.jsx)(z,{action:`plugin:install`,context:`Plugin`,fallback:`i`,description:`install`,bold:!0}),(0,q.jsx)(p,{children:`type to search`}),t&&(0,q.jsx)(z,{action:`plugin:toggle`,context:`Plugin`,fallback:`Space`,description:`toggle`}),(0,q.jsx)(z,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`details`}),(0,q.jsx)(z,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]})})})}function Sr({reason:e}){switch(e){case`git-not-installed`:return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(p,{dimColor:!0,children:`Git is required to install marketplaces.`}),(0,q.jsx)(p,{dimColor:!0,children:`Please install git and restart Claude Code.`})]});case`all-blocked-by-policy`:return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(p,{dimColor:!0,children:`Your organization policy does not allow any external marketplaces.`}),(0,q.jsx)(p,{dimColor:!0,children:`Contact your administrator.`})]});case`policy-restricts-sources`:return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(p,{dimColor:!0,children:`Your organization restricts which marketplaces can be added.`}),(0,q.jsx)(p,{dimColor:!0,children:`Switch to the Marketplaces tab to view allowed sources.`})]});case`all-marketplaces-failed`:return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(p,{dimColor:!0,children:`Failed to load marketplace data.`}),(0,q.jsx)(p,{dimColor:!0,children:`Check your network connection.`})]});case`all-plugins-installed`:return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(p,{dimColor:!0,children:`All available plugins are already installed.`}),(0,q.jsx)(p,{dimColor:!0,children:`Check for new plugins later or add more marketplaces.`})]});default:return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(p,{dimColor:!0,children:`No plugins available.`}),(0,q.jsx)(p,{dimColor:!0,children:`Add a marketplace first using the Marketplaces tab.`})]})}}var Cr,K,q,wr=e((()=>{i(),Cr=t(l(),1),K=t(l(),1),Mt(),bn(),x(),Sn(),nt(),Kt(),xe(),Gt(),de(),L(),Pt(),sn(),Me(),lt(),rt(),Ue(),Ft(),Ct(),M(),Ce(),rr(),or(),dr(),hr(),q=w()}));function Tr({setViewState:e,error:t,setError:n,setResult:r,exitState:i,onManageComplete:o,targetMarketplace:s,action:c}){let[l,u]=(0,Dr.useState)([]),[d,f]=(0,Dr.useState)(!0),[m,h]=(0,Dr.useState)(0),[_,y]=(0,Dr.useState)(!1),[b,x]=(0,Dr.useState)(null),[ee,S]=(0,Dr.useState)(null),[w,T]=(0,Dr.useState)(null),[E,A]=(0,Dr.useState)(`list`),[j,M]=(0,Dr.useState)(null),[N,P]=(0,Dr.useState)(0),ie=(0,Dr.useRef)(!1);(0,Dr.useEffect)(()=>{async function e(){try{let e=await Ie(),{enabled:r,disabled:i}=await Et(),a=[...r,...i],{marketplaces:o,failures:l}=await jt(e),d=[];for(let{name:e,config:t,data:n}of o){let r=a.filter(t=>t.source.endsWith(`@${e}`));d.push({name:e,source:kt(t.source),lastUpdated:t.lastUpdated,pluginCount:n?.plugins.length,installedPlugins:r,pendingUpdate:!1,pendingRemove:!1,autoUpdate:oe(e,t)})}d.sort((e,t)=>e.name===`claude-plugin-directory`?-1:t.name===`claude-plugin-directory`?1:e.name.localeCompare(t.name)),u(d);let f=St(l,be(o,e=>e.data!==null));if(f)if(f.type===`warning`)x(f.message);else throw Error(f.message);if(s&&!ie.current&&!t){ie.current=!0;let e=d.findIndex(e=>e.name===s);if(e>=0){let t=d[e];if(c){h(e+1);let t=[...d];c===`update`?t[e].pendingUpdate=!0:c===`remove`&&(t[e].pendingRemove=!0),u(t),setTimeout(se,100,t)}else t&&(h(e+1),M(t),A(`details`))}else n&&n(`Marketplace not found: ${s}`)}}catch(e){n&&n(e instanceof Error?e.message:`Failed to load marketplaces`),x(e instanceof Error?e.message:`Failed to load marketplaces`)}finally{f(!1)}}e()},[s,c,t]);let F=()=>l.some(e=>e.pendingUpdate||e.pendingRemove),ae=()=>({updateCount:be(l,e=>e.pendingUpdate),removeCount:be(l,e=>e.pendingRemove)}),se=async t=>{let i=t||l,s=E===`details`;y(!0),x(null),S(null),T(null);try{let t=k(`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=Te(t.name,e.name);n[r]=!1}re(`userSettings`,{enabledPlugins:n})}await Ot(e.name),c++,me(`tengu_marketplace_removed`,{marketplace_name:e.name,plugins_uninstalled:e.installedPlugins?.length||0});continue}e.pendingUpdate&&(await Fe(e.name,e=>{T(e)}),n++,l.add(e.name.toLowerCase()),me(`tengu_marketplace_updated`,{marketplace_name:e.name}))}let d=0;l.size>0&&(d=(await Cn(l)).length),yt(),o&&await o();let f=await Ie(),{enabled:p,disabled:m}=await Et(),h=[...p,...m],{marketplaces:g}=await jt(f),_=[];for(let{name:e,config:t,data:n}of g){let r=h.filter(t=>t.source.endsWith(`@${e}`));_.push({name:e,source:kt(t.source),lastUpdated:t.lastUpdated,pluginCount:n?.plugins.length,installedPlugins:r,pendingUpdate:!1,pendingRemove:!1,autoUpdate:oe(e,t)})}if(_.sort((e,t)=>e.name===`claude-plugin-directory`?-1:t.name===`claude-plugin-directory`?1:e.name.localeCompare(t.name)),u(_),s&&j){let e=_.find(e=>e.name===j.name);e&&M(e)}let v=[];if(n>0){let e=d>0?` (${d} ${O(d,`plugin`)} bumped)`:``;v.push(`Updated ${n} ${O(n,`marketplace`)}${e}`)}if(c>0&&v.push(`Removed ${c} ${O(c,`marketplace`)}`),v.length>0){let t=`${a.tick} ${v.join(`, `)}`;s?S(t):(r(t),setTimeout(e,2e3,{type:`menu`}))}else s||e({type:`menu`})}catch(e){let t=ce(e);x(t),n&&n(t)}finally{y(!1),T(null)}},I=async()=>{if(!j)return;let e=l.map(e=>e.name===j.name?{...e,pendingRemove:!0}:e);u(e),await se(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 D()||t.push({label:e.autoUpdate?`Disable auto-update`:`Enable auto-update`,value:`toggle-auto-update`}),t.push({label:`Remove marketplace`,value:`remove`}),t},L=async e=>{let t=!e.autoUpdate;try{await ot(e.name,t),u(n=>n.map(n=>n.name===e.name?{...n,autoUpdate:t}:n)),M(e=>e&&{...e,autoUpdate:t})}catch(e){x(e instanceof Error?e.message:`Failed to update setting`)}};if(te(`confirm:no`,()=>{A(`list`),P(0)},{context:`Confirmation`,isActive:!_&&(E===`details`||E===`confirm-remove`)}),te(`confirm:no`,()=>{u(e=>e.map(e=>({...e,pendingUpdate:!1,pendingRemove:!1}))),h(0)},{context:`Confirmation`,isActive:!_&&E===`list`&&F()}),te(`confirm:no`,()=>{e({type:`menu`})},{context:`Confirmation`,isActive:!_&&E===`list`&&!F()}),v({"select:previous":()=>h(e=>Math.max(0,e-1)),"select:next":()=>{let e=l.length+1;h(t=>Math.min(e-1,t+1))},"select:accept":()=>{let t=m-1;if(m===0)e({type:`add-marketplace`});else if(F())se();else{let e=l[t];e&&(M(e),A(`details`),P(0))}}},{context:`Select`,isActive:!_&&E===`list`}),ne(e=>{let t=m-1;if((e===`u`||e===`U`)&&t>=0)u(e=>e.map((e,n)=>n===t?{...e,pendingUpdate:!e.pendingUpdate,pendingRemove:e.pendingUpdate?e.pendingRemove:!1}:e));else if((e===`r`||e===`R`)&&t>=0){let e=l[t];e&&(M(e),A(`confirm-remove`))}},{isActive:!_&&E===`list`}),v({"select:previous":()=>P(e=>Math.max(0,e-1)),"select:next":()=>{let e=le(j);P(t=>Math.min(e.length-1,t+1))},"select:accept":()=>{if(!j)return;let t=le(j)[N];if(t?.value===`browse`)e({type:`browse-marketplace`,targetMarketplace:j.name});else if(t?.value===`update`){let e=l.map(e=>e.name===j.name?{...e,pendingUpdate:!0}:e);u(e),se(e)}else t?.value===`toggle-auto-update`?L(j):t?.value===`remove`&&A(`confirm-remove`)}},{context:`Select`,isActive:!_&&E===`details`}),ne(e=>{e===`y`||e===`Y`?I():(e===`n`||e===`N`)&&(A(`list`),M(null))},{isActive:!_&&E===`confirm-remove`}),d)return(0,J.jsx)(p,{children:`Loading marketplaces…`});if(l.length===0)return(0,J.jsxs)(C,{flexDirection:`column`,children:[(0,J.jsx)(C,{marginBottom:1,children:(0,J.jsx)(p,{bold:!0,children:`Manage marketplaces`})}),(0,J.jsxs)(C,{flexDirection:`row`,gap:1,children:[(0,J.jsxs)(p,{color:`suggestion`,children:[a.pointer,` +`]}),(0,J.jsx)(p,{bold:!0,color:`suggestion`,children:`Add Marketplace`})]}),(0,J.jsx)(C,{marginLeft:3,children:(0,J.jsx)(p,{dimColor:!0,italic:!0,children:i.pending?(0,J.jsxs)(J.Fragment,{children:[`Press `,i.keyName,` again to go back`]}):(0,J.jsxs)(g,{children:[(0,J.jsx)(z,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`select`}),(0,J.jsx)(z,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`})]})})})]});if(E===`confirm-remove`&&j){let e=j.installedPlugins?.length||0;return(0,J.jsxs)(C,{flexDirection:`column`,children:[(0,J.jsxs)(p,{bold:!0,color:`warning`,children:[`Remove marketplace `,(0,J.jsx)(p,{italic:!0,children:j.name}),`?`]}),(0,J.jsxs)(C,{flexDirection:`column`,children:[e>0&&(0,J.jsx)(C,{marginTop:1,children:(0,J.jsxs)(p,{color:`warning`,children:[`This will also uninstall `,e,` `,O(e,`plugin`),` from this marketplace:`]})}),j.installedPlugins&&j.installedPlugins.length>0&&(0,J.jsx)(C,{flexDirection:`column`,marginTop:1,marginLeft:2,children:j.installedPlugins.map(e=>(0,J.jsxs)(p,{dimColor:!0,children:[`• `,e.name]},e.name))}),(0,J.jsx)(C,{marginTop:1,children:(0,J.jsxs)(p,{children:[`Press `,(0,J.jsx)(p,{bold:!0,children:`y`}),` to confirm or `,(0,J.jsx)(p,{bold:!0,children:`n`}),` to cancel`]})})]})]})}if(E===`details`&&j){let e=j.pendingUpdate||_,t=le(j);return(0,J.jsxs)(C,{flexDirection:`column`,children:[(0,J.jsx)(p,{bold:!0,children:j.name}),(0,J.jsx)(p,{dimColor:!0,children:j.source}),(0,J.jsx)(C,{marginTop:1,children:(0,J.jsxs)(p,{children:[j.pluginCount||0,` available `,O(j.pluginCount||0,`plugin`)]})}),j.installedPlugins&&j.installedPlugins.length>0&&(0,J.jsxs)(C,{flexDirection:`column`,marginTop:1,children:[(0,J.jsxs)(p,{bold:!0,children:[`Installed plugins (`,j.installedPlugins.length,`):`]}),(0,J.jsx)(C,{flexDirection:`column`,marginLeft:1,children:j.installedPlugins.map(e=>(0,J.jsxs)(C,{flexDirection:`row`,gap:1,children:[(0,J.jsx)(p,{children:a.bullet}),(0,J.jsxs)(C,{flexDirection:`column`,children:[(0,J.jsx)(p,{children:e.name}),(0,J.jsx)(p,{dimColor:!0,children:e.manifest.description})]})]},e.name))})]}),e&&(0,J.jsxs)(C,{marginTop:1,flexDirection:`column`,children:[(0,J.jsx)(p,{color:`claude`,children:`Updating marketplace…`}),w&&(0,J.jsx)(p,{dimColor:!0,children:w})]}),!e&&ee&&(0,J.jsx)(C,{marginTop:1,children:(0,J.jsx)(p,{color:`claude`,children:ee})}),!e&&b&&(0,J.jsx)(C,{marginTop:1,children:(0,J.jsx)(p,{color:`error`,children:b})}),!e&&(0,J.jsx)(C,{flexDirection:`column`,marginTop:1,children:t.map((e,t)=>{if(!e)return null;let n=t===N;return(0,J.jsxs)(C,{children:[(0,J.jsxs)(p,{color:n?`suggestion`:void 0,children:[n?a.pointer:` `,` `,e.label]}),e.secondaryLabel&&(0,J.jsxs)(p,{dimColor:!0,children:[` `,e.secondaryLabel]})]},e.value)})}),!e&&!D()&&j.autoUpdate&&(0,J.jsx)(C,{marginTop:1,children:(0,J.jsx)(p,{dimColor:!0,children:`Auto-update enabled. Claude Code will automatically update this marketplace and its installed plugins.`})}),(0,J.jsx)(C,{marginLeft:3,children:(0,J.jsx)(p,{dimColor:!0,italic:!0,children:e?(0,J.jsx)(J.Fragment,{children:`Please wait…`}):(0,J.jsxs)(g,{children:[(0,J.jsx)(z,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`select`}),(0,J.jsx)(z,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`})]})})})]})}let{updateCount:ue,removeCount:de}=ae();return(0,J.jsxs)(C,{flexDirection:`column`,children:[(0,J.jsx)(C,{marginBottom:1,children:(0,J.jsx)(p,{bold:!0,children:`Manage marketplaces`})}),(0,J.jsxs)(C,{flexDirection:`row`,gap:1,marginBottom:1,children:[(0,J.jsxs)(p,{color:m===0?`suggestion`:void 0,children:[m===0?a.pointer:` `,` +`]}),(0,J.jsx)(p,{bold:!0,color:m===0?`suggestion`:void 0,children:`Add Marketplace`})]}),(0,J.jsx)(C,{flexDirection:`column`,children:l.map((e,t)=>{let n=t+1===m,r=[];return e.pendingUpdate&&r.push(`UPDATE`),e.pendingRemove&&r.push(`REMOVE`),(0,J.jsxs)(C,{flexDirection:`row`,gap:1,marginBottom:1,children:[(0,J.jsxs)(p,{color:n?`suggestion`:void 0,children:[n?a.pointer:` `,` `,e.pendingRemove?a.cross:a.bullet]}),(0,J.jsxs)(C,{flexDirection:`column`,flexGrow:1,children:[(0,J.jsxs)(C,{flexDirection:`row`,gap:1,children:[(0,J.jsxs)(p,{bold:!0,strikethrough:e.pendingRemove,dimColor:e.pendingRemove,children:[e.name===`claude-plugins-official`&&(0,J.jsx)(p,{color:`claude`,children:`✻ `}),e.name,e.name===`claude-plugins-official`&&(0,J.jsx)(p,{color:`claude`,children:` ✻`})]}),r.length>0&&(0,J.jsxs)(p,{color:`warning`,children:[`[`,r.join(`, `),`]`]})]}),(0,J.jsx)(p,{dimColor:!0,children:e.source}),(0,J.jsxs)(p,{dimColor:!0,children:[e.pluginCount!==void 0&&(0,J.jsxs)(J.Fragment,{children:[e.pluginCount,` available`]}),e.installedPlugins&&e.installedPlugins.length>0&&(0,J.jsxs)(J.Fragment,{children:[` • `,e.installedPlugins.length,` installed`]}),e.lastUpdated&&(0,J.jsxs)(J.Fragment,{children:[` • Updated `,new Date(e.lastUpdated).toLocaleDateString()]})]})]})]},e.name)})}),F()&&(0,J.jsxs)(C,{marginTop:1,flexDirection:`column`,children:[(0,J.jsxs)(p,{children:[(0,J.jsx)(p,{bold:!0,children:`Pending changes:`}),` `,(0,J.jsx)(p,{dimColor:!0,children:`Enter to apply`})]}),ue>0&&(0,J.jsxs)(p,{children:[`• Update `,ue,` `,O(ue,`marketplace`)]}),de>0&&(0,J.jsxs)(p,{color:`warning`,children:[`• Remove `,de,` `,O(de,`marketplace`)]})]}),_&&(0,J.jsx)(C,{marginTop:1,children:(0,J.jsx)(p,{color:`claude`,children:`Processing changes…`})}),b&&(0,J.jsx)(C,{marginTop:1,children:(0,J.jsx)(p,{color:`error`,children:b})}),(0,J.jsx)(Er,{exitState:i,hasPendingActions:F()})]})}function Er({exitState:e,hasPendingActions:t}){return e.pending?(0,J.jsx)(C,{marginTop:1,children:(0,J.jsxs)(p,{dimColor:!0,italic:!0,children:[`Press `,e.keyName,` again to go back`]})}):(0,J.jsx)(C,{marginTop:1,children:(0,J.jsx)(p,{dimColor:!0,italic:!0,children:(0,J.jsxs)(g,{children:[t&&(0,J.jsx)(z,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`apply changes`}),!t&&(0,J.jsx)(z,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`select`}),!t&&(0,J.jsx)(h,{shortcut:`u`,action:`update`}),!t&&(0,J.jsx)(h,{shortcut:`r`,action:`remove`}),(0,J.jsx)(z,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:t?`cancel`:`go back`})]})})})}var Dr,J,Or=e((()=>{i(),l(),Dr=t(l(),1),pe(),Mt(),x(),Kt(),xe(),T(),L(),Pt(),lt(),rt(),wn(),ft(),se(),F(),M(),J=w()}));function kr(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 Lt(e)}function Ar(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 jr=e((()=>{Oe()}));function Mr({item:e,isSelected:t}){let[n]=u();if(e.type===`plugin`){let r,i;return e.pendingToggle?(r=S(`suggestion`,n)(a.arrowRight),i=e.pendingToggle===`will-enable`?`will enable`:`will disable`):e.errorCount>0?(r=S(`error`,n)(a.cross),i=`${e.errorCount} ${O(e.errorCount,`error`)}`):e.isEnabled?(r=S(`success`,n)(a.tick),i=`enabled`):(r=S(`inactive`,n)(a.radioOff),i=`disabled`),(0,Y.jsxs)(C,{children:[(0,Y.jsx)(p,{color:t?`suggestion`:void 0,children:t?`${a.pointer} `:` `}),(0,Y.jsx)(p,{color:t?`suggestion`:void 0,children:e.name}),(0,Y.jsxs)(p,{dimColor:!t,children:[` `,(0,Y.jsx)(p,{backgroundColor:`userMessageBackground`,children:`Plugin`})]}),(0,Y.jsxs)(p,{dimColor:!0,children:[` · `,e.marketplace]}),(0,Y.jsxs)(p,{dimColor:!t,children:[` · `,r,` `]}),(0,Y.jsx)(p,{dimColor:!t,children:i})]})}if(e.type===`flagged-plugin`){let r=S(`warning`,n)(a.warning);return(0,Y.jsxs)(C,{children:[(0,Y.jsx)(p,{color:t?`suggestion`:void 0,children:t?`${a.pointer} `:` `}),(0,Y.jsx)(p,{color:t?`suggestion`:void 0,children:e.name}),(0,Y.jsxs)(p,{dimColor:!t,children:[` `,(0,Y.jsx)(p,{backgroundColor:`userMessageBackground`,children:`Plugin`})]}),(0,Y.jsxs)(p,{dimColor:!0,children:[` · `,e.marketplace]}),(0,Y.jsxs)(p,{dimColor:!t,children:[` · `,r,` `]}),(0,Y.jsx)(p,{dimColor:!t,children:`removed`})]})}if(e.type===`failed-plugin`){let r=S(`error`,n)(a.cross),i=`failed to load · ${e.errorCount} ${O(e.errorCount,`error`)}`;return(0,Y.jsxs)(C,{children:[(0,Y.jsx)(p,{color:t?`suggestion`:void 0,children:t?`${a.pointer} `:` `}),(0,Y.jsx)(p,{color:t?`suggestion`:void 0,children:e.name}),(0,Y.jsxs)(p,{dimColor:!t,children:[` `,(0,Y.jsx)(p,{backgroundColor:`userMessageBackground`,children:`Plugin`})]}),(0,Y.jsxs)(p,{dimColor:!0,children:[` · `,e.marketplace]}),(0,Y.jsxs)(p,{dimColor:!t,children:[` · `,r,` `]}),(0,Y.jsx)(p,{dimColor:!t,children:i})]})}let r,i;return e.status===`connected`?(r=S(`success`,n)(a.tick),i=`connected`):e.status===`disabled`?(r=S(`inactive`,n)(a.radioOff),i=`disabled`):e.status===`pending`?(r=S(`inactive`,n)(a.radioOff),i=`connecting…`):e.status===`needs-auth`?(r=S(`warning`,n)(a.triangleUpOutline),i=`Enter to auth`):(r=S(`error`,n)(a.cross),i=`failed`),e.indented?(0,Y.jsxs)(C,{children:[(0,Y.jsx)(p,{color:t?`suggestion`:void 0,children:t?`${a.pointer} `:` `}),(0,Y.jsx)(p,{dimColor:!t,children:`└ `}),(0,Y.jsx)(p,{color:t?`suggestion`:void 0,children:e.name}),(0,Y.jsxs)(p,{dimColor:!t,children:[` `,(0,Y.jsx)(p,{backgroundColor:`userMessageBackground`,children:`MCP`})]}),(0,Y.jsxs)(p,{dimColor:!t,children:[` · `,r,` `]}),(0,Y.jsx)(p,{dimColor:!t,children:i})]}):(0,Y.jsxs)(C,{children:[(0,Y.jsx)(p,{color:t?`suggestion`:void 0,children:t?`${a.pointer} `:` `}),(0,Y.jsx)(p,{color:t?`suggestion`:void 0,children:e.name}),(0,Y.jsxs)(p,{dimColor:!t,children:[` `,(0,Y.jsx)(p,{backgroundColor:`userMessageBackground`,children:`MCP`})]}),(0,Y.jsxs)(p,{dimColor:!t,children:[` · `,r,` `]}),(0,Y.jsx)(p,{dimColor:!t,children:i})]})}var Y,Nr=e((()=>{i(),l(),x(),M(),Y=w()}));async function Pr(e){try{return(await En.readdir(e,{withFileTypes:!0})).filter(e=>e.isFile()&&e.name.endsWith(`.md`)).map(e=>Tn.basename(e.name,`.md`))}catch(t){return ue(`Failed to read plugin components from ${e}: ${ce(t)}`,{level:`error`}),ye(I(t)),[]}}async function Fr(e){try{let t=await En.readdir(e,{withFileTypes:!0}),n=[];for(let r of t)if(r.isDirectory()||r.isSymbolicLink()){let t=Tn.join(e,r.name,`SKILL.md`);try{(await En.stat(t)).isFile()&&n.push(r.name)}catch{}}return n}catch(t){return ue(`Failed to read skill directories from ${e}: ${ce(t)}`,{level:`error`}),ye(I(t)),[]}}function Ir({plugin:e,marketplace:t}){let[n,r]=(0,X.useState)(null),[i,a]=(0,X.useState)(!0),[o,s]=(0,X.useState)(null);return(0,X.useEffect)(()=>{async function n(){try{if(t===`builtin`){let t=Ut(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 Ze(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 Pr(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 Pr(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 Fr(e);c.push(...t)}let l=[];e.hooksConfig&&l.push(Object.keys(e.hooksConfig)),n.hooks&&l.push(n.hooks);let u=[];e.mcpServers&&u.push(Object.keys(e.mcpServers)),n.mcpServers&&u.push(n.mcpServers),r({commands:i.length>0?i:null,agents:o.length>0?o:null,skills:c.length>0?c:null,hooks:l.length>0?l:null,mcpServers:u.length>0?u:null})}else s(`Plugin ${e.name} not found in marketplace`)}catch(e){s(e instanceof Error?e.message:`Failed to load components`)}finally{a(!1)}}n()},[e.name,e.commandsPath,e.commandsPaths,e.agentsPath,e.agentsPaths,e.skillsPath,e.skillsPaths,e.hooksConfig,e.mcpServers,t]),i?null:o?(0,Z.jsxs)(C,{flexDirection:`column`,marginBottom:1,children:[(0,Z.jsx)(p,{bold:!0,children:`Components:`}),(0,Z.jsxs)(p,{dimColor:!0,children:[`Error: `,o]})]}):!n||!(n.commands||n.agents||n.skills||n.hooks||n.mcpServers)?null:(0,Z.jsxs)(C,{flexDirection:`column`,marginBottom:1,children:[(0,Z.jsx)(p,{bold:!0,children:`Installed components:`}),n.commands?(0,Z.jsxs)(p,{dimColor:!0,children:[`• Commands:`,` `,typeof n.commands==`string`?n.commands:Array.isArray(n.commands)?n.commands.join(`, `):Object.keys(n.commands).join(`, `)]}):null,n.agents?(0,Z.jsxs)(p,{dimColor:!0,children:[`• Agents:`,` `,typeof n.agents==`string`?n.agents:Array.isArray(n.agents)?n.agents.join(`, `):Object.keys(n.agents).join(`, `)]}):null,n.skills?(0,Z.jsxs)(p,{dimColor:!0,children:[`• Skills:`,` `,typeof n.skills==`string`?n.skills:Array.isArray(n.skills)?n.skills.join(`, `):Object.keys(n.skills).join(`, `)]}):null,n.hooks?(0,Z.jsxs)(p,{dimColor:!0,children:[`• Hooks:`,` `,typeof n.hooks==`string`?n.hooks:Array.isArray(n.hooks)?n.hooks.map(String).join(`, `):typeof n.hooks==`object`&&n.hooks!==null?Object.keys(n.hooks).join(`, `):String(n.hooks)]}):null,n.mcpServers?(0,Z.jsxs)(p,{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 Lr(e,t){let n=(await Ze(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 Rr(e){return e.filter(e=>{let t=e.source.split(`@`)[1]||`local`;return!At(`${e.name}@${t}`)})}function zr({setViewState:e,setResult:t,onManageComplete:n,onSearchModeChange:r,targetPlugin:i,targetMarketplace:o,action:c}){let l=Xe(e=>e.mcp.clients),u=Xe(e=>e.mcp.tools),m=Xe(e=>e.plugins.errors),h=mn(),[_,y]=(0,X.useState)(!1),b=(0,X.useCallback)(e=>{y(e),r?.(e)},[r]),x=d(),{columns:ee}=s(),[S,w]=(0,X.useState)(`plugin-list`),{query:T,setQuery:E,cursorOffset:D}=xn({isActive:S===`plugin-list`&&_,onExit:()=>{b(!1)}}),[A,j]=(0,X.useState)(null),[M,N]=(0,X.useState)([]),[ie,F]=(0,X.useState)([]),[ae,oe]=(0,X.useState)(!0),[se,L]=(0,X.useState)(new Map),de=(0,X.useRef)(!1),fe=(0,X.useRef)(void 0),pe=_n();te(`confirm:no`,Br.useCallback(()=>{if(S===`plugin-details`)w(`plugin-list`),j(null),R(null);else if(typeof S==`object`&&S.type===`failed-plugin-details`)w(`plugin-list`),R(null);else if(S===`configuring`)w(`plugin-details`),Ae(null);else if(typeof S==`object`&&(S.type===`plugin-options`||S.type===`configuring-options`))w(`plugin-list`),j(null),t(`Plugin enabled. Configuration skipped — run /reload-plugins to apply.`),n&&n();else if(typeof S==`object`&&S.type===`flagged-detail`)w(`plugin-list`),R(null);else if(typeof S==`object`&&S.type===`mcp-detail`)w(`plugin-list`),R(null);else if(typeof S==`object`&&S.type===`mcp-tools`)w({type:`mcp-detail`,client:S.client});else if(typeof S==`object`&&S.type===`mcp-tool-detail`)w({type:`mcp-tools`,client:S.client});else{if(se.size>0){t(`Run /reload-plugins to apply plugin changes.`);return}e({type:`menu`})}},[S,e,se,t]),{context:`Confirmation`,isActive:(S!==`plugin-list`||!_)&&S!==`confirm-project-uninstall`&&!(typeof S==`object`&&S.type===`confirm-data-cleanup`)});let me=e=>e.type===`connected`?`connected`:e.type===`disabled`?`disabled`:e.type===`pending`?`pending`:e.type===`needs-auth`?`needs-auth`:`failed`,he=(0,X.useMemo)(()=>{let e=P(),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=m.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 m){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=Xt(),s=[];for(let[e,t]of a){if(e in h)continue;let n=Vt(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:me(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:me(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(h)){let n=Vt(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,m,se,h]),ge=(0,X.useMemo)(()=>he.filter(e=>e.type===`flagged-plugin`).map(e=>e.id),[he]);(0,X.useEffect)(()=>{ge.length>0&&pn(ge)},[ge]);let _e=(0,X.useMemo)(()=>{if(!T)return he;let e=T.toLowerCase();return he.filter(t=>t.name.toLowerCase().includes(e)||`description`in t&&t.description?.toLowerCase().includes(e))},[he,T]),[ve,xe]=(0,X.useState)(0),Se=fr({totalItems:_e.length,selectedIndex:ve,maxVisible:8}),[Ce,Te]=(0,X.useState)(0),[Ee,De]=(0,X.useState)(!1),[Oe,R]=(0,X.useState)(null),[ke,Ae]=(0,X.useState)(null),[je,Me]=(0,X.useState)(!1),[Ne,Fe]=(0,X.useState)(!1);(0,X.useEffect)(()=>{if(!A){Fe(!1);return}async function e(){let e=A.plugin.manifest.mcpServers,t=!1;if(e&&(t=typeof e==`string`&&Be(e)||Array.isArray(e)&&e.some(e=>typeof e==`string`&&Be(e))),!t)try{let e=Tn.join(A.plugin.path,`..`),n=Tn.join(e,`.claude-plugin`,`marketplace.json`),r=le(await En.readFile(n,`utf-8`)).plugins?.find(e=>e.name===A.plugin.name);if(r?.mcpServers){let e=r.mcpServers;t=typeof e==`string`&&Be(e)||Array.isArray(e)&&e.some(e=>typeof e==`string`&&Be(e))}}catch(e){ue(`Failed to read raw marketplace.json: ${e}`)}Fe(t)}e()},[A]),(0,X.useEffect)(()=>{async function e(){oe(!0);try{let{enabled:e,disabled:t}=await Et(),n=P(),r=Rr([...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=be(t,t=>{let r=`${t.name}@${e}`;return n?.enabledPlugins?.[r]!==!1}),i=t.length-r;a.push({name:e,installedPlugins:t,enabledCount:r,disabledCount:i})}a.sort((e,t)=>e.name===`claude-plugin-directory`?-1:t.name===`claude-plugin-directory`?1:e.name.localeCompare(t.name)),N(a);let o=[];for(let e of a)for(let t of e.installedPlugins){let n=`${t.name}@${e.name}`,r=t.isBuiltin?`builtin`:nn(n).scope;o.push({plugin:t,marketplace:e.name,scope:r,pendingEnable:void 0,pendingUpdate:!1})}F(o),xe(0)}finally{oe(!1)}}e()},[]),(0,X.useEffect)(()=>{if(!de.current&&i&&M.length>0&&!ae){let{name:e,marketplace:n}=Vt(i),r=o??n,a=r?M.filter(e=>e.name===r):M;for(let t of a){let n=t.installedPlugins.find(t=>t.name===e);if(n){let{scope:e}=nn(`${n.name}@${t.name}`);j({plugin:n,marketplace:t.name,scope:e,pendingEnable:void 0,pendingUpdate:!1}),w(`plugin-details`),fe.current=c,de.current=!0;return}}let s=he.find(t=>t.type===`failed-plugin`&&t.name===e);s&&s.type===`failed-plugin`&&(w({type:`failed-plugin-details`,plugin:{id:s.id,name:s.name,marketplace:s.marketplace,errors:s.errors,scope:s.scope}}),de.current=!0),!de.current&&c&&(de.current=!0,t(`Plugin "${i}" is not installed in this project`))}},[i,o,M,ae,he,c,t]);let Ie=async r=>{if(!A)return;let i=A.scope||`user`,a=i===`builtin`;if(a&&(r===`update`||r===`uninstall`)){R(`Built-in plugins cannot be updated or uninstalled.`);return}if(!a&&!tn(i)&&r!==`update`){R(`This plugin is managed by your organization. Contact your admin to disable it.`);return}De(!0),R(null);try{let o=`${A.plugin.name}@${A.marketplace}`,s;switch(r){case`enable`:{let e=await Zt(o);if(!e.success)throw Error(e.message);break}case`disable`:{let e=await en(o);if(!e.success)throw Error(e.message);s=e.reverseDependents;break}case`uninstall`:{if(a||!tn(i))break;if(an(o)){De(!1),w(`confirm-project-uninstall`);return}let e=Ve().plugins[o],t=!e||e.length<=1?await xt(o):null;if(t){De(!1),w({type:`confirm-data-cleanup`,size:t});return}let n=await Qt(o,i);if(!n.success)throw Error(n.message);s=n.reverseDependents;break}case`update`:{if(a)break;let r=await $t(o,i);if(!r.success)throw Error(r.message);if(r.alreadyUpToDate){t(`${A.plugin.name} is already at the latest version (${r.newVersion}).`),n&&await n(),e({type:`menu`});return}break}}yt();let c=`${A.plugin.name}@${A.marketplace}`;if(P()?.enabledPlugins?.[c]!==!1){De(!1),w({type:`plugin-options`});return}let l=r===`enable`?`Enabled`:r===`disable`?`Disabled`:r===`update`?`Updated`:`Uninstalled`,u=s&&s.length>0?` · required by ${s.join(`, `)}`:``;t(`✓ ${l} ${A.plugin.name}${u}. Run /reload-plugins to apply.`),n&&await n(),e({type:`menu`})}catch(e){De(!1),R(`Failed to ${r}: ${e instanceof Error?e.message:String(e)}`),ye(I(e))}},Le=(0,X.useRef)(Ie);Le.current=Ie,(0,X.useEffect)(()=>{if(S===`plugin-details`&&A&&fe.current){let e=fe.current;fe.current=void 0,Le.current(e)}},[S,A]);let Re=Br.useCallback(()=>{if(ve>=_e.length)return;let e=_e[ve];if(e?.type!==`flagged-plugin`)if(e?.type===`plugin`){let t=`${e.plugin.name}@${e.marketplace}`,n=P(),r=se.get(t),i=n?.enabledPlugins?.[t]!==!1,a=e.scope;if(a===`builtin`||tn(a)){let e=new Map(se);r?(e.delete(t),(async()=>{try{r===`will-disable`?await Zt(t):await en(t),yt()}catch(e){ye(e)}})()):(e.set(t,i?`will-disable`:`will-enable`),(async()=>{try{i?await en(t):await Zt(t),yt()}catch(e){ye(e)}})()),L(e)}}else e?.type===`mcp`&&pe(e.client.name)},[ve,_e,se,ie,pe]);v({"select:previous":()=>{ve===0?b(!0):Se.handleSelectionChange(ve-1,xe)},"select:next":()=>{ve<_e.length-1&&Se.handleSelectionChange(ve+1,xe)},"select:accept":Br.useCallback(()=>{if(ve>=_e.length)return;let e=_e[ve];if(e?.type===`plugin`){let t=ie.find(t=>t.plugin.name===e.plugin.name&&t.marketplace===e.marketplace);t&&(j(t),w(`plugin-details`),Te(0),R(null))}else e?.type===`flagged-plugin`?(w({type:`flagged-detail`,plugin:{id:e.id,name:e.name,marketplace:e.marketplace,reason:e.reason,text:e.text,flaggedAt:e.flaggedAt}}),R(null)):e?.type===`failed-plugin`?(w({type:`failed-plugin-details`,plugin:{id:e.id,name:e.name,marketplace:e.marketplace,errors:e.errors,scope:e.scope}}),Te(0),R(null)):e?.type===`mcp`&&(w({type:`mcp-detail`,client:e.client}),R(null))},[ve,_e,ie])},{context:`Select`,isActive:S===`plugin-list`&&!_}),v({"plugin:toggle":Re},{context:`Plugin`,isActive:S===`plugin-list`&&!_}),v({"select:accept":Br.useCallback(()=>{typeof S!=`object`||S.type!==`flagged-detail`||(hn(S.plugin.id),w(`plugin-list`))},[S])},{context:`Select`,isActive:typeof S==`object`&&S.type===`flagged-detail`});let ze=Br.useMemo(()=>{if(S!==`plugin-details`||!A)return[];let e=P(),t=`${A.plugin.name}@${A.marketplace}`,n=e?.enabledPlugins?.[t]!==!1,r=A.marketplace===`builtin`,i=[];return i.push({label:n?`Disable plugin`:`Enable plugin`,action:()=>void Ie(n?`disable`:`enable`)}),r||(i.push({label:A.pendingUpdate?`Unmark for update`:`Mark for update`,action:async()=>{try{let e=await Lr(A.plugin.name,A.marketplace);if(e){R(e);return}let t=[...ie],n=t.findIndex(e=>e.plugin.name===A.plugin.name&&e.marketplace===A.marketplace);n!==-1&&(t[n].pendingUpdate=!A.pendingUpdate,F(t),j({...A,pendingUpdate:!A.pendingUpdate}))}catch(e){R(e instanceof Error?e.message:`Failed to check plugin update availability`)}}}),Ne&&i.push({label:`Configure`,action:async()=>{Me(!0);try{let e=A.plugin.manifest.mcpServers,t=null;if(typeof e==`string`&&Be(e))t=e;else if(Array.isArray(e)){for(let n of e)if(typeof n==`string`&&Be(n)){t=n;break}}if(!t){R(`No MCPB file found in plugin`),Me(!1);return}let n=`${A.plugin.name}@${A.marketplace}`,r=await Rt(t,A.plugin.path,n,void 0,void 0,!0);`status`in r&&r.status===`needs-config`?(Ae(r),w(`configuring`)):R(`Failed to load MCPB for configuration`)}catch(e){R(`Failed to load configuration: ${ce(e)}`)}finally{Me(!1)}}}),A.plugin.manifest.userConfig&&Object.keys(A.plugin.manifest.userConfig).length>0&&i.push({label:`Configure options`,action:()=>{w({type:`configuring-options`,schema:A.plugin.manifest.userConfig})}}),i.push({label:`Update now`,action:()=>void Ie(`update`)}),i.push({label:`Uninstall`,action:()=>void Ie(`uninstall`)})),A.plugin.manifest.homepage&&i.push({label:`Open homepage`,action:()=>void Wt(A.plugin.manifest.homepage)}),A.plugin.manifest.repository&&i.push({label:`View repository`,action:()=>void Wt(A.plugin.manifest.repository)}),i.push({label:`Back to plugin list`,action:()=>{w(`plugin-list`),j(null),R(null)}}),i},[S,A,Ne,ie]);if(v({"select:previous":()=>{Ce>0&&Te(Ce-1)},"select:next":()=>{Ce<ze.length-1&&Te(Ce+1)},"select:accept":()=>{ze[Ce]&&ze[Ce].action()}},{context:`Select`,isActive:S===`plugin-details`&&!!A}),v({"select:accept":()=>{typeof S==`object`&&S.type===`failed-plugin-details`&&(async()=>{De(!0),R(null);let e=S.plugin.id,t=S.plugin.scope,r=tn(t)?await Qt(e,t,!1):await Qt(e,`user`,!1),i=r.success;if(!i){for(let t of[`userSettings`,`projectSettings`,`localSettings`]){let n=k(t);n?.enabledPlugins?.[e]!==void 0&&(re(t,{enabledPlugins:{...n.enabledPlugins,[e]:void 0}}),i=!0)}yt()}i?(n&&await n(),De(!1),w(`plugin-list`)):(De(!1),R(r.message))})()}},{context:`Select`,isActive:typeof S==`object`&&S.type===`failed-plugin-details`&&S.plugin.scope!==`managed`}),v({"confirm:yes":()=>{if(!A)return;De(!0),R(null);let r=`${A.plugin.name}@${A.marketplace}`,{error:i}=re(`localSettings`,{enabledPlugins:{...k(`localSettings`)?.enabledPlugins,[r]:!1}});if(i){De(!1),R(`Failed to write settings: ${i.message}`);return}yt(),t(`✓ Disabled ${A.plugin.name} in .claude/settings.local.json. Run /reload-plugins to apply.`),n&&n(),e({type:`menu`})},"confirm:no":()=>{w(`plugin-details`),R(null)}},{context:`Confirmation`,isActive:S===`confirm-project-uninstall`&&!!A&&!Ee}),ne((r,i)=>{if(!A)return;let o=`${A.plugin.name}@${A.marketplace}`,s=A.scope;if(!s||s===`builtin`||!tn(s))return;let c=async r=>{De(!0),R(null);try{let i=await Qt(o,s,r);if(!i.success)throw Error(i.message);yt();let c=r?``:` · data preserved`;t(`${a.tick} ${i.message}${c}`),n&&n(),e({type:`menu`})}catch(e){De(!1),R(e instanceof Error?e.message:String(e))}};r===`y`||r===`Y`?c(!0):r===`n`||r===`N`?c(!1):i.escape&&(w(`plugin-details`),R(null))},{isActive:typeof S==`object`&&S.type===`confirm-data-cleanup`&&!!A&&!Ee}),Br.useEffect(()=>{xe(0)},[T]),ne((e,t)=>{let n=!t.ctrl&&!t.meta;_||(e===`/`&&n?(b(!0),E(``),xe(0)):n&&e.length>0&&!/^\s+$/.test(e)&&e!==`j`&&e!==`k`&&e!==` `&&(b(!0),E(e),xe(0)))},{isActive:S===`plugin-list`}),ae)return(0,Z.jsx)(p,{children:`Loading installed plugins…`});if(he.length===0)return(0,Z.jsxs)(C,{flexDirection:`column`,children:[(0,Z.jsx)(C,{marginBottom:1,children:(0,Z.jsx)(p,{bold:!0,children:`Manage plugins`})}),(0,Z.jsx)(p,{children:`No plugins or MCP servers installed.`}),(0,Z.jsx)(C,{marginTop:1,children:(0,Z.jsx)(p,{dimColor:!0,children:`Esc to go back`})})]});if(typeof S==`object`&&S.type===`plugin-options`&&A){let r=`${A.plugin.name}@${A.marketplace}`;function i(r){t(r),n&&n(),e({type:`menu`})}return(0,Z.jsx)(er,{plugin:A.plugin,pluginId:r,onDone:(e,t)=>{switch(e){case`configured`:i(`✓ Enabled and configured ${A.plugin.name}. Run /reload-plugins to apply.`);break;case`skipped`:i(`✓ Enabled ${A.plugin.name}. Run /reload-plugins to apply.`);break;case`error`:i(`Failed to save configuration: ${t}`);break}}})}if(typeof S==`object`&&S.type===`configuring-options`&&A){let e=`${A.plugin.name}@${A.marketplace}`;return(0,Z.jsx)(Yn,{title:`Configure ${A.plugin.name}`,subtitle:`Plugin options`,configSchema:S.schema,initialValues:Je(e),onSave:n=>{try{Pe(e,n,S.schema),yt(),t(`Configuration saved. Run /reload-plugins for changes to take effect.`)}catch(e){R(`Failed to save configuration: ${ce(e)}`)}w(`plugin-details`)},onCancel:()=>w(`plugin-details`)})}if(S===`configuring`&&ke&&A){let e=`${A.plugin.name}@${A.marketplace}`;async function n(n){if(!(!ke||!A))try{let r=A.plugin.manifest.mcpServers,i=null;if(typeof r==`string`&&Be(r))i=r;else if(Array.isArray(r)){for(let e of r)if(typeof e==`string`&&Be(e)){i=e;break}}if(!i){R(`No MCPB file found`),w(`plugin-details`);return}await Rt(i,A.plugin.path,e,void 0,n),R(null),Ae(null),w(`plugin-details`),t(`Configuration saved. Run /reload-plugins for changes to take effect.`)}catch(e){R(`Failed to save configuration: ${ce(e)}`),w(`plugin-details`)}}function r(){Ae(null),w(`plugin-details`)}return(0,Z.jsx)(Yn,{title:`Configure ${ke.manifest.name}`,subtitle:`Plugin: ${A.plugin.name}`,configSchema:ke.configSchema,initialValues:ke.existingConfig,onSave:n,onCancel:r})}if(typeof S==`object`&&S.type===`flagged-detail`){let e=S.plugin;return(0,Z.jsxs)(C,{flexDirection:`column`,children:[(0,Z.jsx)(C,{children:(0,Z.jsxs)(p,{bold:!0,children:[e.name,` @ `,e.marketplace]})}),(0,Z.jsxs)(C,{marginBottom:1,children:[(0,Z.jsx)(p,{dimColor:!0,children:`Status: `}),(0,Z.jsx)(p,{color:`error`,children:`Removed`})]}),(0,Z.jsxs)(C,{marginBottom:1,flexDirection:`column`,children:[(0,Z.jsxs)(p,{color:`error`,children:[`Removed from marketplace · reason: `,e.reason]}),(0,Z.jsx)(p,{children:e.text}),(0,Z.jsxs)(p,{dimColor:!0,children:[`Flagged on `,new Date(e.flaggedAt).toLocaleDateString()]})]}),(0,Z.jsx)(C,{marginTop:1,flexDirection:`column`,children:(0,Z.jsxs)(C,{children:[(0,Z.jsxs)(p,{children:[a.pointer,` `]}),(0,Z.jsx)(p,{color:`suggestion`,children:`Dismiss`})]})}),(0,Z.jsxs)(g,{children:[(0,Z.jsx)(z,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`dismiss`}),(0,Z.jsx)(z,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]})]})}if(S===`confirm-project-uninstall`&&A)return(0,Z.jsxs)(C,{flexDirection:`column`,children:[(0,Z.jsxs)(p,{bold:!0,color:`warning`,children:[A.plugin.name,` is enabled in .claude/settings.json (shared with your team)`]}),(0,Z.jsxs)(C,{marginTop:1,flexDirection:`column`,children:[(0,Z.jsx)(p,{children:`Disable it just for you in .claude/settings.local.json?`}),(0,Z.jsx)(p,{dimColor:!0,children:`This has the same effect as uninstalling, without affecting other contributors.`})]}),Oe&&(0,Z.jsx)(C,{marginTop:1,children:(0,Z.jsx)(p,{color:`error`,children:Oe})}),(0,Z.jsx)(C,{marginTop:1,children:Ee?(0,Z.jsx)(p,{dimColor:!0,children:`Disabling…`}):(0,Z.jsxs)(g,{children:[(0,Z.jsx)(z,{action:`confirm:yes`,context:`Confirmation`,fallback:`y`,description:`disable`}),(0,Z.jsx)(z,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})]})})]});if(typeof S==`object`&&S.type===`confirm-data-cleanup`&&A)return(0,Z.jsxs)(C,{flexDirection:`column`,children:[(0,Z.jsxs)(p,{bold:!0,children:[A.plugin.name,` has `,S.size.human,` of persistent data`]}),(0,Z.jsxs)(C,{marginTop:1,flexDirection:`column`,children:[(0,Z.jsx)(p,{children:`Delete it along with the plugin?`}),(0,Z.jsx)(p,{dimColor:!0,children:Tt(`${A.plugin.name}@${A.marketplace}`)})]}),Oe&&(0,Z.jsx)(C,{marginTop:1,children:(0,Z.jsx)(p,{color:`error`,children:Oe})}),(0,Z.jsx)(C,{marginTop:1,children:Ee?(0,Z.jsx)(p,{dimColor:!0,children:`Uninstalling…`}):(0,Z.jsxs)(p,{children:[(0,Z.jsx)(p,{bold:!0,children:`y`}),` to delete · `,(0,Z.jsx)(p,{bold:!0,children:`n`}),` to keep · `,(0,Z.jsx)(p,{bold:!0,children:`esc`}),` to cancel`]})})]});if(S===`plugin-details`&&A){let e=P(),t=`${A.plugin.name}@${A.marketplace}`,n=e?.enabledPlugins?.[t]!==!1,r=m.filter(e=>`plugin`in e&&e.plugin===A.plugin.name||e.source===t||e.source.startsWith(`${A.plugin.name}@`)),i=r.length===0?null:(0,Z.jsxs)(C,{flexDirection:`column`,marginBottom:1,children:[(0,Z.jsxs)(p,{bold:!0,color:`error`,children:[r.length,` `,O(r.length,`error`),`:`]}),r.map((e,t)=>{let n=Ar(e);return(0,Z.jsxs)(C,{flexDirection:`column`,marginLeft:2,children:[(0,Z.jsx)(p,{color:`error`,children:kr(e)}),n&&(0,Z.jsxs)(p,{dimColor:!0,italic:!0,children:[a.arrowRight,` `,n]})]},t)})]});return(0,Z.jsxs)(C,{flexDirection:`column`,children:[(0,Z.jsx)(C,{children:(0,Z.jsxs)(p,{bold:!0,children:[A.plugin.name,` @ `,A.marketplace]})}),(0,Z.jsxs)(C,{children:[(0,Z.jsx)(p,{dimColor:!0,children:`Scope: `}),(0,Z.jsx)(p,{children:A.scope||`user`})]}),A.plugin.manifest.version&&(0,Z.jsxs)(C,{children:[(0,Z.jsx)(p,{dimColor:!0,children:`Version: `}),(0,Z.jsx)(p,{children:A.plugin.manifest.version})]}),A.plugin.manifest.description&&(0,Z.jsx)(C,{marginBottom:1,children:(0,Z.jsx)(p,{children:A.plugin.manifest.description})}),A.plugin.manifest.author&&(0,Z.jsxs)(C,{children:[(0,Z.jsx)(p,{dimColor:!0,children:`Author: `}),(0,Z.jsx)(p,{children:A.plugin.manifest.author.name})]}),(0,Z.jsxs)(C,{marginBottom:1,children:[(0,Z.jsx)(p,{dimColor:!0,children:`Status: `}),(0,Z.jsx)(p,{color:n?`success`:`warning`,children:n?`Enabled`:`Disabled`}),A.pendingUpdate&&(0,Z.jsx)(p,{color:`suggestion`,children:` · Marked for update`})]}),(0,Z.jsx)(Ir,{plugin:A.plugin,marketplace:A.marketplace}),i,(0,Z.jsx)(C,{marginTop:1,flexDirection:`column`,children:ze.map((e,t)=>{let n=t===Ce;return(0,Z.jsxs)(C,{children:[n&&(0,Z.jsxs)(p,{children:[a.pointer,` `]}),!n&&(0,Z.jsx)(p,{children:` `}),(0,Z.jsx)(p,{bold:n,color:e.label.includes(`Uninstall`)?`error`:e.label.includes(`Update`)?`suggestion`:void 0,children:e.label})]},t)})}),Ee&&(0,Z.jsx)(C,{marginTop:1,children:(0,Z.jsx)(p,{children:`Processing…`})}),Oe&&(0,Z.jsx)(C,{marginTop:1,children:(0,Z.jsx)(p,{color:`error`,children:Oe})}),(0,Z.jsx)(C,{marginTop:1,children:(0,Z.jsx)(p,{dimColor:!0,italic:!0,children:(0,Z.jsxs)(g,{children:[(0,Z.jsx)(z,{action:`select:previous`,context:`Select`,fallback:`↑`,description:`navigate`}),(0,Z.jsx)(z,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`select`}),(0,Z.jsx)(z,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]})})})]})}if(typeof S==`object`&&S.type===`failed-plugin-details`){let e=S.plugin,t=e.errors[0],n=t?kr(t):`Failed to load`;return(0,Z.jsxs)(C,{flexDirection:`column`,children:[(0,Z.jsxs)(p,{children:[(0,Z.jsx)(p,{bold:!0,children:e.name}),(0,Z.jsxs)(p,{dimColor:!0,children:[` @ `,e.marketplace]}),(0,Z.jsxs)(p,{dimColor:!0,children:[` (`,e.scope,`)`]})]}),(0,Z.jsx)(p,{color:`error`,children:n}),e.scope===`managed`?(0,Z.jsx)(C,{marginTop:1,children:(0,Z.jsx)(p,{dimColor:!0,children:`Managed by your organization — contact your admin`})}):(0,Z.jsxs)(C,{marginTop:1,children:[(0,Z.jsxs)(p,{color:`suggestion`,children:[a.pointer,` `]}),(0,Z.jsx)(p,{bold:!0,children:`Remove`})]}),Ee&&(0,Z.jsx)(p,{children:`Processing…`}),Oe&&(0,Z.jsx)(p,{color:`error`,children:Oe}),(0,Z.jsx)(C,{marginTop:1,children:(0,Z.jsx)(p,{dimColor:!0,italic:!0,children:(0,Z.jsxs)(g,{children:[e.scope!==`managed`&&(0,Z.jsx)(z,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`remove`}),(0,Z.jsx)(z,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]})})})]})}if(typeof S==`object`&&S.type===`mcp-detail`){let e=S.client,n=we(u,e.name).length,r=()=>{w({type:`mcp-tools`,client:e})},i=()=>{w(`plugin-list`)},a=e=>{e&&t(e),w(`plugin-list`)},o=e.config.scope,s=e.config.type;return s===`stdio`?(0,Z.jsx)(Fn,{server:{name:e.name,client:e,scope:o,transport:`stdio`,config:e.config},serverToolsCount:n,onViewTools:r,onCancel:i,onComplete:a,borderless:!0}):s===`sse`?(0,Z.jsx)(Nn,{server:{name:e.name,client:e,scope:o,transport:`sse`,isAuthenticated:void 0,config:e.config},serverToolsCount:n,onViewTools:r,onCancel:i,onComplete:a,borderless:!0}):s===`http`?(0,Z.jsx)(Nn,{server:{name:e.name,client:e,scope:o,transport:`http`,isAuthenticated:void 0,config:e.config},serverToolsCount:n,onViewTools:r,onCancel:i,onComplete:a,borderless:!0}):s===`claudeai-proxy`?(0,Z.jsx)(Nn,{server:{name:e.name,client:e,scope:o,transport:`claudeai-proxy`,isAuthenticated:void 0,config:e.config},serverToolsCount:n,onViewTools:r,onCancel:i,onComplete:a,borderless:!0}):(w(`plugin-list`),null)}if(typeof S==`object`&&S.type===`mcp-tools`){let e=S.client,t=e.config.scope,n=e.config.type,r;return r=n===`stdio`?{name:e.name,client:e,scope:t,transport:`stdio`,config:e.config}:n===`sse`?{name:e.name,client:e,scope:t,transport:`sse`,isAuthenticated:void 0,config:e.config}:n===`http`?{name:e.name,client:e,scope:t,transport:`http`,isAuthenticated:void 0,config:e.config}:{name:e.name,client:e,scope:t,transport:`claudeai-proxy`,isAuthenticated:void 0,config:e.config},(0,Z.jsx)(Vn,{server:r,onSelectTool:t=>{w({type:`mcp-tool-detail`,client:e,tool:t})},onBack:()=>w({type:`mcp-detail`,client:e})})}if(typeof S==`object`&&S.type===`mcp-tool-detail`){let{client:e,tool:t}=S,n=e.config.scope,r=e.config.type,i;return i=r===`stdio`?{name:e.name,client:e,scope:n,transport:`stdio`,config:e.config}:r===`sse`?{name:e.name,client:e,scope:n,transport:`sse`,isAuthenticated:void 0,config:e.config}:r===`http`?{name:e.name,client:e,scope:n,transport:`http`,isAuthenticated:void 0,config:e.config}:{name:e.name,client:e,scope:n,transport:`claudeai-proxy`,isAuthenticated:void 0,config:e.config},(0,Z.jsx)(Rn,{tool:t,server:i,onBack:()=>w({type:`mcp-tools`,client:e})})}let He=Se.getVisibleItems(_e);return(0,Z.jsxs)(C,{flexDirection:`column`,children:[(0,Z.jsx)(C,{marginBottom:1,children:(0,Z.jsx)(f,{query:T,isFocused:_,isTerminalFocused:x,width:ee-4,cursorOffset:D})}),_e.length===0&&T&&(0,Z.jsx)(C,{marginBottom:1,children:(0,Z.jsxs)(p,{dimColor:!0,children:[`No items match "`,T,`"`]})}),Se.scrollPosition.canScrollUp&&(0,Z.jsx)(C,{children:(0,Z.jsxs)(p,{dimColor:!0,children:[` `,a.arrowUp,` more above`]})}),He.map((e,t)=>{let n=Se.toActualIndex(t)===ve&&!_,r=t>0?He[t-1]:null,i=!r||r.scope!==e.scope;return(0,Z.jsxs)(Br.Fragment,{children:[i&&(0,Z.jsx)(C,{marginTop:+(t>0),paddingLeft:2,children:(0,Z.jsx)(p,{dimColor:e.scope!==`flagged`,color:e.scope===`flagged`?`warning`:void 0,bold:e.scope===`flagged`,children:(e=>{switch(e){case`flagged`:return`Flagged`;case`project`:return`Project`;case`local`:return`Local`;case`user`:return`User`;case`enterprise`:return`Enterprise`;case`managed`:return`Managed`;case`builtin`:return`Built-in`;case`dynamic`:return`Built-in`;default:return e}})(e.scope)})}),(0,Z.jsx)(Mr,{item:e,isSelected:n})]},e.id)}),Se.scrollPosition.canScrollDown&&(0,Z.jsx)(C,{children:(0,Z.jsxs)(p,{dimColor:!0,children:[` `,a.arrowDown,` more below`]})}),(0,Z.jsx)(C,{marginTop:1,marginLeft:1,children:(0,Z.jsx)(p,{dimColor:!0,italic:!0,children:(0,Z.jsxs)(g,{children:[(0,Z.jsx)(p,{children:`type to search`}),(0,Z.jsx)(z,{action:`plugin:toggle`,context:`Plugin`,fallback:`Space`,description:`toggle`}),(0,Z.jsx)(z,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`details`}),(0,Z.jsx)(z,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]})})}),se.size>0&&(0,Z.jsx)(C,{marginLeft:1,children:(0,Z.jsx)(p,{dimColor:!0,italic:!0,children:`Run /reload-plugins to apply changes`})})]})}var Br,X,Z,Vr=e((()=>{i(),Br=t(l(),1),X=t(l(),1),Mt(),x(),Pn(),Ln(),Bn(),Wn(),bn(),Sn(),nt(),Kt(),Ht(),vn(),wt(),rn(),ze(),xe(),Gt(),de(),L(),ve(),Pt(),Me(),rt(),Le(),ct(),gn(),Bt(),ft(),We(),Ct(),Yt(),F(),fe(),M(),jr(),Qn(),rr(),Nr(),hr(),Z=w()}));function Hr(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 Ur=e((()=>{}));function Wr({onComplete:e,path:t}){return(0,Gr.useEffect)(()=>{async function n(){if(!t){e(`Usage: /plugin validate <path>
|
|
2
2
|
|
|
3
3
|
Validate a plugin or marketplace manifest file or directory.
|
|
4
4
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e,o as t}from"./chunk-DR8-3Aex.js";import{Cn as n,F as r,Rn as i,b as a,t as o,x as s}from"./src-Di342QoJ.js";import{t as c}from"./jsx-runtime-D-D469L8.js";import{E as l,w as u,x as d}from"./startupProfiler-DnXZaX4A.js";import{Uw as f}from"./loadAgentsDir-
|
|
1
|
+
import{n as e,o as t}from"./chunk-DR8-3Aex.js";import{Cn as n,F as r,Rn as i,b as a,t as o,x as s}from"./src-Di342QoJ.js";import{t as c}from"./jsx-runtime-D-D469L8.js";import{E as l,w as u,x as d}from"./startupProfiler-DnXZaX4A.js";import{Uw as f}from"./loadAgentsDir-HZ19tmOZ.js";function p(e){return e.startsWith(`file-`)?`+`:e.startsWith(`mcp-resource-`)?`◇`:e.startsWith(`agent-`)?`*`:`+`}function m(e){return e.startsWith(`file-`)||e.startsWith(`mcp-resource-`)||e.startsWith(`agent-`)}function h({suggestions:e,selectedSuggestion:t,maxColumnWidth:i,overlay:a}){let{rows:o}=r(),c=a?5:Math.min(6,Math.max(1,o-3));if(e.length===0)return null;let l=i??Math.max(...e.map(e=>n(e.displayText)))+5,u=Math.max(0,Math.min(t-Math.floor(c/2),e.length-c)),d=Math.min(u+c,e.length),f=e.slice(u,d);return(0,_.jsx)(s,{flexDirection:`column`,justifyContent:a?void 0:`flex-end`,children:f.map(n=>(0,_.jsx)(v,{item:n,maxColumnWidth:l,isSelected:n.id===e[t]?.id},n.id))})}var g,_,v,y,b=e((()=>{g=t(i(),1),f(),o(),d(),_=c(),v=(0,g.memo)(function({item:e,maxColumnWidth:t,isSelected:i}){let o=r().columns;if(m(e.id)){let t=p(e.id),r=i?`suggestion`:void 0,s=!i,c=e.id.startsWith(`file-`),d=e.id.startsWith(`mcp-resource-`),f=e.description?3:0,m;if(c){let t=e.description?Math.min(20,n(e.description)):0,r=o-2-4-f-t;m=u(e.displayText,r)}else m=d?l(e.displayText,30):e.displayText;let h=o-2-n(m)-f-4,g;if(e.description){let n=Math.max(0,h),r=l(e.description.replace(/\s+/g,` `),n);g=`${t} ${m} – ${r}`}else g=`${t} ${m}`;return(0,_.jsx)(a,{color:r,dimColor:s,wrap:`truncate`,children:g})}let s=Math.floor(o*.4),c=Math.min(t??n(e.displayText)+5,s),d=e.color||(i?`suggestion`:void 0),f=!i,h=e.displayText;n(h)>c-2&&(h=l(h,c-2));let g=h+` `.repeat(Math.max(0,c-n(h))),v=e.tag?`[${e.tag}] `:``,y=n(v),b=Math.max(0,o-c-y-4),x=e.description?l(e.description.replace(/\s+/g,` `),b):``;return(0,_.jsxs)(a,{wrap:`truncate`,children:[(0,_.jsx)(a,{color:d,dimColor:f,children:g}),v?(0,_.jsx)(a,{color:e.tag===`local`?`ansi:yellow`:void 0,dimColor:e.tag!==`local`,children:v}):null,(0,_.jsx)(a,{color:i?`suggestion`:void 0,dimColor:!i,children:x})]})}),y=(0,g.memo)(h)}));export{y as n,b as r,h as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e}from"./chunk-DR8-3Aex.js";import{Rn as t,b as n,t as r,x as i}from"./src-Di342QoJ.js";import{t as a}from"./jsx-runtime-D-D469L8.js";import{Ac as o,S as s,Sc as c,vi as l,xi as u,yi as d}from"./paths-
|
|
1
|
+
import{n as e}from"./chunk-DR8-3Aex.js";import{Rn as t,b as n,t as r,x as i}from"./src-Di342QoJ.js";import{t as a}from"./jsx-runtime-D-D469L8.js";import{Ac as o,S as s,Sc as c,vi as l,xi as u,yi as d}from"./paths-D8Fx3kUi.js";import{a as f,n as p}from"./env-chR0gV31.js";import{i as m,o as h}from"./platform-CuyedWpe.js";import{dT as g,nT as _,rT as v,uT as y}from"./loadAgentsDir-HZ19tmOZ.js";import{a as b,i as x,r as S}from"./terminalSetup-CGiIwoIX.js";function C(){return c().editorMode===`vim`}function w(){return p.terminal===`Apple_Terminal`&&process.platform===`darwin`||b()?`shift + ⏎ for newline`:S()?`\\⏎ for newline`:`backslash (\\) + return (⏎) for newline`}function T(e,t){return t.ctrl||t.meta||t.escape||t.return||t.tab||t.backspace||t.delete||t.upArrow||t.downArrow||t.leftArrow||t.rightArrow||t.pageUp||t.pageDown||t.home||t.end?!1:e.length>0&&!/^\s/.test(e)&&!e.startsWith(`\x1B`)}var E=e((()=>{x(),o(),f()}));function D(e){return e.replace(/\+/g,` + `)}function O(e){let{dimColor:t,fixedWidth:r,gap:a,paddingX:o}=e,s=D(v(`app:toggleTranscript`,`Global`,`ctrl+o`)),c=D(v(`app:toggleTodos`,`Global`,`ctrl+t`)),l=D(v(`chat:undo`,`Chat`,`ctrl+_`)),f=D(v(`chat:stash`,`Chat`,`ctrl+s`)),p=D(v(`chat:cycleMode`,`Chat`,`shift+tab`)),h=D(v(`chat:modelPicker`,`Chat`,`alt+p`)),_=D(v(`chat:fastMode`,`Chat`,`alt+o`)),y=D(v(`chat:externalEditor`,`Chat`,`ctrl+g`));D(v(`app:toggleTerminal`,`Global`,`meta+j`));let b=D(v(`chat:imagePaste`,`Chat`,`ctrl+v`));return(0,k.jsxs)(i,{paddingX:o,flexDirection:`row`,gap:a,children:[(0,k.jsxs)(i,{flexDirection:`column`,width:r?24:void 0,children:[(0,k.jsx)(i,{children:(0,k.jsx)(n,{dimColor:t,children:`! for bash mode`})}),(0,k.jsx)(i,{children:(0,k.jsx)(n,{dimColor:t,children:`/ for commands`})}),(0,k.jsx)(i,{children:(0,k.jsx)(n,{dimColor:t,children:`@ for file paths`})}),(0,k.jsx)(i,{children:(0,k.jsx)(n,{dimColor:t,children:`& for background`})}),(0,k.jsx)(i,{children:(0,k.jsx)(n,{dimColor:t,children:`/btw for side question`})})]}),(0,k.jsxs)(i,{flexDirection:`column`,width:r?35:void 0,children:[(0,k.jsx)(i,{children:(0,k.jsx)(n,{dimColor:t,children:`double tap esc to clear input`})}),(0,k.jsx)(i,{children:(0,k.jsxs)(n,{dimColor:t,children:[p,` `,process.env.USER_TYPE===`ant`?`to cycle modes`:`to auto-accept edits`]})}),(0,k.jsx)(i,{children:(0,k.jsxs)(n,{dimColor:t,children:[s,` for verbose output`]})}),(0,k.jsx)(i,{children:(0,k.jsxs)(n,{dimColor:t,children:[c,` to toggle tasks`]})}),null,(0,k.jsx)(i,{children:(0,k.jsx)(n,{dimColor:t,children:w()})})]}),(0,k.jsxs)(i,{flexDirection:`column`,children:[(0,k.jsx)(i,{children:(0,k.jsxs)(n,{dimColor:t,children:[l,` to undo`]})}),m()!==`windows`&&(0,k.jsx)(i,{children:(0,k.jsx)(n,{dimColor:t,children:`ctrl + z to suspend`})}),(0,k.jsx)(i,{children:(0,k.jsxs)(n,{dimColor:t,children:[b,` to paste images`]})}),(0,k.jsx)(i,{children:(0,k.jsxs)(n,{dimColor:t,children:[h,` to switch model`]})}),u()&&d()&&(0,k.jsx)(i,{children:(0,k.jsxs)(n,{dimColor:t,children:[_,` to toggle fast mode`]})}),(0,k.jsx)(i,{children:(0,k.jsxs)(n,{dimColor:t,children:[f,` to stash prompt`]})}),(0,k.jsx)(i,{children:(0,k.jsxs)(n,{dimColor:t,children:[y,` to edit in $EDITOR`]})}),g()&&(0,k.jsx)(i,{children:(0,k.jsx)(n,{dimColor:t,children:`/keybindings to customize`})})]})]})}var k,A=e((()=>{t(),r(),h(),y(),_(),s(),l(),E(),k=a()}));export{C as a,T as i,A as n,E as r,O as t};
|