@readmagic/workmate 0.0.23 → 0.0.25
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 +1 -0
- package/dist/chunks/AgentsMdExternalIncludesDialog-Bnb1jWcg.js +1 -0
- package/dist/chunks/AgentsMdExternalIncludesDialog-DVbU-BaD.js +1 -0
- package/dist/chunks/App-B8q8PV77.js +1 -0
- package/dist/chunks/BackgroundTasksDialog-i0TkZgQp.js +2 -0
- package/dist/chunks/BypassPermissionsModeDialog-DjqGAL4C.js +1 -0
- package/dist/chunks/CustomSelect-BvTftqEH.js +1 -0
- package/dist/chunks/DiffDialog-v5r8cBKW.js +6 -0
- package/dist/chunks/Doctor-DKpBnbuI.js +1 -0
- package/dist/chunks/Doctor-uvO6NM5m.js +3 -0
- package/dist/chunks/ExitFlow-Dh9QdaYK.js +2 -0
- package/dist/chunks/InvalidConfigDialog-C9boykQn.js +1 -0
- package/dist/chunks/{InvalidSettingsDialog-Dtmpzeps.js → InvalidSettingsDialog-UN5mleCK.js} +1 -1
- package/dist/chunks/KeybindingProviderSetup-DsJqfEt-.js +1 -0
- package/dist/chunks/MCPConnectionManager-DkZVxLEj.js +1 -0
- package/dist/chunks/MCPToolListView-De1W4jpj.js +1 -0
- package/dist/chunks/McpParsingWarnings-zkM_lGd0.js +1 -0
- package/dist/chunks/MessageSelector-DW_itlX-.js +3 -0
- package/dist/chunks/Messages-BFsCpACq.js +10 -0
- package/dist/chunks/Onboarding-BT90cFkn.js +1 -0
- package/dist/chunks/PromptInputFooterSuggestions-CCTZYbWI.js +1 -0
- package/dist/chunks/PromptInputHelpMenu-Bm5KY0Ma.js +1 -0
- package/dist/chunks/{ProviderSetup-XcBHjUnd.js → ProviderSetup-yIj8YOKF.js} +1 -1
- package/dist/chunks/QueryEngine-egz5mbaW.js +1 -0
- package/dist/chunks/REPL-D27CE4WN.js +124 -0
- package/dist/chunks/REPL-e8wAT1wN.js +1 -0
- package/dist/chunks/ResumeConversation-CWA27Lke.js +1 -0
- package/dist/chunks/SearchExtraToolsTool-BRchtZ9Q.js +1 -0
- package/dist/chunks/{SelectMulti-Bc6l11_K.js → SelectMulti-BW7Ffk1G.js} +1 -1
- package/dist/chunks/Settings-axHLvYIy.js +3 -0
- package/dist/chunks/Spinner-VjwI7m_g.js +1 -0
- package/dist/chunks/{SpinnerGlyph-CmkRUvHe.js → SpinnerGlyph-CqrOK3Mx.js} +1 -1
- package/dist/chunks/TextInput-Cev5Awdd.js +22 -0
- package/dist/chunks/ThemePicker-CtQYHmOr.js +1 -0
- package/dist/chunks/TrustDialog-8Sjmuu0e.js +1 -0
- package/dist/chunks/{ValidationErrorsList-DgNzJQUP.js → ValidationErrorsList-INwwoerV.js} +1 -1
- package/dist/chunks/_baseEach-DrPH_FGo.js +1 -0
- package/dist/chunks/add-dir-D3RMaYxy.js +1 -0
- package/dist/chunks/{agentDisplay-BReJUBWg.js → agentDisplay-B3npXoCS.js} +1 -1
- package/dist/chunks/{agents-B3x8yJ_r.js → agents-2mPGmeq6.js} +1 -1
- package/dist/chunks/agents-DEnmg8Xo.js +101 -0
- package/dist/chunks/allErrors-C9kx6lnk.js +1 -0
- package/dist/chunks/analytics-COpjZpvd.js +1 -0
- package/dist/chunks/{appleTerminalBackup-BArZWB21.js → appleTerminalBackup-CT7g8yOs.js} +1 -1
- package/dist/chunks/backgroundHousekeeping-BkFxfjOf.js +1 -0
- package/dist/chunks/backgroundHousekeeping-CvWfd99M.js +1 -0
- package/dist/chunks/banner-DHpTmEO7.js +2 -0
- package/dist/chunks/branch-Be_yDFU8.js +2 -0
- package/dist/chunks/{break-cache-BMXqFTeS.js → break-cache-UUt6Dkf2.js} +2 -2
- package/dist/chunks/btw-DUml5L1w.js +1 -0
- package/dist/chunks/caches-DWjwe-DN.js +1 -0
- package/dist/chunks/caches-VLs1tQkZ.js +1 -0
- package/dist/chunks/{claudeDesktop-D8ml2767.js → claudeDesktop-mBGFDbI6.js} +1 -1
- package/dist/chunks/{clear-Bdhb6b39.js → clear-CrGjNe6E.js} +1 -1
- package/dist/chunks/{client-CpTCeWba.js → client-BDuhbzLD.js} +1 -1
- package/dist/chunks/{client-4iqhC8xq.js → client-BYFVVMcf.js} +1 -1
- package/dist/chunks/client-CO_6v4yl.js +1 -0
- package/dist/chunks/client-DO-O441l.js +1 -0
- package/dist/chunks/commands-Cn1P7Tms.js +1 -0
- package/dist/chunks/compact-DGUhdXcc.js +2 -0
- package/dist/chunks/config-C7GTF4iI.js +1 -0
- package/dist/chunks/config-CWPHVTic.js +3 -0
- package/dist/chunks/config-Cox0TM2Z.js +1 -0
- package/dist/chunks/context-mV5zjqmc.js +1 -0
- package/dist/chunks/context-noninteractive--OuiZUzL.js +1 -0
- package/dist/chunks/{context-noninteractive-Dd4xIoP1.js → context-noninteractive-DvfVvmSE.js} +2 -2
- package/dist/chunks/conversation--y8PD2Lk.js +1 -0
- package/dist/chunks/conversation-BIPJEOwO.js +1 -0
- package/dist/chunks/conversationRecovery-BBJzrA0g.js +1 -0
- package/dist/chunks/crossProjectResume-CwZb3cEU.js +40 -0
- package/dist/chunks/cwd-BZMp3CZ8.js +1 -0
- package/dist/chunks/cwd-BvNt_018.js +1 -0
- package/dist/chunks/debug-CRnGsZOV.js +39 -0
- package/dist/chunks/{detectRepository-CfX8Lc0A.js → detectRepository-CsJLbVEe.js} +1 -1
- package/dist/chunks/{diff-BOAElpfQ.js → diff-DUEoNCnJ.js} +1 -1
- package/dist/chunks/{directoryCompletion-D_Rtg-4j.js → directoryCompletion-Bgi8DBT5.js} +1 -1
- package/dist/chunks/doctor-4NiE46ZG.js +1 -0
- package/dist/chunks/entry-D1iD76SW.js +13 -0
- package/dist/chunks/{esm-CGx9qY3q.js → esm-DUH16IqH.js} +1 -1
- package/dist/chunks/execAsync-D6SA-YsV.js +1 -0
- package/dist/chunks/{execFileNoThrow-BTachNBI.js → execFileNoThrow-BgRsj_SW.js} +3 -3
- package/dist/chunks/exit-CrsQsjbx.js +1 -0
- package/dist/chunks/extraUsage-BtHE-SBX.js +1 -0
- package/dist/chunks/extractMemories-kogJzpit.js +1 -0
- package/dist/chunks/fast-CuNVwVTr.js +1 -0
- package/dist/chunks/fast-RlFnwGRV.js +1 -0
- package/dist/chunks/fetchModelList-Cjow_QGy.js +1 -0
- package/dist/chunks/fetchModelList-uiCPVqbJ.js +1 -0
- package/dist/chunks/fileSuggestions-C96V9-Ne.js +3 -0
- package/dist/chunks/firstPartyEventLogger-CN9UOmEC.js +1 -0
- package/dist/chunks/firstPartyEventLogger-RR5rvDtk.js +1 -0
- package/dist/chunks/{gemini-D_ORb_L6.js → gemini-4YGElN3H.js} +2 -2
- package/dist/chunks/generateSessionName-BHIKyXpz.js +1 -0
- package/dist/chunks/{genericProcessUtils-DwQFuna9.js → genericProcessUtils-BNlr-QxM.js} +1 -1
- package/dist/chunks/getMachineId-bsd-DTYGimUN.js +1 -0
- package/dist/chunks/getMachineId-darwin-DqIFUVvd.js +2 -0
- package/dist/chunks/getMachineId-linux-CnCTmdzd.js +1 -0
- package/dist/chunks/getMachineId-unsupported-Cx21ssu1.js +1 -0
- package/dist/chunks/getMachineId-win-vZhex7KX.js +1 -0
- package/dist/chunks/goal-ePK_jLo3.js +3 -0
- package/dist/chunks/grok-DnmklTrm.js +1 -0
- package/dist/chunks/help-B7xRle-V.js +1 -0
- package/dist/chunks/history-kOw3CcLT.js +1 -0
- package/dist/chunks/hooks-BDY1jMbS.js +1 -0
- package/dist/chunks/{hooks-DIvN6gdv.js → hooks-BN5f58HY.js} +2 -2
- package/dist/chunks/install-DrMiHa2Q.js +1 -0
- package/dist/chunks/instrumentation-Oj5xagJG.js +21 -0
- package/dist/chunks/{job-R6c4-3c8.js → job-D9ypO0cd.js} +1 -1
- package/dist/chunks/keybindings-BRRN_eap.js +1 -0
- package/dist/chunks/launchLocalMemory-DliLezJw.js +3 -0
- package/dist/chunks/launchOnboarding-A-kk-7ID.js +8 -0
- package/dist/chunks/loadAgentsDir-CJAK4kif.js +1 -0
- package/dist/chunks/{loadAgentsDir-DlPbtIsS.js → loadAgentsDir-DGozQu_6.js} +550 -550
- package/dist/chunks/{loadPluginHooks-C_msxVIc.js → loadPluginHooks-BiHPKDaY.js} +1 -1
- package/dist/chunks/{loader-CICGtLp2.js → loader-CtoR-vO-.js} +1 -1
- package/dist/chunks/{localSearch-CK-sFzPm.js → localSearch-BU02Qsv9.js} +1 -1
- package/dist/chunks/localSearch-DyaB2Rm-.js +1 -0
- package/dist/chunks/{log-D2TIwHBV.js → log-DoSpAwRP.js} +1 -1
- package/dist/chunks/logoUtils-DLd6JKqW.js +1 -0
- package/dist/chunks/{magicDocs-BEF8D3if.js → magicDocs-Bj8LYrN2.js} +2 -2
- package/dist/chunks/main-B_09WbaG.js +345 -0
- package/dist/chunks/managedEnv-BJGfe3m7.js +1 -0
- package/dist/chunks/{managedEnv-OPlzUPbJ.js → managedEnv-CIWJsuty.js} +1 -1
- package/dist/chunks/mcp-1nBvcNxw.js +1 -0
- package/dist/chunks/mcp-7DXpXMdT.js +2 -0
- package/dist/chunks/mcp-kw99WVi2.js +6 -0
- package/dist/chunks/memory-CjWvzR_9.js +1 -0
- package/dist/chunks/mode-CBKawxnD.js +2 -0
- package/dist/chunks/model-DpZaKZMb.js +1 -0
- package/dist/chunks/model-DwbqvCY2.js +1 -0
- package/dist/chunks/modelOptions-CXBfKFXA.js +1 -0
- package/dist/chunks/nativeInstaller-SmPeEisk.js +1 -0
- package/dist/chunks/{notifications-4wP1Tx9Y.js → notifications-ql0eSo0Y.js} +1 -1
- package/dist/chunks/onChangeAppState-D85b33R5.js +1 -0
- package/dist/chunks/open-Cyrr4E5x.js +1 -0
- package/dist/chunks/openai-D_j7-KW6.js +2 -0
- package/dist/chunks/overlayContext-CLjlCFBl.js +1 -0
- package/dist/chunks/{panel-CVS4SK_E.js → panel-DMZkOEiU.js} +1 -1
- package/dist/chunks/parser-2usBI4G-.js +1 -0
- package/dist/chunks/{parser-Cg6hSCmn.js → parser-UqADrvxF.js} +1 -1
- package/dist/chunks/partition-CwxTlmMd.js +1 -0
- package/dist/chunks/{pasteStore-P0zP-ch0.js → pasteStore-ovtxMVR5.js} +1 -1
- package/dist/chunks/permissions-CgsvWOk_.js +3 -0
- package/dist/chunks/pidLock-B-SW3Nhx.js +3 -0
- package/dist/chunks/plan-BJrWtXEh.js +1 -0
- package/dist/chunks/platform-DsMIk3eq.js +2 -0
- package/dist/chunks/plugin-D97VJAxW.js +17 -0
- package/dist/chunks/{pluginAutoupdate-8qugAFhb.js → pluginAutoupdate-DQqYDPVg.js} +1 -1
- package/dist/chunks/{pluginBlocklist-q01ackCf.js → pluginBlocklist-BAr9WTup.js} +1 -1
- package/dist/chunks/pluginCliCommands-CUGPc853.js +1 -0
- package/dist/chunks/{pluginFlagging-BG2MHCQJ.js → pluginFlagging-BO_3qjfs.js} +1 -1
- package/dist/chunks/pluginOperations-rTrzu6Vg.js +2 -0
- package/dist/chunks/pluginStartupCheck-BRHnXlym.js +1 -0
- package/dist/chunks/{pluginStartupCheck-DTMa6TgL.js → pluginStartupCheck-BX6cv-vs.js} +1 -1
- package/dist/chunks/plugins-9crasx2V.js +4 -0
- package/dist/chunks/poorMode-BaS0DBUO.js +1 -0
- package/dist/chunks/{poorMode-B0QGV6Ci.js → poorMode-DmvzFAz_.js} +1 -1
- package/dist/chunks/print-Bi3xVdB3.js +13 -0
- package/dist/chunks/processBashCommand-BBtnCx-7.js +1 -0
- package/dist/chunks/processSlashCommand-jzF0GmLO.js +5 -0
- package/dist/chunks/{projectOnboardingState-B5YATuc6.js → projectOnboardingState--L3BKjOE.js} +1 -1
- package/dist/chunks/prompt-CmijKW7G.js +1 -0
- package/dist/chunks/prompt-DYBx_D0H.js +1 -0
- package/dist/chunks/{prompt-mM79EGnT.js → prompt-DzO1um1h.js} +4 -4
- package/dist/chunks/{promptEditor-DLGN_eLu.js → promptEditor-B6S_Rzcu.js} +2 -2
- package/dist/chunks/protocolHandler-BWgH1jaF.js +13 -0
- package/dist/chunks/{proxy-CDBfZjO7.js → proxy-BjkGlmBu.js} +1 -1
- package/dist/chunks/reconciler-CVMmAaCy.js +1 -0
- package/dist/chunks/refresh-CAGv8BJY.js +1 -0
- package/dist/chunks/reject-CEUkoI2G.js +1 -0
- package/dist/chunks/{reload-plugins-C42xSB5l.js → reload-plugins-DeyJTx4s.js} +1 -1
- package/dist/chunks/rename-DPFis9g_.js +1 -0
- package/dist/chunks/{renderOptions-DV0dn0IW.js → renderOptions-DRS2EslG.js} +1 -1
- package/dist/chunks/resume-N4O5YI-S.js +2 -0
- package/dist/chunks/ripgrep-3omwGI-l.js +1 -0
- package/dist/chunks/ripgrep-CgQrN3XX.js +5 -0
- package/dist/chunks/{runtimeObserver-1wQO8HSZ.js → runtimeObserver-C0CJvA3q.js} +1 -1
- package/dist/chunks/{runtimeObserver-XQrOux41.js → runtimeObserver-DMSzdFWt.js} +4 -4
- package/dist/chunks/sandbox-adapter-D15jjHJR.js +1 -0
- package/dist/chunks/sandbox-toggle-Tbbaw18C.js +1 -0
- package/dist/chunks/searchExtraTools-BoFc__Eg.js +1 -0
- package/dist/chunks/select-Fq6g2Ejk.js +1 -0
- package/dist/chunks/sessionFileAccessHooks-Rgsp4_Ex.js +1 -0
- package/dist/chunks/{sessionObserver-DS4G6mb9.js → sessionObserver-CRie77tp.js} +2 -2
- package/dist/chunks/sessionObserver-PcaVCVkX.js +1 -0
- package/dist/chunks/sessionStorage-Dkf7FRgA.js +1 -0
- package/dist/chunks/sessionTracing-D7rekMdW.js +11 -0
- package/dist/chunks/settings-8fwIkMDV.js +1 -0
- package/dist/chunks/settings-CodSADx8.js +24 -0
- package/dist/chunks/setup-DBiIrXrh.js +3 -0
- package/dist/chunks/{shadowedRuleDetection-BRxZjobz.js → shadowedRuleDetection-CTnYVrmP.js} +1 -1
- package/dist/chunks/{sideQuestion-DLJxyrlp.js → sideQuestion-Cl8m2qYx.js} +3 -3
- package/dist/chunks/sinks-CiupmfTg.js +1 -0
- package/dist/chunks/sinks-DH83d_kd.js +1 -0
- package/dist/chunks/skillChangeDetector-BrrZaFkT.js +1 -0
- package/dist/chunks/{skillGapStore-CKN_d3pO.js → skillGapStore-es3K-aYe.js} +2 -2
- package/dist/chunks/{skillLifecycle-BMY2JGGG.js → skillLifecycle-BcgoOQBk.js} +2 -2
- package/dist/chunks/{skillSearchPanel-D9trHULQ.js → skillSearchPanel-CuDDb1L-.js} +4 -4
- package/dist/chunks/skills-BRtgqnLz.js +1 -0
- package/dist/chunks/{src-CiJCsqUl.js → src-C8gyNm5a.js} +1 -1
- package/dist/chunks/src-Db7K3F_i.js +3 -0
- package/dist/chunks/startupProfiler-D1NRu2nj.js +1 -0
- package/dist/chunks/startupProfiler-DF0AjiDf.js +3 -0
- package/dist/chunks/{state-B4jiUise.js → state-BQ4BEGin.js} +1 -1
- package/dist/chunks/state-D3gvDiu8.js +1 -0
- package/dist/chunks/status-WXA16wIM.js +1 -0
- package/dist/chunks/statusNoticeHelpers-BfmIub5L.js +1 -0
- package/dist/chunks/{stringUtils-C718f5ey.js → stringUtils-Bu_lJH5c.js} +1 -1
- package/dist/chunks/switcher-5gilU5_R.js +1 -0
- package/dist/chunks/{switcher-CAajZeNL.js → switcher-DMfuKuw_.js} +1 -1
- package/dist/chunks/{tasks-BWNQr2d3.js → tasks-B6gYXxOx.js} +1 -1
- package/dist/chunks/{templateJobs-gUET39Ho.js → templateJobs-BW6TaqEC.js} +1 -1
- package/dist/chunks/{terminalSetup-B_10N_gE.js → terminalSetup-BgIXFBpd.js} +4 -4
- package/dist/chunks/{terminalSetup-qc2PlvOm.js → terminalSetup-C-g9Xvj3.js} +1 -1
- package/dist/chunks/{theme-B7fKI6E5.js → theme-9AZceq_m.js} +1 -1
- package/dist/chunks/tipRegistry-DtO1H_Wo.js +2 -0
- package/dist/chunks/{toolEventObserver-BL06sDI4.js → toolEventObserver-DTuJcREC.js} +1 -1
- package/dist/chunks/toolPool-DHS8jWaL.js +1 -0
- package/dist/chunks/{types-Dx7P7JLQ.js → types-97nL3naE.js} +16 -16
- package/dist/chunks/{udsClient-cQz6nJ_T.js → udsClient-CmYHFiBD.js} +1 -1
- package/dist/chunks/{use-select-navigation-BiUJdWai.js → use-select-navigation-BStVRvcX.js} +1 -1
- package/dist/chunks/useExitOnCtrlCDWithKeybindings-DWRFdFoU.js +1 -0
- package/dist/chunks/useMainLoopModel-DSN5HjV1.js +1 -0
- package/dist/chunks/useManagePlugins-ntnOf5OU.js +1 -0
- package/dist/chunks/useMergedTools-C5Yns9Ij.js +1 -0
- package/dist/chunks/useSearchInput-B_mY9wBq.js +1 -0
- package/dist/chunks/useSettingsErrors-CM7tThcp.js +1 -0
- package/dist/chunks/util-Bb2S6g9N.js +1 -0
- package/dist/chunks/{validatePlugin-D6tFo87L.js → validatePlugin-D8WQ5z4W.js} +1 -1
- package/dist/chunks/vim-Dpnhgoz_.js +1 -0
- package/dist/chunks/worktree-a5oOPSYl.js +1 -0
- package/dist/cli.js +1 -1
- package/package.json +1 -12
- package/dist/chunks/AddWorkspaceDirectory-OgcBcK5A.js +0 -1
- package/dist/chunks/AgentsMdExternalIncludesDialog-CDNd5-7E.js +0 -1
- package/dist/chunks/AgentsMdExternalIncludesDialog-CNEifEyV.js +0 -1
- package/dist/chunks/App-B-3tPQ3k.js +0 -1
- package/dist/chunks/BackgroundTasksDialog-COuhHcey.js +0 -2
- package/dist/chunks/BypassPermissionsModeDialog-bJek4siJ.js +0 -1
- package/dist/chunks/CustomSelect-DoeEXOIP.js +0 -1
- package/dist/chunks/DiffDialog-B3X9FMpO.js +0 -6
- package/dist/chunks/Doctor-6PXyjIi6.js +0 -3
- package/dist/chunks/Doctor-DNgkgYhB.js +0 -1
- package/dist/chunks/ExitFlow-DgAZp_8U.js +0 -2
- package/dist/chunks/Grove-CHatOzcE.js +0 -11
- package/dist/chunks/InvalidConfigDialog-DXL92MN9.js +0 -1
- package/dist/chunks/KeybindingProviderSetup-DA37QUFs.js +0 -1
- package/dist/chunks/MCPConnectionManager-thZd-xA_.js +0 -1
- package/dist/chunks/MCPToolListView-CpY-YJg4.js +0 -1
- package/dist/chunks/McpParsingWarnings-JvChf3xr.js +0 -1
- package/dist/chunks/MessageSelector-C0_iw7SI.js +0 -3
- package/dist/chunks/Messages-K4DDsDP9.js +0 -10
- package/dist/chunks/Onboarding-C1UdzM-1.js +0 -1
- package/dist/chunks/PromptInputFooterSuggestions-AyLog8p7.js +0 -1
- package/dist/chunks/PromptInputHelpMenu-oyic20ip.js +0 -1
- package/dist/chunks/QueryEngine-DYxBjJ4i.js +0 -1
- package/dist/chunks/REPL-CQBJRrT0.js +0 -124
- package/dist/chunks/REPL-CrVuMQY2.js +0 -1
- package/dist/chunks/ResumeConversation-Dl8H9Gfy.js +0 -1
- package/dist/chunks/SearchExtraToolsTool-lv7VE50N.js +0 -1
- package/dist/chunks/Settings-TGp3fPrS.js +0 -3
- package/dist/chunks/Spinner-zYPFVFHN.js +0 -1
- package/dist/chunks/TextInput-CD9iau2k.js +0 -22
- package/dist/chunks/ThemePicker-0F0hZYPX.js +0 -1
- package/dist/chunks/TrustDialog-C76YiMKz.js +0 -1
- package/dist/chunks/_baseEach-4ff-vRlp.js +0 -1
- package/dist/chunks/add-dir-JMsRLGfx.js +0 -1
- package/dist/chunks/agents-9qQ8I6zW.js +0 -101
- package/dist/chunks/allErrors-DfWylHSw.js +0 -1
- package/dist/chunks/analytics-DJobLaWP.js +0 -1
- package/dist/chunks/backgroundHousekeeping-BGxHB_OX.js +0 -1
- package/dist/chunks/backgroundHousekeeping-CVNIhQg8.js +0 -17
- package/dist/chunks/banner-Cu2-XUek.js +0 -2
- package/dist/chunks/branch-C4TsMEkx.js +0 -2
- package/dist/chunks/btw-Dn1eYFAz.js +0 -1
- package/dist/chunks/caches-BGzKwpnc.js +0 -1
- package/dist/chunks/caches-DArHxBgL.js +0 -1
- package/dist/chunks/client-BiqbIkwr.js +0 -1
- package/dist/chunks/client-CZ8nyVh5.js +0 -1
- package/dist/chunks/commands-QepeBbFn.js +0 -1
- package/dist/chunks/compact-Bu9BUpxV.js +0 -2
- package/dist/chunks/config-C-Y2qtB2.js +0 -3
- package/dist/chunks/config-D58C3_Lu.js +0 -1
- package/dist/chunks/config-DD8fCYXn.js +0 -1
- package/dist/chunks/context-CY_yfdYa.js +0 -1
- package/dist/chunks/context-noninteractive-BDDi3NLF.js +0 -1
- package/dist/chunks/conversation-B0wxBwzv.js +0 -1
- package/dist/chunks/conversation-DUu9qBnq.js +0 -1
- package/dist/chunks/conversationRecovery-2ft8sCPE.js +0 -1
- package/dist/chunks/crossProjectResume-6boHMUBx.js +0 -40
- package/dist/chunks/cwd-Dc3NV7s8.js +0 -1
- package/dist/chunks/cwd-Pa83R95t.js +0 -1
- package/dist/chunks/datadog-BPuGcxxC.js +0 -1
- package/dist/chunks/debug-Bglx1aTu.js +0 -39
- package/dist/chunks/doctor-CkLzqAMd.js +0 -1
- package/dist/chunks/entry-TNOoyy7_.js +0 -13
- package/dist/chunks/esm-eTAUP-La.js +0 -1
- package/dist/chunks/execAsync-Bv2yxuGe.js +0 -1
- package/dist/chunks/exit-DXApFJIP.js +0 -1
- package/dist/chunks/extraUsage-CmQaLPV1.js +0 -1
- package/dist/chunks/extractMemories-xP63mv6R.js +0 -1
- package/dist/chunks/fast-C5nQH8rm.js +0 -1
- package/dist/chunks/fast-eGx2IxD7.js +0 -1
- package/dist/chunks/fetchModelList-CxLsVNsu.js +0 -1
- package/dist/chunks/fetchModelList-D24lRIgR.js +0 -1
- package/dist/chunks/fileSuggestions-DHxdwq28.js +0 -3
- package/dist/chunks/firstPartyEventLogger-BVAogAX8.js +0 -1
- package/dist/chunks/firstPartyEventLogger-M6UMli2c.js +0 -3
- package/dist/chunks/generateSessionName-BQoDduyA.js +0 -1
- package/dist/chunks/getMachineId-bsd-Cut1kHoA.js +0 -1
- package/dist/chunks/getMachineId-darwin-CsRhaP3y.js +0 -2
- package/dist/chunks/getMachineId-linux-Bd7UBNRQ.js +0 -1
- package/dist/chunks/getMachineId-unsupported-vFGP8E_8.js +0 -1
- package/dist/chunks/getMachineId-win-DamF2CH_.js +0 -1
- package/dist/chunks/goal-D7c2mSds.js +0 -3
- package/dist/chunks/grok-B2-ZbUiR.js +0 -1
- package/dist/chunks/grove-O6qp7ITR.js +0 -1
- package/dist/chunks/help-CZJdRviD.js +0 -1
- package/dist/chunks/history-CQiUERTL.js +0 -1
- package/dist/chunks/hooks-BNuUlMzL.js +0 -1
- package/dist/chunks/install-T_CV1Slu.js +0 -1
- package/dist/chunks/instrumentation-BjqUZ383.js +0 -21
- package/dist/chunks/keybindings-CLRaiL_Z.js +0 -1
- package/dist/chunks/launchLocalMemory-DrbKrwXc.js +0 -3
- package/dist/chunks/launchOnboarding-tqsMD8ni.js +0 -8
- package/dist/chunks/loadAgentsDir-CcmY8zCj.js +0 -1
- package/dist/chunks/localSearch-DrUj0B-d.js +0 -1
- package/dist/chunks/logoUtils-x2pHV-Nl.js +0 -1
- package/dist/chunks/main-kOVUGxOS.js +0 -345
- package/dist/chunks/managedEnv-BEqrGqn1.js +0 -1
- package/dist/chunks/mcp-BNd29r6p.js +0 -6
- package/dist/chunks/mcp-D0wAJrRT.js +0 -1
- package/dist/chunks/mcp-mgOlm1cY.js +0 -2
- package/dist/chunks/memory-DDLk9_LJ.js +0 -1
- package/dist/chunks/mode-CcNsWgK3.js +0 -2
- package/dist/chunks/model-BwBG0V1u.js +0 -1
- package/dist/chunks/model-DzCP4K-9.js +0 -1
- package/dist/chunks/modelOptions-DRaG3bo0.js +0 -1
- package/dist/chunks/nativeInstaller-C3pVPqrZ.js +0 -1
- package/dist/chunks/onChangeAppState-BlaoFbYF.js +0 -1
- package/dist/chunks/open-BtQHzzL9.js +0 -1
- package/dist/chunks/openai-CDN71NdX.js +0 -2
- package/dist/chunks/overlayContext-BT2Lq8ei.js +0 -1
- package/dist/chunks/parser-CG5RuOCK.js +0 -1
- package/dist/chunks/partition-CIl_ORUT.js +0 -1
- package/dist/chunks/permissions-zSNOZSwr.js +0 -3
- package/dist/chunks/pidLock-BTqO-h7Y.js +0 -3
- package/dist/chunks/plan-Bs6em6lk.js +0 -1
- package/dist/chunks/platform-BacQ6ACS.js +0 -2
- package/dist/chunks/plugin-DDDxjBa0.js +0 -17
- package/dist/chunks/pluginCliCommands-DXZfCZsv.js +0 -1
- package/dist/chunks/pluginOperations-hXYLrzM2.js +0 -2
- package/dist/chunks/pluginStartupCheck-HS1ZceZa.js +0 -1
- package/dist/chunks/plugins-COoGBYk6.js +0 -4
- package/dist/chunks/poorMode-G-pnu6NM.js +0 -1
- package/dist/chunks/print-BASybEtO.js +0 -13
- package/dist/chunks/processBashCommand-DDi_Pymt.js +0 -1
- package/dist/chunks/processSlashCommand-Cq9kaoSF.js +0 -5
- package/dist/chunks/prompt-CHobfCB1.js +0 -1
- package/dist/chunks/prompt-CMm6RHHc.js +0 -1
- package/dist/chunks/protocolHandler-DjQALaU2.js +0 -13
- package/dist/chunks/reconciler-CeXqh95g.js +0 -1
- package/dist/chunks/refresh-Ce2yk28a.js +0 -1
- package/dist/chunks/registerProtocol-CAsDme_E.js +0 -1
- package/dist/chunks/reject-Bld5E-bn.js +0 -1
- package/dist/chunks/rename-CtBghpxZ.js +0 -1
- package/dist/chunks/resume-BWkaTDqd.js +0 -2
- package/dist/chunks/ripgrep-DLs8MraF.js +0 -1
- package/dist/chunks/ripgrep-Dl3y5r4m.js +0 -5
- package/dist/chunks/sandbox-adapter-8GO6eJxw.js +0 -1
- package/dist/chunks/sandbox-toggle-Dir9Polo.js +0 -1
- package/dist/chunks/searchExtraTools-BhDq8DTJ.js +0 -1
- package/dist/chunks/select-Bxf5-5sI.js +0 -1
- package/dist/chunks/sessionFileAccessHooks-CozocHQE.js +0 -1
- package/dist/chunks/sessionObserver-DGEQM4cO.js +0 -1
- package/dist/chunks/sessionStorage-BcAscOGE.js +0 -1
- package/dist/chunks/sessionTracing-BoDDYLxW.js +0 -11
- package/dist/chunks/settings-B2jvL8Dp.js +0 -24
- package/dist/chunks/settings-CisDe8DB.js +0 -1
- package/dist/chunks/setup-BRypY6iT.js +0 -3
- package/dist/chunks/sinks-CGdKmq_8.js +0 -1
- package/dist/chunks/sinks-Cz2HfgMU.js +0 -1
- package/dist/chunks/skillChangeDetector-xviGstqm.js +0 -1
- package/dist/chunks/skills-CX_AvwLG.js +0 -1
- package/dist/chunks/src-CHw1lvBc.js +0 -3
- package/dist/chunks/startupProfiler-BH0FoI66.js +0 -1
- package/dist/chunks/startupProfiler-CJdr3SxP.js +0 -3
- package/dist/chunks/state-BhOKSFi5.js +0 -1
- package/dist/chunks/status-Daaak6Bo.js +0 -1
- package/dist/chunks/statusNoticeHelpers-vFVgIYuw.js +0 -1
- package/dist/chunks/switcher-BpgmH4AI.js +0 -1
- package/dist/chunks/tipRegistry-DamZr34w.js +0 -2
- package/dist/chunks/toolPool-CX5wDBi1.js +0 -1
- package/dist/chunks/useExitOnCtrlCDWithKeybindings-C9BYG8Bo.js +0 -1
- package/dist/chunks/useMainLoopModel-DwjSVzzO.js +0 -1
- package/dist/chunks/useManagePlugins-BqfIVa6E.js +0 -1
- package/dist/chunks/useMergedTools-Bw8FchX8.js +0 -1
- package/dist/chunks/useSearchInput-B25K1RnK.js +0 -1
- package/dist/chunks/useSettingsErrors-DYQ44kX4.js +0 -1
- package/dist/chunks/util-CtlC2dsN.js +0 -1
- package/dist/chunks/vim-CoRp9lY1.js +0 -1
- package/dist/chunks/worktree-B8apCnVe.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e,t}from"./managedEnv-CIWJsuty.js";e();export{t as applyConfigEnvironmentVariables};
|
|
@@ -1 +1 @@
|
|
|
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-
|
|
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};
|
|
@@ -0,0 +1 @@
|
|
|
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};
|
|
@@ -0,0 +1,2 @@
|
|
|
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};
|
|
@@ -0,0 +1,6 @@
|
|
|
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};
|
|
@@ -0,0 +1 @@
|
|
|
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};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{I as n,P as r,ai as i,t as a}from"./src-DL3w8VPk.js";import{t as o}from"./jsx-runtime-Bb4Xn-E0.js";import{ct as s,dt as c,lt as l,ut as u}from"./loadAgentsDir-DGozQu_6.js";import{n as d,t as f}from"./select-Fq6g2Ejk.js";function p({onDone:e}){let t=u(),i=s(),a=(0,m.useMemo)(()=>t.map(e=>({label:(0,h.jsxs)(r,{children:[e.icon,` `,e.name,` `,(0,h.jsxs)(r,{dimColor:!0,children:[`(`,e.slug,`) — `,e.description]})]}),value:e.slug})),[t]);function o(n){c(n);let r=t.find(e=>e.slug===n);e(`${r?.icon} Mode switched to: ${r?.name} (${r?.slug}) — ${r?.description}`,{display:`system`})}function l(){e(`Mode selection cancelled.`,{display:`system`})}return(0,h.jsxs)(n,{flexDirection:`column`,children:[(0,h.jsxs)(n,{marginBottom:1,flexDirection:`column`,children:[(0,h.jsx)(r,{color:`remember`,bold:!0,children:`Select mode`}),(0,h.jsx)(r,{dimColor:!0,children:`Arrow keys to navigate, Enter to select, Esc to cancel.`})]}),(0,h.jsx)(f,{defaultValue:i,options:a,onChange:o,onCancel:l,visibleOptionCount:t.length})]})}var m,h,g;e((()=>{m=t(i(),1),a(),d(),l(),h=o(),g=async(e,t,n)=>{let r=n?.trim().toLowerCase();if(r){let t=u(),n=t.find(e=>e.slug===r);if(!n){e(`Unknown mode: "${r}"\n\nAvailable modes:\n${t.map(e=>`${e.icon} ${e.slug} — ${e.description}`).join(`
|
|
2
|
+
`)}`,{display:`system`});return}c(r),e(`${n.icon} Mode switched to: ${n.name} (${n.slug}) — ${n.description}`,{display:`system`});return}return(0,h.jsx)(p,{onDone:e})}}))();export{g as call};
|
|
@@ -0,0 +1 @@
|
|
|
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};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{ai as n,di as r,fi as i}from"./src-DL3w8VPk.js";import{t as a}from"./jsx-runtime-Bb4Xn-E0.js";import{Bp as o,Hp as s,RS as c,XC as l,ad as u,aw as d,id as f,nw as p,ow as m,rd as h,rw as g,zS as _,zp as v}from"./loadAgentsDir-DGozQu_6.js";import{A as y,k as b,q as x}from"./log-DoSpAwRP.js";import{n as S}from"./analytics-COpjZpvd.js";import{C,E as w,T,f as E,h as D,i as O,w as k,y as A}from"./model-DpZaKZMb.js";import{i as j,r as M}from"./switcher-DMfuKuw_.js";import{i as N,n as P,r as F,t as I}from"./extraUsage-BtHE-SBX.js";function L({onDone:e}){let t=o(e=>e.mainLoopModel),n=o(e=>e.mainLoopModelForSession),i=o(e=>e.fastMode),a=s();function c(){let n=U(t);e(`Kept model as ${r.bold(n)}`,{display:`system`})}async function u(t){a(e=>({...e,mainLoopModel:t,mainLoopModelForSession:null}));let n=`Set model to ${r.bold(U(t))}`,o;if(d()&&(l(),!m(t)&&i?(a(e=>({...e,fastMode:!1})),o=!1):m(t)&&g()&&i&&(n+=` · Fast mode ON`,o=!0)),P(t,o===!0,D())&&(n+=` · Billed as extra usage`),o===!1&&(n+=` · Fast mode OFF`),t){let e=await j(t);e.kind===`updated`&&(n+=` · Provider "${e.providerId}" default model updated`)}e(n)}return(0,G.jsx)(F,{initial:t,sessionModel:n,onSelect:u,onCancel:c,isStandaloneCommand:!0,showFastModeNotice:d()&&i&&m(t)&&g()})}function R({args:e,onDone:t}){let n=o(e=>e.fastMode),i=s(),a=e==="default"?null:e;return W.useEffect(()=>{async function e(){if(a&&!k(a)){t(`Model '${a}' is not available. Your organization restricts model selection.`,{display:`system`});return}if(a&&B(a)){t(`Opus 4.7 with 1M context is not available for your account. Learn more: https://code.workmate.com/docs/en/model-config#extended-context-with-1m`,{display:`system`});return}if(a&&V(a)){t(`Sonnet 4.6 with 1M context is not available for your account. Learn more: https://code.workmate.com/docs/en/model-config#extended-context-with-1m`,{display:`system`});return}if(!a){o(null);return}if(z(a)){await o(a);return}try{let{valid:e,error:n}=await _(a);e?await o(a):t(n||`Model '${a}' not found`,{display:`system`})}catch(e){t(`Failed to validate model: ${e.message}`,{display:`system`})}}async function o(e){i(t=>({...t,mainLoopModel:e,mainLoopModelForSession:null}));let a=`Set model to ${r.bold(U(e))}`,o;if(d()&&(l(),!m(e)&&n?(i(e=>({...e,fastMode:!1})),o=!1):m(e)&&n&&(a+=` · Fast mode ON`,o=!0)),P(e,o===!0,D())&&(a+=` · Billed as extra usage`),o===!1&&(a+=` · Fast mode OFF`),e){let t=await j(e);t.kind===`updated`&&(a+=` · Provider "${t.providerId}" default model updated`)}t(a)}e()},[a,t,i]),null}function z(e){return T.includes(e.toLowerCase().trim())}function B(e){let t=e.toLowerCase();return!h()&&!D()&&t.includes(`opus`)&&t.includes(`[1m]`)}function V(e){let t=e.toLowerCase();return!f()&&(t.includes(`sonnet[1m]`)||t.includes(`sonnet-4-6[1m]`))}function H({onDone:e}){let t=o(e=>e.mainLoopModel),n=o(e=>e.mainLoopModelForSession),i=U(t);return e(n?`Current model: ${r.bold(U(n))} (session override from plan mode)\nBase model: ${i}`:`Current model: ${i}`),null}function U(e){let t=A(e??O());return e===null?`${t} (default)`:t}var W,G,K;e((()=>{i(),W=t(n(),1),N(),x(),S(),v(),I(),p(),w(),u(),E(),C(),c(),M(),G=a(),K=async(e,t,n)=>{if(n=n?.trim()||``,y.includes(n))return(0,G.jsx)(H,{onDone:e});if(b.includes(n)){e(`Run /model to open the model selection menu, or /model [modelName] to set the model.`,{display:`system`});return}return n?(0,G.jsx)(R,{args:n,onDone:e}):(0,G.jsx)(L,{onDone:e})}}))();export{K as call};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{Pt as t,j as n}from"./state-BQ4BEGin.js";import{__ as r,h_ as i,y_ as a}from"./loadAgentsDir-DGozQu_6.js";import{d as o,h as s}from"./settings-CodSADx8.js";import{d as c,o as l}from"./config-CWPHVTic.js";import{C as u,Mt as d,Pt as f,d as p,f as m,i as h,w as g,y as _}from"./model-DpZaKZMb.js";function v(e=!1){let t=d()!==`firstParty`;return{value:null,label:`Default (recommended)`,description:`Use the default model (currently ${_(h())})${t?``:` · ${r(i)}`}`}}function y(e=!1){let t=[v(e)],r=process.env.ANTHROPIC_CUSTOM_MODEL_OPTION;r&&!t.some(e=>e.value===r)&&t.push({value:r,label:process.env.ANTHROPIC_CUSTOM_MODEL_OPTION_NAME??r,description:process.env.ANTHROPIC_CUSTOM_MODEL_OPTION_DESCRIPTION??`Custom model (${r})`});for(let e of l().additionalModelOptionsCache??[])t.some(t=>t.value===e.value)||t.push(e);let i=null,a=p(),o=n();return a==null?o!==null&&(i=o):i=a,i!==null&&!t.some(e=>e.value===i)&&t.push({value:i,label:i,description:`Custom model`}),b(t)}function b(e){return(o()||{}).availableModels?e.filter(e=>e.value===null||e.value!==null&&g(e.value)):e}function x(e,t){return e.length===0?null:b([v(t),...e])}var S=e((()=>{t(),c(),a(),s(),u(),m(),f()}));export{y as n,S as r,x as t};
|
|
@@ -0,0 +1 @@
|
|
|
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 +1 @@
|
|
|
1
|
-
import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{
|
|
1
|
+
import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{ai as n}from"./src-DL3w8VPk.js";import{Hp as r,Vp as i,zp as a}from"./loadAgentsDir-DGozQu_6.js";function o(){let e=i(),t=r(),n=(0,c.useCallback)(()=>{t(e=>{let r=s(e.notifications.queue);return e.notifications.current!==null||!r?e:(u=setTimeout((e,t,n)=>{u=null,e(e=>e.notifications.current?.key===t?{...e,notifications:{queue:e.notifications.queue,current:null}}:e),n()},r.timeoutMs??l,t,r.key,n),{...e,notifications:{queue:e.notifications.queue.filter(e=>e!==r),current:r}})})},[t]),a=(0,c.useCallback)(e=>{if(e.priority===`immediate`){u&&(clearTimeout(u),u=null),u=setTimeout((e,t,n)=>{u=null,e(e=>e.notifications.current?.key===t.key?{...e,notifications:{queue:e.notifications.queue.filter(e=>!t.invalidates?.includes(e.key)),current:null}}:e),n()},e.timeoutMs??l,t,e,n),t(t=>({...t,notifications:{current:e,queue:[...t.notifications.current?[t.notifications.current]:[],...t.notifications.queue].filter(t=>t.priority!==`immediate`&&!e.invalidates?.includes(t.key))}}));return}t(r=>{if(e.fold){if(r.notifications.current?.key===e.key){let i=e.fold(r.notifications.current,e);return u&&(clearTimeout(u),u=null),u=setTimeout((e,t,n)=>{u=null,e(e=>e.notifications.current?.key===t?{...e,notifications:{queue:e.notifications.queue,current:null}}:e),n()},i.timeoutMs??l,t,i.key,n),{...r,notifications:{current:i,queue:r.notifications.queue}}}let i=r.notifications.queue.findIndex(t=>t.key===e.key);if(i!==-1){let t=e.fold(r.notifications.queue[i],e),n=[...r.notifications.queue];return n[i]=t,{...r,notifications:{current:r.notifications.current,queue:n}}}}if(!(!new Set(r.notifications.queue.map(e=>e.key)).has(e.key)&&r.notifications.current?.key!==e.key))return r;let i=r.notifications.current!==null&&e.invalidates?.includes(r.notifications.current.key);return i&&u&&(clearTimeout(u),u=null),{...r,notifications:{current:i?null:r.notifications.current,queue:[...r.notifications.queue.filter(t=>t.priority!==`immediate`&&!e.invalidates?.includes(t.key)),e]}}}),n()},[t,n]),o=(0,c.useCallback)(e=>{t(t=>{let n=t.notifications.current?.key===e,r=t.notifications.queue.some(t=>t.key===e);return!n&&!r?t:(n&&u&&(clearTimeout(u),u=null),{...t,notifications:{current:n?null:t.notifications.current,queue:t.notifications.queue.filter(t=>t.key!==e)}})}),n()},[t,n]);return(0,c.useEffect)(()=>{e.getState().notifications.queue.length>0&&n()},[]),{addNotification:a,removeNotification:o}}function s(e){if(e.length!==0)return e.reduce((e,t)=>d[t.priority]<d[e.priority]?t:e)}var c,l,u,d,f=e((()=>{c=t(n(),1),a(),l=8e3,u=null,d={immediate:0,high:1,medium:2,low:3}}));export{o as n,f as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{o as e}from"./rolldown-runtime-DaDcL9Zw.js";import{ai as t}from"./src-DL3w8VPk.js";import{t as n}from"./jsx-runtime-Bb4Xn-E0.js";import{Pt as r,vn as i}from"./state-BQ4BEGin.js";import{Fl as a,Ml as o,Pl as s}from"./loadAgentsDir-DGozQu_6.js";import{I as c,V as l}from"./debug-CRnGsZOV.js";import{Rt as u,jt as d}from"./settings-CodSADx8.js";import{d as f,h as p,m,o as h}from"./config-CWPHVTic.js";import{o as g,s as _}from"./log-DoSpAwRP.js";import{r as v,t as y}from"./managedEnv-CIWJsuty.js";var b=e(t(),1);f();var x=n();function S(e,t){let n=t/100*(e.length-1),r=Math.floor(n),i=Math.ceil(n);return r===i?e[r]:e[r]+(e[i]-e[r])*(n-r)}var C=1024;function w(){let e=new Map,t=new Map,n=new Map;return{increment(t,n=1){e.set(t,(e.get(t)??0)+n)},set(t,n){e.set(t,n)},observe(e,n){let r=t.get(e);if(r||(r={reservoir:[],count:0,sum:0,min:n,max:n},t.set(e,r)),r.count++,r.sum+=n,n<r.min&&(r.min=n),n>r.max&&(r.max=n),r.reservoir.length<C)r.reservoir.push(n);else{let e=Math.floor(Math.random()*r.count);e<C&&(r.reservoir[e]=n)}},add(e,t){let r=n.get(e);r||(r=new Set,n.set(e,r)),r.add(t)},getAll(){let r=Object.fromEntries(e);for(let[e,n]of t){if(n.count===0)continue;r[`${e}_count`]=n.count,r[`${e}_min`]=n.min,r[`${e}_max`]=n.max,r[`${e}_avg`]=n.sum/n.count;let t=[...n.reservoir].sort((e,t)=>e-t);r[`${e}_p50`]=S(t,50),r[`${e}_p95`]=S(t,95),r[`${e}_p99`]=S(t,99)}for(let[e,t]of n)r[e]=t.size;return r}}}var T=(0,b.createContext)(null);function E({store:e,children:t}){let n=(0,b.useMemo)(()=>w(),[]),r=e??n;return(0,b.useEffect)(()=>{let e=()=>{let e=r.getAll();Object.keys(e).length>0&&m(t=>({...t,lastSessionMetrics:e}))};return process.on(`exit`,e),()=>{process.off(`exit`,e)}},[r]),(0,x.jsx)(T.Provider,{value:r,children:t})}r(),f(),c(),g(),v(),d(),o();function D({newState:e,oldState:t}){let n=t.toolPermissionContext.mode,r=e.toolPermissionContext.mode;if(n!==r){let e=u(n),t=u(r);e!==t&&a({permission_mode:t}),s(r)}if(e.mainLoopModel!==t.mainLoopModel&&i(e.mainLoopModel),e.expandedView!==t.expandedView){let t=e.expandedView===`tasks`;h().showExpandedTodos!==t&&p(e=>({...e,showExpandedTodos:t}))}if(e.verbose!==t.verbose&&h().verbose!==e.verbose){let t=e.verbose;p(e=>({...e,verbose:t}))}if(e.settings!==t.settings)try{e.settings.env!==t.settings.env&&y()}catch(e){_(l(e))}}export{E as n,w as r,D as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{promisify as t}from"node:util";import n from"node:process";import r from"node:path";import i,{execFile as a}from"node:child_process";import o from"node:fs";import s from"node:os";import c,{constants as l}from"node:fs/promises";import{Buffer as u}from"node:buffer";import{fileURLToPath as d}from"node:url";function ee(){try{return o.statSync(`/.dockerenv`),!0}catch{return!1}}function te(){try{return o.readFileSync(`/proc/self/cgroup`,`utf8`).includes(`docker`)}catch{return!1}}function f(){return p===void 0&&(p=ee()||te()),p}var p,ne=e((()=>{}));function m(){return h===void 0&&(h=g()||f()),h}var h,g,_=e((()=>{ne(),g=()=>{try{return o.statSync(`/run/.containerenv`),!0}catch{return!1}}})),v,y,re=e((()=>{_(),v=()=>{if(n.platform!==`linux`)return!1;if(s.release().toLowerCase().includes(`microsoft`))return!m();try{if(o.readFileSync(`/proc/version`,`utf8`).toLowerCase().includes(`microsoft`))return!m()}catch{}return o.existsSync(`/proc/sys/fs/binfmt_misc/WSLInterop`)||o.existsSync(`/run/WSL`)?!m():!1},y=n.env.__IS_WSL_TEST__?v:v()})),b,x,S,C=e((()=>{re(),b=(()=>{let e=`/mnt/`,t;return async function(){if(t)return t;let n=`/etc/wsl.conf`,r=!1;try{await c.access(n,l.F_OK),r=!0}catch{}if(!r)return e;let i=await c.readFile(n,{encoding:`utf8`}),a=/(?<!#.*)root\s*=\s*(?<mountPoint>.*)/g.exec(i);return a?(t=a.groups.mountPoint.trim(),t=t.endsWith(`/`)?t:`${t}/`,t):e}})(),x=async()=>`${await b()}c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe`,S=async()=>y?x():`${n.env.SYSTEMROOT||n.env.windir||String.raw`C:\Windows`}\\System32\\WindowsPowerShell\\v1.0\\powershell.exe`}));function w(e,t,n){let r=n=>Object.defineProperty(e,t,{value:n,enumerable:!0,writable:!0});return Object.defineProperty(e,t,{configurable:!0,enumerable:!0,get(){let e=n();return r(e),e},set(e){r(e)}}),e}var T=e((()=>{}));async function E(){if(n.platform!==`darwin`)throw Error(`macOS only`);let{stdout:e}=await D(`defaults`,[`read`,`com.apple.LaunchServices/com.apple.launchservices.secure`,`LSHandlers`]),t=/LSHandlerRoleAll = "(?!-)(?<id>[^"]+?)";\s+?LSHandlerURLScheme = (?:http|https);/.exec(e)?.groups.id??`com.apple.Safari`;return t===`com.apple.safari`?`com.apple.Safari`:t}var D,O=e((()=>{D=t(a)}));async function k(e,{humanReadableOutput:t=!0,signal:r}={}){if(n.platform!==`darwin`)throw Error(`macOS only`);let i=t?[]:[`-ss`],a={};r&&(a.signal=r);let{stdout:o}=await A(`osascript`,[`-e`,e,i],a);return o.trim()}var A,j=e((()=>{A=t(a)}));async function M(e){return k(`tell application "Finder" to set app_path to application file id "${e}" as string\ntell application "System Events" to get value of property list item "CFBundleName" of property list file (app_path & ":Contents:Info.plist")`)}var N=e((()=>{j()}));async function P(e=F){let{stdout:t}=await e(`reg`,[`QUERY`,` HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\Shell\\Associations\\UrlAssociations\\http\\UserChoice`,`/v`,`ProgId`]),n=/ProgId\s*REG_SZ\s*(?<id>\S+)/.exec(t);if(!n)throw new L(`Cannot find Windows browser in stdout: ${JSON.stringify(t)}`);let{id:r}=n.groups,i=r.lastIndexOf(`.`),a=r.lastIndexOf(`-`),o=i===-1?void 0:r.slice(0,i),s=a===-1?void 0:r.slice(0,a);return I[r]??I[o]??I[s]??{name:r,id:r}}var F,I,L,R=e((()=>{F=t(a),I={MSEdgeHTM:{name:`Edge`,id:`com.microsoft.edge`},MSEdgeBHTML:{name:`Edge Beta`,id:`com.microsoft.edge.beta`},MSEdgeDHTML:{name:`Edge Dev`,id:`com.microsoft.edge.dev`},AppXq0fevzme2pys62n3e0fbqa7peapykr8v:{name:`Edge`,id:`com.microsoft.edge.old`},ChromeHTML:{name:`Chrome`,id:`com.google.chrome`},ChromeBHTML:{name:`Chrome Beta`,id:`com.google.chrome.beta`},ChromeDHTML:{name:`Chrome Dev`,id:`com.google.chrome.dev`},ChromiumHTM:{name:`Chromium`,id:`org.chromium.Chromium`},BraveHTML:{name:`Brave`,id:`com.brave.Browser`},BraveBHTML:{name:`Brave Beta`,id:`com.brave.Browser.beta`},BraveDHTML:{name:`Brave Dev`,id:`com.brave.Browser.dev`},BraveSSHTM:{name:`Brave Nightly`,id:`com.brave.Browser.nightly`},FirefoxURL:{name:`Firefox`,id:`org.mozilla.firefox`},OperaStable:{name:`Opera`,id:`com.operasoftware.Opera`},VivaldiHTM:{name:`Vivaldi`,id:`com.vivaldi.Vivaldi`},"IE.HTTP":{name:`Internet Explorer`,id:`com.microsoft.ie`}},new Map(Object.entries(I)),L=class extends Error{}}));async function z(){if(n.platform===`darwin`){let e=await E();return{name:await M(e),id:e}}if(n.platform===`linux`){let{stdout:e}=await B(`xdg-mime`,[`query`,`default`,`x-scheme-handler/http`]),t=e.trim();return{name:V(t.replace(/.desktop$/,``).replace(`-`,` `)),id:t}}if(n.platform===`win32`)return P();throw Error(`Only macOS, Linux, and Windows are supported`)}var B,V,H=e((()=>{O(),N(),R(),B=t(a),V=e=>e.toLowerCase().replaceAll(/(?:^|\s|-)\S/g,e=>e.toUpperCase())}));async function ie(){let e=await S(),t=String.raw`(Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice").ProgId`,n=u.from(t,`utf16le`).toString(`base64`),{stdout:r}=await G(e,[`-NoProfile`,`-NonInteractive`,`-ExecutionPolicy`,`Bypass`,`-EncodedCommand`,n],{encoding:`utf8`}),i=r.trim(),a={ChromeHTML:`com.google.chrome`,BraveHTML:`com.brave.Browser`,MSEdgeHTM:`com.microsoft.edge`,FirefoxURL:`org.mozilla.firefox`};return a[i]?{id:a[i]}:{}}function U(e){if(typeof e==`string`||Array.isArray(e))return e;let{[Y]:t}=e;if(!t)throw Error(`${Y} is not supported`);return t}function W({[J]:e},{wsl:t}){if(t&&y)return U(t);if(!e)throw Error(`${J} is not supported`);return U(e)}var G,K,q,J,Y,X,Z,Q,$;e((()=>{C(),T(),H(),_(),G=t(i.execFile),K=r.dirname(d(import.meta.url)),q=r.join(K,`xdg-open`),{platform:J,arch:Y}=n,X=async(e,t)=>{let n;for(let r of e)try{return await t(r)}catch(e){n=e}throw n},Z=async e=>{if(e={wait:!1,background:!1,newInstance:!1,allowNonzeroExitCode:!1,...e},Array.isArray(e.app))return X(e.app,t=>Z({...e,app:t}));let{name:t,arguments:r=[]}=e.app??{};if(r=[...r],Array.isArray(t))return X(t,t=>Z({...e,app:{name:t,arguments:r}}));if(t===`browser`||t===`browserPrivate`){let n={"com.google.chrome":`chrome`,"google-chrome.desktop":`chrome`,"com.brave.Browser":`brave`,"org.mozilla.firefox":`firefox`,"firefox.desktop":`firefox`,"com.microsoft.msedge":`edge`,"com.microsoft.edge":`edge`,"com.microsoft.edgemac":`edge`,"microsoft-edge.desktop":`edge`},i={chrome:`--incognito`,brave:`--incognito`,firefox:`--private-window`,edge:`--inPrivate`},a=y?await ie():await z();if(a.id in n){let o=n[a.id];return t===`browserPrivate`&&r.push(i[o]),Z({...e,app:{name:$[o],arguments:r}})}throw Error(`${a.name} is not supported as a default browser`)}let a,o=[],s={};if(J===`darwin`)a=`open`,e.wait&&o.push(`--wait-apps`),e.background&&o.push(`--background`),e.newInstance&&o.push(`--new`),t&&o.push(`-a`,t);else if(J===`win32`||y&&!m()&&!t){a=await S(),o.push(`-NoProfile`,`-NonInteractive`,`-ExecutionPolicy`,`Bypass`,`-EncodedCommand`),y||(s.windowsVerbatimArguments=!0);let n=[`Start`];e.wait&&n.push(`-Wait`),t?(n.push(`"\`"${t}\`""`),e.target&&r.push(e.target)):e.target&&n.push(`"${e.target}"`),r.length>0&&(r=r.map(e=>`"\`"${e}\`""`),n.push(`-ArgumentList`,r.join(`,`))),e.target=u.from(n.join(` `),`utf16le`).toString(`base64`)}else{if(t)a=t;else{let e=!K||K===`/`,t=!1;try{await c.access(q,l.X_OK),t=!0}catch{}a=n.versions.electron??(J===`android`||e||!t)?`xdg-open`:q}r.length>0&&o.push(...r),e.wait||(s.stdio=`ignore`,s.detached=!0)}J===`darwin`&&r.length>0&&o.push(`--args`,...r),e.target&&o.push(e.target);let d=i.spawn(a,o,s);return e.wait?new Promise((t,n)=>{d.once(`error`,n),d.once(`close`,r=>{if(!e.allowNonzeroExitCode&&r>0){n(Error(`Exited with code ${r}`));return}t(d)})}):(d.unref(),d)},Q=(e,t)=>{if(typeof e!=`string`)throw TypeError("Expected a `target`");return Z({...t,target:e})},$={},w($,`chrome`,()=>W({darwin:`google chrome`,win32:`chrome`,linux:[`google-chrome`,`google-chrome-stable`,`chromium`]},{wsl:{ia32:`/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe`,x64:[`/mnt/c/Program Files/Google/Chrome/Application/chrome.exe`,`/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe`]}})),w($,`brave`,()=>W({darwin:`brave browser`,win32:`brave`,linux:[`brave-browser`,`brave`]},{wsl:{ia32:`/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe`,x64:[`/mnt/c/Program Files/BraveSoftware/Brave-Browser/Application/brave.exe`,`/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe`]}})),w($,`firefox`,()=>W({darwin:`firefox`,win32:String.raw`C:\Program Files\Mozilla Firefox\firefox.exe`,linux:`firefox`},{wsl:`/mnt/c/Program Files/Mozilla Firefox/firefox.exe`})),w($,`edge`,()=>W({darwin:`microsoft edge`,win32:`msedge`,linux:[`microsoft-edge`,`microsoft-edge-dev`]},{wsl:`/mnt/c/Program Files (x86)/Microsoft/Edge/Application/msedge.exe`})),w($,`browser`,()=>`browser`),w($,`browserPrivate`,()=>`browserPrivate`)}))();export{Q as default};
|
|
@@ -0,0 +1,2 @@
|
|
|
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};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{Rn as n,ai as r,t as i}from"./src-DL3w8VPk.js";import{Bp as a,Rp as o,zp as s}from"./loadAgentsDir-DGozQu_6.js";function c(e,t=!0){let r=(0,d.useContext)(o)?.setState;(0,d.useEffect)(()=>{if(!(!t||!r))return r(t=>{if(t.activeOverlays.has(e))return t;let n=new Set(t.activeOverlays);return n.add(e),{...t,activeOverlays:n}}),()=>{r(t=>{if(!t.activeOverlays.has(e))return t;let n=new Set(t.activeOverlays);return n.delete(e),{...t,activeOverlays:n}})}},[e,t,r]),(0,d.useLayoutEffect)(()=>{if(t)return()=>n.get(process.stdout)?.invalidatePrevFrame()},[t])}function l(){return a(e=>e.activeOverlays.size>0)}function u(){return a(e=>{for(let t of e.activeOverlays)if(!f.has(t))return!0;return!1})}var d,f,p=e((()=>{d=t(r(),1),i(),s(),f=new Set([`autocomplete`])}));export{c as i,u as n,l as r,p as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{I as n,P as r,ai as i,hn as a,t as o,y as s}from"./src-DL3w8VPk.js";import{t as c}from"./jsx-runtime-Bb4Xn-E0.js";import{o as l,r as u}from"./break-cache-
|
|
1
|
+
import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{I as n,P as r,ai as i,hn as a,t as o,y as s}from"./src-DL3w8VPk.js";import{t as c}from"./jsx-runtime-Bb4Xn-E0.js";import{o as l,r as u}from"./break-cache-UUt6Dkf2.js";async function d(e,t){let n=await u(e);n.type===`text`&&t(n.value,{display:`system`})}function f({onDone:e}){let[t,i]=(0,m.useState)(0),o=(0,m.useMemo)(()=>[{label:`Status`,description:`显示 pending 标记、always 模式与打断次数`,run:()=>void d(`status`,e)},{label:`Once`,description:`仅在下一次 API 调用打断 prompt cache`,run:()=>void d(`once`,e)},{label:`Always`,description:`在每次 API 调用都打断 prompt cache`,run:()=>void d(`always`,e)},{label:`Off`,description:`关闭 always 模式并清除 pending 的一次性标记`,run:()=>void d(`off`,e)},{label:`Clear Once`,description:`取消待生效的一次性 cache 打断`,run:()=>void d(`--clear`,e)}],[e]),c=()=>{let e=o[t];e&&e.run()};return a((e,t)=>{if(t.upArrow){i(e=>Math.max(0,e-1));return}if(t.downArrow){i(e=>Math.min(o.length-1,e+1));return}t.return&&c()}),(0,h.jsx)(s,{title:`Break Cache`,subtitle:`${o.length} actions`,onCancel:()=>e(`Break-cache panel dismissed`,{display:`system`}),color:`background`,hideInputGuide:!0,children:(0,h.jsxs)(n,{flexDirection:`column`,children:[o.map((e,i)=>(0,h.jsxs)(n,{flexDirection:`row`,children:[(0,h.jsx)(r,{children:`${i===t?`›`:` `} ${e.label}`.padEnd(g)}),(0,h.jsx)(r,{dimColor:!0,children:e.description})]},e.label)),(0,h.jsx)(n,{marginTop:1,children:(0,h.jsx)(r,{dimColor:!0,children:`↑/↓ select · Enter run · Esc close`})})]})})}async function p(e,t,n){let r=n?.trim()??``;return r?(await d(r,e),null):(0,h.jsx)(f,{onDone:e})}var m,h,g;e((()=>{m=t(i(),1),o(),l(),h=c(),g=28}))();export{p as call};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as e,r as t}from"./parser-UqADrvxF.js";t();export{e as parseCommand};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{i as t}from"./debug-
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{i as t}from"./debug-CRnGsZOV.js";var n,r=e((()=>{Promise.resolve(),n=new Set([`if`,`then`,`elif`,`else`,`fi`,`while`,`until`,`for`,`in`,`do`,`done`,`case`,`esac`,`function`,`select`])}));async function i(e){return!e||e.length,null}async function a(e){return!e||e.length,null}function o(e){if(e.type===`declaration_command`){let t=e.children[0];return t&&c.has(t.text)?[t.text]:[]}let t=[],n=!1;for(let r of e.children)if(r.type!==`variable_assignment`){if(r.type===`command_name`||!n&&r.type===`word`){n=!0,t.push(r.text);continue}if(l.has(r.type))t.push(s(r.text));else if(u.has(r.type))break}return t}function s(e){return e.length>=2&&(e[0]===`"`&&e.at(-1)===`"`||e[0]===`'`&&e.at(-1)===`'`)?e.slice(1,-1):e}var c,l,u,d,f=e((()=>{t(),r(),c=new Set([`export`,`declare`,`typeset`,`readonly`,`local`,`unset`,`unsetenv`]),l=new Set([`word`,`string`,`raw_string`,`number`]),u=new Set([`command_substitution`,`process_substitution`]),d=Symbol(`parse-aborted`)}));export{a,i,o as n,n as o,f as r,r as s,d as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{ar as t,ir as n,ni as r,ri as i}from"./state-BQ4BEGin.js";import{n as a,t as o}from"./_baseEach-DrPH_FGo.js";function s(e,t,n,r){for(var i=-1,a=e==null?0:e.length;++i<a;){var o=e[i];t(r,o,n(o),e)}return r}var c=e((()=>{}));function l(e,t,n,r){return o(e,function(e,i,a){t(r,e,n(e),a)}),r}var u=e((()=>{a()}));function d(e,t){return function(r,a){var o=i(r)?s:l,c=t?t():{};return o(r,e,n(a,2),c)}}var f=e((()=>{c(),u(),t(),r()})),p,m=e((()=>{f(),p=d(function(e,t,n){e[+!n].push(t)},function(){return[[],[]]})}));export{p as n,m as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{i as t,o as n}from"./envUtils-DfkgIdYf.js";import{I as r,R as i,c as a,i as o}from"./debug-
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{i as t,o as n}from"./envUtils-DfkgIdYf.js";import{I as r,R as i,c as a,i as o}from"./debug-CRnGsZOV.js";import{join as s}from"path";import{createHash as c}from"crypto";import{mkdir as l,readFile as u,readdir as d,stat as f,unlink as p,writeFile as m}from"fs/promises";function h(){return s(t(),x)}function g(e){return c(`sha256`).update(e).digest(`hex`).slice(0,16)}function _(e){return s(h(),`${e}.txt`)}async function v(e,t){try{await l(h(),{recursive:!0});let n=_(e);await m(n,t,{encoding:`utf8`,mode:384}),a(`Stored paste ${e} to ${n}`)}catch(e){a(`Failed to store paste: ${e}`)}}async function y(e){try{return await u(_(e),{encoding:`utf8`})}catch(t){return i(t)||a(`Failed to retrieve paste ${e}: ${t}`),null}}async function b(e){let t=h(),n;try{n=await d(t)}catch{return}let r=e.getTime();for(let e of n){if(!e.endsWith(`.txt`))continue;let n=s(t,e);try{(await f(n)).mtimeMs<r&&(await p(n),a(`Cleaned up old paste: ${n}`))}catch{}}}var x,S=e((()=>{o(),n(),r(),x=`paste-cache`}));export{v as a,y as i,g as n,S as r,b as t};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{n,t as r}from"./figures-5ThXQEtq.js";import{I as i,P as a,Wt as o,Xn as s,a as c,ai as l,di as u,fi as d,hn as f,k as p,kt as m,n as h,o as ee,ot as g,r as te,s as ne,t as _,x as re,y as v}from"./src-DL3w8VPk.js";import{t as y}from"./jsx-runtime-Bb4Xn-E0.js";import{Pt as ie,q as b}from"./state-BQ4BEGin.js";import{Bp as ae,Cb as x,DC as S,H as C,Hp as oe,I as se,Ji as w,L as ce,Mf as T,Mm as E,Nm as le,R as ue,V as D,gS as O,jf as k,kC as de,kb as fe,km as pe,z as me,zp as A}from"./loadAgentsDir-DGozQu_6.js";import{C as j,x as M}from"./debug-CRnGsZOV.js";import{B as N,R as P,V as F,a as I,h as L,ln as R,rn as z}from"./settings-CodSADx8.js";import{l as B,o as he}from"./stringUtils-Bu_lJH5c.js";import{n as ge,t as _e}from"./TextInput-Cev5Awdd.js";import{n as ve,t as ye}from"./useExitOnCtrlCDWithKeybindings-DWRFdFoU.js";import{n as V,t as H}from"./select-Fq6g2Ejk.js";import{n as be,t as xe}from"./AddWorkspaceDirectory-Y5S_lMjD.js";import{t as Se}from"./SearchBox-C9xxQzh1.js";import{n as Ce,t as we}from"./useSearchInput-B_mY9wBq.js";import{n as Te,t as Ee}from"./shadowedRuleDetection-CTnYVrmP.js";function De(){return U}var U,Oe=e((()=>{U=[]}));function ke({ruleValue:e}){switch(e.toolName){case k.name:return e.ruleContent?e.ruleContent.endsWith(`:*`)?(0,W.jsxs)(a,{dimColor:!0,children:[`Any Bash command starting with `,(0,W.jsx)(a,{bold:!0,children:e.ruleContent.slice(0,-2)})]}):(0,W.jsxs)(a,{dimColor:!0,children:[`The Bash command `,(0,W.jsx)(a,{bold:!0,children:e.ruleContent})]}):(0,W.jsx)(a,{dimColor:!0,children:`Any Bash command`});default:return e.ruleContent?null:(0,W.jsxs)(a,{dimColor:!0,children:[`Any use of the `,(0,W.jsx)(a,{bold:!0,children:e.toolName}),` tool`]})}}var W,Ae=e((()=>{_(),T(),W=y()}));function je(e){switch(e){case`localSettings`:return{label:`Project settings (local)`,description:`Saved in ${I(`localSettings`)}`,value:e};case`projectSettings`:return{label:`Project settings`,description:`Checked in at ${I(`projectSettings`)}`,value:e};case`userSettings`:return{label:`User settings`,description:`Saved in at ~/.workmate/settings.json`,value:e}}}function Me({onAddRules:e,onCancel:t,ruleValues:n,ruleBehavior:r,initialContext:o,setToolPermissionContext:s}){let c=z.map(je),l=(0,Ne.useCallback)(i=>{if(i===`cancel`){t();return}else if(z.includes(i)){let t=i,a=pe(o,{type:`addRules`,rules:n,behavior:r,destination:t});le({type:`addRules`,rules:n,behavior:r,destination:t}),s(a);let c=n.map(e=>({ruleValue:e,ruleBehavior:r,source:t})),l=Ee(a,{sandboxAutoAllowEnabled:S.isSandboxingEnabled()&&S.isAutoAllowBashIfSandboxedEnabled()}).filter(e=>n.some(t=>t.toolName===e.rule.ruleValue.toolName&&t.ruleContent===e.rule.ruleValue.ruleContent));e(c,l.length>0?l:void 0)}},[e,t,n,r,o,s]);return(0,G.jsxs)(v,{title:`Add ${r} permission ${B(n.length,`rule`)}`,onCancel:t,color:`permission`,children:[(0,G.jsx)(i,{flexDirection:`column`,paddingX:2,children:n.map(e=>(0,G.jsxs)(i,{flexDirection:`column`,children:[(0,G.jsx)(a,{bold:!0,children:F(e)}),(0,G.jsx)(ke,{ruleValue:e})]},F(e)))}),(0,G.jsxs)(i,{flexDirection:`column`,marginY:1,children:[(0,G.jsx)(a,{children:n.length===1?`Where should this rule be saved?`:`Where should these rules be saved?`}),(0,G.jsx)(H,{options:c,onChange:l})]})]})}var Ne,G,Pe=e((()=>{Ne=t(l(),1),V(),_(),E(),P(),Te(),de(),R(),L(),he(),Ae(),G=y()}));function Fe({onCancel:e,onSubmit:t,ruleBehavior:n}){let[s,c]=(0,Ie.useState)(``),[l,u]=(0,Ie.useState)(0),d=ve();o(`confirm:no`,e,{context:`Settings`});let{columns:f}=g(),p=f-6;return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(i,{flexDirection:`column`,gap:1,borderStyle:`round`,paddingLeft:1,paddingRight:1,borderColor:`permission`,children:[(0,K.jsxs)(a,{bold:!0,color:`permission`,children:[`Add `,n,` permission rule`]}),(0,K.jsxs)(i,{flexDirection:`column`,children:[(0,K.jsxs)(a,{children:[`Permission rules are a tool name, optionally followed by a specifier in parentheses.`,(0,K.jsx)(m,{}),`e.g., `,(0,K.jsx)(a,{bold:!0,children:F({toolName:k.name})}),(0,K.jsx)(a,{bold:!1,children:` or `}),(0,K.jsx)(a,{bold:!0,children:F({toolName:k.name,ruleContent:`ls:*`})})]}),(0,K.jsx)(i,{borderDimColor:!0,borderStyle:`round`,marginY:1,paddingLeft:1,children:(0,K.jsx)(_e,{showCursor:!0,value:s,onChange:c,onSubmit:e=>{let r=e.trim();r.length!==0&&t(N(r),n)},placeholder:`Enter permission rule${r.ellipsis}`,columns:p,cursorOffset:l,onChangeCursorOffset:u})})]})]}),(0,K.jsx)(i,{marginLeft:3,children:d.pending?(0,K.jsxs)(a,{dimColor:!0,children:[`Press `,d.keyName,` again to exit`]}):(0,K.jsx)(a,{dimColor:!0,children:`Enter to submit · Esc to cancel`})})]})}var Ie,K,Le=e((()=>{n(),Ie=t(l(),1),ge(),ye(),fe(),_(),x(),T(),P(),K=y()}));function Re({onHeaderFocusChange:e,onStateChange:t}){let{headerFocused:n,focusHeader:r}=c();(0,q.useEffect)(()=>{e?.(n)},[n,e]);let[o]=(0,q.useState)(()=>De()),[s,l]=(0,q.useState)(()=>new Set),[u,d]=(0,q.useState)(()=>new Set),[p,m]=(0,q.useState)(0);(0,q.useEffect)(()=>{t({approved:s,retry:u,denials:o})},[s,u,o,t]);let h=(0,q.useCallback)(e=>{let t=Number(e);l(e=>{let n=new Set(e);return n.has(t)?n.delete(t):n.add(t),n})},[]),ee=(0,q.useCallback)(e=>{m(Number(e))},[]);if(f((e,t)=>{e===`r`&&(d(e=>{let t=new Set(e);return t.has(p)?t.delete(p):t.add(p),t}),l(e=>{if(e.has(p))return e;let t=new Set(e);return t.add(p),t}))},{isActive:o.length>0}),o.length===0)return(0,J.jsx)(a,{dimColor:!0,children:`No recent denials. Commands denied by the auto mode classifier will appear here.`});let g=o.map((e,t)=>{let n=s.has(t),r=u.has(t)?` (retry)`:``;return{label:(0,J.jsxs)(a,{children:[(0,J.jsx)(ne,{status:n?`success`:`error`,withSpace:!0}),e.display,(0,J.jsx)(a,{dimColor:!0,children:r})]}),value:String(t)}});return(0,J.jsxs)(i,{flexDirection:`column`,children:[(0,J.jsx)(a,{children:`Commands recently denied by the auto mode classifier.`}),(0,J.jsx)(i,{marginTop:1,children:(0,J.jsx)(H,{options:g,onChange:h,onFocus:ee,visibleOptionCount:Math.min(10,g.length),isDisabled:n,onUpFromFirstItem:r})})]})}var q,J,ze=e((()=>{q=t(l(),1),_(),Oe(),V(),J=y()}));function Be({directoryPath:e,onRemove:t,onCancel:n,permissionContext:r,setPermissionContext:o}){let s=(0,Ve.useCallback)(()=>{o(pe(r,{type:`removeDirectories`,directories:[e],destination:`session`})),t()},[e,r,o,t]),c=(0,Ve.useCallback)(e=>{e===`yes`?s():n()},[s,n]);return(0,Y.jsxs)(v,{title:`Remove directory from workspace?`,onCancel:n,color:`error`,children:[(0,Y.jsx)(i,{marginX:2,flexDirection:`column`,children:(0,Y.jsx)(a,{bold:!0,children:e})}),(0,Y.jsx)(a,{children:`Work Mate will no longer have access to files in this directory.`}),(0,Y.jsx)(H,{onChange:c,onCancel:n,options:[{label:`Yes`,value:`yes`},{label:`No`,value:`no`}]})]})}var Ve,Y,He=e((()=>{Ve=t(l(),1),V(),_(),E(),Y=y()}));function Ue({onExit:e,toolPermissionContext:t,onRequestAddDirectory:n,onRequestRemoveDirectory:o,onHeaderFocusChange:s}){let{headerFocused:l,focusHeader:u}=c();(0,X.useEffect)(()=>{s?.(l)},[l,s]);let d=We.useMemo(()=>Array.from(t.additionalWorkingDirectories.keys()).map(e=>({path:e,isCurrent:!1,isDeletable:!0})),[t.additionalWorkingDirectories]),f=(0,X.useCallback)(e=>{if(e===`add-directory`){n();return}let t=d.find(t=>t.path===e);t?.isDeletable&&o(t.path)},[d,n,o]),p=(0,X.useCallback)(()=>e(`Workspace dialog dismissed`,{display:`system`}),[e]),m=We.useMemo(()=>{let e=d.map(e=>({label:e.path,value:e.path}));return e.push({label:`Add directory${r.ellipsis}`,value:`add-directory`}),e},[d]);return(0,Z.jsxs)(i,{flexDirection:`column`,marginBottom:1,children:[(0,Z.jsxs)(i,{flexDirection:`row`,marginTop:1,marginLeft:2,gap:1,children:[(0,Z.jsx)(a,{children:`- ${b()}`}),(0,Z.jsx)(a,{dimColor:!0,children:`(Original working directory)`})]}),(0,Z.jsx)(H,{options:m,onChange:f,onCancel:p,visibleOptionCount:Math.min(10,m.length),onUpFromFirstItem:u,isDisabled:l})]})}var We,X,Z,Ge=e((()=>{n(),We=t(l(),1),X=t(l(),1),ie(),V(),_(),Z=y()}));function Ke({rule:e}){return(0,$.jsx)(a,{dimColor:!0,children:`From ${C(e.source)}`})}function qe(e){switch(e){case`allow`:return`allowed`;case`deny`:return`denied`;case`ask`:return`ask`}}function Je({rule:e,onDelete:t,onCancel:n}){let r=ve();o(`confirm:no`,n,{context:`Confirmation`});let s=(0,$.jsxs)(i,{flexDirection:`column`,marginX:2,children:[(0,$.jsx)(a,{bold:!0,children:F(e.ruleValue)}),(0,$.jsx)(ke,{ruleValue:e.ruleValue}),(0,$.jsx)(Ke,{rule:e})]}),c=(0,$.jsx)(i,{marginLeft:3,children:r.pending?(0,$.jsxs)(a,{dimColor:!0,children:[`Press `,r.keyName,` again to exit`]}):(0,$.jsx)(a,{dimColor:!0,children:`Esc to cancel`})});return e.source===`policySettings`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(i,{flexDirection:`column`,gap:1,borderStyle:`round`,paddingLeft:1,paddingRight:1,borderColor:`permission`,children:[(0,$.jsx)(a,{bold:!0,color:`permission`,children:`Rule details`}),s,(0,$.jsxs)(a,{italic:!0,children:[`This rule is configured by managed settings and cannot be modified.`,`
|
|
2
|
+
`,`Contact your system administrator for more information.`]})]}),c]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(i,{flexDirection:`column`,gap:1,borderStyle:`round`,paddingLeft:1,paddingRight:1,borderColor:`error`,children:[(0,$.jsxs)(a,{bold:!0,color:`error`,children:[`Delete `,qe(e.ruleBehavior),` tool?`]}),s,(0,$.jsx)(a,{children:`Are you sure you want to delete this permission rule?`}),(0,$.jsx)(H,{onChange:e=>e===`yes`?t():n(),onCancel:n,options:[{label:`Yes`,value:`yes`},{label:`No`,value:`no`}]})]}),c]})}function Ye(e){let{options:t,searchQuery:n,isSearchMode:r,isFocused:a,onSelect:o,onCancel:s,lastFocusedRuleKey:l,cursorOffset:u,onHeaderFocusChange:d}=e,f=ee(),{headerFocused:m,focusHeader:h,blurHeader:g}=c();return(0,Q.useEffect)(()=>{r&&m&&g()},[r,m,g]),(0,Q.useEffect)(()=>{d?.(m)},[m,d]),(0,$.jsxs)(i,{flexDirection:`column`,children:[(0,$.jsx)(i,{marginBottom:1,flexDirection:`column`,children:(0,$.jsx)(p,{query:n,isFocused:r&&!m,isTerminalFocused:a,width:f,cursorOffset:u})}),(0,$.jsx)(H,{options:t,onChange:o,onCancel:s,visibleOptionCount:Math.min(10,t.length),isDisabled:r||m,defaultFocusValue:l,onUpFromFirstItem:h})]})}function Xe({tab:e,getRulesOptions:t,handleToolSelect:n,...r}){return(0,$.jsxs)(i,{flexDirection:`column`,flexShrink:e===`allow`?0:void 0,children:[(0,$.jsx)(a,{children:{allow:`Work Mate won't ask before using allowed tools.`,ask:`Work Mate will always ask for confirmation before using these tools.`,deny:`Work Mate will always reject requests to use denied tools.`}[e]}),(0,$.jsx)(Ye,{options:t(e,r.searchQuery).options,onSelect:t=>n(t,e),...r})]})}function Ze({onExit:e,initialTab:t,onRetryDenials:n}){let c=De().length>0,l=t??(c?`recent`:`allow`),[d,f]=(0,Q.useState)([]),p=ae(e=>e.toolPermissionContext),m=oe(),ee=s(),g=(0,Q.useRef)({approved:new Set,retry:new Set,denials:[]}),ne=(0,Q.useCallback)(e=>{g.current=e},[]),[_,v]=(0,Q.useState)(),[y,ie]=(0,Q.useState)(),[b,x]=(0,Q.useState)(null),[S,C]=(0,Q.useState)(null),[w,T]=(0,Q.useState)(!1),[E,D]=(0,Q.useState)(null),[O,k]=(0,Q.useState)(!1),[de,fe]=(0,Q.useState)(!0),A=(0,Q.useCallback)(e=>{fe(e)},[]),M=(0,Q.useMemo)(()=>{let e=new Map;return ce(p).forEach(t=>{e.set(j(t),t)}),e},[p]),N=(0,Q.useMemo)(()=>{let e=new Map;return me(p).forEach(t=>{e.set(j(t),t)}),e},[p]),P=(0,Q.useMemo)(()=>{let e=new Map;return ue(p).forEach(t=>{e.set(j(t),t)}),e},[p]),I=(0,Q.useCallback)((e,t=``)=>{let n=(()=>{switch(e){case`allow`:return M;case`deny`:return N;case`ask`:return P;case`workspace`:case`recent`:return new Map}})(),i=[];e!==`workspace`&&e!==`recent`&&!t&&i.push({label:`Add a new rule${r.ellipsis}`,value:`add-new-rule`});let a=Array.from(n.keys()).sort((e,t)=>{let r=n.get(e),i=n.get(t);if(r&&i){let e=F(r.ruleValue).toLowerCase(),t=F(i.ruleValue).toLowerCase();return e.localeCompare(t)}return 0}),o=t.toLowerCase();for(let e of a){let r=n.get(e);if(r){let n=F(r.ruleValue);if(t&&!n.toLowerCase().includes(o))continue;i.push({label:n,value:e})}}return{options:i,rulesByKey:n}},[M,N,P]),L=ve(),R=!_&&!b&&!S&&!w&&!E,{query:z,setQuery:B,cursorOffset:he}=Ce({isActive:R&&O,onExit:()=>{k(!1)}}),ge=(0,Q.useCallback)(e=>{R&&(O||e.ctrl||e.meta||(e.key===`/`?(e.preventDefault(),k(!0),B(``)):e.key.length===1&&e.key!==`j`&&e.key!==`k`&&e.key!==`m`&&e.key!==`i`&&e.key!==`r`&&e.key!==` `&&(e.preventDefault(),k(!0),B(e.key))))},[R,O,B]),_e=(0,Q.useCallback)((e,t)=>{let{rulesByKey:n}=I(t);if(e===`add-new-rule`){x(t);return}else{v(n.get(e));return}},[I]),ye=(0,Q.useCallback)(()=>{x(null)},[]),V=(0,Q.useCallback)((e,t)=>{C({ruleValue:e,ruleBehavior:t}),x(null)},[]),H=(0,Q.useCallback)((e,t)=>{C(null);for(let t of e)f(e=>[...e,`Added ${t.ruleBehavior} rule ${u.bold(F(t.ruleValue))}`]);if(t&&t.length>0)for(let e of t){let t=e.shadowType===`deny`?`blocked`:`shadowed`;f(n=>[...n,u.yellow(`${r.warning} Warning: ${F(e.rule.ruleValue)} is ${t}`),u.dim(` ${e.reason}`),u.dim(` Fix: ${e.fix}`)])}},[]),be=(0,Q.useCallback)(()=>{C(null)},[]),Se=(0,Q.useCallback)(()=>T(!0),[]),we=(0,Q.useCallback)(e=>D(e),[]),Te=(0,Q.useCallback)(()=>{let t=g.current,r=e=>Array.from(e).map(e=>t.denials[e]).filter(e=>e!==void 0),i=r(t.retry);if(i.length>0){let t=i.map(e=>e.display);n?.(t),e(void 0,{shouldQuery:!0,metaMessages:[`Permission granted for: ${t.join(`, `)}. You may now retry ${t.length===1?`this command`:`these commands`} if you would like.`]});return}let a=r(t.approved);a.length>0||d.length>0?e([...a.length>0?[`Approved ${a.map(e=>u.bold(e.display)).join(`, `)}`]:[],...d].join(`
|
|
3
|
+
`)):e(`Permissions dialog dismissed`,{display:`system`})},[d,e,n]);o(`confirm:no`,Te,{context:`Settings`,isActive:R&&!O});let Ee=()=>{if(!_)return;let{options:e}=I(_.ruleBehavior),t=j(_),n=e.filter(e=>e.value!==`add-new-rule`).map(e=>e.value),r=n.indexOf(t),i;r!==-1&&(r<n.length-1?i=n[r+1]:r>0&&(i=n[r-1])),ie(i),se({rule:_,initialContext:p,setToolPermissionContext(e){m(t=>({...t,toolPermissionContext:e}))}}),f(e=>[...e,`Deleted ${_.ruleBehavior} rule ${u.bold(F(_.ruleValue))}`]),v(void 0)};if(_)return(0,$.jsx)(Je,{rule:_,onDelete:Ee,onCancel:()=>v(void 0)});if(b&&b!==`workspace`&&b!==`recent`)return(0,$.jsx)(Fe,{onCancel:ye,onSubmit:V,ruleBehavior:b});if(S)return(0,$.jsx)(Me,{onAddRules:H,onCancel:be,ruleValues:[S.ruleValue],ruleBehavior:S.ruleBehavior,initialContext:p,setToolPermissionContext:e=>{m(t=>({...t,toolPermissionContext:e}))}});if(w)return(0,$.jsx)(xe,{onAddDirectory:(e,t)=>{let n={type:`addDirectories`,directories:[e],destination:t?`localSettings`:`session`},r=pe(p,n);m(e=>({...e,toolPermissionContext:r})),t&&le(n),f(n=>[...n,`Added directory ${u.bold(e)} to workspace${t?` and saved to local settings`:` for this session`}`]),T(!1)},onCancel:()=>T(!1),permissionContext:p});if(E)return(0,$.jsx)(Be,{directoryPath:E,onRemove:()=>{f(e=>[...e,`Removed directory ${u.bold(E)} from workspace`]),D(null)},onCancel:()=>D(null),permissionContext:p,setPermissionContext:e=>{m(t=>({...t,toolPermissionContext:e}))}});let U={searchQuery:z,isSearchMode:O,isFocused:ee,onCancel:Te,lastFocusedRuleKey:y,cursorOffset:he,getRulesOptions:I,handleToolSelect:_e,onHeaderFocusChange:A};return(0,$.jsx)(i,{flexDirection:`column`,onKeyDown:ge,children:(0,$.jsxs)(re,{color:`permission`,children:[(0,$.jsxs)(te,{title:`Permissions:`,color:`permission`,defaultTab:l,hidden:!!_||!!b||!!S||w||!!E,initialHeaderFocused:!c,navFromContent:!O,children:[(0,$.jsx)(h,{id:`recent`,title:`Recently denied`,children:(0,$.jsx)(Re,{onHeaderFocusChange:A,onStateChange:ne})}),(0,$.jsx)(h,{id:`allow`,title:`Allow`,children:(0,$.jsx)(Xe,{tab:`allow`,...U})}),(0,$.jsx)(h,{id:`ask`,title:`Ask`,children:(0,$.jsx)(Xe,{tab:`ask`,...U})}),(0,$.jsx)(h,{id:`deny`,title:`Deny`,children:(0,$.jsx)(Xe,{tab:`deny`,...U})}),(0,$.jsx)(h,{id:`workspace`,title:`Workspace`,children:(0,$.jsxs)(i,{flexDirection:`column`,children:[(0,$.jsx)(a,{children:`Work Mate can read files in the workspace, and make edits when auto-accept edits is on.`}),(0,$.jsx)(Ue,{onExit:e,toolPermissionContext:p,onRequestAddDirectory:Se,onRequestRemoveDirectory:we,onHeaderFocusChange:A})]})})]}),(0,$.jsx)(i,{marginTop:1,paddingLeft:1,children:(0,$.jsx)(a,{dimColor:!0,children:L.pending?(0,$.jsxs)($.Fragment,{children:[`Press `,L.keyName,` again to exit`]}):de?(0,$.jsx)($.Fragment,{children:`←/→ tab switch · ↓ return · Esc cancel`}):O?(0,$.jsx)($.Fragment,{children:`Type to filter · Enter/↓ select · ↑ tabs · Esc clear`}):c&&l===`recent`?(0,$.jsx)($.Fragment,{children:`Enter approve · r retry · ↑↓ navigate · ←/→ switch · Esc cancel`}):(0,$.jsx)($.Fragment,{children:`↑↓ navigate · Enter select · Type to search · ←/→ switch · Esc cancel`})})})]})})}var Q,$,Qe=e((()=>{d(),n(),Q=t(l(),1),A(),E(),V(),ye(),we(),_(),x(),Oe(),P(),D(),M(),Se(),Pe(),be(),Ae(),Le(),ze(),He(),Ge(),$=y()})),$e,et;e((()=>{Qe(),w(),$e=y(),et=async(e,t)=>(0,$e.jsx)(Ze,{onExit:e,onRetryDenials:e=>{t.setMessages(t=>[...t,O(e)])}})}))();export{et as call};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{n as t,t as n}from"./memoize-BK3gG5ob.js";import{c as r,i,l as a,o}from"./envUtils-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};
|
|
@@ -0,0 +1 @@
|
|
|
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};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{n as t,t as n}from"./memoize-BK3gG5ob.js";import{f as r,u as i}from"./debug-CRnGsZOV.js";import{o as a,s as o}from"./log-DoSpAwRP.js";import{release as s}from"os";import{readFile as c}from"fs/promises";var l,u,d,f=e((()=>{n(),r(),a(),l=[`macos`,`wsl`],u=t(()=>{try{if(process.platform===`darwin`)return`macos`;if(process.platform===`win32`)return`windows`;if(process.platform===`linux`){try{let e=i().readFileSync(`/proc/version`,{encoding:`utf8`});if(e.toLowerCase().includes(`microsoft`)||e.toLowerCase().includes(`wsl`))return`wsl`}catch(e){o(e)}return`linux`}return`unknown`}catch(e){return o(e),`unknown`}}),d=t(()=>{if(process.platform===`linux`)try{let e=i().readFileSync(`/proc/version`,{encoding:`utf8`}),t=e.match(/WSL(\d+)/i);return t?.[1]?t[1]:e.toLowerCase().includes(`microsoft`)?`1`:void 0}catch(e){o(e);return}}),t(async()=>{if(process.platform!==`linux`)return;let e={linuxKernel:s()};try{let t=await c(`/etc/os-release`,`utf8`);for(let n of t.split(`
|
|
2
|
+
`)){let t=n.match(/^(ID|VERSION_ID)=(.*)$/);if(t?.[1]&&t[2]){let n=t[2].replace(/^"|"$/g,``);t[1]===`ID`?e.linuxDistroId=n:e.linuxDistroVersion=n}}}catch{}return e})}));export{f as i,u as n,d as r,l as t};
|