claude-code-best 2.6.0 → 2.6.5

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.
Files changed (391) hide show
  1. package/dist/chunks/{AddWorkspaceDirectory-Cj5bvJgD.js → AddWorkspaceDirectory-BYyM_V0q.js} +1 -1
  2. package/dist/chunks/{App-2tgSv9lb.js → App-BboadKdn.js} +1 -1
  3. package/dist/chunks/{ApproveApiKey-DWa-XTLb.js → ApproveApiKey-BLp4742y.js} +1 -1
  4. package/dist/chunks/ApproveApiKey-DiEe4eui.js +1 -0
  5. package/dist/chunks/{AssistantSessionChooser-DF9eeJZS.js → AssistantSessionChooser-B88DM0Oq.js} +1 -1
  6. package/dist/chunks/{BackgroundTasksDialog-DXJdube9.js → BackgroundTasksDialog-ByraVuXh.js} +1 -1
  7. package/dist/chunks/{BypassPermissionsModeDialog-BOSW4Zdy.js → BypassPermissionsModeDialog-BDvmz12S.js} +1 -1
  8. package/dist/chunks/{ClaudeInChromeOnboarding-BW4XHmkw.js → ClaudeInChromeOnboarding-B6XNhFqq.js} +1 -1
  9. package/dist/chunks/ClaudeMdExternalIncludesDialog-B4ocUjev.js +1 -0
  10. package/dist/chunks/{ClaudeMdExternalIncludesDialog-Bz0JyaOG.js → ClaudeMdExternalIncludesDialog-BNhlq7_K.js} +1 -1
  11. package/dist/chunks/ConsoleOAuthFlow-BvaB9b0y.js +1 -0
  12. package/dist/chunks/{DesktopHandoff-CcsM_OAS.js → DesktopHandoff-S-w4bs5T.js} +1 -1
  13. package/dist/chunks/{DevChannelsDialog-DXRgY00D.js → DevChannelsDialog-BljR0X9X.js} +1 -1
  14. package/dist/chunks/{DiffDialog-PvNZfZby.js → DiffDialog-BhQ2QaLW.js} +1 -1
  15. package/dist/chunks/{Doctor-CE_jL9jC.js → Doctor-BXb0qv6n.js} +1 -1
  16. package/dist/chunks/Doctor-C5DYPEGl.js +1 -0
  17. package/dist/chunks/{ExitFlow-C4ybxKPn.js → ExitFlow-CSBDxw9H.js} +1 -1
  18. package/dist/chunks/{Feedback-B5rPGl_C.js → Feedback-DwHzc4UT.js} +1 -1
  19. package/dist/chunks/{Grove-CKVpREDU.js → Grove-DSXRnXKv.js} +1 -1
  20. package/dist/chunks/Grove-DnTo982-.js +1 -0
  21. package/dist/chunks/{HybridTransport-Byjvz-DL.js → HybridTransport-CuT3KI5e.js} +1 -1
  22. package/dist/chunks/{ITermBackend-Co9XpeS4.js → ITermBackend-mokGZVH_.js} +1 -1
  23. package/dist/chunks/{InvalidConfigDialog-CNsqbNU3.js → InvalidConfigDialog-Bi4RKYlk.js} +1 -1
  24. package/dist/chunks/{InvalidSettingsDialog-ClnZaN6b.js → InvalidSettingsDialog-0zKo4-so.js} +1 -1
  25. package/dist/chunks/{MCPConnectionManager-CDsa79pu.js → MCPConnectionManager-DYGoS1Ht.js} +1 -1
  26. package/dist/chunks/{McpParsingWarnings-DZkzoeZf.js → McpParsingWarnings-EzgsOoHw.js} +1 -1
  27. package/dist/chunks/{MessageSelector-CkeGQPNM.js → MessageSelector-DTmUuEKJ.js} +1 -1
  28. package/dist/chunks/{Messages-PfbzLYOU.js → Messages-DWiKTx5o.js} +2 -2
  29. package/dist/chunks/{Onboarding-BwoGQB4g.js → Onboarding-odmthwzz.js} +1 -1
  30. package/dist/chunks/{OverageCreditUpsell-Q5g2YjQw.js → OverageCreditUpsell-Cpk_5Lv0.js} +1 -1
  31. package/dist/chunks/{PluginSettings-B2ASJ0Rx.js → PluginSettings-eYcWehI8.js} +1 -1
  32. package/dist/chunks/{PromptInputFooterSuggestions-D4lMVCqj.js → PromptInputFooterSuggestions-DrrkNOuS.js} +1 -1
  33. package/dist/chunks/{PromptInputHelpMenu-BvLtS6an.js → PromptInputHelpMenu-DMsF4D6d.js} +1 -1
  34. package/dist/chunks/{QueryEngine-Av0G5fze.js → QueryEngine-C_KZts4y.js} +1 -1
  35. package/dist/chunks/REPL-C6YR0VKU.js +1 -0
  36. package/dist/chunks/{REPL-Dh8vzGmF.js → REPL-DzHz-LOY.js} +6 -6
  37. package/dist/chunks/{RemoteCallout-BV_hoz98.js → RemoteCallout-CnpCWRPk.js} +1 -1
  38. package/dist/chunks/{RemoteSessionManager-Cxoy1ud2.js → RemoteSessionManager-OWg_Yccq.js} +1 -1
  39. package/dist/chunks/{ResumeConversation-B3WuB8rs.js → ResumeConversation-BktSnsCm.js} +1 -1
  40. package/dist/chunks/{SSETransport-pIm26VJq.js → SSETransport-BpnapvlK.js} +1 -1
  41. package/dist/chunks/SearchExtraToolsTool-CqFD8vVS.js +1 -0
  42. package/dist/chunks/SentryErrorBoundary-BUirJRWU.js +1 -0
  43. package/dist/chunks/{SentryErrorBoundary-B6EWoJml.js → SentryErrorBoundary-C-NlfQZw.js} +1 -1
  44. package/dist/chunks/{Settings-CreAhCsb.js → Settings-vfFvcweR.js} +2 -2
  45. package/dist/chunks/{TeleportProgress-DPzGpyyM.js → TeleportProgress-CYXay2ZL.js} +1 -1
  46. package/dist/chunks/{TeleportRepoMismatchDialog-DqWQX6j8.js → TeleportRepoMismatchDialog-_zbZTvcJ.js} +1 -1
  47. package/dist/chunks/{TeleportResumeWrapper-DPSO0S49.js → TeleportResumeWrapper-DiHQeZIM.js} +1 -1
  48. package/dist/chunks/{ThemePicker-DueihHcy.js → ThemePicker-BRh027fA.js} +1 -1
  49. package/dist/chunks/{TmuxBackend-BNaZNAeP.js → TmuxBackend-BaX2U7iZ.js} +1 -1
  50. package/dist/chunks/{TrustDialog-CIzAlGn9.js → TrustDialog-CVbzrv6g.js} +1 -1
  51. package/dist/chunks/{ValidationErrorsList-1k1qbsRo.js → ValidationErrorsList-CdCUgfIl.js} +1 -1
  52. package/dist/chunks/{WelcomeV2-CR6TtXXM.js → WelcomeV2-DCXcYd2x.js} +1 -1
  53. package/dist/chunks/{WindowsTerminalBackend-C5SeTXqC.js → WindowsTerminalBackend-BE9NX5IH.js} +1 -1
  54. package/dist/chunks/{add-dir-DAMizKzF.js → add-dir-ldGd3Ppz.js} +1 -1
  55. package/dist/chunks/{agentDisplay-B9z7i8b_.js → agentDisplay-CVnAeURF.js} +1 -1
  56. package/dist/chunks/{agents-DCh_gEvJ.js → agents-C08NzRZx.js} +1 -1
  57. package/dist/chunks/{agents-D5u0p1UC.js → agents-DH5fmbVw.js} +1 -1
  58. package/dist/chunks/{ant-DRJq-cEg.js → ant-DJren1Aa.js} +1 -1
  59. package/dist/chunks/api-6tcwJlf_.js +1 -0
  60. package/dist/chunks/{api-B6URs6nc.js → api-CGOR_Xfl.js} +1 -1
  61. package/dist/chunks/{assistant-BRGDWkKB.js → assistant-BlzrMSkM.js} +1 -1
  62. package/dist/chunks/assistant-CwbhlCM-.js +1 -0
  63. package/dist/chunks/{assistant-tPxOUa-Z.js → assistant-aWkDcurV.js} +1 -1
  64. package/dist/chunks/{auth-CqURlg4d.js → auth-CSB2RDKF.js} +1 -1
  65. package/dist/chunks/auth-GxZhOvQ1.js +1 -0
  66. package/dist/chunks/{autoMode-DVt4K4I2.js → autoMode-CWvZs1jO.js} +1 -1
  67. package/dist/chunks/{autonomy-Ffv0QIyl.js → autonomy-BkVcSMCZ.js} +1 -1
  68. package/dist/chunks/{autonomy-BZzW8QJZ.js → autonomy-DK42aJYt.js} +1 -1
  69. package/dist/chunks/{autonomyPanel-MwuzDvv_.js → autonomyPanel-Cn4IhXgE.js} +1 -1
  70. package/dist/chunks/{backgroundHousekeeping-CYnAG60-.js → backgroundHousekeeping-BIZTAYho.js} +2 -2
  71. package/dist/chunks/backgroundHousekeeping-Csh58CxV.js +1 -0
  72. package/dist/chunks/{branch-DXefFdDE.js → branch-juox_fko.js} +1 -1
  73. package/dist/chunks/{bridge-qr4GQW_c.js → bridge-DudsCZkh.js} +2 -2
  74. package/dist/chunks/bridgeConfig-D4tpc568.js +1 -0
  75. package/dist/chunks/{bridgeConfig-CJ-KznTS.js → bridgeConfig-lRZfQqmA.js} +1 -1
  76. package/dist/chunks/bridgeEnabled-B8_c_Ppq.js +1 -0
  77. package/dist/chunks/{bridgeEnabled-5vsPrjuq.js → bridgeEnabled-D2IykaHE.js} +1 -1
  78. package/dist/chunks/{bridgeMain-BimZwc2P.js → bridgeMain-C5RDihlX.js} +6 -6
  79. package/dist/chunks/bridgeMain-D7_lg2iJ.js +1 -0
  80. package/dist/chunks/{bridgeMessaging-BiE0CTqq.js → bridgeMessaging-CqNURC4-.js} +1 -1
  81. package/dist/chunks/{btw-FpimqEqk.js → btw-DKlE3Dea.js} +1 -1
  82. package/dist/chunks/{buddy-BA3Cr067.js → buddy-DQYgHR63.js} +1 -1
  83. package/dist/chunks/{bypassPermissionsKillswitch-CSC9p8mO.js → bypassPermissionsKillswitch-Bof-UtM-.js} +1 -1
  84. package/dist/chunks/{caches-BUBkfP2Q.js → caches-B5QZDncQ.js} +2 -2
  85. package/dist/chunks/caches-dGk7xsDu.js +1 -0
  86. package/dist/chunks/{ccrClient-BOxUn9EJ.js → ccrClient-BaWg4E9-.js} +1 -1
  87. package/dist/chunks/changeDetector-DoLfg8a6.js +1 -0
  88. package/dist/chunks/{channelNotification-l3EXKDNB.js → channelNotification-B7A-9DIl.js} +1 -1
  89. package/dist/chunks/channelNotification-DDErroWn.js +1 -0
  90. package/dist/chunks/{chrome-BnKyWWQL.js → chrome-jMAks7-w.js} +1 -1
  91. package/dist/chunks/clear-OudnCGa7.js +1 -0
  92. package/dist/chunks/client-DxDmXXTh.js +1 -0
  93. package/dist/chunks/{color-D5MCzz9h.js → color-DG_R5-hl.js} +1 -1
  94. package/dist/chunks/commands-BWIOEBPs.js +1 -0
  95. package/dist/chunks/commitAttribution-BA4fcbHf.js +1 -0
  96. package/dist/chunks/{commitAttribution-BFshsh2H.js → commitAttribution-C22a3OCi.js} +1 -1
  97. package/dist/chunks/{compact-DWNaf1wR.js → compact-BWvnb4or.js} +1 -1
  98. package/dist/chunks/{companion-CyK_Dr1U.js → companion-Bkn2lSLj.js} +1 -1
  99. package/dist/chunks/{config-DNz6Eitr.js → config-BvpTbJ5p.js} +1 -1
  100. package/dist/chunks/{config-BdCuh6eA.js → config-D-dzD6n-.js} +1 -1
  101. package/dist/chunks/{context-BOjdTj0i.js → context-DzNahdyP.js} +1 -1
  102. package/dist/chunks/context-noninteractive-CM1-lUSe.js +1 -0
  103. package/dist/chunks/{context-noninteractive-k2ibficU.js → context-noninteractive-yiyJriiw.js} +1 -1
  104. package/dist/chunks/{conversation-Ci8O_eZ-.js → conversation-DKlz47xf.js} +1 -1
  105. package/dist/chunks/conversation-cUxdb8MN.js +1 -0
  106. package/dist/chunks/{copy-B0VUJ2rH.js → copy-9k9JPRqW.js} +1 -1
  107. package/dist/chunks/{createSSHSession-DqmkCS_k.js → createSSHSession-BZf-Loo5.js} +1 -1
  108. package/dist/chunks/createSession-BuJcoBAj.js +1 -0
  109. package/dist/chunks/{createSession-CJEsHz58.js → createSession-kiTHYXSL.js} +1 -1
  110. package/dist/chunks/{cronJitterConfig-BzPaa52I.js → cronJitterConfig-CYP7yrQu.js} +1 -1
  111. package/dist/chunks/{crossProjectResume-tWsqBUHc.js → crossProjectResume-BJisir9Z.js} +1 -1
  112. package/dist/chunks/{datadog-Bd1s_VFj.js → datadog-Bg-zL-i7.js} +1 -1
  113. package/dist/chunks/datadog-CVeFkaQu.js +1 -0
  114. package/dist/chunks/{desktop-BDowrzvG.js → desktop-DpaStjc-.js} +1 -1
  115. package/dist/chunks/{diff-auU5sUOw.js → diff-N_VSBo3Z.js} +1 -1
  116. package/dist/chunks/{doctor-bKPp6AeL.js → doctor-CUWjbh1X.js} +1 -1
  117. package/dist/chunks/{effort-BQj2QnnA.js → effort-loH1TUvE.js} +3 -3
  118. package/dist/chunks/{entry-CUu6-QhT.js → entry-D58E-E6Y.js} +1 -1
  119. package/dist/chunks/envLessBridgeConfig-CT8sdmFu.js +1 -0
  120. package/dist/chunks/{envLessBridgeConfig-Ju4W58xf.js → envLessBridgeConfig-SPEr9oqO.js} +1 -1
  121. package/dist/chunks/{exit-DijkO8eo.js → exit-D-tuPpbx.js} +1 -1
  122. package/dist/chunks/{export-DA-bBZkX.js → export-BIZ_SPXJ.js} +1 -1
  123. package/dist/chunks/{exportRenderer-3y4tGdSB.js → exportRenderer-CWPSMaqM.js} +1 -1
  124. package/dist/chunks/{extra-usage-CS6VwKJt.js → extra-usage-CCMwIa85.js} +1 -1
  125. package/dist/chunks/{extra-usage-core-DOgT4u4i.js → extra-usage-core-BNW4VT7o.js} +1 -1
  126. package/dist/chunks/{extra-usage-noninteractive-DYnfiRlV.js → extra-usage-noninteractive-B_WjXO1E.js} +1 -1
  127. package/dist/chunks/extra-usage-rdJ7ecEb.js +1 -0
  128. package/dist/chunks/{extraUsage-CfxgfpX_.js → extraUsage-CNMMTNJi.js} +1 -1
  129. package/dist/chunks/extractMemories-BrvZVsmM.js +1 -0
  130. package/dist/chunks/{fast-CzRUJBTK.js → fast-CG1v3fRr.js} +1 -1
  131. package/dist/chunks/fast-CLKKsx2H.js +1 -0
  132. package/dist/chunks/{feedback-FoXtdHAV.js → feedback-CG4mS_-B.js} +1 -1
  133. package/dist/chunks/{firstPartyEventLogger-KIwaBY-E.js → firstPartyEventLogger-Y_jAnHoR.js} +1 -1
  134. package/dist/chunks/{flushGate-C2Icy43G.js → flushGate-COPcye5f.js} +1 -1
  135. package/dist/chunks/gates-CSHuXnUx.js +1 -0
  136. package/dist/chunks/{gates-CbQLZHtm.js → gates-CSKxLmMJ.js} +1 -1
  137. package/dist/chunks/{gemini-BrNJGX4k.js → gemini-B3uSLiNp.js} +1 -1
  138. package/dist/chunks/{generateRecap-B0fvSCjo.js → generateRecap-D7rG3jIm.js} +1 -1
  139. package/dist/chunks/{generateSessionName-DvRYa39O.js → generateSessionName-zbqanivg.js} +1 -1
  140. package/dist/chunks/{githubRepoPathMapping-Dut3d6nn.js → githubRepoPathMapping-B04nEUDG.js} +1 -1
  141. package/dist/chunks/{grok-Ftoheab3.js → grok-CDOpos8E.js} +1 -1
  142. package/dist/chunks/{growthbook-BynnuVTn.js → growthbook-C_EY78Sn.js} +1 -1
  143. package/dist/chunks/{heapdump-hQ_w0LPC.js → heapdump-CpmhJ55b.js} +1 -1
  144. package/dist/chunks/{help-DQsHHv6r.js → help-EHn2neTv.js} +1 -1
  145. package/dist/chunks/hooks-BFdX17Za.js +1 -0
  146. package/dist/chunks/{hooks-BhVDc8yb.js → hooks-BV6HqbU4.js} +1 -1
  147. package/dist/chunks/{hostAdapter-D1eWmmhu.js → hostAdapter-_SmFAVNf.js} +1 -1
  148. package/dist/chunks/{ide-CPmMXLL-.js → ide-DkN0KdTR.js} +1 -1
  149. package/dist/chunks/inboundAttachments-BVUunfAX.js +1 -0
  150. package/dist/chunks/{inboundAttachments-Bmf6vYsE.js → inboundAttachments-DnGQw7Pf.js} +1 -1
  151. package/dist/chunks/{initReplBridge-BiHXpDEY.js → initReplBridge-tPRGPBq7.js} +1 -1
  152. package/dist/chunks/{insights-CTlTyvjj.js → insights-Bs9kJDG6.js} +1 -1
  153. package/dist/chunks/{install-IPuD3Lq8.js → install-CFX_ph9z.js} +1 -1
  154. package/dist/chunks/{install-github-app-Bmu_sA9e.js → install-github-app-CvRjY1Wi.js} +1 -1
  155. package/dist/chunks/{install-slack-app-Rfl81Jqo.js → install-slack-app-DjhnVSe0.js} +1 -1
  156. package/dist/chunks/{instrumentation-DWwmOmr0.js → instrumentation-c5zlOWom.js} +3 -3
  157. package/dist/chunks/{job-BXEt0izn.js → job-3QwLq609.js} +1 -1
  158. package/dist/chunks/{keybindings-DRDgVvqz.js → keybindings-7mDm3UKD.js} +1 -1
  159. package/dist/chunks/{lang-D3ZHlfT6.js → lang-DyyjY20G.js} +1 -1
  160. package/dist/chunks/{language-DcSjogBx.js → language-CPRGmY8Q.js} +1 -1
  161. package/dist/chunks/language-Cf6bMI4N.js +1 -0
  162. package/dist/chunks/{launchAgentsPlatform-BPm_VMln.js → launchAgentsPlatform-CpsMsTqQ.js} +1 -1
  163. package/dist/chunks/{launchAutofixPr-D2qac07g.js → launchAutofixPr-D9h6YAZY.js} +1 -1
  164. package/dist/chunks/{launchLocalMemory-D_hBbXKE.js → launchLocalMemory-DlYQcEQJ.js} +1 -1
  165. package/dist/chunks/{launchLocalVault-CPzNWvQ9.js → launchLocalVault-CP0AyPjj.js} +1 -1
  166. package/dist/chunks/{launchMemoryStores-Djq2KhKb.js → launchMemoryStores-BHoDFkJ5.js} +1 -1
  167. package/dist/chunks/{launchOnboarding-Bh6E7vdc.js → launchOnboarding-CFTNXcnc.js} +1 -1
  168. package/dist/chunks/{launchSchedule-C988bQ-5.js → launchSchedule-5KQr6x_A.js} +1 -1
  169. package/dist/chunks/{launchSkillStore-DqrP6Gme.js → launchSkillStore-D0yGuE68.js} +1 -1
  170. package/dist/chunks/{launchTeleport-DFhybaq_.js → launchTeleport-DRKnXOwY.js} +1 -1
  171. package/dist/chunks/{launchVault-p_CSK4ZQ.js → launchVault-XA-zAswX.js} +1 -1
  172. package/dist/chunks/loadAgentsDir-DCyiY0MN.js +1 -0
  173. package/dist/chunks/{loadAgentsDir-Ci5mr0vm.js → loadAgentsDir-DI1a76pd.js} +700 -700
  174. package/dist/chunks/{loadPluginHooks-xYCEZ6t5.js → loadPluginHooks-C0Ei-0E2.js} +1 -1
  175. package/dist/chunks/{localSearch-Vpn6W5aY.js → localSearch-CDOJNc_E.js} +1 -1
  176. package/dist/chunks/localSearch-MBx7KzC2.js +1 -0
  177. package/dist/chunks/login-D8UKKaud.js +1 -0
  178. package/dist/chunks/{login-D9IWjvza.js → login-nwTOoyxv.js} +1 -1
  179. package/dist/chunks/{logoV2Utils-SAulcC5x.js → logoV2Utils-DDUoPClc.js} +1 -1
  180. package/dist/chunks/logout-B0BjqlGi.js +1 -0
  181. package/dist/chunks/{magicDocs-BfoeYhin.js → magicDocs-CmUlOWjI.js} +1 -1
  182. package/dist/chunks/{main-DhMlhVj3.js → main-CeG_nUsC.js} +15 -15
  183. package/dist/chunks/{mappers-uIrAj-Wd.js → mappers-CJ8IO1o1.js} +1 -1
  184. package/dist/chunks/{mcp-DlM0OC6R.js → mcp-CanCqnch.js} +1 -1
  185. package/dist/chunks/{mcp-COQap0SM.js → mcp-Dq0kxZFx.js} +2 -2
  186. package/dist/chunks/{mcp-CAYGNxCb.js → mcp-zbxZM9BP.js} +1 -1
  187. package/dist/chunks/{mcpServer-DXvS3v4x.js → mcpServer-DPHQVYdC.js} +1 -1
  188. package/dist/chunks/{mcpServer-1SnOWb8_.js → mcpServer-lIneUZ5p.js} +1 -1
  189. package/dist/chunks/{memory-XccPLQLt.js → memory-BcWBkKV8.js} +1 -1
  190. package/dist/chunks/{model-CbiDGGJU.js → model-DJLzVvcF.js} +1 -1
  191. package/dist/chunks/model-H3rtl6eR.js +1 -0
  192. package/dist/chunks/{onChangeAppState-Dp0JIXd8.js → onChangeAppState-Dxbl8fvk.js} +1 -1
  193. package/dist/chunks/{openai-6KcHd4Hw.js → openai-DkYK4THc.js} +1 -1
  194. package/dist/chunks/{overageCreditGrant-DYiB4sr-.js → overageCreditGrant-DLKadMYU.js} +1 -1
  195. package/dist/chunks/{passes-Cbc6T_Tj.js → passes-BIfuerjL.js} +1 -1
  196. package/dist/chunks/{paths-Q2255dD7.js → paths-BBvuDQl9.js} +2 -2
  197. package/dist/chunks/{permissions-BLzPHh_3.js → permissions-S2EvIRKj.js} +1 -1
  198. package/dist/chunks/{pipeTransport-D7NIp3aA.js → pipeTransport-DVoIA1uN.js} +1 -1
  199. package/dist/chunks/{plan-DloFVJK7.js → plan--lnWxB3Q.js} +1 -1
  200. package/dist/chunks/{plugin-XR9IBPMM.js → plugin-DWLyrLw4.js} +1 -1
  201. package/dist/chunks/{pluginAutoupdate-Cr9hP0zG.js → pluginAutoupdate-CGXIWBrb.js} +1 -1
  202. package/dist/chunks/{pluginBlocklist-CM9uP8CY.js → pluginBlocklist-DJrMdzT0.js} +1 -1
  203. package/dist/chunks/{pluginCliCommands-BQkrvES5.js → pluginCliCommands-C08q9dHk.js} +1 -1
  204. package/dist/chunks/{pluginFlagging-CJ1--2Kw.js → pluginFlagging-Dggxke70.js} +1 -1
  205. package/dist/chunks/{pluginOperations-B0rLuSvo.js → pluginOperations-CNCImIe8.js} +1 -1
  206. package/dist/chunks/{pluginStartupCheck-Bjdc8zhz.js → pluginStartupCheck-BW2fjg2P.js} +1 -1
  207. package/dist/chunks/pluginStartupCheck-DpxQPXJE.js +1 -0
  208. package/dist/chunks/{plugins-BgOP_8TX.js → plugins-DQ3CRWWO.js} +1 -1
  209. package/dist/chunks/policyLimits-BotYrS-v.js +1 -0
  210. package/dist/chunks/{pollConfig-DhptuhFw.js → pollConfig-DAQ-ives.js} +1 -1
  211. package/dist/chunks/{poor-DF0aqXDx.js → poor-DqfrQT61.js} +1 -1
  212. package/dist/chunks/poorMode-DEAe3hiK.js +1 -0
  213. package/dist/chunks/{poorMode-C5Frra4j.js → poorMode-DzYT47KW.js} +1 -1
  214. package/dist/chunks/{print-CPtR0KTa.js → print-GGVp62vj.js} +4 -4
  215. package/dist/chunks/{privacy-settings-e-7lc7Un.js → privacy-settings-agwqjYJo.js} +1 -1
  216. package/dist/chunks/{processBashCommand-D5dC6Mya.js → processBashCommand-DHHN8Ca4.js} +1 -1
  217. package/dist/chunks/{processSlashCommand-DHRUtZ-C.js → processSlashCommand-COtIO6Jy.js} +1 -1
  218. package/dist/chunks/prompt-CO160cIr.js +1 -0
  219. package/dist/chunks/{prompt-DEPUnJdB.js → prompt-CjFAtm3w.js} +1 -1
  220. package/dist/chunks/prompt-GY9hlRvI.js +1 -0
  221. package/dist/chunks/{promptEditor-Ci-h04-5.js → promptEditor-EgosPsy-.js} +1 -1
  222. package/dist/chunks/{protocolHandler-DhqM32qE.js → protocolHandler-mtPUT9U0.js} +1 -1
  223. package/dist/chunks/{rate-limit-options-B0l29Zx8.js → rate-limit-options-C6SFOHue.js} +1 -1
  224. package/dist/chunks/{rcDebugLog-BbPkkigY.js → rcDebugLog-CPKZCtR8.js} +1 -1
  225. package/dist/chunks/{referral-ByevBJrE.js → referral-DeDr9zAE.js} +1 -1
  226. package/dist/chunks/{refresh-B_CwwIRX.js → refresh-D7pdoY_X.js} +1 -1
  227. package/dist/chunks/{registerProtocol-DzhaQH02.js → registerProtocol-BZBH8Zgl.js} +1 -1
  228. package/dist/chunks/{registry-DkHA4cRu.js → registry-Dz6AbiYP.js} +1 -1
  229. package/dist/chunks/{release-notes-CZthYkei.js → release-notes-DiUNOrg9.js} +1 -1
  230. package/dist/chunks/{releaseNotes-CwKpIsyd.js → releaseNotes-CnhQit0y.js} +2 -2
  231. package/dist/chunks/{reload-plugins-DxWfXvrN.js → reload-plugins-Dx52GcaG.js} +1 -1
  232. package/dist/chunks/{remote-env-BiRLWIrh.js → remote-env-B67Oo3sI.js} +1 -1
  233. package/dist/chunks/{remoteBridgeCore-nz1fPY1U.js → remoteBridgeCore-BzSUgPbt.js} +1 -1
  234. package/dist/chunks/{remoteControlServer-FzLUxh2B.js → remoteControlServer-L8smP7Zu.js} +1 -1
  235. package/dist/chunks/{rename-DmGuyncE.js → rename-C4PauyTZ.js} +1 -1
  236. package/dist/chunks/{resume-7GeU7RMS.js → resume-CrSn26xq.js} +1 -1
  237. package/dist/chunks/{runtimeObserver-OgM9ZYxZ.js → runtimeObserver-YNy3mIb7.js} +1 -1
  238. package/dist/chunks/{runtimeObserver-Duod-ign.js → runtimeObserver-nAhH4Wca.js} +2 -2
  239. package/dist/chunks/sandbox-adapter-CzwHes1i.js +1 -0
  240. package/dist/chunks/{sandbox-toggle-Cc96R6Ox.js → sandbox-toggle-BYqbcI5d.js} +1 -1
  241. package/dist/chunks/searchExtraTools-CcpdCO6l.js +1 -0
  242. package/dist/chunks/{sentry-BUHYuYGj.js → sentry-BNVxoVLS.js} +1 -1
  243. package/dist/chunks/{session-DgLqm7ZI.js → session-BuEmHrqM.js} +1 -1
  244. package/dist/chunks/{sessionDiscovery-DgNea6qa.js → sessionDiscovery-Mcsfa0g-.js} +1 -1
  245. package/dist/chunks/sessionFileAccessHooks-qnNiGMnE.js +1 -0
  246. package/dist/chunks/{sessionMemory-_dmj8lcH.js → sessionMemory-CMahwDdW.js} +1 -1
  247. package/dist/chunks/sessionMemory-pFSn4HSN.js +1 -0
  248. package/dist/chunks/sessionMemoryUtils-Du5jUl7M.js +1 -0
  249. package/dist/chunks/{sessionObserver-CuWMVPlT.js → sessionObserver-DG2zQgfi.js} +1 -1
  250. package/dist/chunks/sessionObserver-Je868MC9.js +1 -0
  251. package/dist/chunks/sessionStorage-D3FhAADV.js +1 -0
  252. package/dist/chunks/{sessionTitle-DzkMzHer.js → sessionTitle-zUVSAHO7.js} +1 -1
  253. package/dist/chunks/{sessionTracing-DTjmc0EF.js → sessionTracing-DoRJ4nSa.js} +1 -1
  254. package/dist/chunks/{settingsSync-CfYDkakY.js → settingsSync-B9bz77E1.js} +1 -1
  255. package/dist/chunks/{setup-BKUG46jQ.js → setup-B1JbPepL.js} +1 -1
  256. package/dist/chunks/{setup-CmLngvpJ.js → setup-CCOLlRtP.js} +1 -1
  257. package/dist/chunks/{setup-TqJ7-Nxh.js → setup-DWkSjA49.js} +2 -2
  258. package/dist/chunks/{shadowedRuleDetection-DesT0yKM.js → shadowedRuleDetection-BBR3uEgx.js} +1 -1
  259. package/dist/chunks/{sideQuestion-BAq0YyKY.js → sideQuestion-DHW5rgKz.js} +1 -1
  260. package/dist/chunks/{sink-B3uP8Cf8.js → sink-DxDOsLa2.js} +1 -1
  261. package/dist/chunks/sink-cQOgsnw3.js +1 -0
  262. package/dist/chunks/{sinks-COcy5GnB.js → sinks-BrrTUxkC.js} +2 -2
  263. package/dist/chunks/sinks-Djiz_5-Z.js +1 -0
  264. package/dist/chunks/{skill-learning-DOIMPtWE.js → skill-learning-C0nOKZfg.js} +1 -1
  265. package/dist/chunks/{skillChangeDetector-CA_Tdx8N.js → skillChangeDetector-D8C-uQSQ.js} +1 -1
  266. package/dist/chunks/{skillGapStore-CWuw1dYh.js → skillGapStore-Czi5jKjJ.js} +1 -1
  267. package/dist/chunks/{skillGapStore-DpEoKhn-.js → skillGapStore-_YuJP5KI.js} +2 -2
  268. package/dist/chunks/{skillGenerator-9y3Q4YoO.js → skillGenerator-kbaRbpqJ.js} +2 -2
  269. package/dist/chunks/skillLearning-3KWrBczS.js +1 -0
  270. package/dist/chunks/skillLearning-DBbdGbk-.js +1 -0
  271. package/dist/chunks/{skillPanel-Dt24mZTZ.js → skillPanel-BxDvlPzd.js} +3 -3
  272. package/dist/chunks/{skillSearchPanel-gaXN64Fu.js → skillSearchPanel-D-MX6Qgt.js} +2 -2
  273. package/dist/chunks/{skills-Dx3dMHYk.js → skills-NpEgFkFZ.js} +1 -1
  274. package/dist/chunks/{sprites-5OAB-Ui2.js → sprites-DD4eIkN7.js} +1 -1
  275. package/dist/chunks/{stats-TUExo9iU.js → stats-xL3NHwhp.js} +1 -1
  276. package/dist/chunks/{status-Dghaz1my.js → status-B5E70xRv.js} +1 -1
  277. package/dist/chunks/{statusNoticeHelpers-DVZSSXeK.js → statusNoticeHelpers-DcssRhLw.js} +1 -1
  278. package/dist/chunks/{tag-ZcVkzFjz.js → tag-BELr-qIa.js} +1 -1
  279. package/dist/chunks/{tasks-DbB33ekt.js → tasks-CrdWcSt-.js} +1 -1
  280. package/dist/chunks/{teamHelpers-BmN9nKz-.js → teamHelpers--3ZyNDlv.js} +1 -1
  281. package/dist/chunks/teamHelpers-CUAiXng3.js +1 -0
  282. package/dist/chunks/teammateModeSnapshot-C6EWhR0X.js +1 -0
  283. package/dist/chunks/{teammateModeSnapshot-CPjJJDL1.js → teammateModeSnapshot-DOQMTKbQ.js} +1 -1
  284. package/dist/chunks/{teleport-JHgpwZIh.js → teleport-LXFOan9C.js} +1 -1
  285. package/dist/chunks/{templateJobs-Db630FZD.js → templateJobs-8IY2Cgig.js} +1 -1
  286. package/dist/chunks/{terminalSetup-ygKHrVKR.js → terminalSetup-C4psrmpb.js} +1 -1
  287. package/dist/chunks/{terminalSetup-DJqWE8fc.js → terminalSetup-Lyg4NbGA.js} +1 -1
  288. package/dist/chunks/{theme-MmfFhdTD.js → theme-B8GNnJ_q.js} +1 -1
  289. package/dist/chunks/{thinkback-CrNirB0V.js → thinkback-DPXwEK3B.js} +1 -1
  290. package/dist/chunks/thinkback-DZW3Mcx_.js +1 -0
  291. package/dist/chunks/{thinkback-play-CQ1s7oqg.js → thinkback-play-BMOE-ceh.js} +1 -1
  292. package/dist/chunks/{toolEventObserver-DBq2XBYY.js → toolEventObserver-D0TSHm01.js} +1 -1
  293. package/dist/chunks/{toolEventObserver-BqMplcIk.js → toolEventObserver-DzLd0MSn.js} +1 -1
  294. package/dist/chunks/toolPool-DVOfpjDz.js +1 -0
  295. package/dist/chunks/{toolPool-BkCtTKXz.js → toolPool-Dq-Vtvrj.js} +1 -1
  296. package/dist/chunks/{trustedDevice-DEuQUTbz.js → trustedDevice-1iTu4LEm.js} +1 -1
  297. package/dist/chunks/{trustedDevice-C9Zevohz.js → trustedDevice-BvYYXfd8.js} +1 -1
  298. package/dist/chunks/{ultrareviewCommand-DrlfRrXq.js → ultrareviewCommand-BTXAN2wP.js} +1 -1
  299. package/dist/chunks/undercover-C_44e3oN.js +1 -0
  300. package/dist/chunks/{undercover-DKn95mh9.js → undercover-DvvnEmsX.js} +1 -1
  301. package/dist/chunks/{updateCCB-CJ7dCUan.js → updateCCB-C-qfLi0j.js} +1 -1
  302. package/dist/chunks/upgrade-CGXa5Dwy.js +1 -0
  303. package/dist/chunks/{upgrade-Degqbu8S.js → upgrade-DTBZSxwv.js} +1 -1
  304. package/dist/chunks/{upload-pTZQCPLt.js → upload-BF8tf_Eo.js} +1 -1
  305. package/dist/chunks/{usage-DVQMUMcC.js → usage-BRYRRgNt.js} +1 -1
  306. package/dist/chunks/{usage-D96a7Cke.js → usage-DvSTXEYY.js} +1 -1
  307. package/dist/chunks/{useMainLoopModel-B7ch2o9K.js → useMainLoopModel-CwvuTRXn.js} +1 -1
  308. package/dist/chunks/{useManagePlugins-BfGzHMvO.js → useManagePlugins-GmnI9K53.js} +1 -1
  309. package/dist/chunks/{useMergedTools-TemEvCrX.js → useMergedTools-Dah5KDMi.js} +1 -1
  310. package/dist/chunks/{useSearchInput-B-V4kIa-.js → useSearchInput-BV_azHiA.js} +1 -1
  311. package/dist/chunks/{useSettingsErrors-B2JGz1s8.js → useSettingsErrors-C-j_Zt7g.js} +1 -1
  312. package/dist/chunks/{useVoice-BuwYDm2U.js → useVoice-DR69NLxp.js} +1 -1
  313. package/dist/chunks/{util-CeIKZmj9.js → util-BpyJ4Bom.js} +1 -1
  314. package/dist/chunks/utils-CrZcpypC.js +1 -0
  315. package/dist/chunks/{validatePlugin-BlVho93x.js → validatePlugin-vptAYuYu.js} +1 -1
  316. package/dist/chunks/{vim-DUZQCWUP.js → vim-DvOw8dfR.js} +1 -1
  317. package/dist/chunks/{voice-BkRIHZiM.js → voice-B3BZs53f.js} +1 -1
  318. package/dist/chunks/{voiceModeEnabled-CPQUE3PU.js → voiceModeEnabled-DA76xN1Q.js} +1 -1
  319. package/dist/chunks/voiceModeEnabled-DIveLYGb.js +1 -0
  320. package/dist/chunks/{voiceStreamSTT-Dr_wH1Kh.js → voiceStreamSTT-_w1VjIOs.js} +1 -1
  321. package/dist/chunks/voiceStreamSTT-hpzWd_zl.js +1 -0
  322. package/dist/chunks/{workerRegistry-CT7_kjvY.js → workerRegistry-2_MZVih1.js} +1 -1
  323. package/dist/chunks/worktree-CCuDwRmS.js +1 -0
  324. package/dist/chunks/{xml-DD_ldd3X.js → xml-Dx--sNE1.js} +1 -1
  325. package/dist/cli.js +1 -1
  326. package/package.json +1 -1
  327. package/dist/chunks/ApproveApiKey-SIUwkD8j.js +0 -1
  328. package/dist/chunks/ClaudeMdExternalIncludesDialog-B8oAAHSI.js +0 -1
  329. package/dist/chunks/ConsoleOAuthFlow-DYhmGSkx.js +0 -1
  330. package/dist/chunks/Doctor--B1HUENo.js +0 -1
  331. package/dist/chunks/Grove-C2YjB3zL.js +0 -1
  332. package/dist/chunks/REPL-DCwqua0C.js +0 -1
  333. package/dist/chunks/SearchExtraToolsTool-D70C-cmA.js +0 -1
  334. package/dist/chunks/SentryErrorBoundary-oJUBarGg.js +0 -1
  335. package/dist/chunks/api-Dz_3z1kl.js +0 -1
  336. package/dist/chunks/assistant-zVegFdAO.js +0 -1
  337. package/dist/chunks/auth-D4isgfuK.js +0 -1
  338. package/dist/chunks/backgroundHousekeeping-DUmxC6h0.js +0 -1
  339. package/dist/chunks/bridgeConfig-CNbOKpAg.js +0 -1
  340. package/dist/chunks/bridgeEnabled-BUJTCUHY.js +0 -1
  341. package/dist/chunks/bridgeMain-DYL4fl6A.js +0 -1
  342. package/dist/chunks/caches-CTfNpKhW.js +0 -1
  343. package/dist/chunks/changeDetector-Y9KV5LgG.js +0 -1
  344. package/dist/chunks/channelNotification-CC7Xb06W.js +0 -1
  345. package/dist/chunks/clear-OUVFUt8Z.js +0 -1
  346. package/dist/chunks/client-B47ZvTMo.js +0 -1
  347. package/dist/chunks/commands-FJGWgQsa.js +0 -1
  348. package/dist/chunks/commitAttribution-DSv9FggK.js +0 -1
  349. package/dist/chunks/context-noninteractive-Bd2HO-vU.js +0 -1
  350. package/dist/chunks/conversation-BP0phkOY.js +0 -1
  351. package/dist/chunks/createSession-B9MhWusY.js +0 -1
  352. package/dist/chunks/datadog-DJowkWhh.js +0 -1
  353. package/dist/chunks/envLessBridgeConfig-CixkwbRF.js +0 -1
  354. package/dist/chunks/extra-usage-DGHEQOrY.js +0 -1
  355. package/dist/chunks/extractMemories-jvjCvtpC.js +0 -1
  356. package/dist/chunks/fast-Bbtx_Bs1.js +0 -1
  357. package/dist/chunks/gates-DSI3vpwO.js +0 -1
  358. package/dist/chunks/hooks-BLLL4iPv.js +0 -1
  359. package/dist/chunks/inboundAttachments-D-p91z3w.js +0 -1
  360. package/dist/chunks/language-B_-BfBT4.js +0 -1
  361. package/dist/chunks/loadAgentsDir-vB1QEZ7H.js +0 -1
  362. package/dist/chunks/localSearch-DtVqtfvk.js +0 -1
  363. package/dist/chunks/login-D-N78G6r.js +0 -1
  364. package/dist/chunks/logout-CFggVS-9.js +0 -1
  365. package/dist/chunks/model-DdbcxKub.js +0 -1
  366. package/dist/chunks/pluginStartupCheck-Cu2ezD51.js +0 -1
  367. package/dist/chunks/policyLimits-CKy_gTEt.js +0 -1
  368. package/dist/chunks/poorMode-DJvjO2nW.js +0 -1
  369. package/dist/chunks/prompt-CQC-mh6u.js +0 -1
  370. package/dist/chunks/prompt-DawxLANl.js +0 -1
  371. package/dist/chunks/sandbox-adapter-CxkhKgaa.js +0 -1
  372. package/dist/chunks/searchExtraTools-DQ6e601b.js +0 -1
  373. package/dist/chunks/sessionFileAccessHooks-7Svz-7S-.js +0 -1
  374. package/dist/chunks/sessionMemory-DIrR3zvb.js +0 -1
  375. package/dist/chunks/sessionMemoryUtils-BdQtSkRx.js +0 -1
  376. package/dist/chunks/sessionObserver-_adufOGQ.js +0 -1
  377. package/dist/chunks/sessionStorage-W7okgAlQ.js +0 -1
  378. package/dist/chunks/sink-CaWMZBw_.js +0 -1
  379. package/dist/chunks/sinks-oFfsKySL.js +0 -1
  380. package/dist/chunks/skillLearning-BhM09bQD.js +0 -1
  381. package/dist/chunks/skillLearning-_o2D06yM.js +0 -1
  382. package/dist/chunks/teamHelpers-yeTNtZbb.js +0 -1
  383. package/dist/chunks/teammateModeSnapshot-CsNIJTKi.js +0 -1
  384. package/dist/chunks/thinkback-Quc7KPmi.js +0 -1
  385. package/dist/chunks/toolPool-C7bOwJfR.js +0 -1
  386. package/dist/chunks/undercover-CBeHiWUd.js +0 -1
  387. package/dist/chunks/upgrade-ucJ-lnlY.js +0 -1
  388. package/dist/chunks/utils-CwhszpkT.js +0 -1
  389. package/dist/chunks/voiceModeEnabled-DB8GCzAF.js +0 -1
  390. package/dist/chunks/voiceStreamSTT-DgoDscHn.js +0 -1
  391. package/dist/chunks/worktree-DU3xtwKW.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 Gw();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 Gw();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=AC(),t=jC()!==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=jC();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 sw(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||!yw()?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 _w();let i=H();if(i.oauthAccount&&i.oauthAccount.billingType!==void 0&&i.oauthAccount.accountCreatedAt!==void 0&&i.oauthAccount.subscriptionCreatedAt!==void 0||!Y()||!yw())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`?OO(`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((()=>{ik()}));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=OO(`tengu_penguins_off`,null);if(e!==null)return A(`Fast mode unavailable: ${e}`),e;if(!Ar()&&OO(`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`+(Ux()?`[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=Jx(e??Lx());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=jC();if(!(Z()?.accessToken&&yw())&&!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&&yw()?{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 mw(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(),ik(),O(),hr(),Q(),jr(),rp(),M(),h(),nS(),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=zx(e);return n===J(gv.firstParty)?Jb(t.speed===`fast`):lx[n]||(Zb(e,n),lx[zx(Lx())]??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(),nS(),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)?Jx(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)?Jx(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=Jx(n).toLowerCase();if(r.includes(e))return!0}for(let e of r)if(!fx(e)&&dx(e)&&Jx(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(),nS(),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||Fx()}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?Rx():Jx(e)}function Mx(){return Nx()}function Nx(){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:G().opus47}function Px(){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:e===`firstParty`?G().sonnet46:G().sonnet45}function Fx(){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:G().haiku45}function Ix(e){let{permissionMode:t,mainLoopModel:n,exceeds200kTokens:r=!1}=e;return Ax()===`opusplan`&&t===`plan`&&!r?Nx():Ax()===`haiku`&&t===`plan`?Px():n}function Lx(){return process.env.USER_TYPE===`ant`?ub()?.defaultModel??Nx()+`[1m]`:ww()||Ew()?Nx()+(Ux()?`[1m]`:``):Px()}function Rx(){return Jx(Lx())}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 zx(e){return J(Ov(e))}function Bx(e=!1){return ww()||Ew()?Ux()?`Opus 4.7 with 1M context · Most capable for complex work${e?Hx(!0):``}`:`Opus 4.7 · Most capable for complex work${e?Hx(!0):``}`:`Sonnet 4.6 · Best for everyday tasks`}function Vx(e){return e===`opusplan`?`Opus 4.7 in plan mode, else Sonnet 4.6`:qx(Jx(e))}function Hx(e){if(W()!==`firstParty`)return``;let t=tx(Jb(e));return` ·${e?` (↯)`:``} ${t}`}function Ux(){return!(bS()||Ow()||W()!==`firstParty`||!Cv()||Y()&&X()===null)}function Wx(e){return e===`opusplan`?`Opus Plan`:dx(e)?Yh(e):qx(e)}function Gx(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 Kx(e){let[t=``,...n]=e.split(`-`);return[t.slice(0,3)+`*`.repeat(Math.max(0,t.length-3)),...n].join(`-`)}function qx(e){let t=Gx(e);if(t)return t;if(process.env.USER_TYPE===`ant`){let t=Jx(e),n=fb(e);return n?Kx(n.model.replace(/\[1m\]$/i,``))+(xS(t)?`[1m]`:``):t===e?t:`${e} (${t})`}return e}function Jx(e){let t=e.trim(),n=t.toLowerCase(),r=xS(n),i=r?n.replace(/\[1m]$/i,``).trim():n;if(dx(i))switch(i){case`opusplan`:return Px()+(r?`[1m]`:``);case`sonnet`:return Px()+(r?`[1m]`:``);case`haiku`:return Fx()+(r?`[1m]`:``);case`opus`:return Nx()+(r?`[1m]`:``);case`best`:return Mx();default:}if(W()===`firstParty`&&Xx(i)&&Zx())return Nx()+(r?`[1m]`:``);if(process.env.USER_TYPE===`ant`){let e=xS(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 Yx(e,t){return xS(e)||!xS(t)?e:SS(Jx(e))?e+`[1m]`:e}function Xx(e){return tS.includes(e)}function Zx(){return!g(process.env.CLAUDE_CODE_DISABLE_LEGACY_MODEL_REMAP)}function Qx(e){if(e===null)return process.env.USER_TYPE===`ant`?`Default for Ants (${Vx(Lx())})`:Y()?`Default (${Bx()})`:`Default (${Rx()})`;let t=Jx(e);return e===t?t:`${e} (${t})`}function $x(e){if(W()===`foundry`)return;let t=e.toLowerCase().includes(`[1m]`),n=zx(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 eS(e){return e.replace(/\[(1|2)m\]/gi,``)}var tS,nS=t((()=>{O(),pb(),Q(),PS(),h(),Nv(),ux(),Y_(),wv(),Up(),xx(),hx(),ag(),Dx(),tS=[`claude-opus-4-20250514`,`claude-opus-4-1-20250805`,`claude-opus-4-0`,`claude-opus-4-1`]}));function rS(){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 iS({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=oS(),u={"x-app":`cli`,"User-Agent":dT(),"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 _w(),A(`[API:auth] OAuth token check complete`),Y()||await aS(u,Mt());let d=sS(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:rS()}};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 Gw();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:rS()}})}if(g(process.env.CLAUDE_CODE_USE_VERTEX)){g(process.env.CLAUDE_CODE_SKIP_VERTEX_AUTH)||await Yw();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:rS()}})}return new se({apiKey:Y()?null:e||jC(),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:rS()}})}async function aS(e,t){let n=process.env.ANTHROPIC_AUTH_TOKEN||await HC(t);n&&(e.Authorization=`Bearer ${n}`)}function oS(){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 sS(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(cS,sa());try{let n=e instanceof Request?e.url:String(e),r=a.get(cS);A(`[API REQUEST] ${new URL(n).pathname}${r?` ${cS}=${r}`:``} source=${t??`unknown`}`)}catch{}return n(e,{...i,headers:a})}}var cS,lS=t((()=>{vr(),Q(),gT(),nS(),wv(),Pi(),O(),kr(),M(),h(),cS=`x-client-request-id`}));function uS(){return R(ae(),`cache`)}function dS(){return R(uS(),`model-capabilities.json`)}function fS(){return!(W()!==`firstParty`||!Cv())}function pS(e){return[...e].sort((e,t)=>t.id.length-e.id.length||e.id.localeCompare(t.id))}function mS(e){if(!fS())return;let t=vS(dS());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 hS(){if(fS()&&!Br())try{let e=await iS({maxRetries:1}),t=Y()?[Dr]:void 0,n=[];for await(let r of e.models.list({betas:t})){let e=gS().safeParse(r);e.success&&n.push(e.data)}if(n.length===0)return;let r=dS(),i=pS(n);if(ku(vS(r),i)){A(`[modelCapabilities] cache unchanged, skipping write`);return}await la(uS(),{recursive:!0}),await ha(r,k({models:i,timestamp:Date.now()}),{encoding:`utf-8`,mode:384}),vS.cache.delete(r),A(`[modelCapabilities] cached ${i.length} models`)}catch(e){A(`[modelCapabilities] fetch failed: ${e instanceof Error?e.message:`unknown`}`)}}var gS,_S,vS,yS=t((()=>{Au(),m(),Je(),kr(),lS(),Q(),M(),h(),di(),Ei(),zr(),ur(),wv(),gS=L(()=>D({id:b(),max_input_tokens:y().optional(),max_tokens:y().optional()}).strip()),_S=L(()=>D({models:S(gS()),timestamp:y()})),vS=p(e=>{try{let t=ta(e,`utf-8`),n=_S().safeParse(fi(t,!1));return n.success?n.data.models:null}catch{return null}},e=>e)}));function bS(){return g(process.env.CLAUDE_CODE_DISABLE_1M_CONTEXT)}function xS(e){return bS()?!1:/\[1m\]/i.test(e)}function SS(e){if(bS())return!1;let t=zx(e);return t.includes(`claude-sonnet-4`)||t.includes(`opus-4-6`)||t.includes(`opus-4-7`)}function CS(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(xS(e))return 1e6;let n=mS(e);if(n?.max_input_tokens&&n.max_input_tokens>=1e5)return n.max_input_tokens>2e5&&bS()?OS:n.max_input_tokens;if(t?.includes(`context-1m-2025-08-07`)&&SS(e)||wS(e))return 1e6;if(process.env.USER_TYPE===`ant`){let t=fb(e);if(t?.contextWindow)return t.contextWindow}return OS}function wS(e){return bS()||xS(e)||!zx(e).includes(`sonnet-4-6`)?!1:H().clientDataCache?.coral_reef_sonnet===`true`}function TS(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 ES(e){let t,n;if(process.env.USER_TYPE===`ant`){let r=fb(e.toLowerCase());if(r)return t=r.defaultMaxTokens??AS,n=r.upperMaxTokensLimit??jS,{default:t,upperLimit:n}}let r=zx(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=AS,n=jS);let i=mS(e);return i?.max_tokens&&i.max_tokens>=4096&&(n=i.max_tokens,t=Math.min(t,n)),{default:t,upperLimit:n}}function DS(e){return ES(e).upperLimit-1}var OS,kS,AS,jS,MS,NS,PS=t((()=>{lb(),rp(),h(),nS(),pb(),yS(),OS=2e5,kS=2e4,AS=32e3,jS=64e3,MS=8e3,NS=64e3})),FS,IS,LS,RS=t((()=>{m(),wv(),FS=[{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`}],IS=[{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`}],LS=p((e,t)=>{if(W()===`firstParty`)return;let n=e.toLowerCase(),r=W()===`openai`?IS:FS;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 zS(e){let t=[],n=[];for(let r of e)XS.includes(r)?t.push(r):n.push(r);return{allowed:t,disallowed:n}}function BS(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}=zS(e);for(let e of n)console.warn(`Warning: Beta header '${e}' is not allowed. Only the following betas are supported: ${XS.join(`, `)}`);return t.length>0?t:void 0}function VS(e){let t=LS(e,`interleaved_thinking`);if(t!==void 0)return t;let n=zx(e),r=W();return r===`foundry`?!0:r===`firstParty`?!n.includes(`claude-3-`):n.includes(`claude-opus-4`)||n.includes(`claude-sonnet-4`)}function HS(e){let t=zx(e);return t.includes(`claude-opus-4`)||t.includes(`claude-sonnet-4`)||t.includes(`claude-haiku-4`)}function US(e){let t=zx(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 WS(e){let t=zx(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 GS(e){return!0}function KS(){return(W()===`firstParty`||W()===`foundry`)&&!g(process.env.CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS)&&Cv()}function qS(){return W()===`firstParty`&&!g(process.env.CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS)}function JS(e,t){let n=[...QS(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 YS(){ZS.cache?.clear?.(),QS.cache?.clear?.(),$S.cache?.clear?.()}var XS,ZS,QS,$S,eC=t((()=>{m(),ik(),O(),lb(),kr(),Q(),PS(),h(),nS(),RS(),wv(),Y_(),XS=[qy],ZS=p(e=>{let t=[],n=zx(e).includes(`haiku`),r=W(),i=KS();n||(t.push(Gy),process.env.USER_TYPE===`ant`&&process.env.CLAUDE_CODE_ENTRYPOINT===`cli`&&ab&&t.push(ab)),Y()&&t.push(Dr),xS(e)&&t.push(qy),!g(process.env.DISABLE_INTERLEAVED_THINKING)&&VS(e)&&t.push(Ky),i&&VS(e)&&!Mt()&&z_().showThinkingSummaries!==!0&&t.push(nb);let a=g(process.env.USE_API_CONTEXT_MANAGEMENT)||US(e),o=US(e);KS()&&(a||o)&&t.push(Jy);let s=AO(`tengu_tool_pear`),c=!s&&OO(`tengu_amber_json_tools`,!1);return i&&WS(e)&&s&&t.push(Yy),process.env.USER_TYPE===`ant`&&i&&c&&t.push(rb),r===`vertex`&&HS(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}),QS=p(e=>{let t=ZS(e);return W()===`bedrock`?t.filter(e=>!sb.has(e)):t}),$S=p(e=>ZS(e).filter(e=>sb.has(e)))}));function tC(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 nC=t((()=>{}));async function rC(){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 iC(){if(sC!==void 0)return sC;if(process.platform!==`darwin`)return sC=!1,!1;try{sC=Mr(`security`,[`show-keychain-info`],{reject:!1,stdio:[`ignore`,`pipe`,`pipe`]}).exitCode===36}catch{sC=!1}return sC}var aC,oC,sC,cC=t((()=>{Nr(),M(),ii(),ti(),ur(),Py(),aC=4032,oC={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=rC().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<=aC?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 lC(){let e=ae();return{storageDir:e,storagePath:R(e,`.credentials.json`)}}var uC,dC=t((()=>{h(),In(),Jn(),ur(),uC={name:`plaintext`,read(){let{storagePath:e}=lC();try{return Pn(j().readFileSync(e,{encoding:`utf8`}))}catch{return null}},async readAsync(){let{storagePath:e}=lC();try{return Pn(await j().readFile(e,{encoding:`utf8`}))}catch{return null}},update(e){try{let{storageDir:t,storagePath:n}=lC();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}=lC();try{return j().unlinkSync(e),!0}catch(e){return Mn(e)===`ENOENT`}}}}));function fC(){return process.platform===`darwin`?tC(oC,uC):uC}var pC=t((()=>{nC(),cC(),dC()}));function mC(e){return new Promise(t=>{_a(`security`,[`find-generic-password`,`-a`,Ay(),`-w`,`-s`,e],{encoding:`utf-8`,timeout:yC},(e,n)=>{t({stdout:e?null:n?.trim()||null,timedOut:!!(e&&`killed`in e&&e.killed)})})})}function hC(){if(process.platform!==`darwin`||xC||ne())return;let e=mC(ky(Ny)),t=mC(ky());xC=Promise.all([e,t]).then(([e,t])=>{e.timedOut||My(e.stdout),t.timedOut||(bC={stdout:t.stdout})})}async function gC(){xC&&await xC}function _C(){return bC}function vC(){bC=null}var yC,bC,xC,SC=t((()=>{h(),Py(),yC=1e4,bC=null,xC=null}));function CC(){return TC}function wC(){TC.clear()}var TC,EC=t((()=>{TC=new Map})),DC=r({calculateApiKeyHelperTTL:()=>BC,checkAndRefreshOAuthTokenIfNeeded:()=>_w,checkGcpCredentialsValid:()=>ew,clearApiKeyHelperCache:()=>KC,clearAwsCredentialsCache:()=>ZC,clearGcpCredentialsCache:()=>rw,clearOAuthTokenCache:()=>fw,getAccountInformation:()=>Lw,getAnthropicApiKey:()=>jC,getAnthropicApiKeyWithSource:()=>NC,getApiKeyFromApiKeyHelper:()=>HC,getApiKeyFromApiKeyHelperCached:()=>GC,getApiKeyFromConfigOrMacOSKeychain:()=>Xw,getApiKeyHelperElapsedMs:()=>VC,getAuthTokenSource:()=>AC,getClaudeAIOAuthTokens:()=>Z,getClaudeAIOAuthTokensAsync:()=>gw,getConfiguredApiKeyHelper:()=>PC,getOauthAccountInfo:()=>xw,getOtelHeadersFromHelper:()=>Pw,getRateLimitTier:()=>kw,getSubscriptionName:()=>Aw,getSubscriptionType:()=>X,handleOAuth401Error:()=>mw,hasAnthropicApiKeyAuth:()=>MC,hasOpusAccess:()=>Cw,hasProfileScope:()=>yw,is1PApiCustomer:()=>bw,isAnthropicAuthEnabled:()=>kC,isAwsAuthRefreshFromProjectSettings:()=>LC,isAwsCredentialExportFromProjectSettings:()=>zC,isClaudeAISubscriber:()=>Y,isConsumerSubscriber:()=>Iw,isCustomApiKeyApproved:()=>cw,isEnterpriseSubscriber:()=>Dw,isGcpAuthRefreshFromProjectSettings:()=>$C,isMaxSubscriber:()=>ww,isOtelHeadersHelperFromProjectOrLocalSettings:()=>Nw,isOverageProvisioningAllowed:()=>Sw,isProSubscriber:()=>Ow,isTeamPremiumSubscriber:()=>Ew,isTeamSubscriber:()=>Tw,isUsing3PServices:()=>jw,prefetchApiKeyFromApiKeyHelperIfSafe:()=>qC,prefetchAwsCredentialsAndBedRockInfoIfSafe:()=>aw,prefetchGcpCredentialsIfSafe:()=>iw,refreshAndGetAwsCredentials:()=>Gw,refreshAwsAuth:()=>YC,refreshGcpAuth:()=>nw,refreshGcpCredentialsIfNeeded:()=>Yw,removeApiKey:()=>lw,saveApiKey:()=>sw,saveOAuthTokensIfNeeded:()=>dw,validateForceLoginOrg:()=>Rw});function OC(){return g(process.env.CLAUDE_CODE_REMOTE)||process.env.CLAUDE_CODE_ENTRYPOINT===`claude-desktop`}function kC(){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}=NC({skipRetrievingKeyFromApiKeyHelper:!0}),a=i===`ANTHROPIC_API_KEY`||i===`apiKeyHelper`;return!(t||r&&!OC()||a&&!OC())}function AC(){if(ne())return PC()?{source:`apiKeyHelper`,hasToken:!0}:{source:`none`,hasToken:!1};if(process.env.ANTHROPIC_AUTH_TOKEN&&!OC())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(PC()&&!OC())return{source:`apiKeyHelper`,hasToken:!0};let e=Z();return oy(e?.scopes)&&e?.accessToken?{source:`claude.ai`,hasToken:!0}:{source:`none`,hasToken:!1}}function jC(){let{key:e}=NC();return e}function MC(){let{key:e,source:t}=NC({skipRetrievingKeyFromApiKeyHelper:!0});return e!==null&&t!==`none`}function NC(e={}){if(ne())return process.env.ANTHROPIC_API_KEY?{key:process.env.ANTHROPIC_API_KEY,source:`ANTHROPIC_API_KEY`}:PC()?{key:e.skipRetrievingKeyFromApiKeyHelper?null:GC(),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`}:PC()?e.skipRetrievingKeyFromApiKeyHelper?{key:null,source:`apiKeyHelper`}:{key:GC(),source:`apiKeyHelper`}:Xw()||{key:null,source:`none`}}function PC(){return ne()?U(`flagSettings`)?.apiKeyHelper:(J_()||{}).apiKeyHelper}function FC(){let e=PC();if(!e)return!1;let t=U(`projectSettings`),n=U(`localSettings`);return t?.apiKeyHelper===e||n?.apiKeyHelper===e}function IC(){return(J_()||{}).awsAuthRefresh}function LC(){let e=IC();if(!e)return!1;let t=U(`projectSettings`),n=U(`localSettings`);return t?.awsAuthRefresh===e||n?.awsAuthRefresh===e}function RC(){return(J_()||{}).awsCredentialExport}function zC(){let e=RC();if(!e)return!1;let t=U(`projectSettings`),n=U(`localSettings`);return t?.awsCredentialExport===e||n?.awsCredentialExport===e}function BC(){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 zw}function VC(){let e=Vw?.startedAt;return e?Date.now()-e:0}async function HC(e){if(!PC())return null;let t=BC();return Bw?(Date.now()-Bw.timestamp<t||Vw||(Vw={promise:UC(e,!1,Hw),startedAt:null}),Bw.value):(Vw||(Vw={promise:UC(e,!0,Hw),startedAt:Date.now()}),Vw.promise)}async function UC(e,t,n){try{let t=await WC(e);return n===Hw&&t!==null&&(Bw={value:t,timestamp:Date.now()}),t}catch(e){if(n!==Hw)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&&Bw&&Bw.value!==` `?(Bw={...Bw,timestamp:Date.now()},Bw.value):(Bw={value:` `,timestamp:Date.now()},` `)}finally{n===Hw&&(Vw=null)}}async function WC(e){let t=PC();if(!t)return null;if(FC()&&!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 GC(){return Bw?.value??null}function KC(){Hw++,Bw=null,Vw=null}function qC(e){FC()&&!gf()||HC(e)}async function JC(){let e=IC();if(!e)return!1;if(LC()&&!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 YC(e)}}function YC(e){A(`Running AWS auth refresh command`);let t=Uy.getInstance();return t.startAuthentication(),new Promise(n=>{let r=ga(e,{timeout:Ww});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 XC(){let e=RC();if(!e)return null;if(zC()&&!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 ZC(){Gw.cache.clear()}function QC(){return(J_()||{}).gcpAuthRefresh}function $C(){let e=QC();if(!e)return!1;let t=U(`projectSettings`),n=U(`localSettings`);return t?.gcpAuthRefresh===e||n?.gcpAuthRefresh===e}async function ew(){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(Kw).then(()=>{throw new rT(`GCP credentials check timed out`)});return await Promise.race([r,i]),!0}catch{return!1}}async function tw(){let e=QC();if(!e)return!1;if($C()&&!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 ew())return A(`GCP credentials are valid, skipping auth refresh command`),!1}catch{}return nw(e)}function nw(e){A(`Running GCP auth refresh command`);let t=Uy.getInstance();return t.startAuthentication(),new Promise(n=>{let r=ga(e,{timeout:Jw});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 rw(){Yw.cache.clear()}function iw(){QC()&&($C()&&!gf()&&!Mt()||Yw())}function aw(){let e=IC(),t=RC();!e&&!t||(LC()||zC())&&!gf()&&!Mt()||(Gw(),G())}function ow(e){return/^[a-zA-Z0-9-_]+$/.test(e)}async function sw(e){if(!ow(e))throw Error(`Invalid API key format. API key must contain only alphanumeric characters, dashes, and underscores.`);await uw();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??[]}}}),Xw.cache.clear?.(),vC()}function cw(e){let t=H(),n=Iy(e);return t.customApiKeyResponses?.approved?.includes(n)??!1}async function lw(){await uw(),V(e=>({...e,primaryApiKey:void 0})),Xw.cache.clear?.(),vC()}async function uw(){try{await Fy()}catch(e){I(e)}}function dw(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=fC(),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?.(),YS(),wC(),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 fw(){Z.cache?.clear?.(),jy()}async function pw(){try{let{mtimeMs:e}=await pa(R(ae(),`.credentials.json`));e!==Zw&&(Zw=e,fw())}catch{Z.cache?.clear?.()}}function mw(e){let t=Qw.get(e);if(t)return t;let n=hw(e).finally(()=>{Qw.delete(e)});return Qw.set(e,n),n}async function hw(e){fw();let t=await gw();return t?.refreshToken?t.accessToken===e?_w(0,!0):(N(`tengu_oauth_401_recovered_from_keychain`,{}),!0):!1}async function gw(){if(ne())return null;if(process.env.CLAUDE_CODE_OAUTH_TOKEN||Sy())return Z();try{let e=(await fC().readAsync())?.claudeAiOauth;return e?.accessToken?e:null}catch(e){return I(e),null}}function _w(e=0,t=!1){return e===0&&!t?$w||($w=vw(e,t).finally(()=>{$w=null}),$w):vw(e,t)}async function vw(e,t){await pw();let n=Z();if(!t&&(!n?.refreshToken||!py(n.expiresAt))||!n?.refreshToken||!oy(n.scopes))return!1;Z.cache?.clear?.(),jy();let r=await gw();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),vw(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 gw();return!e?.refreshToken||!py(e.expiresAt)?(N(`tengu_oauth_token_refresh_race_resolved`,{}),!1):(N(`tengu_oauth_token_refresh_starting`,{}),dw(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 gw();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 kC()?oy(Z()?.scopes):!1}function yw(){return Z()?.scopes?.includes(`user:profile`)??!1}function bw(){return!(g(process.env.CLAUDE_CODE_USE_BEDROCK)||g(process.env.CLAUDE_CODE_USE_VERTEX)||g(process.env.CLAUDE_CODE_USE_FOUNDRY)||Y())}function xw(){return kC()?H().oauthAccount:void 0}function Sw(){let e=xw()?.billingType;return!(!Y()||!e||e!==`stripe_subscription`&&e!==`stripe_subscription_contracted`&&e!==`apple_subscription`&&e!==`google_play_subscription`)}function Cw(){let e=X();return e===`max`||e===`enterprise`||e===`team`||e===`pro`||e===null}function X(){if(Gv())return Wv();if(!kC())return null;let e=Z();return e?e.subscriptionType??null:null}function ww(){return X()===`max`}function Tw(){return X()===`team`}function Ew(){return X()===`team`&&kw()===`default_claude_max_5x`}function Dw(){return X()===`enterprise`}function Ow(){return X()===`pro`}function kw(){if(!kC())return null;let e=Z();return e?e.rateLimitTier??null:null}function Aw(){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 jw(){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 Mw(){return(J_()||{}).otelHeadersHelper}function Nw(){let e=Mw();if(!e)return!1;let t=U(`projectSettings`),n=U(`localSettings`);return t?.otelHeadersHelper===e||n?.otelHeadersHelper===e}function Pw(){let e=Mw();if(!e)return{};let t=parseInt(process.env.CLAUDE_CODE_OTEL_HEADERS_HELPER_DEBOUNCE_MS||nT.toString(),10);if(eT&&Date.now()-tT<t)return eT;if(Nw()&&!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 eT=n,tT=Date.now(),eT}catch(e){throw I(Error(`Error getting OpenTelemetry headers from otelHeadersHelper (in settings): ${An(e)}`)),e}}function Fw(e){return e===`max`||e===`pro`}function Iw(){let e=X();return Y()&&e!==null&&Fw(e)}function Lw(){if(W()!==`firstParty`)return;let{source:e}=AC(),t={};e===`CLAUDE_CODE_OAUTH_TOKEN`||e===`CLAUDE_CODE_OAUTH_TOKEN_FILE_DESCRIPTOR`?t.tokenSource=e:Y()?t.subscription=Aw():t.tokenSource=e;let{key:n,source:r}=NC();if(n&&(t.apiKeySource=r),e===`claude.ai`||r===`/login managed key`){let e=xw()?.organizationName;e&&(t.organization=e)}let i=xw()?.emailAddress;return(e===`claude.ai`||r===`/login managed key`)&&i&&(t.email=i),t}async function Rw(){if(process.env.ANTHROPIC_UNIX_SOCKET||!kC())return{valid:!0};let e=U(`policySettings`)?.forceLoginOrgUUID;if(!e)return{valid:!0};await _w();let t=Z();if(!t)return{valid:!0};let{source:n}=AC(),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 zw,Bw,Vw,Hw,Uw,Ww,Gw,Kw,qw,Jw,Yw,Xw,Z,Zw,Qw,$w,eT,tT,nT,rT,Q=t((()=>{Ze(),Nr(),m(),kr(),hr(),Nv(),wv(),O(),ny(),vy(),ay(),Oy(),Ly(),Hy(),Wy(),eC(),rp(),M(),h(),In(),ii(),gi(),Vr(),Xr(),pC(),SC(),Py(),Y_(),Ii(),ur(),EC(),zw=300*1e3,Bw=null,Vw=null,Hw=0,Uw=3600*1e3,Ww=180*1e3,Gw=Yr(async()=>{let e=await JC(),t=await XC();return(e||t)&&await Vy(),t},Uw),Kw=5e3,qw=3600*1e3,Jw=180*1e3,Yw=Yr(async()=>await tw(),qw),Xw=p(()=>{if(ne())return null;if(process.platform===`darwin`){let e=_C();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=fC().read()?.claudeAiOauth;return e?.accessToken?e:null}catch(e){return I(e),null}}),Zw=0,Qw=new Map,$w=null,eT=null,tT=0,nT=1740*1e3,rT=class extends Error{}}));function iT(){return`claude-code/2.6.0`}var aT=t((()=>{}));function oT(){return lT.getStore()?.workload}function sT(e,t){return lT.run({workload:e},t)}var cT,lT,uT=t((()=>{cT=`cron`,lT=new va}));function dT(){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=oT(),r=n?`, workload/${n}`:``;return`claude-cli/2.6.0 (${process.env.USER_TYPE}, ${process.env.CLAUDE_CODE_ENTRYPOINT??`cli`}${e}${t}${r})`}function fT(){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.0${e.length>0?` (${e.join(`, `)})`:``}`}function pT(){return`Claude-User (${iT()}; +https://support.anthropic.com/)`}function mT(){if(Y()){let e=Z();return e?.accessToken?{headers:{Authorization:`Bearer ${e.accessToken}`,"anthropic-beta":Dr}}:{headers:{},error:`No OAuth token available`}}let e=jC();return e?{headers:{"x-api-key":e}}:{headers:{},error:`No API key available`}}async function hT(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 mw(i),await e()}}var gT=t((()=>{Ie(),kr(),Q(),aT(),uT()}));async function _T(){ST===null&&!CT&&(CT=xT(),ST=await CT,CT=null,wT.cache.clear?.())}function vT(){ST=null,CT=null,wT.cache.clear?.(),TT.cache.clear?.()}function yT(){return wT(!0)}function bT(){if(ST!==null)return ST;let e=xw();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 xT(){let e=xw();if(e?.emailAddress)return e.emailAddress;if(process.env.USER_TYPE===`ant`)return process.env.COO_CREATOR?`${process.env.COO_CREATOR}@anthropic.com`:TT()}var ST,CT,wT,TT,ET=t((()=>{Nr(),m(),O(),Q(),rp(),gr(),Fr(),h(),ST=null,CT=null,wT=p(e=>{let t=zf(),n=H(),r,i,a;if(e&&(r=X()??void 0,i=kw()??void 0,r&&n.claudeCodeFirstTokenDate)){let e=new Date(n.claudeCodeFirstTokenDate).getTime();isNaN(e)||(a=e)}let o=xw(),s=o?.organizationUuid,c=o?.accountUuid;return{deviceId:t,sessionId:at(),email:bT(),appVersion:`2.6.0`,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}}}}),TT=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 DT(e){return OT(e,new WeakSet)}function OT(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=>OT(e,t));let n=e;return n.constructor!==Object&&n.constructor!==void 0?!1:Object.values(n).every(e=>OT(e,t))}return!1}var kT=t((()=>{})),AT,jT=t((()=>{fe(),we(),Ee(),kT(),ce(),AT=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(!DT(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}}})),MT,NT=t((()=>{Fe(),fe(),jT(),ce(),MT=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 AT(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}}})),PT,FT=t((()=>{PT=class{forceFlush(){return Promise.resolve()}onEmit(e,t){}shutdown(){return Promise.resolve()}enabled(e){return!1}}})),IT,LT=t((()=>{we(),ce(),IT=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 RT(e){return`${e.name}@${e.version||``}:${e.schemaUrl||``}`}var zT=t((()=>{})),BT,VT=t((()=>{BT=`otel.sdk.log.created`})),HT,UT=t((()=>{VT(),ce(),HT=class{constructor(e){_(this,`createdLogs`,void 0),this.createdLogs=e.createCounter(BT,{unit:`{log_record}`,description:`The number of logs submitted to enabled SDK Loggers.`})}emitLog(){this.createdLogs.add(1)}}})),WT,GT=t((()=>{WT=`0.215.0`})),KT,qT,JT,YT=t((()=>{fe(),Fe(),FT(),LT(),zT(),UT(),GT(),ce(),KT={disabled:!1,minimumSeverity:Ne.UNSPECIFIED,traceBased:!1},qT=()=>({...KT}),JT=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 IT(this.registeredLogRecordProcessors,this.forceFlushTimeoutMillis)):this.activeProcessor=new PT,this._loggerConfigurator=i??qT,this.loggerMetrics=new HT(a?a.getMeter(`@opentelemetry/sdk-logs`,WT):le())}getLoggerConfig(e){let t=RT(e),n=this._loggerConfigs.get(t);return n||(n=this._loggerConfigurator(e),this._loggerConfigs.set(t,n),n)}}})),XT,ZT=t((()=>{fe(),Fe(),ke(),we(),NT(),YT(),ce(),XT=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??qT,processors:e.processors??[],meterProvider:e.meterProvider};this._sharedState=new JT(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 MT({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()}}})),QT,$T=t((()=>{we(),QT=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 eE(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 tE,nE,rE=t((()=>{fe(),we(),ce(),tE=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 eE(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()})}},nE=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 tE(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 tE(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)}}})),iE,aE=t((()=>{rE(),iE=class extends nE{onShutdown(){}}})),oE=t((()=>{aE()})),sE=t((()=>{oE()})),cE=t((()=>{ZT(),$T(),sE()}));function lE(){return g(process.env.CLAUDE_CODE_USE_BEDROCK)||g(process.env.CLAUDE_CODE_USE_VERTEX)||g(process.env.CLAUDE_CODE_USE_FOUNDRY)||Hr()}function uE(){return Hr()}var dE=t((()=>{h(),zr()}));function fE(){return{seconds:0,nanos:0}}function pE(e){return e!=null}var mE,hE=t((()=>{mE={fromJSON(e){return{seconds:pE(e.seconds)?globalThis.Number(e.seconds):0,nanos:pE(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 mE.fromPartial(e??{})},fromPartial(e){let t=fE();return t.seconds=e.seconds??0,t.nanos=e.nanos??0,t}}}));function gE(){return{account_id:0,organization_uuid:``,account_uuid:``}}function _E(e){return e!=null}var vE,yE=t((()=>{vE={fromJSON(e){return{account_id:_E(e.account_id)?globalThis.Number(e.account_id):0,organization_uuid:_E(e.organization_uuid)?globalThis.String(e.organization_uuid):``,account_uuid:_E(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 vE.fromPartial(e??{})},fromPartial(e){let t=gE();return t.account_id=e.account_id??0,t.organization_uuid=e.organization_uuid??``,t.account_uuid=e.account_uuid??``,t}}}));function bE(){return{actor_id:``,repository_id:``,repository_owner_id:``}}function xE(){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 SE(){return{slack_team_id:``,is_enterprise_install:!1,trigger:``,creation_method:``}}function CE(){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 wE(e){let t=(e.seconds||0)*1e3;return t+=(e.nanos||0)/1e6,new globalThis.Date(t)}function TE(e){return e instanceof globalThis.Date?e:typeof e==`string`?new globalThis.Date(e):wE(mE.fromJSON(e))}function $(e){return e!=null}var EE,DE,OE,kE,AE=t((()=>{hE(),yE(),EE={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 EE.fromPartial(e??{})},fromPartial(e){let t=bE();return t.actor_id=e.actor_id??``,t.repository_id=e.repository_id??``,t.repository_owner_id=e.repository_owner_id??``,t}},DE={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)?EE.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=EE.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 DE.fromPartial(e??{})},fromPartial(e){let t=xE();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?EE.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}},OE={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 OE.fromPartial(e??{})},fromPartial(e){let t=SE();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}},kE={fromJSON(e){return{event_name:$(e.event_name)?globalThis.String(e.event_name):``,client_timestamp:$(e.client_timestamp)?TE(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)?DE.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)?vE.fromJSON(e.auth):void 0,server_timestamp:$(e.server_timestamp)?TE(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)?OE.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=DE.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=vE.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=OE.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 kE.fromPartial(e??{})},fromPartial(e){let t=CE();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?DE.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?vE.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?OE.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 jE(){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 ME(e){let t=(e.seconds||0)*1e3;return t+=(e.nanos||0)/1e6,new globalThis.Date(t)}function NE(e){return e instanceof globalThis.Date?e:typeof e==`string`?new globalThis.Date(e):ME(mE.fromJSON(e))}function PE(e){return e!=null}var FE,IE=t((()=>{hE(),yE(),FE={fromJSON(e){return{event_id:PE(e.event_id)?globalThis.String(e.event_id):``,timestamp:PE(e.timestamp)?NE(e.timestamp):void 0,experiment_id:PE(e.experiment_id)?globalThis.String(e.experiment_id):``,variation_id:PE(e.variation_id)?globalThis.Number(e.variation_id):0,environment:PE(e.environment)?globalThis.String(e.environment):``,user_attributes:PE(e.user_attributes)?globalThis.String(e.user_attributes):``,experiment_metadata:PE(e.experiment_metadata)?globalThis.String(e.experiment_metadata):``,device_id:PE(e.device_id)?globalThis.String(e.device_id):``,auth:PE(e.auth)?vE.fromJSON(e.auth):void 0,session_id:PE(e.session_id)?globalThis.String(e.session_id):``,anonymous_id:PE(e.anonymous_id)?globalThis.String(e.anonymous_id):``,event_metadata_vars:PE(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=vE.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 FE.fromPartial(e??{})},fromPartial(e){let t=jE();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?vE.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 LE(){return process.platform===`linux`&&g(process.env.CLAUDE_CODE_BUBBLEWRAP)}function RE(){return process.platform===`linux`?WE??!1:!1}async function zE(){if(GE!==void 0)return GE;if(process.platform===`darwin`)return GE=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 GE=t,t}}catch{}return GE=null,null}async function BE(){return process.env.TERMINAL_EMULATOR===`JetBrains-JediTerm`&&Lr.platform!==`darwin`?await zE()||`pycharm`:Lr.terminal}function VE(){return process.env.TERMINAL_EMULATOR===`JetBrains-JediTerm`&&Lr.platform!==`darwin`?GE===void 0?`pycharm`:GE||`pycharm`:Lr.terminal}async function HE(){process.env.TERMINAL_EMULATOR===`JetBrains-JediTerm`&&await zE()}var UE,WE,GE,KE,qE=t((()=>{m(),Fr(),h(),ii(),Li(),UE=p(async()=>{if(process.platform!==`linux`)return!1;let{code:e}=await ai(`test`,[`-f`,`/.dockerenv`]);return e===0}),WE=null,process.platform===`linux`&&pa(`/lib/libc.musl-${process.arch===`x64`?`x86_64`:`aarch64`}.so.1`).then(()=>{WE=!0},()=>{WE=!1}),KE={...Lr,terminal:VE(),getIsDocker:UE,getIsBubblewrapSandbox:LE,isMuslEnvironment:RE,getTerminalWithJetBrainsDetectionAsync:BE,initJetBrainsDetection:HE}}));function JE(e){return YE?.has(e)??!1}var YE,XE=t((()=>{M(),In()}));function ZE(){return!g(process.env.CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS_DISABLED)}var QE=t((()=>{h()}));function $E(){return iD.getStore()}function eD(e,t){return iD.run(e,t)}function tD(e){return e?.agentType===`subagent`}function nD(){let e=$E();if(!(!tD(e)||!e.subagentName))return e.isBuiltIn?e.subagentName:`user-defined`}function rD(){let e=$E();if(!(!e?.invokingRequestId||e.invocationEmitted))return e.invocationEmitted=!0,{invokingRequestId:e.invokingRequestId,invocationKind:e.invocationKind}}var iD,aD=t((()=>{QE(),iD=new va}));function oD(e){return e.startsWith(`mcp__`)?`mcp_tool`:e}function sD(){return g(process.env.OTEL_LOG_TOOL_DETAILS)}function cD(e,t){return!!(process.env.CLAUDE_CODE_ENTRYPOINT===`local-agent`||e===`claudeai-proxy`||t&&JE(t))}function lD(e,t,n){let r=uD(e);return!r||!bD.has(r.serverName)&&!cD(t,n)?{}:{mcpServerName:r.serverName,mcpToolName:r.mcpToolName}}function uD(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 dD(e,t){if(e===`Skill`&&typeof t==`object`&&t&&`skill`in t&&typeof t.skill==`string`)return t.skill}function fD(e,t=0){if(typeof e==`string`)return e.length>xD?`${e.slice(0,SD)}…[${e.length} chars]`:e;if(typeof e==`number`||typeof e==`boolean`||e==null)return e;if(t>=TD)return`<nested>`;if(Array.isArray(e)){let n=e.slice(0,wD).map(e=>fD(e,t+1));return e.length>wD&&n.push(`…[${e.length} items]`),n}if(typeof e==`object`){let n=Object.entries(e).filter(([e])=>!e.startsWith(`_`)),r=n.slice(0,wD).map(([e,n])=>[e,fD(n,t+1)]);return n.length>wD&&r.push([`…`,`${n.length} keys`]),Object.fromEntries(r)}return String(e)}function pD(e){if(!sD())return;let t=k(fD(e));return t.length>CD&&(t=t.slice(0,CD)+`…[truncated]`),t}function mD(e){let t=Ki(e).toLowerCase();if(!t||t===`.`)return;let n=t.slice(1);return n.length>ED?`other`:n}function hD(e,t){if(!e.includes(`.`)&&!t)return;let n,r=new Set;if(t){let e=mD(t);e&&(r.add(e),n=e)}for(let t of e.split(OD)){if(!t)continue;let e=t.split(kD);if(e.length<2)continue;let i=e[0],a=i.lastIndexOf(`/`),o=a>=0?i.slice(a+1):i;if(DD.has(o))for(let t=1;t<e.length;t++){let i=e[t];if(i.charCodeAt(0)===45)continue;let a=mD(i);a&&!r.has(a)&&(r.add(a),n=n?n+`,`+a:a)}}if(n)return n}function gD(){let e=$E();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 _D(){try{let e=process.memoryUsage(),t=process.cpuUsage(),n=Date.now(),r;if(MD&&ND){let e=n-ND;e>0&&(r=(t.user-MD.user+(t.system-MD.system))/(e*1e3)*100)}return MD=t,ND=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 vD(e={}){let t=e.model?String(e.model):jx(),n=typeof e.betas==`string`?e.betas:QS(t).join(`,`),[r,i]=await Promise.all([jD(),xr()]),a=_D();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||``,...gD(),...X()&&{subscriptionType:X()},...xt()?{kairosActive:!0}:{},...i&&{rh:i}}}function yD(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 bD,xD,SD,CD,wD,TD,ED,DD,OD,kD,AD,jD,MD,ND,PD=t((()=>{m(),Fr(),qE(),eC(),nS(),O(),h(),XE(),Q(),wr(),qr(),aD(),ur(),xi(),bD=new Set([(Bi(),e(zi)).COMPUTER_USE_MCP_SERVER_NAME]),xD=512,SD=128,CD=4*1024,wD=20,TD=2,ED=10,DD=new Set([`rm`,`mv`,`cp`,`touch`,`mkdir`,`chmod`,`chown`,`cat`,`head`,`tail`,`sort`,`stat`,`diff`,`wc`,`grep`,`rg`,`sed`]),OD=/\s*(?:&&|\|\||[;|])\s*/,kD=/\s+/,AD=p(()=>{let e=`2.6.0`.match(/^\d+\.\d+\.\d+(?:-[a-z]+)?/);return e?e[0]:void 0}),jD=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:KE.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.0`,versionBase:AD(),buildTime:`2026-05-21T08:40:30.039Z`,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(`,`)}:{}}}),MD=null,ND=null}));function FD(){return Ui.join(ae(),`telemetry`)}function ID(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 LD,RD,zD,BD=t((()=>{we(),Ie(),O(),AE(),IE(),Q(),rp(),M(),h(),In(),gT(),di(),Vr(),Ii(),ur(),aT(),vy(),hr(),PD(),ce(),LD=sa(),RD=`1p_failed_events.`,zD=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(FD(),`${RD}${at()}.${LD}.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(FD(),{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 Gw();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 Gw();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=AC(),t=jC()!==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=jC();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 sw(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||!yw()?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 _w();let i=H();if(i.oauthAccount&&i.oauthAccount.billingType!==void 0&&i.oauthAccount.accountCreatedAt!==void 0&&i.oauthAccount.subscriptionCreatedAt!==void 0||!Y()||!yw())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`?OO(`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((()=>{ik()}));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=OO(`tengu_penguins_off`,null);if(e!==null)return A(`Fast mode unavailable: ${e}`),e;if(!Ar()&&OO(`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`+(Ux()?`[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=Jx(e??Lx());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=jC();if(!(Z()?.accessToken&&yw())&&!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&&yw()?{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 mw(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(),ik(),O(),hr(),Q(),jr(),rp(),M(),h(),nS(),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=zx(e);return n===J(gv.firstParty)?Jb(t.speed===`fast`):lx[n]||(Zb(e,n),lx[zx(Lx())]??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(),nS(),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)?Jx(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)?Jx(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=Jx(n).toLowerCase();if(r.includes(e))return!0}for(let e of r)if(!fx(e)&&dx(e)&&Jx(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(),nS(),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||Fx()}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?Rx():Jx(e)}function Mx(){return Nx()}function Nx(){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:G().opus47}function Px(){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:e===`firstParty`?G().sonnet46:G().sonnet45}function Fx(){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:G().haiku45}function Ix(e){let{permissionMode:t,mainLoopModel:n,exceeds200kTokens:r=!1}=e;return Ax()===`opusplan`&&t===`plan`&&!r?Nx():Ax()===`haiku`&&t===`plan`?Px():n}function Lx(){return process.env.USER_TYPE===`ant`?ub()?.defaultModel??Nx()+`[1m]`:ww()||Ew()?Nx()+(Ux()?`[1m]`:``):Px()}function Rx(){return Jx(Lx())}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 zx(e){return J(Ov(e))}function Bx(e=!1){return ww()||Ew()?Ux()?`Opus 4.7 with 1M context · Most capable for complex work${e?Hx(!0):``}`:`Opus 4.7 · Most capable for complex work${e?Hx(!0):``}`:`Sonnet 4.6 · Best for everyday tasks`}function Vx(e){return e===`opusplan`?`Opus 4.7 in plan mode, else Sonnet 4.6`:qx(Jx(e))}function Hx(e){if(W()!==`firstParty`)return``;let t=tx(Jb(e));return` ·${e?` (↯)`:``} ${t}`}function Ux(){return!(bS()||Ow()||W()!==`firstParty`||!Cv()||Y()&&X()===null)}function Wx(e){return e===`opusplan`?`Opus Plan`:dx(e)?Yh(e):qx(e)}function Gx(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 Kx(e){let[t=``,...n]=e.split(`-`);return[t.slice(0,3)+`*`.repeat(Math.max(0,t.length-3)),...n].join(`-`)}function qx(e){let t=Gx(e);if(t)return t;if(process.env.USER_TYPE===`ant`){let t=Jx(e),n=fb(e);return n?Kx(n.model.replace(/\[1m\]$/i,``))+(xS(t)?`[1m]`:``):t===e?t:`${e} (${t})`}return e}function Jx(e){let t=e.trim(),n=t.toLowerCase(),r=xS(n),i=r?n.replace(/\[1m]$/i,``).trim():n;if(dx(i))switch(i){case`opusplan`:return Px()+(r?`[1m]`:``);case`sonnet`:return Px()+(r?`[1m]`:``);case`haiku`:return Fx()+(r?`[1m]`:``);case`opus`:return Nx()+(r?`[1m]`:``);case`best`:return Mx();default:}if(W()===`firstParty`&&Xx(i)&&Zx())return Nx()+(r?`[1m]`:``);if(process.env.USER_TYPE===`ant`){let e=xS(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 Yx(e,t){return xS(e)||!xS(t)?e:SS(Jx(e))?e+`[1m]`:e}function Xx(e){return tS.includes(e)}function Zx(){return!g(process.env.CLAUDE_CODE_DISABLE_LEGACY_MODEL_REMAP)}function Qx(e){if(e===null)return process.env.USER_TYPE===`ant`?`Default for Ants (${Vx(Lx())})`:Y()?`Default (${Bx()})`:`Default (${Rx()})`;let t=Jx(e);return e===t?t:`${e} (${t})`}function $x(e){if(W()===`foundry`)return;let t=e.toLowerCase().includes(`[1m]`),n=zx(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 eS(e){return e.replace(/\[(1|2)m\]/gi,``)}var tS,nS=t((()=>{O(),pb(),Q(),PS(),h(),Nv(),ux(),Y_(),wv(),Up(),xx(),hx(),ag(),Dx(),tS=[`claude-opus-4-20250514`,`claude-opus-4-1-20250805`,`claude-opus-4-0`,`claude-opus-4-1`]}));function rS(){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 iS({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=oS(),u={"x-app":`cli`,"User-Agent":dT(),"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 _w(),A(`[API:auth] OAuth token check complete`),Y()||await aS(u,Mt());let d=sS(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:rS()}};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 Gw();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:rS()}})}if(g(process.env.CLAUDE_CODE_USE_VERTEX)){g(process.env.CLAUDE_CODE_SKIP_VERTEX_AUTH)||await Yw();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:rS()}})}return new se({apiKey:Y()?null:e||jC(),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:rS()}})}async function aS(e,t){let n=process.env.ANTHROPIC_AUTH_TOKEN||await HC(t);n&&(e.Authorization=`Bearer ${n}`)}function oS(){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 sS(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(cS,sa());try{let n=e instanceof Request?e.url:String(e),r=a.get(cS);A(`[API REQUEST] ${new URL(n).pathname}${r?` ${cS}=${r}`:``} source=${t??`unknown`}`)}catch{}return n(e,{...i,headers:a})}}var cS,lS=t((()=>{vr(),Q(),gT(),nS(),wv(),Pi(),O(),kr(),M(),h(),cS=`x-client-request-id`}));function uS(){return R(ae(),`cache`)}function dS(){return R(uS(),`model-capabilities.json`)}function fS(){return!(W()!==`firstParty`||!Cv())}function pS(e){return[...e].sort((e,t)=>t.id.length-e.id.length||e.id.localeCompare(t.id))}function mS(e){if(!fS())return;let t=vS(dS());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 hS(){if(fS()&&!Br())try{let e=await iS({maxRetries:1}),t=Y()?[Dr]:void 0,n=[];for await(let r of e.models.list({betas:t})){let e=gS().safeParse(r);e.success&&n.push(e.data)}if(n.length===0)return;let r=dS(),i=pS(n);if(ku(vS(r),i)){A(`[modelCapabilities] cache unchanged, skipping write`);return}await la(uS(),{recursive:!0}),await ha(r,k({models:i,timestamp:Date.now()}),{encoding:`utf-8`,mode:384}),vS.cache.delete(r),A(`[modelCapabilities] cached ${i.length} models`)}catch(e){A(`[modelCapabilities] fetch failed: ${e instanceof Error?e.message:`unknown`}`)}}var gS,_S,vS,yS=t((()=>{Au(),m(),Je(),kr(),lS(),Q(),M(),h(),di(),Ei(),zr(),ur(),wv(),gS=L(()=>D({id:b(),max_input_tokens:y().optional(),max_tokens:y().optional()}).strip()),_S=L(()=>D({models:S(gS()),timestamp:y()})),vS=p(e=>{try{let t=ta(e,`utf-8`),n=_S().safeParse(fi(t,!1));return n.success?n.data.models:null}catch{return null}},e=>e)}));function bS(){return g(process.env.CLAUDE_CODE_DISABLE_1M_CONTEXT)}function xS(e){return bS()?!1:/\[1m\]/i.test(e)}function SS(e){if(bS())return!1;let t=zx(e);return t.includes(`claude-sonnet-4`)||t.includes(`opus-4-6`)||t.includes(`opus-4-7`)}function CS(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(xS(e))return 1e6;let n=mS(e);if(n?.max_input_tokens&&n.max_input_tokens>=1e5)return n.max_input_tokens>2e5&&bS()?OS:n.max_input_tokens;if(t?.includes(`context-1m-2025-08-07`)&&SS(e)||wS(e))return 1e6;if(process.env.USER_TYPE===`ant`){let t=fb(e);if(t?.contextWindow)return t.contextWindow}return OS}function wS(e){return bS()||xS(e)||!zx(e).includes(`sonnet-4-6`)?!1:H().clientDataCache?.coral_reef_sonnet===`true`}function TS(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 ES(e){let t,n;if(process.env.USER_TYPE===`ant`){let r=fb(e.toLowerCase());if(r)return t=r.defaultMaxTokens??AS,n=r.upperMaxTokensLimit??jS,{default:t,upperLimit:n}}let r=zx(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=AS,n=jS);let i=mS(e);return i?.max_tokens&&i.max_tokens>=4096&&(n=i.max_tokens,t=Math.min(t,n)),{default:t,upperLimit:n}}function DS(e){return ES(e).upperLimit-1}var OS,kS,AS,jS,MS,NS,PS=t((()=>{lb(),rp(),h(),nS(),pb(),yS(),OS=2e5,kS=2e4,AS=32e3,jS=64e3,MS=8e3,NS=64e3})),FS,IS,LS,RS=t((()=>{m(),wv(),FS=[{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`}],IS=[{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`}],LS=p((e,t)=>{if(W()===`firstParty`)return;let n=e.toLowerCase(),r=W()===`openai`?IS:FS;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 zS(e){let t=[],n=[];for(let r of e)XS.includes(r)?t.push(r):n.push(r);return{allowed:t,disallowed:n}}function BS(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}=zS(e);for(let e of n)console.warn(`Warning: Beta header '${e}' is not allowed. Only the following betas are supported: ${XS.join(`, `)}`);return t.length>0?t:void 0}function VS(e){let t=LS(e,`interleaved_thinking`);if(t!==void 0)return t;let n=zx(e),r=W();return r===`foundry`?!0:r===`firstParty`?!n.includes(`claude-3-`):n.includes(`claude-opus-4`)||n.includes(`claude-sonnet-4`)}function HS(e){let t=zx(e);return t.includes(`claude-opus-4`)||t.includes(`claude-sonnet-4`)||t.includes(`claude-haiku-4`)}function US(e){let t=zx(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 WS(e){let t=zx(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 GS(e){return!0}function KS(){return(W()===`firstParty`||W()===`foundry`)&&!g(process.env.CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS)&&Cv()}function qS(){return W()===`firstParty`&&!g(process.env.CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS)}function JS(e,t){let n=[...QS(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 YS(){ZS.cache?.clear?.(),QS.cache?.clear?.(),$S.cache?.clear?.()}var XS,ZS,QS,$S,eC=t((()=>{m(),ik(),O(),lb(),kr(),Q(),PS(),h(),nS(),RS(),wv(),Y_(),XS=[qy],ZS=p(e=>{let t=[],n=zx(e).includes(`haiku`),r=W(),i=KS();n||(t.push(Gy),process.env.USER_TYPE===`ant`&&process.env.CLAUDE_CODE_ENTRYPOINT===`cli`&&ab&&t.push(ab)),Y()&&t.push(Dr),xS(e)&&t.push(qy),!g(process.env.DISABLE_INTERLEAVED_THINKING)&&VS(e)&&t.push(Ky),i&&VS(e)&&!Mt()&&z_().showThinkingSummaries!==!0&&t.push(nb);let a=g(process.env.USE_API_CONTEXT_MANAGEMENT)||US(e),o=US(e);KS()&&(a||o)&&t.push(Jy);let s=AO(`tengu_tool_pear`),c=!s&&OO(`tengu_amber_json_tools`,!1);return i&&WS(e)&&s&&t.push(Yy),process.env.USER_TYPE===`ant`&&i&&c&&t.push(rb),r===`vertex`&&HS(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}),QS=p(e=>{let t=ZS(e);return W()===`bedrock`?t.filter(e=>!sb.has(e)):t}),$S=p(e=>ZS(e).filter(e=>sb.has(e)))}));function tC(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 nC=t((()=>{}));async function rC(){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 iC(){if(sC!==void 0)return sC;if(process.platform!==`darwin`)return sC=!1,!1;try{sC=Mr(`security`,[`show-keychain-info`],{reject:!1,stdio:[`ignore`,`pipe`,`pipe`]}).exitCode===36}catch{sC=!1}return sC}var aC,oC,sC,cC=t((()=>{Nr(),M(),ii(),ti(),ur(),Py(),aC=4032,oC={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=rC().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<=aC?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 lC(){let e=ae();return{storageDir:e,storagePath:R(e,`.credentials.json`)}}var uC,dC=t((()=>{h(),In(),Jn(),ur(),uC={name:`plaintext`,read(){let{storagePath:e}=lC();try{return Pn(j().readFileSync(e,{encoding:`utf8`}))}catch{return null}},async readAsync(){let{storagePath:e}=lC();try{return Pn(await j().readFile(e,{encoding:`utf8`}))}catch{return null}},update(e){try{let{storageDir:t,storagePath:n}=lC();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}=lC();try{return j().unlinkSync(e),!0}catch(e){return Mn(e)===`ENOENT`}}}}));function fC(){return process.platform===`darwin`?tC(oC,uC):uC}var pC=t((()=>{nC(),cC(),dC()}));function mC(e){return new Promise(t=>{_a(`security`,[`find-generic-password`,`-a`,Ay(),`-w`,`-s`,e],{encoding:`utf-8`,timeout:yC},(e,n)=>{t({stdout:e?null:n?.trim()||null,timedOut:!!(e&&`killed`in e&&e.killed)})})})}function hC(){if(process.platform!==`darwin`||xC||ne())return;let e=mC(ky(Ny)),t=mC(ky());xC=Promise.all([e,t]).then(([e,t])=>{e.timedOut||My(e.stdout),t.timedOut||(bC={stdout:t.stdout})})}async function gC(){xC&&await xC}function _C(){return bC}function vC(){bC=null}var yC,bC,xC,SC=t((()=>{h(),Py(),yC=1e4,bC=null,xC=null}));function CC(){return TC}function wC(){TC.clear()}var TC,EC=t((()=>{TC=new Map})),DC=r({calculateApiKeyHelperTTL:()=>BC,checkAndRefreshOAuthTokenIfNeeded:()=>_w,checkGcpCredentialsValid:()=>ew,clearApiKeyHelperCache:()=>KC,clearAwsCredentialsCache:()=>ZC,clearGcpCredentialsCache:()=>rw,clearOAuthTokenCache:()=>fw,getAccountInformation:()=>Lw,getAnthropicApiKey:()=>jC,getAnthropicApiKeyWithSource:()=>NC,getApiKeyFromApiKeyHelper:()=>HC,getApiKeyFromApiKeyHelperCached:()=>GC,getApiKeyFromConfigOrMacOSKeychain:()=>Xw,getApiKeyHelperElapsedMs:()=>VC,getAuthTokenSource:()=>AC,getClaudeAIOAuthTokens:()=>Z,getClaudeAIOAuthTokensAsync:()=>gw,getConfiguredApiKeyHelper:()=>PC,getOauthAccountInfo:()=>xw,getOtelHeadersFromHelper:()=>Pw,getRateLimitTier:()=>kw,getSubscriptionName:()=>Aw,getSubscriptionType:()=>X,handleOAuth401Error:()=>mw,hasAnthropicApiKeyAuth:()=>MC,hasOpusAccess:()=>Cw,hasProfileScope:()=>yw,is1PApiCustomer:()=>bw,isAnthropicAuthEnabled:()=>kC,isAwsAuthRefreshFromProjectSettings:()=>LC,isAwsCredentialExportFromProjectSettings:()=>zC,isClaudeAISubscriber:()=>Y,isConsumerSubscriber:()=>Iw,isCustomApiKeyApproved:()=>cw,isEnterpriseSubscriber:()=>Dw,isGcpAuthRefreshFromProjectSettings:()=>$C,isMaxSubscriber:()=>ww,isOtelHeadersHelperFromProjectOrLocalSettings:()=>Nw,isOverageProvisioningAllowed:()=>Sw,isProSubscriber:()=>Ow,isTeamPremiumSubscriber:()=>Ew,isTeamSubscriber:()=>Tw,isUsing3PServices:()=>jw,prefetchApiKeyFromApiKeyHelperIfSafe:()=>qC,prefetchAwsCredentialsAndBedRockInfoIfSafe:()=>aw,prefetchGcpCredentialsIfSafe:()=>iw,refreshAndGetAwsCredentials:()=>Gw,refreshAwsAuth:()=>YC,refreshGcpAuth:()=>nw,refreshGcpCredentialsIfNeeded:()=>Yw,removeApiKey:()=>lw,saveApiKey:()=>sw,saveOAuthTokensIfNeeded:()=>dw,validateForceLoginOrg:()=>Rw});function OC(){return g(process.env.CLAUDE_CODE_REMOTE)||process.env.CLAUDE_CODE_ENTRYPOINT===`claude-desktop`}function kC(){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}=NC({skipRetrievingKeyFromApiKeyHelper:!0}),a=i===`ANTHROPIC_API_KEY`||i===`apiKeyHelper`;return!(t||r&&!OC()||a&&!OC())}function AC(){if(ne())return PC()?{source:`apiKeyHelper`,hasToken:!0}:{source:`none`,hasToken:!1};if(process.env.ANTHROPIC_AUTH_TOKEN&&!OC())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(PC()&&!OC())return{source:`apiKeyHelper`,hasToken:!0};let e=Z();return oy(e?.scopes)&&e?.accessToken?{source:`claude.ai`,hasToken:!0}:{source:`none`,hasToken:!1}}function jC(){let{key:e}=NC();return e}function MC(){let{key:e,source:t}=NC({skipRetrievingKeyFromApiKeyHelper:!0});return e!==null&&t!==`none`}function NC(e={}){if(ne())return process.env.ANTHROPIC_API_KEY?{key:process.env.ANTHROPIC_API_KEY,source:`ANTHROPIC_API_KEY`}:PC()?{key:e.skipRetrievingKeyFromApiKeyHelper?null:GC(),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`}:PC()?e.skipRetrievingKeyFromApiKeyHelper?{key:null,source:`apiKeyHelper`}:{key:GC(),source:`apiKeyHelper`}:Xw()||{key:null,source:`none`}}function PC(){return ne()?U(`flagSettings`)?.apiKeyHelper:(J_()||{}).apiKeyHelper}function FC(){let e=PC();if(!e)return!1;let t=U(`projectSettings`),n=U(`localSettings`);return t?.apiKeyHelper===e||n?.apiKeyHelper===e}function IC(){return(J_()||{}).awsAuthRefresh}function LC(){let e=IC();if(!e)return!1;let t=U(`projectSettings`),n=U(`localSettings`);return t?.awsAuthRefresh===e||n?.awsAuthRefresh===e}function RC(){return(J_()||{}).awsCredentialExport}function zC(){let e=RC();if(!e)return!1;let t=U(`projectSettings`),n=U(`localSettings`);return t?.awsCredentialExport===e||n?.awsCredentialExport===e}function BC(){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 zw}function VC(){let e=Vw?.startedAt;return e?Date.now()-e:0}async function HC(e){if(!PC())return null;let t=BC();return Bw?(Date.now()-Bw.timestamp<t||Vw||(Vw={promise:UC(e,!1,Hw),startedAt:null}),Bw.value):(Vw||(Vw={promise:UC(e,!0,Hw),startedAt:Date.now()}),Vw.promise)}async function UC(e,t,n){try{let t=await WC(e);return n===Hw&&t!==null&&(Bw={value:t,timestamp:Date.now()}),t}catch(e){if(n!==Hw)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&&Bw&&Bw.value!==` `?(Bw={...Bw,timestamp:Date.now()},Bw.value):(Bw={value:` `,timestamp:Date.now()},` `)}finally{n===Hw&&(Vw=null)}}async function WC(e){let t=PC();if(!t)return null;if(FC()&&!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 GC(){return Bw?.value??null}function KC(){Hw++,Bw=null,Vw=null}function qC(e){FC()&&!gf()||HC(e)}async function JC(){let e=IC();if(!e)return!1;if(LC()&&!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 YC(e)}}function YC(e){A(`Running AWS auth refresh command`);let t=Uy.getInstance();return t.startAuthentication(),new Promise(n=>{let r=ga(e,{timeout:Ww});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 XC(){let e=RC();if(!e)return null;if(zC()&&!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 ZC(){Gw.cache.clear()}function QC(){return(J_()||{}).gcpAuthRefresh}function $C(){let e=QC();if(!e)return!1;let t=U(`projectSettings`),n=U(`localSettings`);return t?.gcpAuthRefresh===e||n?.gcpAuthRefresh===e}async function ew(){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(Kw).then(()=>{throw new rT(`GCP credentials check timed out`)});return await Promise.race([r,i]),!0}catch{return!1}}async function tw(){let e=QC();if(!e)return!1;if($C()&&!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 ew())return A(`GCP credentials are valid, skipping auth refresh command`),!1}catch{}return nw(e)}function nw(e){A(`Running GCP auth refresh command`);let t=Uy.getInstance();return t.startAuthentication(),new Promise(n=>{let r=ga(e,{timeout:Jw});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 rw(){Yw.cache.clear()}function iw(){QC()&&($C()&&!gf()&&!Mt()||Yw())}function aw(){let e=IC(),t=RC();!e&&!t||(LC()||zC())&&!gf()&&!Mt()||(Gw(),G())}function ow(e){return/^[a-zA-Z0-9-_]+$/.test(e)}async function sw(e){if(!ow(e))throw Error(`Invalid API key format. API key must contain only alphanumeric characters, dashes, and underscores.`);await uw();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??[]}}}),Xw.cache.clear?.(),vC()}function cw(e){let t=H(),n=Iy(e);return t.customApiKeyResponses?.approved?.includes(n)??!1}async function lw(){await uw(),V(e=>({...e,primaryApiKey:void 0})),Xw.cache.clear?.(),vC()}async function uw(){try{await Fy()}catch(e){I(e)}}function dw(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=fC(),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?.(),YS(),wC(),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 fw(){Z.cache?.clear?.(),jy()}async function pw(){try{let{mtimeMs:e}=await pa(R(ae(),`.credentials.json`));e!==Zw&&(Zw=e,fw())}catch{Z.cache?.clear?.()}}function mw(e){let t=Qw.get(e);if(t)return t;let n=hw(e).finally(()=>{Qw.delete(e)});return Qw.set(e,n),n}async function hw(e){fw();let t=await gw();return t?.refreshToken?t.accessToken===e?_w(0,!0):(N(`tengu_oauth_401_recovered_from_keychain`,{}),!0):!1}async function gw(){if(ne())return null;if(process.env.CLAUDE_CODE_OAUTH_TOKEN||Sy())return Z();try{let e=(await fC().readAsync())?.claudeAiOauth;return e?.accessToken?e:null}catch(e){return I(e),null}}function _w(e=0,t=!1){return e===0&&!t?$w||($w=vw(e,t).finally(()=>{$w=null}),$w):vw(e,t)}async function vw(e,t){await pw();let n=Z();if(!t&&(!n?.refreshToken||!py(n.expiresAt))||!n?.refreshToken||!oy(n.scopes))return!1;Z.cache?.clear?.(),jy();let r=await gw();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),vw(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 gw();return!e?.refreshToken||!py(e.expiresAt)?(N(`tengu_oauth_token_refresh_race_resolved`,{}),!1):(N(`tengu_oauth_token_refresh_starting`,{}),dw(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 gw();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 kC()?oy(Z()?.scopes):!1}function yw(){return Z()?.scopes?.includes(`user:profile`)??!1}function bw(){return!(g(process.env.CLAUDE_CODE_USE_BEDROCK)||g(process.env.CLAUDE_CODE_USE_VERTEX)||g(process.env.CLAUDE_CODE_USE_FOUNDRY)||Y())}function xw(){return kC()?H().oauthAccount:void 0}function Sw(){let e=xw()?.billingType;return!(!Y()||!e||e!==`stripe_subscription`&&e!==`stripe_subscription_contracted`&&e!==`apple_subscription`&&e!==`google_play_subscription`)}function Cw(){let e=X();return e===`max`||e===`enterprise`||e===`team`||e===`pro`||e===null}function X(){if(Gv())return Wv();if(!kC())return null;let e=Z();return e?e.subscriptionType??null:null}function ww(){return X()===`max`}function Tw(){return X()===`team`}function Ew(){return X()===`team`&&kw()===`default_claude_max_5x`}function Dw(){return X()===`enterprise`}function Ow(){return X()===`pro`}function kw(){if(!kC())return null;let e=Z();return e?e.rateLimitTier??null:null}function Aw(){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 jw(){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 Mw(){return(J_()||{}).otelHeadersHelper}function Nw(){let e=Mw();if(!e)return!1;let t=U(`projectSettings`),n=U(`localSettings`);return t?.otelHeadersHelper===e||n?.otelHeadersHelper===e}function Pw(){let e=Mw();if(!e)return{};let t=parseInt(process.env.CLAUDE_CODE_OTEL_HEADERS_HELPER_DEBOUNCE_MS||nT.toString(),10);if(eT&&Date.now()-tT<t)return eT;if(Nw()&&!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 eT=n,tT=Date.now(),eT}catch(e){throw I(Error(`Error getting OpenTelemetry headers from otelHeadersHelper (in settings): ${An(e)}`)),e}}function Fw(e){return e===`max`||e===`pro`}function Iw(){let e=X();return Y()&&e!==null&&Fw(e)}function Lw(){if(W()!==`firstParty`)return;let{source:e}=AC(),t={};e===`CLAUDE_CODE_OAUTH_TOKEN`||e===`CLAUDE_CODE_OAUTH_TOKEN_FILE_DESCRIPTOR`?t.tokenSource=e:Y()?t.subscription=Aw():t.tokenSource=e;let{key:n,source:r}=NC();if(n&&(t.apiKeySource=r),e===`claude.ai`||r===`/login managed key`){let e=xw()?.organizationName;e&&(t.organization=e)}let i=xw()?.emailAddress;return(e===`claude.ai`||r===`/login managed key`)&&i&&(t.email=i),t}async function Rw(){if(process.env.ANTHROPIC_UNIX_SOCKET||!kC())return{valid:!0};let e=U(`policySettings`)?.forceLoginOrgUUID;if(!e)return{valid:!0};await _w();let t=Z();if(!t)return{valid:!0};let{source:n}=AC(),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 zw,Bw,Vw,Hw,Uw,Ww,Gw,Kw,qw,Jw,Yw,Xw,Z,Zw,Qw,$w,eT,tT,nT,rT,Q=t((()=>{Ze(),Nr(),m(),kr(),hr(),Nv(),wv(),O(),ny(),vy(),ay(),Oy(),Ly(),Hy(),Wy(),eC(),rp(),M(),h(),In(),ii(),gi(),Vr(),Xr(),pC(),SC(),Py(),Y_(),Ii(),ur(),EC(),zw=300*1e3,Bw=null,Vw=null,Hw=0,Uw=3600*1e3,Ww=180*1e3,Gw=Yr(async()=>{let e=await JC(),t=await XC();return(e||t)&&await Vy(),t},Uw),Kw=5e3,qw=3600*1e3,Jw=180*1e3,Yw=Yr(async()=>await tw(),qw),Xw=p(()=>{if(ne())return null;if(process.platform===`darwin`){let e=_C();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=fC().read()?.claudeAiOauth;return e?.accessToken?e:null}catch(e){return I(e),null}}),Zw=0,Qw=new Map,$w=null,eT=null,tT=0,nT=1740*1e3,rT=class extends Error{}}));function iT(){return`claude-code/2.6.5`}var aT=t((()=>{}));function oT(){return lT.getStore()?.workload}function sT(e,t){return lT.run({workload:e},t)}var cT,lT,uT=t((()=>{cT=`cron`,lT=new va}));function dT(){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=oT(),r=n?`, workload/${n}`:``;return`claude-cli/2.6.5 (${process.env.USER_TYPE}, ${process.env.CLAUDE_CODE_ENTRYPOINT??`cli`}${e}${t}${r})`}function fT(){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.5${e.length>0?` (${e.join(`, `)})`:``}`}function pT(){return`Claude-User (${iT()}; +https://support.anthropic.com/)`}function mT(){if(Y()){let e=Z();return e?.accessToken?{headers:{Authorization:`Bearer ${e.accessToken}`,"anthropic-beta":Dr}}:{headers:{},error:`No OAuth token available`}}let e=jC();return e?{headers:{"x-api-key":e}}:{headers:{},error:`No API key available`}}async function hT(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 mw(i),await e()}}var gT=t((()=>{Ie(),kr(),Q(),aT(),uT()}));async function _T(){ST===null&&!CT&&(CT=xT(),ST=await CT,CT=null,wT.cache.clear?.())}function vT(){ST=null,CT=null,wT.cache.clear?.(),TT.cache.clear?.()}function yT(){return wT(!0)}function bT(){if(ST!==null)return ST;let e=xw();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 xT(){let e=xw();if(e?.emailAddress)return e.emailAddress;if(process.env.USER_TYPE===`ant`)return process.env.COO_CREATOR?`${process.env.COO_CREATOR}@anthropic.com`:TT()}var ST,CT,wT,TT,ET=t((()=>{Nr(),m(),O(),Q(),rp(),gr(),Fr(),h(),ST=null,CT=null,wT=p(e=>{let t=zf(),n=H(),r,i,a;if(e&&(r=X()??void 0,i=kw()??void 0,r&&n.claudeCodeFirstTokenDate)){let e=new Date(n.claudeCodeFirstTokenDate).getTime();isNaN(e)||(a=e)}let o=xw(),s=o?.organizationUuid,c=o?.accountUuid;return{deviceId:t,sessionId:at(),email:bT(),appVersion:`2.6.5`,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}}}}),TT=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 DT(e){return OT(e,new WeakSet)}function OT(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=>OT(e,t));let n=e;return n.constructor!==Object&&n.constructor!==void 0?!1:Object.values(n).every(e=>OT(e,t))}return!1}var kT=t((()=>{})),AT,jT=t((()=>{fe(),we(),Ee(),kT(),ce(),AT=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(!DT(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}}})),MT,NT=t((()=>{Fe(),fe(),jT(),ce(),MT=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 AT(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}}})),PT,FT=t((()=>{PT=class{forceFlush(){return Promise.resolve()}onEmit(e,t){}shutdown(){return Promise.resolve()}enabled(e){return!1}}})),IT,LT=t((()=>{we(),ce(),IT=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 RT(e){return`${e.name}@${e.version||``}:${e.schemaUrl||``}`}var zT=t((()=>{})),BT,VT=t((()=>{BT=`otel.sdk.log.created`})),HT,UT=t((()=>{VT(),ce(),HT=class{constructor(e){_(this,`createdLogs`,void 0),this.createdLogs=e.createCounter(BT,{unit:`{log_record}`,description:`The number of logs submitted to enabled SDK Loggers.`})}emitLog(){this.createdLogs.add(1)}}})),WT,GT=t((()=>{WT=`0.215.0`})),KT,qT,JT,YT=t((()=>{fe(),Fe(),FT(),LT(),zT(),UT(),GT(),ce(),KT={disabled:!1,minimumSeverity:Ne.UNSPECIFIED,traceBased:!1},qT=()=>({...KT}),JT=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 IT(this.registeredLogRecordProcessors,this.forceFlushTimeoutMillis)):this.activeProcessor=new PT,this._loggerConfigurator=i??qT,this.loggerMetrics=new HT(a?a.getMeter(`@opentelemetry/sdk-logs`,WT):le())}getLoggerConfig(e){let t=RT(e),n=this._loggerConfigs.get(t);return n||(n=this._loggerConfigurator(e),this._loggerConfigs.set(t,n),n)}}})),XT,ZT=t((()=>{fe(),Fe(),ke(),we(),NT(),YT(),ce(),XT=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??qT,processors:e.processors??[],meterProvider:e.meterProvider};this._sharedState=new JT(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 MT({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()}}})),QT,$T=t((()=>{we(),QT=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 eE(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 tE,nE,rE=t((()=>{fe(),we(),ce(),tE=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 eE(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()})}},nE=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 tE(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 tE(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)}}})),iE,aE=t((()=>{rE(),iE=class extends nE{onShutdown(){}}})),oE=t((()=>{aE()})),sE=t((()=>{oE()})),cE=t((()=>{ZT(),$T(),sE()}));function lE(){return g(process.env.CLAUDE_CODE_USE_BEDROCK)||g(process.env.CLAUDE_CODE_USE_VERTEX)||g(process.env.CLAUDE_CODE_USE_FOUNDRY)||Hr()}function uE(){return Hr()}var dE=t((()=>{h(),zr()}));function fE(){return{seconds:0,nanos:0}}function pE(e){return e!=null}var mE,hE=t((()=>{mE={fromJSON(e){return{seconds:pE(e.seconds)?globalThis.Number(e.seconds):0,nanos:pE(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 mE.fromPartial(e??{})},fromPartial(e){let t=fE();return t.seconds=e.seconds??0,t.nanos=e.nanos??0,t}}}));function gE(){return{account_id:0,organization_uuid:``,account_uuid:``}}function _E(e){return e!=null}var vE,yE=t((()=>{vE={fromJSON(e){return{account_id:_E(e.account_id)?globalThis.Number(e.account_id):0,organization_uuid:_E(e.organization_uuid)?globalThis.String(e.organization_uuid):``,account_uuid:_E(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 vE.fromPartial(e??{})},fromPartial(e){let t=gE();return t.account_id=e.account_id??0,t.organization_uuid=e.organization_uuid??``,t.account_uuid=e.account_uuid??``,t}}}));function bE(){return{actor_id:``,repository_id:``,repository_owner_id:``}}function xE(){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 SE(){return{slack_team_id:``,is_enterprise_install:!1,trigger:``,creation_method:``}}function CE(){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 wE(e){let t=(e.seconds||0)*1e3;return t+=(e.nanos||0)/1e6,new globalThis.Date(t)}function TE(e){return e instanceof globalThis.Date?e:typeof e==`string`?new globalThis.Date(e):wE(mE.fromJSON(e))}function $(e){return e!=null}var EE,DE,OE,kE,AE=t((()=>{hE(),yE(),EE={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 EE.fromPartial(e??{})},fromPartial(e){let t=bE();return t.actor_id=e.actor_id??``,t.repository_id=e.repository_id??``,t.repository_owner_id=e.repository_owner_id??``,t}},DE={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)?EE.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=EE.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 DE.fromPartial(e??{})},fromPartial(e){let t=xE();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?EE.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}},OE={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 OE.fromPartial(e??{})},fromPartial(e){let t=SE();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}},kE={fromJSON(e){return{event_name:$(e.event_name)?globalThis.String(e.event_name):``,client_timestamp:$(e.client_timestamp)?TE(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)?DE.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)?vE.fromJSON(e.auth):void 0,server_timestamp:$(e.server_timestamp)?TE(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)?OE.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=DE.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=vE.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=OE.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 kE.fromPartial(e??{})},fromPartial(e){let t=CE();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?DE.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?vE.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?OE.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 jE(){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 ME(e){let t=(e.seconds||0)*1e3;return t+=(e.nanos||0)/1e6,new globalThis.Date(t)}function NE(e){return e instanceof globalThis.Date?e:typeof e==`string`?new globalThis.Date(e):ME(mE.fromJSON(e))}function PE(e){return e!=null}var FE,IE=t((()=>{hE(),yE(),FE={fromJSON(e){return{event_id:PE(e.event_id)?globalThis.String(e.event_id):``,timestamp:PE(e.timestamp)?NE(e.timestamp):void 0,experiment_id:PE(e.experiment_id)?globalThis.String(e.experiment_id):``,variation_id:PE(e.variation_id)?globalThis.Number(e.variation_id):0,environment:PE(e.environment)?globalThis.String(e.environment):``,user_attributes:PE(e.user_attributes)?globalThis.String(e.user_attributes):``,experiment_metadata:PE(e.experiment_metadata)?globalThis.String(e.experiment_metadata):``,device_id:PE(e.device_id)?globalThis.String(e.device_id):``,auth:PE(e.auth)?vE.fromJSON(e.auth):void 0,session_id:PE(e.session_id)?globalThis.String(e.session_id):``,anonymous_id:PE(e.anonymous_id)?globalThis.String(e.anonymous_id):``,event_metadata_vars:PE(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=vE.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 FE.fromPartial(e??{})},fromPartial(e){let t=jE();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?vE.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 LE(){return process.platform===`linux`&&g(process.env.CLAUDE_CODE_BUBBLEWRAP)}function RE(){return process.platform===`linux`?WE??!1:!1}async function zE(){if(GE!==void 0)return GE;if(process.platform===`darwin`)return GE=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 GE=t,t}}catch{}return GE=null,null}async function BE(){return process.env.TERMINAL_EMULATOR===`JetBrains-JediTerm`&&Lr.platform!==`darwin`?await zE()||`pycharm`:Lr.terminal}function VE(){return process.env.TERMINAL_EMULATOR===`JetBrains-JediTerm`&&Lr.platform!==`darwin`?GE===void 0?`pycharm`:GE||`pycharm`:Lr.terminal}async function HE(){process.env.TERMINAL_EMULATOR===`JetBrains-JediTerm`&&await zE()}var UE,WE,GE,KE,qE=t((()=>{m(),Fr(),h(),ii(),Li(),UE=p(async()=>{if(process.platform!==`linux`)return!1;let{code:e}=await ai(`test`,[`-f`,`/.dockerenv`]);return e===0}),WE=null,process.platform===`linux`&&pa(`/lib/libc.musl-${process.arch===`x64`?`x86_64`:`aarch64`}.so.1`).then(()=>{WE=!0},()=>{WE=!1}),KE={...Lr,terminal:VE(),getIsDocker:UE,getIsBubblewrapSandbox:LE,isMuslEnvironment:RE,getTerminalWithJetBrainsDetectionAsync:BE,initJetBrainsDetection:HE}}));function JE(e){return YE?.has(e)??!1}var YE,XE=t((()=>{M(),In()}));function ZE(){return!g(process.env.CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS_DISABLED)}var QE=t((()=>{h()}));function $E(){return iD.getStore()}function eD(e,t){return iD.run(e,t)}function tD(e){return e?.agentType===`subagent`}function nD(){let e=$E();if(!(!tD(e)||!e.subagentName))return e.isBuiltIn?e.subagentName:`user-defined`}function rD(){let e=$E();if(!(!e?.invokingRequestId||e.invocationEmitted))return e.invocationEmitted=!0,{invokingRequestId:e.invokingRequestId,invocationKind:e.invocationKind}}var iD,aD=t((()=>{QE(),iD=new va}));function oD(e){return e.startsWith(`mcp__`)?`mcp_tool`:e}function sD(){return g(process.env.OTEL_LOG_TOOL_DETAILS)}function cD(e,t){return!!(process.env.CLAUDE_CODE_ENTRYPOINT===`local-agent`||e===`claudeai-proxy`||t&&JE(t))}function lD(e,t,n){let r=uD(e);return!r||!bD.has(r.serverName)&&!cD(t,n)?{}:{mcpServerName:r.serverName,mcpToolName:r.mcpToolName}}function uD(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 dD(e,t){if(e===`Skill`&&typeof t==`object`&&t&&`skill`in t&&typeof t.skill==`string`)return t.skill}function fD(e,t=0){if(typeof e==`string`)return e.length>xD?`${e.slice(0,SD)}…[${e.length} chars]`:e;if(typeof e==`number`||typeof e==`boolean`||e==null)return e;if(t>=TD)return`<nested>`;if(Array.isArray(e)){let n=e.slice(0,wD).map(e=>fD(e,t+1));return e.length>wD&&n.push(`…[${e.length} items]`),n}if(typeof e==`object`){let n=Object.entries(e).filter(([e])=>!e.startsWith(`_`)),r=n.slice(0,wD).map(([e,n])=>[e,fD(n,t+1)]);return n.length>wD&&r.push([`…`,`${n.length} keys`]),Object.fromEntries(r)}return String(e)}function pD(e){if(!sD())return;let t=k(fD(e));return t.length>CD&&(t=t.slice(0,CD)+`…[truncated]`),t}function mD(e){let t=Ki(e).toLowerCase();if(!t||t===`.`)return;let n=t.slice(1);return n.length>ED?`other`:n}function hD(e,t){if(!e.includes(`.`)&&!t)return;let n,r=new Set;if(t){let e=mD(t);e&&(r.add(e),n=e)}for(let t of e.split(OD)){if(!t)continue;let e=t.split(kD);if(e.length<2)continue;let i=e[0],a=i.lastIndexOf(`/`),o=a>=0?i.slice(a+1):i;if(DD.has(o))for(let t=1;t<e.length;t++){let i=e[t];if(i.charCodeAt(0)===45)continue;let a=mD(i);a&&!r.has(a)&&(r.add(a),n=n?n+`,`+a:a)}}if(n)return n}function gD(){let e=$E();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 _D(){try{let e=process.memoryUsage(),t=process.cpuUsage(),n=Date.now(),r;if(MD&&ND){let e=n-ND;e>0&&(r=(t.user-MD.user+(t.system-MD.system))/(e*1e3)*100)}return MD=t,ND=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 vD(e={}){let t=e.model?String(e.model):jx(),n=typeof e.betas==`string`?e.betas:QS(t).join(`,`),[r,i]=await Promise.all([jD(),xr()]),a=_D();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||``,...gD(),...X()&&{subscriptionType:X()},...xt()?{kairosActive:!0}:{},...i&&{rh:i}}}function yD(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 bD,xD,SD,CD,wD,TD,ED,DD,OD,kD,AD,jD,MD,ND,PD=t((()=>{m(),Fr(),qE(),eC(),nS(),O(),h(),XE(),Q(),wr(),qr(),aD(),ur(),xi(),bD=new Set([(Bi(),e(zi)).COMPUTER_USE_MCP_SERVER_NAME]),xD=512,SD=128,CD=4*1024,wD=20,TD=2,ED=10,DD=new Set([`rm`,`mv`,`cp`,`touch`,`mkdir`,`chmod`,`chown`,`cat`,`head`,`tail`,`sort`,`stat`,`diff`,`wc`,`grep`,`rg`,`sed`]),OD=/\s*(?:&&|\|\||[;|])\s*/,kD=/\s+/,AD=p(()=>{let e=`2.6.5`.match(/^\d+\.\d+\.\d+(?:-[a-z]+)?/);return e?e[0]:void 0}),jD=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:KE.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.5`,versionBase:AD(),buildTime:`2026-05-22T13:07:48.152Z`,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(`,`)}:{}}}),MD=null,ND=null}));function FD(){return Ui.join(ae(),`telemetry`)}function ID(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 LD,RD,zD,BD=t((()=>{we(),Ie(),O(),AE(),IE(),Q(),rp(),M(),h(),In(),gT(),di(),Vr(),Ii(),ur(),aT(),vy(),hr(),PD(),ce(),LD=sa(),RD=`1p_failed_events.`,zD=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(FD(),`${RD}${at()}.${LD}.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(FD(),{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(FD(),{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=`${RD}${at()}.`,t;try{t=(await da(FD())).filter(t=>t.startsWith(e)&&t.endsWith(`.json`)).filter(e=>!e.includes(LD))}catch(e){if(Ln(e))return;throw e}for(let e of t){let t=Ui.join(FD(),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=ID(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":iT(),"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();yw()?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`}:mT(),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:FE.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:kE.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=yD(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:kE.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 VD(e){return zO(HD,{})?.[e]===!0}var HD,UD=t((()=>{ik(),HD=`tengu_frond_boric`}));function WD(){return zO(tO,{})}function GD(e){let t=WD()[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 KD(){return zO(nO,{})}async function qD(){if(iO)try{await iO.shutdown(),process.env.USER_TYPE===`ant`&&A(`1P event logging: final shutdown complete`)}catch{}}function JD(){return!lE()}async function YD(e,t,n={}){try{let r=await vD({model:n.model,betas:n.betas}),i={event_name:t,event_id:sa(),core_metadata:r,user_metadata:wT(!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 XD(e,t={}){JD()&&(!rO||VD(`firstParty`)||YD(rO,e,t))}function ZD(){return`production`}function QD(e){if(!JD()||!rO||VD(`firstParty`))return;let t=zf(),{accountUuid:n,organizationUuid:r}=wT(!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:ZD()};process.env.USER_TYPE===`ant`&&A(`[ANT-ONLY] 1P GrowthBook experiment: ${e.experimentId} variation=${e.variationId}`),rO.emit({body:`growthbook_experiment`,attributes:i})}function $D(){if(wi(`1p_event_logging_start`),!JD()){process.env.USER_TYPE===`ant`&&A(`1P event logging not enabled`);return}let e=KD();aO=e,wi(`1p_event_after_growthbook_config`);let t=e.scheduledDelayMillis||parseInt(process.env.OTEL_LOGS_EXPORT_INTERVAL||oO.toString(),10),n=e.maxExportBatchSize||sO,r=e.maxQueueSize||cO,i=Gr(),a={[xe]:`claude-code`,[ve]:`2.6.0`};if(i===`wsl`){let e=Wr();e&&(a[`wsl.version`]=e)}iO=new XT({resource:Oe(a),processors:[new iE(new zD({maxBatchSize:n,skipAuth:e.skipAuth,maxAttempts:e.maxAttempts,path:e.path,baseUrl:e.baseUrl,isKilled:()=>VD(`firstParty`)}),{scheduledDelayMillis:t,maxExportBatchSize:n,maxQueueSize:r})]}),rO=iO.getLogger(`com.anthropic.claude_code.events`,`2.6.0`)}async function eO(){if(!JD()||!iO||ku(KD(),aO))return;process.env.USER_TYPE===`ant`&&A(`1P event logging: ${nO} changed, reinitializing`);let e=iO,t=rO;rO=null;try{await e.forceFlush()}catch{}iO=null;try{$D()}catch(n){iO=e,rO=t,I(n);return}e.shutdown().catch(()=>{})}var tO,nO,rO,iO,aO,oO,sO,cO,lO=t((()=>{ke(),cE(),Ee(),Td(),rp(),M(),Vr(),qr(),ur(),Ti(),ET(),dE(),BD(),ik(),PD(),UD(),tO=`tengu_event_sampling_config`,nO=`tengu_1p_event_batch_config`,rO=null,iO=null,aO=null,oO=1e4,sO=200,cO=8192}));function uO(e){try{Promise.resolve(e()).catch(e=>{I(e)})}catch(e){I(e)}}function dO(e){let t=!0,n=YO.subscribe(()=>uO(e));return GO.size>0&&queueMicrotask(()=>{t&&GO.size>0&&uO(e)}),()=>{t=!1,n()}}function fO(){if(!ZO&&(ZO=!0,process.env.USER_TYPE===`ant`)){let e=process.env.CLAUDE_INTERNAL_FC_OVERRIDES;if(e)try{XO=JSON.parse(e),A(`GrowthBook: Using env var overrides for ${Object.keys(XO).length} features: ${Object.keys(XO).join(`, `)}`)}catch{I(Error(`GrowthBook: Failed to parse CLAUDE_INTERNAL_FC_OVERRIDES: ${e}`))}}return XO}function pO(e){let t=fO();return t!==null&&e in t}function mO(){if(process.env.USER_TYPE===`ant`)try{return H().growthBookOverrides}catch{return}}function hO(){return GO.size>0?Object.fromEntries(GO):H().cachedGrowthBookFeatures??{}}function gO(){return mO()??{}}function _O(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}}}),YO.emit()}catch(e){I(e)}}function vO(){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}),YO.emit()}catch(e){I(e)}}function yO(e){if(qO.has(e))return;let t=WO.get(e);t&&(qO.add(e),QD({experimentId:t.experimentId,variationId:t.variationId,userAttributes:TO(),experimentMetadata:{feature_id:e}}))}async function bO(e){let t=e.getPayload();if(!t?.features||Object.keys(t.features).length===0)return!1;WO.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&&WO.set(e,{experimentId:r.key,variationId:n.variationId})}}await e.setPayload({...t,features:n}),GO.clear();for(let[e,t]of Object.entries(n)){let n=`value`in t?t.value:t.defaultValue;n!==void 0&&GO.set(e,n)}return!0}function xO(){let e=Object.fromEntries(GO);ku(H().cachedGrowthBookFeatures,e)||V(t=>({...t,cachedGrowthBookFeatures:e}))}function SO(e){if(!process.env.CLAUDE_CODE_DISABLE_LOCAL_GATES)return QO[e]}function CO(){return process.env.CLAUDE_GB_ADAPTER_URL&&process.env.CLAUDE_GB_ADAPTER_KEY?!0:JD()}function wO(){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 TO(){let e=yT(),t=e.email;!t&&process.env.USER_TYPE===`ant`&&(t=H().oauthAccount?.emailAddress);let n=wO();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 EO(e,t,n){let r=fO();if(r&&e in r)return r[e];let i=mO();if(i&&e in i)return i[e];if(!CO()){let n=SO(e);return n===void 0?t:n}let a=await ek();if(!a){let n=SO(e);return n===void 0?t:n}let o;return o=GO.has(e)?GO.get(e):a.getFeatureValue(e,t),n&&yO(e),process.env.USER_TYPE===`ant`&&A(`GrowthBook: getFeatureValue("${e}") = ${k(o)}`),o}async function DO(e,t){return EO(e,t,!0)}function OO(e,t){let n=fO();if(n&&e in n)return n[e];let r=mO();if(r&&e in r)return r[e];if(!CO()){let n=SO(e);return n===void 0?t:n}let i=SO(e);if(i!==void 0)return i;if(WO.has(e)?yO(e):KO.add(e),GO.has(e))return GO.get(e);try{let t=H().cachedGrowthBookFeatures?.[e];if(t!==void 0)return t}catch{}return t}function kO(e,t,n){return OO(e,t)}function AO(e){let t=fO();if(t&&e in t)return!!t[e];let n=mO();if(n&&e in n)return!!n[e];if(!CO()){let t=SO(e);return t===void 0?!1:!!t}WO.has(e)?yO(e):KO.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=SO(e);return r===void 0?!1:!!r}async function jO(e){let t=fO();if(t&&e in t)return!!t[e];let n=mO();if(n&&e in n)return!!n[e];if(!CO())return!1;JO&&await JO;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 MO(e){let t=fO();if(t&&e in t)return!!t[e];let n=mO();if(n&&e in n)return!!n[e];if(!CO()){let t=SO(e);return t===void 0?!1:!!t}return H().cachedGrowthBookFeatures?.[e]===!0?(WO.has(e)?yO(e):KO.add(e),!0):EO(e,!1,!0)}function NO(){if(CO())try{PO(),YO.emit(),JO=ek().catch(e=>(I(kn(e)),null)).finally(()=>{JO=null})}catch(e){I(kn(e))}}function PO(){LO(),VO&&(process.off(`beforeExit`,VO),VO=null),HO&&(process.off(`exit`,HO),HO=null),BO?.destroy(),BO=null,UO=!1,JO=null,WO.clear(),KO.clear(),qO.clear(),GO.clear(),$O.cache?.clear?.(),ek.cache?.clear?.(),XO=null,ZO=!1}async function FO(){if(CO())try{let e=await ek();if(!e)return;if(await e.refreshFeatures(),e!==BO){process.env.USER_TYPE===`ant`&&A(`GrowthBook: Skipping refresh processing for replaced client`);return}let t=await bO(e);if(e!==BO)return;process.env.USER_TYPE===`ant`&&A(`GrowthBook: Light refresh completed`),t&&(xO(),YO.emit())}catch(e){I(kn(e))}}function IO(){CO()&&(nk&&clearInterval(nk),nk=setInterval(()=>{FO()},tk),nk.unref?.(),rk||(rk=()=>{LO()},process.once(`beforeExit`,rk)))}function LO(){nk&&(clearInterval(nk),nk=null),rk&&(process.removeListener(`beforeExit`,rk),rk=null)}async function RO(e,t){return DO(e,t)}function zO(e,t){return OO(e,t)}var BO,VO,HO,UO,WO,GO,KO,qO,JO,YO,XO,ZO,QO,$O,ek,tk,nk,rk,ik=t((()=>{lc(),Td(),O(),Dd(),rp(),M(),In(),gT(),Vr(),ft(),ur(),ET(),lO(),BO=null,VO=null,HO=null,UO=!1,WO=new Map,GO=new Map,KO=new Set,qO=new Set,JO=null,YO=Ot(),XO=null,ZO=!1,QO={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},$O=p(()=>{if(!CO())return null;let e=TO(),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()?mT():{headers:{},error:`trust not established`},a=r||!i.error;UO=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(BO=o,!a)return{client:o,initialized:Promise.resolve()};let s=o.init({timeout:5e3}).then(async e=>{if(BO!==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 bO(o);if(BO===o){if(t){for(let e of KO)yO(e);KO.clear(),xO(),YO.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 VO=()=>BO?.destroy(),HO=()=>BO?.destroy(),process.on(`beforeExit`,VO),process.on(`exit`,HO),{client:o,initialized:s}}),ek=p(async()=>{let e=$O();return!e||!UO&&(gf()||lt()||Mt())&&!mT().error&&(process.env.USER_TYPE===`ant`&&A(`GrowthBook: Auth became available after client creation, reinitializing`),PO(),e=$O(),!e)?null:(await e.initialized,IO(),e.client)}),tk=process.env.USER_TYPE===`ant`?1200*1e3:360*60*1e3,nk=null,rk=null}));function ak(){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 ok(){return OO(`tengu_passport_quail`,!1)?!Mt()||OO(`tengu_slate_thimble`,!1):!1}function sk(){return process.env.CLAUDE_CODE_REMOTE_MEMORY_DIR?process.env.CLAUDE_CODE_REMOTE_MEMORY_DIR:ae()}function ck(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 lk(){return ck(process.env.CLAUDE_COWORK_MEMORY_PATH_OVERRIDE,!1)}function uk(){return ck(U(`policySettings`)?.autoMemoryDirectory??U(`flagSettings`)?.autoMemoryDirectory??U(`localSettings`)?.autoMemoryDirectory??U(`userSettings`)?.autoMemoryDirectory,!0)}function dk(){return lk()!==void 0}function fk(){return Sr(xn())??xn()}function pk(){return R(_k(),gk)}function mk(e){return Ji(e).startsWith(_k())}var hk,gk,_k,vk=t((()=>{m(),O(),ik(),h(),wr(),$r(),Y_(),hk=`memory`,gk=`MEMORY.md`,_k=p(()=>(lk()??uk())||(R(R(sk(),`projects`),Zr(fk()),hk)+Zi).normalize(`NFC`),()=>xn())}));export{$E as $,O_ as $a,zd as $c,Py as $i,qS as $n,bh as $o,hx as $r,Sp as $s,kw as $t,LO as A,Av as Aa,rp as Ac,ub as Ai,Xu as Al,lw as An,Zh as Ao,Gx as Ar,im as As,iT as At,UD as B,Q_ as Ba,cf as Bc,eb as Bi,Bl,fC as Bn,Vh as Bo,Jx as Br,Jp as Bs,Lw as Bt,ek as C,Bv as Ca,yf as Cc,zb as Ci,dd as Cl,qC as Cn,yg as Co,Rx as Cr,_m as Cs,pT as Ct,PO as D,Iv as Da,np as Dc,Mb as Di,$u as Dl,YC as Dn,Yh as Do,jx as Dr,om as Ds,oT as Dt,FO as E,Uv as Ea,zf as Ec,Ub as Ei,id as El,Gw as En,ig as Eo,Px as Er,fm as Es,cT as Et,XD as F,wv as Fa,If as Fc,ib as Fi,Au as Fl,CC as Fn,tg as Fo,Zx as Fr,Wp as Fs,ew as Ft,vD as G,G_ as Ga,Yd as Gc,lb as Gi,BS as Gn,Mh as Go,wx as Gr,Up as Gs,Xw as Gt,uD as H,iv as Ha,uf as Hc,Yy as Hi,Zc as Hl,cC as Hn,jh as Ho,qx as Hr,Bp as Hs,NC as Ht,QD as I,Cv as Ia,ff as Ic,qy as Ii,ku as Il,EC as In,ng as Io,kx as Ir,qp as Is,KC as It,PD as J,L_ as Ja,Hd as Jc,Hy as Ji,QS as Jn,Oh as Jo,Sx as Jr,Fp as Js,Z as Jt,mD as K,z_ as Ka,Ud as Kc,Uy as Ki,$S as Kn,Ih as Ko,Ex as Kr,Np as Ks,VC as Kt,eO as L,gv as La,df as Lc,Jy as Li,bu as Ll,gC as Ln,Rh as Lo,Ux as Lr,$p as Ls,ZC as Lt,lO as M,Nv as Ma,Bf as Mc,pb as Mi,Wu as Ml,dw as Mn,$h as Mo,Ox as Mr,Qp as Ms,DC as Mt,$D as N,W as Na,Pf as Nc,fb as Ni,Mu as Nl,Rw as Nn,eg as No,Ax as Nr,nm as Ns,BC as Nt,_O as O,Pv as Oa,Tf as Oc,jb as Oi,Qu as Ol,nw as On,Qh as Oo,$x as Or,sm as Os,uT as Ot,JD as P,Sv as Pa,V as Pc,ob as Pi,ju as Pl,wC as Pn,Xh as Po,nS as Pr,Yp as Ps,_w as Pt,rD as Q,U as Qa,Rd as Qc,jy as Qi,KS as Qn,Eh as Qo,px as Qr,Cp as Qs,Pw as Qt,GD as R,xv as Ra,pf as Rc,Qy as Ri,yu as Rl,SC as Rn,qh as Ro,Qx as Rr,Xp as Rs,rw as Rt,ik as S,zv as Sa,H as Sc,bb as Si,fd as Sl,jw as Sn,Og as So,Fx as Sr,vm as Ss,dT as St,NO as T,Kv as Ta,Vf as Tc,Vb as Ti,ad as Tl,iw as Tn,bg as To,Nx as Tr,gm as Ts,hT as Tt,dD as U,ov as Ua,of as Uc,$y as Ui,iC as Un,Ph as Uo,Wx as Ur,Hp as Us,HC as Ut,VD as V,tv as Va,lf as Vc,nb as Vi,il as Vl,pC as Vn,Hh as Vo,Vx as Vr,Kp as Vs,jC as Vt,pD as W,$_ as Wa,af as Wc,cb as Wi,YS as Wn,Nh as Wo,Yx as Wr,Vp as Ws,GC as Wt,lD as X,j_ as Xa,ef as Xc,Ly as Xi,GS as Xn,kh as Xo,xx as Xr,Op as Xs,PC as Xt,sD as Y,N_ as Ya,Kd as Yc,Ry as Yi,eC as Yn,Dh as Yo,Cx as Yr,Dp as Ys,gw as Yt,oD as Z,A_ as Za,Gd as Zc,Iy as Zi,WS as Zn,Th as Zo,bx as Zr,Tp as Zs,xw as Zt,OO as _,ry as _a,kf as _c,wb as _i,wd as _l,Nw as _n,r_ as _o,lS as _r,nh as _s,_T as _t,vk as a,fy as aa,yp as ac,Qb as ai,Id as al,yw as an,H_ as ao,TS as ar,vh as as,KE as at,gO as b,Hv as ba,Nf as bc,Ob as bi,yd as bl,Ew as bn,Eg as bo,zx as br,th as bs,mT as bt,ok as c,my as ca,lp as cc,ux as ci,Qd as cl,kC as cn,K_ as co,ES as cr,gh as cs,dE as ct,AO as d,py as da,cp as dc,vb as di,Bd as dl,Y as dn,u_ as do,PS as dr,ym as ds,cE as dt,Dy as ea,bp as ec,ox as ei,sf as el,Aw as en,V_ as eo,LS as er,xh as es,nD as et,vO as f,sy as fa,op as fc,xb as fi,Od as fl,Iw as fn,l_ as fo,bS as fr,oh as fs,iE as ft,zO as g,_y as ga,gf as gc,Db as gi,Td as gl,ww as gn,o_ as go,iS as gr,Mm as gs,TT as gt,RO as h,oy as ha,Kf as hc,yb as hi,Ad as hl,$C as hn,d_ as ho,cS as hr,Gm as hs,wT as ht,dk as i,cy as ia,wp as ic,$b as ii,nf as il,Cw as in,U_ as io,NS as ir,hh as is,ZE as it,WD as j,G as ja,Ff as jc,db as ji,Gu as jl,sw as jn,ag as jo,Ix as jr,em as js,aT as jt,IO as k,Rv as ka,Uf as kc,Sb as ki,Zu as kl,Yw as kn,Jh as ko,Hx as kr,rm as ks,sT as kt,MO as l,hy as la,hp as lc,Nb as li,Xd as ll,LC as ln,P_ as lo,wS as lr,yh as ls,lE as lt,wO as m,uy as ma,ip as mc,_b as mi,jd as ml,Dw as mn,f_ as mo,hS as mr,dh as ms,XT as mt,_k as n,yy as na,Ap as nc,nx as ni,Zd as nl,mw as nn,J_ as no,MS as nr,Sh as ns,eD as nt,mk as o,ly as oa,gp as oc,tx as oi,rf as ol,Q as on,Y_ as oo,CS as or,_h as os,HE as ot,hO as p,gy as pa,ap as pc,kb as pi,Md as pl,cw as pn,x_ as po,yS as pr,lh as ps,QT as pt,hD as q,w_ as qa,Vd as qc,Wy as qi,JS as qn,Ah as qo,Dx as qr,Mp as qs,AC as qt,sk as r,by as ra,Ep as rc,lx as ri,tf as rl,MC as rn,W_ as ro,kS as rr,wh as rs,QE as rt,ak as s,dy as sa,dp as sc,Jb as si,Ld as sl,bw as sn,E_ as so,DS as sr,mh as ss,qE as st,pk as t,Oy as ta,xp as tc,sx as ti,Jd as tl,X as tn,B_ as to,RS as tr,Ch as ts,aD as tt,jO as u,vy as ua,sp as uc,Cb as ui,qd as ul,zC as un,c_ as uo,xS as ur,ph as us,uE as ut,kO as v,iy as va,Lf as vc,qb as vi,Cd as vl,Sw as vn,Gg as vo,J as vr,Ym as vs,ET as vt,dO as w,ny as wa,Hf as wc,Rb as wi,ud as wl,aw as wn,vg as wo,Lx as wr,mm as ws,gT as wt,pO as x,qv as xa,Ef as xc,mb as xi,pd as xl,Tw as xn,Dg as xo,Bx as xr,fh as xs,fT as xt,DO as y,ay as ya,Rf as yc,hb as yi,bd as yl,Ow as yn,Ug as yo,Mx as yr,eh as ys,vT as yt,qD as z,nv as za,mf as zc,tb as zi,zl,hC as zn,Lh as zo,eS as zr,Zp as zs,fw as zt};
39
+ `,`utf8`)}catch(e){I(e)}}async deleteFile(e){try{await ma(e)}catch{}}async retryPreviousBatches(){try{let e=`${RD}${at()}.`,t;try{t=(await da(FD())).filter(t=>t.startsWith(e)&&t.endsWith(`.json`)).filter(e=>!e.includes(LD))}catch(e){if(Ln(e))return;throw e}for(let e of t){let t=Ui.join(FD(),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=ID(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":iT(),"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();yw()?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`}:mT(),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:FE.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:kE.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=yD(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:kE.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 VD(e){return zO(HD,{})?.[e]===!0}var HD,UD=t((()=>{ik(),HD=`tengu_frond_boric`}));function WD(){return zO(tO,{})}function GD(e){let t=WD()[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 KD(){return zO(nO,{})}async function qD(){if(iO)try{await iO.shutdown(),process.env.USER_TYPE===`ant`&&A(`1P event logging: final shutdown complete`)}catch{}}function JD(){return!lE()}async function YD(e,t,n={}){try{let r=await vD({model:n.model,betas:n.betas}),i={event_name:t,event_id:sa(),core_metadata:r,user_metadata:wT(!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 XD(e,t={}){JD()&&(!rO||VD(`firstParty`)||YD(rO,e,t))}function ZD(){return`production`}function QD(e){if(!JD()||!rO||VD(`firstParty`))return;let t=zf(),{accountUuid:n,organizationUuid:r}=wT(!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:ZD()};process.env.USER_TYPE===`ant`&&A(`[ANT-ONLY] 1P GrowthBook experiment: ${e.experimentId} variation=${e.variationId}`),rO.emit({body:`growthbook_experiment`,attributes:i})}function $D(){if(wi(`1p_event_logging_start`),!JD()){process.env.USER_TYPE===`ant`&&A(`1P event logging not enabled`);return}let e=KD();aO=e,wi(`1p_event_after_growthbook_config`);let t=e.scheduledDelayMillis||parseInt(process.env.OTEL_LOGS_EXPORT_INTERVAL||oO.toString(),10),n=e.maxExportBatchSize||sO,r=e.maxQueueSize||cO,i=Gr(),a={[xe]:`claude-code`,[ve]:`2.6.5`};if(i===`wsl`){let e=Wr();e&&(a[`wsl.version`]=e)}iO=new XT({resource:Oe(a),processors:[new iE(new zD({maxBatchSize:n,skipAuth:e.skipAuth,maxAttempts:e.maxAttempts,path:e.path,baseUrl:e.baseUrl,isKilled:()=>VD(`firstParty`)}),{scheduledDelayMillis:t,maxExportBatchSize:n,maxQueueSize:r})]}),rO=iO.getLogger(`com.anthropic.claude_code.events`,`2.6.5`)}async function eO(){if(!JD()||!iO||ku(KD(),aO))return;process.env.USER_TYPE===`ant`&&A(`1P event logging: ${nO} changed, reinitializing`);let e=iO,t=rO;rO=null;try{await e.forceFlush()}catch{}iO=null;try{$D()}catch(n){iO=e,rO=t,I(n);return}e.shutdown().catch(()=>{})}var tO,nO,rO,iO,aO,oO,sO,cO,lO=t((()=>{ke(),cE(),Ee(),Td(),rp(),M(),Vr(),qr(),ur(),Ti(),ET(),dE(),BD(),ik(),PD(),UD(),tO=`tengu_event_sampling_config`,nO=`tengu_1p_event_batch_config`,rO=null,iO=null,aO=null,oO=1e4,sO=200,cO=8192}));function uO(e){try{Promise.resolve(e()).catch(e=>{I(e)})}catch(e){I(e)}}function dO(e){let t=!0,n=YO.subscribe(()=>uO(e));return GO.size>0&&queueMicrotask(()=>{t&&GO.size>0&&uO(e)}),()=>{t=!1,n()}}function fO(){if(!ZO&&(ZO=!0,process.env.USER_TYPE===`ant`)){let e=process.env.CLAUDE_INTERNAL_FC_OVERRIDES;if(e)try{XO=JSON.parse(e),A(`GrowthBook: Using env var overrides for ${Object.keys(XO).length} features: ${Object.keys(XO).join(`, `)}`)}catch{I(Error(`GrowthBook: Failed to parse CLAUDE_INTERNAL_FC_OVERRIDES: ${e}`))}}return XO}function pO(e){let t=fO();return t!==null&&e in t}function mO(){if(process.env.USER_TYPE===`ant`)try{return H().growthBookOverrides}catch{return}}function hO(){return GO.size>0?Object.fromEntries(GO):H().cachedGrowthBookFeatures??{}}function gO(){return mO()??{}}function _O(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}}}),YO.emit()}catch(e){I(e)}}function vO(){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}),YO.emit()}catch(e){I(e)}}function yO(e){if(qO.has(e))return;let t=WO.get(e);t&&(qO.add(e),QD({experimentId:t.experimentId,variationId:t.variationId,userAttributes:TO(),experimentMetadata:{feature_id:e}}))}async function bO(e){let t=e.getPayload();if(!t?.features||Object.keys(t.features).length===0)return!1;WO.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&&WO.set(e,{experimentId:r.key,variationId:n.variationId})}}await e.setPayload({...t,features:n}),GO.clear();for(let[e,t]of Object.entries(n)){let n=`value`in t?t.value:t.defaultValue;n!==void 0&&GO.set(e,n)}return!0}function xO(){let e=Object.fromEntries(GO);ku(H().cachedGrowthBookFeatures,e)||V(t=>({...t,cachedGrowthBookFeatures:e}))}function SO(e){if(!process.env.CLAUDE_CODE_DISABLE_LOCAL_GATES)return QO[e]}function CO(){return process.env.CLAUDE_GB_ADAPTER_URL&&process.env.CLAUDE_GB_ADAPTER_KEY?!0:JD()}function wO(){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 TO(){let e=yT(),t=e.email;!t&&process.env.USER_TYPE===`ant`&&(t=H().oauthAccount?.emailAddress);let n=wO();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 EO(e,t,n){let r=fO();if(r&&e in r)return r[e];let i=mO();if(i&&e in i)return i[e];if(!CO()){let n=SO(e);return n===void 0?t:n}let a=await ek();if(!a){let n=SO(e);return n===void 0?t:n}let o;return o=GO.has(e)?GO.get(e):a.getFeatureValue(e,t),n&&yO(e),process.env.USER_TYPE===`ant`&&A(`GrowthBook: getFeatureValue("${e}") = ${k(o)}`),o}async function DO(e,t){return EO(e,t,!0)}function OO(e,t){let n=fO();if(n&&e in n)return n[e];let r=mO();if(r&&e in r)return r[e];if(!CO()){let n=SO(e);return n===void 0?t:n}let i=SO(e);if(i!==void 0)return i;if(WO.has(e)?yO(e):KO.add(e),GO.has(e))return GO.get(e);try{let t=H().cachedGrowthBookFeatures?.[e];if(t!==void 0)return t}catch{}return t}function kO(e,t,n){return OO(e,t)}function AO(e){let t=fO();if(t&&e in t)return!!t[e];let n=mO();if(n&&e in n)return!!n[e];if(!CO()){let t=SO(e);return t===void 0?!1:!!t}WO.has(e)?yO(e):KO.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=SO(e);return r===void 0?!1:!!r}async function jO(e){let t=fO();if(t&&e in t)return!!t[e];let n=mO();if(n&&e in n)return!!n[e];if(!CO())return!1;JO&&await JO;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 MO(e){let t=fO();if(t&&e in t)return!!t[e];let n=mO();if(n&&e in n)return!!n[e];if(!CO()){let t=SO(e);return t===void 0?!1:!!t}return H().cachedGrowthBookFeatures?.[e]===!0?(WO.has(e)?yO(e):KO.add(e),!0):EO(e,!1,!0)}function NO(){if(CO())try{PO(),YO.emit(),JO=ek().catch(e=>(I(kn(e)),null)).finally(()=>{JO=null})}catch(e){I(kn(e))}}function PO(){LO(),VO&&(process.off(`beforeExit`,VO),VO=null),HO&&(process.off(`exit`,HO),HO=null),BO?.destroy(),BO=null,UO=!1,JO=null,WO.clear(),KO.clear(),qO.clear(),GO.clear(),$O.cache?.clear?.(),ek.cache?.clear?.(),XO=null,ZO=!1}async function FO(){if(CO())try{let e=await ek();if(!e)return;if(await e.refreshFeatures(),e!==BO){process.env.USER_TYPE===`ant`&&A(`GrowthBook: Skipping refresh processing for replaced client`);return}let t=await bO(e);if(e!==BO)return;process.env.USER_TYPE===`ant`&&A(`GrowthBook: Light refresh completed`),t&&(xO(),YO.emit())}catch(e){I(kn(e))}}function IO(){CO()&&(nk&&clearInterval(nk),nk=setInterval(()=>{FO()},tk),nk.unref?.(),rk||(rk=()=>{LO()},process.once(`beforeExit`,rk)))}function LO(){nk&&(clearInterval(nk),nk=null),rk&&(process.removeListener(`beforeExit`,rk),rk=null)}async function RO(e,t){return DO(e,t)}function zO(e,t){return OO(e,t)}var BO,VO,HO,UO,WO,GO,KO,qO,JO,YO,XO,ZO,QO,$O,ek,tk,nk,rk,ik=t((()=>{lc(),Td(),O(),Dd(),rp(),M(),In(),gT(),Vr(),ft(),ur(),ET(),lO(),BO=null,VO=null,HO=null,UO=!1,WO=new Map,GO=new Map,KO=new Set,qO=new Set,JO=null,YO=Ot(),XO=null,ZO=!1,QO={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},$O=p(()=>{if(!CO())return null;let e=TO(),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()?mT():{headers:{},error:`trust not established`},a=r||!i.error;UO=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(BO=o,!a)return{client:o,initialized:Promise.resolve()};let s=o.init({timeout:5e3}).then(async e=>{if(BO!==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 bO(o);if(BO===o){if(t){for(let e of KO)yO(e);KO.clear(),xO(),YO.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 VO=()=>BO?.destroy(),HO=()=>BO?.destroy(),process.on(`beforeExit`,VO),process.on(`exit`,HO),{client:o,initialized:s}}),ek=p(async()=>{let e=$O();return!e||!UO&&(gf()||lt()||Mt())&&!mT().error&&(process.env.USER_TYPE===`ant`&&A(`GrowthBook: Auth became available after client creation, reinitializing`),PO(),e=$O(),!e)?null:(await e.initialized,IO(),e.client)}),tk=process.env.USER_TYPE===`ant`?1200*1e3:360*60*1e3,nk=null,rk=null}));function ak(){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 ok(){return OO(`tengu_passport_quail`,!1)?!Mt()||OO(`tengu_slate_thimble`,!1):!1}function sk(){return process.env.CLAUDE_CODE_REMOTE_MEMORY_DIR?process.env.CLAUDE_CODE_REMOTE_MEMORY_DIR:ae()}function ck(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 lk(){return ck(process.env.CLAUDE_COWORK_MEMORY_PATH_OVERRIDE,!1)}function uk(){return ck(U(`policySettings`)?.autoMemoryDirectory??U(`flagSettings`)?.autoMemoryDirectory??U(`localSettings`)?.autoMemoryDirectory??U(`userSettings`)?.autoMemoryDirectory,!0)}function dk(){return lk()!==void 0}function fk(){return Sr(xn())??xn()}function pk(){return R(_k(),gk)}function mk(e){return Ji(e).startsWith(_k())}var hk,gk,_k,vk=t((()=>{m(),O(),ik(),h(),wr(),$r(),Y_(),hk=`memory`,gk=`MEMORY.md`,_k=p(()=>(lk()??uk())||(R(R(sk(),`projects`),Zr(fk()),hk)+Zi).normalize(`NFC`),()=>xn())}));export{$E as $,O_ as $a,zd as $c,Py as $i,qS as $n,bh as $o,hx as $r,Sp as $s,kw as $t,LO as A,Av as Aa,rp as Ac,ub as Ai,Xu as Al,lw as An,Zh as Ao,Gx as Ar,im as As,iT as At,UD as B,Q_ as Ba,cf as Bc,eb as Bi,Bl,fC as Bn,Vh as Bo,Jx as Br,Jp as Bs,Lw as Bt,ek as C,Bv as Ca,yf as Cc,zb as Ci,dd as Cl,qC as Cn,yg as Co,Rx as Cr,_m as Cs,pT as Ct,PO as D,Iv as Da,np as Dc,Mb as Di,$u as Dl,YC as Dn,Yh as Do,jx as Dr,om as Ds,oT as Dt,FO as E,Uv as Ea,zf as Ec,Ub as Ei,id as El,Gw as En,ig as Eo,Px as Er,fm as Es,cT as Et,XD as F,wv as Fa,If as Fc,ib as Fi,Au as Fl,CC as Fn,tg as Fo,Zx as Fr,Wp as Fs,ew as Ft,vD as G,G_ as Ga,Yd as Gc,lb as Gi,BS as Gn,Mh as Go,wx as Gr,Up as Gs,Xw as Gt,uD as H,iv as Ha,uf as Hc,Yy as Hi,Zc as Hl,cC as Hn,jh as Ho,qx as Hr,Bp as Hs,NC as Ht,QD as I,Cv as Ia,ff as Ic,qy as Ii,ku as Il,EC as In,ng as Io,kx as Ir,qp as Is,KC as It,PD as J,L_ as Ja,Hd as Jc,Hy as Ji,QS as Jn,Oh as Jo,Sx as Jr,Fp as Js,Z as Jt,mD as K,z_ as Ka,Ud as Kc,Uy as Ki,$S as Kn,Ih as Ko,Ex as Kr,Np as Ks,VC as Kt,eO as L,gv as La,df as Lc,Jy as Li,bu as Ll,gC as Ln,Rh as Lo,Ux as Lr,$p as Ls,ZC as Lt,lO as M,Nv as Ma,Bf as Mc,pb as Mi,Wu as Ml,dw as Mn,$h as Mo,Ox as Mr,Qp as Ms,DC as Mt,$D as N,W as Na,Pf as Nc,fb as Ni,Mu as Nl,Rw as Nn,eg as No,Ax as Nr,nm as Ns,BC as Nt,_O as O,Pv as Oa,Tf as Oc,jb as Oi,Qu as Ol,nw as On,Qh as Oo,$x as Or,sm as Os,uT as Ot,JD as P,Sv as Pa,V as Pc,ob as Pi,ju as Pl,wC as Pn,Xh as Po,nS as Pr,Yp as Ps,_w as Pt,rD as Q,U as Qa,Rd as Qc,jy as Qi,KS as Qn,Eh as Qo,px as Qr,Cp as Qs,Pw as Qt,GD as R,xv as Ra,pf as Rc,Qy as Ri,yu as Rl,SC as Rn,qh as Ro,Qx as Rr,Xp as Rs,rw as Rt,ik as S,zv as Sa,H as Sc,bb as Si,fd as Sl,jw as Sn,Og as So,Fx as Sr,vm as Ss,dT as St,NO as T,Kv as Ta,Vf as Tc,Vb as Ti,ad as Tl,iw as Tn,bg as To,Nx as Tr,gm as Ts,hT as Tt,dD as U,ov as Ua,of as Uc,$y as Ui,iC as Un,Ph as Uo,Wx as Ur,Hp as Us,HC as Ut,VD as V,tv as Va,lf as Vc,nb as Vi,il as Vl,pC as Vn,Hh as Vo,Vx as Vr,Kp as Vs,jC as Vt,pD as W,$_ as Wa,af as Wc,cb as Wi,YS as Wn,Nh as Wo,Yx as Wr,Vp as Ws,GC as Wt,lD as X,j_ as Xa,ef as Xc,Ly as Xi,GS as Xn,kh as Xo,xx as Xr,Op as Xs,PC as Xt,sD as Y,N_ as Ya,Kd as Yc,Ry as Yi,eC as Yn,Dh as Yo,Cx as Yr,Dp as Ys,gw as Yt,oD as Z,A_ as Za,Gd as Zc,Iy as Zi,WS as Zn,Th as Zo,bx as Zr,Tp as Zs,xw as Zt,OO as _,ry as _a,kf as _c,wb as _i,wd as _l,Nw as _n,r_ as _o,lS as _r,nh as _s,_T as _t,vk as a,fy as aa,yp as ac,Qb as ai,Id as al,yw as an,H_ as ao,TS as ar,vh as as,KE as at,gO as b,Hv as ba,Nf as bc,Ob as bi,yd as bl,Ew as bn,Eg as bo,zx as br,th as bs,mT as bt,ok as c,my as ca,lp as cc,ux as ci,Qd as cl,kC as cn,K_ as co,ES as cr,gh as cs,dE as ct,AO as d,py as da,cp as dc,vb as di,Bd as dl,Y as dn,u_ as do,PS as dr,ym as ds,cE as dt,Dy as ea,bp as ec,ox as ei,sf as el,Aw as en,V_ as eo,LS as er,xh as es,nD as et,vO as f,sy as fa,op as fc,xb as fi,Od as fl,Iw as fn,l_ as fo,bS as fr,oh as fs,iE as ft,zO as g,_y as ga,gf as gc,Db as gi,Td as gl,ww as gn,o_ as go,iS as gr,Mm as gs,TT as gt,RO as h,oy as ha,Kf as hc,yb as hi,Ad as hl,$C as hn,d_ as ho,cS as hr,Gm as hs,wT as ht,dk as i,cy as ia,wp as ic,$b as ii,nf as il,Cw as in,U_ as io,NS as ir,hh as is,ZE as it,WD as j,G as ja,Ff as jc,db as ji,Gu as jl,sw as jn,ag as jo,Ix as jr,em as js,aT as jt,IO as k,Rv as ka,Uf as kc,Sb as ki,Zu as kl,Yw as kn,Jh as ko,Hx as kr,rm as ks,sT as kt,MO as l,hy as la,hp as lc,Nb as li,Xd as ll,LC as ln,P_ as lo,wS as lr,yh as ls,lE as lt,wO as m,uy as ma,ip as mc,_b as mi,jd as ml,Dw as mn,f_ as mo,hS as mr,dh as ms,XT as mt,_k as n,yy as na,Ap as nc,nx as ni,Zd as nl,mw as nn,J_ as no,MS as nr,Sh as ns,eD as nt,mk as o,ly as oa,gp as oc,tx as oi,rf as ol,Q as on,Y_ as oo,CS as or,_h as os,HE as ot,hO as p,gy as pa,ap as pc,kb as pi,Md as pl,cw as pn,x_ as po,yS as pr,lh as ps,QT as pt,hD as q,w_ as qa,Vd as qc,Wy as qi,JS as qn,Ah as qo,Dx as qr,Mp as qs,AC as qt,sk as r,by as ra,Ep as rc,lx as ri,tf as rl,MC as rn,W_ as ro,kS as rr,wh as rs,QE as rt,ak as s,dy as sa,dp as sc,Jb as si,Ld as sl,bw as sn,E_ as so,DS as sr,mh as ss,qE as st,pk as t,Oy as ta,xp as tc,sx as ti,Jd as tl,X as tn,B_ as to,RS as tr,Ch as ts,aD as tt,jO as u,vy as ua,sp as uc,Cb as ui,qd as ul,zC as un,c_ as uo,xS as ur,ph as us,uE as ut,kO as v,iy as va,Lf as vc,qb as vi,Cd as vl,Sw as vn,Gg as vo,J as vr,Ym as vs,ET as vt,dO as w,ny as wa,Hf as wc,Rb as wi,ud as wl,aw as wn,vg as wo,Lx as wr,mm as ws,gT as wt,pO as x,qv as xa,Ef as xc,mb as xi,pd as xl,Tw as xn,Dg as xo,Bx as xr,fh as xs,fT as xt,DO as y,ay as ya,Rf as yc,hb as yi,bd as yl,Ow as yn,Ug as yo,Mx as yr,eh as ys,vT as yt,qD as z,nv as za,mf as zc,tb as zi,zl,hC as zn,Lh as zo,eS as zr,Zp as zs,fw as zt};