@readmagic/workmate 0.0.25 → 0.0.26
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-Y5S_lMjD.js → AddWorkspaceDirectory-mS8iUoWY.js} +1 -1
- package/dist/chunks/{AgentsMdExternalIncludesDialog-DVbU-BaD.js → AgentsMdExternalIncludesDialog-BHBkysy0.js} +1 -1
- package/dist/chunks/AgentsMdExternalIncludesDialog-DuStmCjj.js +1 -0
- package/dist/chunks/App-D--vtCyq.js +1 -0
- package/dist/chunks/BackgroundTasksDialog-mcDuiNGs.js +2 -0
- package/dist/chunks/{BypassPermissionsModeDialog-DjqGAL4C.js → BypassPermissionsModeDialog-DyqI98d2.js} +1 -1
- package/dist/chunks/CustomSelect-CpMbxYbt.js +1 -0
- package/dist/chunks/DiffDialog-BQAU2pJx.js +6 -0
- package/dist/chunks/Doctor-BU69VQzw.js +1 -0
- package/dist/chunks/Doctor-DJOMbSDE.js +3 -0
- package/dist/chunks/{ExitFlow-Dh9QdaYK.js → ExitFlow-xBOnvhiW.js} +2 -2
- package/dist/chunks/{InvalidConfigDialog-C9boykQn.js → InvalidConfigDialog-NiuhcaG5.js} +1 -1
- package/dist/chunks/{InvalidSettingsDialog-UN5mleCK.js → InvalidSettingsDialog-DrromC1I.js} +1 -1
- package/dist/chunks/KeybindingProviderSetup-CSUkJHTT.js +1 -0
- package/dist/chunks/MCPConnectionManager-Bn1PDn3R.js +1 -0
- package/dist/chunks/MCPToolListView-BRxjOaOL.js +1 -0
- package/dist/chunks/{McpParsingWarnings-zkM_lGd0.js → McpParsingWarnings-BYG2yqjO.js} +1 -1
- package/dist/chunks/MessageSelector-B7xAQqZI.js +3 -0
- package/dist/chunks/Messages-CxMsfjOa.js +10 -0
- package/dist/chunks/{Onboarding-BT90cFkn.js → Onboarding-CkATe87e.js} +1 -1
- package/dist/chunks/{PermissionDialog-BaibiQae.js → PermissionDialog-tEMMa5-a.js} +1 -1
- package/dist/chunks/{PressEnterToContinue-DZc_s_pE.js → PressEnterToContinue-CPOaYnym.js} +1 -1
- package/dist/chunks/{PromptInputFooterSuggestions-CCTZYbWI.js → PromptInputFooterSuggestions-CwqAsTI2.js} +1 -1
- package/dist/chunks/PromptInputHelpMenu-krq-hiFO.js +1 -0
- package/dist/chunks/{ProviderSetup-yIj8YOKF.js → ProviderSetup-J6Ty-Wj8.js} +1 -1
- package/dist/chunks/QueryEngine-Mdi_kUaL.js +1 -0
- package/dist/chunks/REPL-BgzQtSFF.js +1 -0
- package/dist/chunks/REPL-rirm6s_7.js +124 -0
- package/dist/chunks/ResumeConversation-Cmsbo5m7.js +1 -0
- package/dist/chunks/{SearchBox-C9xxQzh1.js → SearchBox-DQBLKyzJ.js} +1 -1
- package/dist/chunks/SearchExtraToolsTool-D1-7C04z.js +1 -0
- package/dist/chunks/{SelectMulti-BW7Ffk1G.js → SelectMulti-BpAjjhsn.js} +1 -1
- package/dist/chunks/Settings-B6DImvca.js +2 -0
- package/dist/chunks/Spinner-DhhSOFcN.js +1 -0
- package/dist/chunks/{SpinnerGlyph-CqrOK3Mx.js → SpinnerGlyph-CmVXC-_9.js} +1 -1
- package/dist/chunks/{TextInput-Cev5Awdd.js → TextInput-BboKIug2.js} +11 -11
- package/dist/chunks/ThemePicker-DTpXbEY0.js +1 -0
- package/dist/chunks/{TrustDialog-8Sjmuu0e.js → TrustDialog-CZ8JpySm.js} +1 -1
- package/dist/chunks/{ValidationErrorsList-INwwoerV.js → ValidationErrorsList-C_gDQfm1.js} +1 -1
- package/dist/chunks/{_baseEach-DrPH_FGo.js → _baseEach-DGbaIpJA.js} +1 -1
- package/dist/chunks/_baseSlice-D67_NpZ1.js +1 -0
- package/dist/chunks/{add-dir-D3RMaYxy.js → add-dir-B576wzi9.js} +1 -1
- package/dist/chunks/{agentDisplay-B3npXoCS.js → agentDisplay-ZuFoBZYu.js} +1 -1
- package/dist/chunks/{agents-2mPGmeq6.js → agents-Dy4_hDic.js} +1 -1
- package/dist/chunks/agents-HIOBiw4w.js +101 -0
- package/dist/chunks/allErrors-CxPNR2WN.js +1 -0
- package/dist/chunks/appleTerminalBackup-C9kjzdM9.js +1 -0
- package/dist/chunks/{backgroundHousekeeping-BkFxfjOf.js → backgroundHousekeeping-PyLNnGdw.js} +1 -1
- package/dist/chunks/backgroundHousekeeping-ZCMPmQuU.js +1 -0
- package/dist/chunks/{banner-DHpTmEO7.js → banner-DqFectPg.js} +2 -2
- package/dist/chunks/{branch-Be_yDFU8.js → branch-B_BL5N9N.js} +2 -2
- package/dist/chunks/{break-cache-UUt6Dkf2.js → break-cache-DL95nKZl.js} +2 -2
- package/dist/chunks/{btw-DUml5L1w.js → btw-Y44ctueB.js} +1 -1
- package/dist/chunks/bundledMode-BxyD5cqq.js +1 -0
- package/dist/chunks/caches-5xZ4dSXt.js +1 -0
- package/dist/chunks/caches-Be9saXxV.js +1 -0
- package/dist/chunks/{claudeDesktop-mBGFDbI6.js → claudeDesktop-g8eUUY2E.js} +1 -1
- package/dist/chunks/{clear-CrGjNe6E.js → clear-DtTkA707.js} +1 -1
- package/dist/chunks/{client-BDuhbzLD.js → client-Bw_L3lSc.js} +1 -1
- package/dist/chunks/{client-BYFVVMcf.js → client-aJ2Nr_sh.js} +1 -1
- package/dist/chunks/client-mnUISv_N.js +1 -0
- package/dist/chunks/client-wPqIdEVm.js +1 -0
- package/dist/chunks/commands-wfE12a4L.js +1 -0
- package/dist/chunks/compact-CvNOtu7J.js +2 -0
- package/dist/chunks/config-D3K87Mm1.js +3 -0
- package/dist/chunks/config-DTga6Ku8.js +1 -0
- package/dist/chunks/config-DtmqWusU.js +1 -0
- package/dist/chunks/{context-mV5zjqmc.js → context-Opu4E8dL.js} +1 -1
- package/dist/chunks/{context-noninteractive-DvfVvmSE.js → context-noninteractive-B1V2Mp26.js} +5 -5
- package/dist/chunks/context-noninteractive-eIlneYiL.js +1 -0
- package/dist/chunks/conversation-CG_z7TLE.js +1 -0
- package/dist/chunks/conversation-CHesBfFZ.js +1 -0
- package/dist/chunks/conversationRecovery-OhitW-7g.js +1 -0
- package/dist/chunks/crossProjectResume-mmYx8PrZ.js +40 -0
- package/dist/chunks/cwd-BH2f3u0o.js +1 -0
- package/dist/chunks/{cwd-BvNt_018.js → cwd-DrEEb4f5.js} +1 -1
- package/dist/chunks/{debug-CRnGsZOV.js → debug-kBjDaVkQ.js} +3 -3
- package/dist/chunks/{detectRepository-CsJLbVEe.js → detectRepository-M6K2wc7h.js} +1 -1
- package/dist/chunks/{diff-DUEoNCnJ.js → diff-Cv7tX2-P.js} +1 -1
- package/dist/chunks/{directoryCompletion-Bgi8DBT5.js → directoryCompletion-BHyjyKAM.js} +1 -1
- package/dist/chunks/doctor-DeBG5SL5.js +1 -0
- package/dist/chunks/{entry-D1iD76SW.js → entry-CbhyIWgj.js} +5 -5
- package/dist/chunks/envUtils-DZ_SvEVz.js +1 -0
- package/dist/chunks/execFileNoThrow-BfZFnCGa.js +1 -0
- package/dist/chunks/execa-CBhG1doD.js +34 -0
- package/dist/chunks/exit-OKEV_ddw.js +1 -0
- package/dist/chunks/{extraUsage-BtHE-SBX.js → extraUsage-BlRL3yeb.js} +1 -1
- package/dist/chunks/extractMemories-jnsv-_n_.js +1 -0
- package/dist/chunks/fast-4I_qPJCd.js +1 -0
- package/dist/chunks/fast-DiolM1M7.js +1 -0
- package/dist/chunks/{fetchModelList-Cjow_QGy.js → fetchModelList-BRFTQim4.js} +1 -1
- package/dist/chunks/fetchModelList-qPKAuu4m.js +1 -0
- package/dist/chunks/{fileSuggestions-C96V9-Ne.js → fileSuggestions-iWVXvvLB.js} +3 -3
- package/dist/chunks/{fpsMetrics-wxj9GAsd.js → fpsMetrics-Ixd0J4CH.js} +1 -1
- package/dist/chunks/{gemini-4YGElN3H.js → gemini-BfVyavwQ.js} +2 -2
- package/dist/chunks/{generateSessionName-BHIKyXpz.js → generateSessionName-CGaTTXCA.js} +1 -1
- package/dist/chunks/genericProcessUtils-CVtQOTO2.js +12 -0
- package/dist/chunks/{goal-ePK_jLo3.js → goal-BidR-GFa.js} +1 -1
- package/dist/chunks/grok-DLcuI-U7.js +1 -0
- package/dist/chunks/{help-B7xRle-V.js → help-CZuvYhXj.js} +1 -1
- package/dist/chunks/history-BxPGftQw.js +1 -0
- package/dist/chunks/hooks-Bg9WIjZQ.js +1 -0
- package/dist/chunks/{hooks-BN5f58HY.js → hooks-ehqfAM5F.js} +2 -2
- package/dist/chunks/install-ACGY0vhM.js +1 -0
- package/dist/chunks/{instrumentation-Oj5xagJG.js → instrumentation-B9bfF2mA.js} +5 -5
- package/dist/chunks/{job-D9ypO0cd.js → job-Coztdn6A.js} +1 -1
- package/dist/chunks/keybindings-DwSdLpaE.js +1 -0
- package/dist/chunks/{launchLocalMemory-DliLezJw.js → launchLocalMemory-DRzfpIOB.js} +1 -1
- package/dist/chunks/{launchOnboarding-A-kk-7ID.js → launchOnboarding-D2zFCJf-.js} +1 -1
- package/dist/chunks/{loadAgentsDir-DGozQu_6.js → loadAgentsDir-DR5PVAc3.js} +557 -561
- package/dist/chunks/loadAgentsDir-DqAbnpB-.js +1 -0
- package/dist/chunks/{loadPluginHooks-BiHPKDaY.js → loadPluginHooks-BiQgGfUJ.js} +1 -1
- package/dist/chunks/{loader-CtoR-vO-.js → loader-6MqzNGmV.js} +1 -1
- package/dist/chunks/{localSearch-BU02Qsv9.js → localSearch-CzkxDuOR.js} +1 -1
- package/dist/chunks/localSearch-DW3JT2MA.js +1 -0
- package/dist/chunks/lockfile-D_9vif6E.js +1 -0
- package/dist/chunks/{log-DoSpAwRP.js → log-DWZny1vM.js} +1 -1
- package/dist/chunks/{logoUtils-DLd6JKqW.js → logoUtils-DR5T0pr3.js} +1 -1
- package/dist/chunks/{magicDocs-Bj8LYrN2.js → magicDocs-BwBxjfLo.js} +2 -2
- package/dist/chunks/main-Ryi27wYq.js +345 -0
- package/dist/chunks/managedEnv-DCEJh3z3.js +1 -0
- package/dist/chunks/managedEnv-Do9fgLpk.js +1 -0
- package/dist/chunks/managedEnvConstants-CWcT7nYr.js +1 -0
- package/dist/chunks/mcp-BCpnF6wD.js +1 -0
- package/dist/chunks/mcp-CJ6SDJEK.js +6 -0
- package/dist/chunks/mcp-CZBTxbhu.js +2 -0
- package/dist/chunks/memory-BQO6Y0ak.js +1 -0
- package/dist/chunks/{modalContext-DDZdU1J8.js → modalContext-CBE8xuck.js} +1 -1
- package/dist/chunks/{mode-CBKawxnD.js → mode-wq70cR44.js} +1 -1
- package/dist/chunks/model-D42epddJ.js +1 -0
- package/dist/chunks/{model-DwbqvCY2.js → model-DVk9-2dk.js} +1 -1
- package/dist/chunks/{modelOptions-CXBfKFXA.js → modelOptions-beLgXORr.js} +1 -1
- package/dist/chunks/nativeInstaller-ChGSz1lb.js +1 -0
- package/dist/chunks/{notifications-ql0eSo0Y.js → notifications-dGBuNvFj.js} +1 -1
- package/dist/chunks/{onChangeAppState-D85b33R5.js → onChangeAppState-B4K-rSaF.js} +1 -1
- package/dist/chunks/openai-DAwnAV9K.js +2 -0
- package/dist/chunks/{overlayContext-CLjlCFBl.js → overlayContext-B6i_6y_0.js} +1 -1
- package/dist/chunks/{panel-DMZkOEiU.js → panel-C0CF3noE.js} +1 -1
- package/dist/chunks/parser-BZt0VFd_.js +1 -0
- package/dist/chunks/{parser-UqADrvxF.js → parser-DThLwgdM.js} +1 -1
- package/dist/chunks/{partition-CwxTlmMd.js → partition-BRQHofxD.js} +1 -1
- package/dist/chunks/{pasteStore-ovtxMVR5.js → pasteStore-BmehVo5j.js} +1 -1
- package/dist/chunks/{permissions-CgsvWOk_.js → permissions-DkfWKN-B.js} +3 -3
- package/dist/chunks/pidLock-YvAaIrIY.js +3 -0
- package/dist/chunks/plan-B6U3ioer.js +1 -0
- package/dist/chunks/{platform-DsMIk3eq.js → platform-Vl9IynC3.js} +1 -1
- package/dist/chunks/plugin-CTA2_-F7.js +17 -0
- package/dist/chunks/{pluginAutoupdate-DQqYDPVg.js → pluginAutoupdate-Dy5W3HWE.js} +1 -1
- package/dist/chunks/{pluginBlocklist-BAr9WTup.js → pluginBlocklist-DAoUENwc.js} +1 -1
- package/dist/chunks/pluginCliCommands-CaHnj0C_.js +1 -0
- package/dist/chunks/{pluginFlagging-BO_3qjfs.js → pluginFlagging-BCj9LJP3.js} +1 -1
- package/dist/chunks/pluginOperations-ClXNOOG6.js +2 -0
- package/dist/chunks/pluginStartupCheck-CiwMKGjx.js +1 -0
- package/dist/chunks/{pluginStartupCheck-BX6cv-vs.js → pluginStartupCheck-U8_xk25t.js} +1 -1
- package/dist/chunks/{plugins-9crasx2V.js → plugins-D7zyI9c4.js} +4 -4
- package/dist/chunks/{poller-CpLBoB-N.js → poller-BeyVwHAf.js} +1 -1
- package/dist/chunks/poorMode-DtzWNhsY.js +1 -0
- package/dist/chunks/poorMode-Ocff_UT1.js +1 -0
- package/dist/chunks/print-BzljdXem.js +13 -0
- package/dist/chunks/processBashCommand-RUkmyAl4.js +1 -0
- package/dist/chunks/processSlashCommand-DRLO-jNV.js +5 -0
- package/dist/chunks/{projectContext-5fmRr6Sd.js → projectContext-COeHKDrk.js} +1 -1
- package/dist/chunks/{projectContext-DhtjLv3k.js → projectContext-QN5U3Ggr.js} +1 -1
- package/dist/chunks/{projectOnboardingState--L3BKjOE.js → projectOnboardingState-KqcpRXls.js} +1 -1
- package/dist/chunks/{prompt-DzO1um1h.js → prompt-CTByhpUI.js} +20 -20
- package/dist/chunks/prompt-DTpfW6yP.js +1 -0
- package/dist/chunks/prompt-D__eHY_5.js +1 -0
- package/dist/chunks/promptEditor-CpUFgGzc.js +4 -0
- package/dist/chunks/{protocolHandler-BWgH1jaF.js → protocolHandler-BQSLVGnG.js} +2 -2
- package/dist/chunks/{proxy-BjkGlmBu.js → proxy-BtWuysHM.js} +2 -2
- package/dist/chunks/{reconciler-CVMmAaCy.js → reconciler-D6BUq8WB.js} +1 -1
- package/dist/chunks/refresh-B4pqFp12.js +1 -0
- package/dist/chunks/reject-C6IvUvBt.js +1 -0
- package/dist/chunks/{reload-plugins-DeyJTx4s.js → reload-plugins-DXQqk7q6.js} +1 -1
- package/dist/chunks/rename-D4XBmTBI.js +1 -0
- package/dist/chunks/{renderOptions-DRS2EslG.js → renderOptions-DkP98P_d.js} +1 -1
- package/dist/chunks/{resume-N4O5YI-S.js → resume-DzIev0JI.js} +2 -2
- package/dist/chunks/ripgrep-CYP26Fhg.js +1 -0
- package/dist/chunks/ripgrep-D1f1pbCz.js +5 -0
- package/dist/chunks/{runtimeObserver-DMSzdFWt.js → runtimeObserver-BPqlbu0B.js} +4 -4
- package/dist/chunks/{runtimeObserver-C0CJvA3q.js → runtimeObserver-BUHs3qjs.js} +1 -1
- package/dist/chunks/sandbox-adapter-CumL75tU.js +1 -0
- package/dist/chunks/{sandbox-toggle-Tbbaw18C.js → sandbox-toggle-CTtET6Xq.js} +1 -1
- package/dist/chunks/searchExtraTools-BMCU2zEf.js +1 -0
- package/dist/chunks/{select-Fq6g2Ejk.js → select-FrwoTzuc.js} +1 -1
- package/dist/chunks/sessionFileAccessHooks-WO8WTdT9.js +1 -0
- package/dist/chunks/{sessionObserver-CRie77tp.js → sessionObserver-B6xzxckA.js} +2 -2
- package/dist/chunks/sessionObserver-CBrM4opL.js +1 -0
- package/dist/chunks/sessionStorage-C1EAxDWG.js +1 -0
- package/dist/chunks/sessionTracing-UFK96PxT.js +11 -0
- package/dist/chunks/settings-BK6gCko-.js +1 -0
- package/dist/chunks/settings-YIDksG5Z.js +24 -0
- package/dist/chunks/setup-BBvZyrfz.js +3 -0
- package/dist/chunks/{shadowedRuleDetection-CTnYVrmP.js → shadowedRuleDetection-D6R2OeoH.js} +1 -1
- package/dist/chunks/{sideQuestion-Cl8m2qYx.js → sideQuestion-5jcbOMsR.js} +3 -3
- package/dist/chunks/{sinks-CiupmfTg.js → sinks-B-kFqjjd.js} +1 -1
- package/dist/chunks/sinks-DB_D4lmu.js +1 -0
- package/dist/chunks/skillChangeDetector-103-nEle.js +1 -0
- package/dist/chunks/{skillGapStore-es3K-aYe.js → skillGapStore-DOz1KCqo.js} +2 -2
- package/dist/chunks/{skillLifecycle-BcgoOQBk.js → skillLifecycle-D9NkIwFQ.js} +2 -2
- package/dist/chunks/{skillSearchPanel-CuDDb1L-.js → skillSearchPanel-DFiSZaJ4.js} +2 -2
- package/dist/chunks/skills-DgeLr52a.js +1 -0
- package/dist/chunks/sleep-BbWr_FL1.js +1 -0
- package/dist/chunks/{src-9vmGsuSI.js → src-Cy5_qH26.js} +1 -1
- package/dist/chunks/{src-DL3w8VPk.js → src-WZ94ZKI3.js} +4 -4
- package/dist/chunks/{startupProfiler-DF0AjiDf.js → startupProfiler-DIM_Ihyp.js} +2 -2
- package/dist/chunks/startupProfiler-FpGsKWYk.js +1 -0
- package/dist/chunks/{state-BQ4BEGin.js → state-CXY-q5gr.js} +1 -1
- package/dist/chunks/state-DXt6rahM.js +1 -0
- package/dist/chunks/{staticRender-BVWx0IM1.js → staticRender-RHUIg5ln.js} +1 -1
- package/dist/chunks/status-CKLecQZV.js +1 -0
- package/dist/chunks/{statusNoticeHelpers-BfmIub5L.js → statusNoticeHelpers-DI45AH-c.js} +1 -1
- package/dist/chunks/stringUtils-D_xPrwGQ.js +4 -0
- package/dist/chunks/switcher-D2Z2ZNQ0.js +1 -0
- package/dist/chunks/switcher-DhZCaAun.js +1 -0
- package/dist/chunks/{tasks-B6gYXxOx.js → tasks-6suPhqsK.js} +1 -1
- package/dist/chunks/{templateJobs-BW6TaqEC.js → templateJobs-BKVEWCsb.js} +1 -1
- package/dist/chunks/{terminalSetup-C-g9Xvj3.js → terminalSetup-7PUR4hfo.js} +1 -1
- package/dist/chunks/{terminalSetup-BgIXFBpd.js → terminalSetup-Cqy5_PhJ.js} +4 -4
- package/dist/chunks/{theme-9AZceq_m.js → theme-B-HG2PUs.js} +1 -1
- package/dist/chunks/tipRegistry-BR_lSGRw.js +2 -0
- package/dist/chunks/{toolEventObserver-DTuJcREC.js → toolEventObserver-BY3QVnr6.js} +1 -1
- package/dist/chunks/toolPool-BcwIF8Q_.js +1 -0
- package/dist/chunks/{types-97nL3naE.js → types-CD25a50S.js} +1 -1
- package/dist/chunks/udsClient-CCxgLiZy.js +1 -0
- package/dist/chunks/urlHandler-BNsQKqba.js +1 -0
- package/dist/chunks/{use-select-navigation-BStVRvcX.js → use-select-navigation-CW5alA9r.js} +1 -1
- package/dist/chunks/{useDoublePress-C9xxQzh1.js → useDoublePress-DQBLKyzJ.js} +1 -1
- package/dist/chunks/{useExitOnCtrlCDWithKeybindings-DWRFdFoU.js → useExitOnCtrlCDWithKeybindings-BgJrnuDl.js} +1 -1
- package/dist/chunks/useMainLoopModel-BVgJo4hN.js +1 -0
- package/dist/chunks/useManagePlugins-CrWjzESW.js +1 -0
- package/dist/chunks/useMergedTools-r6GQq5mI.js +1 -0
- package/dist/chunks/{useSearchInput-B_mY9wBq.js → useSearchInput-BITV_Txn.js} +1 -1
- package/dist/chunks/{useSettingsErrors-CM7tThcp.js → useSettingsErrors-CO0fTNzn.js} +1 -1
- package/dist/chunks/{util-Bb2S6g9N.js → util-_zo3I1y8.js} +1 -1
- package/dist/chunks/validatePlugin-DFGdRhA-.js +1 -0
- package/dist/chunks/{vim-Dpnhgoz_.js → vim-qgMS88ss.js} +1 -1
- package/dist/chunks/worktree-CR_M6Qfy.js +1 -0
- package/dist/cli.js +1 -1
- package/package.json +1 -1
- package/scripts/postinstall.cjs +16 -16
- package/dist/chunks/AgentsMdExternalIncludesDialog-Bnb1jWcg.js +0 -1
- package/dist/chunks/App-B8q8PV77.js +0 -1
- package/dist/chunks/BackgroundTasksDialog-i0TkZgQp.js +0 -2
- package/dist/chunks/CustomSelect-BvTftqEH.js +0 -1
- package/dist/chunks/DiffDialog-v5r8cBKW.js +0 -6
- package/dist/chunks/Doctor-DKpBnbuI.js +0 -1
- package/dist/chunks/Doctor-uvO6NM5m.js +0 -3
- package/dist/chunks/KeybindingProviderSetup-DsJqfEt-.js +0 -1
- package/dist/chunks/MCPConnectionManager-DkZVxLEj.js +0 -1
- package/dist/chunks/MCPToolListView-De1W4jpj.js +0 -1
- package/dist/chunks/MessageSelector-DW_itlX-.js +0 -3
- package/dist/chunks/Messages-BFsCpACq.js +0 -10
- package/dist/chunks/PromptInputHelpMenu-Bm5KY0Ma.js +0 -1
- package/dist/chunks/QueryEngine-egz5mbaW.js +0 -1
- package/dist/chunks/REPL-D27CE4WN.js +0 -124
- package/dist/chunks/REPL-e8wAT1wN.js +0 -1
- package/dist/chunks/ResumeConversation-CWA27Lke.js +0 -1
- package/dist/chunks/SearchExtraToolsTool-BRchtZ9Q.js +0 -1
- package/dist/chunks/Settings-axHLvYIy.js +0 -3
- package/dist/chunks/Spinner-VjwI7m_g.js +0 -1
- package/dist/chunks/ThemePicker-CtQYHmOr.js +0 -1
- package/dist/chunks/agents-DEnmg8Xo.js +0 -101
- package/dist/chunks/allErrors-C9kx6lnk.js +0 -1
- package/dist/chunks/appleTerminalBackup-CT7g8yOs.js +0 -1
- package/dist/chunks/backgroundHousekeeping-CvWfd99M.js +0 -1
- package/dist/chunks/caches-DWjwe-DN.js +0 -1
- package/dist/chunks/caches-VLs1tQkZ.js +0 -1
- package/dist/chunks/client-CO_6v4yl.js +0 -1
- package/dist/chunks/client-DO-O441l.js +0 -1
- package/dist/chunks/commands-Cn1P7Tms.js +0 -1
- package/dist/chunks/compact-DGUhdXcc.js +0 -2
- package/dist/chunks/config-C7GTF4iI.js +0 -1
- package/dist/chunks/config-CWPHVTic.js +0 -3
- package/dist/chunks/config-Cox0TM2Z.js +0 -1
- package/dist/chunks/context-noninteractive--OuiZUzL.js +0 -1
- package/dist/chunks/conversation--y8PD2Lk.js +0 -1
- package/dist/chunks/conversation-BIPJEOwO.js +0 -1
- package/dist/chunks/conversationRecovery-BBJzrA0g.js +0 -1
- package/dist/chunks/crossProjectResume-CwZb3cEU.js +0 -40
- package/dist/chunks/cwd-BZMp3CZ8.js +0 -1
- package/dist/chunks/doctor-4NiE46ZG.js +0 -1
- package/dist/chunks/envUtils-DfkgIdYf.js +0 -1
- package/dist/chunks/execFileNoThrow-BgRsj_SW.js +0 -34
- package/dist/chunks/exit-CrsQsjbx.js +0 -1
- package/dist/chunks/extractMemories-kogJzpit.js +0 -1
- package/dist/chunks/fast-CuNVwVTr.js +0 -1
- package/dist/chunks/fast-RlFnwGRV.js +0 -1
- package/dist/chunks/fetchModelList-uiCPVqbJ.js +0 -1
- package/dist/chunks/genericProcessUtils-BNlr-QxM.js +0 -23
- package/dist/chunks/grok-DnmklTrm.js +0 -1
- package/dist/chunks/history-kOw3CcLT.js +0 -1
- package/dist/chunks/hooks-BDY1jMbS.js +0 -1
- package/dist/chunks/install-DrMiHa2Q.js +0 -1
- package/dist/chunks/keybindings-BRRN_eap.js +0 -1
- package/dist/chunks/loadAgentsDir-CJAK4kif.js +0 -1
- package/dist/chunks/localSearch-DyaB2Rm-.js +0 -1
- package/dist/chunks/main-B_09WbaG.js +0 -345
- package/dist/chunks/managedEnv-BJGfe3m7.js +0 -1
- package/dist/chunks/managedEnv-CIWJsuty.js +0 -1
- package/dist/chunks/managedEnvConstants-BPwL2aWI.js +0 -1
- package/dist/chunks/mcp-1nBvcNxw.js +0 -1
- package/dist/chunks/mcp-7DXpXMdT.js +0 -2
- package/dist/chunks/mcp-kw99WVi2.js +0 -6
- package/dist/chunks/memory-CjWvzR_9.js +0 -1
- package/dist/chunks/model-DpZaKZMb.js +0 -1
- package/dist/chunks/nativeInstaller-SmPeEisk.js +0 -1
- package/dist/chunks/openai-D_j7-KW6.js +0 -2
- package/dist/chunks/parser-2usBI4G-.js +0 -1
- package/dist/chunks/pidLock-B-SW3Nhx.js +0 -3
- package/dist/chunks/plan-BJrWtXEh.js +0 -1
- package/dist/chunks/plugin-D97VJAxW.js +0 -17
- package/dist/chunks/pluginCliCommands-CUGPc853.js +0 -1
- package/dist/chunks/pluginOperations-rTrzu6Vg.js +0 -2
- package/dist/chunks/pluginStartupCheck-BRHnXlym.js +0 -1
- package/dist/chunks/poorMode-BaS0DBUO.js +0 -1
- package/dist/chunks/poorMode-DmvzFAz_.js +0 -1
- package/dist/chunks/print-Bi3xVdB3.js +0 -13
- package/dist/chunks/processBashCommand-BBtnCx-7.js +0 -1
- package/dist/chunks/processSlashCommand-jzF0GmLO.js +0 -5
- package/dist/chunks/prompt-CmijKW7G.js +0 -1
- package/dist/chunks/prompt-DYBx_D0H.js +0 -1
- package/dist/chunks/promptEditor-B6S_Rzcu.js +0 -4
- package/dist/chunks/refresh-CAGv8BJY.js +0 -1
- package/dist/chunks/reject-CEUkoI2G.js +0 -1
- package/dist/chunks/rename-DPFis9g_.js +0 -1
- package/dist/chunks/ripgrep-3omwGI-l.js +0 -1
- package/dist/chunks/ripgrep-CgQrN3XX.js +0 -5
- package/dist/chunks/sandbox-adapter-D15jjHJR.js +0 -1
- package/dist/chunks/searchExtraTools-BoFc__Eg.js +0 -1
- package/dist/chunks/sessionFileAccessHooks-Rgsp4_Ex.js +0 -1
- package/dist/chunks/sessionObserver-PcaVCVkX.js +0 -1
- package/dist/chunks/sessionStorage-Dkf7FRgA.js +0 -1
- package/dist/chunks/sessionTracing-D7rekMdW.js +0 -11
- package/dist/chunks/settings-8fwIkMDV.js +0 -1
- package/dist/chunks/settings-CodSADx8.js +0 -24
- package/dist/chunks/setup-DBiIrXrh.js +0 -3
- package/dist/chunks/sinks-DH83d_kd.js +0 -1
- package/dist/chunks/skillChangeDetector-BrrZaFkT.js +0 -1
- package/dist/chunks/skills-BRtgqnLz.js +0 -1
- package/dist/chunks/startupProfiler-D1NRu2nj.js +0 -1
- package/dist/chunks/state-D3gvDiu8.js +0 -1
- package/dist/chunks/status-WXA16wIM.js +0 -1
- package/dist/chunks/stringUtils-Bu_lJH5c.js +0 -4
- package/dist/chunks/switcher-5gilU5_R.js +0 -1
- package/dist/chunks/switcher-DMfuKuw_.js +0 -1
- package/dist/chunks/tipRegistry-DtO1H_Wo.js +0 -2
- package/dist/chunks/toolPool-DHS8jWaL.js +0 -1
- package/dist/chunks/udsClient-CmYHFiBD.js +0 -1
- package/dist/chunks/urlHandler-DLz3FZm1.js +0 -1
- package/dist/chunks/useMainLoopModel-DSN5HjV1.js +0 -1
- package/dist/chunks/useManagePlugins-ntnOf5OU.js +0 -1
- package/dist/chunks/useMergedTools-C5Yns9Ij.js +0 -1
- package/dist/chunks/validatePlugin-D8WQ5z4W.js +0 -1
- package/dist/chunks/worktree-a5oOPSYl.js +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e,t}from"./managedEnv-CIWJsuty.js";e();export{t as applyConfigEnvironmentVariables};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{l as t,o as n}from"./envUtils-DfkgIdYf.js";import{d as r,h as i,ln as a,s as o,un as s}from"./settings-CodSADx8.js";import{d as c,o as l}from"./config-CWPHVTic.js";import{_ as u,c as d,h as f,m as p,n as m,t as h,u as g}from"./proxy-BjkGlmBu.js";import{n as _,t as v}from"./loader-CtoR-vO-.js";import{n as y,r as b,t as x}from"./managedEnvConstants-BPwL2aWI.js";function S(e){if(!e||!process.env.ANTHROPIC_UNIX_SOCKET)return e||{};let{ANTHROPIC_UNIX_SOCKET:t,ANTHROPIC_BASE_URL:n,ANTHROPIC_API_KEY:r,ANTHROPIC_AUTH_TOKEN:i,CLAUDE_CODE_OAUTH_TOKEN:a,...o}=e;return o}function C(e){if(!e)return{};if(!t(process.env.CLAUDE_CODE_PROVIDER_MANAGED_BY_HOST))return e;let n={};for(let[t,r]of Object.entries(e))b(t)||(n[t]=r);return n}function w(e){if(!e||!k)return e||{};let t={};for(let[n,r]of Object.entries(e))k.has(n)||(t[n]=r);return t}function T(e){if(!e)return{};let t=o(`userSettings`)?.activeProviderId;if(!t||!v(t))return e;let n={};for(let[t,r]of Object.entries(e))A.has(t.toUpperCase())||(n[t]=r);return n}function E(e){return w(C(T(S(e))))}function D(){k===void 0&&(k=process.env.CLAUDE_CODE_ENTRYPOINT===`claude-desktop`?new Set(Object.keys(process.env)):null),Object.assign(process.env,E(l().env));for(let e of j)e!==`policySettings`&&s(e)&&Object.assign(process.env,E(o(e)?.env));Object.assign(process.env,E(o(`policySettings`)?.env));let e=E(r()?.env);for(let[t,n]of Object.entries(e))x.has(t.toUpperCase())&&(process.env[t]=n)}function O(){Object.assign(process.env,E(l().env)),Object.assign(process.env,E(r()?.env)),f(),g(),h(),m()}var k,A,j,M=e((()=>{_(),u(),c(),n(),y(),p(),d(),a(),i(),A=new Set([`ANTHROPIC_BASE_URL`,`ANTHROPIC_API_KEY`,`ANTHROPIC_MODEL`,`CLAUDE_CODE_USE_OPENAI`,`OPENAI_BASE_URL`,`OPENAI_API_KEY`,`OPENAI_MODEL`]),j=[`userSettings`,`flagSettings`,`policySettings`]}));export{D as n,M as r,O as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";function t(e){let t=e.toUpperCase();return n.has(t)||r.some(e=>t.startsWith(e))}var n,r,i,a=e((()=>{n=new Set(`CLAUDE_CODE_PROVIDER_MANAGED_BY_HOST.CLAUDE_CODE_USE_BEDROCK.CLAUDE_CODE_USE_VERTEX.CLAUDE_CODE_USE_FOUNDRY.CLAUDE_CODE_USE_GEMINI.ANTHROPIC_BASE_URL.ANTHROPIC_BEDROCK_BASE_URL.ANTHROPIC_VERTEX_BASE_URL.ANTHROPIC_FOUNDRY_BASE_URL.ANTHROPIC_FOUNDRY_RESOURCE.ANTHROPIC_VERTEX_PROJECT_ID.GEMINI_BASE_URL.CLOUD_ML_REGION.ANTHROPIC_API_KEY.ANTHROPIC_AUTH_TOKEN.CLAUDE_CODE_OAUTH_TOKEN.AWS_BEARER_TOKEN_BEDROCK.ANTHROPIC_FOUNDRY_API_KEY.CLAUDE_CODE_SKIP_BEDROCK_AUTH.CLAUDE_CODE_SKIP_VERTEX_AUTH.CLAUDE_CODE_SKIP_FOUNDRY_AUTH.GEMINI_API_KEY.ANTHROPIC_MODEL.ANTHROPIC_DEFAULT_HAIKU_MODEL.ANTHROPIC_DEFAULT_HAIKU_MODEL_DESCRIPTION.ANTHROPIC_DEFAULT_HAIKU_MODEL_NAME.ANTHROPIC_DEFAULT_HAIKU_MODEL_SUPPORTED_CAPABILITIES.ANTHROPIC_DEFAULT_OPUS_MODEL.ANTHROPIC_DEFAULT_OPUS_MODEL_DESCRIPTION.ANTHROPIC_DEFAULT_OPUS_MODEL_NAME.ANTHROPIC_DEFAULT_OPUS_MODEL_SUPPORTED_CAPABILITIES.ANTHROPIC_DEFAULT_SONNET_MODEL.ANTHROPIC_DEFAULT_SONNET_MODEL_DESCRIPTION.ANTHROPIC_DEFAULT_SONNET_MODEL_NAME.ANTHROPIC_DEFAULT_SONNET_MODEL_SUPPORTED_CAPABILITIES.OPENAI_AUTH_MODE.OPENAI_API_KEY.OPENAI_BASE_URL.OPENAI_MODEL.OPENAI_DEFAULT_HAIKU_MODEL.OPENAI_DEFAULT_HAIKU_MODEL_DESCRIPTION.OPENAI_DEFAULT_HAIKU_MODEL_NAME.OPENAI_DEFAULT_HAIKU_MODEL_SUPPORTED_CAPABILITIES.OPENAI_DEFAULT_OPUS_MODEL.OPENAI_DEFAULT_OPUS_MODEL_DESCRIPTION.OPENAI_DEFAULT_OPUS_MODEL_NAME.OPENAI_DEFAULT_OPUS_MODEL_SUPPORTED_CAPABILITIES.OPENAI_DEFAULT_SONNET_MODEL.OPENAI_DEFAULT_SONNET_MODEL_DESCRIPTION.OPENAI_DEFAULT_SONNET_MODEL_NAME.OPENAI_DEFAULT_SONNET_MODEL_SUPPORTED_CAPABILITIES.OPENAI_SMALL_FAST_MODEL.ANTHROPIC_SMALL_FAST_MODEL.ANTHROPIC_SMALL_FAST_MODEL_AWS_REGION.CLAUDE_CODE_SUBAGENT_MODEL.GEMINI_MODEL.GEMINI_SMALL_FAST_MODEL.GEMINI_DEFAULT_HAIKU_MODEL.GEMINI_DEFAULT_HAIKU_MODEL_DESCRIPTION.GEMINI_DEFAULT_HAIKU_MODEL_NAME.GEMINI_DEFAULT_HAIKU_MODEL_SUPPORTED_CAPABILITIES.GEMINI_DEFAULT_OPUS_MODEL.GEMINI_DEFAULT_OPUS_MODEL_DESCRIPTION.GEMINI_DEFAULT_OPUS_MODEL_NAME.GEMINI_DEFAULT_OPUS_MODEL_SUPPORTED_CAPABILITIES.GEMINI_DEFAULT_SONNET_MODEL.GEMINI_DEFAULT_SONNET_MODEL_DESCRIPTION.GEMINI_DEFAULT_SONNET_MODEL_NAME.GEMINI_DEFAULT_SONNET_MODEL_SUPPORTED_CAPABILITIES`.split(`.`)),r=[`VERTEX_REGION_CLAUDE_`],i=new Set(`ANTHROPIC_CUSTOM_HEADERS.ANTHROPIC_CUSTOM_MODEL_OPTION.ANTHROPIC_CUSTOM_MODEL_OPTION_DESCRIPTION.ANTHROPIC_CUSTOM_MODEL_OPTION_NAME.ANTHROPIC_DEFAULT_HAIKU_MODEL.ANTHROPIC_DEFAULT_HAIKU_MODEL_DESCRIPTION.ANTHROPIC_DEFAULT_HAIKU_MODEL_NAME.ANTHROPIC_DEFAULT_HAIKU_MODEL_SUPPORTED_CAPABILITIES.ANTHROPIC_DEFAULT_OPUS_MODEL.ANTHROPIC_DEFAULT_OPUS_MODEL_DESCRIPTION.ANTHROPIC_DEFAULT_OPUS_MODEL_NAME.ANTHROPIC_DEFAULT_OPUS_MODEL_SUPPORTED_CAPABILITIES.ANTHROPIC_DEFAULT_SONNET_MODEL.ANTHROPIC_DEFAULT_SONNET_MODEL_DESCRIPTION.ANTHROPIC_DEFAULT_SONNET_MODEL_NAME.ANTHROPIC_DEFAULT_SONNET_MODEL_SUPPORTED_CAPABILITIES.OPENAI_API_KEY.OPENAI_AUTH_MODE.OPENAI_BASE_URL.OPENAI_DEFAULT_HAIKU_MODEL.OPENAI_DEFAULT_HAIKU_MODEL_DESCRIPTION.OPENAI_DEFAULT_HAIKU_MODEL_NAME.OPENAI_DEFAULT_HAIKU_MODEL_SUPPORTED_CAPABILITIES.OPENAI_DEFAULT_OPUS_MODEL.OPENAI_DEFAULT_OPUS_MODEL_DESCRIPTION.OPENAI_DEFAULT_OPUS_MODEL_NAME.OPENAI_DEFAULT_OPUS_MODEL_SUPPORTED_CAPABILITIES.OPENAI_DEFAULT_SONNET_MODEL.OPENAI_DEFAULT_SONNET_MODEL_DESCRIPTION.OPENAI_DEFAULT_SONNET_MODEL_NAME.OPENAI_DEFAULT_SONNET_MODEL_SUPPORTED_CAPABILITIES.OPENAI_ENABLE_THINKING.OPENAI_MAX_TOKENS.OPENAI_MODEL.OPENAI_ORG_ID.OPENAI_PROJECT_ID.OPENAI_SMALL_FAST_MODEL.GROK_API_KEY.GROK_BASE_URL.GROK_DEFAULT_HAIKU_MODEL.GROK_DEFAULT_OPUS_MODEL.GROK_DEFAULT_SONNET_MODEL.GROK_MODEL.GROK_MODEL_MAP.XAI_API_KEY.ANTHROPIC_FOUNDRY_API_KEY.ANTHROPIC_MODEL.ANTHROPIC_SMALL_FAST_MODEL_AWS_REGION.ANTHROPIC_SMALL_FAST_MODEL.AWS_DEFAULT_REGION.AWS_PROFILE.AWS_REGION.BASH_DEFAULT_TIMEOUT_MS.BASH_MAX_OUTPUT_LENGTH.BASH_MAX_TIMEOUT_MS.CLAUDE_BASH_MAINTAIN_PROJECT_WORKING_DIR.CLAUDE_CODE_API_KEY_HELPER_TTL_MS.CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS.CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC.CLAUDE_CODE_DISABLE_TERMINAL_TITLE.CLAUDE_CODE_ENABLE_TELEMETRY.CLAUDE_CODE_IDE_SKIP_AUTO_INSTALL.CLAUDE_CODE_MAX_OUTPUT_TOKENS.CLAUDE_CODE_SKIP_BEDROCK_AUTH.CLAUDE_CODE_SKIP_FOUNDRY_AUTH.CLAUDE_CODE_SKIP_VERTEX_AUTH.CLAUDE_CODE_SUBAGENT_MODEL.CLAUDE_CODE_USE_BEDROCK.CLAUDE_CODE_USE_FOUNDRY.CLAUDE_CODE_USE_GEMINI.CLAUDE_CODE_USE_GROK.CLAUDE_CODE_USE_OPENAI.CLAUDE_CODE_USE_VERTEX.GEMINI_API_KEY.GEMINI_BASE_URL.GEMINI_MODEL.GEMINI_SMALL_FAST_MODEL.GEMINI_DEFAULT_HAIKU_MODEL.GEMINI_DEFAULT_HAIKU_MODEL_DESCRIPTION.GEMINI_DEFAULT_HAIKU_MODEL_NAME.GEMINI_DEFAULT_HAIKU_MODEL_SUPPORTED_CAPABILITIES.GEMINI_DEFAULT_OPUS_MODEL.GEMINI_DEFAULT_OPUS_MODEL_DESCRIPTION.GEMINI_DEFAULT_OPUS_MODEL_NAME.GEMINI_DEFAULT_OPUS_MODEL_SUPPORTED_CAPABILITIES.GEMINI_DEFAULT_SONNET_MODEL.GEMINI_DEFAULT_SONNET_MODEL_DESCRIPTION.GEMINI_DEFAULT_SONNET_MODEL_NAME.GEMINI_DEFAULT_SONNET_MODEL_SUPPORTED_CAPABILITIES.DISABLE_AUTOUPDATER.DISABLE_BUG_COMMAND.DISABLE_COST_WARNINGS.DISABLE_ERROR_REPORTING.DISABLE_FEEDBACK_COMMAND.DISABLE_TELEMETRY.ENABLE_SEARCH_EXTRA_TOOLS.MAX_MCP_OUTPUT_TOKENS.MAX_THINKING_TOKENS.MCP_TIMEOUT.MCP_TOOL_TIMEOUT.OTEL_EXPORTER_OTLP_HEADERS.OTEL_EXPORTER_OTLP_LOGS_HEADERS.OTEL_EXPORTER_OTLP_LOGS_PROTOCOL.OTEL_EXPORTER_OTLP_METRICS_CLIENT_CERTIFICATE.OTEL_EXPORTER_OTLP_METRICS_CLIENT_KEY.OTEL_EXPORTER_OTLP_METRICS_HEADERS.OTEL_EXPORTER_OTLP_METRICS_PROTOCOL.OTEL_EXPORTER_OTLP_PROTOCOL.OTEL_EXPORTER_OTLP_TRACES_HEADERS.OTEL_LOG_TOOL_DETAILS.OTEL_LOG_USER_PROMPTS.OTEL_LOGS_EXPORT_INTERVAL.OTEL_LOGS_EXPORTER.OTEL_METRIC_EXPORT_INTERVAL.OTEL_METRICS_EXPORTER.OTEL_METRICS_INCLUDE_ACCOUNT_UUID.OTEL_METRICS_INCLUDE_SESSION_ID.OTEL_METRICS_INCLUDE_VERSION.OTEL_RESOURCE_ATTRIBUTES.USE_BUILTIN_RIPGREP.VERTEX_REGION_CLAUDE_3_5_HAIKU.VERTEX_REGION_CLAUDE_3_5_SONNET.VERTEX_REGION_CLAUDE_3_7_SONNET.VERTEX_REGION_CLAUDE_4_0_OPUS.VERTEX_REGION_CLAUDE_4_0_SONNET.VERTEX_REGION_CLAUDE_4_1_OPUS.VERTEX_REGION_CLAUDE_4_5_SONNET.VERTEX_REGION_CLAUDE_4_6_SONNET.VERTEX_REGION_CLAUDE_HAIKU_4_5`.split(`.`))}));export{a as n,t as r,i as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{n,t as r}from"./figures-5ThXQEtq.js";import{D as i,Gt as a,H as o,I as s,Lt as c,P as l,T as u,ai as d,j as f,t as p,y as m}from"./src-DL3w8VPk.js";import{t as h}from"./jsx-runtime-Bb4Xn-E0.js";import{Bp as g,Cb as _,Cv as v,Vp as y,bv as b,dv as x,hd as S,md as C,vv as w,zp as T}from"./loadAgentsDir-DGozQu_6.js";import{a as ee,i as E}from"./debug-CRnGsZOV.js";import{l as te,n as D,o as O}from"./stringUtils-Bu_lJH5c.js";import{i as k,n as A,r as j}from"./MCPConnectionManager-DkZVxLEj.js";import{t as ne}from"./select-Fq6g2Ejk.js";import{r as re,t as ie}from"./Spinner-VjwI7m_g.js";import{t as ae}from"./CustomSelect-BvTftqEH.js";import{n as oe,t as M}from"./McpParsingWarnings-zkM_lGd0.js";import{a as N,c as P,i as F,n as I,o as L,r as R,s as se,t as ce}from"./MCPToolListView-De1W4jpj.js";function le({agentServer:e,onCancel:t}){let[n]=o();return(0,z.jsxs)(m,{title:`${D(String(e.name))} MCP Server`,subtitle:`agent-only`,onCancel:t,inputGuide:e=>e.pending?(0,z.jsxs)(l,{children:[`Press `,e.keyName,` again to exit`]}):(0,z.jsxs)(u,{children:[(0,z.jsx)(i,{shortcut:`↑↓`,action:`navigate`}),(0,z.jsx)(i,{shortcut:`Enter`,action:`confirm`}),(0,z.jsx)(C,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`})]}),children:[(0,z.jsxs)(s,{flexDirection:`column`,gap:0,children:[(0,z.jsxs)(s,{children:[(0,z.jsx)(l,{bold:!0,children:`Type: `}),(0,z.jsx)(l,{dimColor:!0,children:e.transport})]}),e.url&&(0,z.jsxs)(s,{children:[(0,z.jsx)(l,{bold:!0,children:`URL: `}),(0,z.jsx)(l,{dimColor:!0,children:e.url})]}),e.command&&(0,z.jsxs)(s,{children:[(0,z.jsx)(l,{bold:!0,children:`Command: `}),(0,z.jsx)(l,{dimColor:!0,children:e.command})]}),(0,z.jsxs)(s,{children:[(0,z.jsx)(l,{bold:!0,children:`Used by: `}),(0,z.jsx)(l,{dimColor:!0,children:e.sourceAgents.join(`, `)})]}),(0,z.jsxs)(s,{marginTop:1,children:[(0,z.jsx)(l,{bold:!0,children:`Status: `}),(0,z.jsxs)(l,{children:[f(`inactive`,n)(r.radioOff),` not connected (agent-only)`]})]})]}),(0,z.jsx)(s,{children:(0,z.jsx)(l,{dimColor:!0,children:`This server connects only when running the agent.`})}),(0,z.jsx)(s,{children:(0,z.jsx)(ne,{options:[{label:`Back`,value:`back`}],onChange:e=>{e===`back`&&t()},onCancel:t})})]})}var z,B=e((()=>{n(),p(),O(),S(),ae(),z=h()}));function V(e){switch(e){case`project`:return{label:`Project MCPs`,path:x(e)};case`user`:return{label:`User MCPs`,path:x(e)};case`local`:return{label:`Local MCPs`,path:x(e)};case`enterprise`:return{label:`Enterprise MCPs`};case`dynamic`:return{label:`Built-in MCPs`,path:`always available`};default:return{label:e}}}function ue(e){let t=new Map;for(let n of e){let e=n.scope;t.has(e)||t.set(e,[]),t.get(e).push(n)}for(let[,e]of t)e.sort((e,t)=>e.name.localeCompare(t.name));return t}function de({servers:e,agentServers:t=[],onSelectServer:n,onSelectAgentServer:d,onComplete:p}){let[h]=o(),[g,_]=(0,H.useState)(0),v=H.useMemo(()=>ue(e.filter(e=>e.client.config.type!==`claudeai-proxy`)),[e]),y=H.useMemo(()=>e.filter(e=>e.client.config.type===`claudeai-proxy`).sort((e,t)=>e.name.localeCompare(t.name)),[e]),b=H.useMemo(()=>(v.get(`dynamic`)??[]).sort((e,t)=>e.name.localeCompare(t.name)),[v]),x=V(`dynamic`),S=H.useMemo(()=>{let e=[];for(let t of W){let n=v.get(t)??[];for(let t of n)e.push({type:`server`,server:t})}for(let t of y)e.push({type:`server`,server:t});for(let n of t)e.push({type:`agent-server`,agentServer:n});for(let t of b)e.push({type:`server`,server:t});return e},[v,y,t,b]),w=(0,H.useCallback)(()=>{p(`MCP dialog dismissed`,{display:`system`})},[p]);a({"confirm:previous":()=>_(e=>e===0?S.length-1:e-1),"confirm:next":()=>_(e=>e===S.length-1?0:e+1),"confirm:yes":(0,H.useCallback)(()=>{let e=S[g];e&&(e.type===`server`?n(e.server):e.type===`agent-server`&&d&&d(e.agentServer))},[S,g,n,d]),"confirm:no":w},{context:`Confirmation`});let T=e=>S.findIndex(t=>t.type===`server`&&t.server===e),E=e=>S.findIndex(t=>t.type===`agent-server`&&t.agentServer===e),D=ee(),O=e.some(e=>e.client.type===`failed`);if(e.length===0&&t.length===0)return null;let k=e=>{let t=T(e),n=g===t,i=``,a=``;if(e.client.type===`disabled`)i=f(`inactive`,h)(r.radioOff),a=`disabled`;else if(e.client.type===`connected`)i=f(`success`,h)(r.tick),a=`connected`;else if(e.client.type===`pending`){i=f(`inactive`,h)(r.radioOff);let{reconnectAttempt:t,maxReconnectAttempts:n}=e.client;a=t&&n?`reconnecting (${t}/${n})…`:`connecting…`}else e.client.type===`needs-auth`?(i=f(`warning`,h)(r.triangleUpOutline),a=`needs authentication`):(i=f(`error`,h)(r.cross),a=`failed`);return(0,U.jsxs)(s,{children:[(0,U.jsx)(l,{color:n?`suggestion`:void 0,children:n?`${r.pointer} `:` `}),(0,U.jsx)(l,{color:n?`suggestion`:void 0,children:e.name}),(0,U.jsxs)(l,{dimColor:!n,children:[` · `,i,` `]}),(0,U.jsx)(l,{dimColor:!n,children:a})]},`${e.name}-${t}`)},A=e=>{let t=E(e),n=g===t,i=e.needsAuth?f(`warning`,h)(r.triangleUpOutline):f(`inactive`,h)(r.radioOff),a=e.needsAuth?`may need auth`:`agent-only`;return(0,U.jsxs)(s,{children:[(0,U.jsx)(l,{color:n?`suggestion`:void 0,children:n?`${r.pointer} `:` `}),(0,U.jsx)(l,{color:n?`suggestion`:void 0,children:e.name}),(0,U.jsxs)(l,{dimColor:!n,children:[` · `,i,` `]}),(0,U.jsx)(l,{dimColor:!n,children:a})]},`agent-${e.name}-${t}`)},j=e.length+t.length;return(0,U.jsxs)(s,{flexDirection:`column`,children:[(0,U.jsx)(M,{}),(0,U.jsx)(m,{title:`Manage MCP servers`,subtitle:`${j} ${te(j,`server`)}`,onCancel:w,hideInputGuide:!0,children:(0,U.jsxs)(s,{flexDirection:`column`,children:[W.map(e=>{let t=v.get(e);if(!t||t.length===0)return null;let n=V(e);return(0,U.jsxs)(s,{flexDirection:`column`,marginBottom:1,children:[(0,U.jsxs)(s,{paddingLeft:2,children:[(0,U.jsx)(l,{bold:!0,children:n.label}),n.path&&(0,U.jsxs)(l,{dimColor:!0,children:[` (`,n.path,`)`]})]}),t.map(e=>k(e))]},e)}),y.length>0&&(0,U.jsxs)(s,{flexDirection:`column`,marginBottom:1,children:[(0,U.jsx)(s,{paddingLeft:2,children:(0,U.jsx)(l,{bold:!0,children:`claude.ai`})}),y.map(e=>k(e))]}),t.length>0&&(0,U.jsxs)(s,{flexDirection:`column`,marginBottom:1,children:[(0,U.jsx)(s,{paddingLeft:2,children:(0,U.jsx)(l,{bold:!0,children:`Agent MCPs`})}),[...new Set(t.flatMap(e=>e.sourceAgents))].map(e=>(0,U.jsxs)(s,{flexDirection:`column`,marginTop:1,children:[(0,U.jsx)(s,{paddingLeft:2,children:(0,U.jsxs)(l,{dimColor:!0,children:[`@`,e]})}),t.filter(t=>t.sourceAgents.includes(e)).map(e=>A(e))]},e))]}),b.length>0&&(0,U.jsxs)(s,{flexDirection:`column`,marginBottom:1,children:[(0,U.jsxs)(s,{paddingLeft:2,children:[(0,U.jsx)(l,{bold:!0,children:x.label}),x.path&&(0,U.jsxs)(l,{dimColor:!0,children:[` (`,x.path,`)`]})]}),b.map(e=>k(e))]}),(0,U.jsxs)(s,{flexDirection:`column`,children:[O&&(0,U.jsx)(l,{dimColor:!0,children:D?`※ Error logs shown inline with --debug`:`※ Run claude --debug to see error logs`}),(0,U.jsxs)(l,{dimColor:!0,children:[(0,U.jsx)(c,{url:`https://code.workmate.com/docs/en/mcp`,children:`https://code.workmate.com/docs/en/mcp`}),` for help`]})]})]})}),(0,U.jsx)(s,{paddingX:1,children:(0,U.jsx)(l,{dimColor:!0,italic:!0,children:(0,U.jsxs)(u,{children:[(0,U.jsx)(i,{shortcut:`↑↓`,action:`navigate`}),(0,U.jsx)(i,{shortcut:`Enter`,action:`confirm`}),(0,U.jsx)(C,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})]})})})]})}var H,U,W,G=e((()=>{n(),H=t(d(),1),p(),_(),v(),E(),O(),S(),oe(),U=h(),W=[`project`,`local`,`user`,`enterprise`]}));function fe({serverName:e,onComplete:t}){let[n]=o(),i=y(),a=j(),[c,u]=(0,K.useState)(!0),[d,p]=(0,K.useState)(null);return(0,K.useEffect)(()=>{async function n(){try{if(!i.getState().mcp.clients.find(t=>t.name===e)){p(`MCP server "${e}" not found`),u(!1),t(`MCP server "${e}" not found`);return}switch((await a(e)).client.type){case`connected`:u(!1),t(`Successfully reconnected to ${e}`);break;case`needs-auth`:p(`${e} requires authentication`),u(!1),t(`${e} requires authentication.`);break;case`pending`:case`failed`:case`disabled`:p(`Failed to reconnect to ${e}`),u(!1),t(`Failed to reconnect to ${e}`);break}}catch(e){let n=e instanceof Error?e.message:String(e);p(n),u(!1),t(`Error: ${n}`)}}n()},[e,a,i,t]),c?(0,q.jsxs)(s,{flexDirection:`column`,gap:1,padding:1,children:[(0,q.jsxs)(l,{color:`text`,children:[`Reconnecting to `,(0,q.jsx)(l,{bold:!0,children:e})]}),(0,q.jsxs)(s,{children:[(0,q.jsx)(ie,{}),(0,q.jsx)(l,{children:` Establishing connection to MCP server`})]})]}):d?(0,q.jsxs)(s,{flexDirection:`column`,gap:1,padding:1,children:[(0,q.jsxs)(s,{children:[(0,q.jsxs)(l,{children:[f(`error`,n)(r.cross),` `]}),(0,q.jsxs)(l,{color:`error`,children:[`Failed to reconnect to `,e]})]}),(0,q.jsxs)(l,{dimColor:!0,children:[`Error: `,d]})]}):null}var K,q,J=e((()=>{n(),K=t(d(),1),p(),A(),T(),re(),q=h()}));function Y({onComplete:e}){let t=g(e=>e.mcp),n=g(e=>e.agentDefinitions),r=t.clients,[i,a]=X.useState({type:`list`}),[o,s]=X.useState([]),c=(0,X.useMemo)(()=>w(n.allAgents),[n.allAgents]),l=X.useMemo(()=>r.filter(e=>e.name!==`ide`).sort((e,t)=>e.name.localeCompare(t.name)),[r]);switch(X.useEffect(()=>{let e=!1;async function n(){let n=await Promise.all(l.map(async e=>{let n=e.config.scope,r=e.config.type===`sse`,i=e.config.type===`http`,a=e.config.type===`claudeai-proxy`,o;(r||i)&&(o=e.type===`connected`&&b(t.tools,e.name).length>0);let s={name:e.name,client:e,scope:n};return a?{...s,transport:`claudeai-proxy`,isAuthenticated:!1,config:e.config}:r?{...s,transport:`sse`,isAuthenticated:o,config:e.config}:i?{...s,transport:`http`,isAuthenticated:o,config:e.config}:{...s,transport:`stdio`,config:e.config}}));e||s(n)}return n(),()=>{e=!0}},[l,t.tools]),(0,X.useEffect)(()=>{o.length===0&&l.length>0||o.length===0&&c.length===0&&e("No MCP servers configured. Please run /doctor if this is unexpected. Otherwise, run `claude mcp --help` or visit https://code.workmate.com/docs/en/mcp to learn more.")},[o.length,l.length,c.length,e]),i.type){case`list`:return(0,Z.jsx)(de,{servers:o,agentServers:c,onSelectServer:e=>a({type:`server-menu`,server:e}),onSelectAgentServer:e=>a({type:`agent-server-menu`,agentServer:e}),onComplete:e,defaultTab:i.defaultTab});case`server-menu`:{let n=b(t.tools,i.server.name),r=i.server.transport===`claudeai-proxy`?`claude.ai`:`Work Mate`;return i.server.transport===`stdio`?(0,Z.jsx)(N,{server:i.server,serverToolsCount:n.length,onViewTools:()=>a({type:`server-tools`,server:i.server}),onCancel:()=>a({type:`list`,defaultTab:r}),onComplete:e}):(0,Z.jsx)(se,{server:i.server,serverToolsCount:n.length,onViewTools:()=>a({type:`server-tools`,server:i.server}),onCancel:()=>a({type:`list`,defaultTab:r}),onComplete:e})}case`server-tools`:return(0,Z.jsx)(ce,{server:i.server,onSelectTool:(e,t)=>a({type:`server-tool-detail`,server:i.server,toolIndex:t}),onBack:()=>a({type:`server-menu`,server:i.server})});case`server-tool-detail`:{let e=b(t.tools,i.server.name)[i.toolIndex];return e?(0,Z.jsx)(R,{tool:e,server:i.server,onBack:()=>a({type:`server-tools`,server:i.server})}):(a({type:`server-tools`,server:i.server}),null)}case`agent-server-menu`:return(0,Z.jsx)(le,{agentServer:i.agentServer,onCancel:()=>a({type:`list`,defaultTab:`Agents`}),onComplete:e})}}var X,Z,pe=e((()=>{X=t(d(),1),v(),T(),B(),G(),P(),L(),F(),I(),Z=h()})),me=e((()=>{B(),G(),J(),P(),pe(),L(),F(),I()}));function he({action:e,target:t,onComplete:n}){let r=g(e=>e.mcp.clients),i=k(),a=(0,Q.useRef)(!1);return(0,Q.useEffect)(()=>{if(a.current)return;a.current=!0;let o=e===`enable`,s=r.filter(e=>e.name!==`ide`),c=t===`all`?s.filter(e=>o?e.type===`disabled`:e.type!==`disabled`):s.filter(e=>e.name===t);if(c.length===0){n(t===`all`?`All MCP servers are already ${o?`enabled`:`disabled`}`:`MCP server "${t}" not found`);return}for(let e of c)i(e.name);n(t===`all`?`${o?`Enabled`:`Disabled`} ${c.length} MCP server(s)`:`MCP server "${t}" ${o?`enabled`:`disabled`}`)},[e,t,r,i,n]),null}async function ge(e,t,n){if(n){let t=n.trim().split(/\s+/);if(t[0]===`no-redirect`)return(0,$.jsx)(Y,{onComplete:e});if(t[0]===`reconnect`&&t[1])return(0,$.jsx)(fe,{serverName:t.slice(1).join(` `),onComplete:e});if(t[0]===`enable`||t[0]===`disable`)return(0,$.jsx)(he,{action:t[0],target:t.length>1?t.slice(1).join(` `):`all`,onComplete:e})}return(0,$.jsx)(Y,{onComplete:e})}var Q,$;e((()=>{Q=t(d(),1),me(),J(),A(),T(),$=h()}))();export{ge as call};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{$y as e,Ay as t,B as n,By as r,Cy as i,Dc as a,Dh as o,Ds as s,Dy as c,Ec as l,Eh as u,Ey as d,Fy as f,Hb as p,Hg as m,Hy as h,Iy as g,Ji as ee,Ky as te,Ly as ne,Ny as _,Os as v,Oy as y,Qy as b,Ry as x,Sy as S,Ty as C,Ub as w,Ug as T,Uy as E,V as D,Vy as O,Xy as k,Yy as A,Zy as j,_y as M,bl as N,by as P,cy as F,gy as I,jy as re,ky as L,ly as R,pS as z,qy as B,vy as V,wy as H,xl as U,xy as W,yy as G,zy as K}from"./loadAgentsDir-DGozQu_6.js";import{C as q,x as J}from"./debug-CRnGsZOV.js";import{o as Y,s as X}from"./log-DoSpAwRP.js";import{f as ie,s as ae}from"./model-DpZaKZMb.js";import{_n as Z,gn as oe,vn as se}from"./prompt-DzO1um1h.js";import Q from"node:process";j(),C(),i(),A();var ce=class{constructor(e){this._server=e}requestStream(e,t,n){return this._server.requestStream(e,t,n)}createMessageStream(e,t){let n=this._server.getClientCapabilities();if((e.tools||e.toolChoice)&&!n?.sampling?.tools)throw Error(`Client does not support sampling tools capability.`);if(e.messages.length>0){let t=e.messages[e.messages.length-1],n=Array.isArray(t.content)?t.content:[t.content],r=n.some(e=>e.type===`tool_result`),i=e.messages.length>1?e.messages[e.messages.length-2]:void 0,a=i?Array.isArray(i.content)?i.content:[i.content]:[],o=a.some(e=>e.type===`tool_use`);if(r){if(n.some(e=>e.type!==`tool_result`))throw Error(`The last message must contain only tool_result content if any is present`);if(!o)throw Error(`tool_result blocks are not matching any tool_use from the previous message`)}if(o){let e=new Set(a.filter(e=>e.type===`tool_use`).map(e=>e.id)),t=new Set(n.filter(e=>e.type===`tool_result`).map(e=>e.toolUseId));if(e.size!==t.size||![...e].every(e=>t.has(e)))throw Error(`ids of tool_result blocks and tool_use blocks from previous message do not match`)}}return this.requestStream({method:`sampling/createMessage`,params:e},L,t)}elicitInputStream(e,t){let n=this._server.getClientCapabilities(),r=e.mode??`form`;switch(r){case`url`:if(!n?.elicitation?.url)throw Error(`Client does not support url elicitation.`);break;case`form`:if(!n?.elicitation?.form)throw Error(`Client does not support form elicitation.`);break}let i=r===`form`&&e.mode===void 0?{...e,mode:`form`}:e;return this.requestStream({method:`elicitation/create`,params:i},_,t)}async getTask(e,t){return this._server.getTask({taskId:e},t)}async getTaskResult(e,t,n){return this._server.getTaskResult({taskId:e},t,n)}async listTasks(e,t){return this._server.listTasks(e?{cursor:e}:void 0,t)}async cancelTask(e,t){return this._server.cancelTask({taskId:e},t)}};A(),W();var le=class extends H{constructor(e,t){super(t),this._serverInfo=e,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(h.options.map((e,t)=>[e,t])),this.isMessageIgnored=(e,t)=>{let n=this._loggingLevels.get(t);return n?this.LOG_LEVEL_SEVERITY.get(e)<this.LOG_LEVEL_SEVERITY.get(n):!1},this._capabilities=t?.capabilities??{},this._instructions=t?.instructions,this._jsonSchemaValidator=t?.jsonSchemaValidator??new S,this.setRequestHandler(ne,e=>this._oninitialize(e)),this.setNotificationHandler(x,()=>this.oninitialized?.()),this._capabilities.logging&&this.setRequestHandler(B,async(e,t)=>{let n=t.sessionId||t.requestInfo?.headers[`mcp-session-id`]||void 0,{level:r}=e.params,i=h.safeParse(r);return i.success&&this._loggingLevels.set(n,i.data),{}})}get experimental(){return this._experimental||(this._experimental={tasks:new ce(this)}),this._experimental}registerCapabilities(e){if(this.transport)throw Error(`Cannot register capabilities after connecting to transport`);this._capabilities=d(this._capabilities,e)}setRequestHandler(t,n){let r=k(t)?.method;if(!r)throw Error(`Schema is missing a method literal`);let i;if(b(r)){let e=r;i=e._zod?.def?.value??e.value}else{let e=r;i=e._def?.value??e.value}if(typeof i!=`string`)throw Error(`Schema method literal must be a string`);return i===`tools/call`?super.setRequestHandler(t,async(t,r)=>{let i=e(c,t);if(!i.success){let e=i.error instanceof Error?i.error.message:String(i.error);throw new E(g.InvalidParams,`Invalid tools/call request: ${e}`)}let{params:a}=i.data,o=await Promise.resolve(n(t,r));if(a.task){let t=e(re,o);if(!t.success){let e=t.error instanceof Error?t.error.message:String(t.error);throw new E(g.InvalidParams,`Invalid task creation result: ${e}`)}return t.data}let s=e(y,o);if(!s.success){let e=s.error instanceof Error?s.error.message:String(s.error);throw new E(g.InvalidParams,`Invalid tools/call result: ${e}`)}return s.data}):super.setRequestHandler(t,n)}assertCapabilityForMethod(e){switch(e){case`sampling/createMessage`:if(!this._clientCapabilities?.sampling)throw Error(`Client does not support sampling (required for ${e})`);break;case`elicitation/create`:if(!this._clientCapabilities?.elicitation)throw Error(`Client does not support elicitation (required for ${e})`);break;case`roots/list`:if(!this._clientCapabilities?.roots)throw Error(`Client does not support listing roots (required for ${e})`);break;case`ping`:break}}assertNotificationCapability(e){switch(e){case`notifications/message`:if(!this._capabilities.logging)throw Error(`Server does not support logging (required for ${e})`);break;case`notifications/resources/updated`:case`notifications/resources/list_changed`:if(!this._capabilities.resources)throw Error(`Server does not support notifying about resources (required for ${e})`);break;case`notifications/tools/list_changed`:if(!this._capabilities.tools)throw Error(`Server does not support notifying of tool list changes (required for ${e})`);break;case`notifications/prompts/list_changed`:if(!this._capabilities.prompts)throw Error(`Server does not support notifying of prompt list changes (required for ${e})`);break;case`notifications/elicitation/complete`:if(!this._clientCapabilities?.elicitation?.url)throw Error(`Client does not support URL elicitation (required for ${e})`);break;case`notifications/cancelled`:break;case`notifications/progress`:break}}assertRequestHandlerCapability(e){if(this._capabilities)switch(e){case`completion/complete`:if(!this._capabilities.completions)throw Error(`Server does not support completions (required for ${e})`);break;case`logging/setLevel`:if(!this._capabilities.logging)throw Error(`Server does not support logging (required for ${e})`);break;case`prompts/get`:case`prompts/list`:if(!this._capabilities.prompts)throw Error(`Server does not support prompts (required for ${e})`);break;case`resources/list`:case`resources/templates/list`:case`resources/read`:if(!this._capabilities.resources)throw Error(`Server does not support resources (required for ${e})`);break;case`tools/call`:case`tools/list`:if(!this._capabilities.tools)throw Error(`Server does not support tools (required for ${e})`);break;case`tasks/get`:case`tasks/list`:case`tasks/result`:case`tasks/cancel`:if(!this._capabilities.tasks)throw Error(`Server does not support tasks capability (required for ${e})`);break;case`ping`:case`initialize`:break}}assertTaskCapability(e){G(this._clientCapabilities?.tasks?.requests,e,`Client`)}assertTaskHandlerCapability(e){this._capabilities&&P(this._capabilities.tasks?.requests,e,`Server`)}async _oninitialize(e){let t=e.params.protocolVersion;return this._clientCapabilities=e.params.capabilities,this._clientVersion=e.params.clientInfo,{protocolVersion:te.includes(t)?t:K,capabilities:this.getCapabilities(),serverInfo:this._serverInfo,...this._instructions&&{instructions:this._instructions}}}getClientCapabilities(){return this._clientCapabilities}getClientVersion(){return this._clientVersion}getCapabilities(){return this._capabilities}async ping(){return this.request({method:`ping`},f)}async createMessage(e,n){if((e.tools||e.toolChoice)&&!this._clientCapabilities?.sampling?.tools)throw Error(`Client does not support sampling tools capability.`);if(e.messages.length>0){let t=e.messages[e.messages.length-1],n=Array.isArray(t.content)?t.content:[t.content],r=n.some(e=>e.type===`tool_result`),i=e.messages.length>1?e.messages[e.messages.length-2]:void 0,a=i?Array.isArray(i.content)?i.content:[i.content]:[],o=a.some(e=>e.type===`tool_use`);if(r){if(n.some(e=>e.type!==`tool_result`))throw Error(`The last message must contain only tool_result content if any is present`);if(!o)throw Error(`tool_result blocks are not matching any tool_use from the previous message`)}if(o){let e=new Set(a.filter(e=>e.type===`tool_use`).map(e=>e.id)),t=new Set(n.filter(e=>e.type===`tool_result`).map(e=>e.toolUseId));if(e.size!==t.size||![...e].every(e=>t.has(e)))throw Error(`ids of tool_result blocks and tool_use blocks from previous message do not match`)}}return e.tools?this.request({method:`sampling/createMessage`,params:e},t,n):this.request({method:`sampling/createMessage`,params:e},L,n)}async elicitInput(e,t){switch(e.mode??`form`){case`url`:{if(!this._clientCapabilities?.elicitation?.url)throw Error(`Client does not support url elicitation.`);let n=e;return this.request({method:`elicitation/create`,params:n},_,t)}case`form`:{if(!this._clientCapabilities?.elicitation?.form)throw Error(`Client does not support form elicitation.`);let n=e.mode===`form`?e:{...e,mode:`form`},r=await this.request({method:`elicitation/create`,params:n},_,t);if(r.action===`accept`&&r.content&&n.requestedSchema)try{let e=this._jsonSchemaValidator.getValidator(n.requestedSchema)(r.content);if(!e.valid)throw new E(g.InvalidParams,`Elicitation response content does not match requested schema: ${e.errorMessage}`)}catch(e){throw e instanceof E?e:new E(g.InternalError,`Error validating elicitation response: ${e instanceof Error?e.message:String(e)}`)}return r}}}createElicitationCompletionNotifier(e,t){if(!this._clientCapabilities?.elicitation?.url)throw Error(`Client does not support URL elicitation (required for notifications/elicitation/complete)`);return()=>this.notification({method:`notifications/elicitation/complete`,params:{elicitationId:e}},t)}async listRoots(e,t){return this.request({method:`roots/list`,params:e},r,t)}async sendLoggingMessage(e,t){if(this._capabilities.logging&&!this.isMessageIgnored(e.level,t))return this.notification({method:`notifications/message`,params:e})}async sendResourceUpdated(e){return this.notification({method:`notifications/resources/updated`,params:e})}async sendResourceListChanged(){return this.notification({method:`notifications/resources/list_changed`})}async sendToolListChanged(){return this.notification({method:`notifications/tools/list_changed`})}async sendPromptListChanged(){return this.notification({method:`notifications/prompts/list_changed`})}};M();var $=class{constructor(e=Q.stdin,t=Q.stdout){this._stdin=e,this._stdout=t,this._readBuffer=new I,this._started=!1,this._ondata=e=>{this._readBuffer.append(e),this.processReadBuffer()},this._onerror=e=>{this.onerror?.(e)}}async start(){if(this._started)throw Error(`StdioServerTransport already started! If using Server class, note that connect() calls start() automatically.`);this._started=!0,this._stdin.on(`data`,this._ondata),this._stdin.on(`error`,this._onerror)}processReadBuffer(){for(;;)try{let e=this._readBuffer.readMessage();if(e===null)break;this.onmessage?.(e)}catch(e){this.onerror?.(e)}}async close(){this._stdin.off(`data`,this._ondata),this._stdin.off(`error`,this._onerror),this._stdin.listenerCount(`data`)===0&&this._stdin.pause(),this._readBuffer.clear(),this.onclose?.()}send(e){return new Promise(t=>{let n=V(e);this._stdout.write(n)?t():this._stdout.once(`drain`,t)})}};A(),v(),se(),a(),R(),T(),Y(),ee(),ie(),D(),p(),J(),U(),u();var ue=[];async function de(e,t,r){let i=m(100);w(e);let a=new le({name:`claude/tengu`,version:`0.0.25`},{capabilities:{tools:{}}});a.setRequestHandler(O,async()=>{let e=Z(),t=l(e);return{tools:await Promise.all(t.map(async n=>{let r;if(n.outputSchema){let e=o(n.outputSchema);typeof e==`object`&&e&&`type`in e&&e.type===`object`&&(r=e)}return{...n,description:await n.prompt({getToolPermissionContext:async()=>e,tools:t,agents:[]}),inputSchema:o(n.inputSchema),outputSchema:r}}))}}),a.setRequestHandler(c,async({params:{name:e,arguments:a}})=>{let o=l(Z()),c=oe(o,e);if(!c)throw Error(`Tool ${e} not found`);let u={abortController:F(),options:{commands:ue,tools:o,mainLoopModel:ae(),thinkingConfig:{type:`disabled`},mcpClients:[],mcpResources:{},isNonInteractiveSession:!0,debug:t,verbose:r,agentDefinitions:{activeAgents:[],allAgents:[]}},getAppState:()=>s(),setAppState:()=>{},messages:[],readFileState:i,setInProgressToolUseIDs:()=>{},setResponseLength:()=>{},updateFileHistoryState:()=>{},updateAttributionState:()=>{}};try{if(!c.isEnabled())throw Error(`Tool ${e} is not enabled`);let t=await c.validateInput?.(a??{},u);if(t&&!t.result)throw Error(`Tool ${e} input is invalid: ${`message`in t?t.message:String(t)}`);let r=await c.call(a??{},u,n,z({content:[]}));return{content:[{type:`text`,text:typeof r==`string`?r:q(r.data)}]}}catch(e){return X(e),{isError:!0,content:[{type:`text`,text:(e instanceof Error?N(e):[String(e)]).filter(Boolean).join(`
|
|
2
|
-
`).trim()||`Error`}]}}});async function u(){let e=new $;await a.connect(e)}return await u()}export{de as startMCPServer};
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-DaDcL9Zw.js";import{D as t,H as n,I as r,P as i,T as a,ai as o,j as s,kn as c,t as l,y as ee}from"./src-DL3w8VPk.js";import{t as u}from"./jsx-runtime-Bb4Xn-E0.js";import{d,l as f}from"./types-97nL3naE.js";import{Av as p,Cv as m,Ev as h,Lp as g,Mv as _,Pv as v,Q_ as te,Rv as y,Sv as b,dv as x,fv as S,gi as C,hd as w,hy as T,iv as ne,jv as E,md as re,mi as D,my as O,nv as k,zp as A}from"./loadAgentsDir-DGozQu_6.js";import{I as j,z as M}from"./debug-CRnGsZOV.js";import{a as N,d as P,m as F,o as I}from"./config-CWPHVTic.js";import{n as L,o as R}from"./process-gEbdy6uY.js";import{l as z,o as B}from"./stringUtils-Bu_lJH5c.js";import{i as V,n as H}from"./platform-DsMIk3eq.js";import{n as U}from"./analytics-COpjZpvd.js";import{n as ie,t as W}from"./SelectMulti-BW7Ffk1G.js";import{t as G}from"./KeybindingProviderSetup-DsJqfEt-.js";import{n as K,t as q}from"./exit-s9XGerrH.js";import{stat as J}from"fs/promises";import{cwd as Y}from"process";O();var X=e(o(),1);C(),L(),l(),v(),B(),w(),ie();var Z=u();function ae({servers:e,scope:o,onDone:c}){let l=Object.keys(e),[u,d]=(0,X.useState)({});(0,X.useEffect)(()=>{p().then(({servers:e})=>d(e))},[]);let f=l.filter(e=>u[e]!==void 0);async function m(t){let n=0;for(let r of t){let t=e[r];if(t){let e=r;if(u[e]!==void 0){let t=1;for(;u[`${r}_${t}`]!==void 0;)t++;e=`${r}_${t}`}await h(e,t,o),n++}}_(n)}let[g]=n(),_=(0,X.useCallback)(e=>{R(e>0?`\n${s(`success`,g)(`Successfully imported ${e} MCP ${z(e,`server`)} to ${o} config.`)}\n`:`
|
|
2
|
-
No servers were imported.`),c(),D()},[g,o,c]),v=(0,X.useCallback)(()=>{_(0)},[_]);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(ee,{title:`Import MCP Servers from Work Mate Desktop`,subtitle:`Found ${l.length} MCP ${z(l.length,`server`)} in Work Mate Desktop.`,color:`success`,onCancel:v,hideInputGuide:!0,children:[f.length>0&&(0,Z.jsx)(i,{color:`warning`,children:`Note: Some servers already exist with the same name. If selected, they will be imported with a numbered suffix.`}),(0,Z.jsx)(i,{children:`Please select the servers you want to import:`}),(0,Z.jsx)(W,{options:l.map(e=>({label:`${e}${f.includes(e)?` (already exists)`:``}`,value:e})),defaultValue:l.filter(e=>!f.includes(e)),onSubmit:m,onCancel:v,hideIndexes:!0})]}),(0,Z.jsx)(r,{paddingX:1,children:(0,Z.jsx)(i,{dimColor:!0,italic:!0,children:(0,Z.jsxs)(a,{children:[(0,Z.jsx)(t,{shortcut:`Space`,action:`select`}),(0,Z.jsx)(t,{shortcut:`Enter`,action:`confirm`}),(0,Z.jsx)(re,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})]})})})]})}l(),U(),ne(),v(),m(),A(),P(),j(),C(),f(),V();async function Q(e,t){try{let n=await te(e,t);return n.type===`connected`?`✓ Connected`:n.type===`needs-auth`?`! Needs authentication`:`✗ Failed to connect`}catch{return`✗ Connection error`}}async function oe({debug:e,verbose:t}){let n=Y();try{await J(n)}catch(e){throw M(e)&&q(`Error: Directory ${n} does not exist`),e}try{let{setup:r}=await import(`./setup-DBiIrXrh.js`);await r(n,`default`,!1,!1,void 0,!1);let{startMCPServer:i}=await import(`./mcp-7DXpXMdT.js`);await i(n,e??!1,t??!1)}catch(e){q(`Error: Failed to start MCP server: ${e}`)}}async function se(e,t){E(e);try{if(t.scope){let n=S(t.scope);await y(e,n),process.stdout.write(`Removed MCP server ${e} from ${n} config\n`),K(`File modified: ${x(n)}`)}let n=N(),r=I(),{servers:i}=_(`project`),a=!!i[e],o=[];if(n.mcpServers?.[e]&&o.push(`local`),a&&o.push(`project`),r.mcpServers?.[e]&&o.push(`user`),o.length===0)q(`No MCP server found with name: "${e}"`);else if(o.length===1){let t=o[0];await y(e,t),process.stdout.write(`Removed MCP server "${e}" from ${t} config\n`),K(`File modified: ${x(t)}`)}else process.stderr.write(`MCP server "${e}" exists in multiple scopes:\n`),o.forEach(e=>{process.stderr.write(` - ${b(e)} (${x(e)})\n`)}),process.stderr.write(`
|
|
3
|
-
To remove from a specific scope, use:
|
|
4
|
-
`),o.forEach(t=>{process.stderr.write(` claude mcp remove "${e}" -s ${t}\n`)}),q()}catch(e){q(e.message)}}async function ce(){let{servers:e}=await p();if(Object.keys(e).length===0)console.log("No MCP servers configured. Use `claude mcp add` to add a server.");else{console.log(`Checking MCP server health...
|
|
5
|
-
`);let t=await T(Object.entries(e),async([e,t])=>({name:e,server:t,status:await Q(e,t)}),{concurrency:k()});for(let{name:e,server:n,status:r}of t)if(n.type===`sse`)console.log(`${e}: ${n.url} (SSE) - ${r}`);else if(n.type===`http`)console.log(`${e}: ${n.url} (HTTP) - ${r}`);else if(n.type===`claudeai-proxy`)console.log(`${e}: ${n.url} - ${r}`);else if(!n.type||n.type===`stdio`){let t=n,i=Array.isArray(t.args)?t.args:[];console.log(`${e}: ${t.command} ${i.join(` `)} - ${r}`)}}await D(0)}async function le(e){let t=E(e);t||q(`No MCP server found with name: ${e}`),console.log(`${e}:`),console.log(` Scope: ${b(t.scope)}`);let n=await Q(e,t);if(console.log(` Status: ${n}`),t.type===`sse`){if(console.log(` Type: sse`),console.log(` URL: ${t.url}`),t.headers){console.log(` Headers:`);for(let[e,n]of Object.entries(t.headers))console.log(` ${e}: ${n}`)}}else if(t.type===`http`){if(console.log(` Type: http`),console.log(` URL: ${t.url}`),t.headers){console.log(` Headers:`);for(let[e,n]of Object.entries(t.headers))console.log(` ${e}: ${n}`)}}else if(t.type===`stdio`){console.log(` Type: stdio`),console.log(` Command: ${t.command}`);let e=Array.isArray(t.args)?t.args:[];if(console.log(` Args: ${e.join(` `)}`),t.env){console.log(` Environment:`);for(let[e,n]of Object.entries(t.env))console.log(` ${e}=${n}`)}}console.log(`\nTo remove this server, run: claude mcp remove "${e}" -s ${t.scope}`),await D(0)}async function $(e,t,n){try{let r=S(n.scope),i=d(t);await h(e,i,r),K(`Added ${i&&typeof i==`object`&&`type`in i?String(i.type||`stdio`):`stdio`} MCP server ${e} to ${r} config`)}catch(e){q(e.message)}}async function ue(e){try{let t=S(e.scope);H();let{readClaudeDesktopMcpServers:n}=await import(`./claudeDesktop-mBGFDbI6.js`),r=await n();Object.keys(r).length===0&&K(`No MCP servers found in Work Mate Desktop configuration or configuration file does not exist.`);let{unmount:i}=await c((0,Z.jsx)(g,{children:(0,Z.jsx)(G,{children:(0,Z.jsx)(ae,{servers:r,scope:t,onDone:()=>{i()}})})}),{exitOnCtrlC:!0})}catch(e){q(e.message)}}async function de(){F(e=>({...e,enabledMcpjsonServers:[],disabledMcpjsonServers:[],enableAllProjectMcpServers:!1})),K(`All project-scoped (.mcp.json) server approvals and rejections have been reset.
|
|
6
|
-
You will be prompted for approval next time you start Work Mate.`)}export{ue as mcpAddFromDesktopHandler,$ as mcpAddJsonHandler,le as mcpGetHandler,ce as mcpListHandler,se as mcpRemoveHandler,de as mcpResetChoicesHandler,oe as mcpServeHandler};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{i as n,o as r}from"./envUtils-DfkgIdYf.js";import{I as i,Lt as a,P as o,Wt as s,_ as c,ai as l,di as ee,fi as u,t as d,y as f}from"./src-DL3w8VPk.js";import{t as p}from"./jsx-runtime-Bb4Xn-E0.js";import{Pt as m,q as h}from"./state-BQ4BEGin.js";import{A_ as g,Bp as _,Cb as v,Kl as y,O_ as b,T_ as x,fc as S,iT as C,nT as te,pc as w,ql as T,xu as ne,yu as E,zp as D}from"./loadAgentsDir-DGozQu_6.js";import{n as O,t as k}from"./cwd-BvNt_018.js";import{I as A,N as j}from"./debug-CRnGsZOV.js";import{Ir as M,Or as N,b as P,h as F,wn as I,xn as re}from"./settings-CodSADx8.js";import{C as ie,E as L,O as R}from"./config-CWPHVTic.js";import{o as z,s as ae}from"./log-DoSpAwRP.js";import{n as oe}from"./analytics-COpjZpvd.js";import{_ as se,p as ce}from"./startupProfiler-DF0AjiDf.js";import{n as B,t as V}from"./useExitOnCtrlCDWithKeybindings-DWRFdFoU.js";import{t as H}from"./select-Fq6g2Ejk.js";import{r as U,t as W}from"./promptEditor-B6S_Rzcu.js";import{t as le}from"./CustomSelect-BvTftqEH.js";import{homedir as ue}from"os";import{join as G,relative as de}from"path";import{mkdir as K,writeFile as fe}from"fs/promises";function pe(e){return N(e)!==null}var me=e((()=>{M()}));function he({onSelect:e,onCancel:t}){let r=(0,q.use)(b()),a=G(n(),`AGENTS.md`),l=G(h(),`AGENTS.md`),u=r.some(e=>e.path===a),d=r.some(e=>e.path===l),f=[...r.filter(e=>e.type!==`AutoMem`).map(e=>({...e,exists:!0})),...u?[]:[{path:a,type:`User`,content:``,exists:!1}],...d?[]:[{path:l,type:`Project`,content:``,exists:!1}]],p=new Map,m=f.map(e=>{let t=re(e.path),n=e.exists?``:` (new)`,r=e.parent?(p.get(e.parent)??0)+1:0;p.set(e.path,r);let i=r>0?` `.repeat(r-1):``,o;o=e.type===`User`&&!e.isNested&&e.path===a?`User memory`:e.type===`Project`&&!e.isNested&&e.path===l?`Project memory`:r>0?`${i}L ${t}${n}`:`${t}`;let s,c=pe(h());return s=e.type===`User`&&!e.isNested?`Saved in ~/.workmate/AGENTS.md`:e.type===`Project`&&!e.isNested&&e.path===l?`${c?`Checked in at`:`Saved in`} ./AGENTS.md`:e.parent?`@-imported`:e.isNested?`dynamically loaded`:``,{label:o,value:e.path,description:s}}),g=[],v=_(e=>e.agentDefinitions);if(R()){g.push({label:`Open auto-memory folder`,value:`${X}${ie()}`,description:``});for(let e of v.activeAgents)if(e.memory){let t=te(e.agentType,e.memory);g.push({label:`Open ${ee.bold(e.agentType)} agent memory`,value:`${X}${t}`,description:`${e.memory} scope`})}}m.push(...g);let y=Y&&m.some(e=>e.value===Y)?Y:m[0]?.value||``,[x,S]=(0,q.useState)(R),[C,E]=(0,q.useState)(w),[D]=(0,q.useState)(R),O=_(e=>Object.values(e.tasks).some(e=>e.type===`dream`&&e.status===`running`)),[k,A]=(0,q.useState)(null);(0,q.useEffect)(()=>{D&&T().then(A)},[D,O]);let j=O?`running`:k===null?``:k===0?`never`:`last ran ${ce(new Date(k))}`,[M,N]=(0,q.useState)(null),F=M!==null,I=+!!D;function L(){let e=!x;P(`userSettings`,{autoMemoryEnabled:e}),S(e)}function z(){let e=!C;P(`userSettings`,{autoDreamEnabled:e}),E(e)}return B(),s(`confirm:no`,t,{context:`Confirmation`}),s(`confirm:yes`,()=>{M===0?L():M===1&&z()},{context:`Confirmation`,isActive:F}),s(`select:next`,()=>{N(e=>e!==null&&e<I?e+1:null)},{context:`Select`,isActive:F}),s(`select:previous`,()=>{N(e=>e!==null&&e>0?e-1:e)},{context:`Select`,isActive:F}),(0,J.jsxs)(i,{flexDirection:`column`,width:`100%`,children:[(0,J.jsxs)(i,{flexDirection:`column`,marginBottom:1,children:[(0,J.jsx)(c,{isFocused:M===0,children:(0,J.jsxs)(o,{children:[`Auto-memory: `,x?`on`:`off`]})}),D&&(0,J.jsx)(c,{isFocused:M===1,styled:!1,children:(0,J.jsxs)(o,{color:M===1?`suggestion`:void 0,children:[`Auto-dream: `,C?`on`:`off`,j&&(0,J.jsxs)(o,{dimColor:!0,children:[` · `,j]}),!O&&C&&(0,J.jsx)(o,{dimColor:!0,children:` · /dream to run`})]})})]}),(0,J.jsx)(H,{defaultFocusValue:y,options:m,isDisabled:F,onChange:t=>{if(t.startsWith(X)){let e=t.slice(15);K(e,{recursive:!0}).catch(()=>{}).then(()=>ne(e));return}Y=t,e(t)},onCancel:t,onUpFromFirstItem:()=>N(I)})]})}var q,J,Y,X,ge=e((()=>{u(),q=t(l(),1),m(),V(),d(),v(),L(),oe(),S(),y(),D(),C(),E(),g(),r(),I(),se(),me(),F(),le(),J=p(),X=`__open_folder__`}));function _e(e){let t=ue(),n=k(),r=e.startsWith(t)?`~${e.slice(t.length)}`:null,i=e.startsWith(n)?`./${de(n,e)}`:null;return r&&i?r.length<=i.length?r:i:r||i||e}var ve=e((()=>{d(),O(),p()}));function ye({onDone:e}){let t=async t=>{try{t.includes(n())&&await K(n(),{recursive:!0});try{await fe(t,``,{encoding:`utf8`,flag:`wx`})}catch(e){if(j(e)!==`EEXIST`)throw e}await W(t);let r=`default`,i=``;process.env.VISUAL?(r=`$VISUAL`,i=process.env.VISUAL):process.env.EDITOR&&(r=`$EDITOR`,i=process.env.EDITOR);let a=r==="default"?``:`Using ${r}="${i}".`,o=a?`> ${a} To change editor, set $EDITOR or $VISUAL environment variable.`:`> To use a different editor, set the $EDITOR or $VISUAL environment variable.`;e(`Opened memory file at ${_e(t)}\n\n${o}`,{display:`system`})}catch(t){ae(t),e(`Error opening memory file: ${t}`)}},r=()=>{e(`Cancelled memory editing`,{display:`system`})};return(0,Q.jsx)(f,{title:`Memory`,onCancel:r,color:`remember`,children:(0,Q.jsxs)(i,{flexDirection:`column`,children:[(0,Q.jsx)(Z.Suspense,{fallback:null,children:(0,Q.jsx)(he,{onSelect:t,onCancel:r})}),(0,Q.jsx)(i,{marginTop:1,children:(0,Q.jsxs)(o,{dimColor:!0,children:[`Learn more: `,(0,Q.jsx)(a,{url:`https://code.workmate.com/docs/en/memory`})]})})]})})}var Z,Q,$;e((()=>{Z=t(l(),1),d(),ge(),ve(),g(),r(),A(),z(),U(),Q=p(),$=async e=>(x(),await b(),(0,Q.jsx)(ye,{onDone:e}))}))();export{$ as call};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{n,t as r}from"./memoize-BK3gG5ob.js";import{i,l as a,o,r as ee,t as s}from"./envUtils-DfkgIdYf.js";import{N as c,U as l,W as u,X as te,b as d,d as f,l as p,o as ne,s as re}from"./types-97nL3naE.js";import{G as m,Pt as ie,Sn as ae,U as oe,at as se,vr as ce,yr as le}from"./state-BQ4BEGin.js";import{C as ue,H as de,U as fe,c as h,i as pe,o as g,x as me}from"./debug-CRnGsZOV.js";import{d as he,h as _,t as ge}from"./settings-CodSADx8.js";import{d as _e,o as ve}from"./config-CWPHVTic.js";import{d as ye,f as be,o as xe,s as v}from"./log-DoSpAwRP.js";import{n as Se,o as Ce}from"./stringUtils-Bu_lJH5c.js";import{c as we,i as Te,r as Ee}from"./proxy-BjkGlmBu.js";import{join as De}from"path";import{readFileSync as Oe}from"fs";import{randomUUID as ke}from"crypto";import{mkdir as Ae,writeFile as je}from"fs/promises";import{AsyncLocalStorage as Me}from"async_hooks";function y(e=ge()){let t=e.modelType;return t===`openai`?`openai`:t===`gemini`?`gemini`:t===`grok`?`grok`:a(process.env.CLAUDE_CODE_USE_BEDROCK)?`bedrock`:a(process.env.CLAUDE_CODE_USE_VERTEX)?`vertex`:a(process.env.CLAUDE_CODE_USE_FOUNDRY)?`foundry`:a(process.env.CLAUDE_CODE_USE_OPENAI)?`openai`:a(process.env.CLAUDE_CODE_USE_GEMINI)?`gemini`:a(process.env.CLAUDE_CODE_USE_GROK)?`grok`:`firstParty`}function Ne(){return y()}function b(){let e=process.env.ANTHROPIC_BASE_URL;if(!e)return!0;try{return new URL(e).host===`api.anthropic.com`}catch{return!1}}var x=e((()=>{_(),o()}));function Pe(){return S.getStore()?.workload}function Fe(e,t){return S.run({workload:e},t)}var S,Ie=e((()=>{S=new Me})),Le,C,Re,ze,Be,Ve,He,Ue,We,Ge,Ke,qe,Je,Ye=e((()=>{Le=`claude-code-20250219`,C=`interleaved-thinking-2025-05-14`,Re=`context-1m-2025-08-07`,ze=`context-management-2025-06-27`,Be=`structured-outputs-2025-12-15`,Ve=`tool-search-tool-2025-10-19`,He=`task-budgets-2026-03-13`,Ue=`prompt-caching-scope-2026-01-05`,We=`fast-mode-2026-02-01`,Ge=`redact-thinking-2026-02-12`,Ke=`advisor-tool-2026-03-01`,qe=new Set([C,Re,Ve]),Je=new Set([Le,C,ze])}));function Xe(e,t){return ce(e,t)}var Ze=e((()=>{le()}));function Qe(){let e=process.env.CLAUDE_AGENT_SDK_VERSION?`, agent-sdk/${process.env.CLAUDE_AGENT_SDK_VERSION}`:``,t=process.env.CLAUDE_AGENT_SDK_CLIENT_APP?`, client-app/${process.env.CLAUDE_AGENT_SDK_CLIENT_APP}`:``,n=Pe(),r=n?`, workload/${n}`:``;return`claude-cli/0.0.25 (external, ${process.env.CLAUDE_CODE_ENTRYPOINT??`cli`}${e}${t}${r})`}function $e(){let e=[];return process.env.CLAUDE_CODE_ENTRYPOINT&&e.push(process.env.CLAUDE_CODE_ENTRYPOINT),process.env.CLAUDE_AGENT_SDK_VERSION&&e.push(`agent-sdk/${process.env.CLAUDE_AGENT_SDK_VERSION}`),process.env.CLAUDE_AGENT_SDK_CLIENT_APP&&e.push(`client-app/${process.env.CLAUDE_AGENT_SDK_CLIENT_APP}`),`workmate/0.0.25${e.length>0?` (${e.join(`, `)})`:``}`}var et=e((()=>{Ie()}));function w(){return{error:(e,...t)=>console.error(`[SDK ERROR]`,e,...t),warn:(e,...t)=>console.error(`[SDK WARN]`,e,...t),info:(e,...t)=>console.error(`[SDK INFO]`,e,...t),debug:(e,...t)=>console.error(`[SDK DEBUG]`,e,...t)}}async function tt({apiKey:e,maxRetries:n,model:r,fetchOverride:i,source:o}){let c=process.env.CLAUDE_CODE_CONTAINER_ID,l=process.env.CLAUDE_CODE_REMOTE_SESSION_ID,u=process.env.CLAUDE_AGENT_SDK_CLIENT_APP,te=nt(),d={"x-app":`cli`,"User-Agent":Qe(),"X-Claude-Code-Session-Id":se(),...te,...c?{"x-claude-remote-container-id":c}:{},...l?{"x-claude-remote-session-id":l}:{},...u?{"x-client-app":u}:{},...process.env.ANTHROPIC_AUTH_NONCE?{"x-auth-nonce":process.env.ANTHROPIC_AUTH_NONCE}:{}};h(`[API:request] Creating client, ANTHROPIC_CUSTOM_HEADERS present: ${!!process.env.ANTHROPIC_CUSTOM_HEADERS}, has Authorization header: ${!!te.Authorization}`),a(process.env.CLAUDE_CODE_ADDITIONAL_PROTECTION)&&(d[`x-anthropic-additional-protection`]=`true`);let f=rt(i,o),p={defaultHeaders:d,maxRetries:n,timeout:parseInt(process.env.API_TIMEOUT_MS||`600000`,10),dangerouslyAllowBrowser:!0,fetchOptions:Te({forAnthropicAPI:!0}),...f&&{fetch:f}};if(a(process.env.CLAUDE_CODE_USE_BEDROCK)){let{BedrockClient:e}=await import(`./bedrockClient-CfiDN-kF.js`),t=r===sn()&&process.env.ANTHROPIC_SMALL_FAST_MODEL_AWS_REGION?process.env.ANTHROPIC_SMALL_FAST_MODEL_AWS_REGION:s(),n={...p,awsRegion:t,...a(process.env.CLAUDE_CODE_SKIP_BEDROCK_AUTH)&&{skipAuth:!0},...g()&&{logger:w()}};return process.env.AWS_BEARER_TOKEN_BEDROCK&&(n.skipAuth=!0,n.defaultHeaders={...n.defaultHeaders,Authorization:`Bearer ${process.env.AWS_BEARER_TOKEN_BEDROCK}`}),new e(n)}if(a(process.env.CLAUDE_CODE_USE_FOUNDRY)){let{AnthropicFoundry:e}=await import(`./foundry-sdk-BdeF2aBu.js`),t;if(!process.env.ANTHROPIC_FOUNDRY_API_KEY)if(a(process.env.CLAUDE_CODE_SKIP_FOUNDRY_AUTH))t=()=>Promise.resolve(``);else{let{DefaultAzureCredential:e,getBearerTokenProvider:n}=await import(`./esm-DUH16IqH.js`);t=n(new e,`https://cognitiveservices.azure.com/.default`)}return new e({...p,...t&&{azureADTokenProvider:t},...g()&&{logger:w()}})}if(a(process.env.CLAUDE_CODE_USE_VERTEX)){let[{AnthropicVertex:e},{GoogleAuth:n}]=await Promise.all([import(`./vertex-sdk-DjXcZ2J7.js`),import(`./src-C8gyNm5a.js`).then(e=>t(e.default,1))]),i=process.env.GCLOUD_PROJECT||process.env.GOOGLE_CLOUD_PROJECT||process.env.gcloud_project||process.env.google_cloud_project,o=process.env.GOOGLE_APPLICATION_CREDENTIALS||process.env.google_application_credentials,s=a(process.env.CLAUDE_CODE_SKIP_VERTEX_AUTH)?{getClient:()=>({getRequestHeaders:()=>({})})}:new n({scopes:[`https://www.googleapis.com/auth/cloud-platform`],...i||o?{}:{projectId:process.env.ANTHROPIC_VERTEX_PROJECT_ID}});return new e({...p,region:ee(r),googleAuth:s,...g()&&{logger:w()}})}return new fe({...e?{apiKey:e}:{},...p,...g()&&{logger:w()}})}function nt(){let e={},t=process.env.ANTHROPIC_CUSTOM_HEADERS;if(!t)return e;let n=t.split(/\n|\r\n/);for(let t of n){if(!t.trim())continue;let n=t.indexOf(`:`);if(n===-1)continue;let r=t.slice(0,n).trim(),i=t.slice(n+1).trim();r&&(e[r]=i)}return e}function rt(e,t){let n=e??globalThis.fetch,r=y()===`firstParty`&&b();return(e,i)=>{let a=new Headers(i?.headers);r&&!a.has(`x-client-request-id`)&&a.set(T,ke());try{let n=e instanceof Request?e.url:String(e),r=a.get(T);h(`[API REQUEST] ${new URL(n).pathname}${r?` ${T}=${r}`:``} source=${t??`unknown`}`)}catch{}return n(e,{...i,headers:a})}}var T,it=e((()=>{de(),et(),$(),x(),we(),ie(),pe(),o(),T=`x-client-request-id`}));function at(){return De(i(),`cache`)}function ot(){return De(at(),`model-capabilities.json`)}function st(){return!(y()!==`firstParty`||!b())}function ct(e){return[...e].sort((e,t)=>t.id.length-e.id.length||e.id.localeCompare(t.id))}function lt(e){if(!st())return;let t=D(ot());if(!t||t.length===0)return;let n=e.toLowerCase();return t.find(e=>e.id.toLowerCase()===n)||t.find(e=>n.includes(e.id.toLowerCase()))}async function ut(){if(st()&&!be())try{let e=await tt({maxRetries:1}),t=[];for await(let n of e.models.list()){let e=E().safeParse(n);e.success&&t.push(e.data)}if(t.length===0)return;let n=ot(),r=ct(t);if(Xe(D(n),r)){h(`[modelCapabilities] cache unchanged, skipping write`);return}await Ae(at(),{recursive:!0}),await je(n,ue({models:r,timestamp:Date.now()}),{encoding:`utf-8`,mode:384}),D.cache.delete(n),h(`[modelCapabilities] cached ${r.length} models`)}catch(e){h(`[modelCapabilities] fetch failed: ${e instanceof Error?e.message:`unknown`}`)}}var E,dt,D,ft=e((()=>{Ze(),r(),d(),it(),pe(),o(),p(),ne(),ye(),me(),x(),E=re(()=>u({id:te(),max_input_tokens:l().optional(),max_tokens:l().optional()}).strip()),dt=re(()=>u({models:c(E()),timestamp:l()})),D=n(e=>{try{let t=Oe(e,`utf-8`),n=dt().safeParse(f(t,!1));return n.success?n.data.models:null}catch{return null}},e=>e)}));function O(){return a(process.env.CLAUDE_CODE_DISABLE_1M_CONTEXT)}function k(e){return!O()&&/\[1m\]/i.test(e)}function pt(e){if(O())return!1;let t=Z(e);return t.includes(`claude-sonnet-4`)||t.includes(`opus-4-6`)||t.includes(`opus-4-7`)}function mt(e,t){if(k(e))return 1e6;let n=lt(e);return n?.max_input_tokens&&n.max_input_tokens>=1e5?n.max_input_tokens>2e5&&O()?A:n.max_input_tokens:t?.includes(`context-1m-2025-08-07`)&&pt(e)||ht(e)?1e6:A}function ht(e){return O()||k(e)||!Z(e).includes(`sonnet-4-6`)?!1:ve().clientDataCache?.coral_reef_sonnet===`true`}function gt(e,t){if(!e)return{used:null,remaining:null};let n=e.input_tokens+e.cache_creation_input_tokens+e.cache_read_input_tokens;if(n===0)return{used:null,remaining:null};let r=Math.round(n/t*100),i=Math.min(100,Math.max(0,r));return{used:i,remaining:100-i}}function _t(e){let t,n,r=Z(e);r.includes(`opus-4-7`)||r.includes(`opus-4-6`)?(t=64e3,n=128e3):r.includes(`sonnet-4-6`)?(t=32e3,n=128e3):r.includes(`opus-4-5`)||r.includes(`sonnet-4`)||r.includes(`haiku-4`)?(t=32e3,n=64e3):r.includes(`opus-4-1`)||r.includes(`opus-4`)?(t=32e3,n=32e3):r.includes(`claude-3-opus`)?(t=4096,n=4096):r.includes(`claude-3-sonnet`)?(t=8192,n=8192):r.includes(`claude-3-haiku`)?(t=4096,n=4096):r.includes(`3-5-sonnet`)||r.includes(`3-5-haiku`)?(t=8192,n=8192):r.includes(`3-7-sonnet`)?(t=32e3,n=64e3):(t=bt,n=xt);let i=lt(e);return i?.max_tokens&&i.max_tokens>=4096&&(n=i.max_tokens,t=Math.min(t,n)),{default:t,upperLimit:n}}function vt(e){return _t(e).upperLimit-1}var A,yt,bt,xt,St,Ct=e((()=>{Ye(),_e(),o(),$(),ft(),A=2e5,yt=2e4,bt=32e3,xt=64e3,St=8e3}));function wt(e){let t=[],n=!1;async function r(){if(!n&&t.length!==0){for(n=!0;t.length>0;){let{args:n,resolve:r,reject:i,context:a}=t.shift();try{r(await e.apply(a,n))}catch(e){i(e)}}n=!1,t.length>0&&r()}}return function(...e){return new Promise((n,i)=>{t.push({args:e,resolve:n,reject:i,context:this}),r()})}}var Tt=e((()=>{}));function Et(e,t){return e.find(e=>e.includes(t))??null}async function Dt(){let{BedrockClient:e}=await import(`./dist-es-BXXmyhQ2.js`),t=s(),n=a(process.env.CLAUDE_CODE_SKIP_BEDROCK_AUTH);return new e({region:t,...process.env.ANTHROPIC_BEDROCK_BASE_URL&&{endpoint:process.env.ANTHROPIC_BEDROCK_BASE_URL},...await Ee(),...n&&{requestHandler:new(await(import(`./dist-es-C7vygWzp.js`))).NodeHttpHandler,httpAuthSchemes:[{schemeId:`smithy.api#noAuth`,identityProvider:()=>async()=>({}),signer:new(await(import(`./dist-es-gUzZ_7Vf.js`))).NoAuthSigner}],httpAuthSchemeProvider:()=>[{schemeId:`smithy.api#noAuth`}]}})}async function Ot(){let{BedrockRuntimeClient:e}=await import(`./dist-es-CzTYn7xo.js`),t=s(),n=a(process.env.CLAUDE_CODE_SKIP_BEDROCK_AUTH);return new e({region:t,...process.env.ANTHROPIC_BEDROCK_BASE_URL&&{endpoint:process.env.ANTHROPIC_BEDROCK_BASE_URL},...await Ee(),...n&&{requestHandler:new(await(import(`./dist-es-C7vygWzp.js`))).NodeHttpHandler,httpAuthSchemes:[{schemeId:`smithy.api#noAuth`,identityProvider:()=>async()=>({}),signer:new(await(import(`./dist-es-gUzZ_7Vf.js`))).NoAuthSigner}],httpAuthSchemeProvider:()=>[{schemeId:`smithy.api#noAuth`}]}})}function kt(e){return e.startsWith(`anthropic.`)}function At(e){if(!e.startsWith(`arn:`))return e;let t=e.lastIndexOf(`/`);return t===-1?e:e.substring(t+1)}function jt(e){let t=At(e);for(let e of Pt)if(t.startsWith(`${e}.anthropic.`))return e}function Mt(e,t){let n=jt(e);return n?e.replace(`${n}.`,`${t}.`):kt(e)?`${t}.${e}`:e}var j,Nt,Pt,Ft=e((()=>{r(),o(),xe(),we(),j=n(async()=>{let[e,{ListInferenceProfilesCommand:t}]=await Promise.all([Dt(),import(`./dist-es-BXXmyhQ2.js`)]),n=[],r;try{do{let i=new t({...r&&{nextToken:r},typeEquals:`SYSTEM_DEFINED`}),a=await e.send(i);a.inferenceProfileSummaries&&n.push(...a.inferenceProfileSummaries),r=a.nextToken}while(r);return n.filter(e=>e.inferenceProfileId?.includes(`anthropic`)).map(e=>e.inferenceProfileId).filter(Boolean)}catch(e){throw v(e),e}}),Nt=n(async e=>{try{let[t,{GetInferenceProfileCommand:n}]=await Promise.all([Dt(),import(`./dist-es-BXXmyhQ2.js`)]),r=new n({inferenceProfileIdentifier:e}),i=await t.send(r);if(!i.models||i.models.length===0)return null;let a=i.models[0];if(!a?.modelArn)return null;let o=a.modelArn.lastIndexOf(`/`);return o>=0?a.modelArn.substring(o+1):a.modelArn}catch(e){return v(e),null}}),Pt=[`us`,`eu`,`apac`,`global`]})),M,N,P,F,I,L,R,z,B,It,Lt,Rt,V,zt,Bt=e((()=>{M={firstParty:`claude-3-7-sonnet-20250219`,bedrock:`us.anthropic.claude-3-7-sonnet-20250219-v1:0`,vertex:`claude-3-7-sonnet@20250219`,foundry:`claude-3-7-sonnet`,openai:`claude-3-7-sonnet-20250219`,gemini:`claude-3-7-sonnet-20250219`,grok:`claude-3-7-sonnet-20250219`},N={firstParty:`claude-3-5-sonnet-20241022`,bedrock:`anthropic.claude-3-5-sonnet-20241022-v2:0`,vertex:`claude-3-5-sonnet-v2@20241022`,foundry:`claude-3-5-sonnet`,openai:`claude-3-5-sonnet-20241022`,gemini:`claude-3-5-sonnet-20241022`,grok:`claude-3-5-sonnet-20241022`},P={firstParty:`claude-3-5-haiku-20241022`,bedrock:`us.anthropic.claude-3-5-haiku-20241022-v1:0`,vertex:`claude-3-5-haiku@20241022`,foundry:`claude-3-5-haiku`,openai:`claude-3-5-haiku-20241022`,gemini:`claude-3-5-haiku-20241022`,grok:`claude-3-5-haiku-20241022`},F={firstParty:`claude-haiku-4-5-20251001`,bedrock:`us.anthropic.claude-haiku-4-5-20251001-v1:0`,vertex:`claude-haiku-4-5@20251001`,foundry:`claude-haiku-4-5`,openai:`claude-haiku-4-5-20251001`,gemini:`claude-haiku-4-5-20251001`,grok:`claude-haiku-4-5-20251001`},I={firstParty:`claude-sonnet-4-20250514`,bedrock:`us.anthropic.claude-sonnet-4-20250514-v1:0`,vertex:`claude-sonnet-4@20250514`,foundry:`claude-sonnet-4`,openai:`claude-sonnet-4-20250514`,gemini:`claude-sonnet-4-20250514`,grok:`claude-sonnet-4-20250514`},L={firstParty:`claude-sonnet-4-5-20250929`,bedrock:`us.anthropic.claude-sonnet-4-5-20250929-v1:0`,vertex:`claude-sonnet-4-5@20250929`,foundry:`claude-sonnet-4-5`,openai:`claude-sonnet-4-5-20250929`,gemini:`claude-sonnet-4-5-20250929`,grok:`claude-sonnet-4-5-20250929`},R={firstParty:`claude-opus-4-20250514`,bedrock:`us.anthropic.claude-opus-4-20250514-v1:0`,vertex:`claude-opus-4@20250514`,foundry:`claude-opus-4`,openai:`claude-opus-4-20250514`,gemini:`claude-opus-4-20250514`,grok:`claude-opus-4-20250514`},z={firstParty:`claude-opus-4-1-20250805`,bedrock:`us.anthropic.claude-opus-4-1-20250805-v1:0`,vertex:`claude-opus-4-1@20250805`,foundry:`claude-opus-4-1`,openai:`claude-opus-4-1-20250805`,gemini:`claude-opus-4-1-20250805`,grok:`claude-opus-4-1-20250805`},B={firstParty:`claude-opus-4-5-20251101`,bedrock:`us.anthropic.claude-opus-4-5-20251101-v1:0`,vertex:`claude-opus-4-5@20251101`,foundry:`claude-opus-4-5`,openai:`claude-opus-4-5-20251101`,gemini:`claude-opus-4-5-20251101`,grok:`claude-opus-4-5-20251101`},It={firstParty:`claude-opus-4-6`,bedrock:`us.anthropic.claude-opus-4-6-v1`,vertex:`claude-opus-4-6`,foundry:`claude-opus-4-6`,openai:`claude-opus-4-6`,gemini:`claude-opus-4-6`,grok:`claude-opus-4-6`},Lt={firstParty:`claude-opus-4-7`,bedrock:`us.anthropic.claude-opus-4-7-v1`,vertex:`claude-opus-4-7`,foundry:`claude-opus-4-7`,openai:`claude-opus-4-7`,gemini:`claude-opus-4-7`,grok:`claude-opus-4-7`},Rt={firstParty:`claude-sonnet-4-6`,bedrock:`us.anthropic.claude-sonnet-4-6`,vertex:`claude-sonnet-4-6`,foundry:`claude-sonnet-4-6`,openai:`claude-sonnet-4-6`,gemini:`claude-sonnet-4-6`,grok:`claude-sonnet-4-6`},V={haiku35:P,haiku45:F,sonnet35:N,sonnet37:M,sonnet40:I,sonnet45:L,sonnet46:Rt,opus40:R,opus41:z,opus45:B,opus46:It,opus47:Lt},Object.values(V).map(e=>e.firstParty),zt=Object.fromEntries(Object.entries(V).map(([e,t])=>[t.firstParty,e]))}));function H(e){let t={};for(let n of Kt)t[n]=V[n][e];return t}async function Vt(){let e=H(`bedrock`),t;try{t=await j()}catch(t){return v(t),e}if(!t?.length)return e;let n={};for(let r of Kt){let i=V[r].firstParty;n[r]=Et(t,i)||e[r]}return n}function Ht(e){let t=ge().modelOverrides;if(!t)return e;let n={...e};for(let[e,r]of Object.entries(t)){let t=zt[e];t&&r&&(n[t]=r)}return n}function Ut(e){let t;try{t=ge().modelOverrides}catch{return e}if(!t)return e;for(let[n,r]of Object.entries(t))if(r===e)return n;return e}function Wt(){if(m()===null){if(y()!==`bedrock`){ae(H(y()));return}qt()}}function U(){let e=m();return e===null?(Wt(),Ht(H(y()))):Ht(e)}async function Gt(){if(m()===null){if(y()!==`bedrock`){ae(H(y()));return}await qt()}}var Kt,qt,W=e((()=>{ie(),xe(),Tt(),_(),Ft(),Bt(),x(),Kt=Object.keys(V),qt=wt(async()=>{if(m()===null)try{ae(await Vt())}catch(e){v(e)}})}));function G(e){return Jt.includes(e)}function K(e){return Yt.includes(e)}var Jt,Yt,Xt=e((()=>{Jt=[`sonnet`,`opus`,`haiku`,`best`,`sonnet[1m]`,`opus[1m]`,`opusplan`],Yt=[`sonnet`,`opus`,`haiku`]}));function Zt(e,t){return e.includes(t)?!0:G(e)?Q(e).toLowerCase().includes(t):!1}function Qt(e,t){return e.startsWith(t)?e.length===t.length||e[t.length]===`-`:!1}function $t(e,t){let n=G(e)?Q(e).toLowerCase():e;return!!(Qt(n,t)||!t.startsWith(`claude-`)&&Qt(n,`claude-${t}`))}function en(e,t){for(let n of t){if(K(n))continue;let t=n.indexOf(e);if(t===-1)continue;let r=t+e.length;if(r===n.length||n[r]===`-`)return!0}return!1}function tn(e){let{availableModels:t}=he()||{};if(!t)return!0;if(t.length===0)return!1;let n=Ut(e).trim().toLowerCase(),r=t.map(e=>e.trim().toLowerCase());if(r.includes(n)&&(!K(n)||!en(n,r)))return!0;for(let e of r)if(K(e)&&!en(e,r)&&Zt(n,e))return!0;if(G(n)){let e=Q(n).toLowerCase();if(r.includes(e))return!0}for(let e of r)if(!K(e)&&G(e)&&Q(e).toLowerCase()===n)return!0;for(let e of r)if(!K(e)&&!G(e)&&$t(n,e))return!0;return!1}var nn=e((()=>{_(),Xt(),$(),W()}));function q(){return process.env.OPENAI_AUTH_MODE===`chatgpt`}var rn,an,on=e((()=>{rn=`gpt-5.5`,an=`gpt-5.4-mini`}));function sn(){let e=y();return e===`openai`&&q()?process.env.OPENAI_SMALL_FAST_MODEL??`gpt-5.4-mini`:e===`openai`&&process.env.OPENAI_SMALL_FAST_MODEL?process.env.OPENAI_SMALL_FAST_MODEL:e===`gemini`&&process.env.GEMINI_SMALL_FAST_MODEL?process.env.GEMINI_SMALL_FAST_MODEL:process.env.ANTHROPIC_SMALL_FAST_MODEL||fn()}function cn(e){return e===U().opus40||e===U().opus41||e===U().opus45||e===U().opus46||e===U().opus47}function J(){let e,t=oe();if(t!==void 0)e=t;else{let t=he()||{};e=process.env.ANTHROPIC_MODEL||t.model||void 0}if(!(e&&!tn(e)))return e}function ln(){let e=J();return e==null?hn():Q(e)}function un(){return Y()}function dn(){let e=y();if(e===`openai`)return process.env.OPENAI_MODEL;if(e===`gemini`)return process.env.GEMINI_MODEL;if(e===`grok`)return process.env.GROK_MODEL}function Y(){let e=y();return e===`openai`&&q()?rn:e===`openai`&&process.env.OPENAI_DEFAULT_OPUS_MODEL?process.env.OPENAI_DEFAULT_OPUS_MODEL:e===`gemini`&&process.env.GEMINI_DEFAULT_OPUS_MODEL?process.env.GEMINI_DEFAULT_OPUS_MODEL:process.env.ANTHROPIC_DEFAULT_OPUS_MODEL?process.env.ANTHROPIC_DEFAULT_OPUS_MODEL:dn()||U().opus47}function X(){let e=y();return e===`openai`&&q()?rn:e===`openai`&&process.env.OPENAI_DEFAULT_SONNET_MODEL?process.env.OPENAI_DEFAULT_SONNET_MODEL:e===`gemini`&&process.env.GEMINI_DEFAULT_SONNET_MODEL?process.env.GEMINI_DEFAULT_SONNET_MODEL:process.env.ANTHROPIC_DEFAULT_SONNET_MODEL?process.env.ANTHROPIC_DEFAULT_SONNET_MODEL:dn()||(e===`firstParty`?U().sonnet46:U().sonnet45)}function fn(){let e=y();return e===`openai`&&q()?an:e===`openai`&&process.env.OPENAI_DEFAULT_HAIKU_MODEL?process.env.OPENAI_DEFAULT_HAIKU_MODEL:e===`gemini`&&process.env.GEMINI_DEFAULT_HAIKU_MODEL?process.env.GEMINI_DEFAULT_HAIKU_MODEL:process.env.ANTHROPIC_DEFAULT_HAIKU_MODEL?process.env.ANTHROPIC_DEFAULT_HAIKU_MODEL:dn()||U().haiku45}function pn(e){let{permissionMode:t,mainLoopModel:n,exceeds200kTokens:r=!1}=e;return J()===`opusplan`&&t===`plan`&&!r?Y():J()===`haiku`&&t===`plan`?X():n}function mn(){return X()}function hn(){return Q(mn())}function gn(e){if(e=e.toLowerCase(),e.includes(`claude-opus-4-7`))return`claude-opus-4-7`;if(e.includes(`claude-opus-4-6`))return`claude-opus-4-6`;if(e.includes(`claude-opus-4-5`))return`claude-opus-4-5`;if(e.includes(`claude-opus-4-1`))return`claude-opus-4-1`;if(e.includes(`claude-opus-4`))return`claude-opus-4`;if(e.includes(`claude-sonnet-4-6`))return`claude-sonnet-4-6`;if(e.includes(`claude-sonnet-4-5`))return`claude-sonnet-4-5`;if(e.includes(`claude-sonnet-4`))return`claude-sonnet-4`;if(e.includes(`claude-haiku-4-5`))return`claude-haiku-4-5`;if(e.includes(`claude-3-7-sonnet`))return`claude-3-7-sonnet`;if(e.includes(`claude-3-5-sonnet`))return`claude-3-5-sonnet`;if(e.includes(`claude-3-5-haiku`))return`claude-3-5-haiku`;if(e.includes(`claude-3-opus`))return`claude-3-opus`;if(e.includes(`claude-3-sonnet`))return`claude-3-sonnet`;if(e.includes(`claude-3-haiku`))return`claude-3-haiku`;let t=e.match(/(claude-(\d+-\d+-)?\w+)/);return t?.[1]?t[1]:e}function Z(e){return gn(Ut(e))}function _n(e){return e===`opusplan`?`Opus 4.7 in plan mode, else Sonnet 4.6`:xn(Q(e))}function vn(){return!(O()||y()!==`firstParty`||!b())}function yn(e){return e===`opusplan`?`Opus Plan`:G(e)?Se(e):xn(e)}function bn(e){switch(e){case U().opus47:return`Opus 4.7`;case`${U().opus47}[1m]`:return`Opus 4.7 (1M context)`;case U().opus46:return`Opus 4.6`;case`${U().opus46}[1m]`:return`Opus 4.6 (1M context)`;case U().opus45:return`Opus 4.5`;case U().opus41:return`Opus 4.1`;case U().opus40:return`Opus 4`;case`${U().sonnet46}[1m]`:return`Sonnet 4.6 (1M context)`;case U().sonnet46:return`Sonnet 4.6`;case`${U().sonnet45}[1m]`:return`Sonnet 4.5 (1M context)`;case U().sonnet45:return`Sonnet 4.5`;case U().sonnet40:return`Sonnet 4`;case`${U().sonnet40}[1m]`:return`Sonnet 4 (1M context)`;case U().sonnet37:return`Sonnet 3.7`;case U().sonnet35:return`Sonnet 3.5`;case U().haiku45:return`Haiku 4.5`;case U().haiku35:return`Haiku 3.5`;default:return null}}function xn(e){return bn(e)||e}function Q(e){let t=e.trim(),n=t.toLowerCase(),r=k(n),i=r?n.replace(/\[1m]$/i,``).trim():n;if(G(i))switch(i){case`opusplan`:return X()+(r?`[1m]`:``);case`sonnet`:return X()+(r?`[1m]`:``);case`haiku`:return fn()+(r?`[1m]`:``);case`opus`:return Y()+(r?`[1m]`:``);case`best`:return un();default:}return y()===`firstParty`&&Cn(i)&&wn()?Y()+(r?`[1m]`:``):r?`${t.replace(/\[1m\]$/i,``).trim()}[1m]`:t}function Sn(e,t){return k(e)||!k(t)?e:pt(Q(e))?`${e}[1m]`:e}function Cn(e){return On.includes(e)}function wn(){return!a(process.env.CLAUDE_CODE_DISABLE_LEGACY_MODEL_REMAP)}function Tn(e){if(e===null)return`Default (${hn()})`;let t=Q(e);return e===t?t:`${e} (${t})`}function En(e){if(y()===`foundry`)return;let t=e.toLowerCase().includes(`[1m]`),n=Z(e);if(n.includes(`claude-opus-4-7`))return t?`Opus 4.7 (with 1M context)`:`Opus 4.7`;if(n.includes(`claude-opus-4-6`))return t?`Opus 4.6 (with 1M context)`:`Opus 4.6`;if(n.includes(`claude-opus-4-5`))return`Opus 4.5`;if(n.includes(`claude-opus-4-1`))return`Opus 4.1`;if(n.includes(`claude-opus-4`))return`Opus 4`;if(n.includes(`claude-sonnet-4-6`))return t?`Sonnet 4.6 (with 1M context)`:`Sonnet 4.6`;if(n.includes(`claude-sonnet-4-5`))return t?`Sonnet 4.5 (with 1M context)`:`Sonnet 4.5`;if(n.includes(`claude-sonnet-4`))return t?`Sonnet 4 (with 1M context)`:`Sonnet 4`;if(n.includes(`claude-3-7-sonnet`))return`Work Mate 3.7 Sonnet`;if(n.includes(`claude-3-5-sonnet`))return`Work Mate 3.5 Sonnet`;if(n.includes(`claude-haiku-4-5`))return`Haiku 4.5`;if(n.includes(`claude-3-5-haiku`))return`Work Mate 3.5 Haiku`}function Dn(e){return e.replace(/\[(1|2)m\]/gi,``)}var On,$=e((()=>{ie(),Ct(),o(),W(),_(),x(),nn(),Xt(),Ce(),on(),On=[`claude-opus-4-20250514`,`claude-opus-4-1-20250805`,`claude-opus-4-0`,`claude-opus-4-1`]}));export{gt as $,P as A,Ie as At,I as B,nn as C,Ue as Ct,Gt as D,Je as Dt,Xt as E,He as Et,B as F,b as Ft,jt as G,Mt as H,It as I,kt as J,Nt as K,R as L,M,y as Mt,F as N,Ne as Nt,U as O,Ye as Ot,z as P,x as Pt,yt as Q,L as R,Sn as S,C as St,Jt as T,Be as Tt,Ot as U,Bt as V,j as W,wt as X,Tt as Y,St as Z,Dn as _,qe as _t,Y as a,Ct as at,xn as b,ze as bt,En as c,ut as ct,J as d,it as dt,mt as et,$ as f,$e as ft,Tn as g,Ke as gt,vn as h,Xe as ht,mn as i,k as it,N as j,Fe as jt,W as k,Pe as kt,pn as l,T as lt,cn as m,Ze as mt,Z as n,_t as nt,X as o,O as ot,wn as p,et as pt,Ft as q,hn as r,ht as rt,ln as s,ft as st,gn as t,vt as tt,sn as u,tt as ut,Q as v,Le as vt,tn as w,Ge as wt,yn as x,We as xt,_n as y,Re as yt,Rt as z};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{l as t,o as n}from"./envUtils-DfkgIdYf.js";import{n as r,t as i}from"./axios-DaWTGg7G.js";import{Hw as a,Uw as o,Vw as s,cv as c,lv as l}from"./loadAgentsDir-DGozQu_6.js";import{$ as u,I as d,M as f,N as ee,R as p,V as m,c as h,et as te,f as ne,i as g,u as re}from"./debug-CRnGsZOV.js";import{Wt as ie,qt as ae}from"./settings-CodSADx8.js";import{_ as oe,d as se,h as ce,o as le,v as ue,y as _}from"./config-CWPHVTic.js";import{i as v,n as y}from"./execFileNoThrow-BgRsj_SW.js";import{o as b,s as x}from"./log-DoSpAwRP.js";import{n as de}from"./analytics-COpjZpvd.js";import{j as fe,k as pe}from"./sessionTracing-D7rekMdW.js";import{C as me,E as he,S as ge,T as _e,_ as ve,a as S,b as ye,c as be,d as xe,f as Se,g as Ce,i as we,l as Te,m as Ee,n as De,o as C,p as Oe,s as ke,t as Ae,u as je,v as Me,w as Ne,x as w,y as Pe}from"./pidLock-B-SW3Nhx.js";import{homedir as T}from"os";import{basename as Fe,delimiter as Ie,dirname as E,join as D,resolve as O}from"path";import{constants as Le}from"fs";import{createHash as Re}from"crypto";import{access as k,chmod as A,copyFile as j,mkdir as M,readdir as N,readlink as P,rename as F,rm as I,rmdir as ze,stat as L,symlink as Be,unlink as R,writeFile as z}from"fs/promises";async function Ve(e=`latest`,t,n){let i=Date.now();try{let a=await r.get(`${t}/${e}`,{timeout:3e4,responseType:`text`,...n});return Date.now()-i,a.data.trim()}catch(n){Date.now()-i;let a=n instanceof Error?n.message:String(n);r.isAxiosError(n)&&n.response&&n.response.status,a.includes(`timeout`);let o=Error(`Failed to fetch version from ${t}/${e}: ${a}`);throw x(o),o}}async function He(e){if(/^v?\d+\.\d+\.\d+(-\S+)?$/.test(e)){let t=e.startsWith(`v`)?e.slice(1):e;if(/^99\.99\./.test(t))throw Error(`Version ${t} is not available for installation. Use 'stable' or 'latest'.`);return t}let t=e;if(t!==`stable`&&t!==`latest`)throw Error(`Invalid channel: ${e}. Use 'stable' or 'latest'`);return Ve(t,B)}function Ue(){return Number(process.env.CLAUDE_CODE_STALL_TIMEOUT_MS_FOR_TESTING)||V}async function We(e,t,n,i={}){let a;for(let o=1;o<=H;o++){let s=new AbortController,c,u=()=>{c&&(clearTimeout(c),c=void 0)},d=()=>{u(),c=setTimeout(e=>e.abort(),Ue(),s)};try{d();let a=await r.get(e,{timeout:5*6e4,responseType:`arraybuffer`,signal:s.signal,onDownloadProgress:()=>{d()},...i});u();let o=Re(`sha256`);o.update(a.data);let c=o.digest(`hex`);if(c!==t)throw Error(`Checksum mismatch: expected ${t}, got ${c}`);await z(n,Buffer.from(a.data)),await A(n,493);return}catch(e){u();let t=r.isCancel(e);if(a=t?new U:m(e),t&&o<H){h(`Download stalled on attempt ${o}/${H}, retrying...`),await l(1e3);continue}throw a}}throw a??Error(`Download failed after all retries`)}async function Ge(e,t,n,i){let a=re();await a.rm(t,{recursive:!0,force:!0});let o=W(),s=Date.now(),c;try{c=(await r.get(`${n}/${e}/manifest.json`,{timeout:1e4,responseType:`json`,...i})).data}catch(t){Date.now()-s;let i=t instanceof Error?t.message:String(t);throw r.isAxiosError(t)&&t.response&&t.response.status,i.includes(`timeout`),x(Error(`Failed to fetch manifest from ${n}/${e}/manifest.json: ${i}`)),t}let l=c.platforms[o];if(!l)throw Error(`Platform ${o} not found in manifest for version ${e}`);let u=l.checksum,d=G(o),f=`${n}/${e}/${o}/${d}`;await a.mkdir(t);let ee=D(t,d);try{await We(f,u,ee,i||{}),Date.now()-s}catch(e){Date.now()-s;let t=e instanceof Error?e.message:String(e);throw r.isAxiosError(e)&&e.response&&e.response.status,t.includes(`timeout`),t.includes(`Checksum mismatch`),x(Error(`Failed to download binary from ${f}: ${t}`)),e}}async function Ke(e,t){return await Ge(e,t,B),`binary`}var B,V,H,U,qe=e((()=>{i(),de(),g(),d(),v(),ne(),b(),c(),$(),B=`https://storage.googleapis.com/claude-code-dist-86c565f3-f756-42ad-8dfa-d59b1c096819/claude-code-releases`,V=6e4,H=3,U=class extends Error{constructor(){super(`Download stalled: no data received for 60 seconds`),this.name=`StallTimeoutError`}}}));function W(){let e=ie.platform,t=process.arch===`x64`?`x64`:process.arch===`arm64`?`arm64`:null;if(!t){let e=Error(`Unsupported architecture: ${process.arch}`);throw h(`Native installer does not support architecture: ${process.arch}`,{level:`error`}),e}return e===`linux`&&pe.isMuslEnvironment()?`linux-${t}-musl`:`${e}-${t}`}function G(e){return e.startsWith(`win32`)?`claude.exe`:`claude`}function K(){let e=G(W());return{versions:D(xe(),`claude`,`versions`),staging:D(je(),`claude`,`staging`),locks:D(Se(),`claude`,`locks`),executable:D(Te(),e)}}async function q(e){try{let t=await L(e);return!t.isFile()||t.size===0?!1:(await k(e,Le.X_OK),!0)}catch{return!1}}async function J(e){let t=K(),n=[t.versions,t.staging,t.locks];await Promise.all(n.map(e=>M(e,{recursive:!0}))),await M(E(t.executable),{recursive:!0});let r=D(t.versions,e);try{await L(r)}catch{await z(r,``,{encoding:`utf8`})}return{stagingPath:D(t.staging,e),installPath:r}}async function Je(e,t,n=0){let r=K(),i=Y(r,e);if(await M(r.locks,{recursive:!0}),C()){let r=0,a=n+1,o=n>0?1e3:100,s=n>0?5e3:500;for(;r<a;){if(await be(e,i,async()=>{try{await t()}catch(e){throw x(e),e}}))return r+1,!0;r++,r<a&&await l(Math.min(o*2**(r-1),s))}return X(e,Error(`Lock held by another process`)),!1}let a=null;try{try{a=await _(e,{stale:Z,retries:{retries:n,minTimeout:n>0?1e3:100,maxTimeout:n>0?5e3:500},lockfilePath:i,onCompromised:e=>{h(`NON-FATAL: Version lock was compromised during operation: ${e.message}`,{level:`info`})}})}catch(t){return X(e,t),!1}try{return await t(),!0}catch(e){throw x(e),e}}finally{a&&await a()}}async function Ye(e,t){await M(E(t),{recursive:!0});let n=`${t}.tmp.${process.pid}.${Date.now()}`;try{await j(e,n),await A(n,493),await F(n,t),h(`Atomically installed binary to ${t}`)}catch(e){try{await R(n)}catch{}throw e}}async function Xe(e,t){try{let n=D(e,`node_modules`,`@anthropic-ai`),r=(await N(n)).find(e=>e.startsWith(`claude-cli-native-`));if(!r)throw Error(`Could not find platform-specific native package`);let i=D(n,r,`cli`);try{await L(i)}catch{throw Error(`Native binary not found in staged package`)}await Ye(i,t),await I(e,{recursive:!0,force:!0})}catch(e){let t=f(e);throw!t.includes(`Could not find platform-specific`)&&t.includes(`Native binary not found`),x(m(e)),e}}async function Ze(e,t){try{let n=D(e,G(W()));try{await L(n)}catch{throw Error(`Staged binary not found`)}await Ye(n,t),await I(e,{recursive:!0,force:!0})}catch(e){throw f(e).includes(`Staged binary not found`),x(m(e)),e}}async function Qe(e,t,n){n===`npm`?await Xe(e,t):await Ze(e,t)}async function $e(e,n){let{stagingPath:r,installPath:i}=await J(e),{executable:a}=K(),o=t(process.env.ENABLE_LOCKLESS_UPDATES)?`${r}.${process.pid}.${Date.now()}`:r,s=!await et(e)||n;if(s?(h(n?`Force reinstalling native installer version ${e}`:`Downloading native installer version ${e}`),await Qe(o,i,await Ke(e,o))):h(`Version ${e} already installed, updating symlink`),await nt(a),await rt(a,i),!await q(a)){let e=!1;try{await L(i),e=!0}catch{}throw Error(`Failed to create executable at ${a}. Source file exists: ${e}. Check write permissions to ${a}.`)}return s}async function et(e){let{installPath:t}=await J(e);return q(t)}async function tt(e,n=!1){let r=Date.now(),i=await He(e),{executable:o}=K();if(h(`Checking for native installer update to version ${i}`),!n){let e=await ve();if(e&&s(i,e)){if(h(`Native installer: maxVersion ${e} is set, capping update from ${i} to ${e}`),a(`0.0.25`,e))return h(`Native installer: current version 0.0.25 is already at or above maxVersion ${e}, skipping update`),Date.now()-r,{success:!0,latestVersion:i};i=e}}if(!n&&i===`0.0.25`&&await et(i)&&await q(o))return h(`Found ${i} at ${o}, skipping install`),Date.now()-r,{success:!0,latestVersion:i};if(!n&&Pe(i))return Date.now()-r,{success:!0,latestVersion:i};if(t(process.env.ENABLE_LOCKLESS_UPDATES))await $e(i,n),Date.now()-r;else{let{installPath:e}=await J(i);n&&await lt(e);let t=await Je(e,async()=>{await $e(i,n)},3);if(Date.now()-r,!t){let t=K(),n;if(C()){let r=Y(t,e);S(r)&&(n=ke(r)?.pid)}return{success:!1,latestVersion:i,lockFailed:!0,lockHolderPid:n}}}return h(`Successfully updated to version ${i}`),{success:!0,latestVersion:i}}async function nt(e){try{await ze(e),h(`Removed empty directory at ${e}`)}catch(t){let n=ee(t);n!==`ENOTDIR`&&n!==`ENOENT`&&n!==`ENOTEMPTY`&&h(`Could not remove directory at ${e}: ${t}`)}}async function rt(e,t){if(W().startsWith(`win32`))try{await M(E(e),{recursive:!0});let n;try{n=await L(e)}catch{}if(n){try{let e=await L(t);if(n.size===e.size)return!1}catch{}let r=`${e}.old.${Date.now()}`;await F(e,r);try{await j(t,e);try{await R(r)}catch{}}catch(t){try{await F(r,e)}catch(e){let n=Error(`Failed to restore old executable: ${e}`,{cause:t});throw x(n),n}throw t}}else try{await j(t,e)}catch(e){throw p(e)?Error(`Source file does not exist: ${t}`):e}return!0}catch(n){return x(Error(`Failed to copy executable from ${t} to ${e}: ${n}`)),!1}let n=E(e);try{await M(n,{recursive:!0}),h(`Created directory ${n} for symlink`)}catch(e){return x(Error(`Failed to create directory ${n}: ${e}`)),!1}try{let n=!1;try{await L(e),n=!0}catch{}if(n){try{let n=await P(e);if(O(E(e),n)===O(t))return!1}catch{}await R(e)}}catch(e){x(Error(`Failed to check/remove existing symlink: ${e}`))}let r=`${e}.tmp.${process.pid}.${Date.now()}`;try{return await Be(t,r),await F(r,e),h(`Atomically updated symlink ${e} -> ${t}`),!0}catch(n){try{await R(r)}catch{}return x(Error(`Failed to create symlink from ${e} to ${t}: ${n}`)),!1}}async function it(e=!1){if(t(process.env.DISABLE_INSTALLATION_CHECKS))return[];let n=await Ee();if(n===`development`||!(e||n===`native`))return[];let r=K(),i=[],a=E(r.executable),o=O(a),s=W().startsWith(`win32`);try{await k(a)}catch{i.push({message:`installMethod is native, but directory ${a} does not exist`,userActionRequired:!0,type:`error`})}if(s)await q(r.executable)||i.push({message:`installMethod is native, but claude command is missing or invalid at ${r.executable}`,userActionRequired:!0,type:`error`});else try{let e=await P(r.executable);await q(O(E(r.executable),e))||i.push({message:`Work Mate symlink points to missing or invalid binary: ${e}`,userActionRequired:!0,type:`error`})}catch(e){p(e)?i.push({message:`installMethod is native, but claude command not found at ${r.executable}`,userActionRequired:!0,type:`error`}):await q(r.executable)||i.push({message:`${r.executable} exists but is not a valid Work Mate binary`,userActionRequired:!0,type:`error`})}if(!(process.env.PATH||``).split(Ie).some(e=>{try{let t=O(e);return s?t.toLowerCase()===o.toLowerCase():t===o}catch{return!1}}))if(s){let e=a.replace(/\//g,`\\`);i.push({message:`Native installation exists but ${e} is not in your PATH. Add it by opening: System Properties → Environment Variables → Edit User PATH → New → Add the path above. Then restart your terminal.`,userActionRequired:!0,type:`path`})}else{let e=_e(),t=w()[e],n=t?t.replace(T(),`~`):`your shell config file`;i.push({message:`Native installation exists but ~/.local/bin is not in your PATH. Run:\n\necho 'export PATH="$HOME/.local/bin:$PATH"' >> ${n} && source ${n}`,userActionRequired:!0,type:`path`})}return i}function at(e,t=!1){if(t)return ot(e,t);if(Q)return h(`installLatest: joining in-flight call`),Q;let n=ot(e,t);Q=n;let r=()=>{Q=null};return n.then(r,r),n}async function ot(e,t=!1){let n=await tt(e,t);return n.success?(le().installMethod!==`native`&&(ce(e=>({...e,installMethod:`native`,autoUpdates:!1,autoUpdatesProtectedForNative:!0})),h(`Native installer: Set installMethod to "native" and disabled legacy auto-updater for protection`)),ut(),{latestVersion:n.latestVersion,wasUpdated:n.success,lockFailed:!1}):{latestVersion:null,wasUpdated:!1,lockFailed:n.lockFailed,lockHolderPid:n.lockHolderPid}}async function st(e){try{let t=await P(e),n=O(E(e),t);if(await q(n))return n}catch{}return null}function Y(e,t){let n=Fe(t);return D(e.locks,`${n}.lock`)}async function ct(){let e=K();if(!process.execPath.includes(e.versions))return;let t=O(process.execPath);try{let n=Y(e,t);if(await M(e.locks,{recursive:!0}),C()){if(!await Ae(t,n)){X(t,Error(`Lock already held by another process`));return}h(`Acquired PID lock on running version: ${t}`)}else{let e;try{e=await _(t,{stale:Z,retries:0,lockfilePath:n,onCompromised:e=>{h(`NON-FATAL: Lock on running version was compromised: ${e.message}`,{level:`info`})}}),h(`Acquired mtime-based lock on running version: ${t}`),te(async()=>{try{await e?.()}catch{}})}catch(e){if(p(e)){h(`Cannot lock current version - file does not exist: ${t}`,{level:`info`});return}X(t,e);return}}}catch(e){if(p(e)){h(`Cannot lock current version - file does not exist: ${t}`,{level:`info`});return}h(`NON-FATAL: Failed to lock current version during execution ${f(e)}`,{level:`info`})}}function X(e,t){x(Error(`NON-FATAL: Lock acquisition failed for ${e} (expected in multi-process scenarios)`,{cause:t}))}async function lt(e){let t=Y(K(),e);try{await R(t),h(`Force-removed lock file at ${t}`)}catch(e){h(`Failed to force-remove lock file: ${f(e)}`)}}async function ut(){await Promise.resolve();let e=K(),t=Date.now()-36e5;if(W().startsWith(`win32`)){let t=E(e.executable);try{let e=await N(t),n=0;for(let r of e)if(/^claude\.exe\.old\.\d+$/.test(r))try{await R(D(t,r)),n++}catch{}n>0&&h(`Cleaned up ${n} old Windows executables on startup`)}catch(e){p(e)||h(`Failed to clean up old Windows executables: ${e}`)}}try{let n=await N(e.staging),r=0;for(let i of n){let n=D(e.staging,i);try{(await L(n)).mtime.getTime()<t&&(await I(n,{recursive:!0,force:!0}),r++,h(`Cleaned up old staging directory: ${i}`))}catch{}}r>0&&h(`Cleaned up ${r} orphaned staging directories`)}catch(e){p(e)||h(`Failed to clean up staging directories: ${e}`)}if(C()){let t=De(e.locks);t>0&&h(`Cleaned up ${t} stale version locks`)}let n;try{n=await N(e.versions)}catch(e){p(e)||h(`Failed to readdir versions directory: ${e}`);return}let r=[],i=0;for(let a of n){let n=D(e.versions,a);if(/\.tmp\.\d+\.\d+$/.test(a)){try{(await L(n)).mtime.getTime()<t&&(await R(n),i++,h(`Cleaned up orphaned temp install file: ${a}`))}catch{}continue}try{let e=await L(n);if(!e.isFile()||process.platform!==`win32`&&e.size>0&&!(e.mode&73))continue;r.push({name:a,path:n,resolvedPath:O(n),mtime:e.mtime})}catch{}}if(i>0&&h(`Cleaned up ${i} orphaned temp install files`),r.length!==0)try{let t=process.execPath,n=new Set;t?.includes(e.versions)&&n.add(O(t));let i=await st(e.executable);i&&n.add(i);for(let t of r){if(n.has(t.resolvedPath))continue;let r=Y(e,t.resolvedPath),i=!1;if(C())i=S(r);else try{i=await oe(t.resolvedPath,{stale:Z,lockfilePath:r})}catch{i=!1}i&&(n.add(t.resolvedPath),h(`Protecting locked version from cleanup: ${t.name}`))}let a=r.filter(e=>!n.has(e.resolvedPath)).sort((e,t)=>t.mtime.getTime()-e.mtime.getTime()).slice(2);if(a.length===0){r.length,n.size;return}let o=0,s=0,c=0;await Promise.all(a.map(async e=>{try{await Je(e.path,async()=>{await R(e.path)})?o++:(s++,h(`Skipping deletion of ${e.name} - locked by another process`))}catch(t){c++,x(Error(`Failed to delete version ${e.name}: ${t}`))}})),r.length,n.size}catch(e){p(e)||x(Error(`Version cleanup failed: ${e}`))}}async function dt(){let e=[],t=w();for(let[n,r]of Object.entries(t))try{let t=await me(r);if(!t)continue;let{filtered:i,hadAlias:a}=ye(t);a&&(await Ne(r,i),e.push({message:`Removed claude alias from ${r}. Run: unalias claude`,userActionRequired:!0,type:`alias`}),h(`Cleaned up claude alias from ${n} config`))}catch(t){x(t),e.push({message:`Failed to clean up ${r}: ${t}`,userActionRequired:!1,type:`error`})}return e}async function ft(e){try{let t=await y(`npm`,[`config`,`get`,`prefix`]);if(t.code!==0||!t.stdout)return{success:!1,error:`Failed to get npm global prefix`};let n=t.stdout.trim(),r=!1;async function i(e,t){try{return await R(e),h(`Manually removed ${t}: ${e}`),!0}catch{return!1}}if(W().startsWith(`win32`)){let e=D(n,`claude.cmd`),t=D(n,`claude.ps1`),a=D(n,`claude`);await i(e,`bin script`)&&(r=!0),await i(t,`PowerShell script`)&&(r=!0),await i(a,`bin executable`)&&(r=!0)}else await i(D(n,`bin`,`claude`),`bin symlink`)&&(r=!0);return r?(h(`Successfully removed ${e} manually`),{success:!0,warning:`${e} executables removed, but node_modules directory was left intact for safety. You may manually delete it later at: ${W().startsWith(`win32`)?D(n,`node_modules`,e):D(n,`lib`,`node_modules`,e)}`}):{success:!1}}catch(e){return h(`Manual removal failed: ${e}`,{level:`error`}),{success:!1,error:`Manual removal failed: ${e}`}}}async function pt(e){let{code:t,stderr:n}=await y(`npm`,[`uninstall`,`-g`,e],{cwd:process.cwd()});if(t===0)return h(`Removed global npm installation of ${e}`),{success:!0};if(n&&!n.includes(`npm ERR! code E404`)){if(n.includes(`npm error code ENOTEMPTY`)){h(`Failed to uninstall global npm package ${e}: ${n}`,{level:`error`}),h(`Attempting manual removal due to ENOTEMPTY error`);let t=await ft(e);if(t.success)return{success:!0,warning:t.warning};if(t.error)return{success:!1,error:`Failed to remove global npm installation of ${e}: ${n}. Manual removal also failed: ${t.error}`}}return h(`Failed to uninstall global npm package ${e}: ${n}`,{level:`error`}),{success:!1,error:`Failed to remove global npm installation of ${e}: ${n}`}}return{success:!1}}async function mt(){let e=[],t=[],n=0,r=await pt(`@anthropic-ai/workmate`);r.success?(n++,r.warning&&t.push(r.warning)):r.error&&e.push(r.error);let i=D(T(),`.workmate`,`local`);try{await I(i,{recursive:!0}),n++,h(`Removed local installation at ${i}`)}catch(t){p(t)||(e.push(`Failed to remove ${i}: ${t}`),h(`Failed to remove local installation: ${t}`,{level:`error`}))}return{removed:n,errors:e,warnings:t}}var Z,Q,$=e((()=>{de(),Me(),u(),se(),g(),Ce(),ae(),fe(),n(),d(),v(),he(),ue(),b(),o(),ge(),c(),Oe(),qe(),we(),Z=10080*60*1e3,Q=null})),ht=e((()=>{$()}));export{dt as a,ct as c,ut as i,it as n,$ as o,mt as r,at as s,ht as t};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{c as t,l as n,o as r}from"./envUtils-DfkgIdYf.js";import{GS as i,HS as a,JS as o,Ji as s,KS as c,Sh as l,US as u,bh as d,c_ as f,ca as p,et as m,fC as h,fS as g,f_ as _,g_ as v,rt as y,ua as b,xS as x,xh as S,y_ as C}from"./loadAgentsDir-DGozQu_6.js";import{c as w,i as T}from"./debug-CRnGsZOV.js";import{at as E,nt as D}from"./model-DpZaKZMb.js";import{_n as O,bn as k,i as A,r as j,t as M,vn as N}from"./prompt-DzO1um1h.js";import{n as P,r as F}from"./client-BYFVVMcf.js";import{n as I,t as L}from"./openaiShared-G2-w4gJt.js";import{randomUUID as R}from"crypto";function z(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 B(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 V(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 H=e((()=>{r()}));function U(e,t,n,r){if(!r||S())return e;let i=t.filter(e=>n.has(e.name)).map(M).sort().join(`
|
|
2
|
-
`);return i?[x({content:`<available-deferred-tools>\n${i}\n</available-deferred-tools>`,isMeta:!0}),...e]:e}function W(e){return e.type===`assistant`||e.type===`user`}function G(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:p(l,r,i),usage:a,stop_reason:o,stop_sequence:null},requestId:void 0,type:`assistant`,uuid:R(),timestamp:new Date().toISOString()}),o===`max_tokens`&&c.push(g({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*K(e,t,n,r,a){try{let s=h(a.model),d=b(e,n),p=await l(a.model,n,a.getToolPermissionContext||(async()=>O()),a.agents||[],a.querySource),m=new Set;if(p)for(let e of n)A(e)&&m.add(e.name);let g=n;p&&m.size>0&&(g=n.filter(e=>!!(!m.has(e.name)||k(e,`SearchExtraTools`))));let _=(await Promise.all(g.map(e=>y(e,{getToolPermissionContext:a.getToolPermissionContext,tools:n,agents:a.agents,allowedAgentTypes:a.allowedAgentTypes,model:a.model,deferLoading:p&&m.has(e.name)})))).filter(e=>{let t=e;return t.type!==`advisor_20260301`&&t.type!==`computer_20250124`}),x=z(s),S=o(U(d.filter(W),n,m,p),t,{enableThinking:x}),C=c(_),T=i(a.toolChoice);if(p){let e=g.filter(e=>m.has(e.name)).length;w(`[OpenAI] Tool search enabled: ${e}/${m.size} deferred tools included, total tools=${C.length}`)}else w(`[OpenAI] Tool search disabled, total tools=${C.length}`);let{upperLimit:E}=D(s),j=B(E,a.maxOutputTokensOverride);w(`[OpenAI] Calling model=${s}, messages=${S.length}, tools=${C.length}, thinking=${x}`);let M=u(await P({maxRetries:0,fetchOverride:a.fetchOverride,source:a.querySource}).chat.completions.create(V({model:s,messages:S,tools:C,toolChoice:T,enableThinking:x,maxTokens:j,temperatureOverride:a.temperatureOverride}),{signal:r}),s),N={},F=null,L=null,R={input_tokens:0,output_tokens:0,cache_creation_input_tokens:0,cache_read_input_tokens:0},H=0,K=Date.now();for await(let e of M){switch(e.type){case`message_start`:F=e.message,H=Date.now()-K,e.message.usage&&(R={...R,...e.message.usage});break;case`content_block_start`:{let t=e.index,n=e.content_block;n.type===`tool_use`?N[t]={...n,input:``}:n.type===`text`?N[t]={...n,text:``}:n.type===`thinking`?N[t]={...n,thinking:``,signature:``}:N[t]={...n};break}case`content_block_delta`:{let t=e.index,n=e.delta,r=N[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&&(R=I(R,t)),e.delta.stop_reason!=null&&(L=e.delta.stop_reason);break}case`message_stop`:if(F){for(let e of G({partialMessage:F,contentBlocks:N,tools:n,agentId:a.agentId,usage:R,stopReason:L,maxTokens:j}))yield e;F=null}R.input_tokens+R.output_tokens>0&&f(v(s,R),R,a.model);break}yield{type:`stream_event`,event:e,...e.type===`message_start`?{ttftMs:H}:void 0}}if(F)for(let e of G({partialMessage:F,contentBlocks:N,tools:n,agentId:a.agentId,usage:R,stopReason:L,maxTokens:j}))yield e}catch(e){let t=e instanceof Error?e.message:String(e);w(`[OpenAI] Error: ${t}`,{level:`error`}),yield g({content:`API Error: ${t}`,apiError:`api_error`,error:e instanceof Error?e:Error(String(e))})}}e((()=>{F(),L(),a(),s(),m(),N(),T(),_(),C(),H(),E(),d(),j()}))();export{K as queryModelOpenAI};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{i as e,r as t}from"./parser-UqADrvxF.js";t();export{e as parseCommand};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{n as t,t as n}from"./memoize-BK3gG5ob.js";import{c as r,i,l as a,o}from"./envUtils-DfkgIdYf.js";import{DC as s,Hw as c,Uw as ee,kC as te}from"./loadAgentsDir-DGozQu_6.js";import{n as ne}from"./cwd-BvNt_018.js";import{C as re,D as ie,I as l,R as u,S as ae,T as oe,V as se,c as d,f,i as p,u as m,x as h,z as ce}from"./debug-CRnGsZOV.js";import{N as le,Qt as ue,Wt as de,Xt as fe,h as pe,j as g,qt as me,t as he}from"./settings-CodSADx8.js";import{d as _,i as ge,o as v,r as _e}from"./config-CWPHVTic.js";import{a as ve,i as y,n as b,s as ye,t as x}from"./execFileNoThrow-BgRsj_SW.js";import{o as S,s as C}from"./log-DoSpAwRP.js";import{_ as be,h as w,m as xe,v as T}from"./stringUtils-Bu_lJH5c.js";import{i as Se,n as E}from"./platform-DsMIk3eq.js";import{a as Ce,i as we}from"./ripgrep-CgQrN3XX.js";import{i as Te,r as Ee}from"./genericProcessUtils-BNlr-QxM.js";import{homedir as D}from"os";import{basename as De,delimiter as Oe,join as O,posix as k,win32 as A}from"path";import{constants as ke}from"fs";import{access as j,open as Ae,readFile as M,realpath as N,stat as je}from"fs/promises";function Me(){return O(i(),`local`)}function Ne(){return O(Me(),`claude`)}function Pe(){return(process.argv[1]||``).includes(`/.workmate/local/node_modules/`)}async function Fe(){try{return await j(O(Me(),`node_modules`,`.bin`,`claude`)),!0}catch{return!1}}function Ie(){let e=process.env.SHELL||``;return e.includes(`zsh`)?`zsh`:e.includes(`bash`)?`bash`:e.includes(`fish`)?`fish`:`unknown`}var P=e((()=>{_(),o(),l(),y(),f(),S(),h()}));function F(e){let t=e?.homedir??D();return{zsh:O((e?.env??process.env).ZDOTDIR||t,`.zshrc`),bash:O(t,`.bashrc`),fish:O(t,`.config/fish/config.fish`)}}function Le(e){let t=!1;return{filtered:e.filter(e=>{if(I.test(e)){let n=e.match(/alias\s+claude\s*=\s*["']([^"']+)["']/);if(n||(n=e.match(/alias\s+claude\s*=\s*([^#\n]+)/)),n?.[1]&&n[1].trim()===Ne())return t=!0,!1}return!0}),hadAlias:t}}async function Re(e){try{return(await M(e,{encoding:`utf8`})).split(`
|
|
2
|
-
`)}catch(e){if(ce(e))return null;throw e}}async function ze(e,t){let n=await Ae(e,`w`);try{await n.writeFile(t.join(`
|
|
3
|
-
`),{encoding:`utf8`}),await n.datasync()}finally{await n.close()}}async function Be(e){let t=F(e);for(let e of Object.values(t)){let t=await Re(e);if(t){for(let e of t)if(I.test(e)){let t=e.match(/alias\s+claude=["']?([^"'\s]+)/);if(t?.[1])return t[1]}}}return null}async function Ve(e){let t=await Be(e);if(!t)return null;let n=e?.homedir??D(),r=t.startsWith(`~`)?t.replace(`~`,n):t;try{let e=await je(r);if(e.isFile()||e.isSymbolicLink())return t}catch{}return null}var I,L=e((()=>{l(),P(),I=/^\s*alias\s+claude\s*=/}));async function He(){}function Ue(e){let t=he()?.minimumVersion;if(!t)return!1;let n=!c(e,t);return n&&d(`Skipping update to ${e} - below minimumVersion ${t}`),n}async function We(){let e=de.isRunningWithBun(),t=null;return t=e?await b(`bun`,[`pm`,`bin`,`-g`],{cwd:D()}):await b(`npm`,[`-g`,`config`,`get`,`prefix`],{cwd:D()}),t.code===0?t.stdout.trim():(C(Error(`Failed to check ${e?`bun`:`npm`} permissions`)),null)}async function Ge(){try{let e=await We();if(!e)return{hasPermissions:!1,npmPrefix:null};try{return await j(e,ke.W_OK),{hasPermissions:!0,npmPrefix:e}}catch{return C(new R(`Insufficient permissions for global npm install.`)),{hasPermissions:!1,npmPrefix:e}}}catch(e){return C(e),{hasPermissions:!1,npmPrefix:null}}}var R,z=e((()=>{p(),me(),o(),l(),y(),f(),S(),ee(),pe(),L(),R=class extends ie{}}));function B(e,t){return t.includes(e.id)||e.idLike.some(e=>t.includes(e))}function V(){let e=process.execPath||process.argv[0]||``;return/[/\\]mise[/\\]installs[/\\]/i.test(e)?(d(`Detected mise installation: ${e}`),!0):!1}function H(){let e=process.execPath||process.argv[0]||``;return/[/\\]\.?asdf[/\\]installs[/\\]/i.test(e)?(d(`Detected asdf installation: ${e}`),!0):!1}function U(){let e=E();if(e!==`macos`&&e!==`linux`&&e!==`wsl`)return!1;let t=process.execPath||process.argv[0]||``;return t.includes(`/Caskroom/`)?(d(`Detected Homebrew cask installation: ${t}`),!0):!1}function Ke(){if(E()!==`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 d(`Detected winget installation: ${e}`),!0;return!1}var W,G,K,q,J,qe,Je=e((()=>{n(),p(),y(),Se(),W=t(async()=>{try{let e=await M(`/etc/os-release`,`utf8`),t=e.match(/^ID=["']?(\S+?)["']?\s*$/m),n=e.match(/^ID_LIKE=["']?(.+?)["']?\s*$/m);return{id:t?.[1]??``,idLike:n?.[1]?.split(` `)??[]}}catch{return null}}),G=t(async()=>{if(E()!==`linux`)return!1;let e=await W();if(e&&!B(e,[`arch`]))return!1;let t=await x(`pacman`,[`-Qo`,process.execPath||process.argv[0]||``],{timeout:5e3,useCwd:!1});return t.code===0&&t.stdout?(d(`Detected pacman installation: ${t.stdout.trim()}`),!0):!1}),K=t(async()=>{if(E()!==`linux`)return!1;let e=await W();if(e&&!B(e,[`debian`]))return!1;let t=await x(`dpkg`,[`-S`,process.execPath||process.argv[0]||``],{timeout:5e3,useCwd:!1});return t.code===0&&t.stdout?(d(`Detected deb installation: ${t.stdout.trim()}`),!0):!1}),q=t(async()=>{if(E()!==`linux`)return!1;let e=await W();if(e&&!B(e,[`fedora`,`rhel`,`suse`]))return!1;let t=await x(`rpm`,[`-qf`,process.execPath||process.argv[0]||``],{timeout:5e3,useCwd:!1});return t.code===0&&t.stdout?(d(`Detected rpm installation: ${t.stdout.trim()}`),!0):!1}),J=t(async()=>{if(E()!==`linux`)return!1;let e=await W();if(e&&!B(e,[`alpine`]))return!1;let t=await x(`apk`,[`info`,`--who-owns`,process.execPath||process.argv[0]||``],{timeout:5e3,useCwd:!1});return t.code===0&&t.stdout?(d(`Detected apk installation: ${t.stdout.trim()}`),!0):!1}),qe=t(async()=>U()?`homebrew`:Ke()?`winget`:V()?`mise`:H()?`asdf`:await G()?`pacman`:await J()?`apk`:await K()?`deb`:await q()?`rpm`:`unknown`)}));function Ye(){let e=process.argv[1]||``,t=process.execPath||process.argv[0]||``;return E()===`windows`&&(e=e.split(A.sep).join(k.sep),t=t.split(A.sep).join(k.sep)),[e,t]}async function Xe(){let[e]=Ye();if(w())return U()||Ke()||V()||H()||await G()||await K()||await q()||await J()?`package-manager`:`native`;if(Pe())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 ve(`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 Ze(){if(w()){try{return await N(process.execPath)}catch{}try{let e=await T(`claude`);if(e)return e}catch{}try{return await m().stat(O(D(),`.local/bin/claude`)),O(D(),`.local/bin/claude`)}catch{}return`native`}try{return process.argv[0]||`unknown`}catch{return`unknown`}}function Qe(){try{return w()?process.execPath||`unknown`:process.argv[1]||`unknown`}catch{return`unknown`}}async function $e(){let e=m(),t=[],n=O(D(),`.workmate`,`local`);await Fe()&&t.push({type:`npm-local`,path:n});let r=[`@anthropic-ai/workmate`],i=await x(`npm`,[`-g`,`config`,`get`,`prefix`]);if(i.code===0&&i.stdout){let n=i.stdout.trim(),a=E()===`windows`,o=a?O(n,`claude`):O(n,`bin`,`claude`),s=!1;try{await e.stat(o),s=!0}catch{}if(s){let e=!1;try{(await N(o)).includes(`/Caskroom/`)&&(e=U())}catch{}e||t.push({type:`npm-global`,path:o})}else for(let i of r){let r=a?O(n,`node_modules`,i):O(n,`lib`,`node_modules`,i);try{await e.stat(r),t.push({type:`npm-global-orphan`,path:r})}catch{}}}let a=O(D(),`.local`,`bin`,`claude`);try{await e.stat(a),t.push({type:`native`,path:a})}catch{}if(v().installMethod===`native`){let n=O(D(),`.local`,`share`,`claude`);try{await e.stat(n),t.some(e=>e.type===`native`)||t.push({type:`native`,path:n})}catch{}}return t}async function et(e){let t=[];try{let e=ae(await M(O(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: ${g.join(`, `)}.`});else{let e=n.filter(e=>typeof e==`string`&&!g.includes(e));e.length>0&&t.push({issue:`managed-settings.json: strictPluginOnlyCustomization has ${e.length} value(s) this client doesn't recognize: ${e.map(String).join(`, `)}`,fix:`These are silently ignored (forwards-compat). Known surfaces for this version: ${g.join(`, `)}. Either remove them, or this client is older than the managed-settings intended.`})}}catch{}let n=v();if(e===`development`)return t;if(e===`native`){let e=(process.env.PATH||``).split(Oe),n=O(D(),`.local`,`bin`),r=n;if(E()===`windows`&&(r=n.split(A.sep).join(k.sep)),!e.some(e=>{let t=e;E()===`windows`&&(t=e.split(A.sep).join(k.sep));let n=t.replace(/\/+$/,``),i=e.replace(/[/\\]+$/,``);return n===r||i===`~/.local/bin`||i===`$HOME/.local/bin`}))if(E()===`windows`){let e=n.split(k.sep).join(A.sep);t.push({issue:`Native installation exists but ${e} is not in your PATH`,fix:`Add it by opening: System Properties → Environment Variables → Edit User PATH → New → Add the path above. Then restart your terminal.`})}else{let e=Ie(),n=F()[e],r=n?n.replace(D(),`~`):`your shell config file`;t.push({issue:`Native installation exists but ~/.local/bin is not in your PATH`,fix:`Run: echo 'export PATH="$HOME/.local/bin:$PATH"' >> ${r} then open a new terminal or run: source ${r}`})}}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 Fe()&&t.push({issue:`Local installation exists but not being used`,fix:`Consider using native installation: claude install`});let r=await Be(),i=await Ve();return e===`npm-local`&&!await T(`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 tt(){if(E()!==`linux`)return[];let e=[],t=s.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 nt(){let e=await Xe(),t=typeof MACRO<`u`?`0.0.25`:`unknown`,n=await Ze(),r=Qe(),i=await $e(),a=await et(e);if(a.push(...tt()),e===`native`){let e=i.filter(e=>e.type===`npm-global`||e.type===`npm-global-orphan`||e.type===`npm-local`),t=E()===`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 Ge()).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=we(),ee={working:c.working??!0,mode:c.mode,systemPath:c.mode===`system`?c.path:null,note:c.note??null},te=e===`package-manager`?await qe():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:te,ripgrepStatus:ee}}var rt=e((()=>{ye(),z(),xe(),_(),ne(),o(),y(),f(),P(),Je(),Se(),Ce(),te(),ue(),le(),L(),h(),be()}));function Y(e){return{env:e?.env??process.env,home:e?.homedir??process.env.HOME??D()}}function X(e,...t){return e.includes(`/`)&&!e.includes(`\\`)&&!/^[A-Za-z]:/.test(e)?k.join(e,...t):O(e,...t)}function it(e){let{env:t,home:n}=Y(e);return t.XDG_STATE_HOME??X(n,`.local`,`state`)}function at(e){let{env:t,home:n}=Y(e);return t.XDG_CACHE_HOME??X(n,`.cache`)}function ot(e){let{env:t,home:n}=Y(e);return t.XDG_DATA_HOME??X(n,`.local`,`share`)}function st(e){let{home:t}=Y(e);return X(t,`.local`,`bin`)}var ct=e((()=>{}));function lt(){let e=process.env.ENABLE_PID_BASED_VERSION_LOCKING;return a(e)?!0:(r(e),!1)}function Z(e){if(e<=1)return!1;try{return process.kill(e,0),!0}catch{return!1}}function ut(e,t){if(!Z(e))return!1;if(e===process.pid)return!0;try{let n=Ee(e);if(!n)return!0;let r=n.toLowerCase(),i=t.toLowerCase();return r.includes(`claude`)||r.includes(i)}catch{return!0}}function Q(e){let t=m();try{let n=t.readFileSync(e,{encoding:`utf8`});if(!n||n.trim()===``)return null;let r=ae(n);return typeof r.pid!=`number`||!r.version||!r.execPath?null:r}catch{return null}}function $(e){let t=Q(e);if(!t)return!1;let{pid:n,execPath:r}=t;if(!Z(n))return!1;if(!ut(n,r))return d(`Lock PID ${n} is running but does not appear to be Work Mate - treating as stale`),!1;let i=m();try{let t=i.statSync(e);if(Date.now()-t.mtimeMs>_t&&!Z(n))return!1}catch{}return!0}function dt(e,t){let n=m(),r=`${e}.tmp.${process.pid}.${Date.now()}`;try{oe(r,re(t,null,2),{encoding:`utf8`,flush:!0}),n.renameSync(r,e)}catch(e){try{n.unlinkSync(r)}catch{}throw e}}async function ft(e,t){let n=m(),r=De(e);if($(t))return d(`Cannot acquire lock for ${r} - held by PID ${Q(t)?.pid}`),null;let i={pid:process.pid,version:r,execPath:process.execPath,acquiredAt:Date.now()};try{return dt(t,i),Q(t)?.pid===process.pid?(d(`Acquired PID lock for ${r} (PID ${process.pid})`),()=>{try{Q(t)?.pid===process.pid&&(n.unlinkSync(t),d(`Released PID lock for ${r}`))}catch(e){d(`Failed to release lock for ${r}: ${e}`)}}):null}catch(e){return d(`Failed to acquire lock for ${r}: ${e}`),null}}async function pt(e,t){let n=await ft(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 mt(e,t,n){let r=await ft(e,t);if(!r)return!1;try{return await n(),!0}finally{r()}}function ht(e){let t=m(),n=[];try{let r=t.readdirStringSync(e).filter(e=>e.endsWith(`.lock`));for(let t of r){let r=O(e,t),i=Q(r);i&&n.push({version:i.version,pid:i.pid,isProcessRunning:Z(i.pid),execPath:i.execPath,acquiredAt:new Date(i.acquiredAt),lockFilePath:r})}}catch(e){if(u(e))return n;C(se(e))}return n}function gt(e){let t=m(),n=0;try{let r=t.readdirStringSync(e).filter(e=>e.endsWith(`.lock`));for(let i of r){let r=O(e,i);try{t.lstatSync(r).isDirectory()?(t.rmSync(r,{recursive:!0,force:!0}),n++,d(`Cleaned up legacy directory lock: ${i}`)):$(r)||(t.unlinkSync(r),n++,d(`Cleaned up stale lock: ${i}`))}catch{}}}catch(e){if(u(e))return 0;C(se(e))}return n}var _t,vt=e((()=>{p(),o(),l(),f(),Te(),S(),h(),_t=7200*1e3}));export{Re as C,P as E,L as S,Ie as T,He as _,$ as a,Le as b,mt as c,ot as d,it as f,rt as g,nt as h,vt as i,st as l,Xe as m,gt as n,lt as o,ct as p,ht as r,Q as s,pt as t,at as u,z as v,ze as w,F as x,Ue as y};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{I as t,P as n,t as r}from"./src-DL3w8VPk.js";import{t as i}from"./jsx-runtime-Bb4Xn-E0.js";import{Pt as a,kt as o}from"./state-BQ4BEGin.js";import{$w as s,D as c,Mm as l,W_ as u,Xw as d,Yw as f,b as p,km as m,z_ as h}from"./loadAgentsDir-DGozQu_6.js";import{a as g,i as _,r as v,t as y}from"./promptEditor-B6S_Rzcu.js";import{r as b,t as x}from"./staticRender-BVWx0IM1.js";function S({planContent:e,planPath:r,editorName:i}){return(0,w.jsxs)(t,{flexDirection:`column`,children:[(0,w.jsx)(n,{bold:!0,children:`Current Plan`}),(0,w.jsx)(n,{dimColor:!0,children:r}),(0,w.jsx)(t,{marginTop:1,children:(0,w.jsx)(n,{children:e})}),i&&(0,w.jsxs)(t,{marginTop:1,children:[(0,w.jsx)(n,{dimColor:!0,children:`"/plan open"`}),(0,w.jsx)(n,{dimColor:!0,children:` to edit this plan in `}),(0,w.jsx)(n,{bold:!0,dimColor:!0,children:i})]})]})}async function C(e,t,n){let{getAppState:r,setAppState:i}=t,a=r().toolPermissionContext.mode;if(a!==`plan`){o(a,`plan`),i(e=>({...e,toolPermissionContext:m(c(e.toolPermissionContext),{type:`setMode`,mode:`plan`,destination:`session`})}));let t=n.trim();return t&&t!==`open`?e(`Enabled plan mode`,{shouldQuery:!0}):e(`Enabled plan mode`),null}let s=f(),l=d();if(!s)return e(`Already in plan mode. No plan written yet.`),null;if(n.trim().split(/\s+/)[0]===`open`){let t=await y(l);return t.error?e(`Failed to open plan in editor: ${t.error}`):e(`Opened plan in editor: ${l}`),null}let p=_();return e(await b((0,w.jsx)(S,{planContent:s,planPath:l,editorName:p?u(p):void 0}))),null}var w;e((()=>{a(),r(),g(),h(),l(),p(),s(),v(),x(),w=i()}))();export{C as call};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{l as n,o as r}from"./envUtils-DfkgIdYf.js";import{n as i,t as a}from"./figures-5ThXQEtq.js";import{D as o,Gr as s,Gt as c,H as l,I as u,P as d,T as f,Wt as p,Xn as m,ai as h,hn as g,j as _,k as v,n as y,ot as b,r as x,t as S,x as ee,y as te}from"./src-DL3w8VPk.js";import{t as C}from"./jsx-runtime-Bb4Xn-E0.js";import{$a as w,Ao as T,Ba as ne,Bp as E,Bv as D,Cb as O,Co as k,Cv as A,Do as re,Eo as ie,Fa as ae,Ga as j,Gv as M,Gx as N,Hp as oe,Jv as P,Ka as se,Kv as ce,Mo as le,Mx as ue,No as F,Oo as I,Ox as de,Pa as fe,Qa as pe,Qv as me,Qx as he,So as L,To as R,Va as ge,Vv as _e,Vx as ve,Wv as ye,Xv as be,Ya as z,Yv as xe,Zv as Se,Zx as Ce,bu as we,bv as Te,do as B,eS as Ee,go as De,hd as Oe,io as ke,jx as Ae,kb as je,md as V,mo as Me,qv as Ne,qx as Pe,so as Fe,tS as Ie,to as Le,uo as Re,vo as ze,wo as Be,yo as Ve,yu as He,zp as Ue}from"./loadAgentsDir-DGozQu_6.js";import{I as We,M as Ge,S as Ke,V as qe,c as Je,i as Ye,x as Xe}from"./debug-CRnGsZOV.js";import{Hn as Ze,Vn as Qe,_t as $e,b as et,bt as tt,d as nt,h as rt,s as it}from"./settings-CodSADx8.js";import{d as at,g as ot}from"./config-CWPHVTic.js";import{o as st,s as ct}from"./log-DoSpAwRP.js";import{l as H,o as lt}from"./stringUtils-Bu_lJH5c.js";import{n as ut}from"./analytics-COpjZpvd.js";import{S as dt,v as ft}from"./startupProfiler-DF0AjiDf.js";import{n as pt,t as mt}from"./TextInput-Cev5Awdd.js";import{n as ht,t as gt}from"./pluginStartupCheck-BX6cv-vs.js";import{a as _t,d as vt,f as yt,i as bt,l as xt,o as St,s as Ct,u as wt}from"./pluginOperations-rTrzu6Vg.js";import{a as Tt,c as Et,i as Dt,n as Ot,o as kt,s as At,t as jt}from"./validatePlugin-D8WQ5z4W.js";import{a as Mt,n as Nt,o as Pt,r as Ft}from"./pluginFlagging-BO_3qjfs.js";import{i as It,n as Lt}from"./MCPConnectionManager-DkZVxLEj.js";import{n as Rt,t as zt}from"./useExitOnCtrlCDWithKeybindings-DWRFdFoU.js";import{r as Bt,t as Vt}from"./Spinner-VjwI7m_g.js";import{t as Ht}from"./SearchBox-C9xxQzh1.js";import{n as Ut,t as Wt}from"./useSearchInput-B_mY9wBq.js";import{a as Gt,c as Kt,i as qt,n as Jt,o as Yt,r as Xt,s as Zt,t as Qt}from"./MCPToolListView-De1W4jpj.js";import{i as $t,n as en}from"./pluginAutoupdate-DQqYDPVg.js";import*as tn from"path";import*as nn from"fs/promises";function rn({inputValue:e,setInputValue:t,cursorOffset:n,setCursorOffset:r,error:i,setError:a,result:s,setResult:c,setViewState:l,onAddComplete:p,cliMode:m=!1}){let h=(0,an.useRef)(!1),[g,_]=(0,an.useState)(!1),[v,y]=(0,an.useState)(``),b=async()=>{let t=e.trim();if(!t){a(`Please enter a marketplace source`);return}let n=await Tt(t);if(!n){a(`Invalid marketplace source format. Try: owner/repo, https://..., or ./path`);return}if(`error`in n){a(n.error);return}a(null);try{_(!0),y(``);let{name:e,resolvedSource:t}=await ke(n,e=>{y(e)});ze(e,{source:t}),le(),n.source,n.source===`github`&&n.repo,p&&await p(),y(``),_(!1),m?c(`Successfully added marketplace: ${e}`):l({type:`browse-marketplace`,targetMarketplace:e})}catch(e){let t=qe(e);ct(t),a(t.message),y(``),_(!1),c(m?`Error: ${t.message}`:null)}};return(0,an.useEffect)(()=>{e&&!h.current&&!i&&!s&&(h.current=!0,b())},[]),(0,U.jsxs)(u,{flexDirection:`column`,children:[(0,U.jsxs)(u,{flexDirection:`column`,paddingX:1,borderStyle:`round`,children:[(0,U.jsx)(u,{marginBottom:1,children:(0,U.jsx)(d,{bold:!0,children:`Add Marketplace`})}),(0,U.jsxs)(u,{flexDirection:`column`,children:[(0,U.jsx)(d,{children:`Enter marketplace source:`}),(0,U.jsx)(d,{dimColor:!0,children:`Examples:`}),(0,U.jsx)(d,{dimColor:!0,children:` · owner/repo (GitHub)`}),(0,U.jsx)(d,{dimColor:!0,children:` · git@github.com:owner/repo.git (SSH)`}),(0,U.jsx)(d,{dimColor:!0,children:` · https://example.com/marketplace.json`}),(0,U.jsx)(d,{dimColor:!0,children:` · ./path/to/marketplace`}),(0,U.jsx)(u,{marginTop:1,children:(0,U.jsx)(mt,{value:e,onChange:t,onSubmit:b,columns:80,cursorOffset:n,onChangeCursorOffset:r,focus:!0,showCursor:!0})})]}),g&&(0,U.jsxs)(u,{marginTop:1,children:[(0,U.jsx)(Vt,{}),(0,U.jsx)(d,{children:v||`Adding marketplace to configuration…`})]}),i&&(0,U.jsx)(u,{marginTop:1,children:(0,U.jsx)(d,{color:`error`,children:i})}),s&&(0,U.jsx)(u,{marginTop:1,children:(0,U.jsx)(d,{children:s})})]}),(0,U.jsx)(u,{marginLeft:3,children:(0,U.jsx)(d,{dimColor:!0,italic:!0,children:(0,U.jsxs)(f,{children:[(0,U.jsx)(o,{shortcut:`Enter`,action:`add`}),(0,U.jsx)(V,{action:`confirm:no`,context:`Settings`,fallback:`Esc`,description:`cancel`})]})})})]})}var an,U,on=e((()=>{an=t(h(),1),ut(),Oe(),S(),Bt(),pt(),We(),st(),F(),Re(),Dt(),U=C()}));function sn(e,t,r,i){let a={};for(let o of e){let e=r[o],s=t[o]??``;if(!(e?.sensitive===!0&&s===``&&i?.[o]!==void 0))if(e?.type===`number`){if(s.trim()===``)continue;let e=Number(s);a[o]=Number.isNaN(e)?s:e}else e?.type===`boolean`?a[o]=n(s):a[o]=s}return a}function cn({title:e,subtitle:t,configSchema:n,initialValues:r,onSave:i,onCancel:o}){let l=Object.keys(n),f=(0,ln.useCallback)(e=>{if(n[e]?.sensitive===!0)return``;let t=r?.[e];return t===void 0?``:String(t)},[n,r]),[m,h]=(0,ln.useState)(0),[_,v]=(0,ln.useState)({}),[y,b]=(0,ln.useState)(()=>l[0]?f(l[0]):``),x=l[m],S=x?n[x]:null;if(p(`confirm:no`,o,{context:`Settings`}),c({"confirm:nextField":(0,ln.useCallback)(()=>{if(m<l.length-1&&x){v(e=>({...e,[x]:y})),h(e=>e+1);let e=l[m+1];b(e?f(e):``)}},[m,l,x,y,f]),"confirm:yes":(0,ln.useCallback)(()=>{if(!x)return;let e={..._,[x]:y};if(m===l.length-1)i(sn(l,e,n,r));else{v(e),h(e=>e+1);let t=l[m+1];b(t?f(t):``)}},[x,_,y,m,l,n,i,f,r])},{context:`Confirmation`}),g((e,t)=>{if(t.backspace||t.delete){b(e=>e.slice(0,-1));return}e&&!t.ctrl&&!t.meta&&!t.tab&&!t.return&&b(t=>t+e)}),!S||!x)return null;let ee=S.sensitive===!0,C=S.required===!0,w=ee?`*`.repeat(s(y)):y;return(0,un.jsxs)(te,{title:e,subtitle:t,onCancel:o,isCancelActive:!1,children:[(0,un.jsxs)(u,{flexDirection:`column`,children:[(0,un.jsxs)(d,{bold:!0,children:[S.title||x,C&&(0,un.jsx)(d,{color:`error`,children:` *`})]}),S.description&&(0,un.jsx)(d,{dimColor:!0,children:S.description}),(0,un.jsxs)(u,{marginTop:1,children:[(0,un.jsxs)(d,{children:[a.pointerSmall,` `]}),(0,un.jsx)(d,{children:w}),(0,un.jsx)(d,{children:`█`})]})]}),(0,un.jsxs)(u,{flexDirection:`column`,children:[(0,un.jsxs)(d,{dimColor:!0,children:[`Field `,m+1,` of `,l.length]}),m<l.length-1&&(0,un.jsx)(d,{dimColor:!0,children:`Tab: Next field · Enter: Save and continue`}),m===l.length-1&&(0,un.jsx)(d,{dimColor:!0,children:`Enter: Save configuration`})]})]})}var ln,un,dn=e((()=>{i(),ln=t(h(),1),S(),O(),r(),un=C()}));async function fn(e){let{enabled:t,disabled:n}=await ae();return[...t,...n].find(t=>t.repository===e||t.source===e)}function pn({plugin:e,pluginId:t,onDone:n}){let[r]=mn.useState(()=>{let n=[],r=ye(e);Object.keys(r).length>0&&n.push({key:`top-level`,title:`Configure ${e.name}`,subtitle:`Plugin options`,schema:r,load:()=>ce(t),save:n=>Ne(t,n,e.manifest.userConfig)});let i=D(e);for(let r of i)n.push({key:`channel:${r.server}`,title:`Configure ${r.displayName}`,subtitle:`Plugin: ${e.name}`,schema:r.configSchema,load:()=>be(t,r.server)??void 0,save:e=>me(t,r.server,e,r.configSchema)});return n}),[i,a]=mn.useState(0),o=mn.useRef(n);if(o.current=n,mn.useEffect(()=>{r.length===0&&o.current(`skipped`)},[r.length]),r.length===0)return null;let s=r[i];function c(e){try{s.save(e)}catch(e){n(`error`,Ge(e));return}let t=i+1;t<r.length?a(t):n(`configured`)}return(0,hn.jsx)(cn,{title:s.title,subtitle:s.subtitle,configSchema:s.schema,initialValues:s.load(),onSave:c,onCancel:()=>n(`skipped`)},s.key)}var mn,hn,gn=e((()=>{mn=t(h(),1),We(),P(),_e(),fe(),M(),dn(),hn=C()}));function _n(){let e=re();return(0,vn.jsxs)(u,{marginBottom:1,children:[(0,vn.jsxs)(d,{color:`claude`,children:[a.warning,` `]}),(0,vn.jsxs)(d,{dimColor:!0,italic:!0,children:[`Make sure you trust a plugin before installing, updating, or using it. We do not control what MCP servers, files, or other software are included in plugins and cannot verify that they will work as intended or that they won't change. See each plugin's homepage for more information.`,e?` ${e}`:``]})]})}var vn,yn=e((()=>{i(),S(),I(),vn=C()}));function bn(e){return e.entry.source&&typeof e.entry.source==`object`&&`source`in e.entry.source&&e.entry.source.source===`github`&&typeof e.entry.source==`object`&&`repo`in e.entry.source?e.entry.source.repo:null}function xn(e,t){let n=[{label:`Install for you (user scope)`,action:`install-user`},{label:`Install for all collaborators on this repository (project scope)`,action:`install-project`},{label:`Install for you, in this repo only (local scope)`,action:`install-local`}];return e&&n.push({label:`Open homepage`,action:`homepage`}),t&&n.push({label:`View on GitHub`,action:`github`}),n.push({label:`Back to plugin list`,action:`back`}),n}function Sn({hasSelection:e}){return(0,Cn.jsx)(u,{marginTop:1,children:(0,Cn.jsx)(d,{dimColor:!0,italic:!0,children:(0,Cn.jsxs)(f,{children:[e&&(0,Cn.jsx)(V,{action:`plugin:install`,context:`Plugin`,fallback:`i`,description:`install`,bold:!0}),(0,Cn.jsx)(V,{action:`plugin:toggle`,context:`Plugin`,fallback:`Space`,description:`toggle`}),(0,Cn.jsx)(V,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`details`}),(0,Cn.jsx)(V,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]})})})}var Cn,wn=e((()=>{Oe(),S(),Cn=C()}));function Tn({totalItems:e,maxVisible:t=Dn,selectedIndex:n=0}){let r=e>t,i=(0,En.useRef)(0),a=(0,En.useMemo)(()=>{if(!r)return 0;let a=i.current;if(n<a)return i.current=n,n;if(n>=a+t){let e=n-t+1;return i.current=e,e}let o=Math.max(0,e-t),s=Math.min(a,o);return i.current=s,s},[n,t,r,e]),o=a,s=Math.min(a+t,e),c=(0,En.useCallback)(e=>r?e.slice(o,s):e,[r,o,s]),l=(0,En.useCallback)(e=>o+e,[o]),u=(0,En.useCallback)(e=>e>=o&&e<s,[o,s]),d=(0,En.useCallback)(e=>{},[]),f=(0,En.useCallback)(()=>{},[]),p=(0,En.useCallback)(()=>{},[]),m=(0,En.useCallback)((t,n)=>{n(Math.max(0,Math.min(t,e-1)))},[e]),h=(0,En.useCallback)((e,t)=>!1,[]),g=Math.max(1,Math.ceil(e/t));return{currentPage:Math.floor(a/t),totalPages:g,startIndex:o,endIndex:s,needsPagination:r,pageSize:t,getVisibleItems:c,toActualIndex:l,isOnCurrentPage:u,goToPage:d,nextPage:f,prevPage:p,handleSelectionChange:m,handlePageNavigation:h,scrollPosition:{current:n+1,total:e,canScrollUp:a>0,canScrollDown:a+t<e}}}var En,Dn,On=e((()=>{En=t(h(),1),Dn=5}));function kn({error:e,setError:t,result:n,setResult:r,setViewState:i,onInstallComplete:o,targetMarketplace:s,targetPlugin:l}){let[m,h]=(0,W.useState)(`marketplace-list`),[g,_]=(0,W.useState)(null),[v,y]=(0,W.useState)(null),[b,x]=(0,W.useState)([]),[S,ee]=(0,W.useState)([]),[te,C]=(0,W.useState)(!0),[ne,E]=(0,W.useState)(null),[D,O]=(0,W.useState)(0),[k,A]=(0,W.useState)(new Set),[re,ae]=(0,W.useState)(new Set),j=Tn({totalItems:S.length,selectedIndex:D}),[M,N]=(0,W.useState)(0),[oe,P]=(0,W.useState)(!1),[ce,ue]=(0,W.useState)(null),[F,I]=(0,W.useState)(null);p(`confirm:no`,An.useCallback(()=>{m===`plugin-list`?s?i({type:`manage-marketplaces`,targetMarketplace:s}):b.length===1?i({type:`menu`}):(h(`marketplace-list`),_(null),A(new Set)):m===`plugin-details`?(h(`plugin-list`),y(null)):i({type:`menu`})},[m,s,i,b.length]),{context:`Confirmation`}),(0,W.useEffect)(()=>{async function e(){try{let e=await B(),{marketplaces:n,failures:r}=await T(e),i=[];for(let{name:e,config:t,data:r}of n)if(r){let n=Qe(r.plugins,t=>w(L(t.name,e)));i.push({name:e,totalPlugins:r.plugins.length,installedCount:n,source:ie(t.source)})}i.sort((e,t)=>e.name===`claude-plugin-directory`?-1:+(t.name===`claude-plugin-directory`)),x(i);let a=R(r,Qe(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&&!s&&!l){let e=i[0];e&&(_(e.name),h(`plugin-list`))}if(l){let n=null,r=null;for(let[t]of Object.entries(e)){let e=await Fe(t);if(e){let i=e.plugins.find(e=>e.name===l);if(i){let e=L(i.name,t);n={entry:i,marketplaceName:t,pluginId:e,isInstalled:pe(e)},r=t;break}}}if(n&&r){let e=n.pluginId;pe(e)?t(`Plugin '${e}' is already installed globally. Use '/plugin' to manage existing plugins.`):(_(r),y(n),h(`plugin-details`))}else t(`Plugin "${l}" not found in any marketplace`)}else s&&(i.some(e=>e.name===s)?(_(s),h(`plugin-list`)):t(`Marketplace "${s}" not found`))}catch(e){t(e instanceof Error?e.message:`Failed to load marketplaces`)}finally{C(!1)}}e()},[t,s,l]),(0,W.useEffect)(()=>{if(!g)return;let e=!1;async function n(n){C(!0);try{let t=await Fe(n);if(e)return;if(!t)throw Error(`Failed to load marketplace: ${n}`);let r=[];for(let e of t.plugins){let t=L(e.name,n);se(t)||r.push({entry:e,marketplaceName:n,pluginId:t,isInstalled:pe(t)})}try{let t=await At();if(e)return;E(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;Je(`Failed to fetch install counts: ${Ge(t)}`),r.sort((e,t)=>e.entry.name.localeCompare(t.entry.name))}ee(r),O(0),A(new Set)}catch(n){if(e)return;t(n instanceof Error?n.message:`Failed to load plugins`)}finally{C(!1)}}return n(g),()=>{e=!0}},[g,t]);let de=async()=>{if(k.size===0)return;let e=S.filter(e=>k.has(e.pluginId));ae(new Set(e.map(e=>e.pluginId)));let n=0,a=0,s=[];for(let t of e){let e=await ge({pluginId:t.pluginId,entry:t.entry,marketplaceName:t.marketplaceName,scope:`user`});e.success?n++:(a++,s.push({name:t.entry.name,reason:e.error}))}ae(new Set),A(new Set),le(),a===0?r(`✓ Installed ${n} ${H(n,`plugin`)}. Run /reload-plugins to activate.`):n===0?t(`Failed to install: ${Be(s,!0)}`):r(`✓ Installed ${n} of ${n+a} plugins. Failed: ${Be(s,!1)}. Run /reload-plugins to activate successfully installed plugins.`),n>0&&o&&await o(),i({type:`menu`})},fe=async(e,t=`user`)=>{P(!0),ue(null);let n=await ge({pluginId:e.pluginId,entry:e.entry,marketplaceName:e.marketplaceName,scope:t});if(n.success){let t=await fn(e.pluginId);if(t){P(!1),h({type:`plugin-options`,plugin:t,pluginId:e.pluginId});return}r(n.message),o&&await o(),i({type:`menu`})}else P(!1),ue(n.error)};(0,W.useEffect)(()=>{e&&r(e)},[e,r]),c({"select:previous":()=>{D>0&&O(D-1)},"select:next":()=>{D<b.length-1&&O(D+1)},"select:accept":()=>{let e=b[D];e&&(_(e.name),h(`plugin-list`))}},{context:`Select`,isActive:m===`marketplace-list`}),c({"select:previous":()=>{D>0&&j.handleSelectionChange(D-1,O)},"select:next":()=>{D<S.length-1&&j.handleSelectionChange(D+1,O)},"select:accept":()=>{if(D===S.length&&k.size>0)de();else if(D<S.length){let e=S[D];e&&(e.isInstalled?i({type:`manage-plugins`,targetPlugin:e.entry.name,targetMarketplace:e.marketplaceName}):(y(e),h(`plugin-details`),N(0),ue(null)))}}},{context:`Select`,isActive:m===`plugin-list`}),c({"plugin:toggle":()=>{if(D<S.length){let e=S[D];if(e&&!e.isInstalled){let t=new Set(k);t.has(e.pluginId)?t.delete(e.pluginId):t.add(e.pluginId),A(t)}}},"plugin:install":()=>{k.size>0&&de()}},{context:`Plugin`,isActive:m===`plugin-list`});let me=An.useMemo(()=>{if(!v)return[];let e=v.entry.homepage;return xn(e,bn(v))},[v]);if(c({"select:previous":()=>{M>0&&N(M-1)},"select:next":()=>{M<me.length-1&&N(M+1)},"select:accept":()=>{if(!v)return;let e=me[M]?.action,t=v.entry.homepage,n=bn(v);e===`install-user`?fe(v,`user`):e===`install-project`?fe(v,`project`):e===`install-local`?fe(v,`local`):e===`homepage`&&t?we(t):e===`github`&&n?we(`https://github.com/${n}`):e===`back`&&(h(`plugin-list`),y(null))}},{context:`Select`,isActive:m===`plugin-details`&&!!v}),typeof m==`object`&&m.type===`plugin-options`){let{plugin:e,pluginId:t}=m;function n(e){r(e),o&&o(),i({type:`menu`})}return(0,G.jsx)(pn,{plugin:e,pluginId:t,onDone:(t,r)=>{switch(t){case`configured`:n(`✓ Installed and configured ${e.name}. Run /reload-plugins to apply.`);break;case`skipped`:n(`✓ Installed ${e.name}. Run /reload-plugins to apply.`);break;case`error`:n(`Installed but failed to save config: ${r}`);break}}})}if(te)return(0,G.jsx)(d,{children:`Loading…`});if(e)return(0,G.jsx)(d,{color:`error`,children:e});if(m===`marketplace-list`)return b.length===0?(0,G.jsxs)(u,{flexDirection:`column`,children:[(0,G.jsx)(u,{marginBottom:1,children:(0,G.jsx)(d,{bold:!0,children:`Select marketplace`})}),(0,G.jsx)(d,{children:`No marketplaces configured.`}),(0,G.jsxs)(d,{dimColor:!0,children:[`Add a marketplace first using `,`'Add marketplace'`,`.`]}),(0,G.jsx)(u,{marginTop:1,paddingLeft:1,children:(0,G.jsx)(d,{dimColor:!0,children:(0,G.jsx)(V,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`})})})]}):(0,G.jsxs)(u,{flexDirection:`column`,children:[(0,G.jsx)(u,{marginBottom:1,children:(0,G.jsx)(d,{bold:!0,children:`Select marketplace`})}),F&&(0,G.jsx)(u,{marginBottom:1,flexDirection:`column`,children:(0,G.jsxs)(d,{color:`warning`,children:[a.warning,` `,F]})}),b.map((e,t)=>(0,G.jsxs)(u,{flexDirection:`column`,marginBottom:+(t<b.length-1),children:[(0,G.jsx)(u,{children:(0,G.jsxs)(d,{color:D===t?`suggestion`:void 0,children:[D===t?a.pointer:` `,` `,e.name]})}),(0,G.jsx)(u,{marginLeft:2,children:(0,G.jsxs)(d,{dimColor:!0,children:[e.totalPlugins,` `,H(e.totalPlugins,`plugin`),` available`,e.installedCount>0&&` · ${e.installedCount} already installed`,e.source&&` · ${e.source}`]})})]},e.name)),(0,G.jsx)(u,{marginTop:1,children:(0,G.jsx)(d,{dimColor:!0,italic:!0,children:(0,G.jsxs)(f,{children:[(0,G.jsx)(V,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`select`}),(0,G.jsx)(V,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`})]})})})]});if(m===`plugin-details`&&v){let e=v.entry.homepage,t=xn(e,bn(v));return(0,G.jsxs)(u,{flexDirection:`column`,children:[(0,G.jsx)(u,{marginBottom:1,children:(0,G.jsx)(d,{bold:!0,children:`Plugin Details`})}),(0,G.jsxs)(u,{flexDirection:`column`,marginBottom:1,children:[(0,G.jsx)(d,{bold:!0,children:v.entry.name}),v.entry.version&&(0,G.jsxs)(d,{dimColor:!0,children:[`Version: `,v.entry.version]}),v.entry.description&&(0,G.jsx)(u,{marginTop:1,children:(0,G.jsx)(d,{children:v.entry.description})}),v.entry.author&&(0,G.jsx)(u,{marginTop:1,children:(0,G.jsxs)(d,{dimColor:!0,children:[`By:`,` `,typeof v.entry.author==`string`?v.entry.author:v.entry.author.name]})})]}),(0,G.jsxs)(u,{flexDirection:`column`,marginBottom:1,children:[(0,G.jsx)(d,{bold:!0,children:`Will install:`}),v.entry.commands&&(0,G.jsxs)(d,{dimColor:!0,children:[`· Commands:`,` `,Array.isArray(v.entry.commands)?v.entry.commands.join(`, `):Object.keys(v.entry.commands).join(`, `)]}),v.entry.agents&&(0,G.jsxs)(d,{dimColor:!0,children:[`· Agents:`,` `,Array.isArray(v.entry.agents)?v.entry.agents.join(`, `):Object.keys(v.entry.agents).join(`, `)]}),v.entry.hooks&&(0,G.jsxs)(d,{dimColor:!0,children:[`· Hooks: `,Object.keys(v.entry.hooks).join(`, `)]}),v.entry.mcpServers&&(0,G.jsxs)(d,{dimColor:!0,children:[`· MCP Servers:`,` `,Array.isArray(v.entry.mcpServers)?v.entry.mcpServers.join(`, `):typeof v.entry.mcpServers==`object`?Object.keys(v.entry.mcpServers).join(`, `):`configured`]}),!v.entry.commands&&!v.entry.agents&&!v.entry.hooks&&!v.entry.mcpServers&&(typeof v.entry.source==`object`&&`source`in v.entry.source&&(v.entry.source.source===`github`||v.entry.source.source===`url`||v.entry.source.source===`npm`||v.entry.source.source===`pip`)?(0,G.jsx)(d,{dimColor:!0,children:`· Component summary not available for remote plugin`}):(0,G.jsx)(d,{dimColor:!0,children:`· Components will be discovered at installation`}))]}),(0,G.jsx)(_n,{}),ce&&(0,G.jsx)(u,{marginBottom:1,children:(0,G.jsxs)(d,{color:`error`,children:[`Error: `,ce]})}),(0,G.jsx)(u,{flexDirection:`column`,children:t.map((e,t)=>(0,G.jsxs)(u,{children:[M===t&&(0,G.jsx)(d,{children:`> `}),M!==t&&(0,G.jsx)(d,{children:` `}),(0,G.jsx)(d,{bold:M===t,children:oe&&e.action===`install`?`Installing…`:e.label})]},e.action))}),(0,G.jsx)(u,{marginTop:1,paddingLeft:1,children:(0,G.jsx)(d,{dimColor:!0,children:(0,G.jsxs)(f,{children:[(0,G.jsx)(V,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`select`}),(0,G.jsx)(V,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]})})})]})}if(S.length===0)return(0,G.jsxs)(u,{flexDirection:`column`,children:[(0,G.jsx)(u,{marginBottom:1,children:(0,G.jsx)(d,{bold:!0,children:`Install plugins`})}),(0,G.jsx)(d,{dimColor:!0,children:`No new plugins available to install.`}),(0,G.jsx)(d,{dimColor:!0,children:`All plugins from this marketplace are already installed.`}),(0,G.jsx)(u,{marginLeft:3,children:(0,G.jsx)(d,{dimColor:!0,italic:!0,children:(0,G.jsx)(V,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`})})})]});let he=j.getVisibleItems(S);return(0,G.jsxs)(u,{flexDirection:`column`,children:[(0,G.jsx)(u,{marginBottom:1,children:(0,G.jsx)(d,{bold:!0,children:`Install Plugins`})}),j.scrollPosition.canScrollUp&&(0,G.jsx)(u,{children:(0,G.jsxs)(d,{dimColor:!0,children:[` `,a.arrowUp,` more above`]})}),he.map((t,n)=>{let r=j.toActualIndex(n),i=D===r,o=k.has(t.pluginId),s=re.has(t.pluginId);return(0,G.jsxs)(u,{flexDirection:`column`,marginBottom:n===he.length-1&&!e?0:1,children:[(0,G.jsxs)(u,{children:[(0,G.jsxs)(d,{color:i?`suggestion`:void 0,children:[i?a.pointer:` `,` `]}),(0,G.jsxs)(d,{color:t.isInstalled?`success`:void 0,children:[t.isInstalled?a.tick:s?a.ellipsis:o?a.radioOn:a.radioOff,` `,t.entry.name,t.entry.category&&(0,G.jsxs)(d,{dimColor:!0,children:[` [`,t.entry.category,`]`]}),t.entry.tags?.includes(`community-managed`)&&(0,G.jsx)(d,{dimColor:!0,children:` [Community Managed]`}),t.isInstalled&&(0,G.jsx)(d,{dimColor:!0,children:` (installed)`}),ne&&g===`claude-plugins-official`&&(0,G.jsxs)(d,{dimColor:!0,children:[` · `,kt(ne.get(t.pluginId)??0),` installs`]})]})]}),t.entry.description&&(0,G.jsxs)(u,{marginLeft:4,children:[(0,G.jsx)(d,{dimColor:!0,children:dt(t.entry.description,60)}),t.entry.version&&(0,G.jsxs)(d,{dimColor:!0,children:[` · v`,t.entry.version]})]})]},t.pluginId)}),j.scrollPosition.canScrollDown&&(0,G.jsx)(u,{children:(0,G.jsxs)(d,{dimColor:!0,children:[` `,a.arrowDown,` more below`]})}),e&&(0,G.jsx)(u,{marginTop:1,children:(0,G.jsxs)(d,{color:`error`,children:[a.cross,` `,e]})}),(0,G.jsx)(Sn,{hasSelection:k.size>0})]})}var An,W,G,jn=e((()=>{i(),An=t(h(),1),W=t(h(),1),Oe(),S(),O(),Ze(),He(),Ye(),We(),F(),Et(),z(),I(),Re(),ve(),ne(),j(),lt(),ft(),gn(),yn(),wn(),On(),G=C()}));function Mn({error:e,setError:t,result:n,setResult:r,setViewState:i,onInstallComplete:o,onSearchModeChange:s,targetPlugin:l}){let[h,_]=(0,K.useState)(`plugin-list`),[y,x]=(0,K.useState)(null),[S,ee]=(0,K.useState)([]),[te,C]=(0,K.useState)(!0),[w,ne]=(0,K.useState)(null),[E,D]=(0,K.useState)(!1),O=(0,K.useCallback)(e=>{D(e),s?.(e)},[s]),{query:A,setQuery:re,cursorOffset:ie}=Ut({isActive:h===`plugin-list`&&E&&!te,onExit:()=>{O(!1)}}),ae=m(),{columns:j}=b(),M=(0,K.useMemo)(()=>{if(!A)return S;let e=A.toLowerCase();return S.filter(t=>t.entry.name.toLowerCase().includes(e)||t.entry.description?.toLowerCase().includes(e)||t.marketplaceName.toLowerCase().includes(e))},[S,A]),[N,oe]=(0,K.useState)(0),[P,ce]=(0,K.useState)(new Set),[ue,F]=(0,K.useState)(new Set),I=Tn({totalItems:M.length,selectedIndex:N});(0,K.useEffect)(()=>{oe(0)},[A]);let[de,fe]=(0,K.useState)(0),[me,he]=(0,K.useState)(!1),[_e,ve]=(0,K.useState)(null),[ye,be]=(0,K.useState)(null),[z,xe]=(0,K.useState)(null);(0,K.useEffect)(()=>{async function e(){try{let e=await B(),{marketplaces:n,failures:r}=await T(e),i=[];for(let{name:e,data:t}of n)if(t)for(let n of t.plugins){let t=L(n.name,e);i.push({entry:n,marketplaceName:e,pluginId:t,isInstalled:pe(t)})}let a=i.filter(e=>!e.isInstalled&&!se(e.pluginId));try{let e=await At();ne(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){Je(`Failed to fetch install counts: ${Ge(e)}`),a.sort((e,t)=>e.entry.name.localeCompare(t.entry.name))}ee(a);let o=Object.keys(e).length;if(a.length===0){let e=await k({configuredMarketplaceCount:o,failedMarketplaceCount:r.length});xe(e)}let s=R(r,Qe(n,e=>e.data!==null));if(s)if(s.type===`warning`)be(`${s.message}. Showing available plugins.`);else throw Error(s.message);if(l){let e=i.find(e=>e.entry.name===l);e?e.isInstalled?t(`Plugin '${e.pluginId}' is already installed. Use '/plugin' to manage existing plugins.`):(x(e),_(`plugin-details`)):t(`Plugin "${l}" not found in any marketplace`)}}catch(e){t(e instanceof Error?e.message:`Failed to load plugins`)}finally{C(!1)}}e()},[t,l]);let Se=async()=>{if(P.size===0)return;let e=S.filter(e=>P.has(e.pluginId));F(new Set(e.map(e=>e.pluginId)));let n=0,a=0,s=[];for(let t of e){let e=await ge({pluginId:t.pluginId,entry:t.entry,marketplaceName:t.marketplaceName,scope:`user`});e.success?n++:(a++,s.push({name:t.entry.name,reason:e.error}))}F(new Set),ce(new Set),le(),a===0?r(`✓ Installed ${n} ${H(n,`plugin`)}. Run /reload-plugins to activate.`):n===0?t(`Failed to install: ${Be(s,!0)}`):r(`✓ Installed ${n} of ${n+a} plugins. Failed: ${Be(s,!1)}. Run /reload-plugins to activate successfully installed plugins.`),n>0&&o&&await o(),i({type:`menu`})},Ce=async(e,t=`user`)=>{he(!0),ve(null);let n=await ge({pluginId:e.pluginId,entry:e.entry,marketplaceName:e.marketplaceName,scope:t});if(n.success){let t=await fn(e.pluginId);if(t){he(!1),_({type:`plugin-options`,plugin:t,pluginId:e.pluginId});return}r(n.message),o&&await o(),i({type:`menu`})}else he(!1),ve(n.error)};(0,K.useEffect)(()=>{e&&r(e)},[e,r]),p(`confirm:no`,()=>{_(`plugin-list`),x(null)},{context:`Confirmation`,isActive:h===`plugin-details`}),p(`confirm:no`,()=>{i({type:`menu`})},{context:`Confirmation`,isActive:h===`plugin-list`&&!E}),g((e,t)=>{let n=!t.ctrl&&!t.meta;E||(e===`/`&&n?(O(!0),re(``)):n&&e.length>0&&!/^\s+$/.test(e)&&e!==`j`&&e!==`k`&&e!==`i`&&(O(!0),re(e)))},{isActive:h===`plugin-list`&&!te}),c({"select:previous":()=>{N===0?O(!0):I.handleSelectionChange(N-1,oe)},"select:next":()=>{N<M.length-1&&I.handleSelectionChange(N+1,oe)},"select:accept":()=>{if(N===M.length&&P.size>0)Se();else if(N<M.length){let e=M[N];e&&(e.isInstalled?i({type:`manage-plugins`,targetPlugin:e.entry.name,targetMarketplace:e.marketplaceName}):(x(e),_(`plugin-details`),fe(0),ve(null)))}}},{context:`Select`,isActive:h===`plugin-list`&&!E}),c({"plugin:toggle":()=>{if(N<M.length){let e=M[N];if(e&&!e.isInstalled){let t=new Set(P);t.has(e.pluginId)?t.delete(e.pluginId):t.add(e.pluginId),ce(t)}}},"plugin:install":()=>{P.size>0&&Se()}},{context:`Plugin`,isActive:h===`plugin-list`&&!E});let Te=Fn.useMemo(()=>{if(!y)return[];let e=y.entry.homepage;return xn(e,bn(y))},[y]);if(c({"select:previous":()=>{de>0&&fe(de-1)},"select:next":()=>{de<Te.length-1&&fe(de+1)},"select:accept":()=>{if(!y)return;let e=Te[de]?.action,t=y.entry.homepage,n=bn(y);e===`install-user`?Ce(y,`user`):e===`install-project`?Ce(y,`project`):e===`install-local`?Ce(y,`local`):e===`homepage`&&t?we(t):e===`github`&&n?we(`https://github.com/${n}`):e===`back`&&(_(`plugin-list`),x(null))}},{context:`Select`,isActive:h===`plugin-details`&&!!y}),typeof h==`object`&&h.type===`plugin-options`){let{plugin:e,pluginId:t}=h;function n(e){r(e),o&&o(),i({type:`menu`})}return(0,q.jsx)(pn,{plugin:e,pluginId:t,onDone:(t,r)=>{switch(t){case`configured`:n(`✓ Installed and configured ${e.name}. Run /reload-plugins to apply.`);break;case`skipped`:n(`✓ Installed ${e.name}. Run /reload-plugins to apply.`);break;case`error`:n(`Installed but failed to save config: ${r}`);break}}})}if(te)return(0,q.jsx)(d,{children:`Loading…`});if(e)return(0,q.jsx)(d,{color:`error`,children:e});if(h===`plugin-details`&&y){let e=y.entry.homepage,t=xn(e,bn(y));return(0,q.jsxs)(u,{flexDirection:`column`,children:[(0,q.jsx)(u,{marginBottom:1,children:(0,q.jsx)(d,{bold:!0,children:`Plugin details`})}),(0,q.jsxs)(u,{flexDirection:`column`,marginBottom:1,children:[(0,q.jsx)(d,{bold:!0,children:y.entry.name}),(0,q.jsxs)(d,{dimColor:!0,children:[`from `,y.marketplaceName]}),y.entry.version&&(0,q.jsxs)(d,{dimColor:!0,children:[`Version: `,y.entry.version]}),y.entry.description&&(0,q.jsx)(u,{marginTop:1,children:(0,q.jsx)(d,{children:y.entry.description})}),y.entry.author&&(0,q.jsx)(u,{marginTop:1,children:(0,q.jsxs)(d,{dimColor:!0,children:[`By:`,` `,typeof y.entry.author==`string`?y.entry.author:y.entry.author.name]})})]}),(0,q.jsx)(_n,{}),_e&&(0,q.jsx)(u,{marginBottom:1,children:(0,q.jsxs)(d,{color:`error`,children:[`Error: `,_e]})}),(0,q.jsx)(u,{flexDirection:`column`,children:t.map((e,t)=>(0,q.jsxs)(u,{children:[de===t&&(0,q.jsx)(d,{children:`> `}),de!==t&&(0,q.jsx)(d,{children:` `}),(0,q.jsx)(d,{bold:de===t,children:me&&e.action.startsWith(`install-`)?`Installing…`:e.label})]},e.action))}),(0,q.jsx)(u,{marginTop:1,children:(0,q.jsx)(d,{dimColor:!0,children:(0,q.jsxs)(f,{children:[(0,q.jsx)(V,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`select`}),(0,q.jsx)(V,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]})})})]})}if(S.length===0)return(0,q.jsxs)(u,{flexDirection:`column`,children:[(0,q.jsx)(u,{marginBottom:1,children:(0,q.jsx)(d,{bold:!0,children:`Discover plugins`})}),(0,q.jsx)(Pn,{reason:z}),(0,q.jsx)(u,{marginTop:1,children:(0,q.jsx)(d,{dimColor:!0,italic:!0,children:`Esc to go back`})})]});let Ee=I.getVisibleItems(M);return(0,q.jsxs)(u,{flexDirection:`column`,children:[(0,q.jsxs)(u,{children:[(0,q.jsx)(d,{bold:!0,children:`Discover plugins`}),I.needsPagination&&(0,q.jsxs)(d,{dimColor:!0,children:[` `,`(`,I.scrollPosition.current,`/`,I.scrollPosition.total,`)`]})]}),(0,q.jsx)(u,{marginBottom:1,children:(0,q.jsx)(v,{query:A,isFocused:E,isTerminalFocused:ae,width:j-4,cursorOffset:ie})}),ye&&(0,q.jsx)(u,{marginBottom:1,children:(0,q.jsxs)(d,{color:`warning`,children:[a.warning,` `,ye]})}),M.length===0&&A&&(0,q.jsx)(u,{marginBottom:1,children:(0,q.jsxs)(d,{dimColor:!0,children:[`No plugins match "`,A,`"`]})}),I.scrollPosition.canScrollUp&&(0,q.jsx)(u,{children:(0,q.jsxs)(d,{dimColor:!0,children:[` `,a.arrowUp,` more above`]})}),Ee.map((t,n)=>{let r=I.toActualIndex(n),i=N===r,o=P.has(t.pluginId),s=ue.has(t.pluginId);return(0,q.jsxs)(u,{flexDirection:`column`,marginBottom:n===Ee.length-1&&!e?0:1,children:[(0,q.jsxs)(u,{children:[(0,q.jsxs)(d,{color:i&&!E?`suggestion`:void 0,children:[i&&!E?a.pointer:` `,` `]}),(0,q.jsxs)(d,{children:[s?a.ellipsis:o?a.radioOn:a.radioOff,` `,t.entry.name,(0,q.jsxs)(d,{dimColor:!0,children:[` · `,t.marketplaceName]}),t.entry.tags?.includes(`community-managed`)&&(0,q.jsx)(d,{dimColor:!0,children:` [Community Managed]`}),w&&t.marketplaceName===`claude-plugins-official`&&(0,q.jsxs)(d,{dimColor:!0,children:[` · `,kt(w.get(t.pluginId)??0),` installs`]})]})]}),t.entry.description&&(0,q.jsx)(u,{marginLeft:4,children:(0,q.jsx)(d,{dimColor:!0,children:dt(t.entry.description,60)})})]},`${I.startIndex}-${t.pluginId}`)}),I.scrollPosition.canScrollDown&&(0,q.jsx)(u,{children:(0,q.jsxs)(d,{dimColor:!0,children:[` `,a.arrowDown,` more below`]})}),e&&(0,q.jsx)(u,{marginTop:1,children:(0,q.jsxs)(d,{color:`error`,children:[a.cross,` `,e]})}),(0,q.jsx)(Nn,{hasSelection:P.size>0,canToggle:N<M.length&&!M[N]?.isInstalled})]})}function Nn({hasSelection:e,canToggle:t}){return(0,q.jsx)(u,{marginTop:1,children:(0,q.jsx)(d,{dimColor:!0,italic:!0,children:(0,q.jsxs)(f,{children:[e&&(0,q.jsx)(V,{action:`plugin:install`,context:`Plugin`,fallback:`i`,description:`install`,bold:!0}),(0,q.jsx)(d,{children:`type to search`}),t&&(0,q.jsx)(V,{action:`plugin:toggle`,context:`Plugin`,fallback:`Space`,description:`toggle`}),(0,q.jsx)(V,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`details`}),(0,q.jsx)(V,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]})})})}function Pn({reason:e}){switch(e){case`git-not-installed`:return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(d,{dimColor:!0,children:`Git is required to install marketplaces.`}),(0,q.jsx)(d,{dimColor:!0,children:`Please install git and restart Work Mate.`})]});case`all-blocked-by-policy`:return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(d,{dimColor:!0,children:`Your organization policy does not allow any external marketplaces.`}),(0,q.jsx)(d,{dimColor:!0,children:`Contact your administrator.`})]});case`policy-restricts-sources`:return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(d,{dimColor:!0,children:`Your organization restricts which marketplaces can be added.`}),(0,q.jsx)(d,{dimColor:!0,children:`Switch to the Marketplaces tab to view allowed sources.`})]});case`all-marketplaces-failed`:return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(d,{dimColor:!0,children:`Failed to load marketplace data.`}),(0,q.jsx)(d,{dimColor:!0,children:`Check your network connection.`})]});case`all-plugins-installed`:return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(d,{dimColor:!0,children:`All available plugins are already installed.`}),(0,q.jsx)(d,{dimColor:!0,children:`Check for new plugins later or add more marketplaces.`})]});default:return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(d,{dimColor:!0,children:`No plugins available.`}),(0,q.jsx)(d,{dimColor:!0,children:`Add a marketplace first using the Marketplaces tab.`})]})}}var Fn,K,q,In=e((()=>{i(),Fn=t(h(),1),K=t(h(),1),Oe(),Ht(),S(),Wt(),je(),O(),Ze(),He(),Ye(),We(),F(),Et(),z(),I(),Re(),ve(),ne(),j(),lt(),ft(),gn(),yn(),wn(),On(),q=C()}));function Ln({setViewState:e,error:t,setError:n,setResult:r,exitState:i,onManageComplete:o,targetMarketplace:s,action:l}){let[m,h]=(0,zn.useState)([]),[_,v]=(0,zn.useState)(!0),[y,b]=(0,zn.useState)(0),[x,S]=(0,zn.useState)(!1),[ee,te]=(0,zn.useState)(null),[C,w]=(0,zn.useState)(null),[ne,E]=(0,zn.useState)(null),[D,O]=(0,zn.useState)(`list`),[k,A]=(0,zn.useState)(null),[re,j]=(0,zn.useState)(0),M=(0,zn.useRef)(!1);(0,zn.useEffect)(()=>{async function e(){try{let e=await B(),{enabled:r,disabled:i}=await ae(),a=[...r,...i],{marketplaces:o,failures:c}=await T(e),u=[];for(let{name:e,config:t,data:n}of o){let r=a.filter(t=>t.source.endsWith(`@${e}`));u.push({name:e,source:ie(t.source),lastUpdated:t.lastUpdated,pluginCount:n?.plugins.length,installedPlugins:r,pendingUpdate:!1,pendingRemove:!1,autoUpdate:tt(e,t)})}u.sort((e,t)=>e.name===`claude-plugin-directory`?-1:t.name===`claude-plugin-directory`?1:e.name.localeCompare(t.name)),h(u);let d=R(c,Qe(o,e=>e.data!==null));if(d)if(d.type===`warning`)te(d.message);else throw Error(d.message);if(s&&!M.current&&!t){M.current=!0;let e=u.findIndex(e=>e.name===s);if(e>=0){let t=u[e];if(l){b(e+1);let t=[...u];l===`update`?t[e].pendingUpdate=!0:l===`remove`&&(t[e].pendingRemove=!0),h(t),setTimeout(P,100,t)}else t&&(b(e+1),A(t),O(`details`))}else n&&n(`Marketplace not found: ${s}`)}}catch(e){n&&n(e instanceof Error?e.message:`Failed to load marketplaces`),te(e instanceof Error?e.message:`Failed to load marketplaces`)}finally{v(!1)}}e()},[s,l,t]);let N=()=>m.some(e=>e.pendingUpdate||e.pendingRemove),oe=()=>({updateCount:Qe(m,e=>e.pendingUpdate),removeCount:Qe(m,e=>e.pendingRemove)}),P=async t=>{let i=t||m,s=D===`details`;S(!0),te(null),w(null),E(null);try{let t=it(`userSettings`),n=0,c=0,l=new Set;for(let e of i){if(e.pendingRemove){if(e.installedPlugins&&e.installedPlugins.length>0){let n={...t?.enabledPlugins};for(let t of e.installedPlugins){let r=L(t.name,e.name);n[r]=!1}et(`userSettings`,{enabledPlugins:n})}await De(e.name),c++,e.name,e.installedPlugins?.length;continue}e.pendingUpdate&&(await Me(e.name,e=>{E(e)}),n++,l.add(e.name.toLowerCase()),e.name)}let u=0;l.size>0&&(u=(await $t(l)).length),le(),o&&await o();let d=await B(),{enabled:f,disabled:p}=await ae(),m=[...f,...p],{marketplaces:g}=await T(d),_=[];for(let{name:e,config:t,data:n}of g){let r=m.filter(t=>t.source.endsWith(`@${e}`));_.push({name:e,source:ie(t.source),lastUpdated:t.lastUpdated,pluginCount:n?.plugins.length,installedPlugins:r,pendingUpdate:!1,pendingRemove:!1,autoUpdate:tt(e,t)})}if(_.sort((e,t)=>e.name===`claude-plugin-directory`?-1:t.name===`claude-plugin-directory`?1:e.name.localeCompare(t.name)),h(_),s&&k){let e=_.find(e=>e.name===k.name);e&&A(e)}let v=[];if(n>0){let e=u>0?` (${u} ${H(u,`plugin`)} bumped)`:``;v.push(`Updated ${n} ${H(n,`marketplace`)}${e}`)}if(c>0&&v.push(`Removed ${c} ${H(c,`marketplace`)}`),v.length>0){let t=`${a.tick} ${v.join(`, `)}`;s?w(t):(r(t),setTimeout(e,2e3,{type:`menu`}))}else s||e({type:`menu`})}catch(e){let t=Ge(e);te(t),n&&n(t)}finally{S(!1),E(null)}},se=async()=>{if(!k)return;let e=m.map(e=>e.name===k.name?{...e,pendingRemove:!0}:e);h(e),await P(e)},ce=e=>{if(!e)return[];let t=[{label:`Browse plugins (${e.pluginCount??0})`,value:`browse`},{label:`Update marketplace`,secondaryLabel:e.lastUpdated?`(last updated ${new Date(e.lastUpdated).toLocaleDateString()})`:void 0,value:`update`}];return ot()||t.push({label:e.autoUpdate?`Disable auto-update`:`Enable auto-update`,value:`toggle-auto-update`}),t.push({label:`Remove marketplace`,value:`remove`}),t},ue=async e=>{let t=!e.autoUpdate;try{await Ve(e.name,t),h(n=>n.map(n=>n.name===e.name?{...n,autoUpdate:t}:n)),A(e=>e&&{...e,autoUpdate:t})}catch(e){te(e instanceof Error?e.message:`Failed to update setting`)}};if(p(`confirm:no`,()=>{O(`list`),j(0)},{context:`Confirmation`,isActive:!x&&(D===`details`||D===`confirm-remove`)}),p(`confirm:no`,()=>{h(e=>e.map(e=>({...e,pendingUpdate:!1,pendingRemove:!1}))),b(0)},{context:`Confirmation`,isActive:!x&&D===`list`&&N()}),p(`confirm:no`,()=>{e({type:`menu`})},{context:`Confirmation`,isActive:!x&&D===`list`&&!N()}),c({"select:previous":()=>b(e=>Math.max(0,e-1)),"select:next":()=>{let e=m.length+1;b(t=>Math.min(e-1,t+1))},"select:accept":()=>{let t=y-1;if(y===0)e({type:`add-marketplace`});else if(N())P();else{let e=m[t];e&&(A(e),O(`details`),j(0))}}},{context:`Select`,isActive:!x&&D===`list`}),g(e=>{let t=y-1;if((e===`u`||e===`U`)&&t>=0)h(e=>e.map((e,n)=>n===t?{...e,pendingUpdate:!e.pendingUpdate,pendingRemove:e.pendingUpdate?e.pendingRemove:!1}:e));else if((e===`r`||e===`R`)&&t>=0){let e=m[t];e&&(A(e),O(`confirm-remove`))}},{isActive:!x&&D===`list`}),c({"select:previous":()=>j(e=>Math.max(0,e-1)),"select:next":()=>{let e=ce(k);j(t=>Math.min(e.length-1,t+1))},"select:accept":()=>{if(!k)return;let t=ce(k)[re];if(t?.value===`browse`)e({type:`browse-marketplace`,targetMarketplace:k.name});else if(t?.value===`update`){let e=m.map(e=>e.name===k.name?{...e,pendingUpdate:!0}:e);h(e),P(e)}else t?.value===`toggle-auto-update`?ue(k):t?.value===`remove`&&O(`confirm-remove`)}},{context:`Select`,isActive:!x&&D===`details`}),g(e=>{e===`y`||e===`Y`?se():(e===`n`||e===`N`)&&(O(`list`),A(null))},{isActive:!x&&D===`confirm-remove`}),_)return(0,J.jsx)(d,{children:`Loading marketplaces…`});if(m.length===0)return(0,J.jsxs)(u,{flexDirection:`column`,children:[(0,J.jsx)(u,{marginBottom:1,children:(0,J.jsx)(d,{bold:!0,children:`Manage marketplaces`})}),(0,J.jsxs)(u,{flexDirection:`row`,gap:1,children:[(0,J.jsxs)(d,{color:`suggestion`,children:[a.pointer,` +`]}),(0,J.jsx)(d,{bold:!0,color:`suggestion`,children:`Add Marketplace`})]}),(0,J.jsx)(u,{marginLeft:3,children:(0,J.jsx)(d,{dimColor:!0,italic:!0,children:i.pending?(0,J.jsxs)(J.Fragment,{children:[`Press `,i.keyName,` again to go back`]}):(0,J.jsxs)(f,{children:[(0,J.jsx)(V,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`select`}),(0,J.jsx)(V,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`})]})})})]});if(D===`confirm-remove`&&k){let e=k.installedPlugins?.length||0;return(0,J.jsxs)(u,{flexDirection:`column`,children:[(0,J.jsxs)(d,{bold:!0,color:`warning`,children:[`Remove marketplace `,(0,J.jsx)(d,{italic:!0,children:k.name}),`?`]}),(0,J.jsxs)(u,{flexDirection:`column`,children:[e>0&&(0,J.jsx)(u,{marginTop:1,children:(0,J.jsxs)(d,{color:`warning`,children:[`This will also uninstall `,e,` `,H(e,`plugin`),` from this marketplace:`]})}),k.installedPlugins&&k.installedPlugins.length>0&&(0,J.jsx)(u,{flexDirection:`column`,marginTop:1,marginLeft:2,children:k.installedPlugins.map(e=>(0,J.jsxs)(d,{dimColor:!0,children:[`• `,e.name]},e.name))}),(0,J.jsx)(u,{marginTop:1,children:(0,J.jsxs)(d,{children:[`Press `,(0,J.jsx)(d,{bold:!0,children:`y`}),` to confirm or `,(0,J.jsx)(d,{bold:!0,children:`n`}),` to cancel`]})})]})]})}if(D===`details`&&k){let e=k.pendingUpdate||x,t=ce(k);return(0,J.jsxs)(u,{flexDirection:`column`,children:[(0,J.jsx)(d,{bold:!0,children:k.name}),(0,J.jsx)(d,{dimColor:!0,children:k.source}),(0,J.jsx)(u,{marginTop:1,children:(0,J.jsxs)(d,{children:[k.pluginCount||0,` available `,H(k.pluginCount||0,`plugin`)]})}),k.installedPlugins&&k.installedPlugins.length>0&&(0,J.jsxs)(u,{flexDirection:`column`,marginTop:1,children:[(0,J.jsxs)(d,{bold:!0,children:[`Installed plugins (`,k.installedPlugins.length,`):`]}),(0,J.jsx)(u,{flexDirection:`column`,marginLeft:1,children:k.installedPlugins.map(e=>(0,J.jsxs)(u,{flexDirection:`row`,gap:1,children:[(0,J.jsx)(d,{children:a.bullet}),(0,J.jsxs)(u,{flexDirection:`column`,children:[(0,J.jsx)(d,{children:e.name}),(0,J.jsx)(d,{dimColor:!0,children:e.manifest.description})]})]},e.name))})]}),e&&(0,J.jsxs)(u,{marginTop:1,flexDirection:`column`,children:[(0,J.jsx)(d,{color:`claude`,children:`Updating marketplace…`}),ne&&(0,J.jsx)(d,{dimColor:!0,children:ne})]}),!e&&C&&(0,J.jsx)(u,{marginTop:1,children:(0,J.jsx)(d,{color:`claude`,children:C})}),!e&&ee&&(0,J.jsx)(u,{marginTop:1,children:(0,J.jsx)(d,{color:`error`,children:ee})}),!e&&(0,J.jsx)(u,{flexDirection:`column`,marginTop:1,children:t.map((e,t)=>{if(!e)return null;let n=t===re;return(0,J.jsxs)(u,{children:[(0,J.jsxs)(d,{color:n?`suggestion`:void 0,children:[n?a.pointer:` `,` `,e.label]}),e.secondaryLabel&&(0,J.jsxs)(d,{dimColor:!0,children:[` `,e.secondaryLabel]})]},e.value)})}),!e&&!ot()&&k.autoUpdate&&(0,J.jsx)(u,{marginTop:1,children:(0,J.jsx)(d,{dimColor:!0,children:`Auto-update enabled. Work Mate will automatically update this marketplace and its installed plugins.`})}),(0,J.jsx)(u,{marginLeft:3,children:(0,J.jsx)(d,{dimColor:!0,italic:!0,children:e?(0,J.jsx)(J.Fragment,{children:`Please wait…`}):(0,J.jsxs)(f,{children:[(0,J.jsx)(V,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`select`}),(0,J.jsx)(V,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`})]})})})]})}let{updateCount:F,removeCount:I}=oe();return(0,J.jsxs)(u,{flexDirection:`column`,children:[(0,J.jsx)(u,{marginBottom:1,children:(0,J.jsx)(d,{bold:!0,children:`Manage marketplaces`})}),(0,J.jsxs)(u,{flexDirection:`row`,gap:1,marginBottom:1,children:[(0,J.jsxs)(d,{color:y===0?`suggestion`:void 0,children:[y===0?a.pointer:` `,` +`]}),(0,J.jsx)(d,{bold:!0,color:y===0?`suggestion`:void 0,children:`Add Marketplace`})]}),(0,J.jsx)(u,{flexDirection:`column`,children:m.map((e,t)=>{let n=t+1===y,r=[];return e.pendingUpdate&&r.push(`UPDATE`),e.pendingRemove&&r.push(`REMOVE`),(0,J.jsxs)(u,{flexDirection:`row`,gap:1,marginBottom:1,children:[(0,J.jsxs)(d,{color:n?`suggestion`:void 0,children:[n?a.pointer:` `,` `,e.pendingRemove?a.cross:a.bullet]}),(0,J.jsxs)(u,{flexDirection:`column`,flexGrow:1,children:[(0,J.jsxs)(u,{flexDirection:`row`,gap:1,children:[(0,J.jsxs)(d,{bold:!0,strikethrough:e.pendingRemove,dimColor:e.pendingRemove,children:[e.name===`claude-plugins-official`&&(0,J.jsx)(d,{color:`claude`,children:`✻ `}),e.name,e.name===`claude-plugins-official`&&(0,J.jsx)(d,{color:`claude`,children:` ✻`})]}),r.length>0&&(0,J.jsxs)(d,{color:`warning`,children:[`[`,r.join(`, `),`]`]})]}),(0,J.jsx)(d,{dimColor:!0,children:e.source}),(0,J.jsxs)(d,{dimColor:!0,children:[e.pluginCount!==void 0&&(0,J.jsxs)(J.Fragment,{children:[e.pluginCount,` available`]}),e.installedPlugins&&e.installedPlugins.length>0&&(0,J.jsxs)(J.Fragment,{children:[` • `,e.installedPlugins.length,` installed`]}),e.lastUpdated&&(0,J.jsxs)(J.Fragment,{children:[` • Updated `,new Date(e.lastUpdated).toLocaleDateString()]})]})]})]},e.name)})}),N()&&(0,J.jsxs)(u,{marginTop:1,flexDirection:`column`,children:[(0,J.jsxs)(d,{children:[(0,J.jsx)(d,{bold:!0,children:`Pending changes:`}),` `,(0,J.jsx)(d,{dimColor:!0,children:`Enter to apply`})]}),F>0&&(0,J.jsxs)(d,{children:[`• Update `,F,` `,H(F,`marketplace`)]}),I>0&&(0,J.jsxs)(d,{color:`warning`,children:[`• Remove `,I,` `,H(I,`marketplace`)]})]}),x&&(0,J.jsx)(u,{marginTop:1,children:(0,J.jsx)(d,{color:`claude`,children:`Processing changes…`})}),ee&&(0,J.jsx)(u,{marginTop:1,children:(0,J.jsx)(d,{color:`error`,children:ee})}),(0,J.jsx)(Rn,{exitState:i,hasPendingActions:N()})]})}function Rn({exitState:e,hasPendingActions:t}){return e.pending?(0,J.jsx)(u,{marginTop:1,children:(0,J.jsxs)(d,{dimColor:!0,italic:!0,children:[`Press `,e.keyName,` again to go back`]})}):(0,J.jsx)(u,{marginTop:1,children:(0,J.jsx)(d,{dimColor:!0,italic:!0,children:(0,J.jsxs)(f,{children:[t&&(0,J.jsx)(V,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`apply changes`}),!t&&(0,J.jsx)(V,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`select`}),!t&&(0,J.jsx)(o,{shortcut:`u`,action:`update`}),!t&&(0,J.jsx)(o,{shortcut:`r`,action:`remove`}),(0,J.jsx)(V,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:t?`cancel`:`go back`})]})})})}var zn,J,Bn=e((()=>{i(),zn=t(h(),1),ut(),Oe(),S(),O(),Ze(),at(),We(),F(),I(),Re(),en(),fe(),$e(),rt(),lt(),J=C()}));function Vn(e){switch(e.type){case`path-not-found`:return`${e.component} path not found: ${e.path}`;case`git-auth-failed`:return`Git ${e.authType.toUpperCase()} authentication failed for ${e.gitUrl}`;case`git-timeout`:return`Git ${e.operation} timed out for ${e.gitUrl}`;case`network-error`:return`Network error accessing ${e.url}${e.details?`: ${e.details}`:``}`;case`manifest-parse-error`:return`Failed to parse manifest at ${e.manifestPath}: ${e.parseError}`;case`manifest-validation-error`:return`Invalid manifest at ${e.manifestPath}: ${e.validationErrors.join(`, `)}`;case`plugin-not-found`:return`Plugin "${e.pluginId}" not found in marketplace "${e.marketplace}"`;case`marketplace-not-found`:return`Marketplace "${e.marketplace}" not found`;case`marketplace-load-failed`:return`Failed to load marketplace "${e.marketplace}": ${e.reason}`;case`mcp-config-invalid`:return`Invalid MCP server config for "${e.serverName}": ${e.validationError}`;case`mcp-server-suppressed-duplicate`:{let t=e.duplicateOf.startsWith(`plugin:`)?`server provided by plugin "${e.duplicateOf.split(`:`)[1]??`?`}"`:`already-configured "${e.duplicateOf}"`;return`MCP server "${e.serverName}" skipped — same command/URL as ${t}`}case`hook-load-failed`:return`Failed to load hooks from ${e.hookPath}: ${e.reason}`;case`component-load-failed`:return`Failed to load ${e.component} from ${e.path}: ${e.reason}`;case`mcpb-download-failed`:return`Failed to download MCPB from ${e.url}: ${e.reason}`;case`mcpb-extract-failed`:return`Failed to extract MCPB ${e.mcpbPath}: ${e.reason}`;case`mcpb-invalid-manifest`:return`MCPB manifest invalid at ${e.mcpbPath}: ${e.validationError}`;case`marketplace-blocked-by-policy`:return e.blockedByBlocklist?`Marketplace "${e.marketplace}" is blocked by enterprise policy`:`Marketplace "${e.marketplace}" is not in the allowed marketplace list`;case`dependency-unsatisfied`:return e.reason===`not-enabled`?`Dependency "${e.dependency}" is disabled`:`Dependency "${e.dependency}" is not installed`;case`lsp-config-invalid`:return`Invalid LSP server config for "${e.serverName}": ${e.validationError}`;case`lsp-server-start-failed`:return`LSP server "${e.serverName}" failed to start: ${e.reason}`;case`lsp-server-crashed`:return e.signal?`LSP server "${e.serverName}" crashed with signal ${e.signal}`:`LSP server "${e.serverName}" crashed with exit code ${e.exitCode??`unknown`}`;case`lsp-request-timeout`:return`LSP server "${e.serverName}" timed out on ${e.method} after ${e.timeoutMs}ms`;case`lsp-request-failed`:return`LSP server "${e.serverName}" ${e.method} failed: ${e.error}`;case`plugin-cache-miss`:return`Plugin "${e.plugin}" not cached at ${e.installPath}`;case`generic-error`:return e.error}return Ee(e)}function Hn(e){switch(e.type){case`path-not-found`:return`Check that the path in your manifest or marketplace config is correct`;case`git-auth-failed`:return e.authType===`ssh`?`Configure SSH keys or use HTTPS URL instead`:`Configure credentials or use SSH URL instead`;case`git-timeout`:case`network-error`:return`Check your internet connection and try again`;case`manifest-parse-error`:return`Check manifest file syntax in the plugin directory`;case`manifest-validation-error`:return`Check manifest file follows the required schema`;case`plugin-not-found`:return`Plugin may not exist in marketplace "${e.marketplace}"`;case`marketplace-not-found`:return e.availableMarketplaces.length>0?`Available marketplaces: ${e.availableMarketplaces.join(`, `)}`:`Add the marketplace first using /plugin marketplace add`;case`mcp-config-invalid`:return`Check MCP server configuration in .mcp.json or manifest`;case`mcp-server-suppressed-duplicate`:return e.duplicateOf.startsWith(`plugin:`)?`Disable plugin "${e.duplicateOf.split(`:`)[1]??`the other plugin`}" if you want this plugin's version instead`:`Remove "${e.duplicateOf}" from your MCP config if you want the plugin's version instead`;case`hook-load-failed`:return`Check hooks.json file syntax and structure`;case`component-load-failed`:return`Check ${e.component} directory structure and file permissions`;case`mcpb-download-failed`:return`Check your internet connection and URL accessibility`;case`mcpb-extract-failed`:return`Verify the MCPB file is valid and not corrupted`;case`mcpb-invalid-manifest`:return`Contact the plugin author about the invalid manifest`;case`marketplace-blocked-by-policy`:return e.blockedByBlocklist?`This marketplace source is explicitly blocked by your administrator`:e.allowedSources.length>0?`Allowed sources: ${e.allowedSources.join(`, `)}`:`Contact your administrator to configure allowed marketplace sources`;case`dependency-unsatisfied`:return e.reason===`not-enabled`?`Enable "${e.dependency}" or uninstall "${e.plugin}"`:`Install "${e.dependency}" or uninstall "${e.plugin}"`;case`lsp-config-invalid`:return`Check LSP server configuration in the plugin manifest`;case`lsp-server-start-failed`:case`lsp-server-crashed`:case`lsp-request-timeout`:case`lsp-request-failed`:return`Check LSP server logs with --debug for details`;case`plugin-cache-miss`:return`Run /plugins to refresh the plugin cache`;case`marketplace-load-failed`:case`generic-error`:return null}return null}var Un=e((()=>{Ie()}));function Wn({item:e,isSelected:t}){let[n]=l();if(e.type===`plugin`){let r,i;return e.pendingToggle?(r=_(`suggestion`,n)(a.arrowRight),i=e.pendingToggle===`will-enable`?`will enable`:`will disable`):e.errorCount>0?(r=_(`error`,n)(a.cross),i=`${e.errorCount} ${H(e.errorCount,`error`)}`):e.isEnabled?(r=_(`success`,n)(a.tick),i=`enabled`):(r=_(`inactive`,n)(a.radioOff),i=`disabled`),(0,Y.jsxs)(u,{children:[(0,Y.jsx)(d,{color:t?`suggestion`:void 0,children:t?`${a.pointer} `:` `}),(0,Y.jsx)(d,{color:t?`suggestion`:void 0,children:e.name}),(0,Y.jsxs)(d,{dimColor:!t,children:[` `,(0,Y.jsx)(d,{backgroundColor:`userMessageBackground`,children:`Plugin`})]}),(0,Y.jsxs)(d,{dimColor:!0,children:[` · `,e.marketplace]}),(0,Y.jsxs)(d,{dimColor:!t,children:[` · `,r,` `]}),(0,Y.jsx)(d,{dimColor:!t,children:i})]})}if(e.type===`flagged-plugin`){let r=_(`warning`,n)(a.warning);return(0,Y.jsxs)(u,{children:[(0,Y.jsx)(d,{color:t?`suggestion`:void 0,children:t?`${a.pointer} `:` `}),(0,Y.jsx)(d,{color:t?`suggestion`:void 0,children:e.name}),(0,Y.jsxs)(d,{dimColor:!t,children:[` `,(0,Y.jsx)(d,{backgroundColor:`userMessageBackground`,children:`Plugin`})]}),(0,Y.jsxs)(d,{dimColor:!0,children:[` · `,e.marketplace]}),(0,Y.jsxs)(d,{dimColor:!t,children:[` · `,r,` `]}),(0,Y.jsx)(d,{dimColor:!t,children:`removed`})]})}if(e.type===`failed-plugin`){let r=_(`error`,n)(a.cross),i=`failed to load · ${e.errorCount} ${H(e.errorCount,`error`)}`;return(0,Y.jsxs)(u,{children:[(0,Y.jsx)(d,{color:t?`suggestion`:void 0,children:t?`${a.pointer} `:` `}),(0,Y.jsx)(d,{color:t?`suggestion`:void 0,children:e.name}),(0,Y.jsxs)(d,{dimColor:!t,children:[` `,(0,Y.jsx)(d,{backgroundColor:`userMessageBackground`,children:`Plugin`})]}),(0,Y.jsxs)(d,{dimColor:!0,children:[` · `,e.marketplace]}),(0,Y.jsxs)(d,{dimColor:!t,children:[` · `,r,` `]}),(0,Y.jsx)(d,{dimColor:!t,children:i})]})}let r,i;return e.status===`connected`?(r=_(`success`,n)(a.tick),i=`connected`):e.status===`disabled`?(r=_(`inactive`,n)(a.radioOff),i=`disabled`):e.status===`pending`?(r=_(`inactive`,n)(a.radioOff),i=`connecting…`):e.status===`needs-auth`?(r=_(`warning`,n)(a.triangleUpOutline),i=`Enter to auth`):(r=_(`error`,n)(a.cross),i=`failed`),e.indented?(0,Y.jsxs)(u,{children:[(0,Y.jsx)(d,{color:t?`suggestion`:void 0,children:t?`${a.pointer} `:` `}),(0,Y.jsx)(d,{dimColor:!t,children:`└ `}),(0,Y.jsx)(d,{color:t?`suggestion`:void 0,children:e.name}),(0,Y.jsxs)(d,{dimColor:!t,children:[` `,(0,Y.jsx)(d,{backgroundColor:`userMessageBackground`,children:`MCP`})]}),(0,Y.jsxs)(d,{dimColor:!t,children:[` · `,r,` `]}),(0,Y.jsx)(d,{dimColor:!t,children:i})]}):(0,Y.jsxs)(u,{children:[(0,Y.jsx)(d,{color:t?`suggestion`:void 0,children:t?`${a.pointer} `:` `}),(0,Y.jsx)(d,{color:t?`suggestion`:void 0,children:e.name}),(0,Y.jsxs)(d,{dimColor:!t,children:[` `,(0,Y.jsx)(d,{backgroundColor:`userMessageBackground`,children:`MCP`})]}),(0,Y.jsxs)(d,{dimColor:!t,children:[` · `,r,` `]}),(0,Y.jsx)(d,{dimColor:!t,children:i})]})}var Y,Gn=e((()=>{i(),S(),lt(),Y=C()}));async function Kn(e){try{return(await nn.readdir(e,{withFileTypes:!0})).filter(e=>e.isFile()&&e.name.endsWith(`.md`)).map(e=>tn.basename(e.name,`.md`))}catch(t){return Je(`Failed to read plugin components from ${e}: ${Ge(t)}`,{level:`error`}),ct(qe(t)),[]}}async function qn(e){try{let t=await nn.readdir(e,{withFileTypes:!0}),n=[];for(let r of t)if(r.isDirectory()||r.isSymbolicLink()){let t=tn.join(e,r.name,`SKILL.md`);try{(await nn.stat(t)).isFile()&&n.push(r.name)}catch{}}return n}catch(t){return Je(`Failed to read skill directories from ${e}: ${Ge(t)}`,{level:`error`}),ct(qe(t)),[]}}function Jn({plugin:e,marketplace:t}){let[n,r]=(0,X.useState)(null),[i,a]=(0,X.useState)(!0),[o,s]=(0,X.useState)(null);return(0,X.useEffect)(()=>{async function n(){try{if(t===`builtin`){let t=Ce(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 Fe(t)).plugins.find(t=>t.name===e.name);if(n){let t=[];e.commandsPath&&t.push(e.commandsPath),e.commandsPaths&&t.push(...e.commandsPaths);let i=[];for(let e of t)if(typeof e==`string`){let t=await Kn(e);i.push(...t)}let a=[];e.agentsPath&&a.push(e.agentsPath),e.agentsPaths&&a.push(...e.agentsPaths);let o=[];for(let e of a)if(typeof e==`string`){let t=await Kn(e);o.push(...t)}let s=[];e.skillsPath&&s.push(e.skillsPath),e.skillsPaths&&s.push(...e.skillsPaths);let c=[];for(let e of s)if(typeof e==`string`){let t=await qn(e);c.push(...t)}let l=[];e.hooksConfig&&l.push(Object.keys(e.hooksConfig)),n.hooks&&l.push(n.hooks);let u=[];e.mcpServers&&u.push(Object.keys(e.mcpServers)),n.mcpServers&&u.push(n.mcpServers),r({commands:i.length>0?i:null,agents:o.length>0?o:null,skills:c.length>0?c:null,hooks:l.length>0?l:null,mcpServers:u.length>0?u:null})}else s(`Plugin ${e.name} not found in marketplace`)}catch(e){s(e instanceof Error?e.message:`Failed to load components`)}finally{a(!1)}}n()},[e.name,e.commandsPath,e.commandsPaths,e.agentsPath,e.agentsPaths,e.skillsPath,e.skillsPaths,e.hooksConfig,e.mcpServers,t]),i?null:o?(0,Z.jsxs)(u,{flexDirection:`column`,marginBottom:1,children:[(0,Z.jsx)(d,{bold:!0,children:`Components:`}),(0,Z.jsxs)(d,{dimColor:!0,children:[`Error: `,o]})]}):!n||!(n.commands||n.agents||n.skills||n.hooks||n.mcpServers)?null:(0,Z.jsxs)(u,{flexDirection:`column`,marginBottom:1,children:[(0,Z.jsx)(d,{bold:!0,children:`Installed components:`}),n.commands?(0,Z.jsxs)(d,{dimColor:!0,children:[`• Commands:`,` `,typeof n.commands==`string`?n.commands:Array.isArray(n.commands)?n.commands.join(`, `):Object.keys(n.commands).join(`, `)]}):null,n.agents?(0,Z.jsxs)(d,{dimColor:!0,children:[`• Agents:`,` `,typeof n.agents==`string`?n.agents:Array.isArray(n.agents)?n.agents.join(`, `):Object.keys(n.agents).join(`, `)]}):null,n.skills?(0,Z.jsxs)(d,{dimColor:!0,children:[`• Skills:`,` `,typeof n.skills==`string`?n.skills:Array.isArray(n.skills)?n.skills.join(`, `):Object.keys(n.skills).join(`, `)]}):null,n.hooks?(0,Z.jsxs)(d,{dimColor:!0,children:[`• Hooks:`,` `,typeof n.hooks==`string`?n.hooks:Array.isArray(n.hooks)?n.hooks.map(String).join(`, `):typeof n.hooks==`object`&&n.hooks!==null?Object.keys(n.hooks).join(`, `):String(n.hooks)]}):null,n.mcpServers?(0,Z.jsxs)(d,{dimColor:!0,children:[`• MCP Servers:`,` `,typeof n.mcpServers==`string`?n.mcpServers:Array.isArray(n.mcpServers)?n.mcpServers.map(String).join(`, `):typeof n.mcpServers==`object`&&n.mcpServers!==null?Object.keys(n.mcpServers).join(`, `):String(n.mcpServers)]}):null]})}async function Yn(e,t){let n=(await Fe(t))?.plugins.find(t=>t.name===e);return n&&typeof n.source==`string`?`Local plugins cannot be updated remotely. To update, modify the source at: ${n.source}`:null}function Xn(e){return e.filter(e=>{let t=e.source.split(`@`)[1]||`local`;return!se(`${e.name}@${t}`)})}function Zn({setViewState:e,setResult:t,onManageComplete:n,onSearchModeChange:r,targetPlugin:i,targetMarketplace:o,action:s}){let l=E(e=>e.mcp.clients),h=E(e=>e.mcp.tools),_=E(e=>e.plugins.errors),y=Nt(),[x,S]=(0,X.useState)(!1),ee=(0,X.useCallback)(e=>{S(e),r?.(e)},[r]),te=m(),{columns:C}=b(),[w,T]=(0,X.useState)(`plugin-list`),{query:ne,setQuery:D,cursorOffset:O}=Ut({isActive:w===`plugin-list`&&x,onExit:()=>{ee(!1)}}),[k,A]=(0,X.useState)(null),[re,ie]=(0,X.useState)([]),[j,M]=(0,X.useState)([]),[N,oe]=(0,X.useState)(!0),[P,se]=(0,X.useState)(new Map),F=(0,X.useRef)(!1),I=(0,X.useRef)(void 0),fe=It();p(`confirm:no`,Qn.useCallback(()=>{if(w===`plugin-details`)T(`plugin-list`),A(null),B(null);else if(typeof w==`object`&&w.type===`failed-plugin-details`)T(`plugin-list`),B(null);else if(w===`configuring`)T(`plugin-details`),De(null);else if(typeof w==`object`&&(w.type===`plugin-options`||w.type===`configuring-options`))T(`plugin-list`),A(null),t(`Plugin enabled. Configuration skipped — run /reload-plugins to apply.`),n&&n();else if(typeof w==`object`&&w.type===`flagged-detail`)T(`plugin-list`),B(null);else if(typeof w==`object`&&w.type===`mcp-detail`)T(`plugin-list`),B(null);else if(typeof w==`object`&&w.type===`mcp-tools`)T({type:`mcp-detail`,client:w.client});else if(typeof w==`object`&&w.type===`mcp-tool-detail`)T({type:`mcp-tools`,client:w.client});else{if(P.size>0){t(`Run /reload-plugins to apply plugin changes.`);return}e({type:`menu`})}},[w,e,P,t]),{context:`Confirmation`,isActive:(w!==`plugin-list`||!x)&&w!==`confirm-project-uninstall`&&!(typeof w==`object`&&w.type===`confirm-data-cleanup`)});let pe=e=>e.type===`connected`?`connected`:e.type===`disabled`?`disabled`:e.type===`pending`?`pending`:e.type===`needs-auth`?`needs-auth`:`failed`,me=(0,X.useMemo)(()=>{let e=nt(),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 j){let i=`${r.plugin.name}@${r.marketplace}`,a=e?.enabledPlugins?.[i]!==!1,o=_.filter(e=>`plugin`in e&&e.plugin===r.plugin.name||e.source===i||e.source.startsWith(`${r.plugin.name}@`)),s=r.plugin.isBuiltin?`builtin`:r.scope||`user`;n.push({item:{type:`plugin`,id:i,name:r.plugin.name,description:r.plugin.manifest.description,marketplace:r.marketplace,scope:s,isEnabled:a,errorCount:o.length,errors:o,plugin:r.plugin,pendingEnable:r.pendingEnable,pendingUpdate:r.pendingUpdate,pendingToggle:P.get(i)},originalScope:s,childMcps:t.get(r.plugin.name)||[]})}let r=new Set(n.map(({item:e})=>e.id)),i=new Set(n.map(({item:e})=>e.name)),a=new Map;for(let e of _){if(r.has(e.source)||`plugin`in e&&typeof e.plugin==`string`&&i.has(e.plugin))continue;let t=a.get(e.source)||[];t.push(e),a.set(e.source,t)}let o=gt(),s=[];for(let[e,t]of a){if(e in y)continue;let n=Pe(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:pe(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:pe(n),client:n,indented:!0})}}for(let e of c){let t=e.scope;f.has(t)||f.set(t,[]),f.get(t).push(e)}for(let e of s){let t=e.scope;f.has(t)||f.set(t,[]),f.get(t).push(e)}for(let[e,t]of Object.entries(y)){let n=Pe(e),r=n.name||e,i=n.marketplace||`unknown`;f.has(`flagged`)||f.set(`flagged`,[]),f.get(`flagged`).push({type:`flagged-plugin`,id:e,name:r,marketplace:i,scope:`flagged`,reason:`delisted`,text:`Removed from marketplace`,flaggedAt:t.flaggedAt})}let p=[...f.keys()].sort((e,t)=>(u[e]??99)-(u[t]??99));for(let e of p){let t=f.get(e),n=[],r=[],i=0;for(;i<t.length;){let e=t[i];if(e.type===`plugin`||e.type===`failed-plugin`||e.type===`flagged-plugin`){let r=[e];i++;let a=t[i];for(;a?.type===`mcp`&&a.indented;)r.push(a),i++,a=t[i];n.push(r)}else e.type===`mcp`&&!e.indented&&r.push(e),i++}n.sort((e,t)=>e[0].name.localeCompare(t[0].name)),r.sort((e,t)=>e.name.localeCompare(t.name));for(let e of n)d.push(...e);d.push(...r)}return d},[j,l,_,P,y]),he=(0,X.useMemo)(()=>me.filter(e=>e.type===`flagged-plugin`).map(e=>e.id),[me]);(0,X.useEffect)(()=>{he.length>0&&Mt(he)},[he]);let L=(0,X.useMemo)(()=>{if(!ne)return me;let e=ne.toLowerCase();return me.filter(t=>t.name.toLowerCase().includes(e)||`description`in t&&t.description?.toLowerCase().includes(e))},[me,ne]),[R,ge]=(0,X.useState)(0),_e=Tn({totalItems:L.length,selectedIndex:R,maxVisible:8}),[ve,ye]=(0,X.useState)(0),[be,z]=(0,X.useState)(!1),[Ce,B]=(0,X.useState)(null),[Ee,De]=(0,X.useState)(null),[Oe,ke]=(0,X.useState)(!1),[Ae,je]=(0,X.useState)(!1);(0,X.useEffect)(()=>{if(!k){je(!1);return}async function e(){let e=k.plugin.manifest.mcpServers,t=!1;if(e&&(t=typeof e==`string`&&xe(e)||Array.isArray(e)&&e.some(e=>typeof e==`string`&&xe(e))),!t)try{let e=tn.join(k.plugin.path,`..`),n=tn.join(e,`.claude-plugin`,`marketplace.json`),r=Ke(await nn.readFile(n,`utf-8`)).plugins?.find(e=>e.name===k.plugin.name);if(r?.mcpServers){let e=r.mcpServers;t=typeof e==`string`&&xe(e)||Array.isArray(e)&&e.some(e=>typeof e==`string`&&xe(e))}}catch(e){Je(`Failed to read raw marketplace.json: ${e}`)}je(t)}e()},[k]),(0,X.useEffect)(()=>{async function e(){oe(!0);try{let{enabled:e,disabled:t}=await ae(),n=nt(),r=Xn([...e,...t]),i={};for(let e of r){let t=e.source.split(`@`)[1]||`local`;i[t]||(i[t]=[]),i[t].push(e)}let a=[];for(let[e,t]of Object.entries(i)){let r=Qe(t,t=>{let r=`${t.name}@${e}`;return n?.enabledPlugins?.[r]!==!1}),i=t.length-r;a.push({name:e,installedPlugins:t,enabledCount:r,disabledCount:i})}a.sort((e,t)=>e.name===`claude-plugin-directory`?-1:t.name===`claude-plugin-directory`?1:e.name.localeCompare(t.name)),ie(a);let o=[];for(let e of a)for(let t of e.installedPlugins){let n=`${t.name}@${e.name}`,r=t.isBuiltin?`builtin`:St(n).scope;o.push({plugin:t,marketplace:e.name,scope:r,pendingEnable:void 0,pendingUpdate:!1})}M(o),ge(0)}finally{oe(!1)}}e()},[]),(0,X.useEffect)(()=>{if(!F.current&&i&&re.length>0&&!N){let{name:e,marketplace:n}=Pe(i),r=o??n,a=r?re.filter(e=>e.name===r):re;for(let t of a){let n=t.installedPlugins.find(t=>t.name===e);if(n){let{scope:e}=St(`${n.name}@${t.name}`),r={plugin:n,marketplace:t.name,scope:e,pendingEnable:void 0,pendingUpdate:!1};A(r),T(`plugin-details`),I.current=s,F.current=!0;return}}let c=me.find(t=>t.type===`failed-plugin`&&t.name===e);c&&c.type===`failed-plugin`&&(T({type:`failed-plugin-details`,plugin:{id:c.id,name:c.name,marketplace:c.marketplace,errors:c.errors,scope:c.scope}}),F.current=!0),!F.current&&s&&(F.current=!0,t(`Plugin "${i}" is not installed in this project`))}},[i,o,re,N,me,s,t]);let Me=async r=>{if(!k)return;let i=k.scope||`user`,a=i===`builtin`;if(a&&(r===`update`||r===`uninstall`)){B(`Built-in plugins cannot be updated or uninstalled.`);return}if(!a&&!xt(i)&&r!==`update`){B(`This plugin is managed by your organization. Contact your admin to disable it.`);return}z(!0),B(null);try{let o=`${k.plugin.name}@${k.marketplace}`,s;switch(r){case`enable`:{let e=await _t(o);if(!e.success)throw Error(e.message);break}case`disable`:{let e=await bt(o);if(!e.success)throw Error(e.message);s=e.reverseDependents;break}case`uninstall`:{if(a||!xt(i))break;if(wt(o)){z(!1),T(`confirm-project-uninstall`);return}let e=Le().plugins[o],t=!e||e.length<=1?await de(o):null;if(t){z(!1),T({type:`confirm-data-cleanup`,size:t});return}let n=await vt(o,i);if(!n.success)throw Error(n.message);s=n.reverseDependents;break}case`update`:{if(a)break;let r=await yt(o,i);if(!r.success)throw Error(r.message);if(r.alreadyUpToDate){t(`${k.plugin.name} is already at the latest version (${r.newVersion}).`),n&&await n(),e({type:`menu`});return}break}}le();let c=`${k.plugin.name}@${k.marketplace}`;if(nt()?.enabledPlugins?.[c]!==!1){z(!1),T({type:`plugin-options`});return}let l=r===`enable`?`Enabled`:r===`disable`?`Disabled`:r===`update`?`Updated`:`Uninstalled`,u=s&&s.length>0?` · required by ${s.join(`, `)}`:``;t(`✓ ${l} ${k.plugin.name}${u}. Run /reload-plugins to apply.`),n&&await n(),e({type:`menu`})}catch(e){z(!1);let t=e instanceof Error?e.message:String(e);B(`Failed to ${r}: ${t}`),ct(qe(e))}},Fe=(0,X.useRef)(Me);Fe.current=Me,(0,X.useEffect)(()=>{if(w===`plugin-details`&&k&&I.current){let e=I.current;I.current=void 0,Fe.current(e)}},[w,k]);let Ie=Qn.useCallback(()=>{if(R>=L.length)return;let e=L[R];if(e?.type!==`flagged-plugin`)if(e?.type===`plugin`){let t=`${e.plugin.name}@${e.marketplace}`,n=nt(),r=P.get(t),i=n?.enabledPlugins?.[t]!==!1,a=e.scope;if(a===`builtin`||xt(a)){let e=new Map(P);r?(e.delete(t),(async()=>{try{r===`will-disable`?await _t(t):await bt(t),le()}catch(e){ct(e)}})()):(e.set(t,i?`will-disable`:`will-enable`),(async()=>{try{i?await bt(t):await _t(t),le()}catch(e){ct(e)}})()),se(e)}}else e?.type===`mcp`&&fe(e.client.name)},[R,L,P,j,fe]);c({"select:previous":()=>{R===0?ee(!0):_e.handleSelectionChange(R-1,ge)},"select:next":()=>{R<L.length-1&&_e.handleSelectionChange(R+1,ge)},"select:accept":Qn.useCallback(()=>{if(R>=L.length)return;let e=L[R];if(e?.type===`plugin`){let t=j.find(t=>t.plugin.name===e.plugin.name&&t.marketplace===e.marketplace);t&&(A(t),T(`plugin-details`),ye(0),B(null))}else e?.type===`flagged-plugin`?(T({type:`flagged-detail`,plugin:{id:e.id,name:e.name,marketplace:e.marketplace,reason:e.reason,text:e.text,flaggedAt:e.flaggedAt}}),B(null)):e?.type===`failed-plugin`?(T({type:`failed-plugin-details`,plugin:{id:e.id,name:e.name,marketplace:e.marketplace,errors:e.errors,scope:e.scope}}),ye(0),B(null)):e?.type===`mcp`&&(T({type:`mcp-detail`,client:e.client}),B(null))},[R,L,j])},{context:`Select`,isActive:w===`plugin-list`&&!x}),c({"plugin:toggle":Ie},{context:`Plugin`,isActive:w===`plugin-list`&&!x}),c({"select:accept":Qn.useCallback(()=>{typeof w!=`object`||w.type!==`flagged-detail`||(Pt(w.plugin.id),T(`plugin-list`))},[w])},{context:`Select`,isActive:typeof w==`object`&&w.type===`flagged-detail`});let Re=Qn.useMemo(()=>{if(w!==`plugin-details`||!k)return[];let e=nt(),t=`${k.plugin.name}@${k.marketplace}`,n=e?.enabledPlugins?.[t]!==!1,r=k.marketplace===`builtin`,i=[];return i.push({label:n?`Disable plugin`:`Enable plugin`,action:()=>void Me(n?`disable`:`enable`)}),r||(i.push({label:k.pendingUpdate?`Unmark for update`:`Mark for update`,action:async()=>{try{let e=await Yn(k.plugin.name,k.marketplace);if(e){B(e);return}let t=[...j],n=t.findIndex(e=>e.plugin.name===k.plugin.name&&e.marketplace===k.marketplace);n!==-1&&(t[n].pendingUpdate=!k.pendingUpdate,M(t),A({...k,pendingUpdate:!k.pendingUpdate}))}catch(e){B(e instanceof Error?e.message:`Failed to check plugin update availability`)}}}),Ae&&i.push({label:`Configure`,action:async()=>{ke(!0);try{let e=k.plugin.manifest.mcpServers,t=null;if(typeof e==`string`&&xe(e))t=e;else if(Array.isArray(e)){for(let n of e)if(typeof n==`string`&&xe(n)){t=n;break}}if(!t){B(`No MCPB file found in plugin`),ke(!1);return}let n=`${k.plugin.name}@${k.marketplace}`,r=await Se(t,k.plugin.path,n,void 0,void 0,!0);`status`in r&&r.status===`needs-config`?(De(r),T(`configuring`)):B(`Failed to load MCPB for configuration`)}catch(e){let t=Ge(e);B(`Failed to load configuration: ${t}`)}finally{ke(!1)}}}),k.plugin.manifest.userConfig&&Object.keys(k.plugin.manifest.userConfig).length>0&&i.push({label:`Configure options`,action:()=>{T({type:`configuring-options`,schema:k.plugin.manifest.userConfig})}}),i.push({label:`Update now`,action:()=>void Me(`update`)}),i.push({label:`Uninstall`,action:()=>void Me(`uninstall`)})),k.plugin.manifest.homepage&&i.push({label:`Open homepage`,action:()=>void we(k.plugin.manifest.homepage)}),k.plugin.manifest.repository&&i.push({label:`View repository`,action:()=>void we(k.plugin.manifest.repository)}),i.push({label:`Back to plugin list`,action:()=>{T(`plugin-list`),A(null),B(null)}}),i},[w,k,Ae,j]);if(c({"select:previous":()=>{ve>0&&ye(ve-1)},"select:next":()=>{ve<Re.length-1&&ye(ve+1)},"select:accept":()=>{Re[ve]&&Re[ve].action()}},{context:`Select`,isActive:w===`plugin-details`&&!!k}),c({"select:accept":()=>{typeof w==`object`&&w.type===`failed-plugin-details`&&(async()=>{z(!0),B(null);let e=w.plugin.id,t=w.plugin.scope,r=xt(t)?await vt(e,t,!1):await vt(e,`user`,!1),i=r.success;if(!i){for(let t of[`userSettings`,`projectSettings`,`localSettings`]){let n=it(t);n?.enabledPlugins?.[e]!==void 0&&(et(t,{enabledPlugins:{...n.enabledPlugins,[e]:void 0}}),i=!0)}le()}i?(n&&await n(),z(!1),T(`plugin-list`)):(z(!1),B(r.message))})()}},{context:`Select`,isActive:typeof w==`object`&&w.type===`failed-plugin-details`&&w.plugin.scope!==`managed`}),c({"confirm:yes":()=>{if(!k)return;z(!0),B(null);let r=`${k.plugin.name}@${k.marketplace}`,{error:i}=et(`localSettings`,{enabledPlugins:{...it(`localSettings`)?.enabledPlugins,[r]:!1}});if(i){z(!1),B(`Failed to write settings: ${i.message}`);return}le(),t(`✓ Disabled ${k.plugin.name} in .workmate/settings.local.json. Run /reload-plugins to apply.`),n&&n(),e({type:`menu`})},"confirm:no":()=>{T(`plugin-details`),B(null)}},{context:`Confirmation`,isActive:w===`confirm-project-uninstall`&&!!k&&!be}),g((r,i)=>{if(!k)return;let o=`${k.plugin.name}@${k.marketplace}`,s=k.scope;if(!s||s===`builtin`||!xt(s))return;let c=async r=>{z(!0),B(null);try{let i=await vt(o,s,r);if(!i.success)throw Error(i.message);le();let c=r?``:` · data preserved`;t(`${a.tick} ${i.message}${c}`),n&&n(),e({type:`menu`})}catch(e){z(!1),B(e instanceof Error?e.message:String(e))}};r===`y`||r===`Y`?c(!0):r===`n`||r===`N`?c(!1):i.escape&&(T(`plugin-details`),B(null))},{isActive:typeof w==`object`&&w.type===`confirm-data-cleanup`&&!!k&&!be}),Qn.useEffect(()=>{ge(0)},[ne]),g((e,t)=>{let n=!t.ctrl&&!t.meta;x||(e===`/`&&n?(ee(!0),D(``),ge(0)):n&&e.length>0&&!/^\s+$/.test(e)&&e!==`j`&&e!==`k`&&e!==` `&&(ee(!0),D(e),ge(0)))},{isActive:w===`plugin-list`}),N)return(0,Z.jsx)(d,{children:`Loading installed plugins…`});if(me.length===0)return(0,Z.jsxs)(u,{flexDirection:`column`,children:[(0,Z.jsx)(u,{marginBottom:1,children:(0,Z.jsx)(d,{bold:!0,children:`Manage plugins`})}),(0,Z.jsx)(d,{children:`No plugins or MCP servers installed.`}),(0,Z.jsx)(u,{marginTop:1,children:(0,Z.jsx)(d,{dimColor:!0,children:`Esc to go back`})})]});if(typeof w==`object`&&w.type===`plugin-options`&&k){let r=`${k.plugin.name}@${k.marketplace}`;function i(r){t(r),n&&n(),e({type:`menu`})}return(0,Z.jsx)(pn,{plugin:k.plugin,pluginId:r,onDone:(e,t)=>{switch(e){case`configured`:i(`✓ Enabled and configured ${k.plugin.name}. Run /reload-plugins to apply.`);break;case`skipped`:i(`✓ Enabled ${k.plugin.name}. Run /reload-plugins to apply.`);break;case`error`:i(`Failed to save configuration: ${t}`);break}}})}if(typeof w==`object`&&w.type===`configuring-options`&&k){let e=`${k.plugin.name}@${k.marketplace}`;return(0,Z.jsx)(cn,{title:`Configure ${k.plugin.name}`,subtitle:`Plugin options`,configSchema:w.schema,initialValues:ce(e),onSave:n=>{try{Ne(e,n,w.schema),le(),t(`Configuration saved. Run /reload-plugins for changes to take effect.`)}catch(e){B(`Failed to save configuration: ${Ge(e)}`)}T(`plugin-details`)},onCancel:()=>T(`plugin-details`)})}if(w===`configuring`&&Ee&&k){let e=`${k.plugin.name}@${k.marketplace}`;async function n(n){if(!(!Ee||!k))try{let r=k.plugin.manifest.mcpServers,i=null;if(typeof r==`string`&&xe(r))i=r;else if(Array.isArray(r)){for(let e of r)if(typeof e==`string`&&xe(e)){i=e;break}}if(!i){B(`No MCPB file found`),T(`plugin-details`);return}await Se(i,k.plugin.path,e,void 0,n),B(null),De(null),T(`plugin-details`),t(`Configuration saved. Run /reload-plugins for changes to take effect.`)}catch(e){let t=Ge(e);B(`Failed to save configuration: ${t}`),T(`plugin-details`)}}function r(){De(null),T(`plugin-details`)}return(0,Z.jsx)(cn,{title:`Configure ${Ee.manifest.name}`,subtitle:`Plugin: ${k.plugin.name}`,configSchema:Ee.configSchema,initialValues:Ee.existingConfig,onSave:n,onCancel:r})}if(typeof w==`object`&&w.type===`flagged-detail`){let e=w.plugin;return(0,Z.jsxs)(u,{flexDirection:`column`,children:[(0,Z.jsx)(u,{children:(0,Z.jsxs)(d,{bold:!0,children:[e.name,` @ `,e.marketplace]})}),(0,Z.jsxs)(u,{marginBottom:1,children:[(0,Z.jsx)(d,{dimColor:!0,children:`Status: `}),(0,Z.jsx)(d,{color:`error`,children:`Removed`})]}),(0,Z.jsxs)(u,{marginBottom:1,flexDirection:`column`,children:[(0,Z.jsxs)(d,{color:`error`,children:[`Removed from marketplace · reason: `,e.reason]}),(0,Z.jsx)(d,{children:e.text}),(0,Z.jsxs)(d,{dimColor:!0,children:[`Flagged on `,new Date(e.flaggedAt).toLocaleDateString()]})]}),(0,Z.jsx)(u,{marginTop:1,flexDirection:`column`,children:(0,Z.jsxs)(u,{children:[(0,Z.jsxs)(d,{children:[a.pointer,` `]}),(0,Z.jsx)(d,{color:`suggestion`,children:`Dismiss`})]})}),(0,Z.jsxs)(f,{children:[(0,Z.jsx)(V,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`dismiss`}),(0,Z.jsx)(V,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]})]})}if(w===`confirm-project-uninstall`&&k)return(0,Z.jsxs)(u,{flexDirection:`column`,children:[(0,Z.jsxs)(d,{bold:!0,color:`warning`,children:[k.plugin.name,` is enabled in .workmate/settings.json (shared with your team)`]}),(0,Z.jsxs)(u,{marginTop:1,flexDirection:`column`,children:[(0,Z.jsx)(d,{children:`Disable it just for you in .workmate/settings.local.json?`}),(0,Z.jsx)(d,{dimColor:!0,children:`This has the same effect as uninstalling, without affecting other contributors.`})]}),Ce&&(0,Z.jsx)(u,{marginTop:1,children:(0,Z.jsx)(d,{color:`error`,children:Ce})}),(0,Z.jsx)(u,{marginTop:1,children:be?(0,Z.jsx)(d,{dimColor:!0,children:`Disabling…`}):(0,Z.jsxs)(f,{children:[(0,Z.jsx)(V,{action:`confirm:yes`,context:`Confirmation`,fallback:`y`,description:`disable`}),(0,Z.jsx)(V,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})]})})]});if(typeof w==`object`&&w.type===`confirm-data-cleanup`&&k)return(0,Z.jsxs)(u,{flexDirection:`column`,children:[(0,Z.jsxs)(d,{bold:!0,children:[k.plugin.name,` has `,w.size.human,` of persistent data`]}),(0,Z.jsxs)(u,{marginTop:1,flexDirection:`column`,children:[(0,Z.jsx)(d,{children:`Delete it along with the plugin?`}),(0,Z.jsx)(d,{dimColor:!0,children:ue(`${k.plugin.name}@${k.marketplace}`)})]}),Ce&&(0,Z.jsx)(u,{marginTop:1,children:(0,Z.jsx)(d,{color:`error`,children:Ce})}),(0,Z.jsx)(u,{marginTop:1,children:be?(0,Z.jsx)(d,{dimColor:!0,children:`Uninstalling…`}):(0,Z.jsxs)(d,{children:[(0,Z.jsx)(d,{bold:!0,children:`y`}),` to delete · `,(0,Z.jsx)(d,{bold:!0,children:`n`}),` to keep · `,(0,Z.jsx)(d,{bold:!0,children:`esc`}),` to cancel`]})})]});if(w===`plugin-details`&&k){let e=nt(),t=`${k.plugin.name}@${k.marketplace}`,n=e?.enabledPlugins?.[t]!==!1,r=_.filter(e=>`plugin`in e&&e.plugin===k.plugin.name||e.source===t||e.source.startsWith(`${k.plugin.name}@`)),i=r.length===0?null:(0,Z.jsxs)(u,{flexDirection:`column`,marginBottom:1,children:[(0,Z.jsxs)(d,{bold:!0,color:`error`,children:[r.length,` `,H(r.length,`error`),`:`]}),r.map((e,t)=>{let n=Hn(e);return(0,Z.jsxs)(u,{flexDirection:`column`,marginLeft:2,children:[(0,Z.jsx)(d,{color:`error`,children:Vn(e)}),n&&(0,Z.jsxs)(d,{dimColor:!0,italic:!0,children:[a.arrowRight,` `,n]})]},t)})]});return(0,Z.jsxs)(u,{flexDirection:`column`,children:[(0,Z.jsx)(u,{children:(0,Z.jsxs)(d,{bold:!0,children:[k.plugin.name,` @ `,k.marketplace]})}),(0,Z.jsxs)(u,{children:[(0,Z.jsx)(d,{dimColor:!0,children:`Scope: `}),(0,Z.jsx)(d,{children:k.scope||`user`})]}),k.plugin.manifest.version&&(0,Z.jsxs)(u,{children:[(0,Z.jsx)(d,{dimColor:!0,children:`Version: `}),(0,Z.jsx)(d,{children:k.plugin.manifest.version})]}),k.plugin.manifest.description&&(0,Z.jsx)(u,{marginBottom:1,children:(0,Z.jsx)(d,{children:k.plugin.manifest.description})}),k.plugin.manifest.author&&(0,Z.jsxs)(u,{children:[(0,Z.jsx)(d,{dimColor:!0,children:`Author: `}),(0,Z.jsx)(d,{children:k.plugin.manifest.author.name})]}),(0,Z.jsxs)(u,{marginBottom:1,children:[(0,Z.jsx)(d,{dimColor:!0,children:`Status: `}),(0,Z.jsx)(d,{color:n?`success`:`warning`,children:n?`Enabled`:`Disabled`}),k.pendingUpdate&&(0,Z.jsx)(d,{color:`suggestion`,children:` · Marked for update`})]}),(0,Z.jsx)(Jn,{plugin:k.plugin,marketplace:k.marketplace}),i,(0,Z.jsx)(u,{marginTop:1,flexDirection:`column`,children:Re.map((e,t)=>{let n=t===ve;return(0,Z.jsxs)(u,{children:[n&&(0,Z.jsxs)(d,{children:[a.pointer,` `]}),!n&&(0,Z.jsx)(d,{children:` `}),(0,Z.jsx)(d,{bold:n,color:e.label.includes(`Uninstall`)?`error`:e.label.includes(`Update`)?`suggestion`:void 0,children:e.label})]},t)})}),be&&(0,Z.jsx)(u,{marginTop:1,children:(0,Z.jsx)(d,{children:`Processing…`})}),Ce&&(0,Z.jsx)(u,{marginTop:1,children:(0,Z.jsx)(d,{color:`error`,children:Ce})}),(0,Z.jsx)(u,{marginTop:1,children:(0,Z.jsx)(d,{dimColor:!0,italic:!0,children:(0,Z.jsxs)(f,{children:[(0,Z.jsx)(V,{action:`select:previous`,context:`Select`,fallback:`↑`,description:`navigate`}),(0,Z.jsx)(V,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`select`}),(0,Z.jsx)(V,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]})})})]})}if(typeof w==`object`&&w.type===`failed-plugin-details`){let e=w.plugin,t=e.errors[0],n=t?Vn(t):`Failed to load`;return(0,Z.jsxs)(u,{flexDirection:`column`,children:[(0,Z.jsxs)(d,{children:[(0,Z.jsx)(d,{bold:!0,children:e.name}),(0,Z.jsxs)(d,{dimColor:!0,children:[` @ `,e.marketplace]}),(0,Z.jsxs)(d,{dimColor:!0,children:[` (`,e.scope,`)`]})]}),(0,Z.jsx)(d,{color:`error`,children:n}),e.scope===`managed`?(0,Z.jsx)(u,{marginTop:1,children:(0,Z.jsx)(d,{dimColor:!0,children:`Managed by your organization — contact your admin`})}):(0,Z.jsxs)(u,{marginTop:1,children:[(0,Z.jsxs)(d,{color:`suggestion`,children:[a.pointer,` `]}),(0,Z.jsx)(d,{bold:!0,children:`Remove`})]}),be&&(0,Z.jsx)(d,{children:`Processing…`}),Ce&&(0,Z.jsx)(d,{color:`error`,children:Ce}),(0,Z.jsx)(u,{marginTop:1,children:(0,Z.jsx)(d,{dimColor:!0,italic:!0,children:(0,Z.jsxs)(f,{children:[e.scope!==`managed`&&(0,Z.jsx)(V,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`remove`}),(0,Z.jsx)(V,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]})})})]})}if(typeof w==`object`&&w.type===`mcp-detail`){let e=w.client,n=Te(h,e.name).length,r=()=>{T({type:`mcp-tools`,client:e})},i=()=>{T(`plugin-list`)},a=e=>{e&&t(e),T(`plugin-list`)},o=e.config.scope,s=e.config.type;return s===`stdio`?(0,Z.jsx)(Gt,{server:{name:e.name,client:e,scope:o,transport:`stdio`,config:e.config},serverToolsCount:n,onViewTools:r,onCancel:i,onComplete:a,borderless:!0}):s===`sse`?(0,Z.jsx)(Zt,{server:{name:e.name,client:e,scope:o,transport:`sse`,isAuthenticated:void 0,config:e.config},serverToolsCount:n,onViewTools:r,onCancel:i,onComplete:a,borderless:!0}):s===`http`?(0,Z.jsx)(Zt,{server:{name:e.name,client:e,scope:o,transport:`http`,isAuthenticated:void 0,config:e.config},serverToolsCount:n,onViewTools:r,onCancel:i,onComplete:a,borderless:!0}):s===`claudeai-proxy`?(0,Z.jsx)(Zt,{server:{name:e.name,client:e,scope:o,transport:`claudeai-proxy`,isAuthenticated:void 0,config:e.config},serverToolsCount:n,onViewTools:r,onCancel:i,onComplete:a,borderless:!0}):(T(`plugin-list`),null)}if(typeof w==`object`&&w.type===`mcp-tools`){let e=w.client,t=e.config.scope,n=e.config.type,r;return r=n===`stdio`?{name:e.name,client:e,scope:t,transport:`stdio`,config:e.config}:n===`sse`?{name:e.name,client:e,scope:t,transport:`sse`,isAuthenticated:void 0,config:e.config}:n===`http`?{name:e.name,client:e,scope:t,transport:`http`,isAuthenticated:void 0,config:e.config}:{name:e.name,client:e,scope:t,transport:`claudeai-proxy`,isAuthenticated:void 0,config:e.config},(0,Z.jsx)(Qt,{server:r,onSelectTool:t=>{T({type:`mcp-tool-detail`,client:e,tool:t})},onBack:()=>T({type:`mcp-detail`,client:e})})}if(typeof w==`object`&&w.type===`mcp-tool-detail`){let{client:e,tool:t}=w,n=e.config.scope,r=e.config.type,i;return i=r===`stdio`?{name:e.name,client:e,scope:n,transport:`stdio`,config:e.config}:r===`sse`?{name:e.name,client:e,scope:n,transport:`sse`,isAuthenticated:void 0,config:e.config}:r===`http`?{name:e.name,client:e,scope:n,transport:`http`,isAuthenticated:void 0,config:e.config}:{name:e.name,client:e,scope:n,transport:`claudeai-proxy`,isAuthenticated:void 0,config:e.config},(0,Z.jsx)(Xt,{tool:t,server:i,onBack:()=>T({type:`mcp-tools`,client:e})})}let ze=_e.getVisibleItems(L);return(0,Z.jsxs)(u,{flexDirection:`column`,children:[(0,Z.jsx)(u,{marginBottom:1,children:(0,Z.jsx)(v,{query:ne,isFocused:x,isTerminalFocused:te,width:C-4,cursorOffset:O})}),L.length===0&&ne&&(0,Z.jsx)(u,{marginBottom:1,children:(0,Z.jsxs)(d,{dimColor:!0,children:[`No items match "`,ne,`"`]})}),_e.scrollPosition.canScrollUp&&(0,Z.jsx)(u,{children:(0,Z.jsxs)(d,{dimColor:!0,children:[` `,a.arrowUp,` more above`]})}),ze.map((e,t)=>{let n=_e.toActualIndex(t)===R&&!x,r=t>0?ze[t-1]:null,i=!r||r.scope!==e.scope;return(0,Z.jsxs)(Qn.Fragment,{children:[i&&(0,Z.jsx)(u,{marginTop:+(t>0),paddingLeft:2,children:(0,Z.jsx)(d,{dimColor:e.scope!==`flagged`,color:e.scope===`flagged`?`warning`:void 0,bold:e.scope===`flagged`,children:(e=>{switch(e){case`flagged`:return`Flagged`;case`project`:return`Project`;case`local`:return`Local`;case`user`:return`User`;case`enterprise`:return`Enterprise`;case`managed`:return`Managed`;case`builtin`:return`Built-in`;case`dynamic`:return`Built-in`;default:return e}})(e.scope)})}),(0,Z.jsx)(Wn,{item:e,isSelected:n})]},e.id)}),_e.scrollPosition.canScrollDown&&(0,Z.jsx)(u,{children:(0,Z.jsxs)(d,{dimColor:!0,children:[` `,a.arrowDown,` more below`]})}),(0,Z.jsx)(u,{marginTop:1,marginLeft:1,children:(0,Z.jsx)(d,{dimColor:!0,italic:!0,children:(0,Z.jsxs)(f,{children:[(0,Z.jsx)(d,{children:`type to search`}),(0,Z.jsx)(V,{action:`plugin:toggle`,context:`Plugin`,fallback:`Space`,description:`toggle`}),(0,Z.jsx)(V,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`details`}),(0,Z.jsx)(V,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]})})}),P.size>0&&(0,Z.jsx)(u,{marginLeft:1,children:(0,Z.jsx)(d,{dimColor:!0,italic:!0,children:`Run /reload-plugins to apply changes`})})]})}var Qn,X,Z,$n=e((()=>{i(),Qn=t(h(),1),X=t(h(),1),Oe(),S(),Kt(),Yt(),qt(),Jt(),Ht(),Wt(),je(),O(),he(),Lt(),A(),Ct(),Ue(),Ze(),He(),Ye(),We(),st(),F(),z(),Re(),P(),Ae(),Ft(),N(),fe(),M(),j(),ht(),rt(),Xe(),lt(),Un(),dn(),gn(),Gn(),On(),Z=C()}));function er(e){if(!e)return{type:`menu`};let t=e.trim().split(/\s+/);switch(t[0]?.toLowerCase()){case`help`:case`--help`:case`-h`:return{type:`help`};case`install`:case`i`:{let e=t[1];if(!e)return{type:`install`};if(e.includes(`@`)){let[t,n]=e.split(`@`);return{type:`install`,plugin:t,marketplace:n}}return e.startsWith(`http://`)||e.startsWith(`https://`)||e.startsWith(`file://`)||e.includes(`/`)||e.includes(`\\`)?{type:`install`,marketplace:e}:{type:`install`,plugin:e}}case`manage`:return{type:`manage`};case`uninstall`:return{type:`uninstall`,plugin:t[1]};case`enable`:return{type:`enable`,plugin:t[1]};case`disable`:return{type:`disable`,plugin:t[1]};case`validate`:return{type:`validate`,path:t.slice(1).join(` `).trim()||void 0};case`marketplace`:case`market`:{let e=t[1]?.toLowerCase(),n=t.slice(2).join(` `);switch(e){case`add`:return{type:`marketplace`,action:`add`,target:n};case`remove`:case`rm`:return{type:`marketplace`,action:`remove`,target:n};case`update`:return{type:`marketplace`,action:`update`,target:n};case`list`:return{type:`marketplace`,action:`list`};default:return{type:`marketplace`}}}default:return{type:`menu`}}}var tr=e((()=>{}));function nr({onComplete:e,path:t}){return(0,rr.useEffect)(()=>{async function n(){if(!t){e(`Usage: /plugin validate <path>
|
|
2
|
-
|
|
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 Ot(t),r=``;r+=`Validating ${n.fileType} manifest: ${n.filePath}\n\n`,n.errors.length>0&&(r+=`${a.cross} Found ${n.errors.length} ${H(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} ${H(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,ct(t),e(`${a.cross} Unexpected error during validation: ${Ge(t)}`)}}n()},[e,t]),(0,ir.jsx)(u,{flexDirection:`column`,children:(0,ir.jsx)(d,{children:`Running validation...`})})}var rr,ir,ar=e((()=>{i(),rr=t(h(),1),S(),We(),st(),jt(),lt(),ir=C()}));function or({onComplete:e}){return(0,Q.useEffect)(()=>{async function t(){try{let t=await B(),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: ${Ge(t)}`)}}t()},[e]),(0,$.jsx)(d,{children:`Loading marketplaces...`})}function sr(e){let t=[];for(let{source:n,scope:r}of[{source:`userSettings`,scope:`user`},{source:`projectSettings`,scope:`project`},{source:`localSettings`,scope:`local`}])it(n)?.extraKnownMarketplaces?.[e]&&t.push({source:n,scope:r});return{editableSources:t,isInPolicy:!!it(`policySettings`)?.extraKnownMarketplaces?.[e]}}function cr(e){let{editableSources:t,isInPolicy:n}=sr(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 lr(e){return{kind:`navigate`,tab:`installed`,viewState:{type:`manage-plugins`,targetPlugin:e,action:`uninstall`}}}function ur(e){return vr.has(e.type)}function dr(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 fr(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:Vn(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=cr(t.name),n=sr(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=cr(t),r=sr(t),i=r.isInPolicy?`managed`:r.editableSources[0]?.scope;s.push({label:t,message:Vn(e),guidance:n.kind===`managed-only`?`Managed by your organization — contact your admin`:Hn(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=dr(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:Vn(e),guidance:Hn(e),action:t?lr(t):{kind:`none`},scope:r})}for(let e of r)s.push({label:e.source,message:Vn(e),guidance:Hn(e),action:{kind:`none`}});return s}function pr(e,t){for(let{source:n}of t){let t=it(n);if(!t)continue;let r={};if(t.extraKnownMarketplaces?.[e]&&(r.extraKnownMarketplaces={...t.extraKnownMarketplaces,[e]:void 0}),t.enabledPlugins){let n=`@${e}`,i=!1,a={...t.enabledPlugins};for(let e in a)e.endsWith(n)&&(a[e]=void 0,i=!0);i&&(r.enabledPlugins=a)}Object.keys(r).length>0&&et(n,r)}}function mr({setViewState:e,setActiveTab:t,markPluginsChanged:n}){let r=E(e=>e.plugins.errors),i=E(e=>e.plugins.installationStatus),o=oe(),[s,l]=(0,Q.useState)(0),[m,h]=(0,Q.useState)(null),[g,_]=(0,Q.useState)([]);(0,Q.useEffect)(()=>{(async()=>{try{let{failures:e}=await T(await B());_(e)}catch{}})()},[]);let v=i.marketplaces.filter(e=>e.status===`failed`),y=new Set(v.map(e=>e.name)),b=r.filter(ur),x=fr(v,r.filter(e=>(e.type===`marketplace-not-found`||e.type===`marketplace-load-failed`||e.type===`marketplace-blocked-by-policy`)&&!y.has(e.marketplace)),r.filter(e=>ur(e)||e.type===`marketplace-not-found`||e.type===`marketplace-load-failed`||e.type===`marketplace-blocked-by-policy`?!1:dr(e)!==void 0),r.filter(e=>ur(e)||e.type===`marketplace-not-found`||e.type===`marketplace-load-failed`||e.type===`marketplace-blocked-by-policy`?!1:dr(e)===void 0),g,b,gt());p(`confirm:no`,()=>{e({type:`menu`})},{context:`Confirmation`}),c({"select:previous":()=>l(e=>Math.max(0,e-1)),"select:next":()=>l(e=>Math.min(x.length-1,e+1)),"select:accept":()=>{let r=x[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(`, `);pr(i.name,i.sources),le(),o(e=>({...e,plugins:{...e.plugins,errors:e.plugins.errors.filter(e=>!(`marketplace`in e&&e.marketplace===i.name)),installationStatus:{...e.plugins.installationStatus,marketplaces:e.plugins.installationStatus.marketplaces.filter(e=>e.name!==i.name)}}})),h(`${a.tick} Removed "${i.name}" from ${e} settings`),n();break}case`remove-installed-marketplace`:(async()=>{try{await De(i.name),le(),_(e=>e.filter(e=>e.name!==i.name)),h(`${a.tick} Removed marketplace "${i.name}"`),n()}catch(e){h(`Failed to remove "${i.name}": ${e instanceof Error?e.message:String(e)}`)}})();break;case`managed-only`:break;case`none`:break}}},{context:`Select`,isActive:x.length>0});let S=Math.min(s,Math.max(0,x.length-1));S!==s&&l(S);let ee=x[S]?.action,te=ee&&ee.kind!==`none`&&ee.kind!==`managed-only`;return x.length===0?(0,$.jsxs)(u,{flexDirection:`column`,children:[(0,$.jsx)(u,{marginLeft:1,children:(0,$.jsx)(d,{dimColor:!0,children:`No plugin errors`})}),(0,$.jsx)(u,{marginTop:1,children:(0,$.jsx)(d,{dimColor:!0,italic:!0,children:(0,$.jsx)(V,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})})})]}):(0,$.jsxs)(u,{flexDirection:`column`,children:[x.map((e,t)=>{let n=t===S;return(0,$.jsxs)(u,{marginLeft:1,flexDirection:`column`,marginBottom:1,children:[(0,$.jsxs)(d,{children:[(0,$.jsxs)(d,{color:n?`suggestion`:`error`,children:[n?a.pointer:a.cross,` `]}),(0,$.jsx)(d,{bold:n,children:e.label}),e.scope&&(0,$.jsxs)(d,{dimColor:!0,children:[` (`,e.scope,`)`]})]}),(0,$.jsx)(u,{marginLeft:3,children:(0,$.jsx)(d,{color:`error`,children:e.message})}),e.guidance&&(0,$.jsx)(u,{marginLeft:3,children:(0,$.jsx)(d,{dimColor:!0,italic:!0,children:e.guidance})})]},t)}),m&&(0,$.jsx)(u,{marginTop:1,marginLeft:1,children:(0,$.jsx)(d,{color:`claude`,children:m})}),(0,$.jsx)(u,{marginTop:1,children:(0,$.jsx)(d,{dimColor:!0,italic:!0,children:(0,$.jsxs)(f,{children:[(0,$.jsx)(V,{action:`select:previous`,context:`Select`,fallback:`↑`,description:`navigate`}),te&&(0,$.jsx)(V,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`resolve`}),(0,$.jsx)(V,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]})})})]})}function hr(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 gr(e){return e.type===`manage-plugins`?`installed`:e.type===`manage-marketplaces`?`marketplaces`:`discover`}function _r({onComplete:e,args:t}){let n=er(t),r=hr(n),[i,a]=(0,Q.useState)(r),[o,s]=(0,Q.useState)(gr(r)),[c,l]=(0,Q.useState)(i.type===`add-marketplace`&&i.initialValue||``),[f,m]=(0,Q.useState)(0),[h,g]=(0,Q.useState)(null),[_,v]=(0,Q.useState)(null),[b,S]=(0,Q.useState)(!1),te=oe(),C=E(e=>{let t=e.plugins.errors.length;for(let n of e.plugins.installationStatus.marketplaces)n.status===`failed`&&t++;return t}),w=C>0?`Errors (${C})`:`Errors`,T=Rt(),ne=n.type===`marketplace`&&n.action===`add`&&n.target!==void 0,D=(0,Q.useCallback)(()=>{te(e=>e.plugins.needsRefresh?e:{...e,plugins:{...e.plugins,needsRefresh:!0}})},[te]),O=(0,Q.useCallback)(e=>{let t=e;switch(s(t),g(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`&&!_&&e()},[i.type,_,e]),(0,Q.useEffect)(()=>{i.type===`browse-marketplace`&&o!==`discover`&&s(`discover`)},[i.type,o]),p(`confirm:no`,(0,Q.useCallback)(()=>{s(`marketplaces`),a({type:`manage-marketplaces`}),l(``),g(null)},[]),{context:`Settings`,isActive:i.type===`add-marketplace`}),(0,Q.useEffect)(()=>{_&&e(_)},[_,e]),(0,Q.useEffect)(()=>{i.type===`help`&&e()},[i.type,e]),i.type===`help`?(0,$.jsxs)(u,{flexDirection:`column`,children:[(0,$.jsx)(d,{bold:!0,children:`Plugin Command Usage:`}),(0,$.jsx)(d,{children:` `}),(0,$.jsx)(d,{dimColor:!0,children:`Installation:`}),(0,$.jsx)(d,{children:` /plugin install - Browse and install plugins`}),(0,$.jsx)(d,{children:` /plugin install <marketplace> - Install from specific marketplace`}),(0,$.jsx)(d,{children:` /plugin install <plugin> - Install specific plugin`}),(0,$.jsx)(d,{children:` /plugin install <plugin>@<market> - Install plugin from marketplace`}),(0,$.jsx)(d,{children:` `}),(0,$.jsx)(d,{dimColor:!0,children:`Management:`}),(0,$.jsx)(d,{children:` /plugin manage - Manage installed plugins`}),(0,$.jsx)(d,{children:` /plugin enable <plugin> - Enable a plugin`}),(0,$.jsx)(d,{children:` /plugin disable <plugin> - Disable a plugin`}),(0,$.jsx)(d,{children:` /plugin uninstall <plugin> - Uninstall a plugin`}),(0,$.jsx)(d,{children:` `}),(0,$.jsx)(d,{dimColor:!0,children:`Marketplaces:`}),(0,$.jsx)(d,{children:` /plugin marketplace - Marketplace management menu`}),(0,$.jsx)(d,{children:` /plugin marketplace add - Add a marketplace`}),(0,$.jsx)(d,{children:` /plugin marketplace add <path/url> - Add marketplace directly`}),(0,$.jsx)(d,{children:` /plugin marketplace update - Update marketplaces`}),(0,$.jsx)(d,{children:` /plugin marketplace update <name> - Update specific marketplace`}),(0,$.jsx)(d,{children:` /plugin marketplace remove - Remove a marketplace`}),(0,$.jsx)(d,{children:` /plugin marketplace remove <name> - Remove specific marketplace`}),(0,$.jsx)(d,{children:` /plugin marketplace list - List all marketplaces`}),(0,$.jsx)(d,{children:` `}),(0,$.jsx)(d,{dimColor:!0,children:`Validation:`}),(0,$.jsx)(d,{children:` /plugin validate <path> - Validate a manifest file or directory`}),(0,$.jsx)(d,{children:` `}),(0,$.jsx)(d,{dimColor:!0,children:`Other:`}),(0,$.jsx)(d,{children:` /plugin - Main plugin menu`}),(0,$.jsx)(d,{children:` /plugin help - Show this help`}),(0,$.jsx)(d,{children:` /plugins - Alias for /plugin`})]}):i.type===`validate`?(0,$.jsx)(nr,{onComplete:e,path:i.path}):i.type===`marketplace-menu`?(a({type:`menu`}),null):i.type===`marketplace-list`?(0,$.jsx)(or,{onComplete:e}):i.type===`add-marketplace`?(0,$.jsx)(rn,{inputValue:c,setInputValue:l,cursorOffset:f,setCursorOffset:m,error:h,setError:g,result:_,setResult:v,setViewState:a,onAddComplete:D,cliMode:ne}):(0,$.jsx)(ee,{color:`suggestion`,children:(0,$.jsxs)(x,{title:`Plugins`,selectedTab:o,onTabChange:O,color:`suggestion`,disableNavigation:b,children:[(0,$.jsx)(y,{id:`discover`,title:`Discover`,children:i.type===`browse-marketplace`?(0,$.jsx)(kn,{error:h,setError:g,result:_,setResult:v,setViewState:a,onInstallComplete:D,targetMarketplace:i.targetMarketplace,targetPlugin:i.targetPlugin}):(0,$.jsx)(Mn,{error:h,setError:g,result:_,setResult:v,setViewState:a,onInstallComplete:D,onSearchModeChange:S,targetPlugin:i.type===`discover-plugins`?i.targetPlugin:void 0})}),(0,$.jsx)(y,{id:`installed`,title:`Installed`,children:(0,$.jsx)(Zn,{setViewState:a,setResult:v,onManageComplete:D,onSearchModeChange:S,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)(y,{id:`marketplaces`,title:`Marketplaces`,children:(0,$.jsx)(Ln,{setViewState:a,error:h,setError:g,setResult:v,exitState:T,onManageComplete:D,targetMarketplace:i.type===`manage-marketplaces`?i.targetMarketplace:void 0,action:i.type===`manage-marketplaces`?i.action:void 0})}),(0,$.jsx)(y,{id:`errors`,title:w,children:(0,$.jsx)(mr,{setViewState:a,setActiveTab:s,markPluginsChanged:D})})]})})}var Q,$,vr,yr=e((()=>{i(),Q=t(h(),1),Oe(),S(),zt(),O(),Ue(),We(),F(),I(),Re(),ht(),rt(),on(),jn(),In(),Bn(),$n(),Un(),tr(),ar(),$=C(),vr=new Set([`git-auth-failed`,`git-timeout`,`network-error`])}));async function br(e,t,n){return(0,xr.jsx)(_r,{onComplete:e,args:n})}var xr;e((()=>{yr(),xr=C()}))();export{br as call};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e,t}from"./figures-5ThXQEtq.js";import{Gx as n,Ja as r,au as i,gi as a,iu as o,mi as s,qa as c,qx as l,ru as u}from"./loadAgentsDir-DGozQu_6.js";import{I as d,M as f}from"./debug-CRnGsZOV.js";import{n as p,o as m}from"./process-gEbdy6uY.js";import{o as h,s as g}from"./log-DoSpAwRP.js";import{n as _}from"./analytics-COpjZpvd.js";import{a as v,c as y,d as b,f as x,i as S,r as C,s as w}from"./pluginOperations-rTrzu6Vg.js";e(),d(),a(),h(),r(),n(),p(),i(),_(),w();function T(e,n,r){g(e);let i=r?`${n} plugin "${r}"`:n===`disable-all`?`disable all plugins`:`${n} plugins`;console.error(`${t.cross} Failed to ${i}: ${f(e)}`);let a=r?(()=>{let{name:e,marketplace:t}=l(r);return{_PROTO_plugin_name:e,...t&&{_PROTO_marketplace_name:t},...u(e,t,c())}})():{};o(e),{...a},process.exit(1)}async function E(e,n=`user`){try{console.log(`Installing plugin "${e}"...`);let r=await y(e,n);if(!r.success)throw Error(r.message);console.log(`${t.tick} ${r.message}`);let{name:i,marketplace:a}=l(r.pluginId||e);({...a&&{_PROTO_marketplace_name:a}}),r.scope,{...u(i,a,c())},process.exit(0)}catch(t){T(t,`install`,e)}}async function D(e,n=`user`,r=!1){try{let i=await b(e,n,!r);if(!i.success)throw Error(i.message);console.log(`${t.tick} ${i.message}`);let{name:a,marketplace:o}=l(i.pluginId||e);({...o&&{_PROTO_marketplace_name:o}}),i.scope,{...u(a,o,c())},process.exit(0)}catch(t){T(t,`uninstall`,e)}}async function O(e,n){try{let r=await v(e,n);if(!r.success)throw Error(r.message);console.log(`${t.tick} ${r.message}`);let{name:i,marketplace:a}=l(r.pluginId||e);({...a&&{_PROTO_marketplace_name:a}}),r.scope,{...u(i,a,c())},process.exit(0)}catch(t){T(t,`enable`,e)}}async function k(e,n){try{let r=await S(e,n);if(!r.success)throw Error(r.message);console.log(`${t.tick} ${r.message}`);let{name:i,marketplace:a}=l(r.pluginId||e);({...a&&{_PROTO_marketplace_name:a}}),r.scope,{...u(i,a,c())},process.exit(0)}catch(t){T(t,`disable`,e)}}async function A(){try{let e=await C();if(!e.success)throw Error(e.message);console.log(`${t.tick} ${e.message}`),process.exit(0)}catch(e){T(e,`disable-all`)}}async function j(e,n){try{m(`Checking for updates for plugin "${e}" at ${n} scope…\n`);let r=await x(e,n);if(!r.success)throw Error(r.message);if(m(`${t.tick} ${r.message}\n`),!r.alreadyUpToDate){let{name:t,marketplace:n}=l(r.pluginId||e);({...n&&{_PROTO_marketplace_name:n}}),r.oldVersion,r.newVersion,{...u(t,n,c())}}await s(0)}catch(t){T(t,`update`,e)}}export{D as a,E as i,k as n,j as o,O as r,A as t};
|