@readmagic/workmate 0.0.30 → 0.0.31
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-B03NZZuQ.js → AddWorkspaceDirectory-C07tZJZN.js} +1 -1
- package/dist/chunks/{AgentsMdExternalIncludesDialog-CIyefOzT.js → AgentsMdExternalIncludesDialog-6_bT7l-8.js} +1 -1
- package/dist/chunks/AgentsMdExternalIncludesDialog-BbSA-E68.js +1 -0
- package/dist/chunks/{App-WBysAL0_.js → App--Nvun0sE.js} +1 -1
- package/dist/chunks/{BackgroundTasksDialog-CvvrjBoq.js → BackgroundTasksDialog-DTWNv4Gc.js} +1 -1
- package/dist/chunks/{BypassPermissionsModeDialog-DdVbMyla.js → BypassPermissionsModeDialog-CJ6U9Vb2.js} +1 -1
- package/dist/chunks/{CustomSelect-iSG1rbWU.js → CustomSelect-uOjgHk8D.js} +1 -1
- package/dist/chunks/{DiffDialog-DSb46fzB.js → DiffDialog-CTFLCtYp.js} +1 -1
- package/dist/chunks/Doctor-Bd0k7Jo7.js +1 -0
- package/dist/chunks/{Doctor-dR71Dg_D.js → Doctor-CgZxiFf3.js} +1 -1
- package/dist/chunks/{ExitFlow-BiBi5Sqk.js → ExitFlow-DGqwlF8J.js} +1 -1
- package/dist/chunks/{InvalidConfigDialog-7MkDSXXj.js → InvalidConfigDialog-8ZJmSDBO.js} +1 -1
- package/dist/chunks/{InvalidSettingsDialog-D8Ves3Th.js → InvalidSettingsDialog-B7czkYPj.js} +1 -1
- package/dist/chunks/{KeybindingProviderSetup-DJSFdVYv.js → KeybindingProviderSetup-C8rq4fwQ.js} +1 -1
- package/dist/chunks/{MCPConnectionManager-BZxRMdGO.js → MCPConnectionManager-DbPzbRdc.js} +1 -1
- package/dist/chunks/{MCPToolListView-H_Kvvelz.js → MCPToolListView-BsO2uWCL.js} +1 -1
- package/dist/chunks/{McpParsingWarnings-D2xvaog9.js → McpParsingWarnings-BIpQ_Dle.js} +1 -1
- package/dist/chunks/{MessageSelector-DQgIgPij.js → MessageSelector-DuCpdn-Q.js} +1 -1
- package/dist/chunks/{Messages-DyQCr-od.js → Messages-SKlSLbVo.js} +1 -1
- package/dist/chunks/{Onboarding-DFufTPIY.js → Onboarding-CLEqdl35.js} +1 -1
- package/dist/chunks/{PromptInputFooterSuggestions-B9JRcHHE.js → PromptInputFooterSuggestions-cu1KF4_b.js} +1 -1
- package/dist/chunks/{PromptInputHelpMenu-DcGXK5lt.js → PromptInputHelpMenu-MH_gVGmN.js} +1 -1
- package/dist/chunks/{ProviderSetup-DJ_Z1BSe.js → ProviderSetup-zjQQUmDr.js} +1 -1
- package/dist/chunks/{QueryEngine-BQ5PSqKV.js → QueryEngine-Cb2ncWE6.js} +1 -1
- package/dist/chunks/REPL-CWbLkb3q.js +124 -0
- package/dist/chunks/REPL-D1bn80_0.js +1 -0
- package/dist/chunks/{ResumeConversation-exTLviBY.js → ResumeConversation-DRcIMHTE.js} +1 -1
- package/dist/chunks/SearchExtraToolsTool-B6Qlr08G.js +1 -0
- package/dist/chunks/{Settings-nM6-cXh0.js → Settings-B-EscJrZ.js} +2 -2
- package/dist/chunks/{Spinner-ChT4lOOg.js → Spinner-ByYcKk2V.js} +1 -1
- package/dist/chunks/{TextInput-CanSwT9J.js → TextInput-eYxBj_1-.js} +1 -1
- package/dist/chunks/{ThemePicker-CXzPiSy0.js → ThemePicker-BqeGU99Q.js} +1 -1
- package/dist/chunks/{TrustDialog-D0fJ-YIw.js → TrustDialog-DYZ0i7rH.js} +1 -1
- package/dist/chunks/{ValidationErrorsList-29bQ0l-Q.js → ValidationErrorsList-Cw-sjz1h.js} +1 -1
- package/dist/chunks/{_baseEach-DPcnudh_.js → _baseEach-BQ2jM5Sg.js} +1 -1
- package/dist/chunks/{add-dir-DbNz1SeY.js → add-dir-3q2C-Kfj.js} +1 -1
- package/dist/chunks/{agentDisplay-Bif3eE1e.js → agentDisplay-C18dbK7V.js} +1 -1
- package/dist/chunks/{agents-CbsNbPbp.js → agents--BKL-glS.js} +1 -1
- package/dist/chunks/{agents-yvC-VikU.js → agents-B_Ik_9lY.js} +1 -1
- package/dist/chunks/{allErrors-Bv1e8fra.js → allErrors-CJOE7EGx.js} +1 -1
- package/dist/chunks/{appleTerminalBackup-Ct9hf1QQ.js → appleTerminalBackup-j8nI5uNK.js} +1 -1
- package/dist/chunks/backgroundHousekeeping-COON_jRA.js +1 -0
- package/dist/chunks/{backgroundHousekeeping-C75FgxW1.js → backgroundHousekeeping-FPn2H48W.js} +1 -1
- package/dist/chunks/{banner-D5m9LUjl.js → banner-BsO6K4Ve.js} +1 -1
- package/dist/chunks/{branch-DOQ3yNds.js → branch-7SdIl7ZG.js} +1 -1
- package/dist/chunks/{btw-DUjuwyMH.js → btw-BhVWw00h.js} +1 -1
- package/dist/chunks/{caches-BKAPMXp9.js → caches-DaOhyHsb.js} +1 -1
- package/dist/chunks/caches-DgNr-KX3.js +1 -0
- package/dist/chunks/{channel-C8JmEI06.js → channel-BNS35qVl.js} +1 -1
- package/dist/chunks/{channel-TEYwDITo.js → channel-DWDK9jut.js} +1 -1
- package/dist/chunks/{clear-BFlTcvMt.js → clear-B5WkPxlz.js} +1 -1
- package/dist/chunks/commands-DJe5bkNw.js +1 -0
- package/dist/chunks/{compact-CyR7Sbo1.js → compact-DriVPdmX.js} +1 -1
- package/dist/chunks/{config-Bjwat4P6.js → config-CMtnYZR9.js} +1 -1
- package/dist/chunks/config-CgzzjTUe.js +1 -0
- package/dist/chunks/config-FEF6EcWp.js +1 -0
- package/dist/chunks/{context-Cm_gyngQ.js → context-CXi66Ghx.js} +1 -1
- package/dist/chunks/{context-noninteractive-BDmFfPRt.js → context-noninteractive-BRoUkLxt.js} +1 -1
- package/dist/chunks/context-noninteractive-Bupgkyt9.js +1 -0
- package/dist/chunks/conversation-CCV0BYD_.js +1 -0
- package/dist/chunks/{conversation-CYZKYlWc.js → conversation-DrEE7olO.js} +1 -1
- package/dist/chunks/{conversationRecovery-BUqpxLl-.js → conversationRecovery-CZzxsT_R.js} +1 -1
- package/dist/chunks/{crossProjectResume-BCa2l0KZ.js → crossProjectResume-CbXDWdHE.js} +1 -1
- package/dist/chunks/{diff-BEvpLh_b.js → diff-CH8kHqwX.js} +1 -1
- package/dist/chunks/doctor-HV7-zZgq.js +1 -0
- package/dist/chunks/{entry-JGyBs1p5.js → entry-CyH0Rkjq.js} +1 -1
- package/dist/chunks/{exit-DU2KGyDk.js → exit-zYpIKg68.js} +1 -1
- package/dist/chunks/{extraUsage-cZx2XLx4.js → extraUsage-Dp_LtcKE.js} +1 -1
- package/dist/chunks/extractMemories-1_fkJtc-.js +1 -0
- package/dist/chunks/fast-Bi-RRDlf.js +1 -0
- package/dist/chunks/{fast-DUJq6-QE.js → fast-DnP_x58e.js} +1 -1
- package/dist/chunks/{fetchModelList-Dn8OahtV.js → fetchModelList-BctZn47N.js} +1 -1
- package/dist/chunks/fetchModelList-Dfyy0Yds.js +1 -0
- package/dist/chunks/{fileSuggestions-XLnnVLwx.js → fileSuggestions-CoYWpIJB.js} +1 -1
- package/dist/chunks/{gemini-qzPNGqOX.js → gemini-CyZAw1Wg.js} +1 -1
- package/dist/chunks/{generateSessionName-CA-cc58H.js → generateSessionName-CJ13ZLWG.js} +1 -1
- package/dist/chunks/{goal-x9Pkx5nv.js → goal-CiuF90SO.js} +1 -1
- package/dist/chunks/{grok-36CpLjsq.js → grok-B4R78Wy4.js} +1 -1
- package/dist/chunks/{help-DwfAEV0X.js → help-CQ8yZg8_.js} +1 -1
- package/dist/chunks/hooks-Cj3t3ItG.js +1 -0
- package/dist/chunks/{hooks-DBmA-DWx.js → hooks-DgsxCW0L.js} +1 -1
- package/dist/chunks/{install-DF4ep6nb.js → install-W_2JVR8Y.js} +1 -1
- package/dist/chunks/{instrumentation-BAbhrE3f.js → instrumentation-Yk5dlvD_.js} +3 -3
- package/dist/chunks/{job-CFWKIjNl.js → job-CAbdQPkT.js} +1 -1
- package/dist/chunks/{launchLocalMemory-Cf8l-1fz.js → launchLocalMemory-C-KuYLDQ.js} +1 -1
- package/dist/chunks/{launchOnboarding-8CDef-v1.js → launchOnboarding-2-AEYja0.js} +1 -1
- package/dist/chunks/{loadAgentsDir-DnHL_5cU.js → loadAgentsDir-CgDTTnMX.js} +468 -468
- package/dist/chunks/loadAgentsDir-jBY44wEO.js +1 -0
- package/dist/chunks/{loadPluginHooks-BuunKr9m.js → loadPluginHooks-CWkivYx4.js} +1 -1
- package/dist/chunks/localSearch-B3aRqi3q.js +1 -0
- package/dist/chunks/{localSearch-LFCzV7VE.js → localSearch-BhygSl0K.js} +1 -1
- package/dist/chunks/{logoUtils-B8MIA7c5.js → logoUtils-rZbHAggC.js} +1 -1
- package/dist/chunks/{magicDocs-BoxJusTI.js → magicDocs-430IH4o3.js} +1 -1
- package/dist/chunks/{main-B9ciFYnO.js → main-DuS6HbbE.js} +6 -6
- package/dist/chunks/managedEnv-BV6T_PdC.js +1 -0
- package/dist/chunks/{managedEnv-B0mj-wgE.js → managedEnv-O3Xqe_lk.js} +1 -1
- package/dist/chunks/{mcp-CHlAZvpV.js → mcp-BoJ9rdef.js} +1 -1
- package/dist/chunks/{mcp-DVKuOqvY.js → mcp-C2GF6Gp7.js} +1 -1
- package/dist/chunks/{mcp-B3Ewo-_h.js → mcp-XaHs-eh9.js} +1 -1
- package/dist/chunks/{memory-Cr0d-s7U.js → memory-D0vG6luI.js} +1 -1
- package/dist/chunks/{mode-DBNBDbVP.js → mode-4ZXGLC71.js} +1 -1
- package/dist/chunks/{model-C9ANf1-R.js → model-BidsdFhX.js} +1 -1
- package/dist/chunks/{model-B2r1Ms0g.js → model-CcgVXT3w.js} +1 -1
- package/dist/chunks/{modelOptions-B4BWYms0.js → modelOptions-Bw53Jebp.js} +1 -1
- package/dist/chunks/{nativeInstaller-BDJxBAPV.js → nativeInstaller-BczAzL96.js} +1 -1
- package/dist/chunks/{notifications-BV-VeXyJ.js → notifications-B3v1XAdd.js} +1 -1
- package/dist/chunks/{onChangeAppState-BGWWkhBg.js → onChangeAppState-wASLrUas.js} +1 -1
- package/dist/chunks/{openai-BL_IWBTr.js → openai-CvSNI6b2.js} +1 -1
- package/dist/chunks/{overlayContext-DGUFuee9.js → overlayContext-0wuZMXWl.js} +1 -1
- package/dist/chunks/{partition-B2VCm4vu.js → partition-CGKLltyv.js} +1 -1
- package/dist/chunks/{permissions-Bkj1UB1h.js → permissions-DawwDdur.js} +1 -1
- package/dist/chunks/{pidLock-CawSx6hb.js → pidLock-TOlSC34M.js} +2 -2
- package/dist/chunks/{plan-D7Ki5ADu.js → plan-D_vIEUQa.js} +1 -1
- package/dist/chunks/{plugin-D7I6VZjh.js → plugin-CDWB3AFL.js} +1 -1
- package/dist/chunks/{pluginAutoupdate-Cr3jw-ky.js → pluginAutoupdate-CPzXHVsX.js} +1 -1
- package/dist/chunks/{pluginBlocklist-JG_kJSSK.js → pluginBlocklist-Bu6GP9_C.js} +1 -1
- package/dist/chunks/{pluginCliCommands-BWIBBFJf.js → pluginCliCommands-CNpseXZD.js} +1 -1
- package/dist/chunks/{pluginFlagging-yFcXMVin.js → pluginFlagging-1MM3zuMP.js} +1 -1
- package/dist/chunks/{pluginOperations-6QXjdPOb.js → pluginOperations-qT-GGKNu.js} +1 -1
- package/dist/chunks/pluginStartupCheck-CCDpCchC.js +1 -0
- package/dist/chunks/{pluginStartupCheck-CkjyJ4RS.js → pluginStartupCheck-DXPIrR7f.js} +1 -1
- package/dist/chunks/{plugins-CMDfjFp-.js → plugins-Bbbvm9KH.js} +1 -1
- package/dist/chunks/{print-B6x_8O9w.js → print-Db7IDW_T.js} +2 -2
- package/dist/chunks/{processBashCommand-D0BBcBHY.js → processBashCommand-DtEP1Js2.js} +1 -1
- package/dist/chunks/{processSlashCommand-BvjNuNyP.js → processSlashCommand-BIIOr3n4.js} +1 -1
- package/dist/chunks/{projectOnboardingState-ofkjp9FJ.js → projectOnboardingState-DqGLXSM_.js} +1 -1
- package/dist/chunks/prompt-CCP82QoX.js +1 -0
- package/dist/chunks/{prompt-DDlkyIzV.js → prompt-CduUPV0s.js} +1 -1
- package/dist/chunks/prompt-DmWyLDH6.js +1 -0
- package/dist/chunks/{protocolHandler-Bjmx7OmF.js → protocolHandler-DrGjosKa.js} +1 -1
- package/dist/chunks/{reconciler-CHbint0C.js → reconciler-DQxjz0OK.js} +1 -1
- package/dist/chunks/{refresh-yut9uEfd.js → refresh-BmkkYKno.js} +1 -1
- package/dist/chunks/{reject-CrNfit3M.js → reject-DYsU8jkO.js} +1 -1
- package/dist/chunks/{reload-plugins-labKy5Eh.js → reload-plugins-CmHAxvlA.js} +1 -1
- package/dist/chunks/{rename-c8tElppw.js → rename-BrGuvkvC.js} +1 -1
- package/dist/chunks/{resume-C8xif2lo.js → resume-COSo0ATp.js} +1 -1
- package/dist/chunks/{runtimeObserver-vmPplAGH.js → runtimeObserver-CoNTwrJ3.js} +1 -1
- package/dist/chunks/{runtimeObserver-DuJ8mRfr.js → runtimeObserver-Dpi40Nfi.js} +2 -2
- package/dist/chunks/sandbox-adapter-D0bQ6nsv.js +1 -0
- package/dist/chunks/{sandbox-toggle-USHaZHD7.js → sandbox-toggle-CrjErH9V.js} +1 -1
- package/dist/chunks/searchExtraTools-_Fo0KDnz.js +1 -0
- package/dist/chunks/{select-BpiKdirZ.js → select-BNeFiLNP.js} +1 -1
- package/dist/chunks/sessionFileAccessHooks-BCBV26Ut.js +1 -0
- package/dist/chunks/{sessionObserver-sO6PF7mV.js → sessionObserver-CAvR0MCN.js} +1 -1
- package/dist/chunks/sessionObserver-QbHl_0Dr.js +1 -0
- package/dist/chunks/sessionStorage-CscAodvT.js +1 -0
- package/dist/chunks/{sessionTracing-Bz89tYh5.js → sessionTracing-rMBtalMz.js} +1 -1
- package/dist/chunks/{setup-B-FejaeH.js → setup-X5QOX_BW.js} +2 -2
- package/dist/chunks/{shadowedRuleDetection-BI6Xz0pY.js → shadowedRuleDetection-BucAPuXp.js} +1 -1
- package/dist/chunks/{sideQuestion-BEpCuv_7.js → sideQuestion-B1W_L7NR.js} +1 -1
- package/dist/chunks/{sinks-BvOPODnl.js → sinks-Bqzavjot.js} +1 -1
- package/dist/chunks/sinks-ofVW99nt.js +1 -0
- package/dist/chunks/{skillChangeDetector-D-fxaAMH.js → skillChangeDetector-jKxXTp4F.js} +1 -1
- package/dist/chunks/{skillGapStore-A1FCr8Mf.js → skillGapStore-CQVCxlWd.js} +2 -2
- package/dist/chunks/{skillLifecycle-CTVa34xO.js → skillLifecycle-GGpX7H8W.js} +2 -2
- package/dist/chunks/{skillSearchPanel-CjekGkrw.js → skillSearchPanel-DDM0zZ_r.js} +2 -2
- package/dist/chunks/{skills-110JHHbj.js → skills-Bmdrtecu.js} +1 -1
- package/dist/chunks/status-CFpCBQX1.js +1 -0
- package/dist/chunks/{statusNoticeHelpers-C5BRU3lw.js → statusNoticeHelpers-DRJcaVdx.js} +1 -1
- package/dist/chunks/switcher-BCr3vwnq.js +1 -0
- package/dist/chunks/{switcher-nLHGsxLw.js → switcher-CqGz0hjQ.js} +1 -1
- package/dist/chunks/{tasks-CjYr59Ak.js → tasks-CNQUkXoq.js} +1 -1
- package/dist/chunks/{templateJobs-ECX0rRRp.js → templateJobs-CYArZLti.js} +1 -1
- package/dist/chunks/{terminalSetup-AptBNs_i.js → terminalSetup-QvvwfSGV.js} +1 -1
- package/dist/chunks/{terminalSetup-CKO6eWhS.js → terminalSetup-h_TPZN2E.js} +1 -1
- package/dist/chunks/{theme-BCSx9irC.js → theme-DVkXXIPx.js} +1 -1
- package/dist/chunks/{tipRegistry-CnQB3TaA.js → tipRegistry-DzOyYhJT.js} +1 -1
- package/dist/chunks/{toolEventObserver-Bqtypnkk.js → toolEventObserver-BAkhiG0F.js} +1 -1
- package/dist/chunks/{toolPool-B1sXN7SK.js → toolPool-D_7Onp-c.js} +1 -1
- package/dist/chunks/{useExitOnCtrlCDWithKeybindings-DegJrysj.js → useExitOnCtrlCDWithKeybindings-z3RiW9jT.js} +1 -1
- package/dist/chunks/useMainLoopModel-DMB41HoQ.js +1 -0
- package/dist/chunks/{useManagePlugins-BW2Zj_jf.js → useManagePlugins-DSRLHKH5.js} +1 -1
- package/dist/chunks/{useMergedTools-CTm1AU9b.js → useMergedTools-C7wh5W03.js} +1 -1
- package/dist/chunks/{useSearchInput-DrY4BZKy.js → useSearchInput-r534PKo1.js} +1 -1
- package/dist/chunks/{useSettingsErrors-2uIAF6H8.js → useSettingsErrors-DL_ai-el.js} +1 -1
- package/dist/chunks/{util-BUgUtaUV.js → util-DombpJHQ.js} +1 -1
- package/dist/chunks/{validatePlugin-BGB8T9Mb.js → validatePlugin-DU3C7Mvb.js} +1 -1
- package/dist/chunks/vim-BX8ljWbJ.js +1 -0
- package/dist/chunks/worktree-CjnMMjR6.js +1 -0
- package/dist/cli.js +1 -1
- package/package.json +1 -1
- package/dist/chunks/AgentsMdExternalIncludesDialog-45Ize2zR.js +0 -1
- package/dist/chunks/Doctor--yF3SBsD.js +0 -1
- package/dist/chunks/REPL-CjoJCy0g.js +0 -124
- package/dist/chunks/REPL-DGieTVDl.js +0 -1
- package/dist/chunks/SearchExtraToolsTool-BBhWAuoA.js +0 -1
- package/dist/chunks/backgroundHousekeeping-d0qpqWHe.js +0 -1
- package/dist/chunks/caches-he4NeZSK.js +0 -1
- package/dist/chunks/commands-BoGtXPAA.js +0 -1
- package/dist/chunks/config-B-hDBSL8.js +0 -1
- package/dist/chunks/config-DubkVeOw.js +0 -1
- package/dist/chunks/context-noninteractive-CmOFpwwP.js +0 -1
- package/dist/chunks/conversation-B7YCvyCD.js +0 -1
- package/dist/chunks/doctor-DYKr9Reu.js +0 -1
- package/dist/chunks/extractMemories-4wbv-mTc.js +0 -1
- package/dist/chunks/fast-BALHWqpd.js +0 -1
- package/dist/chunks/fetchModelList-OZ2sLDEx.js +0 -1
- package/dist/chunks/hooks-BofA8GeO.js +0 -1
- package/dist/chunks/loadAgentsDir-C-qRJlXH.js +0 -1
- package/dist/chunks/localSearch-BulDBrBk.js +0 -1
- package/dist/chunks/managedEnv-BFpXdDI8.js +0 -1
- package/dist/chunks/pluginStartupCheck-B-nYb61N.js +0 -1
- package/dist/chunks/prompt-Cpu4meqR.js +0 -1
- package/dist/chunks/prompt-HO8Docca.js +0 -1
- package/dist/chunks/sandbox-adapter-BKnsdtVj.js +0 -1
- package/dist/chunks/searchExtraTools-DV5iZPdw.js +0 -1
- package/dist/chunks/sessionFileAccessHooks-nq8C34WL.js +0 -1
- package/dist/chunks/sessionObserver-CKp3uqPg.js +0 -1
- package/dist/chunks/sessionStorage-CuQf4d1y.js +0 -1
- package/dist/chunks/sinks-DLALCllz.js +0 -1
- package/dist/chunks/status-D_b3UMke.js +0 -1
- package/dist/chunks/switcher-BFzvv7KT.js +0 -1
- package/dist/chunks/useMainLoopModel-CPnigpM1.js +0 -1
- package/dist/chunks/vim-DdxGarvY.js +0 -1
- package/dist/chunks/worktree-DBZ7f9Lk.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{l as n,o as r}from"./envUtils-QyzA_cFM.js";import{n as i,t as a}from"./figures-5ThXQEtq.js";import{D as o,Gr as s,Gt as c,H as l,I as u,P as d,T as f,Wt as p,Xn as m,ai as h,hn as g,j as _,k as v,n as y,ot as b,r as x,t as S,x as ee,y as te}from"./src-BX54x08P.js";import{t as C}from"./jsx-runtime-Bb4Xn-E0.js";import{$n as w,Qn as ne,d as re,gt as T,m as E,s as D,y as O,yt as ie}from"./settings-CA-5Px85.js";import{$m as ae,Ao as k,Do as A,Dx as j,Eo as oe,Fo as M,Fx as N,Ha as P,Hh as F,Ia as se,Ja as ce,La as le,Mo as ue,Mx as de,Oo as fe,Po as pe,Px as I,Qd as me,Qm as he,Su as ge,To as _e,Tx as ve,Ua as ye,Vh as be,Wh as L,Za as R,Zm as xe,_d as Se,ah as Ce,bo as we,cx as Te,dx as Ee,eh as De,eo as z,fo as Oe,fx as ke,gd as B,go as V,ih as Ae,jx as je,ko as Me,lb as Ne,lo as Pe,nh as Fe,oo as Ie,po as Le,qa as Re,rb as ze,rh as Be,ro as Ve,tf as He,th as Ue,to as We,vf as Ge,vo as Ke,wo as qe,xo as Je,xu as Ye,xx as Xe,yf as Ze}from"./loadAgentsDir-DnHL_5cU.js";import{I as Qe,M as $e,S as et,V as tt,c as nt,i as rt,x as it}from"./debug-NBJH_NxR.js";import{d as at,g as ot}from"./config-Bjwat4P6.js";import{o as st,s as ct}from"./log-D98mO6yJ.js";import{n as lt}from"./analytics-COpjZpvd.js";import{S as ut,v as dt}from"./startupProfiler-C_xcIvEA.js";import{l as H,o as ft}from"./stringUtils-CtJhTszO.js";import{n as pt,t as mt}from"./pluginStartupCheck-CkjyJ4RS.js";import{a as ht,d as gt,f as _t,i as vt,l as yt,o as bt,s as xt,u as St}from"./pluginOperations-6QXjdPOb.js";import{a as Ct,c as wt,i as Tt,n as Et,o as Dt,s as Ot,t as kt}from"./validatePlugin-BGB8T9Mb.js";import{a as At,n as jt,o as Mt,r as Nt}from"./pluginFlagging-yFcXMVin.js";import{i as Pt,n as Ft}from"./MCPConnectionManager-BZxRMdGO.js";import{n as It,t as Lt}from"./useExitOnCtrlCDWithKeybindings-DegJrysj.js";import{n as Rt,t as zt}from"./TextInput-CanSwT9J.js";import{r as Bt,t as Vt}from"./Spinner-ChT4lOOg.js";import{t as Ht}from"./SearchBox-zA5QwIpO.js";import{n as Ut,t as Wt}from"./useSearchInput-DrY4BZKy.js";import{a as Gt,c as Kt,i as qt,n as Jt,o as Yt,r as Xt,s as Zt,t as Qt}from"./MCPToolListView-H_Kvvelz.js";import{i as $t,n as en}from"./pluginAutoupdate-Cr3jw-ky.js";import*as tn from"path";import*as nn from"fs/promises";function rn({inputValue:e,setInputValue:t,cursorOffset:n,setCursorOffset:r,error:i,setError:a,result:s,setResult:c,setViewState:l,onAddComplete:p,cliMode:m=!1}){let h=(0,an.useRef)(!1),[g,_]=(0,an.useState)(!1),[v,y]=(0,an.useState)(``),b=async()=>{let t=e.trim();if(!t){a(`Please enter a marketplace source`);return}let n=await Ct(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{_(!0),y(``);let{name:e,resolvedSource:t}=await Ie(n,e=>{y(e)});we(e,{source:t}),pe(),n.source,n.source===`github`&&n.repo,p&&await p(),y(``),_(!1),m?c(`Successfully added marketplace: ${e}`):l({type:`browse-marketplace`,targetMarketplace:e})}catch(e){let t=tt(e);ct(t),a(t.message),y(``),_(!1),c(m?`Error: ${t.message}`:null)}};return(0,an.useEffect)(()=>{e&&!h.current&&!i&&!s&&(h.current=!0,b())},[]),(0,U.jsxs)(u,{flexDirection:`column`,children:[(0,U.jsxs)(u,{flexDirection:`column`,paddingX:1,borderStyle:`round`,children:[(0,U.jsx)(u,{marginBottom:1,children:(0,U.jsx)(d,{bold:!0,children:`Add Marketplace`})}),(0,U.jsxs)(u,{flexDirection:`column`,children:[(0,U.jsx)(d,{children:`Enter marketplace source:`}),(0,U.jsx)(d,{dimColor:!0,children:`Examples:`}),(0,U.jsx)(d,{dimColor:!0,children:` · owner/repo (GitHub)`}),(0,U.jsx)(d,{dimColor:!0,children:` · git@github.com:owner/repo.git (SSH)`}),(0,U.jsx)(d,{dimColor:!0,children:` · https://example.com/marketplace.json`}),(0,U.jsx)(d,{dimColor:!0,children:` · ./path/to/marketplace`}),(0,U.jsx)(u,{marginTop:1,children:(0,U.jsx)(zt,{value:e,onChange:t,onSubmit:b,columns:80,cursorOffset:n,onChangeCursorOffset:r,focus:!0,showCursor:!0})})]}),g&&(0,U.jsxs)(u,{marginTop:1,children:[(0,U.jsx)(Vt,{}),(0,U.jsx)(d,{children:v||`Adding marketplace to configuration…`})]}),i&&(0,U.jsx)(u,{marginTop:1,children:(0,U.jsx)(d,{color:`error`,children:i})}),s&&(0,U.jsx)(u,{marginTop:1,children:(0,U.jsx)(d,{children:s})})]}),(0,U.jsx)(u,{marginLeft:3,children:(0,U.jsx)(d,{dimColor:!0,italic:!0,children:(0,U.jsxs)(f,{children:[(0,U.jsx)(o,{shortcut:`Enter`,action:`add`}),(0,U.jsx)(B,{action:`confirm:no`,context:`Settings`,fallback:`Esc`,description:`cancel`})]})})})]})}var an,U,on=e((()=>{an=t(h(),1),lt(),Se(),S(),Bt(),Rt(),Qe(),st(),M(),Oe(),Tt(),U=C()}));function sn(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 cn({title:e,subtitle:t,configSchema:n,initialValues:r,onSave:i,onCancel:o}){let l=Object.keys(n),f=(0,ln.useCallback)(e=>{if(n[e]?.sensitive===!0)return``;let t=r?.[e];return t===void 0?``:String(t)},[n,r]),[m,h]=(0,ln.useState)(0),[_,v]=(0,ln.useState)({}),[y,b]=(0,ln.useState)(()=>l[0]?f(l[0]):``),x=l[m],S=x?n[x]:null;if(p(`confirm:no`,o,{context:`Settings`}),c({"confirm:nextField":(0,ln.useCallback)(()=>{if(m<l.length-1&&x){v(e=>({...e,[x]:y})),h(e=>e+1);let e=l[m+1];b(e?f(e):``)}},[m,l,x,y,f]),"confirm:yes":(0,ln.useCallback)(()=>{if(!x)return;let e={..._,[x]:y};if(m===l.length-1)i(sn(l,e,n,r));else{v(e),h(e=>e+1);let t=l[m+1];b(t?f(t):``)}},[x,_,y,m,l,n,i,f,r])},{context:`Confirmation`}),g((e,t)=>{if(t.backspace||t.delete){b(e=>e.slice(0,-1));return}e&&!t.ctrl&&!t.meta&&!t.tab&&!t.return&&b(t=>t+e)}),!S||!x)return null;let ee=S.sensitive===!0,C=S.required===!0,w=ee?`*`.repeat(s(y)):y;return(0,un.jsxs)(te,{title:e,subtitle:t,onCancel:o,isCancelActive:!1,children:[(0,un.jsxs)(u,{flexDirection:`column`,children:[(0,un.jsxs)(d,{bold:!0,children:[S.title||x,C&&(0,un.jsx)(d,{color:`error`,children:` *`})]}),S.description&&(0,un.jsx)(d,{dimColor:!0,children:S.description}),(0,un.jsxs)(u,{marginTop:1,children:[(0,un.jsxs)(d,{children:[a.pointerSmall,` `]}),(0,un.jsx)(d,{children:w}),(0,un.jsx)(d,{children:`█`})]})]}),(0,un.jsxs)(u,{flexDirection:`column`,children:[(0,un.jsxs)(d,{dimColor:!0,children:[`Field `,m+1,` of `,l.length]}),m<l.length-1&&(0,un.jsx)(d,{dimColor:!0,children:`Tab: Next field · Enter: Save and continue`}),m===l.length-1&&(0,un.jsx)(d,{dimColor:!0,children:`Enter: Save configuration`})]})]})}var ln,un,dn=e((()=>{i(),ln=t(h(),1),S(),ze(),r(),un=C()}));async function fn(e){let{enabled:t,disabled:n}=await le();return[...t,...n].find(t=>t.repository===e||t.source===e)}function pn({plugin:e,pluginId:t,onDone:n}){let[r]=mn.useState(()=>{let n=[],r=xe(e);Object.keys(r).length>0&&n.push({key:`top-level`,title:`Configure ${e.name}`,subtitle:`Plugin options`,schema:r,load:()=>ae(t),save:n=>De(t,n,e.manifest.userConfig)});let i=Ge(e);for(let r of i)n.push({key:`channel:${r.server}`,title:`Configure ${r.displayName}`,subtitle:`Plugin: ${e.name}`,schema:r.configSchema,load:()=>Be(t,r.server)??void 0,save:e=>Ce(t,r.server,e,r.configSchema)});return n}),[i,a]=mn.useState(0),o=mn.useRef(n);if(o.current=n,mn.useEffect(()=>{r.length===0&&o.current(`skipped`)},[r.length]),r.length===0)return null;let s=r[i];function c(e){try{s.save(e)}catch(e){n(`error`,$e(e));return}let t=i+1;t<r.length?a(t):n(`configured`)}return(0,hn.jsx)(cn,{title:s.title,subtitle:s.subtitle,configSchema:s.schema,initialValues:s.load(),onSave:c,onCancel:()=>n(`skipped`)},s.key)}var mn,hn,gn=e((()=>{mn=t(h(),1),Qe(),Ue(),Ze(),se(),he(),dn(),hn=C()}));function _n(){let e=Me();return(0,vn.jsxs)(u,{marginBottom:1,children:[(0,vn.jsxs)(d,{color:`claude`,children:[a.warning,` `]}),(0,vn.jsxs)(d,{dimColor:!0,italic:!0,children:[`Make sure you trust a plugin before installing, updating, or using it. We do not control what MCP servers, files, or other software are included in plugins and cannot verify that they will work as intended or that they won't change. See each plugin's homepage for more information.`,e?` ${e}`:``]})]})}var vn,yn=e((()=>{i(),S(),k(),vn=C()}));function bn(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 xn(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 Sn({hasSelection:e}){return(0,Cn.jsx)(u,{marginTop:1,children:(0,Cn.jsx)(d,{dimColor:!0,italic:!0,children:(0,Cn.jsxs)(f,{children:[e&&(0,Cn.jsx)(B,{action:`plugin:install`,context:`Plugin`,fallback:`i`,description:`install`,bold:!0}),(0,Cn.jsx)(B,{action:`plugin:toggle`,context:`Plugin`,fallback:`Space`,description:`toggle`}),(0,Cn.jsx)(B,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`details`}),(0,Cn.jsx)(B,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]})})})}var Cn,wn=e((()=>{Se(),S(),Cn=C()}));function Tn({totalItems:e,maxVisible:t=Dn,selectedIndex:n=0}){let r=e>t,i=(0,En.useRef)(0),a=(0,En.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,En.useCallback)(e=>r?e.slice(o,s):e,[r,o,s]),l=(0,En.useCallback)(e=>o+e,[o]),u=(0,En.useCallback)(e=>e>=o&&e<s,[o,s]),d=(0,En.useCallback)(e=>{},[]),f=(0,En.useCallback)(()=>{},[]),p=(0,En.useCallback)(()=>{},[]),m=(0,En.useCallback)((t,n)=>{n(Math.max(0,Math.min(t,e-1)))},[e]),h=(0,En.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 En,Dn,On=e((()=>{En=t(h(),1),Dn=5}));function kn({error:e,setError:t,result:n,setResult:r,setViewState:i,onInstallComplete:o,targetMarketplace:s,targetPlugin:l}){let[m,h]=(0,W.useState)(`marketplace-list`),[g,_]=(0,W.useState)(null),[v,y]=(0,W.useState)(null),[b,x]=(0,W.useState)([]),[S,ee]=(0,W.useState)([]),[te,C]=(0,W.useState)(!0),[w,re]=(0,W.useState)(null),[T,E]=(0,W.useState)(0),[D,O]=(0,W.useState)(new Set),[ie,ae]=(0,W.useState)(new Set),k=Tn({totalItems:S.length,selectedIndex:T}),[j,M]=(0,W.useState)(0),[N,P]=(0,W.useState)(!1),[F,se]=(0,W.useState)(null),[le,de]=(0,W.useState)(null);p(`confirm:no`,An.useCallback(()=>{m===`plugin-list`?s?i({type:`manage-marketplaces`,targetMarketplace:s}):b.length===1?i({type:`menu`}):(h(`marketplace-list`),_(null),O(new Set)):m===`plugin-details`?(h(`plugin-list`),y(null)):i({type:`menu`})},[m,s,i,b.length]),{context:`Confirmation`}),(0,W.useEffect)(()=>{async function e(){try{let e=await Le(),{marketplaces:n,failures:r}=await ue(e),i=[];for(let{name:e,config:t,data:r}of n)if(r){let n=ne(r.plugins,t=>We(qe(t.name,e)));i.push({name:e,totalPlugins:r.plugins.length,installedCount:n,source:fe(t.source)})}i.sort((e,t)=>e.name===`claude-plugin-directory`?-1:+(t.name===`claude-plugin-directory`)),x(i);let a=A(r,ne(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&&!s&&!l){let e=i[0];e&&(_(e.name),h(`plugin-list`))}if(l){let n=null,r=null;for(let[t]of Object.entries(e)){let e=await Pe(t);if(e){let i=e.plugins.find(e=>e.name===l);if(i){let e=qe(i.name,t);n={entry:i,marketplaceName:t,pluginId:e,isInstalled:z(e)},r=t;break}}}if(n&&r){let e=n.pluginId;z(e)?t(`Plugin '${e}' is already installed globally. Use '/plugin' to manage existing plugins.`):(_(r),y(n),h(`plugin-details`))}else t(`Plugin "${l}" not found in any marketplace`)}else s&&(i.some(e=>e.name===s)?(_(s),h(`plugin-list`)):t(`Marketplace "${s}" not found`))}catch(e){t(e instanceof Error?e.message:`Failed to load marketplaces`)}finally{C(!1)}}e()},[t,s,l]),(0,W.useEffect)(()=>{if(!g)return;let e=!1;async function n(n){C(!0);try{let t=await Pe(n);if(e)return;if(!t)throw Error(`Failed to load marketplace: ${n}`);let r=[];for(let e of t.plugins){let t=qe(e.name,n);ce(t)||r.push({entry:e,marketplaceName:n,pluginId:t,isInstalled:z(t)})}try{let t=await Ot();if(e)return;re(t),t?r.sort((e,n)=>{let r=t.get(e.pluginId)??0,i=t.get(n.pluginId)??0;return r===i?e.entry.name.localeCompare(n.entry.name):i-r}):r.sort((e,t)=>e.entry.name.localeCompare(t.entry.name))}catch(t){if(e)return;nt(`Failed to fetch install counts: ${$e(t)}`),r.sort((e,t)=>e.entry.name.localeCompare(t.entry.name))}ee(r),E(0),O(new Set)}catch(n){if(e)return;t(n instanceof Error?n.message:`Failed to load plugins`)}finally{C(!1)}}return n(g),()=>{e=!0}},[g,t]);let I=async()=>{if(D.size===0)return;let e=S.filter(e=>D.has(e.pluginId));ae(new Set(e.map(e=>e.pluginId)));let n=0,a=0,s=[];for(let t of e){let e=await ye({pluginId:t.pluginId,entry:t.entry,marketplaceName:t.marketplaceName,scope:`user`});e.success?n++:(a++,s.push({name:t.entry.name,reason:e.error}))}ae(new Set),O(new Set),pe(),a===0?r(`✓ Installed ${n} ${H(n,`plugin`)}. Run /reload-plugins to activate.`):n===0?t(`Failed to install: ${oe(s,!0)}`):r(`✓ Installed ${n} of ${n+a} plugins. Failed: ${oe(s,!1)}. Run /reload-plugins to activate successfully installed plugins.`),n>0&&o&&await o(),i({type:`menu`})},me=async(e,t=`user`)=>{P(!0),se(null);let n=await ye({pluginId:e.pluginId,entry:e.entry,marketplaceName:e.marketplaceName,scope:t});if(n.success){let t=await fn(e.pluginId);if(t){P(!1),h({type:`plugin-options`,plugin:t,pluginId:e.pluginId});return}r(n.message),o&&await o(),i({type:`menu`})}else P(!1),se(n.error)};(0,W.useEffect)(()=>{e&&r(e)},[e,r]),c({"select:previous":()=>{T>0&&E(T-1)},"select:next":()=>{T<b.length-1&&E(T+1)},"select:accept":()=>{let e=b[T];e&&(_(e.name),h(`plugin-list`))}},{context:`Select`,isActive:m===`marketplace-list`}),c({"select:previous":()=>{T>0&&k.handleSelectionChange(T-1,E)},"select:next":()=>{T<S.length-1&&k.handleSelectionChange(T+1,E)},"select:accept":()=>{if(T===S.length&&D.size>0)I();else if(T<S.length){let e=S[T];e&&(e.isInstalled?i({type:`manage-plugins`,targetPlugin:e.entry.name,targetMarketplace:e.marketplaceName}):(y(e),h(`plugin-details`),M(0),se(null)))}}},{context:`Select`,isActive:m===`plugin-list`}),c({"plugin:toggle":()=>{if(T<S.length){let e=S[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&&I()}},{context:`Plugin`,isActive:m===`plugin-list`});let he=An.useMemo(()=>{if(!v)return[];let e=v.entry.homepage;return xn(e,bn(v))},[v]);if(c({"select:previous":()=>{j>0&&M(j-1)},"select:next":()=>{j<he.length-1&&M(j+1)},"select:accept":()=>{if(!v)return;let e=he[j]?.action,t=v.entry.homepage,n=bn(v);e===`install-user`?me(v,`user`):e===`install-project`?me(v,`project`):e===`install-local`?me(v,`local`):e===`homepage`&&t?ge(t):e===`github`&&n?ge(`https://github.com/${n}`):e===`back`&&(h(`plugin-list`),y(null))}},{context:`Select`,isActive:m===`plugin-details`&&!!v}),typeof m==`object`&&m.type===`plugin-options`){let{plugin:e,pluginId:t}=m;function n(e){r(e),o&&o(),i({type:`menu`})}return(0,G.jsx)(pn,{plugin:e,pluginId:t,onDone:(t,r)=>{switch(t){case`configured`:n(`✓ Installed and configured ${e.name}. Run /reload-plugins to apply.`);break;case`skipped`:n(`✓ Installed ${e.name}. Run /reload-plugins to apply.`);break;case`error`:n(`Installed but failed to save config: ${r}`);break}}})}if(te)return(0,G.jsx)(d,{children:`Loading…`});if(e)return(0,G.jsx)(d,{color:`error`,children:e});if(m===`marketplace-list`)return b.length===0?(0,G.jsxs)(u,{flexDirection:`column`,children:[(0,G.jsx)(u,{marginBottom:1,children:(0,G.jsx)(d,{bold:!0,children:`Select marketplace`})}),(0,G.jsx)(d,{children:`No marketplaces configured.`}),(0,G.jsxs)(d,{dimColor:!0,children:[`Add a marketplace first using `,`'Add marketplace'`,`.`]}),(0,G.jsx)(u,{marginTop:1,paddingLeft:1,children:(0,G.jsx)(d,{dimColor:!0,children:(0,G.jsx)(B,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`})})})]}):(0,G.jsxs)(u,{flexDirection:`column`,children:[(0,G.jsx)(u,{marginBottom:1,children:(0,G.jsx)(d,{bold:!0,children:`Select marketplace`})}),le&&(0,G.jsx)(u,{marginBottom:1,flexDirection:`column`,children:(0,G.jsxs)(d,{color:`warning`,children:[a.warning,` `,le]})}),b.map((e,t)=>(0,G.jsxs)(u,{flexDirection:`column`,marginBottom:+(t<b.length-1),children:[(0,G.jsx)(u,{children:(0,G.jsxs)(d,{color:T===t?`suggestion`:void 0,children:[T===t?a.pointer:` `,` `,e.name]})}),(0,G.jsx)(u,{marginLeft:2,children:(0,G.jsxs)(d,{dimColor:!0,children:[e.totalPlugins,` `,H(e.totalPlugins,`plugin`),` available`,e.installedCount>0&&` · ${e.installedCount} already installed`,e.source&&` · ${e.source}`]})})]},e.name)),(0,G.jsx)(u,{marginTop:1,children:(0,G.jsx)(d,{dimColor:!0,italic:!0,children:(0,G.jsxs)(f,{children:[(0,G.jsx)(B,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`select`}),(0,G.jsx)(B,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`})]})})})]});if(m===`plugin-details`&&v){let e=v.entry.homepage,t=xn(e,bn(v));return(0,G.jsxs)(u,{flexDirection:`column`,children:[(0,G.jsx)(u,{marginBottom:1,children:(0,G.jsx)(d,{bold:!0,children:`Plugin Details`})}),(0,G.jsxs)(u,{flexDirection:`column`,marginBottom:1,children:[(0,G.jsx)(d,{bold:!0,children:v.entry.name}),v.entry.version&&(0,G.jsxs)(d,{dimColor:!0,children:[`Version: `,v.entry.version]}),v.entry.description&&(0,G.jsx)(u,{marginTop:1,children:(0,G.jsx)(d,{children:v.entry.description})}),v.entry.author&&(0,G.jsx)(u,{marginTop:1,children:(0,G.jsxs)(d,{dimColor:!0,children:[`By:`,` `,typeof v.entry.author==`string`?v.entry.author:v.entry.author.name]})})]}),(0,G.jsxs)(u,{flexDirection:`column`,marginBottom:1,children:[(0,G.jsx)(d,{bold:!0,children:`Will install:`}),v.entry.commands&&(0,G.jsxs)(d,{dimColor:!0,children:[`· Commands:`,` `,Array.isArray(v.entry.commands)?v.entry.commands.join(`, `):Object.keys(v.entry.commands).join(`, `)]}),v.entry.agents&&(0,G.jsxs)(d,{dimColor:!0,children:[`· Agents:`,` `,Array.isArray(v.entry.agents)?v.entry.agents.join(`, `):Object.keys(v.entry.agents).join(`, `)]}),v.entry.hooks&&(0,G.jsxs)(d,{dimColor:!0,children:[`· Hooks: `,Object.keys(v.entry.hooks).join(`, `)]}),v.entry.mcpServers&&(0,G.jsxs)(d,{dimColor:!0,children:[`· MCP Servers:`,` `,Array.isArray(v.entry.mcpServers)?v.entry.mcpServers.join(`, `):typeof v.entry.mcpServers==`object`?Object.keys(v.entry.mcpServers).join(`, `):`configured`]}),!v.entry.commands&&!v.entry.agents&&!v.entry.hooks&&!v.entry.mcpServers&&(typeof v.entry.source==`object`&&`source`in v.entry.source&&(v.entry.source.source===`github`||v.entry.source.source===`url`||v.entry.source.source===`npm`||v.entry.source.source===`pip`)?(0,G.jsx)(d,{dimColor:!0,children:`· Component summary not available for remote plugin`}):(0,G.jsx)(d,{dimColor:!0,children:`· Components will be discovered at installation`}))]}),(0,G.jsx)(_n,{}),F&&(0,G.jsx)(u,{marginBottom:1,children:(0,G.jsxs)(d,{color:`error`,children:[`Error: `,F]})}),(0,G.jsx)(u,{flexDirection:`column`,children:t.map((e,t)=>(0,G.jsxs)(u,{children:[j===t&&(0,G.jsx)(d,{children:`> `}),j!==t&&(0,G.jsx)(d,{children:` `}),(0,G.jsx)(d,{bold:j===t,children:N&&e.action===`install`?`Installing…`:e.label})]},e.action))}),(0,G.jsx)(u,{marginTop:1,paddingLeft:1,children:(0,G.jsx)(d,{dimColor:!0,children:(0,G.jsxs)(f,{children:[(0,G.jsx)(B,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`select`}),(0,G.jsx)(B,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]})})})]})}if(S.length===0)return(0,G.jsxs)(u,{flexDirection:`column`,children:[(0,G.jsx)(u,{marginBottom:1,children:(0,G.jsx)(d,{bold:!0,children:`Install plugins`})}),(0,G.jsx)(d,{dimColor:!0,children:`No new plugins available to install.`}),(0,G.jsx)(d,{dimColor:!0,children:`All plugins from this marketplace are already installed.`}),(0,G.jsx)(u,{marginLeft:3,children:(0,G.jsx)(d,{dimColor:!0,italic:!0,children:(0,G.jsx)(B,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`})})})]});let _e=k.getVisibleItems(S);return(0,G.jsxs)(u,{flexDirection:`column`,children:[(0,G.jsx)(u,{marginBottom:1,children:(0,G.jsx)(d,{bold:!0,children:`Install Plugins`})}),k.scrollPosition.canScrollUp&&(0,G.jsx)(u,{children:(0,G.jsxs)(d,{dimColor:!0,children:[` `,a.arrowUp,` more above`]})}),_e.map((t,n)=>{let r=k.toActualIndex(n),i=T===r,o=D.has(t.pluginId),s=ie.has(t.pluginId);return(0,G.jsxs)(u,{flexDirection:`column`,marginBottom:n===_e.length-1&&!e?0:1,children:[(0,G.jsxs)(u,{children:[(0,G.jsxs)(d,{color:i?`suggestion`:void 0,children:[i?a.pointer:` `,` `]}),(0,G.jsxs)(d,{color:t.isInstalled?`success`:void 0,children:[t.isInstalled?a.tick:s?a.ellipsis:o?a.radioOn:a.radioOff,` `,t.entry.name,t.entry.category&&(0,G.jsxs)(d,{dimColor:!0,children:[` [`,t.entry.category,`]`]}),t.entry.tags?.includes(`community-managed`)&&(0,G.jsx)(d,{dimColor:!0,children:` [Community Managed]`}),t.isInstalled&&(0,G.jsx)(d,{dimColor:!0,children:` (installed)`}),w&&g===`claude-plugins-official`&&(0,G.jsxs)(d,{dimColor:!0,children:[` · `,Dt(w.get(t.pluginId)??0),` installs`]})]})]}),t.entry.description&&(0,G.jsxs)(u,{marginLeft:4,children:[(0,G.jsx)(d,{dimColor:!0,children:ut(t.entry.description,60)}),t.entry.version&&(0,G.jsxs)(d,{dimColor:!0,children:[` · v`,t.entry.version]})]})]},t.pluginId)}),k.scrollPosition.canScrollDown&&(0,G.jsx)(u,{children:(0,G.jsxs)(d,{dimColor:!0,children:[` `,a.arrowDown,` more below`]})}),e&&(0,G.jsx)(u,{marginTop:1,children:(0,G.jsxs)(d,{color:`error`,children:[a.cross,` `,e]})}),(0,G.jsx)(Sn,{hasSelection:D.size>0})]})}var An,W,G,jn=e((()=>{i(),An=t(h(),1),W=t(h(),1),Se(),S(),ze(),w(),Ye(),rt(),Qe(),M(),wt(),R(),k(),Oe(),Xe(),P(),Re(),ft(),dt(),gn(),yn(),wn(),On(),G=C()}));function Mn({error:e,setError:t,result:n,setResult:r,setViewState:i,onInstallComplete:o,onSearchModeChange:s,targetPlugin:l}){let[h,_]=(0,K.useState)(`plugin-list`),[y,x]=(0,K.useState)(null),[S,ee]=(0,K.useState)([]),[te,C]=(0,K.useState)(!0),[w,re]=(0,K.useState)(null),[T,E]=(0,K.useState)(!1),D=(0,K.useCallback)(e=>{E(e),s?.(e)},[s]),{query:O,setQuery:ie,cursorOffset:ae}=Ut({isActive:h===`plugin-list`&&T&&!te,onExit:()=>{D(!1)}}),k=m(),{columns:j}=b(),M=(0,K.useMemo)(()=>{if(!O)return S;let e=O.toLowerCase();return S.filter(t=>t.entry.name.toLowerCase().includes(e)||t.entry.description?.toLowerCase().includes(e)||t.marketplaceName.toLowerCase().includes(e))},[S,O]),[N,P]=(0,K.useState)(0),[F,se]=(0,K.useState)(new Set),[le,de]=(0,K.useState)(new Set),fe=Tn({totalItems:M.length,selectedIndex:N});(0,K.useEffect)(()=>{P(0)},[O]);let[I,me]=(0,K.useState)(0),[he,ve]=(0,K.useState)(!1),[be,L]=(0,K.useState)(null),[R,xe]=(0,K.useState)(null),[Se,Ce]=(0,K.useState)(null);(0,K.useEffect)(()=>{async function e(){try{let e=await Le(),{marketplaces:n,failures:r}=await ue(e),i=[];for(let{name:e,data:t}of n)if(t)for(let n of t.plugins){let t=qe(n.name,e);i.push({entry:n,marketplaceName:e,pluginId:t,isInstalled:z(t)})}let a=i.filter(e=>!e.isInstalled&&!ce(e.pluginId));try{let e=await Ot();re(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){nt(`Failed to fetch install counts: ${$e(e)}`),a.sort((e,t)=>e.entry.name.localeCompare(t.entry.name))}ee(a);let o=Object.keys(e).length;if(a.length===0){let e=await _e({configuredMarketplaceCount:o,failedMarketplaceCount:r.length});Ce(e)}let s=A(r,ne(n,e=>e.data!==null));if(s)if(s.type===`warning`)xe(`${s.message}. Showing available plugins.`);else throw Error(s.message);if(l){let e=i.find(e=>e.entry.name===l);e?e.isInstalled?t(`Plugin '${e.pluginId}' is already installed. Use '/plugin' to manage existing plugins.`):(x(e),_(`plugin-details`)):t(`Plugin "${l}" not found in any marketplace`)}}catch(e){t(e instanceof Error?e.message:`Failed to load plugins`)}finally{C(!1)}}e()},[t,l]);let we=async()=>{if(F.size===0)return;let e=S.filter(e=>F.has(e.pluginId));de(new Set(e.map(e=>e.pluginId)));let n=0,a=0,s=[];for(let t of e){let e=await ye({pluginId:t.pluginId,entry:t.entry,marketplaceName:t.marketplaceName,scope:`user`});e.success?n++:(a++,s.push({name:t.entry.name,reason:e.error}))}de(new Set),se(new Set),pe(),a===0?r(`✓ Installed ${n} ${H(n,`plugin`)}. Run /reload-plugins to activate.`):n===0?t(`Failed to install: ${oe(s,!0)}`):r(`✓ Installed ${n} of ${n+a} plugins. Failed: ${oe(s,!1)}. Run /reload-plugins to activate successfully installed plugins.`),n>0&&o&&await o(),i({type:`menu`})},Te=async(e,t=`user`)=>{ve(!0),L(null);let n=await ye({pluginId:e.pluginId,entry:e.entry,marketplaceName:e.marketplaceName,scope:t});if(n.success){let t=await fn(e.pluginId);if(t){ve(!1),_({type:`plugin-options`,plugin:t,pluginId:e.pluginId});return}r(n.message),o&&await o(),i({type:`menu`})}else ve(!1),L(n.error)};(0,K.useEffect)(()=>{e&&r(e)},[e,r]),p(`confirm:no`,()=>{_(`plugin-list`),x(null)},{context:`Confirmation`,isActive:h===`plugin-details`}),p(`confirm:no`,()=>{i({type:`menu`})},{context:`Confirmation`,isActive:h===`plugin-list`&&!T}),g((e,t)=>{let n=!t.ctrl&&!t.meta;T||(e===`/`&&n?(D(!0),ie(``)):n&&e.length>0&&!/^\s+$/.test(e)&&e!==`j`&&e!==`k`&&e!==`i`&&(D(!0),ie(e)))},{isActive:h===`plugin-list`&&!te}),c({"select:previous":()=>{N===0?D(!0):fe.handleSelectionChange(N-1,P)},"select:next":()=>{N<M.length-1&&fe.handleSelectionChange(N+1,P)},"select:accept":()=>{if(N===M.length&&F.size>0)we();else if(N<M.length){let e=M[N];e&&(e.isInstalled?i({type:`manage-plugins`,targetPlugin:e.entry.name,targetMarketplace:e.marketplaceName}):(x(e),_(`plugin-details`),me(0),L(null)))}}},{context:`Select`,isActive:h===`plugin-list`&&!T}),c({"plugin:toggle":()=>{if(N<M.length){let e=M[N];if(e&&!e.isInstalled){let t=new Set(F);t.has(e.pluginId)?t.delete(e.pluginId):t.add(e.pluginId),se(t)}}},"plugin:install":()=>{F.size>0&&we()}},{context:`Plugin`,isActive:h===`plugin-list`&&!T});let Ee=Fn.useMemo(()=>{if(!y)return[];let e=y.entry.homepage;return xn(e,bn(y))},[y]);if(c({"select:previous":()=>{I>0&&me(I-1)},"select:next":()=>{I<Ee.length-1&&me(I+1)},"select:accept":()=>{if(!y)return;let e=Ee[I]?.action,t=y.entry.homepage,n=bn(y);e===`install-user`?Te(y,`user`):e===`install-project`?Te(y,`project`):e===`install-local`?Te(y,`local`):e===`homepage`&&t?ge(t):e===`github`&&n?ge(`https://github.com/${n}`):e===`back`&&(_(`plugin-list`),x(null))}},{context:`Select`,isActive:h===`plugin-details`&&!!y}),typeof h==`object`&&h.type===`plugin-options`){let{plugin:e,pluginId:t}=h;function n(e){r(e),o&&o(),i({type:`menu`})}return(0,q.jsx)(pn,{plugin:e,pluginId:t,onDone:(t,r)=>{switch(t){case`configured`:n(`✓ Installed and configured ${e.name}. Run /reload-plugins to apply.`);break;case`skipped`:n(`✓ Installed ${e.name}. Run /reload-plugins to apply.`);break;case`error`:n(`Installed but failed to save config: ${r}`);break}}})}if(te)return(0,q.jsx)(d,{children:`Loading…`});if(e)return(0,q.jsx)(d,{color:`error`,children:e});if(h===`plugin-details`&&y){let e=y.entry.homepage,t=xn(e,bn(y));return(0,q.jsxs)(u,{flexDirection:`column`,children:[(0,q.jsx)(u,{marginBottom:1,children:(0,q.jsx)(d,{bold:!0,children:`Plugin details`})}),(0,q.jsxs)(u,{flexDirection:`column`,marginBottom:1,children:[(0,q.jsx)(d,{bold:!0,children:y.entry.name}),(0,q.jsxs)(d,{dimColor:!0,children:[`from `,y.marketplaceName]}),y.entry.version&&(0,q.jsxs)(d,{dimColor:!0,children:[`Version: `,y.entry.version]}),y.entry.description&&(0,q.jsx)(u,{marginTop:1,children:(0,q.jsx)(d,{children:y.entry.description})}),y.entry.author&&(0,q.jsx)(u,{marginTop:1,children:(0,q.jsxs)(d,{dimColor:!0,children:[`By:`,` `,typeof y.entry.author==`string`?y.entry.author:y.entry.author.name]})})]}),(0,q.jsx)(_n,{}),be&&(0,q.jsx)(u,{marginBottom:1,children:(0,q.jsxs)(d,{color:`error`,children:[`Error: `,be]})}),(0,q.jsx)(u,{flexDirection:`column`,children:t.map((e,t)=>(0,q.jsxs)(u,{children:[I===t&&(0,q.jsx)(d,{children:`> `}),I!==t&&(0,q.jsx)(d,{children:` `}),(0,q.jsx)(d,{bold:I===t,children:he&&e.action.startsWith(`install-`)?`Installing…`:e.label})]},e.action))}),(0,q.jsx)(u,{marginTop:1,children:(0,q.jsx)(d,{dimColor:!0,children:(0,q.jsxs)(f,{children:[(0,q.jsx)(B,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`select`}),(0,q.jsx)(B,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]})})})]})}if(S.length===0)return(0,q.jsxs)(u,{flexDirection:`column`,children:[(0,q.jsx)(u,{marginBottom:1,children:(0,q.jsx)(d,{bold:!0,children:`Discover plugins`})}),(0,q.jsx)(Pn,{reason:Se}),(0,q.jsx)(u,{marginTop:1,children:(0,q.jsx)(d,{dimColor:!0,italic:!0,children:`Esc to go back`})})]});let De=fe.getVisibleItems(M);return(0,q.jsxs)(u,{flexDirection:`column`,children:[(0,q.jsxs)(u,{children:[(0,q.jsx)(d,{bold:!0,children:`Discover plugins`}),fe.needsPagination&&(0,q.jsxs)(d,{dimColor:!0,children:[` `,`(`,fe.scrollPosition.current,`/`,fe.scrollPosition.total,`)`]})]}),(0,q.jsx)(u,{marginBottom:1,children:(0,q.jsx)(v,{query:O,isFocused:T,isTerminalFocused:k,width:j-4,cursorOffset:ae})}),R&&(0,q.jsx)(u,{marginBottom:1,children:(0,q.jsxs)(d,{color:`warning`,children:[a.warning,` `,R]})}),M.length===0&&O&&(0,q.jsx)(u,{marginBottom:1,children:(0,q.jsxs)(d,{dimColor:!0,children:[`No plugins match "`,O,`"`]})}),fe.scrollPosition.canScrollUp&&(0,q.jsx)(u,{children:(0,q.jsxs)(d,{dimColor:!0,children:[` `,a.arrowUp,` more above`]})}),De.map((t,n)=>{let r=fe.toActualIndex(n),i=N===r,o=F.has(t.pluginId),s=le.has(t.pluginId);return(0,q.jsxs)(u,{flexDirection:`column`,marginBottom:n===De.length-1&&!e?0:1,children:[(0,q.jsxs)(u,{children:[(0,q.jsxs)(d,{color:i&&!T?`suggestion`:void 0,children:[i&&!T?a.pointer:` `,` `]}),(0,q.jsxs)(d,{children:[s?a.ellipsis:o?a.radioOn:a.radioOff,` `,t.entry.name,(0,q.jsxs)(d,{dimColor:!0,children:[` · `,t.marketplaceName]}),t.entry.tags?.includes(`community-managed`)&&(0,q.jsx)(d,{dimColor:!0,children:` [Community Managed]`}),w&&t.marketplaceName===`claude-plugins-official`&&(0,q.jsxs)(d,{dimColor:!0,children:[` · `,Dt(w.get(t.pluginId)??0),` installs`]})]})]}),t.entry.description&&(0,q.jsx)(u,{marginLeft:4,children:(0,q.jsx)(d,{dimColor:!0,children:ut(t.entry.description,60)})})]},`${fe.startIndex}-${t.pluginId}`)}),fe.scrollPosition.canScrollDown&&(0,q.jsx)(u,{children:(0,q.jsxs)(d,{dimColor:!0,children:[` `,a.arrowDown,` more below`]})}),e&&(0,q.jsx)(u,{marginTop:1,children:(0,q.jsxs)(d,{color:`error`,children:[a.cross,` `,e]})}),(0,q.jsx)(Nn,{hasSelection:F.size>0,canToggle:N<M.length&&!M[N]?.isInstalled})]})}function Nn({hasSelection:e,canToggle:t}){return(0,q.jsx)(u,{marginTop:1,children:(0,q.jsx)(d,{dimColor:!0,italic:!0,children:(0,q.jsxs)(f,{children:[e&&(0,q.jsx)(B,{action:`plugin:install`,context:`Plugin`,fallback:`i`,description:`install`,bold:!0}),(0,q.jsx)(d,{children:`type to search`}),t&&(0,q.jsx)(B,{action:`plugin:toggle`,context:`Plugin`,fallback:`Space`,description:`toggle`}),(0,q.jsx)(B,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`details`}),(0,q.jsx)(B,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]})})})}function Pn({reason:e}){switch(e){case`git-not-installed`:return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(d,{dimColor:!0,children:`Git is required to install marketplaces.`}),(0,q.jsx)(d,{dimColor:!0,children:`Please install git and restart Work Mate.`})]});case`all-blocked-by-policy`:return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(d,{dimColor:!0,children:`Your organization policy does not allow any external marketplaces.`}),(0,q.jsx)(d,{dimColor:!0,children:`Contact your administrator.`})]});case`policy-restricts-sources`:return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(d,{dimColor:!0,children:`Your organization restricts which marketplaces can be added.`}),(0,q.jsx)(d,{dimColor:!0,children:`Switch to the Marketplaces tab to view allowed sources.`})]});case`all-marketplaces-failed`:return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(d,{dimColor:!0,children:`Failed to load marketplace data.`}),(0,q.jsx)(d,{dimColor:!0,children:`Check your network connection.`})]});case`all-plugins-installed`:return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(d,{dimColor:!0,children:`All available plugins are already installed.`}),(0,q.jsx)(d,{dimColor:!0,children:`Check for new plugins later or add more marketplaces.`})]});default:return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(d,{dimColor:!0,children:`No plugins available.`}),(0,q.jsx)(d,{dimColor:!0,children:`Add a marketplace first using the Marketplaces tab.`})]})}}var Fn,K,q,In=e((()=>{i(),Fn=t(h(),1),K=t(h(),1),Se(),Ht(),S(),Wt(),Ne(),ze(),w(),Ye(),rt(),Qe(),M(),wt(),R(),k(),Oe(),Xe(),P(),Re(),ft(),dt(),gn(),yn(),wn(),On(),q=C()}));function Ln({setViewState:e,error:t,setError:n,setResult:r,exitState:i,onManageComplete:o,targetMarketplace:s,action:l}){let[m,h]=(0,zn.useState)([]),[_,v]=(0,zn.useState)(!0),[y,b]=(0,zn.useState)(0),[x,S]=(0,zn.useState)(!1),[ee,te]=(0,zn.useState)(null),[C,w]=(0,zn.useState)(null),[re,T]=(0,zn.useState)(null),[E,ae]=(0,zn.useState)(`list`),[k,j]=(0,zn.useState)(null),[oe,M]=(0,zn.useState)(0),N=(0,zn.useRef)(!1);(0,zn.useEffect)(()=>{async function e(){try{let e=await Le(),{enabled:r,disabled:i}=await le(),a=[...r,...i],{marketplaces:o,failures:c}=await ue(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:fe(t.source),lastUpdated:t.lastUpdated,pluginCount:n?.plugins.length,installedPlugins:r,pendingUpdate:!1,pendingRemove:!1,autoUpdate:ie(e,t)})}u.sort((e,t)=>e.name===`claude-plugin-directory`?-1:t.name===`claude-plugin-directory`?1:e.name.localeCompare(t.name)),h(u);let d=A(c,ne(o,e=>e.data!==null));if(d)if(d.type===`warning`)te(d.message);else throw Error(d.message);if(s&&!N.current&&!t){N.current=!0;let e=u.findIndex(e=>e.name===s);if(e>=0){let t=u[e];if(l){b(e+1);let t=[...u];l===`update`?t[e].pendingUpdate=!0:l===`remove`&&(t[e].pendingRemove=!0),h(t),setTimeout(se,100,t)}else t&&(b(e+1),j(t),ae(`details`))}else n&&n(`Marketplace not found: ${s}`)}}catch(e){n&&n(e instanceof Error?e.message:`Failed to load marketplaces`),te(e instanceof Error?e.message:`Failed to load marketplaces`)}finally{v(!1)}}e()},[s,l,t]);let P=()=>m.some(e=>e.pendingUpdate||e.pendingRemove),F=()=>({updateCount:ne(m,e=>e.pendingUpdate),removeCount:ne(m,e=>e.pendingRemove)}),se=async t=>{let i=t||m,s=E===`details`;S(!0),te(null),w(null),T(null);try{let t=D(`userSettings`),n=0,c=0,l=new Set;for(let e of i){if(e.pendingRemove){if(e.installedPlugins&&e.installedPlugins.length>0){let n={...t?.enabledPlugins};for(let t of e.installedPlugins){let r=qe(t.name,e.name);n[r]=!1}O(`userSettings`,{enabledPlugins:n})}await Ke(e.name),c++,e.name,e.installedPlugins?.length;continue}e.pendingUpdate&&(await V(e.name,e=>{T(e)}),n++,l.add(e.name.toLowerCase()),e.name)}let u=0;l.size>0&&(u=(await $t(l)).length),pe(),o&&await o();let d=await Le(),{enabled:f,disabled:p}=await le(),m=[...f,...p],{marketplaces:g}=await ue(d),_=[];for(let{name:e,config:t,data:n}of g){let r=m.filter(t=>t.source.endsWith(`@${e}`));_.push({name:e,source:fe(t.source),lastUpdated:t.lastUpdated,pluginCount:n?.plugins.length,installedPlugins:r,pendingUpdate:!1,pendingRemove:!1,autoUpdate:ie(e,t)})}if(_.sort((e,t)=>e.name===`claude-plugin-directory`?-1:t.name===`claude-plugin-directory`?1:e.name.localeCompare(t.name)),h(_),s&&k){let e=_.find(e=>e.name===k.name);e&&j(e)}let v=[];if(n>0){let e=u>0?` (${u} ${H(u,`plugin`)} bumped)`:``;v.push(`Updated ${n} ${H(n,`marketplace`)}${e}`)}if(c>0&&v.push(`Removed ${c} ${H(c,`marketplace`)}`),v.length>0){let t=`${a.tick} ${v.join(`, `)}`;s?w(t):(r(t),setTimeout(e,2e3,{type:`menu`}))}else s||e({type:`menu`})}catch(e){let t=$e(e);te(t),n&&n(t)}finally{S(!1),T(null)}},ce=async()=>{if(!k)return;let e=m.map(e=>e.name===k.name?{...e,pendingRemove:!0}:e);h(e),await se(e)},de=e=>{if(!e)return[];let t=[{label:`Browse plugins (${e.pluginCount??0})`,value:`browse`},{label:`Update marketplace`,secondaryLabel:e.lastUpdated?`(last updated ${new Date(e.lastUpdated).toLocaleDateString()})`:void 0,value:`update`}];return ot()||t.push({label:e.autoUpdate?`Disable auto-update`:`Enable auto-update`,value:`toggle-auto-update`}),t.push({label:`Remove marketplace`,value:`remove`}),t},I=async e=>{let t=!e.autoUpdate;try{await Je(e.name,t),h(n=>n.map(n=>n.name===e.name?{...n,autoUpdate:t}:n)),j(e=>e&&{...e,autoUpdate:t})}catch(e){te(e instanceof Error?e.message:`Failed to update setting`)}};if(p(`confirm:no`,()=>{ae(`list`),M(0)},{context:`Confirmation`,isActive:!x&&(E===`details`||E===`confirm-remove`)}),p(`confirm:no`,()=>{h(e=>e.map(e=>({...e,pendingUpdate:!1,pendingRemove:!1}))),b(0)},{context:`Confirmation`,isActive:!x&&E===`list`&&P()}),p(`confirm:no`,()=>{e({type:`menu`})},{context:`Confirmation`,isActive:!x&&E===`list`&&!P()}),c({"select:previous":()=>b(e=>Math.max(0,e-1)),"select:next":()=>{let e=m.length+1;b(t=>Math.min(e-1,t+1))},"select:accept":()=>{let t=y-1;if(y===0)e({type:`add-marketplace`});else if(P())se();else{let e=m[t];e&&(j(e),ae(`details`),M(0))}}},{context:`Select`,isActive:!x&&E===`list`}),g(e=>{let t=y-1;if((e===`u`||e===`U`)&&t>=0)h(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=m[t];e&&(j(e),ae(`confirm-remove`))}},{isActive:!x&&E===`list`}),c({"select:previous":()=>M(e=>Math.max(0,e-1)),"select:next":()=>{let e=de(k);M(t=>Math.min(e.length-1,t+1))},"select:accept":()=>{if(!k)return;let t=de(k)[oe];if(t?.value===`browse`)e({type:`browse-marketplace`,targetMarketplace:k.name});else if(t?.value===`update`){let e=m.map(e=>e.name===k.name?{...e,pendingUpdate:!0}:e);h(e),se(e)}else t?.value===`toggle-auto-update`?I(k):t?.value===`remove`&&ae(`confirm-remove`)}},{context:`Select`,isActive:!x&&E===`details`}),g(e=>{e===`y`||e===`Y`?ce():(e===`n`||e===`N`)&&(ae(`list`),j(null))},{isActive:!x&&E===`confirm-remove`}),_)return(0,J.jsx)(d,{children:`Loading marketplaces…`});if(m.length===0)return(0,J.jsxs)(u,{flexDirection:`column`,children:[(0,J.jsx)(u,{marginBottom:1,children:(0,J.jsx)(d,{bold:!0,children:`Manage marketplaces`})}),(0,J.jsxs)(u,{flexDirection:`row`,gap:1,children:[(0,J.jsxs)(d,{color:`suggestion`,children:[a.pointer,` +`]}),(0,J.jsx)(d,{bold:!0,color:`suggestion`,children:`Add Marketplace`})]}),(0,J.jsx)(u,{marginLeft:3,children:(0,J.jsx)(d,{dimColor:!0,italic:!0,children:i.pending?(0,J.jsxs)(J.Fragment,{children:[`Press `,i.keyName,` again to go back`]}):(0,J.jsxs)(f,{children:[(0,J.jsx)(B,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`select`}),(0,J.jsx)(B,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`})]})})})]});if(E===`confirm-remove`&&k){let e=k.installedPlugins?.length||0;return(0,J.jsxs)(u,{flexDirection:`column`,children:[(0,J.jsxs)(d,{bold:!0,color:`warning`,children:[`Remove marketplace `,(0,J.jsx)(d,{italic:!0,children:k.name}),`?`]}),(0,J.jsxs)(u,{flexDirection:`column`,children:[e>0&&(0,J.jsx)(u,{marginTop:1,children:(0,J.jsxs)(d,{color:`warning`,children:[`This will also uninstall `,e,` `,H(e,`plugin`),` from this marketplace:`]})}),k.installedPlugins&&k.installedPlugins.length>0&&(0,J.jsx)(u,{flexDirection:`column`,marginTop:1,marginLeft:2,children:k.installedPlugins.map(e=>(0,J.jsxs)(d,{dimColor:!0,children:[`• `,e.name]},e.name))}),(0,J.jsx)(u,{marginTop:1,children:(0,J.jsxs)(d,{children:[`Press `,(0,J.jsx)(d,{bold:!0,children:`y`}),` to confirm or `,(0,J.jsx)(d,{bold:!0,children:`n`}),` to cancel`]})})]})]})}if(E===`details`&&k){let e=k.pendingUpdate||x,t=de(k);return(0,J.jsxs)(u,{flexDirection:`column`,children:[(0,J.jsx)(d,{bold:!0,children:k.name}),(0,J.jsx)(d,{dimColor:!0,children:k.source}),(0,J.jsx)(u,{marginTop:1,children:(0,J.jsxs)(d,{children:[k.pluginCount||0,` available `,H(k.pluginCount||0,`plugin`)]})}),k.installedPlugins&&k.installedPlugins.length>0&&(0,J.jsxs)(u,{flexDirection:`column`,marginTop:1,children:[(0,J.jsxs)(d,{bold:!0,children:[`Installed plugins (`,k.installedPlugins.length,`):`]}),(0,J.jsx)(u,{flexDirection:`column`,marginLeft:1,children:k.installedPlugins.map(e=>(0,J.jsxs)(u,{flexDirection:`row`,gap:1,children:[(0,J.jsx)(d,{children:a.bullet}),(0,J.jsxs)(u,{flexDirection:`column`,children:[(0,J.jsx)(d,{children:e.name}),(0,J.jsx)(d,{dimColor:!0,children:e.manifest.description})]})]},e.name))})]}),e&&(0,J.jsxs)(u,{marginTop:1,flexDirection:`column`,children:[(0,J.jsx)(d,{color:`claude`,children:`Updating marketplace…`}),re&&(0,J.jsx)(d,{dimColor:!0,children:re})]}),!e&&C&&(0,J.jsx)(u,{marginTop:1,children:(0,J.jsx)(d,{color:`claude`,children:C})}),!e&&ee&&(0,J.jsx)(u,{marginTop:1,children:(0,J.jsx)(d,{color:`error`,children:ee})}),!e&&(0,J.jsx)(u,{flexDirection:`column`,marginTop:1,children:t.map((e,t)=>{if(!e)return null;let n=t===oe;return(0,J.jsxs)(u,{children:[(0,J.jsxs)(d,{color:n?`suggestion`:void 0,children:[n?a.pointer:` `,` `,e.label]}),e.secondaryLabel&&(0,J.jsxs)(d,{dimColor:!0,children:[` `,e.secondaryLabel]})]},e.value)})}),!e&&!ot()&&k.autoUpdate&&(0,J.jsx)(u,{marginTop:1,children:(0,J.jsx)(d,{dimColor:!0,children:`Auto-update enabled. Work Mate will automatically update this marketplace and its installed plugins.`})}),(0,J.jsx)(u,{marginLeft:3,children:(0,J.jsx)(d,{dimColor:!0,italic:!0,children:e?(0,J.jsx)(J.Fragment,{children:`Please wait…`}):(0,J.jsxs)(f,{children:[(0,J.jsx)(B,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`select`}),(0,J.jsx)(B,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`})]})})})]})}let{updateCount:me,removeCount:he}=F();return(0,J.jsxs)(u,{flexDirection:`column`,children:[(0,J.jsx)(u,{marginBottom:1,children:(0,J.jsx)(d,{bold:!0,children:`Manage marketplaces`})}),(0,J.jsxs)(u,{flexDirection:`row`,gap:1,marginBottom:1,children:[(0,J.jsxs)(d,{color:y===0?`suggestion`:void 0,children:[y===0?a.pointer:` `,` +`]}),(0,J.jsx)(d,{bold:!0,color:y===0?`suggestion`:void 0,children:`Add Marketplace`})]}),(0,J.jsx)(u,{flexDirection:`column`,children:m.map((e,t)=>{let n=t+1===y,r=[];return e.pendingUpdate&&r.push(`UPDATE`),e.pendingRemove&&r.push(`REMOVE`),(0,J.jsxs)(u,{flexDirection:`row`,gap:1,marginBottom:1,children:[(0,J.jsxs)(d,{color:n?`suggestion`:void 0,children:[n?a.pointer:` `,` `,e.pendingRemove?a.cross:a.bullet]}),(0,J.jsxs)(u,{flexDirection:`column`,flexGrow:1,children:[(0,J.jsxs)(u,{flexDirection:`row`,gap:1,children:[(0,J.jsxs)(d,{bold:!0,strikethrough:e.pendingRemove,dimColor:e.pendingRemove,children:[e.name===`claude-plugins-official`&&(0,J.jsx)(d,{color:`claude`,children:`✻ `}),e.name,e.name===`claude-plugins-official`&&(0,J.jsx)(d,{color:`claude`,children:` ✻`})]}),r.length>0&&(0,J.jsxs)(d,{color:`warning`,children:[`[`,r.join(`, `),`]`]})]}),(0,J.jsx)(d,{dimColor:!0,children:e.source}),(0,J.jsxs)(d,{dimColor:!0,children:[e.pluginCount!==void 0&&(0,J.jsxs)(J.Fragment,{children:[e.pluginCount,` available`]}),e.installedPlugins&&e.installedPlugins.length>0&&(0,J.jsxs)(J.Fragment,{children:[` • `,e.installedPlugins.length,` installed`]}),e.lastUpdated&&(0,J.jsxs)(J.Fragment,{children:[` • Updated `,new Date(e.lastUpdated).toLocaleDateString()]})]})]})]},e.name)})}),P()&&(0,J.jsxs)(u,{marginTop:1,flexDirection:`column`,children:[(0,J.jsxs)(d,{children:[(0,J.jsx)(d,{bold:!0,children:`Pending changes:`}),` `,(0,J.jsx)(d,{dimColor:!0,children:`Enter to apply`})]}),me>0&&(0,J.jsxs)(d,{children:[`• Update `,me,` `,H(me,`marketplace`)]}),he>0&&(0,J.jsxs)(d,{color:`warning`,children:[`• Remove `,he,` `,H(he,`marketplace`)]})]}),x&&(0,J.jsx)(u,{marginTop:1,children:(0,J.jsx)(d,{color:`claude`,children:`Processing changes…`})}),ee&&(0,J.jsx)(u,{marginTop:1,children:(0,J.jsx)(d,{color:`error`,children:ee})}),(0,J.jsx)(Rn,{exitState:i,hasPendingActions:P()})]})}function Rn({exitState:e,hasPendingActions:t}){return e.pending?(0,J.jsx)(u,{marginTop:1,children:(0,J.jsxs)(d,{dimColor:!0,italic:!0,children:[`Press `,e.keyName,` again to go back`]})}):(0,J.jsx)(u,{marginTop:1,children:(0,J.jsx)(d,{dimColor:!0,italic:!0,children:(0,J.jsxs)(f,{children:[t&&(0,J.jsx)(B,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`apply changes`}),!t&&(0,J.jsx)(B,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`select`}),!t&&(0,J.jsx)(o,{shortcut:`u`,action:`update`}),!t&&(0,J.jsx)(o,{shortcut:`r`,action:`remove`}),(0,J.jsx)(B,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:t?`cancel`:`go back`})]})})})}var zn,J,Bn=e((()=>{i(),zn=t(h(),1),lt(),Se(),S(),ze(),w(),at(),Qe(),M(),k(),Oe(),en(),se(),T(),E(),ft(),J=C()}));function Vn(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 I(e)}function Hn(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 Un=e((()=>{N()}));function Wn({item:e,isSelected:t}){let[n]=l();if(e.type===`plugin`){let r,i;return e.pendingToggle?(r=_(`suggestion`,n)(a.arrowRight),i=e.pendingToggle===`will-enable`?`will enable`:`will disable`):e.errorCount>0?(r=_(`error`,n)(a.cross),i=`${e.errorCount} ${H(e.errorCount,`error`)}`):e.isEnabled?(r=_(`success`,n)(a.tick),i=`enabled`):(r=_(`inactive`,n)(a.radioOff),i=`disabled`),(0,Y.jsxs)(u,{children:[(0,Y.jsx)(d,{color:t?`suggestion`:void 0,children:t?`${a.pointer} `:` `}),(0,Y.jsx)(d,{color:t?`suggestion`:void 0,children:e.name}),(0,Y.jsxs)(d,{dimColor:!t,children:[` `,(0,Y.jsx)(d,{backgroundColor:`userMessageBackground`,children:`Plugin`})]}),(0,Y.jsxs)(d,{dimColor:!0,children:[` · `,e.marketplace]}),(0,Y.jsxs)(d,{dimColor:!t,children:[` · `,r,` `]}),(0,Y.jsx)(d,{dimColor:!t,children:i})]})}if(e.type===`flagged-plugin`){let r=_(`warning`,n)(a.warning);return(0,Y.jsxs)(u,{children:[(0,Y.jsx)(d,{color:t?`suggestion`:void 0,children:t?`${a.pointer} `:` `}),(0,Y.jsx)(d,{color:t?`suggestion`:void 0,children:e.name}),(0,Y.jsxs)(d,{dimColor:!t,children:[` `,(0,Y.jsx)(d,{backgroundColor:`userMessageBackground`,children:`Plugin`})]}),(0,Y.jsxs)(d,{dimColor:!0,children:[` · `,e.marketplace]}),(0,Y.jsxs)(d,{dimColor:!t,children:[` · `,r,` `]}),(0,Y.jsx)(d,{dimColor:!t,children:`removed`})]})}if(e.type===`failed-plugin`){let r=_(`error`,n)(a.cross),i=`failed to load · ${e.errorCount} ${H(e.errorCount,`error`)}`;return(0,Y.jsxs)(u,{children:[(0,Y.jsx)(d,{color:t?`suggestion`:void 0,children:t?`${a.pointer} `:` `}),(0,Y.jsx)(d,{color:t?`suggestion`:void 0,children:e.name}),(0,Y.jsxs)(d,{dimColor:!t,children:[` `,(0,Y.jsx)(d,{backgroundColor:`userMessageBackground`,children:`Plugin`})]}),(0,Y.jsxs)(d,{dimColor:!0,children:[` · `,e.marketplace]}),(0,Y.jsxs)(d,{dimColor:!t,children:[` · `,r,` `]}),(0,Y.jsx)(d,{dimColor:!t,children:i})]})}let r,i;return e.status===`connected`?(r=_(`success`,n)(a.tick),i=`connected`):e.status===`disabled`?(r=_(`inactive`,n)(a.radioOff),i=`disabled`):e.status===`pending`?(r=_(`inactive`,n)(a.radioOff),i=`connecting…`):e.status===`needs-auth`?(r=_(`warning`,n)(a.triangleUpOutline),i=`Enter to auth`):(r=_(`error`,n)(a.cross),i=`failed`),e.indented?(0,Y.jsxs)(u,{children:[(0,Y.jsx)(d,{color:t?`suggestion`:void 0,children:t?`${a.pointer} `:` `}),(0,Y.jsx)(d,{dimColor:!t,children:`└ `}),(0,Y.jsx)(d,{color:t?`suggestion`:void 0,children:e.name}),(0,Y.jsxs)(d,{dimColor:!t,children:[` `,(0,Y.jsx)(d,{backgroundColor:`userMessageBackground`,children:`MCP`})]}),(0,Y.jsxs)(d,{dimColor:!t,children:[` · `,r,` `]}),(0,Y.jsx)(d,{dimColor:!t,children:i})]}):(0,Y.jsxs)(u,{children:[(0,Y.jsx)(d,{color:t?`suggestion`:void 0,children:t?`${a.pointer} `:` `}),(0,Y.jsx)(d,{color:t?`suggestion`:void 0,children:e.name}),(0,Y.jsxs)(d,{dimColor:!t,children:[` `,(0,Y.jsx)(d,{backgroundColor:`userMessageBackground`,children:`MCP`})]}),(0,Y.jsxs)(d,{dimColor:!t,children:[` · `,r,` `]}),(0,Y.jsx)(d,{dimColor:!t,children:i})]})}var Y,Gn=e((()=>{i(),S(),ft(),Y=C()}));async function Kn(e){try{return(await nn.readdir(e,{withFileTypes:!0})).filter(e=>e.isFile()&&e.name.endsWith(`.md`)).map(e=>tn.basename(e.name,`.md`))}catch(t){return nt(`Failed to read plugin components from ${e}: ${$e(t)}`,{level:`error`}),ct(tt(t)),[]}}async function qn(e){try{let t=await nn.readdir(e,{withFileTypes:!0}),n=[];for(let r of t)if(r.isDirectory()||r.isSymbolicLink()){let t=tn.join(e,r.name,`SKILL.md`);try{(await nn.stat(t)).isFile()&&n.push(r.name)}catch{}}return n}catch(t){return nt(`Failed to read skill directories from ${e}: ${$e(t)}`,{level:`error`}),ct(tt(t)),[]}}function Jn({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=je(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 Pe(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 Kn(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 Kn(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 qn(e);c.push(...t)}let l=[];e.hooksConfig&&l.push(Object.keys(e.hooksConfig)),n.hooks&&l.push(n.hooks);let u=[];e.mcpServers&&u.push(Object.keys(e.mcpServers)),n.mcpServers&&u.push(n.mcpServers),r({commands:i.length>0?i:null,agents:o.length>0?o:null,skills:c.length>0?c:null,hooks:l.length>0?l:null,mcpServers:u.length>0?u:null})}else s(`Plugin ${e.name} not found in marketplace`)}catch(e){s(e instanceof Error?e.message:`Failed to load components`)}finally{a(!1)}}n()},[e.name,e.commandsPath,e.commandsPaths,e.agentsPath,e.agentsPaths,e.skillsPath,e.skillsPaths,e.hooksConfig,e.mcpServers,t]),i?null:o?(0,Z.jsxs)(u,{flexDirection:`column`,marginBottom:1,children:[(0,Z.jsx)(d,{bold:!0,children:`Components:`}),(0,Z.jsxs)(d,{dimColor:!0,children:[`Error: `,o]})]}):!n||!(n.commands||n.agents||n.skills||n.hooks||n.mcpServers)?null:(0,Z.jsxs)(u,{flexDirection:`column`,marginBottom:1,children:[(0,Z.jsx)(d,{bold:!0,children:`Installed components:`}),n.commands?(0,Z.jsxs)(d,{dimColor:!0,children:[`• Commands:`,` `,typeof n.commands==`string`?n.commands:Array.isArray(n.commands)?n.commands.join(`, `):Object.keys(n.commands).join(`, `)]}):null,n.agents?(0,Z.jsxs)(d,{dimColor:!0,children:[`• Agents:`,` `,typeof n.agents==`string`?n.agents:Array.isArray(n.agents)?n.agents.join(`, `):Object.keys(n.agents).join(`, `)]}):null,n.skills?(0,Z.jsxs)(d,{dimColor:!0,children:[`• Skills:`,` `,typeof n.skills==`string`?n.skills:Array.isArray(n.skills)?n.skills.join(`, `):Object.keys(n.skills).join(`, `)]}):null,n.hooks?(0,Z.jsxs)(d,{dimColor:!0,children:[`• Hooks:`,` `,typeof n.hooks==`string`?n.hooks:Array.isArray(n.hooks)?n.hooks.map(String).join(`, `):typeof n.hooks==`object`&&n.hooks!==null?Object.keys(n.hooks).join(`, `):String(n.hooks)]}):null,n.mcpServers?(0,Z.jsxs)(d,{dimColor:!0,children:[`• MCP Servers:`,` `,typeof n.mcpServers==`string`?n.mcpServers:Array.isArray(n.mcpServers)?n.mcpServers.map(String).join(`, `):typeof n.mcpServers==`object`&&n.mcpServers!==null?Object.keys(n.mcpServers).join(`, `):String(n.mcpServers)]}):null]})}async function Yn(e,t){let n=(await Pe(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 Xn(e){return e.filter(e=>{let t=e.source.split(`@`)[1]||`local`;return!ce(`${e.name}@${t}`)})}function Zn({setViewState:e,setResult:t,onManageComplete:n,onSearchModeChange:r,targetPlugin:i,targetMarketplace:o,action:s}){let l=F(e=>e.mcp.clients),h=F(e=>e.mcp.tools),_=F(e=>e.plugins.errors),y=jt(),[x,S]=(0,X.useState)(!1),ee=(0,X.useCallback)(e=>{S(e),r?.(e)},[r]),te=m(),{columns:C}=b(),[w,T]=(0,X.useState)(`plugin-list`),{query:E,setQuery:ie,cursorOffset:k}=Ut({isActive:w===`plugin-list`&&x,onExit:()=>{ee(!1)}}),[A,oe]=(0,X.useState)(null),[M,N]=(0,X.useState)([]),[P,se]=(0,X.useState)([]),[ce,ue]=(0,X.useState)(!0),[de,fe]=(0,X.useState)(new Map),I=(0,X.useRef)(!1),he=(0,X.useRef)(void 0),_e=Pt();p(`confirm:no`,Qn.useCallback(()=>{if(w===`plugin-details`)T(`plugin-list`),oe(null),V(null);else if(typeof w==`object`&&w.type===`failed-plugin-details`)T(`plugin-list`),V(null);else if(w===`configuring`)T(`plugin-details`),Me(null);else if(typeof w==`object`&&(w.type===`plugin-options`||w.type===`configuring-options`))T(`plugin-list`),oe(null),t(`Plugin enabled. Configuration skipped — run /reload-plugins to apply.`),n&&n();else if(typeof w==`object`&&w.type===`flagged-detail`)T(`plugin-list`),V(null);else if(typeof w==`object`&&w.type===`mcp-detail`)T(`plugin-list`),V(null);else if(typeof w==`object`&&w.type===`mcp-tools`)T({type:`mcp-detail`,client:w.client});else if(typeof w==`object`&&w.type===`mcp-tool-detail`)T({type:`mcp-tools`,client:w.client});else{if(de.size>0){t(`Run /reload-plugins to apply plugin changes.`);return}e({type:`menu`})}},[w,e,de,t]),{context:`Confirmation`,isActive:(w!==`plugin-list`||!x)&&w!==`confirm-project-uninstall`&&!(typeof w==`object`&&w.type===`confirm-data-cleanup`)});let ve=e=>e.type===`connected`?`connected`:e.type===`disabled`?`disabled`:e.type===`pending`?`pending`:e.type===`needs-auth`?`needs-auth`:`failed`,ye=(0,X.useMemo)(()=>{let e=re(),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 P){let i=`${r.plugin.name}@${r.marketplace}`,a=e?.enabledPlugins?.[i]!==!1,o=_.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:de.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 _){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=mt(),s=[];for(let[e,t]of a){if(e in y)continue;let n=j(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:ve(e),client:e}));let u={flagged:-1,project:0,local:1,user:2,enterprise:3,managed:4,dynamic:5,builtin:6},d=[],f=new Map;for(let{item:e,originalScope:t,childMcps:r}of n){let n=e.scope;f.has(n)||f.set(n,[]),f.get(n).push(e);for(let{displayName:e,client:n}of r){let r=t===`builtin`?`user`:t;f.has(r)||f.set(r,[]),f.get(r).push({type:`mcp`,id:`mcp:${n.name}`,name:e,description:void 0,scope:r,status:ve(n),client:n,indented:!0})}}for(let e of c){let t=e.scope;f.has(t)||f.set(t,[]),f.get(t).push(e)}for(let e of s){let t=e.scope;f.has(t)||f.set(t,[]),f.get(t).push(e)}for(let[e,t]of Object.entries(y)){let n=j(e),r=n.name||e,i=n.marketplace||`unknown`;f.has(`flagged`)||f.set(`flagged`,[]),f.get(`flagged`).push({type:`flagged-plugin`,id:e,name:r,marketplace:i,scope:`flagged`,reason:`delisted`,text:`Removed from marketplace`,flaggedAt:t.flaggedAt})}let p=[...f.keys()].sort((e,t)=>(u[e]??99)-(u[t]??99));for(let e of p){let t=f.get(e),n=[],r=[],i=0;for(;i<t.length;){let e=t[i];if(e.type===`plugin`||e.type===`failed-plugin`||e.type===`flagged-plugin`){let r=[e];i++;let a=t[i];for(;a?.type===`mcp`&&a.indented;)r.push(a),i++,a=t[i];n.push(r)}else e.type===`mcp`&&!e.indented&&r.push(e),i++}n.sort((e,t)=>e[0].name.localeCompare(t[0].name)),r.sort((e,t)=>e.name.localeCompare(t.name));for(let e of n)d.push(...e);d.push(...r)}return d},[P,l,_,de,y]),be=(0,X.useMemo)(()=>ye.filter(e=>e.type===`flagged-plugin`).map(e=>e.id),[ye]);(0,X.useEffect)(()=>{be.length>0&&At(be)},[be]);let L=(0,X.useMemo)(()=>{if(!E)return ye;let e=E.toLowerCase();return ye.filter(t=>t.name.toLowerCase().includes(e)||`description`in t&&t.description?.toLowerCase().includes(e))},[ye,E]),[R,xe]=(0,X.useState)(0),Se=Tn({totalItems:L.length,selectedIndex:R,maxVisible:8}),[Ce,we]=(0,X.useState)(0),[Ee,z]=(0,X.useState)(!1),[Oe,V]=(0,X.useState)(null),[je,Me]=(0,X.useState)(null),[Ne,Pe]=(0,X.useState)(!1),[Ie,Le]=(0,X.useState)(!1);(0,X.useEffect)(()=>{if(!A){Le(!1);return}async function e(){let e=A.plugin.manifest.mcpServers,t=!1;if(e&&(t=typeof e==`string`&&Fe(e)||Array.isArray(e)&&e.some(e=>typeof e==`string`&&Fe(e))),!t)try{let e=tn.join(A.plugin.path,`..`),n=tn.join(e,`.claude-plugin`,`marketplace.json`),r=et(await nn.readFile(n,`utf-8`)).plugins?.find(e=>e.name===A.plugin.name);if(r?.mcpServers){let e=r.mcpServers;t=typeof e==`string`&&Fe(e)||Array.isArray(e)&&e.some(e=>typeof e==`string`&&Fe(e))}}catch(e){nt(`Failed to read raw marketplace.json: ${e}`)}Le(t)}e()},[A]),(0,X.useEffect)(()=>{async function e(){ue(!0);try{let{enabled:e,disabled:t}=await le(),n=re(),r=Xn([...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=ne(t,t=>{let r=`${t.name}@${e}`;return n?.enabledPlugins?.[r]!==!1}),i=t.length-r;a.push({name:e,installedPlugins:t,enabledCount:r,disabledCount:i})}a.sort((e,t)=>e.name===`claude-plugin-directory`?-1:t.name===`claude-plugin-directory`?1:e.name.localeCompare(t.name)),N(a);let o=[];for(let e of a)for(let t of e.installedPlugins){let n=`${t.name}@${e.name}`,r=t.isBuiltin?`builtin`:bt(n).scope;o.push({plugin:t,marketplace:e.name,scope:r,pendingEnable:void 0,pendingUpdate:!1})}se(o),xe(0)}finally{ue(!1)}}e()},[]),(0,X.useEffect)(()=>{if(!I.current&&i&&M.length>0&&!ce){let{name:e,marketplace:n}=j(i),r=o??n,a=r?M.filter(e=>e.name===r):M;for(let t of a){let n=t.installedPlugins.find(t=>t.name===e);if(n){let{scope:e}=bt(`${n.name}@${t.name}`),r={plugin:n,marketplace:t.name,scope:e,pendingEnable:void 0,pendingUpdate:!1};oe(r),T(`plugin-details`),he.current=s,I.current=!0;return}}let c=ye.find(t=>t.type===`failed-plugin`&&t.name===e);c&&c.type===`failed-plugin`&&(T({type:`failed-plugin-details`,plugin:{id:c.id,name:c.name,marketplace:c.marketplace,errors:c.errors,scope:c.scope}}),I.current=!0),!I.current&&s&&(I.current=!0,t(`Plugin "${i}" is not installed in this project`))}},[i,o,M,ce,ye,s,t]);let Re=async r=>{if(!A)return;let i=A.scope||`user`,a=i===`builtin`;if(a&&(r===`update`||r===`uninstall`)){V(`Built-in plugins cannot be updated or uninstalled.`);return}if(!a&&!yt(i)&&r!==`update`){V(`This plugin is managed by your organization. Contact your admin to disable it.`);return}z(!0),V(null);try{let o=`${A.plugin.name}@${A.marketplace}`,s;switch(r){case`enable`:{let e=await ht(o);if(!e.success)throw Error(e.message);break}case`disable`:{let e=await vt(o);if(!e.success)throw Error(e.message);s=e.reverseDependents;break}case`uninstall`:{if(a||!yt(i))break;if(St(o)){z(!1),T(`confirm-project-uninstall`);return}let e=Ve().plugins[o],t=!e||e.length<=1?await Te(o):null;if(t){z(!1),T({type:`confirm-data-cleanup`,size:t});return}let n=await gt(o,i);if(!n.success)throw Error(n.message);s=n.reverseDependents;break}case`update`:{if(a)break;let r=await _t(o,i);if(!r.success)throw Error(r.message);if(r.alreadyUpToDate){t(`${A.plugin.name} is already at the latest version (${r.newVersion}).`),n&&await n(),e({type:`menu`});return}break}}pe();let c=`${A.plugin.name}@${A.marketplace}`;if(re()?.enabledPlugins?.[c]!==!1){z(!1),T({type:`plugin-options`});return}let l=r===`enable`?`Enabled`:r===`disable`?`Disabled`:r===`update`?`Updated`:`Uninstalled`,u=s&&s.length>0?` · required by ${s.join(`, `)}`:``;t(`✓ ${l} ${A.plugin.name}${u}. Run /reload-plugins to apply.`),n&&await n(),e({type:`menu`})}catch(e){z(!1);let t=e instanceof Error?e.message:String(e);V(`Failed to ${r}: ${t}`),ct(tt(e))}},ze=(0,X.useRef)(Re);ze.current=Re,(0,X.useEffect)(()=>{if(w===`plugin-details`&&A&&he.current){let e=he.current;he.current=void 0,ze.current(e)}},[w,A]);let Be=Qn.useCallback(()=>{if(R>=L.length)return;let e=L[R];if(e?.type!==`flagged-plugin`)if(e?.type===`plugin`){let t=`${e.plugin.name}@${e.marketplace}`,n=re(),r=de.get(t),i=n?.enabledPlugins?.[t]!==!1,a=e.scope;if(a===`builtin`||yt(a)){let e=new Map(de);r?(e.delete(t),(async()=>{try{r===`will-disable`?await ht(t):await vt(t),pe()}catch(e){ct(e)}})()):(e.set(t,i?`will-disable`:`will-enable`),(async()=>{try{i?await vt(t):await ht(t),pe()}catch(e){ct(e)}})()),fe(e)}}else e?.type===`mcp`&&_e(e.client.name)},[R,L,de,P,_e]);c({"select:previous":()=>{R===0?ee(!0):Se.handleSelectionChange(R-1,xe)},"select:next":()=>{R<L.length-1&&Se.handleSelectionChange(R+1,xe)},"select:accept":Qn.useCallback(()=>{if(R>=L.length)return;let e=L[R];if(e?.type===`plugin`){let t=P.find(t=>t.plugin.name===e.plugin.name&&t.marketplace===e.marketplace);t&&(oe(t),T(`plugin-details`),we(0),V(null))}else e?.type===`flagged-plugin`?(T({type:`flagged-detail`,plugin:{id:e.id,name:e.name,marketplace:e.marketplace,reason:e.reason,text:e.text,flaggedAt:e.flaggedAt}}),V(null)):e?.type===`failed-plugin`?(T({type:`failed-plugin-details`,plugin:{id:e.id,name:e.name,marketplace:e.marketplace,errors:e.errors,scope:e.scope}}),we(0),V(null)):e?.type===`mcp`&&(T({type:`mcp-detail`,client:e.client}),V(null))},[R,L,P])},{context:`Select`,isActive:w===`plugin-list`&&!x}),c({"plugin:toggle":Be},{context:`Plugin`,isActive:w===`plugin-list`&&!x}),c({"select:accept":Qn.useCallback(()=>{typeof w!=`object`||w.type!==`flagged-detail`||(Mt(w.plugin.id),T(`plugin-list`))},[w])},{context:`Select`,isActive:typeof w==`object`&&w.type===`flagged-detail`});let He=Qn.useMemo(()=>{if(w!==`plugin-details`||!A)return[];let e=re(),t=`${A.plugin.name}@${A.marketplace}`,n=e?.enabledPlugins?.[t]!==!1,r=A.marketplace===`builtin`,i=[];return i.push({label:n?`Disable plugin`:`Enable plugin`,action:()=>void Re(n?`disable`:`enable`)}),r||(i.push({label:A.pendingUpdate?`Unmark for update`:`Mark for update`,action:async()=>{try{let e=await Yn(A.plugin.name,A.marketplace);if(e){V(e);return}let t=[...P],n=t.findIndex(e=>e.plugin.name===A.plugin.name&&e.marketplace===A.marketplace);n!==-1&&(t[n].pendingUpdate=!A.pendingUpdate,se(t),oe({...A,pendingUpdate:!A.pendingUpdate}))}catch(e){V(e instanceof Error?e.message:`Failed to check plugin update availability`)}}}),Ie&&i.push({label:`Configure`,action:async()=>{Pe(!0);try{let e=A.plugin.manifest.mcpServers,t=null;if(typeof e==`string`&&Fe(e))t=e;else if(Array.isArray(e)){for(let n of e)if(typeof n==`string`&&Fe(n)){t=n;break}}if(!t){V(`No MCPB file found in plugin`),Pe(!1);return}let n=`${A.plugin.name}@${A.marketplace}`,r=await Ae(t,A.plugin.path,n,void 0,void 0,!0);`status`in r&&r.status===`needs-config`?(Me(r),T(`configuring`)):V(`Failed to load MCPB for configuration`)}catch(e){let t=$e(e);V(`Failed to load configuration: ${t}`)}finally{Pe(!1)}}}),A.plugin.manifest.userConfig&&Object.keys(A.plugin.manifest.userConfig).length>0&&i.push({label:`Configure options`,action:()=>{T({type:`configuring-options`,schema:A.plugin.manifest.userConfig})}}),i.push({label:`Update now`,action:()=>void Re(`update`)}),i.push({label:`Uninstall`,action:()=>void Re(`uninstall`)})),A.plugin.manifest.homepage&&i.push({label:`Open homepage`,action:()=>void ge(A.plugin.manifest.homepage)}),A.plugin.manifest.repository&&i.push({label:`View repository`,action:()=>void ge(A.plugin.manifest.repository)}),i.push({label:`Back to plugin list`,action:()=>{T(`plugin-list`),oe(null),V(null)}}),i},[w,A,Ie,P]);if(c({"select:previous":()=>{Ce>0&&we(Ce-1)},"select:next":()=>{Ce<He.length-1&&we(Ce+1)},"select:accept":()=>{He[Ce]&&He[Ce].action()}},{context:`Select`,isActive:w===`plugin-details`&&!!A}),c({"select:accept":()=>{typeof w==`object`&&w.type===`failed-plugin-details`&&(async()=>{z(!0),V(null);let e=w.plugin.id,t=w.plugin.scope,r=yt(t)?await gt(e,t,!1):await gt(e,`user`,!1),i=r.success;if(!i){for(let t of[`userSettings`,`projectSettings`,`localSettings`]){let n=D(t);n?.enabledPlugins?.[e]!==void 0&&(O(t,{enabledPlugins:{...n.enabledPlugins,[e]:void 0}}),i=!0)}pe()}i?(n&&await n(),z(!1),T(`plugin-list`)):(z(!1),V(r.message))})()}},{context:`Select`,isActive:typeof w==`object`&&w.type===`failed-plugin-details`&&w.plugin.scope!==`managed`}),c({"confirm:yes":()=>{if(!A)return;z(!0),V(null);let r=`${A.plugin.name}@${A.marketplace}`,{error:i}=O(`localSettings`,{enabledPlugins:{...D(`localSettings`)?.enabledPlugins,[r]:!1}});if(i){z(!1),V(`Failed to write settings: ${i.message}`);return}pe(),t(`✓ Disabled ${A.plugin.name} in .workmate/settings.local.json. Run /reload-plugins to apply.`),n&&n(),e({type:`menu`})},"confirm:no":()=>{T(`plugin-details`),V(null)}},{context:`Confirmation`,isActive:w===`confirm-project-uninstall`&&!!A&&!Ee}),g((r,i)=>{if(!A)return;let o=`${A.plugin.name}@${A.marketplace}`,s=A.scope;if(!s||s===`builtin`||!yt(s))return;let c=async r=>{z(!0),V(null);try{let i=await gt(o,s,r);if(!i.success)throw Error(i.message);pe();let c=r?``:` · data preserved`;t(`${a.tick} ${i.message}${c}`),n&&n(),e({type:`menu`})}catch(e){z(!1),V(e instanceof Error?e.message:String(e))}};r===`y`||r===`Y`?c(!0):r===`n`||r===`N`?c(!1):i.escape&&(T(`plugin-details`),V(null))},{isActive:typeof w==`object`&&w.type===`confirm-data-cleanup`&&!!A&&!Ee}),Qn.useEffect(()=>{xe(0)},[E]),g((e,t)=>{let n=!t.ctrl&&!t.meta;x||(e===`/`&&n?(ee(!0),ie(``),xe(0)):n&&e.length>0&&!/^\s+$/.test(e)&&e!==`j`&&e!==`k`&&e!==` `&&(ee(!0),ie(e),xe(0)))},{isActive:w===`plugin-list`}),ce)return(0,Z.jsx)(d,{children:`Loading installed plugins…`});if(ye.length===0)return(0,Z.jsxs)(u,{flexDirection:`column`,children:[(0,Z.jsx)(u,{marginBottom:1,children:(0,Z.jsx)(d,{bold:!0,children:`Manage plugins`})}),(0,Z.jsx)(d,{children:`No plugins or MCP servers installed.`}),(0,Z.jsx)(u,{marginTop:1,children:(0,Z.jsx)(d,{dimColor:!0,children:`Esc to go back`})})]});if(typeof w==`object`&&w.type===`plugin-options`&&A){let r=`${A.plugin.name}@${A.marketplace}`;function i(r){t(r),n&&n(),e({type:`menu`})}return(0,Z.jsx)(pn,{plugin:A.plugin,pluginId:r,onDone:(e,t)=>{switch(e){case`configured`:i(`✓ Enabled and configured ${A.plugin.name}. Run /reload-plugins to apply.`);break;case`skipped`:i(`✓ Enabled ${A.plugin.name}. Run /reload-plugins to apply.`);break;case`error`:i(`Failed to save configuration: ${t}`);break}}})}if(typeof w==`object`&&w.type===`configuring-options`&&A){let e=`${A.plugin.name}@${A.marketplace}`;return(0,Z.jsx)(cn,{title:`Configure ${A.plugin.name}`,subtitle:`Plugin options`,configSchema:w.schema,initialValues:ae(e),onSave:n=>{try{De(e,n,w.schema),pe(),t(`Configuration saved. Run /reload-plugins for changes to take effect.`)}catch(e){V(`Failed to save configuration: ${$e(e)}`)}T(`plugin-details`)},onCancel:()=>T(`plugin-details`)})}if(w===`configuring`&&je&&A){let e=`${A.plugin.name}@${A.marketplace}`;async function n(n){if(!(!je||!A))try{let r=A.plugin.manifest.mcpServers,i=null;if(typeof r==`string`&&Fe(r))i=r;else if(Array.isArray(r)){for(let e of r)if(typeof e==`string`&&Fe(e)){i=e;break}}if(!i){V(`No MCPB file found`),T(`plugin-details`);return}await Ae(i,A.plugin.path,e,void 0,n),V(null),Me(null),T(`plugin-details`),t(`Configuration saved. Run /reload-plugins for changes to take effect.`)}catch(e){let t=$e(e);V(`Failed to save configuration: ${t}`),T(`plugin-details`)}}function r(){Me(null),T(`plugin-details`)}return(0,Z.jsx)(cn,{title:`Configure ${je.manifest.name}`,subtitle:`Plugin: ${A.plugin.name}`,configSchema:je.configSchema,initialValues:je.existingConfig,onSave:n,onCancel:r})}if(typeof w==`object`&&w.type===`flagged-detail`){let e=w.plugin;return(0,Z.jsxs)(u,{flexDirection:`column`,children:[(0,Z.jsx)(u,{children:(0,Z.jsxs)(d,{bold:!0,children:[e.name,` @ `,e.marketplace]})}),(0,Z.jsxs)(u,{marginBottom:1,children:[(0,Z.jsx)(d,{dimColor:!0,children:`Status: `}),(0,Z.jsx)(d,{color:`error`,children:`Removed`})]}),(0,Z.jsxs)(u,{marginBottom:1,flexDirection:`column`,children:[(0,Z.jsxs)(d,{color:`error`,children:[`Removed from marketplace · reason: `,e.reason]}),(0,Z.jsx)(d,{children:e.text}),(0,Z.jsxs)(d,{dimColor:!0,children:[`Flagged on `,new Date(e.flaggedAt).toLocaleDateString()]})]}),(0,Z.jsx)(u,{marginTop:1,flexDirection:`column`,children:(0,Z.jsxs)(u,{children:[(0,Z.jsxs)(d,{children:[a.pointer,` `]}),(0,Z.jsx)(d,{color:`suggestion`,children:`Dismiss`})]})}),(0,Z.jsxs)(f,{children:[(0,Z.jsx)(B,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`dismiss`}),(0,Z.jsx)(B,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]})]})}if(w===`confirm-project-uninstall`&&A)return(0,Z.jsxs)(u,{flexDirection:`column`,children:[(0,Z.jsxs)(d,{bold:!0,color:`warning`,children:[A.plugin.name,` is enabled in .workmate/settings.json (shared with your team)`]}),(0,Z.jsxs)(u,{marginTop:1,flexDirection:`column`,children:[(0,Z.jsx)(d,{children:`Disable it just for you in .workmate/settings.local.json?`}),(0,Z.jsx)(d,{dimColor:!0,children:`This has the same effect as uninstalling, without affecting other contributors.`})]}),Oe&&(0,Z.jsx)(u,{marginTop:1,children:(0,Z.jsx)(d,{color:`error`,children:Oe})}),(0,Z.jsx)(u,{marginTop:1,children:Ee?(0,Z.jsx)(d,{dimColor:!0,children:`Disabling…`}):(0,Z.jsxs)(f,{children:[(0,Z.jsx)(B,{action:`confirm:yes`,context:`Confirmation`,fallback:`y`,description:`disable`}),(0,Z.jsx)(B,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})]})})]});if(typeof w==`object`&&w.type===`confirm-data-cleanup`&&A)return(0,Z.jsxs)(u,{flexDirection:`column`,children:[(0,Z.jsxs)(d,{bold:!0,children:[A.plugin.name,` has `,w.size.human,` of persistent data`]}),(0,Z.jsxs)(u,{marginTop:1,flexDirection:`column`,children:[(0,Z.jsx)(d,{children:`Delete it along with the plugin?`}),(0,Z.jsx)(d,{dimColor:!0,children:ke(`${A.plugin.name}@${A.marketplace}`)})]}),Oe&&(0,Z.jsx)(u,{marginTop:1,children:(0,Z.jsx)(d,{color:`error`,children:Oe})}),(0,Z.jsx)(u,{marginTop:1,children:Ee?(0,Z.jsx)(d,{dimColor:!0,children:`Uninstalling…`}):(0,Z.jsxs)(d,{children:[(0,Z.jsx)(d,{bold:!0,children:`y`}),` to delete · `,(0,Z.jsx)(d,{bold:!0,children:`n`}),` to keep · `,(0,Z.jsx)(d,{bold:!0,children:`esc`}),` to cancel`]})})]});if(w===`plugin-details`&&A){let e=re(),t=`${A.plugin.name}@${A.marketplace}`,n=e?.enabledPlugins?.[t]!==!1,r=_.filter(e=>`plugin`in e&&e.plugin===A.plugin.name||e.source===t||e.source.startsWith(`${A.plugin.name}@`)),i=r.length===0?null:(0,Z.jsxs)(u,{flexDirection:`column`,marginBottom:1,children:[(0,Z.jsxs)(d,{bold:!0,color:`error`,children:[r.length,` `,H(r.length,`error`),`:`]}),r.map((e,t)=>{let n=Hn(e);return(0,Z.jsxs)(u,{flexDirection:`column`,marginLeft:2,children:[(0,Z.jsx)(d,{color:`error`,children:Vn(e)}),n&&(0,Z.jsxs)(d,{dimColor:!0,italic:!0,children:[a.arrowRight,` `,n]})]},t)})]});return(0,Z.jsxs)(u,{flexDirection:`column`,children:[(0,Z.jsx)(u,{children:(0,Z.jsxs)(d,{bold:!0,children:[A.plugin.name,` @ `,A.marketplace]})}),(0,Z.jsxs)(u,{children:[(0,Z.jsx)(d,{dimColor:!0,children:`Scope: `}),(0,Z.jsx)(d,{children:A.scope||`user`})]}),A.plugin.manifest.version&&(0,Z.jsxs)(u,{children:[(0,Z.jsx)(d,{dimColor:!0,children:`Version: `}),(0,Z.jsx)(d,{children:A.plugin.manifest.version})]}),A.plugin.manifest.description&&(0,Z.jsx)(u,{marginBottom:1,children:(0,Z.jsx)(d,{children:A.plugin.manifest.description})}),A.plugin.manifest.author&&(0,Z.jsxs)(u,{children:[(0,Z.jsx)(d,{dimColor:!0,children:`Author: `}),(0,Z.jsx)(d,{children:A.plugin.manifest.author.name})]}),(0,Z.jsxs)(u,{marginBottom:1,children:[(0,Z.jsx)(d,{dimColor:!0,children:`Status: `}),(0,Z.jsx)(d,{color:n?`success`:`warning`,children:n?`Enabled`:`Disabled`}),A.pendingUpdate&&(0,Z.jsx)(d,{color:`suggestion`,children:` · Marked for update`})]}),(0,Z.jsx)(Jn,{plugin:A.plugin,marketplace:A.marketplace}),i,(0,Z.jsx)(u,{marginTop:1,flexDirection:`column`,children:He.map((e,t)=>{let n=t===Ce;return(0,Z.jsxs)(u,{children:[n&&(0,Z.jsxs)(d,{children:[a.pointer,` `]}),!n&&(0,Z.jsx)(d,{children:` `}),(0,Z.jsx)(d,{bold:n,color:e.label.includes(`Uninstall`)?`error`:e.label.includes(`Update`)?`suggestion`:void 0,children:e.label})]},t)})}),Ee&&(0,Z.jsx)(u,{marginTop:1,children:(0,Z.jsx)(d,{children:`Processing…`})}),Oe&&(0,Z.jsx)(u,{marginTop:1,children:(0,Z.jsx)(d,{color:`error`,children:Oe})}),(0,Z.jsx)(u,{marginTop:1,children:(0,Z.jsx)(d,{dimColor:!0,italic:!0,children:(0,Z.jsxs)(f,{children:[(0,Z.jsx)(B,{action:`select:previous`,context:`Select`,fallback:`↑`,description:`navigate`}),(0,Z.jsx)(B,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`select`}),(0,Z.jsx)(B,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]})})})]})}if(typeof w==`object`&&w.type===`failed-plugin-details`){let e=w.plugin,t=e.errors[0],n=t?Vn(t):`Failed to load`;return(0,Z.jsxs)(u,{flexDirection:`column`,children:[(0,Z.jsxs)(d,{children:[(0,Z.jsx)(d,{bold:!0,children:e.name}),(0,Z.jsxs)(d,{dimColor:!0,children:[` @ `,e.marketplace]}),(0,Z.jsxs)(d,{dimColor:!0,children:[` (`,e.scope,`)`]})]}),(0,Z.jsx)(d,{color:`error`,children:n}),e.scope===`managed`?(0,Z.jsx)(u,{marginTop:1,children:(0,Z.jsx)(d,{dimColor:!0,children:`Managed by your organization — contact your admin`})}):(0,Z.jsxs)(u,{marginTop:1,children:[(0,Z.jsxs)(d,{color:`suggestion`,children:[a.pointer,` `]}),(0,Z.jsx)(d,{bold:!0,children:`Remove`})]}),Ee&&(0,Z.jsx)(d,{children:`Processing…`}),Oe&&(0,Z.jsx)(d,{color:`error`,children:Oe}),(0,Z.jsx)(u,{marginTop:1,children:(0,Z.jsx)(d,{dimColor:!0,italic:!0,children:(0,Z.jsxs)(f,{children:[e.scope!==`managed`&&(0,Z.jsx)(B,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`remove`}),(0,Z.jsx)(B,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]})})})]})}if(typeof w==`object`&&w.type===`mcp-detail`){let e=w.client,n=me(h,e.name).length,r=()=>{T({type:`mcp-tools`,client:e})},i=()=>{T(`plugin-list`)},a=e=>{e&&t(e),T(`plugin-list`)},o=e.config.scope,s=e.config.type;return s===`stdio`?(0,Z.jsx)(Gt,{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)(Zt,{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)(Zt,{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)(Zt,{server:{name:e.name,client:e,scope:o,transport:`claudeai-proxy`,isAuthenticated:void 0,config:e.config},serverToolsCount:n,onViewTools:r,onCancel:i,onComplete:a,borderless:!0}):(T(`plugin-list`),null)}if(typeof w==`object`&&w.type===`mcp-tools`){let e=w.client,t=e.config.scope,n=e.config.type,r;return r=n===`stdio`?{name:e.name,client:e,scope:t,transport:`stdio`,config:e.config}:n===`sse`?{name:e.name,client:e,scope:t,transport:`sse`,isAuthenticated:void 0,config:e.config}:n===`http`?{name:e.name,client:e,scope:t,transport:`http`,isAuthenticated:void 0,config:e.config}:{name:e.name,client:e,scope:t,transport:`claudeai-proxy`,isAuthenticated:void 0,config:e.config},(0,Z.jsx)(Qt,{server:r,onSelectTool:t=>{T({type:`mcp-tool-detail`,client:e,tool:t})},onBack:()=>T({type:`mcp-detail`,client:e})})}if(typeof w==`object`&&w.type===`mcp-tool-detail`){let{client:e,tool:t}=w,n=e.config.scope,r=e.config.type,i;return i=r===`stdio`?{name:e.name,client:e,scope:n,transport:`stdio`,config:e.config}:r===`sse`?{name:e.name,client:e,scope:n,transport:`sse`,isAuthenticated:void 0,config:e.config}:r===`http`?{name:e.name,client:e,scope:n,transport:`http`,isAuthenticated:void 0,config:e.config}:{name:e.name,client:e,scope:n,transport:`claudeai-proxy`,isAuthenticated:void 0,config:e.config},(0,Z.jsx)(Xt,{tool:t,server:i,onBack:()=>T({type:`mcp-tools`,client:e})})}let Ue=Se.getVisibleItems(L);return(0,Z.jsxs)(u,{flexDirection:`column`,children:[(0,Z.jsx)(u,{marginBottom:1,children:(0,Z.jsx)(v,{query:E,isFocused:x,isTerminalFocused:te,width:C-4,cursorOffset:k})}),L.length===0&&E&&(0,Z.jsx)(u,{marginBottom:1,children:(0,Z.jsxs)(d,{dimColor:!0,children:[`No items match "`,E,`"`]})}),Se.scrollPosition.canScrollUp&&(0,Z.jsx)(u,{children:(0,Z.jsxs)(d,{dimColor:!0,children:[` `,a.arrowUp,` more above`]})}),Ue.map((e,t)=>{let n=Se.toActualIndex(t)===R&&!x,r=t>0?Ue[t-1]:null,i=!r||r.scope!==e.scope;return(0,Z.jsxs)(Qn.Fragment,{children:[i&&(0,Z.jsx)(u,{marginTop:+(t>0),paddingLeft:2,children:(0,Z.jsx)(d,{dimColor:e.scope!==`flagged`,color:e.scope===`flagged`?`warning`:void 0,bold:e.scope===`flagged`,children:(e=>{switch(e){case`flagged`:return`Flagged`;case`project`:return`Project`;case`local`:return`Local`;case`user`:return`User`;case`enterprise`:return`Enterprise`;case`managed`:return`Managed`;case`builtin`:return`Built-in`;case`dynamic`:return`Built-in`;default:return e}})(e.scope)})}),(0,Z.jsx)(Wn,{item:e,isSelected:n})]},e.id)}),Se.scrollPosition.canScrollDown&&(0,Z.jsx)(u,{children:(0,Z.jsxs)(d,{dimColor:!0,children:[` `,a.arrowDown,` more below`]})}),(0,Z.jsx)(u,{marginTop:1,marginLeft:1,children:(0,Z.jsx)(d,{dimColor:!0,italic:!0,children:(0,Z.jsxs)(f,{children:[(0,Z.jsx)(d,{children:`type to search`}),(0,Z.jsx)(B,{action:`plugin:toggle`,context:`Plugin`,fallback:`Space`,description:`toggle`}),(0,Z.jsx)(B,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`details`}),(0,Z.jsx)(B,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]})})}),de.size>0&&(0,Z.jsx)(u,{marginLeft:1,children:(0,Z.jsx)(d,{dimColor:!0,italic:!0,children:`Run /reload-plugins to apply changes`})})]})}var Qn,X,Z,$n=e((()=>{i(),Qn=t(h(),1),X=t(h(),1),Se(),S(),Kt(),Yt(),qt(),Jt(),Ht(),Wt(),Ne(),ze(),de(),Ft(),He(),xt(),be(),w(),Ye(),rt(),Qe(),st(),M(),R(),Oe(),Ue(),Ee(),Nt(),ve(),se(),he(),Re(),pt(),E(),it(),ft(),Un(),dn(),gn(),Gn(),On(),Z=C()}));function er(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 tr=e((()=>{}));function nr({onComplete:e,path:t}){return(0,rr.useEffect)(()=>{async function n(){if(!t){e(`Usage: /plugin validate <path>
|
|
1
|
+
import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{l as n,o as r}from"./envUtils-QyzA_cFM.js";import{n as i,t as a}from"./figures-5ThXQEtq.js";import{D as o,Gr as s,Gt as c,H as l,I as u,P as d,T as f,Wt as p,Xn as m,ai as h,hn as g,j as _,k as v,n as y,ot as b,r as x,t as S,x as ee,y as te}from"./src-BX54x08P.js";import{t as C}from"./jsx-runtime-Bb4Xn-E0.js";import{$n as w,Qn as ne,d as re,gt as T,m as E,s as D,y as O,yt as ie}from"./settings-CA-5Px85.js";import{$m as ae,Ao as k,Do as A,Dx as j,Eo as oe,Fo as M,Fx as N,Ha as P,Hh as F,Ia as se,Ja as ce,La as le,Mo as ue,Mx as de,Oo as fe,Po as pe,Px as I,Qd as me,Qm as he,Su as ge,To as _e,Tx as ve,Ua as ye,Vh as be,Wh as L,Za as R,Zm as xe,_d as Se,ah as Ce,bo as we,cx as Te,dx as Ee,eh as De,eo as z,fo as Oe,fx as ke,gd as B,go as V,ih as Ae,jx as je,ko as Me,lb as Ne,lo as Pe,nh as Fe,oo as Ie,po as Le,qa as Re,rb as ze,rh as Be,ro as Ve,tf as He,th as Ue,to as We,vf as Ge,vo as Ke,wo as qe,xo as Je,xu as Ye,xx as Xe,yf as Ze}from"./loadAgentsDir-CgDTTnMX.js";import{I as Qe,M as $e,S as et,V as tt,c as nt,i as rt,x as it}from"./debug-NBJH_NxR.js";import{d as at,g as ot}from"./config-CMtnYZR9.js";import{o as st,s as ct}from"./log-D98mO6yJ.js";import{n as lt}from"./analytics-COpjZpvd.js";import{S as ut,v as dt}from"./startupProfiler-C_xcIvEA.js";import{l as H,o as ft}from"./stringUtils-CtJhTszO.js";import{n as pt,t as mt}from"./pluginStartupCheck-DXPIrR7f.js";import{a as ht,d as gt,f as _t,i as vt,l as yt,o as bt,s as xt,u as St}from"./pluginOperations-qT-GGKNu.js";import{a as Ct,c as wt,i as Tt,n as Et,o as Dt,s as Ot,t as kt}from"./validatePlugin-DU3C7Mvb.js";import{a as At,n as jt,o as Mt,r as Nt}from"./pluginFlagging-1MM3zuMP.js";import{i as Pt,n as Ft}from"./MCPConnectionManager-DbPzbRdc.js";import{n as It,t as Lt}from"./useExitOnCtrlCDWithKeybindings-z3RiW9jT.js";import{n as Rt,t as zt}from"./TextInput-eYxBj_1-.js";import{r as Bt,t as Vt}from"./Spinner-ByYcKk2V.js";import{t as Ht}from"./SearchBox-zA5QwIpO.js";import{n as Ut,t as Wt}from"./useSearchInput-r534PKo1.js";import{a as Gt,c as Kt,i as qt,n as Jt,o as Yt,r as Xt,s as Zt,t as Qt}from"./MCPToolListView-BsO2uWCL.js";import{i as $t,n as en}from"./pluginAutoupdate-CPzXHVsX.js";import*as tn from"path";import*as nn from"fs/promises";function rn({inputValue:e,setInputValue:t,cursorOffset:n,setCursorOffset:r,error:i,setError:a,result:s,setResult:c,setViewState:l,onAddComplete:p,cliMode:m=!1}){let h=(0,an.useRef)(!1),[g,_]=(0,an.useState)(!1),[v,y]=(0,an.useState)(``),b=async()=>{let t=e.trim();if(!t){a(`Please enter a marketplace source`);return}let n=await Ct(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{_(!0),y(``);let{name:e,resolvedSource:t}=await Ie(n,e=>{y(e)});we(e,{source:t}),pe(),n.source,n.source===`github`&&n.repo,p&&await p(),y(``),_(!1),m?c(`Successfully added marketplace: ${e}`):l({type:`browse-marketplace`,targetMarketplace:e})}catch(e){let t=tt(e);ct(t),a(t.message),y(``),_(!1),c(m?`Error: ${t.message}`:null)}};return(0,an.useEffect)(()=>{e&&!h.current&&!i&&!s&&(h.current=!0,b())},[]),(0,U.jsxs)(u,{flexDirection:`column`,children:[(0,U.jsxs)(u,{flexDirection:`column`,paddingX:1,borderStyle:`round`,children:[(0,U.jsx)(u,{marginBottom:1,children:(0,U.jsx)(d,{bold:!0,children:`Add Marketplace`})}),(0,U.jsxs)(u,{flexDirection:`column`,children:[(0,U.jsx)(d,{children:`Enter marketplace source:`}),(0,U.jsx)(d,{dimColor:!0,children:`Examples:`}),(0,U.jsx)(d,{dimColor:!0,children:` · owner/repo (GitHub)`}),(0,U.jsx)(d,{dimColor:!0,children:` · git@github.com:owner/repo.git (SSH)`}),(0,U.jsx)(d,{dimColor:!0,children:` · https://example.com/marketplace.json`}),(0,U.jsx)(d,{dimColor:!0,children:` · ./path/to/marketplace`}),(0,U.jsx)(u,{marginTop:1,children:(0,U.jsx)(zt,{value:e,onChange:t,onSubmit:b,columns:80,cursorOffset:n,onChangeCursorOffset:r,focus:!0,showCursor:!0})})]}),g&&(0,U.jsxs)(u,{marginTop:1,children:[(0,U.jsx)(Vt,{}),(0,U.jsx)(d,{children:v||`Adding marketplace to configuration…`})]}),i&&(0,U.jsx)(u,{marginTop:1,children:(0,U.jsx)(d,{color:`error`,children:i})}),s&&(0,U.jsx)(u,{marginTop:1,children:(0,U.jsx)(d,{children:s})})]}),(0,U.jsx)(u,{marginLeft:3,children:(0,U.jsx)(d,{dimColor:!0,italic:!0,children:(0,U.jsxs)(f,{children:[(0,U.jsx)(o,{shortcut:`Enter`,action:`add`}),(0,U.jsx)(B,{action:`confirm:no`,context:`Settings`,fallback:`Esc`,description:`cancel`})]})})})]})}var an,U,on=e((()=>{an=t(h(),1),lt(),Se(),S(),Bt(),Rt(),Qe(),st(),M(),Oe(),Tt(),U=C()}));function sn(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 cn({title:e,subtitle:t,configSchema:n,initialValues:r,onSave:i,onCancel:o}){let l=Object.keys(n),f=(0,ln.useCallback)(e=>{if(n[e]?.sensitive===!0)return``;let t=r?.[e];return t===void 0?``:String(t)},[n,r]),[m,h]=(0,ln.useState)(0),[_,v]=(0,ln.useState)({}),[y,b]=(0,ln.useState)(()=>l[0]?f(l[0]):``),x=l[m],S=x?n[x]:null;if(p(`confirm:no`,o,{context:`Settings`}),c({"confirm:nextField":(0,ln.useCallback)(()=>{if(m<l.length-1&&x){v(e=>({...e,[x]:y})),h(e=>e+1);let e=l[m+1];b(e?f(e):``)}},[m,l,x,y,f]),"confirm:yes":(0,ln.useCallback)(()=>{if(!x)return;let e={..._,[x]:y};if(m===l.length-1)i(sn(l,e,n,r));else{v(e),h(e=>e+1);let t=l[m+1];b(t?f(t):``)}},[x,_,y,m,l,n,i,f,r])},{context:`Confirmation`}),g((e,t)=>{if(t.backspace||t.delete){b(e=>e.slice(0,-1));return}e&&!t.ctrl&&!t.meta&&!t.tab&&!t.return&&b(t=>t+e)}),!S||!x)return null;let ee=S.sensitive===!0,C=S.required===!0,w=ee?`*`.repeat(s(y)):y;return(0,un.jsxs)(te,{title:e,subtitle:t,onCancel:o,isCancelActive:!1,children:[(0,un.jsxs)(u,{flexDirection:`column`,children:[(0,un.jsxs)(d,{bold:!0,children:[S.title||x,C&&(0,un.jsx)(d,{color:`error`,children:` *`})]}),S.description&&(0,un.jsx)(d,{dimColor:!0,children:S.description}),(0,un.jsxs)(u,{marginTop:1,children:[(0,un.jsxs)(d,{children:[a.pointerSmall,` `]}),(0,un.jsx)(d,{children:w}),(0,un.jsx)(d,{children:`█`})]})]}),(0,un.jsxs)(u,{flexDirection:`column`,children:[(0,un.jsxs)(d,{dimColor:!0,children:[`Field `,m+1,` of `,l.length]}),m<l.length-1&&(0,un.jsx)(d,{dimColor:!0,children:`Tab: Next field · Enter: Save and continue`}),m===l.length-1&&(0,un.jsx)(d,{dimColor:!0,children:`Enter: Save configuration`})]})]})}var ln,un,dn=e((()=>{i(),ln=t(h(),1),S(),ze(),r(),un=C()}));async function fn(e){let{enabled:t,disabled:n}=await le();return[...t,...n].find(t=>t.repository===e||t.source===e)}function pn({plugin:e,pluginId:t,onDone:n}){let[r]=mn.useState(()=>{let n=[],r=xe(e);Object.keys(r).length>0&&n.push({key:`top-level`,title:`Configure ${e.name}`,subtitle:`Plugin options`,schema:r,load:()=>ae(t),save:n=>De(t,n,e.manifest.userConfig)});let i=Ge(e);for(let r of i)n.push({key:`channel:${r.server}`,title:`Configure ${r.displayName}`,subtitle:`Plugin: ${e.name}`,schema:r.configSchema,load:()=>Be(t,r.server)??void 0,save:e=>Ce(t,r.server,e,r.configSchema)});return n}),[i,a]=mn.useState(0),o=mn.useRef(n);if(o.current=n,mn.useEffect(()=>{r.length===0&&o.current(`skipped`)},[r.length]),r.length===0)return null;let s=r[i];function c(e){try{s.save(e)}catch(e){n(`error`,$e(e));return}let t=i+1;t<r.length?a(t):n(`configured`)}return(0,hn.jsx)(cn,{title:s.title,subtitle:s.subtitle,configSchema:s.schema,initialValues:s.load(),onSave:c,onCancel:()=>n(`skipped`)},s.key)}var mn,hn,gn=e((()=>{mn=t(h(),1),Qe(),Ue(),Ze(),se(),he(),dn(),hn=C()}));function _n(){let e=Me();return(0,vn.jsxs)(u,{marginBottom:1,children:[(0,vn.jsxs)(d,{color:`claude`,children:[a.warning,` `]}),(0,vn.jsxs)(d,{dimColor:!0,italic:!0,children:[`Make sure you trust a plugin before installing, updating, or using it. We do not control what MCP servers, files, or other software are included in plugins and cannot verify that they will work as intended or that they won't change. See each plugin's homepage for more information.`,e?` ${e}`:``]})]})}var vn,yn=e((()=>{i(),S(),k(),vn=C()}));function bn(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 xn(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 Sn({hasSelection:e}){return(0,Cn.jsx)(u,{marginTop:1,children:(0,Cn.jsx)(d,{dimColor:!0,italic:!0,children:(0,Cn.jsxs)(f,{children:[e&&(0,Cn.jsx)(B,{action:`plugin:install`,context:`Plugin`,fallback:`i`,description:`install`,bold:!0}),(0,Cn.jsx)(B,{action:`plugin:toggle`,context:`Plugin`,fallback:`Space`,description:`toggle`}),(0,Cn.jsx)(B,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`details`}),(0,Cn.jsx)(B,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]})})})}var Cn,wn=e((()=>{Se(),S(),Cn=C()}));function Tn({totalItems:e,maxVisible:t=Dn,selectedIndex:n=0}){let r=e>t,i=(0,En.useRef)(0),a=(0,En.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,En.useCallback)(e=>r?e.slice(o,s):e,[r,o,s]),l=(0,En.useCallback)(e=>o+e,[o]),u=(0,En.useCallback)(e=>e>=o&&e<s,[o,s]),d=(0,En.useCallback)(e=>{},[]),f=(0,En.useCallback)(()=>{},[]),p=(0,En.useCallback)(()=>{},[]),m=(0,En.useCallback)((t,n)=>{n(Math.max(0,Math.min(t,e-1)))},[e]),h=(0,En.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 En,Dn,On=e((()=>{En=t(h(),1),Dn=5}));function kn({error:e,setError:t,result:n,setResult:r,setViewState:i,onInstallComplete:o,targetMarketplace:s,targetPlugin:l}){let[m,h]=(0,W.useState)(`marketplace-list`),[g,_]=(0,W.useState)(null),[v,y]=(0,W.useState)(null),[b,x]=(0,W.useState)([]),[S,ee]=(0,W.useState)([]),[te,C]=(0,W.useState)(!0),[w,re]=(0,W.useState)(null),[T,E]=(0,W.useState)(0),[D,O]=(0,W.useState)(new Set),[ie,ae]=(0,W.useState)(new Set),k=Tn({totalItems:S.length,selectedIndex:T}),[j,M]=(0,W.useState)(0),[N,P]=(0,W.useState)(!1),[F,se]=(0,W.useState)(null),[le,de]=(0,W.useState)(null);p(`confirm:no`,An.useCallback(()=>{m===`plugin-list`?s?i({type:`manage-marketplaces`,targetMarketplace:s}):b.length===1?i({type:`menu`}):(h(`marketplace-list`),_(null),O(new Set)):m===`plugin-details`?(h(`plugin-list`),y(null)):i({type:`menu`})},[m,s,i,b.length]),{context:`Confirmation`}),(0,W.useEffect)(()=>{async function e(){try{let e=await Le(),{marketplaces:n,failures:r}=await ue(e),i=[];for(let{name:e,config:t,data:r}of n)if(r){let n=ne(r.plugins,t=>We(qe(t.name,e)));i.push({name:e,totalPlugins:r.plugins.length,installedCount:n,source:fe(t.source)})}i.sort((e,t)=>e.name===`claude-plugin-directory`?-1:+(t.name===`claude-plugin-directory`)),x(i);let a=A(r,ne(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&&!s&&!l){let e=i[0];e&&(_(e.name),h(`plugin-list`))}if(l){let n=null,r=null;for(let[t]of Object.entries(e)){let e=await Pe(t);if(e){let i=e.plugins.find(e=>e.name===l);if(i){let e=qe(i.name,t);n={entry:i,marketplaceName:t,pluginId:e,isInstalled:z(e)},r=t;break}}}if(n&&r){let e=n.pluginId;z(e)?t(`Plugin '${e}' is already installed globally. Use '/plugin' to manage existing plugins.`):(_(r),y(n),h(`plugin-details`))}else t(`Plugin "${l}" not found in any marketplace`)}else s&&(i.some(e=>e.name===s)?(_(s),h(`plugin-list`)):t(`Marketplace "${s}" not found`))}catch(e){t(e instanceof Error?e.message:`Failed to load marketplaces`)}finally{C(!1)}}e()},[t,s,l]),(0,W.useEffect)(()=>{if(!g)return;let e=!1;async function n(n){C(!0);try{let t=await Pe(n);if(e)return;if(!t)throw Error(`Failed to load marketplace: ${n}`);let r=[];for(let e of t.plugins){let t=qe(e.name,n);ce(t)||r.push({entry:e,marketplaceName:n,pluginId:t,isInstalled:z(t)})}try{let t=await Ot();if(e)return;re(t),t?r.sort((e,n)=>{let r=t.get(e.pluginId)??0,i=t.get(n.pluginId)??0;return r===i?e.entry.name.localeCompare(n.entry.name):i-r}):r.sort((e,t)=>e.entry.name.localeCompare(t.entry.name))}catch(t){if(e)return;nt(`Failed to fetch install counts: ${$e(t)}`),r.sort((e,t)=>e.entry.name.localeCompare(t.entry.name))}ee(r),E(0),O(new Set)}catch(n){if(e)return;t(n instanceof Error?n.message:`Failed to load plugins`)}finally{C(!1)}}return n(g),()=>{e=!0}},[g,t]);let I=async()=>{if(D.size===0)return;let e=S.filter(e=>D.has(e.pluginId));ae(new Set(e.map(e=>e.pluginId)));let n=0,a=0,s=[];for(let t of e){let e=await ye({pluginId:t.pluginId,entry:t.entry,marketplaceName:t.marketplaceName,scope:`user`});e.success?n++:(a++,s.push({name:t.entry.name,reason:e.error}))}ae(new Set),O(new Set),pe(),a===0?r(`✓ Installed ${n} ${H(n,`plugin`)}. Run /reload-plugins to activate.`):n===0?t(`Failed to install: ${oe(s,!0)}`):r(`✓ Installed ${n} of ${n+a} plugins. Failed: ${oe(s,!1)}. Run /reload-plugins to activate successfully installed plugins.`),n>0&&o&&await o(),i({type:`menu`})},me=async(e,t=`user`)=>{P(!0),se(null);let n=await ye({pluginId:e.pluginId,entry:e.entry,marketplaceName:e.marketplaceName,scope:t});if(n.success){let t=await fn(e.pluginId);if(t){P(!1),h({type:`plugin-options`,plugin:t,pluginId:e.pluginId});return}r(n.message),o&&await o(),i({type:`menu`})}else P(!1),se(n.error)};(0,W.useEffect)(()=>{e&&r(e)},[e,r]),c({"select:previous":()=>{T>0&&E(T-1)},"select:next":()=>{T<b.length-1&&E(T+1)},"select:accept":()=>{let e=b[T];e&&(_(e.name),h(`plugin-list`))}},{context:`Select`,isActive:m===`marketplace-list`}),c({"select:previous":()=>{T>0&&k.handleSelectionChange(T-1,E)},"select:next":()=>{T<S.length-1&&k.handleSelectionChange(T+1,E)},"select:accept":()=>{if(T===S.length&&D.size>0)I();else if(T<S.length){let e=S[T];e&&(e.isInstalled?i({type:`manage-plugins`,targetPlugin:e.entry.name,targetMarketplace:e.marketplaceName}):(y(e),h(`plugin-details`),M(0),se(null)))}}},{context:`Select`,isActive:m===`plugin-list`}),c({"plugin:toggle":()=>{if(T<S.length){let e=S[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&&I()}},{context:`Plugin`,isActive:m===`plugin-list`});let he=An.useMemo(()=>{if(!v)return[];let e=v.entry.homepage;return xn(e,bn(v))},[v]);if(c({"select:previous":()=>{j>0&&M(j-1)},"select:next":()=>{j<he.length-1&&M(j+1)},"select:accept":()=>{if(!v)return;let e=he[j]?.action,t=v.entry.homepage,n=bn(v);e===`install-user`?me(v,`user`):e===`install-project`?me(v,`project`):e===`install-local`?me(v,`local`):e===`homepage`&&t?ge(t):e===`github`&&n?ge(`https://github.com/${n}`):e===`back`&&(h(`plugin-list`),y(null))}},{context:`Select`,isActive:m===`plugin-details`&&!!v}),typeof m==`object`&&m.type===`plugin-options`){let{plugin:e,pluginId:t}=m;function n(e){r(e),o&&o(),i({type:`menu`})}return(0,G.jsx)(pn,{plugin:e,pluginId:t,onDone:(t,r)=>{switch(t){case`configured`:n(`✓ Installed and configured ${e.name}. Run /reload-plugins to apply.`);break;case`skipped`:n(`✓ Installed ${e.name}. Run /reload-plugins to apply.`);break;case`error`:n(`Installed but failed to save config: ${r}`);break}}})}if(te)return(0,G.jsx)(d,{children:`Loading…`});if(e)return(0,G.jsx)(d,{color:`error`,children:e});if(m===`marketplace-list`)return b.length===0?(0,G.jsxs)(u,{flexDirection:`column`,children:[(0,G.jsx)(u,{marginBottom:1,children:(0,G.jsx)(d,{bold:!0,children:`Select marketplace`})}),(0,G.jsx)(d,{children:`No marketplaces configured.`}),(0,G.jsxs)(d,{dimColor:!0,children:[`Add a marketplace first using `,`'Add marketplace'`,`.`]}),(0,G.jsx)(u,{marginTop:1,paddingLeft:1,children:(0,G.jsx)(d,{dimColor:!0,children:(0,G.jsx)(B,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`})})})]}):(0,G.jsxs)(u,{flexDirection:`column`,children:[(0,G.jsx)(u,{marginBottom:1,children:(0,G.jsx)(d,{bold:!0,children:`Select marketplace`})}),le&&(0,G.jsx)(u,{marginBottom:1,flexDirection:`column`,children:(0,G.jsxs)(d,{color:`warning`,children:[a.warning,` `,le]})}),b.map((e,t)=>(0,G.jsxs)(u,{flexDirection:`column`,marginBottom:+(t<b.length-1),children:[(0,G.jsx)(u,{children:(0,G.jsxs)(d,{color:T===t?`suggestion`:void 0,children:[T===t?a.pointer:` `,` `,e.name]})}),(0,G.jsx)(u,{marginLeft:2,children:(0,G.jsxs)(d,{dimColor:!0,children:[e.totalPlugins,` `,H(e.totalPlugins,`plugin`),` available`,e.installedCount>0&&` · ${e.installedCount} already installed`,e.source&&` · ${e.source}`]})})]},e.name)),(0,G.jsx)(u,{marginTop:1,children:(0,G.jsx)(d,{dimColor:!0,italic:!0,children:(0,G.jsxs)(f,{children:[(0,G.jsx)(B,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`select`}),(0,G.jsx)(B,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`})]})})})]});if(m===`plugin-details`&&v){let e=v.entry.homepage,t=xn(e,bn(v));return(0,G.jsxs)(u,{flexDirection:`column`,children:[(0,G.jsx)(u,{marginBottom:1,children:(0,G.jsx)(d,{bold:!0,children:`Plugin Details`})}),(0,G.jsxs)(u,{flexDirection:`column`,marginBottom:1,children:[(0,G.jsx)(d,{bold:!0,children:v.entry.name}),v.entry.version&&(0,G.jsxs)(d,{dimColor:!0,children:[`Version: `,v.entry.version]}),v.entry.description&&(0,G.jsx)(u,{marginTop:1,children:(0,G.jsx)(d,{children:v.entry.description})}),v.entry.author&&(0,G.jsx)(u,{marginTop:1,children:(0,G.jsxs)(d,{dimColor:!0,children:[`By:`,` `,typeof v.entry.author==`string`?v.entry.author:v.entry.author.name]})})]}),(0,G.jsxs)(u,{flexDirection:`column`,marginBottom:1,children:[(0,G.jsx)(d,{bold:!0,children:`Will install:`}),v.entry.commands&&(0,G.jsxs)(d,{dimColor:!0,children:[`· Commands:`,` `,Array.isArray(v.entry.commands)?v.entry.commands.join(`, `):Object.keys(v.entry.commands).join(`, `)]}),v.entry.agents&&(0,G.jsxs)(d,{dimColor:!0,children:[`· Agents:`,` `,Array.isArray(v.entry.agents)?v.entry.agents.join(`, `):Object.keys(v.entry.agents).join(`, `)]}),v.entry.hooks&&(0,G.jsxs)(d,{dimColor:!0,children:[`· Hooks: `,Object.keys(v.entry.hooks).join(`, `)]}),v.entry.mcpServers&&(0,G.jsxs)(d,{dimColor:!0,children:[`· MCP Servers:`,` `,Array.isArray(v.entry.mcpServers)?v.entry.mcpServers.join(`, `):typeof v.entry.mcpServers==`object`?Object.keys(v.entry.mcpServers).join(`, `):`configured`]}),!v.entry.commands&&!v.entry.agents&&!v.entry.hooks&&!v.entry.mcpServers&&(typeof v.entry.source==`object`&&`source`in v.entry.source&&(v.entry.source.source===`github`||v.entry.source.source===`url`||v.entry.source.source===`npm`||v.entry.source.source===`pip`)?(0,G.jsx)(d,{dimColor:!0,children:`· Component summary not available for remote plugin`}):(0,G.jsx)(d,{dimColor:!0,children:`· Components will be discovered at installation`}))]}),(0,G.jsx)(_n,{}),F&&(0,G.jsx)(u,{marginBottom:1,children:(0,G.jsxs)(d,{color:`error`,children:[`Error: `,F]})}),(0,G.jsx)(u,{flexDirection:`column`,children:t.map((e,t)=>(0,G.jsxs)(u,{children:[j===t&&(0,G.jsx)(d,{children:`> `}),j!==t&&(0,G.jsx)(d,{children:` `}),(0,G.jsx)(d,{bold:j===t,children:N&&e.action===`install`?`Installing…`:e.label})]},e.action))}),(0,G.jsx)(u,{marginTop:1,paddingLeft:1,children:(0,G.jsx)(d,{dimColor:!0,children:(0,G.jsxs)(f,{children:[(0,G.jsx)(B,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`select`}),(0,G.jsx)(B,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]})})})]})}if(S.length===0)return(0,G.jsxs)(u,{flexDirection:`column`,children:[(0,G.jsx)(u,{marginBottom:1,children:(0,G.jsx)(d,{bold:!0,children:`Install plugins`})}),(0,G.jsx)(d,{dimColor:!0,children:`No new plugins available to install.`}),(0,G.jsx)(d,{dimColor:!0,children:`All plugins from this marketplace are already installed.`}),(0,G.jsx)(u,{marginLeft:3,children:(0,G.jsx)(d,{dimColor:!0,italic:!0,children:(0,G.jsx)(B,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`})})})]});let _e=k.getVisibleItems(S);return(0,G.jsxs)(u,{flexDirection:`column`,children:[(0,G.jsx)(u,{marginBottom:1,children:(0,G.jsx)(d,{bold:!0,children:`Install Plugins`})}),k.scrollPosition.canScrollUp&&(0,G.jsx)(u,{children:(0,G.jsxs)(d,{dimColor:!0,children:[` `,a.arrowUp,` more above`]})}),_e.map((t,n)=>{let r=k.toActualIndex(n),i=T===r,o=D.has(t.pluginId),s=ie.has(t.pluginId);return(0,G.jsxs)(u,{flexDirection:`column`,marginBottom:n===_e.length-1&&!e?0:1,children:[(0,G.jsxs)(u,{children:[(0,G.jsxs)(d,{color:i?`suggestion`:void 0,children:[i?a.pointer:` `,` `]}),(0,G.jsxs)(d,{color:t.isInstalled?`success`:void 0,children:[t.isInstalled?a.tick:s?a.ellipsis:o?a.radioOn:a.radioOff,` `,t.entry.name,t.entry.category&&(0,G.jsxs)(d,{dimColor:!0,children:[` [`,t.entry.category,`]`]}),t.entry.tags?.includes(`community-managed`)&&(0,G.jsx)(d,{dimColor:!0,children:` [Community Managed]`}),t.isInstalled&&(0,G.jsx)(d,{dimColor:!0,children:` (installed)`}),w&&g===`claude-plugins-official`&&(0,G.jsxs)(d,{dimColor:!0,children:[` · `,Dt(w.get(t.pluginId)??0),` installs`]})]})]}),t.entry.description&&(0,G.jsxs)(u,{marginLeft:4,children:[(0,G.jsx)(d,{dimColor:!0,children:ut(t.entry.description,60)}),t.entry.version&&(0,G.jsxs)(d,{dimColor:!0,children:[` · v`,t.entry.version]})]})]},t.pluginId)}),k.scrollPosition.canScrollDown&&(0,G.jsx)(u,{children:(0,G.jsxs)(d,{dimColor:!0,children:[` `,a.arrowDown,` more below`]})}),e&&(0,G.jsx)(u,{marginTop:1,children:(0,G.jsxs)(d,{color:`error`,children:[a.cross,` `,e]})}),(0,G.jsx)(Sn,{hasSelection:D.size>0})]})}var An,W,G,jn=e((()=>{i(),An=t(h(),1),W=t(h(),1),Se(),S(),ze(),w(),Ye(),rt(),Qe(),M(),wt(),R(),k(),Oe(),Xe(),P(),Re(),ft(),dt(),gn(),yn(),wn(),On(),G=C()}));function Mn({error:e,setError:t,result:n,setResult:r,setViewState:i,onInstallComplete:o,onSearchModeChange:s,targetPlugin:l}){let[h,_]=(0,K.useState)(`plugin-list`),[y,x]=(0,K.useState)(null),[S,ee]=(0,K.useState)([]),[te,C]=(0,K.useState)(!0),[w,re]=(0,K.useState)(null),[T,E]=(0,K.useState)(!1),D=(0,K.useCallback)(e=>{E(e),s?.(e)},[s]),{query:O,setQuery:ie,cursorOffset:ae}=Ut({isActive:h===`plugin-list`&&T&&!te,onExit:()=>{D(!1)}}),k=m(),{columns:j}=b(),M=(0,K.useMemo)(()=>{if(!O)return S;let e=O.toLowerCase();return S.filter(t=>t.entry.name.toLowerCase().includes(e)||t.entry.description?.toLowerCase().includes(e)||t.marketplaceName.toLowerCase().includes(e))},[S,O]),[N,P]=(0,K.useState)(0),[F,se]=(0,K.useState)(new Set),[le,de]=(0,K.useState)(new Set),fe=Tn({totalItems:M.length,selectedIndex:N});(0,K.useEffect)(()=>{P(0)},[O]);let[I,me]=(0,K.useState)(0),[he,ve]=(0,K.useState)(!1),[be,L]=(0,K.useState)(null),[R,xe]=(0,K.useState)(null),[Se,Ce]=(0,K.useState)(null);(0,K.useEffect)(()=>{async function e(){try{let e=await Le(),{marketplaces:n,failures:r}=await ue(e),i=[];for(let{name:e,data:t}of n)if(t)for(let n of t.plugins){let t=qe(n.name,e);i.push({entry:n,marketplaceName:e,pluginId:t,isInstalled:z(t)})}let a=i.filter(e=>!e.isInstalled&&!ce(e.pluginId));try{let e=await Ot();re(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){nt(`Failed to fetch install counts: ${$e(e)}`),a.sort((e,t)=>e.entry.name.localeCompare(t.entry.name))}ee(a);let o=Object.keys(e).length;if(a.length===0){let e=await _e({configuredMarketplaceCount:o,failedMarketplaceCount:r.length});Ce(e)}let s=A(r,ne(n,e=>e.data!==null));if(s)if(s.type===`warning`)xe(`${s.message}. Showing available plugins.`);else throw Error(s.message);if(l){let e=i.find(e=>e.entry.name===l);e?e.isInstalled?t(`Plugin '${e.pluginId}' is already installed. Use '/plugin' to manage existing plugins.`):(x(e),_(`plugin-details`)):t(`Plugin "${l}" not found in any marketplace`)}}catch(e){t(e instanceof Error?e.message:`Failed to load plugins`)}finally{C(!1)}}e()},[t,l]);let we=async()=>{if(F.size===0)return;let e=S.filter(e=>F.has(e.pluginId));de(new Set(e.map(e=>e.pluginId)));let n=0,a=0,s=[];for(let t of e){let e=await ye({pluginId:t.pluginId,entry:t.entry,marketplaceName:t.marketplaceName,scope:`user`});e.success?n++:(a++,s.push({name:t.entry.name,reason:e.error}))}de(new Set),se(new Set),pe(),a===0?r(`✓ Installed ${n} ${H(n,`plugin`)}. Run /reload-plugins to activate.`):n===0?t(`Failed to install: ${oe(s,!0)}`):r(`✓ Installed ${n} of ${n+a} plugins. Failed: ${oe(s,!1)}. Run /reload-plugins to activate successfully installed plugins.`),n>0&&o&&await o(),i({type:`menu`})},Te=async(e,t=`user`)=>{ve(!0),L(null);let n=await ye({pluginId:e.pluginId,entry:e.entry,marketplaceName:e.marketplaceName,scope:t});if(n.success){let t=await fn(e.pluginId);if(t){ve(!1),_({type:`plugin-options`,plugin:t,pluginId:e.pluginId});return}r(n.message),o&&await o(),i({type:`menu`})}else ve(!1),L(n.error)};(0,K.useEffect)(()=>{e&&r(e)},[e,r]),p(`confirm:no`,()=>{_(`plugin-list`),x(null)},{context:`Confirmation`,isActive:h===`plugin-details`}),p(`confirm:no`,()=>{i({type:`menu`})},{context:`Confirmation`,isActive:h===`plugin-list`&&!T}),g((e,t)=>{let n=!t.ctrl&&!t.meta;T||(e===`/`&&n?(D(!0),ie(``)):n&&e.length>0&&!/^\s+$/.test(e)&&e!==`j`&&e!==`k`&&e!==`i`&&(D(!0),ie(e)))},{isActive:h===`plugin-list`&&!te}),c({"select:previous":()=>{N===0?D(!0):fe.handleSelectionChange(N-1,P)},"select:next":()=>{N<M.length-1&&fe.handleSelectionChange(N+1,P)},"select:accept":()=>{if(N===M.length&&F.size>0)we();else if(N<M.length){let e=M[N];e&&(e.isInstalled?i({type:`manage-plugins`,targetPlugin:e.entry.name,targetMarketplace:e.marketplaceName}):(x(e),_(`plugin-details`),me(0),L(null)))}}},{context:`Select`,isActive:h===`plugin-list`&&!T}),c({"plugin:toggle":()=>{if(N<M.length){let e=M[N];if(e&&!e.isInstalled){let t=new Set(F);t.has(e.pluginId)?t.delete(e.pluginId):t.add(e.pluginId),se(t)}}},"plugin:install":()=>{F.size>0&&we()}},{context:`Plugin`,isActive:h===`plugin-list`&&!T});let Ee=Fn.useMemo(()=>{if(!y)return[];let e=y.entry.homepage;return xn(e,bn(y))},[y]);if(c({"select:previous":()=>{I>0&&me(I-1)},"select:next":()=>{I<Ee.length-1&&me(I+1)},"select:accept":()=>{if(!y)return;let e=Ee[I]?.action,t=y.entry.homepage,n=bn(y);e===`install-user`?Te(y,`user`):e===`install-project`?Te(y,`project`):e===`install-local`?Te(y,`local`):e===`homepage`&&t?ge(t):e===`github`&&n?ge(`https://github.com/${n}`):e===`back`&&(_(`plugin-list`),x(null))}},{context:`Select`,isActive:h===`plugin-details`&&!!y}),typeof h==`object`&&h.type===`plugin-options`){let{plugin:e,pluginId:t}=h;function n(e){r(e),o&&o(),i({type:`menu`})}return(0,q.jsx)(pn,{plugin:e,pluginId:t,onDone:(t,r)=>{switch(t){case`configured`:n(`✓ Installed and configured ${e.name}. Run /reload-plugins to apply.`);break;case`skipped`:n(`✓ Installed ${e.name}. Run /reload-plugins to apply.`);break;case`error`:n(`Installed but failed to save config: ${r}`);break}}})}if(te)return(0,q.jsx)(d,{children:`Loading…`});if(e)return(0,q.jsx)(d,{color:`error`,children:e});if(h===`plugin-details`&&y){let e=y.entry.homepage,t=xn(e,bn(y));return(0,q.jsxs)(u,{flexDirection:`column`,children:[(0,q.jsx)(u,{marginBottom:1,children:(0,q.jsx)(d,{bold:!0,children:`Plugin details`})}),(0,q.jsxs)(u,{flexDirection:`column`,marginBottom:1,children:[(0,q.jsx)(d,{bold:!0,children:y.entry.name}),(0,q.jsxs)(d,{dimColor:!0,children:[`from `,y.marketplaceName]}),y.entry.version&&(0,q.jsxs)(d,{dimColor:!0,children:[`Version: `,y.entry.version]}),y.entry.description&&(0,q.jsx)(u,{marginTop:1,children:(0,q.jsx)(d,{children:y.entry.description})}),y.entry.author&&(0,q.jsx)(u,{marginTop:1,children:(0,q.jsxs)(d,{dimColor:!0,children:[`By:`,` `,typeof y.entry.author==`string`?y.entry.author:y.entry.author.name]})})]}),(0,q.jsx)(_n,{}),be&&(0,q.jsx)(u,{marginBottom:1,children:(0,q.jsxs)(d,{color:`error`,children:[`Error: `,be]})}),(0,q.jsx)(u,{flexDirection:`column`,children:t.map((e,t)=>(0,q.jsxs)(u,{children:[I===t&&(0,q.jsx)(d,{children:`> `}),I!==t&&(0,q.jsx)(d,{children:` `}),(0,q.jsx)(d,{bold:I===t,children:he&&e.action.startsWith(`install-`)?`Installing…`:e.label})]},e.action))}),(0,q.jsx)(u,{marginTop:1,children:(0,q.jsx)(d,{dimColor:!0,children:(0,q.jsxs)(f,{children:[(0,q.jsx)(B,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`select`}),(0,q.jsx)(B,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]})})})]})}if(S.length===0)return(0,q.jsxs)(u,{flexDirection:`column`,children:[(0,q.jsx)(u,{marginBottom:1,children:(0,q.jsx)(d,{bold:!0,children:`Discover plugins`})}),(0,q.jsx)(Pn,{reason:Se}),(0,q.jsx)(u,{marginTop:1,children:(0,q.jsx)(d,{dimColor:!0,italic:!0,children:`Esc to go back`})})]});let De=fe.getVisibleItems(M);return(0,q.jsxs)(u,{flexDirection:`column`,children:[(0,q.jsxs)(u,{children:[(0,q.jsx)(d,{bold:!0,children:`Discover plugins`}),fe.needsPagination&&(0,q.jsxs)(d,{dimColor:!0,children:[` `,`(`,fe.scrollPosition.current,`/`,fe.scrollPosition.total,`)`]})]}),(0,q.jsx)(u,{marginBottom:1,children:(0,q.jsx)(v,{query:O,isFocused:T,isTerminalFocused:k,width:j-4,cursorOffset:ae})}),R&&(0,q.jsx)(u,{marginBottom:1,children:(0,q.jsxs)(d,{color:`warning`,children:[a.warning,` `,R]})}),M.length===0&&O&&(0,q.jsx)(u,{marginBottom:1,children:(0,q.jsxs)(d,{dimColor:!0,children:[`No plugins match "`,O,`"`]})}),fe.scrollPosition.canScrollUp&&(0,q.jsx)(u,{children:(0,q.jsxs)(d,{dimColor:!0,children:[` `,a.arrowUp,` more above`]})}),De.map((t,n)=>{let r=fe.toActualIndex(n),i=N===r,o=F.has(t.pluginId),s=le.has(t.pluginId);return(0,q.jsxs)(u,{flexDirection:`column`,marginBottom:n===De.length-1&&!e?0:1,children:[(0,q.jsxs)(u,{children:[(0,q.jsxs)(d,{color:i&&!T?`suggestion`:void 0,children:[i&&!T?a.pointer:` `,` `]}),(0,q.jsxs)(d,{children:[s?a.ellipsis:o?a.radioOn:a.radioOff,` `,t.entry.name,(0,q.jsxs)(d,{dimColor:!0,children:[` · `,t.marketplaceName]}),t.entry.tags?.includes(`community-managed`)&&(0,q.jsx)(d,{dimColor:!0,children:` [Community Managed]`}),w&&t.marketplaceName===`claude-plugins-official`&&(0,q.jsxs)(d,{dimColor:!0,children:[` · `,Dt(w.get(t.pluginId)??0),` installs`]})]})]}),t.entry.description&&(0,q.jsx)(u,{marginLeft:4,children:(0,q.jsx)(d,{dimColor:!0,children:ut(t.entry.description,60)})})]},`${fe.startIndex}-${t.pluginId}`)}),fe.scrollPosition.canScrollDown&&(0,q.jsx)(u,{children:(0,q.jsxs)(d,{dimColor:!0,children:[` `,a.arrowDown,` more below`]})}),e&&(0,q.jsx)(u,{marginTop:1,children:(0,q.jsxs)(d,{color:`error`,children:[a.cross,` `,e]})}),(0,q.jsx)(Nn,{hasSelection:F.size>0,canToggle:N<M.length&&!M[N]?.isInstalled})]})}function Nn({hasSelection:e,canToggle:t}){return(0,q.jsx)(u,{marginTop:1,children:(0,q.jsx)(d,{dimColor:!0,italic:!0,children:(0,q.jsxs)(f,{children:[e&&(0,q.jsx)(B,{action:`plugin:install`,context:`Plugin`,fallback:`i`,description:`install`,bold:!0}),(0,q.jsx)(d,{children:`type to search`}),t&&(0,q.jsx)(B,{action:`plugin:toggle`,context:`Plugin`,fallback:`Space`,description:`toggle`}),(0,q.jsx)(B,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`details`}),(0,q.jsx)(B,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]})})})}function Pn({reason:e}){switch(e){case`git-not-installed`:return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(d,{dimColor:!0,children:`Git is required to install marketplaces.`}),(0,q.jsx)(d,{dimColor:!0,children:`Please install git and restart Work Mate.`})]});case`all-blocked-by-policy`:return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(d,{dimColor:!0,children:`Your organization policy does not allow any external marketplaces.`}),(0,q.jsx)(d,{dimColor:!0,children:`Contact your administrator.`})]});case`policy-restricts-sources`:return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(d,{dimColor:!0,children:`Your organization restricts which marketplaces can be added.`}),(0,q.jsx)(d,{dimColor:!0,children:`Switch to the Marketplaces tab to view allowed sources.`})]});case`all-marketplaces-failed`:return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(d,{dimColor:!0,children:`Failed to load marketplace data.`}),(0,q.jsx)(d,{dimColor:!0,children:`Check your network connection.`})]});case`all-plugins-installed`:return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(d,{dimColor:!0,children:`All available plugins are already installed.`}),(0,q.jsx)(d,{dimColor:!0,children:`Check for new plugins later or add more marketplaces.`})]});default:return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(d,{dimColor:!0,children:`No plugins available.`}),(0,q.jsx)(d,{dimColor:!0,children:`Add a marketplace first using the Marketplaces tab.`})]})}}var Fn,K,q,In=e((()=>{i(),Fn=t(h(),1),K=t(h(),1),Se(),Ht(),S(),Wt(),Ne(),ze(),w(),Ye(),rt(),Qe(),M(),wt(),R(),k(),Oe(),Xe(),P(),Re(),ft(),dt(),gn(),yn(),wn(),On(),q=C()}));function Ln({setViewState:e,error:t,setError:n,setResult:r,exitState:i,onManageComplete:o,targetMarketplace:s,action:l}){let[m,h]=(0,zn.useState)([]),[_,v]=(0,zn.useState)(!0),[y,b]=(0,zn.useState)(0),[x,S]=(0,zn.useState)(!1),[ee,te]=(0,zn.useState)(null),[C,w]=(0,zn.useState)(null),[re,T]=(0,zn.useState)(null),[E,ae]=(0,zn.useState)(`list`),[k,j]=(0,zn.useState)(null),[oe,M]=(0,zn.useState)(0),N=(0,zn.useRef)(!1);(0,zn.useEffect)(()=>{async function e(){try{let e=await Le(),{enabled:r,disabled:i}=await le(),a=[...r,...i],{marketplaces:o,failures:c}=await ue(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:fe(t.source),lastUpdated:t.lastUpdated,pluginCount:n?.plugins.length,installedPlugins:r,pendingUpdate:!1,pendingRemove:!1,autoUpdate:ie(e,t)})}u.sort((e,t)=>e.name===`claude-plugin-directory`?-1:t.name===`claude-plugin-directory`?1:e.name.localeCompare(t.name)),h(u);let d=A(c,ne(o,e=>e.data!==null));if(d)if(d.type===`warning`)te(d.message);else throw Error(d.message);if(s&&!N.current&&!t){N.current=!0;let e=u.findIndex(e=>e.name===s);if(e>=0){let t=u[e];if(l){b(e+1);let t=[...u];l===`update`?t[e].pendingUpdate=!0:l===`remove`&&(t[e].pendingRemove=!0),h(t),setTimeout(se,100,t)}else t&&(b(e+1),j(t),ae(`details`))}else n&&n(`Marketplace not found: ${s}`)}}catch(e){n&&n(e instanceof Error?e.message:`Failed to load marketplaces`),te(e instanceof Error?e.message:`Failed to load marketplaces`)}finally{v(!1)}}e()},[s,l,t]);let P=()=>m.some(e=>e.pendingUpdate||e.pendingRemove),F=()=>({updateCount:ne(m,e=>e.pendingUpdate),removeCount:ne(m,e=>e.pendingRemove)}),se=async t=>{let i=t||m,s=E===`details`;S(!0),te(null),w(null),T(null);try{let t=D(`userSettings`),n=0,c=0,l=new Set;for(let e of i){if(e.pendingRemove){if(e.installedPlugins&&e.installedPlugins.length>0){let n={...t?.enabledPlugins};for(let t of e.installedPlugins){let r=qe(t.name,e.name);n[r]=!1}O(`userSettings`,{enabledPlugins:n})}await Ke(e.name),c++,e.name,e.installedPlugins?.length;continue}e.pendingUpdate&&(await V(e.name,e=>{T(e)}),n++,l.add(e.name.toLowerCase()),e.name)}let u=0;l.size>0&&(u=(await $t(l)).length),pe(),o&&await o();let d=await Le(),{enabled:f,disabled:p}=await le(),m=[...f,...p],{marketplaces:g}=await ue(d),_=[];for(let{name:e,config:t,data:n}of g){let r=m.filter(t=>t.source.endsWith(`@${e}`));_.push({name:e,source:fe(t.source),lastUpdated:t.lastUpdated,pluginCount:n?.plugins.length,installedPlugins:r,pendingUpdate:!1,pendingRemove:!1,autoUpdate:ie(e,t)})}if(_.sort((e,t)=>e.name===`claude-plugin-directory`?-1:t.name===`claude-plugin-directory`?1:e.name.localeCompare(t.name)),h(_),s&&k){let e=_.find(e=>e.name===k.name);e&&j(e)}let v=[];if(n>0){let e=u>0?` (${u} ${H(u,`plugin`)} bumped)`:``;v.push(`Updated ${n} ${H(n,`marketplace`)}${e}`)}if(c>0&&v.push(`Removed ${c} ${H(c,`marketplace`)}`),v.length>0){let t=`${a.tick} ${v.join(`, `)}`;s?w(t):(r(t),setTimeout(e,2e3,{type:`menu`}))}else s||e({type:`menu`})}catch(e){let t=$e(e);te(t),n&&n(t)}finally{S(!1),T(null)}},ce=async()=>{if(!k)return;let e=m.map(e=>e.name===k.name?{...e,pendingRemove:!0}:e);h(e),await se(e)},de=e=>{if(!e)return[];let t=[{label:`Browse plugins (${e.pluginCount??0})`,value:`browse`},{label:`Update marketplace`,secondaryLabel:e.lastUpdated?`(last updated ${new Date(e.lastUpdated).toLocaleDateString()})`:void 0,value:`update`}];return ot()||t.push({label:e.autoUpdate?`Disable auto-update`:`Enable auto-update`,value:`toggle-auto-update`}),t.push({label:`Remove marketplace`,value:`remove`}),t},I=async e=>{let t=!e.autoUpdate;try{await Je(e.name,t),h(n=>n.map(n=>n.name===e.name?{...n,autoUpdate:t}:n)),j(e=>e&&{...e,autoUpdate:t})}catch(e){te(e instanceof Error?e.message:`Failed to update setting`)}};if(p(`confirm:no`,()=>{ae(`list`),M(0)},{context:`Confirmation`,isActive:!x&&(E===`details`||E===`confirm-remove`)}),p(`confirm:no`,()=>{h(e=>e.map(e=>({...e,pendingUpdate:!1,pendingRemove:!1}))),b(0)},{context:`Confirmation`,isActive:!x&&E===`list`&&P()}),p(`confirm:no`,()=>{e({type:`menu`})},{context:`Confirmation`,isActive:!x&&E===`list`&&!P()}),c({"select:previous":()=>b(e=>Math.max(0,e-1)),"select:next":()=>{let e=m.length+1;b(t=>Math.min(e-1,t+1))},"select:accept":()=>{let t=y-1;if(y===0)e({type:`add-marketplace`});else if(P())se();else{let e=m[t];e&&(j(e),ae(`details`),M(0))}}},{context:`Select`,isActive:!x&&E===`list`}),g(e=>{let t=y-1;if((e===`u`||e===`U`)&&t>=0)h(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=m[t];e&&(j(e),ae(`confirm-remove`))}},{isActive:!x&&E===`list`}),c({"select:previous":()=>M(e=>Math.max(0,e-1)),"select:next":()=>{let e=de(k);M(t=>Math.min(e.length-1,t+1))},"select:accept":()=>{if(!k)return;let t=de(k)[oe];if(t?.value===`browse`)e({type:`browse-marketplace`,targetMarketplace:k.name});else if(t?.value===`update`){let e=m.map(e=>e.name===k.name?{...e,pendingUpdate:!0}:e);h(e),se(e)}else t?.value===`toggle-auto-update`?I(k):t?.value===`remove`&&ae(`confirm-remove`)}},{context:`Select`,isActive:!x&&E===`details`}),g(e=>{e===`y`||e===`Y`?ce():(e===`n`||e===`N`)&&(ae(`list`),j(null))},{isActive:!x&&E===`confirm-remove`}),_)return(0,J.jsx)(d,{children:`Loading marketplaces…`});if(m.length===0)return(0,J.jsxs)(u,{flexDirection:`column`,children:[(0,J.jsx)(u,{marginBottom:1,children:(0,J.jsx)(d,{bold:!0,children:`Manage marketplaces`})}),(0,J.jsxs)(u,{flexDirection:`row`,gap:1,children:[(0,J.jsxs)(d,{color:`suggestion`,children:[a.pointer,` +`]}),(0,J.jsx)(d,{bold:!0,color:`suggestion`,children:`Add Marketplace`})]}),(0,J.jsx)(u,{marginLeft:3,children:(0,J.jsx)(d,{dimColor:!0,italic:!0,children:i.pending?(0,J.jsxs)(J.Fragment,{children:[`Press `,i.keyName,` again to go back`]}):(0,J.jsxs)(f,{children:[(0,J.jsx)(B,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`select`}),(0,J.jsx)(B,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`})]})})})]});if(E===`confirm-remove`&&k){let e=k.installedPlugins?.length||0;return(0,J.jsxs)(u,{flexDirection:`column`,children:[(0,J.jsxs)(d,{bold:!0,color:`warning`,children:[`Remove marketplace `,(0,J.jsx)(d,{italic:!0,children:k.name}),`?`]}),(0,J.jsxs)(u,{flexDirection:`column`,children:[e>0&&(0,J.jsx)(u,{marginTop:1,children:(0,J.jsxs)(d,{color:`warning`,children:[`This will also uninstall `,e,` `,H(e,`plugin`),` from this marketplace:`]})}),k.installedPlugins&&k.installedPlugins.length>0&&(0,J.jsx)(u,{flexDirection:`column`,marginTop:1,marginLeft:2,children:k.installedPlugins.map(e=>(0,J.jsxs)(d,{dimColor:!0,children:[`• `,e.name]},e.name))}),(0,J.jsx)(u,{marginTop:1,children:(0,J.jsxs)(d,{children:[`Press `,(0,J.jsx)(d,{bold:!0,children:`y`}),` to confirm or `,(0,J.jsx)(d,{bold:!0,children:`n`}),` to cancel`]})})]})]})}if(E===`details`&&k){let e=k.pendingUpdate||x,t=de(k);return(0,J.jsxs)(u,{flexDirection:`column`,children:[(0,J.jsx)(d,{bold:!0,children:k.name}),(0,J.jsx)(d,{dimColor:!0,children:k.source}),(0,J.jsx)(u,{marginTop:1,children:(0,J.jsxs)(d,{children:[k.pluginCount||0,` available `,H(k.pluginCount||0,`plugin`)]})}),k.installedPlugins&&k.installedPlugins.length>0&&(0,J.jsxs)(u,{flexDirection:`column`,marginTop:1,children:[(0,J.jsxs)(d,{bold:!0,children:[`Installed plugins (`,k.installedPlugins.length,`):`]}),(0,J.jsx)(u,{flexDirection:`column`,marginLeft:1,children:k.installedPlugins.map(e=>(0,J.jsxs)(u,{flexDirection:`row`,gap:1,children:[(0,J.jsx)(d,{children:a.bullet}),(0,J.jsxs)(u,{flexDirection:`column`,children:[(0,J.jsx)(d,{children:e.name}),(0,J.jsx)(d,{dimColor:!0,children:e.manifest.description})]})]},e.name))})]}),e&&(0,J.jsxs)(u,{marginTop:1,flexDirection:`column`,children:[(0,J.jsx)(d,{color:`claude`,children:`Updating marketplace…`}),re&&(0,J.jsx)(d,{dimColor:!0,children:re})]}),!e&&C&&(0,J.jsx)(u,{marginTop:1,children:(0,J.jsx)(d,{color:`claude`,children:C})}),!e&&ee&&(0,J.jsx)(u,{marginTop:1,children:(0,J.jsx)(d,{color:`error`,children:ee})}),!e&&(0,J.jsx)(u,{flexDirection:`column`,marginTop:1,children:t.map((e,t)=>{if(!e)return null;let n=t===oe;return(0,J.jsxs)(u,{children:[(0,J.jsxs)(d,{color:n?`suggestion`:void 0,children:[n?a.pointer:` `,` `,e.label]}),e.secondaryLabel&&(0,J.jsxs)(d,{dimColor:!0,children:[` `,e.secondaryLabel]})]},e.value)})}),!e&&!ot()&&k.autoUpdate&&(0,J.jsx)(u,{marginTop:1,children:(0,J.jsx)(d,{dimColor:!0,children:`Auto-update enabled. Work Mate will automatically update this marketplace and its installed plugins.`})}),(0,J.jsx)(u,{marginLeft:3,children:(0,J.jsx)(d,{dimColor:!0,italic:!0,children:e?(0,J.jsx)(J.Fragment,{children:`Please wait…`}):(0,J.jsxs)(f,{children:[(0,J.jsx)(B,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`select`}),(0,J.jsx)(B,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`})]})})})]})}let{updateCount:me,removeCount:he}=F();return(0,J.jsxs)(u,{flexDirection:`column`,children:[(0,J.jsx)(u,{marginBottom:1,children:(0,J.jsx)(d,{bold:!0,children:`Manage marketplaces`})}),(0,J.jsxs)(u,{flexDirection:`row`,gap:1,marginBottom:1,children:[(0,J.jsxs)(d,{color:y===0?`suggestion`:void 0,children:[y===0?a.pointer:` `,` +`]}),(0,J.jsx)(d,{bold:!0,color:y===0?`suggestion`:void 0,children:`Add Marketplace`})]}),(0,J.jsx)(u,{flexDirection:`column`,children:m.map((e,t)=>{let n=t+1===y,r=[];return e.pendingUpdate&&r.push(`UPDATE`),e.pendingRemove&&r.push(`REMOVE`),(0,J.jsxs)(u,{flexDirection:`row`,gap:1,marginBottom:1,children:[(0,J.jsxs)(d,{color:n?`suggestion`:void 0,children:[n?a.pointer:` `,` `,e.pendingRemove?a.cross:a.bullet]}),(0,J.jsxs)(u,{flexDirection:`column`,flexGrow:1,children:[(0,J.jsxs)(u,{flexDirection:`row`,gap:1,children:[(0,J.jsxs)(d,{bold:!0,strikethrough:e.pendingRemove,dimColor:e.pendingRemove,children:[e.name===`claude-plugins-official`&&(0,J.jsx)(d,{color:`claude`,children:`✻ `}),e.name,e.name===`claude-plugins-official`&&(0,J.jsx)(d,{color:`claude`,children:` ✻`})]}),r.length>0&&(0,J.jsxs)(d,{color:`warning`,children:[`[`,r.join(`, `),`]`]})]}),(0,J.jsx)(d,{dimColor:!0,children:e.source}),(0,J.jsxs)(d,{dimColor:!0,children:[e.pluginCount!==void 0&&(0,J.jsxs)(J.Fragment,{children:[e.pluginCount,` available`]}),e.installedPlugins&&e.installedPlugins.length>0&&(0,J.jsxs)(J.Fragment,{children:[` • `,e.installedPlugins.length,` installed`]}),e.lastUpdated&&(0,J.jsxs)(J.Fragment,{children:[` • Updated `,new Date(e.lastUpdated).toLocaleDateString()]})]})]})]},e.name)})}),P()&&(0,J.jsxs)(u,{marginTop:1,flexDirection:`column`,children:[(0,J.jsxs)(d,{children:[(0,J.jsx)(d,{bold:!0,children:`Pending changes:`}),` `,(0,J.jsx)(d,{dimColor:!0,children:`Enter to apply`})]}),me>0&&(0,J.jsxs)(d,{children:[`• Update `,me,` `,H(me,`marketplace`)]}),he>0&&(0,J.jsxs)(d,{color:`warning`,children:[`• Remove `,he,` `,H(he,`marketplace`)]})]}),x&&(0,J.jsx)(u,{marginTop:1,children:(0,J.jsx)(d,{color:`claude`,children:`Processing changes…`})}),ee&&(0,J.jsx)(u,{marginTop:1,children:(0,J.jsx)(d,{color:`error`,children:ee})}),(0,J.jsx)(Rn,{exitState:i,hasPendingActions:P()})]})}function Rn({exitState:e,hasPendingActions:t}){return e.pending?(0,J.jsx)(u,{marginTop:1,children:(0,J.jsxs)(d,{dimColor:!0,italic:!0,children:[`Press `,e.keyName,` again to go back`]})}):(0,J.jsx)(u,{marginTop:1,children:(0,J.jsx)(d,{dimColor:!0,italic:!0,children:(0,J.jsxs)(f,{children:[t&&(0,J.jsx)(B,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`apply changes`}),!t&&(0,J.jsx)(B,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`select`}),!t&&(0,J.jsx)(o,{shortcut:`u`,action:`update`}),!t&&(0,J.jsx)(o,{shortcut:`r`,action:`remove`}),(0,J.jsx)(B,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:t?`cancel`:`go back`})]})})})}var zn,J,Bn=e((()=>{i(),zn=t(h(),1),lt(),Se(),S(),ze(),w(),at(),Qe(),M(),k(),Oe(),en(),se(),T(),E(),ft(),J=C()}));function Vn(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 I(e)}function Hn(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 Un=e((()=>{N()}));function Wn({item:e,isSelected:t}){let[n]=l();if(e.type===`plugin`){let r,i;return e.pendingToggle?(r=_(`suggestion`,n)(a.arrowRight),i=e.pendingToggle===`will-enable`?`will enable`:`will disable`):e.errorCount>0?(r=_(`error`,n)(a.cross),i=`${e.errorCount} ${H(e.errorCount,`error`)}`):e.isEnabled?(r=_(`success`,n)(a.tick),i=`enabled`):(r=_(`inactive`,n)(a.radioOff),i=`disabled`),(0,Y.jsxs)(u,{children:[(0,Y.jsx)(d,{color:t?`suggestion`:void 0,children:t?`${a.pointer} `:` `}),(0,Y.jsx)(d,{color:t?`suggestion`:void 0,children:e.name}),(0,Y.jsxs)(d,{dimColor:!t,children:[` `,(0,Y.jsx)(d,{backgroundColor:`userMessageBackground`,children:`Plugin`})]}),(0,Y.jsxs)(d,{dimColor:!0,children:[` · `,e.marketplace]}),(0,Y.jsxs)(d,{dimColor:!t,children:[` · `,r,` `]}),(0,Y.jsx)(d,{dimColor:!t,children:i})]})}if(e.type===`flagged-plugin`){let r=_(`warning`,n)(a.warning);return(0,Y.jsxs)(u,{children:[(0,Y.jsx)(d,{color:t?`suggestion`:void 0,children:t?`${a.pointer} `:` `}),(0,Y.jsx)(d,{color:t?`suggestion`:void 0,children:e.name}),(0,Y.jsxs)(d,{dimColor:!t,children:[` `,(0,Y.jsx)(d,{backgroundColor:`userMessageBackground`,children:`Plugin`})]}),(0,Y.jsxs)(d,{dimColor:!0,children:[` · `,e.marketplace]}),(0,Y.jsxs)(d,{dimColor:!t,children:[` · `,r,` `]}),(0,Y.jsx)(d,{dimColor:!t,children:`removed`})]})}if(e.type===`failed-plugin`){let r=_(`error`,n)(a.cross),i=`failed to load · ${e.errorCount} ${H(e.errorCount,`error`)}`;return(0,Y.jsxs)(u,{children:[(0,Y.jsx)(d,{color:t?`suggestion`:void 0,children:t?`${a.pointer} `:` `}),(0,Y.jsx)(d,{color:t?`suggestion`:void 0,children:e.name}),(0,Y.jsxs)(d,{dimColor:!t,children:[` `,(0,Y.jsx)(d,{backgroundColor:`userMessageBackground`,children:`Plugin`})]}),(0,Y.jsxs)(d,{dimColor:!0,children:[` · `,e.marketplace]}),(0,Y.jsxs)(d,{dimColor:!t,children:[` · `,r,` `]}),(0,Y.jsx)(d,{dimColor:!t,children:i})]})}let r,i;return e.status===`connected`?(r=_(`success`,n)(a.tick),i=`connected`):e.status===`disabled`?(r=_(`inactive`,n)(a.radioOff),i=`disabled`):e.status===`pending`?(r=_(`inactive`,n)(a.radioOff),i=`connecting…`):e.status===`needs-auth`?(r=_(`warning`,n)(a.triangleUpOutline),i=`Enter to auth`):(r=_(`error`,n)(a.cross),i=`failed`),e.indented?(0,Y.jsxs)(u,{children:[(0,Y.jsx)(d,{color:t?`suggestion`:void 0,children:t?`${a.pointer} `:` `}),(0,Y.jsx)(d,{dimColor:!t,children:`└ `}),(0,Y.jsx)(d,{color:t?`suggestion`:void 0,children:e.name}),(0,Y.jsxs)(d,{dimColor:!t,children:[` `,(0,Y.jsx)(d,{backgroundColor:`userMessageBackground`,children:`MCP`})]}),(0,Y.jsxs)(d,{dimColor:!t,children:[` · `,r,` `]}),(0,Y.jsx)(d,{dimColor:!t,children:i})]}):(0,Y.jsxs)(u,{children:[(0,Y.jsx)(d,{color:t?`suggestion`:void 0,children:t?`${a.pointer} `:` `}),(0,Y.jsx)(d,{color:t?`suggestion`:void 0,children:e.name}),(0,Y.jsxs)(d,{dimColor:!t,children:[` `,(0,Y.jsx)(d,{backgroundColor:`userMessageBackground`,children:`MCP`})]}),(0,Y.jsxs)(d,{dimColor:!t,children:[` · `,r,` `]}),(0,Y.jsx)(d,{dimColor:!t,children:i})]})}var Y,Gn=e((()=>{i(),S(),ft(),Y=C()}));async function Kn(e){try{return(await nn.readdir(e,{withFileTypes:!0})).filter(e=>e.isFile()&&e.name.endsWith(`.md`)).map(e=>tn.basename(e.name,`.md`))}catch(t){return nt(`Failed to read plugin components from ${e}: ${$e(t)}`,{level:`error`}),ct(tt(t)),[]}}async function qn(e){try{let t=await nn.readdir(e,{withFileTypes:!0}),n=[];for(let r of t)if(r.isDirectory()||r.isSymbolicLink()){let t=tn.join(e,r.name,`SKILL.md`);try{(await nn.stat(t)).isFile()&&n.push(r.name)}catch{}}return n}catch(t){return nt(`Failed to read skill directories from ${e}: ${$e(t)}`,{level:`error`}),ct(tt(t)),[]}}function Jn({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=je(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 Pe(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 Kn(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 Kn(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 qn(e);c.push(...t)}let l=[];e.hooksConfig&&l.push(Object.keys(e.hooksConfig)),n.hooks&&l.push(n.hooks);let u=[];e.mcpServers&&u.push(Object.keys(e.mcpServers)),n.mcpServers&&u.push(n.mcpServers),r({commands:i.length>0?i:null,agents:o.length>0?o:null,skills:c.length>0?c:null,hooks:l.length>0?l:null,mcpServers:u.length>0?u:null})}else s(`Plugin ${e.name} not found in marketplace`)}catch(e){s(e instanceof Error?e.message:`Failed to load components`)}finally{a(!1)}}n()},[e.name,e.commandsPath,e.commandsPaths,e.agentsPath,e.agentsPaths,e.skillsPath,e.skillsPaths,e.hooksConfig,e.mcpServers,t]),i?null:o?(0,Z.jsxs)(u,{flexDirection:`column`,marginBottom:1,children:[(0,Z.jsx)(d,{bold:!0,children:`Components:`}),(0,Z.jsxs)(d,{dimColor:!0,children:[`Error: `,o]})]}):!n||!(n.commands||n.agents||n.skills||n.hooks||n.mcpServers)?null:(0,Z.jsxs)(u,{flexDirection:`column`,marginBottom:1,children:[(0,Z.jsx)(d,{bold:!0,children:`Installed components:`}),n.commands?(0,Z.jsxs)(d,{dimColor:!0,children:[`• Commands:`,` `,typeof n.commands==`string`?n.commands:Array.isArray(n.commands)?n.commands.join(`, `):Object.keys(n.commands).join(`, `)]}):null,n.agents?(0,Z.jsxs)(d,{dimColor:!0,children:[`• Agents:`,` `,typeof n.agents==`string`?n.agents:Array.isArray(n.agents)?n.agents.join(`, `):Object.keys(n.agents).join(`, `)]}):null,n.skills?(0,Z.jsxs)(d,{dimColor:!0,children:[`• Skills:`,` `,typeof n.skills==`string`?n.skills:Array.isArray(n.skills)?n.skills.join(`, `):Object.keys(n.skills).join(`, `)]}):null,n.hooks?(0,Z.jsxs)(d,{dimColor:!0,children:[`• Hooks:`,` `,typeof n.hooks==`string`?n.hooks:Array.isArray(n.hooks)?n.hooks.map(String).join(`, `):typeof n.hooks==`object`&&n.hooks!==null?Object.keys(n.hooks).join(`, `):String(n.hooks)]}):null,n.mcpServers?(0,Z.jsxs)(d,{dimColor:!0,children:[`• MCP Servers:`,` `,typeof n.mcpServers==`string`?n.mcpServers:Array.isArray(n.mcpServers)?n.mcpServers.map(String).join(`, `):typeof n.mcpServers==`object`&&n.mcpServers!==null?Object.keys(n.mcpServers).join(`, `):String(n.mcpServers)]}):null]})}async function Yn(e,t){let n=(await Pe(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 Xn(e){return e.filter(e=>{let t=e.source.split(`@`)[1]||`local`;return!ce(`${e.name}@${t}`)})}function Zn({setViewState:e,setResult:t,onManageComplete:n,onSearchModeChange:r,targetPlugin:i,targetMarketplace:o,action:s}){let l=F(e=>e.mcp.clients),h=F(e=>e.mcp.tools),_=F(e=>e.plugins.errors),y=jt(),[x,S]=(0,X.useState)(!1),ee=(0,X.useCallback)(e=>{S(e),r?.(e)},[r]),te=m(),{columns:C}=b(),[w,T]=(0,X.useState)(`plugin-list`),{query:E,setQuery:ie,cursorOffset:k}=Ut({isActive:w===`plugin-list`&&x,onExit:()=>{ee(!1)}}),[A,oe]=(0,X.useState)(null),[M,N]=(0,X.useState)([]),[P,se]=(0,X.useState)([]),[ce,ue]=(0,X.useState)(!0),[de,fe]=(0,X.useState)(new Map),I=(0,X.useRef)(!1),he=(0,X.useRef)(void 0),_e=Pt();p(`confirm:no`,Qn.useCallback(()=>{if(w===`plugin-details`)T(`plugin-list`),oe(null),V(null);else if(typeof w==`object`&&w.type===`failed-plugin-details`)T(`plugin-list`),V(null);else if(w===`configuring`)T(`plugin-details`),Me(null);else if(typeof w==`object`&&(w.type===`plugin-options`||w.type===`configuring-options`))T(`plugin-list`),oe(null),t(`Plugin enabled. Configuration skipped — run /reload-plugins to apply.`),n&&n();else if(typeof w==`object`&&w.type===`flagged-detail`)T(`plugin-list`),V(null);else if(typeof w==`object`&&w.type===`mcp-detail`)T(`plugin-list`),V(null);else if(typeof w==`object`&&w.type===`mcp-tools`)T({type:`mcp-detail`,client:w.client});else if(typeof w==`object`&&w.type===`mcp-tool-detail`)T({type:`mcp-tools`,client:w.client});else{if(de.size>0){t(`Run /reload-plugins to apply plugin changes.`);return}e({type:`menu`})}},[w,e,de,t]),{context:`Confirmation`,isActive:(w!==`plugin-list`||!x)&&w!==`confirm-project-uninstall`&&!(typeof w==`object`&&w.type===`confirm-data-cleanup`)});let ve=e=>e.type===`connected`?`connected`:e.type===`disabled`?`disabled`:e.type===`pending`?`pending`:e.type===`needs-auth`?`needs-auth`:`failed`,ye=(0,X.useMemo)(()=>{let e=re(),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 P){let i=`${r.plugin.name}@${r.marketplace}`,a=e?.enabledPlugins?.[i]!==!1,o=_.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:de.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 _){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=mt(),s=[];for(let[e,t]of a){if(e in y)continue;let n=j(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:ve(e),client:e}));let u={flagged:-1,project:0,local:1,user:2,enterprise:3,managed:4,dynamic:5,builtin:6},d=[],f=new Map;for(let{item:e,originalScope:t,childMcps:r}of n){let n=e.scope;f.has(n)||f.set(n,[]),f.get(n).push(e);for(let{displayName:e,client:n}of r){let r=t===`builtin`?`user`:t;f.has(r)||f.set(r,[]),f.get(r).push({type:`mcp`,id:`mcp:${n.name}`,name:e,description:void 0,scope:r,status:ve(n),client:n,indented:!0})}}for(let e of c){let t=e.scope;f.has(t)||f.set(t,[]),f.get(t).push(e)}for(let e of s){let t=e.scope;f.has(t)||f.set(t,[]),f.get(t).push(e)}for(let[e,t]of Object.entries(y)){let n=j(e),r=n.name||e,i=n.marketplace||`unknown`;f.has(`flagged`)||f.set(`flagged`,[]),f.get(`flagged`).push({type:`flagged-plugin`,id:e,name:r,marketplace:i,scope:`flagged`,reason:`delisted`,text:`Removed from marketplace`,flaggedAt:t.flaggedAt})}let p=[...f.keys()].sort((e,t)=>(u[e]??99)-(u[t]??99));for(let e of p){let t=f.get(e),n=[],r=[],i=0;for(;i<t.length;){let e=t[i];if(e.type===`plugin`||e.type===`failed-plugin`||e.type===`flagged-plugin`){let r=[e];i++;let a=t[i];for(;a?.type===`mcp`&&a.indented;)r.push(a),i++,a=t[i];n.push(r)}else e.type===`mcp`&&!e.indented&&r.push(e),i++}n.sort((e,t)=>e[0].name.localeCompare(t[0].name)),r.sort((e,t)=>e.name.localeCompare(t.name));for(let e of n)d.push(...e);d.push(...r)}return d},[P,l,_,de,y]),be=(0,X.useMemo)(()=>ye.filter(e=>e.type===`flagged-plugin`).map(e=>e.id),[ye]);(0,X.useEffect)(()=>{be.length>0&&At(be)},[be]);let L=(0,X.useMemo)(()=>{if(!E)return ye;let e=E.toLowerCase();return ye.filter(t=>t.name.toLowerCase().includes(e)||`description`in t&&t.description?.toLowerCase().includes(e))},[ye,E]),[R,xe]=(0,X.useState)(0),Se=Tn({totalItems:L.length,selectedIndex:R,maxVisible:8}),[Ce,we]=(0,X.useState)(0),[Ee,z]=(0,X.useState)(!1),[Oe,V]=(0,X.useState)(null),[je,Me]=(0,X.useState)(null),[Ne,Pe]=(0,X.useState)(!1),[Ie,Le]=(0,X.useState)(!1);(0,X.useEffect)(()=>{if(!A){Le(!1);return}async function e(){let e=A.plugin.manifest.mcpServers,t=!1;if(e&&(t=typeof e==`string`&&Fe(e)||Array.isArray(e)&&e.some(e=>typeof e==`string`&&Fe(e))),!t)try{let e=tn.join(A.plugin.path,`..`),n=tn.join(e,`.claude-plugin`,`marketplace.json`),r=et(await nn.readFile(n,`utf-8`)).plugins?.find(e=>e.name===A.plugin.name);if(r?.mcpServers){let e=r.mcpServers;t=typeof e==`string`&&Fe(e)||Array.isArray(e)&&e.some(e=>typeof e==`string`&&Fe(e))}}catch(e){nt(`Failed to read raw marketplace.json: ${e}`)}Le(t)}e()},[A]),(0,X.useEffect)(()=>{async function e(){ue(!0);try{let{enabled:e,disabled:t}=await le(),n=re(),r=Xn([...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=ne(t,t=>{let r=`${t.name}@${e}`;return n?.enabledPlugins?.[r]!==!1}),i=t.length-r;a.push({name:e,installedPlugins:t,enabledCount:r,disabledCount:i})}a.sort((e,t)=>e.name===`claude-plugin-directory`?-1:t.name===`claude-plugin-directory`?1:e.name.localeCompare(t.name)),N(a);let o=[];for(let e of a)for(let t of e.installedPlugins){let n=`${t.name}@${e.name}`,r=t.isBuiltin?`builtin`:bt(n).scope;o.push({plugin:t,marketplace:e.name,scope:r,pendingEnable:void 0,pendingUpdate:!1})}se(o),xe(0)}finally{ue(!1)}}e()},[]),(0,X.useEffect)(()=>{if(!I.current&&i&&M.length>0&&!ce){let{name:e,marketplace:n}=j(i),r=o??n,a=r?M.filter(e=>e.name===r):M;for(let t of a){let n=t.installedPlugins.find(t=>t.name===e);if(n){let{scope:e}=bt(`${n.name}@${t.name}`),r={plugin:n,marketplace:t.name,scope:e,pendingEnable:void 0,pendingUpdate:!1};oe(r),T(`plugin-details`),he.current=s,I.current=!0;return}}let c=ye.find(t=>t.type===`failed-plugin`&&t.name===e);c&&c.type===`failed-plugin`&&(T({type:`failed-plugin-details`,plugin:{id:c.id,name:c.name,marketplace:c.marketplace,errors:c.errors,scope:c.scope}}),I.current=!0),!I.current&&s&&(I.current=!0,t(`Plugin "${i}" is not installed in this project`))}},[i,o,M,ce,ye,s,t]);let Re=async r=>{if(!A)return;let i=A.scope||`user`,a=i===`builtin`;if(a&&(r===`update`||r===`uninstall`)){V(`Built-in plugins cannot be updated or uninstalled.`);return}if(!a&&!yt(i)&&r!==`update`){V(`This plugin is managed by your organization. Contact your admin to disable it.`);return}z(!0),V(null);try{let o=`${A.plugin.name}@${A.marketplace}`,s;switch(r){case`enable`:{let e=await ht(o);if(!e.success)throw Error(e.message);break}case`disable`:{let e=await vt(o);if(!e.success)throw Error(e.message);s=e.reverseDependents;break}case`uninstall`:{if(a||!yt(i))break;if(St(o)){z(!1),T(`confirm-project-uninstall`);return}let e=Ve().plugins[o],t=!e||e.length<=1?await Te(o):null;if(t){z(!1),T({type:`confirm-data-cleanup`,size:t});return}let n=await gt(o,i);if(!n.success)throw Error(n.message);s=n.reverseDependents;break}case`update`:{if(a)break;let r=await _t(o,i);if(!r.success)throw Error(r.message);if(r.alreadyUpToDate){t(`${A.plugin.name} is already at the latest version (${r.newVersion}).`),n&&await n(),e({type:`menu`});return}break}}pe();let c=`${A.plugin.name}@${A.marketplace}`;if(re()?.enabledPlugins?.[c]!==!1){z(!1),T({type:`plugin-options`});return}let l=r===`enable`?`Enabled`:r===`disable`?`Disabled`:r===`update`?`Updated`:`Uninstalled`,u=s&&s.length>0?` · required by ${s.join(`, `)}`:``;t(`✓ ${l} ${A.plugin.name}${u}. Run /reload-plugins to apply.`),n&&await n(),e({type:`menu`})}catch(e){z(!1);let t=e instanceof Error?e.message:String(e);V(`Failed to ${r}: ${t}`),ct(tt(e))}},ze=(0,X.useRef)(Re);ze.current=Re,(0,X.useEffect)(()=>{if(w===`plugin-details`&&A&&he.current){let e=he.current;he.current=void 0,ze.current(e)}},[w,A]);let Be=Qn.useCallback(()=>{if(R>=L.length)return;let e=L[R];if(e?.type!==`flagged-plugin`)if(e?.type===`plugin`){let t=`${e.plugin.name}@${e.marketplace}`,n=re(),r=de.get(t),i=n?.enabledPlugins?.[t]!==!1,a=e.scope;if(a===`builtin`||yt(a)){let e=new Map(de);r?(e.delete(t),(async()=>{try{r===`will-disable`?await ht(t):await vt(t),pe()}catch(e){ct(e)}})()):(e.set(t,i?`will-disable`:`will-enable`),(async()=>{try{i?await vt(t):await ht(t),pe()}catch(e){ct(e)}})()),fe(e)}}else e?.type===`mcp`&&_e(e.client.name)},[R,L,de,P,_e]);c({"select:previous":()=>{R===0?ee(!0):Se.handleSelectionChange(R-1,xe)},"select:next":()=>{R<L.length-1&&Se.handleSelectionChange(R+1,xe)},"select:accept":Qn.useCallback(()=>{if(R>=L.length)return;let e=L[R];if(e?.type===`plugin`){let t=P.find(t=>t.plugin.name===e.plugin.name&&t.marketplace===e.marketplace);t&&(oe(t),T(`plugin-details`),we(0),V(null))}else e?.type===`flagged-plugin`?(T({type:`flagged-detail`,plugin:{id:e.id,name:e.name,marketplace:e.marketplace,reason:e.reason,text:e.text,flaggedAt:e.flaggedAt}}),V(null)):e?.type===`failed-plugin`?(T({type:`failed-plugin-details`,plugin:{id:e.id,name:e.name,marketplace:e.marketplace,errors:e.errors,scope:e.scope}}),we(0),V(null)):e?.type===`mcp`&&(T({type:`mcp-detail`,client:e.client}),V(null))},[R,L,P])},{context:`Select`,isActive:w===`plugin-list`&&!x}),c({"plugin:toggle":Be},{context:`Plugin`,isActive:w===`plugin-list`&&!x}),c({"select:accept":Qn.useCallback(()=>{typeof w!=`object`||w.type!==`flagged-detail`||(Mt(w.plugin.id),T(`plugin-list`))},[w])},{context:`Select`,isActive:typeof w==`object`&&w.type===`flagged-detail`});let He=Qn.useMemo(()=>{if(w!==`plugin-details`||!A)return[];let e=re(),t=`${A.plugin.name}@${A.marketplace}`,n=e?.enabledPlugins?.[t]!==!1,r=A.marketplace===`builtin`,i=[];return i.push({label:n?`Disable plugin`:`Enable plugin`,action:()=>void Re(n?`disable`:`enable`)}),r||(i.push({label:A.pendingUpdate?`Unmark for update`:`Mark for update`,action:async()=>{try{let e=await Yn(A.plugin.name,A.marketplace);if(e){V(e);return}let t=[...P],n=t.findIndex(e=>e.plugin.name===A.plugin.name&&e.marketplace===A.marketplace);n!==-1&&(t[n].pendingUpdate=!A.pendingUpdate,se(t),oe({...A,pendingUpdate:!A.pendingUpdate}))}catch(e){V(e instanceof Error?e.message:`Failed to check plugin update availability`)}}}),Ie&&i.push({label:`Configure`,action:async()=>{Pe(!0);try{let e=A.plugin.manifest.mcpServers,t=null;if(typeof e==`string`&&Fe(e))t=e;else if(Array.isArray(e)){for(let n of e)if(typeof n==`string`&&Fe(n)){t=n;break}}if(!t){V(`No MCPB file found in plugin`),Pe(!1);return}let n=`${A.plugin.name}@${A.marketplace}`,r=await Ae(t,A.plugin.path,n,void 0,void 0,!0);`status`in r&&r.status===`needs-config`?(Me(r),T(`configuring`)):V(`Failed to load MCPB for configuration`)}catch(e){let t=$e(e);V(`Failed to load configuration: ${t}`)}finally{Pe(!1)}}}),A.plugin.manifest.userConfig&&Object.keys(A.plugin.manifest.userConfig).length>0&&i.push({label:`Configure options`,action:()=>{T({type:`configuring-options`,schema:A.plugin.manifest.userConfig})}}),i.push({label:`Update now`,action:()=>void Re(`update`)}),i.push({label:`Uninstall`,action:()=>void Re(`uninstall`)})),A.plugin.manifest.homepage&&i.push({label:`Open homepage`,action:()=>void ge(A.plugin.manifest.homepage)}),A.plugin.manifest.repository&&i.push({label:`View repository`,action:()=>void ge(A.plugin.manifest.repository)}),i.push({label:`Back to plugin list`,action:()=>{T(`plugin-list`),oe(null),V(null)}}),i},[w,A,Ie,P]);if(c({"select:previous":()=>{Ce>0&&we(Ce-1)},"select:next":()=>{Ce<He.length-1&&we(Ce+1)},"select:accept":()=>{He[Ce]&&He[Ce].action()}},{context:`Select`,isActive:w===`plugin-details`&&!!A}),c({"select:accept":()=>{typeof w==`object`&&w.type===`failed-plugin-details`&&(async()=>{z(!0),V(null);let e=w.plugin.id,t=w.plugin.scope,r=yt(t)?await gt(e,t,!1):await gt(e,`user`,!1),i=r.success;if(!i){for(let t of[`userSettings`,`projectSettings`,`localSettings`]){let n=D(t);n?.enabledPlugins?.[e]!==void 0&&(O(t,{enabledPlugins:{...n.enabledPlugins,[e]:void 0}}),i=!0)}pe()}i?(n&&await n(),z(!1),T(`plugin-list`)):(z(!1),V(r.message))})()}},{context:`Select`,isActive:typeof w==`object`&&w.type===`failed-plugin-details`&&w.plugin.scope!==`managed`}),c({"confirm:yes":()=>{if(!A)return;z(!0),V(null);let r=`${A.plugin.name}@${A.marketplace}`,{error:i}=O(`localSettings`,{enabledPlugins:{...D(`localSettings`)?.enabledPlugins,[r]:!1}});if(i){z(!1),V(`Failed to write settings: ${i.message}`);return}pe(),t(`✓ Disabled ${A.plugin.name} in .workmate/settings.local.json. Run /reload-plugins to apply.`),n&&n(),e({type:`menu`})},"confirm:no":()=>{T(`plugin-details`),V(null)}},{context:`Confirmation`,isActive:w===`confirm-project-uninstall`&&!!A&&!Ee}),g((r,i)=>{if(!A)return;let o=`${A.plugin.name}@${A.marketplace}`,s=A.scope;if(!s||s===`builtin`||!yt(s))return;let c=async r=>{z(!0),V(null);try{let i=await gt(o,s,r);if(!i.success)throw Error(i.message);pe();let c=r?``:` · data preserved`;t(`${a.tick} ${i.message}${c}`),n&&n(),e({type:`menu`})}catch(e){z(!1),V(e instanceof Error?e.message:String(e))}};r===`y`||r===`Y`?c(!0):r===`n`||r===`N`?c(!1):i.escape&&(T(`plugin-details`),V(null))},{isActive:typeof w==`object`&&w.type===`confirm-data-cleanup`&&!!A&&!Ee}),Qn.useEffect(()=>{xe(0)},[E]),g((e,t)=>{let n=!t.ctrl&&!t.meta;x||(e===`/`&&n?(ee(!0),ie(``),xe(0)):n&&e.length>0&&!/^\s+$/.test(e)&&e!==`j`&&e!==`k`&&e!==` `&&(ee(!0),ie(e),xe(0)))},{isActive:w===`plugin-list`}),ce)return(0,Z.jsx)(d,{children:`Loading installed plugins…`});if(ye.length===0)return(0,Z.jsxs)(u,{flexDirection:`column`,children:[(0,Z.jsx)(u,{marginBottom:1,children:(0,Z.jsx)(d,{bold:!0,children:`Manage plugins`})}),(0,Z.jsx)(d,{children:`No plugins or MCP servers installed.`}),(0,Z.jsx)(u,{marginTop:1,children:(0,Z.jsx)(d,{dimColor:!0,children:`Esc to go back`})})]});if(typeof w==`object`&&w.type===`plugin-options`&&A){let r=`${A.plugin.name}@${A.marketplace}`;function i(r){t(r),n&&n(),e({type:`menu`})}return(0,Z.jsx)(pn,{plugin:A.plugin,pluginId:r,onDone:(e,t)=>{switch(e){case`configured`:i(`✓ Enabled and configured ${A.plugin.name}. Run /reload-plugins to apply.`);break;case`skipped`:i(`✓ Enabled ${A.plugin.name}. Run /reload-plugins to apply.`);break;case`error`:i(`Failed to save configuration: ${t}`);break}}})}if(typeof w==`object`&&w.type===`configuring-options`&&A){let e=`${A.plugin.name}@${A.marketplace}`;return(0,Z.jsx)(cn,{title:`Configure ${A.plugin.name}`,subtitle:`Plugin options`,configSchema:w.schema,initialValues:ae(e),onSave:n=>{try{De(e,n,w.schema),pe(),t(`Configuration saved. Run /reload-plugins for changes to take effect.`)}catch(e){V(`Failed to save configuration: ${$e(e)}`)}T(`plugin-details`)},onCancel:()=>T(`plugin-details`)})}if(w===`configuring`&&je&&A){let e=`${A.plugin.name}@${A.marketplace}`;async function n(n){if(!(!je||!A))try{let r=A.plugin.manifest.mcpServers,i=null;if(typeof r==`string`&&Fe(r))i=r;else if(Array.isArray(r)){for(let e of r)if(typeof e==`string`&&Fe(e)){i=e;break}}if(!i){V(`No MCPB file found`),T(`plugin-details`);return}await Ae(i,A.plugin.path,e,void 0,n),V(null),Me(null),T(`plugin-details`),t(`Configuration saved. Run /reload-plugins for changes to take effect.`)}catch(e){let t=$e(e);V(`Failed to save configuration: ${t}`),T(`plugin-details`)}}function r(){Me(null),T(`plugin-details`)}return(0,Z.jsx)(cn,{title:`Configure ${je.manifest.name}`,subtitle:`Plugin: ${A.plugin.name}`,configSchema:je.configSchema,initialValues:je.existingConfig,onSave:n,onCancel:r})}if(typeof w==`object`&&w.type===`flagged-detail`){let e=w.plugin;return(0,Z.jsxs)(u,{flexDirection:`column`,children:[(0,Z.jsx)(u,{children:(0,Z.jsxs)(d,{bold:!0,children:[e.name,` @ `,e.marketplace]})}),(0,Z.jsxs)(u,{marginBottom:1,children:[(0,Z.jsx)(d,{dimColor:!0,children:`Status: `}),(0,Z.jsx)(d,{color:`error`,children:`Removed`})]}),(0,Z.jsxs)(u,{marginBottom:1,flexDirection:`column`,children:[(0,Z.jsxs)(d,{color:`error`,children:[`Removed from marketplace · reason: `,e.reason]}),(0,Z.jsx)(d,{children:e.text}),(0,Z.jsxs)(d,{dimColor:!0,children:[`Flagged on `,new Date(e.flaggedAt).toLocaleDateString()]})]}),(0,Z.jsx)(u,{marginTop:1,flexDirection:`column`,children:(0,Z.jsxs)(u,{children:[(0,Z.jsxs)(d,{children:[a.pointer,` `]}),(0,Z.jsx)(d,{color:`suggestion`,children:`Dismiss`})]})}),(0,Z.jsxs)(f,{children:[(0,Z.jsx)(B,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`dismiss`}),(0,Z.jsx)(B,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]})]})}if(w===`confirm-project-uninstall`&&A)return(0,Z.jsxs)(u,{flexDirection:`column`,children:[(0,Z.jsxs)(d,{bold:!0,color:`warning`,children:[A.plugin.name,` is enabled in .workmate/settings.json (shared with your team)`]}),(0,Z.jsxs)(u,{marginTop:1,flexDirection:`column`,children:[(0,Z.jsx)(d,{children:`Disable it just for you in .workmate/settings.local.json?`}),(0,Z.jsx)(d,{dimColor:!0,children:`This has the same effect as uninstalling, without affecting other contributors.`})]}),Oe&&(0,Z.jsx)(u,{marginTop:1,children:(0,Z.jsx)(d,{color:`error`,children:Oe})}),(0,Z.jsx)(u,{marginTop:1,children:Ee?(0,Z.jsx)(d,{dimColor:!0,children:`Disabling…`}):(0,Z.jsxs)(f,{children:[(0,Z.jsx)(B,{action:`confirm:yes`,context:`Confirmation`,fallback:`y`,description:`disable`}),(0,Z.jsx)(B,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})]})})]});if(typeof w==`object`&&w.type===`confirm-data-cleanup`&&A)return(0,Z.jsxs)(u,{flexDirection:`column`,children:[(0,Z.jsxs)(d,{bold:!0,children:[A.plugin.name,` has `,w.size.human,` of persistent data`]}),(0,Z.jsxs)(u,{marginTop:1,flexDirection:`column`,children:[(0,Z.jsx)(d,{children:`Delete it along with the plugin?`}),(0,Z.jsx)(d,{dimColor:!0,children:ke(`${A.plugin.name}@${A.marketplace}`)})]}),Oe&&(0,Z.jsx)(u,{marginTop:1,children:(0,Z.jsx)(d,{color:`error`,children:Oe})}),(0,Z.jsx)(u,{marginTop:1,children:Ee?(0,Z.jsx)(d,{dimColor:!0,children:`Uninstalling…`}):(0,Z.jsxs)(d,{children:[(0,Z.jsx)(d,{bold:!0,children:`y`}),` to delete · `,(0,Z.jsx)(d,{bold:!0,children:`n`}),` to keep · `,(0,Z.jsx)(d,{bold:!0,children:`esc`}),` to cancel`]})})]});if(w===`plugin-details`&&A){let e=re(),t=`${A.plugin.name}@${A.marketplace}`,n=e?.enabledPlugins?.[t]!==!1,r=_.filter(e=>`plugin`in e&&e.plugin===A.plugin.name||e.source===t||e.source.startsWith(`${A.plugin.name}@`)),i=r.length===0?null:(0,Z.jsxs)(u,{flexDirection:`column`,marginBottom:1,children:[(0,Z.jsxs)(d,{bold:!0,color:`error`,children:[r.length,` `,H(r.length,`error`),`:`]}),r.map((e,t)=>{let n=Hn(e);return(0,Z.jsxs)(u,{flexDirection:`column`,marginLeft:2,children:[(0,Z.jsx)(d,{color:`error`,children:Vn(e)}),n&&(0,Z.jsxs)(d,{dimColor:!0,italic:!0,children:[a.arrowRight,` `,n]})]},t)})]});return(0,Z.jsxs)(u,{flexDirection:`column`,children:[(0,Z.jsx)(u,{children:(0,Z.jsxs)(d,{bold:!0,children:[A.plugin.name,` @ `,A.marketplace]})}),(0,Z.jsxs)(u,{children:[(0,Z.jsx)(d,{dimColor:!0,children:`Scope: `}),(0,Z.jsx)(d,{children:A.scope||`user`})]}),A.plugin.manifest.version&&(0,Z.jsxs)(u,{children:[(0,Z.jsx)(d,{dimColor:!0,children:`Version: `}),(0,Z.jsx)(d,{children:A.plugin.manifest.version})]}),A.plugin.manifest.description&&(0,Z.jsx)(u,{marginBottom:1,children:(0,Z.jsx)(d,{children:A.plugin.manifest.description})}),A.plugin.manifest.author&&(0,Z.jsxs)(u,{children:[(0,Z.jsx)(d,{dimColor:!0,children:`Author: `}),(0,Z.jsx)(d,{children:A.plugin.manifest.author.name})]}),(0,Z.jsxs)(u,{marginBottom:1,children:[(0,Z.jsx)(d,{dimColor:!0,children:`Status: `}),(0,Z.jsx)(d,{color:n?`success`:`warning`,children:n?`Enabled`:`Disabled`}),A.pendingUpdate&&(0,Z.jsx)(d,{color:`suggestion`,children:` · Marked for update`})]}),(0,Z.jsx)(Jn,{plugin:A.plugin,marketplace:A.marketplace}),i,(0,Z.jsx)(u,{marginTop:1,flexDirection:`column`,children:He.map((e,t)=>{let n=t===Ce;return(0,Z.jsxs)(u,{children:[n&&(0,Z.jsxs)(d,{children:[a.pointer,` `]}),!n&&(0,Z.jsx)(d,{children:` `}),(0,Z.jsx)(d,{bold:n,color:e.label.includes(`Uninstall`)?`error`:e.label.includes(`Update`)?`suggestion`:void 0,children:e.label})]},t)})}),Ee&&(0,Z.jsx)(u,{marginTop:1,children:(0,Z.jsx)(d,{children:`Processing…`})}),Oe&&(0,Z.jsx)(u,{marginTop:1,children:(0,Z.jsx)(d,{color:`error`,children:Oe})}),(0,Z.jsx)(u,{marginTop:1,children:(0,Z.jsx)(d,{dimColor:!0,italic:!0,children:(0,Z.jsxs)(f,{children:[(0,Z.jsx)(B,{action:`select:previous`,context:`Select`,fallback:`↑`,description:`navigate`}),(0,Z.jsx)(B,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`select`}),(0,Z.jsx)(B,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]})})})]})}if(typeof w==`object`&&w.type===`failed-plugin-details`){let e=w.plugin,t=e.errors[0],n=t?Vn(t):`Failed to load`;return(0,Z.jsxs)(u,{flexDirection:`column`,children:[(0,Z.jsxs)(d,{children:[(0,Z.jsx)(d,{bold:!0,children:e.name}),(0,Z.jsxs)(d,{dimColor:!0,children:[` @ `,e.marketplace]}),(0,Z.jsxs)(d,{dimColor:!0,children:[` (`,e.scope,`)`]})]}),(0,Z.jsx)(d,{color:`error`,children:n}),e.scope===`managed`?(0,Z.jsx)(u,{marginTop:1,children:(0,Z.jsx)(d,{dimColor:!0,children:`Managed by your organization — contact your admin`})}):(0,Z.jsxs)(u,{marginTop:1,children:[(0,Z.jsxs)(d,{color:`suggestion`,children:[a.pointer,` `]}),(0,Z.jsx)(d,{bold:!0,children:`Remove`})]}),Ee&&(0,Z.jsx)(d,{children:`Processing…`}),Oe&&(0,Z.jsx)(d,{color:`error`,children:Oe}),(0,Z.jsx)(u,{marginTop:1,children:(0,Z.jsx)(d,{dimColor:!0,italic:!0,children:(0,Z.jsxs)(f,{children:[e.scope!==`managed`&&(0,Z.jsx)(B,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`remove`}),(0,Z.jsx)(B,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]})})})]})}if(typeof w==`object`&&w.type===`mcp-detail`){let e=w.client,n=me(h,e.name).length,r=()=>{T({type:`mcp-tools`,client:e})},i=()=>{T(`plugin-list`)},a=e=>{e&&t(e),T(`plugin-list`)},o=e.config.scope,s=e.config.type;return s===`stdio`?(0,Z.jsx)(Gt,{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)(Zt,{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)(Zt,{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)(Zt,{server:{name:e.name,client:e,scope:o,transport:`claudeai-proxy`,isAuthenticated:void 0,config:e.config},serverToolsCount:n,onViewTools:r,onCancel:i,onComplete:a,borderless:!0}):(T(`plugin-list`),null)}if(typeof w==`object`&&w.type===`mcp-tools`){let e=w.client,t=e.config.scope,n=e.config.type,r;return r=n===`stdio`?{name:e.name,client:e,scope:t,transport:`stdio`,config:e.config}:n===`sse`?{name:e.name,client:e,scope:t,transport:`sse`,isAuthenticated:void 0,config:e.config}:n===`http`?{name:e.name,client:e,scope:t,transport:`http`,isAuthenticated:void 0,config:e.config}:{name:e.name,client:e,scope:t,transport:`claudeai-proxy`,isAuthenticated:void 0,config:e.config},(0,Z.jsx)(Qt,{server:r,onSelectTool:t=>{T({type:`mcp-tool-detail`,client:e,tool:t})},onBack:()=>T({type:`mcp-detail`,client:e})})}if(typeof w==`object`&&w.type===`mcp-tool-detail`){let{client:e,tool:t}=w,n=e.config.scope,r=e.config.type,i;return i=r===`stdio`?{name:e.name,client:e,scope:n,transport:`stdio`,config:e.config}:r===`sse`?{name:e.name,client:e,scope:n,transport:`sse`,isAuthenticated:void 0,config:e.config}:r===`http`?{name:e.name,client:e,scope:n,transport:`http`,isAuthenticated:void 0,config:e.config}:{name:e.name,client:e,scope:n,transport:`claudeai-proxy`,isAuthenticated:void 0,config:e.config},(0,Z.jsx)(Xt,{tool:t,server:i,onBack:()=>T({type:`mcp-tools`,client:e})})}let Ue=Se.getVisibleItems(L);return(0,Z.jsxs)(u,{flexDirection:`column`,children:[(0,Z.jsx)(u,{marginBottom:1,children:(0,Z.jsx)(v,{query:E,isFocused:x,isTerminalFocused:te,width:C-4,cursorOffset:k})}),L.length===0&&E&&(0,Z.jsx)(u,{marginBottom:1,children:(0,Z.jsxs)(d,{dimColor:!0,children:[`No items match "`,E,`"`]})}),Se.scrollPosition.canScrollUp&&(0,Z.jsx)(u,{children:(0,Z.jsxs)(d,{dimColor:!0,children:[` `,a.arrowUp,` more above`]})}),Ue.map((e,t)=>{let n=Se.toActualIndex(t)===R&&!x,r=t>0?Ue[t-1]:null,i=!r||r.scope!==e.scope;return(0,Z.jsxs)(Qn.Fragment,{children:[i&&(0,Z.jsx)(u,{marginTop:+(t>0),paddingLeft:2,children:(0,Z.jsx)(d,{dimColor:e.scope!==`flagged`,color:e.scope===`flagged`?`warning`:void 0,bold:e.scope===`flagged`,children:(e=>{switch(e){case`flagged`:return`Flagged`;case`project`:return`Project`;case`local`:return`Local`;case`user`:return`User`;case`enterprise`:return`Enterprise`;case`managed`:return`Managed`;case`builtin`:return`Built-in`;case`dynamic`:return`Built-in`;default:return e}})(e.scope)})}),(0,Z.jsx)(Wn,{item:e,isSelected:n})]},e.id)}),Se.scrollPosition.canScrollDown&&(0,Z.jsx)(u,{children:(0,Z.jsxs)(d,{dimColor:!0,children:[` `,a.arrowDown,` more below`]})}),(0,Z.jsx)(u,{marginTop:1,marginLeft:1,children:(0,Z.jsx)(d,{dimColor:!0,italic:!0,children:(0,Z.jsxs)(f,{children:[(0,Z.jsx)(d,{children:`type to search`}),(0,Z.jsx)(B,{action:`plugin:toggle`,context:`Plugin`,fallback:`Space`,description:`toggle`}),(0,Z.jsx)(B,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`details`}),(0,Z.jsx)(B,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]})})}),de.size>0&&(0,Z.jsx)(u,{marginLeft:1,children:(0,Z.jsx)(d,{dimColor:!0,italic:!0,children:`Run /reload-plugins to apply changes`})})]})}var Qn,X,Z,$n=e((()=>{i(),Qn=t(h(),1),X=t(h(),1),Se(),S(),Kt(),Yt(),qt(),Jt(),Ht(),Wt(),Ne(),ze(),de(),Ft(),He(),xt(),be(),w(),Ye(),rt(),Qe(),st(),M(),R(),Oe(),Ue(),Ee(),Nt(),ve(),se(),he(),Re(),pt(),E(),it(),ft(),Un(),dn(),gn(),Gn(),On(),Z=C()}));function er(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 tr=e((()=>{}));function nr({onComplete:e,path:t}){return(0,rr.useEffect)(()=>{async function n(){if(!t){e(`Usage: /plugin validate <path>
|
|
2
2
|
|
|
3
3
|
Validate a plugin or marketplace manifest file or directory.
|
|
4
4
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{gt as t,yt as n}from"./settings-CA-5Px85.js";import{$a as r,Dx as i,Tx as a,Za as o,co as s,fo as c,go as l,no as u,po as d}from"./loadAgentsDir-
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{gt as t,yt as n}from"./settings-CA-5Px85.js";import{$a as r,Dx as i,Tx as a,Za as o,co as s,fo as c,go as l,no as u,po as d}from"./loadAgentsDir-CgDTTnMX.js";import{I as f,M as p,c as m,i as h}from"./debug-NBJH_NxR.js";import{d as g,g as _}from"./config-CMtnYZR9.js";import{o as v,s as y}from"./log-D98mO6yJ.js";import{f as b,s as x}from"./pluginOperations-qT-GGKNu.js";function S(e){return O=e,k!==null&&k.length>0&&(e(k),k=null),()=>{O=null}}async function C(){let e=await d(),t=s(),r=new Set;for(let[i,a]of Object.entries(e)){let e=t[i]?.autoUpdate;(e===void 0?n(i,a):e)&&r.add(i.toLowerCase())}return r}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,m(`Plugin autoupdate: updated ${e} from ${t.oldVersion} to ${t.newVersion}`)):t.alreadyUpToDate||m(`Plugin autoupdate: failed to update ${e}: ${t.message}`,{level:`warn`})}catch(t){m(`Plugin autoupdate: error updating ${e}: ${p(t)}`,{level:`warn`})}return n?e:null}async function T(e){let t=u(),n=Object.keys(t.plugins);return n.length===0?[]:(await Promise.allSettled(n.map(async n=>{let{marketplace:a}=i(n);if(!a||!e.has(a.toLowerCase()))return null;let o=t.plugins[n];if(!o||o.length===0)return null;let s=o.filter(r);return s.length===0?null:w(n,s)}))).filter(e=>e.status===`fulfilled`&&e.value!==null).map(e=>e.value)}async function E(e){return T(e)}function D(){(async()=>{if(_()){m(`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 l(e,void 0,{disableCredentialHelper:!0})}catch(t){m(`Plugin autoupdate: failed to refresh marketplace ${e}: ${p(t)}`,{level:`warn`})}}))).filter(e=>e.status===`rejected`);t.length>0&&m(`Plugin autoupdate: ${t.length} marketplace refresh(es) failed`,{level:`warn`}),m(`Plugin autoupdate: checking installed plugins`);let n=await E(e);n.length>0&&(O?O(n):k=n)}catch(e){y(e)}})()}var O,k,A=e((()=>{x(),g(),h(),f(),v(),o(),c(),a(),t(),O=null,k=null}));export{T as i,A as n,S as r,D as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Za as e,fo as t,lo as n,mo as r,ro as i}from"./loadAgentsDir-
|
|
1
|
+
import{Za as e,fo as t,lo as n,mo as r,ro as i}from"./loadAgentsDir-CgDTTnMX.js";import{I as a,M as o,c as s,i as c}from"./debug-NBJH_NxR.js";import{d as l,s as u}from"./pluginOperations-qT-GGKNu.js";import{i as d,n as f,r as p,t as m}from"./pluginFlagging-1MM3zuMP.js";u(),c(),a(),e(),t(),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=i(),t=f(),a=await r(),c=[];for(let r of Object.keys(a))try{let i=await n(r);if(!i.forceRemoveDeletedPlugins)continue;let a=h(e,i,r);for(let n of a){if(n in t)continue;let r=e.plugins[n]??[];if(r.some(e=>e.scope===`user`||e.scope===`project`||e.scope===`local`)){for(let e of r){let{scope:t}=e;if(!(t!==`user`&&t!==`project`&&t!==`local`))try{await l(n,t)}catch(e){s(`Failed to auto-uninstall delisted plugin ${n} from ${t}: ${o(e)}`,{level:`error`})}}await m(n),c.push(n)}}}catch(e){s(`Failed to check for delisted plugins in "${r}": ${o(e)}`,{level:`warn`})}return c}export{g as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e,t}from"./figures-5ThXQEtq.js";import{Dx as n,Tx as r,Xa as i,Ya as a,au as o,gi as s,ou as c,su as l,vi as u}from"./loadAgentsDir-
|
|
1
|
+
import{n as e,t}from"./figures-5ThXQEtq.js";import{Dx as n,Tx as r,Xa as i,Ya as a,au as o,gi as s,ou as c,su as l,vi as u}from"./loadAgentsDir-CgDTTnMX.js";import{I as d,M as f}from"./debug-NBJH_NxR.js";import{n as p,s as m}from"./process-CewWh77C.js";import{o as h,s as g}from"./log-D98mO6yJ.js";import{n as _}from"./analytics-COpjZpvd.js";import{a as v,c as y,d as b,f as x,i as S,r as C,s as w}from"./pluginOperations-qT-GGKNu.js";e(),d(),u(),h(),i(),r(),p(),l(),_(),w();function T(e,r,i){g(e);let s=i?`${r} plugin "${i}"`:r===`disable-all`?`disable all plugins`:`${r} plugins`;console.error(`${t.cross} Failed to ${s}: ${f(e)}`);let l=i?(()=>{let{name:e,marketplace:t}=n(i);return{_PROTO_plugin_name:e,...t&&{_PROTO_marketplace_name:t},...o(e,t,a())}})():{};c(e),{...l},process.exit(1)}async function E(e,r=`user`){try{console.log(`Installing plugin "${e}"...`);let i=await y(e,r);if(!i.success)throw Error(i.message);console.log(`${t.tick} ${i.message}`);let{name:s,marketplace:c}=n(i.pluginId||e);({...c&&{_PROTO_marketplace_name:c}}),i.scope,{...o(s,c,a())},process.exit(0)}catch(t){T(t,`install`,e)}}async function D(e,r=`user`,i=!1){try{let s=await b(e,r,!i);if(!s.success)throw Error(s.message);console.log(`${t.tick} ${s.message}`);let{name:c,marketplace:l}=n(s.pluginId||e);({...l&&{_PROTO_marketplace_name:l}}),s.scope,{...o(c,l,a())},process.exit(0)}catch(t){T(t,`uninstall`,e)}}async function O(e,r){try{let i=await v(e,r);if(!i.success)throw Error(i.message);console.log(`${t.tick} ${i.message}`);let{name:s,marketplace:c}=n(i.pluginId||e);({...c&&{_PROTO_marketplace_name:c}}),i.scope,{...o(s,c,a())},process.exit(0)}catch(t){T(t,`enable`,e)}}async function k(e,r){try{let i=await S(e,r);if(!i.success)throw Error(i.message);console.log(`${t.tick} ${i.message}`);let{name:s,marketplace:c}=n(i.pluginId||e);({...c&&{_PROTO_marketplace_name:c}}),i.scope,{...o(s,c,a())},process.exit(0)}catch(t){T(t,`disable`,e)}}async function A(){try{let e=await C();if(!e.success)throw Error(e.message);console.log(`${t.tick} ${e.message}`),process.exit(0)}catch(e){T(e,`disable-all`)}}async function j(e,r){try{m(`Checking for updates for plugin "${e}" at ${r} scope…\n`);let i=await x(e,r);if(!i.success)throw Error(i.message);if(m(`${t.tick} ${i.message}\n`),!i.alreadyUpToDate){let{name:t,marketplace:r}=n(i.pluginId||e);({...r&&{_PROTO_marketplace_name:r}}),i.oldVersion,i.newVersion,{...o(t,r,a())}}await s(0)}catch(t){T(t,`update`,e)}}export{D as a,E as i,k as n,j as o,O as r,A as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{dx as t,ux as n}from"./loadAgentsDir-
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{dx as t,ux as n}from"./loadAgentsDir-CgDTTnMX.js";import{C as r,S as i,c as a,f as o,i as s,u as c,x as l}from"./debug-NBJH_NxR.js";import{o as u,s as d}from"./log-D98mO6yJ.js";import{join as f}from"path";import{randomBytes as p}from"crypto";import{readFile as m,rename as h,unlink as g,writeFile as _}from"fs/promises";function v(){return f(n(),D)}function y(e){let t=i(e);if(typeof t!=`object`||!t||!(`plugins`in t)||typeof t.plugins!=`object`||t.plugins===null)return{};let n=t.plugins,r={};for(let[e,t]of Object.entries(n))if(t&&typeof t==`object`&&`flaggedAt`in t&&typeof t.flaggedAt==`string`){let n={flaggedAt:t.flaggedAt};`seenAt`in t&&typeof t.seenAt==`string`&&(n.seenAt=t.seenAt),r[e]=n}return r}async function b(){try{return y(await m(v(),{encoding:`utf-8`}))}catch{return{}}}async function x(e){let t=v(),i=`${t}.${p(8).toString(`hex`)}.tmp`;try{await c().mkdir(n()),await _(i,r({plugins:e},null,2),{encoding:`utf-8`,mode:384}),await h(i,t),k=e}catch(e){d(e);try{await g(i)}catch{}}}async function S(){let e=await b(),t=Date.now(),n=!1;for(let[r,i]of Object.entries(e))i.seenAt&&t-new Date(i.seenAt).getTime()>=O&&(delete e[r],n=!0);k=e,n&&await x(e)}function C(){return k??{}}async function w(e){k===null&&(k=await b()),await x({...k,[e]:{flaggedAt:new Date().toISOString()}}),a(`Flagged plugin: ${e}`)}async function T(e){k===null&&(k=await b());let t=new Date().toISOString(),n=!1,r={...k};for(let i of e){let e=r[i];e&&!e.seenAt&&(r[i]={...e,seenAt:t},n=!0)}n&&await x(r)}async function E(e){if(k===null&&(k=await b()),!(e in k))return;let{[e]:t,...n}=k;k=n,await x(n)}var D,O,k,A=e((()=>{s(),o(),u(),l(),t(),D=`flagged-plugins.json`,O=2880*60*1e3,k=null}));export{T as a,S as i,C as n,E as o,A as r,w as t};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{m as t,s as n,y as r}from"./settings-CA-5Px85.js";import{Pt as i,q as a}from"./state-CXY-q5gr.js";import{Cx as o,Dx as s,Fa as c,Fo as l,Ga as u,Ha as d,Ia as f,Io as p,Ja as m,Ka as h,La as g,Mx as _,Na as v,Nx as y,Ox as b,Pa as x,Po as S,Qm as C,Sx as w,Tx as T,Va as E,Wa as D,Xm as O,Za as ee,ao as te,do as k,dx as A,fo as j,io as ne,ja as re,lo as ie,no as M,po as ae,qa as oe,ro as N,sx as se,wx as ce,za as P}from"./loadAgentsDir-
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{m as t,s as n,y as r}from"./settings-CA-5Px85.js";import{Pt as i,q as a}from"./state-CXY-q5gr.js";import{Cx as o,Dx as s,Fa as c,Fo as l,Ga as u,Ha as d,Ia as f,Io as p,Ja as m,Ka as h,La as g,Mx as _,Na as v,Nx as y,Ox as b,Pa as x,Po as S,Qm as C,Sx as w,Tx as T,Va as E,Wa as D,Xm as O,Za as ee,ao as te,do as k,dx as A,fo as j,io as ne,ja as re,lo as ie,no as M,po as ae,qa as oe,ro as N,sx as se,wx as ce,za as P}from"./loadAgentsDir-CgDTTnMX.js";import{I as F,R as I,V as L,f as R,u as z}from"./debug-NBJH_NxR.js";import{o as B,s as V}from"./log-D98mO6yJ.js";import{l as H,o as U}from"./stringUtils-CtJhTszO.js";import{n as W,t as G}from"./pluginStartupCheck-DXPIrR7f.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`?a():void 0}function de(e){return n(`projectSettings`)?.enabledPlugins?.[e]===!0}function fe(e){let t=e.includes(`@`);for(let r of[`local`,`project`,`user`]){let i=n(b(r))?.enabledPlugins;if(i){for(let n of Object.keys(i))if(t?n===e:n.startsWith(`${e}@`))return{pluginId:n,scope:r}}}return null}function pe(e,t){let{name:n,marketplace:r}=s(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}=s(e),n=N();if(n.plugins[e]?.length)return{pluginId:e,pluginName:t};let r=Object.keys(n.plugins).find(e=>{let{name:r}=s(e);return r===t&&(n.plugins[e]?.length??0)>0});return r?{pluginId:r,pluginName:t}:null}function Y(e){let t=N().plugins[e];if(!t||t.length===0)return{scope:`user`};let n=a(),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 o=t.find(e=>e.scope===`user`);return o?{scope:o.scope}:{scope:t[0].scope,projectPath:t[0].projectPath}}async function he(e,t=`user`){q(t);let{name:n,marketplace:r}=s(e),i,a,o;if(r){let t=await k(e);t&&(i=t.entry,a=r,o=t.marketplaceInstallLocation)}else{let e=await ae();for(let[t,r]of Object.entries(e))try{let e=(await ie(t)).plugins.find(e=>e.name===n);if(e){i=e,a=t,o=r.installLocation;break}}catch(e){V(L(e))}}if(!i||!a)return{success:!1,message:`Plugin "${n}" not found in ${r?`marketplace "${r}"`:`any configured marketplace`}`};let c=i,l=`${c.name}@${a}`,u=await D({pluginId:l,entry:c,scope:t,marketplaceInstallLocation:o});if(!u.ok){let e=u;switch(e.reason){case`local-source-no-location`:return{success:!1,message:`Cannot install local plugin "${e.pluginName}" without marketplace install location`};case`settings-write-failed`:return{success:!1,message:`Failed to update settings: ${e.message}`};case`resolution-failed`:return{success:!1,message:E(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: ${l} (scope: ${t})${u.depNote}`,pluginId:l,pluginName:c.name,scope:t}}async function ge(e,t=`user`,i=!0){q(t);let{enabled:a,disabled:s}=await g(),c=[...a,...s],l=pe(e,c),u=b(t),d=n(u),f,m;if(l)f=Object.keys(d?.enabledPlugins??{}).find(t=>t===e||t===l.name||t.startsWith(`${l.name}@`))??(e.includes(`@`)?e:l.name),m=l.name;else{let t=me(e);if(!t)return{success:!1,message:`Plugin "${e}" not found in installed plugins`};f=t.pluginId,m=t.pluginName}let h=J(t),_=N().plugins[f],v=_?.find(e=>e.scope===t&&e.projectPath===h);if(!v){let{scope:n}=Y(f);return n!==t&&_&&_.length>0?n===`project`?{success:!1,message:`Plugin "${e}" is enabled at project scope (.workmate/settings.json, shared with your team). To disable just for you: claude plugin disable ${e} --scope local`}:{success:!1,message:`Plugin "${e}" is installed in ${n} scope, not ${t}. Use --scope ${n} to uninstall.`}:{success:!1,message:`Plugin "${e}" is not installed in ${t} scope. Use --scope to specify the correct scope.`}}let y=v.installPath,x={...d?.enabledPlugins};x[f]=void 0,r(u,{enabledPlugins:x}),S(),ne(f,t,h);let C=N().plugins[f],T=!C||C.length===0;T&&y&&await p(y),T&&(O(f),i&&await se(f));let E=w(f,c),D=o(E);return{success:!0,message:`Successfully uninstalled plugin: ${m} (scope: ${t})${D}`,pluginId:f,pluginName:m,scope:t,reverseDependents:E.length>0?E:void 0}}async function X(e,t,i){let a=t?`enable`:`disable`;if(y(e)){let{error:i}=r(`userSettings`,{enabledPlugins:{...n(`userSettings`)?.enabledPlugins,[e]:t}});if(i)return{success:!1,message:`Failed to ${a} built-in plugin: ${i.message}`};S();let{name:o}=s(e);return{success:!0,message:`Successfully ${a}d built-in plugin: ${o}`,pluginId:e,pluginName:o,scope:`user`}}i&&q(i);let c,l,u=fe(e);if(i)if(l=i,u)c=u.pluginId;else if(e.includes(`@`))c=e;else return{success:!1,message:`Plugin "${e}" not found in settings. Use plugin@marketplace format.`};else if(u)c=u.pluginId,l=u.scope;else if(e.includes(`@`))c=e,l=`user`;else return{success:!1,message:`Plugin "${e}" not found in any editable settings scope. Use plugin@marketplace format.`};if(t&&m(c))return{success:!1,message:`Plugin "${c}" is blocked by your organization's policy and cannot be enabled`};let d=b(l),f=n(d)?.enabledPlugins?.[c],p={user:0,project:1,local:2},h=i&&u&&p[i]>p[u.scope];if(i&&f===void 0&&u&&u.scope!==i&&!h)return{success:!1,message:`Plugin "${e}" is installed at ${u.scope} scope, not ${i}. Use --scope ${u.scope} or omit --scope to auto-detect.`};if(t===(i&&!h?f===!0:G().has(c)))return{success:!1,message:`Plugin "${e}" is already ${t?`enabled`:`disabled`}${i?` at ${i} scope`:``}`};let _;if(!t){let{enabled:e,disabled:t}=await g(),n=w(c,[...e,...t]);n.length>0&&(_=n)}let{error:v}=r(d,{enabledPlugins:{...n(d)?.enabledPlugins,[c]:t}});if(v)return{success:!1,message:`Failed to ${a} plugin: ${v.message}`};S();let{name:x}=s(c),C=o(_);return{success:!0,message:`Successfully ${a}d plugin: ${x} (scope: ${l})${C}`,pluginId:c,pluginName:x,scope:l,reverseDependents:_}}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
2
|
`)}`}:{success:!0,message:`Disabled ${t.length} ${H(t.length,`plugin`)}`}}async function ye(e,t){let{name:n,marketplace:r}=s(e),i=r?`${n}@${r}`:e,a=await k(e);if(!a)return{success:!1,message:`Plugin "${n}" not found`,pluginId:i,scope:t};let{entry:o,marketplaceInstallLocation:c}=a,l=M().plugins[i];if(!l||l.length===0)return{success:!1,message:`Plugin "${n}" is not installed`,pluginId:i,scope:t};let u=J(t),d=l.find(e=>e.scope===t&&e.projectPath===u);return d?be({pluginId:i,pluginName:n,entry:o,marketplaceInstallLocation:c,installation:d,scope:t,projectPath:u}):{success:!1,message:`Plugin "${n}" is not installed at scope ${u?`${t} (${u})`:t}`,pluginId:i,scope:t}}async function be({pluginId:e,pluginName:t,entry:n,marketplaceInstallLocation:r,installation:i,scope:a,projectPath:o}){let s=z(),l=i.version,d,f,m=!1,h;if(typeof n.source!=`string`){let t=await re(n.source,{manifest:{name:n.name}});d=t.path,m=!0,h=t.gitCommitSha,f=await u(e,n.source,t.manifest,t.path,n.version,t.gitCommitSha)}else{let t;try{t=await s.stat(r)}catch(t){if(I(t))return{success:!1,message:`Marketplace directory not found at ${r}`,pluginId:e,scope:a};throw t}d=K(t.isDirectory()?r:le(r),n.source);try{await s.stat(d)}catch(t){if(I(t))return{success:!1,message:`Plugin source not found at ${d}`,pluginId:e,scope:a};throw t}let i,o=K(d,`.claude-plugin`,`plugin.json`);try{i=await P(o,n.name,n.source)}catch{}f=await u(e,n.source,i,d,n.version)}try{let r=x(e,f),s=c(e,f);if(i.version===f||i.installPath===r||i.installPath===s)return{success:!0,message:`${t} is already at the latest version (${f}).`,pluginId:e,newVersion:f,oldVersion:l,alreadyUpToDate:!0,scope:a};r=await v(d,e,f,n);let u=i.installPath;if(te(e,a,o,r,f,h),u&&u!==r){let e=M();Object.values(e.plugins).some(e=>e.some(e=>e.installPath===u))||await p(u)}let m=o?`${a} (${o})`:a;return{success:!0,message:`Plugin "${t}" updated from ${l||`unknown`} to ${f} for scope ${m}. Restart to apply changes.`,pluginId:e,newVersion:f,oldVersion:l,scope:a}}finally{m&&d!==x(e,f)&&await s.rm(d,{recursive:!0,force:!0})}}var Q,$,xe=e((()=>{i(),_(),F(),R(),B(),l(),ce(),ee(),j(),A(),T(),d(),f(),C(),oe(),W(),h(),t(),U(),Q=[`user`,`project`,`local`],$=[`user`,`project`,`local`,`managed`]}));export{_e as a,he as c,ge as d,ye as f,ve as i,ue as l,$ as n,Y as o,Z as r,xe as s,Q as t,de as u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e,t}from"./pluginStartupCheck-DXPIrR7f.js";e();export{t as getPluginEditableScopes};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{gt as t,m as n,s as r}from"./settings-CA-5Px85.js";import{Ax as i,Ha as a,Tx as o,Za as s,fo as c,kx as l}from"./loadAgentsDir-
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{gt as t,m as n,s as r}from"./settings-CA-5Px85.js";import{Ax as i,Ha as a,Tx as o,Za as s,fo as c,kx as l}from"./loadAgentsDir-CgDTTnMX.js";import{n as u}from"./cwd-DrEEb4f5.js";import{c as d,i as f}from"./debug-NBJH_NxR.js";import{o as p}from"./log-D98mO6yJ.js";import"path";function m(){let e=new Map,t=l();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:i}of[{scope:`managed`,source:`policySettings`},{scope:`user`,source:`userSettings`},{scope:`project`,source:`projectSettings`},{scope:`local`,source:`localSettings`},{scope:`flag`,source:`flagSettings`}]){let a=r(i);if(a?.enabledPlugins)for(let[r,o]of Object.entries(a.enabledPlugins))r.includes(`@`)&&(r in t&&t[r]!==o&&d(`Plugin ${r} from --add-dir (${t[r]}) overridden by ${i} (${o})`),o===!0?e.set(r,n):o===!1&&e.delete(r))}return d(`Found ${e.size} enabled plugins with scopes: ${Array.from(e.entries()).map(([e,t])=>`${e}(${t})`).join(`, `)}`),e}var h=e((()=>{u(),f(),p(),n(),i(),s(),c(),o(),a(),t()}));export{h as n,m as t};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{n as e,t}from"./figures-5ThXQEtq.js";import{Bn as n,Pt as r}from"./state-CXY-q5gr.js";import{Ao as i,Dx as a,Fo as o,Fx as s,Ia as c,La as l,Mo as u,Ox as d,Po as f,Px as p,Tx as m,Za as h,bf as g,bo as _,fo as ee,go as v,ho as y,oo as b,po as x,ro as S,to as C,vo as w,wo as te,yf as ne}from"./loadAgentsDir-
|
|
1
|
+
import{n as e,t}from"./figures-5ThXQEtq.js";import{Bn as n,Pt as r}from"./state-CXY-q5gr.js";import{Ao as i,Dx as a,Fo as o,Fx as s,Ia as c,La as l,Mo as u,Ox as d,Po as f,Px as p,Tx as m,Za as h,bf as g,bo as _,fo as ee,go as v,ho as y,oo as b,po as x,ro as S,to as C,vo as w,wo as te,yf as ne}from"./loadAgentsDir-CgDTTnMX.js";import{C as T,I as re,M as E,x as D}from"./debug-NBJH_NxR.js";import{o as O,s as k}from"./log-D98mO6yJ.js";import{n as A}from"./analytics-COpjZpvd.js";import{l as j,o as M}from"./stringUtils-CtJhTszO.js";import{n as N,t as P}from"./exit-s9XGerrH.js";import{n as F,s as I,t as L}from"./pluginOperations-qT-GGKNu.js";import{a as R,i as z,n as B,o as V,r as H,t as U}from"./pluginCliCommands-CNpseXZD.js";import{a as W,c as G,i as ie,n as K,r as q,s as J,t as Y}from"./validatePlugin-DU3C7Mvb.js";import{basename as ae,dirname as X}from"path";e(),r(),A(),I(),s(),re(),O(),o(),G(),h(),i(),ee(),ne(),ie(),m(),c(),Y(),D(),M();function Z(e,n){k(e),P(`${t.cross} Failed to ${n}: ${E(e)}`)}function Q(e){e.errors.length>0&&(console.log(`${t.cross} Found ${e.errors.length} ${j(e.errors.length,`error`)}:\n`),e.errors.forEach(e=>{console.log(` ${t.pointer} ${e.path}: ${e.message}`)}),console.log(``)),e.warnings.length>0&&(console.log(`${t.warning} Found ${e.warnings.length} ${j(e.warnings.length,`warning`)}:\n`),e.warnings.forEach(e=>{console.log(` ${t.pointer} ${e.path}: ${e.message}`)}),console.log(``))}async function oe(e,r){r.cowork&&n(!0);try{let n=await K(e);console.log(`Validating ${n.fileType} manifest: ${n.filePath}\n`),Q(n);let r=[];if(n.fileType===`plugin`){let e=X(n.filePath);if(ae(e)===`.claude-plugin`){r=await q(X(e));for(let e of r)console.log(`Validating ${e.fileType}: ${e.filePath}\n`),Q(e)}}let i=n.success&&r.every(e=>e.success),a=n.warnings.length>0||r.some(e=>e.warnings.length>0);i?N(a?`${t.tick} Validation passed with warnings`:`${t.tick} Validation passed`):(console.log(`${t.cross} Validation failed`),process.exit(1))}catch(e){k(e),console.error(`${t.cross} Unexpected error during validation: ${E(e)}`),process.exit(2)}}async function se(e){e.cowork&&n(!0);let r=S(),{getPluginEditableScopes:i}=await import(`./pluginStartupCheck-CCDpCchC.js`),o=i(),s=Object.keys(r.plugins),{enabled:c,disabled:d,errors:f}=await l(),m=[...c,...d],h=m.filter(e=>e.source.endsWith(`@inline`)),_=f.filter(e=>e.source.endsWith(`@inline`)||e.source.startsWith(`inline[`));if(e.json){let t=new Map(m.map(e=>[e.source,e])),n=[];for(let e of s.sort()){let i=r.plugins[e];if(!i||i.length===0)continue;let s=a(e).name,c=f.filter(t=>t.source===e||`plugin`in t&&t.plugin===s).map(p);for(let r of i){let i=t.get(e),a;if(i){let e=i.mcpServers||await g(i);e&&Object.keys(e).length>0&&(a=e)}n.push({id:e,version:r.version||`unknown`,scope:r.scope,enabled:o.has(e),installPath:r.installPath,installedAt:r.installedAt,lastUpdated:r.lastUpdated,projectPath:r.projectPath,mcpServers:a,errors:c.length>0?c:void 0})}}for(let e of h){let t=e.mcpServers||await g(e),r=_.filter(t=>t.source===e.source||`plugin`in t&&t.plugin===e.name).map(p);n.push({id:e.source,version:e.manifest.version??`unknown`,scope:`session`,enabled:e.enabled!==!1,installPath:e.path,mcpServers:t&&Object.keys(t).length>0?t:void 0,errors:r.length>0?r:void 0})}for(let e of _.filter(e=>e.source.startsWith(`inline[`)))n.push({id:e.source,version:`unknown`,scope:`session`,enabled:!1,installPath:`path`in e?e.path:``,errors:[p(e)]});if(e.available){let e=[];try{let[t,n]=await Promise.all([x(),J()]),{marketplaces:r}=await u(t);for(let{name:t,data:i}of r)if(i)for(let r of i.plugins){let i=te(r.name,t);C(i)||e.push({pluginId:i,name:r.name,description:r.description,marketplaceName:t,version:r.version,source:r.source,installCount:n?.get(i)})}}catch{}N(T({installed:n,available:e},null,2))}else N(T(n,null,2))}s.length===0&&h.length===0&&_.length===0&&N("No plugins installed. Use `wm plugin install` to install a plugin."),s.length>0&&console.log(`Installed plugins:
|
|
2
2
|
`);for(let e of s.sort()){let n=r.plugins[e];if(!n||n.length===0)continue;let i=a(e).name,s=f.filter(t=>t.source===e||`plugin`in t&&t.plugin===i);for(let r of n){let n=o.has(e),i=s.length>0?`${t.cross} failed to load`:n?`${t.tick} enabled`:`${t.cross} disabled`,a=r.version||`unknown`,c=r.scope;console.log(` ${t.pointer} ${e}`),console.log(` Version: ${a}`),console.log(` Scope: ${c}`),console.log(` Status: ${i}`);for(let e of s)console.log(` Error: ${p(e)}`);console.log(``)}}if(h.length>0||_.length>0){console.log(`Session-only plugins (--plugin-dir):
|
|
3
3
|
`);for(let e of h){let n=_.filter(t=>t.source===e.source||`plugin`in t&&t.plugin===e.name),r=n.length>0?`${t.cross} loaded with errors`:`${t.tick} loaded`;console.log(` ${t.pointer} ${e.source}`),console.log(` Version: ${e.manifest.version??`unknown`}`),console.log(` Path: ${e.path}`),console.log(` Status: ${r}`);for(let e of n)console.log(` Error: ${p(e)}`);console.log(``)}for(let e of _.filter(e=>e.source.startsWith(`inline[`)))console.log(` ${t.pointer} ${e.source}: ${t.cross} ${p(e)}\n`)}N()}async function ce(e,r){r.cowork&&n(!0);try{let n=await W(e);n||P(`${t.cross} Invalid marketplace source format. Try: owner/repo, https://..., or ./path`),`error`in n&&P(`${t.cross} ${n.error}`);let i=r.scope??`user`;i!==`user`&&i!==`project`&&i!==`local`&&P(`${t.cross} Invalid scope '${i}'. Use: user, project, or local`);let a=d(i),o=n;r.sparse&&r.sparse.length>0&&(o.source===`github`||o.source===`git`?o={...o,sparsePaths:r.sparse}:P(`${t.cross} --sparse is only supported for github and git marketplace sources (got: ${o.source})`)),console.log(`Adding marketplace...`);let{name:s,alreadyMaterialized:c,resolvedSource:l}=await b(o,e=>{console.log(e)});_(s,{source:l},a),f(),o.source,o.source===`github`&&o.repo,N(c?`${t.tick} Marketplace '${s}' already on disk — declared in ${i} settings`:`${t.tick} Successfully added marketplace: ${s} (declared in ${i} settings)`)}catch(e){Z(e,`add marketplace`)}}async function le(e){e.cowork&&n(!0);try{let n=await x(),r=Object.keys(n);e.json&&N(T(r.sort().map(e=>{let t=n[e],r=t?.source;return{name:e,source:r?.source,...r?.source===`github`&&{repo:r.repo},...r?.source===`git`&&{url:r.url},...r?.source===`url`&&{url:r.url},...r?.source===`directory`&&{path:r.path},...r?.source===`file`&&{path:r.path},installLocation:t?.installLocation}}),null,2)),r.length===0&&N(`No marketplaces configured`),console.log(`Configured marketplaces:
|
|
4
4
|
`),r.forEach(e=>{let r=n[e];if(console.log(` ${t.pointer} ${e}`),r?.source){let e=r.source;e.source===`github`?console.log(` Source: GitHub (${e.repo})`):e.source===`git`?console.log(` Source: Git (${e.url})`):e.source===`url`?console.log(` Source: URL (${e.url})`):e.source===`directory`?console.log(` Source: Directory (${e.path})`):e.source===`file`&&console.log(` Source: File (${e.path})`)}console.log(``)}),N()}catch(e){Z(e,`list marketplaces`)}}async function $(e,r){r.cowork&&n(!0);try{await w(e),f(),N(`${t.tick} Successfully removed marketplace: ${e}`)}catch(e){Z(e,`remove marketplace`)}}async function ue(e,r){r.cowork&&n(!0);try{if(e)console.log(`Updating marketplace: ${e}...`),await v(e,e=>{console.log(e)}),f(),N(`${t.tick} Successfully updated marketplace: ${e}`);else{let e=await x(),n=Object.keys(e);n.length===0&&N(`No marketplaces configured`),console.log(`Updating ${n.length} marketplace(s)...`),await y(),f(),n.length,N(`${t.tick} Successfully updated ${n.length} marketplace(s)`)}}catch(e){Z(e,`update marketplace(s)`)}}async function de(e,t){t.cowork&&n(!0);let r=t.scope||`user`;t.cowork&&r!==`user`&&P(`--cowork can only be used with user scope`),L.includes(r)||P(`Invalid scope: ${r}. Must be one of: ${L.join(`, `)}.`);let{name:i,marketplace:o}=a(e);({...o&&{_PROTO_marketplace_name:o}}),await z(e,r)}async function fe(e,t){t.cowork&&n(!0);let r=t.scope||`user`;t.cowork&&r!==`user`&&P(`--cowork can only be used with user scope`),L.includes(r)||P(`Invalid scope: ${r}. Must be one of: ${L.join(`, `)}.`);let{name:i,marketplace:o}=a(e);({...o&&{_PROTO_marketplace_name:o}}),await R(e,r,t.keepData)}async function pe(e,t){t.cowork&&n(!0);let r;t.scope&&(L.includes(t.scope)||P(`Invalid scope "${t.scope}". Valid scopes: ${L.join(`, `)}`),r=t.scope),t.cowork&&r!==void 0&&r!==`user`&&P(`--cowork can only be used with user scope`),t.cowork&&r===void 0&&(r=`user`);let{name:i,marketplace:o}=a(e);({...o&&{_PROTO_marketplace_name:o}}),await H(e,r)}async function me(e,t){if(t.all&&e&&P(`Cannot use --all with a specific plugin`),!t.all&&!e&&P(`Please specify a plugin name or use --all to disable all plugins`),t.cowork&&n(!0),t.all){t.scope&&P(`Cannot use --scope with --all`),await U();return}let r;t.scope&&(L.includes(t.scope)||P(`Invalid scope "${t.scope}". Valid scopes: ${L.join(`, `)}`),r=t.scope),t.cowork&&r!==void 0&&r!==`user`&&P(`--cowork can only be used with user scope`),t.cowork&&r===void 0&&(r=`user`);let{name:i,marketplace:o}=a(e);({...o&&{_PROTO_marketplace_name:o}}),await B(e,r)}async function he(e,t){t.cowork&&n(!0);let{name:r,marketplace:i}=a(e);({...i&&{_PROTO_marketplace_name:i}});let o=`user`;t.scope&&(F.includes(t.scope)||P(`Invalid scope "${t.scope}". Valid scopes: ${F.join(`, `)}`),o=t.scope),t.cowork&&o!==`user`&&P(`--cowork can only be used with user scope`),await V(e,o)}export{ce as marketplaceAddHandler,le as marketplaceListHandler,$ as marketplaceRemoveHandler,ue as marketplaceUpdateHandler,me as pluginDisableHandler,pe as pluginEnableHandler,de as pluginInstallHandler,se as pluginListHandler,fe as pluginUninstallHandler,he as pluginUpdateHandler,oe as pluginValidateHandler};
|