claude-code-best 2.6.10 → 2.6.11
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-DYIf4o0g.js → AddWorkspaceDirectory-CGKtPsTK.js} +1 -1
- package/dist/chunks/{App-Bw4stCcv.js → App-DF28Bpg9.js} +1 -1
- package/dist/chunks/ApproveApiKey-BtiWOryM.js +1 -0
- package/dist/chunks/{ApproveApiKey-CNBKF9de.js → ApproveApiKey-D21kbmQj.js} +1 -1
- package/dist/chunks/{AssistantSessionChooser-DU5OOPwq.js → AssistantSessionChooser-CDfwNVi5.js} +1 -1
- package/dist/chunks/{BackgroundTasksDialog-ChDZ6M4c.js → BackgroundTasksDialog-5RpkAbJz.js} +1 -1
- package/dist/chunks/{BypassPermissionsModeDialog-UOkwRr3W.js → BypassPermissionsModeDialog-BDWFw61G.js} +1 -1
- package/dist/chunks/{ClaudeInChromeOnboarding-6UL2_PCg.js → ClaudeInChromeOnboarding-CpN0yIU_.js} +1 -1
- package/dist/chunks/{ClaudeMdExternalIncludesDialog-DBfmH_dG.js → ClaudeMdExternalIncludesDialog-CWRHpy22.js} +1 -1
- package/dist/chunks/ClaudeMdExternalIncludesDialog-Dje7A0F2.js +1 -0
- package/dist/chunks/ConsoleOAuthFlow-DQf3dmj6.js +1 -0
- package/dist/chunks/{DesktopHandoff-B-ySC5nP.js → DesktopHandoff-CKHLXiwc.js} +1 -1
- package/dist/chunks/{DevChannelsDialog-DZMsKuak.js → DevChannelsDialog-BwMFW7Wt.js} +1 -1
- package/dist/chunks/{DiffDialog-CeYcqIIw.js → DiffDialog-oA1v0BMo.js} +1 -1
- package/dist/chunks/Doctor-ButdpAkf.js +1 -0
- package/dist/chunks/{Doctor-ByQrTdef.js → Doctor-QVMo0fIh.js} +1 -1
- package/dist/chunks/{ExitFlow-gMv13EpM.js → ExitFlow-DJLYN-Bd.js} +1 -1
- package/dist/chunks/{Feedback-CGRlFB5g.js → Feedback-CpfhqIEv.js} +1 -1
- package/dist/chunks/{Grove-CnHyPepC.js → Grove-BugC6ssx.js} +1 -1
- package/dist/chunks/Grove-CmdRVv9F.js +1 -0
- package/dist/chunks/{HybridTransport-CiY6jyhx.js → HybridTransport-PeXWuYfl.js} +1 -1
- package/dist/chunks/{ITermBackend-CG-a4QYW.js → ITermBackend-dcs68DGS.js} +1 -1
- package/dist/chunks/{InvalidConfigDialog-umJZVrz-.js → InvalidConfigDialog-DdB9_Ve0.js} +1 -1
- package/dist/chunks/{InvalidSettingsDialog-C62kuhHc.js → InvalidSettingsDialog-BL8nxwWQ.js} +1 -1
- package/dist/chunks/{MCPConnectionManager-BbGFGZTr.js → MCPConnectionManager-D2eAGUME.js} +1 -1
- package/dist/chunks/{McpParsingWarnings-DW0d9Lsb.js → McpParsingWarnings-BYPXpmte.js} +1 -1
- package/dist/chunks/{MessageSelector-A-814zUi.js → MessageSelector-Bzq8CYAH.js} +1 -1
- package/dist/chunks/{Messages-C4nIAGDL.js → Messages-uRxxAMW-.js} +2 -2
- package/dist/chunks/{Onboarding-BRePz3fJ.js → Onboarding-ByLnHSnW.js} +1 -1
- package/dist/chunks/{OverageCreditUpsell-DEZsyI6y.js → OverageCreditUpsell-CVNfTSKG.js} +1 -1
- package/dist/chunks/{PluginSettings-CuZtXDaS.js → PluginSettings-h9Lj0vW6.js} +1 -1
- package/dist/chunks/{PromptInputFooterSuggestions-BrpVQJVn.js → PromptInputFooterSuggestions-CYWSLCgA.js} +1 -1
- package/dist/chunks/{PromptInputHelpMenu-BlGRpX1Q.js → PromptInputHelpMenu-BsYNhZCw.js} +1 -1
- package/dist/chunks/{QueryEngine-CK9YRTZo.js → QueryEngine-CxP2S3qi.js} +1 -1
- package/dist/chunks/{REPL-D-t0XQx2.js → REPL-CV12-ns7.js} +6 -6
- package/dist/chunks/REPL-h1bwm8ee.js +1 -0
- package/dist/chunks/{RemoteCallout-DvOZQWoG.js → RemoteCallout-WWO84za-.js} +1 -1
- package/dist/chunks/{RemoteSessionManager-BlIA65dM.js → RemoteSessionManager-Dx2skKnM.js} +1 -1
- package/dist/chunks/{ResumeConversation-BTccgPK8.js → ResumeConversation-CagiCg7-.js} +1 -1
- package/dist/chunks/{SSETransport-CIvM80QS.js → SSETransport-BHdzk1HO.js} +1 -1
- package/dist/chunks/SearchExtraToolsTool-BJ2d8mtx.js +1 -0
- package/dist/chunks/SentryErrorBoundary-CYiFofRZ.js +1 -0
- package/dist/chunks/{SentryErrorBoundary-BK2HjzVw.js → SentryErrorBoundary-CmewX8Dv.js} +1 -1
- package/dist/chunks/{Settings-D3Kpcb7q.js → Settings-BcgtW60l.js} +2 -2
- package/dist/chunks/{TeleportProgress-BFlMrsa_.js → TeleportProgress-BmbhZlOg.js} +1 -1
- package/dist/chunks/{TeleportRepoMismatchDialog-BUeyIQCH.js → TeleportRepoMismatchDialog-BAwtgUhR.js} +1 -1
- package/dist/chunks/{TeleportResumeWrapper-CHfeyo9J.js → TeleportResumeWrapper-BlkvOdYn.js} +1 -1
- package/dist/chunks/{ThemePicker-a5n2EKgk.js → ThemePicker-v_3lh136.js} +1 -1
- package/dist/chunks/{TmuxBackend-Ct9v-J78.js → TmuxBackend-B7Nabc5t.js} +1 -1
- package/dist/chunks/{TrustDialog-e1nyM-Fp.js → TrustDialog-CHu5eoeR.js} +1 -1
- package/dist/chunks/{ValidationErrorsList-BHCepjdO.js → ValidationErrorsList-BSMetgqr.js} +1 -1
- package/dist/chunks/{WelcomeV2-BnyziLbm.js → WelcomeV2-DZfBSTu5.js} +1 -1
- package/dist/chunks/{WindowsTerminalBackend-Dw6qjsBu.js → WindowsTerminalBackend-CeSoQ_Nk.js} +1 -1
- package/dist/chunks/{add-dir-CjnY5yfR.js → add-dir-7UeFZkdv.js} +1 -1
- package/dist/chunks/{agentDisplay-Dfx-axK9.js → agentDisplay-DJgsfIlm.js} +1 -1
- package/dist/chunks/{agents-lM-cxA8_.js → agents-DD7gQVZD.js} +1 -1
- package/dist/chunks/{agents-CICHEOOq.js → agents-DK0y9jId.js} +1 -1
- package/dist/chunks/{ant-JgExUpwJ.js → ant-PhgMZT08.js} +1 -1
- package/dist/chunks/api-D4aCzJS-.js +1 -0
- package/dist/chunks/{api-CClu711S.js → api-nHsRf03G.js} +1 -1
- package/dist/chunks/{assistant-Bih7t52W.js → assistant-BJbeizyH.js} +1 -1
- package/dist/chunks/{assistant-D1XefK1z.js → assistant-DO7RAhd3.js} +1 -1
- package/dist/chunks/assistant-Dvx-UrTi.js +1 -0
- package/dist/chunks/auth-Cp7Nt0ik.js +1 -0
- package/dist/chunks/{auth-CU6ArDos.js → auth-DxRiJwZ-.js} +1 -1
- package/dist/chunks/{autoMode-DM9eDMmT.js → autoMode-BswSpjo5.js} +1 -1
- package/dist/chunks/{autonomy-CZCZ9wlx.js → autonomy-CNJQwoAQ.js} +1 -1
- package/dist/chunks/{autonomy-DUfXLZfq.js → autonomy-Lc78acHX.js} +1 -1
- package/dist/chunks/{autonomyPanel-kUZwcjfu.js → autonomyPanel-DxcumRp-.js} +1 -1
- package/dist/chunks/{backgroundHousekeeping-KGRk7QeA.js → backgroundHousekeeping-BkfWgzIP.js} +2 -2
- package/dist/chunks/backgroundHousekeeping-BxBI2KkX.js +1 -0
- package/dist/chunks/{branch-Ac3HXXs2.js → branch-BPsUW1dk.js} +1 -1
- package/dist/chunks/{bridge-Drt-UmFp.js → bridge-DcOGvDbb.js} +2 -2
- package/dist/chunks/{bridgeConfig-GQzZVhuF.js → bridgeConfig-CvKdNJOg.js} +1 -1
- package/dist/chunks/bridgeConfig-Dkn5GGec.js +1 -0
- package/dist/chunks/bridgeEnabled-CjaYKTo5.js +1 -0
- package/dist/chunks/{bridgeEnabled-CDoXbe3S.js → bridgeEnabled-D01faWms.js} +1 -1
- package/dist/chunks/{bridgeMain-B0fLyOLC.js → bridgeMain-Bu2oOX31.js} +6 -6
- package/dist/chunks/bridgeMain-CEpOBx8Z.js +1 -0
- package/dist/chunks/{bridgeMessaging-gRm2WcIE.js → bridgeMessaging-BZMDSZAN.js} +1 -1
- package/dist/chunks/{btw-B2Tq2ewP.js → btw-B8s-X_cm.js} +1 -1
- package/dist/chunks/{buddy-v00QHFZ6.js → buddy-DkB1xU1o.js} +1 -1
- package/dist/chunks/{bypassPermissionsKillswitch-DAr5U3Ep.js → bypassPermissionsKillswitch-B9Qz9zKO.js} +1 -1
- package/dist/chunks/{caches-DHUk9KMo.js → caches-BuSzLvN9.js} +2 -2
- package/dist/chunks/caches-Bvl2jdxF.js +1 -0
- package/dist/chunks/{ccrClient-1Q3C_3_r.js → ccrClient-CMZXfu9P.js} +1 -1
- package/dist/chunks/changeDetector-DTXMv7gH.js +1 -0
- package/dist/chunks/channelNotification-B7s1OoRK.js +1 -0
- package/dist/chunks/{channelNotification-d08DSK9u.js → channelNotification-t6Kgu-vX.js} +1 -1
- package/dist/chunks/{chrome-CKo0_n71.js → chrome-Cvkozg2F.js} +1 -1
- package/dist/chunks/clear-C9pufI6F.js +1 -0
- package/dist/chunks/client-CqJ5gRGj.js +1 -0
- package/dist/chunks/{color-DqtpdhFx.js → color-AYeAYKyq.js} +1 -1
- package/dist/chunks/commands-LcLR5Vgx.js +1 -0
- package/dist/chunks/commitAttribution-BZupnGMc.js +1 -0
- package/dist/chunks/{commitAttribution-BJvmLsVe.js → commitAttribution-CUqUEjsh.js} +1 -1
- package/dist/chunks/{compact-DLYic2Oa.js → compact-BF0-0_qh.js} +1 -1
- package/dist/chunks/{companion-C2CBSYiF.js → companion-Cf_kYtOD.js} +1 -1
- package/dist/chunks/{config-Cht2x9n9.js → config-45GLd-lt.js} +1 -1
- package/dist/chunks/{config-DnWYFpDc.js → config-JGm0O-ZQ.js} +1 -1
- package/dist/chunks/{context-CDz9HqRT.js → context-Bl5VUX5M.js} +1 -1
- package/dist/chunks/context-noninteractive-BtzPsJ8k.js +1 -0
- package/dist/chunks/{context-noninteractive-BUIf4IMX.js → context-noninteractive-DdPFYYO9.js} +1 -1
- package/dist/chunks/{conversation-CLRfdC_V.js → conversation-C3NWyOB3.js} +1 -1
- package/dist/chunks/conversation-oX932vBQ.js +1 -0
- package/dist/chunks/{copy-BgHTb1Z0.js → copy-CbhxPqw4.js} +1 -1
- package/dist/chunks/{createSSHSession-C_mpeqPy.js → createSSHSession-Dq2nMChz.js} +1 -1
- package/dist/chunks/createSession-1ewHG3eq.js +1 -0
- package/dist/chunks/{createSession-kVJBXQlZ.js → createSession-DTHPUie-.js} +1 -1
- package/dist/chunks/{cronJitterConfig-SI7bYvJj.js → cronJitterConfig-IGWCRDrv.js} +1 -1
- package/dist/chunks/{crossProjectResume-BMWSw62A.js → crossProjectResume-WmabPBTO.js} +1 -1
- package/dist/chunks/datadog-Da7KYZNF.js +1 -0
- package/dist/chunks/{datadog-Bd9AgZT-.js → datadog-FKvRNyFi.js} +1 -1
- package/dist/chunks/{desktop-BeUj2fqu.js → desktop-ZASE3YWy.js} +1 -1
- package/dist/chunks/{diff-BzgXDp1o.js → diff-QP-TbxuD.js} +1 -1
- package/dist/chunks/{doctor-HCOexiL5.js → doctor-DVkgmkRb.js} +1 -1
- package/dist/chunks/{effort-BaJU_k2K.js → effort-DbryQCua.js} +1 -1
- package/dist/chunks/{entry-BoXZIfxW.js → entry-D8y42iuM.js} +5 -5
- package/dist/chunks/envLessBridgeConfig-CpW0G4Eh.js +1 -0
- package/dist/chunks/{envLessBridgeConfig-CnR1E53G.js → envLessBridgeConfig-D4bSwf7w.js} +1 -1
- package/dist/chunks/{exit-B-9k0zjK.js → exit-BsNW67F9.js} +1 -1
- package/dist/chunks/{export-p85q3g8t.js → export-C9A9nOA1.js} +1 -1
- package/dist/chunks/{exportRenderer-CUqd8PZM.js → exportRenderer-CyTuZFFF.js} +1 -1
- package/dist/chunks/{extra-usage-pPprHqwq.js → extra-usage-C6s5mXW0.js} +1 -1
- package/dist/chunks/extra-usage-DL2C0_BM.js +1 -0
- package/dist/chunks/{extra-usage-core-B9Fy8_RP.js → extra-usage-core-BFCwz3XM.js} +1 -1
- package/dist/chunks/{extra-usage-noninteractive-B4vaWh0y.js → extra-usage-noninteractive-IHq7s6wm.js} +1 -1
- package/dist/chunks/{extraUsage-CEHCMe7l.js → extraUsage-CIrG_Lbw.js} +1 -1
- package/dist/chunks/extractMemories-CA2eJwHy.js +1 -0
- package/dist/chunks/fast-B01NO2uA.js +1 -0
- package/dist/chunks/{fast-CiSIZ5FI.js → fast-NEKXVZqQ.js} +1 -1
- package/dist/chunks/{feedback-C2QLdCfW.js → feedback-D5iWO16P.js} +1 -1
- package/dist/chunks/{firstPartyEventLogger-CozFbFD9.js → firstPartyEventLogger-Dr3TK3IU.js} +1 -1
- package/dist/chunks/{flushGate-LXr8ynSz.js → flushGate-DygHyqmB.js} +1 -1
- package/dist/chunks/gates-BSpXbh9s.js +1 -0
- package/dist/chunks/{gates-BGfvIJXl.js → gates-Dyz_t5zJ.js} +1 -1
- package/dist/chunks/{gemini-BFBrPtVM.js → gemini-BEmbnRQR.js} +1 -1
- package/dist/chunks/{generateRecap-CLla3Ymz.js → generateRecap-DZiXeYWn.js} +1 -1
- package/dist/chunks/{generateSessionName-DF4I7gr2.js → generateSessionName-EbB2vl9t.js} +1 -1
- package/dist/chunks/{githubRepoPathMapping-C_5RCW_Z.js → githubRepoPathMapping-dky2fPeU.js} +1 -1
- package/dist/chunks/{grok-Dih61WOo.js → grok-BM6ZJ4w2.js} +1 -1
- package/dist/chunks/{growthbook-C39e6Byf.js → growthbook-JD-WW3yV.js} +1 -1
- package/dist/chunks/{heapdump-BRj4tC1y.js → heapdump-8vyFTWly.js} +1 -1
- package/dist/chunks/{help-fH9LNwox.js → help-C2DM0p8U.js} +1 -1
- package/dist/chunks/{hooks-D22Uu3Vs.js → hooks-CMh0a2pT.js} +1 -1
- package/dist/chunks/hooks-QXGwOfWj.js +1 -0
- package/dist/chunks/{hostAdapter-CbXytx4y.js → hostAdapter-CmbGfgNV.js} +1 -1
- package/dist/chunks/{ide-DM5Tw70v.js → ide-Bn8R7397.js} +1 -1
- package/dist/chunks/{inboundAttachments-2QIORKsd.js → inboundAttachments-BweY9sYo.js} +1 -1
- package/dist/chunks/inboundAttachments-N5DKbZSl.js +1 -0
- package/dist/chunks/{initReplBridge-D8sWx97P.js → initReplBridge-3CfmzjJL.js} +1 -1
- package/dist/chunks/{insights-B6ogyLuv.js → insights-NOl_PxhN.js} +1 -1
- package/dist/chunks/{install-DimDiHha.js → install-BoT2GIcz.js} +1 -1
- package/dist/chunks/{install-github-app-CQ7vkhIX.js → install-github-app-SD4PvrTR.js} +1 -1
- package/dist/chunks/{install-slack-app-By9_5YS7.js → install-slack-app-DLQXpOCt.js} +1 -1
- package/dist/chunks/{instrumentation-DbKu2GCL.js → instrumentation-BXJk0mxI.js} +3 -3
- package/dist/chunks/{job-D_DoFtev.js → job-CnlMlm3t.js} +1 -1
- package/dist/chunks/{keybindings-DYRBv1bg.js → keybindings-BjaRqcbD.js} +1 -1
- package/dist/chunks/{lang-CAMxxG9F.js → lang-BI8CzjL6.js} +1 -1
- package/dist/chunks/{language-CoHgN7rh.js → language-CRIdgj2F.js} +1 -1
- package/dist/chunks/language-DmbRGIs8.js +1 -0
- package/dist/chunks/{launchAgentsPlatform-9P8K66ku.js → launchAgentsPlatform-Bg9guiqy.js} +1 -1
- package/dist/chunks/{launchAutofixPr-BbsqqUMA.js → launchAutofixPr-BMfXGXwN.js} +1 -1
- package/dist/chunks/{launchLocalMemory-K55Yo6JM.js → launchLocalMemory-lgnXOi6U.js} +1 -1
- package/dist/chunks/{launchLocalVault-rrd1Q7jP.js → launchLocalVault-C0Oz-lto.js} +1 -1
- package/dist/chunks/{launchMemoryStores-DMZ8GNQj.js → launchMemoryStores-Bw11ruRi.js} +1 -1
- package/dist/chunks/{launchOnboarding-Duz_huXl.js → launchOnboarding-WEW34cnl.js} +1 -1
- package/dist/chunks/{launchSchedule-7VlG_3M6.js → launchSchedule-X0rcM_kM.js} +1 -1
- package/dist/chunks/{launchSkillStore-CcJL8RT0.js → launchSkillStore-DpxSlMCU.js} +1 -1
- package/dist/chunks/{launchTeleport-C8h_4F_L.js → launchTeleport-uOtMsYcI.js} +1 -1
- package/dist/chunks/{launchVault-Bm1EeT2x.js → launchVault-CJyJaPqH.js} +1 -1
- package/dist/chunks/{loadAgentsDir-HZ19tmOZ.js → loadAgentsDir-D-xcJ22-.js} +45 -45
- package/dist/chunks/loadAgentsDir-ILQxk_4G.js +1 -0
- package/dist/chunks/{loadPluginHooks-DoFtrBWf.js → loadPluginHooks-BC1Ea7_D.js} +1 -1
- package/dist/chunks/{localSearch-4cz5ia5a.js → localSearch-B6Ho7Vfj.js} +1 -1
- package/dist/chunks/localSearch-COyJeP9E.js +1 -0
- package/dist/chunks/login-Cf89biEK.js +1 -0
- package/dist/chunks/{login-D6ywctRr.js → login-uOvq1xN_.js} +1 -1
- package/dist/chunks/{logoV2Utils-jaFn88oE.js → logoV2Utils-C2cdcgtp.js} +1 -1
- package/dist/chunks/logout-CEXwTlEX.js +1 -0
- package/dist/chunks/{magicDocs-DHGtJq0K.js → magicDocs-BBjAhGN1.js} +1 -1
- package/dist/chunks/{main-Bv4AvaJk.js → main-DGsAUuG_.js} +15 -15
- package/dist/chunks/{mappers-qcXgNBi5.js → mappers-CO6koWDa.js} +1 -1
- package/dist/chunks/{mcp-iCbCqg7w.js → mcp-BrN_Tbq5.js} +2 -2
- package/dist/chunks/{mcp-BXPg0RPm.js → mcp-CZltNml5.js} +1 -1
- package/dist/chunks/{mcp-yDWIJznG.js → mcp-D6JOqdT8.js} +1 -1
- package/dist/chunks/{mcpServer-Do9XTs2J.js → mcpServer-C-0K3Azg.js} +1 -1
- package/dist/chunks/{mcpServer-DcSto-Od.js → mcpServer-C_aDoLMg.js} +1 -1
- package/dist/chunks/{memory-B0YG4r65.js → memory-BYYOgo4e.js} +1 -1
- package/dist/chunks/model-CHgqwg6N.js +1 -0
- package/dist/chunks/{model-DwVGG0mc.js → model-CrAPXYZA.js} +1 -1
- package/dist/chunks/{onChangeAppState-CHYSALjM.js → onChangeAppState-C6ZIU1SD.js} +1 -1
- package/dist/chunks/{openai-Brj68CWD.js → openai-Cm4gozk8.js} +1 -1
- package/dist/chunks/{overageCreditGrant-D5X6-TcP.js → overageCreditGrant-Pe7C_4Qi.js} +1 -1
- package/dist/chunks/{passes-B1f6NHWA.js → passes-BpI6azLG.js} +1 -1
- package/dist/chunks/{paths-D8Fx3kUi.js → paths-D9CVAtXU.js} +2 -2
- package/dist/chunks/{permissions-CYrv_WVH.js → permissions-C7wcAYOc.js} +1 -1
- package/dist/chunks/{pipeTransport-DAYnzvGK.js → pipeTransport-wjeyTgon.js} +1 -1
- package/dist/chunks/{plan-B7EPetF0.js → plan-DA8IRpHQ.js} +1 -1
- package/dist/chunks/{plugin-BRWx-_ZS.js → plugin-N2pTkzOz.js} +1 -1
- package/dist/chunks/{pluginAutoupdate-BwxAsU2F.js → pluginAutoupdate-DCc5qDvo.js} +1 -1
- package/dist/chunks/{pluginBlocklist-BiRgxFei.js → pluginBlocklist-C_Veew3p.js} +1 -1
- package/dist/chunks/{pluginCliCommands-CXANH43C.js → pluginCliCommands-BN7loc5T.js} +1 -1
- package/dist/chunks/{pluginFlagging-CBbUoCJ9.js → pluginFlagging-Dpu1cvMo.js} +1 -1
- package/dist/chunks/{pluginOperations-B3gcFjVq.js → pluginOperations-CP6NFNog.js} +1 -1
- package/dist/chunks/pluginStartupCheck-BF0xUEJG.js +1 -0
- package/dist/chunks/{pluginStartupCheck-BNfv-Pf4.js → pluginStartupCheck-DvWHwNnD.js} +1 -1
- package/dist/chunks/{plugins-zHTS03v8.js → plugins-BHoniP5f.js} +1 -1
- package/dist/chunks/policyLimits-sh7ywop0.js +1 -0
- package/dist/chunks/{pollConfig-BWY_xmk6.js → pollConfig-xYxAmuXi.js} +1 -1
- package/dist/chunks/{poor-Bcu8JaV5.js → poor-C0KwfFF0.js} +1 -1
- package/dist/chunks/{poorMode-CDhhKGBw.js → poorMode-D7WXWZtJ.js} +1 -1
- package/dist/chunks/poorMode-DZQXZ_zu.js +1 -0
- package/dist/chunks/{print-DO52Fudu.js → print-BcRG8gkQ.js} +4 -4
- package/dist/chunks/{privacy-settings-CmHUlYoo.js → privacy-settings-DT3LGgsH.js} +1 -1
- package/dist/chunks/{processBashCommand-DltW2Ubs.js → processBashCommand-DPfJ9lrj.js} +1 -1
- package/dist/chunks/{processSlashCommand-JLJ_vF05.js → processSlashCommand-DyPCeZux.js} +1 -1
- package/dist/chunks/{prompt-BxoRdmaw.js → prompt-C69iv9cI.js} +1 -1
- package/dist/chunks/prompt-DaIJzI1P.js +1 -0
- package/dist/chunks/prompt-DnLsyywj.js +1 -0
- package/dist/chunks/{promptEditor-LQu9NhbN.js → promptEditor-BZqpLrcZ.js} +1 -1
- package/dist/chunks/{protocolHandler-DYn2E9Yl.js → protocolHandler-CfmBTg36.js} +1 -1
- package/dist/chunks/{rate-limit-options-OQt6LUP8.js → rate-limit-options-P7oQuwrl.js} +1 -1
- package/dist/chunks/{rcDebugLog-5XEbz_Yg.js → rcDebugLog-CTOZ2K3E.js} +1 -1
- package/dist/chunks/{referral-BsAvaATn.js → referral-D26orIXE.js} +1 -1
- package/dist/chunks/{refresh-TlNezXn4.js → refresh-BeSXaVya.js} +1 -1
- package/dist/chunks/{registerProtocol-COUVHFku.js → registerProtocol-DSQh-I21.js} +1 -1
- package/dist/chunks/{registry-m7JojEMY.js → registry-Dp5W2V8B.js} +1 -1
- package/dist/chunks/{release-notes-BDdughgu.js → release-notes-Cg85UVo8.js} +1 -1
- package/dist/chunks/{releaseNotes-Bd3zxid3.js → releaseNotes-Dps4SeVh.js} +2 -2
- package/dist/chunks/{reload-plugins-qUIybHNy.js → reload-plugins-Bo-R1CF3.js} +1 -1
- package/dist/chunks/{remote-env-GGlLNGsx.js → remote-env-ChQuV3rO.js} +1 -1
- package/dist/chunks/{remoteBridgeCore-DpF5alU6.js → remoteBridgeCore-BXtygJA-.js} +1 -1
- package/dist/chunks/{remoteControlServer-C32rxr3F.js → remoteControlServer-sqW_JLwC.js} +1 -1
- package/dist/chunks/{rename-CCF7A5mG.js → rename-Bigaipiq.js} +1 -1
- package/dist/chunks/{resume-C6ereXig.js → resume-CtOI2pOJ.js} +1 -1
- package/dist/chunks/{runtimeObserver-jrNSkZU2.js → runtimeObserver-CJ955XSo.js} +2 -2
- package/dist/chunks/{runtimeObserver-DBdzsp_h.js → runtimeObserver-DojpbVgU.js} +1 -1
- package/dist/chunks/sandbox-adapter-BbrJOJNZ.js +1 -0
- package/dist/chunks/{sandbox-toggle-Bfti5GKF.js → sandbox-toggle-B9dn09gt.js} +1 -1
- package/dist/chunks/searchExtraTools-Denn1c1E.js +1 -0
- package/dist/chunks/{sentry-CZUyEC3A.js → sentry-B6tWUNGj.js} +1 -1
- package/dist/chunks/{session-DCIDa5dI.js → session-C5yIf_zV.js} +1 -1
- package/dist/chunks/{sessionDiscovery-5m_pul65.js → sessionDiscovery-CQ3iMN4s.js} +1 -1
- package/dist/chunks/sessionFileAccessHooks-1IAwziOQ.js +1 -0
- package/dist/chunks/sessionMemory-3TAJyNuJ.js +1 -0
- package/dist/chunks/{sessionMemory-BQP_RezB.js → sessionMemory-HZNzEOLd.js} +1 -1
- package/dist/chunks/sessionMemoryUtils-BAkA4sGG.js +1 -0
- package/dist/chunks/sessionObserver-DqLMFMLM.js +1 -0
- package/dist/chunks/{sessionObserver-LBqNoak9.js → sessionObserver-MQA9_wZw.js} +1 -1
- package/dist/chunks/sessionStorage-CFfMypMQ.js +1 -0
- package/dist/chunks/{sessionTitle-BIykjtKk.js → sessionTitle-BafqFHLc.js} +1 -1
- package/dist/chunks/{sessionTracing-Da_r0mIc.js → sessionTracing-_obALZbi.js} +1 -1
- package/dist/chunks/{settingsSync-BE0PQqyo.js → settingsSync-DBWi-NXU.js} +1 -1
- package/dist/chunks/{setup-CjA5bW6e.js → setup-C_GrS0Rd.js} +1 -1
- package/dist/chunks/{setup-lxzmZdw5.js → setup-D1sQnli9.js} +2 -2
- package/dist/chunks/{setup-p04XtwYu.js → setup-DIxsjw17.js} +1 -1
- package/dist/chunks/{shadowedRuleDetection-Zqp1M5St.js → shadowedRuleDetection-CwMwv9uM.js} +1 -1
- package/dist/chunks/{sideQuestion-DzJenEES.js → sideQuestion-CI5pyoQF.js} +1 -1
- package/dist/chunks/{sink-N5XR8Zgp.js → sink-BSTUubjl.js} +1 -1
- package/dist/chunks/sink-fGBOXJab.js +1 -0
- package/dist/chunks/{sinks-D8erzS9D.js → sinks-B9EsWFeb.js} +2 -2
- package/dist/chunks/sinks-BCl9slVM.js +1 -0
- package/dist/chunks/{skill-learning-CbMQ8IsZ.js → skill-learning-DThetLpo.js} +1 -1
- package/dist/chunks/{skillChangeDetector-4XWLpjQl.js → skillChangeDetector-BOH-fyEn.js} +1 -1
- package/dist/chunks/{skillGapStore-DbiDG9Pd.js → skillGapStore-BmjCK9ZR.js} +2 -2
- package/dist/chunks/{skillGapStore-Bp5IVfOx.js → skillGapStore-ax0GuSmd.js} +1 -1
- package/dist/chunks/{skillGenerator-Bys7U1l_.js → skillGenerator-Dj3xInwG.js} +2 -2
- package/dist/chunks/skillLearning-BDsjN-u-.js +1 -0
- package/dist/chunks/skillLearning-CXUsWxdi.js +1 -0
- package/dist/chunks/{skillPanel-MIHU1PPp.js → skillPanel-CJ4tvX7A.js} +3 -3
- package/dist/chunks/{skillSearchPanel-MFB-PzB1.js → skillSearchPanel-hwZvXKZ4.js} +2 -2
- package/dist/chunks/{skills-D4tZYFpd.js → skills-BVWDDcD9.js} +1 -1
- package/dist/chunks/{sprites-B479AZSz.js → sprites-B-V9otkt.js} +1 -1
- package/dist/chunks/{stats-B-ErfxCJ.js → stats-DcS6ZnsX.js} +1 -1
- package/dist/chunks/{status-DVACJLsK.js → status-DZKjK9CE.js} +1 -1
- package/dist/chunks/{statusNoticeHelpers-CwSCVvxP.js → statusNoticeHelpers-reCcymMR.js} +1 -1
- package/dist/chunks/{tag-YpE2D2ve.js → tag-B5b-waIf.js} +1 -1
- package/dist/chunks/{tasks-7N7iSiEx.js → tasks-vXM-vULI.js} +1 -1
- package/dist/chunks/teamHelpers-BBhol4dD.js +1 -0
- package/dist/chunks/{teamHelpers-BFdTH57t.js → teamHelpers-CbFFdvPw.js} +1 -1
- package/dist/chunks/{teammateModeSnapshot-CwacsQvD.js → teammateModeSnapshot-DkkMv2-b.js} +1 -1
- package/dist/chunks/teammateModeSnapshot-W5G22rwQ.js +1 -0
- package/dist/chunks/{teleport-CPB1CHBs.js → teleport-Da0rKwCo.js} +1 -1
- package/dist/chunks/{templateJobs-BM98KAEH.js → templateJobs-BLQqrGjb.js} +1 -1
- package/dist/chunks/{terminalSetup-yQ0CoywX.js → terminalSetup-BKfVYk3w.js} +1 -1
- package/dist/chunks/{terminalSetup-CGiIwoIX.js → terminalSetup-BLU99dau.js} +1 -1
- package/dist/chunks/{theme-C5ULGNRs.js → theme-BM2CXWYE.js} +1 -1
- package/dist/chunks/{thinkback-CF_sLFvX.js → thinkback-Cd1g_2A9.js} +1 -1
- package/dist/chunks/thinkback-ChP6pvCS.js +1 -0
- package/dist/chunks/{thinkback-play-syg_SJm8.js → thinkback-play-Cg8Ys2dq.js} +1 -1
- package/dist/chunks/{toolEventObserver-CcLqNRcT.js → toolEventObserver-71WYUega.js} +1 -1
- package/dist/chunks/{toolEventObserver-CuJbsUL0.js → toolEventObserver-nxcfjaur.js} +1 -1
- package/dist/chunks/{toolPool-CRq0GSrk.js → toolPool-CN1cPGQz.js} +1 -1
- package/dist/chunks/toolPool-CygNb5cr.js +1 -0
- package/dist/chunks/{trustedDevice-C4tvgByY.js → trustedDevice-Brc9B8cZ.js} +1 -1
- package/dist/chunks/{trustedDevice-u2HpuTkN.js → trustedDevice-C0KJ0qiK.js} +1 -1
- package/dist/chunks/{ultrareviewCommand-CWLiiq-z.js → ultrareviewCommand-BY0T8Pzl.js} +1 -1
- package/dist/chunks/undercover-bx8TwG9W.js +1 -0
- package/dist/chunks/{undercover-CNlN7Xzl.js → undercover-j27F8p49.js} +1 -1
- package/dist/chunks/{updateCCB-BWN4mOEz.js → updateCCB-Dgb2ed9v.js} +1 -1
- package/dist/chunks/upgrade-BkHztwGA.js +1 -0
- package/dist/chunks/{upgrade-CE25mJEk.js → upgrade-zs7K9UkG.js} +1 -1
- package/dist/chunks/{upload-YpyOX2a-.js → upload-Df84yCBz.js} +1 -1
- package/dist/chunks/{usage-Bw-kTwHb.js → usage-DKENFl_k.js} +1 -1
- package/dist/chunks/{usage-DNXwr_ep.js → usage-lTILrQJV.js} +1 -1
- package/dist/chunks/{useMainLoopModel-DPmF_cMn.js → useMainLoopModel-X1PW9z5A.js} +1 -1
- package/dist/chunks/{useManagePlugins-hPG7UMWo.js → useManagePlugins-DDKeDfIv.js} +1 -1
- package/dist/chunks/{useMergedTools-BSO1NflP.js → useMergedTools-CC3XwtOR.js} +1 -1
- package/dist/chunks/{useSearchInput-CR9uhbA7.js → useSearchInput-DNpNG36H.js} +1 -1
- package/dist/chunks/{useSettingsErrors-453j5XuO.js → useSettingsErrors-vGzCYpIA.js} +1 -1
- package/dist/chunks/{useVoice-B5DQ5Tay.js → useVoice-DmObXoAh.js} +1 -1
- package/dist/chunks/{util-D_BHu06u.js → util-9vJ9WIeZ.js} +1 -1
- package/dist/chunks/utils-Dg0S2Vfn.js +1 -0
- package/dist/chunks/{validatePlugin-Dxm-5f8W.js → validatePlugin-_Z4zhjSx.js} +1 -1
- package/dist/chunks/{vim-BGqKMQxl.js → vim-CK7lReJi.js} +1 -1
- package/dist/chunks/{voice-B2MWrkN3.js → voice-BLVF7E3Q.js} +1 -1
- package/dist/chunks/{voiceModeEnabled-if9dV1bW.js → voiceModeEnabled-BpLBjY2-.js} +1 -1
- package/dist/chunks/voiceModeEnabled-BqFYzoXw.js +1 -0
- package/dist/chunks/voiceStreamSTT-C0pkuXGm.js +1 -0
- package/dist/chunks/{voiceStreamSTT-CWhKAxcp.js → voiceStreamSTT-i4tUq3Hu.js} +1 -1
- package/dist/chunks/{workerRegistry-BANOcuS2.js → workerRegistry-Bg7dWLHf.js} +1 -1
- package/dist/chunks/worktree-Cg4p1J__.js +1 -0
- package/dist/chunks/{xml-DZp0WcWT.js → xml-K_hNNh2b.js} +1 -1
- package/dist/cli.js +1 -1
- package/package.json +1 -1
- package/dist/chunks/ApproveApiKey-CBEOrsej.js +0 -1
- package/dist/chunks/ClaudeMdExternalIncludesDialog-CG26Jg7h.js +0 -1
- package/dist/chunks/ConsoleOAuthFlow-1aq67dJV.js +0 -1
- package/dist/chunks/Doctor-DOil8Eh7.js +0 -1
- package/dist/chunks/Grove-CJn8QGFo.js +0 -1
- package/dist/chunks/REPL-DV96-Prr.js +0 -1
- package/dist/chunks/SearchExtraToolsTool-CmyZbRut.js +0 -1
- package/dist/chunks/SentryErrorBoundary-B9sk4zvj.js +0 -1
- package/dist/chunks/api-DgzWK3bh.js +0 -1
- package/dist/chunks/assistant-Ojm6Wsb6.js +0 -1
- package/dist/chunks/auth-lQWhUjLX.js +0 -1
- package/dist/chunks/backgroundHousekeeping-BcLV1-Ap.js +0 -1
- package/dist/chunks/bridgeConfig-ByjfIoJz.js +0 -1
- package/dist/chunks/bridgeEnabled-C7AI9y8g.js +0 -1
- package/dist/chunks/bridgeMain-DKQ1u3k_.js +0 -1
- package/dist/chunks/caches-DbE9R4Zh.js +0 -1
- package/dist/chunks/changeDetector--9sSzU2e.js +0 -1
- package/dist/chunks/channelNotification-CLYOd2-R.js +0 -1
- package/dist/chunks/clear-Cf1D1WkR.js +0 -1
- package/dist/chunks/client-Bzn58Ea4.js +0 -1
- package/dist/chunks/commands-CJz20FMO.js +0 -1
- package/dist/chunks/commitAttribution-BgNel6QS.js +0 -1
- package/dist/chunks/context-noninteractive-CzuLiIeO.js +0 -1
- package/dist/chunks/conversation-D2iFk7Te.js +0 -1
- package/dist/chunks/createSession-XhPMcSns.js +0 -1
- package/dist/chunks/datadog-B5oHSyS1.js +0 -1
- package/dist/chunks/envLessBridgeConfig-DgdkC9jO.js +0 -1
- package/dist/chunks/extra-usage-CsJ9Z2G1.js +0 -1
- package/dist/chunks/extractMemories-D34FfNYT.js +0 -1
- package/dist/chunks/fast-CxPB-PBH.js +0 -1
- package/dist/chunks/gates-D-kXXHiv.js +0 -1
- package/dist/chunks/hooks-Cw-F-1uO.js +0 -1
- package/dist/chunks/inboundAttachments-CZN_sUNx.js +0 -1
- package/dist/chunks/language-DB1HIsF8.js +0 -1
- package/dist/chunks/loadAgentsDir-DsskgPWe.js +0 -1
- package/dist/chunks/localSearch-CScvVw0c.js +0 -1
- package/dist/chunks/login-FdPNsHJs.js +0 -1
- package/dist/chunks/logout-CulTqT7V.js +0 -1
- package/dist/chunks/model-DG0v1297.js +0 -1
- package/dist/chunks/pluginStartupCheck-Ga_XiMnA.js +0 -1
- package/dist/chunks/policyLimits-Dsz-jkpD.js +0 -1
- package/dist/chunks/poorMode-BAuBNURJ.js +0 -1
- package/dist/chunks/prompt-D3rBUscf.js +0 -1
- package/dist/chunks/prompt-ohTcwieE.js +0 -1
- package/dist/chunks/sandbox-adapter-CQ0imVO1.js +0 -1
- package/dist/chunks/searchExtraTools-Ntz1u-YC.js +0 -1
- package/dist/chunks/sessionFileAccessHooks-DD2a-mTZ.js +0 -1
- package/dist/chunks/sessionMemory-hbxplpxs.js +0 -1
- package/dist/chunks/sessionMemoryUtils-DlW9hqOH.js +0 -1
- package/dist/chunks/sessionObserver-Lb1c5FPy.js +0 -1
- package/dist/chunks/sessionStorage-DG68Xvsy.js +0 -1
- package/dist/chunks/sink-BdRlnpoG.js +0 -1
- package/dist/chunks/sinks-Bn0FK_Ab.js +0 -1
- package/dist/chunks/skillLearning-702-D6Lq.js +0 -1
- package/dist/chunks/skillLearning-Cz7qU9V6.js +0 -1
- package/dist/chunks/teamHelpers-CmDn2xyl.js +0 -1
- package/dist/chunks/teammateModeSnapshot-DXtG86pG.js +0 -1
- package/dist/chunks/thinkback-D1Fv1QYl.js +0 -1
- package/dist/chunks/toolPool-C4CO158z.js +0 -1
- package/dist/chunks/undercover-jZEIpxrJ.js +0 -1
- package/dist/chunks/upgrade-C_0-l0Zo.js +0 -1
- package/dist/chunks/utils--ZdihcLH.js +0 -1
- package/dist/chunks/voiceModeEnabled-0NU5pSM-.js +0 -1
- package/dist/chunks/voiceStreamSTT-yvcTWD7i.js +0 -1
- package/dist/chunks/worktree-CRn2SbHn.js +0 -1
|
@@ -32,8 +32,8 @@ Keep messages tight — the decision, the file:line, the PR number. Second perso
|
|
|
32
32
|
`)+`…`}var rg,ig,ag=t((()=>{ce(),rg=2**21,ig=class{constructor(e=rg){_(this,`content`,``),_(this,`isTruncated`,!1),_(this,`totalBytesReceived`,0),this.maxSize=e}append(e){let t=typeof e==`string`?e:e.toString();if(this.totalBytesReceived+=t.length,!(this.isTruncated&&this.content.length>=this.maxSize))if(this.content.length+t.length>this.maxSize){let e=this.maxSize-this.content.length;e>0&&(this.content+=t.slice(0,e)),this.isTruncated=!0}else this.content+=t}toString(){if(!this.isTruncated)return this.content;let e=this.totalBytesReceived-this.maxSize,t=Math.round(e/1024);return this.content+`\n... [output truncated - ${t}KB removed]`}clear(){this.content=``,this.isTruncated=!1,this.totalBytesReceived=0}get length(){return this.content.length}get truncated(){return this.isTruncated}get totalBytes(){return this.totalBytesReceived}}}));function og(e){return lg.filePatternTools.includes(e)}function sg(e){return lg.bashPrefixTools.includes(e)}function cg(e){return lg.customValidation[e]}var lg,ug=t((()=>{lg={filePatternTools:[`Read`,`Write`,`Edit`,`Glob`,`NotebookRead`,`NotebookEdit`],bashPrefixTools:[`Bash`],customValidation:{WebSearch:e=>e.includes(`*`)||e.includes(`?`)?{valid:!1,error:`WebSearch does not support wildcards`,suggestion:`Use exact search terms without * or ?`,examples:[`WebSearch(claude ai)`,`WebSearch(typescript tutorial)`]}:{valid:!0},WebFetch:e=>e.includes(`://`)||e.startsWith(`http`)?{valid:!1,error:`WebFetch permissions use domain format, not URLs`,suggestion:`Use "domain:hostname" format`,examples:[`WebFetch(domain:example.com)`,`WebFetch(domain:github.com)`]}:e.startsWith(`domain:`)?{valid:!0}:{valid:!1,error:`WebFetch permissions must use "domain:" prefix`,suggestion:`Use "domain:hostname" format`,examples:[`WebFetch(domain:example.com)`,`WebFetch(domain:*.google.com)`]}}}}));function dg(e,t){let n=0,r=t-1;for(;r>=0&&e[r]===`\\`;)n++,r--;return n%2!=0}function fg(e,t){let n=0;for(let r=0;r<e.length;r++)e[r]===t&&!dg(e,r)&&n++;return n}function pg(e){for(let t=0;t<e.length-1;t++)if(e[t]===`(`&&e[t+1]===`)`&&!dg(e,t))return!0;return!1}function mg(e,t){if(!e||e.trim()===``)return{valid:!1,error:`Permission rule cannot be empty`};if(fg(e,`(`)!==fg(e,`)`))return{valid:!1,error:`Mismatched parentheses`,suggestion:`Ensure all opening parentheses have matching closing parentheses`};if(pg(e)){let t=e.substring(0,e.indexOf(`(`));return t?{valid:!1,error:`Empty parentheses`,suggestion:`Either specify a pattern or use just "${t}" without parentheses`,examples:[`${t}`,`${t}(some-pattern)`]}:{valid:!1,error:`Empty parentheses with no tool name`,suggestion:`Specify a tool name before the parentheses`}}let n=Vh(e),r=ph(n.toolName);if(r)return n.ruleContent!==void 0||fg(e,`(`)>0?{valid:!1,error:`MCP rules do not support patterns in parentheses`,suggestion:`Use "${n.toolName}" without parentheses, or use "mcp__${r.serverName}__*" for all tools`,examples:[`mcp__${r.serverName}`,`mcp__${r.serverName}__*`,r.toolName&&r.toolName!==`*`?`mcp__${r.serverName}__${r.toolName}`:void 0].filter(Boolean)}:{valid:!0};if(!n.toolName||n.toolName.length===0)return{valid:!1,error:`Tool name cannot be empty`};if(n.toolName[0]!==n.toolName[0]?.toUpperCase())return{valid:!1,error:`Tool names must start with uppercase`,suggestion:`Use "${Yh(String(n.toolName))}"`};let i=cg(n.toolName);if(i&&n.ruleContent!==void 0){let e=i(n.ruleContent);if(!e.valid)return e}if(sg(n.toolName)&&n.ruleContent!==void 0){let e=n.ruleContent;if(e.includes(`:*`)&&!e.endsWith(`:*`))return{valid:!1,error:`The :* pattern must be at the end`,suggestion:`Move :* to the end for prefix matching, or use * for wildcard matching`,examples:[`Bash(npm run:*) - prefix matching (legacy)`,`Bash(npm run *) - wildcard matching`]};if(e===`:*`)return{valid:!1,error:`Prefix cannot be empty before :*`,suggestion:`Specify a command prefix before :*`,examples:[`Bash(npm:*)`,`Bash(git:*)`]}}if(og(n.toolName)&&n.ruleContent!==void 0){let e=n.ruleContent;if(e.includes(`:*`))return{valid:!1,error:`The ":*" syntax is only for Bash prefix rules`,suggestion:`Use glob patterns like "*" or "**" for file matching`,examples:[`${n.toolName}(*.ts) - matches .ts files`,`${n.toolName}(src/**) - matches all files in src`,`${n.toolName}(**/*.test.ts) - matches test files`]};if(e.includes(`*`)&&!e.match(/^\*|\*$|\*\*|\/\*|\*\.|\*\)/)&&!e.includes(`**`))return{valid:!1,error:`Wildcard placement might be incorrect`,suggestion:`Wildcards are typically used at path boundaries`,examples:[`${n.toolName}(*.js) - all .js files`,`${n.toolName}(src/*) - all files directly in src`,`${n.toolName}(src/**) - all files recursively in src`]}}if(n&&n.toolName===`VaultHttpFetch`&&n.ruleContent!==void 0){let e=n.ruleContent;if(e.length>384)return{valid:!1,error:`VaultHttpFetch rule content is too long (${e.length} chars; max 384)`,suggestion:`Use a shorter key name and host, or use the wildcard form <key>@*`};if(/[\x00-\x1F\x7F]/.test(e))return{valid:!1,error:`VaultHttpFetch rule content contains control characters (only printable ASCII allowed in key@host)`,suggestion:`Remove control characters from the rule content`}}if(n&&n.toolName===`VaultHttpFetch`&&t===`deny`&&n.ruleContent!==void 0&&!/^[A-Za-z0-9._-]{1,128}@(?:\*|(?:\[[A-Fa-f0-9:]+\]|[A-Za-z0-9.-]{1,253})(?::(?:[1-9]\d{0,3}|[1-5]\d{4}|6[0-4]\d{3}|65[0-4]\d{2}|655[0-2]\d|6553[0-5]))?)$/.test(n.ruleContent))return{valid:!1,error:`VaultHttpFetch deny rule content must be '<key>@<host>' or '<key>@*' (or whole-tool deny without parentheses for kill switch)`,suggestion:`Found '${n.ruleContent}'. Use 'VaultHttpFetch' (no parens) for kill switch, or 'VaultHttpFetch(${n.ruleContent}@*)' for any-host.`,examples:[`VaultHttpFetch — whole-tool kill switch`,`VaultHttpFetch(${n.ruleContent}@api.github.com)`,`VaultHttpFetch(${n.ruleContent}@*)`]};if(t===`allow`&&n){if(n.ruleContent===void 0&&hg.has(n.toolName))return{valid:!1,error:`Whole-tool allow forbidden for vault tool '${n.toolName}'`,suggestion:`Use per-key + per-host allow: '${n.toolName}(your-key-name@host)'`,examples:[`${n.toolName}(github-token@api.github.com)`,`${n.toolName}(my-api@*) - allow any host (advanced)`]};if(n.toolName===`VaultHttpFetch`&&n.ruleContent!==void 0&&!/^[A-Za-z0-9._-]{1,128}@(?:\*|(?:\[[A-Fa-f0-9:]+\]|[A-Za-z0-9.-]{1,253})(?::(?:[1-9]\d{0,3}|[1-5]\d{4}|6[0-4]\d{3}|65[0-4]\d{2}|655[0-2]\d|6553[0-5]))?)$/.test(n.ruleContent))return{valid:!1,error:`VaultHttpFetch rule content must be '<key>@<host>' or '<key>@*'`,suggestion:`Found '${n.ruleContent}'. Use e.g. 'github-token@api.github.com' or 'admin-key@127.0.0.1:8443' to bind a key to a host.`,examples:[`VaultHttpFetch(github-token@api.github.com)`,`VaultHttpFetch(local-admin@localhost:8443)`,`VaultHttpFetch(stripe-key@*) - any host (advanced)`]}}return{valid:!0}}var hg,gg,_g=t((()=>{Je(),yh(),Ei(),qh(),ag(),ug(),hg=new Set([`LocalVaultFetch`,`VaultHttpFetch`]),gg=L(()=>b().superRefine((e,t)=>{let n=mg(e);if(!n.valid){let r=n.error;n.suggestion&&(r+=`. ${n.suggestion}`),n.examples&&n.examples.length>0&&(r+=`. Examples: ${n.examples.join(`, `)}`),t.addIssue({code:qe.custom,message:r,params:{received:e}})}}))}));function vg(e){return`serverName`in e&&e.serverName!==void 0}function yg(e){return`serverCommand`in e&&e.serverCommand!==void 0}function bg(e){return`serverUrl`in e&&e.serverUrl!==void 0}var xg,Sg,Cg,wg,Tg,Eg,Dg,Og=t((()=>{Je(),zp(),h(),Ei(),nm(),fh(),Ap(),_g(),pm(),Ci(),xg=L(()=>x(b(),Ge())),Sg=L(()=>D({allow:S(gg()).optional().describe(`List of permission rules for allowed operations`),deny:S(gg()).optional().describe(`List of permission rules for denied operations`),ask:S(gg()).optional().describe(`List of permission rules that should always prompt for confirmation`),defaultMode:E(Oi).optional().describe(`Default permission mode when Claude Code needs access`),disableBypassPermissionsMode:E([`disable`]).optional().describe(`Disable the ability to bypass permission prompts`),disableAutoMode:E([`disable`]).optional().describe(`Disable auto mode`),additionalDirectories:S(b()).optional().describe(`Additional directories to include in the permission scope`)}).passthrough()),Cg=L(()=>D({source:Xm().describe(`Where to fetch the marketplace from`),installLocation:b().optional().describe(`Local cache path where marketplace manifest is stored (auto-generated if not provided)`),autoUpdate:w().optional().describe(`Whether to automatically update this marketplace and its installed plugins on startup`)})),wg=L(()=>D({serverName:b().regex(/^[a-zA-Z0-9_-]+$/,`Server name can only contain letters, numbers, hyphens, and underscores`).optional().describe(`Name of the MCP server that users are allowed to configure`),serverCommand:S(b()).min(1,`Server command must have at least one element (the command)`).optional().describe(`Command array [command, ...args] to match exactly for allowed stdio servers`),serverUrl:b().optional().describe(`URL pattern with wildcard support (e.g., "https://*.example.com/*") for allowed remote MCP servers`)}).refine(e=>vi([e.serverName!==void 0,e.serverCommand!==void 0,e.serverUrl!==void 0],Boolean)===1,{message:`Entry must have exactly one of "serverName", "serverCommand", or "serverUrl"`})),Tg=L(()=>D({serverName:b().regex(/^[a-zA-Z0-9_-]+$/,`Server name can only contain letters, numbers, hyphens, and underscores`).optional().describe(`Name of the MCP server that is explicitly blocked`),serverCommand:S(b()).min(1,`Server command must have at least one element (the command)`).optional().describe(`Command array [command, ...args] to match exactly for blocked stdio servers`),serverUrl:b().optional().describe(`URL pattern with wildcard support (e.g., "https://*.example.com/*") for blocked remote MCP servers`)}).refine(e=>vi([e.serverName!==void 0,e.serverCommand!==void 0,e.serverUrl!==void 0],Boolean)===1,{message:`Entry must have exactly one of "serverName", "serverCommand", or "serverUrl"`})),Eg=[`skills`,`agents`,`hooks`,`mcp`],Dg=L(()=>D({$schema:T(kp).optional().describe(`JSON Schema reference for Claude Code settings`),apiKeyHelper:b().optional().describe(`Path to a script that outputs authentication values`),awsCredentialExport:b().optional().describe(`Path to a script that exports AWS credentials`),awsAuthRefresh:b().optional().describe(`Path to a script that refreshes AWS authentication`),gcpAuthRefresh:b().optional().describe(`Command to refresh GCP authentication (e.g., gcloud auth application-default login)`),...g(process.env.CLAUDE_CODE_ENABLE_XAA)?{xaaIdp:D({issuer:b().url().describe(`IdP issuer URL for OIDC discovery`),clientId:b().describe(`Claude Code's client_id registered at the IdP`),callbackPort:y().int().positive().optional().describe(`Fixed loopback callback port for the IdP OIDC login. Only needed if the IdP does not honor RFC 8252 port-any matching.`)}).optional().describe(`XAA (SEP-990) IdP connection. Configure once; all XAA-enabled MCP servers reuse this.`)}:{},fileSuggestion:D({type:T(`command`),command:b()}).optional().describe(`Custom file suggestion configuration for @ mentions`),respectGitignore:w().optional().describe(`Whether file picker should respect .gitignore files (default: true). Note: .ignore files are always respected.`),cleanupPeriodDays:y().nonnegative().int().optional().describe(`Number of days to retain chat transcripts (default: 30). Setting to 0 disables session persistence entirely: no transcripts are written and existing transcripts are deleted at startup.`),env:xg().optional().describe(`Environment variables to set for Claude Code sessions`),attribution:D({commit:b().optional().describe(`Attribution text for git commits, including any trailers. Empty string hides attribution.`),pr:b().optional().describe(`Attribution text for pull request descriptions. Empty string hides attribution.`)}).optional().describe(`Customize attribution text for commits and PRs. Each field defaults to the standard Claude Code attribution if not set.`),includeCoAuthoredBy:w().optional().describe(`Deprecated: Use attribution instead. Whether to include Claude's co-authored by attribution in commits and PRs (defaults to true)`),includeGitInstructions:w().optional().describe(`Include built-in commit and PR workflow instructions in Claude's system prompt (default: true)`),permissions:Sg().optional().describe(`Tool usage permissions configuration`),modelType:E([`anthropic`,`openai`,`gemini`,`grok`]).optional().describe(`API provider type. "anthropic" uses the Anthropic API (default), "openai" uses the OpenAI Chat Completions API, "gemini" uses the Gemini API, and "grok" uses the xAI Grok API (OpenAI-compatible). When set to "openai", configure OPENAI_API_KEY, OPENAI_BASE_URL, and OPENAI_MODEL. When set to "gemini", configure GEMINI_API_KEY and optional GEMINI_BASE_URL. When set to "grok", configure GROK_API_KEY (or XAI_API_KEY), optional GROK_BASE_URL, GROK_MODEL, and GROK_MODEL_MAP.`),model:b().optional().describe(`Override the default model used by Claude Code`),availableModels:S(b()).optional().describe(`Allowlist of models that users can select. Accepts family aliases ("opus" allows any opus version), version prefixes ("opus-4-5" allows only that version), and full model IDs. If undefined, all models are available. If empty array, only the default model is available. Typically set in managed settings by enterprise administrators.`),modelOverrides:x(b(),b()).optional().describe(`Override mapping from Anthropic model ID (e.g. "claude-opus-4-6") to provider-specific model ID (e.g. a Bedrock inference profile ARN). Typically set in managed settings by enterprise administrators.`),enableAllProjectMcpServers:w().optional().describe(`Whether to automatically approve all MCP servers in the project`),enabledMcpjsonServers:S(b()).optional().describe(`List of approved MCP servers from .mcp.json`),disabledMcpjsonServers:S(b()).optional().describe(`List of rejected MCP servers from .mcp.json`),allowedMcpServers:S(wg()).optional().describe(`Enterprise allowlist of MCP servers that can be used. Applies to all scopes including enterprise servers from managed-mcp.json. If undefined, all servers are allowed. If empty array, no servers are allowed. Denylist takes precedence - if a server is on both lists, it is denied.`),deniedMcpServers:S(Tg()).optional().describe(`Enterprise denylist of MCP servers that are explicitly blocked. If a server is on the denylist, it will be blocked across all scopes including enterprise. Denylist takes precedence over allowlist - if a server is on both lists, it is denied.`),hooks:fm().optional().describe(`Custom commands to run before/after tool executions`),worktree:D({symlinkDirectories:S(b()).optional().describe(`Directories to symlink from main repository to worktrees to avoid disk bloat. Must be explicitly configured - no directories are symlinked by default. Common examples: "node_modules", ".cache", ".bin"`),sparsePaths:S(b()).optional().describe(`Directories to include when creating worktrees, via git sparse-checkout (cone mode). Dramatically faster in large monorepos — only the listed paths are written to disk.`)}).optional().describe(`Git worktree configuration for --worktree flag.`),disableAllHooks:w().optional().describe(`Disable all hooks and statusLine execution`),defaultShell:E([`bash`,`powershell`]).optional().describe(`Default shell for input-box ! commands. Defaults to 'bash' on all platforms (no Windows auto-flip).`),allowManagedHooksOnly:w().optional().describe(`When true (and set in managed settings), only hooks from managed settings run. User, project, and local hooks are ignored.`),allowedHttpHookUrls:S(b()).optional().describe(`Allowlist of URL patterns that HTTP hooks may target. Supports * as a wildcard (e.g. "https://hooks.example.com/*"). When set, HTTP hooks with non-matching URLs are blocked. If undefined, all URLs are allowed. If empty array, no HTTP hooks are allowed. Arrays merge across settings sources (same semantics as allowedMcpServers).`),httpHookAllowedEnvVars:S(b()).optional().describe(`Allowlist of environment variable names HTTP hooks may interpolate into headers. When set, each hook's effective allowedEnvVars is the intersection with this list. If undefined, no restriction is applied. Arrays merge across settings sources (same semantics as allowedMcpServers).`),allowManagedPermissionRulesOnly:w().optional().describe(`When true (and set in managed settings), only permission rules (allow/deny/ask) from managed settings are respected. User, project, local, and CLI argument permission rules are ignored.`),allowManagedMcpServersOnly:w().optional().describe(`When true (and set in managed settings), allowedMcpServers is only read from managed settings. deniedMcpServers still merges from all sources, so users can deny servers for themselves. Users can still add their own MCP servers, but only the admin-defined allowlist applies.`),strictPluginOnlyCustomization:He(e=>Array.isArray(e)?e.filter(e=>Eg.includes(e)):e,C([w(),S(E(Eg))])).optional().catch(void 0).describe('When set in managed settings, blocks non-plugin customization sources for the listed surfaces. Array form locks specific surfaces (e.g. ["skills", "hooks"]); `true` locks all four; `false` is an explicit no-op. Blocked: ~/.claude/{surface}/, .claude/{surface}/ (project), settings.json hooks, .mcp.json. NOT blocked: managed (policySettings) sources, plugin-provided customizations. Composes with strictKnownMarketplaces for end-to-end admin control — plugins gated by marketplace allowlist, everything else blocked here.'),statusLine:D({type:T(`command`),command:b(),padding:y().optional(),refreshInterval:y().optional()}).optional().describe(`Custom status line display configuration`),statusLineEnabled:w().optional().describe(`Whether to render the fork built-in status line (model + ctx + 5h/7d limits + cost + cache pill). Toggled with /statusline.`),enabledPlugins:x(b(),C([S(b()),w(),Be()])).optional().describe(`Enabled plugins using plugin-id@marketplace-id format. Example: { "formatter@anthropic-tools": true }. Also supports extended format with version constraints.`),extraKnownMarketplaces:x(b(),Cg()).check(e=>{for(let[t,n]of Object.entries(e.value))n.source.source===`settings`&&n.source.name!==t&&e.issues.push({code:`custom`,input:n.source.name,path:[t,`source`,`name`],message:`Settings-sourced marketplace name must match its extraKnownMarketplaces key (got key "${t}" but source.name "${n.source.name}")`})}).optional().describe(`Additional marketplaces to make available for this repository. Typically used in repository .claude/settings.json to ensure team members have required plugin sources.`),strictKnownMarketplaces:S(Xm()).optional().describe(`Enterprise strict list of allowed marketplace sources. When set in managed settings, ONLY these exact sources can be added as marketplaces. The check happens BEFORE downloading, so blocked sources never touch the filesystem. Note: this is a policy gate only — it does NOT register marketplaces. To pre-register allowed marketplaces for users, also set extraKnownMarketplaces.`),blockedMarketplaces:S(Xm()).optional().describe(`Enterprise blocklist of marketplace sources. When set in managed settings, these exact sources are blocked from being added as marketplaces. The check happens BEFORE downloading, so blocked sources never touch the filesystem.`),forceLoginMethod:E([`claudeai`,`console`]).optional().describe(`Force a specific login method: "claudeai" for Claude Pro/Max, "console" for Console billing`),forceLoginOrgUUID:b().optional().describe(`Organization UUID to use for OAuth login`),otelHeadersHelper:b().optional().describe(`Path to a script that outputs OpenTelemetry headers`),outputStyle:b().optional().describe(`Controls the output style for assistant responses`),language:b().optional().describe(`Preferred language for Claude responses and voice dictation (e.g., "japanese", "spanish")`),skipWebFetchPreflight:w().optional().describe(`Skip the WebFetch blocklist check for enterprise environments with restrictive security policies`),sandbox:Rp().optional(),feedbackSurveyRate:y().min(0).max(1).optional().describe(`Probability (0–1) that the session quality survey appears when eligible. 0.05 is a reasonable starting point.`),spinnerTipsEnabled:w().optional().describe(`Whether to show tips in the spinner`),spinnerVerbs:D({mode:E([`append`,`replace`]),verbs:S(b())}).optional().describe(`Customize spinner verbs. mode: "append" adds verbs to defaults, "replace" uses only your verbs.`),spinnerTipsOverride:D({excludeDefault:w().optional(),tips:S(b())}).optional().describe(`Override spinner tips. tips: array of tip strings. excludeDefault: if true, only show custom tips (default: false).`),syntaxHighlightingDisabled:w().optional().describe(`Whether to disable syntax highlighting in diffs`),terminalTitleFromRename:w().optional().describe(`Whether /rename updates the terminal tab title (defaults to true). Set to false to keep auto-generated topic titles.`),alwaysThinkingEnabled:w().optional().describe(`When false, thinking is disabled. When absent or true, thinking is enabled automatically for supported models.`),effortLevel:E(process.env.USER_TYPE===`ant`?[`low`,`medium`,`high`,`xhigh`,`max`]:[`low`,`medium`,`high`,`xhigh`]).optional().catch(void 0).describe(`Persisted effort level for supported models.`),advisorModel:b().optional().describe(`Advisor model for the server-side advisor tool.`),fastMode:w().optional().describe(`When true, fast mode is enabled. When absent or false, fast mode is off.`),fastModePerSessionOptIn:w().optional().describe(`When true, fast mode does not persist across sessions. Each session starts with fast mode off.`),promptSuggestionEnabled:w().optional().describe(`When false, prompt suggestions are disabled. When absent or true, prompt suggestions are enabled.`),poorMode:w().optional().describe(`When true, poor mode is active — extract_memories and prompt_suggestion are disabled to save tokens.`),showClearContextOnPlanAccept:w().optional().describe(`When true, the plan-approval dialog offers a "clear context" option. Defaults to false.`),agent:b().optional().describe(`Name of an agent (built-in or custom) to use for the main thread. Applies the agent's system prompt, tool restrictions, and model.`),companyAnnouncements:S(b()).optional().describe(`Company announcements to display at startup (one will be randomly selected if multiple are provided)`),pluginConfigs:x(b(),D({mcpServers:x(b(),x(b(),C([b(),y(),w(),S(b())]))).optional().describe(`User configuration values for MCP servers keyed by server name`),options:x(b(),C([b(),y(),w(),S(b())])).optional().describe(`Non-sensitive option values from plugin manifest userConfig, keyed by option name. Sensitive values go to secure storage instead.`)})).optional().describe(`Per-plugin configuration including MCP server user configs, keyed by plugin ID (plugin@marketplace format)`),remote:D({defaultEnvironmentId:b().optional().describe(`Default environment ID to use for remote sessions`)}).optional().describe(`Remote session configuration`),autoUpdatesChannel:E([`latest`,`stable`]).optional().describe(`Release channel for auto-updates (latest or stable)`),disableDeepLinkRegistration:E([`disable`]).optional().describe(`Prevent claude-cli:// protocol handler registration with the OS`),minimumVersion:b().optional().describe(`Minimum version to stay on - prevents downgrades when switching to stable channel`),plansDirectory:b().optional().describe(`Custom directory for plan files, relative to project root. If not set, defaults to ~/.claude/plans/`),...process.env.USER_TYPE===`ant`?{classifierPermissionsEnabled:w().optional().describe(`Enable AI-based classification for Bash(prompt:...) permission rules`)}:{},minSleepDurationMs:y().nonnegative().int().optional().describe(`Minimum duration in milliseconds that the Sleep tool must sleep for. Useful for throttling proactive tick frequency.`),maxSleepDurationMs:y().int().min(-1).optional().describe(`Maximum duration in milliseconds that the Sleep tool can sleep for. Set to -1 for indefinite sleep (waits for user input). Useful for limiting idle time in remote/managed environments.`),voiceEnabled:w().optional().describe(`Enable voice mode (hold-to-talk dictation)`),voiceProvider:E([`anthropic`,`doubao`]).optional().describe(`Voice STT backend: "anthropic" (default) or "doubao" (Doubao ASR)`),assistant:w().optional().describe(`Start Claude in assistant mode (custom system prompt, brief view, scheduled check-in skills)`),assistantName:b().optional().describe(`Display name for the assistant, shown in the claude.ai session list`),channelsEnabled:w().optional().describe(`Teams/Enterprise opt-in for channel notifications (MCP servers with the claude/channel capability pushing inbound messages). Default off. Set true to allow; users then select servers via --channels.`),allowedChannelPlugins:S(D({marketplace:b(),plugin:b()})).optional().describe(`Teams/Enterprise allowlist of channel plugins. When set, replaces the default Anthropic allowlist — admins decide which plugins may push inbound messages. Undefined falls back to the default. Requires channelsEnabled: true.`),defaultView:E([`chat`,`transcript`]).optional().describe(`Default transcript view: chat (SendUserMessage checkpoints only) or transcript (full)`),prefersReducedMotion:w().optional().describe(`Reduce or disable animations for accessibility (spinner shimmer, flash effects, etc.)`),autoMemoryEnabled:w().optional().describe(`Enable auto-memory for this project. When false, Claude will not read from or write to the auto-memory directory.`),autoMemoryDirectory:b().optional().describe(`Custom directory path for auto-memory storage. Supports ~/ prefix for home directory expansion. Ignored if set in projectSettings (checked-in .claude/settings.json) for security. When unset, defaults to ~/.claude/projects/<sanitized-cwd>/memory/.`),autoDreamEnabled:w().optional().describe(`Enable background memory consolidation (auto-dream). When set, overrides the server-side default.`),showThinkingSummaries:w().optional().describe(`Show thinking summaries in the transcript view (ctrl+o). Default: false.`),skipDangerousModePermissionPrompt:w().optional().describe(`Whether the user has accepted the bypass permissions mode dialog`),skipAutoPermissionPrompt:w().optional().describe(`Whether the user has accepted the auto mode opt-in dialog`),useAutoModeDuringPlan:w().optional().describe(`Whether plan mode uses auto mode semantics when auto mode is available (default: true)`),autoMode:D({allow:S(b()).optional().describe(`Rules for the auto mode classifier allow section`),soft_deny:S(b()).optional().describe(`Rules for the auto mode classifier deny section`),...process.env.USER_TYPE===`ant`?{deny:S(b()).optional()}:{},environment:S(b()).optional().describe(`Entries for the auto mode classifier environment section`)}).optional().describe(`Auto mode classifier prompt customization`),disableAutoMode:E([`disable`]).optional().describe(`Disable auto mode`),sshConfigs:S(D({id:b().describe(`Unique identifier for this SSH config. Used to match configs across settings sources.`),name:b().describe(`Display name for the SSH connection`),sshHost:b().describe(`SSH host in format "user@hostname" or "hostname", or a host alias from ~/.ssh/config`),sshPort:y().int().optional().describe(`SSH port (default: 22)`),sshIdentityFile:b().optional().describe(`Path to SSH identity file (private key)`),startDirectory:b().optional().describe("Default working directory on the remote host. Supports tilde expansion (e.g. ~/projects). If not specified, defaults to the remote user home directory. Can be overridden by the [dir] positional argument in `claude ssh <config> [dir]`.")})).optional().describe(`SSH connection configurations for remote environments. Typically set in managed settings by enterprise administrators to pre-configure SSH connections for team members.`),claudeMdExcludes:S(b()).optional().describe(`Glob patterns or absolute paths of CLAUDE.md files to exclude from loading. Patterns are matched against absolute file paths using picomatch. Only applies to User, Project, and Local memory types (Managed/policy files cannot be excluded). Examples: "/home/user/monorepo/CLAUDE.md", "**/code/CLAUDE.md", "**/some-dir/.claude/rules/**"`),cacheThreshold:y().int().min(0).max(100).optional().describe(`Prompt cache hit rate threshold (0-100). Warnings shown when cache hit rate falls below this percentage. Default: 80.`),pluginTrustMessage:b().optional().describe(`Custom message to append to the plugin trust warning shown before installation. Only read from policy settings (managed-settings.json / MDM). Useful for enterprise administrators to add organization-specific context (e.g., "All plugins from our internal marketplace are vetted and approved.").`),workspaceApiKey:b().optional().describe(`Workspace API key (sk-ant-api03-*) saved via /login UI. Stored in plaintext — keep this file gitignored and restrict its permissions. ANTHROPIC_API_KEY environment variable takes precedence when both are set.`)}).passthrough())}));function kg(){return k(ze(Dg(),{unrepresentable:`any`}),null,2)}var Ag=t((()=>{Je(),ur(),Og()}));function jg(e){let t=Ng.find(t=>t.matches(e));if(!t)return null;let n={...t.tip};if(e.code===`invalid_value`&&e.enumValues&&!n.suggestion&&(n.suggestion=`Valid values: ${e.enumValues.map(e=>`"${e}"`).join(`, `)}`),!n.docLink&&e.path){let t=e.path.split(`.`)[0];t&&(n.docLink=Pg[t])}return n}var Mg,Ng,Pg,Fg=t((()=>{Mg=`https://code.claude.com/docs/en`,Ng=[{matches:e=>e.path===`permissions.defaultMode`&&e.code===`invalid_value`,tip:{suggestion:`Valid modes: "acceptEdits" (ask before file changes), "plan" (analysis only), "bypassPermissions" (auto-accept all), or "default" (standard behavior)`,docLink:`${Mg}/iam#permission-modes`}},{matches:e=>e.path===`apiKeyHelper`&&e.code===`invalid_type`,tip:{suggestion:`Provide a shell command that outputs your API key to stdout. The script should output only the API key. Example: "/bin/generate_temp_api_key.sh"`}},{matches:e=>e.path===`cleanupPeriodDays`&&e.code===`too_small`&&e.expected===`0`,tip:{suggestion:`Must be 0 or greater. Set a positive number for days to retain transcripts (default is 30). Setting 0 disables session persistence entirely: no transcripts are written and existing transcripts are deleted at startup.`}},{matches:e=>e.path.startsWith(`env.`)&&e.code===`invalid_type`,tip:{suggestion:`Environment variables must be strings. Wrap numbers and booleans in quotes. Example: "DEBUG": "true", "PORT": "3000"`,docLink:`${Mg}/settings#environment-variables`}},{matches:e=>(e.path===`permissions.allow`||e.path===`permissions.deny`)&&e.code===`invalid_type`&&e.expected===`array`,tip:{suggestion:`Permission rules must be in an array. Format: ["Tool(specifier)"]. Examples: ["Bash(npm run build)", "Edit(docs/**)", "Read(~/.zshrc)"]. Use * for wildcards.`}},{matches:e=>e.path.includes(`hooks`)&&e.code===`invalid_type`,tip:{suggestion:`Hooks use a matcher + hooks array. The matcher is a string: a tool name ("Bash"), pipe-separated list ("Edit|Write"), or empty to match all. Example: {"PostToolUse": [{"matcher": "Edit|Write", "hooks": [{"type": "command", "command": "echo Done"}]}]}`}},{matches:e=>e.code===`invalid_type`&&e.expected===`boolean`,tip:{suggestion:`Use true or false without quotes. Example: "includeCoAuthoredBy": true`}},{matches:e=>e.code===`unrecognized_keys`,tip:{suggestion:`Check for typos or refer to the documentation for valid fields`,docLink:`${Mg}/settings`}},{matches:e=>e.code===`invalid_value`&&e.enumValues!==void 0,tip:{suggestion:void 0}},{matches:e=>e.code===`invalid_type`&&e.expected===`object`&&e.received===null&&e.path===``,tip:{suggestion:`Check for missing commas, unmatched brackets, or trailing commas. Use a JSON validator to identify the exact syntax error.`}},{matches:e=>e.path===`permissions.additionalDirectories`&&e.code===`invalid_type`,tip:{suggestion:`Must be an array of directory paths. Example: ["~/projects", "/tmp/workspace"]. You can also use --add-dir flag or /add-dir command`,docLink:`${Mg}/iam#working-directories`}}],Pg={permissions:`${Mg}/iam#configuring-permissions`,env:`${Mg}/settings#environment-variables`,hooks:`${Mg}/hooks`}}));function Ig(e){return e.code===`invalid_type`}function Lg(e){return e.code===`invalid_value`}function Rg(e){return e.code===`unrecognized_keys`}function zg(e){return e.code===`too_small`}function Bg(e){return e===null?`null`:e===void 0?`undefined`:Array.isArray(e)?`array`:typeof e}function Vg(e){let t=e.match(/received (\w+)/);return t?t[1]:void 0}function Hg(e,t){return e.issues.map(e=>{let n=e.path.map(String).join(`.`),r=e.message,i,a,o,s,c;if(Lg(e))a=e.values.map(e=>String(e)),o=a.join(` | `),s=void 0,c=void 0;else if(Ig(e)){o=e.expected;let t=Vg(e.message);s=t??Bg(e.input),c=t??Bg(e.input)}else zg(e)?o=String(e.minimum):e.code===`custom`&&`params`in e&&(s=e.params.received,c=s);let l=jg({path:n,code:e.code,expected:o,received:s,enumValues:a,message:e.message,value:s});if(Lg(e))i=a?.map(e=>`"${e}"`).join(`, `),r=`Invalid value. Expected one of: ${i}`;else if(Ig(e)){let t=Vg(e.message)??Bg(e.input);r=e.expected===`object`&&t===`null`&&n===``?`Invalid or malformed JSON`:`Expected ${e.expected}, but received ${t}`}else if(Rg(e)){let t=e.keys.join(`, `);r=`Unrecognized ${Xh(e.keys.length,`field`)}: ${t}`}else zg(e)&&(r=`Number must be greater than or equal to ${e.minimum}`,i=String(e.minimum));return{file:t,path:n,message:r,expected:i,invalidValue:c,suggestion:l?.suggestion,docLink:l?.docLink}})}function Ug(e){try{let t=Pn(e),n=Dg().strict().safeParse(t);return n.success?{isValid:!0}:{isValid:!1,error:`Settings validation failed:
|
|
33
33
|
`+Hg(n.error,`settings`).map(e=>`- ${e.path}: ${e.message}`).join(`
|
|
34
34
|
`),fullSchema:kg()}}catch(e){return{isValid:!1,error:`Invalid JSON: ${e instanceof Error?e.message:`Unknown parsing error`}`,fullSchema:kg()}}}function Wg(e,t){if(!e||typeof e!=`object`)return[];let n=e;if(!n.permissions||typeof n.permissions!=`object`)return[];let r=n.permissions,i=[];for(let e of[`allow`,`deny`,`ask`]){let n=r[e];Array.isArray(n)&&(r[e]=n.filter(n=>{if(typeof n!=`string`)return i.push({file:t,path:`permissions.${e}`,message:`Non-string value in ${e} array was removed`,invalidValue:n}),!1;let r=mg(n,e);if(!r.valid){let a=`Invalid permission rule "${n}" was skipped`;return r.error&&(a+=`: ${r.error}`),r.suggestion&&(a+=`. ${r.suggestion}`),i.push({file:t,path:`permissions.${e}`,message:a,invalidValue:n}),!1}return!0}))}return i}var Gg=t((()=>{ur(),ag(),_g(),Ag(),Og(),Fg()}));function Kg(){let e=``;try{e=Hi().username}catch{}let t=[];return e&&t.push({path:`/Library/Managed Preferences/${e}/${qg}.plist`,label:`per-user managed preferences`}),t.push({path:`/Library/Managed Preferences/${qg}.plist`,label:`device-level managed preferences`}),process.env.USER_TYPE===`ant`&&t.push({path:R(Vi(),`Library`,`Preferences`,`${qg}.plist`),label:`user preferences (ant-only)`}),t}var qg,Jg,Yg,Xg,Zg,Qg,$g,e_=t((()=>{qg=`com.anthropic.claudecode`,Jg=`HKLM\\SOFTWARE\\Policies\\ClaudeCode`,Yg=`HKCU\\SOFTWARE\\Policies\\ClaudeCode`,Xg=`Settings`,Zg=`/usr/bin/plutil`,Qg=[`-convert`,`json`,`-o`,`-`,`--`],$g=5e3}));function t_(e,t){return new Promise(n=>{_a(e,t,{encoding:`utf-8`,timeout:$g},(e,t)=>{n({stdout:t??``,code:+!!e})})})}function n_(){return(async()=>{if(process.platform===`darwin`){let e=Kg(),t=(await Promise.all(e.map(async({path:e,label:t})=>{if(!$i(e))return{stdout:``,label:t,ok:!1};let{stdout:n,code:r}=await t_(Zg,[...Qg,e]);return{stdout:n,label:t,ok:r===0&&!!n}}))).find(e=>e.ok);return{plistStdouts:t?[{stdout:t.stdout,label:t.label}]:[],hklmStdout:null,hkcuStdout:null}}if(process.platform===`win32`){let[e,t]=await Promise.all([t_(`reg`,[`query`,Jg,`/v`,Xg]),t_(`reg`,[`query`,Yg,`/v`,Xg])]);return{plistStdouts:null,hklmStdout:e.code===0?e.stdout:null,hkcuStdout:t.code===0?t.stdout:null}}return{plistStdouts:null,hklmStdout:null,hkcuStdout:null}})()}function r_(){a_||(a_=n_())}function i_(){return a_}var a_,o_=t((()=>{e_(),a_=null}));function s_(){b_||(b_=(async()=>{wi(`mdm_load_start`);let e=Date.now(),{mdm:t,hkcu:n}=h_(await(i_()??n_()));v_=t,y_=n,wi(`mdm_load_end`);let r=Date.now()-e;if(A(`MDM settings load completed in ${r}ms`),Object.keys(t.settings).length>0){A(`MDM settings found: ${Object.keys(t.settings).join(`, `)}`);try{yr(`info`,`mdm_settings_loaded`,{duration_ms:r,key_count:Object.keys(t.settings).length,error_count:t.errors.length})}catch{}}})())}async function c_(){b_||s_(),await b_}function l_(){return v_??__}function u_(){return y_??__}function d_(e,t){v_=e,y_=t}async function f_(){return h_(await n_())}function p_(e,t){let n=fi(e,!1);if(!n||typeof n!=`object`)return{settings:{},errors:[]};let r=Wg(n,t),i=Dg().safeParse(n);if(!i.success){let e=Hg(i.error,t);return{settings:{},errors:[...r,...e]}}return{settings:i.data,errors:r}}function m_(e,t=`Settings`){let n=e.split(/\r?\n/),r=t.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`),i=RegExp(`^\\s+${r}\\s+REG_(?:EXPAND_)?SZ\\s+(.*)$`,`i`);for(let e of n){let t=e.match(i);if(t&&t[1])return t[1].trimEnd()}return null}function h_(e){if(e.plistStdouts&&e.plistStdouts.length>0){let{stdout:t,label:n}=e.plistStdouts[0],r=p_(t,n);if(Object.keys(r.settings).length>0)return{mdm:r,hkcu:__}}if(e.hklmStdout){let t=m_(e.hklmStdout);if(t){let e=p_(t,`Registry: ${Jg}\\${Xg}`);if(Object.keys(e.settings).length>0)return{mdm:e,hkcu:__}}}if(g_())return{mdm:__,hkcu:__};if(e.hkcuStdout){let t=m_(e.hkcuStdout);if(t)return{mdm:__,hkcu:p_(t,`Registry: ${Yg}\\${Xg}`)}}return{mdm:__,hkcu:__}}function g_(){try{let e=fi(jd(R(cf(),`managed-settings.json`)),!1);if(e&&typeof e==`object`&&Object.keys(e).length>0)return!0}catch{}try{let e=lf(),t=j().readdirSync(e);for(let n of t)if(!(!(n.isFile()||n.isSymbolicLink())||!n.name.endsWith(`.json`)||n.name.startsWith(`.`)))try{let t=fi(jd(R(e,n.name)),!1);if(t&&typeof t==`object`&&Object.keys(t).length>0)return!0}catch{}}catch{}return!1}var __,v_,y_,b_,x_=t((()=>{M(),br(),Md(),Jn(),di(),Ti(),uf(),Og(),Gg(),e_(),o_(),__=Object.freeze({settings:{},errors:[]}),v_=null,y_=null,b_=null}));function S_(){return R(cf(),`managed-settings.json`)}function C_(){let e=[],t={},n=!1,{settings:r,errors:i}=E_(S_());e.push(...i),r&&Object.keys(r).length>0&&(t=hu(t,r,I_),n=!0);let a=lf();try{let r=j().readdirSync(a).filter(e=>(e.isFile()||e.isSymbolicLink())&&e.name.endsWith(`.json`)&&!e.name.startsWith(`.`)).map(e=>e.name).sort();for(let i of r){let{settings:r,errors:o}=E_(R(a,i));e.push(...o),r&&Object.keys(r).length>0&&(t=hu(t,r,I_),n=!0)}}catch(e){let t=Mn(e);t!==`ENOENT`&&t!==`ENOTDIR`&&I(e)}return{settings:n?t:null,errors:e}}function w_(){let{settings:e}=E_(S_()),t=!!e&&Object.keys(e).length>0,n=!1,r=lf();try{n=j().readdirSync(r).some(e=>(e.isFile()||e.isSymbolicLink())&&e.name.endsWith(`.json`)&&!e.name.startsWith(`.`))}catch{}return{hasBase:t,hasDropIns:n}}function T_(e,t){typeof e==`object`&&e&&`code`in e&&e.code===`ENOENT`?A(`Broken symlink or missing file encountered for settings.json at path: ${t}`):I(e)}function E_(e){let t=wt(e);if(t)return{settings:t.settings?Dn(t.settings):null,errors:t.errors};let n=D_(e);return Nt(e,n),{settings:n.settings?Dn(n.settings):null,errors:n.errors}}function D_(e){try{let{resolvedPath:t}=fr(j(),e),n=jd(t);if(n.trim()===``)return{settings:{},errors:[]};let r=fi(n,!1),i=Wg(r,e),a=Dg().safeParse(r);if(!a.success){let t=Hg(a.error,e);return{settings:null,errors:[...i,...t]}}return{settings:a.data,errors:i}}catch(t){return T_(t,e),{settings:null,errors:[]}}}function O_(e){switch(e){case`userSettings`:return Xi(ae());case`policySettings`:case`projectSettings`:case`localSettings`:return Xi(dn());case`flagSettings`:{let e=_t();return e?Gi(Xi(e)):Xi(dn())}}}function k_(){return Qt()||g(process.env.CLAUDE_CODE_USE_COWORK_PLUGINS)?`cowork_settings.json`:`settings.json`}function A_(e){switch(e){case`userSettings`:return R(O_(e),k_());case`projectSettings`:case`localSettings`:return R(O_(e),j_(e));case`policySettings`:return S_();case`flagSettings`:return _t()}}function j_(e){switch(e){case`projectSettings`:return R(`.claude`,`settings.json`);case`localSettings`:return R(`.claude`,`settings.local.json`)}}function U(e){let t=At(e);if(t!==void 0)return t;let n=M_(e);return It(e,n),n}function M_(e){if(e===`policySettings`){let e=dp();if(e&&Object.keys(e).length>0)return e;let t=l_();if(Object.keys(t.settings).length>0)return t.settings;let{settings:n}=C_();if(n)return n;let r=u_();return Object.keys(r.settings).length>0?r.settings:null}let t=A_(e),{settings:n}=t?E_(t):{settings:null};if(e===`flagSettings`){let e=ut();if(e){let t=Dg().safeParse(e);if(t.success)return hu(n||{},t.data,I_)}}return n}function N_(){let e=dp();if(e&&Object.keys(e).length>0)return`remote`;let t=l_();if(Object.keys(t.settings).length>0)return Gr()===`macos`?`plist`:`hklm`;let{settings:n}=C_();if(n)return`file`;let r=u_();return Object.keys(r.settings).length>0?`hkcu`:null}function P_(e,t){if(e===`policySettings`||e===`flagSettings`)return{error:null};let n=A_(e);if(!n)return{error:null};try{j().mkdirSync(Gi(n));let r=M_(e);if(!r){let e=null;try{e=jd(n)}catch(e){if(!Fn(e))throw e}if(e!==null){let t=fi(e);if(t===null)return{error:Error(`Invalid JSON syntax in settings file at ${n}`)};t&&typeof t==`object`&&(r=t,A(`Using raw settings from ${n} due to validation failure`))}}let i=hu(r||{},t,(e,t,n,r)=>{if(t===void 0&&r&&typeof n==`string`){delete r[n];return}if(Array.isArray(t))return t});jp(n),$d(n,k(i,null,2)+`
|
|
35
|
-
`),gt(),e===`localSettings`&&vp(j_(`localSettings`),dn())}catch(e){let t=Error(`Failed to read raw settings from ${n}: ${e}`);return I(t),{error:t}}return{error:null}}function F_(e,t){return pi([...e,...t])}function I_(e,t){if(Array.isArray(e)&&Array.isArray(t))return F_(e,t)}function L_(e){let t=Dg().strip().parse(e),n=[`permissions`,`sandbox`,`hooks`],r=[],i={permissions:new Set([`allow`,`deny`,`ask`,`defaultMode`,`disableBypassPermissionsMode`,...[`disableAutoMode`],`additionalDirectories`]),sandbox:new Set([`enabled`,`failIfUnavailable`,`allowUnsandboxedCommands`,`network`,`filesystem`,`ignoreViolations`,`excludedCommands`,`autoAllowBashIfSandboxed`,`enableWeakerNestedSandbox`,`enableWeakerNetworkIsolation`,`ripgrep`]),hooks:new Set([`PreToolUse`,`PostToolUse`,`Notification`,`UserPromptSubmit`,`SessionStart`,`SessionEnd`,`Stop`,`SubagentStop`,`PreCompact`,`PostCompact`,`TeammateIdle`,`TaskCreated`,`TaskCompleted`])};for(let e of Object.keys(t))if(n.includes(e)&&t[e]&&typeof t[e]==`object`){let n=t[e],a=i[e];if(a)for(let t of Object.keys(n))a.has(t)&&r.push(`${e}.${t}`)}else r.push(e);return r.sort()}function R_(){if(q_)return{settings:{},errors:[]};let e=Date.now();wi(`loadSettingsFromDisk_start`),yr(`info`,`settings_load_started`),q_=!0;try{let t=Tn(),n={};t&&(n=hu(n,t,I_));let r=[],i=new Set,a=new Set;for(let e of Tp()){if(e===`policySettings`){let e=null,t=[],a=dp();if(a&&Object.keys(a).length>0){let n=Dg().safeParse(a);n.success?e=n.data:t.push(...Hg(n.error,`remote managed settings`))}if(!e){let n=l_();Object.keys(n.settings).length>0&&(e=n.settings),t.push(...n.errors)}if(!e){let{settings:n,errors:r}=C_();n&&(e=n),t.push(...r)}if(!e){let n=u_();Object.keys(n.settings).length>0&&(e=n.settings),t.push(...n.errors)}e&&(n=hu(n,e,I_));for(let e of t){let t=`${e.file}:${e.path}:${e.message}`;i.has(t)||(i.add(t),r.push(e))}continue}let t=A_(e);if(t){let e=Xi(t);if(!a.has(e)){a.add(e);let{settings:o,errors:s}=E_(t);for(let e of s){let t=`${e.file}:${e.path}:${e.message}`;i.has(t)||(i.add(t),r.push(e))}o&&(n=hu(n,o,I_))}}if(e===`flagSettings`){let e=ut();if(e){let t=Dg().safeParse(e);t.success&&(n=hu(n,t.data,I_))}}}return yr(`info`,`settings_load_completed`,{duration_ms:Date.now()-e,source_count:a.size,error_count:r.length}),{settings:n,errors:r}}finally{q_=!1}}function z_(){let{settings:e}=V_();return e||{}}function B_(){gt();let e=[];for(let t of Tp()){let n=U(t);n&&Object.keys(n).length>0&&e.push({source:t,settings:n})}return{effective:z_(),sources:e}}function V_(){let e=it();if(e!==null)return e;let t=R_();return wi(`loadSettingsFromDisk_end`),Ct(t),t}function H_(){return!!(U(`userSettings`)?.skipDangerousModePermissionPrompt||U(`localSettings`)?.skipDangerousModePermissionPrompt||U(`flagSettings`)?.skipDangerousModePermissionPrompt||U(`policySettings`)?.skipDangerousModePermissionPrompt)}function U_(){return!0}function W_(){return U(`policySettings`)?.useAutoModeDuringPlan!==!1&&U(`flagSettings`)?.useAutoModeDuringPlan!==!1&&U(`userSettings`)?.useAutoModeDuringPlan!==!1&&U(`localSettings`)?.useAutoModeDuringPlan!==!1}function G_(){{let e=D({allow:S(b()).optional(),soft_deny:S(b()).optional(),deny:S(b()).optional(),environment:S(b()).optional()}),t=[],n=[],r=[];for(let i of[`userSettings`,`localSettings`,`flagSettings`,`policySettings`]){let a=U(i);if(!a)continue;let o=e.safeParse(a.autoMode);o.success&&(o.data.allow&&t.push(...o.data.allow),o.data.soft_deny&&n.push(...o.data.soft_deny),process.env.USER_TYPE===`ant`&&o.data.deny&&n.push(...o.data.deny),o.data.environment&&r.push(...o.data.environment))}if(t.length>0||n.length>0||r.length>0)return{...t.length>0&&{allow:t},...n.length>0&&{soft_deny:n},...r.length>0&&{environment:r}}}}function K_(e){for(let t of Tp()){if(t===`policySettings`)continue;let n=A_(t);if(n)try{let{resolvedPath:t}=fr(j(),n),r=jd(t);if(!r.trim())continue;let i=fi(r,!1);if(i&&typeof i==`object`&&e in i)return!0}catch(e){T_(e,n)}}return!1}var q_,J_,Y_=t((()=>{gu(),Je(),O(),hp(),Ci(),M(),br(),h(),In(),sf(),Md(),Jn(),yp(),di(),Vr(),qr(),ur(),Ti(),Ap(),Fp(),uf(),x_(),Ft(),Og(),Gg(),q_=!1,J_=z_}));function X_(e,t){return e.find(e=>e.includes(t))??null}async function Z_(){let{BedrockClient:e}=await import(`./dist-es-4z5T3Jzm.js`),t=oe(),n=g(process.env.CLAUDE_CODE_SKIP_BEDROCK_AUTH),r={region:t,...process.env.ANTHROPIC_BEDROCK_BASE_URL&&{endpoint:process.env.ANTHROPIC_BEDROCK_BASE_URL},...await Mi(),...n&&{requestHandler:new(await(import(`./dist-es-hdN_ShpZ.js`))).NodeHttpHandler,httpAuthSchemes:[{schemeId:`smithy.api#noAuth`,identityProvider:()=>async()=>({}),signer:new(await(import(`./dist-es-CZkzHpjF.js`))).NoAuthSigner}],httpAuthSchemeProvider:()=>[{schemeId:`smithy.api#noAuth`}]}};if(!n&&!process.env.AWS_BEARER_TOKEN_BEDROCK){let e=await Kw();e&&(r.credentials={accessKeyId:e.accessKeyId,secretAccessKey:e.secretAccessKey,sessionToken:e.sessionToken})}return new e(r)}async function Q_(){let{BedrockRuntimeClient:e}=await import(`./dist-es-DN7otr6F.js`),t=oe(),n=g(process.env.CLAUDE_CODE_SKIP_BEDROCK_AUTH),r={region:t,...process.env.ANTHROPIC_BEDROCK_BASE_URL&&{endpoint:process.env.ANTHROPIC_BEDROCK_BASE_URL},...await Mi(),...n&&{requestHandler:new(await(import(`./dist-es-hdN_ShpZ.js`))).NodeHttpHandler,httpAuthSchemes:[{schemeId:`smithy.api#noAuth`,identityProvider:()=>async()=>({}),signer:new(await(import(`./dist-es-CZkzHpjF.js`))).NoAuthSigner}],httpAuthSchemeProvider:()=>[{schemeId:`smithy.api#noAuth`}]}};if(!n&&!process.env.AWS_BEARER_TOKEN_BEDROCK){let e=await Kw();e&&(r.credentials={accessKeyId:e.accessKeyId,secretAccessKey:e.secretAccessKey,sessionToken:e.sessionToken})}return new e(r)}function $_(e){return e.startsWith(`anthropic.`)}function ev(e){if(!e.startsWith(`arn:`))return e;let t=e.lastIndexOf(`/`);return t===-1?e:e.substring(t+1)}function tv(e){let t=ev(e);for(let e of av)if(t.startsWith(`${e}.anthropic.`))return e}function nv(e,t){let n=tv(e);return n?e.replace(`${n}.`,`${t}.`):$_(e)?`${t}.${e}`:e}var rv,iv,av,ov=t((()=>{m(),Q(),h(),Vr(),Pi(),rv=p(async function(){let[e,{ListInferenceProfilesCommand:t}]=await Promise.all([Z_(),import(`./dist-es-4z5T3Jzm.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 I(e),e}}),iv=p(async function(e){try{let[t,{GetInferenceProfileCommand:n}]=await Promise.all([Z_(),import(`./dist-es-4z5T3Jzm.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 I(e),null}}),av=[`us`,`eu`,`apac`,`global`]})),sv,cv,lv,uv,dv,fv,pv,mv,hv,gv,_v,vv,yv,bv,xv=t((()=>{sv={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`},cv={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`},lv={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`},uv={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`},dv={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`},fv={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`},pv={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`},mv={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`},hv={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`},gv={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`},_v={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`},vv={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`},yv={haiku35:lv,haiku45:uv,sonnet35:cv,sonnet37:sv,sonnet40:dv,sonnet45:fv,sonnet46:vv,opus40:pv,opus41:mv,opus45:hv,opus46:gv,opus47:_v},Object.values(yv).map(e=>e.firstParty),bv=Object.fromEntries(Object.entries(yv).map(([e,t])=>[t.firstParty,e]))}));function W(e=z_()){let t=e.modelType;return t===`openai`?`openai`:t===`gemini`?`gemini`:t===`grok`?`grok`:g(process.env.CLAUDE_CODE_USE_BEDROCK)?`bedrock`:g(process.env.CLAUDE_CODE_USE_VERTEX)?`vertex`:g(process.env.CLAUDE_CODE_USE_FOUNDRY)?`foundry`:g(process.env.CLAUDE_CODE_USE_OPENAI)?`openai`:g(process.env.CLAUDE_CODE_USE_GEMINI)?`gemini`:g(process.env.CLAUDE_CODE_USE_GROK)?`grok`:`firstParty`}function Sv(){return W()}function Cv(){let e=process.env.ANTHROPIC_BASE_URL;if(!e)return!0;try{let t=new URL(e).host,n=[`api.anthropic.com`];return process.env.USER_TYPE===`ant`&&n.push(`api-staging.anthropic.com`),n.includes(t)}catch{return!1}}var wv=t((()=>{Y_(),h()}));function Tv(e){let t={};for(let n of jv)t[n]=yv[n][e];return t}async function Ev(){let e=Tv(`bedrock`),t;try{t=await rv()}catch(t){return I(t),e}if(!t?.length)return e;let n={};for(let r of jv){let i=yv[r].firstParty;n[r]=X_(t,i)||e[r]}return n}function Dv(e){let t=z_().modelOverrides;if(!t)return e;let n={...e};for(let[e,r]of Object.entries(t)){let t=bv[e];t&&r&&(n[t]=r)}return n}function Ov(e){let t;try{t=z_().modelOverrides}catch{return e}if(!t)return e;for(let[n,r]of Object.entries(t))if(r===e)return n;return e}function kv(){if(gn()===null){if(W()!==`bedrock`){Wt(Tv(W()));return}Mv()}}function G(){let e=gn();return e===null?(kv(),Dv(Tv(W()))):Dv(e)}async function Av(){if(gn()===null){if(W()!==`bedrock`){Wt(Tv(W()));return}await Mv()}}var jv,Mv,Nv=t((()=>{O(),Vr(),ap(),Y_(),ov(),xv(),wv(),jv=Object.keys(yv),Mv=ip(async()=>{if(gn()===null)try{Wt(await Ev())}catch(e){I(e)}})}));function Pv(){if(g(process.env.DISABLE_COST_WARNINGS)||Y())return!1;let e=jC(),t=MC()!==null;if(!e.hasToken&&!t)return!1;let n=H(),r=n.oauthAccount?.organizationRole,i=n.oauthAccount?.workspaceRole;return!r||!i?!1:[`admin`,`billing`].includes(r)||[`workspace_admin`,`workspace_billing`].includes(i)}function Fv(e){Lv=e}function Iv(){if(Lv!==null)return Lv;if(!Y())return!1;let e=X();if(e===`max`||e===`pro`)return!0;let t=H().oauthAccount?.organizationRole;return!!t&&[`admin`,`billing`,`owner`,`primary_owner`].includes(t)}var Lv,Rv=t((()=>{Q(),rp(),h(),Lv=null}));function zv(){return process.env.USER_TYPE===`ant`?process.env.CLAUDE_MOCK_HEADERLESS_429?process.env.CLAUDE_MOCK_HEADERLESS_429:Yv?Xv:null:null}function Bv(){return!Yv||process.env.USER_TYPE!==`ant`||Object.keys(Jv).length===0?null:Jv}function Vv(){Jv={},ty=[],Zv=null,Qv=null,$v=null,Xv=null,Fv(null),Yv=!1}function Hv(e){let t=Bv();if(!t)return e;let n=new globalThis.Headers(e);return Object.entries(t).forEach(([e,t])=>{t!==void 0&&n.set(e,t)}),n}function Uv(){return process.env.USER_TYPE===`ant`?Yv||!!process.env.CLAUDE_MOCK_HEADERLESS_429:!1}function Wv(){return!Yv||process.env.USER_TYPE!==`ant`?null:Zv||ey}function Gv(){return Yv&&Zv!==null&&process.env.USER_TYPE===`ant`}function Kv(){return Qv!==null}function qv(e){if(Qv===null||!e)return null;if($v!==null&&Date.now()>=$v)return Vv(),null;$v===null&&($v=Date.now()+Qv);let t=$v-Date.now(),n={...Jv};return n[`retry-after`]=String(Math.max(1,Math.ceil(t/1e3))),n}var Jv,Yv,Xv,Zv,Qv,$v,ey,ty,ny=t((()=>{Rv(),Jv={},Yv=!1,Xv=null,Zv=null,Qv=null,$v=null,ey=`max`}));async function ry(){let e=H().oauthAccount?.accountUuid,t=MC();if(!e||!t)return;let n=`${P().BASE_API_URL}/api/claude_cli_profile`;try{return(await v.get(n,{headers:{"x-api-key":t,"anthropic-beta":Dr},params:{account_uuid:e},timeout:1e4})).data}catch(e){I(e)}}async function iy(e){let t=`${P().BASE_API_URL}/api/oauth/profile`;try{return(await v.get(t,{headers:{Authorization:`Bearer ${e}`,"Content-Type":`application/json`},timeout:1e4})).data}catch(e){I(e)}}var ay=t((()=>{Ie(),kr(),Q(),rp(),Vr()}));function oy(e){return!!e?.includes(Tr)}function sy(e){return e?.split(` `).filter(Boolean)??[]}function cy({codeChallenge:e,state:t,port:n,isManual:r,loginWithClaudeAi:i,inferenceOnly:a,orgUUID:o,loginHint:s,loginMethod:c}){let l=i?P().CLAUDE_AI_AUTHORIZE_URL:P().CONSOLE_AUTHORIZE_URL,u=new URL(l);u.searchParams.append(`code`,`true`),u.searchParams.append(`client_id`,P().CLIENT_ID),u.searchParams.append(`response_type`,`code`),u.searchParams.append(`redirect_uri`,r?P().MANUAL_REDIRECT_URL:`http://localhost:${n}/callback`);let d=a?[Tr]:Or;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 ly(e,t,n,r,i=!1,a){let o={grant_type:`authorization_code`,code:e,redirect_uri:i?P().MANUAL_REDIRECT_URL:`http://localhost:${r}/callback`,client_id:P().CLIENT_ID,code_verifier:n,state:t};a!==void 0&&(o.expires_in=a);let s=await v.post(P().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 N(`tengu_oauth_token_exchange_success`,{}),s.data}async function uy(e,{scopes:t}={}){let n={grant_type:`refresh_token`,refresh_token:e,client_id:P().CLIENT_ID,scope:(t?.length?t:Er).join(` `)};try{let t=await v.post(P().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=sy(r.scope);N(`tengu_oauth_token_refresh_success`,{});let l=H(),u=Z(),d=l.oauthAccount?.billingType!==void 0&&l.oauthAccount?.accountCreatedAt!==void 0&&l.oauthAccount?.subscriptionCreatedAt!==void 0&&u?.subscriptionType!=null&&u?.rateLimitTier!=null?null:await my(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&&V(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=v.isAxiosError(e)&&e.response?.data?JSON.stringify(e.response.data):void 0;throw N(`tengu_oauth_token_refresh_failure`,{error:e.message,...t&&{responseBody:t}}),e}}async function dy(e){let t=await v.get(P().ROLES_URL,{headers:{Authorization:`Bearer ${e}`}});if(t.status!==200)throw Error(`Failed to fetch user roles: ${t.statusText}`);let n=t.data;if(!H().oauthAccount)throw Error(`OAuth account information not found in config`);V(e=>({...e,oauthAccount:e.oauthAccount?{...e.oauthAccount,organizationRole:n.organization_role,workspaceRole:n.workspace_role,organizationName:n.organization_name}:e.oauthAccount})),N(`tengu_oauth_roles_stored`,{org_role:n.organization_role})}async function fy(e){try{let t=await v.post(P().API_KEY_URL,null,{headers:{Authorization:`Bearer ${e}`}}),n=t.data?.raw_key;return n?(await cw(n),N(`tengu_oauth_api_key`,{status:`success`,statusCode:t.status}),n):null}catch(e){throw N(`tengu_oauth_api_key`,{status:`failure`,error:e instanceof Error?e.message:String(e)}),e}}function py(e){return e===null?!1:Date.now()+300*1e3>=e}async function my(e){let t=await iy(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),N(`tengu_oauth_profile_fetch_success`,{}),{...i,rawProfile:t}}async function hy(){let e=H().oauthAccount?.organizationUuid;if(e)return e;let t=Z()?.accessToken;return t===void 0||!bw()?null:(await iy(t))?.organization?.uuid||null}async function gy(){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&&(H().oauthAccount||_y({accountUuid:e,emailAddress:t,organizationUuid:n})),await vw();let i=H();if(i.oauthAccount&&i.oauthAccount.billingType!==void 0&&i.oauthAccount.accountCreatedAt!==void 0&&i.oauthAccount.subscriptionCreatedAt!==void 0||!Y()||!bw())return!1;let a=Z();if(a?.accessToken){let e=await iy(a.accessToken);if(e)return r&&A(`OAuth profile fetch succeeded, overriding env var account info`,{level:`info`}),_y({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 _y({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),V(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 vy=t((()=>{Ie(),hr(),kr(),Q(),rp(),M(),ay()}));function yy(e,t,n){if(g(process.env.CLAUDE_CODE_REMOTE))try{ea(wy,{recursive:!0,mode:448}),ia(e,t,{encoding:`utf8`,mode:384}),A(`Persisted ${n} to ${e} for subprocess access`)}catch(e){A(`Failed to persist ${n} to disk (non-fatal): ${An(e)}`,{level:`error`})}}function by(e,t){try{let n=j().readFileSync(e,{encoding:`utf8`}).trim();return n?(A(`Read ${t} from well-known file ${e}`),n):null}catch(n){return Fn(n)||A(`Failed to read ${t} from ${e}: ${An(n)}`,{level:`debug`}),null}}function xy({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=by(t,n);return i(e),e}let s=parseInt(o,10);if(Number.isNaN(s))return A(`${e} must be a valid file descriptor number, got: ${o}`,{level:`error`}),i(null),null;try{let e=j(),r=process.platform===`darwin`||process.platform===`freebsd`?`/dev/fd/${s}`:`/proc/self/fd/${s}`,a=e.readFileSync(r,{encoding:`utf8`}).trim();return a?(A(`Successfully read ${n} from file descriptor ${s}`),i(a),yy(t,a,n),a):(A(`File descriptor contained empty ${n}`,{level:`error`}),i(null),null)}catch(e){A(`Failed to read ${n} from file descriptor ${s}: ${An(e)}`,{level:`error`});let r=by(t,n);return i(r),r}}function Sy(){return xy({envVar:`CLAUDE_CODE_OAUTH_TOKEN_FILE_DESCRIPTOR`,wellKnownPath:Ty,label:`OAuth token`,getCached:Gt,setCached:Jt})}function Cy(){return xy({envVar:`CLAUDE_CODE_API_KEY_FILE_DESCRIPTOR`,wellKnownPath:Ey,label:`API key`,getCached:wn,setCached:ot})}var wy,Ty,Ey,Dy,Oy=t((()=>{O(),M(),h(),In(),Jn(),wy=`/home/claude/.claude/remote`,Ty=`${wy}/.oauth_token`,Ey=`${wy}/.api_key`,Dy=`${wy}/.session_ingress_token`}));function ky(e=``){let t=ae(),n=process.env.CLAUDE_CONFIG_DIR?`-${aa(`sha256`).update(t).digest(`hex`).substring(0,8)}`:``;return`Claude Code${P().OAUTH_FILE_SUFFIX}${e}${n}`}function Ay(){try{return process.env.USER||Hi().username}catch{return`claude-code-user`}}function jy(){K.cache={data:null,cachedAt:0},K.generation++,K.readInFlight=null}function My(e){if(K.cache.cachedAt!==0)return;let t=null;if(e)try{t=JSON.parse(e)}catch{return}K.cache={data:t,cachedAt:Date.now()}}var Ny,K,Py=t((()=>{kr(),h(),Ny=`-credentials`,K={cache:{data:null,cachedAt:0},generation:0,readInFlight:null}}));async function Fy(){if(process.platform===`darwin`&&(await Pr(`security delete-generic-password -a $USER -s "${ky()}"`,{shell:!0,reject:!1})).exitCode!==0)throw Error(`Failed to delete keychain entry`)}function Iy(e){return e.slice(-20)}var Ly=t((()=>{Nr(),Py()}));function Ry(e){return e?.name===`CredentialsProviderError`}function zy(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 By(){let{STSClient:e,GetCallerIdentityCommand:t}=await import(`./dist-es-D1LN6CJd.js`);await new e().send(new t({}))}async function Vy(){try{A(`Clearing AWS credential provider cache`);let{fromIni:e}=await import(`./dist-es-DGn8uOwQ2.js`);await e({ignoreCache:!0})(),A(`AWS credential provider cache refreshed`)}catch{A(`Failed to clear AWS credential cache (this is expected if no credentials are configured)`)}}var Hy=t((()=>{M()})),Uy,Wy=t((()=>{ft(),ce(),Uy=class e{constructor(){_(this,`status`,{isAuthenticating:!1,output:[]}),_(this,`changed`,Ot()),_(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)}},_(Uy,`instance`,null)})),Gy,Ky,qy,Jy,Yy,Xy,Zy,Qy,$y,eb,tb,nb,rb,ib,ab,ob,sb,cb,lb=t((()=>{Gy=`claude-code-20250219`,Ky=`interleaved-thinking-2025-05-14`,qy=`context-1m-2025-08-07`,Jy=`context-management-2025-06-27`,Yy=`structured-outputs-2025-12-15`,Xy=`web-search-2025-03-05`,Zy=`tool-search-tool-2025-10-19`,Qy=`effort-2025-11-24`,$y=`task-budgets-2026-03-13`,eb=`prompt-caching-scope-2026-01-05`,tb=`fast-mode-2026-02-01`,nb=`redact-thinking-2026-02-12`,rb=`token-efficient-tools-2026-03-28`,ib=`afk-mode-2026-01-31`,ab=process.env.USER_TYPE===`ant`?`cli-internal-2026-02-09`:``,ob=`advisor-tool-2026-03-01`,sb=new Set([Ky,qy,Zy]),cb=new Set([Gy,Ky,Jy])}));function ub(){return process.env.USER_TYPE===`ant`?kO(`tengu_ant_model_override`,null):null}function db(){return process.env.USER_TYPE===`ant`?ub()?.antModels??[]:[]}function fb(e){if(process.env.USER_TYPE!==`ant`||e===void 0)return;let t=e.toLowerCase();return db().find(n=>n.alias===e||t.includes(n.model.toLowerCase()))}var pb=t((()=>{ak()}));function mb(){return!g(process.env.CLAUDE_CODE_DISABLE_FAST_MODE)}function hb(){return mb()?_b()===null:!1}function gb(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 · /extra-usage to enable`;case`network_error`:return`Fast mode unavailable due to network connectivity issues`;case`unknown`:return`Fast mode is currently unavailable`}}function _b(){if(!mb())return`Fast mode is not available`;let e=kO(`tengu_penguins_off`,null);if(e!==null)return A(`Fast mode unavailable: ${e}`),e;if(!Ar()&&kO(`tengu_marble_sandcastle`,!1))return`Fast mode requires the native binary · Install from: https://claude.com/product/claude-code`;if(Mt()&&rn()&&!xt()&&!U(`flagSettings`)?.fastMode){let e=`Fast mode is not available in the Agent SDK`;return A(`Fast mode unavailable: ${e}`),e}if(W()!==`firstParty`){let e=`Fast mode is not available on Bedrock, Vertex, or Foundry`;return A(`Fast mode unavailable: ${e}`),e}if(q.status===`disabled`){if((q.reason===`network_error`||q.reason===`unknown`)&&g(process.env.CLAUDE_CODE_SKIP_FAST_MODE_NETWORK_ERRORS))return null;let e=Z()===null?`api-key`:`oauth`,t=gb(q.reason,e);return A(`Fast mode unavailable: ${t}`),t}return null}function vb(){return`opus`+(Wx()?`[1m]`:``)}function yb(e){if(!mb()||!hb()||!bb(e))return!1;let t=z_();return t.fastModePerSessionOptIn?!1:t.fastMode===!0}function bb(e){if(!mb())return!1;let t=Yx(e??Rx());return t.toLowerCase().includes(`opus-4-7`)||t.toLowerCase().includes(`opus-4-6`)}function xb(){return Pb.status===`cooldown`&&Date.now()>=Pb.resetAt&&(mb()&&!Fb&&(A(`Fast mode cooldown expired, re-enabling fast mode`),Fb=!0,Lb.emit()),Pb={status:`active`}),Pb}function Sb(e,t){if(!mb())return;Pb={status:`cooldown`,resetAt:e,reason:t},Fb=!1;let n=e-Date.now();A(`Fast mode cooldown triggered (${t}), duration ${Math.round(n/1e3)}s`),N(`tengu_fast_mode_fallback_triggered`,{cooldown_duration_ms:n,cooldown_reason:t}),Ib.emit(e,t)}function Cb(){Pb={status:`active`}}function wb(){q.status!==`disabled`&&(q={status:`disabled`,reason:`preference`},P_(`userSettings`,{fastMode:void 0}),V(e=>({...e,penguinModeOrgEnabled:!1})),Hb.emit(!1))}function Tb(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 · /extra-usage to enable`;default:return`Fast mode disabled · extra usage not available`}}function Eb(e){return e===`org_level_disabled_until`||e===`out_of_credits`}function Db(e){let t=Tb(e);A(`Fast mode overage rejection: ${e??`unknown`} — ${t}`),N(`tengu_fast_mode_overage_rejected`,{overage_disabled_reason:e??`unknown`}),Eb(e)||(P_(`userSettings`,{fastMode:void 0}),V(e=>({...e,penguinModeOrgEnabled:!1}))),Bb.emit(t)}function Ob(){return xb().status===`cooldown`}function kb(e,t){let n=mb()&&hb()&&!!t&&bb(e);return n&&Ob()?`cooldown`:n?`on`:`off`}async function Ab(e){let t=`${P().BASE_API_URL}/api/claude_code_penguin_mode`,n=`accessToken`in e?{Authorization:`Bearer ${e.accessToken}`,"anthropic-beta":Dr}:{"x-api-key":e.apiKey};return(await v.get(t,{headers:n})).data}function jb(){if(!mb()||q.status!==`pending`)return;let e=process.env.USER_TYPE===`ant`,t=H().penguinModeOrgEnabled===!0;q=e||t?{status:`enabled`}:{status:`disabled`,reason:`unknown`}}async function Mb(){if(Br()||!mb())return;if(Kb)return A(`Fast mode prefetch in progress, returning in-flight promise`),Kb;let e=MC();if(!(Z()?.accessToken&&bw())&&!e){let e=process.env.USER_TYPE===`ant`,t=H().penguinModeOrgEnabled===!0;q=e||t?{status:`enabled`}:{status:`disabled`,reason:`preference`};return}let t=Date.now();if(t-Gb<Wb){A(`Skipping fast mode prefetch, fetched recently`);return}Gb=t;let n=async()=>{let t=Z(),n=t?.accessToken&&bw()?{accessToken:t.accessToken}:e?{apiKey:e}:null;if(!n)throw Error(`No auth available`);return Ab(n)};async function r(){try{let e;try{e=await n()}catch(t){if(v.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=Z()?.accessToken;if(r)await hw(r),e=await n();else throw t}else throw t}let t=q.status===`pending`?H().penguinModeOrgEnabled:q.status===`enabled`;q=e.enabled?{status:`enabled`}:{status:`disabled`,reason:e.disabled_reason??`preference`},t!==e.enabled&&(e.enabled||P_(`userSettings`,{fastMode:void 0}),V(t=>({...t,penguinModeOrgEnabled:e.enabled})),Hb.emit(e.enabled)),A(`Org fast mode: ${e.enabled?`enabled`:`disabled (${e.disabled_reason??`preference`})`}`)}catch(e){let t=process.env.USER_TYPE===`ant`,n=H().penguinModeOrgEnabled===!0;q=t||n?{status:`enabled`}:{status:`disabled`,reason:`network_error`},A(`Failed to fetch org fast mode status, defaulting to ${q.status===`enabled`?`enabled (cached)`:`disabled (network_error)`}: ${e}`,{level:`error`}),N(`tengu_org_penguin_mode_fetch_failed`,{})}finally{Kb=null}}return Kb=r(),Kb}var Nb,Pb,Fb,Ib,Lb,Rb,zb,Bb,Vb,q,Hb,Ub,Wb,Gb,Kb,qb=t((()=>{Ie(),kr(),ak(),O(),hr(),Q(),jr(),rp(),M(),h(),rS(),wv(),zr(),Y_(),ft(),Nb=`Opus 4.7`,Pb={status:`active`},Fb=!1,Ib=Ot(),Lb=Ot(),Rb=Ib.subscribe,zb=Lb.subscribe,Bb=Ot(),Vb=Bb.subscribe,q={status:`pending`},Hb=Ot(),Ub=Hb.subscribe,Wb=3e4,Gb=0,Kb=null}));function Jb(e){return mb()&&e?ax:ix}function Yb(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 Xb(e,t){let n=Bx(e);return n===J(gv.firstParty)?Jb(t.speed===`fast`):lx[n]||(Zb(e,n),lx[Bx(Rx())]??cx)}function Zb(e,t){N(`tengu_unknown_model_cost`,{model:e,shortName:t}),rt()}function Qb(e,t){return Yb(Xb(e,t),t)}function $b(e,t){return Qb(e,{input_tokens:t.inputTokens,output_tokens:t.outputTokens,cache_read_input_tokens:t.cacheReadInputTokens,cache_creation_input_tokens:t.cacheCreationInputTokens})}function ex(e){return Number.isInteger(e)?`$${e}`:`$${e.toFixed(2)}`}function tx(e){return`${ex(e.inputTokens)}/${ex(e.outputTokens)} per Mtok`}var nx,rx,ix,ax,ox,sx,cx,lx,ux=t((()=>{hr(),O(),qb(),xv(),rS(),nx={inputTokens:3,outputTokens:15,promptCacheWriteTokens:3.75,promptCacheReadTokens:.3,webSearchRequests:.01},rx={inputTokens:15,outputTokens:75,promptCacheWriteTokens:18.75,promptCacheReadTokens:1.5,webSearchRequests:.01},ix={inputTokens:5,outputTokens:25,promptCacheWriteTokens:6.25,promptCacheReadTokens:.5,webSearchRequests:.01},ax={inputTokens:30,outputTokens:150,promptCacheWriteTokens:37.5,promptCacheReadTokens:3,webSearchRequests:.01},ox={inputTokens:.8,outputTokens:4,promptCacheWriteTokens:1,promptCacheReadTokens:.08,webSearchRequests:.01},sx={inputTokens:1,outputTokens:5,promptCacheWriteTokens:1.25,promptCacheReadTokens:.1,webSearchRequests:.01},cx=ix,lx={[J(lv.firstParty)]:ox,[J(uv.firstParty)]:sx,[J(cv.firstParty)]:nx,[J(sv.firstParty)]:nx,[J(dv.firstParty)]:nx,[J(fv.firstParty)]:nx,[J(vv.firstParty)]:nx,[J(pv.firstParty)]:rx,[J(mv.firstParty)]:rx,[J(hv.firstParty)]:ix,[J(gv.firstParty)]:ix}}));function dx(e){return px.includes(e)}function fx(e){return mx.includes(e)}var px,mx,hx=t((()=>{px=[`sonnet`,`opus`,`haiku`,`best`,`sonnet[1m]`,`opus[1m]`,`opusplan`],mx=[`sonnet`,`opus`,`haiku`]}));function gx(e,t){return e.includes(t)?!0:dx(e)?Yx(e).toLowerCase().includes(t):!1}function _x(e,t){return e.startsWith(t)?e.length===t.length||e[t.length]===`-`:!1}function vx(e,t){let n=dx(e)?Yx(e).toLowerCase():e;return!!(_x(n,t)||!t.startsWith(`claude-`)&&_x(n,`claude-${t}`))}function yx(e,t){for(let n of t){if(fx(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 bx(e){let{availableModels:t}=J_()||{};if(!t)return!0;if(t.length===0)return!1;let n=Ov(e).trim().toLowerCase(),r=t.map(e=>e.trim().toLowerCase());if(r.includes(n)&&(!fx(n)||!yx(n,r)))return!0;for(let e of r)if(fx(e)&&!yx(e,r)&&gx(n,e))return!0;if(dx(n)){let e=Yx(n).toLowerCase();if(r.includes(e))return!0}for(let e of r)if(!fx(e)&&dx(e)&&Yx(e).toLowerCase()===n)return!0;for(let e of r)if(!fx(e)&&!dx(e)&&vx(n,e))return!0;return!1}var xx=t((()=>{Y_(),hx(),rS(),Nv()}));function Sx(){return process.env.OPENAI_AUTH_MODE===`chatgpt`}function Cx(e){let t=e.toLowerCase().replace(/\[1m\]$/,``);return Ex.some(e=>e.value.toLowerCase()===t)}var wx,Tx,Ex,Dx=t((()=>{wx=`gpt-5.5`,Tx=`gpt-5.4-mini`,Ex=[{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 Ox(){let e=W();return e===`openai`&&Sx()?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||Ix()}function kx(e){return e===G().opus40||e===G().opus41||e===G().opus45||e===G().opus46||e===G().opus47}function Ax(){let e,t=$t();if(t!==void 0)e=t;else{let t=J_()||{};e=process.env.ANTHROPIC_MODEL||t.model||void 0}if(!(e&&!bx(e)))return e}function jx(){let e=Ax();return e==null?zx():Yx(e)}function Mx(){return Px()}function Nx(){let e=W();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 Px(){let e=W();return e===`openai`&&Sx()?wx: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:Nx()||G().opus47}function Fx(){let e=W();return e===`openai`&&Sx()?wx: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:Nx()||(e===`firstParty`?G().sonnet46:G().sonnet45)}function Ix(){let e=W();return e===`openai`&&Sx()?Tx: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:Nx()||G().haiku45}function Lx(e){let{permissionMode:t,mainLoopModel:n,exceeds200kTokens:r=!1}=e;return Ax()===`opusplan`&&t===`plan`&&!r?Px():Ax()===`haiku`&&t===`plan`?Fx():n}function Rx(){return process.env.USER_TYPE===`ant`?ub()?.defaultModel??Px()+`[1m]`:Tw()||Dw()?Px()+(Wx()?`[1m]`:``):Fx()}function zx(){return Yx(Rx())}function J(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 Bx(e){return J(Ov(e))}function Vx(e=!1){return Tw()||Dw()?Wx()?`Opus 4.7 with 1M context · Most capable for complex work${e?Ux(!0):``}`:`Opus 4.7 · Most capable for complex work${e?Ux(!0):``}`:`Sonnet 4.6 · Best for everyday tasks`}function Hx(e){return e===`opusplan`?`Opus 4.7 in plan mode, else Sonnet 4.6`:Jx(Yx(e))}function Ux(e){if(W()!==`firstParty`)return``;let t=tx(Jb(e));return` ·${e?` (↯)`:``} ${t}`}function Wx(){return!(xS()||kw()||W()!==`firstParty`||!Cv()||Y()&&X()===null)}function Gx(e){return e===`opusplan`?`Opus Plan`:dx(e)?Yh(e):Jx(e)}function Kx(e){switch(e){case G().opus47:return`Opus 4.7`;case G().opus47+`[1m]`:return`Opus 4.7 (1M context)`;case G().opus46:return`Opus 4.6`;case G().opus46+`[1m]`:return`Opus 4.6 (1M context)`;case G().opus45:return`Opus 4.5`;case G().opus41:return`Opus 4.1`;case G().opus40:return`Opus 4`;case G().sonnet46+`[1m]`:return`Sonnet 4.6 (1M context)`;case G().sonnet46:return`Sonnet 4.6`;case G().sonnet45+`[1m]`:return`Sonnet 4.5 (1M context)`;case G().sonnet45:return`Sonnet 4.5`;case G().sonnet40:return`Sonnet 4`;case G().sonnet40+`[1m]`:return`Sonnet 4 (1M context)`;case G().sonnet37:return`Sonnet 3.7`;case G().sonnet35:return`Sonnet 3.5`;case G().haiku45:return`Haiku 4.5`;case G().haiku35:return`Haiku 3.5`;default:return null}}function qx(e){let[t=``,...n]=e.split(`-`);return[t.slice(0,3)+`*`.repeat(Math.max(0,t.length-3)),...n].join(`-`)}function Jx(e){let t=Kx(e);if(t)return t;if(process.env.USER_TYPE===`ant`){let t=Yx(e),n=fb(e);return n?qx(n.model.replace(/\[1m\]$/i,``))+(SS(t)?`[1m]`:``):t===e?t:`${e} (${t})`}return e}function Yx(e){let t=e.trim(),n=t.toLowerCase(),r=SS(n),i=r?n.replace(/\[1m]$/i,``).trim():n;if(dx(i))switch(i){case`opusplan`:return Fx()+(r?`[1m]`:``);case`sonnet`:return Fx()+(r?`[1m]`:``);case`haiku`:return Ix()+(r?`[1m]`:``);case`opus`:return Px()+(r?`[1m]`:``);case`best`:return Mx();default:}if(W()===`firstParty`&&Zx(i)&&Qx())return Px()+(r?`[1m]`:``);if(process.env.USER_TYPE===`ant`){let e=SS(n),t=fb(n.replace(/\[1m]$/i,``).trim());if(t){let n=e?`[1m]`:``;return t.model+n}}return r?t.replace(/\[1m\]$/i,``).trim()+`[1m]`:t}function Xx(e,t){return SS(e)||!SS(t)?e:CS(Yx(e))?e+`[1m]`:e}function Zx(e){return nS.includes(e)}function Qx(){return!g(process.env.CLAUDE_CODE_DISABLE_LEGACY_MODEL_REMAP)}function $x(e){if(e===null)return process.env.USER_TYPE===`ant`?`Default for Ants (${Hx(Rx())})`:Y()?`Default (${Vx()})`:`Default (${zx()})`;let t=Yx(e);return e===t?t:`${e} (${t})`}function eS(e){if(W()===`foundry`)return;let t=e.toLowerCase().includes(`[1m]`),n=Bx(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 tS(e){return e.replace(/\[(1|2)m\]/gi,``)}var nS,rS=t((()=>{O(),pb(),Q(),FS(),h(),Nv(),ux(),Y_(),wv(),Up(),xx(),hx(),ag(),Dx(),nS=[`claude-opus-4-20250514`,`claude-opus-4-1-20250805`,`claude-opus-4-0`,`claude-opus-4-1`]}));function iS(){return{error:(e,...t)=>console.error(`[Anthropic SDK ERROR]`,e,...t),warn:(e,...t)=>console.error(`[Anthropic SDK WARN]`,e,...t),info:(e,...t)=>console.error(`[Anthropic SDK INFO]`,e,...t),debug:(e,...t)=>console.error(`[Anthropic SDK DEBUG]`,e,...t)}}async function aS({apiKey:e,maxRetries:t,model:r,fetchOverride:i,source:a}){let o=process.env.CLAUDE_CODE_CONTAINER_ID,s=process.env.CLAUDE_CODE_REMOTE_SESSION_ID,c=process.env.CLAUDE_AGENT_SDK_CLIENT_APP,l=sS(),u={"x-app":`cli`,"User-Agent":fT(),"X-Claude-Code-Session-Id":at(),...l,...o?{"x-claude-remote-container-id":o}:{},...s?{"x-claude-remote-session-id":s}:{},...c?{"x-client-app":c}:{},...process.env.ANTHROPIC_AUTH_NONCE?{"x-auth-nonce":process.env.ANTHROPIC_AUTH_NONCE}:{}};A(`[API:request] Creating client, ANTHROPIC_CUSTOM_HEADERS present: ${!!process.env.ANTHROPIC_CUSTOM_HEADERS}, has Authorization header: ${!!l.Authorization}`),g(process.env.CLAUDE_CODE_ADDITIONAL_PROTECTION)&&(u[`x-anthropic-additional-protection`]=`true`),A(`[API:auth] OAuth token check starting`),await vw(),A(`[API:auth] OAuth token check complete`),Y()||await oS(u,Mt());let d=cS(i,a),f={defaultHeaders:u,maxRetries:t,timeout:parseInt(process.env.API_TIMEOUT_MS||`600000`,10),dangerouslyAllowBrowser:!0,fetchOptions:Ni({forAnthropicAPI:!0}),...d&&{fetch:d}};if(g(process.env.CLAUDE_CODE_USE_BEDROCK)){let{BedrockClient:e}=await import(`./bedrockClient-qi1-JCOK.js`),t=r===Ox()&&process.env.ANTHROPIC_SMALL_FAST_MODEL_AWS_REGION?process.env.ANTHROPIC_SMALL_FAST_MODEL_AWS_REGION:oe(),n={...f,awsRegion:t,...g(process.env.CLAUDE_CODE_SKIP_BEDROCK_AUTH)&&{skipAuth:!0},...Qn()&&{logger:iS()}};if(process.env.AWS_BEARER_TOKEN_BEDROCK)n.skipAuth=!0,n.defaultHeaders={...n.defaultHeaders,Authorization:`Bearer ${process.env.AWS_BEARER_TOKEN_BEDROCK}`};else if(!g(process.env.CLAUDE_CODE_SKIP_BEDROCK_AUTH)){let e=await Kw();e&&(n.awsAccessKey=e.accessKeyId,n.awsSecretKey=e.secretAccessKey,n.awsSessionToken=e.sessionToken)}return new e(n)}if(g(process.env.CLAUDE_CODE_USE_FOUNDRY)){let{AnthropicFoundry:e}=await import(`./foundry-sdk-BFN5VDFQ.js`),t;if(!process.env.ANTHROPIC_FOUNDRY_API_KEY)if(g(process.env.CLAUDE_CODE_SKIP_FOUNDRY_AUTH))t=()=>Promise.resolve(``);else{let{DefaultAzureCredential:e,getBearerTokenProvider:n}=await import(`./esm-CsGLyWmS.js`);t=n(new e,`https://cognitiveservices.azure.com/.default`)}return new e({...f,...t&&{azureADTokenProvider:t},...Qn()&&{logger:iS()}})}if(g(process.env.CLAUDE_CODE_USE_VERTEX)){g(process.env.CLAUDE_CODE_SKIP_VERTEX_AUTH)||await Xw();let[{AnthropicVertex:e},{GoogleAuth:t}]=await Promise.all([import(`./vertex-sdk-CSGw3fvU.js`),import(`./src-hdbPEvzO.js`).then(e=>n(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,o=g(process.env.CLAUDE_CODE_SKIP_VERTEX_AUTH)?{getClient:()=>({getRequestHeaders:()=>({})})}:new t({scopes:[`https://www.googleapis.com/auth/cloud-platform`],...i||a?{}:{projectId:process.env.ANTHROPIC_VERTEX_PROJECT_ID}});return new e({...f,region:te(r),googleAuth:o,...Qn()&&{logger:iS()}})}return new se({apiKey:Y()?null:e||MC(),authToken:Y()?Z()?.accessToken:void 0,...process.env.USER_TYPE===`ant`&&g(process.env.USE_STAGING_OAUTH)?{baseURL:P().BASE_API_URL}:{},...f,...Qn()&&{logger:iS()}})}async function oS(e,t){let n=process.env.ANTHROPIC_AUTH_TOKEN||await UC(t);n&&(e.Authorization=`Bearer ${n}`)}function sS(){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 cS(e,t){let n=e??globalThis.fetch,r=W()===`firstParty`&&Cv();return(e,i)=>{let a=new Headers(i?.headers);r&&!a.has(`x-client-request-id`)&&a.set(lS,sa());try{let n=e instanceof Request?e.url:String(e),r=a.get(lS);A(`[API REQUEST] ${new URL(n).pathname}${r?` ${lS}=${r}`:``} source=${t??`unknown`}`)}catch{}return n(e,{...i,headers:a})}}var lS,uS=t((()=>{vr(),Q(),_T(),rS(),wv(),Pi(),O(),kr(),M(),h(),lS=`x-client-request-id`}));function dS(){return R(ae(),`cache`)}function fS(){return R(dS(),`model-capabilities.json`)}function pS(){return!(W()!==`firstParty`||!Cv())}function mS(e){return[...e].sort((e,t)=>t.id.length-e.id.length||e.id.localeCompare(t.id))}function hS(e){if(!pS())return;let t=yS(fS());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 gS(){if(pS()&&!Br())try{let e=await aS({maxRetries:1}),t=Y()?[Dr]:void 0,n=[];for await(let r of e.models.list({betas:t})){let e=_S().safeParse(r);e.success&&n.push(e.data)}if(n.length===0)return;let r=fS(),i=mS(n);if(ku(yS(r),i)){A(`[modelCapabilities] cache unchanged, skipping write`);return}await la(dS(),{recursive:!0}),await ha(r,k({models:i,timestamp:Date.now()}),{encoding:`utf-8`,mode:384}),yS.cache.delete(r),A(`[modelCapabilities] cached ${i.length} models`)}catch(e){A(`[modelCapabilities] fetch failed: ${e instanceof Error?e.message:`unknown`}`)}}var _S,vS,yS,bS=t((()=>{Au(),m(),Je(),kr(),uS(),Q(),M(),h(),di(),Ei(),zr(),ur(),wv(),_S=L(()=>D({id:b(),max_input_tokens:y().optional(),max_tokens:y().optional()}).strip()),vS=L(()=>D({models:S(_S()),timestamp:y()})),yS=p(e=>{try{let t=ta(e,`utf-8`),n=vS().safeParse(fi(t,!1));return n.success?n.data.models:null}catch{return null}},e=>e)}));function xS(){return g(process.env.CLAUDE_CODE_DISABLE_1M_CONTEXT)}function SS(e){return xS()?!1:/\[1m\]/i.test(e)}function CS(e){if(xS())return!1;let t=Bx(e);return t.includes(`claude-sonnet-4`)||t.includes(`opus-4-6`)||t.includes(`opus-4-7`)}function wS(e,t){if(process.env.USER_TYPE===`ant`&&process.env.CLAUDE_CODE_MAX_CONTEXT_TOKENS){let e=parseInt(process.env.CLAUDE_CODE_MAX_CONTEXT_TOKENS,10);if(!isNaN(e)&&e>0)return e}if(SS(e))return 1e6;let n=hS(e);if(n?.max_input_tokens&&n.max_input_tokens>=1e5)return n.max_input_tokens>2e5&&xS()?kS:n.max_input_tokens;if(t?.includes(`context-1m-2025-08-07`)&&CS(e)||TS(e))return 1e6;if(process.env.USER_TYPE===`ant`){let t=fb(e);if(t?.contextWindow)return t.contextWindow}return kS}function TS(e){return xS()||SS(e)||!Bx(e).includes(`sonnet-4-6`)?!1:H().clientDataCache?.coral_reef_sonnet===`true`}function ES(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 DS(e){let t,n;if(process.env.USER_TYPE===`ant`){let r=fb(e.toLowerCase());if(r)return t=r.defaultMaxTokens??jS,n=r.upperMaxTokensLimit??MS,{default:t,upperLimit:n}}let r=Bx(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=jS,n=MS);let i=hS(e);return i?.max_tokens&&i.max_tokens>=4096&&(n=i.max_tokens,t=Math.min(t,n)),{default:t,upperLimit:n}}function OS(e){return DS(e).upperLimit-1}var kS,AS,jS,MS,NS,PS,FS=t((()=>{lb(),rp(),h(),rS(),pb(),bS(),kS=2e5,AS=2e4,jS=32e3,MS=64e3,NS=8e3,PS=64e3})),IS,LS,RS,zS=t((()=>{m(),wv(),IS=[{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`}],LS=[{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`}],RS=p((e,t)=>{if(W()===`firstParty`)return;let n=e.toLowerCase(),r=W()===`openai`?LS:IS;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 BS(e){let t=[],n=[];for(let r of e)ZS.includes(r)?t.push(r):n.push(r);return{allowed:t,disallowed:n}}function VS(e){if(!e||e.length===0)return;if(Y()){console.warn(`Warning: Custom betas are only available for API key users. Ignoring provided betas.`);return}let{allowed:t,disallowed:n}=BS(e);for(let e of n)console.warn(`Warning: Beta header '${e}' is not allowed. Only the following betas are supported: ${ZS.join(`, `)}`);return t.length>0?t:void 0}function HS(e){let t=RS(e,`interleaved_thinking`);if(t!==void 0)return t;let n=Bx(e),r=W();return r===`foundry`?!0:r===`firstParty`?!n.includes(`claude-3-`):n.includes(`claude-opus-4`)||n.includes(`claude-sonnet-4`)}function US(e){let t=Bx(e);return t.includes(`claude-opus-4`)||t.includes(`claude-sonnet-4`)||t.includes(`claude-haiku-4`)}function WS(e){let t=Bx(e),n=W();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 GS(e){let t=Bx(e),n=W();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 KS(e){return!0}function qS(){return(W()===`firstParty`||W()===`foundry`)&&!g(process.env.CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS)&&Cv()}function JS(){return W()===`firstParty`&&!g(process.env.CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS)}function YS(e,t){let n=[...$S(e)];t?.isAgenticQuery&&(n.includes(`claude-code-20250219`)||n.push(Gy),process.env.USER_TYPE===`ant`&&process.env.CLAUDE_CODE_ENTRYPOINT===`cli`&&ab&&!n.includes(ab)&&n.push(ab));let r=Cn();return!r||r.length===0?n:[...n,...r.filter(e=>!n.includes(e))]}function XS(){QS.cache?.clear?.(),$S.cache?.clear?.(),eC.cache?.clear?.()}var ZS,QS,$S,eC,tC=t((()=>{m(),ak(),O(),lb(),kr(),Q(),FS(),h(),rS(),zS(),wv(),Y_(),ZS=[qy],QS=p(e=>{let t=[],n=Bx(e).includes(`haiku`),r=W(),i=qS();n||(t.push(Gy),process.env.USER_TYPE===`ant`&&process.env.CLAUDE_CODE_ENTRYPOINT===`cli`&&ab&&t.push(ab)),Y()&&t.push(Dr),SS(e)&&t.push(qy),!g(process.env.DISABLE_INTERLEAVED_THINKING)&&HS(e)&&t.push(Ky),i&&HS(e)&&!Mt()&&z_().showThinkingSummaries!==!0&&t.push(nb);let a=g(process.env.USE_API_CONTEXT_MANAGEMENT)||WS(e),o=WS(e);qS()&&(a||o)&&t.push(Jy);let s=jO(`tengu_tool_pear`),c=!s&&kO(`tengu_amber_json_tools`,!1);return i&&GS(e)&&s&&t.push(Yy),process.env.USER_TYPE===`ant`&&i&&c&&t.push(rb),r===`vertex`&&US(e)&&t.push(Xy),r===`foundry`&&t.push(Xy),i&&t.push(eb),process.env.ANTHROPIC_BETAS&&t.push(...process.env.ANTHROPIC_BETAS.split(`,`).map(e=>e.trim()).filter(Boolean)),t}),$S=p(e=>{let t=QS(e);return W()===`bedrock`?t.filter(e=>!sb.has(e)):t}),eC=p(e=>QS(e).filter(e=>sb.has(e)))}));function nC(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 rC=t((()=>{}));async function iC(){try{let e=ky(Ny),{stdout:t,code:n}=await ai(`security`,[`find-generic-password`,`-a`,Ay(),`-w`,`-s`,e],{useCwd:!1,preserveOutputOnError:!1});if(n===0&&t)return Pn(t.trim())}catch{}return null}function aC(){if(cC!==void 0)return cC;if(process.platform!==`darwin`)return cC=!1,!1;try{cC=Mr(`security`,[`show-keychain-info`],{reject:!1,stdio:[`ignore`,`pipe`,`pipe`]}).exitCode===36}catch{cC=!1}return cC}var oC,sC,cC,lC=t((()=>{Nr(),M(),ii(),ti(),ur(),Py(),oC=4032,sC={name:`keychain`,read(){let e=K.cache;if(Date.now()-e.cachedAt<3e4)return e.data;try{let e=ky(Ny),t=ni(`security find-generic-password -a "${Ay()}" -w -s "${e}"`);if(t){let e=Pn(t);return K.cache={data:e,cachedAt:Date.now()},e}}catch{}return e.data===null?(K.cache={data:null,cachedAt:Date.now()},null):(A(`[keychain] read failed; serving stale cache`,{level:`warn`}),K.cache={data:e.data,cachedAt:Date.now()},e.data)},async readAsync(){let e=K.cache;if(Date.now()-e.cachedAt<3e4)return e.data;if(K.readInFlight)return K.readInFlight;let t=K.generation,n=iC().then(n=>{if(t===K.generation){n===null&&e.data!==null&&A(`[keychain] readAsync failed; serving stale cache`,{level:`warn`});let t=n??e.data;return K.cache={data:t,cachedAt:Date.now()},K.readInFlight=null,t}return n});return K.readInFlight=n,n},update(e){jy();try{let t=ky(Ny),n=Ay(),r=k(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<=oC?o=Mr(`security`,[`-i`],{input:a,stdio:[`pipe`,`pipe`,`pipe`],reject:!1}):(A(`Keychain payload (${r.length}B JSON) exceeds security -i stdin limit; using argv`,{level:`warn`}),o=Mr(`security`,[`add-generic-password`,`-U`,`-a`,n,`-s`,t,`-X`,i],{stdio:[`ignore`,`pipe`,`pipe`],reject:!1})),o.exitCode===0?(K.cache={data:e,cachedAt:Date.now()},{success:!0}):{success:!1}}catch{return{success:!1}}},delete(){jy();try{let e=ky(Ny);return ni(`security delete-generic-password -a "${Ay()}" -s "${e}"`),!0}catch{return!1}}}}));function uC(){let e=ae();return{storageDir:e,storagePath:R(e,`.credentials.json`)}}var dC,fC=t((()=>{h(),In(),Jn(),ur(),dC={name:`plaintext`,read(){let{storagePath:e}=uC();try{return Pn(j().readFileSync(e,{encoding:`utf8`}))}catch{return null}},async readAsync(){let{storagePath:e}=uC();try{return Pn(await j().readFile(e,{encoding:`utf8`}))}catch{return null}},update(e){try{let{storageDir:t,storagePath:n}=uC();try{j().mkdirSync(t)}catch(e){if(Mn(e)!==`EEXIST`)throw e}return jn(n,k(e),{encoding:`utf8`,flush:!1}),Qi(n,384),{success:!0,warning:`Warning: Storing credentials in plaintext.`}}catch{return{success:!1}}},delete(){let{storagePath:e}=uC();try{return j().unlinkSync(e),!0}catch(e){return Mn(e)===`ENOENT`}}}}));function pC(){return process.platform===`darwin`?nC(sC,dC):dC}var mC=t((()=>{rC(),lC(),fC()}));function hC(e){return new Promise(t=>{_a(`security`,[`find-generic-password`,`-a`,Ay(),`-w`,`-s`,e],{encoding:`utf-8`,timeout:bC},(e,n)=>{t({stdout:e?null:n?.trim()||null,timedOut:!!(e&&`killed`in e&&e.killed)})})})}function gC(){if(process.platform!==`darwin`||SC||ne())return;let e=hC(ky(Ny)),t=hC(ky());SC=Promise.all([e,t]).then(([e,t])=>{e.timedOut||My(e.stdout),t.timedOut||(xC={stdout:t.stdout})})}async function _C(){SC&&await SC}function vC(){return xC}function yC(){xC=null}var bC,xC,SC,CC=t((()=>{h(),Py(),bC=1e4,xC=null,SC=null}));function wC(){return EC}function TC(){EC.clear()}var EC,DC=t((()=>{EC=new Map})),OC=r({calculateApiKeyHelperTTL:()=>VC,checkAndRefreshOAuthTokenIfNeeded:()=>vw,checkGcpCredentialsValid:()=>tw,clearApiKeyHelperCache:()=>qC,clearAwsCredentialsCache:()=>QC,clearGcpCredentialsCache:()=>iw,clearOAuthTokenCache:()=>pw,getAccountInformation:()=>Rw,getAnthropicApiKey:()=>MC,getAnthropicApiKeyWithSource:()=>PC,getApiKeyFromApiKeyHelper:()=>UC,getApiKeyFromApiKeyHelperCached:()=>KC,getApiKeyFromConfigOrMacOSKeychain:()=>Zw,getApiKeyHelperElapsedMs:()=>HC,getAuthTokenSource:()=>jC,getClaudeAIOAuthTokens:()=>Z,getClaudeAIOAuthTokensAsync:()=>_w,getConfiguredApiKeyHelper:()=>FC,getOauthAccountInfo:()=>Sw,getOtelHeadersFromHelper:()=>Fw,getRateLimitTier:()=>Aw,getSubscriptionName:()=>jw,getSubscriptionType:()=>X,handleOAuth401Error:()=>hw,hasAnthropicApiKeyAuth:()=>NC,hasOpusAccess:()=>ww,hasProfileScope:()=>bw,is1PApiCustomer:()=>xw,isAnthropicAuthEnabled:()=>AC,isAwsAuthRefreshFromProjectSettings:()=>RC,isAwsCredentialExportFromProjectSettings:()=>BC,isClaudeAISubscriber:()=>Y,isConsumerSubscriber:()=>Lw,isCustomApiKeyApproved:()=>lw,isEnterpriseSubscriber:()=>Ow,isGcpAuthRefreshFromProjectSettings:()=>ew,isMaxSubscriber:()=>Tw,isOtelHeadersHelperFromProjectOrLocalSettings:()=>Pw,isOverageProvisioningAllowed:()=>Cw,isProSubscriber:()=>kw,isTeamPremiumSubscriber:()=>Dw,isTeamSubscriber:()=>Ew,isUsing3PServices:()=>Mw,prefetchApiKeyFromApiKeyHelperIfSafe:()=>JC,prefetchAwsCredentialsAndBedRockInfoIfSafe:()=>ow,prefetchGcpCredentialsIfSafe:()=>aw,refreshAndGetAwsCredentials:()=>Kw,refreshAwsAuth:()=>XC,refreshGcpAuth:()=>rw,refreshGcpCredentialsIfNeeded:()=>Xw,removeApiKey:()=>uw,saveApiKey:()=>cw,saveOAuthTokensIfNeeded:()=>fw,validateForceLoginOrg:()=>zw});function kC(){return g(process.env.CLAUDE_CODE_REMOTE)||process.env.CLAUDE_CODE_ENTRYPOINT===`claude-desktop`}function AC(){if(ne())return!1;if(process.env.ANTHROPIC_UNIX_SOCKET)return!!process.env.CLAUDE_CODE_OAUTH_TOKEN;let e=J_()||{},t=g(process.env.CLAUDE_CODE_USE_BEDROCK)||g(process.env.CLAUDE_CODE_USE_VERTEX)||g(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}=PC({skipRetrievingKeyFromApiKeyHelper:!0}),a=i===`ANTHROPIC_API_KEY`||i===`apiKeyHelper`;return!(t||r&&!kC()||a&&!kC())}function jC(){if(ne())return FC()?{source:`apiKeyHelper`,hasToken:!0}:{source:`none`,hasToken:!1};if(process.env.ANTHROPIC_AUTH_TOKEN&&!kC())return{source:`ANTHROPIC_AUTH_TOKEN`,hasToken:!0};if(process.env.CLAUDE_CODE_OAUTH_TOKEN)return{source:`CLAUDE_CODE_OAUTH_TOKEN`,hasToken:!0};if(Sy())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(FC()&&!kC())return{source:`apiKeyHelper`,hasToken:!0};let e=Z();return oy(e?.scopes)&&e?.accessToken?{source:`claude.ai`,hasToken:!0}:{source:`none`,hasToken:!1}}function MC(){let{key:e}=PC();return e}function NC(){let{key:e,source:t}=PC({skipRetrievingKeyFromApiKeyHelper:!0});return e!==null&&t!==`none`}function PC(e={}){if(ne())return process.env.ANTHROPIC_API_KEY?{key:process.env.ANTHROPIC_API_KEY,source:`ANTHROPIC_API_KEY`}:FC()?{key:e.skipRetrievingKeyFromApiKeyHelper?null:KC(),source:`apiKeyHelper`}:{key:null,source:`none`};let t=re()?void 0:process.env.ANTHROPIC_API_KEY;if(rn()&&t)return{key:t,source:`ANTHROPIC_API_KEY`};if(g(process.env.CI)){let e=Cy();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&&H().customApiKeyResponses?.approved?.includes(Iy(t)))return{key:t,source:`ANTHROPIC_API_KEY`};let n=Cy();return n?{key:n,source:`ANTHROPIC_API_KEY`}:FC()?e.skipRetrievingKeyFromApiKeyHelper?{key:null,source:`apiKeyHelper`}:{key:KC(),source:`apiKeyHelper`}:Zw()||{key:null,source:`none`}}function FC(){return ne()?U(`flagSettings`)?.apiKeyHelper:(J_()||{}).apiKeyHelper}function IC(){let e=FC();if(!e)return!1;let t=U(`projectSettings`),n=U(`localSettings`);return t?.apiKeyHelper===e||n?.apiKeyHelper===e}function LC(){return(J_()||{}).awsAuthRefresh}function RC(){let e=LC();if(!e)return!1;let t=U(`projectSettings`),n=U(`localSettings`);return t?.awsAuthRefresh===e||n?.awsAuthRefresh===e}function zC(){return(J_()||{}).awsCredentialExport}function BC(){let e=zC();if(!e)return!1;let t=U(`projectSettings`),n=U(`localSettings`);return t?.awsCredentialExport===e||n?.awsCredentialExport===e}function VC(){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;A(`Found CLAUDE_CODE_API_KEY_HELPER_TTL_MS env var, but it was not a valid number. Got ${e}`,{level:`error`})}return Bw}function HC(){let e=Hw?.startedAt;return e?Date.now()-e:0}async function UC(e){if(!FC())return null;let t=VC();return Vw?(Date.now()-Vw.timestamp<t||Hw||(Hw={promise:WC(e,!1,Uw),startedAt:null}),Vw.value):(Hw||(Hw={promise:WC(e,!0,Uw),startedAt:Date.now()}),Hw.promise)}async function WC(e,t,n){try{let t=await GC(e);return n===Uw&&t!==null&&(Vw={value:t,timestamp:Date.now()}),t}catch(e){if(n!==Uw)return` `;let r=e instanceof Error?e.message:String(e);return console.error(Xe.red(`apiKeyHelper failed: ${r}`)),A(`Error getting API key from apiKeyHelper: ${r}`,{level:`error`}),!t&&Vw&&Vw.value!==` `?(Vw={...Vw,timestamp:Date.now()},Vw.value):(Vw={value:` `,timestamp:Date.now()},` `)}finally{n===Uw&&(Hw=null)}}async function GC(e){let t=FC();if(!t)return null;if(IC()&&!gf()&&!e)return sr(`apiKeyHelper invoked before trust check`,Error(`Security: apiKeyHelper executed before workspace trust is confirmed. If you see this message, post in .`)),N(`tengu_apiKeyHelper_missing_trust11`,{}),null;let n=await Pr(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 KC(){return Vw?.value??null}function qC(){Uw++,Vw=null,Hw=null}function JC(e){IC()&&!gf()||UC(e)}async function YC(){let e=LC();if(!e)return!1;if(RC()&&!gf()&&!Mt())return sr(`awsAuthRefresh invoked before trust check`,Error(`Security: awsAuthRefresh executed before workspace trust is confirmed. If you see this message, post in .`)),N(`tengu_awsAuthRefresh_missing_trust`,{}),!1;try{return A(`Fetching AWS caller identity for AWS auth refresh command`),await By(),A(`Fetched AWS caller identity, skipping AWS auth refresh command`),!1}catch{return XC(e)}}function XC(e){A(`Running AWS auth refresh command`);let t=Uy.getInstance();return t.startAuthentication(),new Promise(n=>{let r=ga(e,{timeout:Gw});r.stdout.on(`data`,e=>{let n=e.toString().trim();n&&(t.addOutput(n),A(n,{level:`debug`}))}),r.stderr.on(`data`,e=>{let n=e.toString().trim();n&&(t.setError(n),A(n,{level:`error`}))}),r.on(`close`,(e,r)=>{if(e===0)A(`AWS auth refresh completed successfully`),t.endAuthentication(!0),n(!0);else{let e=r===`SIGTERM`?Xe.red(`AWS auth refresh timed out after 3 minutes. Run your auth command manually in a separate terminal.`):Xe.red(`Error running awsAuthRefresh (in settings or ~/.claude.json):`);console.error(e),t.endAuthentication(!1),n(!1)}})})}async function ZC(){let e=zC();if(!e)return null;if(BC()&&!gf()&&!Mt())return sr(`awsCredentialExport invoked before trust check`,Error(`Security: awsCredentialExport executed before workspace trust is confirmed. If you see this message, post in .`)),N(`tengu_awsCredentialExport_missing_trust`,{}),null;try{return A(`Fetching AWS caller identity for credential export command`),await By(),A(`Fetched AWS caller identity, skipping AWS credential export command`),null}catch{try{A(`Running AWS credential export command`);let t=await Pr(e,{shell:!0,reject:!1});if(t.exitCode!==0||!t.stdout)throw Error(`awsCredentialExport did not return a valid value`);let n=Pn(t.stdout.trim());if(!zy(n))throw Error(`awsCredentialExport did not return valid AWS STS output structure`);return A(`AWS credentials retrieved from awsCredentialExport`),{accessKeyId:n.Credentials.AccessKeyId,secretAccessKey:n.Credentials.SecretAccessKey,sessionToken:n.Credentials.SessionToken}}catch(e){let t=Xe.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 QC(){Kw.cache.clear()}function $C(){return(J_()||{}).gcpAuthRefresh}function ew(){let e=$C();if(!e)return!1;let t=U(`projectSettings`),n=U(`localSettings`);return t?.gcpAuthRefresh===e||n?.gcpAuthRefresh===e}async function tw(){try{let{GoogleAuth:e}=await import(`./src-hdbPEvzO.js`).then(e=>n(e.default,1)),t=new e({scopes:[`https://www.googleapis.com/auth/cloud-platform`]}),r=(async()=>{await(await t.getClient()).getAccessToken()})(),i=Fi(qw).then(()=>{throw new iT(`GCP credentials check timed out`)});return await Promise.race([r,i]),!0}catch{return!1}}async function nw(){let e=$C();if(!e)return!1;if(ew()&&!gf()&&!Mt())return sr(`gcpAuthRefresh invoked before trust check`,Error(`Security: gcpAuthRefresh executed before workspace trust is confirmed. If you see this message, post in .`)),N(`tengu_gcpAuthRefresh_missing_trust`,{}),!1;try{if(A(`Checking GCP credentials validity for auth refresh`),await tw())return A(`GCP credentials are valid, skipping auth refresh command`),!1}catch{}return rw(e)}function rw(e){A(`Running GCP auth refresh command`);let t=Uy.getInstance();return t.startAuthentication(),new Promise(n=>{let r=ga(e,{timeout:Yw});r.stdout.on(`data`,e=>{let n=e.toString().trim();n&&(t.addOutput(n),A(n,{level:`debug`}))}),r.stderr.on(`data`,e=>{let n=e.toString().trim();n&&(t.setError(n),A(n,{level:`error`}))}),r.on(`close`,(e,r)=>{if(e===0)A(`GCP auth refresh completed successfully`),t.endAuthentication(!0),n(!0);else{let e=r===`SIGTERM`?Xe.red(`GCP auth refresh timed out after 3 minutes. Run your auth command manually in a separate terminal.`):Xe.red(`Error running gcpAuthRefresh (in settings or ~/.claude.json):`);console.error(e),t.endAuthentication(!1),n(!1)}})})}function iw(){Xw.cache.clear()}function aw(){$C()&&(ew()&&!gf()&&!Mt()||Xw())}function ow(){let e=LC(),t=zC();!e&&!t||(RC()||BC())&&!gf()&&!Mt()||(Kw(),G())}function sw(e){return/^[a-zA-Z0-9-_]+$/.test(e)}async function cw(e){if(!sw(e))throw Error(`Invalid API key format. API key must contain only alphanumeric characters, dashes, and underscores.`);await dw();let t=!1;if(process.platform===`darwin`)try{let n=ky();await Pr(`security`,[`-i`],{input:`add-generic-password -U -a "${Ay()}" -s "${n}" -X "${Buffer.from(e,`utf-8`).toString(`hex`)}"\n`,reject:!1}),N(`tengu_api_key_saved_to_keychain`,{}),t=!0}catch(e){I(e),N(`tengu_api_key_keychain_error`,{error:An(e)}),N(`tengu_api_key_saved_to_config`,{})}else N(`tengu_api_key_saved_to_config`,{});let n=Iy(e);V(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??[]}}}),Zw.cache.clear?.(),yC()}function lw(e){let t=H(),n=Iy(e);return t.customApiKeyResponses?.approved?.includes(n)??!1}async function uw(){await dw(),V(e=>({...e,primaryApiKey:void 0})),Zw.cache.clear?.(),yC()}async function dw(){try{await Fy()}catch(e){I(e)}}function fw(e){if(!oy(e.scopes))return N(`tengu_oauth_tokens_not_claude_ai`,{}),{success:!0};if(!e.refreshToken||!e.expiresAt)return N(`tengu_oauth_tokens_inference_only`,{}),{success:!0};let t=pC(),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?N(`tengu_oauth_tokens_saved`,{storageBackend:n}):N(`tengu_oauth_tokens_save_failed`,{storageBackend:n}),Z.cache?.clear?.(),XS(),TC(),a}catch(e){return I(e),N(`tengu_oauth_tokens_save_exception`,{storageBackend:n,error:An(e)}),{success:!1,warning:`Failed to save OAuth tokens`}}}function pw(){Z.cache?.clear?.(),jy()}async function mw(){try{let{mtimeMs:e}=await pa(R(ae(),`.credentials.json`));e!==Qw&&(Qw=e,pw())}catch{Z.cache?.clear?.()}}function hw(e){let t=$w.get(e);if(t)return t;let n=gw(e).finally(()=>{$w.delete(e)});return $w.set(e,n),n}async function gw(e){pw();let t=await _w();return t?.refreshToken?t.accessToken===e?vw(0,!0):(N(`tengu_oauth_401_recovered_from_keychain`,{}),!0):!1}async function _w(){if(ne())return null;if(process.env.CLAUDE_CODE_OAUTH_TOKEN||Sy())return Z();try{let e=(await pC().readAsync())?.claudeAiOauth;return e?.accessToken?e:null}catch(e){return I(e),null}}function vw(e=0,t=!1){return e===0&&!t?eT||(eT=yw(e,t).finally(()=>{eT=null}),eT):yw(e,t)}async function yw(e,t){await mw();let n=Z();if(!t&&(!n?.refreshToken||!py(n.expiresAt))||!n?.refreshToken||!oy(n.scopes))return!1;Z.cache?.clear?.(),jy();let r=await _w();if(!r?.refreshToken||!py(r.expiresAt))return!1;let i=ae();await la(i,{recursive:!0});let a;try{N(`tengu_oauth_token_refresh_lock_acquiring`,{}),a=await hi(i),N(`tengu_oauth_token_refresh_lock_acquired`,{})}catch(n){return n.code===`ELOCKED`?e<5?(N(`tengu_oauth_token_refresh_lock_retry`,{retryCount:e+1}),await Fi(1e3+Math.random()*1e3),yw(e+1,t)):(N(`tengu_oauth_token_refresh_lock_retry_limit_reached`,{maxRetries:5}),!1):(I(n),N(`tengu_oauth_token_refresh_lock_error`,{error:An(n)}),!1)}try{Z.cache?.clear?.(),jy();let e=await _w();return!e?.refreshToken||!py(e.expiresAt)?(N(`tengu_oauth_token_refresh_race_resolved`,{}),!1):(N(`tengu_oauth_token_refresh_starting`,{}),fw(await uy(e.refreshToken,{scopes:oy(e.scopes)?void 0:e.scopes})),Z.cache?.clear?.(),jy(),!0)}catch(e){I(e),Z.cache?.clear?.(),jy();let t=await _w();return t&&!py(t.expiresAt)?(N(`tengu_oauth_token_refresh_race_recovered`,{}),!0):!1}finally{N(`tengu_oauth_token_refresh_lock_releasing`,{}),await a(),N(`tengu_oauth_token_refresh_lock_released`,{})}}function Y(){return AC()?oy(Z()?.scopes):!1}function bw(){return Z()?.scopes?.includes(`user:profile`)??!1}function xw(){return!(g(process.env.CLAUDE_CODE_USE_BEDROCK)||g(process.env.CLAUDE_CODE_USE_VERTEX)||g(process.env.CLAUDE_CODE_USE_FOUNDRY)||Y())}function Sw(){return AC()?H().oauthAccount:void 0}function Cw(){let e=Sw()?.billingType;return!(!Y()||!e||e!==`stripe_subscription`&&e!==`stripe_subscription_contracted`&&e!==`apple_subscription`&&e!==`google_play_subscription`)}function ww(){let e=X();return e===`max`||e===`enterprise`||e===`team`||e===`pro`||e===null}function X(){if(Gv())return Wv();if(!AC())return null;let e=Z();return e?e.subscriptionType??null:null}function Tw(){return X()===`max`}function Ew(){return X()===`team`}function Dw(){return X()===`team`&&Aw()===`default_claude_max_5x`}function Ow(){return X()===`enterprise`}function kw(){return X()===`pro`}function Aw(){if(!AC())return null;let e=Z();return e?e.rateLimitTier??null:null}function jw(){switch(X()){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 Mw(){return!!(g(process.env.CLAUDE_CODE_USE_BEDROCK)||g(process.env.CLAUDE_CODE_USE_VERTEX)||g(process.env.CLAUDE_CODE_USE_FOUNDRY)||g(process.env.CLAUDE_CODE_USE_OPENAI)||g(process.env.CLAUDE_CODE_USE_GEMINI)||g(process.env.CLAUDE_CODE_USE_GROK))}function Nw(){return(J_()||{}).otelHeadersHelper}function Pw(){let e=Nw();if(!e)return!1;let t=U(`projectSettings`),n=U(`localSettings`);return t?.otelHeadersHelper===e||n?.otelHeadersHelper===e}function Fw(){let e=Nw();if(!e)return{};let t=parseInt(process.env.CLAUDE_CODE_OTEL_HEADERS_HELPER_DEBOUNCE_MS||rT.toString(),10);if(tT&&Date.now()-nT<t)return tT;if(Pw()&&!gf())return{};try{let t=ni(e,{timeout:3e4})?.toString().trim();if(!t)throw Error(`otelHeadersHelper did not return a valid value`);let n=Pn(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 tT=n,nT=Date.now(),tT}catch(e){throw I(Error(`Error getting OpenTelemetry headers from otelHeadersHelper (in settings): ${An(e)}`)),e}}function Iw(e){return e===`max`||e===`pro`}function Lw(){let e=X();return Y()&&e!==null&&Iw(e)}function Rw(){if(W()!==`firstParty`)return;let{source:e}=jC(),t={};e===`CLAUDE_CODE_OAUTH_TOKEN`||e===`CLAUDE_CODE_OAUTH_TOKEN_FILE_DESCRIPTOR`?t.tokenSource=e:Y()?t.subscription=jw():t.tokenSource=e;let{key:n,source:r}=PC();if(n&&(t.apiKeySource=r),e===`claude.ai`||r===`/login managed key`){let e=Sw()?.organizationName;e&&(t.organization=e)}let i=Sw()?.emailAddress;return(e===`claude.ai`||r===`/login managed key`)&&i&&(t.email=i),t}async function zw(){if(process.env.ANTHROPIC_UNIX_SOCKET||!AC())return{valid:!0};let e=U(`policySettings`)?.forceLoginOrgUUID;if(!e)return{valid:!0};await vw();let t=Z();if(!t)return{valid:!0};let{source:n}=jC(),r=n===`CLAUDE_CODE_OAUTH_TOKEN`||n===`CLAUDE_CODE_OAUTH_TOKEN_FILE_DESCRIPTOR`,i=await iy(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 via 'claude auth login'.`};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\nPlease log in with the correct organization: claude auth login`}}var Bw,Vw,Hw,Uw,Ww,Gw,Kw,qw,Jw,Yw,Xw,Zw,Z,Qw,$w,eT,tT,nT,rT,iT,Q=t((()=>{Ze(),Nr(),m(),kr(),hr(),Nv(),wv(),O(),ny(),vy(),ay(),Oy(),Ly(),Hy(),Wy(),tC(),rp(),M(),h(),In(),ii(),gi(),Vr(),Xr(),mC(),CC(),Py(),Y_(),Ii(),ur(),DC(),Bw=300*1e3,Vw=null,Hw=null,Uw=0,Ww=3600*1e3,Gw=180*1e3,Kw=Yr(async()=>{let e=await YC(),t=await ZC();return(e||t)&&await Vy(),t},Ww),qw=5e3,Jw=3600*1e3,Yw=180*1e3,Xw=Yr(async()=>await nw(),Jw),Zw=p(()=>{if(ne())return null;if(process.platform===`darwin`){let e=vC();if(e){if(e.stdout)return{key:e.stdout,source:`/login managed key`}}else{let e=ky();try{let t=ni(`security find-generic-password -a $USER -w -s "${e}"`);if(t)return{key:t,source:`/login managed key`}}catch(e){I(e)}}}let e=H();return e.primaryApiKey?{key:e.primaryApiKey,source:`/login managed key`}:null}),Z=p(()=>{if(ne())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=Sy();if(e)return{accessToken:e,refreshToken:null,expiresAt:null,scopes:[`user:inference`],subscriptionType:null,rateLimitTier:null};try{let e=pC().read()?.claudeAiOauth;return e?.accessToken?e:null}catch(e){return I(e),null}}),Qw=0,$w=new Map,eT=null,tT=null,nT=0,rT=1740*1e3,iT=class extends Error{}}));function aT(){return`claude-code/2.6.10`}var oT=t((()=>{}));function sT(){return uT.getStore()?.workload}function cT(e,t){return uT.run({workload:e},t)}var lT,uT,dT=t((()=>{lT=`cron`,uT=new va}));function fT(){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=sT(),r=n?`, workload/${n}`:``;return`claude-cli/2.6.10 (${process.env.USER_TYPE}, ${process.env.CLAUDE_CODE_ENTRYPOINT??`cli`}${e}${t}${r})`}function pT(){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/2.6.10${e.length>0?` (${e.join(`, `)})`:``}`}function mT(){return`Claude-User (${aT()}; +https://support.anthropic.com/)`}function hT(){if(Y()){let e=Z();return e?.accessToken?{headers:{Authorization:`Bearer ${e.accessToken}`,"anthropic-beta":Dr}}:{headers:{},error:`No OAuth token available`}}let e=MC();return e?{headers:{"x-api-key":e}}:{headers:{},error:`No API key available`}}async function gT(e,t){try{return await e()}catch(n){if(!v.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=Z()?.accessToken;if(!i)throw n;return await hw(i),await e()}}var _T=t((()=>{Ie(),kr(),Q(),oT(),dT()}));async function vT(){CT===null&&!wT&&(wT=ST(),CT=await wT,wT=null,TT.cache.clear?.())}function yT(){CT=null,wT=null,TT.cache.clear?.(),ET.cache.clear?.()}function bT(){return TT(!0)}function xT(){if(CT!==null)return CT;let e=Sw();if(e?.emailAddress)return e.emailAddress;if(process.env.USER_TYPE===`ant`&&process.env.COO_CREATOR)return`${process.env.COO_CREATOR}@anthropic.com`}async function ST(){let e=Sw();if(e?.emailAddress)return e.emailAddress;if(process.env.USER_TYPE===`ant`)return process.env.COO_CREATOR?`${process.env.COO_CREATOR}@anthropic.com`:ET()}var CT,wT,TT,ET,DT=t((()=>{Nr(),m(),O(),Q(),rp(),gr(),Fr(),h(),CT=null,wT=null,TT=p(e=>{let t=zf(),n=H(),r,i,a;if(e&&(r=X()??void 0,i=Aw()??void 0,r&&n.claudeCodeFirstTokenDate)){let e=new Date(n.claudeCodeFirstTokenDate).getTime();isNaN(e)||(a=e)}let o=Sw(),s=o?.organizationUuid,c=o?.accountUuid;return{deviceId:t,sessionId:at(),email:xT(),appVersion:`2.6.10`,platform:Ir(),organizationUuid:s,accountUuid:c,userType:process.env.USER_TYPE,subscriptionType:r,rateLimitTier:i,firstTokenTime:a,...g(process.env.GITHUB_ACTIONS)&&{githubActionsMetadata:{actor:process.env.GITHUB_ACTOR,actorId:process.env.GITHUB_ACTOR_ID,repository:process.env.GITHUB_REPOSITORY,repositoryId:process.env.GITHUB_REPOSITORY_ID,repositoryOwner:process.env.GITHUB_REPOSITORY_OWNER,repositoryOwnerId:process.env.GITHUB_REPOSITORY_OWNER_ID}}}}),ET=p(async()=>{let e=await Pr(`git config --get user.email`,{shell:!0,reject:!1,cwd:_r()});return e.exitCode===0&&e.stdout?e.stdout.trim():void 0})}));function OT(e){return kT(e,new WeakSet)}function kT(e,t){if(e==null||typeof e==`string`||typeof e==`number`||typeof e==`boolean`||e instanceof Uint8Array)return!0;if(typeof e==`object`){if(t.has(e))return!1;if(t.add(e),Array.isArray(e))return e.every(e=>kT(e,t));let n=e;return n.constructor!==Object&&n.constructor!==void 0?!1:Object.values(n).every(e=>kT(e,t))}return!1}var AT=t((()=>{})),jT,MT=t((()=>{fe(),we(),Ee(),AT(),ce(),jT=class{set severityText(e){this._isLogRecordReadonly()||(this._severityText=e)}get severityText(){return this._severityText}set severityNumber(e){this._isLogRecordReadonly()||(this._severityNumber=e)}get severityNumber(){return this._severityNumber}set body(e){this._isLogRecordReadonly()||(this._body=e)}get body(){return this._body}get eventName(){return this._eventName}set eventName(e){this._isLogRecordReadonly()||(this._eventName=e)}get droppedAttributesCount(){return this._droppedAttributesCount}constructor(e,t,n){_(this,`hrTime`,void 0),_(this,`hrTimeObserved`,void 0),_(this,`spanContext`,void 0),_(this,`resource`,void 0),_(this,`instrumentationScope`,void 0),_(this,`attributes`,{}),_(this,`_severityText`,void 0),_(this,`_severityNumber`,void 0),_(this,`_body`,void 0),_(this,`_eventName`,void 0),_(this,`_attributesCount`,0),_(this,`_droppedAttributesCount`,0),_(this,`_isReadonly`,!1),_(this,`_logRecordLimits`,void 0);let{timestamp:r,observedTimestamp:i,eventName:a,severityNumber:o,severityText:s,body:c,attributes:l={},exception:u,context:d}=n,f=Date.now();if(this.hrTime=_e(r??f),this.hrTimeObserved=_e(i??f),d){let e=me.getSpanContext(d);e&&ue(e)&&(this.spanContext=e)}this.severityNumber=o,this.severityText=s,this.body=c,this.resource=e.resource,this.instrumentationScope=t,this._logRecordLimits=e.logRecordLimits,this._eventName=a,this.setAttributes(l),u!=null&&this._setException(u)}setAttribute(e,t){if(this._isLogRecordReadonly())return this;if(e.length===0)return pe.warn(`Invalid attribute key: ${e}`),this;if(!OT(t))return pe.warn(`Invalid attribute value set for key: ${e}`),this;let n=!Object.prototype.hasOwnProperty.call(this.attributes,e);return n&&this._attributesCount>=this._logRecordLimits.attributeCountLimit?(this._droppedAttributesCount++,this._droppedAttributesCount===1&&pe.warn(`Dropping extra attributes.`),this):(this.attributes[e]=this._truncateToSize(t),n&&this._attributesCount++,this)}setAttributes(e){for(let[t,n]of Object.entries(e))this.setAttribute(t,n);return this}setBody(e){return this.body=e,this}setEventName(e){return this.eventName=e,this}setSeverityNumber(e){return this.severityNumber=e,this}setSeverityText(e){return this.severityText=e,this}_makeReadonly(){this._isReadonly=!0}_truncateToSize(e){let t=this._logRecordLimits.attributeValueLengthLimit;if(t<=0)return pe.warn(`Attribute value limit must be positive, got ${t}`),e;if(e==null)return e;if(typeof e==`string`)return this._truncateToLimitUtil(e,t);if(e instanceof Uint8Array)return e;if(Array.isArray(e))return e.map(e=>this._truncateToSize(e));if(typeof e==`object`){let t={};for(let[n,r]of Object.entries(e))t[n]=this._truncateToSize(r);return t}return e}_setException(e){let t=!1;if(typeof e==`string`||typeof e==`number`)Object.hasOwn(this.attributes,`exception.message`)||this.setAttribute(Me,String(e)),t=!0;else if(e&&typeof e==`object`){let n=e;n.code?(Object.hasOwn(this.attributes,`exception.type`)||this.setAttribute(be,n.code.toString()),t=!0):n.name&&(Object.hasOwn(this.attributes,`exception.type`)||this.setAttribute(be,n.name),t=!0),n.message&&(Object.hasOwn(this.attributes,`exception.message`)||this.setAttribute(Me,n.message),t=!0),n.stack&&(Object.hasOwn(this.attributes,`exception.stacktrace`)||this.setAttribute(ge,n.stack),t=!0)}t||pe.warn(`Failed to record an exception ${e}`)}_truncateToLimitUtil(e,t){return e.length<=t?e:e.substring(0,t)}_isLogRecordReadonly(){return this._isReadonly&&pe.warn(`Can not execute the operation on emitted log record`),this._isReadonly}}})),NT,PT=t((()=>{Fe(),fe(),MT(),ce(),NT=class{constructor(e,t){_(this,`instrumentationScope`,void 0),_(this,`_sharedState`,void 0),_(this,`_loggerConfig`,void 0),this.instrumentationScope=e,this._sharedState=t,this._loggerConfig=this._sharedState.getLoggerConfig(this.instrumentationScope)}emit(e){let t=this._loggerConfig,n=e.context||he.active(),r=e.severityNumber??Ne.UNSPECIFIED;if(r!==Ne.UNSPECIFIED&&r<t.minimumSeverity)return;if(t.traceBased){let e=me.getSpanContext(n);if(e&&ue(e)&&(e.traceFlags&de.SAMPLED)!==de.SAMPLED)return}let i=new jT(this._sharedState,this.instrumentationScope,{context:n,...e});this._sharedState.loggerMetrics.emitLog(),this._sharedState.activeProcessor.onEmit(i,n),i._makeReadonly()}enabled(e){let t=this._loggerConfig;if(t.disabled)return!1;let n=e?.severityNumber;if(typeof n==`number`&&n!==Ne.UNSPECIFIED&&n<t.minimumSeverity)return!1;let r=e?.context||he.active();if(t.traceBased){let e=me.getSpanContext(r);if(e&&ue(e)&&(e.traceFlags&de.SAMPLED)!==de.SAMPLED)return!1}let i={context:r,instrumentationScope:this.instrumentationScope,severityNumber:e?.severityNumber,eventName:e?.eventName};for(let e of this._sharedState.processors)if(!e.enabled||e.enabled(i))return!0;return!1}}})),FT,IT=t((()=>{FT=class{forceFlush(){return Promise.resolve()}onEmit(e,t){}shutdown(){return Promise.resolve()}enabled(e){return!1}}})),LT,RT=t((()=>{we(),ce(),LT=class{constructor(e,t){_(this,`processors`,void 0),_(this,`forceFlushTimeoutMillis`,void 0),this.processors=e,this.forceFlushTimeoutMillis=t}async forceFlush(){let e=this.forceFlushTimeoutMillis;await Promise.all(this.processors.map(t=>Te(t.forceFlush(),e)))}onEmit(e,t){this.processors.forEach(n=>n.onEmit(e,t))}async shutdown(){await Promise.all(this.processors.map(e=>e.shutdown()))}enabled(e){for(let t of this.processors)if(!t.enabled||t.enabled(e))return!0;return!1}}}));function zT(e){return`${e.name}@${e.version||``}:${e.schemaUrl||``}`}var BT=t((()=>{})),VT,HT=t((()=>{VT=`otel.sdk.log.created`})),UT,WT=t((()=>{HT(),ce(),UT=class{constructor(e){_(this,`createdLogs`,void 0),this.createdLogs=e.createCounter(VT,{unit:`{log_record}`,description:`The number of logs submitted to enabled SDK Loggers.`})}emitLog(){this.createdLogs.add(1)}}})),GT,KT=t((()=>{GT=`0.215.0`})),qT,JT,YT,XT=t((()=>{fe(),Fe(),IT(),RT(),BT(),WT(),KT(),ce(),qT={disabled:!1,minimumSeverity:Ne.UNSPECIFIED,traceBased:!1},JT=()=>({...qT}),YT=class{constructor(e,t,n,r,i,a){_(this,`loggers`,new Map),_(this,`activeProcessor`,void 0),_(this,`registeredLogRecordProcessors`,[]),_(this,`resource`,void 0),_(this,`forceFlushTimeoutMillis`,void 0),_(this,`logRecordLimits`,void 0),_(this,`processors`,void 0),_(this,`loggerMetrics`,void 0),_(this,`_loggerConfigurator`,void 0),_(this,`_loggerConfigs`,new Map),this.resource=e,this.forceFlushTimeoutMillis=t,this.logRecordLimits=n,this.processors=r,r.length>0?(this.registeredLogRecordProcessors=r,this.activeProcessor=new LT(this.registeredLogRecordProcessors,this.forceFlushTimeoutMillis)):this.activeProcessor=new FT,this._loggerConfigurator=i??JT,this.loggerMetrics=new UT(a?a.getMeter(`@opentelemetry/sdk-logs`,GT):le())}getLoggerConfig(e){let t=zT(e),n=this._loggerConfigs.get(t);return n||(n=this._loggerConfigurator(e),this._loggerConfigs.set(t,n),n)}}})),ZT,QT=t((()=>{fe(),Fe(),ke(),we(),PT(),XT(),ce(),ZT=class{constructor(e={}){_(this,`_shutdownOnce`,void 0),_(this,`_sharedState`,void 0);let t={resource:e.resource??Ce(),forceFlushTimeoutMillis:e.forceFlushTimeoutMillis??3e4,logRecordLimits:{attributeCountLimit:e.logRecordLimits?.attributeCountLimit??128,attributeValueLengthLimit:e.logRecordLimits?.attributeValueLengthLimit??1/0},loggerConfigurator:e.loggerConfigurator??JT,processors:e.processors??[],meterProvider:e.meterProvider};this._sharedState=new YT(t.resource,t.forceFlushTimeoutMillis,t.logRecordLimits,t.processors,t.loggerConfigurator,t.meterProvider),this._shutdownOnce=new Ae(this._shutdown,this)}getLogger(e,t,n){if(this._shutdownOnce.isCalled)return pe.warn(`A shutdown LoggerProvider cannot provide a Logger`),Pe;e||pe.warn(`Logger requested without instrumentation scope name.`);let r=e||`unknown`,i=`${r}@${t||``}:${n?.schemaUrl||``}`;return this._sharedState.loggers.has(i)||this._sharedState.loggers.set(i,new NT({name:r,version:t,schemaUrl:n?.schemaUrl},this._sharedState)),this._sharedState.loggers.get(i)}forceFlush(){return this._shutdownOnce.isCalled?(pe.warn(`invalid attempt to force flush after LoggerProvider shutdown`),this._shutdownOnce.promise):this._sharedState.activeProcessor.forceFlush()}shutdown(){return this._shutdownOnce.isCalled?(pe.warn(`shutdown may only be called once per LoggerProvider`),this._shutdownOnce.promise):this._shutdownOnce.call()}_shutdown(){return this._sharedState.activeProcessor.shutdown()}}})),$T,eE=t((()=>{we(),$T=class{export(e,t){this._sendLogRecords(e,t)}async forceFlush(){}async shutdown(){}_exportInfo(e){return{resource:{attributes:e.resource.attributes},instrumentationScope:e.instrumentationScope,timestamp:je(e.hrTime),traceId:e.spanContext?.traceId,spanId:e.spanContext?.spanId,traceFlags:e.spanContext?.traceFlags,severityText:e.severityText,severityNumber:e.severityNumber,eventName:e.eventName,body:e.body,attributes:e.attributes}}_sendLogRecords(e,t){for(let t of e)console.dir(this._exportInfo(t),{depth:3});t?.({code:Se.SUCCESS})}}}));async function tE(e){let t=[];for(let n=0,r=e.length;n<r;n++){let r=e[n];r.resource.asyncAttributesPending&&r.resource.waitForAsyncAttributes&&t.push(r.resource.waitForAsyncAttributes())}t!=null&&t.length>0&&await Promise.all(t)}var nE,rE,iE=t((()=>{fe(),we(),ce(),nE=class{constructor(e,t,n){_(this,`_exportCompleted`,void 0),_(this,`_exportScheduledPromise`,void 0),_(this,`_exportScheduledResolve`,void 0),this._exportScheduledPromise=new Promise(e=>{this._exportScheduledResolve=e}),this._exportCompleted=this._executeExport(e,t,n)}get exportCompleted(){return this._exportCompleted}get exportScheduled(){return this._exportScheduledPromise}async _executeExport(e,t,n){try{await tE(t),await he.with(De(he.active()),async()=>this._exportWithTimeout(e,t,n))}catch(e){ye(e),this._exportScheduledResolve()}}async _exportWithTimeout(e,t,n){return new Promise((r,i)=>{let a=setTimeout(()=>{i(Error(`Timeout`))},n);e.export(t,e=>{clearTimeout(a),e.code===Se.SUCCESS?r():i(e.error??Error(`BatchLogRecordProcessor: log record export failed`))}),this._exportScheduledResolve()})}},rE=class{constructor(e,t){_(this,`_maxExportBatchSize`,void 0),_(this,`_maxQueueSize`,void 0),_(this,`_scheduledDelayMillis`,void 0),_(this,`_exportTimeoutMillis`,void 0),_(this,`_exporter`,void 0),_(this,`_currentExport`,null),_(this,`_finishedLogRecords`,[]),_(this,`_timer`,void 0),_(this,`_shutdownOnce`,void 0),_(this,`_flushing`,!1),this._exporter=e,this._maxExportBatchSize=t?.maxExportBatchSize??512,this._maxQueueSize=t?.maxQueueSize??2048,this._scheduledDelayMillis=t?.scheduledDelayMillis??5e3,this._exportTimeoutMillis=t?.exportTimeoutMillis??3e4,this._shutdownOnce=new Ae(this._shutdown,this),this._maxExportBatchSize>this._maxQueueSize&&(pe.warn(`BatchLogRecordProcessor: maxExportBatchSize must be smaller or equal to maxQueueSize, setting maxExportBatchSize to match maxQueueSize`),this._maxExportBatchSize=this._maxQueueSize)}onEmit(e){this._shutdownOnce.isCalled||this._addToBuffer(e)}forceFlush(){return this._shutdownOnce.isCalled?this._shutdownOnce.promise:this._flushAll()}_addToBuffer(e){this._finishedLogRecords.length>=this._maxQueueSize||(this._finishedLogRecords.push(e),this._maybeStartTimer())}shutdown(){return this._shutdownOnce.call()}async _shutdown(){this.onShutdown(),await this._flushAll(),await this._exporter.shutdown()}async _flushAll(){if(this._flushing)return;this._flushing=!0;let e=this._finishedLogRecords;for(this._finishedLogRecords=[],this._clearTimer(),this._currentExport!==null&&(await this._exporter.forceFlush(),await this._currentExport.exportCompleted,this._currentExport=null);e.length>0;){let t;e.length<=this._maxExportBatchSize?(t=e,e=[]):t=e.splice(0,this._maxExportBatchSize);let n=new nE(this._exporter,t,this._exportTimeoutMillis);this._currentExport=n;try{await n.exportScheduled,await this._exporter.forceFlush(),await n.exportCompleted}catch(e){ye(e)}finally{this._currentExport=null}}this._flushing=!1,this._maybeStartTimer()}_extractBatch(){if(this._finishedLogRecords.length===0)return null;if(this._finishedLogRecords.length<=this._maxExportBatchSize){let e=this._finishedLogRecords;return this._finishedLogRecords=[],e}else return this._finishedLogRecords.splice(0,this._maxExportBatchSize)}_exportOneBatch(){this._clearTimer();let e=this._extractBatch();if(e===null)return;let t=new nE(this._exporter,e,this._exportTimeoutMillis);this._currentExport=t,t.exportCompleted.then(()=>{this._currentExport=null,this._maybeStartTimer()}).catch(e=>{this._currentExport=null,ye(e),this._maybeStartTimer()})}_maybeStartTimer(){if(!this._shutdownOnce.isCalled&&!this._flushing&&this._finishedLogRecords.length!==0&&this._currentExport===null){if(this._finishedLogRecords.length>=this._maxExportBatchSize){this._exportOneBatch();return}this._timer===void 0&&(this._timer=setTimeout(()=>{this._timer=void 0,this._exportOneBatch()},this._scheduledDelayMillis),typeof this._timer!=`number`&&this._timer.unref())}}_clearTimer(){this._timer!==void 0&&(clearTimeout(this._timer),this._timer=void 0)}}})),aE,oE=t((()=>{iE(),aE=class extends rE{onShutdown(){}}})),sE=t((()=>{oE()})),cE=t((()=>{sE()})),lE=t((()=>{QT(),eE(),cE()}));function uE(){return g(process.env.CLAUDE_CODE_USE_BEDROCK)||g(process.env.CLAUDE_CODE_USE_VERTEX)||g(process.env.CLAUDE_CODE_USE_FOUNDRY)||Hr()}function dE(){return Hr()}var fE=t((()=>{h(),zr()}));function pE(){return{seconds:0,nanos:0}}function mE(e){return e!=null}var hE,gE=t((()=>{hE={fromJSON(e){return{seconds:mE(e.seconds)?globalThis.Number(e.seconds):0,nanos:mE(e.nanos)?globalThis.Number(e.nanos):0}},toJSON(e){let t={};return e.seconds!==void 0&&(t.seconds=Math.round(e.seconds)),e.nanos!==void 0&&(t.nanos=Math.round(e.nanos)),t},create(e){return hE.fromPartial(e??{})},fromPartial(e){let t=pE();return t.seconds=e.seconds??0,t.nanos=e.nanos??0,t}}}));function _E(){return{account_id:0,organization_uuid:``,account_uuid:``}}function vE(e){return e!=null}var yE,bE=t((()=>{yE={fromJSON(e){return{account_id:vE(e.account_id)?globalThis.Number(e.account_id):0,organization_uuid:vE(e.organization_uuid)?globalThis.String(e.organization_uuid):``,account_uuid:vE(e.account_uuid)?globalThis.String(e.account_uuid):``}},toJSON(e){let t={};return e.account_id!==void 0&&(t.account_id=Math.round(e.account_id)),e.organization_uuid!==void 0&&(t.organization_uuid=e.organization_uuid),e.account_uuid!==void 0&&(t.account_uuid=e.account_uuid),t},create(e){return yE.fromPartial(e??{})},fromPartial(e){let t=_E();return t.account_id=e.account_id??0,t.organization_uuid=e.organization_uuid??``,t.account_uuid=e.account_uuid??``,t}}}));function xE(){return{actor_id:``,repository_id:``,repository_owner_id:``}}function SE(){return{platform:``,node_version:``,terminal:``,package_managers:``,runtimes:``,is_running_with_bun:!1,is_ci:!1,is_claubbit:!1,is_github_action:!1,is_claude_code_action:!1,is_claude_ai_auth:!1,version:``,github_event_name:``,github_actions_runner_environment:``,github_actions_runner_os:``,github_action_ref:``,wsl_version:``,github_actions_metadata:void 0,arch:``,is_claude_code_remote:!1,remote_environment_type:``,claude_code_container_id:``,claude_code_remote_session_id:``,tags:[],deployment_environment:``,is_conductor:!1,version_base:``,coworker_type:``,build_time:``,is_local_agent_mode:!1,linux_distro_id:``,linux_distro_version:``,linux_kernel:``,vcs:``,platform_raw:``}}function CE(){return{slack_team_id:``,is_enterprise_install:!1,trigger:``,creation_method:``}}function wE(){return{event_name:``,client_timestamp:void 0,model:``,session_id:``,user_type:``,betas:``,env:void 0,entrypoint:``,agent_sdk_version:``,is_interactive:!1,client_type:``,process:``,additional_metadata:``,auth:void 0,server_timestamp:void 0,event_id:``,device_id:``,swe_bench_run_id:``,swe_bench_instance_id:``,swe_bench_task_id:``,email:``,agent_id:``,parent_session_id:``,agent_type:``,slack:void 0,team_name:``,skill_name:``,plugin_name:``,marketplace_name:``}}function TE(e){let t=(e.seconds||0)*1e3;return t+=(e.nanos||0)/1e6,new globalThis.Date(t)}function EE(e){return e instanceof globalThis.Date?e:typeof e==`string`?new globalThis.Date(e):TE(hE.fromJSON(e))}function $(e){return e!=null}var DE,OE,kE,AE,jE=t((()=>{gE(),bE(),DE={fromJSON(e){return{actor_id:$(e.actor_id)?globalThis.String(e.actor_id):``,repository_id:$(e.repository_id)?globalThis.String(e.repository_id):``,repository_owner_id:$(e.repository_owner_id)?globalThis.String(e.repository_owner_id):``}},toJSON(e){let t={};return e.actor_id!==void 0&&(t.actor_id=e.actor_id),e.repository_id!==void 0&&(t.repository_id=e.repository_id),e.repository_owner_id!==void 0&&(t.repository_owner_id=e.repository_owner_id),t},create(e){return DE.fromPartial(e??{})},fromPartial(e){let t=xE();return t.actor_id=e.actor_id??``,t.repository_id=e.repository_id??``,t.repository_owner_id=e.repository_owner_id??``,t}},OE={fromJSON(e){return{platform:$(e.platform)?globalThis.String(e.platform):``,node_version:$(e.node_version)?globalThis.String(e.node_version):``,terminal:$(e.terminal)?globalThis.String(e.terminal):``,package_managers:$(e.package_managers)?globalThis.String(e.package_managers):``,runtimes:$(e.runtimes)?globalThis.String(e.runtimes):``,is_running_with_bun:$(e.is_running_with_bun)?globalThis.Boolean(e.is_running_with_bun):!1,is_ci:$(e.is_ci)?globalThis.Boolean(e.is_ci):!1,is_claubbit:$(e.is_claubbit)?globalThis.Boolean(e.is_claubbit):!1,is_github_action:$(e.is_github_action)?globalThis.Boolean(e.is_github_action):!1,is_claude_code_action:$(e.is_claude_code_action)?globalThis.Boolean(e.is_claude_code_action):!1,is_claude_ai_auth:$(e.is_claude_ai_auth)?globalThis.Boolean(e.is_claude_ai_auth):!1,version:$(e.version)?globalThis.String(e.version):``,github_event_name:$(e.github_event_name)?globalThis.String(e.github_event_name):``,github_actions_runner_environment:$(e.github_actions_runner_environment)?globalThis.String(e.github_actions_runner_environment):``,github_actions_runner_os:$(e.github_actions_runner_os)?globalThis.String(e.github_actions_runner_os):``,github_action_ref:$(e.github_action_ref)?globalThis.String(e.github_action_ref):``,wsl_version:$(e.wsl_version)?globalThis.String(e.wsl_version):``,github_actions_metadata:$(e.github_actions_metadata)?DE.fromJSON(e.github_actions_metadata):void 0,arch:$(e.arch)?globalThis.String(e.arch):``,is_claude_code_remote:$(e.is_claude_code_remote)?globalThis.Boolean(e.is_claude_code_remote):!1,remote_environment_type:$(e.remote_environment_type)?globalThis.String(e.remote_environment_type):``,claude_code_container_id:$(e.claude_code_container_id)?globalThis.String(e.claude_code_container_id):``,claude_code_remote_session_id:$(e.claude_code_remote_session_id)?globalThis.String(e.claude_code_remote_session_id):``,tags:globalThis.Array.isArray(e?.tags)?e.tags.map(e=>globalThis.String(e)):[],deployment_environment:$(e.deployment_environment)?globalThis.String(e.deployment_environment):``,is_conductor:$(e.is_conductor)?globalThis.Boolean(e.is_conductor):!1,version_base:$(e.version_base)?globalThis.String(e.version_base):``,coworker_type:$(e.coworker_type)?globalThis.String(e.coworker_type):``,build_time:$(e.build_time)?globalThis.String(e.build_time):``,is_local_agent_mode:$(e.is_local_agent_mode)?globalThis.Boolean(e.is_local_agent_mode):!1,linux_distro_id:$(e.linux_distro_id)?globalThis.String(e.linux_distro_id):``,linux_distro_version:$(e.linux_distro_version)?globalThis.String(e.linux_distro_version):``,linux_kernel:$(e.linux_kernel)?globalThis.String(e.linux_kernel):``,vcs:$(e.vcs)?globalThis.String(e.vcs):``,platform_raw:$(e.platform_raw)?globalThis.String(e.platform_raw):``}},toJSON(e){let t={};return e.platform!==void 0&&(t.platform=e.platform),e.node_version!==void 0&&(t.node_version=e.node_version),e.terminal!==void 0&&(t.terminal=e.terminal),e.package_managers!==void 0&&(t.package_managers=e.package_managers),e.runtimes!==void 0&&(t.runtimes=e.runtimes),e.is_running_with_bun!==void 0&&(t.is_running_with_bun=e.is_running_with_bun),e.is_ci!==void 0&&(t.is_ci=e.is_ci),e.is_claubbit!==void 0&&(t.is_claubbit=e.is_claubbit),e.is_github_action!==void 0&&(t.is_github_action=e.is_github_action),e.is_claude_code_action!==void 0&&(t.is_claude_code_action=e.is_claude_code_action),e.is_claude_ai_auth!==void 0&&(t.is_claude_ai_auth=e.is_claude_ai_auth),e.version!==void 0&&(t.version=e.version),e.github_event_name!==void 0&&(t.github_event_name=e.github_event_name),e.github_actions_runner_environment!==void 0&&(t.github_actions_runner_environment=e.github_actions_runner_environment),e.github_actions_runner_os!==void 0&&(t.github_actions_runner_os=e.github_actions_runner_os),e.github_action_ref!==void 0&&(t.github_action_ref=e.github_action_ref),e.wsl_version!==void 0&&(t.wsl_version=e.wsl_version),e.github_actions_metadata!==void 0&&(t.github_actions_metadata=DE.toJSON(e.github_actions_metadata)),e.arch!==void 0&&(t.arch=e.arch),e.is_claude_code_remote!==void 0&&(t.is_claude_code_remote=e.is_claude_code_remote),e.remote_environment_type!==void 0&&(t.remote_environment_type=e.remote_environment_type),e.claude_code_container_id!==void 0&&(t.claude_code_container_id=e.claude_code_container_id),e.claude_code_remote_session_id!==void 0&&(t.claude_code_remote_session_id=e.claude_code_remote_session_id),e.tags?.length&&(t.tags=e.tags),e.deployment_environment!==void 0&&(t.deployment_environment=e.deployment_environment),e.is_conductor!==void 0&&(t.is_conductor=e.is_conductor),e.version_base!==void 0&&(t.version_base=e.version_base),e.coworker_type!==void 0&&(t.coworker_type=e.coworker_type),e.build_time!==void 0&&(t.build_time=e.build_time),e.is_local_agent_mode!==void 0&&(t.is_local_agent_mode=e.is_local_agent_mode),e.linux_distro_id!==void 0&&(t.linux_distro_id=e.linux_distro_id),e.linux_distro_version!==void 0&&(t.linux_distro_version=e.linux_distro_version),e.linux_kernel!==void 0&&(t.linux_kernel=e.linux_kernel),e.vcs!==void 0&&(t.vcs=e.vcs),e.platform_raw!==void 0&&(t.platform_raw=e.platform_raw),t},create(e){return OE.fromPartial(e??{})},fromPartial(e){let t=SE();return t.platform=e.platform??``,t.node_version=e.node_version??``,t.terminal=e.terminal??``,t.package_managers=e.package_managers??``,t.runtimes=e.runtimes??``,t.is_running_with_bun=e.is_running_with_bun??!1,t.is_ci=e.is_ci??!1,t.is_claubbit=e.is_claubbit??!1,t.is_github_action=e.is_github_action??!1,t.is_claude_code_action=e.is_claude_code_action??!1,t.is_claude_ai_auth=e.is_claude_ai_auth??!1,t.version=e.version??``,t.github_event_name=e.github_event_name??``,t.github_actions_runner_environment=e.github_actions_runner_environment??``,t.github_actions_runner_os=e.github_actions_runner_os??``,t.github_action_ref=e.github_action_ref??``,t.wsl_version=e.wsl_version??``,t.github_actions_metadata=e.github_actions_metadata!==void 0&&e.github_actions_metadata!==null?DE.fromPartial(e.github_actions_metadata):void 0,t.arch=e.arch??``,t.is_claude_code_remote=e.is_claude_code_remote??!1,t.remote_environment_type=e.remote_environment_type??``,t.claude_code_container_id=e.claude_code_container_id??``,t.claude_code_remote_session_id=e.claude_code_remote_session_id??``,t.tags=e.tags?.map(e=>e)||[],t.deployment_environment=e.deployment_environment??``,t.is_conductor=e.is_conductor??!1,t.version_base=e.version_base??``,t.coworker_type=e.coworker_type??``,t.build_time=e.build_time??``,t.is_local_agent_mode=e.is_local_agent_mode??!1,t.linux_distro_id=e.linux_distro_id??``,t.linux_distro_version=e.linux_distro_version??``,t.linux_kernel=e.linux_kernel??``,t.vcs=e.vcs??``,t.platform_raw=e.platform_raw??``,t}},kE={fromJSON(e){return{slack_team_id:$(e.slack_team_id)?globalThis.String(e.slack_team_id):``,is_enterprise_install:$(e.is_enterprise_install)?globalThis.Boolean(e.is_enterprise_install):!1,trigger:$(e.trigger)?globalThis.String(e.trigger):``,creation_method:$(e.creation_method)?globalThis.String(e.creation_method):``}},toJSON(e){let t={};return e.slack_team_id!==void 0&&(t.slack_team_id=e.slack_team_id),e.is_enterprise_install!==void 0&&(t.is_enterprise_install=e.is_enterprise_install),e.trigger!==void 0&&(t.trigger=e.trigger),e.creation_method!==void 0&&(t.creation_method=e.creation_method),t},create(e){return kE.fromPartial(e??{})},fromPartial(e){let t=CE();return t.slack_team_id=e.slack_team_id??``,t.is_enterprise_install=e.is_enterprise_install??!1,t.trigger=e.trigger??``,t.creation_method=e.creation_method??``,t}},AE={fromJSON(e){return{event_name:$(e.event_name)?globalThis.String(e.event_name):``,client_timestamp:$(e.client_timestamp)?EE(e.client_timestamp):void 0,model:$(e.model)?globalThis.String(e.model):``,session_id:$(e.session_id)?globalThis.String(e.session_id):``,user_type:$(e.user_type)?globalThis.String(e.user_type):``,betas:$(e.betas)?globalThis.String(e.betas):``,env:$(e.env)?OE.fromJSON(e.env):void 0,entrypoint:$(e.entrypoint)?globalThis.String(e.entrypoint):``,agent_sdk_version:$(e.agent_sdk_version)?globalThis.String(e.agent_sdk_version):``,is_interactive:$(e.is_interactive)?globalThis.Boolean(e.is_interactive):!1,client_type:$(e.client_type)?globalThis.String(e.client_type):``,process:$(e.process)?globalThis.String(e.process):``,additional_metadata:$(e.additional_metadata)?globalThis.String(e.additional_metadata):``,auth:$(e.auth)?yE.fromJSON(e.auth):void 0,server_timestamp:$(e.server_timestamp)?EE(e.server_timestamp):void 0,event_id:$(e.event_id)?globalThis.String(e.event_id):``,device_id:$(e.device_id)?globalThis.String(e.device_id):``,swe_bench_run_id:$(e.swe_bench_run_id)?globalThis.String(e.swe_bench_run_id):``,swe_bench_instance_id:$(e.swe_bench_instance_id)?globalThis.String(e.swe_bench_instance_id):``,swe_bench_task_id:$(e.swe_bench_task_id)?globalThis.String(e.swe_bench_task_id):``,email:$(e.email)?globalThis.String(e.email):``,agent_id:$(e.agent_id)?globalThis.String(e.agent_id):``,parent_session_id:$(e.parent_session_id)?globalThis.String(e.parent_session_id):``,agent_type:$(e.agent_type)?globalThis.String(e.agent_type):``,slack:$(e.slack)?kE.fromJSON(e.slack):void 0,team_name:$(e.team_name)?globalThis.String(e.team_name):``,skill_name:$(e.skill_name)?globalThis.String(e.skill_name):``,plugin_name:$(e.plugin_name)?globalThis.String(e.plugin_name):``,marketplace_name:$(e.marketplace_name)?globalThis.String(e.marketplace_name):``}},toJSON(e){let t={};return e.event_name!==void 0&&(t.event_name=e.event_name),e.client_timestamp!==void 0&&(t.client_timestamp=e.client_timestamp.toISOString()),e.model!==void 0&&(t.model=e.model),e.session_id!==void 0&&(t.session_id=e.session_id),e.user_type!==void 0&&(t.user_type=e.user_type),e.betas!==void 0&&(t.betas=e.betas),e.env!==void 0&&(t.env=OE.toJSON(e.env)),e.entrypoint!==void 0&&(t.entrypoint=e.entrypoint),e.agent_sdk_version!==void 0&&(t.agent_sdk_version=e.agent_sdk_version),e.is_interactive!==void 0&&(t.is_interactive=e.is_interactive),e.client_type!==void 0&&(t.client_type=e.client_type),e.process!==void 0&&(t.process=e.process),e.additional_metadata!==void 0&&(t.additional_metadata=e.additional_metadata),e.auth!==void 0&&(t.auth=yE.toJSON(e.auth)),e.server_timestamp!==void 0&&(t.server_timestamp=e.server_timestamp.toISOString()),e.event_id!==void 0&&(t.event_id=e.event_id),e.device_id!==void 0&&(t.device_id=e.device_id),e.swe_bench_run_id!==void 0&&(t.swe_bench_run_id=e.swe_bench_run_id),e.swe_bench_instance_id!==void 0&&(t.swe_bench_instance_id=e.swe_bench_instance_id),e.swe_bench_task_id!==void 0&&(t.swe_bench_task_id=e.swe_bench_task_id),e.email!==void 0&&(t.email=e.email),e.agent_id!==void 0&&(t.agent_id=e.agent_id),e.parent_session_id!==void 0&&(t.parent_session_id=e.parent_session_id),e.agent_type!==void 0&&(t.agent_type=e.agent_type),e.slack!==void 0&&(t.slack=kE.toJSON(e.slack)),e.team_name!==void 0&&(t.team_name=e.team_name),e.skill_name!==void 0&&(t.skill_name=e.skill_name),e.plugin_name!==void 0&&(t.plugin_name=e.plugin_name),e.marketplace_name!==void 0&&(t.marketplace_name=e.marketplace_name),t},create(e){return AE.fromPartial(e??{})},fromPartial(e){let t=wE();return t.event_name=e.event_name??``,t.client_timestamp=e.client_timestamp??void 0,t.model=e.model??``,t.session_id=e.session_id??``,t.user_type=e.user_type??``,t.betas=e.betas??``,t.env=e.env!==void 0&&e.env!==null?OE.fromPartial(e.env):void 0,t.entrypoint=e.entrypoint??``,t.agent_sdk_version=e.agent_sdk_version??``,t.is_interactive=e.is_interactive??!1,t.client_type=e.client_type??``,t.process=e.process??``,t.additional_metadata=e.additional_metadata??``,t.auth=e.auth!==void 0&&e.auth!==null?yE.fromPartial(e.auth):void 0,t.server_timestamp=e.server_timestamp??void 0,t.event_id=e.event_id??``,t.device_id=e.device_id??``,t.swe_bench_run_id=e.swe_bench_run_id??``,t.swe_bench_instance_id=e.swe_bench_instance_id??``,t.swe_bench_task_id=e.swe_bench_task_id??``,t.email=e.email??``,t.agent_id=e.agent_id??``,t.parent_session_id=e.parent_session_id??``,t.agent_type=e.agent_type??``,t.slack=e.slack!==void 0&&e.slack!==null?kE.fromPartial(e.slack):void 0,t.team_name=e.team_name??``,t.skill_name=e.skill_name??``,t.plugin_name=e.plugin_name??``,t.marketplace_name=e.marketplace_name??``,t}}}));function ME(){return{event_id:``,timestamp:void 0,experiment_id:``,variation_id:0,environment:``,user_attributes:``,experiment_metadata:``,device_id:``,auth:void 0,session_id:``,anonymous_id:``,event_metadata_vars:``}}function NE(e){let t=(e.seconds||0)*1e3;return t+=(e.nanos||0)/1e6,new globalThis.Date(t)}function PE(e){return e instanceof globalThis.Date?e:typeof e==`string`?new globalThis.Date(e):NE(hE.fromJSON(e))}function FE(e){return e!=null}var IE,LE=t((()=>{gE(),bE(),IE={fromJSON(e){return{event_id:FE(e.event_id)?globalThis.String(e.event_id):``,timestamp:FE(e.timestamp)?PE(e.timestamp):void 0,experiment_id:FE(e.experiment_id)?globalThis.String(e.experiment_id):``,variation_id:FE(e.variation_id)?globalThis.Number(e.variation_id):0,environment:FE(e.environment)?globalThis.String(e.environment):``,user_attributes:FE(e.user_attributes)?globalThis.String(e.user_attributes):``,experiment_metadata:FE(e.experiment_metadata)?globalThis.String(e.experiment_metadata):``,device_id:FE(e.device_id)?globalThis.String(e.device_id):``,auth:FE(e.auth)?yE.fromJSON(e.auth):void 0,session_id:FE(e.session_id)?globalThis.String(e.session_id):``,anonymous_id:FE(e.anonymous_id)?globalThis.String(e.anonymous_id):``,event_metadata_vars:FE(e.event_metadata_vars)?globalThis.String(e.event_metadata_vars):``}},toJSON(e){let t={};return e.event_id!==void 0&&(t.event_id=e.event_id),e.timestamp!==void 0&&(t.timestamp=e.timestamp.toISOString()),e.experiment_id!==void 0&&(t.experiment_id=e.experiment_id),e.variation_id!==void 0&&(t.variation_id=Math.round(e.variation_id)),e.environment!==void 0&&(t.environment=e.environment),e.user_attributes!==void 0&&(t.user_attributes=e.user_attributes),e.experiment_metadata!==void 0&&(t.experiment_metadata=e.experiment_metadata),e.device_id!==void 0&&(t.device_id=e.device_id),e.auth!==void 0&&(t.auth=yE.toJSON(e.auth)),e.session_id!==void 0&&(t.session_id=e.session_id),e.anonymous_id!==void 0&&(t.anonymous_id=e.anonymous_id),e.event_metadata_vars!==void 0&&(t.event_metadata_vars=e.event_metadata_vars),t},create(e){return IE.fromPartial(e??{})},fromPartial(e){let t=ME();return t.event_id=e.event_id??``,t.timestamp=e.timestamp??void 0,t.experiment_id=e.experiment_id??``,t.variation_id=e.variation_id??0,t.environment=e.environment??``,t.user_attributes=e.user_attributes??``,t.experiment_metadata=e.experiment_metadata??``,t.device_id=e.device_id??``,t.auth=e.auth!==void 0&&e.auth!==null?yE.fromPartial(e.auth):void 0,t.session_id=e.session_id??``,t.anonymous_id=e.anonymous_id??``,t.event_metadata_vars=e.event_metadata_vars??``,t}}}));function RE(){return process.platform===`linux`&&g(process.env.CLAUDE_CODE_BUBBLEWRAP)}function zE(){return process.platform===`linux`?GE??!1:!1}async function BE(){if(KE!==void 0)return KE;if(process.platform===`darwin`)return KE=null,null;try{let e=await Ri(process.pid,10);for(let t of e){let e=t.toLowerCase();for(let t of Rr)if(e.includes(t))return KE=t,t}}catch{}return KE=null,null}async function VE(){return process.env.TERMINAL_EMULATOR===`JetBrains-JediTerm`&&Lr.platform!==`darwin`?await BE()||`pycharm`:Lr.terminal}function HE(){return process.env.TERMINAL_EMULATOR===`JetBrains-JediTerm`&&Lr.platform!==`darwin`?KE===void 0?`pycharm`:KE||`pycharm`:Lr.terminal}async function UE(){process.env.TERMINAL_EMULATOR===`JetBrains-JediTerm`&&await BE()}var WE,GE,KE,qE,JE=t((()=>{m(),Fr(),h(),ii(),Li(),WE=p(async()=>{if(process.platform!==`linux`)return!1;let{code:e}=await ai(`test`,[`-f`,`/.dockerenv`]);return e===0}),GE=null,process.platform===`linux`&&pa(`/lib/libc.musl-${process.arch===`x64`?`x86_64`:`aarch64`}.so.1`).then(()=>{GE=!0},()=>{GE=!1}),qE={...Lr,terminal:HE(),getIsDocker:WE,getIsBubblewrapSandbox:RE,isMuslEnvironment:zE,getTerminalWithJetBrainsDetectionAsync:VE,initJetBrainsDetection:UE}}));function YE(e){return XE?.has(e)??!1}var XE,ZE=t((()=>{M(),In()}));function QE(){return!g(process.env.CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS_DISABLED)}var $E=t((()=>{h()}));function eD(){return aD.getStore()}function tD(e,t){return aD.run(e,t)}function nD(e){return e?.agentType===`subagent`}function rD(){let e=eD();if(!(!nD(e)||!e.subagentName))return e.isBuiltIn?e.subagentName:`user-defined`}function iD(){let e=eD();if(!(!e?.invokingRequestId||e.invocationEmitted))return e.invocationEmitted=!0,{invokingRequestId:e.invokingRequestId,invocationKind:e.invocationKind}}var aD,oD=t((()=>{$E(),aD=new va}));function sD(e){return e.startsWith(`mcp__`)?`mcp_tool`:e}function cD(){return g(process.env.OTEL_LOG_TOOL_DETAILS)}function lD(e,t){return!!(process.env.CLAUDE_CODE_ENTRYPOINT===`local-agent`||e===`claudeai-proxy`||t&&YE(t))}function uD(e,t,n){let r=dD(e);return!r||!xD.has(r.serverName)&&!lD(t,n)?{}:{mcpServerName:r.serverName,mcpToolName:r.mcpToolName}}function dD(e){if(!e.startsWith(`mcp__`))return;let t=e.split(`__`);if(t.length<3)return;let n=t[1],r=t.slice(2).join(`__`);if(!(!n||!r))return{serverName:n,mcpToolName:r}}function fD(e,t){if(e===`Skill`&&typeof t==`object`&&t&&`skill`in t&&typeof t.skill==`string`)return t.skill}function pD(e,t=0){if(typeof e==`string`)return e.length>SD?`${e.slice(0,CD)}…[${e.length} chars]`:e;if(typeof e==`number`||typeof e==`boolean`||e==null)return e;if(t>=ED)return`<nested>`;if(Array.isArray(e)){let n=e.slice(0,TD).map(e=>pD(e,t+1));return e.length>TD&&n.push(`…[${e.length} items]`),n}if(typeof e==`object`){let n=Object.entries(e).filter(([e])=>!e.startsWith(`_`)),r=n.slice(0,TD).map(([e,n])=>[e,pD(n,t+1)]);return n.length>TD&&r.push([`…`,`${n.length} keys`]),Object.fromEntries(r)}return String(e)}function mD(e){if(!cD())return;let t=k(pD(e));return t.length>wD&&(t=t.slice(0,wD)+`…[truncated]`),t}function hD(e){let t=Ki(e).toLowerCase();if(!t||t===`.`)return;let n=t.slice(1);return n.length>DD?`other`:n}function gD(e,t){if(!e.includes(`.`)&&!t)return;let n,r=new Set;if(t){let e=hD(t);e&&(r.add(e),n=e)}for(let t of e.split(kD)){if(!t)continue;let e=t.split(AD);if(e.length<2)continue;let i=e[0],a=i.lastIndexOf(`/`),o=a>=0?i.slice(a+1):i;if(OD.has(o))for(let t=1;t<e.length;t++){let i=e[t];if(i.charCodeAt(0)===45)continue;let a=hD(i);a&&!r.has(a)&&(r.add(a),n=n?n+`,`+a:a)}}if(n)return n}function _D(){let e=eD();if(e){let t={agentId:e.agentId,parentSessionId:e.parentSessionId,agentType:e.agentType};return e.agentType===`teammate`&&(t.teamName=e.teamName),t}let t=Si(),n=bi(),r=_i(),i=yi()?`teammate`:t?`standalone`:void 0;if(t||i||n||r)return{...t?{agentId:t}:{},...i?{agentType:i}:{},...n?{parentSessionId:n}:{},...r?{teamName:r}:{}};let a=vn();return a?{parentSessionId:a}:{}}function vD(){try{let e=process.memoryUsage(),t=process.cpuUsage(),n=Date.now(),r;if(ND&&PD){let e=n-PD;e>0&&(r=(t.user-ND.user+(t.system-ND.system))/(e*1e3)*100)}return ND=t,PD=n,{uptime:process.uptime(),rss:e.rss,heapTotal:e.heapTotal,heapUsed:e.heapUsed,external:e.external,arrayBuffers:e.arrayBuffers,constrainedMemory:process.constrainedMemory(),cpuUsage:t,cpuPercent:r}}catch{return}}async function yD(e={}){let t=e.model?String(e.model):jx(),n=typeof e.betas==`string`?e.betas:$S(t).join(`,`),[r,i]=await Promise.all([MD(),xr()]),a=vD();return{model:t,sessionId:at(),userType:process.env.USER_TYPE||``,...n.length>0?{betas:n}:{},envContext:r,...process.env.CLAUDE_CODE_ENTRYPOINT&&{entrypoint:process.env.CLAUDE_CODE_ENTRYPOINT},...process.env.CLAUDE_AGENT_SDK_VERSION&&{agentSdkVersion:process.env.CLAUDE_AGENT_SDK_VERSION},isInteractive:String(mt()),clientType:st(),...a&&{processMetrics:a},sweBenchRunId:process.env.SWE_BENCH_RUN_ID||``,sweBenchInstanceId:process.env.SWE_BENCH_INSTANCE_ID||``,sweBenchTaskId:process.env.SWE_BENCH_TASK_ID||``,..._D(),...X()&&{subscriptionType:X()},...xt()?{kairosActive:!0}:{},...i&&{rh:i}}}function bD(e,t,n={}){let{envContext:r,processMetrics:i,rh:a,kairosActive:o,skillMode:s,observerMode:c,...l}=e,u={platform:r.platform,platform_raw:r.platformRaw,arch:r.arch,node_version:r.nodeVersion,terminal:r.terminal||`unknown`,package_managers:r.packageManagers,runtimes:r.runtimes,is_running_with_bun:r.isRunningWithBun,is_ci:r.isCi,is_claubbit:r.isClaubbit,is_claude_code_remote:r.isClaudeCodeRemote,is_local_agent_mode:r.isLocalAgentMode,is_conductor:r.isConductor,is_github_action:r.isGithubAction,is_claude_code_action:r.isClaudeCodeAction,is_claude_ai_auth:r.isClaudeAiAuth,version:r.version,build_time:r.buildTime,deployment_environment:r.deploymentEnvironment};r.remoteEnvironmentType&&(u.remote_environment_type=r.remoteEnvironmentType),r.claudeCodeContainerId&&(u.claude_code_container_id=r.claudeCodeContainerId),r.claudeCodeRemoteSessionId&&(u.claude_code_remote_session_id=r.claudeCodeRemoteSessionId),r.tags&&(u.tags=r.tags.split(`,`).map(e=>e.trim()).filter(Boolean)),r.githubEventName&&(u.github_event_name=r.githubEventName),r.githubActionsRunnerEnvironment&&(u.github_actions_runner_environment=r.githubActionsRunnerEnvironment),r.githubActionsRunnerOs&&(u.github_actions_runner_os=r.githubActionsRunnerOs),r.githubActionRef&&(u.github_action_ref=r.githubActionRef),r.wslVersion&&(u.wsl_version=r.wslVersion),r.linuxDistroId&&(u.linux_distro_id=r.linuxDistroId),r.linuxDistroVersion&&(u.linux_distro_version=r.linuxDistroVersion),r.linuxKernel&&(u.linux_kernel=r.linuxKernel),r.vcs&&(u.vcs=r.vcs),r.versionBase&&(u.version_base=r.versionBase);let d={session_id:l.sessionId,model:l.model,user_type:l.userType,is_interactive:l.isInteractive===`true`,client_type:l.clientType};if(l.betas&&(d.betas=l.betas),l.entrypoint&&(d.entrypoint=l.entrypoint),l.agentSdkVersion&&(d.agent_sdk_version=l.agentSdkVersion),l.sweBenchRunId&&(d.swe_bench_run_id=l.sweBenchRunId),l.sweBenchInstanceId&&(d.swe_bench_instance_id=l.sweBenchInstanceId),l.sweBenchTaskId&&(d.swe_bench_task_id=l.sweBenchTaskId),l.agentId&&(d.agent_id=l.agentId),l.parentSessionId&&(d.parent_session_id=l.parentSessionId),l.agentType&&(d.agent_type=l.agentType),l.teamName&&(d.team_name=l.teamName),t.githubActionsMetadata){let e=t.githubActionsMetadata;u.github_actions_metadata={actor_id:e.actorId,repository_id:e.repositoryId,repository_owner_id:e.repositoryOwnerId}}let f;return(t.accountUuid||t.organizationUuid)&&(f={account_uuid:t.accountUuid,organization_uuid:t.organizationUuid}),{env:u,...i&&{process:Buffer.from(k(i)).toString(`base64`)},...f&&{auth:f},core:d,additional:{...a&&{rh:a},...o&&{is_assistant_mode:!0},...s&&{skill_mode:s},...c&&{observer_mode:c},...n}}}var xD,SD,CD,wD,TD,ED,DD,OD,kD,AD,jD,MD,ND,PD,FD=t((()=>{m(),Fr(),JE(),tC(),rS(),O(),h(),ZE(),Q(),wr(),qr(),oD(),ur(),xi(),xD=new Set([(Bi(),e(zi)).COMPUTER_USE_MCP_SERVER_NAME]),SD=512,CD=128,wD=4*1024,TD=20,ED=2,DD=10,OD=new Set([`rm`,`mv`,`cp`,`touch`,`mkdir`,`chmod`,`chown`,`cat`,`head`,`tail`,`sort`,`stat`,`diff`,`wc`,`grep`,`rg`,`sed`]),kD=/\s*(?:&&|\|\||[;|])\s*/,AD=/\s+/,jD=p(()=>{let e=`2.6.10`.match(/^\d+\.\d+\.\d+(?:-[a-z]+)?/);return e?e[0]:void 0}),MD=p(async()=>{let[e,t,n,r]=await Promise.all([Lr.getPackageManagers(),Lr.getRuntimes(),Jr(),Kr()]);return{platform:Ir(),platformRaw:process.env.CLAUDE_CODE_HOST_PLATFORM||process.platform,arch:Lr.arch,nodeVersion:Lr.nodeVersion,terminal:qE.terminal,packageManagers:e.join(`,`),runtimes:t.join(`,`),isRunningWithBun:Lr.isRunningWithBun(),isCi:g(process.env.CI),isClaubbit:g(process.env.CLAUBBIT),isClaudeCodeRemote:g(process.env.CLAUDE_CODE_REMOTE),isLocalAgentMode:process.env.CLAUDE_CODE_ENTRYPOINT===`local-agent`,isConductor:Lr.isConductor(),...process.env.CLAUDE_CODE_REMOTE_ENVIRONMENT_TYPE&&{remoteEnvironmentType:process.env.CLAUDE_CODE_REMOTE_ENVIRONMENT_TYPE},...process.env.CLAUDE_CODE_CONTAINER_ID&&{claudeCodeContainerId:process.env.CLAUDE_CODE_CONTAINER_ID},...process.env.CLAUDE_CODE_REMOTE_SESSION_ID&&{claudeCodeRemoteSessionId:process.env.CLAUDE_CODE_REMOTE_SESSION_ID},...process.env.CLAUDE_CODE_TAGS&&{tags:process.env.CLAUDE_CODE_TAGS},isGithubAction:g(process.env.GITHUB_ACTIONS),isClaudeCodeAction:g(process.env.CLAUDE_CODE_ACTION),isClaudeAiAuth:Y(),version:`2.6.10`,versionBase:jD(),buildTime:`2026-06-04T16:04:58.907Z`,deploymentEnvironment:Lr.detectDeploymentEnvironment(),...g(process.env.GITHUB_ACTIONS)&&{githubEventName:process.env.GITHUB_EVENT_NAME,githubActionsRunnerEnvironment:process.env.RUNNER_ENVIRONMENT,githubActionsRunnerOs:process.env.RUNNER_OS,githubActionRef:process.env.GITHUB_ACTION_PATH?.includes(`claude-code-action/`)?process.env.GITHUB_ACTION_PATH.split(`claude-code-action/`)[1]:void 0},...Wr()&&{wslVersion:Wr()},...n??{},...r.length>0?{vcs:r.join(`,`)}:{}}}),ND=null,PD=null}));function ID(){return Ui.join(ae(),`telemetry`)}function LD(e){if(!v.isAxiosError(e))return An(e);let t=[],n=e.response?.headers?.[`request-id`];return n&&t.push(`request-id=${n}`),e.response?.status&&t.push(`status=${e.response.status}`),e.code&&t.push(`code=${e.code}`),e.message&&t.push(e.message),t.join(`, `)}var RD,zD,BD,VD=t((()=>{we(),Ie(),O(),jE(),LE(),Q(),rp(),M(),h(),In(),_T(),di(),Vr(),Ii(),ur(),oT(),vy(),hr(),FD(),ce(),RD=sa(),zD=`1p_failed_events.`,BD=class{constructor(e={}){_(this,`endpoint`,void 0),_(this,`timeout`,void 0),_(this,`maxBatchSize`,void 0),_(this,`skipAuth`,void 0),_(this,`batchDelayMs`,void 0),_(this,`baseBackoffDelayMs`,void 0),_(this,`maxBackoffDelayMs`,void 0),_(this,`maxAttempts`,void 0),_(this,`isKilled`,void 0),_(this,`pendingExports`,[]),_(this,`isShutdown`,!1),_(this,`schedule`,void 0),_(this,`cancelBackoff`,null),_(this,`attempts`,0),_(this,`isRetrying`,!1),_(this,`lastExportErrorContext`,void 0),this.endpoint=`${e.baseUrl||(process.env.ANTHROPIC_BASE_URL===`https://api-staging.anthropic.com`?`https://api-staging.anthropic.com`:`https://api.anthropic.com`)}${e.path||`/api/event_logging/batch`}`,this.timeout=e.timeout||1e4,this.maxBatchSize=e.maxBatchSize||200,this.skipAuth=e.skipAuth??!1,this.batchDelayMs=e.batchDelayMs||100,this.baseBackoffDelayMs=e.baseBackoffDelayMs||500,this.maxBackoffDelayMs=e.maxBackoffDelayMs||3e4,this.maxAttempts=e.maxAttempts??8,this.isKilled=e.isKilled??(()=>!1),this.schedule=e.schedule??((e,t)=>{let n=setTimeout(e,t);return()=>clearTimeout(n)}),this.retryPreviousBatches()}async getQueuedEventCount(){return(await this.loadEventsFromCurrentBatch()).length}getCurrentBatchFilePath(){return Ui.join(ID(),`${zD}${at()}.${RD}.json`)}async loadEventsFromFile(e){try{return await ci(e)}catch{return[]}}async loadEventsFromCurrentBatch(){return this.loadEventsFromFile(this.getCurrentBatchFilePath())}async saveEventsToFile(e,t){try{if(t.length===0)try{await ma(e)}catch{}else await la(ID(),{recursive:!0}),await ha(e,t.map(e=>k(e)).join(`
|
|
35
|
+
`),gt(),e===`localSettings`&&vp(j_(`localSettings`),dn())}catch(e){let t=Error(`Failed to read raw settings from ${n}: ${e}`);return I(t),{error:t}}return{error:null}}function F_(e,t){return pi([...e,...t])}function I_(e,t){if(Array.isArray(e)&&Array.isArray(t))return F_(e,t)}function L_(e){let t=Dg().strip().parse(e),n=[`permissions`,`sandbox`,`hooks`],r=[],i={permissions:new Set([`allow`,`deny`,`ask`,`defaultMode`,`disableBypassPermissionsMode`,...[`disableAutoMode`],`additionalDirectories`]),sandbox:new Set([`enabled`,`failIfUnavailable`,`allowUnsandboxedCommands`,`network`,`filesystem`,`ignoreViolations`,`excludedCommands`,`autoAllowBashIfSandboxed`,`enableWeakerNestedSandbox`,`enableWeakerNetworkIsolation`,`ripgrep`]),hooks:new Set([`PreToolUse`,`PostToolUse`,`Notification`,`UserPromptSubmit`,`SessionStart`,`SessionEnd`,`Stop`,`SubagentStop`,`PreCompact`,`PostCompact`,`TeammateIdle`,`TaskCreated`,`TaskCompleted`])};for(let e of Object.keys(t))if(n.includes(e)&&t[e]&&typeof t[e]==`object`){let n=t[e],a=i[e];if(a)for(let t of Object.keys(n))a.has(t)&&r.push(`${e}.${t}`)}else r.push(e);return r.sort()}function R_(){if(q_)return{settings:{},errors:[]};let e=Date.now();wi(`loadSettingsFromDisk_start`),yr(`info`,`settings_load_started`),q_=!0;try{let t=Tn(),n={};t&&(n=hu(n,t,I_));let r=[],i=new Set,a=new Set;for(let e of Tp()){if(e===`policySettings`){let e=null,t=[],a=dp();if(a&&Object.keys(a).length>0){let n=Dg().safeParse(a);n.success?e=n.data:t.push(...Hg(n.error,`remote managed settings`))}if(!e){let n=l_();Object.keys(n.settings).length>0&&(e=n.settings),t.push(...n.errors)}if(!e){let{settings:n,errors:r}=C_();n&&(e=n),t.push(...r)}if(!e){let n=u_();Object.keys(n.settings).length>0&&(e=n.settings),t.push(...n.errors)}e&&(n=hu(n,e,I_));for(let e of t){let t=`${e.file}:${e.path}:${e.message}`;i.has(t)||(i.add(t),r.push(e))}continue}let t=A_(e);if(t){let e=Xi(t);if(!a.has(e)){a.add(e);let{settings:o,errors:s}=E_(t);for(let e of s){let t=`${e.file}:${e.path}:${e.message}`;i.has(t)||(i.add(t),r.push(e))}o&&(n=hu(n,o,I_))}}if(e===`flagSettings`){let e=ut();if(e){let t=Dg().safeParse(e);t.success&&(n=hu(n,t.data,I_))}}}return yr(`info`,`settings_load_completed`,{duration_ms:Date.now()-e,source_count:a.size,error_count:r.length}),{settings:n,errors:r}}finally{q_=!1}}function z_(){let{settings:e}=V_();return e||{}}function B_(){gt();let e=[];for(let t of Tp()){let n=U(t);n&&Object.keys(n).length>0&&e.push({source:t,settings:n})}return{effective:z_(),sources:e}}function V_(){let e=it();if(e!==null)return e;let t=R_();return wi(`loadSettingsFromDisk_end`),Ct(t),t}function H_(){return!!(U(`userSettings`)?.skipDangerousModePermissionPrompt||U(`localSettings`)?.skipDangerousModePermissionPrompt||U(`flagSettings`)?.skipDangerousModePermissionPrompt||U(`policySettings`)?.skipDangerousModePermissionPrompt)}function U_(){return!0}function W_(){return U(`policySettings`)?.useAutoModeDuringPlan!==!1&&U(`flagSettings`)?.useAutoModeDuringPlan!==!1&&U(`userSettings`)?.useAutoModeDuringPlan!==!1&&U(`localSettings`)?.useAutoModeDuringPlan!==!1}function G_(){{let e=D({allow:S(b()).optional(),soft_deny:S(b()).optional(),deny:S(b()).optional(),environment:S(b()).optional()}),t=[],n=[],r=[];for(let i of[`userSettings`,`localSettings`,`flagSettings`,`policySettings`]){let a=U(i);if(!a)continue;let o=e.safeParse(a.autoMode);o.success&&(o.data.allow&&t.push(...o.data.allow),o.data.soft_deny&&n.push(...o.data.soft_deny),process.env.USER_TYPE===`ant`&&o.data.deny&&n.push(...o.data.deny),o.data.environment&&r.push(...o.data.environment))}if(t.length>0||n.length>0||r.length>0)return{...t.length>0&&{allow:t},...n.length>0&&{soft_deny:n},...r.length>0&&{environment:r}}}}function K_(e){for(let t of Tp()){if(t===`policySettings`)continue;let n=A_(t);if(n)try{let{resolvedPath:t}=fr(j(),n),r=jd(t);if(!r.trim())continue;let i=fi(r,!1);if(i&&typeof i==`object`&&e in i)return!0}catch(e){T_(e,n)}}return!1}var q_,J_,Y_=t((()=>{gu(),Je(),O(),hp(),Ci(),M(),br(),h(),In(),sf(),Md(),Jn(),yp(),di(),Vr(),qr(),ur(),Ti(),Ap(),Fp(),uf(),x_(),Ft(),Og(),Gg(),q_=!1,J_=z_}));function X_(e,t){return e.find(e=>e.includes(t))??null}async function Z_(){let{BedrockClient:e}=await import(`./dist-es-4z5T3Jzm.js`),t=oe(),n=g(process.env.CLAUDE_CODE_SKIP_BEDROCK_AUTH),r={region:t,...process.env.ANTHROPIC_BEDROCK_BASE_URL&&{endpoint:process.env.ANTHROPIC_BEDROCK_BASE_URL},...await Mi(),...n&&{requestHandler:new(await(import(`./dist-es-hdN_ShpZ.js`))).NodeHttpHandler,httpAuthSchemes:[{schemeId:`smithy.api#noAuth`,identityProvider:()=>async()=>({}),signer:new(await(import(`./dist-es-CZkzHpjF.js`))).NoAuthSigner}],httpAuthSchemeProvider:()=>[{schemeId:`smithy.api#noAuth`}]}};if(!n&&!process.env.AWS_BEARER_TOKEN_BEDROCK){let e=await Kw();e&&(r.credentials={accessKeyId:e.accessKeyId,secretAccessKey:e.secretAccessKey,sessionToken:e.sessionToken})}return new e(r)}async function Q_(){let{BedrockRuntimeClient:e}=await import(`./dist-es-DN7otr6F.js`),t=oe(),n=g(process.env.CLAUDE_CODE_SKIP_BEDROCK_AUTH),r={region:t,...process.env.ANTHROPIC_BEDROCK_BASE_URL&&{endpoint:process.env.ANTHROPIC_BEDROCK_BASE_URL},...await Mi(),...n&&{requestHandler:new(await(import(`./dist-es-hdN_ShpZ.js`))).NodeHttpHandler,httpAuthSchemes:[{schemeId:`smithy.api#noAuth`,identityProvider:()=>async()=>({}),signer:new(await(import(`./dist-es-CZkzHpjF.js`))).NoAuthSigner}],httpAuthSchemeProvider:()=>[{schemeId:`smithy.api#noAuth`}]}};if(!n&&!process.env.AWS_BEARER_TOKEN_BEDROCK){let e=await Kw();e&&(r.credentials={accessKeyId:e.accessKeyId,secretAccessKey:e.secretAccessKey,sessionToken:e.sessionToken})}return new e(r)}function $_(e){return e.startsWith(`anthropic.`)}function ev(e){if(!e.startsWith(`arn:`))return e;let t=e.lastIndexOf(`/`);return t===-1?e:e.substring(t+1)}function tv(e){let t=ev(e);for(let e of av)if(t.startsWith(`${e}.anthropic.`))return e}function nv(e,t){let n=tv(e);return n?e.replace(`${n}.`,`${t}.`):$_(e)?`${t}.${e}`:e}var rv,iv,av,ov=t((()=>{m(),Q(),h(),Vr(),Pi(),rv=p(async function(){let[e,{ListInferenceProfilesCommand:t}]=await Promise.all([Z_(),import(`./dist-es-4z5T3Jzm.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 I(e),e}}),iv=p(async function(e){try{let[t,{GetInferenceProfileCommand:n}]=await Promise.all([Z_(),import(`./dist-es-4z5T3Jzm.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 I(e),null}}),av=[`us`,`eu`,`apac`,`global`]})),sv,cv,lv,uv,dv,fv,pv,mv,hv,gv,_v,vv,yv,bv,xv=t((()=>{sv={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`},cv={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`},lv={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`},uv={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`},dv={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`},fv={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`},pv={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`},mv={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`},hv={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`},gv={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`},_v={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`},vv={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`},yv={haiku35:lv,haiku45:uv,sonnet35:cv,sonnet37:sv,sonnet40:dv,sonnet45:fv,sonnet46:vv,opus40:pv,opus41:mv,opus45:hv,opus46:gv,opus47:_v},Object.values(yv).map(e=>e.firstParty),bv=Object.fromEntries(Object.entries(yv).map(([e,t])=>[t.firstParty,e]))}));function W(e=z_()){let t=e.modelType;return t===`openai`?`openai`:t===`gemini`?`gemini`:t===`grok`?`grok`:g(process.env.CLAUDE_CODE_USE_BEDROCK)?`bedrock`:g(process.env.CLAUDE_CODE_USE_VERTEX)?`vertex`:g(process.env.CLAUDE_CODE_USE_FOUNDRY)?`foundry`:g(process.env.CLAUDE_CODE_USE_OPENAI)?`openai`:g(process.env.CLAUDE_CODE_USE_GEMINI)?`gemini`:g(process.env.CLAUDE_CODE_USE_GROK)?`grok`:`firstParty`}function Sv(){return W()}function Cv(){let e=process.env.ANTHROPIC_BASE_URL;if(!e)return!0;try{let t=new URL(e).host,n=[`api.anthropic.com`];return process.env.USER_TYPE===`ant`&&n.push(`api-staging.anthropic.com`),n.includes(t)}catch{return!1}}var wv=t((()=>{Y_(),h()}));function Tv(e){let t={};for(let n of jv)t[n]=yv[n][e];return t}async function Ev(){let e=Tv(`bedrock`),t;try{t=await rv()}catch(t){return I(t),e}if(!t?.length)return e;let n={};for(let r of jv){let i=yv[r].firstParty;n[r]=X_(t,i)||e[r]}return n}function Dv(e){let t=z_().modelOverrides;if(!t)return e;let n={...e};for(let[e,r]of Object.entries(t)){let t=bv[e];t&&r&&(n[t]=r)}return n}function Ov(e){let t;try{t=z_().modelOverrides}catch{return e}if(!t)return e;for(let[n,r]of Object.entries(t))if(r===e)return n;return e}function kv(){if(gn()===null){if(W()!==`bedrock`){Wt(Tv(W()));return}Mv()}}function G(){let e=gn();return e===null?(kv(),Dv(Tv(W()))):Dv(e)}async function Av(){if(gn()===null){if(W()!==`bedrock`){Wt(Tv(W()));return}await Mv()}}var jv,Mv,Nv=t((()=>{O(),Vr(),ap(),Y_(),ov(),xv(),wv(),jv=Object.keys(yv),Mv=ip(async()=>{if(gn()===null)try{Wt(await Ev())}catch(e){I(e)}})}));function Pv(){if(g(process.env.DISABLE_COST_WARNINGS)||Y())return!1;let e=jC(),t=MC()!==null;if(!e.hasToken&&!t)return!1;let n=H(),r=n.oauthAccount?.organizationRole,i=n.oauthAccount?.workspaceRole;return!r||!i?!1:[`admin`,`billing`].includes(r)||[`workspace_admin`,`workspace_billing`].includes(i)}function Fv(e){Lv=e}function Iv(){if(Lv!==null)return Lv;if(!Y())return!1;let e=X();if(e===`max`||e===`pro`)return!0;let t=H().oauthAccount?.organizationRole;return!!t&&[`admin`,`billing`,`owner`,`primary_owner`].includes(t)}var Lv,Rv=t((()=>{Q(),rp(),h(),Lv=null}));function zv(){return process.env.USER_TYPE===`ant`?process.env.CLAUDE_MOCK_HEADERLESS_429?process.env.CLAUDE_MOCK_HEADERLESS_429:Yv?Xv:null:null}function Bv(){return!Yv||process.env.USER_TYPE!==`ant`||Object.keys(Jv).length===0?null:Jv}function Vv(){Jv={},ty=[],Zv=null,Qv=null,$v=null,Xv=null,Fv(null),Yv=!1}function Hv(e){let t=Bv();if(!t)return e;let n=new globalThis.Headers(e);return Object.entries(t).forEach(([e,t])=>{t!==void 0&&n.set(e,t)}),n}function Uv(){return process.env.USER_TYPE===`ant`?Yv||!!process.env.CLAUDE_MOCK_HEADERLESS_429:!1}function Wv(){return!Yv||process.env.USER_TYPE!==`ant`?null:Zv||ey}function Gv(){return Yv&&Zv!==null&&process.env.USER_TYPE===`ant`}function Kv(){return Qv!==null}function qv(e){if(Qv===null||!e)return null;if($v!==null&&Date.now()>=$v)return Vv(),null;$v===null&&($v=Date.now()+Qv);let t=$v-Date.now(),n={...Jv};return n[`retry-after`]=String(Math.max(1,Math.ceil(t/1e3))),n}var Jv,Yv,Xv,Zv,Qv,$v,ey,ty,ny=t((()=>{Rv(),Jv={},Yv=!1,Xv=null,Zv=null,Qv=null,$v=null,ey=`max`}));async function ry(){let e=H().oauthAccount?.accountUuid,t=MC();if(!e||!t)return;let n=`${P().BASE_API_URL}/api/claude_cli_profile`;try{return(await v.get(n,{headers:{"x-api-key":t,"anthropic-beta":Dr},params:{account_uuid:e},timeout:1e4})).data}catch(e){I(e)}}async function iy(e){let t=`${P().BASE_API_URL}/api/oauth/profile`;try{return(await v.get(t,{headers:{Authorization:`Bearer ${e}`,"Content-Type":`application/json`},timeout:1e4})).data}catch(e){I(e)}}var ay=t((()=>{Ie(),kr(),Q(),rp(),Vr()}));function oy(e){return!!e?.includes(Tr)}function sy(e){return e?.split(` `).filter(Boolean)??[]}function cy({codeChallenge:e,state:t,port:n,isManual:r,loginWithClaudeAi:i,inferenceOnly:a,orgUUID:o,loginHint:s,loginMethod:c}){let l=i?P().CLAUDE_AI_AUTHORIZE_URL:P().CONSOLE_AUTHORIZE_URL,u=new URL(l);u.searchParams.append(`code`,`true`),u.searchParams.append(`client_id`,P().CLIENT_ID),u.searchParams.append(`response_type`,`code`),u.searchParams.append(`redirect_uri`,r?P().MANUAL_REDIRECT_URL:`http://localhost:${n}/callback`);let d=a?[Tr]:Or;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 ly(e,t,n,r,i=!1,a){let o={grant_type:`authorization_code`,code:e,redirect_uri:i?P().MANUAL_REDIRECT_URL:`http://localhost:${r}/callback`,client_id:P().CLIENT_ID,code_verifier:n,state:t};a!==void 0&&(o.expires_in=a);let s=await v.post(P().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 N(`tengu_oauth_token_exchange_success`,{}),s.data}async function uy(e,{scopes:t}={}){let n={grant_type:`refresh_token`,refresh_token:e,client_id:P().CLIENT_ID,scope:(t?.length?t:Er).join(` `)};try{let t=await v.post(P().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=sy(r.scope);N(`tengu_oauth_token_refresh_success`,{});let l=H(),u=Z(),d=l.oauthAccount?.billingType!==void 0&&l.oauthAccount?.accountCreatedAt!==void 0&&l.oauthAccount?.subscriptionCreatedAt!==void 0&&u?.subscriptionType!=null&&u?.rateLimitTier!=null?null:await my(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&&V(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=v.isAxiosError(e)&&e.response?.data?JSON.stringify(e.response.data):void 0;throw N(`tengu_oauth_token_refresh_failure`,{error:e.message,...t&&{responseBody:t}}),e}}async function dy(e){let t=await v.get(P().ROLES_URL,{headers:{Authorization:`Bearer ${e}`}});if(t.status!==200)throw Error(`Failed to fetch user roles: ${t.statusText}`);let n=t.data;if(!H().oauthAccount)throw Error(`OAuth account information not found in config`);V(e=>({...e,oauthAccount:e.oauthAccount?{...e.oauthAccount,organizationRole:n.organization_role,workspaceRole:n.workspace_role,organizationName:n.organization_name}:e.oauthAccount})),N(`tengu_oauth_roles_stored`,{org_role:n.organization_role})}async function fy(e){try{let t=await v.post(P().API_KEY_URL,null,{headers:{Authorization:`Bearer ${e}`}}),n=t.data?.raw_key;return n?(await cw(n),N(`tengu_oauth_api_key`,{status:`success`,statusCode:t.status}),n):null}catch(e){throw N(`tengu_oauth_api_key`,{status:`failure`,error:e instanceof Error?e.message:String(e)}),e}}function py(e){return e===null?!1:Date.now()+300*1e3>=e}async function my(e){let t=await iy(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),N(`tengu_oauth_profile_fetch_success`,{}),{...i,rawProfile:t}}async function hy(){let e=H().oauthAccount?.organizationUuid;if(e)return e;let t=Z()?.accessToken;return t===void 0||!bw()?null:(await iy(t))?.organization?.uuid||null}async function gy(){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&&(H().oauthAccount||_y({accountUuid:e,emailAddress:t,organizationUuid:n})),await vw();let i=H();if(i.oauthAccount&&i.oauthAccount.billingType!==void 0&&i.oauthAccount.accountCreatedAt!==void 0&&i.oauthAccount.subscriptionCreatedAt!==void 0||!Y()||!bw())return!1;let a=Z();if(a?.accessToken){let e=await iy(a.accessToken);if(e)return r&&A(`OAuth profile fetch succeeded, overriding env var account info`,{level:`info`}),_y({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 _y({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),V(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 vy=t((()=>{Ie(),hr(),kr(),Q(),rp(),M(),ay()}));function yy(e,t,n){if(g(process.env.CLAUDE_CODE_REMOTE))try{ea(wy,{recursive:!0,mode:448}),ia(e,t,{encoding:`utf8`,mode:384}),A(`Persisted ${n} to ${e} for subprocess access`)}catch(e){A(`Failed to persist ${n} to disk (non-fatal): ${An(e)}`,{level:`error`})}}function by(e,t){try{let n=j().readFileSync(e,{encoding:`utf8`}).trim();return n?(A(`Read ${t} from well-known file ${e}`),n):null}catch(n){return Fn(n)||A(`Failed to read ${t} from ${e}: ${An(n)}`,{level:`debug`}),null}}function xy({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=by(t,n);return i(e),e}let s=parseInt(o,10);if(Number.isNaN(s))return A(`${e} must be a valid file descriptor number, got: ${o}`,{level:`error`}),i(null),null;try{let e=j(),r=process.platform===`darwin`||process.platform===`freebsd`?`/dev/fd/${s}`:`/proc/self/fd/${s}`,a=e.readFileSync(r,{encoding:`utf8`}).trim();return a?(A(`Successfully read ${n} from file descriptor ${s}`),i(a),yy(t,a,n),a):(A(`File descriptor contained empty ${n}`,{level:`error`}),i(null),null)}catch(e){A(`Failed to read ${n} from file descriptor ${s}: ${An(e)}`,{level:`error`});let r=by(t,n);return i(r),r}}function Sy(){return xy({envVar:`CLAUDE_CODE_OAUTH_TOKEN_FILE_DESCRIPTOR`,wellKnownPath:Ty,label:`OAuth token`,getCached:Gt,setCached:Jt})}function Cy(){return xy({envVar:`CLAUDE_CODE_API_KEY_FILE_DESCRIPTOR`,wellKnownPath:Ey,label:`API key`,getCached:wn,setCached:ot})}var wy,Ty,Ey,Dy,Oy=t((()=>{O(),M(),h(),In(),Jn(),wy=`/home/claude/.claude/remote`,Ty=`${wy}/.oauth_token`,Ey=`${wy}/.api_key`,Dy=`${wy}/.session_ingress_token`}));function ky(e=``){let t=ae(),n=process.env.CLAUDE_CONFIG_DIR?`-${aa(`sha256`).update(t).digest(`hex`).substring(0,8)}`:``;return`Claude Code${P().OAUTH_FILE_SUFFIX}${e}${n}`}function Ay(){try{return process.env.USER||Hi().username}catch{return`claude-code-user`}}function jy(){K.cache={data:null,cachedAt:0},K.generation++,K.readInFlight=null}function My(e){if(K.cache.cachedAt!==0)return;let t=null;if(e)try{t=JSON.parse(e)}catch{return}K.cache={data:t,cachedAt:Date.now()}}var Ny,K,Py=t((()=>{kr(),h(),Ny=`-credentials`,K={cache:{data:null,cachedAt:0},generation:0,readInFlight:null}}));async function Fy(){if(process.platform===`darwin`&&(await Pr(`security delete-generic-password -a $USER -s "${ky()}"`,{shell:!0,reject:!1})).exitCode!==0)throw Error(`Failed to delete keychain entry`)}function Iy(e){return e.slice(-20)}var Ly=t((()=>{Nr(),Py()}));function Ry(e){return e?.name===`CredentialsProviderError`}function zy(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 By(){let{STSClient:e,GetCallerIdentityCommand:t}=await import(`./dist-es-D1LN6CJd.js`);await new e().send(new t({}))}async function Vy(){try{A(`Clearing AWS credential provider cache`);let{fromIni:e}=await import(`./dist-es-DGn8uOwQ2.js`);await e({ignoreCache:!0})(),A(`AWS credential provider cache refreshed`)}catch{A(`Failed to clear AWS credential cache (this is expected if no credentials are configured)`)}}var Hy=t((()=>{M()})),Uy,Wy=t((()=>{ft(),ce(),Uy=class e{constructor(){_(this,`status`,{isAuthenticating:!1,output:[]}),_(this,`changed`,Ot()),_(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)}},_(Uy,`instance`,null)})),Gy,Ky,qy,Jy,Yy,Xy,Zy,Qy,$y,eb,tb,nb,rb,ib,ab,ob,sb,cb,lb=t((()=>{Gy=`claude-code-20250219`,Ky=`interleaved-thinking-2025-05-14`,qy=`context-1m-2025-08-07`,Jy=`context-management-2025-06-27`,Yy=`structured-outputs-2025-12-15`,Xy=`web-search-2025-03-05`,Zy=`tool-search-tool-2025-10-19`,Qy=`effort-2025-11-24`,$y=`task-budgets-2026-03-13`,eb=`prompt-caching-scope-2026-01-05`,tb=`fast-mode-2026-02-01`,nb=`redact-thinking-2026-02-12`,rb=`token-efficient-tools-2026-03-28`,ib=`afk-mode-2026-01-31`,ab=process.env.USER_TYPE===`ant`?`cli-internal-2026-02-09`:``,ob=`advisor-tool-2026-03-01`,sb=new Set([Ky,qy,Zy]),cb=new Set([Gy,Ky,Jy])}));function ub(){return process.env.USER_TYPE===`ant`?kO(`tengu_ant_model_override`,null):null}function db(){return process.env.USER_TYPE===`ant`?ub()?.antModels??[]:[]}function fb(e){if(process.env.USER_TYPE!==`ant`||e===void 0)return;let t=e.toLowerCase();return db().find(n=>n.alias===e||t.includes(n.model.toLowerCase()))}var pb=t((()=>{ak()}));function mb(){return!g(process.env.CLAUDE_CODE_DISABLE_FAST_MODE)}function hb(){return mb()?_b()===null:!1}function gb(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 · /extra-usage to enable`;case`network_error`:return`Fast mode unavailable due to network connectivity issues`;case`unknown`:return`Fast mode is currently unavailable`}}function _b(){if(!mb())return`Fast mode is not available`;let e=kO(`tengu_penguins_off`,null);if(e!==null)return A(`Fast mode unavailable: ${e}`),e;if(!Ar()&&kO(`tengu_marble_sandcastle`,!1))return`Fast mode requires the native binary · Install from: https://claude.com/product/claude-code`;if(Mt()&&rn()&&!xt()&&!U(`flagSettings`)?.fastMode){let e=`Fast mode is not available in the Agent SDK`;return A(`Fast mode unavailable: ${e}`),e}if(W()!==`firstParty`){let e=`Fast mode is not available on Bedrock, Vertex, or Foundry`;return A(`Fast mode unavailable: ${e}`),e}if(q.status===`disabled`){if((q.reason===`network_error`||q.reason===`unknown`)&&g(process.env.CLAUDE_CODE_SKIP_FAST_MODE_NETWORK_ERRORS))return null;let e=Z()===null?`api-key`:`oauth`,t=gb(q.reason,e);return A(`Fast mode unavailable: ${t}`),t}return null}function vb(){return`opus`+(Wx()?`[1m]`:``)}function yb(e){if(!mb()||!hb()||!bb(e))return!1;let t=z_();return t.fastModePerSessionOptIn?!1:t.fastMode===!0}function bb(e){if(!mb())return!1;let t=Yx(e??Rx());return t.toLowerCase().includes(`opus-4-7`)||t.toLowerCase().includes(`opus-4-6`)}function xb(){return Pb.status===`cooldown`&&Date.now()>=Pb.resetAt&&(mb()&&!Fb&&(A(`Fast mode cooldown expired, re-enabling fast mode`),Fb=!0,Lb.emit()),Pb={status:`active`}),Pb}function Sb(e,t){if(!mb())return;Pb={status:`cooldown`,resetAt:e,reason:t},Fb=!1;let n=e-Date.now();A(`Fast mode cooldown triggered (${t}), duration ${Math.round(n/1e3)}s`),N(`tengu_fast_mode_fallback_triggered`,{cooldown_duration_ms:n,cooldown_reason:t}),Ib.emit(e,t)}function Cb(){Pb={status:`active`}}function wb(){q.status!==`disabled`&&(q={status:`disabled`,reason:`preference`},P_(`userSettings`,{fastMode:void 0}),V(e=>({...e,penguinModeOrgEnabled:!1})),Hb.emit(!1))}function Tb(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 · /extra-usage to enable`;default:return`Fast mode disabled · extra usage not available`}}function Eb(e){return e===`org_level_disabled_until`||e===`out_of_credits`}function Db(e){let t=Tb(e);A(`Fast mode overage rejection: ${e??`unknown`} — ${t}`),N(`tengu_fast_mode_overage_rejected`,{overage_disabled_reason:e??`unknown`}),Eb(e)||(P_(`userSettings`,{fastMode:void 0}),V(e=>({...e,penguinModeOrgEnabled:!1}))),Bb.emit(t)}function Ob(){return xb().status===`cooldown`}function kb(e,t){let n=mb()&&hb()&&!!t&&bb(e);return n&&Ob()?`cooldown`:n?`on`:`off`}async function Ab(e){let t=`${P().BASE_API_URL}/api/claude_code_penguin_mode`,n=`accessToken`in e?{Authorization:`Bearer ${e.accessToken}`,"anthropic-beta":Dr}:{"x-api-key":e.apiKey};return(await v.get(t,{headers:n})).data}function jb(){if(!mb()||q.status!==`pending`)return;let e=process.env.USER_TYPE===`ant`,t=H().penguinModeOrgEnabled===!0;q=e||t?{status:`enabled`}:{status:`disabled`,reason:`unknown`}}async function Mb(){if(Br()||!mb())return;if(Kb)return A(`Fast mode prefetch in progress, returning in-flight promise`),Kb;let e=MC();if(!(Z()?.accessToken&&bw())&&!e){let e=process.env.USER_TYPE===`ant`,t=H().penguinModeOrgEnabled===!0;q=e||t?{status:`enabled`}:{status:`disabled`,reason:`preference`};return}let t=Date.now();if(t-Gb<Wb){A(`Skipping fast mode prefetch, fetched recently`);return}Gb=t;let n=async()=>{let t=Z(),n=t?.accessToken&&bw()?{accessToken:t.accessToken}:e?{apiKey:e}:null;if(!n)throw Error(`No auth available`);return Ab(n)};async function r(){try{let e;try{e=await n()}catch(t){if(v.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=Z()?.accessToken;if(r)await hw(r),e=await n();else throw t}else throw t}let t=q.status===`pending`?H().penguinModeOrgEnabled:q.status===`enabled`;q=e.enabled?{status:`enabled`}:{status:`disabled`,reason:e.disabled_reason??`preference`},t!==e.enabled&&(e.enabled||P_(`userSettings`,{fastMode:void 0}),V(t=>({...t,penguinModeOrgEnabled:e.enabled})),Hb.emit(e.enabled)),A(`Org fast mode: ${e.enabled?`enabled`:`disabled (${e.disabled_reason??`preference`})`}`)}catch(e){let t=process.env.USER_TYPE===`ant`,n=H().penguinModeOrgEnabled===!0;q=t||n?{status:`enabled`}:{status:`disabled`,reason:`network_error`},A(`Failed to fetch org fast mode status, defaulting to ${q.status===`enabled`?`enabled (cached)`:`disabled (network_error)`}: ${e}`,{level:`error`}),N(`tengu_org_penguin_mode_fetch_failed`,{})}finally{Kb=null}}return Kb=r(),Kb}var Nb,Pb,Fb,Ib,Lb,Rb,zb,Bb,Vb,q,Hb,Ub,Wb,Gb,Kb,qb=t((()=>{Ie(),kr(),ak(),O(),hr(),Q(),jr(),rp(),M(),h(),rS(),wv(),zr(),Y_(),ft(),Nb=`Opus 4.7`,Pb={status:`active`},Fb=!1,Ib=Ot(),Lb=Ot(),Rb=Ib.subscribe,zb=Lb.subscribe,Bb=Ot(),Vb=Bb.subscribe,q={status:`pending`},Hb=Ot(),Ub=Hb.subscribe,Wb=3e4,Gb=0,Kb=null}));function Jb(e){return mb()&&e?ax:ix}function Yb(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 Xb(e,t){let n=Bx(e);return n===J(gv.firstParty)?Jb(t.speed===`fast`):lx[n]||(Zb(e,n),lx[Bx(Rx())]??cx)}function Zb(e,t){N(`tengu_unknown_model_cost`,{model:e,shortName:t}),rt()}function Qb(e,t){return Yb(Xb(e,t),t)}function $b(e,t){return Qb(e,{input_tokens:t.inputTokens,output_tokens:t.outputTokens,cache_read_input_tokens:t.cacheReadInputTokens,cache_creation_input_tokens:t.cacheCreationInputTokens})}function ex(e){return Number.isInteger(e)?`$${e}`:`$${e.toFixed(2)}`}function tx(e){return`${ex(e.inputTokens)}/${ex(e.outputTokens)} per Mtok`}var nx,rx,ix,ax,ox,sx,cx,lx,ux=t((()=>{hr(),O(),qb(),xv(),rS(),nx={inputTokens:3,outputTokens:15,promptCacheWriteTokens:3.75,promptCacheReadTokens:.3,webSearchRequests:.01},rx={inputTokens:15,outputTokens:75,promptCacheWriteTokens:18.75,promptCacheReadTokens:1.5,webSearchRequests:.01},ix={inputTokens:5,outputTokens:25,promptCacheWriteTokens:6.25,promptCacheReadTokens:.5,webSearchRequests:.01},ax={inputTokens:30,outputTokens:150,promptCacheWriteTokens:37.5,promptCacheReadTokens:3,webSearchRequests:.01},ox={inputTokens:.8,outputTokens:4,promptCacheWriteTokens:1,promptCacheReadTokens:.08,webSearchRequests:.01},sx={inputTokens:1,outputTokens:5,promptCacheWriteTokens:1.25,promptCacheReadTokens:.1,webSearchRequests:.01},cx=ix,lx={[J(lv.firstParty)]:ox,[J(uv.firstParty)]:sx,[J(cv.firstParty)]:nx,[J(sv.firstParty)]:nx,[J(dv.firstParty)]:nx,[J(fv.firstParty)]:nx,[J(vv.firstParty)]:nx,[J(pv.firstParty)]:rx,[J(mv.firstParty)]:rx,[J(hv.firstParty)]:ix,[J(gv.firstParty)]:ix}}));function dx(e){return px.includes(e)}function fx(e){return mx.includes(e)}var px,mx,hx=t((()=>{px=[`sonnet`,`opus`,`haiku`,`best`,`sonnet[1m]`,`opus[1m]`,`opusplan`],mx=[`sonnet`,`opus`,`haiku`]}));function gx(e,t){return e.includes(t)?!0:dx(e)?Yx(e).toLowerCase().includes(t):!1}function _x(e,t){return e.startsWith(t)?e.length===t.length||e[t.length]===`-`:!1}function vx(e,t){let n=dx(e)?Yx(e).toLowerCase():e;return!!(_x(n,t)||!t.startsWith(`claude-`)&&_x(n,`claude-${t}`))}function yx(e,t){for(let n of t){if(fx(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 bx(e){let{availableModels:t}=J_()||{};if(!t)return!0;if(t.length===0)return!1;let n=Ov(e).trim().toLowerCase(),r=t.map(e=>e.trim().toLowerCase());if(r.includes(n)&&(!fx(n)||!yx(n,r)))return!0;for(let e of r)if(fx(e)&&!yx(e,r)&&gx(n,e))return!0;if(dx(n)){let e=Yx(n).toLowerCase();if(r.includes(e))return!0}for(let e of r)if(!fx(e)&&dx(e)&&Yx(e).toLowerCase()===n)return!0;for(let e of r)if(!fx(e)&&!dx(e)&&vx(n,e))return!0;return!1}var xx=t((()=>{Y_(),hx(),rS(),Nv()}));function Sx(){return process.env.OPENAI_AUTH_MODE===`chatgpt`}function Cx(e){let t=e.toLowerCase().replace(/\[1m\]$/,``);return Ex.some(e=>e.value.toLowerCase()===t)}var wx,Tx,Ex,Dx=t((()=>{wx=`gpt-5.5`,Tx=`gpt-5.4-mini`,Ex=[{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 Ox(){let e=W();return e===`openai`&&Sx()?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||Ix()}function kx(e){return e===G().opus40||e===G().opus41||e===G().opus45||e===G().opus46||e===G().opus47}function Ax(){let e,t=$t();if(t!==void 0)e=t;else{let t=J_()||{};e=process.env.ANTHROPIC_MODEL||t.model||void 0}if(!(e&&!bx(e)))return e}function jx(){let e=Ax();return e==null?zx():Yx(e)}function Mx(){return Px()}function Nx(){let e=W();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 Px(){let e=W();return e===`openai`&&Sx()?wx: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:Nx()||G().opus47}function Fx(){let e=W();return e===`openai`&&Sx()?wx: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:Nx()||(e===`firstParty`?G().sonnet46:G().sonnet45)}function Ix(){let e=W();return e===`openai`&&Sx()?Tx: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:Nx()||G().haiku45}function Lx(e){let{permissionMode:t,mainLoopModel:n,exceeds200kTokens:r=!1}=e;return Ax()===`opusplan`&&t===`plan`&&!r?Px():Ax()===`haiku`&&t===`plan`?Fx():n}function Rx(){return process.env.USER_TYPE===`ant`?ub()?.defaultModel??Px()+`[1m]`:Tw()||Dw()?Px()+(Wx()?`[1m]`:``):Fx()}function zx(){return Yx(Rx())}function J(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 Bx(e){return J(Ov(e))}function Vx(e=!1){return Tw()||Dw()?Wx()?`Opus 4.7 with 1M context · Most capable for complex work${e?Ux(!0):``}`:`Opus 4.7 · Most capable for complex work${e?Ux(!0):``}`:`Sonnet 4.6 · Best for everyday tasks`}function Hx(e){return e===`opusplan`?`Opus 4.7 in plan mode, else Sonnet 4.6`:Jx(Yx(e))}function Ux(e){if(W()!==`firstParty`)return``;let t=tx(Jb(e));return` ·${e?` (↯)`:``} ${t}`}function Wx(){return!(xS()||kw()||W()!==`firstParty`||!Cv()||Y()&&X()===null)}function Gx(e){return e===`opusplan`?`Opus Plan`:dx(e)?Yh(e):Jx(e)}function Kx(e){switch(e){case G().opus47:return`Opus 4.7`;case G().opus47+`[1m]`:return`Opus 4.7 (1M context)`;case G().opus46:return`Opus 4.6`;case G().opus46+`[1m]`:return`Opus 4.6 (1M context)`;case G().opus45:return`Opus 4.5`;case G().opus41:return`Opus 4.1`;case G().opus40:return`Opus 4`;case G().sonnet46+`[1m]`:return`Sonnet 4.6 (1M context)`;case G().sonnet46:return`Sonnet 4.6`;case G().sonnet45+`[1m]`:return`Sonnet 4.5 (1M context)`;case G().sonnet45:return`Sonnet 4.5`;case G().sonnet40:return`Sonnet 4`;case G().sonnet40+`[1m]`:return`Sonnet 4 (1M context)`;case G().sonnet37:return`Sonnet 3.7`;case G().sonnet35:return`Sonnet 3.5`;case G().haiku45:return`Haiku 4.5`;case G().haiku35:return`Haiku 3.5`;default:return null}}function qx(e){let[t=``,...n]=e.split(`-`);return[t.slice(0,3)+`*`.repeat(Math.max(0,t.length-3)),...n].join(`-`)}function Jx(e){let t=Kx(e);if(t)return t;if(process.env.USER_TYPE===`ant`){let t=Yx(e),n=fb(e);return n?qx(n.model.replace(/\[1m\]$/i,``))+(SS(t)?`[1m]`:``):t===e?t:`${e} (${t})`}return e}function Yx(e){let t=e.trim(),n=t.toLowerCase(),r=SS(n),i=r?n.replace(/\[1m]$/i,``).trim():n;if(dx(i))switch(i){case`opusplan`:return Fx()+(r?`[1m]`:``);case`sonnet`:return Fx()+(r?`[1m]`:``);case`haiku`:return Ix()+(r?`[1m]`:``);case`opus`:return Px()+(r?`[1m]`:``);case`best`:return Mx();default:}if(W()===`firstParty`&&Zx(i)&&Qx())return Px()+(r?`[1m]`:``);if(process.env.USER_TYPE===`ant`){let e=SS(n),t=fb(n.replace(/\[1m]$/i,``).trim());if(t){let n=e?`[1m]`:``;return t.model+n}}return r?t.replace(/\[1m\]$/i,``).trim()+`[1m]`:t}function Xx(e,t){return SS(e)||!SS(t)?e:CS(Yx(e))?e+`[1m]`:e}function Zx(e){return nS.includes(e)}function Qx(){return!g(process.env.CLAUDE_CODE_DISABLE_LEGACY_MODEL_REMAP)}function $x(e){if(e===null)return process.env.USER_TYPE===`ant`?`Default for Ants (${Hx(Rx())})`:Y()?`Default (${Vx()})`:`Default (${zx()})`;let t=Yx(e);return e===t?t:`${e} (${t})`}function eS(e){if(W()===`foundry`)return;let t=e.toLowerCase().includes(`[1m]`),n=Bx(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 tS(e){return e.replace(/\[(1|2)m\]/gi,``)}var nS,rS=t((()=>{O(),pb(),Q(),FS(),h(),Nv(),ux(),Y_(),wv(),Up(),xx(),hx(),ag(),Dx(),nS=[`claude-opus-4-20250514`,`claude-opus-4-1-20250805`,`claude-opus-4-0`,`claude-opus-4-1`]}));function iS(){return{error:(e,...t)=>console.error(`[Anthropic SDK ERROR]`,e,...t),warn:(e,...t)=>console.error(`[Anthropic SDK WARN]`,e,...t),info:(e,...t)=>console.error(`[Anthropic SDK INFO]`,e,...t),debug:(e,...t)=>console.error(`[Anthropic SDK DEBUG]`,e,...t)}}async function aS({apiKey:e,maxRetries:t,model:r,fetchOverride:i,source:a}){let o=process.env.CLAUDE_CODE_CONTAINER_ID,s=process.env.CLAUDE_CODE_REMOTE_SESSION_ID,c=process.env.CLAUDE_AGENT_SDK_CLIENT_APP,l=sS(),u={"x-app":`cli`,"User-Agent":fT(),"X-Claude-Code-Session-Id":at(),...l,...o?{"x-claude-remote-container-id":o}:{},...s?{"x-claude-remote-session-id":s}:{},...c?{"x-client-app":c}:{},...process.env.ANTHROPIC_AUTH_NONCE?{"x-auth-nonce":process.env.ANTHROPIC_AUTH_NONCE}:{}};A(`[API:request] Creating client, ANTHROPIC_CUSTOM_HEADERS present: ${!!process.env.ANTHROPIC_CUSTOM_HEADERS}, has Authorization header: ${!!l.Authorization}`),g(process.env.CLAUDE_CODE_ADDITIONAL_PROTECTION)&&(u[`x-anthropic-additional-protection`]=`true`),A(`[API:auth] OAuth token check starting`),await vw(),A(`[API:auth] OAuth token check complete`),Y()||await oS(u,Mt());let d=cS(i,a),f={defaultHeaders:u,maxRetries:t,timeout:parseInt(process.env.API_TIMEOUT_MS||`600000`,10),dangerouslyAllowBrowser:!0,fetchOptions:Ni({forAnthropicAPI:!0}),...d&&{fetch:d}};if(g(process.env.CLAUDE_CODE_USE_BEDROCK)){let{BedrockClient:e}=await import(`./bedrockClient-qi1-JCOK.js`),t=r===Ox()&&process.env.ANTHROPIC_SMALL_FAST_MODEL_AWS_REGION?process.env.ANTHROPIC_SMALL_FAST_MODEL_AWS_REGION:oe(),n={...f,awsRegion:t,...g(process.env.CLAUDE_CODE_SKIP_BEDROCK_AUTH)&&{skipAuth:!0},...Qn()&&{logger:iS()}};if(process.env.AWS_BEARER_TOKEN_BEDROCK)n.skipAuth=!0,n.defaultHeaders={...n.defaultHeaders,Authorization:`Bearer ${process.env.AWS_BEARER_TOKEN_BEDROCK}`};else if(!g(process.env.CLAUDE_CODE_SKIP_BEDROCK_AUTH)){let e=await Kw();e&&(n.awsAccessKey=e.accessKeyId,n.awsSecretKey=e.secretAccessKey,n.awsSessionToken=e.sessionToken)}return new e(n)}if(g(process.env.CLAUDE_CODE_USE_FOUNDRY)){let{AnthropicFoundry:e}=await import(`./foundry-sdk-BFN5VDFQ.js`),t;if(!process.env.ANTHROPIC_FOUNDRY_API_KEY)if(g(process.env.CLAUDE_CODE_SKIP_FOUNDRY_AUTH))t=()=>Promise.resolve(``);else{let{DefaultAzureCredential:e,getBearerTokenProvider:n}=await import(`./esm-CsGLyWmS.js`);t=n(new e,`https://cognitiveservices.azure.com/.default`)}return new e({...f,...t&&{azureADTokenProvider:t},...Qn()&&{logger:iS()}})}if(g(process.env.CLAUDE_CODE_USE_VERTEX)){g(process.env.CLAUDE_CODE_SKIP_VERTEX_AUTH)||await Xw();let[{AnthropicVertex:e},{GoogleAuth:t}]=await Promise.all([import(`./vertex-sdk-CSGw3fvU.js`),import(`./src-hdbPEvzO.js`).then(e=>n(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,o=g(process.env.CLAUDE_CODE_SKIP_VERTEX_AUTH)?{getClient:()=>({getRequestHeaders:()=>({})})}:new t({scopes:[`https://www.googleapis.com/auth/cloud-platform`],...i||a?{}:{projectId:process.env.ANTHROPIC_VERTEX_PROJECT_ID}});return new e({...f,region:te(r),googleAuth:o,...Qn()&&{logger:iS()}})}return new se({apiKey:Y()?null:e||MC(),authToken:Y()?Z()?.accessToken:void 0,...process.env.USER_TYPE===`ant`&&g(process.env.USE_STAGING_OAUTH)?{baseURL:P().BASE_API_URL}:{},...f,...Qn()&&{logger:iS()}})}async function oS(e,t){let n=process.env.ANTHROPIC_AUTH_TOKEN||await UC(t);n&&(e.Authorization=`Bearer ${n}`)}function sS(){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 cS(e,t){let n=e??globalThis.fetch,r=W()===`firstParty`&&Cv();return(e,i)=>{let a=new Headers(i?.headers);r&&!a.has(`x-client-request-id`)&&a.set(lS,sa());try{let n=e instanceof Request?e.url:String(e),r=a.get(lS);A(`[API REQUEST] ${new URL(n).pathname}${r?` ${lS}=${r}`:``} source=${t??`unknown`}`)}catch{}return n(e,{...i,headers:a})}}var lS,uS=t((()=>{vr(),Q(),_T(),rS(),wv(),Pi(),O(),kr(),M(),h(),lS=`x-client-request-id`}));function dS(){return R(ae(),`cache`)}function fS(){return R(dS(),`model-capabilities.json`)}function pS(){return!(W()!==`firstParty`||!Cv())}function mS(e){return[...e].sort((e,t)=>t.id.length-e.id.length||e.id.localeCompare(t.id))}function hS(e){if(!pS())return;let t=yS(fS());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 gS(){if(pS()&&!Br())try{let e=await aS({maxRetries:1}),t=Y()?[Dr]:void 0,n=[];for await(let r of e.models.list({betas:t})){let e=_S().safeParse(r);e.success&&n.push(e.data)}if(n.length===0)return;let r=fS(),i=mS(n);if(ku(yS(r),i)){A(`[modelCapabilities] cache unchanged, skipping write`);return}await la(dS(),{recursive:!0}),await ha(r,k({models:i,timestamp:Date.now()}),{encoding:`utf-8`,mode:384}),yS.cache.delete(r),A(`[modelCapabilities] cached ${i.length} models`)}catch(e){A(`[modelCapabilities] fetch failed: ${e instanceof Error?e.message:`unknown`}`)}}var _S,vS,yS,bS=t((()=>{Au(),m(),Je(),kr(),uS(),Q(),M(),h(),di(),Ei(),zr(),ur(),wv(),_S=L(()=>D({id:b(),max_input_tokens:y().optional(),max_tokens:y().optional()}).strip()),vS=L(()=>D({models:S(_S()),timestamp:y()})),yS=p(e=>{try{let t=ta(e,`utf-8`),n=vS().safeParse(fi(t,!1));return n.success?n.data.models:null}catch{return null}},e=>e)}));function xS(){return g(process.env.CLAUDE_CODE_DISABLE_1M_CONTEXT)}function SS(e){return xS()?!1:/\[1m\]/i.test(e)}function CS(e){if(xS())return!1;let t=Bx(e);return t.includes(`claude-sonnet-4`)||t.includes(`opus-4-6`)||t.includes(`opus-4-7`)}function wS(e,t){if(process.env.USER_TYPE===`ant`&&process.env.CLAUDE_CODE_MAX_CONTEXT_TOKENS){let e=parseInt(process.env.CLAUDE_CODE_MAX_CONTEXT_TOKENS,10);if(!isNaN(e)&&e>0)return e}if(SS(e))return 1e6;let n=hS(e);if(n?.max_input_tokens&&n.max_input_tokens>=1e5)return n.max_input_tokens>2e5&&xS()?kS:n.max_input_tokens;if(t?.includes(`context-1m-2025-08-07`)&&CS(e)||TS(e))return 1e6;if(process.env.USER_TYPE===`ant`){let t=fb(e);if(t?.contextWindow)return t.contextWindow}return kS}function TS(e){return xS()||SS(e)||!Bx(e).includes(`sonnet-4-6`)?!1:H().clientDataCache?.coral_reef_sonnet===`true`}function ES(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 DS(e){let t,n;if(process.env.USER_TYPE===`ant`){let r=fb(e.toLowerCase());if(r)return t=r.defaultMaxTokens??jS,n=r.upperMaxTokensLimit??MS,{default:t,upperLimit:n}}let r=Bx(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=jS,n=MS);let i=hS(e);return i?.max_tokens&&i.max_tokens>=4096&&(n=i.max_tokens,t=Math.min(t,n)),{default:t,upperLimit:n}}function OS(e){return DS(e).upperLimit-1}var kS,AS,jS,MS,NS,PS,FS=t((()=>{lb(),rp(),h(),rS(),pb(),bS(),kS=2e5,AS=2e4,jS=32e3,MS=64e3,NS=8e3,PS=64e3})),IS,LS,RS,zS=t((()=>{m(),wv(),IS=[{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`}],LS=[{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`}],RS=p((e,t)=>{if(W()===`firstParty`)return;let n=e.toLowerCase(),r=W()===`openai`?LS:IS;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 BS(e){let t=[],n=[];for(let r of e)ZS.includes(r)?t.push(r):n.push(r);return{allowed:t,disallowed:n}}function VS(e){if(!e||e.length===0)return;if(Y()){console.warn(`Warning: Custom betas are only available for API key users. Ignoring provided betas.`);return}let{allowed:t,disallowed:n}=BS(e);for(let e of n)console.warn(`Warning: Beta header '${e}' is not allowed. Only the following betas are supported: ${ZS.join(`, `)}`);return t.length>0?t:void 0}function HS(e){let t=RS(e,`interleaved_thinking`);if(t!==void 0)return t;let n=Bx(e),r=W();return r===`foundry`?!0:r===`firstParty`?!n.includes(`claude-3-`):n.includes(`claude-opus-4`)||n.includes(`claude-sonnet-4`)}function US(e){let t=Bx(e);return t.includes(`claude-opus-4`)||t.includes(`claude-sonnet-4`)||t.includes(`claude-haiku-4`)}function WS(e){let t=Bx(e),n=W();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 GS(e){let t=Bx(e),n=W();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 KS(e){return!0}function qS(){return(W()===`firstParty`||W()===`foundry`)&&!g(process.env.CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS)&&Cv()}function JS(){return W()===`firstParty`&&!g(process.env.CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS)}function YS(e,t){let n=[...$S(e)];t?.isAgenticQuery&&(n.includes(`claude-code-20250219`)||n.push(Gy),process.env.USER_TYPE===`ant`&&process.env.CLAUDE_CODE_ENTRYPOINT===`cli`&&ab&&!n.includes(ab)&&n.push(ab));let r=Cn();return!r||r.length===0?n:[...n,...r.filter(e=>!n.includes(e))]}function XS(){QS.cache?.clear?.(),$S.cache?.clear?.(),eC.cache?.clear?.()}var ZS,QS,$S,eC,tC=t((()=>{m(),ak(),O(),lb(),kr(),Q(),FS(),h(),rS(),zS(),wv(),Y_(),ZS=[qy],QS=p(e=>{let t=[],n=Bx(e).includes(`haiku`),r=W(),i=qS();n||(t.push(Gy),process.env.USER_TYPE===`ant`&&process.env.CLAUDE_CODE_ENTRYPOINT===`cli`&&ab&&t.push(ab)),Y()&&t.push(Dr),SS(e)&&t.push(qy),!g(process.env.DISABLE_INTERLEAVED_THINKING)&&HS(e)&&t.push(Ky),i&&HS(e)&&!Mt()&&z_().showThinkingSummaries!==!0&&t.push(nb);let a=g(process.env.USE_API_CONTEXT_MANAGEMENT)||WS(e),o=WS(e);qS()&&(a||o)&&t.push(Jy);let s=jO(`tengu_tool_pear`),c=!s&&kO(`tengu_amber_json_tools`,!1);return i&&GS(e)&&s&&t.push(Yy),process.env.USER_TYPE===`ant`&&i&&c&&t.push(rb),r===`vertex`&&US(e)&&t.push(Xy),r===`foundry`&&t.push(Xy),i&&t.push(eb),process.env.ANTHROPIC_BETAS&&t.push(...process.env.ANTHROPIC_BETAS.split(`,`).map(e=>e.trim()).filter(Boolean)),t}),$S=p(e=>{let t=QS(e);return W()===`bedrock`?t.filter(e=>!sb.has(e)):t}),eC=p(e=>QS(e).filter(e=>sb.has(e)))}));function nC(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 rC=t((()=>{}));async function iC(){try{let e=ky(Ny),{stdout:t,code:n}=await ai(`security`,[`find-generic-password`,`-a`,Ay(),`-w`,`-s`,e],{useCwd:!1,preserveOutputOnError:!1});if(n===0&&t)return Pn(t.trim())}catch{}return null}function aC(){if(cC!==void 0)return cC;if(process.platform!==`darwin`)return cC=!1,!1;try{cC=Mr(`security`,[`show-keychain-info`],{reject:!1,stdio:[`ignore`,`pipe`,`pipe`]}).exitCode===36}catch{cC=!1}return cC}var oC,sC,cC,lC=t((()=>{Nr(),M(),ii(),ti(),ur(),Py(),oC=4032,sC={name:`keychain`,read(){let e=K.cache;if(Date.now()-e.cachedAt<3e4)return e.data;try{let e=ky(Ny),t=ni(`security find-generic-password -a "${Ay()}" -w -s "${e}"`);if(t){let e=Pn(t);return K.cache={data:e,cachedAt:Date.now()},e}}catch{}return e.data===null?(K.cache={data:null,cachedAt:Date.now()},null):(A(`[keychain] read failed; serving stale cache`,{level:`warn`}),K.cache={data:e.data,cachedAt:Date.now()},e.data)},async readAsync(){let e=K.cache;if(Date.now()-e.cachedAt<3e4)return e.data;if(K.readInFlight)return K.readInFlight;let t=K.generation,n=iC().then(n=>{if(t===K.generation){n===null&&e.data!==null&&A(`[keychain] readAsync failed; serving stale cache`,{level:`warn`});let t=n??e.data;return K.cache={data:t,cachedAt:Date.now()},K.readInFlight=null,t}return n});return K.readInFlight=n,n},update(e){jy();try{let t=ky(Ny),n=Ay(),r=k(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<=oC?o=Mr(`security`,[`-i`],{input:a,stdio:[`pipe`,`pipe`,`pipe`],reject:!1}):(A(`Keychain payload (${r.length}B JSON) exceeds security -i stdin limit; using argv`,{level:`warn`}),o=Mr(`security`,[`add-generic-password`,`-U`,`-a`,n,`-s`,t,`-X`,i],{stdio:[`ignore`,`pipe`,`pipe`],reject:!1})),o.exitCode===0?(K.cache={data:e,cachedAt:Date.now()},{success:!0}):{success:!1}}catch{return{success:!1}}},delete(){jy();try{let e=ky(Ny);return ni(`security delete-generic-password -a "${Ay()}" -s "${e}"`),!0}catch{return!1}}}}));function uC(){let e=ae();return{storageDir:e,storagePath:R(e,`.credentials.json`)}}var dC,fC=t((()=>{h(),In(),Jn(),ur(),dC={name:`plaintext`,read(){let{storagePath:e}=uC();try{return Pn(j().readFileSync(e,{encoding:`utf8`}))}catch{return null}},async readAsync(){let{storagePath:e}=uC();try{return Pn(await j().readFile(e,{encoding:`utf8`}))}catch{return null}},update(e){try{let{storageDir:t,storagePath:n}=uC();try{j().mkdirSync(t)}catch(e){if(Mn(e)!==`EEXIST`)throw e}return jn(n,k(e),{encoding:`utf8`,flush:!1}),Qi(n,384),{success:!0,warning:`Warning: Storing credentials in plaintext.`}}catch{return{success:!1}}},delete(){let{storagePath:e}=uC();try{return j().unlinkSync(e),!0}catch(e){return Mn(e)===`ENOENT`}}}}));function pC(){return process.platform===`darwin`?nC(sC,dC):dC}var mC=t((()=>{rC(),lC(),fC()}));function hC(e){return new Promise(t=>{_a(`security`,[`find-generic-password`,`-a`,Ay(),`-w`,`-s`,e],{encoding:`utf-8`,timeout:bC},(e,n)=>{t({stdout:e?null:n?.trim()||null,timedOut:!!(e&&`killed`in e&&e.killed)})})})}function gC(){if(process.platform!==`darwin`||SC||ne())return;let e=hC(ky(Ny)),t=hC(ky());SC=Promise.all([e,t]).then(([e,t])=>{e.timedOut||My(e.stdout),t.timedOut||(xC={stdout:t.stdout})})}async function _C(){SC&&await SC}function vC(){return xC}function yC(){xC=null}var bC,xC,SC,CC=t((()=>{h(),Py(),bC=1e4,xC=null,SC=null}));function wC(){return EC}function TC(){EC.clear()}var EC,DC=t((()=>{EC=new Map})),OC=r({calculateApiKeyHelperTTL:()=>VC,checkAndRefreshOAuthTokenIfNeeded:()=>vw,checkGcpCredentialsValid:()=>tw,clearApiKeyHelperCache:()=>qC,clearAwsCredentialsCache:()=>QC,clearGcpCredentialsCache:()=>iw,clearOAuthTokenCache:()=>pw,getAccountInformation:()=>Rw,getAnthropicApiKey:()=>MC,getAnthropicApiKeyWithSource:()=>PC,getApiKeyFromApiKeyHelper:()=>UC,getApiKeyFromApiKeyHelperCached:()=>KC,getApiKeyFromConfigOrMacOSKeychain:()=>Zw,getApiKeyHelperElapsedMs:()=>HC,getAuthTokenSource:()=>jC,getClaudeAIOAuthTokens:()=>Z,getClaudeAIOAuthTokensAsync:()=>_w,getConfiguredApiKeyHelper:()=>FC,getOauthAccountInfo:()=>Sw,getOtelHeadersFromHelper:()=>Fw,getRateLimitTier:()=>Aw,getSubscriptionName:()=>jw,getSubscriptionType:()=>X,handleOAuth401Error:()=>hw,hasAnthropicApiKeyAuth:()=>NC,hasOpusAccess:()=>ww,hasProfileScope:()=>bw,is1PApiCustomer:()=>xw,isAnthropicAuthEnabled:()=>AC,isAwsAuthRefreshFromProjectSettings:()=>RC,isAwsCredentialExportFromProjectSettings:()=>BC,isClaudeAISubscriber:()=>Y,isConsumerSubscriber:()=>Lw,isCustomApiKeyApproved:()=>lw,isEnterpriseSubscriber:()=>Ow,isGcpAuthRefreshFromProjectSettings:()=>ew,isMaxSubscriber:()=>Tw,isOtelHeadersHelperFromProjectOrLocalSettings:()=>Pw,isOverageProvisioningAllowed:()=>Cw,isProSubscriber:()=>kw,isTeamPremiumSubscriber:()=>Dw,isTeamSubscriber:()=>Ew,isUsing3PServices:()=>Mw,prefetchApiKeyFromApiKeyHelperIfSafe:()=>JC,prefetchAwsCredentialsAndBedRockInfoIfSafe:()=>ow,prefetchGcpCredentialsIfSafe:()=>aw,refreshAndGetAwsCredentials:()=>Kw,refreshAwsAuth:()=>XC,refreshGcpAuth:()=>rw,refreshGcpCredentialsIfNeeded:()=>Xw,removeApiKey:()=>uw,saveApiKey:()=>cw,saveOAuthTokensIfNeeded:()=>fw,validateForceLoginOrg:()=>zw});function kC(){return g(process.env.CLAUDE_CODE_REMOTE)||process.env.CLAUDE_CODE_ENTRYPOINT===`claude-desktop`}function AC(){if(ne())return!1;if(process.env.ANTHROPIC_UNIX_SOCKET)return!!process.env.CLAUDE_CODE_OAUTH_TOKEN;let e=J_()||{},t=g(process.env.CLAUDE_CODE_USE_BEDROCK)||g(process.env.CLAUDE_CODE_USE_VERTEX)||g(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}=PC({skipRetrievingKeyFromApiKeyHelper:!0}),a=i===`ANTHROPIC_API_KEY`||i===`apiKeyHelper`;return!(t||r&&!kC()||a&&!kC())}function jC(){if(ne())return FC()?{source:`apiKeyHelper`,hasToken:!0}:{source:`none`,hasToken:!1};if(process.env.ANTHROPIC_AUTH_TOKEN&&!kC())return{source:`ANTHROPIC_AUTH_TOKEN`,hasToken:!0};if(process.env.CLAUDE_CODE_OAUTH_TOKEN)return{source:`CLAUDE_CODE_OAUTH_TOKEN`,hasToken:!0};if(Sy())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(FC()&&!kC())return{source:`apiKeyHelper`,hasToken:!0};let e=Z();return oy(e?.scopes)&&e?.accessToken?{source:`claude.ai`,hasToken:!0}:{source:`none`,hasToken:!1}}function MC(){let{key:e}=PC();return e}function NC(){let{key:e,source:t}=PC({skipRetrievingKeyFromApiKeyHelper:!0});return e!==null&&t!==`none`}function PC(e={}){if(ne())return process.env.ANTHROPIC_API_KEY?{key:process.env.ANTHROPIC_API_KEY,source:`ANTHROPIC_API_KEY`}:FC()?{key:e.skipRetrievingKeyFromApiKeyHelper?null:KC(),source:`apiKeyHelper`}:{key:null,source:`none`};let t=re()?void 0:process.env.ANTHROPIC_API_KEY;if(rn()&&t)return{key:t,source:`ANTHROPIC_API_KEY`};if(g(process.env.CI)){let e=Cy();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&&H().customApiKeyResponses?.approved?.includes(Iy(t)))return{key:t,source:`ANTHROPIC_API_KEY`};let n=Cy();return n?{key:n,source:`ANTHROPIC_API_KEY`}:FC()?e.skipRetrievingKeyFromApiKeyHelper?{key:null,source:`apiKeyHelper`}:{key:KC(),source:`apiKeyHelper`}:Zw()||{key:null,source:`none`}}function FC(){return ne()?U(`flagSettings`)?.apiKeyHelper:(J_()||{}).apiKeyHelper}function IC(){let e=FC();if(!e)return!1;let t=U(`projectSettings`),n=U(`localSettings`);return t?.apiKeyHelper===e||n?.apiKeyHelper===e}function LC(){return(J_()||{}).awsAuthRefresh}function RC(){let e=LC();if(!e)return!1;let t=U(`projectSettings`),n=U(`localSettings`);return t?.awsAuthRefresh===e||n?.awsAuthRefresh===e}function zC(){return(J_()||{}).awsCredentialExport}function BC(){let e=zC();if(!e)return!1;let t=U(`projectSettings`),n=U(`localSettings`);return t?.awsCredentialExport===e||n?.awsCredentialExport===e}function VC(){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;A(`Found CLAUDE_CODE_API_KEY_HELPER_TTL_MS env var, but it was not a valid number. Got ${e}`,{level:`error`})}return Bw}function HC(){let e=Hw?.startedAt;return e?Date.now()-e:0}async function UC(e){if(!FC())return null;let t=VC();return Vw?(Date.now()-Vw.timestamp<t||Hw||(Hw={promise:WC(e,!1,Uw),startedAt:null}),Vw.value):(Hw||(Hw={promise:WC(e,!0,Uw),startedAt:Date.now()}),Hw.promise)}async function WC(e,t,n){try{let t=await GC(e);return n===Uw&&t!==null&&(Vw={value:t,timestamp:Date.now()}),t}catch(e){if(n!==Uw)return` `;let r=e instanceof Error?e.message:String(e);return console.error(Xe.red(`apiKeyHelper failed: ${r}`)),A(`Error getting API key from apiKeyHelper: ${r}`,{level:`error`}),!t&&Vw&&Vw.value!==` `?(Vw={...Vw,timestamp:Date.now()},Vw.value):(Vw={value:` `,timestamp:Date.now()},` `)}finally{n===Uw&&(Hw=null)}}async function GC(e){let t=FC();if(!t)return null;if(IC()&&!gf()&&!e)return sr(`apiKeyHelper invoked before trust check`,Error(`Security: apiKeyHelper executed before workspace trust is confirmed. If you see this message, post in .`)),N(`tengu_apiKeyHelper_missing_trust11`,{}),null;let n=await Pr(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 KC(){return Vw?.value??null}function qC(){Uw++,Vw=null,Hw=null}function JC(e){IC()&&!gf()||UC(e)}async function YC(){let e=LC();if(!e)return!1;if(RC()&&!gf()&&!Mt())return sr(`awsAuthRefresh invoked before trust check`,Error(`Security: awsAuthRefresh executed before workspace trust is confirmed. If you see this message, post in .`)),N(`tengu_awsAuthRefresh_missing_trust`,{}),!1;try{return A(`Fetching AWS caller identity for AWS auth refresh command`),await By(),A(`Fetched AWS caller identity, skipping AWS auth refresh command`),!1}catch{return XC(e)}}function XC(e){A(`Running AWS auth refresh command`);let t=Uy.getInstance();return t.startAuthentication(),new Promise(n=>{let r=ga(e,{timeout:Gw});r.stdout.on(`data`,e=>{let n=e.toString().trim();n&&(t.addOutput(n),A(n,{level:`debug`}))}),r.stderr.on(`data`,e=>{let n=e.toString().trim();n&&(t.setError(n),A(n,{level:`error`}))}),r.on(`close`,(e,r)=>{if(e===0)A(`AWS auth refresh completed successfully`),t.endAuthentication(!0),n(!0);else{let e=r===`SIGTERM`?Xe.red(`AWS auth refresh timed out after 3 minutes. Run your auth command manually in a separate terminal.`):Xe.red(`Error running awsAuthRefresh (in settings or ~/.claude.json):`);console.error(e),t.endAuthentication(!1),n(!1)}})})}async function ZC(){let e=zC();if(!e)return null;if(BC()&&!gf()&&!Mt())return sr(`awsCredentialExport invoked before trust check`,Error(`Security: awsCredentialExport executed before workspace trust is confirmed. If you see this message, post in .`)),N(`tengu_awsCredentialExport_missing_trust`,{}),null;try{return A(`Fetching AWS caller identity for credential export command`),await By(),A(`Fetched AWS caller identity, skipping AWS credential export command`),null}catch{try{A(`Running AWS credential export command`);let t=await Pr(e,{shell:!0,reject:!1});if(t.exitCode!==0||!t.stdout)throw Error(`awsCredentialExport did not return a valid value`);let n=Pn(t.stdout.trim());if(!zy(n))throw Error(`awsCredentialExport did not return valid AWS STS output structure`);return A(`AWS credentials retrieved from awsCredentialExport`),{accessKeyId:n.Credentials.AccessKeyId,secretAccessKey:n.Credentials.SecretAccessKey,sessionToken:n.Credentials.SessionToken}}catch(e){let t=Xe.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 QC(){Kw.cache.clear()}function $C(){return(J_()||{}).gcpAuthRefresh}function ew(){let e=$C();if(!e)return!1;let t=U(`projectSettings`),n=U(`localSettings`);return t?.gcpAuthRefresh===e||n?.gcpAuthRefresh===e}async function tw(){try{let{GoogleAuth:e}=await import(`./src-hdbPEvzO.js`).then(e=>n(e.default,1)),t=new e({scopes:[`https://www.googleapis.com/auth/cloud-platform`]}),r=(async()=>{await(await t.getClient()).getAccessToken()})(),i=Fi(qw).then(()=>{throw new iT(`GCP credentials check timed out`)});return await Promise.race([r,i]),!0}catch{return!1}}async function nw(){let e=$C();if(!e)return!1;if(ew()&&!gf()&&!Mt())return sr(`gcpAuthRefresh invoked before trust check`,Error(`Security: gcpAuthRefresh executed before workspace trust is confirmed. If you see this message, post in .`)),N(`tengu_gcpAuthRefresh_missing_trust`,{}),!1;try{if(A(`Checking GCP credentials validity for auth refresh`),await tw())return A(`GCP credentials are valid, skipping auth refresh command`),!1}catch{}return rw(e)}function rw(e){A(`Running GCP auth refresh command`);let t=Uy.getInstance();return t.startAuthentication(),new Promise(n=>{let r=ga(e,{timeout:Yw});r.stdout.on(`data`,e=>{let n=e.toString().trim();n&&(t.addOutput(n),A(n,{level:`debug`}))}),r.stderr.on(`data`,e=>{let n=e.toString().trim();n&&(t.setError(n),A(n,{level:`error`}))}),r.on(`close`,(e,r)=>{if(e===0)A(`GCP auth refresh completed successfully`),t.endAuthentication(!0),n(!0);else{let e=r===`SIGTERM`?Xe.red(`GCP auth refresh timed out after 3 minutes. Run your auth command manually in a separate terminal.`):Xe.red(`Error running gcpAuthRefresh (in settings or ~/.claude.json):`);console.error(e),t.endAuthentication(!1),n(!1)}})})}function iw(){Xw.cache.clear()}function aw(){$C()&&(ew()&&!gf()&&!Mt()||Xw())}function ow(){let e=LC(),t=zC();!e&&!t||(RC()||BC())&&!gf()&&!Mt()||(Kw(),G())}function sw(e){return/^[a-zA-Z0-9-_]+$/.test(e)}async function cw(e){if(!sw(e))throw Error(`Invalid API key format. API key must contain only alphanumeric characters, dashes, and underscores.`);await dw();let t=!1;if(process.platform===`darwin`)try{let n=ky();await Pr(`security`,[`-i`],{input:`add-generic-password -U -a "${Ay()}" -s "${n}" -X "${Buffer.from(e,`utf-8`).toString(`hex`)}"\n`,reject:!1}),N(`tengu_api_key_saved_to_keychain`,{}),t=!0}catch(e){I(e),N(`tengu_api_key_keychain_error`,{error:An(e)}),N(`tengu_api_key_saved_to_config`,{})}else N(`tengu_api_key_saved_to_config`,{});let n=Iy(e);V(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??[]}}}),Zw.cache.clear?.(),yC()}function lw(e){let t=H(),n=Iy(e);return t.customApiKeyResponses?.approved?.includes(n)??!1}async function uw(){await dw(),V(e=>({...e,primaryApiKey:void 0})),Zw.cache.clear?.(),yC()}async function dw(){try{await Fy()}catch(e){I(e)}}function fw(e){if(!oy(e.scopes))return N(`tengu_oauth_tokens_not_claude_ai`,{}),{success:!0};if(!e.refreshToken||!e.expiresAt)return N(`tengu_oauth_tokens_inference_only`,{}),{success:!0};let t=pC(),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?N(`tengu_oauth_tokens_saved`,{storageBackend:n}):N(`tengu_oauth_tokens_save_failed`,{storageBackend:n}),Z.cache?.clear?.(),XS(),TC(),a}catch(e){return I(e),N(`tengu_oauth_tokens_save_exception`,{storageBackend:n,error:An(e)}),{success:!1,warning:`Failed to save OAuth tokens`}}}function pw(){Z.cache?.clear?.(),jy()}async function mw(){try{let{mtimeMs:e}=await pa(R(ae(),`.credentials.json`));e!==Qw&&(Qw=e,pw())}catch{Z.cache?.clear?.()}}function hw(e){let t=$w.get(e);if(t)return t;let n=gw(e).finally(()=>{$w.delete(e)});return $w.set(e,n),n}async function gw(e){pw();let t=await _w();return t?.refreshToken?t.accessToken===e?vw(0,!0):(N(`tengu_oauth_401_recovered_from_keychain`,{}),!0):!1}async function _w(){if(ne())return null;if(process.env.CLAUDE_CODE_OAUTH_TOKEN||Sy())return Z();try{let e=(await pC().readAsync())?.claudeAiOauth;return e?.accessToken?e:null}catch(e){return I(e),null}}function vw(e=0,t=!1){return e===0&&!t?eT||(eT=yw(e,t).finally(()=>{eT=null}),eT):yw(e,t)}async function yw(e,t){await mw();let n=Z();if(!t&&(!n?.refreshToken||!py(n.expiresAt))||!n?.refreshToken||!oy(n.scopes))return!1;Z.cache?.clear?.(),jy();let r=await _w();if(!r?.refreshToken||!py(r.expiresAt))return!1;let i=ae();await la(i,{recursive:!0});let a;try{N(`tengu_oauth_token_refresh_lock_acquiring`,{}),a=await hi(i),N(`tengu_oauth_token_refresh_lock_acquired`,{})}catch(n){return n.code===`ELOCKED`?e<5?(N(`tengu_oauth_token_refresh_lock_retry`,{retryCount:e+1}),await Fi(1e3+Math.random()*1e3),yw(e+1,t)):(N(`tengu_oauth_token_refresh_lock_retry_limit_reached`,{maxRetries:5}),!1):(I(n),N(`tengu_oauth_token_refresh_lock_error`,{error:An(n)}),!1)}try{Z.cache?.clear?.(),jy();let e=await _w();return!e?.refreshToken||!py(e.expiresAt)?(N(`tengu_oauth_token_refresh_race_resolved`,{}),!1):(N(`tengu_oauth_token_refresh_starting`,{}),fw(await uy(e.refreshToken,{scopes:oy(e.scopes)?void 0:e.scopes})),Z.cache?.clear?.(),jy(),!0)}catch(e){I(e),Z.cache?.clear?.(),jy();let t=await _w();return t&&!py(t.expiresAt)?(N(`tengu_oauth_token_refresh_race_recovered`,{}),!0):!1}finally{N(`tengu_oauth_token_refresh_lock_releasing`,{}),await a(),N(`tengu_oauth_token_refresh_lock_released`,{})}}function Y(){return AC()?oy(Z()?.scopes):!1}function bw(){return Z()?.scopes?.includes(`user:profile`)??!1}function xw(){return!(g(process.env.CLAUDE_CODE_USE_BEDROCK)||g(process.env.CLAUDE_CODE_USE_VERTEX)||g(process.env.CLAUDE_CODE_USE_FOUNDRY)||Y())}function Sw(){return AC()?H().oauthAccount:void 0}function Cw(){let e=Sw()?.billingType;return!(!Y()||!e||e!==`stripe_subscription`&&e!==`stripe_subscription_contracted`&&e!==`apple_subscription`&&e!==`google_play_subscription`)}function ww(){let e=X();return e===`max`||e===`enterprise`||e===`team`||e===`pro`||e===null}function X(){if(Gv())return Wv();if(!AC())return null;let e=Z();return e?e.subscriptionType??null:null}function Tw(){return X()===`max`}function Ew(){return X()===`team`}function Dw(){return X()===`team`&&Aw()===`default_claude_max_5x`}function Ow(){return X()===`enterprise`}function kw(){return X()===`pro`}function Aw(){if(!AC())return null;let e=Z();return e?e.rateLimitTier??null:null}function jw(){switch(X()){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 Mw(){return!!(g(process.env.CLAUDE_CODE_USE_BEDROCK)||g(process.env.CLAUDE_CODE_USE_VERTEX)||g(process.env.CLAUDE_CODE_USE_FOUNDRY)||g(process.env.CLAUDE_CODE_USE_OPENAI)||g(process.env.CLAUDE_CODE_USE_GEMINI)||g(process.env.CLAUDE_CODE_USE_GROK))}function Nw(){return(J_()||{}).otelHeadersHelper}function Pw(){let e=Nw();if(!e)return!1;let t=U(`projectSettings`),n=U(`localSettings`);return t?.otelHeadersHelper===e||n?.otelHeadersHelper===e}function Fw(){let e=Nw();if(!e)return{};let t=parseInt(process.env.CLAUDE_CODE_OTEL_HEADERS_HELPER_DEBOUNCE_MS||rT.toString(),10);if(tT&&Date.now()-nT<t)return tT;if(Pw()&&!gf())return{};try{let t=ni(e,{timeout:3e4})?.toString().trim();if(!t)throw Error(`otelHeadersHelper did not return a valid value`);let n=Pn(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 tT=n,nT=Date.now(),tT}catch(e){throw I(Error(`Error getting OpenTelemetry headers from otelHeadersHelper (in settings): ${An(e)}`)),e}}function Iw(e){return e===`max`||e===`pro`}function Lw(){let e=X();return Y()&&e!==null&&Iw(e)}function Rw(){if(W()!==`firstParty`)return;let{source:e}=jC(),t={};e===`CLAUDE_CODE_OAUTH_TOKEN`||e===`CLAUDE_CODE_OAUTH_TOKEN_FILE_DESCRIPTOR`?t.tokenSource=e:Y()?t.subscription=jw():t.tokenSource=e;let{key:n,source:r}=PC();if(n&&(t.apiKeySource=r),e===`claude.ai`||r===`/login managed key`){let e=Sw()?.organizationName;e&&(t.organization=e)}let i=Sw()?.emailAddress;return(e===`claude.ai`||r===`/login managed key`)&&i&&(t.email=i),t}async function zw(){if(process.env.ANTHROPIC_UNIX_SOCKET||!AC())return{valid:!0};let e=U(`policySettings`)?.forceLoginOrgUUID;if(!e)return{valid:!0};await vw();let t=Z();if(!t)return{valid:!0};let{source:n}=jC(),r=n===`CLAUDE_CODE_OAUTH_TOKEN`||n===`CLAUDE_CODE_OAUTH_TOKEN_FILE_DESCRIPTOR`,i=await iy(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 via 'claude auth login'.`};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\nPlease log in with the correct organization: claude auth login`}}var Bw,Vw,Hw,Uw,Ww,Gw,Kw,qw,Jw,Yw,Xw,Zw,Z,Qw,$w,eT,tT,nT,rT,iT,Q=t((()=>{Ze(),Nr(),m(),kr(),hr(),Nv(),wv(),O(),ny(),vy(),ay(),Oy(),Ly(),Hy(),Wy(),tC(),rp(),M(),h(),In(),ii(),gi(),Vr(),Xr(),mC(),CC(),Py(),Y_(),Ii(),ur(),DC(),Bw=300*1e3,Vw=null,Hw=null,Uw=0,Ww=3600*1e3,Gw=180*1e3,Kw=Yr(async()=>{let e=await YC(),t=await ZC();return(e||t)&&await Vy(),t},Ww),qw=5e3,Jw=3600*1e3,Yw=180*1e3,Xw=Yr(async()=>await nw(),Jw),Zw=p(()=>{if(ne())return null;if(process.platform===`darwin`){let e=vC();if(e){if(e.stdout)return{key:e.stdout,source:`/login managed key`}}else{let e=ky();try{let t=ni(`security find-generic-password -a $USER -w -s "${e}"`);if(t)return{key:t,source:`/login managed key`}}catch(e){I(e)}}}let e=H();return e.primaryApiKey?{key:e.primaryApiKey,source:`/login managed key`}:null}),Z=p(()=>{if(ne())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=Sy();if(e)return{accessToken:e,refreshToken:null,expiresAt:null,scopes:[`user:inference`],subscriptionType:null,rateLimitTier:null};try{let e=pC().read()?.claudeAiOauth;return e?.accessToken?e:null}catch(e){return I(e),null}}),Qw=0,$w=new Map,eT=null,tT=null,nT=0,rT=1740*1e3,iT=class extends Error{}}));function aT(){return`claude-code/2.6.11`}var oT=t((()=>{}));function sT(){return uT.getStore()?.workload}function cT(e,t){return uT.run({workload:e},t)}var lT,uT,dT=t((()=>{lT=`cron`,uT=new va}));function fT(){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=sT(),r=n?`, workload/${n}`:``;return`claude-cli/2.6.11 (${process.env.USER_TYPE}, ${process.env.CLAUDE_CODE_ENTRYPOINT??`cli`}${e}${t}${r})`}function pT(){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/2.6.11${e.length>0?` (${e.join(`, `)})`:``}`}function mT(){return`Claude-User (${aT()}; +https://support.anthropic.com/)`}function hT(){if(Y()){let e=Z();return e?.accessToken?{headers:{Authorization:`Bearer ${e.accessToken}`,"anthropic-beta":Dr}}:{headers:{},error:`No OAuth token available`}}let e=MC();return e?{headers:{"x-api-key":e}}:{headers:{},error:`No API key available`}}async function gT(e,t){try{return await e()}catch(n){if(!v.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=Z()?.accessToken;if(!i)throw n;return await hw(i),await e()}}var _T=t((()=>{Ie(),kr(),Q(),oT(),dT()}));async function vT(){CT===null&&!wT&&(wT=ST(),CT=await wT,wT=null,TT.cache.clear?.())}function yT(){CT=null,wT=null,TT.cache.clear?.(),ET.cache.clear?.()}function bT(){return TT(!0)}function xT(){if(CT!==null)return CT;let e=Sw();if(e?.emailAddress)return e.emailAddress;if(process.env.USER_TYPE===`ant`&&process.env.COO_CREATOR)return`${process.env.COO_CREATOR}@anthropic.com`}async function ST(){let e=Sw();if(e?.emailAddress)return e.emailAddress;if(process.env.USER_TYPE===`ant`)return process.env.COO_CREATOR?`${process.env.COO_CREATOR}@anthropic.com`:ET()}var CT,wT,TT,ET,DT=t((()=>{Nr(),m(),O(),Q(),rp(),gr(),Fr(),h(),CT=null,wT=null,TT=p(e=>{let t=zf(),n=H(),r,i,a;if(e&&(r=X()??void 0,i=Aw()??void 0,r&&n.claudeCodeFirstTokenDate)){let e=new Date(n.claudeCodeFirstTokenDate).getTime();isNaN(e)||(a=e)}let o=Sw(),s=o?.organizationUuid,c=o?.accountUuid;return{deviceId:t,sessionId:at(),email:xT(),appVersion:`2.6.11`,platform:Ir(),organizationUuid:s,accountUuid:c,userType:process.env.USER_TYPE,subscriptionType:r,rateLimitTier:i,firstTokenTime:a,...g(process.env.GITHUB_ACTIONS)&&{githubActionsMetadata:{actor:process.env.GITHUB_ACTOR,actorId:process.env.GITHUB_ACTOR_ID,repository:process.env.GITHUB_REPOSITORY,repositoryId:process.env.GITHUB_REPOSITORY_ID,repositoryOwner:process.env.GITHUB_REPOSITORY_OWNER,repositoryOwnerId:process.env.GITHUB_REPOSITORY_OWNER_ID}}}}),ET=p(async()=>{let e=await Pr(`git config --get user.email`,{shell:!0,reject:!1,cwd:_r()});return e.exitCode===0&&e.stdout?e.stdout.trim():void 0})}));function OT(e){return kT(e,new WeakSet)}function kT(e,t){if(e==null||typeof e==`string`||typeof e==`number`||typeof e==`boolean`||e instanceof Uint8Array)return!0;if(typeof e==`object`){if(t.has(e))return!1;if(t.add(e),Array.isArray(e))return e.every(e=>kT(e,t));let n=e;return n.constructor!==Object&&n.constructor!==void 0?!1:Object.values(n).every(e=>kT(e,t))}return!1}var AT=t((()=>{})),jT,MT=t((()=>{fe(),we(),Ee(),AT(),ce(),jT=class{set severityText(e){this._isLogRecordReadonly()||(this._severityText=e)}get severityText(){return this._severityText}set severityNumber(e){this._isLogRecordReadonly()||(this._severityNumber=e)}get severityNumber(){return this._severityNumber}set body(e){this._isLogRecordReadonly()||(this._body=e)}get body(){return this._body}get eventName(){return this._eventName}set eventName(e){this._isLogRecordReadonly()||(this._eventName=e)}get droppedAttributesCount(){return this._droppedAttributesCount}constructor(e,t,n){_(this,`hrTime`,void 0),_(this,`hrTimeObserved`,void 0),_(this,`spanContext`,void 0),_(this,`resource`,void 0),_(this,`instrumentationScope`,void 0),_(this,`attributes`,{}),_(this,`_severityText`,void 0),_(this,`_severityNumber`,void 0),_(this,`_body`,void 0),_(this,`_eventName`,void 0),_(this,`_attributesCount`,0),_(this,`_droppedAttributesCount`,0),_(this,`_isReadonly`,!1),_(this,`_logRecordLimits`,void 0);let{timestamp:r,observedTimestamp:i,eventName:a,severityNumber:o,severityText:s,body:c,attributes:l={},exception:u,context:d}=n,f=Date.now();if(this.hrTime=_e(r??f),this.hrTimeObserved=_e(i??f),d){let e=me.getSpanContext(d);e&&ue(e)&&(this.spanContext=e)}this.severityNumber=o,this.severityText=s,this.body=c,this.resource=e.resource,this.instrumentationScope=t,this._logRecordLimits=e.logRecordLimits,this._eventName=a,this.setAttributes(l),u!=null&&this._setException(u)}setAttribute(e,t){if(this._isLogRecordReadonly())return this;if(e.length===0)return pe.warn(`Invalid attribute key: ${e}`),this;if(!OT(t))return pe.warn(`Invalid attribute value set for key: ${e}`),this;let n=!Object.prototype.hasOwnProperty.call(this.attributes,e);return n&&this._attributesCount>=this._logRecordLimits.attributeCountLimit?(this._droppedAttributesCount++,this._droppedAttributesCount===1&&pe.warn(`Dropping extra attributes.`),this):(this.attributes[e]=this._truncateToSize(t),n&&this._attributesCount++,this)}setAttributes(e){for(let[t,n]of Object.entries(e))this.setAttribute(t,n);return this}setBody(e){return this.body=e,this}setEventName(e){return this.eventName=e,this}setSeverityNumber(e){return this.severityNumber=e,this}setSeverityText(e){return this.severityText=e,this}_makeReadonly(){this._isReadonly=!0}_truncateToSize(e){let t=this._logRecordLimits.attributeValueLengthLimit;if(t<=0)return pe.warn(`Attribute value limit must be positive, got ${t}`),e;if(e==null)return e;if(typeof e==`string`)return this._truncateToLimitUtil(e,t);if(e instanceof Uint8Array)return e;if(Array.isArray(e))return e.map(e=>this._truncateToSize(e));if(typeof e==`object`){let t={};for(let[n,r]of Object.entries(e))t[n]=this._truncateToSize(r);return t}return e}_setException(e){let t=!1;if(typeof e==`string`||typeof e==`number`)Object.hasOwn(this.attributes,`exception.message`)||this.setAttribute(Me,String(e)),t=!0;else if(e&&typeof e==`object`){let n=e;n.code?(Object.hasOwn(this.attributes,`exception.type`)||this.setAttribute(be,n.code.toString()),t=!0):n.name&&(Object.hasOwn(this.attributes,`exception.type`)||this.setAttribute(be,n.name),t=!0),n.message&&(Object.hasOwn(this.attributes,`exception.message`)||this.setAttribute(Me,n.message),t=!0),n.stack&&(Object.hasOwn(this.attributes,`exception.stacktrace`)||this.setAttribute(ge,n.stack),t=!0)}t||pe.warn(`Failed to record an exception ${e}`)}_truncateToLimitUtil(e,t){return e.length<=t?e:e.substring(0,t)}_isLogRecordReadonly(){return this._isReadonly&&pe.warn(`Can not execute the operation on emitted log record`),this._isReadonly}}})),NT,PT=t((()=>{Fe(),fe(),MT(),ce(),NT=class{constructor(e,t){_(this,`instrumentationScope`,void 0),_(this,`_sharedState`,void 0),_(this,`_loggerConfig`,void 0),this.instrumentationScope=e,this._sharedState=t,this._loggerConfig=this._sharedState.getLoggerConfig(this.instrumentationScope)}emit(e){let t=this._loggerConfig,n=e.context||he.active(),r=e.severityNumber??Ne.UNSPECIFIED;if(r!==Ne.UNSPECIFIED&&r<t.minimumSeverity)return;if(t.traceBased){let e=me.getSpanContext(n);if(e&&ue(e)&&(e.traceFlags&de.SAMPLED)!==de.SAMPLED)return}let i=new jT(this._sharedState,this.instrumentationScope,{context:n,...e});this._sharedState.loggerMetrics.emitLog(),this._sharedState.activeProcessor.onEmit(i,n),i._makeReadonly()}enabled(e){let t=this._loggerConfig;if(t.disabled)return!1;let n=e?.severityNumber;if(typeof n==`number`&&n!==Ne.UNSPECIFIED&&n<t.minimumSeverity)return!1;let r=e?.context||he.active();if(t.traceBased){let e=me.getSpanContext(r);if(e&&ue(e)&&(e.traceFlags&de.SAMPLED)!==de.SAMPLED)return!1}let i={context:r,instrumentationScope:this.instrumentationScope,severityNumber:e?.severityNumber,eventName:e?.eventName};for(let e of this._sharedState.processors)if(!e.enabled||e.enabled(i))return!0;return!1}}})),FT,IT=t((()=>{FT=class{forceFlush(){return Promise.resolve()}onEmit(e,t){}shutdown(){return Promise.resolve()}enabled(e){return!1}}})),LT,RT=t((()=>{we(),ce(),LT=class{constructor(e,t){_(this,`processors`,void 0),_(this,`forceFlushTimeoutMillis`,void 0),this.processors=e,this.forceFlushTimeoutMillis=t}async forceFlush(){let e=this.forceFlushTimeoutMillis;await Promise.all(this.processors.map(t=>Te(t.forceFlush(),e)))}onEmit(e,t){this.processors.forEach(n=>n.onEmit(e,t))}async shutdown(){await Promise.all(this.processors.map(e=>e.shutdown()))}enabled(e){for(let t of this.processors)if(!t.enabled||t.enabled(e))return!0;return!1}}}));function zT(e){return`${e.name}@${e.version||``}:${e.schemaUrl||``}`}var BT=t((()=>{})),VT,HT=t((()=>{VT=`otel.sdk.log.created`})),UT,WT=t((()=>{HT(),ce(),UT=class{constructor(e){_(this,`createdLogs`,void 0),this.createdLogs=e.createCounter(VT,{unit:`{log_record}`,description:`The number of logs submitted to enabled SDK Loggers.`})}emitLog(){this.createdLogs.add(1)}}})),GT,KT=t((()=>{GT=`0.215.0`})),qT,JT,YT,XT=t((()=>{fe(),Fe(),IT(),RT(),BT(),WT(),KT(),ce(),qT={disabled:!1,minimumSeverity:Ne.UNSPECIFIED,traceBased:!1},JT=()=>({...qT}),YT=class{constructor(e,t,n,r,i,a){_(this,`loggers`,new Map),_(this,`activeProcessor`,void 0),_(this,`registeredLogRecordProcessors`,[]),_(this,`resource`,void 0),_(this,`forceFlushTimeoutMillis`,void 0),_(this,`logRecordLimits`,void 0),_(this,`processors`,void 0),_(this,`loggerMetrics`,void 0),_(this,`_loggerConfigurator`,void 0),_(this,`_loggerConfigs`,new Map),this.resource=e,this.forceFlushTimeoutMillis=t,this.logRecordLimits=n,this.processors=r,r.length>0?(this.registeredLogRecordProcessors=r,this.activeProcessor=new LT(this.registeredLogRecordProcessors,this.forceFlushTimeoutMillis)):this.activeProcessor=new FT,this._loggerConfigurator=i??JT,this.loggerMetrics=new UT(a?a.getMeter(`@opentelemetry/sdk-logs`,GT):le())}getLoggerConfig(e){let t=zT(e),n=this._loggerConfigs.get(t);return n||(n=this._loggerConfigurator(e),this._loggerConfigs.set(t,n),n)}}})),ZT,QT=t((()=>{fe(),Fe(),ke(),we(),PT(),XT(),ce(),ZT=class{constructor(e={}){_(this,`_shutdownOnce`,void 0),_(this,`_sharedState`,void 0);let t={resource:e.resource??Ce(),forceFlushTimeoutMillis:e.forceFlushTimeoutMillis??3e4,logRecordLimits:{attributeCountLimit:e.logRecordLimits?.attributeCountLimit??128,attributeValueLengthLimit:e.logRecordLimits?.attributeValueLengthLimit??1/0},loggerConfigurator:e.loggerConfigurator??JT,processors:e.processors??[],meterProvider:e.meterProvider};this._sharedState=new YT(t.resource,t.forceFlushTimeoutMillis,t.logRecordLimits,t.processors,t.loggerConfigurator,t.meterProvider),this._shutdownOnce=new Ae(this._shutdown,this)}getLogger(e,t,n){if(this._shutdownOnce.isCalled)return pe.warn(`A shutdown LoggerProvider cannot provide a Logger`),Pe;e||pe.warn(`Logger requested without instrumentation scope name.`);let r=e||`unknown`,i=`${r}@${t||``}:${n?.schemaUrl||``}`;return this._sharedState.loggers.has(i)||this._sharedState.loggers.set(i,new NT({name:r,version:t,schemaUrl:n?.schemaUrl},this._sharedState)),this._sharedState.loggers.get(i)}forceFlush(){return this._shutdownOnce.isCalled?(pe.warn(`invalid attempt to force flush after LoggerProvider shutdown`),this._shutdownOnce.promise):this._sharedState.activeProcessor.forceFlush()}shutdown(){return this._shutdownOnce.isCalled?(pe.warn(`shutdown may only be called once per LoggerProvider`),this._shutdownOnce.promise):this._shutdownOnce.call()}_shutdown(){return this._sharedState.activeProcessor.shutdown()}}})),$T,eE=t((()=>{we(),$T=class{export(e,t){this._sendLogRecords(e,t)}async forceFlush(){}async shutdown(){}_exportInfo(e){return{resource:{attributes:e.resource.attributes},instrumentationScope:e.instrumentationScope,timestamp:je(e.hrTime),traceId:e.spanContext?.traceId,spanId:e.spanContext?.spanId,traceFlags:e.spanContext?.traceFlags,severityText:e.severityText,severityNumber:e.severityNumber,eventName:e.eventName,body:e.body,attributes:e.attributes}}_sendLogRecords(e,t){for(let t of e)console.dir(this._exportInfo(t),{depth:3});t?.({code:Se.SUCCESS})}}}));async function tE(e){let t=[];for(let n=0,r=e.length;n<r;n++){let r=e[n];r.resource.asyncAttributesPending&&r.resource.waitForAsyncAttributes&&t.push(r.resource.waitForAsyncAttributes())}t!=null&&t.length>0&&await Promise.all(t)}var nE,rE,iE=t((()=>{fe(),we(),ce(),nE=class{constructor(e,t,n){_(this,`_exportCompleted`,void 0),_(this,`_exportScheduledPromise`,void 0),_(this,`_exportScheduledResolve`,void 0),this._exportScheduledPromise=new Promise(e=>{this._exportScheduledResolve=e}),this._exportCompleted=this._executeExport(e,t,n)}get exportCompleted(){return this._exportCompleted}get exportScheduled(){return this._exportScheduledPromise}async _executeExport(e,t,n){try{await tE(t),await he.with(De(he.active()),async()=>this._exportWithTimeout(e,t,n))}catch(e){ye(e),this._exportScheduledResolve()}}async _exportWithTimeout(e,t,n){return new Promise((r,i)=>{let a=setTimeout(()=>{i(Error(`Timeout`))},n);e.export(t,e=>{clearTimeout(a),e.code===Se.SUCCESS?r():i(e.error??Error(`BatchLogRecordProcessor: log record export failed`))}),this._exportScheduledResolve()})}},rE=class{constructor(e,t){_(this,`_maxExportBatchSize`,void 0),_(this,`_maxQueueSize`,void 0),_(this,`_scheduledDelayMillis`,void 0),_(this,`_exportTimeoutMillis`,void 0),_(this,`_exporter`,void 0),_(this,`_currentExport`,null),_(this,`_finishedLogRecords`,[]),_(this,`_timer`,void 0),_(this,`_shutdownOnce`,void 0),_(this,`_flushing`,!1),this._exporter=e,this._maxExportBatchSize=t?.maxExportBatchSize??512,this._maxQueueSize=t?.maxQueueSize??2048,this._scheduledDelayMillis=t?.scheduledDelayMillis??5e3,this._exportTimeoutMillis=t?.exportTimeoutMillis??3e4,this._shutdownOnce=new Ae(this._shutdown,this),this._maxExportBatchSize>this._maxQueueSize&&(pe.warn(`BatchLogRecordProcessor: maxExportBatchSize must be smaller or equal to maxQueueSize, setting maxExportBatchSize to match maxQueueSize`),this._maxExportBatchSize=this._maxQueueSize)}onEmit(e){this._shutdownOnce.isCalled||this._addToBuffer(e)}forceFlush(){return this._shutdownOnce.isCalled?this._shutdownOnce.promise:this._flushAll()}_addToBuffer(e){this._finishedLogRecords.length>=this._maxQueueSize||(this._finishedLogRecords.push(e),this._maybeStartTimer())}shutdown(){return this._shutdownOnce.call()}async _shutdown(){this.onShutdown(),await this._flushAll(),await this._exporter.shutdown()}async _flushAll(){if(this._flushing)return;this._flushing=!0;let e=this._finishedLogRecords;for(this._finishedLogRecords=[],this._clearTimer(),this._currentExport!==null&&(await this._exporter.forceFlush(),await this._currentExport.exportCompleted,this._currentExport=null);e.length>0;){let t;e.length<=this._maxExportBatchSize?(t=e,e=[]):t=e.splice(0,this._maxExportBatchSize);let n=new nE(this._exporter,t,this._exportTimeoutMillis);this._currentExport=n;try{await n.exportScheduled,await this._exporter.forceFlush(),await n.exportCompleted}catch(e){ye(e)}finally{this._currentExport=null}}this._flushing=!1,this._maybeStartTimer()}_extractBatch(){if(this._finishedLogRecords.length===0)return null;if(this._finishedLogRecords.length<=this._maxExportBatchSize){let e=this._finishedLogRecords;return this._finishedLogRecords=[],e}else return this._finishedLogRecords.splice(0,this._maxExportBatchSize)}_exportOneBatch(){this._clearTimer();let e=this._extractBatch();if(e===null)return;let t=new nE(this._exporter,e,this._exportTimeoutMillis);this._currentExport=t,t.exportCompleted.then(()=>{this._currentExport=null,this._maybeStartTimer()}).catch(e=>{this._currentExport=null,ye(e),this._maybeStartTimer()})}_maybeStartTimer(){if(!this._shutdownOnce.isCalled&&!this._flushing&&this._finishedLogRecords.length!==0&&this._currentExport===null){if(this._finishedLogRecords.length>=this._maxExportBatchSize){this._exportOneBatch();return}this._timer===void 0&&(this._timer=setTimeout(()=>{this._timer=void 0,this._exportOneBatch()},this._scheduledDelayMillis),typeof this._timer!=`number`&&this._timer.unref())}}_clearTimer(){this._timer!==void 0&&(clearTimeout(this._timer),this._timer=void 0)}}})),aE,oE=t((()=>{iE(),aE=class extends rE{onShutdown(){}}})),sE=t((()=>{oE()})),cE=t((()=>{sE()})),lE=t((()=>{QT(),eE(),cE()}));function uE(){return g(process.env.CLAUDE_CODE_USE_BEDROCK)||g(process.env.CLAUDE_CODE_USE_VERTEX)||g(process.env.CLAUDE_CODE_USE_FOUNDRY)||Hr()}function dE(){return Hr()}var fE=t((()=>{h(),zr()}));function pE(){return{seconds:0,nanos:0}}function mE(e){return e!=null}var hE,gE=t((()=>{hE={fromJSON(e){return{seconds:mE(e.seconds)?globalThis.Number(e.seconds):0,nanos:mE(e.nanos)?globalThis.Number(e.nanos):0}},toJSON(e){let t={};return e.seconds!==void 0&&(t.seconds=Math.round(e.seconds)),e.nanos!==void 0&&(t.nanos=Math.round(e.nanos)),t},create(e){return hE.fromPartial(e??{})},fromPartial(e){let t=pE();return t.seconds=e.seconds??0,t.nanos=e.nanos??0,t}}}));function _E(){return{account_id:0,organization_uuid:``,account_uuid:``}}function vE(e){return e!=null}var yE,bE=t((()=>{yE={fromJSON(e){return{account_id:vE(e.account_id)?globalThis.Number(e.account_id):0,organization_uuid:vE(e.organization_uuid)?globalThis.String(e.organization_uuid):``,account_uuid:vE(e.account_uuid)?globalThis.String(e.account_uuid):``}},toJSON(e){let t={};return e.account_id!==void 0&&(t.account_id=Math.round(e.account_id)),e.organization_uuid!==void 0&&(t.organization_uuid=e.organization_uuid),e.account_uuid!==void 0&&(t.account_uuid=e.account_uuid),t},create(e){return yE.fromPartial(e??{})},fromPartial(e){let t=_E();return t.account_id=e.account_id??0,t.organization_uuid=e.organization_uuid??``,t.account_uuid=e.account_uuid??``,t}}}));function xE(){return{actor_id:``,repository_id:``,repository_owner_id:``}}function SE(){return{platform:``,node_version:``,terminal:``,package_managers:``,runtimes:``,is_running_with_bun:!1,is_ci:!1,is_claubbit:!1,is_github_action:!1,is_claude_code_action:!1,is_claude_ai_auth:!1,version:``,github_event_name:``,github_actions_runner_environment:``,github_actions_runner_os:``,github_action_ref:``,wsl_version:``,github_actions_metadata:void 0,arch:``,is_claude_code_remote:!1,remote_environment_type:``,claude_code_container_id:``,claude_code_remote_session_id:``,tags:[],deployment_environment:``,is_conductor:!1,version_base:``,coworker_type:``,build_time:``,is_local_agent_mode:!1,linux_distro_id:``,linux_distro_version:``,linux_kernel:``,vcs:``,platform_raw:``}}function CE(){return{slack_team_id:``,is_enterprise_install:!1,trigger:``,creation_method:``}}function wE(){return{event_name:``,client_timestamp:void 0,model:``,session_id:``,user_type:``,betas:``,env:void 0,entrypoint:``,agent_sdk_version:``,is_interactive:!1,client_type:``,process:``,additional_metadata:``,auth:void 0,server_timestamp:void 0,event_id:``,device_id:``,swe_bench_run_id:``,swe_bench_instance_id:``,swe_bench_task_id:``,email:``,agent_id:``,parent_session_id:``,agent_type:``,slack:void 0,team_name:``,skill_name:``,plugin_name:``,marketplace_name:``}}function TE(e){let t=(e.seconds||0)*1e3;return t+=(e.nanos||0)/1e6,new globalThis.Date(t)}function EE(e){return e instanceof globalThis.Date?e:typeof e==`string`?new globalThis.Date(e):TE(hE.fromJSON(e))}function $(e){return e!=null}var DE,OE,kE,AE,jE=t((()=>{gE(),bE(),DE={fromJSON(e){return{actor_id:$(e.actor_id)?globalThis.String(e.actor_id):``,repository_id:$(e.repository_id)?globalThis.String(e.repository_id):``,repository_owner_id:$(e.repository_owner_id)?globalThis.String(e.repository_owner_id):``}},toJSON(e){let t={};return e.actor_id!==void 0&&(t.actor_id=e.actor_id),e.repository_id!==void 0&&(t.repository_id=e.repository_id),e.repository_owner_id!==void 0&&(t.repository_owner_id=e.repository_owner_id),t},create(e){return DE.fromPartial(e??{})},fromPartial(e){let t=xE();return t.actor_id=e.actor_id??``,t.repository_id=e.repository_id??``,t.repository_owner_id=e.repository_owner_id??``,t}},OE={fromJSON(e){return{platform:$(e.platform)?globalThis.String(e.platform):``,node_version:$(e.node_version)?globalThis.String(e.node_version):``,terminal:$(e.terminal)?globalThis.String(e.terminal):``,package_managers:$(e.package_managers)?globalThis.String(e.package_managers):``,runtimes:$(e.runtimes)?globalThis.String(e.runtimes):``,is_running_with_bun:$(e.is_running_with_bun)?globalThis.Boolean(e.is_running_with_bun):!1,is_ci:$(e.is_ci)?globalThis.Boolean(e.is_ci):!1,is_claubbit:$(e.is_claubbit)?globalThis.Boolean(e.is_claubbit):!1,is_github_action:$(e.is_github_action)?globalThis.Boolean(e.is_github_action):!1,is_claude_code_action:$(e.is_claude_code_action)?globalThis.Boolean(e.is_claude_code_action):!1,is_claude_ai_auth:$(e.is_claude_ai_auth)?globalThis.Boolean(e.is_claude_ai_auth):!1,version:$(e.version)?globalThis.String(e.version):``,github_event_name:$(e.github_event_name)?globalThis.String(e.github_event_name):``,github_actions_runner_environment:$(e.github_actions_runner_environment)?globalThis.String(e.github_actions_runner_environment):``,github_actions_runner_os:$(e.github_actions_runner_os)?globalThis.String(e.github_actions_runner_os):``,github_action_ref:$(e.github_action_ref)?globalThis.String(e.github_action_ref):``,wsl_version:$(e.wsl_version)?globalThis.String(e.wsl_version):``,github_actions_metadata:$(e.github_actions_metadata)?DE.fromJSON(e.github_actions_metadata):void 0,arch:$(e.arch)?globalThis.String(e.arch):``,is_claude_code_remote:$(e.is_claude_code_remote)?globalThis.Boolean(e.is_claude_code_remote):!1,remote_environment_type:$(e.remote_environment_type)?globalThis.String(e.remote_environment_type):``,claude_code_container_id:$(e.claude_code_container_id)?globalThis.String(e.claude_code_container_id):``,claude_code_remote_session_id:$(e.claude_code_remote_session_id)?globalThis.String(e.claude_code_remote_session_id):``,tags:globalThis.Array.isArray(e?.tags)?e.tags.map(e=>globalThis.String(e)):[],deployment_environment:$(e.deployment_environment)?globalThis.String(e.deployment_environment):``,is_conductor:$(e.is_conductor)?globalThis.Boolean(e.is_conductor):!1,version_base:$(e.version_base)?globalThis.String(e.version_base):``,coworker_type:$(e.coworker_type)?globalThis.String(e.coworker_type):``,build_time:$(e.build_time)?globalThis.String(e.build_time):``,is_local_agent_mode:$(e.is_local_agent_mode)?globalThis.Boolean(e.is_local_agent_mode):!1,linux_distro_id:$(e.linux_distro_id)?globalThis.String(e.linux_distro_id):``,linux_distro_version:$(e.linux_distro_version)?globalThis.String(e.linux_distro_version):``,linux_kernel:$(e.linux_kernel)?globalThis.String(e.linux_kernel):``,vcs:$(e.vcs)?globalThis.String(e.vcs):``,platform_raw:$(e.platform_raw)?globalThis.String(e.platform_raw):``}},toJSON(e){let t={};return e.platform!==void 0&&(t.platform=e.platform),e.node_version!==void 0&&(t.node_version=e.node_version),e.terminal!==void 0&&(t.terminal=e.terminal),e.package_managers!==void 0&&(t.package_managers=e.package_managers),e.runtimes!==void 0&&(t.runtimes=e.runtimes),e.is_running_with_bun!==void 0&&(t.is_running_with_bun=e.is_running_with_bun),e.is_ci!==void 0&&(t.is_ci=e.is_ci),e.is_claubbit!==void 0&&(t.is_claubbit=e.is_claubbit),e.is_github_action!==void 0&&(t.is_github_action=e.is_github_action),e.is_claude_code_action!==void 0&&(t.is_claude_code_action=e.is_claude_code_action),e.is_claude_ai_auth!==void 0&&(t.is_claude_ai_auth=e.is_claude_ai_auth),e.version!==void 0&&(t.version=e.version),e.github_event_name!==void 0&&(t.github_event_name=e.github_event_name),e.github_actions_runner_environment!==void 0&&(t.github_actions_runner_environment=e.github_actions_runner_environment),e.github_actions_runner_os!==void 0&&(t.github_actions_runner_os=e.github_actions_runner_os),e.github_action_ref!==void 0&&(t.github_action_ref=e.github_action_ref),e.wsl_version!==void 0&&(t.wsl_version=e.wsl_version),e.github_actions_metadata!==void 0&&(t.github_actions_metadata=DE.toJSON(e.github_actions_metadata)),e.arch!==void 0&&(t.arch=e.arch),e.is_claude_code_remote!==void 0&&(t.is_claude_code_remote=e.is_claude_code_remote),e.remote_environment_type!==void 0&&(t.remote_environment_type=e.remote_environment_type),e.claude_code_container_id!==void 0&&(t.claude_code_container_id=e.claude_code_container_id),e.claude_code_remote_session_id!==void 0&&(t.claude_code_remote_session_id=e.claude_code_remote_session_id),e.tags?.length&&(t.tags=e.tags),e.deployment_environment!==void 0&&(t.deployment_environment=e.deployment_environment),e.is_conductor!==void 0&&(t.is_conductor=e.is_conductor),e.version_base!==void 0&&(t.version_base=e.version_base),e.coworker_type!==void 0&&(t.coworker_type=e.coworker_type),e.build_time!==void 0&&(t.build_time=e.build_time),e.is_local_agent_mode!==void 0&&(t.is_local_agent_mode=e.is_local_agent_mode),e.linux_distro_id!==void 0&&(t.linux_distro_id=e.linux_distro_id),e.linux_distro_version!==void 0&&(t.linux_distro_version=e.linux_distro_version),e.linux_kernel!==void 0&&(t.linux_kernel=e.linux_kernel),e.vcs!==void 0&&(t.vcs=e.vcs),e.platform_raw!==void 0&&(t.platform_raw=e.platform_raw),t},create(e){return OE.fromPartial(e??{})},fromPartial(e){let t=SE();return t.platform=e.platform??``,t.node_version=e.node_version??``,t.terminal=e.terminal??``,t.package_managers=e.package_managers??``,t.runtimes=e.runtimes??``,t.is_running_with_bun=e.is_running_with_bun??!1,t.is_ci=e.is_ci??!1,t.is_claubbit=e.is_claubbit??!1,t.is_github_action=e.is_github_action??!1,t.is_claude_code_action=e.is_claude_code_action??!1,t.is_claude_ai_auth=e.is_claude_ai_auth??!1,t.version=e.version??``,t.github_event_name=e.github_event_name??``,t.github_actions_runner_environment=e.github_actions_runner_environment??``,t.github_actions_runner_os=e.github_actions_runner_os??``,t.github_action_ref=e.github_action_ref??``,t.wsl_version=e.wsl_version??``,t.github_actions_metadata=e.github_actions_metadata!==void 0&&e.github_actions_metadata!==null?DE.fromPartial(e.github_actions_metadata):void 0,t.arch=e.arch??``,t.is_claude_code_remote=e.is_claude_code_remote??!1,t.remote_environment_type=e.remote_environment_type??``,t.claude_code_container_id=e.claude_code_container_id??``,t.claude_code_remote_session_id=e.claude_code_remote_session_id??``,t.tags=e.tags?.map(e=>e)||[],t.deployment_environment=e.deployment_environment??``,t.is_conductor=e.is_conductor??!1,t.version_base=e.version_base??``,t.coworker_type=e.coworker_type??``,t.build_time=e.build_time??``,t.is_local_agent_mode=e.is_local_agent_mode??!1,t.linux_distro_id=e.linux_distro_id??``,t.linux_distro_version=e.linux_distro_version??``,t.linux_kernel=e.linux_kernel??``,t.vcs=e.vcs??``,t.platform_raw=e.platform_raw??``,t}},kE={fromJSON(e){return{slack_team_id:$(e.slack_team_id)?globalThis.String(e.slack_team_id):``,is_enterprise_install:$(e.is_enterprise_install)?globalThis.Boolean(e.is_enterprise_install):!1,trigger:$(e.trigger)?globalThis.String(e.trigger):``,creation_method:$(e.creation_method)?globalThis.String(e.creation_method):``}},toJSON(e){let t={};return e.slack_team_id!==void 0&&(t.slack_team_id=e.slack_team_id),e.is_enterprise_install!==void 0&&(t.is_enterprise_install=e.is_enterprise_install),e.trigger!==void 0&&(t.trigger=e.trigger),e.creation_method!==void 0&&(t.creation_method=e.creation_method),t},create(e){return kE.fromPartial(e??{})},fromPartial(e){let t=CE();return t.slack_team_id=e.slack_team_id??``,t.is_enterprise_install=e.is_enterprise_install??!1,t.trigger=e.trigger??``,t.creation_method=e.creation_method??``,t}},AE={fromJSON(e){return{event_name:$(e.event_name)?globalThis.String(e.event_name):``,client_timestamp:$(e.client_timestamp)?EE(e.client_timestamp):void 0,model:$(e.model)?globalThis.String(e.model):``,session_id:$(e.session_id)?globalThis.String(e.session_id):``,user_type:$(e.user_type)?globalThis.String(e.user_type):``,betas:$(e.betas)?globalThis.String(e.betas):``,env:$(e.env)?OE.fromJSON(e.env):void 0,entrypoint:$(e.entrypoint)?globalThis.String(e.entrypoint):``,agent_sdk_version:$(e.agent_sdk_version)?globalThis.String(e.agent_sdk_version):``,is_interactive:$(e.is_interactive)?globalThis.Boolean(e.is_interactive):!1,client_type:$(e.client_type)?globalThis.String(e.client_type):``,process:$(e.process)?globalThis.String(e.process):``,additional_metadata:$(e.additional_metadata)?globalThis.String(e.additional_metadata):``,auth:$(e.auth)?yE.fromJSON(e.auth):void 0,server_timestamp:$(e.server_timestamp)?EE(e.server_timestamp):void 0,event_id:$(e.event_id)?globalThis.String(e.event_id):``,device_id:$(e.device_id)?globalThis.String(e.device_id):``,swe_bench_run_id:$(e.swe_bench_run_id)?globalThis.String(e.swe_bench_run_id):``,swe_bench_instance_id:$(e.swe_bench_instance_id)?globalThis.String(e.swe_bench_instance_id):``,swe_bench_task_id:$(e.swe_bench_task_id)?globalThis.String(e.swe_bench_task_id):``,email:$(e.email)?globalThis.String(e.email):``,agent_id:$(e.agent_id)?globalThis.String(e.agent_id):``,parent_session_id:$(e.parent_session_id)?globalThis.String(e.parent_session_id):``,agent_type:$(e.agent_type)?globalThis.String(e.agent_type):``,slack:$(e.slack)?kE.fromJSON(e.slack):void 0,team_name:$(e.team_name)?globalThis.String(e.team_name):``,skill_name:$(e.skill_name)?globalThis.String(e.skill_name):``,plugin_name:$(e.plugin_name)?globalThis.String(e.plugin_name):``,marketplace_name:$(e.marketplace_name)?globalThis.String(e.marketplace_name):``}},toJSON(e){let t={};return e.event_name!==void 0&&(t.event_name=e.event_name),e.client_timestamp!==void 0&&(t.client_timestamp=e.client_timestamp.toISOString()),e.model!==void 0&&(t.model=e.model),e.session_id!==void 0&&(t.session_id=e.session_id),e.user_type!==void 0&&(t.user_type=e.user_type),e.betas!==void 0&&(t.betas=e.betas),e.env!==void 0&&(t.env=OE.toJSON(e.env)),e.entrypoint!==void 0&&(t.entrypoint=e.entrypoint),e.agent_sdk_version!==void 0&&(t.agent_sdk_version=e.agent_sdk_version),e.is_interactive!==void 0&&(t.is_interactive=e.is_interactive),e.client_type!==void 0&&(t.client_type=e.client_type),e.process!==void 0&&(t.process=e.process),e.additional_metadata!==void 0&&(t.additional_metadata=e.additional_metadata),e.auth!==void 0&&(t.auth=yE.toJSON(e.auth)),e.server_timestamp!==void 0&&(t.server_timestamp=e.server_timestamp.toISOString()),e.event_id!==void 0&&(t.event_id=e.event_id),e.device_id!==void 0&&(t.device_id=e.device_id),e.swe_bench_run_id!==void 0&&(t.swe_bench_run_id=e.swe_bench_run_id),e.swe_bench_instance_id!==void 0&&(t.swe_bench_instance_id=e.swe_bench_instance_id),e.swe_bench_task_id!==void 0&&(t.swe_bench_task_id=e.swe_bench_task_id),e.email!==void 0&&(t.email=e.email),e.agent_id!==void 0&&(t.agent_id=e.agent_id),e.parent_session_id!==void 0&&(t.parent_session_id=e.parent_session_id),e.agent_type!==void 0&&(t.agent_type=e.agent_type),e.slack!==void 0&&(t.slack=kE.toJSON(e.slack)),e.team_name!==void 0&&(t.team_name=e.team_name),e.skill_name!==void 0&&(t.skill_name=e.skill_name),e.plugin_name!==void 0&&(t.plugin_name=e.plugin_name),e.marketplace_name!==void 0&&(t.marketplace_name=e.marketplace_name),t},create(e){return AE.fromPartial(e??{})},fromPartial(e){let t=wE();return t.event_name=e.event_name??``,t.client_timestamp=e.client_timestamp??void 0,t.model=e.model??``,t.session_id=e.session_id??``,t.user_type=e.user_type??``,t.betas=e.betas??``,t.env=e.env!==void 0&&e.env!==null?OE.fromPartial(e.env):void 0,t.entrypoint=e.entrypoint??``,t.agent_sdk_version=e.agent_sdk_version??``,t.is_interactive=e.is_interactive??!1,t.client_type=e.client_type??``,t.process=e.process??``,t.additional_metadata=e.additional_metadata??``,t.auth=e.auth!==void 0&&e.auth!==null?yE.fromPartial(e.auth):void 0,t.server_timestamp=e.server_timestamp??void 0,t.event_id=e.event_id??``,t.device_id=e.device_id??``,t.swe_bench_run_id=e.swe_bench_run_id??``,t.swe_bench_instance_id=e.swe_bench_instance_id??``,t.swe_bench_task_id=e.swe_bench_task_id??``,t.email=e.email??``,t.agent_id=e.agent_id??``,t.parent_session_id=e.parent_session_id??``,t.agent_type=e.agent_type??``,t.slack=e.slack!==void 0&&e.slack!==null?kE.fromPartial(e.slack):void 0,t.team_name=e.team_name??``,t.skill_name=e.skill_name??``,t.plugin_name=e.plugin_name??``,t.marketplace_name=e.marketplace_name??``,t}}}));function ME(){return{event_id:``,timestamp:void 0,experiment_id:``,variation_id:0,environment:``,user_attributes:``,experiment_metadata:``,device_id:``,auth:void 0,session_id:``,anonymous_id:``,event_metadata_vars:``}}function NE(e){let t=(e.seconds||0)*1e3;return t+=(e.nanos||0)/1e6,new globalThis.Date(t)}function PE(e){return e instanceof globalThis.Date?e:typeof e==`string`?new globalThis.Date(e):NE(hE.fromJSON(e))}function FE(e){return e!=null}var IE,LE=t((()=>{gE(),bE(),IE={fromJSON(e){return{event_id:FE(e.event_id)?globalThis.String(e.event_id):``,timestamp:FE(e.timestamp)?PE(e.timestamp):void 0,experiment_id:FE(e.experiment_id)?globalThis.String(e.experiment_id):``,variation_id:FE(e.variation_id)?globalThis.Number(e.variation_id):0,environment:FE(e.environment)?globalThis.String(e.environment):``,user_attributes:FE(e.user_attributes)?globalThis.String(e.user_attributes):``,experiment_metadata:FE(e.experiment_metadata)?globalThis.String(e.experiment_metadata):``,device_id:FE(e.device_id)?globalThis.String(e.device_id):``,auth:FE(e.auth)?yE.fromJSON(e.auth):void 0,session_id:FE(e.session_id)?globalThis.String(e.session_id):``,anonymous_id:FE(e.anonymous_id)?globalThis.String(e.anonymous_id):``,event_metadata_vars:FE(e.event_metadata_vars)?globalThis.String(e.event_metadata_vars):``}},toJSON(e){let t={};return e.event_id!==void 0&&(t.event_id=e.event_id),e.timestamp!==void 0&&(t.timestamp=e.timestamp.toISOString()),e.experiment_id!==void 0&&(t.experiment_id=e.experiment_id),e.variation_id!==void 0&&(t.variation_id=Math.round(e.variation_id)),e.environment!==void 0&&(t.environment=e.environment),e.user_attributes!==void 0&&(t.user_attributes=e.user_attributes),e.experiment_metadata!==void 0&&(t.experiment_metadata=e.experiment_metadata),e.device_id!==void 0&&(t.device_id=e.device_id),e.auth!==void 0&&(t.auth=yE.toJSON(e.auth)),e.session_id!==void 0&&(t.session_id=e.session_id),e.anonymous_id!==void 0&&(t.anonymous_id=e.anonymous_id),e.event_metadata_vars!==void 0&&(t.event_metadata_vars=e.event_metadata_vars),t},create(e){return IE.fromPartial(e??{})},fromPartial(e){let t=ME();return t.event_id=e.event_id??``,t.timestamp=e.timestamp??void 0,t.experiment_id=e.experiment_id??``,t.variation_id=e.variation_id??0,t.environment=e.environment??``,t.user_attributes=e.user_attributes??``,t.experiment_metadata=e.experiment_metadata??``,t.device_id=e.device_id??``,t.auth=e.auth!==void 0&&e.auth!==null?yE.fromPartial(e.auth):void 0,t.session_id=e.session_id??``,t.anonymous_id=e.anonymous_id??``,t.event_metadata_vars=e.event_metadata_vars??``,t}}}));function RE(){return process.platform===`linux`&&g(process.env.CLAUDE_CODE_BUBBLEWRAP)}function zE(){return process.platform===`linux`?GE??!1:!1}async function BE(){if(KE!==void 0)return KE;if(process.platform===`darwin`)return KE=null,null;try{let e=await Ri(process.pid,10);for(let t of e){let e=t.toLowerCase();for(let t of Rr)if(e.includes(t))return KE=t,t}}catch{}return KE=null,null}async function VE(){return process.env.TERMINAL_EMULATOR===`JetBrains-JediTerm`&&Lr.platform!==`darwin`?await BE()||`pycharm`:Lr.terminal}function HE(){return process.env.TERMINAL_EMULATOR===`JetBrains-JediTerm`&&Lr.platform!==`darwin`?KE===void 0?`pycharm`:KE||`pycharm`:Lr.terminal}async function UE(){process.env.TERMINAL_EMULATOR===`JetBrains-JediTerm`&&await BE()}var WE,GE,KE,qE,JE=t((()=>{m(),Fr(),h(),ii(),Li(),WE=p(async()=>{if(process.platform!==`linux`)return!1;let{code:e}=await ai(`test`,[`-f`,`/.dockerenv`]);return e===0}),GE=null,process.platform===`linux`&&pa(`/lib/libc.musl-${process.arch===`x64`?`x86_64`:`aarch64`}.so.1`).then(()=>{GE=!0},()=>{GE=!1}),qE={...Lr,terminal:HE(),getIsDocker:WE,getIsBubblewrapSandbox:RE,isMuslEnvironment:zE,getTerminalWithJetBrainsDetectionAsync:VE,initJetBrainsDetection:UE}}));function YE(e){return XE?.has(e)??!1}var XE,ZE=t((()=>{M(),In()}));function QE(){return!g(process.env.CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS_DISABLED)}var $E=t((()=>{h()}));function eD(){return aD.getStore()}function tD(e,t){return aD.run(e,t)}function nD(e){return e?.agentType===`subagent`}function rD(){let e=eD();if(!(!nD(e)||!e.subagentName))return e.isBuiltIn?e.subagentName:`user-defined`}function iD(){let e=eD();if(!(!e?.invokingRequestId||e.invocationEmitted))return e.invocationEmitted=!0,{invokingRequestId:e.invokingRequestId,invocationKind:e.invocationKind}}var aD,oD=t((()=>{$E(),aD=new va}));function sD(e){return e.startsWith(`mcp__`)?`mcp_tool`:e}function cD(){return g(process.env.OTEL_LOG_TOOL_DETAILS)}function lD(e,t){return!!(process.env.CLAUDE_CODE_ENTRYPOINT===`local-agent`||e===`claudeai-proxy`||t&&YE(t))}function uD(e,t,n){let r=dD(e);return!r||!xD.has(r.serverName)&&!lD(t,n)?{}:{mcpServerName:r.serverName,mcpToolName:r.mcpToolName}}function dD(e){if(!e.startsWith(`mcp__`))return;let t=e.split(`__`);if(t.length<3)return;let n=t[1],r=t.slice(2).join(`__`);if(!(!n||!r))return{serverName:n,mcpToolName:r}}function fD(e,t){if(e===`Skill`&&typeof t==`object`&&t&&`skill`in t&&typeof t.skill==`string`)return t.skill}function pD(e,t=0){if(typeof e==`string`)return e.length>SD?`${e.slice(0,CD)}…[${e.length} chars]`:e;if(typeof e==`number`||typeof e==`boolean`||e==null)return e;if(t>=ED)return`<nested>`;if(Array.isArray(e)){let n=e.slice(0,TD).map(e=>pD(e,t+1));return e.length>TD&&n.push(`…[${e.length} items]`),n}if(typeof e==`object`){let n=Object.entries(e).filter(([e])=>!e.startsWith(`_`)),r=n.slice(0,TD).map(([e,n])=>[e,pD(n,t+1)]);return n.length>TD&&r.push([`…`,`${n.length} keys`]),Object.fromEntries(r)}return String(e)}function mD(e){if(!cD())return;let t=k(pD(e));return t.length>wD&&(t=t.slice(0,wD)+`…[truncated]`),t}function hD(e){let t=Ki(e).toLowerCase();if(!t||t===`.`)return;let n=t.slice(1);return n.length>DD?`other`:n}function gD(e,t){if(!e.includes(`.`)&&!t)return;let n,r=new Set;if(t){let e=hD(t);e&&(r.add(e),n=e)}for(let t of e.split(kD)){if(!t)continue;let e=t.split(AD);if(e.length<2)continue;let i=e[0],a=i.lastIndexOf(`/`),o=a>=0?i.slice(a+1):i;if(OD.has(o))for(let t=1;t<e.length;t++){let i=e[t];if(i.charCodeAt(0)===45)continue;let a=hD(i);a&&!r.has(a)&&(r.add(a),n=n?n+`,`+a:a)}}if(n)return n}function _D(){let e=eD();if(e){let t={agentId:e.agentId,parentSessionId:e.parentSessionId,agentType:e.agentType};return e.agentType===`teammate`&&(t.teamName=e.teamName),t}let t=Si(),n=bi(),r=_i(),i=yi()?`teammate`:t?`standalone`:void 0;if(t||i||n||r)return{...t?{agentId:t}:{},...i?{agentType:i}:{},...n?{parentSessionId:n}:{},...r?{teamName:r}:{}};let a=vn();return a?{parentSessionId:a}:{}}function vD(){try{let e=process.memoryUsage(),t=process.cpuUsage(),n=Date.now(),r;if(ND&&PD){let e=n-PD;e>0&&(r=(t.user-ND.user+(t.system-ND.system))/(e*1e3)*100)}return ND=t,PD=n,{uptime:process.uptime(),rss:e.rss,heapTotal:e.heapTotal,heapUsed:e.heapUsed,external:e.external,arrayBuffers:e.arrayBuffers,constrainedMemory:process.constrainedMemory(),cpuUsage:t,cpuPercent:r}}catch{return}}async function yD(e={}){let t=e.model?String(e.model):jx(),n=typeof e.betas==`string`?e.betas:$S(t).join(`,`),[r,i]=await Promise.all([MD(),xr()]),a=vD();return{model:t,sessionId:at(),userType:process.env.USER_TYPE||``,...n.length>0?{betas:n}:{},envContext:r,...process.env.CLAUDE_CODE_ENTRYPOINT&&{entrypoint:process.env.CLAUDE_CODE_ENTRYPOINT},...process.env.CLAUDE_AGENT_SDK_VERSION&&{agentSdkVersion:process.env.CLAUDE_AGENT_SDK_VERSION},isInteractive:String(mt()),clientType:st(),...a&&{processMetrics:a},sweBenchRunId:process.env.SWE_BENCH_RUN_ID||``,sweBenchInstanceId:process.env.SWE_BENCH_INSTANCE_ID||``,sweBenchTaskId:process.env.SWE_BENCH_TASK_ID||``,..._D(),...X()&&{subscriptionType:X()},...xt()?{kairosActive:!0}:{},...i&&{rh:i}}}function bD(e,t,n={}){let{envContext:r,processMetrics:i,rh:a,kairosActive:o,skillMode:s,observerMode:c,...l}=e,u={platform:r.platform,platform_raw:r.platformRaw,arch:r.arch,node_version:r.nodeVersion,terminal:r.terminal||`unknown`,package_managers:r.packageManagers,runtimes:r.runtimes,is_running_with_bun:r.isRunningWithBun,is_ci:r.isCi,is_claubbit:r.isClaubbit,is_claude_code_remote:r.isClaudeCodeRemote,is_local_agent_mode:r.isLocalAgentMode,is_conductor:r.isConductor,is_github_action:r.isGithubAction,is_claude_code_action:r.isClaudeCodeAction,is_claude_ai_auth:r.isClaudeAiAuth,version:r.version,build_time:r.buildTime,deployment_environment:r.deploymentEnvironment};r.remoteEnvironmentType&&(u.remote_environment_type=r.remoteEnvironmentType),r.claudeCodeContainerId&&(u.claude_code_container_id=r.claudeCodeContainerId),r.claudeCodeRemoteSessionId&&(u.claude_code_remote_session_id=r.claudeCodeRemoteSessionId),r.tags&&(u.tags=r.tags.split(`,`).map(e=>e.trim()).filter(Boolean)),r.githubEventName&&(u.github_event_name=r.githubEventName),r.githubActionsRunnerEnvironment&&(u.github_actions_runner_environment=r.githubActionsRunnerEnvironment),r.githubActionsRunnerOs&&(u.github_actions_runner_os=r.githubActionsRunnerOs),r.githubActionRef&&(u.github_action_ref=r.githubActionRef),r.wslVersion&&(u.wsl_version=r.wslVersion),r.linuxDistroId&&(u.linux_distro_id=r.linuxDistroId),r.linuxDistroVersion&&(u.linux_distro_version=r.linuxDistroVersion),r.linuxKernel&&(u.linux_kernel=r.linuxKernel),r.vcs&&(u.vcs=r.vcs),r.versionBase&&(u.version_base=r.versionBase);let d={session_id:l.sessionId,model:l.model,user_type:l.userType,is_interactive:l.isInteractive===`true`,client_type:l.clientType};if(l.betas&&(d.betas=l.betas),l.entrypoint&&(d.entrypoint=l.entrypoint),l.agentSdkVersion&&(d.agent_sdk_version=l.agentSdkVersion),l.sweBenchRunId&&(d.swe_bench_run_id=l.sweBenchRunId),l.sweBenchInstanceId&&(d.swe_bench_instance_id=l.sweBenchInstanceId),l.sweBenchTaskId&&(d.swe_bench_task_id=l.sweBenchTaskId),l.agentId&&(d.agent_id=l.agentId),l.parentSessionId&&(d.parent_session_id=l.parentSessionId),l.agentType&&(d.agent_type=l.agentType),l.teamName&&(d.team_name=l.teamName),t.githubActionsMetadata){let e=t.githubActionsMetadata;u.github_actions_metadata={actor_id:e.actorId,repository_id:e.repositoryId,repository_owner_id:e.repositoryOwnerId}}let f;return(t.accountUuid||t.organizationUuid)&&(f={account_uuid:t.accountUuid,organization_uuid:t.organizationUuid}),{env:u,...i&&{process:Buffer.from(k(i)).toString(`base64`)},...f&&{auth:f},core:d,additional:{...a&&{rh:a},...o&&{is_assistant_mode:!0},...s&&{skill_mode:s},...c&&{observer_mode:c},...n}}}var xD,SD,CD,wD,TD,ED,DD,OD,kD,AD,jD,MD,ND,PD,FD=t((()=>{m(),Fr(),JE(),tC(),rS(),O(),h(),ZE(),Q(),wr(),qr(),oD(),ur(),xi(),xD=new Set([(Bi(),e(zi)).COMPUTER_USE_MCP_SERVER_NAME]),SD=512,CD=128,wD=4*1024,TD=20,ED=2,DD=10,OD=new Set([`rm`,`mv`,`cp`,`touch`,`mkdir`,`chmod`,`chown`,`cat`,`head`,`tail`,`sort`,`stat`,`diff`,`wc`,`grep`,`rg`,`sed`]),kD=/\s*(?:&&|\|\||[;|])\s*/,AD=/\s+/,jD=p(()=>{let e=`2.6.11`.match(/^\d+\.\d+\.\d+(?:-[a-z]+)?/);return e?e[0]:void 0}),MD=p(async()=>{let[e,t,n,r]=await Promise.all([Lr.getPackageManagers(),Lr.getRuntimes(),Jr(),Kr()]);return{platform:Ir(),platformRaw:process.env.CLAUDE_CODE_HOST_PLATFORM||process.platform,arch:Lr.arch,nodeVersion:Lr.nodeVersion,terminal:qE.terminal,packageManagers:e.join(`,`),runtimes:t.join(`,`),isRunningWithBun:Lr.isRunningWithBun(),isCi:g(process.env.CI),isClaubbit:g(process.env.CLAUBBIT),isClaudeCodeRemote:g(process.env.CLAUDE_CODE_REMOTE),isLocalAgentMode:process.env.CLAUDE_CODE_ENTRYPOINT===`local-agent`,isConductor:Lr.isConductor(),...process.env.CLAUDE_CODE_REMOTE_ENVIRONMENT_TYPE&&{remoteEnvironmentType:process.env.CLAUDE_CODE_REMOTE_ENVIRONMENT_TYPE},...process.env.CLAUDE_CODE_CONTAINER_ID&&{claudeCodeContainerId:process.env.CLAUDE_CODE_CONTAINER_ID},...process.env.CLAUDE_CODE_REMOTE_SESSION_ID&&{claudeCodeRemoteSessionId:process.env.CLAUDE_CODE_REMOTE_SESSION_ID},...process.env.CLAUDE_CODE_TAGS&&{tags:process.env.CLAUDE_CODE_TAGS},isGithubAction:g(process.env.GITHUB_ACTIONS),isClaudeCodeAction:g(process.env.CLAUDE_CODE_ACTION),isClaudeAiAuth:Y(),version:`2.6.11`,versionBase:jD(),buildTime:`2026-06-05T02:52:17.586Z`,deploymentEnvironment:Lr.detectDeploymentEnvironment(),...g(process.env.GITHUB_ACTIONS)&&{githubEventName:process.env.GITHUB_EVENT_NAME,githubActionsRunnerEnvironment:process.env.RUNNER_ENVIRONMENT,githubActionsRunnerOs:process.env.RUNNER_OS,githubActionRef:process.env.GITHUB_ACTION_PATH?.includes(`claude-code-action/`)?process.env.GITHUB_ACTION_PATH.split(`claude-code-action/`)[1]:void 0},...Wr()&&{wslVersion:Wr()},...n??{},...r.length>0?{vcs:r.join(`,`)}:{}}}),ND=null,PD=null}));function ID(){return Ui.join(ae(),`telemetry`)}function LD(e){if(!v.isAxiosError(e))return An(e);let t=[],n=e.response?.headers?.[`request-id`];return n&&t.push(`request-id=${n}`),e.response?.status&&t.push(`status=${e.response.status}`),e.code&&t.push(`code=${e.code}`),e.message&&t.push(e.message),t.join(`, `)}var RD,zD,BD,VD=t((()=>{we(),Ie(),O(),jE(),LE(),Q(),rp(),M(),h(),In(),_T(),di(),Vr(),Ii(),ur(),oT(),vy(),hr(),FD(),ce(),RD=sa(),zD=`1p_failed_events.`,BD=class{constructor(e={}){_(this,`endpoint`,void 0),_(this,`timeout`,void 0),_(this,`maxBatchSize`,void 0),_(this,`skipAuth`,void 0),_(this,`batchDelayMs`,void 0),_(this,`baseBackoffDelayMs`,void 0),_(this,`maxBackoffDelayMs`,void 0),_(this,`maxAttempts`,void 0),_(this,`isKilled`,void 0),_(this,`pendingExports`,[]),_(this,`isShutdown`,!1),_(this,`schedule`,void 0),_(this,`cancelBackoff`,null),_(this,`attempts`,0),_(this,`isRetrying`,!1),_(this,`lastExportErrorContext`,void 0),this.endpoint=`${e.baseUrl||(process.env.ANTHROPIC_BASE_URL===`https://api-staging.anthropic.com`?`https://api-staging.anthropic.com`:`https://api.anthropic.com`)}${e.path||`/api/event_logging/batch`}`,this.timeout=e.timeout||1e4,this.maxBatchSize=e.maxBatchSize||200,this.skipAuth=e.skipAuth??!1,this.batchDelayMs=e.batchDelayMs||100,this.baseBackoffDelayMs=e.baseBackoffDelayMs||500,this.maxBackoffDelayMs=e.maxBackoffDelayMs||3e4,this.maxAttempts=e.maxAttempts??8,this.isKilled=e.isKilled??(()=>!1),this.schedule=e.schedule??((e,t)=>{let n=setTimeout(e,t);return()=>clearTimeout(n)}),this.retryPreviousBatches()}async getQueuedEventCount(){return(await this.loadEventsFromCurrentBatch()).length}getCurrentBatchFilePath(){return Ui.join(ID(),`${zD}${at()}.${RD}.json`)}async loadEventsFromFile(e){try{return await ci(e)}catch{return[]}}async loadEventsFromCurrentBatch(){return this.loadEventsFromFile(this.getCurrentBatchFilePath())}async saveEventsToFile(e,t){try{if(t.length===0)try{await ma(e)}catch{}else await la(ID(),{recursive:!0}),await ha(e,t.map(e=>k(e)).join(`
|
|
36
36
|
`)+`
|
|
37
37
|
`,`utf8`)}catch(e){I(e)}}async appendEventsToFile(e,t){if(t.length!==0)try{await la(ID(),{recursive:!0}),await ca(e,t.map(e=>k(e)).join(`
|
|
38
38
|
`)+`
|
|
39
|
-
`,`utf8`)}catch(e){I(e)}}async deleteFile(e){try{await ma(e)}catch{}}async retryPreviousBatches(){try{let e=`${zD}${at()}.`,t;try{t=(await da(ID())).filter(t=>t.startsWith(e)&&t.endsWith(`.json`)).filter(e=>!e.includes(RD))}catch(e){if(Ln(e))return;throw e}for(let e of t){let t=Ui.join(ID(),e);this.retryFileInBackground(t)}}catch(e){I(e)}}async retryFileInBackground(e){if(this.attempts>=this.maxAttempts){await this.deleteFile(e);return}let t=await this.loadEventsFromFile(e);if(t.length===0){await this.deleteFile(e);return}process.env.USER_TYPE===`ant`&&A(`1P event logging: retrying ${t.length} events from previous batch`);let n=await this.sendEventsInBatches(t);n.length===0?(await this.deleteFile(e),process.env.USER_TYPE===`ant`&&A(`1P event logging: previous batch retry succeeded`)):(await this.saveEventsToFile(e,n),process.env.USER_TYPE===`ant`&&A(`1P event logging: previous batch retry failed, ${n.length} events remain`))}async export(e,t){if(this.isShutdown){process.env.USER_TYPE===`ant`&&A(`1P event logging export failed: Exporter has been shutdown`),t({code:Se.FAILED,error:Error(`Exporter has been shutdown`)});return}let n=this.doExport(e,t);this.pendingExports.push(n),n.finally(()=>{let e=this.pendingExports.indexOf(n);e>-1&&this.pendingExports.splice(e,1)})}async doExport(e,t){try{let n=e.filter(e=>e.instrumentationScope?.name===`com.anthropic.claude_code.events`);if(n.length===0){t({code:Se.SUCCESS});return}let r=this.transformLogsToEvents(n).events;if(r.length===0){t({code:Se.SUCCESS});return}if(this.attempts>=this.maxAttempts){t({code:Se.FAILED,error:Error(`Dropped ${r.length} events: max attempts (${this.maxAttempts}) reached`)});return}let i=await this.sendEventsInBatches(r);if(this.attempts++,i.length>0){await this.queueFailedEvents(i),this.scheduleBackoffRetry();let e=this.lastExportErrorContext?` (${this.lastExportErrorContext})`:``;t({code:Se.FAILED,error:Error(`Failed to export ${i.length} events${e}`)});return}this.resetBackoff(),await this.getQueuedEventCount()>0&&!this.isRetrying&&this.retryFailedEvents(),t({code:Se.SUCCESS})}catch(e){process.env.USER_TYPE===`ant`&&A(`1P event logging export failed: ${An(e)}`),I(e),t({code:Se.FAILED,error:kn(e)})}}async sendEventsInBatches(e){let t=[];for(let n=0;n<e.length;n+=this.maxBatchSize)t.push(e.slice(n,n+this.maxBatchSize));process.env.USER_TYPE===`ant`&&A(`1P event logging: exporting ${e.length} events in ${t.length} batch(es)`);let n=[],r;for(let e=0;e<t.length;e++){let i=t[e];try{await this.sendBatchWithRetry({events:i})}catch(i){r=LD(i);for(let r=e;r<t.length;r++)n.push(...t[r]);if(process.env.USER_TYPE===`ant`){let n=t.length-1-e;A(`1P event logging: batch ${e+1}/${t.length} failed (${r}); short-circuiting ${n} remaining batch(es)`)}break}e<t.length-1&&this.batchDelayMs>0&&await Fi(this.batchDelayMs)}return n.length>0&&r&&(this.lastExportErrorContext=r),n}async queueFailedEvents(e){let t=this.getCurrentBatchFilePath();await this.appendEventsToFile(t,e);let n=this.lastExportErrorContext?` (${this.lastExportErrorContext})`:``,r=`1P event logging: ${e.length} events failed to export${n}`;I(Error(r))}scheduleBackoffRetry(){if(this.cancelBackoff||this.isRetrying||this.isShutdown)return;let e=Math.min(this.baseBackoffDelayMs*this.attempts*this.attempts,this.maxBackoffDelayMs);process.env.USER_TYPE===`ant`&&A(`1P event logging: scheduling backoff retry in ${e}ms (attempt ${this.attempts})`),this.cancelBackoff=this.schedule(async()=>{this.cancelBackoff=null,await this.retryFailedEvents()},e)}async retryFailedEvents(){let e=this.getCurrentBatchFilePath();for(;!this.isShutdown;){let t=await this.loadEventsFromFile(e);if(t.length===0)break;if(this.attempts>=this.maxAttempts){process.env.USER_TYPE===`ant`&&A(`1P event logging: max attempts (${this.maxAttempts}) reached, dropping ${t.length} events`),await this.deleteFile(e),this.resetBackoff();return}this.isRetrying=!0,await this.deleteFile(e),process.env.USER_TYPE===`ant`&&A(`1P event logging: retrying ${t.length} failed events (attempt ${this.attempts+1})`);let n=await this.sendEventsInBatches(t);if(this.attempts++,this.isRetrying=!1,n.length>0){await this.saveEventsToFile(e,n),this.scheduleBackoffRetry();return}this.resetBackoff(),process.env.USER_TYPE===`ant`&&A(`1P event logging: backoff retry succeeded`)}}resetBackoff(){this.attempts=0,this.cancelBackoff&&(this.cancelBackoff(),this.cancelBackoff=null)}async sendBatchWithRetry(e){if(this.isKilled())throw Error(`firstParty sink killswitch active`);let t={"Content-Type":`application/json`,"User-Agent":aT(),"x-service-name":`claude-code`},n=gf()||Mt();process.env.USER_TYPE===`ant`&&!n&&A(`1P event logging: Trust not accepted`);let r=this.skipAuth||!n;if(!r&&Y()){let e=Z();bw()?e&&py(e.expiresAt)&&(r=!0,process.env.USER_TYPE===`ant`&&A(`1P event logging: OAuth token expired, skipping auth to avoid 401`)):r=!0}let i=r?{headers:{},error:`trust not established or Oauth token expired`}:hT(),a=!i.error;!a&&process.env.USER_TYPE===`ant`&&A(`1P event logging: auth not available, sending without auth`);let o=a?{...t,...i.headers}:t;try{let t=await v.post(this.endpoint,e,{timeout:this.timeout,headers:o});this.logSuccess(e.events.length,a,t.data);return}catch(n){if(a&&v.isAxiosError(n)&&n.response?.status===401){process.env.USER_TYPE===`ant`&&A(`1P event logging: 401 auth error, retrying without auth`);let n=await v.post(this.endpoint,e,{timeout:this.timeout,headers:t});this.logSuccess(e.events.length,!1,n.data);return}throw n}}logSuccess(e,t,n){process.env.USER_TYPE===`ant`&&(A(`1P event logging: ${e} events exported successfully${t?` (with auth)`:` (without auth)`}`),A(`API Response: ${k(n,null,2)}`))}hrTimeToDate(e){let[t,n]=e;return new Date(t*1e3+n/1e6)}transformLogsToEvents(e){let t=[];for(let n of e){let e=n.attributes||{};if(e.event_type===`GrowthbookExperimentEvent`){let r=this.hrTimeToDate(n.hrTime),i=e.account_uuid,a=e.organization_uuid;t.push({event_type:`GrowthbookExperimentEvent`,event_data:IE.toJSON({event_id:e.event_id,timestamp:r,experiment_id:e.experiment_id,variation_id:e.variation_id,environment:e.environment,user_attributes:e.user_attributes,experiment_metadata:e.experiment_metadata,device_id:e.device_id,session_id:e.session_id,auth:i||a?{account_uuid:i,organization_uuid:a}:void 0})});continue}let r=e.event_name||n.body||`unknown`,i=e.core_metadata,a=e.user_metadata,o=e.event_metadata||{};if(!i){process.env.USER_TYPE===`ant`&&A(`1P event logging: core_metadata missing for event ${r}`),t.push({event_type:`ClaudeCodeInternalEvent`,event_data:AE.toJSON({event_id:e.event_id,event_name:r,client_timestamp:this.hrTimeToDate(n.hrTime),session_id:at(),additional_metadata:Buffer.from(k({transform_error:`core_metadata attribute is missing`})).toString(`base64`)})});continue}let s=bD(i,a,o),{_PROTO_skill_name:c,_PROTO_plugin_name:l,_PROTO_marketplace_name:u,...d}=s.additional,f=mr(d);t.push({event_type:`ClaudeCodeInternalEvent`,event_data:AE.toJSON({event_id:e.event_id,event_name:r,client_timestamp:this.hrTimeToDate(n.hrTime),device_id:e.user_id,email:a?.email,auth:s.auth,...s.core,env:s.env,process:s.process,skill_name:typeof c==`string`?c:void 0,plugin_name:typeof l==`string`?l:void 0,marketplace_name:typeof u==`string`?u:void 0,additional_metadata:Object.keys(f).length>0?Buffer.from(k(f)).toString(`base64`):void 0})})}return{events:t}}async shutdown(){this.isShutdown=!0,this.resetBackoff(),await this.forceFlush(),process.env.USER_TYPE===`ant`&&A(`1P event logging exporter shutdown complete`)}async forceFlush(){await Promise.all(this.pendingExports),process.env.USER_TYPE===`ant`&&A(`1P event logging exporter flush complete`)}}}));function HD(e){return BO(UD,{})?.[e]===!0}var UD,WD=t((()=>{ak(),UD=`tengu_frond_boric`}));function GD(){return BO(nO,{})}function KD(e){let t=GD()[e];if(!t)return null;let n=t.sample_rate;return typeof n!=`number`||n<0||n>1||n>=1?null:n<=0?0:Math.random()<n?n:0}function qD(){return BO(rO,{})}async function JD(){if(aO)try{await aO.shutdown(),process.env.USER_TYPE===`ant`&&A(`1P event logging: final shutdown complete`)}catch{}}function YD(){return!uE()}async function XD(e,t,n={}){try{let r=await yD({model:n.model,betas:n.betas}),i={event_name:t,event_id:sa(),core_metadata:r,user_metadata:TT(!0),event_metadata:n},a=zf();a&&(i.user_id=a),process.env.USER_TYPE===`ant`&&A(`[ANT-ONLY] 1P event: ${t} ${k(n,null,0)}`),e.emit({body:t,attributes:i})}catch(e){process.env.USER_TYPE===`ant`&&I(e)}}function ZD(e,t={}){YD()&&(!iO||HD(`firstParty`)||XD(iO,e,t))}function QD(){return`production`}function $D(e){if(!YD()||!iO||HD(`firstParty`))return;let t=zf(),{accountUuid:n,organizationUuid:r}=TT(!0),i={event_type:`GrowthbookExperimentEvent`,event_id:sa(),experiment_id:e.experimentId,variation_id:e.variationId,...t&&{device_id:t},...n&&{account_uuid:n},...r&&{organization_uuid:r},...e.userAttributes&&{session_id:e.userAttributes.sessionId,user_attributes:k(e.userAttributes)},...e.experimentMetadata&&{experiment_metadata:k(e.experimentMetadata)},environment:QD()};process.env.USER_TYPE===`ant`&&A(`[ANT-ONLY] 1P GrowthBook experiment: ${e.experimentId} variation=${e.variationId}`),iO.emit({body:`growthbook_experiment`,attributes:i})}function eO(){if(wi(`1p_event_logging_start`),!YD()){process.env.USER_TYPE===`ant`&&A(`1P event logging not enabled`);return}let e=qD();oO=e,wi(`1p_event_after_growthbook_config`);let t=e.scheduledDelayMillis||parseInt(process.env.OTEL_LOGS_EXPORT_INTERVAL||sO.toString(),10),n=e.maxExportBatchSize||cO,r=e.maxQueueSize||lO,i=Gr(),a={[xe]:`claude-code`,[ve]:`2.6.10`};if(i===`wsl`){let e=Wr();e&&(a[`wsl.version`]=e)}aO=new ZT({resource:Oe(a),processors:[new aE(new BD({maxBatchSize:n,skipAuth:e.skipAuth,maxAttempts:e.maxAttempts,path:e.path,baseUrl:e.baseUrl,isKilled:()=>HD(`firstParty`)}),{scheduledDelayMillis:t,maxExportBatchSize:n,maxQueueSize:r})]}),iO=aO.getLogger(`com.anthropic.claude_code.events`,`2.6.10`)}async function tO(){if(!YD()||!aO||ku(qD(),oO))return;process.env.USER_TYPE===`ant`&&A(`1P event logging: ${rO} changed, reinitializing`);let e=aO,t=iO;iO=null;try{await e.forceFlush()}catch{}aO=null;try{eO()}catch(n){aO=e,iO=t,I(n);return}e.shutdown().catch(()=>{})}var nO,rO,iO,aO,oO,sO,cO,lO,uO=t((()=>{ke(),lE(),Ee(),Td(),rp(),M(),Vr(),qr(),ur(),Ti(),DT(),fE(),VD(),ak(),FD(),WD(),nO=`tengu_event_sampling_config`,rO=`tengu_1p_event_batch_config`,iO=null,aO=null,oO=null,sO=1e4,cO=200,lO=8192}));function dO(e){try{Promise.resolve(e()).catch(e=>{I(e)})}catch(e){I(e)}}function fO(e){let t=!0,n=XO.subscribe(()=>dO(e));return KO.size>0&&queueMicrotask(()=>{t&&KO.size>0&&dO(e)}),()=>{t=!1,n()}}function pO(){if(!QO&&(QO=!0,process.env.USER_TYPE===`ant`)){let e=process.env.CLAUDE_INTERNAL_FC_OVERRIDES;if(e)try{ZO=JSON.parse(e),A(`GrowthBook: Using env var overrides for ${Object.keys(ZO).length} features: ${Object.keys(ZO).join(`, `)}`)}catch{I(Error(`GrowthBook: Failed to parse CLAUDE_INTERNAL_FC_OVERRIDES: ${e}`))}}return ZO}function mO(e){let t=pO();return t!==null&&e in t}function hO(){if(process.env.USER_TYPE===`ant`)try{return H().growthBookOverrides}catch{return}}function gO(){return KO.size>0?Object.fromEntries(KO):H().cachedGrowthBookFeatures??{}}function _O(){return hO()??{}}function vO(e,t){if(process.env.USER_TYPE===`ant`)try{V(n=>{let r=n.growthBookOverrides??{};if(t===void 0){if(!(e in r))return n;let{[e]:t,...i}=r;if(Object.keys(i).length===0){let{growthBookOverrides:e,...t}=n;return t}return{...n,growthBookOverrides:i}}return ku(r[e],t)?n:{...n,growthBookOverrides:{...r,[e]:t}}}),XO.emit()}catch(e){I(e)}}function yO(){if(process.env.USER_TYPE===`ant`)try{V(e=>{if(!e.growthBookOverrides||Object.keys(e.growthBookOverrides).length===0)return e;let{growthBookOverrides:t,...n}=e;return n}),XO.emit()}catch(e){I(e)}}function bO(e){if(JO.has(e))return;let t=GO.get(e);t&&(JO.add(e),$D({experimentId:t.experimentId,variationId:t.variationId,userAttributes:EO(),experimentMetadata:{feature_id:e}}))}async function xO(e){let t=e.getPayload();if(!t?.features||Object.keys(t.features).length===0)return!1;GO.clear();let n={};for(let[e,r]of Object.entries(t.features)){let t=r;if(`value`in t&&!(`defaultValue`in t)?n[e]={...t,defaultValue:t.value}:n[e]=t,t.source===`experiment`&&t.experimentResult){let n=t.experimentResult,r=t.experiment;r?.key&&n.variationId!==void 0&&GO.set(e,{experimentId:r.key,variationId:n.variationId})}}await e.setPayload({...t,features:n}),KO.clear();for(let[e,t]of Object.entries(n)){let n=`value`in t?t.value:t.defaultValue;n!==void 0&&KO.set(e,n)}return!0}function SO(){let e=Object.fromEntries(KO);ku(H().cachedGrowthBookFeatures,e)||V(t=>({...t,cachedGrowthBookFeatures:e}))}function CO(e){if(!process.env.CLAUDE_CODE_DISABLE_LOCAL_GATES)return $O[e]}function wO(){return process.env.CLAUDE_GB_ADAPTER_URL&&process.env.CLAUDE_GB_ADAPTER_KEY?!0:YD()}function TO(){let e=process.env.ANTHROPIC_BASE_URL;if(e)try{let t=new URL(e).host;return t===`api.anthropic.com`?void 0:t}catch{return}}function EO(){let e=bT(),t=e.email;!t&&process.env.USER_TYPE===`ant`&&(t=H().oauthAccount?.emailAddress);let n=TO();return{id:e.deviceId,sessionId:e.sessionId,deviceID:e.deviceId,platform:e.platform,...n&&{apiBaseUrlHost:n},...e.organizationUuid&&{organizationUUID:e.organizationUuid},...e.accountUuid&&{accountUUID:e.accountUuid},...e.userType&&{userType:e.userType},...e.subscriptionType&&{subscriptionType:e.subscriptionType},...e.rateLimitTier&&{rateLimitTier:e.rateLimitTier},...e.firstTokenTime&&{firstTokenTime:e.firstTokenTime},...t&&{email:t},...e.appVersion&&{appVersion:e.appVersion},...e.githubActionsMetadata&&{githubActionsMetadata:e.githubActionsMetadata}}}async function DO(e,t,n){let r=pO();if(r&&e in r)return r[e];let i=hO();if(i&&e in i)return i[e];if(!wO()){let n=CO(e);return n===void 0?t:n}let a=await tk();if(!a){let n=CO(e);return n===void 0?t:n}let o;return o=KO.has(e)?KO.get(e):a.getFeatureValue(e,t),n&&bO(e),process.env.USER_TYPE===`ant`&&A(`GrowthBook: getFeatureValue("${e}") = ${k(o)}`),o}async function OO(e,t){return DO(e,t,!0)}function kO(e,t){let n=pO();if(n&&e in n)return n[e];let r=hO();if(r&&e in r)return r[e];if(!wO()){let n=CO(e);return n===void 0?t:n}let i=CO(e);if(i!==void 0)return i;if(GO.has(e)?bO(e):qO.add(e),KO.has(e))return KO.get(e);try{let t=H().cachedGrowthBookFeatures?.[e];if(t!==void 0)return t}catch{}return t}function AO(e,t,n){return kO(e,t)}function jO(e){let t=pO();if(t&&e in t)return!!t[e];let n=hO();if(n&&e in n)return!!n[e];if(!wO()){let t=CO(e);return t===void 0?!1:!!t}GO.has(e)?bO(e):qO.add(e);try{let t=H(),n=t.cachedGrowthBookFeatures?.[e];if(n!==void 0)return!!n;let r=t.cachedStatsigGates?.[e];if(r!==void 0)return r}catch{}let r=CO(e);return r===void 0?!1:!!r}async function MO(e){let t=pO();if(t&&e in t)return!!t[e];let n=hO();if(n&&e in n)return!!n[e];if(!wO())return!1;YO&&await YO;let r=H(),i=r.cachedStatsigGates?.[e];if(i!==void 0)return!!i;let a=r.cachedGrowthBookFeatures?.[e];return a===void 0?!1:!!a}async function NO(e){let t=pO();if(t&&e in t)return!!t[e];let n=hO();if(n&&e in n)return!!n[e];if(!wO()){let t=CO(e);return t===void 0?!1:!!t}return H().cachedGrowthBookFeatures?.[e]===!0?(GO.has(e)?bO(e):qO.add(e),!0):DO(e,!1,!0)}function PO(){if(wO())try{FO(),XO.emit(),YO=tk().catch(e=>(I(kn(e)),null)).finally(()=>{YO=null})}catch(e){I(kn(e))}}function FO(){RO(),HO&&(process.off(`beforeExit`,HO),HO=null),UO&&(process.off(`exit`,UO),UO=null),VO?.destroy(),VO=null,WO=!1,YO=null,GO.clear(),qO.clear(),JO.clear(),KO.clear(),ek.cache?.clear?.(),tk.cache?.clear?.(),ZO=null,QO=!1}async function IO(){if(wO())try{let e=await tk();if(!e)return;if(await e.refreshFeatures(),e!==VO){process.env.USER_TYPE===`ant`&&A(`GrowthBook: Skipping refresh processing for replaced client`);return}let t=await xO(e);if(e!==VO)return;process.env.USER_TYPE===`ant`&&A(`GrowthBook: Light refresh completed`),t&&(SO(),XO.emit())}catch(e){I(kn(e))}}function LO(){wO()&&(rk&&clearInterval(rk),rk=setInterval(()=>{IO()},nk),rk.unref?.(),ik||(ik=()=>{RO()},process.once(`beforeExit`,ik)))}function RO(){rk&&(clearInterval(rk),rk=null),ik&&(process.removeListener(`beforeExit`,ik),ik=null)}async function zO(e,t){return OO(e,t)}function BO(e,t){return kO(e,t)}var VO,HO,UO,WO,GO,KO,qO,JO,YO,XO,ZO,QO,$O,ek,tk,nk,rk,ik,ak=t((()=>{lc(),Td(),O(),Dd(),rp(),M(),In(),_T(),Vr(),ft(),ur(),DT(),uO(),VO=null,HO=null,UO=null,WO=!1,GO=new Map,KO=new Map,qO=new Set,JO=new Set,YO=null,XO=Ot(),ZO=null,QO=!1,$O={tengu_keybinding_customization_release:!0,tengu_streaming_tool_execution2:!0,tengu_kairos_cron:!0,tengu_amber_json_tools:!0,tengu_immediate_model_command:!0,tengu_basalt_3kr:!0,tengu_pebble_leaf_prune:!0,tengu_chair_sermon:!0,tengu_lodestone_enabled:!0,tengu_auto_background_agents:!0,tengu_fgts:!0,tengu_session_memory:!0,tengu_passport_quail:!0,tengu_moth_copse:!0,tengu_coral_fern:!0,tengu_chomp_inflection:!0,tengu_hive_evidence:!0,tengu_kairos_brief:!0,tengu_kairos_brief_config:{enable_slash_command:!0},tengu_sedge_lantern:!0,tengu_onyx_plover:{enabled:!0},tengu_willow_mode:`dialog`,tengu_turtle_carbon:!0,tengu_amber_stoat:!0,tengu_amber_flint:!0,tengu_slim_subagent_claudemd:!0,tengu_birch_trellis:!0,tengu_collage_kaleidoscope:!0,tengu_compact_cache_prefix:!0,tengu_kairos_assistant:!0,tengu_kairos_cron_durable:!0,tengu_attribution_header:!0,tengu_slate_prism:!0,tengu_review_bughunter_config:{enabled:!0},tengu_ccr_bundle_seed_enabled:!0},ek=p(()=>{if(!wO())return null;let e=EO(),t=Ed(),n=process.env.CLAUDE_GB_ADAPTER_URL||process.env.USER_TYPE===`ant`&&process.env.CLAUDE_CODE_GB_BASE_URL||`https://api.anthropic.com/`,r=!!(process.env.CLAUDE_GB_ADAPTER_URL&&process.env.CLAUDE_GB_ADAPTER_KEY);process.env.USER_TYPE===`ant`&&A(`GrowthBook: Creating client with clientKey=${t}, attributes: ${k(e)}`);let i=gf()||lt()||Mt()?hT():{headers:{},error:`trust not established`},a=r||!i.error;WO=a;let o=new sc({apiHost:n,clientKey:t,attributes:e,remoteEval:!r,...r?{}:{cacheKeyAttributes:[`id`,`organizationUUID`]},...i.error?{}:{apiHostRequestHeaders:i.headers},...process.env.USER_TYPE===`ant`?{log:(e,t)=>{A(`GrowthBook: ${e} ${k(t)}`)}}:{}});if(VO=o,!a)return{client:o,initialized:Promise.resolve()};let s=o.init({timeout:5e3}).then(async e=>{if(VO!==o){process.env.USER_TYPE===`ant`&&A(`GrowthBook: Skipping init callback for replaced client`);return}process.env.USER_TYPE===`ant`&&A(`GrowthBook initialized, source: ${e.source}, success: ${e.success}`);let t=await xO(o);if(VO===o){if(t){for(let e of qO)bO(e);qO.clear(),SO(),XO.emit()}if(process.env.USER_TYPE===`ant`){let e=o.getFeatures();if(e){let t=Object.keys(e);A(`GrowthBook loaded ${t.length} features: ${t.slice(0,10).join(`, `)}${t.length>10?`...`:``}`)}}}}).catch(e=>{process.env.USER_TYPE===`ant`&&I(kn(e))});return HO=()=>VO?.destroy(),UO=()=>VO?.destroy(),process.on(`beforeExit`,HO),process.on(`exit`,UO),{client:o,initialized:s}}),tk=p(async()=>{let e=ek();return!e||!WO&&(gf()||lt()||Mt())&&!hT().error&&(process.env.USER_TYPE===`ant`&&A(`GrowthBook: Auth became available after client creation, reinitializing`),FO(),e=ek(),!e)?null:(await e.initialized,LO(),e.client)}),nk=process.env.USER_TYPE===`ant`?1200*1e3:360*60*1e3,rk=null,ik=null}));function ok(){let e=process.env.CLAUDE_CODE_DISABLE_AUTO_MEMORY;if(g(e))return!1;if(ie(e))return!0;if(g(process.env.CLAUDE_CODE_SIMPLE)||g(process.env.CLAUDE_CODE_REMOTE)&&!process.env.CLAUDE_CODE_REMOTE_MEMORY_DIR)return!1;let t=z_();return t.autoMemoryEnabled===void 0?!0:t.autoMemoryEnabled}function sk(){return kO(`tengu_passport_quail`,!1)?!Mt()||kO(`tengu_slate_thimble`,!1):!1}function ck(){return process.env.CLAUDE_CODE_REMOTE_MEMORY_DIR?process.env.CLAUDE_CODE_REMOTE_MEMORY_DIR:ae()}function lk(e,t){if(!e)return;let n=e;if(t&&(n.startsWith(`~/`)||n.startsWith(`~\\`))){let e=n.slice(2),t=Ji(e||`.`);if(t===`.`||t===`..`)return;n=R(Vi(),e)}let r=Ji(n).replace(/[/\\]+$/,``);if(!(!qi(r)||r.length<3||/^[A-Za-z]:$/.test(r)||r.startsWith(`\\\\`)||r.startsWith(`//`)||r.includes(`\0`)))return(r+Zi).normalize(`NFC`)}function uk(){return lk(process.env.CLAUDE_COWORK_MEMORY_PATH_OVERRIDE,!1)}function dk(){return lk(U(`policySettings`)?.autoMemoryDirectory??U(`flagSettings`)?.autoMemoryDirectory??U(`localSettings`)?.autoMemoryDirectory??U(`userSettings`)?.autoMemoryDirectory,!0)}function fk(){return uk()!==void 0}function pk(){return Sr(xn())??xn()}function mk(){return R(vk(),_k)}function hk(e){return Ji(e).startsWith(vk())}var gk,_k,vk,yk=t((()=>{m(),O(),ak(),h(),wr(),$r(),Y_(),gk=`memory`,_k=`MEMORY.md`,vk=p(()=>(uk()??dk())||(R(R(ck(),`projects`),Zr(pk()),gk)+Zi).normalize(`NFC`),()=>xn())}));export{eD as $,O_ as $a,zd as $c,Py as $i,JS as $n,bh as $o,hx as $r,Sp as $s,Aw as $t,RO as A,Av as Aa,rp as Ac,ub as Ai,Xu as Al,uw as An,Zh as Ao,Kx as Ar,im as As,aT as At,WD as B,Q_ as Ba,cf as Bc,eb as Bi,Bl,pC as Bn,Vh as Bo,Yx as Br,Jp as Bs,Rw as Bt,tk as C,Bv as Ca,yf as Cc,zb as Ci,dd as Cl,JC as Cn,yg as Co,zx as Cr,_m as Cs,mT as Ct,FO as D,Iv as Da,np as Dc,Mb as Di,$u as Dl,XC as Dn,Yh as Do,jx as Dr,om as Ds,sT as Dt,IO as E,Uv as Ea,zf as Ec,Ub as Ei,id as El,Kw as En,ig as Eo,Fx as Er,fm as Es,lT as Et,ZD as F,wv as Fa,If as Fc,ib as Fi,Au as Fl,wC as Fn,tg as Fo,Qx as Fr,Wp as Fs,tw as Ft,yD as G,G_ as Ga,Yd as Gc,lb as Gi,VS as Gn,Mh as Go,wx as Gr,Up as Gs,Zw as Gt,dD as H,iv as Ha,uf as Hc,Yy as Hi,Zc as Hl,lC as Hn,jh as Ho,Jx as Hr,Bp as Hs,PC as Ht,$D as I,Cv as Ia,ff as Ic,qy as Ii,ku as Il,DC as In,ng as Io,kx as Ir,qp as Is,qC as It,FD as J,L_ as Ja,Hd as Jc,Hy as Ji,$S as Jn,Oh as Jo,Sx as Jr,Fp as Js,Z as Jt,hD as K,z_ as Ka,Ud as Kc,Uy as Ki,eC as Kn,Ih as Ko,Ex as Kr,Np as Ks,HC as Kt,tO as L,gv as La,df as Lc,Jy as Li,bu as Ll,_C as Ln,Rh as Lo,Wx as Lr,$p as Ls,QC as Lt,uO as M,Nv as Ma,Bf as Mc,pb as Mi,Wu as Ml,fw as Mn,$h as Mo,Ox as Mr,Qp as Ms,OC as Mt,eO as N,W as Na,Pf as Nc,fb as Ni,Mu as Nl,zw as Nn,eg as No,Ax as Nr,nm as Ns,VC as Nt,vO as O,Pv as Oa,Tf as Oc,jb as Oi,Qu as Ol,rw as On,Qh as Oo,eS as Or,sm as Os,dT as Ot,YD as P,Sv as Pa,V as Pc,ob as Pi,ju as Pl,TC as Pn,Xh as Po,rS as Pr,Yp as Ps,vw as Pt,iD as Q,U as Qa,Rd as Qc,jy as Qi,qS as Qn,Eh as Qo,px as Qr,Cp as Qs,Fw as Qt,KD as R,xv as Ra,pf as Rc,Qy as Ri,yu as Rl,CC as Rn,qh as Ro,$x as Rr,Xp as Rs,iw as Rt,ak as S,zv as Sa,H as Sc,bb as Si,fd as Sl,Mw as Sn,Og as So,Ix as Sr,vm as Ss,fT as St,PO as T,Kv as Ta,Vf as Tc,Vb as Ti,ad as Tl,aw as Tn,bg as To,Px as Tr,gm as Ts,gT as Tt,fD as U,ov as Ua,of as Uc,$y as Ui,aC as Un,Ph as Uo,Gx as Ur,Hp as Us,UC as Ut,HD as V,tv as Va,lf as Vc,nb as Vi,il as Vl,mC as Vn,Hh as Vo,Hx as Vr,Kp as Vs,MC as Vt,mD as W,$_ as Wa,af as Wc,cb as Wi,XS as Wn,Nh as Wo,Xx as Wr,Vp as Ws,KC as Wt,uD as X,j_ as Xa,ef as Xc,Ly as Xi,KS as Xn,kh as Xo,xx as Xr,Op as Xs,FC as Xt,cD as Y,N_ as Ya,Kd as Yc,Ry as Yi,tC as Yn,Dh as Yo,Cx as Yr,Dp as Ys,_w as Yt,sD as Z,A_ as Za,Gd as Zc,Iy as Zi,GS as Zn,Th as Zo,bx as Zr,Tp as Zs,Sw as Zt,kO as _,ry as _a,kf as _c,wb as _i,wd as _l,Pw as _n,r_ as _o,uS as _r,nh as _s,vT as _t,yk as a,fy as aa,yp as ac,Qb as ai,Id as al,bw as an,H_ as ao,ES as ar,vh as as,qE as at,_O as b,Hv as ba,Nf as bc,Ob as bi,yd as bl,Dw as bn,Eg as bo,Bx as br,th as bs,hT as bt,sk as c,my as ca,lp as cc,ux as ci,Qd as cl,AC as cn,K_ as co,DS as cr,gh as cs,fE as ct,jO as d,py as da,cp as dc,vb as di,Bd as dl,Y as dn,u_ as do,FS as dr,ym as ds,lE as dt,Dy as ea,bp as ec,ox as ei,sf as el,jw as en,V_ as eo,RS as er,xh as es,rD as et,yO as f,sy as fa,op as fc,xb as fi,Od as fl,Lw as fn,l_ as fo,xS as fr,oh as fs,aE as ft,BO as g,_y as ga,gf as gc,Db as gi,Td as gl,Tw as gn,o_ as go,aS as gr,Mm as gs,ET as gt,zO as h,oy as ha,Kf as hc,yb as hi,Ad as hl,ew as hn,d_ as ho,lS as hr,Gm as hs,TT as ht,fk as i,cy as ia,wp as ic,$b as ii,nf as il,ww as in,U_ as io,PS as ir,hh as is,QE as it,GD as j,G as ja,Ff as jc,db as ji,Gu as jl,cw as jn,ag as jo,Lx as jr,em as js,oT as jt,LO as k,Rv as ka,Uf as kc,Sb as ki,Zu as kl,Xw as kn,Jh as ko,Ux as kr,rm as ks,cT as kt,NO as l,hy as la,hp as lc,Nb as li,Xd as ll,RC as ln,P_ as lo,TS as lr,yh as ls,uE as lt,TO as m,uy as ma,ip as mc,_b as mi,jd as ml,Ow as mn,f_ as mo,gS as mr,dh as ms,ZT as mt,vk as n,yy as na,Ap as nc,nx as ni,Zd as nl,hw as nn,J_ as no,NS as nr,Sh as ns,tD as nt,hk as o,ly as oa,gp as oc,tx as oi,rf as ol,Q as on,Y_ as oo,wS as or,_h as os,UE as ot,gO as p,gy as pa,ap as pc,kb as pi,Md as pl,lw as pn,x_ as po,bS as pr,lh as ps,$T as pt,gD as q,w_ as qa,Vd as qc,Wy as qi,YS as qn,Ah as qo,Dx as qr,Mp as qs,jC as qt,ck as r,by as ra,Ep as rc,lx as ri,tf as rl,NC as rn,W_ as ro,AS as rr,wh as rs,$E as rt,ok as s,dy as sa,dp as sc,Jb as si,Ld as sl,xw as sn,E_ as so,OS as sr,mh as ss,JE as st,mk as t,Oy as ta,xp as tc,sx as ti,Jd as tl,X as tn,B_ as to,zS as tr,Ch as ts,oD as tt,MO as u,vy as ua,sp as uc,Cb as ui,qd as ul,BC as un,c_ as uo,SS as ur,ph as us,dE as ut,AO as v,iy as va,Lf as vc,qb as vi,Cd as vl,Cw as vn,Gg as vo,J as vr,Ym as vs,DT as vt,fO as w,ny as wa,Hf as wc,Rb as wi,ud as wl,ow as wn,vg as wo,Rx as wr,mm as ws,_T as wt,mO as x,qv as xa,Ef as xc,mb as xi,pd as xl,Ew as xn,Dg as xo,Vx as xr,fh as xs,pT as xt,OO as y,ay as ya,Rf as yc,hb as yi,bd as yl,kw as yn,Ug as yo,Mx as yr,eh as ys,yT as yt,JD as z,nv as za,mf as zc,tb as zi,zl,gC as zn,Lh as zo,tS as zr,Zp as zs,pw as zt};
|
|
39
|
+
`,`utf8`)}catch(e){I(e)}}async deleteFile(e){try{await ma(e)}catch{}}async retryPreviousBatches(){try{let e=`${zD}${at()}.`,t;try{t=(await da(ID())).filter(t=>t.startsWith(e)&&t.endsWith(`.json`)).filter(e=>!e.includes(RD))}catch(e){if(Ln(e))return;throw e}for(let e of t){let t=Ui.join(ID(),e);this.retryFileInBackground(t)}}catch(e){I(e)}}async retryFileInBackground(e){if(this.attempts>=this.maxAttempts){await this.deleteFile(e);return}let t=await this.loadEventsFromFile(e);if(t.length===0){await this.deleteFile(e);return}process.env.USER_TYPE===`ant`&&A(`1P event logging: retrying ${t.length} events from previous batch`);let n=await this.sendEventsInBatches(t);n.length===0?(await this.deleteFile(e),process.env.USER_TYPE===`ant`&&A(`1P event logging: previous batch retry succeeded`)):(await this.saveEventsToFile(e,n),process.env.USER_TYPE===`ant`&&A(`1P event logging: previous batch retry failed, ${n.length} events remain`))}async export(e,t){if(this.isShutdown){process.env.USER_TYPE===`ant`&&A(`1P event logging export failed: Exporter has been shutdown`),t({code:Se.FAILED,error:Error(`Exporter has been shutdown`)});return}let n=this.doExport(e,t);this.pendingExports.push(n),n.finally(()=>{let e=this.pendingExports.indexOf(n);e>-1&&this.pendingExports.splice(e,1)})}async doExport(e,t){try{let n=e.filter(e=>e.instrumentationScope?.name===`com.anthropic.claude_code.events`);if(n.length===0){t({code:Se.SUCCESS});return}let r=this.transformLogsToEvents(n).events;if(r.length===0){t({code:Se.SUCCESS});return}if(this.attempts>=this.maxAttempts){t({code:Se.FAILED,error:Error(`Dropped ${r.length} events: max attempts (${this.maxAttempts}) reached`)});return}let i=await this.sendEventsInBatches(r);if(this.attempts++,i.length>0){await this.queueFailedEvents(i),this.scheduleBackoffRetry();let e=this.lastExportErrorContext?` (${this.lastExportErrorContext})`:``;t({code:Se.FAILED,error:Error(`Failed to export ${i.length} events${e}`)});return}this.resetBackoff(),await this.getQueuedEventCount()>0&&!this.isRetrying&&this.retryFailedEvents(),t({code:Se.SUCCESS})}catch(e){process.env.USER_TYPE===`ant`&&A(`1P event logging export failed: ${An(e)}`),I(e),t({code:Se.FAILED,error:kn(e)})}}async sendEventsInBatches(e){let t=[];for(let n=0;n<e.length;n+=this.maxBatchSize)t.push(e.slice(n,n+this.maxBatchSize));process.env.USER_TYPE===`ant`&&A(`1P event logging: exporting ${e.length} events in ${t.length} batch(es)`);let n=[],r;for(let e=0;e<t.length;e++){let i=t[e];try{await this.sendBatchWithRetry({events:i})}catch(i){r=LD(i);for(let r=e;r<t.length;r++)n.push(...t[r]);if(process.env.USER_TYPE===`ant`){let n=t.length-1-e;A(`1P event logging: batch ${e+1}/${t.length} failed (${r}); short-circuiting ${n} remaining batch(es)`)}break}e<t.length-1&&this.batchDelayMs>0&&await Fi(this.batchDelayMs)}return n.length>0&&r&&(this.lastExportErrorContext=r),n}async queueFailedEvents(e){let t=this.getCurrentBatchFilePath();await this.appendEventsToFile(t,e);let n=this.lastExportErrorContext?` (${this.lastExportErrorContext})`:``,r=`1P event logging: ${e.length} events failed to export${n}`;I(Error(r))}scheduleBackoffRetry(){if(this.cancelBackoff||this.isRetrying||this.isShutdown)return;let e=Math.min(this.baseBackoffDelayMs*this.attempts*this.attempts,this.maxBackoffDelayMs);process.env.USER_TYPE===`ant`&&A(`1P event logging: scheduling backoff retry in ${e}ms (attempt ${this.attempts})`),this.cancelBackoff=this.schedule(async()=>{this.cancelBackoff=null,await this.retryFailedEvents()},e)}async retryFailedEvents(){let e=this.getCurrentBatchFilePath();for(;!this.isShutdown;){let t=await this.loadEventsFromFile(e);if(t.length===0)break;if(this.attempts>=this.maxAttempts){process.env.USER_TYPE===`ant`&&A(`1P event logging: max attempts (${this.maxAttempts}) reached, dropping ${t.length} events`),await this.deleteFile(e),this.resetBackoff();return}this.isRetrying=!0,await this.deleteFile(e),process.env.USER_TYPE===`ant`&&A(`1P event logging: retrying ${t.length} failed events (attempt ${this.attempts+1})`);let n=await this.sendEventsInBatches(t);if(this.attempts++,this.isRetrying=!1,n.length>0){await this.saveEventsToFile(e,n),this.scheduleBackoffRetry();return}this.resetBackoff(),process.env.USER_TYPE===`ant`&&A(`1P event logging: backoff retry succeeded`)}}resetBackoff(){this.attempts=0,this.cancelBackoff&&(this.cancelBackoff(),this.cancelBackoff=null)}async sendBatchWithRetry(e){if(this.isKilled())throw Error(`firstParty sink killswitch active`);let t={"Content-Type":`application/json`,"User-Agent":aT(),"x-service-name":`claude-code`},n=gf()||Mt();process.env.USER_TYPE===`ant`&&!n&&A(`1P event logging: Trust not accepted`);let r=this.skipAuth||!n;if(!r&&Y()){let e=Z();bw()?e&&py(e.expiresAt)&&(r=!0,process.env.USER_TYPE===`ant`&&A(`1P event logging: OAuth token expired, skipping auth to avoid 401`)):r=!0}let i=r?{headers:{},error:`trust not established or Oauth token expired`}:hT(),a=!i.error;!a&&process.env.USER_TYPE===`ant`&&A(`1P event logging: auth not available, sending without auth`);let o=a?{...t,...i.headers}:t;try{let t=await v.post(this.endpoint,e,{timeout:this.timeout,headers:o});this.logSuccess(e.events.length,a,t.data);return}catch(n){if(a&&v.isAxiosError(n)&&n.response?.status===401){process.env.USER_TYPE===`ant`&&A(`1P event logging: 401 auth error, retrying without auth`);let n=await v.post(this.endpoint,e,{timeout:this.timeout,headers:t});this.logSuccess(e.events.length,!1,n.data);return}throw n}}logSuccess(e,t,n){process.env.USER_TYPE===`ant`&&(A(`1P event logging: ${e} events exported successfully${t?` (with auth)`:` (without auth)`}`),A(`API Response: ${k(n,null,2)}`))}hrTimeToDate(e){let[t,n]=e;return new Date(t*1e3+n/1e6)}transformLogsToEvents(e){let t=[];for(let n of e){let e=n.attributes||{};if(e.event_type===`GrowthbookExperimentEvent`){let r=this.hrTimeToDate(n.hrTime),i=e.account_uuid,a=e.organization_uuid;t.push({event_type:`GrowthbookExperimentEvent`,event_data:IE.toJSON({event_id:e.event_id,timestamp:r,experiment_id:e.experiment_id,variation_id:e.variation_id,environment:e.environment,user_attributes:e.user_attributes,experiment_metadata:e.experiment_metadata,device_id:e.device_id,session_id:e.session_id,auth:i||a?{account_uuid:i,organization_uuid:a}:void 0})});continue}let r=e.event_name||n.body||`unknown`,i=e.core_metadata,a=e.user_metadata,o=e.event_metadata||{};if(!i){process.env.USER_TYPE===`ant`&&A(`1P event logging: core_metadata missing for event ${r}`),t.push({event_type:`ClaudeCodeInternalEvent`,event_data:AE.toJSON({event_id:e.event_id,event_name:r,client_timestamp:this.hrTimeToDate(n.hrTime),session_id:at(),additional_metadata:Buffer.from(k({transform_error:`core_metadata attribute is missing`})).toString(`base64`)})});continue}let s=bD(i,a,o),{_PROTO_skill_name:c,_PROTO_plugin_name:l,_PROTO_marketplace_name:u,...d}=s.additional,f=mr(d);t.push({event_type:`ClaudeCodeInternalEvent`,event_data:AE.toJSON({event_id:e.event_id,event_name:r,client_timestamp:this.hrTimeToDate(n.hrTime),device_id:e.user_id,email:a?.email,auth:s.auth,...s.core,env:s.env,process:s.process,skill_name:typeof c==`string`?c:void 0,plugin_name:typeof l==`string`?l:void 0,marketplace_name:typeof u==`string`?u:void 0,additional_metadata:Object.keys(f).length>0?Buffer.from(k(f)).toString(`base64`):void 0})})}return{events:t}}async shutdown(){this.isShutdown=!0,this.resetBackoff(),await this.forceFlush(),process.env.USER_TYPE===`ant`&&A(`1P event logging exporter shutdown complete`)}async forceFlush(){await Promise.all(this.pendingExports),process.env.USER_TYPE===`ant`&&A(`1P event logging exporter flush complete`)}}}));function HD(e){return BO(UD,{})?.[e]===!0}var UD,WD=t((()=>{ak(),UD=`tengu_frond_boric`}));function GD(){return BO(nO,{})}function KD(e){let t=GD()[e];if(!t)return null;let n=t.sample_rate;return typeof n!=`number`||n<0||n>1||n>=1?null:n<=0?0:Math.random()<n?n:0}function qD(){return BO(rO,{})}async function JD(){if(aO)try{await aO.shutdown(),process.env.USER_TYPE===`ant`&&A(`1P event logging: final shutdown complete`)}catch{}}function YD(){return!uE()}async function XD(e,t,n={}){try{let r=await yD({model:n.model,betas:n.betas}),i={event_name:t,event_id:sa(),core_metadata:r,user_metadata:TT(!0),event_metadata:n},a=zf();a&&(i.user_id=a),process.env.USER_TYPE===`ant`&&A(`[ANT-ONLY] 1P event: ${t} ${k(n,null,0)}`),e.emit({body:t,attributes:i})}catch(e){process.env.USER_TYPE===`ant`&&I(e)}}function ZD(e,t={}){YD()&&(!iO||HD(`firstParty`)||XD(iO,e,t))}function QD(){return`production`}function $D(e){if(!YD()||!iO||HD(`firstParty`))return;let t=zf(),{accountUuid:n,organizationUuid:r}=TT(!0),i={event_type:`GrowthbookExperimentEvent`,event_id:sa(),experiment_id:e.experimentId,variation_id:e.variationId,...t&&{device_id:t},...n&&{account_uuid:n},...r&&{organization_uuid:r},...e.userAttributes&&{session_id:e.userAttributes.sessionId,user_attributes:k(e.userAttributes)},...e.experimentMetadata&&{experiment_metadata:k(e.experimentMetadata)},environment:QD()};process.env.USER_TYPE===`ant`&&A(`[ANT-ONLY] 1P GrowthBook experiment: ${e.experimentId} variation=${e.variationId}`),iO.emit({body:`growthbook_experiment`,attributes:i})}function eO(){if(wi(`1p_event_logging_start`),!YD()){process.env.USER_TYPE===`ant`&&A(`1P event logging not enabled`);return}let e=qD();oO=e,wi(`1p_event_after_growthbook_config`);let t=e.scheduledDelayMillis||parseInt(process.env.OTEL_LOGS_EXPORT_INTERVAL||sO.toString(),10),n=e.maxExportBatchSize||cO,r=e.maxQueueSize||lO,i=Gr(),a={[xe]:`claude-code`,[ve]:`2.6.11`};if(i===`wsl`){let e=Wr();e&&(a[`wsl.version`]=e)}aO=new ZT({resource:Oe(a),processors:[new aE(new BD({maxBatchSize:n,skipAuth:e.skipAuth,maxAttempts:e.maxAttempts,path:e.path,baseUrl:e.baseUrl,isKilled:()=>HD(`firstParty`)}),{scheduledDelayMillis:t,maxExportBatchSize:n,maxQueueSize:r})]}),iO=aO.getLogger(`com.anthropic.claude_code.events`,`2.6.11`)}async function tO(){if(!YD()||!aO||ku(qD(),oO))return;process.env.USER_TYPE===`ant`&&A(`1P event logging: ${rO} changed, reinitializing`);let e=aO,t=iO;iO=null;try{await e.forceFlush()}catch{}aO=null;try{eO()}catch(n){aO=e,iO=t,I(n);return}e.shutdown().catch(()=>{})}var nO,rO,iO,aO,oO,sO,cO,lO,uO=t((()=>{ke(),lE(),Ee(),Td(),rp(),M(),Vr(),qr(),ur(),Ti(),DT(),fE(),VD(),ak(),FD(),WD(),nO=`tengu_event_sampling_config`,rO=`tengu_1p_event_batch_config`,iO=null,aO=null,oO=null,sO=1e4,cO=200,lO=8192}));function dO(e){try{Promise.resolve(e()).catch(e=>{I(e)})}catch(e){I(e)}}function fO(e){let t=!0,n=XO.subscribe(()=>dO(e));return KO.size>0&&queueMicrotask(()=>{t&&KO.size>0&&dO(e)}),()=>{t=!1,n()}}function pO(){if(!QO&&(QO=!0,process.env.USER_TYPE===`ant`)){let e=process.env.CLAUDE_INTERNAL_FC_OVERRIDES;if(e)try{ZO=JSON.parse(e),A(`GrowthBook: Using env var overrides for ${Object.keys(ZO).length} features: ${Object.keys(ZO).join(`, `)}`)}catch{I(Error(`GrowthBook: Failed to parse CLAUDE_INTERNAL_FC_OVERRIDES: ${e}`))}}return ZO}function mO(e){let t=pO();return t!==null&&e in t}function hO(){if(process.env.USER_TYPE===`ant`)try{return H().growthBookOverrides}catch{return}}function gO(){return KO.size>0?Object.fromEntries(KO):H().cachedGrowthBookFeatures??{}}function _O(){return hO()??{}}function vO(e,t){if(process.env.USER_TYPE===`ant`)try{V(n=>{let r=n.growthBookOverrides??{};if(t===void 0){if(!(e in r))return n;let{[e]:t,...i}=r;if(Object.keys(i).length===0){let{growthBookOverrides:e,...t}=n;return t}return{...n,growthBookOverrides:i}}return ku(r[e],t)?n:{...n,growthBookOverrides:{...r,[e]:t}}}),XO.emit()}catch(e){I(e)}}function yO(){if(process.env.USER_TYPE===`ant`)try{V(e=>{if(!e.growthBookOverrides||Object.keys(e.growthBookOverrides).length===0)return e;let{growthBookOverrides:t,...n}=e;return n}),XO.emit()}catch(e){I(e)}}function bO(e){if(JO.has(e))return;let t=GO.get(e);t&&(JO.add(e),$D({experimentId:t.experimentId,variationId:t.variationId,userAttributes:EO(),experimentMetadata:{feature_id:e}}))}async function xO(e){let t=e.getPayload();if(!t?.features||Object.keys(t.features).length===0)return!1;GO.clear();let n={};for(let[e,r]of Object.entries(t.features)){let t=r;if(`value`in t&&!(`defaultValue`in t)?n[e]={...t,defaultValue:t.value}:n[e]=t,t.source===`experiment`&&t.experimentResult){let n=t.experimentResult,r=t.experiment;r?.key&&n.variationId!==void 0&&GO.set(e,{experimentId:r.key,variationId:n.variationId})}}await e.setPayload({...t,features:n}),KO.clear();for(let[e,t]of Object.entries(n)){let n=`value`in t?t.value:t.defaultValue;n!==void 0&&KO.set(e,n)}return!0}function SO(){let e=Object.fromEntries(KO);ku(H().cachedGrowthBookFeatures,e)||V(t=>({...t,cachedGrowthBookFeatures:e}))}function CO(e){if(!process.env.CLAUDE_CODE_DISABLE_LOCAL_GATES)return $O[e]}function wO(){return process.env.CLAUDE_GB_ADAPTER_URL&&process.env.CLAUDE_GB_ADAPTER_KEY?!0:YD()}function TO(){let e=process.env.ANTHROPIC_BASE_URL;if(e)try{let t=new URL(e).host;return t===`api.anthropic.com`?void 0:t}catch{return}}function EO(){let e=bT(),t=e.email;!t&&process.env.USER_TYPE===`ant`&&(t=H().oauthAccount?.emailAddress);let n=TO();return{id:e.deviceId,sessionId:e.sessionId,deviceID:e.deviceId,platform:e.platform,...n&&{apiBaseUrlHost:n},...e.organizationUuid&&{organizationUUID:e.organizationUuid},...e.accountUuid&&{accountUUID:e.accountUuid},...e.userType&&{userType:e.userType},...e.subscriptionType&&{subscriptionType:e.subscriptionType},...e.rateLimitTier&&{rateLimitTier:e.rateLimitTier},...e.firstTokenTime&&{firstTokenTime:e.firstTokenTime},...t&&{email:t},...e.appVersion&&{appVersion:e.appVersion},...e.githubActionsMetadata&&{githubActionsMetadata:e.githubActionsMetadata}}}async function DO(e,t,n){let r=pO();if(r&&e in r)return r[e];let i=hO();if(i&&e in i)return i[e];if(!wO()){let n=CO(e);return n===void 0?t:n}let a=await tk();if(!a){let n=CO(e);return n===void 0?t:n}let o;return o=KO.has(e)?KO.get(e):a.getFeatureValue(e,t),n&&bO(e),process.env.USER_TYPE===`ant`&&A(`GrowthBook: getFeatureValue("${e}") = ${k(o)}`),o}async function OO(e,t){return DO(e,t,!0)}function kO(e,t){let n=pO();if(n&&e in n)return n[e];let r=hO();if(r&&e in r)return r[e];if(!wO()){let n=CO(e);return n===void 0?t:n}let i=CO(e);if(i!==void 0)return i;if(GO.has(e)?bO(e):qO.add(e),KO.has(e))return KO.get(e);try{let t=H().cachedGrowthBookFeatures?.[e];if(t!==void 0)return t}catch{}return t}function AO(e,t,n){return kO(e,t)}function jO(e){let t=pO();if(t&&e in t)return!!t[e];let n=hO();if(n&&e in n)return!!n[e];if(!wO()){let t=CO(e);return t===void 0?!1:!!t}GO.has(e)?bO(e):qO.add(e);try{let t=H(),n=t.cachedGrowthBookFeatures?.[e];if(n!==void 0)return!!n;let r=t.cachedStatsigGates?.[e];if(r!==void 0)return r}catch{}let r=CO(e);return r===void 0?!1:!!r}async function MO(e){let t=pO();if(t&&e in t)return!!t[e];let n=hO();if(n&&e in n)return!!n[e];if(!wO())return!1;YO&&await YO;let r=H(),i=r.cachedStatsigGates?.[e];if(i!==void 0)return!!i;let a=r.cachedGrowthBookFeatures?.[e];return a===void 0?!1:!!a}async function NO(e){let t=pO();if(t&&e in t)return!!t[e];let n=hO();if(n&&e in n)return!!n[e];if(!wO()){let t=CO(e);return t===void 0?!1:!!t}return H().cachedGrowthBookFeatures?.[e]===!0?(GO.has(e)?bO(e):qO.add(e),!0):DO(e,!1,!0)}function PO(){if(wO())try{FO(),XO.emit(),YO=tk().catch(e=>(I(kn(e)),null)).finally(()=>{YO=null})}catch(e){I(kn(e))}}function FO(){RO(),HO&&(process.off(`beforeExit`,HO),HO=null),UO&&(process.off(`exit`,UO),UO=null),VO?.destroy(),VO=null,WO=!1,YO=null,GO.clear(),qO.clear(),JO.clear(),KO.clear(),ek.cache?.clear?.(),tk.cache?.clear?.(),ZO=null,QO=!1}async function IO(){if(wO())try{let e=await tk();if(!e)return;if(await e.refreshFeatures(),e!==VO){process.env.USER_TYPE===`ant`&&A(`GrowthBook: Skipping refresh processing for replaced client`);return}let t=await xO(e);if(e!==VO)return;process.env.USER_TYPE===`ant`&&A(`GrowthBook: Light refresh completed`),t&&(SO(),XO.emit())}catch(e){I(kn(e))}}function LO(){wO()&&(rk&&clearInterval(rk),rk=setInterval(()=>{IO()},nk),rk.unref?.(),ik||(ik=()=>{RO()},process.once(`beforeExit`,ik)))}function RO(){rk&&(clearInterval(rk),rk=null),ik&&(process.removeListener(`beforeExit`,ik),ik=null)}async function zO(e,t){return OO(e,t)}function BO(e,t){return kO(e,t)}var VO,HO,UO,WO,GO,KO,qO,JO,YO,XO,ZO,QO,$O,ek,tk,nk,rk,ik,ak=t((()=>{lc(),Td(),O(),Dd(),rp(),M(),In(),_T(),Vr(),ft(),ur(),DT(),uO(),VO=null,HO=null,UO=null,WO=!1,GO=new Map,KO=new Map,qO=new Set,JO=new Set,YO=null,XO=Ot(),ZO=null,QO=!1,$O={tengu_keybinding_customization_release:!0,tengu_streaming_tool_execution2:!0,tengu_kairos_cron:!0,tengu_amber_json_tools:!0,tengu_immediate_model_command:!0,tengu_basalt_3kr:!0,tengu_pebble_leaf_prune:!0,tengu_chair_sermon:!0,tengu_lodestone_enabled:!0,tengu_auto_background_agents:!0,tengu_fgts:!0,tengu_session_memory:!0,tengu_passport_quail:!0,tengu_moth_copse:!0,tengu_coral_fern:!0,tengu_chomp_inflection:!0,tengu_hive_evidence:!0,tengu_kairos_brief:!0,tengu_kairos_brief_config:{enable_slash_command:!0},tengu_sedge_lantern:!0,tengu_onyx_plover:{enabled:!0},tengu_willow_mode:`dialog`,tengu_turtle_carbon:!0,tengu_amber_stoat:!0,tengu_amber_flint:!0,tengu_slim_subagent_claudemd:!0,tengu_birch_trellis:!0,tengu_collage_kaleidoscope:!0,tengu_compact_cache_prefix:!0,tengu_kairos_assistant:!0,tengu_kairos_cron_durable:!0,tengu_attribution_header:!0,tengu_slate_prism:!0,tengu_review_bughunter_config:{enabled:!0},tengu_ccr_bundle_seed_enabled:!0},ek=p(()=>{if(!wO())return null;let e=EO(),t=Ed(),n=process.env.CLAUDE_GB_ADAPTER_URL||process.env.USER_TYPE===`ant`&&process.env.CLAUDE_CODE_GB_BASE_URL||`https://api.anthropic.com/`,r=!!(process.env.CLAUDE_GB_ADAPTER_URL&&process.env.CLAUDE_GB_ADAPTER_KEY);process.env.USER_TYPE===`ant`&&A(`GrowthBook: Creating client with clientKey=${t}, attributes: ${k(e)}`);let i=gf()||lt()||Mt()?hT():{headers:{},error:`trust not established`},a=r||!i.error;WO=a;let o=new sc({apiHost:n,clientKey:t,attributes:e,remoteEval:!r,...r?{}:{cacheKeyAttributes:[`id`,`organizationUUID`]},...i.error?{}:{apiHostRequestHeaders:i.headers},...process.env.USER_TYPE===`ant`?{log:(e,t)=>{A(`GrowthBook: ${e} ${k(t)}`)}}:{}});if(VO=o,!a)return{client:o,initialized:Promise.resolve()};let s=o.init({timeout:5e3}).then(async e=>{if(VO!==o){process.env.USER_TYPE===`ant`&&A(`GrowthBook: Skipping init callback for replaced client`);return}process.env.USER_TYPE===`ant`&&A(`GrowthBook initialized, source: ${e.source}, success: ${e.success}`);let t=await xO(o);if(VO===o){if(t){for(let e of qO)bO(e);qO.clear(),SO(),XO.emit()}if(process.env.USER_TYPE===`ant`){let e=o.getFeatures();if(e){let t=Object.keys(e);A(`GrowthBook loaded ${t.length} features: ${t.slice(0,10).join(`, `)}${t.length>10?`...`:``}`)}}}}).catch(e=>{process.env.USER_TYPE===`ant`&&I(kn(e))});return HO=()=>VO?.destroy(),UO=()=>VO?.destroy(),process.on(`beforeExit`,HO),process.on(`exit`,UO),{client:o,initialized:s}}),tk=p(async()=>{let e=ek();return!e||!WO&&(gf()||lt()||Mt())&&!hT().error&&(process.env.USER_TYPE===`ant`&&A(`GrowthBook: Auth became available after client creation, reinitializing`),FO(),e=ek(),!e)?null:(await e.initialized,LO(),e.client)}),nk=process.env.USER_TYPE===`ant`?1200*1e3:360*60*1e3,rk=null,ik=null}));function ok(){let e=process.env.CLAUDE_CODE_DISABLE_AUTO_MEMORY;if(g(e))return!1;if(ie(e))return!0;if(g(process.env.CLAUDE_CODE_SIMPLE)||g(process.env.CLAUDE_CODE_REMOTE)&&!process.env.CLAUDE_CODE_REMOTE_MEMORY_DIR)return!1;let t=z_();return t.autoMemoryEnabled===void 0?!0:t.autoMemoryEnabled}function sk(){return kO(`tengu_passport_quail`,!1)?!Mt()||kO(`tengu_slate_thimble`,!1):!1}function ck(){return process.env.CLAUDE_CODE_REMOTE_MEMORY_DIR?process.env.CLAUDE_CODE_REMOTE_MEMORY_DIR:ae()}function lk(e,t){if(!e)return;let n=e;if(t&&(n.startsWith(`~/`)||n.startsWith(`~\\`))){let e=n.slice(2),t=Ji(e||`.`);if(t===`.`||t===`..`)return;n=R(Vi(),e)}let r=Ji(n).replace(/[/\\]+$/,``);if(!(!qi(r)||r.length<3||/^[A-Za-z]:$/.test(r)||r.startsWith(`\\\\`)||r.startsWith(`//`)||r.includes(`\0`)))return(r+Zi).normalize(`NFC`)}function uk(){return lk(process.env.CLAUDE_COWORK_MEMORY_PATH_OVERRIDE,!1)}function dk(){return lk(U(`policySettings`)?.autoMemoryDirectory??U(`flagSettings`)?.autoMemoryDirectory??U(`localSettings`)?.autoMemoryDirectory??U(`userSettings`)?.autoMemoryDirectory,!0)}function fk(){return uk()!==void 0}function pk(){return Sr(xn())??xn()}function mk(){return R(vk(),_k)}function hk(e){return Ji(e).startsWith(vk())}var gk,_k,vk,yk=t((()=>{m(),O(),ak(),h(),wr(),$r(),Y_(),gk=`memory`,_k=`MEMORY.md`,vk=p(()=>(uk()??dk())||(R(R(ck(),`projects`),Zr(pk()),gk)+Zi).normalize(`NFC`),()=>xn())}));export{eD as $,O_ as $a,zd as $c,Py as $i,JS as $n,bh as $o,hx as $r,Sp as $s,Aw as $t,RO as A,Av as Aa,rp as Ac,ub as Ai,Xu as Al,uw as An,Zh as Ao,Kx as Ar,im as As,aT as At,WD as B,Q_ as Ba,cf as Bc,eb as Bi,Bl,pC as Bn,Vh as Bo,Yx as Br,Jp as Bs,Rw as Bt,tk as C,Bv as Ca,yf as Cc,zb as Ci,dd as Cl,JC as Cn,yg as Co,zx as Cr,_m as Cs,mT as Ct,FO as D,Iv as Da,np as Dc,Mb as Di,$u as Dl,XC as Dn,Yh as Do,jx as Dr,om as Ds,sT as Dt,IO as E,Uv as Ea,zf as Ec,Ub as Ei,id as El,Kw as En,ig as Eo,Fx as Er,fm as Es,lT as Et,ZD as F,wv as Fa,If as Fc,ib as Fi,Au as Fl,wC as Fn,tg as Fo,Qx as Fr,Wp as Fs,tw as Ft,yD as G,G_ as Ga,Yd as Gc,lb as Gi,VS as Gn,Mh as Go,wx as Gr,Up as Gs,Zw as Gt,dD as H,iv as Ha,uf as Hc,Yy as Hi,Zc as Hl,lC as Hn,jh as Ho,Jx as Hr,Bp as Hs,PC as Ht,$D as I,Cv as Ia,ff as Ic,qy as Ii,ku as Il,DC as In,ng as Io,kx as Ir,qp as Is,qC as It,FD as J,L_ as Ja,Hd as Jc,Hy as Ji,$S as Jn,Oh as Jo,Sx as Jr,Fp as Js,Z as Jt,hD as K,z_ as Ka,Ud as Kc,Uy as Ki,eC as Kn,Ih as Ko,Ex as Kr,Np as Ks,HC as Kt,tO as L,gv as La,df as Lc,Jy as Li,bu as Ll,_C as Ln,Rh as Lo,Wx as Lr,$p as Ls,QC as Lt,uO as M,Nv as Ma,Bf as Mc,pb as Mi,Wu as Ml,fw as Mn,$h as Mo,Ox as Mr,Qp as Ms,OC as Mt,eO as N,W as Na,Pf as Nc,fb as Ni,Mu as Nl,zw as Nn,eg as No,Ax as Nr,nm as Ns,VC as Nt,vO as O,Pv as Oa,Tf as Oc,jb as Oi,Qu as Ol,rw as On,Qh as Oo,eS as Or,sm as Os,dT as Ot,YD as P,Sv as Pa,V as Pc,ob as Pi,ju as Pl,TC as Pn,Xh as Po,rS as Pr,Yp as Ps,vw as Pt,iD as Q,U as Qa,Rd as Qc,jy as Qi,qS as Qn,Eh as Qo,px as Qr,Cp as Qs,Fw as Qt,KD as R,xv as Ra,pf as Rc,Qy as Ri,yu as Rl,CC as Rn,qh as Ro,$x as Rr,Xp as Rs,iw as Rt,ak as S,zv as Sa,H as Sc,bb as Si,fd as Sl,Mw as Sn,Og as So,Ix as Sr,vm as Ss,fT as St,PO as T,Kv as Ta,Vf as Tc,Vb as Ti,ad as Tl,aw as Tn,bg as To,Px as Tr,gm as Ts,gT as Tt,fD as U,ov as Ua,of as Uc,$y as Ui,aC as Un,Ph as Uo,Gx as Ur,Hp as Us,UC as Ut,HD as V,tv as Va,lf as Vc,nb as Vi,il as Vl,mC as Vn,Hh as Vo,Hx as Vr,Kp as Vs,MC as Vt,mD as W,$_ as Wa,af as Wc,cb as Wi,XS as Wn,Nh as Wo,Xx as Wr,Vp as Ws,KC as Wt,uD as X,j_ as Xa,ef as Xc,Ly as Xi,KS as Xn,kh as Xo,xx as Xr,Op as Xs,FC as Xt,cD as Y,N_ as Ya,Kd as Yc,Ry as Yi,tC as Yn,Dh as Yo,Cx as Yr,Dp as Ys,_w as Yt,sD as Z,A_ as Za,Gd as Zc,Iy as Zi,GS as Zn,Th as Zo,bx as Zr,Tp as Zs,Sw as Zt,kO as _,ry as _a,kf as _c,wb as _i,wd as _l,Pw as _n,r_ as _o,uS as _r,nh as _s,vT as _t,yk as a,fy as aa,yp as ac,Qb as ai,Id as al,bw as an,H_ as ao,ES as ar,vh as as,qE as at,_O as b,Hv as ba,Nf as bc,Ob as bi,yd as bl,Dw as bn,Eg as bo,Bx as br,th as bs,hT as bt,sk as c,my as ca,lp as cc,ux as ci,Qd as cl,AC as cn,K_ as co,DS as cr,gh as cs,fE as ct,jO as d,py as da,cp as dc,vb as di,Bd as dl,Y as dn,u_ as do,FS as dr,ym as ds,lE as dt,Dy as ea,bp as ec,ox as ei,sf as el,jw as en,V_ as eo,RS as er,xh as es,rD as et,yO as f,sy as fa,op as fc,xb as fi,Od as fl,Lw as fn,l_ as fo,xS as fr,oh as fs,aE as ft,BO as g,_y as ga,gf as gc,Db as gi,Td as gl,Tw as gn,o_ as go,aS as gr,Mm as gs,ET as gt,zO as h,oy as ha,Kf as hc,yb as hi,Ad as hl,ew as hn,d_ as ho,lS as hr,Gm as hs,TT as ht,fk as i,cy as ia,wp as ic,$b as ii,nf as il,ww as in,U_ as io,PS as ir,hh as is,QE as it,GD as j,G as ja,Ff as jc,db as ji,Gu as jl,cw as jn,ag as jo,Lx as jr,em as js,oT as jt,LO as k,Rv as ka,Uf as kc,Sb as ki,Zu as kl,Xw as kn,Jh as ko,Ux as kr,rm as ks,cT as kt,NO as l,hy as la,hp as lc,Nb as li,Xd as ll,RC as ln,P_ as lo,TS as lr,yh as ls,uE as lt,TO as m,uy as ma,ip as mc,_b as mi,jd as ml,Ow as mn,f_ as mo,gS as mr,dh as ms,ZT as mt,vk as n,yy as na,Ap as nc,nx as ni,Zd as nl,hw as nn,J_ as no,NS as nr,Sh as ns,tD as nt,hk as o,ly as oa,gp as oc,tx as oi,rf as ol,Q as on,Y_ as oo,wS as or,_h as os,UE as ot,gO as p,gy as pa,ap as pc,kb as pi,Md as pl,lw as pn,x_ as po,bS as pr,lh as ps,$T as pt,gD as q,w_ as qa,Vd as qc,Wy as qi,YS as qn,Ah as qo,Dx as qr,Mp as qs,jC as qt,ck as r,by as ra,Ep as rc,lx as ri,tf as rl,NC as rn,W_ as ro,AS as rr,wh as rs,$E as rt,ok as s,dy as sa,dp as sc,Jb as si,Ld as sl,xw as sn,E_ as so,OS as sr,mh as ss,JE as st,mk as t,Oy as ta,xp as tc,sx as ti,Jd as tl,X as tn,B_ as to,zS as tr,Ch as ts,oD as tt,MO as u,vy as ua,sp as uc,Cb as ui,qd as ul,BC as un,c_ as uo,SS as ur,ph as us,dE as ut,AO as v,iy as va,Lf as vc,qb as vi,Cd as vl,Cw as vn,Gg as vo,J as vr,Ym as vs,DT as vt,fO as w,ny as wa,Hf as wc,Rb as wi,ud as wl,ow as wn,vg as wo,Rx as wr,mm as ws,_T as wt,mO as x,qv as xa,Ef as xc,mb as xi,pd as xl,Ew as xn,Dg as xo,Vx as xr,fh as xs,pT as xt,OO as y,ay as ya,Rf as yc,hb as yi,bd as yl,kw as yn,Ug as yo,Mx as yr,eh as ys,yT as yt,JD as z,nv as za,mf as zc,tb as zi,zl,gC as zn,Lh as zo,tS as zr,Zp as zs,pw as zt};
|