claude-code-best 2.6.5 → 2.6.6

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 (430) hide show
  1. package/dist/chunks/{AddWorkspaceDirectory-BYyM_V0q.js → AddWorkspaceDirectory-Bb6crGWh.js} +1 -1
  2. package/dist/chunks/{App-BboadKdn.js → App-CW0Y4ceR.js} +1 -1
  3. package/dist/chunks/{ApproveApiKey-BLp4742y.js → ApproveApiKey-9rkwQfgT.js} +1 -1
  4. package/dist/chunks/ApproveApiKey-BhMr2Y5F.js +1 -0
  5. package/dist/chunks/{AssistantSessionChooser-B88DM0Oq.js → AssistantSessionChooser-XzXZZdiH.js} +1 -1
  6. package/dist/chunks/BackgroundTasksDialog-BL_dfbZP.js +2 -0
  7. package/dist/chunks/BypassPermissionsModeDialog-DlLWAKw2.js +1 -0
  8. package/dist/chunks/{ClaudeInChromeOnboarding-B6XNhFqq.js → ClaudeInChromeOnboarding-CjGydpBk.js} +1 -1
  9. package/dist/chunks/{ClaudeMdExternalIncludesDialog-BNhlq7_K.js → ClaudeMdExternalIncludesDialog-B04cjDwX.js} +1 -1
  10. package/dist/chunks/ClaudeMdExternalIncludesDialog-DPki55Xa.js +1 -0
  11. package/dist/chunks/ConsoleOAuthFlow-D_j1NebK.js +1 -0
  12. package/dist/chunks/{DesktopHandoff-S-w4bs5T.js → DesktopHandoff-CFBUqcCf.js} +1 -1
  13. package/dist/chunks/DevChannelsDialog-ByTf41du.js +1 -0
  14. package/dist/chunks/DiffDialog-CY-8kw_Q.js +3 -0
  15. package/dist/chunks/Doctor-2D5Wz58o.js +1 -0
  16. package/dist/chunks/Doctor-CDez_u_U.js +3 -0
  17. package/dist/chunks/{ExitFlow-CSBDxw9H.js → ExitFlow-BlON8IgH.js} +2 -2
  18. package/dist/chunks/Feedback-CSeD3k4M.js +2 -0
  19. package/dist/chunks/Grove-Dwu_0zRw.js +1 -0
  20. package/dist/chunks/{Grove-DSXRnXKv.js → Grove-Tp_UtIMg.js} +1 -1
  21. package/dist/chunks/{HybridTransport-CuT3KI5e.js → HybridTransport-CAko699F.js} +2 -2
  22. package/dist/chunks/{ITermBackend-mokGZVH_.js → ITermBackend-5P3WJumD.js} +1 -1
  23. package/dist/chunks/{InvalidConfigDialog-Bi4RKYlk.js → InvalidConfigDialog-CVcdra9v.js} +1 -1
  24. package/dist/chunks/{InvalidSettingsDialog-0zKo4-so.js → InvalidSettingsDialog-CfLdbmSI.js} +1 -1
  25. package/dist/chunks/MCPConnectionManager-BK_3uwQj.js +1 -0
  26. package/dist/chunks/{McpParsingWarnings-EzgsOoHw.js → McpParsingWarnings-BOj-T8F3.js} +1 -1
  27. package/dist/chunks/MessageSelector-BRkxpO1O.js +3 -0
  28. package/dist/chunks/Messages-wyMyMP7U.js +11 -0
  29. package/dist/chunks/{Onboarding-odmthwzz.js → Onboarding-C06Mxlf-.js} +1 -1
  30. package/dist/chunks/{OverageCreditUpsell-Cpk_5Lv0.js → OverageCreditUpsell-abcPm3PB.js} +1 -1
  31. package/dist/chunks/PluginSettings-DGpIVGvV.js +17 -0
  32. package/dist/chunks/{PromptInputFooterSuggestions-DrrkNOuS.js → PromptInputFooterSuggestions-ihnbjU0K.js} +1 -1
  33. package/dist/chunks/{PromptInputHelpMenu-DMsF4D6d.js → PromptInputHelpMenu-CMm8z7Gk.js} +1 -1
  34. package/dist/chunks/QueryEngine-I3Bqzbiz.js +1 -0
  35. package/dist/chunks/REPL-BxAsVlx3.js +1 -0
  36. package/dist/chunks/REPL-CBFcgD4r.js +97 -0
  37. package/dist/chunks/{RemoteCallout-CnpCWRPk.js → RemoteCallout-Cy6lH-CZ.js} +1 -1
  38. package/dist/chunks/{RemoteSessionManager-OWg_Yccq.js → RemoteSessionManager-C7iGd5Og.js} +2 -2
  39. package/dist/chunks/ResumeConversation-AdLtgdVB.js +1 -0
  40. package/dist/chunks/{SSETransport-BpnapvlK.js → SSETransport-B5xlXeAN.js} +1 -1
  41. package/dist/chunks/SearchExtraToolsTool-BJ8Nx_Nu.js +1 -0
  42. package/dist/chunks/SentryErrorBoundary-Bs7mtkPb.js +1 -0
  43. package/dist/chunks/{SentryErrorBoundary-C-NlfQZw.js → SentryErrorBoundary-iih9eFpM.js} +1 -1
  44. package/dist/chunks/Settings-PioHwsvg.js +2 -0
  45. package/dist/chunks/{TeleportProgress-CYXay2ZL.js → TeleportProgress-BX-uLwuL.js} +1 -1
  46. package/dist/chunks/TeleportRepoMismatchDialog-D8oPPTWd.js +1 -0
  47. package/dist/chunks/{TeleportResumeWrapper-DiHQeZIM.js → TeleportResumeWrapper-B_CvNDbr.js} +1 -1
  48. package/dist/chunks/{ThemePicker-BRh027fA.js → ThemePicker-BG1ykSpX.js} +1 -1
  49. package/dist/chunks/{TmuxBackend-BaX2U7iZ.js → TmuxBackend-CnMCWNS4.js} +1 -1
  50. package/dist/chunks/TrustDialog-Z_maAYj8.js +1 -0
  51. package/dist/chunks/{ValidationErrorsList-CdCUgfIl.js → ValidationErrorsList-C9swVkZ-.js} +1 -1
  52. package/dist/chunks/{WelcomeV2-DCXcYd2x.js → WelcomeV2-Au_5ddlT.js} +1 -1
  53. package/dist/chunks/WindowsTerminalBackend-CGxaYH74.js +2 -0
  54. package/dist/chunks/{add-dir-ldGd3Ppz.js → add-dir-Cm9u56YX.js} +1 -1
  55. package/dist/chunks/{agentDisplay-CVnAeURF.js → agentDisplay-Bi_bEyEn.js} +1 -1
  56. package/dist/chunks/{agents-DH5fmbVw.js → agents-CMF9fLzV.js} +7 -7
  57. package/dist/chunks/{agents-C08NzRZx.js → agents-CbjR7hNr.js} +1 -1
  58. package/dist/chunks/{ant-DJren1Aa.js → ant-Bu1Gs4WJ.js} +1 -1
  59. package/dist/chunks/api-CFNGoLoL.js +1 -0
  60. package/dist/chunks/{api-CGOR_Xfl.js → api-D_t0nHsS.js} +1 -1
  61. package/dist/chunks/assistant-BLd4y2FJ.js +1 -0
  62. package/dist/chunks/{assistant-aWkDcurV.js → assistant-C_pfWe2a.js} +1 -1
  63. package/dist/chunks/{assistant-BlzrMSkM.js → assistant-EA-MHNQ-.js} +1 -1
  64. package/dist/chunks/{auth-CSB2RDKF.js → auth-D7PZvVPf.js} +1 -1
  65. package/dist/chunks/auth-DGfZCD_B.js +1 -0
  66. package/dist/chunks/{autoMode-CWvZs1jO.js → autoMode-B8iO05xy.js} +6 -6
  67. package/dist/chunks/{autonomy-BkVcSMCZ.js → autonomy-CaLvE5N6.js} +12 -12
  68. package/dist/chunks/{autonomy-DK42aJYt.js → autonomy-dQVtSiCJ.js} +1 -1
  69. package/dist/chunks/{autonomyPanel-Cn4IhXgE.js → autonomyPanel-DSswVlCF.js} +1 -1
  70. package/dist/chunks/backgroundHousekeeping-Ckj8W3RO.js +1 -0
  71. package/dist/chunks/backgroundHousekeeping-D2_Uopt7.js +17 -0
  72. package/dist/chunks/{branch-juox_fko.js → branch-C7pM8Sjh.js} +1 -1
  73. package/dist/chunks/{bridge-DudsCZkh.js → bridge-CTYdzSWg.js} +2 -2
  74. package/dist/chunks/bridgeConfig-7c07tJm9.js +1 -0
  75. package/dist/chunks/{bridgeConfig-lRZfQqmA.js → bridgeConfig-Df6uyp3q.js} +1 -1
  76. package/dist/chunks/{bridgeEnabled-D2IykaHE.js → bridgeEnabled-A-_xJ94c.js} +1 -1
  77. package/dist/chunks/bridgeEnabled-Z2S8lk0l.js +1 -0
  78. package/dist/chunks/bridgeMain-B7FZpvo0.js +68 -0
  79. package/dist/chunks/bridgeMain-C5UxF8ST.js +1 -0
  80. package/dist/chunks/{bridgeMessaging-CqNURC4-.js → bridgeMessaging-DPVLAIzl.js} +1 -1
  81. package/dist/chunks/{btw-DKlE3Dea.js → btw-CqgjLlFN.js} +1 -1
  82. package/dist/chunks/{buddy-DQYgHR63.js → buddy-DCGBAqF2.js} +1 -1
  83. package/dist/chunks/{bypassPermissionsKillswitch-Bof-UtM-.js → bypassPermissionsKillswitch-CK0jeZTW.js} +1 -1
  84. package/dist/chunks/{caches-B5QZDncQ.js → caches-CdVW8fYV.js} +2 -2
  85. package/dist/chunks/caches-Dt52PedI.js +1 -0
  86. package/dist/chunks/{ccrClient-BaWg4E9-.js → ccrClient-B_3AmY7K.js} +1 -1
  87. package/dist/chunks/changeDetector-uO9CBvut.js +1 -0
  88. package/dist/chunks/{channelNotification-B7A-9DIl.js → channelNotification-BbDQdLZC.js} +1 -1
  89. package/dist/chunks/channelNotification-DzTzUrCe.js +1 -0
  90. package/dist/chunks/{chrome-jMAks7-w.js → chrome-CGyqsCkL.js} +1 -1
  91. package/dist/chunks/clear-B_cVk64B.js +1 -0
  92. package/dist/chunks/client-BcqXgcrx.js +1 -0
  93. package/dist/chunks/{color-DG_R5-hl.js → color-DEXUx7gE.js} +1 -1
  94. package/dist/chunks/commands-BX0_wEGw.js +1 -0
  95. package/dist/chunks/commitAttribution-CSVDcgTO.js +1 -0
  96. package/dist/chunks/{commitAttribution-C22a3OCi.js → commitAttribution-e0kkanVT.js} +1 -1
  97. package/dist/chunks/{compact-BWvnb4or.js → compact-Dh9RewNA.js} +3 -3
  98. package/dist/chunks/{companion-Bkn2lSLj.js → companion-DVFacTUw.js} +1 -1
  99. package/dist/chunks/{config-BvpTbJ5p.js → config-CkSmYDJY.js} +1 -1
  100. package/dist/chunks/{config-D-dzD6n-.js → config-DwiVCSrY.js} +1 -1
  101. package/dist/chunks/{context-DzNahdyP.js → context-B8VDDHTv.js} +1 -1
  102. package/dist/chunks/{context-noninteractive-yiyJriiw.js → context-noninteractive-IZfWniex.js} +2 -2
  103. package/dist/chunks/context-noninteractive-SBxqQ3iu.js +1 -0
  104. package/dist/chunks/conversation-CQBl9Yy2.js +1 -0
  105. package/dist/chunks/conversation-DVZplNag.js +1 -0
  106. package/dist/chunks/{copy-9k9JPRqW.js → copy-CIjrYoFa.js} +2 -2
  107. package/dist/chunks/{createSSHSession-BZf-Loo5.js → createSSHSession-ArNlbIZB.js} +1 -1
  108. package/dist/chunks/{createSession-kiTHYXSL.js → createSession-CBheIT_G.js} +1 -1
  109. package/dist/chunks/createSession-DfEQy2dZ.js +1 -0
  110. package/dist/chunks/cronJitterConfig-DcMGWOa-.js +6 -0
  111. package/dist/chunks/crossProjectResume-Z-aR2q-d.js +40 -0
  112. package/dist/chunks/{datadog-Bg-zL-i7.js → datadog-BK8eJz8B.js} +1 -1
  113. package/dist/chunks/datadog-Uj6FjEuU.js +1 -0
  114. package/dist/chunks/{desktop-DpaStjc-.js → desktop-B9vWJeRu.js} +1 -1
  115. package/dist/chunks/{diff-N_VSBo3Z.js → diff-BTV7_Dca.js} +1 -1
  116. package/dist/chunks/{doctor-CUWjbh1X.js → doctor-Dpbh0aRz.js} +1 -1
  117. package/dist/chunks/{effort-loH1TUvE.js → effort-Czlwa5qF.js} +2 -2
  118. package/dist/chunks/{entry-D58E-E6Y.js → entry-CdfuWjKu.js} +3 -3
  119. package/dist/chunks/{envLessBridgeConfig-SPEr9oqO.js → envLessBridgeConfig-BAFYaZ0E.js} +1 -1
  120. package/dist/chunks/envLessBridgeConfig-DOO9eX07.js +1 -0
  121. package/dist/chunks/{exit-D-tuPpbx.js → exit-DzOm62Dn.js} +1 -1
  122. package/dist/chunks/{export-BIZ_SPXJ.js → export-DHOR3z3Z.js} +1 -1
  123. package/dist/chunks/{exportRenderer-CWPSMaqM.js → exportRenderer-CiNXeNr9.js} +1 -1
  124. package/dist/chunks/extra-usage-CJcyfVCt.js +1 -0
  125. package/dist/chunks/{extra-usage-CCMwIa85.js → extra-usage-DIYR_3ZR.js} +1 -1
  126. package/dist/chunks/{extra-usage-core-BNW4VT7o.js → extra-usage-core-C3uM9bOP.js} +1 -1
  127. package/dist/chunks/{extra-usage-noninteractive-B_WjXO1E.js → extra-usage-noninteractive-Ctz9TfY8.js} +1 -1
  128. package/dist/chunks/{extraUsage-CNMMTNJi.js → extraUsage-CBwIvl73.js} +1 -1
  129. package/dist/chunks/extractMemories-C3SU-Osb.js +1 -0
  130. package/dist/chunks/fast-7iinMwk-.js +1 -0
  131. package/dist/chunks/{fast-CG1v3fRr.js → fast-BpBwjbSD.js} +1 -1
  132. package/dist/chunks/{feedback-CG4mS_-B.js → feedback-BkVnsZVx.js} +1 -1
  133. package/dist/chunks/{firstPartyEventLogger-Y_jAnHoR.js → firstPartyEventLogger-BCzGkdpd.js} +1 -1
  134. package/dist/chunks/{flushGate-COPcye5f.js → flushGate-CQsnMw8g.js} +1 -1
  135. package/dist/chunks/{gates-CSKxLmMJ.js → gates-CxWIWtmd.js} +1 -1
  136. package/dist/chunks/gates-qgzva-fO.js +1 -0
  137. package/dist/chunks/{gemini-B3uSLiNp.js → gemini-BbV8D2SS.js} +1 -1
  138. package/dist/chunks/{generateRecap-D7rG3jIm.js → generateRecap-B3j2nUgh.js} +1 -1
  139. package/dist/chunks/{generateSessionName-zbqanivg.js → generateSessionName-aGnXSNgN.js} +1 -1
  140. package/dist/chunks/{githubRepoPathMapping-B04nEUDG.js → githubRepoPathMapping-DCJLSTLl.js} +1 -1
  141. package/dist/chunks/{grok-CDOpos8E.js → grok-C4QFXJnR.js} +1 -1
  142. package/dist/chunks/{growthbook-C_EY78Sn.js → growthbook-prtWhMRg.js} +1 -1
  143. package/dist/chunks/{heapdump-CpmhJ55b.js → heapdump-Czm-2XiG.js} +1 -1
  144. package/dist/chunks/{help-EHn2neTv.js → help-CSAFsN0-.js} +1 -1
  145. package/dist/chunks/hooks-Ch2vPE8u.js +1 -0
  146. package/dist/chunks/{hooks-BV6HqbU4.js → hooks-DkbOP-bI.js} +2 -2
  147. package/dist/chunks/{hostAdapter-_SmFAVNf.js → hostAdapter-BcdDPVTj.js} +1 -1
  148. package/dist/chunks/{ide-DkN0KdTR.js → ide-BXERRFZF.js} +2 -2
  149. package/dist/chunks/{inboundAttachments-DnGQw7Pf.js → inboundAttachments-7rXrAtkb.js} +1 -1
  150. package/dist/chunks/inboundAttachments-C0rkLl2x.js +1 -0
  151. package/dist/chunks/initReplBridge-tXqkba08.js +1 -0
  152. package/dist/chunks/{insights-Bs9kJDG6.js → insights-DrvqJgF8.js} +25 -25
  153. package/dist/chunks/{install-CFX_ph9z.js → install-BGnxwO00.js} +1 -1
  154. package/dist/chunks/{install-github-app-CvRjY1Wi.js → install-github-app-CIpBHlr9.js} +2 -2
  155. package/dist/chunks/{install-slack-app-DjhnVSe0.js → install-slack-app-By4Lh7ww.js} +1 -1
  156. package/dist/chunks/{instrumentation-c5zlOWom.js → instrumentation-D9y7Ph_R.js} +3 -3
  157. package/dist/chunks/{job-3QwLq609.js → job-BPVIMW_P.js} +1 -1
  158. package/dist/chunks/{keybindings-7mDm3UKD.js → keybindings-Ce6AHMLI.js} +2 -2
  159. package/dist/chunks/{lang-DyyjY20G.js → lang-DfDG_fSa.js} +1 -1
  160. package/dist/chunks/language-B1yHC1d6.js +1 -0
  161. package/dist/chunks/{language-CPRGmY8Q.js → language-yGoDFP3X.js} +1 -1
  162. package/dist/chunks/{launchAgentsPlatform-CpsMsTqQ.js → launchAgentsPlatform-DT01xZM7.js} +1 -1
  163. package/dist/chunks/launchAutofixPr-DrYd7WVf.js +18 -0
  164. package/dist/chunks/{launchLocalMemory-DlYQcEQJ.js → launchLocalMemory-Bt3tMYVJ.js} +1 -1
  165. package/dist/chunks/{launchLocalVault-CP0AyPjj.js → launchLocalVault-jyRHEa_Y.js} +1 -1
  166. package/dist/chunks/{launchMemoryStores-BHoDFkJ5.js → launchMemoryStores-cmXnLAF5.js} +1 -1
  167. package/dist/chunks/{launchOnboarding-CFTNXcnc.js → launchOnboarding-BPTNFftb.js} +1 -1
  168. package/dist/chunks/{launchSchedule-5KQr6x_A.js → launchSchedule-141GqGC8.js} +1 -1
  169. package/dist/chunks/{launchSkillStore-D0yGuE68.js → launchSkillStore-Bz0lok_o.js} +1 -1
  170. package/dist/chunks/{launchTeleport-DRKnXOwY.js → launchTeleport-BMquJxIq.js} +2 -2
  171. package/dist/chunks/{launchVault-XA-zAswX.js → launchVault-Bsuwqad6.js} +1 -1
  172. package/dist/chunks/{loadAgentsDir-DI1a76pd.js → loadAgentsDir-D7kapZB5.js} +506 -498
  173. package/dist/chunks/loadAgentsDir-DxPE2bIO.js +1 -0
  174. package/dist/chunks/{loadPluginHooks-C0Ei-0E2.js → loadPluginHooks-CL5aGDrb.js} +1 -1
  175. package/dist/chunks/localSearch-iozuZZhZ.js +1 -0
  176. package/dist/chunks/{localSearch-CDOJNc_E.js → localSearch-r1_G8kfV.js} +1 -1
  177. package/dist/chunks/{login-nwTOoyxv.js → login-7MvpaOkt.js} +1 -1
  178. package/dist/chunks/login-Dxza_KNT.js +1 -0
  179. package/dist/chunks/{logoV2Utils-DDUoPClc.js → logoV2Utils-DjThKW15.js} +1 -1
  180. package/dist/chunks/logout-BeGQR78E.js +1 -0
  181. package/dist/chunks/{magicDocs-CmUlOWjI.js → magicDocs-Dy72LHIj.js} +2 -2
  182. package/dist/chunks/{main-CeG_nUsC.js → main-CF6Im-LV.js} +46 -46
  183. package/dist/chunks/{mappers-CJ8IO1o1.js → mappers-CkMESMy7.js} +1 -1
  184. package/dist/chunks/mcp-BTgHgOhR.js +2 -0
  185. package/dist/chunks/mcp-UJZ22IDJ.js +6 -0
  186. package/dist/chunks/mcp-fHf8Uc7h.js +1 -0
  187. package/dist/chunks/{mcpServer-lIneUZ5p.js → mcpServer-BueM5fWI.js} +1 -1
  188. package/dist/chunks/{mcpServer-DPHQVYdC.js → mcpServer-Dqm2PQQx.js} +1 -1
  189. package/dist/chunks/{memory-BcWBkKV8.js → memory-BNZmqma1.js} +1 -1
  190. package/dist/chunks/model-D3g2QdU-.js +1 -0
  191. package/dist/chunks/{model-DJLzVvcF.js → model-DOw7wIKQ.js} +1 -1
  192. package/dist/chunks/{onChangeAppState-Dxbl8fvk.js → onChangeAppState-Cb9_yIuW.js} +1 -1
  193. package/dist/chunks/{openai-DkYK4THc.js → openai-Bvo0Gcec.js} +3 -3
  194. package/dist/chunks/{overageCreditGrant-DLKadMYU.js → overageCreditGrant-BrN7dk3d.js} +1 -1
  195. package/dist/chunks/{passes-BIfuerjL.js → passes-vgcY8_l8.js} +1 -1
  196. package/dist/chunks/{paths-BBvuDQl9.js → paths-1ngPRtu3.js} +2 -2
  197. package/dist/chunks/permissions-BDbIjTT6.js +3 -0
  198. package/dist/chunks/{pipeTransport-DVoIA1uN.js → pipeTransport-KU8psPDI.js} +1 -1
  199. package/dist/chunks/{plan--lnWxB3Q.js → plan-5NVPuxp6.js} +1 -1
  200. package/dist/chunks/{plugin-DWLyrLw4.js → plugin-t8jMqdsY.js} +1 -1
  201. package/dist/chunks/{pluginAutoupdate-CGXIWBrb.js → pluginAutoupdate-CAa4KLro.js} +1 -1
  202. package/dist/chunks/{pluginBlocklist-DJrMdzT0.js → pluginBlocklist-BG2LkLq1.js} +1 -1
  203. package/dist/chunks/{pluginCliCommands-C08q9dHk.js → pluginCliCommands-vqAtVibb.js} +1 -1
  204. package/dist/chunks/{pluginFlagging-Dggxke70.js → pluginFlagging-BFCtv3kY.js} +1 -1
  205. package/dist/chunks/{pluginOperations-CNCImIe8.js → pluginOperations-C9XP-mko.js} +2 -2
  206. package/dist/chunks/pluginStartupCheck-DZp0wnXP.js +1 -0
  207. package/dist/chunks/{pluginStartupCheck-BW2fjg2P.js → pluginStartupCheck-RRcAbKfx.js} +1 -1
  208. package/dist/chunks/plugins-0SyID4Kx.js +4 -0
  209. package/dist/chunks/policyLimits-Cmmzuv-E.js +1 -0
  210. package/dist/chunks/{pollConfig-DAQ-ives.js → pollConfig-DTYIJ8lQ.js} +1 -1
  211. package/dist/chunks/{poor-DqfrQT61.js → poor-Dw5dMZpM.js} +1 -1
  212. package/dist/chunks/{poorMode-DzYT47KW.js → poorMode-CsGLI_hm.js} +1 -1
  213. package/dist/chunks/poorMode-D_hB-rDf.js +1 -0
  214. package/dist/chunks/{print-GGVp62vj.js → print-Ct8N4PYT.js} +12 -12
  215. package/dist/chunks/{privacy-settings-agwqjYJo.js → privacy-settings-P2r-kg2i.js} +1 -1
  216. package/dist/chunks/processBashCommand-a8W8aTRu.js +1 -0
  217. package/dist/chunks/{processSlashCommand-COtIO6Jy.js → processSlashCommand-BaUdUg3T.js} +3 -3
  218. package/dist/chunks/prompt-B1Qy8mi4.js +1 -0
  219. package/dist/chunks/{prompt-CjFAtm3w.js → prompt-BBg3jtfc.js} +1 -1
  220. package/dist/chunks/prompt-D4kWWEZC.js +1 -0
  221. package/dist/chunks/{promptEditor-EgosPsy-.js → promptEditor-CvaugNTt.js} +2 -2
  222. package/dist/chunks/{protocolHandler-mtPUT9U0.js → protocolHandler-DxBaHlaD.js} +1 -1
  223. package/dist/chunks/{rate-limit-options-C6SFOHue.js → rate-limit-options-Df_sgE0b.js} +1 -1
  224. package/dist/chunks/rcDebugLog-CPGWJbI4.js +11 -0
  225. package/dist/chunks/{referral-DeDr9zAE.js → referral-BKeCKnOJ.js} +1 -1
  226. package/dist/chunks/{refresh-D7pdoY_X.js → refresh-Cjv4jA6L.js} +1 -1
  227. package/dist/chunks/{registerProtocol-BZBH8Zgl.js → registerProtocol-DLuRm0mf.js} +1 -1
  228. package/dist/chunks/{registry-Dz6AbiYP.js → registry-DVSgtCq5.js} +1 -1
  229. package/dist/chunks/{release-notes-DiUNOrg9.js → release-notes-CZcf8zB7.js} +1 -1
  230. package/dist/chunks/{releaseNotes-CnhQit0y.js → releaseNotes-CvfZb3fZ.js} +2 -2
  231. package/dist/chunks/{reload-plugins-Dx52GcaG.js → reload-plugins-pSlDLk3b.js} +1 -1
  232. package/dist/chunks/{remote-env-B67Oo3sI.js → remote-env-BH89NuwC.js} +1 -1
  233. package/dist/chunks/{remoteBridgeCore-BzSUgPbt.js → remoteBridgeCore-CrXlWEL1.js} +1 -1
  234. package/dist/chunks/{remoteControlServer-L8smP7Zu.js → remoteControlServer-BSOnq4yY.js} +1 -1
  235. package/dist/chunks/{rename-C4PauyTZ.js → rename-DNGvNQm2.js} +1 -1
  236. package/dist/chunks/{resume-CrSn26xq.js → resume-6UL38yL3.js} +2 -2
  237. package/dist/chunks/{runtimeObserver-nAhH4Wca.js → runtimeObserver-BhvHeiwD.js} +4 -4
  238. package/dist/chunks/{runtimeObserver-YNy3mIb7.js → runtimeObserver-Cp-DN8fP.js} +1 -1
  239. package/dist/chunks/sandbox-adapter-DGVtPPD0.js +1 -0
  240. package/dist/chunks/{sandbox-toggle-BYqbcI5d.js → sandbox-toggle-D19YbI5G.js} +1 -1
  241. package/dist/chunks/searchExtraTools-DXWkpOIg.js +1 -0
  242. package/dist/chunks/{sentry-BNVxoVLS.js → sentry-BZmpC-iI.js} +1 -1
  243. package/dist/chunks/{session-BuEmHrqM.js → session-lLpGqp0B.js} +2 -2
  244. package/dist/chunks/{sessionDiscovery-Mcsfa0g-.js → sessionDiscovery-BX3fjgzD.js} +1 -1
  245. package/dist/chunks/sessionFileAccessHooks-BeuS4m7a.js +1 -0
  246. package/dist/chunks/sessionMemory-LMOQk90c.js +1 -0
  247. package/dist/chunks/sessionMemory-UpILj5ww.js +1 -0
  248. package/dist/chunks/sessionMemoryUtils-DE7AezA0.js +1 -0
  249. package/dist/chunks/{sessionObserver-DG2zQgfi.js → sessionObserver-CujNIWks.js} +1 -1
  250. package/dist/chunks/sessionObserver-HqvTXhs9.js +1 -0
  251. package/dist/chunks/sessionStorage-BN56DAAd.js +1 -0
  252. package/dist/chunks/{sessionTitle-zUVSAHO7.js → sessionTitle-QxXslbJY.js} +1 -1
  253. package/dist/chunks/{sessionTracing-DoRJ4nSa.js → sessionTracing-DognYcDf.js} +1 -1
  254. package/dist/chunks/{settingsSync-B9bz77E1.js → settingsSync-DEPET5O1.js} +1 -1
  255. package/dist/chunks/{setup-B1JbPepL.js → setup-BUBUidOg.js} +1 -1
  256. package/dist/chunks/setup-BZMVuIIx.js +2 -0
  257. package/dist/chunks/{setup-CCOLlRtP.js → setup-C6G0lasE.js} +1 -1
  258. package/dist/chunks/{shadowedRuleDetection-BBR3uEgx.js → shadowedRuleDetection-CQayPrmM.js} +1 -1
  259. package/dist/chunks/{sideQuestion-DHW5rgKz.js → sideQuestion-B9EE1vTM.js} +1 -1
  260. package/dist/chunks/sink-BRrEbL6h.js +1 -0
  261. package/dist/chunks/{sink-DxDOsLa2.js → sink-Cugto5We.js} +1 -1
  262. package/dist/chunks/{sinks-BrrTUxkC.js → sinks-B9A94oIj.js} +2 -2
  263. package/dist/chunks/sinks-CKaSBvU8.js +1 -0
  264. package/dist/chunks/{skill-learning-C0nOKZfg.js → skill-learning-CroDcatu.js} +1 -1
  265. package/dist/chunks/skillChangeDetector-DnyEQqe6.js +1 -0
  266. package/dist/chunks/{skillGapStore-_YuJP5KI.js → skillGapStore-91Mb3xDY.js} +2 -2
  267. package/dist/chunks/{skillGapStore-Czi5jKjJ.js → skillGapStore-LKwap3o4.js} +1 -1
  268. package/dist/chunks/{skillGenerator-kbaRbpqJ.js → skillGenerator-B9GM0LHk.js} +2 -2
  269. package/dist/chunks/skillLearning-D6latSKi.js +1 -0
  270. package/dist/chunks/skillLearning-DbOOqb6b.js +1 -0
  271. package/dist/chunks/{skillPanel-BxDvlPzd.js → skillPanel-rIIYgnBE.js} +3 -3
  272. package/dist/chunks/{skillSearchPanel-D-MX6Qgt.js → skillSearchPanel-xAL-6uJF.js} +4 -4
  273. package/dist/chunks/{skills-NpEgFkFZ.js → skills-Doe47wxK.js} +1 -1
  274. package/dist/chunks/{sprites-DD4eIkN7.js → sprites-D11F3i1M.js} +1 -1
  275. package/dist/chunks/{stats-xL3NHwhp.js → stats-WNUyieG-.js} +1 -1
  276. package/dist/chunks/{status-B5E70xRv.js → status-CjBS9SkF.js} +1 -1
  277. package/dist/chunks/{statusNoticeHelpers-DcssRhLw.js → statusNoticeHelpers-cnI4TiGw.js} +1 -1
  278. package/dist/chunks/{tag-BELr-qIa.js → tag-Gfb8vTAR.js} +2 -2
  279. package/dist/chunks/{tasks-CrdWcSt-.js → tasks-BwX1rzOD.js} +1 -1
  280. package/dist/chunks/{teamHelpers--3ZyNDlv.js → teamHelpers-DEgaCpta.js} +1 -1
  281. package/dist/chunks/teamHelpers-EJxTXoTV.js +1 -0
  282. package/dist/chunks/teammateModeSnapshot-BgUQ4Phz.js +1 -0
  283. package/dist/chunks/{teammateModeSnapshot-DOQMTKbQ.js → teammateModeSnapshot-Dyukgtp9.js} +1 -1
  284. package/dist/chunks/teleport-B4p8XlAv.js +1 -0
  285. package/dist/chunks/{templateJobs-8IY2Cgig.js → templateJobs-DQXuFnkl.js} +1 -1
  286. package/dist/chunks/{terminalSetup-C4psrmpb.js → terminalSetup-CTEIn08j.js} +1 -1
  287. package/dist/chunks/{terminalSetup-Lyg4NbGA.js → terminalSetup-bSbq4LE7.js} +1 -1
  288. package/dist/chunks/{theme-B8GNnJ_q.js → theme-DazaKPy8.js} +1 -1
  289. package/dist/chunks/thinkback-BOfZP_QG.js +1 -0
  290. package/dist/chunks/{thinkback-DPXwEK3B.js → thinkback-CxWZV2Oz.js} +1 -1
  291. package/dist/chunks/{thinkback-play-BMOE-ceh.js → thinkback-play-CHe1x2Hc.js} +1 -1
  292. package/dist/chunks/{toolEventObserver-DzLd0MSn.js → toolEventObserver-D4h-QqVP.js} +1 -1
  293. package/dist/chunks/{toolEventObserver-D0TSHm01.js → toolEventObserver-Dfvv2trb.js} +1 -1
  294. package/dist/chunks/toolPool-BHChMuLr.js +1 -0
  295. package/dist/chunks/toolPool-C5K43w4_.js +1 -0
  296. package/dist/chunks/{trustedDevice-1iTu4LEm.js → trustedDevice-CQ9PK-8m.js} +1 -1
  297. package/dist/chunks/{trustedDevice-BvYYXfd8.js → trustedDevice-rdvUkS1W.js} +1 -1
  298. package/dist/chunks/{ultrareviewCommand-BTXAN2wP.js → ultrareviewCommand-Zf9hO4wr.js} +2 -2
  299. package/dist/chunks/{undercover-DvvnEmsX.js → undercover-DLyKv5TE.js} +1 -1
  300. package/dist/chunks/undercover-DNS9V_JT.js +1 -0
  301. package/dist/chunks/{updateCCB-C-qfLi0j.js → updateCCB-7WQRz9lW.js} +4 -4
  302. package/dist/chunks/{upgrade-DTBZSxwv.js → upgrade-ByIumMQe.js} +1 -1
  303. package/dist/chunks/upgrade-bK4x32Ma.js +1 -0
  304. package/dist/chunks/{upload-BF8tf_Eo.js → upload-CvOMbA9_.js} +1 -1
  305. package/dist/chunks/{usage-DvSTXEYY.js → usage-C_d-Z-eb.js} +1 -1
  306. package/dist/chunks/{usage-BRYRRgNt.js → usage-DE4PSQiF.js} +1 -1
  307. package/dist/chunks/useMainLoopModel-Os8Ao8-x.js +1 -0
  308. package/dist/chunks/{useManagePlugins-GmnI9K53.js → useManagePlugins-BYBubfHU.js} +1 -1
  309. package/dist/chunks/{useMergedTools-Dah5KDMi.js → useMergedTools-BJAn2i-F.js} +1 -1
  310. package/dist/chunks/{useSearchInput-BV_azHiA.js → useSearchInput-CF77X2OV.js} +1 -1
  311. package/dist/chunks/useSettingsErrors-DD7fQ-fU.js +1 -0
  312. package/dist/chunks/{useVoice-DR69NLxp.js → useVoice-DwzMN0fq.js} +1 -1
  313. package/dist/chunks/{util-BpyJ4Bom.js → util-DD30Y4o8.js} +1 -1
  314. package/dist/chunks/utils-D44M8obg.js +1 -0
  315. package/dist/chunks/validatePlugin-DpHiJRsT.js +1 -0
  316. package/dist/chunks/{vim-DvOw8dfR.js → vim-zc9EiMil.js} +1 -1
  317. package/dist/chunks/{voice-B3BZs53f.js → voice-BRhZt4jW.js} +2 -2
  318. package/dist/chunks/{voiceModeEnabled-DA76xN1Q.js → voiceModeEnabled-168-1Ocs.js} +1 -1
  319. package/dist/chunks/voiceModeEnabled-CTT25yFj.js +1 -0
  320. package/dist/chunks/{voiceStreamSTT-_w1VjIOs.js → voiceStreamSTT-B80UegKG.js} +1 -1
  321. package/dist/chunks/voiceStreamSTT-BpYhKo2H.js +1 -0
  322. package/dist/chunks/{workerRegistry-2_MZVih1.js → workerRegistry-s8nnpmUO.js} +1 -1
  323. package/dist/chunks/worktree-CkB4jLXK.js +1 -0
  324. package/dist/chunks/{xml-Dx--sNE1.js → xml-DTMvLcPg.js} +1 -1
  325. package/dist/cli.js +1 -1
  326. package/package.json +1 -1
  327. package/dist/chunks/ApproveApiKey-DiEe4eui.js +0 -1
  328. package/dist/chunks/BackgroundTasksDialog-ByraVuXh.js +0 -2
  329. package/dist/chunks/BypassPermissionsModeDialog-BDvmz12S.js +0 -1
  330. package/dist/chunks/ClaudeMdExternalIncludesDialog-B4ocUjev.js +0 -1
  331. package/dist/chunks/ConsoleOAuthFlow-BvaB9b0y.js +0 -1
  332. package/dist/chunks/DevChannelsDialog-BljR0X9X.js +0 -1
  333. package/dist/chunks/DiffDialog-BhQ2QaLW.js +0 -3
  334. package/dist/chunks/Doctor-BXb0qv6n.js +0 -3
  335. package/dist/chunks/Doctor-C5DYPEGl.js +0 -1
  336. package/dist/chunks/Feedback-DwHzc4UT.js +0 -2
  337. package/dist/chunks/Grove-DnTo982-.js +0 -1
  338. package/dist/chunks/MCPConnectionManager-DYGoS1Ht.js +0 -1
  339. package/dist/chunks/MessageSelector-DTmUuEKJ.js +0 -3
  340. package/dist/chunks/Messages-DWiKTx5o.js +0 -11
  341. package/dist/chunks/PluginSettings-eYcWehI8.js +0 -17
  342. package/dist/chunks/QueryEngine-C_KZts4y.js +0 -1
  343. package/dist/chunks/REPL-C6YR0VKU.js +0 -1
  344. package/dist/chunks/REPL-DzHz-LOY.js +0 -97
  345. package/dist/chunks/ResumeConversation-BktSnsCm.js +0 -1
  346. package/dist/chunks/SearchExtraToolsTool-CqFD8vVS.js +0 -1
  347. package/dist/chunks/SentryErrorBoundary-BUirJRWU.js +0 -1
  348. package/dist/chunks/Settings-vfFvcweR.js +0 -2
  349. package/dist/chunks/TeleportRepoMismatchDialog-_zbZTvcJ.js +0 -1
  350. package/dist/chunks/TrustDialog-CVbzrv6g.js +0 -1
  351. package/dist/chunks/WindowsTerminalBackend-BE9NX5IH.js +0 -2
  352. package/dist/chunks/api-6tcwJlf_.js +0 -1
  353. package/dist/chunks/assistant-CwbhlCM-.js +0 -1
  354. package/dist/chunks/auth-GxZhOvQ1.js +0 -1
  355. package/dist/chunks/backgroundHousekeeping-BIZTAYho.js +0 -17
  356. package/dist/chunks/backgroundHousekeeping-Csh58CxV.js +0 -1
  357. package/dist/chunks/bridgeConfig-D4tpc568.js +0 -1
  358. package/dist/chunks/bridgeEnabled-B8_c_Ppq.js +0 -1
  359. package/dist/chunks/bridgeMain-C5RDihlX.js +0 -68
  360. package/dist/chunks/bridgeMain-D7_lg2iJ.js +0 -1
  361. package/dist/chunks/caches-dGk7xsDu.js +0 -1
  362. package/dist/chunks/changeDetector-DoLfg8a6.js +0 -1
  363. package/dist/chunks/channelNotification-DDErroWn.js +0 -1
  364. package/dist/chunks/clear-OudnCGa7.js +0 -1
  365. package/dist/chunks/client-DxDmXXTh.js +0 -1
  366. package/dist/chunks/commands-BWIOEBPs.js +0 -1
  367. package/dist/chunks/commitAttribution-BA4fcbHf.js +0 -1
  368. package/dist/chunks/context-noninteractive-CM1-lUSe.js +0 -1
  369. package/dist/chunks/conversation-DKlz47xf.js +0 -1
  370. package/dist/chunks/conversation-cUxdb8MN.js +0 -1
  371. package/dist/chunks/createSession-BuJcoBAj.js +0 -1
  372. package/dist/chunks/cronJitterConfig-CYP7yrQu.js +0 -6
  373. package/dist/chunks/crossProjectResume-BJisir9Z.js +0 -40
  374. package/dist/chunks/datadog-CVeFkaQu.js +0 -1
  375. package/dist/chunks/envLessBridgeConfig-CT8sdmFu.js +0 -1
  376. package/dist/chunks/extra-usage-rdJ7ecEb.js +0 -1
  377. package/dist/chunks/extractMemories-BrvZVsmM.js +0 -1
  378. package/dist/chunks/fast-CLKKsx2H.js +0 -1
  379. package/dist/chunks/gates-CSHuXnUx.js +0 -1
  380. package/dist/chunks/hooks-BFdX17Za.js +0 -1
  381. package/dist/chunks/inboundAttachments-BVUunfAX.js +0 -1
  382. package/dist/chunks/initReplBridge-tPRGPBq7.js +0 -1
  383. package/dist/chunks/language-Cf6bMI4N.js +0 -1
  384. package/dist/chunks/launchAutofixPr-D9h6YAZY.js +0 -2
  385. package/dist/chunks/loadAgentsDir-DCyiY0MN.js +0 -1
  386. package/dist/chunks/localSearch-MBx7KzC2.js +0 -1
  387. package/dist/chunks/login-D8UKKaud.js +0 -1
  388. package/dist/chunks/logout-B0BjqlGi.js +0 -1
  389. package/dist/chunks/mcp-CanCqnch.js +0 -2
  390. package/dist/chunks/mcp-Dq0kxZFx.js +0 -6
  391. package/dist/chunks/mcp-zbxZM9BP.js +0 -1
  392. package/dist/chunks/model-H3rtl6eR.js +0 -1
  393. package/dist/chunks/permissions-S2EvIRKj.js +0 -3
  394. package/dist/chunks/pluginStartupCheck-DpxQPXJE.js +0 -1
  395. package/dist/chunks/plugins-DQ3CRWWO.js +0 -4
  396. package/dist/chunks/policyLimits-BotYrS-v.js +0 -1
  397. package/dist/chunks/poorMode-DEAe3hiK.js +0 -1
  398. package/dist/chunks/processBashCommand-DHHN8Ca4.js +0 -1
  399. package/dist/chunks/prompt-CO160cIr.js +0 -1
  400. package/dist/chunks/prompt-GY9hlRvI.js +0 -1
  401. package/dist/chunks/rcDebugLog-CPKZCtR8.js +0 -11
  402. package/dist/chunks/sandbox-adapter-CzwHes1i.js +0 -1
  403. package/dist/chunks/searchExtraTools-CcpdCO6l.js +0 -1
  404. package/dist/chunks/sessionFileAccessHooks-qnNiGMnE.js +0 -1
  405. package/dist/chunks/sessionMemory-CMahwDdW.js +0 -1
  406. package/dist/chunks/sessionMemory-pFSn4HSN.js +0 -1
  407. package/dist/chunks/sessionMemoryUtils-Du5jUl7M.js +0 -1
  408. package/dist/chunks/sessionObserver-Je868MC9.js +0 -1
  409. package/dist/chunks/sessionStorage-D3FhAADV.js +0 -1
  410. package/dist/chunks/setup-DWkSjA49.js +0 -2
  411. package/dist/chunks/sink-cQOgsnw3.js +0 -1
  412. package/dist/chunks/sinks-Djiz_5-Z.js +0 -1
  413. package/dist/chunks/skillChangeDetector-D8C-uQSQ.js +0 -1
  414. package/dist/chunks/skillLearning-3KWrBczS.js +0 -1
  415. package/dist/chunks/skillLearning-DBbdGbk-.js +0 -1
  416. package/dist/chunks/teamHelpers-CUAiXng3.js +0 -1
  417. package/dist/chunks/teammateModeSnapshot-C6EWhR0X.js +0 -1
  418. package/dist/chunks/teleport-LXFOan9C.js +0 -1
  419. package/dist/chunks/thinkback-DZW3Mcx_.js +0 -1
  420. package/dist/chunks/toolPool-DVOfpjDz.js +0 -1
  421. package/dist/chunks/toolPool-Dq-Vtvrj.js +0 -1
  422. package/dist/chunks/undercover-C_44e3oN.js +0 -1
  423. package/dist/chunks/upgrade-CGXa5Dwy.js +0 -1
  424. package/dist/chunks/useMainLoopModel-CwvuTRXn.js +0 -1
  425. package/dist/chunks/useSettingsErrors-C-j_Zt7g.js +0 -1
  426. package/dist/chunks/utils-CrZcpypC.js +0 -1
  427. package/dist/chunks/validatePlugin-vptAYuYu.js +0 -1
  428. package/dist/chunks/voiceModeEnabled-DIveLYGb.js +0 -1
  429. package/dist/chunks/voiceStreamSTT-hpzWd_zl.js +0 -1
  430. package/dist/chunks/worktree-CCuDwRmS.js +0 -1
