@readmagic/workmate 0.0.10 → 0.0.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/{AddWorkspaceDirectory-Vmmm7p1c.js → AddWorkspaceDirectory-CtRxzRny.js} +1 -1
- package/dist/chunks/AgentsMdExternalIncludesDialog-_bI4jo_P.js +1 -0
- package/dist/chunks/AgentsMdExternalIncludesDialog-_yJJ0wqu.js +1 -0
- package/dist/chunks/App-DoAZ7CYS.js +1 -0
- package/dist/chunks/ApproveApiKey-C8LwmDM2.js +1 -0
- package/dist/chunks/ApproveApiKey-DQP3qmb0.js +1 -0
- package/dist/chunks/BackgroundTasksDialog-CDA2noEk.js +2 -0
- package/dist/chunks/{BypassPermissionsModeDialog-CLSACUmo.js → BypassPermissionsModeDialog-COI_V57z.js} +1 -1
- package/dist/chunks/ConsoleOAuthFlow-Dn8fO-o_.js +1 -0
- package/dist/chunks/{DiffDialog-9AYwtupw.js → DiffDialog-CRWtQ1R5.js} +3 -3
- package/dist/chunks/Doctor-CZ513Df9.js +3 -0
- package/dist/chunks/Doctor-CzPvNZzF.js +1 -0
- package/dist/chunks/ExitFlow-BFeftDv0.js +2 -0
- package/dist/chunks/{Grove-B9-hhkZA.js → Grove-DRZrhbF0.js} +2 -2
- package/dist/chunks/{HybridTransport-MxJ_W_np.js → HybridTransport-BadJQe6u.js} +4 -4
- package/dist/chunks/InvalidConfigDialog-DQaT6aen.js +1 -0
- package/dist/chunks/{InvalidSettingsDialog-YyQcHocx.js → InvalidSettingsDialog-ISzcIGPU.js} +1 -1
- package/dist/chunks/MCPConnectionManager-BpjC7CEo.js +1 -0
- package/dist/chunks/MCPToolListView-Rb1Q--jG.js +1 -0
- package/dist/chunks/{McpParsingWarnings-BCpfHaBK.js → McpParsingWarnings-xv0RZCSL.js} +1 -1
- package/dist/chunks/MessageSelector-BHB55sZb.js +3 -0
- package/dist/chunks/Messages-CPX-nIdA.js +11 -0
- package/dist/chunks/Onboarding-CymgipoF.js +1 -0
- package/dist/chunks/{PromptInputFooterSuggestions-BSA9NrZc.js → PromptInputFooterSuggestions-8-awCxOn.js} +1 -1
- package/dist/chunks/PromptInputHelpMenu-BP3UgCdi.js +1 -0
- package/dist/chunks/QueryEngine-HkswHUNv.js +1 -0
- package/dist/chunks/REPL-CZfg65kg.js +133 -0
- package/dist/chunks/REPL-eZsYNBfl.js +1 -0
- package/dist/chunks/RemoteSessionManager-B4jqKVd3.js +2 -0
- package/dist/chunks/ResumeConversation-B03XN_SP.js +1 -0
- package/dist/chunks/{SSETransport-CoxQ8YpH.js → SSETransport-je346ofV.js} +3 -3
- package/dist/chunks/SearchExtraToolsTool-C85Sanww.js +1 -0
- package/dist/chunks/Settings-C8GKWod1.js +2 -0
- package/dist/chunks/{TeleportProgress-Doucj-50.js → TeleportProgress-zmdAsogZ.js} +1 -1
- package/dist/chunks/{TeleportRepoMismatchDialog-B5I73j7Y.js → TeleportRepoMismatchDialog-CG32I4cO.js} +1 -1
- package/dist/chunks/{TeleportResumeWrapper-D6kpr2c6.js → TeleportResumeWrapper-2Yjr74Lq.js} +1 -1
- package/dist/chunks/{ThemePicker-DrC8tlp0.js → ThemePicker-p7_hHk1V.js} +1 -1
- package/dist/chunks/TrustDialog-BVcny9vs.js +1 -0
- package/dist/chunks/{ValidationErrorsList-D_OUa4RT.js → ValidationErrorsList-DSSUWdgd.js} +1 -1
- package/dist/chunks/{WelcomeV2-DvfQHnZY.js → WelcomeV2-BnSYhyfu.js} +1 -1
- package/dist/chunks/add-dir-Bd7pilVx.js +1 -0
- package/dist/chunks/{agentDisplay-B755vMZE.js → agentDisplay-CfMLGPGH.js} +1 -1
- package/dist/chunks/{agents-CIvP8l0s.js → agents-BT82hwBN.js} +1 -1
- package/dist/chunks/agents-qR6r94-F.js +103 -0
- package/dist/chunks/allErrors-CS77lRvU.js +1 -0
- package/dist/chunks/api-C4VflFau.js +1 -0
- package/dist/chunks/{api-nSHc_GIQ.js → api-DAubp5q9.js} +1 -1
- package/dist/chunks/auth-CNCehj7y.js +1 -0
- package/dist/chunks/auth-DrD9DW6X.js +1 -0
- package/dist/chunks/{auth-5QB6tsfB.js → auth-yDsvFcM7.js} +2 -2
- package/dist/chunks/{autoMode-BnUiK9Cu.js → autoMode-C2lnBot9.js} +6 -6
- package/dist/chunks/backgroundHousekeeping-DbpTGbwl.js +1 -0
- package/dist/chunks/backgroundHousekeeping-SpTxViUq.js +17 -0
- package/dist/chunks/{banner-D0P7wXdw.js → banner-BcAM7iSx.js} +1 -1
- package/dist/chunks/bg-Ci7pG4eo.js +9 -0
- package/dist/chunks/{branch-DFWa4Oxo.js → branch-DJiMa8td.js} +2 -2
- package/dist/chunks/{break-cache-Chj9i9MP.js → break-cache-4rlQORVk.js} +2 -2
- package/dist/chunks/{bridgeConfig-Bb6URf4Q.js → bridgeConfig-BB6Hgali.js} +1 -1
- package/dist/chunks/bridgeConfig-Ccm79Jze.js +1 -0
- package/dist/chunks/{bridgeMessaging-C3huGcR3.js → bridgeMessaging-C9D0Lly2.js} +1 -1
- package/dist/chunks/{bridgePointer-DLYyvRKb.js → bridgePointer-DHWK3LEe.js} +1 -1
- package/dist/chunks/{bridgeStatusUtil-DFMftajD.js → bridgeStatusUtil-D8UbcVrZ.js} +1 -1
- package/dist/chunks/{btw-DSK9R2C8.js → btw-BO2B23f-.js} +1 -1
- package/dist/chunks/caches-BQmbXerw.js +1 -0
- package/dist/chunks/caches-Dtjmjm6G.js +1 -0
- package/dist/chunks/{capacityWake-amzeeBz0.js → capacityWake-ByL6fM6I.js} +1 -1
- package/dist/chunks/ccrClient-BG9HU_fW.js +1 -0
- package/dist/chunks/{claudeDesktop-CsJfF1b-.js → claudeDesktop-Ct_hyICL.js} +1 -1
- package/dist/chunks/{clear-ClFDpWVJ.js → clear-B4XN2fib.js} +1 -1
- package/dist/chunks/cliLaunch-OPOtzhvA.js +1 -0
- package/dist/chunks/client-7lIxWcaM.js +1 -0
- package/dist/chunks/client-B-2ccQZk.js +1 -0
- package/dist/chunks/{client-DFlE4fYh.js → client-BMA05FW8.js} +1 -1
- package/dist/chunks/commands-D_-v6_A0.js +1 -0
- package/dist/chunks/compact-kM0ETtB2.js +2 -0
- package/dist/chunks/config-9rLTDOYW.js +3 -0
- package/dist/chunks/config-Crf6Mzu3.js +1 -0
- package/dist/chunks/{config-CVHMRMwd.js → config-DMKtiMzJ.js} +1 -1
- package/dist/chunks/context-BY5oO5is.js +1 -0
- package/dist/chunks/{context-noninteractive-D5iQhasu.js → context-noninteractive-mAQt1p9l.js} +5 -5
- package/dist/chunks/context-noninteractive-tc4KTYfI.js +1 -0
- package/dist/chunks/conversation-CFIn-KsW.js +1 -0
- package/dist/chunks/conversation-DPI7VKBL.js +1 -0
- package/dist/chunks/createSSHSession-DjLSGm-0.js +6 -0
- package/dist/chunks/createSession-CftIZ3aq.js +1 -0
- package/dist/chunks/createSession-CjdLcRec.js +1 -0
- package/dist/chunks/crossProjectResume-BJqXBzkf.js +40 -0
- package/dist/chunks/{cwd-Cfdf7z7s.js → cwd-Besi3Os3.js} +1 -1
- package/dist/chunks/cwd-DpqwaYHw.js +1 -0
- package/dist/chunks/datadog-BGati3aQ.js +1 -0
- package/dist/chunks/debug-Dr1SjdXn.js +39 -0
- package/dist/chunks/{debugUtils-DX0KAXNK.js → debugUtils-cK-iOsEV.js} +1 -1
- package/dist/chunks/detached-CqfQYVOi.js +5 -0
- package/dist/chunks/detectRepository-BsKZDRoI.js +1 -0
- package/dist/chunks/detectRepository-CMEkS5_2.js +1 -0
- package/dist/chunks/{diff-jEJJe58I.js → diff-1HsxKGBh.js} +1 -1
- package/dist/chunks/{directoryCompletion-BbXR2bfy.js → directoryCompletion-ByBTSuLu.js} +1 -1
- package/dist/chunks/doctor-CJfvt9zR.js +1 -0
- package/dist/chunks/entry-CrZCZQQC.js +14 -0
- package/dist/chunks/{envUtils-BDhHQY0-.js → envUtils-DcaKZlRU.js} +1 -1
- package/dist/chunks/{esm-Cf4nSRjF.js → esm-BkOWaWVb.js} +1 -1
- package/dist/chunks/{execFileNoThrow-Dwu6psHW.js → execFileNoThrow-mXq4K0rl.js} +2 -2
- package/dist/chunks/execSyncWrapper-Ne33rRiD.js +1 -0
- package/dist/chunks/exit-B8MA4Ltm.js +1 -0
- package/dist/chunks/{extraUsage-Mi66JwFZ.js → extraUsage-0pUcYexI.js} +1 -1
- package/dist/chunks/extractMemories-DqhN0lba.js +1 -0
- package/dist/chunks/fast-DT5WDe3L.js +1 -0
- package/dist/chunks/{fast-BU4iUZ8E.js → fast-VOu2FUlV.js} +1 -1
- package/dist/chunks/{fileSuggestions-BMfQIDdW.js → fileSuggestions-Be-pyLLq.js} +3 -3
- package/dist/chunks/firstPartyEventLogger-B8RVGBQB.js +1 -0
- package/dist/chunks/{firstPartyEventLogger-B3cXgR67.js → firstPartyEventLogger-aFhcruXA.js} +2 -2
- package/dist/chunks/{flushGate-DgSDVGKZ.js → flushGate-BUSrMj_6.js} +1 -1
- package/dist/chunks/gemini-DB4M-MYv.js +1 -0
- package/dist/chunks/generateSessionName-DhCypqJ_.js +1 -0
- package/dist/chunks/{genericProcessUtils-CmsUPyRz.js → genericProcessUtils-Dc1pfb7J.js} +1 -1
- package/dist/chunks/git-Bs1vtuvX.js +1 -0
- package/dist/chunks/git-CoQQ6YEf.js +6 -0
- package/dist/chunks/githubRepoPathMapping-CmpEaQoo.js +1 -0
- package/dist/chunks/goal-TxXtfkQ6.js +3 -0
- package/dist/chunks/{grok-BXMvezWb.js → grok-D2a_J5wE.js} +1 -1
- package/dist/chunks/{grove-CeOjTaY6.js → grove-BnzBbGsX.js} +1 -1
- package/dist/chunks/{help-5DNZO6_H.js → help-C5ankDi4.js} +1 -1
- package/dist/chunks/{hooks-C637tFtd.js → hooks-BZS105Rd.js} +3 -3
- package/dist/chunks/hooks-D-twhU_z.js +1 -0
- package/dist/chunks/{initReplBridge-D1h10vQ9.js → initReplBridge-DL4klK0C.js} +1 -1
- package/dist/chunks/{install-C-6ItpH0.js → install-NZvHd_40.js} +1 -1
- package/dist/chunks/{instrumentation-DaiPDUst.js → instrumentation-CjBlVlFq.js} +5 -5
- package/dist/chunks/{job-BeYzQUiR.js → job-D502Zf8J.js} +1 -1
- package/dist/chunks/jwtUtils-FQWtM6iM.js +1 -0
- package/dist/chunks/keybindings-D9Boc8FD.js +2 -0
- package/dist/chunks/{launchLocalMemory-CE4J98xO.js → launchLocalMemory-DxC3LojF.js} +2 -2
- package/dist/chunks/{launchOnboarding-BfTdC6vp.js → launchOnboarding-BLp5k_H4.js} +1 -1
- package/dist/chunks/{loadAgentsDir-C7lOqvfh.js → loadAgentsDir-BXtV2jiO.js} +563 -570
- package/dist/chunks/loadAgentsDir-BjsAQWqt.js +1 -0
- package/dist/chunks/loadPluginHooks-Dt3XQ-3N.js +1 -0
- package/dist/chunks/{localSearch-BKrznW5x.js → localSearch-CeP4ef0a.js} +1 -1
- package/dist/chunks/localSearch-Cz8Ot7k2.js +1 -0
- package/dist/chunks/{log-CezCRpAN.js → log-27kCA_9u.js} +1 -1
- package/dist/chunks/{logoV2Utils-BkQfyQ1-.js → logoV2Utils-CEnU8qad.js} +1 -1
- package/dist/chunks/{magicDocs-BpVcON9o.js → magicDocs-YtfrqVC6.js} +4 -4
- package/dist/chunks/main-CGLCy2pM.js +31 -0
- package/dist/chunks/main-CkjTzYj1.js +513 -0
- package/dist/chunks/{managedEnv-DhWRJ5DK.js → managedEnv-B-BNY0xC.js} +1 -1
- package/dist/chunks/managedEnv-K9Si1UuL.js +1 -0
- package/dist/chunks/{mappers-bOab8ipV.js → mappers-IuJeXgvr.js} +1 -1
- package/dist/chunks/mcp-DMBoeQzm.js +6 -0
- package/dist/chunks/mcp-TMOPfLcW.js +1 -0
- package/dist/chunks/mcp-x5rgv-uv.js +2 -0
- package/dist/chunks/{memoize-DsqYrbeR.js → memoize-Co4vS6UF.js} +1 -1
- package/dist/chunks/memory-DDUoR63T.js +1 -0
- package/dist/chunks/{mode-DlKnUM8l.js → mode-GzBwK--u.js} +2 -2
- package/dist/chunks/model-BydaMaPr.js +1 -0
- package/dist/chunks/model-CDnVaVDR.js +1 -0
- package/dist/chunks/model-CIvbC7rW.js +1 -0
- package/dist/chunks/{modelOptions-CxP067Qv.js → modelOptions-ut0xePEe.js} +1 -1
- package/dist/chunks/nativeInstaller-fgCMR_c0.js +1 -0
- package/dist/chunks/oauth-D38aRTUb.js +1 -0
- package/dist/chunks/oauth-U649LV5H.js +1 -0
- package/dist/chunks/{observationStore-BpjlK0pG.js → observationStore-D0rm3GhP.js} +1 -1
- package/dist/chunks/omit-D4Udf-p-.js +1 -0
- package/dist/chunks/onChangeAppState-WbvtqDtk.js +1 -0
- package/dist/chunks/{openai-B9C2XN5Q.js → openai-DaVFXyBB.js} +3 -3
- package/dist/chunks/panel-CoF2a-h4.js +1 -0
- package/dist/chunks/parser-B2PlJg4C.js +1 -0
- package/dist/chunks/{parser-BwPXQomy.js → parser-CUUiH40T.js} +1 -1
- package/dist/chunks/{partition-D-UhsUCx.js → partition-CzW_31Y1.js} +1 -1
- package/dist/chunks/permissions-BT3lxYBM.js +3 -0
- package/dist/chunks/pidLock-d1VPd6CG.js +3 -0
- package/dist/chunks/{plan-CyU2zrCK.js → plan-M9DG3AqN.js} +1 -1
- package/dist/chunks/{platform-BMPbglug.js → platform-Dg1c9F_1.js} +1 -1
- package/dist/chunks/plugin-BiNHuq3h.js +17 -0
- package/dist/chunks/pluginAutoupdate-B5lel6s5.js +1 -0
- package/dist/chunks/pluginBlocklist-CNGmIlwU.js +1 -0
- package/dist/chunks/pluginCliCommands-WLOEhb2M.js +1 -0
- package/dist/chunks/pluginFlagging-CXSSOj4J.js +1 -0
- package/dist/chunks/pluginOperations-BFbty6WT.js +2 -0
- package/dist/chunks/pluginStartupCheck-BEd0VeQC.js +1 -0
- package/dist/chunks/pluginStartupCheck-Bcdxg484.js +1 -0
- package/dist/chunks/plugins-BMZ3aYKP.js +4 -0
- package/dist/chunks/poorMode-Djw0P9Gu.js +1 -0
- package/dist/chunks/{poorMode-DEwQOAJt.js → poorMode-DxgO_bUb.js} +1 -1
- package/dist/chunks/print-DmoLcwVq.js +26 -0
- package/dist/chunks/processBashCommand-B-VqME9O.js +1 -0
- package/dist/chunks/processSlashCommand-D6zEooTy.js +5 -0
- package/dist/chunks/{projectContext-CIxul6vA.js → projectContext-BN2ZWzOG.js} +1 -1
- package/dist/chunks/{projectContext-RUMJB798.js → projectContext-Bw3o5BrN.js} +1 -1
- package/dist/chunks/prompt-C3RRe4kW.js +1 -0
- package/dist/chunks/{prompt-M2lu8_Oa.js → prompt-CRc2QEZ5.js} +5 -5
- package/dist/chunks/prompt-EtAanewG.js +1 -0
- package/dist/chunks/{promptEditor-DhcZY-iu.js → promptEditor-Bo1d8ZLq.js} +2 -2
- package/dist/chunks/{protocolHandler-CkFaJKKo.js → protocolHandler-B83fCYI4.js} +4 -4
- package/dist/chunks/{proxy-CuMaO_YV.js → proxy-BEKNaTXI.js} +3 -3
- package/dist/chunks/rcDebugLog-DSchf3Hs.js +1 -0
- package/dist/chunks/reconciler-BGav_ezX.js +1 -0
- package/dist/chunks/refresh-DumNiLvM.js +1 -0
- package/dist/chunks/{registerProtocol-CsNYRZKr.js → registerProtocol-DduKPsn_.js} +2 -2
- package/dist/chunks/{reload-plugins-B7JAE3b4.js → reload-plugins-DNEgQ5vo.js} +1 -1
- package/dist/chunks/{remoteBridgeCore-CFLJhsB6.js → remoteBridgeCore-BGOqHADF.js} +1 -1
- package/dist/chunks/remoteManagedSettings-26nhzuca.js +1 -0
- package/dist/chunks/{rename-BCp2Vtqu.js → rename-BPknfVGF.js} +1 -1
- package/dist/chunks/{renderOptions-Q5oCLFIC.js → renderOptions-45A-EdsK.js} +1 -1
- package/dist/chunks/resume-DGz04xDh.js +2 -0
- package/dist/chunks/ripgrep-BLQnqPnE.js +1 -0
- package/dist/chunks/{ripgrep-DvOOsDMv.js → ripgrep-DQ_ILUJV.js} +5 -5
- package/dist/chunks/{runtimeObserver-CS_3BDNo.js → runtimeObserver-BZrF3GnQ.js} +4 -4
- package/dist/chunks/{runtimeObserver-DYUva6g-.js → runtimeObserver-CBV-7-w7.js} +1 -1
- package/dist/chunks/sandbox-adapter-DUqeqkQD.js +1 -0
- package/dist/chunks/sandbox-toggle-D61gVqcT.js +1 -0
- package/dist/chunks/searchExtraTools-CgsV6kb1.js +1 -0
- package/dist/chunks/{session-CO3gEqQP.js → session-Dy-_R7KP.js} +2 -2
- package/dist/chunks/sessionFileAccessHooks-BJlrZaRD.js +1 -0
- package/dist/chunks/sessionObserver-BGYoLRGx.js +1 -0
- package/dist/chunks/{sessionObserver-YkRHC-Aa.js → sessionObserver-CyLpHSkw.js} +1 -1
- package/dist/chunks/{sessionState-Bifmu95-.js → sessionState-DSWN4tMV.js} +2 -2
- package/dist/chunks/sessionStorage-zJ1esSCE.js +1 -0
- package/dist/chunks/{sessionStoragePortable-JZnGwqUM.js → sessionStoragePortable-BhkGMZWp.js} +1 -1
- package/dist/chunks/{sessionTitle-COBSgSXS.js → sessionTitle-L5tyJgdU.js} +2 -2
- package/dist/chunks/{sessionTracing-BrNx1k2V.js → sessionTracing-DpHGGIZm.js} +3 -3
- package/dist/chunks/settings-3ionQKNv.js +1 -0
- package/dist/chunks/settings-DiBMs2gM.js +20 -0
- package/dist/chunks/settingsSync-dBqlrbcU.js +1 -0
- package/dist/chunks/setup-zf3v3ICe.js +3 -0
- package/dist/chunks/{shadowedRuleDetection-DEaw-X5j.js → shadowedRuleDetection-DZ0AA2Rw.js} +1 -1
- package/dist/chunks/{shellQuote-BYeOv3Ip.js → shellQuote-C_I6DHLV.js} +2 -2
- package/dist/chunks/{sideQuestion-D0OKljee.js → sideQuestion-BYT8FdPF.js} +2 -2
- package/dist/chunks/sinks-DppGvgz1.js +1 -0
- package/dist/chunks/sinks-mFsijQ_S.js +2 -0
- package/dist/chunks/skillChangeDetector-D-iq09Xs.js +1 -0
- package/dist/chunks/{skillGapStore-N_kmvXML.js → skillGapStore-DQXHqoP7.js} +2 -2
- package/dist/chunks/{skillLifecycle-C4F5RXuh.js → skillLifecycle-BG_RnGSh.js} +2 -2
- package/dist/chunks/skillSearchPanel-DxYP4Q6R.js +21 -0
- package/dist/chunks/skills-BD-2ofXA.js +1 -0
- package/dist/chunks/startupProfiler-CUlV07MD.js +1 -0
- package/dist/chunks/{startupProfiler-L_UWZ03w.js → startupProfiler-Dc5r6LgE.js} +2 -2
- package/dist/chunks/{state-BemZdQIl.js → state-BPFYBqm1.js} +1 -1
- package/dist/chunks/state-CsdHk8n-.js +1 -0
- package/dist/chunks/{stats-IzV0_vEc.js → stats-BkadEKa-.js} +1 -1
- package/dist/chunks/status-BmHu-c7I.js +2 -0
- package/dist/chunks/{status-CeVP_uDT.js → status-CrmnCDIE.js} +1 -1
- package/dist/chunks/{statusNoticeHelpers-Bb9gxdSt.js → statusNoticeHelpers-DakAVtQO.js} +1 -1
- package/dist/chunks/{stringUtils-C84IJ91d.js → stringUtils-Df-Lnjxd.js} +1 -1
- package/dist/chunks/{subprocessEnv-Ci8VV_bi.js → subprocessEnv-CNBOhlDV.js} +1 -1
- package/dist/chunks/subprocessEnv-DtBCqQIo.js +1 -0
- package/dist/chunks/switcher-Dm646gO5.js +1 -0
- package/dist/chunks/switcher-sYTxnJQA.js +1 -0
- package/dist/chunks/syncCache-BofuFJEe.js +1 -0
- package/dist/chunks/{tasks-DZDhgx0w.js → tasks-NpI1iEem.js} +1 -1
- package/dist/chunks/teleport-Bs3kEipi.js +1 -0
- package/dist/chunks/{templateJobs-CrNPEKkh.js → templateJobs-C94jEE6O.js} +2 -2
- package/dist/chunks/{terminalSetup-CBqcwQll.js → terminalSetup-CbXKCpWM.js} +1 -1
- package/dist/chunks/{terminalSetup-D-N8YPiQ.js → terminalSetup-fwhFTxGi.js} +4 -4
- package/dist/chunks/{theme-Dazsirbw.js → theme-CEi3b_8f.js} +1 -1
- package/dist/chunks/tmux-d3cNCIZA.js +1 -0
- package/dist/chunks/{toolEventObserver-lnHJ9fLQ.js → toolEventObserver-DlL9CHmI.js} +1 -1
- package/dist/chunks/toolPool-DIT_uhtD.js +1 -0
- package/dist/chunks/trustedDevice-BokywSKL.js +1 -0
- package/dist/chunks/trustedDevice-Bzz03jCy.js +1 -0
- package/dist/chunks/{types-3j8PS-Du.js → types-BJ7qTz75.js} +2 -2
- package/dist/chunks/udsClient-CF8BmZgN.js +1 -0
- package/dist/chunks/{updateCCB-BPe9_FW6.js → updateCCB-CzBxsuJe.js} +1 -1
- package/dist/chunks/{upstreamproxy-DF00RzGG.js → upstreamproxy-BuBFDFAD.js} +2 -2
- package/dist/chunks/{useExitOnCtrlCDWithKeybindings-ChqBs9Lr.js → useExitOnCtrlCDWithKeybindings-BHQfwlAl.js} +1 -1
- package/dist/chunks/useMainLoopModel-BkyIIW9t.js +1 -0
- package/dist/chunks/useManagePlugins-BWROoGDs.js +1 -0
- package/dist/chunks/{useMergedTools-Dk5cPqLc.js → useMergedTools-CHxnwR7R.js} +1 -1
- package/dist/chunks/{useSearchInput-C7Y1I9P9.js → useSearchInput-q2CFPU4W.js} +1 -1
- package/dist/chunks/{useSettingsErrors-DAEO7AyB.js → useSettingsErrors-CPVQbsqq.js} +1 -1
- package/dist/chunks/{userAgent-CIq27vUR.js → userAgent-B7WkjI6I.js} +1 -1
- package/dist/chunks/util-BfqXOA-P.js +1 -0
- package/dist/chunks/{validatePlugin-Kk6pxnO2.js → validatePlugin-jrcrYEIu.js} +1 -1
- package/dist/chunks/{vim-EYQn94Kx.js → vim-C4Hs5U2h.js} +1 -1
- package/dist/chunks/{which-DzFN5TNM.js → which-mplwBbc0.js} +1 -1
- package/dist/chunks/windowsPaths-B8p9tFRF.js +1 -0
- package/dist/chunks/windowsPaths-C7Mdo9aU.js +1 -0
- package/dist/chunks/{workSecret-DUqdPy44.js → workSecret-XLodD7tw.js} +1 -1
- package/dist/chunks/workerRegistry-Cfo7bKlm.js +6 -0
- package/dist/chunks/worktree-D0k_pCEz.js +1 -0
- package/dist/cli.js +1 -1
- package/package.json +2 -3
- package/dist/chunks/App-C2yQjBgY.js +0 -1
- package/dist/chunks/ApproveApiKey-CKbv5C1x.js +0 -1
- package/dist/chunks/ApproveApiKey-MscC-ssL.js +0 -1
- package/dist/chunks/BackgroundTasksDialog-CL5NWsFL.js +0 -2
- package/dist/chunks/ClaudeMdExternalIncludesDialog-BqNxQOXJ.js +0 -1
- package/dist/chunks/ClaudeMdExternalIncludesDialog-C0-psohX.js +0 -1
- package/dist/chunks/ConsoleOAuthFlow-4mOvEer_.js +0 -1
- package/dist/chunks/Doctor-DmgAwce2.js +0 -1
- package/dist/chunks/Doctor-jEs9chPk.js +0 -3
- package/dist/chunks/ExitFlow-DVKxFdpX.js +0 -2
- package/dist/chunks/InvalidConfigDialog-o9DF1REI.js +0 -1
- package/dist/chunks/MCPConnectionManager-CUTuaa8T.js +0 -1
- package/dist/chunks/MCPToolListView-CvqB4nCw.js +0 -1
- package/dist/chunks/MessageSelector-BLzw172f.js +0 -3
- package/dist/chunks/Messages-4K5sLmNh.js +0 -11
- package/dist/chunks/Onboarding-ClwHS5rh.js +0 -1
- package/dist/chunks/PromptInputHelpMenu-Bb4KdIX_.js +0 -1
- package/dist/chunks/QueryEngine-DPHLSsax.js +0 -1
- package/dist/chunks/REPL-Bf46iQCN.js +0 -1
- package/dist/chunks/REPL-DIaAo9M9.js +0 -133
- package/dist/chunks/RemoteSessionManager-CS6mywIn.js +0 -2
- package/dist/chunks/ResumeConversation-Br2KsBoe.js +0 -1
- package/dist/chunks/SearchExtraToolsTool-i_YO3QvV.js +0 -1
- package/dist/chunks/Settings-BMXysXIx.js +0 -2
- package/dist/chunks/TrustDialog-Fk4m_Sy4.js +0 -1
- package/dist/chunks/add-dir-CZ6Clvq8.js +0 -1
- package/dist/chunks/agents-DHnNg4h6.js +0 -103
- package/dist/chunks/allErrors-CU89tF-z.js +0 -1
- package/dist/chunks/api-BSeE6MwB.js +0 -1
- package/dist/chunks/auth-BIGJth5U.js +0 -1
- package/dist/chunks/auth-CDQMhIZP.js +0 -1
- package/dist/chunks/autonomy-C1aSgWPQ.js +0 -1
- package/dist/chunks/autonomy-Src6sKCp.js +0 -15
- package/dist/chunks/autonomyPanel-DnHpuiy4.js +0 -1
- package/dist/chunks/backgroundHousekeeping-B-cw0UcS.js +0 -17
- package/dist/chunks/backgroundHousekeeping-BS_8z3_x.js +0 -1
- package/dist/chunks/bg-50rllUNh.js +0 -1
- package/dist/chunks/bg-DAPORXF3.js +0 -9
- package/dist/chunks/bridgeConfig-BeqChxJC.js +0 -1
- package/dist/chunks/caches-BTQAW9zc.js +0 -1
- package/dist/chunks/caches-BVtSCnV1.js +0 -1
- package/dist/chunks/ccrClient-Bu7Tf1Z5.js +0 -1
- package/dist/chunks/cliLaunch-BWcoyZDP.js +0 -1
- package/dist/chunks/client-BWQ4-rN7.js +0 -1
- package/dist/chunks/client-c-3-PW1F.js +0 -1
- package/dist/chunks/commands-Bi7k3Wg-.js +0 -1
- package/dist/chunks/compact-J-h0Yf4b.js +0 -2
- package/dist/chunks/config-Do1870_d.js +0 -3
- package/dist/chunks/config-yyFe87vW.js +0 -1
- package/dist/chunks/context-Tb1Ca2Q-.js +0 -1
- package/dist/chunks/context-noninteractive-soPYKAc9.js +0 -1
- package/dist/chunks/conversation-CSEtUxOY.js +0 -1
- package/dist/chunks/conversation-Dk1WDQuN.js +0 -1
- package/dist/chunks/createSSHSession-CJtzNQdZ.js +0 -6
- package/dist/chunks/createSession-DkT1GL8y.js +0 -1
- package/dist/chunks/createSession-eE8mswkv.js +0 -1
- package/dist/chunks/crossProjectResume-04n3Ppy9.js +0 -40
- package/dist/chunks/cwd-ClLru_7T.js +0 -1
- package/dist/chunks/datadog-DjeJThpV.js +0 -1
- package/dist/chunks/debug-RAynG_nM.js +0 -39
- package/dist/chunks/detached-X_yjYR7x.js +0 -5
- package/dist/chunks/detectRepository-DgpNd87p.js +0 -1
- package/dist/chunks/detectRepository-ctF9KDbb.js +0 -1
- package/dist/chunks/doctor-B-Wag4C1.js +0 -1
- package/dist/chunks/entry-oIqjxIjQ.js +0 -14
- package/dist/chunks/execSyncWrapper-BTZJjCuv.js +0 -1
- package/dist/chunks/exit-BtW7LfRX.js +0 -1
- package/dist/chunks/extractMemories-CUrdiNcr.js +0 -1
- package/dist/chunks/fast-C60p6AqJ.js +0 -1
- package/dist/chunks/firstPartyEventLogger-BfCYN7lt.js +0 -1
- package/dist/chunks/gemini-BwvSxGgn.js +0 -1
- package/dist/chunks/generateSessionName-DlrdedOk.js +0 -1
- package/dist/chunks/git-2c7WlGDL.js +0 -6
- package/dist/chunks/git-XtKbtJMc.js +0 -1
- package/dist/chunks/githubRepoPathMapping-DbWG4hFQ.js +0 -1
- package/dist/chunks/goal-ZmSRBx4q.js +0 -3
- package/dist/chunks/hooks-DWg07LmS.js +0 -1
- package/dist/chunks/jwtUtils-CUPXdX3W.js +0 -1
- package/dist/chunks/keybindings-DgIPdBy9.js +0 -2
- package/dist/chunks/loadAgentsDir-zikjxLvn.js +0 -1
- package/dist/chunks/loadPluginHooks-Cp8MSwAc.js +0 -1
- package/dist/chunks/localSearch-ZFyFy5FN.js +0 -1
- package/dist/chunks/main-9r5gLzUW.js +0 -605
- package/dist/chunks/main-CvOv59-7.js +0 -31
- package/dist/chunks/managedEnv-B61yLpwp.js +0 -1
- package/dist/chunks/mcp-BckPBjaM.js +0 -6
- package/dist/chunks/mcp-CS1DA3JL.js +0 -1
- package/dist/chunks/mcp-VcGPYCkW.js +0 -2
- package/dist/chunks/memory-C5ohwh-T.js +0 -1
- package/dist/chunks/model-BGu1AGq0.js +0 -1
- package/dist/chunks/model-BsZ4sP_H.js +0 -1
- package/dist/chunks/model-D19IIcll.js +0 -1
- package/dist/chunks/nativeInstaller-QB8cEJ18.js +0 -1
- package/dist/chunks/oauth-BN2I0_jl.js +0 -1
- package/dist/chunks/oauth-C9VBDB0Y.js +0 -1
- package/dist/chunks/omit-DDUIPHnl.js +0 -1
- package/dist/chunks/onChangeAppState-RBl6H7ho.js +0 -1
- package/dist/chunks/panel-KW-wmEvU.js +0 -1
- package/dist/chunks/parser-xSBaQRLH.js +0 -1
- package/dist/chunks/permissions-BoLXYN1j.js +0 -3
- package/dist/chunks/pidLock-nJHbufJN.js +0 -3
- package/dist/chunks/plugin-C6-GQke5.js +0 -17
- package/dist/chunks/pluginAutoupdate-SlRFJlTT.js +0 -1
- package/dist/chunks/pluginBlocklist-n6Imlh3y.js +0 -1
- package/dist/chunks/pluginCliCommands-Bd96zSOQ.js +0 -1
- package/dist/chunks/pluginFlagging-DZaYzecY.js +0 -1
- package/dist/chunks/pluginOperations-D90IRawu.js +0 -2
- package/dist/chunks/pluginStartupCheck-Bxkxpm4k.js +0 -1
- package/dist/chunks/pluginStartupCheck-CB2q2dLv.js +0 -1
- package/dist/chunks/plugins-B9eSjLSA.js +0 -4
- package/dist/chunks/poorMode-BAnubpn1.js +0 -1
- package/dist/chunks/print-eCRv_Li-.js +0 -26
- package/dist/chunks/processBashCommand-B5F2Cl7K.js +0 -1
- package/dist/chunks/processSlashCommand-BC_D3cH5.js +0 -5
- package/dist/chunks/prompt-C1JPqinc.js +0 -1
- package/dist/chunks/prompt-DZhBz_Vu.js +0 -1
- package/dist/chunks/rcDebugLog-CARUIORE.js +0 -1
- package/dist/chunks/reconciler-B4GDm_iC.js +0 -1
- package/dist/chunks/refresh-DBVizOzg.js +0 -1
- package/dist/chunks/remoteManagedSettings-xh_MViZH.js +0 -1
- package/dist/chunks/resume-DVCSzKvv.js +0 -2
- package/dist/chunks/ripgrep-e-iewvTf.js +0 -1
- package/dist/chunks/sandbox-adapter-BFZFHplu.js +0 -1
- package/dist/chunks/sandbox-toggle--zNSKce_.js +0 -1
- package/dist/chunks/searchExtraTools-ui5y2VSE.js +0 -1
- package/dist/chunks/sessionFileAccessHooks-CZvCqQJ6.js +0 -1
- package/dist/chunks/sessionObserver-Ba7um95p.js +0 -1
- package/dist/chunks/sessionStorage-CedwLLQs.js +0 -1
- package/dist/chunks/settings-DkDH7WQT.js +0 -1
- package/dist/chunks/settings-DnptdP79.js +0 -20
- package/dist/chunks/settingsSync-PmU7SmkU.js +0 -1
- package/dist/chunks/setup-BEsBuzsk.js +0 -3
- package/dist/chunks/sinks-BJHgxz6Y.js +0 -1
- package/dist/chunks/sinks-D5-yhcgU.js +0 -2
- package/dist/chunks/skillChangeDetector-Dd0WPdkO.js +0 -1
- package/dist/chunks/skillSearchPanel-CftorvAM.js +0 -21
- package/dist/chunks/skills-C4CTRN9o.js +0 -1
- package/dist/chunks/startupProfiler-D4FBdEQr.js +0 -1
- package/dist/chunks/state-BAGmpVBn.js +0 -1
- package/dist/chunks/state-D_lk6z-C.js +0 -1
- package/dist/chunks/status-Dzuw3hBv.js +0 -2
- package/dist/chunks/subprocessEnv-CZkA9Cdp.js +0 -1
- package/dist/chunks/switcher-4KzBvuKH.js +0 -1
- package/dist/chunks/switcher-CCs9xl1z.js +0 -1
- package/dist/chunks/syncCache-CBRiRU5x.js +0 -1
- package/dist/chunks/teleport-Bw0jSxe9.js +0 -1
- package/dist/chunks/tmux-DewYVEBm.js +0 -1
- package/dist/chunks/toolPool-CkXFlqsn.js +0 -1
- package/dist/chunks/trustedDevice-CFf5yaG-.js +0 -1
- package/dist/chunks/trustedDevice-CuwSv8dG.js +0 -1
- package/dist/chunks/udsClient-e9dIkwVA.js +0 -1
- package/dist/chunks/useMainLoopModel-2-eujv0n.js +0 -1
- package/dist/chunks/useManagePlugins-CYBIkaB1.js +0 -1
- package/dist/chunks/util-VO98TdOz.js +0 -1
- package/dist/chunks/windowsPaths-BU3yQWTB.js +0 -1
- package/dist/chunks/windowsPaths-DgZ3YY4a.js +0 -1
- package/dist/chunks/workerRegistry-C07BcZIw.js +0 -6
- package/dist/chunks/worktree-dFUkhVE_.js +0 -1
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{dirname as t,join as n}from"node:path";import{createHash as r}from"node:crypto";import{mkdir as i,readFile as a,rename as o,stat as s,writeFile as c}from"node:fs/promises";function l(e){return e?.rootDir?e.rootDir:process.env.CLAUDE_SKILL_LEARNING_HOME?process.env.CLAUDE_SKILL_LEARNING_HOME:n(process.env.HOME??process.cwd(),`.
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{dirname as t,join as n}from"node:path";import{createHash as r}from"node:crypto";import{mkdir as i,readFile as a,rename as o,stat as s,writeFile as c}from"node:fs/promises";function l(e){return e?.rootDir?e.rootDir:process.env.CLAUDE_SKILL_LEARNING_HOME?process.env.CLAUDE_SKILL_LEARNING_HOME:n(process.env.HOME??process.cwd(),`.workmate`,`skill-learning`)}function u(e){let t=l(e),r=e?.project;return!r||r.scope===`global`||r.projectId===`global`?n(t,`global`,`observations.jsonl`):n(t,`projects`,r.projectId,`observations.jsonl`)}function d(e,t=y){if(e===void 0)return;let n=e;for(let e of C)n=n.replace(e,e=>{let t=e.split(/[:=]/,1)[0];return/[:=]/.test(e)?`${t}: ${S}`:S});if(n.length<=t)return n;let r=v(n),i=n.slice(0,t);return n.includes(S)&&!i.includes(S)&&(i=`${S} ${i}`),`${i}\n[TRUNCATED length=${n.length} sha256=${r}]`}function f(e,t){let n=t?.maxFieldLength??y,r={...e,toolInput:d(e.toolInput,n),toolOutput:d(e.toolOutput,n),messageText:d(e.messageText,n)},i=[r.event,r.toolName??``,r.toolInput??``,r.toolOutput??``,r.messageText??``].join(`
|
|
2
2
|
`);return{...r,contentHash:v(i)}}async function p(e,n){let r=u(n);await i(t(r),{recursive:!0}),await g(n);let a=f(e,n),o=JSON.stringify(a);return Buffer.byteLength(o)>w||await c(r,`${o}\n`,{flag:`a`}),a}async function m(e){let t=u(e),n=``;try{n=await a(t,`utf8`)}catch(e){if(e.code===`ENOENT`)return[];throw e}let r=[];for(let e of n.split(/\r?\n/))if(e.trim())try{r.push(JSON.parse(e))}catch{}return r}async function h(e){let t=u(e),n=e?.maxAgeDays??x,r=Date.now()-n*24*60*60*1e3,i=``;try{i=await a(t,`utf8`)}catch(e){if(e.code===`ENOENT`)return 0;throw e}let s=[],l=0;for(let e of i.split(/\r?\n/))if(e.trim())try{let t=JSON.parse(e),n=Date.parse(t.timestamp);if(!Number.isNaN(n)&&n<r){l+=1;continue}s.push(e)}catch{s.push(e)}if(l===0)return 0;let d=`${t}.tmp-${process.pid}-${Date.now()}`;return await c(d,s.length?`${s.join(`
|
|
3
3
|
`)}\n`:``),await o(d,t),l}async function g(e){let r=u(e),a=e?.archiveThresholdBytes??b,c;try{c=await s(r)}catch(e){if(e.code===`ENOENT`)return null;throw e}if(c.size<a)return null;let l=n(t(r),`observations.archive`);await i(l,{recursive:!0});let d=n(l,`observations-${new Date().toISOString().replace(/[:.]/g,`-`)}.jsonl`);return await o(r,d),d}function _(e){if(e!=null)return typeof e==`string`?e:JSON.stringify(e)}function v(e){return r(`sha256`).update(e).digest(`hex`)}var y,b,x,S,C,w,T=e((()=>{y=5e3,b=1e6,x=30,S=`[REDACTED]`,C=[/\b(?:sk|sk-ant|sk-proj|xox[baprs])-[A-Za-z0-9_-]{12,}\b/g,/\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}\b/g,/\b(?:api[_-]?key|token|secret|password|authorization)\b\s*[:=]\s*["']?[^"',\s}]+/gi,/\bBearer\s+[A-Za-z0-9._~+/=-]{12,}\b/gi],w=64*1024}));export{m as a,h as i,l as n,_ as o,T as r,p as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{a as t,o as n}from"./isObject-C6qM3WEW.js";import{BT as r,KT as i,NE as a,PE as o,VT as s,qT as c}from"./loadAgentsDir-BXtV2jiO.js";import{Ar as l,Ci as u,Dr as d,Er as f,Fr as p,Or as m,Pr as h,Si as g,bi as _,di as v,jr as y,kr as b,ui as x,xi as S}from"./state-BPFYBqm1.js";import{$n as C,Er as w,Qn as T,Tr as E,Zn as D,er as O,nr as k,tr as A}from"./settings-DiBMs2gM.js";import{I as j,L as M}from"./config-9rLTDOYW.js";function N(e){return S(e)||v(e)||!!(P&&e&&e[P])}var P,F=e((()=>{n(),x(),_(),P=t?t.isConcatSpreadable:void 0}));function I(e,t,n,r,i){var a=-1,o=e.length;for(n||(n=N),i||(i=[]);++a<o;){var s=e[a];t>0&&n(s)?t>1?I(s,t-1,n,r,i):g(i,s):r||(i[i.length]=s)}return i}var L=e((()=>{u(),F()}));function R(e){return e!=null&&e.length?I(e,1):[]}var z=e((()=>{L()}));function B(e){return T(O(e,void 0,R),e+``)}var V=e((()=>{z(),C(),D()}));function H(e,t){return t.length<2?e:f(e,i(t,0,-1))}var U=e((()=>{d(),c()}));function W(e,t){t=l(t,e);var n=-1,r=t.length;if(!r)return!0;for(;++n<r;){var i=b(t[n]);if(i===`__proto__`&&!G.call(e,`__proto__`)||(i===`constructor`||i===`prototype`)&&n<r-1)return!1}var a=H(e,t);return a==null||delete a[b(s(t))]}var G,K=e((()=>{y(),r(),U(),m(),G=Object.prototype.hasOwnProperty}));function q(e){return k(e)?void 0:e}var J=e((()=>{A()})),Y,X,Z,Q,$=e((()=>{p(),o(),K(),y(),w(),J(),V(),M(),Y=1,X=2,Z=4,Q=B(function(e,t){var n={};if(e==null)return n;var r=!1;t=h(t,function(t){return t=l(t,e),r||(r=t.length>1),t}),E(e,j(e),n),r&&(n=a(n,Y|X|Z,q));for(var i=t.length;i--;)W(n,t[i]);return n})}));export{Q as n,$ as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Mn as e,Wt as t}from"./state-BPFYBqm1.js";import{R as n,U as r}from"./debug-Dr1SjdXn.js";import{Ft as i,Mt as a,zt as o}from"./settings-DiBMs2gM.js";import{c as s,h as c,y as l}from"./config-9rLTDOYW.js";import{o as u,s as d}from"./log-27kCA_9u.js";import{Bt as f,_t as p,gt as m,vt as h}from"./model-CDnVaVDR.js";import{a as g,i as _,n as v}from"./sessionState-DSWN4tMV.js";import{r as y,t as b}from"./managedEnv-B-BNY0xC.js";t(),f(),c(),n(),u(),y(),a(),v();function x(e){return t=>({...t,...typeof e.permission_mode==`string`?{toolPermissionContext:{...t.toolPermissionContext,mode:i(e.permission_mode)}}:{}})}function S({newState:t,oldState:n}){let i=n.toolPermissionContext.mode,a=t.toolPermissionContext.mode;if(i!==a){let e=o(i),t=o(a);e!==t&&g({permission_mode:t}),_(a)}if(t.mainLoopModel!==n.mainLoopModel&&e(t.mainLoopModel),t.expandedView!==n.expandedView){let e=t.expandedView===`tasks`;s().showExpandedTodos!==e&&l(t=>({...t,showExpandedTodos:e}))}if(t.verbose!==n.verbose&&s().verbose!==t.verbose){let e=t.verbose;l(t=>({...t,verbose:e}))}if(t.settings!==n.settings)try{m(),p(),h(),t.settings.env!==n.settings.env&&b()}catch(e){d(r(e))}}export{S as n,x as t};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{c as t,l as n,o as r}from"./envUtils-
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{c as t,l as n,o as r}from"./envUtils-DcaKZlRU.js";import{Ba as i,Fy as a,G_ as o,Ta as s,U_ as c,W_ as l,Ya as ee,ga as u,it as d,jy as te,qa as f,st as ne}from"./loadAgentsDir-BXtV2jiO.js";import{c as p,i as m}from"./debug-Dr1SjdXn.js";import{Kn as h,Un as re,V as g,W as _}from"./model-CDnVaVDR.js";import{bn as v,i as ie,r as y,t as b,xn as x,yn as S}from"./prompt-CRc2QEZ5.js";import{F as C,I as w,M as T,N as E,R as ae,it as oe}from"./sessionState-DSWN4tMV.js";import{n as se,r as D}from"./client-BMA05FW8.js";import{n as ce,t as O}from"./openaiShared-G2-w4gJt.js";import{homedir as k}from"os";import{join as A}from"path";import{randomUUID as j}from"crypto";import{chmod as M,mkdir as N,readFile as P,writeFile as F}from"fs/promises";function I(){return A(L(),J)}function L(){return(process.env.WORKMATE_CONFIG_DIR??A(k(),`.workmate`)).normalize(`NFC`)}function R(){return A(process.env.CODEX_HOME??A(process.env.HOME??``,`.codex`),`auth.json`)}function z(e){return typeof e==`string`&&e.length>0?e:void 0}function B(e){try{let t=JSON.parse(e);return t&&typeof t==`object`?t:null}catch{return null}}function V(e){let[,t]=e.split(`.`);if(!t)return null;try{let e=t.replace(/-/g,`+`).replace(/_/g,`/`),n=e.padEnd(e.length+(4-e.length%4)%4,`=`);return B(Buffer.from(n,`base64`).toString(`utf8`))}catch{return null}}function H(e){let t=V(e),n=t?.[`https://api.openai.com/auth`];return n&&typeof n==`object`?n:t??{}}function U(e){let t=V(e)?.exp;return typeof t==`number`?t*1e3:null}function W(e){if(e.accountId)return e.accountId;for(let t of[e.idToken,e.accessToken]){if(!t)continue;let e=H(t),n=z(e.chatgpt_account_id)??z(e.chatgpt_account_user_id)??z(e.account_id);if(n)return n}}async function G(e){try{let t=await P(e,`utf8`),n=JSON.parse(t),r=n.tokens,i=r?.id_token,a=r?.access_token,o=r?.refresh_token;return!i||!a||!o?null:{idToken:i,accessToken:a,refreshToken:o,accountId:W({idToken:i,accessToken:a,accountId:r.account_id}),lastRefresh:n.last_refresh}}catch{return null}}async function le(e){let t=I();await N(L(),{recursive:!0});let n={auth_mode:`chatgpt`,tokens:{id_token:e.idToken,access_token:e.accessToken,refresh_token:e.refreshToken,account_id:W(e)},last_refresh:new Date().toISOString()};await F(t,`${JSON.stringify(n,null,2)}\n`,{mode:384}),await M(t,384).catch(()=>void 0)}async function ue(e,t){let n=await fetch(e,{method:`POST`,headers:{"Content-Type":`application/x-www-form-urlencoded`},body:t});if(!n.ok){let e=await n.text().catch(()=>``);throw Error(`ChatGPT token request failed (${n.status})${e?`: ${e}`:``}`)}return await n.json()}async function de(e){let t=new URLSearchParams({grant_type:`refresh_token`,refresh_token:e.refreshToken,client_id:q,scope:`openid profile email offline_access api.connectors.read api.connectors.invoke`}),n=await ue(`${K}/oauth/token`,t);return{idToken:n.id_token,accessToken:n.access_token,refreshToken:n.refresh_token??e.refreshToken,accountId:W({idToken:n.id_token,accessToken:n.access_token,accountId:e.accountId})}}function fe(){return process.env.OPENAI_AUTH_MODE===`chatgpt`}async function pe(){let e=await G(I());if(e||(e=await G(R()),e&&p(`[OpenAI] Using ChatGPT auth from Codex auth.json`)),!e)throw Error(`ChatGPT account is not logged in.`);let t=U(e.accessToken);return t!==null&&t<=Date.now()+Y&&(e=await de(e),await le(e)),{accessToken:e.accessToken,accountId:e.accountId??W(e)}}var K,q,J,Y,X=e((()=>{m(),K=`https://auth.openai.com`,q=`app_EMoamEEZ73f0CkXaXp7hrann`,J=`openai-chatgpt-auth.json`,Y=300*1e3}));function Z(e){return typeof e==`string`?e:Array.isArray(e)?e.map(e=>{if(!e||typeof e!=`object`)return``;let t=e;return typeof t.text==`string`?t.text:``}).filter(Boolean).join(`
|
|
2
2
|
`):``}function me(e){if(typeof e==`string`)return e;if(!Array.isArray(e))return Z(e);let t=[];for(let n of e){if(!n||typeof n!=`object`)continue;let e=n;if(e.type===`text`&&typeof e.text==`string`)t.push({type:`input_text`,text:e.text});else if(e.type===`image_url`){let n=e.image_url;typeof n?.url==`string`&&t.push({type:`input_image`,image_url:n.url})}}return t.length>0?t:Z(e)}function he(e){let t=[],n=[];for(let r of e){if(!r||typeof r!=`object`)continue;let e=r,i=e.role;if(i===`system`||i===`developer`){let t=Z(e.content);t&&n.push(t);continue}if(i===`tool`){let n=e.tool_call_id;typeof n==`string`&&t.push({type:`function_call_output`,call_id:n,output:Z(e.content)});continue}if(i===`assistant`){let n=Z(e.content);n&&t.push({role:`assistant`,content:n});let r=e.tool_calls;if(Array.isArray(r))for(let e of r){if(!e||typeof e!=`object`)continue;let n=e,r=n.function,i=typeof n.id==`string`?n.id:void 0,a=typeof r?.name==`string`?r.name:void 0;!i||!a||t.push({type:`function_call`,call_id:i,name:a,arguments:typeof r?.arguments==`string`?r.arguments:`{}`})}continue}i===`user`&&t.push({role:`user`,content:me(e.content)})}return{input:t,instructions:n.length>0?n.join(`
|
|
3
3
|
|
|
4
4
|
`):void 0}}function ge(e){let t=[];for(let n of e){if(!n||typeof n!=`object`)continue;let e=n.function,r=typeof e?.name==`string`?e.name:void 0;r&&t.push({type:`function`,name:r,description:typeof e?.description==`string`?e.description:``,parameters:e?.parameters&&typeof e.parameters==`object`?e.parameters:{type:`object`,properties:{}},strict:!1})}return t}function _e(e){if(e===`required`)return`required`;if(e===`auto`)return`auto`;if(!e||typeof e!=`object`)return e;let t=e,n=t.function;return t.type===`function`&&typeof n?.name==`string`?{type:`function`,name:n.name}:e}function ve(e){let{input:t,instructions:n}=he(e.messages),r=ge(e.tools);return{model:e.model,stream:!0,store:!1,input:t,...n?{instructions:n}:{},...r.length>0?{tools:r}:{},...e.toolChoice?{tool_choice:_e(e.toolChoice)}:{},parallel_tool_calls:!0}}async function*ye(e){if(!e.body)throw Error(`ChatGPT response did not include a body`);let t=e.body.getReader(),n=new TextDecoder,r=``;for(;;){let{done:e,value:i}=await t.read();if(e)break;r+=n.decode(i,{stream:!0});let a=r.indexOf(`
|
|
@@ -6,5 +6,5 @@ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{c as t,l as n,o as r}f
|
|
|
6
6
|
`);for(;a>=0;){let e=r.slice(0,a);r=r.slice(a+2);let t=e.split(/\r?\n/).filter(e=>e.startsWith(`data:`)).map(e=>e.slice(5).trimStart()).join(`
|
|
7
7
|
`);if(t&&t!==`[DONE]`){let e=JSON.parse(t);e&&typeof e==`object`&&(yield e)}a=r.indexOf(`
|
|
8
8
|
|
|
9
|
-
`)}}}function be(e){let t=e?.usage,n=t?.input_tokens_details;return{input_tokens:typeof t?.input_tokens==`number`?t.input_tokens:0,output_tokens:typeof t?.output_tokens==`number`?t.output_tokens:0,cache_creation_input_tokens:0,cache_read_input_tokens:typeof n?.cached_tokens==`number`?n.cached_tokens:0}}function xe(e){return e?.status===`incomplete`?`max_tokens`:`end_turn`}async function*Q(e,t){let n=`msg_${
|
|
10
|
-
`);return i?[s({content:`<available-deferred-tools>\n${i}\n</available-deferred-tools>`,isMeta:!0}),...e]:e}function ke(e){return e.type===`assistant`||e.type===`user`}function $(e){let{partialMessage:t,contentBlocks:n,tools:r,agentId:i,usage:a,stopReason:o,maxTokens:s}=e,c=[],l=Object.keys(n).sort((e,t)=>Number(e)-Number(t)).map(e=>n[Number(e)]).filter(Boolean);return l.length>0&&t&&c.push({message:{...t,content:
|
|
9
|
+
`)}}}function be(e){let t=e?.usage,n=t?.input_tokens_details;return{input_tokens:typeof t?.input_tokens==`number`?t.input_tokens:0,output_tokens:typeof t?.output_tokens==`number`?t.output_tokens:0,cache_creation_input_tokens:0,cache_read_input_tokens:typeof n?.cached_tokens==`number`?n.cached_tokens:0}}function xe(e){return e?.status===`incomplete`?`max_tokens`:`end_turn`}async function*Q(e,t){let n=`msg_${j().replace(/-/g,``).slice(0,24)}`,r=new Map,i=!1,a=-1,o=!1,s=!1,c=async function*(){i||(i=!0,yield{type:`message_start`,message:{id:n,type:`message`,role:`assistant`,content:[],model:t,stop_reason:null,stop_sequence:null,usage:{input_tokens:0,output_tokens:0,cache_creation_input_tokens:0,cache_read_input_tokens:0}}})};for await(let t of e){for await(let e of c())yield e;let e=t.type;if(e===`response.output_text.delta`){o||(s&&(yield{type:`content_block_stop`,index:a},s=!1),a++,o=!0,yield{type:`content_block_start`,index:a,content_block:{type:`text`,text:``}}),yield{type:`content_block_delta`,index:a,delta:{type:`text_delta`,text:String(t.delta??``)}};continue}if(e===`response.reasoning_text.delta`){s||(o&&(yield{type:`content_block_stop`,index:a},o=!1),a++,s=!0,yield{type:`content_block_start`,index:a,content_block:{type:`thinking`,thinking:``,signature:``}}),yield{type:`content_block_delta`,index:a,delta:{type:`thinking_delta`,thinking:String(t.delta??``)}};continue}if(e===`response.output_item.added`){let e=t.item,n=typeof t.output_index==`number`?t.output_index:-1;if(e?.type===`function_call`&&n>=0){o&&(yield{type:`content_block_stop`,index:a},o=!1),s&&(yield{type:`content_block_stop`,index:a},s=!1),a++;let t=String(e.call_id??e.id??`call_${n}`),i=String(e.name??``);r.set(n,{contentIndex:a,open:!0,name:i,id:t}),yield{type:`content_block_start`,index:a,content_block:{type:`tool_use`,id:t,name:i,input:{}}}}continue}if(e===`response.function_call_arguments.delta`){let e=typeof t.output_index==`number`?t.output_index:-1,n=r.get(e);n&&(yield{type:`content_block_delta`,index:n.contentIndex,delta:{type:`input_json_delta`,partial_json:String(t.delta??``)}});continue}if(e===`response.output_item.done`){let e=typeof t.output_index==`number`?t.output_index:-1,n=r.get(e);n?.open&&(yield{type:`content_block_stop`,index:n.contentIndex},n.open=!1);continue}if(e===`response.error`){let e=t.error;throw Error(String(e?.message??`ChatGPT Responses API error`))}if(e===`response.failed`){let e=t.response?.error;throw Error(String(e?.message??`ChatGPT Responses API failed`))}if(e===`response.completed`||e===`response.incomplete`){o&&(yield{type:`content_block_stop`,index:a},o=!1),s&&(yield{type:`content_block_stop`,index:a},s=!1);let e=t.response;yield{type:`message_delta`,delta:{stop_reason:xe(e),stop_sequence:null},usage:be(e)},yield{type:`message_stop`}}}}async function Se(e){let t=await pe(),n=e.fetchOverride??globalThis.fetch,r={Authorization:`Bearer ${t.accessToken}`,"Content-Type":`application/json`,Accept:`text/event-stream`,"OpenAI-Beta":`responses=experimental`,Origin:`https://chatgpt.com`,Referer:`https://chatgpt.com/`,originator:`workmate`};t.accountId&&(r[`ChatGPT-Account-Id`]=t.accountId);let i=await n(`https://chatgpt.com/backend-api/codex/responses`,{method:`POST`,headers:r,body:JSON.stringify(e.request),signal:e.signal});if(!i.ok){let e=await i.text().catch(()=>``);throw Error(`ChatGPT Responses API request failed (${i.status})${e?`: ${e.slice(0,500)}`:``}`)}return ye(i)}var Ce=e((()=>{X()}));function we(e){if(t(process.env.OPENAI_ENABLE_THINKING))return!1;if(n(process.env.OPENAI_ENABLE_THINKING))return!0;let r=e.toLowerCase();return r.includes(`deepseek`)||r.includes(`mimo`)}function Te(e,t){return t??(process.env.OPENAI_MAX_TOKENS&&parseInt(process.env.OPENAI_MAX_TOKENS,10)||void 0)??(process.env.CLAUDE_CODE_MAX_OUTPUT_TOKENS&&parseInt(process.env.CLAUDE_CODE_MAX_OUTPUT_TOKENS,10)||void 0)??e}function Ee(e){let{model:t,messages:n,tools:r,toolChoice:i,enableThinking:a,maxTokens:o,temperatureOverride:s}=e;return{model:t,messages:n,max_tokens:o,...r.length>0&&{tools:r,...i&&{tool_choice:i}},stream:!0,stream_options:{include_usage:!0},...a&&{thinking:{type:`enabled`},enable_thinking:!0,chat_template_kwargs:{thinking:!0,enable_thinking:!0}},...!a&&s!==void 0&&{temperature:s}}}var De=e((()=>{r()}));function Oe(e,t,n,r){if(!r||l())return e;let i=t.filter(e=>n.has(e.name)).map(b).sort().join(`
|
|
10
|
+
`);return i?[s({content:`<available-deferred-tools>\n${i}\n</available-deferred-tools>`,isMeta:!0}),...e]:e}function ke(e){return e.type===`assistant`||e.type===`user`}function $(e){let{partialMessage:t,contentBlocks:n,tools:r,agentId:i,usage:a,stopReason:o,maxTokens:s}=e,c=[],l=Object.keys(n).sort((e,t)=>Number(e)-Number(t)).map(e=>n[Number(e)]).filter(Boolean);return l.length>0&&t&&c.push({message:{...t,content:f(l,r,i),usage:a,stop_reason:o,stop_sequence:null},requestId:void 0,type:`assistant`,uuid:j(),timestamp:new Date().toISOString()}),o===`max_tokens`&&c.push(u({content:`Output truncated: response exceeded the ${s} token limit. Set OPENAI_MAX_TOKENS or CLAUDE_CODE_MAX_OUTPUT_TOKENS to override.`,apiError:`max_output_tokens`,error:`max_output_tokens`})),c}async function*Ae(e,t,n,r,i){try{let a=oe(i.model),s=ee(e,n),c=await o(i.model,n,i.getToolPermissionContext||(async()=>S()),i.agents||[],i.querySource),l=new Set;if(c)for(let e of n)ie(e)&&l.add(e.name);let u=n;c&&l.size>0&&(u=n.filter(e=>!!(!l.has(e.name)||x(e,`SearchExtraTools`))));let d=(await Promise.all(u.map(e=>ne(e,{getToolPermissionContext:i.getToolPermissionContext,tools:n,agents:i.agents,allowedAgentTypes:i.allowedAgentTypes,model:i.model,deferLoading:c&&l.has(e.name)})))).filter(e=>{let t=e;return t.type!==`advisor_20260301`&&t.type!==`computer_20250124`}),f=we(a),m=ae(Oe(s.filter(ke),n,l,c),t,{enableThinking:f}),h=w(d),_=C(i.toolChoice);if(c){let e=u.filter(e=>l.has(e.name)).length;p(`[OpenAI] Tool search enabled: ${e}/${l.size} deferred tools included, total tools=${h.length}`)}else p(`[OpenAI] Tool search disabled, total tools=${h.length}`);let{upperLimit:v}=re(a),y=Te(v,i.maxOutputTokensOverride);p(`[OpenAI] Calling model=${a}, messages=${m.length}, tools=${h.length}, thinking=${f}`);let b=fe()?Q(await Se({request:ve({model:a,messages:m,tools:h,toolChoice:_}),signal:r,fetchOverride:i.fetchOverride}),a):E(await se({maxRetries:0,fetchOverride:i.fetchOverride,source:i.querySource}).chat.completions.create(Ee({model:a,messages:m,tools:h,toolChoice:_,enableThinking:f,maxTokens:y,temperatureOverride:i.temperatureOverride}),{signal:r}),a),T={},D=null,O=null,k={input_tokens:0,output_tokens:0,cache_creation_input_tokens:0,cache_read_input_tokens:0},A=0,j=Date.now();for await(let e of b){switch(e.type){case`message_start`:D=e.message,A=Date.now()-j,e.message.usage&&(k={...k,...e.message.usage});break;case`content_block_start`:{let t=e.index,n=e.content_block;n.type===`tool_use`?T[t]={...n,input:``}:n.type===`text`?T[t]={...n,text:``}:n.type===`thinking`?T[t]={...n,thinking:``,signature:``}:T[t]={...n};break}case`content_block_delta`:{let t=e.index,n=e.delta,r=T[t];if(!r)break;n.type===`text_delta`?r.text=(r.text||``)+n.text:n.type===`input_json_delta`?r.input=(r.input||``)+n.partial_json:n.type===`thinking_delta`?r.thinking=(r.thinking||``)+n.thinking:n.type===`signature_delta`&&(r.signature=n.signature);break}case`content_block_stop`:break;case`message_delta`:{let t=e.usage;t&&(k=ce(k,t)),e.delta.stop_reason!=null&&(O=e.delta.stop_reason);break}case`message_stop`:if(D){for(let e of $({partialMessage:D,contentBlocks:T,tools:n,agentId:i.agentId,usage:k,stopReason:O,maxTokens:y}))yield e;D=null}k.input_tokens+k.output_tokens>0&&te(g(a,k),k,i.model);break}yield{type:`stream_event`,event:e,...e.type===`message_start`?{ttftMs:A}:void 0}}if(D)for(let e of $({partialMessage:D,contentBlocks:T,tools:n,agentId:i.agentId,usage:k,stopReason:O,maxTokens:y}))yield e}catch(e){let t=e instanceof Error?e.message:String(e);p(`[OpenAI] Error: ${t}`,{level:`error`}),yield u({content:`API Error: ${t}`,apiError:`api_error`,error:e instanceof Error?e:Error(String(e))})}}e((()=>{D(),O(),T(),X(),Ce(),i(),d(),v(),m(),a(),_(),De(),h(),c(),y()}))();export{Ae as queryModelOpenAI};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{I as n,P as r,fi as i,hn as a,t as o,y as s}from"./src-P_wYS_NJ2.js";import{t as c}from"./jsx-runtime-Bb4Xn-E0.js";import{o as l,r as u}from"./break-cache-4rlQORVk.js";async function d(e,t){let n=await u(e);n.type===`text`&&t(n.value,{display:`system`})}function f({onDone:e}){let[t,i]=(0,m.useState)(0),o=(0,m.useMemo)(()=>[{label:`Status`,description:`显示 pending 标记、always 模式与打断次数`,run:()=>void d(`status`,e)},{label:`Once`,description:`仅在下一次 API 调用打断 prompt cache`,run:()=>void d(`once`,e)},{label:`Always`,description:`在每次 API 调用都打断 prompt cache`,run:()=>void d(`always`,e)},{label:`Off`,description:`关闭 always 模式并清除 pending 的一次性标记`,run:()=>void d(`off`,e)},{label:`Clear Once`,description:`取消待生效的一次性 cache 打断`,run:()=>void d(`--clear`,e)}],[e]),c=()=>{let e=o[t];e&&e.run()};return a((e,t)=>{if(t.upArrow){i(e=>Math.max(0,e-1));return}if(t.downArrow){i(e=>Math.min(o.length-1,e+1));return}t.return&&c()}),(0,h.jsx)(s,{title:`Break Cache`,subtitle:`${o.length} actions`,onCancel:()=>e(`Break-cache panel dismissed`,{display:`system`}),color:`background`,hideInputGuide:!0,children:(0,h.jsxs)(n,{flexDirection:`column`,children:[o.map((e,i)=>(0,h.jsxs)(n,{flexDirection:`row`,children:[(0,h.jsx)(r,{children:`${i===t?`›`:` `} ${e.label}`.padEnd(g)}),(0,h.jsx)(r,{dimColor:!0,children:e.description})]},e.label)),(0,h.jsx)(n,{marginTop:1,children:(0,h.jsx)(r,{dimColor:!0,children:`↑/↓ select · Enter run · Esc close`})})]})})}async function p(e,t,n){let r=n?.trim()??``;return r?(await d(r,e),null):(0,h.jsx)(f,{onDone:e})}var m,h,g;e((()=>{m=t(i(),1),o(),l(),h=c(),g=28}))();export{p as call};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as e,r as t}from"./parser-CUUiH40T.js";t();export{e as parseCommand};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{i as t}from"./debug-Dr1SjdXn.js";var n,r=e((()=>{Promise.resolve(),n=new Set([`if`,`then`,`elif`,`else`,`fi`,`while`,`until`,`for`,`in`,`do`,`done`,`case`,`esac`,`function`,`select`])}));async function i(e){return!e||e.length,null}async function a(e){return!e||e.length,null}function o(e){if(e.type===`declaration_command`){let t=e.children[0];return t&&c.has(t.text)?[t.text]:[]}let t=[],n=!1;for(let r of e.children)if(r.type!==`variable_assignment`){if(r.type===`command_name`||!n&&r.type===`word`){n=!0,t.push(r.text);continue}if(l.has(r.type))t.push(s(r.text));else if(u.has(r.type))break}return t}function s(e){return e.length>=2&&(e[0]===`"`&&e.at(-1)===`"`||e[0]===`'`&&e.at(-1)===`'`)?e.slice(1,-1):e}var c,l,u,d,f=e((()=>{t(),r(),c=new Set([`export`,`declare`,`typeset`,`readonly`,`local`,`unset`,`unsetenv`]),l=new Set([`word`,`string`,`raw_string`,`number`]),u=new Set([`command_substitution`,`process_substitution`]),d=Symbol(`parse-aborted`)}));export{a,i,o as n,n as o,f as r,r as s,d as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{HT as t,UT as n}from"./loadAgentsDir-BXtV2jiO.js";import{Cr as r,Sr as i,bi as a,xi as o}from"./state-BPFYBqm1.js";function s(e,t,n,r){for(var i=-1,a=e==null?0:e.length;++i<a;){var o=e[i];t(r,o,n(o),e)}return r}var c=e((()=>{}));function l(e,n,r,i){return t(e,function(e,t,a){n(i,e,r(e),a)}),i}var u=e((()=>{n()}));function d(e,t){return function(n,r){var a=o(n)?s:l,c=t?t():{};return a(n,e,i(r,2),c)}}var f=e((()=>{c(),u(),r(),a()})),p,m=e((()=>{f(),p=d(function(e,t,n){e[+!n].push(t)},function(){return[[],[]]})}));export{p as n,m as t};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{n,t as r}from"./figures-5ThXQEtq.js";import{AC as i,B as a,Ba as o,CT as s,G as c,H as l,IC as u,Qg as d,Qm as f,Qu as p,V as ee,W as te,Zm as m,Zu as h,bT as g,ba as ne,cd as re,lg as ie,n_ as ae,og as _,sd as v,sg as oe,t_ as y,z as se}from"./loadAgentsDir-BXtV2jiO.js";import{I as b,P as x,Wt as ce,Xn as le,a as S,di as C,fi as w,hn as T,k as E,kt as D,n as O,o as k,ot as ue,r as de,s as fe,t as A,ui as j,x as pe,y as M}from"./src-P_wYS_NJ2.js";import{t as N}from"./jsx-runtime-Bb4Xn-E0.js";import{Wt as me,et as P}from"./state-BPFYBqm1.js";import{C as F,x as I}from"./debug-Dr1SjdXn.js";import{H as L,V as R,g as he,ln as z,o as B,rn as V,z as H}from"./settings-DiBMs2gM.js";import{l as ge,o as _e}from"./stringUtils-Df-Lnjxd.js";import{n as ve,t as ye}from"./useExitOnCtrlCDWithKeybindings-BHQfwlAl.js";import{n as be,t as xe}from"./AddWorkspaceDirectory-CtRxzRny.js";import{t as Se}from"./SearchBox-C9vUA4IM.js";import{n as Ce,t as we}from"./useSearchInput-q2CFPU4W.js";import{n as Te,t as Ee}from"./shadowedRuleDetection-DZ0AA2Rw.js";import{n as U,t as De}from"./autoModeDenials-BxNzGJdR.js";function Oe({ruleValue:e}){switch(e.toolName){case m.name:return e.ruleContent?e.ruleContent.endsWith(`:*`)?(0,W.jsxs)(x,{dimColor:!0,children:[`Any Bash command starting with `,(0,W.jsx)(x,{bold:!0,children:e.ruleContent.slice(0,-2)})]}):(0,W.jsxs)(x,{dimColor:!0,children:[`The Bash command `,(0,W.jsx)(x,{bold:!0,children:e.ruleContent})]}):(0,W.jsx)(x,{dimColor:!0,children:`Any Bash command`});default:return e.ruleContent?null:(0,W.jsxs)(x,{dimColor:!0,children:[`Any use of the `,(0,W.jsx)(x,{bold:!0,children:e.toolName}),` tool`]})}}var W,ke=e((()=>{w(),A(),f(),W=N()}));function Ae(e){switch(e){case`localSettings`:return{label:`Project settings (local)`,description:`Saved in ${B(`localSettings`)}`,value:e};case`projectSettings`:return{label:`Project settings`,description:`Checked in at ${B(`projectSettings`)}`,value:e};case`userSettings`:return{label:`User settings`,description:`Saved in at ~/.workmate/settings.json`,value:e}}}function je({onAddRules:e,onCancel:t,ruleValues:n,ruleBehavior:r,initialContext:i,setToolPermissionContext:a}){let o=V.map(Ae),s=(0,Me.useCallback)(o=>{if(o===`cancel`){t();return}else if(V.includes(o)){let t=o,s=d(i,{type:`addRules`,rules:n,behavior:r,destination:t});ae({type:`addRules`,rules:n,behavior:r,destination:t}),a(s);let c=n.map(e=>({ruleValue:e,ruleBehavior:r,source:t})),l=Ee(s,{sandboxAutoAllowEnabled:g.isSandboxingEnabled()&&g.isAutoAllowBashIfSandboxedEnabled()}).filter(e=>n.some(t=>t.toolName===e.rule.ruleValue.toolName&&t.ruleContent===e.rule.ruleValue.ruleContent));e(c,l.length>0?l:void 0)}},[e,t,n,r,i,a]);return(0,G.jsxs)(M,{title:`Add ${r} permission ${ge(n.length,`rule`)}`,onCancel:t,color:`permission`,children:[(0,G.jsx)(b,{flexDirection:`column`,paddingX:2,children:n.map(e=>(0,G.jsxs)(b,{flexDirection:`column`,children:[(0,G.jsx)(x,{bold:!0,children:L(e)}),(0,G.jsx)(Oe,{ruleValue:e})]},L(e)))}),(0,G.jsxs)(b,{flexDirection:`column`,marginY:1,children:[(0,G.jsx)(x,{children:n.length===1?`Where should this rule be saved?`:`Where should these rules be saved?`}),(0,G.jsx)(h,{options:o,onChange:s})]})]})}var Me,G,Ne=e((()=>{w(),Me=t(w(),1),p(),A(),y(),H(),Te(),s(),z(),he(),_e(),ke(),G=N()}));function Pe({onCancel:e,onSubmit:t,ruleBehavior:n}){let[i,a]=(0,Fe.useState)(``),[o,s]=(0,Fe.useState)(0),c=ve();ce(`confirm:no`,e,{context:`Settings`});let{columns:l}=ue(),u=l-6;return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(b,{flexDirection:`column`,gap:1,borderStyle:`round`,paddingLeft:1,paddingRight:1,borderColor:`permission`,children:[(0,K.jsxs)(x,{bold:!0,color:`permission`,children:[`Add `,n,` permission rule`]}),(0,K.jsxs)(b,{flexDirection:`column`,children:[(0,K.jsxs)(x,{children:[`Permission rules are a tool name, optionally followed by a specifier in parentheses.`,(0,K.jsx)(D,{}),`e.g., `,(0,K.jsx)(x,{bold:!0,children:L({toolName:m.name})}),(0,K.jsx)(x,{bold:!1,children:` or `}),(0,K.jsx)(x,{bold:!0,children:L({toolName:m.name,ruleContent:`ls:*`})})]}),(0,K.jsx)(b,{borderDimColor:!0,borderStyle:`round`,marginY:1,paddingLeft:1,children:(0,K.jsx)(v,{showCursor:!0,value:i,onChange:a,onSubmit:e=>{let r=e.trim();r.length!==0&&t(R(r),n)},placeholder:`Enter permission rule${r.ellipsis}`,columns:u,cursorOffset:o,onChangeCursorOffset:s})})]})]}),(0,K.jsx)(b,{marginLeft:3,children:c.pending?(0,K.jsxs)(x,{dimColor:!0,children:[`Press `,c.keyName,` again to exit`]}):(0,K.jsx)(x,{dimColor:!0,children:`Enter to submit · Esc to cancel`})})]})}var Fe,K,Ie=e((()=>{n(),w(),Fe=t(w(),1),re(),ye(),u(),A(),i(),f(),H(),K=N()}));function Le({onHeaderFocusChange:e,onStateChange:t}){let{headerFocused:n,focusHeader:r}=S();(0,q.useEffect)(()=>{e?.(n)},[n,e]);let[i]=(0,q.useState)(()=>De()),[a,o]=(0,q.useState)(()=>new Set),[s,c]=(0,q.useState)(()=>new Set),[l,u]=(0,q.useState)(0);(0,q.useEffect)(()=>{t({approved:a,retry:s,denials:i})},[a,s,i,t]);let d=(0,q.useCallback)(e=>{let t=Number(e);o(e=>{let n=new Set(e);return n.has(t)?n.delete(t):n.add(t),n})},[]),f=(0,q.useCallback)(e=>{u(Number(e))},[]);if(T((e,t)=>{e===`r`&&(c(e=>{let t=new Set(e);return t.has(l)?t.delete(l):t.add(l),t}),o(e=>{if(e.has(l))return e;let t=new Set(e);return t.add(l),t}))},{isActive:i.length>0}),i.length===0)return(0,J.jsx)(x,{dimColor:!0,children:`No recent denials. Commands denied by the auto mode classifier will appear here.`});let p=i.map((e,t)=>{let n=a.has(t),r=s.has(t)?` (retry)`:``;return{label:(0,J.jsxs)(x,{children:[(0,J.jsx)(fe,{status:n?`success`:`error`,withSpace:!0}),e.display,(0,J.jsx)(x,{dimColor:!0,children:r})]}),value:String(t)}});return(0,J.jsxs)(b,{flexDirection:`column`,children:[(0,J.jsx)(x,{children:`Commands recently denied by the auto mode classifier.`}),(0,J.jsx)(b,{marginTop:1,children:(0,J.jsx)(h,{options:p,onChange:d,onFocus:f,visibleOptionCount:Math.min(10,p.length),isDisabled:n,onUpFromFirstItem:r})})]})}var q,J,Re=e((()=>{w(),q=t(w(),1),A(),U(),p(),J=N()}));function ze({directoryPath:e,onRemove:t,onCancel:n,permissionContext:r,setPermissionContext:i}){let a=(0,Be.useCallback)(()=>{i(d(r,{type:`removeDirectories`,directories:[e],destination:`session`})),t()},[e,r,i,t]),o=(0,Be.useCallback)(e=>{e===`yes`?a():n()},[a,n]);return(0,Y.jsxs)(M,{title:`Remove directory from workspace?`,onCancel:n,color:`error`,children:[(0,Y.jsx)(b,{marginX:2,flexDirection:`column`,children:(0,Y.jsx)(x,{bold:!0,children:e})}),(0,Y.jsx)(x,{children:`Claude Code will no longer have access to files in this directory.`}),(0,Y.jsx)(h,{onChange:o,onCancel:n,options:[{label:`Yes`,value:`yes`},{label:`No`,value:`no`}]})]})}var Be,Y,Ve=e((()=>{w(),Be=t(w(),1),p(),A(),y(),Y=N()}));function He({onExit:e,toolPermissionContext:t,onRequestAddDirectory:n,onRequestRemoveDirectory:i,onHeaderFocusChange:a}){let{headerFocused:o,focusHeader:s}=S();(0,X.useEffect)(()=>{a?.(o)},[o,a]);let c=Ue.useMemo(()=>Array.from(t.additionalWorkingDirectories.keys()).map(e=>({path:e,isCurrent:!1,isDeletable:!0})),[t.additionalWorkingDirectories]),l=(0,X.useCallback)(e=>{if(e===`add-directory`){n();return}let t=c.find(t=>t.path===e);t&&t.isDeletable&&i(t.path)},[c,n,i]),u=(0,X.useCallback)(()=>e(`Workspace dialog dismissed`,{display:`system`}),[e]),d=Ue.useMemo(()=>{let e=c.map(e=>({label:e.path,value:e.path}));return e.push({label:`Add directory${r.ellipsis}`,value:`add-directory`}),e},[c]);return(0,Z.jsxs)(b,{flexDirection:`column`,marginBottom:1,children:[(0,Z.jsxs)(b,{flexDirection:`row`,marginTop:1,marginLeft:2,gap:1,children:[(0,Z.jsx)(x,{children:`- ${P()}`}),(0,Z.jsx)(x,{dimColor:!0,children:`(Original working directory)`})]}),(0,Z.jsx)(h,{options:d,onChange:l,onCancel:u,visibleOptionCount:Math.min(10,d.length),onUpFromFirstItem:s,isDisabled:o})]})}var Ue,X,Z,We=e((()=>{n(),Ue=t(w(),1),X=t(w(),1),me(),p(),A(),Z=N()}));function Ge({rule:e}){return(0,$.jsx)(x,{dimColor:!0,children:`From ${c(e.source)}`})}function Ke(e){switch(e){case`allow`:return`allowed`;case`deny`:return`denied`;case`ask`:return`ask`}}function qe({rule:e,onDelete:t,onCancel:n}){let r=ve();ce(`confirm:no`,n,{context:`Confirmation`});let i=(0,$.jsxs)(b,{flexDirection:`column`,marginX:2,children:[(0,$.jsx)(x,{bold:!0,children:L(e.ruleValue)}),(0,$.jsx)(Oe,{ruleValue:e.ruleValue}),(0,$.jsx)(Ge,{rule:e})]}),a=(0,$.jsx)(b,{marginLeft:3,children:r.pending?(0,$.jsxs)(x,{dimColor:!0,children:[`Press `,r.keyName,` again to exit`]}):(0,$.jsx)(x,{dimColor:!0,children:`Esc to cancel`})});return e.source===`policySettings`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(b,{flexDirection:`column`,gap:1,borderStyle:`round`,paddingLeft:1,paddingRight:1,borderColor:`permission`,children:[(0,$.jsx)(x,{bold:!0,color:`permission`,children:`Rule details`}),i,(0,$.jsxs)(x,{italic:!0,children:[`This rule is configured by managed settings and cannot be modified.`,`
|
|
2
|
+
`,`Contact your system administrator for more information.`]})]}),a]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(b,{flexDirection:`column`,gap:1,borderStyle:`round`,paddingLeft:1,paddingRight:1,borderColor:`error`,children:[(0,$.jsxs)(x,{bold:!0,color:`error`,children:[`Delete `,Ke(e.ruleBehavior),` tool?`]}),i,(0,$.jsx)(x,{children:`Are you sure you want to delete this permission rule?`}),(0,$.jsx)(h,{onChange:e=>e===`yes`?t():n(),onCancel:n,options:[{label:`Yes`,value:`yes`},{label:`No`,value:`no`}]})]}),a]})}function Je(e){let{options:t,searchQuery:n,isSearchMode:r,isFocused:i,onSelect:a,onCancel:o,lastFocusedRuleKey:s,cursorOffset:c,onHeaderFocusChange:l}=e,u=k(),{headerFocused:d,focusHeader:f,blurHeader:p}=S();return(0,Q.useEffect)(()=>{r&&d&&p()},[r,d,p]),(0,Q.useEffect)(()=>{l?.(d)},[d,l]),(0,$.jsxs)(b,{flexDirection:`column`,children:[(0,$.jsx)(b,{marginBottom:1,flexDirection:`column`,children:(0,$.jsx)(E,{query:n,isFocused:r&&!d,isTerminalFocused:i,width:u,cursorOffset:c})}),(0,$.jsx)(h,{options:t,onChange:a,onCancel:o,visibleOptionCount:Math.min(10,t.length),isDisabled:r||d,defaultFocusValue:s,onUpFromFirstItem:f})]})}function Ye({tab:e,getRulesOptions:t,handleToolSelect:n,...r}){return(0,$.jsxs)(b,{flexDirection:`column`,flexShrink:e===`allow`?0:void 0,children:[(0,$.jsx)(x,{children:{allow:`Claude Code won't ask before using allowed tools.`,ask:`Claude Code will always ask for confirmation before using these tools.`,deny:`Claude Code will always reject requests to use denied tools.`}[e]}),(0,$.jsx)(Je,{options:t(e,r.searchQuery).options,onSelect:t=>n(t,e),...r})]})}function Xe({onExit:e,initialTab:t,onRetryDenials:n}){let i=De().length>0,o=t??(i?`recent`:`allow`),[s,c]=(0,Q.useState)([]),u=oe(e=>e.toolPermissionContext),f=ie(),p=le(),te=(0,Q.useRef)({approved:new Set,retry:new Set,denials:[]}),m=(0,Q.useCallback)(e=>{te.current=e},[]),[h,g]=(0,Q.useState)(),[ne,re]=(0,Q.useState)(),[_,v]=(0,Q.useState)(null),[y,S]=(0,Q.useState)(null),[C,w]=(0,Q.useState)(!1),[T,E]=(0,Q.useState)(null),[D,k]=(0,Q.useState)(!1),[ue,fe]=(0,Q.useState)(!0),A=(0,Q.useCallback)(e=>{fe(e)},[]),M=(0,Q.useMemo)(()=>{let e=new Map;return a(u).forEach(t=>{e.set(F(t),t)}),e},[u]),N=(0,Q.useMemo)(()=>{let e=new Map;return l(u).forEach(t=>{e.set(F(t),t)}),e},[u]),me=(0,Q.useMemo)(()=>{let e=new Map;return ee(u).forEach(t=>{e.set(F(t),t)}),e},[u]),P=(0,Q.useCallback)((e,t=``)=>{let n=(()=>{switch(e){case`allow`:return M;case`deny`:return N;case`ask`:return me;case`workspace`:case`recent`:return new Map}})(),i=[];e!==`workspace`&&e!==`recent`&&!t&&i.push({label:`Add a new rule${r.ellipsis}`,value:`add-new-rule`});let a=Array.from(n.keys()).sort((e,t)=>{let r=n.get(e),i=n.get(t);if(r&&i){let e=L(r.ruleValue).toLowerCase(),t=L(i.ruleValue).toLowerCase();return e.localeCompare(t)}return 0}),o=t.toLowerCase();for(let e of a){let r=n.get(e);if(r){let n=L(r.ruleValue);if(t&&!n.toLowerCase().includes(o))continue;i.push({label:n,value:e})}}return{options:i,rulesByKey:n}},[M,N,me]),I=ve(),R=!h&&!_&&!y&&!C&&!T,{query:he,setQuery:z,cursorOffset:B}=Ce({isActive:R&&D,onExit:()=>{k(!1)}}),V=(0,Q.useCallback)(e=>{R&&(D||e.ctrl||e.meta||(e.key===`/`?(e.preventDefault(),k(!0),z(``)):e.key.length===1&&e.key!==`j`&&e.key!==`k`&&e.key!==`m`&&e.key!==`i`&&e.key!==`r`&&e.key!==` `&&(e.preventDefault(),k(!0),z(e.key))))},[R,D,z]),H=(0,Q.useCallback)((e,t)=>{let{rulesByKey:n}=P(t);if(e===`add-new-rule`){v(t);return}else{g(n.get(e));return}},[P]),ge=(0,Q.useCallback)(()=>{v(null)},[]),_e=(0,Q.useCallback)((e,t)=>{S({ruleValue:e,ruleBehavior:t}),v(null)},[]),ye=(0,Q.useCallback)((e,t)=>{S(null);for(let t of e)c(e=>[...e,`Added ${t.ruleBehavior} rule ${j.bold(L(t.ruleValue))}`]);if(t&&t.length>0)for(let e of t){let t=e.shadowType===`deny`?`blocked`:`shadowed`;c(n=>[...n,j.yellow(`${r.warning} Warning: ${L(e.rule.ruleValue)} is ${t}`),j.dim(` ${e.reason}`),j.dim(` Fix: ${e.fix}`)])}},[]),be=(0,Q.useCallback)(()=>{S(null)},[]),Se=(0,Q.useCallback)(()=>w(!0),[]),we=(0,Q.useCallback)(e=>E(e),[]),Te=(0,Q.useCallback)(()=>{let t=te.current,r=e=>Array.from(e).map(e=>t.denials[e]).filter(e=>e!==void 0),i=r(t.retry);if(i.length>0){let t=i.map(e=>e.display);n?.(t),e(void 0,{shouldQuery:!0,metaMessages:[`Permission granted for: ${t.join(`, `)}. You may now retry ${t.length===1?`this command`:`these commands`} if you would like.`]});return}let a=r(t.approved);a.length>0||s.length>0?e([...a.length>0?[`Approved ${a.map(e=>j.bold(e.display)).join(`, `)}`]:[],...s].join(`
|
|
3
|
+
`)):e(`Permissions dialog dismissed`,{display:`system`})},[s,e,n]);ce(`confirm:no`,Te,{context:`Settings`,isActive:R&&!D});let Ee=()=>{if(!h)return;let{options:e}=P(h.ruleBehavior),t=F(h),n=e.filter(e=>e.value!==`add-new-rule`).map(e=>e.value),r=n.indexOf(t),i;r!==-1&&(r<n.length-1?i=n[r+1]:r>0&&(i=n[r-1])),re(i),se({rule:h,initialContext:u,setToolPermissionContext(e){f(t=>({...t,toolPermissionContext:e}))}}),c(e=>[...e,`Deleted ${h.ruleBehavior} rule ${j.bold(L(h.ruleValue))}`]),g(void 0)};if(h)return(0,$.jsx)(qe,{rule:h,onDelete:Ee,onCancel:()=>g(void 0)});if(_&&_!==`workspace`&&_!==`recent`)return(0,$.jsx)(Pe,{onCancel:ge,onSubmit:_e,ruleBehavior:_});if(y)return(0,$.jsx)(je,{onAddRules:ye,onCancel:be,ruleValues:[y.ruleValue],ruleBehavior:y.ruleBehavior,initialContext:u,setToolPermissionContext:e=>{f(t=>({...t,toolPermissionContext:e}))}});if(C)return(0,$.jsx)(xe,{onAddDirectory:(e,t)=>{let n={type:`addDirectories`,directories:[e],destination:t?`localSettings`:`session`},r=d(u,n);f(e=>({...e,toolPermissionContext:r})),t&&ae(n),c(n=>[...n,`Added directory ${j.bold(e)} to workspace${t?` and saved to local settings`:` for this session`}`]),w(!1)},onCancel:()=>w(!1),permissionContext:u});if(T)return(0,$.jsx)(ze,{directoryPath:T,onRemove:()=>{c(e=>[...e,`Removed directory ${j.bold(T)} from workspace`]),E(null)},onCancel:()=>E(null),permissionContext:u,setPermissionContext:e=>{f(t=>({...t,toolPermissionContext:e}))}});let U={searchQuery:he,isSearchMode:D,isFocused:p,onCancel:Te,lastFocusedRuleKey:ne,cursorOffset:B,getRulesOptions:P,handleToolSelect:H,onHeaderFocusChange:A};return(0,$.jsx)(b,{flexDirection:`column`,onKeyDown:V,children:(0,$.jsxs)(pe,{color:`permission`,children:[(0,$.jsxs)(de,{title:`Permissions:`,color:`permission`,defaultTab:o,hidden:!!h||!!_||!!y||C||!!T,initialHeaderFocused:!i,navFromContent:!D,children:[(0,$.jsx)(O,{id:`recent`,title:`Recently denied`,children:(0,$.jsx)(Le,{onHeaderFocusChange:A,onStateChange:m})}),(0,$.jsx)(O,{id:`allow`,title:`Allow`,children:(0,$.jsx)(Ye,{tab:`allow`,...U})}),(0,$.jsx)(O,{id:`ask`,title:`Ask`,children:(0,$.jsx)(Ye,{tab:`ask`,...U})}),(0,$.jsx)(O,{id:`deny`,title:`Deny`,children:(0,$.jsx)(Ye,{tab:`deny`,...U})}),(0,$.jsx)(O,{id:`workspace`,title:`Workspace`,children:(0,$.jsxs)(b,{flexDirection:`column`,children:[(0,$.jsx)(x,{children:`Work Mate can read files in the workspace, and make edits when auto-accept edits is on.`}),(0,$.jsx)(He,{onExit:e,toolPermissionContext:u,onRequestAddDirectory:Se,onRequestRemoveDirectory:we,onHeaderFocusChange:A})]})})]}),(0,$.jsx)(b,{marginTop:1,paddingLeft:1,children:(0,$.jsx)(x,{dimColor:!0,children:I.pending?(0,$.jsxs)($.Fragment,{children:[`Press `,I.keyName,` again to exit`]}):ue?(0,$.jsx)($.Fragment,{children:`←/→ tab switch · ↓ return · Esc cancel`}):D?(0,$.jsx)($.Fragment,{children:`Type to filter · Enter/↓ select · ↑ tabs · Esc clear`}):i&&o===`recent`?(0,$.jsx)($.Fragment,{children:`Enter approve · r retry · ↑↓ navigate · ←/→ switch · Esc cancel`}):(0,$.jsx)($.Fragment,{children:`↑↓ navigate · Enter select · Type to search · ←/→ switch · Esc cancel`})})})]})})}var Q,$,Ze=e((()=>{C(),n(),w(),Q=t(w(),1),_(),y(),p(),ye(),we(),A(),i(),U(),H(),te(),I(),Se(),Ne(),be(),ke(),Ie(),Re(),Ve(),We(),$=N()})),Qe,$e;e((()=>{Ze(),o(),Qe=N(),$e=async(e,t)=>(0,Qe.jsx)(Xe,{onExit:e,onRetryDenials:e=>{t.setMessages(t=>[...t,ne(e)])}})}))();export{$e as call};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{n as t,t as n}from"./memoize-BK3gG5ob.js";import{c as r,i,l as a,o}from"./envUtils-DcaKZlRU.js";import{n as s,t as c}from"./axios-DaWTGg7G.js";import{CT as l,Qd as ee,bT as te}from"./loadAgentsDir-BXtV2jiO.js";import{n as ne}from"./cwd-Besi3Os3.js";import{B as re,C as ie,D as ae,R as u,S as d,T as oe,U as se,V as ce,c as f,f as p,i as m,u as h,x as g}from"./debug-Dr1SjdXn.js";import{Kt as le,M as _,P as ue,Qt as de,Xt as fe,Yt as pe,g as me,n as he}from"./settings-DiBMs2gM.js";import{a as ge,c as v,h as y,i as _e}from"./config-9rLTDOYW.js";import{c as ve,n as b,o as ye,r as x,t as S}from"./execFileNoThrow-mXq4K0rl.js";import{o as C,s as w}from"./log-27kCA_9u.js";import{n as be,t as xe}from"./which-mplwBbc0.js";import{i as T,o as E}from"./platform-Dg1c9F_1.js";import{n as D,t as Se}from"./bundledMode--fG1S62b.js";import{dt as Ce,ut as we}from"./sessionState-DSWN4tMV.js";import{a as Te,i as Ee}from"./ripgrep-DQ_ILUJV.js";import{i as De,r as Oe}from"./genericProcessUtils-Dc1pfb7J.js";import{homedir as O}from"os";import{basename as ke,delimiter as Ae,join as k,posix as A,win32 as j}from"path";import{constants as je}from"fs";import{access as M,open as Me,readFile as N,realpath as P,stat as Ne}from"fs/promises";function F(){return k(i(),`local`)}function Pe(){return k(F(),`claude`)}function Fe(){return(process.argv[1]||``).includes(`/.workmate/local/node_modules/`)}async function I(){try{return await M(k(F(),`node_modules`,`.bin`,`claude`)),!0}catch{return!1}}function L(){let e=process.env.SHELL||``;return e.includes(`zsh`)?`zsh`:e.includes(`bash`)?`bash`:e.includes(`fish`)?`fish`:`unknown`}var R=e((()=>{y(),o(),u(),x(),p(),C(),g()}));function z(e){let t=e?.homedir??O();return{zsh:k((e?.env??process.env).ZDOTDIR||t,`.zshrc`),bash:k(t,`.bashrc`),fish:k(t,`.config/fish/config.fish`)}}function Ie(e){let t=!1;return{filtered:e.filter(e=>{if(V.test(e)){let n=e.match(/alias\s+claude\s*=\s*["']([^"']+)["']/);if(n||(n=e.match(/alias\s+claude\s*=\s*([^#\n]+)/)),n&&n[1]&&n[1].trim()===Pe())return t=!0,!1}return!0}),hadAlias:t}}async function B(e){try{return(await N(e,{encoding:`utf8`})).split(`
|
|
2
|
+
`)}catch(e){if(ce(e))return null;throw e}}async function Le(e,t){let n=await Me(e,`w`);try{await n.writeFile(t.join(`
|
|
3
|
+
`),{encoding:`utf8`}),await n.datasync()}finally{await n.close()}}async function Re(e){let t=z(e);for(let e of Object.values(t)){let t=await B(e);if(t){for(let e of t)if(V.test(e)){let t=e.match(/alias\s+claude=["']?([^"'\s]+)/);if(t&&t[1])return t[1]}}}return null}async function ze(e){let t=await Re(e);if(!t)return null;let n=e?.homedir??O(),r=t.startsWith(`~`)?t.replace(`~`,n):t;try{let e=await Ne(r);if(e.isFile()||e.isSymbolicLink())return t}catch{}return null}var V,H=e((()=>{u(),R(),V=/^\s*alias\s+claude\s*=/}));async function Be(){}function Ve(e){let t=he()?.minimumVersion;if(!t)return!1;let n=!we(e,t);return n&&f(`Skipping update to ${e} - below minimumVersion ${t}`),n}async function He(){let e=le.isRunningWithBun(),t=null;return t=e?await b(`bun`,[`pm`,`bin`,`-g`],{cwd:O()}):await b(`npm`,[`-g`,`config`,`get`,`prefix`],{cwd:O()}),t.code===0?t.stdout.trim():(w(Error(`Failed to check ${e?`bun`:`npm`} permissions`)),null)}async function Ue(){try{let e=await He();if(!e)return{hasPermissions:!1,npmPrefix:null};try{return await M(e,je.W_OK),{hasPermissions:!0,npmPrefix:e}}catch{return w(new Je(`Insufficient permissions for global npm install.`)),{hasPermissions:!1,npmPrefix:e}}}catch(e){return w(e),{hasPermissions:!1,npmPrefix:null}}}async function We(){let e=await b(`npm`,[`view`,``,`dist-tags`,`--json`,`--prefer-online`],{abortSignal:AbortSignal.timeout(5e3),cwd:O()});if(e.code!==0)return f(`npm view dist-tags failed with code ${e.code}`),{latest:null,stable:null};try{let t=d(e.stdout.trim());return{latest:typeof t.latest==`string`?t.latest:null,stable:typeof t.stable==`string`?t.stable:null}}catch(e){return f(`Failed to parse dist-tags: ${e}`),{latest:null,stable:null}}}async function Ge(e){try{return(await s.get(`${qe}/${e}`,{timeout:5e3,responseType:`text`})).data.trim()}catch(t){return f(`Failed to fetch ${e} from GCS: ${t}`),null}}async function Ke(){let[e,t]=await Promise.all([Ge(`latest`),Ge(`stable`)]);return{latest:e,stable:t}}var qe,Je,Ye=e((()=>{c(),y(),m(),pe(),o(),u(),x(),p(),ee(),C(),Ce(),me(),H(),g(),qe=`https://storage.googleapis.com/claude-code-dist-86c565f3-f756-42ad-8dfa-d59b1c096819/claude-code-releases`,Je=class extends ae{}}));function U(e,t){return t.includes(e.id)||e.idLike.some(e=>t.includes(e))}function Xe(){let e=process.execPath||process.argv[0]||``;return/[/\\]mise[/\\]installs[/\\]/i.test(e)?(f(`Detected mise installation: ${e}`),!0):!1}function Ze(){let e=process.execPath||process.argv[0]||``;return/[/\\]\.?asdf[/\\]installs[/\\]/i.test(e)?(f(`Detected asdf installation: ${e}`),!0):!1}function W(){let e=T();if(e!==`macos`&&e!==`linux`&&e!==`wsl`)return!1;let t=process.execPath||process.argv[0]||``;return t.includes(`/Caskroom/`)?(f(`Detected Homebrew cask installation: ${t}`),!0):!1}function Qe(){if(T()!==`windows`)return!1;let e=process.execPath||process.argv[0]||``;for(let t of[/Microsoft[/\\]WinGet[/\\]Packages/i,/Microsoft[/\\]WinGet[/\\]Links/i])if(t.test(e))return f(`Detected winget installation: ${e}`),!0;return!1}var G,K,q,J,Y,$e,et=e((()=>{n(),m(),x(),E(),G=t(async()=>{try{let e=await N(`/etc/os-release`,`utf8`),t=e.match(/^ID=["']?(\S+?)["']?\s*$/m),n=e.match(/^ID_LIKE=["']?(.+?)["']?\s*$/m);return{id:t?.[1]??``,idLike:n?.[1]?.split(` `)??[]}}catch{return null}}),K=t(async()=>{if(T()!==`linux`)return!1;let e=await G();if(e&&!U(e,[`arch`]))return!1;let t=await S(`pacman`,[`-Qo`,process.execPath||process.argv[0]||``],{timeout:5e3,useCwd:!1});return t.code===0&&t.stdout?(f(`Detected pacman installation: ${t.stdout.trim()}`),!0):!1}),q=t(async()=>{if(T()!==`linux`)return!1;let e=await G();if(e&&!U(e,[`debian`]))return!1;let t=await S(`dpkg`,[`-S`,process.execPath||process.argv[0]||``],{timeout:5e3,useCwd:!1});return t.code===0&&t.stdout?(f(`Detected deb installation: ${t.stdout.trim()}`),!0):!1}),J=t(async()=>{if(T()!==`linux`)return!1;let e=await G();if(e&&!U(e,[`fedora`,`rhel`,`suse`]))return!1;let t=await S(`rpm`,[`-qf`,process.execPath||process.argv[0]||``],{timeout:5e3,useCwd:!1});return t.code===0&&t.stdout?(f(`Detected rpm installation: ${t.stdout.trim()}`),!0):!1}),Y=t(async()=>{if(T()!==`linux`)return!1;let e=await G();if(e&&!U(e,[`alpine`]))return!1;let t=await S(`apk`,[`info`,`--who-owns`,process.execPath||process.argv[0]||``],{timeout:5e3,useCwd:!1});return t.code===0&&t.stdout?(f(`Detected apk installation: ${t.stdout.trim()}`),!0):!1}),$e=t(async()=>W()?`homebrew`:Qe()?`winget`:Xe()?`mise`:Ze()?`asdf`:await K()?`pacman`:await Y()?`apk`:await q()?`deb`:await J()?`rpm`:`unknown`)}));function tt(){let e=process.argv[1]||``,t=process.execPath||process.argv[0]||``;return T()===`windows`&&(e=e.split(j.sep).join(A.sep),t=t.split(j.sep).join(A.sep)),[e,t]}async function nt(){let[e]=tt();if(D())return W()||Qe()||Xe()||Ze()||await K()||await q()||await J()||await Y()?`package-manager`:`native`;if(Fe())return`npm-local`;if([`/usr/local/lib/node_modules`,`/usr/lib/node_modules`,`/opt/homebrew/lib/node_modules`,`/opt/homebrew/bin`,`/usr/local/bin`,`/.nvm/versions/node/`].some(t=>e.includes(t))||e.includes(`/npm/`)||e.includes(`/nvm/`))return`npm-global`;let t=await ye(`npm config get prefix`,{shell:!0,reject:!1}),n=t.exitCode===0?t.stdout.trim():null;return n&&e.startsWith(n)?`npm-global`:`unknown`}async function rt(){if(D()){try{return await P(process.execPath)}catch{}try{let e=await be(`claude`);if(e)return e}catch{}try{return await h().stat(k(O(),`.local/bin/claude`)),k(O(),`.local/bin/claude`)}catch{}return`native`}try{return process.argv[0]||`unknown`}catch{return`unknown`}}function it(){try{return D()?process.execPath||`unknown`:process.argv[1]||`unknown`}catch{return`unknown`}}async function at(){let e=h(),t=[],n=k(O(),`.workmate`,`local`);await I()&&t.push({type:`npm-local`,path:n});let r=[`@anthropic-ai/workmate`],i=await S(`npm`,[`-g`,`config`,`get`,`prefix`]);if(i.code===0&&i.stdout){let n=i.stdout.trim(),a=T()===`windows`,o=a?k(n,`claude`):k(n,`bin`,`claude`),s=!1;try{await e.stat(o),s=!0}catch{}if(s){let e=!1;try{(await P(o)).includes(`/Caskroom/`)&&(e=W())}catch{}e||t.push({type:`npm-global`,path:o})}else for(let i of r){let r=a?k(n,`node_modules`,i):k(n,`lib`,`node_modules`,i);try{await e.stat(r),t.push({type:`npm-global-orphan`,path:r})}catch{}}}let a=k(O(),`.local`,`bin`,`claude`);try{await e.stat(a),t.push({type:`native`,path:a})}catch{}if(v().installMethod===`native`){let n=k(O(),`.local`,`share`,`claude`);try{await e.stat(n),t.some(e=>e.type===`native`)||t.push({type:`native`,path:n})}catch{}}return t}async function ot(e){let t=[];try{let e=d(await N(k(fe(),`managed-settings.json`),`utf-8`)),n=e&&typeof e==`object`?e.strictPluginOnlyCustomization:void 0;if(n!==void 0&&typeof n!=`boolean`)if(!Array.isArray(n))t.push({issue:`managed-settings.json: strictPluginOnlyCustomization has an invalid value (expected true or an array, got ${typeof n})`,fix:`The field is silently ignored (schema .catch rescues it). Set it to true, or an array of: ${_.join(`, `)}.`});else{let e=n.filter(e=>typeof e==`string`&&!_.includes(e));e.length>0&&t.push({issue:`managed-settings.json: strictPluginOnlyCustomization has ${e.length} value(s) this client doesn't recognize: ${e.map(String).join(`, `)}`,fix:`These are silently ignored (forwards-compat). Known surfaces for this version: ${_.join(`, `)}. Either remove them, or this client is older than the managed-settings intended.`})}}catch{}let n=v();if(e===`development`)return t;if(e===`native`){let e=(process.env.PATH||``).split(Ae),n=k(O(),`.local`,`bin`),r=n;if(T()===`windows`&&(r=n.split(j.sep).join(A.sep)),!e.some(e=>{let t=e;T()===`windows`&&(t=e.split(j.sep).join(A.sep));let n=t.replace(/\/+$/,``),i=e.replace(/[/\\]+$/,``);return n===r||i===`~/.local/bin`||i===`$HOME/.local/bin`}))if(T()===`windows`){let e=n.split(A.sep).join(j.sep);t.push({issue:`Native installation exists but ${e} is not in your PATH`,fix:`Add it by opening: System Properties → Environment Variables → Edit User PATH → New → Add the path above. Then restart your terminal.`})}else{let e=L(),n=z()[e],r=n?n.replace(O(),`~`):`your shell config file`;t.push({issue:`Native installation exists but ~/.local/bin is not in your PATH`,fix:`Run: echo 'export PATH="$HOME/.local/bin:$PATH"' >> ${r} then open a new terminal or run: source ${r}`})}}a(process.env.DISABLE_INSTALLATION_CHECKS)||(e===`npm-local`&&n.installMethod!==`local`&&t.push({issue:`Running from local installation but config install method is '${n.installMethod}'`,fix:`Consider using native installation: claude install`}),e===`native`&&n.installMethod!==`native`&&t.push({issue:`Running native installation but config install method is '${n.installMethod}'`,fix:`Run claude install to update configuration`})),e===`npm-global`&&await I()&&t.push({issue:`Local installation exists but not being used`,fix:`Consider using native installation: claude install`});let r=await Re(),i=await ze();return e===`npm-local`&&!await be(`claude`)&&!i&&(r?t.push({issue:`Local installation not accessible`,fix:`Alias exists but points to invalid target: ${r}. Update alias: alias claude="~/.workmate/local/claude"`}):t.push({issue:`Local installation not accessible`,fix:`Create alias: alias claude="~/.workmate/local/claude"`})),t}function st(){if(T()!==`linux`)return[];let e=[],t=te.getLinuxGlobPatternWarnings();if(t.length>0){let n=t.slice(0,3).join(`, `),r=t.length-3,i=r>0?`${n} (${r} more)`:n;e.push({issue:`Glob patterns in sandbox permission rules are not fully supported on Linux`,fix:`Found ${t.length} pattern(s): ${i}. On Linux, glob patterns in Edit/Read rules will be ignored.`})}return e}async function ct(){let e=await nt(),t=typeof MACRO<`u`?`0.0.12`:`unknown`,n=await rt(),r=it(),i=await at(),a=await ot(e);if(a.push(...st()),e===`native`){let e=i.filter(e=>e.type===`npm-global`||e.type===`npm-global-orphan`||e.type===`npm-local`),t=T()===`windows`;for(let n of e)n.type===`npm-global`?a.push({issue:`Leftover npm global installation at ${n.path}`,fix:`Run: npm -g uninstall @anthropic-ai/workmate`}):n.type===`npm-global-orphan`?a.push({issue:`Orphaned npm global package at ${n.path}`,fix:t?`Run: rmdir /s /q "${n.path}"`:`Run: rm -rf ${n.path}`}):n.type===`npm-local`&&a.push({issue:`Leftover npm local installation at ${n.path}`,fix:t?`Run: rmdir /s /q "${n.path}"`:`Run: rm -rf ${n.path}`})}let o=v().installMethod||`not set`,s=null;e===`npm-global`&&(s=(await Ue()).hasPermissions,!s&&!ge()&&a.push({issue:`Insufficient permissions for auto-updates`,fix:"Do one of: (1) Re-install node without sudo, or (2) Use `claude install` for native installation"}));let c=Ee(),l={working:c.working??!0,mode:c.mode,systemPath:c.mode===`system`?c.path:null,note:c.note??null},ee=e===`package-manager`?await $e():void 0;return{installationType:e,version:t,installationPath:n,invokedBinary:r,configInstallMethod:o,autoUpdates:(()=>{let e=ge();return e?`disabled (${_e(e)})`:`enabled`})(),hasUpdatePermissions:s,multipleInstallations:i,warnings:a,packageManager:ee,ripgrepStatus:l}}var lt=e((()=>{ve(),Ye(),Se(),y(),ne(),o(),x(),p(),R(),et(),E(),Te(),l(),de(),ue(),H(),g(),xe()}));function ut(){let e=process.env.ENABLE_PID_BASED_VERSION_LOCKING;return a(e)?!0:(r(e),!1)}function X(e){if(e<=1)return!1;try{return process.kill(e,0),!0}catch{return!1}}function dt(e,t){if(!X(e))return!1;if(e===process.pid)return!0;try{let n=Oe(e);if(!n)return!0;let r=n.toLowerCase(),i=t.toLowerCase();return r.includes(`claude`)||r.includes(i)}catch{return!0}}function Z(e){let t=h();try{let n=t.readFileSync(e,{encoding:`utf8`});if(!n||n.trim()===``)return null;let r=d(n);return typeof r.pid!=`number`||!r.version||!r.execPath?null:r}catch{return null}}function Q(e){let t=Z(e);if(!t)return!1;let{pid:n,execPath:r}=t;if(!X(n))return!1;if(!dt(n,r))return f(`Lock PID ${n} is running but does not appear to be Claude - treating as stale`),!1;let i=h();try{let t=i.statSync(e);if(Date.now()-t.mtimeMs>$&&!X(n))return!1}catch{}return!0}function ft(e,t){let n=h(),r=`${e}.tmp.${process.pid}.${Date.now()}`;try{oe(r,ie(t,null,2),{encoding:`utf8`,flush:!0}),n.renameSync(r,e)}catch(e){try{n.unlinkSync(r)}catch{}throw e}}async function pt(e,t){let n=h(),r=ke(e);if(Q(t))return f(`Cannot acquire lock for ${r} - held by PID ${Z(t)?.pid}`),null;let i={pid:process.pid,version:r,execPath:process.execPath,acquiredAt:Date.now()};try{return ft(t,i),Z(t)?.pid===process.pid?(f(`Acquired PID lock for ${r} (PID ${process.pid})`),()=>{try{Z(t)?.pid===process.pid&&(n.unlinkSync(t),f(`Released PID lock for ${r}`))}catch(e){f(`Failed to release lock for ${r}: ${e}`)}}):null}catch(e){return f(`Failed to acquire lock for ${r}: ${e}`),null}}async function mt(e,t){let n=await pt(e,t);if(!n)return!1;let r=()=>{try{n()}catch{}};return process.on(`exit`,r),process.on(`SIGINT`,r),process.on(`SIGTERM`,r),!0}async function ht(e,t,n){let r=await pt(e,t);if(!r)return!1;try{return await n(),!0}finally{r()}}function gt(e){let t=h(),n=[];try{let r=t.readdirStringSync(e).filter(e=>e.endsWith(`.lock`));for(let t of r){let r=k(e,t),i=Z(r);i&&n.push({version:i.version,pid:i.pid,isProcessRunning:X(i.pid),execPath:i.execPath,acquiredAt:new Date(i.acquiredAt),lockFilePath:r})}}catch(e){if(re(e))return n;w(se(e))}return n}function _t(e){let t=h(),n=0;try{let r=t.readdirStringSync(e).filter(e=>e.endsWith(`.lock`));for(let i of r){let r=k(e,i);try{t.lstatSync(r).isDirectory()?(t.rmSync(r,{recursive:!0,force:!0}),n++,f(`Cleaned up legacy directory lock: ${i}`)):Q(r)||(t.unlinkSync(r),n++,f(`Cleaned up stale lock: ${i}`))}catch{}}}catch(e){if(re(e))return 0;w(se(e))}return n}var $,vt=e((()=>{m(),o(),u(),p(),De(),C(),g(),$=7200*1e3}));export{R as C,L as S,Ie as _,Q as a,B as b,ht as c,lt as d,Ke as f,Ve as g,Ye as h,vt as i,nt as l,We as m,_t as n,ut as o,Be as p,gt as r,Z as s,mt as t,ct as u,z as v,Le as x,H as y};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{A as t,
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{A as t,C as n,Mb as r,Qg as i,_E as a,mE as o,pE as s,t_ as c,wb as l}from"./loadAgentsDir-BXtV2jiO.js";import{I as u,P as d,fi as f,t as p}from"./src-P_wYS_NJ2.js";import{t as m}from"./jsx-runtime-Bb4Xn-E0.js";import{Wt as h,zt as g}from"./state-BPFYBqm1.js";import{a as _,i as v,r as y,t as b}from"./promptEditor-Bo1d8ZLq.js";import{r as x,t as S}from"./staticRender-DrU6eWoq.js";function C({planContent:e,planPath:t,editorName:n}){return(0,T.jsxs)(u,{flexDirection:`column`,children:[(0,T.jsx)(d,{bold:!0,children:`Current Plan`}),(0,T.jsx)(d,{dimColor:!0,children:t}),(0,T.jsx)(u,{marginTop:1,children:(0,T.jsx)(d,{children:e})}),n&&(0,T.jsxs)(u,{marginTop:1,children:[(0,T.jsx)(d,{dimColor:!0,children:`"/plan open"`}),(0,T.jsx)(d,{dimColor:!0,children:` to edit this plan in `}),(0,T.jsx)(d,{bold:!0,dimColor:!0,children:n})]})]})}async function w(e,n,a){let{getAppState:c,setAppState:l}=n,u=c().toolPermissionContext.mode;if(u!==`plan`){g(u,`plan`),l(e=>({...e,toolPermissionContext:i(t(e.toolPermissionContext),{type:`setMode`,mode:`plan`,destination:`session`})}));let n=a.trim();return n&&n!==`open`?e(`Enabled plan mode`,{shouldQuery:!0}):e(`Enabled plan mode`),null}let d=s(),f=o();if(!d)return e(`Already in plan mode. No plan written yet.`),null;if(a.trim().split(/\s+/)[0]===`open`){let t=await b(f);return t.error?e(`Failed to open plan in editor: ${t.error}`):e(`Opened plan in editor: ${f}`),null}let p=v();return e(await x((0,T.jsx)(C,{planContent:d,planPath:f,editorName:p?r(p):void 0}))),null}var T;e((()=>{f(),h(),p(),_(),l(),c(),n(),a(),y(),S(),T=m()}))();export{w as call};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{n as t,t as n}from"./memoize-BK3gG5ob.js";import{
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{n as t,t as n}from"./memoize-BK3gG5ob.js";import{f as r,u as i}from"./debug-Dr1SjdXn.js";import{o as a,s as o}from"./log-27kCA_9u.js";import{release as s}from"os";import{readFile as c,readdir as l}from"fs/promises";async function u(e){let t=new Set;process.env.P4PORT&&t.add(`perforce`);try{let n=e??i().cwd(),r=new Set(await l(n));for(let[e,n]of h)r.has(e)&&t.add(n)}catch{}return[...t]}var d,f,p,m,h,g=e((()=>{n(),r(),a(),d=[`macos`,`wsl`],f=t(()=>{try{if(process.platform===`darwin`)return`macos`;if(process.platform===`win32`)return`windows`;if(process.platform===`linux`){try{let e=i().readFileSync(`/proc/version`,{encoding:`utf8`});if(e.toLowerCase().includes(`microsoft`)||e.toLowerCase().includes(`wsl`))return`wsl`}catch(e){o(e)}return`linux`}return`unknown`}catch(e){return o(e),`unknown`}}),p=t(()=>{if(process.platform===`linux`)try{let e=i().readFileSync(`/proc/version`,{encoding:`utf8`}),t=e.match(/WSL(\d+)/i);return t&&t[1]?t[1]:e.toLowerCase().includes(`microsoft`)?`1`:void 0}catch(e){o(e);return}}),m=t(async()=>{if(process.platform!==`linux`)return;let e={linuxKernel:s()};try{let t=await c(`/etc/os-release`,`utf8`);for(let n of t.split(`
|
|
2
2
|
`)){let t=n.match(/^(ID|VERSION_ID)=(.*)$/);if(t&&t[1]&&t[2]){let n=t[2].replace(/^"|"$/g,``);t[1]===`ID`?e.linuxDistroId=n:e.linuxDistroVersion=n}}}catch{}return e}),h=[[`.git`,`git`],[`.hg`,`mercurial`],[`.svn`,`svn`],[`.p4config`,`perforce`],[`$tf`,`tfs`],[`.tfvc`,`tfs`],[`.jj`,`jujutsu`],[`.sl`,`sapling`]]}));export{p as a,f as i,u as n,g as o,m as r,d as t};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{l as n,o as r}from"./envUtils-DcaKZlRU.js";import{n as i,t as a}from"./figures-5ThXQEtq.js";import{$o as o,AC as s,Ao as c,Bo as l,Do as u,Fw as d,Fx as f,Go as p,IC as m,Io as h,Jo as g,Jw as _,Mp as v,No as y,Nu as b,Oo as x,Pw as S,Qo as ee,Rx as te,Uo as C,Ww as w,Xw as T,Zo as ne,_S as E,_o as D,as as re,bS as O,bg as k,cS as A,cd as ie,cs as j,dS as M,do as ae,eT as oe,es as se,fS as N,fo as ce,gS as P,hS as F,iT as I,jp as L,ju as le,jw as ue,lg as de,mS as fe,ns as pe,og as me,pS as he,qo as ge,rT as _e,rs as ve,sS as R,sd as ye,sg as be,ss as xe,tT as Se,ts as Ce,vS as we,vo as Te,wo as Ee,xS as De,xg as Oe,yS as ke,zo as Ae}from"./loadAgentsDir-BXtV2jiO.js";import{D as je,Gr as Me,Gt as z,H as Ne,I as B,P as V,T as Pe,Wt as Fe,Xn as Ie,fi as H,hn as Le,j as Re,k as ze,n as Be,ot as Ve,r as He,t as Ue,x as We,y as Ge}from"./src-P_wYS_NJ2.js";import{t as Ke}from"./jsx-runtime-Bb4Xn-E0.js";import{P as qe,R as Je,S as Ye,U as Xe,c as Ze,i as Qe,x as $e}from"./debug-Dr1SjdXn.js";import{Ln as et,Rn as tt,c as nt,f as rt,g as it,vt as at,x as ot,xt as st}from"./settings-DiBMs2gM.js";import{b as ct,h as lt}from"./config-9rLTDOYW.js";import{o as ut,s as dt}from"./log-27kCA_9u.js";import{n as ft,r as pt}from"./analytics-DJobLaWP.js";import{C as mt,y as ht}from"./startupProfiler-Dc5r6LgE.js";import{l as gt,o as _t}from"./stringUtils-Df-Lnjxd.js";import{n as vt,t as yt}from"./pluginStartupCheck-BEd0VeQC.js";import{a as bt,d as xt,f as St,i as Ct,l as wt,o as Tt,s as Et,u as Dt}from"./pluginOperations-BFbty6WT.js";import{a as Ot,c as kt,i as At,n as jt,o as Mt,s as Nt,t as Pt}from"./validatePlugin-jrcrYEIu.js";import{a as Ft,n as It,o as Lt,r as Rt}from"./pluginFlagging-CXSSOj4J.js";import{i as zt,n as Bt}from"./MCPConnectionManager-BpjC7CEo.js";import{n as Vt,t as Ht}from"./useExitOnCtrlCDWithKeybindings-BHQfwlAl.js";import{t as Ut}from"./SearchBox-C9vUA4IM.js";import{n as Wt,t as Gt}from"./useSearchInput-q2CFPU4W.js";import{a as Kt,c as qt,i as Jt,n as Yt,o as Xt,r as Zt,s as Qt,t as $t}from"./MCPToolListView-Rb1Q--jG.js";import{i as en,n as tn}from"./pluginAutoupdate-B5lel6s5.js";import*as nn from"path";import*as rn from"fs/promises";function an({inputValue:e,setInputValue:t,cursorOffset:n,setCursorOffset:r,error:i,setError:a,result:o,setResult:s,setViewState:c,onAddComplete:l,cliMode:u=!1}){let d=(0,on.useRef)(!1),[f,p]=(0,on.useState)(!1),[m,h]=(0,on.useState)(``),g=async()=>{let t=e.trim();if(!t){a(`Please enter a marketplace source`);return}let n=await Ot(t);if(!n){a(`Invalid marketplace source format. Try: owner/repo, https://..., or ./path`);return}if(`error`in n){a(n.error);return}a(null);try{p(!0),h(``);let{name:e,resolvedSource:t}=await y(n,e=>{h(e)});ge(e,{source:t}),xe();let r=n.source;n.source===`github`&&(r=n.repo),pt(`tengu_marketplace_added`,{source_type:r}),l&&await l(),h(``),p(!1),u?s(`Successfully added marketplace: ${e}`):c({type:`browse-marketplace`,targetMarketplace:e})}catch(e){let t=Xe(e);dt(t),a(t.message),h(``),p(!1),s(u?`Error: ${t.message}`:null)}};return(0,on.useEffect)(()=>{e&&!d.current&&!i&&!o&&(d.current=!0,g())},[]),(0,U.jsxs)(B,{flexDirection:`column`,children:[(0,U.jsxs)(B,{flexDirection:`column`,paddingX:1,borderStyle:`round`,children:[(0,U.jsx)(B,{marginBottom:1,children:(0,U.jsx)(V,{bold:!0,children:`Add Marketplace`})}),(0,U.jsxs)(B,{flexDirection:`column`,children:[(0,U.jsx)(V,{children:`Enter marketplace source:`}),(0,U.jsx)(V,{dimColor:!0,children:`Examples:`}),(0,U.jsx)(V,{dimColor:!0,children:` · owner/repo (GitHub)`}),(0,U.jsx)(V,{dimColor:!0,children:` · git@github.com:owner/repo.git (SSH)`}),(0,U.jsx)(V,{dimColor:!0,children:` · https://example.com/marketplace.json`}),(0,U.jsx)(V,{dimColor:!0,children:` · ./path/to/marketplace`}),(0,U.jsx)(B,{marginTop:1,children:(0,U.jsx)(ye,{value:e,onChange:t,onSubmit:g,columns:80,cursorOffset:n,onChangeCursorOffset:r,focus:!0,showCursor:!0})})]}),f&&(0,U.jsxs)(B,{marginTop:1,children:[(0,U.jsx)(le,{}),(0,U.jsx)(V,{children:m||`Adding marketplace to configuration…`})]}),i&&(0,U.jsx)(B,{marginTop:1,children:(0,U.jsx)(V,{color:`error`,children:i})}),o&&(0,U.jsx)(B,{marginTop:1,children:(0,U.jsx)(V,{children:o})})]}),(0,U.jsx)(B,{marginLeft:3,children:(0,U.jsx)(V,{dimColor:!0,italic:!0,children:(0,U.jsxs)(Pe,{children:[(0,U.jsx)(je,{shortcut:`Enter`,action:`add`}),(0,U.jsx)(L,{action:`confirm:no`,context:`Settings`,fallback:`Esc`,description:`cancel`})]})})})]})}var on,U,sn=e((()=>{H(),on=t(H(),1),ft(),v(),Ue(),b(),ie(),Je(),ut(),j(),Ae(),At(),U=Ke()}));function cn(e,t,r,i){let a={};for(let o of e){let e=r[o],s=t[o]??``;if(!(e?.sensitive===!0&&s===``&&i?.[o]!==void 0))if(e?.type===`number`){if(s.trim()===``)continue;let e=Number(s);a[o]=Number.isNaN(e)?s:e}else e?.type===`boolean`?a[o]=n(s):a[o]=s}return a}function ln({title:e,subtitle:t,configSchema:n,initialValues:r,onSave:i,onCancel:o}){let s=Object.keys(n),c=(0,un.useCallback)(e=>{if(n[e]?.sensitive===!0)return``;let t=r?.[e];return t===void 0?``:String(t)},[n,r]),[l,u]=(0,un.useState)(0),[d,f]=(0,un.useState)({}),[p,m]=(0,un.useState)(()=>s[0]?c(s[0]):``),h=s[l],g=h?n[h]:null;if(Fe(`confirm:no`,o,{context:`Settings`}),z({"confirm:nextField":(0,un.useCallback)(()=>{if(l<s.length-1&&h){f(e=>({...e,[h]:p})),u(e=>e+1);let e=s[l+1];m(e?c(e):``)}},[l,s,h,p,c]),"confirm:yes":(0,un.useCallback)(()=>{if(!h)return;let e={...d,[h]:p};if(l===s.length-1)i(cn(s,e,n,r));else{f(e),u(e=>e+1);let t=s[l+1];m(t?c(t):``)}},[h,d,p,l,s,n,i,c,r])},{context:`Confirmation`}),Le((e,t)=>{if(t.backspace||t.delete){m(e=>e.slice(0,-1));return}e&&!t.ctrl&&!t.meta&&!t.tab&&!t.return&&m(t=>t+e)}),!g||!h)return null;let _=g.sensitive===!0,v=g.required===!0,y=_?`*`.repeat(Me(p)):p;return(0,dn.jsxs)(Ge,{title:e,subtitle:t,onCancel:o,isCancelActive:!1,children:[(0,dn.jsxs)(B,{flexDirection:`column`,children:[(0,dn.jsxs)(V,{bold:!0,children:[g.title||h,v&&(0,dn.jsx)(V,{color:`error`,children:` *`})]}),g.description&&(0,dn.jsx)(V,{dimColor:!0,children:g.description}),(0,dn.jsxs)(B,{marginTop:1,children:[(0,dn.jsxs)(V,{children:[a.pointerSmall,` `]}),(0,dn.jsx)(V,{children:y}),(0,dn.jsx)(V,{children:`█`})]})]}),(0,dn.jsxs)(B,{flexDirection:`column`,children:[(0,dn.jsxs)(V,{dimColor:!0,children:[`Field `,l+1,` of `,s.length]}),l<s.length-1&&(0,dn.jsx)(V,{dimColor:!0,children:`Tab: Next field · Enter: Save and continue`}),l===s.length-1&&(0,dn.jsx)(V,{dimColor:!0,children:`Enter: Save configuration`})]})]})}var un,dn,fn=e((()=>{i(),un=t(H(),1),Ue(),s(),r(),dn=Ke()}));async function pn(e){let{enabled:t,disabled:n}=await ce();return[...t,...n].find(t=>t.repository===e||t.source===e)}function mn({plugin:e,pluginId:t,onDone:n}){let[r]=hn.useState(()=>{let n=[],r=M(e);Object.keys(r).length>0&&n.push({key:`top-level`,title:`Configure ${e.name}`,subtitle:`Plugin options`,schema:r,load:()=>he(t),save:n=>fe(t,n,e.manifest.userConfig)});let i=R(e);for(let r of i)n.push({key:`channel:${r.server}`,title:`Configure ${r.displayName}`,subtitle:`Plugin: ${e.name}`,schema:r.configSchema,load:()=>E(t,r.server)??void 0,save:e=>ke(t,r.server,e,r.configSchema)});return n}),[i,a]=hn.useState(0),o=hn.useRef(n);if(o.current=n,hn.useEffect(()=>{r.length===0&&o.current(`skipped`)},[r.length]),r.length===0)return null;let s=r[i];function c(e){try{s.save(e)}catch(e){n(`error`,qe(e));return}let t=i+1;t<r.length?a(t):n(`configured`)}return(0,gn.jsx)(ln,{title:s.title,subtitle:s.subtitle,configSchema:s.schema,initialValues:s.load(),onSave:c,onCancel:()=>n(`skipped`)},s.key)}var hn,gn,_n=e((()=>{hn=t(H(),1),Je(),F(),A(),ae(),N(),fn(),gn=Ke()}));function vn(){let e=pe();return(0,yn.jsxs)(B,{marginBottom:1,children:[(0,yn.jsxs)(V,{color:`claude`,children:[a.warning,` `]}),(0,yn.jsxs)(V,{dimColor:!0,italic:!0,children:[`Make sure you trust a plugin before installing, updating, or using it. We do not control what MCP servers, files, or other software are included in plugins and cannot verify that they will work as intended or that they won't change. See each plugin's homepage for more information.`,e?` ${e}`:``]})]})}var yn,bn=e((()=>{i(),H(),Ue(),ve(),yn=Ke()}));function xn(e){return e.entry.source&&typeof e.entry.source==`object`&&`source`in e.entry.source&&e.entry.source.source===`github`&&typeof e.entry.source==`object`&&`repo`in e.entry.source?e.entry.source.repo:null}function Sn(e,t){let n=[{label:`Install for you (user scope)`,action:`install-user`},{label:`Install for all collaborators on this repository (project scope)`,action:`install-project`},{label:`Install for you, in this repo only (local scope)`,action:`install-local`}];return e&&n.push({label:`Open homepage`,action:`homepage`}),t&&n.push({label:`View on GitHub`,action:`github`}),n.push({label:`Back to plugin list`,action:`back`}),n}function Cn({hasSelection:e}){return(0,wn.jsx)(B,{marginTop:1,children:(0,wn.jsx)(V,{dimColor:!0,italic:!0,children:(0,wn.jsxs)(Pe,{children:[e&&(0,wn.jsx)(L,{action:`plugin:install`,context:`Plugin`,fallback:`i`,description:`install`,bold:!0}),(0,wn.jsx)(L,{action:`plugin:toggle`,context:`Plugin`,fallback:`Space`,description:`toggle`}),(0,wn.jsx)(L,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`details`}),(0,wn.jsx)(L,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]})})})}var wn,Tn=e((()=>{H(),v(),Ue(),wn=Ke()}));function En({totalItems:e,maxVisible:t=On,selectedIndex:n=0}){let r=e>t,i=(0,Dn.useRef)(0),a=(0,Dn.useMemo)(()=>{if(!r)return 0;let a=i.current;if(n<a)return i.current=n,n;if(n>=a+t){let e=n-t+1;return i.current=e,e}let o=Math.max(0,e-t),s=Math.min(a,o);return i.current=s,s},[n,t,r,e]),o=a,s=Math.min(a+t,e),c=(0,Dn.useCallback)(e=>r?e.slice(o,s):e,[r,o,s]),l=(0,Dn.useCallback)(e=>o+e,[o]),u=(0,Dn.useCallback)(e=>e>=o&&e<s,[o,s]),d=(0,Dn.useCallback)(e=>{},[]),f=(0,Dn.useCallback)(()=>{},[]),p=(0,Dn.useCallback)(()=>{},[]),m=(0,Dn.useCallback)((t,n)=>{n(Math.max(0,Math.min(t,e-1)))},[e]),h=(0,Dn.useCallback)((e,t)=>!1,[]),g=Math.max(1,Math.ceil(e/t));return{currentPage:Math.floor(a/t),totalPages:g,startIndex:o,endIndex:s,needsPagination:r,pageSize:t,getVisibleItems:c,toActualIndex:l,isOnCurrentPage:u,goToPage:d,nextPage:f,prevPage:p,handleSelectionChange:m,handlePageNavigation:h,scrollPosition:{current:n+1,total:e,canScrollUp:a>0,canScrollDown:a+t<e}}}var Dn,On,kn=e((()=>{Dn=t(H(),1),On=5}));function An({error:e,setError:t,result:n,setResult:r,setViewState:i,onInstallComplete:s,targetMarketplace:c,targetPlugin:d}){let[f,p]=(0,W.useState)(`marketplace-list`),[m,g]=(0,W.useState)(null),[_,v]=(0,W.useState)(null),[y,b]=(0,W.useState)([]),[S,ee]=(0,W.useState)([]),[te,C]=(0,W.useState)(!0),[w,T]=(0,W.useState)(null),[E,D]=(0,W.useState)(0),[O,k]=(0,W.useState)(new Set),[A,ie]=(0,W.useState)(new Set),j=En({totalItems:S.length,selectedIndex:E}),[M,ae]=(0,W.useState)(0),[oe,N]=(0,W.useState)(!1),[ce,P]=(0,W.useState)(null),[F,I]=(0,W.useState)(null);Fe(`confirm:no`,jn.useCallback(()=>{f===`plugin-list`?c?i({type:`manage-marketplaces`,targetMarketplace:c}):y.length===1?i({type:`menu`}):(p(`marketplace-list`),g(null),k(new Set)):f===`plugin-details`?(p(`plugin-list`),v(null)):i({type:`menu`})},[f,c,i,y.length]),{context:`Confirmation`}),(0,W.useEffect)(()=>{async function e(){try{let e=await l(),{marketplaces:n,failures:r}=await re(e),i=[];for(let{name:e,config:t,data:r}of n)if(r){let n=et(r.plugins,t=>x(ne(t.name,e)));i.push({name:e,totalPlugins:r.plugins.length,installedCount:n,source:Ce(t.source)})}i.sort((e,t)=>e.name===`claude-plugin-directory`?-1:+(t.name===`claude-plugin-directory`)),b(i);let a=se(r,et(n,e=>e.data!==null));if(a)if(a.type===`warning`)I(a.message+`. Showing available marketplaces.`);else throw Error(a.message);if(i.length===1&&!c&&!d){let e=i[0];e&&(g(e.name),p(`plugin-list`))}if(d){let n=null,r=null;for(let[t]of Object.entries(e)){let e=await h(t);if(e){let i=e.plugins.find(e=>e.name===d);if(i){let e=ne(i.name,t);n={entry:i,marketplaceName:t,pluginId:e,isInstalled:u(e)},r=t;break}}}if(n&&r){let e=n.pluginId;u(e)?t(`Plugin '${e}' is already installed globally. Use '/plugin' to manage existing plugins.`):(g(r),v(n),p(`plugin-details`))}else t(`Plugin "${d}" not found in any marketplace`)}else c&&(i.some(e=>e.name===c)?(g(c),p(`plugin-list`)):t(`Marketplace "${c}" not found`))}catch(e){t(e instanceof Error?e.message:`Failed to load marketplaces`)}finally{C(!1)}}e()},[t,c,d]),(0,W.useEffect)(()=>{if(!m)return;let e=!1;async function n(n){C(!0);try{let t=await h(n);if(e)return;if(!t)throw Error(`Failed to load marketplace: ${n}`);let r=[];for(let e of t.plugins){let t=ne(e.name,n);Oe(t)||r.push({entry:e,marketplaceName:n,pluginId:t,isInstalled:u(t)})}try{let t=await Nt();if(e)return;T(t),t?r.sort((e,n)=>{let r=t.get(e.pluginId)??0,i=t.get(n.pluginId)??0;return r===i?e.entry.name.localeCompare(n.entry.name):i-r}):r.sort((e,t)=>e.entry.name.localeCompare(t.entry.name))}catch(t){if(e)return;Ze(`Failed to fetch install counts: ${qe(t)}`),r.sort((e,t)=>e.entry.name.localeCompare(t.entry.name))}ee(r),D(0),k(new Set)}catch(n){if(e)return;t(n instanceof Error?n.message:`Failed to load plugins`)}finally{C(!1)}}return n(m),()=>{e=!0}},[m,t]);let le=async()=>{if(O.size===0)return;let e=S.filter(e=>O.has(e.pluginId));ie(new Set(e.map(e=>e.pluginId)));let n=0,a=0,c=[];for(let t of e){let e=await Te({pluginId:t.pluginId,entry:t.entry,marketplaceName:t.marketplaceName,scope:`user`});e.success?n++:(a++,c.push({name:t.entry.name,reason:e.error}))}ie(new Set),k(new Set),xe(),a===0?r(`✓ Installed ${n} ${gt(n,`plugin`)}. Run /reload-plugins to activate.`):n===0?t(`Failed to install: ${o(c,!0)}`):r(`✓ Installed ${n} of ${n+a} plugins. Failed: ${o(c,!1)}. Run /reload-plugins to activate successfully installed plugins.`),n>0&&s&&await s(),i({type:`menu`})},ue=async(e,t=`user`)=>{N(!0),P(null);let n=await Te({pluginId:e.pluginId,entry:e.entry,marketplaceName:e.marketplaceName,scope:t});if(n.success){let t=await pn(e.pluginId);if(t){N(!1),p({type:`plugin-options`,plugin:t,pluginId:e.pluginId});return}r(n.message),s&&await s(),i({type:`menu`})}else N(!1),P(n.error)};(0,W.useEffect)(()=>{e&&r(e)},[e,r]),z({"select:previous":()=>{E>0&&D(E-1)},"select:next":()=>{E<y.length-1&&D(E+1)},"select:accept":()=>{let e=y[E];e&&(g(e.name),p(`plugin-list`))}},{context:`Select`,isActive:f===`marketplace-list`}),z({"select:previous":()=>{E>0&&j.handleSelectionChange(E-1,D)},"select:next":()=>{E<S.length-1&&j.handleSelectionChange(E+1,D)},"select:accept":()=>{if(E===S.length&&O.size>0)le();else if(E<S.length){let e=S[E];e&&(e.isInstalled?i({type:`manage-plugins`,targetPlugin:e.entry.name,targetMarketplace:e.marketplaceName}):(v(e),p(`plugin-details`),ae(0),P(null)))}}},{context:`Select`,isActive:f===`plugin-list`}),z({"plugin:toggle":()=>{if(E<S.length){let e=S[E];if(e&&!e.isInstalled){let t=new Set(O);t.has(e.pluginId)?t.delete(e.pluginId):t.add(e.pluginId),k(t)}}},"plugin:install":()=>{O.size>0&&le()}},{context:`Plugin`,isActive:f===`plugin-list`});let de=jn.useMemo(()=>{if(!_)return[];let e=_.entry.homepage;return Sn(e,xn(_))},[_]);if(z({"select:previous":()=>{M>0&&ae(M-1)},"select:next":()=>{M<de.length-1&&ae(M+1)},"select:accept":()=>{if(!_)return;let e=de[M]?.action,t=_.entry.homepage,n=xn(_);e===`install-user`?ue(_,`user`):e===`install-project`?ue(_,`project`):e===`install-local`?ue(_,`local`):e===`homepage`&&t?De(t):e===`github`&&n?De(`https://github.com/${n}`):e===`back`&&(p(`plugin-list`),v(null))}},{context:`Select`,isActive:f===`plugin-details`&&!!_}),typeof f==`object`&&f.type===`plugin-options`){let{plugin:e,pluginId:t}=f;function n(e){r(e),s&&s(),i({type:`menu`})}return(0,G.jsx)(mn,{plugin:e,pluginId:t,onDone:(t,r)=>{switch(t){case`configured`:n(`✓ Installed and configured ${e.name}. Run /reload-plugins to apply.`);break;case`skipped`:n(`✓ Installed ${e.name}. Run /reload-plugins to apply.`);break;case`error`:n(`Installed but failed to save config: ${r}`);break}}})}if(te)return(0,G.jsx)(V,{children:`Loading…`});if(e)return(0,G.jsx)(V,{color:`error`,children:e});if(f===`marketplace-list`)return y.length===0?(0,G.jsxs)(B,{flexDirection:`column`,children:[(0,G.jsx)(B,{marginBottom:1,children:(0,G.jsx)(V,{bold:!0,children:`Select marketplace`})}),(0,G.jsx)(V,{children:`No marketplaces configured.`}),(0,G.jsxs)(V,{dimColor:!0,children:[`Add a marketplace first using `,`'Add marketplace'`,`.`]}),(0,G.jsx)(B,{marginTop:1,paddingLeft:1,children:(0,G.jsx)(V,{dimColor:!0,children:(0,G.jsx)(L,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`})})})]}):(0,G.jsxs)(B,{flexDirection:`column`,children:[(0,G.jsx)(B,{marginBottom:1,children:(0,G.jsx)(V,{bold:!0,children:`Select marketplace`})}),F&&(0,G.jsx)(B,{marginBottom:1,flexDirection:`column`,children:(0,G.jsxs)(V,{color:`warning`,children:[a.warning,` `,F]})}),y.map((e,t)=>(0,G.jsxs)(B,{flexDirection:`column`,marginBottom:+(t<y.length-1),children:[(0,G.jsx)(B,{children:(0,G.jsxs)(V,{color:E===t?`suggestion`:void 0,children:[E===t?a.pointer:` `,` `,e.name]})}),(0,G.jsx)(B,{marginLeft:2,children:(0,G.jsxs)(V,{dimColor:!0,children:[e.totalPlugins,` `,gt(e.totalPlugins,`plugin`),` available`,e.installedCount>0&&` · ${e.installedCount} already installed`,e.source&&` · ${e.source}`]})})]},e.name)),(0,G.jsx)(B,{marginTop:1,children:(0,G.jsx)(V,{dimColor:!0,italic:!0,children:(0,G.jsxs)(Pe,{children:[(0,G.jsx)(L,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`select`}),(0,G.jsx)(L,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`})]})})})]});if(f===`plugin-details`&&_){let e=_.entry.homepage,t=Sn(e,xn(_));return(0,G.jsxs)(B,{flexDirection:`column`,children:[(0,G.jsx)(B,{marginBottom:1,children:(0,G.jsx)(V,{bold:!0,children:`Plugin Details`})}),(0,G.jsxs)(B,{flexDirection:`column`,marginBottom:1,children:[(0,G.jsx)(V,{bold:!0,children:_.entry.name}),_.entry.version&&(0,G.jsxs)(V,{dimColor:!0,children:[`Version: `,_.entry.version]}),_.entry.description&&(0,G.jsx)(B,{marginTop:1,children:(0,G.jsx)(V,{children:_.entry.description})}),_.entry.author&&(0,G.jsx)(B,{marginTop:1,children:(0,G.jsxs)(V,{dimColor:!0,children:[`By:`,` `,typeof _.entry.author==`string`?_.entry.author:_.entry.author.name]})})]}),(0,G.jsxs)(B,{flexDirection:`column`,marginBottom:1,children:[(0,G.jsx)(V,{bold:!0,children:`Will install:`}),_.entry.commands&&(0,G.jsxs)(V,{dimColor:!0,children:[`· Commands:`,` `,Array.isArray(_.entry.commands)?_.entry.commands.join(`, `):Object.keys(_.entry.commands).join(`, `)]}),_.entry.agents&&(0,G.jsxs)(V,{dimColor:!0,children:[`· Agents:`,` `,Array.isArray(_.entry.agents)?_.entry.agents.join(`, `):Object.keys(_.entry.agents).join(`, `)]}),_.entry.hooks&&(0,G.jsxs)(V,{dimColor:!0,children:[`· Hooks: `,Object.keys(_.entry.hooks).join(`, `)]}),_.entry.mcpServers&&(0,G.jsxs)(V,{dimColor:!0,children:[`· MCP Servers:`,` `,Array.isArray(_.entry.mcpServers)?_.entry.mcpServers.join(`, `):typeof _.entry.mcpServers==`object`?Object.keys(_.entry.mcpServers).join(`, `):`configured`]}),!_.entry.commands&&!_.entry.agents&&!_.entry.hooks&&!_.entry.mcpServers&&(0,G.jsx)(G.Fragment,{children:typeof _.entry.source==`object`&&`source`in _.entry.source&&(_.entry.source.source===`github`||_.entry.source.source===`url`||_.entry.source.source===`npm`||_.entry.source.source===`pip`)?(0,G.jsx)(V,{dimColor:!0,children:`· Component summary not available for remote plugin`}):(0,G.jsx)(V,{dimColor:!0,children:`· Components will be discovered at installation`})})]}),(0,G.jsx)(vn,{}),ce&&(0,G.jsx)(B,{marginBottom:1,children:(0,G.jsxs)(V,{color:`error`,children:[`Error: `,ce]})}),(0,G.jsx)(B,{flexDirection:`column`,children:t.map((e,t)=>(0,G.jsxs)(B,{children:[M===t&&(0,G.jsx)(V,{children:`> `}),M!==t&&(0,G.jsx)(V,{children:` `}),(0,G.jsx)(V,{bold:M===t,children:oe&&e.action===`install`?`Installing…`:e.label})]},e.action))}),(0,G.jsx)(B,{marginTop:1,paddingLeft:1,children:(0,G.jsx)(V,{dimColor:!0,children:(0,G.jsxs)(Pe,{children:[(0,G.jsx)(L,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`select`}),(0,G.jsx)(L,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]})})})]})}if(S.length===0)return(0,G.jsxs)(B,{flexDirection:`column`,children:[(0,G.jsx)(B,{marginBottom:1,children:(0,G.jsx)(V,{bold:!0,children:`Install plugins`})}),(0,G.jsx)(V,{dimColor:!0,children:`No new plugins available to install.`}),(0,G.jsx)(V,{dimColor:!0,children:`All plugins from this marketplace are already installed.`}),(0,G.jsx)(B,{marginLeft:3,children:(0,G.jsx)(V,{dimColor:!0,italic:!0,children:(0,G.jsx)(L,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`})})})]});let fe=j.getVisibleItems(S);return(0,G.jsxs)(B,{flexDirection:`column`,children:[(0,G.jsx)(B,{marginBottom:1,children:(0,G.jsx)(V,{bold:!0,children:`Install Plugins`})}),j.scrollPosition.canScrollUp&&(0,G.jsx)(B,{children:(0,G.jsxs)(V,{dimColor:!0,children:[` `,a.arrowUp,` more above`]})}),fe.map((t,n)=>{let r=j.toActualIndex(n),i=E===r,o=O.has(t.pluginId),s=A.has(t.pluginId);return(0,G.jsxs)(B,{flexDirection:`column`,marginBottom:n===fe.length-1&&!e?0:1,children:[(0,G.jsxs)(B,{children:[(0,G.jsxs)(V,{color:i?`suggestion`:void 0,children:[i?a.pointer:` `,` `]}),(0,G.jsxs)(V,{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)(V,{dimColor:!0,children:[` [`,t.entry.category,`]`]}),t.entry.tags?.includes(`community-managed`)&&(0,G.jsx)(V,{dimColor:!0,children:` [Community Managed]`}),t.isInstalled&&(0,G.jsx)(V,{dimColor:!0,children:` (installed)`}),w&&m===`claude-plugins-official`&&(0,G.jsxs)(V,{dimColor:!0,children:[` · `,Mt(w.get(t.pluginId)??0),` installs`]})]})]}),t.entry.description&&(0,G.jsxs)(B,{marginLeft:4,children:[(0,G.jsx)(V,{dimColor:!0,children:mt(t.entry.description,60)}),t.entry.version&&(0,G.jsxs)(V,{dimColor:!0,children:[` · v`,t.entry.version]})]})]},t.pluginId)}),j.scrollPosition.canScrollDown&&(0,G.jsx)(B,{children:(0,G.jsxs)(V,{dimColor:!0,children:[` `,a.arrowDown,` more below`]})}),e&&(0,G.jsx)(B,{marginTop:1,children:(0,G.jsxs)(V,{color:`error`,children:[a.cross,` `,e]})}),(0,G.jsx)(Cn,{hasSelection:O.size>0})]})}var jn,W,G,Mn=e((()=>{i(),jn=t(H(),1),W=t(H(),1),v(),Ue(),s(),tt(),O(),Qe(),Je(),j(),kt(),Ee(),ve(),Ae(),w(),D(),k(),_t(),ht(),_n(),bn(),Tn(),kn(),G=Ke()}));function Nn({error:e,setError:t,result:n,setResult:r,setViewState:i,onInstallComplete:s,onSearchModeChange:c,targetPlugin:d}){let[f,p]=(0,K.useState)(`plugin-list`),[m,h]=(0,K.useState)(null),[g,_]=(0,K.useState)([]),[v,y]=(0,K.useState)(!0),[b,x]=(0,K.useState)(null),[S,te]=(0,K.useState)(!1),C=(0,K.useCallback)(e=>{te(e),c?.(e)},[c]),{query:w,setQuery:T,cursorOffset:E}=Wt({isActive:f===`plugin-list`&&S&&!v,onExit:()=>{C(!1)}}),D=Ie(),{columns:O}=Ve(),k=(0,K.useMemo)(()=>{if(!w)return g;let e=w.toLowerCase();return g.filter(t=>t.entry.name.toLowerCase().includes(e)||t.entry.description?.toLowerCase().includes(e)||t.marketplaceName.toLowerCase().includes(e))},[g,w]),[A,ie]=(0,K.useState)(0),[j,M]=(0,K.useState)(new Set),[ae,oe]=(0,K.useState)(new Set),N=En({totalItems:k.length,selectedIndex:A});(0,K.useEffect)(()=>{ie(0)},[w]);let[ce,P]=(0,K.useState)(0),[F,I]=(0,K.useState)(!1),[le,ue]=(0,K.useState)(null),[de,fe]=(0,K.useState)(null),[pe,me]=(0,K.useState)(null);(0,K.useEffect)(()=>{async function e(){try{let e=await l(),{marketplaces:n,failures:r}=await re(e),i=[];for(let{name:e,data:t}of n)if(t)for(let n of t.plugins){let t=ne(n.name,e);i.push({entry:n,marketplaceName:e,pluginId:t,isInstalled:u(t)})}let a=i.filter(e=>!e.isInstalled&&!Oe(e.pluginId));try{let e=await Nt();x(e),e?a.sort((t,n)=>{let r=e.get(t.pluginId)??0,i=e.get(n.pluginId)??0;return r===i?t.entry.name.localeCompare(n.entry.name):i-r}):a.sort((e,t)=>e.entry.name.localeCompare(t.entry.name))}catch(e){Ze(`Failed to fetch install counts: ${qe(e)}`),a.sort((e,t)=>e.entry.name.localeCompare(t.entry.name))}_(a);let o=Object.keys(e).length;if(a.length===0){let e=await ee({configuredMarketplaceCount:o,failedMarketplaceCount:r.length});me(e)}let s=se(r,et(n,e=>e.data!==null));if(s)if(s.type===`warning`)fe(s.message+`. Showing available plugins.`);else throw Error(s.message);if(d){let e=i.find(e=>e.entry.name===d);e?e.isInstalled?t(`Plugin '${e.pluginId}' is already installed. Use '/plugin' to manage existing plugins.`):(h(e),p(`plugin-details`)):t(`Plugin "${d}" not found in any marketplace`)}}catch(e){t(e instanceof Error?e.message:`Failed to load plugins`)}finally{y(!1)}}e()},[t,d]);let he=async()=>{if(j.size===0)return;let e=g.filter(e=>j.has(e.pluginId));oe(new Set(e.map(e=>e.pluginId)));let n=0,a=0,c=[];for(let t of e){let e=await Te({pluginId:t.pluginId,entry:t.entry,marketplaceName:t.marketplaceName,scope:`user`});e.success?n++:(a++,c.push({name:t.entry.name,reason:e.error}))}oe(new Set),M(new Set),xe(),a===0?r(`✓ Installed ${n} ${gt(n,`plugin`)}. Run /reload-plugins to activate.`):n===0?t(`Failed to install: ${o(c,!0)}`):r(`✓ Installed ${n} of ${n+a} plugins. Failed: ${o(c,!1)}. Run /reload-plugins to activate successfully installed plugins.`),n>0&&s&&await s(),i({type:`menu`})},ge=async(e,t=`user`)=>{I(!0),ue(null);let n=await Te({pluginId:e.pluginId,entry:e.entry,marketplaceName:e.marketplaceName,scope:t});if(n.success){let t=await pn(e.pluginId);if(t){I(!1),p({type:`plugin-options`,plugin:t,pluginId:e.pluginId});return}r(n.message),s&&await s(),i({type:`menu`})}else I(!1),ue(n.error)};(0,K.useEffect)(()=>{e&&r(e)},[e,r]),Fe(`confirm:no`,()=>{p(`plugin-list`),h(null)},{context:`Confirmation`,isActive:f===`plugin-details`}),Fe(`confirm:no`,()=>{i({type:`menu`})},{context:`Confirmation`,isActive:f===`plugin-list`&&!S}),Le((e,t)=>{let n=!t.ctrl&&!t.meta;S||(e===`/`&&n?(C(!0),T(``)):n&&e.length>0&&!/^\s+$/.test(e)&&e!==`j`&&e!==`k`&&e!==`i`&&(C(!0),T(e)))},{isActive:f===`plugin-list`&&!v}),z({"select:previous":()=>{A===0?C(!0):N.handleSelectionChange(A-1,ie)},"select:next":()=>{A<k.length-1&&N.handleSelectionChange(A+1,ie)},"select:accept":()=>{if(A===k.length&&j.size>0)he();else if(A<k.length){let e=k[A];e&&(e.isInstalled?i({type:`manage-plugins`,targetPlugin:e.entry.name,targetMarketplace:e.marketplaceName}):(h(e),p(`plugin-details`),P(0),ue(null)))}}},{context:`Select`,isActive:f===`plugin-list`&&!S}),z({"plugin:toggle":()=>{if(A<k.length){let e=k[A];if(e&&!e.isInstalled){let t=new Set(j);t.has(e.pluginId)?t.delete(e.pluginId):t.add(e.pluginId),M(t)}}},"plugin:install":()=>{j.size>0&&he()}},{context:`Plugin`,isActive:f===`plugin-list`&&!S});let _e=In.useMemo(()=>{if(!m)return[];let e=m.entry.homepage;return Sn(e,xn(m))},[m]);if(z({"select:previous":()=>{ce>0&&P(ce-1)},"select:next":()=>{ce<_e.length-1&&P(ce+1)},"select:accept":()=>{if(!m)return;let e=_e[ce]?.action,t=m.entry.homepage,n=xn(m);e===`install-user`?ge(m,`user`):e===`install-project`?ge(m,`project`):e===`install-local`?ge(m,`local`):e===`homepage`&&t?De(t):e===`github`&&n?De(`https://github.com/${n}`):e===`back`&&(p(`plugin-list`),h(null))}},{context:`Select`,isActive:f===`plugin-details`&&!!m}),typeof f==`object`&&f.type===`plugin-options`){let{plugin:e,pluginId:t}=f;function n(e){r(e),s&&s(),i({type:`menu`})}return(0,q.jsx)(mn,{plugin:e,pluginId:t,onDone:(t,r)=>{switch(t){case`configured`:n(`✓ Installed and configured ${e.name}. Run /reload-plugins to apply.`);break;case`skipped`:n(`✓ Installed ${e.name}. Run /reload-plugins to apply.`);break;case`error`:n(`Installed but failed to save config: ${r}`);break}}})}if(v)return(0,q.jsx)(V,{children:`Loading…`});if(e)return(0,q.jsx)(V,{color:`error`,children:e});if(f===`plugin-details`&&m){let e=m.entry.homepage,t=Sn(e,xn(m));return(0,q.jsxs)(B,{flexDirection:`column`,children:[(0,q.jsx)(B,{marginBottom:1,children:(0,q.jsx)(V,{bold:!0,children:`Plugin details`})}),(0,q.jsxs)(B,{flexDirection:`column`,marginBottom:1,children:[(0,q.jsx)(V,{bold:!0,children:m.entry.name}),(0,q.jsxs)(V,{dimColor:!0,children:[`from `,m.marketplaceName]}),m.entry.version&&(0,q.jsxs)(V,{dimColor:!0,children:[`Version: `,m.entry.version]}),m.entry.description&&(0,q.jsx)(B,{marginTop:1,children:(0,q.jsx)(V,{children:m.entry.description})}),m.entry.author&&(0,q.jsx)(B,{marginTop:1,children:(0,q.jsxs)(V,{dimColor:!0,children:[`By:`,` `,typeof m.entry.author==`string`?m.entry.author:m.entry.author.name]})})]}),(0,q.jsx)(vn,{}),le&&(0,q.jsx)(B,{marginBottom:1,children:(0,q.jsxs)(V,{color:`error`,children:[`Error: `,le]})}),(0,q.jsx)(B,{flexDirection:`column`,children:t.map((e,t)=>(0,q.jsxs)(B,{children:[ce===t&&(0,q.jsx)(V,{children:`> `}),ce!==t&&(0,q.jsx)(V,{children:` `}),(0,q.jsx)(V,{bold:ce===t,children:F&&e.action.startsWith(`install-`)?`Installing…`:e.label})]},e.action))}),(0,q.jsx)(B,{marginTop:1,children:(0,q.jsx)(V,{dimColor:!0,children:(0,q.jsxs)(Pe,{children:[(0,q.jsx)(L,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`select`}),(0,q.jsx)(L,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]})})})]})}if(g.length===0)return(0,q.jsxs)(B,{flexDirection:`column`,children:[(0,q.jsx)(B,{marginBottom:1,children:(0,q.jsx)(V,{bold:!0,children:`Discover plugins`})}),(0,q.jsx)(Fn,{reason:pe}),(0,q.jsx)(B,{marginTop:1,children:(0,q.jsx)(V,{dimColor:!0,italic:!0,children:`Esc to go back`})})]});let ve=N.getVisibleItems(k);return(0,q.jsxs)(B,{flexDirection:`column`,children:[(0,q.jsxs)(B,{children:[(0,q.jsx)(V,{bold:!0,children:`Discover plugins`}),N.needsPagination&&(0,q.jsxs)(V,{dimColor:!0,children:[` `,`(`,N.scrollPosition.current,`/`,N.scrollPosition.total,`)`]})]}),(0,q.jsx)(B,{marginBottom:1,children:(0,q.jsx)(ze,{query:w,isFocused:S,isTerminalFocused:D,width:O-4,cursorOffset:E})}),de&&(0,q.jsx)(B,{marginBottom:1,children:(0,q.jsxs)(V,{color:`warning`,children:[a.warning,` `,de]})}),k.length===0&&w&&(0,q.jsx)(B,{marginBottom:1,children:(0,q.jsxs)(V,{dimColor:!0,children:[`No plugins match "`,w,`"`]})}),N.scrollPosition.canScrollUp&&(0,q.jsx)(B,{children:(0,q.jsxs)(V,{dimColor:!0,children:[` `,a.arrowUp,` more above`]})}),ve.map((t,n)=>{let r=N.toActualIndex(n),i=A===r,o=j.has(t.pluginId),s=ae.has(t.pluginId);return(0,q.jsxs)(B,{flexDirection:`column`,marginBottom:n===ve.length-1&&!e?0:1,children:[(0,q.jsxs)(B,{children:[(0,q.jsxs)(V,{color:i&&!S?`suggestion`:void 0,children:[i&&!S?a.pointer:` `,` `]}),(0,q.jsxs)(V,{children:[s?a.ellipsis:o?a.radioOn:a.radioOff,` `,t.entry.name,(0,q.jsxs)(V,{dimColor:!0,children:[` · `,t.marketplaceName]}),t.entry.tags?.includes(`community-managed`)&&(0,q.jsx)(V,{dimColor:!0,children:` [Community Managed]`}),b&&t.marketplaceName===`claude-plugins-official`&&(0,q.jsxs)(V,{dimColor:!0,children:[` · `,Mt(b.get(t.pluginId)??0),` installs`]})]})]}),t.entry.description&&(0,q.jsx)(B,{marginLeft:4,children:(0,q.jsx)(V,{dimColor:!0,children:mt(t.entry.description,60)})})]},`${N.startIndex}-${t.pluginId}`)}),N.scrollPosition.canScrollDown&&(0,q.jsx)(B,{children:(0,q.jsxs)(V,{dimColor:!0,children:[` `,a.arrowDown,` more below`]})}),e&&(0,q.jsx)(B,{marginTop:1,children:(0,q.jsxs)(V,{color:`error`,children:[a.cross,` `,e]})}),(0,q.jsx)(Pn,{hasSelection:j.size>0,canToggle:A<k.length&&!k[A]?.isInstalled})]})}function Pn({hasSelection:e,canToggle:t}){return(0,q.jsx)(B,{marginTop:1,children:(0,q.jsx)(V,{dimColor:!0,italic:!0,children:(0,q.jsxs)(Pe,{children:[e&&(0,q.jsx)(L,{action:`plugin:install`,context:`Plugin`,fallback:`i`,description:`install`,bold:!0}),(0,q.jsx)(V,{children:`type to search`}),t&&(0,q.jsx)(L,{action:`plugin:toggle`,context:`Plugin`,fallback:`Space`,description:`toggle`}),(0,q.jsx)(L,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`details`}),(0,q.jsx)(L,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]})})})}function Fn({reason:e}){switch(e){case`git-not-installed`:return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(V,{dimColor:!0,children:`Git is required to install marketplaces.`}),(0,q.jsx)(V,{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)(V,{dimColor:!0,children:`Your organization policy does not allow any external marketplaces.`}),(0,q.jsx)(V,{dimColor:!0,children:`Contact your administrator.`})]});case`policy-restricts-sources`:return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(V,{dimColor:!0,children:`Your organization restricts which marketplaces can be added.`}),(0,q.jsx)(V,{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)(V,{dimColor:!0,children:`Failed to load marketplace data.`}),(0,q.jsx)(V,{dimColor:!0,children:`Check your network connection.`})]});case`all-plugins-installed`:return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(V,{dimColor:!0,children:`All available plugins are already installed.`}),(0,q.jsx)(V,{dimColor:!0,children:`Check for new plugins later or add more marketplaces.`})]});default:return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(V,{dimColor:!0,children:`No plugins available.`}),(0,q.jsx)(V,{dimColor:!0,children:`Add a marketplace first using the Marketplaces tab.`})]})}}var In,K,q,Ln=e((()=>{i(),In=t(H(),1),K=t(H(),1),v(),Ut(),Ue(),Gt(),m(),s(),tt(),O(),Qe(),Je(),j(),kt(),Ee(),ve(),Ae(),w(),D(),k(),_t(),ht(),_n(),bn(),Tn(),kn(),q=Ke()}));function Rn({setViewState:e,error:t,setError:n,setResult:r,exitState:i,onManageComplete:o,targetMarketplace:s,action:c}){let[u,d]=(0,Bn.useState)([]),[f,m]=(0,Bn.useState)(!0),[h,_]=(0,Bn.useState)(0),[v,y]=(0,Bn.useState)(!1),[b,x]=(0,Bn.useState)(null),[S,ee]=(0,Bn.useState)(null),[te,w]=(0,Bn.useState)(null),[T,E]=(0,Bn.useState)(`list`),[D,O]=(0,Bn.useState)(null),[k,A]=(0,Bn.useState)(0),ie=(0,Bn.useRef)(!1);(0,Bn.useEffect)(()=>{async function e(){try{let e=await l(),{enabled:r,disabled:i}=await ce(),a=[...r,...i],{marketplaces:o,failures:u}=await re(e),f=[];for(let{name:e,config:t,data:n}of o){let r=a.filter(t=>t.source.endsWith(`@${e}`));f.push({name:e,source:Ce(t.source),lastUpdated:t.lastUpdated,pluginCount:n?.plugins.length,installedPlugins:r,pendingUpdate:!1,pendingRemove:!1,autoUpdate:st(e,t)})}f.sort((e,t)=>e.name===`claude-plugin-directory`?-1:t.name===`claude-plugin-directory`?1:e.name.localeCompare(t.name)),d(f);let p=se(u,et(o,e=>e.data!==null));if(p)if(p.type===`warning`)x(p.message);else throw Error(p.message);if(s&&!ie.current&&!t){ie.current=!0;let e=f.findIndex(e=>e.name===s);if(e>=0){let t=f[e];if(c){_(e+1);let t=[...f];c===`update`?t[e].pendingUpdate=!0:c===`remove`&&(t[e].pendingRemove=!0),d(t),setTimeout(ae,100,t)}else t&&(_(e+1),O(t),E(`details`))}else n&&n(`Marketplace not found: ${s}`)}}catch(e){n&&n(e instanceof Error?e.message:`Failed to load marketplaces`),x(e instanceof Error?e.message:`Failed to load marketplaces`)}finally{m(!1)}}e()},[s,c,t]);let j=()=>u.some(e=>e.pendingUpdate||e.pendingRemove),M=()=>({updateCount:et(u,e=>e.pendingUpdate),removeCount:et(u,e=>e.pendingRemove)}),ae=async t=>{let i=t||u,s=T===`details`;y(!0),x(null),ee(null),w(null);try{let t=nt(`userSettings`),n=0,c=0,u=new Set;for(let e of i){if(e.pendingRemove){if(e.installedPlugins&&e.installedPlugins.length>0){let n={...t?.enabledPlugins};for(let t of e.installedPlugins){let r=ne(t.name,e.name);n[r]=!1}ot(`userSettings`,{enabledPlugins:n})}await p(e.name),c++,pt(`tengu_marketplace_removed`,{marketplace_name:e.name,plugins_uninstalled:e.installedPlugins?.length||0});continue}e.pendingUpdate&&(await C(e.name,e=>{w(e)}),n++,u.add(e.name.toLowerCase()),pt(`tengu_marketplace_updated`,{marketplace_name:e.name}))}let f=0;u.size>0&&(f=(await en(u)).length),xe(),o&&await o();let m=await l(),{enabled:h,disabled:g}=await ce(),_=[...h,...g],{marketplaces:v}=await re(m),y=[];for(let{name:e,config:t,data:n}of v){let r=_.filter(t=>t.source.endsWith(`@${e}`));y.push({name:e,source:Ce(t.source),lastUpdated:t.lastUpdated,pluginCount:n?.plugins.length,installedPlugins:r,pendingUpdate:!1,pendingRemove:!1,autoUpdate:st(e,t)})}if(y.sort((e,t)=>e.name===`claude-plugin-directory`?-1:t.name===`claude-plugin-directory`?1:e.name.localeCompare(t.name)),d(y),s&&D){let e=y.find(e=>e.name===D.name);e&&O(e)}let b=[];if(n>0){let e=f>0?` (${f} ${gt(f,`plugin`)} bumped)`:``;b.push(`Updated ${n} ${gt(n,`marketplace`)}${e}`)}if(c>0&&b.push(`Removed ${c} ${gt(c,`marketplace`)}`),b.length>0){let t=`${a.tick} ${b.join(`, `)}`;s?ee(t):(r(t),setTimeout(e,2e3,{type:`menu`}))}else s||e({type:`menu`})}catch(e){let t=qe(e);x(t),n&&n(t)}finally{y(!1),w(null)}},oe=async()=>{if(!D)return;let e=u.map(e=>e.name===D.name?{...e,pendingRemove:!0}:e);d(e),await ae(e)},N=e=>{if(!e)return[];let t=[{label:`Browse plugins (${e.pluginCount??0})`,value:`browse`},{label:`Update marketplace`,secondaryLabel:e.lastUpdated?`(last updated ${new Date(e.lastUpdated).toLocaleDateString()})`:void 0,value:`update`}];return ct()||t.push({label:e.autoUpdate?`Disable auto-update`:`Enable auto-update`,value:`toggle-auto-update`}),t.push({label:`Remove marketplace`,value:`remove`}),t},P=async e=>{let t=!e.autoUpdate;try{await g(e.name,t),d(n=>n.map(n=>n.name===e.name?{...n,autoUpdate:t}:n)),O(e=>e&&{...e,autoUpdate:t})}catch(e){x(e instanceof Error?e.message:`Failed to update setting`)}};if(Fe(`confirm:no`,()=>{E(`list`),A(0)},{context:`Confirmation`,isActive:!v&&(T===`details`||T===`confirm-remove`)}),Fe(`confirm:no`,()=>{d(e=>e.map(e=>({...e,pendingUpdate:!1,pendingRemove:!1}))),_(0)},{context:`Confirmation`,isActive:!v&&T===`list`&&j()}),Fe(`confirm:no`,()=>{e({type:`menu`})},{context:`Confirmation`,isActive:!v&&T===`list`&&!j()}),z({"select:previous":()=>_(e=>Math.max(0,e-1)),"select:next":()=>{let e=u.length+1;_(t=>Math.min(e-1,t+1))},"select:accept":()=>{let t=h-1;if(h===0)e({type:`add-marketplace`});else if(j())ae();else{let e=u[t];e&&(O(e),E(`details`),A(0))}}},{context:`Select`,isActive:!v&&T===`list`}),Le(e=>{let t=h-1;if((e===`u`||e===`U`)&&t>=0)d(e=>e.map((e,n)=>n===t?{...e,pendingUpdate:!e.pendingUpdate,pendingRemove:e.pendingUpdate?e.pendingRemove:!1}:e));else if((e===`r`||e===`R`)&&t>=0){let e=u[t];e&&(O(e),E(`confirm-remove`))}},{isActive:!v&&T===`list`}),z({"select:previous":()=>A(e=>Math.max(0,e-1)),"select:next":()=>{let e=N(D);A(t=>Math.min(e.length-1,t+1))},"select:accept":()=>{if(!D)return;let t=N(D)[k];if(t?.value===`browse`)e({type:`browse-marketplace`,targetMarketplace:D.name});else if(t?.value===`update`){let e=u.map(e=>e.name===D.name?{...e,pendingUpdate:!0}:e);d(e),ae(e)}else t?.value===`toggle-auto-update`?P(D):t?.value===`remove`&&E(`confirm-remove`)}},{context:`Select`,isActive:!v&&T===`details`}),Le(e=>{e===`y`||e===`Y`?oe():(e===`n`||e===`N`)&&(E(`list`),O(null))},{isActive:!v&&T===`confirm-remove`}),f)return(0,J.jsx)(V,{children:`Loading marketplaces…`});if(u.length===0)return(0,J.jsxs)(B,{flexDirection:`column`,children:[(0,J.jsx)(B,{marginBottom:1,children:(0,J.jsx)(V,{bold:!0,children:`Manage marketplaces`})}),(0,J.jsxs)(B,{flexDirection:`row`,gap:1,children:[(0,J.jsxs)(V,{color:`suggestion`,children:[a.pointer,` +`]}),(0,J.jsx)(V,{bold:!0,color:`suggestion`,children:`Add Marketplace`})]}),(0,J.jsx)(B,{marginLeft:3,children:(0,J.jsx)(V,{dimColor:!0,italic:!0,children:i.pending?(0,J.jsxs)(J.Fragment,{children:[`Press `,i.keyName,` again to go back`]}):(0,J.jsxs)(Pe,{children:[(0,J.jsx)(L,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`select`}),(0,J.jsx)(L,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`})]})})})]});if(T===`confirm-remove`&&D){let e=D.installedPlugins?.length||0;return(0,J.jsxs)(B,{flexDirection:`column`,children:[(0,J.jsxs)(V,{bold:!0,color:`warning`,children:[`Remove marketplace `,(0,J.jsx)(V,{italic:!0,children:D.name}),`?`]}),(0,J.jsxs)(B,{flexDirection:`column`,children:[e>0&&(0,J.jsx)(B,{marginTop:1,children:(0,J.jsxs)(V,{color:`warning`,children:[`This will also uninstall `,e,` `,gt(e,`plugin`),` from this marketplace:`]})}),D.installedPlugins&&D.installedPlugins.length>0&&(0,J.jsx)(B,{flexDirection:`column`,marginTop:1,marginLeft:2,children:D.installedPlugins.map(e=>(0,J.jsxs)(V,{dimColor:!0,children:[`• `,e.name]},e.name))}),(0,J.jsx)(B,{marginTop:1,children:(0,J.jsxs)(V,{children:[`Press `,(0,J.jsx)(V,{bold:!0,children:`y`}),` to confirm or `,(0,J.jsx)(V,{bold:!0,children:`n`}),` to cancel`]})})]})]})}if(T===`details`&&D){let e=D.pendingUpdate||v,t=N(D);return(0,J.jsxs)(B,{flexDirection:`column`,children:[(0,J.jsx)(V,{bold:!0,children:D.name}),(0,J.jsx)(V,{dimColor:!0,children:D.source}),(0,J.jsx)(B,{marginTop:1,children:(0,J.jsxs)(V,{children:[D.pluginCount||0,` available `,gt(D.pluginCount||0,`plugin`)]})}),D.installedPlugins&&D.installedPlugins.length>0&&(0,J.jsxs)(B,{flexDirection:`column`,marginTop:1,children:[(0,J.jsxs)(V,{bold:!0,children:[`Installed plugins (`,D.installedPlugins.length,`):`]}),(0,J.jsx)(B,{flexDirection:`column`,marginLeft:1,children:D.installedPlugins.map(e=>(0,J.jsxs)(B,{flexDirection:`row`,gap:1,children:[(0,J.jsx)(V,{children:a.bullet}),(0,J.jsxs)(B,{flexDirection:`column`,children:[(0,J.jsx)(V,{children:e.name}),(0,J.jsx)(V,{dimColor:!0,children:e.manifest.description})]})]},e.name))})]}),e&&(0,J.jsxs)(B,{marginTop:1,flexDirection:`column`,children:[(0,J.jsx)(V,{color:`claude`,children:`Updating marketplace…`}),te&&(0,J.jsx)(V,{dimColor:!0,children:te})]}),!e&&S&&(0,J.jsx)(B,{marginTop:1,children:(0,J.jsx)(V,{color:`claude`,children:S})}),!e&&b&&(0,J.jsx)(B,{marginTop:1,children:(0,J.jsx)(V,{color:`error`,children:b})}),!e&&(0,J.jsx)(B,{flexDirection:`column`,marginTop:1,children:t.map((e,t)=>{if(!e)return null;let n=t===k;return(0,J.jsxs)(B,{children:[(0,J.jsxs)(V,{color:n?`suggestion`:void 0,children:[n?a.pointer:` `,` `,e.label]}),e.secondaryLabel&&(0,J.jsxs)(V,{dimColor:!0,children:[` `,e.secondaryLabel]})]},e.value)})}),!e&&!ct()&&D.autoUpdate&&(0,J.jsx)(B,{marginTop:1,children:(0,J.jsx)(V,{dimColor:!0,children:`Auto-update enabled. Work Mate will automatically update this marketplace and its installed plugins.`})}),(0,J.jsx)(B,{marginLeft:3,children:(0,J.jsx)(V,{dimColor:!0,italic:!0,children:e?(0,J.jsx)(J.Fragment,{children:`Please wait…`}):(0,J.jsxs)(Pe,{children:[(0,J.jsx)(L,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`select`}),(0,J.jsx)(L,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`})]})})})]})}let{updateCount:F,removeCount:I}=M();return(0,J.jsxs)(B,{flexDirection:`column`,children:[(0,J.jsx)(B,{marginBottom:1,children:(0,J.jsx)(V,{bold:!0,children:`Manage marketplaces`})}),(0,J.jsxs)(B,{flexDirection:`row`,gap:1,marginBottom:1,children:[(0,J.jsxs)(V,{color:h===0?`suggestion`:void 0,children:[h===0?a.pointer:` `,` +`]}),(0,J.jsx)(V,{bold:!0,color:h===0?`suggestion`:void 0,children:`Add Marketplace`})]}),(0,J.jsx)(B,{flexDirection:`column`,children:u.map((e,t)=>{let n=t+1===h,r=[];return e.pendingUpdate&&r.push(`UPDATE`),e.pendingRemove&&r.push(`REMOVE`),(0,J.jsxs)(B,{flexDirection:`row`,gap:1,marginBottom:1,children:[(0,J.jsxs)(V,{color:n?`suggestion`:void 0,children:[n?a.pointer:` `,` `,e.pendingRemove?a.cross:a.bullet]}),(0,J.jsxs)(B,{flexDirection:`column`,flexGrow:1,children:[(0,J.jsxs)(B,{flexDirection:`row`,gap:1,children:[(0,J.jsxs)(V,{bold:!0,strikethrough:e.pendingRemove,dimColor:e.pendingRemove,children:[e.name===`claude-plugins-official`&&(0,J.jsx)(V,{color:`claude`,children:`✻ `}),e.name,e.name===`claude-plugins-official`&&(0,J.jsx)(V,{color:`claude`,children:` ✻`})]}),r.length>0&&(0,J.jsxs)(V,{color:`warning`,children:[`[`,r.join(`, `),`]`]})]}),(0,J.jsx)(V,{dimColor:!0,children:e.source}),(0,J.jsxs)(V,{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)})}),j()&&(0,J.jsxs)(B,{marginTop:1,flexDirection:`column`,children:[(0,J.jsxs)(V,{children:[(0,J.jsx)(V,{bold:!0,children:`Pending changes:`}),` `,(0,J.jsx)(V,{dimColor:!0,children:`Enter to apply`})]}),F>0&&(0,J.jsxs)(V,{children:[`• Update `,F,` `,gt(F,`marketplace`)]}),I>0&&(0,J.jsxs)(V,{color:`warning`,children:[`• Remove `,I,` `,gt(I,`marketplace`)]})]}),v&&(0,J.jsx)(B,{marginTop:1,children:(0,J.jsx)(V,{color:`claude`,children:`Processing changes…`})}),b&&(0,J.jsx)(B,{marginTop:1,children:(0,J.jsx)(V,{color:`error`,children:b})}),(0,J.jsx)(zn,{exitState:i,hasPendingActions:j()})]})}function zn({exitState:e,hasPendingActions:t}){return e.pending?(0,J.jsx)(B,{marginTop:1,children:(0,J.jsxs)(V,{dimColor:!0,italic:!0,children:[`Press `,e.keyName,` again to go back`]})}):(0,J.jsx)(B,{marginTop:1,children:(0,J.jsx)(V,{dimColor:!0,italic:!0,children:(0,J.jsxs)(Pe,{children:[t&&(0,J.jsx)(L,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`apply changes`}),!t&&(0,J.jsx)(L,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`select`}),!t&&(0,J.jsx)(je,{shortcut:`u`,action:`update`}),!t&&(0,J.jsx)(je,{shortcut:`r`,action:`remove`}),(0,J.jsx)(L,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:t?`cancel`:`go back`})]})})})}var Bn,J,Vn=e((()=>{i(),H(),Bn=t(H(),1),ft(),v(),Ue(),s(),tt(),lt(),Je(),j(),ve(),Ae(),tn(),ae(),at(),it(),_t(),J=Ke()}));function Hn(e){switch(e.type){case`path-not-found`:return`${e.component} path not found: ${e.path}`;case`git-auth-failed`:return`Git ${e.authType.toUpperCase()} authentication failed for ${e.gitUrl}`;case`git-timeout`:return`Git ${e.operation} timed out for ${e.gitUrl}`;case`network-error`:return`Network error accessing ${e.url}${e.details?`: ${e.details}`:``}`;case`manifest-parse-error`:return`Failed to parse manifest at ${e.manifestPath}: ${e.parseError}`;case`manifest-validation-error`:return`Invalid manifest at ${e.manifestPath}: ${e.validationErrors.join(`, `)}`;case`plugin-not-found`:return`Plugin "${e.pluginId}" not found in marketplace "${e.marketplace}"`;case`marketplace-not-found`:return`Marketplace "${e.marketplace}" not found`;case`marketplace-load-failed`:return`Failed to load marketplace "${e.marketplace}": ${e.reason}`;case`mcp-config-invalid`:return`Invalid MCP server config for "${e.serverName}": ${e.validationError}`;case`mcp-server-suppressed-duplicate`:{let t=e.duplicateOf.startsWith(`plugin:`)?`server provided by plugin "${e.duplicateOf.split(`:`)[1]??`?`}"`:`already-configured "${e.duplicateOf}"`;return`MCP server "${e.serverName}" skipped — same command/URL as ${t}`}case`hook-load-failed`:return`Failed to load hooks from ${e.hookPath}: ${e.reason}`;case`component-load-failed`:return`Failed to load ${e.component} from ${e.path}: ${e.reason}`;case`mcpb-download-failed`:return`Failed to download MCPB from ${e.url}: ${e.reason}`;case`mcpb-extract-failed`:return`Failed to extract MCPB ${e.mcpbPath}: ${e.reason}`;case`mcpb-invalid-manifest`:return`MCPB manifest invalid at ${e.mcpbPath}: ${e.validationError}`;case`marketplace-blocked-by-policy`:return e.blockedByBlocklist?`Marketplace "${e.marketplace}" is blocked by enterprise policy`:`Marketplace "${e.marketplace}" is not in the allowed marketplace list`;case`dependency-unsatisfied`:return e.reason===`not-enabled`?`Dependency "${e.dependency}" is disabled`:`Dependency "${e.dependency}" is not installed`;case`lsp-config-invalid`:return`Invalid LSP server config for "${e.serverName}": ${e.validationError}`;case`lsp-server-start-failed`:return`LSP server "${e.serverName}" failed to start: ${e.reason}`;case`lsp-server-crashed`:return e.signal?`LSP server "${e.serverName}" crashed with signal ${e.signal}`:`LSP server "${e.serverName}" crashed with exit code ${e.exitCode??`unknown`}`;case`lsp-request-timeout`:return`LSP server "${e.serverName}" timed out on ${e.method} after ${e.timeoutMs}ms`;case`lsp-request-failed`:return`LSP server "${e.serverName}" ${e.method} failed: ${e.error}`;case`plugin-cache-miss`:return`Plugin "${e.plugin}" not cached at ${e.installPath}`;case`generic-error`:return e.error}return _e(e)}function Un(e){switch(e.type){case`path-not-found`:return`Check that the path in your manifest or marketplace config is correct`;case`git-auth-failed`:return e.authType===`ssh`?`Configure SSH keys or use HTTPS URL instead`:`Configure credentials or use SSH URL instead`;case`git-timeout`:case`network-error`:return`Check your internet connection and try again`;case`manifest-parse-error`:return`Check manifest file syntax in the plugin directory`;case`manifest-validation-error`:return`Check manifest file follows the required schema`;case`plugin-not-found`:return`Plugin may not exist in marketplace "${e.marketplace}"`;case`marketplace-not-found`:return e.availableMarketplaces.length>0?`Available marketplaces: ${e.availableMarketplaces.join(`, `)}`:`Add the marketplace first using /plugin marketplace add`;case`mcp-config-invalid`:return`Check MCP server configuration in .mcp.json or manifest`;case`mcp-server-suppressed-duplicate`:return e.duplicateOf.startsWith(`plugin:`)?`Disable plugin "${e.duplicateOf.split(`:`)[1]??`the other plugin`}" if you want this plugin's version instead`:`Remove "${e.duplicateOf}" from your MCP config if you want the plugin's version instead`;case`hook-load-failed`:return`Check hooks.json file syntax and structure`;case`component-load-failed`:return`Check ${e.component} directory structure and file permissions`;case`mcpb-download-failed`:return`Check your internet connection and URL accessibility`;case`mcpb-extract-failed`:return`Verify the MCPB file is valid and not corrupted`;case`mcpb-invalid-manifest`:return`Contact the plugin author about the invalid manifest`;case`marketplace-blocked-by-policy`:return e.blockedByBlocklist?`This marketplace source is explicitly blocked by your administrator`:e.allowedSources.length>0?`Allowed sources: ${e.allowedSources.join(`, `)}`:`Contact your administrator to configure allowed marketplace sources`;case`dependency-unsatisfied`:return e.reason===`not-enabled`?`Enable "${e.dependency}" or uninstall "${e.plugin}"`:`Install "${e.dependency}" or uninstall "${e.plugin}"`;case`lsp-config-invalid`:return`Check LSP server configuration in the plugin manifest`;case`lsp-server-start-failed`:case`lsp-server-crashed`:case`lsp-request-timeout`:case`lsp-request-failed`:return`Check LSP server logs with --debug for details`;case`plugin-cache-miss`:return`Run /plugins to refresh the plugin cache`;case`marketplace-load-failed`:case`generic-error`:return null}return null}var Wn=e((()=>{I()}));function Gn({item:e,isSelected:t}){let[n]=Ne();if(e.type===`plugin`){let r,i;return e.pendingToggle?(r=Re(`suggestion`,n)(a.arrowRight),i=e.pendingToggle===`will-enable`?`will enable`:`will disable`):e.errorCount>0?(r=Re(`error`,n)(a.cross),i=`${e.errorCount} ${gt(e.errorCount,`error`)}`):e.isEnabled?(r=Re(`success`,n)(a.tick),i=`enabled`):(r=Re(`inactive`,n)(a.radioOff),i=`disabled`),(0,Y.jsxs)(B,{children:[(0,Y.jsx)(V,{color:t?`suggestion`:void 0,children:t?`${a.pointer} `:` `}),(0,Y.jsx)(V,{color:t?`suggestion`:void 0,children:e.name}),(0,Y.jsxs)(V,{dimColor:!t,children:[` `,(0,Y.jsx)(V,{backgroundColor:`userMessageBackground`,children:`Plugin`})]}),(0,Y.jsxs)(V,{dimColor:!0,children:[` · `,e.marketplace]}),(0,Y.jsxs)(V,{dimColor:!t,children:[` · `,r,` `]}),(0,Y.jsx)(V,{dimColor:!t,children:i})]})}if(e.type===`flagged-plugin`){let r=Re(`warning`,n)(a.warning);return(0,Y.jsxs)(B,{children:[(0,Y.jsx)(V,{color:t?`suggestion`:void 0,children:t?`${a.pointer} `:` `}),(0,Y.jsx)(V,{color:t?`suggestion`:void 0,children:e.name}),(0,Y.jsxs)(V,{dimColor:!t,children:[` `,(0,Y.jsx)(V,{backgroundColor:`userMessageBackground`,children:`Plugin`})]}),(0,Y.jsxs)(V,{dimColor:!0,children:[` · `,e.marketplace]}),(0,Y.jsxs)(V,{dimColor:!t,children:[` · `,r,` `]}),(0,Y.jsx)(V,{dimColor:!t,children:`removed`})]})}if(e.type===`failed-plugin`){let r=Re(`error`,n)(a.cross),i=`failed to load · ${e.errorCount} ${gt(e.errorCount,`error`)}`;return(0,Y.jsxs)(B,{children:[(0,Y.jsx)(V,{color:t?`suggestion`:void 0,children:t?`${a.pointer} `:` `}),(0,Y.jsx)(V,{color:t?`suggestion`:void 0,children:e.name}),(0,Y.jsxs)(V,{dimColor:!t,children:[` `,(0,Y.jsx)(V,{backgroundColor:`userMessageBackground`,children:`Plugin`})]}),(0,Y.jsxs)(V,{dimColor:!0,children:[` · `,e.marketplace]}),(0,Y.jsxs)(V,{dimColor:!t,children:[` · `,r,` `]}),(0,Y.jsx)(V,{dimColor:!t,children:i})]})}let r,i;return e.status===`connected`?(r=Re(`success`,n)(a.tick),i=`connected`):e.status===`disabled`?(r=Re(`inactive`,n)(a.radioOff),i=`disabled`):e.status===`pending`?(r=Re(`inactive`,n)(a.radioOff),i=`connecting…`):e.status===`needs-auth`?(r=Re(`warning`,n)(a.triangleUpOutline),i=`Enter to auth`):(r=Re(`error`,n)(a.cross),i=`failed`),e.indented?(0,Y.jsxs)(B,{children:[(0,Y.jsx)(V,{color:t?`suggestion`:void 0,children:t?`${a.pointer} `:` `}),(0,Y.jsx)(V,{dimColor:!t,children:`└ `}),(0,Y.jsx)(V,{color:t?`suggestion`:void 0,children:e.name}),(0,Y.jsxs)(V,{dimColor:!t,children:[` `,(0,Y.jsx)(V,{backgroundColor:`userMessageBackground`,children:`MCP`})]}),(0,Y.jsxs)(V,{dimColor:!t,children:[` · `,r,` `]}),(0,Y.jsx)(V,{dimColor:!t,children:i})]}):(0,Y.jsxs)(B,{children:[(0,Y.jsx)(V,{color:t?`suggestion`:void 0,children:t?`${a.pointer} `:` `}),(0,Y.jsx)(V,{color:t?`suggestion`:void 0,children:e.name}),(0,Y.jsxs)(V,{dimColor:!t,children:[` `,(0,Y.jsx)(V,{backgroundColor:`userMessageBackground`,children:`MCP`})]}),(0,Y.jsxs)(V,{dimColor:!t,children:[` · `,r,` `]}),(0,Y.jsx)(V,{dimColor:!t,children:i})]})}var Y,Kn=e((()=>{i(),H(),Ue(),_t(),Y=Ke()}));async function qn(e){try{return(await rn.readdir(e,{withFileTypes:!0})).filter(e=>e.isFile()&&e.name.endsWith(`.md`)).map(e=>nn.basename(e.name,`.md`))}catch(t){return Ze(`Failed to read plugin components from ${e}: ${qe(t)}`,{level:`error`}),dt(Xe(t)),[]}}async function Jn(e){try{let t=await rn.readdir(e,{withFileTypes:!0}),n=[];for(let r of t)if(r.isDirectory()||r.isSymbolicLink()){let t=nn.join(e,r.name,`SKILL.md`);try{(await rn.stat(t)).isFile()&&n.push(r.name)}catch{}}return n}catch(t){return Ze(`Failed to read skill directories from ${e}: ${qe(t)}`,{level:`error`}),dt(Xe(t)),[]}}function Yn({plugin:e,marketplace:t}){let[n,r]=(0,X.useState)(null),[i,a]=(0,X.useState)(!0),[o,s]=(0,X.useState)(null);return(0,X.useEffect)(()=>{async function n(){try{if(t===`builtin`){let t=oe(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 h(t)).plugins.find(t=>t.name===e.name);if(n){let t=[];e.commandsPath&&t.push(e.commandsPath),e.commandsPaths&&t.push(...e.commandsPaths);let i=[];for(let e of t)if(typeof e==`string`){let t=await qn(e);i.push(...t)}let a=[];e.agentsPath&&a.push(e.agentsPath),e.agentsPaths&&a.push(...e.agentsPaths);let o=[];for(let e of a)if(typeof e==`string`){let t=await qn(e);o.push(...t)}let s=[];e.skillsPath&&s.push(e.skillsPath),e.skillsPaths&&s.push(...e.skillsPaths);let c=[];for(let e of s)if(typeof e==`string`){let t=await Jn(e);c.push(...t)}let l=[];e.hooksConfig&&l.push(Object.keys(e.hooksConfig)),n.hooks&&l.push(n.hooks);let u=[];e.mcpServers&&u.push(Object.keys(e.mcpServers)),n.mcpServers&&u.push(n.mcpServers),r({commands:i.length>0?i:null,agents:o.length>0?o:null,skills:c.length>0?c:null,hooks:l.length>0?l:null,mcpServers:u.length>0?u:null})}else s(`Plugin ${e.name} not found in marketplace`)}catch(e){s(e instanceof Error?e.message:`Failed to load components`)}finally{a(!1)}}n()},[e.name,e.commandsPath,e.commandsPaths,e.agentsPath,e.agentsPaths,e.skillsPath,e.skillsPaths,e.hooksConfig,e.mcpServers,t]),i?null:o?(0,Z.jsxs)(B,{flexDirection:`column`,marginBottom:1,children:[(0,Z.jsx)(V,{bold:!0,children:`Components:`}),(0,Z.jsxs)(V,{dimColor:!0,children:[`Error: `,o]})]}):!n||!(n.commands||n.agents||n.skills||n.hooks||n.mcpServers)?null:(0,Z.jsxs)(B,{flexDirection:`column`,marginBottom:1,children:[(0,Z.jsx)(V,{bold:!0,children:`Installed components:`}),n.commands?(0,Z.jsxs)(V,{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)(V,{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)(V,{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)(V,{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)(V,{dimColor:!0,children:[`• MCP Servers:`,` `,typeof n.mcpServers==`string`?n.mcpServers:Array.isArray(n.mcpServers)?n.mcpServers.map(String).join(`, `):typeof n.mcpServers==`object`&&n.mcpServers!==null?Object.keys(n.mcpServers).join(`, `):String(n.mcpServers)]}):null]})}async function Xn(e,t){let n=(await h(t))?.plugins.find(t=>t.name===e);return n&&typeof n.source==`string`?`Local plugins cannot be updated remotely. To update, modify the source at: ${n.source}`:null}function Zn(e){return e.filter(e=>{let t=e.source.split(`@`)[1]||`local`;return!Oe(`${e.name}@${t}`)})}function Qn({setViewState:e,setResult:t,onManageComplete:n,onSearchModeChange:r,targetPlugin:i,targetMarketplace:o,action:s}){let l=be(e=>e.mcp.clients),u=be(e=>e.mcp.tools),p=be(e=>e.plugins.errors),m=It(),[h,g]=(0,X.useState)(!1),_=(0,X.useCallback)(e=>{g(e),r?.(e)},[r]),v=Ie(),{columns:y}=Ve(),[b,x]=(0,X.useState)(`plugin-list`),{query:S,setQuery:ee,cursorOffset:te}=Wt({isActive:b===`plugin-list`&&h,onExit:()=>{_(!1)}}),[C,w]=(0,X.useState)(null),[ne,E]=(0,X.useState)([]),[D,re]=(0,X.useState)([]),[O,k]=(0,X.useState)(!0),[A,ie]=(0,X.useState)(new Map),j=(0,X.useRef)(!1),M=(0,X.useRef)(void 0),ae=zt();Fe(`confirm:no`,$n.useCallback(()=>{if(b===`plugin-details`)x(`plugin-list`),w(null),R(null);else if(typeof b==`object`&&b.type===`failed-plugin-details`)x(`plugin-list`),R(null);else if(b===`configuring`)x(`plugin-details`),Se(null);else if(typeof b==`object`&&(b.type===`plugin-options`||b.type===`configuring-options`))x(`plugin-list`),w(null),t(`Plugin enabled. Configuration skipped — run /reload-plugins to apply.`),n&&n();else if(typeof b==`object`&&b.type===`flagged-detail`)x(`plugin-list`),R(null);else if(typeof b==`object`&&b.type===`mcp-detail`)x(`plugin-list`),R(null);else if(typeof b==`object`&&b.type===`mcp-tools`)x({type:`mcp-detail`,client:b.client});else if(typeof b==`object`&&b.type===`mcp-tool-detail`)x({type:`mcp-tools`,client:b.client});else{if(A.size>0){t(`Run /reload-plugins to apply plugin changes.`);return}e({type:`menu`})}},[b,e,A,t]),{context:`Confirmation`,isActive:(b!==`plugin-list`||!h)&&b!==`confirm-project-uninstall`&&!(typeof b==`object`&&b.type===`confirm-data-cleanup`)});let oe=e=>e.type===`connected`?`connected`:e.type===`disabled`?`disabled`:e.type===`pending`?`pending`:e.type===`needs-auth`?`needs-auth`:`failed`,se=(0,X.useMemo)(()=>{let e=rt(),t=new Map;for(let e of l)if(e.name.startsWith(`plugin:`)){let n=e.name.split(`:`);if(n.length>=3){let r=n[1],i=n.slice(2).join(`:`),a=t.get(r)||[];a.push({displayName:i,client:e}),t.set(r,a)}}let n=[];for(let r of D){let i=`${r.plugin.name}@${r.marketplace}`,a=e?.enabledPlugins?.[i]!==!1,o=p.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:A.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 p){if(r.has(e.source)||`plugin`in e&&typeof e.plugin==`string`&&i.has(e.plugin))continue;let t=a.get(e.source)||[];t.push(e),a.set(e.source,t)}let o=yt(),s=[];for(let[e,t]of a){if(e in m)continue;let n=T(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:oe(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:oe(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(m)){let n=T(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 h=[...f.keys()].sort((e,t)=>(u[e]??99)-(u[t]??99));for(let e of h){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},[D,l,p,A,m]),N=(0,X.useMemo)(()=>se.filter(e=>e.type===`flagged-plugin`).map(e=>e.id),[se]);(0,X.useEffect)(()=>{N.length>0&&Ft(N)},[N]);let F=(0,X.useMemo)(()=>{if(!S)return se;let e=S.toLowerCase();return se.filter(t=>t.name.toLowerCase().includes(e)||`description`in t&&t.description?.toLowerCase().includes(e))},[se,S]),[I,le]=(0,X.useState)(0),de=En({totalItems:F.length,selectedIndex:I,maxVisible:8}),[pe,me]=(0,X.useState)(0),[ge,_e]=(0,X.useState)(!1),[ve,R]=(0,X.useState)(null),[ye,Se]=(0,X.useState)(null),[Ce,Te]=(0,X.useState)(!1),[Ee,Oe]=(0,X.useState)(!1);(0,X.useEffect)(()=>{if(!C){Oe(!1);return}async function e(){let e=C.plugin.manifest.mcpServers,t=!1;if(e&&(t=typeof e==`string`&&P(e)||Array.isArray(e)&&e.some(e=>typeof e==`string`&&P(e))),!t)try{let e=nn.join(C.plugin.path,`..`),n=nn.join(e,`.claude-plugin`,`marketplace.json`),r=Ye(await rn.readFile(n,`utf-8`)).plugins?.find(e=>e.name===C.plugin.name);if(r?.mcpServers){let e=r.mcpServers;t=typeof e==`string`&&P(e)||Array.isArray(e)&&e.some(e=>typeof e==`string`&&P(e))}}catch(e){Ze(`Failed to read raw marketplace.json: ${e}`)}Oe(t)}e()},[C]),(0,X.useEffect)(()=>{async function e(){k(!0);try{let{enabled:e,disabled:t}=await ce(),n=rt(),r=Zn([...e,...t]),i={};for(let e of r){let t=e.source.split(`@`)[1]||`local`;i[t]||(i[t]=[]),i[t].push(e)}let a=[];for(let[e,t]of Object.entries(i)){let r=et(t,t=>{let r=`${t.name}@${e}`;return n?.enabledPlugins?.[r]!==!1}),i=t.length-r;a.push({name:e,installedPlugins:t,enabledCount:r,disabledCount:i})}a.sort((e,t)=>e.name===`claude-plugin-directory`?-1:t.name===`claude-plugin-directory`?1:e.name.localeCompare(t.name)),E(a);let o=[];for(let e of a)for(let t of e.installedPlugins){let n=`${t.name}@${e.name}`,r=t.isBuiltin?`builtin`:Tt(n).scope;o.push({plugin:t,marketplace:e.name,scope:r,pendingEnable:void 0,pendingUpdate:!1})}re(o),le(0)}finally{k(!1)}}e()},[]),(0,X.useEffect)(()=>{if(!j.current&&i&&ne.length>0&&!O){let{name:e,marketplace:n}=T(i),r=o??n,a=r?ne.filter(e=>e.name===r):ne;for(let t of a){let n=t.installedPlugins.find(t=>t.name===e);if(n){let{scope:e}=Tt(`${n.name}@${t.name}`),r={plugin:n,marketplace:t.name,scope:e,pendingEnable:void 0,pendingUpdate:!1};w(r),x(`plugin-details`),M.current=s,j.current=!0;return}}let c=se.find(t=>t.type===`failed-plugin`&&t.name===e);c&&c.type===`failed-plugin`&&(x({type:`failed-plugin-details`,plugin:{id:c.id,name:c.name,marketplace:c.marketplace,errors:c.errors,scope:c.scope}}),j.current=!0),!j.current&&s&&(j.current=!0,t(`Plugin "${i}" is not installed in this project`))}},[i,o,ne,O,se,s,t]);let ke=async r=>{if(!C)return;let i=C.scope||`user`,a=i===`builtin`;if(a&&(r===`update`||r===`uninstall`)){R(`Built-in plugins cannot be updated or uninstalled.`);return}if(!a&&!wt(i)&&r!==`update`){R(`This plugin is managed by your organization. Contact your admin to disable it.`);return}_e(!0),R(null);try{let o=`${C.plugin.name}@${C.marketplace}`,s;switch(r){case`enable`:{let e=await bt(o);if(!e.success)throw Error(e.message);break}case`disable`:{let e=await Ct(o);if(!e.success)throw Error(e.message);s=e.reverseDependents;break}case`uninstall`:{if(a||!wt(i))break;if(Dt(o)){_e(!1),x(`confirm-project-uninstall`);return}let e=c().plugins[o],t=!e||e.length<=1?await ue(o):null;if(t){_e(!1),x({type:`confirm-data-cleanup`,size:t});return}let n=await xt(o,i);if(!n.success)throw Error(n.message);s=n.reverseDependents;break}case`update`:{if(a)break;let r=await St(o,i);if(!r.success)throw Error(r.message);if(r.alreadyUpToDate){t(`${C.plugin.name} is already at the latest version (${r.newVersion}).`),n&&await n(),e({type:`menu`});return}break}}xe();let l=`${C.plugin.name}@${C.marketplace}`;if(rt()?.enabledPlugins?.[l]!==!1){_e(!1),x({type:`plugin-options`});return}let u=r===`enable`?`Enabled`:r===`disable`?`Disabled`:r===`update`?`Updated`:`Uninstalled`,d=s&&s.length>0?` · required by ${s.join(`, `)}`:``;t(`✓ ${u} ${C.plugin.name}${d}. Run /reload-plugins to apply.`),n&&await n(),e({type:`menu`})}catch(e){_e(!1);let t=e instanceof Error?e.message:String(e);R(`Failed to ${r}: ${t}`),dt(Xe(e))}},Ae=(0,X.useRef)(ke);Ae.current=ke,(0,X.useEffect)(()=>{if(b===`plugin-details`&&C&&M.current){let e=M.current;M.current=void 0,Ae.current(e)}},[b,C]);let je=$n.useCallback(()=>{if(I>=F.length)return;let e=F[I];if(e?.type!==`flagged-plugin`)if(e?.type===`plugin`){let t=`${e.plugin.name}@${e.marketplace}`,n=rt(),r=A.get(t),i=n?.enabledPlugins?.[t]!==!1,a=e.scope;if(a===`builtin`||wt(a)){let e=new Map(A);r?(e.delete(t),(async()=>{try{r===`will-disable`?await bt(t):await Ct(t),xe()}catch(e){dt(e)}})()):(e.set(t,i?`will-disable`:`will-enable`),(async()=>{try{i?await Ct(t):await bt(t),xe()}catch(e){dt(e)}})()),ie(e)}}else e?.type===`mcp`&&ae(e.client.name)},[I,F,A,D,ae]);z({"select:previous":()=>{I===0?_(!0):de.handleSelectionChange(I-1,le)},"select:next":()=>{I<F.length-1&&de.handleSelectionChange(I+1,le)},"select:accept":$n.useCallback(()=>{if(I>=F.length)return;let e=F[I];if(e?.type===`plugin`){let t=D.find(t=>t.plugin.name===e.plugin.name&&t.marketplace===e.marketplace);t&&(w(t),x(`plugin-details`),me(0),R(null))}else e?.type===`flagged-plugin`?(x({type:`flagged-detail`,plugin:{id:e.id,name:e.name,marketplace:e.marketplace,reason:e.reason,text:e.text,flaggedAt:e.flaggedAt}}),R(null)):e?.type===`failed-plugin`?(x({type:`failed-plugin-details`,plugin:{id:e.id,name:e.name,marketplace:e.marketplace,errors:e.errors,scope:e.scope}}),me(0),R(null)):e?.type===`mcp`&&(x({type:`mcp-detail`,client:e.client}),R(null))},[I,F,D])},{context:`Select`,isActive:b===`plugin-list`&&!h}),z({"plugin:toggle":je},{context:`Plugin`,isActive:b===`plugin-list`&&!h}),z({"select:accept":$n.useCallback(()=>{typeof b!=`object`||b.type!==`flagged-detail`||(Lt(b.plugin.id),x(`plugin-list`))},[b])},{context:`Select`,isActive:typeof b==`object`&&b.type===`flagged-detail`});let Me=$n.useMemo(()=>{if(b!==`plugin-details`||!C)return[];let e=rt(),t=`${C.plugin.name}@${C.marketplace}`,n=e?.enabledPlugins?.[t]!==!1,r=C.marketplace===`builtin`,i=[];return i.push({label:n?`Disable plugin`:`Enable plugin`,action:()=>void ke(n?`disable`:`enable`)}),r||(i.push({label:C.pendingUpdate?`Unmark for update`:`Mark for update`,action:async()=>{try{let e=await Xn(C.plugin.name,C.marketplace);if(e){R(e);return}let t=[...D],n=t.findIndex(e=>e.plugin.name===C.plugin.name&&e.marketplace===C.marketplace);n!==-1&&(t[n].pendingUpdate=!C.pendingUpdate,re(t),w({...C,pendingUpdate:!C.pendingUpdate}))}catch(e){R(e instanceof Error?e.message:`Failed to check plugin update availability`)}}}),Ee&&i.push({label:`Configure`,action:async()=>{Te(!0);try{let e=C.plugin.manifest.mcpServers,t=null;if(typeof e==`string`&&P(e))t=e;else if(Array.isArray(e)){for(let n of e)if(typeof n==`string`&&P(n)){t=n;break}}if(!t){R(`No MCPB file found in plugin`),Te(!1);return}let n=`${C.plugin.name}@${C.marketplace}`,r=await we(t,C.plugin.path,n,void 0,void 0,!0);`status`in r&&r.status===`needs-config`?(Se(r),x(`configuring`)):R(`Failed to load MCPB for configuration`)}catch(e){let t=qe(e);R(`Failed to load configuration: ${t}`)}finally{Te(!1)}}}),C.plugin.manifest.userConfig&&Object.keys(C.plugin.manifest.userConfig).length>0&&i.push({label:`Configure options`,action:()=>{x({type:`configuring-options`,schema:C.plugin.manifest.userConfig})}}),i.push({label:`Update now`,action:()=>void ke(`update`)}),i.push({label:`Uninstall`,action:()=>void ke(`uninstall`)})),C.plugin.manifest.homepage&&i.push({label:`Open homepage`,action:()=>void De(C.plugin.manifest.homepage)}),C.plugin.manifest.repository&&i.push({label:`View repository`,action:()=>void De(C.plugin.manifest.repository)}),i.push({label:`Back to plugin list`,action:()=>{x(`plugin-list`),w(null),R(null)}}),i},[b,C,Ee,D]);if(z({"select:previous":()=>{pe>0&&me(pe-1)},"select:next":()=>{pe<Me.length-1&&me(pe+1)},"select:accept":()=>{Me[pe]&&Me[pe].action()}},{context:`Select`,isActive:b===`plugin-details`&&!!C}),z({"select:accept":()=>{typeof b==`object`&&b.type===`failed-plugin-details`&&(async()=>{_e(!0),R(null);let e=b.plugin.id,t=b.plugin.scope,r=wt(t)?await xt(e,t,!1):await xt(e,`user`,!1),i=r.success;if(!i){for(let t of[`userSettings`,`projectSettings`,`localSettings`]){let n=nt(t);n?.enabledPlugins?.[e]!==void 0&&(ot(t,{enabledPlugins:{...n.enabledPlugins,[e]:void 0}}),i=!0)}xe()}i?(n&&await n(),_e(!1),x(`plugin-list`)):(_e(!1),R(r.message))})()}},{context:`Select`,isActive:typeof b==`object`&&b.type===`failed-plugin-details`&&b.plugin.scope!==`managed`}),z({"confirm:yes":()=>{if(!C)return;_e(!0),R(null);let r=`${C.plugin.name}@${C.marketplace}`,{error:i}=ot(`localSettings`,{enabledPlugins:{...nt(`localSettings`)?.enabledPlugins,[r]:!1}});if(i){_e(!1),R(`Failed to write settings: ${i.message}`);return}xe(),t(`✓ Disabled ${C.plugin.name} in .workmate/settings.local.json. Run /reload-plugins to apply.`),n&&n(),e({type:`menu`})},"confirm:no":()=>{x(`plugin-details`),R(null)}},{context:`Confirmation`,isActive:b===`confirm-project-uninstall`&&!!C&&!ge}),Le((r,i)=>{if(!C)return;let o=`${C.plugin.name}@${C.marketplace}`,s=C.scope;if(!s||s===`builtin`||!wt(s))return;let c=async r=>{_e(!0),R(null);try{let i=await xt(o,s,r);if(!i.success)throw Error(i.message);xe();let c=r?``:` · data preserved`;t(`${a.tick} ${i.message}${c}`),n&&n(),e({type:`menu`})}catch(e){_e(!1),R(e instanceof Error?e.message:String(e))}};r===`y`||r===`Y`?c(!0):r===`n`||r===`N`?c(!1):i.escape&&(x(`plugin-details`),R(null))},{isActive:typeof b==`object`&&b.type===`confirm-data-cleanup`&&!!C&&!ge}),$n.useEffect(()=>{le(0)},[S]),Le((e,t)=>{let n=!t.ctrl&&!t.meta;h||(e===`/`&&n?(_(!0),ee(``),le(0)):n&&e.length>0&&!/^\s+$/.test(e)&&e!==`j`&&e!==`k`&&e!==` `&&(_(!0),ee(e),le(0)))},{isActive:b===`plugin-list`}),O)return(0,Z.jsx)(V,{children:`Loading installed plugins…`});if(se.length===0)return(0,Z.jsxs)(B,{flexDirection:`column`,children:[(0,Z.jsx)(B,{marginBottom:1,children:(0,Z.jsx)(V,{bold:!0,children:`Manage plugins`})}),(0,Z.jsx)(V,{children:`No plugins or MCP servers installed.`}),(0,Z.jsx)(B,{marginTop:1,children:(0,Z.jsx)(V,{dimColor:!0,children:`Esc to go back`})})]});if(typeof b==`object`&&b.type===`plugin-options`&&C){let r=`${C.plugin.name}@${C.marketplace}`;function i(r){t(r),n&&n(),e({type:`menu`})}return(0,Z.jsx)(mn,{plugin:C.plugin,pluginId:r,onDone:(e,t)=>{switch(e){case`configured`:i(`✓ Enabled and configured ${C.plugin.name}. Run /reload-plugins to apply.`);break;case`skipped`:i(`✓ Enabled ${C.plugin.name}. Run /reload-plugins to apply.`);break;case`error`:i(`Failed to save configuration: ${t}`);break}}})}if(typeof b==`object`&&b.type===`configuring-options`&&C){let e=`${C.plugin.name}@${C.marketplace}`;return(0,Z.jsx)(ln,{title:`Configure ${C.plugin.name}`,subtitle:`Plugin options`,configSchema:b.schema,initialValues:he(e),onSave:n=>{try{fe(e,n,b.schema),xe(),t(`Configuration saved. Run /reload-plugins for changes to take effect.`)}catch(e){R(`Failed to save configuration: ${qe(e)}`)}x(`plugin-details`)},onCancel:()=>x(`plugin-details`)})}if(b===`configuring`&&ye&&C){let e=`${C.plugin.name}@${C.marketplace}`;async function n(n){if(!(!ye||!C))try{let r=C.plugin.manifest.mcpServers,i=null;if(typeof r==`string`&&P(r))i=r;else if(Array.isArray(r)){for(let e of r)if(typeof e==`string`&&P(e)){i=e;break}}if(!i){R(`No MCPB file found`),x(`plugin-details`);return}await we(i,C.plugin.path,e,void 0,n),R(null),Se(null),x(`plugin-details`),t(`Configuration saved. Run /reload-plugins for changes to take effect.`)}catch(e){let t=qe(e);R(`Failed to save configuration: ${t}`),x(`plugin-details`)}}function r(){Se(null),x(`plugin-details`)}return(0,Z.jsx)(ln,{title:`Configure ${ye.manifest.name}`,subtitle:`Plugin: ${C.plugin.name}`,configSchema:ye.configSchema,initialValues:ye.existingConfig,onSave:n,onCancel:r})}if(typeof b==`object`&&b.type===`flagged-detail`){let e=b.plugin;return(0,Z.jsxs)(B,{flexDirection:`column`,children:[(0,Z.jsx)(B,{children:(0,Z.jsxs)(V,{bold:!0,children:[e.name,` @ `,e.marketplace]})}),(0,Z.jsxs)(B,{marginBottom:1,children:[(0,Z.jsx)(V,{dimColor:!0,children:`Status: `}),(0,Z.jsx)(V,{color:`error`,children:`Removed`})]}),(0,Z.jsxs)(B,{marginBottom:1,flexDirection:`column`,children:[(0,Z.jsxs)(V,{color:`error`,children:[`Removed from marketplace · reason: `,e.reason]}),(0,Z.jsx)(V,{children:e.text}),(0,Z.jsxs)(V,{dimColor:!0,children:[`Flagged on `,new Date(e.flaggedAt).toLocaleDateString()]})]}),(0,Z.jsx)(B,{marginTop:1,flexDirection:`column`,children:(0,Z.jsxs)(B,{children:[(0,Z.jsxs)(V,{children:[a.pointer,` `]}),(0,Z.jsx)(V,{color:`suggestion`,children:`Dismiss`})]})}),(0,Z.jsxs)(Pe,{children:[(0,Z.jsx)(L,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`dismiss`}),(0,Z.jsx)(L,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]})]})}if(b===`confirm-project-uninstall`&&C)return(0,Z.jsxs)(B,{flexDirection:`column`,children:[(0,Z.jsxs)(V,{bold:!0,color:`warning`,children:[C.plugin.name,` is enabled in .workmate/settings.json (shared with your team)`]}),(0,Z.jsxs)(B,{marginTop:1,flexDirection:`column`,children:[(0,Z.jsx)(V,{children:`Disable it just for you in .workmate/settings.local.json?`}),(0,Z.jsx)(V,{dimColor:!0,children:`This has the same effect as uninstalling, without affecting other contributors.`})]}),ve&&(0,Z.jsx)(B,{marginTop:1,children:(0,Z.jsx)(V,{color:`error`,children:ve})}),(0,Z.jsx)(B,{marginTop:1,children:ge?(0,Z.jsx)(V,{dimColor:!0,children:`Disabling…`}):(0,Z.jsxs)(Pe,{children:[(0,Z.jsx)(L,{action:`confirm:yes`,context:`Confirmation`,fallback:`y`,description:`disable`}),(0,Z.jsx)(L,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})]})})]});if(typeof b==`object`&&b.type===`confirm-data-cleanup`&&C)return(0,Z.jsxs)(B,{flexDirection:`column`,children:[(0,Z.jsxs)(V,{bold:!0,children:[C.plugin.name,` has `,b.size.human,` of persistent data`]}),(0,Z.jsxs)(B,{marginTop:1,flexDirection:`column`,children:[(0,Z.jsx)(V,{children:`Delete it along with the plugin?`}),(0,Z.jsx)(V,{dimColor:!0,children:d(`${C.plugin.name}@${C.marketplace}`)})]}),ve&&(0,Z.jsx)(B,{marginTop:1,children:(0,Z.jsx)(V,{color:`error`,children:ve})}),(0,Z.jsx)(B,{marginTop:1,children:ge?(0,Z.jsx)(V,{dimColor:!0,children:`Uninstalling…`}):(0,Z.jsxs)(V,{children:[(0,Z.jsx)(V,{bold:!0,children:`y`}),` to delete · `,(0,Z.jsx)(V,{bold:!0,children:`n`}),` to keep · `,(0,Z.jsx)(V,{bold:!0,children:`esc`}),` to cancel`]})})]});if(b===`plugin-details`&&C){let e=rt(),t=`${C.plugin.name}@${C.marketplace}`,n=e?.enabledPlugins?.[t]!==!1,r=p.filter(e=>`plugin`in e&&e.plugin===C.plugin.name||e.source===t||e.source.startsWith(`${C.plugin.name}@`)),i=r.length===0?null:(0,Z.jsxs)(B,{flexDirection:`column`,marginBottom:1,children:[(0,Z.jsxs)(V,{bold:!0,color:`error`,children:[r.length,` `,gt(r.length,`error`),`:`]}),r.map((e,t)=>{let n=Un(e);return(0,Z.jsxs)(B,{flexDirection:`column`,marginLeft:2,children:[(0,Z.jsx)(V,{color:`error`,children:Hn(e)}),n&&(0,Z.jsxs)(V,{dimColor:!0,italic:!0,children:[a.arrowRight,` `,n]})]},t)})]});return(0,Z.jsxs)(B,{flexDirection:`column`,children:[(0,Z.jsx)(B,{children:(0,Z.jsxs)(V,{bold:!0,children:[C.plugin.name,` @ `,C.marketplace]})}),(0,Z.jsxs)(B,{children:[(0,Z.jsx)(V,{dimColor:!0,children:`Scope: `}),(0,Z.jsx)(V,{children:C.scope||`user`})]}),C.plugin.manifest.version&&(0,Z.jsxs)(B,{children:[(0,Z.jsx)(V,{dimColor:!0,children:`Version: `}),(0,Z.jsx)(V,{children:C.plugin.manifest.version})]}),C.plugin.manifest.description&&(0,Z.jsx)(B,{marginBottom:1,children:(0,Z.jsx)(V,{children:C.plugin.manifest.description})}),C.plugin.manifest.author&&(0,Z.jsxs)(B,{children:[(0,Z.jsx)(V,{dimColor:!0,children:`Author: `}),(0,Z.jsx)(V,{children:C.plugin.manifest.author.name})]}),(0,Z.jsxs)(B,{marginBottom:1,children:[(0,Z.jsx)(V,{dimColor:!0,children:`Status: `}),(0,Z.jsx)(V,{color:n?`success`:`warning`,children:n?`Enabled`:`Disabled`}),C.pendingUpdate&&(0,Z.jsx)(V,{color:`suggestion`,children:` · Marked for update`})]}),(0,Z.jsx)(Yn,{plugin:C.plugin,marketplace:C.marketplace}),i,(0,Z.jsx)(B,{marginTop:1,flexDirection:`column`,children:Me.map((e,t)=>{let n=t===pe;return(0,Z.jsxs)(B,{children:[n&&(0,Z.jsxs)(V,{children:[a.pointer,` `]}),!n&&(0,Z.jsx)(V,{children:` `}),(0,Z.jsx)(V,{bold:n,color:e.label.includes(`Uninstall`)?`error`:e.label.includes(`Update`)?`suggestion`:void 0,children:e.label})]},t)})}),ge&&(0,Z.jsx)(B,{marginTop:1,children:(0,Z.jsx)(V,{children:`Processing…`})}),ve&&(0,Z.jsx)(B,{marginTop:1,children:(0,Z.jsx)(V,{color:`error`,children:ve})}),(0,Z.jsx)(B,{marginTop:1,children:(0,Z.jsx)(V,{dimColor:!0,italic:!0,children:(0,Z.jsxs)(Pe,{children:[(0,Z.jsx)(L,{action:`select:previous`,context:`Select`,fallback:`↑`,description:`navigate`}),(0,Z.jsx)(L,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`select`}),(0,Z.jsx)(L,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]})})})]})}if(typeof b==`object`&&b.type===`failed-plugin-details`){let e=b.plugin,t=e.errors[0],n=t?Hn(t):`Failed to load`;return(0,Z.jsxs)(B,{flexDirection:`column`,children:[(0,Z.jsxs)(V,{children:[(0,Z.jsx)(V,{bold:!0,children:e.name}),(0,Z.jsxs)(V,{dimColor:!0,children:[` @ `,e.marketplace]}),(0,Z.jsxs)(V,{dimColor:!0,children:[` (`,e.scope,`)`]})]}),(0,Z.jsx)(V,{color:`error`,children:n}),e.scope===`managed`?(0,Z.jsx)(B,{marginTop:1,children:(0,Z.jsx)(V,{dimColor:!0,children:`Managed by your organization — contact your admin`})}):(0,Z.jsxs)(B,{marginTop:1,children:[(0,Z.jsxs)(V,{color:`suggestion`,children:[a.pointer,` `]}),(0,Z.jsx)(V,{bold:!0,children:`Remove`})]}),ge&&(0,Z.jsx)(V,{children:`Processing…`}),ve&&(0,Z.jsx)(V,{color:`error`,children:ve}),(0,Z.jsx)(B,{marginTop:1,children:(0,Z.jsx)(V,{dimColor:!0,italic:!0,children:(0,Z.jsxs)(Pe,{children:[e.scope!==`managed`&&(0,Z.jsx)(L,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`remove`}),(0,Z.jsx)(L,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]})})})]})}if(typeof b==`object`&&b.type===`mcp-detail`){let e=b.client,n=f(u,e.name).length,r=()=>{x({type:`mcp-tools`,client:e})},i=()=>{x(`plugin-list`)},a=e=>{e&&t(e),x(`plugin-list`)},o=e.config.scope,s=e.config.type;return s===`stdio`?(0,Z.jsx)(Kt,{server:{name:e.name,client:e,scope:o,transport:`stdio`,config:e.config},serverToolsCount:n,onViewTools:r,onCancel:i,onComplete:a,borderless:!0}):s===`sse`?(0,Z.jsx)(Qt,{server:{name:e.name,client:e,scope:o,transport:`sse`,isAuthenticated:void 0,config:e.config},serverToolsCount:n,onViewTools:r,onCancel:i,onComplete:a,borderless:!0}):s===`http`?(0,Z.jsx)(Qt,{server:{name:e.name,client:e,scope:o,transport:`http`,isAuthenticated:void 0,config:e.config},serverToolsCount:n,onViewTools:r,onCancel:i,onComplete:a,borderless:!0}):s===`claudeai-proxy`?(0,Z.jsx)(Qt,{server:{name:e.name,client:e,scope:o,transport:`claudeai-proxy`,isAuthenticated:void 0,config:e.config},serverToolsCount:n,onViewTools:r,onCancel:i,onComplete:a,borderless:!0}):(x(`plugin-list`),null)}if(typeof b==`object`&&b.type===`mcp-tools`){let e=b.client,t=e.config.scope,n=e.config.type,r;return r=n===`stdio`?{name:e.name,client:e,scope:t,transport:`stdio`,config:e.config}:n===`sse`?{name:e.name,client:e,scope:t,transport:`sse`,isAuthenticated:void 0,config:e.config}:n===`http`?{name:e.name,client:e,scope:t,transport:`http`,isAuthenticated:void 0,config:e.config}:{name:e.name,client:e,scope:t,transport:`claudeai-proxy`,isAuthenticated:void 0,config:e.config},(0,Z.jsx)($t,{server:r,onSelectTool:t=>{x({type:`mcp-tool-detail`,client:e,tool:t})},onBack:()=>x({type:`mcp-detail`,client:e})})}if(typeof b==`object`&&b.type===`mcp-tool-detail`){let{client:e,tool:t}=b,n=e.config.scope,r=e.config.type,i;return i=r===`stdio`?{name:e.name,client:e,scope:n,transport:`stdio`,config:e.config}:r===`sse`?{name:e.name,client:e,scope:n,transport:`sse`,isAuthenticated:void 0,config:e.config}:r===`http`?{name:e.name,client:e,scope:n,transport:`http`,isAuthenticated:void 0,config:e.config}:{name:e.name,client:e,scope:n,transport:`claudeai-proxy`,isAuthenticated:void 0,config:e.config},(0,Z.jsx)(Zt,{tool:t,server:i,onBack:()=>x({type:`mcp-tools`,client:e})})}let Ne=de.getVisibleItems(F);return(0,Z.jsxs)(B,{flexDirection:`column`,children:[(0,Z.jsx)(B,{marginBottom:1,children:(0,Z.jsx)(ze,{query:S,isFocused:h,isTerminalFocused:v,width:y-4,cursorOffset:te})}),F.length===0&&S&&(0,Z.jsx)(B,{marginBottom:1,children:(0,Z.jsxs)(V,{dimColor:!0,children:[`No items match "`,S,`"`]})}),de.scrollPosition.canScrollUp&&(0,Z.jsx)(B,{children:(0,Z.jsxs)(V,{dimColor:!0,children:[` `,a.arrowUp,` more above`]})}),Ne.map((e,t)=>{let n=de.toActualIndex(t)===I&&!h,r=t>0?Ne[t-1]:null,i=!r||r.scope!==e.scope;return(0,Z.jsxs)($n.Fragment,{children:[i&&(0,Z.jsx)(B,{marginTop:+(t>0),paddingLeft:2,children:(0,Z.jsx)(V,{dimColor:e.scope!==`flagged`,color:e.scope===`flagged`?`warning`:void 0,bold:e.scope===`flagged`,children:(e=>{switch(e){case`flagged`:return`Flagged`;case`project`:return`Project`;case`local`:return`Local`;case`user`:return`User`;case`enterprise`:return`Enterprise`;case`managed`:return`Managed`;case`builtin`:return`Built-in`;case`dynamic`:return`Built-in`;default:return e}})(e.scope)})}),(0,Z.jsx)(Gn,{item:e,isSelected:n})]},e.id)}),de.scrollPosition.canScrollDown&&(0,Z.jsx)(B,{children:(0,Z.jsxs)(V,{dimColor:!0,children:[` `,a.arrowDown,` more below`]})}),(0,Z.jsx)(B,{marginTop:1,marginLeft:1,children:(0,Z.jsx)(V,{dimColor:!0,italic:!0,children:(0,Z.jsxs)(Pe,{children:[(0,Z.jsx)(V,{children:`type to search`}),(0,Z.jsx)(L,{action:`plugin:toggle`,context:`Plugin`,fallback:`Space`,description:`toggle`}),(0,Z.jsx)(L,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`details`}),(0,Z.jsx)(L,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]})})}),A.size>0&&(0,Z.jsx)(B,{marginLeft:1,children:(0,Z.jsx)(V,{dimColor:!0,italic:!0,children:`Run /reload-plugins to apply changes`})})]})}var $n,X,Z,er=e((()=>{i(),$n=t(H(),1),X=t(H(),1),v(),Ue(),qt(),Xt(),Jt(),Yt(),Ut(),Gt(),m(),s(),Se(),Bt(),te(),Et(),me(),tt(),O(),Qe(),Je(),ut(),j(),Ee(),Ae(),F(),S(),Rt(),_(),ae(),N(),k(),vt(),it(),$e(),_t(),Wn(),fn(),_n(),Kn(),kn(),Z=Ke()}));function tr(e){if(!e)return{type:`menu`};let t=e.trim().split(/\s+/);switch(t[0]?.toLowerCase()){case`help`:case`--help`:case`-h`:return{type:`help`};case`install`:case`i`:{let e=t[1];if(!e)return{type:`install`};if(e.includes(`@`)){let[t,n]=e.split(`@`);return{type:`install`,plugin:t,marketplace:n}}return e.startsWith(`http://`)||e.startsWith(`https://`)||e.startsWith(`file://`)||e.includes(`/`)||e.includes(`\\`)?{type:`install`,marketplace:e}:{type:`install`,plugin:e}}case`manage`:return{type:`manage`};case`uninstall`:return{type:`uninstall`,plugin:t[1]};case`enable`:return{type:`enable`,plugin:t[1]};case`disable`:return{type:`disable`,plugin:t[1]};case`validate`:return{type:`validate`,path:t.slice(1).join(` `).trim()||void 0};case`marketplace`:case`market`:{let e=t[1]?.toLowerCase(),n=t.slice(2).join(` `);switch(e){case`add`:return{type:`marketplace`,action:`add`,target:n};case`remove`:case`rm`:return{type:`marketplace`,action:`remove`,target:n};case`update`:return{type:`marketplace`,action:`update`,target:n};case`list`:return{type:`marketplace`,action:`list`};default:return{type:`marketplace`}}}default:return{type:`menu`}}}var nr=e((()=>{}));function rr({onComplete:e,path:t}){return(0,ir.useEffect)(()=>{async function n(){if(!t){e(`Usage: /plugin validate <path>
|
|
2
|
+
|
|
3
|
+
Validate a plugin or marketplace manifest file or directory.
|
|
4
|
+
|
|
5
|
+
Examples:
|
|
6
|
+
/plugin validate .claude-plugin/plugin.json
|
|
7
|
+
/plugin validate /path/to/plugin-directory
|
|
8
|
+
/plugin validate .
|
|
9
|
+
|
|
10
|
+
When given a directory, automatically validates .claude-plugin/marketplace.json
|
|
11
|
+
or .claude-plugin/plugin.json (prefers marketplace if both exist).
|
|
12
|
+
|
|
13
|
+
Or from the command line:
|
|
14
|
+
claude plugin validate <path>`);return}try{let n=await jt(t),r=``;r+=`Validating ${n.fileType} manifest: ${n.filePath}\n\n`,n.errors.length>0&&(r+=`${a.cross} Found ${n.errors.length} ${gt(n.errors.length,`error`)}:\n\n`,n.errors.forEach(e=>{r+=` ${a.pointer} ${e.path}: ${e.message}\n`}),r+=`
|
|
15
|
+
`),n.warnings.length>0&&(r+=`${a.warning} Found ${n.warnings.length} ${gt(n.warnings.length,`warning`)}:\n\n`,n.warnings.forEach(e=>{r+=` ${a.pointer} ${e.path}: ${e.message}\n`}),r+=`
|
|
16
|
+
`),n.success?(n.warnings.length>0?r+=`${a.tick} Validation passed with warnings\n`:r+=`${a.tick} Validation passed\n`,process.exitCode=0):(r+=`${a.cross} Validation failed\n`,process.exitCode=1),e(r)}catch(t){process.exitCode=2,dt(t),e(`${a.cross} Unexpected error during validation: ${qe(t)}`)}}n()},[e,t]),(0,ar.jsx)(B,{flexDirection:`column`,children:(0,ar.jsx)(V,{children:`Running validation...`})})}var ir,ar,or=e((()=>{i(),H(),ir=t(H(),1),Ue(),Je(),ut(),Pt(),_t(),ar=Ke()}));function sr({onComplete:e}){return(0,Q.useEffect)(()=>{async function t(){try{let t=await l(),n=Object.keys(t);n.length===0?e(`No marketplaces configured`):e(`Configured marketplaces:\n${n.map(e=>` • ${e}`).join(`
|
|
17
|
+
`)}`)}catch(t){e(`Error loading marketplaces: ${qe(t)}`)}}t()},[e]),(0,$.jsx)(V,{children:`Loading marketplaces...`})}function cr(e){let t=[];for(let{source:n,scope:r}of[{source:`userSettings`,scope:`user`},{source:`projectSettings`,scope:`project`},{source:`localSettings`,scope:`local`}])nt(n)?.extraKnownMarketplaces?.[e]&&t.push({source:n,scope:r});return{editableSources:t,isInPolicy:!!nt(`policySettings`)?.extraKnownMarketplaces?.[e]}}function lr(e){let{editableSources:t,isInPolicy:n}=cr(e);return t.length>0?{kind:`remove-extra-marketplace`,name:e,sources:t}:n?{kind:`managed-only`,name:e}:{kind:`navigate`,tab:`marketplaces`,viewState:{type:`manage-marketplaces`,targetMarketplace:e,action:`remove`}}}function ur(e){return{kind:`navigate`,tab:`installed`,viewState:{type:`manage-plugins`,targetPlugin:e,action:`uninstall`}}}function dr(e){return yr.has(e.type)}function fr(e){if(`pluginId`in e&&e.pluginId)return e.pluginId;if(`plugin`in e&&e.plugin)return e.plugin;if(e.source.includes(`@`))return e.source.split(`@`)[0]}function pr(e,t,n,r,i,a,o){let s=[];for(let e of a){let t=`pluginId`in e?e.pluginId:`plugin`in e?e.plugin:void 0;s.push({label:t??e.source,message:Hn(e),guidance:`Restart to retry loading plugins`,action:{kind:`none`}})}let c=new Set;for(let t of e){c.add(t.name);let e=lr(t.name),n=cr(t.name),r=n.isInPolicy?`managed`:n.editableSources[0]?.scope;s.push({label:t.name,message:t.error??`Installation failed`,guidance:e.kind===`managed-only`?`Managed by your organization — contact your admin`:void 0,action:e,scope:r})}for(let e of t){let t=`marketplace`in e?e.marketplace:e.source;if(c.has(t))continue;c.add(t);let n=lr(t),r=cr(t),i=r.isInPolicy?`managed`:r.editableSources[0]?.scope;s.push({label:t,message:Hn(e),guidance:n.kind===`managed-only`?`Managed by your organization — contact your admin`:Un(e),action:n,scope:i})}for(let e of i)c.has(e.name)||(c.add(e.name),s.push({label:e.name,message:e.error,action:{kind:`remove-installed-marketplace`,name:e.name}}));let l=new Set;for(let e of n){let t=fr(e);if(t&&l.has(t))continue;t&&l.add(t);let n=`marketplace`in e?e.marketplace:void 0,r=t?o.get(e.source)??o.get(t):void 0;s.push({label:t?n?`${t} @ ${n}`:t:e.source,message:Hn(e),guidance:Un(e),action:t?ur(t):{kind:`none`},scope:r})}for(let e of r)s.push({label:e.source,message:Hn(e),guidance:Un(e),action:{kind:`none`}});return s}function mr(e,t){for(let{source:n}of t){let t=nt(n);if(!t)continue;let r={};if(t.extraKnownMarketplaces?.[e]&&(r.extraKnownMarketplaces={...t.extraKnownMarketplaces,[e]:void 0}),t.enabledPlugins){let n=`@${e}`,i=!1,a={...t.enabledPlugins};for(let e in a)e.endsWith(n)&&(a[e]=void 0,i=!0);i&&(r.enabledPlugins=a)}Object.keys(r).length>0&&ot(n,r)}}function hr({setViewState:e,setActiveTab:t,markPluginsChanged:n}){let r=be(e=>e.plugins.errors),i=be(e=>e.plugins.installationStatus),o=de(),[s,c]=(0,Q.useState)(0),[u,d]=(0,Q.useState)(null),[f,m]=(0,Q.useState)([]);(0,Q.useEffect)(()=>{(async()=>{try{let{failures:e}=await re(await l());m(e)}catch{}})()},[]);let h=i.marketplaces.filter(e=>e.status===`failed`),g=new Set(h.map(e=>e.name)),_=r.filter(dr),v=pr(h,r.filter(e=>(e.type===`marketplace-not-found`||e.type===`marketplace-load-failed`||e.type===`marketplace-blocked-by-policy`)&&!g.has(e.marketplace)),r.filter(e=>dr(e)||e.type===`marketplace-not-found`||e.type===`marketplace-load-failed`||e.type===`marketplace-blocked-by-policy`?!1:fr(e)!==void 0),r.filter(e=>dr(e)||e.type===`marketplace-not-found`||e.type===`marketplace-load-failed`||e.type===`marketplace-blocked-by-policy`?!1:fr(e)===void 0),f,_,yt());Fe(`confirm:no`,()=>{e({type:`menu`})},{context:`Confirmation`}),z({"select:previous":()=>c(e=>Math.max(0,e-1)),"select:next":()=>c(e=>Math.min(v.length-1,e+1)),"select:accept":()=>{let r=v[s];if(!r)return;let{action:i}=r;switch(i.kind){case`navigate`:t(i.tab),e(i.viewState);break;case`remove-extra-marketplace`:{let e=i.sources.map(e=>e.scope).join(`, `);mr(i.name,i.sources),xe(),o(e=>({...e,plugins:{...e.plugins,errors:e.plugins.errors.filter(e=>!(`marketplace`in e&&e.marketplace===i.name)),installationStatus:{...e.plugins.installationStatus,marketplaces:e.plugins.installationStatus.marketplaces.filter(e=>e.name!==i.name)}}})),d(`${a.tick} Removed "${i.name}" from ${e} settings`),n();break}case`remove-installed-marketplace`:(async()=>{try{await p(i.name),xe(),m(e=>e.filter(e=>e.name!==i.name)),d(`${a.tick} Removed marketplace "${i.name}"`),n()}catch(e){d(`Failed to remove "${i.name}": ${e instanceof Error?e.message:String(e)}`)}})();break;case`managed-only`:break;case`none`:break}}},{context:`Select`,isActive:v.length>0});let y=Math.min(s,Math.max(0,v.length-1));y!==s&&c(y);let b=v[y]?.action,x=b&&b.kind!==`none`&&b.kind!==`managed-only`;return v.length===0?(0,$.jsxs)(B,{flexDirection:`column`,children:[(0,$.jsx)(B,{marginLeft:1,children:(0,$.jsx)(V,{dimColor:!0,children:`No plugin errors`})}),(0,$.jsx)(B,{marginTop:1,children:(0,$.jsx)(V,{dimColor:!0,italic:!0,children:(0,$.jsx)(L,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})})})]}):(0,$.jsxs)(B,{flexDirection:`column`,children:[v.map((e,t)=>{let n=t===y;return(0,$.jsxs)(B,{marginLeft:1,flexDirection:`column`,marginBottom:1,children:[(0,$.jsxs)(V,{children:[(0,$.jsxs)(V,{color:n?`suggestion`:`error`,children:[n?a.pointer:a.cross,` `]}),(0,$.jsx)(V,{bold:n,children:e.label}),e.scope&&(0,$.jsxs)(V,{dimColor:!0,children:[` (`,e.scope,`)`]})]}),(0,$.jsx)(B,{marginLeft:3,children:(0,$.jsx)(V,{color:`error`,children:e.message})}),e.guidance&&(0,$.jsx)(B,{marginLeft:3,children:(0,$.jsx)(V,{dimColor:!0,italic:!0,children:e.guidance})})]},t)}),u&&(0,$.jsx)(B,{marginTop:1,marginLeft:1,children:(0,$.jsx)(V,{color:`claude`,children:u})}),(0,$.jsx)(B,{marginTop:1,children:(0,$.jsx)(V,{dimColor:!0,italic:!0,children:(0,$.jsxs)(Pe,{children:[(0,$.jsx)(L,{action:`select:previous`,context:`Select`,fallback:`↑`,description:`navigate`}),x&&(0,$.jsx)(L,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`resolve`}),(0,$.jsx)(L,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]})})})]})}function gr(e){switch(e.type){case`help`:return{type:`help`};case`validate`:return{type:`validate`,path:e.path};case`install`:return e.marketplace?{type:`browse-marketplace`,targetMarketplace:e.marketplace,targetPlugin:e.plugin}:e.plugin?{type:`discover-plugins`,targetPlugin:e.plugin}:{type:`discover-plugins`};case`manage`:return{type:`manage-plugins`};case`uninstall`:return{type:`manage-plugins`,targetPlugin:e.plugin,action:`uninstall`};case`enable`:return{type:`manage-plugins`,targetPlugin:e.plugin,action:`enable`};case`disable`:return{type:`manage-plugins`,targetPlugin:e.plugin,action:`disable`};case`marketplace`:return e.action===`list`?{type:`marketplace-list`}:e.action===`add`?{type:`add-marketplace`,initialValue:e.target}:e.action===`remove`?{type:`manage-marketplaces`,targetMarketplace:e.target,action:`remove`}:e.action===`update`?{type:`manage-marketplaces`,targetMarketplace:e.target,action:`update`}:{type:`marketplace-menu`};default:return{type:`discover-plugins`}}}function _r(e){return e.type===`manage-plugins`?`installed`:e.type===`manage-marketplaces`?`marketplaces`:`discover`}function vr({onComplete:e,args:t}){let n=tr(t),r=gr(n),[i,a]=(0,Q.useState)(r),[o,s]=(0,Q.useState)(_r(r)),[c,l]=(0,Q.useState)(i.type===`add-marketplace`&&i.initialValue||``),[u,d]=(0,Q.useState)(0),[f,p]=(0,Q.useState)(null),[m,h]=(0,Q.useState)(null),[g,_]=(0,Q.useState)(!1),v=de(),y=be(e=>{let t=e.plugins.errors.length;for(let n of e.plugins.installationStatus.marketplaces)n.status===`failed`&&t++;return t}),b=y>0?`Errors (${y})`:`Errors`,x=Vt(),S=n.type===`marketplace`&&n.action===`add`&&n.target!==void 0,ee=(0,Q.useCallback)(()=>{v(e=>e.plugins.needsRefresh?e:{...e,plugins:{...e.plugins,needsRefresh:!0}})},[v]),te=(0,Q.useCallback)(e=>{let t=e;switch(s(t),p(null),t){case`discover`:a({type:`discover-plugins`});break;case`installed`:a({type:`manage-plugins`});break;case`marketplaces`:a({type:`manage-marketplaces`});break;case`errors`:break}},[]);return(0,Q.useEffect)(()=>{i.type===`menu`&&!m&&e()},[i.type,m,e]),(0,Q.useEffect)(()=>{i.type===`browse-marketplace`&&o!==`discover`&&s(`discover`)},[i.type,o]),Fe(`confirm:no`,(0,Q.useCallback)(()=>{s(`marketplaces`),a({type:`manage-marketplaces`}),l(``),p(null)},[]),{context:`Settings`,isActive:i.type===`add-marketplace`}),(0,Q.useEffect)(()=>{m&&e(m)},[m,e]),(0,Q.useEffect)(()=>{i.type===`help`&&e()},[i.type,e]),i.type===`help`?(0,$.jsxs)(B,{flexDirection:`column`,children:[(0,$.jsx)(V,{bold:!0,children:`Plugin Command Usage:`}),(0,$.jsx)(V,{children:` `}),(0,$.jsx)(V,{dimColor:!0,children:`Installation:`}),(0,$.jsx)(V,{children:` /plugin install - Browse and install plugins`}),(0,$.jsx)(V,{children:` /plugin install <marketplace> - Install from specific marketplace`}),(0,$.jsx)(V,{children:` /plugin install <plugin> - Install specific plugin`}),(0,$.jsx)(V,{children:` /plugin install <plugin>@<market> - Install plugin from marketplace`}),(0,$.jsx)(V,{children:` `}),(0,$.jsx)(V,{dimColor:!0,children:`Management:`}),(0,$.jsx)(V,{children:` /plugin manage - Manage installed plugins`}),(0,$.jsx)(V,{children:` /plugin enable <plugin> - Enable a plugin`}),(0,$.jsx)(V,{children:` /plugin disable <plugin> - Disable a plugin`}),(0,$.jsx)(V,{children:` /plugin uninstall <plugin> - Uninstall a plugin`}),(0,$.jsx)(V,{children:` `}),(0,$.jsx)(V,{dimColor:!0,children:`Marketplaces:`}),(0,$.jsx)(V,{children:` /plugin marketplace - Marketplace management menu`}),(0,$.jsx)(V,{children:` /plugin marketplace add - Add a marketplace`}),(0,$.jsx)(V,{children:` /plugin marketplace add <path/url> - Add marketplace directly`}),(0,$.jsx)(V,{children:` /plugin marketplace update - Update marketplaces`}),(0,$.jsx)(V,{children:` /plugin marketplace update <name> - Update specific marketplace`}),(0,$.jsx)(V,{children:` /plugin marketplace remove - Remove a marketplace`}),(0,$.jsx)(V,{children:` /plugin marketplace remove <name> - Remove specific marketplace`}),(0,$.jsx)(V,{children:` /plugin marketplace list - List all marketplaces`}),(0,$.jsx)(V,{children:` `}),(0,$.jsx)(V,{dimColor:!0,children:`Validation:`}),(0,$.jsx)(V,{children:` /plugin validate <path> - Validate a manifest file or directory`}),(0,$.jsx)(V,{children:` `}),(0,$.jsx)(V,{dimColor:!0,children:`Other:`}),(0,$.jsx)(V,{children:` /plugin - Main plugin menu`}),(0,$.jsx)(V,{children:` /plugin help - Show this help`}),(0,$.jsx)(V,{children:` /plugins - Alias for /plugin`})]}):i.type===`validate`?(0,$.jsx)(rr,{onComplete:e,path:i.path}):i.type===`marketplace-menu`?(a({type:`menu`}),null):i.type===`marketplace-list`?(0,$.jsx)(sr,{onComplete:e}):i.type===`add-marketplace`?(0,$.jsx)(an,{inputValue:c,setInputValue:l,cursorOffset:u,setCursorOffset:d,error:f,setError:p,result:m,setResult:h,setViewState:a,onAddComplete:ee,cliMode:S}):(0,$.jsx)(We,{color:`suggestion`,children:(0,$.jsxs)(He,{title:`Plugins`,selectedTab:o,onTabChange:te,color:`suggestion`,disableNavigation:g,children:[(0,$.jsx)(Be,{id:`discover`,title:`Discover`,children:i.type===`browse-marketplace`?(0,$.jsx)(An,{error:f,setError:p,result:m,setResult:h,setViewState:a,onInstallComplete:ee,targetMarketplace:i.targetMarketplace,targetPlugin:i.targetPlugin}):(0,$.jsx)(Nn,{error:f,setError:p,result:m,setResult:h,setViewState:a,onInstallComplete:ee,onSearchModeChange:_,targetPlugin:i.type===`discover-plugins`?i.targetPlugin:void 0})}),(0,$.jsx)(Be,{id:`installed`,title:`Installed`,children:(0,$.jsx)(Qn,{setViewState:a,setResult:h,onManageComplete:ee,onSearchModeChange:_,targetPlugin:i.type===`manage-plugins`?i.targetPlugin:void 0,targetMarketplace:i.type===`manage-plugins`?i.targetMarketplace:void 0,action:i.type===`manage-plugins`?i.action:void 0})}),(0,$.jsx)(Be,{id:`marketplaces`,title:`Marketplaces`,children:(0,$.jsx)(Rn,{setViewState:a,error:f,setError:p,setResult:h,exitState:x,onManageComplete:ee,targetMarketplace:i.type===`manage-marketplaces`?i.targetMarketplace:void 0,action:i.type===`manage-marketplaces`?i.action:void 0})}),(0,$.jsx)(Be,{id:`errors`,title:b,children:(0,$.jsx)(hr,{setViewState:a,setActiveTab:s,markPluginsChanged:ee})})]})})}var Q,$,yr,br=e((()=>{i(),H(),Q=t(H(),1),v(),Ue(),Ht(),s(),me(),Je(),j(),ve(),Ae(),vt(),it(),sn(),Mn(),Ln(),Vn(),er(),Wn(),nr(),or(),$=Ke(),yr=new Set([`git-auth-failed`,`git-timeout`,`network-error`])}));async function xr(e,t,n){return(0,Sr.jsx)(vr,{onComplete:e,args:n})}var Sr;e((()=>{H(),br(),Sr=Ke()}))();export{xr as call};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{Bo as t,Eo as n,Fo as r,Jw as i,Uo as a,Xw as o,ko as s,wo as c,zo as l}from"./loadAgentsDir-BXtV2jiO.js";import{P as u,R as d,c as f,i as p}from"./debug-Dr1SjdXn.js";import{vt as m,xt as h}from"./settings-DiBMs2gM.js";import{b as g,h as _}from"./config-9rLTDOYW.js";import{o as v,s as y}from"./log-27kCA_9u.js";import{f as b,s as x}from"./pluginOperations-BFbty6WT.js";function S(e){return O=e,k!==null&&k.length>0&&(e(k),k=null),()=>{O=null}}async function C(){let e=await t(),n=r(),i=new Set;for(let[t,r]of Object.entries(e)){let e=n[t]?.autoUpdate;(e===void 0?h(t,r):e)&&i.add(t.toLowerCase())}return i}async function w(e,t){let n=!1;for(let{scope:r}of t)try{let t=await b(e,r);t.success&&!t.alreadyUpToDate?(n=!0,f(`Plugin autoupdate: updated ${e} from ${t.oldVersion} to ${t.newVersion}`)):t.alreadyUpToDate||f(`Plugin autoupdate: failed to update ${e}: ${t.message}`,{level:`warn`})}catch(t){f(`Plugin autoupdate: error updating ${e}: ${u(t)}`,{level:`warn`})}return n?e:null}async function T(e){let t=s(),r=Object.keys(t.plugins);return r.length===0?[]:(await Promise.allSettled(r.map(async r=>{let{marketplace:i}=o(r);if(!i||!e.has(i.toLowerCase()))return null;let a=t.plugins[r];if(!a||a.length===0)return null;let s=a.filter(n);return s.length===0?null:w(r,s)}))).filter(e=>e.status===`fulfilled`&&e.value!==null).map(e=>e.value)}async function E(e){return T(e)}function D(){(async()=>{if(g()){f(`Plugin autoupdate: skipped (auto-updater disabled)`);return}try{let e=await C();if(e.size===0)return;let t=(await Promise.allSettled(Array.from(e).map(async e=>{try{await a(e,void 0,{disableCredentialHelper:!0})}catch(t){f(`Plugin autoupdate: failed to refresh marketplace ${e}: ${u(t)}`,{level:`warn`})}}))).filter(e=>e.status===`rejected`);t.length>0&&f(`Plugin autoupdate: ${t.length} marketplace refresh(es) failed`,{level:`warn`}),f(`Plugin autoupdate: checking installed plugins`);let n=await E(e);n.length>0&&(O?O(n):k=n)}catch(e){y(e)}})()}var O,k,A=e((()=>{x(),_(),p(),d(),v(),c(),l(),i(),m(),O=null,k=null}));export{T as i,A as n,S as r,D as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Ao as e,Io as t,Vo as n,wo as r,zo as i}from"./loadAgentsDir-BXtV2jiO.js";import{P as a,R as o,c as s,i as c}from"./debug-Dr1SjdXn.js";import{d as l,s as u}from"./pluginOperations-BFbty6WT.js";import{i as d,n as f,r as p,t as m}from"./pluginFlagging-CXSSOj4J.js";u(),c(),o(),r(),i(),p();function h(e,t,n){let r=new Set(t.plugins.map(e=>e.name)),i=`@${n}`,a=[];for(let t of Object.keys(e.plugins)){if(!t.endsWith(i))continue;let e=t.slice(0,-i.length);r.has(e)||a.push(t)}return a}async function g(){await d();let r=e(),i=f(),o=await n(),c=[];for(let e of Object.keys(o))try{let n=await t(e);if(!n.forceRemoveDeletedPlugins)continue;let o=h(r,n,e);for(let e of o){if(e in i)continue;let t=r.plugins[e]??[];if(t.some(e=>e.scope===`user`||e.scope===`project`||e.scope===`local`)){for(let n of t){let{scope:t}=n;if(!(t!==`user`&&t!==`project`&&t!==`local`))try{await l(e,t)}catch(n){s(`Failed to auto-uninstall delisted plugin ${e} from ${t}: ${a(n)}`,{level:`error`})}}await m(e),c.push(e)}}}catch(t){s(`Failed to check for delisted plugins in "${e}": ${a(t)}`,{level:`warn`})}return c}export{g as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e,t}from"./figures-5ThXQEtq.js";import{Co as n,Df as r,Jw as i,Of as a,Qd as o,So as s,Xd as c,Xw as l,kf as u}from"./loadAgentsDir-BXtV2jiO.js";import{P as d,R as f}from"./debug-Dr1SjdXn.js";import{n as p,o as m}from"./process-gEbdy6uY.js";import{o as h,s as g}from"./log-27kCA_9u.js";import{n as _,r as v}from"./analytics-DJobLaWP.js";import{a as y,c as b,d as x,f as S,i as C,r as w,s as T}from"./pluginOperations-BFbty6WT.js";e(),f(),o(),h(),n(),i(),p(),u(),_(),T();function E(e,n,i){g(e);let o=i?`${n} plugin "${i}"`:n===`disable-all`?`disable all plugins`:`${n} plugins`;console.error(`${t.cross} Failed to ${o}: ${d(e)}`);let c=i?(()=>{let{name:e,marketplace:t}=l(i);return{_PROTO_plugin_name:e,...t&&{_PROTO_marketplace_name:t},...r(e,t,s())}})():{};v(`tengu_plugin_command_failed`,{command:n,error_category:a(e),...c}),process.exit(1)}async function D(e,n=`user`){try{console.log(`Installing plugin "${e}"...`);let i=await b(e,n);if(!i.success)throw Error(i.message);console.log(`${t.tick} ${i.message}`);let{name:a,marketplace:o}=l(i.pluginId||e);v(`tengu_plugin_installed_cli`,{_PROTO_plugin_name:a,...o&&{_PROTO_marketplace_name:o},scope:i.scope||n,install_source:`cli-explicit`,...r(a,o,s())}),process.exit(0)}catch(t){E(t,`install`,e)}}async function O(e,n=`user`,i=!1){try{let a=await x(e,n,!i);if(!a.success)throw Error(a.message);console.log(`${t.tick} ${a.message}`);let{name:o,marketplace:c}=l(a.pluginId||e);v(`tengu_plugin_uninstalled_cli`,{_PROTO_plugin_name:o,...c&&{_PROTO_marketplace_name:c},scope:a.scope||n,...r(o,c,s())}),process.exit(0)}catch(t){E(t,`uninstall`,e)}}async function k(e,n){try{let i=await y(e,n);if(!i.success)throw Error(i.message);console.log(`${t.tick} ${i.message}`);let{name:a,marketplace:o}=l(i.pluginId||e);v(`tengu_plugin_enabled_cli`,{_PROTO_plugin_name:a,...o&&{_PROTO_marketplace_name:o},scope:i.scope,...r(a,o,s())}),process.exit(0)}catch(t){E(t,`enable`,e)}}async function A(e,n){try{let i=await C(e,n);if(!i.success)throw Error(i.message);console.log(`${t.tick} ${i.message}`);let{name:a,marketplace:o}=l(i.pluginId||e);v(`tengu_plugin_disabled_cli`,{_PROTO_plugin_name:a,...o&&{_PROTO_marketplace_name:o},scope:i.scope,...r(a,o,s())}),process.exit(0)}catch(t){E(t,`disable`,e)}}async function j(){try{let e=await w();if(!e.success)throw Error(e.message);console.log(`${t.tick} ${e.message}`),v(`tengu_plugin_disabled_all_cli`,{}),process.exit(0)}catch(e){E(e,`disable-all`)}}async function M(e,n){try{m(`Checking for updates for plugin "${e}" at ${n} scope…\n`);let i=await S(e,n);if(!i.success)throw Error(i.message);if(m(`${t.tick} ${i.message}\n`),!i.alreadyUpToDate){let{name:t,marketplace:n}=l(i.pluginId||e);v(`tengu_plugin_updated_cli`,{_PROTO_plugin_name:t,...n&&{_PROTO_marketplace_name:n},old_version:i.oldVersion||`unknown`,new_version:i.newVersion||`unknown`,...r(t,n,s())})}await c(0)}catch(t){E(t,`update`,e)}}export{O as a,D as i,A as n,M as o,k as r,j as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{Nw as t,Pw as n}from"./loadAgentsDir-BXtV2jiO.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-Dr1SjdXn.js";import{o as u,s as d}from"./log-27kCA_9u.js";import{join as f}from"path";import{randomBytes as p}from"crypto";import{readFile as m,rename as h,unlink as g,writeFile as _}from"fs/promises";function v(){return f(t(),D)}function y(e){let t=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 n=v(),i=`${n}.${p(8).toString(`hex`)}.tmp`;try{await c().mkdir(t()),await _(i,r({plugins:e},null,2),{encoding:`utf-8`,mode:384}),await h(i,n),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(),n(),D=`flagged-plugins.json`,O=2880*60*1e3,k=null}));export{T as a,S as i,C as n,E as o,A as r,w as t};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{Ao as t,Aw as n,Bo as r,Gw as i,Io as a,Jw as o,Kw as s,Mo as c,Pw as l,Ro as u,Xw as d,Zw as f,_o as p,bg as m,bo as h,co as g,cs as _,do as v,fS as y,fo as b,go as x,jo as S,ko as C,lo as w,ls as T,mo as E,nT as D,oo as ee,qw as te,ss as O,tT as k,uS as A,uo as j,wo as ne,xg as re,xo as ie,yo as ae,zo as oe}from"./loadAgentsDir-BXtV2jiO.js";import{Wt as se,et as M}from"./state-BPFYBqm1.js";import{B as N,R as ce,U as P,f as F,u as I}from"./debug-Dr1SjdXn.js";import{c as L,g as R,x as z}from"./settings-DiBMs2gM.js";import{o as B,s as V}from"./log-27kCA_9u.js";import{l as H,o as U}from"./stringUtils-Df-Lnjxd.js";import{n as W,t as G}from"./pluginStartupCheck-BEd0VeQC.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`?M():void 0}function de(e){return L(`projectSettings`)?.enabledPlugins?.[e]===!0}function fe(e){let t=e.includes(`@`);for(let n of[`local`,`project`,`user`]){let r=L(f(n))?.enabledPlugins;if(r){for(let i of Object.keys(r))if(t?i===e:i.startsWith(`${e}@`))return{pluginId:i,scope:n}}}return null}function pe(e,t){let{name:n,marketplace:r}=d(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:n}=d(e),r=t();if(r.plugins[e]?.length)return{pluginId:e,pluginName:n};let i=Object.keys(r.plugins).find(e=>{let{name:t}=d(e);return t===n&&(r.plugins[e]?.length??0)>0});return i?{pluginId:i,pluginName:n}:null}function Y(e){let n=t().plugins[e];if(!n||n.length===0)return{scope:`user`};let r=M(),i=n.find(e=>e.scope===`local`&&e.projectPath===r);if(i)return{scope:i.scope,projectPath:i.projectPath};let a=n.find(e=>e.scope===`project`&&e.projectPath===r);if(a)return{scope:a.scope,projectPath:a.projectPath};let o=n.find(e=>e.scope===`user`);return o?{scope:o.scope}:{scope:n[0].scope,projectPath:n[0].projectPath}}async function he(e,t=`user`){q(t);let{name:n,marketplace:i}=d(e),o,s,c;if(i){let t=await u(e);t&&(o=t.entry,s=i,c=t.marketplaceInstallLocation)}else{let e=await r();for(let[t,r]of Object.entries(e))try{let e=(await a(t)).plugins.find(e=>e.name===n);if(e){o=e,s=t,c=r.installLocation;break}}catch(e){V(P(e))}}if(!o||!s)return{success:!1,message:`Plugin "${n}" not found in ${i?`marketplace "${i}"`:`any configured marketplace`}`};let l=o,f=`${l.name}@${s}`,p=await ae({pluginId:f,entry:l,scope:t,marketplaceInstallLocation:c});if(!p.ok){let e=p;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:x(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: ${f} (scope: ${t})${p.depNote}`,pluginId:f,pluginName:l.name,scope:t}}async function ge(e,r=`user`,a=!0){q(r);let{enabled:o,disabled:c}=await b(),l=[...o,...c],u=pe(e,l),d=f(r),p=L(d),m,h;if(u)m=Object.keys(p?.enabledPlugins??{}).find(t=>t===e||t===u.name||t.startsWith(`${u.name}@`))??(e.includes(`@`)?e:u.name),h=u.name;else{let t=me(e);if(!t)return{success:!1,message:`Plugin "${e}" not found in installed plugins`};m=t.pluginId,h=t.pluginName}let g=J(r),_=t().plugins[m],v=_?.find(e=>e.scope===r&&e.projectPath===g);if(!v){let{scope:t}=Y(m);return t!==r&&_&&_.length>0?t===`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 ${t} scope, not ${r}. Use --scope ${t} to uninstall.`}:{success:!1,message:`Plugin "${e}" is not installed in ${r} scope. Use --scope to specify the correct scope.`}}let y=v.installPath,x={...p?.enabledPlugins};x[m]=void 0,z(d,{enabledPlugins:x}),O(),S(m,r,g);let C=t().plugins[m],w=!C||C.length===0;w&&y&&await T(y),w&&(A(m),a&&await n(m));let E=i(m,l),D=s(E);return{success:!0,message:`Successfully uninstalled plugin: ${h} (scope: ${r})${D}`,pluginId:m,pluginName:h,scope:r,reverseDependents:E.length>0?E:void 0}}async function X(e,t,n){let r=t?`enable`:`disable`;if(D(e)){let{error:n}=z(`userSettings`,{enabledPlugins:{...L(`userSettings`)?.enabledPlugins,[e]:t}});if(n)return{success:!1,message:`Failed to ${r} built-in plugin: ${n.message}`};O();let{name:i}=d(e);return{success:!0,message:`Successfully ${r}d built-in plugin: ${i}`,pluginId:e,pluginName:i,scope:`user`}}n&&q(n);let a,o,c=fe(e);if(n)if(o=n,c)a=c.pluginId;else if(e.includes(`@`))a=e;else return{success:!1,message:`Plugin "${e}" not found in settings. Use plugin@marketplace format.`};else if(c)a=c.pluginId,o=c.scope;else if(e.includes(`@`))a=e,o=`user`;else return{success:!1,message:`Plugin "${e}" not found in any editable settings scope. Use plugin@marketplace format.`};if(t&&re(a))return{success:!1,message:`Plugin "${a}" is blocked by your organization's policy and cannot be enabled`};let l=f(o),u=L(l)?.enabledPlugins?.[a],p={user:0,project:1,local:2},m=n&&c&&p[n]>p[c.scope];if(n&&u===void 0&&c&&c.scope!==n&&!m)return{success:!1,message:`Plugin "${e}" is installed at ${c.scope} scope, not ${n}. Use --scope ${c.scope} or omit --scope to auto-detect.`};if(t===(n&&!m?u===!0:G().has(a)))return{success:!1,message:`Plugin "${e}" is already ${t?`enabled`:`disabled`}${n?` at ${n} scope`:``}`};let h;if(!t){let{enabled:e,disabled:t}=await b(),n=i(a,[...e,...t]);n.length>0&&(h=n)}let{error:g}=z(l,{enabledPlugins:{...L(l)?.enabledPlugins,[a]:t}});if(g)return{success:!1,message:`Failed to ${r} plugin: ${g.message}`};O();let{name:_}=d(a),v=s(h);return{success:!0,message:`Successfully ${r}d plugin: ${_} (scope: ${o})${v}`,pluginId:a,pluginName:_,scope:o,reverseDependents:h}}async function _e(e,t){return X(e,!0,t)}async function ve(e,t){return X(e,!1,t)}async function Z(){let e=G();if(e.size===0)return{success:!0,message:`No enabled plugins to disable`};let t=[],n=[];for(let[r]of e){let e=await X(r,!1);e.success?t.push(r):n.push(`${r}: ${e.message}`)}return n.length>0?{success:!1,message:`Disabled ${t.length} ${H(t.length,`plugin`)}, ${n.length} failed:\n${n.join(`
|
|
2
|
+
`)}`}:{success:!0,message:`Disabled ${t.length} ${H(t.length,`plugin`)}`}}async function ye(e,t){let{name:n,marketplace:r}=d(e),i=r?`${n}@${r}`:e,a=await u(e);if(!a)return{success:!1,message:`Plugin "${n}" not found`,pluginId:i,scope:t};let{entry:o,marketplaceInstallLocation:s}=a,c=C().plugins[i];if(!c||c.length===0)return{success:!1,message:`Plugin "${n}" is not installed`,pluginId:i,scope:t};let l=J(t),f=c.find(e=>e.scope===t&&e.projectPath===l);return f?be({pluginId:i,pluginName:n,entry:o,marketplaceInstallLocation:s,installation:f,scope:t,projectPath:l}):{success:!1,message:`Plugin "${n}" is not installed at scope ${l?`${t} (${l})`:t}`,pluginId:i,scope:t}}async function be({pluginId:e,pluginName:t,entry:n,marketplaceInstallLocation:r,installation:i,scope:a,projectPath:o}){let s=I(),l=i.version,u,d,f=!1,p;if(typeof n.source!=`string`){let t=await ee(n.source,{manifest:{name:n.name}});u=t.path,f=!0,p=t.gitCommitSha,d=await h(e,n.source,t.manifest,t.path,n.version,t.gitCommitSha)}else{let t;try{t=await s.stat(r)}catch(t){if(N(t))return{success:!1,message:`Marketplace directory not found at ${r}`,pluginId:e,scope:a};throw t}u=K(t.isDirectory()?r:le(r),n.source);try{await s.stat(u)}catch(t){if(N(t))return{success:!1,message:`Plugin source not found at ${u}`,pluginId:e,scope:a};throw t}let i,o=K(u,`.claude-plugin`,`plugin.json`);try{i=await E(o,n.name,n.source)}catch{}d=await h(e,n.source,i,u,n.version)}try{let r=w(e,d),s=j(e,d);if(i.version===d||i.installPath===r||i.installPath===s)return{success:!0,message:`${t} is already at the latest version (${d}).`,pluginId:e,newVersion:d,oldVersion:l,alreadyUpToDate:!0,scope:a};r=await g(u,e,d,n);let f=i.installPath;if(c(e,a,o,r,d,p),f&&f!==r){let e=C();Object.values(e.plugins).some(e=>e.some(e=>e.installPath===f))||await T(f)}let m=o?`${a} (${o})`:a;return{success:!0,message:`Plugin "${t}" updated from ${l||`unknown`} to ${d} for scope ${m}. Restart to apply changes.`,pluginId:e,newVersion:d,oldVersion:l,scope:a}}finally{f&&u!==w(e,d)&&await s.rm(u,{recursive:!0,force:!0})}}var Q,$,xe=e((()=>{se(),k(),ce(),F(),B(),_(),te(),ne(),oe(),l(),o(),p(),v(),y(),m(),W(),ie(),R(),U(),Q=[`user`,`project`,`local`],$=[`user`,`project`,`local`,`managed`]}));export{_e as a,he as c,ge as d,ye as f,ve as i,ue as l,$ as n,Y as o,Z as r,xe as s,Q as t,de as u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{$w as t,Jw as n,Qw as r,_o as i,wo as a,zo as o}from"./loadAgentsDir-BXtV2jiO.js";import{n as s}from"./cwd-Besi3Os3.js";import{c,i as l}from"./debug-Dr1SjdXn.js";import{c as u,g as d,vt as f}from"./settings-DiBMs2gM.js";import{o as p}from"./log-27kCA_9u.js";import"path";function m(){let e=new Map,t=r();for(let[n,r]of Object.entries(t))n.includes(`@`)&&(r===!0?e.set(n,`flag`):r===!1&&e.delete(n));for(let{scope:n,source:r}of[{scope:`managed`,source:`policySettings`},{scope:`user`,source:`userSettings`},{scope:`project`,source:`projectSettings`},{scope:`local`,source:`localSettings`},{scope:`flag`,source:`flagSettings`}]){let i=u(r);if(i?.enabledPlugins)for(let[a,o]of Object.entries(i.enabledPlugins))a.includes(`@`)&&(a in t&&t[a]!==o&&c(`Plugin ${a} from --add-dir (${t[a]}) overridden by ${r} (${o})`),o===!0?e.set(a,n):o===!1&&e.delete(a))}return c(`Found ${e.size} enabled plugins with scopes: ${Array.from(e.entries()).map(([e,t])=>`${e}(${t})`).join(`, `)}`),e}var h=e((()=>{s(),l(),p(),d(),t(),a(),o(),n(),i(),f()}));export{h as n,m as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e,t}from"./pluginStartupCheck-BEd0VeQC.js";e();export{t as getPluginEditableScopes};
|