@readmagic/workmate 0.0.10 → 0.0.11
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-Vmmm7p1c.js → AddWorkspaceDirectory-ag2JTpmU.js} +1 -1
- package/dist/chunks/App-BuKmqFPm.js +1 -0
- package/dist/chunks/ApproveApiKey-CIWOi_7v.js +1 -0
- package/dist/chunks/ApproveApiKey-M6U-NafA.js +1 -0
- package/dist/chunks/BackgroundTasksDialog-Pnpl3Ixx.js +2 -0
- package/dist/chunks/{BypassPermissionsModeDialog-CLSACUmo.js → BypassPermissionsModeDialog-B05t83wa.js} +1 -1
- package/dist/chunks/{ClaudeMdExternalIncludesDialog-BqNxQOXJ.js → ClaudeMdExternalIncludesDialog-CSywJdVL.js} +1 -1
- package/dist/chunks/ClaudeMdExternalIncludesDialog-D-w166RC.js +1 -0
- package/dist/chunks/ConsoleOAuthFlow-CV6PcJOP.js +1 -0
- package/dist/chunks/{DiffDialog-9AYwtupw.js → DiffDialog-DUbFrzKu.js} +2 -2
- package/dist/chunks/Doctor-BcnUfJ4I.js +1 -0
- package/dist/chunks/Doctor-Dz4TuYas.js +3 -0
- package/dist/chunks/ExitFlow-BwyAtIHx.js +2 -0
- package/dist/chunks/{Grove-B9-hhkZA.js → Grove-BDoVj02t.js} +2 -2
- package/dist/chunks/{HybridTransport-MxJ_W_np.js → HybridTransport-C_U0IJfz.js} +4 -4
- package/dist/chunks/InvalidConfigDialog-bih293Xt.js +1 -0
- package/dist/chunks/{InvalidSettingsDialog-YyQcHocx.js → InvalidSettingsDialog-Br8kQOHz.js} +1 -1
- package/dist/chunks/MCPConnectionManager-B9n4SXN4.js +1 -0
- package/dist/chunks/MCPToolListView-DJ06N1DG.js +1 -0
- package/dist/chunks/{McpParsingWarnings-BCpfHaBK.js → McpParsingWarnings-COa71S9q.js} +1 -1
- package/dist/chunks/MessageSelector-o4ULADFg.js +3 -0
- package/dist/chunks/Messages-qqwHuAW5.js +11 -0
- package/dist/chunks/{Onboarding-ClwHS5rh.js → Onboarding-BzuQjney.js} +1 -1
- package/dist/chunks/{PromptInputFooterSuggestions-BSA9NrZc.js → PromptInputFooterSuggestions-to5eYBvI.js} +1 -1
- package/dist/chunks/{PromptInputHelpMenu-Bb4KdIX_.js → PromptInputHelpMenu-CfMFx-TF.js} +1 -1
- package/dist/chunks/QueryEngine-Dt0BKUeF.js +1 -0
- package/dist/chunks/REPL-CUbEDqEl.js +133 -0
- package/dist/chunks/REPL-DMaKNhTa.js +1 -0
- package/dist/chunks/{RemoteSessionManager-CS6mywIn.js → RemoteSessionManager-Bf44A0Ol.js} +2 -2
- package/dist/chunks/ResumeConversation-Ctw5Q1g9.js +1 -0
- package/dist/chunks/{SSETransport-CoxQ8YpH.js → SSETransport-DN4tCDEh.js} +3 -3
- package/dist/chunks/SearchExtraToolsTool-C80OdtPZ.js +1 -0
- package/dist/chunks/Settings-DfdcmvOV.js +2 -0
- package/dist/chunks/{TeleportProgress-Doucj-50.js → TeleportProgress-C2LQVLav.js} +1 -1
- package/dist/chunks/TeleportRepoMismatchDialog-BZL8Zblz.js +1 -0
- package/dist/chunks/{TeleportResumeWrapper-D6kpr2c6.js → TeleportResumeWrapper-wPiIs8xg.js} +1 -1
- package/dist/chunks/{ThemePicker-DrC8tlp0.js → ThemePicker-BT_NaRQC.js} +1 -1
- package/dist/chunks/{TrustDialog-Fk4m_Sy4.js → TrustDialog-ACaJ_m7A.js} +1 -1
- package/dist/chunks/{ValidationErrorsList-D_OUa4RT.js → ValidationErrorsList-C-hWdy_8.js} +1 -1
- package/dist/chunks/{WelcomeV2-DvfQHnZY.js → WelcomeV2-ZQRKlcT4.js} +1 -1
- package/dist/chunks/add-dir-SAKTkw0S.js +1 -0
- package/dist/chunks/{agentDisplay-B755vMZE.js → agentDisplay-CuSHqgZc.js} +1 -1
- package/dist/chunks/{agents-CIvP8l0s.js → agents-CMC0iQP4.js} +1 -1
- package/dist/chunks/agents-ZgRKpjHv.js +103 -0
- package/dist/chunks/allErrors-_cOQksHC.js +1 -0
- package/dist/chunks/{api-nSHc_GIQ.js → api-BbJfMXRS.js} +1 -1
- package/dist/chunks/api-DS1MiW01.js +1 -0
- package/dist/chunks/{auth-5QB6tsfB.js → auth-7mJGtlZp.js} +2 -2
- package/dist/chunks/auth-DGZzCbU0.js +1 -0
- package/dist/chunks/auth-DN1MUpB8.js +1 -0
- package/dist/chunks/{autoMode-BnUiK9Cu.js → autoMode-CBtY7ACs.js} +6 -6
- package/dist/chunks/{autonomy-Src6sKCp.js → autonomy-DuQmYhq6.js} +9 -9
- package/dist/chunks/{autonomy-C1aSgWPQ.js → autonomy-lJV7yWUl.js} +1 -1
- package/dist/chunks/autonomyPanel-DAQm6lDz.js +1 -0
- package/dist/chunks/backgroundHousekeeping-BTy71bcY.js +1 -0
- package/dist/chunks/backgroundHousekeeping-Cc7Ag7JG.js +17 -0
- package/dist/chunks/{banner-D0P7wXdw.js → banner-1Wyeyawe.js} +1 -1
- package/dist/chunks/{bg-DAPORXF3.js → bg-CJ0YWFli.js} +2 -2
- package/dist/chunks/bg-CeUrRz_7.js +1 -0
- package/dist/chunks/{branch-DFWa4Oxo.js → branch-k3kirqbA.js} +2 -2
- package/dist/chunks/{break-cache-Chj9i9MP.js → break-cache-CAoZ9b72.js} +1 -1
- package/dist/chunks/bridgeConfig-CzRUPn-D.js +1 -0
- package/dist/chunks/{bridgeConfig-Bb6URf4Q.js → bridgeConfig-UgaUfuP6.js} +1 -1
- package/dist/chunks/{bridgeMessaging-C3huGcR3.js → bridgeMessaging-Ci5H68MX.js} +1 -1
- package/dist/chunks/{bridgePointer-DLYyvRKb.js → bridgePointer-BL8-lGvN.js} +1 -1
- package/dist/chunks/{bridgeStatusUtil-DFMftajD.js → bridgeStatusUtil-C36w15ge.js} +1 -1
- package/dist/chunks/btw-nVoVuIae.js +1 -0
- package/dist/chunks/caches-B8sM3Zys.js +1 -0
- package/dist/chunks/caches-Bp9MZ7IE.js +1 -0
- package/dist/chunks/{capacityWake-amzeeBz0.js → capacityWake-BOySRJUJ.js} +1 -1
- package/dist/chunks/ccrClient-Br4LAofR.js +1 -0
- package/dist/chunks/{claudeDesktop-CsJfF1b-.js → claudeDesktop-Bgds1-YT.js} +1 -1
- package/dist/chunks/{clear-ClFDpWVJ.js → clear-C4Vtnbye.js} +1 -1
- package/dist/chunks/{cliLaunch-BWcoyZDP.js → cliLaunch-BTpfAGGI.js} +1 -1
- package/dist/chunks/{client-DFlE4fYh.js → client-B9404qIP.js} +1 -1
- package/dist/chunks/client-BCAbKdNz.js +1 -0
- package/dist/chunks/client-CJE6gEvU.js +1 -0
- package/dist/chunks/commands-DL-BzoMQ.js +1 -0
- package/dist/chunks/compact-Cx7BPXLU.js +2 -0
- package/dist/chunks/config-S5OW4Xqr.js +1 -0
- package/dist/chunks/{config-Do1870_d.js → config-aRiTrtCv.js} +2 -2
- package/dist/chunks/{config-CVHMRMwd.js → config-kB2eazPX.js} +1 -1
- package/dist/chunks/context-BN7DEjoH.js +1 -0
- package/dist/chunks/{context-noninteractive-D5iQhasu.js → context-noninteractive-D91W2B8e.js} +5 -5
- package/dist/chunks/context-noninteractive-DPacEFJ1.js +1 -0
- package/dist/chunks/conversation-D5Nbu9eT.js +1 -0
- package/dist/chunks/conversation-hcUx9e-C.js +1 -0
- package/dist/chunks/{createSSHSession-CJtzNQdZ.js → createSSHSession-DecOR6M5.js} +6 -6
- package/dist/chunks/createSession-D27zvmOs.js +1 -0
- package/dist/chunks/createSession-DRqkLZWt.js +1 -0
- package/dist/chunks/crossProjectResume-Bw3U0Ty6.js +40 -0
- package/dist/chunks/{datadog-DjeJThpV.js → datadog-bm551AVV.js} +1 -1
- package/dist/chunks/debug-BecbSVoN.js +39 -0
- package/dist/chunks/{debugUtils-DX0KAXNK.js → debugUtils-CmJfIUxW.js} +1 -1
- package/dist/chunks/{detached-X_yjYR7x.js → detached-CIyF0M5O.js} +1 -1
- package/dist/chunks/detectRepository-C15umvKN.js +1 -0
- package/dist/chunks/detectRepository-DDfLfKcM.js +1 -0
- package/dist/chunks/{diff-jEJJe58I.js → diff-DeK4bwjw.js} +1 -1
- package/dist/chunks/{directoryCompletion-BbXR2bfy.js → directoryCompletion-BJCu19HJ.js} +1 -1
- package/dist/chunks/doctor-BJORBomU.js +1 -0
- package/dist/chunks/{entry-oIqjxIjQ.js → entry-mdegyj8z.js} +3 -3
- package/dist/chunks/{esm-Cf4nSRjF.js → esm-Ka3lhafK.js} +1 -1
- package/dist/chunks/{execFileNoThrow-Dwu6psHW.js → execFileNoThrow-DHyW8FMX.js} +2 -2
- package/dist/chunks/execSyncWrapper-CDzB0BM1.js +1 -0
- package/dist/chunks/exit-CF3KBl-S.js +1 -0
- package/dist/chunks/{extraUsage-Mi66JwFZ.js → extraUsage-BrKbpBK-.js} +1 -1
- package/dist/chunks/extractMemories-4lBn134y.js +1 -0
- package/dist/chunks/fast-0Vi354KI.js +1 -0
- package/dist/chunks/{fast-BU4iUZ8E.js → fast-DWn40OcQ.js} +1 -1
- package/dist/chunks/{fileSuggestions-BMfQIDdW.js → fileSuggestions-C7Pwq2yj.js} +3 -3
- package/dist/chunks/{firstPartyEventLogger-B3cXgR67.js → firstPartyEventLogger-BHjBQH0J.js} +2 -2
- package/dist/chunks/firstPartyEventLogger-BNBnLYPK.js +1 -0
- package/dist/chunks/{flushGate-DgSDVGKZ.js → flushGate-DdJjxCes.js} +1 -1
- package/dist/chunks/gemini-DHv2iVfy.js +1 -0
- package/dist/chunks/generateSessionName-DhS_6oHd.js +1 -0
- package/dist/chunks/{genericProcessUtils-CmsUPyRz.js → genericProcessUtils-B2HcDYhg.js} +1 -1
- package/dist/chunks/git-DBlOv64X.js +6 -0
- package/dist/chunks/git-DF4RFFaT.js +1 -0
- package/dist/chunks/githubRepoPathMapping-CK56bUDe.js +1 -0
- package/dist/chunks/{goal-ZmSRBx4q.js → goal-BZG4gtnb.js} +3 -3
- package/dist/chunks/{grok-BXMvezWb.js → grok-BS57ZhyW.js} +1 -1
- package/dist/chunks/{grove-CeOjTaY6.js → grove-_zlQ83yR.js} +2 -2
- package/dist/chunks/{help-5DNZO6_H.js → help-C_2tdXHC.js} +1 -1
- package/dist/chunks/{hooks-C637tFtd.js → hooks-C7Bn7MBe.js} +2 -2
- package/dist/chunks/hooks-DT80Arzc.js +1 -0
- package/dist/chunks/{initReplBridge-D1h10vQ9.js → initReplBridge-NkZRcM77.js} +1 -1
- package/dist/chunks/{install-C-6ItpH0.js → install-Du-DSVzj.js} +1 -1
- package/dist/chunks/{instrumentation-DaiPDUst.js → instrumentation-DMs3b82f.js} +5 -5
- package/dist/chunks/{job-BeYzQUiR.js → job-rbX1VZmp.js} +1 -1
- package/dist/chunks/jwtUtils-OzxN2zts.js +1 -0
- package/dist/chunks/keybindings-CwdC_8S0.js +2 -0
- package/dist/chunks/{launchLocalMemory-CE4J98xO.js → launchLocalMemory-BLRCK1_o.js} +2 -2
- package/dist/chunks/{launchOnboarding-BfTdC6vp.js → launchOnboarding-Al_X75Vz.js} +1 -1
- package/dist/chunks/{loadAgentsDir-C7lOqvfh.js → loadAgentsDir-BL93ulMm.js} +619 -619
- package/dist/chunks/loadAgentsDir-eVKq8efm.js +1 -0
- package/dist/chunks/loadPluginHooks-B0au35a4.js +1 -0
- package/dist/chunks/{localSearch-BKrznW5x.js → localSearch-C5ipegd9.js} +1 -1
- package/dist/chunks/localSearch-CZlFfR_X.js +1 -0
- package/dist/chunks/{log-CezCRpAN.js → log-Dauqle-Z.js} +1 -1
- package/dist/chunks/{logoV2Utils-BkQfyQ1-.js → logoV2Utils-CkvOihX7.js} +1 -1
- package/dist/chunks/{magicDocs-BpVcON9o.js → magicDocs-DLav5QK0.js} +3 -3
- package/dist/chunks/main-CVNWNAoh.js +513 -0
- package/dist/chunks/{main-CvOv59-7.js → main-LMyE3jXY.js} +2 -2
- package/dist/chunks/managedEnv-CYepSnm8.js +1 -0
- package/dist/chunks/{managedEnv-DhWRJ5DK.js → managedEnv-DJSCuqCb.js} +1 -1
- package/dist/chunks/{mappers-bOab8ipV.js → mappers-DQxMcezy.js} +1 -1
- package/dist/chunks/mcp-BAbbEaBA.js +1 -0
- package/dist/chunks/mcp-Ct4Sum6A.js +6 -0
- package/dist/chunks/{mcp-VcGPYCkW.js → mcp-D5HkCqUh.js} +2 -2
- package/dist/chunks/{memoize-DsqYrbeR.js → memoize-FeyE7JEh.js} +1 -1
- package/dist/chunks/memory-COa7aUbx.js +1 -0
- package/dist/chunks/{mode-DlKnUM8l.js → mode-Bl2RZC8M.js} +2 -2
- package/dist/chunks/model-B7rtZ7KV.js +1 -0
- package/dist/chunks/{model-BsZ4sP_H.js → model-Bgh_r4lg.js} +1 -1
- package/dist/chunks/model-DiuEAv6h.js +1 -0
- package/dist/chunks/{modelOptions-CxP067Qv.js → modelOptions-BtEZe5BB.js} +1 -1
- package/dist/chunks/nativeInstaller-BEwayifa.js +1 -0
- package/dist/chunks/omit--yH_T4rf.js +1 -0
- package/dist/chunks/onChangeAppState-ZdwI7boX.js +1 -0
- package/dist/chunks/{openai-B9C2XN5Q.js → openai-DWs4D-nQ.js} +3 -3
- package/dist/chunks/panel-CoNfXy3K.js +1 -0
- package/dist/chunks/{parser-BwPXQomy.js → parser-BH4u7QiV.js} +1 -1
- package/dist/chunks/parser-BMIaRErw.js +1 -0
- package/dist/chunks/{partition-D-UhsUCx.js → partition-DLcW5Oo_.js} +1 -1
- package/dist/chunks/permissions-CaucYK3s.js +3 -0
- package/dist/chunks/pidLock-DgOBc1Xo.js +3 -0
- package/dist/chunks/{plan-CyU2zrCK.js → plan-BNYDTnQd.js} +1 -1
- package/dist/chunks/{platform-BMPbglug.js → platform-B0uTQc9P.js} +1 -1
- package/dist/chunks/plugin-BN-of1_H.js +17 -0
- package/dist/chunks/pluginAutoupdate-BBU9Jn4p.js +1 -0
- package/dist/chunks/pluginBlocklist-DXQlbG0P.js +1 -0
- package/dist/chunks/pluginCliCommands-CfdVNs8D.js +1 -0
- package/dist/chunks/pluginFlagging-DcJ_FQuv.js +1 -0
- package/dist/chunks/pluginOperations-DnhzFbYI.js +2 -0
- package/dist/chunks/pluginStartupCheck-CKBFaMFr.js +1 -0
- package/dist/chunks/pluginStartupCheck-CpNB4jxG.js +1 -0
- package/dist/chunks/plugins-CBW7kPyp.js +4 -0
- package/dist/chunks/{poorMode-DEwQOAJt.js → poorMode-B_xEvuEV.js} +1 -1
- package/dist/chunks/poorMode-yH1o41cQ.js +1 -0
- package/dist/chunks/{print-eCRv_Li-.js → print-BZOx09SU.js} +16 -16
- package/dist/chunks/processBashCommand-dcCNCiBp.js +1 -0
- package/dist/chunks/processSlashCommand-YDiM63Qr.js +5 -0
- package/dist/chunks/prompt-CXGy0llt.js +1 -0
- package/dist/chunks/prompt-DovNDmcx.js +1 -0
- package/dist/chunks/{prompt-M2lu8_Oa.js → prompt-Dx7IWhBt.js} +2 -2
- package/dist/chunks/{promptEditor-DhcZY-iu.js → promptEditor-WCkmpejM.js} +2 -2
- package/dist/chunks/{protocolHandler-CkFaJKKo.js → protocolHandler-BiVWrpHi.js} +4 -4
- package/dist/chunks/{proxy-CuMaO_YV.js → proxy-CVn7o19p.js} +3 -3
- package/dist/chunks/reconciler-C2Nd_e4n.js +1 -0
- package/dist/chunks/refresh-B84H2Ezd.js +1 -0
- package/dist/chunks/{registerProtocol-CsNYRZKr.js → registerProtocol-E0Iu5hEx.js} +2 -2
- package/dist/chunks/{reload-plugins-B7JAE3b4.js → reload-plugins-D-3AUT9g.js} +1 -1
- package/dist/chunks/{remoteBridgeCore-CFLJhsB6.js → remoteBridgeCore-CV6we3ZA.js} +1 -1
- package/dist/chunks/remoteManagedSettings-D26Q09-7.js +1 -0
- package/dist/chunks/{rename-BCp2Vtqu.js → rename-CSavuBIE.js} +1 -1
- package/dist/chunks/{renderOptions-Q5oCLFIC.js → renderOptions-DDLbSMQU.js} +1 -1
- package/dist/chunks/resume-CROylN3J.js +2 -0
- package/dist/chunks/ripgrep-2M1GkXqJ.js +1 -0
- package/dist/chunks/{ripgrep-DvOOsDMv.js → ripgrep-C1ydIMzT.js} +5 -5
- package/dist/chunks/{runtimeObserver-CS_3BDNo.js → runtimeObserver-L7pSIWBT.js} +2 -2
- package/dist/chunks/{runtimeObserver-DYUva6g-.js → runtimeObserver-OU8KrZQG.js} +1 -1
- package/dist/chunks/sandbox-adapter-6UwMLh6e.js +1 -0
- package/dist/chunks/{sandbox-toggle--zNSKce_.js → sandbox-toggle-YrQNWGsr.js} +1 -1
- package/dist/chunks/searchExtraTools-Bdv5HJ74.js +1 -0
- package/dist/chunks/{session-CO3gEqQP.js → session-DUYsfPy_.js} +2 -2
- package/dist/chunks/sessionFileAccessHooks-Czen7Ejz.js +1 -0
- package/dist/chunks/sessionObserver-B0zucj_c.js +1 -0
- package/dist/chunks/{sessionObserver-YkRHC-Aa.js → sessionObserver-Dv3Ba8eA.js} +2 -2
- package/dist/chunks/{sessionState-Bifmu95-.js → sessionState-D-SaBzWD.js} +2 -2
- package/dist/chunks/sessionStorage-BM1x51Z7.js +1 -0
- package/dist/chunks/{sessionTitle-COBSgSXS.js → sessionTitle-uCuYaNif.js} +2 -2
- package/dist/chunks/{sessionTracing-BrNx1k2V.js → sessionTracing-Bqb3vJTt.js} +3 -3
- package/dist/chunks/settings-BG15IFYx.js +1 -0
- package/dist/chunks/settings-D4CpDv2y.js +20 -0
- package/dist/chunks/settingsSync-BSrpnyqo.js +1 -0
- package/dist/chunks/setup-C62oq4AZ.js +3 -0
- package/dist/chunks/{shadowedRuleDetection-DEaw-X5j.js → shadowedRuleDetection-BzAZ57p2.js} +1 -1
- package/dist/chunks/{shellQuote-BYeOv3Ip.js → shellQuote-DS6WrivY.js} +2 -2
- package/dist/chunks/{sideQuestion-D0OKljee.js → sideQuestion-CvMBBjI8.js} +2 -2
- package/dist/chunks/sinks-WJ7nzLQs.js +1 -0
- package/dist/chunks/sinks-f7qYjbKJ.js +2 -0
- package/dist/chunks/skillChangeDetector-U5kRU5nd.js +1 -0
- package/dist/chunks/{skillGapStore-N_kmvXML.js → skillGapStore-CqaT8c0C.js} +2 -2
- package/dist/chunks/{skillLifecycle-C4F5RXuh.js → skillLifecycle-CnR8IqJM.js} +2 -2
- package/dist/chunks/skillSearchPanel-D9qrOXpI.js +21 -0
- package/dist/chunks/{skills-C4CTRN9o.js → skills-BgcFh0vy.js} +1 -1
- package/dist/chunks/startupProfiler-B4HBBbHN.js +1 -0
- package/dist/chunks/{startupProfiler-L_UWZ03w.js → startupProfiler-CmH_aVy2.js} +2 -2
- package/dist/chunks/{stats-IzV0_vEc.js → stats-B8uQ-UDi.js} +1 -1
- package/dist/chunks/{status-CeVP_uDT.js → status-BekdWoIj.js} +1 -1
- package/dist/chunks/status-D6KlRJmR.js +2 -0
- package/dist/chunks/{statusNoticeHelpers-Bb9gxdSt.js → statusNoticeHelpers-BMM8_uJ1.js} +1 -1
- package/dist/chunks/{stringUtils-C84IJ91d.js → stringUtils-C8PaYpQF.js} +1 -1
- package/dist/chunks/switcher-Ck9CrXrr.js +1 -0
- package/dist/chunks/{switcher-CCs9xl1z.js → switcher-DnAhkyIn.js} +1 -1
- package/dist/chunks/syncCache-ClP9aBqK.js +1 -0
- package/dist/chunks/{tasks-DZDhgx0w.js → tasks-Dmh6qikm.js} +1 -1
- package/dist/chunks/teleport-DH3IuAUQ.js +1 -0
- package/dist/chunks/{templateJobs-CrNPEKkh.js → templateJobs-CxqU-s5i.js} +1 -1
- package/dist/chunks/{terminalSetup-CBqcwQll.js → terminalSetup-BKGcmlWp.js} +1 -1
- package/dist/chunks/{terminalSetup-D-N8YPiQ.js → terminalSetup-Cy19F1Js.js} +4 -4
- package/dist/chunks/{theme-Dazsirbw.js → theme-U7lMFHQ0.js} +1 -1
- package/dist/chunks/{tmux-DewYVEBm.js → tmux-D5EvHWi3.js} +1 -1
- package/dist/chunks/{toolEventObserver-lnHJ9fLQ.js → toolEventObserver-D9qjoVl5.js} +1 -1
- package/dist/chunks/toolPool-69mfSPAs.js +1 -0
- package/dist/chunks/trustedDevice-B6AKlsl_.js +1 -0
- package/dist/chunks/trustedDevice-DL0pWP4_.js +1 -0
- package/dist/chunks/{types-3j8PS-Du.js → types-DafcFtmb.js} +2 -2
- package/dist/chunks/udsClient-CWnfsgFP.js +1 -0
- package/dist/chunks/{updateCCB-BPe9_FW6.js → updateCCB-C6XftzIG.js} +6 -6
- package/dist/chunks/{upstreamproxy-DF00RzGG.js → upstreamproxy-CXmjxHpl.js} +2 -2
- package/dist/chunks/{useExitOnCtrlCDWithKeybindings-ChqBs9Lr.js → useExitOnCtrlCDWithKeybindings-DEEJhm_W.js} +1 -1
- package/dist/chunks/useMainLoopModel-6w7mhwhU.js +1 -0
- package/dist/chunks/useManagePlugins-CjnsO-Of.js +1 -0
- package/dist/chunks/{useMergedTools-Dk5cPqLc.js → useMergedTools-DbhqKk1-.js} +1 -1
- package/dist/chunks/{useSearchInput-C7Y1I9P9.js → useSearchInput-gUDbkLaC.js} +1 -1
- package/dist/chunks/{useSettingsErrors-DAEO7AyB.js → useSettingsErrors-CgPad-H0.js} +1 -1
- package/dist/chunks/{userAgent-CIq27vUR.js → userAgent-CU7Ndh79.js} +1 -1
- package/dist/chunks/util-B4oMhJKh.js +1 -0
- package/dist/chunks/validatePlugin-y_O_tCEL.js +1 -0
- package/dist/chunks/{vim-EYQn94Kx.js → vim-w37BfGZ5.js} +1 -1
- package/dist/chunks/{which-DzFN5TNM.js → which-BRWBO7Gu.js} +1 -1
- package/dist/chunks/windowsPaths-BY-IVNwQ.js +1 -0
- package/dist/chunks/windowsPaths-DtWHLjmE.js +1 -0
- package/dist/chunks/{workSecret-DUqdPy44.js → workSecret-BEhXgH2M.js} +1 -1
- package/dist/chunks/{workerRegistry-C07BcZIw.js → workerRegistry-Bq9bS5pw.js} +5 -5
- package/dist/chunks/worktree-4SUJ4dtz.js +1 -0
- package/dist/cli.js +1 -1
- package/package.json +2 -3
- package/dist/chunks/App-C2yQjBgY.js +0 -1
- package/dist/chunks/ApproveApiKey-CKbv5C1x.js +0 -1
- package/dist/chunks/ApproveApiKey-MscC-ssL.js +0 -1
- package/dist/chunks/BackgroundTasksDialog-CL5NWsFL.js +0 -2
- package/dist/chunks/ClaudeMdExternalIncludesDialog-C0-psohX.js +0 -1
- package/dist/chunks/ConsoleOAuthFlow-4mOvEer_.js +0 -1
- package/dist/chunks/Doctor-DmgAwce2.js +0 -1
- package/dist/chunks/Doctor-jEs9chPk.js +0 -3
- package/dist/chunks/ExitFlow-DVKxFdpX.js +0 -2
- package/dist/chunks/InvalidConfigDialog-o9DF1REI.js +0 -1
- package/dist/chunks/MCPConnectionManager-CUTuaa8T.js +0 -1
- package/dist/chunks/MCPToolListView-CvqB4nCw.js +0 -1
- package/dist/chunks/MessageSelector-BLzw172f.js +0 -3
- package/dist/chunks/Messages-4K5sLmNh.js +0 -11
- package/dist/chunks/QueryEngine-DPHLSsax.js +0 -1
- package/dist/chunks/REPL-Bf46iQCN.js +0 -1
- package/dist/chunks/REPL-DIaAo9M9.js +0 -133
- package/dist/chunks/ResumeConversation-Br2KsBoe.js +0 -1
- package/dist/chunks/SearchExtraToolsTool-i_YO3QvV.js +0 -1
- package/dist/chunks/Settings-BMXysXIx.js +0 -2
- package/dist/chunks/TeleportRepoMismatchDialog-B5I73j7Y.js +0 -1
- package/dist/chunks/add-dir-CZ6Clvq8.js +0 -1
- package/dist/chunks/agents-DHnNg4h6.js +0 -103
- package/dist/chunks/allErrors-CU89tF-z.js +0 -1
- package/dist/chunks/api-BSeE6MwB.js +0 -1
- package/dist/chunks/auth-BIGJth5U.js +0 -1
- package/dist/chunks/auth-CDQMhIZP.js +0 -1
- package/dist/chunks/autonomyPanel-DnHpuiy4.js +0 -1
- package/dist/chunks/backgroundHousekeeping-B-cw0UcS.js +0 -17
- package/dist/chunks/backgroundHousekeeping-BS_8z3_x.js +0 -1
- package/dist/chunks/bg-50rllUNh.js +0 -1
- package/dist/chunks/bridgeConfig-BeqChxJC.js +0 -1
- package/dist/chunks/btw-DSK9R2C8.js +0 -1
- package/dist/chunks/caches-BTQAW9zc.js +0 -1
- package/dist/chunks/caches-BVtSCnV1.js +0 -1
- package/dist/chunks/ccrClient-Bu7Tf1Z5.js +0 -1
- package/dist/chunks/client-BWQ4-rN7.js +0 -1
- package/dist/chunks/client-c-3-PW1F.js +0 -1
- package/dist/chunks/commands-Bi7k3Wg-.js +0 -1
- package/dist/chunks/compact-J-h0Yf4b.js +0 -2
- package/dist/chunks/config-yyFe87vW.js +0 -1
- package/dist/chunks/context-Tb1Ca2Q-.js +0 -1
- package/dist/chunks/context-noninteractive-soPYKAc9.js +0 -1
- package/dist/chunks/conversation-CSEtUxOY.js +0 -1
- package/dist/chunks/conversation-Dk1WDQuN.js +0 -1
- package/dist/chunks/createSession-DkT1GL8y.js +0 -1
- package/dist/chunks/createSession-eE8mswkv.js +0 -1
- package/dist/chunks/crossProjectResume-04n3Ppy9.js +0 -40
- package/dist/chunks/debug-RAynG_nM.js +0 -39
- package/dist/chunks/detectRepository-DgpNd87p.js +0 -1
- package/dist/chunks/detectRepository-ctF9KDbb.js +0 -1
- package/dist/chunks/doctor-B-Wag4C1.js +0 -1
- package/dist/chunks/execSyncWrapper-BTZJjCuv.js +0 -1
- package/dist/chunks/exit-BtW7LfRX.js +0 -1
- package/dist/chunks/extractMemories-CUrdiNcr.js +0 -1
- package/dist/chunks/fast-C60p6AqJ.js +0 -1
- package/dist/chunks/firstPartyEventLogger-BfCYN7lt.js +0 -1
- package/dist/chunks/gemini-BwvSxGgn.js +0 -1
- package/dist/chunks/generateSessionName-DlrdedOk.js +0 -1
- package/dist/chunks/git-2c7WlGDL.js +0 -6
- package/dist/chunks/git-XtKbtJMc.js +0 -1
- package/dist/chunks/githubRepoPathMapping-DbWG4hFQ.js +0 -1
- package/dist/chunks/hooks-DWg07LmS.js +0 -1
- package/dist/chunks/jwtUtils-CUPXdX3W.js +0 -1
- package/dist/chunks/keybindings-DgIPdBy9.js +0 -2
- package/dist/chunks/loadAgentsDir-zikjxLvn.js +0 -1
- package/dist/chunks/loadPluginHooks-Cp8MSwAc.js +0 -1
- package/dist/chunks/localSearch-ZFyFy5FN.js +0 -1
- package/dist/chunks/main-9r5gLzUW.js +0 -605
- package/dist/chunks/managedEnv-B61yLpwp.js +0 -1
- package/dist/chunks/mcp-BckPBjaM.js +0 -6
- package/dist/chunks/mcp-CS1DA3JL.js +0 -1
- package/dist/chunks/memory-C5ohwh-T.js +0 -1
- package/dist/chunks/model-BGu1AGq0.js +0 -1
- package/dist/chunks/model-D19IIcll.js +0 -1
- package/dist/chunks/nativeInstaller-QB8cEJ18.js +0 -1
- package/dist/chunks/omit-DDUIPHnl.js +0 -1
- package/dist/chunks/onChangeAppState-RBl6H7ho.js +0 -1
- package/dist/chunks/panel-KW-wmEvU.js +0 -1
- package/dist/chunks/parser-xSBaQRLH.js +0 -1
- package/dist/chunks/permissions-BoLXYN1j.js +0 -3
- package/dist/chunks/pidLock-nJHbufJN.js +0 -3
- package/dist/chunks/plugin-C6-GQke5.js +0 -17
- package/dist/chunks/pluginAutoupdate-SlRFJlTT.js +0 -1
- package/dist/chunks/pluginBlocklist-n6Imlh3y.js +0 -1
- package/dist/chunks/pluginCliCommands-Bd96zSOQ.js +0 -1
- package/dist/chunks/pluginFlagging-DZaYzecY.js +0 -1
- package/dist/chunks/pluginOperations-D90IRawu.js +0 -2
- package/dist/chunks/pluginStartupCheck-Bxkxpm4k.js +0 -1
- package/dist/chunks/pluginStartupCheck-CB2q2dLv.js +0 -1
- package/dist/chunks/plugins-B9eSjLSA.js +0 -4
- package/dist/chunks/poorMode-BAnubpn1.js +0 -1
- package/dist/chunks/processBashCommand-B5F2Cl7K.js +0 -1
- package/dist/chunks/processSlashCommand-BC_D3cH5.js +0 -5
- package/dist/chunks/prompt-C1JPqinc.js +0 -1
- package/dist/chunks/prompt-DZhBz_Vu.js +0 -1
- package/dist/chunks/reconciler-B4GDm_iC.js +0 -1
- package/dist/chunks/refresh-DBVizOzg.js +0 -1
- package/dist/chunks/remoteManagedSettings-xh_MViZH.js +0 -1
- package/dist/chunks/resume-DVCSzKvv.js +0 -2
- package/dist/chunks/ripgrep-e-iewvTf.js +0 -1
- package/dist/chunks/sandbox-adapter-BFZFHplu.js +0 -1
- package/dist/chunks/searchExtraTools-ui5y2VSE.js +0 -1
- package/dist/chunks/sessionFileAccessHooks-CZvCqQJ6.js +0 -1
- package/dist/chunks/sessionObserver-Ba7um95p.js +0 -1
- package/dist/chunks/sessionStorage-CedwLLQs.js +0 -1
- package/dist/chunks/settings-DkDH7WQT.js +0 -1
- package/dist/chunks/settings-DnptdP79.js +0 -20
- package/dist/chunks/settingsSync-PmU7SmkU.js +0 -1
- package/dist/chunks/setup-BEsBuzsk.js +0 -3
- package/dist/chunks/sinks-BJHgxz6Y.js +0 -1
- package/dist/chunks/sinks-D5-yhcgU.js +0 -2
- package/dist/chunks/skillChangeDetector-Dd0WPdkO.js +0 -1
- package/dist/chunks/skillSearchPanel-CftorvAM.js +0 -21
- package/dist/chunks/startupProfiler-D4FBdEQr.js +0 -1
- package/dist/chunks/status-Dzuw3hBv.js +0 -2
- package/dist/chunks/switcher-4KzBvuKH.js +0 -1
- package/dist/chunks/syncCache-CBRiRU5x.js +0 -1
- package/dist/chunks/teleport-Bw0jSxe9.js +0 -1
- package/dist/chunks/toolPool-CkXFlqsn.js +0 -1
- package/dist/chunks/trustedDevice-CFf5yaG-.js +0 -1
- package/dist/chunks/trustedDevice-CuwSv8dG.js +0 -1
- package/dist/chunks/udsClient-e9dIkwVA.js +0 -1
- package/dist/chunks/useMainLoopModel-2-eujv0n.js +0 -1
- package/dist/chunks/useManagePlugins-CYBIkaB1.js +0 -1
- package/dist/chunks/util-VO98TdOz.js +0 -1
- package/dist/chunks/validatePlugin-Kk6pxnO2.js +0 -1
- package/dist/chunks/windowsPaths-BU3yQWTB.js +0 -1
- package/dist/chunks/windowsPaths-DgZ3YY4a.js +0 -1
- package/dist/chunks/worktree-dFUkhVE_.js +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e,t}from"./managedEnv-DhWRJ5DK.js";e();export{t as applyConfigEnvironmentVariables};
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-DaDcL9Zw.js";import{$E as t,Ax as n,Cg as r,Cx as i,Ex as a,Ip as o,Lp as s,Mu as c,Nu as l,Ox as u,QE as d,Sg as f,Tx as p,Ux as m,Wx as h,ad as ee,dS as g,eS as _,fS as v,iS as y,id as te,lS as b,lx as ne,mS as x,rf as S,rx as re,sx as ie,tS as ae,tf as C,vS as w,wx as oe}from"./loadAgentsDir-C7lOqvfh.js";import{D as T,H as se,I as E,P as D,T as O,fi as k,j as A,kn as j,t as M,y as N}from"./src-P_wYS_NJ2.js";import{t as P}from"./jsx-runtime-Bb4Xn-E0.js";import{H as F,z as I}from"./debug-RAynG_nM.js";import{c as L,h as R,o as z,v as B}from"./config-Do1870_d.js";import{n as V,o as H}from"./process-gEbdy6uY.js";import{i as U,o as W}from"./platform-BMPbglug.js";import{s as G,u as ce}from"./types-3j8PS-Du.js";import{n as le,r as K}from"./analytics-DJobLaWP.js";import{l as q,o as ue}from"./stringUtils-C84IJ91d.js";import{n as J,t as Y}from"./exit-BOhGfSlm.js";import{stat as de}from"fs/promises";import{cwd as fe}from"process";d();var X=e(k(),1);S(),V(),M(),x(),ue(),s(),ee();var Z=P();function pe({servers:e,scope:t,onDone:n}){let r=Object.keys(e),[i,a]=(0,X.useState)({});(0,X.useEffect)(()=>{b().then(({servers:e})=>a(e))},[]);let s=r.filter(e=>i[e]!==void 0);async function c(n){let r=0;for(let a of n){let n=e[a];if(n){let e=a;if(i[e]!==void 0){let t=1;for(;i[`${a}_${t}`]!==void 0;)t++;e=`${a}_${t}`}await y(e,n,t),r++}}u(r)}let[l]=se(),u=(0,X.useCallback)(e=>{H(e>0?`\n${A(`success`,l)(`Successfully imported ${e} MCP ${q(e,`server`)} to ${t} config.`)}\n`:`
|
|
2
|
-
No servers were imported.`),n(),C()},[l,t,n]),d=(0,X.useCallback)(()=>{u(0)},[u]);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(N,{title:`Import MCP Servers from Claude Desktop`,subtitle:`Found ${r.length} MCP ${q(r.length,`server`)} in Claude Desktop.`,color:`success`,onCancel:d,hideInputGuide:!0,children:[s.length>0&&(0,Z.jsx)(D,{color:`warning`,children:`Note: Some servers already exist with the same name. If selected, they will be imported with a numbered suffix.`}),(0,Z.jsx)(D,{children:`Please select the servers you want to import:`}),(0,Z.jsx)(te,{options:r.map(e=>({label:`${e}${s.includes(e)?` (already exists)`:``}`,value:e})),defaultValue:r.filter(e=>!s.includes(e)),onSubmit:c,onCancel:d,hideIndexes:!0})]}),(0,Z.jsx)(E,{paddingX:1,children:(0,Z.jsx)(D,{dimColor:!0,italic:!0,children:(0,Z.jsxs)(O,{children:[(0,Z.jsx)(T,{shortcut:`Space`,action:`select`}),(0,Z.jsx)(T,{shortcut:`Enter`,action:`confirm`}),(0,Z.jsx)(o,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})]})})})]})}M(),l(),le(),a(),ne(),x(),ae(),r(),R(),I(),S(),G(),W();async function Q(e,t){try{let n=await re(e,t);return n.type===`connected`?`✓ Connected`:n.type===`needs-auth`?`! Needs authentication`:`✗ Failed to connect`}catch{return`✗ Connection error`}}async function me({debug:e,verbose:t}){let n=fe();K(`tengu_mcp_start`,{});try{await de(n)}catch(e){throw F(e)&&Y(`Error: Directory ${n} does not exist`),e}try{let{setup:r}=await import(`./setup-BEsBuzsk.js`);await r(n,`default`,!1,!1,void 0,!1);let{startMCPServer:i}=await import(`./mcp-VcGPYCkW.js`);await i(n,e??!1,t??!1)}catch(e){Y(`Error: Failed to start MCP server: ${e}`)}}async function he(e,t){let n=g(e),r=()=>{n&&(n.type===`sse`||n.type===`http`)&&(oe(e,n),i(e,n))};try{if(t.scope){let n=h(t.scope);K(`tengu_mcp_delete`,{name:e,scope:n}),await w(e,n),r(),process.stdout.write(`Removed MCP server ${e} from ${n} config\n`),J(`File modified: ${m(n)}`)}let n=z(),i=L(),{servers:a}=v(`project`),o=!!a[e],s=[];if(n.mcpServers?.[e]&&s.push(`local`),o&&s.push(`project`),i.mcpServers?.[e]&&s.push(`user`),s.length===0)Y(`No MCP server found with name: "${e}"`);else if(s.length===1){let t=s[0];K(`tengu_mcp_delete`,{name:e,scope:t}),await w(e,t),r(),process.stdout.write(`Removed MCP server "${e}" from ${t} config\n`),J(`File modified: ${m(t)}`)}else process.stderr.write(`MCP server "${e}" exists in multiple scopes:\n`),s.forEach(e=>{process.stderr.write(` - ${_(e)} (${m(e)})\n`)}),process.stderr.write(`
|
|
3
|
-
To remove from a specific scope, use:
|
|
4
|
-
`),s.forEach(t=>{process.stderr.write(` claude mcp remove "${e}" -s ${t}\n`)}),Y()}catch(e){Y(e.message)}}async function ge(){K(`tengu_mcp_list`,{});let{servers:e}=await b();if(Object.keys(e).length===0)console.log("No MCP servers configured. Use `claude mcp add` to add a server.");else{console.log(`Checking MCP server health...
|
|
5
|
-
`);let n=await t(Object.entries(e),async([e,t])=>({name:e,server:t,status:await Q(e,t)}),{concurrency:ie()});for(let{name:e,server:t,status:r}of n)if(t.type===`sse`)console.log(`${e}: ${t.url} (SSE) - ${r}`);else if(t.type===`http`)console.log(`${e}: ${t.url} (HTTP) - ${r}`);else if(t.type===`claudeai-proxy`)console.log(`${e}: ${t.url} - ${r}`);else if(!t.type||t.type===`stdio`){let n=t,i=Array.isArray(n.args)?n.args:[];console.log(`${e}: ${n.command} ${i.join(` `)} - ${r}`)}}await C(0)}async function $(e){K(`tengu_mcp_get`,{name:e});let t=g(e);t||Y(`No MCP server found with name: ${e}`),console.log(`${e}:`),console.log(` Scope: ${_(t.scope)}`);let n=await Q(e,t);if(console.log(` Status: ${n}`),t.type===`sse`){if(console.log(` Type: sse`),console.log(` URL: ${t.url}`),t.headers){console.log(` Headers:`);for(let[e,n]of Object.entries(t.headers))console.log(` ${e}: ${n}`)}if(t.oauth?.clientId||t.oauth?.callbackPort){let n=[];t.oauth.clientId&&(n.push(`client_id configured`),p(e,t)?.clientSecret&&n.push(`client_secret configured`)),t.oauth.callbackPort&&n.push(`callback_port ${t.oauth.callbackPort}`),console.log(` OAuth: ${n.join(`, `)}`)}}else if(t.type===`http`){if(console.log(` Type: http`),console.log(` URL: ${t.url}`),t.headers){console.log(` Headers:`);for(let[e,n]of Object.entries(t.headers))console.log(` ${e}: ${n}`)}if(t.oauth?.clientId||t.oauth?.callbackPort){let n=[];t.oauth.clientId&&(n.push(`client_id configured`),p(e,t)?.clientSecret&&n.push(`client_secret configured`)),t.oauth.callbackPort&&n.push(`callback_port ${t.oauth.callbackPort}`),console.log(` OAuth: ${n.join(`, `)}`)}}else if(t.type===`stdio`){console.log(` Type: stdio`),console.log(` Command: ${t.command}`);let e=Array.isArray(t.args)?t.args:[];if(console.log(` Args: ${e.join(` `)}`),t.env){console.log(` Environment:`);for(let[e,n]of Object.entries(t.env))console.log(` ${e}=${n}`)}}console.log(`\nTo remove this server, run: claude mcp remove "${e}" -s ${t.scope}`),await C(0)}async function _e(e,t,r){try{let i=h(r.scope),a=ce(t),o=r.clientSecret&&a&&typeof a==`object`&&`type`in a&&(a.type===`sse`||a.type===`http`)&&`url`in a&&typeof a.url==`string`&&`oauth`in a&&a.oauth&&typeof a.oauth==`object`&&`clientId`in a.oauth?await u():void 0;await y(e,a,i);let s=a&&typeof a==`object`&&`type`in a?String(a.type||`stdio`):`stdio`;o&&a&&typeof a==`object`&&`type`in a&&(a.type===`sse`||a.type===`http`)&&`url`in a&&typeof a.url==`string`&&n(e,{type:a.type,url:a.url},o),K(`tengu_mcp_add`,{scope:i,source:`json`,type:s}),J(`Added ${s} MCP server ${e} to ${i} config`)}catch(e){Y(e.message)}}async function ve(e){try{let t=h(e.scope);K(`tengu_mcp_add`,{scope:t,platform:U(),source:`desktop`});let{readClaudeDesktopMcpServers:n}=await import(`./claudeDesktop-CsJfF1b-.js`),r=await n();Object.keys(r).length===0&&J(`No MCP servers found in Claude Desktop configuration or configuration file does not exist.`);let{unmount:i}=await j((0,Z.jsx)(f,{children:(0,Z.jsx)(c,{children:(0,Z.jsx)(pe,{servers:r,scope:t,onDone:()=>{i()}})})}),{exitOnCtrlC:!0})}catch(e){Y(e.message)}}async function ye(){K(`tengu_mcp_reset_mcpjson_choices`,{}),B(e=>({...e,enabledMcpjsonServers:[],disabledMcpjsonServers:[],enableAllProjectMcpServers:!1})),J(`All project-scoped (.mcp.json) server approvals and rejections have been reset.
|
|
6
|
-
You will be prompted for approval next time you start Work Mate.`)}export{ve as mcpAddFromDesktopHandler,_e as mcpAddJsonHandler,$ as mcpGetHandler,ge as mcpListHandler,he as mcpRemoveHandler,ye as mcpResetChoicesHandler,me as mcpServeHandler};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{n,t as r}from"./figures-5ThXQEtq.js";import{Cg as i,Dx as a,Ex as o,Ip as s,Iu as c,Lp as l,Qx as u,Ru as d,Sx as f,Tg as p,Ux as m,Xx as h,nd as ee,qC as g,tS as _,td as te,wg as v,xx as y}from"./loadAgentsDir-C7lOqvfh.js";import{D as b,Gt as ne,H as x,I as S,Lt as C,P as w,T,Wt as E,fi as D,j as O,t as k,y as A}from"./src-P_wYS_NJ2.js";import{t as j}from"./jsx-runtime-Bb4Xn-E0.js";import{a as re,o as ie}from"./debug-RAynG_nM.js";import{l as ae,n as oe,o as M}from"./stringUtils-C84IJ91d.js";import{A as se,k as ce}from"./sessionState-Bifmu95-.js";import{i as le,n as N,r as ue}from"./MCPConnectionManager-CUTuaa8T.js";import{n as de,t as fe}from"./McpParsingWarnings-BCpfHaBK.js";import{a as pe,c as P,i as F,n as I,o as L,r as me,s as he,t as ge}from"./MCPToolListView-CvqB4nCw.js";function _e({agentServer:e,onCancel:t,onComplete:n}){let[i]=x(),[o,l]=(0,R.useState)(!1),[u,d]=(0,R.useState)(null),[f,p]=(0,R.useState)(null),m=(0,R.useRef)(null);(0,R.useEffect)(()=>()=>m.current?.abort(),[]),E(`confirm:no`,(0,R.useCallback)(()=>{o&&(m.current?.abort(),m.current=null,l(!1),p(null))},[o]),{context:`Confirmation`,isActive:o});let h=(0,R.useCallback)(async()=>{if(!e.needsAuth||!e.url)return;l(!0),d(null);let t=new AbortController;m.current=t;try{let r={type:e.transport,url:e.url};await a(e.name,r,p,t.signal),n?.(`Authentication successful for ${e.name}. The server will connect when the agent runs.`)}catch(e){e instanceof Error&&!(e instanceof y)&&d(e.message)}finally{l(!1),m.current=null}},[e,n]),g=oe(String(e.name));if(o)return(0,z.jsxs)(S,{flexDirection:`column`,gap:1,padding:1,children:[(0,z.jsxs)(w,{color:`claude`,children:[`Authenticating with `,e.name,`…`]}),(0,z.jsxs)(S,{children:[(0,z.jsx)(c,{}),(0,z.jsx)(w,{children:` A browser window will open for authentication`})]}),f&&(0,z.jsxs)(S,{flexDirection:`column`,children:[(0,z.jsx)(w,{dimColor:!0,children:`If your browser doesn't open automatically, copy this URL manually:`}),(0,z.jsx)(C,{url:f})]}),(0,z.jsx)(S,{marginLeft:3,children:(0,z.jsxs)(w,{dimColor:!0,children:[`Return here after authenticating in your browser.`,` `,(0,z.jsx)(s,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`})]})})]});let _=[];return e.needsAuth&&_.push({label:e.isAuthenticated?`Re-authenticate`:`Authenticate`,value:`auth`}),_.push({label:`Back`,value:`back`}),(0,z.jsxs)(A,{title:`${g} MCP Server`,subtitle:`agent-only`,onCancel:t,inputGuide:e=>e.pending?(0,z.jsxs)(w,{children:[`Press `,e.keyName,` again to exit`]}):(0,z.jsxs)(T,{children:[(0,z.jsx)(b,{shortcut:`↑↓`,action:`navigate`}),(0,z.jsx)(b,{shortcut:`Enter`,action:`confirm`}),(0,z.jsx)(s,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`})]}),children:[(0,z.jsxs)(S,{flexDirection:`column`,gap:0,children:[(0,z.jsxs)(S,{children:[(0,z.jsx)(w,{bold:!0,children:`Type: `}),(0,z.jsx)(w,{dimColor:!0,children:e.transport})]}),e.url&&(0,z.jsxs)(S,{children:[(0,z.jsx)(w,{bold:!0,children:`URL: `}),(0,z.jsx)(w,{dimColor:!0,children:e.url})]}),e.command&&(0,z.jsxs)(S,{children:[(0,z.jsx)(w,{bold:!0,children:`Command: `}),(0,z.jsx)(w,{dimColor:!0,children:e.command})]}),(0,z.jsxs)(S,{children:[(0,z.jsx)(w,{bold:!0,children:`Used by: `}),(0,z.jsx)(w,{dimColor:!0,children:e.sourceAgents.join(`, `)})]}),(0,z.jsxs)(S,{marginTop:1,children:[(0,z.jsx)(w,{bold:!0,children:`Status: `}),(0,z.jsxs)(w,{children:[O(`inactive`,i)(r.radioOff),` not connected (agent-only)`]})]}),e.needsAuth&&(0,z.jsxs)(S,{children:[(0,z.jsx)(w,{bold:!0,children:`Auth: `}),e.isAuthenticated?(0,z.jsxs)(w,{children:[O(`success`,i)(r.tick),` authenticated`]}):(0,z.jsxs)(w,{children:[O(`warning`,i)(r.triangleUpOutline),` may need authentication`]})]})]}),(0,z.jsx)(S,{children:(0,z.jsx)(w,{dimColor:!0,children:`This server connects only when running the agent.`})}),u&&(0,z.jsx)(S,{children:(0,z.jsxs)(w,{color:`error`,children:[`Error: `,u]})}),(0,z.jsx)(S,{children:(0,z.jsx)(ee,{options:_,onChange:async e=>{switch(e){case`auth`:await h();break;case`back`:t();break}},onCancel:t})})]})}var R,z,B=e((()=>{n(),R=t(D(),1),k(),g(),o(),M(),l(),te(),d(),z=j()}));function V(e){switch(e){case`project`:return{label:`Project MCPs`,path:m(e)};case`user`:return{label:`User MCPs`,path:m(e)};case`local`:return{label:`Local MCPs`,path:m(e)};case`enterprise`:return{label:`Enterprise MCPs`};case`dynamic`:return{label:`Built-in MCPs`,path:`always available`};default:return{label:e}}}function ve(e){let t=new Map;for(let n of e){let e=n.scope;t.has(e)||t.set(e,[]),t.get(e).push(n)}for(let[,e]of t)e.sort((e,t)=>e.name.localeCompare(t.name));return t}function ye({servers:e,agentServers:t=[],onSelectServer:n,onSelectAgentServer:i,onComplete:a}){let[o]=x(),[c,l]=(0,H.useState)(0),u=H.useMemo(()=>ve(e.filter(e=>e.client.config.type!==`claudeai-proxy`)),[e]),d=H.useMemo(()=>e.filter(e=>e.client.config.type===`claudeai-proxy`).sort((e,t)=>e.name.localeCompare(t.name)),[e]),f=H.useMemo(()=>(u.get(`dynamic`)??[]).sort((e,t)=>e.name.localeCompare(t.name)),[u]),p=V(`dynamic`),m=H.useMemo(()=>{let e=[];for(let t of W){let n=u.get(t)??[];for(let t of n)e.push({type:`server`,server:t})}for(let t of d)e.push({type:`server`,server:t});for(let n of t)e.push({type:`agent-server`,agentServer:n});for(let t of f)e.push({type:`server`,server:t});return e},[u,d,t,f]),h=(0,H.useCallback)(()=>{a(`MCP dialog dismissed`,{display:`system`})},[a]);ne({"confirm:previous":()=>l(e=>e===0?m.length-1:e-1),"confirm:next":()=>l(e=>e===m.length-1?0:e+1),"confirm:yes":(0,H.useCallback)(()=>{let e=m[c];e&&(e.type===`server`?n(e.server):e.type===`agent-server`&&i&&i(e.agentServer))},[m,c,n,i]),"confirm:no":h},{context:`Confirmation`});let ee=e=>m.findIndex(t=>t.type===`server`&&t.server===e),g=e=>m.findIndex(t=>t.type===`agent-server`&&t.agentServer===e),_=ie(),te=e.some(e=>e.client.type===`failed`);if(e.length===0&&t.length===0)return null;let v=e=>{let t=ee(e),n=c===t,i=``,a=``;if(e.client.type===`disabled`)i=O(`inactive`,o)(r.radioOff),a=`disabled`;else if(e.client.type===`connected`)i=O(`success`,o)(r.tick),a=`connected`;else if(e.client.type===`pending`){i=O(`inactive`,o)(r.radioOff);let{reconnectAttempt:t,maxReconnectAttempts:n}=e.client;a=t&&n?`reconnecting (${t}/${n})…`:`connecting…`}else e.client.type===`needs-auth`?(i=O(`warning`,o)(r.triangleUpOutline),a=`needs authentication`):(i=O(`error`,o)(r.cross),a=`failed`);return(0,U.jsxs)(S,{children:[(0,U.jsx)(w,{color:n?`suggestion`:void 0,children:n?`${r.pointer} `:` `}),(0,U.jsx)(w,{color:n?`suggestion`:void 0,children:e.name}),(0,U.jsxs)(w,{dimColor:!n,children:[` · `,i,` `]}),(0,U.jsx)(w,{dimColor:!n,children:a})]},`${e.name}-${t}`)},y=e=>{let t=g(e),n=c===t,i=e.needsAuth?O(`warning`,o)(r.triangleUpOutline):O(`inactive`,o)(r.radioOff),a=e.needsAuth?`may need auth`:`agent-only`;return(0,U.jsxs)(S,{children:[(0,U.jsx)(w,{color:n?`suggestion`:void 0,children:n?`${r.pointer} `:` `}),(0,U.jsx)(w,{color:n?`suggestion`:void 0,children:e.name}),(0,U.jsxs)(w,{dimColor:!n,children:[` · `,i,` `]}),(0,U.jsx)(w,{dimColor:!n,children:a})]},`agent-${e.name}-${t}`)},E=e.length+t.length;return(0,U.jsxs)(S,{flexDirection:`column`,children:[(0,U.jsx)(fe,{}),(0,U.jsx)(A,{title:`Manage MCP servers`,subtitle:`${E} ${ae(E,`server`)}`,onCancel:h,hideInputGuide:!0,children:(0,U.jsxs)(S,{flexDirection:`column`,children:[W.map(e=>{let t=u.get(e);if(!t||t.length===0)return null;let n=V(e);return(0,U.jsxs)(S,{flexDirection:`column`,marginBottom:1,children:[(0,U.jsxs)(S,{paddingLeft:2,children:[(0,U.jsx)(w,{bold:!0,children:n.label}),n.path&&(0,U.jsxs)(w,{dimColor:!0,children:[` (`,n.path,`)`]})]}),t.map(e=>v(e))]},e)}),d.length>0&&(0,U.jsxs)(S,{flexDirection:`column`,marginBottom:1,children:[(0,U.jsx)(S,{paddingLeft:2,children:(0,U.jsx)(w,{bold:!0,children:`claude.ai`})}),d.map(e=>v(e))]}),t.length>0&&(0,U.jsxs)(S,{flexDirection:`column`,marginBottom:1,children:[(0,U.jsx)(S,{paddingLeft:2,children:(0,U.jsx)(w,{bold:!0,children:`Agent MCPs`})}),[...new Set(t.flatMap(e=>e.sourceAgents))].map(e=>(0,U.jsxs)(S,{flexDirection:`column`,marginTop:1,children:[(0,U.jsx)(S,{paddingLeft:2,children:(0,U.jsxs)(w,{dimColor:!0,children:[`@`,e]})}),t.filter(t=>t.sourceAgents.includes(e)).map(e=>y(e))]},e))]}),f.length>0&&(0,U.jsxs)(S,{flexDirection:`column`,marginBottom:1,children:[(0,U.jsxs)(S,{paddingLeft:2,children:[(0,U.jsx)(w,{bold:!0,children:p.label}),p.path&&(0,U.jsxs)(w,{dimColor:!0,children:[` (`,p.path,`)`]})]}),f.map(e=>v(e))]}),(0,U.jsxs)(S,{flexDirection:`column`,children:[te&&(0,U.jsx)(w,{dimColor:!0,children:_?`※ Error logs shown inline with --debug`:`※ Run claude --debug to see error logs`}),(0,U.jsxs)(w,{dimColor:!0,children:[(0,U.jsx)(C,{url:`https://code.claude.com/docs/en/mcp`,children:`https://code.claude.com/docs/en/mcp`}),` for help`]})]})]})}),(0,U.jsx)(S,{paddingX:1,children:(0,U.jsx)(w,{dimColor:!0,italic:!0,children:(0,U.jsxs)(T,{children:[(0,U.jsx)(b,{shortcut:`↑↓`,action:`navigate`}),(0,U.jsx)(b,{shortcut:`Enter`,action:`confirm`}),(0,U.jsx)(s,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})]})})})]})}var H,U,W,G=e((()=>{n(),H=t(D(),1),k(),g(),_(),re(),M(),l(),de(),U=j(),W=[`project`,`local`,`user`,`enterprise`]}));function be({serverName:e,onComplete:t}){let[n]=x(),i=p(),a=ue(),[o,s]=(0,K.useState)(!0),[l,u]=(0,K.useState)(null);return(0,K.useEffect)(()=>{async function n(){try{if(!i.getState().mcp.clients.find(t=>t.name===e)){u(`MCP server "${e}" not found`),s(!1),t(`MCP server "${e}" not found`);return}switch((await a(e)).client.type){case`connected`:s(!1),t(`Successfully reconnected to ${e}`);break;case`needs-auth`:u(`${e} requires authentication`),s(!1),t(`${e} requires authentication. Use /mcp to authenticate.`);break;case`pending`:case`failed`:case`disabled`:u(`Failed to reconnect to ${e}`),s(!1),t(`Failed to reconnect to ${e}`);break}}catch(e){let n=e instanceof Error?e.message:String(e);u(n),s(!1),t(`Error: ${n}`)}}n()},[e,a,i,t]),o?(0,q.jsxs)(S,{flexDirection:`column`,gap:1,padding:1,children:[(0,q.jsxs)(w,{color:`text`,children:[`Reconnecting to `,(0,q.jsx)(w,{bold:!0,children:e})]}),(0,q.jsxs)(S,{children:[(0,q.jsx)(c,{}),(0,q.jsx)(w,{children:` Establishing connection to MCP server`})]})]}):l?(0,q.jsxs)(S,{flexDirection:`column`,gap:1,padding:1,children:[(0,q.jsxs)(S,{children:[(0,q.jsxs)(w,{children:[O(`error`,n)(r.cross),` `]}),(0,q.jsxs)(w,{color:`error`,children:[`Failed to reconnect to `,e]})]}),(0,q.jsxs)(w,{dimColor:!0,children:[`Error: `,l]})]}):null}var K,q,J=e((()=>{n(),K=t(D(),1),k(),N(),i(),d(),q=j()}));function Y({onComplete:e}){let t=v(e=>e.mcp),n=v(e=>e.agentDefinitions),r=t.clients,[i,a]=X.useState({type:`list`}),[o,s]=X.useState([]),c=(0,X.useMemo)(()=>h(n.allAgents),[n.allAgents]),l=X.useMemo(()=>r.filter(e=>e.name!==`ide`).sort((e,t)=>e.name.localeCompare(t.name)),[r]);switch(X.useEffect(()=>{let e=!1;async function n(){let n=await Promise.all(l.map(async e=>{let n=e.config.scope,r=e.config.type===`sse`,i=e.config.type===`http`,a=e.config.type===`claudeai-proxy`,o;if(r||i){let n=await new f(e.name,e.config).tokens(),r=ce()!==null&&e.type===`connected`,i=e.type===`connected`&&u(t.tools,e.name).length>0;o=!!n||r||i}let s={name:e.name,client:e,scope:n};return a?{...s,transport:`claudeai-proxy`,isAuthenticated:!1,config:e.config}:r?{...s,transport:`sse`,isAuthenticated:o,config:e.config}:i?{...s,transport:`http`,isAuthenticated:o,config:e.config}:{...s,transport:`stdio`,config:e.config}}));e||s(n)}return n(),()=>{e=!0}},[l,t.tools]),(0,X.useEffect)(()=>{o.length===0&&l.length>0||o.length===0&&c.length===0&&e("No MCP servers configured. Please run /doctor if this is unexpected. Otherwise, run `claude mcp --help` or visit https://code.claude.com/docs/en/mcp to learn more.")},[o.length,l.length,c.length,e]),i.type){case`list`:return(0,Z.jsx)(ye,{servers:o,agentServers:c,onSelectServer:e=>a({type:`server-menu`,server:e}),onSelectAgentServer:e=>a({type:`agent-server-menu`,agentServer:e}),onComplete:e,defaultTab:i.defaultTab});case`server-menu`:{let n=u(t.tools,i.server.name),r=i.server.transport===`claudeai-proxy`?`claude.ai`:`Work Mate`;return i.server.transport===`stdio`?(0,Z.jsx)(pe,{server:i.server,serverToolsCount:n.length,onViewTools:()=>a({type:`server-tools`,server:i.server}),onCancel:()=>a({type:`list`,defaultTab:r}),onComplete:e}):(0,Z.jsx)(he,{server:i.server,serverToolsCount:n.length,onViewTools:()=>a({type:`server-tools`,server:i.server}),onCancel:()=>a({type:`list`,defaultTab:r}),onComplete:e})}case`server-tools`:return(0,Z.jsx)(ge,{server:i.server,onSelectTool:(e,t)=>a({type:`server-tool-detail`,server:i.server,toolIndex:t}),onBack:()=>a({type:`server-menu`,server:i.server})});case`server-tool-detail`:{let e=u(t.tools,i.server.name)[i.toolIndex];return e?(0,Z.jsx)(me,{tool:e,server:i.server,onBack:()=>a({type:`server-tools`,server:i.server})}):(a({type:`server-tools`,server:i.server}),null)}case`agent-server-menu`:return(0,Z.jsx)(_e,{agentServer:i.agentServer,onCancel:()=>a({type:`list`,defaultTab:`Agents`}),onComplete:e})}}var X,Z,xe=e((()=>{X=t(D(),1),o(),_(),i(),se(),B(),G(),P(),L(),F(),I(),Z=j()})),Se=e((()=>{B(),G(),J(),P(),xe(),L(),F(),I()}));function Ce({action:e,target:t,onComplete:n}){let r=v(e=>e.mcp.clients),i=le(),a=(0,Q.useRef)(!1);return(0,Q.useEffect)(()=>{if(a.current)return;a.current=!0;let o=e===`enable`,s=r.filter(e=>e.name!==`ide`),c=t===`all`?s.filter(e=>o?e.type===`disabled`:e.type!==`disabled`):s.filter(e=>e.name===t);if(c.length===0){n(t===`all`?`All MCP servers are already ${o?`enabled`:`disabled`}`:`MCP server "${t}" not found`);return}for(let e of c)i(e.name);n(t===`all`?`${o?`Enabled`:`Disabled`} ${c.length} MCP server(s)`:`MCP server "${t}" ${o?`enabled`:`disabled`}`)},[e,t,r,i,n]),null}async function we(e,t,n){if(n){let t=n.trim().split(/\s+/);if(t[0]===`no-redirect`)return(0,$.jsx)(Y,{onComplete:e});if(t[0]===`reconnect`&&t[1])return(0,$.jsx)(be,{serverName:t.slice(1).join(` `),onComplete:e});if(t[0]===`enable`||t[0]===`disable`)return(0,$.jsx)(Ce,{action:t[0],target:t.length>1?t.slice(1).join(` `):`all`,onComplete:e})}return(0,$.jsx)(Y,{onComplete:e})}var Q,$;e((()=>{Q=t(D(),1),Se(),J(),N(),i(),$=j()}))();export{we as call};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{n,o as r}from"./envUtils-BDhHQY0-.js";import{Cg as i,Hc as a,LS as o,Sb as s,Sf as c,Uc as l,VE as u,nd as ee,qC as d,td as f,wb as p,wg as m,xf as h,yb as g,zE as te,zS as ne}from"./loadAgentsDir-C7lOqvfh.js";import{I as _,Lt as v,P as y,Wt as b,_ as x,di as S,fi as C,t as w,ui as re,y as T}from"./src-P_wYS_NJ2.js";import{t as E}from"./jsx-runtime-Bb4Xn-E0.js";import{Wt as D,et as O}from"./state-BemZdQIl.js";import{n as k,t as A}from"./cwd-Cfdf7z7s.js";import{I as j,z as M}from"./debug-RAynG_nM.js";import{Cn as N,bn as ie,g as P,x as F}from"./settings-DnptdP79.js";import{M as I,P as L,k as ae}from"./config-Do1870_d.js";import{m as R,r as z}from"./git-2c7WlGDL.js";import{o as oe,s as se}from"./log-CezCRpAN.js";import{n as ce,r as B}from"./analytics-DJobLaWP.js";import{m as le,v as V}from"./startupProfiler-L_UWZ03w.js";import{n as H,t as U}from"./useExitOnCtrlCDWithKeybindings-ChqBs9Lr.js";import{r as ue,t as de}from"./promptEditor-DhcZY-iu.js";import{homedir as fe}from"os";import{join as W,relative as pe}from"path";import{mkdir as G,writeFile as me}from"fs/promises";function he(e){return z(e)!==null}var ge=e((()=>{R()}));function _e({onSelect:e,onCancel:t}){let r=(0,K.use)(s()),i=W(n(),`CLAUDE.md`),a=W(O(),`CLAUDE.md`),o=r.some(e=>e.path===i),u=r.some(e=>e.path===a),d=[...r.filter(e=>e.type!==`AutoMem`).map(e=>({...e,exists:!0})),...o?[]:[{path:i,type:`User`,content:``,exists:!1}],...u?[]:[{path:a,type:`Project`,content:``,exists:!1}]],f=new Map,p=d.map(e=>{let t=ie(e.path),n=e.exists?``:` (new)`,r=e.parent?(f.get(e.parent)??0)+1:0;f.set(e.path,r);let o=r>0?` `.repeat(r-1):``,s;s=e.type===`User`&&!e.isNested&&e.path===i?`User memory`:e.type===`Project`&&!e.isNested&&e.path===a?`Project memory`:r>0?`${o}L ${t}${n}`:`${t}`;let c,l=he(O());return c=e.type===`User`&&!e.isNested?`Saved in ~/.claude/CLAUDE.md`:e.type===`Project`&&!e.isNested&&e.path===a?`${l?`Checked in at`:`Saved in`} ./CLAUDE.md`:e.parent?`@-imported`:e.isNested?`dynamically loaded`:``,{label:s,value:e.path,description:c}}),h=[],g=m(e=>e.agentDefinitions);if(L()){h.push({label:`Open auto-memory folder`,value:`${Y}${ae()}`,description:``});for(let e of g.activeAgents)if(e.memory){let t=te(e.agentType,e.memory);h.push({label:`Open ${re.bold(e.agentType)} agent memory`,value:`${Y}${t}`,description:`${e.memory} scope`})}}p.push(...h);let v=J&&p.some(e=>e.value===J)?J:p[0]?.value||``,[S,C]=(0,K.useState)(L),[w,T]=(0,K.useState)(l),[E]=(0,K.useState)(L),D=m(e=>Object.values(e.tasks).some(e=>e.type===`dream`&&e.status===`running`)),[k,A]=(0,K.useState)(null);(0,K.useEffect)(()=>{E&&c().then(A)},[E,D]);let j=D?`running`:k===null?``:k===0?`never`:`last ran ${le(new Date(k))}`,[M,N]=(0,K.useState)(null),P=M!==null,I=+!!E;function R(){let e=!S;F(`userSettings`,{autoMemoryEnabled:e}),C(e),B(`tengu_auto_memory_toggled`,{enabled:e})}function z(){let e=!w;F(`userSettings`,{autoDreamEnabled:e}),T(e),B(`tengu_auto_dream_toggled`,{enabled:e})}return H(),b(`confirm:no`,t,{context:`Confirmation`}),b(`confirm:yes`,()=>{M===0?R():M===1&&z()},{context:`Confirmation`,isActive:P}),b(`select:next`,()=>{N(e=>e!==null&&e<I?e+1:null)},{context:`Select`,isActive:P}),b(`select:previous`,()=>{N(e=>e!==null&&e>0?e-1:e)},{context:`Select`,isActive:P}),(0,q.jsxs)(_,{flexDirection:`column`,width:`100%`,children:[(0,q.jsxs)(_,{flexDirection:`column`,marginBottom:1,children:[(0,q.jsx)(x,{isFocused:M===0,children:(0,q.jsxs)(y,{children:[`Auto-memory: `,S?`on`:`off`]})}),E&&(0,q.jsx)(x,{isFocused:M===1,styled:!1,children:(0,q.jsxs)(y,{color:M===1?`suggestion`:void 0,children:[`Auto-dream: `,w?`on`:`off`,j&&(0,q.jsxs)(y,{dimColor:!0,children:[` · `,j]}),!D&&w&&(0,q.jsx)(y,{dimColor:!0,children:` · /dream to run`})]})})]}),(0,q.jsx)(ee,{defaultFocusValue:v,options:p,isDisabled:P,onChange:t=>{if(t.startsWith(Y)){let e=t.slice(15);G(e,{recursive:!0}).catch(()=>{}).then(()=>ne(e));return}J=t,e(t)},onCancel:t,onUpFromFirstItem:()=>N(I)})]})}var K,q,J,Y,X=e((()=>{S(),C(),K=t(C(),1),D(),U(),w(),d(),I(),ce(),a(),h(),i(),u(),o(),p(),r(),N(),V(),ge(),P(),f(),q=E(),Y=`__open_folder__`}));function ve(e){let t=fe(),n=A(),r=e.startsWith(t)?`~`+e.slice(t.length):null,i=e.startsWith(n)?`./`+pe(n,e):null;return r&&i?r.length<=i.length?r:i:r||i||e}var ye=e((()=>{C(),w(),k(),E()}));function be({onDone:e}){let t=async t=>{try{t.includes(n())&&await G(n(),{recursive:!0});try{await me(t,``,{encoding:`utf8`,flag:`wx`})}catch(e){if(j(e)!==`EEXIST`)throw e}await de(t);let r=`default`,i=``;process.env.VISUAL?(r=`$VISUAL`,i=process.env.VISUAL):process.env.EDITOR&&(r=`$EDITOR`,i=process.env.EDITOR);let a=r==="default"?``:`Using ${r}="${i}".`,o=a?`> ${a} To change editor, set $EDITOR or $VISUAL environment variable.`:`> To use a different editor, set the $EDITOR or $VISUAL environment variable.`;e(`Opened memory file at ${ve(t)}\n\n${o}`,{display:`system`})}catch(t){se(t),e(`Error opening memory file: ${t}`)}},r=()=>{e(`Cancelled memory editing`,{display:`system`})};return(0,Q.jsx)(T,{title:`Memory`,onCancel:r,color:`remember`,children:(0,Q.jsxs)(_,{flexDirection:`column`,children:[(0,Q.jsx)(Z.Suspense,{fallback:null,children:(0,Q.jsx)(_e,{onSelect:t,onCancel:r})}),(0,Q.jsx)(_,{marginTop:1,children:(0,Q.jsxs)(y,{dimColor:!0,children:[`Learn more: `,(0,Q.jsx)(v,{url:`https://code.claude.com/docs/en/memory`})]})})]})})}var Z,Q,$;e((()=>{Z=t(C(),1),w(),X(),ye(),p(),r(),M(),oe(),ue(),Q=E(),$=async e=>(g(),await s(),(0,Q.jsx)(be,{onDone:e}))}))();export{$ as call};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{Ap as n,Cg as r,Eg as i,Op as a,TT as o,kp as s,wT as c,wg as l}from"./loadAgentsDir-C7lOqvfh.js";import{di as u,fi as d,ui as f}from"./src-P_wYS_NJ2.js";import{t as p}from"./jsx-runtime-Bb4Xn-E0.js";import{D as m,E as h,q as g}from"./log-CezCRpAN.js";import{n as _,r as v}from"./analytics-DJobLaWP.js";import{F as y,K as b,M as x,N as S,P as C,_ as w,b as T,et as E,it as D,rt as O,s as k,tt as A,w as j}from"./model-BsZ4sP_H.js";import{i as M,n as N,r as P,t as F}from"./extraUsage-Mi66JwFZ.js";function I({onDone:e}){let t=l(e=>e.mainLoopModel),n=l(e=>e.mainLoopModelForSession),r=l(e=>e.fastMode),a=i();function o(){v(`tengu_model_command_menu`,{action:`cancel`});let n=H(t);e(`Kept model as ${f.bold(n)}`,{display:`system`})}function s(n){v(`tengu_model_command_menu`,{action:n,from_model:t,to_model:n}),a(e=>({...e,mainLoopModel:n,mainLoopModelForSession:null}));let i=`Set model to ${f.bold(H(n))}`,o;O()&&(b(),!D(n)&&r?(a(e=>({...e,fastMode:!1})),o=!1):D(n)&&A()&&r&&(i+=` · Fast mode ON`,o=!0)),N(n,o===!0,T())&&(i+=` · Billed as extra usage`),o===!1&&(i+=` · Fast mode OFF`),e(i)}return(0,W.jsx)(P,{initial:t,sessionModel:n,onSelect:s,onCancel:o,isStandaloneCommand:!0,showFastModeNotice:O()&&r&&D(t)&&A()})}function L({args:e,onDone:t}){let n=l(e=>e.fastMode),r=i(),a=e==="default"?null:e;return U.useEffect(()=>{async function e(){if(a&&!S(a)){t(`Model '${a}' is not available. Your organization restricts model selection.`,{display:`system`});return}if(a&&z(a)){t(`Opus 4.7 with 1M context is not available for your account. Learn more: https://code.claude.com/docs/en/model-config#extended-context-with-1m`,{display:`system`});return}if(a&&B(a)){t(`Sonnet 4.6 with 1M context is not available for your account. Learn more: https://code.claude.com/docs/en/model-config#extended-context-with-1m`,{display:`system`});return}if(!a){i(null);return}if(R(a)){i(a);return}try{let{valid:e,error:n}=await o(a);e?i(a):t(n||`Model '${a}' not found`,{display:`system`})}catch(e){t(`Failed to validate model: ${e.message}`,{display:`system`})}}function i(e){r(t=>({...t,mainLoopModel:e,mainLoopModelForSession:null}));let i=`Set model to ${f.bold(H(e))}`,a;O()&&(b(),!D(e)&&n?(r(e=>({...e,fastMode:!1})),a=!1):D(e)&&n&&(i+=` · Fast mode ON`,a=!0)),N(e,a===!0,T())&&(i+=` · Billed as extra usage`),a===!1&&(i+=` · Fast mode OFF`),t(i)}e()},[a,t,r]),null}function R(e){return C.includes(e.toLowerCase().trim())}function z(e){let t=e.toLowerCase();return!a()&&!T()&&t.includes(`opus`)&&t.includes(`[1m]`)}function B(e){let t=e.toLowerCase();return!s()&&(t.includes(`sonnet[1m]`)||t.includes(`sonnet-4-6[1m]`))}function V({onDone:e}){let t=l(e=>e.mainLoopModel),n=l(e=>e.mainLoopModelForSession),r=H(t);return e(n?`Current model: ${f.bold(H(n))} (session override from plan mode)\nBase model: ${r}`:`Current model: ${r}`),null}function H(e){let t=j(e??k());return e===null?`${t} (default)`:t}var U,W,G;e((()=>{u(),U=t(d(),1),M(),g(),_(),r(),F(),E(),y(),n(),w(),x(),c(),W=p(),G=async(e,t,n)=>{if(n=n?.trim()||``,m.includes(n))return v(`tengu_model_command_inline_help`,{args:n}),(0,W.jsx)(V,{onDone:e});if(h.includes(n)){e(`Run /model to open the model selection menu, or /model [modelName] to set the model.`,{display:`system`});return}return n?(v(`tengu_model_command_inline`,{args:n}),(0,W.jsx)(L,{args:n,onDone:e})):(0,W.jsx)(I,{onDone:e})}}))();export{G as call};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{_ as e,u as t}from"./model-BsZ4sP_H.js";e();export{t as getMainLoopModel};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{l as t,o as n}from"./envUtils-BDhHQY0-.js";import{n as r,t as i}from"./axios-DaWTGg7G.js";import{F as a,I as o,S as s,V as c,W as l,a as u,d,l as f,nt as p,p as ee,rt as te,z as ne}from"./debug-RAynG_nM.js";import{Gt as re,Jt as ie}from"./settings-DnptdP79.js";import{C as m,S as ae,c as oe,h as se,x as ce,y as le}from"./config-Do1870_d.js";import{n as h,r as g}from"./execFileNoThrow-Dwu6psHW.js";import{o as ue,s as _}from"./log-CezCRpAN.js";import{n as de,r as v}from"./analytics-DJobLaWP.js";import{_n as y,vn as b}from"./model-BsZ4sP_H.js";import{dt as fe,lt as pe,ut as me}from"./sessionState-Bifmu95-.js";import{ft as he,ut as ge}from"./esm-Cf4nSRjF.js";import{C as _e,S as ve,_ as ye,a as x,b as be,c as xe,d as Se,g as Ce,h as we,i as Te,l as Ee,n as De,o as S,p as Oe,s as ke,t as Ae,v as je,x as Me,y as Ne}from"./pidLock-nJHbufJN.js";import{a as Pe,i as Fe,n as Ie,r as Le,t as Re}from"./xdg-DcF9ejUM.js";import{homedir as ze}from"os";import{basename as Be,delimiter as Ve,dirname as C,join as w,resolve as T}from"path";import{constants as He}from"fs";import{createHash as Ue}from"crypto";import{access as E,chmod as D,copyFile as O,mkdir as k,readdir as A,readlink as j,rename as M,rm as N,rmdir as We,stat as P,symlink as Ge,unlink as F,writeFile as I}from"fs/promises";async function Ke(e=`latest`,t,n){let i=Date.now();try{let a=await r.get(`${t}/${e}`,{timeout:3e4,responseType:`text`,...n});return v(`tengu_version_check_success`,{latency_ms:Date.now()-i}),a.data.trim()}catch(n){let a=Date.now()-i,o=n instanceof Error?n.message:String(n),s;r.isAxiosError(n)&&n.response&&(s=n.response.status),v(`tengu_version_check_failure`,{latency_ms:a,http_status:s,is_timeout:o.includes(`timeout`)});let c=Error(`Failed to fetch version from ${t}/${e}: ${o}`);throw _(c),c}}async function qe(e){if(/^v?\d+\.\d+\.\d+(-\S+)?$/.test(e)){let t=e.startsWith(`v`)?e.slice(1):e;if(/^99\.99\./.test(t))throw Error(`Version ${t} is not available for installation. Use 'stable' or 'latest'.`);return t}let t=e;if(t!==`stable`&&t!==`latest`)throw Error(`Invalid channel: ${e}. Use 'stable' or 'latest'`);return Ke(t,L)}function Je(){return Number(process.env.CLAUDE_CODE_STALL_TIMEOUT_MS_FOR_TESTING)||R}async function Ye(e,t,n,i={}){let a;for(let o=1;o<=3;o++){let s=new AbortController,c,u=()=>{c&&(clearTimeout(c),c=void 0)},d=()=>{u(),c=setTimeout(e=>e.abort(),Je(),s)};try{d();let a=await r.get(e,{timeout:5*6e4,responseType:`arraybuffer`,signal:s.signal,onDownloadProgress:()=>{d()},...i});u();let o=Ue(`sha256`);o.update(a.data);let c=o.digest(`hex`);if(c!==t)throw Error(`Checksum mismatch: expected ${t}, got ${c}`);await I(n,Buffer.from(a.data)),await D(n,493);return}catch(e){u();let t=r.isCancel(e);if(a=t?new z:l(e),t&&o<3){f(`Download stalled on attempt ${o}/3, retrying...`),await b(1e3);continue}throw a}}throw a??Error(`Download failed after all retries`)}async function Xe(e,t,n,i){let a=d();await a.rm(t,{recursive:!0,force:!0});let o=B(),s=Date.now();v(`tengu_binary_download_attempt`,{});let c;try{c=(await r.get(`${n}/${e}/manifest.json`,{timeout:1e4,responseType:`json`,...i})).data}catch(t){let i=Date.now()-s,a=t instanceof Error?t.message:String(t),o;throw r.isAxiosError(t)&&t.response&&(o=t.response.status),v(`tengu_binary_manifest_fetch_failure`,{latency_ms:i,http_status:o,is_timeout:a.includes(`timeout`)}),_(Error(`Failed to fetch manifest from ${n}/${e}/manifest.json: ${a}`)),t}let l=c.platforms[o];if(!l)throw v(`tengu_binary_platform_not_found`,{}),Error(`Platform ${o} not found in manifest for version ${e}`);let u=l.checksum,f=V(o),p=`${n}/${e}/${o}/${f}`;await a.mkdir(t);let ee=w(t,f);try{await Ye(p,u,ee,i||{}),v(`tengu_binary_download_success`,{latency_ms:Date.now()-s})}catch(e){let t=Date.now()-s,n=e instanceof Error?e.message:String(e),i;throw r.isAxiosError(e)&&e.response&&(i=e.response.status),v(`tengu_binary_download_failure`,{latency_ms:t,http_status:i,is_timeout:n.includes(`timeout`),is_checksum_mismatch:n.includes(`Checksum mismatch`)}),_(Error(`Failed to download binary from ${p}: ${n}`)),e}}async function Ze(e,t){return await Xe(e,t,L),`binary`}var L,R,z,Qe=e((()=>{i(),de(),u(),ne(),g(),ee(),ue(),y(),s(),$(),L=`https://storage.googleapis.com/claude-code-dist-86c565f3-f756-42ad-8dfa-d59b1c096819/claude-code-releases`,R=6e4,z=class extends Error{constructor(){super(`Download stalled: no data received for 60 seconds`),this.name=`StallTimeoutError`}}}));function B(){let e=re.platform,t=process.arch===`x64`?`x64`:process.arch===`arm64`?`arm64`:null;if(!t){let e=Error(`Unsupported architecture: ${process.arch}`);throw f(`Native installer does not support architecture: ${process.arch}`,{level:`error`}),e}return e===`linux`&&ge.isMuslEnvironment()?`linux-${t}-musl`:`${e}-${t}`}function V(e){return e.startsWith(`win32`)?`claude.exe`:`claude`}function H(){let e=V(B());return{versions:w(Le(),`claude`,`versions`),staging:w(Ie(),`claude`,`staging`),locks:w(Fe(),`claude`,`locks`),executable:w(Re(),e)}}async function U(e){try{let t=await P(e);return!t.isFile()||t.size===0?!1:(await E(e,He.X_OK),!0)}catch{return!1}}async function W(e){let t=H(),n=[t.versions,t.staging,t.locks];await Promise.all(n.map(e=>k(e,{recursive:!0}))),await k(C(t.executable),{recursive:!0});let r=w(t.versions,e);try{await P(r)}catch{await I(r,``,{encoding:`utf8`})}return{stagingPath:w(t.staging,e),installPath:r}}async function G(e,t,n=0){let r=H(),i=Y(r,e);if(await k(r.locks,{recursive:!0}),S()){let r=0,a=n+1,o=n>0?1e3:100,s=n>0?5e3:500;for(;r<a;){if(await xe(e,i,async()=>{try{await t()}catch(e){throw _(e),e}}))return v(`tengu_version_lock_acquired`,{is_pid_based:!0,is_lifetime_lock:!1,attempts:r+1}),!0;r++,r<a&&await b(Math.min(o*2**(r-1),s))}return v(`tengu_version_lock_failed`,{is_pid_based:!0,is_lifetime_lock:!1,attempts:a}),X(e,Error(`Lock held by another process`)),!1}let a=null;try{try{a=await m(e,{stale:Z,retries:{retries:n,minTimeout:n>0?1e3:100,maxTimeout:n>0?5e3:500},lockfilePath:i,onCompromised:e=>{f(`NON-FATAL: Version lock was compromised during operation: ${e.message}`,{level:`info`})}})}catch(t){return v(`tengu_version_lock_failed`,{is_pid_based:!1,is_lifetime_lock:!1}),X(e,t),!1}try{return await t(),v(`tengu_version_lock_acquired`,{is_pid_based:!1,is_lifetime_lock:!1}),!0}catch(e){throw _(e),e}}finally{a&&await a()}}async function K(e,t){await k(C(t),{recursive:!0});let n=`${t}.tmp.${process.pid}.${Date.now()}`;try{await O(e,n),await D(n,493),await M(n,t),f(`Atomically installed binary to ${t}`)}catch(e){try{await F(n)}catch{}throw e}}async function $e(e,t){try{let n=w(e,`node_modules`,`@anthropic-ai`),r=(await A(n)).find(e=>e.startsWith(`claude-cli-native-`));if(!r)throw v(`tengu_native_install_package_failure`,{stage_find_package:!0,error_package_not_found:!0}),Error(`Could not find platform-specific native package`);let i=w(n,r,`cli`);try{await P(i)}catch{throw v(`tengu_native_install_package_failure`,{stage_binary_exists:!0,error_binary_not_found:!0}),Error(`Native binary not found in staged package`)}await K(i,t),await N(e,{recursive:!0,force:!0}),v(`tengu_native_install_package_success`,{})}catch(e){let t=a(e);throw!t.includes(`Could not find platform-specific`)&&!t.includes(`Native binary not found`)&&v(`tengu_native_install_package_failure`,{stage_atomic_move:!0,error_move_failed:!0}),_(l(e)),e}}async function et(e,t){try{let n=w(e,V(B()));try{await P(n)}catch{throw v(`tengu_native_install_binary_failure`,{stage_binary_exists:!0,error_binary_not_found:!0}),Error(`Staged binary not found`)}await K(n,t),await N(e,{recursive:!0,force:!0}),v(`tengu_native_install_binary_success`,{})}catch(e){throw a(e).includes(`Staged binary not found`)||v(`tengu_native_install_binary_failure`,{stage_atomic_move:!0,error_move_failed:!0}),_(l(e)),e}}async function tt(e,t,n){n===`npm`?await $e(e,t):await et(e,t)}async function q(e,n){let{stagingPath:r,installPath:i}=await W(e),{executable:a}=H(),o=t(process.env.ENABLE_LOCKLESS_UPDATES)?`${r}.${process.pid}.${Date.now()}`:r,s=!await J(e)||n;if(s?(f(n?`Force reinstalling native installer version ${e}`:`Downloading native installer version ${e}`),await tt(o,i,await Ze(e,o))):f(`Version ${e} already installed, updating symlink`),await rt(a),await it(a,i),!await U(a)){let e=!1;try{await P(i),e=!0}catch{}throw Error(`Failed to create executable at ${a}. Source file exists: ${e}. Check write permissions to ${a}.`)}return s}async function J(e){let{installPath:t}=await W(e);return U(t)}async function nt(e,n=!1){let r=Date.now(),i=await qe(e),{executable:a}=H();if(f(`Checking for native installer update to version ${i}`),!n){let e=await Oe();if(e&&pe(i,e)){if(f(`Native installer: maxVersion ${e} is set, capping update from ${i} to ${e}`),me(`0.0.10`,e))return f(`Native installer: current version 0.0.10 is already at or above maxVersion ${e}, skipping update`),v(`tengu_native_update_skipped_max_version`,{latency_ms:Date.now()-r,max_version:e,available_version:i}),{success:!0,latestVersion:i};i=e}}if(!n&&i===`0.0.10`&&await J(i)&&await U(a))return f(`Found ${i} at ${a}, skipping install`),v(`tengu_native_update_complete`,{latency_ms:Date.now()-r,was_new_install:!1,was_force_reinstall:!1,was_already_running:!0}),{success:!0,latestVersion:i};if(!n&&Ce(i))return v(`tengu_native_update_skipped_minimum_version`,{latency_ms:Date.now()-r,target_version:i}),{success:!0,latestVersion:i};let o=!1,s;if(t(process.env.ENABLE_LOCKLESS_UPDATES))o=await q(i,n),s=Date.now()-r;else{let{installPath:e}=await W(i);n&&await ut(e);let t=await G(e,async()=>{o=await q(i,n)},3);if(s=Date.now()-r,!t){let t=H(),n;if(S()){let r=Y(t,e);x(r)&&(n=ke(r)?.pid)}return v(`tengu_native_update_lock_failed`,{latency_ms:s,lock_holder_pid:n}),{success:!1,latestVersion:i,lockFailed:!0,lockHolderPid:n}}}return v(`tengu_native_update_complete`,{latency_ms:s,was_new_install:o,was_force_reinstall:n}),f(`Successfully updated to version ${i}`),{success:!0,latestVersion:i}}async function rt(e){try{await We(e),f(`Removed empty directory at ${e}`)}catch(t){let n=o(t);n!==`ENOTDIR`&&n!==`ENOENT`&&n!==`ENOTEMPTY`&&f(`Could not remove directory at ${e}: ${t}`)}}async function it(e,t){if(B().startsWith(`win32`))try{await k(C(e),{recursive:!0});let n;try{n=await P(e)}catch{}if(n){try{let e=await P(t);if(n.size===e.size)return!1}catch{}let r=`${e}.old.${Date.now()}`;await M(e,r);try{await O(t,e);try{await F(r)}catch{}}catch(t){try{await M(r,e)}catch(e){let n=Error(`Failed to restore old executable: ${e}`,{cause:t});throw _(n),n}throw t}}else try{await O(t,e)}catch(e){throw c(e)?Error(`Source file does not exist: ${t}`):e}return!0}catch(n){return _(Error(`Failed to copy executable from ${t} to ${e}: ${n}`)),!1}let n=C(e);try{await k(n,{recursive:!0}),f(`Created directory ${n} for symlink`)}catch(e){return _(Error(`Failed to create directory ${n}: ${e}`)),!1}try{let n=!1;try{await P(e),n=!0}catch{}if(n){try{let n=await j(e);if(T(C(e),n)===T(t))return!1}catch{}await F(e)}}catch(e){_(Error(`Failed to check/remove existing symlink: ${e}`))}let r=`${e}.tmp.${process.pid}.${Date.now()}`;try{return await Ge(t,r),await M(r,e),f(`Atomically updated symlink ${e} -> ${t}`),!0}catch(n){try{await F(r)}catch{}return _(Error(`Failed to create symlink from ${e} to ${t}: ${n}`)),!1}}async function at(e=!1){if(t(process.env.DISABLE_INSTALLATION_CHECKS))return[];let n=await Ee();if(n===`development`||!(e||n===`native`))return[];let r=H(),i=[],a=C(r.executable),o=T(a),s=B().startsWith(`win32`);try{await E(a)}catch{i.push({message:`installMethod is native, but directory ${a} does not exist`,userActionRequired:!0,type:`error`})}if(s)await U(r.executable)||i.push({message:`installMethod is native, but claude command is missing or invalid at ${r.executable}`,userActionRequired:!0,type:`error`});else try{let e=await j(r.executable);await U(T(C(r.executable),e))||i.push({message:`Claude symlink points to missing or invalid binary: ${e}`,userActionRequired:!0,type:`error`})}catch(e){c(e)?i.push({message:`installMethod is native, but claude command not found at ${r.executable}`,userActionRequired:!0,type:`error`}):await U(r.executable)||i.push({message:`${r.executable} exists but is not a valid Claude binary`,userActionRequired:!0,type:`error`})}if(!(process.env.PATH||``).split(Ve).some(e=>{try{let t=T(e);return s?t.toLowerCase()===o.toLowerCase():t===o}catch{return!1}}))if(s){let e=a.replace(/\//g,`\\`);i.push({message:`Native installation exists but ${e} is not in your PATH. Add it by opening: System Properties → Environment Variables → Edit User PATH → New → Add the path above. Then restart your terminal.`,userActionRequired:!0,type:`path`})}else{let e=ve(),t=je()[e],n=t?t.replace(ze(),`~`):`your shell config file`;i.push({message:`Native installation exists but ~/.local/bin is not in your PATH. Run:\n\necho 'export PATH="$HOME/.local/bin:$PATH"' >> ${n} && source ${n}`,userActionRequired:!0,type:`path`})}return i}function ot(e,t=!1){if(t)return st(e,t);if(Q)return f(`installLatest: joining in-flight call`),Q;let n=st(e,t);Q=n;let r=()=>{Q=null};return n.then(r,r),n}async function st(e,t=!1){let n=await nt(e,t);return n.success?(oe().installMethod!==`native`&&(le(e=>({...e,installMethod:`native`,autoUpdates:!1,autoUpdatesProtectedForNative:!0})),f(`Native installer: Set installMethod to "native" and disabled legacy auto-updater for protection`)),dt(),{latestVersion:n.latestVersion,wasUpdated:n.success,lockFailed:!1}):{latestVersion:null,wasUpdated:!1,lockFailed:n.lockFailed,lockHolderPid:n.lockHolderPid}}async function ct(e){try{let t=await j(e),n=T(C(e),t);if(await U(n))return n}catch{}return null}function Y(e,t){let n=Be(t);return w(e.locks,`${n}.lock`)}async function lt(){let e=H();if(!process.execPath.includes(e.versions))return;let t=T(process.execPath);try{let n=Y(e,t);if(await k(e.locks,{recursive:!0}),S()){if(!await Ae(t,n)){v(`tengu_version_lock_failed`,{is_pid_based:!0,is_lifetime_lock:!0}),X(t,Error(`Lock already held by another process`));return}v(`tengu_version_lock_acquired`,{is_pid_based:!0,is_lifetime_lock:!0}),f(`Acquired PID lock on running version: ${t}`)}else{let e;try{e=await m(t,{stale:Z,retries:0,lockfilePath:n,onCompromised:e=>{f(`NON-FATAL: Lock on running version was compromised: ${e.message}`,{level:`info`})}}),v(`tengu_version_lock_acquired`,{is_pid_based:!1,is_lifetime_lock:!0}),f(`Acquired mtime-based lock on running version: ${t}`),te(async()=>{try{await e?.()}catch{}})}catch(e){if(c(e)){f(`Cannot lock current version - file does not exist: ${t}`,{level:`info`});return}v(`tengu_version_lock_failed`,{is_pid_based:!1,is_lifetime_lock:!0}),X(t,e);return}}}catch(e){if(c(e)){f(`Cannot lock current version - file does not exist: ${t}`,{level:`info`});return}f(`NON-FATAL: Failed to lock current version during execution ${a(e)}`,{level:`info`})}}function X(e,t){_(Error(`NON-FATAL: Lock acquisition failed for ${e} (expected in multi-process scenarios)`,{cause:t}))}async function ut(e){let t=Y(H(),e);try{await F(t),f(`Force-removed lock file at ${t}`)}catch(e){f(`Failed to force-remove lock file: ${a(e)}`)}}async function dt(){await Promise.resolve();let e=H(),t=Date.now()-36e5;if(B().startsWith(`win32`)){let t=C(e.executable);try{let e=await A(t),n=0;for(let r of e)if(/^claude\.exe\.old\.\d+$/.test(r))try{await F(w(t,r)),n++}catch{}n>0&&f(`Cleaned up ${n} old Windows executables on startup`)}catch(e){c(e)||f(`Failed to clean up old Windows executables: ${e}`)}}try{let n=await A(e.staging),r=0;for(let i of n){let n=w(e.staging,i);try{(await P(n)).mtime.getTime()<t&&(await N(n,{recursive:!0,force:!0}),r++,f(`Cleaned up old staging directory: ${i}`))}catch{}}r>0&&(f(`Cleaned up ${r} orphaned staging directories`),v(`tengu_native_staging_cleanup`,{cleaned_count:r}))}catch(e){c(e)||f(`Failed to clean up staging directories: ${e}`)}if(S()){let t=De(e.locks);t>0&&(f(`Cleaned up ${t} stale version locks`),v(`tengu_native_stale_locks_cleanup`,{cleaned_count:t}))}let n;try{n=await A(e.versions)}catch(e){c(e)||f(`Failed to readdir versions directory: ${e}`);return}let r=[],i=0;for(let a of n){let n=w(e.versions,a);if(/\.tmp\.\d+\.\d+$/.test(a)){try{(await P(n)).mtime.getTime()<t&&(await F(n),i++,f(`Cleaned up orphaned temp install file: ${a}`))}catch{}continue}try{let e=await P(n);if(!e.isFile()||process.platform!==`win32`&&e.size>0&&!(e.mode&73))continue;r.push({name:a,path:n,resolvedPath:T(n),mtime:e.mtime})}catch{}}if(i>0&&(f(`Cleaned up ${i} orphaned temp install files`),v(`tengu_native_temp_files_cleanup`,{cleaned_count:i})),r.length!==0)try{let t=process.execPath,n=new Set;t&&t.includes(e.versions)&&n.add(T(t));let i=await ct(e.executable);i&&n.add(i);for(let t of r){if(n.has(t.resolvedPath))continue;let r=Y(e,t.resolvedPath),i=!1;if(S())i=x(r);else try{i=await ce(t.resolvedPath,{stale:Z,lockfilePath:r})}catch{i=!1}i&&(n.add(t.resolvedPath),f(`Protecting locked version from cleanup: ${t.name}`))}let a=r.filter(e=>!n.has(e.resolvedPath)).sort((e,t)=>t.mtime.getTime()-e.mtime.getTime()).slice(2);if(a.length===0){v(`tengu_native_version_cleanup`,{total_count:r.length,deleted_count:0,protected_count:n.size,retained_count:2,lock_failed_count:0,error_count:0});return}let o=0,s=0,c=0;await Promise.all(a.map(async e=>{try{await G(e.path,async()=>{await F(e.path)})?o++:(s++,f(`Skipping deletion of ${e.name} - locked by another process`))}catch(t){c++,_(Error(`Failed to delete version ${e.name}: ${t}`))}})),v(`tengu_native_version_cleanup`,{total_count:r.length,deleted_count:o,protected_count:n.size,retained_count:2,lock_failed_count:s,error_count:c})}catch(e){c(e)||_(Error(`Version cleanup failed: ${e}`))}}async function ft(){let e=[],t=je();for(let[n,r]of Object.entries(t))try{let t=await be(r);if(!t)continue;let{filtered:i,hadAlias:a}=ye(t);a&&(await Me(r,i),e.push({message:`Removed claude alias from ${r}. Run: unalias claude`,userActionRequired:!0,type:`alias`}),f(`Cleaned up claude alias from ${n} config`))}catch(t){_(t),e.push({message:`Failed to clean up ${r}: ${t}`,userActionRequired:!1,type:`error`})}return e}async function pt(e){try{let t=await h(`npm`,[`config`,`get`,`prefix`]);if(t.code!==0||!t.stdout)return{success:!1,error:`Failed to get npm global prefix`};let n=t.stdout.trim(),r=!1;async function i(e,t){try{return await F(e),f(`Manually removed ${t}: ${e}`),!0}catch{return!1}}if(B().startsWith(`win32`)){let e=w(n,`claude.cmd`),t=w(n,`claude.ps1`),a=w(n,`claude`);await i(e,`bin script`)&&(r=!0),await i(t,`PowerShell script`)&&(r=!0),await i(a,`bin executable`)&&(r=!0)}else await i(w(n,`bin`,`claude`),`bin symlink`)&&(r=!0);return r?(f(`Successfully removed ${e} manually`),{success:!0,warning:`${e} executables removed, but node_modules directory was left intact for safety. You may manually delete it later at: ${B().startsWith(`win32`)?w(n,`node_modules`,e):w(n,`lib`,`node_modules`,e)}`}):{success:!1}}catch(e){return f(`Manual removal failed: ${e}`,{level:`error`}),{success:!1,error:`Manual removal failed: ${e}`}}}async function mt(e){let{code:t,stderr:n}=await h(`npm`,[`uninstall`,`-g`,e],{cwd:process.cwd()});if(t===0)return f(`Removed global npm installation of ${e}`),{success:!0};if(n&&!n.includes(`npm ERR! code E404`)){if(n.includes(`npm error code ENOTEMPTY`)){f(`Failed to uninstall global npm package ${e}: ${n}`,{level:`error`}),f(`Attempting manual removal due to ENOTEMPTY error`);let t=await pt(e);if(t.success)return{success:!0,warning:t.warning};if(t.error)return{success:!1,error:`Failed to remove global npm installation of ${e}: ${n}. Manual removal also failed: ${t.error}`}}return f(`Failed to uninstall global npm package ${e}: ${n}`,{level:`error`}),{success:!1,error:`Failed to remove global npm installation of ${e}: ${n}`}}return{success:!1}}async function ht(){let e=[],t=[],n=0,r=await mt(`@anthropic-ai/claude-code`);r.success?(n++,r.warning&&t.push(r.warning)):r.error&&e.push(r.error);let i=w(ze(),`.claude`,`local`);try{await N(i,{recursive:!0}),n++,f(`Removed local installation at ${i}`)}catch(t){c(t)||(e.push(`Failed to remove ${i}: ${t}`),f(`Failed to remove local installation: ${t}`,{level:`error`}))}return{removed:n,errors:e,warnings:t}}var Z,Q,$=e((()=>{de(),we(),p(),se(),u(),Se(),ie(),he(),n(),ne(),g(),_e(),ae(),ue(),fe(),Ne(),y(),Pe(),Qe(),Te(),Z=10080*60*1e3,Q=null})),gt=e((()=>{$()}));export{ft as a,lt as c,dt as i,at as n,$ as o,ht as r,ot as s,gt as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{a as t,o as n}from"./isObject-C6qM3WEW.js";import{XE as r,ZE as i,iE as a,lE as o,rE as s,uE as c}from"./loadAgentsDir-C7lOqvfh.js";import{Ar as l,Ci as u,Dr as d,Er as f,Fr as p,Or as m,Pr as h,Si as g,bi as _,di as v,jr as y,kr as b,ui as x,xi as S}from"./state-BemZdQIl.js";import{$n as C,Qn as w,Tr as T,Xn as E,Zn as D,er as O,tr as k,wr as A}from"./settings-DnptdP79.js";import{I as j,L as M}from"./config-Do1870_d.js";function N(e){return S(e)||v(e)||!!(P&&e&&e[P])}var P,F=e((()=>{n(),x(),_(),P=t?t.isConcatSpreadable:void 0}));function I(e,t,n,r,i){var a=-1,o=e.length;for(n||(n=N),i||(i=[]);++a<o;){var s=e[a];t>0&&n(s)?t>1?I(s,t-1,n,r,i):g(i,s):r||(i[i.length]=s)}return i}var L=e((()=>{u(),F()}));function R(e){return e!=null&&e.length?I(e,1):[]}var z=e((()=>{L()}));function B(e){return D(C(e,void 0,R),e+``)}var V=e((()=>{z(),w(),E()}));function H(e,t){return t.length<2?e:f(e,o(t,0,-1))}var U=e((()=>{d(),c()}));function W(e,t){t=l(t,e);var n=-1,r=t.length;if(!r)return!0;for(;++n<r;){var i=b(t[n]);if(i===`__proto__`&&!G.call(e,`__proto__`)||(i===`constructor`||i===`prototype`)&&n<r-1)return!1}var o=H(e,t);return o==null||delete o[b(a(t))]}var G,K=e((()=>{y(),s(),U(),m(),G=Object.prototype.hasOwnProperty}));function q(e){return k(e)?void 0:e}var J=e((()=>{O()})),Y,X,Z,Q,$=e((()=>{p(),i(),K(),y(),T(),J(),V(),M(),Y=1,X=2,Z=4,Q=B(function(e,t){var n={};if(e==null)return n;var i=!1;t=h(t,function(t){return t=l(t,e),i||(i=t.length>1),t}),A(e,j(e),n),i&&(n=r(n,Y|X|Z,q));for(var a=t.length;a--;)W(n,t[a]);return n})}));export{Q as n,$ as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{Mn as e,Wt as t}from"./state-BemZdQIl.js";import{W as n,z as r}from"./debug-RAynG_nM.js";import{Pt as i,Rt as a,jt as o}from"./settings-DnptdP79.js";import{c as s,h as c,y as l}from"./config-Do1870_d.js";import{o as u,s as d}from"./log-CezCRpAN.js";import{Bt as f,_t as p,gt as m,vt as h}from"./model-BsZ4sP_H.js";import{a as g,i as _,n as v}from"./sessionState-Bifmu95-.js";import{r as y,t as b}from"./managedEnv-DhWRJ5DK.js";t(),f(),c(),r(),u(),y(),o(),v();function x(e){return t=>({...t,...typeof e.permission_mode==`string`?{toolPermissionContext:{...t.toolPermissionContext,mode:i(e.permission_mode)}}:{}})}function S({newState:t,oldState:r}){let i=r.toolPermissionContext.mode,o=t.toolPermissionContext.mode;if(i!==o){let e=a(i),t=a(o);e!==t&&g({permission_mode:t}),_(o)}if(t.mainLoopModel!==r.mainLoopModel&&e(t.mainLoopModel),t.expandedView!==r.expandedView){let e=t.expandedView===`tasks`;s().showExpandedTodos!==e&&l(t=>({...t,showExpandedTodos:e}))}if(t.verbose!==r.verbose&&s().verbose!==t.verbose){let e=t.verbose;l(t=>({...t,verbose:e}))}if(t.settings!==r.settings)try{m(),p(),h(),t.settings.env!==r.settings.env&&b()}catch(e){d(n(e))}}export{S as n,x as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{I as n,P as r,fi as i,hn as a,t as o,y as s}from"./src-P_wYS_NJ2.js";import{t as c}from"./jsx-runtime-Bb4Xn-E0.js";import{o as l,r as u}from"./break-cache-Chj9i9MP.js";async function d(e,t){let n=await u(e);n.type===`text`&&t(n.value,{display:`system`})}function f({onDone:e}){let[t,i]=(0,m.useState)(0),o=(0,m.useMemo)(()=>[{label:`Status`,description:`Show pending marker, always mode, and break count`,run:()=>void d(`status`,e)},{label:`Once`,description:`Break prompt cache on the next API call only`,run:()=>void d(`once`,e)},{label:`Always`,description:`Break prompt cache on every API call`,run:()=>void d(`always`,e)},{label:`Off`,description:`Disable always mode and clear pending once marker`,run:()=>void d(`off`,e)},{label:`Clear Once`,description:`Cancel the pending one-time cache break`,run:()=>void d(`--clear`,e)}],[e]),c=()=>{let e=o[t];e&&e.run()};return a((e,t)=>{if(t.upArrow){i(e=>Math.max(0,e-1));return}if(t.downArrow){i(e=>Math.min(o.length-1,e+1));return}t.return&&c()}),(0,h.jsx)(s,{title:`Break Cache`,subtitle:`${o.length} actions`,onCancel:()=>e(`Break-cache panel dismissed`,{display:`system`}),color:`background`,hideInputGuide:!0,children:(0,h.jsxs)(n,{flexDirection:`column`,children:[o.map((e,i)=>(0,h.jsxs)(n,{flexDirection:`row`,children:[(0,h.jsx)(r,{children:`${i===t?`›`:` `} ${e.label}`.padEnd(g)}),(0,h.jsx)(r,{dimColor:!0,children:e.description})]},e.label)),(0,h.jsx)(n,{marginTop:1,children:(0,h.jsx)(r,{dimColor:!0,children:`↑/↓ select · Enter run · Esc close`})})]})})}async function p(e,t,n){let r=n?.trim()??``;return r?(await d(r,e),null):(0,h.jsx)(f,{onDone:e})}var m,h,g;e((()=>{m=t(i(),1),o(),l(),h=c(),g=28}))();export{p as call};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{i as e,r as t}from"./parser-BwPXQomy.js";t();export{e as parseCommand};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{n,t as r}from"./figures-5ThXQEtq.js";import{$C as i,B as a,BT as o,Ba as s,Cg as c,Eg as l,G as u,H as d,LT as f,V as p,W as ee,ba as te,fd as ne,h_ as re,hh as m,mh as h,nd as g,pd as ie,qC as _,rd as v,v_ as y,wg as ae,y_ as oe,z as se}from"./loadAgentsDir-C7lOqvfh.js";import{I as b,P as x,Wt as ce,Xn as le,a as S,di as C,fi as w,hn as T,k as E,kt as D,n as O,o as k,ot as ue,r as de,s as fe,t as A,ui as j,x as pe,y as M}from"./src-P_wYS_NJ2.js";import{t as N}from"./jsx-runtime-Bb4Xn-E0.js";import{Wt as me,et as P}from"./state-BemZdQIl.js";import{S as F,w as I}from"./debug-RAynG_nM.js";import{H as L,V as R,cn as he,g as z,nn as B,o as V,z as H}from"./settings-DnptdP79.js";import{l as ge,o as _e}from"./stringUtils-C84IJ91d.js";import{n as ve,t as ye}from"./useExitOnCtrlCDWithKeybindings-ChqBs9Lr.js";import{n as be,t as xe}from"./AddWorkspaceDirectory-Vmmm7p1c.js";import{t as Se}from"./SearchBox-C9vUA4IM.js";import{n as Ce,t as we}from"./useSearchInput-C7Y1I9P9.js";import{n as Te,t as Ee}from"./shadowedRuleDetection-DEaw-X5j.js";import{n as U,t as De}from"./autoModeDenials-BxNzGJdR.js";function Oe({ruleValue:e}){switch(e.toolName){case h.name:return e.ruleContent?e.ruleContent.endsWith(`:*`)?(0,W.jsxs)(x,{dimColor:!0,children:[`Any Bash command starting with `,(0,W.jsx)(x,{bold:!0,children:e.ruleContent.slice(0,-2)})]}):(0,W.jsxs)(x,{dimColor:!0,children:[`The Bash command `,(0,W.jsx)(x,{bold:!0,children:e.ruleContent})]}):(0,W.jsx)(x,{dimColor:!0,children:`Any Bash command`});default:return e.ruleContent?null:(0,W.jsxs)(x,{dimColor:!0,children:[`Any use of the `,(0,W.jsx)(x,{bold:!0,children:e.toolName}),` tool`]})}}var W,ke=e((()=>{w(),A(),m(),W=N()}));function Ae(e){switch(e){case`localSettings`:return{label:`Project settings (local)`,description:`Saved in ${V(`localSettings`)}`,value:e};case`projectSettings`:return{label:`Project settings`,description:`Checked in at ${V(`projectSettings`)}`,value:e};case`userSettings`:return{label:`User settings`,description:`Saved in at ~/.claude/settings.json`,value:e}}}function je({onAddRules:e,onCancel:t,ruleValues:n,ruleBehavior:r,initialContext:i,setToolPermissionContext:a}){let o=B.map(Ae),s=(0,Me.useCallback)(o=>{if(o===`cancel`){t();return}else if(B.includes(o)){let t=o,s=re(i,{type:`addRules`,rules:n,behavior:r,destination:t});oe({type:`addRules`,rules:n,behavior:r,destination:t}),a(s);let c=n.map(e=>({ruleValue:e,ruleBehavior:r,source:t})),l=Ee(s,{sandboxAutoAllowEnabled:f.isSandboxingEnabled()&&f.isAutoAllowBashIfSandboxedEnabled()}).filter(e=>n.some(t=>t.toolName===e.rule.ruleValue.toolName&&t.ruleContent===e.rule.ruleValue.ruleContent));e(c,l.length>0?l:void 0)}},[e,t,n,r,i,a]);return(0,G.jsxs)(M,{title:`Add ${r} permission ${ge(n.length,`rule`)}`,onCancel:t,color:`permission`,children:[(0,G.jsx)(b,{flexDirection:`column`,paddingX:2,children:n.map(e=>(0,G.jsxs)(b,{flexDirection:`column`,children:[(0,G.jsx)(x,{bold:!0,children:L(e)}),(0,G.jsx)(Oe,{ruleValue:e})]},L(e)))}),(0,G.jsxs)(b,{flexDirection:`column`,marginY:1,children:[(0,G.jsx)(x,{children:n.length===1?`Where should this rule be saved?`:`Where should these rules be saved?`}),(0,G.jsx)(g,{options:o,onChange:s})]})]})}var Me,G,Ne=e((()=>{w(),Me=t(w(),1),v(),A(),y(),H(),Te(),o(),he(),z(),_e(),ke(),G=N()}));function Pe({onCancel:e,onSubmit:t,ruleBehavior:n}){let[i,a]=(0,Fe.useState)(``),[o,s]=(0,Fe.useState)(0),c=ve();ce(`confirm:no`,e,{context:`Settings`});let{columns:l}=ue(),u=l-6;return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(b,{flexDirection:`column`,gap:1,borderStyle:`round`,paddingLeft:1,paddingRight:1,borderColor:`permission`,children:[(0,K.jsxs)(x,{bold:!0,color:`permission`,children:[`Add `,n,` permission rule`]}),(0,K.jsxs)(b,{flexDirection:`column`,children:[(0,K.jsxs)(x,{children:[`Permission rules are a tool name, optionally followed by a specifier in parentheses.`,(0,K.jsx)(D,{}),`e.g., `,(0,K.jsx)(x,{bold:!0,children:L({toolName:h.name})}),(0,K.jsx)(x,{bold:!1,children:` or `}),(0,K.jsx)(x,{bold:!0,children:L({toolName:h.name,ruleContent:`ls:*`})})]}),(0,K.jsx)(b,{borderDimColor:!0,borderStyle:`round`,marginY:1,paddingLeft:1,children:(0,K.jsx)(ne,{showCursor:!0,value:i,onChange:a,onSubmit:e=>{let r=e.trim();r.length!==0&&t(R(r),n)},placeholder:`Enter permission rule${r.ellipsis}`,columns:u,cursorOffset:o,onChangeCursorOffset:s})})]})]}),(0,K.jsx)(b,{marginLeft:3,children:c.pending?(0,K.jsxs)(x,{dimColor:!0,children:[`Press `,c.keyName,` again to exit`]}):(0,K.jsx)(x,{dimColor:!0,children:`Enter to submit · Esc to cancel`})})]})}var Fe,K,Ie=e((()=>{n(),w(),Fe=t(w(),1),ie(),ye(),i(),A(),_(),m(),H(),K=N()}));function Le({onHeaderFocusChange:e,onStateChange:t}){let{headerFocused:n,focusHeader:r}=S();(0,q.useEffect)(()=>{e?.(n)},[n,e]);let[i]=(0,q.useState)(()=>De()),[a,o]=(0,q.useState)(()=>new Set),[s,c]=(0,q.useState)(()=>new Set),[l,u]=(0,q.useState)(0);(0,q.useEffect)(()=>{t({approved:a,retry:s,denials:i})},[a,s,i,t]);let d=(0,q.useCallback)(e=>{let t=Number(e);o(e=>{let n=new Set(e);return n.has(t)?n.delete(t):n.add(t),n})},[]),f=(0,q.useCallback)(e=>{u(Number(e))},[]);if(T((e,t)=>{e===`r`&&(c(e=>{let t=new Set(e);return t.has(l)?t.delete(l):t.add(l),t}),o(e=>{if(e.has(l))return e;let t=new Set(e);return t.add(l),t}))},{isActive:i.length>0}),i.length===0)return(0,J.jsx)(x,{dimColor:!0,children:`No recent denials. Commands denied by the auto mode classifier will appear here.`});let p=i.map((e,t)=>{let n=a.has(t),r=s.has(t)?` (retry)`:``;return{label:(0,J.jsxs)(x,{children:[(0,J.jsx)(fe,{status:n?`success`:`error`,withSpace:!0}),e.display,(0,J.jsx)(x,{dimColor:!0,children:r})]}),value:String(t)}});return(0,J.jsxs)(b,{flexDirection:`column`,children:[(0,J.jsx)(x,{children:`Commands recently denied by the auto mode classifier.`}),(0,J.jsx)(b,{marginTop:1,children:(0,J.jsx)(g,{options:p,onChange:d,onFocus:f,visibleOptionCount:Math.min(10,p.length),isDisabled:n,onUpFromFirstItem:r})})]})}var q,J,Re=e((()=>{w(),q=t(w(),1),A(),U(),v(),J=N()}));function ze({directoryPath:e,onRemove:t,onCancel:n,permissionContext:r,setPermissionContext:i}){let a=(0,Be.useCallback)(()=>{i(re(r,{type:`removeDirectories`,directories:[e],destination:`session`})),t()},[e,r,i,t]),o=(0,Be.useCallback)(e=>{e===`yes`?a():n()},[a,n]);return(0,Y.jsxs)(M,{title:`Remove directory from workspace?`,onCancel:n,color:`error`,children:[(0,Y.jsx)(b,{marginX:2,flexDirection:`column`,children:(0,Y.jsx)(x,{bold:!0,children:e})}),(0,Y.jsx)(x,{children:`Claude Code will no longer have access to files in this directory.`}),(0,Y.jsx)(g,{onChange:o,onCancel:n,options:[{label:`Yes`,value:`yes`},{label:`No`,value:`no`}]})]})}var Be,Y,Ve=e((()=>{w(),Be=t(w(),1),v(),A(),y(),Y=N()}));function He({onExit:e,toolPermissionContext:t,onRequestAddDirectory:n,onRequestRemoveDirectory:i,onHeaderFocusChange:a}){let{headerFocused:o,focusHeader:s}=S();(0,X.useEffect)(()=>{a?.(o)},[o,a]);let c=Ue.useMemo(()=>Array.from(t.additionalWorkingDirectories.keys()).map(e=>({path:e,isCurrent:!1,isDeletable:!0})),[t.additionalWorkingDirectories]),l=(0,X.useCallback)(e=>{if(e===`add-directory`){n();return}let t=c.find(t=>t.path===e);t&&t.isDeletable&&i(t.path)},[c,n,i]),u=(0,X.useCallback)(()=>e(`Workspace dialog dismissed`,{display:`system`}),[e]),d=Ue.useMemo(()=>{let e=c.map(e=>({label:e.path,value:e.path}));return e.push({label:`Add directory${r.ellipsis}`,value:`add-directory`}),e},[c]);return(0,Z.jsxs)(b,{flexDirection:`column`,marginBottom:1,children:[(0,Z.jsxs)(b,{flexDirection:`row`,marginTop:1,marginLeft:2,gap:1,children:[(0,Z.jsx)(x,{children:`- ${P()}`}),(0,Z.jsx)(x,{dimColor:!0,children:`(Original working directory)`})]}),(0,Z.jsx)(g,{options:d,onChange:l,onCancel:u,visibleOptionCount:Math.min(10,d.length),onUpFromFirstItem:s,isDisabled:o})]})}var Ue,X,Z,We=e((()=>{n(),Ue=t(w(),1),X=t(w(),1),me(),v(),A(),Z=N()}));function Ge({rule:e}){return(0,$.jsx)(x,{dimColor:!0,children:`From ${u(e.source)}`})}function Ke(e){switch(e){case`allow`:return`allowed`;case`deny`:return`denied`;case`ask`:return`ask`}}function qe({rule:e,onDelete:t,onCancel:n}){let r=ve();ce(`confirm:no`,n,{context:`Confirmation`});let i=(0,$.jsxs)(b,{flexDirection:`column`,marginX:2,children:[(0,$.jsx)(x,{bold:!0,children:L(e.ruleValue)}),(0,$.jsx)(Oe,{ruleValue:e.ruleValue}),(0,$.jsx)(Ge,{rule:e})]}),a=(0,$.jsx)(b,{marginLeft:3,children:r.pending?(0,$.jsxs)(x,{dimColor:!0,children:[`Press `,r.keyName,` again to exit`]}):(0,$.jsx)(x,{dimColor:!0,children:`Esc to cancel`})});return e.source===`policySettings`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(b,{flexDirection:`column`,gap:1,borderStyle:`round`,paddingLeft:1,paddingRight:1,borderColor:`permission`,children:[(0,$.jsx)(x,{bold:!0,color:`permission`,children:`Rule details`}),i,(0,$.jsxs)(x,{italic:!0,children:[`This rule is configured by managed settings and cannot be modified.`,`
|
|
2
|
-
`,`Contact your system administrator for more information.`]})]}),a]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(b,{flexDirection:`column`,gap:1,borderStyle:`round`,paddingLeft:1,paddingRight:1,borderColor:`error`,children:[(0,$.jsxs)(x,{bold:!0,color:`error`,children:[`Delete `,Ke(e.ruleBehavior),` tool?`]}),i,(0,$.jsx)(x,{children:`Are you sure you want to delete this permission rule?`}),(0,$.jsx)(g,{onChange:e=>e===`yes`?t():n(),onCancel:n,options:[{label:`Yes`,value:`yes`},{label:`No`,value:`no`}]})]}),a]})}function Je(e){let{options:t,searchQuery:n,isSearchMode:r,isFocused:i,onSelect:a,onCancel:o,lastFocusedRuleKey:s,cursorOffset:c,onHeaderFocusChange:l}=e,u=k(),{headerFocused:d,focusHeader:f,blurHeader:p}=S();return(0,Q.useEffect)(()=>{r&&d&&p()},[r,d,p]),(0,Q.useEffect)(()=>{l?.(d)},[d,l]),(0,$.jsxs)(b,{flexDirection:`column`,children:[(0,$.jsx)(b,{marginBottom:1,flexDirection:`column`,children:(0,$.jsx)(E,{query:n,isFocused:r&&!d,isTerminalFocused:i,width:u,cursorOffset:c})}),(0,$.jsx)(g,{options:t,onChange:a,onCancel:o,visibleOptionCount:Math.min(10,t.length),isDisabled:r||d,defaultFocusValue:s,onUpFromFirstItem:f})]})}function Ye({tab:e,getRulesOptions:t,handleToolSelect:n,...r}){return(0,$.jsxs)(b,{flexDirection:`column`,flexShrink:e===`allow`?0:void 0,children:[(0,$.jsx)(x,{children:{allow:`Claude Code won't ask before using allowed tools.`,ask:`Claude Code will always ask for confirmation before using these tools.`,deny:`Claude Code will always reject requests to use denied tools.`}[e]}),(0,$.jsx)(Je,{options:t(e,r.searchQuery).options,onSelect:t=>n(t,e),...r})]})}function Xe({onExit:e,initialTab:t,onRetryDenials:n}){let i=De().length>0,o=t??(i?`recent`:`allow`),[s,c]=(0,Q.useState)([]),u=ae(e=>e.toolPermissionContext),f=l(),ee=le(),te=(0,Q.useRef)({approved:new Set,retry:new Set,denials:[]}),ne=(0,Q.useCallback)(e=>{te.current=e},[]),[m,h]=(0,Q.useState)(),[g,ie]=(0,Q.useState)(),[_,v]=(0,Q.useState)(null),[y,S]=(0,Q.useState)(null),[C,w]=(0,Q.useState)(!1),[T,E]=(0,Q.useState)(null),[D,k]=(0,Q.useState)(!1),[ue,fe]=(0,Q.useState)(!0),A=(0,Q.useCallback)(e=>{fe(e)},[]),M=(0,Q.useMemo)(()=>{let e=new Map;return a(u).forEach(t=>{e.set(I(t),t)}),e},[u]),N=(0,Q.useMemo)(()=>{let e=new Map;return d(u).forEach(t=>{e.set(I(t),t)}),e},[u]),me=(0,Q.useMemo)(()=>{let e=new Map;return p(u).forEach(t=>{e.set(I(t),t)}),e},[u]),P=(0,Q.useCallback)((e,t=``)=>{let n=(()=>{switch(e){case`allow`:return M;case`deny`:return N;case`ask`:return me;case`workspace`:case`recent`:return new Map}})(),i=[];e!==`workspace`&&e!==`recent`&&!t&&i.push({label:`Add a new rule${r.ellipsis}`,value:`add-new-rule`});let a=Array.from(n.keys()).sort((e,t)=>{let r=n.get(e),i=n.get(t);if(r&&i){let e=L(r.ruleValue).toLowerCase(),t=L(i.ruleValue).toLowerCase();return e.localeCompare(t)}return 0}),o=t.toLowerCase();for(let e of a){let r=n.get(e);if(r){let n=L(r.ruleValue);if(t&&!n.toLowerCase().includes(o))continue;i.push({label:n,value:e})}}return{options:i,rulesByKey:n}},[M,N,me]),F=ve(),R=!m&&!_&&!y&&!C&&!T,{query:he,setQuery:z,cursorOffset:B}=Ce({isActive:R&&D,onExit:()=>{k(!1)}}),V=(0,Q.useCallback)(e=>{R&&(D||e.ctrl||e.meta||(e.key===`/`?(e.preventDefault(),k(!0),z(``)):e.key.length===1&&e.key!==`j`&&e.key!==`k`&&e.key!==`m`&&e.key!==`i`&&e.key!==`r`&&e.key!==` `&&(e.preventDefault(),k(!0),z(e.key))))},[R,D,z]),H=(0,Q.useCallback)((e,t)=>{let{rulesByKey:n}=P(t);if(e===`add-new-rule`){v(t);return}else{h(n.get(e));return}},[P]),ge=(0,Q.useCallback)(()=>{v(null)},[]),_e=(0,Q.useCallback)((e,t)=>{S({ruleValue:e,ruleBehavior:t}),v(null)},[]),ye=(0,Q.useCallback)((e,t)=>{S(null);for(let t of e)c(e=>[...e,`Added ${t.ruleBehavior} rule ${j.bold(L(t.ruleValue))}`]);if(t&&t.length>0)for(let e of t){let t=e.shadowType===`deny`?`blocked`:`shadowed`;c(n=>[...n,j.yellow(`${r.warning} Warning: ${L(e.rule.ruleValue)} is ${t}`),j.dim(` ${e.reason}`),j.dim(` Fix: ${e.fix}`)])}},[]),be=(0,Q.useCallback)(()=>{S(null)},[]),Se=(0,Q.useCallback)(()=>w(!0),[]),we=(0,Q.useCallback)(e=>E(e),[]),Te=(0,Q.useCallback)(()=>{let t=te.current,r=e=>Array.from(e).map(e=>t.denials[e]).filter(e=>e!==void 0),i=r(t.retry);if(i.length>0){let t=i.map(e=>e.display);n?.(t),e(void 0,{shouldQuery:!0,metaMessages:[`Permission granted for: ${t.join(`, `)}. You may now retry ${t.length===1?`this command`:`these commands`} if you would like.`]});return}let a=r(t.approved);a.length>0||s.length>0?e([...a.length>0?[`Approved ${a.map(e=>j.bold(e.display)).join(`, `)}`]:[],...s].join(`
|
|
3
|
-
`)):e(`Permissions dialog dismissed`,{display:`system`})},[s,e,n]);ce(`confirm:no`,Te,{context:`Settings`,isActive:R&&!D});let Ee=()=>{if(!m)return;let{options:e}=P(m.ruleBehavior),t=I(m),n=e.filter(e=>e.value!==`add-new-rule`).map(e=>e.value),r=n.indexOf(t),i;r!==-1&&(r<n.length-1?i=n[r+1]:r>0&&(i=n[r-1])),ie(i),se({rule:m,initialContext:u,setToolPermissionContext(e){f(t=>({...t,toolPermissionContext:e}))}}),c(e=>[...e,`Deleted ${m.ruleBehavior} rule ${j.bold(L(m.ruleValue))}`]),h(void 0)};if(m)return(0,$.jsx)(qe,{rule:m,onDelete:Ee,onCancel:()=>h(void 0)});if(_&&_!==`workspace`&&_!==`recent`)return(0,$.jsx)(Pe,{onCancel:ge,onSubmit:_e,ruleBehavior:_});if(y)return(0,$.jsx)(je,{onAddRules:ye,onCancel:be,ruleValues:[y.ruleValue],ruleBehavior:y.ruleBehavior,initialContext:u,setToolPermissionContext:e=>{f(t=>({...t,toolPermissionContext:e}))}});if(C)return(0,$.jsx)(xe,{onAddDirectory:(e,t)=>{let n={type:`addDirectories`,directories:[e],destination:t?`localSettings`:`session`},r=re(u,n);f(e=>({...e,toolPermissionContext:r})),t&&oe(n),c(n=>[...n,`Added directory ${j.bold(e)} to workspace${t?` and saved to local settings`:` for this session`}`]),w(!1)},onCancel:()=>w(!1),permissionContext:u});if(T)return(0,$.jsx)(ze,{directoryPath:T,onRemove:()=>{c(e=>[...e,`Removed directory ${j.bold(T)} from workspace`]),E(null)},onCancel:()=>E(null),permissionContext:u,setPermissionContext:e=>{f(t=>({...t,toolPermissionContext:e}))}});let U={searchQuery:he,isSearchMode:D,isFocused:ee,onCancel:Te,lastFocusedRuleKey:g,cursorOffset:B,getRulesOptions:P,handleToolSelect:H,onHeaderFocusChange:A};return(0,$.jsx)(b,{flexDirection:`column`,onKeyDown:V,children:(0,$.jsxs)(pe,{color:`permission`,children:[(0,$.jsxs)(de,{title:`Permissions:`,color:`permission`,defaultTab:o,hidden:!!m||!!_||!!y||C||!!T,initialHeaderFocused:!i,navFromContent:!D,children:[(0,$.jsx)(O,{id:`recent`,title:`Recently denied`,children:(0,$.jsx)(Le,{onHeaderFocusChange:A,onStateChange:ne})}),(0,$.jsx)(O,{id:`allow`,title:`Allow`,children:(0,$.jsx)(Ye,{tab:`allow`,...U})}),(0,$.jsx)(O,{id:`ask`,title:`Ask`,children:(0,$.jsx)(Ye,{tab:`ask`,...U})}),(0,$.jsx)(O,{id:`deny`,title:`Deny`,children:(0,$.jsx)(Ye,{tab:`deny`,...U})}),(0,$.jsx)(O,{id:`workspace`,title:`Workspace`,children:(0,$.jsxs)(b,{flexDirection:`column`,children:[(0,$.jsx)(x,{children:`Work Mate can read files in the workspace, and make edits when auto-accept edits is on.`}),(0,$.jsx)(He,{onExit:e,toolPermissionContext:u,onRequestAddDirectory:Se,onRequestRemoveDirectory:we,onHeaderFocusChange:A})]})})]}),(0,$.jsx)(b,{marginTop:1,paddingLeft:1,children:(0,$.jsx)(x,{dimColor:!0,children:F.pending?(0,$.jsxs)($.Fragment,{children:[`Press `,F.keyName,` again to exit`]}):ue?(0,$.jsx)($.Fragment,{children:`←/→ tab switch · ↓ return · Esc cancel`}):D?(0,$.jsx)($.Fragment,{children:`Type to filter · Enter/↓ select · ↑ tabs · Esc clear`}):i&&o===`recent`?(0,$.jsx)($.Fragment,{children:`Enter approve · r retry · ↑↓ navigate · ←/→ switch · Esc cancel`}):(0,$.jsx)($.Fragment,{children:`↑↓ navigate · Enter select · Type to search · ←/→ switch · Esc cancel`})})})]})})}var Q,$,Ze=e((()=>{C(),n(),w(),Q=t(w(),1),c(),y(),v(),ye(),we(),A(),_(),U(),H(),ee(),F(),Se(),Ne(),be(),ke(),Ie(),Re(),Ve(),We(),$=N()})),Qe,$e;e((()=>{Ze(),s(),Qe=N(),$e=async(e,t)=>(0,Qe.jsx)(Xe,{onExit:e,onRetryDenials:e=>{t.setMessages(t=>[...t,te(e)])}})}))();export{$e as call};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{n as t,t as n}from"./memoize-BK3gG5ob.js";import{c as r,l as i,n as a,o}from"./envUtils-BDhHQY0-.js";import{n as s,t as c}from"./axios-DaWTGg7G.js";import{BT as ee,LT as te,rf as ne}from"./loadAgentsDir-C7lOqvfh.js";import{n as re}from"./cwd-Cfdf7z7s.js";import{C as l,E as ie,H as ae,O as oe,S as u,V as se,W as ce,a as d,d as f,l as p,p as m,w as le,z as h}from"./debug-RAynG_nM.js";import{Gt as ue,Jt as de,M as g,P as fe,Yt as pe,Zt as me,g as he,n as ge}from"./settings-DnptdP79.js";import{a as _e,c as _,h as v,i as ve}from"./config-Do1870_d.js";import{c as ye,n as y,o as be,r as b,t as x}from"./execFileNoThrow-Dwu6psHW.js";import{o as S,s as C}from"./log-CezCRpAN.js";import{n as xe,t as Se}from"./which-DzFN5TNM.js";import{i as w,o as T}from"./platform-BMPbglug.js";import{n as E,t as Ce}from"./bundledMode--fG1S62b.js";import{dt as we,ut as Te}from"./sessionState-Bifmu95-.js";import{a as Ee,i as De}from"./ripgrep-DvOOsDMv.js";import{i as Oe,r as ke}from"./genericProcessUtils-CmsUPyRz.js";import{homedir as D}from"os";import{basename as Ae,delimiter as je,join as O,posix as k,win32 as A}from"path";import{constants as Me}from"fs";import{access as j,open as Ne,readFile as M,realpath as N,stat as Pe}from"fs/promises";function P(){return O(a(),`local`)}function Fe(){return O(P(),`claude`)}function Ie(){return(process.argv[1]||``).includes(`/.claude/local/node_modules/`)}async function F(){try{return await j(O(P(),`node_modules`,`.bin`,`claude`)),!0}catch{return!1}}function I(){let e=process.env.SHELL||``;return e.includes(`zsh`)?`zsh`:e.includes(`bash`)?`bash`:e.includes(`fish`)?`fish`:`unknown`}var L=e((()=>{v(),o(),h(),b(),m(),S(),u()}));function R(e){let t=e?.homedir??D();return{zsh:O((e?.env??process.env).ZDOTDIR||t,`.zshrc`),bash:O(t,`.bashrc`),fish:O(t,`.config/fish/config.fish`)}}function Le(e){let t=!1;return{filtered:e.filter(e=>{if(V.test(e)){let n=e.match(/alias\s+claude\s*=\s*["']([^"']+)["']/);if(n||(n=e.match(/alias\s+claude\s*=\s*([^#\n]+)/)),n&&n[1]&&n[1].trim()===Fe())return t=!0,!1}return!0}),hadAlias:t}}async function z(e){try{return(await M(e,{encoding:`utf8`})).split(`
|
|
2
|
-
`)}catch(e){if(ae(e))return null;throw e}}async function Re(e,t){let n=await Ne(e,`w`);try{await n.writeFile(t.join(`
|
|
3
|
-
`),{encoding:`utf8`}),await n.datasync()}finally{await n.close()}}async function B(e){let t=R(e);for(let e of Object.values(t)){let t=await z(e);if(t){for(let e of t)if(V.test(e)){let t=e.match(/alias\s+claude=["']?([^"'\s]+)/);if(t&&t[1])return t[1]}}}return null}async function ze(e){let t=await B(e);if(!t)return null;let n=e?.homedir??D(),r=t.startsWith(`~`)?t.replace(`~`,n):t;try{let e=await Pe(r);if(e.isFile()||e.isSymbolicLink())return t}catch{}return null}var V,H=e((()=>{h(),L(),V=/^\s*alias\s+claude\s*=/}));async function Be(){}function Ve(e){let t=ge()?.minimumVersion;if(!t)return!1;let n=!Te(e,t);return n&&p(`Skipping update to ${e} - below minimumVersion ${t}`),n}async function He(){let e=ue.isRunningWithBun(),t=null;return t=e?await y(`bun`,[`pm`,`bin`,`-g`],{cwd:D()}):await y(`npm`,[`-g`,`config`,`get`,`prefix`],{cwd:D()}),t.code===0?t.stdout.trim():(C(Error(`Failed to check ${e?`bun`:`npm`} permissions`)),null)}async function Ue(){try{let e=await He();if(!e)return{hasPermissions:!1,npmPrefix:null};try{return await j(e,Me.W_OK),{hasPermissions:!0,npmPrefix:e}}catch{return C(new Je(`Insufficient permissions for global npm install.`)),{hasPermissions:!1,npmPrefix:e}}}catch(e){return C(e),{hasPermissions:!1,npmPrefix:null}}}async function We(){let e=await y(`npm`,[`view`,``,`dist-tags`,`--json`,`--prefer-online`],{abortSignal:AbortSignal.timeout(5e3),cwd:D()});if(e.code!==0)return p(`npm view dist-tags failed with code ${e.code}`),{latest:null,stable:null};try{let t=l(e.stdout.trim());return{latest:typeof t.latest==`string`?t.latest:null,stable:typeof t.stable==`string`?t.stable:null}}catch(e){return p(`Failed to parse dist-tags: ${e}`),{latest:null,stable:null}}}async function Ge(e){try{return(await s.get(`${qe}/${e}`,{timeout:5e3,responseType:`text`})).data.trim()}catch(t){return p(`Failed to fetch ${e} from GCS: ${t}`),null}}async function Ke(){let[e,t]=await Promise.all([Ge(`latest`),Ge(`stable`)]);return{latest:e,stable:t}}var qe,Je,Ye=e((()=>{c(),v(),d(),de(),o(),h(),b(),m(),ne(),S(),we(),he(),H(),u(),qe=`https://storage.googleapis.com/claude-code-dist-86c565f3-f756-42ad-8dfa-d59b1c096819/claude-code-releases`,Je=class extends oe{}}));function U(e,t){return t.includes(e.id)||e.idLike.some(e=>t.includes(e))}function Xe(){let e=process.execPath||process.argv[0]||``;return/[/\\]mise[/\\]installs[/\\]/i.test(e)?(p(`Detected mise installation: ${e}`),!0):!1}function Ze(){let e=process.execPath||process.argv[0]||``;return/[/\\]\.?asdf[/\\]installs[/\\]/i.test(e)?(p(`Detected asdf installation: ${e}`),!0):!1}function W(){let e=w();if(e!==`macos`&&e!==`linux`&&e!==`wsl`)return!1;let t=process.execPath||process.argv[0]||``;return t.includes(`/Caskroom/`)?(p(`Detected Homebrew cask installation: ${t}`),!0):!1}function Qe(){if(w()!==`windows`)return!1;let e=process.execPath||process.argv[0]||``;for(let t of[/Microsoft[/\\]WinGet[/\\]Packages/i,/Microsoft[/\\]WinGet[/\\]Links/i])if(t.test(e))return p(`Detected winget installation: ${e}`),!0;return!1}var G,K,q,J,Y,$e,et=e((()=>{n(),d(),b(),T(),G=t(async()=>{try{let e=await M(`/etc/os-release`,`utf8`),t=e.match(/^ID=["']?(\S+?)["']?\s*$/m),n=e.match(/^ID_LIKE=["']?(.+?)["']?\s*$/m);return{id:t?.[1]??``,idLike:n?.[1]?.split(` `)??[]}}catch{return null}}),K=t(async()=>{if(w()!==`linux`)return!1;let e=await G();if(e&&!U(e,[`arch`]))return!1;let t=await x(`pacman`,[`-Qo`,process.execPath||process.argv[0]||``],{timeout:5e3,useCwd:!1});return t.code===0&&t.stdout?(p(`Detected pacman installation: ${t.stdout.trim()}`),!0):!1}),q=t(async()=>{if(w()!==`linux`)return!1;let e=await G();if(e&&!U(e,[`debian`]))return!1;let t=await x(`dpkg`,[`-S`,process.execPath||process.argv[0]||``],{timeout:5e3,useCwd:!1});return t.code===0&&t.stdout?(p(`Detected deb installation: ${t.stdout.trim()}`),!0):!1}),J=t(async()=>{if(w()!==`linux`)return!1;let e=await G();if(e&&!U(e,[`fedora`,`rhel`,`suse`]))return!1;let t=await x(`rpm`,[`-qf`,process.execPath||process.argv[0]||``],{timeout:5e3,useCwd:!1});return t.code===0&&t.stdout?(p(`Detected rpm installation: ${t.stdout.trim()}`),!0):!1}),Y=t(async()=>{if(w()!==`linux`)return!1;let e=await G();if(e&&!U(e,[`alpine`]))return!1;let t=await x(`apk`,[`info`,`--who-owns`,process.execPath||process.argv[0]||``],{timeout:5e3,useCwd:!1});return t.code===0&&t.stdout?(p(`Detected apk installation: ${t.stdout.trim()}`),!0):!1}),$e=t(async()=>W()?`homebrew`:Qe()?`winget`:Xe()?`mise`:Ze()?`asdf`:await K()?`pacman`:await Y()?`apk`:await q()?`deb`:await J()?`rpm`:`unknown`)}));function tt(){let e=process.argv[1]||``,t=process.execPath||process.argv[0]||``;return w()===`windows`&&(e=e.split(A.sep).join(k.sep),t=t.split(A.sep).join(k.sep)),[e,t]}async function nt(){let[e]=tt();if(E())return W()||Qe()||Xe()||Ze()||await K()||await q()||await J()||await Y()?`package-manager`:`native`;if(Ie())return`npm-local`;if([`/usr/local/lib/node_modules`,`/usr/lib/node_modules`,`/opt/homebrew/lib/node_modules`,`/opt/homebrew/bin`,`/usr/local/bin`,`/.nvm/versions/node/`].some(t=>e.includes(t))||e.includes(`/npm/`)||e.includes(`/nvm/`))return`npm-global`;let t=await be(`npm config get prefix`,{shell:!0,reject:!1}),n=t.exitCode===0?t.stdout.trim():null;return n&&e.startsWith(n)?`npm-global`:`unknown`}async function rt(){if(E()){try{return await N(process.execPath)}catch{}try{let e=await xe(`claude`);if(e)return e}catch{}try{return await f().stat(O(D(),`.local/bin/claude`)),O(D(),`.local/bin/claude`)}catch{}return`native`}try{return process.argv[0]||`unknown`}catch{return`unknown`}}function it(){try{return E()?process.execPath||`unknown`:process.argv[1]||`unknown`}catch{return`unknown`}}async function at(){let e=f(),t=[],n=O(D(),`.claude`,`local`);await F()&&t.push({type:`npm-local`,path:n});let r=[`@anthropic-ai/claude-code`],i=await x(`npm`,[`-g`,`config`,`get`,`prefix`]);if(i.code===0&&i.stdout){let n=i.stdout.trim(),a=w()===`windows`,o=a?O(n,`claude`):O(n,`bin`,`claude`),s=!1;try{await e.stat(o),s=!0}catch{}if(s){let e=!1;try{(await N(o)).includes(`/Caskroom/`)&&(e=W())}catch{}e||t.push({type:`npm-global`,path:o})}else for(let i of r){let r=a?O(n,`node_modules`,i):O(n,`lib`,`node_modules`,i);try{await e.stat(r),t.push({type:`npm-global-orphan`,path:r})}catch{}}}let a=O(D(),`.local`,`bin`,`claude`);try{await e.stat(a),t.push({type:`native`,path:a})}catch{}if(_().installMethod===`native`){let n=O(D(),`.local`,`share`,`claude`);try{await e.stat(n),t.some(e=>e.type===`native`)||t.push({type:`native`,path:n})}catch{}}return t}async function ot(e){let t=[];try{let e=l(await M(O(pe(),`managed-settings.json`),`utf-8`)),n=e&&typeof e==`object`?e.strictPluginOnlyCustomization:void 0;if(n!==void 0&&typeof n!=`boolean`)if(!Array.isArray(n))t.push({issue:`managed-settings.json: strictPluginOnlyCustomization has an invalid value (expected true or an array, got ${typeof n})`,fix:`The field is silently ignored (schema .catch rescues it). Set it to true, or an array of: ${g.join(`, `)}.`});else{let e=n.filter(e=>typeof e==`string`&&!g.includes(e));e.length>0&&t.push({issue:`managed-settings.json: strictPluginOnlyCustomization has ${e.length} value(s) this client doesn't recognize: ${e.map(String).join(`, `)}`,fix:`These are silently ignored (forwards-compat). Known surfaces for this version: ${g.join(`, `)}. Either remove them, or this client is older than the managed-settings intended.`})}}catch{}let n=_();if(e===`development`)return t;if(e===`native`){let e=(process.env.PATH||``).split(je),n=O(D(),`.local`,`bin`),r=n;if(w()===`windows`&&(r=n.split(A.sep).join(k.sep)),!e.some(e=>{let t=e;w()===`windows`&&(t=e.split(A.sep).join(k.sep));let n=t.replace(/\/+$/,``),i=e.replace(/[/\\]+$/,``);return n===r||i===`~/.local/bin`||i===`$HOME/.local/bin`}))if(w()===`windows`){let e=n.split(k.sep).join(A.sep);t.push({issue:`Native installation exists but ${e} is not in your PATH`,fix:`Add it by opening: System Properties → Environment Variables → Edit User PATH → New → Add the path above. Then restart your terminal.`})}else{let e=I(),n=R()[e],r=n?n.replace(D(),`~`):`your shell config file`;t.push({issue:`Native installation exists but ~/.local/bin is not in your PATH`,fix:`Run: echo 'export PATH="$HOME/.local/bin:$PATH"' >> ${r} then open a new terminal or run: source ${r}`})}}i(process.env.DISABLE_INSTALLATION_CHECKS)||(e===`npm-local`&&n.installMethod!==`local`&&t.push({issue:`Running from local installation but config install method is '${n.installMethod}'`,fix:`Consider using native installation: claude install`}),e===`native`&&n.installMethod!==`native`&&t.push({issue:`Running native installation but config install method is '${n.installMethod}'`,fix:`Run claude install to update configuration`})),e===`npm-global`&&await F()&&t.push({issue:`Local installation exists but not being used`,fix:`Consider using native installation: claude install`});let r=await B(),a=await ze();return e===`npm-local`&&!await xe(`claude`)&&!a&&(r?t.push({issue:`Local installation not accessible`,fix:`Alias exists but points to invalid target: ${r}. Update alias: alias claude="~/.claude/local/claude"`}):t.push({issue:`Local installation not accessible`,fix:`Create alias: alias claude="~/.claude/local/claude"`})),t}function st(){if(w()!==`linux`)return[];let e=[],t=te.getLinuxGlobPatternWarnings();if(t.length>0){let n=t.slice(0,3).join(`, `),r=t.length-3,i=r>0?`${n} (${r} more)`:n;e.push({issue:`Glob patterns in sandbox permission rules are not fully supported on Linux`,fix:`Found ${t.length} pattern(s): ${i}. On Linux, glob patterns in Edit/Read rules will be ignored.`})}return e}async function ct(){let e=await nt(),t=typeof MACRO<`u`?`0.0.10`:`unknown`,n=await rt(),r=it(),i=await at(),a=await ot(e);if(a.push(...st()),e===`native`){let e=i.filter(e=>e.type===`npm-global`||e.type===`npm-global-orphan`||e.type===`npm-local`),t=w()===`windows`;for(let n of e)n.type===`npm-global`?a.push({issue:`Leftover npm global installation at ${n.path}`,fix:`Run: npm -g uninstall @anthropic-ai/claude-code`}):n.type===`npm-global-orphan`?a.push({issue:`Orphaned npm global package at ${n.path}`,fix:t?`Run: rmdir /s /q "${n.path}"`:`Run: rm -rf ${n.path}`}):n.type===`npm-local`&&a.push({issue:`Leftover npm local installation at ${n.path}`,fix:t?`Run: rmdir /s /q "${n.path}"`:`Run: rm -rf ${n.path}`})}let o=_().installMethod||`not set`,s=null;e===`npm-global`&&(s=(await Ue()).hasPermissions,!s&&!_e()&&a.push({issue:`Insufficient permissions for auto-updates`,fix:"Do one of: (1) Re-install node without sudo, or (2) Use `claude install` for native installation"}));let c=De(),ee={working:c.working??!0,mode:c.mode,systemPath:c.mode===`system`?c.path:null,note:c.note??null},te=e===`package-manager`?await $e():void 0;return{installationType:e,version:t,installationPath:n,invokedBinary:r,configInstallMethod:o,autoUpdates:(()=>{let e=_e();return e?`disabled (${ve(e)})`:`enabled`})(),hasUpdatePermissions:s,multipleInstallations:i,warnings:a,packageManager:te,ripgrepStatus:ee}}var lt=e((()=>{ye(),Ye(),Ce(),v(),re(),o(),b(),m(),L(),et(),T(),Ee(),ee(),me(),fe(),H(),u(),Se()}));function ut(){let e=process.env.ENABLE_PID_BASED_VERSION_LOCKING;return i(e)?!0:(r(e),!1)}function X(e){if(e<=1)return!1;try{return process.kill(e,0),!0}catch{return!1}}function dt(e,t){if(!X(e))return!1;if(e===process.pid)return!0;try{let n=ke(e);if(!n)return!0;let r=n.toLowerCase(),i=t.toLowerCase();return r.includes(`claude`)||r.includes(i)}catch{return!0}}function Z(e){let t=f();try{let n=t.readFileSync(e,{encoding:`utf8`});if(!n||n.trim()===``)return null;let r=l(n);return typeof r.pid!=`number`||!r.version||!r.execPath?null:r}catch{return null}}function Q(e){let t=Z(e);if(!t)return!1;let{pid:n,execPath:r}=t;if(!X(n))return!1;if(!dt(n,r))return p(`Lock PID ${n} is running but does not appear to be Claude - treating as stale`),!1;let i=f();try{let t=i.statSync(e);if(Date.now()-t.mtimeMs>$&&!X(n))return!1}catch{}return!0}function ft(e,t){let n=f(),r=`${e}.tmp.${process.pid}.${Date.now()}`;try{ie(r,le(t,null,2),{encoding:`utf8`,flush:!0}),n.renameSync(r,e)}catch(e){try{n.unlinkSync(r)}catch{}throw e}}async function pt(e,t){let n=f(),r=Ae(e);if(Q(t))return p(`Cannot acquire lock for ${r} - held by PID ${Z(t)?.pid}`),null;let i={pid:process.pid,version:r,execPath:process.execPath,acquiredAt:Date.now()};try{return ft(t,i),Z(t)?.pid===process.pid?(p(`Acquired PID lock for ${r} (PID ${process.pid})`),()=>{try{Z(t)?.pid===process.pid&&(n.unlinkSync(t),p(`Released PID lock for ${r}`))}catch(e){p(`Failed to release lock for ${r}: ${e}`)}}):null}catch(e){return p(`Failed to acquire lock for ${r}: ${e}`),null}}async function mt(e,t){let n=await pt(e,t);if(!n)return!1;let r=()=>{try{n()}catch{}};return process.on(`exit`,r),process.on(`SIGINT`,r),process.on(`SIGTERM`,r),!0}async function ht(e,t,n){let r=await pt(e,t);if(!r)return!1;try{return await n(),!0}finally{r()}}function gt(e){let t=f(),n=[];try{let r=t.readdirStringSync(e).filter(e=>e.endsWith(`.lock`));for(let t of r){let r=O(e,t),i=Z(r);i&&n.push({version:i.version,pid:i.pid,isProcessRunning:X(i.pid),execPath:i.execPath,acquiredAt:new Date(i.acquiredAt),lockFilePath:r})}}catch(e){if(se(e))return n;C(ce(e))}return n}function _t(e){let t=f(),n=0;try{let r=t.readdirStringSync(e).filter(e=>e.endsWith(`.lock`));for(let i of r){let r=O(e,i);try{t.lstatSync(r).isDirectory()?(t.rmSync(r,{recursive:!0,force:!0}),n++,p(`Cleaned up legacy directory lock: ${i}`)):Q(r)||(t.unlinkSync(r),n++,p(`Cleaned up stale lock: ${i}`))}catch{}}}catch(e){if(se(e))return 0;C(ce(e))}return n}var $,vt=e((()=>{d(),o(),h(),m(),Oe(),S(),u(),$=7200*1e3}));export{L as C,I as S,Le as _,Q as a,z as b,ht as c,lt as d,Ke as f,Ve as g,Ye as h,vt as i,nt as l,We as m,_t as n,ut as o,Be as p,gt as r,Z as s,mt as t,ct as u,R as v,Re as x,H as y};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{l as n,o as r}from"./envUtils-BDhHQY0-.js";import{n as i,t as a}from"./figures-5ThXQEtq.js";import{$C as o,$o as s,AS as c,Ao as l,Cg as u,Eg as d,Eo as f,FS as p,Fo as m,Go as h,Ho as g,IS as _,Ip as v,Iu as y,Jw as b,LS as x,Lg as S,Lp as C,MS as w,Mo as ee,NS as te,OS as T,PS as E,Qw as D,Qx as O,RS as ne,Rg as re,Ro as k,Ru as ie,TS as A,Vo as j,Xo as ae,Yo as oe,Zw as M,_T as se,as as N,bT as ce,bo as le,dT as ue,es as de,fd as fe,is as P,jS as pe,kS as F,ko as me,ls as he,mo as ge,ns as _e,pT as ve,pd as ye,po as be,qC as xe,qo as I,rs as Se,sT as L,ss as Ce,tS as we,ts as Te,us as Ee,vT as De,wS as Oe,wg as ke,xT as Ae,yo as je}from"./loadAgentsDir-C7lOqvfh.js";import{D as Me,Gr as Ne,Gt as R,H as Pe,I as z,P as B,T as V,Wt as Fe,Xn as Ie,fi as H,hn as Le,j as Re,k as ze,n as Be,ot as Ve,r as He,t as Ue,x as We,y as Ge}from"./src-P_wYS_NJ2.js";import{t as Ke}from"./jsx-runtime-Bb4Xn-E0.js";import{C as qe,F as Je,S as Ye,W as Xe,a as Ze,l as Qe,z as $e}from"./debug-RAynG_nM.js";import{In as et,Ln as tt,c as nt,f as rt,g as it,vt as at,x as ot,xt as st}from"./settings-DnptdP79.js";import{b as ct,h as lt}from"./config-Do1870_d.js";import{o as ut,s as dt}from"./log-CezCRpAN.js";import{n as ft,r as pt}from"./analytics-DJobLaWP.js";import{C as mt,y as ht}from"./startupProfiler-L_UWZ03w.js";import{l as gt,o as _t}from"./stringUtils-C84IJ91d.js";import{n as vt,t as yt}from"./pluginStartupCheck-CB2q2dLv.js";import{a as bt,d as xt,f as St,i as Ct,l as wt,o as Tt,s as Et,u as Dt}from"./pluginOperations-D90IRawu.js";import{a as Ot,c as kt,i as At,n as jt,o as Mt,s as Nt,t as Pt}from"./validatePlugin-Kk6pxnO2.js";import{a as Ft,n as It,o as Lt,r as Rt}from"./pluginFlagging-DZaYzecY.js";import{i as zt,n as Bt}from"./MCPConnectionManager-CUTuaa8T.js";import{n as Vt,t as Ht}from"./useExitOnCtrlCDWithKeybindings-ChqBs9Lr.js";import{t as Ut}from"./SearchBox-C9vUA4IM.js";import{n as Wt,t as Gt}from"./useSearchInput-C7Y1I9P9.js";import{a as Kt,c as qt,i as Jt,n as Yt,o as Xt,r as Zt,s as Qt,t as $t}from"./MCPToolListView-CvqB4nCw.js";import{i as en,n as tn}from"./pluginAutoupdate-SlRFJlTT.js";import*as nn from"path";import*as rn from"fs/promises";function an({inputValue:e,setInputValue:t,cursorOffset:n,setCursorOffset:r,error:i,setError:a,result:o,setResult:s,setViewState:c,onAddComplete:l,cliMode:u=!1}){let d=(0,on.useRef)(!1),[f,p]=(0,on.useState)(!1),[h,g]=(0,on.useState)(``),_=async()=>{let t=e.trim();if(!t){a(`Please enter a marketplace source`);return}let n=await Ot(t);if(!n){a(`Invalid marketplace source format. Try: owner/repo, https://..., or ./path`);return}if(`error`in n){a(n.error);return}a(null);try{p(!0),g(``);let{name:e,resolvedSource:t}=await m(n,e=>{g(e)});oe(e,{source:t}),he();let r=n.source;n.source===`github`&&(r=n.repo),pt(`tengu_marketplace_added`,{source_type:r}),l&&await l(),g(``),p(!1),u?s(`Successfully added marketplace: ${e}`):c({type:`browse-marketplace`,targetMarketplace:e})}catch(e){let t=Xe(e);dt(t),a(t.message),g(``),p(!1),s(u?`Error: ${t.message}`:null)}};return(0,on.useEffect)(()=>{e&&!d.current&&!i&&!o&&(d.current=!0,_())},[]),(0,U.jsxs)(z,{flexDirection:`column`,children:[(0,U.jsxs)(z,{flexDirection:`column`,paddingX:1,borderStyle:`round`,children:[(0,U.jsx)(z,{marginBottom:1,children:(0,U.jsx)(B,{bold:!0,children:`Add Marketplace`})}),(0,U.jsxs)(z,{flexDirection:`column`,children:[(0,U.jsx)(B,{children:`Enter marketplace source:`}),(0,U.jsx)(B,{dimColor:!0,children:`Examples:`}),(0,U.jsx)(B,{dimColor:!0,children:` · owner/repo (GitHub)`}),(0,U.jsx)(B,{dimColor:!0,children:` · git@github.com:owner/repo.git (SSH)`}),(0,U.jsx)(B,{dimColor:!0,children:` · https://example.com/marketplace.json`}),(0,U.jsx)(B,{dimColor:!0,children:` · ./path/to/marketplace`}),(0,U.jsx)(z,{marginTop:1,children:(0,U.jsx)(fe,{value:e,onChange:t,onSubmit:_,columns:80,cursorOffset:n,onChangeCursorOffset:r,focus:!0,showCursor:!0})})]}),f&&(0,U.jsxs)(z,{marginTop:1,children:[(0,U.jsx)(y,{}),(0,U.jsx)(B,{children:h||`Adding marketplace to configuration…`})]}),i&&(0,U.jsx)(z,{marginTop:1,children:(0,U.jsx)(B,{color:`error`,children:i})}),o&&(0,U.jsx)(z,{marginTop:1,children:(0,U.jsx)(B,{children:o})})]}),(0,U.jsx)(z,{marginLeft:3,children:(0,U.jsx)(B,{dimColor:!0,italic:!0,children:(0,U.jsxs)(V,{children:[(0,U.jsx)(Me,{shortcut:`Enter`,action:`add`}),(0,U.jsx)(v,{action:`confirm:no`,context:`Settings`,fallback:`Esc`,description:`cancel`})]})})})]})}var on,U,sn=e((()=>{H(),on=t(H(),1),ft(),C(),Ue(),ie(),ye(),$e(),ut(),Ee(),j(),At(),U=Ke()}));function cn(e,t,r,i){let a={};for(let o of e){let e=r[o],s=t[o]??``;if(!(e?.sensitive===!0&&s===``&&i?.[o]!==void 0))if(e?.type===`number`){if(s.trim()===``)continue;let e=Number(s);a[o]=Number.isNaN(e)?s:e}else e?.type===`boolean`?a[o]=n(s):a[o]=s}return a}function ln({title:e,subtitle:t,configSchema:n,initialValues:r,onSave:i,onCancel:o}){let s=Object.keys(n),c=(0,un.useCallback)(e=>{if(n[e]?.sensitive===!0)return``;let t=r?.[e];return t===void 0?``:String(t)},[n,r]),[l,u]=(0,un.useState)(0),[d,f]=(0,un.useState)({}),[p,m]=(0,un.useState)(()=>s[0]?c(s[0]):``),h=s[l],g=h?n[h]:null;if(Fe(`confirm:no`,o,{context:`Settings`}),R({"confirm:nextField":(0,un.useCallback)(()=>{if(l<s.length-1&&h){f(e=>({...e,[h]:p})),u(e=>e+1);let e=s[l+1];m(e?c(e):``)}},[l,s,h,p,c]),"confirm:yes":(0,un.useCallback)(()=>{if(!h)return;let e={...d,[h]:p};if(l===s.length-1)i(cn(s,e,n,r));else{f(e),u(e=>e+1);let t=s[l+1];m(t?c(t):``)}},[h,d,p,l,s,n,i,c,r])},{context:`Confirmation`}),Le((e,t)=>{if(t.backspace||t.delete){m(e=>e.slice(0,-1));return}e&&!t.ctrl&&!t.meta&&!t.tab&&!t.return&&m(t=>t+e)}),!g||!h)return null;let _=g.sensitive===!0,v=g.required===!0,y=_?`*`.repeat(Ne(p)):p;return(0,dn.jsxs)(Ge,{title:e,subtitle:t,onCancel:o,isCancelActive:!1,children:[(0,dn.jsxs)(z,{flexDirection:`column`,children:[(0,dn.jsxs)(B,{bold:!0,children:[g.title||h,v&&(0,dn.jsx)(B,{color:`error`,children:` *`})]}),g.description&&(0,dn.jsx)(B,{dimColor:!0,children:g.description}),(0,dn.jsxs)(z,{marginTop:1,children:[(0,dn.jsxs)(B,{children:[a.pointerSmall,` `]}),(0,dn.jsx)(B,{children:y}),(0,dn.jsx)(B,{children:`█`})]})]}),(0,dn.jsxs)(z,{flexDirection:`column`,children:[(0,dn.jsxs)(B,{dimColor:!0,children:[`Field `,l+1,` of `,s.length]}),l<s.length-1&&(0,dn.jsx)(B,{dimColor:!0,children:`Tab: Next field · Enter: Save and continue`}),l===s.length-1&&(0,dn.jsx)(B,{dimColor:!0,children:`Enter: Save configuration`})]})]})}var un,dn,fn=e((()=>{i(),un=t(H(),1),Ue(),xe(),r(),dn=Ke()}));async function pn(e){let{enabled:t,disabled:n}=await ge();return[...t,...n].find(t=>t.repository===e||t.source===e)}function mn({plugin:e,pluginId:t,onDone:n}){let[r]=hn.useState(()=>{let n=[],r=T(e);Object.keys(r).length>0&&n.push({key:`top-level`,title:`Configure ${e.name}`,subtitle:`Plugin options`,schema:r,load:()=>c(t),save:n=>pe(t,n,e.manifest.userConfig)});let i=Oe(e);for(let r of i)n.push({key:`channel:${r.server}`,title:`Configure ${r.displayName}`,subtitle:`Plugin: ${e.name}`,schema:r.configSchema,load:()=>E(t,r.server)??void 0,save:e=>_(t,r.server,e,r.configSchema)});return n}),[i,a]=hn.useState(0),o=hn.useRef(n);if(o.current=n,hn.useEffect(()=>{r.length===0&&o.current(`skipped`)},[r.length]),r.length===0)return null;let s=r[i];function l(e){try{s.save(e)}catch(e){n(`error`,Je(e));return}let t=i+1;t<r.length?a(t):n(`configured`)}return(0,gn.jsx)(ln,{title:s.title,subtitle:s.subtitle,configSchema:s.schema,initialValues:s.load(),onSave:l,onCancel:()=>n(`skipped`)},s.key)}var hn,gn,_n=e((()=>{hn=t(H(),1),$e(),w(),A(),be(),F(),fn(),gn=Ke()}));function vn(){let e=P();return(0,yn.jsxs)(z,{marginBottom:1,children:[(0,yn.jsxs)(B,{color:`claude`,children:[a.warning,` `]}),(0,yn.jsxs)(B,{dimColor:!0,italic:!0,children:[`Make sure you trust a plugin before installing, updating, or using it. We do not control what MCP servers, files, or other software are included in plugins and cannot verify that they will work as intended or that they won't change. See each plugin's homepage for more information.`,e?` ${e}`:``]})]})}var yn,bn=e((()=>{i(),H(),Ue(),N(),yn=Ke()}));function xn(e){return e.entry.source&&typeof e.entry.source==`object`&&`source`in e.entry.source&&e.entry.source.source===`github`&&typeof e.entry.source==`object`&&`repo`in e.entry.source?e.entry.source.repo:null}function Sn(e,t){let n=[{label:`Install for you (user scope)`,action:`install-user`},{label:`Install for all collaborators on this repository (project scope)`,action:`install-project`},{label:`Install for you, in this repo only (local scope)`,action:`install-local`}];return e&&n.push({label:`Open homepage`,action:`homepage`}),t&&n.push({label:`View on GitHub`,action:`github`}),n.push({label:`Back to plugin list`,action:`back`}),n}function Cn({hasSelection:e}){return(0,wn.jsx)(z,{marginTop:1,children:(0,wn.jsx)(B,{dimColor:!0,italic:!0,children:(0,wn.jsxs)(V,{children:[e&&(0,wn.jsx)(v,{action:`plugin:install`,context:`Plugin`,fallback:`i`,description:`install`,bold:!0}),(0,wn.jsx)(v,{action:`plugin:toggle`,context:`Plugin`,fallback:`Space`,description:`toggle`}),(0,wn.jsx)(v,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`details`}),(0,wn.jsx)(v,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]})})})}var wn,Tn=e((()=>{H(),C(),Ue(),wn=Ke()}));function En({totalItems:e,maxVisible:t=On,selectedIndex:n=0}){let r=e>t,i=(0,Dn.useRef)(0),a=(0,Dn.useMemo)(()=>{if(!r)return 0;let a=i.current;if(n<a)return i.current=n,n;if(n>=a+t){let e=n-t+1;return i.current=e,e}let o=Math.max(0,e-t),s=Math.min(a,o);return i.current=s,s},[n,t,r,e]),o=a,s=Math.min(a+t,e),c=(0,Dn.useCallback)(e=>r?e.slice(o,s):e,[r,o,s]),l=(0,Dn.useCallback)(e=>o+e,[o]),u=(0,Dn.useCallback)(e=>e>=o&&e<s,[o,s]),d=(0,Dn.useCallback)(e=>{},[]),f=(0,Dn.useCallback)(()=>{},[]),p=(0,Dn.useCallback)(()=>{},[]),m=(0,Dn.useCallback)((t,n)=>{n(Math.max(0,Math.min(t,e-1)))},[e]),h=(0,Dn.useCallback)((e,t)=>!1,[]),g=Math.max(1,Math.ceil(e/t));return{currentPage:Math.floor(a/t),totalPages:g,startIndex:o,endIndex:s,needsPagination:r,pageSize:t,getVisibleItems:c,toActualIndex:l,isOnCurrentPage:u,goToPage:d,nextPage:f,prevPage:p,handleSelectionChange:m,handlePageNavigation:h,scrollPosition:{current:n+1,total:e,canScrollUp:a>0,canScrollDown:a+t<e}}}var Dn,On,kn=e((()=>{Dn=t(H(),1),On=5}));function An({error:e,setError:t,result:n,setResult:r,setViewState:i,onInstallComplete:o,targetMarketplace:c,targetPlugin:u}){let[d,f]=(0,W.useState)(`marketplace-list`),[p,m]=(0,W.useState)(null),[h,_]=(0,W.useState)(null),[y,b]=(0,W.useState)([]),[x,S]=(0,W.useState)([]),[C,w]=(0,W.useState)(!0),[ee,te]=(0,W.useState)(null),[T,E]=(0,W.useState)(0),[D,O]=(0,W.useState)(new Set),[ie,A]=(0,W.useState)(new Set),j=En({totalItems:x.length,selectedIndex:T}),[ae,oe]=(0,W.useState)(0),[M,se]=(0,W.useState)(!1),[N,ce]=(0,W.useState)(null),[ue,de]=(0,W.useState)(null);Fe(`confirm:no`,jn.useCallback(()=>{d===`plugin-list`?c?i({type:`manage-marketplaces`,targetMarketplace:c}):y.length===1?i({type:`menu`}):(f(`marketplace-list`),m(null),O(new Set)):d===`plugin-details`?(f(`plugin-list`),_(null)):i({type:`menu`})},[d,c,i,y.length]),{context:`Confirmation`}),(0,W.useEffect)(()=>{async function e(){try{let e=await g(),{marketplaces:n,failures:r}=await Ce(e),i=[];for(let{name:e,config:t,data:r}of n)if(r){let n=et(r.plugins,t=>l(s(t.name,e)));i.push({name:e,totalPlugins:r.plugins.length,installedCount:n,source:Se(t.source)})}i.sort((e,t)=>e.name===`claude-plugin-directory`?-1:+(t.name===`claude-plugin-directory`)),b(i);let a=_e(r,et(n,e=>e.data!==null));if(a)if(a.type===`warning`)de(a.message+`. Showing available marketplaces.`);else throw Error(a.message);if(i.length===1&&!c&&!u){let e=i[0];e&&(m(e.name),f(`plugin-list`))}if(u){let n=null,r=null;for(let[t]of Object.entries(e)){let e=await k(t);if(e){let i=e.plugins.find(e=>e.name===u);if(i){let e=s(i.name,t);n={entry:i,marketplaceName:t,pluginId:e,isInstalled:me(e)},r=t;break}}}if(n&&r){let e=n.pluginId;me(e)?t(`Plugin '${e}' is already installed globally. Use '/plugin' to manage existing plugins.`):(m(r),_(n),f(`plugin-details`))}else t(`Plugin "${u}" not found in any marketplace`)}else c&&(i.some(e=>e.name===c)?(m(c),f(`plugin-list`)):t(`Marketplace "${c}" not found`))}catch(e){t(e instanceof Error?e.message:`Failed to load marketplaces`)}finally{w(!1)}}e()},[t,c,u]),(0,W.useEffect)(()=>{if(!p)return;let e=!1;async function n(n){w(!0);try{let t=await k(n);if(e)return;if(!t)throw Error(`Failed to load marketplace: ${n}`);let r=[];for(let e of t.plugins){let t=s(e.name,n);re(t)||r.push({entry:e,marketplaceName:n,pluginId:t,isInstalled:me(t)})}try{let t=await Nt();if(e)return;te(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;Qe(`Failed to fetch install counts: ${Je(t)}`),r.sort((e,t)=>e.entry.name.localeCompare(t.entry.name))}S(r),E(0),O(new Set)}catch(n){if(e)return;t(n instanceof Error?n.message:`Failed to load plugins`)}finally{w(!1)}}return n(p),()=>{e=!0}},[p,t]);let fe=async()=>{if(D.size===0)return;let e=x.filter(e=>D.has(e.pluginId));A(new Set(e.map(e=>e.pluginId)));let n=0,a=0,s=[];for(let t of e){let e=await le({pluginId:t.pluginId,entry:t.entry,marketplaceName:t.marketplaceName,scope:`user`});e.success?n++:(a++,s.push({name:t.entry.name,reason:e.error}))}A(new Set),O(new Set),he(),a===0?r(`✓ Installed ${n} ${gt(n,`plugin`)}. Run /reload-plugins to activate.`):n===0?t(`Failed to install: ${Te(s,!0)}`):r(`✓ Installed ${n} of ${n+a} plugins. Failed: ${Te(s,!1)}. Run /reload-plugins to activate successfully installed plugins.`),n>0&&o&&await o(),i({type:`menu`})},P=async(e,t=`user`)=>{se(!0),ce(null);let n=await le({pluginId:e.pluginId,entry:e.entry,marketplaceName:e.marketplaceName,scope:t});if(n.success){let t=await pn(e.pluginId);if(t){se(!1),f({type:`plugin-options`,plugin:t,pluginId:e.pluginId});return}r(n.message),o&&await o(),i({type:`menu`})}else se(!1),ce(n.error)};(0,W.useEffect)(()=>{e&&r(e)},[e,r]),R({"select:previous":()=>{T>0&&E(T-1)},"select:next":()=>{T<y.length-1&&E(T+1)},"select:accept":()=>{let e=y[T];e&&(m(e.name),f(`plugin-list`))}},{context:`Select`,isActive:d===`marketplace-list`}),R({"select:previous":()=>{T>0&&j.handleSelectionChange(T-1,E)},"select:next":()=>{T<x.length-1&&j.handleSelectionChange(T+1,E)},"select:accept":()=>{if(T===x.length&&D.size>0)fe();else if(T<x.length){let e=x[T];e&&(e.isInstalled?i({type:`manage-plugins`,targetPlugin:e.entry.name,targetMarketplace:e.marketplaceName}):(_(e),f(`plugin-details`),oe(0),ce(null)))}}},{context:`Select`,isActive:d===`plugin-list`}),R({"plugin:toggle":()=>{if(T<x.length){let e=x[T];if(e&&!e.isInstalled){let t=new Set(D);t.has(e.pluginId)?t.delete(e.pluginId):t.add(e.pluginId),O(t)}}},"plugin:install":()=>{D.size>0&&fe()}},{context:`Plugin`,isActive:d===`plugin-list`});let pe=jn.useMemo(()=>{if(!h)return[];let e=h.entry.homepage;return Sn(e,xn(h))},[h]);if(R({"select:previous":()=>{ae>0&&oe(ae-1)},"select:next":()=>{ae<pe.length-1&&oe(ae+1)},"select:accept":()=>{if(!h)return;let e=pe[ae]?.action,t=h.entry.homepage,n=xn(h);e===`install-user`?P(h,`user`):e===`install-project`?P(h,`project`):e===`install-local`?P(h,`local`):e===`homepage`&&t?ne(t):e===`github`&&n?ne(`https://github.com/${n}`):e===`back`&&(f(`plugin-list`),_(null))}},{context:`Select`,isActive:d===`plugin-details`&&!!h}),typeof d==`object`&&d.type===`plugin-options`){let{plugin:e,pluginId:t}=d;function n(e){r(e),o&&o(),i({type:`menu`})}return(0,G.jsx)(mn,{plugin:e,pluginId:t,onDone:(t,r)=>{switch(t){case`configured`:n(`✓ Installed and configured ${e.name}. Run /reload-plugins to apply.`);break;case`skipped`:n(`✓ Installed ${e.name}. Run /reload-plugins to apply.`);break;case`error`:n(`Installed but failed to save config: ${r}`);break}}})}if(C)return(0,G.jsx)(B,{children:`Loading…`});if(e)return(0,G.jsx)(B,{color:`error`,children:e});if(d===`marketplace-list`)return y.length===0?(0,G.jsxs)(z,{flexDirection:`column`,children:[(0,G.jsx)(z,{marginBottom:1,children:(0,G.jsx)(B,{bold:!0,children:`Select marketplace`})}),(0,G.jsx)(B,{children:`No marketplaces configured.`}),(0,G.jsxs)(B,{dimColor:!0,children:[`Add a marketplace first using `,`'Add marketplace'`,`.`]}),(0,G.jsx)(z,{marginTop:1,paddingLeft:1,children:(0,G.jsx)(B,{dimColor:!0,children:(0,G.jsx)(v,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`})})})]}):(0,G.jsxs)(z,{flexDirection:`column`,children:[(0,G.jsx)(z,{marginBottom:1,children:(0,G.jsx)(B,{bold:!0,children:`Select marketplace`})}),ue&&(0,G.jsx)(z,{marginBottom:1,flexDirection:`column`,children:(0,G.jsxs)(B,{color:`warning`,children:[a.warning,` `,ue]})}),y.map((e,t)=>(0,G.jsxs)(z,{flexDirection:`column`,marginBottom:+(t<y.length-1),children:[(0,G.jsx)(z,{children:(0,G.jsxs)(B,{color:T===t?`suggestion`:void 0,children:[T===t?a.pointer:` `,` `,e.name]})}),(0,G.jsx)(z,{marginLeft:2,children:(0,G.jsxs)(B,{dimColor:!0,children:[e.totalPlugins,` `,gt(e.totalPlugins,`plugin`),` available`,e.installedCount>0&&` · ${e.installedCount} already installed`,e.source&&` · ${e.source}`]})})]},e.name)),(0,G.jsx)(z,{marginTop:1,children:(0,G.jsx)(B,{dimColor:!0,italic:!0,children:(0,G.jsxs)(V,{children:[(0,G.jsx)(v,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`select`}),(0,G.jsx)(v,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`})]})})})]});if(d===`plugin-details`&&h){let e=h.entry.homepage,t=Sn(e,xn(h));return(0,G.jsxs)(z,{flexDirection:`column`,children:[(0,G.jsx)(z,{marginBottom:1,children:(0,G.jsx)(B,{bold:!0,children:`Plugin Details`})}),(0,G.jsxs)(z,{flexDirection:`column`,marginBottom:1,children:[(0,G.jsx)(B,{bold:!0,children:h.entry.name}),h.entry.version&&(0,G.jsxs)(B,{dimColor:!0,children:[`Version: `,h.entry.version]}),h.entry.description&&(0,G.jsx)(z,{marginTop:1,children:(0,G.jsx)(B,{children:h.entry.description})}),h.entry.author&&(0,G.jsx)(z,{marginTop:1,children:(0,G.jsxs)(B,{dimColor:!0,children:[`By:`,` `,typeof h.entry.author==`string`?h.entry.author:h.entry.author.name]})})]}),(0,G.jsxs)(z,{flexDirection:`column`,marginBottom:1,children:[(0,G.jsx)(B,{bold:!0,children:`Will install:`}),h.entry.commands&&(0,G.jsxs)(B,{dimColor:!0,children:[`· Commands:`,` `,Array.isArray(h.entry.commands)?h.entry.commands.join(`, `):Object.keys(h.entry.commands).join(`, `)]}),h.entry.agents&&(0,G.jsxs)(B,{dimColor:!0,children:[`· Agents:`,` `,Array.isArray(h.entry.agents)?h.entry.agents.join(`, `):Object.keys(h.entry.agents).join(`, `)]}),h.entry.hooks&&(0,G.jsxs)(B,{dimColor:!0,children:[`· Hooks: `,Object.keys(h.entry.hooks).join(`, `)]}),h.entry.mcpServers&&(0,G.jsxs)(B,{dimColor:!0,children:[`· MCP Servers:`,` `,Array.isArray(h.entry.mcpServers)?h.entry.mcpServers.join(`, `):typeof h.entry.mcpServers==`object`?Object.keys(h.entry.mcpServers).join(`, `):`configured`]}),!h.entry.commands&&!h.entry.agents&&!h.entry.hooks&&!h.entry.mcpServers&&(0,G.jsx)(G.Fragment,{children:typeof h.entry.source==`object`&&`source`in h.entry.source&&(h.entry.source.source===`github`||h.entry.source.source===`url`||h.entry.source.source===`npm`||h.entry.source.source===`pip`)?(0,G.jsx)(B,{dimColor:!0,children:`· Component summary not available for remote plugin`}):(0,G.jsx)(B,{dimColor:!0,children:`· Components will be discovered at installation`})})]}),(0,G.jsx)(vn,{}),N&&(0,G.jsx)(z,{marginBottom:1,children:(0,G.jsxs)(B,{color:`error`,children:[`Error: `,N]})}),(0,G.jsx)(z,{flexDirection:`column`,children:t.map((e,t)=>(0,G.jsxs)(z,{children:[ae===t&&(0,G.jsx)(B,{children:`> `}),ae!==t&&(0,G.jsx)(B,{children:` `}),(0,G.jsx)(B,{bold:ae===t,children:M&&e.action===`install`?`Installing…`:e.label})]},e.action))}),(0,G.jsx)(z,{marginTop:1,paddingLeft:1,children:(0,G.jsx)(B,{dimColor:!0,children:(0,G.jsxs)(V,{children:[(0,G.jsx)(v,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`select`}),(0,G.jsx)(v,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]})})})]})}if(x.length===0)return(0,G.jsxs)(z,{flexDirection:`column`,children:[(0,G.jsx)(z,{marginBottom:1,children:(0,G.jsx)(B,{bold:!0,children:`Install plugins`})}),(0,G.jsx)(B,{dimColor:!0,children:`No new plugins available to install.`}),(0,G.jsx)(B,{dimColor:!0,children:`All plugins from this marketplace are already installed.`}),(0,G.jsx)(z,{marginLeft:3,children:(0,G.jsx)(B,{dimColor:!0,italic:!0,children:(0,G.jsx)(v,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`})})})]});let F=j.getVisibleItems(x);return(0,G.jsxs)(z,{flexDirection:`column`,children:[(0,G.jsx)(z,{marginBottom:1,children:(0,G.jsx)(B,{bold:!0,children:`Install Plugins`})}),j.scrollPosition.canScrollUp&&(0,G.jsx)(z,{children:(0,G.jsxs)(B,{dimColor:!0,children:[` `,a.arrowUp,` more above`]})}),F.map((t,n)=>{let r=j.toActualIndex(n),i=T===r,o=D.has(t.pluginId),s=ie.has(t.pluginId);return(0,G.jsxs)(z,{flexDirection:`column`,marginBottom:n===F.length-1&&!e?0:1,children:[(0,G.jsxs)(z,{children:[(0,G.jsxs)(B,{color:i?`suggestion`:void 0,children:[i?a.pointer:` `,` `]}),(0,G.jsxs)(B,{color:t.isInstalled?`success`:void 0,children:[t.isInstalled?a.tick:s?a.ellipsis:o?a.radioOn:a.radioOff,` `,t.entry.name,t.entry.category&&(0,G.jsxs)(B,{dimColor:!0,children:[` [`,t.entry.category,`]`]}),t.entry.tags?.includes(`community-managed`)&&(0,G.jsx)(B,{dimColor:!0,children:` [Community Managed]`}),t.isInstalled&&(0,G.jsx)(B,{dimColor:!0,children:` (installed)`}),ee&&p===`claude-plugins-official`&&(0,G.jsxs)(B,{dimColor:!0,children:[` · `,Mt(ee.get(t.pluginId)??0),` installs`]})]})]}),t.entry.description&&(0,G.jsxs)(z,{marginLeft:4,children:[(0,G.jsx)(B,{dimColor:!0,children:mt(t.entry.description,60)}),t.entry.version&&(0,G.jsxs)(B,{dimColor:!0,children:[` · v`,t.entry.version]})]})]},t.pluginId)}),j.scrollPosition.canScrollDown&&(0,G.jsx)(z,{children:(0,G.jsxs)(B,{dimColor:!0,children:[` `,a.arrowDown,` more below`]})}),e&&(0,G.jsx)(z,{marginTop:1,children:(0,G.jsxs)(B,{color:`error`,children:[a.cross,` `,e]})}),(0,G.jsx)(Cn,{hasSelection:D.size>0})]})}var jn,W,G,Mn=e((()=>{i(),jn=t(H(),1),W=t(H(),1),C(),Ue(),xe(),tt(),x(),Ze(),$e(),Ee(),kt(),f(),N(),j(),L(),je(),S(),_t(),ht(),_n(),bn(),Tn(),kn(),G=Ke()}));function Nn({error:e,setError:t,result:n,setResult:r,setViewState:i,onInstallComplete:o,onSearchModeChange:c,targetPlugin:l}){let[u,d]=(0,K.useState)(`plugin-list`),[f,p]=(0,K.useState)(null),[m,h]=(0,K.useState)([]),[_,y]=(0,K.useState)(!0),[b,x]=(0,K.useState)(null),[S,C]=(0,K.useState)(!1),w=(0,K.useCallback)(e=>{C(e),c?.(e)},[c]),{query:ee,setQuery:te,cursorOffset:T}=Wt({isActive:u===`plugin-list`&&S&&!_,onExit:()=>{w(!1)}}),E=Ie(),{columns:D}=Ve(),O=(0,K.useMemo)(()=>{if(!ee)return m;let e=ee.toLowerCase();return m.filter(t=>t.entry.name.toLowerCase().includes(e)||t.entry.description?.toLowerCase().includes(e)||t.marketplaceName.toLowerCase().includes(e))},[m,ee]),[k,ie]=(0,K.useState)(0),[A,j]=(0,K.useState)(new Set),[ae,oe]=(0,K.useState)(new Set),M=En({totalItems:O.length,selectedIndex:k});(0,K.useEffect)(()=>{ie(0)},[ee]);let[se,N]=(0,K.useState)(0),[ce,ue]=(0,K.useState)(!1),[fe,P]=(0,K.useState)(null),[pe,F]=(0,K.useState)(null),[ge,ve]=(0,K.useState)(null);(0,K.useEffect)(()=>{async function e(){try{let e=await g(),{marketplaces:n,failures:r}=await Ce(e),i=[];for(let{name:e,data:t}of n)if(t)for(let n of t.plugins){let t=s(n.name,e);i.push({entry:n,marketplaceName:e,pluginId:t,isInstalled:me(t)})}let a=i.filter(e=>!e.isInstalled&&!re(e.pluginId));try{let e=await Nt();x(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){Qe(`Failed to fetch install counts: ${Je(e)}`),a.sort((e,t)=>e.entry.name.localeCompare(t.entry.name))}h(a);let o=Object.keys(e).length;if(a.length===0){let e=await de({configuredMarketplaceCount:o,failedMarketplaceCount:r.length});ve(e)}let c=_e(r,et(n,e=>e.data!==null));if(c)if(c.type===`warning`)F(c.message+`. Showing available plugins.`);else throw Error(c.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.`):(p(e),d(`plugin-details`)):t(`Plugin "${l}" not found in any marketplace`)}}catch(e){t(e instanceof Error?e.message:`Failed to load plugins`)}finally{y(!1)}}e()},[t,l]);let ye=async()=>{if(A.size===0)return;let e=m.filter(e=>A.has(e.pluginId));oe(new Set(e.map(e=>e.pluginId)));let n=0,a=0,s=[];for(let t of e){let e=await le({pluginId:t.pluginId,entry:t.entry,marketplaceName:t.marketplaceName,scope:`user`});e.success?n++:(a++,s.push({name:t.entry.name,reason:e.error}))}oe(new Set),j(new Set),he(),a===0?r(`✓ Installed ${n} ${gt(n,`plugin`)}. Run /reload-plugins to activate.`):n===0?t(`Failed to install: ${Te(s,!0)}`):r(`✓ Installed ${n} of ${n+a} plugins. Failed: ${Te(s,!1)}. Run /reload-plugins to activate successfully installed plugins.`),n>0&&o&&await o(),i({type:`menu`})},be=async(e,t=`user`)=>{ue(!0),P(null);let n=await le({pluginId:e.pluginId,entry:e.entry,marketplaceName:e.marketplaceName,scope:t});if(n.success){let t=await pn(e.pluginId);if(t){ue(!1),d({type:`plugin-options`,plugin:t,pluginId:e.pluginId});return}r(n.message),o&&await o(),i({type:`menu`})}else ue(!1),P(n.error)};(0,K.useEffect)(()=>{e&&r(e)},[e,r]),Fe(`confirm:no`,()=>{d(`plugin-list`),p(null)},{context:`Confirmation`,isActive:u===`plugin-details`}),Fe(`confirm:no`,()=>{i({type:`menu`})},{context:`Confirmation`,isActive:u===`plugin-list`&&!S}),Le((e,t)=>{let n=!t.ctrl&&!t.meta;S||(e===`/`&&n?(w(!0),te(``)):n&&e.length>0&&!/^\s+$/.test(e)&&e!==`j`&&e!==`k`&&e!==`i`&&(w(!0),te(e)))},{isActive:u===`plugin-list`&&!_}),R({"select:previous":()=>{k===0?w(!0):M.handleSelectionChange(k-1,ie)},"select:next":()=>{k<O.length-1&&M.handleSelectionChange(k+1,ie)},"select:accept":()=>{if(k===O.length&&A.size>0)ye();else if(k<O.length){let e=O[k];e&&(e.isInstalled?i({type:`manage-plugins`,targetPlugin:e.entry.name,targetMarketplace:e.marketplaceName}):(p(e),d(`plugin-details`),N(0),P(null)))}}},{context:`Select`,isActive:u===`plugin-list`&&!S}),R({"plugin:toggle":()=>{if(k<O.length){let e=O[k];if(e&&!e.isInstalled){let t=new Set(A);t.has(e.pluginId)?t.delete(e.pluginId):t.add(e.pluginId),j(t)}}},"plugin:install":()=>{A.size>0&&ye()}},{context:`Plugin`,isActive:u===`plugin-list`&&!S});let xe=In.useMemo(()=>{if(!f)return[];let e=f.entry.homepage;return Sn(e,xn(f))},[f]);if(R({"select:previous":()=>{se>0&&N(se-1)},"select:next":()=>{se<xe.length-1&&N(se+1)},"select:accept":()=>{if(!f)return;let e=xe[se]?.action,t=f.entry.homepage,n=xn(f);e===`install-user`?be(f,`user`):e===`install-project`?be(f,`project`):e===`install-local`?be(f,`local`):e===`homepage`&&t?ne(t):e===`github`&&n?ne(`https://github.com/${n}`):e===`back`&&(d(`plugin-list`),p(null))}},{context:`Select`,isActive:u===`plugin-details`&&!!f}),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)(mn,{plugin:e,pluginId:t,onDone:(t,r)=>{switch(t){case`configured`:n(`✓ Installed and configured ${e.name}. Run /reload-plugins to apply.`);break;case`skipped`:n(`✓ Installed ${e.name}. Run /reload-plugins to apply.`);break;case`error`:n(`Installed but failed to save config: ${r}`);break}}})}if(_)return(0,q.jsx)(B,{children:`Loading…`});if(e)return(0,q.jsx)(B,{color:`error`,children:e});if(u===`plugin-details`&&f){let e=f.entry.homepage,t=Sn(e,xn(f));return(0,q.jsxs)(z,{flexDirection:`column`,children:[(0,q.jsx)(z,{marginBottom:1,children:(0,q.jsx)(B,{bold:!0,children:`Plugin details`})}),(0,q.jsxs)(z,{flexDirection:`column`,marginBottom:1,children:[(0,q.jsx)(B,{bold:!0,children:f.entry.name}),(0,q.jsxs)(B,{dimColor:!0,children:[`from `,f.marketplaceName]}),f.entry.version&&(0,q.jsxs)(B,{dimColor:!0,children:[`Version: `,f.entry.version]}),f.entry.description&&(0,q.jsx)(z,{marginTop:1,children:(0,q.jsx)(B,{children:f.entry.description})}),f.entry.author&&(0,q.jsx)(z,{marginTop:1,children:(0,q.jsxs)(B,{dimColor:!0,children:[`By:`,` `,typeof f.entry.author==`string`?f.entry.author:f.entry.author.name]})})]}),(0,q.jsx)(vn,{}),fe&&(0,q.jsx)(z,{marginBottom:1,children:(0,q.jsxs)(B,{color:`error`,children:[`Error: `,fe]})}),(0,q.jsx)(z,{flexDirection:`column`,children:t.map((e,t)=>(0,q.jsxs)(z,{children:[se===t&&(0,q.jsx)(B,{children:`> `}),se!==t&&(0,q.jsx)(B,{children:` `}),(0,q.jsx)(B,{bold:se===t,children:ce&&e.action.startsWith(`install-`)?`Installing…`:e.label})]},e.action))}),(0,q.jsx)(z,{marginTop:1,children:(0,q.jsx)(B,{dimColor:!0,children:(0,q.jsxs)(V,{children:[(0,q.jsx)(v,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`select`}),(0,q.jsx)(v,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]})})})]})}if(m.length===0)return(0,q.jsxs)(z,{flexDirection:`column`,children:[(0,q.jsx)(z,{marginBottom:1,children:(0,q.jsx)(B,{bold:!0,children:`Discover plugins`})}),(0,q.jsx)(Fn,{reason:ge}),(0,q.jsx)(z,{marginTop:1,children:(0,q.jsx)(B,{dimColor:!0,italic:!0,children:`Esc to go back`})})]});let I=M.getVisibleItems(O);return(0,q.jsxs)(z,{flexDirection:`column`,children:[(0,q.jsxs)(z,{children:[(0,q.jsx)(B,{bold:!0,children:`Discover plugins`}),M.needsPagination&&(0,q.jsxs)(B,{dimColor:!0,children:[` `,`(`,M.scrollPosition.current,`/`,M.scrollPosition.total,`)`]})]}),(0,q.jsx)(z,{marginBottom:1,children:(0,q.jsx)(ze,{query:ee,isFocused:S,isTerminalFocused:E,width:D-4,cursorOffset:T})}),pe&&(0,q.jsx)(z,{marginBottom:1,children:(0,q.jsxs)(B,{color:`warning`,children:[a.warning,` `,pe]})}),O.length===0&&ee&&(0,q.jsx)(z,{marginBottom:1,children:(0,q.jsxs)(B,{dimColor:!0,children:[`No plugins match "`,ee,`"`]})}),M.scrollPosition.canScrollUp&&(0,q.jsx)(z,{children:(0,q.jsxs)(B,{dimColor:!0,children:[` `,a.arrowUp,` more above`]})}),I.map((t,n)=>{let r=M.toActualIndex(n),i=k===r,o=A.has(t.pluginId),s=ae.has(t.pluginId);return(0,q.jsxs)(z,{flexDirection:`column`,marginBottom:n===I.length-1&&!e?0:1,children:[(0,q.jsxs)(z,{children:[(0,q.jsxs)(B,{color:i&&!S?`suggestion`:void 0,children:[i&&!S?a.pointer:` `,` `]}),(0,q.jsxs)(B,{children:[s?a.ellipsis:o?a.radioOn:a.radioOff,` `,t.entry.name,(0,q.jsxs)(B,{dimColor:!0,children:[` · `,t.marketplaceName]}),t.entry.tags?.includes(`community-managed`)&&(0,q.jsx)(B,{dimColor:!0,children:` [Community Managed]`}),b&&t.marketplaceName===`claude-plugins-official`&&(0,q.jsxs)(B,{dimColor:!0,children:[` · `,Mt(b.get(t.pluginId)??0),` installs`]})]})]}),t.entry.description&&(0,q.jsx)(z,{marginLeft:4,children:(0,q.jsx)(B,{dimColor:!0,children:mt(t.entry.description,60)})})]},`${M.startIndex}-${t.pluginId}`)}),M.scrollPosition.canScrollDown&&(0,q.jsx)(z,{children:(0,q.jsxs)(B,{dimColor:!0,children:[` `,a.arrowDown,` more below`]})}),e&&(0,q.jsx)(z,{marginTop:1,children:(0,q.jsxs)(B,{color:`error`,children:[a.cross,` `,e]})}),(0,q.jsx)(Pn,{hasSelection:A.size>0,canToggle:k<O.length&&!O[k]?.isInstalled})]})}function Pn({hasSelection:e,canToggle:t}){return(0,q.jsx)(z,{marginTop:1,children:(0,q.jsx)(B,{dimColor:!0,italic:!0,children:(0,q.jsxs)(V,{children:[e&&(0,q.jsx)(v,{action:`plugin:install`,context:`Plugin`,fallback:`i`,description:`install`,bold:!0}),(0,q.jsx)(B,{children:`type to search`}),t&&(0,q.jsx)(v,{action:`plugin:toggle`,context:`Plugin`,fallback:`Space`,description:`toggle`}),(0,q.jsx)(v,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`details`}),(0,q.jsx)(v,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]})})})}function Fn({reason:e}){switch(e){case`git-not-installed`:return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(B,{dimColor:!0,children:`Git is required to install marketplaces.`}),(0,q.jsx)(B,{dimColor:!0,children:`Please install git and restart Work Mate.`})]});case`all-blocked-by-policy`:return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(B,{dimColor:!0,children:`Your organization policy does not allow any external marketplaces.`}),(0,q.jsx)(B,{dimColor:!0,children:`Contact your administrator.`})]});case`policy-restricts-sources`:return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(B,{dimColor:!0,children:`Your organization restricts which marketplaces can be added.`}),(0,q.jsx)(B,{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)(B,{dimColor:!0,children:`Failed to load marketplace data.`}),(0,q.jsx)(B,{dimColor:!0,children:`Check your network connection.`})]});case`all-plugins-installed`:return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(B,{dimColor:!0,children:`All available plugins are already installed.`}),(0,q.jsx)(B,{dimColor:!0,children:`Check for new plugins later or add more marketplaces.`})]});default:return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(B,{dimColor:!0,children:`No plugins available.`}),(0,q.jsx)(B,{dimColor:!0,children:`Add a marketplace first using the Marketplaces tab.`})]})}}var In,K,q,Ln=e((()=>{i(),In=t(H(),1),K=t(H(),1),C(),Ut(),Ue(),Gt(),o(),xe(),tt(),x(),Ze(),$e(),Ee(),kt(),f(),N(),j(),L(),je(),S(),_t(),ht(),_n(),bn(),Tn(),kn(),q=Ke()}));function Rn({setViewState:e,error:t,setError:n,setResult:r,exitState:i,onManageComplete:o,targetMarketplace:c,action:l}){let[u,d]=(0,Bn.useState)([]),[f,p]=(0,Bn.useState)(!0),[m,_]=(0,Bn.useState)(0),[y,b]=(0,Bn.useState)(!1),[x,S]=(0,Bn.useState)(null),[C,w]=(0,Bn.useState)(null),[ee,te]=(0,Bn.useState)(null),[T,E]=(0,Bn.useState)(`list`),[D,O]=(0,Bn.useState)(null),[ne,re]=(0,Bn.useState)(0),k=(0,Bn.useRef)(!1);(0,Bn.useEffect)(()=>{async function e(){try{let e=await g(),{enabled:r,disabled:i}=await ge(),a=[...r,...i],{marketplaces:o,failures:s}=await Ce(e),u=[];for(let{name:e,config:t,data:n}of o){let r=a.filter(t=>t.source.endsWith(`@${e}`));u.push({name:e,source:Se(t.source),lastUpdated:t.lastUpdated,pluginCount:n?.plugins.length,installedPlugins:r,pendingUpdate:!1,pendingRemove:!1,autoUpdate:st(e,t)})}u.sort((e,t)=>e.name===`claude-plugin-directory`?-1:t.name===`claude-plugin-directory`?1:e.name.localeCompare(t.name)),d(u);let f=_e(s,et(o,e=>e.data!==null));if(f)if(f.type===`warning`)S(f.message);else throw Error(f.message);if(c&&!k.current&&!t){k.current=!0;let e=u.findIndex(e=>e.name===c);if(e>=0){let t=u[e];if(l){_(e+1);let t=[...u];l===`update`?t[e].pendingUpdate=!0:l===`remove`&&(t[e].pendingRemove=!0),d(t),setTimeout(j,100,t)}else t&&(_(e+1),O(t),E(`details`))}else n&&n(`Marketplace not found: ${c}`)}}catch(e){n&&n(e instanceof Error?e.message:`Failed to load marketplaces`),S(e instanceof Error?e.message:`Failed to load marketplaces`)}finally{p(!1)}}e()},[c,l,t]);let ie=()=>u.some(e=>e.pendingUpdate||e.pendingRemove),A=()=>({updateCount:et(u,e=>e.pendingUpdate),removeCount:et(u,e=>e.pendingRemove)}),j=async t=>{let i=t||u,c=T===`details`;b(!0),S(null),w(null),te(null);try{let t=nt(`userSettings`),n=0,l=0,u=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=s(t.name,e.name);n[r]=!1}ot(`userSettings`,{enabledPlugins:n})}await I(e.name),l++,pt(`tengu_marketplace_removed`,{marketplace_name:e.name,plugins_uninstalled:e.installedPlugins?.length||0});continue}e.pendingUpdate&&(await h(e.name,e=>{te(e)}),n++,u.add(e.name.toLowerCase()),pt(`tengu_marketplace_updated`,{marketplace_name:e.name}))}let f=0;u.size>0&&(f=(await en(u)).length),he(),o&&await o();let p=await g(),{enabled:m,disabled:_}=await ge(),v=[...m,..._],{marketplaces:y}=await Ce(p),b=[];for(let{name:e,config:t,data:n}of y){let r=v.filter(t=>t.source.endsWith(`@${e}`));b.push({name:e,source:Se(t.source),lastUpdated:t.lastUpdated,pluginCount:n?.plugins.length,installedPlugins:r,pendingUpdate:!1,pendingRemove:!1,autoUpdate:st(e,t)})}if(b.sort((e,t)=>e.name===`claude-plugin-directory`?-1:t.name===`claude-plugin-directory`?1:e.name.localeCompare(t.name)),d(b),c&&D){let e=b.find(e=>e.name===D.name);e&&O(e)}let x=[];if(n>0){let e=f>0?` (${f} ${gt(f,`plugin`)} bumped)`:``;x.push(`Updated ${n} ${gt(n,`marketplace`)}${e}`)}if(l>0&&x.push(`Removed ${l} ${gt(l,`marketplace`)}`),x.length>0){let t=`${a.tick} ${x.join(`, `)}`;c?w(t):(r(t),setTimeout(e,2e3,{type:`menu`}))}else c||e({type:`menu`})}catch(e){let t=Je(e);S(t),n&&n(t)}finally{b(!1),te(null)}},oe=async()=>{if(!D)return;let e=u.map(e=>e.name===D.name?{...e,pendingRemove:!0}:e);d(e),await j(e)},M=e=>{if(!e)return[];let t=[{label:`Browse plugins (${e.pluginCount??0})`,value:`browse`},{label:`Update marketplace`,secondaryLabel:e.lastUpdated?`(last updated ${new Date(e.lastUpdated).toLocaleDateString()})`:void 0,value:`update`}];return ct()||t.push({label:e.autoUpdate?`Disable auto-update`:`Enable auto-update`,value:`toggle-auto-update`}),t.push({label:`Remove marketplace`,value:`remove`}),t},se=async e=>{let t=!e.autoUpdate;try{await ae(e.name,t),d(n=>n.map(n=>n.name===e.name?{...n,autoUpdate:t}:n)),O(e=>e&&{...e,autoUpdate:t})}catch(e){S(e instanceof Error?e.message:`Failed to update setting`)}};if(Fe(`confirm:no`,()=>{E(`list`),re(0)},{context:`Confirmation`,isActive:!y&&(T===`details`||T===`confirm-remove`)}),Fe(`confirm:no`,()=>{d(e=>e.map(e=>({...e,pendingUpdate:!1,pendingRemove:!1}))),_(0)},{context:`Confirmation`,isActive:!y&&T===`list`&&ie()}),Fe(`confirm:no`,()=>{e({type:`menu`})},{context:`Confirmation`,isActive:!y&&T===`list`&&!ie()}),R({"select:previous":()=>_(e=>Math.max(0,e-1)),"select:next":()=>{let e=u.length+1;_(t=>Math.min(e-1,t+1))},"select:accept":()=>{let t=m-1;if(m===0)e({type:`add-marketplace`});else if(ie())j();else{let e=u[t];e&&(O(e),E(`details`),re(0))}}},{context:`Select`,isActive:!y&&T===`list`}),Le(e=>{let t=m-1;if((e===`u`||e===`U`)&&t>=0)d(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=u[t];e&&(O(e),E(`confirm-remove`))}},{isActive:!y&&T===`list`}),R({"select:previous":()=>re(e=>Math.max(0,e-1)),"select:next":()=>{let e=M(D);re(t=>Math.min(e.length-1,t+1))},"select:accept":()=>{if(!D)return;let t=M(D)[ne];if(t?.value===`browse`)e({type:`browse-marketplace`,targetMarketplace:D.name});else if(t?.value===`update`){let e=u.map(e=>e.name===D.name?{...e,pendingUpdate:!0}:e);d(e),j(e)}else t?.value===`toggle-auto-update`?se(D):t?.value===`remove`&&E(`confirm-remove`)}},{context:`Select`,isActive:!y&&T===`details`}),Le(e=>{e===`y`||e===`Y`?oe():(e===`n`||e===`N`)&&(E(`list`),O(null))},{isActive:!y&&T===`confirm-remove`}),f)return(0,J.jsx)(B,{children:`Loading marketplaces…`});if(u.length===0)return(0,J.jsxs)(z,{flexDirection:`column`,children:[(0,J.jsx)(z,{marginBottom:1,children:(0,J.jsx)(B,{bold:!0,children:`Manage marketplaces`})}),(0,J.jsxs)(z,{flexDirection:`row`,gap:1,children:[(0,J.jsxs)(B,{color:`suggestion`,children:[a.pointer,` +`]}),(0,J.jsx)(B,{bold:!0,color:`suggestion`,children:`Add Marketplace`})]}),(0,J.jsx)(z,{marginLeft:3,children:(0,J.jsx)(B,{dimColor:!0,italic:!0,children:i.pending?(0,J.jsxs)(J.Fragment,{children:[`Press `,i.keyName,` again to go back`]}):(0,J.jsxs)(V,{children:[(0,J.jsx)(v,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`select`}),(0,J.jsx)(v,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`})]})})})]});if(T===`confirm-remove`&&D){let e=D.installedPlugins?.length||0;return(0,J.jsxs)(z,{flexDirection:`column`,children:[(0,J.jsxs)(B,{bold:!0,color:`warning`,children:[`Remove marketplace `,(0,J.jsx)(B,{italic:!0,children:D.name}),`?`]}),(0,J.jsxs)(z,{flexDirection:`column`,children:[e>0&&(0,J.jsx)(z,{marginTop:1,children:(0,J.jsxs)(B,{color:`warning`,children:[`This will also uninstall `,e,` `,gt(e,`plugin`),` from this marketplace:`]})}),D.installedPlugins&&D.installedPlugins.length>0&&(0,J.jsx)(z,{flexDirection:`column`,marginTop:1,marginLeft:2,children:D.installedPlugins.map(e=>(0,J.jsxs)(B,{dimColor:!0,children:[`• `,e.name]},e.name))}),(0,J.jsx)(z,{marginTop:1,children:(0,J.jsxs)(B,{children:[`Press `,(0,J.jsx)(B,{bold:!0,children:`y`}),` to confirm or `,(0,J.jsx)(B,{bold:!0,children:`n`}),` to cancel`]})})]})]})}if(T===`details`&&D){let e=D.pendingUpdate||y,t=M(D);return(0,J.jsxs)(z,{flexDirection:`column`,children:[(0,J.jsx)(B,{bold:!0,children:D.name}),(0,J.jsx)(B,{dimColor:!0,children:D.source}),(0,J.jsx)(z,{marginTop:1,children:(0,J.jsxs)(B,{children:[D.pluginCount||0,` available `,gt(D.pluginCount||0,`plugin`)]})}),D.installedPlugins&&D.installedPlugins.length>0&&(0,J.jsxs)(z,{flexDirection:`column`,marginTop:1,children:[(0,J.jsxs)(B,{bold:!0,children:[`Installed plugins (`,D.installedPlugins.length,`):`]}),(0,J.jsx)(z,{flexDirection:`column`,marginLeft:1,children:D.installedPlugins.map(e=>(0,J.jsxs)(z,{flexDirection:`row`,gap:1,children:[(0,J.jsx)(B,{children:a.bullet}),(0,J.jsxs)(z,{flexDirection:`column`,children:[(0,J.jsx)(B,{children:e.name}),(0,J.jsx)(B,{dimColor:!0,children:e.manifest.description})]})]},e.name))})]}),e&&(0,J.jsxs)(z,{marginTop:1,flexDirection:`column`,children:[(0,J.jsx)(B,{color:`claude`,children:`Updating marketplace…`}),ee&&(0,J.jsx)(B,{dimColor:!0,children:ee})]}),!e&&C&&(0,J.jsx)(z,{marginTop:1,children:(0,J.jsx)(B,{color:`claude`,children:C})}),!e&&x&&(0,J.jsx)(z,{marginTop:1,children:(0,J.jsx)(B,{color:`error`,children:x})}),!e&&(0,J.jsx)(z,{flexDirection:`column`,marginTop:1,children:t.map((e,t)=>{if(!e)return null;let n=t===ne;return(0,J.jsxs)(z,{children:[(0,J.jsxs)(B,{color:n?`suggestion`:void 0,children:[n?a.pointer:` `,` `,e.label]}),e.secondaryLabel&&(0,J.jsxs)(B,{dimColor:!0,children:[` `,e.secondaryLabel]})]},e.value)})}),!e&&!ct()&&D.autoUpdate&&(0,J.jsx)(z,{marginTop:1,children:(0,J.jsx)(B,{dimColor:!0,children:`Auto-update enabled. Work Mate will automatically update this marketplace and its installed plugins.`})}),(0,J.jsx)(z,{marginLeft:3,children:(0,J.jsx)(B,{dimColor:!0,italic:!0,children:e?(0,J.jsx)(J.Fragment,{children:`Please wait…`}):(0,J.jsxs)(V,{children:[(0,J.jsx)(v,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`select`}),(0,J.jsx)(v,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`})]})})})]})}let{updateCount:N,removeCount:ce}=A();return(0,J.jsxs)(z,{flexDirection:`column`,children:[(0,J.jsx)(z,{marginBottom:1,children:(0,J.jsx)(B,{bold:!0,children:`Manage marketplaces`})}),(0,J.jsxs)(z,{flexDirection:`row`,gap:1,marginBottom:1,children:[(0,J.jsxs)(B,{color:m===0?`suggestion`:void 0,children:[m===0?a.pointer:` `,` +`]}),(0,J.jsx)(B,{bold:!0,color:m===0?`suggestion`:void 0,children:`Add Marketplace`})]}),(0,J.jsx)(z,{flexDirection:`column`,children:u.map((e,t)=>{let n=t+1===m,r=[];return e.pendingUpdate&&r.push(`UPDATE`),e.pendingRemove&&r.push(`REMOVE`),(0,J.jsxs)(z,{flexDirection:`row`,gap:1,marginBottom:1,children:[(0,J.jsxs)(B,{color:n?`suggestion`:void 0,children:[n?a.pointer:` `,` `,e.pendingRemove?a.cross:a.bullet]}),(0,J.jsxs)(z,{flexDirection:`column`,flexGrow:1,children:[(0,J.jsxs)(z,{flexDirection:`row`,gap:1,children:[(0,J.jsxs)(B,{bold:!0,strikethrough:e.pendingRemove,dimColor:e.pendingRemove,children:[e.name===`claude-plugins-official`&&(0,J.jsx)(B,{color:`claude`,children:`✻ `}),e.name,e.name===`claude-plugins-official`&&(0,J.jsx)(B,{color:`claude`,children:` ✻`})]}),r.length>0&&(0,J.jsxs)(B,{color:`warning`,children:[`[`,r.join(`, `),`]`]})]}),(0,J.jsx)(B,{dimColor:!0,children:e.source}),(0,J.jsxs)(B,{dimColor:!0,children:[e.pluginCount!==void 0&&(0,J.jsxs)(J.Fragment,{children:[e.pluginCount,` available`]}),e.installedPlugins&&e.installedPlugins.length>0&&(0,J.jsxs)(J.Fragment,{children:[` • `,e.installedPlugins.length,` installed`]}),e.lastUpdated&&(0,J.jsxs)(J.Fragment,{children:[` • Updated `,new Date(e.lastUpdated).toLocaleDateString()]})]})]})]},e.name)})}),ie()&&(0,J.jsxs)(z,{marginTop:1,flexDirection:`column`,children:[(0,J.jsxs)(B,{children:[(0,J.jsx)(B,{bold:!0,children:`Pending changes:`}),` `,(0,J.jsx)(B,{dimColor:!0,children:`Enter to apply`})]}),N>0&&(0,J.jsxs)(B,{children:[`• Update `,N,` `,gt(N,`marketplace`)]}),ce>0&&(0,J.jsxs)(B,{color:`warning`,children:[`• Remove `,ce,` `,gt(ce,`marketplace`)]})]}),y&&(0,J.jsx)(z,{marginTop:1,children:(0,J.jsx)(B,{color:`claude`,children:`Processing changes…`})}),x&&(0,J.jsx)(z,{marginTop:1,children:(0,J.jsx)(B,{color:`error`,children:x})}),(0,J.jsx)(zn,{exitState:i,hasPendingActions:ie()})]})}function zn({exitState:e,hasPendingActions:t}){return e.pending?(0,J.jsx)(z,{marginTop:1,children:(0,J.jsxs)(B,{dimColor:!0,italic:!0,children:[`Press `,e.keyName,` again to go back`]})}):(0,J.jsx)(z,{marginTop:1,children:(0,J.jsx)(B,{dimColor:!0,italic:!0,children:(0,J.jsxs)(V,{children:[t&&(0,J.jsx)(v,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`apply changes`}),!t&&(0,J.jsx)(v,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`select`}),!t&&(0,J.jsx)(Me,{shortcut:`u`,action:`update`}),!t&&(0,J.jsx)(Me,{shortcut:`r`,action:`remove`}),(0,J.jsx)(v,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:t?`cancel`:`go back`})]})})})}var Bn,J,Vn=e((()=>{i(),H(),Bn=t(H(),1),ft(),C(),Ue(),xe(),tt(),lt(),$e(),Ee(),N(),j(),tn(),be(),at(),it(),_t(),J=Ke()}));function Hn(e){switch(e.type){case`path-not-found`:return`${e.component} path not found: ${e.path}`;case`git-auth-failed`:return`Git ${e.authType.toUpperCase()} authentication failed for ${e.gitUrl}`;case`git-timeout`:return`Git ${e.operation} timed out for ${e.gitUrl}`;case`network-error`:return`Network error accessing ${e.url}${e.details?`: ${e.details}`:``}`;case`manifest-parse-error`:return`Failed to parse manifest at ${e.manifestPath}: ${e.parseError}`;case`manifest-validation-error`:return`Invalid manifest at ${e.manifestPath}: ${e.validationErrors.join(`, `)}`;case`plugin-not-found`:return`Plugin "${e.pluginId}" not found in marketplace "${e.marketplace}"`;case`marketplace-not-found`:return`Marketplace "${e.marketplace}" not found`;case`marketplace-load-failed`:return`Failed to load marketplace "${e.marketplace}": ${e.reason}`;case`mcp-config-invalid`:return`Invalid MCP server config for "${e.serverName}": ${e.validationError}`;case`mcp-server-suppressed-duplicate`:{let t=e.duplicateOf.startsWith(`plugin:`)?`server provided by plugin "${e.duplicateOf.split(`:`)[1]??`?`}"`:`already-configured "${e.duplicateOf}"`;return`MCP server "${e.serverName}" skipped — same command/URL as ${t}`}case`hook-load-failed`:return`Failed to load hooks from ${e.hookPath}: ${e.reason}`;case`component-load-failed`:return`Failed to load ${e.component} from ${e.path}: ${e.reason}`;case`mcpb-download-failed`:return`Failed to download MCPB from ${e.url}: ${e.reason}`;case`mcpb-extract-failed`:return`Failed to extract MCPB ${e.mcpbPath}: ${e.reason}`;case`mcpb-invalid-manifest`:return`MCPB manifest invalid at ${e.mcpbPath}: ${e.validationError}`;case`marketplace-blocked-by-policy`:return e.blockedByBlocklist?`Marketplace "${e.marketplace}" is blocked by enterprise policy`:`Marketplace "${e.marketplace}" is not in the allowed marketplace list`;case`dependency-unsatisfied`:return e.reason===`not-enabled`?`Dependency "${e.dependency}" is disabled`:`Dependency "${e.dependency}" is not installed`;case`lsp-config-invalid`:return`Invalid LSP server config for "${e.serverName}": ${e.validationError}`;case`lsp-server-start-failed`:return`LSP server "${e.serverName}" failed to start: ${e.reason}`;case`lsp-server-crashed`:return e.signal?`LSP server "${e.serverName}" crashed with signal ${e.signal}`:`LSP server "${e.serverName}" crashed with exit code ${e.exitCode??`unknown`}`;case`lsp-request-timeout`:return`LSP server "${e.serverName}" timed out on ${e.method} after ${e.timeoutMs}ms`;case`lsp-request-failed`:return`LSP server "${e.serverName}" ${e.method} failed: ${e.error}`;case`plugin-cache-miss`:return`Plugin "${e.plugin}" not cached at ${e.installPath}`;case`generic-error`:return e.error}return ce(e)}function Un(e){switch(e.type){case`path-not-found`:return`Check that the path in your manifest or marketplace config is correct`;case`git-auth-failed`:return e.authType===`ssh`?`Configure SSH keys or use HTTPS URL instead`:`Configure credentials or use SSH URL instead`;case`git-timeout`:case`network-error`:return`Check your internet connection and try again`;case`manifest-parse-error`:return`Check manifest file syntax in the plugin directory`;case`manifest-validation-error`:return`Check manifest file follows the required schema`;case`plugin-not-found`:return`Plugin may not exist in marketplace "${e.marketplace}"`;case`marketplace-not-found`:return e.availableMarketplaces.length>0?`Available marketplaces: ${e.availableMarketplaces.join(`, `)}`:`Add the marketplace first using /plugin marketplace add`;case`mcp-config-invalid`:return`Check MCP server configuration in .mcp.json or manifest`;case`mcp-server-suppressed-duplicate`:return e.duplicateOf.startsWith(`plugin:`)?`Disable plugin "${e.duplicateOf.split(`:`)[1]??`the other plugin`}" if you want this plugin's version instead`:`Remove "${e.duplicateOf}" from your MCP config if you want the plugin's version instead`;case`hook-load-failed`:return`Check hooks.json file syntax and structure`;case`component-load-failed`:return`Check ${e.component} directory structure and file permissions`;case`mcpb-download-failed`:return`Check your internet connection and URL accessibility`;case`mcpb-extract-failed`:return`Verify the MCPB file is valid and not corrupted`;case`mcpb-invalid-manifest`:return`Contact the plugin author about the invalid manifest`;case`marketplace-blocked-by-policy`:return e.blockedByBlocklist?`This marketplace source is explicitly blocked by your administrator`:e.allowedSources.length>0?`Allowed sources: ${e.allowedSources.join(`, `)}`:`Contact your administrator to configure allowed marketplace sources`;case`dependency-unsatisfied`:return e.reason===`not-enabled`?`Enable "${e.dependency}" or uninstall "${e.plugin}"`:`Install "${e.dependency}" or uninstall "${e.plugin}"`;case`lsp-config-invalid`:return`Check LSP server configuration in the plugin manifest`;case`lsp-server-start-failed`:case`lsp-server-crashed`:case`lsp-request-timeout`:case`lsp-request-failed`:return`Check LSP server logs with --debug for details`;case`plugin-cache-miss`:return`Run /plugins to refresh the plugin cache`;case`marketplace-load-failed`:case`generic-error`:return null}return null}var Wn=e((()=>{Ae()}));function Gn({item:e,isSelected:t}){let[n]=Pe();if(e.type===`plugin`){let r,i;return e.pendingToggle?(r=Re(`suggestion`,n)(a.arrowRight),i=e.pendingToggle===`will-enable`?`will enable`:`will disable`):e.errorCount>0?(r=Re(`error`,n)(a.cross),i=`${e.errorCount} ${gt(e.errorCount,`error`)}`):e.isEnabled?(r=Re(`success`,n)(a.tick),i=`enabled`):(r=Re(`inactive`,n)(a.radioOff),i=`disabled`),(0,Y.jsxs)(z,{children:[(0,Y.jsx)(B,{color:t?`suggestion`:void 0,children:t?`${a.pointer} `:` `}),(0,Y.jsx)(B,{color:t?`suggestion`:void 0,children:e.name}),(0,Y.jsxs)(B,{dimColor:!t,children:[` `,(0,Y.jsx)(B,{backgroundColor:`userMessageBackground`,children:`Plugin`})]}),(0,Y.jsxs)(B,{dimColor:!0,children:[` · `,e.marketplace]}),(0,Y.jsxs)(B,{dimColor:!t,children:[` · `,r,` `]}),(0,Y.jsx)(B,{dimColor:!t,children:i})]})}if(e.type===`flagged-plugin`){let r=Re(`warning`,n)(a.warning);return(0,Y.jsxs)(z,{children:[(0,Y.jsx)(B,{color:t?`suggestion`:void 0,children:t?`${a.pointer} `:` `}),(0,Y.jsx)(B,{color:t?`suggestion`:void 0,children:e.name}),(0,Y.jsxs)(B,{dimColor:!t,children:[` `,(0,Y.jsx)(B,{backgroundColor:`userMessageBackground`,children:`Plugin`})]}),(0,Y.jsxs)(B,{dimColor:!0,children:[` · `,e.marketplace]}),(0,Y.jsxs)(B,{dimColor:!t,children:[` · `,r,` `]}),(0,Y.jsx)(B,{dimColor:!t,children:`removed`})]})}if(e.type===`failed-plugin`){let r=Re(`error`,n)(a.cross),i=`failed to load · ${e.errorCount} ${gt(e.errorCount,`error`)}`;return(0,Y.jsxs)(z,{children:[(0,Y.jsx)(B,{color:t?`suggestion`:void 0,children:t?`${a.pointer} `:` `}),(0,Y.jsx)(B,{color:t?`suggestion`:void 0,children:e.name}),(0,Y.jsxs)(B,{dimColor:!t,children:[` `,(0,Y.jsx)(B,{backgroundColor:`userMessageBackground`,children:`Plugin`})]}),(0,Y.jsxs)(B,{dimColor:!0,children:[` · `,e.marketplace]}),(0,Y.jsxs)(B,{dimColor:!t,children:[` · `,r,` `]}),(0,Y.jsx)(B,{dimColor:!t,children:i})]})}let r,i;return e.status===`connected`?(r=Re(`success`,n)(a.tick),i=`connected`):e.status===`disabled`?(r=Re(`inactive`,n)(a.radioOff),i=`disabled`):e.status===`pending`?(r=Re(`inactive`,n)(a.radioOff),i=`connecting…`):e.status===`needs-auth`?(r=Re(`warning`,n)(a.triangleUpOutline),i=`Enter to auth`):(r=Re(`error`,n)(a.cross),i=`failed`),e.indented?(0,Y.jsxs)(z,{children:[(0,Y.jsx)(B,{color:t?`suggestion`:void 0,children:t?`${a.pointer} `:` `}),(0,Y.jsx)(B,{dimColor:!t,children:`└ `}),(0,Y.jsx)(B,{color:t?`suggestion`:void 0,children:e.name}),(0,Y.jsxs)(B,{dimColor:!t,children:[` `,(0,Y.jsx)(B,{backgroundColor:`userMessageBackground`,children:`MCP`})]}),(0,Y.jsxs)(B,{dimColor:!t,children:[` · `,r,` `]}),(0,Y.jsx)(B,{dimColor:!t,children:i})]}):(0,Y.jsxs)(z,{children:[(0,Y.jsx)(B,{color:t?`suggestion`:void 0,children:t?`${a.pointer} `:` `}),(0,Y.jsx)(B,{color:t?`suggestion`:void 0,children:e.name}),(0,Y.jsxs)(B,{dimColor:!t,children:[` `,(0,Y.jsx)(B,{backgroundColor:`userMessageBackground`,children:`MCP`})]}),(0,Y.jsxs)(B,{dimColor:!t,children:[` · `,r,` `]}),(0,Y.jsx)(B,{dimColor:!t,children:i})]})}var Y,Kn=e((()=>{i(),H(),Ue(),_t(),Y=Ke()}));async function qn(e){try{return(await rn.readdir(e,{withFileTypes:!0})).filter(e=>e.isFile()&&e.name.endsWith(`.md`)).map(e=>nn.basename(e.name,`.md`))}catch(t){return Qe(`Failed to read plugin components from ${e}: ${Je(t)}`,{level:`error`}),dt(Xe(t)),[]}}async function Jn(e){try{let t=await rn.readdir(e,{withFileTypes:!0}),n=[];for(let r of t)if(r.isDirectory()||r.isSymbolicLink()){let t=nn.join(e,r.name,`SKILL.md`);try{(await rn.stat(t)).isFile()&&n.push(r.name)}catch{}}return n}catch(t){return Qe(`Failed to read skill directories from ${e}: ${Je(t)}`,{level:`error`}),dt(Xe(t)),[]}}function Yn({plugin:e,marketplace:t}){let[n,r]=(0,X.useState)(null),[i,a]=(0,X.useState)(!0),[o,s]=(0,X.useState)(null);return(0,X.useEffect)(()=>{async function n(){try{if(t===`builtin`){let t=se(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 k(t)).plugins.find(t=>t.name===e.name);if(n){let t=[];e.commandsPath&&t.push(e.commandsPath),e.commandsPaths&&t.push(...e.commandsPaths);let i=[];for(let e of t)if(typeof e==`string`){let t=await qn(e);i.push(...t)}let a=[];e.agentsPath&&a.push(e.agentsPath),e.agentsPaths&&a.push(...e.agentsPaths);let o=[];for(let e of a)if(typeof e==`string`){let t=await qn(e);o.push(...t)}let s=[];e.skillsPath&&s.push(e.skillsPath),e.skillsPaths&&s.push(...e.skillsPaths);let c=[];for(let e of s)if(typeof e==`string`){let t=await Jn(e);c.push(...t)}let l=[];e.hooksConfig&&l.push(Object.keys(e.hooksConfig)),n.hooks&&l.push(n.hooks);let u=[];e.mcpServers&&u.push(Object.keys(e.mcpServers)),n.mcpServers&&u.push(n.mcpServers),r({commands:i.length>0?i:null,agents:o.length>0?o:null,skills:c.length>0?c:null,hooks:l.length>0?l:null,mcpServers:u.length>0?u:null})}else s(`Plugin ${e.name} not found in marketplace`)}catch(e){s(e instanceof Error?e.message:`Failed to load components`)}finally{a(!1)}}n()},[e.name,e.commandsPath,e.commandsPaths,e.agentsPath,e.agentsPaths,e.skillsPath,e.skillsPaths,e.hooksConfig,e.mcpServers,t]),i?null:o?(0,Z.jsxs)(z,{flexDirection:`column`,marginBottom:1,children:[(0,Z.jsx)(B,{bold:!0,children:`Components:`}),(0,Z.jsxs)(B,{dimColor:!0,children:[`Error: `,o]})]}):!n||!(n.commands||n.agents||n.skills||n.hooks||n.mcpServers)?null:(0,Z.jsxs)(z,{flexDirection:`column`,marginBottom:1,children:[(0,Z.jsx)(B,{bold:!0,children:`Installed components:`}),n.commands?(0,Z.jsxs)(B,{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)(B,{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)(B,{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)(B,{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)(B,{dimColor:!0,children:[`• MCP Servers:`,` `,typeof n.mcpServers==`string`?n.mcpServers:Array.isArray(n.mcpServers)?n.mcpServers.map(String).join(`, `):typeof n.mcpServers==`object`&&n.mcpServers!==null?Object.keys(n.mcpServers).join(`, `):String(n.mcpServers)]}):null]})}async function Xn(e,t){let n=(await k(t))?.plugins.find(t=>t.name===e);return n&&typeof n.source==`string`?`Local plugins cannot be updated remotely. To update, modify the source at: ${n.source}`:null}function Zn(e){return e.filter(e=>{let t=e.source.split(`@`)[1]||`local`;return!re(`${e.name}@${t}`)})}function Qn({setViewState:e,setResult:t,onManageComplete:n,onSearchModeChange:r,targetPlugin:i,targetMarketplace:o,action:s}){let l=ke(e=>e.mcp.clients),u=ke(e=>e.mcp.tools),d=ke(e=>e.plugins.errors),f=It(),[m,h]=(0,X.useState)(!1),g=(0,X.useCallback)(e=>{h(e),r?.(e)},[r]),_=Ie(),{columns:y}=Ve(),[x,S]=(0,X.useState)(`plugin-list`),{query:C,setQuery:w,cursorOffset:T}=Wt({isActive:x===`plugin-list`&&m,onExit:()=>{g(!1)}}),[E,re]=(0,X.useState)(null),[k,ie]=(0,X.useState)([]),[A,j]=(0,X.useState)([]),[ae,oe]=(0,X.useState)(!0),[M,se]=(0,X.useState)(new Map),N=(0,X.useRef)(!1),ce=(0,X.useRef)(void 0),le=zt();Fe(`confirm:no`,$n.useCallback(()=>{if(x===`plugin-details`)S(`plugin-list`),re(null),L(null);else if(typeof x==`object`&&x.type===`failed-plugin-details`)S(`plugin-list`),L(null);else if(x===`configuring`)S(`plugin-details`),we(null);else if(typeof x==`object`&&(x.type===`plugin-options`||x.type===`configuring-options`))S(`plugin-list`),re(null),t(`Plugin enabled. Configuration skipped — run /reload-plugins to apply.`),n&&n();else if(typeof x==`object`&&x.type===`flagged-detail`)S(`plugin-list`),L(null);else if(typeof x==`object`&&x.type===`mcp-detail`)S(`plugin-list`),L(null);else if(typeof x==`object`&&x.type===`mcp-tools`)S({type:`mcp-detail`,client:x.client});else if(typeof x==`object`&&x.type===`mcp-tool-detail`)S({type:`mcp-tools`,client:x.client});else{if(M.size>0){t(`Run /reload-plugins to apply plugin changes.`);return}e({type:`menu`})}},[x,e,M,t]),{context:`Confirmation`,isActive:(x!==`plugin-list`||!m)&&x!==`confirm-project-uninstall`&&!(typeof x==`object`&&x.type===`confirm-data-cleanup`)});let ue=e=>e.type===`connected`?`connected`:e.type===`disabled`?`disabled`:e.type===`pending`?`pending`:e.type===`needs-auth`?`needs-auth`:`failed`,de=(0,X.useMemo)(()=>{let e=rt(),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 A){let i=`${r.plugin.name}@${r.marketplace}`,a=e?.enabledPlugins?.[i]!==!1,o=d.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:M.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 d){if(r.has(e.source)||`plugin`in e&&typeof e.plugin==`string`&&i.has(e.plugin))continue;let t=a.get(e.source)||[];t.push(e),a.set(e.source,t)}let o=yt(),s=[];for(let[e,t]of a){if(e in f)continue;let n=ve(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:ue(e),client:e}));let u={flagged:-1,project:0,local:1,user:2,enterprise:3,managed:4,dynamic:5,builtin:6},p=[],m=new Map;for(let{item:e,originalScope:t,childMcps:r}of n){let n=e.scope;m.has(n)||m.set(n,[]),m.get(n).push(e);for(let{displayName:e,client:n}of r){let r=t===`builtin`?`user`:t;m.has(r)||m.set(r,[]),m.get(r).push({type:`mcp`,id:`mcp:${n.name}`,name:e,description:void 0,scope:r,status:ue(n),client:n,indented:!0})}}for(let e of c){let t=e.scope;m.has(t)||m.set(t,[]),m.get(t).push(e)}for(let e of s){let t=e.scope;m.has(t)||m.set(t,[]),m.get(t).push(e)}for(let[e,t]of Object.entries(f)){let n=ve(e),r=n.name||e,i=n.marketplace||`unknown`;m.has(`flagged`)||m.set(`flagged`,[]),m.get(`flagged`).push({type:`flagged-plugin`,id:e,name:r,marketplace:i,scope:`flagged`,reason:`delisted`,text:`Removed from marketplace`,flaggedAt:t.flaggedAt})}let h=[...m.keys()].sort((e,t)=>(u[e]??99)-(u[t]??99));for(let e of h){let t=m.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)p.push(...e);p.push(...r)}return p},[A,l,d,M,f]),fe=(0,X.useMemo)(()=>de.filter(e=>e.type===`flagged-plugin`).map(e=>e.id),[de]);(0,X.useEffect)(()=>{fe.length>0&&Ft(fe)},[fe]);let P=(0,X.useMemo)(()=>{if(!C)return de;let e=C.toLowerCase();return de.filter(t=>t.name.toLowerCase().includes(e)||`description`in t&&t.description?.toLowerCase().includes(e))},[de,C]),[F,me]=(0,X.useState)(0),_e=En({totalItems:P.length,selectedIndex:F,maxVisible:8}),[ye,be]=(0,X.useState)(0),[xe,I]=(0,X.useState)(!1),[Se,L]=(0,X.useState)(null),[Ce,we]=(0,X.useState)(null),[Te,Ee]=(0,X.useState)(!1),[De,Oe]=(0,X.useState)(!1);(0,X.useEffect)(()=>{if(!E){Oe(!1);return}async function e(){let e=E.plugin.manifest.mcpServers,t=!1;if(e&&(t=typeof e==`string`&&te(e)||Array.isArray(e)&&e.some(e=>typeof e==`string`&&te(e))),!t)try{let e=nn.join(E.plugin.path,`..`),n=nn.join(e,`.claude-plugin`,`marketplace.json`),r=qe(await rn.readFile(n,`utf-8`)).plugins?.find(e=>e.name===E.plugin.name);if(r?.mcpServers){let e=r.mcpServers;t=typeof e==`string`&&te(e)||Array.isArray(e)&&e.some(e=>typeof e==`string`&&te(e))}}catch(e){Qe(`Failed to read raw marketplace.json: ${e}`)}Oe(t)}e()},[E]),(0,X.useEffect)(()=>{async function e(){oe(!0);try{let{enabled:e,disabled:t}=await ge(),n=rt(),r=Zn([...e,...t]),i={};for(let e of r){let t=e.source.split(`@`)[1]||`local`;i[t]||(i[t]=[]),i[t].push(e)}let a=[];for(let[e,t]of Object.entries(i)){let r=et(t,t=>{let r=`${t.name}@${e}`;return n?.enabledPlugins?.[r]!==!1}),i=t.length-r;a.push({name:e,installedPlugins:t,enabledCount:r,disabledCount:i})}a.sort((e,t)=>e.name===`claude-plugin-directory`?-1:t.name===`claude-plugin-directory`?1:e.name.localeCompare(t.name)),ie(a);let o=[];for(let e of a)for(let t of e.installedPlugins){let n=`${t.name}@${e.name}`,r=t.isBuiltin?`builtin`:Tt(n).scope;o.push({plugin:t,marketplace:e.name,scope:r,pendingEnable:void 0,pendingUpdate:!1})}j(o),me(0)}finally{oe(!1)}}e()},[]),(0,X.useEffect)(()=>{if(!N.current&&i&&k.length>0&&!ae){let{name:e,marketplace:n}=ve(i),r=o??n,a=r?k.filter(e=>e.name===r):k;for(let t of a){let n=t.installedPlugins.find(t=>t.name===e);if(n){let{scope:e}=Tt(`${n.name}@${t.name}`),r={plugin:n,marketplace:t.name,scope:e,pendingEnable:void 0,pendingUpdate:!1};re(r),S(`plugin-details`),ce.current=s,N.current=!0;return}}let c=de.find(t=>t.type===`failed-plugin`&&t.name===e);c&&c.type===`failed-plugin`&&(S({type:`failed-plugin-details`,plugin:{id:c.id,name:c.name,marketplace:c.marketplace,errors:c.errors,scope:c.scope}}),N.current=!0),!N.current&&s&&(N.current=!0,t(`Plugin "${i}" is not installed in this project`))}},[i,o,k,ae,de,s,t]);let Ae=async r=>{if(!E)return;let i=E.scope||`user`,a=i===`builtin`;if(a&&(r===`update`||r===`uninstall`)){L(`Built-in plugins cannot be updated or uninstalled.`);return}if(!a&&!wt(i)&&r!==`update`){L(`This plugin is managed by your organization. Contact your admin to disable it.`);return}I(!0),L(null);try{let o=`${E.plugin.name}@${E.marketplace}`,s;switch(r){case`enable`:{let e=await bt(o);if(!e.success)throw Error(e.message);break}case`disable`:{let e=await Ct(o);if(!e.success)throw Error(e.message);s=e.reverseDependents;break}case`uninstall`:{if(a||!wt(i))break;if(Dt(o)){I(!1),S(`confirm-project-uninstall`);return}let e=ee().plugins[o],t=!e||e.length<=1?await b(o):null;if(t){I(!1),S({type:`confirm-data-cleanup`,size:t});return}let n=await xt(o,i);if(!n.success)throw Error(n.message);s=n.reverseDependents;break}case`update`:{if(a)break;let r=await St(o,i);if(!r.success)throw Error(r.message);if(r.alreadyUpToDate){t(`${E.plugin.name} is already at the latest version (${r.newVersion}).`),n&&await n(),e({type:`menu`});return}break}}he();let c=`${E.plugin.name}@${E.marketplace}`;if(rt()?.enabledPlugins?.[c]!==!1){I(!1),S({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} ${E.plugin.name}${u}. Run /reload-plugins to apply.`),n&&await n(),e({type:`menu`})}catch(e){I(!1);let t=e instanceof Error?e.message:String(e);L(`Failed to ${r}: ${t}`),dt(Xe(e))}},je=(0,X.useRef)(Ae);je.current=Ae,(0,X.useEffect)(()=>{if(x===`plugin-details`&&E&&ce.current){let e=ce.current;ce.current=void 0,je.current(e)}},[x,E]);let Me=$n.useCallback(()=>{if(F>=P.length)return;let e=P[F];if(e?.type!==`flagged-plugin`)if(e?.type===`plugin`){let t=`${e.plugin.name}@${e.marketplace}`,n=rt(),r=M.get(t),i=n?.enabledPlugins?.[t]!==!1,a=e.scope;if(a===`builtin`||wt(a)){let e=new Map(M);r?(e.delete(t),(async()=>{try{r===`will-disable`?await bt(t):await Ct(t),he()}catch(e){dt(e)}})()):(e.set(t,i?`will-disable`:`will-enable`),(async()=>{try{i?await Ct(t):await bt(t),he()}catch(e){dt(e)}})()),se(e)}}else e?.type===`mcp`&&le(e.client.name)},[F,P,M,A,le]);R({"select:previous":()=>{F===0?g(!0):_e.handleSelectionChange(F-1,me)},"select:next":()=>{F<P.length-1&&_e.handleSelectionChange(F+1,me)},"select:accept":$n.useCallback(()=>{if(F>=P.length)return;let e=P[F];if(e?.type===`plugin`){let t=A.find(t=>t.plugin.name===e.plugin.name&&t.marketplace===e.marketplace);t&&(re(t),S(`plugin-details`),be(0),L(null))}else e?.type===`flagged-plugin`?(S({type:`flagged-detail`,plugin:{id:e.id,name:e.name,marketplace:e.marketplace,reason:e.reason,text:e.text,flaggedAt:e.flaggedAt}}),L(null)):e?.type===`failed-plugin`?(S({type:`failed-plugin-details`,plugin:{id:e.id,name:e.name,marketplace:e.marketplace,errors:e.errors,scope:e.scope}}),be(0),L(null)):e?.type===`mcp`&&(S({type:`mcp-detail`,client:e.client}),L(null))},[F,P,A])},{context:`Select`,isActive:x===`plugin-list`&&!m}),R({"plugin:toggle":Me},{context:`Plugin`,isActive:x===`plugin-list`&&!m}),R({"select:accept":$n.useCallback(()=>{typeof x!=`object`||x.type!==`flagged-detail`||(Lt(x.plugin.id),S(`plugin-list`))},[x])},{context:`Select`,isActive:typeof x==`object`&&x.type===`flagged-detail`});let Ne=$n.useMemo(()=>{if(x!==`plugin-details`||!E)return[];let e=rt(),t=`${E.plugin.name}@${E.marketplace}`,n=e?.enabledPlugins?.[t]!==!1,r=E.marketplace===`builtin`,i=[];return i.push({label:n?`Disable plugin`:`Enable plugin`,action:()=>void Ae(n?`disable`:`enable`)}),r||(i.push({label:E.pendingUpdate?`Unmark for update`:`Mark for update`,action:async()=>{try{let e=await Xn(E.plugin.name,E.marketplace);if(e){L(e);return}let t=[...A],n=t.findIndex(e=>e.plugin.name===E.plugin.name&&e.marketplace===E.marketplace);n!==-1&&(t[n].pendingUpdate=!E.pendingUpdate,j(t),re({...E,pendingUpdate:!E.pendingUpdate}))}catch(e){L(e instanceof Error?e.message:`Failed to check plugin update availability`)}}}),De&&i.push({label:`Configure`,action:async()=>{Ee(!0);try{let e=E.plugin.manifest.mcpServers,t=null;if(typeof e==`string`&&te(e))t=e;else if(Array.isArray(e)){for(let n of e)if(typeof n==`string`&&te(n)){t=n;break}}if(!t){L(`No MCPB file found in plugin`),Ee(!1);return}let n=`${E.plugin.name}@${E.marketplace}`,r=await p(t,E.plugin.path,n,void 0,void 0,!0);`status`in r&&r.status===`needs-config`?(we(r),S(`configuring`)):L(`Failed to load MCPB for configuration`)}catch(e){let t=Je(e);L(`Failed to load configuration: ${t}`)}finally{Ee(!1)}}}),E.plugin.manifest.userConfig&&Object.keys(E.plugin.manifest.userConfig).length>0&&i.push({label:`Configure options`,action:()=>{S({type:`configuring-options`,schema:E.plugin.manifest.userConfig})}}),i.push({label:`Update now`,action:()=>void Ae(`update`)}),i.push({label:`Uninstall`,action:()=>void Ae(`uninstall`)})),E.plugin.manifest.homepage&&i.push({label:`Open homepage`,action:()=>void ne(E.plugin.manifest.homepage)}),E.plugin.manifest.repository&&i.push({label:`View repository`,action:()=>void ne(E.plugin.manifest.repository)}),i.push({label:`Back to plugin list`,action:()=>{S(`plugin-list`),re(null),L(null)}}),i},[x,E,De,A]);if(R({"select:previous":()=>{ye>0&&be(ye-1)},"select:next":()=>{ye<Ne.length-1&&be(ye+1)},"select:accept":()=>{Ne[ye]&&Ne[ye].action()}},{context:`Select`,isActive:x===`plugin-details`&&!!E}),R({"select:accept":()=>{typeof x==`object`&&x.type===`failed-plugin-details`&&(async()=>{I(!0),L(null);let e=x.plugin.id,t=x.plugin.scope,r=wt(t)?await xt(e,t,!1):await xt(e,`user`,!1),i=r.success;if(!i){for(let t of[`userSettings`,`projectSettings`,`localSettings`]){let n=nt(t);n?.enabledPlugins?.[e]!==void 0&&(ot(t,{enabledPlugins:{...n.enabledPlugins,[e]:void 0}}),i=!0)}he()}i?(n&&await n(),I(!1),S(`plugin-list`)):(I(!1),L(r.message))})()}},{context:`Select`,isActive:typeof x==`object`&&x.type===`failed-plugin-details`&&x.plugin.scope!==`managed`}),R({"confirm:yes":()=>{if(!E)return;I(!0),L(null);let r=`${E.plugin.name}@${E.marketplace}`,{error:i}=ot(`localSettings`,{enabledPlugins:{...nt(`localSettings`)?.enabledPlugins,[r]:!1}});if(i){I(!1),L(`Failed to write settings: ${i.message}`);return}he(),t(`✓ Disabled ${E.plugin.name} in .claude/settings.local.json. Run /reload-plugins to apply.`),n&&n(),e({type:`menu`})},"confirm:no":()=>{S(`plugin-details`),L(null)}},{context:`Confirmation`,isActive:x===`confirm-project-uninstall`&&!!E&&!xe}),Le((r,i)=>{if(!E)return;let o=`${E.plugin.name}@${E.marketplace}`,s=E.scope;if(!s||s===`builtin`||!wt(s))return;let c=async r=>{I(!0),L(null);try{let i=await xt(o,s,r);if(!i.success)throw Error(i.message);he();let c=r?``:` · data preserved`;t(`${a.tick} ${i.message}${c}`),n&&n(),e({type:`menu`})}catch(e){I(!1),L(e instanceof Error?e.message:String(e))}};r===`y`||r===`Y`?c(!0):r===`n`||r===`N`?c(!1):i.escape&&(S(`plugin-details`),L(null))},{isActive:typeof x==`object`&&x.type===`confirm-data-cleanup`&&!!E&&!xe}),$n.useEffect(()=>{me(0)},[C]),Le((e,t)=>{let n=!t.ctrl&&!t.meta;m||(e===`/`&&n?(g(!0),w(``),me(0)):n&&e.length>0&&!/^\s+$/.test(e)&&e!==`j`&&e!==`k`&&e!==` `&&(g(!0),w(e),me(0)))},{isActive:x===`plugin-list`}),ae)return(0,Z.jsx)(B,{children:`Loading installed plugins…`});if(de.length===0)return(0,Z.jsxs)(z,{flexDirection:`column`,children:[(0,Z.jsx)(z,{marginBottom:1,children:(0,Z.jsx)(B,{bold:!0,children:`Manage plugins`})}),(0,Z.jsx)(B,{children:`No plugins or MCP servers installed.`}),(0,Z.jsx)(z,{marginTop:1,children:(0,Z.jsx)(B,{dimColor:!0,children:`Esc to go back`})})]});if(typeof x==`object`&&x.type===`plugin-options`&&E){let r=`${E.plugin.name}@${E.marketplace}`;function i(r){t(r),n&&n(),e({type:`menu`})}return(0,Z.jsx)(mn,{plugin:E.plugin,pluginId:r,onDone:(e,t)=>{switch(e){case`configured`:i(`✓ Enabled and configured ${E.plugin.name}. Run /reload-plugins to apply.`);break;case`skipped`:i(`✓ Enabled ${E.plugin.name}. Run /reload-plugins to apply.`);break;case`error`:i(`Failed to save configuration: ${t}`);break}}})}if(typeof x==`object`&&x.type===`configuring-options`&&E){let e=`${E.plugin.name}@${E.marketplace}`;return(0,Z.jsx)(ln,{title:`Configure ${E.plugin.name}`,subtitle:`Plugin options`,configSchema:x.schema,initialValues:c(e),onSave:n=>{try{pe(e,n,x.schema),he(),t(`Configuration saved. Run /reload-plugins for changes to take effect.`)}catch(e){L(`Failed to save configuration: ${Je(e)}`)}S(`plugin-details`)},onCancel:()=>S(`plugin-details`)})}if(x===`configuring`&&Ce&&E){let e=`${E.plugin.name}@${E.marketplace}`;async function n(n){if(!(!Ce||!E))try{let r=E.plugin.manifest.mcpServers,i=null;if(typeof r==`string`&&te(r))i=r;else if(Array.isArray(r)){for(let e of r)if(typeof e==`string`&&te(e)){i=e;break}}if(!i){L(`No MCPB file found`),S(`plugin-details`);return}await p(i,E.plugin.path,e,void 0,n),L(null),we(null),S(`plugin-details`),t(`Configuration saved. Run /reload-plugins for changes to take effect.`)}catch(e){let t=Je(e);L(`Failed to save configuration: ${t}`),S(`plugin-details`)}}function r(){we(null),S(`plugin-details`)}return(0,Z.jsx)(ln,{title:`Configure ${Ce.manifest.name}`,subtitle:`Plugin: ${E.plugin.name}`,configSchema:Ce.configSchema,initialValues:Ce.existingConfig,onSave:n,onCancel:r})}if(typeof x==`object`&&x.type===`flagged-detail`){let e=x.plugin;return(0,Z.jsxs)(z,{flexDirection:`column`,children:[(0,Z.jsx)(z,{children:(0,Z.jsxs)(B,{bold:!0,children:[e.name,` @ `,e.marketplace]})}),(0,Z.jsxs)(z,{marginBottom:1,children:[(0,Z.jsx)(B,{dimColor:!0,children:`Status: `}),(0,Z.jsx)(B,{color:`error`,children:`Removed`})]}),(0,Z.jsxs)(z,{marginBottom:1,flexDirection:`column`,children:[(0,Z.jsxs)(B,{color:`error`,children:[`Removed from marketplace · reason: `,e.reason]}),(0,Z.jsx)(B,{children:e.text}),(0,Z.jsxs)(B,{dimColor:!0,children:[`Flagged on `,new Date(e.flaggedAt).toLocaleDateString()]})]}),(0,Z.jsx)(z,{marginTop:1,flexDirection:`column`,children:(0,Z.jsxs)(z,{children:[(0,Z.jsxs)(B,{children:[a.pointer,` `]}),(0,Z.jsx)(B,{color:`suggestion`,children:`Dismiss`})]})}),(0,Z.jsxs)(V,{children:[(0,Z.jsx)(v,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`dismiss`}),(0,Z.jsx)(v,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]})]})}if(x===`confirm-project-uninstall`&&E)return(0,Z.jsxs)(z,{flexDirection:`column`,children:[(0,Z.jsxs)(B,{bold:!0,color:`warning`,children:[E.plugin.name,` is enabled in .claude/settings.json (shared with your team)`]}),(0,Z.jsxs)(z,{marginTop:1,flexDirection:`column`,children:[(0,Z.jsx)(B,{children:`Disable it just for you in .claude/settings.local.json?`}),(0,Z.jsx)(B,{dimColor:!0,children:`This has the same effect as uninstalling, without affecting other contributors.`})]}),Se&&(0,Z.jsx)(z,{marginTop:1,children:(0,Z.jsx)(B,{color:`error`,children:Se})}),(0,Z.jsx)(z,{marginTop:1,children:xe?(0,Z.jsx)(B,{dimColor:!0,children:`Disabling…`}):(0,Z.jsxs)(V,{children:[(0,Z.jsx)(v,{action:`confirm:yes`,context:`Confirmation`,fallback:`y`,description:`disable`}),(0,Z.jsx)(v,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})]})})]});if(typeof x==`object`&&x.type===`confirm-data-cleanup`&&E)return(0,Z.jsxs)(z,{flexDirection:`column`,children:[(0,Z.jsxs)(B,{bold:!0,children:[E.plugin.name,` has `,x.size.human,` of persistent data`]}),(0,Z.jsxs)(z,{marginTop:1,flexDirection:`column`,children:[(0,Z.jsx)(B,{children:`Delete it along with the plugin?`}),(0,Z.jsx)(B,{dimColor:!0,children:D(`${E.plugin.name}@${E.marketplace}`)})]}),Se&&(0,Z.jsx)(z,{marginTop:1,children:(0,Z.jsx)(B,{color:`error`,children:Se})}),(0,Z.jsx)(z,{marginTop:1,children:xe?(0,Z.jsx)(B,{dimColor:!0,children:`Uninstalling…`}):(0,Z.jsxs)(B,{children:[(0,Z.jsx)(B,{bold:!0,children:`y`}),` to delete · `,(0,Z.jsx)(B,{bold:!0,children:`n`}),` to keep · `,(0,Z.jsx)(B,{bold:!0,children:`esc`}),` to cancel`]})})]});if(x===`plugin-details`&&E){let e=rt(),t=`${E.plugin.name}@${E.marketplace}`,n=e?.enabledPlugins?.[t]!==!1,r=d.filter(e=>`plugin`in e&&e.plugin===E.plugin.name||e.source===t||e.source.startsWith(`${E.plugin.name}@`)),i=r.length===0?null:(0,Z.jsxs)(z,{flexDirection:`column`,marginBottom:1,children:[(0,Z.jsxs)(B,{bold:!0,color:`error`,children:[r.length,` `,gt(r.length,`error`),`:`]}),r.map((e,t)=>{let n=Un(e);return(0,Z.jsxs)(z,{flexDirection:`column`,marginLeft:2,children:[(0,Z.jsx)(B,{color:`error`,children:Hn(e)}),n&&(0,Z.jsxs)(B,{dimColor:!0,italic:!0,children:[a.arrowRight,` `,n]})]},t)})]});return(0,Z.jsxs)(z,{flexDirection:`column`,children:[(0,Z.jsx)(z,{children:(0,Z.jsxs)(B,{bold:!0,children:[E.plugin.name,` @ `,E.marketplace]})}),(0,Z.jsxs)(z,{children:[(0,Z.jsx)(B,{dimColor:!0,children:`Scope: `}),(0,Z.jsx)(B,{children:E.scope||`user`})]}),E.plugin.manifest.version&&(0,Z.jsxs)(z,{children:[(0,Z.jsx)(B,{dimColor:!0,children:`Version: `}),(0,Z.jsx)(B,{children:E.plugin.manifest.version})]}),E.plugin.manifest.description&&(0,Z.jsx)(z,{marginBottom:1,children:(0,Z.jsx)(B,{children:E.plugin.manifest.description})}),E.plugin.manifest.author&&(0,Z.jsxs)(z,{children:[(0,Z.jsx)(B,{dimColor:!0,children:`Author: `}),(0,Z.jsx)(B,{children:E.plugin.manifest.author.name})]}),(0,Z.jsxs)(z,{marginBottom:1,children:[(0,Z.jsx)(B,{dimColor:!0,children:`Status: `}),(0,Z.jsx)(B,{color:n?`success`:`warning`,children:n?`Enabled`:`Disabled`}),E.pendingUpdate&&(0,Z.jsx)(B,{color:`suggestion`,children:` · Marked for update`})]}),(0,Z.jsx)(Yn,{plugin:E.plugin,marketplace:E.marketplace}),i,(0,Z.jsx)(z,{marginTop:1,flexDirection:`column`,children:Ne.map((e,t)=>{let n=t===ye;return(0,Z.jsxs)(z,{children:[n&&(0,Z.jsxs)(B,{children:[a.pointer,` `]}),!n&&(0,Z.jsx)(B,{children:` `}),(0,Z.jsx)(B,{bold:n,color:e.label.includes(`Uninstall`)?`error`:e.label.includes(`Update`)?`suggestion`:void 0,children:e.label})]},t)})}),xe&&(0,Z.jsx)(z,{marginTop:1,children:(0,Z.jsx)(B,{children:`Processing…`})}),Se&&(0,Z.jsx)(z,{marginTop:1,children:(0,Z.jsx)(B,{color:`error`,children:Se})}),(0,Z.jsx)(z,{marginTop:1,children:(0,Z.jsx)(B,{dimColor:!0,italic:!0,children:(0,Z.jsxs)(V,{children:[(0,Z.jsx)(v,{action:`select:previous`,context:`Select`,fallback:`↑`,description:`navigate`}),(0,Z.jsx)(v,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`select`}),(0,Z.jsx)(v,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]})})})]})}if(typeof x==`object`&&x.type===`failed-plugin-details`){let e=x.plugin,t=e.errors[0],n=t?Hn(t):`Failed to load`;return(0,Z.jsxs)(z,{flexDirection:`column`,children:[(0,Z.jsxs)(B,{children:[(0,Z.jsx)(B,{bold:!0,children:e.name}),(0,Z.jsxs)(B,{dimColor:!0,children:[` @ `,e.marketplace]}),(0,Z.jsxs)(B,{dimColor:!0,children:[` (`,e.scope,`)`]})]}),(0,Z.jsx)(B,{color:`error`,children:n}),e.scope===`managed`?(0,Z.jsx)(z,{marginTop:1,children:(0,Z.jsx)(B,{dimColor:!0,children:`Managed by your organization — contact your admin`})}):(0,Z.jsxs)(z,{marginTop:1,children:[(0,Z.jsxs)(B,{color:`suggestion`,children:[a.pointer,` `]}),(0,Z.jsx)(B,{bold:!0,children:`Remove`})]}),xe&&(0,Z.jsx)(B,{children:`Processing…`}),Se&&(0,Z.jsx)(B,{color:`error`,children:Se}),(0,Z.jsx)(z,{marginTop:1,children:(0,Z.jsx)(B,{dimColor:!0,italic:!0,children:(0,Z.jsxs)(V,{children:[e.scope!==`managed`&&(0,Z.jsx)(v,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`remove`}),(0,Z.jsx)(v,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]})})})]})}if(typeof x==`object`&&x.type===`mcp-detail`){let e=x.client,n=O(u,e.name).length,r=()=>{S({type:`mcp-tools`,client:e})},i=()=>{S(`plugin-list`)},a=e=>{e&&t(e),S(`plugin-list`)},o=e.config.scope,s=e.config.type;return s===`stdio`?(0,Z.jsx)(Kt,{server:{name:e.name,client:e,scope:o,transport:`stdio`,config:e.config},serverToolsCount:n,onViewTools:r,onCancel:i,onComplete:a,borderless:!0}):s===`sse`?(0,Z.jsx)(Qt,{server:{name:e.name,client:e,scope:o,transport:`sse`,isAuthenticated:void 0,config:e.config},serverToolsCount:n,onViewTools:r,onCancel:i,onComplete:a,borderless:!0}):s===`http`?(0,Z.jsx)(Qt,{server:{name:e.name,client:e,scope:o,transport:`http`,isAuthenticated:void 0,config:e.config},serverToolsCount:n,onViewTools:r,onCancel:i,onComplete:a,borderless:!0}):s===`claudeai-proxy`?(0,Z.jsx)(Qt,{server:{name:e.name,client:e,scope:o,transport:`claudeai-proxy`,isAuthenticated:void 0,config:e.config},serverToolsCount:n,onViewTools:r,onCancel:i,onComplete:a,borderless:!0}):(S(`plugin-list`),null)}if(typeof x==`object`&&x.type===`mcp-tools`){let e=x.client,t=e.config.scope,n=e.config.type,r;return r=n===`stdio`?{name:e.name,client:e,scope:t,transport:`stdio`,config:e.config}:n===`sse`?{name:e.name,client:e,scope:t,transport:`sse`,isAuthenticated:void 0,config:e.config}:n===`http`?{name:e.name,client:e,scope:t,transport:`http`,isAuthenticated:void 0,config:e.config}:{name:e.name,client:e,scope:t,transport:`claudeai-proxy`,isAuthenticated:void 0,config:e.config},(0,Z.jsx)($t,{server:r,onSelectTool:t=>{S({type:`mcp-tool-detail`,client:e,tool:t})},onBack:()=>S({type:`mcp-detail`,client:e})})}if(typeof x==`object`&&x.type===`mcp-tool-detail`){let{client:e,tool:t}=x,n=e.config.scope,r=e.config.type,i;return i=r===`stdio`?{name:e.name,client:e,scope:n,transport:`stdio`,config:e.config}:r===`sse`?{name:e.name,client:e,scope:n,transport:`sse`,isAuthenticated:void 0,config:e.config}:r===`http`?{name:e.name,client:e,scope:n,transport:`http`,isAuthenticated:void 0,config:e.config}:{name:e.name,client:e,scope:n,transport:`claudeai-proxy`,isAuthenticated:void 0,config:e.config},(0,Z.jsx)(Zt,{tool:t,server:i,onBack:()=>S({type:`mcp-tools`,client:e})})}let Pe=_e.getVisibleItems(P);return(0,Z.jsxs)(z,{flexDirection:`column`,children:[(0,Z.jsx)(z,{marginBottom:1,children:(0,Z.jsx)(ze,{query:C,isFocused:m,isTerminalFocused:_,width:y-4,cursorOffset:T})}),P.length===0&&C&&(0,Z.jsx)(z,{marginBottom:1,children:(0,Z.jsxs)(B,{dimColor:!0,children:[`No items match "`,C,`"`]})}),_e.scrollPosition.canScrollUp&&(0,Z.jsx)(z,{children:(0,Z.jsxs)(B,{dimColor:!0,children:[` `,a.arrowUp,` more above`]})}),Pe.map((e,t)=>{let n=_e.toActualIndex(t)===F&&!m,r=t>0?Pe[t-1]:null,i=!r||r.scope!==e.scope;return(0,Z.jsxs)($n.Fragment,{children:[i&&(0,Z.jsx)(z,{marginTop:+(t>0),paddingLeft:2,children:(0,Z.jsx)(B,{dimColor:e.scope!==`flagged`,color:e.scope===`flagged`?`warning`:void 0,bold:e.scope===`flagged`,children:(e=>{switch(e){case`flagged`:return`Flagged`;case`project`:return`Project`;case`local`:return`Local`;case`user`:return`User`;case`enterprise`:return`Enterprise`;case`managed`:return`Managed`;case`builtin`:return`Built-in`;case`dynamic`:return`Built-in`;default:return e}})(e.scope)})}),(0,Z.jsx)(Gn,{item:e,isSelected:n})]},e.id)}),_e.scrollPosition.canScrollDown&&(0,Z.jsx)(z,{children:(0,Z.jsxs)(B,{dimColor:!0,children:[` `,a.arrowDown,` more below`]})}),(0,Z.jsx)(z,{marginTop:1,marginLeft:1,children:(0,Z.jsx)(B,{dimColor:!0,italic:!0,children:(0,Z.jsxs)(V,{children:[(0,Z.jsx)(B,{children:`type to search`}),(0,Z.jsx)(v,{action:`plugin:toggle`,context:`Plugin`,fallback:`Space`,description:`toggle`}),(0,Z.jsx)(v,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`details`}),(0,Z.jsx)(v,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]})})}),M.size>0&&(0,Z.jsx)(z,{marginLeft:1,children:(0,Z.jsx)(B,{dimColor:!0,italic:!0,children:`Run /reload-plugins to apply changes`})})]})}var $n,X,Z,er=e((()=>{i(),$n=t(H(),1),X=t(H(),1),C(),Ue(),qt(),Xt(),Jt(),Yt(),Ut(),Gt(),o(),xe(),De(),Bt(),we(),Et(),u(),tt(),x(),Ze(),$e(),ut(),Ee(),f(),j(),w(),M(),Rt(),ue(),be(),F(),S(),vt(),it(),Ye(),_t(),Wn(),fn(),_n(),Kn(),kn(),Z=Ke()}));function tr(e){if(!e)return{type:`menu`};let t=e.trim().split(/\s+/);switch(t[0]?.toLowerCase()){case`help`:case`--help`:case`-h`:return{type:`help`};case`install`:case`i`:{let e=t[1];if(!e)return{type:`install`};if(e.includes(`@`)){let[t,n]=e.split(`@`);return{type:`install`,plugin:t,marketplace:n}}return e.startsWith(`http://`)||e.startsWith(`https://`)||e.startsWith(`file://`)||e.includes(`/`)||e.includes(`\\`)?{type:`install`,marketplace:e}:{type:`install`,plugin:e}}case`manage`:return{type:`manage`};case`uninstall`:return{type:`uninstall`,plugin:t[1]};case`enable`:return{type:`enable`,plugin:t[1]};case`disable`:return{type:`disable`,plugin:t[1]};case`validate`:return{type:`validate`,path:t.slice(1).join(` `).trim()||void 0};case`marketplace`:case`market`:{let e=t[1]?.toLowerCase(),n=t.slice(2).join(` `);switch(e){case`add`:return{type:`marketplace`,action:`add`,target:n};case`remove`:case`rm`:return{type:`marketplace`,action:`remove`,target:n};case`update`:return{type:`marketplace`,action:`update`,target:n};case`list`:return{type:`marketplace`,action:`list`};default:return{type:`marketplace`}}}default:return{type:`menu`}}}var nr=e((()=>{}));function rr({onComplete:e,path:t}){return(0,ir.useEffect)(()=>{async function n(){if(!t){e(`Usage: /plugin validate <path>
|
|
2
|
-
|
|
3
|
-
Validate a plugin or marketplace manifest file or directory.
|
|
4
|
-
|
|
5
|
-
Examples:
|
|
6
|
-
/plugin validate .claude-plugin/plugin.json
|
|
7
|
-
/plugin validate /path/to/plugin-directory
|
|
8
|
-
/plugin validate .
|
|
9
|
-
|
|
10
|
-
When given a directory, automatically validates .claude-plugin/marketplace.json
|
|
11
|
-
or .claude-plugin/plugin.json (prefers marketplace if both exist).
|
|
12
|
-
|
|
13
|
-
Or from the command line:
|
|
14
|
-
claude plugin validate <path>`);return}try{let n=await jt(t),r=``;r+=`Validating ${n.fileType} manifest: ${n.filePath}\n\n`,n.errors.length>0&&(r+=`${a.cross} Found ${n.errors.length} ${gt(n.errors.length,`error`)}:\n\n`,n.errors.forEach(e=>{r+=` ${a.pointer} ${e.path}: ${e.message}\n`}),r+=`
|
|
15
|
-
`),n.warnings.length>0&&(r+=`${a.warning} Found ${n.warnings.length} ${gt(n.warnings.length,`warning`)}:\n\n`,n.warnings.forEach(e=>{r+=` ${a.pointer} ${e.path}: ${e.message}\n`}),r+=`
|
|
16
|
-
`),n.success?(n.warnings.length>0?r+=`${a.tick} Validation passed with warnings\n`:r+=`${a.tick} Validation passed\n`,process.exitCode=0):(r+=`${a.cross} Validation failed\n`,process.exitCode=1),e(r)}catch(t){process.exitCode=2,dt(t),e(`${a.cross} Unexpected error during validation: ${Je(t)}`)}}n()},[e,t]),(0,ar.jsx)(z,{flexDirection:`column`,children:(0,ar.jsx)(B,{children:`Running validation...`})})}var ir,ar,or=e((()=>{i(),H(),ir=t(H(),1),Ue(),$e(),ut(),Pt(),_t(),ar=Ke()}));function sr({onComplete:e}){return(0,Q.useEffect)(()=>{async function t(){try{let t=await g(),n=Object.keys(t);n.length===0?e(`No marketplaces configured`):e(`Configured marketplaces:\n${n.map(e=>` • ${e}`).join(`
|
|
17
|
-
`)}`)}catch(t){e(`Error loading marketplaces: ${Je(t)}`)}}t()},[e]),(0,$.jsx)(B,{children:`Loading marketplaces...`})}function cr(e){let t=[];for(let{source:n,scope:r}of[{source:`userSettings`,scope:`user`},{source:`projectSettings`,scope:`project`},{source:`localSettings`,scope:`local`}])nt(n)?.extraKnownMarketplaces?.[e]&&t.push({source:n,scope:r});return{editableSources:t,isInPolicy:!!nt(`policySettings`)?.extraKnownMarketplaces?.[e]}}function lr(e){let{editableSources:t,isInPolicy:n}=cr(e);return t.length>0?{kind:`remove-extra-marketplace`,name:e,sources:t}:n?{kind:`managed-only`,name:e}:{kind:`navigate`,tab:`marketplaces`,viewState:{type:`manage-marketplaces`,targetMarketplace:e,action:`remove`}}}function ur(e){return{kind:`navigate`,tab:`installed`,viewState:{type:`manage-plugins`,targetPlugin:e,action:`uninstall`}}}function dr(e){return yr.has(e.type)}function fr(e){if(`pluginId`in e&&e.pluginId)return e.pluginId;if(`plugin`in e&&e.plugin)return e.plugin;if(e.source.includes(`@`))return e.source.split(`@`)[0]}function pr(e,t,n,r,i,a,o){let s=[];for(let e of a){let t=`pluginId`in e?e.pluginId:`plugin`in e?e.plugin:void 0;s.push({label:t??e.source,message:Hn(e),guidance:`Restart to retry loading plugins`,action:{kind:`none`}})}let c=new Set;for(let t of e){c.add(t.name);let e=lr(t.name),n=cr(t.name),r=n.isInPolicy?`managed`:n.editableSources[0]?.scope;s.push({label:t.name,message:t.error??`Installation failed`,guidance:e.kind===`managed-only`?`Managed by your organization — contact your admin`:void 0,action:e,scope:r})}for(let e of t){let t=`marketplace`in e?e.marketplace:e.source;if(c.has(t))continue;c.add(t);let n=lr(t),r=cr(t),i=r.isInPolicy?`managed`:r.editableSources[0]?.scope;s.push({label:t,message:Hn(e),guidance:n.kind===`managed-only`?`Managed by your organization — contact your admin`:Un(e),action:n,scope:i})}for(let e of i)c.has(e.name)||(c.add(e.name),s.push({label:e.name,message:e.error,action:{kind:`remove-installed-marketplace`,name:e.name}}));let l=new Set;for(let e of n){let t=fr(e);if(t&&l.has(t))continue;t&&l.add(t);let n=`marketplace`in e?e.marketplace:void 0,r=t?o.get(e.source)??o.get(t):void 0;s.push({label:t?n?`${t} @ ${n}`:t:e.source,message:Hn(e),guidance:Un(e),action:t?ur(t):{kind:`none`},scope:r})}for(let e of r)s.push({label:e.source,message:Hn(e),guidance:Un(e),action:{kind:`none`}});return s}function mr(e,t){for(let{source:n}of t){let t=nt(n);if(!t)continue;let r={};if(t.extraKnownMarketplaces?.[e]&&(r.extraKnownMarketplaces={...t.extraKnownMarketplaces,[e]:void 0}),t.enabledPlugins){let n=`@${e}`,i=!1,a={...t.enabledPlugins};for(let e in a)e.endsWith(n)&&(a[e]=void 0,i=!0);i&&(r.enabledPlugins=a)}Object.keys(r).length>0&&ot(n,r)}}function hr({setViewState:e,setActiveTab:t,markPluginsChanged:n}){let r=ke(e=>e.plugins.errors),i=ke(e=>e.plugins.installationStatus),o=d(),[s,c]=(0,Q.useState)(0),[l,u]=(0,Q.useState)(null),[f,p]=(0,Q.useState)([]);(0,Q.useEffect)(()=>{(async()=>{try{let{failures:e}=await Ce(await g());p(e)}catch{}})()},[]);let m=i.marketplaces.filter(e=>e.status===`failed`),h=new Set(m.map(e=>e.name)),_=r.filter(dr),y=pr(m,r.filter(e=>(e.type===`marketplace-not-found`||e.type===`marketplace-load-failed`||e.type===`marketplace-blocked-by-policy`)&&!h.has(e.marketplace)),r.filter(e=>dr(e)||e.type===`marketplace-not-found`||e.type===`marketplace-load-failed`||e.type===`marketplace-blocked-by-policy`?!1:fr(e)!==void 0),r.filter(e=>dr(e)||e.type===`marketplace-not-found`||e.type===`marketplace-load-failed`||e.type===`marketplace-blocked-by-policy`?!1:fr(e)===void 0),f,_,yt());Fe(`confirm:no`,()=>{e({type:`menu`})},{context:`Confirmation`}),R({"select:previous":()=>c(e=>Math.max(0,e-1)),"select:next":()=>c(e=>Math.min(y.length-1,e+1)),"select:accept":()=>{let r=y[s];if(!r)return;let{action:i}=r;switch(i.kind){case`navigate`:t(i.tab),e(i.viewState);break;case`remove-extra-marketplace`:{let e=i.sources.map(e=>e.scope).join(`, `);mr(i.name,i.sources),he(),o(e=>({...e,plugins:{...e.plugins,errors:e.plugins.errors.filter(e=>!(`marketplace`in e&&e.marketplace===i.name)),installationStatus:{...e.plugins.installationStatus,marketplaces:e.plugins.installationStatus.marketplaces.filter(e=>e.name!==i.name)}}})),u(`${a.tick} Removed "${i.name}" from ${e} settings`),n();break}case`remove-installed-marketplace`:(async()=>{try{await I(i.name),he(),p(e=>e.filter(e=>e.name!==i.name)),u(`${a.tick} Removed marketplace "${i.name}"`),n()}catch(e){u(`Failed to remove "${i.name}": ${e instanceof Error?e.message:String(e)}`)}})();break;case`managed-only`:break;case`none`:break}}},{context:`Select`,isActive:y.length>0});let b=Math.min(s,Math.max(0,y.length-1));b!==s&&c(b);let x=y[b]?.action,S=x&&x.kind!==`none`&&x.kind!==`managed-only`;return y.length===0?(0,$.jsxs)(z,{flexDirection:`column`,children:[(0,$.jsx)(z,{marginLeft:1,children:(0,$.jsx)(B,{dimColor:!0,children:`No plugin errors`})}),(0,$.jsx)(z,{marginTop:1,children:(0,$.jsx)(B,{dimColor:!0,italic:!0,children:(0,$.jsx)(v,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})})})]}):(0,$.jsxs)(z,{flexDirection:`column`,children:[y.map((e,t)=>{let n=t===b;return(0,$.jsxs)(z,{marginLeft:1,flexDirection:`column`,marginBottom:1,children:[(0,$.jsxs)(B,{children:[(0,$.jsxs)(B,{color:n?`suggestion`:`error`,children:[n?a.pointer:a.cross,` `]}),(0,$.jsx)(B,{bold:n,children:e.label}),e.scope&&(0,$.jsxs)(B,{dimColor:!0,children:[` (`,e.scope,`)`]})]}),(0,$.jsx)(z,{marginLeft:3,children:(0,$.jsx)(B,{color:`error`,children:e.message})}),e.guidance&&(0,$.jsx)(z,{marginLeft:3,children:(0,$.jsx)(B,{dimColor:!0,italic:!0,children:e.guidance})})]},t)}),l&&(0,$.jsx)(z,{marginTop:1,marginLeft:1,children:(0,$.jsx)(B,{color:`claude`,children:l})}),(0,$.jsx)(z,{marginTop:1,children:(0,$.jsx)(B,{dimColor:!0,italic:!0,children:(0,$.jsxs)(V,{children:[(0,$.jsx)(v,{action:`select:previous`,context:`Select`,fallback:`↑`,description:`navigate`}),S&&(0,$.jsx)(v,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`resolve`}),(0,$.jsx)(v,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]})})})]})}function gr(e){switch(e.type){case`help`:return{type:`help`};case`validate`:return{type:`validate`,path:e.path};case`install`:return e.marketplace?{type:`browse-marketplace`,targetMarketplace:e.marketplace,targetPlugin:e.plugin}:e.plugin?{type:`discover-plugins`,targetPlugin:e.plugin}:{type:`discover-plugins`};case`manage`:return{type:`manage-plugins`};case`uninstall`:return{type:`manage-plugins`,targetPlugin:e.plugin,action:`uninstall`};case`enable`:return{type:`manage-plugins`,targetPlugin:e.plugin,action:`enable`};case`disable`:return{type:`manage-plugins`,targetPlugin:e.plugin,action:`disable`};case`marketplace`:return e.action===`list`?{type:`marketplace-list`}:e.action===`add`?{type:`add-marketplace`,initialValue:e.target}:e.action===`remove`?{type:`manage-marketplaces`,targetMarketplace:e.target,action:`remove`}:e.action===`update`?{type:`manage-marketplaces`,targetMarketplace:e.target,action:`update`}:{type:`marketplace-menu`};default:return{type:`discover-plugins`}}}function _r(e){return e.type===`manage-plugins`?`installed`:e.type===`manage-marketplaces`?`marketplaces`:`discover`}function vr({onComplete:e,args:t}){let n=tr(t),r=gr(n),[i,a]=(0,Q.useState)(r),[o,s]=(0,Q.useState)(_r(r)),[c,l]=(0,Q.useState)(i.type===`add-marketplace`&&i.initialValue||``),[u,f]=(0,Q.useState)(0),[p,m]=(0,Q.useState)(null),[h,g]=(0,Q.useState)(null),[_,v]=(0,Q.useState)(!1),y=d(),b=ke(e=>{let t=e.plugins.errors.length;for(let n of e.plugins.installationStatus.marketplaces)n.status===`failed`&&t++;return t}),x=b>0?`Errors (${b})`:`Errors`,S=Vt(),C=n.type===`marketplace`&&n.action===`add`&&n.target!==void 0,w=(0,Q.useCallback)(()=>{y(e=>e.plugins.needsRefresh?e:{...e,plugins:{...e.plugins,needsRefresh:!0}})},[y]),ee=(0,Q.useCallback)(e=>{let t=e;switch(s(t),m(null),t){case`discover`:a({type:`discover-plugins`});break;case`installed`:a({type:`manage-plugins`});break;case`marketplaces`:a({type:`manage-marketplaces`});break;case`errors`:break}},[]);return(0,Q.useEffect)(()=>{i.type===`menu`&&!h&&e()},[i.type,h,e]),(0,Q.useEffect)(()=>{i.type===`browse-marketplace`&&o!==`discover`&&s(`discover`)},[i.type,o]),Fe(`confirm:no`,(0,Q.useCallback)(()=>{s(`marketplaces`),a({type:`manage-marketplaces`}),l(``),m(null)},[]),{context:`Settings`,isActive:i.type===`add-marketplace`}),(0,Q.useEffect)(()=>{h&&e(h)},[h,e]),(0,Q.useEffect)(()=>{i.type===`help`&&e()},[i.type,e]),i.type===`help`?(0,$.jsxs)(z,{flexDirection:`column`,children:[(0,$.jsx)(B,{bold:!0,children:`Plugin Command Usage:`}),(0,$.jsx)(B,{children:` `}),(0,$.jsx)(B,{dimColor:!0,children:`Installation:`}),(0,$.jsx)(B,{children:` /plugin install - Browse and install plugins`}),(0,$.jsx)(B,{children:` /plugin install <marketplace> - Install from specific marketplace`}),(0,$.jsx)(B,{children:` /plugin install <plugin> - Install specific plugin`}),(0,$.jsx)(B,{children:` /plugin install <plugin>@<market> - Install plugin from marketplace`}),(0,$.jsx)(B,{children:` `}),(0,$.jsx)(B,{dimColor:!0,children:`Management:`}),(0,$.jsx)(B,{children:` /plugin manage - Manage installed plugins`}),(0,$.jsx)(B,{children:` /plugin enable <plugin> - Enable a plugin`}),(0,$.jsx)(B,{children:` /plugin disable <plugin> - Disable a plugin`}),(0,$.jsx)(B,{children:` /plugin uninstall <plugin> - Uninstall a plugin`}),(0,$.jsx)(B,{children:` `}),(0,$.jsx)(B,{dimColor:!0,children:`Marketplaces:`}),(0,$.jsx)(B,{children:` /plugin marketplace - Marketplace management menu`}),(0,$.jsx)(B,{children:` /plugin marketplace add - Add a marketplace`}),(0,$.jsx)(B,{children:` /plugin marketplace add <path/url> - Add marketplace directly`}),(0,$.jsx)(B,{children:` /plugin marketplace update - Update marketplaces`}),(0,$.jsx)(B,{children:` /plugin marketplace update <name> - Update specific marketplace`}),(0,$.jsx)(B,{children:` /plugin marketplace remove - Remove a marketplace`}),(0,$.jsx)(B,{children:` /plugin marketplace remove <name> - Remove specific marketplace`}),(0,$.jsx)(B,{children:` /plugin marketplace list - List all marketplaces`}),(0,$.jsx)(B,{children:` `}),(0,$.jsx)(B,{dimColor:!0,children:`Validation:`}),(0,$.jsx)(B,{children:` /plugin validate <path> - Validate a manifest file or directory`}),(0,$.jsx)(B,{children:` `}),(0,$.jsx)(B,{dimColor:!0,children:`Other:`}),(0,$.jsx)(B,{children:` /plugin - Main plugin menu`}),(0,$.jsx)(B,{children:` /plugin help - Show this help`}),(0,$.jsx)(B,{children:` /plugins - Alias for /plugin`})]}):i.type===`validate`?(0,$.jsx)(rr,{onComplete:e,path:i.path}):i.type===`marketplace-menu`?(a({type:`menu`}),null):i.type===`marketplace-list`?(0,$.jsx)(sr,{onComplete:e}):i.type===`add-marketplace`?(0,$.jsx)(an,{inputValue:c,setInputValue:l,cursorOffset:u,setCursorOffset:f,error:p,setError:m,result:h,setResult:g,setViewState:a,onAddComplete:w,cliMode:C}):(0,$.jsx)(We,{color:`suggestion`,children:(0,$.jsxs)(He,{title:`Plugins`,selectedTab:o,onTabChange:ee,color:`suggestion`,disableNavigation:_,children:[(0,$.jsx)(Be,{id:`discover`,title:`Discover`,children:i.type===`browse-marketplace`?(0,$.jsx)(An,{error:p,setError:m,result:h,setResult:g,setViewState:a,onInstallComplete:w,targetMarketplace:i.targetMarketplace,targetPlugin:i.targetPlugin}):(0,$.jsx)(Nn,{error:p,setError:m,result:h,setResult:g,setViewState:a,onInstallComplete:w,onSearchModeChange:v,targetPlugin:i.type===`discover-plugins`?i.targetPlugin:void 0})}),(0,$.jsx)(Be,{id:`installed`,title:`Installed`,children:(0,$.jsx)(Qn,{setViewState:a,setResult:g,onManageComplete:w,onSearchModeChange:v,targetPlugin:i.type===`manage-plugins`?i.targetPlugin:void 0,targetMarketplace:i.type===`manage-plugins`?i.targetMarketplace:void 0,action:i.type===`manage-plugins`?i.action:void 0})}),(0,$.jsx)(Be,{id:`marketplaces`,title:`Marketplaces`,children:(0,$.jsx)(Rn,{setViewState:a,error:p,setError:m,setResult:g,exitState:S,onManageComplete:w,targetMarketplace:i.type===`manage-marketplaces`?i.targetMarketplace:void 0,action:i.type===`manage-marketplaces`?i.action:void 0})}),(0,$.jsx)(Be,{id:`errors`,title:x,children:(0,$.jsx)(hr,{setViewState:a,setActiveTab:s,markPluginsChanged:w})})]})})}var Q,$,yr,br=e((()=>{i(),H(),Q=t(H(),1),C(),Ue(),Ht(),xe(),u(),$e(),Ee(),N(),j(),vt(),it(),sn(),Mn(),Ln(),Vn(),er(),Wn(),nr(),or(),$=Ke(),yr=new Set([`git-auth-failed`,`git-timeout`,`network-error`])}));async function xr(e,t,n){return(0,Sr.jsx)(vr,{onComplete:e,args:n})}var Sr;e((()=>{H(),br(),Sr=Ke()}))();export{xr as call};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{Eo as t,Go as n,Ho as r,Lo as i,Oo as a,Vo as o,dT as s,jo as c,pT as l}from"./loadAgentsDir-C7lOqvfh.js";import{F as u,a as d,l as f,z as p}from"./debug-RAynG_nM.js";import{vt as m,xt as h}from"./settings-DnptdP79.js";import{b as g,h as _}from"./config-Do1870_d.js";import{o as v,s as y}from"./log-CezCRpAN.js";import{f as b,s as x}from"./pluginOperations-D90IRawu.js";function S(e){return O=e,k!==null&&k.length>0&&(e(k),k=null),()=>{O=null}}async function C(){let e=await r(),t=i(),n=new Set;for(let[r,i]of Object.entries(e)){let e=t[r]?.autoUpdate;(e===void 0?h(r,i):e)&&n.add(r.toLowerCase())}return n}async function w(e,t){let n=!1;for(let{scope:r}of t)try{let t=await b(e,r);t.success&&!t.alreadyUpToDate?(n=!0,f(`Plugin autoupdate: updated ${e} from ${t.oldVersion} to ${t.newVersion}`)):t.alreadyUpToDate||f(`Plugin autoupdate: failed to update ${e}: ${t.message}`,{level:`warn`})}catch(t){f(`Plugin autoupdate: error updating ${e}: ${u(t)}`,{level:`warn`})}return n?e:null}async function T(e){let t=c(),n=Object.keys(t.plugins);return n.length===0?[]:(await Promise.allSettled(n.map(async n=>{let{marketplace:r}=l(n);if(!r||!e.has(r.toLowerCase()))return null;let i=t.plugins[n];if(!i||i.length===0)return null;let o=i.filter(a);return o.length===0?null:w(n,o)}))).filter(e=>e.status===`fulfilled`&&e.value!==null).map(e=>e.value)}async function E(e){return T(e)}function D(){(async()=>{if(g()){f(`Plugin autoupdate: skipped (auto-updater disabled)`);return}try{let e=await C();if(e.size===0)return;let t=(await Promise.allSettled(Array.from(e).map(async e=>{try{await n(e,void 0,{disableCredentialHelper:!0})}catch(t){f(`Plugin autoupdate: failed to refresh marketplace ${e}: ${u(t)}`,{level:`warn`})}}))).filter(e=>e.status===`rejected`);t.length>0&&f(`Plugin autoupdate: ${t.length} marketplace refresh(es) failed`,{level:`warn`}),f(`Plugin autoupdate: checking installed plugins`);let r=await E(e);r.length>0&&(O?O(r):k=r)}catch(e){y(e)}})()}var O,k,A=e((()=>{x(),_(),d(),p(),v(),t(),o(),s(),m(),O=null,k=null}));export{T as i,A as n,S as r,D as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{Eo as e,Mo as t,Ro as n,Uo as r,Vo as i}from"./loadAgentsDir-C7lOqvfh.js";import{F as a,a as o,l as s,z as c}from"./debug-RAynG_nM.js";import{d as l,s as u}from"./pluginOperations-D90IRawu.js";import{i as d,n as f,r as p,t as m}from"./pluginFlagging-DZaYzecY.js";u(),o(),c(),e(),i(),p();function h(e,t,n){let r=new Set(t.plugins.map(e=>e.name)),i=`@${n}`,a=[];for(let t of Object.keys(e.plugins)){if(!t.endsWith(i))continue;let e=t.slice(0,-i.length);r.has(e)||a.push(t)}return a}async function g(){await d();let e=t(),i=f(),o=await r(),c=[];for(let t of Object.keys(o))try{let r=await n(t);if(!r.forceRemoveDeletedPlugins)continue;let o=h(e,r,t);for(let t of o){if(t in i)continue;let n=e.plugins[t]??[];if(n.some(e=>e.scope===`user`||e.scope===`project`||e.scope===`local`)){for(let e of n){let{scope:n}=e;if(!(n!==`user`&&n!==`project`&&n!==`local`))try{await l(t,n)}catch(e){s(`Failed to auto-uninstall delisted plugin ${t} from ${n}: ${a(e)}`,{level:`error`})}}await m(t),c.push(t)}}}catch(e){s(`Failed to check for delisted plugins in "${t}": ${a(e)}`,{level:`warn`})}return c}export{g as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e,t}from"./figures-5ThXQEtq.js";import{Mf as n,Nf as r,Pf as i,To as a,dT as o,pT as s,rf as c,tf as l,wo as u}from"./loadAgentsDir-C7lOqvfh.js";import{F as d,z as f}from"./debug-RAynG_nM.js";import{n as p,o as m}from"./process-gEbdy6uY.js";import{o as h,s as g}from"./log-CezCRpAN.js";import{n as _,r as v}from"./analytics-DJobLaWP.js";import{a as y,c as b,d as x,f as S,i as C,r as w,s as T}from"./pluginOperations-D90IRawu.js";e(),f(),c(),h(),a(),o(),p(),i(),_(),T();function E(e,i,a){g(e);let o=a?`${i} plugin "${a}"`:i===`disable-all`?`disable all plugins`:`${i} plugins`;console.error(`${t.cross} Failed to ${o}: ${d(e)}`);let c=a?(()=>{let{name:e,marketplace:t}=s(a);return{_PROTO_plugin_name:e,...t&&{_PROTO_marketplace_name:t},...n(e,t,u())}})():{};v(`tengu_plugin_command_failed`,{command:i,error_category:r(e),...c}),process.exit(1)}async function D(e,r=`user`){try{console.log(`Installing plugin "${e}"...`);let i=await b(e,r);if(!i.success)throw Error(i.message);console.log(`${t.tick} ${i.message}`);let{name:a,marketplace:o}=s(i.pluginId||e);v(`tengu_plugin_installed_cli`,{_PROTO_plugin_name:a,...o&&{_PROTO_marketplace_name:o},scope:i.scope||r,install_source:`cli-explicit`,...n(a,o,u())}),process.exit(0)}catch(t){E(t,`install`,e)}}async function O(e,r=`user`,i=!1){try{let a=await x(e,r,!i);if(!a.success)throw Error(a.message);console.log(`${t.tick} ${a.message}`);let{name:o,marketplace:c}=s(a.pluginId||e);v(`tengu_plugin_uninstalled_cli`,{_PROTO_plugin_name:o,...c&&{_PROTO_marketplace_name:c},scope:a.scope||r,...n(o,c,u())}),process.exit(0)}catch(t){E(t,`uninstall`,e)}}async function k(e,r){try{let i=await y(e,r);if(!i.success)throw Error(i.message);console.log(`${t.tick} ${i.message}`);let{name:a,marketplace:o}=s(i.pluginId||e);v(`tengu_plugin_enabled_cli`,{_PROTO_plugin_name:a,...o&&{_PROTO_marketplace_name:o},scope:i.scope,...n(a,o,u())}),process.exit(0)}catch(t){E(t,`enable`,e)}}async function A(e,r){try{let i=await C(e,r);if(!i.success)throw Error(i.message);console.log(`${t.tick} ${i.message}`);let{name:a,marketplace:o}=s(i.pluginId||e);v(`tengu_plugin_disabled_cli`,{_PROTO_plugin_name:a,...o&&{_PROTO_marketplace_name:o},scope:i.scope,...n(a,o,u())}),process.exit(0)}catch(t){E(t,`disable`,e)}}async function j(){try{let e=await w();if(!e.success)throw Error(e.message);console.log(`${t.tick} ${e.message}`),v(`tengu_plugin_disabled_all_cli`,{}),process.exit(0)}catch(e){E(e,`disable-all`)}}async function M(e,r){try{m(`Checking for updates for plugin "${e}" at ${r} scope…\n`);let i=await S(e,r);if(!i.success)throw Error(i.message);if(m(`${t.tick} ${i.message}\n`),!i.alreadyUpToDate){let{name:t,marketplace:r}=s(i.pluginId||e);v(`tengu_plugin_updated_cli`,{_PROTO_plugin_name:t,...r&&{_PROTO_marketplace_name:r},old_version:i.oldVersion||`unknown`,new_version:i.newVersion||`unknown`,...n(t,r,u())})}await l(0)}catch(t){E(t,`update`,e)}}export{O as a,D as i,A as n,M as o,k as r,j as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{Xw as t,Zw as n}from"./loadAgentsDir-C7lOqvfh.js";import{C as r,S as i,a,d as o,l as s,p as c,w as l}from"./debug-RAynG_nM.js";import{o as u,s as d}from"./log-CezCRpAN.js";import{join as f}from"path";import{randomBytes as p}from"crypto";import{readFile as m,rename as h,unlink as g,writeFile as _}from"fs/promises";function v(){return f(t(),D)}function y(e){let t=r(e);if(typeof t!=`object`||!t||!(`plugins`in t)||typeof t.plugins!=`object`||t.plugins===null)return{};let n=t.plugins,i={};for(let[e,t]of Object.entries(n))if(t&&typeof t==`object`&&`flaggedAt`in t&&typeof t.flaggedAt==`string`){let n={flaggedAt:t.flaggedAt};`seenAt`in t&&typeof t.seenAt==`string`&&(n.seenAt=t.seenAt),i[e]=n}return i}async function b(){try{return y(await m(v(),{encoding:`utf-8`}))}catch{return{}}}async function x(e){let n=v(),r=`${n}.${p(8).toString(`hex`)}.tmp`;try{await o().mkdir(t()),await _(r,l({plugins:e},null,2),{encoding:`utf-8`,mode:384}),await h(r,n),k=e}catch(e){d(e);try{await g(r)}catch{}}}async function S(){let e=await b(),t=Date.now(),n=!1;for(let[r,i]of Object.entries(e))i.seenAt&&t-new Date(i.seenAt).getTime()>=O&&(delete e[r],n=!0);k=e,n&&await x(e)}function C(){return k??{}}async function w(e){k===null&&(k=await b()),await x({...k,[e]:{flaggedAt:new Date().toISOString()}}),s(`Flagged plugin: ${e}`)}async function T(e){k===null&&(k=await b());let t=new Date().toISOString(),n=!1,r={...k};for(let i of e){let e=r[i];e&&!e.seenAt&&(r[i]={...e,seenAt:t},n=!0)}n&&await x(r)}async function E(e){if(k===null&&(k=await b()),!(e in k))return;let{[e]:t,...n}=k;k=n,await x(n)}var D,O,k,A=e((()=>{a(),c(),u(),i(),n(),D=`flagged-plugins.json`,O=2880*60*1e3,k=null}));export{T as a,S as i,C as n,E as o,A as r,w as t};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{Bo as t,Co as n,DS as r,Eo as i,Ho as a,Lg as o,Mo as s,No as c,Po as l,Rg as u,Ro as d,So as f,Vo as p,Zw as m,cT as h,co as g,dT as _,do as v,ds as y,fo as b,go as x,jo as S,kS as C,lT as w,ls as T,mT as E,mo as D,pT as O,po as ee,qw as te,uT as k,uo as A,us as j,vT as M,vo as ne,xo as re,yT as ie,yo as ae}from"./loadAgentsDir-C7lOqvfh.js";import{Wt as oe,et as N}from"./state-BemZdQIl.js";import{V as P,W as se,d as ce,p as F,z as I}from"./debug-RAynG_nM.js";import{c as L,g as R,x as z}from"./settings-DnptdP79.js";import{o as B,s as V}from"./log-CezCRpAN.js";import{l as H,o as U}from"./stringUtils-C84IJ91d.js";import{n as W,t as G}from"./pluginStartupCheck-CB2q2dLv.js";import{dirname as le,join as K}from"path";function q(e){if(!Q.includes(e))throw Error(`Invalid scope "${e}". Must be one of: ${Q.join(`, `)}`)}function ue(e){return Q.includes(e)}function J(e){return e===`project`||e===`local`?N():void 0}function de(e){return L(`projectSettings`)?.enabledPlugins?.[e]===!0}function fe(e){let t=e.includes(`@`);for(let n of[`local`,`project`,`user`]){let r=L(E(n))?.enabledPlugins;if(r){for(let i of Object.keys(r))if(t?i===e:i.startsWith(`${e}@`))return{pluginId:i,scope:n}}}return null}function pe(e,t){let{name:n,marketplace:r}=O(e);return t.find(t=>t.name===e||t.name===n?!0:r&&t.source?t.name===n&&t.source.includes(`@${r}`):!1)}function me(e){let{name:t}=O(e),n=s();if(n.plugins[e]?.length)return{pluginId:e,pluginName:t};let r=Object.keys(n.plugins).find(e=>{let{name:r}=O(e);return r===t&&(n.plugins[e]?.length??0)>0});return r?{pluginId:r,pluginName:t}:null}function Y(e){let t=s().plugins[e];if(!t||t.length===0)return{scope:`user`};let n=N(),r=t.find(e=>e.scope===`local`&&e.projectPath===n);if(r)return{scope:r.scope,projectPath:r.projectPath};let i=t.find(e=>e.scope===`project`&&e.projectPath===n);if(i)return{scope:i.scope,projectPath:i.projectPath};let a=t.find(e=>e.scope===`user`);return a?{scope:a.scope}:{scope:t[0].scope,projectPath:t[0].projectPath}}async function he(e,n=`user`){q(n);let{name:r,marketplace:i}=O(e),o,s,c;if(i){let n=await t(e);n&&(o=n.entry,s=i,c=n.marketplaceInstallLocation)}else{let e=await a();for(let[t,n]of Object.entries(e))try{let e=(await d(t)).plugins.find(e=>e.name===r);if(e){o=e,s=t,c=n.installLocation;break}}catch(e){V(se(e))}}if(!o||!s)return{success:!1,message:`Plugin "${r}" not found in ${i?`marketplace "${i}"`:`any configured marketplace`}`};let l=o,u=`${l.name}@${s}`,f=await re({pluginId:u,entry:l,scope:n,marketplaceInstallLocation:c});if(!f.ok){let e=f;switch(e.reason){case`local-source-no-location`:return{success:!1,message:`Cannot install local plugin "${e.pluginName}" without marketplace install location`};case`settings-write-failed`:return{success:!1,message:`Failed to update settings: ${e.message}`};case`resolution-failed`:return{success:!1,message:ne(e.resolution)};case`blocked-by-policy`:return{success:!1,message:`Plugin "${e.pluginName}" is blocked by your organization's policy and cannot be installed`};case`dependency-blocked-by-policy`:return{success:!1,message:`Plugin "${e.pluginName}" depends on "${e.blockedDependency}", which is blocked by your organization's policy`}}}return{success:!0,message:`Successfully installed plugin: ${u} (scope: ${n})${f.depNote}`,pluginId:u,pluginName:l.name,scope:n}}async function ge(e,t=`user`,n=!0){q(t);let{enabled:i,disabled:a}=await D(),o=[...i,...a],l=pe(e,o),u=E(t),d=L(u),f,p;if(l)f=Object.keys(d?.enabledPlugins??{}).find(t=>t===e||t===l.name||t.startsWith(`${l.name}@`))??(e.includes(`@`)?e:l.name),p=l.name;else{let t=me(e);if(!t)return{success:!1,message:`Plugin "${e}" not found in installed plugins`};f=t.pluginId,p=t.pluginName}let m=J(t),g=s().plugins[f],_=g?.find(e=>e.scope===t&&e.projectPath===m);if(!_){let{scope:n}=Y(f);return n!==t&&g&&g.length>0?n===`project`?{success:!1,message:`Plugin "${e}" is enabled at project scope (.claude/settings.json, shared with your team). To disable just for you: claude plugin disable ${e} --scope local`}:{success:!1,message:`Plugin "${e}" is installed in ${n} scope, not ${t}. Use --scope ${n} to uninstall.`}:{success:!1,message:`Plugin "${e}" is not installed in ${t} scope. Use --scope to specify the correct scope.`}}let v=_.installPath,b={...d?.enabledPlugins};b[f]=void 0,z(u,{enabledPlugins:b}),T(),c(f,t,m);let x=s().plugins[f],S=!x||x.length===0;S&&v&&await y(v),S&&(r(f),n&&await te(f));let C=h(f,o),O=w(C);return{success:!0,message:`Successfully uninstalled plugin: ${p} (scope: ${t})${O}`,pluginId:f,pluginName:p,scope:t,reverseDependents:C.length>0?C:void 0}}async function X(e,t,n){let r=t?`enable`:`disable`;if(ie(e)){let{error:n}=z(`userSettings`,{enabledPlugins:{...L(`userSettings`)?.enabledPlugins,[e]:t}});if(n)return{success:!1,message:`Failed to ${r} built-in plugin: ${n.message}`};T();let{name:i}=O(e);return{success:!0,message:`Successfully ${r}d built-in plugin: ${i}`,pluginId:e,pluginName:i,scope:`user`}}n&&q(n);let i,a,o=fe(e);if(n)if(a=n,o)i=o.pluginId;else if(e.includes(`@`))i=e;else return{success:!1,message:`Plugin "${e}" not found in settings. Use plugin@marketplace format.`};else if(o)i=o.pluginId,a=o.scope;else if(e.includes(`@`))i=e,a=`user`;else return{success:!1,message:`Plugin "${e}" not found in any editable settings scope. Use plugin@marketplace format.`};if(t&&u(i))return{success:!1,message:`Plugin "${i}" is blocked by your organization's policy and cannot be enabled`};let s=E(a),c=L(s)?.enabledPlugins?.[i],l={user:0,project:1,local:2},d=n&&o&&l[n]>l[o.scope];if(n&&c===void 0&&o&&o.scope!==n&&!d)return{success:!1,message:`Plugin "${e}" is installed at ${o.scope} scope, not ${n}. Use --scope ${o.scope} or omit --scope to auto-detect.`};if(t===(n&&!d?c===!0:G().has(i)))return{success:!1,message:`Plugin "${e}" is already ${t?`enabled`:`disabled`}${n?` at ${n} scope`:``}`};let f;if(!t){let{enabled:e,disabled:t}=await D(),n=h(i,[...e,...t]);n.length>0&&(f=n)}let{error:p}=z(s,{enabledPlugins:{...L(s)?.enabledPlugins,[i]:t}});if(p)return{success:!1,message:`Failed to ${r} plugin: ${p.message}`};T();let{name:m}=O(i),g=w(f);return{success:!0,message:`Successfully ${r}d plugin: ${m} (scope: ${a})${g}`,pluginId:i,pluginName:m,scope:a,reverseDependents:f}}async function _e(e,t){return X(e,!0,t)}async function ve(e,t){return X(e,!1,t)}async function Z(){let e=G();if(e.size===0)return{success:!0,message:`No enabled plugins to disable`};let t=[],n=[];for(let[r]of e){let e=await X(r,!1);e.success?t.push(r):n.push(`${r}: ${e.message}`)}return n.length>0?{success:!1,message:`Disabled ${t.length} ${H(t.length,`plugin`)}, ${n.length} failed:\n${n.join(`
|
|
2
|
-
`)}`}:{success:!0,message:`Disabled ${t.length} ${H(t.length,`plugin`)}`}}async function ye(e,n){let{name:r,marketplace:i}=O(e),a=i?`${r}@${i}`:e,o=await t(e);if(!o)return{success:!1,message:`Plugin "${r}" not found`,pluginId:a,scope:n};let{entry:s,marketplaceInstallLocation:c}=o,l=S().plugins[a];if(!l||l.length===0)return{success:!1,message:`Plugin "${r}" is not installed`,pluginId:a,scope:n};let u=J(n),d=l.find(e=>e.scope===n&&e.projectPath===u);return d?be({pluginId:a,pluginName:r,entry:s,marketplaceInstallLocation:c,installation:d,scope:n,projectPath:u}):{success:!1,message:`Plugin "${r}" is not installed at scope ${u?`${n} (${u})`:n}`,pluginId:a,scope:n}}async function be({pluginId:e,pluginName:t,entry:n,marketplaceInstallLocation:r,installation:i,scope:a,projectPath:o}){let s=ce(),c=i.version,u,d,p=!1,m;if(typeof n.source!=`string`){let t=await g(n.source,{manifest:{name:n.name}});u=t.path,p=!0,m=t.gitCommitSha,d=await f(e,n.source,t.manifest,t.path,n.version,t.gitCommitSha)}else{let t;try{t=await s.stat(r)}catch(t){if(P(t))return{success:!1,message:`Marketplace directory not found at ${r}`,pluginId:e,scope:a};throw t}u=K(t.isDirectory()?r:le(r),n.source);try{await s.stat(u)}catch(t){if(P(t))return{success:!1,message:`Plugin source not found at ${u}`,pluginId:e,scope:a};throw t}let i,o=K(u,`.claude-plugin`,`plugin.json`);try{i=await x(o,n.name,n.source)}catch{}d=await f(e,n.source,i,u,n.version)}try{let r=v(e,d),s=b(e,d);if(i.version===d||i.installPath===r||i.installPath===s)return{success:!0,message:`${t} is already at the latest version (${d}).`,pluginId:e,newVersion:d,oldVersion:c,alreadyUpToDate:!0,scope:a};r=await A(u,e,d,n);let f=i.installPath;if(l(e,a,o,r,d,m),f&&f!==r){let e=S();Object.values(e.plugins).some(e=>e.some(e=>e.installPath===f))||await y(f)}let p=o?`${a} (${o})`:a;return{success:!0,message:`Plugin "${t}" updated from ${c||`unknown`} to ${d} for scope ${p}. Restart to apply changes.`,pluginId:e,newVersion:d,oldVersion:c,scope:a}}finally{p&&u!==v(e,d)&&await s.rm(u,{recursive:!0,force:!0})}}var Q,$,xe=e((()=>{oe(),M(),I(),F(),B(),j(),k(),i(),p(),m(),_(),ae(),ee(),C(),o(),W(),n(),R(),U(),Q=[`user`,`project`,`local`],$=[`user`,`project`,`local`,`managed`]}));export{_e as a,he as c,ge as d,ye as f,ve as i,ue as l,$ as n,Y as o,Z as r,xe as s,Q as t,de as u};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e,t}from"./pluginStartupCheck-CB2q2dLv.js";e();export{t as getPluginEditableScopes};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{Eo as t,Vo as n,dT as r,gT as i,hT as a,yo as o}from"./loadAgentsDir-C7lOqvfh.js";import{n as s}from"./cwd-Cfdf7z7s.js";import{a as c,l}from"./debug-RAynG_nM.js";import{c as u,g as d,vt as f}from"./settings-DnptdP79.js";import{o as p}from"./log-CezCRpAN.js";import"path";function m(){let e=new Map,t=a();for(let[n,r]of Object.entries(t))n.includes(`@`)&&(r===!0?e.set(n,`flag`):r===!1&&e.delete(n));for(let{scope:n,source:r}of[{scope:`managed`,source:`policySettings`},{scope:`user`,source:`userSettings`},{scope:`project`,source:`projectSettings`},{scope:`local`,source:`localSettings`},{scope:`flag`,source:`flagSettings`}]){let i=u(r);if(i?.enabledPlugins)for(let[a,o]of Object.entries(i.enabledPlugins))a.includes(`@`)&&(a in t&&t[a]!==o&&l(`Plugin ${a} from --add-dir (${t[a]}) overridden by ${r} (${o})`),o===!0?e.set(a,n):o===!1&&e.delete(a))}return l(`Found ${e.size} enabled plugins with scopes: ${Array.from(e.entries()).map(([e,t])=>`${e}(${t})`).join(`, `)}`),e}var h=e((()=>{s(),c(),p(),d(),i(),t(),n(),r(),o(),f()}));export{h as n,m as t};
|