@@ -1 +1 @@
1
- import{n as e}from"./chunk-DR8-3Aex.js";import{n as t,t as n}from"./figures-gfT9mM8P.js";import{Rn as r,b as i,o as a,t as o,x as s}from"./src-Di342QoJ.js";import{t as c}from"./jsx-runtime-D-D469L8.js";import{Zc as l,el as u,nc as d,tc as f}from"./paths-BBvuDQl9.js";import{b as p,x as m}from"./startupProfiler-DnXZaX4A.js";import{Dk as h,Ek as g,Lo as _,Oo as v,al as y,rl as b}from"./loadAgentsDir-DI1a76pd.js";import{Fn as x,In as S,Mn as C,Pn as w,hn as T,in as E,rn as D,xn as O}from"./prompt-CjFAtm3w.js";import{n as k,t as ee}from"./staticRender-Br64h1E1.js";function A(e){let t=[];return j(e,t),M(e,t),P(e,t),F(e,t),I(e,t),t.sort((e,t)=>e.severity===t.severity?(t.savingsTokens??0)-(e.savingsTokens??0):e.severity===`warning`?-1:1),t}function j(e,t){e.percentage>=B&&t.push({severity:`warning`,title:`Context is ${e.percentage}% full`,detail:e.isAutoCompactEnabled?`Autocompact will trigger soon, which discards older messages. Use /compact now to control what gets kept.`:`Autocompact is disabled. Use /compact to free space, or enable autocompact in /config.`})}function M(e,t){if(e.messageBreakdown)for(let n of e.messageBreakdown.toolCallsByType){let r=n.callTokens+n.resultTokens,i=r/e.rawMaxTokens*100;if(i<L||r<R)continue;let a=N(n.name,r,i);a&&t.push(a)}}function N(e,t,n){let r=p(t);switch(e){case x:return{severity:`warning`,title:`Bash results using ${r} tokens (${n.toFixed(0)}%)`,detail:`Pipe output through head, tail, or grep to reduce result size. Avoid cat on large files — use Read with offset/limit instead.`,savingsTokens:Math.floor(t*.5)};case T:return{severity:`info`,title:`Read results using ${r} tokens (${n.toFixed(0)}%)`,detail:`Use offset and limit parameters to read only the sections you need. Avoid re-reading entire files when you only need a few lines.`,savingsTokens:Math.floor(t*.3)};case C:return{severity:`info`,title:`Grep results using ${r} tokens (${n.toFixed(0)}%)`,detail:`Add more specific patterns or use the glob or type parameter to narrow file types. Consider Glob for file discovery instead of Grep.`,savingsTokens:Math.floor(t*.3)};case D:return{severity:`info`,title:`WebFetch results using ${r} tokens (${n.toFixed(0)}%)`,detail:`Web page content can be very large. Consider extracting only the specific information needed.`,savingsTokens:Math.floor(t*.4)};default:return n>=20?{severity:`info`,title:`${e} using ${r} tokens (${n.toFixed(0)}%)`,detail:`This tool is consuming a significant portion of context.`,savingsTokens:Math.floor(t*.2)}:null}}function P(e,t){if(!e.messageBreakdown)return;let n=e.messageBreakdown.toolCallsByType.find(e=>e.name===T);if(!n)return;let r=n.callTokens+n.resultTokens,i=r/e.rawMaxTokens*100,a=n.resultTokens/e.rawMaxTokens*100;i>=L&&r>=R||a>=z&&n.resultTokens>=R&&t.push({severity:`info`,title:`File reads using ${p(n.resultTokens)} tokens (${a.toFixed(0)}%)`,detail:`If you are re-reading files, consider referencing earlier reads. Use offset/limit for large files.`,savingsTokens:Math.floor(n.resultTokens*.3)})}function F(e,t){let n=e.memoryFiles.reduce((e,t)=>e+t.tokens,0),r=n/e.rawMaxTokens*100;if(r>=V&&n>=H){let i=[...e.memoryFiles].sort((e,t)=>t.tokens-e.tokens).slice(0,3).map(e=>`${l(e.path)} (${p(e.tokens)})`).join(`, `);t.push({severity:`info`,title:`Memory files using ${p(n)} tokens (${r.toFixed(0)}%)`,detail:`Largest: ${i}. Use /memory to review and prune stale entries.`,savingsTokens:Math.floor(n*.3)})}}function I(e,t){!e.isAutoCompactEnabled&&e.percentage>=50&&e.percentage<B&&t.push({severity:`info`,title:`Autocompact is disabled`,detail:`Without autocompact, you will hit context limits and lose the conversation. Enable it in /config or use /compact manually.`})}var L,R,z,B,V,H,U=e((()=>{S(),O(),w(),E(),u(),m(),L=15,R=1e4,z=5,B=80,V=5,H=5e3}));function W({suggestions:e}){return e.length===0?null:(0,G.jsxs)(s,{flexDirection:`column`,marginTop:1,children:[(0,G.jsx)(i,{bold:!0,children:`Suggestions`}),e.map((e,t)=>(0,G.jsxs)(s,{flexDirection:`column`,marginTop:t===0?0:1,children:[(0,G.jsxs)(s,{children:[(0,G.jsx)(a,{status:e.severity,withSpace:!0}),(0,G.jsx)(i,{bold:!0,children:e.title}),e.savingsTokens?(0,G.jsxs)(i,{dimColor:!0,children:[` `,n.arrowRight,` save ~`,p(e.savingsTokens)]}):null]}),(0,G.jsx)(s,{marginLeft:2,children:(0,G.jsx)(i,{dimColor:!0,children:e.detail})})]},t))]})}var G,K=e((()=>{t(),r(),o(),m(),G=c()}));function q(){return null}function J(e){let t=new Map;for(let n of e){let e=f(n.source),r=t.get(e)||[];r.push(n),t.set(e,r)}for(let[e,n]of t.entries())t.set(e,n.sort((e,t)=>t.tokens-e.tokens));let n=new Map;for(let e of Q){let r=t.get(e);r&&n.set(e,r)}return n}function Y({data:e}){let{categories:t,totalTokens:n,rawMaxTokens:r,percentage:a,gridRows:o,model:c,memoryFiles:u,mcpTools:d,deferredBuiltinTools:f=[],systemTools:m,systemPromptSections:h,agents:g,skills:_,messageBreakdown:v,cacheHitRate:y,cacheThreshold:b}=e,x=t.filter(e=>e.tokens>0&&e.name!==`Free space`&&e.name!==Z&&!e.isDeferred),S=t.some(e=>e.isDeferred&&e.name.includes(`MCP`)),C=f.length>0,w=t.find(e=>e.name===Z);return(0,X.jsxs)(s,{flexDirection:`column`,paddingLeft:1,children:[(0,X.jsx)(i,{bold:!0,children:`Context Usage`}),(0,X.jsxs)(s,{flexDirection:`row`,gap:2,children:[(0,X.jsx)(s,{flexDirection:`column`,flexShrink:0,children:o.map((e,t)=>(0,X.jsx)(s,{flexDirection:`row`,marginLeft:-1,children:e.map((e,t)=>e.categoryName===`Free space`?(0,X.jsx)(i,{dimColor:!0,children:`⛶ `},t):e.categoryName===Z?(0,X.jsx)(i,{color:e.color,children:`⛝ `},t):(0,X.jsx)(i,{color:e.color,children:e.squareFullness>=.7?`⛁ `:`⛀ `},t))},t))}),(0,X.jsxs)(s,{flexDirection:`column`,gap:0,flexShrink:0,children:[(0,X.jsxs)(i,{dimColor:!0,children:[c,` · `,p(n),`/`,p(r),` tokens (`,a,`%)`]}),(0,X.jsx)(q,{}),y!==void 0&&b!==void 0&&(0,X.jsxs)(i,{color:y<b?`warning`:void 0,children:[`Cache hit rate: `,y.toFixed(0),`%`,y<b?` (below ${b}% threshold)`:``]}),(0,X.jsx)(i,{children:` `}),(0,X.jsx)(i,{dimColor:!0,italic:!0,children:`Estimated usage by category`}),x.map((e,t)=>{let n=p(e.tokens),a=e.isDeferred?`N/A`:`${(e.tokens/r*100).toFixed(1)}%`,o=e.name===Z,c=e.name,l=e.isDeferred?` `:o?`⛝`:`⛁`;return(0,X.jsxs)(s,{children:[(0,X.jsx)(i,{color:e.color,children:l}),(0,X.jsxs)(i,{children:[` `,c,`: `]}),(0,X.jsxs)(i,{dimColor:!0,children:[n,` tokens (`,a,`)`]})]},t)}),(t.find(e=>e.name===`Free space`)?.tokens??0)>0&&(0,X.jsxs)(s,{children:[(0,X.jsx)(i,{dimColor:!0,children:`⛶`}),(0,X.jsx)(i,{children:` Free space: `}),(0,X.jsxs)(i,{dimColor:!0,children:[p(t.find(e=>e.name===`Free space`)?.tokens||0),` (`,((t.find(e=>e.name===`Free space`)?.tokens||0)/r*100).toFixed(1),`%)`]})]}),w&&w.tokens>0&&(0,X.jsxs)(s,{children:[(0,X.jsx)(i,{color:w.color,children:`⛝`}),(0,X.jsxs)(i,{dimColor:!0,children:[` `,w.name,`: `]}),(0,X.jsxs)(i,{dimColor:!0,children:[p(w.tokens),` tokens (`,(w.tokens/r*100).toFixed(1),`%)`]})]})]})]}),(0,X.jsxs)(s,{flexDirection:`column`,marginLeft:-1,children:[d.length>0&&(0,X.jsxs)(s,{flexDirection:`column`,marginTop:1,children:[(0,X.jsxs)(s,{children:[(0,X.jsx)(i,{bold:!0,children:`MCP tools`}),(0,X.jsxs)(i,{dimColor:!0,children:[` · /mcp`,S?` (loaded on-demand)`:``]})]}),d.some(e=>e.isLoaded)&&(0,X.jsxs)(s,{flexDirection:`column`,marginTop:1,children:[(0,X.jsx)(i,{dimColor:!0,children:`Loaded`}),d.filter(e=>e.isLoaded).map((e,t)=>(0,X.jsxs)(s,{children:[(0,X.jsxs)(i,{children:[`└ `,e.name,`: `]}),(0,X.jsxs)(i,{dimColor:!0,children:[p(e.tokens),` tokens`]})]},t))]}),S&&d.some(e=>!e.isLoaded)&&(0,X.jsxs)(s,{flexDirection:`column`,marginTop:1,children:[(0,X.jsx)(i,{dimColor:!0,children:`Available`}),d.filter(e=>!e.isLoaded).map((e,t)=>(0,X.jsx)(s,{children:(0,X.jsxs)(i,{dimColor:!0,children:[`└ `,e.name]})},t))]}),!S&&d.map((e,t)=>(0,X.jsxs)(s,{children:[(0,X.jsxs)(i,{children:[`└ `,e.name,`: `]}),(0,X.jsxs)(i,{dimColor:!0,children:[p(e.tokens),` tokens`]})]},t))]}),(m&&m.length>0||C)&&process.env.USER_TYPE===`ant`&&(0,X.jsxs)(s,{flexDirection:`column`,marginTop:1,children:[(0,X.jsxs)(s,{children:[(0,X.jsx)(i,{bold:!0,children:`[ANT-ONLY] System tools`}),C&&(0,X.jsx)(i,{dimColor:!0,children:` (some loaded on-demand)`})]}),(0,X.jsxs)(s,{flexDirection:`column`,marginTop:1,children:[(0,X.jsx)(i,{dimColor:!0,children:`Loaded`}),m?.map((e,t)=>(0,X.jsxs)(s,{children:[(0,X.jsxs)(i,{children:[`└ `,e.name,`: `]}),(0,X.jsxs)(i,{dimColor:!0,children:[p(e.tokens),` tokens`]})]},`sys-${t}`)),f.filter(e=>e.isLoaded).map((e,t)=>(0,X.jsxs)(s,{children:[(0,X.jsxs)(i,{children:[`└ `,e.name,`: `]}),(0,X.jsxs)(i,{dimColor:!0,children:[p(e.tokens),` tokens`]})]},`def-${t}`))]}),C&&f.some(e=>!e.isLoaded)&&(0,X.jsxs)(s,{flexDirection:`column`,marginTop:1,children:[(0,X.jsx)(i,{dimColor:!0,children:`Available`}),f.filter(e=>!e.isLoaded).map((e,t)=>(0,X.jsx)(s,{children:(0,X.jsxs)(i,{dimColor:!0,children:[`└ `,e.name]})},t))]})]}),h&&h.length>0&&process.env.USER_TYPE===`ant`&&(0,X.jsxs)(s,{flexDirection:`column`,marginTop:1,children:[(0,X.jsx)(i,{bold:!0,children:`[ANT-ONLY] System prompt sections`}),h.map((e,t)=>(0,X.jsxs)(s,{children:[(0,X.jsxs)(i,{children:[`└ `,e.name,`: `]}),(0,X.jsxs)(i,{dimColor:!0,children:[p(e.tokens),` tokens`]})]},t))]}),g.length>0&&(0,X.jsxs)(s,{flexDirection:`column`,marginTop:1,children:[(0,X.jsxs)(s,{children:[(0,X.jsx)(i,{bold:!0,children:`Custom agents`}),(0,X.jsx)(i,{dimColor:!0,children:` · /agents`})]}),Array.from(J(g).entries()).map(([e,t])=>(0,X.jsxs)(s,{flexDirection:`column`,marginTop:1,children:[(0,X.jsx)(i,{dimColor:!0,children:e}),t.map((e,t)=>(0,X.jsxs)(s,{children:[(0,X.jsxs)(i,{children:[`└ `,e.agentType,`: `]}),(0,X.jsxs)(i,{dimColor:!0,children:[p(e.tokens),` tokens`]})]},t))]},e))]}),u.length>0&&(0,X.jsxs)(s,{flexDirection:`column`,marginTop:1,children:[(0,X.jsxs)(s,{children:[(0,X.jsx)(i,{bold:!0,children:`Memory files`}),(0,X.jsx)(i,{dimColor:!0,children:` · /memory`})]}),u.map((e,t)=>(0,X.jsxs)(s,{children:[(0,X.jsxs)(i,{children:[`└ `,l(e.path),`: `]}),(0,X.jsxs)(i,{dimColor:!0,children:[p(e.tokens),` tokens`]})]},t))]}),_&&_.tokens>0&&(0,X.jsxs)(s,{flexDirection:`column`,marginTop:1,children:[(0,X.jsxs)(s,{children:[(0,X.jsx)(i,{bold:!0,children:`Skills`}),(0,X.jsx)(i,{dimColor:!0,children:` · /skills`})]}),Array.from(J(_.skillFrontmatter).entries()).map(([e,t])=>(0,X.jsxs)(s,{flexDirection:`column`,marginTop:1,children:[(0,X.jsx)(i,{dimColor:!0,children:e}),t.map((e,t)=>(0,X.jsxs)(s,{children:[(0,X.jsxs)(i,{children:[`└ `,e.name,`: `]}),(0,X.jsxs)(i,{dimColor:!0,children:[p(e.tokens),` tokens`]})]},t))]},e))]}),v&&process.env.USER_TYPE===`ant`&&(0,X.jsxs)(s,{flexDirection:`column`,marginTop:1,children:[(0,X.jsx)(i,{bold:!0,children:`[ANT-ONLY] Message breakdown`}),(0,X.jsxs)(s,{flexDirection:`column`,marginLeft:1,children:[(0,X.jsxs)(s,{children:[(0,X.jsx)(i,{children:`Tool calls: `}),(0,X.jsxs)(i,{dimColor:!0,children:[p(v.toolCallTokens),` tokens`]})]}),(0,X.jsxs)(s,{children:[(0,X.jsx)(i,{children:`Tool results: `}),(0,X.jsxs)(i,{dimColor:!0,children:[p(v.toolResultTokens),` tokens`]})]}),(0,X.jsxs)(s,{children:[(0,X.jsx)(i,{children:`Attachments: `}),(0,X.jsxs)(i,{dimColor:!0,children:[p(v.attachmentTokens),` tokens`]})]}),(0,X.jsxs)(s,{children:[(0,X.jsx)(i,{children:`Assistant messages (non-tool): `}),(0,X.jsxs)(i,{dimColor:!0,children:[p(v.assistantMessageTokens),` tokens`]})]}),(0,X.jsxs)(s,{children:[(0,X.jsx)(i,{children:`User messages (non-tool-result): `}),(0,X.jsxs)(i,{dimColor:!0,children:[p(v.userMessageTokens),` tokens`]})]})]}),v.toolCallsByType.length>0&&(0,X.jsxs)(s,{flexDirection:`column`,marginTop:1,children:[(0,X.jsx)(i,{bold:!0,children:`[ANT-ONLY] Top tools`}),v.toolCallsByType.slice(0,5).map((e,t)=>(0,X.jsxs)(s,{marginLeft:1,children:[(0,X.jsxs)(i,{children:[`└ `,e.name,`: `]}),(0,X.jsxs)(i,{dimColor:!0,children:[`calls `,p(e.callTokens),`, results `,p(e.resultTokens)]})]},t))]}),v.attachmentsByType.length>0&&(0,X.jsxs)(s,{flexDirection:`column`,marginTop:1,children:[(0,X.jsx)(i,{bold:!0,children:`[ANT-ONLY] Top attachments`}),v.attachmentsByType.slice(0,5).map((e,t)=>(0,X.jsxs)(s,{marginLeft:1,children:[(0,X.jsxs)(i,{children:[`└ `,e.name,`: `]}),(0,X.jsxs)(i,{dimColor:!0,children:[p(e.tokens),` tokens`]})]},t))]})]})]}),(0,X.jsx)(W,{suggestions:A(e)})]})}var X,Z,Q,te=e((()=>{r(),o(),U(),u(),m(),d(),K(),X=c(),Z=`Autocompact buffer`,Q=[`Project`,`User`,`Managed`,`Plugin`,`Built-in`]}));function ne(e){return v(e)}async function re(e,t){let{messages:n,getAppState:r,options:{mainLoopModel:i,tools:a}}=t,o=ne(n),{messages:s}=await h(o),c=process.stdout.columns||80,l=r();return e(await k((0,$.jsx)(Y,{data:await b(s,i,async()=>l.toolPermissionContext,a,l.agentDefinitions,c,t,void 0,o)}))),null}var $;e((()=>{r(),te(),g(),y(),_(),ee(),$=c()}))();export{re as call};
1
+ import{n as e}from"./chunk-DR8-3Aex.js";import{n as t,t as n}from"./figures-gfT9mM8P.js";import{Rn as r,b as i,o as a,t as o,x as s}from"./src-Di342QoJ.js";import{t as c}from"./jsx-runtime-D-D469L8.js";import{Zc as l,el as u,nc as d,tc as f}from"./paths-1ngPRtu3.js";import{b as p,x as m}from"./startupProfiler-DnXZaX4A.js";import{Lo as h,Ok as g,Oo as _,al as v,kk as y,rl as b}from"./loadAgentsDir-D7kapZB5.js";import{Fn as x,In as S,Mn as C,Pn as w,hn as T,in as E,rn as D,xn as O}from"./prompt-BBg3jtfc.js";import{n as k,t as ee}from"./staticRender-Br64h1E1.js";function A(e){let t=[];return j(e,t),M(e,t),P(e,t),F(e,t),I(e,t),t.sort((e,t)=>e.severity===t.severity?(t.savingsTokens??0)-(e.savingsTokens??0):e.severity===`warning`?-1:1),t}function j(e,t){e.percentage>=B&&t.push({severity:`warning`,title:`Context is ${e.percentage}% full`,detail:e.isAutoCompactEnabled?`Autocompact will trigger soon, which discards older messages. Use /compact now to control what gets kept.`:`Autocompact is disabled. Use /compact to free space, or enable autocompact in /config.`})}function M(e,t){if(e.messageBreakdown)for(let n of e.messageBreakdown.toolCallsByType){let r=n.callTokens+n.resultTokens,i=r/e.rawMaxTokens*100;if(i<L||r<R)continue;let a=N(n.name,r,i);a&&t.push(a)}}function N(e,t,n){let r=p(t);switch(e){case x:return{severity:`warning`,title:`Bash results using ${r} tokens (${n.toFixed(0)}%)`,detail:`Pipe output through head, tail, or grep to reduce result size. Avoid cat on large files — use Read with offset/limit instead.`,savingsTokens:Math.floor(t*.5)};case T:return{severity:`info`,title:`Read results using ${r} tokens (${n.toFixed(0)}%)`,detail:`Use offset and limit parameters to read only the sections you need. Avoid re-reading entire files when you only need a few lines.`,savingsTokens:Math.floor(t*.3)};case C:return{severity:`info`,title:`Grep results using ${r} tokens (${n.toFixed(0)}%)`,detail:`Add more specific patterns or use the glob or type parameter to narrow file types. Consider Glob for file discovery instead of Grep.`,savingsTokens:Math.floor(t*.3)};case D:return{severity:`info`,title:`WebFetch results using ${r} tokens (${n.toFixed(0)}%)`,detail:`Web page content can be very large. Consider extracting only the specific information needed.`,savingsTokens:Math.floor(t*.4)};default:return n>=20?{severity:`info`,title:`${e} using ${r} tokens (${n.toFixed(0)}%)`,detail:`This tool is consuming a significant portion of context.`,savingsTokens:Math.floor(t*.2)}:null}}function P(e,t){if(!e.messageBreakdown)return;let n=e.messageBreakdown.toolCallsByType.find(e=>e.name===T);if(!n)return;let r=n.callTokens+n.resultTokens,i=r/e.rawMaxTokens*100,a=n.resultTokens/e.rawMaxTokens*100;i>=L&&r>=R||a>=z&&n.resultTokens>=R&&t.push({severity:`info`,title:`File reads using ${p(n.resultTokens)} tokens (${a.toFixed(0)}%)`,detail:`If you are re-reading files, consider referencing earlier reads. Use offset/limit for large files.`,savingsTokens:Math.floor(n.resultTokens*.3)})}function F(e,t){let n=e.memoryFiles.reduce((e,t)=>e+t.tokens,0),r=n/e.rawMaxTokens*100;if(r>=V&&n>=H){let i=[...e.memoryFiles].sort((e,t)=>t.tokens-e.tokens).slice(0,3).map(e=>`${l(e.path)} (${p(e.tokens)})`).join(`, `);t.push({severity:`info`,title:`Memory files using ${p(n)} tokens (${r.toFixed(0)}%)`,detail:`Largest: ${i}. Use /memory to review and prune stale entries.`,savingsTokens:Math.floor(n*.3)})}}function I(e,t){!e.isAutoCompactEnabled&&e.percentage>=50&&e.percentage<B&&t.push({severity:`info`,title:`Autocompact is disabled`,detail:`Without autocompact, you will hit context limits and lose the conversation. Enable it in /config or use /compact manually.`})}var L,R,z,B,V,H,U=e((()=>{S(),O(),w(),E(),u(),m(),L=15,R=1e4,z=5,B=80,V=5,H=5e3}));function W({suggestions:e}){return e.length===0?null:(0,G.jsxs)(s,{flexDirection:`column`,marginTop:1,children:[(0,G.jsx)(i,{bold:!0,children:`Suggestions`}),e.map((e,t)=>(0,G.jsxs)(s,{flexDirection:`column`,marginTop:t===0?0:1,children:[(0,G.jsxs)(s,{children:[(0,G.jsx)(a,{status:e.severity,withSpace:!0}),(0,G.jsx)(i,{bold:!0,children:e.title}),e.savingsTokens?(0,G.jsxs)(i,{dimColor:!0,children:[` `,n.arrowRight,` save ~`,p(e.savingsTokens)]}):null]}),(0,G.jsx)(s,{marginLeft:2,children:(0,G.jsx)(i,{dimColor:!0,children:e.detail})})]},t))]})}var G,K=e((()=>{t(),r(),o(),m(),G=c()}));function q(){return null}function J(e){let t=new Map;for(let n of e){let e=f(n.source),r=t.get(e)||[];r.push(n),t.set(e,r)}for(let[e,n]of t.entries())t.set(e,n.sort((e,t)=>t.tokens-e.tokens));let n=new Map;for(let e of Q){let r=t.get(e);r&&n.set(e,r)}return n}function Y({data:e}){let{categories:t,totalTokens:n,rawMaxTokens:r,percentage:a,gridRows:o,model:c,memoryFiles:u,mcpTools:d,deferredBuiltinTools:f=[],systemTools:m,systemPromptSections:h,agents:g,skills:_,messageBreakdown:v,cacheHitRate:y,cacheThreshold:b}=e,x=t.filter(e=>e.tokens>0&&e.name!==`Free space`&&e.name!==Z&&!e.isDeferred),S=t.some(e=>e.isDeferred&&e.name.includes(`MCP`)),C=f.length>0,w=t.find(e=>e.name===Z);return(0,X.jsxs)(s,{flexDirection:`column`,paddingLeft:1,children:[(0,X.jsx)(i,{bold:!0,children:`Context Usage`}),(0,X.jsxs)(s,{flexDirection:`row`,gap:2,children:[(0,X.jsx)(s,{flexDirection:`column`,flexShrink:0,children:o.map((e,t)=>(0,X.jsx)(s,{flexDirection:`row`,marginLeft:-1,children:e.map((e,t)=>e.categoryName===`Free space`?(0,X.jsx)(i,{dimColor:!0,children:`⛶ `},t):e.categoryName===Z?(0,X.jsx)(i,{color:e.color,children:`⛝ `},t):(0,X.jsx)(i,{color:e.color,children:e.squareFullness>=.7?`⛁ `:`⛀ `},t))},t))}),(0,X.jsxs)(s,{flexDirection:`column`,gap:0,flexShrink:0,children:[(0,X.jsxs)(i,{dimColor:!0,children:[c,` · `,p(n),`/`,p(r),` tokens (`,a,`%)`]}),(0,X.jsx)(q,{}),y!==void 0&&b!==void 0&&(0,X.jsxs)(i,{color:y<b?`warning`:void 0,children:[`Cache hit rate: `,y.toFixed(0),`%`,y<b?` (below ${b}% threshold)`:``]}),(0,X.jsx)(i,{children:` `}),(0,X.jsx)(i,{dimColor:!0,italic:!0,children:`Estimated usage by category`}),x.map((e,t)=>{let n=p(e.tokens),a=e.isDeferred?`N/A`:`${(e.tokens/r*100).toFixed(1)}%`,o=e.name===Z,c=e.name,l=e.isDeferred?` `:o?`⛝`:`⛁`;return(0,X.jsxs)(s,{children:[(0,X.jsx)(i,{color:e.color,children:l}),(0,X.jsxs)(i,{children:[` `,c,`: `]}),(0,X.jsxs)(i,{dimColor:!0,children:[n,` tokens (`,a,`)`]})]},t)}),(t.find(e=>e.name===`Free space`)?.tokens??0)>0&&(0,X.jsxs)(s,{children:[(0,X.jsx)(i,{dimColor:!0,children:`⛶`}),(0,X.jsx)(i,{children:` Free space: `}),(0,X.jsxs)(i,{dimColor:!0,children:[p(t.find(e=>e.name===`Free space`)?.tokens||0),` (`,((t.find(e=>e.name===`Free space`)?.tokens||0)/r*100).toFixed(1),`%)`]})]}),w&&w.tokens>0&&(0,X.jsxs)(s,{children:[(0,X.jsx)(i,{color:w.color,children:`⛝`}),(0,X.jsxs)(i,{dimColor:!0,children:[` `,w.name,`: `]}),(0,X.jsxs)(i,{dimColor:!0,children:[p(w.tokens),` tokens (`,(w.tokens/r*100).toFixed(1),`%)`]})]})]})]}),(0,X.jsxs)(s,{flexDirection:`column`,marginLeft:-1,children:[d.length>0&&(0,X.jsxs)(s,{flexDirection:`column`,marginTop:1,children:[(0,X.jsxs)(s,{children:[(0,X.jsx)(i,{bold:!0,children:`MCP tools`}),(0,X.jsxs)(i,{dimColor:!0,children:[` · /mcp`,S?` (loaded on-demand)`:``]})]}),d.some(e=>e.isLoaded)&&(0,X.jsxs)(s,{flexDirection:`column`,marginTop:1,children:[(0,X.jsx)(i,{dimColor:!0,children:`Loaded`}),d.filter(e=>e.isLoaded).map((e,t)=>(0,X.jsxs)(s,{children:[(0,X.jsxs)(i,{children:[`└ `,e.name,`: `]}),(0,X.jsxs)(i,{dimColor:!0,children:[p(e.tokens),` tokens`]})]},t))]}),S&&d.some(e=>!e.isLoaded)&&(0,X.jsxs)(s,{flexDirection:`column`,marginTop:1,children:[(0,X.jsx)(i,{dimColor:!0,children:`Available`}),d.filter(e=>!e.isLoaded).map((e,t)=>(0,X.jsx)(s,{children:(0,X.jsxs)(i,{dimColor:!0,children:[`└ `,e.name]})},t))]}),!S&&d.map((e,t)=>(0,X.jsxs)(s,{children:[(0,X.jsxs)(i,{children:[`└ `,e.name,`: `]}),(0,X.jsxs)(i,{dimColor:!0,children:[p(e.tokens),` tokens`]})]},t))]}),(m&&m.length>0||C)&&process.env.USER_TYPE===`ant`&&(0,X.jsxs)(s,{flexDirection:`column`,marginTop:1,children:[(0,X.jsxs)(s,{children:[(0,X.jsx)(i,{bold:!0,children:`[ANT-ONLY] System tools`}),C&&(0,X.jsx)(i,{dimColor:!0,children:` (some loaded on-demand)`})]}),(0,X.jsxs)(s,{flexDirection:`column`,marginTop:1,children:[(0,X.jsx)(i,{dimColor:!0,children:`Loaded`}),m?.map((e,t)=>(0,X.jsxs)(s,{children:[(0,X.jsxs)(i,{children:[`└ `,e.name,`: `]}),(0,X.jsxs)(i,{dimColor:!0,children:[p(e.tokens),` tokens`]})]},`sys-${t}`)),f.filter(e=>e.isLoaded).map((e,t)=>(0,X.jsxs)(s,{children:[(0,X.jsxs)(i,{children:[`└ `,e.name,`: `]}),(0,X.jsxs)(i,{dimColor:!0,children:[p(e.tokens),` tokens`]})]},`def-${t}`))]}),C&&f.some(e=>!e.isLoaded)&&(0,X.jsxs)(s,{flexDirection:`column`,marginTop:1,children:[(0,X.jsx)(i,{dimColor:!0,children:`Available`}),f.filter(e=>!e.isLoaded).map((e,t)=>(0,X.jsx)(s,{children:(0,X.jsxs)(i,{dimColor:!0,children:[`└ `,e.name]})},t))]})]}),h&&h.length>0&&process.env.USER_TYPE===`ant`&&(0,X.jsxs)(s,{flexDirection:`column`,marginTop:1,children:[(0,X.jsx)(i,{bold:!0,children:`[ANT-ONLY] System prompt sections`}),h.map((e,t)=>(0,X.jsxs)(s,{children:[(0,X.jsxs)(i,{children:[`└ `,e.name,`: `]}),(0,X.jsxs)(i,{dimColor:!0,children:[p(e.tokens),` tokens`]})]},t))]}),g.length>0&&(0,X.jsxs)(s,{flexDirection:`column`,marginTop:1,children:[(0,X.jsxs)(s,{children:[(0,X.jsx)(i,{bold:!0,children:`Custom agents`}),(0,X.jsx)(i,{dimColor:!0,children:` · /agents`})]}),Array.from(J(g).entries()).map(([e,t])=>(0,X.jsxs)(s,{flexDirection:`column`,marginTop:1,children:[(0,X.jsx)(i,{dimColor:!0,children:e}),t.map((e,t)=>(0,X.jsxs)(s,{children:[(0,X.jsxs)(i,{children:[`└ `,e.agentType,`: `]}),(0,X.jsxs)(i,{dimColor:!0,children:[p(e.tokens),` tokens`]})]},t))]},e))]}),u.length>0&&(0,X.jsxs)(s,{flexDirection:`column`,marginTop:1,children:[(0,X.jsxs)(s,{children:[(0,X.jsx)(i,{bold:!0,children:`Memory files`}),(0,X.jsx)(i,{dimColor:!0,children:` · /memory`})]}),u.map((e,t)=>(0,X.jsxs)(s,{children:[(0,X.jsxs)(i,{children:[`└ `,l(e.path),`: `]}),(0,X.jsxs)(i,{dimColor:!0,children:[p(e.tokens),` tokens`]})]},t))]}),_&&_.tokens>0&&(0,X.jsxs)(s,{flexDirection:`column`,marginTop:1,children:[(0,X.jsxs)(s,{children:[(0,X.jsx)(i,{bold:!0,children:`Skills`}),(0,X.jsx)(i,{dimColor:!0,children:` · /skills`})]}),Array.from(J(_.skillFrontmatter).entries()).map(([e,t])=>(0,X.jsxs)(s,{flexDirection:`column`,marginTop:1,children:[(0,X.jsx)(i,{dimColor:!0,children:e}),t.map((e,t)=>(0,X.jsxs)(s,{children:[(0,X.jsxs)(i,{children:[`└ `,e.name,`: `]}),(0,X.jsxs)(i,{dimColor:!0,children:[p(e.tokens),` tokens`]})]},t))]},e))]}),v&&process.env.USER_TYPE===`ant`&&(0,X.jsxs)(s,{flexDirection:`column`,marginTop:1,children:[(0,X.jsx)(i,{bold:!0,children:`[ANT-ONLY] Message breakdown`}),(0,X.jsxs)(s,{flexDirection:`column`,marginLeft:1,children:[(0,X.jsxs)(s,{children:[(0,X.jsx)(i,{children:`Tool calls: `}),(0,X.jsxs)(i,{dimColor:!0,children:[p(v.toolCallTokens),` tokens`]})]}),(0,X.jsxs)(s,{children:[(0,X.jsx)(i,{children:`Tool results: `}),(0,X.jsxs)(i,{dimColor:!0,children:[p(v.toolResultTokens),` tokens`]})]}),(0,X.jsxs)(s,{children:[(0,X.jsx)(i,{children:`Attachments: `}),(0,X.jsxs)(i,{dimColor:!0,children:[p(v.attachmentTokens),` tokens`]})]}),(0,X.jsxs)(s,{children:[(0,X.jsx)(i,{children:`Assistant messages (non-tool): `}),(0,X.jsxs)(i,{dimColor:!0,children:[p(v.assistantMessageTokens),` tokens`]})]}),(0,X.jsxs)(s,{children:[(0,X.jsx)(i,{children:`User messages (non-tool-result): `}),(0,X.jsxs)(i,{dimColor:!0,children:[p(v.userMessageTokens),` tokens`]})]})]}),v.toolCallsByType.length>0&&(0,X.jsxs)(s,{flexDirection:`column`,marginTop:1,children:[(0,X.jsx)(i,{bold:!0,children:`[ANT-ONLY] Top tools`}),v.toolCallsByType.slice(0,5).map((e,t)=>(0,X.jsxs)(s,{marginLeft:1,children:[(0,X.jsxs)(i,{children:[`└ `,e.name,`: `]}),(0,X.jsxs)(i,{dimColor:!0,children:[`calls `,p(e.callTokens),`, results `,p(e.resultTokens)]})]},t))]}),v.attachmentsByType.length>0&&(0,X.jsxs)(s,{flexDirection:`column`,marginTop:1,children:[(0,X.jsx)(i,{bold:!0,children:`[ANT-ONLY] Top attachments`}),v.attachmentsByType.slice(0,5).map((e,t)=>(0,X.jsxs)(s,{marginLeft:1,children:[(0,X.jsxs)(i,{children:[`└ `,e.name,`: `]}),(0,X.jsxs)(i,{dimColor:!0,children:[p(e.tokens),` tokens`]})]},t))]})]})]}),(0,X.jsx)(W,{suggestions:A(e)})]})}var X,Z,Q,te=e((()=>{r(),o(),U(),u(),m(),d(),K(),X=c(),Z=`Autocompact buffer`,Q=[`Project`,`User`,`Managed`,`Plugin`,`Built-in`]}));function ne(e){return _(e)}async function re(e,t){let{messages:n,getAppState:r,options:{mainLoopModel:i,tools:a}}=t,o=ne(n),{messages:s}=await y(o),c=process.stdout.columns||80,l=r();return e(await k((0,$.jsx)(Y,{data:await b(s,i,async()=>l.toolPermissionContext,a,l.agentDefinitions,c,t,void 0,o)}))),null}var $;e((()=>{r(),te(),g(),v(),h(),ee(),$=c()}))();export{re as call};
@@ -1,4 +1,4 @@
1
- import{n as e}from"./chunk-DR8-3Aex.js";import{nc as t,tc as n}from"./paths-BBvuDQl9.js";import{b as r,x as i}from"./startupProfiler-DnXZaX4A.js";import{Dk as a,Ek as o,Lo as s,Oo as c,al as l,rl as u}from"./loadAgentsDir-DI1a76pd.js";async function d(e){let{messages:t,getAppState:n,options:{mainLoopModel:r,tools:i,agentDefinitions:o,customSystemPrompt:s,appendSystemPrompt:l}}=e,d=c(t),{messages:f}=await a(d),p=n();return u(f,r,async()=>p.toolPermissionContext,i,o,void 0,{options:{customSystemPrompt:s,appendSystemPrompt:l}},void 0,d)}async function f(e,t){return{type:`text`,value:p(await d(t))}}function p(e){let{categories:t,totalTokens:i,rawMaxTokens:a,percentage:o,model:s,memoryFiles:c,mcpTools:l,agents:u,skills:d,messageBreakdown:f,systemTools:p,systemPromptSections:m}=e,h=`## Context Usage
1
+ import{n as e}from"./chunk-DR8-3Aex.js";import{nc as t,tc as n}from"./paths-1ngPRtu3.js";import{b as r,x as i}from"./startupProfiler-DnXZaX4A.js";import{Lo as a,Ok as o,Oo as s,al as c,kk as l,rl as u}from"./loadAgentsDir-D7kapZB5.js";async function d(e){let{messages:t,getAppState:n,options:{mainLoopModel:r,tools:i,agentDefinitions:a,customSystemPrompt:o,appendSystemPrompt:c}}=e,d=s(t),{messages:f}=await l(d),p=n();return u(f,r,async()=>p.toolPermissionContext,i,a,void 0,{options:{customSystemPrompt:o,appendSystemPrompt:c}},void 0,d)}async function f(e,t){return{type:`text`,value:p(await d(t))}}function p(e){let{categories:t,totalTokens:i,rawMaxTokens:a,percentage:o,model:s,memoryFiles:c,mcpTools:l,agents:u,skills:d,messageBreakdown:f,systemTools:p,systemPromptSections:m}=e,h=`## Context Usage
2
2
 
3
3
  `;h+=`**Model:** ${s} \n`,h+=`**Tokens:** ${r(i)} / ${r(a)} (${o}%)\n`,h+=`
4
4
  `;let g=t.filter(e=>e.tokens>0&&e.name!==`Free space`&&e.name!==`Autocompact buffer`);if(g.length>0){h+=`### Estimated usage by category
@@ -51,4 +51,4 @@ import{n as e}from"./chunk-DR8-3Aex.js";import{nc as t,tc as n}from"./paths-BBvu
51
51
  `,h+=`| Attachment | Tokens |
52
52
  `,h+=`|------------|--------|
53
53
  `;for(let e of f.attachmentsByType)h+=`| ${e.name} | ${r(e.tokens)} |\n`;h+=`
54
- `}}return h}var m=e((()=>{o(),l(),i(),s(),t()}));export{d as n,m as r,f as t};
54
+ `}}return h}var m=e((()=>{o(),c(),i(),a(),t()}));export{d as n,m as r,f as t};
@@ -0,0 +1 @@
1
+ import{n as e,r as t,t as n}from"./context-noninteractive-IZfWniex.js";t();export{n as call,e as collectContextData};
@@ -0,0 +1 @@
1
+ import{a as e,n as t}from"./chunk-DR8-3Aex.js";import{Ct as n,Jn as r,Xn as i,Z as a,cn as o,gn as s,ot as c,qn as l,yn as u}from"./state-sIHsFpDu.js";import{n as d,r as f}from"./analytics-DqMQntaB.js";import{o as p,s as m}from"./log-CzsijfHZ.js";import{Ar as h,Du as g,Eu as _,Hm as v,Lv as y,Mn as b,N_ as x,P_ as S,Tv as C,Vm as w,Wv as T,Yt as E,ad as D,di as O,eb as k,fr as A,gE as j,id as M,jn as N,kn as P,lE as F,nr as ee,tb as I,uE as L,un as R,vE as z,wi as B,wt as V,wv as H,xi as U,xt as W,yn as G}from"./loadAgentsDir-D7kapZB5.js";import{C as K,y as q}from"./rcDebugLog-CPGWJbI4.js";import{l as J,r as Y}from"./commitAttribution-e0kkanVT.js";import{n as X,t as Z}from"./caches-CdVW8fYV.js";import{randomUUID as Q}from"crypto";function $(){let e=M();if(!e)return;e.markTranscriptReset?.();let t={type:`status`,subtype:`status`,status:`conversation_cleared`,message:`conversation_cleared`,uuid:Q()};e.writeSdkMessages([t])}async function te({setMessages:t,readFileState:o,discoveredSkillNames:d,loadedNestedMemoryPaths:p,getAppState:_,setAppState:b,setConversationId:x}){let w=R();await E(`clear`,{getAppState:_,setAppState:b,signal:AbortSignal.timeout(w),timeoutMs:w});let T=a();T&&f(`tengu_cache_eviction_hint`,{scope:`conversation_clear`,last_request_id:T});let D=new Set,k=[],M=e=>`isBackgrounded`in e&&e.isBackgrounded===!1;if(_)for(let e of Object.values(_().tasks))M(e)||(g(e)?(D.add(e.agentId),k.push(e)):I(e)&&D.add(e.identity.agentId));t(()=>[]),$();{let{setContextBlocked:t}=(q(),e(K));t(!1)}x&&x(Q()),Z(D),l(null),r(null),i(null),u(),v(c()),o.clear(),d?.clear(),p?.clear(),b&&b(e=>{let t={};for(let[n,r]of Object.entries(e.tasks)){if(!M(r)){t[n]=r;continue}try{r.status===`running`&&(S(r)&&(r.shellCommand?.kill(),r.shellCommand?.cleanup(),r.cleanupTimeoutId&&clearTimeout(r.cleanupTimeoutId)),`abortController`in r&&r.abortController?.abort(),`unregisterCleanup`in r&&r.unregisterCleanup?.())}catch(e){m(e)}P(n)}return{...e,tasks:t,attribution:Y(),standaloneAgentContext:void 0,fileHistory:{snapshots:[],trackedFiles:new Set,snapshotSequence:0},mcp:{clients:[],tools:[],commands:[],resources:{},pluginReconnectKey:e.mcp.pluginReconnectKey}}}),y(),ee(),s({setCurrentAsParent:!0}),process.env.USER_TYPE===`ant`&&process.env.CLAUDE_CODE_SESSION_ID&&(process.env.CLAUDE_CODE_SESSION_ID=n()),await O();for(let e of k)e.status===`running`&&N(e.id,A(j(e.agentId)));{let{saveMode:t}=(h(),e(B)),{isCoordinatorMode:n}=(L(),e(F));t(n()?`coordinator`:`normal`)}let z=W();z&&U(z);let V=await C(`clear`);V.length>0&&t(()=>V)}var ne=t((()=>{D(),o(),d(),k(),_(),x(),z(),J(),G(),p(),T(),w(),H(),h(),b(),V(),X()}));export{ne as n,te as t};
@@ -0,0 +1 @@
1
+ import{n as e,t}from"./conversation-CQBl9Yy2.js";e();export{t as clearConversation};
@@ -1,7 +1,7 @@
1
- import{n as e,o as t}from"./chunk-DR8-3Aex.js";import{Cn as n,Rn as r,b as i,g as a,h as o,p as s,t as c,tn as l,x as u}from"./src-Di342QoJ.js";import{t as d}from"./jsx-runtime-D-D469L8.js";import{Ac as f,Oo as p,Pc as m,Sc as h,jo as g}from"./paths-BBvuDQl9.js";import{n as _,r as v}from"./analytics-DqMQntaB.js";import{Co as y,Dx as b,Lo as x,Ox as S,Tk as C,Xo as w,wk as T}from"./loadAgentsDir-DI1a76pd.js";import{tmpdir as E}from"os";import{join as D}from"path";import{mkdir as O,writeFile as k}from"fs/promises";function A(e){let t=T.lexer(w(e)),n=[];for(let e of t)if(e.type===`code`){let t=e;n.push({code:t.text,lang:t.lang})}return n}function j(e){let t=[];for(let n=e.length-1;n>=0&&t.length<V;n--){let r=e[n];if(r?.type!==`assistant`||r.isApiErrorMessage)continue;let i=r.message.content;if(!Array.isArray(i))continue;let a=y(i,`
1
+ import{n as e,o as t}from"./chunk-DR8-3Aex.js";import{Cn as n,Rn as r,b as i,g as a,h as o,p as s,t as c,tn as l,x as u}from"./src-Di342QoJ.js";import{t as d}from"./jsx-runtime-D-D469L8.js";import{Ac as f,Oo as p,Pc as m,Sc as h,jo as g}from"./paths-1ngPRtu3.js";import{n as _,r as v}from"./analytics-DqMQntaB.js";import{Ax as y,Co as b,Dk as x,Ek as S,Lo as C,Xo as w,kx as T}from"./loadAgentsDir-D7kapZB5.js";import{tmpdir as E}from"os";import{join as D}from"path";import{mkdir as O,writeFile as k}from"fs/promises";function A(e){let t=S.lexer(w(e)),n=[];for(let e of t)if(e.type===`code`){let t=e;n.push({code:t.text,lang:t.lang})}return n}function j(e){let t=[];for(let n=e.length-1;n>=0&&t.length<V;n--){let r=e[n];if(r?.type!==`assistant`||r.isApiErrorMessage)continue;let i=r.message.content;if(!Array.isArray(i))continue;let a=b(i,`
2
2
 
3
3
  `);a&&t.push(a)}return t}function M(e){if(e){let t=e.replace(/[^a-zA-Z0-9]/g,``);if(t&&t!==`plaintext`)return`.${t}`}return`.txt`}async function N(e,t){let n=D(z,t);return await O(z,{recursive:!0}),await k(n,e,`utf-8`),n}async function P(e,t){let n=await l(e);n&&process.stdout.write(n);let r=p(e,`
4
4
  `)+1,i=e.length;try{return`Copied to clipboard (${i} characters, ${r} lines)\nAlso written to ${await N(e,t)}`}catch{return`Copied to clipboard (${i} characters, ${r} lines)`}}function F(e,t){let r=e.split(`
5
5
  `)[0]??``;if(n(r)<=t)return r;let i=``,a=0,o=t-1;for(let e of r){let t=n(e);if(a+t>o)break;i+=e,a+=t}return i+`…`}function I({fullText:e,codeBlocks:t,messageAge:n,onDone:r}){let c=(0,L.useRef)(`full`),l=[{label:`Full response`,value:`full`,description:`${e.length} chars, ${p(e,`
6
6
  `)+1} lines`},...t.map((e,t)=>{let n=p(e.code,`
7
- `)+1;return{label:F(e.code,60),value:t,description:[e.lang,n>1?`${n} lines`:void 0].filter(Boolean).join(`, `)||void 0}}),{label:`Always copy full response`,value:`always`,description:`Skip this picker in the future (revert via /config)`}];function d(n){if(n===`full`||n===`always`)return{text:e,filename:B};let r=t[n];return{text:r.code,filename:`copy${M(r.lang)}`,blockIndex:n}}async function f(e){let i=d(e);if(e===`always`){h().copyFullResponse||m(e=>({...e,copyFullResponse:!0})),v(`tengu_copy`,{block_count:t.length,always:!0,message_age:n}),r(`${await P(i.text,i.filename)}\nPreference saved. Use /config to change copyFullResponse`);return}v(`tengu_copy`,{selected_block:i.blockIndex,block_count:t.length,message_age:n}),r(await P(i.text,i.filename))}async function g(e){let i=d(e);v(`tengu_copy`,{selected_block:i.blockIndex,block_count:t.length,message_age:n,write_shortcut:!0});try{r(`Written to ${await N(i.text,i.filename)}`)}catch(e){r(`Failed to write file: ${e instanceof Error?e.message:e}`)}}function _(e){e.key===`w`&&(e.preventDefault(),g(c.current))}return(0,R.jsx)(s,{children:(0,R.jsxs)(u,{flexDirection:`column`,gap:1,tabIndex:0,autoFocus:!0,onKeyDown:_,children:[(0,R.jsx)(i,{dimColor:!0,children:`Select content to copy:`}),(0,R.jsx)(b,{options:l,hideIndexes:!1,onFocus:e=>{c.current=e},onChange:e=>{f(e)},onCancel:()=>{r(`Copy cancelled`,{display:`system`})}}),(0,R.jsx)(i,{dimColor:!0,children:(0,R.jsxs)(o,{children:[(0,R.jsx)(a,{shortcut:`enter`,action:`copy`}),(0,R.jsx)(a,{shortcut:`w`,action:`write to file`}),(0,R.jsx)(a,{shortcut:`esc`,action:`cancel`})]})})]})})}var L,R,z,B,V,H;e((()=>{C(),L=t(r(),1),S(),c(),_(),f(),x(),g(),R=d(),z=D(E(),`claude`),B=`response.md`,V=20,H=async(e,t,n)=>{let r=j(t.messages);if(r.length===0)return e(`No assistant message to copy`),null;let i=0,a=n?.trim();if(a){let t=Number(a);if(!Number.isInteger(t)||t<1)return e(`Usage: /copy [N] where N is 1 (latest), 2, 3, \u2026 Got: ${a}`),null;if(t>r.length)return e(`Only ${r.length} assistant ${r.length===1?`message`:`messages`} available to copy`),null;i=t-1}let o=r[i],s=A(o),c=h();return s.length===0||c.copyFullResponse?(v(`tengu_copy`,{always:c.copyFullResponse,block_count:s.length,message_age:i}),e(await P(o,B)),null):(0,R.jsx)(I,{fullText:o,codeBlocks:s,messageAge:i,onDone:e})}}))();export{H as call,j as collectRecentAssistantTexts,M as fileExtension};
7
+ `)+1;return{label:F(e.code,60),value:t,description:[e.lang,n>1?`${n} lines`:void 0].filter(Boolean).join(`, `)||void 0}}),{label:`Always copy full response`,value:`always`,description:`Skip this picker in the future (revert via /config)`}];function d(n){if(n===`full`||n===`always`)return{text:e,filename:B};let r=t[n];return{text:r.code,filename:`copy${M(r.lang)}`,blockIndex:n}}async function f(e){let i=d(e);if(e===`always`){h().copyFullResponse||m(e=>({...e,copyFullResponse:!0})),v(`tengu_copy`,{block_count:t.length,always:!0,message_age:n}),r(`${await P(i.text,i.filename)}\nPreference saved. Use /config to change copyFullResponse`);return}v(`tengu_copy`,{selected_block:i.blockIndex,block_count:t.length,message_age:n}),r(await P(i.text,i.filename))}async function g(e){let i=d(e);v(`tengu_copy`,{selected_block:i.blockIndex,block_count:t.length,message_age:n,write_shortcut:!0});try{r(`Written to ${await N(i.text,i.filename)}`)}catch(e){r(`Failed to write file: ${e instanceof Error?e.message:e}`)}}function _(e){e.key===`w`&&(e.preventDefault(),g(c.current))}return(0,R.jsx)(s,{children:(0,R.jsxs)(u,{flexDirection:`column`,gap:1,tabIndex:0,autoFocus:!0,onKeyDown:_,children:[(0,R.jsx)(i,{dimColor:!0,children:`Select content to copy:`}),(0,R.jsx)(T,{options:l,hideIndexes:!1,onFocus:e=>{c.current=e},onChange:e=>{f(e)},onCancel:()=>{r(`Copy cancelled`,{display:`system`})}}),(0,R.jsx)(i,{dimColor:!0,children:(0,R.jsxs)(o,{children:[(0,R.jsx)(a,{shortcut:`enter`,action:`copy`}),(0,R.jsx)(a,{shortcut:`w`,action:`write to file`}),(0,R.jsx)(a,{shortcut:`esc`,action:`cancel`})]})})]})})}var L,R,z,B,V,H;e((()=>{x(),L=t(r(),1),y(),c(),_(),f(),C(),g(),R=d(),z=D(E(),`claude`),B=`response.md`,V=20,H=async(e,t,n)=>{let r=j(t.messages);if(r.length===0)return e(`No assistant message to copy`),null;let i=0,a=n?.trim();if(a){let t=Number(a);if(!Number.isInteger(t)||t<1)return e(`Usage: /copy [N] where N is 1 (latest), 2, 3, \u2026 Got: ${a}`),null;if(t>r.length)return e(`Only ${r.length} assistant ${r.length===1?`message`:`messages`} available to copy`),null;i=t-1}let o=r[i],s=A(o),c=h();return s.length===0||c.copyFullResponse?(v(`tengu_copy`,{always:c.copyFullResponse,block_count:s.length,message_age:i}),e(await P(o,B)),null):(0,R.jsx)(I,{fullText:o,codeBlocks:s,messageAge:i,onDone:e})}}))();export{H as call,j as collectRecentAssistantTexts,M as fileExtension};
@@ -1,4 +1,4 @@
1
- import{n as e,t}from"./defineProperty-80gRi2ZW.js";import{Jt as n,on as r}from"./paths-BBvuDQl9.js";import{E as i,T as a,d as o,s,w as c}from"./debug-UI3T040K.js";import{l,u}from"./oauth-CdZEzMww.js";import{i as d,t as f}from"./cliLaunch-BQa48gsr.js";import{resolve as p}from"path";import{existsSync as m,unlinkSync as h}from"fs";import{randomUUID as g}from"crypto";s(),c(),e();function _(e){return typeof e==`object`&&!!e&&`type`in e&&typeof e.type==`string`}var v=2e3,y=15e3,b=3,x=class{constructor(e,n){t(this,`proc`,void 0),t(this,`options`,void 0),t(this,`connected`,!1),t(this,`disconnected`,!1),t(this,`readLoopAbort`,null),t(this,`reconnectAttempt`,0),t(this,`maxReconnectAttempts`,void 0),t(this,`userInitiatedDisconnect`,!1),t(this,`reconnecting`,!1),this.proc=e,this.options=n,this.maxReconnectAttempts=n.maxReconnectAttempts??b}connect(){this.connected||(this.readLoopAbort=new AbortController,this.startReadLoop(),this.monitorExit(),this.connected=!0,this.options.onConnected())}async startReadLoop(){let e=this.proc.stdout;if(!e){this.options.onError(Error(`SSH process stdout is not available`));return}let t=e.getReader(),n=new TextDecoder,r=``;try{for(;!this.disconnected;){let{done:e,value:i}=await t.read();if(e)break;r+=n.decode(i,{stream:!0});let a=r.split(`
1
+ import{n as e,t}from"./defineProperty-80gRi2ZW.js";import{Jt as n,on as r}from"./paths-1ngPRtu3.js";import{E as i,T as a,d as o,s,w as c}from"./debug-UI3T040K.js";import{l,u}from"./oauth-CdZEzMww.js";import{i as d,t as f}from"./cliLaunch-BQa48gsr.js";import{resolve as p}from"path";import{existsSync as m,unlinkSync as h}from"fs";import{randomUUID as g}from"crypto";s(),c(),e();function _(e){return typeof e==`object`&&!!e&&`type`in e&&typeof e.type==`string`}var v=2e3,y=15e3,b=3,x=class{constructor(e,n){t(this,`proc`,void 0),t(this,`options`,void 0),t(this,`connected`,!1),t(this,`disconnected`,!1),t(this,`readLoopAbort`,null),t(this,`reconnectAttempt`,0),t(this,`maxReconnectAttempts`,void 0),t(this,`userInitiatedDisconnect`,!1),t(this,`reconnecting`,!1),this.proc=e,this.options=n,this.maxReconnectAttempts=n.maxReconnectAttempts??b}connect(){this.connected||(this.readLoopAbort=new AbortController,this.startReadLoop(),this.monitorExit(),this.connected=!0,this.options.onConnected())}async startReadLoop(){let e=this.proc.stdout;if(!e){this.options.onError(Error(`SSH process stdout is not available`));return}let t=e.getReader(),n=new TextDecoder,r=``;try{for(;!this.disconnected;){let{done:e,value:i}=await t.read();if(e)break;r+=n.decode(i,{stream:!0});let a=r.split(`
2
2
  `);r=a.pop()??``;for(let e of a){let t=e.trim();t&&this.processLine(t)}}}catch(e){this.disconnected||this.options.onError(e instanceof Error?e:Error(String(e)))}finally{t.releaseLock(),!this.disconnected&&!this.userInitiatedDisconnect&&this.handleProcessExit()}}monitorExit(){if(this.proc.exitCode!==null){this.userInitiatedDisconnect||this.handleProcessExit();return}this.proc.exited.then(()=>{!this.disconnected&&!this.userInitiatedDisconnect&&this.handleProcessExit()}).catch(()=>{!this.disconnected&&!this.userInitiatedDisconnect&&this.handleProcessExit()})}async handleProcessExit(){if(!(this.disconnected||this.reconnecting)){if(this.connected=!1,!this.options.reconnect){this.disconnected=!0,this.options.onDisconnected();return}if(this.reconnectAttempt>=this.maxReconnectAttempts){this.disconnected=!0,this.options.onDisconnected();return}this.reconnecting=!0;try{await this.attemptReconnect()}finally{this.reconnecting=!1}}}async attemptReconnect(){let e=this.options.reconnect;for(;this.reconnectAttempt<this.maxReconnectAttempts;){this.reconnectAttempt++,this.options.onReconnecting(this.reconnectAttempt,this.maxReconnectAttempts);let t=Math.min(v*2**(this.reconnectAttempt-1),y);if(await new Promise(e=>setTimeout(e,t)),this.userInitiatedDisconnect)return;try{this.proc=await e(),this.reconnectAttempt=0,this.connected=!0,this.startReadLoop(),this.monitorExit(),this.options.onConnected();return}catch(e){o(`[SSH] reconnect attempt ${this.reconnectAttempt} failed: ${e instanceof Error?e.message:String(e)}`)}}this.disconnected=!0,this.options.onDisconnected()}processLine(e){let t;try{t=a(e)}catch{return}if(!_(t))return;let n=t;if(n.type===`control_request`){let e=n;e.request.subtype===`can_use_tool`?this.options.onPermissionRequest(e.request,e.request_id):(o(`[SSH] Unsupported control request subtype: ${e.request.subtype}`),this.sendErrorResponse(e.request_id,`Unsupported control request subtype: ${e.request.subtype}`));return}n.type!==`control_response`&&n.type!==`keep_alive`&&n.type!==`control_cancel_request`&&n.type!==`streamlined_text`&&n.type!==`streamlined_tool_use_summary`&&!(n.type===`system`&&n.subtype===`post_turn_summary`)&&this.options.onMessage(n)}writeToStdin(e){try{let t=this.proc.stdin;if(!t||typeof t==`number`||this.disconnected)return!1;let n=new TextEncoder().encode(e+`
3
3
  `);return t.write(n),t.flush?.(),!0}catch{return!1}}async sendMessage(e){let t=i({type:`user`,message:{role:`user`,content:e},parent_tool_use_id:null,session_id:``});return this.writeToStdin(t)}sendInterrupt(){let e=i({type:`control_request`,request_id:crypto.randomUUID(),request:{subtype:`interrupt`}});this.writeToStdin(e)}respondToPermissionRequest(e,t){let n=i({type:`control_response`,response:{subtype:`success`,request_id:e,response:{behavior:t.behavior,...t.behavior===`allow`?{updatedInput:t.updatedInput}:{message:t.message}}}});this.writeToStdin(n)}sendErrorResponse(e,t){let n=i({type:`control_response`,response:{subtype:`error`,request_id:e,error:t}});this.writeToStdin(n)}disconnect(){if(!this.disconnected){this.userInitiatedDisconnect=!0,this.disconnected=!0,this.connected=!1,this.readLoopAbort?.abort();try{let e=this.proc.stdin;e&&typeof e!=`number`&&e.end?.()}catch{}try{this.proc.kill()}catch{}}}isConnected(){return this.connected&&!this.disconnected}};r(),u(),s();var S=process.platform===`win32`;function C(){let e=process.env.ANTHROPIC_API_KEY;if(e)return{"x-api-key":e};let t=n();return t?.accessToken?{Authorization:`Bearer ${t.accessToken}`}:{}}function w(){return process.env.ANTHROPIC_BASE_URL||l().BASE_API_URL}async function T(e,t){if(t&&e.headers.get(`x-auth-nonce`)!==t)return new Response(`Forbidden`,{status:403});let n=w(),r=new URL(e.url),i=`${n}${r.pathname}${r.search}`,a=C();if(Object.keys(a).length===0)return new Response(JSON.stringify({error:`No API credentials available on local machine`}),{status:401,headers:{"content-type":`application/json`}});let s=new Headers(e.headers);for(let[e,t]of Object.entries(a))s.set(e,t);s.delete(`host`),s.delete(`x-auth-nonce`),o(`[SSHAuthProxy] ${e.method} ${r.pathname} -> ${i}`);try{let t=await fetch(i,{method:e.method,headers:s,body:e.body,duplex:`half`}),n=new Headers(t.headers);return n.delete(`content-encoding`),n.delete(`content-length`),new Response(t.body,{status:t.status,statusText:t.statusText,headers:n})}catch(e){let t=e instanceof Error?e.message:String(e);return o(`[SSHAuthProxy] upstream error: ${t}`),new Response(JSON.stringify({error:`Proxy upstream error: ${t}`}),{status:502,headers:{"content-type":`application/json`}})}}async function E(){let e=g();return S?O(e):D(e)}async function D(e){let t=`/tmp/claude-ssh-auth-${e}.sock`,n=Bun.serve({unix:t,fetch:e=>T(e,null)});return o(`[SSHAuthProxy] listening on unix:${t}`),{proxy:{stop(){n.stop(!0);try{h(t)}catch{}}},localAddress:t,authEnv:{ANTHROPIC_AUTH_SOCKET:t}}}async function O(e){let t=g(),n=Bun.serve({port:0,hostname:`127.0.0.1`,fetch:e=>T(e,t)}),r=n.port;return o(`[SSHAuthProxy] listening on TCP 127.0.0.1:${r} (nonce-protected)`),{proxy:{stop(){n.stop(!0)}},localAddress:`127.0.0.1:${r}`,authEnv:{ANTHROPIC_BASE_URL:`http://127.0.0.1:${r}`,ANTHROPIC_AUTH_NONCE:t}}}s();var k=15e3,A=class extends Error{constructor(e){super(e),this.name=`SSHProbeError`}};async function j(e,t){t?.(`Probing remote host…`);let n=Bun.spawn([`ssh`,`-o`,`BatchMode=yes`,`-o`,`ConnectTimeout=10`,e,`CLAUDE_BIN=$(test -x "$HOME/.local/bin/claude" && echo "$HOME/.local/bin/claude" || command -v claude 2>/dev/null); echo "$CLAUDE_BIN"; $CLAUDE_BIN --version 2>/dev/null; uname -sm; pwd`],{stdin:`ignore`,stdout:`pipe`,stderr:`pipe`}),r=await Promise.race([n.exited,new Promise((e,t)=>setTimeout(()=>t(new A(`SSH probe timed out after ${k/1e3}s`)),k))]),i=await new Response(n.stdout).text(),a=await new Response(n.stderr).text();if(r!==0)throw new A(`SSH probe failed: ${a.trim()||`exit code ${r}`}`);let s=i.split(`
4
4
  `).map(e=>e.trim()).filter(Boolean);o(`[SSHProbe] raw lines: ${JSON.stringify(s)}`);let c=s.findIndex(e=>/^(Linux|Darwin)\s/.test(e));if(c===-1)throw new A(`Could not detect remote platform (uname output missing)`);let l=c>=2&&s[c-2]||null,u=c>=1&&s[c-1]||null,d=u&&/^\d+\.\d+/.test(u)?u:null,f=l!==null&&l.startsWith(`/`),p=s[c+1]||`/`,[m,h]=s[c].split(/\s+/),g=m===`Darwin`?`darwin`:`linux`,_=h===`aarch64`||h===`arm64`?`arm64`:`x64`;return t?.(`Detected ${g}/${_}`),{hasBinary:f&&d!==null,remoteVersion:d,remotePlatform:g,remoteArch:_,defaultCwd:p,binaryPath:f?l:null}}s();var M=6e4,N=`~/.local/bin`,P=`claude-code-cli.js`,F=`claude`;async function I(e,t,n=M){let r=Bun.spawn([`ssh`,`-o`,`ConnectTimeout=10`,e,t],{stdout:`pipe`,stderr:`pipe`}),i=setTimeout(()=>r.kill(),n);try{let[e,t]=await Promise.all([new Response(r.stdout).text(),new Response(r.stderr).text()]),n=await r.exited;return{stdout:e.trim(),stderr:t.trim(),exitCode:n}}finally{clearTimeout(i)}}function L(){let e=p(import.meta.dir,`../..`),t=p(e,`dist/cli.js`);if(m(t))return t;let n=p(e,`src/entrypoints/cli.tsx`);if(m(n))return n;throw Error("Cannot find local CLI binary to deploy. Run `bun run build` first.")}async function R(e){let{host:t,remotePlatform:n,remoteArch:r,localVersion:i,onProgress:a}=e;if(n!==`linux`&&n!==`darwin`)throw Error(`Remote platform "${n}" is not supported. Only linux and darwin are supported.`);o(`[SSHDeploy] deploying to ${t} (${n}/${r}, v${i})`);let s=L();o(`[SSHDeploy] local binary: ${s}`),a?.(`Creating remote directory...`);let c=await I(t,`mkdir -p ${N}`);if(c.exitCode!==0)throw Error(`Failed to create remote directory: ${c.stderr}`);a?.(`Uploading binary...`);let l=`${N}/${P}`,u=Bun.spawn([`scp`,`-o`,`ConnectTimeout=10`,s,`${t}:${l}`],{stdout:`pipe`,stderr:`pipe`}),d=setTimeout(()=>u.kill(),M),f=await new Response(u.stderr).text(),p=await u.exited;if(clearTimeout(d),p!==0)throw Error(`SCP upload failed (exit ${p}): ${f.trim()}`);a?.(`Installing wrapper script...`);let m=await I(t,[`cat > ${N}/${F} << 'WRAPPER'`,`#!/bin/sh`,`exec bun ${N}/${P} "$@"`,`WRAPPER`,`chmod +x ${N}/${F}`].join(`
@@ -1 +1 @@
1
- import{n as e}from"./chunk-DR8-3Aex.js";import{L as t,V as n,d as r,s as i}from"./debug-UI3T040K.js";import{c as a,d as o,i as s,o as c}from"./debugUtils-BBMFODKH.js";async function l({environmentId:e,title:n,events:i,gitRepoUrl:a,branch:o,signal:c,baseUrl:l,getAccessToken:u,permissionMode:d}){let{getClaudeAIOAuthTokens:f}=await import(`./auth-CSB2RDKF.js`),{getOrganizationUUID:p}=await import(`./client-DxDmXXTh.js`),{getOauthConfig:m}=await import(`./oauth-CmensepG.js`),{getOAuthHeaders:h}=await import(`./api-6tcwJlf_.js`),{parseGitHubRepository:g}=await import(`./detectRepository-DCTvg4p0.js`),{getDefaultBranch:_}=await import(`./git-D23Mzu_K.js`),{getMainLoopModel:v}=await import(`./model-H3rtl6eR.js`),{default:y}=await import(`./axios-DLnc2dVy.js`),{isSelfHostedBridge:b}=await import(`./bridgeConfig-D4tpc568.js`),x=u?.()??f()?.accessToken;if(!x)return r(`[bridge] No access token for session creation`),null;let S=b()?`self-hosted`:await p();if(!S)return r(`[bridge] No org UUID for session creation`),null;let C=null,w=null;if(a){let{parseGitRemote:e}=await import(`./detectRepository-DCTvg4p0.js`),t=e(a);if(t){let{host:e,owner:n,name:r}=t,i=o||await _()||void 0;C={type:`git_repository`,url:`https://${e}/${n}/${r}`,revision:i},w={type:`git_repository`,git_info:{type:`github`,repo:`${n}/${r}`,branches:[`claude/${o||`task`}`]}}}else{let e=g(a);if(e){let[t,n]=e.split(`/`);if(t&&n){let e=o||await _()||void 0;C={type:`git_repository`,url:`https://github.com/${t}/${n}`,revision:e},w={type:`git_repository`,git_info:{type:`github`,repo:`${t}/${n}`,branches:[`claude/${o||`task`}`]}}}}}}let T={...n!==void 0&&{title:n},events:i,session_context:{sources:C?[C]:[],outcomes:w?[w]:[],model:v()},environment_id:e,source:`remote-control`,...d&&{permission_mode:d}},E={...h(x),"anthropic-beta":`ccr-byoc-2025-07-29`,"x-organization-uuid":S},D=`${l??m().BASE_API_URL}/v1/sessions`,O;try{O=await y.post(D,T,{headers:E,signal:c,validateStatus:e=>e<500})}catch(e){return r(`[bridge] Session creation request failed: ${t(e)}`),null}if(!(O.status===200||O.status===201)){let e=s(O.data);return r(`[bridge] Session creation failed with status ${O.status}${e?`: ${e}`:``}`),null}let k=O.data;return!k||typeof k!=`object`||!(`id`in k)||typeof k.id!=`string`?(r(`[bridge] No session ID in response`),null):k.id}async function u(e,n){let{getClaudeAIOAuthTokens:i}=await import(`./auth-CSB2RDKF.js`),{getOrganizationUUID:a}=await import(`./client-DxDmXXTh.js`),{getOauthConfig:o}=await import(`./oauth-CmensepG.js`),{getOAuthHeaders:c}=await import(`./api-6tcwJlf_.js`),{default:l}=await import(`./axios-DLnc2dVy.js`),{isSelfHostedBridge:u}=await import(`./bridgeConfig-D4tpc568.js`),d=n?.getAccessToken?.()??i()?.accessToken;if(!d)return r(`[bridge] No access token for session fetch`),null;let f=u()?`self-hosted`:await a();if(!f)return r(`[bridge] No org UUID for session fetch`),null;let p={...c(d),"anthropic-beta":`ccr-byoc-2025-07-29`,"x-organization-uuid":f},m=`${n?.baseUrl??o().BASE_API_URL}/v1/sessions/${e}`;r(`[bridge] Fetching session ${e}`);let h;try{h=await l.get(m,{headers:p,timeout:1e4,validateStatus:e=>e<500})}catch(e){return r(`[bridge] Session fetch request failed: ${t(e)}`),null}if(h.status!==200){let e=s(h.data);return r(`[bridge] Session fetch failed with status ${h.status}${e?`: ${e}`:``}`),null}return h.data}async function d(e,t){let{getClaudeAIOAuthTokens:n}=await import(`./auth-CSB2RDKF.js`),{getOrganizationUUID:i}=await import(`./client-DxDmXXTh.js`),{getOauthConfig:a}=await import(`./oauth-CmensepG.js`),{getOAuthHeaders:o}=await import(`./api-6tcwJlf_.js`),{default:c}=await import(`./axios-DLnc2dVy.js`),{isSelfHostedBridge:l}=await import(`./bridgeConfig-D4tpc568.js`),u=t?.getAccessToken?.()??n()?.accessToken;if(!u){r(`[bridge] No access token for session archive`);return}let d=l()?`self-hosted`:await i();if(!d){r(`[bridge] No org UUID for session archive`);return}let f={...o(u),"anthropic-beta":`ccr-byoc-2025-07-29`,"x-organization-uuid":d},p=`${t?.baseUrl??a().BASE_API_URL}/v1/sessions/${e}/archive`;r(`[bridge] Archiving session ${e}`);let m=await c.post(p,{},{headers:f,timeout:t?.timeoutMs??1e4,validateStatus:e=>e<500});if(m.status===200)r(`[bridge] Session ${e} archived successfully`);else{let e=s(m.data);r(`[bridge] Session archive failed with status ${m.status}${e?`: ${e}`:``}`)}}async function f(e,n,i){let{getClaudeAIOAuthTokens:a}=await import(`./auth-CSB2RDKF.js`),{getOrganizationUUID:c}=await import(`./client-DxDmXXTh.js`),{getOauthConfig:l}=await import(`./oauth-CmensepG.js`),{getOAuthHeaders:u}=await import(`./api-6tcwJlf_.js`),{default:d}=await import(`./axios-DLnc2dVy.js`),{isSelfHostedBridge:f}=await import(`./bridgeConfig-D4tpc568.js`),p=i?.getAccessToken?.()??a()?.accessToken;if(!p){r(`[bridge] No access token for session title update`);return}let m=f()?`self-hosted`:await c();if(!m){r(`[bridge] No org UUID for session title update`);return}let h={...u(p),"anthropic-beta":`ccr-byoc-2025-07-29`,"x-organization-uuid":m},g=o(e),_=`${i?.baseUrl??l().BASE_API_URL}/v1/sessions/${g}`;r(`[bridge] Updating session title: ${g} → ${n}`);try{let e=await d.patch(_,{title:n},{headers:h,timeout:1e4,validateStatus:e=>e<500});if(e.status===200)r(`[bridge] Session title updated successfully`);else{let t=s(e.data);r(`[bridge] Session title update failed with status ${e.status}${t?`: ${t}`:``}`)}}catch(e){r(`[bridge] Session title update request failed: ${t(e)}`)}}var p=e((()=>{i(),n(),c(),a()}));export{f as a,p as i,l as n,u as r,d as t};
1
+ import{n as e}from"./chunk-DR8-3Aex.js";import{L as t,V as n,d as r,s as i}from"./debug-UI3T040K.js";import{c as a,d as o,i as s,o as c}from"./debugUtils-BBMFODKH.js";async function l({environmentId:e,title:n,events:i,gitRepoUrl:a,branch:o,signal:c,baseUrl:l,getAccessToken:u,permissionMode:d}){let{getClaudeAIOAuthTokens:f}=await import(`./auth-D7PZvVPf.js`),{getOrganizationUUID:p}=await import(`./client-BcqXgcrx.js`),{getOauthConfig:m}=await import(`./oauth-CmensepG.js`),{getOAuthHeaders:h}=await import(`./api-CFNGoLoL.js`),{parseGitHubRepository:g}=await import(`./detectRepository-DCTvg4p0.js`),{getDefaultBranch:_}=await import(`./git-D23Mzu_K.js`),{getMainLoopModel:v}=await import(`./model-D3g2QdU-.js`),{default:y}=await import(`./axios-DLnc2dVy.js`),{isSelfHostedBridge:b}=await import(`./bridgeConfig-7c07tJm9.js`),x=u?.()??f()?.accessToken;if(!x)return r(`[bridge] No access token for session creation`),null;let S=b()?`self-hosted`:await p();if(!S)return r(`[bridge] No org UUID for session creation`),null;let C=null,w=null;if(a){let{parseGitRemote:e}=await import(`./detectRepository-DCTvg4p0.js`),t=e(a);if(t){let{host:e,owner:n,name:r}=t,i=o||await _()||void 0;C={type:`git_repository`,url:`https://${e}/${n}/${r}`,revision:i},w={type:`git_repository`,git_info:{type:`github`,repo:`${n}/${r}`,branches:[`claude/${o||`task`}`]}}}else{let e=g(a);if(e){let[t,n]=e.split(`/`);if(t&&n){let e=o||await _()||void 0;C={type:`git_repository`,url:`https://github.com/${t}/${n}`,revision:e},w={type:`git_repository`,git_info:{type:`github`,repo:`${t}/${n}`,branches:[`claude/${o||`task`}`]}}}}}}let T={...n!==void 0&&{title:n},events:i,session_context:{sources:C?[C]:[],outcomes:w?[w]:[],model:v()},environment_id:e,source:`remote-control`,...d&&{permission_mode:d}},E={...h(x),"anthropic-beta":`ccr-byoc-2025-07-29`,"x-organization-uuid":S},D=`${l??m().BASE_API_URL}/v1/sessions`,O;try{O=await y.post(D,T,{headers:E,signal:c,validateStatus:e=>e<500})}catch(e){return r(`[bridge] Session creation request failed: ${t(e)}`),null}if(!(O.status===200||O.status===201)){let e=s(O.data);return r(`[bridge] Session creation failed with status ${O.status}${e?`: ${e}`:``}`),null}let k=O.data;return!k||typeof k!=`object`||!(`id`in k)||typeof k.id!=`string`?(r(`[bridge] No session ID in response`),null):k.id}async function u(e,n){let{getClaudeAIOAuthTokens:i}=await import(`./auth-D7PZvVPf.js`),{getOrganizationUUID:a}=await import(`./client-BcqXgcrx.js`),{getOauthConfig:o}=await import(`./oauth-CmensepG.js`),{getOAuthHeaders:c}=await import(`./api-CFNGoLoL.js`),{default:l}=await import(`./axios-DLnc2dVy.js`),{isSelfHostedBridge:u}=await import(`./bridgeConfig-7c07tJm9.js`),d=n?.getAccessToken?.()??i()?.accessToken;if(!d)return r(`[bridge] No access token for session fetch`),null;let f=u()?`self-hosted`:await a();if(!f)return r(`[bridge] No org UUID for session fetch`),null;let p={...c(d),"anthropic-beta":`ccr-byoc-2025-07-29`,"x-organization-uuid":f},m=`${n?.baseUrl??o().BASE_API_URL}/v1/sessions/${e}`;r(`[bridge] Fetching session ${e}`);let h;try{h=await l.get(m,{headers:p,timeout:1e4,validateStatus:e=>e<500})}catch(e){return r(`[bridge] Session fetch request failed: ${t(e)}`),null}if(h.status!==200){let e=s(h.data);return r(`[bridge] Session fetch failed with status ${h.status}${e?`: ${e}`:``}`),null}return h.data}async function d(e,t){let{getClaudeAIOAuthTokens:n}=await import(`./auth-D7PZvVPf.js`),{getOrganizationUUID:i}=await import(`./client-BcqXgcrx.js`),{getOauthConfig:a}=await import(`./oauth-CmensepG.js`),{getOAuthHeaders:o}=await import(`./api-CFNGoLoL.js`),{default:c}=await import(`./axios-DLnc2dVy.js`),{isSelfHostedBridge:l}=await import(`./bridgeConfig-7c07tJm9.js`),u=t?.getAccessToken?.()??n()?.accessToken;if(!u){r(`[bridge] No access token for session archive`);return}let d=l()?`self-hosted`:await i();if(!d){r(`[bridge] No org UUID for session archive`);return}let f={...o(u),"anthropic-beta":`ccr-byoc-2025-07-29`,"x-organization-uuid":d},p=`${t?.baseUrl??a().BASE_API_URL}/v1/sessions/${e}/archive`;r(`[bridge] Archiving session ${e}`);let m=await c.post(p,{},{headers:f,timeout:t?.timeoutMs??1e4,validateStatus:e=>e<500});if(m.status===200)r(`[bridge] Session ${e} archived successfully`);else{let e=s(m.data);r(`[bridge] Session archive failed with status ${m.status}${e?`: ${e}`:``}`)}}async function f(e,n,i){let{getClaudeAIOAuthTokens:a}=await import(`./auth-D7PZvVPf.js`),{getOrganizationUUID:c}=await import(`./client-BcqXgcrx.js`),{getOauthConfig:l}=await import(`./oauth-CmensepG.js`),{getOAuthHeaders:u}=await import(`./api-CFNGoLoL.js`),{default:d}=await import(`./axios-DLnc2dVy.js`),{isSelfHostedBridge:f}=await import(`./bridgeConfig-7c07tJm9.js`),p=i?.getAccessToken?.()??a()?.accessToken;if(!p){r(`[bridge] No access token for session title update`);return}let m=f()?`self-hosted`:await c();if(!m){r(`[bridge] No org UUID for session title update`);return}let h={...u(p),"anthropic-beta":`ccr-byoc-2025-07-29`,"x-organization-uuid":m},g=o(e),_=`${i?.baseUrl??l().BASE_API_URL}/v1/sessions/${g}`;r(`[bridge] Updating session title: ${g} → ${n}`);try{let e=await d.patch(_,{title:n},{headers:h,timeout:1e4,validateStatus:e=>e<500});if(e.status===200)r(`[bridge] Session title updated successfully`);else{let t=s(e.data);r(`[bridge] Session title update failed with status ${e.status}${t?`: ${t}`:``}`)}}catch(e){r(`[bridge] Session title update request failed: ${t(e)}`)}}var p=e((()=>{i(),n(),c(),a()}));export{f as a,p as i,l as n,u as r,d as t};
@@ -0,0 +1 @@
1
+ import{a as e,i as t,n,r}from"./createSession-CBheIT_G.js";t();export{n as createBridgeSession,r as getBridgeSession,e as updateBridgeSessionTitle};
@@ -0,0 +1,6 @@
1
+ import{n as e,r as t}from"./chunk-DR8-3Aex.js";import{n,t as r}from"./defineProperty-80gRi2ZW.js";import{Cn as i,Ln as a,Mn as o,Tt as s,Xn as c,Yn as l,kt as u,ln as d,un as f,vt as p,wn as m,wt as h}from"./schemas-BGAvj1T4.js";import{n as g,t as _}from"./v4-f1i_CNUT.js";import{Ct as v,St as ee,cn as y,gr as te,gt as b,ot as x,ut as S,vn as ne}from"./state-sIHsFpDu.js";import{Fl as C,Il as re,S as w,Ss as ie,al as ae,el as oe,v as se,xs as ce}from"./paths-1ngPRtu3.js";import{E as T,L as le,R as ue,T as de,V as E,X as fe,Y as pe,d as D,k as me,s as O,w as k}from"./debug-UI3T040K.js";import{n as he,r as A}from"./analytics-DqMQntaB.js";import{n as ge,o as _e}from"./process-DMKLUQIO.js";import{F as ve,P as ye,n as be,v as xe}from"./git-CN3qtTb_.js";import{o as Se,s as j}from"./log-CzsijfHZ.js";import{s as Ce,u as we}from"./types-Csi32ZXh.js";import{n as M,t as N}from"./lazySchema-2sOku3cX.js";import{a as Te,i as Ee}from"./genericProcessUtils-BGvcwuPt.js";import{En as De,FD as Oe,FO as ke,Fs as Ae,G as je,Hs as Me,ID as Ne,IO as Pe,K as Fe,Ls as Ie,Tn as Le,Ut as Re,Vs as ze,_g as Be,ag as Ve,bg as P,cD as F,cg as He,cu as Ue,dg as I,fg as We,gg as Ge,hg as Ke,ig as qe,lg as Je,lu as Ye,mg as Xe,nf as Ze,oD as L,og as R,pg as Qe,rD as $e,sg as et,tf as tt,ug as nt,vg as rt,xg as it,yg as at,yn as ot}from"./loadAgentsDir-D7kapZB5.js";import{B as z,H as st,I as B,J as ct,K as lt,R as ut,V as dt,W as ft,q as pt,z as mt}from"./prompt-BBg3jtfc.js";import{n as ht,r as gt}from"./cron-DiW7eIPP.js";import{d as _t,h as vt}from"./rcDebugLog-CPGWJbI4.js";import{t as yt}from"./controlMessageCompat-BJhFiS7u.js";import{dirname as bt,isAbsolute as xt,join as St,resolve as Ct}from"path";import{randomUUID as V}from"crypto";import{mkdir as wt,readFile as Tt,unlink as Et,writeFile as H}from"fs/promises";_(),N(),it();var Dt=M(()=>c()),Ot=M(()=>m({matcher:a().optional(),hookCallbackIds:s(a()),timeout:i().optional()}).describe(`Configuration for matching and routing hook callbacks.`)),kt=M(()=>m({subtype:f(`initialize`),hooks:o(He(),s(Ot())).optional(),sdkMcpServers:s(a()).optional(),jsonSchema:o(a(),c()).optional(),systemPrompt:a().optional(),appendSystemPrompt:a().optional(),agents:o(a(),Ve()).optional(),promptSuggestions:u().optional(),agentProgressSummaries:u().optional()}).describe(`Initializes the SDK session with hooks, MCP servers, and agent configuration.`));M(()=>m({commands:s(P()),agents:s(R()),output_style:a(),available_output_styles:s(a()),models:s(We()),account:qe(),pid:i().optional().describe(`@internal CLI process PID for tmux socket isolation`),fast_mode_state:et().optional()}).describe(`Response from session initialization with available commands, models, and account info.`));var At=M(()=>m({subtype:f(`interrupt`)}).describe(`Interrupts the currently running conversation turn.`)),jt=M(()=>m({subtype:f(`can_use_tool`),tool_name:a(),input:o(a(),c()),permission_suggestions:s(Xe()).optional(),blocked_path:a().optional(),decision_reason:a().optional(),title:a().optional(),display_name:a().optional(),tool_use_id:a(),agent_id:a().optional(),description:a().optional()}).describe(`Requests permission to use a tool with the given input.`)),Mt=M(()=>m({subtype:f(`set_permission_mode`),mode:Qe(),ultraplan:u().optional().describe(`@internal CCR ultraplan session marker.`)}).describe(`Sets the permission mode for tool execution handling.`)),Nt=M(()=>m({subtype:f(`set_model`),model:a().optional()}).describe(`Sets the model to use for subsequent conversation turns.`)),Pt=M(()=>m({subtype:f(`set_max_thinking_tokens`),max_thinking_tokens:i().nullable()}).describe(`Sets the maximum number of thinking tokens for extended thinking.`)),Ft=M(()=>m({subtype:f(`mcp_status`)}).describe(`Requests the current status of all MCP server connections.`));M(()=>m({mcpServers:s(I())}).describe(`Response containing the current status of all MCP server connections.`));var It=M(()=>m({subtype:f(`get_context_usage`)}).describe(`Requests a breakdown of current context window usage by category.`)),Lt=M(()=>m({name:a(),tokens:i(),color:a(),isDeferred:u().optional()})),Rt=M(()=>m({color:a(),isFilled:u(),categoryName:a(),tokens:i(),percentage:i(),squareFullness:i()}));M(()=>m({categories:s(Lt()),totalTokens:i(),maxTokens:i(),rawMaxTokens:i(),percentage:i(),gridRows:s(s(Rt())),model:a(),memoryFiles:s(m({path:a(),type:a(),tokens:i()})),mcpTools:s(m({name:a(),serverName:a(),tokens:i(),isLoaded:u().optional()})),deferredBuiltinTools:s(m({name:a(),tokens:i(),isLoaded:u()})).optional(),systemTools:s(m({name:a(),tokens:i()})).optional(),systemPromptSections:s(m({name:a(),tokens:i()})).optional(),agents:s(m({agentType:a(),source:a(),tokens:i()})),slashCommands:m({totalCommands:i(),includedCommands:i(),tokens:i()}).optional(),skills:m({totalSkills:i(),includedSkills:i(),tokens:i(),skillFrontmatter:s(m({name:a(),source:a(),tokens:i()}))}).optional(),autoCompactThreshold:i().optional(),isAutoCompactEnabled:u(),messageBreakdown:m({toolCallTokens:i(),toolResultTokens:i(),attachmentTokens:i(),assistantMessageTokens:i(),userMessageTokens:i(),toolCallsByType:s(m({name:a(),callTokens:i(),resultTokens:i()})),attachmentsByType:s(m({name:a(),tokens:i()}))}).optional(),apiUsage:m({input_tokens:i(),output_tokens:i(),cache_creation_input_tokens:i(),cache_read_input_tokens:i()}).nullable()}).describe(`Breakdown of current context window usage by category (system prompt, tools, messages, etc.).`));var zt=M(()=>m({subtype:f(`rewind_files`),user_message_id:a(),dry_run:u().optional()}).describe(`Rewinds file changes made since a specific user message.`));M(()=>m({canRewind:u(),error:a().optional(),filesChanged:s(a()).optional(),insertions:i().optional(),deletions:i().optional()}).describe(`Result of a rewindFiles operation.`));var Bt=M(()=>m({subtype:f(`cancel_async_message`),message_uuid:a()}).describe(`Drops a pending async user message from the command queue by uuid. No-op if already dequeued for execution.`));M(()=>m({cancelled:u()}).describe(`Result of a cancel_async_message operation. cancelled=false means the message was not in the queue (already dequeued or never enqueued).`));var Vt=M(()=>m({subtype:f(`seed_read_state`),path:a(),mtime:i()}).describe(`Seeds the readFileState cache with a path+mtime entry. Use when a prior Read was removed from context (e.g. by snip) so Edit validation would fail despite the client having observed the Read. The mtime lets the CLI detect if the file changed since the seeded Read — same staleness check as the normal path.`)),Ht=M(()=>m({subtype:f(`hook_callback`),callback_id:a(),input:Je(),tool_use_id:a().optional()}).describe(`Delivers a hook callback with its input data.`)),Ut=M(()=>m({subtype:f(`mcp_message`),server_name:a(),message:Dt()}).describe(`Sends a JSON-RPC message to a specific MCP server.`)),Wt=M(()=>m({subtype:f(`mcp_set_servers`),servers:o(a(),nt())}).describe(`Replaces the set of dynamically managed MCP servers.`));M(()=>m({added:s(a()),removed:s(a()),errors:o(a(),a())}).describe(`Result of replacing the set of dynamically managed MCP servers.`));var Gt=M(()=>m({subtype:f(`reload_plugins`)}).describe(`Reloads plugins from disk and returns the refreshed session components.`));M(()=>m({commands:s(P()),agents:s(R()),plugins:s(m({name:a(),path:a(),source:a().optional()})),mcpServers:s(I()),error_count:i()}).describe(`Refreshed commands, agents, plugins, and MCP server status after reload.`));var Kt=M(()=>m({subtype:f(`mcp_reconnect`),serverName:a()}).describe(`Reconnects a disconnected or failed MCP server.`)),qt=M(()=>m({subtype:f(`mcp_toggle`),serverName:a(),enabled:u()}).describe(`Enables or disables an MCP server.`)),Jt=M(()=>m({subtype:f(`stop_task`),task_id:a()}).describe(`Stops a running task.`)),Yt=M(()=>m({subtype:f(`apply_flag_settings`),settings:o(a(),c())}).describe(`Merges the provided settings into the flag settings layer, updating the active configuration.`)),Xt=M(()=>m({subtype:f(`get_settings`)}).describe(`Returns the effective merged settings and the raw per-source settings.`));M(()=>m({effective:o(a(),c()),sources:s(m({source:p([`userSettings`,`projectSettings`,`localSettings`,`flagSettings`,`policySettings`]),settings:o(a(),c())})).describe(`Ordered low-to-high priority — later entries override earlier ones.`),applied:m({model:a(),effort:p([`low`,`medium`,`high`,`xhigh`,`max`]).nullable()}).optional().describe("Runtime-resolved values after env overrides, session state, and model-specific defaults are applied. Unlike `effective` (disk merge), these reflect what will actually be sent to the API.")}).describe(`Effective merged settings plus raw per-source settings in merge order.`));var Zt=M(()=>m({subtype:f(`elicitation`),mcp_server_name:a(),message:a(),mode:p([`form`,`url`]).optional(),url:a().optional(),elicitation_id:a().optional(),requested_schema:o(a(),c()).optional()}).describe(`Requests the SDK consumer to handle an MCP elicitation (user input request).`)),Qt=M(()=>m({action:p([`accept`,`decline`,`cancel`]),content:o(a(),c()).optional()}).describe(`Response from the SDK consumer for an elicitation request.`)),$t=M(()=>l([At(),jt(),kt(),Mt(),Nt(),Pt(),Ft(),It(),Ht(),Ut(),zt(),Bt(),Vt(),Wt(),Gt(),Kt(),qt(),Jt(),Yt(),Xt(),Zt()])),U=M(()=>m({type:f(`control_request`),request_id:a(),request:$t()})),en=M(()=>m({subtype:f(`success`),request_id:a(),response:o(a(),c()).optional()})),tn=M(()=>m({subtype:f(`error`),request_id:a(),error:a(),pending_permission_requests:s(d(()=>U())).optional()})),nn=M(()=>m({type:f(`control_response`),response:l([en(),tn()])})),rn=M(()=>m({type:f(`control_cancel_request`),request_id:a()}).describe(`Cancels a currently open control request.`)),an=M(()=>m({type:f(`keep_alive`)}).describe(`Keep-alive message to maintain WebSocket connection.`)),on=M(()=>m({type:f(`update_environment_variables`),variables:o(a(),a())}).describe(`Updates environment variables at runtime.`));M(()=>l([Ke(),Be(),rt(),Ge(),nn(),U(),rn(),an()])),M(()=>l([at(),U(),nn(),an(),on()])),n(),y(),pe(),E(),k(),ge(),ye(),De(),_(),O(),N(),L(),tt(),M(()=>g.object({tool_name:g.string().describe(`The name of the tool requesting permission`),input:g.record(g.string(),g.unknown()).describe(`The input for the tool`),tool_use_id:g.string().optional().describe(`The unique tool use request ID`)}));var sn=M(()=>g.enum([`user_temporary`,`user_permanent`,`user_reject`]).optional().catch(void 0)),cn=M(()=>g.object({behavior:g.literal(`allow`),updatedInput:g.record(g.string(),g.unknown()),updatedPermissions:g.array(Ze()).optional().catch(e=>{D(`Malformed updatedPermissions from SDK host ignored: ${e.error.issues[0]?.message??`unknown`}`,{level:`warn`})}),toolUseID:g.string().optional(),decisionClassification:sn()})),ln=M(()=>g.object({behavior:g.literal(`deny`),message:g.string(),interrupt:g.boolean().optional(),toolUseID:g.string().optional(),decisionClassification:sn()})),W=M(()=>g.union([cn(),ln()]));function G(e,t,n,r){let i={type:`permissionPromptTool`,permissionPromptToolName:t.name,toolResult:e};if(e.behavior===`allow`){let t=e.updatedPermissions;t&&(r.setAppState(e=>({...e,toolPermissionContext:$e(e.toolPermissionContext,t)})),F(t));let a=Object.keys(e.updatedInput).length>0?e.updatedInput:n;return{...e,updatedInput:a,decisionReason:i}}else e.behavior===`deny`&&e.interrupt&&(D(`SDK permission prompt deny+interrupt: tool=${t.name} message=${e.message}`),r.abortController.abort());return{...e,decisionReason:i}}he(),Se(),oe(),ce(),w(),Oe(),_t(),Ye(),ot(),Fe();var un=/\u2028|\u2029/g;function dn(e){return e.replace(un,e=>e===`\u2028`?`\\u2028`:`\\u2029`)}function fn(e){return dn(T(e))}O(),k(),_(),L();var pn=`SandboxNetworkAccess`;function mn(e){if(e){if(e.type===`classifier`)return e.reason;switch(e.type){case`rule`:case`mode`:case`subcommandResults`:case`permissionPromptTool`:return;case`hook`:case`asyncAgent`:case`sandboxOverride`:case`workingDir`:case`safetyCheck`:case`other`:return e.reason}}}function hn(e,t,n,r){let i;try{i=e.getActivityDescription?.(t)??e.getToolUseSummary?.(t)??e.userFacingName(t)}catch{i=e.name}return{tool_name:e.name,action_description:i,tool_use_id:n,request_id:r,input:t}}var gn=1e3,_n=class{constructor(e,t){r(this,`structuredInput`,void 0),r(this,`pendingRequests`,new Map),r(this,`restoredWorkerState`,Promise.resolve(null)),r(this,`inputClosed`,!1),r(this,`unexpectedResponseCallback`,void 0),r(this,`resolvedToolUseIds`,new Set),r(this,`prependedLines`,[]),r(this,`onControlRequestSent`,void 0),r(this,`onControlRequestResolved`,void 0),r(this,`outbound`,new Ue),this.input=e,this.replayUserMessages=t,this.input=e,this.structuredInput=this.read()}trackResolvedToolUseId(e){let t=e.request;if(t.subtype===`can_use_tool`&&(this.resolvedToolUseIds.add(t.tool_use_id),this.resolvedToolUseIds.size>gn)){let e=this.resolvedToolUseIds.values().next().value;e!==void 0&&this.resolvedToolUseIds.delete(e)}}flushInternalEvents(){return Promise.resolve()}get internalEventsPending(){return 0}prependUserMessage(e){this.prependedLines.push(T({type:`user`,content:e,uuid:``,session_id:``,message:{role:`user`,content:e},parent_tool_use_id:null})+`
2
+ `)}async*read(){let e=``,t=async function*(){for(;;){this.prependedLines.length>0&&(e=this.prependedLines.join(``)+e,this.prependedLines=[]);let t=e.indexOf(`
3
+ `);if(t===-1)break;let n=e.slice(0,t);e=e.slice(t+1);let r=await this.processLine(n);r&&(ve(`info`,`cli_stdin_message_parsed`,{type:r.type}),yield r)}}.bind(this);yield*t();for await(let n of this.input)e+=n,yield*t();if(e){let t=await this.processLine(e);t&&(yield t)}this.inputClosed=!0;for(let e of this.pendingRequests.values())e.reject(Error(`Tool permission stream closed before response received`))}getPendingPermissionRequests(){return Array.from(this.pendingRequests.values()).map(e=>e.request).filter(e=>e.request.subtype===`can_use_tool`)}setUnexpectedResponseCallback(e){this.unexpectedResponseCallback=e}injectControlResponse(e){let t=e.response,n=t?.request_id;if(!n)return;let r=this.pendingRequests.get(n);if(r)if(this.trackResolvedToolUseId(r.request),this.pendingRequests.delete(n),this.write({type:`control_cancel_request`,request_id:n}),t.subtype===`error`)r.reject(Error(t.error));else{let e=t.response;if(r.schema)try{r.resolve(r.schema.parse(e))}catch(e){r.reject(e)}else r.resolve({})}}setOnControlRequestSent(e){this.onControlRequestSent=e}setOnControlRequestResolved(e){this.onControlRequestResolved=e}async processLine(e){if(e)try{let t=yt(de(e));if(t.type===`keep_alive`)return;if(t.type===`update_environment_variables`){let e=t.variables??{},n=Object.keys(e);for(let[t,n]of Object.entries(e))process.env[t]=n;D(`[structuredIO] applied update_environment_variables: ${n.join(`, `)}`);return}if(t.type===`control_response`){let e=`uuid`in t&&typeof t.uuid==`string`?t.uuid:void 0;e&&Ne(e,`completed`);let n=t.response,r=this.pendingRequests.get(n.request_id);if(!r){let e=(n.subtype===`success`?n.response:void 0)?.toolUseID;if(typeof e==`string`&&this.resolvedToolUseIds.has(e)){D(`Ignoring duplicate control_response for already-resolved toolUseID=${e} request_id=${n.request_id}`);return}this.unexpectedResponseCallback&&await this.unexpectedResponseCallback(t);return}if(this.trackResolvedToolUseId(r.request),this.pendingRequests.delete(n.request_id),r.request.request.subtype===`can_use_tool`&&this.onControlRequestResolved&&this.onControlRequestResolved(n.request_id),n.subtype===`error`){r.reject(Error(n.error??`Unknown error`));return}let i=n.response;if(r.schema)try{r.resolve(r.schema.parse(i))}catch(e){r.reject(e)}else r.resolve({});return this.replayUserMessages?t:void 0}if(t.type!==`user`&&t.type!==`control_request`&&t.type!==`assistant`&&t.type!==`system`){D(`Ignoring unknown message type: ${t.type}`,{level:`warn`});return}return t.type===`control_request`?(t.request||vn(`Error: Missing request on control_request`),t):(t.type===`assistant`||t.type===`system`||t.message?.role!==`user`&&vn(`Error: Expected message role 'user', got '${t.message?.role}'`),t)}catch(t){console.error(`Error parsing streaming input line: ${e}: ${t}`),process.exit(1)}}async write(e){_e(fn(e)+`
4
+ `)}async sendRequest(e,t,n,r=V()){let i={type:`control_request`,request_id:r,request:e};if(this.inputClosed)throw Error(`Stream closed`);if(n?.aborted)throw Error(`Request aborted`);this.outbound.enqueue(i),e.subtype===`can_use_tool`&&this.onControlRequestSent&&this.onControlRequestSent(i);let a=()=>{this.outbound.enqueue({type:`control_cancel_request`,request_id:r});let e=this.pendingRequests.get(r);e&&(this.trackResolvedToolUseId(e.request),e.reject(new me))};n&&n.addEventListener(`abort`,a,{once:!0});try{return await new Promise((n,i)=>{this.pendingRequests.set(r,{request:{type:`control_request`,request_id:r,request:e},resolve:e=>{n(e)},reject:i,schema:t})})}finally{n&&n.removeEventListener(`abort`,a),this.pendingRequests.delete(r)}}createCanUseTool(e){return async(t,n,r,i,a,o)=>{let s=o??await je(t,n,r,i,a);if(s.behavior===`allow`||s.behavior===`deny`)return s;let c=new AbortController,l=r.abortController.signal,u=()=>c.abort();l.addEventListener(`abort`,u,{once:!0});try{let i=yn(t.name,a,n,r,s.suggestions).then(e=>({source:`hook`,decision:e})),o=V();e?.(hn(t,n,a,o));let l=this.sendRequest({subtype:`can_use_tool`,tool_name:t.name,input:n,permission_suggestions:s.suggestions,blocked_path:s.blockedPath,decision_reason:mn(s.decisionReason),tool_use_id:a,agent_id:r.agentId},W(),c.signal,o).then(e=>({source:`sdk`,result:e})),u=await Promise.race([i,l]);return u.source===`hook`?u.decision?(l.catch(()=>{}),c.abort(),u.decision):G((await l).result,t,n,r):G(u.result,t,n,r)}catch(e){return G({behavior:`deny`,message:`Tool permission request failed: ${e}`,toolUseID:a},t,n,r)}finally{this.getPendingPermissionRequests().length===0&&vt(`running`),l.removeEventListener(`abort`,u)}}}createHookCallback(e,t){return{type:`callback`,timeout:t,callback:async(t,n,r)=>{try{return await this.sendRequest({subtype:`hook_callback`,callback_id:e,input:t,tool_use_id:n||void 0},Le(),r)}catch(t){return console.error(`Error in hook callback ${e}:`,t),{}}}}}async handleElicitation(e,t,n,r,i,a,o){try{return await this.sendRequest({subtype:`elicitation`,mcp_server_name:e,message:t,mode:i,url:a,elicitation_id:o,requested_schema:n},Qt(),r)}catch{return{action:`cancel`}}}createSandboxAskCallback(){return async e=>{try{return(await this.sendRequest({subtype:`can_use_tool`,tool_name:pn,input:{host:e.host},tool_use_id:V(),description:`Allow network connection to ${e.host}?`},W())).behavior===`allow`}catch{return!1}}}async sendMcpMessage(e,t){return(await this.sendRequest({subtype:`mcp_message`,server_name:e,message:t},m({mcp_response:h()}))).mcp_response}};function vn(e){console.error(e),process.exit(1)}async function yn(e,t,n,r,i){let a=r.getAppState().toolPermissionContext.mode,o=Re(e,t,n,r,a,i,r.abortController.signal);for await(let e of o)if(e.permissionRequestResult&&(e.permissionRequestResult.behavior===`allow`||e.permissionRequestResult.behavior===`deny`)){let t=e.permissionRequestResult;if(t.behavior===`allow`){let e=t.updatedInput||n,i=t.updatedPermissions??[];if(i.length>0){F(i);let e=$e(r.getAppState().toolPermissionContext,i);r.setAppState(t=>t.toolPermissionContext===e?t:{...t,toolPermissionContext:e})}return{behavior:`allow`,updatedInput:e,userModified:!1,decisionReason:{type:`hook`,hookName:`PermissionRequest`}}}else return{behavior:`deny`,message:t.message||`Permission denied by PermissionRequest hook`,decisionReason:{type:`hook`,hookName:`PermissionRequest`}}}}Pe();function bn(e){if(e.type!==`user`)return;let t=e.message?.content;if(!t||Array.isArray(t)&&t.length===0)return;let n=`uuid`in e&&typeof e.uuid==`string`?e.uuid:void 0;return{content:Array.isArray(t)?xn(t):t,uuid:n}}function xn(e){return e.some(Sn)?e.map(e=>{if(!Sn(e))return e;let t=e.source,n=typeof t.mediaType==`string`&&t.mediaType?t.mediaType:ke(e.source.data);return{...e,source:{type:`base64`,media_type:n,data:e.source.data}}}):e}function Sn(e){return e.type!==`image`||e.source?.type!==`base64`?!1:!e.source.media_type}C(),O(),E(),xe(),ze();function Cn(e,t,n){let r=[],i=[],a=[];for(let[o,s]of Object.entries(e)){let e=t[o],c=Tn(s.source,n?.projectRoot);e?s.sourceIsFallback||re(c,e.source)?a.push(o):i.push({name:o,declaredSource:c,materializedSource:e.source}):r.push(o)}return{missing:r,sourceChanged:i,upToDate:a}}async function wn(e){let t=Ie();if(Object.keys(t).length===0)return{installed:[],updated:[],failed:[],upToDate:[],skipped:[]};let n;try{n=await Me()}catch(e){j(e),n={}}let r=Cn(t,n,{projectRoot:x()}),i=[...r.missing.map(e=>({name:e,source:Tn(t[e].source),action:`install`})),...r.sourceChanged.map(({name:e,declaredSource:t})=>({name:e,source:t,action:`update`}))],a=[],o=[];for(let t of i){if(e?.skip?.(t.name,t.source)){a.push(t.name);continue}if(t.action===`update`&&ie(t.source)&&!await ae(t.source.path)){D(`[reconcile] '${t.name}' declared path does not exist; keeping materialized entry`),a.push(t.name);continue}o.push(t)}if(o.length===0)return{installed:[],updated:[],failed:[],upToDate:r.upToDate,skipped:a};D(`[reconcile] ${o.length} marketplace(s): ${o.map(e=>`${e.name}(${e.action})`).join(`, `)}`);let s=[],c=[],l=[];for(let t=0;t<o.length;t++){let{name:n,source:r,action:i}=o[t];e?.onProgress?.({type:`installing`,name:n,action:i,index:t+1,total:o.length});try{let t=await Ae(r);i===`install`?s.push(n):c.push(n),e?.onProgress?.({type:`installed`,name:n,alreadyMaterialized:t.alreadyMaterialized})}catch(t){let r=le(t);l.push({name:n,error:r}),e?.onProgress?.({type:`failed`,name:n,error:r}),j(t)}}return{installed:s,updated:c,failed:l,upToDate:r.upToDate,skipped:a}}function Tn(e,t){if((e.source===`directory`||e.source===`file`)&&!xt(e.path)){let n=t??x(),r=be(n);return{...e,path:Ct(r??n,e.path)}}return e}function K(e){return St(e??S(),kn)}async function En(e){let t;try{t=await Tt(K(e),`utf8`)}catch{return}let n=An().safeParse(we(t,!1));return n.success?n.data:void 0}async function Dn(e,t){let n=K(t),r=T(e);try{return await H(n,r,{flag:`wx`}),!0}catch(e){let t=ue(e);if(t===`EEXIST`)return!1;if(t===`ENOENT`){await wt(bt(n),{recursive:!0});try{return await H(n,r,{flag:`wx`}),!0}catch(e){if(ue(e)===`EEXIST`)return!1;throw e}}throw e}}function q(e){Y?.(),Y=fe(async()=>{await J(e)})}async function On(e){let t=e?.dir,n=e?.lockIdentity??v(),r={sessionId:n,pid:process.pid,acquiredAt:Date.now()};if(await Dn(r,t))return X=void 0,q(e),D(`[ScheduledTasks] acquired scheduler lock (PID ${process.pid})`),!0;let i=await En(t);return i?.sessionId===n?(i.pid!==process.pid&&(await H(K(t),T(r)),q(e)),!0):i&&Te(i.pid)?(X!==i.sessionId&&(X=i.sessionId,D(`[ScheduledTasks] scheduler lock held by session ${i.sessionId} (PID ${i.pid})`)),!1):(i&&D(`[ScheduledTasks] recovering stale scheduler lock from PID ${i.pid}`),await Et(K(t)).catch(()=>{}),await Dn(r,t)?(X=void 0,q(e),!0):!1)}async function J(e){Y?.(),Y=void 0,X=void 0;let t=e?.dir,n=e?.lockIdentity??v(),r=await En(t);if(!(!r||r.sessionId!==n))try{await Et(K(t)),D(`[ScheduledTasks] released scheduler lock`)}catch{}}var kn,An,Y,X,jn=e((()=>{_(),y(),O(),E(),Ee(),Ce(),N(),k(),kn=St(`.claude`,`scheduled_tasks.lock`),An=M(()=>m({sessionId:a(),pid:i(),acquiredAt:i()}))})),Mn=t({buildMissedTaskNotification:()=>Fn,createCronScheduler:()=>Pn,isRecurringTaskAged:()=>Nn});function Nn(e,t,n){return n===0?!1:!!(e.recurring&&!e.permanent&&t-e.createdAt>=n)}function Pn(e){let{onFire:t,isLoading:n,assistantMode:r=!1,onFireTask:i,onMissed:a,dir:o,lockIdentity:s,getJitterConfig:c,isKilled:l,filter:u}=e,d=o||s?{dir:o,lockIdentity:s}:void 0,f=[],p=new Map,m=new Set,h=new Set,g=null,_=null,v=null,y=null,x=!1,S=!1;async function C(e){let n=await pt(o);if(x||(f=n,!e))return;let r=ut(n,Date.now()).filter(e=>!e.recurring&&!m.has(e.id)&&(!u||u(e)));if(r.length>0){for(let e of r)m.add(e.id),p.set(e.id,1/0);A(`tengu_scheduled_task_missed`,{count:r.length,taskIds:r.map(e=>e.id).join(`,`)}),a?a(r):t(Fn(r)),ct(r.map(e=>e.id),o).catch(e=>D(`[ScheduledTasks] failed to remove missed tasks: ${e}`)),D(`[ScheduledTasks] surfaced ${r.length} missed one-shot task(s)`)}}function re(){if(l?.()||n()&&!r)return;let e=Date.now(),a=new Set,s=[],d=c?.()??B;function m(n,r){if(u&&!u(n)||(a.add(n.id),h.has(n.id)))return;let c=p.get(n.id);if(c===void 0&&(c=n.recurring?st(n.cron,n.lastFiredAt??n.createdAt,n.id,d)??1/0:lt(n.cron,n.createdAt,n.id,d)??1/0,p.set(n.id,c),D(`[ScheduledTasks] scheduled ${n.id} for ${c===1/0?`never`:new Date(c).toISOString()}`)),e<c)return;D(`[ScheduledTasks] firing ${n.id}${n.recurring?` (recurring)`:``}`),A(`tengu_scheduled_task_fire`,{recurring:n.recurring??!1,taskId:n.id}),i?i(n):t(n.prompt);let l=Nn(n,e,d.recurringMaxAgeMs);if(l){let t=Math.floor((e-n.createdAt)/1e3/60/60);D(`[ScheduledTasks] recurring task ${n.id} aged out (${t}h since creation), deleting after final fire`),A(`tengu_scheduled_task_expired`,{taskId:n.id,ageHours:t})}if(n.recurring&&!l){let t=st(n.cron,e,n.id,d)??1/0;p.set(n.id,t),r||s.push(n.id)}else r?(ne([n.id]),p.delete(n.id)):(h.add(n.id),ct([n.id],o).catch(e=>D(`[ScheduledTasks] failed to remove task ${n.id}: ${e}`)).finally(()=>h.delete(n.id)),p.delete(n.id))}if(S){for(let e of f)m(e,!1);if(s.length>0){for(let e of s)h.add(e);ft(s,e,o).catch(e=>D(`[ScheduledTasks] failed to persist lastFiredAt: ${e}`)).finally(()=>{for(let e of s)h.delete(e)})}}if(o===void 0)for(let e of ee())m(e,!0);if(a.size===0){p.clear();return}for(let e of p.keys())a.has(e)||p.delete(e)}async function w(){if(x)return;g&&(clearInterval(g),g=null);let{default:e}=await import(`./chokidar-BcI3rIKm.js`);if(x)return;if(S=await On(d).catch(()=>!1),x){S&&(S=!1,J(d));return}S||(v=setInterval(()=>{On(d).then(e=>{if(x){e&&J(d);return}e&&(S=!0,v&&(clearInterval(v),v=null))}).catch(e=>D(String(e),{level:`error`}))},Q),v.unref?.()),C(!0);let t=mt(o);y=e.watch(t,{persistent:!1,ignoreInitial:!0,awaitWriteFinish:{stabilityThreshold:In},ignorePermissionErrors:!0}),y.on(`add`,()=>void C(!1)),y.on(`change`,()=>void C(!1)),y.on(`unlink`,()=>{x||(f=[],p.clear())}),_=setInterval(re,Z),_.unref?.()}return{start(){if(x=!1,o!==void 0){D(`[ScheduledTasks] scheduler start() — dir=${o}, hasTasks=${z(o)}`),w();return}if(D(`[ScheduledTasks] scheduler start() — enabled=${b()}, hasTasks=${z()}`),!b()&&(r||z())&&te(!0),b()){w();return}g=setInterval(e=>{b()&&e()},Z,w),g.unref?.()},stop(){x=!0,g&&(clearInterval(g),g=null),_&&(clearInterval(_),_=null),v&&(clearInterval(v),v=null),y?.close(),y=null,S&&(S=!1,J(d))},getNextFireTime(){let e=1/0;for(let t of p.values())t<e&&(e=t);return e===1/0?null:e}}}function Fn(e){let t=e.length>1;return`${`The following one-shot scheduled task${t?`s were`:` was`} missed while Claude was not running. ${t?`They have`:`It has`} already been removed from .claude/scheduled_tasks.json.\n\nDo NOT execute ${t?`these prompts`:`this prompt`} yet. First use the AskUserQuestion tool to ask whether to run ${t?`each one`:`it`} now. Only execute if the user confirms.`}\n\n${e.map(e=>{let t=`[${ht(e.cron)}, created ${new Date(e.createdAt).toLocaleString()}]`,n=(e.prompt.match(/`+/g)??[]).reduce((e,t)=>Math.max(e,t.length),0),r="`".repeat(Math.max(3,n+1));return`${t}\n${r}\n${e.prompt}\n${r}`}).join(`
5
+
6
+ `)}`}var Z,In,Q,Ln=e((()=>{y(),gt(),dt(),jn(),O(),Z=1e3,In=300,Q=5e3})),Rn=t({getCronJitterConfig:()=>zn});function zn(){let e=se(`tengu_kairos_cron_config`,B,Bn),t=Hn().safeParse(e);return t.success?t.data:B}var Bn,$,Vn,Hn,Un=e((()=>{_(),dt(),N(),Bn=60*1e3,$=1800*1e3,Vn=720*60*60*1e3,Hn=M(()=>m({recurringFrac:i().min(0).max(1),recurringCapMs:i().int().min(0).max($),oneShotMaxMs:i().int().min(0).max($),oneShotFloorMs:i().int().min(0).max($),oneShotMinuteMod:i().int().min(1).max(60),recurringMaxAgeMs:i().int().min(0).max(Vn).default(B.recurringMaxAgeMs)}).refine(e=>e.oneShotFloorMs<=e.oneShotMaxMs))}));export{Mn as a,wn as c,_n as d,fn as f,Pn as i,bn as l,G as m,zn as n,Ln as o,W as p,Un as r,Cn as s,Rn as t,pn as u};
@@ -0,0 +1,40 @@
1
+ import{n as e,o as t}from"./chunk-DR8-3Aex.js";import{n,t as r}from"./figures-gfT9mM8P.js";import{Cn as i,F as a,In as o,Ln as s,Mn as c,Rn as l,T as u,Ut as d,_ as f,b as p,g as m,h,l as ee,m as te,t as g,tt as _,x as v,xt as y}from"./src-Di342QoJ.js";import{t as b}from"./jsx-runtime-D-D469L8.js";import{Ct as ne,cn as x,ot as re}from"./state-sIHsFpDu.js";import{Mr as ie,Pr as ae}from"./paths-1ngPRtu3.js";import{T as S,d as C,s as w,w as T}from"./debug-UI3T040K.js";import{n as oe,r as E}from"./analytics-DqMQntaB.js";import{i as se,v as ce}from"./git-CN3qtTb_.js";import{a as le,o as D,s as ue}from"./log-CzsijfHZ.js";import{b as O,x as de}from"./teammate-DMYOtLTK.js";import{E as k,g as fe,p as pe,x as A}from"./startupProfiler-DnXZaX4A.js";import{Ar as me,Ax as he,Fx as ge,Gu as _e,Hy as ve,Ix as ye,Mi as be,Mr as xe,Ni as Se,Pr as Ce,Ur as we,Vy as Te,XS as j,ZS as Ee,_i as De,f_ as Oe,gr as ke,gy as Ae,kx as je,p_ as Me,qu as Ne,vy as Pe,wr as M,zw as Fe}from"./loadAgentsDir-D7kapZB5.js";import{i as N,r as P}from"./shellQuote-DgjT8KBA.js";import{t as Ie}from"./useKeybinding-FsOnjW6T.js";import{l as Le,u as Re}from"./referral-BKeCKnOJ.js";import{t as ze}from"./SearchBox-DfOmUoaI.js";import{n as Be,t as Ve}from"./useSearchInput-CF77X2OV.js";import{n as He,t as F}from"./Messages-wyMyMP7U.js";import{n as Ue,t as We}from"./fuse-Ch_OAlm3.js";import{sep as I}from"path";function Ge({log:e,onExit:t,onSelect:n}){let[r,i]=L.useState(null);L.useEffect(()=>{i(null),Ce(e)&&we(e).then(i)},[e]);let a=Ce(e)&&r===null,o=r??e,s=M(o)||``,c=_e();return _(`confirm:no`,t,{context:`Confirmation`}),_(`confirm:yes`,(0,L.useCallback)(()=>{n(r??e)},[n,r,e]),{context:`Confirmation`}),a?(0,R.jsxs)(v,{flexDirection:`column`,padding:1,children:[(0,R.jsx)(ee,{message:`Loading session…`}),(0,R.jsx)(p,{dimColor:!0,children:(0,R.jsx)(h,{children:(0,R.jsx)(j,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})})})]}):(0,R.jsxs)(v,{flexDirection:`column`,children:[(0,R.jsx)(F,{messages:o.messages,tools:c,commands:[],verbose:!0,toolJSX:null,toolUseConfirmQueue:[],inProgressToolUseIDs:new Set,isMessageSelectorVisible:!1,conversationId:s,screen:`transcript`,streamingToolUses:[],showAllInTranscript:!0,isLoading:!1}),(0,R.jsxs)(v,{flexShrink:0,flexDirection:`column`,borderTopDimColor:!0,borderBottom:!1,borderLeft:!1,borderRight:!1,borderStyle:`single`,paddingLeft:2,children:[(0,R.jsxs)(p,{children:[fe(o.modified),` · `,o.messageCount,` messages`,o.gitBranch?` · ${o.gitBranch}`:``]}),(0,R.jsx)(p,{dimColor:!0,children:(0,R.jsxs)(h,{children:[(0,R.jsx)(m,{shortcut:`Enter`,action:`resume`}),(0,R.jsx)(j,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})]})})]})]})}var L,R,z=e((()=>{L=t(l(),1),g(),Ie(),Ne(),A(),me(),Ee(),He(),R=b()}));function Ke(e,t){if(e===V)return 3+H;let n=i(e),r=t?Math.min(n,t-H-U):n;return Math.max(0,r)+H+U}function qe(e,t){let n=t-H-U;return i(e)<=n?e:n<=1?e.charAt(0):k(e,n)}function Je({tabs:e,selectedIndex:t,availableWidth:n,showAllProjects:r=!1}){let i=r?`Resume (All Projects)`:`Resume`,a=i.length+1,o=Math.max(W,G),s=n-a-o-2,c=Math.max(0,Math.min(t,e.length-1)),l=Math.max(20,Math.floor(s/2)),u=e.map(e=>Ke(e,l)),d=0,f=e.length;if(u.reduce((e,t,n)=>e+t+ +(n<u.length-1),0)>s){let t=s-et,n=u[c]??0;for(d=c,f=c+1;d>0||f<e.length;){let r=d>0,i=f<e.length;if(r){let e=(u[d-1]??0)+1;if(n+e<=t){d--,n+=e;continue}}if(i){let e=(u[f]??0)+1;if(n+e<=t){f++,n+=e;continue}}break}}let m=d,h=e.length-f,ee=e.slice(d,f),te=ee.map((e,t)=>d+t);return(0,B.jsxs)(v,{flexDirection:`row`,gap:1,children:[(0,B.jsx)(p,{color:`suggestion`,children:i}),m>0&&(0,B.jsxs)(p,{dimColor:!0,children:[Ye,m]}),ee.map((e,t)=>{let n=te[t]===c,r=e===V?e:`#${qe(e,l-H)}`;return(0,B.jsxs)(p,{backgroundColor:n?`suggestion`:void 0,color:n?`inverseText`:void 0,bold:n,children:[` `,r,` `]},e)}),h>0?(0,B.jsxs)(p,{dimColor:!0,children:[Xe,h,Ze]}):(0,B.jsx)(p,{dimColor:!0,children:Qe})]})}var B,V,H,U,Ye,Xe,Ze,Qe,$e,et,W,G,tt=e((()=>{l(),g(),A(),B=b(),V=`All`,H=2,U=1,Ye=`← `,Xe=`→`,Ze=` (tab to cycle)`,Qe=`(tab to cycle)`,$e=2,et=2+$e+1,W=1+$e+15,G=14}));function nt({nodes:e,onSelect:t,onCancel:n,onFocus:r,focusNodeId:i,visibleOptionCount:a,layout:o=`expanded`,isDisabled:s=!1,hideIndexes:c=!1,isNodeExpanded:l,onExpand:u,onCollapse:d,getParentPrefix:f,getChildPrefix:p,onUpFromFirstItem:m}){let[h,ee]=K.useState(new Set),te=K.useRef(!1),g=K.useRef(null),_=K.useCallback(e=>l?l(e):h.has(e),[l,h]),y=K.useMemo(()=>{let t=[];function n(e,r,i){let a=!!e.children&&e.children.length>0,o=_(e.id);if(t.push({node:e,depth:r,isExpanded:o,hasChildren:a,parentId:i}),a&&o&&e.children)for(let t of e.children)n(t,r+1,e.id)}for(let t of e)n(t,0);return t},[e,_]),b=K.useCallback(e=>e?`▼ `:`▶ `,[]),ne=K.useCallback(e=>` ▸ `,[]),x=f??b,re=p??ne,ie=K.useCallback(e=>{let t=``;return e.hasChildren?t=x(e.isExpanded):e.depth>0&&(t=re(e.depth)),t+e.node.label},[x,re]),ae=K.useMemo(()=>y.map(e=>({label:ie(e),description:e.node.description,dimDescription:e.node.dimDescription??!0,value:e.node.id})),[y,ie]),S=K.useMemo(()=>{let e=new Map;return y.forEach(t=>e.set(t.node.id,t.node)),e},[y]),C=K.useCallback(e=>y.find(t=>t.node.id===e),[y]),w=K.useCallback((e,t)=>{let n=C(e);!n||!n.hasChildren||(t?u?u(e):ee(t=>new Set(t).add(e)):d?d(e):ee(t=>{let n=new Set(t);return n.delete(e),n}))},[C,u,d]);return(0,rt.jsx)(v,{tabIndex:0,autoFocus:!0,onKeyDown:e=>{if(!i||s)return;let t=C(i);if(t){if(e.key===`right`&&t.hasChildren)e.preventDefault(),w(i,!0);else if(e.key===`left`){if(t.hasChildren&&t.isExpanded)e.preventDefault(),w(i,!1);else if(t.parentId!==void 0&&(e.preventDefault(),te.current=!0,w(t.parentId,!1),r)){let e=S.get(t.parentId);e&&r(e)}}}},children:(0,rt.jsx)(je,{options:ae,onChange:K.useCallback(e=>{let n=S.get(e);n&&t(n)},[S,t]),onFocus:K.useCallback(e=>{if(te.current){te.current=!1;return}if(g.current!==e&&(g.current=e,r)){let t=S.get(e);t&&r(t)}},[r,S]),onCancel:n,defaultFocusValue:i,visibleOptionCount:a,layout:o,isDisabled:s,hideIndexes:c,onUpFromFirstItem:m})})}var K,rt,it=e((()=>{K=t(l(),1),g(),he(),rt=b()}));function at(e,t){return k(e.replace(/\s+/g,` `).trim(),t)}function ot({before:e,match:t,after:n},r){return o.dim(e)+r(t)+o.dim(n)}function st(e,t,n){let r=e.toLowerCase().indexOf(t.toLowerCase());if(r===-1)return null;let i=r+t.length,a=Math.max(0,r-n),o=Math.min(e.length,i+n),s=e.slice(a,r),c=e.slice(r,i),l=e.slice(i,o);return{before:(a>0?`…`:``)+s.replace(/\s+/g,` `).trimStart(),match:c.trim(),after:l.replace(/\s+/g,` `).trimEnd()+(o<e.length?`…`:``)}}function ct(e,t,n){let{isGroupHeader:r=!1,isChild:i=!1,forkCount:a=0}=n||{},o=r&&a>0?ht:i?Y:0,s=r&&a>0?` (+${a} other ${a===1?`session`:`sessions`})`:``,c=e.isSidechain?` (sidechain)`:``,l=t-o-c.length-s.length;return`${at(le(e),l)}${c}${s}`}function lt(e,t){let{isChild:n=!1,showProjectPath:r=!1}=t||{},i=n?` `:``,a=pe(e),o=r&&e.projectPath?` · ${e.projectPath}`:``;return i+a+o}function ut({logs:e,maxHeight:t=1/0,forceWidth:n,onCancel:i,onSelect:o,onLogsChanged:s,onLoadMore:l,initialSearchQuery:ee,showAllProjects:g=!1,onToggleAllProjects:b,onAgenticSearch:x}){let ie=a(),ae=n===void 0?ie.columns:n,S=Re(i),C=d(),w=xe(),T=process.env.USER_TYPE===`ant`,[oe]=u(),ce=Te(oe),D=q.useMemo(()=>e=>c(e,ce.warning),[ce.warning]),ue=process.env.USER_TYPE===`ant`,[O,de]=q.useState(null),[k,fe]=q.useState(!1),[A,me]=q.useState(!1),[he,_e]=q.useState(!1),ve=q.useMemo(()=>re(),[]),[ye,Se]=q.useState(``),[Ce,we]=q.useState(0),[Ee,Oe]=q.useState(new Set),[Me,Ne]=q.useState(null),[Pe,Fe]=q.useState(1),[N,P]=q.useState(`list`),[Ie,Le]=q.useState(null),ze=q.useRef(null),[Ve,He]=q.useState(0),[F,Ue]=q.useState({status:`idle`}),[I,L]=q.useState(!1),R=q.useRef(null),{query:z,setQuery:Ke,cursorOffset:qe}=Be({isActive:N===`search`&&F.status!==`searching`,onExit:()=>{P(`list`),E(`tengu_session_search_toggled`,{enabled:!1})},onExitUp:()=>{P(`list`),E(`tengu_session_search_toggled`,{enabled:!1})},passthroughCtrlKeys:[`n`],initialQuery:ee||``}),B=q.useDeferredValue(z),[V,H]=q.useState(``);q.useEffect(()=>{if(!B){H(``);return}let e=setTimeout(H,300,B);return()=>clearTimeout(e)},[B]);let[U,Ye]=q.useState(null),[Xe,Ze]=q.useState(!1);q.useEffect(()=>{se().then(e=>de(e)),be(ve).then(e=>{_e(e.length>1)})},[ve]);let Qe=q.useMemo(()=>new Map(e.map(e=>[e,ft(e)])),[e]),$e=q.useMemo(()=>T?new We(e.map(e=>({log:e,searchableText:Qe.get(e)??``})).filter(e=>e.searchableText),{keys:[`searchableText`],threshold:gt,ignoreLocation:!0,includeScore:!0}):null,[e,Qe,T]),et=q.useMemo(()=>mt(e),[e]),W=et.length>0,G=q.useMemo(()=>W?[`All`,...et]:[],[W,et]),tt=G.length>0&&Ve<G.length?Ve:0,K=G[tt],rt=K===`All`?void 0:K,it=+!!W,ut=q.useMemo(()=>{let t=e;return w&&(t=e.filter(e=>{let t=ne(),n=M(e);return!!(t&&n===t||e.customTitle||ke(e.messages)||e.firstPrompt||e.customTitle)})),rt!==void 0&&(t=t.filter(e=>e.tag===rt)),k&&O&&(t=t.filter(e=>e.gitBranch===O)),he&&!A&&(t=t.filter(e=>e.projectPath===ve)),t},[e,w,rt,k,O,he,A,ve]),dt=q.useMemo(()=>{if(!z)return ut;let e=z.toLowerCase();return ut.filter(t=>{let n=le(t).toLowerCase(),r=(t.gitBranch||``).toLowerCase(),i=(t.tag||``).toLowerCase(),a=t.prNumber?`pr #${t.prNumber} ${t.prRepository||``}`.toLowerCase():``;return n.includes(e)||r.includes(e)||i.includes(e)||a.includes(e)})},[ut,z]);q.useEffect(()=>{T&&B&&B!==V&&Ze(!0)},[B,V,T]),q.useEffect(()=>{if(!T||!V||!$e){Ye(null),Ze(!1);return}let e=setTimeout((e,t,n,r)=>{let i=e.search(t);i.sort((e,t)=>{let n=new Date(e.item.log.modified).getTime(),r=new Date(t.item.log.modified).getTime()-n;return Math.abs(r)>_t?r:(e.score??1)-(t.score??1)}),n({results:i.map(e=>({log:e.item.log,score:e.score,searchableText:e.item.searchableText})),query:t}),r(!1)},0,$e,V,Ye,Ze);return()=>{clearTimeout(e)}},[V,$e,T]);let{filteredLogs:ht,snippets:Y}=q.useMemo(()=>{let e=new Map,t=dt;if(U&&V&&U.query===V){for(let t of U.results)if(t.searchableText){let n=st(t.searchableText,V,vt);n&&e.set(t.log,n)}let n=new Set(t.map(e=>e.messages[0]?.uuid)),r=U.results.map(e=>e.log).filter(e=>!n.has(e.messages[0]?.uuid));t=[...t,...r]}return{filteredLogs:t,snippets:e}},[dt,U,V]),X=q.useMemo(()=>F.status===`results`&&F.results.length>0?F.results:ht,[F,ht]),Z=Math.max(30,ae-4),Q=q.useMemo(()=>{if(!w)return[];let e=pt(X);return Array.from(e.entries()).map(([e,t])=>{let n=t[0],r=X.indexOf(n),i=Y.get(n),a=i?ot(i,D):null;if(t.length===1){let t=lt(n,{showProjectPath:g});return{id:`log:${e}:0`,value:{log:n,indexInFiltered:r},label:ct(n,Z),description:a?`${t}\n ${a}`:t,dimDescription:!0}}let o=t.length-1,s=t.slice(1).map((t,n)=>{let r=X.indexOf(t),i=Y.get(t),a=i?ot(i,D):null,o=lt(t,{isChild:!0,showProjectPath:g});return{id:`log:${e}:${n+1}`,value:{log:t,indexInFiltered:r},label:ct(t,Z,{isChild:!0}),description:a?`${o}\n ${a}`:o,dimDescription:!0}}),c=lt(n,{showProjectPath:g});return{id:`group:${e}`,value:{log:n,indexInFiltered:r},label:ct(n,Z,{isGroupHeader:!0,forkCount:o}),description:a?`${c}\n ${a}`:c,dimDescription:!0,children:s}})},[w,X,Z,g,Y,D]),yt=q.useMemo(()=>w?[]:X.map((e,t)=>{let n=at(le(e)+(e.isSidechain?` (sidechain)`:``),Z),r=pe(e),i=g&&e.projectPath?` · ${e.projectPath}`:``,a=Y.get(e),o=a?ot(a,D):null;return{label:n,description:o?`${r}${i}\n ${o}`:r+i,dimDescription:!0,value:t.toString()}}),[w,X,D,Z,g,Y]),$=Me?.value.log??null,bt=()=>{if(!w||!$)return``;let e=M($);if(!e)return``;let t=X.filter(t=>M(t)===e);if(!(t.length>1))return``;let n=Ee.has(e);return t.indexOf($)>0||n?`← to collapse`:`→ to expand`},xt=q.useCallback(async()=>{let e=$?M($):void 0;if(!$||!e){P(`list`),Se(``);return}ye.trim()&&(await De(e,ye.trim(),$.fullPath),w&&s&&s()),P(`list`),Se(``)},[$,ye,s,w]),St=q.useCallback(()=>{P(`list`),E(`tengu_session_search_toggled`,{enabled:!1})},[]),Ct=q.useCallback(()=>{P(`search`),E(`tengu_session_search_toggled`,{enabled:!0})},[]),wt=q.useCallback(async()=>{if(!z.trim()||!x||!ue)return;R.current?.abort();let t=new AbortController;R.current=t,Ue({status:`searching`}),E(`tengu_agentic_search_started`,{query_length:z.length});try{let n=await x(z,e,t.signal);if(t.signal.aborted)return;Ue({status:`results`,results:n,query:z}),E(`tengu_agentic_search_completed`,{query_length:z.length,results_count:n.length})}catch(e){if(t.signal.aborted)return;Ue({status:`error`,message:e instanceof Error?e.message:`Search failed`}),E(`tengu_agentic_search_error`,{query_length:z.length})}},[z,x,ue,e]);q.useEffect(()=>{F.status!==`idle`&&F.status!==`searching`&&(F.status===`results`&&F.query!==z||F.status===`error`)&&Ue({status:`idle`})},[z,F]),q.useEffect(()=>()=>{R.current?.abort()},[]);let Tt=q.useRef(F.status);q.useEffect(()=>{let e=Tt.current;if(Tt.current=F.status,e===`searching`&&F.status===`results`){if(w&&Q.length>0)Ne(Q[0]);else if(!w&&X.length>0){let e=X[0];Ne({id:`0`,value:{log:e,indexInFiltered:0},label:``})}}},[F.status,w,Q,X]);let Et=q.useCallback(e=>{let t=parseInt(e,10),n=X[t];!n||ze.current===t.toString()||(ze.current=t.toString(),Ne({id:t.toString(),value:{log:n,indexInFiltered:t},label:``}),Fe(t+1))},[X]),Dt=q.useCallback(e=>{Ne(e);let t=X.findIndex(t=>M(t)===M(e.value.log));t>=0&&Fe(t+1)},[X]);_(`confirm:no`,()=>{R.current?.abort(),Ue({status:`idle`}),E(`tengu_agentic_search_cancelled`,{})},{context:`Confirmation`,isActive:N!==`preview`&&F.status===`searching`}),_(`confirm:no`,()=>{P(`list`),Se(``)},{context:`Settings`,isActive:N===`rename`&&F.status!==`searching`}),_(`confirm:no`,()=>{Ke(``),L(!1),i?.()},{context:`Confirmation`,isActive:N!==`preview`&&N!==`rename`&&N!==`search`&&I&&F.status!==`searching`}),y((e,t)=>{if(N!==`preview`&&F.status!==`searching`&&N!==`rename`)if(N===`search`)e.toLowerCase()===`n`&&t.ctrl?St():(t.return||t.downArrow)&&z.trim()&&x&&ue&&F.status!==`results`&&L(!0);else{if(I){if(t.return){wt(),L(!1);return}else if(t.downArrow){L(!1);return}else if(t.upArrow){P(`search`),L(!1);return}}if(W&&t.tab){let e=t.shift?-1:1;He(t=>{let n=((t<G.length?t:0)+G.length+e)%G.length,r=G[n];return E(`tengu_session_tag_filter_changed`,{is_all:r===`All`,tag_count:et.length}),n});return}let n=!t.ctrl&&!t.meta,r=e.toLowerCase();if(r===`a`&&t.ctrl&&b)b(),E(`tengu_session_all_projects_toggled`,{enabled:!g});else if(r===`b`&&t.ctrl){let e=!k;fe(e),E(`tengu_session_branch_filter_toggled`,{enabled:e})}else if(r===`w`&&t.ctrl&&he){let e=!A;me(e),E(`tengu_session_worktree_filter_toggled`,{enabled:e})}else r===`/`&&n?(P(`search`),E(`tengu_session_search_toggled`,{enabled:!0})):r===`r`&&t.ctrl&&$?(P(`rename`),Se(``),E(`tengu_session_rename_started`,{})):r===`v`&&t.ctrl&&$?(Le($),P(`preview`),E(`tengu_session_preview_opened`,{messageCount:$.messageCount})):$&&n&&e.length>0&&!/^\s+$/.test(e)&&(P(`search`),Ke(e),E(`tengu_session_search_toggled`,{enabled:!0}))}},{isActive:!0});let Ot=[];k&&O&&Ot.push(O),he&&!A&&Ot.push(`current worktree`);let kt=8+ +(Ot.length>0&&N!==`search`)+it,At=Math.max(1,Math.floor((t-kt-2)/3));return q.useEffect(()=>{l&&Pe+At*2>=X.length&&l(At*3)},[Pe,At,X.length,l]),e.length===0?null:N===`preview`&&Ie&&w?(0,J.jsx)(Ge,{log:Ie,onExit:()=>{P(`list`),Le(null)},onSelect:o}):(0,J.jsxs)(v,{flexDirection:`column`,height:t-1,children:[(0,J.jsx)(v,{flexShrink:0,children:(0,J.jsx)(te,{color:`suggestion`})}),(0,J.jsx)(v,{flexShrink:0,children:(0,J.jsx)(p,{children:` `})}),W?(0,J.jsx)(Je,{tabs:G,selectedIndex:tt,availableWidth:ae,showAllProjects:g}):(0,J.jsx)(v,{flexShrink:0,children:(0,J.jsxs)(p,{bold:!0,color:`suggestion`,children:[`Resume Session`,N===`list`&&X.length>At&&(0,J.jsxs)(p,{dimColor:!0,children:[` `,`(`,Pe,` of `,X.length,`)`]})]})}),(0,J.jsx)(f,{query:z,isFocused:N===`search`,isTerminalFocused:C,cursorOffset:qe}),Ot.length>0&&N!==`search`&&(0,J.jsx)(v,{flexShrink:0,paddingLeft:2,children:(0,J.jsx)(p,{dimColor:!0,children:(0,J.jsx)(h,{children:Ot})})}),(0,J.jsx)(v,{flexShrink:0,children:(0,J.jsx)(p,{children:` `})}),F.status===`searching`&&(0,J.jsxs)(v,{paddingLeft:1,flexShrink:0,children:[(0,J.jsx)(Ae,{}),(0,J.jsx)(p,{children:` Searching…`})]}),F.status===`results`&&F.results.length>0&&(0,J.jsx)(v,{paddingLeft:1,marginBottom:1,flexShrink:0,children:(0,J.jsx)(p,{dimColor:!0,italic:!0,children:`Claude found these results:`})}),F.status===`results`&&F.results.length===0&&ht.length===0&&(0,J.jsx)(v,{paddingLeft:1,marginBottom:1,flexShrink:0,children:(0,J.jsx)(p,{dimColor:!0,italic:!0,children:`No matching sessions found.`})}),F.status===`error`&&ht.length===0&&(0,J.jsx)(v,{paddingLeft:1,marginBottom:1,flexShrink:0,children:(0,J.jsx)(p,{dimColor:!0,italic:!0,children:`No matching sessions found.`})}),!!z.trim()&&x&&ue&&F.status!==`searching`&&F.status!==`results`&&F.status!==`error`&&(0,J.jsxs)(v,{flexShrink:0,flexDirection:`column`,children:[(0,J.jsxs)(v,{flexDirection:`row`,gap:1,children:[(0,J.jsx)(p,{color:I?`suggestion`:void 0,children:I?r.pointer:` `}),(0,J.jsx)(p,{color:I?`suggestion`:void 0,bold:I,children:`Search deeply using Claude →`})]}),(0,J.jsx)(v,{height:1})]}),F.status===`searching`?null:N===`rename`&&$?(0,J.jsxs)(v,{paddingLeft:2,flexDirection:`column`,children:[(0,J.jsx)(p,{bold:!0,children:`Rename session:`}),(0,J.jsx)(v,{paddingTop:1,children:(0,J.jsx)(ge,{value:ye,onChange:Se,onSubmit:xt,placeholder:le($,`Enter new session name`),columns:ae,cursorOffset:Ce,onChangeCursorOffset:we,showCursor:!0})})]}):w?(0,J.jsx)(nt,{nodes:Q,onSelect:e=>{o(e.value.log)},onFocus:Dt,onCancel:i,focusNodeId:Me?.id,visibleOptionCount:At,layout:`expanded`,isDisabled:N===`search`||I,hideIndexes:!1,isNodeExpanded:e=>{if(N===`search`||k)return!0;let t=typeof e==`string`&&e.startsWith(`group:`)?e.substring(6):null;return t?Ee.has(t):!1},onExpand:e=>{let t=typeof e==`string`&&e.startsWith(`group:`)?e.substring(6):null;t&&(Oe(e=>new Set(e).add(t)),E(`tengu_session_group_expanded`,{}))},onCollapse:e=>{let t=typeof e==`string`&&e.startsWith(`group:`)?e.substring(6):null;t&&Oe(e=>{let n=new Set(e);return n.delete(t),n})},onUpFromFirstItem:Ct}):(0,J.jsx)(je,{options:yt,onChange:e=>{let t=X[parseInt(e,10)];t&&o(t)},visibleOptionCount:At,onCancel:i,onFocus:Et,defaultFocusValue:Me?.id.toString(),layout:`expanded`,isDisabled:N===`search`||I,onUpFromFirstItem:Ct}),(0,J.jsx)(v,{paddingLeft:2,children:S.pending?(0,J.jsxs)(p,{dimColor:!0,children:[`Press `,S.keyName,` again to exit`]}):N===`rename`?(0,J.jsx)(p,{dimColor:!0,children:(0,J.jsxs)(h,{children:[(0,J.jsx)(m,{shortcut:`Enter`,action:`save`}),(0,J.jsx)(j,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})]})}):F.status===`searching`?(0,J.jsx)(p,{dimColor:!0,children:(0,J.jsxs)(h,{children:[(0,J.jsx)(p,{children:`Searching with Claude…`}),(0,J.jsx)(j,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})]})}):I?(0,J.jsx)(p,{dimColor:!0,children:(0,J.jsxs)(h,{children:[(0,J.jsx)(m,{shortcut:`Enter`,action:`search`}),(0,J.jsx)(m,{shortcut:`↓`,action:`skip`}),(0,J.jsx)(j,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})]})}):N===`search`?(0,J.jsx)(p,{dimColor:!0,children:(0,J.jsxs)(h,{children:[(0,J.jsx)(p,{children:Xe&&T?`Searching…`:`Type to Search`}),(0,J.jsx)(m,{shortcut:`Enter`,action:`select`}),(0,J.jsx)(j,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`clear`})]})}):(0,J.jsx)(p,{dimColor:!0,children:(0,J.jsxs)(h,{children:[b&&(0,J.jsx)(m,{shortcut:`Ctrl+A`,action:`show ${g?`current dir`:`all projects`}`}),O&&(0,J.jsx)(m,{shortcut:`Ctrl+B`,action:`toggle branch`}),he&&(0,J.jsx)(m,{shortcut:`Ctrl+W`,action:`show ${A?`current worktree`:`all worktrees`}`}),(0,J.jsx)(m,{shortcut:`Ctrl+V`,action:`preview`}),(0,J.jsx)(m,{shortcut:`Ctrl+R`,action:`rename`}),(0,J.jsx)(p,{children:`Type to search`}),(0,J.jsx)(j,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`}),bt()&&(0,J.jsx)(p,{children:bt()})]})})})]})}function dt(e){if(e.type!==`user`&&e.type!==`assistant`)return``;let t=`message`in e?e.message?.content:void 0;return t?typeof t==`string`?t:Array.isArray(t)?t.map(e=>typeof e==`string`?e:`text`in e&&typeof e.text==`string`?e.text:``).filter(Boolean).join(` `):``:``}function ft(e){let t=(e.messages.length<=X?e.messages:[...e.messages.slice(0,Z),...e.messages.slice(-Z)]).map(dt).filter(Boolean).join(` `),n=`${[e.customTitle,e.summary,e.firstPrompt,e.gitBranch,e.tag,e.prNumber?`PR #${e.prNumber}`:void 0,e.prRepository].filter(Boolean).join(` `)} ${t}`.trim();return n.length>Q?n.slice(0,Q):n}function pt(e){let t=new Map;for(let n of e){let e=M(n);if(e){let r=t.get(e);r?r.push(n):t.set(e,[n])}}return t.forEach(e=>e.sort((e,t)=>new Date(t.modified).getTime()-new Date(e.modified).getTime())),t}function mt(e){let t=new Set;for(let n of e)n.tag&&t.add(n.tag);return Array.from(t).sort((e,t)=>e.localeCompare(t))}var q,J,ht,Y,X,Z,Q,gt,_t,vt,yt=e((()=>{s(),n(),Ue(),q=t(l(),1),x(),Le(),Ve(),Fe(),g(),Ie(),oe(),A(),Se(),ce(),D(),me(),ve(),Ee(),he(),ze(),z(),Pe(),tt(),ye(),it(),J=b(),ht=2,Y=4,X=2e3,Z=1e3,Q=5e4,gt=.3,_t=60*1e3,vt=50}));function $(e){if(e.type!==`user`&&e.type!==`assistant`)return``;let t=`message`in e?e.message?.content:void 0;return t?typeof t==`string`?t:Array.isArray(t)?t.map(e=>typeof e==`string`?e:`text`in e&&typeof e.text==`string`?e.text:``).filter(Boolean).join(` `):``:``}function bt(e){if(e.length===0)return``;let t=(e.length<=wt?e:[...e.slice(0,wt/2),...e.slice(-wt/2)]).map($).filter(Boolean).join(` `).replace(/\s+/g,` `).trim();return t.length>Ct?t.slice(0,Ct)+`…`:t}function xt(e,t){return!!(le(e).toLowerCase().includes(t)||e.customTitle?.toLowerCase().includes(t)||e.tag?.toLowerCase().includes(t)||e.gitBranch?.toLowerCase().includes(t)||e.summary?.toLowerCase().includes(t)||e.firstPrompt?.toLowerCase().includes(t)||e.messages&&e.messages.length>0&&bt(e.messages).toLowerCase().includes(t))}async function St(e,t,n){if(!e.trim()||t.length===0)return[];let r=e.toLowerCase(),i=t.filter(e=>xt(e,r)),a;if(i.length>=Tt)a=i.slice(0,Tt);else{let e=t.filter(e=>!xt(e,r)),n=Tt-i.length;a=[...i,...e.slice(0,n)]}C(`Agentic search: ${a.length}/${t.length} logs, query="${e}", matching: ${i.length}, with messages: ${O(a,e=>e.messages?.length>0)}`);let o=a.map(async e=>{if(Ce(e))try{return await we(e)}catch(t){return ue(t),e}return e}),s=await Promise.all(o);C(`Agentic search: loaded ${O(s,e=>e.messages?.length>0)}/${a.length} logs with transcripts`);let c=`Sessions:
2
+ ${s.map((e,t)=>{let n=[`${t}:`],r=le(e);if(n.push(r),e.customTitle&&e.customTitle!==r&&n.push(`[custom title: ${e.customTitle}]`),e.tag&&n.push(`[tag: ${e.tag}]`),e.gitBranch&&n.push(`[branch: ${e.gitBranch}]`),e.summary&&n.push(`- Summary: ${e.summary}`),e.firstPrompt&&e.firstPrompt!==`No prompt`&&n.push(`- First message: ${e.firstPrompt.slice(0,300)}`),e.messages&&e.messages.length>0){let t=bt(e.messages);t&&n.push(`- Transcript: ${t}`)}return n.join(` `)}).join(`
3
+ `)}
4
+
5
+ Search query: "${e}"
6
+
7
+ Find the sessions that are most relevant to this query.`;C(`Agentic search prompt (first 500 chars): ${c.slice(0,500)}...`);try{let e=ie();C(`Agentic search using model: ${e}`);let t=(await Me({model:e,system:Et,messages:[{role:`user`,content:c}],signal:n,querySource:`session_search`})).content.find(e=>e.type===`text`);if(!t||t.type!==`text`)return C(`No text content in agentic search response`),[];C(`Agentic search response: ${t.text}`);let r=t.text.match(/\{[\s\S]*\}/);if(!r)return C(`Could not find JSON in agentic search response`),[];let i=(S(r[0]).relevant_indices||[]).filter(e=>e>=0&&e<s.length).map(e=>s[e]);return C(`Agentic search found ${i.length} relevant sessions`),i}catch(e){return ue(e),C(`Agentic search error: ${e}`),[]}}var Ct,wt,Tt,Et,Dt=e((()=>{de(),w(),D(),ae(),me(),Oe(),T(),Ct=2e3,wt=100,Tt=100,Et=`Your goal is to find relevant sessions based on a user's search query.
8
+
9
+ You will be given a list of sessions with their metadata and a search query. Identify which sessions are most relevant to the query.
10
+
11
+ Each session may include:
12
+ - Title (display name or custom title)
13
+ - Tag (user-assigned category, shown as [tag: name] - users tag sessions with /tag command to categorize them)
14
+ - Branch (git branch name, shown as [branch: name])
15
+ - Summary (AI-generated summary)
16
+ - First message (beginning of the conversation)
17
+ - Transcript (excerpt of conversation content)
18
+
19
+ IMPORTANT: Tags are user-assigned labels that indicate the session's topic or category. If the query matches a tag exactly or partially, those sessions should be highly prioritized.
20
+
21
+ For each session, consider (in order of priority):
22
+ 1. Exact tag matches (highest priority - user explicitly categorized this session)
23
+ 2. Partial tag matches or tag-related terms
24
+ 3. Title matches (custom titles or first message content)
25
+ 4. Branch name matches
26
+ 5. Summary and transcript content matches
27
+ 6. Semantic similarity and related concepts
28
+
29
+ CRITICAL: Be VERY inclusive in your matching. Include sessions that:
30
+ - Contain the query term anywhere in any field
31
+ - Are semantically related to the query (e.g., "testing" matches sessions about "tests", "unit tests", "QA", etc.)
32
+ - Discuss topics that could be related to the query
33
+ - Have transcripts that mention the concept even in passing
34
+
35
+ When in doubt, INCLUDE the session. It's better to return too many results than too few. The user can easily scan through results, but missing relevant sessions is frustrating.
36
+
37
+ Return sessions ordered by relevance (most relevant first). If truly no sessions have ANY connection to the query, return an empty array - but this should be rare.
38
+
39
+ Respond with ONLY the JSON object, no markdown formatting:
40
+ {"relevant_indices": [2, 5, 0]}`}));function Ot(e,t,n){let r=re();if(!t||!e.projectPath||e.projectPath===r)return{isCrossProject:!1};if(process.env.USER_TYPE!==`ant`){let t=M(e);return{isCrossProject:!0,isSameRepoWorktree:!1,command:`cd ${N([e.projectPath])} && claude --resume ${t}`,projectPath:e.projectPath}}if(n.some(t=>e.projectPath===t||e.projectPath.startsWith(t+I)))return{isCrossProject:!0,isSameRepoWorktree:!0,projectPath:e.projectPath};let i=M(e);return{isCrossProject:!0,isSameRepoWorktree:!1,command:`cd ${N([e.projectPath])} && claude --resume ${i}`,projectPath:e.projectPath}}var kt=e((()=>{x(),P(),me()}));export{ut as a,Dt as i,kt as n,yt as o,St as r,Ot as t};
@@ -1 +1 @@
1
- import{n as e}from"./chunk-DR8-3Aex.js";import{n as t,t as n}from"./memoize-DNnuA2aU.js";import{n as r,t as i}from"./axios-DhfaybwJ.js";import{Ac as a,Ec as o,Fa as s,G as c,J as l,Na as u,Pr as d,br as f,ci as p,ct as m,lt as h,ri as g}from"./paths-BBvuDQl9.js";import{o as _,s as v}from"./log-CzsijfHZ.js";import{createHash as y}from"crypto";function b(e){return e.replace(/[A-Z]/g,e=>`_${e.toLowerCase()}`)}async function x(){if(N.length===0)return;let e=N;N=[];try{await r.post(E,e,{headers:{"Content-Type":`application/json`,"DD-API-KEY":D},timeout:A})}catch(e){v(e)}}function S(){P||(P=setTimeout(()=>{P=null,x()},T()).unref())}async function C(){P&&(clearTimeout(P),P=null),await x()}async function w(e,t){if(u()!==`firstParty`)return;let n=F;if(n===null&&(n=await I()),!(!n||!j.has(e)))try{let{envContext:n,...r}=await c({model:t.model,betas:t.betas}),i={...r,...n,...t,userBucket:R()};if(typeof i.toolName==`string`&&i.toolName.startsWith(`mcp__`)&&(i.toolName=`mcp`),process.env.USER_TYPE!==`ant`&&typeof i.model==`string`){let e=f(i.model.replace(/\[1m]$/i,``));i.model=e in g?e:`other`}if(typeof i.version==`string`&&(i.version=i.version.replace(/^(\d+\.\d+\.\d+-dev\.\d{8})\.t\d+\.sha[a-f0-9]+$/,`$1`)),i.status!==void 0&&i.status!==null){let e=String(i.status);i.http_status=e;let t=e.charAt(0);t>=`1`&&t<=`5`&&(i.http_status_range=`${t}xx`),delete i.status}let a=i,o={ddsource:`nodejs`,ddtags:[`event:${e}`,...M.filter(e=>a[e]!==void 0&&a[e]!==null).map(e=>`${b(e)}:${a[e]}`)].join(`,`),message:e,service:`claude-code`,hostname:`claude-code`,env:process.env.USER_TYPE};for(let[e,t]of Object.entries(i))t!=null&&(o[b(e)]=t);N.push(o),N.length>=k?(P&&(clearTimeout(P),P=null),x()):S()}catch(e){v(e)}}function T(){return parseInt(process.env.CLAUDE_CODE_DATADOG_FLUSH_INTERVAL_MS||``,10)||O}var E,D,O,k,A,j,M,N,P,F,I,L,R,z=e((()=>{i(),n(),a(),_(),d(),s(),p(),m(),l(),E=process.env.DATADOG_LOGS_ENDPOINT??``,D=process.env.DATADOG_API_KEY??``,O=15e3,k=100,A=5e3,j=new Set(`chrome_bridge_connection_succeeded.chrome_bridge_connection_failed.chrome_bridge_disconnected.chrome_bridge_tool_call_completed.chrome_bridge_tool_call_error.chrome_bridge_tool_call_started.chrome_bridge_tool_call_timeout.tengu_api_error.tengu_api_success.tengu_brief_mode_enabled.tengu_brief_mode_toggled.tengu_brief_send.tengu_cancel.tengu_compact_failed.tengu_exit.tengu_flicker.tengu_init.tengu_model_fallback_triggered.tengu_oauth_error.tengu_oauth_success.tengu_oauth_token_refresh_failure.tengu_oauth_token_refresh_success.tengu_oauth_token_refresh_lock_acquiring.tengu_oauth_token_refresh_lock_acquired.tengu_oauth_token_refresh_starting.tengu_oauth_token_refresh_completed.tengu_oauth_token_refresh_lock_releasing.tengu_oauth_token_refresh_lock_released.tengu_query_error.tengu_session_file_read.tengu_started.tengu_tool_use_error.tengu_tool_use_granted_in_prompt_permanent.tengu_tool_use_granted_in_prompt_temporary.tengu_tool_use_rejected_in_prompt.tengu_tool_use_success.tengu_uncaught_exception.tengu_unhandled_rejection.tengu_voice_recording_started.tengu_voice_toggled.tengu_team_mem_sync_pull.tengu_team_mem_sync_push.tengu_team_mem_sync_started.tengu_team_mem_entries_capped`.split(`.`)),M=[`arch`,`clientType`,`errorType`,`http_status_range`,`http_status`,`kairosActive`,`model`,`platform`,`provider`,`skillMode`,`subscriptionType`,`toolName`,`userBucket`,`userType`,`version`,`versionBase`],N=[],P=null,F=null,I=t(async()=>{if(h()||!E||!D)return F=!1,!1;try{return F=!0,!0}catch(e){return v(e),F=!1,!1}}),L=30,R=t(()=>{let e=o(),t=y(`sha256`).update(e).digest(`hex`);return parseInt(t.slice(0,8),16)%L})}));export{w as i,I as n,C as r,z as t};
1
+ import{n as e}from"./chunk-DR8-3Aex.js";import{n as t,t as n}from"./memoize-DNnuA2aU.js";import{n as r,t as i}from"./axios-DhfaybwJ.js";import{Ac as a,Ec as o,Fa as s,G as c,J as l,Na as u,Pr as d,br as f,ci as p,ct as m,lt as h,ri as g}from"./paths-1ngPRtu3.js";import{o as _,s as v}from"./log-CzsijfHZ.js";import{createHash as y}from"crypto";function b(e){return e.replace(/[A-Z]/g,e=>`_${e.toLowerCase()}`)}async function x(){if(N.length===0)return;let e=N;N=[];try{await r.post(E,e,{headers:{"Content-Type":`application/json`,"DD-API-KEY":D},timeout:A})}catch(e){v(e)}}function S(){P||(P=setTimeout(()=>{P=null,x()},T()).unref())}async function C(){P&&(clearTimeout(P),P=null),await x()}async function w(e,t){if(u()!==`firstParty`)return;let n=F;if(n===null&&(n=await I()),!(!n||!j.has(e)))try{let{envContext:n,...r}=await c({model:t.model,betas:t.betas}),i={...r,...n,...t,userBucket:R()};if(typeof i.toolName==`string`&&i.toolName.startsWith(`mcp__`)&&(i.toolName=`mcp`),process.env.USER_TYPE!==`ant`&&typeof i.model==`string`){let e=f(i.model.replace(/\[1m]$/i,``));i.model=e in g?e:`other`}if(typeof i.version==`string`&&(i.version=i.version.replace(/^(\d+\.\d+\.\d+-dev\.\d{8})\.t\d+\.sha[a-f0-9]+$/,`$1`)),i.status!==void 0&&i.status!==null){let e=String(i.status);i.http_status=e;let t=e.charAt(0);t>=`1`&&t<=`5`&&(i.http_status_range=`${t}xx`),delete i.status}let a=i,o={ddsource:`nodejs`,ddtags:[`event:${e}`,...M.filter(e=>a[e]!==void 0&&a[e]!==null).map(e=>`${b(e)}:${a[e]}`)].join(`,`),message:e,service:`claude-code`,hostname:`claude-code`,env:process.env.USER_TYPE};for(let[e,t]of Object.entries(i))t!=null&&(o[b(e)]=t);N.push(o),N.length>=k?(P&&(clearTimeout(P),P=null),x()):S()}catch(e){v(e)}}function T(){return parseInt(process.env.CLAUDE_CODE_DATADOG_FLUSH_INTERVAL_MS||``,10)||O}var E,D,O,k,A,j,M,N,P,F,I,L,R,z=e((()=>{i(),n(),a(),_(),d(),s(),p(),m(),l(),E=process.env.DATADOG_LOGS_ENDPOINT??``,D=process.env.DATADOG_API_KEY??``,O=15e3,k=100,A=5e3,j=new Set(`chrome_bridge_connection_succeeded.chrome_bridge_connection_failed.chrome_bridge_disconnected.chrome_bridge_tool_call_completed.chrome_bridge_tool_call_error.chrome_bridge_tool_call_started.chrome_bridge_tool_call_timeout.tengu_api_error.tengu_api_success.tengu_brief_mode_enabled.tengu_brief_mode_toggled.tengu_brief_send.tengu_cancel.tengu_compact_failed.tengu_exit.tengu_flicker.tengu_init.tengu_model_fallback_triggered.tengu_oauth_error.tengu_oauth_success.tengu_oauth_token_refresh_failure.tengu_oauth_token_refresh_success.tengu_oauth_token_refresh_lock_acquiring.tengu_oauth_token_refresh_lock_acquired.tengu_oauth_token_refresh_starting.tengu_oauth_token_refresh_completed.tengu_oauth_token_refresh_lock_releasing.tengu_oauth_token_refresh_lock_released.tengu_query_error.tengu_session_file_read.tengu_started.tengu_tool_use_error.tengu_tool_use_granted_in_prompt_permanent.tengu_tool_use_granted_in_prompt_temporary.tengu_tool_use_rejected_in_prompt.tengu_tool_use_success.tengu_uncaught_exception.tengu_unhandled_rejection.tengu_voice_recording_started.tengu_voice_toggled.tengu_team_mem_sync_pull.tengu_team_mem_sync_push.tengu_team_mem_sync_started.tengu_team_mem_entries_capped`.split(`.`)),M=[`arch`,`clientType`,`errorType`,`http_status_range`,`http_status`,`kairosActive`,`model`,`platform`,`provider`,`skillMode`,`subscriptionType`,`toolName`,`userBucket`,`userType`,`version`,`versionBase`],N=[],P=null,F=null,I=t(async()=>{if(h()||!E||!D)return F=!1,!1;try{return F=!0,!0}catch(e){return v(e),F=!1,!1}}),L=30,R=t(()=>{let e=o(),t=y(`sha256`).update(e).digest(`hex`);return parseInt(t.slice(0,8),16)%L})}));export{w as i,I as n,C as r,z as t};
@@ -0,0 +1 @@
1
+ import{r as e,t}from"./datadog-BK8eJz8B.js";t();export{e as shutdownDatadog};
@@ -1 +1 @@
1
- import{n as e}from"./chunk-DR8-3Aex.js";import{Rn as t}from"./src-Di342QoJ.js";import{t as n}from"./jsx-runtime-D-D469L8.js";import{n as r,t as i}from"./DesktopHandoff-S-w4bs5T.js";async function a(e){return(0,o.jsx)(i,{onDone:e})}var o;e((()=>{t(),r(),o=n()}))();export{a as call};
1
+ import{n as e}from"./chunk-DR8-3Aex.js";import{Rn as t}from"./src-Di342QoJ.js";import{t as n}from"./jsx-runtime-D-D469L8.js";import{n as r,t as i}from"./DesktopHandoff-CFBUqcCf.js";async function a(e){return(0,o.jsx)(i,{onDone:e})}var o;e((()=>{t(),r(),o=n()}))();export{a as call};
@@ -1 +1 @@
1
- import{n as e}from"./chunk-DR8-3Aex.js";import{t}from"./jsx-runtime-D-D469L8.js";var n,r;e((()=>{n=t(),r=async(e,t)=>{let{DiffDialog:r}=await import(`./DiffDialog-BhQ2QaLW.js`);return(0,n.jsx)(r,{messages:t.messages,onDone:e})}}))();export{r as call};
1
+ import{n as e}from"./chunk-DR8-3Aex.js";import{t}from"./jsx-runtime-D-D469L8.js";var n,r;e((()=>{n=t(),r=async(e,t)=>{let{DiffDialog:r}=await import(`./DiffDialog-CY-8kw_Q.js`);return(0,n.jsx)(r,{messages:t.messages,onDone:e})}}))();export{r as call};
@@ -1 +1 @@
1
- import{n as e}from"./chunk-DR8-3Aex.js";import{t}from"./jsx-runtime-D-D469L8.js";import{n,t as r}from"./Doctor-BXb0qv6n.js";var i,a;e((()=>{n(),i=t(),a=(e,t,n)=>Promise.resolve((0,i.jsx)(r,{onDone:e}))}))();export{a as call};
1
+ import{n as e}from"./chunk-DR8-3Aex.js";import{t}from"./jsx-runtime-D-D469L8.js";import{n,t as r}from"./Doctor-CDez_u_U.js";var i,a;e((()=>{n(),i=t(),a=(e,t,n)=>Promise.resolve((0,i.jsx)(r,{onDone:e}))}))();export{a as call};
@@ -1,4 +1,4 @@
1
- import{n as e,o as t}from"./chunk-DR8-3Aex.js";import{Rn as n}from"./src-Di342QoJ.js";import{t as r}from"./jsx-runtime-D-D469L8.js";import{lo as i,oo as a}from"./paths-BBvuDQl9.js";import{n as o,r as s}from"./analytics-DqMQntaB.js";import{GA as c,JA as l,KA as u,MS as d,PS as f,QA as p,ZA as m,aj as h,jS as g}from"./loadAgentsDir-DI1a76pd.js";import{n as _,t as v}from"./useMainLoopModel-CwvuTRXn.js";function y(e){let t=h(e);if(t!==void 0){let e=i(`userSettings`,{effortLevel:t});if(e.error)return{message:`Failed to set effort level: ${e.error.message}`}}s(`tengu_effort_command`,{effort:e});let n=u();if(n!==void 0&&n!==e){let n=process.env.CLAUDE_CODE_EFFORT_LEVEL;return t===void 0?{message:`Not applied: CLAUDE_CODE_EFFORT_LEVEL=${n} overrides effort this session, and ${e} is session-only (nothing saved)`,effortUpdate:{value:e}}:{message:`CLAUDE_CODE_EFFORT_LEVEL=${n} overrides this session — clear it and ${e} takes over`,effortUpdate:{value:e}}}let r=l(e);return{message:`Set effort level to ${e}${t===void 0?` (this session only)`:``}: ${r}`,effortUpdate:{value:e}}}function b(e,t){let n=u(),r=n===null?void 0:n??e;return r===void 0?{message:`Effort level: auto (currently ${c(t,e)})`}:{message:`Current effort level: ${r} (${l(r)})`}}function x(){let e=i(`userSettings`,{effortLevel:void 0});return e.error?{message:`Failed to set effort level: ${e.error.message}`}:(s(`tengu_effort_command`,{effort:`auto`}),u()==null?{message:`Effort level set to auto`,effortUpdate:{value:void 0}}:{message:`Cleared effort from settings, but CLAUDE_CODE_EFFORT_LEVEL=${process.env.CLAUDE_CODE_EFFORT_LEVEL} still controls this session`,effortUpdate:{value:void 0}})}function S(e){let t=e.toLowerCase();return t===`auto`||t===`unset`?x():p(t)?y(t):{message:`Invalid argument: ${e}. Valid options are: low, medium, high, max, auto`}}function C({onDone:e}){let{message:t}=b(d(e=>e.effortValue),_());return e(t),null}function w({result:e,onDone:t}){let n=f(),{effortUpdate:r,message:i}=e;return E.useEffect(()=>{r&&n(e=>({...e,effortValue:r.value})),t(i)},[n,r,i,t]),null}async function T(e,t,n){if(n=n?.trim()||``,O.includes(n)){e(`Usage: /effort [low|medium|high|xhigh|max|auto]
1
+ import{n as e,o as t}from"./chunk-DR8-3Aex.js";import{Rn as n}from"./src-Di342QoJ.js";import{t as r}from"./jsx-runtime-D-D469L8.js";import{lo as i,oo as a}from"./paths-1ngPRtu3.js";import{n as o,r as s}from"./analytics-DqMQntaB.js";import{$A as c,IS as l,JA as u,NS as d,PS as f,XA as p,ej as m,qA as h,sj as g}from"./loadAgentsDir-D7kapZB5.js";import{n as _,t as v}from"./useMainLoopModel-Os8Ao8-x.js";function y(e){let t=g(e);if(t!==void 0){let e=i(`userSettings`,{effortLevel:t});if(e.error)return{message:`Failed to set effort level: ${e.error.message}`}}s(`tengu_effort_command`,{effort:e});let n=u();if(n!==void 0&&n!==e){let n=process.env.CLAUDE_CODE_EFFORT_LEVEL;return t===void 0?{message:`Not applied: CLAUDE_CODE_EFFORT_LEVEL=${n} overrides effort this session, and ${e} is session-only (nothing saved)`,effortUpdate:{value:e}}:{message:`CLAUDE_CODE_EFFORT_LEVEL=${n} overrides this session — clear it and ${e} takes over`,effortUpdate:{value:e}}}let r=p(e);return{message:`Set effort level to ${e}${t===void 0?` (this session only)`:``}: ${r}`,effortUpdate:{value:e}}}function b(e,t){let n=u(),r=n===null?void 0:n??e;return r===void 0?{message:`Effort level: auto (currently ${h(t,e)})`}:{message:`Current effort level: ${r} (${p(r)})`}}function x(){let e=i(`userSettings`,{effortLevel:void 0});return e.error?{message:`Failed to set effort level: ${e.error.message}`}:(s(`tengu_effort_command`,{effort:`auto`}),u()==null?{message:`Effort level set to auto`,effortUpdate:{value:void 0}}:{message:`Cleared effort from settings, but CLAUDE_CODE_EFFORT_LEVEL=${process.env.CLAUDE_CODE_EFFORT_LEVEL} still controls this session`,effortUpdate:{value:void 0}})}function S(e){let t=e.toLowerCase();return t===`auto`||t===`unset`?x():m(t)?y(t):{message:`Invalid argument: ${e}. Valid options are: low, medium, high, max, auto`}}function C({onDone:e}){let{message:t}=b(f(e=>e.effortValue),_());return e(t),null}function w({result:e,onDone:t}){let n=l(),{effortUpdate:r,message:i}=e;return E.useEffect(()=>{r&&n(e=>({...e,effortValue:r.value})),t(i)},[n,r,i,t]),null}async function T(e,t,n){if(n=n?.trim()||``,O.includes(n)){e(`Usage: /effort [low|medium|high|xhigh|max|auto]
2
2
 
3
3
  Effort levels:
4
4
  - low: Quick, straightforward implementation
@@ -6,4 +6,4 @@ Effort levels:
6
6
  - high: Comprehensive implementation with extensive testing
7
7
  - xhigh: Extended reasoning beyond high, short of max; including ChatGPT Codex models
8
8
  - max: Maximum capability with deepest reasoning; maps to xhigh for ChatGPT Codex models
9
- - auto: Use the default effort level for your model`);return}return!n||n===`current`||n===`status`?(0,D.jsx)(C,{onDone:e}):(0,D.jsx)(w,{result:S(n),onDone:e})}var E,D,O;e((()=>{E=t(n(),1),v(),o(),g(),m(),a(),D=r(),O=[`help`,`-h`,`--help`]}))();export{T as call,S as executeEffort,b as showCurrentEffort};
9
+ - auto: Use the default effort level for your model`);return}return!n||n===`current`||n===`status`?(0,D.jsx)(C,{onDone:e}):(0,D.jsx)(w,{result:S(n),onDone:e})}var E,D,O;e((()=>{E=t(n(),1),v(),o(),d(),c(),a(),D=r(),O=[`help`,`-h`,`--help`]}))();export{T as call,S as executeEffort,b as showCurrentEffort};