@readmagic/workmate 0.0.6 → 0.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (556) hide show
  1. package/dist/chunks/AddWorkspaceDirectory-CwLtQld4.js +1 -0
  2. package/dist/chunks/App-Ba52HvYC.js +1 -0
  3. package/dist/chunks/{ApproveApiKey-Bsy8kr2a.js → ApproveApiKey-CEIfuUh0.js} +1 -1
  4. package/dist/chunks/ApproveApiKey-D2MLQu2P.js +1 -0
  5. package/dist/chunks/BackgroundTasksDialog-IGDrkbWl.js +2 -0
  6. package/dist/chunks/{BypassPermissionsModeDialog-BKj_3Idm.js → BypassPermissionsModeDialog-GYhq--JR.js} +1 -1
  7. package/dist/chunks/{ClaudeMdExternalIncludesDialog-BD-7yAZh.js → ClaudeMdExternalIncludesDialog-C-CTa-95.js} +1 -1
  8. package/dist/chunks/ClaudeMdExternalIncludesDialog-Catv6BCJ.js +1 -0
  9. package/dist/chunks/ConsoleOAuthFlow-BeQXqUtX.js +1 -0
  10. package/dist/chunks/{DiffDialog-C4XSSjvV.js → DiffDialog-AC5DSJrq.js} +6 -6
  11. package/dist/chunks/Doctor-B9Rxsoy0.js +1 -0
  12. package/dist/chunks/Doctor-lhUBhEy5.js +3 -0
  13. package/dist/chunks/{ExitFlow-BttnAv-O.js → ExitFlow-Cu8SoQHs.js} +2 -2
  14. package/dist/chunks/Grove-Bc4CofEj.js +11 -0
  15. package/dist/chunks/{HybridTransport-B8V6O6rM.js → HybridTransport-BJPOG2wl.js} +3 -3
  16. package/dist/chunks/{InvalidConfigDialog-CHzBSJDf.js → InvalidConfigDialog-BI13il58.js} +1 -1
  17. package/dist/chunks/{InvalidSettingsDialog-BKenH3bD.js → InvalidSettingsDialog-CtOheV1K.js} +1 -1
  18. package/dist/chunks/MCPConnectionManager-ao-P3xSA.js +1 -0
  19. package/dist/chunks/MCPToolListView-dkofcJs4.js +1 -0
  20. package/dist/chunks/{McpParsingWarnings-Bj2-YL8o.js → McpParsingWarnings-BS4JoR5l.js} +1 -1
  21. package/dist/chunks/MessageSelector-B88b2ypw.js +3 -0
  22. package/dist/chunks/Messages-BPeI7lLV.js +11 -0
  23. package/dist/chunks/Onboarding-c2fQ8Io_.js +1 -0
  24. package/dist/chunks/{PromptInputFooterSuggestions-egs9VvUs.js → PromptInputFooterSuggestions-D1cH9sDX.js} +1 -1
  25. package/dist/chunks/{PromptInputHelpMenu-SieM5NoY.js → PromptInputHelpMenu-DDD5WuK0.js} +1 -1
  26. package/dist/chunks/QueryEngine-Cv_meCam.js +1 -0
  27. package/dist/chunks/REPL-BXhAQOXb.js +139 -0
  28. package/dist/chunks/REPL-YqjLnr3A.js +1 -0
  29. package/dist/chunks/RemoteSessionManager-CT7T8BaR.js +2 -0
  30. package/dist/chunks/ResumeConversation-CIZCjms9.js +1 -0
  31. package/dist/chunks/{SSETransport-DtpMDekF.js → SSETransport-CrwbKuVt.js} +3 -3
  32. package/dist/chunks/SearchExtraToolsTool-Dx6093yw.js +1 -0
  33. package/dist/chunks/Settings-CyUm0AtU.js +2 -0
  34. package/dist/chunks/{TeleportProgress-rYaHIEfe.js → TeleportProgress-C3qyp5zy.js} +1 -1
  35. package/dist/chunks/TeleportRepoMismatchDialog-BV--nyYn.js +1 -0
  36. package/dist/chunks/TeleportResumeWrapper-Blo2cZg-.js +1 -0
  37. package/dist/chunks/ThemePicker-EQ6hPUeI.js +1 -0
  38. package/dist/chunks/TrustDialog-BukWGvHZ.js +1 -0
  39. package/dist/chunks/{ValidationErrorsList-B8pRiGuy.js → ValidationErrorsList-DokTJQwi.js} +1 -1
  40. package/dist/chunks/{WelcomeV2-DqnbSdIu.js → WelcomeV2-Ci9VwPYh.js} +1 -1
  41. package/dist/chunks/{add-dir-C2Hu3oE4.js → add-dir-DPQV0qml.js} +1 -1
  42. package/dist/chunks/{agentDisplay-XoDJhr03.js → agentDisplay-DBQYOaOh.js} +1 -1
  43. package/dist/chunks/agents-DmybpgDN.js +103 -0
  44. package/dist/chunks/{agents-C4QXeHIJ.js → agents-HlKk68Qc.js} +1 -1
  45. package/dist/chunks/allErrors-BPn_2TrB.js +1 -0
  46. package/dist/chunks/analytics-CkYUHW_U.js +1 -0
  47. package/dist/chunks/ant-DjdvlLOo.js +1 -0
  48. package/dist/chunks/api-AMgj1zf_.js +1 -0
  49. package/dist/chunks/api-CF5IVtj0.js +1 -0
  50. package/dist/chunks/{asciicast-CbAjUHT_.js → asciicast-BJNYO5sh.js} +1 -1
  51. package/dist/chunks/asciicast-CH6hdK0a.js +1 -0
  52. package/dist/chunks/auth-CNjDn1VY.js +15 -0
  53. package/dist/chunks/auth-CZzP483s.js +1 -0
  54. package/dist/chunks/auth-DDSBm_Yj.js +1 -0
  55. package/dist/chunks/{autoMode-BNukrVAB.js → autoMode-Cr0AhS1G.js} +5 -5
  56. package/dist/chunks/{autonomy-BEmI7WVW.js → autonomy-ARUQt-Lu.js} +1 -1
  57. package/dist/chunks/autonomy-D4xZLOdJ.js +15 -0
  58. package/dist/chunks/{autonomyPanel-fhge09AG.js → autonomyPanel-BQK9MoeB.js} +1 -1
  59. package/dist/chunks/backgroundHousekeeping--eBgphcg.js +17 -0
  60. package/dist/chunks/backgroundHousekeeping-VV1V_Y2Z.js +1 -0
  61. package/dist/chunks/{banner-CWkrK10u.js → banner-Ca7rki2V.js} +2 -2
  62. package/dist/chunks/bg-BK_9J6F6.js +1 -0
  63. package/dist/chunks/{bg-WnYN5ifx.js → bg-DxRHF1yn.js} +2 -2
  64. package/dist/chunks/{branch-Bpe-gocq.js → branch-BYq0zpzT.js} +1 -1
  65. package/dist/chunks/{break-cache-C_p7Kmx2.js → break-cache-BKvoMOZx.js} +2 -2
  66. package/dist/chunks/bridgeConfig-C82un7rJ.js +1 -0
  67. package/dist/chunks/{bridgeConfig-BhxRF2vm.js → bridgeConfig-jDEva6Eh.js} +1 -1
  68. package/dist/chunks/bridgeMessaging-YqYdl6ej.js +1 -0
  69. package/dist/chunks/bridgePointer-DIM0sj0x.js +1 -0
  70. package/dist/chunks/btw-CUV3nRrE.js +1 -0
  71. package/dist/chunks/caches-BZ59_En6.js +1 -0
  72. package/dist/chunks/caches-Cg-HtWKG.js +1 -0
  73. package/dist/chunks/capacityWake-CKOiRELo.js +3 -0
  74. package/dist/chunks/ccrClient-BC2q3k44.js +1 -0
  75. package/dist/chunks/{claudeDesktop-Cx31Ugjp.js → claudeDesktop-DQXL5bGm.js} +1 -1
  76. package/dist/chunks/{clear-B4d38ssF.js → clear-1etSJhdg.js} +1 -1
  77. package/dist/chunks/{cliLaunch-BkPAatcs.js → cliLaunch-CQjLYRzM.js} +1 -1
  78. package/dist/chunks/client-DQXvVKND.js +1 -0
  79. package/dist/chunks/client-DQwf_b9o.js +17 -0
  80. package/dist/chunks/client-DkgC-mFB.js +1 -0
  81. package/dist/chunks/color-CBsNbt1s.js +1 -0
  82. package/dist/chunks/commands-qM5z_Uld.js +1 -0
  83. package/dist/chunks/compact-BclJiRJe.js +2 -0
  84. package/dist/chunks/completionCache-BMHAktkM.js +1 -0
  85. package/dist/chunks/config-CE058cvr.js +3 -0
  86. package/dist/chunks/config-D81avYye.js +1 -0
  87. package/dist/chunks/config-DpOOllGk.js +1 -0
  88. package/dist/chunks/context-noninteractive-Ct_ttQfP.js +29 -0
  89. package/dist/chunks/context-noninteractive-DJb8H_hN.js +1 -0
  90. package/dist/chunks/context-sR9fJmXE.js +1 -0
  91. package/dist/chunks/conversation-D48Kt3ar.js +1 -0
  92. package/dist/chunks/conversation-fOFTa7k5.js +1 -0
  93. package/dist/chunks/{createSSHSession-BM-5pbv6.js → createSSHSession-BmHXA2me.js} +1 -1
  94. package/dist/chunks/createSession-C4rukWkv.js +1 -0
  95. package/dist/chunks/createSession-CSwlW2T2.js +1 -0
  96. package/dist/chunks/crossProjectResume-lDFB2ZcY.js +40 -0
  97. package/dist/chunks/cwd-5Xr-Qka6.js +1 -0
  98. package/dist/chunks/cwd-C5ce-7WB.js +1 -0
  99. package/dist/chunks/{daemon-YtZbMQtn.js → daemon-ZtpTZWgQ.js} +1 -1
  100. package/dist/chunks/{datadog-CpqEQbHa.js → datadog-BJn5ECIu.js} +1 -1
  101. package/dist/chunks/{debug-BrXObCdR.js → debug-RZ4NuXyS.js} +1 -1
  102. package/dist/chunks/debugUtils-D30M1cbN.js +1 -0
  103. package/dist/chunks/{detached-TYk4hMFj.js → detached-jrVP11oU.js} +1 -1
  104. package/dist/chunks/{detectRepository-BPr0VWNO.js → detectRepository-CFiHe6Rv.js} +1 -1
  105. package/dist/chunks/detectRepository-DqQvyj_a.js +1 -0
  106. package/dist/chunks/{diff-CVzOodeg.js → diff-BKiK3xHv.js} +1 -1
  107. package/dist/chunks/directoryCompletion-BagQcynj.js +1 -0
  108. package/dist/chunks/doctor-BEHYm34V.js +1 -0
  109. package/dist/chunks/{entry-DHVYCR26.js → entry-BzL1MFQG.js} +4 -4
  110. package/dist/chunks/esm-BLPbfHQd.js +1 -0
  111. package/dist/chunks/{execFileNoThrow-D244NytW.js → execFileNoThrow-CCX-JY8h.js} +1 -1
  112. package/dist/chunks/{execSyncWrapper-CCMQShK-.js → execSyncWrapper-dhRSYGFW.js} +1 -1
  113. package/dist/chunks/exit-DE2YiAhQ.js +1 -0
  114. package/dist/chunks/{lazySchema-DcIJE_0i.js → external-CEp-aPkt.js} +1 -1
  115. package/dist/chunks/extraUsage-Dw7AXiH7.js +1 -0
  116. package/dist/chunks/extractMemories-DxTUMiv3.js +1 -0
  117. package/dist/chunks/fast-CHmMkIpE.js +1 -0
  118. package/dist/chunks/fast-uQASHWqR.js +1 -0
  119. package/dist/chunks/fileSuggestions-Dyu2kQtE.js +3 -0
  120. package/dist/chunks/firstPartyEventLogger-D5ohKbIe.js +5 -0
  121. package/dist/chunks/firstPartyEventLogger-LsNY6yOt.js +1 -0
  122. package/dist/chunks/flushGate-Cnsu4HET.js +1 -0
  123. package/dist/chunks/gemini-Cudre91e.js +1 -0
  124. package/dist/chunks/{generateRecap-jGDLI_wU.js → generateRecap-CiFxXlmH.js} +1 -1
  125. package/dist/chunks/generateSessionName-DitoBxJT.js +1 -0
  126. package/dist/chunks/{genericProcessUtils-CdQTApYX.js → genericProcessUtils-DVfMHhfy.js} +1 -1
  127. package/dist/chunks/git-BerW9bId.js +6 -0
  128. package/dist/chunks/git-D6dOU2mT.js +1 -0
  129. package/dist/chunks/githubRepoPathMapping-DGr0kJ8D.js +1 -0
  130. package/dist/chunks/{goal-CFx4eRkf.js → goal-DuUayfDg.js} +3 -3
  131. package/dist/chunks/grok-tRbmZzEh.js +1 -0
  132. package/dist/chunks/grove-Cv19v6Sv.js +7 -0
  133. package/dist/chunks/help-DkqxbFDM.js +1 -0
  134. package/dist/chunks/{hooks-X6J03MnA.js → hooks-BZJTWD07.js} +2 -2
  135. package/dist/chunks/hooks-CsP42iOp.js +1 -0
  136. package/dist/chunks/initReplBridge-DdsSWVqN.js +1 -0
  137. package/dist/chunks/{install-D5YORIJL.js → install-BI---dv0.js} +1 -1
  138. package/dist/chunks/{instrumentation-Bw3CxPQf.js → instrumentation-CcWzhGfE.js} +4 -4
  139. package/dist/chunks/{job-DOWtcltx.js → job-B0ftcqPF.js} +1 -1
  140. package/dist/chunks/{jwtUtils-DE2GPUcx.js → jwtUtils-C0cE-1Ey.js} +1 -1
  141. package/dist/chunks/keybindings-DZU3vwo3.js +2 -0
  142. package/dist/chunks/language-DHhXLb_Y.js +1 -0
  143. package/dist/chunks/{language-C6Fq-XOZ.js → language-s-dLbdVz.js} +1 -1
  144. package/dist/chunks/launchLocalMemory-twLxpPvg.js +3 -0
  145. package/dist/chunks/{launchOnboarding-Cc6WwPX9.js → launchOnboarding-BWz2XSb9.js} +1 -1
  146. package/dist/chunks/lazySchema-B4D4qJVE.js +1 -0
  147. package/dist/chunks/{loadAgentsDir-D206qwP3.js → loadAgentsDir-ByO8eJqU.js} +1724 -1993
  148. package/dist/chunks/loadAgentsDir-CMNFLt7R.js +1 -0
  149. package/dist/chunks/loadPluginHooks-BPnxcgrL.js +1 -0
  150. package/dist/chunks/{localSearch-CzrbOklu.js → localSearch-CHHCH16D.js} +1 -1
  151. package/dist/chunks/localSearch-DzQODFap.js +1 -0
  152. package/dist/chunks/log-CZ0zYP_c.js +1 -0
  153. package/dist/chunks/logoV2Utils-CGUJ-5gY.js +1 -0
  154. package/dist/chunks/{magicDocs-DWjL2k7P.js → magicDocs-C5i5ruuU.js} +3 -3
  155. package/dist/chunks/{main-D862LI_d.js → main-BLD4QAQg.js} +2 -2
  156. package/dist/chunks/{main-BohPzJFF.js → main-D4Uk-WUs.js} +89 -86
  157. package/dist/chunks/managedEnv-C-9XSN14.js +1 -0
  158. package/dist/chunks/managedEnv-DLVRBaA9.js +1 -0
  159. package/dist/chunks/managedEnvConstants-BPwL2aWI.js +1 -0
  160. package/dist/chunks/{mappers-BDMZFgKx.js → mappers-CHRFic5q.js} +1 -1
  161. package/dist/chunks/mcp-BMVdGknC.js +1 -0
  162. package/dist/chunks/mcp-COS5RJFS.js +6 -0
  163. package/dist/chunks/mcp-tGsOW1GN.js +2 -0
  164. package/dist/chunks/memoize-B8hfb1JN.js +1 -0
  165. package/dist/chunks/memory-DR6poqeH.js +1 -0
  166. package/dist/chunks/{mode-CUkHFkju.js → mode-QV-NW1Wd.js} +2 -2
  167. package/dist/chunks/model-BF_4ebyl.js +1 -0
  168. package/dist/chunks/{model-BY3auM2c.js → model-BNU_ulDJ.js} +1 -1
  169. package/dist/chunks/model-CwO-g1RW.js +1 -0
  170. package/dist/chunks/nativeInstaller-B-lNJjM-.js +1 -0
  171. package/dist/chunks/observationStore-BpjlK0pG.js +3 -0
  172. package/dist/chunks/omit-DZCEXri5.js +1 -0
  173. package/dist/chunks/onChangeAppState-BmfM5g-D.js +1 -0
  174. package/dist/chunks/openai-DPH6rXOZ.js +10 -0
  175. package/dist/chunks/{panel-BSZGX6jN.js → panel-mD094ALT.js} +1 -1
  176. package/dist/chunks/{panelCall-BsVoL1uF.js → panelCall-SbffM7G4.js} +1 -1
  177. package/dist/chunks/parser-DrBC8nWp.js +1 -0
  178. package/dist/chunks/{parser-DFwaTGf7.js → parser-dbHRgXb8.js} +1 -1
  179. package/dist/chunks/partition-DKuAFJkc.js +1 -0
  180. package/dist/chunks/{path-D5U-tm91.js → path-Cv9QMBAX.js} +1 -1
  181. package/dist/chunks/permissions-ey-bfanE.js +3 -0
  182. package/dist/chunks/{pidLock-D5rUnDB-.js → pidLock-DJnS_38v.js} +2 -2
  183. package/dist/chunks/{pipeTransport-CqCnc-Ys.js → pipeTransport-DVOKR4c_.js} +1 -1
  184. package/dist/chunks/{plan-SYZ4DXR8.js → plan-Brg9XnRr.js} +1 -1
  185. package/dist/chunks/{platform-BrYefG_2.js → platform-DCXXznJg.js} +1 -1
  186. package/dist/chunks/plugin-CRwa39Y1.js +17 -0
  187. package/dist/chunks/pluginAutoupdate-D0LIP7cy.js +1 -0
  188. package/dist/chunks/{pluginBlocklist-C3H2afWG.js → pluginBlocklist-PwHHD3nj.js} +1 -1
  189. package/dist/chunks/pluginCliCommands-BJM5Bdpf.js +1 -0
  190. package/dist/chunks/pluginFlagging-pBxSselw.js +1 -0
  191. package/dist/chunks/pluginOperations-C7p_Qr2r.js +2 -0
  192. package/dist/chunks/pluginStartupCheck-C0HqhG6D.js +1 -0
  193. package/dist/chunks/pluginStartupCheck-Di4LjHXf.js +1 -0
  194. package/dist/chunks/{plugins-Dn6ceWrT.js → plugins-DUKNjLq6.js} +4 -4
  195. package/dist/chunks/pollConfig-BgpfHQPJ.js +1 -0
  196. package/dist/chunks/{poorMode-DhzFKpPl.js → poorMode-CYXmr_mU.js} +1 -1
  197. package/dist/chunks/poorMode-CejPNCp-.js +1 -0
  198. package/dist/chunks/print-gyTOCJzk.js +23 -0
  199. package/dist/chunks/processBashCommand-Cze9vCm6.js +1 -0
  200. package/dist/chunks/processSlashCommand-BRajh1v7.js +5 -0
  201. package/dist/chunks/prompt-B7joRiqj.js +139 -0
  202. package/dist/chunks/prompt-DqSMh2x9.js +1 -0
  203. package/dist/chunks/prompt-Eysh8Et_.js +1 -0
  204. package/dist/chunks/{promptEditor-DeMrXUir.js → promptEditor-R_acDAgI.js} +2 -2
  205. package/dist/chunks/{protocolHandler-BHxBy84Z.js → protocolHandler-RNKkhq91.js} +1 -1
  206. package/dist/chunks/{proxy-CRN7jYIi.js → proxy-BmtEnJ02.js} +1 -1
  207. package/dist/chunks/rcDebugLog-CARUIORE.js +1 -0
  208. package/dist/chunks/reconciler-BfkO6X2X.js +4 -0
  209. package/dist/chunks/refresh-C1X3sptR.js +1 -0
  210. package/dist/chunks/registerProtocol-DoKqmqu2.js +36 -0
  211. package/dist/chunks/{reload-plugins-B9IT9CFA.js → reload-plugins-C0osFcNh.js} +1 -1
  212. package/dist/chunks/remoteBridgeCore-Cddqv2WW.js +1 -0
  213. package/dist/chunks/remoteManagedSettings-B1mnRDmA.js +1 -0
  214. package/dist/chunks/rename-B3tf-YiD.js +1 -0
  215. package/dist/chunks/{renderOptions-BUJB9nAm.js → renderOptions-ChLwxtVu.js} +1 -1
  216. package/dist/chunks/replBridgeHandle-CNwNIijW.js +1 -0
  217. package/dist/chunks/{resume-y7MCTZHJ.js → resume-Be1G_GBL.js} +2 -2
  218. package/dist/chunks/ripgrep-C2PhTJDh.js +1 -0
  219. package/dist/chunks/{ripgrep-BXmXjAzA.js → ripgrep-gaT9Njwi.js} +1 -1
  220. package/dist/chunks/{runtimeObserver-BZcJ1FbH.js → runtimeObserver-CsIwinzh.js} +1 -1
  221. package/dist/chunks/runtimeObserver-Dbxxw4ls.js +10 -0
  222. package/dist/chunks/sandbox-adapter-C6GBuJPB.js +1 -0
  223. package/dist/chunks/sandbox-toggle-jEySONTW.js +1 -0
  224. package/dist/chunks/searchExtraTools-C_UTryh_.js +1 -0
  225. package/dist/chunks/session-DDI1Eb2x.js +2 -0
  226. package/dist/chunks/sessionFileAccessHooks-DfJ7Htfl.js +1 -0
  227. package/dist/chunks/sessionIdCompat-DMayYBrf.js +1 -0
  228. package/dist/chunks/sessionMemory-CQBxPkTQ.js +1 -0
  229. package/dist/chunks/sessionMemory-s0ALUHvc.js +1 -0
  230. package/dist/chunks/sessionMemoryUtils-xt7dTHGC.js +1 -0
  231. package/dist/chunks/sessionObserver-C2sYqWL3.js +1 -0
  232. package/dist/chunks/sessionObserver-DoYc0ZOP.js +20 -0
  233. package/dist/chunks/sessionState-CjNY991n.js +11 -0
  234. package/dist/chunks/sessionStorage-DqsY-7pi.js +1 -0
  235. package/dist/chunks/{sessionTitle-coed9IuJ.js → sessionTitle-B0OYf5nM.js} +3 -3
  236. package/dist/chunks/sessionTracing-CwsXt_uA.js +11 -0
  237. package/dist/chunks/settings-BWtOA9A7.js +1 -0
  238. package/dist/chunks/settings-hQDLwPVj.js +20 -0
  239. package/dist/chunks/settingsSync-DdFagwHV.js +1 -0
  240. package/dist/chunks/setup-DzC22EkN.js +3 -0
  241. package/dist/chunks/{shadowedRuleDetection-D1wsAdpp.js → shadowedRuleDetection-C86PTj1m.js} +1 -1
  242. package/dist/chunks/{shellQuote-DkSy9MYE.js → shellQuote-BUVKMu_P.js} +1 -1
  243. package/dist/chunks/{sideQuestion-wSi38p81.js → sideQuestion-C780iYwd.js} +3 -3
  244. package/dist/chunks/sinks-5G_xhc1Q.js +1 -0
  245. package/dist/chunks/{sinks-C_Dl1p4K.js → sinks-Cftq7Es0.js} +2 -2
  246. package/dist/chunks/skillChangeDetector-plLveEbf.js +1 -0
  247. package/dist/chunks/skillGapStore-Dc1arohs.js +5 -0
  248. package/dist/chunks/skillLifecycle-DP6mY1Kp.js +8 -0
  249. package/dist/chunks/{skillSearchPanel-CErRnUwo.js → skillSearchPanel-CpLTImaL.js} +4 -4
  250. package/dist/chunks/{skills-CBKhfg_a.js → skills-zGYaYfFV.js} +1 -1
  251. package/dist/chunks/{src-D06Xyj4g.js → src-BN7QRYLl.js} +1 -1
  252. package/dist/chunks/startupProfiler-DCn_NxMH.js +3 -0
  253. package/dist/chunks/startupProfiler-JbpAkfNE.js +1 -0
  254. package/dist/chunks/{state-ix0xIunV.js → state-C2OSZkV1.js} +1 -1
  255. package/dist/chunks/state-DU9lRJ9x.js +1 -0
  256. package/dist/chunks/{stats-BY4dskVg.js → stats-Duk7_xjQ.js} +1 -1
  257. package/dist/chunks/{status-BnJIXtKl.js → status-CFw-FpZM.js} +2 -2
  258. package/dist/chunks/{status-DU-B4SMW.js → status-peiVB_2j.js} +1 -1
  259. package/dist/chunks/statusNoticeHelpers-B5U5c9PE.js +1 -0
  260. package/dist/chunks/{stringUtils-DGLPkqJ4.js → stringUtils-B6FudhoZ.js} +1 -1
  261. package/dist/chunks/switcher-BAMqSX7Z.js +1 -0
  262. package/dist/chunks/switcher-hgBgVzLb.js +1 -0
  263. package/dist/chunks/syncCache-Zl9kZRRl.js +1 -0
  264. package/dist/chunks/{tasks-CBVL005y.js → tasks-BxpyRhmD.js} +1 -1
  265. package/dist/chunks/teleport-CwxeD5vL.js +1 -0
  266. package/dist/chunks/{templateJobs-D6998LcG.js → templateJobs-DR5fKFiO.js} +1 -1
  267. package/dist/chunks/{terminalSetup-0SBdyKF5.js → terminalSetup-DgRBt-JJ.js} +1 -1
  268. package/dist/chunks/terminalSetup-DlaFWI81.js +33 -0
  269. package/dist/chunks/{theme-p0AooruD.js → theme-Bz6esfST.js} +1 -1
  270. package/dist/chunks/{tmux-BY7IdQ1f.js → tmux-DSU9tYIo.js} +1 -1
  271. package/dist/chunks/{toolEventObserver-DTccwC3c.js → toolEventObserver-BSekCkM2.js} +1 -1
  272. package/dist/chunks/toolPool-B7SIoDw5.js +1 -0
  273. package/dist/chunks/{trustedDevice-BTYoQCkC.js → trustedDevice-B0x9X0fb.js} +1 -1
  274. package/dist/chunks/trustedDevice-CjHQtVkO.js +1 -0
  275. package/dist/chunks/{types-C-MRCL8J.js → types-D7_37tP2.js} +2 -2
  276. package/dist/chunks/{udsClient-BuCtv7dN.js → udsClient-CHoMMH28.js} +1 -1
  277. package/dist/chunks/{up-BHkC97_C.js → up-B8wBSpLg.js} +1 -1
  278. package/dist/chunks/{updateCCB-DFL5Wt_I.js → updateCCB-D_kGQKPT.js} +1 -1
  279. package/dist/chunks/{upstreamproxy-DyR_eXO8.js → upstreamproxy-Hmq-n8fw.js} +1 -1
  280. package/dist/chunks/useExitOnCtrlCDWithKeybindings-Cce612uS.js +1 -0
  281. package/dist/chunks/useMainLoopModel-BICP6_Fi.js +1 -0
  282. package/dist/chunks/useManagePlugins-DtbY_vPL.js +1 -0
  283. package/dist/chunks/useMergedTools-Ckx2IEhF.js +1 -0
  284. package/dist/chunks/{useSearchInput-D1Vr2Js1.js → useSearchInput-BAgljZUl.js} +1 -1
  285. package/dist/chunks/useSettingsErrors-CAJR_wpd.js +1 -0
  286. package/dist/chunks/userAgent-BxTG7IMk.js +1 -0
  287. package/dist/chunks/{util-BaDs-wL5.js → util-DDtmyq_r.js} +1 -1
  288. package/dist/chunks/validatePlugin-AHl-g4ct.js +1 -0
  289. package/dist/chunks/{vim-C-icQDz1.js → vim-kg-mRVbu.js} +1 -1
  290. package/dist/chunks/{which-CKQnSouy.js → which-CHLNJmtJ.js} +1 -1
  291. package/dist/chunks/windowsPaths-Pmx8LDR6.js +1 -0
  292. package/dist/chunks/{windowsPaths-DtapVxOo.js → windowsPaths-o62uq6LF.js} +1 -1
  293. package/dist/chunks/{workSecret-CNWiR2uQ.js → workSecret-DG9shvG0.js} +1 -1
  294. package/dist/chunks/workerRegistry-C7H_lsQX.js +6 -0
  295. package/dist/chunks/worktree-O2p-mJdF.js +1 -0
  296. package/dist/cli.js +1 -1
  297. package/package.json +1 -1
  298. package/dist/chunks/AddWorkspaceDirectory-ClHi-Dr6.js +0 -1
  299. package/dist/chunks/App-BP06lHmf.js +0 -1
  300. package/dist/chunks/ApproveApiKey-a2ZonQ3n.js +0 -1
  301. package/dist/chunks/AssistantSessionChooser-CcocKoTJ.js +0 -1
  302. package/dist/chunks/BackgroundTasksDialog-DNeBhGCf.js +0 -2
  303. package/dist/chunks/ClaudeMdExternalIncludesDialog-DFivNFuo.js +0 -1
  304. package/dist/chunks/ConsoleOAuthFlow-CS3zjEPF.js +0 -1
  305. package/dist/chunks/DesktopHandoff-BmPmCfT3.js +0 -1
  306. package/dist/chunks/Dialog-vfLXEPed.js +0 -1
  307. package/dist/chunks/Doctor-BhD-ZzZm.js +0 -1
  308. package/dist/chunks/Doctor-DEQe2q16.js +0 -3
  309. package/dist/chunks/Feedback-BaYA8-SU.js +0 -2
  310. package/dist/chunks/Grove-BJziCbZH.js +0 -11
  311. package/dist/chunks/Grove-sWm-oLBf.js +0 -1
  312. package/dist/chunks/ListItem-vfLXEPed.js +0 -1
  313. package/dist/chunks/MCPConnectionManager-CNh9dNlk.js +0 -1
  314. package/dist/chunks/MessageSelector-DdR6wJhh.js +0 -3
  315. package/dist/chunks/Messages-Ch6cboMV.js +0 -11
  316. package/dist/chunks/Onboarding-BrAJp0aL.js +0 -1
  317. package/dist/chunks/OverageCreditUpsell-Ds1cB7RC.js +0 -1
  318. package/dist/chunks/PluginSettings-CGqEzejq.js +0 -17
  319. package/dist/chunks/QueryEngine-CZZMl3PB.js +0 -1
  320. package/dist/chunks/REPL-CG2N7E4Q.js +0 -142
  321. package/dist/chunks/REPL-DvA910N_.js +0 -1
  322. package/dist/chunks/RemoteCallout-Cs-ro8_i.js +0 -1
  323. package/dist/chunks/RemoteSessionManager-B740Dp6m.js +0 -2
  324. package/dist/chunks/ResumeConversation-DzV2zmuX.js +0 -1
  325. package/dist/chunks/SearchExtraToolsTool-C4uO-Zx3.js +0 -1
  326. package/dist/chunks/Settings-XKw6FI_m.js +0 -2
  327. package/dist/chunks/TeleportRepoMismatchDialog-DY97YZMB.js +0 -1
  328. package/dist/chunks/TeleportResumeWrapper-jaQzyTCh.js +0 -1
  329. package/dist/chunks/ThemePicker-BViWzLp3.js +0 -1
  330. package/dist/chunks/TrustDialog-DGJ_BisZ.js +0 -1
  331. package/dist/chunks/TungstenTool-Cb7gJvq4.js +0 -1
  332. package/dist/chunks/TungstenTool-CxMQVCuF.js +0 -1
  333. package/dist/chunks/agents-BIHTGDYh.js +0 -103
  334. package/dist/chunks/allErrors-1896uQA1.js +0 -1
  335. package/dist/chunks/analytics-BotDBGh0.js +0 -1
  336. package/dist/chunks/ant-B6k6cBts.js +0 -1
  337. package/dist/chunks/api-BsFW57_Q.js +0 -1
  338. package/dist/chunks/api-gqTA-D7n.js +0 -1
  339. package/dist/chunks/asciicast-BsWpcxrc.js +0 -1
  340. package/dist/chunks/assistant-C83quuNj.js +0 -1
  341. package/dist/chunks/assistant-DJ9hd4uC.js +0 -1
  342. package/dist/chunks/assistant-z2o4-UJe.js +0 -1
  343. package/dist/chunks/auth-8Vd3_U8t.js +0 -1
  344. package/dist/chunks/auth-BnSrKyJe.js +0 -15
  345. package/dist/chunks/auth-DRTjfnGy.js +0 -1
  346. package/dist/chunks/autonomy-DGcy5Rml.js +0 -15
  347. package/dist/chunks/backgroundHousekeeping-3i_d_WW5.js +0 -1
  348. package/dist/chunks/backgroundHousekeeping-BVMf_Tjn.js +0 -17
  349. package/dist/chunks/bg-B0iMGM9C.js +0 -1
  350. package/dist/chunks/bridge-D12Shbkj.js +0 -2
  351. package/dist/chunks/bridgeConfig-CqIQ_rvD.js +0 -1
  352. package/dist/chunks/bridgeEnabled-D0XC5kNh.js +0 -1
  353. package/dist/chunks/bridgeEnabled-SbB-6zdY.js +0 -1
  354. package/dist/chunks/bridgeMain-DHUpZFgL.js +0 -68
  355. package/dist/chunks/bridgeMain-DUbQjgCp.js +0 -1
  356. package/dist/chunks/bridgeMessaging-DHc5dOhB.js +0 -1
  357. package/dist/chunks/bridgePointer-MqLe5Asm.js +0 -1
  358. package/dist/chunks/browser-BmZuQom6.js +0 -1
  359. package/dist/chunks/btw-D9hMM5d2.js +0 -1
  360. package/dist/chunks/caches-CWzT7e6Y.js +0 -1
  361. package/dist/chunks/caches-UeVVM3T0.js +0 -3
  362. package/dist/chunks/capacityWake-CV_x9H8j.js +0 -1
  363. package/dist/chunks/ccrClient-Iza0L8Zw.js +0 -1
  364. package/dist/chunks/client-BzKQTXzF.js +0 -1
  365. package/dist/chunks/color-D8VOyoYl.js +0 -1
  366. package/dist/chunks/commands-DDamMmo4.js +0 -1
  367. package/dist/chunks/commitAttribution-CgohL8vD.js +0 -1
  368. package/dist/chunks/commitAttribution-ChAgixdj.js +0 -2
  369. package/dist/chunks/compact-IFHwxjZ9.js +0 -2
  370. package/dist/chunks/completionCache-MN3_MqK8.js +0 -4
  371. package/dist/chunks/completionCache-c4aiyZ_f.js +0 -1
  372. package/dist/chunks/config-DY5-_kk_.js +0 -1
  373. package/dist/chunks/config-DmomySWC.js +0 -3
  374. package/dist/chunks/config-WxgxrQoP.js +0 -1
  375. package/dist/chunks/context-Cl6BJ2vm.js +0 -1
  376. package/dist/chunks/context-noninteractive-9hELVC29.js +0 -54
  377. package/dist/chunks/context-noninteractive-Beij5MfU.js +0 -1
  378. package/dist/chunks/conversation-BBB91hEw.js +0 -1
  379. package/dist/chunks/conversation-BWVTM40Y.js +0 -1
  380. package/dist/chunks/createSession-CoQtL5Rj.js +0 -1
  381. package/dist/chunks/createSession-Cvl1Q50F.js +0 -1
  382. package/dist/chunks/cron-3LntnnhJ.js +0 -1
  383. package/dist/chunks/crossProjectResume-BasMLl2n.js +0 -40
  384. package/dist/chunks/cwd--nvsx73T.js +0 -1
  385. package/dist/chunks/cwd-CYmmnQVS.js +0 -1
  386. package/dist/chunks/debugUtils-NO5KtXqi.js +0 -1
  387. package/dist/chunks/desktop-B_L6T6jI.js +0 -1
  388. package/dist/chunks/detectRepository-BTPgN89l.js +0 -1
  389. package/dist/chunks/directoryCompletion-CW2ckkQg.js +0 -1
  390. package/dist/chunks/doctor-1L0TFuGw.js +0 -1
  391. package/dist/chunks/envLessBridgeConfig-CN0_44-p.js +0 -1
  392. package/dist/chunks/envLessBridgeConfig-Ck2-KMq0.js +0 -1
  393. package/dist/chunks/esm-D5q6s4l8.js +0 -1
  394. package/dist/chunks/exit-Bm1S_f3i.js +0 -1
  395. package/dist/chunks/extra-usage-UHAWtypK.js +0 -1
  396. package/dist/chunks/extra-usage-core-BFOolqoi.js +0 -1
  397. package/dist/chunks/extra-usage-noninteractive-cUGZy0en.js +0 -1
  398. package/dist/chunks/extra-usage-zDHVtWKZ.js +0 -1
  399. package/dist/chunks/extraUsage-Dq66zzqR.js +0 -1
  400. package/dist/chunks/extractMemories-BcaklA33.js +0 -1
  401. package/dist/chunks/fast-DALAHO3d.js +0 -1
  402. package/dist/chunks/fast-MS7WZpD8.js +0 -1
  403. package/dist/chunks/feedback-Fw4m28ZC.js +0 -1
  404. package/dist/chunks/file-DcZWPH2V.js +0 -12
  405. package/dist/chunks/fileStateCache-DDW5toIs.js +0 -1
  406. package/dist/chunks/files-Cz1-PK3r.js +0 -2
  407. package/dist/chunks/firstPartyEventLogger-CS9jVz6D.js +0 -1
  408. package/dist/chunks/firstPartyEventLogger-CoSUd0a1.js +0 -5
  409. package/dist/chunks/flushGate-De-yppeo.js +0 -1
  410. package/dist/chunks/gemini-BPziscyN.js +0 -1
  411. package/dist/chunks/generateSessionName-hDJ6HBJ1.js +0 -1
  412. package/dist/chunks/git-CbcnOf0E.js +0 -1
  413. package/dist/chunks/git-Do0wJvux.js +0 -6
  414. package/dist/chunks/githubRepoPathMapping-qAoiyj6P.js +0 -1
  415. package/dist/chunks/grok-Byblph7F.js +0 -1
  416. package/dist/chunks/grove-CpqjcGCb.js +0 -7
  417. package/dist/chunks/heapdump-C4kPlqGt.js +0 -5
  418. package/dist/chunks/help-B1h-faJ3.js +0 -1
  419. package/dist/chunks/hooks-DPLIIpAD.js +0 -1
  420. package/dist/chunks/hostGuard-BHI6Q8Mt.js +0 -1
  421. package/dist/chunks/inboundAttachments-BekVc0W-.js +0 -1
  422. package/dist/chunks/inboundAttachments-CUJE3KaU.js +0 -1
  423. package/dist/chunks/index.min-D75yiGLN.js +0 -1
  424. package/dist/chunks/initReplBridge-JQ-afRx9.js +0 -1
  425. package/dist/chunks/keybindings-BLw5J-Zj.js +0 -2
  426. package/dist/chunks/language-Cqw5gYJR.js +0 -1
  427. package/dist/chunks/launchAgentsPlatform-jWWf-Lk9.js +0 -1
  428. package/dist/chunks/launchCommand-1qkTCKpf.js +0 -1
  429. package/dist/chunks/launchLocalMemory-kHeD0I0y.js +0 -3
  430. package/dist/chunks/launchLocalVault-DLqkOjmb.js +0 -3
  431. package/dist/chunks/launchMemoryStores-Ct7AVXrO.js +0 -1
  432. package/dist/chunks/launchSchedule-ZyvuvjgU.js +0 -1
  433. package/dist/chunks/launchSkillStore-BejQnLog.js +0 -1
  434. package/dist/chunks/launchTeleport-8CuYUfIR.js +0 -3
  435. package/dist/chunks/launchVault-DIvIOuPh.js +0 -1
  436. package/dist/chunks/loadAgentsDir-TZjwTqdr.js +0 -1
  437. package/dist/chunks/loadPluginHooks-Ddhsyn0_.js +0 -1
  438. package/dist/chunks/localSearch-DrOAL6f4.js +0 -1
  439. package/dist/chunks/log-BMCygSzM.js +0 -1
  440. package/dist/chunks/logoV2Utils-8M56V7oN.js +0 -1
  441. package/dist/chunks/mcp-Bt1ITh-Z.js +0 -1
  442. package/dist/chunks/mcp-CwJ-AIpt.js +0 -6
  443. package/dist/chunks/mcp-W0LFoyFR.js +0 -2
  444. package/dist/chunks/memoize-B0zhbT8Z.js +0 -1
  445. package/dist/chunks/memory-3wV7m7UU.js +0 -1
  446. package/dist/chunks/model-CKkOnnnx.js +0 -1
  447. package/dist/chunks/model-DRXcJyU9.js +0 -1
  448. package/dist/chunks/nativeInstaller-CA5d6_G7.js +0 -1
  449. package/dist/chunks/observationStore-DzCdXq8U.js +0 -4
  450. package/dist/chunks/onChangeAppState-DBmy2Ow_.js +0 -1
  451. package/dist/chunks/openai-Cbomn0Ws.js +0 -10
  452. package/dist/chunks/output-style-BM3qAHLA.js +0 -1
  453. package/dist/chunks/overageCreditGrant-DsUrmeBh.js +0 -1
  454. package/dist/chunks/panel-Be-OxtqL.js +0 -1
  455. package/dist/chunks/parser-Bf6iasPV.js +0 -1
  456. package/dist/chunks/partition-BAakXjvj.js +0 -1
  457. package/dist/chunks/passes-CLRt7Cvm.js +0 -1
  458. package/dist/chunks/permissions-BVSFuwNP.js +0 -3
  459. package/dist/chunks/permissions-CeYKbtSC.js +0 -1
  460. package/dist/chunks/permissions-Cn_6f8CB.js +0 -1
  461. package/dist/chunks/plugin-Bfjzhmrk.js +0 -1
  462. package/dist/chunks/pluginAutoupdate-reO2PgtQ.js +0 -1
  463. package/dist/chunks/pluginCliCommands-lqdxdkQp.js +0 -1
  464. package/dist/chunks/pluginFlagging-D9HKAGBC.js +0 -1
  465. package/dist/chunks/pluginOperations-EN3EKLux.js +0 -2
  466. package/dist/chunks/pluginStartupCheck-BY73BMT2.js +0 -1
  467. package/dist/chunks/pluginStartupCheck-CwWOlveD.js +0 -1
  468. package/dist/chunks/policyLimits-CkTI5KEt.js +0 -1
  469. package/dist/chunks/pollConfig-DH2oCtFS.js +0 -1
  470. package/dist/chunks/poor-j-y-bv8o.js +0 -1
  471. package/dist/chunks/poorMode-V11s-3cf.js +0 -1
  472. package/dist/chunks/print-Db_VXmfO.js +0 -23
  473. package/dist/chunks/privacy-settings-DHMJREbb.js +0 -1
  474. package/dist/chunks/processBashCommand-BcM_fhV9.js +0 -1
  475. package/dist/chunks/processSlashCommand-DEVo3GPX.js +0 -5
  476. package/dist/chunks/prompt-BNHtszmZ.js +0 -139
  477. package/dist/chunks/prompt-CrX31AGm.js +0 -1
  478. package/dist/chunks/prompt-IAvMxKDl.js +0 -1
  479. package/dist/chunks/rate-limit-options-DIudL9fb.js +0 -1
  480. package/dist/chunks/rcDebugLog-CUy1_F23.js +0 -11
  481. package/dist/chunks/reconciler-BXpPyfSY.js +0 -4
  482. package/dist/chunks/referral-CUaIo_vT.js +0 -1
  483. package/dist/chunks/refresh-CuaVBIQ0.js +0 -1
  484. package/dist/chunks/registerProtocol-B7Fzdofu.js +0 -36
  485. package/dist/chunks/release-notes-fbfv2DC0.js +0 -4
  486. package/dist/chunks/releaseNotes-CxAHFLPl.js +0 -2
  487. package/dist/chunks/remote-env-BOklGlll.js +0 -1
  488. package/dist/chunks/remoteBridgeCore-j0bG1zjv.js +0 -1
  489. package/dist/chunks/remoteManagedSettings-Cq994lyc.js +0 -1
  490. package/dist/chunks/rename-Iev7wQsI.js +0 -1
  491. package/dist/chunks/ripgrep-BfIpz5uC.js +0 -1
  492. package/dist/chunks/runtimeObserver-CyzLASla.js +0 -10
  493. package/dist/chunks/sandbox-adapter-Cu1FYrkh.js +0 -1
  494. package/dist/chunks/sandbox-toggle-CWpBO228.js +0 -1
  495. package/dist/chunks/sanitization-DV-94a9Z.js +0 -1
  496. package/dist/chunks/searchExtraTools-BUOUds7p.js +0 -1
  497. package/dist/chunks/semver-BMRJYn3q.js +0 -1
  498. package/dist/chunks/session-DL4cA_8l.js +0 -2
  499. package/dist/chunks/sessionDiscovery-DAfNKqp1.js +0 -1
  500. package/dist/chunks/sessionFileAccessHooks-2cgIIxPk.js +0 -1
  501. package/dist/chunks/sessionMemory-BS8_TbKj.js +0 -1
  502. package/dist/chunks/sessionMemory-D5fSHXvZ.js +0 -1
  503. package/dist/chunks/sessionMemoryUtils-BWUztNh6.js +0 -1
  504. package/dist/chunks/sessionObserver-ChfQtK2m.js +0 -1
  505. package/dist/chunks/sessionObserver-ShbCwJ8x.js +0 -20
  506. package/dist/chunks/sessionStorage-Cf5wmnyB.js +0 -1
  507. package/dist/chunks/sessionTracing-D9rUyiq0.js +0 -11
  508. package/dist/chunks/settings-BovzmwMP.js +0 -19
  509. package/dist/chunks/settingsSync-PqU9XGJq.js +0 -1
  510. package/dist/chunks/setup-B_FOvNpp.js +0 -3
  511. package/dist/chunks/sinks-BpcRrN_T.js +0 -1
  512. package/dist/chunks/skill-learning-B5tmc7EX.js +0 -5
  513. package/dist/chunks/skillChangeDetector-DNqohXxz.js +0 -1
  514. package/dist/chunks/skillGapStore-D-kQKVDZ.js +0 -1
  515. package/dist/chunks/skillGapStore-Df5BWAk5.js +0 -5
  516. package/dist/chunks/skillGenerator-DbcdpAkw.js +0 -8
  517. package/dist/chunks/skillLearning-C5cXZE6_.js +0 -1
  518. package/dist/chunks/skillLearning-ClRiDcJH.js +0 -1
  519. package/dist/chunks/skillPanel-LBd4E-MM.js +0 -28
  520. package/dist/chunks/slashCommandParsing-RQb_7Xzt.js +0 -1
  521. package/dist/chunks/startupProfiler-DIWVcO4e.js +0 -1
  522. package/dist/chunks/startupProfiler-xa3NmN7Z.js +0 -3
  523. package/dist/chunks/state-BOa-3Av3.js +0 -1
  524. package/dist/chunks/statusNoticeHelpers-CzTuGNuC.js +0 -1
  525. package/dist/chunks/stickers-D5teCKMN.js +0 -1
  526. package/dist/chunks/systemPromptSections-CR_AoPIX.js +0 -1
  527. package/dist/chunks/systemPromptSections-DN0HGVye.js +0 -1
  528. package/dist/chunks/tag-B-wVW9Aj.js +0 -11
  529. package/dist/chunks/teleport-dtqQXM4x.js +0 -1
  530. package/dist/chunks/terminalSetup-CuV-qU6v.js +0 -33
  531. package/dist/chunks/thinkback-Catprqs_.js +0 -1
  532. package/dist/chunks/thinkback-DI2NpvG-.js +0 -1
  533. package/dist/chunks/thinkback-play-CqrIRx2o.js +0 -1
  534. package/dist/chunks/toolEventObserver-DlH73w-S.js +0 -1
  535. package/dist/chunks/toolPool-B64V-jmK.js +0 -1
  536. package/dist/chunks/trustedDevice-CiwjT_Y6.js +0 -1
  537. package/dist/chunks/tui-C2yuCuOU.js +0 -6
  538. package/dist/chunks/types-Bh9S_JG5.js +0 -3
  539. package/dist/chunks/types-DHkZVzJe.js +0 -1
  540. package/dist/chunks/ultrareviewCommand-BDFUS3hf.js +0 -3
  541. package/dist/chunks/undercover-XYapZ_SS.js +0 -1
  542. package/dist/chunks/undercover-vuTpCnQJ.js +0 -31
  543. package/dist/chunks/upgrade-D5qwcaWQ.js +0 -1
  544. package/dist/chunks/upgrade-DIg3j929.js +0 -1
  545. package/dist/chunks/upload-B_yADHX9.js +0 -1
  546. package/dist/chunks/usage-C0SnnC-i.js +0 -1
  547. package/dist/chunks/usage-CYJKE8N6.js +0 -1
  548. package/dist/chunks/useExitOnCtrlCDWithKeybindings-DKIqRraH.js +0 -1
  549. package/dist/chunks/useMainLoopModel-XetDUXd-.js +0 -1
  550. package/dist/chunks/useManagePlugins-B2KhKiu5.js +0 -1
  551. package/dist/chunks/useMergedTools-CKvwz_Zt.js +0 -1
  552. package/dist/chunks/useSettingsErrors-B7BXHchG.js +0 -1
  553. package/dist/chunks/validatePlugin-DtiYlXby.js +0 -1
  554. package/dist/chunks/windowsPaths-9pEkw0oV.js +0 -1
  555. package/dist/chunks/workerRegistry-ChqPPIaO.js +0 -1
  556. package/dist/chunks/worktree-DAn8ooa1.js +0 -1
