claude-code-best 2.6.0 → 2.6.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (391) hide show
  1. package/dist/chunks/{AddWorkspaceDirectory-Cj5bvJgD.js → AddWorkspaceDirectory-BYyM_V0q.js} +1 -1
  2. package/dist/chunks/{App-2tgSv9lb.js → App-BboadKdn.js} +1 -1
  3. package/dist/chunks/{ApproveApiKey-DWa-XTLb.js → ApproveApiKey-BLp4742y.js} +1 -1
  4. package/dist/chunks/ApproveApiKey-DiEe4eui.js +1 -0
  5. package/dist/chunks/{AssistantSessionChooser-DF9eeJZS.js → AssistantSessionChooser-B88DM0Oq.js} +1 -1
  6. package/dist/chunks/{BackgroundTasksDialog-DXJdube9.js → BackgroundTasksDialog-ByraVuXh.js} +1 -1
  7. package/dist/chunks/{BypassPermissionsModeDialog-BOSW4Zdy.js → BypassPermissionsModeDialog-BDvmz12S.js} +1 -1
  8. package/dist/chunks/{ClaudeInChromeOnboarding-BW4XHmkw.js → ClaudeInChromeOnboarding-B6XNhFqq.js} +1 -1
  9. package/dist/chunks/ClaudeMdExternalIncludesDialog-B4ocUjev.js +1 -0
  10. package/dist/chunks/{ClaudeMdExternalIncludesDialog-Bz0JyaOG.js → ClaudeMdExternalIncludesDialog-BNhlq7_K.js} +1 -1
  11. package/dist/chunks/ConsoleOAuthFlow-BvaB9b0y.js +1 -0
  12. package/dist/chunks/{DesktopHandoff-CcsM_OAS.js → DesktopHandoff-S-w4bs5T.js} +1 -1
  13. package/dist/chunks/{DevChannelsDialog-DXRgY00D.js → DevChannelsDialog-BljR0X9X.js} +1 -1
  14. package/dist/chunks/{DiffDialog-PvNZfZby.js → DiffDialog-BhQ2QaLW.js} +1 -1
  15. package/dist/chunks/{Doctor-CE_jL9jC.js → Doctor-BXb0qv6n.js} +1 -1
  16. package/dist/chunks/Doctor-C5DYPEGl.js +1 -0
  17. package/dist/chunks/{ExitFlow-C4ybxKPn.js → ExitFlow-CSBDxw9H.js} +1 -1
  18. package/dist/chunks/{Feedback-B5rPGl_C.js → Feedback-DwHzc4UT.js} +1 -1
  19. package/dist/chunks/{Grove-CKVpREDU.js → Grove-DSXRnXKv.js} +1 -1
  20. package/dist/chunks/Grove-DnTo982-.js +1 -0
  21. package/dist/chunks/{HybridTransport-Byjvz-DL.js → HybridTransport-CuT3KI5e.js} +1 -1
  22. package/dist/chunks/{ITermBackend-Co9XpeS4.js → ITermBackend-mokGZVH_.js} +1 -1
  23. package/dist/chunks/{InvalidConfigDialog-CNsqbNU3.js → InvalidConfigDialog-Bi4RKYlk.js} +1 -1
  24. package/dist/chunks/{InvalidSettingsDialog-ClnZaN6b.js → InvalidSettingsDialog-0zKo4-so.js} +1 -1
  25. package/dist/chunks/{MCPConnectionManager-CDsa79pu.js → MCPConnectionManager-DYGoS1Ht.js} +1 -1
  26. package/dist/chunks/{McpParsingWarnings-DZkzoeZf.js → McpParsingWarnings-EzgsOoHw.js} +1 -1
  27. package/dist/chunks/{MessageSelector-CkeGQPNM.js → MessageSelector-DTmUuEKJ.js} +1 -1
  28. package/dist/chunks/{Messages-PfbzLYOU.js → Messages-DWiKTx5o.js} +2 -2
  29. package/dist/chunks/{Onboarding-BwoGQB4g.js → Onboarding-odmthwzz.js} +1 -1
  30. package/dist/chunks/{OverageCreditUpsell-Q5g2YjQw.js → OverageCreditUpsell-Cpk_5Lv0.js} +1 -1
  31. package/dist/chunks/{PluginSettings-B2ASJ0Rx.js → PluginSettings-eYcWehI8.js} +1 -1
  32. package/dist/chunks/{PromptInputFooterSuggestions-D4lMVCqj.js → PromptInputFooterSuggestions-DrrkNOuS.js} +1 -1
  33. package/dist/chunks/{PromptInputHelpMenu-BvLtS6an.js → PromptInputHelpMenu-DMsF4D6d.js} +1 -1
  34. package/dist/chunks/{QueryEngine-Av0G5fze.js → QueryEngine-C_KZts4y.js} +1 -1
  35. package/dist/chunks/REPL-C6YR0VKU.js +1 -0
  36. package/dist/chunks/{REPL-Dh8vzGmF.js → REPL-DzHz-LOY.js} +6 -6
  37. package/dist/chunks/{RemoteCallout-BV_hoz98.js → RemoteCallout-CnpCWRPk.js} +1 -1
  38. package/dist/chunks/{RemoteSessionManager-Cxoy1ud2.js → RemoteSessionManager-OWg_Yccq.js} +1 -1
  39. package/dist/chunks/{ResumeConversation-B3WuB8rs.js → ResumeConversation-BktSnsCm.js} +1 -1
  40. package/dist/chunks/{SSETransport-pIm26VJq.js → SSETransport-BpnapvlK.js} +1 -1
  41. package/dist/chunks/SearchExtraToolsTool-CqFD8vVS.js +1 -0
  42. package/dist/chunks/SentryErrorBoundary-BUirJRWU.js +1 -0
  43. package/dist/chunks/{SentryErrorBoundary-B6EWoJml.js → SentryErrorBoundary-C-NlfQZw.js} +1 -1
  44. package/dist/chunks/{Settings-CreAhCsb.js → Settings-vfFvcweR.js} +2 -2
  45. package/dist/chunks/{TeleportProgress-DPzGpyyM.js → TeleportProgress-CYXay2ZL.js} +1 -1
  46. package/dist/chunks/{TeleportRepoMismatchDialog-DqWQX6j8.js → TeleportRepoMismatchDialog-_zbZTvcJ.js} +1 -1
  47. package/dist/chunks/{TeleportResumeWrapper-DPSO0S49.js → TeleportResumeWrapper-DiHQeZIM.js} +1 -1
  48. package/dist/chunks/{ThemePicker-DueihHcy.js → ThemePicker-BRh027fA.js} +1 -1
  49. package/dist/chunks/{TmuxBackend-BNaZNAeP.js → TmuxBackend-BaX2U7iZ.js} +1 -1
  50. package/dist/chunks/{TrustDialog-CIzAlGn9.js → TrustDialog-CVbzrv6g.js} +1 -1
  51. package/dist/chunks/{ValidationErrorsList-1k1qbsRo.js → ValidationErrorsList-CdCUgfIl.js} +1 -1
  52. package/dist/chunks/{WelcomeV2-CR6TtXXM.js → WelcomeV2-DCXcYd2x.js} +1 -1
  53. package/dist/chunks/{WindowsTerminalBackend-C5SeTXqC.js → WindowsTerminalBackend-BE9NX5IH.js} +1 -1
  54. package/dist/chunks/{add-dir-DAMizKzF.js → add-dir-ldGd3Ppz.js} +1 -1
  55. package/dist/chunks/{agentDisplay-B9z7i8b_.js → agentDisplay-CVnAeURF.js} +1 -1
  56. package/dist/chunks/{agents-DCh_gEvJ.js → agents-C08NzRZx.js} +1 -1
  57. package/dist/chunks/{agents-D5u0p1UC.js → agents-DH5fmbVw.js} +1 -1
  58. package/dist/chunks/{ant-DRJq-cEg.js → ant-DJren1Aa.js} +1 -1
  59. package/dist/chunks/api-6tcwJlf_.js +1 -0
  60. package/dist/chunks/{api-B6URs6nc.js → api-CGOR_Xfl.js} +1 -1
  61. package/dist/chunks/{assistant-BRGDWkKB.js → assistant-BlzrMSkM.js} +1 -1
  62. package/dist/chunks/assistant-CwbhlCM-.js +1 -0
  63. package/dist/chunks/{assistant-tPxOUa-Z.js → assistant-aWkDcurV.js} +1 -1
  64. package/dist/chunks/{auth-CqURlg4d.js → auth-CSB2RDKF.js} +1 -1
  65. package/dist/chunks/auth-GxZhOvQ1.js +1 -0
  66. package/dist/chunks/{autoMode-DVt4K4I2.js → autoMode-CWvZs1jO.js} +1 -1
  67. package/dist/chunks/{autonomy-Ffv0QIyl.js → autonomy-BkVcSMCZ.js} +1 -1
  68. package/dist/chunks/{autonomy-BZzW8QJZ.js → autonomy-DK42aJYt.js} +1 -1
  69. package/dist/chunks/{autonomyPanel-MwuzDvv_.js → autonomyPanel-Cn4IhXgE.js} +1 -1
  70. package/dist/chunks/{backgroundHousekeeping-CYnAG60-.js → backgroundHousekeeping-BIZTAYho.js} +2 -2
  71. package/dist/chunks/backgroundHousekeeping-Csh58CxV.js +1 -0
  72. package/dist/chunks/{branch-DXefFdDE.js → branch-juox_fko.js} +1 -1
  73. package/dist/chunks/{bridge-qr4GQW_c.js → bridge-DudsCZkh.js} +2 -2
  74. package/dist/chunks/bridgeConfig-D4tpc568.js +1 -0
  75. package/dist/chunks/{bridgeConfig-CJ-KznTS.js → bridgeConfig-lRZfQqmA.js} +1 -1
  76. package/dist/chunks/bridgeEnabled-B8_c_Ppq.js +1 -0
  77. package/dist/chunks/{bridgeEnabled-5vsPrjuq.js → bridgeEnabled-D2IykaHE.js} +1 -1
  78. package/dist/chunks/{bridgeMain-BimZwc2P.js → bridgeMain-C5RDihlX.js} +6 -6
  79. package/dist/chunks/bridgeMain-D7_lg2iJ.js +1 -0
  80. package/dist/chunks/{bridgeMessaging-BiE0CTqq.js → bridgeMessaging-CqNURC4-.js} +1 -1
  81. package/dist/chunks/{btw-FpimqEqk.js → btw-DKlE3Dea.js} +1 -1
  82. package/dist/chunks/{buddy-BA3Cr067.js → buddy-DQYgHR63.js} +1 -1
  83. package/dist/chunks/{bypassPermissionsKillswitch-CSC9p8mO.js → bypassPermissionsKillswitch-Bof-UtM-.js} +1 -1
  84. package/dist/chunks/{caches-BUBkfP2Q.js → caches-B5QZDncQ.js} +2 -2
  85. package/dist/chunks/caches-dGk7xsDu.js +1 -0
  86. package/dist/chunks/{ccrClient-BOxUn9EJ.js → ccrClient-BaWg4E9-.js} +1 -1
  87. package/dist/chunks/changeDetector-DoLfg8a6.js +1 -0
  88. package/dist/chunks/{channelNotification-l3EXKDNB.js → channelNotification-B7A-9DIl.js} +1 -1
  89. package/dist/chunks/channelNotification-DDErroWn.js +1 -0
  90. package/dist/chunks/{chrome-BnKyWWQL.js → chrome-jMAks7-w.js} +1 -1
  91. package/dist/chunks/clear-OudnCGa7.js +1 -0
  92. package/dist/chunks/client-DxDmXXTh.js +1 -0
  93. package/dist/chunks/{color-D5MCzz9h.js → color-DG_R5-hl.js} +1 -1
  94. package/dist/chunks/commands-BWIOEBPs.js +1 -0
  95. package/dist/chunks/commitAttribution-BA4fcbHf.js +1 -0
  96. package/dist/chunks/{commitAttribution-BFshsh2H.js → commitAttribution-C22a3OCi.js} +1 -1
  97. package/dist/chunks/{compact-DWNaf1wR.js → compact-BWvnb4or.js} +1 -1
  98. package/dist/chunks/{companion-CyK_Dr1U.js → companion-Bkn2lSLj.js} +1 -1
  99. package/dist/chunks/{config-DNz6Eitr.js → config-BvpTbJ5p.js} +1 -1
  100. package/dist/chunks/{config-BdCuh6eA.js → config-D-dzD6n-.js} +1 -1
  101. package/dist/chunks/{context-BOjdTj0i.js → context-DzNahdyP.js} +1 -1
  102. package/dist/chunks/context-noninteractive-CM1-lUSe.js +1 -0
  103. package/dist/chunks/{context-noninteractive-k2ibficU.js → context-noninteractive-yiyJriiw.js} +1 -1
  104. package/dist/chunks/{conversation-Ci8O_eZ-.js → conversation-DKlz47xf.js} +1 -1
  105. package/dist/chunks/conversation-cUxdb8MN.js +1 -0
  106. package/dist/chunks/{copy-B0VUJ2rH.js → copy-9k9JPRqW.js} +1 -1
  107. package/dist/chunks/{createSSHSession-DqmkCS_k.js → createSSHSession-BZf-Loo5.js} +1 -1
  108. package/dist/chunks/createSession-BuJcoBAj.js +1 -0
  109. package/dist/chunks/{createSession-CJEsHz58.js → createSession-kiTHYXSL.js} +1 -1
  110. package/dist/chunks/{cronJitterConfig-BzPaa52I.js → cronJitterConfig-CYP7yrQu.js} +1 -1
  111. package/dist/chunks/{crossProjectResume-tWsqBUHc.js → crossProjectResume-BJisir9Z.js} +1 -1
  112. package/dist/chunks/{datadog-Bd1s_VFj.js → datadog-Bg-zL-i7.js} +1 -1
  113. package/dist/chunks/datadog-CVeFkaQu.js +1 -0
  114. package/dist/chunks/{desktop-BDowrzvG.js → desktop-DpaStjc-.js} +1 -1
  115. package/dist/chunks/{diff-auU5sUOw.js → diff-N_VSBo3Z.js} +1 -1
  116. package/dist/chunks/{doctor-bKPp6AeL.js → doctor-CUWjbh1X.js} +1 -1
  117. package/dist/chunks/{effort-BQj2QnnA.js → effort-loH1TUvE.js} +3 -3
  118. package/dist/chunks/{entry-CUu6-QhT.js → entry-D58E-E6Y.js} +1 -1
  119. package/dist/chunks/envLessBridgeConfig-CT8sdmFu.js +1 -0
  120. package/dist/chunks/{envLessBridgeConfig-Ju4W58xf.js → envLessBridgeConfig-SPEr9oqO.js} +1 -1
  121. package/dist/chunks/{exit-DijkO8eo.js → exit-D-tuPpbx.js} +1 -1
  122. package/dist/chunks/{export-DA-bBZkX.js → export-BIZ_SPXJ.js} +1 -1
  123. package/dist/chunks/{exportRenderer-3y4tGdSB.js → exportRenderer-CWPSMaqM.js} +1 -1
  124. package/dist/chunks/{extra-usage-CS6VwKJt.js → extra-usage-CCMwIa85.js} +1 -1
  125. package/dist/chunks/{extra-usage-core-DOgT4u4i.js → extra-usage-core-BNW4VT7o.js} +1 -1
  126. package/dist/chunks/{extra-usage-noninteractive-DYnfiRlV.js → extra-usage-noninteractive-B_WjXO1E.js} +1 -1
  127. package/dist/chunks/extra-usage-rdJ7ecEb.js +1 -0
  128. package/dist/chunks/{extraUsage-CfxgfpX_.js → extraUsage-CNMMTNJi.js} +1 -1
  129. package/dist/chunks/extractMemories-BrvZVsmM.js +1 -0
  130. package/dist/chunks/{fast-CzRUJBTK.js → fast-CG1v3fRr.js} +1 -1
  131. package/dist/chunks/fast-CLKKsx2H.js +1 -0
  132. package/dist/chunks/{feedback-FoXtdHAV.js → feedback-CG4mS_-B.js} +1 -1
  133. package/dist/chunks/{firstPartyEventLogger-KIwaBY-E.js → firstPartyEventLogger-Y_jAnHoR.js} +1 -1
  134. package/dist/chunks/{flushGate-C2Icy43G.js → flushGate-COPcye5f.js} +1 -1
  135. package/dist/chunks/gates-CSHuXnUx.js +1 -0
  136. package/dist/chunks/{gates-CbQLZHtm.js → gates-CSKxLmMJ.js} +1 -1
  137. package/dist/chunks/{gemini-BrNJGX4k.js → gemini-B3uSLiNp.js} +1 -1
  138. package/dist/chunks/{generateRecap-B0fvSCjo.js → generateRecap-D7rG3jIm.js} +1 -1
  139. package/dist/chunks/{generateSessionName-DvRYa39O.js → generateSessionName-zbqanivg.js} +1 -1
  140. package/dist/chunks/{githubRepoPathMapping-Dut3d6nn.js → githubRepoPathMapping-B04nEUDG.js} +1 -1
  141. package/dist/chunks/{grok-Ftoheab3.js → grok-CDOpos8E.js} +1 -1
  142. package/dist/chunks/{growthbook-BynnuVTn.js → growthbook-C_EY78Sn.js} +1 -1
  143. package/dist/chunks/{heapdump-hQ_w0LPC.js → heapdump-CpmhJ55b.js} +1 -1
  144. package/dist/chunks/{help-DQsHHv6r.js → help-EHn2neTv.js} +1 -1
  145. package/dist/chunks/hooks-BFdX17Za.js +1 -0
  146. package/dist/chunks/{hooks-BhVDc8yb.js → hooks-BV6HqbU4.js} +1 -1
  147. package/dist/chunks/{hostAdapter-D1eWmmhu.js → hostAdapter-_SmFAVNf.js} +1 -1
  148. package/dist/chunks/{ide-CPmMXLL-.js → ide-DkN0KdTR.js} +1 -1
  149. package/dist/chunks/inboundAttachments-BVUunfAX.js +1 -0
  150. package/dist/chunks/{inboundAttachments-Bmf6vYsE.js → inboundAttachments-DnGQw7Pf.js} +1 -1
  151. package/dist/chunks/{initReplBridge-BiHXpDEY.js → initReplBridge-tPRGPBq7.js} +1 -1
  152. package/dist/chunks/{insights-CTlTyvjj.js → insights-Bs9kJDG6.js} +1 -1
  153. package/dist/chunks/{install-IPuD3Lq8.js → install-CFX_ph9z.js} +1 -1
  154. package/dist/chunks/{install-github-app-Bmu_sA9e.js → install-github-app-CvRjY1Wi.js} +1 -1
  155. package/dist/chunks/{install-slack-app-Rfl81Jqo.js → install-slack-app-DjhnVSe0.js} +1 -1
  156. package/dist/chunks/{instrumentation-DWwmOmr0.js → instrumentation-c5zlOWom.js} +3 -3
  157. package/dist/chunks/{job-BXEt0izn.js → job-3QwLq609.js} +1 -1
  158. package/dist/chunks/{keybindings-DRDgVvqz.js → keybindings-7mDm3UKD.js} +1 -1
  159. package/dist/chunks/{lang-D3ZHlfT6.js → lang-DyyjY20G.js} +1 -1
  160. package/dist/chunks/{language-DcSjogBx.js → language-CPRGmY8Q.js} +1 -1
  161. package/dist/chunks/language-Cf6bMI4N.js +1 -0
  162. package/dist/chunks/{launchAgentsPlatform-BPm_VMln.js → launchAgentsPlatform-CpsMsTqQ.js} +1 -1
  163. package/dist/chunks/{launchAutofixPr-D2qac07g.js → launchAutofixPr-D9h6YAZY.js} +1 -1
  164. package/dist/chunks/{launchLocalMemory-D_hBbXKE.js → launchLocalMemory-DlYQcEQJ.js} +1 -1
  165. package/dist/chunks/{launchLocalVault-CPzNWvQ9.js → launchLocalVault-CP0AyPjj.js} +1 -1
  166. package/dist/chunks/{launchMemoryStores-Djq2KhKb.js → launchMemoryStores-BHoDFkJ5.js} +1 -1
  167. package/dist/chunks/{launchOnboarding-Bh6E7vdc.js → launchOnboarding-CFTNXcnc.js} +1 -1
  168. package/dist/chunks/{launchSchedule-C988bQ-5.js → launchSchedule-5KQr6x_A.js} +1 -1
  169. package/dist/chunks/{launchSkillStore-DqrP6Gme.js → launchSkillStore-D0yGuE68.js} +1 -1
  170. package/dist/chunks/{launchTeleport-DFhybaq_.js → launchTeleport-DRKnXOwY.js} +1 -1
  171. package/dist/chunks/{launchVault-p_CSK4ZQ.js → launchVault-XA-zAswX.js} +1 -1
  172. package/dist/chunks/loadAgentsDir-DCyiY0MN.js +1 -0
  173. package/dist/chunks/{loadAgentsDir-Ci5mr0vm.js → loadAgentsDir-DI1a76pd.js} +700 -700
  174. package/dist/chunks/{loadPluginHooks-xYCEZ6t5.js → loadPluginHooks-C0Ei-0E2.js} +1 -1
  175. package/dist/chunks/{localSearch-Vpn6W5aY.js → localSearch-CDOJNc_E.js} +1 -1
  176. package/dist/chunks/localSearch-MBx7KzC2.js +1 -0
  177. package/dist/chunks/login-D8UKKaud.js +1 -0
  178. package/dist/chunks/{login-D9IWjvza.js → login-nwTOoyxv.js} +1 -1
  179. package/dist/chunks/{logoV2Utils-SAulcC5x.js → logoV2Utils-DDUoPClc.js} +1 -1
  180. package/dist/chunks/logout-B0BjqlGi.js +1 -0
  181. package/dist/chunks/{magicDocs-BfoeYhin.js → magicDocs-CmUlOWjI.js} +1 -1
  182. package/dist/chunks/{main-DhMlhVj3.js → main-CeG_nUsC.js} +15 -15
  183. package/dist/chunks/{mappers-uIrAj-Wd.js → mappers-CJ8IO1o1.js} +1 -1
  184. package/dist/chunks/{mcp-DlM0OC6R.js → mcp-CanCqnch.js} +1 -1
  185. package/dist/chunks/{mcp-COQap0SM.js → mcp-Dq0kxZFx.js} +2 -2
  186. package/dist/chunks/{mcp-CAYGNxCb.js → mcp-zbxZM9BP.js} +1 -1
  187. package/dist/chunks/{mcpServer-DXvS3v4x.js → mcpServer-DPHQVYdC.js} +1 -1
  188. package/dist/chunks/{mcpServer-1SnOWb8_.js → mcpServer-lIneUZ5p.js} +1 -1
  189. package/dist/chunks/{memory-XccPLQLt.js → memory-BcWBkKV8.js} +1 -1
  190. package/dist/chunks/{model-CbiDGGJU.js → model-DJLzVvcF.js} +1 -1
  191. package/dist/chunks/model-H3rtl6eR.js +1 -0
  192. package/dist/chunks/{onChangeAppState-Dp0JIXd8.js → onChangeAppState-Dxbl8fvk.js} +1 -1
  193. package/dist/chunks/{openai-6KcHd4Hw.js → openai-DkYK4THc.js} +1 -1
  194. package/dist/chunks/{overageCreditGrant-DYiB4sr-.js → overageCreditGrant-DLKadMYU.js} +1 -1
  195. package/dist/chunks/{passes-Cbc6T_Tj.js → passes-BIfuerjL.js} +1 -1
  196. package/dist/chunks/{paths-Q2255dD7.js → paths-BBvuDQl9.js} +2 -2
  197. package/dist/chunks/{permissions-BLzPHh_3.js → permissions-S2EvIRKj.js} +1 -1
  198. package/dist/chunks/{pipeTransport-D7NIp3aA.js → pipeTransport-DVoIA1uN.js} +1 -1
  199. package/dist/chunks/{plan-DloFVJK7.js → plan--lnWxB3Q.js} +1 -1
  200. package/dist/chunks/{plugin-XR9IBPMM.js → plugin-DWLyrLw4.js} +1 -1
  201. package/dist/chunks/{pluginAutoupdate-Cr9hP0zG.js → pluginAutoupdate-CGXIWBrb.js} +1 -1
  202. package/dist/chunks/{pluginBlocklist-CM9uP8CY.js → pluginBlocklist-DJrMdzT0.js} +1 -1
  203. package/dist/chunks/{pluginCliCommands-BQkrvES5.js → pluginCliCommands-C08q9dHk.js} +1 -1
  204. package/dist/chunks/{pluginFlagging-CJ1--2Kw.js → pluginFlagging-Dggxke70.js} +1 -1
  205. package/dist/chunks/{pluginOperations-B0rLuSvo.js → pluginOperations-CNCImIe8.js} +1 -1
  206. package/dist/chunks/{pluginStartupCheck-Bjdc8zhz.js → pluginStartupCheck-BW2fjg2P.js} +1 -1
  207. package/dist/chunks/pluginStartupCheck-DpxQPXJE.js +1 -0
  208. package/dist/chunks/{plugins-BgOP_8TX.js → plugins-DQ3CRWWO.js} +1 -1
  209. package/dist/chunks/policyLimits-BotYrS-v.js +1 -0
  210. package/dist/chunks/{pollConfig-DhptuhFw.js → pollConfig-DAQ-ives.js} +1 -1
  211. package/dist/chunks/{poor-DF0aqXDx.js → poor-DqfrQT61.js} +1 -1
  212. package/dist/chunks/poorMode-DEAe3hiK.js +1 -0
  213. package/dist/chunks/{poorMode-C5Frra4j.js → poorMode-DzYT47KW.js} +1 -1
  214. package/dist/chunks/{print-CPtR0KTa.js → print-GGVp62vj.js} +4 -4
  215. package/dist/chunks/{privacy-settings-e-7lc7Un.js → privacy-settings-agwqjYJo.js} +1 -1
  216. package/dist/chunks/{processBashCommand-D5dC6Mya.js → processBashCommand-DHHN8Ca4.js} +1 -1
  217. package/dist/chunks/{processSlashCommand-DHRUtZ-C.js → processSlashCommand-COtIO6Jy.js} +1 -1
  218. package/dist/chunks/prompt-CO160cIr.js +1 -0
  219. package/dist/chunks/{prompt-DEPUnJdB.js → prompt-CjFAtm3w.js} +1 -1
  220. package/dist/chunks/prompt-GY9hlRvI.js +1 -0
  221. package/dist/chunks/{promptEditor-Ci-h04-5.js → promptEditor-EgosPsy-.js} +1 -1
  222. package/dist/chunks/{protocolHandler-DhqM32qE.js → protocolHandler-mtPUT9U0.js} +1 -1
  223. package/dist/chunks/{rate-limit-options-B0l29Zx8.js → rate-limit-options-C6SFOHue.js} +1 -1
  224. package/dist/chunks/{rcDebugLog-BbPkkigY.js → rcDebugLog-CPKZCtR8.js} +1 -1
  225. package/dist/chunks/{referral-ByevBJrE.js → referral-DeDr9zAE.js} +1 -1
  226. package/dist/chunks/{refresh-B_CwwIRX.js → refresh-D7pdoY_X.js} +1 -1
  227. package/dist/chunks/{registerProtocol-DzhaQH02.js → registerProtocol-BZBH8Zgl.js} +1 -1
  228. package/dist/chunks/{registry-DkHA4cRu.js → registry-Dz6AbiYP.js} +1 -1
  229. package/dist/chunks/{release-notes-CZthYkei.js → release-notes-DiUNOrg9.js} +1 -1
  230. package/dist/chunks/{releaseNotes-CwKpIsyd.js → releaseNotes-CnhQit0y.js} +2 -2
  231. package/dist/chunks/{reload-plugins-DxWfXvrN.js → reload-plugins-Dx52GcaG.js} +1 -1
  232. package/dist/chunks/{remote-env-BiRLWIrh.js → remote-env-B67Oo3sI.js} +1 -1
  233. package/dist/chunks/{remoteBridgeCore-nz1fPY1U.js → remoteBridgeCore-BzSUgPbt.js} +1 -1
  234. package/dist/chunks/{remoteControlServer-FzLUxh2B.js → remoteControlServer-L8smP7Zu.js} +1 -1
  235. package/dist/chunks/{rename-DmGuyncE.js → rename-C4PauyTZ.js} +1 -1
  236. package/dist/chunks/{resume-7GeU7RMS.js → resume-CrSn26xq.js} +1 -1
  237. package/dist/chunks/{runtimeObserver-OgM9ZYxZ.js → runtimeObserver-YNy3mIb7.js} +1 -1
  238. package/dist/chunks/{runtimeObserver-Duod-ign.js → runtimeObserver-nAhH4Wca.js} +2 -2
  239. package/dist/chunks/sandbox-adapter-CzwHes1i.js +1 -0
  240. package/dist/chunks/{sandbox-toggle-Cc96R6Ox.js → sandbox-toggle-BYqbcI5d.js} +1 -1
  241. package/dist/chunks/searchExtraTools-CcpdCO6l.js +1 -0
  242. package/dist/chunks/{sentry-BUHYuYGj.js → sentry-BNVxoVLS.js} +1 -1
  243. package/dist/chunks/{session-DgLqm7ZI.js → session-BuEmHrqM.js} +1 -1
  244. package/dist/chunks/{sessionDiscovery-DgNea6qa.js → sessionDiscovery-Mcsfa0g-.js} +1 -1
  245. package/dist/chunks/sessionFileAccessHooks-qnNiGMnE.js +1 -0
  246. package/dist/chunks/{sessionMemory-_dmj8lcH.js → sessionMemory-CMahwDdW.js} +1 -1
  247. package/dist/chunks/sessionMemory-pFSn4HSN.js +1 -0
  248. package/dist/chunks/sessionMemoryUtils-Du5jUl7M.js +1 -0
  249. package/dist/chunks/{sessionObserver-CuWMVPlT.js → sessionObserver-DG2zQgfi.js} +1 -1
  250. package/dist/chunks/sessionObserver-Je868MC9.js +1 -0
  251. package/dist/chunks/sessionStorage-D3FhAADV.js +1 -0
  252. package/dist/chunks/{sessionTitle-DzkMzHer.js → sessionTitle-zUVSAHO7.js} +1 -1
  253. package/dist/chunks/{sessionTracing-DTjmc0EF.js → sessionTracing-DoRJ4nSa.js} +1 -1
  254. package/dist/chunks/{settingsSync-CfYDkakY.js → settingsSync-B9bz77E1.js} +1 -1
  255. package/dist/chunks/{setup-BKUG46jQ.js → setup-B1JbPepL.js} +1 -1
  256. package/dist/chunks/{setup-CmLngvpJ.js → setup-CCOLlRtP.js} +1 -1
  257. package/dist/chunks/{setup-TqJ7-Nxh.js → setup-DWkSjA49.js} +2 -2
  258. package/dist/chunks/{shadowedRuleDetection-DesT0yKM.js → shadowedRuleDetection-BBR3uEgx.js} +1 -1
  259. package/dist/chunks/{sideQuestion-BAq0YyKY.js → sideQuestion-DHW5rgKz.js} +1 -1
  260. package/dist/chunks/{sink-B3uP8Cf8.js → sink-DxDOsLa2.js} +1 -1
  261. package/dist/chunks/sink-cQOgsnw3.js +1 -0
  262. package/dist/chunks/{sinks-COcy5GnB.js → sinks-BrrTUxkC.js} +2 -2
  263. package/dist/chunks/sinks-Djiz_5-Z.js +1 -0
  264. package/dist/chunks/{skill-learning-DOIMPtWE.js → skill-learning-C0nOKZfg.js} +1 -1
  265. package/dist/chunks/{skillChangeDetector-CA_Tdx8N.js → skillChangeDetector-D8C-uQSQ.js} +1 -1
  266. package/dist/chunks/{skillGapStore-CWuw1dYh.js → skillGapStore-Czi5jKjJ.js} +1 -1
  267. package/dist/chunks/{skillGapStore-DpEoKhn-.js → skillGapStore-_YuJP5KI.js} +2 -2
  268. package/dist/chunks/{skillGenerator-9y3Q4YoO.js → skillGenerator-kbaRbpqJ.js} +2 -2
  269. package/dist/chunks/skillLearning-3KWrBczS.js +1 -0
  270. package/dist/chunks/skillLearning-DBbdGbk-.js +1 -0
  271. package/dist/chunks/{skillPanel-Dt24mZTZ.js → skillPanel-BxDvlPzd.js} +3 -3
  272. package/dist/chunks/{skillSearchPanel-gaXN64Fu.js → skillSearchPanel-D-MX6Qgt.js} +2 -2
  273. package/dist/chunks/{skills-Dx3dMHYk.js → skills-NpEgFkFZ.js} +1 -1
  274. package/dist/chunks/{sprites-5OAB-Ui2.js → sprites-DD4eIkN7.js} +1 -1
  275. package/dist/chunks/{stats-TUExo9iU.js → stats-xL3NHwhp.js} +1 -1
  276. package/dist/chunks/{status-Dghaz1my.js → status-B5E70xRv.js} +1 -1
  277. package/dist/chunks/{statusNoticeHelpers-DVZSSXeK.js → statusNoticeHelpers-DcssRhLw.js} +1 -1
  278. package/dist/chunks/{tag-ZcVkzFjz.js → tag-BELr-qIa.js} +1 -1
  279. package/dist/chunks/{tasks-DbB33ekt.js → tasks-CrdWcSt-.js} +1 -1
  280. package/dist/chunks/{teamHelpers-BmN9nKz-.js → teamHelpers--3ZyNDlv.js} +1 -1
  281. package/dist/chunks/teamHelpers-CUAiXng3.js +1 -0
  282. package/dist/chunks/teammateModeSnapshot-C6EWhR0X.js +1 -0
  283. package/dist/chunks/{teammateModeSnapshot-CPjJJDL1.js → teammateModeSnapshot-DOQMTKbQ.js} +1 -1
  284. package/dist/chunks/{teleport-JHgpwZIh.js → teleport-LXFOan9C.js} +1 -1
  285. package/dist/chunks/{templateJobs-Db630FZD.js → templateJobs-8IY2Cgig.js} +1 -1
  286. package/dist/chunks/{terminalSetup-ygKHrVKR.js → terminalSetup-C4psrmpb.js} +1 -1
  287. package/dist/chunks/{terminalSetup-DJqWE8fc.js → terminalSetup-Lyg4NbGA.js} +1 -1
  288. package/dist/chunks/{theme-MmfFhdTD.js → theme-B8GNnJ_q.js} +1 -1
  289. package/dist/chunks/{thinkback-CrNirB0V.js → thinkback-DPXwEK3B.js} +1 -1
  290. package/dist/chunks/thinkback-DZW3Mcx_.js +1 -0
  291. package/dist/chunks/{thinkback-play-CQ1s7oqg.js → thinkback-play-BMOE-ceh.js} +1 -1
  292. package/dist/chunks/{toolEventObserver-DBq2XBYY.js → toolEventObserver-D0TSHm01.js} +1 -1
  293. package/dist/chunks/{toolEventObserver-BqMplcIk.js → toolEventObserver-DzLd0MSn.js} +1 -1
  294. package/dist/chunks/toolPool-DVOfpjDz.js +1 -0
  295. package/dist/chunks/{toolPool-BkCtTKXz.js → toolPool-Dq-Vtvrj.js} +1 -1
  296. package/dist/chunks/{trustedDevice-DEuQUTbz.js → trustedDevice-1iTu4LEm.js} +1 -1
  297. package/dist/chunks/{trustedDevice-C9Zevohz.js → trustedDevice-BvYYXfd8.js} +1 -1
  298. package/dist/chunks/{ultrareviewCommand-DrlfRrXq.js → ultrareviewCommand-BTXAN2wP.js} +1 -1
  299. package/dist/chunks/undercover-C_44e3oN.js +1 -0
  300. package/dist/chunks/{undercover-DKn95mh9.js → undercover-DvvnEmsX.js} +1 -1
  301. package/dist/chunks/{updateCCB-CJ7dCUan.js → updateCCB-C-qfLi0j.js} +1 -1
  302. package/dist/chunks/upgrade-CGXa5Dwy.js +1 -0
  303. package/dist/chunks/{upgrade-Degqbu8S.js → upgrade-DTBZSxwv.js} +1 -1
  304. package/dist/chunks/{upload-pTZQCPLt.js → upload-BF8tf_Eo.js} +1 -1
  305. package/dist/chunks/{usage-DVQMUMcC.js → usage-BRYRRgNt.js} +1 -1
  306. package/dist/chunks/{usage-D96a7Cke.js → usage-DvSTXEYY.js} +1 -1
  307. package/dist/chunks/{useMainLoopModel-B7ch2o9K.js → useMainLoopModel-CwvuTRXn.js} +1 -1
  308. package/dist/chunks/{useManagePlugins-BfGzHMvO.js → useManagePlugins-GmnI9K53.js} +1 -1
  309. package/dist/chunks/{useMergedTools-TemEvCrX.js → useMergedTools-Dah5KDMi.js} +1 -1
  310. package/dist/chunks/{useSearchInput-B-V4kIa-.js → useSearchInput-BV_azHiA.js} +1 -1
  311. package/dist/chunks/{useSettingsErrors-B2JGz1s8.js → useSettingsErrors-C-j_Zt7g.js} +1 -1
  312. package/dist/chunks/{useVoice-BuwYDm2U.js → useVoice-DR69NLxp.js} +1 -1
  313. package/dist/chunks/{util-CeIKZmj9.js → util-BpyJ4Bom.js} +1 -1
  314. package/dist/chunks/utils-CrZcpypC.js +1 -0
  315. package/dist/chunks/{validatePlugin-BlVho93x.js → validatePlugin-vptAYuYu.js} +1 -1
  316. package/dist/chunks/{vim-DUZQCWUP.js → vim-DvOw8dfR.js} +1 -1
  317. package/dist/chunks/{voice-BkRIHZiM.js → voice-B3BZs53f.js} +1 -1
  318. package/dist/chunks/{voiceModeEnabled-CPQUE3PU.js → voiceModeEnabled-DA76xN1Q.js} +1 -1
  319. package/dist/chunks/voiceModeEnabled-DIveLYGb.js +1 -0
  320. package/dist/chunks/{voiceStreamSTT-Dr_wH1Kh.js → voiceStreamSTT-_w1VjIOs.js} +1 -1
  321. package/dist/chunks/voiceStreamSTT-hpzWd_zl.js +1 -0
  322. package/dist/chunks/{workerRegistry-CT7_kjvY.js → workerRegistry-2_MZVih1.js} +1 -1
  323. package/dist/chunks/worktree-CCuDwRmS.js +1 -0
  324. package/dist/chunks/{xml-DD_ldd3X.js → xml-Dx--sNE1.js} +1 -1
  325. package/dist/cli.js +1 -1
  326. package/package.json +1 -1
  327. package/dist/chunks/ApproveApiKey-SIUwkD8j.js +0 -1
  328. package/dist/chunks/ClaudeMdExternalIncludesDialog-B8oAAHSI.js +0 -1
  329. package/dist/chunks/ConsoleOAuthFlow-DYhmGSkx.js +0 -1
  330. package/dist/chunks/Doctor--B1HUENo.js +0 -1
  331. package/dist/chunks/Grove-C2YjB3zL.js +0 -1
  332. package/dist/chunks/REPL-DCwqua0C.js +0 -1
  333. package/dist/chunks/SearchExtraToolsTool-D70C-cmA.js +0 -1
  334. package/dist/chunks/SentryErrorBoundary-oJUBarGg.js +0 -1
  335. package/dist/chunks/api-Dz_3z1kl.js +0 -1
  336. package/dist/chunks/assistant-zVegFdAO.js +0 -1
  337. package/dist/chunks/auth-D4isgfuK.js +0 -1
  338. package/dist/chunks/backgroundHousekeeping-DUmxC6h0.js +0 -1
  339. package/dist/chunks/bridgeConfig-CNbOKpAg.js +0 -1
  340. package/dist/chunks/bridgeEnabled-BUJTCUHY.js +0 -1
  341. package/dist/chunks/bridgeMain-DYL4fl6A.js +0 -1
  342. package/dist/chunks/caches-CTfNpKhW.js +0 -1
  343. package/dist/chunks/changeDetector-Y9KV5LgG.js +0 -1
  344. package/dist/chunks/channelNotification-CC7Xb06W.js +0 -1
  345. package/dist/chunks/clear-OUVFUt8Z.js +0 -1
  346. package/dist/chunks/client-B47ZvTMo.js +0 -1
  347. package/dist/chunks/commands-FJGWgQsa.js +0 -1
  348. package/dist/chunks/commitAttribution-DSv9FggK.js +0 -1
  349. package/dist/chunks/context-noninteractive-Bd2HO-vU.js +0 -1
  350. package/dist/chunks/conversation-BP0phkOY.js +0 -1
  351. package/dist/chunks/createSession-B9MhWusY.js +0 -1
  352. package/dist/chunks/datadog-DJowkWhh.js +0 -1
  353. package/dist/chunks/envLessBridgeConfig-CixkwbRF.js +0 -1
  354. package/dist/chunks/extra-usage-DGHEQOrY.js +0 -1
  355. package/dist/chunks/extractMemories-jvjCvtpC.js +0 -1
  356. package/dist/chunks/fast-Bbtx_Bs1.js +0 -1
  357. package/dist/chunks/gates-DSI3vpwO.js +0 -1
  358. package/dist/chunks/hooks-BLLL4iPv.js +0 -1
  359. package/dist/chunks/inboundAttachments-D-p91z3w.js +0 -1
  360. package/dist/chunks/language-B_-BfBT4.js +0 -1
  361. package/dist/chunks/loadAgentsDir-vB1QEZ7H.js +0 -1
  362. package/dist/chunks/localSearch-DtVqtfvk.js +0 -1
  363. package/dist/chunks/login-D-N78G6r.js +0 -1
  364. package/dist/chunks/logout-CFggVS-9.js +0 -1
  365. package/dist/chunks/model-DdbcxKub.js +0 -1
  366. package/dist/chunks/pluginStartupCheck-Cu2ezD51.js +0 -1
  367. package/dist/chunks/policyLimits-CKy_gTEt.js +0 -1
  368. package/dist/chunks/poorMode-DJvjO2nW.js +0 -1
  369. package/dist/chunks/prompt-CQC-mh6u.js +0 -1
  370. package/dist/chunks/prompt-DawxLANl.js +0 -1
  371. package/dist/chunks/sandbox-adapter-CxkhKgaa.js +0 -1
  372. package/dist/chunks/searchExtraTools-DQ6e601b.js +0 -1
  373. package/dist/chunks/sessionFileAccessHooks-7Svz-7S-.js +0 -1
  374. package/dist/chunks/sessionMemory-DIrR3zvb.js +0 -1
  375. package/dist/chunks/sessionMemoryUtils-BdQtSkRx.js +0 -1
  376. package/dist/chunks/sessionObserver-_adufOGQ.js +0 -1
  377. package/dist/chunks/sessionStorage-W7okgAlQ.js +0 -1
  378. package/dist/chunks/sink-CaWMZBw_.js +0 -1
  379. package/dist/chunks/sinks-oFfsKySL.js +0 -1
  380. package/dist/chunks/skillLearning-BhM09bQD.js +0 -1
  381. package/dist/chunks/skillLearning-_o2D06yM.js +0 -1
  382. package/dist/chunks/teamHelpers-yeTNtZbb.js +0 -1
  383. package/dist/chunks/teammateModeSnapshot-CsNIJTKi.js +0 -1
  384. package/dist/chunks/thinkback-Quc7KPmi.js +0 -1
  385. package/dist/chunks/toolPool-C7bOwJfR.js +0 -1
  386. package/dist/chunks/undercover-CBeHiWUd.js +0 -1
  387. package/dist/chunks/upgrade-ucJ-lnlY.js +0 -1
  388. package/dist/chunks/utils-CwhszpkT.js +0 -1
  389. package/dist/chunks/voiceModeEnabled-DB8GCzAF.js +0 -1
  390. package/dist/chunks/voiceStreamSTT-DgoDscHn.js +0 -1
  391. package/dist/chunks/worktree-DU3xtwKW.js +0 -1
@@ -1,4 +1,4 @@
1
- import{a as e,n as t,o as n,r}from"./chunk-DR8-3Aex.js";import{f as i,l as a,n as o,s,u as c}from"./envUtils-BWeoiL4Y.js";import{g as l}from"./client-_sjL0I7A.js";import{n as u,t as d}from"./defineProperty-80gRi2ZW.js";import{n as f,t as p}from"./figures-gfT9mM8P.js";import{n as m,t as h}from"./axios-DhfaybwJ.js";import{Cn as g,Ln as _,un as v,vt as y,wn as b,yn as x}from"./schemas-BGAvj1T4.js";import{i as S,r as C,t as w}from"./v4-f1i_CNUT.js";import{A as T,B as E,Cn as D,Ct as O,F as k,Ft as A,I as j,In as M,K as N,Kt as P,L as ee,Ln as F,Lt as te,M as ne,O as I,Q as re,Rn as L,St as ie,T as ae,Tn as oe,Tt as se,U as ce,Ut as le,Wt as ue,Yt as de,Z as fe,at as pe,b as R,ct as me,en as z,f as B,g as he,gn as ge,h as _e,k as ve,m as ye,nt as V,ot as be,p as xe,qt as Se,t as H,tn as Ce,tt as we,v as Te,wn as Ee,wt as De,x as U,xt as Oe,z as ke,zt as Ae}from"./src-Di342QoJ.js";import{t as je}from"./jsx-runtime-D-D469L8.js";import{A as Me,Ar as Ne,Bt as Pe,Ct as Fe,Dt as Ie,Fr as Le,G as Re,Ht as ze,Jt as Be,K as Ve,Kt as He,Lt as Ue,Mr as We,Nt as Ge,Pr as Ke,Qt as qe,Rt as Je,S as Ye,Sn as Xe,U as Ze,Vt as Qe,W as $e,X as et,Xt as tt,Yt as nt,Zt as rt,an as it,bn as at,cn as ot,er as st,jn as ct,jr as lt,ln as ut,or as dt,ot as ft,qt as pt,rn as mt,sr as ht,tr as gt,tt as _t,ut as vt,vt as yt,xn as bt,y as xt,yn as St,zn as Ct,zt as wt}from"./state-sIHsFpDu.js";import{$s as Tt,Ac as Et,Ao as Dt,Br as Ot,Bs as kt,Cc as At,Ci as jt,Da as Mt,Dr as Nt,Ei as Pt,Et as Ft,Fa as It,Gs as Lt,Hr as Rt,Hs as zt,Ht as Bt,Io as Vt,Is as Ht,J as Ut,Ka as Wt,Ki as Gt,Kt,Lr as qt,Mo as Jt,Mr as Yt,Ms as Xt,Na as Zt,No as Qt,Ns as $t,Oa as en,Oo as tn,Ot as nn,Pc as rn,Po as an,Pr as on,Ps as sn,Pt as cn,Qa as ln,Ro as un,Rr as dn,S as fn,Sc as pn,Si as mn,St as hn,Ti as gn,Us as _n,Ut as vn,Vo as yn,Vs as bn,Wr as xn,Xt as Sn,Z as Cn,Zc as wn,_ as Tn,_a as En,a as Dn,ar as On,bi as kn,bl as An,bt as jn,cn as Mn,ct as Nn,d as Pn,dn as Fn,dr as In,ds as Ln,el as Rn,fl as zn,gc as Bn,gn as Vn,h as Hn,it as Un,jo as Wn,jr as Gn,ka as Kn,kt as qn,lo as Jn,mi as Yn,ml as Xn,nc as Zn,no as Qn,on as $n,oo as er,or as tr,pl as nr,qi as rr,rt as ir,s as ar,tn as or,ut as sr,vi as cr,w as lr,wi as W,wt as ur,xi as dr,xn as fr,xs as G,ya as pr,yi as mr,yl as hr,yn as gr,zs as _r}from"./paths-Q2255dD7.js";import{E as vr,K as yr,L as br,T as xr,U as Sr,V as Cr,X as wr,Y as Tr,d as K,h as Er,k as Dr,p as Or,s as q,w as kr,y as Ar}from"./debug-UI3T040K.js";import{n as J,r as Y}from"./analytics-DqMQntaB.js";import{n as jr,t as Mr}from"./cwd--iizewsn.js";import{t as Nr}from"./sdk-DEtgRZvI.js";import{F as Pr,P as Fr,a as Ir,f as Lr,i as Rr,v as zr}from"./git-CN3qtTb_.js";import{l as Br,u as Vr}from"./oauth-CdZEzMww.js";import{n as Hr,t as Ur}from"./bundledMode-kSQejuY4.js";import{n as Wr,t as Gr}from"./which-DqSAIvp2.js";import{a as Kr,i as qr,n as Jr}from"./env-chR0gV31.js";import{E as Yr,H as Xr,J as Zr,K as Qr,L as $r,N as ei,V as ti,W as ni,et as ri,o as ii,s as ai}from"./log-CzsijfHZ.js";import{i as oi,o as si}from"./platform-CuyedWpe.js";import{n as ci,t as li}from"./memoize-DxwLawI2.js";import{i as ui,n as di,o as fi,r as pi}from"./path-C4kbwvSH.js";import{r as mi,t as hi}from"./execFileNoThrow-CuQN1sz8.js";import{s as gi,u as _i}from"./types-Csi32ZXh.js";import{S as vi,_ as yi,a as bi,b as xi,d as Si,f as Ci,l as wi,n as Ti,o as Ei,r as Di,u as Oi,v as ki,x as Ai}from"./teammate-DMYOtLTK.js";import{c as ji,n as Mi,s as Ni,t as Pi}from"./intl-Pse97ORk.js";import{E as Fi,b as Ii,d as Li,f as Ri,m as zi,p as Bi,x as Vi}from"./startupProfiler-DnXZaX4A.js";import{n as Hi,t as Ui}from"./lazySchema-2sOku3cX.js";import{$ as Wi,$E as Gi,$S as Ki,$a as qi,$b as Ji,$d as Yi,$f as Xi,$h as Zi,$i as Qi,$l as $i,$m as ea,$n as ta,$p as na,$r as ra,$u as ia,$v as aa,$w as oa,$x as sa,$y as ca,AE as la,AO as ua,Af as da,Ag as fa,Ah as pa,Ak as ma,Am as ha,Ap as ga,Ar as _a,As as va,Au as ya,Ax as ba,BD as xa,B_ as Sa,Ba as Ca,Bc as wa,Bd as Ta,Bf as Ea,Bg as Da,Bh as Oa,Bl as ka,Bn as Aa,Bp as ja,Bs as Ma,Bu as Na,Bv as Pa,Bw as Fa,Bx as Ia,By as La,CD as Ra,CE as za,CS as Ba,C_ as Va,Cd as Ha,Cg as Ua,Ch as Wa,Cl as Ga,Co as Ka,Cu as qa,Cv as Ja,Cx as Ya,Cy as Xa,D as Za,DA as Qa,DE as $a,DO as eo,DS as to,Dh as no,Dn as ro,Do as io,Dp as ao,Du as oo,Dx as so,Dy as co,EA as lo,EO as uo,ES as fo,Ec as po,Ek as mo,Em as ho,Eo as go,Ep as _o,Es as vo,Eu as yo,Ey as bo,F as xo,FO as So,Fa as Co,Fd as wo,Ff as To,Fh as Eo,Fl as Do,Fm as Oo,Fn as ko,Fr as Ao,Fs as jo,Fy as Mo,G as No,GE as Po,GS as Fo,GT as Io,Gd as Lo,Gg as Ro,Gh as zo,Gi as Bo,Go as Vo,Gp as Ho,Gu as Uo,Gw as Wo,Gx as Go,Gy as Ko,HD as qo,HS as Jo,Hd as Yo,Hf as Xo,Hg as Zo,Hh as Qo,Hi as $o,Hl as es,Hm as ts,Hp as ns,Hs as rs,Hv as is,Hx as as,Hy as os,ID as ss,IE as cs,Ia as ls,Id as us,If as ds,Ig as fs,Ih as ps,Ii as ms,Il as hs,Im as gs,Is as _s,Iv as vs,Ix as ys,Iy as bs,J as xs,JO as Ss,JS as Cs,Ja as ws,Jb as Ts,Jd as Es,Jh as Ds,Ji as Os,Jp as ks,Js as As,Ju as js,Jx as Ms,Jy as Ns,K as Ps,KS as Fs,KT as Is,Kd as Ls,Kg as Rs,Kh as zs,Ko as Bs,Ks as Vs,Ku as Hs,Kx as Us,Ky as Ws,LD as Gs,Ld as Ks,Lf as qs,Lg as Js,Lh as Ys,Ll as Xs,Lm as Zs,Lo as Qs,Lp as $s,Ls as ec,Lv as tc,Lw as nc,Lx as rc,ME as ic,MS as X,Mb as ac,Mc as oc,Mf as sc,Mg as cc,Mh as lc,Mm as uc,Mp as dc,Mv as fc,Mx as pc,My as mc,N as hc,NS as gc,Nb as _c,Nd as vc,Nf as yc,Ng as bc,Nh as xc,Nm as Sc,No as Cc,Np as wc,Nr as Tc,Nt as Ec,Nx as Dc,Ny as Oc,O as kc,OS as Ac,Oc as jc,Ok as Mc,Om as Nc,On as Pc,Oo as Fc,Op as Ic,Ou as Lc,Ox as Rc,Oy as zc,P as Bc,PO as Vc,PS as Hc,Pd as Uc,Pf as Wc,Ph as Gc,Pm as Kc,Pn as qc,Po as Jc,Pv as Yc,Px as Xc,Py as Zc,Q as Qc,QE as $c,Q_ as el,Qa as tl,Qb as nl,Qd as rl,Qh as il,Qo as al,Qp as ol,Qs as sl,Qt as cl,Qv as ll,Qw as ul,Qx as dl,Qy as fl,RD as pl,Ra as ml,Rc as hl,Rd as gl,Rf as _l,Rh as vl,Ri as yl,Rl as bl,Rm as xl,Rn as Sl,Ro as Cl,Rp as wl,Rs as Tl,Rv as El,Rx as Dl,S as Ol,SD as kl,SE as Al,SS as jl,Sd as Ml,Si as Nl,Su as Pl,Sv as Fl,Sy as Il,TA as Ll,TE as Rl,TS as zl,T_ as Bl,Tl as Vl,To as Hl,Tr as Ul,Tu as Wl,Ty as Gl,UA as Kl,US as ql,Ub as Jl,Ud as Yl,Uf as Xl,Ug as Zl,Uh as Ql,Ul as $l,Up as eu,Ut as tu,Uu as nu,Uv as ru,Uw as iu,Ux as au,Uy as ou,VD as su,Vc as cu,Vd as lu,Vf as uu,Vh as du,Vl as fu,Vm as pu,Vn as mu,Vp as hu,Vs as gu,Vw as _u,Vx as vu,Vy as yu,WA as bu,WE as xu,WO as Su,WS as Cu,Wb as wu,Wd as Tu,Wg as Eu,Wh as Du,Wi as Ou,Wp as ku,Wx as Au,Wy as ju,XA as Mu,XD as Nu,XS as Pu,Xd as Fu,Xh as Iu,Xi as Lu,Xp as Ru,Xu as zu,Xw as Bu,Xx as Vu,Xy as Hu,Y as Uu,YD as Wu,YS as Gu,Yd as Ku,Yh as qu,Yi as Ju,Yn as Yu,Yp as Xu,Yt as Zu,Yu as Qu,Yv as $u,Yw as ed,Yx as td,Yy as nd,Z as rd,ZA as id,Zb as ad,Zd as od,Zh as sd,Zi as cd,Zp as ld,Zs as ud,Zu as dd,Zv as fd,Zw as pd,_D as md,_E as hd,_O as gd,_S as _d,_d as vd,_i as yd,_l as bd,_m as xd,_o as Sd,_v as Cd,_w as wd,_y as Td,aD as Ed,aE as Dd,aO as Od,ab as kd,ac as Ad,ad as jd,ah as Md,aj as Nd,ak as Pd,au as Fd,ay as Id,bA as Ld,bD as Rd,bE as zd,bO as Bd,bS as Vd,bT as Hd,bo as Ud,by as Wd,cE as Gd,cO as Kd,cS as qd,c_ as Jd,ca as Yd,cb as Xd,cd as Zd,ch as Qd,ci as $d,cj as ef,ck as tf,cl as nf,cs as rf,cx as af,cy as of,dC as sf,dE as cf,dO as lf,dS as uf,dd as df,dh as ff,di as pf,dk as mf,dm as hf,do as gf,dr as _f,dt as vf,du as yf,dx as bf,eC as xf,eD as Sf,eS as Cf,eT as wf,ea as Tf,eb as Ef,ed as Df,ef as Of,eg as kf,eh as Af,em as jf,eo as Mf,ep as Nf,es as Pf,ev as Ff,ey as If,fC as Lf,fD as Rf,fE as zf,fO as Bf,fS as Vf,fb as Hf,fh as Uf,fi as Wf,fk as Gf,fm as Kf,fo as qf,fs as Jf,ft as Yf,fu as Xf,gD as Zf,gE as Qf,gO as $f,gS as ep,gT as tp,gd as np,gl as rp,gm as ip,gs as ap,gy as op,hC as sp,hD as cp,hE as lp,hO as up,hS as dp,hd as fp,hh as pp,hl as mp,hm as hp,ho as gp,hp as _p,hr as vp,hu as yp,hx as bp,hy as xp,iA as Sp,iD as Cp,ia as wp,ib as Tp,if as Ep,ig as Dp,iu as Op,ix as kp,iy as Ap,jE as jp,jO as Mp,jS as Z,jc as Np,jf as Pp,jg as Fp,jh as Ip,jm as Lp,jp as Rp,jr as zp,ju as Bp,jx as Vp,jy as Hp,kO as Up,kS as Wp,kc as Gp,kg as Kp,kh as qp,kk as Jp,km as Yp,kp as Xp,ku as Zp,kx as Qp,lA as $p,lD as em,lO as tm,lS as nm,l_ as rm,la as im,lb as am,ld as om,lh as sm,lj as cm,ll as lm,lm as um,lo as dm,lx as fm,ly as pm,mC as mm,mD as hm,mE as gm,mO as _m,mS as vm,mT as ym,m_ as bm,ma as xm,mh as Sm,mi as Cm,mm as wm,mp as Tm,mu as Em,my as Dm,nC as Om,nD as km,na as Am,nb as jm,nd as Mm,ng as Nm,nh as Pm,nm as Fm,nr as Im,nt as Lm,nu as Rm,o as zm,oD as Bm,oE as Vm,oO as Hm,oa as Um,oc as Wm,od as Gm,oh as Km,oi as qm,oj as Jm,ol as Ym,oo as Xm,or as Zm,os as Qm,ot as $m,pD as eh,pE as th,pS as nh,p_ as rh,pa as ih,pb as ah,pd as oh,ph as sh,pk as ch,pu as lh,py as uh,qD as dh,qE as fh,qS as ph,qT as mh,qb as hh,qd as gh,qh as _h,qp as vh,qr as yh,qu as bh,qv as xh,qx as Sh,qy as Ch,rC as wh,rD as Th,ra as Eh,rd as Dh,rf as Oh,rg as kh,rk as Ah,rt as jh,ru as Mh,rv as Nh,rx as Ph,sA as Fh,sD as Ih,sE as Lh,sO as Rh,sa as zh,sb as Bh,sh as Vh,sj as Hh,sk as Uh,sl as Wh,so as Gh,sx as Kh,tA as qh,tD as Jh,tS as Yh,tT as Xh,ta as Zh,tb as Qh,td as $h,tg as eg,th as tg,tm as ng,to as rg,tt as ig,tv as ag,tx as og,ty as sg,u as cg,uD as lg,uE as ug,uO as dg,uS as fg,ua as pg,uh as mg,ul as hg,um as gg,un as _g,uo as vg,uu as yg,ux as bg,vD as xg,vO as Sg,vd as Cg,vo as wg,vs as Tg,vv as Eg,vw as Dg,vy as Og,w as kg,wE as Ag,wS as jg,wg as Mg,wh as Ng,wi as Pg,wo as Fg,wr as Ig,wt as Lg,wy as Rg,x as zg,xA as Bg,xD as Vg,xE as Hg,xO as Ug,xS as Wg,xT as Gg,xi as Kg,xk as qg,xt as Jg,xu as Yg,xy as Xg,yA as Zg,yD as Qg,yE as $g,yO as e_,yk as t_,ym as n_,yn as r_,ys as i_,yy as a_,zD as o_,z_ as s_,zc as c_,zf as l_,zh as u_,zi as d_,zl as f_,zn as p_,zp as m_,zs as h_,zu as g_,zv as __,zx as v_,zy as y_}from"./loadAgentsDir-Ci5mr0vm.js";import{An as b_,Bn as x_,Dn as S_,Fn as C_,In as w_,It as T_,J as E_,Lt as D_,M as O_,Mt as k_,On as A_,P as j_,V as M_,Vn as N_,en as P_,in as F_,jn as I_,jt as L_,mt as R_,tn as z_,xn as B_,zn as V_}from"./prompt-DEPUnJdB.js";import{a as H_,n as U_,r as W_,v as G_}from"./companion-CyK_Dr1U.js";import{r as K_,t as q_}from"./xml-DD_ldd3X.js";import{a as J_,i as Y_,r as X_}from"./shellQuote-DgjT8KBA.js";import{a as Z_,o as Q_,s as $_}from"./fileStateCache-C7-TxF8G.js";import{C as ev,N as tv,S as nv,T as rv,X as iv,b as av,d as ov,f as sv,j as cv,w as lv,x as uv,y as dv}from"./rcDebugLog-BbPkkigY.js";import{T as fv,c as pv,r as mv,w as hv}from"./sessionTracing-DTjmc0EF.js";import{i as gv,n as _v,r as vv}from"./parser-CmngCwjB.js";import{c as yv,l as bv}from"./commitAttribution-BFshsh2H.js";import{n as xv,t as Sv}from"./poorMode-C5Frra4j.js";import{A as Cv,E as wv,H as Tv,I as Ev,L as Dv,M as Ov,N as kv,P as Av,V as jv,_ as Mv,a as Nv,b as Pv,d as Fv,g as Iv,h as Lv,m as Rv,o as zv,u as Bv,x as Vv}from"./teamHelpers-BmN9nKz-.js";import{a as Hv,f as Uv,l as Wv,o as Gv}from"./api-B6URs6nc.js";import{n as Kv,t as qv}from"./browser-fLRXxIsQ.js";import{t as Jv}from"./useKeybinding-FsOnjW6T.js";import{c as Yv,u as Xv}from"./common-CMCv4N_v.js";import{i as Zv,m as Qv,n as $v,p as ey}from"./terminalSetup-DJqWE8fc.js";import{d as ty,l as ny,u as ry}from"./referral-ByevBJrE.js";import{a as iy,c as ay,o as oy,s as sy}from"./constants-41VpZw2G.js";import{n as cy,t as ly}from"./SentryErrorBoundary-B6EWoJml.js";import{i as uy,r as dy}from"./bridgeEnabled-5vsPrjuq.js";import{i as fy,n as py,t as my}from"./voiceModeEnabled-CPQUE3PU.js";import{o as hy,r as gy,s as _y}from"./detection-CQsNad64.js";import{n as vy,r as yy}from"./undercover-DKn95mh9.js";import{t as by}from"./lib-B4Q0Nrpb.js";import{t as xy}from"./Dialog-DYFGqyDs.js";import{n as Sy,t as Cy}from"./mappers-uIrAj-Wd.js";import{n as wy,r as Ty}from"./sessionTitle-DzkMzHer.js";import{t as Ey}from"./bridgeMessaging-BiE0CTqq.js";import{a as Dy,i as Oy,r as ky,t as Ay}from"./pipeTransport-D7NIp3aA.js";import{t as jy}from"./useManagePlugins-BfGzHMvO.js";import{c as My,n as Ny,o as Py}from"./channelNotification-l3EXKDNB.js";import{a as Fy,c as Iy,n as Ly,o as Ry,s as zy,t as By}from"./MCPConnectionManager-CDsa79pu.js";import{c as Vy,i as Hy,l as Uy,n as Wy,o as Gy,r as Ky,s as qy,u as Jy}from"./cronJitterConfig-BzPaa52I.js";import{i as Yy,n as Xy}from"./toolPool-BkCtTKXz.js";import{a as Zy,c as Qy,i as $y,l as eb,o as tb,r as nb,t as rb,u as ib}from"./MessageSelector-CkeGQPNM.js";import{n as ab,t as ob}from"./sideQuestion-BAq0YyKY.js";import{a as sb,n as cb,o as lb,r as ub,s as db,t as fb}from"./skillChangeDetector-CA_Tdx8N.js";import{n as pb,t as mb}from"./refresh-B_CwwIRX.js";import{i as hb,n as gb,r as _b,t as vb}from"./directoryCompletion-DP_4B1GL.js";import{r as yb,t as bb}from"./PromptInputFooterSuggestions-D4lMVCqj.js";import{n as xb,t as Sb}from"./useMergedTools-TemEvCrX.js";import{a as Cb,i as wb,n as Tb,o as Eb,r as Db,t as Ob}from"./promptEditor-Ci-h04-5.js";import{n as kb,t as Ab}from"./useMainLoopModel-B7ch2o9K.js";import{i as jb,n as Mb,r as Nb,t as Pb}from"./PermissionDialog-5MlJf7ew.js";import{n as Fb,t as Ib}from"./RemoteCallout-BV_hoz98.js";import{i as Lb,n as Rb,r as zb,t as Bb}from"./sprites-5OAB-Ui2.js";import{a as Vb,n as Hb,t as Ub}from"./setup-BKUG46jQ.js";import{a as Wb,c as Gb,i as Kb,o as qb,r as Jb,s as Yb}from"./caches-BUBkfP2Q.js";import{n as Xb,t as Zb}from"./conversation-Ci8O_eZ-.js";import{a as Qb,i as $b,n as ex,o as tx,r as nx,s as rx,t as ix}from"./extraUsage-CfxgfpX_.js";import{n as ax,t as ox}from"./useSearchInput-B-V4kIa-.js";import{n as sx,t as cx}from"./useSettingsErrors-B2JGz1s8.js";import{n as lx,t as ux}from"./shadowedRuleDetection-DesT0yKM.js";import{n as dx,t as fx}from"./ExitFlow-C4ybxKPn.js";import{a as px,c as mx,i as hx,l as gx,n as _x,o as vx,r as yx,s as bx,t as xx}from"./Messages-PfbzLYOU.js";import{n as Sx,t as Cx}from"./exportRenderer-3y4tGdSB.js";import{i as wx,n as Tx,t as Ex}from"./bypassPermissionsKillswitch-CSC9p8mO.js";import{a as Dx,i as Ox,r as kx,t as Ax}from"./fast-CzRUJBTK.js";import{n as jx,r as Mx}from"./Feedback-B5rPGl_C.js";import{a as Nx,i as Px,n as Fx,r as Ix,t as Lx}from"./PromptInputHelpMenu-BvLtS6an.js";import{n as Rx,r as zx}from"./language-DcSjogBx.js";import{n as Bx,r as Vx}from"./pluginAutoupdate-Cr9hP0zG.js";import{n as Hx,r as Ux}from"./autoModeDenials-Cp6VFdsm.js";import{n as Wx,t as Gx}from"./generateSessionName-DvRYa39O.js";import{n as Kx,t as qx}from"./fuse-Ch_OAlm3.js";import{a as Jx,c as Yx,i as Xx,l as Zx,n as Qx,o as $x,r as eS,s as tS,t as nS}from"./BackgroundTasksDialog-DXJdube9.js";import{r as rS,t as iS}from"./useVoice-BuwYDm2U.js";import{n as aS}from"./fpsMetrics-DeezdcwV.js";import{t as oS}from"./earlyInput-tRkbxFv2.js";import{a as sS,c as cS,f as lS,i as uS,l as dS,o as fS,r as pS,s as mS,t as hS}from"./RemoteSessionManager-Cxoy1ud2.js";import{n as gS,t as _S}from"./backgroundHousekeeping-CYnAG60-.js";import{homedir as vS,tmpdir as yS}from"os";import*as bS from"path";import{basename as xS,dirname as SS,extname as CS,join as wS,relative as TS,sep as ES}from"path";import{dirname as DS,join as OS}from"node:path";import{watch as kS}from"fs";import{createHash as AS}from"node:crypto";import{randomUUID as jS}from"crypto";import{readFile as MS,stat as NS,writeFile as PS}from"fs/promises";import{spawn as FS,spawnSync as IS}from"child_process";import{mkdir as LS,readFile as RS,rename as zS,writeFile as BS}from"node:fs/promises";s(),u(),h(),w(),F(),Ee(),O(),f(),Le(),ot(),hr(),J(),jr(),Tr(),Nr(),Cr(),kr(),Er(),q(),Fr(),Vr(),Ur(),Gr(),Kr(),nr(),ri(),ii(),si(),li(),ui(),Rn(),mi(),zr(),gi(),Et(),Ai(),Ni(),Vi(),Zn(),Ui(),Lt(),$t(),G(),un(),Wn(),er(),It(),Kn(),pr(),rr(),cr(),on(),In(),$n(),nn(),ur(),ir(),yi(),wi(),Ut(),fn(),Dn(),ef(),id(),N_(),w_(),I_(),B_(),Qa(),Ld(),F_(),$p(),Sp(),z_(),D_(),k_(),R_(),M_(),O_(),ma(),mo(),Q_(),qg(),ch(),Uh(),Ss(),Vc(),Mp(),eo(),up(),dh(),o_(),Ra(),Vg(),hv(),vv(),X_(),cp(),em(),Cp(),$c(),Po(),la(),$a(),za(),tv(),$g(),K_(),Qf(),cf(),Vm(),Av(),mh(),qv(),Xh(),wf(),ul(),Bu(),Jv(),Wo(),nc(),Yv(),Dg(),Lf(),wh(),Gu(),Cu(),Jo(),Z(),Ac(),fo(),jg(),jl(),ey(),Zv(),vm(),dl(),Go(),ty(),au(),Ia(),ys(),Xc(),Qp(),Rc(),Ya(),bf(),nl(),fl(),Hu(),Ws(),La(),Pv(),ay(),Nv(),co(),Xg(),sg(),is(),fc(),Fl(),Sa(),Bl(),Eu(),Zo(),cc(),cy(),Du(),vl(),Ip(),Ng(),pp(),Vh(),Af(),ts(),Zs(),xd(),Kf(),ku(),ja(),wl(),wc(),Rp(),Ic(),ao(),_p(),dy(),Xl(),_l(),ds(),yc(),Pp(),py(),dv(),Zd(),Mm(),bh(),g_(),yo(),qa(),yp(),lh(),pv(),Rm(),$i(),es(),Do(),Ga(),mp(),lm(),Wh(),cu(),hl(),Np(),Gp(),Ad(),sl(),gu(),vo(),Tg(),Jf(),Qm(),Qs(),ml(),xm(),Lu(),_a(),Sl(),ro(),r_(),ig(),Qc(),xs(),Ps(),kg(),Gy(),Ky(),Cb(),jb(),Mb(),ox(),_x(),Cx(),jx();var Q=n(L(),1);H(),of();var $=je();function VS({onDone:e}){return(0,$.jsxs)(B,{title:`You've spent $5 on the Anthropic API this session.`,onCancel:e,children:[(0,$.jsxs)(U,{flexDirection:`column`,children:[(0,$.jsx)(R,{children:`Learn more about how to monitor your spending:`}),(0,$.jsx)(re,{url:`https://code.claude.com/docs/en/costs`})]}),(0,$.jsx)(so,{options:[{value:`ok`,label:`Got it, thanks!`}],onChange:e})]})}H(),of();function HS({idleMinutes:e,totalInputTokens:t,onDone:n}){return(0,$.jsxs)(B,{title:`You've been away ${US(e)} and this conversation is ${Ii(t)} tokens.`,onCancel:()=>n(`dismiss`),children:[(0,$.jsx)(U,{flexDirection:`column`,children:(0,$.jsx)(R,{children:`If this is a new task, clearing context will save usage and be faster.`})}),(0,$.jsx)(so,{options:[{value:`continue`,label:`Continue this conversation`},{value:`clear`,label:`Send message as a new conversation`},{value:`never`,label:`Don't ask me again`}],onChange:e=>n(e)})]})}function US(e){if(e<1)return`< 1m`;if(e<60)return`${Math.floor(e)}m`;let t=Math.floor(e/60),n=Math.floor(e%60);return n===0?`${t}h`:`${t}h ${n}m`}Hf();var WS=300,GS=240*1e3,KS=null,qS=null,JS=0,YS=!1;function XS(){JS++,JS===1&&(tC(),$S())}function ZS(){JS>0&&JS--,JS===0&&(eC(),nC())}function QS(){JS=0,eC(),nC()}function $S(){process.platform===`darwin`&&qS===null&&(qS=setInterval(()=>{JS>0&&(K(`Restarting caffeinate to maintain sleep prevention`),nC(),tC())},GS),qS.unref())}function eC(){qS!==null&&(clearInterval(qS),qS=null)}function tC(){if(process.platform===`darwin`&&KS===null){YS||(YS=!0,wr(async()=>{QS()}));try{KS=FS(`caffeinate`,[`-i`,`-t`,String(WS)],{stdio:`ignore`}),KS.unref();let e=KS;KS.on(`error`,t=>{K(`caffeinate spawn error: ${t.message}`),KS===e&&(KS=null)}),KS.on(`exit`,()=>{KS===e&&(KS=null)}),K(`Started caffeinate to prevent sleep`)}catch{KS=null}}}function nC(){if(KS!==null){let e=KS;KS=null;try{e.kill(`SIGKILL`),K(`Stopped caffeinate, allowing sleep`)}catch{}}}var rC=class{constructor(){d(this,`_status`,`idle`),d(this,`_generation`,0),d(this,`_changed`,Ke()),d(this,`subscribe`,this._changed.subscribe),d(this,`getSnapshot`,()=>this._status!==`idle`)}reserve(){return this._status===`idle`?(this._status=`dispatching`,this._notify(),!0):!1}cancelReservation(){this._status===`dispatching`&&(this._status=`idle`,this._notify())}tryStart(){return this._status===`running`?null:(this._status=`running`,++this._generation,this._notify(),this._generation)}end(e){return this._generation!==e||this._status!==`running`?!1:(this._status=`idle`,this._notify(),!0)}forceEnd(){this._status!==`idle`&&(this._status=`idle`,++this._generation,this._notify())}get isActive(){return this._status!==`idle`}get generation(){return this._generation}_notify(){this._changed.emit()}};am(),Qh(),Ko(),yu(),Hp(),op(),Ku(),Yo(),H(),Oc();function iC({name:e,color:t}){return(0,$.jsx)(U,{flexDirection:`row`,gap:1,children:(0,$.jsxs)(R,{color:Zc(t),children:[zt,` `,(0,$.jsxs)(R,{bold:!0,children:[`@`,e]})]})})}H();function aC({toolName:e,description:t}){let n=bi(),r=Ti(),i=Ei();return(0,$.jsxs)(U,{flexDirection:`column`,borderStyle:`round`,borderColor:`warning`,paddingX:1,children:[(0,$.jsxs)(U,{marginBottom:1,children:[(0,$.jsx)(Dm,{}),(0,$.jsxs)(R,{color:`warning`,bold:!0,children:[` `,`Waiting for team lead approval`]})]}),r&&i&&(0,$.jsx)(U,{marginBottom:1,children:(0,$.jsx)(iC,{name:r,color:i})}),(0,$.jsxs)(U,{children:[(0,$.jsx)(R,{dimColor:!0,children:`Tool: `}),(0,$.jsx)(R,{children:e})]}),(0,$.jsxs)(U,{children:[(0,$.jsx)(R,{dimColor:!0,children:`Action: `}),(0,$.jsx)(R,{children:t})]}),n&&(0,$.jsx)(U,{marginTop:1,children:(0,$.jsxs)(R,{dimColor:!0,children:[`Permission request sent to team `,`"`,n,`"`,` leader`]})})]})}Uc();function oC(e,t=!1){let n=X(e=>e.teamContext),r=(0,Q.useRef)(0),i=(0,Q.useRef)(void 0),a=(0,Q.useRef)(void 0),o=(0,Q.useRef)(0);(0,Q.useEffect)(()=>{if(t)return;let s=e[0]?.uuid,c=r.current,l=a.current===void 0,u=s!==void 0&&!l&&s===a.current&&c<=e.length,d=s!==void 0&&!l&&s===a.current&&c>e.length,f=u?c:0;if(f===e.length)return;let p=f===0?e:e.slice(f),m=u?i.current:void 0,h=++o.current;if(qm(p,Un()?{teamName:n?.teamName,agentName:n?.selfAgentName}:{},m,e).then(e=>{h===o.current&&e&&!u&&(i.current=e)}),u||l||d){let t=ta(p,e).findLast(zp);t&&(i.current=t.uuid)}r.current=e.length,a.current=s},[e,t,n?.teamName,n?.selfAgentName])}function sC(e){return!e||typeof e!=`object`?!1:`behavior`in e&&(e.behavior===`allow`||e.behavior===`deny`)}function cC(e,t){if(typeof e.message==`string`&&e.message)return e.message;if(typeof t?.message==`string`&&t.message)return t.message;if(typeof e.error==`string`&&e.error)return e.error}function lC(e){let t=e.response;if(!t||typeof t!=`object`)return null;if(t.subtype===`success`&&`response`in t&&sC(t.response))return t.response;if(t.subtype!==`error`)return null;let n=`response`in t&&sC(t.response)?t.response:void 0,r=cC(t,n);return n?r?{...n,message:r}:n:r?{behavior:`deny`,message:r}:null}function uC(t){{let{pauseProactive:t}=(dv(),e(ev));t()}t?.abort()}function dC(e,t){return e<t}function fC(e,t){return e&&t===0}function pC({hasHandle:e,isConnected:t,lastWrittenIndex:n,messageCount:r}){return!e||!t?!0:dC(n,r)}jd();function mC(e){return{id:e.id,subject:e.subject,description:e.description,activeForm:e.activeForm,status:e.status,owner:e.owner,blocks:[...e.blocks],blockedBy:[...e.blockedBy]}}function hC(e,t){return e.id.localeCompare(t.id)}function gC(e,t){return{task_list_id:e,tasks:t.filter(e=>!e.metadata?._internal).map(mC).sort(hC)}}function _C(e,t){return JSON.stringify(gC(e,t))}function vC(e,t){let n=gC(e,t);return{type:`task_state`,uuid:jS(),...n}}H(),Z(),q();var yC=50,bC=5e3,xC=1e4,SC=3;function CC(e,t,n,r,i){let a=(0,Q.useRef)(null),o=(0,Q.useRef)(void 0),s=(0,Q.useRef)(0),c=(0,Q.useRef)(!1),l=(0,Q.useRef)(!1),u=(0,Q.useRef)(new Set),d=(0,Q.useRef)(void 0),f=(0,Q.useRef)(0),p=Hc(),m=(0,Q.useRef)(r);m.current=r;let h=(0,Q.useRef)(i);h.current=i;let g=(0,Q.useRef)(e);g.current=e;let _=gc(),{addNotification:v}=Wp(),y=X(e=>e.replBridgeEnabled),b=X(e=>e.replBridgeConnected),x=X(e=>e.replBridgeSessionActive),S=X(e=>e.replBridgeOutboundOnly),C=X(e=>e.replBridgeInitialName);return(0,Q.useEffect)(()=>{{if(!y)return;let r=S;function i(e){r||v({key:`bridge-failed`,jsx:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(R,{color:`error`,children:`Remote Control failed`}),e&&(0,$.jsxs)(R,{dimColor:!0,children:[` · `,e]})]}),priority:`immediate`})}if(f.current>=SC){K(`[bridge:repl] Hook: ${f.current} consecutive init failures, not retrying this session`);let e=`disabled after repeated failures · restart to retry`;i(e),p(t=>t.replBridgeError===e&&!t.replBridgeEnabled?t:{...t,replBridgeError:e,replBridgeEnabled:!1});return}let b=!1,x=e.length;return(async()=>{try{if(o.current&&(K(`[bridge:repl] Hook: waiting for previous teardown to complete before re-init`),await o.current,o.current=void 0,K(`[bridge:repl] Hook: previous teardown complete, proceeding with re-init`)),b)return;let{initReplBridge:v}=await import(`./initReplBridge-BiHXpDEY.js`),{shouldShowAppUpgradeMessage:y}=await import(`./envLessBridgeConfig-CixkwbRF.js`),S=!1;{let{isAssistantMode:e}=await import(`./assistant-zVegFdAO.js`);S=e()}async function w(e){try{let t=Uy(e);if(!t)return;let{uuid:n}=t,{resolveAndPrepend:r}=await import(`./inboundAttachments-D-p91z3w.js`),i=t.content,a=await r(e,i);K(`[bridge:repl] Injecting inbound user message: ${typeof a==`string`?a.slice(0,80):`[${a.length} content blocks]`}${n?` uuid=${n}`:``}`),Kd({value:a,mode:`prompt`,uuid:n,skipSlashCommands:!0,bridgeOrigin:!0})}catch(e){K(`[bridge:repl] handleInboundMessage failed: ${e}`,{level:`error`})}}function T(e,n){if(b)return;if(r){K(`[bridge:repl] Mirror state=${e}${n?` detail=${n}`:``}`),e===`failed`?p(e=>e.replBridgeConnected?{...e,replBridgeConnected:!1}:e):(e===`ready`||e===`connected`)&&p(e=>e.replBridgeConnected?e:{...e,replBridgeConnected:!0});return}let o=a.current;switch(e){case`ready`:p(e=>{let t=o&&o.environmentId!==``?kd(o.environmentId,o.sessionIngressUrl):e.replBridgeConnectUrl,n=o?Dd(o.bridgeSessionId,o.sessionIngressUrl):e.replBridgeSessionUrl,r=o?.environmentId,i=o?.bridgeSessionId;return e.replBridgeConnected&&!e.replBridgeSessionActive&&!e.replBridgeReconnecting&&e.replBridgeConnectUrl===t&&e.replBridgeSessionUrl===n&&e.replBridgeEnvironmentId===r&&e.replBridgeSessionId===i?e:{...e,replBridgeConnected:!0,replBridgeSessionActive:!1,replBridgeReconnecting:!1,replBridgeConnectUrl:t,replBridgeSessionUrl:n,replBridgeEnvironmentId:r,replBridgeSessionId:i,replBridgeError:void 0}});break;case`connected`:{let e=_.getState().replBridgeSessionActive;p(e=>e.replBridgeSessionActive?e:{...e,replBridgeConnected:!0,replBridgeSessionActive:!0,replBridgeReconnecting:!1,replBridgeError:void 0}),e||t(e=>[...e,Sd(`Remote Control 已连接。现在可以使用 PushNotification、SendUserFile、Brief 工具,请使用 SearchExtraTools 搜索发现。`,`info`)]),Tn(`tengu_bridge_system_init`,!1)&&(async()=>{try{let e=await Os(Mr());if(b)return;let t=_.getState();a.current?.writeSdkMessages([tb({tools:[],mcpClients:[],model:h.current,permissionMode:t.toolPermissionContext.mode,commands:m.current.filter(cd),agents:t.agentDefinitions.activeAgents,skills:e,plugins:[],fastMode:t.fastMode})])}catch(e){K(`[bridge:repl] Failed to send system/init: ${br(e)}`,{level:`error`})}})();break}case`reconnecting`:p(e=>e.replBridgeReconnecting?e:{...e,replBridgeReconnecting:!0,replBridgeSessionActive:!1});break;case`failed`:clearTimeout(d.current),i(n),p(e=>({...e,replBridgeError:n,replBridgeReconnecting:!1,replBridgeSessionActive:!1,replBridgeConnected:!1})),d.current=setTimeout(()=>{b||(d.current=void 0,p(e=>e.replBridgeError?{...e,replBridgeEnabled:!1,replBridgeError:void 0}:e))},xC);break}}let E=new Map;function D(e){let t=e.response?.request_id;if(!t)return;let n=E.get(t);if(!n){K(`[bridge:repl] No handler for control_response request_id=${t}`);return}let r=lC(e);if(!r){K(`[bridge:repl] Ignoring unrecognized control_response request_id=${t}`);return}E.delete(t),n(r)}let O=await v({outboundOnly:r,tags:r?[`ccr-mirror`]:void 0,onInboundMessage:w,onPermissionResponse:D,onInterrupt(){uC(n.current)},onSetModel(e){let t=e===`default`?null:e??null;gt(t),p(e=>e.mainLoopModelForSession===t?e:{...e,mainLoopModelForSession:t})},onSetMaxThinkingTokens(e){let t=e!==null;p(e=>e.thinkingEnabled===t?e:{...e,thinkingEnabled:t})},onSetPermissionMode(e){if(e===`bypassPermissions`){if(kc())return{ok:!1,error:`Cannot set permission mode to bypassPermissions because it is disabled by settings or configuration`};if(!_.getState().toolPermissionContext.isBypassPermissionsModeAvailable)return{ok:!1,error:`Cannot set permission mode to bypassPermissions because the session was not launched with --dangerously-skip-permissions`}}if(e===`auto`&&!Za()){let e=Ol();return{ok:!1,error:e?`Cannot set permission mode to auto: ${zg(e)}`:`Cannot set permission mode to auto`}}return p(t=>{let n=t.toolPermissionContext.mode;if(n===e)return t;let r=xo(n,e,t.toolPermissionContext);return{...t,toolPermissionContext:{...r,mode:e}}}),setImmediate(()=>{vc()?.(e=>(e.forEach(e=>{e.recheckPermission()}),e))}),{ok:!0}},onStateChange:T,initialMessages:e.length>0?e:void 0,getMessages:()=>g.current,previouslyFlushedUUIDs:u.current,initialName:C,perpetual:S}),k=O?{...O,markTranscriptReset(){l.current=!0,c.current=!1,s.current=0}}:null;if(b){K(`[bridge:repl] Hook: init cancelled during flight, tearing down${k?` env=${k.environmentId}`:``}`),k&&k.teardown();return}if(!k){f.current++,K(`[bridge:repl] Init returned null (precondition or session creation failed); consecutive failures: ${f.current}`),clearTimeout(d.current),p(e=>({...e,replBridgeError:e.replBridgeError??`check debug logs for details`})),d.current=setTimeout(()=>{b||(d.current=void 0,p(e=>e.replBridgeError?{...e,replBridgeEnabled:!1,replBridgeError:void 0}:e))},xC);return}if(a.current=k,Gm(k),f.current=0,s.current=x,r)p(e=>e.replBridgeConnected&&e.replBridgeSessionId===k.bridgeSessionId?e:{...e,replBridgeConnected:!0,replBridgeSessionId:k.bridgeSessionId,replBridgeSessionUrl:void 0,replBridgeConnectUrl:void 0,replBridgeError:void 0}),K(`[bridge:repl] Mirror initialized, session=${k.bridgeSessionId}`);else{let e={sendRequest(e,t,n,r,i,a,o){k.sendControlRequest({type:`control_request`,request_id:e,request:{subtype:`can_use_tool`,tool_name:t,input:n,tool_use_id:r,description:i,...a?{permission_suggestions:a}:{},...o?{blocked_path:o}:{}}})},sendResponse(e,t){let n={...t};k.sendControlResponse({type:`control_response`,response:{subtype:`success`,request_id:e,response:n}})},cancelRequest(e){k.sendControlCancelRequest(e)},onResponse(e,t){return E.set(e,t),()=>{E.delete(e)}}};p(t=>({...t,replBridgePermissionCallbacks:e}));let n=Dd(k.bridgeSessionId,k.sessionIngressUrl),r=k.environmentId===``?void 0:kd(k.environmentId,k.sessionIngressUrl);p(e=>e.replBridgeConnected&&e.replBridgeSessionUrl===n?e:{...e,replBridgeConnected:!0,replBridgeSessionUrl:n,replBridgeConnectUrl:r??e.replBridgeConnectUrl,replBridgeEnvironmentId:k.environmentId,replBridgeSessionId:k.bridgeSessionId,replBridgeError:void 0});let i=S?!1:await y().catch(()=>!1);if(b)return;t(e=>[...e,gf(n,i?`Please upgrade to the latest version of the Claude mobile app to see your Remote Control sessions.`:void 0)]),K(`[bridge:repl] Hook initialized, session=${k.bridgeSessionId}`)}}catch(e){if(b)return;f.current++;let n=br(e);K(`[bridge:repl] Init failed: ${n}; consecutive failures: ${f.current}`),clearTimeout(d.current),i(n),p(e=>({...e,replBridgeError:n})),d.current=setTimeout(()=>{b||(d.current=void 0,p(e=>e.replBridgeError?{...e,replBridgeEnabled:!1,replBridgeError:void 0}:e))},xC),r||t(e=>[...e,Sd(`Remote Control failed to connect: ${n}`,`warning`)])}})(),()=>{b=!0,clearTimeout(d.current),d.current=void 0,a.current&&(K(`[bridge:repl] Hook cleanup: starting teardown for env=${a.current.environmentId} session=${a.current.bridgeSessionId}`),o.current=a.current.teardown(),a.current=null,Gm(null)),p(e=>!e.replBridgeConnected&&!e.replBridgeSessionActive&&!e.replBridgeError?e:{...e,replBridgeConnected:!1,replBridgeSessionActive:!1,replBridgeReconnecting:!1,replBridgeConnectUrl:void 0,replBridgeSessionUrl:void 0,replBridgeEnvironmentId:void 0,replBridgeSessionId:void 0,replBridgeError:void 0,replBridgePermissionCallbacks:void 0}),s.current=0,c.current=!1,l.current=!1}}},[y,S,p,t,v]),(0,Q.useEffect)(()=>{{if(!b)return;let t=a.current;if(!t)return;s.current>e.length&&K(`[bridge:repl] Compaction detected: lastWrittenIndex=${s.current} > messages.length=${e.length}, clamping`);let n=Math.min(s.current,e.length),r=[];for(let t=n;t<e.length;t++){let n=e[t];n&&(n.type===`user`||n.type===`assistant`||n.type===`system`&&n.subtype===`local_command`)&&r.push(n)}if(s.current=e.length,r.length>0&&(t.writeMessages(r),l.current=!1),c.current&&fC(l.current,e.length)){l.current=!1,c.current=!1,t.sendResult();return}c.current&&!l.current&&(c.current=!1,t.sendResult())}},[e,b]),(0,Q.useEffect)(()=>{{if(!x||S)return;let e=!1,t,n,r=null,i=null,o=null,s=null,c=e=>{if(!(e===i&&r!==null)){r?.close(),r=null,i=e;try{r=kS(e,u),r.unref()}catch{}}},l=async()=>{let t=a.current;if(!t)return;let n=Ov();c(kv(n));try{let r=await Ev(n);if(e||a.current!==t)return;let i=_C(n,r);if(i===o&&t===s)return;t.writeSdkMessages([vC(n,r)]),o=i,s=t}catch(e){K(`[bridge:repl] Failed to publish task_state: ${br(e)}`,{level:`error`})}},u=()=>{t&&clearTimeout(t),t=setTimeout(()=>{t=void 0,l()},yC),t.unref?.()};l();let d=Dv(u);return n=setInterval(()=>{l()},bC),n.unref?.(),()=>{e=!0,d(),t&&clearTimeout(t),n&&clearInterval(n),r?.close()}}},[x,S]),{sendBridgeResult:(0,Q.useCallback)(()=>{{let e=a.current;if(!e){c.current=!0;return}if(fC(l.current,g.current.length)){l.current=!1,c.current=!1,e.sendResult();return}if(l.current||pC({hasHandle:!0,isConnected:b,lastWrittenIndex:s.current,messageCount:g.current.length})){c.current=!0;return}e.sendResult()}},[b])}}ny(),nb();var wC=Hi(()=>b({method:v(`log_event`),params:b({eventName:_(),eventData:b({}).passthrough()})}));function TC(e){(0,Q.useEffect)(()=>{if(!e.length)return;let t=hh(e);t&&t.client.setNotificationHandler(wC(),e=>{let{eventName:t,eventData:n}=e.params;Y(`tengu_ide_${t}`,n)})},[e])}ot(),H();var EC=6e3;function DC(){return Date.now()-et()}function OC(e){return DC()<e}function kC(e){return!OC(e)}function AC(e,t){let n=A();(0,Q.useEffect)(()=>{We(!0)},[]),(0,Q.useEffect)(()=>{let r=!1,i=setInterval(()=>{kC(6e3)&&!r&&(r=!0,clearInterval(i),ah({message:e,notificationType:t},n))},EC);return()=>clearInterval(i)},[e,t,n])}Ki(),fa(),Kc(),Lp(),Nc(),Db(),H(),Fa();var jC={topLeft:`┌`,topRight:`┐`,bottomLeft:`└`,bottomRight:`┘`,horizontal:`─`,vertical:`│`,teeLeft:`├`,teeRight:`┤`};function MC(e){return zl().syntaxHighlightingDisabled?(0,$.jsx)(PC,{...e,highlight:null}):(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(PC,{...e,highlight:null}),children:(0,$.jsx)(NC,{...e})})}function NC(e){let t=(0,Q.use)(Qg());return(0,$.jsx)(PC,{...e,highlight:t})}function PC({content:e,maxLines:t,minHeight:n,minWidth:r=40,maxWidth:i,highlight:a}){let{columns:o}=k(),[s]=ae(),c=i??o-4,l=t??20,u=(0,Q.useMemo)(()=>Zl(e,s,a),[e,s,a]).split(`
1
+ import{a as e,n as t,o as n,r}from"./chunk-DR8-3Aex.js";import{f as i,l as a,n as o,s,u as c}from"./envUtils-BWeoiL4Y.js";import{g as l}from"./client-_sjL0I7A.js";import{n as u,t as d}from"./defineProperty-80gRi2ZW.js";import{n as f,t as p}from"./figures-gfT9mM8P.js";import{n as m,t as h}from"./axios-DhfaybwJ.js";import{Cn as g,Ln as _,un as v,vt as y,wn as b,yn as x}from"./schemas-BGAvj1T4.js";import{i as S,r as C,t as w}from"./v4-f1i_CNUT.js";import{A as T,B as E,Cn as D,Ct as O,F as k,Ft as A,I as j,In as M,K as N,Kt as P,L as ee,Ln as F,Lt as te,M as ne,O as I,Q as re,Rn as L,St as ie,T as ae,Tn as oe,Tt as se,U as ce,Ut as le,Wt as ue,Yt as de,Z as fe,at as pe,b as R,ct as me,en as z,f as B,g as he,gn as ge,h as _e,k as ve,m as ye,nt as V,ot as be,p as xe,qt as Se,t as H,tn as Ce,tt as we,v as Te,wn as Ee,wt as De,x as U,xt as Oe,z as ke,zt as Ae}from"./src-Di342QoJ.js";import{t as je}from"./jsx-runtime-D-D469L8.js";import{A as Me,Ar as Ne,Bt as Pe,Ct as Fe,Dt as Ie,Fr as Le,G as Re,Ht as ze,Jt as Be,K as Ve,Kt as He,Lt as Ue,Mr as We,Nt as Ge,Pr as Ke,Qt as qe,Rt as Je,S as Ye,Sn as Xe,U as Ze,Vt as Qe,W as $e,X as et,Xt as tt,Yt as nt,Zt as rt,an as it,bn as at,cn as ot,er as st,jn as ct,jr as lt,ln as ut,or as dt,ot as ft,qt as pt,rn as mt,sr as ht,tr as gt,tt as _t,ut as vt,vt as yt,xn as bt,y as xt,yn as St,zn as Ct,zt as wt}from"./state-sIHsFpDu.js";import{$s as Tt,Ac as Et,Ao as Dt,Br as Ot,Bs as kt,Cc as At,Ci as jt,Da as Mt,Dr as Nt,Ei as Pt,Et as Ft,Fa as It,Gs as Lt,Hr as Rt,Hs as zt,Ht as Bt,Io as Vt,Is as Ht,J as Ut,Ka as Wt,Ki as Gt,Kt,Lr as qt,Mo as Jt,Mr as Yt,Ms as Xt,Na as Zt,No as Qt,Ns as $t,Oa as en,Oo as tn,Ot as nn,Pc as rn,Po as an,Pr as on,Ps as sn,Pt as cn,Qa as ln,Ro as un,Rr as dn,S as fn,Sc as pn,Si as mn,St as hn,Ti as gn,Us as _n,Ut as vn,Vo as yn,Vs as bn,Wr as xn,Xt as Sn,Z as Cn,Zc as wn,_ as Tn,_a as En,a as Dn,ar as On,bi as kn,bl as An,bt as jn,cn as Mn,ct as Nn,d as Pn,dn as Fn,dr as In,ds as Ln,el as Rn,fl as zn,gc as Bn,gn as Vn,h as Hn,it as Un,jo as Wn,jr as Gn,ka as Kn,kt as qn,lo as Jn,mi as Yn,ml as Xn,nc as Zn,no as Qn,on as $n,oo as er,or as tr,pl as nr,qi as rr,rt as ir,s as ar,tn as or,ut as sr,vi as cr,w as lr,wi as W,wt as ur,xi as dr,xn as fr,xs as G,ya as pr,yi as mr,yl as hr,yn as gr,zs as _r}from"./paths-BBvuDQl9.js";import{E as vr,K as yr,L as br,T as xr,U as Sr,V as Cr,X as wr,Y as Tr,d as K,h as Er,k as Dr,p as Or,s as q,w as kr,y as Ar}from"./debug-UI3T040K.js";import{n as J,r as Y}from"./analytics-DqMQntaB.js";import{n as jr,t as Mr}from"./cwd--iizewsn.js";import{t as Nr}from"./sdk-DEtgRZvI.js";import{F as Pr,P as Fr,a as Ir,f as Lr,i as Rr,v as zr}from"./git-CN3qtTb_.js";import{l as Br,u as Vr}from"./oauth-CdZEzMww.js";import{n as Hr,t as Ur}from"./bundledMode-kSQejuY4.js";import{n as Wr,t as Gr}from"./which-DqSAIvp2.js";import{a as Kr,i as qr,n as Jr}from"./env-chR0gV31.js";import{E as Yr,H as Xr,J as Zr,K as Qr,L as $r,N as ei,V as ti,W as ni,et as ri,o as ii,s as ai}from"./log-CzsijfHZ.js";import{i as oi,o as si}from"./platform-CuyedWpe.js";import{n as ci,t as li}from"./memoize-DxwLawI2.js";import{i as ui,n as di,o as fi,r as pi}from"./path-C4kbwvSH.js";import{r as mi,t as hi}from"./execFileNoThrow-CuQN1sz8.js";import{s as gi,u as _i}from"./types-Csi32ZXh.js";import{S as vi,_ as yi,a as bi,b as xi,d as Si,f as Ci,l as wi,n as Ti,o as Ei,r as Di,u as Oi,v as ki,x as Ai}from"./teammate-DMYOtLTK.js";import{c as ji,n as Mi,s as Ni,t as Pi}from"./intl-Pse97ORk.js";import{E as Fi,b as Ii,d as Li,f as Ri,m as zi,p as Bi,x as Vi}from"./startupProfiler-DnXZaX4A.js";import{n as Hi,t as Ui}from"./lazySchema-2sOku3cX.js";import{$ as Wi,$E as Gi,$S as Ki,$a as qi,$b as Ji,$d as Yi,$f as Xi,$h as Zi,$i as Qi,$l as $i,$m as ea,$n as ta,$p as na,$r as ra,$u as ia,$v as aa,$w as oa,$x as sa,$y as ca,AE as la,AO as ua,Af as da,Ag as fa,Ah as pa,Ak as ma,Am as ha,Ap as ga,Ar as _a,As as va,Au as ya,Ax as ba,BD as xa,B_ as Sa,Ba as Ca,Bc as wa,Bd as Ta,Bf as Ea,Bg as Da,Bh as Oa,Bl as ka,Bn as Aa,Bp as ja,Bs as Ma,Bu as Na,Bv as Pa,Bw as Fa,Bx as Ia,By as La,CD as Ra,CE as za,CS as Ba,C_ as Va,Cd as Ha,Cg as Ua,Ch as Wa,Cl as Ga,Co as Ka,Cu as qa,Cv as Ja,Cx as Ya,Cy as Xa,D as Za,DA as Qa,DE as $a,DO as eo,DS as to,Dh as no,Dn as ro,Do as io,Dp as ao,Du as oo,Dx as so,Dy as co,EA as lo,EO as uo,ES as fo,Ec as po,Ek as mo,Em as ho,Eo as go,Ep as _o,Es as vo,Eu as yo,Ey as bo,F as xo,FO as So,Fa as Co,Fd as wo,Ff as To,Fh as Eo,Fl as Do,Fm as Oo,Fn as ko,Fr as Ao,Fs as jo,Fy as Mo,G as No,GE as Po,GS as Fo,GT as Io,Gd as Lo,Gg as Ro,Gh as zo,Gi as Bo,Go as Vo,Gp as Ho,Gu as Uo,Gw as Wo,Gx as Go,Gy as Ko,HD as qo,HS as Jo,Hd as Yo,Hf as Xo,Hg as Zo,Hh as Qo,Hi as $o,Hl as es,Hm as ts,Hp as ns,Hs as rs,Hv as is,Hx as as,Hy as os,ID as ss,IE as cs,Ia as ls,Id as us,If as ds,Ig as fs,Ih as ps,Ii as ms,Il as hs,Im as gs,Is as _s,Iv as vs,Ix as ys,Iy as bs,J as xs,JO as Ss,JS as Cs,Ja as ws,Jb as Ts,Jd as Es,Jh as Ds,Ji as Os,Jp as ks,Js as As,Ju as js,Jx as Ms,Jy as Ns,K as Ps,KS as Fs,KT as Is,Kd as Ls,Kg as Rs,Kh as zs,Ko as Bs,Ks as Vs,Ku as Hs,Kx as Us,Ky as Ws,LD as Gs,Ld as Ks,Lf as qs,Lg as Js,Lh as Ys,Ll as Xs,Lm as Zs,Lo as Qs,Lp as $s,Ls as ec,Lv as tc,Lw as nc,Lx as rc,ME as ic,MS as X,Mb as ac,Mc as oc,Mf as sc,Mg as cc,Mh as lc,Mm as uc,Mp as dc,Mv as fc,Mx as pc,My as mc,N as hc,NS as gc,Nb as _c,Nd as vc,Nf as yc,Ng as bc,Nh as xc,Nm as Sc,No as Cc,Np as wc,Nr as Tc,Nt as Ec,Nx as Dc,Ny as Oc,O as kc,OS as Ac,Oc as jc,Ok as Mc,Om as Nc,On as Pc,Oo as Fc,Op as Ic,Ou as Lc,Ox as Rc,Oy as zc,P as Bc,PO as Vc,PS as Hc,Pd as Uc,Pf as Wc,Ph as Gc,Pm as Kc,Pn as qc,Po as Jc,Pv as Yc,Px as Xc,Py as Zc,Q as Qc,QE as $c,Q_ as el,Qa as tl,Qb as nl,Qd as rl,Qh as il,Qo as al,Qp as ol,Qs as sl,Qt as cl,Qv as ll,Qw as ul,Qx as dl,Qy as fl,RD as pl,Ra as ml,Rc as hl,Rd as gl,Rf as _l,Rh as vl,Ri as yl,Rl as bl,Rm as xl,Rn as Sl,Ro as Cl,Rp as wl,Rs as Tl,Rv as El,Rx as Dl,S as Ol,SD as kl,SE as Al,SS as jl,Sd as Ml,Si as Nl,Su as Pl,Sv as Fl,Sy as Il,TA as Ll,TE as Rl,TS as zl,T_ as Bl,Tl as Vl,To as Hl,Tr as Ul,Tu as Wl,Ty as Gl,UA as Kl,US as ql,Ub as Jl,Ud as Yl,Uf as Xl,Ug as Zl,Uh as Ql,Ul as $l,Up as eu,Ut as tu,Uu as nu,Uv as ru,Uw as iu,Ux as au,Uy as ou,VD as su,Vc as cu,Vd as lu,Vf as uu,Vh as du,Vl as fu,Vm as pu,Vn as mu,Vp as hu,Vs as gu,Vw as _u,Vx as vu,Vy as yu,WA as bu,WE as xu,WO as Su,WS as Cu,Wb as wu,Wd as Tu,Wg as Eu,Wh as Du,Wi as Ou,Wp as ku,Wx as Au,Wy as ju,XA as Mu,XD as Nu,XS as Pu,Xd as Fu,Xh as Iu,Xi as Lu,Xp as Ru,Xu as zu,Xw as Bu,Xx as Vu,Xy as Hu,Y as Uu,YD as Wu,YS as Gu,Yd as Ku,Yh as qu,Yi as Ju,Yn as Yu,Yp as Xu,Yt as Zu,Yu as Qu,Yv as $u,Yw as ed,Yx as td,Yy as nd,Z as rd,ZA as id,Zb as ad,Zd as od,Zh as sd,Zi as cd,Zp as ld,Zs as ud,Zu as dd,Zv as fd,Zw as pd,_D as md,_E as hd,_O as gd,_S as _d,_d as vd,_i as yd,_l as bd,_m as xd,_o as Sd,_v as Cd,_w as wd,_y as Td,aD as Ed,aE as Dd,aO as Od,ab as kd,ac as Ad,ad as jd,ah as Md,aj as Nd,ak as Pd,au as Fd,ay as Id,bA as Ld,bD as Rd,bE as zd,bO as Bd,bS as Vd,bT as Hd,bo as Ud,by as Wd,cE as Gd,cO as Kd,cS as qd,c_ as Jd,ca as Yd,cb as Xd,cd as Zd,ch as Qd,ci as $d,cj as ef,ck as tf,cl as nf,cs as rf,cx as af,cy as of,dC as sf,dE as cf,dO as lf,dS as uf,dd as df,dh as ff,di as pf,dk as mf,dm as hf,do as gf,dr as _f,dt as vf,du as yf,dx as bf,eC as xf,eD as Sf,eS as Cf,eT as wf,ea as Tf,eb as Ef,ed as Df,ef as Of,eg as kf,eh as Af,em as jf,eo as Mf,ep as Nf,es as Pf,ev as Ff,ey as If,fC as Lf,fD as Rf,fE as zf,fO as Bf,fS as Vf,fb as Hf,fh as Uf,fi as Wf,fk as Gf,fm as Kf,fo as qf,fs as Jf,ft as Yf,fu as Xf,gD as Zf,gE as Qf,gO as $f,gS as ep,gT as tp,gd as np,gl as rp,gm as ip,gs as ap,gy as op,hC as sp,hD as cp,hE as lp,hO as up,hS as dp,hd as fp,hh as pp,hl as mp,hm as hp,ho as gp,hp as _p,hr as vp,hu as yp,hx as bp,hy as xp,iA as Sp,iD as Cp,ia as wp,ib as Tp,if as Ep,ig as Dp,iu as Op,ix as kp,iy as Ap,jE as jp,jO as Mp,jS as Z,jc as Np,jf as Pp,jg as Fp,jh as Ip,jm as Lp,jp as Rp,jr as zp,ju as Bp,jx as Vp,jy as Hp,kO as Up,kS as Wp,kc as Gp,kg as Kp,kh as qp,kk as Jp,km as Yp,kp as Xp,ku as Zp,kx as Qp,lA as $p,lD as em,lO as tm,lS as nm,l_ as rm,la as im,lb as am,ld as om,lh as sm,lj as cm,ll as lm,lm as um,lo as dm,lx as fm,ly as pm,mC as mm,mD as hm,mE as gm,mO as _m,mS as vm,mT as ym,m_ as bm,ma as xm,mh as Sm,mi as Cm,mm as wm,mp as Tm,mu as Em,my as Dm,nC as Om,nD as km,na as Am,nb as jm,nd as Mm,ng as Nm,nh as Pm,nm as Fm,nr as Im,nt as Lm,nu as Rm,o as zm,oD as Bm,oE as Vm,oO as Hm,oa as Um,oc as Wm,od as Gm,oh as Km,oi as qm,oj as Jm,ol as Ym,oo as Xm,or as Zm,os as Qm,ot as $m,pD as eh,pE as th,pS as nh,p_ as rh,pa as ih,pb as ah,pd as oh,ph as sh,pk as ch,pu as lh,py as uh,qD as dh,qE as fh,qS as ph,qT as mh,qb as hh,qd as gh,qh as _h,qp as vh,qr as yh,qu as bh,qv as xh,qx as Sh,qy as Ch,rC as wh,rD as Th,ra as Eh,rd as Dh,rf as Oh,rg as kh,rk as Ah,rt as jh,ru as Mh,rv as Nh,rx as Ph,sA as Fh,sD as Ih,sE as Lh,sO as Rh,sa as zh,sb as Bh,sh as Vh,sj as Hh,sk as Uh,sl as Wh,so as Gh,sx as Kh,tA as qh,tD as Jh,tS as Yh,tT as Xh,ta as Zh,tb as Qh,td as $h,tg as eg,th as tg,tm as ng,to as rg,tt as ig,tv as ag,tx as og,ty as sg,u as cg,uD as lg,uE as ug,uO as dg,uS as fg,ua as pg,uh as mg,ul as hg,um as gg,un as _g,uo as vg,uu as yg,ux as bg,vD as xg,vO as Sg,vd as Cg,vo as wg,vs as Tg,vv as Eg,vw as Dg,vy as Og,w as kg,wE as Ag,wS as jg,wg as Mg,wh as Ng,wi as Pg,wo as Fg,wr as Ig,wt as Lg,wy as Rg,x as zg,xA as Bg,xD as Vg,xE as Hg,xO as Ug,xS as Wg,xT as Gg,xi as Kg,xk as qg,xt as Jg,xu as Yg,xy as Xg,yA as Zg,yD as Qg,yE as $g,yO as e_,yk as t_,ym as n_,yn as r_,ys as i_,yy as a_,zD as o_,z_ as s_,zc as c_,zf as l_,zh as u_,zi as d_,zl as f_,zn as p_,zp as m_,zs as h_,zu as g_,zv as __,zx as v_,zy as y_}from"./loadAgentsDir-DI1a76pd.js";import{An as b_,Bn as x_,Dn as S_,Fn as C_,In as w_,It as T_,J as E_,Lt as D_,M as O_,Mt as k_,On as A_,P as j_,V as M_,Vn as N_,en as P_,in as F_,jn as I_,jt as L_,mt as R_,tn as z_,xn as B_,zn as V_}from"./prompt-CjFAtm3w.js";import{a as H_,n as U_,r as W_,v as G_}from"./companion-Bkn2lSLj.js";import{r as K_,t as q_}from"./xml-Dx--sNE1.js";import{a as J_,i as Y_,r as X_}from"./shellQuote-DgjT8KBA.js";import{a as Z_,o as Q_,s as $_}from"./fileStateCache-C7-TxF8G.js";import{C as ev,N as tv,S as nv,T as rv,X as iv,b as av,d as ov,f as sv,j as cv,w as lv,x as uv,y as dv}from"./rcDebugLog-CPKZCtR8.js";import{T as fv,c as pv,r as mv,w as hv}from"./sessionTracing-DoRJ4nSa.js";import{i as gv,n as _v,r as vv}from"./parser-CmngCwjB.js";import{c as yv,l as bv}from"./commitAttribution-C22a3OCi.js";import{n as xv,t as Sv}from"./poorMode-DzYT47KW.js";import{A as Cv,E as wv,H as Tv,I as Ev,L as Dv,M as Ov,N as kv,P as Av,V as jv,_ as Mv,a as Nv,b as Pv,d as Fv,g as Iv,h as Lv,m as Rv,o as zv,u as Bv,x as Vv}from"./teamHelpers--3ZyNDlv.js";import{a as Hv,f as Uv,l as Wv,o as Gv}from"./api-CGOR_Xfl.js";import{n as Kv,t as qv}from"./browser-fLRXxIsQ.js";import{t as Jv}from"./useKeybinding-FsOnjW6T.js";import{c as Yv,u as Xv}from"./common-CMCv4N_v.js";import{i as Zv,m as Qv,n as $v,p as ey}from"./terminalSetup-Lyg4NbGA.js";import{d as ty,l as ny,u as ry}from"./referral-DeDr9zAE.js";import{a as iy,c as ay,o as oy,s as sy}from"./constants-41VpZw2G.js";import{n as cy,t as ly}from"./SentryErrorBoundary-C-NlfQZw.js";import{i as uy,r as dy}from"./bridgeEnabled-D2IykaHE.js";import{i as fy,n as py,t as my}from"./voiceModeEnabled-DA76xN1Q.js";import{o as hy,r as gy,s as _y}from"./detection-CQsNad64.js";import{n as vy,r as yy}from"./undercover-DvvnEmsX.js";import{t as by}from"./lib-B4Q0Nrpb.js";import{t as xy}from"./Dialog-DYFGqyDs.js";import{n as Sy,t as Cy}from"./mappers-CJ8IO1o1.js";import{n as wy,r as Ty}from"./sessionTitle-zUVSAHO7.js";import{t as Ey}from"./bridgeMessaging-CqNURC4-.js";import{a as Dy,i as Oy,r as ky,t as Ay}from"./pipeTransport-DVoIA1uN.js";import{t as jy}from"./useManagePlugins-GmnI9K53.js";import{c as My,n as Ny,o as Py}from"./channelNotification-B7A-9DIl.js";import{a as Fy,c as Iy,n as Ly,o as Ry,s as zy,t as By}from"./MCPConnectionManager-DYGoS1Ht.js";import{c as Vy,i as Hy,l as Uy,n as Wy,o as Gy,r as Ky,s as qy,u as Jy}from"./cronJitterConfig-CYP7yrQu.js";import{i as Yy,n as Xy}from"./toolPool-Dq-Vtvrj.js";import{a as Zy,c as Qy,i as $y,l as eb,o as tb,r as nb,t as rb,u as ib}from"./MessageSelector-DTmUuEKJ.js";import{n as ab,t as ob}from"./sideQuestion-DHW5rgKz.js";import{a as sb,n as cb,o as lb,r as ub,s as db,t as fb}from"./skillChangeDetector-D8C-uQSQ.js";import{n as pb,t as mb}from"./refresh-D7pdoY_X.js";import{i as hb,n as gb,r as _b,t as vb}from"./directoryCompletion-DP_4B1GL.js";import{r as yb,t as bb}from"./PromptInputFooterSuggestions-DrrkNOuS.js";import{n as xb,t as Sb}from"./useMergedTools-Dah5KDMi.js";import{a as Cb,i as wb,n as Tb,o as Eb,r as Db,t as Ob}from"./promptEditor-EgosPsy-.js";import{n as kb,t as Ab}from"./useMainLoopModel-CwvuTRXn.js";import{i as jb,n as Mb,r as Nb,t as Pb}from"./PermissionDialog-5MlJf7ew.js";import{n as Fb,t as Ib}from"./RemoteCallout-CnpCWRPk.js";import{i as Lb,n as Rb,r as zb,t as Bb}from"./sprites-DD4eIkN7.js";import{a as Vb,n as Hb,t as Ub}from"./setup-B1JbPepL.js";import{a as Wb,c as Gb,i as Kb,o as qb,r as Jb,s as Yb}from"./caches-B5QZDncQ.js";import{n as Xb,t as Zb}from"./conversation-DKlz47xf.js";import{a as Qb,i as $b,n as ex,o as tx,r as nx,s as rx,t as ix}from"./extraUsage-CNMMTNJi.js";import{n as ax,t as ox}from"./useSearchInput-BV_azHiA.js";import{n as sx,t as cx}from"./useSettingsErrors-C-j_Zt7g.js";import{n as lx,t as ux}from"./shadowedRuleDetection-BBR3uEgx.js";import{n as dx,t as fx}from"./ExitFlow-CSBDxw9H.js";import{a as px,c as mx,i as hx,l as gx,n as _x,o as vx,r as yx,s as bx,t as xx}from"./Messages-DWiKTx5o.js";import{n as Sx,t as Cx}from"./exportRenderer-CWPSMaqM.js";import{i as wx,n as Tx,t as Ex}from"./bypassPermissionsKillswitch-Bof-UtM-.js";import{a as Dx,i as Ox,r as kx,t as Ax}from"./fast-CG1v3fRr.js";import{n as jx,r as Mx}from"./Feedback-DwHzc4UT.js";import{a as Nx,i as Px,n as Fx,r as Ix,t as Lx}from"./PromptInputHelpMenu-DMsF4D6d.js";import{n as Rx,r as zx}from"./language-CPRGmY8Q.js";import{n as Bx,r as Vx}from"./pluginAutoupdate-CGXIWBrb.js";import{n as Hx,r as Ux}from"./autoModeDenials-Cp6VFdsm.js";import{n as Wx,t as Gx}from"./generateSessionName-zbqanivg.js";import{n as Kx,t as qx}from"./fuse-Ch_OAlm3.js";import{a as Jx,c as Yx,i as Xx,l as Zx,n as Qx,o as $x,r as eS,s as tS,t as nS}from"./BackgroundTasksDialog-ByraVuXh.js";import{r as rS,t as iS}from"./useVoice-DR69NLxp.js";import{n as aS}from"./fpsMetrics-DeezdcwV.js";import{t as oS}from"./earlyInput-tRkbxFv2.js";import{a as sS,c as cS,f as lS,i as uS,l as dS,o as fS,r as pS,s as mS,t as hS}from"./RemoteSessionManager-OWg_Yccq.js";import{n as gS,t as _S}from"./backgroundHousekeeping-BIZTAYho.js";import{homedir as vS,tmpdir as yS}from"os";import*as bS from"path";import{basename as xS,dirname as SS,extname as CS,join as wS,relative as TS,sep as ES}from"path";import{dirname as DS,join as OS}from"node:path";import{watch as kS}from"fs";import{createHash as AS}from"node:crypto";import{randomUUID as jS}from"crypto";import{readFile as MS,stat as NS,writeFile as PS}from"fs/promises";import{spawn as FS,spawnSync as IS}from"child_process";import{mkdir as LS,readFile as RS,rename as zS,writeFile as BS}from"node:fs/promises";s(),u(),h(),w(),F(),Ee(),O(),f(),Le(),ot(),hr(),J(),jr(),Tr(),Nr(),Cr(),kr(),Er(),q(),Fr(),Vr(),Ur(),Gr(),Kr(),nr(),ri(),ii(),si(),li(),ui(),Rn(),mi(),zr(),gi(),Et(),Ai(),Ni(),Vi(),Zn(),Ui(),Lt(),$t(),G(),un(),Wn(),er(),It(),Kn(),pr(),rr(),cr(),on(),In(),$n(),nn(),ur(),ir(),yi(),wi(),Ut(),fn(),Dn(),ef(),id(),N_(),w_(),I_(),B_(),Qa(),Ld(),F_(),$p(),Sp(),z_(),D_(),k_(),R_(),M_(),O_(),ma(),mo(),Q_(),qg(),ch(),Uh(),Ss(),Vc(),Mp(),eo(),up(),dh(),o_(),Ra(),Vg(),hv(),vv(),X_(),cp(),em(),Cp(),$c(),Po(),la(),$a(),za(),tv(),$g(),K_(),Qf(),cf(),Vm(),Av(),mh(),qv(),Xh(),wf(),ul(),Bu(),Jv(),Wo(),nc(),Yv(),Dg(),Lf(),wh(),Gu(),Cu(),Jo(),Z(),Ac(),fo(),jg(),jl(),ey(),Zv(),vm(),dl(),Go(),ty(),au(),Ia(),ys(),Xc(),Qp(),Rc(),Ya(),bf(),nl(),fl(),Hu(),Ws(),La(),Pv(),ay(),Nv(),co(),Xg(),sg(),is(),fc(),Fl(),Sa(),Bl(),Eu(),Zo(),cc(),cy(),Du(),vl(),Ip(),Ng(),pp(),Vh(),Af(),ts(),Zs(),xd(),Kf(),ku(),ja(),wl(),wc(),Rp(),Ic(),ao(),_p(),dy(),Xl(),_l(),ds(),yc(),Pp(),py(),dv(),Zd(),Mm(),bh(),g_(),yo(),qa(),yp(),lh(),pv(),Rm(),$i(),es(),Do(),Ga(),mp(),lm(),Wh(),cu(),hl(),Np(),Gp(),Ad(),sl(),gu(),vo(),Tg(),Jf(),Qm(),Qs(),ml(),xm(),Lu(),_a(),Sl(),ro(),r_(),ig(),Qc(),xs(),Ps(),kg(),Gy(),Ky(),Cb(),jb(),Mb(),ox(),_x(),Cx(),jx();var Q=n(L(),1);H(),of();var $=je();function VS({onDone:e}){return(0,$.jsxs)(B,{title:`You've spent $5 on the Anthropic API this session.`,onCancel:e,children:[(0,$.jsxs)(U,{flexDirection:`column`,children:[(0,$.jsx)(R,{children:`Learn more about how to monitor your spending:`}),(0,$.jsx)(re,{url:`https://code.claude.com/docs/en/costs`})]}),(0,$.jsx)(so,{options:[{value:`ok`,label:`Got it, thanks!`}],onChange:e})]})}H(),of();function HS({idleMinutes:e,totalInputTokens:t,onDone:n}){return(0,$.jsxs)(B,{title:`You've been away ${US(e)} and this conversation is ${Ii(t)} tokens.`,onCancel:()=>n(`dismiss`),children:[(0,$.jsx)(U,{flexDirection:`column`,children:(0,$.jsx)(R,{children:`If this is a new task, clearing context will save usage and be faster.`})}),(0,$.jsx)(so,{options:[{value:`continue`,label:`Continue this conversation`},{value:`clear`,label:`Send message as a new conversation`},{value:`never`,label:`Don't ask me again`}],onChange:e=>n(e)})]})}function US(e){if(e<1)return`< 1m`;if(e<60)return`${Math.floor(e)}m`;let t=Math.floor(e/60),n=Math.floor(e%60);return n===0?`${t}h`:`${t}h ${n}m`}Hf();var WS=300,GS=240*1e3,KS=null,qS=null,JS=0,YS=!1;function XS(){JS++,JS===1&&(tC(),$S())}function ZS(){JS>0&&JS--,JS===0&&(eC(),nC())}function QS(){JS=0,eC(),nC()}function $S(){process.platform===`darwin`&&qS===null&&(qS=setInterval(()=>{JS>0&&(K(`Restarting caffeinate to maintain sleep prevention`),nC(),tC())},GS),qS.unref())}function eC(){qS!==null&&(clearInterval(qS),qS=null)}function tC(){if(process.platform===`darwin`&&KS===null){YS||(YS=!0,wr(async()=>{QS()}));try{KS=FS(`caffeinate`,[`-i`,`-t`,String(WS)],{stdio:`ignore`}),KS.unref();let e=KS;KS.on(`error`,t=>{K(`caffeinate spawn error: ${t.message}`),KS===e&&(KS=null)}),KS.on(`exit`,()=>{KS===e&&(KS=null)}),K(`Started caffeinate to prevent sleep`)}catch{KS=null}}}function nC(){if(KS!==null){let e=KS;KS=null;try{e.kill(`SIGKILL`),K(`Stopped caffeinate, allowing sleep`)}catch{}}}var rC=class{constructor(){d(this,`_status`,`idle`),d(this,`_generation`,0),d(this,`_changed`,Ke()),d(this,`subscribe`,this._changed.subscribe),d(this,`getSnapshot`,()=>this._status!==`idle`)}reserve(){return this._status===`idle`?(this._status=`dispatching`,this._notify(),!0):!1}cancelReservation(){this._status===`dispatching`&&(this._status=`idle`,this._notify())}tryStart(){return this._status===`running`?null:(this._status=`running`,++this._generation,this._notify(),this._generation)}end(e){return this._generation!==e||this._status!==`running`?!1:(this._status=`idle`,this._notify(),!0)}forceEnd(){this._status!==`idle`&&(this._status=`idle`,++this._generation,this._notify())}get isActive(){return this._status!==`idle`}get generation(){return this._generation}_notify(){this._changed.emit()}};am(),Qh(),Ko(),yu(),Hp(),op(),Ku(),Yo(),H(),Oc();function iC({name:e,color:t}){return(0,$.jsx)(U,{flexDirection:`row`,gap:1,children:(0,$.jsxs)(R,{color:Zc(t),children:[zt,` `,(0,$.jsxs)(R,{bold:!0,children:[`@`,e]})]})})}H();function aC({toolName:e,description:t}){let n=bi(),r=Ti(),i=Ei();return(0,$.jsxs)(U,{flexDirection:`column`,borderStyle:`round`,borderColor:`warning`,paddingX:1,children:[(0,$.jsxs)(U,{marginBottom:1,children:[(0,$.jsx)(Dm,{}),(0,$.jsxs)(R,{color:`warning`,bold:!0,children:[` `,`Waiting for team lead approval`]})]}),r&&i&&(0,$.jsx)(U,{marginBottom:1,children:(0,$.jsx)(iC,{name:r,color:i})}),(0,$.jsxs)(U,{children:[(0,$.jsx)(R,{dimColor:!0,children:`Tool: `}),(0,$.jsx)(R,{children:e})]}),(0,$.jsxs)(U,{children:[(0,$.jsx)(R,{dimColor:!0,children:`Action: `}),(0,$.jsx)(R,{children:t})]}),n&&(0,$.jsx)(U,{marginTop:1,children:(0,$.jsxs)(R,{dimColor:!0,children:[`Permission request sent to team `,`"`,n,`"`,` leader`]})})]})}Uc();function oC(e,t=!1){let n=X(e=>e.teamContext),r=(0,Q.useRef)(0),i=(0,Q.useRef)(void 0),a=(0,Q.useRef)(void 0),o=(0,Q.useRef)(0);(0,Q.useEffect)(()=>{if(t)return;let s=e[0]?.uuid,c=r.current,l=a.current===void 0,u=s!==void 0&&!l&&s===a.current&&c<=e.length,d=s!==void 0&&!l&&s===a.current&&c>e.length,f=u?c:0;if(f===e.length)return;let p=f===0?e:e.slice(f),m=u?i.current:void 0,h=++o.current;if(qm(p,Un()?{teamName:n?.teamName,agentName:n?.selfAgentName}:{},m,e).then(e=>{h===o.current&&e&&!u&&(i.current=e)}),u||l||d){let t=ta(p,e).findLast(zp);t&&(i.current=t.uuid)}r.current=e.length,a.current=s},[e,t,n?.teamName,n?.selfAgentName])}function sC(e){return!e||typeof e!=`object`?!1:`behavior`in e&&(e.behavior===`allow`||e.behavior===`deny`)}function cC(e,t){if(typeof e.message==`string`&&e.message)return e.message;if(typeof t?.message==`string`&&t.message)return t.message;if(typeof e.error==`string`&&e.error)return e.error}function lC(e){let t=e.response;if(!t||typeof t!=`object`)return null;if(t.subtype===`success`&&`response`in t&&sC(t.response))return t.response;if(t.subtype!==`error`)return null;let n=`response`in t&&sC(t.response)?t.response:void 0,r=cC(t,n);return n?r?{...n,message:r}:n:r?{behavior:`deny`,message:r}:null}function uC(t){{let{pauseProactive:t}=(dv(),e(ev));t()}t?.abort()}function dC(e,t){return e<t}function fC(e,t){return e&&t===0}function pC({hasHandle:e,isConnected:t,lastWrittenIndex:n,messageCount:r}){return!e||!t?!0:dC(n,r)}jd();function mC(e){return{id:e.id,subject:e.subject,description:e.description,activeForm:e.activeForm,status:e.status,owner:e.owner,blocks:[...e.blocks],blockedBy:[...e.blockedBy]}}function hC(e,t){return e.id.localeCompare(t.id)}function gC(e,t){return{task_list_id:e,tasks:t.filter(e=>!e.metadata?._internal).map(mC).sort(hC)}}function _C(e,t){return JSON.stringify(gC(e,t))}function vC(e,t){let n=gC(e,t);return{type:`task_state`,uuid:jS(),...n}}H(),Z(),q();var yC=50,bC=5e3,xC=1e4,SC=3;function CC(e,t,n,r,i){let a=(0,Q.useRef)(null),o=(0,Q.useRef)(void 0),s=(0,Q.useRef)(0),c=(0,Q.useRef)(!1),l=(0,Q.useRef)(!1),u=(0,Q.useRef)(new Set),d=(0,Q.useRef)(void 0),f=(0,Q.useRef)(0),p=Hc(),m=(0,Q.useRef)(r);m.current=r;let h=(0,Q.useRef)(i);h.current=i;let g=(0,Q.useRef)(e);g.current=e;let _=gc(),{addNotification:v}=Wp(),y=X(e=>e.replBridgeEnabled),b=X(e=>e.replBridgeConnected),x=X(e=>e.replBridgeSessionActive),S=X(e=>e.replBridgeOutboundOnly),C=X(e=>e.replBridgeInitialName);return(0,Q.useEffect)(()=>{{if(!y)return;let r=S;function i(e){r||v({key:`bridge-failed`,jsx:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(R,{color:`error`,children:`Remote Control failed`}),e&&(0,$.jsxs)(R,{dimColor:!0,children:[` · `,e]})]}),priority:`immediate`})}if(f.current>=SC){K(`[bridge:repl] Hook: ${f.current} consecutive init failures, not retrying this session`);let e=`disabled after repeated failures · restart to retry`;i(e),p(t=>t.replBridgeError===e&&!t.replBridgeEnabled?t:{...t,replBridgeError:e,replBridgeEnabled:!1});return}let b=!1,x=e.length;return(async()=>{try{if(o.current&&(K(`[bridge:repl] Hook: waiting for previous teardown to complete before re-init`),await o.current,o.current=void 0,K(`[bridge:repl] Hook: previous teardown complete, proceeding with re-init`)),b)return;let{initReplBridge:v}=await import(`./initReplBridge-tPRGPBq7.js`),{shouldShowAppUpgradeMessage:y}=await import(`./envLessBridgeConfig-CT8sdmFu.js`),S=!1;{let{isAssistantMode:e}=await import(`./assistant-CwbhlCM-.js`);S=e()}async function w(e){try{let t=Uy(e);if(!t)return;let{uuid:n}=t,{resolveAndPrepend:r}=await import(`./inboundAttachments-BVUunfAX.js`),i=t.content,a=await r(e,i);K(`[bridge:repl] Injecting inbound user message: ${typeof a==`string`?a.slice(0,80):`[${a.length} content blocks]`}${n?` uuid=${n}`:``}`),Kd({value:a,mode:`prompt`,uuid:n,skipSlashCommands:!0,bridgeOrigin:!0})}catch(e){K(`[bridge:repl] handleInboundMessage failed: ${e}`,{level:`error`})}}function T(e,n){if(b)return;if(r){K(`[bridge:repl] Mirror state=${e}${n?` detail=${n}`:``}`),e===`failed`?p(e=>e.replBridgeConnected?{...e,replBridgeConnected:!1}:e):(e===`ready`||e===`connected`)&&p(e=>e.replBridgeConnected?e:{...e,replBridgeConnected:!0});return}let o=a.current;switch(e){case`ready`:p(e=>{let t=o&&o.environmentId!==``?kd(o.environmentId,o.sessionIngressUrl):e.replBridgeConnectUrl,n=o?Dd(o.bridgeSessionId,o.sessionIngressUrl):e.replBridgeSessionUrl,r=o?.environmentId,i=o?.bridgeSessionId;return e.replBridgeConnected&&!e.replBridgeSessionActive&&!e.replBridgeReconnecting&&e.replBridgeConnectUrl===t&&e.replBridgeSessionUrl===n&&e.replBridgeEnvironmentId===r&&e.replBridgeSessionId===i?e:{...e,replBridgeConnected:!0,replBridgeSessionActive:!1,replBridgeReconnecting:!1,replBridgeConnectUrl:t,replBridgeSessionUrl:n,replBridgeEnvironmentId:r,replBridgeSessionId:i,replBridgeError:void 0}});break;case`connected`:{let e=_.getState().replBridgeSessionActive;p(e=>e.replBridgeSessionActive?e:{...e,replBridgeConnected:!0,replBridgeSessionActive:!0,replBridgeReconnecting:!1,replBridgeError:void 0}),e||t(e=>[...e,Sd(`Remote Control 已连接。现在可以使用 PushNotification、SendUserFile、Brief 工具,请使用 SearchExtraTools 搜索发现。`,`info`)]),Tn(`tengu_bridge_system_init`,!1)&&(async()=>{try{let e=await Os(Mr());if(b)return;let t=_.getState();a.current?.writeSdkMessages([tb({tools:[],mcpClients:[],model:h.current,permissionMode:t.toolPermissionContext.mode,commands:m.current.filter(cd),agents:t.agentDefinitions.activeAgents,skills:e,plugins:[],fastMode:t.fastMode})])}catch(e){K(`[bridge:repl] Failed to send system/init: ${br(e)}`,{level:`error`})}})();break}case`reconnecting`:p(e=>e.replBridgeReconnecting?e:{...e,replBridgeReconnecting:!0,replBridgeSessionActive:!1});break;case`failed`:clearTimeout(d.current),i(n),p(e=>({...e,replBridgeError:n,replBridgeReconnecting:!1,replBridgeSessionActive:!1,replBridgeConnected:!1})),d.current=setTimeout(()=>{b||(d.current=void 0,p(e=>e.replBridgeError?{...e,replBridgeEnabled:!1,replBridgeError:void 0}:e))},xC);break}}let E=new Map;function D(e){let t=e.response?.request_id;if(!t)return;let n=E.get(t);if(!n){K(`[bridge:repl] No handler for control_response request_id=${t}`);return}let r=lC(e);if(!r){K(`[bridge:repl] Ignoring unrecognized control_response request_id=${t}`);return}E.delete(t),n(r)}let O=await v({outboundOnly:r,tags:r?[`ccr-mirror`]:void 0,onInboundMessage:w,onPermissionResponse:D,onInterrupt(){uC(n.current)},onSetModel(e){let t=e===`default`?null:e??null;gt(t),p(e=>e.mainLoopModelForSession===t?e:{...e,mainLoopModelForSession:t})},onSetMaxThinkingTokens(e){let t=e!==null;p(e=>e.thinkingEnabled===t?e:{...e,thinkingEnabled:t})},onSetPermissionMode(e){if(e===`bypassPermissions`){if(kc())return{ok:!1,error:`Cannot set permission mode to bypassPermissions because it is disabled by settings or configuration`};if(!_.getState().toolPermissionContext.isBypassPermissionsModeAvailable)return{ok:!1,error:`Cannot set permission mode to bypassPermissions because the session was not launched with --dangerously-skip-permissions`}}if(e===`auto`&&!Za()){let e=Ol();return{ok:!1,error:e?`Cannot set permission mode to auto: ${zg(e)}`:`Cannot set permission mode to auto`}}return p(t=>{let n=t.toolPermissionContext.mode;if(n===e)return t;let r=xo(n,e,t.toolPermissionContext);return{...t,toolPermissionContext:{...r,mode:e}}}),setImmediate(()=>{vc()?.(e=>(e.forEach(e=>{e.recheckPermission()}),e))}),{ok:!0}},onStateChange:T,initialMessages:e.length>0?e:void 0,getMessages:()=>g.current,previouslyFlushedUUIDs:u.current,initialName:C,perpetual:S}),k=O?{...O,markTranscriptReset(){l.current=!0,c.current=!1,s.current=0}}:null;if(b){K(`[bridge:repl] Hook: init cancelled during flight, tearing down${k?` env=${k.environmentId}`:``}`),k&&k.teardown();return}if(!k){f.current++,K(`[bridge:repl] Init returned null (precondition or session creation failed); consecutive failures: ${f.current}`),clearTimeout(d.current),p(e=>({...e,replBridgeError:e.replBridgeError??`check debug logs for details`})),d.current=setTimeout(()=>{b||(d.current=void 0,p(e=>e.replBridgeError?{...e,replBridgeEnabled:!1,replBridgeError:void 0}:e))},xC);return}if(a.current=k,Gm(k),f.current=0,s.current=x,r)p(e=>e.replBridgeConnected&&e.replBridgeSessionId===k.bridgeSessionId?e:{...e,replBridgeConnected:!0,replBridgeSessionId:k.bridgeSessionId,replBridgeSessionUrl:void 0,replBridgeConnectUrl:void 0,replBridgeError:void 0}),K(`[bridge:repl] Mirror initialized, session=${k.bridgeSessionId}`);else{let e={sendRequest(e,t,n,r,i,a,o){k.sendControlRequest({type:`control_request`,request_id:e,request:{subtype:`can_use_tool`,tool_name:t,input:n,tool_use_id:r,description:i,...a?{permission_suggestions:a}:{},...o?{blocked_path:o}:{}}})},sendResponse(e,t){let n={...t};k.sendControlResponse({type:`control_response`,response:{subtype:`success`,request_id:e,response:n}})},cancelRequest(e){k.sendControlCancelRequest(e)},onResponse(e,t){return E.set(e,t),()=>{E.delete(e)}}};p(t=>({...t,replBridgePermissionCallbacks:e}));let n=Dd(k.bridgeSessionId,k.sessionIngressUrl),r=k.environmentId===``?void 0:kd(k.environmentId,k.sessionIngressUrl);p(e=>e.replBridgeConnected&&e.replBridgeSessionUrl===n?e:{...e,replBridgeConnected:!0,replBridgeSessionUrl:n,replBridgeConnectUrl:r??e.replBridgeConnectUrl,replBridgeEnvironmentId:k.environmentId,replBridgeSessionId:k.bridgeSessionId,replBridgeError:void 0});let i=S?!1:await y().catch(()=>!1);if(b)return;t(e=>[...e,gf(n,i?`Please upgrade to the latest version of the Claude mobile app to see your Remote Control sessions.`:void 0)]),K(`[bridge:repl] Hook initialized, session=${k.bridgeSessionId}`)}}catch(e){if(b)return;f.current++;let n=br(e);K(`[bridge:repl] Init failed: ${n}; consecutive failures: ${f.current}`),clearTimeout(d.current),i(n),p(e=>({...e,replBridgeError:n})),d.current=setTimeout(()=>{b||(d.current=void 0,p(e=>e.replBridgeError?{...e,replBridgeEnabled:!1,replBridgeError:void 0}:e))},xC),r||t(e=>[...e,Sd(`Remote Control failed to connect: ${n}`,`warning`)])}})(),()=>{b=!0,clearTimeout(d.current),d.current=void 0,a.current&&(K(`[bridge:repl] Hook cleanup: starting teardown for env=${a.current.environmentId} session=${a.current.bridgeSessionId}`),o.current=a.current.teardown(),a.current=null,Gm(null)),p(e=>!e.replBridgeConnected&&!e.replBridgeSessionActive&&!e.replBridgeError?e:{...e,replBridgeConnected:!1,replBridgeSessionActive:!1,replBridgeReconnecting:!1,replBridgeConnectUrl:void 0,replBridgeSessionUrl:void 0,replBridgeEnvironmentId:void 0,replBridgeSessionId:void 0,replBridgeError:void 0,replBridgePermissionCallbacks:void 0}),s.current=0,c.current=!1,l.current=!1}}},[y,S,p,t,v]),(0,Q.useEffect)(()=>{{if(!b)return;let t=a.current;if(!t)return;s.current>e.length&&K(`[bridge:repl] Compaction detected: lastWrittenIndex=${s.current} > messages.length=${e.length}, clamping`);let n=Math.min(s.current,e.length),r=[];for(let t=n;t<e.length;t++){let n=e[t];n&&(n.type===`user`||n.type===`assistant`||n.type===`system`&&n.subtype===`local_command`)&&r.push(n)}if(s.current=e.length,r.length>0&&(t.writeMessages(r),l.current=!1),c.current&&fC(l.current,e.length)){l.current=!1,c.current=!1,t.sendResult();return}c.current&&!l.current&&(c.current=!1,t.sendResult())}},[e,b]),(0,Q.useEffect)(()=>{{if(!x||S)return;let e=!1,t,n,r=null,i=null,o=null,s=null,c=e=>{if(!(e===i&&r!==null)){r?.close(),r=null,i=e;try{r=kS(e,u),r.unref()}catch{}}},l=async()=>{let t=a.current;if(!t)return;let n=Ov();c(kv(n));try{let r=await Ev(n);if(e||a.current!==t)return;let i=_C(n,r);if(i===o&&t===s)return;t.writeSdkMessages([vC(n,r)]),o=i,s=t}catch(e){K(`[bridge:repl] Failed to publish task_state: ${br(e)}`,{level:`error`})}},u=()=>{t&&clearTimeout(t),t=setTimeout(()=>{t=void 0,l()},yC),t.unref?.()};l();let d=Dv(u);return n=setInterval(()=>{l()},bC),n.unref?.(),()=>{e=!0,d(),t&&clearTimeout(t),n&&clearInterval(n),r?.close()}}},[x,S]),{sendBridgeResult:(0,Q.useCallback)(()=>{{let e=a.current;if(!e){c.current=!0;return}if(fC(l.current,g.current.length)){l.current=!1,c.current=!1,e.sendResult();return}if(l.current||pC({hasHandle:!0,isConnected:b,lastWrittenIndex:s.current,messageCount:g.current.length})){c.current=!0;return}e.sendResult()}},[b])}}ny(),nb();var wC=Hi(()=>b({method:v(`log_event`),params:b({eventName:_(),eventData:b({}).passthrough()})}));function TC(e){(0,Q.useEffect)(()=>{if(!e.length)return;let t=hh(e);t&&t.client.setNotificationHandler(wC(),e=>{let{eventName:t,eventData:n}=e.params;Y(`tengu_ide_${t}`,n)})},[e])}ot(),H();var EC=6e3;function DC(){return Date.now()-et()}function OC(e){return DC()<e}function kC(e){return!OC(e)}function AC(e,t){let n=A();(0,Q.useEffect)(()=>{We(!0)},[]),(0,Q.useEffect)(()=>{let r=!1,i=setInterval(()=>{kC(6e3)&&!r&&(r=!0,clearInterval(i),ah({message:e,notificationType:t},n))},EC);return()=>clearInterval(i)},[e,t,n])}Ki(),fa(),Kc(),Lp(),Nc(),Db(),H(),Fa();var jC={topLeft:`┌`,topRight:`┐`,bottomLeft:`└`,bottomRight:`┘`,horizontal:`─`,vertical:`│`,teeLeft:`├`,teeRight:`┤`};function MC(e){return zl().syntaxHighlightingDisabled?(0,$.jsx)(PC,{...e,highlight:null}):(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(PC,{...e,highlight:null}),children:(0,$.jsx)(NC,{...e})})}function NC(e){let t=(0,Q.use)(Qg());return(0,$.jsx)(PC,{...e,highlight:t})}function PC({content:e,maxLines:t,minHeight:n,minWidth:r=40,maxWidth:i,highlight:a}){let{columns:o}=k(),[s]=ae(),c=i??o-4,l=t??20,u=(0,Q.useMemo)(()=>Zl(e,s,a),[e,s,a]).split(`
2
2
  `),d=u.length>l,f=d?u.slice(0,l):u,p=Math.max(0,Math.min(n??0,l)-f.length-+!!d),m=p>0?[...f,...Array(p).fill(``)]:f,h=Math.max(r,...m.map(e=>D(e))),g=Math.min(h+4,c),_=g-4,v=`${jC.topLeft}${jC.horizontal.repeat(g-2)}${jC.topRight}`,y=`${jC.bottomLeft}${jC.horizontal.repeat(g-2)}${jC.bottomRight}`,b=d?(()=>{let e=u.length-l,t=`${jC.horizontal.repeat(3)} \u2702 ${jC.horizontal.repeat(3)} ${e} lines hidden `,n=D(t),r=Math.max(0,g-2-n);return`${jC.teeLeft}${t}${jC.horizontal.repeat(r)}${jC.teeRight}`})():null;return(0,$.jsxs)(U,{flexDirection:`column`,children:[(0,$.jsx)(R,{dimColor:!0,children:v}),m.map((e,t)=>{let n=D(e)>_?_u(e,0,_):e,r=` `.repeat(Math.max(0,_-D(n)));return(0,$.jsxs)(U,{flexDirection:`row`,children:[(0,$.jsxs)(R,{dimColor:!0,children:[jC.vertical,` `]}),(0,$.jsx)(fe,{children:n}),(0,$.jsxs)(R,{dimColor:!0,children:[r,` `,jC.vertical]})]},t)}),b&&(0,$.jsx)(R,{color:`warning`,children:b}),(0,$.jsx)(R,{dimColor:!0,children:y})]})}nc(),H(),Vi();function FC({questions:e,currentQuestionIndex:t,answers:n,hideSubmitTab:r=!1}){let{columns:i}=k(),a=(0,Q.useMemo)(()=>{let n=r?``:` ${p.tick} Submit `,a=i-(D(`← `)+D(` →`)+D(n));if(a<=0)return e.map((e,n)=>{let r=e?.header||`Q${n+1}`;return n===t?r.slice(0,3):``});let o=e.map((e,t)=>e?.header||`Q${t+1}`);if(o.map(e=>4+D(e)).reduce((e,t)=>e+t,0)<=a)return o;let s=4+D(o[t]||``),c=Math.min(s,a/2),l=a-c,u=e.length-1,d=Math.max(6,Math.floor(l/Math.max(u,1)));return o.map((e,n)=>n===t?Fi(e,c-2-2):Fi(e,d-2-2))},[e,t,i,r]),o=e.length===1&&r;return(0,$.jsxs)(U,{flexDirection:`row`,marginBottom:1,children:[!o&&(0,$.jsx)(R,{color:t===0?`inactive`:void 0,children:`← `}),e.map((e,r)=>{let i=r===t,o=e?.question&&n[e.question]?p.checkboxOn:p.checkboxOff,s=a[r]||e?.header||`Q${r+1}`;return(0,$.jsx)(U,{children:i?(0,$.jsxs)(R,{backgroundColor:`permission`,color:`inverseText`,children:[` `,o,` `,s,` `]}):(0,$.jsxs)(R,{children:[` `,o,` `,s,` `]})},e?.question||`question-${r}`)}),!r&&(0,$.jsx)(U,{children:t===e.length?(0,$.jsxs)(R,{backgroundColor:`permission`,color:`inverseText`,children:[` `,p.tick,` Submit`,` `]}):(0,$.jsxs)(R,{children:[` `,p.tick,` Submit `]})},`submit`),!o&&(0,$.jsx)(R,{color:t===e.length?`inactive`:void 0,children:` →`})]})}f(),nc(),H(),Z(),nl();function IC({question:e,questions:t,currentQuestionIndex:n,answers:r,questionStates:i,hideSubmitTab:a=!1,minContentHeight:o,minContentWidth:s,onUpdateQuestionState:c,onAnswer:l,onTextInputFocus:u,onCancel:d,onTabPrev:f,onTabNext:m,onRespondToClaude:h,onFinishPlanInterview:g}){let _=X(e=>e.toolPermissionContext.mode)===`plan`,[v,y]=(0,Q.useState)(!1),[b,x]=(0,Q.useState)(0),[S,C]=(0,Q.useState)(!1),[w,T]=(0,Q.useState)(0),E=wb(),D=E?Kh(E):null,O=e.question,A=i[O],j=e.options,[M,N]=(0,Q.useState)(0),P=(0,Q.useRef)(O);if(P.current!==O){P.current=O;let e=A?.selectedValue,t=e?j.findIndex(t=>t.label===e):-1;N(t>=0?t:0)}let ee=j[M],F=A?.selectedValue,te=A?.textInputValue||``,ne=(0,Q.useCallback)(e=>{let t=j[e];t&&(N(e),c(O,{selectedValue:t.label},!1),l(O,t.label))},[j,O,c,l]),I=(0,Q.useCallback)(e=>{if(S)return;let t;t=typeof e==`number`?e:e===`up`?M>0?M-1:M:M<j.length-1?M+1:M,t>=0&&t<j.length&&N(t)},[M,j.length,S]);we(`chat:externalEditor`,async()=>{let e=A?.textInputValue||``,t=await Tb(e);t.content!==null&&t.content!==e&&c(O,{textInputValue:t.content},!1)},{context:`Chat`,isActive:S&&!!E}),V({"tabs:previous":()=>f?.(),"tabs:next":()=>m?.()},{context:`Tabs`,isActive:!S&&!v});let re=(0,Q.useCallback)(()=>{C(!1),u(!1),F&&l(O,F)},[F,O,l,u]),L=(0,Q.useCallback)(()=>{y(!0)},[]),ie=(0,Q.useCallback)(()=>{y(!1)},[]),ae=(0,Q.useCallback)(e=>{if(v){if(e.key===`up`||e.ctrl&&e.key===`p`){e.preventDefault(),b===0?ie():x(0);return}if(e.key===`down`||e.ctrl&&e.key===`n`){e.preventDefault(),_&&b===0&&x(1);return}if(e.key===`return`){e.preventDefault(),b===0?h():g();return}e.key===`escape`&&(e.preventDefault(),d());return}if(S){e.key===`escape`&&(e.preventDefault(),re());return}if(e.key===`up`||e.ctrl&&e.key===`p`)e.preventDefault(),M>0&&I(`up`);else if(e.key===`down`||e.ctrl&&e.key===`n`)e.preventDefault(),M===j.length-1?L():I(`down`);else if(e.key===`return`)e.preventDefault(),ne(M);else if(e.key===`n`&&!e.ctrl&&!e.meta)e.preventDefault(),C(!0),u(!0);else if(e.key===`escape`)e.preventDefault(),d();else if(e.key.length===1&&e.key>=`1`&&e.key<=`9`){e.preventDefault();let t=parseInt(e.key,10)-1;t<j.length&&I(t)}},[v,b,_,S,M,j.length,ie,L,I,ne,re,h,g,d,u]),oe=ee?.preview||null,{columns:se}=k(),ce=se-30-4,le=(0,Q.useMemo)(()=>o?Math.max(1,o-11):void 0,[o]);return(0,$.jsxs)(U,{flexDirection:`column`,marginTop:1,tabIndex:0,autoFocus:!0,onKeyDown:ae,children:[(0,$.jsx)(ye,{color:`inactive`}),(0,$.jsxs)(U,{flexDirection:`column`,paddingTop:0,children:[(0,$.jsx)(FC,{questions:t,currentQuestionIndex:n,answers:r,hideSubmitTab:a}),(0,$.jsx)(Nb,{title:e.question,color:`text`}),(0,$.jsxs)(U,{flexDirection:`column`,minHeight:o,children:[(0,$.jsxs)(U,{marginTop:1,flexDirection:`row`,gap:4,children:[(0,$.jsx)(U,{flexDirection:`column`,width:30,children:j.map((e,t)=>{let n=M===t,r=F===e.label;return(0,$.jsxs)(U,{flexDirection:`row`,children:[n?(0,$.jsx)(R,{color:`suggestion`,children:p.pointer}):(0,$.jsx)(R,{children:` `}),(0,$.jsxs)(R,{dimColor:!0,children:[` `,t+1,`.`]}),(0,$.jsxs)(R,{color:r?`success`:n?`suggestion`:void 0,bold:n,children:[` `,e.label]}),r&&(0,$.jsxs)(R,{color:`success`,children:[` `,p.tick]})]},e.label)})}),(0,$.jsxs)(U,{flexDirection:`column`,flexGrow:1,children:[(0,$.jsx)(MC,{content:oe||`No preview available`,maxLines:le,minWidth:s,maxWidth:ce}),(0,$.jsxs)(U,{marginTop:1,flexDirection:`row`,gap:1,children:[(0,$.jsx)(R,{color:`suggestion`,children:`Notes:`}),S?(0,$.jsx)(Dc,{value:te,placeholder:`Add notes on this design…`,onChange:e=>{c(O,{textInputValue:e},!1)},onSubmit:re,onExit:re,focus:!0,showCursor:!0,columns:60,cursorOffset:w,onChangeCursorOffset:T}):(0,$.jsx)(R,{dimColor:!0,italic:!0,children:te||`press n to add notes`})]})]})]}),(0,$.jsxs)(U,{flexDirection:`column`,marginTop:1,children:[(0,$.jsx)(ye,{color:`inactive`}),(0,$.jsxs)(U,{flexDirection:`row`,gap:1,children:[v&&b===0?(0,$.jsx)(R,{color:`suggestion`,children:p.pointer}):(0,$.jsx)(R,{children:` `}),(0,$.jsx)(R,{color:v&&b===0?`suggestion`:void 0,children:`Chat about this`})]}),_&&(0,$.jsxs)(U,{flexDirection:`row`,gap:1,children:[v&&b===1?(0,$.jsx)(R,{color:`suggestion`,children:p.pointer}):(0,$.jsx)(R,{children:` `}),(0,$.jsx)(R,{color:v&&b===1?`suggestion`:void 0,children:`Skip interview and plan immediately`})]})]}),(0,$.jsx)(U,{marginTop:1,children:(0,$.jsxs)(R,{color:`inactive`,dimColor:!0,children:[`Enter to select · `,p.arrowUp,`/`,p.arrowDown,` to navigate · n to add notes`,t.length>1&&(0,$.jsx)($.Fragment,{children:` · Tab to switch questions`}),S&&D&&(0,$.jsxs)($.Fragment,{children:[` · ctrl+g to edit in `,D]}),` · Esc to cancel`]})})]})]})]})}f(),H(),Z(),Cb(),nl(),Db(),of(),jb();function LC({question:e,questions:t,currentQuestionIndex:n,answers:r,questionStates:i,hideSubmitTab:a=!1,planFilePath:o,minContentHeight:s,minContentWidth:c,onUpdateQuestionState:l,onAnswer:u,onTextInputFocus:d,onCancel:f,onSubmit:m,onTabPrev:h,onTabNext:g,onRespondToClaude:_,onFinishPlanInterview:v,onImagePaste:y,pastedContents:b,onRemoveImage:x}){let S=X(e=>e.toolPermissionContext.mode)===`plan`,[C,w]=(0,Q.useState)(!1),[T,E]=(0,Q.useState)(0),[D,O]=(0,Q.useState)(!1),k=wb(),A=k?Kh(k):null,j=(0,Q.useCallback)(e=>{let t=e===`__other__`;O(t),d(t)},[d]),M=(0,Q.useCallback)(()=>{w(!0)},[]),N=(0,Q.useCallback)(()=>{w(!1)},[]),P=(0,Q.useCallback)(e=>{if(C){if(e.key===`up`||e.ctrl&&e.key===`p`){e.preventDefault(),T===0?N():E(0);return}if(e.key===`down`||e.ctrl&&e.key===`n`){e.preventDefault(),S&&T===0&&E(1);return}if(e.key===`return`){e.preventDefault(),T===0?_():v();return}e.key===`escape`&&(e.preventDefault(),f())}},[C,T,S,N,_,v,f]),ee=e.options.map(e=>({type:`text`,value:e.label,label:e.label,description:e.description})),F=e.question,te=i[F],ne=(0,Q.useCallback)(async(t,n)=>{let r=await Tb(t);r.content!==null&&r.content!==t&&(n(r.content),l(F,{textInputValue:r.content},e.multiSelect??!1))},[F,l,e.multiSelect]),I={type:`input`,value:`__other__`,label:`Other`,placeholder:e.multiSelect?`Type something`:`Type something.`,initialValue:te?.textInputValue??``,onChange:t=>{l(F,{textInputValue:t},e.multiSelect??!1)}},re=[...ee,I];return!e.multiSelect&&e.options.some(e=>e.preview)?(0,$.jsx)(IC,{question:e,questions:t,currentQuestionIndex:n,answers:r,questionStates:i,hideSubmitTab:a,minContentHeight:s,minContentWidth:c,onUpdateQuestionState:l,onAnswer:u,onTextInputFocus:d,onCancel:f,onTabPrev:h,onTabNext:g,onRespondToClaude:_,onFinishPlanInterview:v}):(0,$.jsxs)(U,{flexDirection:`column`,marginTop:0,tabIndex:0,autoFocus:!0,onKeyDown:P,children:[S&&o&&(0,$.jsxs)(U,{flexDirection:`column`,gap:0,children:[(0,$.jsx)(ye,{color:`inactive`}),(0,$.jsxs)(R,{color:`inactive`,children:[`Planning: `,(0,$.jsx)(Kp,{filePath:o})]})]}),(0,$.jsx)(U,{marginTop:-1,children:(0,$.jsx)(ye,{color:`inactive`})}),(0,$.jsxs)(U,{flexDirection:`column`,paddingTop:0,children:[(0,$.jsx)(FC,{questions:t,currentQuestionIndex:n,answers:r,hideSubmitTab:a}),(0,$.jsx)(Nb,{title:e.question,color:`text`}),(0,$.jsxs)(U,{flexDirection:`column`,minHeight:s,children:[(0,$.jsx)(U,{marginTop:1,children:e.multiSelect?(0,$.jsx)(pm,{options:re,defaultValue:i[e.question]?.selectedValue,onChange:e=>{l(F,{selectedValue:e},!0);let t=e.includes(`__other__`)?i[F]?.textInputValue:void 0;u(F,e.filter(e=>e!==`__other__`).concat(t?[t]:[]),void 0,!1)},onFocus:j,onCancel:f,submitButtonText:n===t.length-1?`Submit`:`Next`,onSubmit:m,onDownFromLastItem:M,isDisabled:C,onOpenEditor:ne,onImagePaste:y,pastedContents:b,onRemoveImage:x},e.question):(0,$.jsx)(so,{options:re,defaultValue:i[e.question]?.selectedValue,onChange:e=>{l(F,{selectedValue:e},!1),u(F,e,e===`__other__`?i[F]?.textInputValue:void 0)},onFocus:j,onCancel:f,onDownFromLastItem:M,isDisabled:C,layout:`compact-vertical`,onOpenEditor:ne,onImagePaste:y,pastedContents:b,onRemoveImage:x},e.question)}),(0,$.jsxs)(U,{flexDirection:`column`,children:[(0,$.jsx)(ye,{color:`inactive`}),(0,$.jsxs)(U,{flexDirection:`row`,gap:1,children:[C&&T===0?(0,$.jsx)(R,{color:`suggestion`,children:p.pointer}):(0,$.jsx)(R,{children:` `}),(0,$.jsxs)(R,{color:C&&T===0?`suggestion`:void 0,children:[re.length+1,`. Chat about this`]})]}),S&&(0,$.jsxs)(U,{flexDirection:`row`,gap:1,children:[C&&T===1?(0,$.jsx)(R,{color:`suggestion`,children:p.pointer}):(0,$.jsx)(R,{children:` `}),(0,$.jsxs)(R,{color:C&&T===1?`suggestion`:void 0,children:[re.length+2,`. Skip interview and plan immediately`]})]})]}),(0,$.jsx)(U,{marginTop:1,children:(0,$.jsxs)(R,{color:`inactive`,dimColor:!0,children:[`Enter to select ·`,` `,t.length===1?(0,$.jsxs)($.Fragment,{children:[p.arrowUp,`/`,p.arrowDown,` to navigate`]}):`Tab/Arrow keys to navigate`,D&&A&&(0,$.jsxs)($.Fragment,{children:[` · ctrl+g to edit in `,A]}),` · Esc to cancel`]})})]})]})]})}function RC(e,t){if(!e)return null;if(e.type===`classifier`)return e.classifier===`auto-mode`?{reasonString:`Auto mode classifier requires confirmation for this ${t}.\n${e.reason}`,configString:void 0,themeColor:`error`}:{reasonString:`Classifier ${M.bold(e.classifier)} requires confirmation for this ${t}.\n${e.reason}`,configString:void 0};switch(e.type){case`rule`:return{reasonString:`Permission rule ${M.bold(yn(e.rule.ruleValue))} requires confirmation for this ${t}.`,configString:e.rule.source===`policySettings`?void 0:`/permissions to update rules`};case`hook`:{let n=e.reason?`:\n${e.reason}`:`.`,r=e.hookSource?` ${M.dim(`[${e.hookSource}]`)}`:``;return{reasonString:`Hook ${M.bold(e.hookName)} requires confirmation for this ${t}${n}${r}`,configString:`/hooks to update`}}case`safetyCheck`:case`other`:return{reasonString:e.reason,configString:void 0};case`workingDir`:return{reasonString:e.reason,configString:`/permissions to update rules`};default:return null}}function zC({permissionResult:e,toolType:t}){let n=X(e=>e.toolPermissionContext.mode),r=RC(e?.decisionReason,t);if(!r)return null;let i=r.themeColor??(e?.decisionReason?.type===`hook`&&n===`auto`?`warning`:void 0);return(0,BC.jsxs)(U,{marginBottom:1,flexDirection:`column`,children:[i?(0,BC.jsx)(R,{color:i,children:r.reasonString}):(0,BC.jsx)(R,{children:(0,BC.jsx)(fe,{children:r.reasonString})}),r.configString&&(0,BC.jsx)(R,{dimColor:!0,children:r.configString})]})}var BC,VC=t((()=>{L(),H(),Z(),BC=je()}));f(),H(),of(),jb(),VC();function HC({questions:e,currentQuestionIndex:t,answers:n,allQuestionsAnswered:r,permissionResult:i,minContentHeight:a,onFinalResponse:o}){return(0,$.jsxs)(U,{flexDirection:`column`,marginTop:1,children:[(0,$.jsx)(ye,{color:`inactive`}),(0,$.jsxs)(U,{flexDirection:`column`,borderTop:!0,borderColor:`inactive`,paddingTop:0,children:[(0,$.jsx)(FC,{questions:e,currentQuestionIndex:t,answers:n}),(0,$.jsx)(Nb,{title:`Review your answers`,color:`text`}),(0,$.jsxs)(U,{flexDirection:`column`,marginTop:1,minHeight:a,children:[!r&&(0,$.jsx)(U,{marginBottom:1,children:(0,$.jsxs)(R,{color:`warning`,children:[p.warning,` You have not answered all questions`]})}),Object.keys(n).length>0&&(0,$.jsx)(U,{flexDirection:`column`,marginBottom:1,children:e.filter(e=>e?.question&&n[e.question]).map(e=>{let t=n[e?.question];return(0,$.jsxs)(U,{flexDirection:`column`,marginLeft:1,children:[(0,$.jsxs)(R,{children:[p.bullet,` `,e?.question||`Question`]}),(0,$.jsx)(U,{marginLeft:2,children:(0,$.jsxs)(R,{color:`success`,children:[p.arrowRight,` `,t]})})]},e?.question||`answer`)})}),(0,$.jsx)(zC,{permissionResult:i,toolType:`tool`}),(0,$.jsx)(R,{color:`inactive`,children:`Ready to submit your answers?`}),(0,$.jsx)(U,{marginTop:1,children:(0,$.jsx)(so,{options:[{type:`text`,label:`Submit answers`,value:`submit`},{type:`text`,label:`Cancel`,value:`cancel`}],onChange:e=>o(e),onCancel:()=>o(`cancel`)})})]})]})]})}function UC(e,t){switch(t.type){case`next-question`:return{...e,currentQuestionIndex:e.currentQuestionIndex+1,isInTextInput:!1};case`prev-question`:return{...e,currentQuestionIndex:Math.max(0,e.currentQuestionIndex-1),isInTextInput:!1};case`update-question-state`:{let n=e.questionStates[t.questionText],r={selectedValue:t.updates.selectedValue??n?.selectedValue??(t.isMultiSelect?[]:void 0),textInputValue:t.updates.textInputValue??n?.textInputValue??``};return{...e,questionStates:{...e.questionStates,[t.questionText]:r}}}case`set-answer`:{let n={...e,answers:{...e.answers,[t.questionText]:t.answer}};return t.shouldAdvance?{...n,currentQuestionIndex:n.currentQuestionIndex+1,isInTextInput:!1}:n}case`set-text-input-mode`:return{...e,isInTextInput:t.isInInput}}}var WC={currentQuestionIndex:0,answers:{},questionStates:{},isInTextInput:!1};function GC(){let[e,t]=(0,Q.useReducer)(UC,WC),n=(0,Q.useCallback)(()=>{t({type:`next-question`})},[]),r=(0,Q.useCallback)(()=>{t({type:`prev-question`})},[]),i=(0,Q.useCallback)((e,n,r)=>{t({type:`update-question-state`,questionText:e,updates:n,isMultiSelect:r})},[]),a=(0,Q.useCallback)((e,n,r=!0)=>{t({type:`set-answer`,questionText:e,answer:n,shouldAdvance:r})},[]),o=(0,Q.useCallback)(e=>{t({type:`set-text-input-mode`,isInInput:e})},[]);return{currentQuestionIndex:e.currentQuestionIndex,answers:e.answers,questionStates:e.questionStates,isInTextInput:e.isInTextInput,nextQuestion:n,prevQuestion:r,updateQuestionState:i,setAnswer:a,setTextInputMode:o}}jg(),nc(),H(),Jv(),J(),Z(),Vg(),Eu();var KC=12,qC=40,JC=15;function YC(e){return zl().syntaxHighlightingDisabled?(0,$.jsx)(ZC,{...e,highlight:null}):(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(ZC,{...e,highlight:null}),children:(0,$.jsx)(XC,{...e})})}function XC(e){let t=(0,Q.use)(Qg());return(0,$.jsx)(ZC,{...e,highlight:t})}function ZC({toolUseConfirm:e,onDone:t,onReject:n,highlight:r}){let i=(0,Q.useMemo)(()=>To.inputSchema.safeParse(e.input),[e.input]),a=i.success&&i.data.questions||[],{rows:o}=k(),[s]=ae(),{globalContentHeight:c,globalContentWidth:l}=(0,Q.useMemo)(()=>{let e=0,t=0,n=Math.max(KC,o-JC);for(let i of a)if(i.options.some(e=>e.preview)){let a=Math.max(1,n-11),o=0;for(let e of i.options)if(e.preview){let n=Zl(e.preview,s,r).split(`
3
3
  `),i=n.length>a,c=i?a:n.length;o=Math.max(o,c+ +!!i+2);for(let e of n)t=Math.max(t,D(e))}let c=o+2,l=i.options.length+2;e=Math.max(e,Math.max(l,c)+7)}else e=Math.max(e,i.options.length+3+7);return{globalContentHeight:Math.min(Math.max(e,KC),n),globalContentWidth:Math.max(t,qC)}},[a,o,s,r]),u=i.success?i.data.metadata?.source:void 0,[d,f]=(0,Q.useState)({}),p=(0,Q.useRef)(0);function m(e,t,n,r,i,a){let o=p.current++,s={id:o,type:`image`,content:t,mediaType:n||`image/png`,filename:r||`Pasted image`,dimensions:i};Pu(s),xf(s),f(t=>({...t,[e]:{...t[e]??{},[o]:s}}))}let h=(0,Q.useCallback)((e,t)=>{f(n=>{let r={...n[e]??{}};return delete r[t],{...n,[e]:r}})},[]),g=Object.values(d).flatMap(e=>Object.values(e)).filter(e=>e.type===`image`),_=X(e=>e.toolPermissionContext.mode)===`plan`,v=_?__():void 0,{currentQuestionIndex:y,answers:b,questionStates:x,isInTextInput:S,nextQuestion:C,prevQuestion:w,updateQuestionState:T,setAnswer:E,setTextInputMode:O}=GC(),A=y<(a?.length||0)?a?.[y]:null,j=y===(a?.length||0),M=a?.every(e=>e?.question&&!!b[e.question])??!1,N=a.length===1&&!a[0]?.multiSelect,P=(0,Q.useCallback)(()=>{u&&Y(`tengu_ask_user_question_rejected`,{source:u,questionCount:a.length,isInPlanMode:_,interviewPhaseEnabled:_&&Wc()}),t(),n(),e.onReject()},[t,n,e,u,a.length,_]),ee=(0,Q.useCallback)(async()=>{let n=`The user wants to clarify these questions.
4
4
  This means they may have additional information, context or questions for you.
@@ -68,7 +68,7 @@ Parse the user's input into ISO 8601 format. Return ONLY the formatted string, o
68
68
  `)&&(a+=`
69
69
  `),r.setRegister(a,i),e===`yank`)r.setOffset(t);else if(e===`delete`){let e=r.text.slice(0,t)+r.text.slice(n);r.setText(e);let i=Math.max(0,e.length-(ji(e).length||1));r.setOffset(Math.min(t,i))}else if(e===`change`){let e=r.text.slice(0,t)+r.text.slice(n);r.setText(e),r.enterInsert(t)}}function jA(e,t,n){let r=t===1?n.cursor.startOfLastLine():n.cursor.goToLine(t);if(r.equals(n.cursor))return;let i=OA(n.cursor,r,`G`,e,t);AA(e,i.from,i.to,n,i.linewise),n.recordChange({type:`operator`,op:e,motion:`G`,count:t})}function MA(e,t,n){let r=t===1?n.cursor.startOfFirstLine():n.cursor.goToLine(t);if(r.equals(n.cursor))return;let i=OA(n.cursor,r,`gg`,e,t);AA(e,i.from,i.to,n,i.linewise),n.recordChange({type:`operator`,op:e,motion:`gg`,count:t})}var NA={d:`delete`,c:`change`,y:`yank`};function PA(e){return e in NA}var FA=new Set([`h`,`l`,`j`,`k`,`w`,`b`,`e`,`W`,`B`,`E`,`0`,`^`,`$`]),IA=new Set([`f`,`F`,`t`,`T`]),LA={i:`inner`,a:`around`};function RA(e){return e in LA}var zA=new Set([`w`,`W`,`"`,`'`,"`",`(`,`)`,`b`,`[`,`]`,`{`,`}`,`B`,`<`,`>`]),BA=1e4;function VA(){return{mode:`INSERT`,insertedText:``}}function HA(){return{lastChange:null,lastFind:null,register:``,registerIsLinewise:!1}}function UA(e,t,n){switch(e.type){case`idle`:return KA(t,n);case`count`:return qA(e,t,n);case`operator`:return JA(e,t,n);case`operatorCount`:return YA(e,t,n);case`operatorFind`:return XA(e,t,n);case`operatorTextObj`:return ZA(e,t,n);case`find`:return QA(e,t,n);case`g`:return $A(e,t,n);case`operatorG`:return ej(e,t,n);case`replace`:return tj(e,t,n);case`indent`:return nj(e,t,n)}}function WA(e,t,n){return PA(e)?{next:{type:`operator`,op:NA[e],count:t}}:FA.has(e)?{execute:()=>{let r=sA(e,n.cursor,t);n.setOffset(r.offset)}}:IA.has(e)?{next:{type:`find`,find:e,count:t}}:e===`g`?{next:{type:`g`,count:t}}:e===`r`?{next:{type:`replace`,count:t}}:e===`>`||e===`<`?{next:{type:`indent`,dir:e,count:t}}:e===`~`?{execute:()=>SA(t,n)}:e===`x`?{execute:()=>bA(t,n)}:e===`J`?{execute:()=>CA(t,n)}:e===`p`||e===`P`?{execute:()=>wA(e===`p`,t,n)}:e===`D`?{execute:()=>gA(`delete`,`$`,1,n)}:e===`C`?{execute:()=>gA(`change`,`$`,1,n)}:e===`Y`?{execute:()=>yA(`yank`,t,n)}:e===`G`?{execute:()=>{t===1?n.setOffset(n.cursor.startOfLastLine().offset):n.setOffset(n.cursor.goToLine(t).offset)}}:e===`.`?{execute:()=>n.onDotRepeat?.()}:e===`;`||e===`,`?{execute:()=>rj(e===`,`,t,n)}:e===`u`?{execute:()=>n.onUndo?.()}:e===`i`?{execute:()=>n.enterInsert(n.cursor.offset)}:e===`I`?{execute:()=>n.enterInsert(n.cursor.firstNonBlankInLogicalLine().offset)}:e===`a`?{execute:()=>{let e=n.cursor.isAtEnd()?n.cursor.offset:n.cursor.right().offset;n.enterInsert(e)}}:e===`A`?{execute:()=>n.enterInsert(n.cursor.endOfLogicalLine().offset)}:e===`o`?{execute:()=>EA(`below`,n)}:e===`O`?{execute:()=>EA(`above`,n)}:null}function GA(e,t,n,r){return RA(n)?{next:{type:`operatorTextObj`,op:e,count:t,scope:LA[n]}}:IA.has(n)?{next:{type:`operatorFind`,op:e,count:t,find:n}}:FA.has(n)?{execute:()=>gA(e,n,t,r)}:n===`G`?{execute:()=>jA(e,t,r)}:n===`g`?{next:{type:`operatorG`,op:e,count:t}}:null}function KA(e,t){return/[1-9]/.test(e)?{next:{type:`count`,digits:e}}:e===`0`?{execute:()=>t.setOffset(t.cursor.startOfLogicalLine().offset)}:WA(e,1,t)||{}}function qA(e,t,n){if(/[0-9]/.test(t)){let n=e.digits+t;return{next:{type:`count`,digits:String(Math.min(parseInt(n,10),BA))}}}return WA(t,parseInt(e.digits,10),n)||{next:{type:`idle`}}}function JA(e,t,n){return t===e.op[0]?{execute:()=>yA(e.op,e.count,n)}:/[0-9]/.test(t)?{next:{type:`operatorCount`,op:e.op,count:e.count,digits:t}}:GA(e.op,e.count,t,n)||{next:{type:`idle`}}}function YA(e,t,n){if(/[0-9]/.test(t)){let n=e.digits+t,r=Math.min(parseInt(n,10),BA);return{next:{...e,digits:String(r)}}}let r=parseInt(e.digits,10),i=e.count*r;return GA(e.op,i,t,n)||{next:{type:`idle`}}}function XA(e,t,n){return{execute:()=>_A(e.op,e.find,t,e.count,n)}}function ZA(e,t,n){return zA.has(t)?{execute:()=>vA(e.op,e.scope,t,e.count,n)}:{next:{type:`idle`}}}function QA(e,t,n){return{execute:()=>{let r=n.cursor.findCharacter(t,e.find,e.count);r!==null&&(n.setOffset(r),n.setLastFind(e.find,t))}}}function $A(e,t,n){return t===`j`||t===`k`?{execute:()=>{let r=sA(`g${t}`,n.cursor,e.count);n.setOffset(r.offset)}}:t===`g`?e.count>1?{execute:()=>{let t=n.text.split(`
70
70
  `),r=Math.min(e.count-1,t.length-1),i=0;for(let e=0;e<r;e++)i+=(t[e]?.length??0)+1;n.setOffset(i)}}:{execute:()=>n.setOffset(n.cursor.startOfFirstLine().offset)}:{next:{type:`idle`}}}function ej(e,t,n){return t===`j`||t===`k`?{execute:()=>gA(e.op,`g${t}`,e.count,n)}:t===`g`?{execute:()=>MA(e.op,e.count,n)}:{next:{type:`idle`}}}function tj(e,t,n){return t===``?{next:{type:`idle`}}:{execute:()=>xA(t,e.count,n)}}function nj(e,t,n){return t===e.dir?{execute:()=>TA(e.dir,e.count,n)}:{next:{type:`idle`}}}function rj(e,t,n){let r=n.getLastFind();if(!r)return;let i=r.type;e&&(i={f:`F`,F:`f`,t:`T`,T:`t`}[i]);let a=n.cursor.findCharacter(r.char,i,t);a!==null&&n.setOffset(a)}dl(),Ni();function ij(e){let t=Q.useRef(VA()),[n,r]=(0,Q.useState)(`INSERT`),i=Q.useRef(HA()),a=Au({...e,inputFilter:void 0}),{onModeChange:o,inputFilter:s}=e,c=(0,Q.useCallback)(e=>{e!==void 0&&a.setOffset(e),t.current={mode:`INSERT`,insertedText:``},r(`INSERT`),o?.(`INSERT`)},[a,o]),l=(0,Q.useCallback)(()=>{let n=t.current;n.mode===`INSERT`&&n.insertedText&&(i.current.lastChange={type:`insert`,text:n.insertedText});let s=a.offset;s>0&&e.value[s-1]!==`
71
- `&&a.setOffset(s-1),t.current={mode:`NORMAL`,command:{type:`idle`}},r(`NORMAL`),o?.(`NORMAL`)},[o,a,e.value]);function u(t,n=!1){return{cursor:t,text:e.value,setText:t=>e.onChange(t),setOffset:e=>a.setOffset(e),enterInsert:e=>c(e),getRegister:()=>i.current.register,setRegister:(e,t)=>{i.current.register=e,i.current.registerIsLinewise=t},getLastFind:()=>i.current.lastFind,setLastFind:(e,t)=>{i.current.lastFind={type:e,char:t}},recordChange:n?()=>{}:e=>{i.current.lastChange=e}}}function d(){let t=i.current.lastChange;if(!t)return;let n=Vu.fromText(e.value,e.columns,a.offset),r=u(n,!0);switch(t.type){case`insert`:if(t.text){let r=n.insert(t.text);e.onChange(r.text),a.setOffset(r.offset)}break;case`x`:bA(t.count,r);break;case`replace`:xA(t.char,t.count,r);break;case`toggleCase`:SA(t.count,r);break;case`indent`:TA(t.dir,t.count,r);break;case`join`:CA(t.count,r);break;case`openLine`:EA(t.direction,r);break;case`operator`:gA(t.op,t.motion,t.count,r);break;case`operatorFind`:_A(t.op,t.find,t.char,t.count,r);break;case`operatorTextObj`:vA(t.op,t.scope,t.objType,t.count,r);break}}function f(n,r){let i=t.current,o=s?s(n,r):n,c=i.mode===`INSERT`?o:n,f=Vu.fromText(e.value,e.columns,a.offset);if(r.ctrl){a.onInput(c,r);return}if(r.escape&&i.mode===`INSERT`){l();return}if(r.escape&&i.mode===`NORMAL`){t.current={mode:`NORMAL`,command:{type:`idle`}};return}if(r.return){a.onInput(c,r);return}if(i.mode===`INSERT`){r.backspace||r.delete?i.insertedText.length>0&&(t.current={mode:`INSERT`,insertedText:i.insertedText.slice(0,-(ji(i.insertedText).length||1))}):t.current={mode:`INSERT`,insertedText:i.insertedText+c},a.onInput(c,r);return}if(i.mode!==`NORMAL`)return;if(i.command.type===`idle`&&(r.upArrow||r.downArrow||r.leftArrow||r.rightArrow)){a.onInput(c,r);return}let p={...u(f,!1),onUndo:e.onUndo,onDotRepeat:d},m=i.command.type===`idle`||i.command.type===`count`||i.command.type===`operator`||i.command.type===`operatorCount`,h=c;r.leftArrow?h=`h`:r.rightArrow?h=`l`:r.upArrow?h=`k`:r.downArrow?h=`j`:m&&r.backspace?h=`h`:m&&i.command.type!==`count`&&r.delete&&(h=`x`);let g=UA(i.command,h,p);g.execute&&g.execute(),t.current.mode===`NORMAL`&&(g.next?t.current={mode:`NORMAL`,command:g.next}:g.execute&&(t.current={mode:`NORMAL`,command:{type:`idle`}})),c===`?`&&i.mode===`NORMAL`&&i.command.type===`idle`&&e.onChange(`?`)}let p=(0,Q.useCallback)(e=>{e===`INSERT`?t.current={mode:`INSERT`,insertedText:``}:t.current={mode:`NORMAL`,command:{type:`idle`}},r(e),o?.(e)},[o]);return{...a,onInput:f,mode:n,setMode:p}}F(),H();function aj(e){let[t]=ae(),n=le();to(n,!!e.onImagePaste);let r=ij({value:e.value,onChange:e.onChange,onSubmit:e.onSubmit,onExit:e.onExit,onExitMessage:e.onExitMessage,onHistoryReset:e.onHistoryReset,onHistoryUp:e.onHistoryUp,onHistoryDown:e.onHistoryDown,onClearInput:e.onClearInput,focus:e.focus,mask:e.mask,multiline:e.multiline,cursorChar:e.showCursor?` `:``,highlightPastedText:e.highlightPastedText,invert:n?M.inverse:e=>e,themeText:Te(`text`,t),columns:e.columns,maxVisibleLines:e.maxVisibleLines,onImagePaste:e.onImagePaste,disableCursorMovementForUpDownKeys:e.disableCursorMovementForUpDownKeys,disableEscapeDoublePress:e.disableEscapeDoublePress,externalOffset:e.cursorOffset,onOffsetChange:e.onChangeCursorOffset,inputFilter:e.inputFilter,onModeChange:e.onModeChange,onUndo:e.onUndo}),{mode:i,setMode:a}=r;return Q.useEffect(()=>{e.initialMode&&e.initialMode!==i&&a(e.initialMode)},[e.initialMode,i,a]),(0,$.jsx)(U,{flexDirection:`column`,children:(0,$.jsx)(v_,{inputState:r,terminalFocus:n,highlights:e.highlights,...e})})}bv(),vy(),Lg(),ky(),Ix(),s();function oj(e){if(!e)return null;let t=e.input_tokens+e.cache_creation_input_tokens+e.cache_read_input_tokens;return t===0?null:Math.round(e.cache_read_input_tokens/t*100)}function sj(e){return`${e.input_tokens}|${e.cache_creation_input_tokens}|${e.cache_read_input_tokens}`}function cj(e){let t=AS(`sha256`).update(e).digest(`hex`).slice(0,16);return OS(o(),`cache-stats`,`${t}.json`)}var lj={version:1,signature:null,lastResetAt:null,lastHitRate:null};function uj(e){if(typeof e!=`object`||!e)return!1;let t=e;return t.version===1&&(t.signature===null||typeof t.signature==`string`)&&(t.lastResetAt===null||typeof t.lastResetAt==`number`)&&(t.lastHitRate===null||typeof t.lastHitRate==`number`)}async function dj(e){try{let t=await RS(e,`utf8`),n=JSON.parse(t);return uj(n)?n:{...lj}}catch{return{...lj}}}async function fj(e,t){await LS(DS(e),{recursive:!0});let n=`${e}.${process.pid}.tmp`;try{await BS(n,JSON.stringify(t),`utf8`),await zS(n,e)}catch{}}var pj={signature:null,lastResetAt:null,lastHitRate:null},mj=null;async function hj(e){mj=e;let t=await dj(cj(e));pj={signature:t.signature,lastResetAt:t.lastResetAt,lastHitRate:t.lastHitRate}}function gj(e){let t=sj(e),n=oj(e);return t!==pj.signature&&(pj={signature:t,lastResetAt:Date.now(),lastHitRate:n},mj!==null&&fj(cj(mj),{version:1,signature:t,lastResetAt:pj.lastResetAt,lastHitRate:n})),{...pj}}function _j(){return{...pj}}H(),Vi(),nc();function vj(e){let t=e-Date.now()/1e3;if(t<=0)return`now`;let n=Math.floor(t/86400),r=Math.floor(t%86400/3600),i=Math.floor(t%3600/60);return n>=1?`${n}d${r}h`:r>=1?`${r}h${i}m`:`${i}m`}function yj(){return(0,$.jsx)(R,{dimColor:!0,children:` │ `})}function bj({modelName:e,contextUsedPct:t,usedTokens:n,contextWindowSize:r,totalCostUsd:i,rateLimits:a}){let{columns:o}=k(),[s,c]=(0,Q.useState)(0);(0,Q.useEffect)(()=>{if(!((a.five_hour?.resets_at??0)||(a.seven_day?.resets_at??0)))return;let e=setInterval(()=>c(e=>e+1),6e4);return()=>clearInterval(e)},[a.five_hour?.resets_at,a.seven_day?.resets_at]);let l=e.split(` `),u=l.length>=2?`${l[0]} ${l[1]}`:e,d=o<60,f=a.five_hour!=null,p=a.seven_day!=null,m=f?Math.round(a.five_hour.utilization*100):0,h=p?Math.round(a.seven_day.utilization*100):0,g=`${Ii(n)}/${Ii(r)}`;return(0,$.jsxs)(U,{children:[(0,$.jsx)(R,{children:u}),(0,$.jsx)(yj,{}),(0,$.jsx)(R,{dimColor:!0,children:`Context `}),(0,$.jsxs)(R,{children:[t,`%`]}),!d&&(0,$.jsxs)(R,{dimColor:!0,children:[` (`,g,`)`]}),f&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(yj,{}),(0,$.jsx)(R,{dimColor:!0,children:`Session `}),(0,$.jsxs)(R,{children:[m,`%`]}),!d&&a.five_hour.resets_at>0&&(0,$.jsxs)(R,{dimColor:!0,children:[` `,vj(a.five_hour.resets_at)]})]}),p&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(yj,{}),(0,$.jsx)(R,{dimColor:!0,children:`Weekly `}),(0,$.jsxs)(R,{children:[h,`%`]}),!d&&a.seven_day.resets_at>0&&(0,$.jsxs)(R,{dimColor:!0,children:[` `,vj(a.seven_day.resets_at)]})]}),i>0&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(yj,{}),(0,$.jsx)(R,{children:wm(i)})]})]})}var xj=Q.memo(bj);J(),Z(),ot(),Ac(),xd(),Ab(),jg(),H(),Et(),In(),jr(),q(),Go(),Qs(),on(),_a(),Uh();var Sj=3600*1e3;function Cj(e){return String(Math.floor(e)).padStart(2,`0`)}function wj(e){if(e<=0)return`exp`;let t=Math.floor(e/6e4),n=Math.floor(e%6e4/1e3);return`${Cj(t)}:${Cj(n)}`}function Tj({messages:e}){let[t,n]=(0,Q.useState)(()=>Date.now()),[r,i]=(0,Q.useState)(!0),a=Pd(e),o=(0,Q.useRef)(null);if(a!==null){let e=sj(a);e!==o.current&&(o.current=e,gj(a))}let{lastResetAt:s,lastHitRate:c}=_j(),l=s===null?null:t-s,u=l===null?null:Sj-l,d=l===null?null:l/6e4,f=u!==null&&u<=0;(0,Q.useEffect)(()=>{let e=setInterval(()=>n(Date.now()),1e3);return()=>clearInterval(e)},[]);let p=d!==null&&d>=55&&!f;(0,Q.useEffect)(()=>{if(!p){i(!0);return}let e=setInterval(()=>i(e=>!e),500);return()=>clearInterval(e)},[p]);let m=(0,Q.useRef)(!1);(0,Q.useEffect)(()=>{m.current||(m.current=!0,hj(Fe()))},[]);let h=a===null?c:oj(a);if(h===null&&s===null)return(0,$.jsx)(R,{dimColor:!0,children:` Cache --% --:--`});let g=u===null?`--:--`:wj(u),_=h===null?`--%`:`${h}%`,v;return v=f||d===null?`inactive`:d<20?`success`:d<40?`warning`:`error`,(0,$.jsxs)(R,{children:[(0,$.jsx)(R,{dimColor:!0,children:` Cache `}),(0,$.jsx)(R,{color:h!==null&&h>=50?`success`:`inactive`,children:_}),(0,$.jsxs)(R,{color:v,dimColor:p&&!r,children:[` `,g]})]})}function Ej(e){return Ve()||e?.statusLineEnabled===!1?!1:e?.statusLineEnabled===!0||!!e?.statusLine?.command}function Dj(e,t,n,r,i,a,o){let s=_t(),c=Jg(),l=Gn({permissionMode:e,mainLoopModel:a,exceeds200kTokens:t}),u=n?.outputStyle||`default`,d=Pd(r),f=tr(l,yt()),p=On(d,f),m=vp(Fe()),h=uo(),g={...h.five_hour&&{five_hour:{used_percentage:h.five_hour.utilization*100,resets_at:h.five_hour.resets_at}},...h.seven_day&&{seven_day:{used_percentage:h.seven_day.utilization*100,resets_at:h.seven_day.resets_at}}};return{...Ec(),...m&&{session_name:m},model:{id:l,display_name:Rt(l)},workspace:{current_dir:Mr(),project_dir:ft(),added_dirs:i},version:`2.6.0`,output_style:{name:u},cost:{total_cost_usd:Ue(),total_duration_ms:Je(),total_api_duration_ms:Ge(),total_lines_added:Pe(),total_lines_removed:Qe()},context_window:{total_input_tokens:wt(),total_output_tokens:ze(),context_window_size:f,current_usage:d,used_percentage:p.used,remaining_percentage:p.remaining},exceeds_200k_tokens:t,...(g.five_hour||g.seven_day)&&{rate_limits:g},...Nx()&&{vim:{mode:o??`INSERT`}},...s&&{agent:{name:s}},...$e()&&{remote:{session_id:Fe()}},...c&&{worktree:{name:c.worktreeName,path:c.worktreePath,branch:c.worktreeBranch,original_cwd:c.originalCwd,original_branch:c.originalBranch}}}}function Oj(e){return io(e)?.uuid??null}function kj({messagesRef:e,lastAssistantMessageId:t,vimMode:n}){let r=(0,Q.useRef)(void 0),i=X(e=>e.toolPermissionContext.mode),a=X(e=>e.toolPermissionContext.additionalWorkingDirectories),o=X(e=>e.statusLineText),s=Hc(),c=zl(),{addNotification:l}=Wp(),u=kb(),d=(0,Q.useRef)(c);d.current=c;let f=(0,Q.useRef)(n);f.current=n;let p=(0,Q.useRef)(i);p.current=i;let m=(0,Q.useRef)(a);m.current=a;let h=(0,Q.useRef)(u);h.current=u;let g=(0,Q.useRef)({messageId:null,exceeds200kTokens:!1,permissionMode:i,vimMode:n,mainLoopModel:u}),_=(0,Q.useRef)(void 0),v=(0,Q.useRef)(!0),y=(0,Q.useCallback)(async()=>{r.current?.abort();let t=new AbortController;r.current=t;let n=e.current,i=v.current;if(v.current=!1,d.current?.statusLine?.command)try{let e=g.current.exceeds200kTokens,r=Oj(n);r!==g.current.messageId&&(e=Ah(n),g.current.messageId=r,g.current.exceeds200kTokens=e);let a=await cl(Dj(p.current,e,d.current,n,Array.from(m.current.keys()),h.current,f.current),t.signal,void 0,i);t.signal.aborted||s(e=>e.statusLineText===a?e:{...e,statusLineText:a})}catch{}},[e,s]),b=(0,Q.useCallback)(()=>{_.current!==void 0&&clearTimeout(_.current),_.current=setTimeout((e,t)=>{e.current=void 0,t()},300,_,y)},[y]);(0,Q.useEffect)(()=>{(t!==g.current.messageId||i!==g.current.permissionMode||n!==g.current.vimMode||u!==g.current.mainLoopModel)&&(g.current.permissionMode=i,g.current.vimMode=n,g.current.mainLoopModel=u,b())},[t,i,n,u,b]);let x=c?.statusLine?.command,S=(0,Q.useRef)(!0);(0,Q.useEffect)(()=>{if(S.current){S.current=!1;return}v.current=!0,y()},[x,y]),(0,Q.useEffect)(()=>{let e=c?.statusLine;e&&(Y(`tengu_status_line_mount`,{command_length:e.command.length,padding:e.padding}),c.disableAllHooks===!0&&K(`Status line is configured but disableAllHooks is true`,{level:`warn`}),Bn()||(l({key:`statusline-trust-blocked`,text:`statusline skipped · restart to fix`,color:`warning`,priority:`low`}),K(`Status line command skipped: workspace trust not accepted`,{level:`warn`})))},[]),(0,Q.useEffect)(()=>(y(),()=>{r.current?.abort(),_.current!==void 0&&clearTimeout(_.current)}),[]);let C=c?.statusLine?.padding??0,w=Gn({permissionMode:i,mainLoopModel:u,exceeds200kTokens:g.current.exceeds200kTokens}),T=tr(w,yt()),E=Pd(e.current),D=E?E.input_tokens+E.cache_creation_input_tokens+E.cache_read_input_tokens:0,O=E?Math.round(On(E,T).used??0):0,k=uo(),A={...k.five_hour&&{five_hour:{utilization:k.five_hour.utilization,resets_at:k.five_hour.resets_at}},...k.seven_day&&{seven_day:{utilization:k.seven_day.utilization,resets_at:k.seven_day.resets_at}}},j=c?.statusLineEnabled===!0,M=!!c?.statusLine?.command;return(0,$.jsxs)(U,{flexDirection:`column`,paddingX:C,children:[j&&(0,$.jsxs)(U,{gap:2,children:[(0,$.jsx)(xj,{modelName:Rt(w),contextUsedPct:O,usedTokens:D,contextWindowSize:T,totalCostUsd:Ue(),rateLimits:A}),(0,$.jsx)(Tj,{messages:e.current})]}),o?(0,$.jsx)(R,{dimColor:!0,wrap:`truncate`,children:(0,$.jsx)(fe,{children:o})}):M&&Sh()?(0,$.jsx)(R,{children:` `}):null]})}var Aj=(0,Q.memo)(kj);xc();function jj(e,t,n,r,i=!0){let a=e.length;if(a===0)return{startIndex:0,endIndex:0,showLeftArrow:!1,showRightArrow:!1};let o=Math.max(0,Math.min(r,a-1));if(e.reduce((e,t)=>e+t,0)<=t)return{startIndex:0,endIndex:a,showLeftArrow:!1,showRightArrow:!1};let s=[0];for(let t=0;t<a;t++)s.push(s[t]+e[t]);function c(e,t){let n=s[t]-s[e];return i&&e>0?n-1:n}function l(e,r){let i=t;return e>0&&(i-=n),r<a&&(i-=n),i}let u=0,d=1;for(;d<a&&c(u,d+1)<=l(u,d+1);)d++;if(o>=u&&o<d)return{startIndex:u,endIndex:d,showLeftArrow:u>0,showRightArrow:d<a};if(o>=d)for(d=o+1,u=o;u>0&&c(u-1,d)<=l(u-1,d);)u--;else for(u=o,d=o+1;d<a&&c(u,d+1)<=l(u,d+1);)d++;return{startIndex:u,endIndex:d,showLeftArrow:u>0,showRightArrow:d<a}}f(),nc(),H(),Z(),Yx(),yo(),Hu(),eS();function Mj({tasksSelected:e,isViewingTeammate:t,teammateFooterIndex:n=0,isLeaderIdle:r=!1,onOpenDialog:i}){let a=Hc(),{columns:o}=k(),s=X(e=>e.tasks),c=X(e=>e.viewingAgentTaskId),l=(0,Q.useMemo)(()=>Object.values(s??{}).filter(e=>mc(e)&&!(process.env.USER_TYPE===`ant`&&Lc(e))),[s]),u=X(e=>e.expandedView)===`teammates`,d=!u&&l.length>0&&l.every(e=>e.type===`in_process_teammate`),f=(0,Q.useMemo)(()=>l.filter(e=>e.type===`in_process_teammate`).sort((e,t)=>e.identity.agentName.localeCompare(t.identity.agentName)),[l]),m=(0,Q.useMemo)(()=>{let t={name:`main`,color:void 0,isIdle:r,taskId:void 0},n=f.map(e=>({name:e.identity.agentName,color:Fj(e.identity.color),isIdle:e.isIdle,taskId:e.id}));return e||n.sort((e,t)=>e.isIdle===t.isIdle?0:e.isIdle?1:-1),[t,...n].map((e,t)=>({...e,idx:t}))},[f,r,e]),h=(0,Q.useMemo)(()=>m.map((e,t)=>D(`@${e.name}`)+ +(t>0)),[m]);if(d||!u&&t){let t=e?n:-1,r=c?f.findIndex(e=>e.id===c)+1:0,{startIndex:i,endIndex:s,showLeftArrow:l,showRightArrow:u}=jj(h,Math.max(20,o-20-4),2,t>=0?t:0),d=m.slice(i,s);return(0,$.jsxs)($.Fragment,{children:[l&&(0,$.jsxs)(R,{dimColor:!0,children:[p.arrowLeft,` `]}),d.map((e,n)=>{let i=n>0;return(0,$.jsxs)(Q.Fragment,{children:[i&&(0,$.jsx)(R,{children:` `}),(0,$.jsx)(Nj,{name:e.name,color:e.color,isSelected:t===e.idx,isViewed:r===e.idx,isIdle:e.isIdle,onClick:()=>e.taskId?$x(e.taskId,a):tS(a)})]},e.name)}),u&&(0,$.jsxs)(R,{dimColor:!0,children:[` `,p.arrowRight]}),(0,$.jsxs)(R,{dimColor:!0,children:[` · `,(0,$.jsx)(he,{shortcut:`shift + ↓`,action:`expand`})]})]})}return Jx(s??{},u)||l.length===0?null:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Pj,{selected:e,onClick:i,children:lc(l)}),Gc(l)&&(0,$.jsxs)(R,{dimColor:!0,children:[` · `,p.arrowDown,` to view`]})]})}function Nj({name:e,color:t,isSelected:n,isViewed:r,isIdle:i,onClick:a}){let[o,s]=(0,Q.useState)(!1),c=n||o,l;return l=c?t?(0,$.jsxs)(R,{backgroundColor:t,color:`inverseText`,bold:r,children:[`@`,e]}):(0,$.jsxs)(R,{color:`background`,inverse:!0,bold:r,children:[`@`,e]}):i?(0,$.jsxs)(R,{dimColor:!0,bold:r,children:[`@`,e]}):r?(0,$.jsxs)(R,{color:t,bold:!0,children:[`@`,e]}):(0,$.jsxs)(R,{color:t,dimColor:!t,children:[`@`,e]}),a?(0,$.jsx)(U,{onClick:a,onMouseEnter:()=>s(!0),onMouseLeave:()=>s(!1),children:l}):l}function Pj({selected:e,onClick:t,children:n}){let[r,i]=(0,Q.useState)(!1),a=(0,$.jsx)(R,{color:`background`,inverse:e||r,children:n});return t?(0,$.jsx)(U,{onClick:t,onMouseEnter:()=>i(!0),onMouseLeave:()=>i(!1),children:a}):a}function Fj(e){if(e&&Ch.includes(e))return Ns[e]}H(),Z();function Ij({teamsSelected:e,showHint:t}){let n=X(e=>e.teamContext),r=n?Object.values(n.teammates).filter(e=>e.name!==`team-lead`).length:0;if(r===0)return null;let i=t&&e?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(R,{dimColor:!0,children:`· `}),(0,$.jsx)(R,{dimColor:!0,children:`Enter to view`})]}):null;return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(R,{color:`background`,inverse:e,children:`${r} ${r===1?`teammate`:`teammates`}`},e?`selected`:`normal`),i?(0,$.jsxs)(R,{children:[` `,i]}):null]})}H(),Xc();function Lj({value:e,onChange:t,historyFailedMatch:n}){return(0,$.jsxs)(U,{gap:1,children:[(0,$.jsx)(R,{dimColor:!0,children:n?`no matching prompt:`:`search prompts:`}),(0,$.jsx)(Dc,{value:e,onChange:t,cursorOffset:e.length,onChangeCursorOffset:()=>{},columns:D(e)+1,focus:!0,showCursor:!0,multiline:!1,dimColor:!0})]})}mi(),zr(),kr();var Rj=5e3;function zj(e,t){if(e)return`draft`;switch(t){case`APPROVED`:return`approved`;case`CHANGES_REQUESTED`:return`changes_requested`;default:return`pending`}}async function Bj(){if(!await Lr())return null;let[e,t]=await Promise.all([Rr(),Ir()]);if(e===t)return null;let{stdout:n,code:r}=await hi(`gh`,[`pr`,`view`,`--json`,`number,url,reviewDecision,isDraft,headRefName,state`],{timeout:Rj,preserveOutputOnError:!1});if(r!==0||!n.trim())return null;try{let e=xr(n);return e.headRefName===t||e.headRefName===`main`||e.headRefName===`master`||e.state===`MERGED`||e.state===`CLOSED`?null:{number:e.number,url:e.url,reviewState:zj(e.isDraft,e.reviewDecision)}}catch{return null}}ot();var Vj=6e4,Hj=4e3,Uj=60*6e4,Wj={number:null,url:null,reviewState:null,lastUpdated:0};function Gj(e,t=!0){let[n,r]=(0,Q.useState)(Wj),i=(0,Q.useRef)(null),a=(0,Q.useRef)(!1),o=(0,Q.useRef)(0);return(0,Q.useEffect)(()=>{if(!t||a.current)return;let e=!1,n=-1,s=Date.now();async function c(){if(e)return;let t=et();if(n!==t)n=t,s=Date.now();else if(Date.now()-s>=Uj)return;let l=Date.now(),u=await Bj();if(!e){if(o.current=l,r(e=>{let t=u?.number??null,n=u?.reviewState??null;return e.number===t&&e.reviewState===n?e:{number:t,url:u?.url??null,reviewState:n,lastUpdated:Date.now()}}),Date.now()-l>Hj){a.current=!0;return}e||(i.current=setTimeout(c,Vj))}}let l=Date.now()-o.current;return l>=Vj?c():i.current=setTimeout(c,Vj-l),()=>{e=!0,i.current&&(clearTimeout(i.current),i.current=null)}},[e,t]),n}H(),f(),Ix(),Bu(),$t(),Hp(),yo(),Ai(),eS(),ir(),Ml(),Z(),ot(),nc(),Vi(),JD(),AD(),Cu(),Go(),Et(),si(),ps();var Kj=(Gd(),e(Lh)),qj=(dv(),e(ev)),Jj=e=>()=>{},Yj=()=>null,Xj=3,Zj=5e3;function Qj(){let[e,t]=(0,Q.useState)(null);return(0,Q.useEffect)(()=>{function e(){let e=process.memoryUsage().rss/(1024*1024),n=e>=1024?`error`:e>=512?`warning`:`normal`,r=Ri(e*1024*1024);t(e=>e?.text===r?e:{text:r,level:n})}e();let n=setInterval(e,Zj);return()=>clearInterval(n)},[]),e}function $j(){let e=(0,Q.useSyncExternalStore)(qj?.subscribeToProactiveChanges??Jj,qj?.getNextTickAt??Yj,Yj),[t,n]=(0,Q.useState)(null);return(0,Q.useEffect)(()=>{if(e===null){n(null);return}function t(){n(Math.max(0,Math.ceil((e-Date.now())/1e3)))}t();let r=setInterval(t,1e3);return()=>clearInterval(r)},[e]),t===null?null:(0,$.jsxs)(R,{dimColor:!0,children:[`waiting `,Li(t*1e3,{mostSignificantOnly:!0})]})}function eM({exitMessage:e,vimMode:t,mode:n,toolPermissionContext:r,suppressHint:i,isLoading:a,tasksSelected:o,teamsSelected:s,tmuxSelected:c,teammateFooterIndex:l,isPasting:u,isSearching:d,historyQuery:f,setHistoryQuery:p,historyFailedMatch:m,onOpenTasksDialog:h}){if(e.show)return(0,$.jsxs)(R,{dimColor:!0,children:[`Press `,e.key,` again to exit`]},`exit-message`);if(u)return(0,$.jsx)(R,{dimColor:!0,children:`Pasting text…`},`pasting-message`);let g=Nx()&&t===`INSERT`&&!d;return(0,$.jsxs)(U,{justifyContent:`flex-start`,gap:1,children:[d&&(0,$.jsx)(Lj,{value:f,onChange:p,historyFailedMatch:m}),g?(0,$.jsx)(R,{dimColor:!0,children:`-- INSERT --`},`vim-insert`):null,(0,$.jsx)(tM,{mode:n,toolPermissionContext:r,showHint:!i&&!g,isLoading:a,tasksSelected:o,teamsSelected:s,teammateFooterIndex:l,tmuxSelected:c,onOpenTasksDialog:h})]})}function tM({mode:e,toolPermissionContext:t,showHint:n,isLoading:r,tasksSelected:i,teamsSelected:a,tmuxSelected:o,teammateFooterIndex:s,onOpenTasksDialog:c}){let{columns:l}=k(),u=pd(`chat:cycleMode`,`Chat`,`shift+tab`),d=X(e=>e.tasks),f=X(e=>e.teamContext),m=gc(),[h]=(0,Q.useState)(()=>m.getState().remoteSessionUrl),g=X(e=>e.viewSelectionMode),_=X(e=>e.viewingAgentTaskId),v=X(e=>e.expandedView),y=v===`teammates`,b=Gj(r,rM()),x=X(e=>process.env.USER_TYPE===`ant`&&e.tungstenActiveSession!==void 0),S=(0,Q.useSyncExternalStore)(qj?.subscribeToProactiveChanges??Jj,qj?.getNextTickAt??Yj,Yj),C=OD(),w=ph(e=>e.voiceState),T=ph(e=>e.voiceWarmingUp),E=j(),D=ee().getState,O=S!==null,A=Kj?.isCoordinatorMode()===!0,M=(0,Q.useMemo)(()=>xi(Object.values(d),e=>mc(e)&&!(process.env.USER_TYPE===`ant`&&Lc(e))),[d]),N=os(),P=N!==void 0&&N.length>0,F=pd(`chat:cancel`,`Chat`,`esc`).toLowerCase(),te=pd(`app:toggleTodos`,`Global`,`ctrl+t`),ne=pd(`chat:killAgents`,`Chat`,`ctrl+x ctrl+k`),I=pd(`voice:pushToTalk`,`Chat`,`Space`),[L]=(0,Q.useState)(()=>(pn().voiceFooterHintSeenCount??0)<Xj),ie=L,ae=(0,Q.useRef)(!1);(0,Q.useEffect)(()=>{{if(!C||!ie||ae?.current)return;ae&&(ae.current=!0);let e=(pn().voiceFooterHintSeenCount??0)+1;rn(t=>(t.voiceFooterHintSeenCount??0)>=e?t:{...t,voiceFooterHintSeenCount:e})}},[C,ie]);let oe=X(e=>e.notifications.current?.key===`kill-agents-confirm`),se=Qj(),ce=Un()&&!Ha()&&f!==void 0&&xi(Object.values(f.teammates),e=>e.name!==`team-lead`)>0;if(e===`bash`)return(0,$.jsx)(R,{color:`bashBorder`,children:`! for bash mode`});let le=t?.mode,ue=!sn(le),fe=_?d[_]:void 0,pe=g===`viewing-agent`&&fe?.type===`in_process_teammate`,me=pe&&fe!=null&&fe.status!==`running`,z=M>0||pe,B=(A||ue?1:0)+ +!!z+ +!!ce,ge=rM()&&b.number!==null&&b.reviewState!==null&&b.url!==null&&B<2&&(B===0||l>=80),ve=B<2,ye=!y&&z&&Object.values(d).some(e=>e.type===`in_process_teammate`)||!y&&pe,V=le&&ue&&!$e()?(0,$.jsxs)(R,{color:Xt(le),children:[_r(le),` `,kt(le).toLowerCase(),` on`,ve&&(0,$.jsxs)(R,{dimColor:!0,children:[` `,(0,$.jsx)(he,{shortcut:u,action:`cycle`,parens:!0})]})]},`mode`):null,be=[...h?[(0,$.jsx)(re,{url:h,children:(0,$.jsxs)(R,{color:`ide`,children:[p.circleDouble,` remote`]})},`remote`)]:[],...process.env.USER_TYPE===`ant`&&x?[(0,$.jsx)(TungstenPill,{selected:o},`tmux`)]:[],...Un()&&ce?[(0,$.jsx)(Ij,{teamsSelected:a,showHint:n&&!z},`teams`)]:[],...ge?[(0,$.jsx)(Eo,{number:b.number,url:b.url,reviewState:b.reviewState},`pr-status`)]:[],...se?[(0,$.jsxs)(R,{dimColor:se.level===`normal`,color:se.level===`error`?`error`:se.level===`warning`?`warning`:void 0,children:[se.text,` · pid:`,process.pid]},`rss`)]:[]],xe=Object.values(d).some(e=>e.type===`in_process_teammate`&&e.status===`running`),Se=Object.values(d).some(e=>e.type===`local_agent`&&e.status===`running`),H=n?nM(r,F,te,ne,P,v,xe,Se,oe):[];if(me?be.push((0,$.jsx)(R,{dimColor:!0,children:(0,$.jsx)(he,{shortcut:F,action:`return to team lead`})},`esc-return`)):O?be.push((0,$.jsx)($j,{},`proactive`)):!ye&&n&&be.push(...H),ye){let e=[...V?[V]:[],...be,...me?[]:H];return(0,$.jsxs)(U,{flexDirection:`column`,children:[(0,$.jsx)(U,{children:(0,$.jsx)(Mj,{tasksSelected:i,isViewingTeammate:pe,teammateFooterIndex:s,isLeaderIdle:!r,onOpenDialog:c})}),e.length>0&&(0,$.jsx)(U,{children:(0,$.jsx)(_e,{children:e})})]})}let Ce=process.env.USER_TYPE===`ant`&&Uk(d).length>0,we=z&&!ye&&!Jx(d,y)?(0,$.jsx)(Mj,{tasksSelected:i,isViewingTeammate:pe,teammateFooterIndex:s,isLeaderIdle:!r,onOpenDialog:c}):null;be.length===0&&!we&&!V&&n&&be.push((0,$.jsx)(R,{dimColor:!0,children:`? for shortcuts`},`shortcuts-hint`));let Te=pn().copyOnSelect??!0,Ee=E&&(!Te||de());if(C&&T)be.push((0,$.jsx)(HD,{},`voice-warmup`));else if(Sh()&&Ee){let e=oi()===`macos`,t=e&&(D()?.lastPressHadAlt??!1);be.push((0,$.jsx)(R,{dimColor:!0,children:(0,$.jsxs)(_e,{children:[!Te&&(0,$.jsx)(he,{shortcut:`ctrl+c`,action:`copy`}),de()&&(t?(0,$.jsx)(R,{children:`set macOptionClickForcesSelection in VS Code settings`}):(0,$.jsx)(he,{shortcut:e?`option+click`:`shift+click`,action:`native select`}))]})},`selection-copy`))}else be.length>0&&n&&C&&w===`idle`&&H.length===0&&ie&&be.push((0,$.jsxs)(R,{dimColor:!0,children:[`hold `,I,` to speak`]},`voice-hint`));return(we||Ce)&&n&&!ce&&be.push((0,$.jsx)(R,{dimColor:!0,children:i?(0,$.jsx)(he,{shortcut:`Enter`,action:`view tasks`}):(0,$.jsx)(he,{shortcut:`↓`,action:`manage`})},`manage-tasks`)),be.length===0&&!we&&!V?Sh()?(0,$.jsx)(R,{children:` `}):null:(0,$.jsxs)(U,{height:1,overflow:`hidden`,children:[V&&(0,$.jsxs)(U,{flexShrink:0,children:[V,(we||be.length>0)&&(0,$.jsx)(R,{dimColor:!0,children:` · `})]}),we&&(0,$.jsxs)(U,{flexShrink:0,children:[we,be.length>0&&(0,$.jsx)(R,{dimColor:!0,children:` · `})]}),be.length>0&&(0,$.jsx)(R,{wrap:`truncate`,children:(0,$.jsx)(_e,{children:be})})]})}function nM(e,t,n,r,i,a,o,s,c){let l;if(o)switch(a){case`none`:l=`show tasks`;break;case`tasks`:l=`show teammates`;break;case`teammates`:l=`hide`;break}else l=a===`tasks`?`hide tasks`:`show tasks`;let u=i||o;return[...e?[(0,$.jsx)(R,{dimColor:!0,children:(0,$.jsx)(he,{shortcut:t,action:`interrupt`})},`esc`)]:[],...!e&&s&&!c?[(0,$.jsx)(R,{dimColor:!0,children:(0,$.jsx)(he,{shortcut:r,action:`stop agents`})},`kill-agents`)]:[],...u?[(0,$.jsx)(R,{dimColor:!0,children:(0,$.jsx)(he,{shortcut:n,action:l})},`toggle-tasks`)]:[]]}function rM(){return pn().prStatusFooterEnabled??!0}am(),jg(),nc(),H(),Qp(),Z(),Go(),yb(),Fx();function iM({apiKeyStatus:e,debug:t,exitMessage:n,vimMode:r,mode:i,autoUpdaterResult:a,isAutoUpdating:o,verbose:s,onAutoUpdaterResult:c,onChangeIsUpdating:l,suggestions:u,selectedSuggestion:d,maxColumnWidth:f,toolPermissionContext:p,helpOpen:m,suppressHint:h,isLoading:g,tasksSelected:_,teamsSelected:v,bridgeSelected:y,tmuxSelected:b,teammateFooterIndex:x,ideSelection:S,mcpClients:C,isPasting:w=!1,isInputWrapped:T=!1,messages:E,isSearching:D,historyQuery:O,setHistoryQuery:A,historyFailedMatch:j,onOpenTasksDialog:M}){let N=zl(),{columns:P,rows:ee}=k(),F=(0,Q.useRef)(E);F.current=E;let te=(0,Q.useMemo)(()=>Oj(E),[E]),ne=P<80,I=Sh(),re=I&&ee<24,L=Gk(),ie=X(e=>e.coordinatorTaskIndex),ae=_&&(L===0||ie<0),oe=h||Ej(N)||D;return mx((0,Q.useMemo)(()=>I&&u.length?{suggestions:u,selectedSuggestion:d,maxColumnWidth:f}:null,[I,u,d,f])),u.length&&!I?(0,$.jsx)(U,{paddingX:2,paddingY:0,children:(0,$.jsx)(bb,{suggestions:u,selectedSuggestion:d,maxColumnWidth:f})}):m?(0,$.jsx)(Lx,{dimColor:!0,fixedWidth:!0,paddingX:2}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(U,{flexDirection:ne?`column`:`row`,justifyContent:ne?`flex-start`:`space-between`,paddingX:2,gap:+!ne,children:[(0,$.jsxs)(U,{flexDirection:`column`,flexShrink:+!ne,children:[i===`prompt`&&!re&&!n.show&&!w&&Ej(N)&&(0,$.jsx)(Aj,{messagesRef:F,lastAssistantMessageId:te,vimMode:r}),(0,$.jsx)(sM,{}),(0,$.jsx)(eM,{exitMessage:n,vimMode:r,mode:i,toolPermissionContext:p,suppressHint:oe,isLoading:g,tasksSelected:ae,teamsSelected:v,teammateFooterIndex:x,tmuxSelected:b,isPasting:w,isSearching:D,historyQuery:O,setHistoryQuery:A,historyFailedMatch:j,onOpenTasksDialog:M})]}),(0,$.jsxs)(U,{flexShrink:1,gap:1,children:[I?null:(0,$.jsx)(ZD,{apiKeyStatus:e,autoUpdaterResult:a,debug:t,isAutoUpdating:o,verbose:s,messages:E,onAutoUpdaterResult:c,onChangeIsUpdating:l,ideSelection:S,mcpClients:C,isInputWrapped:T,isNarrow:ne}),process.env.USER_TYPE===`ant`&&yy()&&(0,$.jsx)(R,{dimColor:!0,children:`undercover`}),(0,$.jsx)(oM,{bridgeSelected:y})]})]}),process.env.USER_TYPE===`ant`&&(0,$.jsx)(Wk,{})]})}var aM=(0,Q.memo)(iM);function oM({bridgeSelected:e}){let t=X(e=>e.replBridgeEnabled),n=X(e=>e.replBridgeConnected),r=X(e=>e.replBridgeSessionActive),i=X(e=>e.replBridgeReconnecting),a=X(e=>e.replBridgeExplicit);if(!uy()||!t)return null;let o=Xd({error:void 0,connected:n,sessionActive:r,reconnecting:i});return!a&&o.label!==`Remote Control reconnecting`?null:(0,$.jsxs)(R,{color:e?`background`:o.color,inverse:e,wrap:`truncate`,children:[o.label,e&&(0,$.jsx)(R,{dimColor:!0,children:` · Enter to view`})]})}function sM(){return null}f(),H(),Hu(),wi(),ir();function cM(){if(!Un())return;let e=Ei();if(e&&Ch.includes(e))return Ns[e]}function lM({isLoading:e,themeColor:t}){let n=t,r=process.env.USER_TYPE===`ant`;return(0,$.jsxs)(R,{color:n??(r?`subtle`:void 0),dimColor:e,children:[p.pointer,`\xA0`]})}function uM({mode:e,isLoading:t,viewingAgentName:n,viewingAgentColor:r}){let i=cM(),a=r?Ns[r]:void 0;return(0,$.jsx)(U,{alignItems:`flex-start`,alignSelf:`flex-start`,flexWrap:`nowrap`,justifyContent:`flex-start`,children:n?(0,$.jsx)(lM,{isLoading:t,themeColor:a}):e===`bash`?(0,$.jsx)(R,{color:`bashBorder`,dimColor:t,children:`!\xA0`}):(0,$.jsx)(lM,{isLoading:t,themeColor:Un()?i:void 0})})}H(),Z(),Mg(),up(),Qs(),kr(),qp();var dM=new Set;function fM(e){try{return xr(e)?.type===`idle_notification`}catch{return!1}}var pM=3;function mM(e){return`<${ni}>
71
+ `&&a.setOffset(s-1),t.current={mode:`NORMAL`,command:{type:`idle`}},r(`NORMAL`),o?.(`NORMAL`)},[o,a,e.value]);function u(t,n=!1){return{cursor:t,text:e.value,setText:t=>e.onChange(t),setOffset:e=>a.setOffset(e),enterInsert:e=>c(e),getRegister:()=>i.current.register,setRegister:(e,t)=>{i.current.register=e,i.current.registerIsLinewise=t},getLastFind:()=>i.current.lastFind,setLastFind:(e,t)=>{i.current.lastFind={type:e,char:t}},recordChange:n?()=>{}:e=>{i.current.lastChange=e}}}function d(){let t=i.current.lastChange;if(!t)return;let n=Vu.fromText(e.value,e.columns,a.offset),r=u(n,!0);switch(t.type){case`insert`:if(t.text){let r=n.insert(t.text);e.onChange(r.text),a.setOffset(r.offset)}break;case`x`:bA(t.count,r);break;case`replace`:xA(t.char,t.count,r);break;case`toggleCase`:SA(t.count,r);break;case`indent`:TA(t.dir,t.count,r);break;case`join`:CA(t.count,r);break;case`openLine`:EA(t.direction,r);break;case`operator`:gA(t.op,t.motion,t.count,r);break;case`operatorFind`:_A(t.op,t.find,t.char,t.count,r);break;case`operatorTextObj`:vA(t.op,t.scope,t.objType,t.count,r);break}}function f(n,r){let i=t.current,o=s?s(n,r):n,c=i.mode===`INSERT`?o:n,f=Vu.fromText(e.value,e.columns,a.offset);if(r.ctrl){a.onInput(c,r);return}if(r.escape&&i.mode===`INSERT`){l();return}if(r.escape&&i.mode===`NORMAL`){t.current={mode:`NORMAL`,command:{type:`idle`}};return}if(r.return){a.onInput(c,r);return}if(i.mode===`INSERT`){r.backspace||r.delete?i.insertedText.length>0&&(t.current={mode:`INSERT`,insertedText:i.insertedText.slice(0,-(ji(i.insertedText).length||1))}):t.current={mode:`INSERT`,insertedText:i.insertedText+c},a.onInput(c,r);return}if(i.mode!==`NORMAL`)return;if(i.command.type===`idle`&&(r.upArrow||r.downArrow||r.leftArrow||r.rightArrow)){a.onInput(c,r);return}let p={...u(f,!1),onUndo:e.onUndo,onDotRepeat:d},m=i.command.type===`idle`||i.command.type===`count`||i.command.type===`operator`||i.command.type===`operatorCount`,h=c;r.leftArrow?h=`h`:r.rightArrow?h=`l`:r.upArrow?h=`k`:r.downArrow?h=`j`:m&&r.backspace?h=`h`:m&&i.command.type!==`count`&&r.delete&&(h=`x`);let g=UA(i.command,h,p);g.execute&&g.execute(),t.current.mode===`NORMAL`&&(g.next?t.current={mode:`NORMAL`,command:g.next}:g.execute&&(t.current={mode:`NORMAL`,command:{type:`idle`}})),c===`?`&&i.mode===`NORMAL`&&i.command.type===`idle`&&e.onChange(`?`)}let p=(0,Q.useCallback)(e=>{e===`INSERT`?t.current={mode:`INSERT`,insertedText:``}:t.current={mode:`NORMAL`,command:{type:`idle`}},r(e),o?.(e)},[o]);return{...a,onInput:f,mode:n,setMode:p}}F(),H();function aj(e){let[t]=ae(),n=le();to(n,!!e.onImagePaste);let r=ij({value:e.value,onChange:e.onChange,onSubmit:e.onSubmit,onExit:e.onExit,onExitMessage:e.onExitMessage,onHistoryReset:e.onHistoryReset,onHistoryUp:e.onHistoryUp,onHistoryDown:e.onHistoryDown,onClearInput:e.onClearInput,focus:e.focus,mask:e.mask,multiline:e.multiline,cursorChar:e.showCursor?` `:``,highlightPastedText:e.highlightPastedText,invert:n?M.inverse:e=>e,themeText:Te(`text`,t),columns:e.columns,maxVisibleLines:e.maxVisibleLines,onImagePaste:e.onImagePaste,disableCursorMovementForUpDownKeys:e.disableCursorMovementForUpDownKeys,disableEscapeDoublePress:e.disableEscapeDoublePress,externalOffset:e.cursorOffset,onOffsetChange:e.onChangeCursorOffset,inputFilter:e.inputFilter,onModeChange:e.onModeChange,onUndo:e.onUndo}),{mode:i,setMode:a}=r;return Q.useEffect(()=>{e.initialMode&&e.initialMode!==i&&a(e.initialMode)},[e.initialMode,i,a]),(0,$.jsx)(U,{flexDirection:`column`,children:(0,$.jsx)(v_,{inputState:r,terminalFocus:n,highlights:e.highlights,...e})})}bv(),vy(),Lg(),ky(),Ix(),s();function oj(e){if(!e)return null;let t=e.input_tokens+e.cache_creation_input_tokens+e.cache_read_input_tokens;return t===0?null:Math.round(e.cache_read_input_tokens/t*100)}function sj(e){return`${e.input_tokens}|${e.cache_creation_input_tokens}|${e.cache_read_input_tokens}`}function cj(e){let t=AS(`sha256`).update(e).digest(`hex`).slice(0,16);return OS(o(),`cache-stats`,`${t}.json`)}var lj={version:1,signature:null,lastResetAt:null,lastHitRate:null};function uj(e){if(typeof e!=`object`||!e)return!1;let t=e;return t.version===1&&(t.signature===null||typeof t.signature==`string`)&&(t.lastResetAt===null||typeof t.lastResetAt==`number`)&&(t.lastHitRate===null||typeof t.lastHitRate==`number`)}async function dj(e){try{let t=await RS(e,`utf8`),n=JSON.parse(t);return uj(n)?n:{...lj}}catch{return{...lj}}}async function fj(e,t){await LS(DS(e),{recursive:!0});let n=`${e}.${process.pid}.tmp`;try{await BS(n,JSON.stringify(t),`utf8`),await zS(n,e)}catch{}}var pj={signature:null,lastResetAt:null,lastHitRate:null},mj=null;async function hj(e){mj=e;let t=await dj(cj(e));pj={signature:t.signature,lastResetAt:t.lastResetAt,lastHitRate:t.lastHitRate}}function gj(e){let t=sj(e),n=oj(e);return t!==pj.signature&&(pj={signature:t,lastResetAt:Date.now(),lastHitRate:n},mj!==null&&fj(cj(mj),{version:1,signature:t,lastResetAt:pj.lastResetAt,lastHitRate:n})),{...pj}}function _j(){return{...pj}}H(),Vi(),nc();function vj(e){let t=e-Date.now()/1e3;if(t<=0)return`now`;let n=Math.floor(t/86400),r=Math.floor(t%86400/3600),i=Math.floor(t%3600/60);return n>=1?`${n}d${r}h`:r>=1?`${r}h${i}m`:`${i}m`}function yj(){return(0,$.jsx)(R,{dimColor:!0,children:` │ `})}function bj({modelName:e,contextUsedPct:t,usedTokens:n,contextWindowSize:r,totalCostUsd:i,rateLimits:a}){let{columns:o}=k(),[s,c]=(0,Q.useState)(0);(0,Q.useEffect)(()=>{if(!((a.five_hour?.resets_at??0)||(a.seven_day?.resets_at??0)))return;let e=setInterval(()=>c(e=>e+1),6e4);return()=>clearInterval(e)},[a.five_hour?.resets_at,a.seven_day?.resets_at]);let l=e.split(` `),u=l.length>=2?`${l[0]} ${l[1]}`:e,d=o<60,f=a.five_hour!=null,p=a.seven_day!=null,m=f?Math.round(a.five_hour.utilization*100):0,h=p?Math.round(a.seven_day.utilization*100):0,g=`${Ii(n)}/${Ii(r)}`;return(0,$.jsxs)(U,{children:[(0,$.jsx)(R,{children:u}),(0,$.jsx)(yj,{}),(0,$.jsx)(R,{dimColor:!0,children:`Context `}),(0,$.jsxs)(R,{children:[t,`%`]}),!d&&(0,$.jsxs)(R,{dimColor:!0,children:[` (`,g,`)`]}),f&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(yj,{}),(0,$.jsx)(R,{dimColor:!0,children:`Session `}),(0,$.jsxs)(R,{children:[m,`%`]}),!d&&a.five_hour.resets_at>0&&(0,$.jsxs)(R,{dimColor:!0,children:[` `,vj(a.five_hour.resets_at)]})]}),p&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(yj,{}),(0,$.jsx)(R,{dimColor:!0,children:`Weekly `}),(0,$.jsxs)(R,{children:[h,`%`]}),!d&&a.seven_day.resets_at>0&&(0,$.jsxs)(R,{dimColor:!0,children:[` `,vj(a.seven_day.resets_at)]})]}),i>0&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(yj,{}),(0,$.jsx)(R,{children:wm(i)})]})]})}var xj=Q.memo(bj);J(),Z(),ot(),Ac(),xd(),Ab(),jg(),H(),Et(),In(),jr(),q(),Go(),Qs(),on(),_a(),Uh();var Sj=3600*1e3;function Cj(e){return String(Math.floor(e)).padStart(2,`0`)}function wj(e){if(e<=0)return`exp`;let t=Math.floor(e/6e4),n=Math.floor(e%6e4/1e3);return`${Cj(t)}:${Cj(n)}`}function Tj({messages:e}){let[t,n]=(0,Q.useState)(()=>Date.now()),[r,i]=(0,Q.useState)(!0),a=Pd(e),o=(0,Q.useRef)(null);if(a!==null){let e=sj(a);e!==o.current&&(o.current=e,gj(a))}let{lastResetAt:s,lastHitRate:c}=_j(),l=s===null?null:t-s,u=l===null?null:Sj-l,d=l===null?null:l/6e4,f=u!==null&&u<=0;(0,Q.useEffect)(()=>{let e=setInterval(()=>n(Date.now()),1e3);return()=>clearInterval(e)},[]);let p=d!==null&&d>=55&&!f;(0,Q.useEffect)(()=>{if(!p){i(!0);return}let e=setInterval(()=>i(e=>!e),500);return()=>clearInterval(e)},[p]);let m=(0,Q.useRef)(!1);(0,Q.useEffect)(()=>{m.current||(m.current=!0,hj(Fe()))},[]);let h=a===null?c:oj(a);if(h===null&&s===null)return(0,$.jsx)(R,{dimColor:!0,children:` Cache --% --:--`});let g=u===null?`--:--`:wj(u),_=h===null?`--%`:`${h}%`,v;return v=f||d===null?`inactive`:d<20?`success`:d<40?`warning`:`error`,(0,$.jsxs)(R,{children:[(0,$.jsx)(R,{dimColor:!0,children:` Cache `}),(0,$.jsx)(R,{color:h!==null&&h>=50?`success`:`inactive`,children:_}),(0,$.jsxs)(R,{color:v,dimColor:p&&!r,children:[` `,g]})]})}function Ej(e){return Ve()||e?.statusLineEnabled===!1?!1:e?.statusLineEnabled===!0||!!e?.statusLine?.command}function Dj(e,t,n,r,i,a,o){let s=_t(),c=Jg(),l=Gn({permissionMode:e,mainLoopModel:a,exceeds200kTokens:t}),u=n?.outputStyle||`default`,d=Pd(r),f=tr(l,yt()),p=On(d,f),m=vp(Fe()),h=uo(),g={...h.five_hour&&{five_hour:{used_percentage:h.five_hour.utilization*100,resets_at:h.five_hour.resets_at}},...h.seven_day&&{seven_day:{used_percentage:h.seven_day.utilization*100,resets_at:h.seven_day.resets_at}}};return{...Ec(),...m&&{session_name:m},model:{id:l,display_name:Rt(l)},workspace:{current_dir:Mr(),project_dir:ft(),added_dirs:i},version:`2.6.5`,output_style:{name:u},cost:{total_cost_usd:Ue(),total_duration_ms:Je(),total_api_duration_ms:Ge(),total_lines_added:Pe(),total_lines_removed:Qe()},context_window:{total_input_tokens:wt(),total_output_tokens:ze(),context_window_size:f,current_usage:d,used_percentage:p.used,remaining_percentage:p.remaining},exceeds_200k_tokens:t,...(g.five_hour||g.seven_day)&&{rate_limits:g},...Nx()&&{vim:{mode:o??`INSERT`}},...s&&{agent:{name:s}},...$e()&&{remote:{session_id:Fe()}},...c&&{worktree:{name:c.worktreeName,path:c.worktreePath,branch:c.worktreeBranch,original_cwd:c.originalCwd,original_branch:c.originalBranch}}}}function Oj(e){return io(e)?.uuid??null}function kj({messagesRef:e,lastAssistantMessageId:t,vimMode:n}){let r=(0,Q.useRef)(void 0),i=X(e=>e.toolPermissionContext.mode),a=X(e=>e.toolPermissionContext.additionalWorkingDirectories),o=X(e=>e.statusLineText),s=Hc(),c=zl(),{addNotification:l}=Wp(),u=kb(),d=(0,Q.useRef)(c);d.current=c;let f=(0,Q.useRef)(n);f.current=n;let p=(0,Q.useRef)(i);p.current=i;let m=(0,Q.useRef)(a);m.current=a;let h=(0,Q.useRef)(u);h.current=u;let g=(0,Q.useRef)({messageId:null,exceeds200kTokens:!1,permissionMode:i,vimMode:n,mainLoopModel:u}),_=(0,Q.useRef)(void 0),v=(0,Q.useRef)(!0),y=(0,Q.useCallback)(async()=>{r.current?.abort();let t=new AbortController;r.current=t;let n=e.current,i=v.current;if(v.current=!1,d.current?.statusLine?.command)try{let e=g.current.exceeds200kTokens,r=Oj(n);r!==g.current.messageId&&(e=Ah(n),g.current.messageId=r,g.current.exceeds200kTokens=e);let a=await cl(Dj(p.current,e,d.current,n,Array.from(m.current.keys()),h.current,f.current),t.signal,void 0,i);t.signal.aborted||s(e=>e.statusLineText===a?e:{...e,statusLineText:a})}catch{}},[e,s]),b=(0,Q.useCallback)(()=>{_.current!==void 0&&clearTimeout(_.current),_.current=setTimeout((e,t)=>{e.current=void 0,t()},300,_,y)},[y]);(0,Q.useEffect)(()=>{(t!==g.current.messageId||i!==g.current.permissionMode||n!==g.current.vimMode||u!==g.current.mainLoopModel)&&(g.current.permissionMode=i,g.current.vimMode=n,g.current.mainLoopModel=u,b())},[t,i,n,u,b]);let x=c?.statusLine?.command,S=(0,Q.useRef)(!0);(0,Q.useEffect)(()=>{if(S.current){S.current=!1;return}v.current=!0,y()},[x,y]),(0,Q.useEffect)(()=>{let e=c?.statusLine;e&&(Y(`tengu_status_line_mount`,{command_length:e.command.length,padding:e.padding}),c.disableAllHooks===!0&&K(`Status line is configured but disableAllHooks is true`,{level:`warn`}),Bn()||(l({key:`statusline-trust-blocked`,text:`statusline skipped · restart to fix`,color:`warning`,priority:`low`}),K(`Status line command skipped: workspace trust not accepted`,{level:`warn`})))},[]),(0,Q.useEffect)(()=>(y(),()=>{r.current?.abort(),_.current!==void 0&&clearTimeout(_.current)}),[]);let C=c?.statusLine?.padding??0,w=Gn({permissionMode:i,mainLoopModel:u,exceeds200kTokens:g.current.exceeds200kTokens}),T=tr(w,yt()),E=Pd(e.current),D=E?E.input_tokens+E.cache_creation_input_tokens+E.cache_read_input_tokens:0,O=E?Math.round(On(E,T).used??0):0,k=uo(),A={...k.five_hour&&{five_hour:{utilization:k.five_hour.utilization,resets_at:k.five_hour.resets_at}},...k.seven_day&&{seven_day:{utilization:k.seven_day.utilization,resets_at:k.seven_day.resets_at}}},j=c?.statusLineEnabled===!0,M=!!c?.statusLine?.command;return(0,$.jsxs)(U,{flexDirection:`column`,paddingX:C,children:[j&&(0,$.jsxs)(U,{gap:2,children:[(0,$.jsx)(xj,{modelName:Rt(w),contextUsedPct:O,usedTokens:D,contextWindowSize:T,totalCostUsd:Ue(),rateLimits:A}),(0,$.jsx)(Tj,{messages:e.current})]}),o?(0,$.jsx)(R,{dimColor:!0,wrap:`truncate`,children:(0,$.jsx)(fe,{children:o})}):M&&Sh()?(0,$.jsx)(R,{children:` `}):null]})}var Aj=(0,Q.memo)(kj);xc();function jj(e,t,n,r,i=!0){let a=e.length;if(a===0)return{startIndex:0,endIndex:0,showLeftArrow:!1,showRightArrow:!1};let o=Math.max(0,Math.min(r,a-1));if(e.reduce((e,t)=>e+t,0)<=t)return{startIndex:0,endIndex:a,showLeftArrow:!1,showRightArrow:!1};let s=[0];for(let t=0;t<a;t++)s.push(s[t]+e[t]);function c(e,t){let n=s[t]-s[e];return i&&e>0?n-1:n}function l(e,r){let i=t;return e>0&&(i-=n),r<a&&(i-=n),i}let u=0,d=1;for(;d<a&&c(u,d+1)<=l(u,d+1);)d++;if(o>=u&&o<d)return{startIndex:u,endIndex:d,showLeftArrow:u>0,showRightArrow:d<a};if(o>=d)for(d=o+1,u=o;u>0&&c(u-1,d)<=l(u-1,d);)u--;else for(u=o,d=o+1;d<a&&c(u,d+1)<=l(u,d+1);)d++;return{startIndex:u,endIndex:d,showLeftArrow:u>0,showRightArrow:d<a}}f(),nc(),H(),Z(),Yx(),yo(),Hu(),eS();function Mj({tasksSelected:e,isViewingTeammate:t,teammateFooterIndex:n=0,isLeaderIdle:r=!1,onOpenDialog:i}){let a=Hc(),{columns:o}=k(),s=X(e=>e.tasks),c=X(e=>e.viewingAgentTaskId),l=(0,Q.useMemo)(()=>Object.values(s??{}).filter(e=>mc(e)&&!(process.env.USER_TYPE===`ant`&&Lc(e))),[s]),u=X(e=>e.expandedView)===`teammates`,d=!u&&l.length>0&&l.every(e=>e.type===`in_process_teammate`),f=(0,Q.useMemo)(()=>l.filter(e=>e.type===`in_process_teammate`).sort((e,t)=>e.identity.agentName.localeCompare(t.identity.agentName)),[l]),m=(0,Q.useMemo)(()=>{let t={name:`main`,color:void 0,isIdle:r,taskId:void 0},n=f.map(e=>({name:e.identity.agentName,color:Fj(e.identity.color),isIdle:e.isIdle,taskId:e.id}));return e||n.sort((e,t)=>e.isIdle===t.isIdle?0:e.isIdle?1:-1),[t,...n].map((e,t)=>({...e,idx:t}))},[f,r,e]),h=(0,Q.useMemo)(()=>m.map((e,t)=>D(`@${e.name}`)+ +(t>0)),[m]);if(d||!u&&t){let t=e?n:-1,r=c?f.findIndex(e=>e.id===c)+1:0,{startIndex:i,endIndex:s,showLeftArrow:l,showRightArrow:u}=jj(h,Math.max(20,o-20-4),2,t>=0?t:0),d=m.slice(i,s);return(0,$.jsxs)($.Fragment,{children:[l&&(0,$.jsxs)(R,{dimColor:!0,children:[p.arrowLeft,` `]}),d.map((e,n)=>{let i=n>0;return(0,$.jsxs)(Q.Fragment,{children:[i&&(0,$.jsx)(R,{children:` `}),(0,$.jsx)(Nj,{name:e.name,color:e.color,isSelected:t===e.idx,isViewed:r===e.idx,isIdle:e.isIdle,onClick:()=>e.taskId?$x(e.taskId,a):tS(a)})]},e.name)}),u&&(0,$.jsxs)(R,{dimColor:!0,children:[` `,p.arrowRight]}),(0,$.jsxs)(R,{dimColor:!0,children:[` · `,(0,$.jsx)(he,{shortcut:`shift + ↓`,action:`expand`})]})]})}return Jx(s??{},u)||l.length===0?null:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Pj,{selected:e,onClick:i,children:lc(l)}),Gc(l)&&(0,$.jsxs)(R,{dimColor:!0,children:[` · `,p.arrowDown,` to view`]})]})}function Nj({name:e,color:t,isSelected:n,isViewed:r,isIdle:i,onClick:a}){let[o,s]=(0,Q.useState)(!1),c=n||o,l;return l=c?t?(0,$.jsxs)(R,{backgroundColor:t,color:`inverseText`,bold:r,children:[`@`,e]}):(0,$.jsxs)(R,{color:`background`,inverse:!0,bold:r,children:[`@`,e]}):i?(0,$.jsxs)(R,{dimColor:!0,bold:r,children:[`@`,e]}):r?(0,$.jsxs)(R,{color:t,bold:!0,children:[`@`,e]}):(0,$.jsxs)(R,{color:t,dimColor:!t,children:[`@`,e]}),a?(0,$.jsx)(U,{onClick:a,onMouseEnter:()=>s(!0),onMouseLeave:()=>s(!1),children:l}):l}function Pj({selected:e,onClick:t,children:n}){let[r,i]=(0,Q.useState)(!1),a=(0,$.jsx)(R,{color:`background`,inverse:e||r,children:n});return t?(0,$.jsx)(U,{onClick:t,onMouseEnter:()=>i(!0),onMouseLeave:()=>i(!1),children:a}):a}function Fj(e){if(e&&Ch.includes(e))return Ns[e]}H(),Z();function Ij({teamsSelected:e,showHint:t}){let n=X(e=>e.teamContext),r=n?Object.values(n.teammates).filter(e=>e.name!==`team-lead`).length:0;if(r===0)return null;let i=t&&e?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(R,{dimColor:!0,children:`· `}),(0,$.jsx)(R,{dimColor:!0,children:`Enter to view`})]}):null;return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(R,{color:`background`,inverse:e,children:`${r} ${r===1?`teammate`:`teammates`}`},e?`selected`:`normal`),i?(0,$.jsxs)(R,{children:[` `,i]}):null]})}H(),Xc();function Lj({value:e,onChange:t,historyFailedMatch:n}){return(0,$.jsxs)(U,{gap:1,children:[(0,$.jsx)(R,{dimColor:!0,children:n?`no matching prompt:`:`search prompts:`}),(0,$.jsx)(Dc,{value:e,onChange:t,cursorOffset:e.length,onChangeCursorOffset:()=>{},columns:D(e)+1,focus:!0,showCursor:!0,multiline:!1,dimColor:!0})]})}mi(),zr(),kr();var Rj=5e3;function zj(e,t){if(e)return`draft`;switch(t){case`APPROVED`:return`approved`;case`CHANGES_REQUESTED`:return`changes_requested`;default:return`pending`}}async function Bj(){if(!await Lr())return null;let[e,t]=await Promise.all([Rr(),Ir()]);if(e===t)return null;let{stdout:n,code:r}=await hi(`gh`,[`pr`,`view`,`--json`,`number,url,reviewDecision,isDraft,headRefName,state`],{timeout:Rj,preserveOutputOnError:!1});if(r!==0||!n.trim())return null;try{let e=xr(n);return e.headRefName===t||e.headRefName===`main`||e.headRefName===`master`||e.state===`MERGED`||e.state===`CLOSED`?null:{number:e.number,url:e.url,reviewState:zj(e.isDraft,e.reviewDecision)}}catch{return null}}ot();var Vj=6e4,Hj=4e3,Uj=60*6e4,Wj={number:null,url:null,reviewState:null,lastUpdated:0};function Gj(e,t=!0){let[n,r]=(0,Q.useState)(Wj),i=(0,Q.useRef)(null),a=(0,Q.useRef)(!1),o=(0,Q.useRef)(0);return(0,Q.useEffect)(()=>{if(!t||a.current)return;let e=!1,n=-1,s=Date.now();async function c(){if(e)return;let t=et();if(n!==t)n=t,s=Date.now();else if(Date.now()-s>=Uj)return;let l=Date.now(),u=await Bj();if(!e){if(o.current=l,r(e=>{let t=u?.number??null,n=u?.reviewState??null;return e.number===t&&e.reviewState===n?e:{number:t,url:u?.url??null,reviewState:n,lastUpdated:Date.now()}}),Date.now()-l>Hj){a.current=!0;return}e||(i.current=setTimeout(c,Vj))}}let l=Date.now()-o.current;return l>=Vj?c():i.current=setTimeout(c,Vj-l),()=>{e=!0,i.current&&(clearTimeout(i.current),i.current=null)}},[e,t]),n}H(),f(),Ix(),Bu(),$t(),Hp(),yo(),Ai(),eS(),ir(),Ml(),Z(),ot(),nc(),Vi(),JD(),AD(),Cu(),Go(),Et(),si(),ps();var Kj=(Gd(),e(Lh)),qj=(dv(),e(ev)),Jj=e=>()=>{},Yj=()=>null,Xj=3,Zj=5e3;function Qj(){let[e,t]=(0,Q.useState)(null);return(0,Q.useEffect)(()=>{function e(){let e=process.memoryUsage().rss/(1024*1024),n=e>=1024?`error`:e>=512?`warning`:`normal`,r=Ri(e*1024*1024);t(e=>e?.text===r?e:{text:r,level:n})}e();let n=setInterval(e,Zj);return()=>clearInterval(n)},[]),e}function $j(){let e=(0,Q.useSyncExternalStore)(qj?.subscribeToProactiveChanges??Jj,qj?.getNextTickAt??Yj,Yj),[t,n]=(0,Q.useState)(null);return(0,Q.useEffect)(()=>{if(e===null){n(null);return}function t(){n(Math.max(0,Math.ceil((e-Date.now())/1e3)))}t();let r=setInterval(t,1e3);return()=>clearInterval(r)},[e]),t===null?null:(0,$.jsxs)(R,{dimColor:!0,children:[`waiting `,Li(t*1e3,{mostSignificantOnly:!0})]})}function eM({exitMessage:e,vimMode:t,mode:n,toolPermissionContext:r,suppressHint:i,isLoading:a,tasksSelected:o,teamsSelected:s,tmuxSelected:c,teammateFooterIndex:l,isPasting:u,isSearching:d,historyQuery:f,setHistoryQuery:p,historyFailedMatch:m,onOpenTasksDialog:h}){if(e.show)return(0,$.jsxs)(R,{dimColor:!0,children:[`Press `,e.key,` again to exit`]},`exit-message`);if(u)return(0,$.jsx)(R,{dimColor:!0,children:`Pasting text…`},`pasting-message`);let g=Nx()&&t===`INSERT`&&!d;return(0,$.jsxs)(U,{justifyContent:`flex-start`,gap:1,children:[d&&(0,$.jsx)(Lj,{value:f,onChange:p,historyFailedMatch:m}),g?(0,$.jsx)(R,{dimColor:!0,children:`-- INSERT --`},`vim-insert`):null,(0,$.jsx)(tM,{mode:n,toolPermissionContext:r,showHint:!i&&!g,isLoading:a,tasksSelected:o,teamsSelected:s,teammateFooterIndex:l,tmuxSelected:c,onOpenTasksDialog:h})]})}function tM({mode:e,toolPermissionContext:t,showHint:n,isLoading:r,tasksSelected:i,teamsSelected:a,tmuxSelected:o,teammateFooterIndex:s,onOpenTasksDialog:c}){let{columns:l}=k(),u=pd(`chat:cycleMode`,`Chat`,`shift+tab`),d=X(e=>e.tasks),f=X(e=>e.teamContext),m=gc(),[h]=(0,Q.useState)(()=>m.getState().remoteSessionUrl),g=X(e=>e.viewSelectionMode),_=X(e=>e.viewingAgentTaskId),v=X(e=>e.expandedView),y=v===`teammates`,b=Gj(r,rM()),x=X(e=>process.env.USER_TYPE===`ant`&&e.tungstenActiveSession!==void 0),S=(0,Q.useSyncExternalStore)(qj?.subscribeToProactiveChanges??Jj,qj?.getNextTickAt??Yj,Yj),C=OD(),w=ph(e=>e.voiceState),T=ph(e=>e.voiceWarmingUp),E=j(),D=ee().getState,O=S!==null,A=Kj?.isCoordinatorMode()===!0,M=(0,Q.useMemo)(()=>xi(Object.values(d),e=>mc(e)&&!(process.env.USER_TYPE===`ant`&&Lc(e))),[d]),N=os(),P=N!==void 0&&N.length>0,F=pd(`chat:cancel`,`Chat`,`esc`).toLowerCase(),te=pd(`app:toggleTodos`,`Global`,`ctrl+t`),ne=pd(`chat:killAgents`,`Chat`,`ctrl+x ctrl+k`),I=pd(`voice:pushToTalk`,`Chat`,`Space`),[L]=(0,Q.useState)(()=>(pn().voiceFooterHintSeenCount??0)<Xj),ie=L,ae=(0,Q.useRef)(!1);(0,Q.useEffect)(()=>{{if(!C||!ie||ae?.current)return;ae&&(ae.current=!0);let e=(pn().voiceFooterHintSeenCount??0)+1;rn(t=>(t.voiceFooterHintSeenCount??0)>=e?t:{...t,voiceFooterHintSeenCount:e})}},[C,ie]);let oe=X(e=>e.notifications.current?.key===`kill-agents-confirm`),se=Qj(),ce=Un()&&!Ha()&&f!==void 0&&xi(Object.values(f.teammates),e=>e.name!==`team-lead`)>0;if(e===`bash`)return(0,$.jsx)(R,{color:`bashBorder`,children:`! for bash mode`});let le=t?.mode,ue=!sn(le),fe=_?d[_]:void 0,pe=g===`viewing-agent`&&fe?.type===`in_process_teammate`,me=pe&&fe!=null&&fe.status!==`running`,z=M>0||pe,B=(A||ue?1:0)+ +!!z+ +!!ce,ge=rM()&&b.number!==null&&b.reviewState!==null&&b.url!==null&&B<2&&(B===0||l>=80),ve=B<2,ye=!y&&z&&Object.values(d).some(e=>e.type===`in_process_teammate`)||!y&&pe,V=le&&ue&&!$e()?(0,$.jsxs)(R,{color:Xt(le),children:[_r(le),` `,kt(le).toLowerCase(),` on`,ve&&(0,$.jsxs)(R,{dimColor:!0,children:[` `,(0,$.jsx)(he,{shortcut:u,action:`cycle`,parens:!0})]})]},`mode`):null,be=[...h?[(0,$.jsx)(re,{url:h,children:(0,$.jsxs)(R,{color:`ide`,children:[p.circleDouble,` remote`]})},`remote`)]:[],...process.env.USER_TYPE===`ant`&&x?[(0,$.jsx)(TungstenPill,{selected:o},`tmux`)]:[],...Un()&&ce?[(0,$.jsx)(Ij,{teamsSelected:a,showHint:n&&!z},`teams`)]:[],...ge?[(0,$.jsx)(Eo,{number:b.number,url:b.url,reviewState:b.reviewState},`pr-status`)]:[],...se?[(0,$.jsxs)(R,{dimColor:se.level===`normal`,color:se.level===`error`?`error`:se.level===`warning`?`warning`:void 0,children:[se.text,` · pid:`,process.pid]},`rss`)]:[]],xe=Object.values(d).some(e=>e.type===`in_process_teammate`&&e.status===`running`),Se=Object.values(d).some(e=>e.type===`local_agent`&&e.status===`running`),H=n?nM(r,F,te,ne,P,v,xe,Se,oe):[];if(me?be.push((0,$.jsx)(R,{dimColor:!0,children:(0,$.jsx)(he,{shortcut:F,action:`return to team lead`})},`esc-return`)):O?be.push((0,$.jsx)($j,{},`proactive`)):!ye&&n&&be.push(...H),ye){let e=[...V?[V]:[],...be,...me?[]:H];return(0,$.jsxs)(U,{flexDirection:`column`,children:[(0,$.jsx)(U,{children:(0,$.jsx)(Mj,{tasksSelected:i,isViewingTeammate:pe,teammateFooterIndex:s,isLeaderIdle:!r,onOpenDialog:c})}),e.length>0&&(0,$.jsx)(U,{children:(0,$.jsx)(_e,{children:e})})]})}let Ce=process.env.USER_TYPE===`ant`&&Uk(d).length>0,we=z&&!ye&&!Jx(d,y)?(0,$.jsx)(Mj,{tasksSelected:i,isViewingTeammate:pe,teammateFooterIndex:s,isLeaderIdle:!r,onOpenDialog:c}):null;be.length===0&&!we&&!V&&n&&be.push((0,$.jsx)(R,{dimColor:!0,children:`? for shortcuts`},`shortcuts-hint`));let Te=pn().copyOnSelect??!0,Ee=E&&(!Te||de());if(C&&T)be.push((0,$.jsx)(HD,{},`voice-warmup`));else if(Sh()&&Ee){let e=oi()===`macos`,t=e&&(D()?.lastPressHadAlt??!1);be.push((0,$.jsx)(R,{dimColor:!0,children:(0,$.jsxs)(_e,{children:[!Te&&(0,$.jsx)(he,{shortcut:`ctrl+c`,action:`copy`}),de()&&(t?(0,$.jsx)(R,{children:`set macOptionClickForcesSelection in VS Code settings`}):(0,$.jsx)(he,{shortcut:e?`option+click`:`shift+click`,action:`native select`}))]})},`selection-copy`))}else be.length>0&&n&&C&&w===`idle`&&H.length===0&&ie&&be.push((0,$.jsxs)(R,{dimColor:!0,children:[`hold `,I,` to speak`]},`voice-hint`));return(we||Ce)&&n&&!ce&&be.push((0,$.jsx)(R,{dimColor:!0,children:i?(0,$.jsx)(he,{shortcut:`Enter`,action:`view tasks`}):(0,$.jsx)(he,{shortcut:`↓`,action:`manage`})},`manage-tasks`)),be.length===0&&!we&&!V?Sh()?(0,$.jsx)(R,{children:` `}):null:(0,$.jsxs)(U,{height:1,overflow:`hidden`,children:[V&&(0,$.jsxs)(U,{flexShrink:0,children:[V,(we||be.length>0)&&(0,$.jsx)(R,{dimColor:!0,children:` · `})]}),we&&(0,$.jsxs)(U,{flexShrink:0,children:[we,be.length>0&&(0,$.jsx)(R,{dimColor:!0,children:` · `})]}),be.length>0&&(0,$.jsx)(R,{wrap:`truncate`,children:(0,$.jsx)(_e,{children:be})})]})}function nM(e,t,n,r,i,a,o,s,c){let l;if(o)switch(a){case`none`:l=`show tasks`;break;case`tasks`:l=`show teammates`;break;case`teammates`:l=`hide`;break}else l=a===`tasks`?`hide tasks`:`show tasks`;let u=i||o;return[...e?[(0,$.jsx)(R,{dimColor:!0,children:(0,$.jsx)(he,{shortcut:t,action:`interrupt`})},`esc`)]:[],...!e&&s&&!c?[(0,$.jsx)(R,{dimColor:!0,children:(0,$.jsx)(he,{shortcut:r,action:`stop agents`})},`kill-agents`)]:[],...u?[(0,$.jsx)(R,{dimColor:!0,children:(0,$.jsx)(he,{shortcut:n,action:l})},`toggle-tasks`)]:[]]}function rM(){return pn().prStatusFooterEnabled??!0}am(),jg(),nc(),H(),Qp(),Z(),Go(),yb(),Fx();function iM({apiKeyStatus:e,debug:t,exitMessage:n,vimMode:r,mode:i,autoUpdaterResult:a,isAutoUpdating:o,verbose:s,onAutoUpdaterResult:c,onChangeIsUpdating:l,suggestions:u,selectedSuggestion:d,maxColumnWidth:f,toolPermissionContext:p,helpOpen:m,suppressHint:h,isLoading:g,tasksSelected:_,teamsSelected:v,bridgeSelected:y,tmuxSelected:b,teammateFooterIndex:x,ideSelection:S,mcpClients:C,isPasting:w=!1,isInputWrapped:T=!1,messages:E,isSearching:D,historyQuery:O,setHistoryQuery:A,historyFailedMatch:j,onOpenTasksDialog:M}){let N=zl(),{columns:P,rows:ee}=k(),F=(0,Q.useRef)(E);F.current=E;let te=(0,Q.useMemo)(()=>Oj(E),[E]),ne=P<80,I=Sh(),re=I&&ee<24,L=Gk(),ie=X(e=>e.coordinatorTaskIndex),ae=_&&(L===0||ie<0),oe=h||Ej(N)||D;return mx((0,Q.useMemo)(()=>I&&u.length?{suggestions:u,selectedSuggestion:d,maxColumnWidth:f}:null,[I,u,d,f])),u.length&&!I?(0,$.jsx)(U,{paddingX:2,paddingY:0,children:(0,$.jsx)(bb,{suggestions:u,selectedSuggestion:d,maxColumnWidth:f})}):m?(0,$.jsx)(Lx,{dimColor:!0,fixedWidth:!0,paddingX:2}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(U,{flexDirection:ne?`column`:`row`,justifyContent:ne?`flex-start`:`space-between`,paddingX:2,gap:+!ne,children:[(0,$.jsxs)(U,{flexDirection:`column`,flexShrink:+!ne,children:[i===`prompt`&&!re&&!n.show&&!w&&Ej(N)&&(0,$.jsx)(Aj,{messagesRef:F,lastAssistantMessageId:te,vimMode:r}),(0,$.jsx)(sM,{}),(0,$.jsx)(eM,{exitMessage:n,vimMode:r,mode:i,toolPermissionContext:p,suppressHint:oe,isLoading:g,tasksSelected:ae,teamsSelected:v,teammateFooterIndex:x,tmuxSelected:b,isPasting:w,isSearching:D,historyQuery:O,setHistoryQuery:A,historyFailedMatch:j,onOpenTasksDialog:M})]}),(0,$.jsxs)(U,{flexShrink:1,gap:1,children:[I?null:(0,$.jsx)(ZD,{apiKeyStatus:e,autoUpdaterResult:a,debug:t,isAutoUpdating:o,verbose:s,messages:E,onAutoUpdaterResult:c,onChangeIsUpdating:l,ideSelection:S,mcpClients:C,isInputWrapped:T,isNarrow:ne}),process.env.USER_TYPE===`ant`&&yy()&&(0,$.jsx)(R,{dimColor:!0,children:`undercover`}),(0,$.jsx)(oM,{bridgeSelected:y})]})]}),process.env.USER_TYPE===`ant`&&(0,$.jsx)(Wk,{})]})}var aM=(0,Q.memo)(iM);function oM({bridgeSelected:e}){let t=X(e=>e.replBridgeEnabled),n=X(e=>e.replBridgeConnected),r=X(e=>e.replBridgeSessionActive),i=X(e=>e.replBridgeReconnecting),a=X(e=>e.replBridgeExplicit);if(!uy()||!t)return null;let o=Xd({error:void 0,connected:n,sessionActive:r,reconnecting:i});return!a&&o.label!==`Remote Control reconnecting`?null:(0,$.jsxs)(R,{color:e?`background`:o.color,inverse:e,wrap:`truncate`,children:[o.label,e&&(0,$.jsx)(R,{dimColor:!0,children:` · Enter to view`})]})}function sM(){return null}f(),H(),Hu(),wi(),ir();function cM(){if(!Un())return;let e=Ei();if(e&&Ch.includes(e))return Ns[e]}function lM({isLoading:e,themeColor:t}){let n=t,r=process.env.USER_TYPE===`ant`;return(0,$.jsxs)(R,{color:n??(r?`subtle`:void 0),dimColor:e,children:[p.pointer,`\xA0`]})}function uM({mode:e,isLoading:t,viewingAgentName:n,viewingAgentColor:r}){let i=cM(),a=r?Ns[r]:void 0;return(0,$.jsx)(U,{alignItems:`flex-start`,alignSelf:`flex-start`,flexWrap:`nowrap`,justifyContent:`flex-start`,children:n?(0,$.jsx)(lM,{isLoading:t,themeColor:a}):e===`bash`?(0,$.jsx)(R,{color:`bashBorder`,dimColor:t,children:`!\xA0`}):(0,$.jsx)(lM,{isLoading:t,themeColor:Un()?i:void 0})})}H(),Z(),Mg(),up(),Qs(),kr(),qp();var dM=new Set;function fM(e){try{return xr(e)?.type===`idle_notification`}catch{return!1}}var pM=3;function mM(e){return`<${ni}>
72
72
  <${Xr}>+${e} more tasks completed</${Xr}>
73
73
  <${ti}>completed</${ti}>
74
74
  </${ni}>`}function hM(e){let t=e.filter(e=>typeof e.value!=`string`||!fM(e.value)),n=t.filter(e=>e.mode===`task-notification`),r=t.filter(e=>e.mode!==`task-notification`);if(n.length<=pM)return[...r,...n];let i=n.slice(0,pM-1),a={value:mM(n.length-(pM-1)),mode:`task-notification`};return[...r,...i,a]}function gM(){let e=aD(),t=X(e=>!!e.viewingAgentTaskId),n=X(e=>e.isBriefOnly),r=(0,Q.useMemo)(()=>{if(e.length===0)return null;let t=e.filter(gd);return t.length===0?null:Vo(hM(t).map(e=>{let t=e.value;return e.mode===`bash`&&typeof t==`string`&&(t=`<bash-input>${t}</bash-input>`),Ud({content:t})}))},[e]);return t||r===null?null:(0,$.jsx)(U,{marginTop:1,flexDirection:`column`,children:r.map((e,t)=>(0,$.jsx)(Ua,{isFirst:t===0,useBriefLayout:n,children:(0,$.jsx)(no,{message:e,lookups:ws,addMargin:!1,tools:[],commands:[],verbose:!1,inProgressToolUseIDs:dM,progressMessagesForMessage:[],shouldAnimate:!1,shouldShowDot:!1,isTranscriptMode:!1,isStatic:!0})},t))})}var _M=Q.memo(gM);Oa(),f(),H();function vM({hasStash:e}){return e?(0,$.jsx)(U,{paddingLeft:2,children:(0,$.jsxs)(R,{dimColor:!0,children:[p.pointerSmall,` Stashed (auto-restores after submit)`]})}):null}vm();var yM=1e4,bM=1e3;function xM(e,t){if(e.length<=yM)return{truncatedText:e,placeholderContent:``};let n=Math.floor(bM/2),r=Math.floor(bM/2),i=e.slice(0,n),a=e.slice(-r),o=e.slice(n,-r);return{truncatedText:i+SM(t,nh(o))+a,placeholderContent:o}}function SM(e,t){return`[...Truncated text #${e} +${t} lines...]`}function CM(e,t){let n=Object.keys(t).map(Number),r=n.length>0?Math.max(...n)+1:1,{truncatedText:i,placeholderContent:a}=xM(e,r);return a?{newInput:i,newPastedContents:{...t,[r]:{id:r,type:`text`,content:a}}}:{newInput:e,newPastedContents:t}}function wM({input:e,pastedContents:t,onInputChange:n,setCursorOffset:r,setPastedContents:i}){let[a,o]=(0,Q.useState)(!1);(0,Q.useEffect)(()=>{if(a||e.length<=1e4)return;let{newInput:s,newPastedContents:c}=CM(e,t);n(s),r(s.length),i(c),o(!0)},[e,a,t,n,i,r]),(0,Q.useEffect)(()=>{e===``&&o(!1)},[e])}Z(),Et(),up();var TM=(dv(),e(ev)),EM=3,DM=20;function OM({input:e,submitCount:t,viewingAgentName:n}){let r=aD(),i=X(e=>e.promptSuggestionEnabled);return(0,Q.useMemo)(()=>{if(e===``){if(n)return`Message @${n.length>DM?n.slice(0,DM-3)+`...`:n}…`;if(r.some($f)&&(pn().queuedCommandUpHintCount||0)<EM)return`Press up to edit queued messages`;if(t<1&&i&&!TM?.isProactiveActive())return dS()}},[e,r,t,i,n])}var kM=5e3,AM=!1;function jM(e){let[t,n]=(0,Q.useState)(!1);return(0,Q.useEffect)(()=>{if(AM||!e)return;AM=!0,n(!0);let t=setTimeout(n,kM,!1);return()=>{clearTimeout(t),n(!1)}},[e]),t}wi();function MM(e){if(!bi())return e.standaloneAgentContext?.name}Z(),Hu(),gy(),Ml(),ay(),wi();function NM(){let e=X(e=>e.teamContext),t=X(e=>e.standaloneAgentContext),n=X(e=>e.agent);X(e=>e.viewingAgentTaskId);let r=gc(),[i,a]=Q.useState(null);Q.useEffect(()=>{hy().then(a)},[]);let o=r.getState();if(Ci()&&!ki()){let t=Ti();if(t&&bi())return{text:`@${t}`,bgColor:PM(e?.selfAgentColor??Ei())}}if(e?.teamName&&e.teammates&&Object.keys(e.teammates).length>0){let e=Wd(o),t=PM(e?.identity.color),n=Ha(),r=Cg(),a=r?.isNative??!1,s=r?.backend.type;if(i===!1&&!n&&!a)return{text:s===`windows-terminal`?`View teammates in the Windows Terminal tabs spawned for each teammate`:`View teammates: \`tmux -L ${sy()} a\``,bgColor:t};if((i===!0||n||a)&&e)return{text:`@${e.identity.agentName}`,bgColor:t}}let s=a_(o);if(s.type===`named_agent`){let e=s.task,t;for(let[n,r]of o.agentNameRegistry)if(r===e.id){t=n;break}return{text:t?`@${t}`:e.description,bgColor:nd(e.agentType)??`cyan_FOR_SUBAGENTS_ONLY`}}let c=MM(o),l=t?.color;return c||l?{text:c??``,bgColor:PM(l)}:n?{text:n,bgColor:PM(o.agentDefinitions.activeAgents.find(e=>e.agentType===n)?.color,`promptBorder`)}:null}function PM(e,t=`cyan_FOR_SUBAGENTS_ONLY`){return e&&Ch.includes(e)?Ns[e]:t}F(),Ac(),J(),Z(),jr(),up(),Lu(),Qp(),bx(),vm(),Ab(),nc(),H(),ul(),wf(),Jv(),za(),Xg(),Yx(),yo(),Hp(),Hu(),ir(),Ai(),dl(),Et(),q(),Kr(),Cr(),Go(),Ki(),ii(),on(),si(),Db(),Ml(),Nv(),wi(),yi(),Du(),Gu(),Xc(),eS(),jl(),Ix();var FM=5,IM=3;function LM({debug:e,ideSelection:t,toolPermissionContext:n,setToolPermissionContext:r,apiKeyStatus:i,commands:a,agents:o,isLoading:s,verbose:c,messages:l,onAutoUpdaterResult:u,autoUpdaterResult:d,input:f,onInputChange:p,mode:m,onModeChange:h,stashedPrompt:g,setStashedPrompt:_,submitCount:v,onShowMessageSelector:y,onMessageActionsEnter:b,mcpClients:x,pastedContents:S,setPastedContents:C,vimMode:w,setVimMode:T,showBashesDialog:E,setShowBashesDialog:O,onExit:A,getToolUseContext:j,onSubmit:M,onAgentSubmit:N,isSearchingHistory:P,setIsSearchingHistory:ee,onDismissSideQuestion:F,isSideQuestionVisible:te,helpOpen:I,setHelpOpen:re,hasSuppressedDialogs:L,isLocalJSXCommandActive:ie=!1,insertTextRef:ae,voiceInterimRange:se}){let ce=kb(),le=ba()||ie,[ue,de]=(0,Q.useState)(!1),[fe,me]=(0,Q.useState)({show:!1}),[z,B]=(0,Q.useState)(f.length),he=Q.useRef(f);f!==he.current&&(B(f.length),he.current=f);let ge=Q.useCallback(e=>{he.current=e,p(e)},[p]);ae&&(ae.current={cursorOffset:z,insert:e=>{let t=z===f.length&&f.length>0&&!/\s$/.test(f)?` `+e:e,n=f.slice(0,z)+t+f.slice(z);he.current=n,p(n),B(z+t.length)},setInputWithCursor:(e,t)=>{he.current=e,p(e),B(t)}});let _e=gc(),ve=Hc(),ye=X(e=>e.tasks),be=X(e=>e.replBridgeConnected),xe=X(e=>e.replBridgeExplicit),Se=X(e=>e.replBridgeReconnecting),H=be&&(xe||Se),Ce=X(e=>process.env.USER_TYPE===`ant`&&e.tungstenActiveSession!==void 0),Te=process.env.USER_TYPE===`ant`&&Ce,Ee=X(e=>!1),De=X(e=>e.teamContext),ke=aD(),Ae=X(e=>e.promptSuggestion),je=X(e=>e.speculation),Me=X(e=>e.speculationSessionTimeSavedMs),Ne=X(e=>e.viewingAgentTaskId),Pe=X(e=>e.viewSelectionMode),Fe=X(e=>e.expandedView)===`teammates`,{companion:Ie,companionMuted:Le}=pn(),Re=!!Ie&&!Le,ze=X(e=>e.isBriefOnly)&&!Ne,Be=X(e=>e.mainLoopModel),Ve=X(e=>e.mainLoopModelForSession),He=X(e=>e.thinkingEnabled),Ue=X(e=>dr()?e.fastMode:!1),We=X(e=>e.effortValue),Ge=Wd(_e.getState()),Ke=Ge?.identity.agentName,qe=Ge?.identity.color&&Ch.includes(Ge.identity.color)?Ge.identity.color:void 0,Je=(0,Q.useMemo)(()=>bo(ye),[ye]),Ye=Je.length>0||Ge!==void 0,Xe=(0,Q.useMemo)(()=>Ge?{...n,mode:Ge.permissionMode}:n,[Ge,n]),{historyQuery:Ze,setHistoryQuery:Qe,historyMatch:$e,historyFailedMatch:et}=oO(e=>{C(e.pastedContents),Vn(e.display)},f,ge,B,z,h,m,P,ee,C,S),tt=(0,Q.useRef)(-1);tt.current===-1&&(tt.current=RM(l));let nt=(0,Q.useRef)(!1),[rt,it]=(0,Q.useState)(!1),[at,ot]=(0,Q.useState)(!1),[st,ct]=(0,Q.useState)(0),lt=X(e=>e.coordinatorTaskIndex),ut=X(e=>e.selectedBgAgentIndex),dt=(0,Q.useCallback)(e=>ve(t=>{let n=typeof e==`function`?e(t.selectedBgAgentIndex):e;return n===t.selectedBgAgentIndex?t:{...t,selectedBgAgentIndex:n}}),[ve]),ft=(0,Q.useCallback)(e=>ve(t=>{let n=typeof e==`function`?e(t.coordinatorTaskIndex):e;return n===t.coordinatorTaskIndex?t:{...t,coordinatorTaskIndex:n}}),[ve]),pt=Gk(),mt=(0,Q.useMemo)(()=>Object.values(ye).some(e=>mc(e)&&!(process.env.USER_TYPE===`ant`&&Lc(e))),[ye])?-1:0;(0,Q.useEffect)(()=>{lt>=pt?ft(Math.max(mt,pt-1)):lt<mt&&ft(mt)},[pt,lt,mt]);let[ht,gt]=(0,Q.useState)(!1),[_t,vt]=(0,Q.useState)(!1),[yt,bt]=(0,Q.useState)(!1),[xt,St]=(0,Q.useState)(!1),[Ct,wt]=(0,Q.useState)(!1),[Tt,Et]=(0,Q.useState)(!1),[Dt,Ot]=(0,Q.useState)(!1),[kt,At]=(0,Q.useState)(!1),jt=(0,Q.useMemo)(()=>{let e=f.indexOf(`
@@ -86,12 +86,12 @@ Server disconnected.
86
86
 
87
87
  `),S=()=>{o(e=>({...e,inbox:{messages:[...e.inbox.messages,...b.map(e=>({id:jS(),from:e.from,text:e.text,timestamp:e.timestamp,status:`pending`,color:e.color,summary:e.summary}))]}}))};!t&&!n?(K(`[InboxPoller] Session idle, submitting immediately`),i(x)||(K(`[InboxPoller] Submission rejected, queuing for later delivery`),S())):(K(`[InboxPoller] Session busy, queuing for later delivery`),S()),u()},[e,t,n,i,o,c,a]);(0,Q.useEffect)(()=>{if(!e||t||n)return;let r=a.getState();if(!CP(r))return;let s=r.inbox.messages.filter(e=>e.status===`pending`),c=r.inbox.messages.filter(e=>e.status===`processed`);if(c.length>0){K(`[InboxPoller] Cleaning up ${c.length} processed message(s) that were delivered mid-turn`);let e=new Set(c.map(e=>e.id));o(t=>({...t,inbox:{messages:t.inbox.messages.filter(t=>!e.has(t.id))}}))}if(s.length!==0)if(K(`[InboxPoller] Session idle, delivering ${s.length} pending message(s)`),i(s.map(e=>{let t=e.color?` color="${e.color}"`:``,n=e.summary?` summary="${e.summary}"`:``;return`<teammate-message teammate_id="${e.from}"${t}${n}>\n${e.text}\n</teammate-message>`}).join(`
88
88
 
89
- `))){let e=new Set(s.map(e=>e.id));o(t=>({...t,inbox:{messages:t.inbox.messages.filter(t=>!e.has(t.id))}}))}else K(`[InboxPoller] Submission rejected, keeping messages queued`)},[e,t,n,i,o,s,a]),se(()=>void l(),e&&CP(a.getState())?wP:null);let u=(0,Q.useRef)(!1);(0,Q.useEffect)(()=>{e&&(u.current||CP(a.getState())&&(u.current=!0,l()))},[e,l,a])}q(),Av();var EP=1e3;function DP({taskListId:e,isLoading:t,onSubmitTask:n}){let r=(0,Q.useRef)(null),i=(0,Q.useRef)(null),a=(0,Q.useRef)(t);a.current=t;let o=(0,Q.useRef)(n);o.current=n;let s=e!==void 0,c=e??`tasklist`,l=(0,Q.useRef)(async()=>{});l.current=async()=>{if(!s||a.current)return;let t=await Ev(e);if(r.current!==null){let e=t.find(e=>e.id===r.current);if(!e||e.status===`completed`)K(`[TaskListWatcher] Task #${r.current} is marked complete, ready for next task`),r.current=null;else return}let n=OP(t);if(!n)return;K(`[TaskListWatcher] Found available task #${n.id}: ${n.subject}`);let i=await wv(e,n.id,c);if(!i.success){K(`[TaskListWatcher] Failed to claim task #${n.id}: ${i.reason}`);return}r.current=n.id;let l=kP(n);K(`[TaskListWatcher] Submitting task #${n.id} as prompt`),o.current(l)||(K(`[TaskListWatcher] Failed to submit task #${n.id}, releasing claim`),await Tv(e,n.id,{owner:void 0}),r.current=null)};let u=(0,Q.useRef)(()=>{});(0,Q.useEffect)(()=>{if(!s)return;Cv(e);let t=kv(e),n=null,r=()=>{i.current&&clearTimeout(i.current),i.current=setTimeout(e=>void e.current(),EP,l)};u.current=r;try{n=kS(t,r),n.unref(),K(`[TaskListWatcher] Watching for tasks in ${t}`)}catch(e){K(`[TaskListWatcher] Failed to watch ${t}: ${e}`)}return r(),()=>{u.current=()=>{},n&&n.close(),i.current&&clearTimeout(i.current)}},[s,e]),(0,Q.useEffect)(()=>{s&&(t||u.current())},[s,t])}function OP(e){let t=new Set(e.filter(e=>e.status!==`completed`).map(e=>e.id));return e.find(e=>e.status!==`pending`||e.owner?!1:e.blockedBy.every(e=>!t.has(e)))}function kP(e){let t=`Complete all open tasks. Start with task #${e.id}: \n\n ${e.subject}`;return e.description&&(t+=`\n\n${e.description}`),t}Et(),s(),nl();function AP({autoConnectIdeFlag:e,ideToInstallExtension:t,setDynamicMcpConfig:n,setShowIdeOnboarding:r,setIDEInstallationState:i}){(0,Q.useEffect)(()=>{function o(r){r&&(pn().autoConnectIde||e||Ph()||process.env.CLAUDE_CODE_SSE_PORT||t||c(process.env.CLAUDE_CODE_AUTO_CONNECT_IDE))&&!a(process.env.CLAUDE_CODE_AUTO_CONNECT_IDE)&&n(e=>e?.ide?e:{...e,ide:{type:r.url.startsWith(`ws:`)?`ws-ide`:`sse-ide`,url:r.url,ideName:r.name,authToken:r.authToken,ideRunningInWindows:r.ideRunningInWindows,scope:`dynamic`}})}Ji(o,t,()=>r(!0),e=>i(e))},[e,t,n,r,i])}dx(),ty(),H(),Jv(),Bu(),Z(),Et(),Kr(),s();function jP({onBackgroundSession:e,isLoading:t}){let n=Hc(),r=gc(),[i,a]=(0,Q.useState)(!1),o=ne(a,e,()=>{}),s=(0,Q.useCallback)(()=>{c(process.env.CLAUDE_CODE_DISABLE_BACKGROUND_TASKS)||(Pl(r.getState())?(Yg(()=>r.getState(),n),pn().hasUsedBackgroundTask||rn(e=>e.hasUsedBackgroundTask?e:{...e,hasUsedBackgroundTask:!0})):c(`false`)&&t&&o())},[n,r,t,o]),l=X(Pl),u=c(`false`);we(`task:background`,s,{context:`Task`,isActive:l||u&&t});let d=pd(`task:background`,`Task`,`ctrl+b`),f=Jr.terminal===`tmux`&&d===`ctrl+b`?`ctrl+b ctrl+b`:d;return!t||!i?null:(0,$.jsx)(U,{paddingLeft:2,children:(0,$.jsx)(R,{dimColor:!0,children:(0,$.jsx)(he,{shortcut:f,action:`background`})})})}Z();function MP({setMessages:e,setIsLoading:t,resetLoadingState:n,setAbortController:r,onBackgroundQuery:i}){let a=X(e=>e.foregroundedTaskId),o=X(e=>e.foregroundedTaskId?e.tasks[e.foregroundedTaskId]:void 0),s=Hc(),c=(0,Q.useRef)(0),l=(0,Q.useCallback)(()=>{if(a){s(e=>{let t=e.foregroundedTaskId;if(!t)return e;let n=e.tasks[t];return n?{...e,foregroundedTaskId:void 0,tasks:{...e.tasks,[t]:{...n,isBackgrounded:!0}}}:{...e,foregroundedTaskId:void 0}}),e([]),n(),r(null);return}i()},[a,s,e,n,r,i]);return(0,Q.useEffect)(()=>{if(!a){c.current=0;return}if(!o||o.type!==`local_agent`){s(e=>({...e,foregroundedTaskId:void 0})),n(),c.current=0;return}let i=o.messages??[];if(i.length!==c.current&&(c.current=i.length,e([...i])),o.status===`running`){let e=o.abortController;if(e?.signal.aborted){s(e=>{if(!e.foregroundedTaskId)return e;let t=e.tasks[e.foregroundedTaskId];return t?{...e,foregroundedTaskId:void 0,tasks:{...e.tasks,[e.foregroundedTaskId]:{...t,isBackgrounded:!0}}}:{...e,foregroundedTaskId:void 0}}),n(),r(null),c.current=0;return}t(!0),e&&r(e)}else s(e=>{let t=e.foregroundedTaskId;if(!t)return e;let n=e.tasks[t];return n?{...e,foregroundedTaskId:void 0,tasks:{...e.tasks,[t]:{...n,isBackgrounded:!0}}}:{...e,foregroundedTaskId:void 0}}),n(),r(null),c.current=0},[a,o,s,e,t,n,r]),{handleBackgroundSession:l}}fm(),H(),$n(),Et(),on(),er(),Rc(),rx(),Mb();var NP=3e4;function PP({model:e,onDone:t}){let n=Mu(),r=(0,Q.useRef)(t);(0,Q.useEffect)(()=>{r.current=t});let i=(0,Q.useCallback)(()=>{r.current(`dismiss`)},[]);(0,Q.useEffect)(()=>{RP()},[]),(0,Q.useEffect)(()=>{let e=setTimeout(i,NP);return()=>clearTimeout(e)},[i]);let a=bu(e),o=a?Kl(a):`high`,s=(0,Q.useCallback)(e=>{Jn(`userSettings`,{effortLevel:Nd(e===o?void 0:e)}),r.current(e)},[o]),c=[{label:(0,$.jsx)(IP,{level:`medium`,text:`Medium (recommended)`}),value:`medium`},{label:(0,$.jsx)(IP,{level:`high`,text:`High`}),value:`high`},{label:(0,$.jsx)(IP,{level:`low`,text:`Low`}),value:`low`}];return(0,$.jsx)(Pb,{title:n.dialogTitle,children:(0,$.jsxs)(U,{flexDirection:`column`,paddingX:2,paddingY:1,children:[(0,$.jsx)(U,{marginBottom:1,flexDirection:`column`,children:(0,$.jsx)(R,{children:n.dialogDescription})}),(0,$.jsx)(U,{marginBottom:1,children:(0,$.jsxs)(R,{dimColor:!0,children:[(0,$.jsx)(FP,{level:`low`}),` low `,`·`,` `,(0,$.jsx)(FP,{level:`medium`}),` medium `,`·`,` `,(0,$.jsx)(FP,{level:`high`}),` high`]})}),(0,$.jsx)(so,{options:c,onChange:s,onCancel:i})]})})}function FP({level:e}){return(0,$.jsx)(R,{color:`suggestion`,children:Qb(e)})}function IP({level:e,text:t}){return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(FP,{level:e}),` `,t]})}function LP(e){if(!Ot(e).toLowerCase().includes(`opus-4-6`))return!1;let t=pn();return t.effortCalloutV2Dismissed?!1:t.numStartups<=1?(RP(),!1):gr()?t.effortCalloutDismissed?(RP(),!1):Mu().enabled:Vn()||fr()?Mu().enabled:(RP(),!1)}function RP(){rn(e=>e.effortCalloutV2Dismissed?e:{...e,effortCalloutV2Dismissed:!0})}Ly(),Fb(),fn();function zP(e,t){let[n,r]=Q.useState(t);return Q.useEffect(()=>{Hn(e,t).then(r)},[e,t]),n}async function BP(e,t,n){try{K(`Collecting transcript for sharing`,{level:`info`});let r=Bs(e),i=await yh(Zm(e)),a;try{let e=Ul(),{size:t}=await NS(e);t<=52428800?a=await MS(e,`utf-8`):K(`Skipping raw transcript read: file too large (${t} bytes)`,{level:`warn`})}catch{}let o=Mx(vr({trigger:t,version:`2.6.0`,platform:process.platform,transcript:r,subagentTranscripts:Object.keys(i).length>0?i:void 0,rawTranscriptJsonl:a}));await cn();let s=jn();if(s.error)return{success:!1};let c={"Content-Type":`application/json`,"User-Agent":hn(),...s.headers},l=await m.post(`https://api.anthropic.com/api/claude_code_shared_session_transcripts`,{content:o,appearance_id:n},{headers:c,timeout:3e4});if(l.status===200||l.status===201){let e=l.data;return K(`Transcript shared successfully`,{level:`info`}),{success:!0,transcriptId:e?.transcript_id}}return{success:!1}}catch(e){return K(br(e),{level:`error`}),{success:!1}}}var VP=t((()=>{h(),$n(),q(),Cr(),Qs(),_a(),kr()}));Nn(),VP();function HP({hideThanksAfterMs:e,onOpen:t,onSelect:n,shouldShowTranscriptPrompt:r,onTranscriptPromptShown:i,onTranscriptSelect:a}){let[o,s]=(0,Q.useState)(`closed`),[c,l]=(0,Q.useState)(null),u=(0,Q.useRef)(jS()),d=(0,Q.useRef)(null),f=(0,Q.useCallback)(()=>{s(`thanks`),setTimeout((e,t)=>{e(`closed`),t(null)},e,s,l)},[e]),p=(0,Q.useCallback)(()=>{s(`submitted`),setTimeout(s,e,`closed`)},[e]);return{state:o,lastResponse:c,open:(0,Q.useCallback)(()=>{o===`closed`&&(s(`open`),u.current=jS(),t(u.current))},[o,t]),handleSelect:(0,Q.useCallback)(e=>{if(l(e),d.current=e,n(u.current,e),e===`dismissed`)s(`closed`),l(null);else if(r?.(e))return s(`transcript_prompt`),i?.(u.current,e),!0;else f();return!1},[f,n,r,i]),handleTranscriptSelect:(0,Q.useCallback)(e=>{switch(e){case`yes`:s(`submitting`),(async()=>{try{await a?.(u.current,e,d.current)?p():f()}catch{f()}})();break;case`no`:case`dont_ask_again`:a?.(u.current,e,d.current),f();break}},[f,p,a])}}J(),Et(),s(),Qs(),on(),er();var UP={minTimeBeforeFeedbackMs:6e5,minTimeBetweenFeedbackMs:36e5,minTimeBetweenGlobalFeedbackMs:1e8,minUserTurnsBeforeFeedback:5,minUserTurnsBetweenFeedback:10,hideThanksAfterMs:3e3,onForModels:[`*`],probability:.005},WP={probability:0};function GP(e,t,n,r=`session`,i=!1){let a=(0,Q.useRef)(`unknown`);a.current=io(e)?.message?.id||`unknown`;let[o,s]=(0,Q.useState)(()=>({timeLastShown:null,submitCountAtLastAppearance:null})),l=zP(`tengu_feedback_survey_config`,UP),u=zP(`tengu_bad_survey_transcript_ask_config`,WP),d=zP(`tengu_good_survey_transcript_ask_config`,WP),f=Wt().feedbackSurveyRate,p=(0,Q.useRef)(Date.now()),m=(0,Q.useRef)(n),h=(0,Q.useRef)(n);h.current=n;let g=(0,Q.useRef)(e);g.current=e;let _=(0,Q.useRef)(!1),v=(0,Q.useRef)(null),y=(0,Q.useCallback)((e,t)=>{s(n=>n.timeLastShown===e&&n.submitCountAtLastAppearance===t?n:{timeLastShown:e,submitCountAtLastAppearance:t}),pn().feedbackSurveyState?.lastShownTime!==e&&rn(t=>({...t,feedbackSurveyState:{lastShownTime:e}}))},[]),b=(0,Q.useCallback)(e=>{y(Date.now(),h.current),Y(`tengu_feedback_survey_event`,{event_type:`appeared`,appearance_id:e,last_assistant_message_id:a.current,survey_type:r}),fv(`feedback_survey`,{event_type:`appeared`,appearance_id:e,survey_type:r})},[y,r]),x=(0,Q.useCallback)((e,t)=>{y(Date.now(),h.current),Y(`tengu_feedback_survey_event`,{event_type:`responded`,appearance_id:e,response:t,last_assistant_message_id:a.current,survey_type:r}),fv(`feedback_survey`,{event_type:`responded`,appearance_id:e,response:t,survey_type:r})},[y,r]),S=(0,Q.useCallback)(e=>{if(e!==`bad`&&e!==`good`||pn().transcriptShareDismissed||!Ca(`allow_product_feedback`))return!1;let t=e===`bad`?u.probability:d.probability;return Math.random()<=t},[u.probability,d.probability]),C=(0,Q.useCallback)((e,t)=>{let n=t===`good`?`good_feedback_survey`:`bad_feedback_survey`;Y(`tengu_feedback_survey_event`,{event_type:`transcript_prompt_appeared`,appearance_id:e,last_assistant_message_id:a.current,survey_type:r,trigger:n}),fv(`feedback_survey`,{event_type:`transcript_prompt_appeared`,appearance_id:e,survey_type:r})},[r]),w=(0,Q.useCallback)(async(e,t,n)=>{let i=n===`good`?`good_feedback_survey`:`bad_feedback_survey`;if(Y(`tengu_feedback_survey_event`,{event_type:`transcript_share_${t}`,appearance_id:e,last_assistant_message_id:a.current,survey_type:r,trigger:i}),t===`dont_ask_again`&&rn(e=>({...e,transcriptShareDismissed:!0})),t===`yes`){let t=await BP(g.current,i,e);return Y(`tengu_feedback_survey_event`,{event_type:t.success?`transcript_share_submitted`:`transcript_share_failed`,appearance_id:e,trigger:i}),t.success}return!1},[r]),{state:T,lastResponse:E,open:D,handleSelect:O,handleTranscriptSelect:k}=HP({hideThanksAfterMs:l.hideThanksAfterMs,onOpen:b,onSelect:x,shouldShowTranscriptPrompt:S,onTranscriptPromptShown:C,onTranscriptSelect:w}),A=Nt(),j=(0,Q.useMemo)(()=>l.onForModels.length===0?!1:l.onForModels.includes(`*`)?!0:l.onForModels.includes(A),[l.onForModels,A]),M=(0,Q.useMemo)(()=>{if(T!==`closed`||t||i)return!1;if(process.env.CLAUDE_FORCE_DISPLAY_SURVEY&&!o.timeLastShown)return!0;if(!j||c(process.env.CLAUDE_CODE_DISABLE_FEEDBACK_SURVEY)||sr()||!Ca(`allow_product_feedback`))return!1;if(o.timeLastShown){if(Date.now()-o.timeLastShown<l.minTimeBetweenFeedbackMs||o.submitCountAtLastAppearance!==null&&n<o.submitCountAtLastAppearance+l.minUserTurnsBetweenFeedback)return!1}else if(Date.now()-p.current<l.minTimeBeforeFeedbackMs||n<m.current+l.minUserTurnsBeforeFeedback)return!1;if(v.current!==n&&(v.current=n,_.current=Math.random()<=(f??l.probability)),!_.current)return!1;let e=pn().feedbackSurveyState;return!(e?.lastShownTime&&Date.now()-e.lastShownTime<l.minTimeBetweenGlobalFeedbackMs)},[T,t,i,j,o.timeLastShown,o.submitCountAtLastAppearance,n,l.minTimeBetweenFeedbackMs,l.minTimeBetweenGlobalFeedbackMs,l.minUserTurnsBetweenFeedback,l.minTimeBeforeFeedbackMs,l.minUserTurnsBeforeFeedback,l.probability,f]);return(0,Q.useEffect)(()=>{M&&D()},[M,D]),{state:T,lastResponse:E,handleSelect:O,handleTranscriptSelect:k}}Nn(),fn(),J(),ml(),Et(),s(),Qs(),hv(),VP();var KP=3e3,qP=`tengu_dunwich_bell`,JP=`tengu_memory_survey_event`,YP=.2,XP=`memory_survey`,ZP=/\bmemor(?:y|ies)\b/i;function QP(e){for(let t of e){if(t.type!==`assistant`)continue;let e=t.message.content;if(Array.isArray(e))for(let t of e){if(t.type!==`tool_use`||t.name!==`Read`)continue;let e=t.input;if(typeof e.file_path==`string`&&Na(e.file_path))return!0}}return!1}function $P(e,t,n=!1,{enabled:r=!0}={}){let i=(0,Q.useRef)(new Set),a=(0,Q.useRef)(!1),o=(0,Q.useRef)(e);o.current=e;let{state:s,lastResponse:l,open:u,handleSelect:d,handleTranscriptSelect:f}=HP({hideThanksAfterMs:KP,onOpen:(0,Q.useCallback)(e=>{Y(JP,{event_type:`appeared`,appearance_id:e}),fv(`feedback_survey`,{event_type:`appeared`,appearance_id:e,survey_type:`memory`})},[]),onSelect:(0,Q.useCallback)((e,t)=>{Y(JP,{event_type:`responded`,appearance_id:e,response:t}),fv(`feedback_survey`,{event_type:`responded`,appearance_id:e,response:t,survey_type:`memory`})},[]),shouldShowTranscriptPrompt:(0,Q.useCallback)(e=>!(process.env.USER_TYPE!==`ant`||e!==`bad`&&e!==`good`||pn().transcriptShareDismissed||!Ca(`allow_product_feedback`)),[]),onTranscriptPromptShown:(0,Q.useCallback)(e=>{Y(JP,{event_type:`transcript_prompt_appeared`,appearance_id:e,trigger:XP}),fv(`feedback_survey`,{event_type:`transcript_prompt_appeared`,appearance_id:e,survey_type:`memory`})},[]),onTranscriptSelect:(0,Q.useCallback)(async(e,t)=>{if(Y(JP,{event_type:`transcript_share_${t}`,appearance_id:e,trigger:XP}),t===`dont_ask_again`&&rn(e=>({...e,transcriptShareDismissed:!0})),t===`yes`){let t=await BP(o.current,XP,e);return Y(JP,{event_type:t.success?`transcript_share_submitted`:`transcript_share_failed`,appearance_id:e,trigger:XP}),t.success}return!1},[])}),p=(0,Q.useMemo)(()=>io(e),[e]);return(0,Q.useEffect)(()=>{if(!r)return;if(e.length===0){a.current=!1,i.current.clear();return}if(s!==`closed`||t||n||!Tn(qP,!1)||!ar()||sr()||!Ca(`allow_product_feedback`)||c(process.env.CLAUDE_CODE_DISABLE_FEEDBACK_SURVEY)||!p||i.current.has(p.uuid))return;let o=Ka(Array.isArray(p.message.content)?p.message.content:[],` `);ZP.test(o)&&(i.current.add(p.uuid),a.current||(a.current=QP(e)),a.current&&Math.random()<YP&&u())},[r,s,t,n,p,e,u]),{state:s,lastResponse:l,handleSelect:d,handleTranscriptSelect:f}}Nn(),fn(),J(),s(),Qs(),hv();var eF=3e3,tF=`tengu_post_compact_survey`,nF=.2;function rF(e,t){let n=e.findIndex(e=>e.uuid===t);if(n===-1)return!1;for(let t=n+1;t<e.length;t++){let n=e[t];if(n&&(n.type===`user`||n.type===`assistant`))return!0}return!1}function iF(e,t,n=!1,{enabled:r=!0}={}){let[i,a]=(0,Q.useState)(null),o=(0,Q.useRef)(new Set),s=(0,Q.useRef)(null),{state:l,lastResponse:u,open:d,handleSelect:f}=HP({hideThanksAfterMs:eF,onOpen:(0,Q.useCallback)(e=>{Y(`tengu_post_compact_survey_event`,{event_type:`appeared`,appearance_id:e,session_memory_compaction_enabled:hg()}),fv(`feedback_survey`,{event_type:`appeared`,appearance_id:e,survey_type:`post_compact`})},[]),onSelect:(0,Q.useCallback)((e,t)=>{Y(`tengu_post_compact_survey_event`,{event_type:`responded`,appearance_id:e,response:t,session_memory_compaction_enabled:hg()}),fv(`feedback_survey`,{event_type:`responded`,appearance_id:e,response:t,survey_type:`post_compact`})},[])});(0,Q.useEffect)(()=>{r&&a(Pn(tF))},[r]);let p=(0,Q.useMemo)(()=>new Set(e.filter(e=>Cl(e)).map(e=>e.uuid)),[e]);return(0,Q.useEffect)(()=>{if(!r||l!==`closed`||t||n||i!==!0||sr()||c(process.env.CLAUDE_CODE_DISABLE_FEEDBACK_SURVEY))return;if(s.current!==null&&rF(e,s.current)){s.current=null,Math.random()<nF&&d();return}let a=Array.from(p).filter(e=>!o.current.has(e));a.length>0&&(o.current=new Set(p),s.current=a[a.length-1])},[r,p,l,t,n,i,e,d]),{state:l,lastResponse:u,handleSelect:f}}Lt(),H();var aF=[`1`,`2`,`3`],oF={1:`yes`,2:`no`,3:`dont_ask_again`},sF=e=>aF.includes(e);function cF({onSelect:e,inputValue:t,setInputValue:n}){return _N({inputValue:t,setInputValue:n,isValidDigit:sF,onDigit:t=>e(oF[t])}),(0,$.jsxs)(U,{flexDirection:`column`,marginTop:1,children:[(0,$.jsxs)(U,{children:[(0,$.jsxs)(R,{color:`ansi:cyan`,children:[zt,` `]}),(0,$.jsx)(R,{bold:!0,children:`Can Anthropic look at your session transcript to help us improve Claude Code?`})]}),(0,$.jsx)(U,{marginLeft:2,children:(0,$.jsx)(R,{dimColor:!0,children:`Learn more: https://code.claude.com/docs/en/data-usage#session-quality-surveys`})}),(0,$.jsxs)(U,{marginLeft:2,children:[(0,$.jsx)(U,{width:10,children:(0,$.jsxs)(R,{children:[(0,$.jsx)(R,{color:`ansi:cyan`,children:`1`}),`: Yes`]})}),(0,$.jsx)(U,{width:10,children:(0,$.jsxs)(R,{children:[(0,$.jsx)(R,{color:`ansi:cyan`,children:`2`}),`: No`]})}),(0,$.jsx)(U,{children:(0,$.jsxs)(R,{children:[(0,$.jsx)(R,{color:`ansi:cyan`,children:`3`}),`: Don't ask again`]})})]})]})}J(),H();function lF({state:e,lastResponse:t,handleSelect:n,handleTranscriptSelect:r,inputValue:i,setInputValue:a,onRequestFeedback:o,message:s}){return e===`closed`?null:e===`thanks`?(0,$.jsx)(dF,{lastResponse:t,inputValue:i,setInputValue:a,onRequestFeedback:o}):e===`submitted`?(0,$.jsx)(U,{marginTop:1,children:(0,$.jsxs)(R,{color:`success`,children:[`✓`,` Thanks for sharing your transcript!`]})}):e===`submitting`?(0,$.jsx)(U,{marginTop:1,children:(0,$.jsxs)(R,{dimColor:!0,children:[`Sharing transcript`,`…`]})}):e===`transcript_prompt`?!r||i&&![`1`,`2`,`3`].includes(i)?null:(0,$.jsx)(cF,{onSelect:r,inputValue:i,setInputValue:a}):i&&!bN(i)?null:(0,$.jsx)(SN,{onSelect:n,inputValue:i,setInputValue:a,message:s})}var uF=e=>e===`1`;function dF({lastResponse:e,inputValue:t,setInputValue:n,onRequestFeedback:r}){let i=r&&e===`good`;_N({inputValue:t,setInputValue:n,isValidDigit:uF,enabled:!!i,once:!0,onDigit:()=>{Y(`tengu_feedback_survey_event`,{event_type:`followup_accepted`,response:e}),r?.()}});let a=process.env.USER_TYPE===`ant`?`/issue`:`/feedback`;return(0,$.jsxs)(U,{marginTop:1,flexDirection:`column`,children:[(0,$.jsx)(R,{color:`success`,children:`Thanks for the feedback!`}),i?(0,$.jsxs)(R,{dimColor:!0,children:[`(Optional) Press [`,(0,$.jsx)(R,{color:`ansi:cyan`,children:`1`}),`] to tell us what went well `,` · `,a]}):e===`bad`?(0,$.jsx)(R,{dimColor:!0,children:`Use /issue to report model behavior issues.`}):(0,$.jsxs)(R,{dimColor:!0,children:[`Use `,a,` to share detailed feedback anytime.`]})]})}tp(),ac(),ot(),Ac(),ii();function fF(e){let{addNotification:t}=Wp(),n=(0,Q.useRef)(!1),r=(0,Q.useRef)(e);r.current=e,(0,Q.useEffect)(()=>{$e()||n.current||(n.current=!0,Promise.resolve().then(()=>r.current()).then(e=>{if(e)for(let n of Array.isArray(e)?e:[e])t(n)}).catch(ai))},[t])}function pF(){fF(async()=>(await _c()).map((e,t)=>{let n=`low`;return e.type===`error`||e.userActionRequired?n=`high`:(e.type===`path`||e.type===`alias`)&&(n=`medium`),{key:`install-message-${t}-${e.type}`,text:e.message,priority:n,color:e.type===`error`?`error`:`warning`}}))}Nr(),N_(),q(),Qs(),on(),Mp(),zx(),ig(),ot();var mF=30,hF=`The user stepped away and is coming back. Write exactly 1-3 short sentences. Start by stating the high-level task — what they are building or debugging, not implementation details. Next: the concrete next step. Skip status reports and commit recaps.`,gF=`用户离开后回来了。用中文写 1-3 句话。先说明用户在做什么(高层目标,不是实现细节),然后说明下一步具体操作。不要写状态报告或提交总结。`;function _F(e){return`${e?`Session memory (broader context):\n${e}\n\n`:``}${Rx()===`zh`?gF:hF}`}async function vF(e,t){if(e.length===0)return null;let n=Yt(),r=cs()?jp({sessionId:Fe(),model:n,provider:Zt(),name:`away-summary`}):null;try{let i=await Su(),a=e.slice(-mF);a.push(Ud({content:_F(i)}));let o=await jh({messages:a,systemPrompt:iv([]),thinkingConfig:{type:`disabled`},tools:[],signal:t,options:{getToolPermissionContext:async()=>x_(),model:n,toolChoice:void 0,isNonInteractiveSession:!1,hasAppendSystemPrompt:!1,agents:[],querySource:`away_summary`,mcpTools:[],skipCacheWrite:!0,langfuseTrace:r}});return o.isApiErrorMessage?(K(`[awaySummary] API error: ${Hl(o)}`),ic(r,void 0,`error`),null):(ic(r),Hl(o))}catch(e){return e instanceof l||t.aborted?null:(K(`[awaySummary] generation failed: ${e}`),ic(r,void 0,`error`),null)}}H(),fn(),Qs();var yF=5*6e4;function bF(e){for(let t=e.length-1;t>=0;t--){let n=e[t];if(n.type===`user`&&!n.isMeta&&!n.isCompactSummary)return!1;if(n.type===`system`&&n.subtype===`away_summary`)return!0}return!1}function xF(e,t,n){let r=(0,Q.useRef)(null),i=(0,Q.useRef)(null),a=(0,Q.useRef)(e),o=(0,Q.useRef)(n),s=(0,Q.useRef)(!1),c=(0,Q.useRef)(null);a.current=e,o.current=n;let l=Tn(`tengu_sedge_lantern`,!1);(0,Q.useEffect)(()=>{if(!l)return;function e(){r.current!==null&&(clearTimeout(r.current),r.current=null)}function n(){i.current?.abort(),i.current=null}async function u(){if(s.current=!1,bF(a.current))return;n();let e=new AbortController;i.current=e;let r=await vF(a.current,e.signal);e.signal.aborted||r===null||t(e=>[...e,vg(r)])}function d(){if(r.current=null,o.current){s.current=!0;return}u()}function f(){let t=ue();t===`blurred`||t===`unknown`?(e(),r.current=setTimeout(d,yF)):t===`focused`&&(e(),n(),s.current=!1)}let p=P(f);return f(),c.current=u,()=>{p(),e(),n(),c.current=null}},[l,t]),(0,Q.useEffect)(()=>{if(n||!s.current)return;let e=ue();e!==`blurred`&&e!==`unknown`||c.current?.()},[n]),(0,Q.useEffect)(()=>{ue()===`unknown`&&l&&(n?(r.current!==null&&(clearTimeout(r.current),r.current=null),i.current?.abort(),i.current=null,s.current=!1):(r.current!==null&&clearTimeout(r.current),r.current=setTimeout(()=>{if(r.current=null,o.current){s.current=!0;return}c.current?.()},yF)))},[n,l])}H(),$n(),Ub(),s();function SF(){if(process.argv.includes(`--chrome`))return!0;if(process.argv.includes(`--no-chrome`))return!1}function CF(){fF(async()=>{let e=SF();return Vb(e)?process.env.USER_TYPE!==`ant`&&!Fn()?{key:`chrome-requires-subscription`,jsx:(0,$.jsx)(R,{color:`error`,children:`Claude in Chrome requires a claude.ai subscription`}),priority:`immediate`,timeoutMs:5e3}:!await Hb()&&!i()?{key:`chrome-extension-not-detected`,jsx:(0,$.jsx)(R,{color:`warning`,children:`Chrome extension not detected · https://claude.ai/chrome to install`}),priority:`immediate`,timeoutMs:3e3}:e===void 0?{key:`claude-in-chrome-default-enabled`,text:`Claude in Chrome enabled · /chrome`,priority:`low`}:null:null})}fn(),J(),Et(),q(),s(),Cr(),ii();function wF(){return c(process.env.CLAUDE_CODE_DISABLE_OFFICIAL_MARKETPLACE_AUTOINSTALL)}var TF={MAX_ATTEMPTS:10,INITIAL_DELAY_MS:3600*1e3,BACKOFF_MULTIPLIER:2,MAX_DELAY_MS:10080*60*1e3};function EF(e){let t=TF.INITIAL_DELAY_MS*TF.BACKOFF_MULTIPLIER**e;return Math.min(t,TF.MAX_DELAY_MS)}function DF(e){if(!e.officialMarketplaceAutoInstallAttempted)return!0;if(e.officialMarketplaceAutoInstalled)return!1;let t=e.officialMarketplaceAutoInstallFailReason,n=e.officialMarketplaceAutoInstallRetryCount||0,r=e.officialMarketplaceAutoInstallNextRetryTime,i=Date.now();return n>=TF.MAX_ATTEMPTS||t===`policy_blocked`||r&&i<r?!1:t===`unknown`||t===`git_unavailable`||t===`gcs_unavailable`||t===void 0}async function OF(){let e=pn();if(!DF(e)){let t=e.officialMarketplaceAutoInstallFailReason??`already_attempted`;return K(`Official marketplace auto-install skipped: ${t}`),{installed:!1,skipped:!0,reason:t}}try{if(wF())return K(`Official marketplace auto-install disabled via env var, skipping`),rn(e=>({...e,officialMarketplaceAutoInstallAttempted:!0,officialMarketplaceAutoInstalled:!1,officialMarketplaceAutoInstallFailReason:`policy_blocked`})),Y(`tengu_official_marketplace_auto_install`,{installed:!1,skipped:!0,policy_blocked:!0}),{installed:!1,skipped:!0,reason:`policy_blocked`};if((await rs())[`claude-plugins-official`])return K(`Official marketplace '${Ll}' already installed, skipping`),rn(e=>({...e,officialMarketplaceAutoInstallAttempted:!0,officialMarketplaceAutoInstalled:!0})),{installed:!1,skipped:!0,reason:`already_installed`};if(!Wm(lo))return K(`Official marketplace blocked by enterprise policy, skipping`),rn(e=>({...e,officialMarketplaceAutoInstallAttempted:!0,officialMarketplaceAutoInstalled:!1,officialMarketplaceAutoInstallFailReason:`policy_blocked`})),Y(`tengu_official_marketplace_auto_install`,{installed:!1,skipped:!0,policy_blocked:!0}),{installed:!1,skipped:!0,reason:`policy_blocked`};let t=h_(),n=wS(t,Ll);if(await ud(n,t)!==null){let e=await rs();return e[Ll]={source:lo,installLocation:n,lastUpdated:new Date().toISOString()},await As(e),rn(e=>({...e,officialMarketplaceAutoInstallAttempted:!0,officialMarketplaceAutoInstalled:!0,officialMarketplaceAutoInstallFailReason:void 0,officialMarketplaceAutoInstallRetryCount:void 0,officialMarketplaceAutoInstallLastAttemptTime:void 0,officialMarketplaceAutoInstallNextRetryTime:void 0})),Y(`tengu_official_marketplace_auto_install`,{installed:!0,skipped:!1,via_gcs:!0}),{installed:!0,skipped:!1}}if(!Tn(`tengu_plugin_official_mkt_git_fallback`,!0)){K(`Official marketplace GCS failed; git fallback disabled by flag — skipping install`);let t=(e.officialMarketplaceAutoInstallRetryCount||0)+1,n=Date.now(),r=n+EF(t);return rn(e=>({...e,officialMarketplaceAutoInstallAttempted:!0,officialMarketplaceAutoInstalled:!1,officialMarketplaceAutoInstallFailReason:`gcs_unavailable`,officialMarketplaceAutoInstallRetryCount:t,officialMarketplaceAutoInstallLastAttemptTime:n,officialMarketplaceAutoInstallNextRetryTime:r})),Y(`tengu_official_marketplace_auto_install`,{installed:!1,skipped:!0,gcs_unavailable:!0,retry_count:t}),{installed:!1,skipped:!0,reason:`gcs_unavailable`}}if(!await Zg()){K(`Git not available, skipping official marketplace auto-install`);let t=(e.officialMarketplaceAutoInstallRetryCount||0)+1,n=Date.now(),r=n+EF(t),i=!1;try{rn(e=>({...e,officialMarketplaceAutoInstallAttempted:!0,officialMarketplaceAutoInstalled:!1,officialMarketplaceAutoInstallFailReason:`git_unavailable`,officialMarketplaceAutoInstallRetryCount:t,officialMarketplaceAutoInstallLastAttemptTime:n,officialMarketplaceAutoInstallNextRetryTime:r}))}catch(e){i=!0,ai(yr(e)),K(`Failed to save marketplace auto-install git_unavailable state: ${e}`,{level:`error`})}return Y(`tengu_official_marketplace_auto_install`,{installed:!1,skipped:!0,git_unavailable:!0,retry_count:t}),{installed:!1,skipped:!0,reason:`git_unavailable`,configSaveFailed:i}}K(`Attempting to auto-install official marketplace`),await jo(lo),K(`Successfully auto-installed official marketplace`);let r=e.officialMarketplaceAutoInstallRetryCount||0;return rn(e=>({...e,officialMarketplaceAutoInstallAttempted:!0,officialMarketplaceAutoInstalled:!0,officialMarketplaceAutoInstallFailReason:void 0,officialMarketplaceAutoInstallRetryCount:void 0,officialMarketplaceAutoInstallLastAttemptTime:void 0,officialMarketplaceAutoInstallNextRetryTime:void 0})),Y(`tengu_official_marketplace_auto_install`,{installed:!0,skipped:!1,retry_count:r}),{installed:!0,skipped:!1}}catch(t){let n=t instanceof Error?t.message:String(t);if(n.includes(`xcrun: error:`))return Bg(),K(`Official marketplace auto-install: git is a non-functional macOS xcrun shim, treating as git_unavailable`),Y(`tengu_official_marketplace_auto_install`,{installed:!1,skipped:!0,git_unavailable:!0,macos_xcrun_shim:!0}),{installed:!1,skipped:!0,reason:`git_unavailable`};K(`Failed to auto-install official marketplace: ${n}`,{level:`error`}),ai(yr(t));let r=(e.officialMarketplaceAutoInstallRetryCount||0)+1,i=Date.now(),a=i+EF(r),o=!1;try{rn(e=>({...e,officialMarketplaceAutoInstallAttempted:!0,officialMarketplaceAutoInstalled:!1,officialMarketplaceAutoInstallFailReason:`unknown`,officialMarketplaceAutoInstallRetryCount:r,officialMarketplaceAutoInstallLastAttemptTime:i,officialMarketplaceAutoInstallNextRetryTime:a}))}catch(e){o=!0,ai(yr(e)),K(`Failed to save marketplace auto-install failure state: ${e}`,{level:`error`})}return Y(`tengu_official_marketplace_auto_install`,{installed:!1,skipped:!0,failed:!0,retry_count:r}),{installed:!1,skipped:!0,reason:`unknown`,configSaveFailed:o}}}H(),q();function kF(){fF(async()=>{let e=await OF(),t=[];return e.configSaveFailed&&(K(`Showing marketplace config save failure notification`),t.push({key:`marketplace-config-save-failed`,jsx:(0,$.jsx)(R,{color:`error`,children:`Failed to save marketplace retry info · Check ~/.claude.json permissions`}),priority:`immediate`,timeoutMs:1e4})),e.installed?(K(`Showing marketplace installation success notification`),t.push({key:`marketplace-installed`,jsx:(0,$.jsx)(R,{color:`success`,children:`✓ Anthropic marketplace installed · /plugin to see available plugins`}),priority:`immediate`,timeoutMs:7e3})):e.skipped&&e.reason===`unknown`&&(K(`Showing marketplace installation failure notification`),t.push({key:`marketplace-install-failed`,jsx:(0,$.jsx)(R,{color:`warning`,children:`Failed to install Anthropic marketplace · Will retry on next startup`}),priority:`immediate`,timeoutMs:8e3})),t})}ii(),w(),Ui(),up();var AF=Hi(()=>b({method:v(`notifications/message`),params:b({prompt:_(),image:b({type:v(`base64`),media_type:y([`image/jpeg`,`image/png`,`image/gif`,`image/webp`]),data:_()}).optional(),tabId:g().optional()})}));function jF(e,t){let n=(0,Q.useRef)(void 0);(0,Q.useEffect)(()=>{if(process.env.USER_TYPE!==`ant`)return;let t=MF(e);n.current!==t&&(n.current=t),t&&t.client.setNotificationHandler(AF(),e=>{if(n.current!==t)return;let{tabId:r,prompt:i,image:a}=e.params;if(!(typeof r!=`number`||!Xv(r)))try{tm(a?{value:[{type:`text`,text:i},{type:`image`,source:{type:a.type,media_type:a.media_type,data:a.data}}],mode:`prompt`}:{value:i,mode:`prompt`})}catch(e){ai(e)}})},[e]),(0,Q.useEffect)(()=>{let n=MF(e);n&&bp(`set_permission_mode`,{mode:t===`bypassPermissions`?`skip_all_permission_checks`:`ask`},n)},[e,t])}function MF(e){return e.find(e=>e.type===`connected`&&e.name===`claude-in-chrome`)}er(),J();function NF(e){if(e.length===0)return;if(e.length===1)return e[0];let t=e.map(e=>({tip:e,sessions:uS(e.id)}));return t.sort((e,t)=>t.sessions-e.sessions),t[0]?.tip}async function PF(e){if(Qn().spinnerTipsEnabled===!1)return;let t=await pS(e);if(t.length!==0)return NF(t)}function FF(e){sS(e.id),Y(`tengu_tip_shown`,{tipIdLength:e.id,cooldownSessions:e.cooldownSessions})}Tx(),sg();function IF(e,t,n){let r=(0,Q.useRef)(!1);(0,Q.useEffect)(()=>{!$u()||r.current||(r.current=!0,e&&aa(e,n))},[t,e,n])}H(),Sp(),J(),Rc(),Mb();function LF({hostPattern:{host:e},onUserResponse:t}){function n(n){switch(process.env.USER_TYPE===`ant`&&Y(`tengu_sandbox_network_dialog_result`,{host:e,result:n}),n){case`yes`:t({allow:!0,persistToSettings:!1});break;case`yes-dont-ask-again`:t({allow:!0,persistToSettings:!0});break;case`no`:t({allow:!1,persistToSettings:!1});break}}let r=[{label:`Yes`,value:`yes`},...Fh()?[]:[{label:(0,$.jsxs)(R,{children:[`Yes, and don't ask again for `,(0,$.jsx)(R,{bold:!0,children:e})]}),value:`yes-dont-ask-again`}],{label:(0,$.jsxs)(R,{children:[`No, and tell Claude what to do differently `,(0,$.jsx)(R,{bold:!0,children:`(esc)`})]}),value:`no`}];return(0,$.jsx)(Pb,{title:`Network request outside of sandbox`,children:(0,$.jsxs)(U,{flexDirection:`column`,paddingX:2,paddingY:1,children:[(0,$.jsxs)(U,{children:[(0,$.jsx)(R,{dimColor:!0,children:`Host:`}),(0,$.jsxs)(R,{children:[` `,e]})]}),(0,$.jsx)(U,{marginTop:1,children:(0,$.jsx)(R,{children:`Do you want to allow this connection?`})}),(0,$.jsx)(U,{children:(0,$.jsx)(so,{options:r,onChange:n,onCancel:()=>{process.env.USER_TYPE===`ant`&&Y(`tengu_sandbox_network_dialog_result`,{host:e,result:`cancel`}),t({allow:!1,persistToSettings:!1})}})})]})})}H(),Sp(),si();function RF(e){return`${e.getHours()%12||12}:${String(e.getMinutes()).padStart(2,`0`)}:${String(e.getSeconds()).padStart(2,`0`)}${e.getHours()<12?`am`:`pm`}`}function zF(){let[e,t]=(0,Q.useState)([]),[n,r]=(0,Q.useState)(0);return(0,Q.useEffect)(()=>{let e=qh.getSandboxViolationStore();return e.subscribe(n=>{t(n.slice(-10)),r(e.getTotalCount())})},[]),!qh.isSandboxingEnabled()||oi()===`linux`||n===0?null:(0,$.jsxs)(U,{flexDirection:`column`,marginTop:1,children:[(0,$.jsx)(U,{marginLeft:0,children:(0,$.jsxs)(R,{color:`permission`,children:[`⧈ Sandbox blocked `,n,` total `,n===1?`operation`:`operations`]})}),e.map((e,t)=>(0,$.jsx)(U,{paddingLeft:2,children:(0,$.jsxs)(R,{dimColor:!0,children:[RF(e.timestamp),e.command?` ${e.command}:`:``,` `,e.line]})},`${e.timestamp.getTime()}-${t}`)),(0,$.jsx)(U,{paddingLeft:2,children:(0,$.jsxs)(R,{dimColor:!0,children:[`… showing last `,Math.min(10,e.length),` of `,n]})})]})}cx(),Ac(),ot(),H();var BF=[];function VF({mcpClients:e=BF}){let{addNotification:t}=Wp();(0,Q.useEffect)(()=>{if($e())return;let n=e.filter(e=>e.type===`failed`&&e.config.type!==`sse-ide`&&e.config.type!==`ws-ide`&&e.config.type!==`claudeai-proxy`),r=e.filter(e=>e.type===`failed`&&e.config.type===`claudeai-proxy`&&wd(e.name)),i=e.filter(e=>e.type===`needs-auth`&&e.config.type!==`claudeai-proxy`),a=e.filter(e=>e.type===`needs-auth`&&e.config.type===`claudeai-proxy`&&wd(e.name));n.length===0&&r.length===0&&i.length===0&&a.length===0||(n.length>0&&t({key:`mcp-failed`,jsx:(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(R,{color:`error`,children:[n.length,` MCP `,n.length===1?`server`:`servers`,` failed`]}),(0,$.jsx)(R,{dimColor:!0,children:` · /mcp`})]}),priority:`medium`}),r.length>0&&t({key:`mcp-claudeai-failed`,jsx:(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(R,{color:`error`,children:[r.length,` claude.ai `,r.length===1?`connector`:`connectors`,` `,`unavailable`]}),(0,$.jsx)(R,{dimColor:!0,children:` · /mcp`})]}),priority:`medium`}),i.length>0&&t({key:`mcp-needs-auth`,jsx:(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(R,{color:`warning`,children:[i.length,` MCP `,i.length===1?`server needs`:`servers need`,` `,`auth`]}),(0,$.jsx)(R,{dimColor:!0,children:` · /mcp`})]}),priority:`medium`}),a.length>0&&t({key:`mcp-claudeai-needs-auth`,jsx:(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(R,{color:`warning`,children:[a.length,` claude.ai`,` `,a.length===1?`connector needs`:`connectors need`,` auth`]}),(0,$.jsx)(R,{dimColor:!0,children:` · /mcp`})]}),priority:`medium`}))},[t,e])}H(),er(),of();var HF=`Auto mode lets Claude handle permission prompts automatically — Claude checks each tool call for risky actions and prompt injection before executing. Actions Claude identifies as safe are executed, while actions Claude identifies as risky are blocked and Claude may try a different approach. Ideal for long-running tasks. Sessions are slightly more expensive. Claude can make mistakes that allow harmful commands to run, it's recommended to only use in isolated environments. Shift+Tab to change mode.`;O(),ot(),Ac(),H(),Z(),q(),s();var UF=5e3;function WF(){let{addNotification:e}=Wp(),t=Hc(),[n,r]=Q.useState(()=>c(`true`)),i=Q.useRef(new Set),a=Q.useCallback((n,r)=>{let a=`${n}:${r}`;if(i.current.has(a))return;i.current.add(a),K(`LSP error: ${n} - ${r}`),t(e=>{let t=new Set(e.plugins.errors.map(e=>e.type===`generic-error`?`generic-error:${e.source}:${e.error}`:`${e.type}:${e.source}`)),i=`generic-error:${n}:${r}`;return t.has(i)?e:{...e,plugins:{...e.plugins,errors:[...e.plugins.errors,{type:`generic-error`,source:n,error:r}]}}});let o=n.startsWith(`plugin:`)?n.split(`:`)[1]??n:n;e({key:`lsp-error-${n}`,jsx:(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(R,{color:`error`,children:[`LSP for `,o,` failed`]}),(0,$.jsx)(R,{dimColor:!0,children:` · /plugin for details`})]}),priority:`medium`,timeoutMs:8e3})},[e,t]),o=Q.useCallback(()=>{if($e()||Re())return;let e=sh();if(e.status===`failed`){a(`lsp-manager`,e.error.message),r(!1);return}if(e.status===`pending`||e.status===`not-started`)return;let t=Sm();if(t){let e=t.getAllServers();for(let[t,n]of e)n.state===`error`&&n.lastError&&a(t,n.lastError.message)}},[a]);se(o,n?UF:null),Q.useEffect(()=>{$e()||!n||o()},[o,n])}q();var GF=new Map;async function KF(e){if(!e||!e.trim())return K(`[binaryCheck] Empty command provided, returning false`),!1;let t=e.trim(),n=GF.get(t);if(n!==void 0)return K(`[binaryCheck] Cache hit for '${t}': ${n}`),n;let r=!1;return await Wr(t).catch(()=>null)&&(r=!0),GF.set(t,r),K(`[binaryCheck] Binary '${t}' ${r?`found`:`not found`}`),r}Et(),q(),gu();var qF=5;function JF(e){return Ln.has(e.toLowerCase())}function YF(e){if(!e)return null;if(typeof e==`string`)return K(`[lspRecommendation] Skipping string path lspServers (not readable from marketplace)`),null;if(Array.isArray(e)){for(let t of e){if(typeof t==`string`)continue;let e=ZF(t);if(e)return e}return null}return ZF(e)}function XF(e){return typeof e==`object`&&!!e}function ZF(e){let t=new Set,n=null;for(let[r,i]of Object.entries(e)){if(!XF(i))continue;!n&&typeof i.command==`string`&&(n=i.command);let e=i.extensionToLanguage;if(XF(e))for(let n of Object.keys(e))t.add(n.toLowerCase())}return!n||t.size===0?null:{extensions:t,command:n}}async function QF(){let e=new Map;try{let t=await rs();for(let n of Object.keys(t))try{let t=await Tl(n),r=JF(n);for(let i of t.plugins){if(!i.lspServers)continue;let t=YF(i.lspServers);if(!t)continue;let a=`${i.name}@${n}`;e.set(a,{entry:i,marketplaceName:n,extensions:t.extensions,command:t.command,isOfficial:r})}}catch(e){K(`[lspRecommendation] Failed to load marketplace ${n}: ${e}`)}}catch(e){K(`[lspRecommendation] Failed to load marketplaces config: ${e}`)}return e}async function $F(e){if(nI())return K(`[lspRecommendation] Recommendations are disabled`),[];let t=CS(e).toLowerCase();if(!t)return K(`[lspRecommendation] No file extension found`),[];K(`[lspRecommendation] Looking for LSP plugins for ${t}`);let n=await QF(),r=pn().lspRecommendationNeverPlugins??[],i=[];for(let[e,a]of n)if(a.extensions.has(t)){if(r.includes(e)){K(`[lspRecommendation] Skipping ${e} (in never suggest list)`);continue}if(va(e)){K(`[lspRecommendation] Skipping ${e} (already installed)`);continue}i.push({info:a,pluginId:e})}let a=[];for(let{info:e,pluginId:t}of i)await KF(e.command)?(a.push({info:e,pluginId:t}),K(`[lspRecommendation] Binary '${e.command}' found for ${t}`)):K(`[lspRecommendation] Skipping ${t} (binary '${e.command}' not found)`);return a.sort((e,t)=>e.info.isOfficial&&!t.info.isOfficial?-1:!e.info.isOfficial&&t.info.isOfficial?1:0),a.map(({info:e,pluginId:t})=>({pluginId:t,pluginName:e.entry.name,marketplaceName:e.marketplaceName,description:e.entry.description,isOfficial:e.isOfficial,extensions:Array.from(e.extensions),command:e.command}))}function eI(e){rn(t=>{let n=t.lspRecommendationNeverPlugins??[];return n.includes(e)?t:{...t,lspRecommendationNeverPlugins:[...n,e]}}),K(`[lspRecommendation] Added ${e} to never suggest`)}function tI(){rn(e=>{let t=(e.lspRecommendationIgnoredCount??0)+1;return{...e,lspRecommendationIgnoredCount:t}}),K(`[lspRecommendation] Incremented ignored count`)}function nI(){let e=pn();return e.lspRecommendationDisabled===!0||(e.lspRecommendationIgnoredCount??0)>=qF}f(),ot(),H(),ii(),gu();function rI(){let[e,t]=Q.useState(null),n=Q.useRef(!1),r=Q.useCallback(r=>{$e()||e||n.current||(n.current=!0,r().then(e=>{e&&t(e)}).catch(ai).finally(()=>{n.current=!1}))},[e]);return{recommendation:e,clearRecommendation:Q.useCallback(()=>t(null),[]),tryResolve:r}}async function iI(e,t,n,r,i){try{let a=await Ma(e);if(!a)throw Error(`Plugin ${e} not found in marketplace`);await i(a),r({key:`${n}-installed`,jsx:(0,$.jsxs)(R,{color:`success`,children:[p.tick,` `,t,` installed · restart to apply`]}),priority:`immediate`,timeoutMs:5e3})}catch(e){ai(e),r({key:`${n}-install-failed`,jsx:(0,$.jsxs)(R,{color:`error`,children:[`Failed to install `,t]}),priority:`immediate`,timeoutMs:5e3})}}ot(),Ac(),Z(),Et(),q(),ii(),er();var aI=28e3;function oI(){let e=X(e=>e.fileHistory.trackedFiles),{addNotification:t}=Wp(),n=Q.useRef(new Set),{recommendation:r,clearRecommendation:i,tryResolve:a}=rI();return Q.useEffect(()=>{a(async()=>{if(it())return null;let t=[];for(let r of e)n.current.has(r)||(n.current.add(r),t.push(r));for(let e of t)try{let t=(await $F(e))[0];if(t)return K(`[useLspPluginRecommendation] Found match: ${t.pluginName} for ${e}`),st(!0),{pluginId:t.pluginId,pluginName:t.pluginName,pluginDescription:t.description,fileExtension:CS(e),shownAt:Date.now()}}catch(e){ai(e)}return null})},[e,a]),{recommendation:r,handleResponse:Q.useCallback(e=>{if(!r)return;let{pluginId:n,pluginName:a,shownAt:o}=r;switch(K(`[useLspPluginRecommendation] User response: ${e} for ${a}`),e){case`yes`:iI(n,a,`lsp-plugin`,t,async e=>{K(`[useLspPluginRecommendation] Installing plugin: ${n}`);let t=typeof e.entry.source==`string`?wS(e.marketplaceInstallLocation,e.entry.source):void 0;await ap(n,e.entry,`user`,void 0,t),Jn(`userSettings`,{enabledPlugins:{...ln(`userSettings`)?.enabledPlugins,[n]:!0}}),K(`[useLspPluginRecommendation] Plugin installed: ${n}`)});break;case`no`:{let e=Date.now()-o;e>=aI&&(K(`[useLspPluginRecommendation] Timeout detected (${e}ms), incrementing ignored count`),tI());break}case`never`:eI(n);break;case`disable`:rn(e=>e.lspRecommendationDisabled?e:{...e,lspRecommendationDisabled:!0});break}i()},[r,t,i])}}H(),Rc(),Mb();var sI=3e4;function cI({pluginName:e,pluginDescription:t,fileExtension:n,onResponse:r}){let i=Q.useRef(r);i.current=r,Q.useEffect(()=>{let e=setTimeout(e=>e.current(`no`),sI,i);return()=>clearTimeout(e)},[]);function a(e){switch(e){case`yes`:r(`yes`);break;case`no`:r(`no`);break;case`never`:r(`never`);break;case`disable`:r(`disable`);break}}return(0,$.jsx)(Pb,{title:`LSP Plugin Recommendation`,children:(0,$.jsxs)(U,{flexDirection:`column`,paddingX:2,paddingY:1,children:[(0,$.jsx)(U,{marginBottom:1,children:(0,$.jsx)(R,{dimColor:!0,children:`LSP provides code intelligence like go-to-definition and error checking`})}),(0,$.jsxs)(U,{children:[(0,$.jsx)(R,{dimColor:!0,children:`Plugin:`}),(0,$.jsxs)(R,{children:[` `,e]})]}),t&&(0,$.jsx)(U,{children:(0,$.jsx)(R,{dimColor:!0,children:t})}),(0,$.jsxs)(U,{children:[(0,$.jsx)(R,{dimColor:!0,children:`Triggered by:`}),(0,$.jsxs)(R,{children:[` `,n,` files`]})]}),(0,$.jsx)(U,{marginTop:1,children:(0,$.jsx)(R,{children:`Would you like to install this LSP plugin?`})}),(0,$.jsx)(U,{children:(0,$.jsx)(so,{options:[{label:(0,$.jsxs)(R,{children:[`Yes, install `,(0,$.jsx)(R,{bold:!0,children:e})]}),value:`yes`},{label:`No, not now`,value:`no`},{label:(0,$.jsxs)(R,{children:[`Never for `,(0,$.jsx)(R,{bold:!0,children:e})]}),value:`never`},{label:`Disable all LSP recommendations`,value:`disable`}],onChange:a,onCancel:()=>r(`no`)})})]})})}Ac(),J(),q(),Tg();function lI(){let e=Q.useSyncExternalStore(sm,Km),{addNotification:t}=Wp(),{recommendation:n,clearRecommendation:r,tryResolve:i}=rI();return Q.useEffect(()=>{e&&i(async()=>{let t=await Pm(e);return t&&(K(`[useClaudeCodeHintRecommendation] surfacing ${t.pluginId} from ${t.sourceCommand}`),Qd()),Km()===e&&Md(),t})},[e,i]),{recommendation:n,handleResponse:Q.useCallback(e=>{if(n){switch(tg(n.pluginId),Y(`tengu_plugin_hint_response`,{_PROTO_plugin_name:n.pluginName,_PROTO_marketplace_name:n.marketplaceName,response:e}),e){case`yes`:{let{pluginId:e,pluginName:r,marketplaceName:i}=n;iI(e,r,`hint-plugin`,t,async t=>{let n=await i_({pluginId:e,entry:t.entry,marketplaceName:i,scope:`user`,trigger:`hint`});if(!n.success)throw Error(n.success?`Unknown error`:n.error)});break}case`disable`:ea();break;case`no`:break}r()}},[n,t,r])}}H(),Rc(),Mb();var uI=3e4;function dI({pluginName:e,pluginDescription:t,marketplaceName:n,sourceCommand:r,onResponse:i}){let a=Q.useRef(i);a.current=i,Q.useEffect(()=>{let e=setTimeout(e=>e.current(`no`),uI,a);return()=>clearTimeout(e)},[]);function o(e){switch(e){case`yes`:i(`yes`);break;case`disable`:i(`disable`);break;default:i(`no`)}}return(0,$.jsx)(Pb,{title:`Plugin Recommendation`,children:(0,$.jsxs)(U,{flexDirection:`column`,paddingX:2,paddingY:1,children:[(0,$.jsx)(U,{marginBottom:1,children:(0,$.jsxs)(R,{dimColor:!0,children:[`The `,(0,$.jsx)(R,{bold:!0,children:r}),` command suggests installing a plugin.`]})}),(0,$.jsxs)(U,{children:[(0,$.jsx)(R,{dimColor:!0,children:`Plugin:`}),(0,$.jsxs)(R,{children:[` `,e]})]}),(0,$.jsxs)(U,{children:[(0,$.jsx)(R,{dimColor:!0,children:`Marketplace:`}),(0,$.jsxs)(R,{children:[` `,n]})]}),t&&(0,$.jsx)(U,{children:(0,$.jsx)(R,{dimColor:!0,children:t})}),(0,$.jsx)(U,{marginTop:1,children:(0,$.jsx)(R,{children:`Would you like to install it?`})}),(0,$.jsx)(U,{children:(0,$.jsx)(so,{options:[{label:(0,$.jsxs)(R,{children:[`Yes, install `,(0,$.jsx)(R,{bold:!0,children:e})]}),value:`yes`},{label:`No`,value:`no`},{label:`No, and don't show plugin installation hints again`,value:`disable`}],onChange:o,onCancel:()=>i(`no`)})})]})})}Rc(),Mb();var fI=3e4;function pI({tools:e,onSelect:t,onDismiss:n}){let r=Q.useRef(t),i=Q.useRef(n);r.current=t,i.current=n,Q.useEffect(()=>{let e=setTimeout(e=>e.current(),fI,i);return()=>clearTimeout(e)},[]);let a=e.map(e=>({label:`${e.name} — ${e.description.slice(0,60)} (score: ${e.score.toFixed(2)})`,value:e.name}));return a.push({label:`Dismiss`,value:`__dismiss__`}),(0,$.jsx)(Pb,{title:`Tool Recommendation`,children:(0,$.jsx)(so,{options:a,onChange:e=>{e===`__dismiss__`?i.current():(i.current(),r.current(e))}})})}f_();var mI=.15,hI=3;function gI(){let e=Q.useSyncExternalStore(ka,bl),t=Q.useMemo(()=>e.length===0?[]:e.slice(0,hI).map(e=>({name:e.name,description:e.description.slice(0,60),score:e.score})),[e]);return{tools:t,visible:t.length>0&&(t[0]?.score??0)>=mI,handleSelect:Q.useCallback(e=>{Xs()},[]),handleDismiss:Q.useCallback(()=>{Xs()},[])}}ot(),Ac(),H(),Z(),q(),Wn();function _I(){let{addNotification:e}=Wp(),t=X(e=>e.plugins.installationStatus),{totalFailed:n,failedMarketplacesCount:r,failedPluginsCount:i}=(0,Q.useMemo)(()=>{if(!t)return{totalFailed:0,failedMarketplacesCount:0,failedPluginsCount:0};let e=t.marketplaces.filter(e=>e.status===`failed`),n=t.plugins.filter(e=>e.status===`failed`);return{totalFailed:e.length+n.length,failedMarketplacesCount:e.length,failedPluginsCount:n.length}},[t]);(0,Q.useEffect)(()=>{if(!$e()){if(!t){K(`No installation status to monitor`);return}n!==0&&(K(`Plugin installation status: ${r} failed marketplaces, ${i} failed plugins`),n!==0&&(K(`Adding notification for ${n} failed installations`),e({key:`plugin-install-failed`,jsx:(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(R,{color:`error`,children:[n,` `,an(n,`plugin`),` failed to install`]}),(0,$.jsx)(R,{dimColor:!0,children:` · /plugin for details`})]}),priority:`medium`})))}},[e,n,r,i])}ot(),Ac(),H(),q(),Bx();function vI(){let{addNotification:e}=Wp(),[t,n]=(0,Q.useState)([]);(0,Q.useEffect)(()=>{if(!$e())return Vx(e=>{K(`Plugin autoupdate notification: ${e.length} plugin(s) updated`),n(e)})},[]),(0,Q.useEffect)(()=>{if($e()||t.length===0)return;let n=t.map(e=>{let t=e.indexOf(`@`);return t>0?e.substring(0,t):e}),r=n.length<=2?n.join(` and `):`${n.length} plugins`;e({key:`plugin-autoupdate-restart`,jsx:(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(R,{color:`success`,children:[n.length===1?`Plugin`:`Plugins`,` updated: `,r]}),(0,$.jsx)(R,{dimColor:!0,children:` · Run /reload-plugins to apply`})]}),priority:`low`,timeoutMs:1e4}),K(`Showing plugin autoupdate notification for: ${n.join(`, `)}`)},[t,e])}q(),ii(),gu(),mb(),J();function yI(e,t,n,r){e(e=>({...e,plugins:{...e.plugins,installationStatus:{...e.plugins.installationStatus,marketplaces:e.plugins.installationStatus.marketplaces.map(e=>e.name===t?{...e,status:n,error:r}:e)}}}))}async function bI(e){K(`performBackgroundPluginInstallations called`);try{let t=qy(ec(),await rs().catch(()=>({}))),n=[...t.missing,...t.sourceChanged.map(e=>e.name)];if(e(e=>({...e,plugins:{...e.plugins,installationStatus:{marketplaces:n.map(e=>({name:e,status:`pending`})),plugins:[]}}})),n.length===0)return;K(`Installing ${n.length} marketplace(s) in background`);let r=await Vy({onProgress:t=>{switch(t.type){case`installing`:yI(e,t.name,`installing`);break;case`installed`:yI(e,t.name,`installed`);break;case`failed`:yI(e,t.name,`failed`,t.error);break}}}),i={installed_count:r.installed.length,updated_count:r.updated.length,failed_count:r.failed.length,up_to_date_count:r.upToDate.length};if(Y(`tengu_marketplace_background_install`,i),Pr(`info`,`tengu_marketplace_background_install`,i),r.installed.length>0){_s(),K(`Auto-refreshing plugins after ${r.installed.length} new marketplace(s) installed`);try{await pb(e)}catch(t){ai(t),K(`Auto-refresh failed, falling back to needsRefresh: ${t}`,{level:`warn`}),rf(`performBackgroundPluginInstallations: auto-refresh failed`),e(e=>e.plugins.needsRefresh?e:{...e,plugins:{...e.plugins,needsRefresh:!0}})}}else r.updated.length>0&&(_s(),rf(`performBackgroundPluginInstallations: marketplaces reconciled`),e(e=>e.plugins.needsRefresh?e:{...e,plugins:{...e.plugins,needsRefresh:!0}}))}catch(e){ai(e)}}Et(),q(),gu(),Jf();async function xI(e){if(K(`performStartupChecks called`),!Bn()){K(`Trust not accepted for current directory - skipping plugin installations`);return}try{K(`Starting background plugin installations`),await Vs()&&(_s(),rf(`performStartupChecks: seed marketplaces changed`),e(e=>e.plugins.needsRefresh?e:{...e,plugins:{...e.plugins,needsRefresh:!0}})),await bI(e)}catch(e){K(`Error initiating background plugin installations: ${e}`)}}H();var SI=/https?:\/\/\S+/;function CI(){let[e,t]=(0,Q.useState)(Gt.getInstance().getStatus());return(0,Q.useEffect)(()=>Gt.getInstance().subscribe(t),[]),!e.isAuthenticating&&!e.error&&e.output.length===0||!e.isAuthenticating&&!e.error?null:(0,$.jsxs)(U,{flexDirection:`column`,borderStyle:`round`,borderColor:`permission`,paddingX:1,marginY:1,children:[(0,$.jsx)(R,{bold:!0,color:`permission`,children:`Cloud Authentication`}),e.output.length>0&&(0,$.jsx)(U,{flexDirection:`column`,marginTop:1,children:e.output.slice(-5).map((e,t)=>{let n=e.match(SI);if(!n)return(0,$.jsx)(R,{dimColor:!0,children:e},t);let r=n[0],i=n.index??0,a=e.slice(0,i),o=e.slice(i+r.length);return(0,$.jsxs)(R,{dimColor:!0,children:[a,(0,$.jsx)(re,{url:r,children:r}),o]},t)})}),e.error&&(0,$.jsx)(U,{marginTop:1,children:(0,$.jsx)(R,{color:`error`,children:e.error})})]})}Ac(),H(),eo(),fs(),$n(),Kn(),ot();function wI(e){let{addNotification:t}=Wp(),n=Js(),r=(0,Q.useMemo)(()=>Up(n,e),[n,e]),i=(0,Q.useMemo)(()=>ua(n),[n]),a=(0,Q.useRef)(null),o=or(),s=Mt(),c=o===`team`||o===`enterprise`,[l,u]=(0,Q.useState)(!1);(0,Q.useEffect)(()=>{$e()||(n.isUsingOverage&&!l&&(!c||s)?(t({key:`limit-reached`,text:i,priority:`immediate`}),u(!0)):!n.isUsingOverage&&l&&u(!1))},[n.isUsingOverage,i,l,t,s,c]),(0,Q.useEffect)(()=>{$e()||r&&r!==a.current&&(a.current=r,t({key:`rate-limit-warning`,jsx:(0,$.jsx)(R,{children:(0,$.jsx)(R,{color:`warning`,children:r})}),priority:`high`}))},[r,t])}Ac(),ot();function TI(e){let{addNotification:t}=Wp(),n=(0,Q.useRef)(null);(0,Q.useEffect)(()=>{if($e())return;let r=cS(e);r&&r!==n.current&&(n.current=r,t({key:`model-deprecation-warning`,text:r,color:`warning`,priority:`high`})),r||(n.current=null)},[e,t])}s();var EI=``;function DI(){fF(async()=>Hr()||c(process.env.DISABLE_INSTALLATION_CHECKS)||await ym()===`development`?null:{timeoutMs:15e3,key:`npm-deprecation-warning`,text:EI,color:`warning`,priority:`high`})}Ac(),H(),Et(),nl(),ot();var OI=5;function kI({ideSelection:e,mcpClients:t,ideInstallationStatus:n}){let{addNotification:r,removeNotification:i}=Wp(),{status:a,ideName:o}=DD(t),s=(0,Q.useRef)(!1),c=n?og(n?.ideType):!1,l=n?.error||c,u=a===`connected`&&(e?.filePath||e?.text&&e.lineCount>0),d=a===`connected`&&!u,f=l&&!c&&!d&&!u,p=l&&c&&!d&&!u;(0,Q.useEffect)(()=>{if($e())return;if(Ph()||a!==null||p){i(`ide-status-hint`);return}if(s.current||(pn().ideHintShownCount??0)>=OI)return;let e=setTimeout((e,t)=>{wu(!0).then(n=>{let r=n[0]?.name;r&&!e.current&&(e.current=!0,rn(e=>({...e,ideHintShownCount:(e.ideHintShownCount??0)+1})),t({key:`ide-status-hint`,jsx:(0,$.jsxs)(R,{dimColor:!0,children:[`/ide for `,(0,$.jsx)(R,{color:`ide`,children:r})]}),priority:`low`}))})},3e3,s,r);return()=>clearTimeout(e)},[r,i,a,p]),(0,Q.useEffect)(()=>{if(!$e()){if(f||p||a!==`disconnected`||!o){i(`ide-status-disconnected`);return}r({key:`ide-status-disconnected`,text:`${o} disconnected`,color:`error`,priority:`medium`})}},[r,i,a,o,f,p]),(0,Q.useEffect)(()=>{if(!$e()){if(!p){i(`ide-status-jetbrains-disconnected`);return}r({key:`ide-status-jetbrains-disconnected`,text:`IDE plugin not connected · /status for info`,priority:`medium`})}},[r,i,p]),(0,Q.useEffect)(()=>{if(!$e()){if(!f){i(`ide-status-install-error`);return}r({key:`ide-status-install-error`,text:`IDE extension install failed (see /status for info)`,color:`error`,priority:`medium`})}},[r,i,f])}Et();var AI=[e=>{if(MI(e.sonnet45To46MigrationTimestamp))return{key:`sonnet-46-update`,text:`Model updated to Sonnet 4.6`,color:`suggestion`,priority:`high`,timeoutMs:3e3}},e=>{let t=!!e.legacyOpusMigrationTimestamp;if(MI(e.legacyOpusMigrationTimestamp??e.opusProMigrationTimestamp))return{key:`opus-pro-update`,text:t?`Model updated to Opus 4.7 · Set CLAUDE_CODE_DISABLE_LEGACY_MODEL_REMAP=1 to opt out`:`Model updated to Opus 4.7`,color:`suggestion`,priority:`high`,timeoutMs:t?8e3:3e3}}];function jI(){fF(()=>{let e=pn(),t=[];for(let n of AI){let r=n(e);r&&t.push(r)}return t.length>0?t:null})}function MI(e){return e!==void 0&&Date.now()-e<3e3}$n(),H(),J(),Et();var NI=3;function PI(){fF(async()=>{if((pn().subscriptionNoticeCount??0)>=NI)return null;let e=await FI();return e===null?null:(rn(e=>({...e,subscriptionNoticeCount:(e.subscriptionNoticeCount??0)+1})),Y(`tengu_switch_to_subscription_notice_shown`,{}),{key:`switch-to-subscription`,jsx:(0,$.jsxs)(R,{color:`suggestion`,children:[`Use your existing Claude `,e,` plan with Claude Code`,(0,$.jsxs)(R,{color:`text`,dimColor:!0,children:[` `,`· /login to activate`]})]}),priority:`low`})})}async function FI(){if(Fn())return null;let e=await En();return e?e.account.has_claude_max?`Max`:e.account.has_claude_pro?`Pro`:null:null}ot(),Ac(),Z(),fl();function II(e){if(!(`text`in e))return 1;let t=e.text.match(/^(\d+)/);return t?.[1]?parseInt(t[1],10):1}function LI(e,t){return RI(II(e)+1)}function RI(e){return{key:`teammate-spawn`,text:e===1?`1 agent spawned`:`${e} agents spawned`,priority:`low`,timeoutMs:5e3,fold:LI}}function zI(e,t){return BI(II(e)+1)}function BI(e){return{key:`teammate-shutdown`,text:e===1?`1 agent shut down`:`${e} agents shut down`,priority:`low`,timeoutMs:5e3,fold:zI}}function VI(){let e=X(e=>e.tasks),{addNotification:t}=Wp(),n=(0,Q.useRef)(new Set),r=(0,Q.useRef)(new Set);(0,Q.useEffect)(()=>{if(!$e())for(let[i,a]of Object.entries(e))ca(a)&&(a.status===`running`&&!n.current.has(i)&&(n.current.add(i),t(RI(1))),a.status===`completed`&&!r.current.has(i)&&(r.current.add(i),t(BI(1))))},[e,t])}Ac(),Z(),cr(),Vi(),ot();var HI=`fast-mode-cooldown-started`,UI=`fast-mode-cooldown-expired`,WI=`fast-mode-org-changed`,GI=`fast-mode-overage-rejected`;function KI(){let{addNotification:e}=Wp(),t=X(e=>e.fastMode),n=Hc();(0,Q.useEffect)(()=>{if(!$e()&&dr())return Pt(r=>{r?e({key:WI,color:`fastMode`,priority:`immediate`,text:`Fast mode is now available · /fast to turn on`}):t&&(n(e=>({...e,fastMode:!1})),e({key:WI,color:`warning`,priority:`immediate`,text:`Fast mode has been disabled by your organization`}))})},[e,t,n]),(0,Q.useEffect)(()=>{if(!$e()&&dr())return gn(t=>{n(e=>({...e,fastMode:!1})),e({key:GI,color:`warning`,priority:`immediate`,text:t})})},[e,n]),(0,Q.useEffect)(()=>{if($e()||!t)return;let n=W((t,n)=>{let r=qI(n,Li(t-Date.now(),{hideTrailingZeros:!0}));e({key:HI,invalidates:[UI],text:r,color:`warning`,priority:`immediate`})}),r=jt(()=>{e({key:UI,invalidates:[HI],color:`fastMode`,text:`Fast limit reset · now using fast mode`,priority:`immediate`})});return()=>{n(),r()}},[e,t])}function qI(e,t){switch(e){case`overloaded`:return`Fast mode overloaded and is temporarily unavailable · resets in ${t}`;case`rate_limit`:return`Fast limit reached and temporarily disabled · resets in ${t}`}}H(),Jv();function JI({onRun:e,onCancel:t,reason:n}){let r=(0,Q.useRef)(!1);return we(`confirm:no`,t,{context:`Confirmation`}),(0,Q.useEffect)(()=>{r.current||(r.current=!0,e())},[e]),(0,$.jsxs)(U,{flexDirection:`column`,marginTop:1,children:[(0,$.jsx)(U,{children:(0,$.jsx)(R,{bold:!0,children:`Running feedback capture...`})}),(0,$.jsx)(U,{children:(0,$.jsxs)(R,{dimColor:!0,children:[`Press `,(0,$.jsx)(he,{shortcut:`Esc`,action:`cancel`}),` anytime`]})}),(0,$.jsx)(U,{children:(0,$.jsxs)(R,{dimColor:!0,children:[`Reason: `,n]})})]})}function YI(e){if(process.env.USER_TYPE!==`ant`)return!1;switch(e){case`feedback_survey_bad`:return!1;case`feedback_survey_good`:return!1;default:return!1}}function XI(e){return process.env.USER_TYPE===`ant`&&e===`feedback_survey_good`?`/good-claude`:`/issue`}function ZI(e){switch(e){case`feedback_survey_bad`:return`You responded "Bad" to the feedback survey`;case`feedback_survey_good`:return`You responded "Good" to the feedback survey`;default:return`Unknown reason`}}var QI=()=>null;Lt(),H();function $I(){return process.env.USER_TYPE===`ant`?(0,$.jsxs)(U,{flexDirection:`row`,marginTop:1,width:`100%`,children:[(0,$.jsx)(U,{minWidth:2,children:(0,$.jsx)(R,{color:`warning`,children:`⚑`})}),(0,$.jsxs)(R,{children:[(0,$.jsx)(R,{dimColor:!0,children:`[ANT-ONLY] `}),(0,$.jsx)(R,{color:`warning`,bold:!0,children:`Something off with Claude?`}),(0,$.jsx)(R,{dimColor:!0,children:` /issue to report it`})]})]}):null}w_(),Qs();var eL=[/\bcurl\b/,/\bwget\b/,/\bssh\b/,/\bkubectl\b/,/\bsrun\b/,/\bdocker\b/,/\bbq\b/,/\bgsutil\b/,/\bgcloud\b/,/\baws\b/,/\bgit\s+push\b/,/\bgit\s+pull\b/,/\bgit\s+fetch\b/,/\bgh\s+(pr|issue)\b/,/\bnc\b/,/\bncat\b/,/\btelnet\b/,/\bftp\b/],tL=[/^no[,!]\s/i,/\bthat'?s (wrong|incorrect|not (what|right|correct))\b/i,/\bnot what I (asked|wanted|meant|said)\b/i,/\bI (said|asked|wanted|told you|already said)\b/i,/\bwhy did you\b/i,/\byou should(n'?t| not)? have\b/i,/\byou were supposed to\b/i,/\btry again\b/i,/\b(undo|revert) (that|this|it|what you)\b/i];function nL(e){for(let t of e){if(t.type!==`assistant`)continue;let e=t.message.content;if(Array.isArray(e))for(let t of e){if(t.type!==`tool_use`||!(`name`in t))continue;let e=t.name;if(e.startsWith(`mcp__`))return!1;if(e===`Bash`){let e=t.input?.command||``;if(eL.some(t=>t.test(e)))return!1}}}return!0}function rL(e){for(let t=e.length-1;t>=0;t--){let n=e[t];if(n.type!==`user`)continue;let r=Cc(n);if(r)return tL.some(e=>e.test(r))}return!1}var iL=3,aL=1800*1e3;function oL(e,t){let n=(0,Q.useRef)(0),r=(0,Q.useRef)(-1),i=(0,Q.useMemo)(()=>nL(e)&&rL(e),[e]);return process.env.USER_TYPE===`ant`?r.current===t?!0:Date.now()-n.current<aL||t<iL||!i?!1:(n.current=Date.now(),r.current=t,!0):!1}ot(),H();function sL(){return process.env.USER_TYPE===`ant`}function cL(){let[e,t]=(0,Q.useState)(Ie);return ke(()=>{t(Ie())},sL()?500:null),!sL()||e.length===0?null:(0,$.jsxs)(R,{wrap:`truncate-end`,color:`warning`,children:[`[ANT-ONLY] slow sync: `,e.slice(-3).map(e=>`${e.operation} (${Math.round(e.durationMs)}ms)`).join(` · `)]})}f(),H(),nc(),Rc(),xy(),Z(),ot(),Xb(),Qs(),up(),$g(),jr(),ui(),_a(),Qp();var lL=24,uL=11;function dL(){return new Date().toISOString().split(`T`)[0]}function fL({plan:e,sessionId:t,taskId:n,setMessages:r,readFileState:i,memorySelector:a,getAppState:o,setConversationId:s,resultDedupState:c}){pc(`ultraplan-choice`);let l=Hc(),{rows:u,columns:d}=k(),f=Q.useMemo(()=>Math.min(lL,Math.max(1,Math.floor(u/2)-uL)),[u]),m=Q.useMemo(()=>ge(e,Math.max(1,d-4),`wrap`).split(`
89
+ `))){let e=new Set(s.map(e=>e.id));o(t=>({...t,inbox:{messages:t.inbox.messages.filter(t=>!e.has(t.id))}}))}else K(`[InboxPoller] Submission rejected, keeping messages queued`)},[e,t,n,i,o,s,a]),se(()=>void l(),e&&CP(a.getState())?wP:null);let u=(0,Q.useRef)(!1);(0,Q.useEffect)(()=>{e&&(u.current||CP(a.getState())&&(u.current=!0,l()))},[e,l,a])}q(),Av();var EP=1e3;function DP({taskListId:e,isLoading:t,onSubmitTask:n}){let r=(0,Q.useRef)(null),i=(0,Q.useRef)(null),a=(0,Q.useRef)(t);a.current=t;let o=(0,Q.useRef)(n);o.current=n;let s=e!==void 0,c=e??`tasklist`,l=(0,Q.useRef)(async()=>{});l.current=async()=>{if(!s||a.current)return;let t=await Ev(e);if(r.current!==null){let e=t.find(e=>e.id===r.current);if(!e||e.status===`completed`)K(`[TaskListWatcher] Task #${r.current} is marked complete, ready for next task`),r.current=null;else return}let n=OP(t);if(!n)return;K(`[TaskListWatcher] Found available task #${n.id}: ${n.subject}`);let i=await wv(e,n.id,c);if(!i.success){K(`[TaskListWatcher] Failed to claim task #${n.id}: ${i.reason}`);return}r.current=n.id;let l=kP(n);K(`[TaskListWatcher] Submitting task #${n.id} as prompt`),o.current(l)||(K(`[TaskListWatcher] Failed to submit task #${n.id}, releasing claim`),await Tv(e,n.id,{owner:void 0}),r.current=null)};let u=(0,Q.useRef)(()=>{});(0,Q.useEffect)(()=>{if(!s)return;Cv(e);let t=kv(e),n=null,r=()=>{i.current&&clearTimeout(i.current),i.current=setTimeout(e=>void e.current(),EP,l)};u.current=r;try{n=kS(t,r),n.unref(),K(`[TaskListWatcher] Watching for tasks in ${t}`)}catch(e){K(`[TaskListWatcher] Failed to watch ${t}: ${e}`)}return r(),()=>{u.current=()=>{},n&&n.close(),i.current&&clearTimeout(i.current)}},[s,e]),(0,Q.useEffect)(()=>{s&&(t||u.current())},[s,t])}function OP(e){let t=new Set(e.filter(e=>e.status!==`completed`).map(e=>e.id));return e.find(e=>e.status!==`pending`||e.owner?!1:e.blockedBy.every(e=>!t.has(e)))}function kP(e){let t=`Complete all open tasks. Start with task #${e.id}: \n\n ${e.subject}`;return e.description&&(t+=`\n\n${e.description}`),t}Et(),s(),nl();function AP({autoConnectIdeFlag:e,ideToInstallExtension:t,setDynamicMcpConfig:n,setShowIdeOnboarding:r,setIDEInstallationState:i}){(0,Q.useEffect)(()=>{function o(r){r&&(pn().autoConnectIde||e||Ph()||process.env.CLAUDE_CODE_SSE_PORT||t||c(process.env.CLAUDE_CODE_AUTO_CONNECT_IDE))&&!a(process.env.CLAUDE_CODE_AUTO_CONNECT_IDE)&&n(e=>e?.ide?e:{...e,ide:{type:r.url.startsWith(`ws:`)?`ws-ide`:`sse-ide`,url:r.url,ideName:r.name,authToken:r.authToken,ideRunningInWindows:r.ideRunningInWindows,scope:`dynamic`}})}Ji(o,t,()=>r(!0),e=>i(e))},[e,t,n,r,i])}dx(),ty(),H(),Jv(),Bu(),Z(),Et(),Kr(),s();function jP({onBackgroundSession:e,isLoading:t}){let n=Hc(),r=gc(),[i,a]=(0,Q.useState)(!1),o=ne(a,e,()=>{}),s=(0,Q.useCallback)(()=>{c(process.env.CLAUDE_CODE_DISABLE_BACKGROUND_TASKS)||(Pl(r.getState())?(Yg(()=>r.getState(),n),pn().hasUsedBackgroundTask||rn(e=>e.hasUsedBackgroundTask?e:{...e,hasUsedBackgroundTask:!0})):c(`false`)&&t&&o())},[n,r,t,o]),l=X(Pl),u=c(`false`);we(`task:background`,s,{context:`Task`,isActive:l||u&&t});let d=pd(`task:background`,`Task`,`ctrl+b`),f=Jr.terminal===`tmux`&&d===`ctrl+b`?`ctrl+b ctrl+b`:d;return!t||!i?null:(0,$.jsx)(U,{paddingLeft:2,children:(0,$.jsx)(R,{dimColor:!0,children:(0,$.jsx)(he,{shortcut:f,action:`background`})})})}Z();function MP({setMessages:e,setIsLoading:t,resetLoadingState:n,setAbortController:r,onBackgroundQuery:i}){let a=X(e=>e.foregroundedTaskId),o=X(e=>e.foregroundedTaskId?e.tasks[e.foregroundedTaskId]:void 0),s=Hc(),c=(0,Q.useRef)(0),l=(0,Q.useCallback)(()=>{if(a){s(e=>{let t=e.foregroundedTaskId;if(!t)return e;let n=e.tasks[t];return n?{...e,foregroundedTaskId:void 0,tasks:{...e.tasks,[t]:{...n,isBackgrounded:!0}}}:{...e,foregroundedTaskId:void 0}}),e([]),n(),r(null);return}i()},[a,s,e,n,r,i]);return(0,Q.useEffect)(()=>{if(!a){c.current=0;return}if(!o||o.type!==`local_agent`){s(e=>({...e,foregroundedTaskId:void 0})),n(),c.current=0;return}let i=o.messages??[];if(i.length!==c.current&&(c.current=i.length,e([...i])),o.status===`running`){let e=o.abortController;if(e?.signal.aborted){s(e=>{if(!e.foregroundedTaskId)return e;let t=e.tasks[e.foregroundedTaskId];return t?{...e,foregroundedTaskId:void 0,tasks:{...e.tasks,[e.foregroundedTaskId]:{...t,isBackgrounded:!0}}}:{...e,foregroundedTaskId:void 0}}),n(),r(null),c.current=0;return}t(!0),e&&r(e)}else s(e=>{let t=e.foregroundedTaskId;if(!t)return e;let n=e.tasks[t];return n?{...e,foregroundedTaskId:void 0,tasks:{...e.tasks,[t]:{...n,isBackgrounded:!0}}}:{...e,foregroundedTaskId:void 0}}),n(),r(null),c.current=0},[a,o,s,e,t,n,r]),{handleBackgroundSession:l}}fm(),H(),$n(),Et(),on(),er(),Rc(),rx(),Mb();var NP=3e4;function PP({model:e,onDone:t}){let n=Mu(),r=(0,Q.useRef)(t);(0,Q.useEffect)(()=>{r.current=t});let i=(0,Q.useCallback)(()=>{r.current(`dismiss`)},[]);(0,Q.useEffect)(()=>{RP()},[]),(0,Q.useEffect)(()=>{let e=setTimeout(i,NP);return()=>clearTimeout(e)},[i]);let a=bu(e),o=a?Kl(a):`high`,s=(0,Q.useCallback)(e=>{Jn(`userSettings`,{effortLevel:Nd(e===o?void 0:e)}),r.current(e)},[o]),c=[{label:(0,$.jsx)(IP,{level:`medium`,text:`Medium (recommended)`}),value:`medium`},{label:(0,$.jsx)(IP,{level:`high`,text:`High`}),value:`high`},{label:(0,$.jsx)(IP,{level:`low`,text:`Low`}),value:`low`}];return(0,$.jsx)(Pb,{title:n.dialogTitle,children:(0,$.jsxs)(U,{flexDirection:`column`,paddingX:2,paddingY:1,children:[(0,$.jsx)(U,{marginBottom:1,flexDirection:`column`,children:(0,$.jsx)(R,{children:n.dialogDescription})}),(0,$.jsx)(U,{marginBottom:1,children:(0,$.jsxs)(R,{dimColor:!0,children:[(0,$.jsx)(FP,{level:`low`}),` low `,`·`,` `,(0,$.jsx)(FP,{level:`medium`}),` medium `,`·`,` `,(0,$.jsx)(FP,{level:`high`}),` high`]})}),(0,$.jsx)(so,{options:c,onChange:s,onCancel:i})]})})}function FP({level:e}){return(0,$.jsx)(R,{color:`suggestion`,children:Qb(e)})}function IP({level:e,text:t}){return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(FP,{level:e}),` `,t]})}function LP(e){if(!Ot(e).toLowerCase().includes(`opus-4-6`))return!1;let t=pn();return t.effortCalloutV2Dismissed?!1:t.numStartups<=1?(RP(),!1):gr()?t.effortCalloutDismissed?(RP(),!1):Mu().enabled:Vn()||fr()?Mu().enabled:(RP(),!1)}function RP(){rn(e=>e.effortCalloutV2Dismissed?e:{...e,effortCalloutV2Dismissed:!0})}Ly(),Fb(),fn();function zP(e,t){let[n,r]=Q.useState(t);return Q.useEffect(()=>{Hn(e,t).then(r)},[e,t]),n}async function BP(e,t,n){try{K(`Collecting transcript for sharing`,{level:`info`});let r=Bs(e),i=await yh(Zm(e)),a;try{let e=Ul(),{size:t}=await NS(e);t<=52428800?a=await MS(e,`utf-8`):K(`Skipping raw transcript read: file too large (${t} bytes)`,{level:`warn`})}catch{}let o=Mx(vr({trigger:t,version:`2.6.5`,platform:process.platform,transcript:r,subagentTranscripts:Object.keys(i).length>0?i:void 0,rawTranscriptJsonl:a}));await cn();let s=jn();if(s.error)return{success:!1};let c={"Content-Type":`application/json`,"User-Agent":hn(),...s.headers},l=await m.post(`https://api.anthropic.com/api/claude_code_shared_session_transcripts`,{content:o,appearance_id:n},{headers:c,timeout:3e4});if(l.status===200||l.status===201){let e=l.data;return K(`Transcript shared successfully`,{level:`info`}),{success:!0,transcriptId:e?.transcript_id}}return{success:!1}}catch(e){return K(br(e),{level:`error`}),{success:!1}}}var VP=t((()=>{h(),$n(),q(),Cr(),Qs(),_a(),kr()}));Nn(),VP();function HP({hideThanksAfterMs:e,onOpen:t,onSelect:n,shouldShowTranscriptPrompt:r,onTranscriptPromptShown:i,onTranscriptSelect:a}){let[o,s]=(0,Q.useState)(`closed`),[c,l]=(0,Q.useState)(null),u=(0,Q.useRef)(jS()),d=(0,Q.useRef)(null),f=(0,Q.useCallback)(()=>{s(`thanks`),setTimeout((e,t)=>{e(`closed`),t(null)},e,s,l)},[e]),p=(0,Q.useCallback)(()=>{s(`submitted`),setTimeout(s,e,`closed`)},[e]);return{state:o,lastResponse:c,open:(0,Q.useCallback)(()=>{o===`closed`&&(s(`open`),u.current=jS(),t(u.current))},[o,t]),handleSelect:(0,Q.useCallback)(e=>{if(l(e),d.current=e,n(u.current,e),e===`dismissed`)s(`closed`),l(null);else if(r?.(e))return s(`transcript_prompt`),i?.(u.current,e),!0;else f();return!1},[f,n,r,i]),handleTranscriptSelect:(0,Q.useCallback)(e=>{switch(e){case`yes`:s(`submitting`),(async()=>{try{await a?.(u.current,e,d.current)?p():f()}catch{f()}})();break;case`no`:case`dont_ask_again`:a?.(u.current,e,d.current),f();break}},[f,p,a])}}J(),Et(),s(),Qs(),on(),er();var UP={minTimeBeforeFeedbackMs:6e5,minTimeBetweenFeedbackMs:36e5,minTimeBetweenGlobalFeedbackMs:1e8,minUserTurnsBeforeFeedback:5,minUserTurnsBetweenFeedback:10,hideThanksAfterMs:3e3,onForModels:[`*`],probability:.005},WP={probability:0};function GP(e,t,n,r=`session`,i=!1){let a=(0,Q.useRef)(`unknown`);a.current=io(e)?.message?.id||`unknown`;let[o,s]=(0,Q.useState)(()=>({timeLastShown:null,submitCountAtLastAppearance:null})),l=zP(`tengu_feedback_survey_config`,UP),u=zP(`tengu_bad_survey_transcript_ask_config`,WP),d=zP(`tengu_good_survey_transcript_ask_config`,WP),f=Wt().feedbackSurveyRate,p=(0,Q.useRef)(Date.now()),m=(0,Q.useRef)(n),h=(0,Q.useRef)(n);h.current=n;let g=(0,Q.useRef)(e);g.current=e;let _=(0,Q.useRef)(!1),v=(0,Q.useRef)(null),y=(0,Q.useCallback)((e,t)=>{s(n=>n.timeLastShown===e&&n.submitCountAtLastAppearance===t?n:{timeLastShown:e,submitCountAtLastAppearance:t}),pn().feedbackSurveyState?.lastShownTime!==e&&rn(t=>({...t,feedbackSurveyState:{lastShownTime:e}}))},[]),b=(0,Q.useCallback)(e=>{y(Date.now(),h.current),Y(`tengu_feedback_survey_event`,{event_type:`appeared`,appearance_id:e,last_assistant_message_id:a.current,survey_type:r}),fv(`feedback_survey`,{event_type:`appeared`,appearance_id:e,survey_type:r})},[y,r]),x=(0,Q.useCallback)((e,t)=>{y(Date.now(),h.current),Y(`tengu_feedback_survey_event`,{event_type:`responded`,appearance_id:e,response:t,last_assistant_message_id:a.current,survey_type:r}),fv(`feedback_survey`,{event_type:`responded`,appearance_id:e,response:t,survey_type:r})},[y,r]),S=(0,Q.useCallback)(e=>{if(e!==`bad`&&e!==`good`||pn().transcriptShareDismissed||!Ca(`allow_product_feedback`))return!1;let t=e===`bad`?u.probability:d.probability;return Math.random()<=t},[u.probability,d.probability]),C=(0,Q.useCallback)((e,t)=>{let n=t===`good`?`good_feedback_survey`:`bad_feedback_survey`;Y(`tengu_feedback_survey_event`,{event_type:`transcript_prompt_appeared`,appearance_id:e,last_assistant_message_id:a.current,survey_type:r,trigger:n}),fv(`feedback_survey`,{event_type:`transcript_prompt_appeared`,appearance_id:e,survey_type:r})},[r]),w=(0,Q.useCallback)(async(e,t,n)=>{let i=n===`good`?`good_feedback_survey`:`bad_feedback_survey`;if(Y(`tengu_feedback_survey_event`,{event_type:`transcript_share_${t}`,appearance_id:e,last_assistant_message_id:a.current,survey_type:r,trigger:i}),t===`dont_ask_again`&&rn(e=>({...e,transcriptShareDismissed:!0})),t===`yes`){let t=await BP(g.current,i,e);return Y(`tengu_feedback_survey_event`,{event_type:t.success?`transcript_share_submitted`:`transcript_share_failed`,appearance_id:e,trigger:i}),t.success}return!1},[r]),{state:T,lastResponse:E,open:D,handleSelect:O,handleTranscriptSelect:k}=HP({hideThanksAfterMs:l.hideThanksAfterMs,onOpen:b,onSelect:x,shouldShowTranscriptPrompt:S,onTranscriptPromptShown:C,onTranscriptSelect:w}),A=Nt(),j=(0,Q.useMemo)(()=>l.onForModels.length===0?!1:l.onForModels.includes(`*`)?!0:l.onForModels.includes(A),[l.onForModels,A]),M=(0,Q.useMemo)(()=>{if(T!==`closed`||t||i)return!1;if(process.env.CLAUDE_FORCE_DISPLAY_SURVEY&&!o.timeLastShown)return!0;if(!j||c(process.env.CLAUDE_CODE_DISABLE_FEEDBACK_SURVEY)||sr()||!Ca(`allow_product_feedback`))return!1;if(o.timeLastShown){if(Date.now()-o.timeLastShown<l.minTimeBetweenFeedbackMs||o.submitCountAtLastAppearance!==null&&n<o.submitCountAtLastAppearance+l.minUserTurnsBetweenFeedback)return!1}else if(Date.now()-p.current<l.minTimeBeforeFeedbackMs||n<m.current+l.minUserTurnsBeforeFeedback)return!1;if(v.current!==n&&(v.current=n,_.current=Math.random()<=(f??l.probability)),!_.current)return!1;let e=pn().feedbackSurveyState;return!(e?.lastShownTime&&Date.now()-e.lastShownTime<l.minTimeBetweenGlobalFeedbackMs)},[T,t,i,j,o.timeLastShown,o.submitCountAtLastAppearance,n,l.minTimeBetweenFeedbackMs,l.minTimeBetweenGlobalFeedbackMs,l.minUserTurnsBetweenFeedback,l.minTimeBeforeFeedbackMs,l.minUserTurnsBeforeFeedback,l.probability,f]);return(0,Q.useEffect)(()=>{M&&D()},[M,D]),{state:T,lastResponse:E,handleSelect:O,handleTranscriptSelect:k}}Nn(),fn(),J(),ml(),Et(),s(),Qs(),hv(),VP();var KP=3e3,qP=`tengu_dunwich_bell`,JP=`tengu_memory_survey_event`,YP=.2,XP=`memory_survey`,ZP=/\bmemor(?:y|ies)\b/i;function QP(e){for(let t of e){if(t.type!==`assistant`)continue;let e=t.message.content;if(Array.isArray(e))for(let t of e){if(t.type!==`tool_use`||t.name!==`Read`)continue;let e=t.input;if(typeof e.file_path==`string`&&Na(e.file_path))return!0}}return!1}function $P(e,t,n=!1,{enabled:r=!0}={}){let i=(0,Q.useRef)(new Set),a=(0,Q.useRef)(!1),o=(0,Q.useRef)(e);o.current=e;let{state:s,lastResponse:l,open:u,handleSelect:d,handleTranscriptSelect:f}=HP({hideThanksAfterMs:KP,onOpen:(0,Q.useCallback)(e=>{Y(JP,{event_type:`appeared`,appearance_id:e}),fv(`feedback_survey`,{event_type:`appeared`,appearance_id:e,survey_type:`memory`})},[]),onSelect:(0,Q.useCallback)((e,t)=>{Y(JP,{event_type:`responded`,appearance_id:e,response:t}),fv(`feedback_survey`,{event_type:`responded`,appearance_id:e,response:t,survey_type:`memory`})},[]),shouldShowTranscriptPrompt:(0,Q.useCallback)(e=>!(process.env.USER_TYPE!==`ant`||e!==`bad`&&e!==`good`||pn().transcriptShareDismissed||!Ca(`allow_product_feedback`)),[]),onTranscriptPromptShown:(0,Q.useCallback)(e=>{Y(JP,{event_type:`transcript_prompt_appeared`,appearance_id:e,trigger:XP}),fv(`feedback_survey`,{event_type:`transcript_prompt_appeared`,appearance_id:e,survey_type:`memory`})},[]),onTranscriptSelect:(0,Q.useCallback)(async(e,t)=>{if(Y(JP,{event_type:`transcript_share_${t}`,appearance_id:e,trigger:XP}),t===`dont_ask_again`&&rn(e=>({...e,transcriptShareDismissed:!0})),t===`yes`){let t=await BP(o.current,XP,e);return Y(JP,{event_type:t.success?`transcript_share_submitted`:`transcript_share_failed`,appearance_id:e,trigger:XP}),t.success}return!1},[])}),p=(0,Q.useMemo)(()=>io(e),[e]);return(0,Q.useEffect)(()=>{if(!r)return;if(e.length===0){a.current=!1,i.current.clear();return}if(s!==`closed`||t||n||!Tn(qP,!1)||!ar()||sr()||!Ca(`allow_product_feedback`)||c(process.env.CLAUDE_CODE_DISABLE_FEEDBACK_SURVEY)||!p||i.current.has(p.uuid))return;let o=Ka(Array.isArray(p.message.content)?p.message.content:[],` `);ZP.test(o)&&(i.current.add(p.uuid),a.current||(a.current=QP(e)),a.current&&Math.random()<YP&&u())},[r,s,t,n,p,e,u]),{state:s,lastResponse:l,handleSelect:d,handleTranscriptSelect:f}}Nn(),fn(),J(),s(),Qs(),hv();var eF=3e3,tF=`tengu_post_compact_survey`,nF=.2;function rF(e,t){let n=e.findIndex(e=>e.uuid===t);if(n===-1)return!1;for(let t=n+1;t<e.length;t++){let n=e[t];if(n&&(n.type===`user`||n.type===`assistant`))return!0}return!1}function iF(e,t,n=!1,{enabled:r=!0}={}){let[i,a]=(0,Q.useState)(null),o=(0,Q.useRef)(new Set),s=(0,Q.useRef)(null),{state:l,lastResponse:u,open:d,handleSelect:f}=HP({hideThanksAfterMs:eF,onOpen:(0,Q.useCallback)(e=>{Y(`tengu_post_compact_survey_event`,{event_type:`appeared`,appearance_id:e,session_memory_compaction_enabled:hg()}),fv(`feedback_survey`,{event_type:`appeared`,appearance_id:e,survey_type:`post_compact`})},[]),onSelect:(0,Q.useCallback)((e,t)=>{Y(`tengu_post_compact_survey_event`,{event_type:`responded`,appearance_id:e,response:t,session_memory_compaction_enabled:hg()}),fv(`feedback_survey`,{event_type:`responded`,appearance_id:e,response:t,survey_type:`post_compact`})},[])});(0,Q.useEffect)(()=>{r&&a(Pn(tF))},[r]);let p=(0,Q.useMemo)(()=>new Set(e.filter(e=>Cl(e)).map(e=>e.uuid)),[e]);return(0,Q.useEffect)(()=>{if(!r||l!==`closed`||t||n||i!==!0||sr()||c(process.env.CLAUDE_CODE_DISABLE_FEEDBACK_SURVEY))return;if(s.current!==null&&rF(e,s.current)){s.current=null,Math.random()<nF&&d();return}let a=Array.from(p).filter(e=>!o.current.has(e));a.length>0&&(o.current=new Set(p),s.current=a[a.length-1])},[r,p,l,t,n,i,e,d]),{state:l,lastResponse:u,handleSelect:f}}Lt(),H();var aF=[`1`,`2`,`3`],oF={1:`yes`,2:`no`,3:`dont_ask_again`},sF=e=>aF.includes(e);function cF({onSelect:e,inputValue:t,setInputValue:n}){return _N({inputValue:t,setInputValue:n,isValidDigit:sF,onDigit:t=>e(oF[t])}),(0,$.jsxs)(U,{flexDirection:`column`,marginTop:1,children:[(0,$.jsxs)(U,{children:[(0,$.jsxs)(R,{color:`ansi:cyan`,children:[zt,` `]}),(0,$.jsx)(R,{bold:!0,children:`Can Anthropic look at your session transcript to help us improve Claude Code?`})]}),(0,$.jsx)(U,{marginLeft:2,children:(0,$.jsx)(R,{dimColor:!0,children:`Learn more: https://code.claude.com/docs/en/data-usage#session-quality-surveys`})}),(0,$.jsxs)(U,{marginLeft:2,children:[(0,$.jsx)(U,{width:10,children:(0,$.jsxs)(R,{children:[(0,$.jsx)(R,{color:`ansi:cyan`,children:`1`}),`: Yes`]})}),(0,$.jsx)(U,{width:10,children:(0,$.jsxs)(R,{children:[(0,$.jsx)(R,{color:`ansi:cyan`,children:`2`}),`: No`]})}),(0,$.jsx)(U,{children:(0,$.jsxs)(R,{children:[(0,$.jsx)(R,{color:`ansi:cyan`,children:`3`}),`: Don't ask again`]})})]})]})}J(),H();function lF({state:e,lastResponse:t,handleSelect:n,handleTranscriptSelect:r,inputValue:i,setInputValue:a,onRequestFeedback:o,message:s}){return e===`closed`?null:e===`thanks`?(0,$.jsx)(dF,{lastResponse:t,inputValue:i,setInputValue:a,onRequestFeedback:o}):e===`submitted`?(0,$.jsx)(U,{marginTop:1,children:(0,$.jsxs)(R,{color:`success`,children:[`✓`,` Thanks for sharing your transcript!`]})}):e===`submitting`?(0,$.jsx)(U,{marginTop:1,children:(0,$.jsxs)(R,{dimColor:!0,children:[`Sharing transcript`,`…`]})}):e===`transcript_prompt`?!r||i&&![`1`,`2`,`3`].includes(i)?null:(0,$.jsx)(cF,{onSelect:r,inputValue:i,setInputValue:a}):i&&!bN(i)?null:(0,$.jsx)(SN,{onSelect:n,inputValue:i,setInputValue:a,message:s})}var uF=e=>e===`1`;function dF({lastResponse:e,inputValue:t,setInputValue:n,onRequestFeedback:r}){let i=r&&e===`good`;_N({inputValue:t,setInputValue:n,isValidDigit:uF,enabled:!!i,once:!0,onDigit:()=>{Y(`tengu_feedback_survey_event`,{event_type:`followup_accepted`,response:e}),r?.()}});let a=process.env.USER_TYPE===`ant`?`/issue`:`/feedback`;return(0,$.jsxs)(U,{marginTop:1,flexDirection:`column`,children:[(0,$.jsx)(R,{color:`success`,children:`Thanks for the feedback!`}),i?(0,$.jsxs)(R,{dimColor:!0,children:[`(Optional) Press [`,(0,$.jsx)(R,{color:`ansi:cyan`,children:`1`}),`] to tell us what went well `,` · `,a]}):e===`bad`?(0,$.jsx)(R,{dimColor:!0,children:`Use /issue to report model behavior issues.`}):(0,$.jsxs)(R,{dimColor:!0,children:[`Use `,a,` to share detailed feedback anytime.`]})]})}tp(),ac(),ot(),Ac(),ii();function fF(e){let{addNotification:t}=Wp(),n=(0,Q.useRef)(!1),r=(0,Q.useRef)(e);r.current=e,(0,Q.useEffect)(()=>{$e()||n.current||(n.current=!0,Promise.resolve().then(()=>r.current()).then(e=>{if(e)for(let n of Array.isArray(e)?e:[e])t(n)}).catch(ai))},[t])}function pF(){fF(async()=>(await _c()).map((e,t)=>{let n=`low`;return e.type===`error`||e.userActionRequired?n=`high`:(e.type===`path`||e.type===`alias`)&&(n=`medium`),{key:`install-message-${t}-${e.type}`,text:e.message,priority:n,color:e.type===`error`?`error`:`warning`}}))}Nr(),N_(),q(),Qs(),on(),Mp(),zx(),ig(),ot();var mF=30,hF=`The user stepped away and is coming back. Write exactly 1-3 short sentences. Start by stating the high-level task — what they are building or debugging, not implementation details. Next: the concrete next step. Skip status reports and commit recaps.`,gF=`用户离开后回来了。用中文写 1-3 句话。先说明用户在做什么(高层目标,不是实现细节),然后说明下一步具体操作。不要写状态报告或提交总结。`;function _F(e){return`${e?`Session memory (broader context):\n${e}\n\n`:``}${Rx()===`zh`?gF:hF}`}async function vF(e,t){if(e.length===0)return null;let n=Yt(),r=cs()?jp({sessionId:Fe(),model:n,provider:Zt(),name:`away-summary`}):null;try{let i=await Su(),a=e.slice(-mF);a.push(Ud({content:_F(i)}));let o=await jh({messages:a,systemPrompt:iv([]),thinkingConfig:{type:`disabled`},tools:[],signal:t,options:{getToolPermissionContext:async()=>x_(),model:n,toolChoice:void 0,isNonInteractiveSession:!1,hasAppendSystemPrompt:!1,agents:[],querySource:`away_summary`,mcpTools:[],skipCacheWrite:!0,langfuseTrace:r}});return o.isApiErrorMessage?(K(`[awaySummary] API error: ${Hl(o)}`),ic(r,void 0,`error`),null):(ic(r),Hl(o))}catch(e){return e instanceof l||t.aborted?null:(K(`[awaySummary] generation failed: ${e}`),ic(r,void 0,`error`),null)}}H(),fn(),Qs();var yF=5*6e4;function bF(e){for(let t=e.length-1;t>=0;t--){let n=e[t];if(n.type===`user`&&!n.isMeta&&!n.isCompactSummary)return!1;if(n.type===`system`&&n.subtype===`away_summary`)return!0}return!1}function xF(e,t,n){let r=(0,Q.useRef)(null),i=(0,Q.useRef)(null),a=(0,Q.useRef)(e),o=(0,Q.useRef)(n),s=(0,Q.useRef)(!1),c=(0,Q.useRef)(null);a.current=e,o.current=n;let l=Tn(`tengu_sedge_lantern`,!1);(0,Q.useEffect)(()=>{if(!l)return;function e(){r.current!==null&&(clearTimeout(r.current),r.current=null)}function n(){i.current?.abort(),i.current=null}async function u(){if(s.current=!1,bF(a.current))return;n();let e=new AbortController;i.current=e;let r=await vF(a.current,e.signal);e.signal.aborted||r===null||t(e=>[...e,vg(r)])}function d(){if(r.current=null,o.current){s.current=!0;return}u()}function f(){let t=ue();t===`blurred`||t===`unknown`?(e(),r.current=setTimeout(d,yF)):t===`focused`&&(e(),n(),s.current=!1)}let p=P(f);return f(),c.current=u,()=>{p(),e(),n(),c.current=null}},[l,t]),(0,Q.useEffect)(()=>{if(n||!s.current)return;let e=ue();e!==`blurred`&&e!==`unknown`||c.current?.()},[n]),(0,Q.useEffect)(()=>{ue()===`unknown`&&l&&(n?(r.current!==null&&(clearTimeout(r.current),r.current=null),i.current?.abort(),i.current=null,s.current=!1):(r.current!==null&&clearTimeout(r.current),r.current=setTimeout(()=>{if(r.current=null,o.current){s.current=!0;return}c.current?.()},yF)))},[n,l])}H(),$n(),Ub(),s();function SF(){if(process.argv.includes(`--chrome`))return!0;if(process.argv.includes(`--no-chrome`))return!1}function CF(){fF(async()=>{let e=SF();return Vb(e)?process.env.USER_TYPE!==`ant`&&!Fn()?{key:`chrome-requires-subscription`,jsx:(0,$.jsx)(R,{color:`error`,children:`Claude in Chrome requires a claude.ai subscription`}),priority:`immediate`,timeoutMs:5e3}:!await Hb()&&!i()?{key:`chrome-extension-not-detected`,jsx:(0,$.jsx)(R,{color:`warning`,children:`Chrome extension not detected · https://claude.ai/chrome to install`}),priority:`immediate`,timeoutMs:3e3}:e===void 0?{key:`claude-in-chrome-default-enabled`,text:`Claude in Chrome enabled · /chrome`,priority:`low`}:null:null})}fn(),J(),Et(),q(),s(),Cr(),ii();function wF(){return c(process.env.CLAUDE_CODE_DISABLE_OFFICIAL_MARKETPLACE_AUTOINSTALL)}var TF={MAX_ATTEMPTS:10,INITIAL_DELAY_MS:3600*1e3,BACKOFF_MULTIPLIER:2,MAX_DELAY_MS:10080*60*1e3};function EF(e){let t=TF.INITIAL_DELAY_MS*TF.BACKOFF_MULTIPLIER**e;return Math.min(t,TF.MAX_DELAY_MS)}function DF(e){if(!e.officialMarketplaceAutoInstallAttempted)return!0;if(e.officialMarketplaceAutoInstalled)return!1;let t=e.officialMarketplaceAutoInstallFailReason,n=e.officialMarketplaceAutoInstallRetryCount||0,r=e.officialMarketplaceAutoInstallNextRetryTime,i=Date.now();return n>=TF.MAX_ATTEMPTS||t===`policy_blocked`||r&&i<r?!1:t===`unknown`||t===`git_unavailable`||t===`gcs_unavailable`||t===void 0}async function OF(){let e=pn();if(!DF(e)){let t=e.officialMarketplaceAutoInstallFailReason??`already_attempted`;return K(`Official marketplace auto-install skipped: ${t}`),{installed:!1,skipped:!0,reason:t}}try{if(wF())return K(`Official marketplace auto-install disabled via env var, skipping`),rn(e=>({...e,officialMarketplaceAutoInstallAttempted:!0,officialMarketplaceAutoInstalled:!1,officialMarketplaceAutoInstallFailReason:`policy_blocked`})),Y(`tengu_official_marketplace_auto_install`,{installed:!1,skipped:!0,policy_blocked:!0}),{installed:!1,skipped:!0,reason:`policy_blocked`};if((await rs())[`claude-plugins-official`])return K(`Official marketplace '${Ll}' already installed, skipping`),rn(e=>({...e,officialMarketplaceAutoInstallAttempted:!0,officialMarketplaceAutoInstalled:!0})),{installed:!1,skipped:!0,reason:`already_installed`};if(!Wm(lo))return K(`Official marketplace blocked by enterprise policy, skipping`),rn(e=>({...e,officialMarketplaceAutoInstallAttempted:!0,officialMarketplaceAutoInstalled:!1,officialMarketplaceAutoInstallFailReason:`policy_blocked`})),Y(`tengu_official_marketplace_auto_install`,{installed:!1,skipped:!0,policy_blocked:!0}),{installed:!1,skipped:!0,reason:`policy_blocked`};let t=h_(),n=wS(t,Ll);if(await ud(n,t)!==null){let e=await rs();return e[Ll]={source:lo,installLocation:n,lastUpdated:new Date().toISOString()},await As(e),rn(e=>({...e,officialMarketplaceAutoInstallAttempted:!0,officialMarketplaceAutoInstalled:!0,officialMarketplaceAutoInstallFailReason:void 0,officialMarketplaceAutoInstallRetryCount:void 0,officialMarketplaceAutoInstallLastAttemptTime:void 0,officialMarketplaceAutoInstallNextRetryTime:void 0})),Y(`tengu_official_marketplace_auto_install`,{installed:!0,skipped:!1,via_gcs:!0}),{installed:!0,skipped:!1}}if(!Tn(`tengu_plugin_official_mkt_git_fallback`,!0)){K(`Official marketplace GCS failed; git fallback disabled by flag — skipping install`);let t=(e.officialMarketplaceAutoInstallRetryCount||0)+1,n=Date.now(),r=n+EF(t);return rn(e=>({...e,officialMarketplaceAutoInstallAttempted:!0,officialMarketplaceAutoInstalled:!1,officialMarketplaceAutoInstallFailReason:`gcs_unavailable`,officialMarketplaceAutoInstallRetryCount:t,officialMarketplaceAutoInstallLastAttemptTime:n,officialMarketplaceAutoInstallNextRetryTime:r})),Y(`tengu_official_marketplace_auto_install`,{installed:!1,skipped:!0,gcs_unavailable:!0,retry_count:t}),{installed:!1,skipped:!0,reason:`gcs_unavailable`}}if(!await Zg()){K(`Git not available, skipping official marketplace auto-install`);let t=(e.officialMarketplaceAutoInstallRetryCount||0)+1,n=Date.now(),r=n+EF(t),i=!1;try{rn(e=>({...e,officialMarketplaceAutoInstallAttempted:!0,officialMarketplaceAutoInstalled:!1,officialMarketplaceAutoInstallFailReason:`git_unavailable`,officialMarketplaceAutoInstallRetryCount:t,officialMarketplaceAutoInstallLastAttemptTime:n,officialMarketplaceAutoInstallNextRetryTime:r}))}catch(e){i=!0,ai(yr(e)),K(`Failed to save marketplace auto-install git_unavailable state: ${e}`,{level:`error`})}return Y(`tengu_official_marketplace_auto_install`,{installed:!1,skipped:!0,git_unavailable:!0,retry_count:t}),{installed:!1,skipped:!0,reason:`git_unavailable`,configSaveFailed:i}}K(`Attempting to auto-install official marketplace`),await jo(lo),K(`Successfully auto-installed official marketplace`);let r=e.officialMarketplaceAutoInstallRetryCount||0;return rn(e=>({...e,officialMarketplaceAutoInstallAttempted:!0,officialMarketplaceAutoInstalled:!0,officialMarketplaceAutoInstallFailReason:void 0,officialMarketplaceAutoInstallRetryCount:void 0,officialMarketplaceAutoInstallLastAttemptTime:void 0,officialMarketplaceAutoInstallNextRetryTime:void 0})),Y(`tengu_official_marketplace_auto_install`,{installed:!0,skipped:!1,retry_count:r}),{installed:!0,skipped:!1}}catch(t){let n=t instanceof Error?t.message:String(t);if(n.includes(`xcrun: error:`))return Bg(),K(`Official marketplace auto-install: git is a non-functional macOS xcrun shim, treating as git_unavailable`),Y(`tengu_official_marketplace_auto_install`,{installed:!1,skipped:!0,git_unavailable:!0,macos_xcrun_shim:!0}),{installed:!1,skipped:!0,reason:`git_unavailable`};K(`Failed to auto-install official marketplace: ${n}`,{level:`error`}),ai(yr(t));let r=(e.officialMarketplaceAutoInstallRetryCount||0)+1,i=Date.now(),a=i+EF(r),o=!1;try{rn(e=>({...e,officialMarketplaceAutoInstallAttempted:!0,officialMarketplaceAutoInstalled:!1,officialMarketplaceAutoInstallFailReason:`unknown`,officialMarketplaceAutoInstallRetryCount:r,officialMarketplaceAutoInstallLastAttemptTime:i,officialMarketplaceAutoInstallNextRetryTime:a}))}catch(e){o=!0,ai(yr(e)),K(`Failed to save marketplace auto-install failure state: ${e}`,{level:`error`})}return Y(`tengu_official_marketplace_auto_install`,{installed:!1,skipped:!0,failed:!0,retry_count:r}),{installed:!1,skipped:!0,reason:`unknown`,configSaveFailed:o}}}H(),q();function kF(){fF(async()=>{let e=await OF(),t=[];return e.configSaveFailed&&(K(`Showing marketplace config save failure notification`),t.push({key:`marketplace-config-save-failed`,jsx:(0,$.jsx)(R,{color:`error`,children:`Failed to save marketplace retry info · Check ~/.claude.json permissions`}),priority:`immediate`,timeoutMs:1e4})),e.installed?(K(`Showing marketplace installation success notification`),t.push({key:`marketplace-installed`,jsx:(0,$.jsx)(R,{color:`success`,children:`✓ Anthropic marketplace installed · /plugin to see available plugins`}),priority:`immediate`,timeoutMs:7e3})):e.skipped&&e.reason===`unknown`&&(K(`Showing marketplace installation failure notification`),t.push({key:`marketplace-install-failed`,jsx:(0,$.jsx)(R,{color:`warning`,children:`Failed to install Anthropic marketplace · Will retry on next startup`}),priority:`immediate`,timeoutMs:8e3})),t})}ii(),w(),Ui(),up();var AF=Hi(()=>b({method:v(`notifications/message`),params:b({prompt:_(),image:b({type:v(`base64`),media_type:y([`image/jpeg`,`image/png`,`image/gif`,`image/webp`]),data:_()}).optional(),tabId:g().optional()})}));function jF(e,t){let n=(0,Q.useRef)(void 0);(0,Q.useEffect)(()=>{if(process.env.USER_TYPE!==`ant`)return;let t=MF(e);n.current!==t&&(n.current=t),t&&t.client.setNotificationHandler(AF(),e=>{if(n.current!==t)return;let{tabId:r,prompt:i,image:a}=e.params;if(!(typeof r!=`number`||!Xv(r)))try{tm(a?{value:[{type:`text`,text:i},{type:`image`,source:{type:a.type,media_type:a.media_type,data:a.data}}],mode:`prompt`}:{value:i,mode:`prompt`})}catch(e){ai(e)}})},[e]),(0,Q.useEffect)(()=>{let n=MF(e);n&&bp(`set_permission_mode`,{mode:t===`bypassPermissions`?`skip_all_permission_checks`:`ask`},n)},[e,t])}function MF(e){return e.find(e=>e.type===`connected`&&e.name===`claude-in-chrome`)}er(),J();function NF(e){if(e.length===0)return;if(e.length===1)return e[0];let t=e.map(e=>({tip:e,sessions:uS(e.id)}));return t.sort((e,t)=>t.sessions-e.sessions),t[0]?.tip}async function PF(e){if(Qn().spinnerTipsEnabled===!1)return;let t=await pS(e);if(t.length!==0)return NF(t)}function FF(e){sS(e.id),Y(`tengu_tip_shown`,{tipIdLength:e.id,cooldownSessions:e.cooldownSessions})}Tx(),sg();function IF(e,t,n){let r=(0,Q.useRef)(!1);(0,Q.useEffect)(()=>{!$u()||r.current||(r.current=!0,e&&aa(e,n))},[t,e,n])}H(),Sp(),J(),Rc(),Mb();function LF({hostPattern:{host:e},onUserResponse:t}){function n(n){switch(process.env.USER_TYPE===`ant`&&Y(`tengu_sandbox_network_dialog_result`,{host:e,result:n}),n){case`yes`:t({allow:!0,persistToSettings:!1});break;case`yes-dont-ask-again`:t({allow:!0,persistToSettings:!0});break;case`no`:t({allow:!1,persistToSettings:!1});break}}let r=[{label:`Yes`,value:`yes`},...Fh()?[]:[{label:(0,$.jsxs)(R,{children:[`Yes, and don't ask again for `,(0,$.jsx)(R,{bold:!0,children:e})]}),value:`yes-dont-ask-again`}],{label:(0,$.jsxs)(R,{children:[`No, and tell Claude what to do differently `,(0,$.jsx)(R,{bold:!0,children:`(esc)`})]}),value:`no`}];return(0,$.jsx)(Pb,{title:`Network request outside of sandbox`,children:(0,$.jsxs)(U,{flexDirection:`column`,paddingX:2,paddingY:1,children:[(0,$.jsxs)(U,{children:[(0,$.jsx)(R,{dimColor:!0,children:`Host:`}),(0,$.jsxs)(R,{children:[` `,e]})]}),(0,$.jsx)(U,{marginTop:1,children:(0,$.jsx)(R,{children:`Do you want to allow this connection?`})}),(0,$.jsx)(U,{children:(0,$.jsx)(so,{options:r,onChange:n,onCancel:()=>{process.env.USER_TYPE===`ant`&&Y(`tengu_sandbox_network_dialog_result`,{host:e,result:`cancel`}),t({allow:!1,persistToSettings:!1})}})})]})})}H(),Sp(),si();function RF(e){return`${e.getHours()%12||12}:${String(e.getMinutes()).padStart(2,`0`)}:${String(e.getSeconds()).padStart(2,`0`)}${e.getHours()<12?`am`:`pm`}`}function zF(){let[e,t]=(0,Q.useState)([]),[n,r]=(0,Q.useState)(0);return(0,Q.useEffect)(()=>{let e=qh.getSandboxViolationStore();return e.subscribe(n=>{t(n.slice(-10)),r(e.getTotalCount())})},[]),!qh.isSandboxingEnabled()||oi()===`linux`||n===0?null:(0,$.jsxs)(U,{flexDirection:`column`,marginTop:1,children:[(0,$.jsx)(U,{marginLeft:0,children:(0,$.jsxs)(R,{color:`permission`,children:[`⧈ Sandbox blocked `,n,` total `,n===1?`operation`:`operations`]})}),e.map((e,t)=>(0,$.jsx)(U,{paddingLeft:2,children:(0,$.jsxs)(R,{dimColor:!0,children:[RF(e.timestamp),e.command?` ${e.command}:`:``,` `,e.line]})},`${e.timestamp.getTime()}-${t}`)),(0,$.jsx)(U,{paddingLeft:2,children:(0,$.jsxs)(R,{dimColor:!0,children:[`… showing last `,Math.min(10,e.length),` of `,n]})})]})}cx(),Ac(),ot(),H();var BF=[];function VF({mcpClients:e=BF}){let{addNotification:t}=Wp();(0,Q.useEffect)(()=>{if($e())return;let n=e.filter(e=>e.type===`failed`&&e.config.type!==`sse-ide`&&e.config.type!==`ws-ide`&&e.config.type!==`claudeai-proxy`),r=e.filter(e=>e.type===`failed`&&e.config.type===`claudeai-proxy`&&wd(e.name)),i=e.filter(e=>e.type===`needs-auth`&&e.config.type!==`claudeai-proxy`),a=e.filter(e=>e.type===`needs-auth`&&e.config.type===`claudeai-proxy`&&wd(e.name));n.length===0&&r.length===0&&i.length===0&&a.length===0||(n.length>0&&t({key:`mcp-failed`,jsx:(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(R,{color:`error`,children:[n.length,` MCP `,n.length===1?`server`:`servers`,` failed`]}),(0,$.jsx)(R,{dimColor:!0,children:` · /mcp`})]}),priority:`medium`}),r.length>0&&t({key:`mcp-claudeai-failed`,jsx:(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(R,{color:`error`,children:[r.length,` claude.ai `,r.length===1?`connector`:`connectors`,` `,`unavailable`]}),(0,$.jsx)(R,{dimColor:!0,children:` · /mcp`})]}),priority:`medium`}),i.length>0&&t({key:`mcp-needs-auth`,jsx:(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(R,{color:`warning`,children:[i.length,` MCP `,i.length===1?`server needs`:`servers need`,` `,`auth`]}),(0,$.jsx)(R,{dimColor:!0,children:` · /mcp`})]}),priority:`medium`}),a.length>0&&t({key:`mcp-claudeai-needs-auth`,jsx:(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(R,{color:`warning`,children:[a.length,` claude.ai`,` `,a.length===1?`connector needs`:`connectors need`,` auth`]}),(0,$.jsx)(R,{dimColor:!0,children:` · /mcp`})]}),priority:`medium`}))},[t,e])}H(),er(),of();var HF=`Auto mode lets Claude handle permission prompts automatically — Claude checks each tool call for risky actions and prompt injection before executing. Actions Claude identifies as safe are executed, while actions Claude identifies as risky are blocked and Claude may try a different approach. Ideal for long-running tasks. Sessions are slightly more expensive. Claude can make mistakes that allow harmful commands to run, it's recommended to only use in isolated environments. Shift+Tab to change mode.`;O(),ot(),Ac(),H(),Z(),q(),s();var UF=5e3;function WF(){let{addNotification:e}=Wp(),t=Hc(),[n,r]=Q.useState(()=>c(`true`)),i=Q.useRef(new Set),a=Q.useCallback((n,r)=>{let a=`${n}:${r}`;if(i.current.has(a))return;i.current.add(a),K(`LSP error: ${n} - ${r}`),t(e=>{let t=new Set(e.plugins.errors.map(e=>e.type===`generic-error`?`generic-error:${e.source}:${e.error}`:`${e.type}:${e.source}`)),i=`generic-error:${n}:${r}`;return t.has(i)?e:{...e,plugins:{...e.plugins,errors:[...e.plugins.errors,{type:`generic-error`,source:n,error:r}]}}});let o=n.startsWith(`plugin:`)?n.split(`:`)[1]??n:n;e({key:`lsp-error-${n}`,jsx:(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(R,{color:`error`,children:[`LSP for `,o,` failed`]}),(0,$.jsx)(R,{dimColor:!0,children:` · /plugin for details`})]}),priority:`medium`,timeoutMs:8e3})},[e,t]),o=Q.useCallback(()=>{if($e()||Re())return;let e=sh();if(e.status===`failed`){a(`lsp-manager`,e.error.message),r(!1);return}if(e.status===`pending`||e.status===`not-started`)return;let t=Sm();if(t){let e=t.getAllServers();for(let[t,n]of e)n.state===`error`&&n.lastError&&a(t,n.lastError.message)}},[a]);se(o,n?UF:null),Q.useEffect(()=>{$e()||!n||o()},[o,n])}q();var GF=new Map;async function KF(e){if(!e||!e.trim())return K(`[binaryCheck] Empty command provided, returning false`),!1;let t=e.trim(),n=GF.get(t);if(n!==void 0)return K(`[binaryCheck] Cache hit for '${t}': ${n}`),n;let r=!1;return await Wr(t).catch(()=>null)&&(r=!0),GF.set(t,r),K(`[binaryCheck] Binary '${t}' ${r?`found`:`not found`}`),r}Et(),q(),gu();var qF=5;function JF(e){return Ln.has(e.toLowerCase())}function YF(e){if(!e)return null;if(typeof e==`string`)return K(`[lspRecommendation] Skipping string path lspServers (not readable from marketplace)`),null;if(Array.isArray(e)){for(let t of e){if(typeof t==`string`)continue;let e=ZF(t);if(e)return e}return null}return ZF(e)}function XF(e){return typeof e==`object`&&!!e}function ZF(e){let t=new Set,n=null;for(let[r,i]of Object.entries(e)){if(!XF(i))continue;!n&&typeof i.command==`string`&&(n=i.command);let e=i.extensionToLanguage;if(XF(e))for(let n of Object.keys(e))t.add(n.toLowerCase())}return!n||t.size===0?null:{extensions:t,command:n}}async function QF(){let e=new Map;try{let t=await rs();for(let n of Object.keys(t))try{let t=await Tl(n),r=JF(n);for(let i of t.plugins){if(!i.lspServers)continue;let t=YF(i.lspServers);if(!t)continue;let a=`${i.name}@${n}`;e.set(a,{entry:i,marketplaceName:n,extensions:t.extensions,command:t.command,isOfficial:r})}}catch(e){K(`[lspRecommendation] Failed to load marketplace ${n}: ${e}`)}}catch(e){K(`[lspRecommendation] Failed to load marketplaces config: ${e}`)}return e}async function $F(e){if(nI())return K(`[lspRecommendation] Recommendations are disabled`),[];let t=CS(e).toLowerCase();if(!t)return K(`[lspRecommendation] No file extension found`),[];K(`[lspRecommendation] Looking for LSP plugins for ${t}`);let n=await QF(),r=pn().lspRecommendationNeverPlugins??[],i=[];for(let[e,a]of n)if(a.extensions.has(t)){if(r.includes(e)){K(`[lspRecommendation] Skipping ${e} (in never suggest list)`);continue}if(va(e)){K(`[lspRecommendation] Skipping ${e} (already installed)`);continue}i.push({info:a,pluginId:e})}let a=[];for(let{info:e,pluginId:t}of i)await KF(e.command)?(a.push({info:e,pluginId:t}),K(`[lspRecommendation] Binary '${e.command}' found for ${t}`)):K(`[lspRecommendation] Skipping ${t} (binary '${e.command}' not found)`);return a.sort((e,t)=>e.info.isOfficial&&!t.info.isOfficial?-1:!e.info.isOfficial&&t.info.isOfficial?1:0),a.map(({info:e,pluginId:t})=>({pluginId:t,pluginName:e.entry.name,marketplaceName:e.marketplaceName,description:e.entry.description,isOfficial:e.isOfficial,extensions:Array.from(e.extensions),command:e.command}))}function eI(e){rn(t=>{let n=t.lspRecommendationNeverPlugins??[];return n.includes(e)?t:{...t,lspRecommendationNeverPlugins:[...n,e]}}),K(`[lspRecommendation] Added ${e} to never suggest`)}function tI(){rn(e=>{let t=(e.lspRecommendationIgnoredCount??0)+1;return{...e,lspRecommendationIgnoredCount:t}}),K(`[lspRecommendation] Incremented ignored count`)}function nI(){let e=pn();return e.lspRecommendationDisabled===!0||(e.lspRecommendationIgnoredCount??0)>=qF}f(),ot(),H(),ii(),gu();function rI(){let[e,t]=Q.useState(null),n=Q.useRef(!1),r=Q.useCallback(r=>{$e()||e||n.current||(n.current=!0,r().then(e=>{e&&t(e)}).catch(ai).finally(()=>{n.current=!1}))},[e]);return{recommendation:e,clearRecommendation:Q.useCallback(()=>t(null),[]),tryResolve:r}}async function iI(e,t,n,r,i){try{let a=await Ma(e);if(!a)throw Error(`Plugin ${e} not found in marketplace`);await i(a),r({key:`${n}-installed`,jsx:(0,$.jsxs)(R,{color:`success`,children:[p.tick,` `,t,` installed · restart to apply`]}),priority:`immediate`,timeoutMs:5e3})}catch(e){ai(e),r({key:`${n}-install-failed`,jsx:(0,$.jsxs)(R,{color:`error`,children:[`Failed to install `,t]}),priority:`immediate`,timeoutMs:5e3})}}ot(),Ac(),Z(),Et(),q(),ii(),er();var aI=28e3;function oI(){let e=X(e=>e.fileHistory.trackedFiles),{addNotification:t}=Wp(),n=Q.useRef(new Set),{recommendation:r,clearRecommendation:i,tryResolve:a}=rI();return Q.useEffect(()=>{a(async()=>{if(it())return null;let t=[];for(let r of e)n.current.has(r)||(n.current.add(r),t.push(r));for(let e of t)try{let t=(await $F(e))[0];if(t)return K(`[useLspPluginRecommendation] Found match: ${t.pluginName} for ${e}`),st(!0),{pluginId:t.pluginId,pluginName:t.pluginName,pluginDescription:t.description,fileExtension:CS(e),shownAt:Date.now()}}catch(e){ai(e)}return null})},[e,a]),{recommendation:r,handleResponse:Q.useCallback(e=>{if(!r)return;let{pluginId:n,pluginName:a,shownAt:o}=r;switch(K(`[useLspPluginRecommendation] User response: ${e} for ${a}`),e){case`yes`:iI(n,a,`lsp-plugin`,t,async e=>{K(`[useLspPluginRecommendation] Installing plugin: ${n}`);let t=typeof e.entry.source==`string`?wS(e.marketplaceInstallLocation,e.entry.source):void 0;await ap(n,e.entry,`user`,void 0,t),Jn(`userSettings`,{enabledPlugins:{...ln(`userSettings`)?.enabledPlugins,[n]:!0}}),K(`[useLspPluginRecommendation] Plugin installed: ${n}`)});break;case`no`:{let e=Date.now()-o;e>=aI&&(K(`[useLspPluginRecommendation] Timeout detected (${e}ms), incrementing ignored count`),tI());break}case`never`:eI(n);break;case`disable`:rn(e=>e.lspRecommendationDisabled?e:{...e,lspRecommendationDisabled:!0});break}i()},[r,t,i])}}H(),Rc(),Mb();var sI=3e4;function cI({pluginName:e,pluginDescription:t,fileExtension:n,onResponse:r}){let i=Q.useRef(r);i.current=r,Q.useEffect(()=>{let e=setTimeout(e=>e.current(`no`),sI,i);return()=>clearTimeout(e)},[]);function a(e){switch(e){case`yes`:r(`yes`);break;case`no`:r(`no`);break;case`never`:r(`never`);break;case`disable`:r(`disable`);break}}return(0,$.jsx)(Pb,{title:`LSP Plugin Recommendation`,children:(0,$.jsxs)(U,{flexDirection:`column`,paddingX:2,paddingY:1,children:[(0,$.jsx)(U,{marginBottom:1,children:(0,$.jsx)(R,{dimColor:!0,children:`LSP provides code intelligence like go-to-definition and error checking`})}),(0,$.jsxs)(U,{children:[(0,$.jsx)(R,{dimColor:!0,children:`Plugin:`}),(0,$.jsxs)(R,{children:[` `,e]})]}),t&&(0,$.jsx)(U,{children:(0,$.jsx)(R,{dimColor:!0,children:t})}),(0,$.jsxs)(U,{children:[(0,$.jsx)(R,{dimColor:!0,children:`Triggered by:`}),(0,$.jsxs)(R,{children:[` `,n,` files`]})]}),(0,$.jsx)(U,{marginTop:1,children:(0,$.jsx)(R,{children:`Would you like to install this LSP plugin?`})}),(0,$.jsx)(U,{children:(0,$.jsx)(so,{options:[{label:(0,$.jsxs)(R,{children:[`Yes, install `,(0,$.jsx)(R,{bold:!0,children:e})]}),value:`yes`},{label:`No, not now`,value:`no`},{label:(0,$.jsxs)(R,{children:[`Never for `,(0,$.jsx)(R,{bold:!0,children:e})]}),value:`never`},{label:`Disable all LSP recommendations`,value:`disable`}],onChange:a,onCancel:()=>r(`no`)})})]})})}Ac(),J(),q(),Tg();function lI(){let e=Q.useSyncExternalStore(sm,Km),{addNotification:t}=Wp(),{recommendation:n,clearRecommendation:r,tryResolve:i}=rI();return Q.useEffect(()=>{e&&i(async()=>{let t=await Pm(e);return t&&(K(`[useClaudeCodeHintRecommendation] surfacing ${t.pluginId} from ${t.sourceCommand}`),Qd()),Km()===e&&Md(),t})},[e,i]),{recommendation:n,handleResponse:Q.useCallback(e=>{if(n){switch(tg(n.pluginId),Y(`tengu_plugin_hint_response`,{_PROTO_plugin_name:n.pluginName,_PROTO_marketplace_name:n.marketplaceName,response:e}),e){case`yes`:{let{pluginId:e,pluginName:r,marketplaceName:i}=n;iI(e,r,`hint-plugin`,t,async t=>{let n=await i_({pluginId:e,entry:t.entry,marketplaceName:i,scope:`user`,trigger:`hint`});if(!n.success)throw Error(n.success?`Unknown error`:n.error)});break}case`disable`:ea();break;case`no`:break}r()}},[n,t,r])}}H(),Rc(),Mb();var uI=3e4;function dI({pluginName:e,pluginDescription:t,marketplaceName:n,sourceCommand:r,onResponse:i}){let a=Q.useRef(i);a.current=i,Q.useEffect(()=>{let e=setTimeout(e=>e.current(`no`),uI,a);return()=>clearTimeout(e)},[]);function o(e){switch(e){case`yes`:i(`yes`);break;case`disable`:i(`disable`);break;default:i(`no`)}}return(0,$.jsx)(Pb,{title:`Plugin Recommendation`,children:(0,$.jsxs)(U,{flexDirection:`column`,paddingX:2,paddingY:1,children:[(0,$.jsx)(U,{marginBottom:1,children:(0,$.jsxs)(R,{dimColor:!0,children:[`The `,(0,$.jsx)(R,{bold:!0,children:r}),` command suggests installing a plugin.`]})}),(0,$.jsxs)(U,{children:[(0,$.jsx)(R,{dimColor:!0,children:`Plugin:`}),(0,$.jsxs)(R,{children:[` `,e]})]}),(0,$.jsxs)(U,{children:[(0,$.jsx)(R,{dimColor:!0,children:`Marketplace:`}),(0,$.jsxs)(R,{children:[` `,n]})]}),t&&(0,$.jsx)(U,{children:(0,$.jsx)(R,{dimColor:!0,children:t})}),(0,$.jsx)(U,{marginTop:1,children:(0,$.jsx)(R,{children:`Would you like to install it?`})}),(0,$.jsx)(U,{children:(0,$.jsx)(so,{options:[{label:(0,$.jsxs)(R,{children:[`Yes, install `,(0,$.jsx)(R,{bold:!0,children:e})]}),value:`yes`},{label:`No`,value:`no`},{label:`No, and don't show plugin installation hints again`,value:`disable`}],onChange:o,onCancel:()=>i(`no`)})})]})})}Rc(),Mb();var fI=3e4;function pI({tools:e,onSelect:t,onDismiss:n}){let r=Q.useRef(t),i=Q.useRef(n);r.current=t,i.current=n,Q.useEffect(()=>{let e=setTimeout(e=>e.current(),fI,i);return()=>clearTimeout(e)},[]);let a=e.map(e=>({label:`${e.name} — ${e.description.slice(0,60)} (score: ${e.score.toFixed(2)})`,value:e.name}));return a.push({label:`Dismiss`,value:`__dismiss__`}),(0,$.jsx)(Pb,{title:`Tool Recommendation`,children:(0,$.jsx)(so,{options:a,onChange:e=>{e===`__dismiss__`?i.current():(i.current(),r.current(e))}})})}f_();var mI=.15,hI=3;function gI(){let e=Q.useSyncExternalStore(ka,bl),t=Q.useMemo(()=>e.length===0?[]:e.slice(0,hI).map(e=>({name:e.name,description:e.description.slice(0,60),score:e.score})),[e]);return{tools:t,visible:t.length>0&&(t[0]?.score??0)>=mI,handleSelect:Q.useCallback(e=>{Xs()},[]),handleDismiss:Q.useCallback(()=>{Xs()},[])}}ot(),Ac(),H(),Z(),q(),Wn();function _I(){let{addNotification:e}=Wp(),t=X(e=>e.plugins.installationStatus),{totalFailed:n,failedMarketplacesCount:r,failedPluginsCount:i}=(0,Q.useMemo)(()=>{if(!t)return{totalFailed:0,failedMarketplacesCount:0,failedPluginsCount:0};let e=t.marketplaces.filter(e=>e.status===`failed`),n=t.plugins.filter(e=>e.status===`failed`);return{totalFailed:e.length+n.length,failedMarketplacesCount:e.length,failedPluginsCount:n.length}},[t]);(0,Q.useEffect)(()=>{if(!$e()){if(!t){K(`No installation status to monitor`);return}n!==0&&(K(`Plugin installation status: ${r} failed marketplaces, ${i} failed plugins`),n!==0&&(K(`Adding notification for ${n} failed installations`),e({key:`plugin-install-failed`,jsx:(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(R,{color:`error`,children:[n,` `,an(n,`plugin`),` failed to install`]}),(0,$.jsx)(R,{dimColor:!0,children:` · /plugin for details`})]}),priority:`medium`})))}},[e,n,r,i])}ot(),Ac(),H(),q(),Bx();function vI(){let{addNotification:e}=Wp(),[t,n]=(0,Q.useState)([]);(0,Q.useEffect)(()=>{if(!$e())return Vx(e=>{K(`Plugin autoupdate notification: ${e.length} plugin(s) updated`),n(e)})},[]),(0,Q.useEffect)(()=>{if($e()||t.length===0)return;let n=t.map(e=>{let t=e.indexOf(`@`);return t>0?e.substring(0,t):e}),r=n.length<=2?n.join(` and `):`${n.length} plugins`;e({key:`plugin-autoupdate-restart`,jsx:(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(R,{color:`success`,children:[n.length===1?`Plugin`:`Plugins`,` updated: `,r]}),(0,$.jsx)(R,{dimColor:!0,children:` · Run /reload-plugins to apply`})]}),priority:`low`,timeoutMs:1e4}),K(`Showing plugin autoupdate notification for: ${n.join(`, `)}`)},[t,e])}q(),ii(),gu(),mb(),J();function yI(e,t,n,r){e(e=>({...e,plugins:{...e.plugins,installationStatus:{...e.plugins.installationStatus,marketplaces:e.plugins.installationStatus.marketplaces.map(e=>e.name===t?{...e,status:n,error:r}:e)}}}))}async function bI(e){K(`performBackgroundPluginInstallations called`);try{let t=qy(ec(),await rs().catch(()=>({}))),n=[...t.missing,...t.sourceChanged.map(e=>e.name)];if(e(e=>({...e,plugins:{...e.plugins,installationStatus:{marketplaces:n.map(e=>({name:e,status:`pending`})),plugins:[]}}})),n.length===0)return;K(`Installing ${n.length} marketplace(s) in background`);let r=await Vy({onProgress:t=>{switch(t.type){case`installing`:yI(e,t.name,`installing`);break;case`installed`:yI(e,t.name,`installed`);break;case`failed`:yI(e,t.name,`failed`,t.error);break}}}),i={installed_count:r.installed.length,updated_count:r.updated.length,failed_count:r.failed.length,up_to_date_count:r.upToDate.length};if(Y(`tengu_marketplace_background_install`,i),Pr(`info`,`tengu_marketplace_background_install`,i),r.installed.length>0){_s(),K(`Auto-refreshing plugins after ${r.installed.length} new marketplace(s) installed`);try{await pb(e)}catch(t){ai(t),K(`Auto-refresh failed, falling back to needsRefresh: ${t}`,{level:`warn`}),rf(`performBackgroundPluginInstallations: auto-refresh failed`),e(e=>e.plugins.needsRefresh?e:{...e,plugins:{...e.plugins,needsRefresh:!0}})}}else r.updated.length>0&&(_s(),rf(`performBackgroundPluginInstallations: marketplaces reconciled`),e(e=>e.plugins.needsRefresh?e:{...e,plugins:{...e.plugins,needsRefresh:!0}}))}catch(e){ai(e)}}Et(),q(),gu(),Jf();async function xI(e){if(K(`performStartupChecks called`),!Bn()){K(`Trust not accepted for current directory - skipping plugin installations`);return}try{K(`Starting background plugin installations`),await Vs()&&(_s(),rf(`performStartupChecks: seed marketplaces changed`),e(e=>e.plugins.needsRefresh?e:{...e,plugins:{...e.plugins,needsRefresh:!0}})),await bI(e)}catch(e){K(`Error initiating background plugin installations: ${e}`)}}H();var SI=/https?:\/\/\S+/;function CI(){let[e,t]=(0,Q.useState)(Gt.getInstance().getStatus());return(0,Q.useEffect)(()=>Gt.getInstance().subscribe(t),[]),!e.isAuthenticating&&!e.error&&e.output.length===0||!e.isAuthenticating&&!e.error?null:(0,$.jsxs)(U,{flexDirection:`column`,borderStyle:`round`,borderColor:`permission`,paddingX:1,marginY:1,children:[(0,$.jsx)(R,{bold:!0,color:`permission`,children:`Cloud Authentication`}),e.output.length>0&&(0,$.jsx)(U,{flexDirection:`column`,marginTop:1,children:e.output.slice(-5).map((e,t)=>{let n=e.match(SI);if(!n)return(0,$.jsx)(R,{dimColor:!0,children:e},t);let r=n[0],i=n.index??0,a=e.slice(0,i),o=e.slice(i+r.length);return(0,$.jsxs)(R,{dimColor:!0,children:[a,(0,$.jsx)(re,{url:r,children:r}),o]},t)})}),e.error&&(0,$.jsx)(U,{marginTop:1,children:(0,$.jsx)(R,{color:`error`,children:e.error})})]})}Ac(),H(),eo(),fs(),$n(),Kn(),ot();function wI(e){let{addNotification:t}=Wp(),n=Js(),r=(0,Q.useMemo)(()=>Up(n,e),[n,e]),i=(0,Q.useMemo)(()=>ua(n),[n]),a=(0,Q.useRef)(null),o=or(),s=Mt(),c=o===`team`||o===`enterprise`,[l,u]=(0,Q.useState)(!1);(0,Q.useEffect)(()=>{$e()||(n.isUsingOverage&&!l&&(!c||s)?(t({key:`limit-reached`,text:i,priority:`immediate`}),u(!0)):!n.isUsingOverage&&l&&u(!1))},[n.isUsingOverage,i,l,t,s,c]),(0,Q.useEffect)(()=>{$e()||r&&r!==a.current&&(a.current=r,t({key:`rate-limit-warning`,jsx:(0,$.jsx)(R,{children:(0,$.jsx)(R,{color:`warning`,children:r})}),priority:`high`}))},[r,t])}Ac(),ot();function TI(e){let{addNotification:t}=Wp(),n=(0,Q.useRef)(null);(0,Q.useEffect)(()=>{if($e())return;let r=cS(e);r&&r!==n.current&&(n.current=r,t({key:`model-deprecation-warning`,text:r,color:`warning`,priority:`high`})),r||(n.current=null)},[e,t])}s();var EI=``;function DI(){fF(async()=>Hr()||c(process.env.DISABLE_INSTALLATION_CHECKS)||await ym()===`development`?null:{timeoutMs:15e3,key:`npm-deprecation-warning`,text:EI,color:`warning`,priority:`high`})}Ac(),H(),Et(),nl(),ot();var OI=5;function kI({ideSelection:e,mcpClients:t,ideInstallationStatus:n}){let{addNotification:r,removeNotification:i}=Wp(),{status:a,ideName:o}=DD(t),s=(0,Q.useRef)(!1),c=n?og(n?.ideType):!1,l=n?.error||c,u=a===`connected`&&(e?.filePath||e?.text&&e.lineCount>0),d=a===`connected`&&!u,f=l&&!c&&!d&&!u,p=l&&c&&!d&&!u;(0,Q.useEffect)(()=>{if($e())return;if(Ph()||a!==null||p){i(`ide-status-hint`);return}if(s.current||(pn().ideHintShownCount??0)>=OI)return;let e=setTimeout((e,t)=>{wu(!0).then(n=>{let r=n[0]?.name;r&&!e.current&&(e.current=!0,rn(e=>({...e,ideHintShownCount:(e.ideHintShownCount??0)+1})),t({key:`ide-status-hint`,jsx:(0,$.jsxs)(R,{dimColor:!0,children:[`/ide for `,(0,$.jsx)(R,{color:`ide`,children:r})]}),priority:`low`}))})},3e3,s,r);return()=>clearTimeout(e)},[r,i,a,p]),(0,Q.useEffect)(()=>{if(!$e()){if(f||p||a!==`disconnected`||!o){i(`ide-status-disconnected`);return}r({key:`ide-status-disconnected`,text:`${o} disconnected`,color:`error`,priority:`medium`})}},[r,i,a,o,f,p]),(0,Q.useEffect)(()=>{if(!$e()){if(!p){i(`ide-status-jetbrains-disconnected`);return}r({key:`ide-status-jetbrains-disconnected`,text:`IDE plugin not connected · /status for info`,priority:`medium`})}},[r,i,p]),(0,Q.useEffect)(()=>{if(!$e()){if(!f){i(`ide-status-install-error`);return}r({key:`ide-status-install-error`,text:`IDE extension install failed (see /status for info)`,color:`error`,priority:`medium`})}},[r,i,f])}Et();var AI=[e=>{if(MI(e.sonnet45To46MigrationTimestamp))return{key:`sonnet-46-update`,text:`Model updated to Sonnet 4.6`,color:`suggestion`,priority:`high`,timeoutMs:3e3}},e=>{let t=!!e.legacyOpusMigrationTimestamp;if(MI(e.legacyOpusMigrationTimestamp??e.opusProMigrationTimestamp))return{key:`opus-pro-update`,text:t?`Model updated to Opus 4.7 · Set CLAUDE_CODE_DISABLE_LEGACY_MODEL_REMAP=1 to opt out`:`Model updated to Opus 4.7`,color:`suggestion`,priority:`high`,timeoutMs:t?8e3:3e3}}];function jI(){fF(()=>{let e=pn(),t=[];for(let n of AI){let r=n(e);r&&t.push(r)}return t.length>0?t:null})}function MI(e){return e!==void 0&&Date.now()-e<3e3}$n(),H(),J(),Et();var NI=3;function PI(){fF(async()=>{if((pn().subscriptionNoticeCount??0)>=NI)return null;let e=await FI();return e===null?null:(rn(e=>({...e,subscriptionNoticeCount:(e.subscriptionNoticeCount??0)+1})),Y(`tengu_switch_to_subscription_notice_shown`,{}),{key:`switch-to-subscription`,jsx:(0,$.jsxs)(R,{color:`suggestion`,children:[`Use your existing Claude `,e,` plan with Claude Code`,(0,$.jsxs)(R,{color:`text`,dimColor:!0,children:[` `,`· /login to activate`]})]}),priority:`low`})})}async function FI(){if(Fn())return null;let e=await En();return e?e.account.has_claude_max?`Max`:e.account.has_claude_pro?`Pro`:null:null}ot(),Ac(),Z(),fl();function II(e){if(!(`text`in e))return 1;let t=e.text.match(/^(\d+)/);return t?.[1]?parseInt(t[1],10):1}function LI(e,t){return RI(II(e)+1)}function RI(e){return{key:`teammate-spawn`,text:e===1?`1 agent spawned`:`${e} agents spawned`,priority:`low`,timeoutMs:5e3,fold:LI}}function zI(e,t){return BI(II(e)+1)}function BI(e){return{key:`teammate-shutdown`,text:e===1?`1 agent shut down`:`${e} agents shut down`,priority:`low`,timeoutMs:5e3,fold:zI}}function VI(){let e=X(e=>e.tasks),{addNotification:t}=Wp(),n=(0,Q.useRef)(new Set),r=(0,Q.useRef)(new Set);(0,Q.useEffect)(()=>{if(!$e())for(let[i,a]of Object.entries(e))ca(a)&&(a.status===`running`&&!n.current.has(i)&&(n.current.add(i),t(RI(1))),a.status===`completed`&&!r.current.has(i)&&(r.current.add(i),t(BI(1))))},[e,t])}Ac(),Z(),cr(),Vi(),ot();var HI=`fast-mode-cooldown-started`,UI=`fast-mode-cooldown-expired`,WI=`fast-mode-org-changed`,GI=`fast-mode-overage-rejected`;function KI(){let{addNotification:e}=Wp(),t=X(e=>e.fastMode),n=Hc();(0,Q.useEffect)(()=>{if(!$e()&&dr())return Pt(r=>{r?e({key:WI,color:`fastMode`,priority:`immediate`,text:`Fast mode is now available · /fast to turn on`}):t&&(n(e=>({...e,fastMode:!1})),e({key:WI,color:`warning`,priority:`immediate`,text:`Fast mode has been disabled by your organization`}))})},[e,t,n]),(0,Q.useEffect)(()=>{if(!$e()&&dr())return gn(t=>{n(e=>({...e,fastMode:!1})),e({key:GI,color:`warning`,priority:`immediate`,text:t})})},[e,n]),(0,Q.useEffect)(()=>{if($e()||!t)return;let n=W((t,n)=>{let r=qI(n,Li(t-Date.now(),{hideTrailingZeros:!0}));e({key:HI,invalidates:[UI],text:r,color:`warning`,priority:`immediate`})}),r=jt(()=>{e({key:UI,invalidates:[HI],color:`fastMode`,text:`Fast limit reset · now using fast mode`,priority:`immediate`})});return()=>{n(),r()}},[e,t])}function qI(e,t){switch(e){case`overloaded`:return`Fast mode overloaded and is temporarily unavailable · resets in ${t}`;case`rate_limit`:return`Fast limit reached and temporarily disabled · resets in ${t}`}}H(),Jv();function JI({onRun:e,onCancel:t,reason:n}){let r=(0,Q.useRef)(!1);return we(`confirm:no`,t,{context:`Confirmation`}),(0,Q.useEffect)(()=>{r.current||(r.current=!0,e())},[e]),(0,$.jsxs)(U,{flexDirection:`column`,marginTop:1,children:[(0,$.jsx)(U,{children:(0,$.jsx)(R,{bold:!0,children:`Running feedback capture...`})}),(0,$.jsx)(U,{children:(0,$.jsxs)(R,{dimColor:!0,children:[`Press `,(0,$.jsx)(he,{shortcut:`Esc`,action:`cancel`}),` anytime`]})}),(0,$.jsx)(U,{children:(0,$.jsxs)(R,{dimColor:!0,children:[`Reason: `,n]})})]})}function YI(e){if(process.env.USER_TYPE!==`ant`)return!1;switch(e){case`feedback_survey_bad`:return!1;case`feedback_survey_good`:return!1;default:return!1}}function XI(e){return process.env.USER_TYPE===`ant`&&e===`feedback_survey_good`?`/good-claude`:`/issue`}function ZI(e){switch(e){case`feedback_survey_bad`:return`You responded "Bad" to the feedback survey`;case`feedback_survey_good`:return`You responded "Good" to the feedback survey`;default:return`Unknown reason`}}var QI=()=>null;Lt(),H();function $I(){return process.env.USER_TYPE===`ant`?(0,$.jsxs)(U,{flexDirection:`row`,marginTop:1,width:`100%`,children:[(0,$.jsx)(U,{minWidth:2,children:(0,$.jsx)(R,{color:`warning`,children:`⚑`})}),(0,$.jsxs)(R,{children:[(0,$.jsx)(R,{dimColor:!0,children:`[ANT-ONLY] `}),(0,$.jsx)(R,{color:`warning`,bold:!0,children:`Something off with Claude?`}),(0,$.jsx)(R,{dimColor:!0,children:` /issue to report it`})]})]}):null}w_(),Qs();var eL=[/\bcurl\b/,/\bwget\b/,/\bssh\b/,/\bkubectl\b/,/\bsrun\b/,/\bdocker\b/,/\bbq\b/,/\bgsutil\b/,/\bgcloud\b/,/\baws\b/,/\bgit\s+push\b/,/\bgit\s+pull\b/,/\bgit\s+fetch\b/,/\bgh\s+(pr|issue)\b/,/\bnc\b/,/\bncat\b/,/\btelnet\b/,/\bftp\b/],tL=[/^no[,!]\s/i,/\bthat'?s (wrong|incorrect|not (what|right|correct))\b/i,/\bnot what I (asked|wanted|meant|said)\b/i,/\bI (said|asked|wanted|told you|already said)\b/i,/\bwhy did you\b/i,/\byou should(n'?t| not)? have\b/i,/\byou were supposed to\b/i,/\btry again\b/i,/\b(undo|revert) (that|this|it|what you)\b/i];function nL(e){for(let t of e){if(t.type!==`assistant`)continue;let e=t.message.content;if(Array.isArray(e))for(let t of e){if(t.type!==`tool_use`||!(`name`in t))continue;let e=t.name;if(e.startsWith(`mcp__`))return!1;if(e===`Bash`){let e=t.input?.command||``;if(eL.some(t=>t.test(e)))return!1}}}return!0}function rL(e){for(let t=e.length-1;t>=0;t--){let n=e[t];if(n.type!==`user`)continue;let r=Cc(n);if(r)return tL.some(e=>e.test(r))}return!1}var iL=3,aL=1800*1e3;function oL(e,t){let n=(0,Q.useRef)(0),r=(0,Q.useRef)(-1),i=(0,Q.useMemo)(()=>nL(e)&&rL(e),[e]);return process.env.USER_TYPE===`ant`?r.current===t?!0:Date.now()-n.current<aL||t<iL||!i?!1:(n.current=Date.now(),r.current=t,!0):!1}ot(),H();function sL(){return process.env.USER_TYPE===`ant`}function cL(){let[e,t]=(0,Q.useState)(Ie);return ke(()=>{t(Ie())},sL()?500:null),!sL()||e.length===0?null:(0,$.jsxs)(R,{wrap:`truncate-end`,color:`warning`,children:[`[ANT-ONLY] slow sync: `,e.slice(-3).map(e=>`${e.operation} (${Math.round(e.durationMs)}ms)`).join(` · `)]})}f(),H(),nc(),Rc(),xy(),Z(),ot(),Xb(),Qs(),up(),$g(),jr(),ui(),_a(),Qp();var lL=24,uL=11;function dL(){return new Date().toISOString().split(`T`)[0]}function fL({plan:e,sessionId:t,taskId:n,setMessages:r,readFileState:i,memorySelector:a,getAppState:o,setConversationId:s,resultDedupState:c}){pc(`ultraplan-choice`);let l=Hc(),{rows:u,columns:d}=k(),f=Q.useMemo(()=>Math.min(lL,Math.max(1,Math.floor(u/2)-uL)),[u]),m=Q.useMemo(()=>ge(e,Math.max(1,d-4),`wrap`).split(`
90
90
  `),[e,d]),h=Math.max(0,m.length-f),[g,_]=Q.useState(0);Q.useEffect(()=>{_(e=>Math.min(e,h))},[h]);let v=m.length>f;Oe((e,t)=>{if(!v)return;let n=Math.max(1,Math.floor(f/2));if(t.ctrl&&e===`d`||t.wheelDown){let e=t.wheelDown?3:n;_(t=>Math.min(t+e,h))}else if(t.ctrl&&e===`u`||t.wheelUp){let e=t.wheelUp?3:n;_(t=>Math.max(t-e,0))}});let y=m.slice(g,g+f).join(`
91
91
  `),b=g>0,x=g<h,S=Q.useCallback(async a=>{switch(a){case`here`:tm({value:[`Ultraplan approved in browser. Here is the plan:`,``,`<ultraplan>`,e,`</ultraplan>`,``,`The user approved this plan in the remote session. Give them a brief summary, then start implementing.`].join(`
92
- `),mode:`task-notification`});break;case`fresh`:let t=Fe(),n=await NS(Ul()).then(()=>!0,()=>!1);await Zb({setMessages:r,readFileState:i,getAppState:o,setAppState:l,setConversationId:s}),n&&r(e=>[...e,Sd(`Previous session saved · resume with: claude --resume ${t}`,`suggestion`)]),tm({value:`Here is the approved implementation plan:\n\n${e}\n\nImplement this plan.`,mode:`prompt`});break;case`cancel`:{let t=wS(Mr(),`${dL()}-ultraplan.md`);await PS(t,e,{encoding:`utf-8`}),r(e=>[...e,Sd(`Ultraplan rejected · Plan saved to ${fi(t)}`,`suggestion`)]);break}}zd(n,l,e=>e.status===`running`?{...e,status:`completed`,endTime:Date.now()}:e),l(e=>e.ultraplanPendingChoice?{...e,ultraplanPendingChoice:void 0,ultraplanSessionUrl:void 0}:e),ag(t)},[e,t,n,r,o,l,i,s]),C=Q.useMemo(()=>[{label:`Implement here`,value:`here`,description:`Inject plan into the current conversation`},{label:`Start new session`,value:`fresh`,description:`Clear conversation and start with only the plan`},{label:`Cancel`,value:`cancel`,description:`Don't implement — save plan and return`}],[]);return(0,$.jsx)(B,{title:`Ultraplan approved`,subtitle:`How should the plan be implemented?`,onCancel:()=>{},hideInputGuide:!0,children:(0,$.jsxs)(U,{flexDirection:`column`,marginBottom:1,children:[(0,$.jsxs)(U,{flexDirection:`column`,marginBottom:1,children:[(0,$.jsx)(R,{children:y}),v&&(0,$.jsxs)(R,{dimColor:!0,children:[b?p.arrowUp:` `,x?p.arrowDown:` `,` `,g+1,`–`,Math.min(g+f,m.length),` of `,m.length,` · ctrl+u/ctrl+d to scroll`]})]}),(0,$.jsx)(so,{options:C,onChange:e=>void S(e)})]})})}H(),Rc(),xy(),Z(),Et(),Eh();function pL(){return!pn().hasSeenUltraplanTerms}function mL(){return zh()}function hL({onChoice:e}){let[t]=Q.useState(pL),[n]=Q.useState(mL),r=Q.useMemo(()=>Um(n),[n]),i=X(e=>e.replBridgeEnabled),a=Hc(),o=Q.useCallback(r=>{let o=r===`run`&&i;o&&a(e=>e.replBridgeEnabled?{...e,replBridgeEnabled:!1,replBridgeExplicit:!1,replBridgeOutboundOnly:!1}:e),r!==`cancel`&&t&&rn(e=>e.hasSeenUltraplanTerms?e:{...e,hasSeenUltraplanTerms:!0}),e(r,{disconnectedBridge:o,promptIdentifier:n})},[e,i,a,t]),s=Q.useCallback(()=>{o(`cancel`)},[o]),c=[{label:`Run ultraplan`,value:`run`,description:i?`Disable remote control and launch in Claude Code on the web`:`launch in Claude Code on the web`},{label:`Not now`,value:`cancel`}];return(0,$.jsx)(B,{title:`Run ultraplan in the cloud?`,subtitle:r.timeEstimate,onCancel:s,children:(0,$.jsxs)(U,{flexDirection:`column`,gap:1,children:[(0,$.jsxs)(U,{flexDirection:`column`,children:[(0,$.jsx)(R,{dimColor:!0,children:r.dialogBody}),t?(0,$.jsxs)(R,{dimColor:!0,children:[`For more information on Claude Code on the web:`,(0,$.jsx)(re,{url:Am,children:Am})]}):null]}),(0,$.jsx)(R,{dimColor:!0,children:i?`This will disable Remote Control for this session.`:r.dialogPipeline}),(0,$.jsx)(so,{options:c,onChange:o})]})})}px(),H(),Et(),La();function gL(e,t,n){let r=(0,Q.useRef)(!1),i=(0,Q.useRef)(n);i.current=n,(0,Q.useEffect)(()=>{if(t)return e.subscribe(()=>{let t=e.getState(),n=e.hasSelection();if(t?.isDragging){r.current=!1;return}if(!n){r.current=!1;return}if(r.current||!(pn().copyOnSelect??!0))return;let a=e.copySelectionNoClear();if(!a||!a.trim()){r.current=!0;return}r.current=!0,i.current?.(a)})},[t,e])}function _L(e){let[t]=ae();(0,Q.useEffect)(()=>{e.setSelectionBgColor(y_(t).selectionBg)},[e,t])}Ac(),H(),Jv(),q();var vL=40,yL=.3,bL=6,xL=200,SL=15,CL=15,wL=3,TL=1500,EL=150,DL=5,OL=5,kL=80,AL=3,jL=6,ML=500;function NL(e){return!(e.wheelUp||e.wheelDown||(e.leftArrow||e.rightArrow||e.upArrow||e.downArrow||e.home||e.end||e.pageUp||e.pageDown)&&(e.shift||e.meta||e.super))}function PL(e){return!e.shift||e.meta?null:e.leftArrow?`left`:e.rightArrow?`right`:e.upArrow?`up`:e.downArrow?`down`:e.home?`lineStart`:e.end?`lineEnd`:null}function FL(e,t,n){if(!e.xtermJs){if(e.wheelMode&&n-e.time>TL&&(e.wheelMode=!1,e.burstCount=0,e.mult=e.base),e.pendingFlip){if(e.pendingFlip=!1,t!==e.dir||n-e.time>xL)return e.dir=t,e.time=n,e.mult=e.base,Math.floor(e.mult);e.wheelMode=!0}let r=n-e.time;if(t!==e.dir&&e.dir!==0)return e.pendingFlip=!0,e.time=n,0;if(e.dir=t,e.time=n,e.wheelMode)if(r<OL)if(++e.burstCount>=5)e.wheelMode=!1,e.burstCount=0,e.mult=e.base;else return 1;else e.burstCount=0;if(e.wheelMode){let t=.5**(r/EL),n=Math.max(CL,e.base*2),i=1+(e.mult-1)*t+SL*t;return e.mult=Math.min(n,i,e.mult+wL),Math.floor(e.mult)}if(r>vL)e.mult=e.base;else{let t=Math.max(bL,e.base*2);e.mult=Math.min(t,e.mult+yL)}return Math.floor(e.mult)}let r=n-e.time,i=t===e.dir;if(e.time=n,e.dir=t,i&&r<OL)return 1;if(!i||r>ML)e.mult=2,e.frac=0;else{let t=.5**(r/EL);e.mult=Math.min(r>=kL?AL:jL,1+(e.mult-1)*t+DL*t)}let a=e.mult+e.frac,o=Math.floor(a);return e.frac=a-o,o}function IL(){let e=process.env.CLAUDE_CODE_SCROLL_SPEED;if(!e)return 1;let t=parseFloat(e);return Number.isNaN(t)||t<=0?1:Math.min(t,20)}function LL(e=!1,t=1){return{time:0,mult:t,dir:0,xtermJs:e,frac:0,base:t,pendingFlip:!1,wheelMode:!1,burstCount:0}}function RL(){let e=de(),t=IL();return K(`wheel accel: ${e?`decay (xterm.js)`:`window (native)`} · base=${t} · TERM_PROGRAM=${process.env.TERM_PROGRAM??`unset`}`),LL(e,t)}var zL=2,BL=50,VL=200;function HL({scrollRef:e,isActive:t,onScroll:n,isModal:r=!1}){let i=ee(),{addNotification:a}=Wp(),o=(0,Q.useRef)(null);function s(e){let t=z(),n=e.length,r;switch(t){case`native`:r=`copied ${n} chars to clipboard`;break;case`tmux-buffer`:r=`copied ${n} chars to tmux buffer · paste with prefix + ]`;break;case`osc52`:r=`sent ${n} chars via OSC 52 · check terminal clipboard settings if paste fails`;break}a({key:`selection-copied`,text:r,color:`suggestion`,priority:`immediate`,timeoutMs:t===`native`?2e3:4e3})}function c(){let e=i.copySelection();e&&s(e)}function l(e,t){let n=i.getState();if(!n?.anchor||!n.focus)return;let r=e.getViewportTop(),a=r+e.getViewportHeight()-1;if(n.anchor.row<r||n.anchor.row>a||n.focus.row<r||n.focus.row>a)return;let o=Math.max(0,e.getScrollHeight()-e.getViewportHeight()),s=e.getScrollTop()+e.getPendingDelta(),c=Math.max(0,Math.min(o,s+t))-s;if(c!==0)if(c>0)i.captureScrolledRows(r,r+c-1,`above`),i.shiftSelection(-c,r,a);else{let e=-c;i.captureScrolledRows(a-e+1,a,`below`),i.shiftSelection(e,r,a)}}return V({"scroll:pageUp":()=>{let t=e.current;if(!t)return;let r=-Math.max(1,Math.floor(t.getViewportHeight()/2));l(t,r);let i=GL(t,r);n?.(i,t)},"scroll:pageDown":()=>{let t=e.current;if(!t)return;let r=Math.max(1,Math.floor(t.getViewportHeight()/2));l(t,r);let i=GL(t,r);n?.(i,t)},"scroll:lineUp":()=>{i.clearSelection();let t=e.current;if(!t||t.getScrollHeight()<=t.getViewportHeight())return!1;o.current??(o.current=RL()),qL(t,FL(o.current,-1,performance.now())),n?.(!1,t)},"scroll:lineDown":()=>{i.clearSelection();let t=e.current;if(!t||t.getScrollHeight()<=t.getViewportHeight())return!1;o.current??(o.current=RL());let r=KL(t,FL(o.current,1,performance.now()));n?.(r,t)},"scroll:top":()=>{let t=e.current;t&&(l(t,-(t.getScrollTop()+t.getPendingDelta())),t.scrollTo(0),n?.(!1,t))},"scroll:bottom":()=>{let t=e.current;if(!t)return;let r=Math.max(0,t.getScrollHeight()-t.getViewportHeight());l(t,r-(t.getScrollTop()+t.getPendingDelta())),t.scrollTo(r),t.scrollToBottom(),n?.(!0,t)},"selection:copy":c},{context:`Scroll`,isActive:t}),V({"scroll:halfPageUp":()=>{let t=e.current;if(!t)return;let r=-Math.max(1,Math.floor(t.getViewportHeight()/2));l(t,r);let i=GL(t,r);n?.(i,t)},"scroll:halfPageDown":()=>{let t=e.current;if(!t)return;let r=Math.max(1,Math.floor(t.getViewportHeight()/2));l(t,r);let i=GL(t,r);n?.(i,t)},"scroll:fullPageUp":()=>{let t=e.current;if(!t)return;let r=-Math.max(1,t.getViewportHeight());l(t,r);let i=GL(t,r);n?.(i,t)},"scroll:fullPageDown":()=>{let t=e.current;if(!t)return;let r=Math.max(1,t.getViewportHeight());l(t,r);let i=GL(t,r);n?.(i,t)}},{context:`Scroll`,isActive:t}),Oe((t,r,i)=>{let a=e.current;if(!a)return;let o=YL(a,JL(t,r),e=>l(a,e));o!==null&&(n?.(o,a),i.stopImmediatePropagation())},{isActive:t&&r}),Oe((e,t,n)=>{if(!i.hasSelection())return;if(t.escape){i.clearSelection(),n.stopImmediatePropagation();return}if(t.ctrl&&!t.shift&&!t.meta&&e===`c`){c(),n.stopImmediatePropagation();return}let r=PL(t);if(r){i.moveFocus(r),n.stopImmediatePropagation();return}NL(t)&&i.clearSelection()},{isActive:t}),UL(e,i,t,n),gL(i,t,s),_L(i),null}function UL(e,t,n,r){let i=(0,Q.useRef)(null),a=(0,Q.useRef)(0),o=(0,Q.useRef)(0),s=(0,Q.useRef)(0),c=(0,Q.useRef)(r);c.current=r,(0,Q.useEffect)(()=>{if(!n)return;function r(){a.current=0,i.current&&(clearInterval(i.current),i.current=null)}function l(){let n=t.getState(),i=e.current,o=a.current;if(!n?.isDragging||!n.focus||!i||o===0||++s.current>VL){r();return}if(i.getPendingDelta()!==0)return;let l=i.getViewportTop(),u=l+i.getViewportHeight()-1;if(o<0){if(i.getScrollTop()<=0){r();return}let e=Math.min(zL,i.getScrollTop());t.captureScrolledRows(u-e+1,u,`below`),t.shiftAnchor(e,0,u),i.scrollBy(-zL)}else{let e=Math.max(0,i.getScrollHeight()-i.getViewportHeight());if(i.getScrollTop()>=e){r();return}let n=Math.min(zL,e-i.getScrollTop());t.captureScrolledRows(l,l+n-1,`above`),t.shiftAnchor(-n,l,u),i.scrollBy(zL)}c.current?.(!1,i)}function u(e){o.current=e,a.current!==e&&(r(),a.current=e,s.current=0,l(),a.current===e&&(i.current=setInterval(l,BL)))}function d(){let n=e.current;if(!n){r();return}let i=n.getViewportTop(),a=i+n.getViewportHeight()-1,s=t.getState();(!s?.isDragging||s.scrolledOffAbove.length===0&&s.scrolledOffBelow.length===0)&&(o.current=0);let c=WL(s,i,a,o.current);if(c===0){if(o.current!==0&&s?.focus){let e=s.focus.row<i?-1:+(s.focus.row>a);e!==0&&e!==o.current&&(s.scrolledOffAbove=[],s.scrolledOffBelow=[],s.scrolledOffAboveSW=[],s.scrolledOffBelowSW=[],o.current=0)}r()}else u(c)}let f=t.subscribe(d);return()=>{f(),r(),o.current=0}},[n,e,t])}function WL(e,t,n,r=0){if(!e?.isDragging||!e.anchor||!e.focus)return 0;let i=e.focus.row,a=i<t?-1:+(i>n);return r===0?e.anchor.row<t||e.anchor.row>n?0:a:a===r?a:0}function GL(e,t){let n=Math.max(0,e.getScrollHeight()-e.getViewportHeight()),r=e.getScrollTop()+e.getPendingDelta()+t;return r>=n?(e.scrollTo(n),e.scrollToBottom(),!0):(e.scrollTo(Math.max(0,r)),!1)}function KL(e,t){let n=Math.max(0,e.getScrollHeight()-e.getViewportHeight());return e.getScrollTop()+e.getPendingDelta()+t>=n?(e.scrollToBottom(),!0):(e.scrollBy(t),!1)}function qL(e,t){if(e.getScrollTop()+e.getPendingDelta()-t<=0){e.scrollTo(0);return}e.scrollBy(-t)}function JL(e,t){if(t.meta)return null;if(!t.ctrl&&!t.shift){if(t.upArrow)return`lineUp`;if(t.downArrow)return`lineDown`;if(t.home)return`top`;if(t.end)return`bottom`}if(t.ctrl){if(t.shift)return null;switch(e){case`u`:return`halfPageUp`;case`d`:return`halfPageDown`;case`b`:return`fullPageUp`;case`f`:return`fullPageDown`;case`n`:return`lineDown`;case`p`:return`lineUp`;default:return null}}let n=e[0];if(!n||e!==n.repeat(e.length))return null;if(n===`G`||n===`g`&&t.shift)return`bottom`;if(t.shift)return null;switch(n){case`g`:return`top`;case`j`:return`lineDown`;case`k`:return`lineUp`;case` `:return`fullPageDown`;case`b`:return`fullPageUp`;default:return null}}function YL(e,t,n){switch(t){case null:return null;case`lineUp`:case`lineDown`:{let r=t===`lineDown`?1:-1;return n(r),GL(e,r)}case`halfPageUp`:case`halfPageDown`:{let r=Math.max(1,Math.floor(e.getViewportHeight()/2)),i=t===`halfPageDown`?r:-r;return n(i),GL(e,i)}case`fullPageUp`:case`fullPageDown`:{let r=Math.max(1,e.getViewportHeight()),i=t===`fullPageDown`?r:-r;return n(i),GL(e,i)}case`top`:return n(-(e.getScrollTop()+e.getPendingDelta())),e.scrollTo(0),!1;case`bottom`:{let t=Math.max(0,e.getScrollHeight()-e.getViewportHeight());return n(t-(e.getScrollTop()+e.getPendingDelta())),e.scrollTo(t),e.scrollToBottom(),!0}}}var XL=r({VoiceKeybindingHandler:()=>eR,useVoiceIntegration:()=>QL,useVoiceKeybindingHandler:()=>$L});function ZL(e,t){return!((e.key===`space`?` `:e.key===`return`?`enter`:e.key.toLowerCase())!==t.key||e.ctrl!==t.ctrl||e.shift!==t.shift||e.meta!==(t.alt||t.meta)||e.superKey!==t.super)}function QL({setInputValueRaw:e,inputValueRef:t,insertTextRef:n}){let{addNotification:r}=Wp(),i=(0,tR.useRef)(null),a=(0,tR.useRef)(``),o=(0,tR.useRef)(null),s=(0,tR.useCallback)((r,{char:s=` `,anchor:c=!1,floor:l=0}={})=>{let u=t.current,d=n.current?.cursorOffset??u.length,f=u.slice(0,d),p=u.slice(d),m=s===` `?Qt(f):f,h=0;for(;h<m.length&&m[m.length-1-h]===s;)h++;let g=Math.max(0,Math.min(h-l,r)),_=h-g,v=f.slice(0,f.length-g),y=``;c&&(i.current=v,a.current=p,p.length>0&&!/^\s/.test(p)&&(y=` `));let b=v+y+p;return c&&(o.current=b),b===u&&g===0||(n.current?n.current.setInputWithCursor(b,v.length):e(b)),_},[e,t,n]),c=(0,tR.useCallback)(()=>{let t=i.current;if(t===null)return;let r=a.current;i.current=null,a.current=``;let o=t+r;n.current?n.current.setInputWithCursor(o,t.length):e(o)},[e,n]),l=OD(),u=ph(e=>e.voiceState),d=ph(e=>e.voiceInterimTranscript);(0,tR.useEffect)(()=>{if(u===`recording`&&i.current===null){let e=t.current,r=n.current?.cursorOffset??e.length;i.current=e.slice(0,r),a.current=e.slice(r),o.current=e}u===`idle`&&(i.current=null,a.current=``,o.current=null)},[u,t,n]),(0,tR.useEffect)(()=>{if(i.current===null)return;let r=i.current,s=a.current;if(t.current!==o.current)return;let c=r.length>0&&!/\s$/.test(r)&&d.length>0,l=s.length>0&&!/^\s/.test(s),u=c?` `:``,f=l?` `:``,p=r+u+d+f+s,m=r.length+u.length+d.length;n.current?n.current.setInputWithCursor(p,m):e(p),o.current=p},[d,e,t,n]);let f=(0,tR.useCallback)(r=>{let s=i.current;if(s===null)return;let c=a.current;if(t.current!==o.current)return;let l=s.length>0&&!/\s$/.test(s)&&r.length>0,u=c.length>0&&!/^\s/.test(c)&&r.length>0,d=l?` `:``,f=u?` `:``,p=s+d+r+f+c,m=s.length+d.length+r.length;n.current?n.current.setInputWithCursor(p,m):e(p),o.current=p,i.current=s+d+r},[e,t,n]),p=nR.useVoice({onTranscript:f,onError:e=>{r({key:`voice-error`,text:e,color:`error`,priority:`immediate`,timeoutMs:1e4})},enabled:l,focusMode:!1}),m=(0,tR.useMemo)(()=>{if(i.current===null||d.length===0)return null;let e=i.current,t=e.length>0&&!/\s$/.test(e)&&d.length>0,n=e.length+ +!!t;return{start:n,end:n+d.length}},[d]);return{stripTrailing:s,resetAnchor:c,handleKeyEvent:p.handleKeyEvent,interimRange:m}}function $L({voiceHandleKeyEvent:e,stripTrailing:t,resetAnchor:n,isActive:r}){let i=Fo(),a=Fs(),o=pe(),s=ba(),c=OD(),l=ph(e=>e.voiceState),u=(0,tR.useMemo)(()=>{if(!o)return sR;let e=null;for(let t of o.bindings){if(t.context!==`Chat`||t.chord.length!==1)continue;let n=t.chord[0];n&&(t.action===`voice:pushToTalk`?e=n:e!==null&&me(n,e)&&(e=null))}return e},[o]),d=u!==null&&u.key.length===1&&!u.ctrl&&!u.alt&&!u.shift&&!u.meta&&!u.super?u.key:null,f=(0,tR.useRef)(0),p=(0,tR.useRef)(0),m=(0,tR.useRef)(0),h=(0,tR.useRef)(!1),g=(0,tR.useRef)(null);(0,tR.useEffect)(()=>{l!==`recording`&&(h.current=!1,f.current=0,p.current=0,m.current=0,a(e=>e.voiceWarmingUp?{...e,voiceWarmingUp:!1}:e))},[l,a]);let _=o=>{if(!c||!r||s||u===null)return;let l;if(d!==null){if(o.ctrl||o.meta||o.shift)return;let e=d===` `?Qt(o.key):o.key;if(e[0]!==d||e.length>1&&e!==d.repeat(e.length))return;l=e.length}else{if(!ZL(o,u))return;l=1}let _=i().voiceState;if(h.current&&_!==`idle`){o.stopImmediatePropagation(),d!==null&&t(l,{char:d,floor:m.current}),e();return}if(_!==`idle`){d===null&&o.stopImmediatePropagation();return}let v=f.current;if(f.current+=l,d===null||f.current>=aR){o.stopImmediatePropagation(),g.current&&(clearTimeout(g.current),g.current=null),f.current=0,h.current=!0,a(e=>e.voiceWarmingUp?{...e,voiceWarmingUp:!1}:e),d===null?(t(0,{anchor:!0}),e(iR)):(m.current=t(p.current+l,{char:d,anchor:!0}),p.current=0,e()),i().voiceState===`idle`&&(h.current=!1,n());return}v>=oR?(o.stopImmediatePropagation(),t(l,{char:d,floor:p.current})):p.current+=l,f.current>=oR&&a(e=>e.voiceWarmingUp?e:{...e,voiceWarmingUp:!0}),g.current&&clearTimeout(g.current),g.current=setTimeout((e,t,n,r)=>{e.current=null,t.current=0,n.current=0,r(e=>e.voiceWarmingUp?{...e,voiceWarmingUp:!1}:e)},rR,g,f,p,a)};return Oe((e,t,n)=>{let r=new Ae(n.keypress);_(r),r.didStopImmediatePropagation()&&n.stopImmediatePropagation()},{isActive:r}),{handleKeyDown:_}}function eR(e){return $L(e),null}var tR,nR,rR,iR,aR,oR,sR,cR=t((()=>{tR=n(L(),1),Ac(),Qp(),Cu(),H(),ul(),Wn(),AD(),nR=(iS(),e(rS)),rR=120,iR=2e3,aR=5,oR=2,sR={key:` `,ctrl:!1,alt:!1,shift:!1,meta:!1,super:!1}})),lR=r({useFrustrationDetection:()=>dR});function uR(e){return e.filter(e=>e.isApiErrorMessage).length>=2}function dR(e,t,n,r){let[i,a]=(0,fR.useState)(`closed`),o=pn(),s=Ca(`product_feedback`),c=o.transcriptShareDismissed||!s||t||n||r,l=uR(e);return{state:c?`closed`:l&&i===`closed`?`transcript_prompt`:i,handleTranscriptSelect:t=>{c||(t===`yes`?(BP(e,`frustration`,crypto.randomUUID()),a(`submitted`)):(rn(e=>({...e,transcriptShareDismissed:!0})),a(`closed`)))}}}var fR,pR=t((()=>{fR=n(L(),1),Et(),ml(),VP()})),mR=r({useAntOrgWarningNotification:()=>hR});function hR(){}var gR=t((()=>{})),_R=r({useProactive:()=>vR});function vR(e){let t=(0,yR.useRef)(e);t.current=e,(0,yR.useEffect)(()=>{if(!uv())return;let e=null,n=!1,r=!1;function i(){lv(Date.now()+bR),e=setTimeout(()=>{if(e=null,!rv()){i();return}let{isLoading:a,queuedCommandsLength:o,hasActiveLocalJsxUI:s,isInPlanMode:c}=t.current;if(a||c||s||o>0||r){i();return}r=!0,(async()=>{let e=await qo({basePrompt:`<${Zr}>${new Date().toLocaleTimeString()}</${Zr}>`,currentDir:Mr(),shouldCreate:()=>!n});if(n){await ss({commands:e});return}let r=[];try{for(let n of e)t.current.onQueueTick(n),r.push(n)}catch(t){throw await ss({commands:e.filter(e=>!r.includes(e))}),t}})().catch(e=>K(`[Proactive] failed to create tick: ${e}`,{level:`error`})).finally(()=>{r=!1}),i()},bR)}return i(),()=>{n=!0,e!==null&&(clearTimeout(e),e=null),lv(null)}},[uv(),nv(),av()])}var yR,bR,xR=t((()=>{yR=n(L(),1),ri(),jr(),o_(),q(),bR=3e4})),SR=r({createScheduledTaskQueuedCommand:()=>CR,useScheduledTasks:()=>wR});async function CR(e,t){let n=await su({basePrompt:e.prompt,trigger:`scheduled-task`,rootDir:t?.rootDir,currentDir:t?.currentDir??Mr(),sourceId:e.id,sourceLabel:e.prompt,workload:Ft,shouldCreate:t?.shouldCreate});return n||K(`[ScheduledTasks] skipping ${e.id}: previous run still queued or running`),n}function wR({isLoading:e,assistantMode:t=!1,setMessages:n}){let r=(0,ER.useRef)(e);r.current=e;let i=gc(),a=Hc();(0,ER.useEffect)(()=>{if(!j_())return;let e=!1,o=async t=>{let n=await xa({basePrompt:t,trigger:`scheduled-task`,currentDir:Mr(),workload:Ft,shouldCreate:()=>!e});if(n){if(e){await Wu(n.autonomy.runId,n.autonomy.rootDir);return}tm(n)}},s=Hy({onFire:e=>{o(e).catch(e=>K(`[ScheduledTasks] failed to enqueue missed task prompt: ${e}`,{level:`error`}))},onFireTask:t=>{(async()=>{if(t.agentId){let n=Rg(t.agentId,i.getState().tasks);if(n&&!Pc(n.status)){let r=await CR(t,{shouldCreate:()=>!e});if(!r)return;if(e){await Wu(r.autonomy.runId,r.autonomy.rootDir);return}!zc(n.id,r.value,{autonomyRunId:r.autonomy?.runId,autonomyRootDir:r.autonomy?.rootDir,origin:r.origin},a)&&r.autonomy?.runId&&await Nu(r.autonomy.runId,`Teammate ${t.agentId} exited before the scheduled message could be delivered.`,r.autonomy.rootDir);return}K(`[ScheduledTasks] teammate ${t.agentId} gone, removing orphaned cron ${t.id}`),E_([t.id]);return}let r=await CR(t,{shouldCreate:()=>!e});if(!r)return;if(e){await Wu(r.autonomy.runId,r.autonomy.rootDir);return}let o=gp(`Running scheduled task (${TR(new Date)})`);n(e=>[...e,o]),tm(r)})().catch(e=>K(`[ScheduledTasks] failed to enqueue task ${t.id}: ${e}`,{level:`error`}))},isLoading:()=>r.current,assistantMode:t,getJitterConfig:Wy,isKilled:()=>!j_()});return s.start(),()=>{e=!0,s.stop()}},[t])}function TR(e){return e.toLocaleString(`en-US`,{month:`short`,day:`numeric`,hour:`numeric`,minute:`2-digit`}).replace(/,? at |, /,` `).replace(/ ([AP]M)/,(e,t)=>t.toLowerCase())}var ER,DR=t((()=>{ER=n(L(),1),Z(),co(),jr(),dh(),q(),up(),Qs(),nn()})),OR=r({AntModelSwitchCallout:()=>kR,shouldShowModelSwitchCallout:()=>AR});function kR(e){return null}function AR(){return!1}var jR=t((()=>{})),MR=r({UndercoverAutoCallout:()=>NR});function NR({onDone:e}){return(0,PR.useEffect)(()=>{e()},[e]),null}var PR,FR=t((()=>{PR=n(L(),1)}));ot(),es(),Ai(),f(),H(),nc(),Cb(),Ac(),Hf(),q(),s(),Vi(),o_(),Nv(),Ku(),Yo(),wi(),co(),yo(),Uc(),Lu(),nb(),op(),xd(),vm(),jl(),Bu(),wf(),Cr(),ii(),jr(),Cp(),kg(),Sl(),lh(),Et(),Kn(),J(),fn(),Qs(),Ty(),ri(),mh(),Rm(),ky(),yu(),r_(),bh(),Ab(),Z(),is(),_a(),sg(),fl(),ir(),nl(),Lg(),up(),za(),Ra(),Sp(),Eh(),Go();var IR=(cR(),e(XL)).useVoiceIntegration,LR=(cR(),e(XL)).VoiceKeybindingHandler,RR=process.env.USER_TYPE===`ant`?(pR(),e(lR)).useFrustrationDetection:()=>({state:`closed`,handleTranscriptSelect:()=>{}}),zR=process.env.USER_TYPE===`ant`?(gR(),e(mR)).useAntOrgWarningNotification:()=>{},BR=(Gd(),e(Lh)).getCoordinatorUserContext,VR=(dv(),e(ev)),HR=e=>()=>{},UR=()=>!1,WR=()=>null,GR=(e,t)=>!1,KR=(xR(),e(_R)).useProactive,qR=(DR(),e(SR)).useScheduledTasks,JR=()=>({relayPipeMessage:()=>!1,pipeReturnHadErrorRef:{current:!1}}),YR=()=>({routeToSelectedPipes:()=>!1}),XR=process.env.USER_TYPE===`ant`?(jR(),e(OR)).AntModelSwitchCallout:null,ZR=process.env.USER_TYPE===`ant`?(jR(),e(OR)).shouldShowModelSwitchCallout:()=>!1,QR=process.env.USER_TYPE===`ant`?(FR(),e(MR)).UndercoverAutoCallout:null,$R=[],ez=3e3;function tz(e){let t=[...e].sort((e,t)=>e-t),n=Math.floor(t.length/2);return t.length%2==0?Math.round((t[n-1]+t[n])/2):t[n]}function nz({showAllInTranscript:e,virtualScroll:t,searchBadge:n,suppressShowAll:r=!1,status:i}){let a=pd(`app:toggleTranscript`,`Global`,`ctrl+o`),o=pd(`transcript:toggleShowAll`,`Transcript`,`ctrl+e`);return(0,$.jsxs)(U,{noSelect:!0,alignItems:`center`,alignSelf:`center`,borderTopDimColor:!0,borderBottom:!1,borderLeft:!1,borderRight:!1,borderStyle:`single`,marginTop:1,paddingLeft:2,width:`100%`,children:[(0,$.jsxs)(R,{dimColor:!0,children:[`Showing detailed transcript · `,a,` to toggle`,n?` · n/N to navigate`:t?` · ${p.arrowUp}${p.arrowDown} scroll · home/end top/bottom`:r?``:` · ${o} to ${e?`collapse`:`show all`}`]}),i?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(U,{flexGrow:1}),(0,$.jsxs)(R,{children:[i,` `]})]}):n?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(U,{flexGrow:1}),(0,$.jsxs)(R,{dimColor:!0,children:[n.current,`/`,n.count,` `]})]}):null]})}function rz({jumpRef:e,count:t,current:n,onClose:r,onCancel:i,setHighlight:a,initialQuery:o}){let{query:s,cursorOffset:c}=ax({isActive:!0,initialQuery:o,onExit:()=>r(s),onCancel:i}),[l,u]=Q.useState(`building`);Q.useEffect(()=>{let t=!0,n,r=e.current?.warmSearchIndex;if(!r){u(null);return}return u(`building`),r().then(e=>{t&&(e<20?u(null):(u({ms:e}),n=setTimeout(()=>t&&u(null),2e3)))}),()=>{t=!1,n&&clearTimeout(n)}},[e]);let d=l!==`building`;(0,Q.useEffect)(()=>{d&&(e.current?.setSearchQuery(s),a(s))},[e,s,a,d]);let f=c,p=f<s.length?s[f]:` `;return(0,$.jsxs)(U,{borderTopDimColor:!0,borderBottom:!1,borderLeft:!1,borderRight:!1,borderStyle:`single`,marginTop:1,paddingLeft:2,width:`100%`,noSelect:!0,children:[(0,$.jsx)(R,{children:`/`}),(0,$.jsx)(R,{children:s.slice(0,f)}),(0,$.jsx)(R,{inverse:!0,children:p}),f<s.length&&(0,$.jsx)(R,{children:s.slice(f+1)}),(0,$.jsx)(U,{flexGrow:1}),l===`building`?(0,$.jsx)(R,{dimColor:!0,children:`indexing… `}):l?(0,$.jsxs)(R,{dimColor:!0,children:[`indexed in `,l.ms,`ms `]}):t===0&&s?(0,$.jsx)(R,{color:`error`,children:`no matches `}):t>0?(0,$.jsxs)(R,{dimColor:!0,children:[n,`/`,t,` `]}):null]})}var iz=[`⠂`,`⠐`],az=`✳`,oz=960;function sz({isAnimating:e,title:t,disabled:n,noPrefix:r}){let i=le(),[a,o]=(0,Q.useState)(0);(0,Q.useEffect)(()=>{if(n||r||!e||!i)return;let t=setInterval(e=>e(e=>(e+1)%iz.length),oz,o);return()=>clearInterval(t)},[n,r,e,i]);let s=e?iz[a]??az:az;return ve(n?null:r?t:`${s} ${t}`),null}var cz=`<${ei}>`;function lz(e){return e.type===`text`&&typeof e.text==`string`&&e.text.includes(cz)}function uz({commands:t,debug:n,initialTools:r,initialMessages:i,pendingHookMessages:a,initialFileHistorySnapshots:o,initialContentReplacements:s,initialAgentName:l,initialAgentColor:u,mcpClients:d,dynamicMcpConfig:f,autoConnectIdeFlag:p,strictMcpConfig:m=!1,systemPrompt:h,appendSystemPrompt:g,onBeforeQuery:_,onTurnComplete:v,disabled:y=!1,mainThreadAgentDefinition:b,disableSlashCommands:x=!1,taskListId:S,remoteSessionConfig:C,directConnectConfig:w,sshSession:E,thinkingConfig:D}){let O=!!C,j=(0,Q.useMemo)(()=>c(process.env.CLAUDE_CODE_DISABLE_TERMINAL_TITLE),[]),M=(0,Q.useMemo)(()=>process.env.USER_TYPE===`ant`&&c(process.env.CLAUDE_MORERIGHT),[]),N=(0,Q.useMemo)(()=>c(process.env.CLAUDE_CODE_DISABLE_VIRTUAL_SCROLL),[]);(0,Q.useMemo)(()=>c(process.env.CLAUDE_CODE_DISABLE_MESSAGE_ACTIONS),[]),(0,Q.useEffect)(()=>(K(`[REPL:mount] REPL mounted, disabled=${y}`),()=>K(`[REPL:unmount] REPL unmounting`)),[y]);let[P,ee]=(0,Q.useState)(b),F=X(e=>e.toolPermissionContext),te=X(e=>e.verbose),ne=X(e=>e.mcp),re=X(e=>e.plugins),L=X(e=>e.agentDefinitions),oe=X(e=>e.fileHistory),se=X(e=>e.initialMessage),ue=aD(),de=X(e=>e.spinnerTip),fe=X(e=>e.expandedView)===`tasks`,pe=X(e=>e.pendingWorkerRequest),me=X(e=>e.pendingSandboxRequest),z=X(e=>e.teamContext),B=X(e=>e.tasks),he=X(e=>e.workerSandboxPermissions),ge=X(e=>e.elicitation),_e=X(e=>e.ultraplanPendingChoice),ve=X(e=>e.ultraplanLaunchPending),ye=X(e=>e.viewingAgentTaskId),V=Hc(),be=ye?B[ye]:void 0,xe=oo(be)&&be.retain&&!be.diskLoaded;(0,Q.useEffect)(()=>{if(!ye||!xe)return;let e=ye;_f(gm(e)).then(t=>{V(n=>{let r=n.tasks[e];if(!oo(r)||r.diskLoaded||!r.retain)return n;let i=r.messages??[],a=new Set(i.map(e=>e.uuid)),o=t?t.messages.filter(e=>!a.has(e.uuid)):[];return{...n,tasks:{...n.tasks,[e]:{...r,messages:[...o,...i],diskLoaded:!0}}}})})},[ye,xe,V]);let H=gc(),we=A(),Te=kb(),[Ee,De]=(0,Q.useState)(t);gP(O?void 0:vt(),De);let ke=Q.useSyncExternalStore(VR?.subscribeToProactiveChanges??HR,VR?.isProactiveActive??UR),Ae=Q.useSyncExternalStore(VR?.subscribeToProactiveChanges??HR,VR?.getNextTickAt??WR),je=X(e=>e.isBriefOnly),Pe=(0,Q.useMemo)(()=>Hs(F),[F,ke,je]);wx();let[Ie,Le]=(0,Q.useState)(f),Re=(0,Q.useCallback)(e=>{Le(e)},[Le]),[ze,Ve]=(0,Q.useState)(`prompt`),[Ge,Ke]=(0,Q.useState)(!1),[Je,Ze]=(0,Q.useState)(!1),[Qe,$e]=(0,Q.useState)(``),it=(0,Q.useRef)(0),ot=(0,Q.useRef)(void 0),st=(0,Q.useRef)(!1),{addNotification:ut,removeNotification:dt}=Wp(),mt=GR,ht=mP(d,ne.clients),[gt,_t]=(0,Q.useState)(void 0),[yt,xt]=(0,Q.useState)(null),[Ct,Tt]=(0,Q.useState)(null),[Et,Dt]=(0,Q.useState)(!1),[Ot,kt]=(0,Q.useState)(()=>process.env.USER_TYPE===`ant`?ZR():!1),[jt,Mt]=(0,Q.useState)(()=>LP(Te)),Nt=X(e=>e.showRemoteCallout),[Pt,Ft]=(0,Q.useState)(()=>mS());jI(),PI(),kI({ideSelection:gt,mcpClients:ht,ideInstallationStatus:Ct}),VF({mcpClients:ht}),_I(),vI(),sx(),wI(Te),KI(),TI(Te),DI(),zR(),pF(),CF(),kF(),WF(),VI();let{recommendation:It,handleResponse:Lt}=oI(),{recommendation:Rt,handleResponse:zt}=lI(),Bt=gI(),Vt=(0,Q.useMemo)(()=>[...Pe,...r],[Pe,r]);jy({enabled:!O});let Ht=ou();(0,Q.useEffect)(()=>{O||xI(V)},[V,O]),jF(O?$R:ht,F.mode),VN(V,i,{enabled:!O});let Ut=xb(Vt,ne.tools,F),{tools:Wt,allowedAgentTypes:Gt}=(0,Q.useMemo)(()=>{if(!P)return{tools:Ut,allowedAgentTypes:void 0};let e=rm(P,Ut,!1,!0);return{tools:e.resolvedTools,allowedAgentTypes:e.allowedAgentTypes}},[P,Ut]),Kt=hP(hP(Ee,re.commands),ne.commands),qt=(0,Q.useMemo)(()=>x?[]:Kt,[x,Kt]);TC(O?$R:ne.clients),yP(O?$R:ne.clients,_t);let[Jt,Yt]=(0,Q.useState)(`responding`),Xt=(0,Q.useRef)(Jt);Xt.current=Jt;let[Zt,Qt]=(0,Q.useState)([]),[$t,tn]=(0,Q.useState)(null);(0,Q.useEffect)(()=>{if($t&&!$t.isStreaming&&$t.streamingEndedAt){let e=3e4-(Date.now()-$t.streamingEndedAt);if(e>0){let t=setTimeout(tn,e,null);return()=>clearTimeout(t)}else tn(null)}},[$t]);let[nn,an]=(0,Q.useState)(null),on=(0,Q.useRef)(null);on.current=nn;let sn=(0,Q.useRef)(()=>{}),cn=(0,Q.useRef)(()=>{}),ln=(0,Q.useRef)(null),un=(0,Q.useRef)(null),dn=(0,Q.useRef)(0),fn=Q.useRef(new rC).current,mn=Q.useSyncExternalStore(fn.subscribe,fn.getSnapshot),[hn,gn]=Q.useState(C?.hasInitialPrompt??!1),_n=mn||hn,[vn,yn]=Q.useState(void 0),bn=Q.useRef(0),xn=Q.useRef(!1),Sn=Q.useRef(0),Cn=Q.useRef(0),wn=Q.useRef(null),En=Q.useCallback(()=>{Sn.current=Date.now(),Cn.current=0,wn.current=null},[]),Dn=Q.useRef(!1);mn&&!Dn.current&&En(),Dn.current=mn;let On=Q.useCallback(e=>{gn(e),e&&En()},[En]),kn=Q.useRef(null),An=Q.useRef(void 0),jn=Q.useRef(void 0),[Mn,Nn]=Q.useState(!1),[Pn,Fn]=(0,Q.useState)(null);(0,Q.useEffect)(()=>{Pn?.notifications&&Pn.notifications.forEach(e=>{ut({key:`auto-updater-notification`,text:e,priority:`low`})})},[Pn,ut]),(0,Q.useEffect)(()=>{Sh()&&td().then(e=>{e&&ut({key:`tmux-mouse-hint`,text:e,priority:`low`})})},[]);let[In,Ln]=(0,Q.useState)(!1);(0,Q.useEffect)(()=>{process.env.USER_TYPE===`ant`&&(async()=>{let{isInternalModelRepo:e}=await import(`./commitAttribution-DSv9FggK.js`);await e();let{shouldShowUndercoverAutoNotice:t}=await import(`./undercover-CBeHiWUd.js`);t()&&Ln(!0)})()},[]);let[Rn,zn]=(0,Q.useState)(null),Bn=(0,Q.useRef)(null),Vn=(0,Q.useCallback)(e=>{if(e?.isLocalJSXCommand){let{clearLocalJSX:t,...n}=e;Bn.current={...n,isLocalJSXCommand:!0},zn(n);return}if(Bn.current){if(e?.clearLocalJSX){Bn.current=null,zn(null);return}return}if(e?.clearLocalJSX){zn(null);return}zn(e)},[]),[Hn,Wn]=(0,Q.useState)([]),[Gn,Kn]=(0,Q.useState)(null),[qn,Jn]=(0,Q.useState)([]),[Yn,Xn]=(0,Q.useState)([]),Zn=(0,Q.useRef)(new Map),Qn=X(e=>e.settings.terminalTitleFromRename)===!1?void 0:vp(Fe()),[$n,er]=(0,Q.useState)(),tr=(0,Q.useRef)((i?.length??0)>0),nr=P?.agentType,rr=Qn??nr??$n??`Claude Code`,ir=Hn.length>0||Yn.length>0||pe||me,ar=Rn?.isLocalJSXCommand===!0&&Rn?.jsx!=null,or=_n&&!ir&&!ar;(0,Q.useEffect)(()=>{if(_n&&!ir&&!ar)return XS(),()=>ZS()},[_n,ir,ar]);let sr=ir||ar?`waiting`:_n?`busy`:`idle`,cr=sr===`waiting`?Hn.length>0?`approve ${Hn[0].tool.name}`:pe?`worker request`:me?`sandbox request`:ar?`dialog open`:`input needed`:void 0;(0,Q.useEffect)(()=>{df({status:sr,waitingFor:cr})},[sr,cr]);let lr=Tn(`tengu_terminal_sidebar`,!1)&&(pn().showStatusInTerminalTab??!1);T(j||!lr?null:sr),(0,Q.useEffect)(()=>(us(Wn),()=>gl()),[Wn]);let[W,ur]=(0,Q.useState)(i??[]),dr=(0,Q.useRef)(W),fr=(0,Q.useRef)(!1),G=(0,Q.useCallback)(e=>{let t=dr.current,n=typeof e==`function`?e(dr.current):e;if(dr.current=n,n.length<bn.current)bn.current=0;else if(n.length>t.length&&xn.current){let e=n.length-t.length;(t.length===0||n[0]===t[0]?n.slice(-e):n.slice(0,e)).some(oc)?xn.current=!1:bn.current=n.length}ur(n)},[]),pr=(0,Q.useCallback)(e=>{e===void 0?xn.current=!1:(bn.current=dr.current.length,xn.current=!0),yn(e)},[]),{dividerIndex:mr,dividerYRef:hr,onScrollAway:gr,onRepin:_r,jumpToNew:vr,shiftDivider:xr}=vx(W.length);xF(W,G,_n);let[Sr,Cr]=(0,Q.useState)(null),wr=(0,Q.useRef)(null),Tr=(0,Q.useMemo)(()=>hx(W,mr),[mr,W.length]),Er=(0,Q.useCallback)(()=>{ln.current?.scrollToBottom(),_r(),Cr(null)},[_r,Cr]),Dr=W.at(-1),Or=Dr!=null&&oc(Dr);(0,Q.useEffect)(()=>{Or&&Er()},[Or,Dr,Er]);let{maybeLoadOlder:q}=hN({config:C,setMessages:G,scrollRef:ln,onPrepend:xr}),kr=(0,Q.useCallback)((e,t)=>{dn.current=Date.now(),e?_r():(gr(t),q(t),V(e=>e.companionReaction===void 0?e:{...e,companionReaction:void 0}))},[_r,gr,q,V]),Ar=jN(a,G),J=(0,Q.useDeferredValue)(Q.useMemo(()=>W.length>500?W.slice(-500):W,[W])),jr=W.length-J.length;jr>0&&K(`[useDeferredValue] Messages deferred by ${jr} (${J.length}→${W.length})`);let[Nr,Pr]=(0,Q.useState)(null),[Fr,Ir]=(0,Q.useState)(()=>oS()),Lr=(0,Q.useRef)(Fr);Lr.current=Fr;let Rr=(0,Q.useRef)(null),zr=(0,Q.useCallback)(e=>{mt(Lr.current,e)||(Lr.current===``&&e!==``&&Date.now()-dn.current>=ez&&Er(),Lr.current=e,Ir(e),Nn(e.trim().length>0))},[Nn,Er,mt]);(0,Q.useEffect)(()=>{if(Fr.trim().length===0)return;let e=setTimeout(Nn,1500,!1);return()=>clearTimeout(e)},[Fr]);let[Br,Vr]=(0,Q.useState)(`prompt`),[Hr,Ur]=(0,Q.useState)(),Wr=(0,Q.useCallback)(e=>{let t=new Set(e);De(e=>e.filter(e=>t.has(e.name)||ms.has(e)))},[De]),[Gr,Kr]=(0,Q.useState)(new Set),qr=(0,Q.useRef)(!1),Jr=eN({config:C,setMessages:G,setIsLoading:On,onInit:Wr,setToolUseConfirmQueue:Wn,tools:Vt,setStreamingToolUses:Qt,setStreamMode:Yt,setInProgressToolUseIDs:Kr}),Yr=rN({config:w,setMessages:G,setIsLoading:On,setToolUseConfirmQueue:Wn,tools:Vt}),Xr=iN({session:E,setMessages:G,setIsLoading:On,setToolUseConfirmQueue:Wn,tools:Vt}),Zr=Xr.isRemoteMode?Xr:Yr.isRemoteMode?Yr:Jr,[Qr,ei]=(0,Q.useState)({}),[ti,ni]=(0,Q.useState)(0),ri=(0,Q.useRef)(0),ii=(0,Q.useRef)([]),oi=(0,Q.useCallback)(e=>{let t=ri.current;if(ri.current=e(t),ri.current>t){let e=ii.current;if(e.length>0){let t=e.at(-1);t.lastTokenTime=Date.now(),t.endResponseLength=ri.current}}},[]),[si,ci]=(0,Q.useState)(null),li=!(X(e=>e.settings.prefersReducedMotion)??!1)&&!Se(),ui=(0,Q.useCallback)(e=>{li&&ci(e)},[li]),di=si&&li&&si.substring(0,si.lastIndexOf(`
93
- `)+1)||null,[fi,pi]=(0,Q.useState)(0),[mi,hi]=(0,Q.useState)(null),[gi,_i]=(0,Q.useState)(null),[vi,yi]=(0,Q.useState)(null),[Si,Ci]=(0,Q.useState)(!1),[wi,Ei]=(0,Q.useState)(void 0),[Di,Oi]=(0,Q.useState)(!1),[ki,Ai]=(0,Q.useState)(jS()),[ji,Mi]=(0,Q.useState)(null),Ni=(0,Q.useRef)(!1),Pi=(0,Q.useRef)(fi);Pi.current=fi;let[Li]=(0,Q.useState)(()=>({current:mm(i,s)}));rp(()=>{Li.current=sf()});let[Ri,zi]=(0,Q.useState)(pn().hasAcknowledgedCostThreshold),[Bi,Vi]=(0,Q.useState)(`INSERT`),[Hi,Ui]=(0,Q.useState)(!1),[Wi,Gi]=(0,Q.useState)(!1),[Ki,qi]=(0,Q.useState)(!1);(0,Q.useEffect)(()=>{_e&&Hi&&Ui(!1)},[_e,Hi]);let Ji=le(),Xi=(0,Q.useRef)(Ji);Xi.current=Ji;let[Zi]=ae(),Qi=Q.useRef(!1),$i=(0,Q.useCallback)(()=>{if(Qi.current)return;Qi.current=!0;let e=dr.current.slice(Ta.current);for(let t of Ag(e))wa.current.add(t);Ta.current=dr.current.length,PF({theme:Zi,readFileState:Ca.current,bashTools:wa.current}).then(async e=>{if(e){let t=await e.content({theme:Zi});V(e=>({...e,spinnerTip:t})),FF(e)}else V(e=>e.spinnerTip===void 0?e:{...e,spinnerTip:void 0})})},[V,Zi]),ea=(0,Q.useCallback)(()=>{On(!1),pr(void 0),ri.current=0,ii.current=[],ci(null),Qt([]),hi(null),_i(null),yi(null),$i(),mv(),yg()},[$i]),ta=(0,Q.useMemo)(()=>Gl(B).some(e=>e.status===`running`),[B]);(0,Q.useEffect)(()=>{if(!ta&&kn.current!==null){let e=Date.now()-kn.current,t=An.current;kn.current=null,An.current=void 0,G(n=>[...n,wg(e,t,xi(n,Ao))])}},[ta,G]);let na=(0,Q.useRef)(!1);(0,Q.useEffect)(()=>{{if(F.mode!==`auto`){na.current=!1;return}if(na.current||(pn().autoPermissionsNotificationCount??0)>=3)return;let e=setTimeout((e,t)=>{e.current=!0,rn(e=>{let t=e.autoPermissionsNotificationCount??0;return t>=3?e:{...e,autoPermissionsNotificationCount:t+1}}),t(e=>[...e,Sd(HF,`warning`)])},800,na,G);return()=>clearTimeout(e)}},[F.mode,G]);let ia=(0,Q.useRef)(!1);(0,Q.useEffect)(()=>{if(ia.current)return;let e=Jg();if(!e?.creationDurationMs||e.usedSparsePaths||e.creationDurationMs<15e3)return;ia.current=!0;let t=Math.round(e.creationDurationMs/1e3);G(e=>[...e,Sd(`Worktree creation took ${t}s. For large repos, set \`worktree.sparsePaths\` in .claude/settings.json to check out only the directories you need — e.g. \`{"worktree": {"sparsePaths": ["src", "packages/foo"]}}\`.`,`info`)])},[G]);let aa=(0,Q.useMemo)(()=>{let e=W.findLast(e=>e.type===`assistant`);if(e?.type!==`assistant`)return!1;let t=e.message?.content,n=(Array.isArray(t)?t:[]).filter(e=>e.type===`tool_use`&&Gr.has(e.id));return n.length>0&&n.every(e=>e.type===`tool_use`&&e.name===`Sleep`)},[W,Gr]),{onBeforeQuery:sa,onTurnComplete:la,render:ua}=ON({enabled:M,setMessages:G,inputValue:Fr,setInputValue:zr,setToolJSX:Vn}),da=(!Rn||Rn.showSpinner===!0)&&Hn.length===0&&Yn.length===0&&(_n||vn||ta||lf()>0)&&!pe&&!aa&&(!di||je),fa=Hn.length>0||Yn.length>0||qn.length>0||ge.queue.length>0||he.queue.length>0,pa=GP(W,_n,ti,`session`,fa),ma=DN(G),ha=oL(W,ti),ga=(0,Q.useMemo)(()=>({...pa,handleSelect:e=>{Na.current=!1;let t=pa.handleSelect(e);e===`bad`&&!t&&YI(`feedback_survey_bad`)&&(Ma(`feedback_survey_bad`),Na.current=!0)}}),[pa]),va=iF(W,_n,fa,{enabled:!O}),ya=$P(W,_n,fa,{enabled:!O}),ba=RR(W,_n,fa,ga.state!==`closed`||va.state!==`closed`||ya.state!==`closed`);AP({autoConnectIdeFlag:p,ideToInstallExtension:yt,setDynamicMcpConfig:Le,setShowIdeOnboarding:Dt,setIDEInstallationState:Tt}),IF(o,oe,e=>V(t=>({...t,fileHistory:e})));let xa=(0,Q.useCallback)(async(t,n,r)=>{let i=performance.now();try{let a=Cd(n.messages);{let t=(Gd(),e(Lh)).matchSessionMode(n.mode);if(t){let{getAgentDefinitionsWithOverrides:n,getActiveAgentsFromList:r}=(zm(),e(cg));n.cache.clear?.();let i=await n(ft());V(e=>({...e,agentDefinitions:{...i,allAgents:i.allAgents,activeAgents:r(i.allAgents)}})),a.push(Sd(t,`warning`))}}let o=_g();await Zu(`resume`,{getAppState:()=>H.getState(),setAppState:V,signal:AbortSignal.timeout(o),timeoutMs:o});let s=await Ja(`resume`,{sessionId:t,agentType:P?.agentType,model:Te});a.push(...s),r===`fork`?vs(n,lp(t)):tc(n,lp(t)),lb(n,V),n.fileHistorySnapshots&&xh(n);let{agentDefinition:c}=sb(n.agentSetting,b,L);ee(c),V(e=>({...e,agent:c?.agentType})),V(e=>({...e,standaloneAgentContext:cb(n.agentName,n.agentColor)})),oh(n.agentName),Oa(a,n.projectPath??ft()),ea(),an(null),Ai(t);let l=ip(t);n_(),St(),lt(lp(t),n.fullPath?SS(n.fullPath):null);let{renameRecordingForSession:u}=await import(`./asciicast-aoKFhc7C.js`);if(await u(),await pf(),Im(),Wf(n),tr.current=!0,er(void 0),r!==`fork`)ub(),db(n.worktreeSession),Yu(),Ff({abortController:new AbortController,getAppState:()=>H.getState(),setAppState:V});else{let e=Jg();e&&Kg(e)}{let{saveMode:t}=(_a(),e(Pg)),{isCoordinatorMode:n}=(Gd(),e(Lh));t(n()?`coordinator`:`normal`)}l&&ct(l),Li.current&&r!==`fork`&&(Li.current=sp(a,n.contentReplacements??[])),G(()=>a),Vn(null),zr(``),Y(`tengu_session_resumed`,{entrypoint:r,success:!0,resume_duration_ms:Math.round(performance.now()-i)})}catch(e){throw Y(`tengu_session_resumed`,{entrypoint:r,success:!1}),e}},[ea,V]),[Sa]=(0,Q.useState)(()=>Z_(100)),Ca=(0,Q.useRef)(Sa),wa=(0,Q.useRef)(new Set),Ta=(0,Q.useRef)(0),Ea=(0,Q.useRef)(new Set),Da=(0,Q.useRef)(new Set),Oa=(0,Q.useCallback)((e,t)=>{let n=Rl(e,t,100);Ca.current=$_(Ca.current,n);for(let t of Ag(e))wa.current.add(t)},[]);(0,Q.useEffect)(()=>{i&&i.length>0&&(Oa(i,ft()),Ff({abortController:new AbortController,getAppState:()=>H.getState(),setAppState:V}))},[]);let{status:ka,reverify:Aa}=MN(),[ja,Ma]=(0,Q.useState)(null),Na=(0,Q.useRef)(!1),[Fa,Ia]=(0,Q.useState)(null),[La,Ra]=(0,Q.useState)(!1),za=!_n&&Di;function Va(){if(La||Fa)return;if(Si)return`message-selector`;if(Mn)return;if(qn[0])return`sandbox-permission`;let e=!Rn||Rn.shouldContinueAnimation;if(e&&Hn[0])return`tool-permission`;if(e&&Yn[0])return`prompt`;if(e&&he.queue[0])return`worker-sandbox-permission`;if(e&&ge.queue[0])return`elicitation`;if(e&&za)return`cost`;if(e&&ji)return`idle-return`;if(e&&!_n&&_e)return`ultraplan-choice`;if(e&&!_n&&ve)return`ultraplan-launch`;if(e&&Et)return`ide-onboarding`;if(process.env.USER_TYPE===`ant`&&e&&Ot)return`model-switch`;if(process.env.USER_TYPE===`ant`&&e&&In)return`undercover-callout`;if(e&&jt)return`effort-callout`;if(e&&Nt)return`remote-callout`;if(e&&It)return`lsp-recommendation`;if(e&&Rt)return`plugin-hint`;if(e&&Bt.visible)return`search-extra-tools-hint`;if(e&&Pt)return`desktop-upsell`}let Ha=Va(),Ua=Mn&&(qn[0]||Hn[0]||Yn[0]||he.queue[0]||ge.queue[0]||za);jn.current=Ha,(0,Q.useEffect)(()=>{if(!_n)return;let e=Ha===`tool-permission`,t=Date.now();e&&wn.current===null?wn.current=t:!e&&wn.current!==null&&(Cn.current+=t-wn.current,wn.current=null)},[Ha,_n]);let Wa=(0,Q.useRef)(Ha);(0,Q.useLayoutEffect)(()=>{Wa.current===`tool-permission`!=(Ha===`tool-permission`)&&Er(),Wa.current=Ha},[Ha,Er]);function Ga(){if(Ha!==`elicitation`){if(K(`[onCancel] focusedInputDialog=${Ha} streamMode=${Jt}`),VR?.pauseProactive(),fn.forceEnd(),Ni.current=!1,si?.trim()&&G(e=>[...e,dm({content:si})]),ea(),Ne(null),Ha===`tool-permission`)Hn[0]?.onAbort(),Wn([]);else if(Ha===`prompt`){for(let e of Yn)e.reject(Error(`Prompt cancelled by user`));Xn([]),nn?.abort(`user-cancel`)}else Zr.isRemoteMode?Zr.cancelRequest():nn?.abort(`user-cancel`);an(null),la(dr.current,!0)}}let Ka=(0,Q.useCallback)(()=>{let e=e_(Fr,0);e&&(zr(e.text),Vr(`prompt`),e.images.length>0&&ei(t=>{let n={...t};for(let t of e.images)n[t.id]=t;return n}))},[zr,Vr,Fr,ei]),qa={setToolUseConfirmQueue:Wn,onCancel:Ga,onAgentsKilled:()=>G(e=>[...e,Xm()]),isMessageSelectorVisible:Si||!!Hi,screen:ze,abortSignal:nn?.signal,popCommandFromQueue:Ka,vimMode:Bi,isLocalJSXCommand:Rn?.isLocalJSXCommand,isSearchingHistory:Wi,isHelpOpen:Ki,inputMode:Br,inputValue:Fr,streamMode:Jt};(0,Q.useEffect)(()=>{Ue()>=5&&!Di&&!Ri&&(Y(`tengu_cost_threshold_reached`,{}),zi(!0),en()&&Oi(!0))},[W,Di,Ri]);let Ya=(0,Q.useCallback)(async e=>{if(Un()&&Fu()){let t=Es(),n=await Yi(e.host,t);return new Promise(r=>{if(!n){Jn(t=>[...t,{hostPattern:e,resolvePromise:r}]);return}Ls({requestId:t,host:e.host,resolve:r}),V(n=>({...n,pendingSandboxRequest:{requestId:t,host:e.host}}))})}return new Promise(t=>{let n=!1;function r(e){n||(n=!0,t(e))}Jn(t=>[...t,{hostPattern:e,resolvePromise:r}]);{let t=H.getState().replBridgePermissionCallbacks;if(t){let n=jS();t.sendRequest(n,Jy,{host:e.host},jS(),`Allow network connection to ${e.host}?`);let r=t.onResponse(n,t=>{r();let n=t.behavior===`allow`;Jn(t=>(t.filter(t=>t.hostPattern.host===e.host).forEach(e=>e.resolvePromise(n)),t.filter(t=>t.hostPattern.host!==e.host)));let i=Zn.current.get(e.host);if(i){for(let e of i)e();Zn.current.delete(e.host)}}),i=()=>{r(),t.cancelRequest(n)},a=Zn.current.get(e.host)??[];a.push(i),Zn.current.set(e.host,a)}}})},[V,H]);(0,Q.useEffect)(()=>{let e=qh.getSandboxUnavailableReason();if(e){if(qh.isSandboxRequired()){process.stderr.write(`\nError: sandbox required but unavailable: ${e}\n sandbox.failIfUnavailable is set — refusing to start without a working sandbox.\n\n`),Is(1,`other`);return}K(`sandbox disabled: ${e}`,{level:`warn`}),ut({key:`sandbox-unavailable`,jsx:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(R,{color:`warning`,children:`sandbox disabled`}),(0,$.jsx)(R,{dimColor:!0,children:` · /sandbox`})]}),priority:`medium`})}},[ut]),qh.isSandboxingEnabled()&&qh.initialize(Ya).catch(e=>{process.stderr.write(`\n❌ Sandbox Error: ${br(e)}\n`),Is(1,`other`)});let Xa=(0,Q.useCallback)((e,t)=>{V(n=>({...n,toolPermissionContext:{...e,mode:t?.preserveMode?n.toolPermissionContext.mode:e.mode}})),setImmediate(e=>{e(e=>(e.forEach(e=>{e.recheckPermission()}),e))},Wn)},[V,Wn]);(0,Q.useEffect)(()=>(wo(Xa),()=>Ks()),[Xa]);let Za=aP(Wn,Xa),Qa=(0,Q.useCallback)((e,t,r,i)=>{let a=H.getState(),o=()=>{let e=H.getState(),t=Yy(Vt,nu(e.toolPermissionContext,e.mcp.tools),e.toolPermissionContext.mode);return P?rm(P,t,!1,!0).resolvedTools:t};return{abortController:r,options:{commands:qt,tools:o(),debug:n,verbose:a.verbose,mainLoopModel:i,thinkingConfig:a.thinkingEnabled===!1?{type:`disabled`}:D,mcpClients:pP(d,a.mcp.clients),mcpResources:a.mcp.resources,ideInstallationStatus:Ct,isNonInteractiveSession:!1,dynamicMcpConfig:Ie,theme:Zi,agentDefinitions:Gt?{...a.agentDefinitions,allowedAgentTypes:Gt}:a.agentDefinitions,customSystemPrompt:h,appendSystemPrompt:g,refreshTools:o},getAppState:()=>H.getState(),setAppState:V,messages:e,setMessages:G,updateFileHistoryState(e){V(t=>{let n=e(t.fileHistory);return n===t.fileHistory?t:{...t,fileHistory:n}})},updateAttributionState(e){V(t=>{let n=e(t.attribution);return n===t.attribution?t:{...t,attribution:n}})},openMessageSelector:()=>{y||Ci(!0)},onChangeAPIKey:Aa,readFileState:Ca.current,setToolJSX:Vn,addNotification:ut,appendSystemMessage:e=>G(t=>[...t,e]),sendOSNotification:e=>{ah(e,we)},onChangeDynamicMcpConfig:Re,onInstallIDEExtension:xt,nestedMemoryAttachmentTriggers:new Set,loadedNestedMemoryPaths:Da.current,dynamicSkillDirTriggers:new Set,discoveredSkillNames:Ea.current,setResponseLength:oi,pushApiMetricsEntry:process.env.USER_TYPE===`ant`?e=>{let t=Date.now(),n=ri.current;ii.current.push({ttftMs:e,firstTokenTime:t,lastTokenTime:t,responseLengthBaseline:n,endResponseLength:n})}:void 0,setStreamMode:Yt,onCompactProgress:e=>{switch(e.type){case`hooks_start`:_i(`claudeBlue_FOR_SYSTEM_SPINNER`),yi(`claudeBlueShimmer_FOR_SYSTEM_SPINNER`),hi(e.hookType===`pre_compact`?`Running PreCompact hooks…`:e.hookType===`post_compact`?`Running PostCompact hooks…`:`Running SessionStart hooks…`);break;case`compact_start`:hi(`Compacting conversation`);break;case`compact_end`:hi(null),_i(null),yi(null);break}},setInProgressToolUseIDs:Kr,setHasInterruptibleToolInProgress:e=>{qr.current=e},resume:xa,setConversationId:Ai,requestPrompt:void 0,contentReplacementState:Li.current}},[qt,Vt,P,n,d,Ct,Ie,Zi,Gt,H,V,Aa,ut,G,Re,xa,(0,Q.useCallback)((e,t)=>n=>new Promise((r,i)=>{Xn(a=>[...a,{request:n,title:e,toolInputSummary:t,resolve:r,reject:i}])}),[]),y,h,g,Ai]),{handleBackgroundSession:$a}=MP({setMessages:G,setIsLoading:On,resetLoadingState:ea,setAbortController:an,onBackgroundQuery:(0,Q.useCallback)(()=>{nn?.abort(`background`);let e=Bd(e=>e.mode===`task-notification`);(async()=>{let t=Qa(dr.current,[],new AbortController,Te),[n,r,i]=await Promise.all([vf(t.options.tools,Te,Array.from(F.additionalWorkingDirectories.keys()),t.options.mcpClients),Gf(),mf()]),a=Df({mainThreadAgentDefinition:P,toolUseContext:t,customSystemPrompt:h,defaultSystemPrompt:n,appendSystemPrompt:g});t.renderedSystemPrompt=a;let o=(await jc(e).catch(()=>[])).map(po),s=new Set;for(let e of dr.current)e.type===`attachment`&&e.attachment.type===`queued_command`&&e.attachment.commandMode===`task-notification`&&typeof e.attachment.prompt==`string`&&s.add(e.attachment.prompt);let c=o.filter(e=>e.attachment.type===`queued_command`&&(typeof e.attachment.prompt!=`string`||!s.has(e.attachment.prompt)));Dh({messages:[...dr.current,...c],queryParams:{systemPrompt:a,userContext:r,systemContext:i,canUseTool:Za,toolUseContext:t,querySource:zf()},description:rr,setAppState:V,agentDefinition:P})})()},[nn,Te,F,P,Qa,h,g,Za,V])}),eo=(0,Q.useCallback)(e=>{Jc(e,e=>{Cl(e)?(Sh()?G(t=>{let n=Fc(t,{includeSnipped:!0});return[...n.length>500?n.slice(-500):n,e]}):G(()=>[e]),Ai(jS()),VR?.setContextBlocked(!1)):e.type===`progress`&&Tc(e.data?.type)?G(t=>{let n=e.data;for(let r=t.length-1;r>=0;r--){let i=t[r];if(i.type!==`progress`)break;let a=i.data;if(i.parentToolUseID===e.parentToolUseID&&a?.type===n.type){let n=t.slice();return n[r]=e,n}}return[...t,e]}):G(t=>[...t,e]),e.type===`assistant`&&`isApiErrorMessage`in e&&e.isApiErrorMessage?VR?.setContextBlocked(!0):e.type===`assistant`&&VR?.setContextBlocked(!1)},e=>{oi(t=>t+e.length)},Yt,Qt,e=>{G(t=>t.filter(t=>t!==e)),$d(e.uuid)},tn,e=>{let t=Date.now(),n=ri.current;ii.current.push({...e,firstTokenTime:t,lastTokenTime:t,responseLengthBaseline:n,endResponseLength:n})},ui)},[G,oi,Yt,Qt,tn,ui]),to=(0,Q.useCallback)(async(e,t,n,r,i,a,o)=>{if(r){let e=pP(d,H.getState().mcp.clients);Ys.handleQueryStart(e);let t=hh(e);t&&Jl(t)}if(Qv(),!j&&!Qn&&!nr&&!tr.current){let e=t.find(e=>e.type===`user`&&!e.isMeta),n=e?.type===`user`?go(e.message.content):null;n&&!n.startsWith(`<local-command-stdout>`)&&!n.startsWith(`<command-message>`)&&!n.startsWith(`<command-name>`)&&!n.startsWith(`<bash-input>`)&&(tr.current=!0,wy(n,new AbortController().signal).then(e=>{e?er(e):tr.current=!1},()=>{tr.current=!1}))}if(H.setState(e=>{let t=e.toolPermissionContext.alwaysAllowRules.command;return t===i||t?.length===i.length&&t.every((e,t)=>e===i[t])?e:{...e,toolPermissionContext:{...e.toolPermissionContext,alwaysAllowRules:{...e.toolPermissionContext.alwaysAllowRules,command:i}}}}),!r){t.some(Cl)&&(Ai(jS()),VR?.setContextBlocked(!1)),ea(),an(null);return}let s=Qa(e,t,n,a),{tools:c,mcpClients:l}=s.options;if(o!==void 0){let e=s.getAppState;s.getAppState=()=>({...e(),effortValue:o})}Op(`query_context_loading_start`);let[,,u,f,p]=await Promise.all([void 0,Ex(F,V,H.getState().fastMode),vf(c,a,Array.from(F.additionalWorkingDirectories.keys()),l),Gf(),mf()]),m={...f,...BR(l,p_()?ko():void 0),...VR?.isProactiveActive()&&!Xi.current?{terminalFocus:`The terminal is unfocused — the user is not actively watching.`}:{}};Op(`query_context_loading_end`);let _=Df({mainThreadAgentDefinition:P,toolUseContext:s,customSystemPrompt:h,defaultSystemPrompt:u,appendSystemPrompt:g});s.renderedSystemPrompt=_,Op(`query_query_start`),bt(),Xe(),at();for await(let t of hs({messages:e,systemPrompt:_,userContext:m,systemContext:p,canUseTool:Za,toolUseContext:s,querySource:zf()}))eo(t);if(typeof globalThis.fireCompanionObserver==`function`){let e=globalThis.fireCompanionObserver;e(dr.current,e=>V(t=>t.companionReaction===e?t:{...t,companionReaction:e}))}if(Op(`query_end`),process.env.USER_TYPE===`ant`&&ii.current.length>0){let e=ii.current,t=e.map(e=>e.ttftMs),n=e.map(e=>{let t=Math.round((e.endResponseLength-e.responseLengthBaseline)/4),n=e.lastTokenTime-e.firstTokenTime;return n>0?Math.round(t/(n/1e3)):0}),r=e.length>1,i=nt(),a=Be(),o=qe(),s=rt(),c=pt(),l=He(),u=Date.now()-Sn.current;G(e=>[...e,Gh({ttftMs:r?tz(t):t[0],otps:r?tz(n):n[0],isP50:r,hookDurationMs:i>0?i:void 0,hookCount:a>0?a:void 0,turnDurationMs:u>0?u:void 0,toolDurationMs:o>0?o:void 0,toolCount:s>0?s:void 0,classifierDurationMs:c>0?c:void 0,classifierCount:l>0?l:void 0,configWriteCount:At()})])}ea(),Mh(),await v?.(dr.current)},[d,ea,Qa,F,V,h,v,g,Za,P,eo,Qn,j]),no=(0,Q.useCallback)(async(e,t,n,r,i,a,o,s)=>{if(Un()){let e=bi(),t=Ti();e&&t&&Rv(e,t,!0)}let c=fn.tryStart();if(c===null)return Y(`tengu_concurrent_onquery_detected`,{}),e.filter(e=>e.type===`user`&&!e.isMeta).map(e=>go(e.message.content)).filter(e=>e!==null).forEach((e,t)=>{Kd({value:e,mode:`prompt`}),t===0&&Y(`tengu_concurrent_onquery_enqueued`,{})}),!1;try{jo.current=!1,En(),G(t=>[...t,...e]),ri.current=0,Ne((o?$l(o):null)??Me()),ii.current=[],Qt([]),ci(null);let c=dr.current;if(o&&await sa(o,c,e.length),a&&o&&!await a(o,c))return!0;try{await to(c,e,t,n,r,i,s)}catch(e){throw e}}finally{if(fn.end(c)){pi(Date.now()),Ni.current=!1,ea(),await la(dr.current,t.signal.aborted),sn.current(),process.env.USER_TYPE===`ant`&&!t.signal.aborted&&V(e=>e.tungstenActiveSession===void 0||e.tungstenPanelAutoHidden===!0?e:{...e,tungstenPanelAutoHidden:!0});let e;Me()!==null&&Me()>0&&!t.signal.aborted&&(e={tokens:tt(),limit:Me(),nudges:Ye()}),Ne(null);let n=Date.now()-Sn.current-Cn.current;(n>3e4||e!==void 0)&&!t.signal.aborted&&!ke&&(Gl(H.getState().tasks).some(e=>e.status===`running`)?(kn.current===null&&(kn.current=Sn.current),e&&(An.current=e)):G(t=>[...t,wg(n,e,xi(t,Ao))])),an(null)}if(t.signal.reason===`user-cancel`&&!fn.isActive&&Lr.current===``&&lf()===0&&!H.getState().viewingAgentTaskId){let e=dr.current,t=e.findLast(Zy);t&&$y(e,e.lastIndexOf(t))&&(_d(),cn.current(t))}}return!0},[to,V,ea,fn,sa,la]),ro=(0,Q.useRef)(!1);(0,Q.useEffect)(()=>{let e=se;if(!e||_n||ro.current)return;ro.current=!0;async function t(e){if(e.clearContext){let t=e.message.planContent?Pa():void 0,{clearConversation:n}=await import(`./conversation-BP0phkOY.js`);await n({setMessages:G,readFileState:Ca.current,discoveredSkillNames:Ea.current,loadedNestedMemoryPaths:Da.current,getAppState:()=>H.getState(),setAppState:V,setConversationId:Ai}),tr.current=!1,er(void 0),wa.current.clear(),Ta.current=0,t&&ru(Fe(),t)}V(t=>{let n=e.mode?Jh(t.toolPermissionContext,RT(e.mode,e.allowedPrompts)):t.toolPermissionContext;return e.mode===`auto`&&(n=Bc({...n,mode:`auto`,prePlanMode:void 0})),{...t,initialMessage:null,toolPermissionContext:n}}),$u()&&ll(e=>{V(t=>({...t,fileHistory:e(t.fileHistory)}))},e.message.uuid),await Ar();let t=e.message.message.content;if(typeof t==`string`&&!e.message.planContent)io(t,{setCursorOffset:()=>{},clearBuffer:()=>{},resetHistory:()=>{}});else{let t=kl();an(t),no([e.message],t,!0,[],Te)}setTimeout(e=>{e.current=!1},100,ro)}t(e)},[se,_n,G,V,no,Te,Wt]);let io=(0,Q.useCallback)(async(e,t,n,r)=>{if(Er(),VR?.resumeProactive(),No(e)){let n=Ud({content:e});G(e=>[...e,n]),r?.fromKeybinding||qd({display:Ba(e,Br),pastedContents:Qr}),zr(``),t.setCursorOffset(0),t.clearBuffer(),ei({}),Vr(`prompt`),_t(void 0);return}if(!n&&e.trim().startsWith(`/`)){let n=nm(e,Qr).trim(),i=n.indexOf(` `),a=i===-1?n.slice(1):n.slice(1,i),o=i===-1?``:n.slice(i+1).trim(),s=qt.find(e=>pg(e)&&(e.name===a||e.aliases?.includes(a)||im(e)===a));s?.name===`clear`&&fr.current&&(Y(`tengu_idle_return_action`,{action:`hint_converted`,variant:fr.current,idleMinutes:Math.round((Date.now()-Pi.current)/6e4),messageCount:dr.current.length,totalInputTokens:wt()}),fr.current=!1);let c=fn.isActive&&(s?.immediate||r?.fromKeybinding);if(s&&c&&s.type===`local-jsx`){e.trim()===Lr.current.trim()&&(zr(``),t.setCursorOffset(0),t.clearBuffer(),ei({}));let n=ep(e).filter(e=>Qr[e.id]?.type===`text`),i=n.length;Y(`tengu_paste_text`,{pastedTextCount:i,pastedTextBytes:n.reduce((e,t)=>e+(Qr[t.id]?.content.length??0),0)}),Y(`tengu_immediate_command_executed`,{commandName:s.name,fromKeybinding:r?.fromKeybinding??!1}),(async()=>{let e=!1,n=(n,r)=>{e=!0,Vn({jsx:null,shouldHidePromptInput:!1,clearLocalJSX:!0});let i=[];n&&r?.display!==`skip`&&(ut({key:`immediate-${s.name}`,text:n,priority:`immediate`}),Sh()||i.push(qf(Fg(im(s),o)),qf(`<${$r}>${q_(n)}</${$r}>`))),r?.metaMessages?.length&&i.push(...r.metaMessages.map(e=>Ud({content:e,isMeta:!0}))),i.length&&G(e=>[...e,...i]),Hr!==void 0&&(zr(Hr.text),t.setCursorOffset(Hr.cursorOffset),ei(Hr.pastedContents),Ur(void 0))},r=Qa(dr.current,[],kl(),Te),i=await(await s.load()).call(n,r,o);i&&!e&&Vn({jsx:i,shouldHidePromptInput:!1,isLocalJSXCommand:!0})})();return}}if(Zr.isRemoteMode&&!e.trim())return;{let r=Tn(`tengu_willow_mode`,`off`),i=Number(process.env.CLAUDE_CODE_IDLE_THRESHOLD_MINUTES??75),a=Number(process.env.CLAUDE_CODE_IDLE_TOKEN_THRESHOLD??1e5);if(r!==`off`&&!pn().idleReturnDismissed&&!Ni.current&&!n&&!e.trim().startsWith(`/`)&&Pi.current>0&&wt()>=a){let n=(Date.now()-Pi.current)/6e4;if(n>=i&&r===`dialog`){Mi({input:e,idleMinutes:n}),zr(``),t.setCursorOffset(0),t.clearBuffer();return}}}r?.fromKeybinding||(qd({display:n?e:Ba(e,Br),pastedContents:n?{}:Qr}),Br===`bash`&&VO(e.trim()));let i=!n&&e.trim().startsWith(`/`),a=!_n||n||Zr.isRemoteMode;if(Hr!==void 0&&!i&&a?(zr(Hr.text),t.setCursorOffset(Hr.cursorOffset),ei(Hr.pastedContents),Ur(void 0)):a&&(r?.fromKeybinding||(zr(``),t.setCursorOffset(0)),ei({})),a&&(Vr(`prompt`),_t(void 0),ni(e=>e+1),t.clearBuffer(),Qi.current=!1,!i&&Br===`prompt`&&!n&&!Zr.isRemoteMode&&(pr(e),En()),V(e=>({...e,attribution:yv(e.attribution,e=>{ra(e).catch(e=>{K(`Attribution: Failed to save snapshot: ${e}`)})})}))),n){let{queryRequired:t}=await Al(n.state,n.speculationSessionTimeSavedMs,n.setAppState,e,{setMessages:G,readFileState:Ca,cwd:ft()});if(t){let e=kl();an(e),no([],e,!0,[],Te)}return}if(Zr.isRemoteMode&&!(i&&qt.find(t=>{let n=e.trim().slice(1).split(/\s/)[0];return pg(t)&&(t.name===n||t.aliases?.includes(n)||im(t)===n)})?.type===`local-jsx`)){let t=Object.values(Qr),n=t.filter(e=>e.type===`image`),r=n.length>0?n.map(e=>e.id):void 0,i=e.trim(),a=e.trim();if(t.length>0){let n=[],r=[],o=e.trim();o&&(n.push({type:`text`,text:o}),r.push({type:`text`,text:o}));for(let e of t)if(e.type===`image`){let t={type:`base64`,media_type:e.mediaType??`image/png`,data:e.content};n.push({type:`image`,source:t}),r.push({type:`image`,source:t})}else n.push({type:`text`,text:e.content}),r.push({type:`text`,text:e.content});i=n,a=r}let o=Ud({content:i,imagePasteIds:r});G(e=>[...e,o]),await Zr.sendMessage(a,{uuid:o.uuid});return}await Ar(),await sP({input:e,helpers:t,queryGuard:fn,isExternalLoading:hn,mode:Br,commands:qt,onInputChange:zr,setPastedContents:ei,setToolJSX:Vn,getToolUseContext:Qa,messages:dr.current,mainLoopModel:Te,pastedContents:Qr,ideSelection:gt,setUserInputOnProcessing:pr,setAbortController:an,abortController:nn,onQuery:no,setAppState:V,querySource:zf(),onBeforeQuery:_,canUseTool:Za,addNotification:ut,setMessages:G,streamMode:Xt.current,hasInterruptibleToolInProgress:qr.current}),(i||_n)&&Hr!==void 0&&(zr(Hr.text),t.setCursorOffset(Hr.cursorOffset),ei(Hr.pastedContents),Ur(void 0))},[fn,_n,hn,Br,qt,zr,Vr,ei,ni,_t,Vn,Qa,Te,Qr,gt,pr,an,ut,no,Hr,Ur,V,_,Za,Jr,G,Ar,Er]),ao=(0,Q.useCallback)(async(e,t,n)=>{oo(t)?(Wl(t.id,Ud({content:e}),V),t.status===`running`?Bp(t.id,e,V):dd({agentId:t.id,prompt:e,toolUseContext:Qa(dr.current,[],new AbortController,Te),canUseTool:Za}).catch(e=>{K(`resumeAgentBackground failed: ${br(e)}`),ut({key:`resume-agent-failed-${t.id}`,jsx:(0,$.jsxs)(R,{color:`error`,children:[`Failed to resume agent: `,br(e)]}),priority:`low`})})):zc(t.id,e,void 0,V),zr(``),n.setCursorOffset(0),n.clearBuffer()},[V,zr,Qa,Za,Te,ut]),so=(0,Q.useCallback)(()=>{let e=ja?XI(ja):`/issue`;Ma(null),io(e,{setCursorOffset:()=>{},clearBuffer:()=>{},resetHistory:()=>{}}).catch(t=>{K(`Auto-run ${e} failed: ${br(t)}`)})},[io,ja]),co=(0,Q.useCallback)(()=>{Ma(null)},[]),lo=(0,Q.useCallback)(()=>{io(process.env.USER_TYPE===`ant`?`/issue`:`/feedback`,{setCursorOffset:()=>{},clearBuffer:()=>{},resetHistory:()=>{}}).catch(e=>{K(`Survey feedback request failed: ${e instanceof Error?e.message:String(e)}`)})},[io]),uo=(0,Q.useRef)(io);uo.current=io;let fo=(0,Q.useCallback)(()=>{uo.current(`/rate-limit-options`,{setCursorOffset:()=>{},clearBuffer:()=>{},resetHistory:()=>{}})},[]),mo=(0,Q.useCallback)(async()=>{if(Ra(!0),om()){IS(`tmux`,[`detach-client`],{stdio:`ignore`}),Ra(!1);return}if(Jg()!==null){Ia((0,$.jsx)(fx,{showWorktree:!0,onDone:()=>{},onCancel:()=>{Ia(null),Ra(!1)}}));return}let e=await(await ih.load()).call(()=>{});Ia(e),e===null&&Ra(!1)},[]),ho=(0,Q.useCallback)(()=>{Ci(e=>!e)},[]),_o=(0,Q.useCallback)(e=>{let t=dr.current,n=t.lastIndexOf(e);if(n===-1)return;Y(`tengu_conversation_rewind`,{preRewindMessageCount:t.length,postRewindMessageCount:n,messagesRemoved:t.length-n,rewindToMessageIndex:n}),G(t.slice(0,n)),Ai(jS()),Mc();let r=e.permissionMode;V(e=>({...e,toolPermissionContext:r&&e.toolPermissionContext.mode!==r?{...e.toolPermissionContext,mode:r}:e.toolPermissionContext,promptSuggestion:{text:null,promptId:null,shownAt:0,acceptedAt:0,generationRequestId:null}}))},[G,V]),vo=(0,Q.useCallback)(e=>{_o(e);let t=al(e);if(t&&(zr(t.text),Vr(t.mode)),Array.isArray(e.message.content)&&e.message.content.some(e=>e.type===`image`)){let t=e.message.content.filter(e=>e.type===`image`);if(t.length>0){let n={};t.forEach((t,r)=>{if(t.source.type===`base64`){let i=e.imagePasteIds?.[r]??r+1;n[i]={id:i,type:`image`,content:t.source.data,mediaType:t.source.media_type}}}),ei(n)}}},[_o,zr]);cn.current=vo;let yo=(0,Q.useCallback)(async e=>{setImmediate((e,t)=>e(t),vo,e)},[vo]),bo=e=>{let t=e.slice(0,24);return W.findIndex(e=>e.uuid.slice(0,24)===t)},{enter:xo,handlers:So}=ed(Sr,Cr,wr,{copy:e=>void Ce(e).then(e=>{e&&process.stdout.write(e),ut({key:`selection-copied`,text:`copied`,color:`success`,priority:`immediate`,timeoutMs:2e3})}),edit:async e=>{let t=bo(e.uuid),n=t>=0?W[t]:void 0;if(!n||!Zy(n))return;let r=!await fd(oe,n.uuid),i=$y(W,t);r&&i?(Ga(),yo(n)):(Ei(n),Ci(!0))}});async function Co(){Aa();let e=await t_();if(e.length>0){let t=e.map(e=>` [${e.type}] ${e.path} (${e.content.length} chars)${e.parent?` (included by ${e.parent})`:``}`).join(`
92
+ `),mode:`task-notification`});break;case`fresh`:let t=Fe(),n=await NS(Ul()).then(()=>!0,()=>!1);await Zb({setMessages:r,readFileState:i,getAppState:o,setAppState:l,setConversationId:s}),n&&r(e=>[...e,Sd(`Previous session saved · resume with: claude --resume ${t}`,`suggestion`)]),tm({value:`Here is the approved implementation plan:\n\n${e}\n\nImplement this plan.`,mode:`prompt`});break;case`cancel`:{let t=wS(Mr(),`${dL()}-ultraplan.md`);await PS(t,e,{encoding:`utf-8`}),r(e=>[...e,Sd(`Ultraplan rejected · Plan saved to ${fi(t)}`,`suggestion`)]);break}}zd(n,l,e=>e.status===`running`?{...e,status:`completed`,endTime:Date.now()}:e),l(e=>e.ultraplanPendingChoice?{...e,ultraplanPendingChoice:void 0,ultraplanSessionUrl:void 0}:e),ag(t)},[e,t,n,r,o,l,i,s]),C=Q.useMemo(()=>[{label:`Implement here`,value:`here`,description:`Inject plan into the current conversation`},{label:`Start new session`,value:`fresh`,description:`Clear conversation and start with only the plan`},{label:`Cancel`,value:`cancel`,description:`Don't implement — save plan and return`}],[]);return(0,$.jsx)(B,{title:`Ultraplan approved`,subtitle:`How should the plan be implemented?`,onCancel:()=>{},hideInputGuide:!0,children:(0,$.jsxs)(U,{flexDirection:`column`,marginBottom:1,children:[(0,$.jsxs)(U,{flexDirection:`column`,marginBottom:1,children:[(0,$.jsx)(R,{children:y}),v&&(0,$.jsxs)(R,{dimColor:!0,children:[b?p.arrowUp:` `,x?p.arrowDown:` `,` `,g+1,`–`,Math.min(g+f,m.length),` of `,m.length,` · ctrl+u/ctrl+d to scroll`]})]}),(0,$.jsx)(so,{options:C,onChange:e=>void S(e)})]})})}H(),Rc(),xy(),Z(),Et(),Eh();function pL(){return!pn().hasSeenUltraplanTerms}function mL(){return zh()}function hL({onChoice:e}){let[t]=Q.useState(pL),[n]=Q.useState(mL),r=Q.useMemo(()=>Um(n),[n]),i=X(e=>e.replBridgeEnabled),a=Hc(),o=Q.useCallback(r=>{let o=r===`run`&&i;o&&a(e=>e.replBridgeEnabled?{...e,replBridgeEnabled:!1,replBridgeExplicit:!1,replBridgeOutboundOnly:!1}:e),r!==`cancel`&&t&&rn(e=>e.hasSeenUltraplanTerms?e:{...e,hasSeenUltraplanTerms:!0}),e(r,{disconnectedBridge:o,promptIdentifier:n})},[e,i,a,t]),s=Q.useCallback(()=>{o(`cancel`)},[o]),c=[{label:`Run ultraplan`,value:`run`,description:i?`Disable remote control and launch in Claude Code on the web`:`launch in Claude Code on the web`},{label:`Not now`,value:`cancel`}];return(0,$.jsx)(B,{title:`Run ultraplan in the cloud?`,subtitle:r.timeEstimate,onCancel:s,children:(0,$.jsxs)(U,{flexDirection:`column`,gap:1,children:[(0,$.jsxs)(U,{flexDirection:`column`,children:[(0,$.jsx)(R,{dimColor:!0,children:r.dialogBody}),t?(0,$.jsxs)(R,{dimColor:!0,children:[`For more information on Claude Code on the web:`,(0,$.jsx)(re,{url:Am,children:Am})]}):null]}),(0,$.jsx)(R,{dimColor:!0,children:i?`This will disable Remote Control for this session.`:r.dialogPipeline}),(0,$.jsx)(so,{options:c,onChange:o})]})})}px(),H(),Et(),La();function gL(e,t,n){let r=(0,Q.useRef)(!1),i=(0,Q.useRef)(n);i.current=n,(0,Q.useEffect)(()=>{if(t)return e.subscribe(()=>{let t=e.getState(),n=e.hasSelection();if(t?.isDragging){r.current=!1;return}if(!n){r.current=!1;return}if(r.current||!(pn().copyOnSelect??!0))return;let a=e.copySelectionNoClear();if(!a||!a.trim()){r.current=!0;return}r.current=!0,i.current?.(a)})},[t,e])}function _L(e){let[t]=ae();(0,Q.useEffect)(()=>{e.setSelectionBgColor(y_(t).selectionBg)},[e,t])}Ac(),H(),Jv(),q();var vL=40,yL=.3,bL=6,xL=200,SL=15,CL=15,wL=3,TL=1500,EL=150,DL=5,OL=5,kL=80,AL=3,jL=6,ML=500;function NL(e){return!(e.wheelUp||e.wheelDown||(e.leftArrow||e.rightArrow||e.upArrow||e.downArrow||e.home||e.end||e.pageUp||e.pageDown)&&(e.shift||e.meta||e.super))}function PL(e){return!e.shift||e.meta?null:e.leftArrow?`left`:e.rightArrow?`right`:e.upArrow?`up`:e.downArrow?`down`:e.home?`lineStart`:e.end?`lineEnd`:null}function FL(e,t,n){if(!e.xtermJs){if(e.wheelMode&&n-e.time>TL&&(e.wheelMode=!1,e.burstCount=0,e.mult=e.base),e.pendingFlip){if(e.pendingFlip=!1,t!==e.dir||n-e.time>xL)return e.dir=t,e.time=n,e.mult=e.base,Math.floor(e.mult);e.wheelMode=!0}let r=n-e.time;if(t!==e.dir&&e.dir!==0)return e.pendingFlip=!0,e.time=n,0;if(e.dir=t,e.time=n,e.wheelMode)if(r<OL)if(++e.burstCount>=5)e.wheelMode=!1,e.burstCount=0,e.mult=e.base;else return 1;else e.burstCount=0;if(e.wheelMode){let t=.5**(r/EL),n=Math.max(CL,e.base*2),i=1+(e.mult-1)*t+SL*t;return e.mult=Math.min(n,i,e.mult+wL),Math.floor(e.mult)}if(r>vL)e.mult=e.base;else{let t=Math.max(bL,e.base*2);e.mult=Math.min(t,e.mult+yL)}return Math.floor(e.mult)}let r=n-e.time,i=t===e.dir;if(e.time=n,e.dir=t,i&&r<OL)return 1;if(!i||r>ML)e.mult=2,e.frac=0;else{let t=.5**(r/EL);e.mult=Math.min(r>=kL?AL:jL,1+(e.mult-1)*t+DL*t)}let a=e.mult+e.frac,o=Math.floor(a);return e.frac=a-o,o}function IL(){let e=process.env.CLAUDE_CODE_SCROLL_SPEED;if(!e)return 1;let t=parseFloat(e);return Number.isNaN(t)||t<=0?1:Math.min(t,20)}function LL(e=!1,t=1){return{time:0,mult:t,dir:0,xtermJs:e,frac:0,base:t,pendingFlip:!1,wheelMode:!1,burstCount:0}}function RL(){let e=de(),t=IL();return K(`wheel accel: ${e?`decay (xterm.js)`:`window (native)`} · base=${t} · TERM_PROGRAM=${process.env.TERM_PROGRAM??`unset`}`),LL(e,t)}var zL=2,BL=50,VL=200;function HL({scrollRef:e,isActive:t,onScroll:n,isModal:r=!1}){let i=ee(),{addNotification:a}=Wp(),o=(0,Q.useRef)(null);function s(e){let t=z(),n=e.length,r;switch(t){case`native`:r=`copied ${n} chars to clipboard`;break;case`tmux-buffer`:r=`copied ${n} chars to tmux buffer · paste with prefix + ]`;break;case`osc52`:r=`sent ${n} chars via OSC 52 · check terminal clipboard settings if paste fails`;break}a({key:`selection-copied`,text:r,color:`suggestion`,priority:`immediate`,timeoutMs:t===`native`?2e3:4e3})}function c(){let e=i.copySelection();e&&s(e)}function l(e,t){let n=i.getState();if(!n?.anchor||!n.focus)return;let r=e.getViewportTop(),a=r+e.getViewportHeight()-1;if(n.anchor.row<r||n.anchor.row>a||n.focus.row<r||n.focus.row>a)return;let o=Math.max(0,e.getScrollHeight()-e.getViewportHeight()),s=e.getScrollTop()+e.getPendingDelta(),c=Math.max(0,Math.min(o,s+t))-s;if(c!==0)if(c>0)i.captureScrolledRows(r,r+c-1,`above`),i.shiftSelection(-c,r,a);else{let e=-c;i.captureScrolledRows(a-e+1,a,`below`),i.shiftSelection(e,r,a)}}return V({"scroll:pageUp":()=>{let t=e.current;if(!t)return;let r=-Math.max(1,Math.floor(t.getViewportHeight()/2));l(t,r);let i=GL(t,r);n?.(i,t)},"scroll:pageDown":()=>{let t=e.current;if(!t)return;let r=Math.max(1,Math.floor(t.getViewportHeight()/2));l(t,r);let i=GL(t,r);n?.(i,t)},"scroll:lineUp":()=>{i.clearSelection();let t=e.current;if(!t||t.getScrollHeight()<=t.getViewportHeight())return!1;o.current??(o.current=RL()),qL(t,FL(o.current,-1,performance.now())),n?.(!1,t)},"scroll:lineDown":()=>{i.clearSelection();let t=e.current;if(!t||t.getScrollHeight()<=t.getViewportHeight())return!1;o.current??(o.current=RL());let r=KL(t,FL(o.current,1,performance.now()));n?.(r,t)},"scroll:top":()=>{let t=e.current;t&&(l(t,-(t.getScrollTop()+t.getPendingDelta())),t.scrollTo(0),n?.(!1,t))},"scroll:bottom":()=>{let t=e.current;if(!t)return;let r=Math.max(0,t.getScrollHeight()-t.getViewportHeight());l(t,r-(t.getScrollTop()+t.getPendingDelta())),t.scrollTo(r),t.scrollToBottom(),n?.(!0,t)},"selection:copy":c},{context:`Scroll`,isActive:t}),V({"scroll:halfPageUp":()=>{let t=e.current;if(!t)return;let r=-Math.max(1,Math.floor(t.getViewportHeight()/2));l(t,r);let i=GL(t,r);n?.(i,t)},"scroll:halfPageDown":()=>{let t=e.current;if(!t)return;let r=Math.max(1,Math.floor(t.getViewportHeight()/2));l(t,r);let i=GL(t,r);n?.(i,t)},"scroll:fullPageUp":()=>{let t=e.current;if(!t)return;let r=-Math.max(1,t.getViewportHeight());l(t,r);let i=GL(t,r);n?.(i,t)},"scroll:fullPageDown":()=>{let t=e.current;if(!t)return;let r=Math.max(1,t.getViewportHeight());l(t,r);let i=GL(t,r);n?.(i,t)}},{context:`Scroll`,isActive:t}),Oe((t,r,i)=>{let a=e.current;if(!a)return;let o=YL(a,JL(t,r),e=>l(a,e));o!==null&&(n?.(o,a),i.stopImmediatePropagation())},{isActive:t&&r}),Oe((e,t,n)=>{if(!i.hasSelection())return;if(t.escape){i.clearSelection(),n.stopImmediatePropagation();return}if(t.ctrl&&!t.shift&&!t.meta&&e===`c`){c(),n.stopImmediatePropagation();return}let r=PL(t);if(r){i.moveFocus(r),n.stopImmediatePropagation();return}NL(t)&&i.clearSelection()},{isActive:t}),UL(e,i,t,n),gL(i,t,s),_L(i),null}function UL(e,t,n,r){let i=(0,Q.useRef)(null),a=(0,Q.useRef)(0),o=(0,Q.useRef)(0),s=(0,Q.useRef)(0),c=(0,Q.useRef)(r);c.current=r,(0,Q.useEffect)(()=>{if(!n)return;function r(){a.current=0,i.current&&(clearInterval(i.current),i.current=null)}function l(){let n=t.getState(),i=e.current,o=a.current;if(!n?.isDragging||!n.focus||!i||o===0||++s.current>VL){r();return}if(i.getPendingDelta()!==0)return;let l=i.getViewportTop(),u=l+i.getViewportHeight()-1;if(o<0){if(i.getScrollTop()<=0){r();return}let e=Math.min(zL,i.getScrollTop());t.captureScrolledRows(u-e+1,u,`below`),t.shiftAnchor(e,0,u),i.scrollBy(-zL)}else{let e=Math.max(0,i.getScrollHeight()-i.getViewportHeight());if(i.getScrollTop()>=e){r();return}let n=Math.min(zL,e-i.getScrollTop());t.captureScrolledRows(l,l+n-1,`above`),t.shiftAnchor(-n,l,u),i.scrollBy(zL)}c.current?.(!1,i)}function u(e){o.current=e,a.current!==e&&(r(),a.current=e,s.current=0,l(),a.current===e&&(i.current=setInterval(l,BL)))}function d(){let n=e.current;if(!n){r();return}let i=n.getViewportTop(),a=i+n.getViewportHeight()-1,s=t.getState();(!s?.isDragging||s.scrolledOffAbove.length===0&&s.scrolledOffBelow.length===0)&&(o.current=0);let c=WL(s,i,a,o.current);if(c===0){if(o.current!==0&&s?.focus){let e=s.focus.row<i?-1:+(s.focus.row>a);e!==0&&e!==o.current&&(s.scrolledOffAbove=[],s.scrolledOffBelow=[],s.scrolledOffAboveSW=[],s.scrolledOffBelowSW=[],o.current=0)}r()}else u(c)}let f=t.subscribe(d);return()=>{f(),r(),o.current=0}},[n,e,t])}function WL(e,t,n,r=0){if(!e?.isDragging||!e.anchor||!e.focus)return 0;let i=e.focus.row,a=i<t?-1:+(i>n);return r===0?e.anchor.row<t||e.anchor.row>n?0:a:a===r?a:0}function GL(e,t){let n=Math.max(0,e.getScrollHeight()-e.getViewportHeight()),r=e.getScrollTop()+e.getPendingDelta()+t;return r>=n?(e.scrollTo(n),e.scrollToBottom(),!0):(e.scrollTo(Math.max(0,r)),!1)}function KL(e,t){let n=Math.max(0,e.getScrollHeight()-e.getViewportHeight());return e.getScrollTop()+e.getPendingDelta()+t>=n?(e.scrollToBottom(),!0):(e.scrollBy(t),!1)}function qL(e,t){if(e.getScrollTop()+e.getPendingDelta()-t<=0){e.scrollTo(0);return}e.scrollBy(-t)}function JL(e,t){if(t.meta)return null;if(!t.ctrl&&!t.shift){if(t.upArrow)return`lineUp`;if(t.downArrow)return`lineDown`;if(t.home)return`top`;if(t.end)return`bottom`}if(t.ctrl){if(t.shift)return null;switch(e){case`u`:return`halfPageUp`;case`d`:return`halfPageDown`;case`b`:return`fullPageUp`;case`f`:return`fullPageDown`;case`n`:return`lineDown`;case`p`:return`lineUp`;default:return null}}let n=e[0];if(!n||e!==n.repeat(e.length))return null;if(n===`G`||n===`g`&&t.shift)return`bottom`;if(t.shift)return null;switch(n){case`g`:return`top`;case`j`:return`lineDown`;case`k`:return`lineUp`;case` `:return`fullPageDown`;case`b`:return`fullPageUp`;default:return null}}function YL(e,t,n){switch(t){case null:return null;case`lineUp`:case`lineDown`:{let r=t===`lineDown`?1:-1;return n(r),GL(e,r)}case`halfPageUp`:case`halfPageDown`:{let r=Math.max(1,Math.floor(e.getViewportHeight()/2)),i=t===`halfPageDown`?r:-r;return n(i),GL(e,i)}case`fullPageUp`:case`fullPageDown`:{let r=Math.max(1,e.getViewportHeight()),i=t===`fullPageDown`?r:-r;return n(i),GL(e,i)}case`top`:return n(-(e.getScrollTop()+e.getPendingDelta())),e.scrollTo(0),!1;case`bottom`:{let t=Math.max(0,e.getScrollHeight()-e.getViewportHeight());return n(t-(e.getScrollTop()+e.getPendingDelta())),e.scrollTo(t),e.scrollToBottom(),!0}}}var XL=r({VoiceKeybindingHandler:()=>eR,useVoiceIntegration:()=>QL,useVoiceKeybindingHandler:()=>$L});function ZL(e,t){return!((e.key===`space`?` `:e.key===`return`?`enter`:e.key.toLowerCase())!==t.key||e.ctrl!==t.ctrl||e.shift!==t.shift||e.meta!==(t.alt||t.meta)||e.superKey!==t.super)}function QL({setInputValueRaw:e,inputValueRef:t,insertTextRef:n}){let{addNotification:r}=Wp(),i=(0,tR.useRef)(null),a=(0,tR.useRef)(``),o=(0,tR.useRef)(null),s=(0,tR.useCallback)((r,{char:s=` `,anchor:c=!1,floor:l=0}={})=>{let u=t.current,d=n.current?.cursorOffset??u.length,f=u.slice(0,d),p=u.slice(d),m=s===` `?Qt(f):f,h=0;for(;h<m.length&&m[m.length-1-h]===s;)h++;let g=Math.max(0,Math.min(h-l,r)),_=h-g,v=f.slice(0,f.length-g),y=``;c&&(i.current=v,a.current=p,p.length>0&&!/^\s/.test(p)&&(y=` `));let b=v+y+p;return c&&(o.current=b),b===u&&g===0||(n.current?n.current.setInputWithCursor(b,v.length):e(b)),_},[e,t,n]),c=(0,tR.useCallback)(()=>{let t=i.current;if(t===null)return;let r=a.current;i.current=null,a.current=``;let o=t+r;n.current?n.current.setInputWithCursor(o,t.length):e(o)},[e,n]),l=OD(),u=ph(e=>e.voiceState),d=ph(e=>e.voiceInterimTranscript);(0,tR.useEffect)(()=>{if(u===`recording`&&i.current===null){let e=t.current,r=n.current?.cursorOffset??e.length;i.current=e.slice(0,r),a.current=e.slice(r),o.current=e}u===`idle`&&(i.current=null,a.current=``,o.current=null)},[u,t,n]),(0,tR.useEffect)(()=>{if(i.current===null)return;let r=i.current,s=a.current;if(t.current!==o.current)return;let c=r.length>0&&!/\s$/.test(r)&&d.length>0,l=s.length>0&&!/^\s/.test(s),u=c?` `:``,f=l?` `:``,p=r+u+d+f+s,m=r.length+u.length+d.length;n.current?n.current.setInputWithCursor(p,m):e(p),o.current=p},[d,e,t,n]);let f=(0,tR.useCallback)(r=>{let s=i.current;if(s===null)return;let c=a.current;if(t.current!==o.current)return;let l=s.length>0&&!/\s$/.test(s)&&r.length>0,u=c.length>0&&!/^\s/.test(c)&&r.length>0,d=l?` `:``,f=u?` `:``,p=s+d+r+f+c,m=s.length+d.length+r.length;n.current?n.current.setInputWithCursor(p,m):e(p),o.current=p,i.current=s+d+r},[e,t,n]),p=nR.useVoice({onTranscript:f,onError:e=>{r({key:`voice-error`,text:e,color:`error`,priority:`immediate`,timeoutMs:1e4})},enabled:l,focusMode:!1}),m=(0,tR.useMemo)(()=>{if(i.current===null||d.length===0)return null;let e=i.current,t=e.length>0&&!/\s$/.test(e)&&d.length>0,n=e.length+ +!!t;return{start:n,end:n+d.length}},[d]);return{stripTrailing:s,resetAnchor:c,handleKeyEvent:p.handleKeyEvent,interimRange:m}}function $L({voiceHandleKeyEvent:e,stripTrailing:t,resetAnchor:n,isActive:r}){let i=Fo(),a=Fs(),o=pe(),s=ba(),c=OD(),l=ph(e=>e.voiceState),u=(0,tR.useMemo)(()=>{if(!o)return sR;let e=null;for(let t of o.bindings){if(t.context!==`Chat`||t.chord.length!==1)continue;let n=t.chord[0];n&&(t.action===`voice:pushToTalk`?e=n:e!==null&&me(n,e)&&(e=null))}return e},[o]),d=u!==null&&u.key.length===1&&!u.ctrl&&!u.alt&&!u.shift&&!u.meta&&!u.super?u.key:null,f=(0,tR.useRef)(0),p=(0,tR.useRef)(0),m=(0,tR.useRef)(0),h=(0,tR.useRef)(!1),g=(0,tR.useRef)(null);(0,tR.useEffect)(()=>{l!==`recording`&&(h.current=!1,f.current=0,p.current=0,m.current=0,a(e=>e.voiceWarmingUp?{...e,voiceWarmingUp:!1}:e))},[l,a]);let _=o=>{if(!c||!r||s||u===null)return;let l;if(d!==null){if(o.ctrl||o.meta||o.shift)return;let e=d===` `?Qt(o.key):o.key;if(e[0]!==d||e.length>1&&e!==d.repeat(e.length))return;l=e.length}else{if(!ZL(o,u))return;l=1}let _=i().voiceState;if(h.current&&_!==`idle`){o.stopImmediatePropagation(),d!==null&&t(l,{char:d,floor:m.current}),e();return}if(_!==`idle`){d===null&&o.stopImmediatePropagation();return}let v=f.current;if(f.current+=l,d===null||f.current>=aR){o.stopImmediatePropagation(),g.current&&(clearTimeout(g.current),g.current=null),f.current=0,h.current=!0,a(e=>e.voiceWarmingUp?{...e,voiceWarmingUp:!1}:e),d===null?(t(0,{anchor:!0}),e(iR)):(m.current=t(p.current+l,{char:d,anchor:!0}),p.current=0,e()),i().voiceState===`idle`&&(h.current=!1,n());return}v>=oR?(o.stopImmediatePropagation(),t(l,{char:d,floor:p.current})):p.current+=l,f.current>=oR&&a(e=>e.voiceWarmingUp?e:{...e,voiceWarmingUp:!0}),g.current&&clearTimeout(g.current),g.current=setTimeout((e,t,n,r)=>{e.current=null,t.current=0,n.current=0,r(e=>e.voiceWarmingUp?{...e,voiceWarmingUp:!1}:e)},rR,g,f,p,a)};return Oe((e,t,n)=>{let r=new Ae(n.keypress);_(r),r.didStopImmediatePropagation()&&n.stopImmediatePropagation()},{isActive:r}),{handleKeyDown:_}}function eR(e){return $L(e),null}var tR,nR,rR,iR,aR,oR,sR,cR=t((()=>{tR=n(L(),1),Ac(),Qp(),Cu(),H(),ul(),Wn(),AD(),nR=(iS(),e(rS)),rR=120,iR=2e3,aR=5,oR=2,sR={key:` `,ctrl:!1,alt:!1,shift:!1,meta:!1,super:!1}})),lR=r({useFrustrationDetection:()=>dR});function uR(e){return e.filter(e=>e.isApiErrorMessage).length>=2}function dR(e,t,n,r){let[i,a]=(0,fR.useState)(`closed`),o=pn(),s=Ca(`product_feedback`),c=o.transcriptShareDismissed||!s||t||n||r,l=uR(e);return{state:c?`closed`:l&&i===`closed`?`transcript_prompt`:i,handleTranscriptSelect:t=>{c||(t===`yes`?(BP(e,`frustration`,crypto.randomUUID()),a(`submitted`)):(rn(e=>({...e,transcriptShareDismissed:!0})),a(`closed`)))}}}var fR,pR=t((()=>{fR=n(L(),1),Et(),ml(),VP()})),mR=r({useAntOrgWarningNotification:()=>hR});function hR(){}var gR=t((()=>{})),_R=r({useProactive:()=>vR});function vR(e){let t=(0,yR.useRef)(e);t.current=e,(0,yR.useEffect)(()=>{if(!uv())return;let e=null,n=!1,r=!1;function i(){lv(Date.now()+bR),e=setTimeout(()=>{if(e=null,!rv()){i();return}let{isLoading:a,queuedCommandsLength:o,hasActiveLocalJsxUI:s,isInPlanMode:c}=t.current;if(a||c||s||o>0||r){i();return}r=!0,(async()=>{let e=await qo({basePrompt:`<${Zr}>${new Date().toLocaleTimeString()}</${Zr}>`,currentDir:Mr(),shouldCreate:()=>!n});if(n){await ss({commands:e});return}let r=[];try{for(let n of e)t.current.onQueueTick(n),r.push(n)}catch(t){throw await ss({commands:e.filter(e=>!r.includes(e))}),t}})().catch(e=>K(`[Proactive] failed to create tick: ${e}`,{level:`error`})).finally(()=>{r=!1}),i()},bR)}return i(),()=>{n=!0,e!==null&&(clearTimeout(e),e=null),lv(null)}},[uv(),nv(),av()])}var yR,bR,xR=t((()=>{yR=n(L(),1),ri(),jr(),o_(),q(),bR=3e4})),SR=r({createScheduledTaskQueuedCommand:()=>CR,useScheduledTasks:()=>wR});async function CR(e,t){let n=await su({basePrompt:e.prompt,trigger:`scheduled-task`,rootDir:t?.rootDir,currentDir:t?.currentDir??Mr(),sourceId:e.id,sourceLabel:e.prompt,workload:Ft,shouldCreate:t?.shouldCreate});return n||K(`[ScheduledTasks] skipping ${e.id}: previous run still queued or running`),n}function wR({isLoading:e,assistantMode:t=!1,setMessages:n}){let r=(0,ER.useRef)(e);r.current=e;let i=gc(),a=Hc();(0,ER.useEffect)(()=>{if(!j_())return;let e=!1,o=async t=>{let n=await xa({basePrompt:t,trigger:`scheduled-task`,currentDir:Mr(),workload:Ft,shouldCreate:()=>!e});if(n){if(e){await Wu(n.autonomy.runId,n.autonomy.rootDir);return}tm(n)}},s=Hy({onFire:e=>{o(e).catch(e=>K(`[ScheduledTasks] failed to enqueue missed task prompt: ${e}`,{level:`error`}))},onFireTask:t=>{(async()=>{if(t.agentId){let n=Rg(t.agentId,i.getState().tasks);if(n&&!Pc(n.status)){let r=await CR(t,{shouldCreate:()=>!e});if(!r)return;if(e){await Wu(r.autonomy.runId,r.autonomy.rootDir);return}!zc(n.id,r.value,{autonomyRunId:r.autonomy?.runId,autonomyRootDir:r.autonomy?.rootDir,origin:r.origin},a)&&r.autonomy?.runId&&await Nu(r.autonomy.runId,`Teammate ${t.agentId} exited before the scheduled message could be delivered.`,r.autonomy.rootDir);return}K(`[ScheduledTasks] teammate ${t.agentId} gone, removing orphaned cron ${t.id}`),E_([t.id]);return}let r=await CR(t,{shouldCreate:()=>!e});if(!r)return;if(e){await Wu(r.autonomy.runId,r.autonomy.rootDir);return}let o=gp(`Running scheduled task (${TR(new Date)})`);n(e=>[...e,o]),tm(r)})().catch(e=>K(`[ScheduledTasks] failed to enqueue task ${t.id}: ${e}`,{level:`error`}))},isLoading:()=>r.current,assistantMode:t,getJitterConfig:Wy,isKilled:()=>!j_()});return s.start(),()=>{e=!0,s.stop()}},[t])}function TR(e){return e.toLocaleString(`en-US`,{month:`short`,day:`numeric`,hour:`numeric`,minute:`2-digit`}).replace(/,? at |, /,` `).replace(/ ([AP]M)/,(e,t)=>t.toLowerCase())}var ER,DR=t((()=>{ER=n(L(),1),Z(),co(),jr(),dh(),q(),up(),Qs(),nn()})),OR=r({AntModelSwitchCallout:()=>kR,shouldShowModelSwitchCallout:()=>AR});function kR(e){return null}function AR(){return!1}var jR=t((()=>{})),MR=r({UndercoverAutoCallout:()=>NR});function NR({onDone:e}){return(0,PR.useEffect)(()=>{e()},[e]),null}var PR,FR=t((()=>{PR=n(L(),1)}));ot(),es(),Ai(),f(),H(),nc(),Cb(),Ac(),Hf(),q(),s(),Vi(),o_(),Nv(),Ku(),Yo(),wi(),co(),yo(),Uc(),Lu(),nb(),op(),xd(),vm(),jl(),Bu(),wf(),Cr(),ii(),jr(),Cp(),kg(),Sl(),lh(),Et(),Kn(),J(),fn(),Qs(),Ty(),ri(),mh(),Rm(),ky(),yu(),r_(),bh(),Ab(),Z(),is(),_a(),sg(),fl(),ir(),nl(),Lg(),up(),za(),Ra(),Sp(),Eh(),Go();var IR=(cR(),e(XL)).useVoiceIntegration,LR=(cR(),e(XL)).VoiceKeybindingHandler,RR=process.env.USER_TYPE===`ant`?(pR(),e(lR)).useFrustrationDetection:()=>({state:`closed`,handleTranscriptSelect:()=>{}}),zR=process.env.USER_TYPE===`ant`?(gR(),e(mR)).useAntOrgWarningNotification:()=>{},BR=(Gd(),e(Lh)).getCoordinatorUserContext,VR=(dv(),e(ev)),HR=e=>()=>{},UR=()=>!1,WR=()=>null,GR=(e,t)=>!1,KR=(xR(),e(_R)).useProactive,qR=(DR(),e(SR)).useScheduledTasks,JR=()=>({relayPipeMessage:()=>!1,pipeReturnHadErrorRef:{current:!1}}),YR=()=>({routeToSelectedPipes:()=>!1}),XR=process.env.USER_TYPE===`ant`?(jR(),e(OR)).AntModelSwitchCallout:null,ZR=process.env.USER_TYPE===`ant`?(jR(),e(OR)).shouldShowModelSwitchCallout:()=>!1,QR=process.env.USER_TYPE===`ant`?(FR(),e(MR)).UndercoverAutoCallout:null,$R=[],ez=3e3;function tz(e){let t=[...e].sort((e,t)=>e-t),n=Math.floor(t.length/2);return t.length%2==0?Math.round((t[n-1]+t[n])/2):t[n]}function nz({showAllInTranscript:e,virtualScroll:t,searchBadge:n,suppressShowAll:r=!1,status:i}){let a=pd(`app:toggleTranscript`,`Global`,`ctrl+o`),o=pd(`transcript:toggleShowAll`,`Transcript`,`ctrl+e`);return(0,$.jsxs)(U,{noSelect:!0,alignItems:`center`,alignSelf:`center`,borderTopDimColor:!0,borderBottom:!1,borderLeft:!1,borderRight:!1,borderStyle:`single`,marginTop:1,paddingLeft:2,width:`100%`,children:[(0,$.jsxs)(R,{dimColor:!0,children:[`Showing detailed transcript · `,a,` to toggle`,n?` · n/N to navigate`:t?` · ${p.arrowUp}${p.arrowDown} scroll · home/end top/bottom`:r?``:` · ${o} to ${e?`collapse`:`show all`}`]}),i?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(U,{flexGrow:1}),(0,$.jsxs)(R,{children:[i,` `]})]}):n?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(U,{flexGrow:1}),(0,$.jsxs)(R,{dimColor:!0,children:[n.current,`/`,n.count,` `]})]}):null]})}function rz({jumpRef:e,count:t,current:n,onClose:r,onCancel:i,setHighlight:a,initialQuery:o}){let{query:s,cursorOffset:c}=ax({isActive:!0,initialQuery:o,onExit:()=>r(s),onCancel:i}),[l,u]=Q.useState(`building`);Q.useEffect(()=>{let t=!0,n,r=e.current?.warmSearchIndex;if(!r){u(null);return}return u(`building`),r().then(e=>{t&&(e<20?u(null):(u({ms:e}),n=setTimeout(()=>t&&u(null),2e3)))}),()=>{t=!1,n&&clearTimeout(n)}},[e]);let d=l!==`building`;(0,Q.useEffect)(()=>{d&&(e.current?.setSearchQuery(s),a(s))},[e,s,a,d]);let f=c,p=f<s.length?s[f]:` `;return(0,$.jsxs)(U,{borderTopDimColor:!0,borderBottom:!1,borderLeft:!1,borderRight:!1,borderStyle:`single`,marginTop:1,paddingLeft:2,width:`100%`,noSelect:!0,children:[(0,$.jsx)(R,{children:`/`}),(0,$.jsx)(R,{children:s.slice(0,f)}),(0,$.jsx)(R,{inverse:!0,children:p}),f<s.length&&(0,$.jsx)(R,{children:s.slice(f+1)}),(0,$.jsx)(U,{flexGrow:1}),l===`building`?(0,$.jsx)(R,{dimColor:!0,children:`indexing… `}):l?(0,$.jsxs)(R,{dimColor:!0,children:[`indexed in `,l.ms,`ms `]}):t===0&&s?(0,$.jsx)(R,{color:`error`,children:`no matches `}):t>0?(0,$.jsxs)(R,{dimColor:!0,children:[n,`/`,t,` `]}):null]})}var iz=[`⠂`,`⠐`],az=`✳`,oz=960;function sz({isAnimating:e,title:t,disabled:n,noPrefix:r}){let i=le(),[a,o]=(0,Q.useState)(0);(0,Q.useEffect)(()=>{if(n||r||!e||!i)return;let t=setInterval(e=>e(e=>(e+1)%iz.length),oz,o);return()=>clearInterval(t)},[n,r,e,i]);let s=e?iz[a]??az:az;return ve(n?null:r?t:`${s} ${t}`),null}var cz=`<${ei}>`;function lz(e){return e.type===`text`&&typeof e.text==`string`&&e.text.includes(cz)}function uz({commands:t,debug:n,initialTools:r,initialMessages:i,pendingHookMessages:a,initialFileHistorySnapshots:o,initialContentReplacements:s,initialAgentName:l,initialAgentColor:u,mcpClients:d,dynamicMcpConfig:f,autoConnectIdeFlag:p,strictMcpConfig:m=!1,systemPrompt:h,appendSystemPrompt:g,onBeforeQuery:_,onTurnComplete:v,disabled:y=!1,mainThreadAgentDefinition:b,disableSlashCommands:x=!1,taskListId:S,remoteSessionConfig:C,directConnectConfig:w,sshSession:E,thinkingConfig:D}){let O=!!C,j=(0,Q.useMemo)(()=>c(process.env.CLAUDE_CODE_DISABLE_TERMINAL_TITLE),[]),M=(0,Q.useMemo)(()=>process.env.USER_TYPE===`ant`&&c(process.env.CLAUDE_MORERIGHT),[]),N=(0,Q.useMemo)(()=>c(process.env.CLAUDE_CODE_DISABLE_VIRTUAL_SCROLL),[]);(0,Q.useMemo)(()=>c(process.env.CLAUDE_CODE_DISABLE_MESSAGE_ACTIONS),[]),(0,Q.useEffect)(()=>(K(`[REPL:mount] REPL mounted, disabled=${y}`),()=>K(`[REPL:unmount] REPL unmounting`)),[y]);let[P,ee]=(0,Q.useState)(b),F=X(e=>e.toolPermissionContext),te=X(e=>e.verbose),ne=X(e=>e.mcp),re=X(e=>e.plugins),L=X(e=>e.agentDefinitions),oe=X(e=>e.fileHistory),se=X(e=>e.initialMessage),ue=aD(),de=X(e=>e.spinnerTip),fe=X(e=>e.expandedView)===`tasks`,pe=X(e=>e.pendingWorkerRequest),me=X(e=>e.pendingSandboxRequest),z=X(e=>e.teamContext),B=X(e=>e.tasks),he=X(e=>e.workerSandboxPermissions),ge=X(e=>e.elicitation),_e=X(e=>e.ultraplanPendingChoice),ve=X(e=>e.ultraplanLaunchPending),ye=X(e=>e.viewingAgentTaskId),V=Hc(),be=ye?B[ye]:void 0,xe=oo(be)&&be.retain&&!be.diskLoaded;(0,Q.useEffect)(()=>{if(!ye||!xe)return;let e=ye;_f(gm(e)).then(t=>{V(n=>{let r=n.tasks[e];if(!oo(r)||r.diskLoaded||!r.retain)return n;let i=r.messages??[],a=new Set(i.map(e=>e.uuid)),o=t?t.messages.filter(e=>!a.has(e.uuid)):[];return{...n,tasks:{...n.tasks,[e]:{...r,messages:[...o,...i],diskLoaded:!0}}}})})},[ye,xe,V]);let H=gc(),we=A(),Te=kb(),[Ee,De]=(0,Q.useState)(t);gP(O?void 0:vt(),De);let ke=Q.useSyncExternalStore(VR?.subscribeToProactiveChanges??HR,VR?.isProactiveActive??UR),Ae=Q.useSyncExternalStore(VR?.subscribeToProactiveChanges??HR,VR?.getNextTickAt??WR),je=X(e=>e.isBriefOnly),Pe=(0,Q.useMemo)(()=>Hs(F),[F,ke,je]);wx();let[Ie,Le]=(0,Q.useState)(f),Re=(0,Q.useCallback)(e=>{Le(e)},[Le]),[ze,Ve]=(0,Q.useState)(`prompt`),[Ge,Ke]=(0,Q.useState)(!1),[Je,Ze]=(0,Q.useState)(!1),[Qe,$e]=(0,Q.useState)(``),it=(0,Q.useRef)(0),ot=(0,Q.useRef)(void 0),st=(0,Q.useRef)(!1),{addNotification:ut,removeNotification:dt}=Wp(),mt=GR,ht=mP(d,ne.clients),[gt,_t]=(0,Q.useState)(void 0),[yt,xt]=(0,Q.useState)(null),[Ct,Tt]=(0,Q.useState)(null),[Et,Dt]=(0,Q.useState)(!1),[Ot,kt]=(0,Q.useState)(()=>process.env.USER_TYPE===`ant`?ZR():!1),[jt,Mt]=(0,Q.useState)(()=>LP(Te)),Nt=X(e=>e.showRemoteCallout),[Pt,Ft]=(0,Q.useState)(()=>mS());jI(),PI(),kI({ideSelection:gt,mcpClients:ht,ideInstallationStatus:Ct}),VF({mcpClients:ht}),_I(),vI(),sx(),wI(Te),KI(),TI(Te),DI(),zR(),pF(),CF(),kF(),WF(),VI();let{recommendation:It,handleResponse:Lt}=oI(),{recommendation:Rt,handleResponse:zt}=lI(),Bt=gI(),Vt=(0,Q.useMemo)(()=>[...Pe,...r],[Pe,r]);jy({enabled:!O});let Ht=ou();(0,Q.useEffect)(()=>{O||xI(V)},[V,O]),jF(O?$R:ht,F.mode),VN(V,i,{enabled:!O});let Ut=xb(Vt,ne.tools,F),{tools:Wt,allowedAgentTypes:Gt}=(0,Q.useMemo)(()=>{if(!P)return{tools:Ut,allowedAgentTypes:void 0};let e=rm(P,Ut,!1,!0);return{tools:e.resolvedTools,allowedAgentTypes:e.allowedAgentTypes}},[P,Ut]),Kt=hP(hP(Ee,re.commands),ne.commands),qt=(0,Q.useMemo)(()=>x?[]:Kt,[x,Kt]);TC(O?$R:ne.clients),yP(O?$R:ne.clients,_t);let[Jt,Yt]=(0,Q.useState)(`responding`),Xt=(0,Q.useRef)(Jt);Xt.current=Jt;let[Zt,Qt]=(0,Q.useState)([]),[$t,tn]=(0,Q.useState)(null);(0,Q.useEffect)(()=>{if($t&&!$t.isStreaming&&$t.streamingEndedAt){let e=3e4-(Date.now()-$t.streamingEndedAt);if(e>0){let t=setTimeout(tn,e,null);return()=>clearTimeout(t)}else tn(null)}},[$t]);let[nn,an]=(0,Q.useState)(null),on=(0,Q.useRef)(null);on.current=nn;let sn=(0,Q.useRef)(()=>{}),cn=(0,Q.useRef)(()=>{}),ln=(0,Q.useRef)(null),un=(0,Q.useRef)(null),dn=(0,Q.useRef)(0),fn=Q.useRef(new rC).current,mn=Q.useSyncExternalStore(fn.subscribe,fn.getSnapshot),[hn,gn]=Q.useState(C?.hasInitialPrompt??!1),_n=mn||hn,[vn,yn]=Q.useState(void 0),bn=Q.useRef(0),xn=Q.useRef(!1),Sn=Q.useRef(0),Cn=Q.useRef(0),wn=Q.useRef(null),En=Q.useCallback(()=>{Sn.current=Date.now(),Cn.current=0,wn.current=null},[]),Dn=Q.useRef(!1);mn&&!Dn.current&&En(),Dn.current=mn;let On=Q.useCallback(e=>{gn(e),e&&En()},[En]),kn=Q.useRef(null),An=Q.useRef(void 0),jn=Q.useRef(void 0),[Mn,Nn]=Q.useState(!1),[Pn,Fn]=(0,Q.useState)(null);(0,Q.useEffect)(()=>{Pn?.notifications&&Pn.notifications.forEach(e=>{ut({key:`auto-updater-notification`,text:e,priority:`low`})})},[Pn,ut]),(0,Q.useEffect)(()=>{Sh()&&td().then(e=>{e&&ut({key:`tmux-mouse-hint`,text:e,priority:`low`})})},[]);let[In,Ln]=(0,Q.useState)(!1);(0,Q.useEffect)(()=>{process.env.USER_TYPE===`ant`&&(async()=>{let{isInternalModelRepo:e}=await import(`./commitAttribution-BA4fcbHf.js`);await e();let{shouldShowUndercoverAutoNotice:t}=await import(`./undercover-C_44e3oN.js`);t()&&Ln(!0)})()},[]);let[Rn,zn]=(0,Q.useState)(null),Bn=(0,Q.useRef)(null),Vn=(0,Q.useCallback)(e=>{if(e?.isLocalJSXCommand){let{clearLocalJSX:t,...n}=e;Bn.current={...n,isLocalJSXCommand:!0},zn(n);return}if(Bn.current){if(e?.clearLocalJSX){Bn.current=null,zn(null);return}return}if(e?.clearLocalJSX){zn(null);return}zn(e)},[]),[Hn,Wn]=(0,Q.useState)([]),[Gn,Kn]=(0,Q.useState)(null),[qn,Jn]=(0,Q.useState)([]),[Yn,Xn]=(0,Q.useState)([]),Zn=(0,Q.useRef)(new Map),Qn=X(e=>e.settings.terminalTitleFromRename)===!1?void 0:vp(Fe()),[$n,er]=(0,Q.useState)(),tr=(0,Q.useRef)((i?.length??0)>0),nr=P?.agentType,rr=Qn??nr??$n??`Claude Code`,ir=Hn.length>0||Yn.length>0||pe||me,ar=Rn?.isLocalJSXCommand===!0&&Rn?.jsx!=null,or=_n&&!ir&&!ar;(0,Q.useEffect)(()=>{if(_n&&!ir&&!ar)return XS(),()=>ZS()},[_n,ir,ar]);let sr=ir||ar?`waiting`:_n?`busy`:`idle`,cr=sr===`waiting`?Hn.length>0?`approve ${Hn[0].tool.name}`:pe?`worker request`:me?`sandbox request`:ar?`dialog open`:`input needed`:void 0;(0,Q.useEffect)(()=>{df({status:sr,waitingFor:cr})},[sr,cr]);let lr=Tn(`tengu_terminal_sidebar`,!1)&&(pn().showStatusInTerminalTab??!1);T(j||!lr?null:sr),(0,Q.useEffect)(()=>(us(Wn),()=>gl()),[Wn]);let[W,ur]=(0,Q.useState)(i??[]),dr=(0,Q.useRef)(W),fr=(0,Q.useRef)(!1),G=(0,Q.useCallback)(e=>{let t=dr.current,n=typeof e==`function`?e(dr.current):e;if(dr.current=n,n.length<bn.current)bn.current=0;else if(n.length>t.length&&xn.current){let e=n.length-t.length;(t.length===0||n[0]===t[0]?n.slice(-e):n.slice(0,e)).some(oc)?xn.current=!1:bn.current=n.length}ur(n)},[]),pr=(0,Q.useCallback)(e=>{e===void 0?xn.current=!1:(bn.current=dr.current.length,xn.current=!0),yn(e)},[]),{dividerIndex:mr,dividerYRef:hr,onScrollAway:gr,onRepin:_r,jumpToNew:vr,shiftDivider:xr}=vx(W.length);xF(W,G,_n);let[Sr,Cr]=(0,Q.useState)(null),wr=(0,Q.useRef)(null),Tr=(0,Q.useMemo)(()=>hx(W,mr),[mr,W.length]),Er=(0,Q.useCallback)(()=>{ln.current?.scrollToBottom(),_r(),Cr(null)},[_r,Cr]),Dr=W.at(-1),Or=Dr!=null&&oc(Dr);(0,Q.useEffect)(()=>{Or&&Er()},[Or,Dr,Er]);let{maybeLoadOlder:q}=hN({config:C,setMessages:G,scrollRef:ln,onPrepend:xr}),kr=(0,Q.useCallback)((e,t)=>{dn.current=Date.now(),e?_r():(gr(t),q(t),V(e=>e.companionReaction===void 0?e:{...e,companionReaction:void 0}))},[_r,gr,q,V]),Ar=jN(a,G),J=(0,Q.useDeferredValue)(Q.useMemo(()=>W.length>500?W.slice(-500):W,[W])),jr=W.length-J.length;jr>0&&K(`[useDeferredValue] Messages deferred by ${jr} (${J.length}→${W.length})`);let[Nr,Pr]=(0,Q.useState)(null),[Fr,Ir]=(0,Q.useState)(()=>oS()),Lr=(0,Q.useRef)(Fr);Lr.current=Fr;let Rr=(0,Q.useRef)(null),zr=(0,Q.useCallback)(e=>{mt(Lr.current,e)||(Lr.current===``&&e!==``&&Date.now()-dn.current>=ez&&Er(),Lr.current=e,Ir(e),Nn(e.trim().length>0))},[Nn,Er,mt]);(0,Q.useEffect)(()=>{if(Fr.trim().length===0)return;let e=setTimeout(Nn,1500,!1);return()=>clearTimeout(e)},[Fr]);let[Br,Vr]=(0,Q.useState)(`prompt`),[Hr,Ur]=(0,Q.useState)(),Wr=(0,Q.useCallback)(e=>{let t=new Set(e);De(e=>e.filter(e=>t.has(e.name)||ms.has(e)))},[De]),[Gr,Kr]=(0,Q.useState)(new Set),qr=(0,Q.useRef)(!1),Jr=eN({config:C,setMessages:G,setIsLoading:On,onInit:Wr,setToolUseConfirmQueue:Wn,tools:Vt,setStreamingToolUses:Qt,setStreamMode:Yt,setInProgressToolUseIDs:Kr}),Yr=rN({config:w,setMessages:G,setIsLoading:On,setToolUseConfirmQueue:Wn,tools:Vt}),Xr=iN({session:E,setMessages:G,setIsLoading:On,setToolUseConfirmQueue:Wn,tools:Vt}),Zr=Xr.isRemoteMode?Xr:Yr.isRemoteMode?Yr:Jr,[Qr,ei]=(0,Q.useState)({}),[ti,ni]=(0,Q.useState)(0),ri=(0,Q.useRef)(0),ii=(0,Q.useRef)([]),oi=(0,Q.useCallback)(e=>{let t=ri.current;if(ri.current=e(t),ri.current>t){let e=ii.current;if(e.length>0){let t=e.at(-1);t.lastTokenTime=Date.now(),t.endResponseLength=ri.current}}},[]),[si,ci]=(0,Q.useState)(null),li=!(X(e=>e.settings.prefersReducedMotion)??!1)&&!Se(),ui=(0,Q.useCallback)(e=>{li&&ci(e)},[li]),di=si&&li&&si.substring(0,si.lastIndexOf(`
93
+ `)+1)||null,[fi,pi]=(0,Q.useState)(0),[mi,hi]=(0,Q.useState)(null),[gi,_i]=(0,Q.useState)(null),[vi,yi]=(0,Q.useState)(null),[Si,Ci]=(0,Q.useState)(!1),[wi,Ei]=(0,Q.useState)(void 0),[Di,Oi]=(0,Q.useState)(!1),[ki,Ai]=(0,Q.useState)(jS()),[ji,Mi]=(0,Q.useState)(null),Ni=(0,Q.useRef)(!1),Pi=(0,Q.useRef)(fi);Pi.current=fi;let[Li]=(0,Q.useState)(()=>({current:mm(i,s)}));rp(()=>{Li.current=sf()});let[Ri,zi]=(0,Q.useState)(pn().hasAcknowledgedCostThreshold),[Bi,Vi]=(0,Q.useState)(`INSERT`),[Hi,Ui]=(0,Q.useState)(!1),[Wi,Gi]=(0,Q.useState)(!1),[Ki,qi]=(0,Q.useState)(!1);(0,Q.useEffect)(()=>{_e&&Hi&&Ui(!1)},[_e,Hi]);let Ji=le(),Xi=(0,Q.useRef)(Ji);Xi.current=Ji;let[Zi]=ae(),Qi=Q.useRef(!1),$i=(0,Q.useCallback)(()=>{if(Qi.current)return;Qi.current=!0;let e=dr.current.slice(Ta.current);for(let t of Ag(e))wa.current.add(t);Ta.current=dr.current.length,PF({theme:Zi,readFileState:Ca.current,bashTools:wa.current}).then(async e=>{if(e){let t=await e.content({theme:Zi});V(e=>({...e,spinnerTip:t})),FF(e)}else V(e=>e.spinnerTip===void 0?e:{...e,spinnerTip:void 0})})},[V,Zi]),ea=(0,Q.useCallback)(()=>{On(!1),pr(void 0),ri.current=0,ii.current=[],ci(null),Qt([]),hi(null),_i(null),yi(null),$i(),mv(),yg()},[$i]),ta=(0,Q.useMemo)(()=>Gl(B).some(e=>e.status===`running`),[B]);(0,Q.useEffect)(()=>{if(!ta&&kn.current!==null){let e=Date.now()-kn.current,t=An.current;kn.current=null,An.current=void 0,G(n=>[...n,wg(e,t,xi(n,Ao))])}},[ta,G]);let na=(0,Q.useRef)(!1);(0,Q.useEffect)(()=>{{if(F.mode!==`auto`){na.current=!1;return}if(na.current||(pn().autoPermissionsNotificationCount??0)>=3)return;let e=setTimeout((e,t)=>{e.current=!0,rn(e=>{let t=e.autoPermissionsNotificationCount??0;return t>=3?e:{...e,autoPermissionsNotificationCount:t+1}}),t(e=>[...e,Sd(HF,`warning`)])},800,na,G);return()=>clearTimeout(e)}},[F.mode,G]);let ia=(0,Q.useRef)(!1);(0,Q.useEffect)(()=>{if(ia.current)return;let e=Jg();if(!e?.creationDurationMs||e.usedSparsePaths||e.creationDurationMs<15e3)return;ia.current=!0;let t=Math.round(e.creationDurationMs/1e3);G(e=>[...e,Sd(`Worktree creation took ${t}s. For large repos, set \`worktree.sparsePaths\` in .claude/settings.json to check out only the directories you need — e.g. \`{"worktree": {"sparsePaths": ["src", "packages/foo"]}}\`.`,`info`)])},[G]);let aa=(0,Q.useMemo)(()=>{let e=W.findLast(e=>e.type===`assistant`);if(e?.type!==`assistant`)return!1;let t=e.message?.content,n=(Array.isArray(t)?t:[]).filter(e=>e.type===`tool_use`&&Gr.has(e.id));return n.length>0&&n.every(e=>e.type===`tool_use`&&e.name===`Sleep`)},[W,Gr]),{onBeforeQuery:sa,onTurnComplete:la,render:ua}=ON({enabled:M,setMessages:G,inputValue:Fr,setInputValue:zr,setToolJSX:Vn}),da=(!Rn||Rn.showSpinner===!0)&&Hn.length===0&&Yn.length===0&&(_n||vn||ta||lf()>0)&&!pe&&!aa&&(!di||je),fa=Hn.length>0||Yn.length>0||qn.length>0||ge.queue.length>0||he.queue.length>0,pa=GP(W,_n,ti,`session`,fa),ma=DN(G),ha=oL(W,ti),ga=(0,Q.useMemo)(()=>({...pa,handleSelect:e=>{Na.current=!1;let t=pa.handleSelect(e);e===`bad`&&!t&&YI(`feedback_survey_bad`)&&(Ma(`feedback_survey_bad`),Na.current=!0)}}),[pa]),va=iF(W,_n,fa,{enabled:!O}),ya=$P(W,_n,fa,{enabled:!O}),ba=RR(W,_n,fa,ga.state!==`closed`||va.state!==`closed`||ya.state!==`closed`);AP({autoConnectIdeFlag:p,ideToInstallExtension:yt,setDynamicMcpConfig:Le,setShowIdeOnboarding:Dt,setIDEInstallationState:Tt}),IF(o,oe,e=>V(t=>({...t,fileHistory:e})));let xa=(0,Q.useCallback)(async(t,n,r)=>{let i=performance.now();try{let a=Cd(n.messages);{let t=(Gd(),e(Lh)).matchSessionMode(n.mode);if(t){let{getAgentDefinitionsWithOverrides:n,getActiveAgentsFromList:r}=(zm(),e(cg));n.cache.clear?.();let i=await n(ft());V(e=>({...e,agentDefinitions:{...i,allAgents:i.allAgents,activeAgents:r(i.allAgents)}})),a.push(Sd(t,`warning`))}}let o=_g();await Zu(`resume`,{getAppState:()=>H.getState(),setAppState:V,signal:AbortSignal.timeout(o),timeoutMs:o});let s=await Ja(`resume`,{sessionId:t,agentType:P?.agentType,model:Te});a.push(...s),r===`fork`?vs(n,lp(t)):tc(n,lp(t)),lb(n,V),n.fileHistorySnapshots&&xh(n);let{agentDefinition:c}=sb(n.agentSetting,b,L);ee(c),V(e=>({...e,agent:c?.agentType})),V(e=>({...e,standaloneAgentContext:cb(n.agentName,n.agentColor)})),oh(n.agentName),Oa(a,n.projectPath??ft()),ea(),an(null),Ai(t);let l=ip(t);n_(),St(),lt(lp(t),n.fullPath?SS(n.fullPath):null);let{renameRecordingForSession:u}=await import(`./asciicast-aoKFhc7C.js`);if(await u(),await pf(),Im(),Wf(n),tr.current=!0,er(void 0),r!==`fork`)ub(),db(n.worktreeSession),Yu(),Ff({abortController:new AbortController,getAppState:()=>H.getState(),setAppState:V});else{let e=Jg();e&&Kg(e)}{let{saveMode:t}=(_a(),e(Pg)),{isCoordinatorMode:n}=(Gd(),e(Lh));t(n()?`coordinator`:`normal`)}l&&ct(l),Li.current&&r!==`fork`&&(Li.current=sp(a,n.contentReplacements??[])),G(()=>a),Vn(null),zr(``),Y(`tengu_session_resumed`,{entrypoint:r,success:!0,resume_duration_ms:Math.round(performance.now()-i)})}catch(e){throw Y(`tengu_session_resumed`,{entrypoint:r,success:!1}),e}},[ea,V]),[Sa]=(0,Q.useState)(()=>Z_(100)),Ca=(0,Q.useRef)(Sa),wa=(0,Q.useRef)(new Set),Ta=(0,Q.useRef)(0),Ea=(0,Q.useRef)(new Set),Da=(0,Q.useRef)(new Set),Oa=(0,Q.useCallback)((e,t)=>{let n=Rl(e,t,100);Ca.current=$_(Ca.current,n);for(let t of Ag(e))wa.current.add(t)},[]);(0,Q.useEffect)(()=>{i&&i.length>0&&(Oa(i,ft()),Ff({abortController:new AbortController,getAppState:()=>H.getState(),setAppState:V}))},[]);let{status:ka,reverify:Aa}=MN(),[ja,Ma]=(0,Q.useState)(null),Na=(0,Q.useRef)(!1),[Fa,Ia]=(0,Q.useState)(null),[La,Ra]=(0,Q.useState)(!1),za=!_n&&Di;function Va(){if(La||Fa)return;if(Si)return`message-selector`;if(Mn)return;if(qn[0])return`sandbox-permission`;let e=!Rn||Rn.shouldContinueAnimation;if(e&&Hn[0])return`tool-permission`;if(e&&Yn[0])return`prompt`;if(e&&he.queue[0])return`worker-sandbox-permission`;if(e&&ge.queue[0])return`elicitation`;if(e&&za)return`cost`;if(e&&ji)return`idle-return`;if(e&&!_n&&_e)return`ultraplan-choice`;if(e&&!_n&&ve)return`ultraplan-launch`;if(e&&Et)return`ide-onboarding`;if(process.env.USER_TYPE===`ant`&&e&&Ot)return`model-switch`;if(process.env.USER_TYPE===`ant`&&e&&In)return`undercover-callout`;if(e&&jt)return`effort-callout`;if(e&&Nt)return`remote-callout`;if(e&&It)return`lsp-recommendation`;if(e&&Rt)return`plugin-hint`;if(e&&Bt.visible)return`search-extra-tools-hint`;if(e&&Pt)return`desktop-upsell`}let Ha=Va(),Ua=Mn&&(qn[0]||Hn[0]||Yn[0]||he.queue[0]||ge.queue[0]||za);jn.current=Ha,(0,Q.useEffect)(()=>{if(!_n)return;let e=Ha===`tool-permission`,t=Date.now();e&&wn.current===null?wn.current=t:!e&&wn.current!==null&&(Cn.current+=t-wn.current,wn.current=null)},[Ha,_n]);let Wa=(0,Q.useRef)(Ha);(0,Q.useLayoutEffect)(()=>{Wa.current===`tool-permission`!=(Ha===`tool-permission`)&&Er(),Wa.current=Ha},[Ha,Er]);function Ga(){if(Ha!==`elicitation`){if(K(`[onCancel] focusedInputDialog=${Ha} streamMode=${Jt}`),VR?.pauseProactive(),fn.forceEnd(),Ni.current=!1,si?.trim()&&G(e=>[...e,dm({content:si})]),ea(),Ne(null),Ha===`tool-permission`)Hn[0]?.onAbort(),Wn([]);else if(Ha===`prompt`){for(let e of Yn)e.reject(Error(`Prompt cancelled by user`));Xn([]),nn?.abort(`user-cancel`)}else Zr.isRemoteMode?Zr.cancelRequest():nn?.abort(`user-cancel`);an(null),la(dr.current,!0)}}let Ka=(0,Q.useCallback)(()=>{let e=e_(Fr,0);e&&(zr(e.text),Vr(`prompt`),e.images.length>0&&ei(t=>{let n={...t};for(let t of e.images)n[t.id]=t;return n}))},[zr,Vr,Fr,ei]),qa={setToolUseConfirmQueue:Wn,onCancel:Ga,onAgentsKilled:()=>G(e=>[...e,Xm()]),isMessageSelectorVisible:Si||!!Hi,screen:ze,abortSignal:nn?.signal,popCommandFromQueue:Ka,vimMode:Bi,isLocalJSXCommand:Rn?.isLocalJSXCommand,isSearchingHistory:Wi,isHelpOpen:Ki,inputMode:Br,inputValue:Fr,streamMode:Jt};(0,Q.useEffect)(()=>{Ue()>=5&&!Di&&!Ri&&(Y(`tengu_cost_threshold_reached`,{}),zi(!0),en()&&Oi(!0))},[W,Di,Ri]);let Ya=(0,Q.useCallback)(async e=>{if(Un()&&Fu()){let t=Es(),n=await Yi(e.host,t);return new Promise(r=>{if(!n){Jn(t=>[...t,{hostPattern:e,resolvePromise:r}]);return}Ls({requestId:t,host:e.host,resolve:r}),V(n=>({...n,pendingSandboxRequest:{requestId:t,host:e.host}}))})}return new Promise(t=>{let n=!1;function r(e){n||(n=!0,t(e))}Jn(t=>[...t,{hostPattern:e,resolvePromise:r}]);{let t=H.getState().replBridgePermissionCallbacks;if(t){let n=jS();t.sendRequest(n,Jy,{host:e.host},jS(),`Allow network connection to ${e.host}?`);let r=t.onResponse(n,t=>{r();let n=t.behavior===`allow`;Jn(t=>(t.filter(t=>t.hostPattern.host===e.host).forEach(e=>e.resolvePromise(n)),t.filter(t=>t.hostPattern.host!==e.host)));let i=Zn.current.get(e.host);if(i){for(let e of i)e();Zn.current.delete(e.host)}}),i=()=>{r(),t.cancelRequest(n)},a=Zn.current.get(e.host)??[];a.push(i),Zn.current.set(e.host,a)}}})},[V,H]);(0,Q.useEffect)(()=>{let e=qh.getSandboxUnavailableReason();if(e){if(qh.isSandboxRequired()){process.stderr.write(`\nError: sandbox required but unavailable: ${e}\n sandbox.failIfUnavailable is set — refusing to start without a working sandbox.\n\n`),Is(1,`other`);return}K(`sandbox disabled: ${e}`,{level:`warn`}),ut({key:`sandbox-unavailable`,jsx:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(R,{color:`warning`,children:`sandbox disabled`}),(0,$.jsx)(R,{dimColor:!0,children:` · /sandbox`})]}),priority:`medium`})}},[ut]),qh.isSandboxingEnabled()&&qh.initialize(Ya).catch(e=>{process.stderr.write(`\n❌ Sandbox Error: ${br(e)}\n`),Is(1,`other`)});let Xa=(0,Q.useCallback)((e,t)=>{V(n=>({...n,toolPermissionContext:{...e,mode:t?.preserveMode?n.toolPermissionContext.mode:e.mode}})),setImmediate(e=>{e(e=>(e.forEach(e=>{e.recheckPermission()}),e))},Wn)},[V,Wn]);(0,Q.useEffect)(()=>(wo(Xa),()=>Ks()),[Xa]);let Za=aP(Wn,Xa),Qa=(0,Q.useCallback)((e,t,r,i)=>{let a=H.getState(),o=()=>{let e=H.getState(),t=Yy(Vt,nu(e.toolPermissionContext,e.mcp.tools),e.toolPermissionContext.mode);return P?rm(P,t,!1,!0).resolvedTools:t};return{abortController:r,options:{commands:qt,tools:o(),debug:n,verbose:a.verbose,mainLoopModel:i,thinkingConfig:a.thinkingEnabled===!1?{type:`disabled`}:D,mcpClients:pP(d,a.mcp.clients),mcpResources:a.mcp.resources,ideInstallationStatus:Ct,isNonInteractiveSession:!1,dynamicMcpConfig:Ie,theme:Zi,agentDefinitions:Gt?{...a.agentDefinitions,allowedAgentTypes:Gt}:a.agentDefinitions,customSystemPrompt:h,appendSystemPrompt:g,refreshTools:o},getAppState:()=>H.getState(),setAppState:V,messages:e,setMessages:G,updateFileHistoryState(e){V(t=>{let n=e(t.fileHistory);return n===t.fileHistory?t:{...t,fileHistory:n}})},updateAttributionState(e){V(t=>{let n=e(t.attribution);return n===t.attribution?t:{...t,attribution:n}})},openMessageSelector:()=>{y||Ci(!0)},onChangeAPIKey:Aa,readFileState:Ca.current,setToolJSX:Vn,addNotification:ut,appendSystemMessage:e=>G(t=>[...t,e]),sendOSNotification:e=>{ah(e,we)},onChangeDynamicMcpConfig:Re,onInstallIDEExtension:xt,nestedMemoryAttachmentTriggers:new Set,loadedNestedMemoryPaths:Da.current,dynamicSkillDirTriggers:new Set,discoveredSkillNames:Ea.current,setResponseLength:oi,pushApiMetricsEntry:process.env.USER_TYPE===`ant`?e=>{let t=Date.now(),n=ri.current;ii.current.push({ttftMs:e,firstTokenTime:t,lastTokenTime:t,responseLengthBaseline:n,endResponseLength:n})}:void 0,setStreamMode:Yt,onCompactProgress:e=>{switch(e.type){case`hooks_start`:_i(`claudeBlue_FOR_SYSTEM_SPINNER`),yi(`claudeBlueShimmer_FOR_SYSTEM_SPINNER`),hi(e.hookType===`pre_compact`?`Running PreCompact hooks…`:e.hookType===`post_compact`?`Running PostCompact hooks…`:`Running SessionStart hooks…`);break;case`compact_start`:hi(`Compacting conversation`);break;case`compact_end`:hi(null),_i(null),yi(null);break}},setInProgressToolUseIDs:Kr,setHasInterruptibleToolInProgress:e=>{qr.current=e},resume:xa,setConversationId:Ai,requestPrompt:void 0,contentReplacementState:Li.current}},[qt,Vt,P,n,d,Ct,Ie,Zi,Gt,H,V,Aa,ut,G,Re,xa,(0,Q.useCallback)((e,t)=>n=>new Promise((r,i)=>{Xn(a=>[...a,{request:n,title:e,toolInputSummary:t,resolve:r,reject:i}])}),[]),y,h,g,Ai]),{handleBackgroundSession:$a}=MP({setMessages:G,setIsLoading:On,resetLoadingState:ea,setAbortController:an,onBackgroundQuery:(0,Q.useCallback)(()=>{nn?.abort(`background`);let e=Bd(e=>e.mode===`task-notification`);(async()=>{let t=Qa(dr.current,[],new AbortController,Te),[n,r,i]=await Promise.all([vf(t.options.tools,Te,Array.from(F.additionalWorkingDirectories.keys()),t.options.mcpClients),Gf(),mf()]),a=Df({mainThreadAgentDefinition:P,toolUseContext:t,customSystemPrompt:h,defaultSystemPrompt:n,appendSystemPrompt:g});t.renderedSystemPrompt=a;let o=(await jc(e).catch(()=>[])).map(po),s=new Set;for(let e of dr.current)e.type===`attachment`&&e.attachment.type===`queued_command`&&e.attachment.commandMode===`task-notification`&&typeof e.attachment.prompt==`string`&&s.add(e.attachment.prompt);let c=o.filter(e=>e.attachment.type===`queued_command`&&(typeof e.attachment.prompt!=`string`||!s.has(e.attachment.prompt)));Dh({messages:[...dr.current,...c],queryParams:{systemPrompt:a,userContext:r,systemContext:i,canUseTool:Za,toolUseContext:t,querySource:zf()},description:rr,setAppState:V,agentDefinition:P})})()},[nn,Te,F,P,Qa,h,g,Za,V])}),eo=(0,Q.useCallback)(e=>{Jc(e,e=>{Cl(e)?(Sh()?G(t=>{let n=Fc(t,{includeSnipped:!0});return[...n.length>500?n.slice(-500):n,e]}):G(()=>[e]),Ai(jS()),VR?.setContextBlocked(!1)):e.type===`progress`&&Tc(e.data?.type)?G(t=>{let n=e.data;for(let r=t.length-1;r>=0;r--){let i=t[r];if(i.type!==`progress`)break;let a=i.data;if(i.parentToolUseID===e.parentToolUseID&&a?.type===n.type){let n=t.slice();return n[r]=e,n}}return[...t,e]}):G(t=>[...t,e]),e.type===`assistant`&&`isApiErrorMessage`in e&&e.isApiErrorMessage?VR?.setContextBlocked(!0):e.type===`assistant`&&VR?.setContextBlocked(!1)},e=>{oi(t=>t+e.length)},Yt,Qt,e=>{G(t=>t.filter(t=>t!==e)),$d(e.uuid)},tn,e=>{let t=Date.now(),n=ri.current;ii.current.push({...e,firstTokenTime:t,lastTokenTime:t,responseLengthBaseline:n,endResponseLength:n})},ui)},[G,oi,Yt,Qt,tn,ui]),to=(0,Q.useCallback)(async(e,t,n,r,i,a,o)=>{if(r){let e=pP(d,H.getState().mcp.clients);Ys.handleQueryStart(e);let t=hh(e);t&&Jl(t)}if(Qv(),!j&&!Qn&&!nr&&!tr.current){let e=t.find(e=>e.type===`user`&&!e.isMeta),n=e?.type===`user`?go(e.message.content):null;n&&!n.startsWith(`<local-command-stdout>`)&&!n.startsWith(`<command-message>`)&&!n.startsWith(`<command-name>`)&&!n.startsWith(`<bash-input>`)&&(tr.current=!0,wy(n,new AbortController().signal).then(e=>{e?er(e):tr.current=!1},()=>{tr.current=!1}))}if(H.setState(e=>{let t=e.toolPermissionContext.alwaysAllowRules.command;return t===i||t?.length===i.length&&t.every((e,t)=>e===i[t])?e:{...e,toolPermissionContext:{...e.toolPermissionContext,alwaysAllowRules:{...e.toolPermissionContext.alwaysAllowRules,command:i}}}}),!r){t.some(Cl)&&(Ai(jS()),VR?.setContextBlocked(!1)),ea(),an(null);return}let s=Qa(e,t,n,a),{tools:c,mcpClients:l}=s.options;if(o!==void 0){let e=s.getAppState;s.getAppState=()=>({...e(),effortValue:o})}Op(`query_context_loading_start`);let[,,u,f,p]=await Promise.all([void 0,Ex(F,V,H.getState().fastMode),vf(c,a,Array.from(F.additionalWorkingDirectories.keys()),l),Gf(),mf()]),m={...f,...BR(l,p_()?ko():void 0),...VR?.isProactiveActive()&&!Xi.current?{terminalFocus:`The terminal is unfocused — the user is not actively watching.`}:{}};Op(`query_context_loading_end`);let _=Df({mainThreadAgentDefinition:P,toolUseContext:s,customSystemPrompt:h,defaultSystemPrompt:u,appendSystemPrompt:g});s.renderedSystemPrompt=_,Op(`query_query_start`),bt(),Xe(),at();for await(let t of hs({messages:e,systemPrompt:_,userContext:m,systemContext:p,canUseTool:Za,toolUseContext:s,querySource:zf()}))eo(t);if(typeof globalThis.fireCompanionObserver==`function`){let e=globalThis.fireCompanionObserver;e(dr.current,e=>V(t=>t.companionReaction===e?t:{...t,companionReaction:e}))}if(Op(`query_end`),process.env.USER_TYPE===`ant`&&ii.current.length>0){let e=ii.current,t=e.map(e=>e.ttftMs),n=e.map(e=>{let t=Math.round((e.endResponseLength-e.responseLengthBaseline)/4),n=e.lastTokenTime-e.firstTokenTime;return n>0?Math.round(t/(n/1e3)):0}),r=e.length>1,i=nt(),a=Be(),o=qe(),s=rt(),c=pt(),l=He(),u=Date.now()-Sn.current;G(e=>[...e,Gh({ttftMs:r?tz(t):t[0],otps:r?tz(n):n[0],isP50:r,hookDurationMs:i>0?i:void 0,hookCount:a>0?a:void 0,turnDurationMs:u>0?u:void 0,toolDurationMs:o>0?o:void 0,toolCount:s>0?s:void 0,classifierDurationMs:c>0?c:void 0,classifierCount:l>0?l:void 0,configWriteCount:At()})])}ea(),Mh(),await v?.(dr.current)},[d,ea,Qa,F,V,h,v,g,Za,P,eo,Qn,j]),no=(0,Q.useCallback)(async(e,t,n,r,i,a,o,s)=>{if(Un()){let e=bi(),t=Ti();e&&t&&Rv(e,t,!0)}let c=fn.tryStart();if(c===null)return Y(`tengu_concurrent_onquery_detected`,{}),e.filter(e=>e.type===`user`&&!e.isMeta).map(e=>go(e.message.content)).filter(e=>e!==null).forEach((e,t)=>{Kd({value:e,mode:`prompt`}),t===0&&Y(`tengu_concurrent_onquery_enqueued`,{})}),!1;try{jo.current=!1,En(),G(t=>[...t,...e]),ri.current=0,Ne((o?$l(o):null)??Me()),ii.current=[],Qt([]),ci(null);let c=dr.current;if(o&&await sa(o,c,e.length),a&&o&&!await a(o,c))return!0;try{await to(c,e,t,n,r,i,s)}catch(e){throw e}}finally{if(fn.end(c)){pi(Date.now()),Ni.current=!1,ea(),await la(dr.current,t.signal.aborted),sn.current(),process.env.USER_TYPE===`ant`&&!t.signal.aborted&&V(e=>e.tungstenActiveSession===void 0||e.tungstenPanelAutoHidden===!0?e:{...e,tungstenPanelAutoHidden:!0});let e;Me()!==null&&Me()>0&&!t.signal.aborted&&(e={tokens:tt(),limit:Me(),nudges:Ye()}),Ne(null);let n=Date.now()-Sn.current-Cn.current;(n>3e4||e!==void 0)&&!t.signal.aborted&&!ke&&(Gl(H.getState().tasks).some(e=>e.status===`running`)?(kn.current===null&&(kn.current=Sn.current),e&&(An.current=e)):G(t=>[...t,wg(n,e,xi(t,Ao))])),an(null)}if(t.signal.reason===`user-cancel`&&!fn.isActive&&Lr.current===``&&lf()===0&&!H.getState().viewingAgentTaskId){let e=dr.current,t=e.findLast(Zy);t&&$y(e,e.lastIndexOf(t))&&(_d(),cn.current(t))}}return!0},[to,V,ea,fn,sa,la]),ro=(0,Q.useRef)(!1);(0,Q.useEffect)(()=>{let e=se;if(!e||_n||ro.current)return;ro.current=!0;async function t(e){if(e.clearContext){let t=e.message.planContent?Pa():void 0,{clearConversation:n}=await import(`./conversation-cUxdb8MN.js`);await n({setMessages:G,readFileState:Ca.current,discoveredSkillNames:Ea.current,loadedNestedMemoryPaths:Da.current,getAppState:()=>H.getState(),setAppState:V,setConversationId:Ai}),tr.current=!1,er(void 0),wa.current.clear(),Ta.current=0,t&&ru(Fe(),t)}V(t=>{let n=e.mode?Jh(t.toolPermissionContext,RT(e.mode,e.allowedPrompts)):t.toolPermissionContext;return e.mode===`auto`&&(n=Bc({...n,mode:`auto`,prePlanMode:void 0})),{...t,initialMessage:null,toolPermissionContext:n}}),$u()&&ll(e=>{V(t=>({...t,fileHistory:e(t.fileHistory)}))},e.message.uuid),await Ar();let t=e.message.message.content;if(typeof t==`string`&&!e.message.planContent)io(t,{setCursorOffset:()=>{},clearBuffer:()=>{},resetHistory:()=>{}});else{let t=kl();an(t),no([e.message],t,!0,[],Te)}setTimeout(e=>{e.current=!1},100,ro)}t(e)},[se,_n,G,V,no,Te,Wt]);let io=(0,Q.useCallback)(async(e,t,n,r)=>{if(Er(),VR?.resumeProactive(),No(e)){let n=Ud({content:e});G(e=>[...e,n]),r?.fromKeybinding||qd({display:Ba(e,Br),pastedContents:Qr}),zr(``),t.setCursorOffset(0),t.clearBuffer(),ei({}),Vr(`prompt`),_t(void 0);return}if(!n&&e.trim().startsWith(`/`)){let n=nm(e,Qr).trim(),i=n.indexOf(` `),a=i===-1?n.slice(1):n.slice(1,i),o=i===-1?``:n.slice(i+1).trim(),s=qt.find(e=>pg(e)&&(e.name===a||e.aliases?.includes(a)||im(e)===a));s?.name===`clear`&&fr.current&&(Y(`tengu_idle_return_action`,{action:`hint_converted`,variant:fr.current,idleMinutes:Math.round((Date.now()-Pi.current)/6e4),messageCount:dr.current.length,totalInputTokens:wt()}),fr.current=!1);let c=fn.isActive&&(s?.immediate||r?.fromKeybinding);if(s&&c&&s.type===`local-jsx`){e.trim()===Lr.current.trim()&&(zr(``),t.setCursorOffset(0),t.clearBuffer(),ei({}));let n=ep(e).filter(e=>Qr[e.id]?.type===`text`),i=n.length;Y(`tengu_paste_text`,{pastedTextCount:i,pastedTextBytes:n.reduce((e,t)=>e+(Qr[t.id]?.content.length??0),0)}),Y(`tengu_immediate_command_executed`,{commandName:s.name,fromKeybinding:r?.fromKeybinding??!1}),(async()=>{let e=!1,n=(n,r)=>{e=!0,Vn({jsx:null,shouldHidePromptInput:!1,clearLocalJSX:!0});let i=[];n&&r?.display!==`skip`&&(ut({key:`immediate-${s.name}`,text:n,priority:`immediate`}),Sh()||i.push(qf(Fg(im(s),o)),qf(`<${$r}>${q_(n)}</${$r}>`))),r?.metaMessages?.length&&i.push(...r.metaMessages.map(e=>Ud({content:e,isMeta:!0}))),i.length&&G(e=>[...e,...i]),Hr!==void 0&&(zr(Hr.text),t.setCursorOffset(Hr.cursorOffset),ei(Hr.pastedContents),Ur(void 0))},r=Qa(dr.current,[],kl(),Te),i=await(await s.load()).call(n,r,o);i&&!e&&Vn({jsx:i,shouldHidePromptInput:!1,isLocalJSXCommand:!0})})();return}}if(Zr.isRemoteMode&&!e.trim())return;{let r=Tn(`tengu_willow_mode`,`off`),i=Number(process.env.CLAUDE_CODE_IDLE_THRESHOLD_MINUTES??75),a=Number(process.env.CLAUDE_CODE_IDLE_TOKEN_THRESHOLD??1e5);if(r!==`off`&&!pn().idleReturnDismissed&&!Ni.current&&!n&&!e.trim().startsWith(`/`)&&Pi.current>0&&wt()>=a){let n=(Date.now()-Pi.current)/6e4;if(n>=i&&r===`dialog`){Mi({input:e,idleMinutes:n}),zr(``),t.setCursorOffset(0),t.clearBuffer();return}}}r?.fromKeybinding||(qd({display:n?e:Ba(e,Br),pastedContents:n?{}:Qr}),Br===`bash`&&VO(e.trim()));let i=!n&&e.trim().startsWith(`/`),a=!_n||n||Zr.isRemoteMode;if(Hr!==void 0&&!i&&a?(zr(Hr.text),t.setCursorOffset(Hr.cursorOffset),ei(Hr.pastedContents),Ur(void 0)):a&&(r?.fromKeybinding||(zr(``),t.setCursorOffset(0)),ei({})),a&&(Vr(`prompt`),_t(void 0),ni(e=>e+1),t.clearBuffer(),Qi.current=!1,!i&&Br===`prompt`&&!n&&!Zr.isRemoteMode&&(pr(e),En()),V(e=>({...e,attribution:yv(e.attribution,e=>{ra(e).catch(e=>{K(`Attribution: Failed to save snapshot: ${e}`)})})}))),n){let{queryRequired:t}=await Al(n.state,n.speculationSessionTimeSavedMs,n.setAppState,e,{setMessages:G,readFileState:Ca,cwd:ft()});if(t){let e=kl();an(e),no([],e,!0,[],Te)}return}if(Zr.isRemoteMode&&!(i&&qt.find(t=>{let n=e.trim().slice(1).split(/\s/)[0];return pg(t)&&(t.name===n||t.aliases?.includes(n)||im(t)===n)})?.type===`local-jsx`)){let t=Object.values(Qr),n=t.filter(e=>e.type===`image`),r=n.length>0?n.map(e=>e.id):void 0,i=e.trim(),a=e.trim();if(t.length>0){let n=[],r=[],o=e.trim();o&&(n.push({type:`text`,text:o}),r.push({type:`text`,text:o}));for(let e of t)if(e.type===`image`){let t={type:`base64`,media_type:e.mediaType??`image/png`,data:e.content};n.push({type:`image`,source:t}),r.push({type:`image`,source:t})}else n.push({type:`text`,text:e.content}),r.push({type:`text`,text:e.content});i=n,a=r}let o=Ud({content:i,imagePasteIds:r});G(e=>[...e,o]),await Zr.sendMessage(a,{uuid:o.uuid});return}await Ar(),await sP({input:e,helpers:t,queryGuard:fn,isExternalLoading:hn,mode:Br,commands:qt,onInputChange:zr,setPastedContents:ei,setToolJSX:Vn,getToolUseContext:Qa,messages:dr.current,mainLoopModel:Te,pastedContents:Qr,ideSelection:gt,setUserInputOnProcessing:pr,setAbortController:an,abortController:nn,onQuery:no,setAppState:V,querySource:zf(),onBeforeQuery:_,canUseTool:Za,addNotification:ut,setMessages:G,streamMode:Xt.current,hasInterruptibleToolInProgress:qr.current}),(i||_n)&&Hr!==void 0&&(zr(Hr.text),t.setCursorOffset(Hr.cursorOffset),ei(Hr.pastedContents),Ur(void 0))},[fn,_n,hn,Br,qt,zr,Vr,ei,ni,_t,Vn,Qa,Te,Qr,gt,pr,an,ut,no,Hr,Ur,V,_,Za,Jr,G,Ar,Er]),ao=(0,Q.useCallback)(async(e,t,n)=>{oo(t)?(Wl(t.id,Ud({content:e}),V),t.status===`running`?Bp(t.id,e,V):dd({agentId:t.id,prompt:e,toolUseContext:Qa(dr.current,[],new AbortController,Te),canUseTool:Za}).catch(e=>{K(`resumeAgentBackground failed: ${br(e)}`),ut({key:`resume-agent-failed-${t.id}`,jsx:(0,$.jsxs)(R,{color:`error`,children:[`Failed to resume agent: `,br(e)]}),priority:`low`})})):zc(t.id,e,void 0,V),zr(``),n.setCursorOffset(0),n.clearBuffer()},[V,zr,Qa,Za,Te,ut]),so=(0,Q.useCallback)(()=>{let e=ja?XI(ja):`/issue`;Ma(null),io(e,{setCursorOffset:()=>{},clearBuffer:()=>{},resetHistory:()=>{}}).catch(t=>{K(`Auto-run ${e} failed: ${br(t)}`)})},[io,ja]),co=(0,Q.useCallback)(()=>{Ma(null)},[]),lo=(0,Q.useCallback)(()=>{io(process.env.USER_TYPE===`ant`?`/issue`:`/feedback`,{setCursorOffset:()=>{},clearBuffer:()=>{},resetHistory:()=>{}}).catch(e=>{K(`Survey feedback request failed: ${e instanceof Error?e.message:String(e)}`)})},[io]),uo=(0,Q.useRef)(io);uo.current=io;let fo=(0,Q.useCallback)(()=>{uo.current(`/rate-limit-options`,{setCursorOffset:()=>{},clearBuffer:()=>{},resetHistory:()=>{}})},[]),mo=(0,Q.useCallback)(async()=>{if(Ra(!0),om()){IS(`tmux`,[`detach-client`],{stdio:`ignore`}),Ra(!1);return}if(Jg()!==null){Ia((0,$.jsx)(fx,{showWorktree:!0,onDone:()=>{},onCancel:()=>{Ia(null),Ra(!1)}}));return}let e=await(await ih.load()).call(()=>{});Ia(e),e===null&&Ra(!1)},[]),ho=(0,Q.useCallback)(()=>{Ci(e=>!e)},[]),_o=(0,Q.useCallback)(e=>{let t=dr.current,n=t.lastIndexOf(e);if(n===-1)return;Y(`tengu_conversation_rewind`,{preRewindMessageCount:t.length,postRewindMessageCount:n,messagesRemoved:t.length-n,rewindToMessageIndex:n}),G(t.slice(0,n)),Ai(jS()),Mc();let r=e.permissionMode;V(e=>({...e,toolPermissionContext:r&&e.toolPermissionContext.mode!==r?{...e.toolPermissionContext,mode:r}:e.toolPermissionContext,promptSuggestion:{text:null,promptId:null,shownAt:0,acceptedAt:0,generationRequestId:null}}))},[G,V]),vo=(0,Q.useCallback)(e=>{_o(e);let t=al(e);if(t&&(zr(t.text),Vr(t.mode)),Array.isArray(e.message.content)&&e.message.content.some(e=>e.type===`image`)){let t=e.message.content.filter(e=>e.type===`image`);if(t.length>0){let n={};t.forEach((t,r)=>{if(t.source.type===`base64`){let i=e.imagePasteIds?.[r]??r+1;n[i]={id:i,type:`image`,content:t.source.data,mediaType:t.source.media_type}}}),ei(n)}}},[_o,zr]);cn.current=vo;let yo=(0,Q.useCallback)(async e=>{setImmediate((e,t)=>e(t),vo,e)},[vo]),bo=e=>{let t=e.slice(0,24);return W.findIndex(e=>e.uuid.slice(0,24)===t)},{enter:xo,handlers:So}=ed(Sr,Cr,wr,{copy:e=>void Ce(e).then(e=>{e&&process.stdout.write(e),ut({key:`selection-copied`,text:`copied`,color:`success`,priority:`immediate`,timeoutMs:2e3})}),edit:async e=>{let t=bo(e.uuid),n=t>=0?W[t]:void 0;if(!n||!Zy(n))return;let r=!await fd(oe,n.uuid),i=$y(W,t);r&&i?(Ga(),yo(n)):(Ei(n),Ci(!0))}});async function Co(){Aa();let e=await t_();if(e.length>0){let t=e.map(e=>` [${e.type}] ${e.path} (${e.content.length} chars)${e.parent?` (included by ${e.parent})`:``}`).join(`
94
94
  `);K(`Loaded ${e.length} CLAUDE.md/rules files:\n${t}`)}else K(`No CLAUDE.md/rules files found`);for(let t of e)Ca.current.set(t.path,{content:t.contentDiffersFromDisk?t.rawContent??t.content:t.content,timestamp:Date.now(),offset:void 0,limit:void 0,isPartialView:t.contentDiffersFromDisk})}kN(aS()),oC(W,W.length===i?.length);let{sendBridgeResult:To}=CC(W,G,on,qt,Te);sn.current=To,AN();let Eo=(0,Q.useRef)(!1);(0,Q.useEffect)(()=>{if(ue.length<1){Eo.current=!1;return}Eo.current||(Eo.current=!0,rn(e=>({...e,promptQueueUseCount:(e.promptQueueUseCount??0)+1})))},[ue.length]),dP({executeQueuedInput:(0,Q.useCallback)(async e=>{await sP({helpers:{setCursorOffset:()=>{},clearBuffer:()=>{},resetHistory:()=>{}},queryGuard:fn,commands:qt,onInputChange:()=>{},setPastedContents:()=>{},setToolJSX:Vn,getToolUseContext:Qa,messages:W,mainLoopModel:Te,ideSelection:gt,setUserInputOnProcessing:pr,setAbortController:an,onQuery:no,setAppState:V,querySource:zf(),onBeforeQuery:_,canUseTool:Za,addNotification:ut,setMessages:G,queuedCommands:e})},[fn,qt,Vn,Qa,W,Te,gt,pr,Za,an,no,ut,V,_]),hasActiveLocalJsxUI:ar,queryGuard:fn}),(0,Q.useEffect)(()=>{Ef.recordUserActivity(),We(!0)},[Fr,ti]),(0,Q.useEffect)(()=>{ti===1&&_S()},[ti]),(0,Q.useEffect)(()=>{if(_n||ti===0||fi===0)return;let e=setTimeout((e,t,n,r,i)=>{if(et()>e)return;let a=Date.now()-e;!t&&!n&&r.current===void 0&&a>=pn().messageIdleNotifThresholdMs&&ah({message:`Claude is waiting for your input`,notificationType:`idle_prompt`},i)},pn().messageIdleNotifThresholdMs,fi,_n,Rn,jn,we);return()=>clearTimeout(e)},[_n,Rn,ti,fi,we]),(0,Q.useEffect)(()=>{if(fi===0||_n)return;let e=Tn(`tengu_willow_mode`,`off`);if(e!==`hint`&&e!==`hint_v2`||pn().idleReturnDismissed)return;let t=Number(process.env.CLAUDE_CODE_IDLE_TOKEN_THRESHOLD??1e5);if(wt()<t)return;let n=Number(process.env.CLAUDE_CODE_IDLE_THRESHOLD_MINUTES??75)*6e4-(Date.now()-fi),r=setTimeout((e,t,n,r,i)=>{if(n.current.length===0)return;let a=wt(),o=Ii(a),s=(Date.now()-e)/6e4;t({key:`idle-return-hint`,jsx:r===`hint_v2`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(R,{dimColor:!0,children:`new task? `}),(0,$.jsx)(R,{color:`suggestion`,children:`/clear`}),(0,$.jsx)(R,{dimColor:!0,children:` to save `}),(0,$.jsxs)(R,{color:`suggestion`,children:[o,` tokens`]})]}):(0,$.jsxs)(R,{color:`warning`,children:[`new task? /clear to save `,o,` tokens`]}),priority:`medium`,timeoutMs:2147483647}),i.current=r,Y(`tengu_idle_return_action`,{action:`hint_shown`,variant:r,idleMinutes:Math.round(s),messageCount:n.current.length,totalInputTokens:a})},Math.max(0,n),fi,ut,dr,e,fr);return()=>{clearTimeout(r),dt(`idle-return-hint`),fr.current=!1}},[fi,_n,ut,dt]);let Do=(0,Q.useCallback)((e,t)=>{if(fn.isActive||dg().some(e=>e.mode===`prompt`||e.mode===`bash`))return!1;let n=typeof e==`string`?{value:e,mode:`prompt`,isMeta:t?.isMeta?!0:void 0}:e;return(async()=>{let e=await Gs([n]),t=e.attachmentCommands[0];if(!t)return;let r=kl();an(r);let i=Ud({content:t.value,isMeta:t.isMeta?!0:void 0,origin:t.origin}),a=!1;try{a=await no([i],r,!0,[],Te)!==!1}catch(t){try{await pl({commands:e.claimedCommands,outcome:{type:`failed`,error:t},currentDir:Mr(),priority:`later`})}catch(e){ai(yr(e))}ai(yr(t));return}if(a)try{let t=await pl({commands:e.claimedCommands,outcome:{type:`completed`},currentDir:Mr(),priority:`later`});for(let e of t)Kd(e)}catch(e){ai(yr(e))}})().catch(e=>{ai(yr(e))}),!0},[no,Te,H]),{relayPipeMessage:Oo,pipeReturnHadErrorRef:jo}=JR(),Mo=IR({setInputValueRaw:Ir,inputValueRef:Lr,insertTextRef:Rr});TP({enabled:Un(),isLoading:_n,focusedInputDialog:Ha,onSubmitMessage:Do}),fP({isLoading:_n,onSubmitMessage:Do}),X(e=>Ay(e));let{routeToSelectedPipes:No}=YR({store:H,setAppState:V,addNotification:ut});{let e=H.getState().kairosEnabled;qR({isLoading:_n,assistantMode:e,setMessages:G})}process.env.USER_TYPE===`ant`&&DP({taskListId:S,isLoading:_n,onSubmitTask:Do}),KR?.({isLoading:_n||se!==null,queuedCommandsLength:ue.length,hasActiveLocalJsxUI:ar,isInPlanMode:F.mode===`plan`,onQueueTick:e=>Kd(e)}),(0,Q.useEffect)(()=>{if(!ke){sv(null);return}if(!_n){if(Ae!==null&&ue.length===0&&!ar&&F.mode!==`plan`&&se===null){sv({enabled:!0,phase:`standby`,next_tick_at:Ae,sleep_until:null});return}sv({enabled:!0,phase:null,next_tick_at:null,sleep_until:null})}},[se,_n,ar,ke,Ae,ue.length,F.mode]),(0,Q.useEffect)(()=>{ue.some(e=>e.priority===`now`)&&on.current?.abort(`interrupt`)},[ue]);let Po=(0,Q.useRef)(Co);Po.current=Co;let Fo=(0,Q.useRef)(Ys);Fo.current=Ys,(0,Q.useEffect)(()=>(Po.current(),()=>{Fo.current.shutdown()}),[]);let{internal_eventEmitter:Io}=ie(),[Lo,Ro]=(0,Q.useState)(0);(0,Q.useEffect)(()=>{let e=()=>{process.stdout.write(`
95
95
  Claude Code has been suspended. Run \`fg\` to bring Claude Code back.
96
96
  Note: ctrl + z now suspends Claude Code, ctrl + _ undoes input.
97
- `)},t=()=>{Ro(e=>e+1)};return Io?.on(`suspend`,e),Io?.on(`resume`,t),()=>{Io?.off(`suspend`,e),Io?.off(`resume`,t)}},[Io]);let zo=(0,Q.useMemo)(()=>{if(!_n)return null;let e=W.filter(e=>{if(e.type!==`progress`)return!1;let t=e.data;return t.type===`hook_progress`&&(t.hookEvent===`Stop`||t.hookEvent===`SubagentStop`)});if(e.length===0)return null;let t=e.at(-1)?.toolUseID;if(!t||W.some(e=>e.type===`system`&&e.subtype===`stop_hook_summary`&&e.toolUseID===t))return null;let n=e.filter(e=>e.toolUseID===t),r=n.length,i=xi(W,e=>{if(e.type!==`attachment`)return!1;let n=e.attachment;return`hookEvent`in n&&(n.hookEvent===`Stop`||n.hookEvent===`SubagentStop`)&&`toolUseID`in n&&n.toolUseID===t}),a=n.find(e=>e.data.statusMessage)?.data.statusMessage;if(a)return r===1?`${a}…`:`${a}… ${i}/${r}`;let o=n[0]?.data.hookEvent===`SubagentStop`?`subagent stop`:`stop`;if(process.env.USER_TYPE===`ant`){let e=n[i]?.data.command,t=e?` '${Fi(e,40)}'`:``;return r===1?`running ${o} hook${t}`:`running ${o} hook${t}\u2026 ${i}/${r}`}return r===1?`running ${o} hook`:`running stop hooks… ${i}/${r}`},[W,_n]),Bo=(0,Q.useCallback)(()=>{Pr({messagesLength:W.length,streamingToolUsesLength:Zt.length})},[W.length,Zt.length]),Vo=(0,Q.useCallback)(()=>{Pr(null)},[]),Ho=Sh()&&!N,Uo=(0,Q.useRef)(null),[Wo,Go]=(0,Q.useState)(!1),[Ko,qo]=(0,Q.useState)(``),[Jo,Yo]=(0,Q.useState)(0),[Xo,Zo]=(0,Q.useState)(0),Qo=(0,Q.useCallback)((e,t)=>{Yo(e),Zo(t)},[]);Oe((e,t,n)=>{if(t.ctrl||t.meta)return;if(e===`/`){Uo.current?.setAnchor(),Go(!0),n.stopImmediatePropagation();return}let r=e[0];if((r===`n`||r===`N`)&&e===r.repeat(e.length)&&Jo>0){let t=r===`n`?Uo.current?.nextMatch:Uo.current?.prevMatch;if(t)for(let n=0;n<e.length;n++)t();n.stopImmediatePropagation()}},{isActive:ze===`transcript`&&Ho&&!Wo&&!Je});let{setQuery:$o,scanElement:es,setPositions:ts}=I(),ns=k().columns,rs=Q.useRef(ns);Q.useEffect(()=>{rs.current!==ns&&(rs.current=ns,(Ko||Wo)&&(Go(!1),qo(``),Yo(0),Zo(0),Uo.current?.disarmSearch(),$o(``)))},[ns,Ko,Wo,$o]),Oe((e,t,n)=>{if(!(t.ctrl||t.meta)){if(e===`q`){Vo(),n.stopImmediatePropagation();return}if(e===`[`&&!Je)Ze(!0),Ke(!0),n.stopImmediatePropagation();else if(e===`v`){if(n.stopImmediatePropagation(),st.current)return;st.current=!0;let e=it.current,t=t=>{e===it.current&&(clearTimeout(ot.current),$e(t))};t(`rendering ${J.length} messages…`),(async()=>{try{let e=(await Sx(J,Wt,Math.max(80,(process.stdout.columns??80)-6))).replace(/[ \t]+$/gm,``),n=wS(yS(),`cc-transcript-${Date.now()}.txt`);await PS(n,e),t(Eb(n)?`opening ${n}`:`wrote ${n} · no $VISUAL/$EDITOR set`)}catch(e){t(`render failed: ${e instanceof Error?e.message:String(e)}`)}st.current=!1,e===it.current&&(ot.current=setTimeout(e=>e(``),4e3,$e))})()}}},{isActive:ze===`transcript`&&Ho&&!Wo});let is=ze===`transcript`&&Ho;(0,Q.useEffect)(()=>{is||(qo(``),Yo(0),Zo(0),Go(!1),it.current++,clearTimeout(ot.current),Ze(!1),$e(``))},[is]),(0,Q.useEffect)(()=>{$o(is?Ko:``),is||ts(null)},[is,Ko,$o,ts]);let as={screen:ze,setScreen:Ve,showAllInTranscript:Ge,setShowAllInTranscript:Ke,messageCount:W.length,onEnterTranscript:Bo,onExitTranscript:Vo,virtualScrollActive:Ho,searchBarOpen:Wo},os=Nr?J.slice(0,Nr.messagesLength):J,ss=Nr?Zt.slice(0,Nr.streamingToolUsesLength):Zt;zN({onOpenBackgroundTasks:ar?void 0:()=>Ui(!0),onTogglePipeSelector:()=>{V(e=>{let t=e.pipeIpc??{};return{...e,pipeIpc:{...t,selectorOpen:!t.selectorOpen}}})}}),HN();let cs=ye?B[ye]:void 0,ls=cs&&ca(cs)?cs:void 0,ds=ls??(cs&&oo(cs)?cs:void 0),fs=li||!_n,ps=ds?.messages,gs=(0,Q.useMemo)(()=>{if(!ds)return;let e=ps??[];if(!oo(ds)||ds.agentType!==`fork`||!ds.prompt)return e;let t=ds.prompt.trim(),n=-1,r=-1,i=!1;for(let a=0;a<e.length;a++){let o=e[a];if(o.type===`user`&&Array.isArray(o.message?.content)){if(o.message.content.some(lz))n=a;else if(!i){let e=o.message.content.find(e=>e.type===`text`&&typeof e.text==`string`);e&&e.text.trim()===t&&(i=!0)}continue}o.type===`assistant`&&Array.isArray(o.message?.content)&&o.message.content.some(e=>e.type===`tool_use`)&&(r=a)}let a=n===-1?e:e.map((e,t)=>t!==n||!Array.isArray(e.message?.content)?e:{...e,message:{...e.message,content:e.message.content.filter(e=>!lz(e))}});if(i)return a;let o=n===-1?r+1:n+1,s=Ud({content:ds.prompt,timestamp:new Date(ds.startTime).toISOString()});return[...a.slice(0,o),s,...a.slice(o)]},[ds,ps]),_s=ds?gs??[]:fs?W:J;if(ze===`transcript`){let e=Sh()&&!N&&!Je?ln:void 0,t=(0,$.jsx)(xx,{messages:os,tools:Wt,commands:qt,verbose:!0,toolJSX:null,toolUseConfirmQueue:[],inProgressToolUseIDs:Gr,isMessageSelectorVisible:!1,conversationId:ki,screen:ze,agentDefinitions:L,streamingToolUses:ss,showAllInTranscript:Ge,onOpenRateLimitOptions:fo,isLoading:_n,hidePastThinking:!0,streamingThinking:$t,scrollRef:e,jumpRef:Uo,onSearchMatchesChange:Qo,scanElement:es,setPositions:ts,disableRenderCap:Je}),n=Rn&&(0,$.jsx)(U,{flexDirection:`column`,width:`100%`,children:Rn.jsx}),r=(0,$.jsxs)(Ap,{children:[(0,$.jsx)(sz,{isAnimating:or,title:rr,disabled:j,noPrefix:lr}),(0,$.jsx)(NN,{...as}),(0,$.jsx)(LR,{voiceHandleKeyEvent:Mo.handleKeyEvent,stripTrailing:Mo.stripTrailing,resetAnchor:Mo.resetAnchor,isActive:!Rn?.isLocalJSXCommand}),(0,$.jsx)(FN,{onSubmit:io,isActive:!Rn?.isLocalJSXCommand}),e?(0,$.jsx)(HL,{scrollRef:ln,isActive:Ha!==`ultraplan-choice`,isModal:!Wo,onScroll:()=>Uo.current?.disarmSearch()}):null,(0,$.jsx)(LN,{...qa}),e?(0,$.jsx)(yx,{scrollRef:ln,scrollable:(0,$.jsxs)($.Fragment,{children:[t,n,(0,$.jsx)(zF,{})]}),bottom:Wo?(0,$.jsx)(rz,{jumpRef:Uo,initialQuery:``,count:Jo,current:Xo,onClose:e=>{qo(Jo>0?e:``),Go(!1),e||(Yo(0),Zo(0),Uo.current?.setSearchQuery(``))},onCancel:()=>{Go(!1),Uo.current?.setSearchQuery(``),Uo.current?.setSearchQuery(Ko),$o(Ko)},setHighlight:$o}):(0,$.jsx)(nz,{showAllInTranscript:Ge,virtualScroll:!0,status:Qe||void 0,searchBadge:Ko&&Jo>0?{current:Xo,count:Jo}:void 0})}):(0,$.jsxs)($.Fragment,{children:[t,n,(0,$.jsx)(zF,{}),(0,$.jsx)(nz,{showAllInTranscript:Ge,virtualScroll:!1,suppressShowAll:Je,status:Qe||void 0})]})]});return e?(0,$.jsx)(ce,{mouseTracking:Ms(),children:r}):r}let ys=vn&&!ds&&_s.length<=bn.current?vn:void 0,bs=Ha===`tool-permission`?(0,$.jsx)(PE,{onDone:()=>Wn(([e,...t])=>t),onReject:Ka,toolUseConfirm:Hn[0],toolUseContext:Qa(W,W,nn??kl(),Te),verbose:te,workerBadge:Hn[0]?.workerBadge,setStickyFooter:Sh()?Kn:void 0},Hn[0]?.toolUseID):null,xs=ns<100,Ss=!Rn?.shouldHidePromptInput&&!Ha&&!Hi,Cs=Sh()&&Rn?.isLocalJSXCommand===!0,ws=Cs?Rn.jsx:null,Ts=(0,$.jsxs)(Ap,{children:[(0,$.jsx)(sz,{isAnimating:or,title:rr,disabled:j,noPrefix:lr}),(0,$.jsx)(NN,{...as}),(0,$.jsx)(LR,{voiceHandleKeyEvent:Mo.handleKeyEvent,stripTrailing:Mo.stripTrailing,resetAnchor:Mo.resetAnchor,isActive:!Rn?.isLocalJSXCommand}),(0,$.jsx)(FN,{onSubmit:io,isActive:!Rn?.isLocalJSXCommand}),(0,$.jsx)(HL,{scrollRef:ln,isActive:Sh()&&(ws!=null||!Ha||Ha===`tool-permission`),onScroll:kr}),null,(0,$.jsx)(LN,{...qa}),(0,$.jsx)(By,{dynamicMcpConfig:Ie,isStrictMcpConfig:m,children:(0,$.jsx)(yx,{scrollRef:ln,overlay:bs,bottomFloat:Ss&&!xs?(0,$.jsx)(ED,{}):void 0,modal:ws,modalScrollRef:un,dividerYRef:hr,hidePill:!!ds,hideSticky:!!ls,newMessageCount:Tr?.count??0,onPillClick:()=>{Cr(null),vr(ln.current)},scrollable:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(_P,{}),(0,$.jsx)(xx,{messages:_s,tools:Wt,commands:qt,verbose:te,toolJSX:Rn,toolUseConfirmQueue:Hn,inProgressToolUseIDs:ls?ls.inProgressToolUseIDs??new Set:Gr,isMessageSelectorVisible:Si,conversationId:ki,screen:ze,streamingToolUses:Zt,showAllInTranscript:Ge,agentDefinitions:L,onOpenRateLimitOptions:fo,isLoading:_n,streamingText:_n&&!ds?di:null,isBriefOnly:ds?!1:je,unseenDivider:ds?void 0:Tr,scrollRef:Sh()?ln:void 0,trackStickyPrompt:Sh()?!0:void 0,cursor:Sr,setCursor:Cr,cursorNavRef:wr}),(0,$.jsx)(CI,{}),!y&&ys&&!ws&&(0,$.jsx)(u_,{param:{text:ys,type:`text`},addMargin:!0,verbose:te}),Rn&&!(Rn.isLocalJSXCommand&&Rn.isImmediate)&&!Cs&&(0,$.jsx)(U,{flexDirection:`column`,width:`100%`,children:Rn.jsx}),process.env.USER_TYPE===`ant`&&(0,$.jsx)(QI,{}),(0,$.jsx)(U,{flexGrow:1}),da&&(0,$.jsx)(xp,{mode:Jt,spinnerTip:de,responseLengthRef:ri,apiMetricsRef:ii,overrideMessage:mi,spinnerSuffix:zo,verbose:te,loadingStartTimeRef:Sn,totalPausedMsRef:Cn,pauseStartTimeRef:wn,overrideColor:gi,overrideShimmerColor:vi,hasActiveTools:Gr.size>0,leaderIsIdle:!_n}),!da&&!_n&&!vn&&!ta&&je&&!ds&&(0,$.jsx)(uh,{}),Sh()&&(0,$.jsx)(_M,{})]}),bottom:(0,$.jsxs)(U,{flexDirection:xs?`column`:`row`,width:`100%`,alignItems:xs?void 0:`flex-end`,children:[xs&&Sh()&&Ss?(0,$.jsx)(TD,{}):null,(0,$.jsxs)(U,{flexDirection:`column`,flexGrow:1,children:[Gn,Rn?.isLocalJSXCommand&&Rn.isImmediate&&!Cs&&(0,$.jsx)(U,{flexDirection:`column`,width:`100%`,children:Rn.jsx}),!da&&!Rn?.isLocalJSXCommand&&fe&&Ht&&Ht.length>0&&(0,$.jsx)(U,{width:`100%`,flexDirection:`column`,children:(0,$.jsx)(ju,{tasks:Ht,isStandalone:!0})}),Ha===`sandbox-permission`&&(0,$.jsx)(LF,{hostPattern:qn[0].hostPattern,onUserResponse:e=>{let{allow:t,persistToSettings:n}=e,r=qn[0];if(!r)return;let i=r.hostPattern.host;if(n){let e={type:`addRules`,rules:[{toolName:`WebFetch`,ruleContent:`domain:${i}`}],behavior:t?`allow`:`deny`,destination:`localSettings`};V(t=>({...t,toolPermissionContext:Sf(t.toolPermissionContext,e)})),Ed(e),qh.refreshConfig()}Jn(e=>(e.filter(e=>e.hostPattern.host===i).forEach(e=>e.resolvePromise(t)),e.filter(e=>e.hostPattern.host!==i)));let a=Zn.current.get(i);if(a){for(let e of a)e();Zn.current.delete(i)}}},qn[0].hostPattern.host),Ha===`prompt`&&(0,$.jsx)(iD,{title:Yn[0].title,toolInputSummary:Yn[0].toolInputSummary,request:Yn[0].request,onRespond:e=>{let t=Yn[0];t&&(t.resolve({prompt_response:t.request.prompt,selected:e}),Xn(([,...e])=>e))},onAbort:()=>{let e=Yn[0];e&&(e.reject(Error(`Prompt cancelled by user`)),Xn(([,...e])=>e))}},Yn[0].request.prompt),pe&&(0,$.jsx)(aC,{toolName:pe.toolName,description:pe.description}),me&&(0,$.jsx)(aC,{toolName:`Network Access`,description:`Waiting for leader to approve network access to ${me.host}`}),Ha===`worker-sandbox-permission`&&(0,$.jsx)(LF,{hostPattern:{host:he.queue[0].host,port:void 0},onUserResponse:e=>{let{allow:t,persistToSettings:n}=e,r=he.queue[0];if(!r)return;let i=r.host;if(Of(r.workerName,r.requestId,i,t,z?.teamName),n&&t){let e={type:`addRules`,rules:[{toolName:`WebFetch`,ruleContent:`domain:${i}`}],behavior:`allow`,destination:`localSettings`};V(t=>({...t,toolPermissionContext:Sf(t.toolPermissionContext,e)})),Ed(e),qh.refreshConfig()}V(e=>({...e,workerSandboxPermissions:{...e.workerSandboxPermissions,queue:e.workerSandboxPermissions.queue.slice(1)}}))}},he.queue[0].requestId),Ha===`elicitation`&&(0,$.jsx)(tD,{event:ge.queue[0],onResponse:(e,t)=>{let n=ge.queue[0];n&&(n.respond({action:e,content:t}),n.params.mode===`url`&&e===`accept`||V(e=>({...e,elicitation:{queue:e.elicitation.queue.slice(1)}})))},onWaitingDismiss:e=>{let t=ge.queue[0];V(e=>({...e,elicitation:{queue:e.elicitation.queue.slice(1)}})),t?.onWaitingDismiss?.(e)}},ge.queue[0].serverName+`:`+String(ge.queue[0].requestId)),Ha===`cost`&&(0,$.jsx)(VS,{onDone:()=>{Oi(!1),zi(!0),rn(e=>({...e,hasAcknowledgedCostThreshold:!0})),Y(`tengu_cost_threshold_acknowledged`,{})}}),Ha===`idle-return`&&ji&&(0,$.jsx)(HS,{idleMinutes:ji.idleMinutes,totalInputTokens:wt(),onDone:async e=>{let t=ji;if(Mi(null),Y(`tengu_idle_return_action`,{action:e,idleMinutes:Math.round(t.idleMinutes),messageCount:dr.current.length,totalInputTokens:wt()}),e===`dismiss`){zr(t.input);return}if(e===`never`&&rn(e=>e.idleReturnDismissed?e:{...e,idleReturnDismissed:!0}),e===`clear`){let{clearConversation:e}=await import(`./conversation-BP0phkOY.js`);await e({setMessages:G,readFileState:Ca.current,discoveredSkillNames:Ea.current,loadedNestedMemoryPaths:Da.current,getAppState:()=>H.getState(),setAppState:V,setConversationId:Ai}),tr.current=!1,er(void 0),wa.current.clear(),Ta.current=0}Ni.current=!0,uo.current(t.input,{setCursorOffset:()=>{},clearBuffer:()=>{},resetHistory:()=>{}})}}),Ha===`ide-onboarding`&&(0,$.jsx)(af,{onDone:()=>Dt(!1),installationStatus:Ct}),process.env.USER_TYPE===`ant`&&Ha===`model-switch`&&XR&&(0,$.jsx)(XR,{onDone:(e,t)=>{kt(!1),e===`switch`&&t&&V(e=>({...e,mainLoopModel:t,mainLoopModelForSession:null}))}}),process.env.USER_TYPE===`ant`&&Ha===`undercover-callout`&&QR&&(0,$.jsx)(QR,{onDone:()=>Ln(!1)}),Ha===`effort-callout`&&(0,$.jsx)(PP,{model:Te,onDone:e=>{Mt(!1),e!==`dismiss`&&V(t=>({...t,effortValue:e}))}}),Ha===`remote-callout`&&(0,$.jsx)(Ib,{onDone:e=>{V(t=>t.showRemoteCallout?{...t,showRemoteCallout:!1,...e===`enable`&&{replBridgeEnabled:!0,replBridgeExplicit:!0,replBridgeOutboundOnly:!1}}:t)}}),Fa,Ha===`plugin-hint`&&Rt&&(0,$.jsx)(dI,{pluginName:Rt.pluginName,pluginDescription:Rt.pluginDescription,marketplaceName:Rt.marketplaceName,sourceCommand:Rt.sourceCommand,onResponse:zt}),Ha===`search-extra-tools-hint`&&Bt.visible&&(0,$.jsx)(pI,{tools:Bt.tools,onSelect:Bt.handleSelect,onDismiss:Bt.handleDismiss}),Ha===`lsp-recommendation`&&It&&(0,$.jsx)(cI,{pluginName:It.pluginName,pluginDescription:It.pluginDescription,fileExtension:It.fileExtension,onResponse:Lt}),Ha===`desktop-upsell`&&(0,$.jsx)(fS,{onDone:()=>Ft(!1)}),Ha===`ultraplan-choice`&&_e&&(0,$.jsx)(fL,{plan:_e.plan,sessionId:_e.sessionId,taskId:_e.taskId,setMessages:G,readFileState:Ca.current,getAppState:()=>H.getState(),setConversationId:Ai}),Ha===`ultraplan-launch`&&ve&&(0,$.jsx)(hL,{onChoice:(e,t)=>{let n=ve.blurb;if(V(e=>e.ultraplanLaunchPending?{...e,ultraplanLaunchPending:void 0}:e),e===`cancel`)return;G(e=>[...e,qf(Fg(`ultraplan`,n))]);let r=e=>G(t=>[...t,qf(`<local-command-stdout>${q_(e)}</local-command-stdout>`)]);wp({blurb:n,promptIdentifier:t?.promptIdentifier,getAppState:()=>H.getState(),setAppState:V,signal:kl().signal,disconnectedBridge:t?.disconnectedBridge,onSessionReady:e=>{if(!fn.isActive){r(e);return}let t=fn.subscribe(()=>{fn.isActive||(t(),H.getState().ultraplanSessionUrl&&r(e))})}}).then(r).catch(ai)}}),ua(),!Rn?.shouldHidePromptInput&&!Ha&&!La&&!y&&!Sr&&(0,$.jsxs)($.Fragment,{children:[ja&&(0,$.jsx)(JI,{onRun:so,onCancel:co,reason:ZI(ja)}),va.state===`closed`?ya.state===`closed`?(0,$.jsx)(lF,{state:ga.state,lastResponse:ga.lastResponse,handleSelect:ga.handleSelect,handleTranscriptSelect:ga.handleTranscriptSelect,inputValue:Fr,setInputValue:zr,onRequestFeedback:Na.current?void 0:lo}):(0,$.jsx)(lF,{state:ya.state,lastResponse:ya.lastResponse,handleSelect:ya.handleSelect,handleTranscriptSelect:ya.handleTranscriptSelect,inputValue:Fr,setInputValue:zr,onRequestFeedback:lo,message:`How well did Claude use its memory? (optional)`}):(0,$.jsx)(lF,{state:va.state,lastResponse:va.lastResponse,handleSelect:va.handleSelect,inputValue:Fr,setInputValue:zr,onRequestFeedback:lo}),ba.state!==`closed`&&(0,$.jsx)(lF,{state:ba.state,lastResponse:null,handleSelect:()=>{},handleTranscriptSelect:ba.handleTranscriptSelect,inputValue:Fr,setInputValue:zr}),ma.suggestion&&(0,$.jsx)(CN,{isOpen:ma.isOpen,skillName:ma.suggestion.skillName,updates:ma.suggestion.updates,handleSelect:ma.handleSelect,inputValue:Fr,setInputValue:zr}),ha&&(0,$.jsx)($I,{}),(0,$.jsx)(BM,{debug:n,ideSelection:gt,hasSuppressedDialogs:!!Ua,isLocalJSXCommandActive:ar,getToolUseContext:Qa,toolPermissionContext:F,setToolPermissionContext:Xa,apiKeyStatus:ka,commands:qt,agents:L.activeAgents,isLoading:_n,onExit:mo,verbose:te,messages:W,onAutoUpdaterResult:Fn,autoUpdaterResult:Pn,input:Fr,onInputChange:zr,mode:Br,onModeChange:Vr,stashedPrompt:Hr,setStashedPrompt:Ur,submitCount:ti,onShowMessageSelector:ho,onMessageActionsEnter:void 0,mcpClients:ht,pastedContents:Qr,setPastedContents:ei,vimMode:Bi,setVimMode:Vi,showBashesDialog:Hi,setShowBashesDialog:Ui,onSubmit:io,onAgentSubmit:ao,isSearchingHistory:Wi,setIsSearchingHistory:Gi,helpOpen:Ki,setHelpOpen:qi,insertTextRef:Rr,voiceInterimRange:Mo.interimRange}),(0,$.jsx)(jP,{onBackgroundSession:$a,isLoading:_n}),(0,$.jsx)(SP,{})]}),Sr&&(0,$.jsx)(iu,{cursor:Sr}),Ha===`message-selector`&&(0,$.jsx)(rb,{messages:W,preselectedMessage:wi,onPreRestore:Ga,onRestoreCode:async e=>{await If(e=>{V(t=>({...t,fileHistory:e(t.fileHistory)}))},e.uuid)},onSummarize:async(e,t,n=`from`)=>{let r=Fc(W),i=r.indexOf(e);if(i===-1){G(e=>[...e,Sd(`That message is no longer in the active context (snipped or pre-compact). Choose a more recent message.`,`warning`)]);return}let a=Qa(r,[],kl(),Te),o=a.getAppState(),s=await vf(a.options.tools,a.options.mainLoopModel,Array.from(o.toolPermissionContext.additionalWorkingDirectories.keys()),a.options.mcpClients),c=Df({mainThreadAgentDefinition:void 0,toolUseContext:a,customSystemPrompt:a.options.customSystemPrompt,defaultSystemPrompt:s,appendSystemPrompt:a.options.appendSystemPrompt}),[l,u]=await Promise.all([Gf(),mf()]),d=await Vl(r,i,a,{systemPrompt:c,userContext:l,systemContext:u,toolUseContext:a,forkContextMessages:r},t,n),f=d.messagesToKeep??[],p=n===`up_to`?[...d.summaryMessages,...f]:[...f,...d.summaryMessages],m=[d.boundaryMarker,...p,...d.attachments,...d.hookResults];if(Sh()&&n===`from`?G(t=>{let n=t.findIndex(t=>t.uuid===e.uuid);return[...t.slice(0,n===-1?0:n),...m]}):G(m),VR?.setContextBlocked(!1),Ai(jS()),bd(a.options.querySource),n===`from`){let t=al(e);t&&(zr(t.text),Vr(t.mode))}ut({key:`summarize-ctrl-o-hint`,text:`Conversation summarized (${oa(`app:toggleTranscript`,`Global`,`ctrl+o`)} for history)`,priority:`medium`,timeoutMs:8e3})},onRestoreMessage:yo,onClose:()=>{Ci(!1),Ei(void 0)}}),process.env.USER_TYPE===`ant`&&(0,$.jsx)(cL,{})]}),!(xs&&Sh())&&Ss?(0,$.jsx)(TD,{}):null]})})},Lo)]});return Sh()?(0,$.jsx)(ce,{mouseTracking:Ms(),children:Ts}):Ts}export{uz as t};
97
+ `)},t=()=>{Ro(e=>e+1)};return Io?.on(`suspend`,e),Io?.on(`resume`,t),()=>{Io?.off(`suspend`,e),Io?.off(`resume`,t)}},[Io]);let zo=(0,Q.useMemo)(()=>{if(!_n)return null;let e=W.filter(e=>{if(e.type!==`progress`)return!1;let t=e.data;return t.type===`hook_progress`&&(t.hookEvent===`Stop`||t.hookEvent===`SubagentStop`)});if(e.length===0)return null;let t=e.at(-1)?.toolUseID;if(!t||W.some(e=>e.type===`system`&&e.subtype===`stop_hook_summary`&&e.toolUseID===t))return null;let n=e.filter(e=>e.toolUseID===t),r=n.length,i=xi(W,e=>{if(e.type!==`attachment`)return!1;let n=e.attachment;return`hookEvent`in n&&(n.hookEvent===`Stop`||n.hookEvent===`SubagentStop`)&&`toolUseID`in n&&n.toolUseID===t}),a=n.find(e=>e.data.statusMessage)?.data.statusMessage;if(a)return r===1?`${a}…`:`${a}… ${i}/${r}`;let o=n[0]?.data.hookEvent===`SubagentStop`?`subagent stop`:`stop`;if(process.env.USER_TYPE===`ant`){let e=n[i]?.data.command,t=e?` '${Fi(e,40)}'`:``;return r===1?`running ${o} hook${t}`:`running ${o} hook${t}\u2026 ${i}/${r}`}return r===1?`running ${o} hook`:`running stop hooks… ${i}/${r}`},[W,_n]),Bo=(0,Q.useCallback)(()=>{Pr({messagesLength:W.length,streamingToolUsesLength:Zt.length})},[W.length,Zt.length]),Vo=(0,Q.useCallback)(()=>{Pr(null)},[]),Ho=Sh()&&!N,Uo=(0,Q.useRef)(null),[Wo,Go]=(0,Q.useState)(!1),[Ko,qo]=(0,Q.useState)(``),[Jo,Yo]=(0,Q.useState)(0),[Xo,Zo]=(0,Q.useState)(0),Qo=(0,Q.useCallback)((e,t)=>{Yo(e),Zo(t)},[]);Oe((e,t,n)=>{if(t.ctrl||t.meta)return;if(e===`/`){Uo.current?.setAnchor(),Go(!0),n.stopImmediatePropagation();return}let r=e[0];if((r===`n`||r===`N`)&&e===r.repeat(e.length)&&Jo>0){let t=r===`n`?Uo.current?.nextMatch:Uo.current?.prevMatch;if(t)for(let n=0;n<e.length;n++)t();n.stopImmediatePropagation()}},{isActive:ze===`transcript`&&Ho&&!Wo&&!Je});let{setQuery:$o,scanElement:es,setPositions:ts}=I(),ns=k().columns,rs=Q.useRef(ns);Q.useEffect(()=>{rs.current!==ns&&(rs.current=ns,(Ko||Wo)&&(Go(!1),qo(``),Yo(0),Zo(0),Uo.current?.disarmSearch(),$o(``)))},[ns,Ko,Wo,$o]),Oe((e,t,n)=>{if(!(t.ctrl||t.meta)){if(e===`q`){Vo(),n.stopImmediatePropagation();return}if(e===`[`&&!Je)Ze(!0),Ke(!0),n.stopImmediatePropagation();else if(e===`v`){if(n.stopImmediatePropagation(),st.current)return;st.current=!0;let e=it.current,t=t=>{e===it.current&&(clearTimeout(ot.current),$e(t))};t(`rendering ${J.length} messages…`),(async()=>{try{let e=(await Sx(J,Wt,Math.max(80,(process.stdout.columns??80)-6))).replace(/[ \t]+$/gm,``),n=wS(yS(),`cc-transcript-${Date.now()}.txt`);await PS(n,e),t(Eb(n)?`opening ${n}`:`wrote ${n} · no $VISUAL/$EDITOR set`)}catch(e){t(`render failed: ${e instanceof Error?e.message:String(e)}`)}st.current=!1,e===it.current&&(ot.current=setTimeout(e=>e(``),4e3,$e))})()}}},{isActive:ze===`transcript`&&Ho&&!Wo});let is=ze===`transcript`&&Ho;(0,Q.useEffect)(()=>{is||(qo(``),Yo(0),Zo(0),Go(!1),it.current++,clearTimeout(ot.current),Ze(!1),$e(``))},[is]),(0,Q.useEffect)(()=>{$o(is?Ko:``),is||ts(null)},[is,Ko,$o,ts]);let as={screen:ze,setScreen:Ve,showAllInTranscript:Ge,setShowAllInTranscript:Ke,messageCount:W.length,onEnterTranscript:Bo,onExitTranscript:Vo,virtualScrollActive:Ho,searchBarOpen:Wo},os=Nr?J.slice(0,Nr.messagesLength):J,ss=Nr?Zt.slice(0,Nr.streamingToolUsesLength):Zt;zN({onOpenBackgroundTasks:ar?void 0:()=>Ui(!0),onTogglePipeSelector:()=>{V(e=>{let t=e.pipeIpc??{};return{...e,pipeIpc:{...t,selectorOpen:!t.selectorOpen}}})}}),HN();let cs=ye?B[ye]:void 0,ls=cs&&ca(cs)?cs:void 0,ds=ls??(cs&&oo(cs)?cs:void 0),fs=li||!_n,ps=ds?.messages,gs=(0,Q.useMemo)(()=>{if(!ds)return;let e=ps??[];if(!oo(ds)||ds.agentType!==`fork`||!ds.prompt)return e;let t=ds.prompt.trim(),n=-1,r=-1,i=!1;for(let a=0;a<e.length;a++){let o=e[a];if(o.type===`user`&&Array.isArray(o.message?.content)){if(o.message.content.some(lz))n=a;else if(!i){let e=o.message.content.find(e=>e.type===`text`&&typeof e.text==`string`);e&&e.text.trim()===t&&(i=!0)}continue}o.type===`assistant`&&Array.isArray(o.message?.content)&&o.message.content.some(e=>e.type===`tool_use`)&&(r=a)}let a=n===-1?e:e.map((e,t)=>t!==n||!Array.isArray(e.message?.content)?e:{...e,message:{...e.message,content:e.message.content.filter(e=>!lz(e))}});if(i)return a;let o=n===-1?r+1:n+1,s=Ud({content:ds.prompt,timestamp:new Date(ds.startTime).toISOString()});return[...a.slice(0,o),s,...a.slice(o)]},[ds,ps]),_s=ds?gs??[]:fs?W:J;if(ze===`transcript`){let e=Sh()&&!N&&!Je?ln:void 0,t=(0,$.jsx)(xx,{messages:os,tools:Wt,commands:qt,verbose:!0,toolJSX:null,toolUseConfirmQueue:[],inProgressToolUseIDs:Gr,isMessageSelectorVisible:!1,conversationId:ki,screen:ze,agentDefinitions:L,streamingToolUses:ss,showAllInTranscript:Ge,onOpenRateLimitOptions:fo,isLoading:_n,hidePastThinking:!0,streamingThinking:$t,scrollRef:e,jumpRef:Uo,onSearchMatchesChange:Qo,scanElement:es,setPositions:ts,disableRenderCap:Je}),n=Rn&&(0,$.jsx)(U,{flexDirection:`column`,width:`100%`,children:Rn.jsx}),r=(0,$.jsxs)(Ap,{children:[(0,$.jsx)(sz,{isAnimating:or,title:rr,disabled:j,noPrefix:lr}),(0,$.jsx)(NN,{...as}),(0,$.jsx)(LR,{voiceHandleKeyEvent:Mo.handleKeyEvent,stripTrailing:Mo.stripTrailing,resetAnchor:Mo.resetAnchor,isActive:!Rn?.isLocalJSXCommand}),(0,$.jsx)(FN,{onSubmit:io,isActive:!Rn?.isLocalJSXCommand}),e?(0,$.jsx)(HL,{scrollRef:ln,isActive:Ha!==`ultraplan-choice`,isModal:!Wo,onScroll:()=>Uo.current?.disarmSearch()}):null,(0,$.jsx)(LN,{...qa}),e?(0,$.jsx)(yx,{scrollRef:ln,scrollable:(0,$.jsxs)($.Fragment,{children:[t,n,(0,$.jsx)(zF,{})]}),bottom:Wo?(0,$.jsx)(rz,{jumpRef:Uo,initialQuery:``,count:Jo,current:Xo,onClose:e=>{qo(Jo>0?e:``),Go(!1),e||(Yo(0),Zo(0),Uo.current?.setSearchQuery(``))},onCancel:()=>{Go(!1),Uo.current?.setSearchQuery(``),Uo.current?.setSearchQuery(Ko),$o(Ko)},setHighlight:$o}):(0,$.jsx)(nz,{showAllInTranscript:Ge,virtualScroll:!0,status:Qe||void 0,searchBadge:Ko&&Jo>0?{current:Xo,count:Jo}:void 0})}):(0,$.jsxs)($.Fragment,{children:[t,n,(0,$.jsx)(zF,{}),(0,$.jsx)(nz,{showAllInTranscript:Ge,virtualScroll:!1,suppressShowAll:Je,status:Qe||void 0})]})]});return e?(0,$.jsx)(ce,{mouseTracking:Ms(),children:r}):r}let ys=vn&&!ds&&_s.length<=bn.current?vn:void 0,bs=Ha===`tool-permission`?(0,$.jsx)(PE,{onDone:()=>Wn(([e,...t])=>t),onReject:Ka,toolUseConfirm:Hn[0],toolUseContext:Qa(W,W,nn??kl(),Te),verbose:te,workerBadge:Hn[0]?.workerBadge,setStickyFooter:Sh()?Kn:void 0},Hn[0]?.toolUseID):null,xs=ns<100,Ss=!Rn?.shouldHidePromptInput&&!Ha&&!Hi,Cs=Sh()&&Rn?.isLocalJSXCommand===!0,ws=Cs?Rn.jsx:null,Ts=(0,$.jsxs)(Ap,{children:[(0,$.jsx)(sz,{isAnimating:or,title:rr,disabled:j,noPrefix:lr}),(0,$.jsx)(NN,{...as}),(0,$.jsx)(LR,{voiceHandleKeyEvent:Mo.handleKeyEvent,stripTrailing:Mo.stripTrailing,resetAnchor:Mo.resetAnchor,isActive:!Rn?.isLocalJSXCommand}),(0,$.jsx)(FN,{onSubmit:io,isActive:!Rn?.isLocalJSXCommand}),(0,$.jsx)(HL,{scrollRef:ln,isActive:Sh()&&(ws!=null||!Ha||Ha===`tool-permission`),onScroll:kr}),null,(0,$.jsx)(LN,{...qa}),(0,$.jsx)(By,{dynamicMcpConfig:Ie,isStrictMcpConfig:m,children:(0,$.jsx)(yx,{scrollRef:ln,overlay:bs,bottomFloat:Ss&&!xs?(0,$.jsx)(ED,{}):void 0,modal:ws,modalScrollRef:un,dividerYRef:hr,hidePill:!!ds,hideSticky:!!ls,newMessageCount:Tr?.count??0,onPillClick:()=>{Cr(null),vr(ln.current)},scrollable:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(_P,{}),(0,$.jsx)(xx,{messages:_s,tools:Wt,commands:qt,verbose:te,toolJSX:Rn,toolUseConfirmQueue:Hn,inProgressToolUseIDs:ls?ls.inProgressToolUseIDs??new Set:Gr,isMessageSelectorVisible:Si,conversationId:ki,screen:ze,streamingToolUses:Zt,showAllInTranscript:Ge,agentDefinitions:L,onOpenRateLimitOptions:fo,isLoading:_n,streamingText:_n&&!ds?di:null,isBriefOnly:ds?!1:je,unseenDivider:ds?void 0:Tr,scrollRef:Sh()?ln:void 0,trackStickyPrompt:Sh()?!0:void 0,cursor:Sr,setCursor:Cr,cursorNavRef:wr}),(0,$.jsx)(CI,{}),!y&&ys&&!ws&&(0,$.jsx)(u_,{param:{text:ys,type:`text`},addMargin:!0,verbose:te}),Rn&&!(Rn.isLocalJSXCommand&&Rn.isImmediate)&&!Cs&&(0,$.jsx)(U,{flexDirection:`column`,width:`100%`,children:Rn.jsx}),process.env.USER_TYPE===`ant`&&(0,$.jsx)(QI,{}),(0,$.jsx)(U,{flexGrow:1}),da&&(0,$.jsx)(xp,{mode:Jt,spinnerTip:de,responseLengthRef:ri,apiMetricsRef:ii,overrideMessage:mi,spinnerSuffix:zo,verbose:te,loadingStartTimeRef:Sn,totalPausedMsRef:Cn,pauseStartTimeRef:wn,overrideColor:gi,overrideShimmerColor:vi,hasActiveTools:Gr.size>0,leaderIsIdle:!_n}),!da&&!_n&&!vn&&!ta&&je&&!ds&&(0,$.jsx)(uh,{}),Sh()&&(0,$.jsx)(_M,{})]}),bottom:(0,$.jsxs)(U,{flexDirection:xs?`column`:`row`,width:`100%`,alignItems:xs?void 0:`flex-end`,children:[xs&&Sh()&&Ss?(0,$.jsx)(TD,{}):null,(0,$.jsxs)(U,{flexDirection:`column`,flexGrow:1,children:[Gn,Rn?.isLocalJSXCommand&&Rn.isImmediate&&!Cs&&(0,$.jsx)(U,{flexDirection:`column`,width:`100%`,children:Rn.jsx}),!da&&!Rn?.isLocalJSXCommand&&fe&&Ht&&Ht.length>0&&(0,$.jsx)(U,{width:`100%`,flexDirection:`column`,children:(0,$.jsx)(ju,{tasks:Ht,isStandalone:!0})}),Ha===`sandbox-permission`&&(0,$.jsx)(LF,{hostPattern:qn[0].hostPattern,onUserResponse:e=>{let{allow:t,persistToSettings:n}=e,r=qn[0];if(!r)return;let i=r.hostPattern.host;if(n){let e={type:`addRules`,rules:[{toolName:`WebFetch`,ruleContent:`domain:${i}`}],behavior:t?`allow`:`deny`,destination:`localSettings`};V(t=>({...t,toolPermissionContext:Sf(t.toolPermissionContext,e)})),Ed(e),qh.refreshConfig()}Jn(e=>(e.filter(e=>e.hostPattern.host===i).forEach(e=>e.resolvePromise(t)),e.filter(e=>e.hostPattern.host!==i)));let a=Zn.current.get(i);if(a){for(let e of a)e();Zn.current.delete(i)}}},qn[0].hostPattern.host),Ha===`prompt`&&(0,$.jsx)(iD,{title:Yn[0].title,toolInputSummary:Yn[0].toolInputSummary,request:Yn[0].request,onRespond:e=>{let t=Yn[0];t&&(t.resolve({prompt_response:t.request.prompt,selected:e}),Xn(([,...e])=>e))},onAbort:()=>{let e=Yn[0];e&&(e.reject(Error(`Prompt cancelled by user`)),Xn(([,...e])=>e))}},Yn[0].request.prompt),pe&&(0,$.jsx)(aC,{toolName:pe.toolName,description:pe.description}),me&&(0,$.jsx)(aC,{toolName:`Network Access`,description:`Waiting for leader to approve network access to ${me.host}`}),Ha===`worker-sandbox-permission`&&(0,$.jsx)(LF,{hostPattern:{host:he.queue[0].host,port:void 0},onUserResponse:e=>{let{allow:t,persistToSettings:n}=e,r=he.queue[0];if(!r)return;let i=r.host;if(Of(r.workerName,r.requestId,i,t,z?.teamName),n&&t){let e={type:`addRules`,rules:[{toolName:`WebFetch`,ruleContent:`domain:${i}`}],behavior:`allow`,destination:`localSettings`};V(t=>({...t,toolPermissionContext:Sf(t.toolPermissionContext,e)})),Ed(e),qh.refreshConfig()}V(e=>({...e,workerSandboxPermissions:{...e.workerSandboxPermissions,queue:e.workerSandboxPermissions.queue.slice(1)}}))}},he.queue[0].requestId),Ha===`elicitation`&&(0,$.jsx)(tD,{event:ge.queue[0],onResponse:(e,t)=>{let n=ge.queue[0];n&&(n.respond({action:e,content:t}),n.params.mode===`url`&&e===`accept`||V(e=>({...e,elicitation:{queue:e.elicitation.queue.slice(1)}})))},onWaitingDismiss:e=>{let t=ge.queue[0];V(e=>({...e,elicitation:{queue:e.elicitation.queue.slice(1)}})),t?.onWaitingDismiss?.(e)}},ge.queue[0].serverName+`:`+String(ge.queue[0].requestId)),Ha===`cost`&&(0,$.jsx)(VS,{onDone:()=>{Oi(!1),zi(!0),rn(e=>({...e,hasAcknowledgedCostThreshold:!0})),Y(`tengu_cost_threshold_acknowledged`,{})}}),Ha===`idle-return`&&ji&&(0,$.jsx)(HS,{idleMinutes:ji.idleMinutes,totalInputTokens:wt(),onDone:async e=>{let t=ji;if(Mi(null),Y(`tengu_idle_return_action`,{action:e,idleMinutes:Math.round(t.idleMinutes),messageCount:dr.current.length,totalInputTokens:wt()}),e===`dismiss`){zr(t.input);return}if(e===`never`&&rn(e=>e.idleReturnDismissed?e:{...e,idleReturnDismissed:!0}),e===`clear`){let{clearConversation:e}=await import(`./conversation-cUxdb8MN.js`);await e({setMessages:G,readFileState:Ca.current,discoveredSkillNames:Ea.current,loadedNestedMemoryPaths:Da.current,getAppState:()=>H.getState(),setAppState:V,setConversationId:Ai}),tr.current=!1,er(void 0),wa.current.clear(),Ta.current=0}Ni.current=!0,uo.current(t.input,{setCursorOffset:()=>{},clearBuffer:()=>{},resetHistory:()=>{}})}}),Ha===`ide-onboarding`&&(0,$.jsx)(af,{onDone:()=>Dt(!1),installationStatus:Ct}),process.env.USER_TYPE===`ant`&&Ha===`model-switch`&&XR&&(0,$.jsx)(XR,{onDone:(e,t)=>{kt(!1),e===`switch`&&t&&V(e=>({...e,mainLoopModel:t,mainLoopModelForSession:null}))}}),process.env.USER_TYPE===`ant`&&Ha===`undercover-callout`&&QR&&(0,$.jsx)(QR,{onDone:()=>Ln(!1)}),Ha===`effort-callout`&&(0,$.jsx)(PP,{model:Te,onDone:e=>{Mt(!1),e!==`dismiss`&&V(t=>({...t,effortValue:e}))}}),Ha===`remote-callout`&&(0,$.jsx)(Ib,{onDone:e=>{V(t=>t.showRemoteCallout?{...t,showRemoteCallout:!1,...e===`enable`&&{replBridgeEnabled:!0,replBridgeExplicit:!0,replBridgeOutboundOnly:!1}}:t)}}),Fa,Ha===`plugin-hint`&&Rt&&(0,$.jsx)(dI,{pluginName:Rt.pluginName,pluginDescription:Rt.pluginDescription,marketplaceName:Rt.marketplaceName,sourceCommand:Rt.sourceCommand,onResponse:zt}),Ha===`search-extra-tools-hint`&&Bt.visible&&(0,$.jsx)(pI,{tools:Bt.tools,onSelect:Bt.handleSelect,onDismiss:Bt.handleDismiss}),Ha===`lsp-recommendation`&&It&&(0,$.jsx)(cI,{pluginName:It.pluginName,pluginDescription:It.pluginDescription,fileExtension:It.fileExtension,onResponse:Lt}),Ha===`desktop-upsell`&&(0,$.jsx)(fS,{onDone:()=>Ft(!1)}),Ha===`ultraplan-choice`&&_e&&(0,$.jsx)(fL,{plan:_e.plan,sessionId:_e.sessionId,taskId:_e.taskId,setMessages:G,readFileState:Ca.current,getAppState:()=>H.getState(),setConversationId:Ai}),Ha===`ultraplan-launch`&&ve&&(0,$.jsx)(hL,{onChoice:(e,t)=>{let n=ve.blurb;if(V(e=>e.ultraplanLaunchPending?{...e,ultraplanLaunchPending:void 0}:e),e===`cancel`)return;G(e=>[...e,qf(Fg(`ultraplan`,n))]);let r=e=>G(t=>[...t,qf(`<local-command-stdout>${q_(e)}</local-command-stdout>`)]);wp({blurb:n,promptIdentifier:t?.promptIdentifier,getAppState:()=>H.getState(),setAppState:V,signal:kl().signal,disconnectedBridge:t?.disconnectedBridge,onSessionReady:e=>{if(!fn.isActive){r(e);return}let t=fn.subscribe(()=>{fn.isActive||(t(),H.getState().ultraplanSessionUrl&&r(e))})}}).then(r).catch(ai)}}),ua(),!Rn?.shouldHidePromptInput&&!Ha&&!La&&!y&&!Sr&&(0,$.jsxs)($.Fragment,{children:[ja&&(0,$.jsx)(JI,{onRun:so,onCancel:co,reason:ZI(ja)}),va.state===`closed`?ya.state===`closed`?(0,$.jsx)(lF,{state:ga.state,lastResponse:ga.lastResponse,handleSelect:ga.handleSelect,handleTranscriptSelect:ga.handleTranscriptSelect,inputValue:Fr,setInputValue:zr,onRequestFeedback:Na.current?void 0:lo}):(0,$.jsx)(lF,{state:ya.state,lastResponse:ya.lastResponse,handleSelect:ya.handleSelect,handleTranscriptSelect:ya.handleTranscriptSelect,inputValue:Fr,setInputValue:zr,onRequestFeedback:lo,message:`How well did Claude use its memory? (optional)`}):(0,$.jsx)(lF,{state:va.state,lastResponse:va.lastResponse,handleSelect:va.handleSelect,inputValue:Fr,setInputValue:zr,onRequestFeedback:lo}),ba.state!==`closed`&&(0,$.jsx)(lF,{state:ba.state,lastResponse:null,handleSelect:()=>{},handleTranscriptSelect:ba.handleTranscriptSelect,inputValue:Fr,setInputValue:zr}),ma.suggestion&&(0,$.jsx)(CN,{isOpen:ma.isOpen,skillName:ma.suggestion.skillName,updates:ma.suggestion.updates,handleSelect:ma.handleSelect,inputValue:Fr,setInputValue:zr}),ha&&(0,$.jsx)($I,{}),(0,$.jsx)(BM,{debug:n,ideSelection:gt,hasSuppressedDialogs:!!Ua,isLocalJSXCommandActive:ar,getToolUseContext:Qa,toolPermissionContext:F,setToolPermissionContext:Xa,apiKeyStatus:ka,commands:qt,agents:L.activeAgents,isLoading:_n,onExit:mo,verbose:te,messages:W,onAutoUpdaterResult:Fn,autoUpdaterResult:Pn,input:Fr,onInputChange:zr,mode:Br,onModeChange:Vr,stashedPrompt:Hr,setStashedPrompt:Ur,submitCount:ti,onShowMessageSelector:ho,onMessageActionsEnter:void 0,mcpClients:ht,pastedContents:Qr,setPastedContents:ei,vimMode:Bi,setVimMode:Vi,showBashesDialog:Hi,setShowBashesDialog:Ui,onSubmit:io,onAgentSubmit:ao,isSearchingHistory:Wi,setIsSearchingHistory:Gi,helpOpen:Ki,setHelpOpen:qi,insertTextRef:Rr,voiceInterimRange:Mo.interimRange}),(0,$.jsx)(jP,{onBackgroundSession:$a,isLoading:_n}),(0,$.jsx)(SP,{})]}),Sr&&(0,$.jsx)(iu,{cursor:Sr}),Ha===`message-selector`&&(0,$.jsx)(rb,{messages:W,preselectedMessage:wi,onPreRestore:Ga,onRestoreCode:async e=>{await If(e=>{V(t=>({...t,fileHistory:e(t.fileHistory)}))},e.uuid)},onSummarize:async(e,t,n=`from`)=>{let r=Fc(W),i=r.indexOf(e);if(i===-1){G(e=>[...e,Sd(`That message is no longer in the active context (snipped or pre-compact). Choose a more recent message.`,`warning`)]);return}let a=Qa(r,[],kl(),Te),o=a.getAppState(),s=await vf(a.options.tools,a.options.mainLoopModel,Array.from(o.toolPermissionContext.additionalWorkingDirectories.keys()),a.options.mcpClients),c=Df({mainThreadAgentDefinition:void 0,toolUseContext:a,customSystemPrompt:a.options.customSystemPrompt,defaultSystemPrompt:s,appendSystemPrompt:a.options.appendSystemPrompt}),[l,u]=await Promise.all([Gf(),mf()]),d=await Vl(r,i,a,{systemPrompt:c,userContext:l,systemContext:u,toolUseContext:a,forkContextMessages:r},t,n),f=d.messagesToKeep??[],p=n===`up_to`?[...d.summaryMessages,...f]:[...f,...d.summaryMessages],m=[d.boundaryMarker,...p,...d.attachments,...d.hookResults];if(Sh()&&n===`from`?G(t=>{let n=t.findIndex(t=>t.uuid===e.uuid);return[...t.slice(0,n===-1?0:n),...m]}):G(m),VR?.setContextBlocked(!1),Ai(jS()),bd(a.options.querySource),n===`from`){let t=al(e);t&&(zr(t.text),Vr(t.mode))}ut({key:`summarize-ctrl-o-hint`,text:`Conversation summarized (${oa(`app:toggleTranscript`,`Global`,`ctrl+o`)} for history)`,priority:`medium`,timeoutMs:8e3})},onRestoreMessage:yo,onClose:()=>{Ci(!1),Ei(void 0)}}),process.env.USER_TYPE===`ant`&&(0,$.jsx)(cL,{})]}),!(xs&&Sh())&&Ss?(0,$.jsx)(TD,{}):null]})})},Lo)]});return Sh()?(0,$.jsx)(ce,{mouseTracking:Ms(),children:Ts}):Ts}export{uz as t};