@readmagic/workmate 0.0.7 → 0.0.8
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-CwLtQld4.js +1 -0
- package/dist/chunks/App-Ba52HvYC.js +1 -0
- package/dist/chunks/{ApproveApiKey-B2HJUD7h.js → ApproveApiKey-CEIfuUh0.js} +1 -1
- package/dist/chunks/ApproveApiKey-D2MLQu2P.js +1 -0
- package/dist/chunks/BackgroundTasksDialog-IGDrkbWl.js +2 -0
- package/dist/chunks/{BypassPermissionsModeDialog-DllL8dxU.js → BypassPermissionsModeDialog-GYhq--JR.js} +1 -1
- package/dist/chunks/{ClaudeMdExternalIncludesDialog-BZSyRqeq.js → ClaudeMdExternalIncludesDialog-C-CTa-95.js} +1 -1
- package/dist/chunks/ClaudeMdExternalIncludesDialog-Catv6BCJ.js +1 -0
- package/dist/chunks/ConsoleOAuthFlow-BeQXqUtX.js +1 -0
- package/dist/chunks/{DiffDialog-B7hx8i_Y.js → DiffDialog-AC5DSJrq.js} +6 -6
- package/dist/chunks/Doctor-B9Rxsoy0.js +1 -0
- package/dist/chunks/Doctor-lhUBhEy5.js +3 -0
- package/dist/chunks/ExitFlow-Cu8SoQHs.js +2 -0
- package/dist/chunks/Grove-Bc4CofEj.js +11 -0
- package/dist/chunks/{HybridTransport-rK83Qijz.js → HybridTransport-BJPOG2wl.js} +3 -3
- package/dist/chunks/{InvalidConfigDialog-DdO0AxyF.js → InvalidConfigDialog-BI13il58.js} +1 -1
- package/dist/chunks/{InvalidSettingsDialog-s1G0DwXF.js → InvalidSettingsDialog-CtOheV1K.js} +1 -1
- package/dist/chunks/MCPConnectionManager-ao-P3xSA.js +1 -0
- package/dist/chunks/MCPToolListView-dkofcJs4.js +1 -0
- package/dist/chunks/{McpParsingWarnings-Du5IxZos.js → McpParsingWarnings-BS4JoR5l.js} +1 -1
- package/dist/chunks/MessageSelector-B88b2ypw.js +3 -0
- package/dist/chunks/Messages-BPeI7lLV.js +11 -0
- package/dist/chunks/Onboarding-c2fQ8Io_.js +1 -0
- package/dist/chunks/{PromptInputFooterSuggestions-BmsFdOu9.js → PromptInputFooterSuggestions-D1cH9sDX.js} +1 -1
- package/dist/chunks/{PromptInputHelpMenu-DX-0wEDo.js → PromptInputHelpMenu-DDD5WuK0.js} +1 -1
- package/dist/chunks/QueryEngine-Cv_meCam.js +1 -0
- package/dist/chunks/REPL-BXhAQOXb.js +139 -0
- package/dist/chunks/REPL-YqjLnr3A.js +1 -0
- package/dist/chunks/RemoteSessionManager-CT7T8BaR.js +2 -0
- package/dist/chunks/ResumeConversation-CIZCjms9.js +1 -0
- package/dist/chunks/{SSETransport-5VK5okFv.js → SSETransport-CrwbKuVt.js} +3 -3
- package/dist/chunks/SearchExtraToolsTool-Dx6093yw.js +1 -0
- package/dist/chunks/Settings-CyUm0AtU.js +2 -0
- package/dist/chunks/{TeleportProgress-DxN0bQL2.js → TeleportProgress-C3qyp5zy.js} +1 -1
- package/dist/chunks/TeleportRepoMismatchDialog-BV--nyYn.js +1 -0
- package/dist/chunks/TeleportResumeWrapper-Blo2cZg-.js +1 -0
- package/dist/chunks/ThemePicker-EQ6hPUeI.js +1 -0
- package/dist/chunks/TrustDialog-BukWGvHZ.js +1 -0
- package/dist/chunks/{ValidationErrorsList-BYsDtAvX.js → ValidationErrorsList-DokTJQwi.js} +1 -1
- package/dist/chunks/{WelcomeV2-C1BfrqC5.js → WelcomeV2-Ci9VwPYh.js} +1 -1
- package/dist/chunks/{add-dir-DfLYgwox.js → add-dir-DPQV0qml.js} +1 -1
- package/dist/chunks/{agentDisplay-CMmHIl86.js → agentDisplay-DBQYOaOh.js} +1 -1
- package/dist/chunks/agents-DmybpgDN.js +103 -0
- package/dist/chunks/{agents-DE_4mAHG.js → agents-HlKk68Qc.js} +1 -1
- package/dist/chunks/allErrors-BPn_2TrB.js +1 -0
- package/dist/chunks/analytics-CkYUHW_U.js +1 -0
- package/dist/chunks/ant-DjdvlLOo.js +1 -0
- package/dist/chunks/api-AMgj1zf_.js +1 -0
- package/dist/chunks/api-CF5IVtj0.js +1 -0
- package/dist/chunks/{asciicast-CbAjUHT_.js → asciicast-BJNYO5sh.js} +1 -1
- package/dist/chunks/asciicast-CH6hdK0a.js +1 -0
- package/dist/chunks/auth-CNjDn1VY.js +15 -0
- package/dist/chunks/auth-CZzP483s.js +1 -0
- package/dist/chunks/auth-DDSBm_Yj.js +1 -0
- package/dist/chunks/{autoMode-ZW70mpr0.js → autoMode-Cr0AhS1G.js} +5 -5
- package/dist/chunks/{autonomy-CwbWsCnv.js → autonomy-ARUQt-Lu.js} +1 -1
- package/dist/chunks/{autonomy-Oui8yK8G.js → autonomy-D4xZLOdJ.js} +7 -7
- package/dist/chunks/{autonomyPanel-Mq50H7iM.js → autonomyPanel-BQK9MoeB.js} +1 -1
- package/dist/chunks/backgroundHousekeeping--eBgphcg.js +17 -0
- package/dist/chunks/backgroundHousekeeping-VV1V_Y2Z.js +1 -0
- package/dist/chunks/{banner-CWkrK10u.js → banner-Ca7rki2V.js} +2 -2
- package/dist/chunks/bg-BK_9J6F6.js +1 -0
- package/dist/chunks/{bg-WnYN5ifx.js → bg-DxRHF1yn.js} +2 -2
- package/dist/chunks/{branch-DU5O9KZ0.js → branch-BYq0zpzT.js} +1 -1
- package/dist/chunks/{break-cache-C_p7Kmx2.js → break-cache-BKvoMOZx.js} +2 -2
- package/dist/chunks/bridgeConfig-C82un7rJ.js +1 -0
- package/dist/chunks/{bridgeConfig-CE6dMsiJ.js → bridgeConfig-jDEva6Eh.js} +1 -1
- package/dist/chunks/bridgeMessaging-YqYdl6ej.js +1 -0
- package/dist/chunks/bridgePointer-DIM0sj0x.js +1 -0
- package/dist/chunks/btw-CUV3nRrE.js +1 -0
- package/dist/chunks/caches-BZ59_En6.js +1 -0
- package/dist/chunks/caches-Cg-HtWKG.js +1 -0
- package/dist/chunks/capacityWake-CKOiRELo.js +3 -0
- package/dist/chunks/ccrClient-BC2q3k44.js +1 -0
- package/dist/chunks/{claudeDesktop-Fe-QL-sN.js → claudeDesktop-DQXL5bGm.js} +1 -1
- package/dist/chunks/{clear-D8m2utXW.js → clear-1etSJhdg.js} +1 -1
- package/dist/chunks/{cliLaunch-BkPAatcs.js → cliLaunch-CQjLYRzM.js} +1 -1
- package/dist/chunks/client-DQXvVKND.js +1 -0
- package/dist/chunks/{client-C6MbjvOB.js → client-DQwf_b9o.js} +1 -1
- package/dist/chunks/client-DkgC-mFB.js +1 -0
- package/dist/chunks/{color-DWhgZH7A.js → color-CBsNbt1s.js} +1 -1
- package/dist/chunks/commands-qM5z_Uld.js +1 -0
- package/dist/chunks/compact-BclJiRJe.js +2 -0
- package/dist/chunks/completionCache-BMHAktkM.js +1 -0
- package/dist/chunks/config-CE058cvr.js +3 -0
- package/dist/chunks/config-D81avYye.js +1 -0
- package/dist/chunks/config-DpOOllGk.js +1 -0
- package/dist/chunks/context-noninteractive-Ct_ttQfP.js +29 -0
- package/dist/chunks/context-noninteractive-DJb8H_hN.js +1 -0
- package/dist/chunks/context-sR9fJmXE.js +1 -0
- package/dist/chunks/conversation-D48Kt3ar.js +1 -0
- package/dist/chunks/conversation-fOFTa7k5.js +1 -0
- package/dist/chunks/{createSSHSession-BOdTAX3N.js → createSSHSession-BmHXA2me.js} +1 -1
- package/dist/chunks/createSession-C4rukWkv.js +1 -0
- package/dist/chunks/createSession-CSwlW2T2.js +1 -0
- package/dist/chunks/crossProjectResume-lDFB2ZcY.js +40 -0
- package/dist/chunks/cwd-5Xr-Qka6.js +1 -0
- package/dist/chunks/cwd-C5ce-7WB.js +1 -0
- package/dist/chunks/{daemon-YtZbMQtn.js → daemon-ZtpTZWgQ.js} +1 -1
- package/dist/chunks/{datadog-DqHxqiwY.js → datadog-BJn5ECIu.js} +1 -1
- package/dist/chunks/{debug-BrXObCdR.js → debug-RZ4NuXyS.js} +1 -1
- package/dist/chunks/debugUtils-D30M1cbN.js +1 -0
- package/dist/chunks/{detached-TYk4hMFj.js → detached-jrVP11oU.js} +1 -1
- package/dist/chunks/{detectRepository-BPr0VWNO.js → detectRepository-CFiHe6Rv.js} +1 -1
- package/dist/chunks/detectRepository-DqQvyj_a.js +1 -0
- package/dist/chunks/{diff-CJEKvOA5.js → diff-BKiK3xHv.js} +1 -1
- package/dist/chunks/directoryCompletion-BagQcynj.js +1 -0
- package/dist/chunks/doctor-BEHYm34V.js +1 -0
- package/dist/chunks/{entry-DE0uMIf0.js → entry-BzL1MFQG.js} +4 -4
- package/dist/chunks/esm-BLPbfHQd.js +1 -0
- package/dist/chunks/{execFileNoThrow-D244NytW.js → execFileNoThrow-CCX-JY8h.js} +1 -1
- package/dist/chunks/{execSyncWrapper-CCMQShK-.js → execSyncWrapper-dhRSYGFW.js} +1 -1
- package/dist/chunks/exit-DE2YiAhQ.js +1 -0
- package/dist/chunks/{lazySchema-DULtBUCI.js → external-CEp-aPkt.js} +1 -1
- package/dist/chunks/extraUsage-Dw7AXiH7.js +1 -0
- package/dist/chunks/extractMemories-DxTUMiv3.js +1 -0
- package/dist/chunks/fast-CHmMkIpE.js +1 -0
- package/dist/chunks/fast-uQASHWqR.js +1 -0
- package/dist/chunks/fileSuggestions-Dyu2kQtE.js +3 -0
- package/dist/chunks/firstPartyEventLogger-D5ohKbIe.js +5 -0
- package/dist/chunks/firstPartyEventLogger-LsNY6yOt.js +1 -0
- package/dist/chunks/flushGate-Cnsu4HET.js +1 -0
- package/dist/chunks/gemini-Cudre91e.js +1 -0
- package/dist/chunks/generateRecap-CiFxXlmH.js +1 -0
- package/dist/chunks/generateSessionName-DitoBxJT.js +1 -0
- package/dist/chunks/{genericProcessUtils-CdQTApYX.js → genericProcessUtils-DVfMHhfy.js} +1 -1
- package/dist/chunks/git-BerW9bId.js +6 -0
- package/dist/chunks/git-D6dOU2mT.js +1 -0
- package/dist/chunks/githubRepoPathMapping-DGr0kJ8D.js +1 -0
- package/dist/chunks/{goal-B4GsR54_.js → goal-DuUayfDg.js} +3 -3
- package/dist/chunks/grok-tRbmZzEh.js +1 -0
- package/dist/chunks/grove-Cv19v6Sv.js +7 -0
- package/dist/chunks/help-DkqxbFDM.js +1 -0
- package/dist/chunks/{hooks-CkA9bhHl.js → hooks-BZJTWD07.js} +2 -2
- package/dist/chunks/hooks-CsP42iOp.js +1 -0
- package/dist/chunks/initReplBridge-DdsSWVqN.js +1 -0
- package/dist/chunks/{install-Dzlm4u58.js → install-BI---dv0.js} +1 -1
- package/dist/chunks/{instrumentation-Yt31gxWN.js → instrumentation-CcWzhGfE.js} +4 -4
- package/dist/chunks/{job-BXujwZNa.js → job-B0ftcqPF.js} +1 -1
- package/dist/chunks/{jwtUtils-DE2GPUcx.js → jwtUtils-C0cE-1Ey.js} +1 -1
- package/dist/chunks/keybindings-DZU3vwo3.js +2 -0
- package/dist/chunks/language-DHhXLb_Y.js +1 -0
- package/dist/chunks/{language-Ca4B018X.js → language-s-dLbdVz.js} +1 -1
- package/dist/chunks/launchLocalMemory-twLxpPvg.js +3 -0
- package/dist/chunks/{launchOnboarding-gOVAFEFp.js → launchOnboarding-BWz2XSb9.js} +1 -1
- package/dist/chunks/lazySchema-B4D4qJVE.js +1 -0
- package/dist/chunks/{loadAgentsDir-x3rlgED4.js → loadAgentsDir-ByO8eJqU.js} +1710 -1977
- package/dist/chunks/loadAgentsDir-CMNFLt7R.js +1 -0
- package/dist/chunks/loadPluginHooks-BPnxcgrL.js +1 -0
- package/dist/chunks/{localSearch-DtplGF-l.js → localSearch-CHHCH16D.js} +1 -1
- package/dist/chunks/localSearch-DzQODFap.js +1 -0
- package/dist/chunks/log-CZ0zYP_c.js +1 -0
- package/dist/chunks/logoV2Utils-CGUJ-5gY.js +1 -0
- package/dist/chunks/{magicDocs-qdDB_mKb.js → magicDocs-C5i5ruuU.js} +3 -3
- package/dist/chunks/{main-D862LI_d.js → main-BLD4QAQg.js} +2 -2
- package/dist/chunks/{main-OWFSddRx.js → main-D4Uk-WUs.js} +87 -84
- package/dist/chunks/{managedEnv-Aq5BXfY7.js → managedEnv-C-9XSN14.js} +1 -1
- package/dist/chunks/managedEnv-DLVRBaA9.js +1 -0
- package/dist/chunks/{mappers-04gNXJ3w.js → mappers-CHRFic5q.js} +1 -1
- package/dist/chunks/mcp-BMVdGknC.js +1 -0
- package/dist/chunks/mcp-COS5RJFS.js +6 -0
- package/dist/chunks/mcp-tGsOW1GN.js +2 -0
- package/dist/chunks/memoize-B8hfb1JN.js +1 -0
- package/dist/chunks/memory-DR6poqeH.js +1 -0
- package/dist/chunks/{mode-DY087x_x.js → mode-QV-NW1Wd.js} +2 -2
- package/dist/chunks/model-BF_4ebyl.js +1 -0
- package/dist/chunks/{model-D0EfJBuw.js → model-BNU_ulDJ.js} +1 -1
- package/dist/chunks/model-CwO-g1RW.js +1 -0
- package/dist/chunks/nativeInstaller-B-lNJjM-.js +1 -0
- package/dist/chunks/observationStore-BpjlK0pG.js +3 -0
- package/dist/chunks/omit-DZCEXri5.js +1 -0
- package/dist/chunks/onChangeAppState-BmfM5g-D.js +1 -0
- package/dist/chunks/{openai-EYRnUsco.js → openai-DPH6rXOZ.js} +3 -3
- package/dist/chunks/{panel-BSZGX6jN.js → panel-mD094ALT.js} +1 -1
- package/dist/chunks/{panelCall-dMvRPAGE.js → panelCall-SbffM7G4.js} +1 -1
- package/dist/chunks/parser-DrBC8nWp.js +1 -0
- package/dist/chunks/{parser-DFwaTGf7.js → parser-dbHRgXb8.js} +1 -1
- package/dist/chunks/partition-DKuAFJkc.js +1 -0
- package/dist/chunks/{path-D5U-tm91.js → path-Cv9QMBAX.js} +1 -1
- package/dist/chunks/permissions-ey-bfanE.js +3 -0
- package/dist/chunks/{pidLock-CbC_il6r.js → pidLock-DJnS_38v.js} +2 -2
- package/dist/chunks/{pipeTransport-CqCnc-Ys.js → pipeTransport-DVOKR4c_.js} +1 -1
- package/dist/chunks/{plan-rsb_83Fo.js → plan-Brg9XnRr.js} +1 -1
- package/dist/chunks/{platform-BrYefG_2.js → platform-DCXXznJg.js} +1 -1
- package/dist/chunks/plugin-CRwa39Y1.js +17 -0
- package/dist/chunks/{pluginAutoupdate-0k03PVff.js → pluginAutoupdate-D0LIP7cy.js} +1 -1
- package/dist/chunks/pluginBlocklist-PwHHD3nj.js +1 -0
- package/dist/chunks/pluginCliCommands-BJM5Bdpf.js +1 -0
- package/dist/chunks/pluginFlagging-pBxSselw.js +1 -0
- package/dist/chunks/pluginOperations-C7p_Qr2r.js +2 -0
- package/dist/chunks/pluginStartupCheck-C0HqhG6D.js +1 -0
- package/dist/chunks/pluginStartupCheck-Di4LjHXf.js +1 -0
- package/dist/chunks/{plugins-CQNKZmjP.js → plugins-DUKNjLq6.js} +4 -4
- package/dist/chunks/pollConfig-BgpfHQPJ.js +1 -0
- package/dist/chunks/{poorMode-CBOtooa0.js → poorMode-CYXmr_mU.js} +1 -1
- package/dist/chunks/poorMode-CejPNCp-.js +1 -0
- package/dist/chunks/print-gyTOCJzk.js +23 -0
- package/dist/chunks/processBashCommand-Cze9vCm6.js +1 -0
- package/dist/chunks/processSlashCommand-BRajh1v7.js +5 -0
- package/dist/chunks/prompt-B7joRiqj.js +139 -0
- package/dist/chunks/prompt-DqSMh2x9.js +1 -0
- package/dist/chunks/prompt-Eysh8Et_.js +1 -0
- package/dist/chunks/{promptEditor-CyTzyjwG.js → promptEditor-R_acDAgI.js} +2 -2
- package/dist/chunks/{protocolHandler-JR8pASdH.js → protocolHandler-RNKkhq91.js} +1 -1
- package/dist/chunks/{proxy-CRN7jYIi.js → proxy-BmtEnJ02.js} +1 -1
- package/dist/chunks/rcDebugLog-CARUIORE.js +1 -0
- package/dist/chunks/reconciler-BfkO6X2X.js +4 -0
- package/dist/chunks/refresh-C1X3sptR.js +1 -0
- package/dist/chunks/registerProtocol-DoKqmqu2.js +36 -0
- package/dist/chunks/{reload-plugins-B9ApSp2m.js → reload-plugins-C0osFcNh.js} +1 -1
- package/dist/chunks/remoteBridgeCore-Cddqv2WW.js +1 -0
- package/dist/chunks/remoteManagedSettings-B1mnRDmA.js +1 -0
- package/dist/chunks/rename-B3tf-YiD.js +1 -0
- package/dist/chunks/{renderOptions-BUJB9nAm.js → renderOptions-ChLwxtVu.js} +1 -1
- package/dist/chunks/replBridgeHandle-CNwNIijW.js +1 -0
- package/dist/chunks/{resume-BicEjsPd.js → resume-Be1G_GBL.js} +2 -2
- package/dist/chunks/ripgrep-C2PhTJDh.js +1 -0
- package/dist/chunks/{ripgrep-BXmXjAzA.js → ripgrep-gaT9Njwi.js} +1 -1
- package/dist/chunks/{runtimeObserver-CiwnPFjK.js → runtimeObserver-CsIwinzh.js} +1 -1
- package/dist/chunks/runtimeObserver-Dbxxw4ls.js +10 -0
- package/dist/chunks/sandbox-adapter-C6GBuJPB.js +1 -0
- package/dist/chunks/sandbox-toggle-jEySONTW.js +1 -0
- package/dist/chunks/searchExtraTools-C_UTryh_.js +1 -0
- package/dist/chunks/session-DDI1Eb2x.js +2 -0
- package/dist/chunks/sessionFileAccessHooks-DfJ7Htfl.js +1 -0
- package/dist/chunks/sessionIdCompat-DMayYBrf.js +1 -0
- package/dist/chunks/sessionMemory-CQBxPkTQ.js +1 -0
- package/dist/chunks/sessionMemory-s0ALUHvc.js +1 -0
- package/dist/chunks/sessionMemoryUtils-xt7dTHGC.js +1 -0
- package/dist/chunks/sessionObserver-C2sYqWL3.js +1 -0
- package/dist/chunks/sessionObserver-DoYc0ZOP.js +20 -0
- package/dist/chunks/sessionState-CjNY991n.js +11 -0
- package/dist/chunks/sessionStorage-DqsY-7pi.js +1 -0
- package/dist/chunks/{sessionTitle-DAnM73S0.js → sessionTitle-B0OYf5nM.js} +3 -3
- package/dist/chunks/sessionTracing-CwsXt_uA.js +11 -0
- package/dist/chunks/settings-BWtOA9A7.js +1 -0
- package/dist/chunks/settings-hQDLwPVj.js +20 -0
- package/dist/chunks/settingsSync-DdFagwHV.js +1 -0
- package/dist/chunks/setup-DzC22EkN.js +3 -0
- package/dist/chunks/{shadowedRuleDetection-C6R5zOUe.js → shadowedRuleDetection-C86PTj1m.js} +1 -1
- package/dist/chunks/{shellQuote-DkSy9MYE.js → shellQuote-BUVKMu_P.js} +1 -1
- package/dist/chunks/{sideQuestion-hUhxls9r.js → sideQuestion-C780iYwd.js} +3 -3
- package/dist/chunks/sinks-5G_xhc1Q.js +1 -0
- package/dist/chunks/{sinks-BuE17DeZ.js → sinks-Cftq7Es0.js} +2 -2
- package/dist/chunks/skillChangeDetector-plLveEbf.js +1 -0
- package/dist/chunks/skillGapStore-Dc1arohs.js +5 -0
- package/dist/chunks/skillLifecycle-DP6mY1Kp.js +8 -0
- package/dist/chunks/{skillSearchPanel-Cll9ccA5.js → skillSearchPanel-CpLTImaL.js} +4 -4
- package/dist/chunks/{skills-BPPeYBy7.js → skills-zGYaYfFV.js} +1 -1
- package/dist/chunks/{src-D06Xyj4g.js → src-BN7QRYLl.js} +1 -1
- package/dist/chunks/startupProfiler-DCn_NxMH.js +3 -0
- package/dist/chunks/startupProfiler-JbpAkfNE.js +1 -0
- package/dist/chunks/{state-ix0xIunV.js → state-C2OSZkV1.js} +1 -1
- package/dist/chunks/state-DU9lRJ9x.js +1 -0
- package/dist/chunks/{stats-CqfF4Axp.js → stats-Duk7_xjQ.js} +1 -1
- package/dist/chunks/{status-D4IQpsNK.js → status-CFw-FpZM.js} +2 -2
- package/dist/chunks/{status-CC9Q-2Yn.js → status-peiVB_2j.js} +1 -1
- package/dist/chunks/statusNoticeHelpers-B5U5c9PE.js +1 -0
- package/dist/chunks/{stringUtils-DGLPkqJ4.js → stringUtils-B6FudhoZ.js} +1 -1
- package/dist/chunks/switcher-BAMqSX7Z.js +1 -0
- package/dist/chunks/switcher-hgBgVzLb.js +1 -0
- package/dist/chunks/syncCache-Zl9kZRRl.js +1 -0
- package/dist/chunks/{tasks-CZvWJYGr.js → tasks-BxpyRhmD.js} +1 -1
- package/dist/chunks/teleport-CwxeD5vL.js +1 -0
- package/dist/chunks/{templateJobs-D1BdhZsv.js → templateJobs-DR5fKFiO.js} +1 -1
- package/dist/chunks/{terminalSetup-Cn6jeYw1.js → terminalSetup-DgRBt-JJ.js} +1 -1
- package/dist/chunks/terminalSetup-DlaFWI81.js +33 -0
- package/dist/chunks/{theme-Cg4GNOoQ.js → theme-Bz6esfST.js} +1 -1
- package/dist/chunks/{tmux-BY7IdQ1f.js → tmux-DSU9tYIo.js} +1 -1
- package/dist/chunks/{toolEventObserver-SFwURL5F.js → toolEventObserver-BSekCkM2.js} +1 -1
- package/dist/chunks/toolPool-B7SIoDw5.js +1 -0
- package/dist/chunks/{trustedDevice-CKedohmT.js → trustedDevice-B0x9X0fb.js} +1 -1
- package/dist/chunks/trustedDevice-CjHQtVkO.js +1 -0
- package/dist/chunks/{types-Dut4311z.js → types-D7_37tP2.js} +2 -2
- package/dist/chunks/{udsClient-BuCtv7dN.js → udsClient-CHoMMH28.js} +1 -1
- package/dist/chunks/{up-BHkC97_C.js → up-B8wBSpLg.js} +1 -1
- package/dist/chunks/{updateCCB-C2G-U-qA.js → updateCCB-D_kGQKPT.js} +1 -1
- package/dist/chunks/{upstreamproxy-DyR_eXO8.js → upstreamproxy-Hmq-n8fw.js} +1 -1
- package/dist/chunks/useExitOnCtrlCDWithKeybindings-Cce612uS.js +1 -0
- package/dist/chunks/useMainLoopModel-BICP6_Fi.js +1 -0
- package/dist/chunks/useManagePlugins-DtbY_vPL.js +1 -0
- package/dist/chunks/useMergedTools-Ckx2IEhF.js +1 -0
- package/dist/chunks/{useSearchInput-C5OzQnX6.js → useSearchInput-BAgljZUl.js} +1 -1
- package/dist/chunks/useSettingsErrors-CAJR_wpd.js +1 -0
- package/dist/chunks/userAgent-BxTG7IMk.js +1 -0
- package/dist/chunks/{util-8EHwfg4A.js → util-DDtmyq_r.js} +1 -1
- package/dist/chunks/validatePlugin-AHl-g4ct.js +1 -0
- package/dist/chunks/{vim-CNDzwoTd.js → vim-kg-mRVbu.js} +1 -1
- package/dist/chunks/{which-CKQnSouy.js → which-CHLNJmtJ.js} +1 -1
- package/dist/chunks/windowsPaths-Pmx8LDR6.js +1 -0
- package/dist/chunks/{windowsPaths-DtapVxOo.js → windowsPaths-o62uq6LF.js} +1 -1
- package/dist/chunks/{workSecret-CNWiR2uQ.js → workSecret-DG9shvG0.js} +1 -1
- package/dist/chunks/workerRegistry-C7H_lsQX.js +6 -0
- package/dist/chunks/worktree-O2p-mJdF.js +1 -0
- package/dist/cli.js +1 -1
- package/package.json +1 -1
- package/dist/chunks/AddWorkspaceDirectory-CFrrXnt9.js +0 -1
- package/dist/chunks/App-Buad9Llp.js +0 -1
- package/dist/chunks/ApproveApiKey-BQbHdvc3.js +0 -1
- package/dist/chunks/AssistantSessionChooser-4lm4eXQ8.js +0 -1
- package/dist/chunks/BackgroundTasksDialog-D4qA0M5O.js +0 -2
- package/dist/chunks/ClaudeMdExternalIncludesDialog--ywODh81.js +0 -1
- package/dist/chunks/ConsoleOAuthFlow-Wkfw7Ts-.js +0 -1
- package/dist/chunks/DesktopHandoff-DaP4Riar.js +0 -1
- package/dist/chunks/Dialog-vfLXEPed.js +0 -1
- package/dist/chunks/Doctor-89OgoAUA.js +0 -1
- package/dist/chunks/Doctor-CuKJ-nGt.js +0 -3
- package/dist/chunks/ExitFlow-DnPydE17.js +0 -2
- package/dist/chunks/Feedback-SmGiR3mf.js +0 -2
- package/dist/chunks/Grove-CjN9DO47.js +0 -11
- package/dist/chunks/Grove-Cq88VBmM.js +0 -1
- package/dist/chunks/ListItem-vfLXEPed.js +0 -1
- package/dist/chunks/MCPConnectionManager-NRfIjdlj.js +0 -1
- package/dist/chunks/MessageSelector-iIroHvXo.js +0 -3
- package/dist/chunks/Messages-D4Hm4gaY.js +0 -11
- package/dist/chunks/Onboarding-BiZByBK-.js +0 -1
- package/dist/chunks/OverageCreditUpsell-BM7szLgm.js +0 -1
- package/dist/chunks/PluginSettings-uY5KTCtK.js +0 -17
- package/dist/chunks/QueryEngine-CGYaShXD.js +0 -1
- package/dist/chunks/REPL-CRJB2t2z.js +0 -142
- package/dist/chunks/REPL-u4Yq29Du.js +0 -1
- package/dist/chunks/RemoteCallout-B-tyvQOe.js +0 -1
- package/dist/chunks/RemoteSessionManager-DCd0O5_l.js +0 -2
- package/dist/chunks/ResumeConversation-DAAXlOCd.js +0 -1
- package/dist/chunks/SearchExtraToolsTool-B-7Bworf.js +0 -1
- package/dist/chunks/Settings-CUjWlncb.js +0 -2
- package/dist/chunks/TeleportRepoMismatchDialog-A5Ss0kuk.js +0 -1
- package/dist/chunks/TeleportResumeWrapper-Bz14mUqR.js +0 -1
- package/dist/chunks/ThemePicker-CVSRqTzW.js +0 -1
- package/dist/chunks/TrustDialog-CY8an_Tg.js +0 -1
- package/dist/chunks/TungstenTool-Cb7gJvq4.js +0 -1
- package/dist/chunks/TungstenTool-CxMQVCuF.js +0 -1
- package/dist/chunks/agents-DJtPfvnL.js +0 -103
- package/dist/chunks/allErrors-CQE2k0zO.js +0 -1
- package/dist/chunks/analytics-BotDBGh0.js +0 -1
- package/dist/chunks/ant-ClQkuQjZ.js +0 -1
- package/dist/chunks/api-2cdIPaeq.js +0 -1
- package/dist/chunks/api-CG-lhKe-.js +0 -1
- package/dist/chunks/asciicast-BsWpcxrc.js +0 -1
- package/dist/chunks/assistant-Bje16tQx.js +0 -1
- package/dist/chunks/assistant-C83quuNj.js +0 -1
- package/dist/chunks/assistant-z2o4-UJe.js +0 -1
- package/dist/chunks/auth-DMfEiQrC.js +0 -1
- package/dist/chunks/auth-D_cGl8WD.js +0 -1
- package/dist/chunks/auth-DqcKPbw8.js +0 -15
- package/dist/chunks/backgroundHousekeeping-BpLtI45r.js +0 -1
- package/dist/chunks/backgroundHousekeeping-DtJNx4Ja.js +0 -17
- package/dist/chunks/bg-B0iMGM9C.js +0 -1
- package/dist/chunks/bridge-DNNxtPlz.js +0 -2
- package/dist/chunks/bridgeConfig-DP9dD1Cv.js +0 -1
- package/dist/chunks/bridgeEnabled-Cc0mGlTb.js +0 -1
- package/dist/chunks/bridgeEnabled-D8wP3DWQ.js +0 -1
- package/dist/chunks/bridgeMain-CwxMa_pd.js +0 -1
- package/dist/chunks/bridgeMain-D11t1BYQ.js +0 -68
- package/dist/chunks/bridgeMessaging-DdvApEqW.js +0 -1
- package/dist/chunks/bridgePointer-DqHMHa2B.js +0 -1
- package/dist/chunks/browser-BmZuQom6.js +0 -1
- package/dist/chunks/btw-CejSEdNl.js +0 -1
- package/dist/chunks/caches-5HVQSevy.js +0 -3
- package/dist/chunks/caches-B-nJoHLM.js +0 -1
- package/dist/chunks/capacityWake-CV_x9H8j.js +0 -1
- package/dist/chunks/ccrClient-BFyfO67b.js +0 -1
- package/dist/chunks/client-DKXCfdde.js +0 -1
- package/dist/chunks/client-xxikkAoZ.js +0 -1
- package/dist/chunks/commands-CxJpmEKF.js +0 -1
- package/dist/chunks/commitAttribution-DM6SBMwl.js +0 -1
- package/dist/chunks/commitAttribution-DPnHHKSA.js +0 -2
- package/dist/chunks/compact-CblM7306.js +0 -2
- package/dist/chunks/completionCache-MN3_MqK8.js +0 -4
- package/dist/chunks/completionCache-c4aiyZ_f.js +0 -1
- package/dist/chunks/config-BLVBFi5v.js +0 -1
- package/dist/chunks/config-CMnqm6Se.js +0 -1
- package/dist/chunks/config-DRDuVyzE.js +0 -3
- package/dist/chunks/context-CdSMMM-0.js +0 -1
- package/dist/chunks/context-noninteractive-CPkf2vB9.js +0 -1
- package/dist/chunks/context-noninteractive-DNury4JI.js +0 -54
- package/dist/chunks/conversation-DCMw_rsE.js +0 -1
- package/dist/chunks/conversation-pUtvc-cE.js +0 -1
- package/dist/chunks/createSession-8Ei-Lj7V.js +0 -1
- package/dist/chunks/createSession-CjqxVh_Q.js +0 -1
- package/dist/chunks/cron-3LntnnhJ.js +0 -1
- package/dist/chunks/crossProjectResume-Bj_Pe8oe.js +0 -40
- package/dist/chunks/cwd--nvsx73T.js +0 -1
- package/dist/chunks/cwd-CYmmnQVS.js +0 -1
- package/dist/chunks/debugUtils-NO5KtXqi.js +0 -1
- package/dist/chunks/desktop-Z5FAfunZ.js +0 -1
- package/dist/chunks/detectRepository-BTPgN89l.js +0 -1
- package/dist/chunks/directoryCompletion-CW2ckkQg.js +0 -1
- package/dist/chunks/doctor-BA2ZLDTl.js +0 -1
- package/dist/chunks/envLessBridgeConfig-B-LKYNvv.js +0 -1
- package/dist/chunks/envLessBridgeConfig-DyD9XCda.js +0 -1
- package/dist/chunks/esm-5w3xFBnt.js +0 -1
- package/dist/chunks/exit-Dt9kHtJO.js +0 -1
- package/dist/chunks/extra-usage-C7E2Z1p1.js +0 -1
- package/dist/chunks/extra-usage-D0Kkjp-2.js +0 -1
- package/dist/chunks/extra-usage-core-DjdaD1qO.js +0 -1
- package/dist/chunks/extra-usage-noninteractive-BnD1RhKK.js +0 -1
- package/dist/chunks/extraUsage-CpgRTcMk.js +0 -1
- package/dist/chunks/extractMemories-DhUprYa7.js +0 -1
- package/dist/chunks/fast-C4ZevUNL.js +0 -1
- package/dist/chunks/fast-CChxlAAF.js +0 -1
- package/dist/chunks/feedback-BIhBhV6n.js +0 -1
- package/dist/chunks/file-DcZWPH2V.js +0 -12
- package/dist/chunks/fileStateCache-DDW5toIs.js +0 -1
- package/dist/chunks/files-Cz1-PK3r.js +0 -2
- package/dist/chunks/firstPartyEventLogger-BXY1IJ2D.js +0 -5
- package/dist/chunks/firstPartyEventLogger-CnkGSojw.js +0 -1
- package/dist/chunks/flushGate-CgHq81Gw.js +0 -1
- package/dist/chunks/gemini-C1J-x1g7.js +0 -1
- package/dist/chunks/generateRecap-C0jjCg0Z.js +0 -1
- package/dist/chunks/generateSessionName-w0BMtwS7.js +0 -1
- package/dist/chunks/git-CbcnOf0E.js +0 -1
- package/dist/chunks/git-Do0wJvux.js +0 -6
- package/dist/chunks/githubRepoPathMapping-8D0kpsif.js +0 -1
- package/dist/chunks/grok-ffNyU3Lt.js +0 -1
- package/dist/chunks/grove-BQisE2JM.js +0 -7
- package/dist/chunks/heapdump-DiCjAPR3.js +0 -5
- package/dist/chunks/help-2hn8VK2-.js +0 -1
- package/dist/chunks/hooks-CBmrBO-J.js +0 -1
- package/dist/chunks/hostGuard-BHI6Q8Mt.js +0 -1
- package/dist/chunks/inboundAttachments-C5K3XPTC.js +0 -1
- package/dist/chunks/inboundAttachments-IH-g95jo.js +0 -1
- package/dist/chunks/index.min-D75yiGLN.js +0 -1
- package/dist/chunks/initReplBridge-C-P4dgAG.js +0 -1
- package/dist/chunks/keybindings-D8FXoO89.js +0 -2
- package/dist/chunks/language-Baosud0X.js +0 -1
- package/dist/chunks/launchAgentsPlatform-D6DmNuDt.js +0 -1
- package/dist/chunks/launchCommand-1qkTCKpf.js +0 -1
- package/dist/chunks/launchLocalMemory-C0FzUq7x.js +0 -3
- package/dist/chunks/launchLocalVault-DkYAre4O.js +0 -3
- package/dist/chunks/launchMemoryStores-D2rKWAPs.js +0 -1
- package/dist/chunks/launchSchedule-IZdFstT_.js +0 -1
- package/dist/chunks/launchSkillStore-B7LamM1d.js +0 -1
- package/dist/chunks/launchTeleport-C2BQMfYP.js +0 -3
- package/dist/chunks/launchVault-C60WUcCI.js +0 -1
- package/dist/chunks/loadAgentsDir-B9c3Emvg.js +0 -1
- package/dist/chunks/loadPluginHooks-BhNdAjeY.js +0 -1
- package/dist/chunks/localSearch-BLCGsdyM.js +0 -1
- package/dist/chunks/log-BMCygSzM.js +0 -1
- package/dist/chunks/logoV2Utils-gGK9gErT.js +0 -1
- package/dist/chunks/managedEnv-BHoeDjpS.js +0 -1
- package/dist/chunks/mcp-BSNdwbxR.js +0 -1
- package/dist/chunks/mcp-CMnDNI-4.js +0 -6
- package/dist/chunks/mcp-D1yA9E56.js +0 -2
- package/dist/chunks/memoize-B0zhbT8Z.js +0 -1
- package/dist/chunks/memory-D1zbyjxN.js +0 -1
- package/dist/chunks/model-CZViyZnE.js +0 -1
- package/dist/chunks/model-DLLkVV6S.js +0 -1
- package/dist/chunks/nativeInstaller-yj81F75v.js +0 -1
- package/dist/chunks/observationStore-DzCdXq8U.js +0 -4
- package/dist/chunks/onChangeAppState-DhGKPG9g.js +0 -1
- package/dist/chunks/output-style-BM3qAHLA.js +0 -1
- package/dist/chunks/overageCreditGrant-Du3dOYVu.js +0 -1
- package/dist/chunks/panel-Be-OxtqL.js +0 -1
- package/dist/chunks/parser-Bf6iasPV.js +0 -1
- package/dist/chunks/partition-C4FWzYVm.js +0 -1
- package/dist/chunks/passes-Daz-ARWD.js +0 -1
- package/dist/chunks/permissions-CeYKbtSC.js +0 -1
- package/dist/chunks/permissions-Cn_6f8CB.js +0 -1
- package/dist/chunks/permissions-DF8tAmDF.js +0 -3
- package/dist/chunks/plugin-Cm31-nej.js +0 -1
- package/dist/chunks/pluginBlocklist-wPFCUPdm.js +0 -1
- package/dist/chunks/pluginCliCommands-DhL9LbH0.js +0 -1
- package/dist/chunks/pluginFlagging-CAdaFV_D.js +0 -1
- package/dist/chunks/pluginOperations-Cs_Z4C6O.js +0 -2
- package/dist/chunks/pluginStartupCheck-BRXGKGjG.js +0 -1
- package/dist/chunks/pluginStartupCheck-KeU0efTj.js +0 -1
- package/dist/chunks/policyLimits-D2s8M8P2.js +0 -1
- package/dist/chunks/pollConfig-2nFzv6Hy.js +0 -1
- package/dist/chunks/poor-DXumVTR4.js +0 -1
- package/dist/chunks/poorMode-yNZL5uYf.js +0 -1
- package/dist/chunks/print-uxCF5ka5.js +0 -23
- package/dist/chunks/privacy-settings-BncbJCV0.js +0 -1
- package/dist/chunks/processBashCommand-CGdwvPmD.js +0 -1
- package/dist/chunks/processSlashCommand-DQarepEb.js +0 -5
- package/dist/chunks/prompt-BgOdcHkd.js +0 -1
- package/dist/chunks/prompt-CE3sFmZV.js +0 -139
- package/dist/chunks/prompt-CLJKFebn.js +0 -1
- package/dist/chunks/rate-limit-options-C-EqWjeI.js +0 -1
- package/dist/chunks/rcDebugLog-DBB9r8aw.js +0 -11
- package/dist/chunks/reconciler-CYD_XpG4.js +0 -4
- package/dist/chunks/referral-CKmHHxj_.js +0 -1
- package/dist/chunks/refresh-ZqZdmLK5.js +0 -1
- package/dist/chunks/registerProtocol-wZv2uiW_.js +0 -36
- package/dist/chunks/release-notes-B5K7wVqZ.js +0 -4
- package/dist/chunks/releaseNotes-B8gbyFFJ.js +0 -2
- package/dist/chunks/remote-env-CAt1dHIS.js +0 -1
- package/dist/chunks/remoteBridgeCore-Bk3UdSLJ.js +0 -1
- package/dist/chunks/remoteManagedSettings-bswzAB6W.js +0 -1
- package/dist/chunks/rename-CE_U6KE6.js +0 -1
- package/dist/chunks/ripgrep-BfIpz5uC.js +0 -1
- package/dist/chunks/runtimeObserver-BrGF5QWX.js +0 -10
- package/dist/chunks/sandbox-adapter-BtMiHImm.js +0 -1
- package/dist/chunks/sandbox-toggle-D8eebdyI.js +0 -1
- package/dist/chunks/sanitization-DV-94a9Z.js +0 -1
- package/dist/chunks/searchExtraTools-hLLPuh7c.js +0 -1
- package/dist/chunks/semver-BMRJYn3q.js +0 -1
- package/dist/chunks/session-BZIlR9Gc.js +0 -2
- package/dist/chunks/sessionDiscovery-DfDqTrF1.js +0 -1
- package/dist/chunks/sessionFileAccessHooks-Bm8wiqwe.js +0 -1
- package/dist/chunks/sessionMemory-D37S0-jX.js +0 -1
- package/dist/chunks/sessionMemory-DmlAG3jq.js +0 -1
- package/dist/chunks/sessionMemoryUtils-6EWDHSGU.js +0 -1
- package/dist/chunks/sessionObserver-BUw2rzKl.js +0 -1
- package/dist/chunks/sessionObserver-KgquhGWw.js +0 -20
- package/dist/chunks/sessionStorage-CucBSK5Q.js +0 -1
- package/dist/chunks/sessionTracing-_Hh5VXxt.js +0 -11
- package/dist/chunks/settings-BeLFUeie.js +0 -19
- package/dist/chunks/settings-Cl16Haug.js +0 -1
- package/dist/chunks/settingsSync-BNvFYH3c.js +0 -1
- package/dist/chunks/setup-D8kXv3ts.js +0 -3
- package/dist/chunks/sinks-FevoYQqP.js +0 -1
- package/dist/chunks/skill-learning-CMdxGtxr.js +0 -5
- package/dist/chunks/skillChangeDetector-C65ZLSYV.js +0 -1
- package/dist/chunks/skillGapStore-D18LRJAM.js +0 -5
- package/dist/chunks/skillGapStore-Ep62R-2_.js +0 -1
- package/dist/chunks/skillGenerator-Bc7WwNT8.js +0 -8
- package/dist/chunks/skillLearning-Cs9fJgkV.js +0 -1
- package/dist/chunks/skillLearning-duPZl69A.js +0 -1
- package/dist/chunks/skillPanel-Cyzby746.js +0 -28
- package/dist/chunks/slashCommandParsing-RQb_7Xzt.js +0 -1
- package/dist/chunks/startupProfiler-DIWVcO4e.js +0 -1
- package/dist/chunks/startupProfiler-xa3NmN7Z.js +0 -3
- package/dist/chunks/state-BOa-3Av3.js +0 -1
- package/dist/chunks/statusNoticeHelpers-CEGvdm5d.js +0 -1
- package/dist/chunks/stickers-D5teCKMN.js +0 -1
- package/dist/chunks/syncCache-CANQZ9mQ.js +0 -1
- package/dist/chunks/systemPromptSections-CR_AoPIX.js +0 -1
- package/dist/chunks/systemPromptSections-DN0HGVye.js +0 -1
- package/dist/chunks/tag-DDbNqBMu.js +0 -11
- package/dist/chunks/teleport-Dk5j03Ix.js +0 -1
- package/dist/chunks/terminalSetup-3JNy6i_J.js +0 -33
- package/dist/chunks/thinkback-p-vKIRW_.js +0 -1
- package/dist/chunks/thinkback-play-DnPTDE8B.js +0 -1
- package/dist/chunks/thinkback-rFA1do6F.js +0 -1
- package/dist/chunks/toolEventObserver-CzsCuUMc.js +0 -1
- package/dist/chunks/toolPool-BR27AMJO.js +0 -1
- package/dist/chunks/trustedDevice-BYt39fui.js +0 -1
- package/dist/chunks/tui-C2yuCuOU.js +0 -6
- package/dist/chunks/types-Bh9S_JG5.js +0 -3
- package/dist/chunks/types-DHkZVzJe.js +0 -1
- package/dist/chunks/ultrareviewCommand-C_4OSBTW.js +0 -3
- package/dist/chunks/undercover-D30rKimg.js +0 -31
- package/dist/chunks/undercover-DRSwLozU.js +0 -1
- package/dist/chunks/upgrade-Bi-bIz7R.js +0 -1
- package/dist/chunks/upgrade-Chs-OQFd.js +0 -1
- package/dist/chunks/upload-D8FWMSQx.js +0 -1
- package/dist/chunks/usage-BxVeUt60.js +0 -1
- package/dist/chunks/usage-DUO7Yy1f.js +0 -1
- package/dist/chunks/useExitOnCtrlCDWithKeybindings-BwsZ5f0s.js +0 -1
- package/dist/chunks/useMainLoopModel-Gy1Vv4Qr.js +0 -1
- package/dist/chunks/useManagePlugins-B11_87VN.js +0 -1
- package/dist/chunks/useMergedTools-CR56my9t.js +0 -1
- package/dist/chunks/useSettingsErrors-B9vOZL41.js +0 -1
- package/dist/chunks/validatePlugin-6q1qmnAC.js +0 -1
- package/dist/chunks/windowsPaths-9pEkw0oV.js +0 -1
- package/dist/chunks/workerRegistry-CvyHvwx-.js +0 -1
- package/dist/chunks/worktree-ogmNCIpz.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{l as t,o as n}from"./envUtils-DSxRz_kt.js";import{c as r,
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{l as t,o as n}from"./envUtils-DSxRz_kt.js";import{c as r,cn as i,f as a,g as o,ln as s}from"./settings-hQDLwPVj.js";import{c,g as l}from"./config-CE058cvr.js";import{d as u,g as d,h as f,l as p,n as m,t as h,v as g}from"./proxy-BmtEnJ02.js";import{n as _,t as v}from"./syncCache-Zl9kZRRl.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||!O)return e||{};let t={};for(let[n,r]of Object.entries(e))O.has(n)||(t[n]=r);return t}function T(e){return w(C(S(e)))}function E(){O===void 0&&(O=process.env.CLAUDE_CODE_ENTRYPOINT===`claude-desktop`?new Set(Object.keys(process.env)):null),Object.assign(process.env,T(c().env));for(let e of k)e!==`policySettings`&&s(e)&&Object.assign(process.env,T(r(e)?.env));_(),Object.assign(process.env,T(r(`policySettings`)?.env));let e=T(a()?.env);for(let[t,n]of Object.entries(e))x.has(t.toUpperCase())&&(process.env[t]=n)}function D(){Object.assign(process.env,T(c().env)),Object.assign(process.env,T(a()?.env)),d(),u(),h(),m()}var O,k,A=e((()=>{v(),g(),l(),n(),y(),f(),p(),i(),o(),k=[`userSettings`,`flagSettings`,`policySettings`]}));export{E as n,A as r,D as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e,t}from"./managedEnv-C-9XSN14.js";e();export{t as applyConfigEnvironmentVariables};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{Kr as t,qr as n}from"./src-CDCSSo0U2.js";import{
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{Kr as t,qr as n}from"./src-CDCSSo0U2.js";import{$t as r,mt as i}from"./state-C2OSZkV1.js";import{UT as a,eo as o,ka as s,zT as c}from"./loadAgentsDir-ByO8eJqU.js";import{J as l}from"./log-CZ0zYP_c.js";import{jt as u}from"./prompt-B7joRiqj.js";import{randomUUID as d}from"crypto";function f(e){return e.flatMap(e=>{if(!e)return[];switch(e.type){case`assistant`:return[{type:`assistant`,message:e.message,uuid:e.uuid,requestId:void 0,timestamp:new Date().toISOString()}];case`user`:return[{type:`user`,message:e.message,uuid:e.uuid??d(),timestamp:e.timestamp??new Date().toISOString(),isMeta:e.isSynthetic}];default:return[]}})}function p(e){let t=e.preservedSegment;return{trigger:e.trigger,pre_tokens:e.preTokens,...t&&{preserved_segment:{head_uuid:t.headUuid,anchor_uuid:t.anchorUuid,tail_uuid:t.tailUuid}}}}function m(e){let t=e,n=t.preserved_segment;return{trigger:t.trigger,preTokens:t.pre_tokens,...n&&{preservedSegment:{headUuid:n.head_uuid,anchorUuid:n.anchor_uuid,tailUuid:n.tail_uuid}}}}function h(e){return e.flatMap(e=>{if(!e)return[];switch(e.type){case`assistant`:return[{type:`assistant`,message:v(e),session_id:i(),parent_tool_use_id:null,uuid:e.uuid,error:e?.error}];case`user`:return[{type:`user`,message:e.message,session_id:i(),parent_tool_use_id:null,uuid:e.uuid,timestamp:e.timestamp,isSynthetic:e.isMeta||e.isVisibleInTranscriptOnly,...e.toolUseResult===void 0?{}:{tool_use_result:e.toolUseResult}}];case`system`:return e.subtype===`compact_boundary`&&e.compactMetadata?[{type:`system`,subtype:`compact_boundary`,session_id:i(),uuid:e.uuid,compact_metadata:p(e.compactMetadata)}]:e.subtype===`local_command`&&(e.content.includes(`<local-command-stdout>`)||e.content.includes(`<local-command-stderr>`))?[g(e.content,e.uuid)]:[];default:return[]}})}function g(e,t){let r=s({content:n(e).replace(/<local-command-stdout>([\s\S]*?)<\/local-command-stdout>/,`$1`).replace(/<local-command-stderr>([\s\S]*?)<\/local-command-stderr>/,`$1`).trim()});return{type:`assistant`,content:r.message?.content,message:r.message,parent_tool_use_id:null,session_id:i(),uuid:t}}function _(e){if(e)return{type:`rate_limit`,status:e.status,...e.resetsAt!==void 0&&{resetsAt:e.resetsAt},...e.rateLimitType!==void 0&&{rateLimitType:e.rateLimitType},...e.utilization!==void 0&&{utilization:e.utilization},...e.overageStatus!==void 0&&{overageStatus:e.overageStatus},...e.overageResetsAt!==void 0&&{overageResetsAt:e.overageResetsAt},...e.overageDisabledReason!==void 0&&{overageDisabledReason:e.overageDisabledReason},...e.isUsingOverage!==void 0&&{isUsingOverage:e.isUsingOverage},...e.surpassedThreshold!==void 0&&{surpassedThreshold:e.surpassedThreshold}}}function v(e){let t=e.message.content;if(!Array.isArray(t))return e.message;let n=t.map(e=>{if(e.type!==`tool_use`)return e;if(e.name===`ExitPlanMode`){let t=c();if(t)return{...e,input:{...e.input,plan:t}}}return e});return{...e.message,content:n}}var y=e((()=>{r(),l(),u(),t(),o(),a()}));export{p as a,f as i,y as n,h as o,g as r,_ as s,m 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,Wt as d,fi as f,j as p,t as m,y as h}from"./src-CDCSSo0U2.js";import{t as g}from"./jsx-runtime-Bb4Xn-E0.js";import{$S as _,DC as v,JS as y,Jp as b,Pw as x,QS as S,Rp as C,SC as w,_v as T,dp as E,hC as D,pp as O,qS as k,qp as A,vv as j,wC as M,yv as ee,zp as te}from"./loadAgentsDir-ByO8eJqU.js";import{a as ne,o as re}from"./debug-RZ4NuXyS.js";import{l as ie,n as ae,o as N}from"./stringUtils-B6FudhoZ.js";import{F as oe,I as se}from"./sessionState-CjNY991n.js";import{i as ce,n as P,r as le}from"./MCPConnectionManager-ao-P3xSA.js";import{n as ue,t as de}from"./McpParsingWarnings-BS4JoR5l.js";import{a as fe,c as F,i as I,n as L,o as R,r as pe,s as me,t as he}from"./MCPToolListView-dkofcJs4.js";function ge({agentServer:e,onCancel:t,onComplete:n}){let[a]=o(),[f,m]=(0,z.useState)(!1),[g,v]=(0,z.useState)(null),[y,b]=(0,z.useState)(null),x=(0,z.useRef)(null);(0,z.useEffect)(()=>()=>x.current?.abort(),[]),d(`confirm:no`,(0,z.useCallback)(()=>{f&&(x.current?.abort(),x.current=null,m(!1),b(null))},[f]),{context:`Confirmation`,isActive:f});let S=(0,z.useCallback)(async()=>{if(!e.needsAuth||!e.url)return;m(!0),v(null);let t=new AbortController;x.current=t;try{let r={type:e.transport,url:e.url};await _(e.name,r,b,t.signal),n?.(`Authentication successful for ${e.name}. The server will connect when the agent runs.`)}catch(e){e instanceof Error&&!(e instanceof k)&&v(e.message)}finally{m(!1),x.current=null}},[e,n]),C=ae(String(e.name));if(f)return(0,B.jsxs)(s,{flexDirection:`column`,gap:1,padding:1,children:[(0,B.jsxs)(l,{color:`claude`,children:[`Authenticating with `,e.name,`…`]}),(0,B.jsxs)(s,{children:[(0,B.jsx)(E,{}),(0,B.jsx)(l,{children:` A browser window will open for authentication`})]}),y&&(0,B.jsxs)(s,{flexDirection:`column`,children:[(0,B.jsx)(l,{dimColor:!0,children:`If your browser doesn't open automatically, copy this URL manually:`}),(0,B.jsx)(c,{url:y})]}),(0,B.jsx)(s,{marginLeft:3,children:(0,B.jsxs)(l,{dimColor:!0,children:[`Return here after authenticating in your browser.`,` `,(0,B.jsx)(A,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`})]})})]});let w=[];return e.needsAuth&&w.push({label:e.isAuthenticated?`Re-authenticate`:`Authenticate`,value:`auth`}),w.push({label:`Back`,value:`back`}),(0,B.jsxs)(h,{title:`${C} MCP Server`,subtitle:`agent-only`,onCancel:t,inputGuide:e=>e.pending?(0,B.jsxs)(l,{children:[`Press `,e.keyName,` again to exit`]}):(0,B.jsxs)(u,{children:[(0,B.jsx)(i,{shortcut:`↑↓`,action:`navigate`}),(0,B.jsx)(i,{shortcut:`Enter`,action:`confirm`}),(0,B.jsx)(A,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`})]}),children:[(0,B.jsxs)(s,{flexDirection:`column`,gap:0,children:[(0,B.jsxs)(s,{children:[(0,B.jsx)(l,{bold:!0,children:`Type: `}),(0,B.jsx)(l,{dimColor:!0,children:e.transport})]}),e.url&&(0,B.jsxs)(s,{children:[(0,B.jsx)(l,{bold:!0,children:`URL: `}),(0,B.jsx)(l,{dimColor:!0,children:e.url})]}),e.command&&(0,B.jsxs)(s,{children:[(0,B.jsx)(l,{bold:!0,children:`Command: `}),(0,B.jsx)(l,{dimColor:!0,children:e.command})]}),(0,B.jsxs)(s,{children:[(0,B.jsx)(l,{bold:!0,children:`Used by: `}),(0,B.jsx)(l,{dimColor:!0,children:e.sourceAgents.join(`, `)})]}),(0,B.jsxs)(s,{marginTop:1,children:[(0,B.jsx)(l,{bold:!0,children:`Status: `}),(0,B.jsxs)(l,{children:[p(`inactive`,a)(r.radioOff),` not connected (agent-only)`]})]}),e.needsAuth&&(0,B.jsxs)(s,{children:[(0,B.jsx)(l,{bold:!0,children:`Auth: `}),e.isAuthenticated?(0,B.jsxs)(l,{children:[p(`success`,a)(r.tick),` authenticated`]}):(0,B.jsxs)(l,{children:[p(`warning`,a)(r.triangleUpOutline),` may need authentication`]})]})]}),(0,B.jsx)(s,{children:(0,B.jsx)(l,{dimColor:!0,children:`This server connects only when running the agent.`})}),g&&(0,B.jsx)(s,{children:(0,B.jsxs)(l,{color:`error`,children:[`Error: `,g]})}),(0,B.jsx)(s,{children:(0,B.jsx)(te,{options:w,onChange:async e=>{switch(e){case`auth`:await S();break;case`back`:t();break}},onCancel:t})})]})}var z,B,V=e((()=>{n(),z=t(f(),1),m(),x(),S(),N(),b(),C(),O(),B=g()}));function H(e){switch(e){case`project`:return{label:`Project MCPs`,path:D(e)};case`user`:return{label:`User MCPs`,path:D(e)};case`local`:return{label:`Local MCPs`,path:D(e)};case`enterprise`:return{label:`Enterprise MCPs`};case`dynamic`:return{label:`Built-in MCPs`,path:`always available`};default:return{label:e}}}function _e(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 ve({servers:e,agentServers:t=[],onSelectServer:n,onSelectAgentServer:d,onComplete:f}){let[m]=o(),[g,_]=(0,U.useState)(0),v=U.useMemo(()=>_e(e.filter(e=>e.client.config.type!==`claudeai-proxy`)),[e]),y=U.useMemo(()=>e.filter(e=>e.client.config.type===`claudeai-proxy`).sort((e,t)=>e.name.localeCompare(t.name)),[e]),b=U.useMemo(()=>(v.get(`dynamic`)??[]).sort((e,t)=>e.name.localeCompare(t.name)),[v]),x=H(`dynamic`),S=U.useMemo(()=>{let e=[];for(let t of G){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]),C=(0,U.useCallback)(()=>{f(`MCP dialog dismissed`,{display:`system`})},[f]);a({"confirm:previous":()=>_(e=>e===0?S.length-1:e-1),"confirm:next":()=>_(e=>e===S.length-1?0:e+1),"confirm:yes":(0,U.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":C},{context:`Confirmation`});let w=e=>S.findIndex(t=>t.type===`server`&&t.server===e),T=e=>S.findIndex(t=>t.type===`agent-server`&&t.agentServer===e),E=re(),D=e.some(e=>e.client.type===`failed`);if(e.length===0&&t.length===0)return null;let O=e=>{let t=w(e),n=g===t,i=``,a=``;if(e.client.type===`disabled`)i=p(`inactive`,m)(r.radioOff),a=`disabled`;else if(e.client.type===`connected`)i=p(`success`,m)(r.tick),a=`connected`;else if(e.client.type===`pending`){i=p(`inactive`,m)(r.radioOff);let{reconnectAttempt:t,maxReconnectAttempts:n}=e.client;a=t&&n?`reconnecting (${t}/${n})…`:`connecting…`}else e.client.type===`needs-auth`?(i=p(`warning`,m)(r.triangleUpOutline),a=`needs authentication`):(i=p(`error`,m)(r.cross),a=`failed`);return(0,W.jsxs)(s,{children:[(0,W.jsx)(l,{color:n?`suggestion`:void 0,children:n?`${r.pointer} `:` `}),(0,W.jsx)(l,{color:n?`suggestion`:void 0,children:e.name}),(0,W.jsxs)(l,{dimColor:!n,children:[` · `,i,` `]}),(0,W.jsx)(l,{dimColor:!n,children:a})]},`${e.name}-${t}`)},k=e=>{let t=T(e),n=g===t,i=e.needsAuth?p(`warning`,m)(r.triangleUpOutline):p(`inactive`,m)(r.radioOff),a=e.needsAuth?`may need auth`:`agent-only`;return(0,W.jsxs)(s,{children:[(0,W.jsx)(l,{color:n?`suggestion`:void 0,children:n?`${r.pointer} `:` `}),(0,W.jsx)(l,{color:n?`suggestion`:void 0,children:e.name}),(0,W.jsxs)(l,{dimColor:!n,children:[` · `,i,` `]}),(0,W.jsx)(l,{dimColor:!n,children:a})]},`agent-${e.name}-${t}`)},j=e.length+t.length;return(0,W.jsxs)(s,{flexDirection:`column`,children:[(0,W.jsx)(de,{}),(0,W.jsx)(h,{title:`Manage MCP servers`,subtitle:`${j} ${ie(j,`server`)}`,onCancel:C,hideInputGuide:!0,children:(0,W.jsxs)(s,{flexDirection:`column`,children:[G.map(e=>{let t=v.get(e);if(!t||t.length===0)return null;let n=H(e);return(0,W.jsxs)(s,{flexDirection:`column`,marginBottom:1,children:[(0,W.jsxs)(s,{paddingLeft:2,children:[(0,W.jsx)(l,{bold:!0,children:n.label}),n.path&&(0,W.jsxs)(l,{dimColor:!0,children:[` (`,n.path,`)`]})]}),t.map(e=>O(e))]},e)}),y.length>0&&(0,W.jsxs)(s,{flexDirection:`column`,marginBottom:1,children:[(0,W.jsx)(s,{paddingLeft:2,children:(0,W.jsx)(l,{bold:!0,children:`claude.ai`})}),y.map(e=>O(e))]}),t.length>0&&(0,W.jsxs)(s,{flexDirection:`column`,marginBottom:1,children:[(0,W.jsx)(s,{paddingLeft:2,children:(0,W.jsx)(l,{bold:!0,children:`Agent MCPs`})}),[...new Set(t.flatMap(e=>e.sourceAgents))].map(e=>(0,W.jsxs)(s,{flexDirection:`column`,marginTop:1,children:[(0,W.jsx)(s,{paddingLeft:2,children:(0,W.jsxs)(l,{dimColor:!0,children:[`@`,e]})}),t.filter(t=>t.sourceAgents.includes(e)).map(e=>k(e))]},e))]}),b.length>0&&(0,W.jsxs)(s,{flexDirection:`column`,marginBottom:1,children:[(0,W.jsxs)(s,{paddingLeft:2,children:[(0,W.jsx)(l,{bold:!0,children:x.label}),x.path&&(0,W.jsxs)(l,{dimColor:!0,children:[` (`,x.path,`)`]})]}),b.map(e=>O(e))]}),(0,W.jsxs)(s,{flexDirection:`column`,children:[D&&(0,W.jsx)(l,{dimColor:!0,children:E?`※ Error logs shown inline with --debug`:`※ Run claude --debug to see error logs`}),(0,W.jsxs)(l,{dimColor:!0,children:[(0,W.jsx)(c,{url:`https://code.claude.com/docs/en/mcp`,children:`https://code.claude.com/docs/en/mcp`}),` for help`]})]})]})}),(0,W.jsx)(s,{paddingX:1,children:(0,W.jsx)(l,{dimColor:!0,italic:!0,children:(0,W.jsxs)(u,{children:[(0,W.jsx)(i,{shortcut:`↑↓`,action:`navigate`}),(0,W.jsx)(i,{shortcut:`Enter`,action:`confirm`}),(0,W.jsx)(A,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})]})})})]})}var U,W,G,K=e((()=>{n(),U=t(f(),1),m(),x(),v(),ne(),N(),b(),ue(),W=g(),G=[`project`,`local`,`user`,`enterprise`]}));function ye({serverName:e,onComplete:t}){let[n]=o(),i=ee(),a=le(),[c,u]=(0,q.useState)(!0),[d,f]=(0,q.useState)(null);return(0,q.useEffect)(()=>{async function n(){try{if(!i.getState().mcp.clients.find(t=>t.name===e)){f(`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`:f(`${e} requires authentication`),u(!1),t(`${e} requires authentication. Use /mcp to authenticate.`);break;case`pending`:case`failed`:case`disabled`:f(`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);f(n),u(!1),t(`Error: ${n}`)}}n()},[e,a,i,t]),c?(0,J.jsxs)(s,{flexDirection:`column`,gap:1,padding:1,children:[(0,J.jsxs)(l,{color:`text`,children:[`Reconnecting to `,(0,J.jsx)(l,{bold:!0,children:e})]}),(0,J.jsxs)(s,{children:[(0,J.jsx)(E,{}),(0,J.jsx)(l,{children:` Establishing connection to MCP server`})]})]}):d?(0,J.jsxs)(s,{flexDirection:`column`,gap:1,padding:1,children:[(0,J.jsxs)(s,{children:[(0,J.jsxs)(l,{children:[p(`error`,n)(r.cross),` `]}),(0,J.jsxs)(l,{color:`error`,children:[`Failed to reconnect to `,e]})]}),(0,J.jsxs)(l,{dimColor:!0,children:[`Error: `,d]})]}):null}var q,J,Y=e((()=>{n(),q=t(f(),1),m(),P(),T(),O(),J=g()}));function be({onComplete:e}){let t=j(e=>e.mcp),n=j(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;if(r||i){let n=await new y(e.name,e.config).tokens(),r=oe()!==null&&e.type===`connected`,i=e.type===`connected`&&M(t.tools,e.name).length>0;o=!!n||r||i}let s={name:e.name,client:e,scope:n};return a?{...s,transport:`claudeai-proxy`,isAuthenticated:!1,config:e.config}:r?{...s,transport:`sse`,isAuthenticated:o,config:e.config}:i?{...s,transport:`http`,isAuthenticated:o,config:e.config}:{...s,transport:`stdio`,config:e.config}}));e||s(n)}return n(),()=>{e=!0}},[l,t.tools]),(0,X.useEffect)(()=>{o.length===0&&l.length>0||o.length===0&&c.length===0&&e("No MCP servers configured. Please run /doctor if this is unexpected. Otherwise, run `claude mcp --help` or visit https://code.claude.com/docs/en/mcp to learn more.")},[o.length,l.length,c.length,e]),i.type){case`list`:return(0,Z.jsx)(ve,{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=M(t.tools,i.server.name),r=i.server.transport===`claudeai-proxy`?`claude.ai`:`Work Mate`;return i.server.transport===`stdio`?(0,Z.jsx)(fe,{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)(me,{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)(he,{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=M(t.tools,i.server.name)[i.toolIndex];return e?(0,Z.jsx)(pe,{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)(ge,{agentServer:i.agentServer,onCancel:()=>a({type:`list`,defaultTab:`Agents`}),onComplete:e})}}var X,Z,xe=e((()=>{X=t(f(),1),S(),v(),T(),se(),V(),K(),F(),R(),I(),L(),Z=g()})),Se=e((()=>{V(),K(),Y(),F(),xe(),R(),I(),L()}));function Ce({action:e,target:t,onComplete:n}){let r=j(e=>e.mcp.clients),i=ce(),a=(0,Q.useRef)(!1);return(0,Q.useEffect)(()=>{if(a.current)return;a.current=!0;let o=e===`enable`,s=r.filter(e=>e.name!==`ide`),c=t===`all`?s.filter(e=>o?e.type===`disabled`:e.type!==`disabled`):s.filter(e=>e.name===t);if(c.length===0){n(t===`all`?`All MCP servers are already ${o?`enabled`:`disabled`}`:`MCP server "${t}" not found`);return}for(let e of c)i(e.name);n(t===`all`?`${o?`Enabled`:`Disabled`} ${c.length} MCP server(s)`:`MCP server "${t}" ${o?`enabled`:`disabled`}`)},[e,t,r,i,n]),null}async function we(e,t,n){if(n){let t=n.trim().split(/\s+/);if(t[0]===`no-redirect`)return(0,$.jsx)(be,{onComplete:e});if(t[0]===`reconnect`&&t[1])return(0,$.jsx)(ye,{serverName:t.slice(1).join(` `),onComplete:e});if(t[0]===`enable`||t[0]===`disable`)return(0,$.jsx)(Ce,{action:t[0],target:t.length>1?t.slice(1).join(` `):`all`,onComplete:e})}return(0,$.jsx)(be,{onComplete:e})}var Q,$;e((()=>{Q=t(f(),1),Se(),Y(),P(),T(),$=g()}))();export{we as call};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import{o as e}from"./rolldown-runtime-DaDcL9Zw.js";import{n as t,t as n}from"./p-map-HKDr3iDo.js";import{D as r,H as i,I as a,P as o,T as s,fi as c,j as ee,kn as l,t as u,y as d}from"./src-CDCSSo0U2.js";import{t as f}from"./jsx-runtime-Bb4Xn-E0.js";import{AC as p,BC as m,CS as h,DC as g,DS as _,EC as v,FC as y,Hp as b,Jm as x,Jp as te,Km as S,LC as C,QS as ne,RC as re,Vp as ie,WC as w,XS as ae,YS as oe,ZS as T,_v as se,eC as E,gC as D,gv as O,hC as k,kS as A,nC as j,op as M,qp as N,sp as P}from"./loadAgentsDir-ByO8eJqU.js";import{H as F,z as I}from"./debug-RZ4NuXyS.js";import{c as L,g as R,o as z,y as B}from"./config-CE058cvr.js";import{n as V,o as H}from"./process-gEbdy6uY.js";import{i as U,o as W}from"./platform-DCXXznJg.js";import{s as G,u as ce}from"./types-D7_37tP2.js";import{n as le,r as K}from"./analytics-CkYUHW_U.js";import{l as q,o as ue}from"./stringUtils-B6FudhoZ.js";import{n as J,t as Y}from"./exit-BOhGfSlm.js";import{stat as de}from"fs/promises";import{cwd as fe}from"process";n();var X=e(c(),1);x(),V(),u(),m(),ue(),te(),b();var Z=f();function pe({servers:e,scope:t,onDone:n}){let c=Object.keys(e),[l,u]=(0,X.useState)({});(0,X.useEffect)(()=>{y().then(({servers:e})=>u(e))},[]);let f=c.filter(e=>l[e]!==void 0);async function m(n){let r=0;for(let i of n){let n=e[i];if(n){let e=i;if(l[e]!==void 0){let t=1;for(;l[`${i}_${t}`]!==void 0;)t++;e=`${i}_${t}`}await p(e,n,t),r++}}g(r)}let[h]=i(),g=(0,X.useCallback)(e=>{H(e>0?`\n${ee(`success`,h)(`Successfully imported ${e} MCP ${q(e,`server`)} to ${t} config.`)}\n`:`
|
|
2
|
+
No servers were imported.`),n(),S()},[h,t,n]),_=(0,X.useCallback)(()=>{g(0)},[g]);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(d,{title:`Import MCP Servers from Claude Desktop`,subtitle:`Found ${c.length} MCP ${q(c.length,`server`)} in Claude Desktop.`,color:`success`,onCancel:_,hideInputGuide:!0,children:[f.length>0&&(0,Z.jsx)(o,{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)(o,{children:`Please select the servers you want to import:`}),(0,Z.jsx)(ie,{options:c.map(e=>({label:`${e}${f.includes(e)?` (already exists)`:``}`,value:e})),defaultValue:c.filter(e=>!f.includes(e)),onSubmit:m,onCancel:_,hideIndexes:!0})]}),(0,Z.jsx)(a,{paddingX:1,children:(0,Z.jsx)(o,{dimColor:!0,italic:!0,children:(0,Z.jsxs)(s,{children:[(0,Z.jsx)(r,{shortcut:`Space`,action:`select`}),(0,Z.jsx)(r,{shortcut:`Enter`,action:`confirm`}),(0,Z.jsx)(N,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})]})})})]})}u(),P(),le(),ne(),A(),m(),g(),se(),R(),I(),x(),G(),W();async function Q(e,t){try{let n=await h(e,t);return n.type===`connected`?`✓ Connected`:n.type===`needs-auth`?`! Needs authentication`:`✗ Failed to connect`}catch{return`✗ Connection error`}}async function me({debug:e,verbose:t}){let n=fe();K(`tengu_mcp_start`,{});try{await de(n)}catch(e){throw F(e)&&Y(`Error: Directory ${n} does not exist`),e}try{let{setup:r}=await import(`./setup-DzC22EkN.js`);await r(n,`default`,!1,!1,void 0,!1);let{startMCPServer:i}=await import(`./mcp-tGsOW1GN.js`);await i(n,e??!1,t??!1)}catch(e){Y(`Error: Failed to start MCP server: ${e}`)}}async function he(e,t){let n=C(e),r=()=>{n&&(n.type===`sse`||n.type===`http`)&&(ae(e,n),oe(e,n))};try{if(t.scope){let n=D(t.scope);K(`tengu_mcp_delete`,{name:e,scope:n}),await w(e,n),r(),process.stdout.write(`Removed MCP server ${e} from ${n} config\n`),J(`File modified: ${k(n)}`)}let n=z(),i=L(),{servers:a}=re(`project`),o=!!a[e],s=[];if(n.mcpServers?.[e]&&s.push(`local`),o&&s.push(`project`),i.mcpServers?.[e]&&s.push(`user`),s.length===0)Y(`No MCP server found with name: "${e}"`);else if(s.length===1){let t=s[0];K(`tengu_mcp_delete`,{name:e,scope:t}),await w(e,t),r(),process.stdout.write(`Removed MCP server "${e}" from ${t} config\n`),J(`File modified: ${k(t)}`)}else process.stderr.write(`MCP server "${e}" exists in multiple scopes:\n`),s.forEach(e=>{process.stderr.write(` - ${v(e)} (${k(e)})\n`)}),process.stderr.write(`
|
|
3
|
+
To remove from a specific scope, use:
|
|
4
|
+
`),s.forEach(t=>{process.stderr.write(` claude mcp remove "${e}" -s ${t}\n`)}),Y()}catch(e){Y(e.message)}}async function ge(){K(`tengu_mcp_list`,{});let{servers:e}=await y();if(Object.keys(e).length===0)console.log("No MCP servers configured. Use `claude mcp add` to add a server.");else{console.log(`Checking MCP server health...
|
|
5
|
+
`);let n=await t(Object.entries(e),async([e,t])=>({name:e,server:t,status:await Q(e,t)}),{concurrency:_()});for(let{name:e,server:t,status:r}of n)if(t.type===`sse`)console.log(`${e}: ${t.url} (SSE) - ${r}`);else if(t.type===`http`)console.log(`${e}: ${t.url} (HTTP) - ${r}`);else if(t.type===`claudeai-proxy`)console.log(`${e}: ${t.url} - ${r}`);else if(!t.type||t.type===`stdio`){let n=t,i=Array.isArray(n.args)?n.args:[];console.log(`${e}: ${n.command} ${i.join(` `)} - ${r}`)}}await S(0)}async function $(e){K(`tengu_mcp_get`,{name:e});let t=C(e);t||Y(`No MCP server found with name: ${e}`),console.log(`${e}:`),console.log(` Scope: ${v(t.scope)}`);let n=await Q(e,t);if(console.log(` Status: ${n}`),t.type===`sse`){if(console.log(` Type: sse`),console.log(` URL: ${t.url}`),t.headers){console.log(` Headers:`);for(let[e,n]of Object.entries(t.headers))console.log(` ${e}: ${n}`)}if(t.oauth?.clientId||t.oauth?.callbackPort){let n=[];t.oauth.clientId&&(n.push(`client_id configured`),T(e,t)?.clientSecret&&n.push(`client_secret configured`)),t.oauth.callbackPort&&n.push(`callback_port ${t.oauth.callbackPort}`),console.log(` OAuth: ${n.join(`, `)}`)}}else if(t.type===`http`){if(console.log(` Type: http`),console.log(` URL: ${t.url}`),t.headers){console.log(` Headers:`);for(let[e,n]of Object.entries(t.headers))console.log(` ${e}: ${n}`)}if(t.oauth?.clientId||t.oauth?.callbackPort){let n=[];t.oauth.clientId&&(n.push(`client_id configured`),T(e,t)?.clientSecret&&n.push(`client_secret configured`)),t.oauth.callbackPort&&n.push(`callback_port ${t.oauth.callbackPort}`),console.log(` OAuth: ${n.join(`, `)}`)}}else if(t.type===`stdio`){console.log(` Type: stdio`),console.log(` Command: ${t.command}`);let e=Array.isArray(t.args)?t.args:[];if(console.log(` Args: ${e.join(` `)}`),t.env){console.log(` Environment:`);for(let[e,n]of Object.entries(t.env))console.log(` ${e}=${n}`)}}console.log(`\nTo remove this server, run: claude mcp remove "${e}" -s ${t.scope}`),await S(0)}async function _e(e,t,n){try{let r=D(n.scope),i=ce(t),a=n.clientSecret&&i&&typeof i==`object`&&`type`in i&&(i.type===`sse`||i.type===`http`)&&`url`in i&&typeof i.url==`string`&&`oauth`in i&&i.oauth&&typeof i.oauth==`object`&&`clientId`in i.oauth?await E():void 0;await p(e,i,r);let o=i&&typeof i==`object`&&`type`in i?String(i.type||`stdio`):`stdio`;a&&i&&typeof i==`object`&&`type`in i&&(i.type===`sse`||i.type===`http`)&&`url`in i&&typeof i.url==`string`&&j(e,{type:i.type,url:i.url},a),K(`tengu_mcp_add`,{scope:r,source:`json`,type:o}),J(`Added ${o} MCP server ${e} to ${r} config`)}catch(e){Y(e.message)}}async function ve(e){try{let t=D(e.scope);K(`tengu_mcp_add`,{scope:t,platform:U(),source:`desktop`});let{readClaudeDesktopMcpServers:n}=await import(`./claudeDesktop-DQXL5bGm.js`),r=await n();Object.keys(r).length===0&&J(`No MCP servers found in Claude Desktop configuration or configuration file does not exist.`);let{unmount:i}=await l((0,Z.jsx)(O,{children:(0,Z.jsx)(M,{children:(0,Z.jsx)(pe,{servers:r,scope:t,onDone:()=>{i()}})})}),{exitOnCtrlC:!0})}catch(e){Y(e.message)}}async function ye(){K(`tengu_mcp_reset_mcpjson_choices`,{}),B(e=>({...e,enabledMcpjsonServers:[],disabledMcpjsonServers:[],enableAllProjectMcpServers:!1})),J(`All project-scoped (.mcp.json) server approvals and rejections have been reset.
|
|
6
|
+
You will be prompted for approval next time you start Work Mate.`)}export{ve as mcpAddFromDesktopHandler,_e as mcpAddJsonHandler,$ as mcpGetHandler,ge as mcpListHandler,he as mcpRemoveHandler,ye as mcpResetChoicesHandler,me as mcpServeHandler};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{$w as e,CT as t,FT as n,G as r,Hg as i,LS as a,MT as o,Mv as s,NT as c,OT as ee,PT as l,Ql as u,Qw as d,RS as f,ST as p,TT as m,Ug as h,W as g,Xx as te,Zl as ne,Zx as re,_T as _,aT as v,aa as y,bT as b,cT as x,dT as S,eT as C,eo as w,fT as T,hT as E,hc as D,hl as O,iT as k,ia as A,jT as j,jv as M,kT as N,ka as P,lT as F,mc as I,ml as L,nT as R,oT as z,pT as B,rT as V,sT as H,tT as U,uT as W,vT as G,wT as K,xT as q,yT as J}from"./loadAgentsDir-ByO8eJqU.js";import{S as Y,w as X}from"./debug-RZ4NuXyS.js";import{o as ie,s as ae}from"./log-CZ0zYP_c.js";import{_ as oe,u as se}from"./model-CwO-g1RW.js";import{bn as Z,xn as Q,yn as ce}from"./prompt-B7joRiqj.js";import $ from"node:process";c(),H(),v(),j();var le=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},S,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},E,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)}};j(),V();var ue=class extends z{constructor(e,t){super(t),this._serverInfo=e,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(K.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 k,this.setRequestHandler(J,e=>this._oninitialize(e)),this.setNotificationHandler(b,()=>this.oninitialized?.()),this._capabilities.logging&&this.setRequestHandler(N,async(e,t)=>{let n=t.sessionId||t.requestInfo?.headers[`mcp-session-id`]||void 0,{level:r}=e.params,i=K.safeParse(r);return i.success&&this._loggingLevels.set(n,i.data),{}})}get experimental(){return this._experimental||(this._experimental={tasks:new le(this)}),this._experimental}registerCapabilities(e){if(this.transport)throw Error(`Cannot register capabilities after connecting to transport`);this._capabilities=x(this._capabilities,e)}setRequestHandler(e,t){let r=o(e)?.method;if(!r)throw Error(`Schema is missing a method literal`);let i;if(l(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(e,async(e,r)=>{let i=n(F,e);if(!i.success){let e=i.error instanceof Error?i.error.message:String(i.error);throw new m(G.InvalidParams,`Invalid tools/call request: ${e}`)}let{params:a}=i.data,o=await Promise.resolve(t(e,r));if(a.task){let e=n(B,o);if(!e.success){let t=e.error instanceof Error?e.error.message:String(e.error);throw new m(G.InvalidParams,`Invalid task creation result: ${t}`)}return e.data}let s=n(W,o);if(!s.success){let e=s.error instanceof Error?s.error.message:String(s.error);throw new m(G.InvalidParams,`Invalid tools/call result: ${e}`)}return s.data}):super.setRequestHandler(e,t)}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){U(this._clientCapabilities?.tasks?.requests,e,`Client`)}assertTaskHandlerCapability(e){this._capabilities&&R(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:ee.includes(t)?t:q,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`},_)}async createMessage(e,t){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,t):this.request({method:`sampling/createMessage`,params:e},S,t)}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},E,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},E,t);if(r.action===`accept`&&r.content&&n.requestedSchema)try{let e=this._jsonSchemaValidator.getValidator(n.requestedSchema)(r.content);if(!e.valid)throw new m(G.InvalidParams,`Elicitation response content does not match requested schema: ${e.errorMessage}`)}catch(e){throw e instanceof m?e:new m(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},p,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`})}};e();var de=class{constructor(e=$.stdin,t=$.stdout){this._stdin=e,this._stdout=t,this._readBuffer=new d,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=C(e);this._stdout.write(n)?t():this._stdout.once(`drain`,t)})}};j(),D(),A(),Q(),O(),f(),re(),ie(),w(),oe(),r(),M(),Y(),u(),i();var fe=[y];async function pe(e,n,r){let i=te(100);s(e);let o=new ue({name:`claude/tengu`,version:`0.0.8`},{capabilities:{tools:{}}});o.setRequestHandler(t,async()=>{let e=Z(),t=L(e);return{tools:await Promise.all(t.map(async n=>{let r;if(n.outputSchema){let e=h(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:h(n.inputSchema),outputSchema:r}}))}}),o.setRequestHandler(F,async({params:{name:e,arguments:t}})=>{let o=L(Z()),s=ce(o,e);if(!s)throw Error(`Tool ${e} not found`);let c={abortController:a(),options:{commands:fe,tools:o,mainLoopModel:se(),thinkingConfig:{type:`disabled`},mcpClients:[],mcpResources:{},isNonInteractiveSession:!0,debug:n,verbose:r,agentDefinitions:{activeAgents:[],allAgents:[]}},getAppState:()=>I(),setAppState:()=>{},messages:[],readFileState:i,setInProgressToolUseIDs:()=>{},setResponseLength:()=>{},updateFileHistoryState:()=>{},updateAttributionState:()=>{}};try{if(!s.isEnabled())throw Error(`Tool ${e} is not enabled`);let n=await s.validateInput?.(t??{},c);if(n&&!n.result)throw Error(`Tool ${e} input is invalid: ${`message`in n?n.message:String(n)}`);let r=await s.call(t??{},c,g,P({content:[]}));return{content:[{type:`text`,text:typeof r==`string`?r:X(r.data)}]}}catch(e){return ae(e),{isError:!0,content:[{type:`text`,text:(e instanceof Error?ne(e):[String(e)]).filter(Boolean).join(`
|
|
2
|
+
`).trim()||`Error`}]}}});async function c(){let e=new de;await o.connect(e)}return await c()}export{pe as startMCPServer};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{n as t,t as n}from"./defineProperty-C-QyHrDq.js";import{a as r,c as i,i as a,n as o,o as s,r as c,s as l,t as u}from"./classPrivateFieldSet2-D4U5K-I3.js";import{n as d,t as f}from"./classPrivateMethodInitSpec-BXQD0Vh4.js";import{S as p,w as m}from"./debug-RZ4NuXyS.js";import{o as h,s as g}from"./log-CZ0zYP_c.js";import{channel as ee,tracingChannel as _}from"node:diagnostics_channel";function te(){let e=new Ne(c(T,this)),t=new Ne(c(T,this));u(W,this,e),u(U,this,t);let n=this.ttlAutopurge?Array.from({length:c(T,this)}):void 0;u(G,this,n),u(ye,this,(n,r,a=c(A,this).now())=>{t[n]=r===0?0:a,e[n]=r,i(n,r)}),u(ve,this,n=>{t[n]=e[n]===0?0:c(A,this).now(),i(n,e[n])});let i=this.ttlAutopurge?(e,t)=>{if(n?.[e]&&(clearTimeout(n[e]),n[e]=void 0),t&&t!==0&&n){let a=setTimeout(()=>{c(Z,this).call(this,e)?(r(Y,this,w).call(this,c(P,this)[e],`expire`),n[e]=void 0):i(e,s(e))},t+1);a.unref&&a.unref(),n[e]=a}}:()=>{};u(X,this,(n,r)=>{if(e[r]){let i=e[r],s=t[r];if(!i||!s)return;n.ttl=i,n.start=s,n.now=a||o(),n.remainingTTL=i-(n.now-s)}});let a=0,o=()=>{let e=c(A,this).now();if(this.ttlResolution>0){a=e;let t=setTimeout(()=>a=0,this.ttlResolution);t.unref&&t.unref()}return e};this.getRemainingTTL=e=>{let t=c(N,this).get(e);return t===void 0?0:s(t)};let s=n=>{let r=e[n],i=t[n];return!r||!i?1/0:r-((a||o())-i)};u(Z,this,n=>{let r=t[n],i=e[n];return!!i&&!!r&&(a||o())-r>i})}function ne(){let e=new Ne(c(T,this));u(M,this,0),u(H,this,e),u(be,this,t=>{u(M,this,c(M,this)-e[t]),e[t]=0}),u(Se,this,(e,t,n,i)=>{if(!$(n)){if(r(Y,this,S).call(this,t))return this.backgroundFetchSize;if(i){if(typeof i!=`function`)throw TypeError(`sizeCalculation must be a function`);if(n=i(t,e),!$(n))throw TypeError(`sizeCalculation return invalid (expect positive integer)`)}else throw TypeError(`invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.`)}return n}),u(xe,this,(t,n,i)=>{if(e[t]=n,c(E,this)){let n=c(E,this)-e[t];for(;c(M,this)>n;)r(Y,this,x).call(this,!0)}u(M,this,c(M,this)+e[t]),i&&(i.entrySize=n,i.totalCalculatedSize=c(M,this))})}function*v({allowStale:e=this.allowStale}={}){if(c(j,this))for(let t=c(z,this);r(Y,this,re).call(this,t)&&((e||!c(Z,this).call(this,t))&&(yield t),t!==c(R,this));)t=c(L,this)[t]}function*y({allowStale:e=this.allowStale}={}){if(c(j,this))for(let t=c(R,this);r(Y,this,re).call(this,t)&&((e||!c(Z,this).call(this,t))&&(yield t),t!==c(z,this));)t=c(I,this)[t]}function re(e){return e!==void 0&&c(N,this).get(c(P,this)[e])===e}function b(e,t,n,i){var a;let{ttl:o=this.ttl,start:s,noDisposeOnSet:l=this.noDisposeOnSet,sizeCalculation:d=this.sizeCalculation,status:f}=n,p=r(Y,this,S).call(this,t);if(t===void 0)return f&&(f.set=`deleted`),this.delete(e),this;let{noUpdateTTL:m=this.noUpdateTTL}=n;f&&!p&&(f.value=t);let h=c(Se,this).call(this,e,t,n.size||0,d,f);if(this.maxEntrySize&&h>this.maxEntrySize)return r(Y,this,w).call(this,e,`set`),f&&(f.set=`miss`,f.maxEntrySizeExceeded=!0),this;let g=c(j,this)===0?void 0:c(N,this).get(e);if(g===void 0)g=c(j,this)===0?c(z,this):c(B,this).length===0?c(j,this)===c(T,this)?r(Y,this,x).call(this,!1):c(j,this):c(B,this).pop(),c(P,this)[g]=e,c(F,this)[g]=t,c(N,this).set(e,g),c(I,this)[c(z,this)]=g,c(L,this)[g]=c(z,this),u(z,this,g),u(j,this,(a=c(j,this),a++,a)),c(xe,this).call(this,g,h,f),f&&(f.set=`add`),m=!1,c(J,this)&&!p&&c(O,this)?.call(this,t,e,`add`);else{r(Y,this,de).call(this,g);let n=c(F,this)[g];if(t!==n){if(!l)if(r(Y,this,S).call(this,n)){n!==i&&n.__abortController.abort(Error(`replaced`));let{__staleWhileFetching:r}=n;r!==void 0&&r!==t&&(c(K,this)&&c(D,this)?.call(this,r,e,`set`),c(q,this)&&c(V,this)?.push([r,e,`set`]))}else c(K,this)&&c(D,this)?.call(this,n,e,`set`),c(q,this)&&c(V,this)?.push([n,e,`set`]);if(c(be,this).call(this,g),c(xe,this).call(this,g,h,f),c(F,this)[g]=t,!p){let i=n&&r(Y,this,S).call(this,n)?n.__staleWhileFetching:n,a=i===void 0?`add`:t===i?`update`:`replace`;f&&(f.set=a,i!==void 0&&(f.oldValue=i)),c(J,this)&&this.onInsert?.(t,e,a)}}else p||(f&&(f.set=`update`),c(J,this)&&this.onInsert?.(t,e,`update`))}if(o!==0&&!c(W,this)&&r(Y,this,te).call(this),c(W,this)&&(m||c(ye,this).call(this,g,o,s),f&&c(X,this).call(this,f,g)),!l&&c(q,this)&&c(V,this)){let e=c(V,this),t;for(;t=e?.shift();)c(k,this)?.call(this,...t)}return this}function x(e){var t;let n=c(R,this),i=c(P,this)[n],a=c(F,this)[n],o=r(Y,this,S).call(this,a);o&&a.__abortController.abort(Error(`evicted`));let s=o?a.__staleWhileFetching:a;return(c(K,this)||c(q,this))&&s!==void 0&&(c(K,this)&&c(D,this)?.call(this,s,i,`evict`),c(q,this)&&c(V,this)?.push([s,i,`evict`])),c(be,this).call(this,n),c(G,this)?.[n]&&(clearTimeout(c(G,this)[n]),c(G,this)[n]=void 0),e&&(c(P,this)[n]=void 0,c(F,this)[n]=void 0,c(B,this).push(n)),c(j,this)===1?(u(R,this,u(z,this,0)),c(B,this).length=0):u(R,this,c(I,this)[n]),c(N,this).delete(i),u(j,this,(t=c(j,this),t--,t)),n}function ie(e,t={}){let{updateAgeOnHas:n=this.updateAgeOnHas,status:i}=t,a=c(N,this).get(e);if(a!==void 0){let e=c(F,this)[a];if(r(Y,this,S).call(this,e)&&e.__staleWhileFetching===void 0)return!1;if(c(Z,this).call(this,a))i&&(i.has=`stale`,c(X,this).call(this,i,a));else return n&&c(ve,this).call(this,a),i&&(i.has=`hit`,c(X,this).call(this,i,a)),!0}else i&&(i.has=`miss`);return!1}function ae(e,t){let{status:n,allowStale:i=this.allowStale}=t,a=c(N,this).get(e);if(a===void 0||!i&&c(Z,this).call(this,a)){n&&(n.peek=a===void 0?`miss`:`stale`);return}let o=c(F,this)[a],s=r(Y,this,S).call(this,o)?o.__staleWhileFetching:o;return n&&(s===void 0?n.peek=`miss`:(n.peek=`hit`,n.value=s)),s}function oe(e,t,n,i){let a=t===void 0?void 0:c(F,this)[t];if(r(Y,this,S).call(this,a))return a;let o=new AbortController,{signal:s}=n;s?.addEventListener(`abort`,()=>o.abort(s.reason),{signal:o.signal});let l={signal:o.signal,options:n,context:i},u=(i,a=!1)=>{let{aborted:s}=o.signal,u=n.ignoreFetchAbort&&i!==void 0,d=n.ignoreFetchAbort||!!(n.allowStaleOnFetchAbort&&i!==void 0);if(n.status&&(s&&!a?(n.status.fetchAborted=!0,n.status.fetchError=o.signal.reason,u&&(n.status.fetchAbortIgnored=!0)):n.status.fetchResolved=!0),s&&!u&&!a)return f(o.signal.reason,d);let p=m,h=c(F,this)[t];return(h===m||h===void 0&&u&&a)&&(i===void 0?p.__staleWhileFetching===void 0?r(Y,this,w).call(this,e,`fetch`):c(F,this)[t]=p.__staleWhileFetching:(n.status&&(n.status.fetchUpdated=!0),r(Y,this,b).call(this,e,i,l.options,p))),i},d=e=>(n.status&&(n.status.fetchRejected=!0,n.status.fetchError=e),f(e,!1)),f=(i,a)=>{let{aborted:s}=o.signal,l=s&&n.allowStaleOnFetchAbort,u=l||n.allowStaleOnFetchRejection,d=u||n.noDeleteOnFetchRejection,f=m;if(c(F,this)[t]===m&&(!d||!a&&f.__staleWhileFetching===void 0?r(Y,this,w).call(this,e,`fetch`):l||(c(F,this)[t]=f.__staleWhileFetching)),u)return n.status&&f.__staleWhileFetching!==void 0&&(n.status.returnedStale=!0),f.__staleWhileFetching;if(f.__returned===f)throw i},p=(t,r)=>{let i=c(he,this)?.call(this,e,a,l);o.signal.addEventListener(`abort`,()=>{(!n.ignoreFetchAbort||n.allowStaleOnFetchAbort)&&(t(void 0),n.allowStaleOnFetchAbort&&(t=e=>u(e,!0)))}),i&&i instanceof Promise?i.then(e=>t(e===void 0?void 0:e),r):i!==void 0&&t(i)};n.status&&(n.status.fetchDispatched=!0);let m=new Promise(p).then(u,d),h=Object.assign(m,{__abortController:o,__staleWhileFetching:a,__returned:void 0});return t===void 0?(r(Y,this,b).call(this,e,h,{...l.options,status:void 0}),t=c(N,this).get(e)):c(F,this)[t]=h,h}function S(e){if(!c(_e,this))return!1;let t=e;return!!t&&t instanceof Promise&&t.hasOwnProperty(`__staleWhileFetching`)&&t.__abortController instanceof AbortController}async function se(e,t={}){let{allowStale:n=this.allowStale,updateAgeOnGet:i=this.updateAgeOnGet,noDeleteOnStaleGet:a=this.noDeleteOnStaleGet,ttl:o=this.ttl,noDisposeOnSet:s=this.noDisposeOnSet,size:l=0,sizeCalculation:u=this.sizeCalculation,noUpdateTTL:d=this.noUpdateTTL,noDeleteOnFetchRejection:f=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:p=this.allowStaleOnFetchRejection,ignoreFetchAbort:m=this.ignoreFetchAbort,allowStaleOnFetchAbort:h=this.allowStaleOnFetchAbort,context:g,forceRefresh:ee=!1,status:_,signal:te}=t;if(_&&(_.op=`fetch`,_.key=e,ee&&(_.forceRefresh=!0),_.cache=this),!c(_e,this))return _&&(_.fetch=`get`),r(Y,this,C).call(this,e,{allowStale:n,updateAgeOnGet:i,noDeleteOnStaleGet:a,status:_});let ne={allowStale:n,updateAgeOnGet:i,noDeleteOnStaleGet:a,ttl:o,noDisposeOnSet:s,size:l,sizeCalculation:u,noUpdateTTL:d,noDeleteOnFetchRejection:f,allowStaleOnFetchRejection:p,allowStaleOnFetchAbort:h,ignoreFetchAbort:m,status:_,signal:te},v=c(N,this).get(e);if(v===void 0){_&&(_.fetch=`miss`);let t=r(Y,this,oe).call(this,e,v,ne,g);return t.__returned=t}else{let t=c(F,this)[v];if(r(Y,this,S).call(this,t)){let e=n&&t.__staleWhileFetching!==void 0;return _&&(_.fetch=`inflight`,e&&(_.returnedStale=!0)),e?t.__staleWhileFetching:t.__returned=t}let a=c(Z,this).call(this,v);if(!ee&&!a)return _&&(_.fetch=`hit`),r(Y,this,de).call(this,v),i&&c(ve,this).call(this,v),_&&c(X,this).call(this,_,v),t;let o=r(Y,this,oe).call(this,e,v,ne,g),s=o.__staleWhileFetching!==void 0&&n;return _&&(_.fetch=a?`stale`:`refresh`,s&&a&&(_.returnedStale=!0)),s?o.__staleWhileFetching:o.__returned=o}}async function ce(e,t={}){let n=await r(Y,this,se).call(this,e,t);if(n===void 0)throw Error(`fetch() returned undefined`);return n}function le(e,t={}){let n=c(ge,this);if(!n)throw Error(`no memoMethod provided to constructor`);let{context:i,status:a,forceRefresh:o,...s}=t;a&&o&&(a.forceRefresh=!0);let l=r(Y,this,C).call(this,e,s),u=o||l===void 0;if(a&&(a.memo=u?`miss`:`hit`,u||(a.value=l)),!u)return l;let d=n(e,l,{options:s,context:i});return a&&(a.value=d),r(Y,this,b).call(this,e,d,s),d}function C(e,t={}){let{allowStale:n=this.allowStale,updateAgeOnGet:i=this.updateAgeOnGet,noDeleteOnStaleGet:a=this.noDeleteOnStaleGet,status:o}=t,s=c(N,this).get(e);if(s===void 0){o&&(o.get=`miss`);return}let l=c(F,this)[s],u=r(Y,this,S).call(this,l);return o&&c(X,this).call(this,o,s),c(Z,this).call(this,s)?u?(o&&(o.get=`stale-fetching`),n&&l.__staleWhileFetching!==void 0?(o&&(o.returnedStale=!0),l.__staleWhileFetching):void 0):(a||r(Y,this,w).call(this,e,`expire`),o&&(o.get=`stale`),n?(o&&(o.returnedStale=!0),l):void 0):(o&&(o.get=u?`fetching`:`hit`),r(Y,this,de).call(this,s),i&&c(ve,this).call(this,s),u?l.__staleWhileFetching:l)}function ue(e,t){c(L,this)[t]=e,c(I,this)[e]=t}function de(e){e!==c(z,this)&&(e===c(R,this)?u(R,this,c(I,this)[e]):r(Y,this,ue).call(this,c(L,this)[e],c(I,this)[e]),r(Y,this,ue).call(this,c(z,this),e),u(z,this,e))}function w(e,t){Q.hasSubscribers&&Q.publish({op:`delete`,delete:t,key:e,cache:this});let n=!1;if(c(j,this)!==0){let a=c(N,this).get(e);if(a!==void 0)if(c(G,this)?.[a]&&(clearTimeout(c(G,this)[a]),c(G,this)[a]=void 0),n=!0,c(j,this)===1)r(Y,this,fe).call(this,t);else{var i;c(be,this).call(this,a);let n=c(F,this)[a];if(r(Y,this,S).call(this,n)?n.__abortController.abort(Error(`deleted`)):(c(K,this)||c(q,this))&&(c(K,this)&&c(D,this)?.call(this,n,e,t),c(q,this)&&c(V,this)?.push([n,e,t])),c(N,this).delete(e),c(P,this)[a]=void 0,c(F,this)[a]=void 0,a===c(z,this))u(z,this,c(L,this)[a]);else if(a===c(R,this))u(R,this,c(I,this)[a]);else{let e=c(L,this)[a];c(I,this)[e]=c(I,this)[a];let t=c(I,this)[a];c(L,this)[t]=c(L,this)[a]}u(j,this,(i=c(j,this),i--,i)),c(B,this).push(a)}}if(c(q,this)&&c(V,this)?.length){let e=c(V,this),t;for(;t=e?.shift();)c(k,this)?.call(this,...t)}return n}function fe(e){for(let t of r(Y,this,y).call(this,{allowStale:!0})){let n=c(F,this)[t];if(r(Y,this,S).call(this,n))n.__abortController.abort(Error(`deleted`));else{let r=c(P,this)[t];c(K,this)&&c(D,this)?.call(this,n,r,e),c(q,this)&&c(V,this)?.push([n,r,e])}}if(c(N,this).clear(),c(F,this).fill(void 0),c(P,this).fill(void 0),c(W,this)&&c(U,this)){c(W,this).fill(0),c(U,this).fill(0);for(let e of c(G,this)??[])e!==void 0&&clearTimeout(e);c(G,this)?.fill(void 0)}if(c(H,this)&&c(H,this).fill(0),u(R,this,0),u(z,this,0),c(B,this).length=0,u(M,this,0),u(j,this,0),c(q,this)&&c(V,this)){let e=c(V,this),t;for(;t=e?.shift();)c(k,this)?.call(this,...t)}}var pe,me,T,E,D,O,k,he,ge,A,j,M,N,P,F,I,L,R,z,B,V,H,U,W,G,K,_e,q,J,Y,ve,X,ye,Z,be,xe,Se,Ce,we,Q,Te,Ee,De,Oe,ke,Ae,je,$,Me,Ne,Pe,Fe,Ie=e((()=>{t(),s(),d(),i(),a(),o(),Q=ee(`lru-cache:metrics`),Te=_(`lru-cache`),Ee=typeof performance==`object`&&performance&&typeof performance.now==`function`?performance:Date,De=()=>Q.hasSubscribers||Te.hasSubscribers,Oe=new Set,ke=typeof process==`object`&&process?process:{},Ae=(e,t,n,r)=>{typeof ke.emitWarning==`function`?ke.emitWarning(e,t,n,r):console.error(`[${n}] ${t}: ${e}`)},je=e=>!Oe.has(e),$=e=>!!e&&e===Math.floor(e)&&e>0&&isFinite(e),Me=e=>$(e)?e<=2**8?Uint8Array:e<=2**16?Uint16Array:e<=2**32?Uint32Array:e<=2**53-1?Ne:null:null,Ne=class extends Array{constructor(e){super(e),this.fill(0)}},Pe=(pe=class e{static create(t){let n=Me(t);if(!n)return[];me._=r(pe,e,!0);let i=new e(t,n);return me._=r(pe,e,!1),i}constructor(t,i){if(n(this,`heap`,void 0),n(this,`length`,void 0),!r(pe,e,me)._)throw TypeError(`instantiate Stack using Stack.create(n)`);this.heap=new i(t),this.length=0}push(e){this.heap[this.length++]=e}pop(){return this.heap[--this.length]}},me={_:!1},pe),Fe=(T=new WeakMap,E=new WeakMap,D=new WeakMap,O=new WeakMap,k=new WeakMap,he=new WeakMap,ge=new WeakMap,A=new WeakMap,j=new WeakMap,M=new WeakMap,N=new WeakMap,P=new WeakMap,F=new WeakMap,I=new WeakMap,L=new WeakMap,R=new WeakMap,z=new WeakMap,B=new WeakMap,V=new WeakMap,H=new WeakMap,U=new WeakMap,W=new WeakMap,G=new WeakMap,K=new WeakMap,_e=new WeakMap,q=new WeakMap,J=new WeakMap,Y=new WeakSet,ve=new WeakMap,X=new WeakMap,ye=new WeakMap,Z=new WeakMap,be=new WeakMap,xe=new WeakMap,Se=new WeakMap,we=Symbol.iterator,Ce=Symbol.toStringTag,class e{get perf(){return c(A,this)}static unsafeExposeInternals(e){return{starts:c(U,e),ttls:c(W,e),autopurgeTimers:c(G,e),sizes:c(H,e),keyMap:c(N,e),keyList:c(P,e),valList:c(F,e),next:c(I,e),prev:c(L,e),get head(){return c(R,e)},get tail(){return c(z,e)},free:c(B,e),isBackgroundFetch:t=>r(Y,e,S).call(e,t),backgroundFetch:(t,n,i,a)=>r(Y,e,oe).call(e,t,n,i,a),moveToTail:t=>r(Y,e,de).call(e,t),indexes:t=>r(Y,e,v).call(e,t),rindexes:t=>r(Y,e,y).call(e,t),isStale:t=>c(Z,e).call(e,t)}}get max(){return c(T,this)}get maxSize(){return c(E,this)}get calculatedSize(){return c(M,this)}get size(){return c(j,this)}get fetchMethod(){return c(he,this)}get memoMethod(){return c(ge,this)}get dispose(){return c(D,this)}get onInsert(){return c(O,this)}get disposeAfter(){return c(k,this)}constructor(t){f(this,Y),l(this,T,void 0),l(this,E,void 0),l(this,D,void 0),l(this,O,void 0),l(this,k,void 0),l(this,he,void 0),l(this,ge,void 0),l(this,A,void 0),n(this,`ttl`,void 0),n(this,`ttlResolution`,void 0),n(this,`ttlAutopurge`,void 0),n(this,`updateAgeOnGet`,void 0),n(this,`updateAgeOnHas`,void 0),n(this,`allowStale`,void 0),n(this,`noDisposeOnSet`,void 0),n(this,`noUpdateTTL`,void 0),n(this,`maxEntrySize`,void 0),n(this,`sizeCalculation`,void 0),n(this,`noDeleteOnFetchRejection`,void 0),n(this,`noDeleteOnStaleGet`,void 0),n(this,`allowStaleOnFetchAbort`,void 0),n(this,`allowStaleOnFetchRejection`,void 0),n(this,`ignoreFetchAbort`,void 0),n(this,`backgroundFetchSize`,void 0),l(this,j,void 0),l(this,M,void 0),l(this,N,void 0),l(this,P,void 0),l(this,F,void 0),l(this,I,void 0),l(this,L,void 0),l(this,R,void 0),l(this,z,void 0),l(this,B,void 0),l(this,V,void 0),l(this,H,void 0),l(this,U,void 0),l(this,W,void 0),l(this,G,void 0),l(this,K,void 0),l(this,_e,void 0),l(this,q,void 0),l(this,J,void 0),l(this,ve,()=>{}),l(this,X,()=>{}),l(this,ye,()=>{}),l(this,Z,()=>!1),l(this,be,e=>{}),l(this,xe,(e,t,n)=>{}),l(this,Se,(e,t,n,r)=>{if(n||r)throw TypeError(`cannot set size without setting maxSize or maxEntrySize on cache`);return 0}),n(this,Ce,`LRUCache`);let{max:i=0,ttl:a,ttlResolution:o=1,ttlAutopurge:s,updateAgeOnGet:d,updateAgeOnHas:p,allowStale:m,dispose:h,onInsert:g,disposeAfter:ee,noDisposeOnSet:_,noUpdateTTL:v,maxSize:y=0,maxEntrySize:re=0,sizeCalculation:b,fetchMethod:x,memoMethod:ie,noDeleteOnFetchRejection:ae,noDeleteOnStaleGet:oe,allowStaleOnFetchRejection:S,allowStaleOnFetchAbort:se,ignoreFetchAbort:ce,backgroundFetchSize:le=1,perf:C}=t;if(this.backgroundFetchSize=le,C!==void 0&&typeof C?.now!=`function`)throw TypeError(`perf option must have a now() method if specified`);if(u(A,this,C??Ee),i!==0&&!$(i))throw TypeError(`max option must be a nonnegative integer`);let ue=i?Me(i):Array;if(!ue)throw Error(`invalid max value: `+i);if(u(T,this,i),u(E,this,y),this.maxEntrySize=re||c(E,this),this.sizeCalculation=b,this.sizeCalculation){if(!c(E,this)&&!this.maxEntrySize)throw TypeError(`cannot set sizeCalculation without setting maxSize or maxEntrySize`);if(typeof this.sizeCalculation!=`function`)throw TypeError(`sizeCalculation set to non-function`)}if(ie!==void 0&&typeof ie!=`function`)throw TypeError(`memoMethod must be a function if defined`);if(u(ge,this,ie),x!==void 0&&typeof x!=`function`)throw TypeError(`fetchMethod must be a function if specified`);if(u(he,this,x),u(_e,this,!!x),u(N,this,new Map),u(P,this,Array.from({length:i}).fill(void 0)),u(F,this,Array.from({length:i}).fill(void 0)),u(I,this,new ue(i)),u(L,this,new ue(i)),u(R,this,0),u(z,this,0),u(B,this,Pe.create(i)),u(j,this,0),u(M,this,0),typeof h==`function`&&u(D,this,h),typeof g==`function`&&u(O,this,g),typeof ee==`function`?(u(k,this,ee),u(V,this,[])):(u(k,this,void 0),u(V,this,void 0)),u(K,this,!!c(D,this)),u(J,this,!!c(O,this)),u(q,this,!!c(k,this)),this.noDisposeOnSet=!!_,this.noUpdateTTL=!!v,this.noDeleteOnFetchRejection=!!ae,this.allowStaleOnFetchRejection=!!S,this.allowStaleOnFetchAbort=!!se,this.ignoreFetchAbort=!!ce,this.maxEntrySize!==0){if(c(E,this)!==0&&!$(c(E,this)))throw TypeError(`maxSize must be a positive integer if specified`);if(!$(this.maxEntrySize))throw TypeError(`maxEntrySize must be a positive integer if specified`);r(Y,this,ne).call(this)}if(this.allowStale=!!m,this.noDeleteOnStaleGet=!!oe,this.updateAgeOnGet=!!d,this.updateAgeOnHas=!!p,this.ttlResolution=$(o)||o===0?o:1,this.ttlAutopurge=!!s,this.ttl=a||0,this.ttl){if(!$(this.ttl))throw TypeError(`ttl must be a positive integer if specified`);r(Y,this,te).call(this)}if(c(T,this)===0&&this.ttl===0&&c(E,this)===0)throw TypeError(`At least one of max, maxSize, or ttl is required`);if(!this.ttlAutopurge&&!c(T,this)&&!c(E,this)){let t=`LRU_CACHE_UNBOUNDED`;je(t)&&(Oe.add(t),Ae(`TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.`,`UnboundedCacheWarning`,t,e))}}getRemainingTTL(e){return c(N,this).has(e)?1/0:0}*entries(){for(let e of r(Y,this,v).call(this))c(F,this)[e]!==void 0&&c(P,this)[e]!==void 0&&!r(Y,this,S).call(this,c(F,this)[e])&&(yield[c(P,this)[e],c(F,this)[e]])}*rentries(){for(let e of r(Y,this,y).call(this))c(F,this)[e]!==void 0&&c(P,this)[e]!==void 0&&!r(Y,this,S).call(this,c(F,this)[e])&&(yield[c(P,this)[e],c(F,this)[e]])}*keys(){for(let e of r(Y,this,v).call(this)){let t=c(P,this)[e];t!==void 0&&!r(Y,this,S).call(this,c(F,this)[e])&&(yield t)}}*rkeys(){for(let e of r(Y,this,y).call(this)){let t=c(P,this)[e];t!==void 0&&!r(Y,this,S).call(this,c(F,this)[e])&&(yield t)}}*values(){for(let e of r(Y,this,v).call(this))c(F,this)[e]!==void 0&&!r(Y,this,S).call(this,c(F,this)[e])&&(yield c(F,this)[e])}*rvalues(){for(let e of r(Y,this,y).call(this))c(F,this)[e]!==void 0&&!r(Y,this,S).call(this,c(F,this)[e])&&(yield c(F,this)[e])}[we](){return this.entries()}find(e,t={}){for(let n of r(Y,this,v).call(this)){let i=c(F,this)[n],a=r(Y,this,S).call(this,i)?i.__staleWhileFetching:i;if(a!==void 0&&e(a,c(P,this)[n],this))return r(Y,this,C).call(this,c(P,this)[n],t)}}forEach(e,t=this){for(let n of r(Y,this,v).call(this)){let i=c(F,this)[n],a=r(Y,this,S).call(this,i)?i.__staleWhileFetching:i;a!==void 0&&e.call(t,a,c(P,this)[n],this)}}rforEach(e,t=this){for(let n of r(Y,this,y).call(this)){let i=c(F,this)[n],a=r(Y,this,S).call(this,i)?i.__staleWhileFetching:i;a!==void 0&&e.call(t,a,c(P,this)[n],this)}}purgeStale(){let e=!1;for(let t of r(Y,this,y).call(this,{allowStale:!0}))c(Z,this).call(this,t)&&(r(Y,this,w).call(this,c(P,this)[t],`expire`),e=!0);return e}info(e){let t=c(N,this).get(e);if(t===void 0)return;let n=c(F,this)[t],i=r(Y,this,S).call(this,n)?n.__staleWhileFetching:n;if(i===void 0)return;let a={value:i};if(c(W,this)&&c(U,this)){let e=c(W,this)[t],n=c(U,this)[t];e&&n&&(a.ttl=e-(c(A,this).now()-n),a.start=Date.now())}return c(H,this)&&(a.size=c(H,this)[t]),a}dump(){let e=[];for(let t of r(Y,this,v).call(this,{allowStale:!0})){let n=c(P,this)[t],i=c(F,this)[t],a=r(Y,this,S).call(this,i)?i.__staleWhileFetching:i;if(a===void 0||n===void 0)continue;let o={value:a};if(c(W,this)&&c(U,this)){o.ttl=c(W,this)[t];let e=c(A,this).now()-c(U,this)[t];o.start=Math.floor(Date.now()-e)}c(H,this)&&(o.size=c(H,this)[t]),e.unshift([n,o])}return e}load(e){this.clear();for(let[t,n]of e){if(n.start){let e=Date.now()-n.start;n.start=c(A,this).now()-e}r(Y,this,b).call(this,t,n.value,n)}}set(e,t,n={}){let{status:i=Q.hasSubscribers?{}:void 0}=n;n.status=i,i&&(i.op=`set`,i.key=e,t!==void 0&&(i.value=t),i.cache=this);let a=r(Y,this,b).call(this,e,t,n);return i&&Q.hasSubscribers&&Q.publish(i),a}pop(){try{for(;c(j,this);){let e=c(F,this)[c(R,this)];if(r(Y,this,x).call(this,!0),r(Y,this,S).call(this,e)){if(e.__staleWhileFetching)return e.__staleWhileFetching}else if(e!==void 0)return e}}finally{if(c(q,this)&&c(V,this)){let e=c(V,this),t;for(;t=e?.shift();)c(k,this)?.call(this,...t)}}}has(e,t={}){let{status:n=Q.hasSubscribers?{}:void 0}=t;t.status=n,n&&(n.op=`has`,n.key=e,n.cache=this);let i=r(Y,this,ie).call(this,e,t);return Q.hasSubscribers&&Q.publish(n),i}peek(e,t={}){let{status:n=De()?{}:void 0}=t;n&&(n.op=`peek`,n.key=e,n.cache=this),t.status=n;let i=r(Y,this,ae).call(this,e,t);return Q.hasSubscribers&&Q.publish(n),i}fetch(e,t={}){let n=Te.hasSubscribers,{status:i=De()?{}:void 0}=t;t.status=i,i&&t.context&&(i.context=t.context);let a=r(Y,this,se).call(this,e,t);return i&&n&&(i.trace=!0,Te.tracePromise(()=>a,i).catch(()=>{})),a}forceFetch(e,t={}){let n=Te.hasSubscribers,{status:i=De()?{}:void 0}=t;t.status=i,i&&t.context&&(i.context=t.context);let a=r(Y,this,ce).call(this,e,t);return i&&n&&(i.trace=!0,Te.tracePromise(()=>a,i).catch(()=>{})),a}memo(e,t={}){let{status:n=Q.hasSubscribers?{}:void 0}=t;t.status=n,n&&(n.op=`memo`,n.key=e,t.context&&(n.context=t.context),n.cache=this);let i=r(Y,this,le).call(this,e,t);return n&&(n.value=i),Q.hasSubscribers&&Q.publish(n),i}get(e,t={}){let{status:n=Q.hasSubscribers?{}:void 0}=t;t.status=n,n&&(n.op=`get`,n.key=e,n.cache=this);let i=r(Y,this,C).call(this,e,t);return n&&(i!==void 0&&(n.value=i),Q.hasSubscribers&&Q.publish(n)),i}delete(e){return r(Y,this,w).call(this,e,`delete`)}clear(){return r(Y,this,fe).call(this,`delete`)}})}));function Le(e,t=300*1e3){let n=new Map,r=new Map,i=async(...i)=>{let a=m(i),o=n.get(a),s=Date.now();if(!o){let t=r.get(a);if(t)return t;let o=e(...i);r.set(a,o);try{let e=await o;return r.get(a)===o&&n.set(a,{value:e,timestamp:s,refreshing:!1}),e}finally{r.get(a)===o&&r.delete(a)}}if(o&&s-o.timestamp>t&&!o.refreshing){o.refreshing=!0;let t=o;return e(...i).then(e=>{n.get(a)===t&&n.set(a,{value:e,timestamp:Date.now(),refreshing:!1})}).catch(e=>{g(e),n.get(a)===t&&n.delete(a)}),o.value}return n.get(a).value};return i.cache={clear:()=>{n.clear(),r.clear()}},i}function Re(e,t,n=100){let r=new Fe({max:n}),i=(...n)=>{let i=t(...n),a=r.get(i);if(a!==void 0)return a;let o=e(...n);return r.set(i,o),o};return i.cache={clear:()=>r.clear(),size:()=>r.size,delete:e=>r.delete(e),get:e=>r.peek(e),has:e=>r.has(e)},i}var ze=e((()=>{Ie(),h(),p()}));export{Ie as a,Fe as i,Re as n,Le as r,ze as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{n,o as r}from"./envUtils-DSxRz_kt.js";import{I as i,Lt as a,P as o,Wt as s,_ as c,di as l,fi as u,t as d,ui as f,y as p}from"./src-CDCSSo0U2.js";import{t as m}from"./jsx-runtime-Bb4Xn-E0.js";import{$t as h,tt as g}from"./state-C2OSZkV1.js";import{Hx as _,Pw as v,Rp as y,Un as b,Vn as ee,Wx as x,_v as S,bu as C,el as w,fw as T,mw as te,tl as ne,vv as E,xu as re,zp as ie,zx as D}from"./loadAgentsDir-ByO8eJqU.js";import{n as O,t as k}from"./cwd-C5ce-7WB.js";import{I as A,z as j}from"./debug-RZ4NuXyS.js";import{Cn as M,bn as ae,g as N,x as P}from"./settings-hQDLwPVj.js";import{I as F,P as I,j as L}from"./config-CE058cvr.js";import{m as R,r as z}from"./git-BerW9bId.js";import{o as oe,s as se}from"./log-CZ0zYP_c.js";import{n as ce,r as B}from"./analytics-CkYUHW_U.js";import{h as V,y as H}from"./startupProfiler-DCn_NxMH.js";import{n as U,t as W}from"./useExitOnCtrlCDWithKeybindings-Cce612uS.js";import{r as le,t as ue}from"./promptEditor-R_acDAgI.js";import{homedir as de}from"os";import{join as G,relative as fe}from"path";import{mkdir as K,writeFile as pe}from"fs/promises";function me(e){return z(e)!==null}var he=e((()=>{R()}));function ge({onSelect:e,onCancel:t}){let r=(0,q.use)(_()),a=G(n(),`CLAUDE.md`),l=G(g(),`CLAUDE.md`),u=r.some(e=>e.path===a),d=r.some(e=>e.path===l),p=[...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}]],m=new Map,h=p.map(e=>{let t=ae(e.path),n=e.exists?``:` (new)`,r=e.parent?(m.get(e.parent)??0)+1:0;m.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=me(g());return s=e.type===`User`&&!e.isNested?`Saved in ~/.claude/CLAUDE.md`:e.type===`Project`&&!e.isNested&&e.path===l?`${c?`Checked in at`:`Saved in`} ./CLAUDE.md`:e.parent?`@-imported`:e.isNested?`dynamically loaded`:``,{label:o,value:e.path,description:s}}),v=[],y=E(e=>e.agentDefinitions);if(F()){v.push({label:`Open auto-memory folder`,value:`${X}${L()}`,description:``});for(let e of y.activeAgents)if(e.memory){let t=ee(e.agentType,e.memory);v.push({label:`Open ${f.bold(e.agentType)} agent memory`,value:`${X}${t}`,description:`${e.memory} scope`})}}h.push(...v);let b=Y&&h.some(e=>e.value===Y)?Y:h[0]?.value||``,[x,S]=(0,q.useState)(F),[C,w]=(0,q.useState)(ne),[T]=(0,q.useState)(F),D=E(e=>Object.values(e.tasks).some(e=>e.type===`dream`&&e.status===`running`)),[O,k]=(0,q.useState)(null);(0,q.useEffect)(()=>{T&&re().then(k)},[T,D]);let A=D?`running`:O===null?``:O===0?`never`:`last ran ${V(new Date(O))}`,[j,M]=(0,q.useState)(null),N=j!==null,I=+!!T;function R(){let e=!x;P(`userSettings`,{autoMemoryEnabled:e}),S(e),B(`tengu_auto_memory_toggled`,{enabled:e})}function z(){let e=!C;P(`userSettings`,{autoDreamEnabled:e}),w(e),B(`tengu_auto_dream_toggled`,{enabled:e})}return U(),s(`confirm:no`,t,{context:`Confirmation`}),s(`confirm:yes`,()=>{j===0?R():j===1&&z()},{context:`Confirmation`,isActive:N}),s(`select:next`,()=>{M(e=>e!==null&&e<I?e+1:null)},{context:`Select`,isActive:N}),s(`select:previous`,()=>{M(e=>e!==null&&e>0?e-1:e)},{context:`Select`,isActive:N}),(0,J.jsxs)(i,{flexDirection:`column`,width:`100%`,children:[(0,J.jsxs)(i,{flexDirection:`column`,marginBottom:1,children:[(0,J.jsx)(c,{isFocused:j===0,children:(0,J.jsxs)(o,{children:[`Auto-memory: `,x?`on`:`off`]})}),T&&(0,J.jsx)(c,{isFocused:j===1,styled:!1,children:(0,J.jsxs)(o,{color:j===1?`suggestion`:void 0,children:[`Auto-dream: `,C?`on`:`off`,A&&(0,J.jsxs)(o,{dimColor:!0,children:[` · `,A]}),!D&&C&&(0,J.jsx)(o,{dimColor:!0,children:` · /dream to run`})]})})]}),(0,J.jsx)(ie,{defaultFocusValue:b,options:h,isDisabled:N,onChange:t=>{if(t.startsWith(X)){let e=t.slice(15);K(e,{recursive:!0}).catch(()=>{}).then(()=>te(e));return}Y=t,e(t)},onCancel:t,onUpFromFirstItem:()=>M(I)})]})}var q,J,Y,X,_e=e((()=>{l(),u(),q=t(u(),1),h(),W(),d(),v(),I(),ce(),w(),C(),S(),b(),T(),x(),r(),M(),H(),he(),N(),y(),J=m(),X=`__open_folder__`}));function ve(e){let t=de(),n=k(),r=e.startsWith(t)?`~`+e.slice(t.length):null,i=e.startsWith(n)?`./`+fe(n,e):null;return r&&i?r.length<=i.length?r:i:r||i||e}var ye=e((()=>{u(),d(),O(),m()}));function be({onDone:e}){let t=async t=>{try{t.includes(n())&&await K(n(),{recursive:!0});try{await pe(t,``,{encoding:`utf8`,flag:`wx`})}catch(e){if(A(e)!==`EEXIST`)throw e}await ue(t);let r=`default`,i=``;process.env.VISUAL?(r=`$VISUAL`,i=process.env.VISUAL):process.env.EDITOR&&(r=`$EDITOR`,i=process.env.EDITOR);let a=r==="default"?``:`Using ${r}="${i}".`,o=a?`> ${a} To change editor, set $EDITOR or $VISUAL environment variable.`:`> To use a different editor, set the $EDITOR or $VISUAL environment variable.`;e(`Opened memory file at ${ve(t)}\n\n${o}`,{display:`system`})}catch(t){se(t),e(`Error opening memory file: ${t}`)}},r=()=>{e(`Cancelled memory editing`,{display:`system`})};return(0,Q.jsx)(p,{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)(ge,{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.claude.com/docs/en/memory`})]})})]})})}var Z,Q,$;e((()=>{Z=t(u(),1),d(),_e(),ye(),x(),r(),j(),oe(),le(),Q=m(),$=async e=>(D(),await _(),(0,Q.jsx)(be,{onDone:e}))}))();export{$ as call};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{I as n,P as r,fi as i,t as a}from"./src-CDCSSo0U2.js";import{t as o}from"./jsx-runtime-Bb4Xn-E0.js";import{
|
|
2
|
-
`)}`,{display:`system`});return}
|
|
1
|
+
import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{I as n,P as r,fi as i,t as a}from"./src-CDCSSo0U2.js";import{t as o}from"./jsx-runtime-Bb4Xn-E0.js";import{Bp as s,dt as c,ft as l,mt as u,pt as d,zp as f}from"./loadAgentsDir-ByO8eJqU.js";function p({onDone:e}){let t=d(),i=c(),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){u(n);let r=t.find(e=>e.slug===n);e(`${r?.icon} Mode switched to: ${r?.name} (${r?.slug}) — ${r?.description}`,{display:`system`})}function s(){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:s,visibleOptionCount:t.length})]})}var m,h,g;e((()=>{m=t(i(),1),a(),s(),l(),h=o(),g=async(e,t,n)=>{let r=n?.trim().toLowerCase();if(r){let t=d(),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}u(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{_ as e,u as t}from"./model-CwO-g1RW.js";e();export{t as getMainLoopModel};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{di as n,fi as r,ui as i}from"./src-CDCSSo0U2.js";import{t as a}from"./jsx-runtime-Bb4Xn-E0.js";import{
|
|
1
|
+
import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{di as n,fi as r,ui as i}from"./src-CDCSSo0U2.js";import{t as a}from"./jsx-runtime-Bb4Xn-E0.js";import{Gd as o,Hl as s,Kd as c,Ul as l,_v as u,bv as d,qd as f,vv as p}from"./loadAgentsDir-ByO8eJqU.js";import{D as m,E as h,J as g}from"./log-CZ0zYP_c.js";import{n as _,r as v}from"./analytics-CkYUHW_U.js";import{F as y,K as b,M as x,N as S,P as C,_ as w,b as T,et as E,it as D,rt as O,s as k,tt as A,w as j}from"./model-CwO-g1RW.js";import{i as M,n as N,r as P,t as F}from"./extraUsage-Dw7AXiH7.js";function I({onDone:e}){let t=p(e=>e.mainLoopModel),n=p(e=>e.mainLoopModelForSession),r=p(e=>e.fastMode),a=d();function o(){v(`tengu_model_command_menu`,{action:`cancel`});let n=H(t);e(`Kept model as ${i.bold(n)}`,{display:`system`})}function s(n){v(`tengu_model_command_menu`,{action:n,from_model:t,to_model:n}),a(e=>({...e,mainLoopModel:n,mainLoopModelForSession:null}));let o=`Set model to ${i.bold(H(n))}`,s;O()&&(b(),!D(n)&&r?(a(e=>({...e,fastMode:!1})),s=!1):D(n)&&A()&&r&&(o+=` · Fast mode ON`,s=!0)),N(n,s===!0,T())&&(o+=` · Billed as extra usage`),s===!1&&(o+=` · Fast mode OFF`),e(o)}return(0,W.jsx)(P,{initial:t,sessionModel:n,onSelect:s,onCancel:o,isStandaloneCommand:!0,showFastModeNotice:O()&&r&&D(t)&&A()})}function L({args:e,onDone:t}){let n=p(e=>e.fastMode),r=d(),a=e==="default"?null:e;return U.useEffect(()=>{async function e(){if(a&&!S(a)){t(`Model '${a}' is not available. Your organization restricts model selection.`,{display:`system`});return}if(a&&z(a)){t(`Opus 4.7 with 1M context is not available for your account. Learn more: https://code.claude.com/docs/en/model-config#extended-context-with-1m`,{display:`system`});return}if(a&&B(a)){t(`Sonnet 4.6 with 1M context is not available for your account. Learn more: https://code.claude.com/docs/en/model-config#extended-context-with-1m`,{display:`system`});return}if(!a){o(null);return}if(R(a)){o(a);return}try{let{valid:e,error:n}=await l(a);e?o(a):t(n||`Model '${a}' not found`,{display:`system`})}catch(e){t(`Failed to validate model: ${e.message}`,{display:`system`})}}function o(e){r(t=>({...t,mainLoopModel:e,mainLoopModelForSession:null}));let a=`Set model to ${i.bold(H(e))}`,o;O()&&(b(),!D(e)&&n?(r(e=>({...e,fastMode:!1})),o=!1):D(e)&&n&&(a+=` · Fast mode ON`,o=!0)),N(e,o===!0,T())&&(a+=` · Billed as extra usage`),o===!1&&(a+=` · Fast mode OFF`),t(a)}e()},[a,t,r]),null}function R(e){return C.includes(e.toLowerCase().trim())}function z(e){let t=e.toLowerCase();return!o()&&!T()&&t.includes(`opus`)&&t.includes(`[1m]`)}function B(e){let t=e.toLowerCase();return!c()&&(t.includes(`sonnet[1m]`)||t.includes(`sonnet-4-6[1m]`))}function V({onDone:e}){let t=p(e=>e.mainLoopModel),n=p(e=>e.mainLoopModelForSession),r=H(t);return e(n?`Current model: ${i.bold(H(n))} (session override from plan mode)\nBase model: ${r}`:`Current model: ${r}`),null}function H(e){let t=j(e??k());return e===null?`${t} (default)`:t}var U,W,G;e((()=>{n(),U=t(r(),1),M(),g(),_(),u(),F(),E(),y(),f(),w(),x(),s(),W=a(),G=async(e,t,n)=>{if(n=n?.trim()||``,m.includes(n))return v(`tengu_model_command_inline_help`,{args:n}),(0,W.jsx)(V,{onDone:e});if(h.includes(n)){e(`Run /model to open the model selection menu, or /model [modelName] to set the model.`,{display:`system`});return}return n?(v(`tengu_model_command_inline`,{args:n}),(0,W.jsx)(L,{args:n,onDone:e})):(0,W.jsx)(I,{onDone:e})}}))();export{G as call};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e,o as t,r as n}from"./rolldown-runtime-DaDcL9Zw.js";import{n as r,t as i}from"./memoize-BK3gG5ob.js";import{d as a,i as o,l as s,n as c,o as l,s as u,t as d}from"./envUtils-DSxRz_kt.js";import{n as ee,t as f}from"./defineProperty-C-QyHrDq.js";import{n as p,t as m}from"./axios-DaWTGg7G.js";import{di as te,ui as ne}from"./src-CDCSSo0U2.js";import{A as re,C as ie,p as ae,w as oe}from"./external-CEp-aPkt.js";import{n as se,r as ce,t as le}from"./lazySchema-B4D4qJVE.js";import{$t as h,Dn as ue,Gn as de,H as fe,Jn as pe,Kr as me,Q as he,Y as ge,br as _e,et as ve,ft as ye,gn as be,mt as xe,on as Se,qr as Ce,y as we,yr as Te,z as g}from"./state-C2OSZkV1.js";import{C as Ee,E as De,F as _,G as Oe,I as ke,K as Ae,S as je,V as Me,a as v,c as Ne,d as Pe,l as y,p as Fe,s as Ie,w as Le,z as Re}from"./debug-RZ4NuXyS.js";import{Ut as ze,c as b,f as x,g as S,n as Be,x as Ve}from"./settings-hQDLwPVj.js";import{C as He,b as C,c as w,g as Ue,n as T,w as We}from"./config-CE058cvr.js";import{a as Ge,c as Ke,i as qe,o as Je,r as Ye,s as Xe,t as Ze}from"./execFileNoThrow-CCX-JY8h.js";import{d as Qe,f as $e,o as et,s as E}from"./log-CZ0zYP_c.js";import{r as tt,t as nt}from"./memoize-B8hfb1JN.js";import{s as rt,u as it}from"./types-D7_37tP2.js";import{n as at,r as D}from"./analytics-CkYUHW_U.js";import{l as O,n as ot,r as st,s as ct,t as lt,u as k}from"./oauth-BqJqV-2M.js";import{n as ut,t as dt}from"./bundledMode--fG1S62b.js";import{n as ft,o as pt}from"./stringUtils-B6FudhoZ.js";import{a as mt,i as ht,l as gt}from"./proxy-BmtEnJ02.js";import{userInfo as _t}from"os";import{join as vt}from"path";import{chmodSync as yt,mkdirSync as bt,readFileSync as xt,writeFileSync as St}from"fs";import{createHash as Ct,randomUUID as wt}from"crypto";import{mkdir as Tt,stat as Et,writeFile as Dt}from"fs/promises";import{exec as Ot,execFile as kt}from"child_process";import{AsyncLocalStorage as At}from"async_hooks";function A(e=Be()){let t=e.modelType;return t===`openai`?`openai`:t===`gemini`?`gemini`:t===`grok`?`grok`:s(process.env.CLAUDE_CODE_USE_BEDROCK)?`bedrock`:s(process.env.CLAUDE_CODE_USE_VERTEX)?`vertex`:s(process.env.CLAUDE_CODE_USE_FOUNDRY)?`foundry`:s(process.env.CLAUDE_CODE_USE_OPENAI)?`openai`:s(process.env.CLAUDE_CODE_USE_GEMINI)?`gemini`:s(process.env.CLAUDE_CODE_USE_GROK)?`grok`:`firstParty`}function jt(){return A()}function Mt(){let e=process.env.ANTHROPIC_BASE_URL;if(!e)return!0;try{let t=new URL(e).host,n=[`api.anthropic.com`];return process.env.USER_TYPE===`ant`&&n.push(`api-staging.anthropic.com`),n.includes(t)}catch{return!1}}var j=e((()=>{S(),l()}));function Nt(){return Ft.getStore()?.workload}function Pt(e,t){return Ft.run({workload:e},t)}var Ft,It=e((()=>{Ft=new At}));function Lt(){return process.env.USER_TYPE,null}function Rt(){return process.env.USER_TYPE===`ant`?Lt()?.antModels??[]:[]}function zt(e){if(process.env.USER_TYPE!==`ant`||e===void 0)return;let t=e.toLowerCase();return Rt().find(n=>n.alias===e||t.includes(n.model.toLowerCase()))}var Bt=e((()=>{}));function Vt(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 Ht=e((()=>{}));function Ut(e,t){return e.find(e=>e.includes(t))??null}async function Wt(){let{BedrockClient:e}=await import(`./dist-es-yHGBqhBe.js`),t=d(),n=s(process.env.CLAUDE_CODE_SKIP_BEDROCK_AUTH),r={region:t,...process.env.ANTHROPIC_BEDROCK_BASE_URL&&{endpoint:process.env.ANTHROPIC_BEDROCK_BASE_URL},...await ht(),...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`}]}};if(!n&&!process.env.AWS_BEARER_TOKEN_BEDROCK){let e=await G();e&&(r.credentials={accessKeyId:e.accessKeyId,secretAccessKey:e.secretAccessKey,sessionToken:e.sessionToken})}return new e(r)}async function Gt(){let{BedrockRuntimeClient:e}=await import(`./dist-es-Gt_DpXlP.js`),t=d(),n=s(process.env.CLAUDE_CODE_SKIP_BEDROCK_AUTH),r={region:t,...process.env.ANTHROPIC_BEDROCK_BASE_URL&&{endpoint:process.env.ANTHROPIC_BEDROCK_BASE_URL},...await ht(),...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`}]}};if(!n&&!process.env.AWS_BEARER_TOKEN_BEDROCK){let e=await G();e&&(r.credentials={accessKeyId:e.accessKeyId,secretAccessKey:e.secretAccessKey,sessionToken:e.sessionToken})}return new e(r)}function Kt(e){return e.startsWith(`anthropic.`)}function qt(e){if(!e.startsWith(`arn:`))return e;let t=e.lastIndexOf(`/`);return t===-1?e:e.substring(t+1)}function Jt(e){let t=qt(e);for(let e of Qt)if(t.startsWith(`${e}.anthropic.`))return e}function Yt(e,t){let n=Jt(e);return n?e.replace(`${n}.`,`${t}.`):Kt(e)?`${t}.${e}`:e}var Xt,Zt,Qt,$t=e((()=>{i(),q(),l(),et(),gt(),Xt=r(async function(){let[e,{ListInferenceProfilesCommand:t}]=await Promise.all([Wt(),import(`./dist-es-yHGBqhBe.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 E(e),e}}),Zt=r(async function(e){try{let[t,{GetInferenceProfileCommand:n}]=await Promise.all([Wt(),import(`./dist-es-yHGBqhBe.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 E(e),null}}),Qt=[`us`,`eu`,`apac`,`global`]})),en,tn,nn,rn,an,on,sn,cn,ln,un,dn,fn,pn,mn,hn=e((()=>{en={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`},tn={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`},nn={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`},rn={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`},an={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`},on={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`},sn={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`},cn={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`},ln={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`},un={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`},dn={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`},fn={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`},pn={haiku35:nn,haiku45:rn,sonnet35:tn,sonnet37:en,sonnet40:an,sonnet45:on,sonnet46:fn,opus40:sn,opus41:cn,opus45:ln,opus46:un,opus47:dn},Object.values(pn).map(e=>e.firstParty),mn=Object.fromEntries(Object.entries(pn).map(([e,t])=>[t.firstParty,e]))}));function gn(e){let t={};for(let n of Sn)t[n]=pn[n][e];return t}async function _n(){let e=gn(`bedrock`),t;try{t=await Xt()}catch(t){return E(t),e}if(!t?.length)return e;let n={};for(let r of Sn){let i=pn[r].firstParty;n[r]=Ut(t,i)||e[r]}return n}function vn(e){let t=Be().modelOverrides;if(!t)return e;let n={...e};for(let[e,r]of Object.entries(t)){let t=mn[e];t&&r&&(n[t]=r)}return n}function yn(e){let t;try{t=Be().modelOverrides}catch{return e}if(!t)return e;for(let[n,r]of Object.entries(t))if(r===e)return n;return e}function bn(){if(he()===null){if(A()!==`bedrock`){de(gn(A()));return}Cn()}}function M(){let e=he();return e===null?(bn(),vn(gn(A()))):vn(e)}async function xn(){if(he()===null){if(A()!==`bedrock`){de(gn(A()));return}await Cn()}}var Sn,Cn,wn=e((()=>{h(),et(),Ht(),S(),$t(),hn(),j(),Sn=Object.keys(pn),Cn=Vt(async()=>{if(he()===null)try{de(await _n())}catch(e){E(e)}})}));function Tn(){if(s(process.env.DISABLE_COST_WARNINGS)||B())return!1;let e=Oa(),t=R()!==null;if(!e.hasToken&&!t)return!1;let n=w(),r=n.oauthAccount?.organizationRole,i=n.oauthAccount?.workspaceRole;return!r||!i?!1:[`admin`,`billing`].includes(r)||[`workspace_admin`,`workspace_billing`].includes(i)}function En(e){On=e}function Dn(){if(On!==null)return On;if(!B())return!1;let e=V();if(e===`max`||e===`pro`)return!0;let t=w().oauthAccount?.organizationRole;return!!t&&[`admin`,`billing`,`owner`,`primary_owner`].includes(t)}var On,kn=e((()=>{q(),Ue(),l(),On=null}));function An(){return process.env.USER_TYPE===`ant`?process.env.CLAUDE_MOCK_HEADERLESS_429?process.env.CLAUDE_MOCK_HEADERLESS_429:Bn?Vn:null:null}function jn(){return!Bn||process.env.USER_TYPE!==`ant`||Object.keys(zn).length===0?null:zn}function Mn(){zn={},Kn=[],Hn=null,Un=null,Wn=null,Vn=null,En(null),Bn=!1}function Nn(e){let t=jn();if(!t)return e;let n=new globalThis.Headers(e);return Object.entries(t).forEach(([e,t])=>{t!==void 0&&n.set(e,t)}),n}function Pn(){return process.env.USER_TYPE===`ant`?Bn||!!process.env.CLAUDE_MOCK_HEADERLESS_429:!1}function Fn(){return!Bn||process.env.USER_TYPE!==`ant`?null:Hn||Gn}function In(){return Bn&&Hn!==null&&process.env.USER_TYPE===`ant`}function Ln(){return Un!==null}function Rn(e){if(Un===null||!e)return null;if(Wn!==null&&Date.now()>=Wn)return Mn(),null;Wn===null&&(Wn=Date.now()+Un);let t=Wn-Date.now(),n={...zn};return n[`retry-after`]=String(Math.max(1,Math.ceil(t/1e3))),n}var zn,Bn,Vn,Hn,Un,Wn,Gn,Kn,qn=e((()=>{kn(),zn={},Bn=!1,Vn=null,Hn=null,Un=null,Wn=null,Gn=`max`}));async function Jn(){let e=w().oauthAccount?.accountUuid,t=R();if(!e||!t)return;let n=`${O().BASE_API_URL}/api/claude_cli_profile`;try{return(await p.get(n,{headers:{"x-api-key":t,"anthropic-beta":ct},params:{account_uuid:e},timeout:1e4})).data}catch(e){E(e)}}async function Yn(e){let t=`${O().BASE_API_URL}/api/oauth/profile`;try{return(await p.get(t,{headers:{Authorization:`Bearer ${e}`,"Content-Type":`application/json`},timeout:1e4})).data}catch(e){E(e)}}var Xn=e((()=>{m(),k(),q(),Ue(),et()}));function Zn(e){return!!e?.includes(ot)}function Qn(e){return e?.split(` `).filter(Boolean)??[]}function $n({codeChallenge:e,state:t,port:n,isManual:r,loginWithClaudeAi:i,inferenceOnly:a,orgUUID:o,loginHint:s,loginMethod:c}){let l=i?O().CLAUDE_AI_AUTHORIZE_URL:O().CONSOLE_AUTHORIZE_URL,u=new URL(l);u.searchParams.append(`code`,`true`),u.searchParams.append(`client_id`,O().CLIENT_ID),u.searchParams.append(`response_type`,`code`),u.searchParams.append(`redirect_uri`,r?O().MANUAL_REDIRECT_URL:`http://localhost:${n}/callback`);let d=a?[ot]:lt;return u.searchParams.append(`scope`,d.join(` `)),u.searchParams.append(`code_challenge`,e),u.searchParams.append(`code_challenge_method`,`S256`),u.searchParams.append(`state`,t),o&&u.searchParams.append(`orgUUID`,o),s&&u.searchParams.append(`login_hint`,s),c&&u.searchParams.append(`login_method`,c),u.toString()}async function er(e,t,n,r,i=!1,a){let o={grant_type:`authorization_code`,code:e,redirect_uri:i?O().MANUAL_REDIRECT_URL:`http://localhost:${r}/callback`,client_id:O().CLIENT_ID,code_verifier:n,state:t};a!==void 0&&(o.expires_in=a);let s=await p.post(O().TOKEN_URL,o,{headers:{"Content-Type":`application/json`},timeout:15e3});if(s.status!==200)throw Error(s.status===401?`Authentication failed: Invalid authorization code`:`Token exchange failed (${s.status}): ${s.statusText}`);return D(`tengu_oauth_token_exchange_success`,{}),s.data}async function tr(e,{scopes:t}={}){let n={grant_type:`refresh_token`,refresh_token:e,client_id:O().CLIENT_ID,scope:(t?.length?t:st).join(` `)};try{let t=await p.post(O().TOKEN_URL,n,{headers:{"Content-Type":`application/json`},timeout:15e3});if(t.status!==200)throw Error(`Token refresh failed: ${t.statusText}`);let r=t.data,{access_token:i,refresh_token:a=e,expires_in:o}=r,s=Date.now()+o*1e3,c=Qn(r.scope);D(`tengu_oauth_token_refresh_success`,{});let l=w(),u=K(),d=l.oauthAccount?.billingType!==void 0&&l.oauthAccount?.accountCreatedAt!==void 0&&l.oauthAccount?.subscriptionCreatedAt!==void 0&&u?.subscriptionType!=null&&u?.rateLimitTier!=null?null:await ar(i);if(d&&l.oauthAccount){let e={};d.displayName!==void 0&&(e.displayName=d.displayName),typeof d.hasExtraUsageEnabled==`boolean`&&(e.hasExtraUsageEnabled=d.hasExtraUsageEnabled),d.billingType!==null&&(e.billingType=d.billingType),d.accountCreatedAt!==void 0&&(e.accountCreatedAt=d.accountCreatedAt),d.subscriptionCreatedAt!==void 0&&(e.subscriptionCreatedAt=d.subscriptionCreatedAt),Object.keys(e).length>0&&C(t=>({...t,oauthAccount:t.oauthAccount?{...t.oauthAccount,...e}:t.oauthAccount}))}return{accessToken:i,refreshToken:a,expiresAt:s,scopes:c,subscriptionType:d?.subscriptionType??u?.subscriptionType??null,rateLimitTier:d?.rateLimitTier??u?.rateLimitTier??null,profile:d?.rawProfile,tokenAccount:r.account?{uuid:r.account.uuid,emailAddress:r.account.email_address,organizationUuid:r.organization?.uuid}:void 0}}catch(e){let t=p.isAxiosError(e)&&e.response?.data?JSON.stringify(e.response.data):void 0;throw D(`tengu_oauth_token_refresh_failure`,{error:e.message,...t&&{responseBody:t}}),e}}async function nr(e){let t=await p.get(O().ROLES_URL,{headers:{Authorization:`Bearer ${e}`}});if(t.status!==200)throw Error(`Failed to fetch user roles: ${t.statusText}`);let n=t.data;if(!w().oauthAccount)throw Error(`OAuth account information not found in config`);C(e=>({...e,oauthAccount:e.oauthAccount?{...e.oauthAccount,organizationRole:n.organization_role,workspaceRole:n.workspace_role,organizationName:n.organization_name}:e.oauthAccount})),D(`tengu_oauth_roles_stored`,{org_role:n.organization_role})}async function rr(e){try{let t=await p.post(O().API_KEY_URL,null,{headers:{Authorization:`Bearer ${e}`}}),n=t.data?.raw_key;return n?(await ro(n),D(`tengu_oauth_api_key`,{status:`success`,statusCode:t.status}),n):null}catch(e){throw D(`tengu_oauth_api_key`,{status:`failure`,error:e instanceof Error?e.message:String(e)}),e}}function ir(e){return e!==null&&Date.now()+300*1e3>=e}async function ar(e){let t=await Yn(e),n=t?.organization?.organization_type,r=null;switch(n){case`claude_max`:r=`max`;break;case`claude_pro`:r=`pro`;break;case`claude_enterprise`:r=`enterprise`;break;case`claude_team`:r=`team`;break;default:r=null;break}let i={subscriptionType:r,rateLimitTier:t?.organization?.rate_limit_tier??null,hasExtraUsageEnabled:t?.organization?.has_extra_usage_enabled??null,billingType:t?.organization?.billing_type??null};return t?.account?.display_name&&(i.displayName=t.account.display_name),t?.account?.created_at&&(i.accountCreatedAt=t.account.created_at),t?.organization?.subscription_created_at&&(i.subscriptionCreatedAt=t.organization.subscription_created_at),D(`tengu_oauth_profile_fetch_success`,{}),{...i,rawProfile:t}}async function or(){let e=w().oauthAccount?.organizationUuid;if(e)return e;let t=K()?.accessToken;return t===void 0||!go()?null:(await Yn(t))?.organization?.uuid||null}async function sr(){let e=process.env.CLAUDE_CODE_ACCOUNT_UUID,t=process.env.CLAUDE_CODE_USER_EMAIL,n=process.env.CLAUDE_CODE_ORGANIZATION_UUID,r=!!(e&&t&&n);e&&t&&n&&(w().oauthAccount||cr({accountUuid:e,emailAddress:t,organizationUuid:n})),await mo();let i=w();if(i.oauthAccount&&i.oauthAccount.billingType!==void 0&&i.oauthAccount.accountCreatedAt!==void 0&&i.oauthAccount.subscriptionCreatedAt!==void 0||!B()||!go())return!1;let a=K();if(a?.accessToken){let e=await Yn(a.accessToken);if(e)return r&&y(`OAuth profile fetch succeeded, overriding env var account info`,{level:`info`}),cr({accountUuid:e.account.uuid,emailAddress:e.account.email,organizationUuid:e.organization.uuid,displayName:e.account.display_name||void 0,hasExtraUsageEnabled:e.organization.has_extra_usage_enabled??!1,billingType:e.organization.billing_type??void 0,accountCreatedAt:e.account.created_at,subscriptionCreatedAt:e.organization.subscription_created_at??void 0}),!0}return!1}function cr({accountUuid:e,emailAddress:t,organizationUuid:n,displayName:r,hasExtraUsageEnabled:i,billingType:a,accountCreatedAt:o,subscriptionCreatedAt:s}){let c={accountUuid:e,emailAddress:t,organizationUuid:n,hasExtraUsageEnabled:i,billingType:a,accountCreatedAt:o,subscriptionCreatedAt:s};r&&(c.displayName=r),C(e=>e.oauthAccount?.accountUuid===c.accountUuid&&e.oauthAccount?.emailAddress===c.emailAddress&&e.oauthAccount?.organizationUuid===c.organizationUuid&&e.oauthAccount?.displayName===c.displayName&&e.oauthAccount?.hasExtraUsageEnabled===c.hasExtraUsageEnabled&&e.oauthAccount?.billingType===c.billingType&&e.oauthAccount?.accountCreatedAt===c.accountCreatedAt&&e.oauthAccount?.subscriptionCreatedAt===c.subscriptionCreatedAt?e:{...e,oauthAccount:c})}var lr=e((()=>{m(),at(),k(),q(),Ue(),v(),Xn()}));function ur(e,t,n){if(s(process.env.CLAUDE_CODE_REMOTE))try{bt(hr,{recursive:!0,mode:448}),St(e,t,{encoding:`utf8`,mode:384}),y(`Persisted ${n} to ${e} for subprocess access`)}catch(e){y(`Failed to persist ${n} to disk (non-fatal): ${_(e)}`,{level:`error`})}}function dr(e,t){try{let n=Pe().readFileSync(e,{encoding:`utf8`}).trim();return n?(y(`Read ${t} from well-known file ${e}`),n):null}catch(n){return Me(n)||y(`Failed to read ${t} from ${e}: ${_(n)}`,{level:`debug`}),null}}function fr({envVar:e,wellKnownPath:t,label:n,getCached:r,setCached:i}){let a=r();if(a!==void 0)return a;let o=process.env[e];if(!o){let e=dr(t,n);return i(e),e}let s=parseInt(o,10);if(Number.isNaN(s))return y(`${e} must be a valid file descriptor number, got: ${o}`,{level:`error`}),i(null),null;try{let e=Pe(),r=process.platform===`darwin`||process.platform===`freebsd`?`/dev/fd/${s}`:`/proc/self/fd/${s}`,a=e.readFileSync(r,{encoding:`utf8`}).trim();return a?(y(`Successfully read ${n} from file descriptor ${s}`),i(a),ur(t,a,n),a):(y(`File descriptor contained empty ${n}`,{level:`error`}),i(null),null)}catch(e){y(`Failed to read ${n} from file descriptor ${s}: ${_(e)}`,{level:`error`});let r=dr(t,n);return i(r),r}}function pr(){return fr({envVar:`CLAUDE_CODE_OAUTH_TOKEN_FILE_DESCRIPTOR`,wellKnownPath:gr,label:`OAuth token`,getCached:ve,setCached:pe})}function mr(){return fr({envVar:`CLAUDE_CODE_API_KEY_FILE_DESCRIPTOR`,wellKnownPath:_r,label:`API key`,getCached:we,setCached:be})}var hr,gr,_r,vr,yr=e((()=>{h(),v(),l(),Re(),Fe(),hr=`/home/claude/.claude/remote`,gr=`${hr}/.oauth_token`,_r=`${hr}/.api_key`,vr=`${hr}/.session_ingress_token`}));function N(e=``){let t=c(),n=process.env.CLAUDE_CONFIG_DIR?`-${Ct(`sha256`).update(t).digest(`hex`).substring(0,8)}`:``;return`Claude Code${O().OAUTH_FILE_SUFFIX}${e}${n}`}function br(){try{return process.env.USER||_t().username}catch{return`claude-code-user`}}function P(){F.cache={data:null,cachedAt:0},F.generation++,F.readInFlight=null}function xr(e){if(F.cache.cachedAt!==0)return;let t=null;if(e)try{t=JSON.parse(e)}catch{return}F.cache={data:t,cachedAt:Date.now()}}var Sr,F,Cr=e((()=>{k(),l(),Sr=`-credentials`,F={cache:{data:null,cachedAt:0},generation:0,readInFlight:null}}));async function wr(){if(process.platform===`darwin`&&(await Je(`security delete-generic-password -a $USER -s "${N()}"`,{shell:!0,reject:!1})).exitCode!==0)throw Error(`Failed to delete keychain entry`)}function Tr(e){return e.slice(-20)}var Er=e((()=>{Ke(),Cr()}));function Dr(e){return e?.name===`CredentialsProviderError`}function Or(e){if(!e||typeof e!=`object`)return!1;let t=e;if(!t.Credentials||typeof t.Credentials!=`object`)return!1;let n=t.Credentials;return typeof n.AccessKeyId==`string`&&typeof n.SecretAccessKey==`string`&&typeof n.SessionToken==`string`&&n.AccessKeyId.length>0&&n.SecretAccessKey.length>0&&n.SessionToken.length>0}async function kr(){let{STSClient:e,GetCallerIdentityCommand:t}=await import(`./dist-es-C-OjW2Ao.js`);await new e().send(new t({}))}async function Ar(){try{y(`Clearing AWS credential provider cache`);let{fromIni:e}=await import(`./dist-es-CIULjvtA2.js`);await e({ignoreCache:!0})(),y(`AWS credential provider cache refreshed`)}catch{y(`Failed to clear AWS credential cache (this is expected if no credentials are configured)`)}}var jr=e((()=>{v()})),Mr,Nr=e((()=>{_e(),ee(),Mr=class e{constructor(){f(this,`status`,{isAuthenticating:!1,output:[]}),f(this,`changed`,Te()),f(this,`subscribe`,this.changed.subscribe)}static getInstance(){return e.instance||(e.instance=new e),e.instance}getStatus(){return{...this.status,output:[...this.status.output]}}startAuthentication(){this.status={isAuthenticating:!0,output:[]},this.changed.emit(this.getStatus())}addOutput(e){this.status.output.push(e),this.changed.emit(this.getStatus())}setError(e){this.status.error=e,this.changed.emit(this.getStatus())}endAuthentication(e){e?this.status={isAuthenticating:!1,output:[]}:this.status.isAuthenticating=!1,this.changed.emit(this.getStatus())}static reset(){e.instance&&(e.instance.changed.clear(),e.instance=null)}},f(Mr,`instance`,null)})),Pr,Fr,Ir,Lr,Rr,zr,Br,Vr,Hr,Ur,Wr,Gr,Kr,qr,Jr,Yr=e((()=>{Pr=`claude-code-20250219`,Fr=`interleaved-thinking-2025-05-14`,Ir=`context-1m-2025-08-07`,Lr=`context-management-2025-06-27`,Rr=`structured-outputs-2025-12-15`,zr=`tool-search-tool-2025-10-19`,Br=`task-budgets-2026-03-13`,Vr=`prompt-caching-scope-2026-01-05`,Hr=`fast-mode-2026-02-01`,Ur=`redact-thinking-2026-02-12`,Wr=`afk-mode-2026-01-31`,Gr=process.env.USER_TYPE===`ant`?`cli-internal-2026-02-09`:``,Kr=`advisor-tool-2026-03-01`,qr=new Set([Fr,Ir,zr]),Jr=new Set([Pr,Fr,Lr])}));function Xr(e,t){return me(e,t)}var Zr=e((()=>{Ce()}));function Qr(){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=Nt(),r=n?`, workload/${n}`:``;return`claude-cli/0.0.8 (${process.env.USER_TYPE}, ${process.env.CLAUDE_CODE_ENTRYPOINT??`cli`}${e}${t}${r})`}function $r(){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}`),`claude-code/0.0.8${e.length>0?` (${e.join(`, `)})`:``}`}function ei(){if(B()){let e=K();return e?.accessToken?{headers:{Authorization:`Bearer ${e.accessToken}`,"anthropic-beta":ct}}:{headers:{},error:`No OAuth token available`}}let e=R();return e?{headers:{"x-api-key":e}}:{headers:{},error:`No API key available`}}async function ti(e,t){try{return await e()}catch(n){if(!p.isAxiosError(n))throw n;let r=n.response?.status;if(!(r===401||t?.also403Revoked&&r===403&&typeof n.response?.data==`string`&&n.response.data.includes(`OAuth token has been revoked`)))throw n;let i=K()?.accessToken;if(!i)throw n;return await uo(i),await e()}}var ni=e((()=>{m(),k(),q(),It()}));function ri(){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 ii({apiKey:e,maxRetries:n,model:r,fetchOverride:i,source:a}){let c=process.env.CLAUDE_CODE_CONTAINER_ID,l=process.env.CLAUDE_CODE_REMOTE_SESSION_ID,u=process.env.CLAUDE_AGENT_SDK_CLIENT_APP,ee=oi(),f={"x-app":`cli`,"User-Agent":Qr(),"X-Claude-Code-Session-Id":xe(),...ee,...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}:{}};y(`[API:request] Creating client, ANTHROPIC_CUSTOM_HEADERS present: ${!!process.env.ANTHROPIC_CUSTOM_HEADERS}, has Authorization header: ${!!ee.Authorization}`),s(process.env.CLAUDE_CODE_ADDITIONAL_PROTECTION)&&(f[`x-anthropic-additional-protection`]=`true`),y(`[API:auth] OAuth token check starting`),await mo(),y(`[API:auth] OAuth token check complete`),B()||await ai(f,g());let p=si(i,a),m={defaultHeaders:f,maxRetries:n,timeout:parseInt(process.env.API_TIMEOUT_MS||`600000`,10),dangerouslyAllowBrowser:!0,fetchOptions:mt({forAnthropicAPI:!0}),...p&&{fetch:p}};if(s(process.env.CLAUDE_CODE_USE_BEDROCK)){let{BedrockClient:e}=await import(`./bedrockClient-DxE_mHFI.js`),t=r===cc()&&process.env.ANTHROPIC_SMALL_FAST_MODEL_AWS_REGION?process.env.ANTHROPIC_SMALL_FAST_MODEL_AWS_REGION:d(),n={...m,awsRegion:t,...s(process.env.CLAUDE_CODE_SKIP_BEDROCK_AUTH)&&{skipAuth:!0},...Ie()&&{logger:ri()}};if(process.env.AWS_BEARER_TOKEN_BEDROCK)n.skipAuth=!0,n.defaultHeaders={...n.defaultHeaders,Authorization:`Bearer ${process.env.AWS_BEARER_TOKEN_BEDROCK}`};else if(!s(process.env.CLAUDE_CODE_SKIP_BEDROCK_AUTH)){let e=await G();e&&(n.awsAccessKey=e.accessKeyId,n.awsSecretKey=e.secretAccessKey,n.awsSessionToken=e.sessionToken)}return new e(n)}if(s(process.env.CLAUDE_CODE_USE_FOUNDRY)){let{AnthropicFoundry:e}=await import(`./foundry-sdk-BdeF2aBu.js`),t;if(!process.env.ANTHROPIC_FOUNDRY_API_KEY)if(s(process.env.CLAUDE_CODE_SKIP_FOUNDRY_AUTH))t=()=>Promise.resolve(``);else{let{DefaultAzureCredential:e,getBearerTokenProvider:n}=await import(`./esm-CGx9qY3q.js`);t=n(new e,`https://cognitiveservices.azure.com/.default`)}return new e({...m,...t&&{azureADTokenProvider:t},...Ie()&&{logger:ri()}})}if(s(process.env.CLAUDE_CODE_USE_VERTEX)){s(process.env.CLAUDE_CODE_SKIP_VERTEX_AUTH)||await Ho();let[{AnthropicVertex:e},{GoogleAuth:n}]=await Promise.all([import(`./vertex-sdk-DjXcZ2J7.js`),import(`./src-CiJCsqUl.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,a=process.env.GOOGLE_APPLICATION_CREDENTIALS||process.env.google_application_credentials,c=s(process.env.CLAUDE_CODE_SKIP_VERTEX_AUTH)?{getClient:()=>({getRequestHeaders:()=>({})})}:new n({scopes:[`https://www.googleapis.com/auth/cloud-platform`],...i||a?{}:{projectId:process.env.ANTHROPIC_VERTEX_PROJECT_ID}});return new e({...m,region:o(r),googleAuth:c,...Ie()&&{logger:ri()}})}return new Ae({apiKey:B()?null:e||R(),authToken:B()?K()?.accessToken:void 0,...process.env.USER_TYPE===`ant`&&s(process.env.USE_STAGING_OAUTH)?{baseURL:O().BASE_API_URL}:{},...m,...Ie()&&{logger:ri()}})}async function ai(e,t){let n=process.env.ANTHROPIC_AUTH_TOKEN||await Ra(t);n&&(e.Authorization=`Bearer ${n}`)}function oi(){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 si(e,t){let n=e??globalThis.fetch,r=A()===`firstParty`&&Mt();return(e,i)=>{let a=new Headers(i?.headers);r&&!a.has(`x-client-request-id`)&&a.set(ci,wt());try{let n=e instanceof Request?e.url:String(e),r=a.get(ci);y(`[API REQUEST] ${new URL(n).pathname}${r?` ${ci}=${r}`:``} source=${t??`unknown`}`)}catch{}return n(e,{...i,headers:a})}}var ci,li=e((()=>{Oe(),q(),ni(),Fc(),j(),gt(),h(),k(),v(),l(),ci=`x-client-request-id`}));function ui(){return vt(c(),`cache`)}function di(){return vt(ui(),`model-capabilities.json`)}function fi(){return!(A()!==`firstParty`||!Mt())}function pi(e){return[...e].sort((e,t)=>t.id.length-e.id.length||e.id.localeCompare(t.id))}function mi(e){if(!fi())return;let t=vi(di());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 hi(){if(fi()&&!$e())try{let e=await ii({maxRetries:1}),t=B()?[ct]:void 0,n=[];for await(let r of e.models.list({betas:t})){let e=gi().safeParse(r);e.success&&n.push(e.data)}if(n.length===0)return;let r=di(),i=pi(n);if(Xr(vi(r),i)){y(`[modelCapabilities] cache unchanged, skipping write`);return}await Tt(ui(),{recursive:!0}),await Dt(r,Le({models:i,timestamp:Date.now()}),{encoding:`utf-8`,mode:384}),vi.cache.delete(r),y(`[modelCapabilities] cached ${i.length} models`)}catch(e){y(`[modelCapabilities] fetch failed: ${e instanceof Error?e.message:`unknown`}`)}}var gi,_i,vi,yi=e((()=>{Zr(),i(),ce(),k(),li(),q(),v(),l(),rt(),le(),Qe(),je(),j(),gi=se(()=>oe({id:re(),max_input_tokens:ie().optional(),max_tokens:ie().optional()}).strip()),_i=se(()=>oe({models:ae(gi()),timestamp:ie()})),vi=r(e=>{try{let t=xt(e,`utf-8`),n=_i().safeParse(it(t,!1));return n.success?n.data.models:null}catch{return null}},e=>e)}));function bi(){return s(process.env.CLAUDE_CODE_DISABLE_1M_CONTEXT)}function I(e){return!bi()&&/\[1m\]/i.test(e)}function xi(e){if(bi())return!1;let t=Q(e);return t.includes(`claude-sonnet-4`)||t.includes(`opus-4-6`)||t.includes(`opus-4-7`)}function Si(e,t){if(process.env.USER_TYPE===`ant`&&process.env.CLAUDE_CODE_MAX_CONTEXT_TOKENS){let e=parseInt(process.env.CLAUDE_CODE_MAX_CONTEXT_TOKENS,10);if(!isNaN(e)&&e>0)return e}if(I(e))return 1e6;let n=mi(e);if(n?.max_input_tokens&&n.max_input_tokens>=1e5)return n.max_input_tokens>2e5&&bi()?Di:n.max_input_tokens;if(t?.includes(`context-1m-2025-08-07`)&&xi(e)||Ci(e))return 1e6;if(process.env.USER_TYPE===`ant`){let t=zt(e);if(t?.contextWindow)return t.contextWindow}return Di}function Ci(e){return bi()||I(e)||!Q(e).includes(`sonnet-4-6`)?!1:w().clientDataCache?.coral_reef_sonnet===`true`}function wi(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 Ti(e){let t,n;if(process.env.USER_TYPE===`ant`){let r=zt(e.toLowerCase());if(r)return t=r.defaultMaxTokens??ki,n=r.upperMaxTokensLimit??Ai,{default:t,upperLimit:n}}let r=Q(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=ki,n=Ai);let i=mi(e);return i?.max_tokens&&i.max_tokens>=4096&&(n=i.max_tokens,t=Math.min(t,n)),{default:t,upperLimit:n}}function Ei(e){return Ti(e).upperLimit-1}var Di,Oi,ki,Ai,ji,Mi=e((()=>{Yr(),Ue(),l(),Fc(),Bt(),yi(),Di=2e5,Oi=2e4,ki=32e3,Ai=64e3,ji=8e3})),Ni,Pi,Fi,Ii=e((()=>{i(),j(),Ni=[{modelEnvVar:`ANTHROPIC_DEFAULT_OPUS_MODEL`,capabilitiesEnvVar:`ANTHROPIC_DEFAULT_OPUS_MODEL_SUPPORTED_CAPABILITIES`},{modelEnvVar:`ANTHROPIC_DEFAULT_SONNET_MODEL`,capabilitiesEnvVar:`ANTHROPIC_DEFAULT_SONNET_MODEL_SUPPORTED_CAPABILITIES`},{modelEnvVar:`ANTHROPIC_DEFAULT_HAIKU_MODEL`,capabilitiesEnvVar:`ANTHROPIC_DEFAULT_HAIKU_MODEL_SUPPORTED_CAPABILITIES`}],Pi=[{modelEnvVar:`OPENAI_DEFAULT_OPUS_MODEL`,capabilitiesEnvVar:`OPENAI_DEFAULT_OPUS_MODEL_SUPPORTED_CAPABILITIES`},{modelEnvVar:`OPENAI_DEFAULT_SONNET_MODEL`,capabilitiesEnvVar:`OPENAI_DEFAULT_SONNET_MODEL_SUPPORTED_CAPABILITIES`},{modelEnvVar:`OPENAI_DEFAULT_HAIKU_MODEL`,capabilitiesEnvVar:`OPENAI_DEFAULT_HAIKU_MODEL_SUPPORTED_CAPABILITIES`}],Fi=r((e,t)=>{if(A()===`firstParty`)return;let n=e.toLowerCase(),r=A()===`openai`?Pi:Ni;for(let e of r){let r=process.env[e.modelEnvVar],i=process.env[e.capabilitiesEnvVar];if(!(!r||i===void 0)&&n===r.toLowerCase())return i.toLowerCase().split(`,`).map(e=>e.trim()).includes(t)}},(e,t)=>`${e.toLowerCase()}:${t}`)}));function Li(e){let t=[],n=[];for(let r of e)qi.includes(r)?t.push(r):n.push(r);return{allowed:t,disallowed:n}}function Ri(e){if(!e||e.length===0)return;if(B()){console.warn(`Warning: Custom betas are only available for API key users. Ignoring provided betas.`);return}let{allowed:t,disallowed:n}=Li(e);for(let e of n)console.warn(`Warning: Beta header '${e}' is not allowed. Only the following betas are supported: ${qi.join(`, `)}`);return t.length>0?t:void 0}function zi(e){let t=Fi(e,`interleaved_thinking`);if(t!==void 0)return t;let n=Q(e),r=A();return r===`foundry`?!0:r===`firstParty`?!n.includes(`claude-3-`):n.includes(`claude-opus-4`)||n.includes(`claude-sonnet-4`)}function Bi(e){let t=Q(e),n=A();return n===`foundry`?!0:n===`firstParty`?!t.includes(`claude-3-`):t.includes(`claude-opus-4`)||t.includes(`claude-sonnet-4`)||t.includes(`claude-haiku-4`)}function Vi(e){let t=Q(e),n=A();return n!==`firstParty`&&n!==`foundry`?!1:t.includes(`claude-sonnet-4-6`)||t.includes(`claude-sonnet-4-5`)||t.includes(`claude-opus-4-1`)||t.includes(`claude-opus-4-5`)||t.includes(`claude-opus-4-6`)||t.includes(`claude-opus-4-7`)||t.includes(`claude-haiku-4-5`)}function Hi(e){return!0}function Ui(){return(A()===`firstParty`||A()===`foundry`)&&!s(process.env.CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS)&&Mt()}function Wi(){return A()===`firstParty`&&!s(process.env.CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS)}function Gi(e,t){let n=[...Yi(e)];t?.isAgenticQuery&&(n.includes(`claude-code-20250219`)||n.push(Pr),process.env.USER_TYPE===`ant`&&process.env.CLAUDE_CODE_ENTRYPOINT===`cli`&&Gr&&!n.includes(Gr)&&n.push(Gr));let r=ye();return!r||r.length===0?n:[...n,...r.filter(e=>!n.includes(e))]}function Ki(){Ji.cache?.clear?.(),Yi.cache?.clear?.(),Xi.cache?.clear?.()}var qi,Ji,Yi,Xi,Zi=e((()=>{i(),h(),Yr(),k(),q(),Mi(),l(),Fc(),Ii(),j(),S(),qi=[Ir],Ji=r(e=>{let t=[],n=Q(e).includes(`haiku`);A();let r=Ui();n||(t.push(Pr),process.env.USER_TYPE===`ant`&&process.env.CLAUDE_CODE_ENTRYPOINT===`cli`&&Gr&&t.push(Gr)),B()&&t.push(ct),I(e)&&t.push(Ir),!s(process.env.DISABLE_INTERLEAVED_THINKING)&&zi(e)&&t.push(Fr),r&&zi(e)&&!g()&&Be().showThinkingSummaries!==!0&&t.push(Ur);let i=s(process.env.USE_API_CONTEXT_MANAGEMENT)||Bi(e),a=Bi(e);return Ui()&&(i||a)&&t.push(Lr),r&&Vi(e),process.env.USER_TYPE,r&&t.push(Vr),process.env.ANTHROPIC_BETAS&&t.push(...process.env.ANTHROPIC_BETAS.split(`,`).map(e=>e.trim()).filter(Boolean)),t}),Yi=r(e=>{let t=Ji(e);return A()===`bedrock`?t.filter(e=>!qr.has(e)):t}),Xi=r(e=>Ji(e).filter(e=>qr.has(e)))}));function Qi(e,t){return{name:`${e.name}-with-${t.name}-fallback`,read(){return e.read()??(t.read()||{})},async readAsync(){return await e.readAsync()??(await t.readAsync()||{})},update(n){let r=e.read(),i=e.update(n);if(i.success)return r===null&&t.delete(),i;let a=t.update(n);return a.success?(r!==null&&e.delete(),{success:!0,warning:a.warning}):{success:!1}},delete(){let n=e.delete(),r=t.delete();return n||r}}}var $i=e((()=>{}));async function ea(){try{let e=N(Sr),{stdout:t,code:n}=await Ze(`security`,[`find-generic-password`,`-a`,br(),`-w`,`-s`,e],{useCwd:!1,preserveOutputOnError:!1});if(n===0&&t)return Ee(t.trim())}catch{}return null}function ta(){if(ia!==void 0)return ia;if(process.platform!==`darwin`)return ia=!1,!1;try{ia=Xe(`security`,[`show-keychain-info`],{reject:!1,stdio:[`ignore`,`pipe`,`pipe`]}).exitCode===36}catch{ia=!1}return ia}var na,ra,ia,aa=e((()=>{Ke(),v(),Ye(),Ge(),je(),Cr(),na=4032,ra={name:`keychain`,read(){let e=F.cache;if(Date.now()-e.cachedAt<3e4)return e.data;try{let e=N(Sr),t=qe(`security find-generic-password -a "${br()}" -w -s "${e}"`);if(t){let e=Ee(t);return F.cache={data:e,cachedAt:Date.now()},e}}catch{}return e.data===null?(F.cache={data:null,cachedAt:Date.now()},null):(y(`[keychain] read failed; serving stale cache`,{level:`warn`}),F.cache={data:e.data,cachedAt:Date.now()},e.data)},async readAsync(){let e=F.cache;if(Date.now()-e.cachedAt<3e4)return e.data;if(F.readInFlight)return F.readInFlight;let t=F.generation,n=ea().then(n=>{if(t===F.generation){n===null&&e.data!==null&&y(`[keychain] readAsync failed; serving stale cache`,{level:`warn`});let t=n??e.data;return F.cache={data:t,cachedAt:Date.now()},F.readInFlight=null,t}return n});return F.readInFlight=n,n},update(e){P();try{let t=N(Sr),n=br(),r=Le(e),i=Buffer.from(r,`utf-8`).toString(`hex`),a=`add-generic-password -U -a "${n}" -s "${t}" -X "${i}"\n`,o;return a.length<=na?o=Xe(`security`,[`-i`],{input:a,stdio:[`pipe`,`pipe`,`pipe`],reject:!1}):(y(`Keychain payload (${r.length}B JSON) exceeds security -i stdin limit; using argv`,{level:`warn`}),o=Xe(`security`,[`add-generic-password`,`-U`,`-a`,n,`-s`,t,`-X`,i],{stdio:[`ignore`,`pipe`,`pipe`],reject:!1})),o.exitCode===0?(F.cache={data:e,cachedAt:Date.now()},{success:!0}):{success:!1}}catch{return{success:!1}}},delete(){P();try{let e=N(Sr);return qe(`security delete-generic-password -a "${br()}" -s "${e}"`),!0}catch{return!1}}}}));function oa(){let e=c();return{storageDir:e,storagePath:vt(e,`.credentials.json`)}}var sa,ca=e((()=>{l(),Re(),Fe(),je(),sa={name:`plaintext`,read(){let{storagePath:e}=oa();try{return Ee(Pe().readFileSync(e,{encoding:`utf8`}))}catch{return null}},async readAsync(){let{storagePath:e}=oa();try{return Ee(await Pe().readFile(e,{encoding:`utf8`}))}catch{return null}},update(e){try{let{storageDir:t,storagePath:n}=oa();try{Pe().mkdirSync(t)}catch(e){if(ke(e)!==`EEXIST`)throw e}return De(n,Le(e),{encoding:`utf8`,flush:!1}),yt(n,384),{success:!0,warning:`Warning: Storing credentials in plaintext.`}}catch{return{success:!1}}},delete(){let{storagePath:e}=oa();try{return Pe().unlinkSync(e),!0}catch(e){return ke(e)===`ENOENT`}}}}));function la(){return process.platform===`darwin`?Qi(ra,sa):sa}var ua=e((()=>{$i(),aa(),ca()}));function da(e){return new Promise(t=>{kt(`security`,[`find-generic-password`,`-a`,br(),`-w`,`-s`,e],{encoding:`utf-8`,timeout:ga},(e,n)=>{t({stdout:e?null:n?.trim()||null,timedOut:!!(e&&`killed`in e&&e.killed)})})})}function fa(){if(process.platform!==`darwin`||va||u())return;let e=da(N(Sr)),t=da(N());va=Promise.all([e,t]).then(([e,t])=>{e.timedOut||xr(e.stdout),t.timedOut||(_a={stdout:t.stdout})})}async function pa(){va&&await va}function ma(){return _a}function ha(){_a=null}var ga,_a,va,ya=e((()=>{l(),Cr(),ga=1e4,_a=null,va=null}));function ba(e,t,n){return new Promise((r,i)=>{if(t?.aborted){n?.throwOnAbort||n?.abortError?i(n.abortError?.()??Error(`aborted`)):r();return}let a=setTimeout((e,t,n)=>{e?.removeEventListener(`abort`,t),n()},e,t,o,r);function o(){clearTimeout(a),n?.throwOnAbort||n?.abortError?i(n.abortError?.()??Error(`aborted`)):r()}t?.addEventListener(`abort`,o,{once:!0}),n?.unref&&a.unref()})}var xa=e((()=>{}));function Sa(){return wa}function Ca(){wa.clear()}var wa,Ta=e((()=>{wa=new Map})),Ea=n({calculateApiKeyHelperTTL:()=>Ia,checkAndRefreshOAuthTokenIfNeeded:()=>mo,checkGcpCredentialsValid:()=>Xa,clearApiKeyHelperCache:()=>Ha,clearAwsCredentialsCache:()=>qa,clearGcpCredentialsCache:()=>$a,clearOAuthTokenCache:()=>co,getAccountInformation:()=>Po,getAnthropicApiKey:()=>R,getAnthropicApiKeyWithSource:()=>Aa,getApiKeyFromApiKeyHelper:()=>Ra,getApiKeyFromApiKeyHelperCached:()=>Va,getApiKeyFromConfigOrMacOSKeychain:()=>Uo,getApiKeyHelperElapsedMs:()=>La,getAuthTokenSource:()=>Oa,getClaudeAIOAuthTokens:()=>K,getClaudeAIOAuthTokensAsync:()=>po,getConfiguredApiKeyHelper:()=>z,getOauthAccountInfo:()=>vo,getOtelHeadersFromHelper:()=>jo,getRateLimitTier:()=>Eo,getSubscriptionName:()=>Do,getSubscriptionType:()=>V,handleOAuth401Error:()=>uo,hasAnthropicApiKeyAuth:()=>ka,hasOpusAccess:()=>bo,hasProfileScope:()=>go,is1PApiCustomer:()=>_o,isAnthropicAuthEnabled:()=>L,isAwsAuthRefreshFromProjectSettings:()=>Na,isAwsCredentialExportFromProjectSettings:()=>Fa,isClaudeAISubscriber:()=>B,isConsumerSubscriber:()=>No,isCustomApiKeyApproved:()=>io,isEnterpriseSubscriber:()=>wo,isGcpAuthRefreshFromProjectSettings:()=>Ya,isMaxSubscriber:()=>xo,isOtelHeadersHelperFromProjectOrLocalSettings:()=>Ao,isOverageProvisioningAllowed:()=>yo,isProSubscriber:()=>To,isTeamPremiumSubscriber:()=>Co,isTeamSubscriber:()=>So,isUsing3PServices:()=>Oo,prefetchApiKeyFromApiKeyHelperIfSafe:()=>Ua,prefetchAwsCredentialsAndBedRockInfoIfSafe:()=>to,prefetchGcpCredentialsIfSafe:()=>eo,refreshAndGetAwsCredentials:()=>G,refreshAwsAuth:()=>Ga,refreshGcpAuth:()=>Qa,refreshGcpCredentialsIfNeeded:()=>Ho,removeApiKey:()=>ao,saveApiKey:()=>ro,saveOAuthTokensIfNeeded:()=>so,validateForceLoginOrg:()=>Fo});function Da(){return s(process.env.CLAUDE_CODE_REMOTE)||process.env.CLAUDE_CODE_ENTRYPOINT===`claude-desktop`}function L(){if(u())return!1;if(process.env.ANTHROPIC_UNIX_SOCKET)return!!process.env.CLAUDE_CODE_OAUTH_TOKEN;let e=x()||{},t=s(process.env.CLAUDE_CODE_USE_BEDROCK)||s(process.env.CLAUDE_CODE_USE_VERTEX)||s(process.env.CLAUDE_CODE_USE_FOUNDRY)||e.modelType===`openai`||e.modelType===`gemini`||!!process.env.OPENAI_BASE_URL||!!process.env.GEMINI_BASE_URL,n=e.apiKeyHelper,r=process.env.ANTHROPIC_AUTH_TOKEN||n||process.env.CLAUDE_CODE_API_KEY_FILE_DESCRIPTOR,{source:i}=Aa({skipRetrievingKeyFromApiKeyHelper:!0}),a=i===`ANTHROPIC_API_KEY`||i===`apiKeyHelper`;return!(t||r&&!Da()||a&&!Da())}function Oa(){if(u())return z()?{source:`apiKeyHelper`,hasToken:!0}:{source:`none`,hasToken:!1};if(process.env.ANTHROPIC_AUTH_TOKEN&&!Da())return{source:`ANTHROPIC_AUTH_TOKEN`,hasToken:!0};if(process.env.CLAUDE_CODE_OAUTH_TOKEN)return{source:`CLAUDE_CODE_OAUTH_TOKEN`,hasToken:!0};if(pr())return process.env.CLAUDE_CODE_OAUTH_TOKEN_FILE_DESCRIPTOR?{source:`CLAUDE_CODE_OAUTH_TOKEN_FILE_DESCRIPTOR`,hasToken:!0}:{source:`CCR_OAUTH_TOKEN_FILE`,hasToken:!0};if(z()&&!Da())return{source:`apiKeyHelper`,hasToken:!0};let e=K();return Zn(e?.scopes)&&e?.accessToken?{source:`claude.ai`,hasToken:!0}:{source:`none`,hasToken:!1}}function R(){let{key:e}=Aa();return e}function ka(){let{key:e,source:t}=Aa({skipRetrievingKeyFromApiKeyHelper:!0});return e!==null&&t!==`none`}function Aa(e={}){if(u())return process.env.ANTHROPIC_API_KEY?{key:process.env.ANTHROPIC_API_KEY,source:`ANTHROPIC_API_KEY`}:z()?{key:e.skipRetrievingKeyFromApiKeyHelper?null:Va(),source:`apiKeyHelper`}:{key:null,source:`none`};let t=a()?void 0:process.env.ANTHROPIC_API_KEY;if(Se()&&t)return{key:t,source:`ANTHROPIC_API_KEY`};if(s(process.env.CI)){let e=mr();if(e)return{key:e,source:`ANTHROPIC_API_KEY`};if(!t&&!process.env.CLAUDE_CODE_OAUTH_TOKEN&&!process.env.CLAUDE_CODE_OAUTH_TOKEN_FILE_DESCRIPTOR)throw Error(`ANTHROPIC_API_KEY or CLAUDE_CODE_OAUTH_TOKEN env var is required`);return t?{key:t,source:`ANTHROPIC_API_KEY`}:{key:null,source:`none`}}if(t&&w().customApiKeyResponses?.approved?.includes(Tr(t)))return{key:t,source:`ANTHROPIC_API_KEY`};let n=mr();return n?{key:n,source:`ANTHROPIC_API_KEY`}:z()?e.skipRetrievingKeyFromApiKeyHelper?{key:null,source:`apiKeyHelper`}:{key:Va(),source:`apiKeyHelper`}:Uo()||{key:null,source:`none`}}function z(){return u()?b(`flagSettings`)?.apiKeyHelper:(x()||{}).apiKeyHelper}function ja(){let e=z();if(!e)return!1;let t=b(`projectSettings`),n=b(`localSettings`);return t?.apiKeyHelper===e||n?.apiKeyHelper===e}function Ma(){return(x()||{}).awsAuthRefresh}function Na(){let e=Ma();if(!e)return!1;let t=b(`projectSettings`),n=b(`localSettings`);return t?.awsAuthRefresh===e||n?.awsAuthRefresh===e}function Pa(){return(x()||{}).awsCredentialExport}function Fa(){let e=Pa();if(!e)return!1;let t=b(`projectSettings`),n=b(`localSettings`);return t?.awsCredentialExport===e||n?.awsCredentialExport===e}function Ia(){let e=process.env.CLAUDE_CODE_API_KEY_HELPER_TTL_MS;if(e){let t=parseInt(e,10);if(!Number.isNaN(t)&&t>=0)return t;y(`Found CLAUDE_CODE_API_KEY_HELPER_TTL_MS env var, but it was not a valid number. Got ${e}`,{level:`error`})}return Io}function La(){let e=U?.startedAt;return e?Date.now()-e:0}async function Ra(e){if(!z())return null;let t=Ia();return H?(Date.now()-H.timestamp<t||U||(U={promise:za(e,!1,W),startedAt:null}),H.value):(U||(U={promise:za(e,!0,W),startedAt:Date.now()}),U.promise)}async function za(e,t,n){try{let t=await Ba(e);return n===W&&t!==null&&(H={value:t,timestamp:Date.now()}),t}catch(e){if(n!==W)return` `;let r=e instanceof Error?e.message:String(e);return console.error(ne.red(`apiKeyHelper failed: ${r}`)),y(`Error getting API key from apiKeyHelper: ${r}`,{level:`error`}),!t&&H&&H.value!==` `?(H={...H,timestamp:Date.now()},H.value):(H={value:` `,timestamp:Date.now()},` `)}finally{n===W&&(U=null)}}async function Ba(e){let t=z();if(!t)return null;if(ja()&&!T()&&!e)return Ne(`apiKeyHelper invoked before trust check`,Error(`Security: apiKeyHelper executed before workspace trust is confirmed. If you see this message, post in .`)),D(`tengu_apiKeyHelper_missing_trust11`,{}),null;let n=await Je(t,{shell:!0,timeout:600*1e3,reject:!1});if(n.failed){let e=n.timedOut?`timed out`:`exited ${n.exitCode}`,t=n.stderr?.trim();throw Error(t?`${e}: ${t}`:e)}let r=n.stdout?.trim();if(!r)throw Error(`did not return a value`);return r}function Va(){return H?.value??null}function Ha(){W++,H=null,U=null}function Ua(e){ja()&&!T()||Ra(e)}async function Wa(){let e=Ma();if(!e)return!1;if(Na()&&!T()&&!g())return Ne(`awsAuthRefresh invoked before trust check`,Error(`Security: awsAuthRefresh executed before workspace trust is confirmed. If you see this message, post in .`)),D(`tengu_awsAuthRefresh_missing_trust`,{}),!1;try{return y(`Fetching AWS caller identity for AWS auth refresh command`),await kr(),y(`Fetched AWS caller identity, skipping AWS auth refresh command`),!1}catch{return Ga(e)}}function Ga(e){y(`Running AWS auth refresh command`);let t=Mr.getInstance();return t.startAuthentication(),new Promise(n=>{let r=Ot(e,{timeout:Ro});r.stdout.on(`data`,e=>{let n=e.toString().trim();n&&(t.addOutput(n),y(n,{level:`debug`}))}),r.stderr.on(`data`,e=>{let n=e.toString().trim();n&&(t.setError(n),y(n,{level:`error`}))}),r.on(`close`,(e,r)=>{if(e===0)y(`AWS auth refresh completed successfully`),t.endAuthentication(!0),n(!0);else{let e=r===`SIGTERM`?ne.red(`AWS auth refresh timed out after 3 minutes. Run your auth command manually in a separate terminal.`):ne.red(`Error running awsAuthRefresh (in settings or ~/.claude.json):`);console.error(e),t.endAuthentication(!1),n(!1)}})})}async function Ka(){let e=Pa();if(!e)return null;if(Fa()&&!T()&&!g())return Ne(`awsCredentialExport invoked before trust check`,Error(`Security: awsCredentialExport executed before workspace trust is confirmed. If you see this message, post in .`)),D(`tengu_awsCredentialExport_missing_trust`,{}),null;try{return y(`Fetching AWS caller identity for credential export command`),await kr(),y(`Fetched AWS caller identity, skipping AWS credential export command`),null}catch{try{y(`Running AWS credential export command`);let t=await Je(e,{shell:!0,reject:!1});if(t.exitCode!==0||!t.stdout)throw Error(`awsCredentialExport did not return a valid value`);let n=Ee(t.stdout.trim());if(!Or(n))throw Error(`awsCredentialExport did not return valid AWS STS output structure`);return y(`AWS credentials retrieved from awsCredentialExport`),{accessKeyId:n.Credentials.AccessKeyId,secretAccessKey:n.Credentials.SecretAccessKey,sessionToken:n.Credentials.SessionToken}}catch(e){let t=ne.red(`Error getting AWS credentials from awsCredentialExport (in settings or ~/.claude.json):`);return e instanceof Error?console.error(t,e.message):console.error(t,e),null}}}function qa(){G.cache.clear()}function Ja(){return(x()||{}).gcpAuthRefresh}function Ya(){let e=Ja();if(!e)return!1;let t=b(`projectSettings`),n=b(`localSettings`);return t?.gcpAuthRefresh===e||n?.gcpAuthRefresh===e}async function Xa(){try{let{GoogleAuth:e}=await import(`./src-CiJCsqUl.js`).then(e=>t(e.default,1)),n=new e({scopes:[`https://www.googleapis.com/auth/cloud-platform`]}),r=(async()=>{await(await n.getClient()).getAccessToken()})(),i=ba(zo).then(()=>{throw new Xo(`GCP credentials check timed out`)});return await Promise.race([r,i]),!0}catch{return!1}}async function Za(){let e=Ja();if(!e)return!1;if(Ya()&&!T()&&!g())return Ne(`gcpAuthRefresh invoked before trust check`,Error(`Security: gcpAuthRefresh executed before workspace trust is confirmed. If you see this message, post in .`)),D(`tengu_gcpAuthRefresh_missing_trust`,{}),!1;try{if(y(`Checking GCP credentials validity for auth refresh`),await Xa())return y(`GCP credentials are valid, skipping auth refresh command`),!1}catch{}return Qa(e)}function Qa(e){y(`Running GCP auth refresh command`);let t=Mr.getInstance();return t.startAuthentication(),new Promise(n=>{let r=Ot(e,{timeout:Vo});r.stdout.on(`data`,e=>{let n=e.toString().trim();n&&(t.addOutput(n),y(n,{level:`debug`}))}),r.stderr.on(`data`,e=>{let n=e.toString().trim();n&&(t.setError(n),y(n,{level:`error`}))}),r.on(`close`,(e,r)=>{if(e===0)y(`GCP auth refresh completed successfully`),t.endAuthentication(!0),n(!0);else{let e=r===`SIGTERM`?ne.red(`GCP auth refresh timed out after 3 minutes. Run your auth command manually in a separate terminal.`):ne.red(`Error running gcpAuthRefresh (in settings or ~/.claude.json):`);console.error(e),t.endAuthentication(!1),n(!1)}})})}function $a(){Ho.cache.clear()}function eo(){Ja()&&(Ya()&&!T()&&!g()||Ho())}function to(){let e=Ma(),t=Pa();!e&&!t||(Na()||Fa())&&!T()&&!g()||(G(),M())}function no(e){return/^[a-zA-Z0-9-_]+$/.test(e)}async function ro(e){if(!no(e))throw Error(`Invalid API key format. API key must contain only alphanumeric characters, dashes, and underscores.`);await oo();let t=!1;if(process.platform===`darwin`)try{let n=N();await Je(`security`,[`-i`],{input:`add-generic-password -U -a "${br()}" -s "${n}" -X "${Buffer.from(e,`utf-8`).toString(`hex`)}"\n`,reject:!1}),D(`tengu_api_key_saved_to_keychain`,{}),t=!0}catch(e){E(e),D(`tengu_api_key_keychain_error`,{error:_(e)}),D(`tengu_api_key_saved_to_config`,{})}else D(`tengu_api_key_saved_to_config`,{});let n=Tr(e);C(r=>{let i=r.customApiKeyResponses?.approved??[];return{...r,primaryApiKey:t?r.primaryApiKey:e,customApiKeyResponses:{...r.customApiKeyResponses,approved:i.includes(n)?i:[...i,n],rejected:r.customApiKeyResponses?.rejected??[]}}}),Uo.cache.clear?.(),ha()}function io(e){let t=w(),n=Tr(e);return t.customApiKeyResponses?.approved?.includes(n)??!1}async function ao(){await oo(),C(e=>({...e,primaryApiKey:void 0})),Uo.cache.clear?.(),ha()}async function oo(){try{await wr()}catch(e){E(e)}}function so(e){if(!Zn(e.scopes))return D(`tengu_oauth_tokens_not_claude_ai`,{}),{success:!0};if(!e.refreshToken||!e.expiresAt)return D(`tengu_oauth_tokens_inference_only`,{}),{success:!0};let t=la(),n=t.name;try{let r=t.read()||{},i=r.claudeAiOauth;r.claudeAiOauth={accessToken:e.accessToken,refreshToken:e.refreshToken,expiresAt:e.expiresAt,scopes:e.scopes,subscriptionType:e.subscriptionType??i?.subscriptionType??null,rateLimitTier:e.rateLimitTier??i?.rateLimitTier??null};let a=t.update(r);return a.success?D(`tengu_oauth_tokens_saved`,{storageBackend:n}):D(`tengu_oauth_tokens_save_failed`,{storageBackend:n}),K.cache?.clear?.(),Ki(),Ca(),a}catch(e){return E(e),D(`tengu_oauth_tokens_save_exception`,{storageBackend:n,error:_(e)}),{success:!1,warning:`Failed to save OAuth tokens`}}}function co(){K.cache?.clear?.(),P()}async function lo(){try{let{mtimeMs:e}=await Et(vt(c(),`.credentials.json`));e!==Wo&&(Wo=e,co())}catch{K.cache?.clear?.()}}function uo(e){let t=Go.get(e);if(t)return t;let n=fo(e).finally(()=>{Go.delete(e)});return Go.set(e,n),n}async function fo(e){co();let t=await po();return t?.refreshToken?t.accessToken===e?mo(0,!0):(D(`tengu_oauth_401_recovered_from_keychain`,{}),!0):!1}async function po(){if(u())return null;if(process.env.CLAUDE_CODE_OAUTH_TOKEN||pr())return K();try{let e=(await la().readAsync())?.claudeAiOauth;return e?.accessToken?e:null}catch(e){return E(e),null}}function mo(e=0,t=!1){return e===0&&!t?Ko||(Ko=ho(e,t).finally(()=>{Ko=null}),Ko):ho(e,t)}async function ho(e,t){await lo();let n=K();if(!t&&(!n?.refreshToken||!ir(n.expiresAt))||!n?.refreshToken||!Zn(n.scopes))return!1;K.cache?.clear?.(),P();let r=await po();if(!r?.refreshToken||!ir(r.expiresAt))return!1;let i=c();await Tt(i,{recursive:!0});let a;try{D(`tengu_oauth_token_refresh_lock_acquiring`,{}),a=await We(i),D(`tengu_oauth_token_refresh_lock_acquired`,{})}catch(n){return n.code===`ELOCKED`?e<5?(D(`tengu_oauth_token_refresh_lock_retry`,{retryCount:e+1}),await ba(1e3+Math.random()*1e3),ho(e+1,t)):(D(`tengu_oauth_token_refresh_lock_retry_limit_reached`,{maxRetries:5}),!1):(E(n),D(`tengu_oauth_token_refresh_lock_error`,{error:_(n)}),!1)}try{K.cache?.clear?.(),P();let e=await po();return!e?.refreshToken||!ir(e.expiresAt)?(D(`tengu_oauth_token_refresh_race_resolved`,{}),!1):(D(`tengu_oauth_token_refresh_starting`,{}),so(await tr(e.refreshToken,{scopes:Zn(e.scopes)?void 0:e.scopes})),K.cache?.clear?.(),P(),!0)}catch(e){E(e),K.cache?.clear?.(),P();let t=await po();return t&&!ir(t.expiresAt)?(D(`tengu_oauth_token_refresh_race_recovered`,{}),!0):!1}finally{D(`tengu_oauth_token_refresh_lock_releasing`,{}),await a(),D(`tengu_oauth_token_refresh_lock_released`,{})}}function B(){return L()?Zn(K()?.scopes):!1}function go(){return K()?.scopes?.includes(`user:profile`)??!1}function _o(){return!(s(process.env.CLAUDE_CODE_USE_BEDROCK)||s(process.env.CLAUDE_CODE_USE_VERTEX)||s(process.env.CLAUDE_CODE_USE_FOUNDRY)||B())}function vo(){return L()?w().oauthAccount:void 0}function yo(){let e=vo()?.billingType;return!(!B()||!e||e!==`stripe_subscription`&&e!==`stripe_subscription_contracted`&&e!==`apple_subscription`&&e!==`google_play_subscription`)}function bo(){let e=V();return e===`max`||e===`enterprise`||e===`team`||e===`pro`||e===null}function V(){if(In())return Fn();if(!L())return null;let e=K();return e?e.subscriptionType??null:null}function xo(){return V()===`max`}function So(){return V()===`team`}function Co(){return V()===`team`&&Eo()===`default_claude_max_5x`}function wo(){return V()===`enterprise`}function To(){return V()===`pro`}function Eo(){if(!L())return null;let e=K();return e?e.rateLimitTier??null:null}function Do(){switch(V()){case`enterprise`:return`Claude Enterprise`;case`team`:return`Claude Team`;case`max`:return`Claude Max`;case`pro`:return`Claude Pro`;default:return`Claude API`}}function Oo(){return!!(s(process.env.CLAUDE_CODE_USE_BEDROCK)||s(process.env.CLAUDE_CODE_USE_VERTEX)||s(process.env.CLAUDE_CODE_USE_FOUNDRY)||s(process.env.CLAUDE_CODE_USE_OPENAI)||s(process.env.CLAUDE_CODE_USE_GEMINI)||s(process.env.CLAUDE_CODE_USE_GROK))}function ko(){return(x()||{}).otelHeadersHelper}function Ao(){let e=ko();if(!e)return!1;let t=b(`projectSettings`),n=b(`localSettings`);return t?.otelHeadersHelper===e||n?.otelHeadersHelper===e}function jo(){let e=ko();if(!e)return{};let t=parseInt(process.env.CLAUDE_CODE_OTEL_HEADERS_HELPER_DEBOUNCE_MS||Yo.toString(),10);if(qo&&Date.now()-Jo<t)return qo;if(Ao()&&!T())return{};try{let t=qe(e,{timeout:3e4})?.toString().trim();if(!t)throw Error(`otelHeadersHelper did not return a valid value`);let n=Ee(t);if(typeof n!=`object`||!n||Array.isArray(n))throw Error(`otelHeadersHelper must return a JSON object with string key-value pairs`);for(let[e,t]of Object.entries(n))if(typeof t!=`string`)throw Error(`otelHeadersHelper returned non-string value for key "${e}": ${typeof t}`);return qo=n,Jo=Date.now(),qo}catch(e){throw E(Error(`Error getting OpenTelemetry headers from otelHeadersHelper (in settings): ${_(e)}`)),e}}function Mo(e){return e===`max`||e===`pro`}function No(){let e=V();return B()&&e!==null&&Mo(e)}function Po(){if(A()!==`firstParty`)return;let{source:e}=Oa(),t={};e===`CLAUDE_CODE_OAUTH_TOKEN`||e===`CLAUDE_CODE_OAUTH_TOKEN_FILE_DESCRIPTOR`?t.tokenSource=e:B()?t.subscription=Do():t.tokenSource=e;let{key:n,source:r}=Aa();if(n&&(t.apiKeySource=r),e===`claude.ai`||r===`/login managed key`){let e=vo()?.organizationName;e&&(t.organization=e)}let i=vo()?.emailAddress;return(e===`claude.ai`||r===`/login managed key`)&&i&&(t.email=i),t}async function Fo(){if(process.env.ANTHROPIC_UNIX_SOCKET||!L())return{valid:!0};let e=b(`policySettings`)?.forceLoginOrgUUID;if(!e)return{valid:!0};await mo();let t=K();if(!t)return{valid:!0};let{source:n}=Oa(),r=n===`CLAUDE_CODE_OAUTH_TOKEN`||n===`CLAUDE_CODE_OAUTH_TOKEN_FILE_DESCRIPTOR`,i=await Yn(t.accessToken);if(!i)return{valid:!1,message:`Unable to verify organization for the current authentication token.\nThis machine requires organization ${e} but the profile could not be fetched.\nThis may be a network error, or the token may lack the user:profile scope required for\nverification (tokens from 'claude setup-token' do not include this scope).\nTry again, or obtain a full-scope token.`};let a=i.organization.uuid;return a===e?{valid:!0}:r?{valid:!1,message:`The ${n===`CLAUDE_CODE_OAUTH_TOKEN`?`CLAUDE_CODE_OAUTH_TOKEN`:`CLAUDE_CODE_OAUTH_TOKEN_FILE_DESCRIPTOR`} environment variable provides a token for a\ndifferent organization than required by this machine's managed settings.\n\nRequired organization: ${e}\nToken organization: ${a}\n\nRemove the environment variable or obtain a token for the correct organization.`}:{valid:!1,message:`Your authentication token belongs to organization ${a},\nbut this machine requires organization ${e}.\n\nAuthentication token belongs to the wrong organization.`}}var Io,H,U,W,Lo,Ro,G,zo,Bo,Vo,Ho,Uo,K,Wo,Go,Ko,qo,Jo,Yo,Xo,q=e((()=>{te(),Ke(),i(),k(),at(),wn(),j(),h(),qn(),lr(),Xn(),yr(),Er(),jr(),Nr(),Zi(),Ue(),v(),l(),Re(),Ye(),He(),et(),nt(),ua(),ya(),Cr(),S(),xa(),je(),Ta(),Io=300*1e3,H=null,U=null,W=0,Lo=3600*1e3,Ro=180*1e3,G=tt(async()=>{let e=await Wa(),t=await Ka();return(e||t)&&await Ar(),t},Lo),zo=5e3,Bo=3600*1e3,Vo=180*1e3,Ho=tt(async()=>await Za(),Bo),Uo=r(()=>{if(u())return null;if(process.platform===`darwin`){let e=ma();if(e){if(e.stdout)return{key:e.stdout,source:`/login managed key`}}else{let e=N();try{let t=qe(`security find-generic-password -a $USER -w -s "${e}"`);if(t)return{key:t,source:`/login managed key`}}catch(e){E(e)}}}let e=w();return e.primaryApiKey?{key:e.primaryApiKey,source:`/login managed key`}:null}),K=r(()=>{if(u())return null;if(process.env.CLAUDE_CODE_OAUTH_TOKEN)return{accessToken:process.env.CLAUDE_CODE_OAUTH_TOKEN,refreshToken:null,expiresAt:null,scopes:[`user:inference`],subscriptionType:null,rateLimitTier:null};let e=pr();if(e)return{accessToken:e,refreshToken:null,expiresAt:null,scopes:[`user:inference`],subscriptionType:null,rateLimitTier:null};try{let e=la().read()?.claudeAiOauth;return e?.accessToken?e:null}catch(e){return E(e),null}}),Wo=0,Go=new Map,Ko=null,qo=null,Jo=0,Yo=1740*1e3,Xo=class extends Error{}}));function J(){return!s(process.env.CLAUDE_CODE_DISABLE_FAST_MODE)}function Zo(){return J()?$o()===null:!1}function Qo(e,t){switch(e){case`free`:return t===`oauth`?`Fast mode requires a paid subscription`:`Fast mode unavailable during evaluation. Please purchase credits.`;case`preference`:return`Fast mode has been disabled by your organization`;case`extra_usage_disabled`:return`Fast mode requires extra usage billing · enable it at claude.ai/settings/usage`;case`network_error`:return`Fast mode unavailable due to network connectivity issues`;case`unknown`:return`Fast mode is currently unavailable`}}function $o(){if(!J())return`Fast mode is not available`;if(ut(),g()&&Se()&&!fe()&&!b(`flagSettings`)?.fastMode){let e=`Fast mode is not available in the Agent SDK`;return y(`Fast mode unavailable: ${e}`),e}if(A()!==`firstParty`){let e=`Fast mode is not available on Bedrock, Vertex, or Foundry`;return y(`Fast mode unavailable: ${e}`),e}if(Y.status===`disabled`){if((Y.reason===`network_error`||Y.reason===`unknown`)&&s(process.env.CLAUDE_CODE_SKIP_FAST_MODE_NETWORK_ERRORS))return null;let e=K()===null?`api-key`:`oauth`,t=Qo(Y.reason,e);return y(`Fast mode unavailable: ${t}`),t}return null}function es(){return`opus`+(Cc()?`[1m]`:``)}function ts(e){if(!J()||!Zo()||!ns(e))return!1;let t=Be();return!t.fastModePerSessionOptIn&&t.fastMode===!0}function ns(e){if(!J())return!1;let t=$(e??vc());return t.toLowerCase().includes(`opus-4-7`)||t.toLowerCase().includes(`opus-4-6`)}function rs(){return gs.status===`cooldown`&&Date.now()>=gs.resetAt&&(J()&&!_s&&(y(`Fast mode cooldown expired, re-enabling fast mode`),_s=!0,ys.emit()),gs={status:`active`}),gs}function is(e,t){if(!J())return;gs={status:`cooldown`,resetAt:e,reason:t},_s=!1;let n=e-Date.now();y(`Fast mode cooldown triggered (${t}), duration ${Math.round(n/1e3)}s`),D(`tengu_fast_mode_fallback_triggered`,{cooldown_duration_ms:n,cooldown_reason:t}),vs.emit(e,t)}function as(){gs={status:`active`}}function os(){Y.status!==`disabled`&&(Y={status:`disabled`,reason:`preference`},Ve(`userSettings`,{fastMode:void 0}),C(e=>({...e,penguinModeOrgEnabled:!1})),ws.emit(!1))}function ss(e){switch(e){case`out_of_credits`:return`Fast mode disabled · extra usage credits exhausted`;case`org_level_disabled`:case`org_service_level_disabled`:return`Fast mode disabled · extra usage disabled by your organization`;case`org_level_disabled_until`:return`Fast mode disabled · extra usage spending cap reached`;case`member_level_disabled`:return`Fast mode disabled · extra usage disabled for your account`;case`seat_tier_level_disabled`:case`seat_tier_zero_credit_limit`:case`member_zero_credit_limit`:return`Fast mode disabled · extra usage not available for your plan`;case`overage_not_provisioned`:case`no_limits_configured`:return`Fast mode requires extra usage billing · enable it at claude.ai/settings/usage`;default:return`Fast mode disabled · extra usage not available`}}function cs(e){return e===`org_level_disabled_until`||e===`out_of_credits`}function ls(e){let t=ss(e);y(`Fast mode overage rejection: ${e??`unknown`} — ${t}`),D(`tengu_fast_mode_overage_rejected`,{overage_disabled_reason:e??`unknown`}),cs(e)||(Ve(`userSettings`,{fastMode:void 0}),C(e=>({...e,penguinModeOrgEnabled:!1}))),Ss.emit(t)}function us(){return rs().status===`cooldown`}function ds(e,t){let n=J()&&Zo()&&!!t&&ns(e);return n&&us()?`cooldown`:n?`on`:`off`}async function fs(e){let t=`${O().BASE_API_URL}/api/claude_code_penguin_mode`,n=`accessToken`in e?{Authorization:`Bearer ${e.accessToken}`,"anthropic-beta":ct}:{"x-api-key":e.apiKey};return(await p.get(t,{headers:n})).data}function ps(){if(!J()||Y.status!==`pending`)return;let e=process.env.USER_TYPE===`ant`,t=w().penguinModeOrgEnabled===!0;Y=e||t?{status:`enabled`}:{status:`disabled`,reason:`unknown`}}async function ms(){if($e()||!J())return;if(Os)return y(`Fast mode prefetch in progress, returning in-flight promise`),Os;let e=R();if(!(K()?.accessToken&&go())&&!e){let e=process.env.USER_TYPE===`ant`,t=w().penguinModeOrgEnabled===!0;Y=e||t?{status:`enabled`}:{status:`disabled`,reason:`preference`};return}let t=Date.now();if(t-Ds<Es){y(`Skipping fast mode prefetch, fetched recently`);return}Ds=t;let n=async()=>{let t=K(),n=t?.accessToken&&go()?{accessToken:t.accessToken}:e?{apiKey:e}:null;if(!n)throw Error(`No auth available`);return fs(n)};async function r(){try{let e;try{e=await n()}catch(t){if(p.isAxiosError(t)&&(t.response?.status===401||t.response?.status===403&&typeof t.response?.data==`string`&&t.response.data.includes(`OAuth token has been revoked`))){let r=K()?.accessToken;if(r)await uo(r),e=await n();else throw t}else throw t}let t=Y.status===`pending`?w().penguinModeOrgEnabled:Y.status===`enabled`;Y=e.enabled?{status:`enabled`}:{status:`disabled`,reason:e.disabled_reason??`preference`},t!==e.enabled&&(e.enabled||Ve(`userSettings`,{fastMode:void 0}),C(t=>({...t,penguinModeOrgEnabled:e.enabled})),ws.emit(e.enabled)),y(`Org fast mode: ${e.enabled?`enabled`:`disabled (${e.disabled_reason??`preference`})`}`)}catch(e){let t=process.env.USER_TYPE===`ant`,n=w().penguinModeOrgEnabled===!0;Y=t||n?{status:`enabled`}:{status:`disabled`,reason:`network_error`},y(`Failed to fetch org fast mode status, defaulting to ${Y.status===`enabled`?`enabled (cached)`:`disabled (network_error)`}: ${e}`,{level:`error`}),D(`tengu_org_penguin_mode_fetch_failed`,{})}finally{Os=null}}return Os=r(),Os}var hs,gs,_s,vs,ys,bs,xs,Ss,Cs,Y,ws,Ts,Es,Ds,Os,ks=e((()=>{m(),k(),h(),at(),q(),dt(),Ue(),v(),l(),Fc(),j(),Qe(),S(),_e(),hs=`Opus 4.7`,gs={status:`active`},_s=!1,vs=Te(),ys=Te(),bs=vs.subscribe,xs=ys.subscribe,Ss=Te(),Cs=Ss.subscribe,Y={status:`pending`},ws=Te(),Ts=ws.subscribe,Es=3e4,Ds=0,Os=null}));function As(e){return J()&&e?Vs:Bs}function js(e,t){return t.input_tokens/1e6*e.inputTokens+t.output_tokens/1e6*e.outputTokens+(t.cache_read_input_tokens??0)/1e6*e.promptCacheReadTokens+(t.cache_creation_input_tokens??0)/1e6*e.promptCacheWriteTokens+(t.server_tool_use?.web_search_requests??0)*e.webSearchRequests}function Ms(e,t){let n=Q(e);return n===Z(un.firstParty)?As(t.speed===`fast`):Gs[n]||(Ns(e,n),Gs[Q(vc())]??Ws)}function Ns(e,t){D(`tengu_unknown_model_cost`,{model:e,shortName:t}),ue()}function Ps(e,t){return js(Ms(e,t),t)}function Fs(e,t){return Ps(e,{input_tokens:t.inputTokens,output_tokens:t.outputTokens,cache_read_input_tokens:t.cacheReadInputTokens,cache_creation_input_tokens:t.cacheCreationInputTokens})}function Is(e){return Number.isInteger(e)?`$${e}`:`$${e.toFixed(2)}`}function Ls(e){return`${Is(e.inputTokens)}/${Is(e.outputTokens)} per Mtok`}var Rs,zs,Bs,Vs,Hs,Us,Ws,Gs,Ks=e((()=>{at(),h(),ks(),hn(),Fc(),Rs={inputTokens:3,outputTokens:15,promptCacheWriteTokens:3.75,promptCacheReadTokens:.3,webSearchRequests:.01},zs={inputTokens:15,outputTokens:75,promptCacheWriteTokens:18.75,promptCacheReadTokens:1.5,webSearchRequests:.01},Bs={inputTokens:5,outputTokens:25,promptCacheWriteTokens:6.25,promptCacheReadTokens:.5,webSearchRequests:.01},Vs={inputTokens:30,outputTokens:150,promptCacheWriteTokens:37.5,promptCacheReadTokens:3,webSearchRequests:.01},Hs={inputTokens:.8,outputTokens:4,promptCacheWriteTokens:1,promptCacheReadTokens:.08,webSearchRequests:.01},Us={inputTokens:1,outputTokens:5,promptCacheWriteTokens:1.25,promptCacheReadTokens:.1,webSearchRequests:.01},Ws=Bs,Gs={[Z(nn.firstParty)]:Hs,[Z(rn.firstParty)]:Us,[Z(tn.firstParty)]:Rs,[Z(en.firstParty)]:Rs,[Z(an.firstParty)]:Rs,[Z(on.firstParty)]:Rs,[Z(fn.firstParty)]:Rs,[Z(sn.firstParty)]:zs,[Z(cn.firstParty)]:zs,[Z(ln.firstParty)]:Bs,[Z(un.firstParty)]:Bs}}));function X(e){return Js.includes(e)}function qs(e){return Ys.includes(e)}var Js,Ys,Xs=e((()=>{Js=[`sonnet`,`opus`,`haiku`,`best`,`sonnet[1m]`,`opus[1m]`,`opusplan`],Ys=[`sonnet`,`opus`,`haiku`]}));function Zs(e,t){return e.includes(t)?!0:X(e)?$(e).toLowerCase().includes(t):!1}function Qs(e,t){return e.startsWith(t)?e.length===t.length||e[t.length]===`-`:!1}function $s(e,t){let n=X(e)?$(e).toLowerCase():e;return!!(Qs(n,t)||!t.startsWith(`claude-`)&&Qs(n,`claude-${t}`))}function ec(e,t){for(let n of t){if(qs(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 tc(e){let{availableModels:t}=x()||{};if(!t)return!0;if(t.length===0)return!1;let n=yn(e).trim().toLowerCase(),r=t.map(e=>e.trim().toLowerCase());if(r.includes(n)&&(!qs(n)||!ec(n,r)))return!0;for(let e of r)if(qs(e)&&!ec(e,r)&&Zs(n,e))return!0;if(X(n)){let e=$(n).toLowerCase();if(r.includes(e))return!0}for(let e of r)if(!qs(e)&&X(e)&&$(e).toLowerCase()===n)return!0;for(let e of r)if(!qs(e)&&!X(e)&&$s(n,e))return!0;return!1}var nc=e((()=>{S(),Xs(),Fc(),wn()}));function rc(){return process.env.OPENAI_AUTH_MODE===`chatgpt`}var ic,ac,oc,sc=e((()=>{ic=`gpt-5.5`,ac=`gpt-5.4-mini`,oc=[{value:`gpt-5.5`,label:`GPT-5.5`,description:`Frontier model for complex coding, research, and real-world work`},{value:`gpt-5.4`,label:`GPT-5.4`,description:`Strong model for everyday coding`},{value:`gpt-5.4-mini`,label:`GPT-5.4-Mini`,description:`Small, fast, and cost-efficient model for simpler coding tasks`},{value:`gpt-5.3-codex`,label:`GPT-5.3-Codex`,description:`Coding-optimized model`},{value:`gpt-5.3-codex-spark`,label:`GPT-5.3-Codex-Spark`,description:`Ultra-fast coding model`},{value:`gpt-5.2`,label:`GPT-5.2`,description:`Optimized for professional work and long-running agents`}]}));function cc(){let e=A();return e===`openai`&&rc()?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||gc()}function lc(e){return e===M().opus40||e===M().opus41||e===M().opus45||e===M().opus46||e===M().opus47}function uc(){let e,t=ge();if(t!==void 0)e=t;else{let t=x()||{};e=process.env.ANTHROPIC_MODEL||t.model||void 0}if(!(e&&!tc(e)))return e}function dc(){let e=uc();return e==null?yc():$(e)}function fc(){return mc()}function pc(){let e=A();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 mc(){let e=A();return e===`openai`&&rc()?ic: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:pc()||M().opus47}function hc(){let e=A();return e===`openai`&&rc()?ic: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:pc()||(e===`firstParty`?M().sonnet46:M().sonnet45)}function gc(){let e=A();return e===`openai`&&rc()?ac: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:pc()||M().haiku45}function _c(e){let{permissionMode:t,mainLoopModel:n,exceeds200kTokens:r=!1}=e;return uc()===`opusplan`&&t===`plan`&&!r?mc():uc()===`haiku`&&t===`plan`?hc():n}function vc(){return process.env.USER_TYPE===`ant`?Lt()?.defaultModel??mc()+`[1m]`:xo()||Co()?mc()+(Cc()?`[1m]`:``):hc()}function yc(){return $(vc())}function Z(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&&t[1]?t[1]:e}function Q(e){return Z(yn(e))}function bc(e=!1){return xo()||Co()?Cc()?`Opus 4.7 with 1M context · Most capable for complex work${e?Sc(!0):``}`:`Opus 4.7 · Most capable for complex work${e?Sc(!0):``}`:`Sonnet 4.6 · Best for everyday tasks`}function xc(e){return e===`opusplan`?`Opus 4.7 in plan mode, else Sonnet 4.6`:Dc($(e))}function Sc(e){if(A()!==`firstParty`)return``;let t=Ls(As(e));return` ·${e?` (↯)`:``} ${t}`}function Cc(){return!(bi()||To()||A()!==`firstParty`||!Mt()||B()&&V()===null)}function wc(e){return e===`opusplan`?`Opus Plan`:X(e)?ft(e):Dc(e)}function Tc(e){switch(e){case M().opus47:return`Opus 4.7`;case M().opus47+`[1m]`:return`Opus 4.7 (1M context)`;case M().opus46:return`Opus 4.6`;case M().opus46+`[1m]`:return`Opus 4.6 (1M context)`;case M().opus45:return`Opus 4.5`;case M().opus41:return`Opus 4.1`;case M().opus40:return`Opus 4`;case M().sonnet46+`[1m]`:return`Sonnet 4.6 (1M context)`;case M().sonnet46:return`Sonnet 4.6`;case M().sonnet45+`[1m]`:return`Sonnet 4.5 (1M context)`;case M().sonnet45:return`Sonnet 4.5`;case M().sonnet40:return`Sonnet 4`;case M().sonnet40+`[1m]`:return`Sonnet 4 (1M context)`;case M().sonnet37:return`Sonnet 3.7`;case M().sonnet35:return`Sonnet 3.5`;case M().haiku45:return`Haiku 4.5`;case M().haiku35:return`Haiku 3.5`;default:return null}}function Ec(e){let[t=``,...n]=e.split(`-`);return[t.slice(0,3)+`*`.repeat(Math.max(0,t.length-3)),...n].join(`-`)}function Dc(e){let t=Tc(e);if(t)return t;if(process.env.USER_TYPE===`ant`){let t=$(e),n=zt(e);return n?Ec(n.model.replace(/\[1m\]$/i,``))+(I(t)?`[1m]`:``):t===e?t:`${e} (${t})`}return e}function $(e){let t=e.trim(),n=t.toLowerCase(),r=I(n),i=r?n.replace(/\[1m]$/i,``).trim():n;if(X(i))switch(i){case`opusplan`:return hc()+(r?`[1m]`:``);case`sonnet`:return hc()+(r?`[1m]`:``);case`haiku`:return gc()+(r?`[1m]`:``);case`opus`:return mc()+(r?`[1m]`:``);case`best`:return fc();default:}if(A()===`firstParty`&&kc(i)&&Ac())return mc()+(r?`[1m]`:``);if(process.env.USER_TYPE===`ant`){let e=I(n),t=zt(n.replace(/\[1m]$/i,``).trim());if(t){let n=e?`[1m]`:``;return t.model+n}}return r?t.replace(/\[1m\]$/i,``).trim()+`[1m]`:t}function Oc(e,t){return I(e)||!I(t)?e:xi($(e))?e+`[1m]`:e}function kc(e){return Pc.includes(e)}function Ac(){return!s(process.env.CLAUDE_CODE_DISABLE_LEGACY_MODEL_REMAP)}function jc(e){if(e===null)return process.env.USER_TYPE===`ant`?`Default for Ants (${xc(vc())})`:B()?`Default (${bc()})`:`Default (${yc()})`;let t=$(e);return e===t?t:`${e} (${t})`}function Mc(e){if(A()===`foundry`)return;let t=e.toLowerCase().includes(`[1m]`),n=Q(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`Claude 3.7 Sonnet`;if(n.includes(`claude-3-5-sonnet`))return`Claude 3.5 Sonnet`;if(n.includes(`claude-haiku-4-5`))return`Haiku 4.5`;if(n.includes(`claude-3-5-haiku`))return`Claude 3.5 Haiku`}function Nc(e){return e.replace(/\[(1|2)m\]/gi,``)}var Pc,Fc=e((()=>{h(),Bt(),q(),Mi(),l(),wn(),Ks(),S(),j(),ze(),nc(),Xs(),pt(),sc(),Pc=[`claude-opus-4-20250514`,`claude-opus-4-1-20250805`,`claude-opus-4-0`,`claude-opus-4-1`]}));export{os as $,ei as $n,Tn as $r,To as $t,sc as A,Yi as An,rr as Ar,z as At,Fs as B,wi as Bn,Zn as Br,q as Bt,$ as C,ua as Cn,P as Cr,Ra as Ct,Oc as D,Ri as Dn,ur as Dr,Oa as Dt,wc as E,Ki as En,yr as Er,La as Et,Xs as F,Wi as Fn,lr as Fr,V as Ft,hs as G,I as Gn,Nn as Gr,B as Gt,Ls as H,Ei as Hn,Jn as Hr,L as Ht,Hs as I,Fi as In,ir as Ir,uo as It,rs as J,yi as Jn,jn as Jr,wo as Jt,as as K,Mi as Kn,Rn as Kr,No as Kt,Us as L,Ii as Ln,Qn as Lr,ka as Lt,nc as M,Hi as Mn,nr as Mr,jo as Mt,tc as N,Vi as Nn,ar as Nr,Eo as Nt,ic as O,Xi as On,dr as Or,K as Ot,Js as P,Ui as Pn,or as Pr,Do as Pt,ls as Q,li as Qn,Dn as Qr,yo as Qt,Rs as R,ji as Rn,sr as Rr,bo as Rt,Nc as S,la as Sn,Tr as Sr,Aa as St,Dc as T,ta as Tn,vr as Tr,Uo as Tt,As as U,Ti as Un,Yn as Ur,Na as Ut,Ps as V,Si as Vn,cr as Vr,_o as Vt,Ks as W,Ci as Wn,Xn as Wr,Fa as Wt,$o as X,ci as Xn,Ln as Xr,xo as Xt,ds as Y,hi as Yn,qn as Yr,Ya as Yt,ts as Z,ii as Zn,Pn as Zr,Ao as Zt,Fc as _,Pt as _i,xa as _n,Mr as _r,qa as _t,gc as a,Gt as ai,eo as an,Xr as ar,xs as at,Cc as b,j as bi,ya as bn,Dr as br,Po as bt,mc as c,$t as ci,Qa as cn,Ir as cr,Ts as ct,Mc as d,Vt as di,ro as dn,Vr as dr,is as dt,kn as ei,Co as en,$r as er,ks as et,Sc as f,Rt as fi,so as fn,Ur as fr,Ea as ft,uc as g,It as gi,Ta as gn,Yr as gr,Ha as gt,cc as h,Nt as hi,Sa as hn,Jr as hr,Xa as ht,bc as i,Yt as ii,to as in,Zr as ir,ns as it,rc as j,Zi as jn,er as jr,vo as jt,oc as k,Gi as kn,$n as kr,po as kt,hc as l,Kt as li,Ho as ln,Lr as lr,ms as lt,_c as m,zt as mi,Ca as mn,Br as mr,mo as mt,fc as n,M as ni,Oo as nn,ni as nr,us as nt,yc as o,Jt as oi,G as on,Kr as or,bs as ot,Tc as p,Bt as pi,Fo as pn,Rr as pr,Ia as pt,es as q,bi as qn,An as qr,io as qt,Q as r,wn as ri,Ua as rn,ti as rr,J as rt,vc as s,Zt as si,Ga as sn,Wr as sr,Cs as st,Z as t,xn as ti,So as tn,Qr as tr,Zo as tt,dc as u,Ht as ui,ao as un,Hr as ur,ps as ut,Ac as v,A as vi,ba as vn,Nr as vr,$a as vt,xc as w,aa as wn,Cr as wr,Va as wt,jc as x,Mt as xi,fa as xn,Er as xr,R as xt,lc as y,jt as yi,pa as yn,jr as yr,co as yt,Gs as z,Oi as zn,tr as zr,go as zt};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{l as t,o as n}from"./envUtils-DSxRz_kt.js";import{n as r,t as i}from"./axios-DaWTGg7G.js";import{E as a,F as o,I as s,S as c,V as l,W as u,a as d,d as f,l as p,nt as m,p as ee,rt as te,w as h,z as g}from"./debug-RZ4NuXyS.js";import{Gt as ne,Jt as re}from"./settings-hQDLwPVj.js";import{C as ie,S as ae,b as oe,c as se,g as ce,w as _}from"./config-CE058cvr.js";import{n as v,r as y}from"./execFileNoThrow-CCX-JY8h.js";import{o as b,s as x}from"./log-CZ0zYP_c.js";import{n as S,r as C}from"./analytics-CkYUHW_U.js";import{_n as le,vn as ue}from"./model-CwO-g1RW.js";import{B as de,R as fe,z as pe}from"./sessionState-CjNY991n.js";import{ft as me,ut as he}from"./esm-BLPbfHQd.js";import{C as ge,S as _e,_ as ve,a as w,b as ye,c as be,d as xe,g as Se,h as Ce,i as we,l as Te,n as Ee,o as T,p as De,s as Oe,t as ke,v as E,x as Ae,y as je}from"./pidLock-DJnS_38v.js";import{a as Me,i as Ne,n as Pe,r as Fe,t as Ie}from"./xdg-DcF9ejUM.js";import{homedir as D}from"os";import{basename as Le,delimiter as Re,dirname as O,join as k,resolve as A}from"path";import{constants as ze}from"fs";import{createHash as Be}from"crypto";import{access as j,chmod as M,copyFile as N,mkdir as P,readdir as F,readlink as I,rename as L,rm as R,rmdir as Ve,stat as z,symlink as He,unlink as B,writeFile as V}from"fs/promises";async function Ue(e=`latest`){let t=Date.now(),{stdout:n,code:r,stderr:i}=await v(`npm`,[`view`,`@${e}`,`version`,`--prefer-online`,`--registry`,U],{timeout:3e4,preserveOutputOnError:!0}),a=Date.now()-t;if(r!==0){C(`tengu_version_check_failure`,{latency_ms:a,source_npm:!0,exit_code:r});let e=Error(`npm view failed with code ${r}: ${i}`);throw x(e),e}return C(`tengu_version_check_success`,{latency_ms:a,source_npm:!0}),p(`npm view @${e} version: ${n}`),n.trim()}async function We(e=`latest`,t,n){let i=Date.now();try{let a=await r.get(`${t}/${e}`,{timeout:3e4,responseType:`text`,...n});return C(`tengu_version_check_success`,{latency_ms:Date.now()-i}),a.data.trim()}catch(n){let a=Date.now()-i,o=n instanceof Error?n.message:String(n),s;r.isAxiosError(n)&&n.response&&(s=n.response.status),C(`tengu_version_check_failure`,{latency_ms:a,http_status:s,is_timeout:o.includes(`timeout`)});let c=Error(`Failed to fetch version from ${t}/${e}: ${o}`);throw x(c),c}}async function Ge(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 process.env.USER_TYPE===`ant`?Ue(t===`stable`?`stable`:`latest`):We(t,H)}async function Ke(e,t){let n=f();await n.rm(t,{recursive:!0,force:!0});let r=W(),i=`-${r}`;p(`Fetching integrity hash for ${i}@${e}`);let{stdout:o,code:s,stderr:c}=await v(`npm`,[`view`,`${i}@${e}`,`dist.integrity`,`--registry`,U],{timeout:3e4,preserveOutputOnError:!0});if(s!==0)throw Error(`npm view integrity failed with code ${s}: ${c}`);let l=o.trim();if(!l)throw Error(`Failed to fetch integrity hash for ${i}@${e}`);p(`Got integrity hash for ${r}: ${l}`),await n.mkdir(t);let u={name:`claude-native-installer`,version:`0.0.1`,dependencies:{"":e}},d={name:`claude-native-installer`,version:`0.0.1`,lockfileVersion:3,requires:!0,packages:{"":{name:`claude-native-installer`,version:`0.0.1`,dependencies:{"":e}},"node_modules/":{version:e,optionalDependencies:{[i]:e}},[`node_modules/${i}`]:{version:e,integrity:l}}};a(k(t,`package.json`),h(u,null,2),{encoding:`utf8`,flush:!0}),a(k(t,`package-lock.json`),h(d,null,2),{encoding:`utf8`,flush:!0});let m=await v(`npm`,[`ci`,`--prefer-online`,`--registry`,U],{timeout:6e4,preserveOutputOnError:!0,cwd:t});if(m.code!==0)throw Error(`npm ci failed with code ${m.code}: ${m.stderr}`);p(`Successfully downloaded and verified @${e}`)}function qe(){return Number(process.env.CLAUDE_CODE_STALL_TIMEOUT_MS_FOR_TESTING)||Ze}async function Je(e,t,n,i={}){let a;for(let o=1;o<=3;o++){let s=new AbortController,c,l=()=>{c&&(clearTimeout(c),c=void 0)},d=()=>{l(),c=setTimeout(e=>e.abort(),qe(),s)};try{d();let a=await r.get(e,{timeout:5*6e4,responseType:`arraybuffer`,signal:s.signal,onDownloadProgress:()=>{d()},...i});l();let o=Be(`sha256`);o.update(a.data);let c=o.digest(`hex`);if(c!==t)throw Error(`Checksum mismatch: expected ${t}, got ${c}`);await V(n,Buffer.from(a.data)),await M(n,493);return}catch(e){l();let t=r.isCancel(e);if(a=t?new Qe:u(e),t&&o<3){p(`Download stalled on attempt ${o}/3, retrying...`),await ue(1e3);continue}throw a}}throw a??Error(`Download failed after all retries`)}async function Ye(e,t,n,i){let a=f();await a.rm(t,{recursive:!0,force:!0});let o=W(),s=Date.now();C(`tengu_binary_download_attempt`,{});let c;try{c=(await r.get(`${n}/${e}/manifest.json`,{timeout:1e4,responseType:`json`,...i})).data}catch(t){let i=Date.now()-s,a=t instanceof Error?t.message:String(t),o;throw r.isAxiosError(t)&&t.response&&(o=t.response.status),C(`tengu_binary_manifest_fetch_failure`,{latency_ms:i,http_status:o,is_timeout:a.includes(`timeout`)}),x(Error(`Failed to fetch manifest from ${n}/${e}/manifest.json: ${a}`)),t}let l=c.platforms[o];if(!l)throw C(`tengu_binary_platform_not_found`,{}),Error(`Platform ${o} not found in manifest for version ${e}`);let u=l.checksum,d=G(o),p=`${n}/${e}/${o}/${d}`;await a.mkdir(t);let m=k(t,d);try{await Je(p,u,m,i||{}),C(`tengu_binary_download_success`,{latency_ms:Date.now()-s})}catch(e){let t=Date.now()-s,n=e instanceof Error?e.message:String(e),i;throw r.isAxiosError(e)&&e.response&&(i=e.response.status),C(`tengu_binary_download_failure`,{latency_ms:t,http_status:i,is_timeout:n.includes(`timeout`),is_checksum_mismatch:n.includes(`Checksum mismatch`)}),x(Error(`Failed to download binary from ${p}: ${n}`)),e}}async function Xe(e,t){return process.env.USER_TYPE===`ant`?(await Ke(e,t),`npm`):(await Ye(e,t,H),`binary`)}var H,U,Ze,Qe,$e=e((()=>{i(),S(),d(),g(),y(),ee(),b(),le(),c(),$(),H=`https://storage.googleapis.com/claude-code-dist-86c565f3-f756-42ad-8dfa-d59b1c096819/claude-code-releases`,U=`https://artifactory.infra.ant.dev/artifactory/api/npm/npm-all/`,Ze=6e4,Qe=class extends Error{constructor(){super(`Download stalled: no data received for 60 seconds`),this.name=`StallTimeoutError`}}}));function W(){let e=ne.platform,t=process.arch===`x64`?`x64`:process.arch===`arm64`?`arm64`:null;if(!t){let e=Error(`Unsupported architecture: ${process.arch}`);throw p(`Native installer does not support architecture: ${process.arch}`,{level:`error`}),e}return e===`linux`&&he.isMuslEnvironment()?`linux-${t}-musl`:`${e}-${t}`}function G(e){return e.startsWith(`win32`)?`claude.exe`:`claude`}function K(){let e=G(W());return{versions:k(Fe(),`claude`,`versions`),staging:k(Pe(),`claude`,`staging`),locks:k(Ne(),`claude`,`locks`),executable:k(Ie(),e)}}async function q(e){try{let t=await z(e);return!t.isFile()||t.size===0?!1:(await j(e,ze.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=>P(e,{recursive:!0}))),await P(O(t.executable),{recursive:!0});let r=k(t.versions,e);try{await z(r)}catch{await V(r,``,{encoding:`utf8`})}return{stagingPath:k(t.staging,e),installPath:r}}async function et(e,t,n=0){let r=K(),i=Y(r,e);if(await P(r.locks,{recursive:!0}),T()){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 C(`tengu_version_lock_acquired`,{is_pid_based:!0,is_lifetime_lock:!1,attempts:r+1}),!0;r++,r<a&&await ue(Math.min(o*2**(r-1),s))}return C(`tengu_version_lock_failed`,{is_pid_based:!0,is_lifetime_lock:!1,attempts:a}),X(e,Error(`Lock held by another process`)),!1}let a=null;try{try{a=await _(e,{stale:Z,retries:{retries:n,minTimeout:n>0?1e3:100,maxTimeout:n>0?5e3:500},lockfilePath:i,onCompromised:e=>{p(`NON-FATAL: Version lock was compromised during operation: ${e.message}`,{level:`info`})}})}catch(t){return C(`tengu_version_lock_failed`,{is_pid_based:!1,is_lifetime_lock:!1}),X(e,t),!1}try{return await t(),C(`tengu_version_lock_acquired`,{is_pid_based:!1,is_lifetime_lock:!1}),!0}catch(e){throw x(e),e}}finally{a&&await a()}}async function tt(e,t){await P(O(t),{recursive:!0});let n=`${t}.tmp.${process.pid}.${Date.now()}`;try{await N(e,n),await M(n,493),await L(n,t),p(`Atomically installed binary to ${t}`)}catch(e){try{await B(n)}catch{}throw e}}async function nt(e,t){try{let n=k(e,`node_modules`,`@anthropic-ai`),r=(await F(n)).find(e=>e.startsWith(`claude-cli-native-`));if(!r)throw C(`tengu_native_install_package_failure`,{stage_find_package:!0,error_package_not_found:!0}),Error(`Could not find platform-specific native package`);let i=k(n,r,`cli`);try{await z(i)}catch{throw C(`tengu_native_install_package_failure`,{stage_binary_exists:!0,error_binary_not_found:!0}),Error(`Native binary not found in staged package`)}await tt(i,t),await R(e,{recursive:!0,force:!0}),C(`tengu_native_install_package_success`,{})}catch(e){let t=o(e);throw!t.includes(`Could not find platform-specific`)&&!t.includes(`Native binary not found`)&&C(`tengu_native_install_package_failure`,{stage_atomic_move:!0,error_move_failed:!0}),x(u(e)),e}}async function rt(e,t){try{let n=k(e,G(W()));try{await z(n)}catch{throw C(`tengu_native_install_binary_failure`,{stage_binary_exists:!0,error_binary_not_found:!0}),Error(`Staged binary not found`)}await tt(n,t),await R(e,{recursive:!0,force:!0}),C(`tengu_native_install_binary_success`,{})}catch(e){throw o(e).includes(`Staged binary not found`)||C(`tengu_native_install_binary_failure`,{stage_atomic_move:!0,error_move_failed:!0}),x(u(e)),e}}async function it(e,t,n){n===`npm`?await nt(e,t):await rt(e,t)}async function at(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 ot(e)||n;if(s?(p(n?`Force reinstalling native installer version ${e}`:`Downloading native installer version ${e}`),await it(o,i,await Xe(e,o))):p(`Version ${e} already installed, updating symlink`),await ct(a),await lt(a,i),!await q(a)){let e=!1;try{await z(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 ot(e){let{installPath:t}=await J(e);return q(t)}async function st(e,n=!1){let r=Date.now(),i=await Ge(e),{executable:a}=K();if(p(`Checking for native installer update to version ${i}`),!n){let e=await De();if(e&&fe(i,e)){if(p(`Native installer: maxVersion ${e} is set, capping update from ${i} to ${e}`),pe(`0.0.8`,e))return p(`Native installer: current version 0.0.8 is already at or above maxVersion ${e}, skipping update`),C(`tengu_native_update_skipped_max_version`,{latency_ms:Date.now()-r,max_version:e,available_version:i}),{success:!0,latestVersion:i};i=e}}if(!n&&i===`0.0.8`&&await ot(i)&&await q(a))return p(`Found ${i} at ${a}, skipping install`),C(`tengu_native_update_complete`,{latency_ms:Date.now()-r,was_new_install:!1,was_force_reinstall:!1,was_already_running:!0}),{success:!0,latestVersion:i};if(!n&&Se(i))return C(`tengu_native_update_skipped_minimum_version`,{latency_ms:Date.now()-r,target_version:i}),{success:!0,latestVersion:i};let o=!1,s;if(t(process.env.ENABLE_LOCKLESS_UPDATES))o=await at(i,n),s=Date.now()-r;else{let{installPath:e}=await J(i);n&&await ht(e);let t=await et(e,async()=>{o=await at(i,n)},3);if(s=Date.now()-r,!t){let t=K(),n;if(T()){let r=Y(t,e);w(r)&&(n=Oe(r)?.pid)}return C(`tengu_native_update_lock_failed`,{latency_ms:s,lock_holder_pid:n}),{success:!1,latestVersion:i,lockFailed:!0,lockHolderPid:n}}}return C(`tengu_native_update_complete`,{latency_ms:s,was_new_install:o,was_force_reinstall:n}),p(`Successfully updated to version ${i}`),{success:!0,latestVersion:i}}async function ct(e){try{await Ve(e),p(`Removed empty directory at ${e}`)}catch(t){let n=s(t);n!==`ENOTDIR`&&n!==`ENOENT`&&n!==`ENOTEMPTY`&&p(`Could not remove directory at ${e}: ${t}`)}}async function lt(e,t){if(W().startsWith(`win32`))try{await P(O(e),{recursive:!0});let n;try{n=await z(e)}catch{}if(n){try{let e=await z(t);if(n.size===e.size)return!1}catch{}let r=`${e}.old.${Date.now()}`;await L(e,r);try{await N(t,e);try{await B(r)}catch{}}catch(t){try{await L(r,e)}catch(e){let n=Error(`Failed to restore old executable: ${e}`,{cause:t});throw x(n),n}throw t}}else try{await N(t,e)}catch(e){throw l(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=O(e);try{await P(n,{recursive:!0}),p(`Created directory ${n} for symlink`)}catch(e){return x(Error(`Failed to create directory ${n}: ${e}`)),!1}try{let n=!1;try{await z(e),n=!0}catch{}if(n){try{let n=await I(e);if(A(O(e),n)===A(t))return!1}catch{}await B(e)}}catch(e){x(Error(`Failed to check/remove existing symlink: ${e}`))}let r=`${e}.tmp.${process.pid}.${Date.now()}`;try{return await He(t,r),await L(r,e),p(`Atomically updated symlink ${e} -> ${t}`),!0}catch(n){try{await B(r)}catch{}return x(Error(`Failed to create symlink from ${e} to ${t}: ${n}`)),!1}}async function ut(e=!1){if(t(process.env.DISABLE_INSTALLATION_CHECKS))return[];let n=await Te();if(n===`development`||!(e||n===`native`))return[];let r=K(),i=[],a=O(r.executable),o=A(a),s=W().startsWith(`win32`);try{await j(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 I(r.executable);await q(A(O(r.executable),e))||i.push({message:`Claude symlink points to missing or invalid binary: ${e}`,userActionRequired:!0,type:`error`})}catch(e){l(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 Claude binary`,userActionRequired:!0,type:`error`})}if(!(process.env.PATH||``).split(Re).some(e=>{try{let t=A(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=E()[e],n=t?t.replace(D(),`~`):`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 dt(e,t=!1){if(t)return ft(e,t);if(Q)return p(`installLatest: joining in-flight call`),Q;let n=ft(e,t);Q=n;let r=()=>{Q=null};return n.then(r,r),n}async function ft(e,t=!1){let n=await st(e,t);return n.success?(se().installMethod!==`native`&&(oe(e=>({...e,installMethod:`native`,autoUpdates:!1,autoUpdatesProtectedForNative:!0})),p(`Native installer: Set installMethod to "native" and disabled legacy auto-updater for protection`)),gt(),{latestVersion:n.latestVersion,wasUpdated:n.success,lockFailed:!1}):{latestVersion:null,wasUpdated:!1,lockFailed:n.lockFailed,lockHolderPid:n.lockHolderPid}}async function pt(e){try{let t=await I(e),n=A(O(e),t);if(await q(n))return n}catch{}return null}function Y(e,t){let n=Le(t);return k(e.locks,`${n}.lock`)}async function mt(){let e=K();if(!process.execPath.includes(e.versions))return;let t=A(process.execPath);try{let n=Y(e,t);if(await P(e.locks,{recursive:!0}),T()){if(!await ke(t,n)){C(`tengu_version_lock_failed`,{is_pid_based:!0,is_lifetime_lock:!0}),X(t,Error(`Lock already held by another process`));return}C(`tengu_version_lock_acquired`,{is_pid_based:!0,is_lifetime_lock:!0}),p(`Acquired PID lock on running version: ${t}`)}else{let e;try{e=await _(t,{stale:Z,retries:0,lockfilePath:n,onCompromised:e=>{p(`NON-FATAL: Lock on running version was compromised: ${e.message}`,{level:`info`})}}),C(`tengu_version_lock_acquired`,{is_pid_based:!1,is_lifetime_lock:!0}),p(`Acquired mtime-based lock on running version: ${t}`),te(async()=>{try{await e?.()}catch{}})}catch(e){if(l(e)){p(`Cannot lock current version - file does not exist: ${t}`,{level:`info`});return}C(`tengu_version_lock_failed`,{is_pid_based:!1,is_lifetime_lock:!0}),X(t,e);return}}}catch(e){if(l(e)){p(`Cannot lock current version - file does not exist: ${t}`,{level:`info`});return}p(`NON-FATAL: Failed to lock current version during execution ${o(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 ht(e){let t=Y(K(),e);try{await B(t),p(`Force-removed lock file at ${t}`)}catch(e){p(`Failed to force-remove lock file: ${o(e)}`)}}async function gt(){await Promise.resolve();let e=K(),t=Date.now()-36e5;if(W().startsWith(`win32`)){let t=O(e.executable);try{let e=await F(t),n=0;for(let r of e)if(/^claude\.exe\.old\.\d+$/.test(r))try{await B(k(t,r)),n++}catch{}n>0&&p(`Cleaned up ${n} old Windows executables on startup`)}catch(e){l(e)||p(`Failed to clean up old Windows executables: ${e}`)}}try{let n=await F(e.staging),r=0;for(let i of n){let n=k(e.staging,i);try{(await z(n)).mtime.getTime()<t&&(await R(n,{recursive:!0,force:!0}),r++,p(`Cleaned up old staging directory: ${i}`))}catch{}}r>0&&(p(`Cleaned up ${r} orphaned staging directories`),C(`tengu_native_staging_cleanup`,{cleaned_count:r}))}catch(e){l(e)||p(`Failed to clean up staging directories: ${e}`)}if(T()){let t=Ee(e.locks);t>0&&(p(`Cleaned up ${t} stale version locks`),C(`tengu_native_stale_locks_cleanup`,{cleaned_count:t}))}let n;try{n=await F(e.versions)}catch(e){l(e)||p(`Failed to readdir versions directory: ${e}`);return}let r=[],i=0;for(let a of n){let n=k(e.versions,a);if(/\.tmp\.\d+\.\d+$/.test(a)){try{(await z(n)).mtime.getTime()<t&&(await B(n),i++,p(`Cleaned up orphaned temp install file: ${a}`))}catch{}continue}try{let e=await z(n);if(!e.isFile()||process.platform!==`win32`&&e.size>0&&!(e.mode&73))continue;r.push({name:a,path:n,resolvedPath:A(n),mtime:e.mtime})}catch{}}if(i>0&&(p(`Cleaned up ${i} orphaned temp install files`),C(`tengu_native_temp_files_cleanup`,{cleaned_count:i})),r.length!==0)try{let t=process.execPath,n=new Set;t&&t.includes(e.versions)&&n.add(A(t));let i=await pt(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(T())i=w(r);else try{i=await ae(t.resolvedPath,{stale:Z,lockfilePath:r})}catch{i=!1}i&&(n.add(t.resolvedPath),p(`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){C(`tengu_native_version_cleanup`,{total_count:r.length,deleted_count:0,protected_count:n.size,retained_count:2,lock_failed_count:0,error_count:0});return}let o=0,s=0,c=0;await Promise.all(a.map(async e=>{try{await et(e.path,async()=>{await B(e.path)})?o++:(s++,p(`Skipping deletion of ${e.name} - locked by another process`))}catch(t){c++,x(Error(`Failed to delete version ${e.name}: ${t}`))}})),C(`tengu_native_version_cleanup`,{total_count:r.length,deleted_count:o,protected_count:n.size,retained_count:2,lock_failed_count:s,error_count:c})}catch(e){l(e)||x(Error(`Version cleanup failed: ${e}`))}}async function _t(){let e=[],t=E();for(let[n,r]of Object.entries(t))try{let t=await ye(r);if(!t)continue;let{filtered:i,hadAlias:a}=ve(t);a&&(await Ae(r,i),e.push({message:`Removed claude alias from ${r}. Run: unalias claude`,userActionRequired:!0,type:`alias`}),p(`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 vt(e){try{let t=await v(`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 B(e),p(`Manually removed ${t}: ${e}`),!0}catch{return!1}}if(W().startsWith(`win32`)){let e=k(n,`claude.cmd`),t=k(n,`claude.ps1`),a=k(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(k(n,`bin`,`claude`),`bin symlink`)&&(r=!0);return r?(p(`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`)?k(n,`node_modules`,e):k(n,`lib`,`node_modules`,e)}`}):{success:!1}}catch(e){return p(`Manual removal failed: ${e}`,{level:`error`}),{success:!1,error:`Manual removal failed: ${e}`}}}async function yt(e){let{code:t,stderr:n}=await v(`npm`,[`uninstall`,`-g`,e],{cwd:process.cwd()});if(t===0)return p(`Removed global npm installation of ${e}`),{success:!0};if(n&&!n.includes(`npm ERR! code E404`)){if(n.includes(`npm error code ENOTEMPTY`)){p(`Failed to uninstall global npm package ${e}: ${n}`,{level:`error`}),p(`Attempting manual removal due to ENOTEMPTY error`);let t=await vt(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 p(`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 bt(){let e=[],t=[],n=0,r=await yt(`@anthropic-ai/claude-code`);r.success?(n++,r.warning&&t.push(r.warning)):r.error&&e.push(r.error);let i=k(D(),`.claude`,`local`);try{await R(i,{recursive:!0}),n++,p(`Removed local installation at ${i}`)}catch(t){l(t)||(e.push(`Failed to remove ${i}: ${t}`),p(`Failed to remove local installation: ${t}`,{level:`error`}))}return{removed:n,errors:e,warnings:t}}var Z,Q,$=e((()=>{S(),Ce(),m(),ce(),d(),xe(),re(),me(),n(),g(),y(),ge(),ie(),b(),de(),je(),le(),Me(),$e(),we(),Z=10080*60*1e3,Q=null})),xt=e((()=>{$()}));export{_t as a,mt as c,gt as i,ut as n,$ as o,bt as r,dt as s,xt as t};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{dirname as t,join as n}from"node:path";import{createHash as r}from"node:crypto";import{mkdir as i,readFile as a,rename as o,stat as s,writeFile as c}from"node:fs/promises";function l(e){return e?.rootDir?e.rootDir:process.env.CLAUDE_SKILL_LEARNING_HOME?process.env.CLAUDE_SKILL_LEARNING_HOME:n(process.env.HOME??process.cwd(),`.claude`,`skill-learning`)}function u(e){let t=l(e),r=e?.project;return!r||r.scope===`global`||r.projectId===`global`?n(t,`global`,`observations.jsonl`):n(t,`projects`,r.projectId,`observations.jsonl`)}function d(e,t=y){if(e===void 0)return;let n=e;for(let e of C)n=n.replace(e,e=>{let t=e.split(/[:=]/,1)[0];return/[:=]/.test(e)?`${t}: ${S}`:S});if(n.length<=t)return n;let r=v(n),i=n.slice(0,t);return n.includes(S)&&!i.includes(S)&&(i=`${S} ${i}`),`${i}\n[TRUNCATED length=${n.length} sha256=${r}]`}function f(e,t){let n=t?.maxFieldLength??y,r={...e,toolInput:d(e.toolInput,n),toolOutput:d(e.toolOutput,n),messageText:d(e.messageText,n)},i=[r.event,r.toolName??``,r.toolInput??``,r.toolOutput??``,r.messageText??``].join(`
|
|
2
|
+
`);return{...r,contentHash:v(i)}}async function p(e,n){let r=u(n);await i(t(r),{recursive:!0}),await g(n);let a=f(e,n),o=JSON.stringify(a);return Buffer.byteLength(o)>w||await c(r,`${o}\n`,{flag:`a`}),a}async function m(e){let t=u(e),n=``;try{n=await a(t,`utf8`)}catch(e){if(e.code===`ENOENT`)return[];throw e}let r=[];for(let e of n.split(/\r?\n/))if(e.trim())try{r.push(JSON.parse(e))}catch{}return r}async function h(e){let t=u(e),n=e?.maxAgeDays??x,r=Date.now()-n*24*60*60*1e3,i=``;try{i=await a(t,`utf8`)}catch(e){if(e.code===`ENOENT`)return 0;throw e}let s=[],l=0;for(let e of i.split(/\r?\n/))if(e.trim())try{let t=JSON.parse(e),n=Date.parse(t.timestamp);if(!Number.isNaN(n)&&n<r){l+=1;continue}s.push(e)}catch{s.push(e)}if(l===0)return 0;let d=`${t}.tmp-${process.pid}-${Date.now()}`;return await c(d,s.length?`${s.join(`
|
|
3
|
+
`)}\n`:``),await o(d,t),l}async function g(e){let r=u(e),a=e?.archiveThresholdBytes??b,c;try{c=await s(r)}catch(e){if(e.code===`ENOENT`)return null;throw e}if(c.size<a)return null;let l=n(t(r),`observations.archive`);await i(l,{recursive:!0});let d=n(l,`observations-${new Date().toISOString().replace(/[:.]/g,`-`)}.jsonl`);return await o(r,d),d}function _(e){if(e!=null)return typeof e==`string`?e:JSON.stringify(e)}function v(e){return r(`sha256`).update(e).digest(`hex`)}var y,b,x,S,C,w,T=e((()=>{y=5e3,b=1e6,x=30,S=`[REDACTED]`,C=[/\b(?:sk|sk-ant|sk-proj|xox[baprs])-[A-Za-z0-9_-]{12,}\b/g,/\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}\b/g,/\b(?:api[_-]?key|token|secret|password|authorization)\b\s*[:=]\s*["']?[^"',\s}]+/gi,/\bBearer\s+[A-Za-z0-9._~+/=-]{12,}\b/gi],w=64*1024}));export{m as a,h as i,l as n,_ as o,T as r,p as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{a as t,o as n}from"./isObject-C6qM3WEW.js";import{Ai as r,Br as i,Gr as a,Ir as o,Lr as s,Mi as c,Ni as l,Rr as u,Vr as d,Wr as f,bi as p,ji as m,xi as h,zr as g}from"./state-C2OSZkV1.js";import{JE as _,RD as v,SD as y,YE as b,xD as x,zD as S}from"./loadAgentsDir-ByO8eJqU.js";import{$n as C,Qn as w,Xn as T,Zn as E,er as D,tr as O,vr as k,yr as A}from"./settings-hQDLwPVj.js";import{R as j,z as M}from"./config-CE058cvr.js";function N(e){return m(e)||h(e)||!!(P&&e&&e[P])}var P,F=e((()=>{n(),p(),r(),P=t?t.isConcatSpreadable:void 0}));function I(e,t,n,r,i){var a=-1,o=e.length;for(n||(n=N),i||(i=[]);++a<o;){var s=e[a];t>0&&n(s)?t>1?I(s,t-1,n,r,i):c(i,s):r||(i[i.length]=s)}return i}var L=e((()=>{l(),F()}));function R(e){return e!=null&&e.length?I(e,1):[]}var z=e((()=>{L()}));function B(e){return E(C(e,void 0,R),e+``)}var V=e((()=>{z(),w(),T()}));function H(e,t){return t.length<2?e:o(e,_(t,0,-1))}var U=e((()=>{s(),b()}));function W(e,t){t=i(t,e);var n=-1,r=t.length;if(!r)return!0;for(;++n<r;){var a=g(t[n]);if(a===`__proto__`&&!G.call(e,`__proto__`)||(a===`constructor`||a===`prototype`)&&n<r-1)return!1}var o=H(e,t);return o==null||delete o[g(y(t))]}var G,K=e((()=>{d(),x(),U(),u(),G=Object.prototype.hasOwnProperty}));function q(e){return O(e)?void 0:e}var J=e((()=>{D()})),Y,X,Z,Q,$=e((()=>{a(),S(),K(),d(),A(),J(),V(),M(),Y=1,X=2,Z=4,Q=B(function(e,t){var n={};if(e==null)return n;var r=!1;t=f(t,function(t){return t=i(t,e),r||(r=t.length>1),t}),k(e,j(e),n),r&&(n=v(n,Y|X|Z,q));for(var a=t.length;a--;)W(n,t[a]);return n})}));export{Q as n,$ as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{$t as e,Vn as t}from"./state-C2OSZkV1.js";import{W as n,z as r}from"./debug-RZ4NuXyS.js";import{Pt as i,Rt as a,jt as o}from"./settings-hQDLwPVj.js";import{b as s,c,g as l}from"./config-CE058cvr.js";import{o as u,s as d}from"./log-CZ0zYP_c.js";import{Bt as f,_t as p,gt as m,vt as h}from"./model-CwO-g1RW.js";import{a as g,i as _,n as v}from"./sessionState-CjNY991n.js";import{r as y,t as b}from"./managedEnv-C-9XSN14.js";e(),f(),l(),r(),u(),y(),o(),v();function x(e){return t=>({...t,...typeof e.permission_mode==`string`?{toolPermissionContext:{...t.toolPermissionContext,mode:i(e.permission_mode)}}:{}})}function S({newState:e,oldState:r}){let i=r.toolPermissionContext.mode,o=e.toolPermissionContext.mode;if(i!==o){let e=a(i),t=a(o);e!==t&&g({permission_mode:t}),_(o)}if(e.mainLoopModel!==r.mainLoopModel&&t(e.mainLoopModel),e.expandedView!==r.expandedView){let t=e.expandedView===`tasks`;c().showExpandedTodos!==t&&s(e=>({...e,showExpandedTodos:t}))}if(e.verbose!==r.verbose&&c().verbose!==e.verbose){let t=e.verbose;s(e=>({...e,verbose:t}))}if(process.env.USER_TYPE===`ant`&&e.tungstenPanelVisible!==r.tungstenPanelVisible&&e.tungstenPanelVisible!==void 0&&c().tungstenPanelVisible!==e.tungstenPanelVisible){let t=e.tungstenPanelVisible;s(e=>({...e,tungstenPanelVisible:t}))}if(e.settings!==r.settings)try{m(),p(),h(),e.settings.env!==r.settings.env&&b()}catch(e){d(n(e))}}export{S as n,x as t};
|