@readmagic/workmate 0.0.7 → 0.0.9
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-qFZy3FOD.js +1 -0
- package/dist/chunks/App-DW4elk6E.js +1 -0
- package/dist/chunks/ApproveApiKey-D05WywHU.js +1 -0
- package/dist/chunks/ApproveApiKey-DHAbdwkC.js +1 -0
- package/dist/chunks/BackgroundTasksDialog-QgFwoaaC.js +2 -0
- package/dist/chunks/BypassPermissionsModeDialog-BuRFF1fQ.js +1 -0
- package/dist/chunks/ClaudeMdExternalIncludesDialog-CDrArsSX.js +1 -0
- package/dist/chunks/ClaudeMdExternalIncludesDialog-DpecRCAt.js +1 -0
- package/dist/chunks/ConsoleOAuthFlow-D1MYL1dJ.js +1 -0
- package/dist/chunks/DiffDialog-BIcwpgSr.js +6 -0
- package/dist/chunks/Doctor-D160J8Ad.js +3 -0
- package/dist/chunks/Doctor-VhJi2cmL.js +1 -0
- package/dist/chunks/ExitFlow-CoWHhKHJ.js +2 -0
- package/dist/chunks/Grove-BmirUB6V.js +11 -0
- package/dist/chunks/{HybridTransport-rK83Qijz.js → HybridTransport-BVmSUHf0.js} +3 -3
- package/dist/chunks/InvalidConfigDialog-WRywkKeS.js +1 -0
- package/dist/chunks/InvalidSettingsDialog-C4n3A72C.js +1 -0
- package/dist/chunks/MCPConnectionManager-DPFe4hPh.js +1 -0
- package/dist/chunks/MCPToolListView-BPmE0C2o.js +1 -0
- package/dist/chunks/McpParsingWarnings-CH4yyMAL.js +1 -0
- package/dist/chunks/MessageSelector-kOn2GaU-.js +3 -0
- package/dist/chunks/Messages-4EnHFeh1.js +11 -0
- package/dist/chunks/Onboarding-BboWs1pp.js +1 -0
- package/dist/chunks/{PermissionDialog-0ya1CU5k.js → PermissionDialog-Cb3z8OUP.js} +1 -1
- package/dist/chunks/{PressEnterToContinue-Dl9Hg9Mf.js → PressEnterToContinue-Dq0Imo9c.js} +1 -1
- package/dist/chunks/PromptInputFooterSuggestions-BpC9COmh.js +1 -0
- package/dist/chunks/PromptInputHelpMenu-BvcAzbSi.js +1 -0
- package/dist/chunks/QueryEngine-J6ElcO16.js +1 -0
- package/dist/chunks/REPL-DBjbAJsm.js +133 -0
- package/dist/chunks/REPL-oBemMXvp.js +1 -0
- package/dist/chunks/RemoteSessionManager-CoIyFKKa.js +2 -0
- package/dist/chunks/ResumeConversation-wBG8OD9P.js +1 -0
- package/dist/chunks/{SSETransport-5VK5okFv.js → SSETransport-1KBBUikF.js} +3 -3
- package/dist/chunks/{Dialog-vfLXEPed.js → SearchBox-C9vUA4IM.js} +1 -1
- package/dist/chunks/SearchExtraToolsTool-BugrzImr.js +1 -0
- package/dist/chunks/Settings-DptKuJE7.js +2 -0
- package/dist/chunks/TeleportProgress-BmgPAZAi.js +1 -0
- package/dist/chunks/TeleportRepoMismatchDialog-sgxNOeM_.js +1 -0
- package/dist/chunks/TeleportResumeWrapper-GptvrUdv.js +1 -0
- package/dist/chunks/ThemePicker-gAMqqD1P.js +1 -0
- package/dist/chunks/TrustDialog-CWt-4Evl.js +1 -0
- package/dist/chunks/{ValidationErrorsList-BYsDtAvX.js → ValidationErrorsList-De3kzHtz.js} +1 -1
- package/dist/chunks/{WelcomeV2-C1BfrqC5.js → WelcomeV2-BWF-cJOu.js} +1 -1
- package/dist/chunks/add-dir-DBVT1cEK.js +1 -0
- package/dist/chunks/{agentDisplay-CMmHIl86.js → agentDisplay-5gnCQwUY.js} +1 -1
- package/dist/chunks/{agents-DE_4mAHG.js → agents-Bz1MLp4A.js} +1 -1
- package/dist/chunks/agents-CnwTOlqO.js +103 -0
- package/dist/chunks/allErrors-DYw_q14e.js +1 -0
- package/dist/chunks/analytics-DJobLaWP.js +1 -0
- package/dist/chunks/api-DXDXTFGa.js +1 -0
- package/dist/chunks/api-DzccRM_z.js +1 -0
- package/dist/chunks/auth-Cjnyy10u.js +15 -0
- package/dist/chunks/auth-CnLb6RWc.js +1 -0
- package/dist/chunks/auth-D-SGHS0K.js +1 -0
- package/dist/chunks/{autoMode-ZW70mpr0.js → autoMode-CQ5nqP9c.js} +5 -5
- package/dist/chunks/{autonomy-CwbWsCnv.js → autonomy-CPUCe-YU.js} +1 -1
- package/dist/chunks/autonomy-dSJl0hN1.js +15 -0
- package/dist/chunks/{autonomyPanel-Mq50H7iM.js → autonomyPanel-Ccr9ilei.js} +1 -1
- package/dist/chunks/backgroundHousekeeping--cs5crp7.js +17 -0
- package/dist/chunks/backgroundHousekeeping-CcbHitKC.js +1 -0
- package/dist/chunks/{banner-CWkrK10u.js → banner-BJZNMppT.js} +2 -2
- package/dist/chunks/bg-DWloqGwk.js +1 -0
- package/dist/chunks/{bg-WnYN5ifx.js → bg-w3Vlsm3Y.js} +2 -2
- package/dist/chunks/branch-CG0AKS1J.js +3 -0
- package/dist/chunks/{break-cache-C_p7Kmx2.js → break-cache-DXV0brco.js} +2 -2
- package/dist/chunks/bridgeConfig-Dmc1ZDev.js +1 -0
- package/dist/chunks/{bridgeConfig-CE6dMsiJ.js → bridgeConfig-vORehbGG.js} +1 -1
- package/dist/chunks/bridgeMessaging-DlczTV9X.js +1 -0
- package/dist/chunks/bridgePointer-D4W9GpWw.js +1 -0
- package/dist/chunks/btw-DDUC_t0w.js +1 -0
- package/dist/chunks/caches-1IFb6_M_.js +1 -0
- package/dist/chunks/caches-CB8MHqy2.js +1 -0
- package/dist/chunks/capacityWake-L7b1mMft.js +3 -0
- package/dist/chunks/ccrClient-CG6HTv_n.js +1 -0
- package/dist/chunks/{claudeDesktop-Fe-QL-sN.js → claudeDesktop-CAmnheYx.js} +1 -1
- package/dist/chunks/{clear-D8m2utXW.js → clear-DdWexxbM.js} +1 -1
- package/dist/chunks/{cliLaunch-BkPAatcs.js → cliLaunch-BWWOgBFh.js} +1 -1
- package/dist/chunks/{client-C6MbjvOB.js → client-CoXtVRzi.js} +1 -1
- package/dist/chunks/client-Crrwkw7g.js +1 -0
- package/dist/chunks/client-D8hKghba.js +1 -0
- package/dist/chunks/color-Cuq0c6xy.js +1 -0
- package/dist/chunks/commands-D3sESsTp.js +1 -0
- package/dist/chunks/compact-DIpwuBDq.js +2 -0
- package/dist/chunks/config-CVvUNkj2.js +1 -0
- package/dist/chunks/config-D4G8_MqJ.js +3 -0
- package/dist/chunks/config-q9D4hFiK.js +1 -0
- package/dist/chunks/context-BWcfhhDj.js +1 -0
- package/dist/chunks/context-noninteractive-Bwt9A3XD.js +1 -0
- package/dist/chunks/context-noninteractive-c7jGVWHQ.js +29 -0
- package/dist/chunks/conversation-Bjo_8kia.js +1 -0
- package/dist/chunks/conversation-DrHZIQX2.js +1 -0
- package/dist/chunks/{createSSHSession-BOdTAX3N.js → createSSHSession-DP7B8yvb.js} +1 -1
- package/dist/chunks/createSession-CPo6GBSb.js +1 -0
- package/dist/chunks/createSession-DnykRoia.js +1 -0
- package/dist/chunks/crossProjectResume-D2A-qjgP.js +40 -0
- package/dist/chunks/cwd--q1ONL7P.js +1 -0
- package/dist/chunks/cwd-L4wygFqJ.js +1 -0
- package/dist/chunks/{daemon-YtZbMQtn.js → daemon-D2vFIVOz.js} +1 -1
- package/dist/chunks/datadog-DrmHyl3_.js +1 -0
- package/dist/chunks/{debug-BrXObCdR.js → debug-BdqxZ7rV.js} +4 -4
- package/dist/chunks/debugUtils-CezNYZ-4.js +1 -0
- package/dist/chunks/{detached-TYk4hMFj.js → detached-CkPpYMJj.js} +1 -1
- package/dist/chunks/detectRepository-DA1Q_Skc.js +1 -0
- package/dist/chunks/{detectRepository-BPr0VWNO.js → detectRepository-DvxoaPlk.js} +1 -1
- package/dist/chunks/{diff-CJEKvOA5.js → diff-DHzz9WAp.js} +1 -1
- package/dist/chunks/directoryCompletion-D5AvL7TF.js +1 -0
- package/dist/chunks/doctor-PWqB46xd.js +1 -0
- package/dist/chunks/entry-4JtoJONR.js +14 -0
- package/dist/chunks/envUtils-BDhHQY0-.js +1 -0
- package/dist/chunks/esm-DcIr7tVd.js +1 -0
- package/dist/chunks/{execFileNoThrow-D244NytW.js → execFileNoThrow-5SylUnAI.js} +1 -1
- package/dist/chunks/{execSyncWrapper-CCMQShK-.js → execSyncWrapper-DKuxVTaf.js} +1 -1
- package/dist/chunks/exit-OW9g7b9A.js +1 -0
- package/dist/chunks/{lazySchema-DULtBUCI.js → external-CEp-aPkt.js} +1 -1
- package/dist/chunks/extraUsage-Dt5mw35U.js +1 -0
- package/dist/chunks/extractMemories-1VlmCGwa.js +1 -0
- package/dist/chunks/fast-ClYQcEv5.js +1 -0
- package/dist/chunks/fast-CrvLdpy3.js +1 -0
- package/dist/chunks/fileSuggestions-fNxREjpe.js +3 -0
- package/dist/chunks/firstPartyEventLogger-BBXEQUf0.js +1 -0
- package/dist/chunks/firstPartyEventLogger-DhEPWcit.js +5 -0
- package/dist/chunks/flushGate-ch-Tvwjj.js +1 -0
- package/dist/chunks/{fpsMetrics-Cf_hdtiJ.js → fpsMetrics-DffAomdg.js} +1 -1
- package/dist/chunks/gemini-fZ0VPU2A.js +1 -0
- package/dist/chunks/generateRecap-BIBVlB__.js +1 -0
- package/dist/chunks/generateSessionName-nZj_VvKZ.js +1 -0
- package/dist/chunks/{genericProcessUtils-CdQTApYX.js → genericProcessUtils-BmDSLcMf.js} +1 -1
- package/dist/chunks/git-B9uvt96d.js +6 -0
- package/dist/chunks/git-BfS5Hk4S.js +1 -0
- package/dist/chunks/githubRepoPathMapping-Cqx3pSfc.js +1 -0
- package/dist/chunks/goal-IasZVqKh.js +3 -0
- package/dist/chunks/grok-Dk3LyzMa.js +1 -0
- package/dist/chunks/grove-BE4fQ6tG.js +7 -0
- package/dist/chunks/help-D2-v9Ug9.js +1 -0
- package/dist/chunks/{hooks-CkA9bhHl.js → hooks-BrKy5XWQ.js} +2 -2
- package/dist/chunks/hooks-DGd02IKF.js +1 -0
- package/dist/chunks/initReplBridge-RhCAlmHE.js +1 -0
- package/dist/chunks/{install-Dzlm4u58.js → install-CVGZ55wV.js} +1 -1
- package/dist/chunks/{instrumentation-Yt31gxWN.js → instrumentation-BmWotlxR.js} +4 -4
- package/dist/chunks/{job-BXujwZNa.js → job-DEXxW_Zo.js} +1 -1
- package/dist/chunks/{jwtUtils-DE2GPUcx.js → jwtUtils-C9sdGhvT.js} +1 -1
- package/dist/chunks/keybindings-BRdSOSUD.js +2 -0
- package/dist/chunks/language-C0cIpKE2.js +1 -0
- package/dist/chunks/{language-Ca4B018X.js → language-CxThoWRC.js} +1 -1
- package/dist/chunks/launchLocalMemory-CLSSVFoj.js +3 -0
- package/dist/chunks/launchOnboarding-BkJfKviO.js +8 -0
- package/dist/chunks/lazySchema-B4D4qJVE.js +1 -0
- package/dist/chunks/loadAgentsDir-8UprzS4w.js +1 -0
- package/dist/chunks/{loadAgentsDir-x3rlgED4.js → loadAgentsDir-CKSb56Gp.js} +1651 -2004
- package/dist/chunks/loadPluginHooks-LbaURHVH.js +1 -0
- package/dist/chunks/{localSearch-DtplGF-l.js → localSearch-CPOnyi8I.js} +1 -1
- package/dist/chunks/localSearch-DNjbr4S9.js +1 -0
- package/dist/chunks/log-CTFl4qpD.js +1 -0
- package/dist/chunks/logoV2Utils-we1sfJvf.js +1 -0
- package/dist/chunks/{magicDocs-qdDB_mKb.js → magicDocs-DmKlTQvK.js} +3 -3
- package/dist/chunks/main-BIiwW4mM.js +605 -0
- package/dist/chunks/{main-D862LI_d.js → main-ClXu1ilx.js} +2 -2
- package/dist/chunks/{managedEnv-Aq5BXfY7.js → managedEnv-Cl7YbYzf.js} +1 -1
- package/dist/chunks/managedEnv-CpiiQx_v.js +1 -0
- package/dist/chunks/{mappers-04gNXJ3w.js → mappers-xQC-Z4-h.js} +1 -1
- package/dist/chunks/mcp-B_m1XBDt.js +6 -0
- package/dist/chunks/mcp-BiyfH9Sd.js +1 -0
- package/dist/chunks/mcp-BjlaPUWX.js +2 -0
- package/dist/chunks/memoize-FJv2HV1u.js +1 -0
- package/dist/chunks/memory-LN8f_p2b.js +1 -0
- package/dist/chunks/{modalContext-DFjKLCB6.js → modalContext-CUThy6Ph.js} +1 -1
- package/dist/chunks/mode-lYTs0XHs.js +2 -0
- package/dist/chunks/model-C2e73CJD.js +1 -0
- package/dist/chunks/model-CvmS-Esk.js +1 -0
- package/dist/chunks/model-DJ8mFfuR.js +1 -0
- package/dist/chunks/modelOptions-efCGKnXT.js +1 -0
- package/dist/chunks/nativeInstaller-DQIFwdat.js +1 -0
- package/dist/chunks/oauth-BN2I0_jl.js +1 -0
- package/dist/chunks/oauth-C9VBDB0Y.js +1 -0
- package/dist/chunks/observationStore-BpjlK0pG.js +3 -0
- package/dist/chunks/omit-CLPZGevl.js +1 -0
- package/dist/chunks/onChangeAppState-DhBO34OK.js +1 -0
- package/dist/chunks/{openai-EYRnUsco.js → openai-DJLYqiRl.js} +3 -3
- package/dist/chunks/{panel-BSZGX6jN.js → panel-q0_iT9cg.js} +1 -1
- package/dist/chunks/panelCall-sum-3zvi.js +1 -0
- package/dist/chunks/parser-BcdhBGx0.js +1 -0
- package/dist/chunks/{parser-DFwaTGf7.js → parser-BdCj2GrE.js} +1 -1
- package/dist/chunks/partition-CpfoVrg1.js +1 -0
- package/dist/chunks/permissions-DTb9wkAP.js +3 -0
- package/dist/chunks/pidLock-BR5M6RQw.js +3 -0
- package/dist/chunks/{pipeTransport-CqCnc-Ys.js → pipeTransport-B3TIkTAp.js} +1 -1
- package/dist/chunks/plan-BeoIjNPv.js +1 -0
- package/dist/chunks/{platform-BrYefG_2.js → platform-D6IMiyqT.js} +1 -1
- package/dist/chunks/plugin-D_dHjTud.js +17 -0
- package/dist/chunks/pluginAutoupdate-BHKlOOXI.js +1 -0
- package/dist/chunks/pluginBlocklist-D93Hd1GF.js +1 -0
- package/dist/chunks/pluginCliCommands-vv0wNt4O.js +1 -0
- package/dist/chunks/pluginFlagging-CxuRF2Vc.js +1 -0
- package/dist/chunks/pluginOperations-BTq4AjYB.js +2 -0
- package/dist/chunks/pluginStartupCheck-B6leNWq9.js +1 -0
- package/dist/chunks/pluginStartupCheck-DBOCHUHQ.js +1 -0
- package/dist/chunks/plugins-pmipe7kE.js +4 -0
- package/dist/chunks/pollConfig-BgpfHQPJ.js +1 -0
- package/dist/chunks/{poorMode-CBOtooa0.js → poorMode-BxsyllUK.js} +1 -1
- package/dist/chunks/poorMode-iV1NwC5L.js +1 -0
- package/dist/chunks/print-CAUvczBM.js +23 -0
- package/dist/chunks/processBashCommand-CdeQg_c6.js +1 -0
- package/dist/chunks/processSlashCommand-CbkshIC6.js +5 -0
- package/dist/chunks/{projectContext-D9MDwJUF.js → projectContext-CIxul6vA.js} +1 -1
- package/dist/chunks/{projectContext-BaDZBAoK.js → projectContext-RUMJB798.js} +1 -1
- package/dist/chunks/prompt-CybUvG8G.js +139 -0
- package/dist/chunks/prompt-RBn4JdEg.js +1 -0
- package/dist/chunks/prompt-Rb8zXlDo.js +1 -0
- package/dist/chunks/promptEditor-0Ug93P2I.js +4 -0
- package/dist/chunks/{protocolHandler-JR8pASdH.js → protocolHandler-ClfbHTjI.js} +1 -1
- package/dist/chunks/{proxy-CRN7jYIi.js → proxy-Blq4W6Ox.js} +1 -1
- package/dist/chunks/rcDebugLog-CARUIORE.js +1 -0
- package/dist/chunks/reconciler-Drq3HSkj.js +4 -0
- package/dist/chunks/refresh-D8TLHO_T.js +1 -0
- package/dist/chunks/registerProtocol-3_ozAuDK.js +36 -0
- package/dist/chunks/reload-plugins-Dn1ibOiI.js +1 -0
- package/dist/chunks/remoteBridgeCore-Dpg6Se9C.js +1 -0
- package/dist/chunks/remoteManagedSettings-CCrq-qL-.js +1 -0
- package/dist/chunks/rename-CKsSc7Z3.js +1 -0
- package/dist/chunks/{renderOptions-BUJB9nAm.js → renderOptions-CLcco6fc.js} +1 -1
- package/dist/chunks/replBridgeHandle-DNC797_T.js +1 -0
- package/dist/chunks/resume-B1a5gLVR.js +2 -0
- package/dist/chunks/ripgrep-BisRODQ2.js +1 -0
- package/dist/chunks/{ripgrep-BXmXjAzA.js → ripgrep-DkL2S7-I.js} +1 -1
- package/dist/chunks/{runtimeObserver-CiwnPFjK.js → runtimeObserver-B0xfyLiA.js} +1 -1
- package/dist/chunks/runtimeObserver-DonWCJOx.js +10 -0
- package/dist/chunks/sandbox-adapter-BnBOSkKJ.js +1 -0
- package/dist/chunks/sandbox-toggle-CSdnHWp-.js +1 -0
- package/dist/chunks/searchExtraTools-DbgfnQkH.js +1 -0
- package/dist/chunks/session-BbQlh2S5.js +2 -0
- package/dist/chunks/sessionFileAccessHooks-Xfr1NiXG.js +1 -0
- package/dist/chunks/sessionIdCompat-DMayYBrf.js +1 -0
- package/dist/chunks/sessionMemory-7UOFdp29.js +1 -0
- package/dist/chunks/sessionMemory-fAzgAS7Q.js +1 -0
- package/dist/chunks/sessionMemoryUtils-DVjFw5Bd.js +1 -0
- package/dist/chunks/sessionObserver-Cl26OdaW.js +1 -0
- package/dist/chunks/sessionObserver-XV6N0XER.js +20 -0
- package/dist/chunks/sessionState-BvECKycx.js +11 -0
- package/dist/chunks/sessionStorage-DSj9yZkl.js +1 -0
- package/dist/chunks/{sessionStoragePortable-Cx6JQ5Ye.js → sessionStoragePortable-JZnGwqUM.js} +1 -1
- package/dist/chunks/sessionTitle-E1FvsKM9.js +14 -0
- package/dist/chunks/sessionTracing-ClGQ08jM.js +11 -0
- package/dist/chunks/settings-B-R9ZJNY.js +1 -0
- package/dist/chunks/settings-Xbq6AaD-.js +20 -0
- package/dist/chunks/settingsSync-NCN0a4sc.js +1 -0
- package/dist/chunks/setup-uZ0dSekt.js +3 -0
- package/dist/chunks/shadowedRuleDetection-B9iSx6mB.js +1 -0
- package/dist/chunks/{shellQuote-DkSy9MYE.js → shellQuote-Bth6IZgX.js} +1 -1
- package/dist/chunks/{sideQuestion-hUhxls9r.js → sideQuestion-D2dPToW8.js} +3 -3
- package/dist/chunks/sinks-C7q46rvE.js +2 -0
- package/dist/chunks/sinks-D3bXeHlQ.js +1 -0
- package/dist/chunks/skillChangeDetector-C1EJ7rUL.js +1 -0
- package/dist/chunks/skillGapStore-DylpOKJ6.js +5 -0
- package/dist/chunks/skillLifecycle-GK-8eyyn.js +8 -0
- package/dist/chunks/{skillSearchPanel-Cll9ccA5.js → skillSearchPanel-mpaC62y4.js} +4 -4
- package/dist/chunks/skills-t6krW8GZ.js +1 -0
- package/dist/chunks/{src-D06Xyj4g.js → src-BN7QRYLl.js} +1 -1
- package/dist/chunks/{src-CDCSSo0U2.js → src-P_wYS_NJ2.js} +1 -1
- package/dist/chunks/{src-CST_jFnT.js → src-r6ZFgWPx2.js} +1 -1
- package/dist/chunks/startupProfiler-BaiXZ9tr.js +1 -0
- package/dist/chunks/startupProfiler-jeId9f2i.js +3 -0
- package/dist/chunks/state-B4HwLt8i.js +1 -0
- package/dist/chunks/{state-Cn_m2NOf.js → state-BAGmpVBn.js} +1 -1
- package/dist/chunks/state-Bs5xweDL.js +1 -0
- package/dist/chunks/{staticRender-BIxpgNUq.js → staticRender-DrU6eWoq.js} +1 -1
- package/dist/chunks/{stats-CqfF4Axp.js → stats-BJBhl-Lc.js} +1 -1
- package/dist/chunks/{status-CC9Q-2Yn.js → status-BtsnKNVY.js} +1 -1
- package/dist/chunks/status-nZQEar7T.js +2 -0
- package/dist/chunks/statusNoticeHelpers-DMqRGFOh.js +1 -0
- package/dist/chunks/{stringUtils-DGLPkqJ4.js → stringUtils-CbS6OkmE.js} +1 -1
- package/dist/chunks/subprocessEnv-CZkA9Cdp.js +1 -0
- package/dist/chunks/{subprocessEnv-vrwzMgKn.js → subprocessEnv-Ci8VV_bi.js} +1 -1
- package/dist/chunks/switcher-77h2J5HC.js +1 -0
- package/dist/chunks/switcher-B2CYzCC_.js +1 -0
- package/dist/chunks/syncCache-By_-buUC.js +1 -0
- package/dist/chunks/tasks-BNrdmF9p.js +1 -0
- package/dist/chunks/teleport-mdnhIZBj.js +1 -0
- package/dist/chunks/{templateJobs-D1BdhZsv.js → templateJobs-Dkv4I9c1.js} +1 -1
- package/dist/chunks/{terminalSetup-Cn6jeYw1.js → terminalSetup-DQopnSPR.js} +1 -1
- package/dist/chunks/terminalSetup-DTGm1Eo2.js +33 -0
- package/dist/chunks/{theme-Cg4GNOoQ.js → theme-BjpBVRf5.js} +1 -1
- package/dist/chunks/{tmux-BY7IdQ1f.js → tmux-CMRiI6CD.js} +1 -1
- package/dist/chunks/{toolEventObserver-SFwURL5F.js → toolEventObserver-D-sNBvOe.js} +1 -1
- package/dist/chunks/toolPool-Di30gn_Y.js +1 -0
- package/dist/chunks/trustedDevice-CupLMpO8.js +1 -0
- package/dist/chunks/{trustedDevice-CKedohmT.js → trustedDevice-j1u2TG5U.js} +1 -1
- package/dist/chunks/{types-Dut4311z.js → types-DWRxAH0E.js} +2 -2
- package/dist/chunks/{udsClient-BuCtv7dN.js → udsClient-Cm3HqYUu.js} +1 -1
- package/dist/chunks/{updateCCB-C2G-U-qA.js → updateCCB-BlUAU2Vp.js} +8 -8
- package/dist/chunks/{upstreamproxy-DyR_eXO8.js → upstreamproxy-DDVMwoRi.js} +1 -1
- package/dist/chunks/useExitOnCtrlCDWithKeybindings-D2FvHieH.js +1 -0
- package/dist/chunks/useMainLoopModel-ylPQNj7Z.js +1 -0
- package/dist/chunks/useManagePlugins-BbWJNLe8.js +1 -0
- package/dist/chunks/useMergedTools-B-Z9XQ6U.js +1 -0
- package/dist/chunks/useSearchInput-C6d6nt9S.js +1 -0
- package/dist/chunks/useSettingsErrors-DKh4rkGi.js +1 -0
- package/dist/chunks/userAgent-Ng_TTjWr.js +1 -0
- package/dist/chunks/util-D-X8i5Z2.js +1 -0
- package/dist/chunks/validatePlugin-DSw08u76.js +1 -0
- package/dist/chunks/vim-3mUqsEJm.js +1 -0
- package/dist/chunks/{which-CKQnSouy.js → which-DznMOwny.js} +1 -1
- package/dist/chunks/windowsPaths-1mgenSWa.js +1 -0
- package/dist/chunks/{windowsPaths-DtapVxOo.js → windowsPaths-BVztIhXM.js} +1 -1
- package/dist/chunks/{workSecret-CNWiR2uQ.js → workSecret-DtiFreRl.js} +1 -1
- package/dist/chunks/workerRegistry-DdOYjLm3.js +6 -0
- package/dist/chunks/worktree-BX1ULzrw.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-B2HJUD7h.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/BypassPermissionsModeDialog-DllL8dxU.js +0 -1
- package/dist/chunks/ClaudeMdExternalIncludesDialog--ywODh81.js +0 -1
- package/dist/chunks/ClaudeMdExternalIncludesDialog-BZSyRqeq.js +0 -1
- package/dist/chunks/ConsoleOAuthFlow-Wkfw7Ts-.js +0 -1
- package/dist/chunks/DesktopHandoff-DaP4Riar.js +0 -1
- package/dist/chunks/DiffDialog-B7hx8i_Y.js +0 -6
- 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/InvalidConfigDialog-DdO0AxyF.js +0 -1
- package/dist/chunks/InvalidSettingsDialog-s1G0DwXF.js +0 -1
- package/dist/chunks/ListItem-vfLXEPed.js +0 -1
- package/dist/chunks/MCPConnectionManager-NRfIjdlj.js +0 -1
- package/dist/chunks/McpParsingWarnings-Du5IxZos.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/PromptInputFooterSuggestions-BmsFdOu9.js +0 -1
- package/dist/chunks/PromptInputHelpMenu-DX-0wEDo.js +0 -1
- 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/SearchBox-vfLXEPed.js +0 -1
- package/dist/chunks/SearchExtraToolsTool-B-7Bworf.js +0 -1
- package/dist/chunks/Settings-CUjWlncb.js +0 -2
- package/dist/chunks/TeleportProgress-DxN0bQL2.js +0 -1
- 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/add-dir-DfLYgwox.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/asciicast-CbAjUHT_.js +0 -4
- 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/autonomy-Oui8yK8G.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/branch-DU5O9KZ0.js +0 -3
- 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/color-DWhgZH7A.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/datadog-DqHxqiwY.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/entry-DE0uMIf0.js +0 -14
- package/dist/chunks/envLessBridgeConfig-B-LKYNvv.js +0 -1
- package/dist/chunks/envLessBridgeConfig-DyD9XCda.js +0 -1
- package/dist/chunks/envUtils-DSxRz_kt.js +0 -1
- package/dist/chunks/esm-5w3xFBnt.js +0 -1
- package/dist/chunks/eventLoopStallDetector-Cg_RXU1q.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/goal-B4GsR54_.js +0 -3
- 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/launchOnboarding-gOVAFEFp.js +0 -8
- 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/lib-rQZENxQg.js +0 -8
- 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/main-OWFSddRx.js +0 -859
- 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/mode-DY087x_x.js +0 -2
- package/dist/chunks/model-CZViyZnE.js +0 -1
- package/dist/chunks/model-D0EfJBuw.js +0 -1
- package/dist/chunks/model-DLLkVV6S.js +0 -1
- package/dist/chunks/nativeInstaller-yj81F75v.js +0 -1
- package/dist/chunks/oauth-BqJqV-2M.js +0 -1
- package/dist/chunks/oauth-C8X_p8Gc.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/p-map-B1EeBuI8.js +0 -1
- package/dist/chunks/p-map-HKDr3iDo.js +0 -1
- package/dist/chunks/panel-Be-OxtqL.js +0 -1
- package/dist/chunks/panelCall-dMvRPAGE.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/path-D5U-tm91.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/pidLock-CbC_il6r.js +0 -3
- package/dist/chunks/plan-rsb_83Fo.js +0 -1
- package/dist/chunks/plugin-Cm31-nej.js +0 -1
- package/dist/chunks/pluginAutoupdate-0k03PVff.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/plugins-CQNKZmjP.js +0 -4
- 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/promptEditor-CyTzyjwG.js +0 -4
- 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/reload-plugins-B9ApSp2m.js +0 -1
- 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/resume-BicEjsPd.js +0 -2
- package/dist/chunks/ripgrep-BfIpz5uC.js +0 -1
- package/dist/chunks/rollback-BPWRKlIZ.js +0 -11
- 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/sdkHeapDumpMonitor-WdXUV7DV.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/sessionDataUploader-CaCjwsA2.js +0 -1
- 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/sessionTitle-DAnM73S0.js +0 -14
- 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/shadowedRuleDetection-C6R5zOUe.js +0 -1
- package/dist/chunks/sinks-BuE17DeZ.js +0 -2
- 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/skills-BPPeYBy7.js +0 -1
- 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/state-ix0xIunV.js +0 -1
- package/dist/chunks/status-D4IQpsNK.js +0 -2
- package/dist/chunks/statusNoticeHelpers-CEGvdm5d.js +0 -1
- package/dist/chunks/stickers-D5teCKMN.js +0 -1
- package/dist/chunks/subprocessEnv-BSQSomcK.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/tasks-CZvWJYGr.js +0 -1
- 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/up-BHkC97_C.js +0 -12
- 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/useSearchInput-C5OzQnX6.js +0 -1
- package/dist/chunks/useSettingsErrors-B9vOZL41.js +0 -1
- package/dist/chunks/util-8EHwfg4A.js +0 -1
- package/dist/chunks/validatePlugin-6q1qmnAC.js +0 -1
- package/dist/chunks/vim-CNDzwoTd.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,4 +1,4 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{i as t,o as n,t as r}from"./cliLaunch-
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{i as t,o as n,t as r}from"./cliLaunch-BWWOgBFh.js";import{a as i,i as a,n as o,r as s,t as c}from"./state-BAGmpVBn.js";import{resolve as l}from"path";async function u(e){let t=e[0]||`status`;switch(t){case`start`:await h(e.slice(1));break;case`stop`:await p();break;case`status`:case`ps`:await f();break;case`bg`:await(await import(`./bg-DWloqGwk.js`)).handleBgStart(e.slice(1));break;case`attach`:await(await import(`./bg-DWloqGwk.js`)).attachHandler(e[1]);break;case`logs`:await(await import(`./bg-DWloqGwk.js`)).logsHandler(e[1]);break;case`kill`:await(await import(`./bg-DWloqGwk.js`)).killHandler(e[1]);break;case`--help`:case`-h`:case`help`:d();break;default:console.error(`Unknown daemon subcommand: ${t}`),d(),process.exitCode=1}}function d(){console.log(`
|
|
2
2
|
Work Mate Daemon — background process management
|
|
3
3
|
|
|
4
4
|
USAGE
|
|
@@ -26,6 +26,6 @@ OPTIONS (for start)
|
|
|
26
26
|
--name <name> Session name
|
|
27
27
|
-h, --help Show this help
|
|
28
28
|
`)}async function f(){let e=o();switch(console.log(`=== Daemon Supervisor ===`),e.status){case`running`:{let t=e.state;console.log(` Status: running`),console.log(` PID: ${t.pid}`),console.log(` CWD: ${t.cwd}`),console.log(` Started: ${t.startedAt}`),console.log(` Workers: ${t.workerKinds.join(`, `)}`);break}case`stopped`:console.log(` Status: stopped`);break;case`stale`:console.log(` Status: stale (cleaned up)`);break}console.log(`
|
|
29
|
-
=== Background Sessions ===`),await(await import(`./bg-
|
|
29
|
+
=== Background Sessions ===`),await(await import(`./bg-DWloqGwk.js`)).psHandler([])}async function p(){let e=o();if(e.status===`stopped`){console.log(`daemon is not running`);return}if(e.status===`stale`){console.log(`daemon was stale (cleaned up)`);return}console.log(`stopping daemon (PID: ${e.state.pid})...`),await a()?console.log(`daemon stopped`):console.log(`daemon could not be stopped (may have already exited)`)}function m(e){let t={};for(let n=0;n<e.length;n++){let r=e[n];r===`--dir`&&n+1<e.length?t.dir=l(e[++n]):r.startsWith(`--dir=`)?t.dir=l(r.slice(6)):r===`--spawn-mode`&&n+1<e.length?t.spawnMode=e[++n]:r.startsWith(`--spawn-mode=`)?t.spawnMode=r.slice(13):r===`--capacity`&&n+1<e.length?t.capacity=e[++n]:r.startsWith(`--capacity=`)?t.capacity=r.slice(11):r===`--permission-mode`&&n+1<e.length?t.permissionMode=e[++n]:r.startsWith(`--permission-mode=`)?t.permissionMode=r.slice(18):r===`--sandbox`?t.sandbox=`1`:r===`--name`&&n+1<e.length?t.name=e[++n]:r.startsWith(`--name=`)&&(t.name=r.slice(7))}return t}async function h(e){let t=m(e),n=t.dir||l(`.`);console.log(`[daemon] supervisor starting in ${n}`);let r=[{kind:`remoteControl`,process:null,backoffMs:v,failureCount:0,parked:!1,lastStartTime:0,restartTimer:null}];i({pid:process.pid,cwd:n,startedAt:new Date().toISOString(),workerKinds:r.map(e=>e.kind),lastStatus:`running`});let a=new AbortController,o=()=>{console.log(`[daemon] supervisor shutting down...`),a.abort(),s();for(let e of r)e.restartTimer&&(clearTimeout(e.restartTimer),e.restartTimer=null),e.process&&!e.process.killed&&e.process.kill(`SIGTERM`)};process.on(`SIGTERM`,o),process.on(`SIGINT`,o);for(let e of r)a.signal.aborted||g(e,n,t,a.signal);await new Promise(e=>{if(a.signal.aborted){e();return}a.signal.addEventListener(`abort`,()=>e(),{once:!0})}),await Promise.all(r.filter(e=>e.process&&e.process.exitCode===null).map(e=>new Promise(t=>{if(!e.process||e.process.exitCode!==null){t();return}let n=null;e.process.on(`exit`,()=>{n&&(clearTimeout(n),n=null),t()}),n=setTimeout(()=>{e.process&&e.process.exitCode===null&&e.process.kill(`SIGKILL`),t()},3e4),n.unref?.()}))),console.log(`[daemon] supervisor stopped`)}function g(e,t,i,a){if(a.aborted||e.parked)return;e.lastStartTime=Date.now();let o={...process.env,DAEMON_WORKER_DIR:t,DAEMON_WORKER_NAME:i.name,DAEMON_WORKER_SPAWN_MODE:i.spawnMode||`same-dir`,DAEMON_WORKER_CAPACITY:i.capacity||`4`,DAEMON_WORKER_PERMISSION:i.permissionMode,DAEMON_WORKER_SANDBOX:i.sandbox||`0`,DAEMON_WORKER_CREATE_SESSION:`1`,CLAUDE_CODE_SESSION_KIND:`daemon-worker`};console.log(`[daemon] spawning worker '${e.kind}'`);let s=n(r([`--daemon-worker=${e.kind}`],{env:o}),{cwd:t,stdio:[`ignore`,`pipe`,`pipe`]});e.process=s,s.stdout?.on(`data`,e=>{let t=e.toString().trimEnd().split(`
|
|
30
30
|
`);for(let e of t)console.log(` ${e}`)}),s.stderr?.on(`data`,e=>{let t=e.toString().trimEnd().split(`
|
|
31
31
|
`);for(let e of t)console.error(` ${e}`)}),s.on(`exit`,(n,r)=>{if(e.process=null,!a.aborted){if(n===_){console.error(`[daemon] worker '${e.kind}' exited with permanent error — parking`),e.parked=!0;return}if(Date.now()-e.lastStartTime<1e4){if(e.failureCount++,e.failureCount>=x){console.error(`[daemon] worker '${e.kind}' failed ${e.failureCount} times rapidly — parking`),e.parked=!0;return}}else e.failureCount=0,e.backoffMs=v;console.log(`[daemon] worker '${e.kind}' exited (code=${n}, signal=${r}), restarting in ${e.backoffMs}ms`),e.restartTimer=setTimeout(()=>{e.restartTimer=null,!a.aborted&&!e.parked&&g(e,t,i,a)},e.backoffMs),e.restartTimer.unref?.(),e.backoffMs=Math.min(e.backoffMs*b,y)}})}var _,v,y,b,x;e((()=>{t(),c(),_=78,v=2e3,y=12e4,b=2,x=5}))();export{u as daemonMain};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{l as t,o as n}from"./envUtils-
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{l as t,o as n}from"./envUtils-BDhHQY0-.js";import{c as r,cn as i,f as a,g as o,ln as s}from"./settings-Xbq6AaD-.js";import{c,h as l}from"./config-D4G8_MqJ.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-Blq4W6Ox.js";import{n as _,t as v}from"./syncCache-By_-buUC.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-Cl7YbYzf.js";e();export{t as applyConfigEnvironmentVariables};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{FT as t,Oa as n,Qa as r,jT as i}from"./loadAgentsDir-CKSb56Gp.js";import{Kr as a,qr as o}from"./src-P_wYS_NJ2.js";import{Kt as s,mt as c}from"./state-Bs5xweDL.js";import{J as l}from"./log-CTFl4qpD.js";import{At as u}from"./prompt-CybUvG8G.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:c(),parent_tool_use_id:null,uuid:e.uuid,error:e?.error}];case`user`:return[{type:`user`,message:e.message,session_id:c(),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:c(),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=n({content:o(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:c(),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=i();if(t)return{...e,input:{...e.input,plan:t}}}return e});return{...e.message,content:n}}var y=e((()=>{s(),l(),u(),a(),r(),t()}));export{p as a,f as i,y as n,h as o,g as r,_ as s,m as t};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import{o as e}from"./rolldown-runtime-DaDcL9Zw.js";import{AC as t,DC as n,Fu as r,HS as i,IC as a,JS as o,KS as s,MC as c,Pu as l,SC as u,US as d,VS as f,WS as ee,_m as te,av as p,bD as ne,cC as m,ff as h,hS as g,kC as _,md as v,ov as re,pd as ie,sC as y,uf as b,vC as x,vm as ae,xD as oe,xS as se,yC as S,yS as C}from"./loadAgentsDir-CKSb56Gp.js";import{D as w,H as T,I as E,P as D,T as O,fi as k,j as A,kn as j,t as M,y as N}from"./src-P_wYS_NJ2.js";import{t as P}from"./jsx-runtime-Bb4Xn-E0.js";import{H as F,z as I}from"./debug-BdqxZ7rV.js";import{c as L,h as R,o as z,v as B}from"./config-D4G8_MqJ.js";import{n as V,o as ce}from"./process-gEbdy6uY.js";import{i as H,o as U}from"./platform-D6IMiyqT.js";import{s as W,u as G}from"./types-DWRxAH0E.js";import{n as le,r as K}from"./analytics-DJobLaWP.js";import{l as q,o as ue}from"./stringUtils-CbS6OkmE.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";ne();var X=e(k(),1);h(),V(),M(),c(),ue(),ae(),v();var Z=P();function pe({servers:e,scope:t,onDone:r}){let i=Object.keys(e),[a,o]=(0,X.useState)({});(0,X.useEffect)(()=>{n().then(({servers:e})=>o(e))},[]);let s=i.filter(e=>a[e]!==void 0);async function c(n){let r=0;for(let i of n){let n=e[i];if(n){let e=i;if(a[e]!==void 0){let t=1;for(;a[`${i}_${t}`]!==void 0;)t++;e=`${i}_${t}`}await u(e,n,t),r++}}d(r)}let[l]=T(),d=(0,X.useCallback)(e=>{ce(e>0?`\n${A(`success`,l)(`Successfully imported ${e} MCP ${q(e,`server`)} to ${t} config.`)}\n`:`
|
|
2
|
+
No servers were imported.`),r(),b()},[l,t,r]),f=(0,X.useCallback)(()=>{d(0)},[d]);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(N,{title:`Import MCP Servers from Claude Desktop`,subtitle:`Found ${i.length} MCP ${q(i.length,`server`)} in Claude Desktop.`,color:`success`,onCancel:f,hideInputGuide:!0,children:[s.length>0&&(0,Z.jsx)(D,{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)(D,{children:`Please select the servers you want to import:`}),(0,Z.jsx)(ie,{options:i.map(e=>({label:`${e}${s.includes(e)?` (already exists)`:``}`,value:e})),defaultValue:i.filter(e=>!s.includes(e)),onSubmit:c,onCancel:f,hideIndexes:!0})]}),(0,Z.jsx)(E,{paddingX:1,children:(0,Z.jsx)(D,{dimColor:!0,italic:!0,children:(0,Z.jsxs)(O,{children:[(0,Z.jsx)(w,{shortcut:`Space`,action:`select`}),(0,Z.jsx)(w,{shortcut:`Enter`,action:`confirm`}),(0,Z.jsx)(te,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})]})})})]})}M(),r(),le(),ee(),se(),c(),S(),re(),R(),I(),h(),W(),U();async function Q(e,t){try{let n=await g(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-uZ0dSekt.js`);await r(n,`default`,!1,!1,void 0,!1);let{startMCPServer:i}=await import(`./mcp-BjlaPUWX.js`);await i(n,e??!1,t??!1)}catch(e){Y(`Error: Failed to start MCP server: ${e}`)}}async function he(e,n){let r=_(e),o=()=>{r&&(r.type===`sse`||r.type===`http`)&&(i(e,r),f(e,r))};try{if(n.scope){let t=m(n.scope);K(`tengu_mcp_delete`,{name:e,scope:t}),await a(e,t),o(),process.stdout.write(`Removed MCP server ${e} from ${t} config\n`),J(`File modified: ${y(t)}`)}let r=z(),i=L(),{servers:s}=t(`project`),c=!!s[e],l=[];if(r.mcpServers?.[e]&&l.push(`local`),c&&l.push(`project`),i.mcpServers?.[e]&&l.push(`user`),l.length===0)Y(`No MCP server found with name: "${e}"`);else if(l.length===1){let t=l[0];K(`tengu_mcp_delete`,{name:e,scope:t}),await a(e,t),o(),process.stdout.write(`Removed MCP server "${e}" from ${t} config\n`),J(`File modified: ${y(t)}`)}else process.stderr.write(`MCP server "${e}" exists in multiple scopes:\n`),l.forEach(e=>{process.stderr.write(` - ${x(e)} (${y(e)})\n`)}),process.stderr.write(`
|
|
3
|
+
To remove from a specific scope, use:
|
|
4
|
+
`),l.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 n();if(Object.keys(e).length===0)console.log("No MCP servers configured. Use `claude mcp add` to add a server.");else{console.log(`Checking MCP server health...
|
|
5
|
+
`);let t=await oe(Object.entries(e),async([e,t])=>({name:e,server:t,status:await Q(e,t)}),{concurrency:C()});for(let{name:e,server:n,status:r}of t)if(n.type===`sse`)console.log(`${e}: ${n.url} (SSE) - ${r}`);else if(n.type===`http`)console.log(`${e}: ${n.url} (HTTP) - ${r}`);else if(n.type===`claudeai-proxy`)console.log(`${e}: ${n.url} - ${r}`);else if(!n.type||n.type===`stdio`){let t=n,i=Array.isArray(t.args)?t.args:[];console.log(`${e}: ${t.command} ${i.join(` `)} - ${r}`)}}await b(0)}async function $(e){K(`tengu_mcp_get`,{name:e});let t=_(e);t||Y(`No MCP server found with name: ${e}`),console.log(`${e}:`),console.log(` Scope: ${x(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`),d(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`),d(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 b(0)}async function _e(e,t,n){try{let r=m(n.scope),i=G(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 s():void 0;await u(e,i,r);let c=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`&&o(e,{type:i.type,url:i.url},a),K(`tengu_mcp_add`,{scope:r,source:`json`,type:c}),J(`Added ${c} MCP server ${e} to ${r} config`)}catch(e){Y(e.message)}}async function ve(e){try{let t=m(e.scope);K(`tengu_mcp_add`,{scope:t,platform:H(),source:`desktop`});let{readClaudeDesktopMcpServers:n}=await import(`./claudeDesktop-CAmnheYx.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 j((0,Z.jsx)(p,{children:(0,Z.jsx)(l,{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 @@
|
|
|
1
|
+
import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{n,t as r}from"./figures-5ThXQEtq.js";import{BS as i,Ew as a,GS as o,Vu as s,WS as c,_m as l,cv as u,dd as d,gC as f,mC as p,ov as m,sC as h,sv as g,ud as _,vm as v,yC as y,zS as b,zu as x}from"./loadAgentsDir-CKSb56Gp.js";import{D as S,Gt as ee,H as C,I as w,Lt as T,P as E,T as D,Wt as O,fi as k,j as A,t as j,y as M}from"./src-P_wYS_NJ2.js";import{t as N}from"./jsx-runtime-Bb4Xn-E0.js";import{a as te,o as ne}from"./debug-BdqxZ7rV.js";import{l as re,n as ie,o as P}from"./stringUtils-CbS6OkmE.js";import{F as ae,I as oe}from"./sessionState-BvECKycx.js";import{i as se,n as F,r as ce}from"./MCPConnectionManager-DPFe4hPh.js";import{n as le,t as ue}from"./McpParsingWarnings-CH4yyMAL.js";import{a as de,c as I,i as L,n as R,o as z,r as fe,s as pe,t as me}from"./MCPToolListView-BPmE0C2o.js";function he({agentServer:e,onCancel:t,onComplete:n}){let[i]=C(),[a,s]=(0,B.useState)(!1),[c,u]=(0,B.useState)(null),[f,p]=(0,B.useState)(null),m=(0,B.useRef)(null);(0,B.useEffect)(()=>()=>m.current?.abort(),[]),O(`confirm:no`,(0,B.useCallback)(()=>{a&&(m.current?.abort(),m.current=null,s(!1),p(null))},[a]),{context:`Confirmation`,isActive:a});let h=(0,B.useCallback)(async()=>{if(!e.needsAuth||!e.url)return;s(!0),u(null);let t=new AbortController;m.current=t;try{let r={type:e.transport,url:e.url};await o(e.name,r,p,t.signal),n?.(`Authentication successful for ${e.name}. The server will connect when the agent runs.`)}catch(e){e instanceof Error&&!(e instanceof b)&&u(e.message)}finally{s(!1),m.current=null}},[e,n]),g=ie(String(e.name));if(a)return(0,V.jsxs)(w,{flexDirection:`column`,gap:1,padding:1,children:[(0,V.jsxs)(E,{color:`claude`,children:[`Authenticating with `,e.name,`…`]}),(0,V.jsxs)(w,{children:[(0,V.jsx)(x,{}),(0,V.jsx)(E,{children:` A browser window will open for authentication`})]}),f&&(0,V.jsxs)(w,{flexDirection:`column`,children:[(0,V.jsx)(E,{dimColor:!0,children:`If your browser doesn't open automatically, copy this URL manually:`}),(0,V.jsx)(T,{url:f})]}),(0,V.jsx)(w,{marginLeft:3,children:(0,V.jsxs)(E,{dimColor:!0,children:[`Return here after authenticating in your browser.`,` `,(0,V.jsx)(l,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`})]})})]});let _=[];return e.needsAuth&&_.push({label:e.isAuthenticated?`Re-authenticate`:`Authenticate`,value:`auth`}),_.push({label:`Back`,value:`back`}),(0,V.jsxs)(M,{title:`${g} MCP Server`,subtitle:`agent-only`,onCancel:t,inputGuide:e=>e.pending?(0,V.jsxs)(E,{children:[`Press `,e.keyName,` again to exit`]}):(0,V.jsxs)(D,{children:[(0,V.jsx)(S,{shortcut:`↑↓`,action:`navigate`}),(0,V.jsx)(S,{shortcut:`Enter`,action:`confirm`}),(0,V.jsx)(l,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`})]}),children:[(0,V.jsxs)(w,{flexDirection:`column`,gap:0,children:[(0,V.jsxs)(w,{children:[(0,V.jsx)(E,{bold:!0,children:`Type: `}),(0,V.jsx)(E,{dimColor:!0,children:e.transport})]}),e.url&&(0,V.jsxs)(w,{children:[(0,V.jsx)(E,{bold:!0,children:`URL: `}),(0,V.jsx)(E,{dimColor:!0,children:e.url})]}),e.command&&(0,V.jsxs)(w,{children:[(0,V.jsx)(E,{bold:!0,children:`Command: `}),(0,V.jsx)(E,{dimColor:!0,children:e.command})]}),(0,V.jsxs)(w,{children:[(0,V.jsx)(E,{bold:!0,children:`Used by: `}),(0,V.jsx)(E,{dimColor:!0,children:e.sourceAgents.join(`, `)})]}),(0,V.jsxs)(w,{marginTop:1,children:[(0,V.jsx)(E,{bold:!0,children:`Status: `}),(0,V.jsxs)(E,{children:[A(`inactive`,i)(r.radioOff),` not connected (agent-only)`]})]}),e.needsAuth&&(0,V.jsxs)(w,{children:[(0,V.jsx)(E,{bold:!0,children:`Auth: `}),e.isAuthenticated?(0,V.jsxs)(E,{children:[A(`success`,i)(r.tick),` authenticated`]}):(0,V.jsxs)(E,{children:[A(`warning`,i)(r.triangleUpOutline),` may need authentication`]})]})]}),(0,V.jsx)(w,{children:(0,V.jsx)(E,{dimColor:!0,children:`This server connects only when running the agent.`})}),c&&(0,V.jsx)(w,{children:(0,V.jsxs)(E,{color:`error`,children:[`Error: `,c]})}),(0,V.jsx)(w,{children:(0,V.jsx)(d,{options:_,onChange:async e=>{switch(e){case`auth`:await h();break;case`back`:t();break}},onCancel:t})})]})}var B,V,H=e((()=>{n(),B=t(k(),1),j(),a(),c(),P(),v(),_(),s(),V=N()}));function U(e){switch(e){case`project`:return{label:`Project MCPs`,path:h(e)};case`user`:return{label:`User MCPs`,path:h(e)};case`local`:return{label:`Local MCPs`,path:h(e)};case`enterprise`:return{label:`Enterprise MCPs`};case`dynamic`:return{label:`Built-in MCPs`,path:`always available`};default:return{label:e}}}function ge(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 _e({servers:e,agentServers:t=[],onSelectServer:n,onSelectAgentServer:i,onComplete:a}){let[o]=C(),[s,c]=(0,W.useState)(0),u=W.useMemo(()=>ge(e.filter(e=>e.client.config.type!==`claudeai-proxy`)),[e]),d=W.useMemo(()=>e.filter(e=>e.client.config.type===`claudeai-proxy`).sort((e,t)=>e.name.localeCompare(t.name)),[e]),f=W.useMemo(()=>(u.get(`dynamic`)??[]).sort((e,t)=>e.name.localeCompare(t.name)),[u]),p=U(`dynamic`),m=W.useMemo(()=>{let e=[];for(let t of K){let n=u.get(t)??[];for(let t of n)e.push({type:`server`,server:t})}for(let t of d)e.push({type:`server`,server:t});for(let n of t)e.push({type:`agent-server`,agentServer:n});for(let t of f)e.push({type:`server`,server:t});return e},[u,d,t,f]),h=(0,W.useCallback)(()=>{a(`MCP dialog dismissed`,{display:`system`})},[a]);ee({"confirm:previous":()=>c(e=>e===0?m.length-1:e-1),"confirm:next":()=>c(e=>e===m.length-1?0:e+1),"confirm:yes":(0,W.useCallback)(()=>{let e=m[s];e&&(e.type===`server`?n(e.server):e.type===`agent-server`&&i&&i(e.agentServer))},[m,s,n,i]),"confirm:no":h},{context:`Confirmation`});let g=e=>m.findIndex(t=>t.type===`server`&&t.server===e),_=e=>m.findIndex(t=>t.type===`agent-server`&&t.agentServer===e),v=ne(),y=e.some(e=>e.client.type===`failed`);if(e.length===0&&t.length===0)return null;let b=e=>{let t=g(e),n=s===t,i=``,a=``;if(e.client.type===`disabled`)i=A(`inactive`,o)(r.radioOff),a=`disabled`;else if(e.client.type===`connected`)i=A(`success`,o)(r.tick),a=`connected`;else if(e.client.type===`pending`){i=A(`inactive`,o)(r.radioOff);let{reconnectAttempt:t,maxReconnectAttempts:n}=e.client;a=t&&n?`reconnecting (${t}/${n})…`:`connecting…`}else e.client.type===`needs-auth`?(i=A(`warning`,o)(r.triangleUpOutline),a=`needs authentication`):(i=A(`error`,o)(r.cross),a=`failed`);return(0,G.jsxs)(w,{children:[(0,G.jsx)(E,{color:n?`suggestion`:void 0,children:n?`${r.pointer} `:` `}),(0,G.jsx)(E,{color:n?`suggestion`:void 0,children:e.name}),(0,G.jsxs)(E,{dimColor:!n,children:[` · `,i,` `]}),(0,G.jsx)(E,{dimColor:!n,children:a})]},`${e.name}-${t}`)},x=e=>{let t=_(e),n=s===t,i=e.needsAuth?A(`warning`,o)(r.triangleUpOutline):A(`inactive`,o)(r.radioOff),a=e.needsAuth?`may need auth`:`agent-only`;return(0,G.jsxs)(w,{children:[(0,G.jsx)(E,{color:n?`suggestion`:void 0,children:n?`${r.pointer} `:` `}),(0,G.jsx)(E,{color:n?`suggestion`:void 0,children:e.name}),(0,G.jsxs)(E,{dimColor:!n,children:[` · `,i,` `]}),(0,G.jsx)(E,{dimColor:!n,children:a})]},`agent-${e.name}-${t}`)},O=e.length+t.length;return(0,G.jsxs)(w,{flexDirection:`column`,children:[(0,G.jsx)(ue,{}),(0,G.jsx)(M,{title:`Manage MCP servers`,subtitle:`${O} ${re(O,`server`)}`,onCancel:h,hideInputGuide:!0,children:(0,G.jsxs)(w,{flexDirection:`column`,children:[K.map(e=>{let t=u.get(e);if(!t||t.length===0)return null;let n=U(e);return(0,G.jsxs)(w,{flexDirection:`column`,marginBottom:1,children:[(0,G.jsxs)(w,{paddingLeft:2,children:[(0,G.jsx)(E,{bold:!0,children:n.label}),n.path&&(0,G.jsxs)(E,{dimColor:!0,children:[` (`,n.path,`)`]})]}),t.map(e=>b(e))]},e)}),d.length>0&&(0,G.jsxs)(w,{flexDirection:`column`,marginBottom:1,children:[(0,G.jsx)(w,{paddingLeft:2,children:(0,G.jsx)(E,{bold:!0,children:`claude.ai`})}),d.map(e=>b(e))]}),t.length>0&&(0,G.jsxs)(w,{flexDirection:`column`,marginBottom:1,children:[(0,G.jsx)(w,{paddingLeft:2,children:(0,G.jsx)(E,{bold:!0,children:`Agent MCPs`})}),[...new Set(t.flatMap(e=>e.sourceAgents))].map(e=>(0,G.jsxs)(w,{flexDirection:`column`,marginTop:1,children:[(0,G.jsx)(w,{paddingLeft:2,children:(0,G.jsxs)(E,{dimColor:!0,children:[`@`,e]})}),t.filter(t=>t.sourceAgents.includes(e)).map(e=>x(e))]},e))]}),f.length>0&&(0,G.jsxs)(w,{flexDirection:`column`,marginBottom:1,children:[(0,G.jsxs)(w,{paddingLeft:2,children:[(0,G.jsx)(E,{bold:!0,children:p.label}),p.path&&(0,G.jsxs)(E,{dimColor:!0,children:[` (`,p.path,`)`]})]}),f.map(e=>b(e))]}),(0,G.jsxs)(w,{flexDirection:`column`,children:[y&&(0,G.jsx)(E,{dimColor:!0,children:v?`※ Error logs shown inline with --debug`:`※ Run claude --debug to see error logs`}),(0,G.jsxs)(E,{dimColor:!0,children:[(0,G.jsx)(T,{url:`https://code.claude.com/docs/en/mcp`,children:`https://code.claude.com/docs/en/mcp`}),` for help`]})]})]})}),(0,G.jsx)(w,{paddingX:1,children:(0,G.jsx)(E,{dimColor:!0,italic:!0,children:(0,G.jsxs)(D,{children:[(0,G.jsx)(S,{shortcut:`↑↓`,action:`navigate`}),(0,G.jsx)(S,{shortcut:`Enter`,action:`confirm`}),(0,G.jsx)(l,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})]})})})]})}var W,G,K,q=e((()=>{n(),W=t(k(),1),j(),a(),y(),te(),P(),v(),le(),G=N(),K=[`project`,`local`,`user`,`enterprise`]}));function ve({serverName:e,onComplete:t}){let[n]=C(),i=u(),a=ce(),[o,s]=(0,J.useState)(!0),[c,l]=(0,J.useState)(null);return(0,J.useEffect)(()=>{async function n(){try{if(!i.getState().mcp.clients.find(t=>t.name===e)){l(`MCP server "${e}" not found`),s(!1),t(`MCP server "${e}" not found`);return}switch((await a(e)).client.type){case`connected`:s(!1),t(`Successfully reconnected to ${e}`);break;case`needs-auth`:l(`${e} requires authentication`),s(!1),t(`${e} requires authentication. Use /mcp to authenticate.`);break;case`pending`:case`failed`:case`disabled`:l(`Failed to reconnect to ${e}`),s(!1),t(`Failed to reconnect to ${e}`);break}}catch(e){let n=e instanceof Error?e.message:String(e);l(n),s(!1),t(`Error: ${n}`)}}n()},[e,a,i,t]),o?(0,Y.jsxs)(w,{flexDirection:`column`,gap:1,padding:1,children:[(0,Y.jsxs)(E,{color:`text`,children:[`Reconnecting to `,(0,Y.jsx)(E,{bold:!0,children:e})]}),(0,Y.jsxs)(w,{children:[(0,Y.jsx)(x,{}),(0,Y.jsx)(E,{children:` Establishing connection to MCP server`})]})]}):c?(0,Y.jsxs)(w,{flexDirection:`column`,gap:1,padding:1,children:[(0,Y.jsxs)(w,{children:[(0,Y.jsxs)(E,{children:[A(`error`,n)(r.cross),` `]}),(0,Y.jsxs)(E,{color:`error`,children:[`Failed to reconnect to `,e]})]}),(0,Y.jsxs)(E,{dimColor:!0,children:[`Error: `,c]})]}):null}var J,Y,ye=e((()=>{n(),J=t(k(),1),j(),F(),m(),s(),Y=N()}));function be({onComplete:e}){let t=g(e=>e.mcp),n=g(e=>e.agentDefinitions),r=t.clients,[a,o]=X.useState({type:`list`}),[s,c]=X.useState([]),l=(0,X.useMemo)(()=>p(n.allAgents),[n.allAgents]),u=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(u.map(async e=>{let n=e.config.scope,r=e.config.type===`sse`,a=e.config.type===`http`,o=e.config.type===`claudeai-proxy`,s;if(r||a){let n=await new i(e.name,e.config).tokens(),r=ae()!==null&&e.type===`connected`,a=e.type===`connected`&&f(t.tools,e.name).length>0;s=!!n||r||a}let c={name:e.name,client:e,scope:n};return o?{...c,transport:`claudeai-proxy`,isAuthenticated:!1,config:e.config}:r?{...c,transport:`sse`,isAuthenticated:s,config:e.config}:a?{...c,transport:`http`,isAuthenticated:s,config:e.config}:{...c,transport:`stdio`,config:e.config}}));e||c(n)}return n(),()=>{e=!0}},[u,t.tools]),(0,X.useEffect)(()=>{s.length===0&&u.length>0||s.length===0&&l.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.")},[s.length,u.length,l.length,e]),a.type){case`list`:return(0,Z.jsx)(_e,{servers:s,agentServers:l,onSelectServer:e=>o({type:`server-menu`,server:e}),onSelectAgentServer:e=>o({type:`agent-server-menu`,agentServer:e}),onComplete:e,defaultTab:a.defaultTab});case`server-menu`:{let n=f(t.tools,a.server.name),r=a.server.transport===`claudeai-proxy`?`claude.ai`:`Work Mate`;return a.server.transport===`stdio`?(0,Z.jsx)(de,{server:a.server,serverToolsCount:n.length,onViewTools:()=>o({type:`server-tools`,server:a.server}),onCancel:()=>o({type:`list`,defaultTab:r}),onComplete:e}):(0,Z.jsx)(pe,{server:a.server,serverToolsCount:n.length,onViewTools:()=>o({type:`server-tools`,server:a.server}),onCancel:()=>o({type:`list`,defaultTab:r}),onComplete:e})}case`server-tools`:return(0,Z.jsx)(me,{server:a.server,onSelectTool:(e,t)=>o({type:`server-tool-detail`,server:a.server,toolIndex:t}),onBack:()=>o({type:`server-menu`,server:a.server})});case`server-tool-detail`:{let e=f(t.tools,a.server.name)[a.toolIndex];return e?(0,Z.jsx)(fe,{tool:e,server:a.server,onBack:()=>o({type:`server-tools`,server:a.server})}):(o({type:`server-tools`,server:a.server}),null)}case`agent-server-menu`:return(0,Z.jsx)(he,{agentServer:a.agentServer,onCancel:()=>o({type:`list`,defaultTab:`Agents`}),onComplete:e})}}var X,Z,xe=e((()=>{X=t(k(),1),c(),y(),m(),oe(),H(),q(),I(),z(),L(),R(),Z=N()})),Se=e((()=>{H(),q(),ye(),I(),xe(),z(),L(),R()}));function Ce({action:e,target:t,onComplete:n}){let r=g(e=>e.mcp.clients),i=se(),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)(ve,{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(k(),1),Se(),ye(),F(),m(),$=N()}))();export{we as call};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{$w as e,AS as t,CT as n,DT as r,ET as i,Gl as a,Gw as o,Hx as s,Jw as c,Kw as l,Mg as u,Ng as d,Oa as f,Qa as p,Qw as m,TT as h,U as ee,Ux as te,W as ne,Wl as g,Ww as _,Xw as v,Yw as y,Zw as b,_T as x,aT as S,aa as C,bT as w,bv as T,dT as E,dc as D,dl as O,eT as k,fT as A,fc as j,fl as M,gT as N,hT as P,iT as F,kS as I,lT as L,mT as R,nT as z,oa as re,pT as B,qw as V,rT as H,sT as U,tT as W,uT as G,wT as K,xT as q,xv as J}from"./loadAgentsDir-CKSb56Gp.js";import{S as Y,w as X}from"./debug-BdqxZ7rV.js";import{o as ie,s as ae}from"./log-CTFl4qpD.js";import{_ as oe,u as se}from"./model-C2e73CJD.js";import{bn as ce,vn as Z,yn as Q}from"./prompt-CybUvG8G.js";import $ from"node:process";h(),e(),b(),n();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},H,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},U,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)}};n(),y();var ue=class extends m{constructor(e,t){super(t),this._serverInfo=e,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(N.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 v,this.setRequestHandler(E,e=>this._oninitialize(e)),this.setNotificationHandler(A,()=>this.oninitialized?.()),this._capabilities.logging&&this.setRequestHandler(q,async(e,t)=>{let n=t.sessionId||t.requestInfo?.headers[`mcp-session-id`]||void 0,{level:r}=e.params,i=N.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=k(this._capabilities,e)}setRequestHandler(e,t){let n=K(e)?.method;if(!n)throw Error(`Schema is missing a method literal`);let a;if(i(n)){let e=n;a=e._zod?.def?.value??e.value}else{let e=n;a=e._def?.value??e.value}if(typeof a!=`string`)throw Error(`Schema method literal must be a string`);return a===`tools/call`?super.setRequestHandler(e,async(e,n)=>{let i=r(W,e);if(!i.success){let e=i.error instanceof Error?i.error.message:String(i.error);throw new x(G.InvalidParams,`Invalid tools/call request: ${e}`)}let{params:a}=i.data,o=await Promise.resolve(t(e,n));if(a.task){let e=r(S,o);if(!e.success){let t=e.error instanceof Error?e.error.message:String(e.error);throw new x(G.InvalidParams,`Invalid task creation result: ${t}`)}return e.data}let s=r(z,o);if(!s.success){let e=s.error instanceof Error?s.error.message:String(s.error);throw new x(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){V(this._clientCapabilities?.tasks?.requests,e,`Client`)}assertTaskHandlerCapability(e){this._capabilities&&c(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:w.includes(t)?t:B,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`},L)}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},F,t):this.request({method:`sampling/createMessage`,params:e},H,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},U,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},U,t);if(r.action===`accept`&&r.content&&n.requestedSchema)try{let e=this._jsonSchemaValidator.getValidator(n.requestedSchema)(r.content);if(!e.valid)throw new x(G.InvalidParams,`Elicitation response content does not match requested schema: ${e.errorMessage}`)}catch(e){throw e instanceof x?e:new x(G.InternalError,`Error validating elicitation response: ${e instanceof Error?e.message:String(e)}`)}return r}}}createElicitationCompletionNotifier(e,t){if(!this._clientCapabilities?.elicitation?.url)throw Error(`Client does not support URL elicitation (required for notifications/elicitation/complete)`);return()=>this.notification({method:`notifications/elicitation/complete`,params:{elicitationId:e}},t)}async listRoots(e,t){return this.request({method:`roots/list`,params:e},R,t)}async sendLoggingMessage(e,t){if(this._capabilities.logging&&!this.isMessageIgnored(e.level,t))return this.notification({method:`notifications/message`,params:e})}async sendResourceUpdated(e){return this.notification({method:`notifications/resources/updated`,params:e})}async sendResourceListChanged(){return this.notification({method:`notifications/resources/list_changed`})}async sendToolListChanged(){return this.notification({method:`notifications/tools/list_changed`})}async sendPromptListChanged(){return this.notification({method:`notifications/prompts/list_changed`})}};o();var de=class{constructor(e=$.stdin,t=$.stdout){this._stdin=e,this._stdout=t,this._readBuffer=new _,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=l(e);this._stdout.write(n)?t():this._stdout.once(`drain`,t)})}};n(),j(),C(),ce(),M(),t(),te(),ie(),p(),oe(),ne(),T(),Y(),a(),u();var fe=[re];async function pe(e,t,n){let r=s(100);J(e);let i=new ue({name:`claude/tengu`,version:`0.0.9`},{capabilities:{tools:{}}});i.setRequestHandler(P,async()=>{let e=Q(),t=O(e);return{tools:await Promise.all(t.map(async n=>{let r;if(n.outputSchema){let e=d(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:d(n.inputSchema),outputSchema:r}}))}}),i.setRequestHandler(W,async({params:{name:e,arguments:i}})=>{let a=O(Q()),o=Z(a,e);if(!o)throw Error(`Tool ${e} not found`);let s={abortController:I(),options:{commands:fe,tools:a,mainLoopModel:se(),thinkingConfig:{type:`disabled`},mcpClients:[],mcpResources:{},isNonInteractiveSession:!0,debug:t,verbose:n,agentDefinitions:{activeAgents:[],allAgents:[]}},getAppState:()=>D(),setAppState:()=>{},messages:[],readFileState:r,setInProgressToolUseIDs:()=>{},setResponseLength:()=>{},updateFileHistoryState:()=>{},updateAttributionState:()=>{}};try{if(!o.isEnabled())throw Error(`Tool ${e} is not enabled`);let t=await o.validateInput?.(i??{},s);if(t&&!t.result)throw Error(`Tool ${e} input is invalid: ${`message`in t?t.message:String(t)}`);let n=await o.call(i??{},s,ee,f({content:[]}));return{content:[{type:`text`,text:typeof n==`string`?n:X(n.data)}]}}catch(e){return ae(e),{isError:!0,content:[{type:`text`,text:(e instanceof Error?g(e):[String(e)]).filter(Boolean).join(`
|
|
2
|
+
`).trim()||`Error`}]}}});async function a(){let e=new de;await i.connect(e)}return await a()}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-BdqxZ7rV.js";import{o as h,s as g}from"./log-CTFl4qpD.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-BDhHQY0-.js";import{Af as i,Bn as a,Ew as o,Hn as s,Ix as c,Px as l,Qc as ee,Zc as u,dd as te,iw as d,jf as f,jx as p,ov as m,ow as ne,sv as h,ud as g}from"./loadAgentsDir-CKSb56Gp.js";import{I as _,Lt as v,P as y,Wt as b,_ as x,di as S,fi as C,t as w,ui as re,y as T}from"./src-P_wYS_NJ2.js";import{t as E}from"./jsx-runtime-Bb4Xn-E0.js";import{Kt as D,tt as O}from"./state-Bs5xweDL.js";import{n as k,t as A}from"./cwd-L4wygFqJ.js";import{I as j,z as M}from"./debug-BdqxZ7rV.js";import{Cn as N,bn as ie,g as P,x as F}from"./settings-Xbq6AaD-.js";import{M as I,P as L,k as ae}from"./config-D4G8_MqJ.js";import{m as R,r as z}from"./git-B9uvt96d.js";import{o as oe,s as se}from"./log-CTFl4qpD.js";import{n as ce,r as B}from"./analytics-DJobLaWP.js";import{m as le,v as V}from"./startupProfiler-jeId9f2i.js";import{n as H,t as U}from"./useExitOnCtrlCDWithKeybindings-D2FvHieH.js";import{r as ue,t as de}from"./promptEditor-0Ug93P2I.js";import{homedir as fe}from"os";import{join as W,relative as pe}from"path";import{mkdir as G,writeFile as me}from"fs/promises";function he(e){return z(e)!==null}var ge=e((()=>{R()}));function _e({onSelect:e,onCancel:t}){let r=(0,K.use)(l()),i=W(n(),`CLAUDE.md`),o=W(O(),`CLAUDE.md`),s=r.some(e=>e.path===i),c=r.some(e=>e.path===o),u=[...r.filter(e=>e.type!==`AutoMem`).map(e=>({...e,exists:!0})),...s?[]:[{path:i,type:`User`,content:``,exists:!1}],...c?[]:[{path:o,type:`Project`,content:``,exists:!1}]],d=new Map,p=u.map(e=>{let t=ie(e.path),n=e.exists?``:` (new)`,r=e.parent?(d.get(e.parent)??0)+1:0;d.set(e.path,r);let a=r>0?` `.repeat(r-1):``,s;s=e.type===`User`&&!e.isNested&&e.path===i?`User memory`:e.type===`Project`&&!e.isNested&&e.path===o?`Project memory`:r>0?`${a}L ${t}${n}`:`${t}`;let c,l=he(O());return c=e.type===`User`&&!e.isNested?`Saved in ~/.claude/CLAUDE.md`:e.type===`Project`&&!e.isNested&&e.path===o?`${l?`Checked in at`:`Saved in`} ./CLAUDE.md`:e.parent?`@-imported`:e.isNested?`dynamically loaded`:``,{label:s,value:e.path,description:c}}),m=[],g=h(e=>e.agentDefinitions);if(L()){m.push({label:`Open auto-memory folder`,value:`${Y}${ae()}`,description:``});for(let e of g.activeAgents)if(e.memory){let t=a(e.agentType,e.memory);m.push({label:`Open ${re.bold(e.agentType)} agent memory`,value:`${Y}${t}`,description:`${e.memory} scope`})}}p.push(...m);let v=J&&p.some(e=>e.value===J)?J:p[0]?.value||``,[S,C]=(0,K.useState)(L),[w,T]=(0,K.useState)(ee),[E]=(0,K.useState)(L),D=h(e=>Object.values(e.tasks).some(e=>e.type===`dream`&&e.status===`running`)),[k,A]=(0,K.useState)(null);(0,K.useEffect)(()=>{E&&f().then(A)},[E,D]);let j=D?`running`:k===null?``:k===0?`never`:`last ran ${le(new Date(k))}`,[M,N]=(0,K.useState)(null),P=M!==null,I=+!!E;function R(){let e=!S;F(`userSettings`,{autoMemoryEnabled:e}),C(e),B(`tengu_auto_memory_toggled`,{enabled:e})}function z(){let e=!w;F(`userSettings`,{autoDreamEnabled:e}),T(e),B(`tengu_auto_dream_toggled`,{enabled:e})}return H(),b(`confirm:no`,t,{context:`Confirmation`}),b(`confirm:yes`,()=>{M===0?R():M===1&&z()},{context:`Confirmation`,isActive:P}),b(`select:next`,()=>{N(e=>e!==null&&e<I?e+1:null)},{context:`Select`,isActive:P}),b(`select:previous`,()=>{N(e=>e!==null&&e>0?e-1:e)},{context:`Select`,isActive:P}),(0,q.jsxs)(_,{flexDirection:`column`,width:`100%`,children:[(0,q.jsxs)(_,{flexDirection:`column`,marginBottom:1,children:[(0,q.jsx)(x,{isFocused:M===0,children:(0,q.jsxs)(y,{children:[`Auto-memory: `,S?`on`:`off`]})}),E&&(0,q.jsx)(x,{isFocused:M===1,styled:!1,children:(0,q.jsxs)(y,{color:M===1?`suggestion`:void 0,children:[`Auto-dream: `,w?`on`:`off`,j&&(0,q.jsxs)(y,{dimColor:!0,children:[` · `,j]}),!D&&w&&(0,q.jsx)(y,{dimColor:!0,children:` · /dream to run`})]})})]}),(0,q.jsx)(te,{defaultFocusValue:v,options:p,isDisabled:P,onChange:t=>{if(t.startsWith(Y)){let e=t.slice(15);G(e,{recursive:!0}).catch(()=>{}).then(()=>ne(e));return}J=t,e(t)},onCancel:t,onUpFromFirstItem:()=>N(I)})]})}var K,q,J,Y,ve=e((()=>{S(),C(),K=t(C(),1),D(),U(),w(),o(),I(),ce(),u(),i(),m(),s(),d(),c(),r(),N(),V(),ge(),P(),g(),q=E(),Y=`__open_folder__`}));function X(e){let t=fe(),n=A(),r=e.startsWith(t)?`~`+e.slice(t.length):null,i=e.startsWith(n)?`./`+pe(n,e):null;return r&&i?r.length<=i.length?r:i:r||i||e}var ye=e((()=>{C(),w(),k(),E()}));function be({onDone:e}){let t=async t=>{try{t.includes(n())&&await G(n(),{recursive:!0});try{await me(t,``,{encoding:`utf8`,flag:`wx`})}catch(e){if(j(e)!==`EEXIST`)throw e}await de(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 ${X(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)(T,{title:`Memory`,onCancel:r,color:`remember`,children:(0,Q.jsxs)(_,{flexDirection:`column`,children:[(0,Q.jsx)(Z.Suspense,{fallback:null,children:(0,Q.jsx)(_e,{onSelect:t,onCancel:r})}),(0,Q.jsx)(_,{marginTop:1,children:(0,Q.jsxs)(y,{dimColor:!0,children:[`Learn more: `,(0,Q.jsx)(v,{url:`https://code.claude.com/docs/en/memory`})]})})]})})}var Z,Q,$;e((()=>{Z=t(C(),1),w(),ve(),ye(),c(),r(),M(),oe(),ue(),Q=E(),$=async e=>(p(),await l(),(0,Q.jsx)(be,{onDone:e}))}))();export{$ as call};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{fi as n}from"./src-
|
|
1
|
+
import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{fi as n}from"./src-P_wYS_NJ2.js";function r(){return(0,a.useContext)(o)!==null}function i(e){let t=(0,a.useContext)(o);return t?{rows:t.rows,columns:t.columns}:e}var a,o,s=e((()=>{a=t(n(),1),o=(0,a.createContext)(null)}));export{i,s as n,r,o as t};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{dd as n,dt as r,fd as i,ft as a,pt as o,ut as s}from"./loadAgentsDir-CKSb56Gp.js";import{I as c,P as l,fi as u,t as d}from"./src-P_wYS_NJ2.js";import{t as f}from"./jsx-runtime-Bb4Xn-E0.js";function p({onDone:e}){let t=a(),r=s(),i=(0,m.useMemo)(()=>t.map(e=>({label:(0,h.jsxs)(l,{children:[e.icon,` `,e.name,` `,(0,h.jsxs)(l,{dimColor:!0,children:[`(`,e.slug,`) — `,e.description]})]}),value:e.slug})),[t]);function u(n){o(n);let r=t.find(e=>e.slug===n);e(`${r?.icon} Mode switched to: ${r?.name} (${r?.slug}) — ${r?.description}`,{display:`system`})}function d(){e(`Mode selection cancelled.`,{display:`system`})}return(0,h.jsxs)(c,{flexDirection:`column`,children:[(0,h.jsxs)(c,{marginBottom:1,flexDirection:`column`,children:[(0,h.jsx)(l,{color:`remember`,bold:!0,children:`Select mode`}),(0,h.jsx)(l,{dimColor:!0,children:`Arrow keys to navigate, Enter to select, Esc to cancel.`})]}),(0,h.jsx)(n,{defaultValue:r,options:i,onChange:u,onCancel:d,visibleOptionCount:t.length})]})}var m,h,g;e((()=>{m=t(u(),1),d(),i(),r(),h=f(),g=async(e,t,n)=>{let r=n?.trim().toLowerCase();if(r){let t=a(),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}o(r),e(`${n.icon} Mode switched to: ${n.name} (${n.slug}) — ${n.description}`,{display:`system`});return}return(0,h.jsx)(p,{onDone:e})}}))();export{g as call};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e,o as t,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-BDhHQY0-.js";import{n as ee,t as te}from"./defineProperty-C-QyHrDq.js";import{n as f,t as p}from"./axios-DaWTGg7G.js";import{di as ne,ui as re}from"./src-P_wYS_NJ2.js";import{A as ie,C as ae,p as oe,w as se}from"./external-CEp-aPkt.js";import{n as ce,r as le,t as ue}from"./lazySchema-B4D4qJVE.js";import{$t as de,Br as fe,H as pe,Kt as m,Q as me,Rn as he,Vn as ge,Y as _e,bn as ve,et as ye,fr as be,ft as xe,ln as Se,mt as Ce,pr as we,y as Te,z as h,zr as Ee}from"./state-Bs5xweDL.js";import{C as De,E as Oe,F as g,G as ke,I as Ae,K as je,S as Me,V as Ne,a as _,c as Pe,d as Fe,l as v,p as Ie,s as Le,w as Re,z as ze}from"./debug-BdqxZ7rV.js";import{Ut as Be,c as y,f as b,g as x,n as Ve,x as He}from"./settings-Xbq6AaD-.js";import{C as Ue,S as We,c as S,h as Ge,n as C,y as w}from"./config-D4G8_MqJ.js";import{a as Ke,c as qe,i as Je,o as Ye,r as Xe,s as Ze,t as Qe}from"./execFileNoThrow-5SylUnAI.js";import{d as $e,f as et,o as tt,s as T}from"./log-CTFl4qpD.js";import{r as nt,t as rt}from"./memoize-FJv2HV1u.js";import{s as it,u as at}from"./types-DWRxAH0E.js";import{n as ot,r as E}from"./analytics-DJobLaWP.js";import{l as D,n as st,r as ct,s as lt,t as ut,u as O}from"./oauth-C9VBDB0Y.js";import{n as dt,t as ft}from"./bundledMode--fG1S62b.js";import{n as pt,o as mt}from"./stringUtils-CbS6OkmE.js";import{a as ht,i as gt,l as _t}from"./proxy-Blq4W6Ox.js";import{userInfo as vt}from"os";import{join as yt}from"path";import{chmodSync as bt,mkdirSync as xt,readFileSync as St,writeFileSync as Ct}from"fs";import{createHash as wt,randomUUID as Tt}from"crypto";import{mkdir as Et,stat as Dt,writeFile as Ot}from"fs/promises";import{exec as kt,execFile as At}from"child_process";import{AsyncLocalStorage as jt}from"async_hooks";function k(e=Ve()){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 Mt(){return k()}function Nt(){let e=process.env.ANTHROPIC_BASE_URL;if(!e)return!0;try{return new URL(e).host===`api.anthropic.com`}catch{return!1}}var A=e((()=>{x(),l()}));function Pt(){return It.getStore()?.workload}function Ft(e,t){return It.run({workload:e},t)}var It,Lt=e((()=>{It=new jt}));function Rt(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 zt=e((()=>{}));function Bt(e,t){return e.find(e=>e.includes(t))??null}async function Vt(){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 gt(),...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 U();e&&(r.credentials={accessKeyId:e.accessKeyId,secretAccessKey:e.secretAccessKey,sessionToken:e.sessionToken})}return new e(r)}async function Ht(){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 gt(),...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 U();e&&(r.credentials={accessKeyId:e.accessKeyId,secretAccessKey:e.secretAccessKey,sessionToken:e.sessionToken})}return new e(r)}function Ut(e){return e.startsWith(`anthropic.`)}function Wt(e){if(!e.startsWith(`arn:`))return e;let t=e.lastIndexOf(`/`);return t===-1?e:e.substring(t+1)}function Gt(e){let t=Wt(e);for(let e of Yt)if(t.startsWith(`${e}.anthropic.`))return e}function Kt(e,t){let n=Gt(e);return n?e.replace(`${n}.`,`${t}.`):Ut(e)?`${t}.${e}`:e}var qt,Jt,Yt,Xt=e((()=>{i(),G(),l(),tt(),_t(),qt=r(async function(){let[e,{ListInferenceProfilesCommand:t}]=await Promise.all([Vt(),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 T(e),e}}),Jt=r(async function(e){try{let[t,{GetInferenceProfileCommand:n}]=await Promise.all([Vt(),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 T(e),null}}),Yt=[`us`,`eu`,`apac`,`global`]})),Zt,Qt,$t,en,tn,nn,rn,an,on,sn,cn,ln,un,dn,fn=e((()=>{Zt={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`},Qt={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`},$t={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`},en={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`},tn={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`},nn={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`},rn={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`},an={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`},on={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`},sn={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`},cn={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`},ln={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`},un={haiku35:$t,haiku45:en,sonnet35:Qt,sonnet37:Zt,sonnet40:tn,sonnet45:nn,sonnet46:ln,opus40:rn,opus41:an,opus45:on,opus46:sn,opus47:cn},Object.values(un).map(e=>e.firstParty),dn=Object.fromEntries(Object.entries(un).map(([e,t])=>[t.firstParty,e]))}));function pn(e){let t={};for(let n of yn)t[n]=un[n][e];return t}async function mn(){let e=pn(`bedrock`),t;try{t=await qt()}catch(t){return T(t),e}if(!t?.length)return e;let n={};for(let r of yn){let i=un[r].firstParty;n[r]=Bt(t,i)||e[r]}return n}function hn(e){let t=Ve().modelOverrides;if(!t)return e;let n={...e};for(let[e,r]of Object.entries(t)){let t=dn[e];t&&r&&(n[t]=r)}return n}function gn(e){let t;try{t=Ve().modelOverrides}catch{return e}if(!t)return e;for(let[n,r]of Object.entries(t))if(r===e)return n;return e}function _n(){if(me()===null){if(k()!==`bedrock`){he(pn(k()));return}bn()}}function j(){let e=me();return e===null?(_n(),hn(pn(k()))):hn(e)}async function vn(){if(me()===null){if(k()!==`bedrock`){he(pn(k()));return}await bn()}}var yn,bn,xn=e((()=>{m(),tt(),zt(),x(),Xt(),fn(),A(),yn=Object.keys(un),bn=Rt(async()=>{if(me()===null)try{he(await mn())}catch(e){T(e)}})}));async function Sn(){let e=S().oauthAccount?.accountUuid,t=na();if(!e||!t)return;let n=`${D().BASE_API_URL}/api/claude_cli_profile`;try{return(await f.get(n,{headers:{"x-api-key":t,"anthropic-beta":lt},params:{account_uuid:e},timeout:1e4})).data}catch(e){T(e)}}async function Cn(e){let t=`${D().BASE_API_URL}/api/oauth/profile`;try{return(await f.get(t,{headers:{Authorization:`Bearer ${e}`,"Content-Type":`application/json`},timeout:1e4})).data}catch(e){T(e)}}var wn=e((()=>{p(),O(),G(),Ge(),tt()}));function Tn(e){return!!e?.includes(st)}function En(e){return e?.split(` `).filter(Boolean)??[]}function Dn({codeChallenge:e,state:t,port:n,isManual:r,loginWithClaudeAi:i,inferenceOnly:a,orgUUID:o,loginHint:s,loginMethod:c}){let l=i?D().CLAUDE_AI_AUTHORIZE_URL:D().CONSOLE_AUTHORIZE_URL,u=new URL(l);u.searchParams.append(`code`,`true`),u.searchParams.append(`client_id`,D().CLIENT_ID),u.searchParams.append(`response_type`,`code`),u.searchParams.append(`redirect_uri`,r?D().MANUAL_REDIRECT_URL:`http://localhost:${n}/callback`);let d=a?[st]:ut;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 On(e,t,n,r,i=!1,a){let o={grant_type:`authorization_code`,code:e,redirect_uri:i?D().MANUAL_REDIRECT_URL:`http://localhost:${r}/callback`,client_id:D().CLIENT_ID,code_verifier:n,state:t};a!==void 0&&(o.expires_in=a);let s=await f.post(D().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 E(`tengu_oauth_token_exchange_success`,{}),s.data}async function kn(e,{scopes:t}={}){let n={grant_type:`refresh_token`,refresh_token:e,client_id:D().CLIENT_ID,scope:(t?.length?t:ct).join(` `)};try{let t=await f.post(D().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=En(r.scope);E(`tengu_oauth_token_refresh_success`,{});let l=S(),u=W(),d=l.oauthAccount?.billingType!==void 0&&l.oauthAccount?.accountCreatedAt!==void 0&&l.oauthAccount?.subscriptionCreatedAt!==void 0&&u?.subscriptionType!=null&&u?.rateLimitTier!=null?null:await Nn(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&&w(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=f.isAxiosError(e)&&e.response?.data?JSON.stringify(e.response.data):void 0;throw E(`tengu_oauth_token_refresh_failure`,{error:e.message,...t&&{responseBody:t}}),e}}async function An(e){let t=await f.get(D().ROLES_URL,{headers:{Authorization:`Bearer ${e}`}});if(t.status!==200)throw Error(`Failed to fetch user roles: ${t.statusText}`);let n=t.data;if(!S().oauthAccount)throw Error(`OAuth account information not found in config`);w(e=>({...e,oauthAccount:e.oauthAccount?{...e.oauthAccount,organizationRole:n.organization_role,workspaceRole:n.workspace_role,organizationName:n.organization_name}:e.oauthAccount})),E(`tengu_oauth_roles_stored`,{org_role:n.organization_role})}async function jn(e){try{let t=await f.post(D().API_KEY_URL,null,{headers:{Authorization:`Bearer ${e}`}}),n=t.data?.raw_key;return n?(await ja(n),E(`tengu_oauth_api_key`,{status:`success`,statusCode:t.status}),n):null}catch(e){throw E(`tengu_oauth_api_key`,{status:`failure`,error:e instanceof Error?e.message:String(e)}),e}}function Mn(e){return e!==null&&Date.now()+300*1e3>=e}async function Nn(e){let t=await Cn(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),E(`tengu_oauth_profile_fetch_success`,{}),{...i,rawProfile:t}}async function Pn(){let e=S().oauthAccount?.organizationUuid;if(e)return e;let t=W()?.accessToken;return t===void 0||!Ua()?null:(await Cn(t))?.organization?.uuid||null}async function Fn(){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&&(S().oauthAccount||In({accountUuid:e,emailAddress:t,organizationUuid:n})),await Va();let i=S();if(i.oauthAccount&&i.oauthAccount.billingType!==void 0&&i.oauthAccount.accountCreatedAt!==void 0&&i.oauthAccount.subscriptionCreatedAt!==void 0||!R()||!Ua())return!1;let a=W();if(a?.accessToken){let e=await Cn(a.accessToken);if(e)return r&&v(`OAuth profile fetch succeeded, overriding env var account info`,{level:`info`}),In({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 In({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),w(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 Ln=e((()=>{p(),ot(),O(),G(),Ge(),_(),wn()}));function Rn(e,t,n){if(s(process.env.CLAUDE_CODE_REMOTE))try{xt(Un,{recursive:!0,mode:448}),Ct(e,t,{encoding:`utf8`,mode:384}),v(`Persisted ${n} to ${e} for subprocess access`)}catch(e){v(`Failed to persist ${n} to disk (non-fatal): ${g(e)}`,{level:`error`})}}function zn(e,t){try{let n=Fe().readFileSync(e,{encoding:`utf8`}).trim();return n?(v(`Read ${t} from well-known file ${e}`),n):null}catch(n){return Ne(n)||v(`Failed to read ${t} from ${e}: ${g(n)}`,{level:`debug`}),null}}function Bn({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=zn(t,n);return i(e),e}let s=parseInt(o,10);if(Number.isNaN(s))return v(`${e} must be a valid file descriptor number, got: ${o}`,{level:`error`}),i(null),null;try{let e=Fe(),r=process.platform===`darwin`||process.platform===`freebsd`?`/dev/fd/${s}`:`/proc/self/fd/${s}`,a=e.readFileSync(r,{encoding:`utf8`}).trim();return a?(v(`Successfully read ${n} from file descriptor ${s}`),i(a),Rn(t,a,n),a):(v(`File descriptor contained empty ${n}`,{level:`error`}),i(null),null)}catch(e){v(`Failed to read ${n} from file descriptor ${s}: ${g(e)}`,{level:`error`});let r=zn(t,n);return i(r),r}}function Vn(){return Bn({envVar:`CLAUDE_CODE_OAUTH_TOKEN_FILE_DESCRIPTOR`,wellKnownPath:Wn,label:`OAuth token`,getCached:ye,setCached:ge})}function Hn(){return Bn({envVar:`CLAUDE_CODE_API_KEY_FILE_DESCRIPTOR`,wellKnownPath:Gn,label:`API key`,getCached:Te,setCached:Se})}var Un,Wn,Gn,Kn,qn=e((()=>{m(),_(),l(),ze(),Ie(),Un=`/home/claude/.claude/remote`,Wn=`${Un}/.oauth_token`,Gn=`${Un}/.api_key`,Kn=`${Un}/.session_ingress_token`}));function M(e=``){let t=c(),n=process.env.CLAUDE_CONFIG_DIR?`-${wt(`sha256`).update(t).digest(`hex`).substring(0,8)}`:``;return`Claude Code${D().OAUTH_FILE_SUFFIX}${e}${n}`}function Jn(){try{return process.env.USER||vt().username}catch{return`claude-code-user`}}function N(){P.cache={data:null,cachedAt:0},P.generation++,P.readInFlight=null}function Yn(e){if(P.cache.cachedAt!==0)return;let t=null;if(e)try{t=JSON.parse(e)}catch{return}P.cache={data:t,cachedAt:Date.now()}}var Xn,P,Zn=e((()=>{O(),l(),Xn=`-credentials`,P={cache:{data:null,cachedAt:0},generation:0,readInFlight:null}}));async function Qn(){if(process.platform===`darwin`&&(await Ye(`security delete-generic-password -a $USER -s "${M()}"`,{shell:!0,reject:!1})).exitCode!==0)throw Error(`Failed to delete keychain entry`)}function $n(e){return e.slice(-20)}var er=e((()=>{qe(),Zn()}));function tr(e){return e?.name===`CredentialsProviderError`}function nr(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 rr(){let{STSClient:e,GetCallerIdentityCommand:t}=await import(`./dist-es-C-OjW2Ao.js`);await new e().send(new t({}))}async function ir(){try{v(`Clearing AWS credential provider cache`);let{fromIni:e}=await import(`./dist-es-CIULjvtA2.js`);await e({ignoreCache:!0})(),v(`AWS credential provider cache refreshed`)}catch{v(`Failed to clear AWS credential cache (this is expected if no credentials are configured)`)}}var ar=e((()=>{_()})),or,sr=e((()=>{we(),ee(),or=class e{constructor(){te(this,`status`,{isAuthenticating:!1,output:[]}),te(this,`changed`,be()),te(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)}},te(or,`instance`,null)})),cr,lr,ur,dr,fr,pr,mr,hr,gr,_r,vr,yr,br,xr,Sr=e((()=>{cr=`claude-code-20250219`,lr=`interleaved-thinking-2025-05-14`,ur=`context-1m-2025-08-07`,dr=`context-management-2025-06-27`,fr=`structured-outputs-2025-12-15`,pr=`tool-search-tool-2025-10-19`,mr=`task-budgets-2026-03-13`,hr=`prompt-caching-scope-2026-01-05`,gr=`fast-mode-2026-02-01`,_r=`redact-thinking-2026-02-12`,vr=`afk-mode-2026-01-31`,yr=`advisor-tool-2026-03-01`,br=new Set([lr,ur,pr]),xr=new Set([cr,lr,dr])}));function Cr(e,t){return Ee(e,t)}var wr=e((()=>{fe()}));function Tr(){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=Pt(),r=n?`, workload/${n}`:``;return`claude-cli/0.0.9 (external, ${process.env.CLAUDE_CODE_ENTRYPOINT??`cli`}${e}${t}${r})`}function Er(){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.9${e.length>0?` (${e.join(`, `)})`:``}`}function Dr(){if(R()){let e=W();return e?.accessToken?{headers:{Authorization:`Bearer ${e.accessToken}`,"anthropic-beta":lt}}:{headers:{},error:`No OAuth token available`}}let e=na();return e?{headers:{"x-api-key":e}}:{headers:{},error:`No API key available`}}async function Or(e,t){try{return await e()}catch(n){if(!f.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=W()?.accessToken;if(!i)throw n;return await Ra(i),await e()}}var kr=e((()=>{p(),O(),G(),Lt()}));function Ar(){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 jr({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=Nr(),te={"x-app":`cli`,"User-Agent":Tr(),"X-Claude-Code-Session-Id":Ce(),...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}:{}};v(`[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)&&(te[`x-anthropic-additional-protection`]=`true`),v(`[API:auth] OAuth token check starting`),await Va(),v(`[API:auth] OAuth token check complete`),R()||await Mr(te,h());let f=Pr(i,a),p={defaultHeaders:te,maxRetries:n,timeout:parseInt(process.env.API_TIMEOUT_MS||`600000`,10),dangerouslyAllowBrowser:!0,fetchOptions:ht({forAnthropicAPI:!0}),...f&&{fetch:f}};if(s(process.env.CLAUDE_CODE_USE_BEDROCK)){let{BedrockClient:e}=await import(`./bedrockClient-DxE_mHFI.js`),t=r===Ps()&&process.env.ANTHROPIC_SMALL_FAST_MODEL_AWS_REGION?process.env.ANTHROPIC_SMALL_FAST_MODEL_AWS_REGION:d(),n={...p,awsRegion:t,...s(process.env.CLAUDE_CODE_SKIP_BEDROCK_AUTH)&&{skipAuth:!0},...Le()&&{logger:Ar()}};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 U();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({...p,...t&&{azureADTokenProvider:t},...Le()&&{logger:Ar()}})}if(s(process.env.CLAUDE_CODE_USE_VERTEX)){s(process.env.CLAUDE_CODE_SKIP_VERTEX_AUTH)||await go();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({...p,region:o(r),googleAuth:c,...Le()&&{logger:Ar()}})}return new je({apiKey:R()?null:e||na(),authToken:R()?W()?.accessToken:void 0,...p,...Le()&&{logger:Ar()}})}async function Mr(e,t){let n=process.env.ANTHROPIC_AUTH_TOKEN||await fa(t);n&&(e.Authorization=`Bearer ${n}`)}function Nr(){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 Pr(e,t){let n=e??globalThis.fetch,r=k()===`firstParty`&&Nt();return(e,i)=>{let a=new Headers(i?.headers);r&&!a.has(`x-client-request-id`)&&a.set(Fr,Tt());try{let n=e instanceof Request?e.url:String(e),r=a.get(Fr);v(`[API REQUEST] ${new URL(n).pathname}${r?` ${Fr}=${r}`:``} source=${t??`unknown`}`)}catch{}return n(e,{...i,headers:a})}}var Fr,Ir=e((()=>{ke(),G(),kr(),oc(),A(),_t(),m(),_(),l(),Fr=`x-client-request-id`}));function Lr(){return yt(c(),`cache`)}function Rr(){return yt(Lr(),`model-capabilities.json`)}function zr(){return!(k()!==`firstParty`||!Nt())}function Br(e){return[...e].sort((e,t)=>t.id.length-e.id.length||e.id.localeCompare(t.id))}function Vr(e){if(!zr())return;let t=Gr(Rr());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 Hr(){if(zr()&&!et())try{let e=await jr({maxRetries:1}),t=R()?[lt]:void 0,n=[];for await(let r of e.models.list({betas:t})){let e=Ur().safeParse(r);e.success&&n.push(e.data)}if(n.length===0)return;let r=Rr(),i=Br(n);if(Cr(Gr(r),i)){v(`[modelCapabilities] cache unchanged, skipping write`);return}await Et(Lr(),{recursive:!0}),await Ot(r,Re({models:i,timestamp:Date.now()}),{encoding:`utf-8`,mode:384}),Gr.cache.delete(r),v(`[modelCapabilities] cached ${i.length} models`)}catch(e){v(`[modelCapabilities] fetch failed: ${e instanceof Error?e.message:`unknown`}`)}}var Ur,Wr,Gr,Kr=e((()=>{wr(),i(),le(),O(),Ir(),G(),_(),l(),it(),ue(),$e(),Me(),A(),Ur=ce(()=>se({id:ie(),max_input_tokens:ae().optional(),max_tokens:ae().optional()}).strip()),Wr=ce(()=>se({models:oe(Ur()),timestamp:ae()})),Gr=r(e=>{try{let t=St(e,`utf-8`),n=Wr().safeParse(at(t,!1));return n.success?n.data.models:null}catch{return null}},e=>e)}));function qr(){return s(process.env.CLAUDE_CODE_DISABLE_1M_CONTEXT)}function F(e){return!qr()&&/\[1m\]/i.test(e)}function Jr(e){if(qr())return!1;let t=Q(e);return t.includes(`claude-sonnet-4`)||t.includes(`opus-4-6`)||t.includes(`opus-4-7`)}function Yr(e,t){if(F(e))return 1e6;let n=Vr(e);return n?.max_input_tokens&&n.max_input_tokens>=1e5?n.max_input_tokens>2e5&&qr()?ei:n.max_input_tokens:t?.includes(`context-1m-2025-08-07`)&&Jr(e)||Xr(e)?1e6:ei}function Xr(e){return qr()||F(e)||!Q(e).includes(`sonnet-4-6`)?!1:S().clientDataCache?.coral_reef_sonnet===`true`}function Zr(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 Qr(e){let t,n,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=ni,n=ri);let i=Vr(e);return i?.max_tokens&&i.max_tokens>=4096&&(n=i.max_tokens,t=Math.min(t,n)),{default:t,upperLimit:n}}function $r(e){return Qr(e).upperLimit-1}var ei,ti,ni,ri,ii,ai=e((()=>{Sr(),Ge(),l(),oc(),Kr(),ei=2e5,ti=2e4,ni=32e3,ri=64e3,ii=8e3})),oi,si,ci,li=e((()=>{i(),A(),oi=[{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`}],si=[{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`}],ci=r((e,t)=>{if(k()===`firstParty`)return;let n=e.toLowerCase(),r=k()===`openai`?si:oi;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 ui(e){let t=[],n=[];for(let r of e)bi.includes(r)?t.push(r):n.push(r);return{allowed:t,disallowed:n}}function di(e){if(!e||e.length===0)return;if(R()){console.warn(`Warning: Custom betas are only available for API key users. Ignoring provided betas.`);return}let{allowed:t,disallowed:n}=ui(e);for(let e of n)console.warn(`Warning: Beta header '${e}' is not allowed. Only the following betas are supported: ${bi.join(`, `)}`);return t.length>0?t:void 0}function fi(e){let t=ci(e,`interleaved_thinking`);if(t!==void 0)return t;let n=Q(e),r=k();return r===`foundry`?!0:r===`firstParty`?!n.includes(`claude-3-`):n.includes(`claude-opus-4`)||n.includes(`claude-sonnet-4`)}function pi(e){let t=Q(e),n=k();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 mi(e){let t=Q(e),n=k();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 gi(){return(k()===`firstParty`||k()===`foundry`)&&!s(process.env.CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS)&&Nt()}function _i(){return k()===`firstParty`&&!s(process.env.CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS)}function vi(e,t){let n=[...Si(e)];t?.isAgenticQuery&&(n.includes(`claude-code-20250219`)||n.push(cr));let r=xe();return!r||r.length===0?n:[...n,...r.filter(e=>!n.includes(e))]}function yi(){xi.cache?.clear?.(),Si.cache?.clear?.(),Ci.cache?.clear?.()}var bi,xi,Si,Ci,wi=e((()=>{i(),m(),Sr(),O(),G(),ai(),l(),oc(),li(),A(),x(),bi=[ur],xi=r(e=>{let t=[],n=Q(e).includes(`haiku`);k();let r=gi();n||t.push(cr),R()&&t.push(lt),F(e)&&t.push(ur),!s(process.env.DISABLE_INTERLEAVED_THINKING)&&fi(e)&&t.push(lr),r&&fi(e)&&!h()&&Ve().showThinkingSummaries!==!0&&t.push(_r);let i=s(process.env.USE_API_CONTEXT_MANAGEMENT)||pi(e),a=pi(e);return gi()&&(i||a)&&t.push(dr),r&&mi(e),r&&t.push(hr),process.env.ANTHROPIC_BETAS&&t.push(...process.env.ANTHROPIC_BETAS.split(`,`).map(e=>e.trim()).filter(Boolean)),t}),Si=r(e=>{let t=xi(e);return k()===`bedrock`?t.filter(e=>!br.has(e)):t}),Ci=r(e=>xi(e).filter(e=>br.has(e)))}));function Ti(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 Ei=e((()=>{}));async function Di(){try{let e=M(Xn),{stdout:t,code:n}=await Qe(`security`,[`find-generic-password`,`-a`,Jn(),`-w`,`-s`,e],{useCwd:!1,preserveOutputOnError:!1});if(n===0&&t)return De(t.trim())}catch{}return null}function Oi(){if(ji!==void 0)return ji;if(process.platform!==`darwin`)return ji=!1,!1;try{ji=Ze(`security`,[`show-keychain-info`],{reject:!1,stdio:[`ignore`,`pipe`,`pipe`]}).exitCode===36}catch{ji=!1}return ji}var ki,Ai,ji,Mi=e((()=>{qe(),_(),Xe(),Ke(),Me(),Zn(),ki=4032,Ai={name:`keychain`,read(){let e=P.cache;if(Date.now()-e.cachedAt<3e4)return e.data;try{let e=M(Xn),t=Je(`security find-generic-password -a "${Jn()}" -w -s "${e}"`);if(t){let e=De(t);return P.cache={data:e,cachedAt:Date.now()},e}}catch{}return e.data===null?(P.cache={data:null,cachedAt:Date.now()},null):(v(`[keychain] read failed; serving stale cache`,{level:`warn`}),P.cache={data:e.data,cachedAt:Date.now()},e.data)},async readAsync(){let e=P.cache;if(Date.now()-e.cachedAt<3e4)return e.data;if(P.readInFlight)return P.readInFlight;let t=P.generation,n=Di().then(n=>{if(t===P.generation){n===null&&e.data!==null&&v(`[keychain] readAsync failed; serving stale cache`,{level:`warn`});let t=n??e.data;return P.cache={data:t,cachedAt:Date.now()},P.readInFlight=null,t}return n});return P.readInFlight=n,n},update(e){N();try{let t=M(Xn),n=Jn(),r=Re(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<=ki?o=Ze(`security`,[`-i`],{input:a,stdio:[`pipe`,`pipe`,`pipe`],reject:!1}):(v(`Keychain payload (${r.length}B JSON) exceeds security -i stdin limit; using argv`,{level:`warn`}),o=Ze(`security`,[`add-generic-password`,`-U`,`-a`,n,`-s`,t,`-X`,i],{stdio:[`ignore`,`pipe`,`pipe`],reject:!1})),o.exitCode===0?(P.cache={data:e,cachedAt:Date.now()},{success:!0}):{success:!1}}catch{return{success:!1}}},delete(){N();try{let e=M(Xn);return Je(`security delete-generic-password -a "${Jn()}" -s "${e}"`),!0}catch{return!1}}}}));function Ni(){let e=c();return{storageDir:e,storagePath:yt(e,`.credentials.json`)}}var Pi,Fi=e((()=>{l(),ze(),Ie(),Me(),Pi={name:`plaintext`,read(){let{storagePath:e}=Ni();try{return De(Fe().readFileSync(e,{encoding:`utf8`}))}catch{return null}},async readAsync(){let{storagePath:e}=Ni();try{return De(await Fe().readFile(e,{encoding:`utf8`}))}catch{return null}},update(e){try{let{storageDir:t,storagePath:n}=Ni();try{Fe().mkdirSync(t)}catch(e){if(Ae(e)!==`EEXIST`)throw e}return Oe(n,Re(e),{encoding:`utf8`,flush:!1}),bt(n,384),{success:!0,warning:`Warning: Storing credentials in plaintext.`}}catch{return{success:!1}}},delete(){let{storagePath:e}=Ni();try{return Fe().unlinkSync(e),!0}catch(e){return Ae(e)===`ENOENT`}}}}));function Ii(){return process.platform===`darwin`?Ti(Ai,Pi):Pi}var Li=e((()=>{Ei(),Mi(),Fi()}));function Ri(e){return new Promise(t=>{At(`security`,[`find-generic-password`,`-a`,Jn(),`-w`,`-s`,e],{encoding:`utf-8`,timeout:Ui},(e,n)=>{t({stdout:e?null:n?.trim()||null,timedOut:!!(e&&`killed`in e&&e.killed)})})})}function zi(){if(process.platform!==`darwin`||Gi||u())return;let e=Ri(M(Xn)),t=Ri(M());Gi=Promise.all([e,t]).then(([e,t])=>{e.timedOut||Yn(e.stdout),t.timedOut||(Wi={stdout:t.stdout})})}async function Bi(){Gi&&await Gi}function Vi(){return Wi}function Hi(){Wi=null}var Ui,Wi,Gi,Ki=e((()=>{l(),Zn(),Ui=1e4,Wi=null,Gi=null}));function qi(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 Ji=e((()=>{}));function Yi(){return Zi}function Xi(){Zi.clear()}var Zi,Qi=e((()=>{Zi=new Map})),$i=n({calculateApiKeyHelperTTL:()=>ua,checkAndRefreshOAuthTokenIfNeeded:()=>Va,checkGcpCredentialsValid:()=>wa,clearApiKeyHelperCache:()=>ga,clearAwsCredentialsCache:()=>xa,clearGcpCredentialsCache:()=>Da,clearOAuthTokenCache:()=>Ia,getAccountInformation:()=>so,getAnthropicApiKey:()=>na,getAnthropicApiKeyWithSource:()=>ia,getApiKeyFromApiKeyHelper:()=>fa,getApiKeyFromApiKeyHelperCached:()=>ha,getApiKeyFromConfigOrMacOSKeychain:()=>_o,getApiKeyHelperElapsedMs:()=>da,getAuthTokenSource:()=>ta,getClaudeAIOAuthTokens:()=>W,getClaudeAIOAuthTokensAsync:()=>Ba,getConfiguredApiKeyHelper:()=>L,getOauthAccountInfo:()=>Ga,getOtelHeadersFromHelper:()=>io,getRateLimitTier:()=>$a,getSubscriptionName:()=>eo,getSubscriptionType:()=>z,handleOAuth401Error:()=>Ra,hasAnthropicApiKeyAuth:()=>ra,hasOpusAccess:()=>qa,hasProfileScope:()=>Ua,is1PApiCustomer:()=>Wa,isAnthropicAuthEnabled:()=>I,isAwsAuthRefreshFromProjectSettings:()=>sa,isAwsCredentialExportFromProjectSettings:()=>la,isClaudeAISubscriber:()=>R,isConsumerSubscriber:()=>oo,isCustomApiKeyApproved:()=>Ma,isEnterpriseSubscriber:()=>Za,isGcpAuthRefreshFromProjectSettings:()=>Ca,isMaxSubscriber:()=>Ja,isOtelHeadersHelperFromProjectOrLocalSettings:()=>ro,isOverageProvisioningAllowed:()=>Ka,isProSubscriber:()=>Qa,isTeamPremiumSubscriber:()=>Xa,isTeamSubscriber:()=>Ya,isUsing3PServices:()=>to,prefetchApiKeyFromApiKeyHelperIfSafe:()=>_a,prefetchAwsCredentialsAndBedRockInfoIfSafe:()=>ka,prefetchGcpCredentialsIfSafe:()=>Oa,refreshAndGetAwsCredentials:()=>U,refreshAwsAuth:()=>ya,refreshGcpAuth:()=>Ea,refreshGcpCredentialsIfNeeded:()=>go,removeApiKey:()=>Na,saveApiKey:()=>ja,saveOAuthTokensIfNeeded:()=>Fa,validateForceLoginOrg:()=>co});function ea(){return s(process.env.CLAUDE_CODE_REMOTE)||process.env.CLAUDE_CODE_ENTRYPOINT===`claude-desktop`}function I(){if(u())return!1;if(process.env.ANTHROPIC_UNIX_SOCKET)return!!process.env.CLAUDE_CODE_OAUTH_TOKEN;let e=b()||{},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}=ia({skipRetrievingKeyFromApiKeyHelper:!0}),a=i===`ANTHROPIC_API_KEY`||i===`apiKeyHelper`;return!(t||r&&!ea()||a&&!ea())}function ta(){if(u())return L()?{source:`apiKeyHelper`,hasToken:!0}:{source:`none`,hasToken:!1};if(process.env.ANTHROPIC_AUTH_TOKEN&&!ea())return{source:`ANTHROPIC_AUTH_TOKEN`,hasToken:!0};if(process.env.CLAUDE_CODE_OAUTH_TOKEN)return{source:`CLAUDE_CODE_OAUTH_TOKEN`,hasToken:!0};if(Vn())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(L()&&!ea())return{source:`apiKeyHelper`,hasToken:!0};let e=W();return Tn(e?.scopes)&&e?.accessToken?{source:`claude.ai`,hasToken:!0}:{source:`none`,hasToken:!1}}function na(){let{key:e}=ia();return e}function ra(){let{key:e,source:t}=ia({skipRetrievingKeyFromApiKeyHelper:!0});return e!==null&&t!==`none`}function ia(e={}){if(u())return process.env.ANTHROPIC_API_KEY?{key:process.env.ANTHROPIC_API_KEY,source:`ANTHROPIC_API_KEY`}:L()?{key:e.skipRetrievingKeyFromApiKeyHelper?null:ha(),source:`apiKeyHelper`}:{key:null,source:`none`};let t=a()?void 0:process.env.ANTHROPIC_API_KEY;if(de()&&t)return{key:t,source:`ANTHROPIC_API_KEY`};if(s(process.env.CI)){let e=Hn();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&&S().customApiKeyResponses?.approved?.includes($n(t)))return{key:t,source:`ANTHROPIC_API_KEY`};let n=Hn();return n?{key:n,source:`ANTHROPIC_API_KEY`}:L()?e.skipRetrievingKeyFromApiKeyHelper?{key:null,source:`apiKeyHelper`}:{key:ha(),source:`apiKeyHelper`}:_o()||{key:null,source:`none`}}function L(){return u()?y(`flagSettings`)?.apiKeyHelper:(b()||{}).apiKeyHelper}function aa(){let e=L();if(!e)return!1;let t=y(`projectSettings`),n=y(`localSettings`);return t?.apiKeyHelper===e||n?.apiKeyHelper===e}function oa(){return(b()||{}).awsAuthRefresh}function sa(){let e=oa();if(!e)return!1;let t=y(`projectSettings`),n=y(`localSettings`);return t?.awsAuthRefresh===e||n?.awsAuthRefresh===e}function ca(){return(b()||{}).awsCredentialExport}function la(){let e=ca();if(!e)return!1;let t=y(`projectSettings`),n=y(`localSettings`);return t?.awsCredentialExport===e||n?.awsCredentialExport===e}function ua(){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;v(`Found CLAUDE_CODE_API_KEY_HELPER_TTL_MS env var, but it was not a valid number. Got ${e}`,{level:`error`})}return lo}function da(){let e=V?.startedAt;return e?Date.now()-e:0}async function fa(e){if(!L())return null;let t=ua();return B?(Date.now()-B.timestamp<t||V||(V={promise:pa(e,!1,H),startedAt:null}),B.value):(V||(V={promise:pa(e,!0,H),startedAt:Date.now()}),V.promise)}async function pa(e,t,n){try{let t=await ma(e);return n===H&&t!==null&&(B={value:t,timestamp:Date.now()}),t}catch(e){if(n!==H)return` `;let r=e instanceof Error?e.message:String(e);return console.error(re.red(`apiKeyHelper failed: ${r}`)),v(`Error getting API key from apiKeyHelper: ${r}`,{level:`error`}),!t&&B&&B.value!==` `?(B={...B,timestamp:Date.now()},B.value):(B={value:` `,timestamp:Date.now()},` `)}finally{n===H&&(V=null)}}async function ma(e){let t=L();if(!t)return null;if(aa()&&!C()&&!e)return Pe(`apiKeyHelper invoked before trust check`,Error(`Security: apiKeyHelper executed before workspace trust is confirmed. If you see this message, post in .`)),E(`tengu_apiKeyHelper_missing_trust11`,{}),null;let n=await Ye(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 ha(){return B?.value??null}function ga(){H++,B=null,V=null}function _a(e){aa()&&!C()||fa(e)}async function va(){let e=oa();if(!e)return!1;if(sa()&&!C()&&!h())return Pe(`awsAuthRefresh invoked before trust check`,Error(`Security: awsAuthRefresh executed before workspace trust is confirmed. If you see this message, post in .`)),E(`tengu_awsAuthRefresh_missing_trust`,{}),!1;try{return v(`Fetching AWS caller identity for AWS auth refresh command`),await rr(),v(`Fetched AWS caller identity, skipping AWS auth refresh command`),!1}catch{return ya(e)}}function ya(e){v(`Running AWS auth refresh command`);let t=or.getInstance();return t.startAuthentication(),new Promise(n=>{let r=kt(e,{timeout:fo});r.stdout.on(`data`,e=>{let n=e.toString().trim();n&&(t.addOutput(n),v(n,{level:`debug`}))}),r.stderr.on(`data`,e=>{let n=e.toString().trim();n&&(t.setError(n),v(n,{level:`error`}))}),r.on(`close`,(e,r)=>{if(e===0)v(`AWS auth refresh completed successfully`),t.endAuthentication(!0),n(!0);else{let e=r===`SIGTERM`?re.red(`AWS auth refresh timed out after 3 minutes. Run your auth command manually in a separate terminal.`):re.red(`Error running awsAuthRefresh (in settings or ~/.claude.json):`);console.error(e),t.endAuthentication(!1),n(!1)}})})}async function ba(){let e=ca();if(!e)return null;if(la()&&!C()&&!h())return Pe(`awsCredentialExport invoked before trust check`,Error(`Security: awsCredentialExport executed before workspace trust is confirmed. If you see this message, post in .`)),E(`tengu_awsCredentialExport_missing_trust`,{}),null;try{return v(`Fetching AWS caller identity for credential export command`),await rr(),v(`Fetched AWS caller identity, skipping AWS credential export command`),null}catch{try{v(`Running AWS credential export command`);let t=await Ye(e,{shell:!0,reject:!1});if(t.exitCode!==0||!t.stdout)throw Error(`awsCredentialExport did not return a valid value`);let n=De(t.stdout.trim());if(!nr(n))throw Error(`awsCredentialExport did not return valid AWS STS output structure`);return v(`AWS credentials retrieved from awsCredentialExport`),{accessKeyId:n.Credentials.AccessKeyId,secretAccessKey:n.Credentials.SecretAccessKey,sessionToken:n.Credentials.SessionToken}}catch(e){let t=re.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 xa(){U.cache.clear()}function Sa(){return(b()||{}).gcpAuthRefresh}function Ca(){let e=Sa();if(!e)return!1;let t=y(`projectSettings`),n=y(`localSettings`);return t?.gcpAuthRefresh===e||n?.gcpAuthRefresh===e}async function wa(){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=qi(po).then(()=>{throw new wo(`GCP credentials check timed out`)});return await Promise.race([r,i]),!0}catch{return!1}}async function Ta(){let e=Sa();if(!e)return!1;if(Ca()&&!C()&&!h())return Pe(`gcpAuthRefresh invoked before trust check`,Error(`Security: gcpAuthRefresh executed before workspace trust is confirmed. If you see this message, post in .`)),E(`tengu_gcpAuthRefresh_missing_trust`,{}),!1;try{if(v(`Checking GCP credentials validity for auth refresh`),await wa())return v(`GCP credentials are valid, skipping auth refresh command`),!1}catch{}return Ea(e)}function Ea(e){v(`Running GCP auth refresh command`);let t=or.getInstance();return t.startAuthentication(),new Promise(n=>{let r=kt(e,{timeout:ho});r.stdout.on(`data`,e=>{let n=e.toString().trim();n&&(t.addOutput(n),v(n,{level:`debug`}))}),r.stderr.on(`data`,e=>{let n=e.toString().trim();n&&(t.setError(n),v(n,{level:`error`}))}),r.on(`close`,(e,r)=>{if(e===0)v(`GCP auth refresh completed successfully`),t.endAuthentication(!0),n(!0);else{let e=r===`SIGTERM`?re.red(`GCP auth refresh timed out after 3 minutes. Run your auth command manually in a separate terminal.`):re.red(`Error running gcpAuthRefresh (in settings or ~/.claude.json):`);console.error(e),t.endAuthentication(!1),n(!1)}})})}function Da(){go.cache.clear()}function Oa(){Sa()&&(Ca()&&!C()&&!h()||go())}function ka(){let e=oa(),t=ca();!e&&!t||(sa()||la())&&!C()&&!h()||(U(),j())}function Aa(e){return/^[a-zA-Z0-9-_]+$/.test(e)}async function ja(e){if(!Aa(e))throw Error(`Invalid API key format. API key must contain only alphanumeric characters, dashes, and underscores.`);await Pa();let t=!1;if(process.platform===`darwin`)try{let n=M();await Ye(`security`,[`-i`],{input:`add-generic-password -U -a "${Jn()}" -s "${n}" -X "${Buffer.from(e,`utf-8`).toString(`hex`)}"\n`,reject:!1}),E(`tengu_api_key_saved_to_keychain`,{}),t=!0}catch(e){T(e),E(`tengu_api_key_keychain_error`,{error:g(e)}),E(`tengu_api_key_saved_to_config`,{})}else E(`tengu_api_key_saved_to_config`,{});let n=$n(e);w(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??[]}}}),_o.cache.clear?.(),Hi()}function Ma(e){let t=S(),n=$n(e);return t.customApiKeyResponses?.approved?.includes(n)??!1}async function Na(){await Pa(),w(e=>({...e,primaryApiKey:void 0})),_o.cache.clear?.(),Hi()}async function Pa(){try{await Qn()}catch(e){T(e)}}function Fa(e){if(!Tn(e.scopes))return E(`tengu_oauth_tokens_not_claude_ai`,{}),{success:!0};if(!e.refreshToken||!e.expiresAt)return E(`tengu_oauth_tokens_inference_only`,{}),{success:!0};let t=Ii(),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?E(`tengu_oauth_tokens_saved`,{storageBackend:n}):E(`tengu_oauth_tokens_save_failed`,{storageBackend:n}),W.cache?.clear?.(),yi(),Xi(),a}catch(e){return T(e),E(`tengu_oauth_tokens_save_exception`,{storageBackend:n,error:g(e)}),{success:!1,warning:`Failed to save OAuth tokens`}}}function Ia(){W.cache?.clear?.(),N()}async function La(){try{let{mtimeMs:e}=await Dt(yt(c(),`.credentials.json`));e!==vo&&(vo=e,Ia())}catch{W.cache?.clear?.()}}function Ra(e){let t=yo.get(e);if(t)return t;let n=za(e).finally(()=>{yo.delete(e)});return yo.set(e,n),n}async function za(e){Ia();let t=await Ba();return t?.refreshToken?t.accessToken===e?Va(0,!0):(E(`tengu_oauth_401_recovered_from_keychain`,{}),!0):!1}async function Ba(){if(u())return null;if(process.env.CLAUDE_CODE_OAUTH_TOKEN||Vn())return W();try{let e=(await Ii().readAsync())?.claudeAiOauth;return e?.accessToken?e:null}catch(e){return T(e),null}}function Va(e=0,t=!1){return e===0&&!t?bo||(bo=Ha(e,t).finally(()=>{bo=null}),bo):Ha(e,t)}async function Ha(e,t){await La();let n=W();if(!t&&(!n?.refreshToken||!Mn(n.expiresAt))||!n?.refreshToken||!Tn(n.scopes))return!1;W.cache?.clear?.(),N();let r=await Ba();if(!r?.refreshToken||!Mn(r.expiresAt))return!1;let i=c();await Et(i,{recursive:!0});let a;try{E(`tengu_oauth_token_refresh_lock_acquiring`,{}),a=await Ue(i),E(`tengu_oauth_token_refresh_lock_acquired`,{})}catch(n){return n.code===`ELOCKED`?e<5?(E(`tengu_oauth_token_refresh_lock_retry`,{retryCount:e+1}),await qi(1e3+Math.random()*1e3),Ha(e+1,t)):(E(`tengu_oauth_token_refresh_lock_retry_limit_reached`,{maxRetries:5}),!1):(T(n),E(`tengu_oauth_token_refresh_lock_error`,{error:g(n)}),!1)}try{W.cache?.clear?.(),N();let e=await Ba();return!e?.refreshToken||!Mn(e.expiresAt)?(E(`tengu_oauth_token_refresh_race_resolved`,{}),!1):(E(`tengu_oauth_token_refresh_starting`,{}),Fa(await kn(e.refreshToken,{scopes:Tn(e.scopes)?void 0:e.scopes})),W.cache?.clear?.(),N(),!0)}catch(e){T(e),W.cache?.clear?.(),N();let t=await Ba();return t&&!Mn(t.expiresAt)?(E(`tengu_oauth_token_refresh_race_recovered`,{}),!0):!1}finally{E(`tengu_oauth_token_refresh_lock_releasing`,{}),await a(),E(`tengu_oauth_token_refresh_lock_released`,{})}}function R(){return I()?Tn(W()?.scopes):!1}function Ua(){return W()?.scopes?.includes(`user:profile`)??!1}function Wa(){return!(s(process.env.CLAUDE_CODE_USE_BEDROCK)||s(process.env.CLAUDE_CODE_USE_VERTEX)||s(process.env.CLAUDE_CODE_USE_FOUNDRY)||R())}function Ga(){return I()?S().oauthAccount:void 0}function Ka(){let e=Ga()?.billingType;return!(!R()||!e||e!==`stripe_subscription`&&e!==`stripe_subscription_contracted`&&e!==`apple_subscription`&&e!==`google_play_subscription`)}function qa(){let e=z();return e===`max`||e===`enterprise`||e===`team`||e===`pro`||e===null}function z(){if(!I())return null;let e=W();return e?e.subscriptionType??null:null}function Ja(){return z()===`max`}function Ya(){return z()===`team`}function Xa(){return z()===`team`&&$a()===`default_claude_max_5x`}function Za(){return z()===`enterprise`}function Qa(){return z()===`pro`}function $a(){if(!I())return null;let e=W();return e?e.rateLimitTier??null:null}function eo(){switch(z()){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 to(){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 no(){return(b()||{}).otelHeadersHelper}function ro(){let e=no();if(!e)return!1;let t=y(`projectSettings`),n=y(`localSettings`);return t?.otelHeadersHelper===e||n?.otelHeadersHelper===e}function io(){let e=no();if(!e)return{};let t=parseInt(process.env.CLAUDE_CODE_OTEL_HEADERS_HELPER_DEBOUNCE_MS||Co.toString(),10);if(xo&&Date.now()-So<t)return xo;if(ro()&&!C())return{};try{let t=Je(e,{timeout:3e4})?.toString().trim();if(!t)throw Error(`otelHeadersHelper did not return a valid value`);let n=De(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 xo=n,So=Date.now(),xo}catch(e){throw T(Error(`Error getting OpenTelemetry headers from otelHeadersHelper (in settings): ${g(e)}`)),e}}function ao(e){return e===`max`||e===`pro`}function oo(){let e=z();return R()&&e!==null&&ao(e)}function so(){if(k()!==`firstParty`)return;let{source:e}=ta(),t={};e===`CLAUDE_CODE_OAUTH_TOKEN`||e===`CLAUDE_CODE_OAUTH_TOKEN_FILE_DESCRIPTOR`?t.tokenSource=e:R()?t.subscription=eo():t.tokenSource=e;let{key:n,source:r}=ia();if(n&&(t.apiKeySource=r),e===`claude.ai`||r===`/login managed key`){let e=Ga()?.organizationName;e&&(t.organization=e)}let i=Ga()?.emailAddress;return(e===`claude.ai`||r===`/login managed key`)&&i&&(t.email=i),t}async function co(){if(process.env.ANTHROPIC_UNIX_SOCKET||!I())return{valid:!0};let e=y(`policySettings`)?.forceLoginOrgUUID;if(!e)return{valid:!0};await Va();let t=W();if(!t)return{valid:!0};let{source:n}=ta(),r=n===`CLAUDE_CODE_OAUTH_TOKEN`||n===`CLAUDE_CODE_OAUTH_TOKEN_FILE_DESCRIPTOR`,i=await Cn(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 lo,B,V,H,uo,fo,U,po,mo,ho,go,_o,W,vo,yo,bo,xo,So,Co,wo,G=e((()=>{ne(),qe(),i(),O(),ot(),xn(),A(),m(),Ln(),wn(),qn(),er(),ar(),sr(),wi(),Ge(),_(),l(),ze(),Xe(),We(),tt(),rt(),Li(),Ki(),Zn(),x(),Ji(),Me(),Qi(),lo=300*1e3,B=null,V=null,H=0,uo=3600*1e3,fo=180*1e3,U=nt(async()=>{let e=await va(),t=await ba();return(e||t)&&await ir(),t},uo),po=5e3,mo=3600*1e3,ho=180*1e3,go=nt(async()=>await Ta(),mo),_o=r(()=>{if(u())return null;if(process.platform===`darwin`){let e=Vi();if(e){if(e.stdout)return{key:e.stdout,source:`/login managed key`}}else{let e=M();try{let t=Je(`security find-generic-password -a $USER -w -s "${e}"`);if(t)return{key:t,source:`/login managed key`}}catch(e){T(e)}}}let e=S();return e.primaryApiKey?{key:e.primaryApiKey,source:`/login managed key`}:null}),W=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=Vn();if(e)return{accessToken:e,refreshToken:null,expiresAt:null,scopes:[`user:inference`],subscriptionType:null,rateLimitTier:null};try{let e=Ii().read()?.claudeAiOauth;return e?.accessToken?e:null}catch(e){return T(e),null}}),vo=0,yo=new Map,bo=null,xo=null,So=0,Co=1740*1e3,wo=class extends Error{}}));function K(){return!s(process.env.CLAUDE_CODE_DISABLE_FAST_MODE)}function To(){return K()?Do()===null:!1}function Eo(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 Do(){if(!K())return`Fast mode is not available`;if(dt(),h()&&de()&&!pe()&&!y(`flagSettings`)?.fastMode){let e=`Fast mode is not available in the Agent SDK`;return v(`Fast mode unavailable: ${e}`),e}if(k()!==`firstParty`){let e=`Fast mode is not available on Bedrock, Vertex, or Foundry`;return v(`Fast mode unavailable: ${e}`),e}if(J.status===`disabled`){if((J.reason===`network_error`||J.reason===`unknown`)&&s(process.env.CLAUDE_CODE_SKIP_FAST_MODE_NETWORK_ERRORS))return null;let e=W()===null?`api-key`:`oauth`,t=Eo(J.reason,e);return v(`Fast mode unavailable: ${t}`),t}return null}function Oo(){return`opus`+(Ys()?`[1m]`:``)}function ko(e){if(!K()||!To()||!Ao(e))return!1;let t=Ve();return!t.fastModePerSessionOptIn&&t.fastMode===!0}function Ao(e){if(!K())return!1;let t=$(e??Ws());return t.toLowerCase().includes(`opus-4-7`)||t.toLowerCase().includes(`opus-4-6`)}function jo(){return q.status===`cooldown`&&Date.now()>=q.resetAt&&(K()&&!Wo&&(v(`Fast mode cooldown expired, re-enabling fast mode`),Wo=!0,Ko.emit()),q={status:`active`}),q}function Mo(e,t){if(!K())return;q={status:`cooldown`,resetAt:e,reason:t},Wo=!1;let n=e-Date.now();v(`Fast mode cooldown triggered (${t}), duration ${Math.round(n/1e3)}s`),E(`tengu_fast_mode_fallback_triggered`,{cooldown_duration_ms:n,cooldown_reason:t}),Go.emit(e,t)}function No(){q={status:`active`}}function Po(){J.status!==`disabled`&&(J={status:`disabled`,reason:`preference`},He(`userSettings`,{fastMode:void 0}),w(e=>({...e,penguinModeOrgEnabled:!1})),Zo.emit(!1))}function Fo(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 Io(e){return e===`org_level_disabled_until`||e===`out_of_credits`}function Lo(e){let t=Fo(e);v(`Fast mode overage rejection: ${e??`unknown`} — ${t}`),E(`tengu_fast_mode_overage_rejected`,{overage_disabled_reason:e??`unknown`}),Io(e)||(He(`userSettings`,{fastMode:void 0}),w(e=>({...e,penguinModeOrgEnabled:!1}))),Yo.emit(t)}function Ro(){return jo().status===`cooldown`}function zo(e,t){let n=K()&&To()&&!!t&&Ao(e);return n&&Ro()?`cooldown`:n?`on`:`off`}async function Bo(e){let t=`${D().BASE_API_URL}/api/claude_code_penguin_mode`,n=`accessToken`in e?{Authorization:`Bearer ${e.accessToken}`,"anthropic-beta":lt}:{"x-api-key":e.apiKey};return(await f.get(t,{headers:n})).data}function Vo(){K()&&J.status===`pending`&&(J=S().penguinModeOrgEnabled===!0?{status:`enabled`}:{status:`disabled`,reason:`unknown`})}async function Ho(){if(et()||!K())return;if(ts)return v(`Fast mode prefetch in progress, returning in-flight promise`),ts;let e=na();if(!(W()?.accessToken&&Ua())&&!e){J=S().penguinModeOrgEnabled===!0?{status:`enabled`}:{status:`disabled`,reason:`preference`};return}let t=Date.now();if(t-es<$o){v(`Skipping fast mode prefetch, fetched recently`);return}es=t;let n=async()=>{let t=W(),n=t?.accessToken&&Ua()?{accessToken:t.accessToken}:e?{apiKey:e}:null;if(!n)throw Error(`No auth available`);return Bo(n)};async function r(){try{let e;try{e=await n()}catch(t){if(f.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=W()?.accessToken;if(r)await Ra(r),e=await n();else throw t}else throw t}let t=J.status===`pending`?S().penguinModeOrgEnabled:J.status===`enabled`;J=e.enabled?{status:`enabled`}:{status:`disabled`,reason:e.disabled_reason??`preference`},t!==e.enabled&&(e.enabled||He(`userSettings`,{fastMode:void 0}),w(t=>({...t,penguinModeOrgEnabled:e.enabled})),Zo.emit(e.enabled)),v(`Org fast mode: ${e.enabled?`enabled`:`disabled (${e.disabled_reason??`preference`})`}`)}catch(e){J=S().penguinModeOrgEnabled===!0?{status:`enabled`}:{status:`disabled`,reason:`network_error`},v(`Failed to fetch org fast mode status, defaulting to ${J.status===`enabled`?`enabled (cached)`:`disabled (network_error)`}: ${e}`,{level:`error`}),E(`tengu_org_penguin_mode_fetch_failed`,{})}finally{ts=null}}return ts=r(),ts}var Uo,q,Wo,Go,Ko,qo,Jo,Yo,Xo,J,Zo,Qo,$o,es,ts,ns=e((()=>{p(),O(),m(),ot(),G(),ft(),Ge(),_(),l(),oc(),A(),$e(),x(),we(),Uo=`Opus 4.7`,q={status:`active`},Wo=!1,Go=be(),Ko=be(),qo=Go.subscribe,Jo=Ko.subscribe,Yo=be(),Xo=Yo.subscribe,J={status:`pending`},Zo=be(),Qo=Zo.subscribe,$o=3e4,es=0,ts=null}));function rs(e){return K()&&e?ps:fs}function is(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 as(e,t){let n=Q(e);return n===Z(sn.firstParty)?rs(t.speed===`fast`):_s[n]||(os(e,n),_s[Q(Ws())]??gs)}function os(e,t){E(`tengu_unknown_model_cost`,{model:e,shortName:t}),ve()}function ss(e,t){return is(as(e,t),t)}function cs(e,t){return ss(e,{input_tokens:t.inputTokens,output_tokens:t.outputTokens,cache_read_input_tokens:t.cacheReadInputTokens,cache_creation_input_tokens:t.cacheCreationInputTokens})}function ls(e){return Number.isInteger(e)?`$${e}`:`$${e.toFixed(2)}`}function us(e){return`${ls(e.inputTokens)}/${ls(e.outputTokens)} per Mtok`}var Y,ds,fs,ps,ms,hs,gs,_s,vs=e((()=>{ot(),m(),ns(),fn(),oc(),Y={inputTokens:3,outputTokens:15,promptCacheWriteTokens:3.75,promptCacheReadTokens:.3,webSearchRequests:.01},ds={inputTokens:15,outputTokens:75,promptCacheWriteTokens:18.75,promptCacheReadTokens:1.5,webSearchRequests:.01},fs={inputTokens:5,outputTokens:25,promptCacheWriteTokens:6.25,promptCacheReadTokens:.5,webSearchRequests:.01},ps={inputTokens:30,outputTokens:150,promptCacheWriteTokens:37.5,promptCacheReadTokens:3,webSearchRequests:.01},ms={inputTokens:.8,outputTokens:4,promptCacheWriteTokens:1,promptCacheReadTokens:.08,webSearchRequests:.01},hs={inputTokens:1,outputTokens:5,promptCacheWriteTokens:1.25,promptCacheReadTokens:.1,webSearchRequests:.01},gs=fs,_s={[Z($t.firstParty)]:ms,[Z(en.firstParty)]:hs,[Z(Qt.firstParty)]:Y,[Z(Zt.firstParty)]:Y,[Z(tn.firstParty)]:Y,[Z(nn.firstParty)]:Y,[Z(ln.firstParty)]:Y,[Z(rn.firstParty)]:ds,[Z(an.firstParty)]:ds,[Z(on.firstParty)]:fs,[Z(sn.firstParty)]:fs}}));function X(e){return bs.includes(e)}function ys(e){return xs.includes(e)}var bs,xs,Ss=e((()=>{bs=[`sonnet`,`opus`,`haiku`,`best`,`sonnet[1m]`,`opus[1m]`,`opusplan`],xs=[`sonnet`,`opus`,`haiku`]}));function Cs(e,t){return e.includes(t)?!0:X(e)?$(e).toLowerCase().includes(t):!1}function ws(e,t){return e.startsWith(t)?e.length===t.length||e[t.length]===`-`:!1}function Ts(e,t){let n=X(e)?$(e).toLowerCase():e;return!!(ws(n,t)||!t.startsWith(`claude-`)&&ws(n,`claude-${t}`))}function Es(e,t){for(let n of t){if(ys(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 Ds(e){let{availableModels:t}=b()||{};if(!t)return!0;if(t.length===0)return!1;let n=gn(e).trim().toLowerCase(),r=t.map(e=>e.trim().toLowerCase());if(r.includes(n)&&(!ys(n)||!Es(n,r)))return!0;for(let e of r)if(ys(e)&&!Es(e,r)&&Cs(n,e))return!0;if(X(n)){let e=$(n).toLowerCase();if(r.includes(e))return!0}for(let e of r)if(!ys(e)&&X(e)&&$(e).toLowerCase()===n)return!0;for(let e of r)if(!ys(e)&&!X(e)&&Ts(n,e))return!0;return!1}var Os=e((()=>{x(),Ss(),oc(),xn()}));function ks(){return process.env.OPENAI_AUTH_MODE===`chatgpt`}var As,js,Ms,Ns=e((()=>{As=`gpt-5.5`,js=`gpt-5.4-mini`,Ms=[{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 Ps(){let e=k();return e===`openai`&&ks()?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||Hs()}function Fs(e){return e===j().opus40||e===j().opus41||e===j().opus45||e===j().opus46||e===j().opus47}function Is(){let e,t=_e();if(t!==void 0)e=t;else{let t=b()||{};e=process.env.ANTHROPIC_MODEL||t.model||void 0}if(!(e&&!Ds(e)))return e}function Ls(){let e=Is();return e==null?Gs():$(e)}function Rs(){return Bs()}function zs(){let e=k();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 Bs(){let e=k();return e===`openai`&&ks()?As: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:zs()||j().opus47}function Vs(){let e=k();return e===`openai`&&ks()?As: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:zs()||(e===`firstParty`?j().sonnet46:j().sonnet45)}function Hs(){let e=k();return e===`openai`&&ks()?js: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:zs()||j().haiku45}function Us(e){let{permissionMode:t,mainLoopModel:n,exceeds200kTokens:r=!1}=e;return Is()===`opusplan`&&t===`plan`&&!r?Bs():Is()===`haiku`&&t===`plan`?Vs():n}function Ws(){return Ja()||Xa()?Bs()+(Ys()?`[1m]`:``):Vs()}function Gs(){return $(Ws())}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(gn(e))}function Ks(e=!1){return Ja()||Xa()?Ys()?`Opus 4.7 with 1M context · Most capable for complex work${e?Js(!0):``}`:`Opus 4.7 · Most capable for complex work${e?Js(!0):``}`:`Sonnet 4.6 · Best for everyday tasks`}function qs(e){return e===`opusplan`?`Opus 4.7 in plan mode, else Sonnet 4.6`:Qs($(e))}function Js(e){if(k()!==`firstParty`)return``;let t=us(rs(e));return` ·${e?` (↯)`:``} ${t}`}function Ys(){return!(qr()||Qa()||k()!==`firstParty`||!Nt()||R()&&z()===null)}function Xs(e){return e===`opusplan`?`Opus Plan`:X(e)?pt(e):Qs(e)}function Zs(e){switch(e){case j().opus47:return`Opus 4.7`;case j().opus47+`[1m]`:return`Opus 4.7 (1M context)`;case j().opus46:return`Opus 4.6`;case j().opus46+`[1m]`:return`Opus 4.6 (1M context)`;case j().opus45:return`Opus 4.5`;case j().opus41:return`Opus 4.1`;case j().opus40:return`Opus 4`;case j().sonnet46+`[1m]`:return`Sonnet 4.6 (1M context)`;case j().sonnet46:return`Sonnet 4.6`;case j().sonnet45+`[1m]`:return`Sonnet 4.5 (1M context)`;case j().sonnet45:return`Sonnet 4.5`;case j().sonnet40:return`Sonnet 4`;case j().sonnet40+`[1m]`:return`Sonnet 4 (1M context)`;case j().sonnet37:return`Sonnet 3.7`;case j().sonnet35:return`Sonnet 3.5`;case j().haiku45:return`Haiku 4.5`;case j().haiku35:return`Haiku 3.5`;default:return null}}function Qs(e){return Zs(e)||e}function $(e){let t=e.trim(),n=t.toLowerCase(),r=F(n),i=r?n.replace(/\[1m]$/i,``).trim():n;if(X(i))switch(i){case`opusplan`:return Vs()+(r?`[1m]`:``);case`sonnet`:return Vs()+(r?`[1m]`:``);case`haiku`:return Hs()+(r?`[1m]`:``);case`opus`:return Bs()+(r?`[1m]`:``);case`best`:return Rs();default:}return k()===`firstParty`&&ec(i)&&tc()?Bs()+(r?`[1m]`:``):r?t.replace(/\[1m\]$/i,``).trim()+`[1m]`:t}function $s(e,t){return F(e)||!F(t)?e:Jr($(e))?e+`[1m]`:e}function ec(e){return ac.includes(e)}function tc(){return!s(process.env.CLAUDE_CODE_DISABLE_LEGACY_MODEL_REMAP)}function nc(e){if(e===null)return R()?`Default (${Ks()})`:`Default (${Gs()})`;let t=$(e);return e===t?t:`${e} (${t})`}function rc(e){if(k()===`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 ic(e){return e.replace(/\[(1|2)m\]/gi,``)}var ac,oc=e((()=>{m(),G(),ai(),l(),xn(),vs(),x(),A(),Be(),Os(),Ss(),mt(),Ns(),ac=[`claude-opus-4-20250514`,`claude-opus-4-1-20250805`,`claude-opus-4-0`,`claude-opus-4-1`]}));export{Po as $,Dr as $n,Ut as $r,Qa as $t,Ns as A,Si as An,jn as Ar,L as At,cs as B,Zr as Bn,Tn as Br,G as Bt,$ as C,Li as Cn,N as Cr,fa as Ct,$s as D,di as Dn,Rn as Dr,ta as Dt,Xs as E,yi as En,qn as Er,da as Et,Ss as F,_i as Fn,Ln as Fr,z as Ft,Uo as G,F as Gn,vn as Gr,R as Gt,us as H,$r as Hn,Sn as Hr,I as Ht,ms as I,ci as In,Mn as Ir,Ra as It,jo as J,Kr as Jn,Kt as Jr,Za as Jt,No as K,ai as Kn,j as Kr,oo as Kt,hs as L,li as Ln,En as Lr,ra as Lt,Os as M,hi as Mn,An as Mr,io as Mt,Ds as N,mi as Nn,Nn as Nr,$a as Nt,As as O,Ci as On,zn as Or,W as Ot,bs as P,gi as Pn,Pn as Pr,eo as Pt,Lo as Q,Ir as Qn,Xt as Qr,Ka as Qt,Y as R,ii as Rn,Fn as Rr,qa as Rt,ic as S,Ii as Sn,$n as Sr,ia as St,Qs as T,Oi as Tn,Kn as Tr,_o as Tt,rs as U,Qr as Un,Cn as Ur,sa as Ut,ss as V,Yr as Vn,In as Vr,Wa as Vt,vs as W,Xr as Wn,wn as Wr,la as Wt,Do as X,Fr as Xn,Gt as Xr,Ja as Xt,zo as Y,Hr as Yn,Ht as Yr,Ca as Yt,ko as Z,jr as Zn,Jt as Zr,ro as Zt,oc as _,Ji as _n,or as _r,xa as _t,Hs as a,k as ai,Oa as an,Cr as ar,Jo as at,Ys as b,Ki as bn,tr as br,so as bt,Bs as c,Nt as ci,Ea as cn,ur as cr,Qo as ct,rc as d,ja as dn,hr as dr,Mo as dt,zt as ei,Xa as en,Er as er,ns as et,Js as f,Fa as fn,_r as fr,$i as ft,Is as g,Qi as gn,Sr as gr,ga as gt,Ps as h,Yi as hn,xr as hr,wa as ht,Ks as i,Ft as ii,ka as in,wr as ir,Ao as it,ks as j,wi as jn,On as jr,Ga as jt,Ms as k,vi as kn,Dn as kr,Ba as kt,Vs as l,go as ln,dr as lr,Ho as lt,Us as m,Xi as mn,mr,Va as mt,Rs as n,Pt as ni,to as nn,kr as nr,Ro as nt,Gs as o,Mt as oi,U as on,yr as or,qo as ot,Zs as p,co as pn,fr as pr,ua as pt,Oo as q,qr as qn,xn as qr,Ma as qt,Q as r,Lt as ri,_a as rn,Or as rr,K as rt,Ws as s,A as si,ya as sn,vr as sr,Xo as st,Z as t,Rt as ti,Ya as tn,Tr as tr,To as tt,Ls as u,Na as un,gr as ur,Vo as ut,tc as v,qi as vn,sr as vr,Da as vt,qs as w,Mi as wn,Zn as wr,ha as wt,nc as x,zi as xn,er as xr,na as xt,Fs as y,Bi as yn,ar as yr,Ia as yt,_s as z,ti as zn,kn as zr,Ua as zt};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{dm as n,ia as r,lm as i,lv as a,ov as o,ra as s,sv as c,um as l}from"./loadAgentsDir-CKSb56Gp.js";import{di as u,fi as d,ui as f}from"./src-P_wYS_NJ2.js";import{t as p}from"./jsx-runtime-Bb4Xn-E0.js";import{D as m,E as h,J as g}from"./log-CTFl4qpD.js";import{n as _,r as v}from"./analytics-DJobLaWP.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-C2e73CJD.js";import{i as M,n as N,r as P,t as F}from"./extraUsage-Dt5mw35U.js";function I({onDone:e}){let t=c(e=>e.mainLoopModel),n=c(e=>e.mainLoopModelForSession),r=c(e=>e.fastMode),i=a();function o(){v(`tengu_model_command_menu`,{action:`cancel`});let n=H(t);e(`Kept model as ${f.bold(n)}`,{display:`system`})}function s(n){v(`tengu_model_command_menu`,{action:n,from_model:t,to_model:n}),i(e=>({...e,mainLoopModel:n,mainLoopModelForSession:null}));let a=`Set model to ${f.bold(H(n))}`,o;O()&&(b(),!D(n)&&r?(i(e=>({...e,fastMode:!1})),o=!1):D(n)&&A()&&r&&(a+=` · Fast mode ON`,o=!0)),N(n,o===!0,T())&&(a+=` · Billed as extra usage`),o===!1&&(a+=` · Fast mode OFF`),e(a)}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=c(e=>e.fastMode),i=a(),o=e==="default"?null:e;return U.useEffect(()=>{async function e(){if(o&&!S(o)){t(`Model '${o}' is not available. Your organization restricts model selection.`,{display:`system`});return}if(o&&z(o)){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(o&&B(o)){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(!o){a(null);return}if(R(o)){a(o);return}try{let{valid:e,error:n}=await r(o);e?a(o):t(n||`Model '${o}' not found`,{display:`system`})}catch(e){t(`Failed to validate model: ${e.message}`,{display:`system`})}}function a(e){i(t=>({...t,mainLoopModel:e,mainLoopModelForSession:null}));let r=`Set model to ${f.bold(H(e))}`,a;O()&&(b(),!D(e)&&n?(i(e=>({...e,fastMode:!1})),a=!1):D(e)&&n&&(r+=` · Fast mode ON`,a=!0)),N(e,a===!0,T())&&(r+=` · Billed as extra usage`),a===!1&&(r+=` · Fast mode OFF`),t(r)}e()},[o,t,i]),null}function R(e){return C.includes(e.toLowerCase().trim())}function z(e){let t=e.toLowerCase();return!i()&&!T()&&t.includes(`opus`)&&t.includes(`[1m]`)}function B(e){let t=e.toLowerCase();return!l()&&(t.includes(`sonnet[1m]`)||t.includes(`sonnet-4-6[1m]`))}function V({onDone:e}){let t=c(e=>e.mainLoopModel),n=c(e=>e.mainLoopModelForSession),r=H(t);return e(n?`Current model: ${f.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((()=>{u(),U=t(d(),1),M(),g(),_(),o(),F(),E(),y(),n(),w(),x(),s(),W=p(),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{_ as e,u as t}from"./model-C2e73CJD.js";e();export{t as getMainLoopModel};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{dm as t,lm as n,um as r}from"./loadAgentsDir-CKSb56Gp.js";import{F as i,Kt as a}from"./state-Bs5xweDL.js";import{f as o,g as s}from"./settings-Xbq6AaD-.js";import{c as ee,h as te}from"./config-D4G8_MqJ.js";import{A as c,Bt as l,Gn as u,Gt as d,H as f,I as ne,Kn as p,Kr as m,L as h,M as g,N as _,O as v,R as y,W as re,Xt as ie,_ as ae,a as b,ai as x,b as S,c as oe,d as C,en as w,f as T,g as E,i as D,j as O,k,l as A,qr as j,r as M,s as N,si as P,w as F}from"./model-C2e73CJD.js";function I(e=!1){if(d())return{value:null,label:`Default (recommended)`,description:D(e)};let t=x()!==`firstParty`;return{value:null,label:`Default (recommended)`,description:`Use the default model (currently ${F(N())})${t?``:` · ${f(y)}`}`}}function L(){let e=x()!==`firstParty`,t=x(),n=t===`openai`?process.env.OPENAI_DEFAULT_SONNET_MODEL:t===`gemini`?process.env.GEMINI_DEFAULT_SONNET_MODEL:process.env.ANTHROPIC_DEFAULT_SONNET_MODEL;if(e&&n){let e=u(n),r=t===`openai`?process.env.OPENAI_DEFAULT_SONNET_MODEL_NAME:t===`gemini`?process.env.GEMINI_DEFAULT_SONNET_MODEL_NAME:process.env.ANTHROPIC_DEFAULT_SONNET_MODEL_NAME,i=t===`openai`?process.env.OPENAI_DEFAULT_SONNET_MODEL_DESCRIPTION:t===`gemini`?process.env.GEMINI_DEFAULT_SONNET_MODEL_DESCRIPTION:process.env.ANTHROPIC_DEFAULT_SONNET_MODEL_DESCRIPTION;return{value:`sonnet`,label:r??n,description:i??`Custom Sonnet model${e?` (1M context)`:``}`,descriptionForModel:`${i??`Custom Sonnet model${e?` with 1M context`:``}`} (${n})`}}}function R(){let e=x()!==`firstParty`;return{value:e?m().sonnet46:`sonnet`,label:`Sonnet`,description:`Sonnet 4.6 · Best for everyday tasks${e?``:` · ${f(y)}`}`,descriptionForModel:`Sonnet 4.6 - best for everyday tasks. Generally recommended for most coding tasks`}}function se(){let e=x()!==`firstParty`,t=x(),n=t===`openai`?process.env.OPENAI_DEFAULT_OPUS_MODEL:t===`gemini`?process.env.GEMINI_DEFAULT_OPUS_MODEL:process.env.ANTHROPIC_DEFAULT_OPUS_MODEL;if(e&&n){let e=u(n),r=t===`openai`?process.env.OPENAI_DEFAULT_OPUS_MODEL_NAME:t===`gemini`?process.env.GEMINI_DEFAULT_OPUS_MODEL_NAME:process.env.ANTHROPIC_DEFAULT_OPUS_MODEL_NAME,i=t===`openai`?process.env.OPENAI_DEFAULT_OPUS_MODEL_DESCRIPTION:t===`gemini`?process.env.GEMINI_DEFAULT_OPUS_MODEL_DESCRIPTION:process.env.ANTHROPIC_DEFAULT_OPUS_MODEL_DESCRIPTION;return{value:`opus`,label:r??n,description:i??`Custom Opus model${e?` (1M context)`:``}`,descriptionForModel:`${i??`Custom Opus model${e?` with 1M context`:``}`} (${n})`}}}function z(e=!1){return{value:x()===`firstParty`?`opus`:m().opus47,label:`Opus 4.7`,description:`Opus 4.7 · Most capable for complex work${T(e)}`,descriptionForModel:`Opus 4.7 - most capable for complex work`}}function B(){let e=x()!==`firstParty`;return{value:e?m().sonnet46+`[1m]`:`sonnet[1m]`,label:`Sonnet (1M context)`,description:`Sonnet 4.6 for long sessions${e?``:` · ${f(y)}`}`,descriptionForModel:`Sonnet 4.6 with 1M context window - for long sessions with large codebases`}}function V(e=!1){return{value:x()===`firstParty`?`opus[1m]`:m().opus47+`[1m]`,label:`Opus 4.7 (1M context)`,description:`Opus 4.7 with 1M context${T(e)}`,descriptionForModel:`Opus 4.7 with 1M context window - for long sessions with large codebases`}}function H(e=!1){return{value:m().opus46+`[1m]`,label:`Opus 4.6 (1M context)`,description:`Opus 4.6 with 1M context${T(e)}`,descriptionForModel:`Opus 4.6 with 1M context window - for long sessions with large codebases`}}function U(){let e=x()!==`firstParty`,t=x(),n=t===`openai`?process.env.OPENAI_DEFAULT_HAIKU_MODEL:t===`gemini`?process.env.GEMINI_DEFAULT_HAIKU_MODEL:process.env.ANTHROPIC_DEFAULT_HAIKU_MODEL;if(e&&n){let e=t===`openai`?process.env.OPENAI_DEFAULT_HAIKU_MODEL_NAME:t===`gemini`?process.env.GEMINI_DEFAULT_HAIKU_MODEL_NAME:process.env.ANTHROPIC_DEFAULT_HAIKU_MODEL_NAME,r=t===`openai`?process.env.OPENAI_DEFAULT_HAIKU_MODEL_DESCRIPTION:t===`gemini`?process.env.GEMINI_DEFAULT_HAIKU_MODEL_DESCRIPTION:process.env.ANTHROPIC_DEFAULT_HAIKU_MODEL_DESCRIPTION;return{value:`haiku`,label:e??n,description:r??`Custom Haiku model`,descriptionForModel:`${r??`Custom Haiku model`} (${n})`}}}function W(){return{value:`haiku`,label:`Haiku`,description:`Haiku 4.5 · Fastest for quick answers${x()===`firstParty`?` · ${f(h)}`:``}`,descriptionForModel:`Haiku 4.5 - fastest for quick answers. Lower cost but less capable than Sonnet 4.6.`}}function G(){return{value:`haiku`,label:`Haiku`,description:`Haiku 3.5 for simple tasks${x()===`firstParty`?` · ${f(ne)}`:``}`,descriptionForModel:`Haiku 3.5 - faster and lower cost, but less capable than Sonnet. Use for simple tasks.`}}function K(){return b()===m().haiku45?W():G()}function q(e=!1){return{value:`opus`,label:`Opus 4.7`,description:`Opus 4.7 · Most capable for complex work${e?T(!0):``}`}}function J(){let e=x()!==`firstParty`;return{value:`sonnet[1m]`,label:`Sonnet (1M context)`,description:`Sonnet 4.6 with 1M context${d()?` · Billed as extra usage`:``}${e?``:` · ${f(y)}`}`}}function ce(e=!1){return{value:`opus[1m]`,label:`Opus 4.7 (1M context)`,description:`Opus 4.7 with 1M context${d()?` · Billed as extra usage`:``}${T(e)}`}}function Y(e=!1){let t=x()!==`firstParty`;return{value:t?m().opus47+`[1m]`:`opus[1m]`,label:`Opus 4.7 (1M context)`,description:`Opus 4.7 with 1M context · Most capable for complex work${!t&&e?T(e):``}`,descriptionForModel:`Opus 4.7 with 1M context - most capable for complex work`}}function le(){return{value:`opusplan`,label:`Opus Plan Mode`,description:`Use Opus 4.7 in plan mode, Sonnet 4.6 otherwise`}}function ue(){return[{value:null,label:`Default (recommended)`,description:`Use the default ChatGPT Codex model (currently ${v})`,descriptionForModel:`Default ChatGPT Codex model (currently ${v})`},...k.map(e=>({value:e.value,label:e.label,description:e.description,descriptionForModel:`${e.description} (${e.value})`}))]}function de(e=!1){if(x()===`openai`&&O())return ue();if(d()){if(ie()||w()){let t=[I(e)];return t.push(H(e)),t.push(Q),r()&&t.push(J()),t.push($),t}let t=[I(e)];return S()?t.push(Y(e)):(t.push(q(e)),n()&&t.push(ce(e))),t.push(H(e)),r()&&t.push(J()),t.push($),t}if(x()===`firstParty`){let t=[I(e)];return S()?t.push(Y(e)):(t.push(z(e)),n()&&t.push(V(e))),t.push(H(e)),r()&&t.push(B()),t.push(W()),t}let t=[I(e)],i=L();i===void 0?(t.push(R()),r()&&t.push(B())):t.push(i);let a=se();a===void 0?(t.push(V(e)),t.push(H(e))):t.push(a);let o=U();return o===void 0?t.push(K()):t.push(o),t}function fe(e){let t=M(e);if(t.includes(`claude-sonnet-4-6`)||t.includes(`claude-sonnet-4-5`)||t.includes(`claude-sonnet-4-`)||t.includes(`claude-3-7-sonnet`)||t.includes(`claude-3-5-sonnet`)){let e=C(A());if(e)return{alias:`Sonnet`,currentVersionName:e}}if(t.includes(`claude-opus-4`)){let e=C(oe());if(e)return{alias:`Opus`,currentVersionName:e}}if(t.includes(`claude-haiku`)||t.includes(`claude-3-5-haiku`)){let e=C(b());if(e)return{alias:`Haiku`,currentVersionName:e}}return null}function X(e){let t=C(e);if(!t)return null;let n=fe(e);return n?t===n.currentVersionName?{value:e,label:t,description:e}:{value:e,label:t,description:`Newer version available · select ${n.alias} for ${n.currentVersionName}`}:{value:e,label:t,description:e}}function pe(e=!1){let t=de(e),n=process.env.ANTHROPIC_CUSTOM_MODEL_OPTION;n&&!t.some(e=>e.value===n)&&t.push({value:n,label:process.env.ANTHROPIC_CUSTOM_MODEL_OPTION_NAME??n,description:process.env.ANTHROPIC_CUSTOM_MODEL_OPTION_DESCRIPTION??`Custom model (${n})`});for(let e of ee().additionalModelOptionsCache??[])t.some(t=>t.value===e.value)||t.push(e);let r=null,a=E(),o=i();if(a==null?o!==null&&(r=o):r=a,r===null||t.some(e=>e.value===r))return Z(t);if(r===`opusplan`)return Z([...t,le()]);if(r===`opus`&&x()===`firstParty`)return Z([...t,q(e)]);if(r===`opus[1m]`&&x()===`firstParty`)return Z([...t,Y(e)]);{let e=X(r);return e?t.push(e):t.push({value:r,label:r,description:`Custom model`}),Z(t)}}function Z(e){return(o()||{}).availableModels?e.filter(e=>e.value===null||e.value!==null&&_(e.value)):e}var Q,$,me=e((()=>{a(),l(),j(),re(),s(),t(),P(),g(),ae(),p(),te(),c(),Q={value:`sonnet`,label:`Sonnet`,description:`Sonnet 4.6 · Best for everyday tasks`},$={value:`haiku`,label:`Haiku`,description:`Haiku 4.5 · Fastest for quick answers`}}));export{me as n,pe as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{l as t,o as n}from"./envUtils-BDhHQY0-.js";import{n as r,t as i}from"./axios-DaWTGg7G.js";import{F as a,I as o,S as s,V as c,W as l,a as u,d,l as f,nt as p,p as ee,rt as te,z as ne}from"./debug-BdqxZ7rV.js";import{Gt as re,Jt as ie}from"./settings-Xbq6AaD-.js";import{C as m,S as ae,c as oe,h as se,x as ce,y as le}from"./config-D4G8_MqJ.js";import{n as h,r as g}from"./execFileNoThrow-5SylUnAI.js";import{o as ue,s as _}from"./log-CTFl4qpD.js";import{n as de,r as v}from"./analytics-DJobLaWP.js";import{_n as y,vn as b}from"./model-C2e73CJD.js";import{B as fe,R as pe,z as me}from"./sessionState-BvECKycx.js";import{ft as he,ut as ge}from"./esm-DcIr7tVd.js";import{C as _e,S as ve,_ as ye,a as x,b as be,c as xe,d as Se,g as Ce,h as we,i as Te,l as Ee,n as De,o as S,p as Oe,s as ke,t as Ae,v as je,x as Me,y as Ne}from"./pidLock-BR5M6RQw.js";import{a as Pe,i as Fe,n as Ie,r as Le,t as Re}from"./xdg-DcF9ejUM.js";import{homedir as ze}from"os";import{basename as Be,delimiter as Ve,dirname as C,join as w,resolve as T}from"path";import{constants as He}from"fs";import{createHash as Ue}from"crypto";import{access as E,chmod as D,copyFile as O,mkdir as k,readdir as A,readlink as j,rename as M,rm as N,rmdir as We,stat as P,symlink as Ge,unlink as F,writeFile as I}from"fs/promises";async function Ke(e=`latest`,t,n){let i=Date.now();try{let a=await r.get(`${t}/${e}`,{timeout:3e4,responseType:`text`,...n});return v(`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),v(`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 _(c),c}}async function qe(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 Ke(t,L)}function Je(){return Number(process.env.CLAUDE_CODE_STALL_TIMEOUT_MS_FOR_TESTING)||R}async function Ye(e,t,n,i={}){let a;for(let o=1;o<=3;o++){let s=new AbortController,c,u=()=>{c&&(clearTimeout(c),c=void 0)},d=()=>{u(),c=setTimeout(e=>e.abort(),Je(),s)};try{d();let a=await r.get(e,{timeout:5*6e4,responseType:`arraybuffer`,signal:s.signal,onDownloadProgress:()=>{d()},...i});u();let o=Ue(`sha256`);o.update(a.data);let c=o.digest(`hex`);if(c!==t)throw Error(`Checksum mismatch: expected ${t}, got ${c}`);await I(n,Buffer.from(a.data)),await D(n,493);return}catch(e){u();let t=r.isCancel(e);if(a=t?new z:l(e),t&&o<3){f(`Download stalled on attempt ${o}/3, retrying...`),await b(1e3);continue}throw a}}throw a??Error(`Download failed after all retries`)}async function Xe(e,t,n,i){let a=d();await a.rm(t,{recursive:!0,force:!0});let o=B(),s=Date.now();v(`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),v(`tengu_binary_manifest_fetch_failure`,{latency_ms:i,http_status:o,is_timeout:a.includes(`timeout`)}),_(Error(`Failed to fetch manifest from ${n}/${e}/manifest.json: ${a}`)),t}let l=c.platforms[o];if(!l)throw v(`tengu_binary_platform_not_found`,{}),Error(`Platform ${o} not found in manifest for version ${e}`);let u=l.checksum,f=V(o),p=`${n}/${e}/${o}/${f}`;await a.mkdir(t);let ee=w(t,f);try{await Ye(p,u,ee,i||{}),v(`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),v(`tengu_binary_download_failure`,{latency_ms:t,http_status:i,is_timeout:n.includes(`timeout`),is_checksum_mismatch:n.includes(`Checksum mismatch`)}),_(Error(`Failed to download binary from ${p}: ${n}`)),e}}async function Ze(e,t){return await Xe(e,t,L),`binary`}var L,R,z,Qe=e((()=>{i(),de(),u(),ne(),g(),ee(),ue(),y(),s(),$(),L=`https://storage.googleapis.com/claude-code-dist-86c565f3-f756-42ad-8dfa-d59b1c096819/claude-code-releases`,R=6e4,z=class extends Error{constructor(){super(`Download stalled: no data received for 60 seconds`),this.name=`StallTimeoutError`}}}));function B(){let e=re.platform,t=process.arch===`x64`?`x64`:process.arch===`arm64`?`arm64`:null;if(!t){let e=Error(`Unsupported architecture: ${process.arch}`);throw f(`Native installer does not support architecture: ${process.arch}`,{level:`error`}),e}return e===`linux`&&ge.isMuslEnvironment()?`linux-${t}-musl`:`${e}-${t}`}function V(e){return e.startsWith(`win32`)?`claude.exe`:`claude`}function H(){let e=V(B());return{versions:w(Le(),`claude`,`versions`),staging:w(Ie(),`claude`,`staging`),locks:w(Fe(),`claude`,`locks`),executable:w(Re(),e)}}async function U(e){try{let t=await P(e);return!t.isFile()||t.size===0?!1:(await E(e,He.X_OK),!0)}catch{return!1}}async function W(e){let t=H(),n=[t.versions,t.staging,t.locks];await Promise.all(n.map(e=>k(e,{recursive:!0}))),await k(C(t.executable),{recursive:!0});let r=w(t.versions,e);try{await P(r)}catch{await I(r,``,{encoding:`utf8`})}return{stagingPath:w(t.staging,e),installPath:r}}async function G(e,t,n=0){let r=H(),i=Y(r,e);if(await k(r.locks,{recursive:!0}),S()){let r=0,a=n+1,o=n>0?1e3:100,s=n>0?5e3:500;for(;r<a;){if(await xe(e,i,async()=>{try{await t()}catch(e){throw _(e),e}}))return v(`tengu_version_lock_acquired`,{is_pid_based:!0,is_lifetime_lock:!1,attempts:r+1}),!0;r++,r<a&&await b(Math.min(o*2**(r-1),s))}return v(`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 m(e,{stale:Z,retries:{retries:n,minTimeout:n>0?1e3:100,maxTimeout:n>0?5e3:500},lockfilePath:i,onCompromised:e=>{f(`NON-FATAL: Version lock was compromised during operation: ${e.message}`,{level:`info`})}})}catch(t){return v(`tengu_version_lock_failed`,{is_pid_based:!1,is_lifetime_lock:!1}),X(e,t),!1}try{return await t(),v(`tengu_version_lock_acquired`,{is_pid_based:!1,is_lifetime_lock:!1}),!0}catch(e){throw _(e),e}}finally{a&&await a()}}async function K(e,t){await k(C(t),{recursive:!0});let n=`${t}.tmp.${process.pid}.${Date.now()}`;try{await O(e,n),await D(n,493),await M(n,t),f(`Atomically installed binary to ${t}`)}catch(e){try{await F(n)}catch{}throw e}}async function $e(e,t){try{let n=w(e,`node_modules`,`@anthropic-ai`),r=(await A(n)).find(e=>e.startsWith(`claude-cli-native-`));if(!r)throw v(`tengu_native_install_package_failure`,{stage_find_package:!0,error_package_not_found:!0}),Error(`Could not find platform-specific native package`);let i=w(n,r,`cli`);try{await P(i)}catch{throw v(`tengu_native_install_package_failure`,{stage_binary_exists:!0,error_binary_not_found:!0}),Error(`Native binary not found in staged package`)}await K(i,t),await N(e,{recursive:!0,force:!0}),v(`tengu_native_install_package_success`,{})}catch(e){let t=a(e);throw!t.includes(`Could not find platform-specific`)&&!t.includes(`Native binary not found`)&&v(`tengu_native_install_package_failure`,{stage_atomic_move:!0,error_move_failed:!0}),_(l(e)),e}}async function et(e,t){try{let n=w(e,V(B()));try{await P(n)}catch{throw v(`tengu_native_install_binary_failure`,{stage_binary_exists:!0,error_binary_not_found:!0}),Error(`Staged binary not found`)}await K(n,t),await N(e,{recursive:!0,force:!0}),v(`tengu_native_install_binary_success`,{})}catch(e){throw a(e).includes(`Staged binary not found`)||v(`tengu_native_install_binary_failure`,{stage_atomic_move:!0,error_move_failed:!0}),_(l(e)),e}}async function tt(e,t,n){n===`npm`?await $e(e,t):await et(e,t)}async function q(e,n){let{stagingPath:r,installPath:i}=await W(e),{executable:a}=H(),o=t(process.env.ENABLE_LOCKLESS_UPDATES)?`${r}.${process.pid}.${Date.now()}`:r,s=!await J(e)||n;if(s?(f(n?`Force reinstalling native installer version ${e}`:`Downloading native installer version ${e}`),await tt(o,i,await Ze(e,o))):f(`Version ${e} already installed, updating symlink`),await rt(a),await it(a,i),!await U(a)){let e=!1;try{await P(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 J(e){let{installPath:t}=await W(e);return U(t)}async function nt(e,n=!1){let r=Date.now(),i=await qe(e),{executable:a}=H();if(f(`Checking for native installer update to version ${i}`),!n){let e=await Oe();if(e&&pe(i,e)){if(f(`Native installer: maxVersion ${e} is set, capping update from ${i} to ${e}`),me(`0.0.9`,e))return f(`Native installer: current version 0.0.9 is already at or above maxVersion ${e}, skipping update`),v(`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.9`&&await J(i)&&await U(a))return f(`Found ${i} at ${a}, skipping install`),v(`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&&Ce(i))return v(`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 q(i,n),s=Date.now()-r;else{let{installPath:e}=await W(i);n&&await ut(e);let t=await G(e,async()=>{o=await q(i,n)},3);if(s=Date.now()-r,!t){let t=H(),n;if(S()){let r=Y(t,e);x(r)&&(n=ke(r)?.pid)}return v(`tengu_native_update_lock_failed`,{latency_ms:s,lock_holder_pid:n}),{success:!1,latestVersion:i,lockFailed:!0,lockHolderPid:n}}}return v(`tengu_native_update_complete`,{latency_ms:s,was_new_install:o,was_force_reinstall:n}),f(`Successfully updated to version ${i}`),{success:!0,latestVersion:i}}async function rt(e){try{await We(e),f(`Removed empty directory at ${e}`)}catch(t){let n=o(t);n!==`ENOTDIR`&&n!==`ENOENT`&&n!==`ENOTEMPTY`&&f(`Could not remove directory at ${e}: ${t}`)}}async function it(e,t){if(B().startsWith(`win32`))try{await k(C(e),{recursive:!0});let n;try{n=await P(e)}catch{}if(n){try{let e=await P(t);if(n.size===e.size)return!1}catch{}let r=`${e}.old.${Date.now()}`;await M(e,r);try{await O(t,e);try{await F(r)}catch{}}catch(t){try{await M(r,e)}catch(e){let n=Error(`Failed to restore old executable: ${e}`,{cause:t});throw _(n),n}throw t}}else try{await O(t,e)}catch(e){throw c(e)?Error(`Source file does not exist: ${t}`):e}return!0}catch(n){return _(Error(`Failed to copy executable from ${t} to ${e}: ${n}`)),!1}let n=C(e);try{await k(n,{recursive:!0}),f(`Created directory ${n} for symlink`)}catch(e){return _(Error(`Failed to create directory ${n}: ${e}`)),!1}try{let n=!1;try{await P(e),n=!0}catch{}if(n){try{let n=await j(e);if(T(C(e),n)===T(t))return!1}catch{}await F(e)}}catch(e){_(Error(`Failed to check/remove existing symlink: ${e}`))}let r=`${e}.tmp.${process.pid}.${Date.now()}`;try{return await Ge(t,r),await M(r,e),f(`Atomically updated symlink ${e} -> ${t}`),!0}catch(n){try{await F(r)}catch{}return _(Error(`Failed to create symlink from ${e} to ${t}: ${n}`)),!1}}async function at(e=!1){if(t(process.env.DISABLE_INSTALLATION_CHECKS))return[];let n=await Ee();if(n===`development`||!(e||n===`native`))return[];let r=H(),i=[],a=C(r.executable),o=T(a),s=B().startsWith(`win32`);try{await E(a)}catch{i.push({message:`installMethod is native, but directory ${a} does not exist`,userActionRequired:!0,type:`error`})}if(s)await U(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 j(r.executable);await U(T(C(r.executable),e))||i.push({message:`Claude symlink points to missing or invalid binary: ${e}`,userActionRequired:!0,type:`error`})}catch(e){c(e)?i.push({message:`installMethod is native, but claude command not found at ${r.executable}`,userActionRequired:!0,type:`error`}):await U(r.executable)||i.push({message:`${r.executable} exists but is not a valid Claude binary`,userActionRequired:!0,type:`error`})}if(!(process.env.PATH||``).split(Ve).some(e=>{try{let t=T(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=ve(),t=je()[e],n=t?t.replace(ze(),`~`):`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 ot(e,t=!1){if(t)return st(e,t);if(Q)return f(`installLatest: joining in-flight call`),Q;let n=st(e,t);Q=n;let r=()=>{Q=null};return n.then(r,r),n}async function st(e,t=!1){let n=await nt(e,t);return n.success?(oe().installMethod!==`native`&&(le(e=>({...e,installMethod:`native`,autoUpdates:!1,autoUpdatesProtectedForNative:!0})),f(`Native installer: Set installMethod to "native" and disabled legacy auto-updater for protection`)),dt(),{latestVersion:n.latestVersion,wasUpdated:n.success,lockFailed:!1}):{latestVersion:null,wasUpdated:!1,lockFailed:n.lockFailed,lockHolderPid:n.lockHolderPid}}async function ct(e){try{let t=await j(e),n=T(C(e),t);if(await U(n))return n}catch{}return null}function Y(e,t){let n=Be(t);return w(e.locks,`${n}.lock`)}async function lt(){let e=H();if(!process.execPath.includes(e.versions))return;let t=T(process.execPath);try{let n=Y(e,t);if(await k(e.locks,{recursive:!0}),S()){if(!await Ae(t,n)){v(`tengu_version_lock_failed`,{is_pid_based:!0,is_lifetime_lock:!0}),X(t,Error(`Lock already held by another process`));return}v(`tengu_version_lock_acquired`,{is_pid_based:!0,is_lifetime_lock:!0}),f(`Acquired PID lock on running version: ${t}`)}else{let e;try{e=await m(t,{stale:Z,retries:0,lockfilePath:n,onCompromised:e=>{f(`NON-FATAL: Lock on running version was compromised: ${e.message}`,{level:`info`})}}),v(`tengu_version_lock_acquired`,{is_pid_based:!1,is_lifetime_lock:!0}),f(`Acquired mtime-based lock on running version: ${t}`),te(async()=>{try{await e?.()}catch{}})}catch(e){if(c(e)){f(`Cannot lock current version - file does not exist: ${t}`,{level:`info`});return}v(`tengu_version_lock_failed`,{is_pid_based:!1,is_lifetime_lock:!0}),X(t,e);return}}}catch(e){if(c(e)){f(`Cannot lock current version - file does not exist: ${t}`,{level:`info`});return}f(`NON-FATAL: Failed to lock current version during execution ${a(e)}`,{level:`info`})}}function X(e,t){_(Error(`NON-FATAL: Lock acquisition failed for ${e} (expected in multi-process scenarios)`,{cause:t}))}async function ut(e){let t=Y(H(),e);try{await F(t),f(`Force-removed lock file at ${t}`)}catch(e){f(`Failed to force-remove lock file: ${a(e)}`)}}async function dt(){await Promise.resolve();let e=H(),t=Date.now()-36e5;if(B().startsWith(`win32`)){let t=C(e.executable);try{let e=await A(t),n=0;for(let r of e)if(/^claude\.exe\.old\.\d+$/.test(r))try{await F(w(t,r)),n++}catch{}n>0&&f(`Cleaned up ${n} old Windows executables on startup`)}catch(e){c(e)||f(`Failed to clean up old Windows executables: ${e}`)}}try{let n=await A(e.staging),r=0;for(let i of n){let n=w(e.staging,i);try{(await P(n)).mtime.getTime()<t&&(await N(n,{recursive:!0,force:!0}),r++,f(`Cleaned up old staging directory: ${i}`))}catch{}}r>0&&(f(`Cleaned up ${r} orphaned staging directories`),v(`tengu_native_staging_cleanup`,{cleaned_count:r}))}catch(e){c(e)||f(`Failed to clean up staging directories: ${e}`)}if(S()){let t=De(e.locks);t>0&&(f(`Cleaned up ${t} stale version locks`),v(`tengu_native_stale_locks_cleanup`,{cleaned_count:t}))}let n;try{n=await A(e.versions)}catch(e){c(e)||f(`Failed to readdir versions directory: ${e}`);return}let r=[],i=0;for(let a of n){let n=w(e.versions,a);if(/\.tmp\.\d+\.\d+$/.test(a)){try{(await P(n)).mtime.getTime()<t&&(await F(n),i++,f(`Cleaned up orphaned temp install file: ${a}`))}catch{}continue}try{let e=await P(n);if(!e.isFile()||process.platform!==`win32`&&e.size>0&&!(e.mode&73))continue;r.push({name:a,path:n,resolvedPath:T(n),mtime:e.mtime})}catch{}}if(i>0&&(f(`Cleaned up ${i} orphaned temp install files`),v(`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(T(t));let i=await ct(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(S())i=x(r);else try{i=await ce(t.resolvedPath,{stale:Z,lockfilePath:r})}catch{i=!1}i&&(n.add(t.resolvedPath),f(`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){v(`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 G(e.path,async()=>{await F(e.path)})?o++:(s++,f(`Skipping deletion of ${e.name} - locked by another process`))}catch(t){c++,_(Error(`Failed to delete version ${e.name}: ${t}`))}})),v(`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){c(e)||_(Error(`Version cleanup failed: ${e}`))}}async function ft(){let e=[],t=je();for(let[n,r]of Object.entries(t))try{let t=await be(r);if(!t)continue;let{filtered:i,hadAlias:a}=ye(t);a&&(await Me(r,i),e.push({message:`Removed claude alias from ${r}. Run: unalias claude`,userActionRequired:!0,type:`alias`}),f(`Cleaned up claude alias from ${n} config`))}catch(t){_(t),e.push({message:`Failed to clean up ${r}: ${t}`,userActionRequired:!1,type:`error`})}return e}async function pt(e){try{let t=await h(`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 F(e),f(`Manually removed ${t}: ${e}`),!0}catch{return!1}}if(B().startsWith(`win32`)){let e=w(n,`claude.cmd`),t=w(n,`claude.ps1`),a=w(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(w(n,`bin`,`claude`),`bin symlink`)&&(r=!0);return r?(f(`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: ${B().startsWith(`win32`)?w(n,`node_modules`,e):w(n,`lib`,`node_modules`,e)}`}):{success:!1}}catch(e){return f(`Manual removal failed: ${e}`,{level:`error`}),{success:!1,error:`Manual removal failed: ${e}`}}}async function mt(e){let{code:t,stderr:n}=await h(`npm`,[`uninstall`,`-g`,e],{cwd:process.cwd()});if(t===0)return f(`Removed global npm installation of ${e}`),{success:!0};if(n&&!n.includes(`npm ERR! code E404`)){if(n.includes(`npm error code ENOTEMPTY`)){f(`Failed to uninstall global npm package ${e}: ${n}`,{level:`error`}),f(`Attempting manual removal due to ENOTEMPTY error`);let t=await pt(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 f(`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 ht(){let e=[],t=[],n=0,r=await mt(`@anthropic-ai/claude-code`);r.success?(n++,r.warning&&t.push(r.warning)):r.error&&e.push(r.error);let i=w(ze(),`.claude`,`local`);try{await N(i,{recursive:!0}),n++,f(`Removed local installation at ${i}`)}catch(t){c(t)||(e.push(`Failed to remove ${i}: ${t}`),f(`Failed to remove local installation: ${t}`,{level:`error`}))}return{removed:n,errors:e,warnings:t}}var Z,Q,$=e((()=>{de(),we(),p(),se(),u(),Se(),ie(),he(),n(),ne(),g(),_e(),ae(),ue(),fe(),Ne(),y(),Pe(),Qe(),Te(),Z=10080*60*1e3,Q=null})),gt=e((()=>{$()}));export{ft as a,lt as c,dt as i,at as n,$ as o,ht as r,ot as s,gt as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{l as e,u as t}from"./oauth-C9VBDB0Y.js";t();export{e as getOauthConfig};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";function t(){return process.env.CLAUDE_CODE_CUSTOM_OAUTH_URL?`-custom-oauth`:``}function n(){let e=u,t=process.env.CLAUDE_CODE_CUSTOM_OAUTH_URL;if(t){let n=t.replace(/\/$/,``);if(!f.includes(n))throw Error(`CLAUDE_CODE_CUSTOM_OAUTH_URL is not an approved endpoint.`);e={...e,BASE_API_URL:n,CONSOLE_AUTHORIZE_URL:`${n}/oauth/authorize`,CLAUDE_AI_AUTHORIZE_URL:`${n}/oauth/authorize`,CLAUDE_AI_ORIGIN:n,TOKEN_URL:`${n}/v1/oauth/token`,API_KEY_URL:`${n}/api/oauth/claude_cli/create_api_key`,ROLES_URL:`${n}/api/oauth/claude_cli/roles`,CONSOLE_SUCCESS_URL:`${n}/oauth/code/success?app=claude-code`,CLAUDEAI_SUCCESS_URL:`${n}/oauth/code/success?app=claude-code`,MANUAL_REDIRECT_URL:`${n}/oauth/code/callback`,OAUTH_FILE_SUFFIX:`-custom-oauth`}}let n=process.env.CLAUDE_CODE_OAUTH_CLIENT_ID;return n&&(e={...e,CLIENT_ID:n}),e}var r,i,a,o,s,c,l,u,d,f,p=e((()=>{r=`user:inference`,i=`user:profile`,a=`org:create_api_key`,o=`oauth-2025-04-20`,s=[a,i],c=[i,r,`user:sessions:claude_code`,`user:mcp_servers`,`user:file_upload`],l=Array.from(new Set([...s,...c])),u={BASE_API_URL:`https://api.anthropic.com`,CONSOLE_AUTHORIZE_URL:`https://platform.claude.com/oauth/authorize`,CLAUDE_AI_AUTHORIZE_URL:`https://claude.com/cai/oauth/authorize`,CLAUDE_AI_ORIGIN:`https://claude.ai`,TOKEN_URL:`https://platform.claude.com/v1/oauth/token`,API_KEY_URL:`https://api.anthropic.com/api/oauth/claude_cli/create_api_key`,ROLES_URL:`https://api.anthropic.com/api/oauth/claude_cli/roles`,CONSOLE_SUCCESS_URL:`https://platform.claude.com/buy_credits?returnUrl=/oauth/code/success%3Fapp%3Dclaude-code`,CLAUDEAI_SUCCESS_URL:`https://platform.claude.com/oauth/code/success?app=claude-code`,MANUAL_REDIRECT_URL:`https://platform.claude.com/oauth/code/callback`,CLIENT_ID:`9d1c250a-e61b-44d9-88ed-5944d1962f5e`,OAUTH_FILE_SUFFIX:``,MCP_PROXY_URL:`https://mcp-proxy.anthropic.com`,MCP_PROXY_PATH:`/v1/mcp/{server_id}`},d=`https://claude.ai/oauth/claude-code-client-metadata`,f=[`https://beacon.claude-ai.staging.ant.dev`,`https://claude.fedstart.com`,`https://claude-staging.fedstart.com`]}));export{s as a,t as c,i,n as l,r as n,d as o,c as r,o as s,l as t,p as u};
|
|
@@ -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{ME as r,aD as i,iD as a,jE as o,vD as s,yD as c}from"./loadAgentsDir-CKSb56Gp.js";import{Ar as l,Ci as u,Ei as d,Lr as f,Mr as p,Nr as m,Pr as h,Rr as g,Ti as _,jr as v,kr as y,mi as b,pi as x,wi as S}from"./state-Bs5xweDL.js";import{$n as C,Qn as w,Tr as T,Xn as E,Zn as D,er as O,tr as k,wr as A}from"./settings-Xbq6AaD-.js";import{I as j,L as M}from"./config-D4G8_MqJ.js";function N(e){return S(e)||b(e)||!!(P&&e&&e[P])}var P,F=e((()=>{n(),x(),u(),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):_(i,s):r||(i[i.length]=s)}return i}var L=e((()=>{d(),F()}));function R(e){return e!=null&&e.length?I(e,1):[]}var z=e((()=>{L()}));function B(e){return D(C(e,void 0,R),e+``)}var V=e((()=>{z(),w(),E()}));function H(e,t){return t.length<2?e:y(e,o(t,0,-1))}var U=e((()=>{l(),r()}));function W(e,t){t=m(t,e);var n=-1,r=t.length;if(!r)return!0;for(;++n<r;){var a=p(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[p(i(t))]}var G,K=e((()=>{h(),a(),U(),v(),G=Object.prototype.hasOwnProperty}));function q(e){return k(e)?void 0:e}var J=e((()=>{O()})),Y,X,Z,Q,$=e((()=>{g(),c(),K(),h(),T(),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=m(t,e),r||(r=t.length>1),t}),A(e,j(e),n),r&&(n=s(n,Y|X|Z,q));for(var i=t.length;i--;)W(n,t[i]);return n})}));export{Q as n,$ as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Kt as e,Pn as t}from"./state-Bs5xweDL.js";import{W as n,z as r}from"./debug-BdqxZ7rV.js";import{Pt as i,Rt as a,jt as o}from"./settings-Xbq6AaD-.js";import{c as s,h as c,y as l}from"./config-D4G8_MqJ.js";import{o as u,s as d}from"./log-CTFl4qpD.js";import{Bt as f,_t as p,gt as m,vt as h}from"./model-C2e73CJD.js";import{a as g,i as _,n as v}from"./sessionState-BvECKycx.js";import{r as y,t as b}from"./managedEnv-Cl7YbYzf.js";e(),f(),c(),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`;s().showExpandedTodos!==t&&l(e=>({...e,showExpandedTodos:t}))}if(e.verbose!==r.verbose&&s().verbose!==e.verbose){let t=e.verbose;l(e=>({...e,verbose: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};
|