@@ -1 +0,0 @@
1
- import{n as e,o as t,r as n}from"./rolldown-runtime-DaDcL9Zw.js";import{n as r,t as i}from"./memoize-BK3gG5ob.js";import{d as a,i as o,l as s,n as c,o as l,s as u,t as d}from"./envUtils-DSxRz_kt.js";import{n as ee,t as te}from"./defineProperty-C-QyHrDq.js";import{n as f,t as p}from"./axios-DaWTGg7G.js";import{di as ne,ui as re}from"./src-CDCSSo0U2.js";import{E as ie,M as ae,T as oe,h as se,n as ce,r as le,t as ue}from"./lazySchema-DcIJE_0i.js";import{$ as de,H as fe,Jr as pe,On as me,Sr as he,X as ge,Xn as _e,Yr as ve,_n as ye,en as m,ht as be,pt as xe,qn as Se,sn as Ce,tt as we,xr as Te,y as Ee,z as h}from"./state-ix0xIunV.js";import{C as De,E as Oe,F as g,G as ke,I as Ae,K as je,S as Me,V as Ne,a as _,c as Pe,d as Fe,l as v,p as Ie,s as Le,w as Re,z as ze}from"./debug-BrXObCdR.js";import{Kt as Be,c as y,f as b,g as x,n as Ve,y as He}from"./settings-BovzmwMP.js";import{C as Ue,b as S,c as C,g as We,n as w,w as Ge}from"./config-DmomySWC.js";import{a as Ke,c as qe,i as Je,o as Ye,r as Xe,s as Ze,t as Qe}from"./execFileNoThrow-D244NytW.js";import{d as $e,f as et,o as tt,s as T}from"./log-BMCygSzM.js";import{r as nt,t as rt}from"./memoize-B0zhbT8Z.js";import{s as it,u as at}from"./types-C-MRCL8J.js";import{n as ot,r as E}from"./analytics-BotDBGh0.js";import{l as D,n as st,r as ct,s as lt,t as ut,u as O}from"./oauth-BqJqV-2M.js";import{n as dt,t as ft}from"./bundledMode--fG1S62b.js";import{n as pt,o as mt}from"./stringUtils-DGLPkqJ4.js";import{a as ht,i as gt,l as _t}from"./proxy-CRN7jYIi.js";import{userInfo as vt}from"os";import{join as yt}from"path";import{chmodSync as bt,mkdirSync as xt,readFileSync as St,writeFileSync as Ct}from"fs";import{createHash as wt,randomUUID as Tt}from"crypto";import{mkdir as Et,stat as Dt,writeFile as Ot}from"fs/promises";import{exec as kt,execFile as At}from"child_process";import{AsyncLocalStorage as jt}from"async_hooks";function k(e=Ve()){let t=e.modelType;return t===`openai`?`openai`:t===`gemini`?`gemini`:t===`grok`?`grok`:s(process.env.CLAUDE_CODE_USE_BEDROCK)?`bedrock`:s(process.env.CLAUDE_CODE_USE_VERTEX)?`vertex`:s(process.env.CLAUDE_CODE_USE_FOUNDRY)?`foundry`:s(process.env.CLAUDE_CODE_USE_OPENAI)?`openai`:s(process.env.CLAUDE_CODE_USE_GEMINI)?`gemini`:s(process.env.CLAUDE_CODE_USE_GROK)?`grok`:`firstParty`}function Mt(){return k()}function Nt(){let e=process.env.ANTHROPIC_BASE_URL;if(!e)return!0;try{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 A=e((()=>{x(),l()}));function Pt(){return It.getStore()?.workload}function Ft(e,t){return It.run({workload:e},t)}var It,Lt=e((()=>{It=new jt}));function Rt(){return process.env.USER_TYPE,null}function zt(){return process.env.USER_TYPE===`ant`?Rt()?.antModels??[]:[]}function Bt(e){if(process.env.USER_TYPE!==`ant`||e===void 0)return;let t=e.toLowerCase();return zt().find(n=>n.alias===e||t.includes(n.model.toLowerCase()))}var Vt=e((()=>{}));function Ht(e){let t=[],n=!1;async function r(){if(!n&&t.length!==0){for(n=!0;t.length>0;){let{args:n,resolve:r,reject:i,context:a}=t.shift();try{r(await e.apply(a,n))}catch(e){i(e)}}n=!1,t.length>0&&r()}}return function(...e){return new Promise((n,i)=>{t.push({args:e,resolve:n,reject:i,context:this}),r()})}}var Ut=e((()=>{}));function Wt(e,t){return e.find(e=>e.includes(t))??null}async function Gt(){let{BedrockClient:e}=await import(`./dist-es-yHGBqhBe.js`),t=d(),n=s(process.env.CLAUDE_CODE_SKIP_BEDROCK_AUTH),r={region:t,...process.env.ANTHROPIC_BEDROCK_BASE_URL&&{endpoint:process.env.ANTHROPIC_BEDROCK_BASE_URL},...await gt(),...n&&{requestHandler:new(await(import(`./dist-es-C7vygWzp.js`))).NodeHttpHandler,httpAuthSchemes:[{schemeId:`smithy.api#noAuth`,identityProvider:()=>async()=>({}),signer:new(await(import(`./dist-es-gUzZ_7Vf.js`))).NoAuthSigner}],httpAuthSchemeProvider:()=>[{schemeId:`smithy.api#noAuth`}]}};if(!n&&!process.env.AWS_BEARER_TOKEN_BEDROCK){let e=await W();e&&(r.credentials={accessKeyId:e.accessKeyId,secretAccessKey:e.secretAccessKey,sessionToken:e.sessionToken})}return new e(r)}async function Kt(){let{BedrockRuntimeClient:e}=await import(`./dist-es-Gt_DpXlP.js`),t=d(),n=s(process.env.CLAUDE_CODE_SKIP_BEDROCK_AUTH),r={region:t,...process.env.ANTHROPIC_BEDROCK_BASE_URL&&{endpoint:process.env.ANTHROPIC_BEDROCK_BASE_URL},...await gt(),...n&&{requestHandler:new(await(import(`./dist-es-C7vygWzp.js`))).NodeHttpHandler,httpAuthSchemes:[{schemeId:`smithy.api#noAuth`,identityProvider:()=>async()=>({}),signer:new(await(import(`./dist-es-gUzZ_7Vf.js`))).NoAuthSigner}],httpAuthSchemeProvider:()=>[{schemeId:`smithy.api#noAuth`}]}};if(!n&&!process.env.AWS_BEARER_TOKEN_BEDROCK){let e=await W();e&&(r.credentials={accessKeyId:e.accessKeyId,secretAccessKey:e.secretAccessKey,sessionToken:e.sessionToken})}return new e(r)}function qt(e){return e.startsWith(`anthropic.`)}function Jt(e){if(!e.startsWith(`arn:`))return e;let t=e.lastIndexOf(`/`);return t===-1?e:e.substring(t+1)}function Yt(e){let t=Jt(e);for(let e of $t)if(t.startsWith(`${e}.anthropic.`))return e}function Xt(e,t){let n=Yt(e);return n?e.replace(`${n}.`,`${t}.`):qt(e)?`${t}.${e}`:e}var Zt,Qt,$t,en=e((()=>{i(),K(),l(),tt(),_t(),Zt=r(async function(){let[e,{ListInferenceProfilesCommand:t}]=await Promise.all([Gt(),import(`./dist-es-yHGBqhBe.js`)]),n=[],r;try{do{let i=new t({...r&&{nextToken:r},typeEquals:`SYSTEM_DEFINED`}),a=await e.send(i);a.inferenceProfileSummaries&&n.push(...a.inferenceProfileSummaries),r=a.nextToken}while(r);return n.filter(e=>e.inferenceProfileId?.includes(`anthropic`)).map(e=>e.inferenceProfileId).filter(Boolean)}catch(e){throw T(e),e}}),Qt=r(async function(e){try{let[t,{GetInferenceProfileCommand:n}]=await Promise.all([Gt(),import(`./dist-es-yHGBqhBe.js`)]),r=new n({inferenceProfileIdentifier:e}),i=await t.send(r);if(!i.models||i.models.length===0)return null;let a=i.models[0];if(!a?.modelArn)return null;let o=a.modelArn.lastIndexOf(`/`);return o>=0?a.modelArn.substring(o+1):a.modelArn}catch(e){return T(e),null}}),$t=[`us`,`eu`,`apac`,`global`]})),tn,nn,rn,an,on,sn,cn,ln,un,dn,fn,pn,mn,hn,gn=e((()=>{tn={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`},nn={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`},rn={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`},an={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`},on={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`},sn={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`},cn={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`},ln={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`},un={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`},dn={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`},fn={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`},pn={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`},mn={haiku35:rn,haiku45:an,sonnet35:nn,sonnet37:tn,sonnet40:on,sonnet45:sn,sonnet46:pn,opus40:cn,opus41:ln,opus45:un,opus46:dn,opus47:fn},Object.values(mn).map(e=>e.firstParty),hn=Object.fromEntries(Object.entries(mn).map(([e,t])=>[t.firstParty,e]))}));function _n(e){let t={};for(let n of Cn)t[n]=mn[n][e];return t}async function vn(){let e=_n(`bedrock`),t;try{t=await Zt()}catch(t){return T(t),e}if(!t?.length)return e;let n={};for(let r of Cn){let i=mn[r].firstParty;n[r]=Wt(t,i)||e[r]}return n}function yn(e){let t=Ve().modelOverrides;if(!t)return e;let n={...e};for(let[e,r]of Object.entries(t)){let t=hn[e];t&&r&&(n[t]=r)}return n}function bn(e){let t;try{t=Ve().modelOverrides}catch{return e}if(!t)return e;for(let[n,r]of Object.entries(t))if(r===e)return n;return e}function xn(){if(de()===null){if(k()!==`bedrock`){Se(_n(k()));return}wn()}}function j(){let e=de();return e===null?(xn(),yn(_n(k()))):yn(e)}async function Sn(){if(de()===null){if(k()!==`bedrock`){Se(_n(k()));return}await wn()}}var Cn,wn,Tn=e((()=>{m(),tt(),Ut(),x(),en(),gn(),A(),Cn=Object.keys(mn),wn=Ht(async()=>{if(de()===null)try{Se(await vn())}catch(e){T(e)}})}));function En(){if(s(process.env.DISABLE_COST_WARNINGS)||B())return!1;let e=ja(),t=R()!==null;if(!e.hasToken&&!t)return!1;let n=C(),r=n.oauthAccount?.organizationRole,i=n.oauthAccount?.workspaceRole;return!r||!i?!1:[`admin`,`billing`].includes(r)||[`workspace_admin`,`workspace_billing`].includes(i)}function Dn(e){kn=e}function On(){if(kn!==null)return kn;if(!B())return!1;let e=V();if(e===`max`||e===`pro`)return!0;let t=C().oauthAccount?.organizationRole;return!!t&&[`admin`,`billing`,`owner`,`primary_owner`].includes(t)}var kn,An=e((()=>{K(),We(),l(),kn=null}));function jn(){return process.env.USER_TYPE===`ant`?process.env.CLAUDE_MOCK_HEADERLESS_429?process.env.CLAUDE_MOCK_HEADERLESS_429:M?Vn:null:null}function Mn(){return!M||process.env.USER_TYPE!==`ant`||Object.keys(Bn).length===0?null:Bn}function Nn(){Bn={},Gn=[],Hn=null,Un=null,N=null,Vn=null,Dn(null),M=!1}function Pn(e){let t=Mn();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 Fn(){return process.env.USER_TYPE===`ant`?M||!!process.env.CLAUDE_MOCK_HEADERLESS_429:!1}function In(){return!M||process.env.USER_TYPE!==`ant`?null:Hn||Wn}function Ln(){return M&&Hn!==null&&process.env.USER_TYPE===`ant`}function Rn(){return Un!==null}function zn(e){if(Un===null||!e)return null;if(N!==null&&Date.now()>=N)return Nn(),null;N===null&&(N=Date.now()+Un);let t=N-Date.now(),n={...Bn};return n[`retry-after`]=String(Math.max(1,Math.ceil(t/1e3))),n}var Bn,M,Vn,Hn,Un,N,Wn,Gn,Kn=e((()=>{An(),Bn={},M=!1,Vn=null,Hn=null,Un=null,N=null,Wn=`max`}));async function qn(){let e=C().oauthAccount?.accountUuid,t=R();if(!e||!t)return;let n=`${D().BASE_API_URL}/api/claude_cli_profile`;try{return(await f.get(n,{headers:{"x-api-key":t,"anthropic-beta":lt},params:{account_uuid:e},timeout:1e4})).data}catch(e){T(e)}}async function Jn(e){let t=`${D().BASE_API_URL}/api/oauth/profile`;try{return(await f.get(t,{headers:{Authorization:`Bearer ${e}`,"Content-Type":`application/json`},timeout:1e4})).data}catch(e){T(e)}}var Yn=e((()=>{p(),O(),K(),We(),tt()}));function Xn(e){return!!e?.includes(st)}function Zn(e){return e?.split(` `).filter(Boolean)??[]}function Qn({codeChallenge:e,state:t,port:n,isManual:r,loginWithClaudeAi:i,inferenceOnly:a,orgUUID:o,loginHint:s,loginMethod:c}){let l=i?D().CLAUDE_AI_AUTHORIZE_URL:D().CONSOLE_AUTHORIZE_URL,u=new URL(l);u.searchParams.append(`code`,`true`),u.searchParams.append(`client_id`,D().CLIENT_ID),u.searchParams.append(`response_type`,`code`),u.searchParams.append(`redirect_uri`,r?D().MANUAL_REDIRECT_URL:`http://localhost:${n}/callback`);let d=a?[st]:ut;return u.searchParams.append(`scope`,d.join(` `)),u.searchParams.append(`code_challenge`,e),u.searchParams.append(`code_challenge_method`,`S256`),u.searchParams.append(`state`,t),o&&u.searchParams.append(`orgUUID`,o),s&&u.searchParams.append(`login_hint`,s),c&&u.searchParams.append(`login_method`,c),u.toString()}async function $n(e,t,n,r,i=!1,a){let o={grant_type:`authorization_code`,code:e,redirect_uri:i?D().MANUAL_REDIRECT_URL:`http://localhost:${r}/callback`,client_id:D().CLIENT_ID,code_verifier:n,state:t};a!==void 0&&(o.expires_in=a);let s=await f.post(D().TOKEN_URL,o,{headers:{"Content-Type":`application/json`},timeout:15e3});if(s.status!==200)throw Error(s.status===401?`Authentication failed: Invalid authorization code`:`Token exchange failed (${s.status}): ${s.statusText}`);return E(`tengu_oauth_token_exchange_success`,{}),s.data}async function er(e,{scopes:t}={}){let n={grant_type:`refresh_token`,refresh_token:e,client_id:D().CLIENT_ID,scope:(t?.length?t:ct).join(` `)};try{let t=await f.post(D().TOKEN_URL,n,{headers:{"Content-Type":`application/json`},timeout:15e3});if(t.status!==200)throw Error(`Token refresh failed: ${t.statusText}`);let r=t.data,{access_token:i,refresh_token:a=e,expires_in:o}=r,s=Date.now()+o*1e3,c=Zn(r.scope);E(`tengu_oauth_token_refresh_success`,{});let l=C(),u=G(),d=l.oauthAccount?.billingType!==void 0&&l.oauthAccount?.accountCreatedAt!==void 0&&l.oauthAccount?.subscriptionCreatedAt!==void 0&&u?.subscriptionType!=null&&u?.rateLimitTier!=null?null:await ir(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&&S(t=>({...t,oauthAccount:t.oauthAccount?{...t.oauthAccount,...e}:t.oauthAccount}))}return{accessToken:i,refreshToken:a,expiresAt:s,scopes:c,subscriptionType:d?.subscriptionType??u?.subscriptionType??null,rateLimitTier:d?.rateLimitTier??u?.rateLimitTier??null,profile:d?.rawProfile,tokenAccount:r.account?{uuid:r.account.uuid,emailAddress:r.account.email_address,organizationUuid:r.organization?.uuid}:void 0}}catch(e){let t=f.isAxiosError(e)&&e.response?.data?JSON.stringify(e.response.data):void 0;throw E(`tengu_oauth_token_refresh_failure`,{error:e.message,...t&&{responseBody:t}}),e}}async function tr(e){let t=await f.get(D().ROLES_URL,{headers:{Authorization:`Bearer ${e}`}});if(t.status!==200)throw Error(`Failed to fetch user roles: ${t.statusText}`);let n=t.data;if(!C().oauthAccount)throw Error(`OAuth account information not found in config`);S(e=>({...e,oauthAccount:e.oauthAccount?{...e.oauthAccount,organizationRole:n.organization_role,workspaceRole:n.workspace_role,organizationName:n.organization_name}:e.oauthAccount})),E(`tengu_oauth_roles_stored`,{org_role:n.organization_role})}async function nr(e){try{let t=await f.post(D().API_KEY_URL,null,{headers:{Authorization:`Bearer ${e}`}}),n=t.data?.raw_key;return n?(await oo(n),E(`tengu_oauth_api_key`,{status:`success`,statusCode:t.status}),n):null}catch(e){throw E(`tengu_oauth_api_key`,{status:`failure`,error:e instanceof Error?e.message:String(e)}),e}}function rr(e){return e!==null&&Date.now()+300*1e3>=e}async function ir(e){let t=await Jn(e),n=t?.organization?.organization_type,r=null;switch(n){case`claude_max`:r=`max`;break;case`claude_pro`:r=`pro`;break;case`claude_enterprise`:r=`enterprise`;break;case`claude_team`:r=`team`;break;default:r=null;break}let i={subscriptionType:r,rateLimitTier:t?.organization?.rate_limit_tier??null,hasExtraUsageEnabled:t?.organization?.has_extra_usage_enabled??null,billingType:t?.organization?.billing_type??null};return t?.account?.display_name&&(i.displayName=t.account.display_name),t?.account?.created_at&&(i.accountCreatedAt=t.account.created_at),t?.organization?.subscription_created_at&&(i.subscriptionCreatedAt=t.organization.subscription_created_at),E(`tengu_oauth_profile_fetch_success`,{}),{...i,rawProfile:t}}async function ar(){let e=C().oauthAccount?.organizationUuid;if(e)return e;let t=G()?.accessToken;return t===void 0||!yo()?null:(await Jn(t))?.organization?.uuid||null}async function or(){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&&(C().oauthAccount||sr({accountUuid:e,emailAddress:t,organizationUuid:n})),await _o();let i=C();if(i.oauthAccount&&i.oauthAccount.billingType!==void 0&&i.oauthAccount.accountCreatedAt!==void 0&&i.oauthAccount.subscriptionCreatedAt!==void 0||!B()||!yo())return!1;let a=G();if(a?.accessToken){let e=await Jn(a.accessToken);if(e)return r&&v(`OAuth profile fetch succeeded, overriding env var account info`,{level:`info`}),sr({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 sr({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),S(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 cr=e((()=>{p(),ot(),O(),K(),We(),_(),Yn()}));function lr(e,t,n){if(s(process.env.CLAUDE_CODE_REMOTE))try{xt(mr,{recursive:!0,mode:448}),Ct(e,t,{encoding:`utf8`,mode:384}),v(`Persisted ${n} to ${e} for subprocess access`)}catch(e){v(`Failed to persist ${n} to disk (non-fatal): ${g(e)}`,{level:`error`})}}function ur(e,t){try{let n=Fe().readFileSync(e,{encoding:`utf8`}).trim();return n?(v(`Read ${t} from well-known file ${e}`),n):null}catch(n){return Ne(n)||v(`Failed to read ${t} from ${e}: ${g(n)}`,{level:`debug`}),null}}function dr({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=ur(t,n);return i(e),e}let s=parseInt(o,10);if(Number.isNaN(s))return v(`${e} must be a valid file descriptor number, got: ${o}`,{level:`error`}),i(null),null;try{let e=Fe(),r=process.platform===`darwin`||process.platform===`freebsd`?`/dev/fd/${s}`:`/proc/self/fd/${s}`,a=e.readFileSync(r,{encoding:`utf8`}).trim();return a?(v(`Successfully read ${n} from file descriptor ${s}`),i(a),lr(t,a,n),a):(v(`File descriptor contained empty ${n}`,{level:`error`}),i(null),null)}catch(e){v(`Failed to read ${n} from file descriptor ${s}: ${g(e)}`,{level:`error`});let r=ur(t,n);return i(r),r}}function fr(){return dr({envVar:`CLAUDE_CODE_OAUTH_TOKEN_FILE_DESCRIPTOR`,wellKnownPath:hr,label:`OAuth token`,getCached:we,setCached:_e})}function pr(){return dr({envVar:`CLAUDE_CODE_API_KEY_FILE_DESCRIPTOR`,wellKnownPath:gr,label:`API key`,getCached:Ee,setCached:ye})}var mr,hr,gr,_r,vr=e((()=>{m(),_(),l(),ze(),Ie(),mr=`/home/claude/.claude/remote`,hr=`${mr}/.oauth_token`,gr=`${mr}/.api_key`,_r=`${mr}/.session_ingress_token`}));function P(e=``){let t=c(),n=process.env.CLAUDE_CONFIG_DIR?`-${wt(`sha256`).update(t).digest(`hex`).substring(0,8)}`:``;return`Claude Code${D().OAUTH_FILE_SUFFIX}${e}${n}`}function yr(){try{return process.env.USER||vt().username}catch{return`claude-code-user`}}function F(){I.cache={data:null,cachedAt:0},I.generation++,I.readInFlight=null}function br(e){if(I.cache.cachedAt!==0)return;let t=null;if(e)try{t=JSON.parse(e)}catch{return}I.cache={data:t,cachedAt:Date.now()}}var xr,I,Sr=e((()=>{O(),l(),xr=`-credentials`,I={cache:{data:null,cachedAt:0},generation:0,readInFlight:null}}));async function Cr(){if(process.platform===`darwin`&&(await Ye(`security delete-generic-password -a $USER -s "${P()}"`,{shell:!0,reject:!1})).exitCode!==0)throw Error(`Failed to delete keychain entry`)}function wr(e){return e.slice(-20)}var Tr=e((()=>{qe(),Sr()}));function Er(e){return e?.name===`CredentialsProviderError`}function Dr(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 Or(){let{STSClient:e,GetCallerIdentityCommand:t}=await import(`./dist-es-C-OjW2Ao.js`);await new e().send(new t({}))}async function kr(){try{v(`Clearing AWS credential provider cache`);let{fromIni:e}=await import(`./dist-es-CIULjvtA2.js`);await e({ignoreCache:!0})(),v(`AWS credential provider cache refreshed`)}catch{v(`Failed to clear AWS credential cache (this is expected if no credentials are configured)`)}}var Ar=e((()=>{_()})),jr,Mr=e((()=>{he(),ee(),jr=class e{constructor(){te(this,`status`,{isAuthenticating:!1,output:[]}),te(this,`changed`,Te()),te(this,`subscribe`,this.changed.subscribe)}static getInstance(){return e.instance||(e.instance=new e),e.instance}getStatus(){return{...this.status,output:[...this.status.output]}}startAuthentication(){this.status={isAuthenticating:!0,output:[]},this.changed.emit(this.getStatus())}addOutput(e){this.status.output.push(e),this.changed.emit(this.getStatus())}setError(e){this.status.error=e,this.changed.emit(this.getStatus())}endAuthentication(e){e?this.status={isAuthenticating:!1,output:[]}:this.status.isAuthenticating=!1,this.changed.emit(this.getStatus())}static reset(){e.instance&&(e.instance.changed.clear(),e.instance=null)}},te(jr,`instance`,null)})),Nr,Pr,Fr,Ir,Lr,Rr,zr,Br,Vr,Hr,Ur,Wr,Gr,Kr,qr,Jr=e((()=>{Nr=`claude-code-20250219`,Pr=`interleaved-thinking-2025-05-14`,Fr=`context-1m-2025-08-07`,Ir=`context-management-2025-06-27`,Lr=`structured-outputs-2025-12-15`,Rr=`tool-search-tool-2025-10-19`,zr=`task-budgets-2026-03-13`,Br=`prompt-caching-scope-2026-01-05`,Vr=`fast-mode-2026-02-01`,Hr=`redact-thinking-2026-02-12`,Ur=`afk-mode-2026-01-31`,Wr=process.env.USER_TYPE===`ant`?`cli-internal-2026-02-09`:``,Gr=`advisor-tool-2026-03-01`,Kr=new Set([Pr,Fr,Rr]),qr=new Set([Nr,Pr,Ir])}));function Yr(e,t){return pe(e,t)}var Xr=e((()=>{ve()}));function Zr(){return`claude-code/0.0.6`}var Qr=e((()=>{}));function $r(){let e=process.env.CLAUDE_AGENT_SDK_VERSION?`, agent-sdk/${process.env.CLAUDE_AGENT_SDK_VERSION}`:``,t=process.env.CLAUDE_AGENT_SDK_CLIENT_APP?`, client-app/${process.env.CLAUDE_AGENT_SDK_CLIENT_APP}`:``,n=Pt(),r=n?`, workload/${n}`:``;return`claude-cli/0.0.6 (${process.env.USER_TYPE}, ${process.env.CLAUDE_CODE_ENTRYPOINT??`cli`}${e}${t}${r})`}function ei(){let e=[];return process.env.CLAUDE_CODE_ENTRYPOINT&&e.push(process.env.CLAUDE_CODE_ENTRYPOINT),process.env.CLAUDE_AGENT_SDK_VERSION&&e.push(`agent-sdk/${process.env.CLAUDE_AGENT_SDK_VERSION}`),process.env.CLAUDE_AGENT_SDK_CLIENT_APP&&e.push(`client-app/${process.env.CLAUDE_AGENT_SDK_CLIENT_APP}`),`claude-code/0.0.6${e.length>0?` (${e.join(`, `)})`:``}`}function ti(){return`Claude-User (${Zr()}; +https://support.anthropic.com/)`}function ni(){if(B()){let e=G();return e?.accessToken?{headers:{Authorization:`Bearer ${e.accessToken}`,"anthropic-beta":lt}}:{headers:{},error:`No OAuth token available`}}let e=R();return e?{headers:{"x-api-key":e}}:{headers:{},error:`No API key available`}}async function ri(e,t){try{return await e()}catch(n){if(!f.isAxiosError(n))throw n;let r=n.response?.status;if(!(r===401||t?.also403Revoked&&r===403&&typeof n.response?.data==`string`&&n.response.data.includes(`OAuth token has been revoked`)))throw n;let i=G()?.accessToken;if(!i)throw n;return await mo(i),await e()}}var ii=e((()=>{p(),O(),K(),Qr(),Lt()}));function ai(){return{error:(e,...t)=>console.error(`[SDK ERROR]`,e,...t),warn:(e,...t)=>console.error(`[SDK WARN]`,e,...t),info:(e,...t)=>console.error(`[SDK INFO]`,e,...t),debug:(e,...t)=>console.error(`[SDK DEBUG]`,e,...t)}}async function oi({apiKey:e,maxRetries:n,model:r,fetchOverride:i,source:a}){let c=process.env.CLAUDE_CODE_CONTAINER_ID,l=process.env.CLAUDE_CODE_REMOTE_SESSION_ID,u=process.env.CLAUDE_AGENT_SDK_CLIENT_APP,ee=ci(),te={"x-app":`cli`,"User-Agent":$r(),"X-Claude-Code-Session-Id":be(),...ee,...c?{"x-claude-remote-container-id":c}:{},...l?{"x-claude-remote-session-id":l}:{},...u?{"x-client-app":u}:{},...process.env.ANTHROPIC_AUTH_NONCE?{"x-auth-nonce":process.env.ANTHROPIC_AUTH_NONCE}:{}};v(`[API:request] Creating client, ANTHROPIC_CUSTOM_HEADERS present: ${!!process.env.ANTHROPIC_CUSTOM_HEADERS}, has Authorization header: ${!!ee.Authorization}`),s(process.env.CLAUDE_CODE_ADDITIONAL_PROTECTION)&&(te[`x-anthropic-additional-protection`]=`true`),v(`[API:auth] OAuth token check starting`),await _o(),v(`[API:auth] OAuth token check complete`),B()||await si(te,h());let f=li(i,a),p={defaultHeaders:te,maxRetries:n,timeout:parseInt(process.env.API_TIMEOUT_MS||`600000`,10),dangerouslyAllowBrowser:!0,fetchOptions:ht({forAnthropicAPI:!0}),...f&&{fetch:f}};if(s(process.env.CLAUDE_CODE_USE_BEDROCK)){let{BedrockClient:e}=await import(`./bedrockClient-DxE_mHFI.js`),t=r===fc()&&process.env.ANTHROPIC_SMALL_FAST_MODEL_AWS_REGION?process.env.ANTHROPIC_SMALL_FAST_MODEL_AWS_REGION:d(),n={...p,awsRegion:t,...s(process.env.CLAUDE_CODE_SKIP_BEDROCK_AUTH)&&{skipAuth:!0},...Le()&&{logger:ai()}};if(process.env.AWS_BEARER_TOKEN_BEDROCK)n.skipAuth=!0,n.defaultHeaders={...n.defaultHeaders,Authorization:`Bearer ${process.env.AWS_BEARER_TOKEN_BEDROCK}`};else if(!s(process.env.CLAUDE_CODE_SKIP_BEDROCK_AUTH)){let e=await W();e&&(n.awsAccessKey=e.accessKeyId,n.awsSecretKey=e.secretAccessKey,n.awsSessionToken=e.sessionToken)}return new e(n)}if(s(process.env.CLAUDE_CODE_USE_FOUNDRY)){let{AnthropicFoundry:e}=await import(`./foundry-sdk-BdeF2aBu.js`),t;if(!process.env.ANTHROPIC_FOUNDRY_API_KEY)if(s(process.env.CLAUDE_CODE_SKIP_FOUNDRY_AUTH))t=()=>Promise.resolve(``);else{let{DefaultAzureCredential:e,getBearerTokenProvider:n}=await import(`./esm-CGx9qY3q.js`);t=n(new e,`https://cognitiveservices.azure.com/.default`)}return new e({...p,...t&&{azureADTokenProvider:t},...Le()&&{logger:ai()}})}if(s(process.env.CLAUDE_CODE_USE_VERTEX)){s(process.env.CLAUDE_CODE_SKIP_VERTEX_AUTH)||await Ko();let[{AnthropicVertex:e},{GoogleAuth:n}]=await Promise.all([import(`./vertex-sdk-DjXcZ2J7.js`),import(`./src-CiJCsqUl.js`).then(e=>t(e.default,1))]),i=process.env.GCLOUD_PROJECT||process.env.GOOGLE_CLOUD_PROJECT||process.env.gcloud_project||process.env.google_cloud_project,a=process.env.GOOGLE_APPLICATION_CREDENTIALS||process.env.google_application_credentials,c=s(process.env.CLAUDE_CODE_SKIP_VERTEX_AUTH)?{getClient:()=>({getRequestHeaders:()=>({})})}:new n({scopes:[`https://www.googleapis.com/auth/cloud-platform`],...i||a?{}:{projectId:process.env.ANTHROPIC_VERTEX_PROJECT_ID}});return new e({...p,region:o(r),googleAuth:c,...Le()&&{logger:ai()}})}return new je({apiKey:B()?null:e||R(),authToken:B()?G()?.accessToken:void 0,...process.env.USER_TYPE===`ant`&&s(process.env.USE_STAGING_OAUTH)?{baseURL:D().BASE_API_URL}:{},...p,...Le()&&{logger:ai()}})}async function si(e,t){let n=process.env.ANTHROPIC_AUTH_TOKEN||await Va(t);n&&(e.Authorization=`Bearer ${n}`)}function ci(){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 li(e,t){let n=e??globalThis.fetch,r=k()===`firstParty`&&Nt();return(e,i)=>{let a=new Headers(i?.headers);r&&!a.has(`x-client-request-id`)&&a.set(ui,Tt());try{let n=e instanceof Request?e.url:String(e),r=a.get(ui);v(`[API REQUEST] ${new URL(n).pathname}${r?` ${ui}=${r}`:``} source=${t??`unknown`}`)}catch{}return n(e,{...i,headers:a})}}var ui,di=e((()=>{ke(),K(),ii(),$(),A(),_t(),m(),O(),_(),l(),ui=`x-client-request-id`}));function fi(){return yt(c(),`cache`)}function pi(){return yt(fi(),`model-capabilities.json`)}function mi(){return!(k()!==`firstParty`||!Nt())}function hi(e){return[...e].sort((e,t)=>t.id.length-e.id.length||e.id.localeCompare(t.id))}function gi(e){if(!mi())return;let t=bi(pi());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 _i(){if(mi()&&!et())try{let e=await oi({maxRetries:1}),t=B()?[lt]:void 0,n=[];for await(let r of e.models.list({betas:t})){let e=vi().safeParse(r);e.success&&n.push(e.data)}if(n.length===0)return;let r=pi(),i=hi(n);if(Yr(bi(r),i)){v(`[modelCapabilities] cache unchanged, skipping write`);return}await Et(fi(),{recursive:!0}),await Ot(r,Re({models:i,timestamp:Date.now()}),{encoding:`utf-8`,mode:384}),bi.cache.delete(r),v(`[modelCapabilities] cached ${i.length} models`)}catch(e){v(`[modelCapabilities] fetch failed: ${e instanceof Error?e.message:`unknown`}`)}}var vi,yi,bi,xi=e((()=>{Xr(),i(),le(),O(),di(),K(),_(),l(),it(),ue(),$e(),Me(),A(),vi=ce(()=>ie({id:ae(),max_input_tokens:oe().optional(),max_tokens:oe().optional()}).strip()),yi=ce(()=>ie({models:se(vi()),timestamp:oe()})),bi=r(e=>{try{let t=St(e,`utf-8`),n=yi().safeParse(at(t,!1));return n.success?n.data.models:null}catch{return null}},e=>e)}));function Si(){return s(process.env.CLAUDE_CODE_DISABLE_1M_CONTEXT)}function L(e){return!Si()&&/\[1m\]/i.test(e)}function Ci(e){if(Si())return!1;let t=Z(e);return t.includes(`claude-sonnet-4`)||t.includes(`opus-4-6`)||t.includes(`opus-4-7`)}function wi(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(L(e))return 1e6;let n=gi(e);if(n?.max_input_tokens&&n.max_input_tokens>=1e5)return n.max_input_tokens>2e5&&Si()?ki:n.max_input_tokens;if(t?.includes(`context-1m-2025-08-07`)&&Ci(e)||Ti(e))return 1e6;if(process.env.USER_TYPE===`ant`){let t=Bt(e);if(t?.contextWindow)return t.contextWindow}return ki}function Ti(e){return Si()||L(e)||!Z(e).includes(`sonnet-4-6`)?!1:C().clientDataCache?.coral_reef_sonnet===`true`}function Ei(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 Di(e){let t,n;if(process.env.USER_TYPE===`ant`){let r=Bt(e.toLowerCase());if(r)return t=r.defaultMaxTokens??ji,n=r.upperMaxTokensLimit??Mi,{default:t,upperLimit:n}}let r=Z(e);r.includes(`opus-4-7`)||r.includes(`opus-4-6`)?(t=64e3,n=128e3):r.includes(`sonnet-4-6`)?(t=32e3,n=128e3):r.includes(`opus-4-5`)||r.includes(`sonnet-4`)||r.includes(`haiku-4`)?(t=32e3,n=64e3):r.includes(`opus-4-1`)||r.includes(`opus-4`)?(t=32e3,n=32e3):r.includes(`claude-3-opus`)?(t=4096,n=4096):r.includes(`claude-3-sonnet`)?(t=8192,n=8192):r.includes(`claude-3-haiku`)?(t=4096,n=4096):r.includes(`3-5-sonnet`)||r.includes(`3-5-haiku`)?(t=8192,n=8192):r.includes(`3-7-sonnet`)?(t=32e3,n=64e3):(t=ji,n=Mi);let i=gi(e);return i?.max_tokens&&i.max_tokens>=4096&&(n=i.max_tokens,t=Math.min(t,n)),{default:t,upperLimit:n}}function Oi(e){return Di(e).upperLimit-1}var ki,Ai,ji,Mi,Ni,Pi=e((()=>{Jr(),We(),l(),$(),Vt(),xi(),ki=2e5,Ai=2e4,ji=32e3,Mi=64e3,Ni=8e3})),Fi,Ii,Li,Ri=e((()=>{i(),A(),Fi=[{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`}],Ii=[{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`}],Li=r((e,t)=>{if(k()===`firstParty`)return;let n=e.toLowerCase(),r=k()===`openai`?Ii:Fi;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 zi(e){let t=[],n=[];for(let r of e)Yi.includes(r)?t.push(r):n.push(r);return{allowed:t,disallowed:n}}function Bi(e){if(!e||e.length===0)return;if(B()){console.warn(`Warning: Custom betas are only available for API key users. Ignoring provided betas.`);return}let{allowed:t,disallowed:n}=zi(e);for(let e of n)console.warn(`Warning: Beta header '${e}' is not allowed. Only the following betas are supported: ${Yi.join(`, `)}`);return t.length>0?t:void 0}function Vi(e){let t=Li(e,`interleaved_thinking`);if(t!==void 0)return t;let n=Z(e),r=k();return r===`foundry`?!0:r===`firstParty`?!n.includes(`claude-3-`):n.includes(`claude-opus-4`)||n.includes(`claude-sonnet-4`)}function Hi(e){let t=Z(e),n=k();return n===`foundry`?!0:n===`firstParty`?!t.includes(`claude-3-`):t.includes(`claude-opus-4`)||t.includes(`claude-sonnet-4`)||t.includes(`claude-haiku-4`)}function Ui(e){let t=Z(e),n=k();return n!==`firstParty`&&n!==`foundry`?!1:t.includes(`claude-sonnet-4-6`)||t.includes(`claude-sonnet-4-5`)||t.includes(`claude-opus-4-1`)||t.includes(`claude-opus-4-5`)||t.includes(`claude-opus-4-6`)||t.includes(`claude-opus-4-7`)||t.includes(`claude-haiku-4-5`)}function Wi(e){return!0}function Gi(){return(k()===`firstParty`||k()===`foundry`)&&!s(process.env.CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS)&&Nt()}function Ki(){return k()===`firstParty`&&!s(process.env.CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS)}function qi(e,t){let n=[...Zi(e)];t?.isAgenticQuery&&(n.includes(`claude-code-20250219`)||n.push(Nr),process.env.USER_TYPE===`ant`&&process.env.CLAUDE_CODE_ENTRYPOINT===`cli`&&Wr&&!n.includes(Wr)&&n.push(Wr));let r=xe();return!r||r.length===0?n:[...n,...r.filter(e=>!n.includes(e))]}function Ji(){Xi.cache?.clear?.(),Zi.cache?.clear?.(),Qi.cache?.clear?.()}var Yi,Xi,Zi,Qi,$i=e((()=>{i(),m(),Jr(),O(),K(),Pi(),l(),$(),Ri(),A(),x(),Yi=[Fr],Xi=r(e=>{let t=[],n=Z(e).includes(`haiku`);k();let r=Gi();n||(t.push(Nr),process.env.USER_TYPE===`ant`&&process.env.CLAUDE_CODE_ENTRYPOINT===`cli`&&Wr&&t.push(Wr)),B()&&t.push(lt),L(e)&&t.push(Fr),!s(process.env.DISABLE_INTERLEAVED_THINKING)&&Vi(e)&&t.push(Pr),r&&Vi(e)&&!h()&&Ve().showThinkingSummaries!==!0&&t.push(Hr);let i=s(process.env.USE_API_CONTEXT_MANAGEMENT)||Hi(e),a=Hi(e);return Gi()&&(i||a)&&t.push(Ir),r&&Ui(e),process.env.USER_TYPE,r&&t.push(Br),process.env.ANTHROPIC_BETAS&&t.push(...process.env.ANTHROPIC_BETAS.split(`,`).map(e=>e.trim()).filter(Boolean)),t}),Zi=r(e=>{let t=Xi(e);return k()===`bedrock`?t.filter(e=>!Kr.has(e)):t}),Qi=r(e=>Xi(e).filter(e=>Kr.has(e)))}));function ea(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 ta=e((()=>{}));async function na(){try{let e=P(xr),{stdout:t,code:n}=await Qe(`security`,[`find-generic-password`,`-a`,yr(),`-w`,`-s`,e],{useCwd:!1,preserveOutputOnError:!1});if(n===0&&t)return De(t.trim())}catch{}return null}function ra(){if(oa!==void 0)return oa;if(process.platform!==`darwin`)return oa=!1,!1;try{oa=Ze(`security`,[`show-keychain-info`],{reject:!1,stdio:[`ignore`,`pipe`,`pipe`]}).exitCode===36}catch{oa=!1}return oa}var ia,aa,oa,sa=e((()=>{qe(),_(),Xe(),Ke(),Me(),Sr(),ia=4032,aa={name:`keychain`,read(){let e=I.cache;if(Date.now()-e.cachedAt<3e4)return e.data;try{let e=P(xr),t=Je(`security find-generic-password -a "${yr()}" -w -s "${e}"`);if(t){let e=De(t);return I.cache={data:e,cachedAt:Date.now()},e}}catch{}return e.data===null?(I.cache={data:null,cachedAt:Date.now()},null):(v(`[keychain] read failed; serving stale cache`,{level:`warn`}),I.cache={data:e.data,cachedAt:Date.now()},e.data)},async readAsync(){let e=I.cache;if(Date.now()-e.cachedAt<3e4)return e.data;if(I.readInFlight)return I.readInFlight;let t=I.generation,n=na().then(n=>{if(t===I.generation){n===null&&e.data!==null&&v(`[keychain] readAsync failed; serving stale cache`,{level:`warn`});let t=n??e.data;return I.cache={data:t,cachedAt:Date.now()},I.readInFlight=null,t}return n});return I.readInFlight=n,n},update(e){F();try{let t=P(xr),n=yr(),r=Re(e),i=Buffer.from(r,`utf-8`).toString(`hex`),a=`add-generic-password -U -a "${n}" -s "${t}" -X "${i}"\n`,o;return a.length<=ia?o=Ze(`security`,[`-i`],{input:a,stdio:[`pipe`,`pipe`,`pipe`],reject:!1}):(v(`Keychain payload (${r.length}B JSON) exceeds security -i stdin limit; using argv`,{level:`warn`}),o=Ze(`security`,[`add-generic-password`,`-U`,`-a`,n,`-s`,t,`-X`,i],{stdio:[`ignore`,`pipe`,`pipe`],reject:!1})),o.exitCode===0?(I.cache={data:e,cachedAt:Date.now()},{success:!0}):{success:!1}}catch{return{success:!1}}},delete(){F();try{let e=P(xr);return Je(`security delete-generic-password -a "${yr()}" -s "${e}"`),!0}catch{return!1}}}}));function ca(){let e=c();return{storageDir:e,storagePath:yt(e,`.credentials.json`)}}var la,ua=e((()=>{l(),ze(),Ie(),Me(),la={name:`plaintext`,read(){let{storagePath:e}=ca();try{return De(Fe().readFileSync(e,{encoding:`utf8`}))}catch{return null}},async readAsync(){let{storagePath:e}=ca();try{return De(await Fe().readFile(e,{encoding:`utf8`}))}catch{return null}},update(e){try{let{storageDir:t,storagePath:n}=ca();try{Fe().mkdirSync(t)}catch(e){if(Ae(e)!==`EEXIST`)throw e}return Oe(n,Re(e),{encoding:`utf8`,flush:!1}),bt(n,384),{success:!0,warning:`Warning: Storing credentials in plaintext.`}}catch{return{success:!1}}},delete(){let{storagePath:e}=ca();try{return Fe().unlinkSync(e),!0}catch(e){return Ae(e)===`ENOENT`}}}}));function da(){return process.platform===`darwin`?ea(aa,la):la}var fa=e((()=>{ta(),sa(),ua()}));function pa(e){return new Promise(t=>{At(`security`,[`find-generic-password`,`-a`,yr(),`-w`,`-s`,e],{encoding:`utf-8`,timeout:va},(e,n)=>{t({stdout:e?null:n?.trim()||null,timedOut:!!(e&&`killed`in e&&e.killed)})})})}function ma(){if(process.platform!==`darwin`||ba||u())return;let e=pa(P(xr)),t=pa(P());ba=Promise.all([e,t]).then(([e,t])=>{e.timedOut||br(e.stdout),t.timedOut||(ya={stdout:t.stdout})})}async function ha(){ba&&await ba}function ga(){return ya}function _a(){ya=null}var va,ya,ba,xa=e((()=>{l(),Sr(),va=1e4,ya=null,ba=null}));function Sa(e,t,n){return new Promise((r,i)=>{if(t?.aborted){n?.throwOnAbort||n?.abortError?i(n.abortError?.()??Error(`aborted`)):r();return}let a=setTimeout((e,t,n)=>{e?.removeEventListener(`abort`,t),n()},e,t,o,r);function o(){clearTimeout(a),n?.throwOnAbort||n?.abortError?i(n.abortError?.()??Error(`aborted`)):r()}t?.addEventListener(`abort`,o,{once:!0}),n?.unref&&a.unref()})}var Ca=e((()=>{}));function wa(){return Ea}function Ta(){Ea.clear()}var Ea,Da=e((()=>{Ea=new Map})),Oa=n({calculateApiKeyHelperTTL:()=>za,checkAndRefreshOAuthTokenIfNeeded:()=>_o,checkGcpCredentialsValid:()=>$a,clearApiKeyHelperCache:()=>Ga,clearAwsCredentialsCache:()=>Xa,clearGcpCredentialsCache:()=>no,clearOAuthTokenCache:()=>fo,getAccountInformation:()=>Lo,getAnthropicApiKey:()=>R,getAnthropicApiKeyWithSource:()=>Na,getApiKeyFromApiKeyHelper:()=>Va,getApiKeyFromApiKeyHelperCached:()=>Wa,getApiKeyFromConfigOrMacOSKeychain:()=>qo,getApiKeyHelperElapsedMs:()=>Ba,getAuthTokenSource:()=>ja,getClaudeAIOAuthTokens:()=>G,getClaudeAIOAuthTokensAsync:()=>go,getConfiguredApiKeyHelper:()=>z,getOauthAccountInfo:()=>xo,getOtelHeadersFromHelper:()=>Po,getRateLimitTier:()=>ko,getSubscriptionName:()=>Ao,getSubscriptionType:()=>V,handleOAuth401Error:()=>mo,hasAnthropicApiKeyAuth:()=>Ma,hasOpusAccess:()=>Co,hasProfileScope:()=>yo,is1PApiCustomer:()=>bo,isAnthropicAuthEnabled:()=>Aa,isAwsAuthRefreshFromProjectSettings:()=>Ia,isAwsCredentialExportFromProjectSettings:()=>Ra,isClaudeAISubscriber:()=>B,isConsumerSubscriber:()=>Io,isCustomApiKeyApproved:()=>so,isEnterpriseSubscriber:()=>Do,isGcpAuthRefreshFromProjectSettings:()=>Qa,isMaxSubscriber:()=>wo,isOtelHeadersHelperFromProjectOrLocalSettings:()=>No,isOverageProvisioningAllowed:()=>So,isProSubscriber:()=>Oo,isTeamPremiumSubscriber:()=>Eo,isTeamSubscriber:()=>To,isUsing3PServices:()=>jo,prefetchApiKeyFromApiKeyHelperIfSafe:()=>Ka,prefetchAwsCredentialsAndBedRockInfoIfSafe:()=>io,prefetchGcpCredentialsIfSafe:()=>ro,refreshAndGetAwsCredentials:()=>W,refreshAwsAuth:()=>Ja,refreshGcpAuth:()=>to,refreshGcpCredentialsIfNeeded:()=>Ko,removeApiKey:()=>co,saveApiKey:()=>oo,saveOAuthTokensIfNeeded:()=>uo,validateForceLoginOrg:()=>Ro});function ka(){return s(process.env.CLAUDE_CODE_REMOTE)||process.env.CLAUDE_CODE_ENTRYPOINT===`claude-desktop`}function Aa(){if(u())return!1;if(process.env.ANTHROPIC_UNIX_SOCKET)return!!process.env.CLAUDE_CODE_OAUTH_TOKEN;let e=b()||{},t=s(process.env.CLAUDE_CODE_USE_BEDROCK)||s(process.env.CLAUDE_CODE_USE_VERTEX)||s(process.env.CLAUDE_CODE_USE_FOUNDRY)||e.modelType===`openai`||e.modelType===`gemini`||!!process.env.OPENAI_BASE_URL||!!process.env.GEMINI_BASE_URL,n=e.apiKeyHelper,r=process.env.ANTHROPIC_AUTH_TOKEN||n||process.env.CLAUDE_CODE_API_KEY_FILE_DESCRIPTOR,{source:i}=Na({skipRetrievingKeyFromApiKeyHelper:!0}),a=i===`ANTHROPIC_API_KEY`||i===`apiKeyHelper`;return!(t||r&&!ka()||a&&!ka())}function ja(){if(u())return z()?{source:`apiKeyHelper`,hasToken:!0}:{source:`none`,hasToken:!1};if(process.env.ANTHROPIC_AUTH_TOKEN&&!ka())return{source:`ANTHROPIC_AUTH_TOKEN`,hasToken:!0};if(process.env.CLAUDE_CODE_OAUTH_TOKEN)return{source:`CLAUDE_CODE_OAUTH_TOKEN`,hasToken:!0};if(fr())return process.env.CLAUDE_CODE_OAUTH_TOKEN_FILE_DESCRIPTOR?{source:`CLAUDE_CODE_OAUTH_TOKEN_FILE_DESCRIPTOR`,hasToken:!0}:{source:`CCR_OAUTH_TOKEN_FILE`,hasToken:!0};if(z()&&!ka())return{source:`apiKeyHelper`,hasToken:!0};let e=G();return Xn(e?.scopes)&&e?.accessToken?{source:`claude.ai`,hasToken:!0}:{source:`none`,hasToken:!1}}function R(){let{key:e}=Na();return e}function Ma(){let{key:e,source:t}=Na({skipRetrievingKeyFromApiKeyHelper:!0});return e!==null&&t!==`none`}function Na(e={}){if(u())return process.env.ANTHROPIC_API_KEY?{key:process.env.ANTHROPIC_API_KEY,source:`ANTHROPIC_API_KEY`}:z()?{key:e.skipRetrievingKeyFromApiKeyHelper?null:Wa(),source:`apiKeyHelper`}:{key:null,source:`none`};let t=a()?void 0:process.env.ANTHROPIC_API_KEY;if(Ce()&&t)return{key:t,source:`ANTHROPIC_API_KEY`};if(s(process.env.CI)){let e=pr();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&&C().customApiKeyResponses?.approved?.includes(wr(t)))return{key:t,source:`ANTHROPIC_API_KEY`};let n=pr();return n?{key:n,source:`ANTHROPIC_API_KEY`}:z()?e.skipRetrievingKeyFromApiKeyHelper?{key:null,source:`apiKeyHelper`}:{key:Wa(),source:`apiKeyHelper`}:qo()||{key:null,source:`none`}}function z(){return u()?y(`flagSettings`)?.apiKeyHelper:(b()||{}).apiKeyHelper}function Pa(){let e=z();if(!e)return!1;let t=y(`projectSettings`),n=y(`localSettings`);return t?.apiKeyHelper===e||n?.apiKeyHelper===e}function Fa(){return(b()||{}).awsAuthRefresh}function Ia(){let e=Fa();if(!e)return!1;let t=y(`projectSettings`),n=y(`localSettings`);return t?.awsAuthRefresh===e||n?.awsAuthRefresh===e}function La(){return(b()||{}).awsCredentialExport}function Ra(){let e=La();if(!e)return!1;let t=y(`projectSettings`),n=y(`localSettings`);return t?.awsCredentialExport===e||n?.awsCredentialExport===e}function za(){let e=process.env.CLAUDE_CODE_API_KEY_HELPER_TTL_MS;if(e){let t=parseInt(e,10);if(!Number.isNaN(t)&&t>=0)return t;v(`Found CLAUDE_CODE_API_KEY_HELPER_TTL_MS env var, but it was not a valid number. Got ${e}`,{level:`error`})}return zo}function Ba(){let e=U?.startedAt;return e?Date.now()-e:0}async function Va(e){if(!z())return null;let t=za();return H?(Date.now()-H.timestamp<t||U||(U={promise:Ha(e,!1,Bo),startedAt:null}),H.value):(U||(U={promise:Ha(e,!0,Bo),startedAt:Date.now()}),U.promise)}async function Ha(e,t,n){try{let t=await Ua(e);return n===Bo&&t!==null&&(H={value:t,timestamp:Date.now()}),t}catch(e){if(n!==Bo)return` `;let r=e instanceof Error?e.message:String(e);return console.error(re.red(`apiKeyHelper failed: ${r}`)),v(`Error getting API key from apiKeyHelper: ${r}`,{level:`error`}),!t&&H&&H.value!==` `?(H={...H,timestamp:Date.now()},H.value):(H={value:` `,timestamp:Date.now()},` `)}finally{n===Bo&&(U=null)}}async function Ua(e){let t=z();if(!t)return null;if(Pa()&&!w()&&!e)return Pe(`apiKeyHelper invoked before trust check`,Error(`Security: apiKeyHelper executed before workspace trust is confirmed. If you see this message, post in .`)),E(`tengu_apiKeyHelper_missing_trust11`,{}),null;let n=await Ye(t,{shell:!0,timeout:600*1e3,reject:!1});if(n.failed){let e=n.timedOut?`timed out`:`exited ${n.exitCode}`,t=n.stderr?.trim();throw Error(t?`${e}: ${t}`:e)}let r=n.stdout?.trim();if(!r)throw Error(`did not return a value`);return r}function Wa(){return H?.value??null}function Ga(){Bo++,H=null,U=null}function Ka(e){Pa()&&!w()||Va(e)}async function qa(){let e=Fa();if(!e)return!1;if(Ia()&&!w()&&!h())return Pe(`awsAuthRefresh invoked before trust check`,Error(`Security: awsAuthRefresh executed before workspace trust is confirmed. If you see this message, post in .`)),E(`tengu_awsAuthRefresh_missing_trust`,{}),!1;try{return v(`Fetching AWS caller identity for AWS auth refresh command`),await Or(),v(`Fetched AWS caller identity, skipping AWS auth refresh command`),!1}catch{return Ja(e)}}function Ja(e){v(`Running AWS auth refresh command`);let t=jr.getInstance();return t.startAuthentication(),new Promise(n=>{let r=kt(e,{timeout:Ho});r.stdout.on(`data`,e=>{let n=e.toString().trim();n&&(t.addOutput(n),v(n,{level:`debug`}))}),r.stderr.on(`data`,e=>{let n=e.toString().trim();n&&(t.setError(n),v(n,{level:`error`}))}),r.on(`close`,(e,r)=>{if(e===0)v(`AWS auth refresh completed successfully`),t.endAuthentication(!0),n(!0);else{let e=r===`SIGTERM`?re.red(`AWS auth refresh timed out after 3 minutes. Run your auth command manually in a separate terminal.`):re.red(`Error running awsAuthRefresh (in settings or ~/.claude.json):`);console.error(e),t.endAuthentication(!1),n(!1)}})})}async function Ya(){let e=La();if(!e)return null;if(Ra()&&!w()&&!h())return Pe(`awsCredentialExport invoked before trust check`,Error(`Security: awsCredentialExport executed before workspace trust is confirmed. If you see this message, post in .`)),E(`tengu_awsCredentialExport_missing_trust`,{}),null;try{return v(`Fetching AWS caller identity for credential export command`),await Or(),v(`Fetched AWS caller identity, skipping AWS credential export command`),null}catch{try{v(`Running AWS credential export command`);let t=await Ye(e,{shell:!0,reject:!1});if(t.exitCode!==0||!t.stdout)throw Error(`awsCredentialExport did not return a valid value`);let n=De(t.stdout.trim());if(!Dr(n))throw Error(`awsCredentialExport did not return valid AWS STS output structure`);return v(`AWS credentials retrieved from awsCredentialExport`),{accessKeyId:n.Credentials.AccessKeyId,secretAccessKey:n.Credentials.SecretAccessKey,sessionToken:n.Credentials.SessionToken}}catch(e){let t=re.red(`Error getting AWS credentials from awsCredentialExport (in settings or ~/.claude.json):`);return e instanceof Error?console.error(t,e.message):console.error(t,e),null}}}function Xa(){W.cache.clear()}function Za(){return(b()||{}).gcpAuthRefresh}function Qa(){let e=Za();if(!e)return!1;let t=y(`projectSettings`),n=y(`localSettings`);return t?.gcpAuthRefresh===e||n?.gcpAuthRefresh===e}async function $a(){try{let{GoogleAuth:e}=await import(`./src-CiJCsqUl.js`).then(e=>t(e.default,1)),n=new e({scopes:[`https://www.googleapis.com/auth/cloud-platform`]}),r=(async()=>{await(await n.getClient()).getAccessToken()})(),i=Sa(Uo).then(()=>{throw new es(`GCP credentials check timed out`)});return await Promise.race([r,i]),!0}catch{return!1}}async function eo(){let e=Za();if(!e)return!1;if(Qa()&&!w()&&!h())return Pe(`gcpAuthRefresh invoked before trust check`,Error(`Security: gcpAuthRefresh executed before workspace trust is confirmed. If you see this message, post in .`)),E(`tengu_gcpAuthRefresh_missing_trust`,{}),!1;try{if(v(`Checking GCP credentials validity for auth refresh`),await $a())return v(`GCP credentials are valid, skipping auth refresh command`),!1}catch{}return to(e)}function to(e){v(`Running GCP auth refresh command`);let t=jr.getInstance();return t.startAuthentication(),new Promise(n=>{let r=kt(e,{timeout:Go});r.stdout.on(`data`,e=>{let n=e.toString().trim();n&&(t.addOutput(n),v(n,{level:`debug`}))}),r.stderr.on(`data`,e=>{let n=e.toString().trim();n&&(t.setError(n),v(n,{level:`error`}))}),r.on(`close`,(e,r)=>{if(e===0)v(`GCP auth refresh completed successfully`),t.endAuthentication(!0),n(!0);else{let e=r===`SIGTERM`?re.red(`GCP auth refresh timed out after 3 minutes. Run your auth command manually in a separate terminal.`):re.red(`Error running gcpAuthRefresh (in settings or ~/.claude.json):`);console.error(e),t.endAuthentication(!1),n(!1)}})})}function no(){Ko.cache.clear()}function ro(){Za()&&(Qa()&&!w()&&!h()||Ko())}function io(){let e=Fa(),t=La();!e&&!t||(Ia()||Ra())&&!w()&&!h()||(W(),j())}function ao(e){return/^[a-zA-Z0-9-_]+$/.test(e)}async function oo(e){if(!ao(e))throw Error(`Invalid API key format. API key must contain only alphanumeric characters, dashes, and underscores.`);await lo();let t=!1;if(process.platform===`darwin`)try{let n=P();await Ye(`security`,[`-i`],{input:`add-generic-password -U -a "${yr()}" -s "${n}" -X "${Buffer.from(e,`utf-8`).toString(`hex`)}"\n`,reject:!1}),E(`tengu_api_key_saved_to_keychain`,{}),t=!0}catch(e){T(e),E(`tengu_api_key_keychain_error`,{error:g(e)}),E(`tengu_api_key_saved_to_config`,{})}else E(`tengu_api_key_saved_to_config`,{});let n=wr(e);S(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??[]}}}),qo.cache.clear?.(),_a()}function so(e){let t=C(),n=wr(e);return t.customApiKeyResponses?.approved?.includes(n)??!1}async function co(){await lo(),S(e=>({...e,primaryApiKey:void 0})),qo.cache.clear?.(),_a()}async function lo(){try{await Cr()}catch(e){T(e)}}function uo(e){if(!Xn(e.scopes))return E(`tengu_oauth_tokens_not_claude_ai`,{}),{success:!0};if(!e.refreshToken||!e.expiresAt)return E(`tengu_oauth_tokens_inference_only`,{}),{success:!0};let t=da(),n=t.name;try{let r=t.read()||{},i=r.claudeAiOauth;r.claudeAiOauth={accessToken:e.accessToken,refreshToken:e.refreshToken,expiresAt:e.expiresAt,scopes:e.scopes,subscriptionType:e.subscriptionType??i?.subscriptionType??null,rateLimitTier:e.rateLimitTier??i?.rateLimitTier??null};let a=t.update(r);return a.success?E(`tengu_oauth_tokens_saved`,{storageBackend:n}):E(`tengu_oauth_tokens_save_failed`,{storageBackend:n}),G.cache?.clear?.(),Ji(),Ta(),a}catch(e){return T(e),E(`tengu_oauth_tokens_save_exception`,{storageBackend:n,error:g(e)}),{success:!1,warning:`Failed to save OAuth tokens`}}}function fo(){G.cache?.clear?.(),F()}async function po(){try{let{mtimeMs:e}=await Dt(yt(c(),`.credentials.json`));e!==Jo&&(Jo=e,fo())}catch{G.cache?.clear?.()}}function mo(e){let t=Yo.get(e);if(t)return t;let n=ho(e).finally(()=>{Yo.delete(e)});return Yo.set(e,n),n}async function ho(e){fo();let t=await go();return t?.refreshToken?t.accessToken===e?_o(0,!0):(E(`tengu_oauth_401_recovered_from_keychain`,{}),!0):!1}async function go(){if(u())return null;if(process.env.CLAUDE_CODE_OAUTH_TOKEN||fr())return G();try{let e=(await da().readAsync())?.claudeAiOauth;return e?.accessToken?e:null}catch(e){return T(e),null}}function _o(e=0,t=!1){return e===0&&!t?Xo||(Xo=vo(e,t).finally(()=>{Xo=null}),Xo):vo(e,t)}async function vo(e,t){await po();let n=G();if(!t&&(!n?.refreshToken||!rr(n.expiresAt))||!n?.refreshToken||!Xn(n.scopes))return!1;G.cache?.clear?.(),F();let r=await go();if(!r?.refreshToken||!rr(r.expiresAt))return!1;let i=c();await Et(i,{recursive:!0});let a;try{E(`tengu_oauth_token_refresh_lock_acquiring`,{}),a=await Ge(i),E(`tengu_oauth_token_refresh_lock_acquired`,{})}catch(n){return n.code===`ELOCKED`?e<5?(E(`tengu_oauth_token_refresh_lock_retry`,{retryCount:e+1}),await Sa(1e3+Math.random()*1e3),vo(e+1,t)):(E(`tengu_oauth_token_refresh_lock_retry_limit_reached`,{maxRetries:5}),!1):(T(n),E(`tengu_oauth_token_refresh_lock_error`,{error:g(n)}),!1)}try{G.cache?.clear?.(),F();let e=await go();return!e?.refreshToken||!rr(e.expiresAt)?(E(`tengu_oauth_token_refresh_race_resolved`,{}),!1):(E(`tengu_oauth_token_refresh_starting`,{}),uo(await er(e.refreshToken,{scopes:Xn(e.scopes)?void 0:e.scopes})),G.cache?.clear?.(),F(),!0)}catch(e){T(e),G.cache?.clear?.(),F();let t=await go();return t&&!rr(t.expiresAt)?(E(`tengu_oauth_token_refresh_race_recovered`,{}),!0):!1}finally{E(`tengu_oauth_token_refresh_lock_releasing`,{}),await a(),E(`tengu_oauth_token_refresh_lock_released`,{})}}function B(){return Aa()?Xn(G()?.scopes):!1}function yo(){return G()?.scopes?.includes(`user:profile`)??!1}function bo(){return!(s(process.env.CLAUDE_CODE_USE_BEDROCK)||s(process.env.CLAUDE_CODE_USE_VERTEX)||s(process.env.CLAUDE_CODE_USE_FOUNDRY)||B())}function xo(){return Aa()?C().oauthAccount:void 0}function So(){let e=xo()?.billingType;return!(!B()||!e||e!==`stripe_subscription`&&e!==`stripe_subscription_contracted`&&e!==`apple_subscription`&&e!==`google_play_subscription`)}function Co(){let e=V();return e===`max`||e===`enterprise`||e===`team`||e===`pro`||e===null}function V(){if(Ln())return In();if(!Aa())return null;let e=G();return e?e.subscriptionType??null:null}function wo(){return V()===`max`}function To(){return V()===`team`}function Eo(){return V()===`team`&&ko()===`default_claude_max_5x`}function Do(){return V()===`enterprise`}function Oo(){return V()===`pro`}function ko(){if(!Aa())return null;let e=G();return e?e.rateLimitTier??null:null}function Ao(){switch(V()){case`enterprise`:return`Claude Enterprise`;case`team`:return`Claude Team`;case`max`:return`Claude Max`;case`pro`:return`Claude Pro`;default:return`Claude API`}}function jo(){return!!(s(process.env.CLAUDE_CODE_USE_BEDROCK)||s(process.env.CLAUDE_CODE_USE_VERTEX)||s(process.env.CLAUDE_CODE_USE_FOUNDRY)||s(process.env.CLAUDE_CODE_USE_OPENAI)||s(process.env.CLAUDE_CODE_USE_GEMINI)||s(process.env.CLAUDE_CODE_USE_GROK))}function Mo(){return(b()||{}).otelHeadersHelper}function No(){let e=Mo();if(!e)return!1;let t=y(`projectSettings`),n=y(`localSettings`);return t?.otelHeadersHelper===e||n?.otelHeadersHelper===e}function Po(){let e=Mo();if(!e)return{};let t=parseInt(process.env.CLAUDE_CODE_OTEL_HEADERS_HELPER_DEBOUNCE_MS||$o.toString(),10);if(Zo&&Date.now()-Qo<t)return Zo;if(No()&&!w())return{};try{let t=Je(e,{timeout:3e4})?.toString().trim();if(!t)throw Error(`otelHeadersHelper did not return a valid value`);let n=De(t);if(typeof n!=`object`||!n||Array.isArray(n))throw Error(`otelHeadersHelper must return a JSON object with string key-value pairs`);for(let[e,t]of Object.entries(n))if(typeof t!=`string`)throw Error(`otelHeadersHelper returned non-string value for key "${e}": ${typeof t}`);return Zo=n,Qo=Date.now(),Zo}catch(e){throw T(Error(`Error getting OpenTelemetry headers from otelHeadersHelper (in settings): ${g(e)}`)),e}}function Fo(e){return e===`max`||e===`pro`}function Io(){let e=V();return B()&&e!==null&&Fo(e)}function Lo(){if(k()!==`firstParty`)return;let{source:e}=ja(),t={};e===`CLAUDE_CODE_OAUTH_TOKEN`||e===`CLAUDE_CODE_OAUTH_TOKEN_FILE_DESCRIPTOR`?t.tokenSource=e:B()?t.subscription=Ao():t.tokenSource=e;let{key:n,source:r}=Na();if(n&&(t.apiKeySource=r),e===`claude.ai`||r===`/login managed key`){let e=xo()?.organizationName;e&&(t.organization=e)}let i=xo()?.emailAddress;return(e===`claude.ai`||r===`/login managed key`)&&i&&(t.email=i),t}async function Ro(){if(process.env.ANTHROPIC_UNIX_SOCKET||!Aa())return{valid:!0};let e=y(`policySettings`)?.forceLoginOrgUUID;if(!e)return{valid:!0};await _o();let t=G();if(!t)return{valid:!0};let{source:n}=ja(),r=n===`CLAUDE_CODE_OAUTH_TOKEN`||n===`CLAUDE_CODE_OAUTH_TOKEN_FILE_DESCRIPTOR`,i=await Jn(t.accessToken);if(!i)return{valid:!1,message:`Unable to verify organization for the current authentication token.\nThis machine requires organization ${e} but the profile could not be fetched.\nThis may be a network error, or the token may lack the user:profile scope required for\nverification (tokens from 'claude setup-token' do not include this scope).\nTry again, or obtain a full-scope token.`};let a=i.organization.uuid;return a===e?{valid:!0}:r?{valid:!1,message:`The ${n===`CLAUDE_CODE_OAUTH_TOKEN`?`CLAUDE_CODE_OAUTH_TOKEN`:`CLAUDE_CODE_OAUTH_TOKEN_FILE_DESCRIPTOR`} environment variable provides a token for a\ndifferent organization than required by this machine's managed settings.\n\nRequired organization: ${e}\nToken organization: ${a}\n\nRemove the environment variable or obtain a token for the correct organization.`}:{valid:!1,message:`Your authentication token belongs to organization ${a},\nbut this machine requires organization ${e}.\n\nAuthentication token belongs to the wrong organization.`}}var zo,H,U,Bo,Vo,Ho,W,Uo,Wo,Go,Ko,qo,G,Jo,Yo,Xo,Zo,Qo,$o,es,K=e((()=>{ne(),qe(),i(),O(),ot(),Tn(),A(),m(),Kn(),cr(),Yn(),vr(),Tr(),Ar(),Mr(),$i(),We(),_(),l(),ze(),Xe(),Ue(),tt(),rt(),fa(),xa(),Sr(),x(),Ca(),Me(),Da(),zo=300*1e3,H=null,U=null,Bo=0,Vo=3600*1e3,Ho=180*1e3,W=nt(async()=>{let e=await qa(),t=await Ya();return(e||t)&&await kr(),t},Vo),Uo=5e3,Wo=3600*1e3,Go=180*1e3,Ko=nt(async()=>await eo(),Wo),qo=r(()=>{if(u())return null;if(process.platform===`darwin`){let e=ga();if(e){if(e.stdout)return{key:e.stdout,source:`/login managed key`}}else{let e=P();try{let t=Je(`security find-generic-password -a $USER -w -s "${e}"`);if(t)return{key:t,source:`/login managed key`}}catch(e){T(e)}}}let e=C();return e.primaryApiKey?{key:e.primaryApiKey,source:`/login managed key`}:null}),G=r(()=>{if(u())return null;if(process.env.CLAUDE_CODE_OAUTH_TOKEN)return{accessToken:process.env.CLAUDE_CODE_OAUTH_TOKEN,refreshToken:null,expiresAt:null,scopes:[`user:inference`],subscriptionType:null,rateLimitTier:null};let e=fr();if(e)return{accessToken:e,refreshToken:null,expiresAt:null,scopes:[`user:inference`],subscriptionType:null,rateLimitTier:null};try{let e=da().read()?.claudeAiOauth;return e?.accessToken?e:null}catch(e){return T(e),null}}),Jo=0,Yo=new Map,Xo=null,Zo=null,Qo=0,$o=1740*1e3,es=class extends Error{}}));function q(){return!s(process.env.CLAUDE_CODE_DISABLE_FAST_MODE)}function ts(){return q()?rs()===null:!1}function ns(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 rs(){if(!q())return`Fast mode is not available`;if(dt(),h()&&Ce()&&!fe()&&!y(`flagSettings`)?.fastMode){let e=`Fast mode is not available in the Agent SDK`;return v(`Fast mode unavailable: ${e}`),e}if(k()!==`firstParty`){let e=`Fast mode is not available on Bedrock, Vertex, or Foundry`;return v(`Fast mode unavailable: ${e}`),e}if(J.status===`disabled`){if((J.reason===`network_error`||J.reason===`unknown`)&&s(process.env.CLAUDE_CODE_SKIP_FAST_MODE_NETWORK_ERRORS))return null;let e=G()===null?`api-key`:`oauth`,t=ns(J.reason,e);return v(`Fast mode unavailable: ${t}`),t}return null}function is(){return`opus`+(Dc()?`[1m]`:``)}function as(e){if(!q()||!ts()||!os(e))return!1;let t=Ve();return!t.fastModePerSessionOptIn&&t.fastMode===!0}function os(e){if(!q())return!1;let t=Q(e??Sc());return t.toLowerCase().includes(`opus-4-7`)||t.toLowerCase().includes(`opus-4-6`)}function ss(){return bs.status===`cooldown`&&Date.now()>=bs.resetAt&&(q()&&!xs&&(v(`Fast mode cooldown expired, re-enabling fast mode`),xs=!0,Cs.emit()),bs={status:`active`}),bs}function cs(e,t){if(!q())return;bs={status:`cooldown`,resetAt:e,reason:t},xs=!1;let n=e-Date.now();v(`Fast mode cooldown triggered (${t}), duration ${Math.round(n/1e3)}s`),E(`tengu_fast_mode_fallback_triggered`,{cooldown_duration_ms:n,cooldown_reason:t}),Ss.emit(e,t)}function ls(){bs={status:`active`}}function us(){J.status!==`disabled`&&(J={status:`disabled`,reason:`preference`},He(`userSettings`,{fastMode:void 0}),S(e=>({...e,penguinModeOrgEnabled:!1})),Os.emit(!1))}function ds(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 fs(e){return e===`org_level_disabled_until`||e===`out_of_credits`}function ps(e){let t=ds(e);v(`Fast mode overage rejection: ${e??`unknown`} — ${t}`),E(`tengu_fast_mode_overage_rejected`,{overage_disabled_reason:e??`unknown`}),fs(e)||(He(`userSettings`,{fastMode:void 0}),S(e=>({...e,penguinModeOrgEnabled:!1}))),Es.emit(t)}function ms(){return ss().status===`cooldown`}function hs(e,t){let n=q()&&ts()&&!!t&&os(e);return n&&ms()?`cooldown`:n?`on`:`off`}async function gs(e){let t=`${D().BASE_API_URL}/api/claude_code_penguin_mode`,n=`accessToken`in e?{Authorization:`Bearer ${e.accessToken}`,"anthropic-beta":lt}:{"x-api-key":e.apiKey};return(await f.get(t,{headers:n})).data}function _s(){if(!q()||J.status!==`pending`)return;let e=process.env.USER_TYPE===`ant`,t=C().penguinModeOrgEnabled===!0;J=e||t?{status:`enabled`}:{status:`disabled`,reason:`unknown`}}async function vs(){if(et()||!q())return;if(Ms)return v(`Fast mode prefetch in progress, returning in-flight promise`),Ms;let e=R();if(!(G()?.accessToken&&yo())&&!e){let e=process.env.USER_TYPE===`ant`,t=C().penguinModeOrgEnabled===!0;J=e||t?{status:`enabled`}:{status:`disabled`,reason:`preference`};return}let t=Date.now();if(t-js<As){v(`Skipping fast mode prefetch, fetched recently`);return}js=t;let n=async()=>{let t=G(),n=t?.accessToken&&yo()?{accessToken:t.accessToken}:e?{apiKey:e}:null;if(!n)throw Error(`No auth available`);return gs(n)};async function r(){try{let e;try{e=await n()}catch(t){if(f.isAxiosError(t)&&(t.response?.status===401||t.response?.status===403&&typeof t.response?.data==`string`&&t.response.data.includes(`OAuth token has been revoked`))){let r=G()?.accessToken;if(r)await mo(r),e=await n();else throw t}else throw t}let t=J.status===`pending`?C().penguinModeOrgEnabled:J.status===`enabled`;J=e.enabled?{status:`enabled`}:{status:`disabled`,reason:e.disabled_reason??`preference`},t!==e.enabled&&(e.enabled||He(`userSettings`,{fastMode:void 0}),S(t=>({...t,penguinModeOrgEnabled:e.enabled})),Os.emit(e.enabled)),v(`Org fast mode: ${e.enabled?`enabled`:`disabled (${e.disabled_reason??`preference`})`}`)}catch(e){let t=process.env.USER_TYPE===`ant`,n=C().penguinModeOrgEnabled===!0;J=t||n?{status:`enabled`}:{status:`disabled`,reason:`network_error`},v(`Failed to fetch org fast mode status, defaulting to ${J.status===`enabled`?`enabled (cached)`:`disabled (network_error)`}: ${e}`,{level:`error`}),E(`tengu_org_penguin_mode_fetch_failed`,{})}finally{Ms=null}}return Ms=r(),Ms}var ys,bs,xs,Ss,Cs,ws,Ts,Es,Ds,J,Os,ks,As,js,Ms,Ns=e((()=>{p(),O(),m(),ot(),K(),ft(),We(),_(),l(),$(),A(),$e(),x(),he(),ys=`Opus 4.7`,bs={status:`active`},xs=!1,Ss=Te(),Cs=Te(),ws=Ss.subscribe,Ts=Cs.subscribe,Es=Te(),Ds=Es.subscribe,J={status:`pending`},Os=Te(),ks=Os.subscribe,As=3e4,js=0,Ms=null}));function Ps(e){return q()&&e?Gs:Ws}function Fs(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 Is(e,t){let n=Z(e);return n===X(dn.firstParty)?Ps(t.speed===`fast`):Ys[n]||(Ls(e,n),Ys[Z(Sc())]??Js)}function Ls(e,t){E(`tengu_unknown_model_cost`,{model:e,shortName:t}),me()}function Rs(e,t){return Fs(Is(e,t),t)}function zs(e,t){return Rs(e,{input_tokens:t.inputTokens,output_tokens:t.outputTokens,cache_read_input_tokens:t.cacheReadInputTokens,cache_creation_input_tokens:t.cacheCreationInputTokens})}function Bs(e){return Number.isInteger(e)?`$${e}`:`$${e.toFixed(2)}`}function Vs(e){return`${Bs(e.inputTokens)}/${Bs(e.outputTokens)} per Mtok`}var Hs,Us,Ws,Gs,Ks,qs,Js,Ys,Xs=e((()=>{ot(),m(),Ns(),gn(),$(),Hs={inputTokens:3,outputTokens:15,promptCacheWriteTokens:3.75,promptCacheReadTokens:.3,webSearchRequests:.01},Us={inputTokens:15,outputTokens:75,promptCacheWriteTokens:18.75,promptCacheReadTokens:1.5,webSearchRequests:.01},Ws={inputTokens:5,outputTokens:25,promptCacheWriteTokens:6.25,promptCacheReadTokens:.5,webSearchRequests:.01},Gs={inputTokens:30,outputTokens:150,promptCacheWriteTokens:37.5,promptCacheReadTokens:3,webSearchRequests:.01},Ks={inputTokens:.8,outputTokens:4,promptCacheWriteTokens:1,promptCacheReadTokens:.08,webSearchRequests:.01},qs={inputTokens:1,outputTokens:5,promptCacheWriteTokens:1.25,promptCacheReadTokens:.1,webSearchRequests:.01},Js=Ws,Ys={[X(rn.firstParty)]:Ks,[X(an.firstParty)]:qs,[X(nn.firstParty)]:Hs,[X(tn.firstParty)]:Hs,[X(on.firstParty)]:Hs,[X(sn.firstParty)]:Hs,[X(pn.firstParty)]:Hs,[X(cn.firstParty)]:Us,[X(ln.firstParty)]:Us,[X(un.firstParty)]:Ws,[X(dn.firstParty)]:Ws}}));function Y(e){return Qs.includes(e)}function Zs(e){return $s.includes(e)}var Qs,$s,ec=e((()=>{Qs=[`sonnet`,`opus`,`haiku`,`best`,`sonnet[1m]`,`opus[1m]`,`opusplan`],$s=[`sonnet`,`opus`,`haiku`]}));function tc(e,t){return e.includes(t)?!0:Y(e)?Q(e).toLowerCase().includes(t):!1}function nc(e,t){return e.startsWith(t)?e.length===t.length||e[t.length]===`-`:!1}function rc(e,t){let n=Y(e)?Q(e).toLowerCase():e;return!!(nc(n,t)||!t.startsWith(`claude-`)&&nc(n,`claude-${t}`))}function ic(e,t){for(let n of t){if(Zs(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 ac(e){let{availableModels:t}=b()||{};if(!t)return!0;if(t.length===0)return!1;let n=bn(e).trim().toLowerCase(),r=t.map(e=>e.trim().toLowerCase());if(r.includes(n)&&(!Zs(n)||!ic(n,r)))return!0;for(let e of r)if(Zs(e)&&!ic(e,r)&&tc(n,e))return!0;if(Y(n)){let e=Q(n).toLowerCase();if(r.includes(e))return!0}for(let e of r)if(!Zs(e)&&Y(e)&&Q(e).toLowerCase()===n)return!0;for(let e of r)if(!Zs(e)&&!Y(e)&&rc(n,e))return!0;return!1}var oc=e((()=>{x(),ec(),$(),Tn()}));function sc(){return process.env.OPENAI_AUTH_MODE===`chatgpt`}var cc,lc,uc,dc=e((()=>{cc=`gpt-5.5`,lc=`gpt-5.4-mini`,uc=[{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 fc(){let e=k();return e===`openai`&&sc()?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||bc()}function pc(e){return e===j().opus40||e===j().opus41||e===j().opus45||e===j().opus46||e===j().opus47}function mc(){let e,t=ge();if(t!==void 0)e=t;else{let t=b()||{};e=process.env.ANTHROPIC_MODEL||t.model||void 0}if(!(e&&!ac(e)))return e}function hc(){let e=mc();return e==null?Cc():Q(e)}function gc(){return vc()}function _c(){let e=k();if(e===`openai`)return process.env.OPENAI_MODEL;if(e===`gemini`)return process.env.GEMINI_MODEL;if(e===`grok`)return process.env.GROK_MODEL}function vc(){let e=k();return e===`openai`&&sc()?cc: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:_c()||j().opus47}function yc(){let e=k();return e===`openai`&&sc()?cc: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:_c()||(e===`firstParty`?j().sonnet46:j().sonnet45)}function bc(){let e=k();return e===`openai`&&sc()?lc: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:_c()||j().haiku45}function xc(e){let{permissionMode:t,mainLoopModel:n,exceeds200kTokens:r=!1}=e;return mc()===`opusplan`&&t===`plan`&&!r?vc():mc()===`haiku`&&t===`plan`?yc():n}function Sc(){return process.env.USER_TYPE===`ant`?Rt()?.defaultModel??vc()+`[1m]`:wo()||Eo()?vc()+(Dc()?`[1m]`:``):yc()}function Cc(){return Q(Sc())}function X(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 Z(e){return X(bn(e))}function wc(e=!1){return wo()||Eo()?Dc()?`Opus 4.7 with 1M context · Most capable for complex work${e?Ec(!0):``}`:`Opus 4.7 · Most capable for complex work${e?Ec(!0):``}`:`Sonnet 4.6 · Best for everyday tasks`}function Tc(e){return e===`opusplan`?`Opus 4.7 in plan mode, else Sonnet 4.6`:jc(Q(e))}function Ec(e){if(k()!==`firstParty`)return``;let t=Vs(Ps(e));return` ·${e?` (↯)`:``} ${t}`}function Dc(){return!(Si()||Oo()||k()!==`firstParty`||!Nt()||B()&&V()===null)}function Oc(e){return e===`opusplan`?`Opus Plan`:Y(e)?pt(e):jc(e)}function kc(e){switch(e){case j().opus47:return`Opus 4.7`;case j().opus47+`[1m]`:return`Opus 4.7 (1M context)`;case j().opus46:return`Opus 4.6`;case j().opus46+`[1m]`:return`Opus 4.6 (1M context)`;case j().opus45:return`Opus 4.5`;case j().opus41:return`Opus 4.1`;case j().opus40:return`Opus 4`;case j().sonnet46+`[1m]`:return`Sonnet 4.6 (1M context)`;case j().sonnet46:return`Sonnet 4.6`;case j().sonnet45+`[1m]`:return`Sonnet 4.5 (1M context)`;case j().sonnet45:return`Sonnet 4.5`;case j().sonnet40:return`Sonnet 4`;case j().sonnet40+`[1m]`:return`Sonnet 4 (1M context)`;case j().sonnet37:return`Sonnet 3.7`;case j().sonnet35:return`Sonnet 3.5`;case j().haiku45:return`Haiku 4.5`;case j().haiku35:return`Haiku 3.5`;default:return null}}function Ac(e){let[t=``,...n]=e.split(`-`);return[t.slice(0,3)+`*`.repeat(Math.max(0,t.length-3)),...n].join(`-`)}function jc(e){let t=kc(e);if(t)return t;if(process.env.USER_TYPE===`ant`){let t=Q(e),n=Bt(e);return n?Ac(n.model.replace(/\[1m\]$/i,``))+(L(t)?`[1m]`:``):t===e?t:`${e} (${t})`}return e}function Q(e){let t=e.trim(),n=t.toLowerCase(),r=L(n),i=r?n.replace(/\[1m]$/i,``).trim():n;if(Y(i))switch(i){case`opusplan`:return yc()+(r?`[1m]`:``);case`sonnet`:return yc()+(r?`[1m]`:``);case`haiku`:return bc()+(r?`[1m]`:``);case`opus`:return vc()+(r?`[1m]`:``);case`best`:return gc();default:}if(k()===`firstParty`&&Nc(i)&&Pc())return vc()+(r?`[1m]`:``);if(process.env.USER_TYPE===`ant`){let e=L(n),t=Bt(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 Mc(e,t){return L(e)||!L(t)?e:Ci(Q(e))?e+`[1m]`:e}function Nc(e){return Rc.includes(e)}function Pc(){return!s(process.env.CLAUDE_CODE_DISABLE_LEGACY_MODEL_REMAP)}function Fc(e){if(e===null)return process.env.USER_TYPE===`ant`?`Default for Ants (${Tc(Sc())})`:B()?`Default (${wc()})`:`Default (${Cc()})`;let t=Q(e);return e===t?t:`${e} (${t})`}function Ic(e){if(k()===`foundry`)return;let t=e.toLowerCase().includes(`[1m]`),n=Z(e);if(n.includes(`claude-opus-4-7`))return t?`Opus 4.7 (with 1M context)`:`Opus 4.7`;if(n.includes(`claude-opus-4-6`))return t?`Opus 4.6 (with 1M context)`:`Opus 4.6`;if(n.includes(`claude-opus-4-5`))return`Opus 4.5`;if(n.includes(`claude-opus-4-1`))return`Opus 4.1`;if(n.includes(`claude-opus-4`))return`Opus 4`;if(n.includes(`claude-sonnet-4-6`))return t?`Sonnet 4.6 (with 1M context)`:`Sonnet 4.6`;if(n.includes(`claude-sonnet-4-5`))return t?`Sonnet 4.5 (with 1M context)`:`Sonnet 4.5`;if(n.includes(`claude-sonnet-4`))return t?`Sonnet 4 (with 1M context)`:`Sonnet 4`;if(n.includes(`claude-3-7-sonnet`))return`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 Lc(e){return e.replace(/\[(1|2)m\]/gi,``)}var Rc,$=e((()=>{m(),Vt(),K(),Pi(),l(),Tn(),Xs(),x(),A(),Be(),oc(),ec(),mt(),dc(),Rc=[`claude-opus-4-20250514`,`claude-opus-4-1-20250805`,`claude-opus-4-0`,`claude-opus-4-1`]}));export{us as $,ni as $n,Rn as $r,Oo as $t,dc as A,Zi as An,lr as Ar,z as At,zs as B,Ei as Bn,Zn as Br,K as Bt,Q as C,Mt as Ci,fa as Cn,Er as Cr,Va as Ct,Mc as D,Bi as Dn,Sr as Dr,ja as Dt,Oc as E,Ji as En,F as Er,Ba as Et,ec as F,Ki as Fn,tr as Fr,V as Ft,ys as G,L as Gn,qn as Gr,B as Gt,Vs as H,Oi as Hn,er as Hr,Aa as Ht,Ks as I,Li as In,ir as Ir,mo as It,ss as J,xi as Jn,Pn as Jr,Do as Jt,ls as K,Pi as Kn,Jn as Kr,Io as Kt,qs as L,Ri as Ln,ar as Lr,Ma as Lt,oc as M,Wi as Mn,Qn as Mr,Po as Mt,ac as N,Ui as Nn,nr as Nr,ko as Nt,cc as O,Qi as On,_r as Or,G as Ot,Qs as P,Gi as Pn,$n as Pr,Ao as Pt,ps as Q,di as Qn,Kn as Qr,So as Qt,Hs as R,Ni as Rn,cr as Rr,Co as Rt,Lc as S,k as Si,da as Sn,Ar as Sr,Na as St,jc as T,Nt as Ti,ra as Tn,wr as Tr,qo as Tt,Ps as U,Di as Un,Xn as Ur,Ia as Ut,Rs as V,wi as Vn,or as Vr,bo as Vt,Xs as W,Ti as Wn,sr as Wr,Ra as Wt,rs as X,ui as Xn,jn as Xr,wo as Xt,hs as Y,_i as Yn,zn as Yr,Qa as Yt,as as Z,oi as Zn,Mn as Zr,No as Zt,$ as _,Vt as _i,Ca as _n,zr as _r,Xa as _t,bc as a,j as ai,ro as an,Zr as ar,Ts as at,Dc as b,Lt as bi,xa as bn,jr as br,Lo as bt,vc as c,Kt as ci,to as cn,Yr as cr,ks as ct,Ic as d,en as di,oo as dn,Fr as dr,cs as dt,Fn as ei,Eo as en,ei as er,Ns as et,Ec as f,qt as fi,uo as fn,Ir as fr,Oa as ft,mc as g,zt as gi,Da as gn,Lr as gr,Ga as gt,fc as h,Rt as hi,wa as hn,Hr as hr,$a as ht,wc as i,Sn as ii,io as in,ri as ir,os as it,sc as j,$i as jn,ur as jr,xo as jt,uc as k,qi as kn,vr as kr,go as kt,yc as l,Yt as li,Ko as ln,Gr as lr,vs as lt,xc as m,Ht as mi,Ta as mn,Br as mr,_o as mt,gc as n,En as ni,jo as nn,ti as nr,ms as nt,Cc as o,Tn as oi,W as on,Qr as or,ws as ot,kc as p,Ut as pi,Ro as pn,Vr as pr,za as pt,is as q,Si as qn,Yn as qr,so as qt,Z as r,An as ri,Ka as rn,ii as rr,q as rt,Sc as s,Xt as si,Ja as sn,Xr as sr,Ds as st,X as t,On as ti,To as tn,$r as tr,ts as tt,hc as u,Qt as ui,co as un,Ur as ur,_s as ut,Pc as v,Bt as vi,Sa as vn,qr as vr,no as vt,Tc as w,A as wi,sa as wn,Tr as wr,Wa as wt,Fc as x,Ft as xi,ma as xn,Mr as xr,R as xt,pc as y,Pt as yi,ha as yn,Jr as yr,fo as yt,Ys as z,Ai as zn,rr as zr,yo as zt};
@@ -1 +0,0 @@
1
- import{_ as e,u as t}from"./model-CKkOnnnx.js";e();export{t as getMainLoopModel};
@@ -1 +0,0 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{l as t,o as n}from"./envUtils-DSxRz_kt.js";import{n as r,t as i}from"./axios-DaWTGg7G.js";import{E as a,F as o,I as s,S as c,V as l,W as u,a as d,d as f,l as p,nt as m,p as ee,rt as te,w as h,z as g}from"./debug-BrXObCdR.js";import{Jt as ne,Zt as re}from"./settings-BovzmwMP.js";import{C as ie,S as ae,b as oe,c as se,g as ce,w as _}from"./config-DmomySWC.js";import{n as v,r as y}from"./execFileNoThrow-D244NytW.js";import{o as b,s as x}from"./log-BMCygSzM.js";import{n as S,r as C}from"./analytics-BotDBGh0.js";import{_n as le,vn as ue}from"./model-CKkOnnnx.js";import{ft as de,ut as fe}from"./esm-D5q6s4l8.js";import{n as pe,r as me,t as he}from"./semver-BMRJYn3q.js";import{C as ge,S as _e,_ as ve,a as w,b as ye,c as be,d as xe,g as Se,h as Ce,i as we,l as Te,n as Ee,o as T,p as De,s as Oe,t as ke,v as E,x as Ae,y as je}from"./pidLock-D5rUnDB-.js";import{a as Me,i as Ne,n as Pe,r as Fe,t as Ie}from"./xdg-DcF9ejUM.js";import{homedir as D}from"os";import{basename as Le,delimiter as Re,dirname as O,join as k,resolve as A}from"path";import{constants as ze}from"fs";import{createHash as Be}from"crypto";import{access as j,chmod as M,copyFile as N,mkdir as P,readdir as F,readlink as I,rename as L,rm as R,rmdir as Ve,stat as z,symlink as He,unlink as B,writeFile as V}from"fs/promises";async function Ue(e=`latest`){let t=Date.now(),{stdout:n,code:r,stderr:i}=await v(`npm`,[`view`,`@${e}`,`version`,`--prefer-online`,`--registry`,U],{timeout:3e4,preserveOutputOnError:!0}),a=Date.now()-t;if(r!==0){C(`tengu_version_check_failure`,{latency_ms:a,source_npm:!0,exit_code:r});let e=Error(`npm view failed with code ${r}: ${i}`);throw x(e),e}return C(`tengu_version_check_success`,{latency_ms:a,source_npm:!0}),p(`npm view @${e} version: ${n}`),n.trim()}async function We(e=`latest`,t,n){let i=Date.now();try{let a=await r.get(`${t}/${e}`,{timeout:3e4,responseType:`text`,...n});return C(`tengu_version_check_success`,{latency_ms:Date.now()-i}),a.data.trim()}catch(n){let a=Date.now()-i,o=n instanceof Error?n.message:String(n),s;r.isAxiosError(n)&&n.response&&(s=n.response.status),C(`tengu_version_check_failure`,{latency_ms:a,http_status:s,is_timeout:o.includes(`timeout`)});let c=Error(`Failed to fetch version from ${t}/${e}: ${o}`);throw x(c),c}}async function Ge(e){if(/^v?\d+\.\d+\.\d+(-\S+)?$/.test(e)){let t=e.startsWith(`v`)?e.slice(1):e;if(/^99\.99\./.test(t))throw Error(`Version ${t} is not available for installation. Use 'stable' or 'latest'.`);return t}let t=e;if(t!==`stable`&&t!==`latest`)throw Error(`Invalid channel: ${e}. Use 'stable' or 'latest'`);return process.env.USER_TYPE===`ant`?Ue(t===`stable`?`stable`:`latest`):We(t,H)}async function Ke(e,t){let n=f();await n.rm(t,{recursive:!0,force:!0});let r=W(),i=`-${r}`;p(`Fetching integrity hash for ${i}@${e}`);let{stdout:o,code:s,stderr:c}=await v(`npm`,[`view`,`${i}@${e}`,`dist.integrity`,`--registry`,U],{timeout:3e4,preserveOutputOnError:!0});if(s!==0)throw Error(`npm view integrity failed with code ${s}: ${c}`);let l=o.trim();if(!l)throw Error(`Failed to fetch integrity hash for ${i}@${e}`);p(`Got integrity hash for ${r}: ${l}`),await n.mkdir(t);let u={name:`claude-native-installer`,version:`0.0.1`,dependencies:{"":e}},d={name:`claude-native-installer`,version:`0.0.1`,lockfileVersion:3,requires:!0,packages:{"":{name:`claude-native-installer`,version:`0.0.1`,dependencies:{"":e}},"node_modules/":{version:e,optionalDependencies:{[i]:e}},[`node_modules/${i}`]:{version:e,integrity:l}}};a(k(t,`package.json`),h(u,null,2),{encoding:`utf8`,flush:!0}),a(k(t,`package-lock.json`),h(d,null,2),{encoding:`utf8`,flush:!0});let m=await v(`npm`,[`ci`,`--prefer-online`,`--registry`,U],{timeout:6e4,preserveOutputOnError:!0,cwd:t});if(m.code!==0)throw Error(`npm ci failed with code ${m.code}: ${m.stderr}`);p(`Successfully downloaded and verified @${e}`)}function qe(){return Number(process.env.CLAUDE_CODE_STALL_TIMEOUT_MS_FOR_TESTING)||Ze}async function Je(e,t,n,i={}){let a;for(let o=1;o<=3;o++){let s=new AbortController,c,l=()=>{c&&(clearTimeout(c),c=void 0)},d=()=>{l(),c=setTimeout(e=>e.abort(),qe(),s)};try{d();let a=await r.get(e,{timeout:5*6e4,responseType:`arraybuffer`,signal:s.signal,onDownloadProgress:()=>{d()},...i});l();let o=Be(`sha256`);o.update(a.data);let c=o.digest(`hex`);if(c!==t)throw Error(`Checksum mismatch: expected ${t}, got ${c}`);await V(n,Buffer.from(a.data)),await M(n,493);return}catch(e){l();let t=r.isCancel(e);if(a=t?new Qe:u(e),t&&o<3){p(`Download stalled on attempt ${o}/3, retrying...`),await ue(1e3);continue}throw a}}throw a??Error(`Download failed after all retries`)}async function Ye(e,t,n,i){let a=f();await a.rm(t,{recursive:!0,force:!0});let o=W(),s=Date.now();C(`tengu_binary_download_attempt`,{});let c;try{c=(await r.get(`${n}/${e}/manifest.json`,{timeout:1e4,responseType:`json`,...i})).data}catch(t){let i=Date.now()-s,a=t instanceof Error?t.message:String(t),o;throw r.isAxiosError(t)&&t.response&&(o=t.response.status),C(`tengu_binary_manifest_fetch_failure`,{latency_ms:i,http_status:o,is_timeout:a.includes(`timeout`)}),x(Error(`Failed to fetch manifest from ${n}/${e}/manifest.json: ${a}`)),t}let l=c.platforms[o];if(!l)throw C(`tengu_binary_platform_not_found`,{}),Error(`Platform ${o} not found in manifest for version ${e}`);let u=l.checksum,d=G(o),p=`${n}/${e}/${o}/${d}`;await a.mkdir(t);let m=k(t,d);try{await Je(p,u,m,i||{}),C(`tengu_binary_download_success`,{latency_ms:Date.now()-s})}catch(e){let t=Date.now()-s,n=e instanceof Error?e.message:String(e),i;throw r.isAxiosError(e)&&e.response&&(i=e.response.status),C(`tengu_binary_download_failure`,{latency_ms:t,http_status:i,is_timeout:n.includes(`timeout`),is_checksum_mismatch:n.includes(`Checksum mismatch`)}),x(Error(`Failed to download binary from ${p}: ${n}`)),e}}async function Xe(e,t){return process.env.USER_TYPE===`ant`?(await Ke(e,t),`npm`):(await Ye(e,t,H),`binary`)}var H,U,Ze,Qe,$e=e((()=>{i(),S(),d(),g(),y(),ee(),b(),le(),c(),$(),H=`https://storage.googleapis.com/claude-code-dist-86c565f3-f756-42ad-8dfa-d59b1c096819/claude-code-releases`,U=`https://artifactory.infra.ant.dev/artifactory/api/npm/npm-all/`,Ze=6e4,Qe=class extends Error{constructor(){super(`Download stalled: no data received for 60 seconds`),this.name=`StallTimeoutError`}}}));function W(){let e=ne.platform,t=process.arch===`x64`?`x64`:process.arch===`arm64`?`arm64`:null;if(!t){let e=Error(`Unsupported architecture: ${process.arch}`);throw p(`Native installer does not support architecture: ${process.arch}`,{level:`error`}),e}return e===`linux`&&fe.isMuslEnvironment()?`linux-${t}-musl`:`${e}-${t}`}function G(e){return e.startsWith(`win32`)?`claude.exe`:`claude`}function K(){let e=G(W());return{versions:k(Fe(),`claude`,`versions`),staging:k(Pe(),`claude`,`staging`),locks:k(Ne(),`claude`,`locks`),executable:k(Ie(),e)}}async function q(e){try{let t=await z(e);return!t.isFile()||t.size===0?!1:(await j(e,ze.X_OK),!0)}catch{return!1}}async function J(e){let t=K(),n=[t.versions,t.staging,t.locks];await Promise.all(n.map(e=>P(e,{recursive:!0}))),await P(O(t.executable),{recursive:!0});let r=k(t.versions,e);try{await z(r)}catch{await V(r,``,{encoding:`utf8`})}return{stagingPath:k(t.staging,e),installPath:r}}async function et(e,t,n=0){let r=K(),i=Y(r,e);if(await P(r.locks,{recursive:!0}),T()){let r=0,a=n+1,o=n>0?1e3:100,s=n>0?5e3:500;for(;r<a;){if(await be(e,i,async()=>{try{await t()}catch(e){throw x(e),e}}))return C(`tengu_version_lock_acquired`,{is_pid_based:!0,is_lifetime_lock:!1,attempts:r+1}),!0;r++,r<a&&await ue(Math.min(o*2**(r-1),s))}return C(`tengu_version_lock_failed`,{is_pid_based:!0,is_lifetime_lock:!1,attempts:a}),X(e,Error(`Lock held by another process`)),!1}let a=null;try{try{a=await _(e,{stale:Z,retries:{retries:n,minTimeout:n>0?1e3:100,maxTimeout:n>0?5e3:500},lockfilePath:i,onCompromised:e=>{p(`NON-FATAL: Version lock was compromised during operation: ${e.message}`,{level:`info`})}})}catch(t){return C(`tengu_version_lock_failed`,{is_pid_based:!1,is_lifetime_lock:!1}),X(e,t),!1}try{return await t(),C(`tengu_version_lock_acquired`,{is_pid_based:!1,is_lifetime_lock:!1}),!0}catch(e){throw x(e),e}}finally{a&&await a()}}async function tt(e,t){await P(O(t),{recursive:!0});let n=`${t}.tmp.${process.pid}.${Date.now()}`;try{await N(e,n),await M(n,493),await L(n,t),p(`Atomically installed binary to ${t}`)}catch(e){try{await B(n)}catch{}throw e}}async function nt(e,t){try{let n=k(e,`node_modules`,`@anthropic-ai`),r=(await F(n)).find(e=>e.startsWith(`claude-cli-native-`));if(!r)throw C(`tengu_native_install_package_failure`,{stage_find_package:!0,error_package_not_found:!0}),Error(`Could not find platform-specific native package`);let i=k(n,r,`cli`);try{await z(i)}catch{throw C(`tengu_native_install_package_failure`,{stage_binary_exists:!0,error_binary_not_found:!0}),Error(`Native binary not found in staged package`)}await tt(i,t),await R(e,{recursive:!0,force:!0}),C(`tengu_native_install_package_success`,{})}catch(e){let t=o(e);throw!t.includes(`Could not find platform-specific`)&&!t.includes(`Native binary not found`)&&C(`tengu_native_install_package_failure`,{stage_atomic_move:!0,error_move_failed:!0}),x(u(e)),e}}async function rt(e,t){try{let n=k(e,G(W()));try{await z(n)}catch{throw C(`tengu_native_install_binary_failure`,{stage_binary_exists:!0,error_binary_not_found:!0}),Error(`Staged binary not found`)}await tt(n,t),await R(e,{recursive:!0,force:!0}),C(`tengu_native_install_binary_success`,{})}catch(e){throw o(e).includes(`Staged binary not found`)||C(`tengu_native_install_binary_failure`,{stage_atomic_move:!0,error_move_failed:!0}),x(u(e)),e}}async function it(e,t,n){n===`npm`?await nt(e,t):await rt(e,t)}async function at(e,n){let{stagingPath:r,installPath:i}=await J(e),{executable:a}=K(),o=t(process.env.ENABLE_LOCKLESS_UPDATES)?`${r}.${process.pid}.${Date.now()}`:r,s=!await ot(e)||n;if(s?(p(n?`Force reinstalling native installer version ${e}`:`Downloading native installer version ${e}`),await it(o,i,await Xe(e,o))):p(`Version ${e} already installed, updating symlink`),await ct(a),await lt(a,i),!await q(a)){let e=!1;try{await z(i),e=!0}catch{}throw Error(`Failed to create executable at ${a}. Source file exists: ${e}. Check write permissions to ${a}.`)}return s}async function ot(e){let{installPath:t}=await J(e);return q(t)}async function st(e,n=!1){let r=Date.now(),i=await Ge(e),{executable:a}=K();if(p(`Checking for native installer update to version ${i}`),!n){let e=await De();if(e&&he(i,e)){if(p(`Native installer: maxVersion ${e} is set, capping update from ${i} to ${e}`),pe(`0.0.6`,e))return p(`Native installer: current version 0.0.6 is already at or above maxVersion ${e}, skipping update`),C(`tengu_native_update_skipped_max_version`,{latency_ms:Date.now()-r,max_version:e,available_version:i}),{success:!0,latestVersion:i};i=e}}if(!n&&i===`0.0.6`&&await ot(i)&&await q(a))return p(`Found ${i} at ${a}, skipping install`),C(`tengu_native_update_complete`,{latency_ms:Date.now()-r,was_new_install:!1,was_force_reinstall:!1,was_already_running:!0}),{success:!0,latestVersion:i};if(!n&&Se(i))return C(`tengu_native_update_skipped_minimum_version`,{latency_ms:Date.now()-r,target_version:i}),{success:!0,latestVersion:i};let o=!1,s;if(t(process.env.ENABLE_LOCKLESS_UPDATES))o=await at(i,n),s=Date.now()-r;else{let{installPath:e}=await J(i);n&&await ht(e);let t=await et(e,async()=>{o=await at(i,n)},3);if(s=Date.now()-r,!t){let t=K(),n;if(T()){let r=Y(t,e);w(r)&&(n=Oe(r)?.pid)}return C(`tengu_native_update_lock_failed`,{latency_ms:s,lock_holder_pid:n}),{success:!1,latestVersion:i,lockFailed:!0,lockHolderPid:n}}}return C(`tengu_native_update_complete`,{latency_ms:s,was_new_install:o,was_force_reinstall:n}),p(`Successfully updated to version ${i}`),{success:!0,latestVersion:i}}async function ct(e){try{await Ve(e),p(`Removed empty directory at ${e}`)}catch(t){let n=s(t);n!==`ENOTDIR`&&n!==`ENOENT`&&n!==`ENOTEMPTY`&&p(`Could not remove directory at ${e}: ${t}`)}}async function lt(e,t){if(W().startsWith(`win32`))try{await P(O(e),{recursive:!0});let n;try{n=await z(e)}catch{}if(n){try{let e=await z(t);if(n.size===e.size)return!1}catch{}let r=`${e}.old.${Date.now()}`;await L(e,r);try{await N(t,e);try{await B(r)}catch{}}catch(t){try{await L(r,e)}catch(e){let n=Error(`Failed to restore old executable: ${e}`,{cause:t});throw x(n),n}throw t}}else try{await N(t,e)}catch(e){throw l(e)?Error(`Source file does not exist: ${t}`):e}return!0}catch(n){return x(Error(`Failed to copy executable from ${t} to ${e}: ${n}`)),!1}let n=O(e);try{await P(n,{recursive:!0}),p(`Created directory ${n} for symlink`)}catch(e){return x(Error(`Failed to create directory ${n}: ${e}`)),!1}try{let n=!1;try{await z(e),n=!0}catch{}if(n){try{let n=await I(e);if(A(O(e),n)===A(t))return!1}catch{}await B(e)}}catch(e){x(Error(`Failed to check/remove existing symlink: ${e}`))}let r=`${e}.tmp.${process.pid}.${Date.now()}`;try{return await He(t,r),await L(r,e),p(`Atomically updated symlink ${e} -> ${t}`),!0}catch(n){try{await B(r)}catch{}return x(Error(`Failed to create symlink from ${e} to ${t}: ${n}`)),!1}}async function ut(e=!1){if(t(process.env.DISABLE_INSTALLATION_CHECKS))return[];let n=await Te();if(n===`development`||!(e||n===`native`))return[];let r=K(),i=[],a=O(r.executable),o=A(a),s=W().startsWith(`win32`);try{await j(a)}catch{i.push({message:`installMethod is native, but directory ${a} does not exist`,userActionRequired:!0,type:`error`})}if(s)await q(r.executable)||i.push({message:`installMethod is native, but claude command is missing or invalid at ${r.executable}`,userActionRequired:!0,type:`error`});else try{let e=await I(r.executable);await q(A(O(r.executable),e))||i.push({message:`Claude symlink points to missing or invalid binary: ${e}`,userActionRequired:!0,type:`error`})}catch(e){l(e)?i.push({message:`installMethod is native, but claude command not found at ${r.executable}`,userActionRequired:!0,type:`error`}):await q(r.executable)||i.push({message:`${r.executable} exists but is not a valid Claude binary`,userActionRequired:!0,type:`error`})}if(!(process.env.PATH||``).split(Re).some(e=>{try{let t=A(e);return s?t.toLowerCase()===o.toLowerCase():t===o}catch{return!1}}))if(s){let e=a.replace(/\//g,`\\`);i.push({message:`Native installation exists but ${e} is not in your PATH. Add it by opening: System Properties → Environment Variables → Edit User PATH → New → Add the path above. Then restart your terminal.`,userActionRequired:!0,type:`path`})}else{let e=_e(),t=E()[e],n=t?t.replace(D(),`~`):`your shell config file`;i.push({message:`Native installation exists but ~/.local/bin is not in your PATH. Run:\n\necho 'export PATH="$HOME/.local/bin:$PATH"' >> ${n} && source ${n}`,userActionRequired:!0,type:`path`})}return i}function dt(e,t=!1){if(t)return ft(e,t);if(Q)return p(`installLatest: joining in-flight call`),Q;let n=ft(e,t);Q=n;let r=()=>{Q=null};return n.then(r,r),n}async function ft(e,t=!1){let n=await st(e,t);return n.success?(se().installMethod!==`native`&&(oe(e=>({...e,installMethod:`native`,autoUpdates:!1,autoUpdatesProtectedForNative:!0})),p(`Native installer: Set installMethod to "native" and disabled legacy auto-updater for protection`)),gt(),{latestVersion:n.latestVersion,wasUpdated:n.success,lockFailed:!1}):{latestVersion:null,wasUpdated:!1,lockFailed:n.lockFailed,lockHolderPid:n.lockHolderPid}}async function pt(e){try{let t=await I(e),n=A(O(e),t);if(await q(n))return n}catch{}return null}function Y(e,t){let n=Le(t);return k(e.locks,`${n}.lock`)}async function mt(){let e=K();if(!process.execPath.includes(e.versions))return;let t=A(process.execPath);try{let n=Y(e,t);if(await P(e.locks,{recursive:!0}),T()){if(!await ke(t,n)){C(`tengu_version_lock_failed`,{is_pid_based:!0,is_lifetime_lock:!0}),X(t,Error(`Lock already held by another process`));return}C(`tengu_version_lock_acquired`,{is_pid_based:!0,is_lifetime_lock:!0}),p(`Acquired PID lock on running version: ${t}`)}else{let e;try{e=await _(t,{stale:Z,retries:0,lockfilePath:n,onCompromised:e=>{p(`NON-FATAL: Lock on running version was compromised: ${e.message}`,{level:`info`})}}),C(`tengu_version_lock_acquired`,{is_pid_based:!1,is_lifetime_lock:!0}),p(`Acquired mtime-based lock on running version: ${t}`),te(async()=>{try{await e?.()}catch{}})}catch(e){if(l(e)){p(`Cannot lock current version - file does not exist: ${t}`,{level:`info`});return}C(`tengu_version_lock_failed`,{is_pid_based:!1,is_lifetime_lock:!0}),X(t,e);return}}}catch(e){if(l(e)){p(`Cannot lock current version - file does not exist: ${t}`,{level:`info`});return}p(`NON-FATAL: Failed to lock current version during execution ${o(e)}`,{level:`info`})}}function X(e,t){x(Error(`NON-FATAL: Lock acquisition failed for ${e} (expected in multi-process scenarios)`,{cause:t}))}async function ht(e){let t=Y(K(),e);try{await B(t),p(`Force-removed lock file at ${t}`)}catch(e){p(`Failed to force-remove lock file: ${o(e)}`)}}async function gt(){await Promise.resolve();let e=K(),t=Date.now()-36e5;if(W().startsWith(`win32`)){let t=O(e.executable);try{let e=await F(t),n=0;for(let r of e)if(/^claude\.exe\.old\.\d+$/.test(r))try{await B(k(t,r)),n++}catch{}n>0&&p(`Cleaned up ${n} old Windows executables on startup`)}catch(e){l(e)||p(`Failed to clean up old Windows executables: ${e}`)}}try{let n=await F(e.staging),r=0;for(let i of n){let n=k(e.staging,i);try{(await z(n)).mtime.getTime()<t&&(await R(n,{recursive:!0,force:!0}),r++,p(`Cleaned up old staging directory: ${i}`))}catch{}}r>0&&(p(`Cleaned up ${r} orphaned staging directories`),C(`tengu_native_staging_cleanup`,{cleaned_count:r}))}catch(e){l(e)||p(`Failed to clean up staging directories: ${e}`)}if(T()){let t=Ee(e.locks);t>0&&(p(`Cleaned up ${t} stale version locks`),C(`tengu_native_stale_locks_cleanup`,{cleaned_count:t}))}let n;try{n=await F(e.versions)}catch(e){l(e)||p(`Failed to readdir versions directory: ${e}`);return}let r=[],i=0;for(let a of n){let n=k(e.versions,a);if(/\.tmp\.\d+\.\d+$/.test(a)){try{(await z(n)).mtime.getTime()<t&&(await B(n),i++,p(`Cleaned up orphaned temp install file: ${a}`))}catch{}continue}try{let e=await z(n);if(!e.isFile()||process.platform!==`win32`&&e.size>0&&!(e.mode&73))continue;r.push({name:a,path:n,resolvedPath:A(n),mtime:e.mtime})}catch{}}if(i>0&&(p(`Cleaned up ${i} orphaned temp install files`),C(`tengu_native_temp_files_cleanup`,{cleaned_count:i})),r.length!==0)try{let t=process.execPath,n=new Set;t&&t.includes(e.versions)&&n.add(A(t));let i=await pt(e.executable);i&&n.add(i);for(let t of r){if(n.has(t.resolvedPath))continue;let r=Y(e,t.resolvedPath),i=!1;if(T())i=w(r);else try{i=await ae(t.resolvedPath,{stale:Z,lockfilePath:r})}catch{i=!1}i&&(n.add(t.resolvedPath),p(`Protecting locked version from cleanup: ${t.name}`))}let a=r.filter(e=>!n.has(e.resolvedPath)).sort((e,t)=>t.mtime.getTime()-e.mtime.getTime()).slice(2);if(a.length===0){C(`tengu_native_version_cleanup`,{total_count:r.length,deleted_count:0,protected_count:n.size,retained_count:2,lock_failed_count:0,error_count:0});return}let o=0,s=0,c=0;await Promise.all(a.map(async e=>{try{await et(e.path,async()=>{await B(e.path)})?o++:(s++,p(`Skipping deletion of ${e.name} - locked by another process`))}catch(t){c++,x(Error(`Failed to delete version ${e.name}: ${t}`))}})),C(`tengu_native_version_cleanup`,{total_count:r.length,deleted_count:o,protected_count:n.size,retained_count:2,lock_failed_count:s,error_count:c})}catch(e){l(e)||x(Error(`Version cleanup failed: ${e}`))}}async function _t(){let e=[],t=E();for(let[n,r]of Object.entries(t))try{let t=await ye(r);if(!t)continue;let{filtered:i,hadAlias:a}=ve(t);a&&(await Ae(r,i),e.push({message:`Removed claude alias from ${r}. Run: unalias claude`,userActionRequired:!0,type:`alias`}),p(`Cleaned up claude alias from ${n} config`))}catch(t){x(t),e.push({message:`Failed to clean up ${r}: ${t}`,userActionRequired:!1,type:`error`})}return e}async function vt(e){try{let t=await v(`npm`,[`config`,`get`,`prefix`]);if(t.code!==0||!t.stdout)return{success:!1,error:`Failed to get npm global prefix`};let n=t.stdout.trim(),r=!1;async function i(e,t){try{return await B(e),p(`Manually removed ${t}: ${e}`),!0}catch{return!1}}if(W().startsWith(`win32`)){let e=k(n,`claude.cmd`),t=k(n,`claude.ps1`),a=k(n,`claude`);await i(e,`bin script`)&&(r=!0),await i(t,`PowerShell script`)&&(r=!0),await i(a,`bin executable`)&&(r=!0)}else await i(k(n,`bin`,`claude`),`bin symlink`)&&(r=!0);return r?(p(`Successfully removed ${e} manually`),{success:!0,warning:`${e} executables removed, but node_modules directory was left intact for safety. You may manually delete it later at: ${W().startsWith(`win32`)?k(n,`node_modules`,e):k(n,`lib`,`node_modules`,e)}`}):{success:!1}}catch(e){return p(`Manual removal failed: ${e}`,{level:`error`}),{success:!1,error:`Manual removal failed: ${e}`}}}async function yt(e){let{code:t,stderr:n}=await v(`npm`,[`uninstall`,`-g`,e],{cwd:process.cwd()});if(t===0)return p(`Removed global npm installation of ${e}`),{success:!0};if(n&&!n.includes(`npm ERR! code E404`)){if(n.includes(`npm error code ENOTEMPTY`)){p(`Failed to uninstall global npm package ${e}: ${n}`,{level:`error`}),p(`Attempting manual removal due to ENOTEMPTY error`);let t=await vt(e);if(t.success)return{success:!0,warning:t.warning};if(t.error)return{success:!1,error:`Failed to remove global npm installation of ${e}: ${n}. Manual removal also failed: ${t.error}`}}return p(`Failed to uninstall global npm package ${e}: ${n}`,{level:`error`}),{success:!1,error:`Failed to remove global npm installation of ${e}: ${n}`}}return{success:!1}}async function bt(){let e=[],t=[],n=0,r=await yt(`@anthropic-ai/claude-code`);r.success?(n++,r.warning&&t.push(r.warning)):r.error&&e.push(r.error);let i=k(D(),`.claude`,`local`);try{await R(i,{recursive:!0}),n++,p(`Removed local installation at ${i}`)}catch(t){l(t)||(e.push(`Failed to remove ${i}: ${t}`),p(`Failed to remove local installation: ${t}`,{level:`error`}))}return{removed:n,errors:e,warnings:t}}var Z,Q,$=e((()=>{S(),Ce(),m(),ce(),d(),xe(),re(),de(),n(),g(),y(),ge(),ie(),b(),me(),je(),le(),Me(),$e(),we(),Z=10080*60*1e3,Q=null})),xt=e((()=>{$()}));export{_t as a,mt as c,gt as i,ut as n,$ as o,bt as r,dt as s,xt as t};
@@ -1,4 +0,0 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{dirname as t,join as n}from"node:path";import{createHash as r,randomUUID as i}from"node:crypto";import{mkdir as a,readFile as o,rename as s,stat as c,writeFile as l}from"node:fs/promises";function u(e){return e?.rootDir?e.rootDir:process.env.CLAUDE_SKILL_LEARNING_HOME?process.env.CLAUDE_SKILL_LEARNING_HOME:n(process.env.HOME??process.cwd(),`.claude`,`skill-learning`)}function d(e){let t=u(e),r=e?.project;return!r||r.scope===`global`||r.projectId===`global`?n(t,`global`,`observations.jsonl`):n(t,`projects`,r.projectId,`observations.jsonl`)}function f(e,t=D){if(e===void 0)return;let n=e;for(let e of j)n=n.replace(e,e=>{let t=e.split(/[:=]/,1)[0];return/[:=]/.test(e)?`${t}: ${A}`:A});if(n.length<=t)return n;let r=E(n),i=n.slice(0,t);return n.includes(A)&&!i.includes(A)&&(i=`${A} ${i}`),`${i}\n[TRUNCATED length=${n.length} sha256=${r}]`}function p(e,t){let n=t?.maxFieldLength??D,r={...e,toolInput:f(e.toolInput,n),toolOutput:f(e.toolOutput,n),messageText:f(e.messageText,n)},i=[r.event,r.toolName??``,r.toolInput??``,r.toolOutput??``,r.messageText??``].join(`
2
- `);return{...r,contentHash:E(i)}}async function m(e,n){let r=d(n);await a(t(r),{recursive:!0}),await v(n);let i=p(e,n),o=JSON.stringify(i);return Buffer.byteLength(o)>M||await l(r,`${o}\n`,{flag:`a`}),i}async function h(e){let t=d(e),n=``;try{n=await o(t,`utf8`)}catch(e){if(e.code===`ENOENT`)return[];throw e}let r=[];for(let e of n.split(/\r?\n/))if(e.trim())try{r.push(JSON.parse(e))}catch{}return r}async function g(e,t){let n=await o(e,`utf8`),r=[];for(let e of n.split(/\r?\n/)){if(!e.trim())continue;let n=JSON.parse(e);for(let e of y(n,t))r.push(await m(e,t))}return r}async function _(e){let t=d(e),n=e?.maxAgeDays??k,r=Date.now()-n*24*60*60*1e3,i=``;try{i=await o(t,`utf8`)}catch(e){if(e.code===`ENOENT`)return 0;throw e}let a=[],c=0;for(let e of i.split(/\r?\n/))if(e.trim())try{let t=JSON.parse(e),n=Date.parse(t.timestamp);if(!Number.isNaN(n)&&n<r){c+=1;continue}a.push(e)}catch{a.push(e)}if(c===0)return 0;let u=`${t}.tmp-${process.pid}-${Date.now()}`;return await l(u,a.length?`${a.join(`
3
- `)}\n`:``),await s(u,t),c}async function v(e){let r=d(e),i=e?.archiveThresholdBytes??O,o;try{o=await c(r)}catch(e){if(e.code===`ENOENT`)return null;throw e}if(o.size<i)return null;let l=n(t(r),`observations.archive`);await a(l,{recursive:!0});let u=n(l,`observations-${new Date().toISOString().replace(/[:.]/g,`-`)}.jsonl`);return await s(r,u),u}function y(e,t){let n=t?.project,r={sessionId:e.sessionId??`unknown-session`,projectId:n?.projectId??`global`,projectName:n?.projectName??`global`,cwd:e.cwd??n?.cwd??process.cwd(),timestamp:e.timestamp??new Date().toISOString(),source:`transcript`},i=e.message?.role??e.type,a=e.message?.content,o=[];if(e.tool_name&&o.push({...r,id:T(),event:`tool_complete`,toolName:e.tool_name,toolInput:w(e.tool_input),toolOutput:w(e.tool_response),outcome:C(e.tool_response)}),i===`user`){let e=S(a);if(e.length>0){for(let t of e)o.push({...r,id:T(),event:`tool_complete`,toolName:t.name,toolOutput:t.output,outcome:t.isError?`failure`:`success`});return o}return o.push({...r,id:T(),event:`user_message`,messageText:b(a)}),o}if(i===`assistant`){let e=x(a);for(let t of e)o.push({...r,id:T(),event:`tool_start`,toolName:t.name,toolInput:t.input});let t=b(a);t.trim()&&o.push({...r,id:T(),event:`assistant_message`,messageText:t})}return o}function b(e){return typeof e==`string`?e:Array.isArray(e)?e.map(e=>{if(typeof e==`string`)return e;if(!e||typeof e!=`object`)return``;let t=e;return typeof t.text==`string`?t.text:``}).filter(Boolean).join(`
4
- `):w(e)??``}function x(e){return Array.isArray(e)?e.flatMap(e=>{if(!e||typeof e!=`object`)return[];let t=e;return t.type===`tool_use`?[{name:String(t.name??`unknown_tool`),input:w(t.input)}]:[]}):[]}function S(e){return Array.isArray(e)?e.flatMap(e=>{if(!e||typeof e!=`object`)return[];let t=e;return t.type===`tool_result`?[{name:String(t.name??t.tool_name??`unknown_tool`),output:w(t.content),isError:t.is_error===!0}]:[]}):[]}function C(e){let t=w(e)?.toLowerCase()??``;return t.includes(`interrupted`)||t.includes(`aborted`)?`interrupted`:t.includes(`error`)||t.includes(`exception`)||t.includes(`failed`)?`failure`:`success`}function w(e){if(e!=null)return typeof e==`string`?e:JSON.stringify(e)}function T(){return typeof crypto<`u`&&`randomUUID`in crypto?crypto.randomUUID():i()}function E(e){return r(`sha256`).update(e).digest(`hex`)}var D,O,k,A,j,M,N=e((()=>{D=5e3,O=1e6,k=30,A=`[REDACTED]`,j=[/\b(?:sk|sk-ant|sk-proj|xox[baprs])-[A-Za-z0-9_-]{12,}\b/g,/\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}\b/g,/\b(?:api[_-]?key|token|secret|password|authorization)\b\s*[:=]\s*["']?[^"',\s}]+/gi,/\bBearer\s+[A-Za-z0-9._~+/=-]{12,}\b/gi],M=64*1024}));export{_ as a,f as c,N as i,w as l,u as n,h as o,g as r,p as s,m as t};
@@ -1 +0,0 @@
1
- import{Un as e,en as t}from"./state-ix0xIunV.js";import{_a as n,ya as r}from"./loadAgentsDir-D206qwP3.js";import{W as i,z as a}from"./debug-BrXObCdR.js";import{Ft as o,Ht as s,Rt as c}from"./settings-BovzmwMP.js";import{b as l,c as u,g as d}from"./config-DmomySWC.js";import{o as f,s as p}from"./log-BMCygSzM.js";import{Bt as m,_t as h,gt as g,vt as _}from"./model-CKkOnnnx.js";import{d as v,m as y,p as b}from"./rcDebugLog-CUy1_F23.js";t(),m(),d(),a(),f(),r(),o(),v();function x(e){return t=>({...t,...typeof e.permission_mode==`string`?{toolPermissionContext:{...t.toolPermissionContext,mode:c(e.permission_mode)}}:{},...typeof e.is_ultraplan_mode==`boolean`?{isUltraplanMode:e.is_ultraplan_mode}:{}})}function S({newState:t,oldState:r}){let a=r.toolPermissionContext.mode,o=t.toolPermissionContext.mode;if(a!==o){let e=s(a),n=s(o);e!==n&&y({permission_mode:n,is_ultraplan_mode:n===`plan`&&t.isUltraplanMode&&!r.isUltraplanMode?!0:null}),b(o)}if(t.mainLoopModel!==r.mainLoopModel&&e(t.mainLoopModel),t.expandedView!==r.expandedView){let e=t.expandedView===`tasks`;u().showExpandedTodos!==e&&l(t=>({...t,showExpandedTodos:e}))}if(t.verbose!==r.verbose&&u().verbose!==t.verbose){let e=t.verbose;l(t=>({...t,verbose:e}))}if(process.env.USER_TYPE===`ant`&&t.tungstenPanelVisible!==r.tungstenPanelVisible&&t.tungstenPanelVisible!==void 0&&u().tungstenPanelVisible!==t.tungstenPanelVisible){let e=t.tungstenPanelVisible;l(t=>({...t,tungstenPanelVisible:e}))}if(t.settings!==r.settings)try{g(),h(),_(),t.settings.env!==r.settings.env&&n()}catch(e){p(i(e))}}export{S as n,x as t};
@@ -1,10 +0,0 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{c as t,l as n,o as r}from"./envUtils-DSxRz_kt.js";import{Jo as i,Ko as a,Rh as o,So as s,Xc as c,Yc as l,Zc as u,at as d,ct as f,fo as p,np as ee,op as m,zh as h,zo as g}from"./loadAgentsDir-D206qwP3.js";import{a as _,l as v}from"./debug-BrXObCdR.js";import{Kn as y,Un as te,V as b,W as x}from"./model-CKkOnnnx.js";import{En as ne,Tn as S,i as re,r as C,t as w,wn as T}from"./prompt-BNHtszmZ.js";import{B as E,F as D,L as O,P as k,R as ie,ot as ae}from"./rcDebugLog-CUy1_F23.js";import{n as oe,t as A}from"./openaiShared-G2-w4gJt.js";import{homedir as j}from"os";import{join as M}from"path";import{randomUUID as N}from"crypto";import{chmod as se,mkdir as ce,readFile as P,writeFile as F}from"fs/promises";function I(){return M(L(),J)}function L(){return(process.env.CLAUDE_CONFIG_DIR??M(j(),`.claude`)).normalize(`NFC`)}function R(){return M(process.env.CODEX_HOME??M(process.env.HOME??``,`.codex`),`auth.json`)}function z(e){return typeof e==`string`&&e.length>0?e:void 0}function B(e){try{let t=JSON.parse(e);return t&&typeof t==`object`?t:null}catch{return null}}function V(e){let[,t]=e.split(`.`);if(!t)return null;try{let e=t.replace(/-/g,`+`).replace(/_/g,`/`),n=e.padEnd(e.length+(4-e.length%4)%4,`=`);return B(Buffer.from(n,`base64`).toString(`utf8`))}catch{return null}}function H(e){let t=V(e),n=t?.[`https://api.openai.com/auth`];return n&&typeof n==`object`?n:t??{}}function U(e){let t=V(e)?.exp;return typeof t==`number`?t*1e3:null}function W(e){if(e.accountId)return e.accountId;for(let t of[e.idToken,e.accessToken]){if(!t)continue;let e=H(t),n=z(e.chatgpt_account_id)??z(e.chatgpt_account_user_id)??z(e.account_id);if(n)return n}}async function G(e){try{let t=await P(e,`utf8`),n=JSON.parse(t),r=n.tokens,i=r?.id_token,a=r?.access_token,o=r?.refresh_token;return!i||!a||!o?null:{idToken:i,accessToken:a,refreshToken:o,accountId:W({idToken:i,accessToken:a,accountId:r.account_id}),lastRefresh:n.last_refresh}}catch{return null}}async function le(e){let t=I();await ce(L(),{recursive:!0});let n={auth_mode:`chatgpt`,tokens:{id_token:e.idToken,access_token:e.accessToken,refresh_token:e.refreshToken,account_id:W(e)},last_refresh:new Date().toISOString()};await F(t,`${JSON.stringify(n,null,2)}\n`,{mode:384}),await se(t,384).catch(()=>void 0)}async function ue(e,t){let n=await fetch(e,{method:`POST`,headers:{"Content-Type":`application/x-www-form-urlencoded`},body:t});if(!n.ok){let e=await n.text().catch(()=>``);throw Error(`ChatGPT token request failed (${n.status})${e?`: ${e}`:``}`)}return await n.json()}async function de(e){let t=new URLSearchParams({grant_type:`refresh_token`,refresh_token:e.refreshToken,client_id:q,scope:`openid profile email offline_access api.connectors.read api.connectors.invoke`}),n=await ue(`${K}/oauth/token`,t);return{idToken:n.id_token,accessToken:n.access_token,refreshToken:n.refresh_token??e.refreshToken,accountId:W({idToken:n.id_token,accessToken:n.access_token,accountId:e.accountId})}}function fe(){return process.env.OPENAI_AUTH_MODE===`chatgpt`}async function pe(){let e=await G(I());if(e||(e=await G(R()),e&&v(`[OpenAI] Using ChatGPT auth from Codex auth.json`)),!e)throw Error(`ChatGPT account is not logged in.`);let t=U(e.accessToken);return t!==null&&t<=Date.now()+Y&&(e=await de(e),await le(e)),{accessToken:e.accessToken,accountId:e.accountId??W(e)}}var K,q,J,Y,X=e((()=>{_(),K=`https://auth.openai.com`,q=`app_EMoamEEZ73f0CkXaXp7hrann`,J=`openai-chatgpt-auth.json`,Y=300*1e3}));function Z(e){return typeof e==`string`?e:Array.isArray(e)?e.map(e=>{if(!e||typeof e!=`object`)return``;let t=e;return typeof t.text==`string`?t.text:``}).filter(Boolean).join(`
2
- `):``}function me(e){if(typeof e==`string`)return e;if(!Array.isArray(e))return Z(e);let t=[];for(let n of e){if(!n||typeof n!=`object`)continue;let e=n;if(e.type===`text`&&typeof e.text==`string`)t.push({type:`input_text`,text:e.text});else if(e.type===`image_url`){let n=e.image_url;typeof n?.url==`string`&&t.push({type:`input_image`,image_url:n.url})}}return t.length>0?t:Z(e)}function he(e){let t=[],n=[];for(let r of e){if(!r||typeof r!=`object`)continue;let e=r,i=e.role;if(i===`system`||i===`developer`){let t=Z(e.content);t&&n.push(t);continue}if(i===`tool`){let n=e.tool_call_id;typeof n==`string`&&t.push({type:`function_call_output`,call_id:n,output:Z(e.content)});continue}if(i===`assistant`){let n=Z(e.content);n&&t.push({role:`assistant`,content:n});let r=e.tool_calls;if(Array.isArray(r))for(let e of r){if(!e||typeof e!=`object`)continue;let n=e,r=n.function,i=typeof n.id==`string`?n.id:void 0,a=typeof r?.name==`string`?r.name:void 0;!i||!a||t.push({type:`function_call`,call_id:i,name:a,arguments:typeof r?.arguments==`string`?r.arguments:`{}`})}continue}i===`user`&&t.push({role:`user`,content:me(e.content)})}return{input:t,instructions:n.length>0?n.join(`
3
-
4
- `):void 0}}function ge(e){let t=[];for(let n of e){if(!n||typeof n!=`object`)continue;let e=n.function,r=typeof e?.name==`string`?e.name:void 0;r&&t.push({type:`function`,name:r,description:typeof e?.description==`string`?e.description:``,parameters:e?.parameters&&typeof e.parameters==`object`?e.parameters:{type:`object`,properties:{}},strict:!1})}return t}function _e(e){if(e===`required`)return`required`;if(e===`auto`)return`auto`;if(!e||typeof e!=`object`)return e;let t=e,n=t.function;return t.type===`function`&&typeof n?.name==`string`?{type:`function`,name:n.name}:e}function ve(e){let{input:t,instructions:n}=he(e.messages),r=ge(e.tools);return{model:e.model,stream:!0,store:!1,input:t,...n?{instructions:n}:{},...r.length>0?{tools:r}:{},...e.toolChoice?{tool_choice:_e(e.toolChoice)}:{},parallel_tool_calls:!0}}async function*ye(e){if(!e.body)throw Error(`ChatGPT response did not include a body`);let t=e.body.getReader(),n=new TextDecoder,r=``;for(;;){let{done:e,value:i}=await t.read();if(e)break;r+=n.decode(i,{stream:!0});let a=r.indexOf(`
5
-
6
- `);for(;a>=0;){let e=r.slice(0,a);r=r.slice(a+2);let t=e.split(/\r?\n/).filter(e=>e.startsWith(`data:`)).map(e=>e.slice(5).trimStart()).join(`
7
- `);if(t&&t!==`[DONE]`){let e=JSON.parse(t);e&&typeof e==`object`&&(yield e)}a=r.indexOf(`
8
-
9
- `)}}}function be(e){let t=e?.usage,n=t?.input_tokens_details;return{input_tokens:typeof t?.input_tokens==`number`?t.input_tokens:0,output_tokens:typeof t?.output_tokens==`number`?t.output_tokens:0,cache_creation_input_tokens:0,cache_read_input_tokens:typeof n?.cached_tokens==`number`?n.cached_tokens:0}}function xe(e){return e?.status===`incomplete`?`max_tokens`:`end_turn`}async function*Q(e,t){let n=`msg_${N().replace(/-/g,``).slice(0,24)}`,r=new Map,i=!1,a=-1,o=!1,s=!1,c=async function*(){i||(i=!0,yield{type:`message_start`,message:{id:n,type:`message`,role:`assistant`,content:[],model:t,stop_reason:null,stop_sequence:null,usage:{input_tokens:0,output_tokens:0,cache_creation_input_tokens:0,cache_read_input_tokens:0}}})};for await(let t of e){for await(let e of c())yield e;let e=t.type;if(e===`response.output_text.delta`){o||(s&&(yield{type:`content_block_stop`,index:a},s=!1),a++,o=!0,yield{type:`content_block_start`,index:a,content_block:{type:`text`,text:``}}),yield{type:`content_block_delta`,index:a,delta:{type:`text_delta`,text:String(t.delta??``)}};continue}if(e===`response.reasoning_text.delta`){s||(o&&(yield{type:`content_block_stop`,index:a},o=!1),a++,s=!0,yield{type:`content_block_start`,index:a,content_block:{type:`thinking`,thinking:``,signature:``}}),yield{type:`content_block_delta`,index:a,delta:{type:`thinking_delta`,thinking:String(t.delta??``)}};continue}if(e===`response.output_item.added`){let e=t.item,n=typeof t.output_index==`number`?t.output_index:-1;if(e?.type===`function_call`&&n>=0){o&&(yield{type:`content_block_stop`,index:a},o=!1),s&&(yield{type:`content_block_stop`,index:a},s=!1),a++;let t=String(e.call_id??e.id??`call_${n}`),i=String(e.name??``);r.set(n,{contentIndex:a,open:!0,name:i,id:t}),yield{type:`content_block_start`,index:a,content_block:{type:`tool_use`,id:t,name:i,input:{}}}}continue}if(e===`response.function_call_arguments.delta`){let e=typeof t.output_index==`number`?t.output_index:-1,n=r.get(e);n&&(yield{type:`content_block_delta`,index:n.contentIndex,delta:{type:`input_json_delta`,partial_json:String(t.delta??``)}});continue}if(e===`response.output_item.done`){let e=typeof t.output_index==`number`?t.output_index:-1,n=r.get(e);n?.open&&(yield{type:`content_block_stop`,index:n.contentIndex},n.open=!1);continue}if(e===`response.error`){let e=t.error;throw Error(String(e?.message??`ChatGPT Responses API error`))}if(e===`response.failed`){let e=t.response?.error;throw Error(String(e?.message??`ChatGPT Responses API failed`))}if(e===`response.completed`||e===`response.incomplete`){o&&(yield{type:`content_block_stop`,index:a},o=!1),s&&(yield{type:`content_block_stop`,index:a},s=!1);let e=t.response;yield{type:`message_delta`,delta:{stop_reason:xe(e),stop_sequence:null},usage:be(e)},yield{type:`message_stop`}}}}async function Se(e){let t=await pe(),n=e.fetchOverride??globalThis.fetch,r={Authorization:`Bearer ${t.accessToken}`,"Content-Type":`application/json`,Accept:`text/event-stream`,"OpenAI-Beta":`responses=experimental`,Origin:`https://chatgpt.com`,Referer:`https://chatgpt.com/`,originator:`workmate`};t.accountId&&(r[`ChatGPT-Account-Id`]=t.accountId);let i=await n(`https://chatgpt.com/backend-api/codex/responses`,{method:`POST`,headers:r,body:JSON.stringify(e.request),signal:e.signal});if(!i.ok){let e=await i.text().catch(()=>``);throw Error(`ChatGPT Responses API request failed (${i.status})${e?`: ${e.slice(0,500)}`:``}`)}return ye(i)}var Ce=e((()=>{X()}));function we(e){if(t(process.env.OPENAI_ENABLE_THINKING))return!1;if(n(process.env.OPENAI_ENABLE_THINKING))return!0;let r=e.toLowerCase();return r.includes(`deepseek`)||r.includes(`mimo`)}function Te(e,t){return t??(process.env.OPENAI_MAX_TOKENS&&parseInt(process.env.OPENAI_MAX_TOKENS,10)||void 0)??(process.env.CLAUDE_CODE_MAX_OUTPUT_TOKENS&&parseInt(process.env.CLAUDE_CODE_MAX_OUTPUT_TOKENS,10)||void 0)??e}function Ee(e){let{model:t,messages:n,tools:r,toolChoice:i,enableThinking:a,maxTokens:o,temperatureOverride:s}=e;return{model:t,messages:n,max_tokens:o,...r.length>0&&{tools:r,...i&&{tool_choice:i}},stream:!0,stream_options:{include_usage:!0},...a&&{thinking:{type:`enabled`},enable_thinking:!0,chat_template_kwargs:{thinking:!0,enable_thinking:!0}},...!a&&s!==void 0&&{temperature:s}}}var De=e((()=>{r()}));function Oe(e,t,n,r){if(!r||c())return e;let i=t.filter(e=>n.has(e.name)).map(w).sort().join(`
10
- `);return i?[s({content:`<available-deferred-tools>\n${i}\n</available-deferred-tools>`,isMeta:!0}),...e]:e}function ke(e){return e.type===`assistant`||e.type===`user`}function $(e){let{partialMessage:t,contentBlocks:n,tools:r,agentId:i,usage:o,stopReason:s,maxTokens:c}=e,l=[],u=Object.keys(n).sort((e,t)=>Number(e)-Number(t)).map(e=>n[Number(e)]).filter(Boolean);return u.length>0&&t&&l.push({message:{...t,content:a(u,r,i),usage:o,stop_reason:s,stop_sequence:null},requestId:void 0,type:`assistant`,uuid:N(),timestamp:new Date().toISOString()}),s===`max_tokens`&&l.push(p({content:`Output truncated: response exceeded the ${c} token limit. Set OPENAI_MAX_TOKENS or CLAUDE_CODE_MAX_OUTPUT_TOKENS to override.`,apiError:`max_output_tokens`,error:`max_output_tokens`})),l}async function*Ae(e,t,n,r,a){try{let s=ae(a.model),c=i(e,n),l=await u(a.model,n,a.getToolPermissionContext||(async()=>T()),a.agents||[],a.querySource),d=new Set;if(l)for(let e of n)re(e)&&d.add(e.name);let p=n;l&&d.size>0&&(p=n.filter(e=>!!(!d.has(e.name)||ne(e,`SearchExtraTools`))));let m=(await Promise.all(p.map(e=>f(e,{getToolPermissionContext:a.getToolPermissionContext,tools:n,agents:a.agents,allowedAgentTypes:a.allowedAgentTypes,model:a.model,deferLoading:l&&d.has(e.name)})))).filter(e=>{let t=e;return t.type!==`advisor_20260301`&&t.type!==`computer_20250124`}),h=we(s),g=E(Oe(c.filter(ke),n,d,l),t,{enableThinking:h}),_=ie(m),y=O(a.toolChoice);if(l){let e=p.filter(e=>d.has(e.name)).length;v(`[OpenAI] Tool search enabled: ${e}/${d.size} deferred tools included, total tools=${_.length}`)}else v(`[OpenAI] Tool search disabled, total tools=${_.length}`);let{upperLimit:x}=te(s),S=Te(x,a.maxOutputTokensOverride);v(`[OpenAI] Calling model=${s}, messages=${g.length}, tools=${_.length}, thinking=${h}`);let C=fe()?Q(await Se({request:ve({model:s,messages:g,tools:_,toolChoice:y}),signal:r,fetchOverride:a.fetchOverride}),s):D(await o({maxRetries:0,fetchOverride:a.fetchOverride,source:a.querySource}).chat.completions.create(Ee({model:s,messages:g,tools:_,toolChoice:y,enableThinking:h,maxTokens:S,temperatureOverride:a.temperatureOverride}),{signal:r}),s),w={},k=null,A=null,j={input_tokens:0,output_tokens:0,cache_creation_input_tokens:0,cache_read_input_tokens:0},M=0,N=Date.now();for await(let e of C){switch(e.type){case`message_start`:k=e.message,M=Date.now()-N,e.message.usage&&(j={...j,...e.message.usage});break;case`content_block_start`:{let t=e.index,n=e.content_block;n.type===`tool_use`?w[t]={...n,input:``}:n.type===`text`?w[t]={...n,text:``}:n.type===`thinking`?w[t]={...n,thinking:``,signature:``}:w[t]={...n};break}case`content_block_delta`:{let t=e.index,n=e.delta,r=w[t];if(!r)break;n.type===`text_delta`?r.text=(r.text||``)+n.text:n.type===`input_json_delta`?r.input=(r.input||``)+n.partial_json:n.type===`thinking_delta`?r.thinking=(r.thinking||``)+n.thinking:n.type===`signature_delta`&&(r.signature=n.signature);break}case`content_block_stop`:break;case`message_delta`:{let t=e.usage;t&&(j=oe(j,t)),e.delta.stop_reason!=null&&(A=e.delta.stop_reason);break}case`message_stop`:if(k){for(let e of $({partialMessage:k,contentBlocks:w,tools:n,agentId:a.agentId,usage:j,stopReason:A,maxTokens:S}))yield e;k=null}j.input_tokens+j.output_tokens>0&&ee(b(s,j),j,a.model);break}yield{type:`stream_event`,event:e,...e.type===`message_start`?{ttftMs:M}:void 0}}if(k)for(let e of $({partialMessage:k,contentBlocks:w,tools:n,agentId:a.agentId,usage:j,stopReason:A,maxTokens:S}))yield e}catch(e){let t=e instanceof Error?e.message:String(e);v(`[OpenAI] Error: ${t}`,{level:`error`}),yield p({content:`API Error: ${t}`,apiError:`api_error`,error:e instanceof Error?e:Error(String(e))})}}e((()=>{h(),A(),k(),X(),Ce(),g(),d(),S(),_(),m(),x(),De(),y(),l(),C()}))();export{Ae as queryModelOpenAI};
@@ -1 +0,0 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";async function t(e){e(`/output-style has been deprecated. Use /config to change your output style, or set it in your settings file. Changes take effect on the next session.`,{display:`system`})}e((()=>{}))();export{t as call};
@@ -1 +0,0 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{n as t,t as n}from"./axios-DaWTGg7G.js";import{b as r,c as i,g as a}from"./config-DmomySWC.js";import{d as o,f as s,o as c,s as l}from"./log-BMCygSzM.js";import{l as u,u as d}from"./oauth-BqJqV-2M.js";import{Bt as f,jt as p}from"./model-CKkOnnnx.js";import{a as m,l as h,o as g}from"./api-gqTA-D7n.js";async function _(){try{let{accessToken:e,orgUUID:n}=await h(),r=`${u().BASE_API_URL}/api/oauth/organizations/${n}/overage_credit_grant`;return(await t.get(r,{headers:m(e)})).data}catch(e){return l(e),null}}function v(){let e=p()?.organizationUuid;if(!e)return null;let t=i().overageCreditGrantCache?.[e];return!t||Date.now()-t.timestamp>S?null:t.info}function y(){let e=p()?.organizationUuid;if(!e)return;let t=i().overageCreditGrantCache;!t||!(e in t)||r(t=>{let n={...t.overageCreditGrantCache};return delete n[e],{...t,overageCreditGrantCache:n}})}async function b(){if(s())return;let e=p()?.organizationUuid;if(!e)return;let t=await _();t&&r(n=>{let r=n.overageCreditGrantCache?.[e],i=r?.info,a=i&&i.available===t.available&&i.eligible===t.eligible&&i.granted===t.granted&&i.amount_minor_units===t.amount_minor_units&&i.currency===t.currency;if(a&&r&&Date.now()-r.timestamp<=S)return n;let o={info:a?i:t,timestamp:Date.now()};return{...n,overageCreditGrantCache:{...n.overageCreditGrantCache,[e]:o}}})}function x(e){if(e.amount_minor_units==null||!e.currency)return null;if(e.currency.toUpperCase()===`USD`){let t=e.amount_minor_units/100;return Number.isInteger(t)?`$${t}`:`$${t.toFixed(2)}`}return null}var S,C=e((()=>{n(),d(),f(),a(),c(),o(),g(),S=3600*1e3}));export{b as a,y as i,v as n,C as r,x as t};
@@ -1 +0,0 @@
1
- import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{I as n,P as r,fi as i,hn as a,t as o,y as s}from"./src-CDCSSo0U2.js";import{t as c}from"./jsx-runtime-Bb4Xn-E0.js";import{n as l,t as u}from"./tui-C2yuCuOU.js";async function d(e,t){let n=await u(e);n.type===`text`&&t(n.value,{display:`system`})}function f({onDone:e}){let[t,i]=(0,m.useState)(0),o=(0,m.useMemo)(()=>[{label:`Status`,description:`Show marker and environment override state`,run:()=>void d(`status`,e)},{label:`Toggle`,description:`Flip persisted TUI mode for the next session`,run:()=>void d(`toggle`,e)},{label:`On`,description:`Enable flicker-free alternate-screen mode`,run:()=>void d(`on`,e)},{label:`Off`,description:`Disable flicker-free alternate-screen mode`,run:()=>void d(`off`,e)}],[e]),c=()=>{let e=o[t];e&&e.run()};return a((e,t)=>{if(t.upArrow){i(e=>Math.max(0,e-1));return}if(t.downArrow){i(e=>Math.min(o.length-1,e+1));return}t.return&&c()}),(0,h.jsx)(s,{title:`TUI Mode`,subtitle:`${o.length} actions`,onCancel:()=>e(`TUI mode panel dismissed`,{display:`system`}),color:`background`,hideInputGuide:!0,children:(0,h.jsxs)(n,{flexDirection:`column`,children:[o.map((e,i)=>(0,h.jsxs)(n,{flexDirection:`row`,children:[(0,h.jsx)(r,{children:`${i===t?`›`:` `} ${e.label}`.padEnd(g)}),(0,h.jsx)(r,{dimColor:!0,children:e.description})]},e.label)),(0,h.jsx)(n,{marginTop:1,children:(0,h.jsx)(r,{dimColor:!0,children:`↑/↓ select · Enter run · Esc close`})})]})})}async function p(e,t,n){let r=n?.trim()??``;return r?(await d(r,e),null):(0,h.jsx)(f,{onDone:e})}var m,h,g;e((()=>{m=t(i(),1),o(),l(),h=c(),g=24}))();export{p as call};
@@ -1 +0,0 @@
1
- import{i as e,r as t}from"./parser-DFwaTGf7.js";t();export{e as parseCommand};
@@ -1 +0,0 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{Fr as t,Mi as n,Ni as r,Pr as i}from"./state-ix0xIunV.js";import{HD as a,VD as o}from"./loadAgentsDir-D206qwP3.js";function s(e,t,n,r){for(var i=-1,a=e==null?0:e.length;++i<a;){var o=e[i];t(r,o,n(o),e)}return r}var c=e((()=>{}));function l(e,t,n,r){return o(e,function(e,i,a){t(r,e,n(e),a)}),r}var u=e((()=>{a()}));function d(e,t){return function(n,a){var o=r(n)?s:l,c=t?t():{};return o(n,e,i(a,2),c)}}var f=e((()=>{c(),u(),t(),n()})),p,m=e((()=>{f(),p=d(function(e,t,n){e[+!n].push(t)},function(){return[[],[]]})}));export{p as n,m as t};
@@ -1 +0,0 @@
1
- import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{I as n,Lt as r,P as i,Wt as a,dr as o,fi as s,hn as c,t as l,x as u}from"./src-CDCSSo0U2.js";import{t as d}from"./jsx-runtime-Bb4Xn-E0.js";import{Kt as f,_n as p,gn as m}from"./settings-BovzmwMP.js";import{b as h,c as g,g as _}from"./config-DmomySWC.js";import{o as v,s as y}from"./log-BMCygSzM.js";import{n as b,r as x}from"./analytics-BotDBGh0.js";import{i as S,n as C,o as w,r as T,s as E,u as D}from"./referral-CUaIo_vT.js";import{n as O,t as k}from"./useExitOnCtrlCDWithKeybindings-DKIqRraH.js";function A({onDone:e}){let[t,s]=(0,j.useState)(!0),[l,d]=(0,j.useState)([]),[f,p]=(0,j.useState)(!1),[h,g]=(0,j.useState)(null),[_,v]=(0,j.useState)(void 0),b=O(()=>e(`Guest passes dialog dismissed`,{display:`system`}));if(a(`confirm:no`,(0,j.useCallback)(()=>{e(`Guest passes dialog dismissed`,{display:`system`})},[e]),{context:`Confirmation`}),c((t,n)=>{n.return&&h&&o(h).then(t=>{t&&process.stdout.write(t),x(`tengu_guest_passes_link_copied`,{}),e(`Referral link copied to clipboard!`)})}),(0,j.useEffect)(()=>{async function e(){try{let e=await S();if(!e||!e.eligible){p(!1),s(!1);return}p(!0),e.referral_code_details?.referral_link&&g(e.referral_code_details.referral_link),v(e.referrer_reward);let t=e.referral_code_details?.campaign??`claude_code_guest_pass`,n;try{n=await C(t)}catch(e){y(e),p(!1),s(!1);return}let r=n.redemptions||[],i=n.limit||3,a=[];for(let e=0;e<i;e++){let t=r[e];a.push({passNumber:e+1,isAvailable:!t})}d(a),s(!1)}catch(e){y(e),p(!1),s(!1)}}e()},[]),t)return(0,M.jsx)(u,{children:(0,M.jsxs)(n,{flexDirection:`column`,gap:1,children:[(0,M.jsx)(i,{dimColor:!0,children:`Loading guest pass information…`}),(0,M.jsx)(i,{dimColor:!0,italic:!0,children:b.pending?(0,M.jsxs)(M.Fragment,{children:[`Press `,b.keyName,` again to exit`]}):(0,M.jsx)(M.Fragment,{children:`Esc to cancel`})})]})});if(!f)return(0,M.jsx)(u,{children:(0,M.jsxs)(n,{flexDirection:`column`,gap:1,children:[(0,M.jsx)(i,{children:`Guest passes are not currently available.`}),(0,M.jsx)(i,{dimColor:!0,italic:!0,children:b.pending?(0,M.jsxs)(M.Fragment,{children:[`Press `,b.keyName,` again to exit`]}):(0,M.jsx)(M.Fragment,{children:`Esc to cancel`})})]})});let w=m(l,e=>e.isAvailable),E=[...l].sort((e,t)=>t.isAvailable-+e.isAvailable),D=e=>e.isAvailable?(0,M.jsxs)(n,{flexDirection:`column`,marginRight:1,children:[(0,M.jsx)(i,{children:`┌──────────┐`}),(0,M.jsxs)(i,{children:[` ) CC `,(0,M.jsx)(i,{color:`claude`,children:`✻`}),` ┊ ( `]}),(0,M.jsx)(i,{children:`└──────────┘`})]},e.passNumber):(0,M.jsxs)(n,{flexDirection:`column`,marginRight:1,children:[(0,M.jsx)(i,{dimColor:!0,children:`┌─────────╱`}),(0,M.jsx)(i,{dimColor:!0,children:` ) CC ✻ ┊╱`}),(0,M.jsx)(i,{dimColor:!0,children:`└───────╱`})]},e.passNumber);return(0,M.jsx)(u,{children:(0,M.jsxs)(n,{flexDirection:`column`,gap:1,children:[(0,M.jsxs)(i,{color:`permission`,children:[`Guest passes · `,w,` left`]}),(0,M.jsx)(n,{flexDirection:`row`,marginLeft:2,children:E.slice(0,3).map(e=>D(e))}),h&&(0,M.jsx)(n,{marginLeft:2,children:(0,M.jsx)(i,{children:h})}),(0,M.jsx)(n,{flexDirection:`column`,marginLeft:2,children:(0,M.jsxs)(i,{dimColor:!0,children:[_?`Share a free week of Claude Code with friends. If they love it and subscribe, you'll get ${T(_)} of extra usage to keep building. `:`Share a free week of Claude Code with friends. `,(0,M.jsx)(r,{url:_?`https://support.claude.com/en/articles/13456702-claude-code-guest-passes`:`https://support.claude.com/en/articles/12875061-claude-code-guest-passes`,children:`Terms apply.`})]})}),(0,M.jsx)(n,{children:(0,M.jsx)(i,{dimColor:!0,italic:!0,children:b.pending?(0,M.jsxs)(M.Fragment,{children:[`Press `,b.keyName,` again to exit`]}):(0,M.jsx)(M.Fragment,{children:`Enter to copy link · Esc to cancel`})})})]})})}var j,M,N=e((()=>{s(),j=t(s(),1),f(),k(),l(),D(),b(),E(),p(),v(),M=d()}));async function P(e){let t=!g().hasVisitedPasses;if(t){let e=w();h(t=>({...t,hasVisitedPasses:!0,passesLastSeenRemaining:e??t.passesLastSeenRemaining}))}return x(`tengu_guest_passes_visited`,{is_first_visit:t}),(0,F.jsx)(A,{onDone:e})}var F;e((()=>{s(),N(),b(),E(),_(),F=d()}))();export{P as call};
@@ -1,3 +0,0 @@
1
- import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{n,t as r}from"./figures-5ThXQEtq.js";import{I as i,P as a,Wt as o,Xn as s,a as c,di as l,fi as u,hn as d,k as f,kt as p,n as m,o as h,ot as g,r as _,s as ee,t as v,ui as y,x as te,y as b}from"./src-CDCSSo0U2.js";import{t as x}from"./jsx-runtime-Bb4Xn-E0.js";import{en as ne,nt as S}from"./state-ix0xIunV.js";import{B as re,Dw as ie,Ew as C,Fx as w,G as T,H as ae,K as E,KS as oe,Px as D,SD as O,Sw as se,U as ce,US as k,V as le,WS as ue,_o as A,_u as j,aC as de,mx as M,px as N,vu as P,yD as F,zo as fe}from"./loadAgentsDir-D206qwP3.js";import{S as I,w as L}from"./debug-BrXObCdR.js";import{B as R,L as z,an as B,dn as pe,g as V,o as H,z as me}from"./settings-BovzmwMP.js";import{l as he,o as ge}from"./stringUtils-DGLPkqJ4.js";import{u as _e}from"./referral-CUaIo_vT.js";import{n as ve,t as ye}from"./useExitOnCtrlCDWithKeybindings-DKIqRraH.js";import{n as be,t as xe}from"./AddWorkspaceDirectory-ClHi-Dr6.js";import{t as Se}from"./SearchBox-vfLXEPed.js";import{n as Ce,t as we}from"./useSearchInput-D1Vr2Js1.js";import{n as Te,t as Ee}from"./shadowedRuleDetection-D1wsAdpp.js";import{n as U,t as De}from"./autoModeDenials-BxNzGJdR.js";function Oe({ruleValue:e}){switch(e.toolName){case j.name:return e.ruleContent?e.ruleContent.endsWith(`:*`)?(0,W.jsxs)(a,{dimColor:!0,children:[`Any Bash command starting with `,(0,W.jsx)(a,{bold:!0,children:e.ruleContent.slice(0,-2)})]}):(0,W.jsxs)(a,{dimColor:!0,children:[`The Bash command `,(0,W.jsx)(a,{bold:!0,children:e.ruleContent})]}):(0,W.jsx)(a,{dimColor:!0,children:`Any Bash command`});default:return e.ruleContent?null:(0,W.jsxs)(a,{dimColor:!0,children:[`Any use of the `,(0,W.jsx)(a,{bold:!0,children:e.toolName}),` tool`]})}}var W,ke=e((()=>{u(),v(),P(),W=x()}));function Ae(e){switch(e){case`localSettings`:return{label:`Project settings (local)`,description:`Saved in ${H(`localSettings`)}`,value:e};case`projectSettings`:return{label:`Project settings`,description:`Checked in at ${H(`projectSettings`)}`,value:e};case`userSettings`:return{label:`User settings`,description:`Saved in at ~/.claude/settings.json`,value:e}}}function je({onAddRules:e,onCancel:t,ruleValues:n,ruleBehavior:r,initialContext:o,setToolPermissionContext:s}){let c=B.map(Ae),l=(0,Me.useCallback)(i=>{if(i===`cancel`){t();return}else if(B.includes(i)){let t=i,a=se(o,{type:`addRules`,rules:n,behavior:r,destination:t});ie({type:`addRules`,rules:n,behavior:r,destination:t}),s(a);let c=n.map(e=>({ruleValue:e,ruleBehavior:r,source:t})),l=Ee(a,{sandboxAutoAllowEnabled:F.isSandboxingEnabled()&&F.isAutoAllowBashIfSandboxedEnabled()}).filter(e=>n.some(t=>t.toolName===e.rule.ruleValue.toolName&&t.ruleContent===e.rule.ruleValue.ruleContent));e(c,l.length>0?l:void 0)}},[e,t,n,r,o,s]);return(0,G.jsxs)(b,{title:`Add ${r} permission ${he(n.length,`rule`)}`,onCancel:t,color:`permission`,children:[(0,G.jsx)(i,{flexDirection:`column`,paddingX:2,children:n.map(e=>(0,G.jsxs)(i,{flexDirection:`column`,children:[(0,G.jsx)(a,{bold:!0,children:R(e)}),(0,G.jsx)(Oe,{ruleValue:e})]},R(e)))}),(0,G.jsxs)(i,{flexDirection:`column`,marginY:1,children:[(0,G.jsx)(a,{children:n.length===1?`Where should this rule be saved?`:`Where should these rules be saved?`}),(0,G.jsx)(N,{options:c,onChange:l})]})]})}var Me,G,Ne=e((()=>{u(),Me=t(u(),1),M(),v(),C(),z(),Te(),O(),pe(),V(),ge(),ke(),G=x()}));function Pe({onCancel:e,onSubmit:t,ruleBehavior:n}){let[s,c]=(0,Fe.useState)(``),[l,u]=(0,Fe.useState)(0),d=ve();o(`confirm:no`,e,{context:`Settings`});let{columns:f}=g(),m=f-6;return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(i,{flexDirection:`column`,gap:1,borderStyle:`round`,paddingLeft:1,paddingRight:1,borderColor:`permission`,children:[(0,K.jsxs)(a,{bold:!0,color:`permission`,children:[`Add `,n,` permission rule`]}),(0,K.jsxs)(i,{flexDirection:`column`,children:[(0,K.jsxs)(a,{children:[`Permission rules are a tool name, optionally followed by a specifier in parentheses.`,(0,K.jsx)(p,{}),`e.g., `,(0,K.jsx)(a,{bold:!0,children:R({toolName:j.name})}),(0,K.jsx)(a,{bold:!1,children:` or `}),(0,K.jsx)(a,{bold:!0,children:R({toolName:j.name,ruleContent:`ls:*`})})]}),(0,K.jsx)(i,{borderDimColor:!0,borderStyle:`round`,marginY:1,paddingLeft:1,children:(0,K.jsx)(D,{showCursor:!0,value:s,onChange:c,onSubmit:e=>{let r=e.trim();r.length!==0&&t(me(r),n)},placeholder:`Enter permission rule${r.ellipsis}`,columns:m,cursorOffset:l,onChangeCursorOffset:u})})]})]}),(0,K.jsx)(i,{marginLeft:3,children:d.pending?(0,K.jsxs)(a,{dimColor:!0,children:[`Press `,d.keyName,` again to exit`]}):(0,K.jsx)(a,{dimColor:!0,children:`Enter to submit · Esc to cancel`})})]})}var Fe,K,Ie=e((()=>{n(),u(),Fe=t(u(),1),w(),ye(),de(),v(),_e(),P(),z(),K=x()}));function Le({onHeaderFocusChange:e,onStateChange:t}){let{headerFocused:n,focusHeader:r}=c();(0,q.useEffect)(()=>{e?.(n)},[n,e]);let[o]=(0,q.useState)(()=>De()),[s,l]=(0,q.useState)(()=>new Set),[u,f]=(0,q.useState)(()=>new Set),[p,m]=(0,q.useState)(0);(0,q.useEffect)(()=>{t({approved:s,retry:u,denials:o})},[s,u,o,t]);let h=(0,q.useCallback)(e=>{let t=Number(e);l(e=>{let n=new Set(e);return n.has(t)?n.delete(t):n.add(t),n})},[]),g=(0,q.useCallback)(e=>{m(Number(e))},[]);if(d((e,t)=>{e===`r`&&(f(e=>{let t=new Set(e);return t.has(p)?t.delete(p):t.add(p),t}),l(e=>{if(e.has(p))return e;let t=new Set(e);return t.add(p),t}))},{isActive:o.length>0}),o.length===0)return(0,J.jsx)(a,{dimColor:!0,children:`No recent denials. Commands denied by the auto mode classifier will appear here.`});let _=o.map((e,t)=>{let n=s.has(t),r=u.has(t)?` (retry)`:``;return{label:(0,J.jsxs)(a,{children:[(0,J.jsx)(ee,{status:n?`success`:`error`,withSpace:!0}),e.display,(0,J.jsx)(a,{dimColor:!0,children:r})]}),value:String(t)}});return(0,J.jsxs)(i,{flexDirection:`column`,children:[(0,J.jsx)(a,{children:`Commands recently denied by the auto mode classifier.`}),(0,J.jsx)(i,{marginTop:1,children:(0,J.jsx)(N,{options:_,onChange:h,onFocus:g,visibleOptionCount:Math.min(10,_.length),isDisabled:n,onUpFromFirstItem:r})})]})}var q,J,Re=e((()=>{u(),q=t(u(),1),v(),U(),M(),J=x()}));function ze({directoryPath:e,onRemove:t,onCancel:n,permissionContext:r,setPermissionContext:o}){let s=(0,Be.useCallback)(()=>{o(se(r,{type:`removeDirectories`,directories:[e],destination:`session`})),t()},[e,r,o,t]),c=(0,Be.useCallback)(e=>{e===`yes`?s():n()},[s,n]);return(0,Y.jsxs)(b,{title:`Remove directory from workspace?`,onCancel:n,color:`error`,children:[(0,Y.jsx)(i,{marginX:2,flexDirection:`column`,children:(0,Y.jsx)(a,{bold:!0,children:e})}),(0,Y.jsx)(a,{children:`Claude Code will no longer have access to files in this directory.`}),(0,Y.jsx)(N,{onChange:c,onCancel:n,options:[{label:`Yes`,value:`yes`},{label:`No`,value:`no`}]})]})}var Be,Y,Ve=e((()=>{u(),Be=t(u(),1),M(),v(),C(),Y=x()}));function He({onExit:e,toolPermissionContext:t,onRequestAddDirectory:n,onRequestRemoveDirectory:o,onHeaderFocusChange:s}){let{headerFocused:l,focusHeader:u}=c();(0,X.useEffect)(()=>{s?.(l)},[l,s]);let d=Ue.useMemo(()=>Array.from(t.additionalWorkingDirectories.keys()).map(e=>({path:e,isCurrent:!1,isDeletable:!0})),[t.additionalWorkingDirectories]),f=(0,X.useCallback)(e=>{if(e===`add-directory`){n();return}let t=d.find(t=>t.path===e);t&&t.isDeletable&&o(t.path)},[d,n,o]),p=(0,X.useCallback)(()=>e(`Workspace dialog dismissed`,{display:`system`}),[e]),m=Ue.useMemo(()=>{let e=d.map(e=>({label:e.path,value:e.path}));return e.push({label:`Add directory${r.ellipsis}`,value:`add-directory`}),e},[d]);return(0,Z.jsxs)(i,{flexDirection:`column`,marginBottom:1,children:[(0,Z.jsxs)(i,{flexDirection:`row`,marginTop:1,marginLeft:2,gap:1,children:[(0,Z.jsx)(a,{children:`- ${S()}`}),(0,Z.jsx)(a,{dimColor:!0,children:`(Original working directory)`})]}),(0,Z.jsx)(N,{options:m,onChange:f,onCancel:p,visibleOptionCount:Math.min(10,m.length),onUpFromFirstItem:u,isDisabled:l})]})}var Ue,X,Z,We=e((()=>{n(),Ue=t(u(),1),X=t(u(),1),ne(),M(),v(),Z=x()}));function Ge({rule:e}){return(0,$.jsx)(a,{dimColor:!0,children:`From ${E(e.source)}`})}function Ke(e){switch(e){case`allow`:return`allowed`;case`deny`:return`denied`;case`ask`:return`ask`}}function qe({rule:e,onDelete:t,onCancel:n}){let r=ve();o(`confirm:no`,n,{context:`Confirmation`});let s=(0,$.jsxs)(i,{flexDirection:`column`,marginX:2,children:[(0,$.jsx)(a,{bold:!0,children:R(e.ruleValue)}),(0,$.jsx)(Oe,{ruleValue:e.ruleValue}),(0,$.jsx)(Ge,{rule:e})]}),c=(0,$.jsx)(i,{marginLeft:3,children:r.pending?(0,$.jsxs)(a,{dimColor:!0,children:[`Press `,r.keyName,` again to exit`]}):(0,$.jsx)(a,{dimColor:!0,children:`Esc to cancel`})});return e.source===`policySettings`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(i,{flexDirection:`column`,gap:1,borderStyle:`round`,paddingLeft:1,paddingRight:1,borderColor:`permission`,children:[(0,$.jsx)(a,{bold:!0,color:`permission`,children:`Rule details`}),s,(0,$.jsxs)(a,{italic:!0,children:[`This rule is configured by managed settings and cannot be modified.`,`
2
- `,`Contact your system administrator for more information.`]})]}),c]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(i,{flexDirection:`column`,gap:1,borderStyle:`round`,paddingLeft:1,paddingRight:1,borderColor:`error`,children:[(0,$.jsxs)(a,{bold:!0,color:`error`,children:[`Delete `,Ke(e.ruleBehavior),` tool?`]}),s,(0,$.jsx)(a,{children:`Are you sure you want to delete this permission rule?`}),(0,$.jsx)(N,{onChange:e=>e===`yes`?t():n(),onCancel:n,options:[{label:`Yes`,value:`yes`},{label:`No`,value:`no`}]})]}),c]})}function Je(e){let{options:t,searchQuery:n,isSearchMode:r,isFocused:a,onSelect:o,onCancel:s,lastFocusedRuleKey:l,cursorOffset:u,onHeaderFocusChange:d}=e,p=h(),{headerFocused:m,focusHeader:g,blurHeader:_}=c();return(0,Q.useEffect)(()=>{r&&m&&_()},[r,m,_]),(0,Q.useEffect)(()=>{d?.(m)},[m,d]),(0,$.jsxs)(i,{flexDirection:`column`,children:[(0,$.jsx)(i,{marginBottom:1,flexDirection:`column`,children:(0,$.jsx)(f,{query:n,isFocused:r&&!m,isTerminalFocused:a,width:p,cursorOffset:u})}),(0,$.jsx)(N,{options:t,onChange:o,onCancel:s,visibleOptionCount:Math.min(10,t.length),isDisabled:r||m,defaultFocusValue:l,onUpFromFirstItem:g})]})}function Ye({tab:e,getRulesOptions:t,handleToolSelect:n,...r}){return(0,$.jsxs)(i,{flexDirection:`column`,flexShrink:e===`allow`?0:void 0,children:[(0,$.jsx)(a,{children:{allow:`Claude Code won't ask before using allowed tools.`,ask:`Claude Code will always ask for confirmation before using these tools.`,deny:`Claude Code will always reject requests to use denied tools.`}[e]}),(0,$.jsx)(Je,{options:t(e,r.searchQuery).options,onSelect:t=>n(t,e),...r})]})}function Xe({onExit:e,initialTab:t,onRetryDenials:n}){let c=De().length>0,l=t??(c?`recent`:`allow`),[u,d]=(0,Q.useState)([]),f=ue(e=>e.toolPermissionContext),p=oe(),h=s(),g=(0,Q.useRef)({approved:new Set,retry:new Set,denials:[]}),ee=(0,Q.useCallback)(e=>{g.current=e},[]),[v,b]=(0,Q.useState)(),[x,ne]=(0,Q.useState)(),[S,C]=(0,Q.useState)(null),[w,T]=(0,Q.useState)(null),[E,D]=(0,Q.useState)(!1),[O,k]=(0,Q.useState)(null),[A,j]=(0,Q.useState)(!1),[de,M]=(0,Q.useState)(!0),N=(0,Q.useCallback)(e=>{M(e)},[]),P=(0,Q.useMemo)(()=>{let e=new Map;return le(f).forEach(t=>{e.set(L(t),t)}),e},[f]),F=(0,Q.useMemo)(()=>{let e=new Map;return ce(f).forEach(t=>{e.set(L(t),t)}),e},[f]),fe=(0,Q.useMemo)(()=>{let e=new Map;return ae(f).forEach(t=>{e.set(L(t),t)}),e},[f]),I=(0,Q.useCallback)((e,t=``)=>{let n=(()=>{switch(e){case`allow`:return P;case`deny`:return F;case`ask`:return fe;case`workspace`:case`recent`:return new Map}})(),i=[];e!==`workspace`&&e!==`recent`&&!t&&i.push({label:`Add a new rule${r.ellipsis}`,value:`add-new-rule`});let a=Array.from(n.keys()).sort((e,t)=>{let r=n.get(e),i=n.get(t);if(r&&i){let e=R(r.ruleValue).toLowerCase(),t=R(i.ruleValue).toLowerCase();return e.localeCompare(t)}return 0}),o=t.toLowerCase();for(let e of a){let r=n.get(e);if(r){let n=R(r.ruleValue);if(t&&!n.toLowerCase().includes(o))continue;i.push({label:n,value:e})}}return{options:i,rulesByKey:n}},[P,F,fe]),z=ve(),B=!v&&!S&&!w&&!E&&!O,{query:pe,setQuery:V,cursorOffset:H}=Ce({isActive:B&&A,onExit:()=>{j(!1)}}),me=(0,Q.useCallback)(e=>{B&&(A||e.ctrl||e.meta||(e.key===`/`?(e.preventDefault(),j(!0),V(``)):e.key.length===1&&e.key!==`j`&&e.key!==`k`&&e.key!==`m`&&e.key!==`i`&&e.key!==`r`&&e.key!==` `&&(e.preventDefault(),j(!0),V(e.key))))},[B,A,V]),he=(0,Q.useCallback)((e,t)=>{let{rulesByKey:n}=I(t);if(e===`add-new-rule`){C(t);return}else{b(n.get(e));return}},[I]),ge=(0,Q.useCallback)(()=>{C(null)},[]),_e=(0,Q.useCallback)((e,t)=>{T({ruleValue:e,ruleBehavior:t}),C(null)},[]),ye=(0,Q.useCallback)((e,t)=>{T(null);for(let t of e)d(e=>[...e,`Added ${t.ruleBehavior} rule ${y.bold(R(t.ruleValue))}`]);if(t&&t.length>0)for(let e of t){let t=e.shadowType===`deny`?`blocked`:`shadowed`;d(n=>[...n,y.yellow(`${r.warning} Warning: ${R(e.rule.ruleValue)} is ${t}`),y.dim(` ${e.reason}`),y.dim(` Fix: ${e.fix}`)])}},[]),be=(0,Q.useCallback)(()=>{T(null)},[]),Se=(0,Q.useCallback)(()=>D(!0),[]),we=(0,Q.useCallback)(e=>k(e),[]),Te=(0,Q.useCallback)(()=>{let t=g.current,r=e=>Array.from(e).map(e=>t.denials[e]).filter(e=>e!==void 0),i=r(t.retry);if(i.length>0){let t=i.map(e=>e.display);n?.(t),e(void 0,{shouldQuery:!0,metaMessages:[`Permission granted for: ${t.join(`, `)}. You may now retry ${t.length===1?`this command`:`these commands`} if you would like.`]});return}let a=r(t.approved);a.length>0||u.length>0?e([...a.length>0?[`Approved ${a.map(e=>y.bold(e.display)).join(`, `)}`]:[],...u].join(`
3
- `)):e(`Permissions dialog dismissed`,{display:`system`})},[u,e,n]);o(`confirm:no`,Te,{context:`Settings`,isActive:B&&!A});let Ee=()=>{if(!v)return;let{options:e}=I(v.ruleBehavior),t=L(v),n=e.filter(e=>e.value!==`add-new-rule`).map(e=>e.value),r=n.indexOf(t),i;r!==-1&&(r<n.length-1?i=n[r+1]:r>0&&(i=n[r-1])),ne(i),re({rule:v,initialContext:f,setToolPermissionContext(e){p(t=>({...t,toolPermissionContext:e}))}}),d(e=>[...e,`Deleted ${v.ruleBehavior} rule ${y.bold(R(v.ruleValue))}`]),b(void 0)};if(v)return(0,$.jsx)(qe,{rule:v,onDelete:Ee,onCancel:()=>b(void 0)});if(S&&S!==`workspace`&&S!==`recent`)return(0,$.jsx)(Pe,{onCancel:ge,onSubmit:_e,ruleBehavior:S});if(w)return(0,$.jsx)(je,{onAddRules:ye,onCancel:be,ruleValues:[w.ruleValue],ruleBehavior:w.ruleBehavior,initialContext:f,setToolPermissionContext:e=>{p(t=>({...t,toolPermissionContext:e}))}});if(E)return(0,$.jsx)(xe,{onAddDirectory:(e,t)=>{let n={type:`addDirectories`,directories:[e],destination:t?`localSettings`:`session`},r=se(f,n);p(e=>({...e,toolPermissionContext:r})),t&&ie(n),d(n=>[...n,`Added directory ${y.bold(e)} to workspace${t?` and saved to local settings`:` for this session`}`]),D(!1)},onCancel:()=>D(!1),permissionContext:f});if(O)return(0,$.jsx)(ze,{directoryPath:O,onRemove:()=>{d(e=>[...e,`Removed directory ${y.bold(O)} from workspace`]),k(null)},onCancel:()=>k(null),permissionContext:f,setPermissionContext:e=>{p(t=>({...t,toolPermissionContext:e}))}});let U={searchQuery:pe,isSearchMode:A,isFocused:h,onCancel:Te,lastFocusedRuleKey:x,cursorOffset:H,getRulesOptions:I,handleToolSelect:he,onHeaderFocusChange:N};return(0,$.jsx)(i,{flexDirection:`column`,onKeyDown:me,children:(0,$.jsxs)(te,{color:`permission`,children:[(0,$.jsxs)(_,{title:`Permissions:`,color:`permission`,defaultTab:l,hidden:!!v||!!S||!!w||E||!!O,initialHeaderFocused:!c,navFromContent:!A,children:[(0,$.jsx)(m,{id:`recent`,title:`Recently denied`,children:(0,$.jsx)(Le,{onHeaderFocusChange:N,onStateChange:ee})}),(0,$.jsx)(m,{id:`allow`,title:`Allow`,children:(0,$.jsx)(Ye,{tab:`allow`,...U})}),(0,$.jsx)(m,{id:`ask`,title:`Ask`,children:(0,$.jsx)(Ye,{tab:`ask`,...U})}),(0,$.jsx)(m,{id:`deny`,title:`Deny`,children:(0,$.jsx)(Ye,{tab:`deny`,...U})}),(0,$.jsx)(m,{id:`workspace`,title:`Workspace`,children:(0,$.jsxs)(i,{flexDirection:`column`,children:[(0,$.jsx)(a,{children:`Work Mate can read files in the workspace, and make edits when auto-accept edits is on.`}),(0,$.jsx)(He,{onExit:e,toolPermissionContext:f,onRequestAddDirectory:Se,onRequestRemoveDirectory:we,onHeaderFocusChange:N})]})})]}),(0,$.jsx)(i,{marginTop:1,paddingLeft:1,children:(0,$.jsx)(a,{dimColor:!0,children:z.pending?(0,$.jsxs)($.Fragment,{children:[`Press `,z.keyName,` again to exit`]}):de?(0,$.jsx)($.Fragment,{children:`←/→ tab switch · ↓ return · Esc cancel`}):A?(0,$.jsx)($.Fragment,{children:`Type to filter · Enter/↓ select · ↑ tabs · Esc clear`}):c&&l===`recent`?(0,$.jsx)($.Fragment,{children:`Enter approve · r retry · ↑↓ navigate · ←/→ switch · Esc cancel`}):(0,$.jsx)($.Fragment,{children:`↑↓ navigate · Enter select · Type to search · ←/→ switch · Esc cancel`})})})]})})}var Q,$,Ze=e((()=>{l(),n(),u(),Q=t(u(),1),k(),C(),M(),ye(),we(),v(),_e(),U(),z(),T(),I(),Se(),Ne(),be(),ke(),Ie(),Re(),Ve(),We(),$=x()})),Qe,$e;e((()=>{Ze(),fe(),Qe=x(),$e=async(e,t)=>(0,Qe.jsx)(Xe,{onExit:e,onRetryDenials:e=>{t.setMessages(t=>[...t,A(e)])}})}))();export{$e as call};
@@ -1 +0,0 @@
1
- import{i as e,r as t,t as n}from"./permissions-Cn_6f8CB.js";e();export{n as EXTERNAL_PERMISSION_MODES,t as PERMISSION_MODES};
@@ -1 +0,0 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";var t,n,r,i=e((()=>{t=[`acceptEdits`,`bypassPermissions`,`default`,`dontAsk`,`plan`],n=[...t,`auto`],r=n}));export{i,n,r,t};
@@ -1 +0,0 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{fi as t}from"./src-CDCSSo0U2.js";import{t as n}from"./jsx-runtime-Bb4Xn-E0.js";import{n as r,t as i}from"./PluginSettings-CGqEzejq.js";async function a(e,t,n){return(0,o.jsx)(i,{onComplete:e,args:n})}var o;e((()=>{t(),r(),o=n()}))();export{a as call};
@@ -1 +0,0 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{Es as t,Gs as n,Hs as r,Ls as i,Os as a,Vs as o,aO as s,js as c,sO as l}from"./loadAgentsDir-D206qwP3.js";import{F as u,a as d,l as f,z as p}from"./debug-BrXObCdR.js";import{St as m,Tt as h}from"./settings-BovzmwMP.js";import{g,x as _}from"./config-DmomySWC.js";import{o as v,s as y}from"./log-BMCygSzM.js";import{f as b,s as x}from"./pluginOperations-EN3EKLux.js";function S(e){return O=e,k!==null&&k.length>0&&(e(k),k=null),()=>{O=null}}async function C(){let e=await r(),t=i(),n=new Set;for(let[r,i]of Object.entries(e)){let e=t[r]?.autoUpdate;(e===void 0?h(r,i):e)&&n.add(r.toLowerCase())}return n}async function w(e,t){let n=!1;for(let{scope:r}of t)try{let t=await b(e,r);t.success&&!t.alreadyUpToDate?(n=!0,f(`Plugin autoupdate: updated ${e} from ${t.oldVersion} to ${t.newVersion}`)):t.alreadyUpToDate||f(`Plugin autoupdate: failed to update ${e}: ${t.message}`,{level:`warn`})}catch(t){f(`Plugin autoupdate: error updating ${e}: ${u(t)}`,{level:`warn`})}return n?e:null}async function T(e){let t=c(),n=Object.keys(t.plugins);return n.length===0?[]:(await Promise.allSettled(n.map(async n=>{let{marketplace:r}=l(n);if(!r||!e.has(r.toLowerCase()))return null;let i=t.plugins[n];if(!i||i.length===0)return null;let o=i.filter(a);return o.length===0?null:w(n,o)}))).filter(e=>e.status===`fulfilled`&&e.value!==null).map(e=>e.value)}async function E(e){return T(e)}function D(){(async()=>{if(_()){f(`Plugin autoupdate: skipped (auto-updater disabled)`);return}try{let e=await C();if(e.size===0)return;let t=(await Promise.allSettled(Array.from(e).map(async e=>{try{await n(e,void 0,{disableCredentialHelper:!0})}catch(t){f(`Plugin autoupdate: failed to refresh marketplace ${e}: ${u(t)}`,{level:`warn`})}}))).filter(e=>e.status===`rejected`);t.length>0&&f(`Plugin autoupdate: ${t.length} marketplace refresh(es) failed`,{level:`warn`}),f(`Plugin autoupdate: checking installed plugins`);let r=await E(e);r.length>0&&(O?O(r):k=r)}catch(e){y(e)}})()}var O,k,A=e((()=>{x(),g(),d(),p(),v(),t(),o(),s(),m(),O=null,k=null}));export{T as i,A as n,S as r,D as t};
@@ -1 +0,0 @@
1
- import{n as e,t}from"./figures-5ThXQEtq.js";import{Ts as n,aO as r,cC as i,hy as a,my as o,oC as s,py as c,sO as l,ws as u}from"./loadAgentsDir-D206qwP3.js";import{F as d,z as f}from"./debug-BrXObCdR.js";import{n as p,o as m}from"./process-gEbdy6uY.js";import{o as h,s as g}from"./log-BMCygSzM.js";import{n as _,r as v}from"./analytics-BotDBGh0.js";import{a as y,c as b,d as x,f as S,i as C,r as w,s as T}from"./pluginOperations-EN3EKLux.js";e(),f(),i(),h(),n(),r(),p(),a(),_(),T();function E(e,n,r){g(e);let i=r?`${n} plugin "${r}"`:n===`disable-all`?`disable all plugins`:`${n} plugins`;console.error(`${t.cross} Failed to ${i}: ${d(e)}`);let a=r?(()=>{let{name:e,marketplace:t}=l(r);return{_PROTO_plugin_name:e,...t&&{_PROTO_marketplace_name:t},...c(e,t,u())}})():{};v(`tengu_plugin_command_failed`,{command:n,error_category:o(e),...a}),process.exit(1)}async function D(e,n=`user`){try{console.log(`Installing plugin "${e}"...`);let r=await b(e,n);if(!r.success)throw Error(r.message);console.log(`${t.tick} ${r.message}`);let{name:i,marketplace:a}=l(r.pluginId||e);v(`tengu_plugin_installed_cli`,{_PROTO_plugin_name:i,...a&&{_PROTO_marketplace_name:a},scope:r.scope||n,install_source:`cli-explicit`,...c(i,a,u())}),process.exit(0)}catch(t){E(t,`install`,e)}}async function O(e,n=`user`,r=!1){try{let i=await x(e,n,!r);if(!i.success)throw Error(i.message);console.log(`${t.tick} ${i.message}`);let{name:a,marketplace:o}=l(i.pluginId||e);v(`tengu_plugin_uninstalled_cli`,{_PROTO_plugin_name:a,...o&&{_PROTO_marketplace_name:o},scope:i.scope||n,...c(a,o,u())}),process.exit(0)}catch(t){E(t,`uninstall`,e)}}async function k(e,n){try{let r=await y(e,n);if(!r.success)throw Error(r.message);console.log(`${t.tick} ${r.message}`);let{name:i,marketplace:a}=l(r.pluginId||e);v(`tengu_plugin_enabled_cli`,{_PROTO_plugin_name:i,...a&&{_PROTO_marketplace_name:a},scope:r.scope,...c(i,a,u())}),process.exit(0)}catch(t){E(t,`enable`,e)}}async function A(e,n){try{let r=await C(e,n);if(!r.success)throw Error(r.message);console.log(`${t.tick} ${r.message}`);let{name:i,marketplace:a}=l(r.pluginId||e);v(`tengu_plugin_disabled_cli`,{_PROTO_plugin_name:i,...a&&{_PROTO_marketplace_name:a},scope:r.scope,...c(i,a,u())}),process.exit(0)}catch(t){E(t,`disable`,e)}}async function j(){try{let e=await w();if(!e.success)throw Error(e.message);console.log(`${t.tick} ${e.message}`),v(`tengu_plugin_disabled_all_cli`,{}),process.exit(0)}catch(e){E(e,`disable-all`)}}async function M(e,n){try{m(`Checking for updates for plugin "${e}" at ${n} scope…\n`);let r=await S(e,n);if(!r.success)throw Error(r.message);if(m(`${t.tick} ${r.message}\n`),!r.alreadyUpToDate){let{name:t,marketplace:n}=l(r.pluginId||e);v(`tengu_plugin_updated_cli`,{_PROTO_plugin_name:t,...n&&{_PROTO_marketplace_name:n},old_version:r.oldVersion||`unknown`,new_version:r.newVersion||`unknown`,...c(t,n,u())})}await s(0)}catch(t){E(t,`update`,e)}}export{O as a,D as i,A as n,M as o,k as r,j as t};
@@ -1 +0,0 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{a as t,o as n}from"./isObject-C6qM3WEW.js";import{Br as r,Ci as i,Fi as a,Hr as o,Kr as s,Mi as ee,Ni as te,Pi as ne,Rr as c,Si as re,Ur as l,Vr as u,qr as ie,zr as ae}from"./state-ix0xIunV.js";import{GD as oe,KD as se,OO as ce,_D as le,gD as d,kO as ue,vO as de,yO as fe}from"./loadAgentsDir-D206qwP3.js";import{C as f,S as p,a as m,d as h,l as g,p as _,w as v}from"./debug-BrXObCdR.js";import{An as y,Dn as b,En as x,Jn as S,On as C,Yn as w,jn as T,kn as E}from"./settings-BovzmwMP.js";import{R as D,z as O}from"./config-DmomySWC.js";import{o as k,s as A}from"./log-BMCygSzM.js";import{join as j}from"path";import{randomBytes as M}from"crypto";import{readFile as N,rename as P,unlink as F,writeFile as I}from"fs/promises";function L(e){return te(e)||i(e)||!!(R&&e&&e[R])}var R,z=e((()=>{n(),re(),ee(),R=t?t.isConcatSpreadable:void 0}));function B(e,t,n,r,i){var a=-1,o=e.length;for(n||(n=L),i||(i=[]);++a<o;){var s=e[a];t>0&&n(s)?t>1?B(s,t-1,n,r,i):ne(i,s):r||(i[i.length]=s)}return i}var V=e((()=>{a(),z()}));function pe(e){return e!=null&&e.length?B(e,1):[]}var me=e((()=>{V()}));function he(e){return b(E(e,void 0,pe),e+``)}var ge=e((()=>{me(),C(),x()}));function _e(e,t){return t.length<2?e:c(e,oe(t,0,-1))}var ve=e((()=>{ae(),se()}));function ye(e,t){t=o(t,e);var n=-1,r=t.length;if(!r)return!0;for(;++n<r;){var i=u(t[n]);if(i===`__proto__`&&!H.call(e,`__proto__`)||(i===`constructor`||i===`prototype`)&&n<r-1)return!1}var a=_e(e,t);return a==null||delete a[u(fe(t))]}var H,be=e((()=>{l(),de(),ve(),r(),H=Object.prototype.hasOwnProperty}));function xe(e){return T(e)?void 0:e}var Se=e((()=>{y()})),U,W,G,K,Ce=e((()=>{ie(),ue(),be(),l(),w(),Se(),ge(),O(),U=1,W=2,G=4,K=he(function(e,t){var n={};if(e==null)return n;var r=!1;t=s(t,function(t){return t=o(t,e),r||(r=t.length>1),t}),S(e,D(e),n),r&&(n=ce(n,U|W|G,xe));for(var i=t.length;i--;)ye(n,t[i]);return n})}));function q(){return j(d(),Z)}function we(e){let t=f(e);if(typeof t!=`object`||!t||!(`plugins`in t)||typeof t.plugins!=`object`||t.plugins===null)return{};let n=t.plugins,r={};for(let[e,t]of Object.entries(n))if(t&&typeof t==`object`&&`flaggedAt`in t&&typeof t.flaggedAt==`string`){let n={flaggedAt:t.flaggedAt};`seenAt`in t&&typeof t.seenAt==`string`&&(n.seenAt=t.seenAt),r[e]=n}return r}async function J(){try{return we(await N(q(),{encoding:`utf-8`}))}catch{return{}}}async function Y(e){let t=q(),n=`${t}.${M(8).toString(`hex`)}.tmp`;try{await h().mkdir(d()),await I(n,v({plugins:e},null,2),{encoding:`utf-8`,mode:384}),await P(n,t),$=e}catch(e){A(e);try{await F(n)}catch{}}}async function Te(){let e=await J(),t=Date.now(),n=!1;for(let[r,i]of Object.entries(e))i.seenAt&&t-new Date(i.seenAt).getTime()>=Q&&(delete e[r],n=!0);$=e,n&&await Y(e)}function Ee(){return $??{}}async function X(e){$===null&&($=await J()),await Y({...$,[e]:{flaggedAt:new Date().toISOString()}}),g(`Flagged plugin: ${e}`)}async function De(e){$===null&&($=await J());let t=new Date().toISOString(),n=!1,r={...$};for(let i of e){let e=r[i];e&&!e.seenAt&&(r[i]={...e,seenAt:t},n=!0)}n&&await Y(r)}async function Oe(e){if($===null&&($=await J()),!(e in $))return;let{[e]:t,...n}=$;$=n,await Y(n)}var Z,Q,$,ke=e((()=>{m(),_(),k(),p(),le(),Z=`flagged-plugins.json`,Q=2880*60*1e3,$=null}));export{De as a,K as c,Te as i,Ee as n,Oe as o,ke as r,Ce as s,X as t};
@@ -1,2 +0,0 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{en as t,nt as n}from"./state-ix0xIunV.js";import{Bs as r,Cs as i,Es as a,Hs as o,Ms as s,Ns as c,Ps as l,Rs as u,Ss as d,Vs as f,_D as p,_s as m,aO as h,am as g,bs as _,cO as v,dc as y,ds as b,ev as ee,fO as x,fs as S,hs as C,iO as w,js as T,lc as E,ls as te,nO as D,nv as ne,om as re,pD as O,pO as k,ps as A,rO as j,sO as M,ss as ie,uc as ae,us as N,vs as oe}from"./loadAgentsDir-D206qwP3.js";import{V as P,W as se,d as ce,p as F,z as I}from"./debug-BrXObCdR.js";import{c as L,g as R,y as z}from"./settings-BovzmwMP.js";import{o as B,s as V}from"./log-BMCygSzM.js";import{l as H,o as U}from"./stringUtils-DGLPkqJ4.js";import{n as W,t as G}from"./pluginStartupCheck-BY73BMT2.js";import{dirname as le,join as K}from"path";function q(e){if(!Q.includes(e))throw Error(`Invalid scope "${e}". Must be one of: ${Q.join(`, `)}`)}function ue(e){return Q.includes(e)}function J(e){return e===`project`||e===`local`?n():void 0}function de(e){return L(`projectSettings`)?.enabledPlugins?.[e]===!0}function fe(e){let t=e.includes(`@`);for(let n of[`local`,`project`,`user`]){let r=L(v(n))?.enabledPlugins;if(r){for(let i of Object.keys(r))if(t?i===e:i.startsWith(`${e}@`))return{pluginId:i,scope:n}}}return null}function pe(e,t){let{name:n,marketplace:r}=M(e);return t.find(t=>t.name===e||t.name===n?!0:r&&t.source?t.name===n&&t.source.includes(`@${r}`):!1)}function me(e){let{name:t}=M(e),n=s();if(n.plugins[e]?.length)return{pluginId:e,pluginName:t};let r=Object.keys(n.plugins).find(e=>{let{name:r}=M(e);return r===t&&(n.plugins[e]?.length??0)>0});return r?{pluginId:r,pluginName:t}:null}function Y(e){let t=s().plugins[e];if(!t||t.length===0)return{scope:`user`};let r=n(),i=t.find(e=>e.scope===`local`&&e.projectPath===r);if(i)return{scope:i.scope,projectPath:i.projectPath};let a=t.find(e=>e.scope===`project`&&e.projectPath===r);if(a)return{scope:a.scope,projectPath:a.projectPath};let o=t.find(e=>e.scope===`user`);return o?{scope:o.scope}:{scope:t[0].scope,projectPath:t[0].projectPath}}async function he(e,t=`user`){q(t);let{name:n,marketplace:i}=M(e),a,s,c;if(i){let t=await r(e);t&&(a=t.entry,s=i,c=t.marketplaceInstallLocation)}else{let e=await o();for(let[t,r]of Object.entries(e))try{let e=(await u(t)).plugins.find(e=>e.name===n);if(e){a=e,s=t,c=r.installLocation;break}}catch(e){V(se(e))}}if(!a||!s)return{success:!1,message:`Plugin "${n}" not found in ${i?`marketplace "${i}"`:`any configured marketplace`}`};let l=a,d=`${l.name}@${s}`,f=await _({pluginId:d,entry:l,scope:t,marketplaceInstallLocation:c});if(!f.ok){let e=f;switch(e.reason){case`local-source-no-location`:return{success:!1,message:`Cannot install local plugin "${e.pluginName}" without marketplace install location`};case`settings-write-failed`:return{success:!1,message:`Failed to update settings: ${e.message}`};case`resolution-failed`:return{success:!1,message:m(e.resolution)};case`blocked-by-policy`:return{success:!1,message:`Plugin "${e.pluginName}" is blocked by your organization's policy and cannot be installed`};case`dependency-blocked-by-policy`:return{success:!1,message:`Plugin "${e.pluginName}" depends on "${e.blockedDependency}", which is blocked by your organization's policy`}}}return{success:!0,message:`Successfully installed plugin: ${d} (scope: ${t})${f.depNote}`,pluginId:d,pluginName:l.name,scope:t}}async function ge(e,t=`user`,n=!0){q(t);let{enabled:r,disabled:i}=await A(),a=[...r,...i],o=pe(e,a),l=v(t),u=L(l),d,f;if(o)d=Object.keys(u?.enabledPlugins??{}).find(t=>t===e||t===o.name||t.startsWith(`${o.name}@`))??(e.includes(`@`)?e:o.name),f=o.name;else{let t=me(e);if(!t)return{success:!1,message:`Plugin "${e}" not found in installed plugins`};d=t.pluginId,f=t.pluginName}let p=J(t),m=s().plugins[d],h=m?.find(e=>e.scope===t&&e.projectPath===p);if(!h){let{scope:n}=Y(d);return n!==t&&m&&m.length>0?n===`project`?{success:!1,message:`Plugin "${e}" is enabled at project scope (.claude/settings.json, shared with your team). To disable just for you: claude plugin disable ${e} --scope local`}:{success:!1,message:`Plugin "${e}" is installed in ${n} scope, not ${t}. Use --scope ${n} to uninstall.`}:{success:!1,message:`Plugin "${e}" is not installed in ${t} scope. Use --scope to specify the correct scope.`}}let g=h.installPath,_={...u?.enabledPlugins};_[d]=void 0,z(l,{enabledPlugins:_}),E(),c(d,t,p);let b=s().plugins[d],x=!b||b.length===0;x&&g&&await y(g),x&&(ee(d),n&&await O(d));let S=D(d,a),C=j(S);return{success:!0,message:`Successfully uninstalled plugin: ${f} (scope: ${t})${C}`,pluginId:d,pluginName:f,scope:t,reverseDependents:S.length>0?S:void 0}}async function X(e,t,n){let r=t?`enable`:`disable`;if(k(e)){let{error:n}=z(`userSettings`,{enabledPlugins:{...L(`userSettings`)?.enabledPlugins,[e]:t}});if(n)return{success:!1,message:`Failed to ${r} built-in plugin: ${n.message}`};E();let{name:i}=M(e);return{success:!0,message:`Successfully ${r}d built-in plugin: ${i}`,pluginId:e,pluginName:i,scope:`user`}}n&&q(n);let i,a,o=fe(e);if(n)if(a=n,o)i=o.pluginId;else if(e.includes(`@`))i=e;else return{success:!1,message:`Plugin "${e}" not found in settings. Use plugin@marketplace format.`};else if(o)i=o.pluginId,a=o.scope;else if(e.includes(`@`))i=e,a=`user`;else return{success:!1,message:`Plugin "${e}" not found in any editable settings scope. Use plugin@marketplace format.`};if(t&&re(i))return{success:!1,message:`Plugin "${i}" is blocked by your organization's policy and cannot be enabled`};let s=v(a),c=L(s)?.enabledPlugins?.[i],l={user:0,project:1,local:2},u=n&&o&&l[n]>l[o.scope];if(n&&c===void 0&&o&&o.scope!==n&&!u)return{success:!1,message:`Plugin "${e}" is installed at ${o.scope} scope, not ${n}. Use --scope ${o.scope} or omit --scope to auto-detect.`};if(t===(n&&!u?c===!0:G().has(i)))return{success:!1,message:`Plugin "${e}" is already ${t?`enabled`:`disabled`}${n?` at ${n} scope`:``}`};let d;if(!t){let{enabled:e,disabled:t}=await A(),n=D(i,[...e,...t]);n.length>0&&(d=n)}let{error:f}=z(s,{enabledPlugins:{...L(s)?.enabledPlugins,[i]:t}});if(f)return{success:!1,message:`Failed to ${r} plugin: ${f.message}`};E();let{name:p}=M(i),m=j(d);return{success:!0,message:`Successfully ${r}d plugin: ${p} (scope: ${a})${m}`,pluginId:i,pluginName:p,scope:a,reverseDependents:d}}async function _e(e,t){return X(e,!0,t)}async function ve(e,t){return X(e,!1,t)}async function Z(){let e=G();if(e.size===0)return{success:!0,message:`No enabled plugins to disable`};let t=[],n=[];for(let[r]of e){let e=await X(r,!1);e.success?t.push(r):n.push(`${r}: ${e.message}`)}return n.length>0?{success:!1,message:`Disabled ${t.length} ${H(t.length,`plugin`)}, ${n.length} failed:\n${n.join(`
2
- `)}`}:{success:!0,message:`Disabled ${t.length} ${H(t.length,`plugin`)}`}}async function ye(e,t){let{name:n,marketplace:i}=M(e),a=i?`${n}@${i}`:e,o=await r(e);if(!o)return{success:!1,message:`Plugin "${n}" not found`,pluginId:a,scope:t};let{entry:s,marketplaceInstallLocation:c}=o,l=T().plugins[a];if(!l||l.length===0)return{success:!1,message:`Plugin "${n}" is not installed`,pluginId:a,scope:t};let u=J(t),d=l.find(e=>e.scope===t&&e.projectPath===u);return d?be({pluginId:a,pluginName:n,entry:s,marketplaceInstallLocation:c,installation:d,scope:t,projectPath:u}):{success:!1,message:`Plugin "${n}" is not installed at scope ${u?`${t} (${u})`:t}`,pluginId:a,scope:t}}async function be({pluginId:e,pluginName:t,entry:n,marketplaceInstallLocation:r,installation:i,scope:a,projectPath:o}){let s=ce(),c=i.version,u,f,p=!1,m;if(typeof n.source!=`string`){let t=await ie(n.source,{manifest:{name:n.name}});u=t.path,p=!0,m=t.gitCommitSha,f=await d(e,n.source,t.manifest,t.path,n.version,t.gitCommitSha)}else{let t;try{t=await s.stat(r)}catch(t){if(P(t))return{success:!1,message:`Marketplace directory not found at ${r}`,pluginId:e,scope:a};throw t}u=K(t.isDirectory()?r:le(r),n.source);try{await s.stat(u)}catch(t){if(P(t))return{success:!1,message:`Plugin source not found at ${u}`,pluginId:e,scope:a};throw t}let i,o=K(u,`.claude-plugin`,`plugin.json`);try{i=await C(o,n.name,n.source)}catch{}f=await d(e,n.source,i,u,n.version)}try{let r=N(e,f),s=b(e,f);if(i.version===f||i.installPath===r||i.installPath===s)return{success:!0,message:`${t} is already at the latest version (${f}).`,pluginId:e,newVersion:f,oldVersion:c,alreadyUpToDate:!0,scope:a};r=await te(u,e,f,n);let d=i.installPath;if(l(e,a,o,r,f,m),d&&d!==r){let e=T();Object.values(e.plugins).some(e=>e.some(e=>e.installPath===d))||await y(d)}let p=o?`${a} (${o})`:a;return{success:!0,message:`Plugin "${t}" updated from ${c||`unknown`} to ${f} for scope ${p}. Restart to apply changes.`,pluginId:e,newVersion:f,oldVersion:c,scope:a}}finally{p&&u!==N(e,f)&&await s.rm(u,{recursive:!0,force:!0})}}var Q,$,xe=e((()=>{t(),x(),I(),F(),B(),ae(),w(),a(),f(),p(),h(),oe(),S(),ne(),g(),W(),i(),R(),U(),Q=[`user`,`project`,`local`],$=[`user`,`project`,`local`,`managed`]}));export{_e as a,he as c,ge as d,ye as f,ve as i,ue as l,$ as n,Y as o,Z as r,xe as s,Q as t,de as u};
@@ -1 +0,0 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{Bs as t,Es as n,Vs as r,aO as i,cO as a,gs as o,lO as s,uO as c,vs as l,xs as u}from"./loadAgentsDir-D206qwP3.js";import{n as d,t as f}from"./cwd-CYmmnQVS.js";import{a as p,l as m}from"./debug-BrXObCdR.js";import{St as h,c as g,g as _,wt as v,y}from"./settings-BovzmwMP.js";import{o as b,s as x}from"./log-BMCygSzM.js";import{join as S}from"path";function C(){let e=new Map,t=s();for(let[n,r]of Object.entries(t))n.includes(`@`)&&(r===!0?e.set(n,`flag`):r===!1&&e.delete(n));for(let{scope:n,source:r}of[{scope:`managed`,source:`policySettings`},{scope:`user`,source:`userSettings`},{scope:`project`,source:`projectSettings`},{scope:`local`,source:`localSettings`},{scope:`flag`,source:`flagSettings`}]){let i=g(r);if(i?.enabledPlugins)for(let[a,o]of Object.entries(i.enabledPlugins))a.includes(`@`)&&(a in t&&t[a]!==o&&m(`Plugin ${a} from --add-dir (${t[a]}) overridden by ${r} (${o})`),o===!0?e.set(a,n):o===!1&&e.delete(a))}return m(`Found ${e.size} enabled plugins with scopes: ${Array.from(e.entries()).map(([e,t])=>`${e}(${t})`).join(`, `)}`),e}async function w(e,n,r=`user`){let i=r===`user`?void 0:f(),s=a(r),c=g(s),l={...c?.enabledPlugins},d=[],p=[];for(let a=0;a<e.length;a++){let s=e[a];if(s){n&&n(s,a+1,e.length);try{let e=await t(s);if(!e){p.push({name:s,error:`Plugin not found in any marketplace`});continue}let{entry:n,marketplaceInstallLocation:a}=e;v(n.source)?u({pluginId:s,installPath:S(a,n.source),version:n.version},r,i):await o(s,n,r,i),l[s]=!0,d.push(s)}catch(e){let t=e instanceof Error?e.message:String(e);p.push({name:s,error:t}),x(e)}}}return y(s,{...c,enabledPlugins:l}),{installed:d,failed:p}}var T=e((()=>{d(),p(),b(),_(),c(),n(),r(),i(),l(),h()}));export{T as n,w as r,C as t};
@@ -1 +0,0 @@
1
- import{n as e,t}from"./pluginStartupCheck-BY73BMT2.js";e();export{t as getPluginEditableScopes};
@@ -1 +0,0 @@
1
- import{Ua as e,Va as t,Ya as n}from"./loadAgentsDir-D206qwP3.js";t();export{e as isPolicyAllowed,n as waitForPolicyLimitsToLoad};
@@ -1 +0,0 @@
1
- import{E as e,T as t,n,r,t as i}from"./lazySchema-DcIJE_0i.js";r(),i();var a=2e3,o=6e5,s={poll_interval_ms_not_at_capacity:a,poll_interval_ms_at_capacity:o,non_exclusive_heartbeat_interval_ms:0,multisession_poll_interval_ms_not_at_capacity:a,multisession_poll_interval_ms_partial_capacity:a,multisession_poll_interval_ms_at_capacity:o,reclaim_older_than_ms:5e3,session_keepalive_interval_v2_ms:12e4},c={message:`must be 0 (disabled) or ≥100ms`},l=n(()=>e({poll_interval_ms_not_at_capacity:t().int().min(100),poll_interval_ms_at_capacity:t().int().refine(e=>e===0||e>=100,c),non_exclusive_heartbeat_interval_ms:t().int().min(0).default(0),multisession_poll_interval_ms_not_at_capacity:t().int().min(100).default(s.multisession_poll_interval_ms_not_at_capacity),multisession_poll_interval_ms_partial_capacity:t().int().min(100).default(s.multisession_poll_interval_ms_partial_capacity),multisession_poll_interval_ms_at_capacity:t().int().refine(e=>e===0||e>=100,c).default(s.multisession_poll_interval_ms_at_capacity),reclaim_older_than_ms:t().int().min(1).default(5e3),session_keepalive_interval_v2_ms:t().int().min(0).default(12e4)}).refine(e=>e.non_exclusive_heartbeat_interval_ms>0||e.poll_interval_ms_at_capacity>0,{message:`at-capacity liveness requires non_exclusive_heartbeat_interval_ms > 0 or poll_interval_ms_at_capacity > 0`}).refine(e=>e.non_exclusive_heartbeat_interval_ms>0||e.multisession_poll_interval_ms_at_capacity>0,{message:`at-capacity liveness requires non_exclusive_heartbeat_interval_ms > 0 or multisession_poll_interval_ms_at_capacity > 0`}));function u(){let e=s,t=l().safeParse(e);return t.success?t.data:s}export{s as n,u as t};
@@ -1 +0,0 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{i as t,n,t as r}from"./poorMode-DhzFKpPl.js";var i;e((()=>{r(),i=async(e,r)=>{let i=!n();return t(i),i?r.setAppState(e=>({...e,promptSuggestionEnabled:!1})):r.setAppState(e=>({...e,promptSuggestionEnabled:!0})),{type:`text`,value:`Poor mode ${i?`ON`:`OFF`} — ${i?`extract_memories and prompt_suggestion are disabled`:`extract_memories and prompt_suggestion are restored`}`}}}))();export{i as call};
@@ -1 +0,0 @@
1
- import{n as e,t}from"./poorMode-DhzFKpPl.js";t();export{e as isPoorModeActive};