claude-code-best 2.6.0 → 2.6.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (391) hide show
  1. package/dist/chunks/{AddWorkspaceDirectory-Cj5bvJgD.js → AddWorkspaceDirectory-BYyM_V0q.js} +1 -1
  2. package/dist/chunks/{App-2tgSv9lb.js → App-BboadKdn.js} +1 -1
  3. package/dist/chunks/{ApproveApiKey-DWa-XTLb.js → ApproveApiKey-BLp4742y.js} +1 -1
  4. package/dist/chunks/ApproveApiKey-DiEe4eui.js +1 -0
  5. package/dist/chunks/{AssistantSessionChooser-DF9eeJZS.js → AssistantSessionChooser-B88DM0Oq.js} +1 -1
  6. package/dist/chunks/{BackgroundTasksDialog-DXJdube9.js → BackgroundTasksDialog-ByraVuXh.js} +1 -1
  7. package/dist/chunks/{BypassPermissionsModeDialog-BOSW4Zdy.js → BypassPermissionsModeDialog-BDvmz12S.js} +1 -1
  8. package/dist/chunks/{ClaudeInChromeOnboarding-BW4XHmkw.js → ClaudeInChromeOnboarding-B6XNhFqq.js} +1 -1
  9. package/dist/chunks/ClaudeMdExternalIncludesDialog-B4ocUjev.js +1 -0
  10. package/dist/chunks/{ClaudeMdExternalIncludesDialog-Bz0JyaOG.js → ClaudeMdExternalIncludesDialog-BNhlq7_K.js} +1 -1
  11. package/dist/chunks/ConsoleOAuthFlow-BvaB9b0y.js +1 -0
  12. package/dist/chunks/{DesktopHandoff-CcsM_OAS.js → DesktopHandoff-S-w4bs5T.js} +1 -1
  13. package/dist/chunks/{DevChannelsDialog-DXRgY00D.js → DevChannelsDialog-BljR0X9X.js} +1 -1
  14. package/dist/chunks/{DiffDialog-PvNZfZby.js → DiffDialog-BhQ2QaLW.js} +1 -1
  15. package/dist/chunks/{Doctor-CE_jL9jC.js → Doctor-BXb0qv6n.js} +1 -1
  16. package/dist/chunks/Doctor-C5DYPEGl.js +1 -0
  17. package/dist/chunks/{ExitFlow-C4ybxKPn.js → ExitFlow-CSBDxw9H.js} +1 -1
  18. package/dist/chunks/{Feedback-B5rPGl_C.js → Feedback-DwHzc4UT.js} +1 -1
  19. package/dist/chunks/{Grove-CKVpREDU.js → Grove-DSXRnXKv.js} +1 -1
  20. package/dist/chunks/Grove-DnTo982-.js +1 -0
  21. package/dist/chunks/{HybridTransport-Byjvz-DL.js → HybridTransport-CuT3KI5e.js} +1 -1
  22. package/dist/chunks/{ITermBackend-Co9XpeS4.js → ITermBackend-mokGZVH_.js} +1 -1
  23. package/dist/chunks/{InvalidConfigDialog-CNsqbNU3.js → InvalidConfigDialog-Bi4RKYlk.js} +1 -1
  24. package/dist/chunks/{InvalidSettingsDialog-ClnZaN6b.js → InvalidSettingsDialog-0zKo4-so.js} +1 -1
  25. package/dist/chunks/{MCPConnectionManager-CDsa79pu.js → MCPConnectionManager-DYGoS1Ht.js} +1 -1
  26. package/dist/chunks/{McpParsingWarnings-DZkzoeZf.js → McpParsingWarnings-EzgsOoHw.js} +1 -1
  27. package/dist/chunks/{MessageSelector-CkeGQPNM.js → MessageSelector-DTmUuEKJ.js} +1 -1
  28. package/dist/chunks/{Messages-PfbzLYOU.js → Messages-DWiKTx5o.js} +2 -2
  29. package/dist/chunks/{Onboarding-BwoGQB4g.js → Onboarding-odmthwzz.js} +1 -1
  30. package/dist/chunks/{OverageCreditUpsell-Q5g2YjQw.js → OverageCreditUpsell-Cpk_5Lv0.js} +1 -1
  31. package/dist/chunks/{PluginSettings-B2ASJ0Rx.js → PluginSettings-eYcWehI8.js} +1 -1
  32. package/dist/chunks/{PromptInputFooterSuggestions-D4lMVCqj.js → PromptInputFooterSuggestions-DrrkNOuS.js} +1 -1
  33. package/dist/chunks/{PromptInputHelpMenu-BvLtS6an.js → PromptInputHelpMenu-DMsF4D6d.js} +1 -1
  34. package/dist/chunks/{QueryEngine-Av0G5fze.js → QueryEngine-C_KZts4y.js} +1 -1
  35. package/dist/chunks/REPL-C6YR0VKU.js +1 -0
  36. package/dist/chunks/{REPL-Dh8vzGmF.js → REPL-DzHz-LOY.js} +6 -6
  37. package/dist/chunks/{RemoteCallout-BV_hoz98.js → RemoteCallout-CnpCWRPk.js} +1 -1
  38. package/dist/chunks/{RemoteSessionManager-Cxoy1ud2.js → RemoteSessionManager-OWg_Yccq.js} +1 -1
  39. package/dist/chunks/{ResumeConversation-B3WuB8rs.js → ResumeConversation-BktSnsCm.js} +1 -1
  40. package/dist/chunks/{SSETransport-pIm26VJq.js → SSETransport-BpnapvlK.js} +1 -1
  41. package/dist/chunks/SearchExtraToolsTool-CqFD8vVS.js +1 -0
  42. package/dist/chunks/SentryErrorBoundary-BUirJRWU.js +1 -0
  43. package/dist/chunks/{SentryErrorBoundary-B6EWoJml.js → SentryErrorBoundary-C-NlfQZw.js} +1 -1
  44. package/dist/chunks/{Settings-CreAhCsb.js → Settings-vfFvcweR.js} +2 -2
  45. package/dist/chunks/{TeleportProgress-DPzGpyyM.js → TeleportProgress-CYXay2ZL.js} +1 -1
  46. package/dist/chunks/{TeleportRepoMismatchDialog-DqWQX6j8.js → TeleportRepoMismatchDialog-_zbZTvcJ.js} +1 -1
  47. package/dist/chunks/{TeleportResumeWrapper-DPSO0S49.js → TeleportResumeWrapper-DiHQeZIM.js} +1 -1
  48. package/dist/chunks/{ThemePicker-DueihHcy.js → ThemePicker-BRh027fA.js} +1 -1
  49. package/dist/chunks/{TmuxBackend-BNaZNAeP.js → TmuxBackend-BaX2U7iZ.js} +1 -1
  50. package/dist/chunks/{TrustDialog-CIzAlGn9.js → TrustDialog-CVbzrv6g.js} +1 -1
  51. package/dist/chunks/{ValidationErrorsList-1k1qbsRo.js → ValidationErrorsList-CdCUgfIl.js} +1 -1
  52. package/dist/chunks/{WelcomeV2-CR6TtXXM.js → WelcomeV2-DCXcYd2x.js} +1 -1
  53. package/dist/chunks/{WindowsTerminalBackend-C5SeTXqC.js → WindowsTerminalBackend-BE9NX5IH.js} +1 -1
  54. package/dist/chunks/{add-dir-DAMizKzF.js → add-dir-ldGd3Ppz.js} +1 -1
  55. package/dist/chunks/{agentDisplay-B9z7i8b_.js → agentDisplay-CVnAeURF.js} +1 -1
  56. package/dist/chunks/{agents-DCh_gEvJ.js → agents-C08NzRZx.js} +1 -1
  57. package/dist/chunks/{agents-D5u0p1UC.js → agents-DH5fmbVw.js} +1 -1
  58. package/dist/chunks/{ant-DRJq-cEg.js → ant-DJren1Aa.js} +1 -1
  59. package/dist/chunks/api-6tcwJlf_.js +1 -0
  60. package/dist/chunks/{api-B6URs6nc.js → api-CGOR_Xfl.js} +1 -1
  61. package/dist/chunks/{assistant-BRGDWkKB.js → assistant-BlzrMSkM.js} +1 -1
  62. package/dist/chunks/assistant-CwbhlCM-.js +1 -0
  63. package/dist/chunks/{assistant-tPxOUa-Z.js → assistant-aWkDcurV.js} +1 -1
  64. package/dist/chunks/{auth-CqURlg4d.js → auth-CSB2RDKF.js} +1 -1
  65. package/dist/chunks/auth-GxZhOvQ1.js +1 -0
  66. package/dist/chunks/{autoMode-DVt4K4I2.js → autoMode-CWvZs1jO.js} +1 -1
  67. package/dist/chunks/{autonomy-Ffv0QIyl.js → autonomy-BkVcSMCZ.js} +1 -1
  68. package/dist/chunks/{autonomy-BZzW8QJZ.js → autonomy-DK42aJYt.js} +1 -1
  69. package/dist/chunks/{autonomyPanel-MwuzDvv_.js → autonomyPanel-Cn4IhXgE.js} +1 -1
  70. package/dist/chunks/{backgroundHousekeeping-CYnAG60-.js → backgroundHousekeeping-BIZTAYho.js} +2 -2
  71. package/dist/chunks/backgroundHousekeeping-Csh58CxV.js +1 -0
  72. package/dist/chunks/{branch-DXefFdDE.js → branch-juox_fko.js} +1 -1
  73. package/dist/chunks/{bridge-qr4GQW_c.js → bridge-DudsCZkh.js} +2 -2
  74. package/dist/chunks/bridgeConfig-D4tpc568.js +1 -0
  75. package/dist/chunks/{bridgeConfig-CJ-KznTS.js → bridgeConfig-lRZfQqmA.js} +1 -1
  76. package/dist/chunks/bridgeEnabled-B8_c_Ppq.js +1 -0
  77. package/dist/chunks/{bridgeEnabled-5vsPrjuq.js → bridgeEnabled-D2IykaHE.js} +1 -1
  78. package/dist/chunks/{bridgeMain-BimZwc2P.js → bridgeMain-C5RDihlX.js} +6 -6
  79. package/dist/chunks/bridgeMain-D7_lg2iJ.js +1 -0
  80. package/dist/chunks/{bridgeMessaging-BiE0CTqq.js → bridgeMessaging-CqNURC4-.js} +1 -1
  81. package/dist/chunks/{btw-FpimqEqk.js → btw-DKlE3Dea.js} +1 -1
  82. package/dist/chunks/{buddy-BA3Cr067.js → buddy-DQYgHR63.js} +1 -1
  83. package/dist/chunks/{bypassPermissionsKillswitch-CSC9p8mO.js → bypassPermissionsKillswitch-Bof-UtM-.js} +1 -1
  84. package/dist/chunks/{caches-BUBkfP2Q.js → caches-B5QZDncQ.js} +2 -2
  85. package/dist/chunks/caches-dGk7xsDu.js +1 -0
  86. package/dist/chunks/{ccrClient-BOxUn9EJ.js → ccrClient-BaWg4E9-.js} +1 -1
  87. package/dist/chunks/changeDetector-DoLfg8a6.js +1 -0
  88. package/dist/chunks/{channelNotification-l3EXKDNB.js → channelNotification-B7A-9DIl.js} +1 -1
  89. package/dist/chunks/channelNotification-DDErroWn.js +1 -0
  90. package/dist/chunks/{chrome-BnKyWWQL.js → chrome-jMAks7-w.js} +1 -1
  91. package/dist/chunks/clear-OudnCGa7.js +1 -0
  92. package/dist/chunks/client-DxDmXXTh.js +1 -0
  93. package/dist/chunks/{color-D5MCzz9h.js → color-DG_R5-hl.js} +1 -1
  94. package/dist/chunks/commands-BWIOEBPs.js +1 -0
  95. package/dist/chunks/commitAttribution-BA4fcbHf.js +1 -0
  96. package/dist/chunks/{commitAttribution-BFshsh2H.js → commitAttribution-C22a3OCi.js} +1 -1
  97. package/dist/chunks/{compact-DWNaf1wR.js → compact-BWvnb4or.js} +1 -1
  98. package/dist/chunks/{companion-CyK_Dr1U.js → companion-Bkn2lSLj.js} +1 -1
  99. package/dist/chunks/{config-DNz6Eitr.js → config-BvpTbJ5p.js} +1 -1
  100. package/dist/chunks/{config-BdCuh6eA.js → config-D-dzD6n-.js} +1 -1
  101. package/dist/chunks/{context-BOjdTj0i.js → context-DzNahdyP.js} +1 -1
  102. package/dist/chunks/context-noninteractive-CM1-lUSe.js +1 -0
  103. package/dist/chunks/{context-noninteractive-k2ibficU.js → context-noninteractive-yiyJriiw.js} +1 -1
  104. package/dist/chunks/{conversation-Ci8O_eZ-.js → conversation-DKlz47xf.js} +1 -1
  105. package/dist/chunks/conversation-cUxdb8MN.js +1 -0
  106. package/dist/chunks/{copy-B0VUJ2rH.js → copy-9k9JPRqW.js} +1 -1
  107. package/dist/chunks/{createSSHSession-DqmkCS_k.js → createSSHSession-BZf-Loo5.js} +1 -1
  108. package/dist/chunks/createSession-BuJcoBAj.js +1 -0
  109. package/dist/chunks/{createSession-CJEsHz58.js → createSession-kiTHYXSL.js} +1 -1
  110. package/dist/chunks/{cronJitterConfig-BzPaa52I.js → cronJitterConfig-CYP7yrQu.js} +1 -1
  111. package/dist/chunks/{crossProjectResume-tWsqBUHc.js → crossProjectResume-BJisir9Z.js} +1 -1
  112. package/dist/chunks/{datadog-Bd1s_VFj.js → datadog-Bg-zL-i7.js} +1 -1
  113. package/dist/chunks/datadog-CVeFkaQu.js +1 -0
  114. package/dist/chunks/{desktop-BDowrzvG.js → desktop-DpaStjc-.js} +1 -1
  115. package/dist/chunks/{diff-auU5sUOw.js → diff-N_VSBo3Z.js} +1 -1
  116. package/dist/chunks/{doctor-bKPp6AeL.js → doctor-CUWjbh1X.js} +1 -1
  117. package/dist/chunks/{effort-BQj2QnnA.js → effort-loH1TUvE.js} +3 -3
  118. package/dist/chunks/{entry-CUu6-QhT.js → entry-D58E-E6Y.js} +1 -1
  119. package/dist/chunks/envLessBridgeConfig-CT8sdmFu.js +1 -0
  120. package/dist/chunks/{envLessBridgeConfig-Ju4W58xf.js → envLessBridgeConfig-SPEr9oqO.js} +1 -1
  121. package/dist/chunks/{exit-DijkO8eo.js → exit-D-tuPpbx.js} +1 -1
  122. package/dist/chunks/{export-DA-bBZkX.js → export-BIZ_SPXJ.js} +1 -1
  123. package/dist/chunks/{exportRenderer-3y4tGdSB.js → exportRenderer-CWPSMaqM.js} +1 -1
  124. package/dist/chunks/{extra-usage-CS6VwKJt.js → extra-usage-CCMwIa85.js} +1 -1
  125. package/dist/chunks/{extra-usage-core-DOgT4u4i.js → extra-usage-core-BNW4VT7o.js} +1 -1
  126. package/dist/chunks/{extra-usage-noninteractive-DYnfiRlV.js → extra-usage-noninteractive-B_WjXO1E.js} +1 -1
  127. package/dist/chunks/extra-usage-rdJ7ecEb.js +1 -0
  128. package/dist/chunks/{extraUsage-CfxgfpX_.js → extraUsage-CNMMTNJi.js} +1 -1
  129. package/dist/chunks/extractMemories-BrvZVsmM.js +1 -0
  130. package/dist/chunks/{fast-CzRUJBTK.js → fast-CG1v3fRr.js} +1 -1
  131. package/dist/chunks/fast-CLKKsx2H.js +1 -0
  132. package/dist/chunks/{feedback-FoXtdHAV.js → feedback-CG4mS_-B.js} +1 -1
  133. package/dist/chunks/{firstPartyEventLogger-KIwaBY-E.js → firstPartyEventLogger-Y_jAnHoR.js} +1 -1
  134. package/dist/chunks/{flushGate-C2Icy43G.js → flushGate-COPcye5f.js} +1 -1
  135. package/dist/chunks/gates-CSHuXnUx.js +1 -0
  136. package/dist/chunks/{gates-CbQLZHtm.js → gates-CSKxLmMJ.js} +1 -1
  137. package/dist/chunks/{gemini-BrNJGX4k.js → gemini-B3uSLiNp.js} +1 -1
  138. package/dist/chunks/{generateRecap-B0fvSCjo.js → generateRecap-D7rG3jIm.js} +1 -1
  139. package/dist/chunks/{generateSessionName-DvRYa39O.js → generateSessionName-zbqanivg.js} +1 -1
  140. package/dist/chunks/{githubRepoPathMapping-Dut3d6nn.js → githubRepoPathMapping-B04nEUDG.js} +1 -1
  141. package/dist/chunks/{grok-Ftoheab3.js → grok-CDOpos8E.js} +1 -1
  142. package/dist/chunks/{growthbook-BynnuVTn.js → growthbook-C_EY78Sn.js} +1 -1
  143. package/dist/chunks/{heapdump-hQ_w0LPC.js → heapdump-CpmhJ55b.js} +1 -1
  144. package/dist/chunks/{help-DQsHHv6r.js → help-EHn2neTv.js} +1 -1
  145. package/dist/chunks/hooks-BFdX17Za.js +1 -0
  146. package/dist/chunks/{hooks-BhVDc8yb.js → hooks-BV6HqbU4.js} +1 -1
  147. package/dist/chunks/{hostAdapter-D1eWmmhu.js → hostAdapter-_SmFAVNf.js} +1 -1
  148. package/dist/chunks/{ide-CPmMXLL-.js → ide-DkN0KdTR.js} +1 -1
  149. package/dist/chunks/inboundAttachments-BVUunfAX.js +1 -0
  150. package/dist/chunks/{inboundAttachments-Bmf6vYsE.js → inboundAttachments-DnGQw7Pf.js} +1 -1
  151. package/dist/chunks/{initReplBridge-BiHXpDEY.js → initReplBridge-tPRGPBq7.js} +1 -1
  152. package/dist/chunks/{insights-CTlTyvjj.js → insights-Bs9kJDG6.js} +1 -1
  153. package/dist/chunks/{install-IPuD3Lq8.js → install-CFX_ph9z.js} +1 -1
  154. package/dist/chunks/{install-github-app-Bmu_sA9e.js → install-github-app-CvRjY1Wi.js} +1 -1
  155. package/dist/chunks/{install-slack-app-Rfl81Jqo.js → install-slack-app-DjhnVSe0.js} +1 -1
  156. package/dist/chunks/{instrumentation-DWwmOmr0.js → instrumentation-c5zlOWom.js} +3 -3
  157. package/dist/chunks/{job-BXEt0izn.js → job-3QwLq609.js} +1 -1
  158. package/dist/chunks/{keybindings-DRDgVvqz.js → keybindings-7mDm3UKD.js} +1 -1
  159. package/dist/chunks/{lang-D3ZHlfT6.js → lang-DyyjY20G.js} +1 -1
  160. package/dist/chunks/{language-DcSjogBx.js → language-CPRGmY8Q.js} +1 -1
  161. package/dist/chunks/language-Cf6bMI4N.js +1 -0
  162. package/dist/chunks/{launchAgentsPlatform-BPm_VMln.js → launchAgentsPlatform-CpsMsTqQ.js} +1 -1
  163. package/dist/chunks/{launchAutofixPr-D2qac07g.js → launchAutofixPr-D9h6YAZY.js} +1 -1
  164. package/dist/chunks/{launchLocalMemory-D_hBbXKE.js → launchLocalMemory-DlYQcEQJ.js} +1 -1
  165. package/dist/chunks/{launchLocalVault-CPzNWvQ9.js → launchLocalVault-CP0AyPjj.js} +1 -1
  166. package/dist/chunks/{launchMemoryStores-Djq2KhKb.js → launchMemoryStores-BHoDFkJ5.js} +1 -1
  167. package/dist/chunks/{launchOnboarding-Bh6E7vdc.js → launchOnboarding-CFTNXcnc.js} +1 -1
  168. package/dist/chunks/{launchSchedule-C988bQ-5.js → launchSchedule-5KQr6x_A.js} +1 -1
  169. package/dist/chunks/{launchSkillStore-DqrP6Gme.js → launchSkillStore-D0yGuE68.js} +1 -1
  170. package/dist/chunks/{launchTeleport-DFhybaq_.js → launchTeleport-DRKnXOwY.js} +1 -1
  171. package/dist/chunks/{launchVault-p_CSK4ZQ.js → launchVault-XA-zAswX.js} +1 -1
  172. package/dist/chunks/loadAgentsDir-DCyiY0MN.js +1 -0
  173. package/dist/chunks/{loadAgentsDir-Ci5mr0vm.js → loadAgentsDir-DI1a76pd.js} +700 -700
  174. package/dist/chunks/{loadPluginHooks-xYCEZ6t5.js → loadPluginHooks-C0Ei-0E2.js} +1 -1
  175. package/dist/chunks/{localSearch-Vpn6W5aY.js → localSearch-CDOJNc_E.js} +1 -1
  176. package/dist/chunks/localSearch-MBx7KzC2.js +1 -0
  177. package/dist/chunks/login-D8UKKaud.js +1 -0
  178. package/dist/chunks/{login-D9IWjvza.js → login-nwTOoyxv.js} +1 -1
  179. package/dist/chunks/{logoV2Utils-SAulcC5x.js → logoV2Utils-DDUoPClc.js} +1 -1
  180. package/dist/chunks/logout-B0BjqlGi.js +1 -0
  181. package/dist/chunks/{magicDocs-BfoeYhin.js → magicDocs-CmUlOWjI.js} +1 -1
  182. package/dist/chunks/{main-DhMlhVj3.js → main-CeG_nUsC.js} +15 -15
  183. package/dist/chunks/{mappers-uIrAj-Wd.js → mappers-CJ8IO1o1.js} +1 -1
  184. package/dist/chunks/{mcp-DlM0OC6R.js → mcp-CanCqnch.js} +1 -1
  185. package/dist/chunks/{mcp-COQap0SM.js → mcp-Dq0kxZFx.js} +2 -2
  186. package/dist/chunks/{mcp-CAYGNxCb.js → mcp-zbxZM9BP.js} +1 -1
  187. package/dist/chunks/{mcpServer-DXvS3v4x.js → mcpServer-DPHQVYdC.js} +1 -1
  188. package/dist/chunks/{mcpServer-1SnOWb8_.js → mcpServer-lIneUZ5p.js} +1 -1
  189. package/dist/chunks/{memory-XccPLQLt.js → memory-BcWBkKV8.js} +1 -1
  190. package/dist/chunks/{model-CbiDGGJU.js → model-DJLzVvcF.js} +1 -1
  191. package/dist/chunks/model-H3rtl6eR.js +1 -0
  192. package/dist/chunks/{onChangeAppState-Dp0JIXd8.js → onChangeAppState-Dxbl8fvk.js} +1 -1
  193. package/dist/chunks/{openai-6KcHd4Hw.js → openai-DkYK4THc.js} +1 -1
  194. package/dist/chunks/{overageCreditGrant-DYiB4sr-.js → overageCreditGrant-DLKadMYU.js} +1 -1
  195. package/dist/chunks/{passes-Cbc6T_Tj.js → passes-BIfuerjL.js} +1 -1
  196. package/dist/chunks/{paths-Q2255dD7.js → paths-BBvuDQl9.js} +2 -2
  197. package/dist/chunks/{permissions-BLzPHh_3.js → permissions-S2EvIRKj.js} +1 -1
  198. package/dist/chunks/{pipeTransport-D7NIp3aA.js → pipeTransport-DVoIA1uN.js} +1 -1
  199. package/dist/chunks/{plan-DloFVJK7.js → plan--lnWxB3Q.js} +1 -1
  200. package/dist/chunks/{plugin-XR9IBPMM.js → plugin-DWLyrLw4.js} +1 -1
  201. package/dist/chunks/{pluginAutoupdate-Cr9hP0zG.js → pluginAutoupdate-CGXIWBrb.js} +1 -1
  202. package/dist/chunks/{pluginBlocklist-CM9uP8CY.js → pluginBlocklist-DJrMdzT0.js} +1 -1
  203. package/dist/chunks/{pluginCliCommands-BQkrvES5.js → pluginCliCommands-C08q9dHk.js} +1 -1
  204. package/dist/chunks/{pluginFlagging-CJ1--2Kw.js → pluginFlagging-Dggxke70.js} +1 -1
  205. package/dist/chunks/{pluginOperations-B0rLuSvo.js → pluginOperations-CNCImIe8.js} +1 -1
  206. package/dist/chunks/{pluginStartupCheck-Bjdc8zhz.js → pluginStartupCheck-BW2fjg2P.js} +1 -1
  207. package/dist/chunks/pluginStartupCheck-DpxQPXJE.js +1 -0
  208. package/dist/chunks/{plugins-BgOP_8TX.js → plugins-DQ3CRWWO.js} +1 -1
  209. package/dist/chunks/policyLimits-BotYrS-v.js +1 -0
  210. package/dist/chunks/{pollConfig-DhptuhFw.js → pollConfig-DAQ-ives.js} +1 -1
  211. package/dist/chunks/{poor-DF0aqXDx.js → poor-DqfrQT61.js} +1 -1
  212. package/dist/chunks/poorMode-DEAe3hiK.js +1 -0
  213. package/dist/chunks/{poorMode-C5Frra4j.js → poorMode-DzYT47KW.js} +1 -1
  214. package/dist/chunks/{print-CPtR0KTa.js → print-GGVp62vj.js} +4 -4
  215. package/dist/chunks/{privacy-settings-e-7lc7Un.js → privacy-settings-agwqjYJo.js} +1 -1
  216. package/dist/chunks/{processBashCommand-D5dC6Mya.js → processBashCommand-DHHN8Ca4.js} +1 -1
  217. package/dist/chunks/{processSlashCommand-DHRUtZ-C.js → processSlashCommand-COtIO6Jy.js} +1 -1
  218. package/dist/chunks/prompt-CO160cIr.js +1 -0
  219. package/dist/chunks/{prompt-DEPUnJdB.js → prompt-CjFAtm3w.js} +1 -1
  220. package/dist/chunks/prompt-GY9hlRvI.js +1 -0
  221. package/dist/chunks/{promptEditor-Ci-h04-5.js → promptEditor-EgosPsy-.js} +1 -1
  222. package/dist/chunks/{protocolHandler-DhqM32qE.js → protocolHandler-mtPUT9U0.js} +1 -1
  223. package/dist/chunks/{rate-limit-options-B0l29Zx8.js → rate-limit-options-C6SFOHue.js} +1 -1
  224. package/dist/chunks/{rcDebugLog-BbPkkigY.js → rcDebugLog-CPKZCtR8.js} +1 -1
  225. package/dist/chunks/{referral-ByevBJrE.js → referral-DeDr9zAE.js} +1 -1
  226. package/dist/chunks/{refresh-B_CwwIRX.js → refresh-D7pdoY_X.js} +1 -1
  227. package/dist/chunks/{registerProtocol-DzhaQH02.js → registerProtocol-BZBH8Zgl.js} +1 -1
  228. package/dist/chunks/{registry-DkHA4cRu.js → registry-Dz6AbiYP.js} +1 -1
  229. package/dist/chunks/{release-notes-CZthYkei.js → release-notes-DiUNOrg9.js} +1 -1
  230. package/dist/chunks/{releaseNotes-CwKpIsyd.js → releaseNotes-CnhQit0y.js} +2 -2
  231. package/dist/chunks/{reload-plugins-DxWfXvrN.js → reload-plugins-Dx52GcaG.js} +1 -1
  232. package/dist/chunks/{remote-env-BiRLWIrh.js → remote-env-B67Oo3sI.js} +1 -1
  233. package/dist/chunks/{remoteBridgeCore-nz1fPY1U.js → remoteBridgeCore-BzSUgPbt.js} +1 -1
  234. package/dist/chunks/{remoteControlServer-FzLUxh2B.js → remoteControlServer-L8smP7Zu.js} +1 -1
  235. package/dist/chunks/{rename-DmGuyncE.js → rename-C4PauyTZ.js} +1 -1
  236. package/dist/chunks/{resume-7GeU7RMS.js → resume-CrSn26xq.js} +1 -1
  237. package/dist/chunks/{runtimeObserver-OgM9ZYxZ.js → runtimeObserver-YNy3mIb7.js} +1 -1
  238. package/dist/chunks/{runtimeObserver-Duod-ign.js → runtimeObserver-nAhH4Wca.js} +2 -2
  239. package/dist/chunks/sandbox-adapter-CzwHes1i.js +1 -0
  240. package/dist/chunks/{sandbox-toggle-Cc96R6Ox.js → sandbox-toggle-BYqbcI5d.js} +1 -1
  241. package/dist/chunks/searchExtraTools-CcpdCO6l.js +1 -0
  242. package/dist/chunks/{sentry-BUHYuYGj.js → sentry-BNVxoVLS.js} +1 -1
  243. package/dist/chunks/{session-DgLqm7ZI.js → session-BuEmHrqM.js} +1 -1
  244. package/dist/chunks/{sessionDiscovery-DgNea6qa.js → sessionDiscovery-Mcsfa0g-.js} +1 -1
  245. package/dist/chunks/sessionFileAccessHooks-qnNiGMnE.js +1 -0
  246. package/dist/chunks/{sessionMemory-_dmj8lcH.js → sessionMemory-CMahwDdW.js} +1 -1
  247. package/dist/chunks/sessionMemory-pFSn4HSN.js +1 -0
  248. package/dist/chunks/sessionMemoryUtils-Du5jUl7M.js +1 -0
  249. package/dist/chunks/{sessionObserver-CuWMVPlT.js → sessionObserver-DG2zQgfi.js} +1 -1
  250. package/dist/chunks/sessionObserver-Je868MC9.js +1 -0
  251. package/dist/chunks/sessionStorage-D3FhAADV.js +1 -0
  252. package/dist/chunks/{sessionTitle-DzkMzHer.js → sessionTitle-zUVSAHO7.js} +1 -1
  253. package/dist/chunks/{sessionTracing-DTjmc0EF.js → sessionTracing-DoRJ4nSa.js} +1 -1
  254. package/dist/chunks/{settingsSync-CfYDkakY.js → settingsSync-B9bz77E1.js} +1 -1
  255. package/dist/chunks/{setup-BKUG46jQ.js → setup-B1JbPepL.js} +1 -1
  256. package/dist/chunks/{setup-CmLngvpJ.js → setup-CCOLlRtP.js} +1 -1
  257. package/dist/chunks/{setup-TqJ7-Nxh.js → setup-DWkSjA49.js} +2 -2
  258. package/dist/chunks/{shadowedRuleDetection-DesT0yKM.js → shadowedRuleDetection-BBR3uEgx.js} +1 -1
  259. package/dist/chunks/{sideQuestion-BAq0YyKY.js → sideQuestion-DHW5rgKz.js} +1 -1
  260. package/dist/chunks/{sink-B3uP8Cf8.js → sink-DxDOsLa2.js} +1 -1
  261. package/dist/chunks/sink-cQOgsnw3.js +1 -0
  262. package/dist/chunks/{sinks-COcy5GnB.js → sinks-BrrTUxkC.js} +2 -2
  263. package/dist/chunks/sinks-Djiz_5-Z.js +1 -0
  264. package/dist/chunks/{skill-learning-DOIMPtWE.js → skill-learning-C0nOKZfg.js} +1 -1
  265. package/dist/chunks/{skillChangeDetector-CA_Tdx8N.js → skillChangeDetector-D8C-uQSQ.js} +1 -1
  266. package/dist/chunks/{skillGapStore-CWuw1dYh.js → skillGapStore-Czi5jKjJ.js} +1 -1
  267. package/dist/chunks/{skillGapStore-DpEoKhn-.js → skillGapStore-_YuJP5KI.js} +2 -2
  268. package/dist/chunks/{skillGenerator-9y3Q4YoO.js → skillGenerator-kbaRbpqJ.js} +2 -2
  269. package/dist/chunks/skillLearning-3KWrBczS.js +1 -0
  270. package/dist/chunks/skillLearning-DBbdGbk-.js +1 -0
  271. package/dist/chunks/{skillPanel-Dt24mZTZ.js → skillPanel-BxDvlPzd.js} +3 -3
  272. package/dist/chunks/{skillSearchPanel-gaXN64Fu.js → skillSearchPanel-D-MX6Qgt.js} +2 -2
  273. package/dist/chunks/{skills-Dx3dMHYk.js → skills-NpEgFkFZ.js} +1 -1
  274. package/dist/chunks/{sprites-5OAB-Ui2.js → sprites-DD4eIkN7.js} +1 -1
  275. package/dist/chunks/{stats-TUExo9iU.js → stats-xL3NHwhp.js} +1 -1
  276. package/dist/chunks/{status-Dghaz1my.js → status-B5E70xRv.js} +1 -1
  277. package/dist/chunks/{statusNoticeHelpers-DVZSSXeK.js → statusNoticeHelpers-DcssRhLw.js} +1 -1
  278. package/dist/chunks/{tag-ZcVkzFjz.js → tag-BELr-qIa.js} +1 -1
  279. package/dist/chunks/{tasks-DbB33ekt.js → tasks-CrdWcSt-.js} +1 -1
  280. package/dist/chunks/{teamHelpers-BmN9nKz-.js → teamHelpers--3ZyNDlv.js} +1 -1
  281. package/dist/chunks/teamHelpers-CUAiXng3.js +1 -0
  282. package/dist/chunks/teammateModeSnapshot-C6EWhR0X.js +1 -0
  283. package/dist/chunks/{teammateModeSnapshot-CPjJJDL1.js → teammateModeSnapshot-DOQMTKbQ.js} +1 -1
  284. package/dist/chunks/{teleport-JHgpwZIh.js → teleport-LXFOan9C.js} +1 -1
  285. package/dist/chunks/{templateJobs-Db630FZD.js → templateJobs-8IY2Cgig.js} +1 -1
  286. package/dist/chunks/{terminalSetup-ygKHrVKR.js → terminalSetup-C4psrmpb.js} +1 -1
  287. package/dist/chunks/{terminalSetup-DJqWE8fc.js → terminalSetup-Lyg4NbGA.js} +1 -1
  288. package/dist/chunks/{theme-MmfFhdTD.js → theme-B8GNnJ_q.js} +1 -1
  289. package/dist/chunks/{thinkback-CrNirB0V.js → thinkback-DPXwEK3B.js} +1 -1
  290. package/dist/chunks/thinkback-DZW3Mcx_.js +1 -0
  291. package/dist/chunks/{thinkback-play-CQ1s7oqg.js → thinkback-play-BMOE-ceh.js} +1 -1
  292. package/dist/chunks/{toolEventObserver-DBq2XBYY.js → toolEventObserver-D0TSHm01.js} +1 -1
  293. package/dist/chunks/{toolEventObserver-BqMplcIk.js → toolEventObserver-DzLd0MSn.js} +1 -1
  294. package/dist/chunks/toolPool-DVOfpjDz.js +1 -0
  295. package/dist/chunks/{toolPool-BkCtTKXz.js → toolPool-Dq-Vtvrj.js} +1 -1
  296. package/dist/chunks/{trustedDevice-DEuQUTbz.js → trustedDevice-1iTu4LEm.js} +1 -1
  297. package/dist/chunks/{trustedDevice-C9Zevohz.js → trustedDevice-BvYYXfd8.js} +1 -1
  298. package/dist/chunks/{ultrareviewCommand-DrlfRrXq.js → ultrareviewCommand-BTXAN2wP.js} +1 -1
  299. package/dist/chunks/undercover-C_44e3oN.js +1 -0
  300. package/dist/chunks/{undercover-DKn95mh9.js → undercover-DvvnEmsX.js} +1 -1
  301. package/dist/chunks/{updateCCB-CJ7dCUan.js → updateCCB-C-qfLi0j.js} +1 -1
  302. package/dist/chunks/upgrade-CGXa5Dwy.js +1 -0
  303. package/dist/chunks/{upgrade-Degqbu8S.js → upgrade-DTBZSxwv.js} +1 -1
  304. package/dist/chunks/{upload-pTZQCPLt.js → upload-BF8tf_Eo.js} +1 -1
  305. package/dist/chunks/{usage-DVQMUMcC.js → usage-BRYRRgNt.js} +1 -1
  306. package/dist/chunks/{usage-D96a7Cke.js → usage-DvSTXEYY.js} +1 -1
  307. package/dist/chunks/{useMainLoopModel-B7ch2o9K.js → useMainLoopModel-CwvuTRXn.js} +1 -1
  308. package/dist/chunks/{useManagePlugins-BfGzHMvO.js → useManagePlugins-GmnI9K53.js} +1 -1
  309. package/dist/chunks/{useMergedTools-TemEvCrX.js → useMergedTools-Dah5KDMi.js} +1 -1
  310. package/dist/chunks/{useSearchInput-B-V4kIa-.js → useSearchInput-BV_azHiA.js} +1 -1
  311. package/dist/chunks/{useSettingsErrors-B2JGz1s8.js → useSettingsErrors-C-j_Zt7g.js} +1 -1
  312. package/dist/chunks/{useVoice-BuwYDm2U.js → useVoice-DR69NLxp.js} +1 -1
  313. package/dist/chunks/{util-CeIKZmj9.js → util-BpyJ4Bom.js} +1 -1
  314. package/dist/chunks/utils-CrZcpypC.js +1 -0
  315. package/dist/chunks/{validatePlugin-BlVho93x.js → validatePlugin-vptAYuYu.js} +1 -1
  316. package/dist/chunks/{vim-DUZQCWUP.js → vim-DvOw8dfR.js} +1 -1
  317. package/dist/chunks/{voice-BkRIHZiM.js → voice-B3BZs53f.js} +1 -1
  318. package/dist/chunks/{voiceModeEnabled-CPQUE3PU.js → voiceModeEnabled-DA76xN1Q.js} +1 -1
  319. package/dist/chunks/voiceModeEnabled-DIveLYGb.js +1 -0
  320. package/dist/chunks/{voiceStreamSTT-Dr_wH1Kh.js → voiceStreamSTT-_w1VjIOs.js} +1 -1
  321. package/dist/chunks/voiceStreamSTT-hpzWd_zl.js +1 -0
  322. package/dist/chunks/{workerRegistry-CT7_kjvY.js → workerRegistry-2_MZVih1.js} +1 -1
  323. package/dist/chunks/worktree-CCuDwRmS.js +1 -0
  324. package/dist/chunks/{xml-DD_ldd3X.js → xml-Dx--sNE1.js} +1 -1
  325. package/dist/cli.js +1 -1
  326. package/package.json +1 -1
  327. package/dist/chunks/ApproveApiKey-SIUwkD8j.js +0 -1
  328. package/dist/chunks/ClaudeMdExternalIncludesDialog-B8oAAHSI.js +0 -1
  329. package/dist/chunks/ConsoleOAuthFlow-DYhmGSkx.js +0 -1
  330. package/dist/chunks/Doctor--B1HUENo.js +0 -1
  331. package/dist/chunks/Grove-C2YjB3zL.js +0 -1
  332. package/dist/chunks/REPL-DCwqua0C.js +0 -1
  333. package/dist/chunks/SearchExtraToolsTool-D70C-cmA.js +0 -1
  334. package/dist/chunks/SentryErrorBoundary-oJUBarGg.js +0 -1
  335. package/dist/chunks/api-Dz_3z1kl.js +0 -1
  336. package/dist/chunks/assistant-zVegFdAO.js +0 -1
  337. package/dist/chunks/auth-D4isgfuK.js +0 -1
  338. package/dist/chunks/backgroundHousekeeping-DUmxC6h0.js +0 -1
  339. package/dist/chunks/bridgeConfig-CNbOKpAg.js +0 -1
  340. package/dist/chunks/bridgeEnabled-BUJTCUHY.js +0 -1
  341. package/dist/chunks/bridgeMain-DYL4fl6A.js +0 -1
  342. package/dist/chunks/caches-CTfNpKhW.js +0 -1
  343. package/dist/chunks/changeDetector-Y9KV5LgG.js +0 -1
  344. package/dist/chunks/channelNotification-CC7Xb06W.js +0 -1
  345. package/dist/chunks/clear-OUVFUt8Z.js +0 -1
  346. package/dist/chunks/client-B47ZvTMo.js +0 -1
  347. package/dist/chunks/commands-FJGWgQsa.js +0 -1
  348. package/dist/chunks/commitAttribution-DSv9FggK.js +0 -1
  349. package/dist/chunks/context-noninteractive-Bd2HO-vU.js +0 -1
  350. package/dist/chunks/conversation-BP0phkOY.js +0 -1
  351. package/dist/chunks/createSession-B9MhWusY.js +0 -1
  352. package/dist/chunks/datadog-DJowkWhh.js +0 -1
  353. package/dist/chunks/envLessBridgeConfig-CixkwbRF.js +0 -1
  354. package/dist/chunks/extra-usage-DGHEQOrY.js +0 -1
  355. package/dist/chunks/extractMemories-jvjCvtpC.js +0 -1
  356. package/dist/chunks/fast-Bbtx_Bs1.js +0 -1
  357. package/dist/chunks/gates-DSI3vpwO.js +0 -1
  358. package/dist/chunks/hooks-BLLL4iPv.js +0 -1
  359. package/dist/chunks/inboundAttachments-D-p91z3w.js +0 -1
  360. package/dist/chunks/language-B_-BfBT4.js +0 -1
  361. package/dist/chunks/loadAgentsDir-vB1QEZ7H.js +0 -1
  362. package/dist/chunks/localSearch-DtVqtfvk.js +0 -1
  363. package/dist/chunks/login-D-N78G6r.js +0 -1
  364. package/dist/chunks/logout-CFggVS-9.js +0 -1
  365. package/dist/chunks/model-DdbcxKub.js +0 -1
  366. package/dist/chunks/pluginStartupCheck-Cu2ezD51.js +0 -1
  367. package/dist/chunks/policyLimits-CKy_gTEt.js +0 -1
  368. package/dist/chunks/poorMode-DJvjO2nW.js +0 -1
  369. package/dist/chunks/prompt-CQC-mh6u.js +0 -1
  370. package/dist/chunks/prompt-DawxLANl.js +0 -1
  371. package/dist/chunks/sandbox-adapter-CxkhKgaa.js +0 -1
  372. package/dist/chunks/searchExtraTools-DQ6e601b.js +0 -1
  373. package/dist/chunks/sessionFileAccessHooks-7Svz-7S-.js +0 -1
  374. package/dist/chunks/sessionMemory-DIrR3zvb.js +0 -1
  375. package/dist/chunks/sessionMemoryUtils-BdQtSkRx.js +0 -1
  376. package/dist/chunks/sessionObserver-_adufOGQ.js +0 -1
  377. package/dist/chunks/sessionStorage-W7okgAlQ.js +0 -1
  378. package/dist/chunks/sink-CaWMZBw_.js +0 -1
  379. package/dist/chunks/sinks-oFfsKySL.js +0 -1
  380. package/dist/chunks/skillLearning-BhM09bQD.js +0 -1
  381. package/dist/chunks/skillLearning-_o2D06yM.js +0 -1
  382. package/dist/chunks/teamHelpers-yeTNtZbb.js +0 -1
  383. package/dist/chunks/teammateModeSnapshot-CsNIJTKi.js +0 -1
  384. package/dist/chunks/thinkback-Quc7KPmi.js +0 -1
  385. package/dist/chunks/toolPool-C7bOwJfR.js +0 -1
  386. package/dist/chunks/undercover-CBeHiWUd.js +0 -1
  387. package/dist/chunks/upgrade-ucJ-lnlY.js +0 -1
  388. package/dist/chunks/utils-CwhszpkT.js +0 -1
  389. package/dist/chunks/voiceModeEnabled-DB8GCzAF.js +0 -1
  390. package/dist/chunks/voiceStreamSTT-DgoDscHn.js +0 -1
  391. package/dist/chunks/worktree-DU3xtwKW.js +0 -1
@@ -1,3 +1,3 @@
1
- import{n as e,o as t}from"./chunk-DR8-3Aex.js";import{Rn as n,b as r,t as i,x as a,xt as o}from"./src-Di342QoJ.js";import{t as s}from"./jsx-runtime-D-D469L8.js";import{Ac as c,Jt as l,Pc as u,Sc as d,St as f,on as p,wt as m}from"./paths-Q2255dD7.js";import{l as h,u as g}from"./oauth-CdZEzMww.js";import{a as _,i as v,n as y,o as b,r as x,s as S,t as C,v as w}from"./companion-CyK_Dr1U.js";import{r as T,t as E}from"./sprites-5OAB-Ui2.js";function D({name:e,value:t}){let n=Math.round(Math.max(0,Math.min(100,t))/10),i=`█`.repeat(n)+`░`.repeat(10-n);return(0,k.jsxs)(r,{children:[e.padEnd(10),` `,i,` `,String(t).padStart(3)]})}function O({companion:e,lastReaction:t,onDone:n}){let i=_[e.rarity],s=b[e.rarity],c=T(e,0);return o(()=>{n?.(void 0,{display:`skip`})},{isActive:n!==void 0}),(0,k.jsxs)(a,{flexDirection:`column`,borderStyle:`round`,borderColor:i,paddingX:j,paddingY:1,width:A,flexShrink:0,children:[(0,k.jsxs)(a,{justifyContent:`space-between`,children:[(0,k.jsxs)(r,{bold:!0,color:i,children:[s,` `,e.rarity.toUpperCase()]}),(0,k.jsx)(r,{color:i,children:e.species.toUpperCase()})]}),e.shiny&&(0,k.jsxs)(r,{color:`warning`,bold:!0,children:[`✨`,` SHINY `,`✨`]}),(0,k.jsx)(a,{flexDirection:`column`,marginY:1,children:c.map((e,t)=>(0,k.jsx)(r,{color:i,children:e},t))}),(0,k.jsx)(r,{bold:!0,children:e.name}),(0,k.jsx)(a,{marginY:1,children:(0,k.jsxs)(r,{dimColor:!0,italic:!0,children:[`"`,e.personality,`"`]})}),(0,k.jsx)(a,{flexDirection:`column`,children:S.map(t=>(0,k.jsx)(D,{name:t,value:e.stats[t]??0},t))}),t&&(0,k.jsxs)(a,{flexDirection:`column`,marginTop:1,children:[(0,k.jsx)(r,{dimColor:!0,children:`last said`}),(0,k.jsx)(a,{borderStyle:`round`,borderColor:`inactive`,paddingX:1,children:(0,k.jsx)(r,{dimColor:!0,italic:!0,children:t})})]})]})}var k,A,j,M=e((()=>{i(),E(),w(),k=s(),A=40,j=2}));function N(e,t){let n=y();if(!n||d().companionMuted)return;let r=P(e,n.name),i=Date.now();if(!r&&i-R<z)return;let a=I(e);a.trim()&&(R=i,L(n,a,r).then(e=>{e&&(B.push(e),B.length>V&&B.shift(),t(e))}).catch(()=>{}))}function P(e,t){let n=RegExp(`\\b${F(t)}\\b`,`i`);for(let t=e.length-1;t>=Math.max(0,e.length-3);t--){let r=e[t];if(r?.type!==`user`)continue;let i=r.message?.content;if(typeof i==`string`&&n.test(i))return!0}return!1}function F(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function I(e){return e.slice(-12).filter(e=>e.type===`user`||e.type===`assistant`).map(e=>{let t=e.type===`user`?`user`:`claude`,n=e.message?.content;return`${t}: ${typeof n==`string`?n.slice(0,300):Array.isArray(n)?n.filter(e=>e?.type===`text`).map(e=>e.text).join(` `).slice(0,300):``}`}).join(`
1
+ import{n as e,o as t}from"./chunk-DR8-3Aex.js";import{Rn as n,b as r,t as i,x as a,xt as o}from"./src-Di342QoJ.js";import{t as s}from"./jsx-runtime-D-D469L8.js";import{Ac as c,Jt as l,Pc as u,Sc as d,St as f,on as p,wt as m}from"./paths-BBvuDQl9.js";import{l as h,u as g}from"./oauth-CdZEzMww.js";import{a as _,i as v,n as y,o as b,r as x,s as S,t as C,v as w}from"./companion-Bkn2lSLj.js";import{r as T,t as E}from"./sprites-DD4eIkN7.js";function D({name:e,value:t}){let n=Math.round(Math.max(0,Math.min(100,t))/10),i=`█`.repeat(n)+`░`.repeat(10-n);return(0,k.jsxs)(r,{children:[e.padEnd(10),` `,i,` `,String(t).padStart(3)]})}function O({companion:e,lastReaction:t,onDone:n}){let i=_[e.rarity],s=b[e.rarity],c=T(e,0);return o(()=>{n?.(void 0,{display:`skip`})},{isActive:n!==void 0}),(0,k.jsxs)(a,{flexDirection:`column`,borderStyle:`round`,borderColor:i,paddingX:j,paddingY:1,width:A,flexShrink:0,children:[(0,k.jsxs)(a,{justifyContent:`space-between`,children:[(0,k.jsxs)(r,{bold:!0,color:i,children:[s,` `,e.rarity.toUpperCase()]}),(0,k.jsx)(r,{color:i,children:e.species.toUpperCase()})]}),e.shiny&&(0,k.jsxs)(r,{color:`warning`,bold:!0,children:[`✨`,` SHINY `,`✨`]}),(0,k.jsx)(a,{flexDirection:`column`,marginY:1,children:c.map((e,t)=>(0,k.jsx)(r,{color:i,children:e},t))}),(0,k.jsx)(r,{bold:!0,children:e.name}),(0,k.jsx)(a,{marginY:1,children:(0,k.jsxs)(r,{dimColor:!0,italic:!0,children:[`"`,e.personality,`"`]})}),(0,k.jsx)(a,{flexDirection:`column`,children:S.map(t=>(0,k.jsx)(D,{name:t,value:e.stats[t]??0},t))}),t&&(0,k.jsxs)(a,{flexDirection:`column`,marginTop:1,children:[(0,k.jsx)(r,{dimColor:!0,children:`last said`}),(0,k.jsx)(a,{borderStyle:`round`,borderColor:`inactive`,paddingX:1,children:(0,k.jsx)(r,{dimColor:!0,italic:!0,children:t})})]})]})}var k,A,j,M=e((()=>{i(),E(),w(),k=s(),A=40,j=2}));function N(e,t){let n=y();if(!n||d().companionMuted)return;let r=P(e,n.name),i=Date.now();if(!r&&i-R<z)return;let a=I(e);a.trim()&&(R=i,L(n,a,r).then(e=>{e&&(B.push(e),B.length>V&&B.shift(),t(e))}).catch(()=>{}))}function P(e,t){let n=RegExp(`\\b${F(t)}\\b`,`i`);for(let t=e.length-1;t>=Math.max(0,e.length-3);t--){let r=e[t];if(r?.type!==`user`)continue;let i=r.message?.content;if(typeof i==`string`&&n.test(i))return!0}return!1}function F(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function I(e){return e.slice(-12).filter(e=>e.type===`user`||e.type===`assistant`).map(e=>{let t=e.type===`user`?`user`:`claude`,n=e.message?.content;return`${t}: ${typeof n==`string`?n.slice(0,300):Array.isArray(n)?n.filter(e=>e?.type===`text`).map(e=>e.text).join(` `).slice(0,300):``}`}).join(`
2
2
  `).slice(0,5e3)}async function L(e,t,n){let r=l();if(!r?.accessToken)return null;let i=d().oauthAccount?.organizationUuid;if(!i)return null;let a=`${h().BASE_API_URL}/api/organizations/${i}/claude_code/buddy_react`,o=await fetch(a,{method:`POST`,headers:{Authorization:`Bearer ${r.accessToken}`,"Content-Type":`application/json`,"User-Agent":f()},body:JSON.stringify({name:e.name.slice(0,32),personality:e.personality.slice(0,200),species:e.species,rarity:e.rarity,stats:e.stats,transcript:t,reason:n?`addressed`:`turn`,recent:B.map(e=>e.slice(0,200)),addressed:n}),signal:AbortSignal.timeout(1e4)});if(!o.ok)return null;try{return(await o.json()).reaction?.trim()||null}catch{return null}}var R,z,B,V,H=e((()=>{x(),c(),p(),g(),m(),R=0,z=45e3,B=[],V=8}));function U(e){return e.charAt(0).toUpperCase()+e.slice(1)}async function W(e,t,n){let r=n?.trim().toLowerCase()??``,i=t.setAppState;if(r===`off`)return u(e=>({...e,companionMuted:!0})),e(`companion muted`,{display:`system`}),null;if(r===`on`)return u(e=>({...e,companionMuted:!1})),e(`companion unmuted`,{display:`system`}),null;if(r===`pet`){let n=y();return n?(u(e=>({...e,companionMuted:!1})),i?.(e=>({...e,companionPetAt:Date.now()})),N(t.messages??[],e=>i?.(t=>t.companionReaction===e?t:{...t,companionReaction:e})),e(`petted ${n.name}`,{display:`system`}),null):(e(`no companion yet · run /buddy first`,{display:`system`}),null)}let a=y();if(a&&d().companionMuted&&u(e=>({...e,companionMuted:!1})),a){let n=t.getAppState?.()?.companionReaction;return G.createElement(O,{companion:a,lastReaction:n,onDone:e})}let o=C(),s=v(o),c=K[s.bones.species]??`Buddy`,l=q[s.bones.species]??`Mysterious and code-savvy.`,f={name:c,personality:l,seed:o,hatchedAt:Date.now()};u(e=>({...e,companion:f}));let p=b[s.bones.rarity],m=T(s.bones,0),h=s.bones.shiny?` ✨ Shiny!`:``;return e([`A wild companion appeared!`,``,...m,``,`${c} the ${U(s.bones.species)}${h}`,`Rarity: ${p} (${s.bones.rarity})`,`"${l}"`,``,`Your companion will now appear beside your input box!`,`Say its name to get its take · /buddy pet · /buddy off`].join(`
3
3
  `),{display:`system`}),null}var G,K,q;e((()=>{G=t(n(),1),x(),w(),E(),M(),c(),H(),K={duck:`Waddles`,goose:`Goosberry`,blob:`Gooey`,cat:`Whiskers`,dragon:`Ember`,octopus:`Inky`,owl:`Hoots`,penguin:`Waddleford`,turtle:`Shelly`,snail:`Trailblazer`,ghost:`Casper`,axolotl:`Axie`,capybara:`Chill`,cactus:`Spike`,robot:`Byte`,rabbit:`Flops`,mushroom:`Spore`,chonk:`Chonk`},q={duck:`Quirky and easily amused. Leaves rubber duck debugging tips everywhere.`,goose:`Assertive and honks at bad code. Takes no prisoners in code reviews.`,blob:`Adaptable and goes with the flow. Sometimes splits into two when confused.`,cat:`Independent and judgmental. Watches you type with mild disdain.`,dragon:`Fiery and passionate about architecture. Hoards good variable names.`,octopus:`Multitasker extraordinaire. Wraps tentacles around every problem at once.`,owl:`Wise but verbose. Always says "let me think about that" for exactly 3 seconds.`,penguin:`Cool under pressure. Slides gracefully through merge conflicts.`,turtle:`Patient and thorough. Believes slow and steady wins the deploy.`,snail:`Methodical and leaves a trail of useful comments. Never rushes.`,ghost:`Ethereal and appears at the worst possible moments with spooky insights.`,axolotl:`Regenerative and cheerful. Recovers from any bug with a smile.`,capybara:`Zen master. Remains calm while everything around is on fire.`,cactus:`Prickly on the outside but full of good intentions. Thrives on neglect.`,robot:`Efficient and literal. Processes feedback in binary.`,rabbit:`Energetic and hops between tasks. Finishes before you start.`,mushroom:`Quietly insightful. Grows on you over time.`,chonk:`Big, warm, and takes up the whole couch. Prioritizes comfort over elegance.`}}))();export{W as call};
@@ -1 +1 @@
1
- import{n as e,o as t}from"./chunk-DR8-3Aex.js";import{Rn as n}from"./src-Di342QoJ.js";import{W as r,cn as i}from"./state-sIHsFpDu.js";import{K as a,V as o}from"./debug-UI3T040K.js";import{o as s,s as c}from"./log-CzsijfHZ.js";import{L as l,MS as u,NS as d,PS as f,jS as p,w as m}from"./loadAgentsDir-Ci5mr0vm.js";async function h(e,t,n){{if(y)return;y=!0;let{updateContext:r,notification:i}=await l(e,n);t(e=>{let t=r(e.toolPermissionContext),n=t===e.toolPermissionContext?e:{...e,toolPermissionContext:t};return i?{...n,notifications:{...n.notifications,queue:[...n.notifications.queue,{key:`auto-mode-gate-notification`,text:i,color:`warning`,priority:`high`}]}}:n})}}function g(){y=!1}function _(){let e=u(e=>e.mainLoopModel),t=u(e=>e.mainLoopModelForSession),n=u(e=>e.fastMode),i=f(),o=d(),s=(0,v.useRef)(!0);(0,v.useEffect)(()=>{r()||(s.current?s.current=!1:g(),h(o.getState().toolPermissionContext,i,n).catch(e=>{c(Error(`Auto mode gate check failed`,{cause:a(e)}))}))},[e,t,n])}var v,y,b=e((()=>{v=t(n(),1),o(),s(),i(),p(),m(),y=!1}));export{_ as i,b as n,g as r,h as t};
1
+ import{n as e,o as t}from"./chunk-DR8-3Aex.js";import{Rn as n}from"./src-Di342QoJ.js";import{W as r,cn as i}from"./state-sIHsFpDu.js";import{K as a,V as o}from"./debug-UI3T040K.js";import{o as s,s as c}from"./log-CzsijfHZ.js";import{L as l,MS as u,NS as d,PS as f,jS as p,w as m}from"./loadAgentsDir-DI1a76pd.js";async function h(e,t,n){{if(y)return;y=!0;let{updateContext:r,notification:i}=await l(e,n);t(e=>{let t=r(e.toolPermissionContext),n=t===e.toolPermissionContext?e:{...e,toolPermissionContext:t};return i?{...n,notifications:{...n.notifications,queue:[...n.notifications.queue,{key:`auto-mode-gate-notification`,text:i,color:`warning`,priority:`high`}]}}:n})}}function g(){y=!1}function _(){let e=u(e=>e.mainLoopModel),t=u(e=>e.mainLoopModelForSession),n=u(e=>e.fastMode),i=f(),o=d(),s=(0,v.useRef)(!0);(0,v.useEffect)(()=>{r()||(s.current?s.current=!1:g(),h(o.getState().toolPermissionContext,i,n).catch(e=>{c(Error(`Auto mode gate check failed`,{cause:a(e)}))}))},[e,t,n])}var v,y,b=e((()=>{v=t(n(),1),o(),s(),i(),p(),m(),y=!1}));export{_ as i,b as n,g as r,h as t};
@@ -1,3 +1,3 @@
1
- import{n as e,o as t}from"./chunk-DR8-3Aex.js";import{n,t as r}from"./defineProperty-80gRi2ZW.js";import{p as i}from"./zod-DT6hytkp.js";import{Fr as a,Pr as o,Zn as s,cn as c,u as l}from"./state-sIHsFpDu.js";import{Ac as u,Ka as d,Sc as f,oo as p}from"./paths-Q2255dD7.js";import{L as m,V as h,d as g,h as _,p as v,s as ee}from"./debug-UI3T040K.js";import{n as y,r as b}from"./analytics-DqMQntaB.js";import{n as x,t as S}from"./cwd--iizewsn.js";import{E as te,S as ne,_ as re,r as ie,v as ae}from"./git-CN3qtTb_.js";import{o as oe,s as C}from"./log-CzsijfHZ.js";import{i as se,n as ce}from"./path-C4kbwvSH.js";import{n as w,r as le}from"./execFileNoThrow-CuQN1sz8.js";import{$S as ue,Ac as de,ED as fe,Gm as pe,Hd as me,Ik as he,Nt as ge,Pk as _e,Q as ve,QS as ye,Sh as be,Sk as xe,Wm as Se,X as Ce,Xi as we,_ as Te,_l as Ee,bm as De,dk as Oe,fk as ke,hl as Ae,kc as je,lA as Me,m as Ne,mk as Pe,ny as Fe,pk as Ie,ry as Le,uA as Re,uk as ze,v as Be,wD as Ve,wm as He,xh as Ue,xk as We,yn as Ge,zd as Ke,zi as qe,zt as Je}from"./loadAgentsDir-Ci5mr0vm.js";import{Gt as Ye,Wt as Xe}from"./prompt-DEPUnJdB.js";import{a as Ze,t as Qe}from"./detectRepository-CBk3S2zv.js";import{r as $e,t as et}from"./magicDocs-BfoeYhin.js";import*as T from"path";import{statSync as tt}from"fs";function E(e,t,n){if(t===0)return n?j:0;let r=e.charCodeAt(t-1);return nt(r)?k:rt(r)&&it(e.charCodeAt(t))?A:0}function nt(e){return e===47||e===92||e===45||e===95||e===46||e===32}function rt(e){return e>=97&&e<=122}function it(e){return e>=65&&e<=90}function D(){return new Promise(e=>setImmediate(e))}function at(e,t){let n=new Set;for(let r of e){let e=r.length;for(let t=0;t<r.length;t++){let n=r.charCodeAt(t);if(n===47||n===92){e=t;break}}let i=r.slice(0,e);if(i.length>0&&(n.add(i),n.size>=t))break}let r=Array.from(n);return r.sort((e,t)=>{let n=e.length-t.length;return n===0?e<t?-1:+(e>t):n}),r.slice(0,t).map(e=>({path:e,score:0}))}var O,k,A,ot,j,M,st,ct,N,P,lt,ut=e((()=>{n(),O=16,k=8,A=6,ot=4,j=8,M=3,st=1,ct=100,N=64,P=new Int32Array(N),lt=class{constructor(){r(this,`paths`,[]),r(this,`lowerPaths`,[]),r(this,`charBits`,new Int32Array),r(this,`pathLens`,new Uint16Array),r(this,`topLevelCache`,null),r(this,`readyCount`,0)}loadFromFileList(e){let t=new Set,n=[];for(let r of e)r.length>0&&!t.has(r)&&(t.add(r),n.push(r));this.buildIndex(n)}loadFromFileListAsync(e){let t=()=>{};return{queryable:new Promise(e=>{t=e}),done:this.buildAsync(e,t)}}async buildAsync(e,t){let n=new Set,r=[],i=performance.now();for(let t=0;t<e.length;t++){let a=e[t];a.length>0&&!n.has(a)&&(n.add(a),r.push(a)),(t&255)==255&&performance.now()-i>4&&(await D(),i=performance.now())}this.resetArrays(r),i=performance.now();let a=!0;for(let e=0;e<r.length;e++)this.indexPath(e),(e&255)==255&&performance.now()-i>4&&(this.readyCount=e+1,a&&(t(),a=!1),await D(),i=performance.now());this.readyCount=r.length,t()}buildIndex(e){this.resetArrays(e);for(let t=0;t<e.length;t++)this.indexPath(t);this.readyCount=e.length}resetArrays(e){let t=e.length;this.paths=e,this.lowerPaths=Array(t),this.charBits=new Int32Array(t),this.pathLens=new Uint16Array(t),this.readyCount=0,this.topLevelCache=at(e,ct)}indexPath(e){let t=this.paths[e].toLowerCase();this.lowerPaths[e]=t;let n=t.length;this.pathLens[e]=n;let r=0;for(let e=0;e<n;e++){let n=t.charCodeAt(e);n>=97&&n<=122&&(r|=1<<n-97)}this.charBits[e]=r}search(e,t){if(t<=0)return[];if(e.length===0)return this.topLevelCache?this.topLevelCache.slice(0,t):[];let n=e!==e.toLowerCase(),r=n?e:e.toLowerCase(),i=Math.min(r.length,N),a=Array(i),o=0;for(let e=0;e<i;e++){let t=r.charAt(e);a[e]=t;let n=t.charCodeAt(0);n>=97&&n<=122&&(o|=1<<n-97)}let s=i*(O+k)+j+32,c=[],l=-1/0,{paths:u,lowerPaths:d,charBits:f,pathLens:p,readyCount:m}=this;for(let e=0;e<m;e++){if((f[e]&o)!==o)continue;let r=n?u[e]:d[e],m=a[0],h=0,g=[],_=r.indexOf(m);if(_===-1)continue;g[h++]=_;for(let e=_+1;e<r.length;e++){if(r.charCodeAt(e)!==m.charCodeAt(0))continue;let t=r.charCodeAt(e-1);(t===47||t===92||t===45||t===95||t===46||t===32)&&(g[h++]=e)}let v=u[e],ee=p[e],y=Math.max(0,32-(ee>>2)),b=-1/0;for(let e=0;e<h;e++){P[0]=g[e];let n=0,o=0,u=P[0],d=!0;for(let e=1;e<i;e++){let t=r.indexOf(a[e],u+1);if(t===-1){d=!1;break}P[e]=t;let i=t-u-1;i===0?o+=ot:n+=M+i*st,u=t}if(!d||c.length===t&&s+o-n+y<=l)continue;let f=i*O+o-n;f+=E(v,P[0],!0);for(let e=1;e<i;e++)f+=E(v,P[e],!1);f+=y,f>b&&(b=f)}if(b===-1/0)continue;let x=b;if(c.length<t)c.push({path:v,fuzzScore:x}),c.length===t&&(c.sort((e,t)=>e.fuzzScore-t.fuzzScore),l=c[0].fuzzScore);else if(x>l){let e=0,t=c.length;for(;e<t;){let n=e+t>>1;c[n].fuzzScore<x?e=n+1:t=n}c.splice(e,0,{path:v,fuzzScore:x}),c.shift(),l=c[0].fuzzScore}}c.sort((e,t)=>t.fuzzScore-e.fuzzScore);let h=c.length,g=Math.max(h,1),_=Array(h);for(let e=0;e<h;e++){let t=c[e].path,n=e/g;_[e]={path:t,score:t.includes(`test`)?Math.min(n*1.05,1):n}}return _}}}));function F(){return R||(R=new lt),R}function dt(){R=null,z=null,V++,H=null,U=[],W=[],G=[],B.clear(),K=null,q=null,J=0,Y=null,X=null,Z=null}function ft(e){let t=e.length,n=Math.max(1,Math.floor(t/500)),r=-2128831035;for(let i=0;i<t;i+=n){let t=e[i];for(let e=0;e<t.length;e++)r=(r^t.charCodeAt(e))*16777619|0;r=r*16777619|0}if(t>0){let n=e[t-1];for(let e=0;e<n.length;e++)r=(r^n.charCodeAt(e))*16777619|0}return`${t}:${(r>>>0).toString(16)}`}function pt(){let e=ie(S());if(!e)return null;try{return tt(T.join(e,`.git`,`index`)).mtimeMs}catch{return null}}function mt(e,t,n){return n===t?e:e.map(e=>{let r=T.join(t,e);return T.relative(n,r)})}async function ht(e){if(e.length===0||!R||U.length===0)return;let t=await vt(e),n=[...U,...W,...G,...e,...t],r=ft(n);if(r===Z){g(`[FileIndex] skipped index rebuild — merged paths unchanged`);return}await R.loadFromFileListAsync(n).done,Z=r,g(`[FileIndex] rebuilt index with ${U.length} tracked + ${e.length} untracked files`)}async function gt(e,t){let n=`${e}:${t}`;if(q===n)return K;let r=v(),i=[`.ignore`,`.rgignore`],a=[...new Set([e,t])],o=(0,kt.default)(),s=!1,c=a.flatMap(e=>i.map(t=>T.join(e,t))),l=await Promise.all(c.map(e=>r.readFile(e,{encoding:`utf8`}).catch(()=>null)));for(let[e,t]of l.entries())t!==null&&(o.add(t),s=!0,g(`[FileIndex] loaded ignore patterns from ${c[e]}`));let u=s?o:null;return K=u,q=n,u}async function _t(e,t){let n=Date.now();g(`[FileIndex] getFilesUsingGit called`);let r=S(),i=ie(r);if(!i)return g(`[FileIndex] not a git repo, returning null`),null;try{let a=Date.now(),o=await w(re(),[`-c`,`core.quotepath=false`,`ls-files`,`--recurse-submodules`],{timeout:5e3,abortSignal:e,cwd:i});if(g(`[FileIndex] git ls-files (tracked) took ${Date.now()-a}ms`),o.code!==0)return g(`[FileIndex] git ls-files failed (code=${o.code}, stderr=${o.stderr}), falling back to ripgrep`),null;let s=mt(o.stdout.trim().split(`
1
+ import{n as e,o as t}from"./chunk-DR8-3Aex.js";import{n,t as r}from"./defineProperty-80gRi2ZW.js";import{p as i}from"./zod-DT6hytkp.js";import{Fr as a,Pr as o,Zn as s,cn as c,u as l}from"./state-sIHsFpDu.js";import{Ac as u,Ka as d,Sc as f,oo as p}from"./paths-BBvuDQl9.js";import{L as m,V as h,d as g,h as _,p as v,s as ee}from"./debug-UI3T040K.js";import{n as y,r as b}from"./analytics-DqMQntaB.js";import{n as x,t as S}from"./cwd--iizewsn.js";import{E as te,S as ne,_ as re,r as ie,v as ae}from"./git-CN3qtTb_.js";import{o as oe,s as C}from"./log-CzsijfHZ.js";import{i as se,n as ce}from"./path-C4kbwvSH.js";import{n as w,r as le}from"./execFileNoThrow-CuQN1sz8.js";import{$S as ue,Ac as de,ED as fe,Gm as pe,Hd as me,Ik as he,Nt as ge,Pk as _e,Q as ve,QS as ye,Sh as be,Sk as xe,Wm as Se,X as Ce,Xi as we,_ as Te,_l as Ee,bm as De,dk as Oe,fk as ke,hl as Ae,kc as je,lA as Me,m as Ne,mk as Pe,ny as Fe,pk as Ie,ry as Le,uA as Re,uk as ze,v as Be,wD as Ve,wm as He,xh as Ue,xk as We,yn as Ge,zd as Ke,zi as qe,zt as Je}from"./loadAgentsDir-DI1a76pd.js";import{Gt as Ye,Wt as Xe}from"./prompt-CjFAtm3w.js";import{a as Ze,t as Qe}from"./detectRepository-CBk3S2zv.js";import{r as $e,t as et}from"./magicDocs-CmUlOWjI.js";import*as T from"path";import{statSync as tt}from"fs";function E(e,t,n){if(t===0)return n?j:0;let r=e.charCodeAt(t-1);return nt(r)?k:rt(r)&&it(e.charCodeAt(t))?A:0}function nt(e){return e===47||e===92||e===45||e===95||e===46||e===32}function rt(e){return e>=97&&e<=122}function it(e){return e>=65&&e<=90}function D(){return new Promise(e=>setImmediate(e))}function at(e,t){let n=new Set;for(let r of e){let e=r.length;for(let t=0;t<r.length;t++){let n=r.charCodeAt(t);if(n===47||n===92){e=t;break}}let i=r.slice(0,e);if(i.length>0&&(n.add(i),n.size>=t))break}let r=Array.from(n);return r.sort((e,t)=>{let n=e.length-t.length;return n===0?e<t?-1:+(e>t):n}),r.slice(0,t).map(e=>({path:e,score:0}))}var O,k,A,ot,j,M,st,ct,N,P,lt,ut=e((()=>{n(),O=16,k=8,A=6,ot=4,j=8,M=3,st=1,ct=100,N=64,P=new Int32Array(N),lt=class{constructor(){r(this,`paths`,[]),r(this,`lowerPaths`,[]),r(this,`charBits`,new Int32Array),r(this,`pathLens`,new Uint16Array),r(this,`topLevelCache`,null),r(this,`readyCount`,0)}loadFromFileList(e){let t=new Set,n=[];for(let r of e)r.length>0&&!t.has(r)&&(t.add(r),n.push(r));this.buildIndex(n)}loadFromFileListAsync(e){let t=()=>{};return{queryable:new Promise(e=>{t=e}),done:this.buildAsync(e,t)}}async buildAsync(e,t){let n=new Set,r=[],i=performance.now();for(let t=0;t<e.length;t++){let a=e[t];a.length>0&&!n.has(a)&&(n.add(a),r.push(a)),(t&255)==255&&performance.now()-i>4&&(await D(),i=performance.now())}this.resetArrays(r),i=performance.now();let a=!0;for(let e=0;e<r.length;e++)this.indexPath(e),(e&255)==255&&performance.now()-i>4&&(this.readyCount=e+1,a&&(t(),a=!1),await D(),i=performance.now());this.readyCount=r.length,t()}buildIndex(e){this.resetArrays(e);for(let t=0;t<e.length;t++)this.indexPath(t);this.readyCount=e.length}resetArrays(e){let t=e.length;this.paths=e,this.lowerPaths=Array(t),this.charBits=new Int32Array(t),this.pathLens=new Uint16Array(t),this.readyCount=0,this.topLevelCache=at(e,ct)}indexPath(e){let t=this.paths[e].toLowerCase();this.lowerPaths[e]=t;let n=t.length;this.pathLens[e]=n;let r=0;for(let e=0;e<n;e++){let n=t.charCodeAt(e);n>=97&&n<=122&&(r|=1<<n-97)}this.charBits[e]=r}search(e,t){if(t<=0)return[];if(e.length===0)return this.topLevelCache?this.topLevelCache.slice(0,t):[];let n=e!==e.toLowerCase(),r=n?e:e.toLowerCase(),i=Math.min(r.length,N),a=Array(i),o=0;for(let e=0;e<i;e++){let t=r.charAt(e);a[e]=t;let n=t.charCodeAt(0);n>=97&&n<=122&&(o|=1<<n-97)}let s=i*(O+k)+j+32,c=[],l=-1/0,{paths:u,lowerPaths:d,charBits:f,pathLens:p,readyCount:m}=this;for(let e=0;e<m;e++){if((f[e]&o)!==o)continue;let r=n?u[e]:d[e],m=a[0],h=0,g=[],_=r.indexOf(m);if(_===-1)continue;g[h++]=_;for(let e=_+1;e<r.length;e++){if(r.charCodeAt(e)!==m.charCodeAt(0))continue;let t=r.charCodeAt(e-1);(t===47||t===92||t===45||t===95||t===46||t===32)&&(g[h++]=e)}let v=u[e],ee=p[e],y=Math.max(0,32-(ee>>2)),b=-1/0;for(let e=0;e<h;e++){P[0]=g[e];let n=0,o=0,u=P[0],d=!0;for(let e=1;e<i;e++){let t=r.indexOf(a[e],u+1);if(t===-1){d=!1;break}P[e]=t;let i=t-u-1;i===0?o+=ot:n+=M+i*st,u=t}if(!d||c.length===t&&s+o-n+y<=l)continue;let f=i*O+o-n;f+=E(v,P[0],!0);for(let e=1;e<i;e++)f+=E(v,P[e],!1);f+=y,f>b&&(b=f)}if(b===-1/0)continue;let x=b;if(c.length<t)c.push({path:v,fuzzScore:x}),c.length===t&&(c.sort((e,t)=>e.fuzzScore-t.fuzzScore),l=c[0].fuzzScore);else if(x>l){let e=0,t=c.length;for(;e<t;){let n=e+t>>1;c[n].fuzzScore<x?e=n+1:t=n}c.splice(e,0,{path:v,fuzzScore:x}),c.shift(),l=c[0].fuzzScore}}c.sort((e,t)=>t.fuzzScore-e.fuzzScore);let h=c.length,g=Math.max(h,1),_=Array(h);for(let e=0;e<h;e++){let t=c[e].path,n=e/g;_[e]={path:t,score:t.includes(`test`)?Math.min(n*1.05,1):n}}return _}}}));function F(){return R||(R=new lt),R}function dt(){R=null,z=null,V++,H=null,U=[],W=[],G=[],B.clear(),K=null,q=null,J=0,Y=null,X=null,Z=null}function ft(e){let t=e.length,n=Math.max(1,Math.floor(t/500)),r=-2128831035;for(let i=0;i<t;i+=n){let t=e[i];for(let e=0;e<t.length;e++)r=(r^t.charCodeAt(e))*16777619|0;r=r*16777619|0}if(t>0){let n=e[t-1];for(let e=0;e<n.length;e++)r=(r^n.charCodeAt(e))*16777619|0}return`${t}:${(r>>>0).toString(16)}`}function pt(){let e=ie(S());if(!e)return null;try{return tt(T.join(e,`.git`,`index`)).mtimeMs}catch{return null}}function mt(e,t,n){return n===t?e:e.map(e=>{let r=T.join(t,e);return T.relative(n,r)})}async function ht(e){if(e.length===0||!R||U.length===0)return;let t=await vt(e),n=[...U,...W,...G,...e,...t],r=ft(n);if(r===Z){g(`[FileIndex] skipped index rebuild — merged paths unchanged`);return}await R.loadFromFileListAsync(n).done,Z=r,g(`[FileIndex] rebuilt index with ${U.length} tracked + ${e.length} untracked files`)}async function gt(e,t){let n=`${e}:${t}`;if(q===n)return K;let r=v(),i=[`.ignore`,`.rgignore`],a=[...new Set([e,t])],o=(0,kt.default)(),s=!1,c=a.flatMap(e=>i.map(t=>T.join(e,t))),l=await Promise.all(c.map(e=>r.readFile(e,{encoding:`utf8`}).catch(()=>null)));for(let[e,t]of l.entries())t!==null&&(o.add(t),s=!0,g(`[FileIndex] loaded ignore patterns from ${c[e]}`));let u=s?o:null;return K=u,q=n,u}async function _t(e,t){let n=Date.now();g(`[FileIndex] getFilesUsingGit called`);let r=S(),i=ie(r);if(!i)return g(`[FileIndex] not a git repo, returning null`),null;try{let a=Date.now(),o=await w(re(),[`-c`,`core.quotepath=false`,`ls-files`,`--recurse-submodules`],{timeout:5e3,abortSignal:e,cwd:i});if(g(`[FileIndex] git ls-files (tracked) took ${Date.now()-a}ms`),o.code!==0)return g(`[FileIndex] git ls-files failed (code=${o.code}, stderr=${o.stderr}), falling back to ripgrep`),null;let s=mt(o.stdout.trim().split(`
2
2
  `).filter(Boolean),i,r),c=await gt(i,r);if(c){let e=s.length;s=c.filter(s),g(`[FileIndex] applied ignore patterns: ${e} -> ${s.length} files`)}U=s;let l=Date.now()-n;if(g(`[FileIndex] git ls-files: ${s.length} tracked files in ${l}ms`),b(`tengu_file_suggestions_git_ls_files`,{file_count:s.length,tracked_count:s.length,untracked_count:0,duration_ms:l}),!H){let e=t?[`-c`,`core.quotepath=false`,`ls-files`,`--others`,`--exclude-standard`]:[`-c`,`core.quotepath=false`,`ls-files`,`--others`],n=V;H=w(re(),e,{timeout:1e4,cwd:i}).then(async e=>{if(n===V&&e.code===0){let t=mt(e.stdout.trim().split(`
3
- `).filter(Boolean),i,r),n=await gt(i,r);if(n&&t.length>0){let e=t.length;t=n.filter(t),g(`[FileIndex] applied ignore patterns to untracked: ${e} -> ${t.length} files`)}g(`[FileIndex] background untracked fetch: ${t.length} files`),ht(t)}}).catch(e=>{g(`[FileIndex] background untracked fetch failed: ${e}`)}).finally(()=>{H=null})}return s}catch(e){return g(`[FileIndex] git ls-files error: ${m(e)}`),null}}async function vt(e){let t=new Set,n=performance.now();for(let r=0;r<e.length;r++)yt(e,r,r+1,t),(r&255)==255&&performance.now()-n>4&&(await D(),n=performance.now());return[...t].map(e=>e+T.sep)}function yt(e,t,n,r){for(let i=t;i<n;i++){let t=T.dirname(e[i]);for(;t!==`.`&&!r.has(t);){let e=T.dirname(t);if(e===t)break;r.add(t),t=e}}}async function bt(e){return(await Promise.all(Ne.map(t=>Be(t,e)))).flatMap(e=>e.map(e=>e.filePath))}async function xt(e,t){g(`[FileIndex] getProjectFiles called, respectGitignore=${t}`);let n=await _t(e,t);if(n!==null)return g(`[FileIndex] using git ls-files result (${n.length} files)`),n;g(`[FileIndex] git ls-files returned null, falling back to ripgrep`);let r=Date.now(),i=[`--files`,`--follow`,`--hidden`,`--glob`,`!.git/`,`--glob`,`!.svn/`,`--glob`,`!.hg/`,`--glob`,`!.bzr/`,`--glob`,`!.jj/`,`--glob`,`!.sl/`];t||i.push(`--no-ignore-vcs`);let a=(await Re(i,`.`,e)).map(e=>T.relative(S(),e)),o=Date.now()-r;return g(`[FileIndex] ripgrep: ${a.length} files in ${o}ms`),b(`tengu_file_suggestions_ripgrep`,{file_count:a.length,duration_ms:o}),a}async function St(){let e=AbortSignal.timeout(1e4),t=F();try{let n=d(),r=f(),i=n.respectGitignore??r.respectGitignore??!0,a=S(),[o,s]=await Promise.all([xt(e,i),bt(a)]);W=s;let c=[...o,...s],l=await vt(c);G=l;let u=[...l,...c],p=ft(u);p===X?g(`[FileIndex] skipped index rebuild — tracked paths unchanged`):(await t.loadFromFileListAsync(u).done,X=p,Z=null)}catch(e){C(e)}return t}function Ct(e,t){let n=Math.min(e.length,t.length),r=0;for(;r<n&&e[r]===t[r];)r++;return e.substring(0,r)}function wt(e){if(e.length===0)return``;let t=e.map(e=>e.displayText),n=t[0];for(let e=1;e<t.length;e++){let r=t[e];if(n=Ct(n,r),n===``)return``}return n}function I(e,t){return{id:`file-${e}`,displayText:e,metadata:t===void 0?void 0:{score:t}}}function Tt(e,t){return e.search(t,Q).map(e=>I(e.path,e.score))}function L(){if(z)return;let e=pt();if(R&&!(e!==null&&e!==Y)&&Date.now()-J<jt)return;let t=V,n=Date.now();F(),z=St().then(r=>t===V?(z=null,B.emit(),Y=e,J=Date.now(),g(`[FileIndex] cache refresh completed in ${Date.now()-n}ms`),r):r).catch(e=>(g(`[FileIndex] Cache refresh failed: ${m(e)}`),C(e),t===V&&(z=null),F()))}async function Et(){let e=v(),t=S();try{return(await e.readdir(t)).map(e=>{let n=T.join(t,e.name),r=T.relative(t,n);return e.isDirectory()?r+T.sep:r})}catch(e){return C(e),[]}}async function Dt(e,t=!1){if(!e&&!t)return[];if(d().fileSuggestion?.type===`command`)return(await Je({...ge(),query:e})).slice(0,Q).map(I);if(e===``||e===`.`||e===`./`){let e=await Et();return L(),e.slice(0,Q).map(I)}let n=Date.now();try{let t=z!==null;L();let r=e,i=`.`+T.sep;e.startsWith(i)&&(r=e.substring(2)),r.startsWith(`~`)&&(r=ce(r));let a=R?Tt(R,r):[],o=Date.now()-n;return g(`[FileIndex] generateFileSuggestions: ${a.length} results in ${o}ms (${t?`partial`:`full`} index)`),b(`tengu_file_suggestions_query`,{duration_ms:o,cache_hit:!t,result_count:a.length,query_length:e.length}),a}catch(e){return C(e),[]}}function Ot(e,t,n,r,i,a){let o=typeof e==`string`?e:e.displayText;i(t.substring(0,r)+o+t.substring(r+n.length)),a(r+o.length)}var kt,R,z,B,At,V,H,U,W,G,K,q,J,Y,X,Z,Q,jt,$=e((()=>{kt=t(i(),1),Te(),ut(),y(),u(),x(),ee(),h(),le(),_(),ae(),Ge(),oe(),se(),Me(),p(),a(),R=null,z=null,B=o(),At=B.subscribe,V=0,H=null,U=[],W=[],G=[],K=null,q=null,J=0,Y=null,X=null,Z=null,Q=15,jt=5e3}));function Mt(e=new Set){let t=e.size>0;ke.cache.clear?.(),Oe.cache.clear?.(),ze.cache.clear?.(),Xe.cache.clear?.(),dt(),qe(),t||he(),Pe(null),s(null),Ee(),de(),xe(`session_start`),ye(),Fe(),t||Ke(),process.env.USER_TYPE===`ant`&&import(`./TungstenTool-C5IqKVr0.js`).then(({clearSessionsWithTungstenUsage:e,resetInitializationState:t})=>{e(),t()}),import(`./attributionHooks-PygdohOh.js`).then(({clearAttributionCaches:e})=>e()),Qe(),Ce(),t||Ve(),l(e),ne(),De(),be(),et(),Se(),import(`./utils-CwhszpkT.js`).then(({clearWebFetchCache:e})=>e()),import(`./SearchExtraToolsTool-D70C-cmA.js`).then(({clearSearchExtraToolsDescriptionCache:e})=>e()),import(`./loadAgentsDir-vB1QEZ7H.js`).then(({clearAgentDefinitionsCache:e})=>e()),import(`./prompt-CQC-mh6u.js`).then(({clearPromptCache:e})=>e())}var Nt=e((()=>{c(),we(),Ye(),Ie(),$(),me(),fe(),_e(),Le(),Ae(),Ue(),$e(),He(),je(),ve(),We(),Ze(),te(),ue(),pe()}));export{Dt as a,L as c,wt as i,Nt as n,$ as o,Ot as r,At as s,Mt as t};
3
+ `).filter(Boolean),i,r),n=await gt(i,r);if(n&&t.length>0){let e=t.length;t=n.filter(t),g(`[FileIndex] applied ignore patterns to untracked: ${e} -> ${t.length} files`)}g(`[FileIndex] background untracked fetch: ${t.length} files`),ht(t)}}).catch(e=>{g(`[FileIndex] background untracked fetch failed: ${e}`)}).finally(()=>{H=null})}return s}catch(e){return g(`[FileIndex] git ls-files error: ${m(e)}`),null}}async function vt(e){let t=new Set,n=performance.now();for(let r=0;r<e.length;r++)yt(e,r,r+1,t),(r&255)==255&&performance.now()-n>4&&(await D(),n=performance.now());return[...t].map(e=>e+T.sep)}function yt(e,t,n,r){for(let i=t;i<n;i++){let t=T.dirname(e[i]);for(;t!==`.`&&!r.has(t);){let e=T.dirname(t);if(e===t)break;r.add(t),t=e}}}async function bt(e){return(await Promise.all(Ne.map(t=>Be(t,e)))).flatMap(e=>e.map(e=>e.filePath))}async function xt(e,t){g(`[FileIndex] getProjectFiles called, respectGitignore=${t}`);let n=await _t(e,t);if(n!==null)return g(`[FileIndex] using git ls-files result (${n.length} files)`),n;g(`[FileIndex] git ls-files returned null, falling back to ripgrep`);let r=Date.now(),i=[`--files`,`--follow`,`--hidden`,`--glob`,`!.git/`,`--glob`,`!.svn/`,`--glob`,`!.hg/`,`--glob`,`!.bzr/`,`--glob`,`!.jj/`,`--glob`,`!.sl/`];t||i.push(`--no-ignore-vcs`);let a=(await Re(i,`.`,e)).map(e=>T.relative(S(),e)),o=Date.now()-r;return g(`[FileIndex] ripgrep: ${a.length} files in ${o}ms`),b(`tengu_file_suggestions_ripgrep`,{file_count:a.length,duration_ms:o}),a}async function St(){let e=AbortSignal.timeout(1e4),t=F();try{let n=d(),r=f(),i=n.respectGitignore??r.respectGitignore??!0,a=S(),[o,s]=await Promise.all([xt(e,i),bt(a)]);W=s;let c=[...o,...s],l=await vt(c);G=l;let u=[...l,...c],p=ft(u);p===X?g(`[FileIndex] skipped index rebuild — tracked paths unchanged`):(await t.loadFromFileListAsync(u).done,X=p,Z=null)}catch(e){C(e)}return t}function Ct(e,t){let n=Math.min(e.length,t.length),r=0;for(;r<n&&e[r]===t[r];)r++;return e.substring(0,r)}function wt(e){if(e.length===0)return``;let t=e.map(e=>e.displayText),n=t[0];for(let e=1;e<t.length;e++){let r=t[e];if(n=Ct(n,r),n===``)return``}return n}function I(e,t){return{id:`file-${e}`,displayText:e,metadata:t===void 0?void 0:{score:t}}}function Tt(e,t){return e.search(t,Q).map(e=>I(e.path,e.score))}function L(){if(z)return;let e=pt();if(R&&!(e!==null&&e!==Y)&&Date.now()-J<jt)return;let t=V,n=Date.now();F(),z=St().then(r=>t===V?(z=null,B.emit(),Y=e,J=Date.now(),g(`[FileIndex] cache refresh completed in ${Date.now()-n}ms`),r):r).catch(e=>(g(`[FileIndex] Cache refresh failed: ${m(e)}`),C(e),t===V&&(z=null),F()))}async function Et(){let e=v(),t=S();try{return(await e.readdir(t)).map(e=>{let n=T.join(t,e.name),r=T.relative(t,n);return e.isDirectory()?r+T.sep:r})}catch(e){return C(e),[]}}async function Dt(e,t=!1){if(!e&&!t)return[];if(d().fileSuggestion?.type===`command`)return(await Je({...ge(),query:e})).slice(0,Q).map(I);if(e===``||e===`.`||e===`./`){let e=await Et();return L(),e.slice(0,Q).map(I)}let n=Date.now();try{let t=z!==null;L();let r=e,i=`.`+T.sep;e.startsWith(i)&&(r=e.substring(2)),r.startsWith(`~`)&&(r=ce(r));let a=R?Tt(R,r):[],o=Date.now()-n;return g(`[FileIndex] generateFileSuggestions: ${a.length} results in ${o}ms (${t?`partial`:`full`} index)`),b(`tengu_file_suggestions_query`,{duration_ms:o,cache_hit:!t,result_count:a.length,query_length:e.length}),a}catch(e){return C(e),[]}}function Ot(e,t,n,r,i,a){let o=typeof e==`string`?e:e.displayText;i(t.substring(0,r)+o+t.substring(r+n.length)),a(r+o.length)}var kt,R,z,B,At,V,H,U,W,G,K,q,J,Y,X,Z,Q,jt,$=e((()=>{kt=t(i(),1),Te(),ut(),y(),u(),x(),ee(),h(),le(),_(),ae(),Ge(),oe(),se(),Me(),p(),a(),R=null,z=null,B=o(),At=B.subscribe,V=0,H=null,U=[],W=[],G=[],K=null,q=null,J=0,Y=null,X=null,Z=null,Q=15,jt=5e3}));function Mt(e=new Set){let t=e.size>0;ke.cache.clear?.(),Oe.cache.clear?.(),ze.cache.clear?.(),Xe.cache.clear?.(),dt(),qe(),t||he(),Pe(null),s(null),Ee(),de(),xe(`session_start`),ye(),Fe(),t||Ke(),process.env.USER_TYPE===`ant`&&import(`./TungstenTool-C5IqKVr0.js`).then(({clearSessionsWithTungstenUsage:e,resetInitializationState:t})=>{e(),t()}),import(`./attributionHooks-PygdohOh.js`).then(({clearAttributionCaches:e})=>e()),Qe(),Ce(),t||Ve(),l(e),ne(),De(),be(),et(),Se(),import(`./utils-CrZcpypC.js`).then(({clearWebFetchCache:e})=>e()),import(`./SearchExtraToolsTool-CqFD8vVS.js`).then(({clearSearchExtraToolsDescriptionCache:e})=>e()),import(`./loadAgentsDir-DCyiY0MN.js`).then(({clearAgentDefinitionsCache:e})=>e()),import(`./prompt-GY9hlRvI.js`).then(({clearPromptCache:e})=>e())}var Nt=e((()=>{c(),we(),Ye(),Ie(),$(),me(),fe(),_e(),Le(),Ae(),Ue(),$e(),He(),je(),ve(),We(),Ze(),te(),ue(),pe()}));export{Dt as a,L as c,wt as i,Nt as n,$ as o,Ot as r,At as s,Mt as t};
@@ -0,0 +1 @@
1
+ import{n as e,t}from"./caches-B5QZDncQ.js";e();export{t as clearSessionCaches};
@@ -1 +1 @@
1
- import{n as e,t}from"./defineProperty-80gRi2ZW.js";import{At as n,jt as r}from"./paths-Q2255dD7.js";import{E as i,L as a,R as o,V as s,d as c,s as l,w as u}from"./debug-UI3T040K.js";import{F as d,P as f}from"./git-CN3qtTb_.js";import{r as p,u as m}from"./proxy-CfZp-wce.js";import{n as h,t as g}from"./sleep-8Eb9j_Ly.js";import{D as _,E as v,O as y,a as b,l as x,r as S}from"./rcDebugLog-BbPkkigY.js";import{n as C}from"./jwtUtils-CpXwh_du.js";import{randomUUID as w}from"crypto";s(),l(),f(),m(),g(),r(),y(),S(),u(),e();var T=class extends Error{constructor(e,t){super(e),this.retryAfterMs=t}},E=class{constructor(e){t(this,`pending`,[]),t(this,`pendingAtClose`,0),t(this,`draining`,!1),t(this,`closed`,!1),t(this,`backpressureResolvers`,[]),t(this,`sleepResolve`,null),t(this,`flushResolvers`,[]),t(this,`droppedBatches`,0),t(this,`config`,void 0),this.config=e}get droppedBatchCount(){return this.droppedBatches}get pendingCount(){return this.closed?this.pendingAtClose:this.pending.length}async enqueue(e){if(this.closed)return;let t=Array.isArray(e)?e:[e];if(t.length!==0){for(;this.pending.length+t.length>this.config.maxQueueSize&&!this.closed;)await new Promise(e=>{this.backpressureResolvers.push(e)});this.closed||(this.pending.push(...t),this.drain())}}flush(){return this.pending.length===0&&!this.draining?Promise.resolve():(this.drain(),new Promise(e=>{this.flushResolvers.push(e)}))}close(){if(!this.closed){this.closed=!0,this.pendingAtClose=this.pending.length,this.pending=[],this.sleepResolve?.(),this.sleepResolve=null;for(let e of this.backpressureResolvers)e();this.backpressureResolvers=[];for(let e of this.flushResolvers)e();this.flushResolvers=[]}}async drain(){if(this.draining||this.closed)return;this.draining=!0;let e=0;try{for(;this.pending.length>0&&!this.closed;){let t=this.takeBatch();if(t.length!==0){try{await this.config.send(t),e=0}catch(n){if(e++,this.config.maxConsecutiveFailures!==void 0&&e>=this.config.maxConsecutiveFailures){this.droppedBatches++,this.config.onBatchDropped?.(t.length,e),e=0,this.releaseBackpressure();continue}this.pending=t.concat(this.pending);let r=n instanceof T?n.retryAfterMs:void 0;await this.sleep(this.retryDelay(e,r));continue}this.releaseBackpressure()}}}finally{if(this.draining=!1,this.pending.length===0){for(let e of this.flushResolvers)e();this.flushResolvers=[]}}}takeBatch(){let{maxBatchSize:e,maxBatchBytes:t}=this.config;if(t===void 0)return this.pending.splice(0,e);let n=0,r=0;for(;r<this.pending.length&&r<e;){let e;try{e=Buffer.byteLength(i(this.pending[r]))}catch{this.pending.splice(r,1);continue}if(r>0&&n+e>t)break;n+=e,r++}return this.pending.splice(0,r)}retryDelay(e,t){let n=Math.random()*this.config.jitterMs;return t===void 0?Math.min(this.config.baseDelayMs*2**(e-1),this.config.maxDelayMs)+n:Math.max(this.config.baseDelayMs,Math.min(t,this.config.maxDelayMs))+n}releaseBackpressure(){let e=this.backpressureResolvers;this.backpressureResolvers=[];for(let t of e)t()}sleep(e){return new Promise(t=>{this.sleepResolve=t,setTimeout((e,t)=>{e.sleepResolve=null,t()},e,this,t)})}};e();var D=class{constructor(e){t(this,`inflight`,null),t(this,`pending`,null),t(this,`closed`,!1),t(this,`config`,void 0),this.config=e}enqueue(e){this.closed||(this.pending=this.pending?O(this.pending,e):e,this.drain())}close(){this.closed=!0,this.pending=null}async drain(){if(this.inflight||this.closed||!this.pending)return;let e=this.pending;this.pending=null,this.inflight=this.sendWithRetry(e).then(()=>{this.inflight=null,this.pending&&!this.closed&&this.drain()})}async sendWithRetry(e){let t=e,n=0;for(;!this.closed;){if(await this.config.send(t))return;n++,await h(this.retryDelay(n)),this.pending&&!this.closed&&(t=O(t,this.pending),this.pending=null)}}retryDelay(e){return Math.min(this.config.baseDelayMs*2**(e-1),this.config.maxDelayMs)+Math.random()*this.config.jitterMs}};function O(e,t){let n={...e};for(let[e,r]of Object.entries(t))(e===`external_metadata`||e===`internal_metadata`)&&n[e]&&typeof n[e]==`object`&&typeof r==`object`&&r?n[e]={...n[e],...r}:n[e]=r;return n}g(),e();var k=2e4,A=100;function j(){return!0}var M=class extends Error{constructor(e){super(`CCRClient init failed: ${e}`),this.reason=e}},N=10;function P(){return{byMessage:new Map,scopeToMessage:new Map}}function F(e){return`${e.session_id}:${e.parent_tool_use_id??``}`}function I(e,t){let n=[],r=new Map;for(let i of e){let e=i.event;switch(e.type){case`message_start`:{let r=e.message.id,a=t.scopeToMessage.get(F(i));a&&t.byMessage.delete(a),t.scopeToMessage.set(F(i),r),t.byMessage.set(r,[]),n.push(i);break}case`content_block_delta`:{let a=e.delta;if(a.type!==`text_delta`){n.push(i);break}let o=t.scopeToMessage.get(F(i)),s=o?t.byMessage.get(o):void 0;if(!s){n.push(i);break}let c=e.index,l=s[c]??(s[c]=[]);l.push(a.text);let u=r.get(l);if(u){u.event.delta={type:`text_delta`,text:l.join(``)};break}let d={type:`stream_event`,uuid:i.uuid,session_id:i.session_id,parent_tool_use_id:i.parent_tool_use_id,event:{type:`content_block_delta`,index:c,delta:{type:`text_delta`,text:l.join(``)}}};r.set(l,d),n.push(d);break}default:n.push(i)}}return n}function L(e,t){e.byMessage.delete(t.message.id);let n=F(t);e.scopeToMessage.get(n)===t.message.id&&e.scopeToMessage.delete(n)}var R=class{constructor(e,n,r){if(t(this,`workerEpoch`,0),t(this,`heartbeatIntervalMs`,void 0),t(this,`heartbeatJitterFraction`,void 0),t(this,`heartbeatTimer`,null),t(this,`heartbeatInFlight`,!1),t(this,`closed`,!1),t(this,`consecutiveAuthFailures`,0),t(this,`currentState`,null),t(this,`sessionBaseUrl`,void 0),t(this,`sessionId`,void 0),t(this,`http`,p({keepAlive:!0})),t(this,`streamEventBuffer`,[]),t(this,`streamEventTimer`,null),t(this,`streamTextAccumulator`,P()),t(this,`workerState`,void 0),t(this,`eventUploader`,void 0),t(this,`internalEventUploader`,void 0),t(this,`deliveryUploader`,void 0),t(this,`onEpochMismatch`,void 0),t(this,`getAuthHeaders`,void 0),this.onEpochMismatch=r?.onEpochMismatch??(()=>{process.exit(1)}),this.heartbeatIntervalMs=r?.heartbeatIntervalMs??k,this.heartbeatJitterFraction=r?.heartbeatJitterFraction??0,this.getAuthHeaders=r?.getAuthHeaders??v,n.protocol!==`http:`&&n.protocol!==`https:`)throw Error(`CCRClient: Expected http(s) URL, got ${n.protocol}`);let i=n.pathname.replace(/\/$/,``);this.sessionBaseUrl=`${n.protocol}//${n.host}${i}`,this.sessionId=i.split(`/`).pop()||``,this.workerState=new D({send:e=>this.request(`put`,`/worker`,{worker_epoch:this.workerEpoch,...e},`PUT worker`).then(e=>e.ok),baseDelayMs:500,maxDelayMs:3e4,jitterMs:500}),this.eventUploader=new E({maxBatchSize:100,maxBatchBytes:10*1024*1024,maxQueueSize:1e5,send:async e=>{let t=await this.request(`post`,`/worker/events`,{worker_epoch:this.workerEpoch,events:e},`client events`);if(!t.ok)throw new T(`client event POST failed`,t.retryAfterMs)},baseDelayMs:500,maxDelayMs:3e4,jitterMs:500}),this.internalEventUploader=new E({maxBatchSize:100,maxBatchBytes:10*1024*1024,maxQueueSize:200,send:async e=>{let t=await this.request(`post`,`/worker/internal-events`,{worker_epoch:this.workerEpoch,events:e},`internal events`);if(!t.ok)throw new T(`internal event POST failed`,t.retryAfterMs)},baseDelayMs:500,maxDelayMs:3e4,jitterMs:500}),this.deliveryUploader=new E({maxBatchSize:64,maxQueueSize:64,send:async e=>{let t=await this.request(`post`,`/worker/events/delivery`,{worker_epoch:this.workerEpoch,updates:e.map(e=>({event_id:e.eventId,status:e.status}))},`delivery batch`);if(!t.ok)throw new T(`delivery POST failed`,t.retryAfterMs)},baseDelayMs:500,maxDelayMs:3e4,jitterMs:500}),e.setOnEvent(e=>{this.reportDelivery(e.event_id,`received`)})}async initialize(e){let t=Date.now();if(Object.keys(this.getAuthHeaders()).length===0)throw new M(`no_auth_headers`);if(e===void 0){let t=process.env.CLAUDE_CODE_WORKER_EPOCH;e=t?parseInt(t,10):NaN}if(isNaN(e))throw new M(`missing_epoch`);this.workerEpoch=e;let n=this.getWorkerState();if(!(await this.request(`put`,`/worker`,{worker_status:`idle`,worker_epoch:this.workerEpoch,external_metadata:{pending_action:null,task_summary:null,automation_state:null}},`PUT worker (init)`)).ok)throw new M(`worker_register_failed`);this.currentState=`idle`,this.startHeartbeat(),b(()=>{this.writeEvent({type:`keep_alive`})}),c(`CCRClient: initialized, epoch=${this.workerEpoch}`),d(`info`,`cli_worker_lifecycle_initialized`,{epoch:this.workerEpoch,duration_ms:Date.now()-t});let{metadata:r,durationMs:i}=await n;return this.closed||d(`info`,`cli_worker_state_restored`,{duration_ms:i,had_state:r!==null}),r}async getWorkerState(){let e=Date.now(),t=this.getAuthHeaders();return Object.keys(t).length===0?{metadata:null,durationMs:0}:{metadata:(await this.getWithRetry(`${this.sessionBaseUrl}/worker`,t,`worker_state`))?.worker?.external_metadata??null,durationMs:Date.now()-e}}async request(e,t,r,i,{timeout:s=1e4}={}){let l=this.getAuthHeaders();if(Object.keys(l).length===0)return{ok:!1};try{let a=await this.http[e](`${this.sessionBaseUrl}${t}`,r,{headers:{...l,"Content-Type":`application/json`,"anthropic-version":`2023-06-01`,"User-Agent":n()},validateStatus:j,timeout:s});if(a.status>=200&&a.status<300)return this.consecutiveAuthFailures=0,{ok:!0};if(a.status===409&&this.handleEpochMismatch(),a.status===401||a.status===403){let e=_(),t=e?C(e):null;t!==null&&t*1e3<Date.now()&&(c(`CCRClient: session_token expired (exp=${new Date(t*1e3).toISOString()}) — no refresh was delivered, exiting`,{level:`error`}),d(`error`,`cli_worker_token_expired_no_refresh`),this.onEpochMismatch()),this.consecutiveAuthFailures++,this.consecutiveAuthFailures>=N&&(c(`CCRClient: ${this.consecutiveAuthFailures} consecutive auth failures with a valid-looking token — server-side auth unrecoverable, exiting`,{level:`error`}),d(`error`,`cli_worker_auth_failures_exhausted`),this.onEpochMismatch())}if(c(`CCRClient: ${i} returned ${a.status}`,{level:`warn`}),d(`warn`,`cli_worker_request_failed`,{method:e,path:t,status:a.status}),a.status===429){let e=a.headers?.[`retry-after`],t=typeof e==`string`?parseInt(e,10):NaN;if(!isNaN(t)&&t>=0)return{ok:!1,retryAfterMs:t*1e3}}return{ok:!1}}catch(n){return c(`CCRClient: ${i} failed: ${a(n)}`,{level:`warn`}),d(`warn`,`cli_worker_request_error`,{method:e,path:t,error_code:o(n)}),{ok:!1}}}reportState(e,t){e===this.currentState&&!t||(this.currentState=e,this.workerState.enqueue({worker_status:e,requires_action_details:t?{tool_name:t.tool_name,action_description:t.action_description,request_id:t.request_id}:null}))}reportMetadata(e){this.workerState.enqueue({external_metadata:e})}handleEpochMismatch(){c(`CCRClient: Epoch mismatch (409), shutting down`,{level:`error`}),d(`error`,`cli_worker_epoch_mismatch`),this.onEpochMismatch()}startHeartbeat(){this.stopHeartbeat();let e=()=>{let e=this.heartbeatIntervalMs*this.heartbeatJitterFraction*(2*Math.random()-1);this.heartbeatTimer=setTimeout(t,this.heartbeatIntervalMs+e)},t=()=>{this.sendHeartbeat(),this.heartbeatTimer!==null&&e()};e()}stopHeartbeat(){this.heartbeatTimer&&(clearTimeout(this.heartbeatTimer),this.heartbeatTimer=null)}async sendHeartbeat(){if(!this.heartbeatInFlight){this.heartbeatInFlight=!0;try{(await this.request(`post`,`/worker/heartbeat`,{session_id:this.sessionId,worker_epoch:this.workerEpoch},`Heartbeat`,{timeout:5e3})).ok&&c(`CCRClient: Heartbeat sent`)}finally{this.heartbeatInFlight=!1}}}async writeEvent(e){if(e.type===`stream_event`){this.streamEventBuffer.push(e),this.streamEventTimer||(this.streamEventTimer=setTimeout(()=>void this.flushStreamEventBuffer(),A));return}await this.flushStreamEventBuffer(),e.type===`assistant`&&L(this.streamTextAccumulator,e),await this.eventUploader.enqueue(this.toClientEvent(e))}toClientEvent(e){let t=e;return{payload:{...t,uuid:typeof t.uuid==`string`?t.uuid:w()}}}async flushStreamEventBuffer(){if(this.streamEventTimer&&(clearTimeout(this.streamEventTimer),this.streamEventTimer=null),this.streamEventBuffer.length===0)return;let e=this.streamEventBuffer;this.streamEventBuffer=[];let t=I(e,this.streamTextAccumulator);await this.eventUploader.enqueue(t.map(e=>({payload:e,ephemeral:!0})))}async writeInternalEvent(e,t,{isCompaction:n=!1,agentId:r}={}){let i={payload:{type:e,...t,uuid:typeof t.uuid==`string`?t.uuid:w()},...n&&{is_compaction:!0},...r&&{agent_id:r}};await this.internalEventUploader.enqueue(i)}flushInternalEvents(){return this.internalEventUploader.flush()}async flush(){return await this.flushStreamEventBuffer(),this.eventUploader.flush()}async readInternalEvents(){return this.paginatedGet(`/worker/internal-events`,{},`internal_events`)}async readSubagentInternalEvents(){return this.paginatedGet(`/worker/internal-events`,{subagents:`true`},`subagent_events`)}async paginatedGet(e,t,n){let r=this.getAuthHeaders();if(Object.keys(r).length===0)return null;let i=[],a;do{let o=new URL(`${this.sessionBaseUrl}${e}`);for(let[e,n]of Object.entries(t))o.searchParams.set(e,n);a&&o.searchParams.set(`cursor`,a);let s=await this.getWithRetry(o.toString(),r,n);if(!s)return null;i.push(...s.data??[]),a=s.next_cursor}while(a);return c(`CCRClient: Read ${i.length} internal events from ${e}${t.subagents?` (subagents)`:``}`),i}async getWithRetry(e,t,r){for(let r=1;r<=10;r++){let i;try{i=await this.http.get(e,{headers:{...t,"anthropic-version":`2023-06-01`,"User-Agent":n()},validateStatus:j,timeout:3e4})}catch(t){c(`CCRClient: GET ${e} failed (attempt ${r}/10): ${a(t)}`,{level:`warn`}),r<10&&await h(Math.min(500*2**(r-1),3e4)+Math.random()*500);continue}if(i.status>=200&&i.status<300)return i.data;i.status===409&&this.handleEpochMismatch(),c(`CCRClient: GET ${e} returned ${i.status} (attempt ${r}/10)`,{level:`warn`}),r<10&&await h(Math.min(500*2**(r-1),3e4)+Math.random()*500)}return c(`CCRClient: GET retries exhausted`,{level:`error`}),d(`error`,`cli_worker_get_retries_exhausted`,{context:r}),null}reportDelivery(e,t){this.deliveryUploader.enqueue({eventId:e,status:t})}getWorkerEpoch(){return this.workerEpoch}get internalEventsPending(){return this.internalEventUploader.pendingCount}close(){this.closed=!0,this.stopHeartbeat(),x(),this.streamEventTimer&&(clearTimeout(this.streamEventTimer),this.streamEventTimer=null),this.streamEventBuffer=[],this.streamTextAccumulator.byMessage.clear(),this.streamTextAccumulator.scopeToMessage.clear(),this.workerState.close(),this.eventUploader.close(),this.internalEventUploader.close(),this.deliveryUploader.close()}};export{M as n,E as r,R as t};
1
+ import{n as e,t}from"./defineProperty-80gRi2ZW.js";import{At as n,jt as r}from"./paths-BBvuDQl9.js";import{E as i,L as a,R as o,V as s,d as c,s as l,w as u}from"./debug-UI3T040K.js";import{F as d,P as f}from"./git-CN3qtTb_.js";import{r as p,u as m}from"./proxy-CfZp-wce.js";import{n as h,t as g}from"./sleep-8Eb9j_Ly.js";import{D as _,E as v,O as y,a as b,l as x,r as S}from"./rcDebugLog-CPKZCtR8.js";import{n as C}from"./jwtUtils-CpXwh_du.js";import{randomUUID as w}from"crypto";s(),l(),f(),m(),g(),r(),y(),S(),u(),e();var T=class extends Error{constructor(e,t){super(e),this.retryAfterMs=t}},E=class{constructor(e){t(this,`pending`,[]),t(this,`pendingAtClose`,0),t(this,`draining`,!1),t(this,`closed`,!1),t(this,`backpressureResolvers`,[]),t(this,`sleepResolve`,null),t(this,`flushResolvers`,[]),t(this,`droppedBatches`,0),t(this,`config`,void 0),this.config=e}get droppedBatchCount(){return this.droppedBatches}get pendingCount(){return this.closed?this.pendingAtClose:this.pending.length}async enqueue(e){if(this.closed)return;let t=Array.isArray(e)?e:[e];if(t.length!==0){for(;this.pending.length+t.length>this.config.maxQueueSize&&!this.closed;)await new Promise(e=>{this.backpressureResolvers.push(e)});this.closed||(this.pending.push(...t),this.drain())}}flush(){return this.pending.length===0&&!this.draining?Promise.resolve():(this.drain(),new Promise(e=>{this.flushResolvers.push(e)}))}close(){if(!this.closed){this.closed=!0,this.pendingAtClose=this.pending.length,this.pending=[],this.sleepResolve?.(),this.sleepResolve=null;for(let e of this.backpressureResolvers)e();this.backpressureResolvers=[];for(let e of this.flushResolvers)e();this.flushResolvers=[]}}async drain(){if(this.draining||this.closed)return;this.draining=!0;let e=0;try{for(;this.pending.length>0&&!this.closed;){let t=this.takeBatch();if(t.length!==0){try{await this.config.send(t),e=0}catch(n){if(e++,this.config.maxConsecutiveFailures!==void 0&&e>=this.config.maxConsecutiveFailures){this.droppedBatches++,this.config.onBatchDropped?.(t.length,e),e=0,this.releaseBackpressure();continue}this.pending=t.concat(this.pending);let r=n instanceof T?n.retryAfterMs:void 0;await this.sleep(this.retryDelay(e,r));continue}this.releaseBackpressure()}}}finally{if(this.draining=!1,this.pending.length===0){for(let e of this.flushResolvers)e();this.flushResolvers=[]}}}takeBatch(){let{maxBatchSize:e,maxBatchBytes:t}=this.config;if(t===void 0)return this.pending.splice(0,e);let n=0,r=0;for(;r<this.pending.length&&r<e;){let e;try{e=Buffer.byteLength(i(this.pending[r]))}catch{this.pending.splice(r,1);continue}if(r>0&&n+e>t)break;n+=e,r++}return this.pending.splice(0,r)}retryDelay(e,t){let n=Math.random()*this.config.jitterMs;return t===void 0?Math.min(this.config.baseDelayMs*2**(e-1),this.config.maxDelayMs)+n:Math.max(this.config.baseDelayMs,Math.min(t,this.config.maxDelayMs))+n}releaseBackpressure(){let e=this.backpressureResolvers;this.backpressureResolvers=[];for(let t of e)t()}sleep(e){return new Promise(t=>{this.sleepResolve=t,setTimeout((e,t)=>{e.sleepResolve=null,t()},e,this,t)})}};e();var D=class{constructor(e){t(this,`inflight`,null),t(this,`pending`,null),t(this,`closed`,!1),t(this,`config`,void 0),this.config=e}enqueue(e){this.closed||(this.pending=this.pending?O(this.pending,e):e,this.drain())}close(){this.closed=!0,this.pending=null}async drain(){if(this.inflight||this.closed||!this.pending)return;let e=this.pending;this.pending=null,this.inflight=this.sendWithRetry(e).then(()=>{this.inflight=null,this.pending&&!this.closed&&this.drain()})}async sendWithRetry(e){let t=e,n=0;for(;!this.closed;){if(await this.config.send(t))return;n++,await h(this.retryDelay(n)),this.pending&&!this.closed&&(t=O(t,this.pending),this.pending=null)}}retryDelay(e){return Math.min(this.config.baseDelayMs*2**(e-1),this.config.maxDelayMs)+Math.random()*this.config.jitterMs}};function O(e,t){let n={...e};for(let[e,r]of Object.entries(t))(e===`external_metadata`||e===`internal_metadata`)&&n[e]&&typeof n[e]==`object`&&typeof r==`object`&&r?n[e]={...n[e],...r}:n[e]=r;return n}g(),e();var k=2e4,A=100;function j(){return!0}var M=class extends Error{constructor(e){super(`CCRClient init failed: ${e}`),this.reason=e}},N=10;function P(){return{byMessage:new Map,scopeToMessage:new Map}}function F(e){return`${e.session_id}:${e.parent_tool_use_id??``}`}function I(e,t){let n=[],r=new Map;for(let i of e){let e=i.event;switch(e.type){case`message_start`:{let r=e.message.id,a=t.scopeToMessage.get(F(i));a&&t.byMessage.delete(a),t.scopeToMessage.set(F(i),r),t.byMessage.set(r,[]),n.push(i);break}case`content_block_delta`:{let a=e.delta;if(a.type!==`text_delta`){n.push(i);break}let o=t.scopeToMessage.get(F(i)),s=o?t.byMessage.get(o):void 0;if(!s){n.push(i);break}let c=e.index,l=s[c]??(s[c]=[]);l.push(a.text);let u=r.get(l);if(u){u.event.delta={type:`text_delta`,text:l.join(``)};break}let d={type:`stream_event`,uuid:i.uuid,session_id:i.session_id,parent_tool_use_id:i.parent_tool_use_id,event:{type:`content_block_delta`,index:c,delta:{type:`text_delta`,text:l.join(``)}}};r.set(l,d),n.push(d);break}default:n.push(i)}}return n}function L(e,t){e.byMessage.delete(t.message.id);let n=F(t);e.scopeToMessage.get(n)===t.message.id&&e.scopeToMessage.delete(n)}var R=class{constructor(e,n,r){if(t(this,`workerEpoch`,0),t(this,`heartbeatIntervalMs`,void 0),t(this,`heartbeatJitterFraction`,void 0),t(this,`heartbeatTimer`,null),t(this,`heartbeatInFlight`,!1),t(this,`closed`,!1),t(this,`consecutiveAuthFailures`,0),t(this,`currentState`,null),t(this,`sessionBaseUrl`,void 0),t(this,`sessionId`,void 0),t(this,`http`,p({keepAlive:!0})),t(this,`streamEventBuffer`,[]),t(this,`streamEventTimer`,null),t(this,`streamTextAccumulator`,P()),t(this,`workerState`,void 0),t(this,`eventUploader`,void 0),t(this,`internalEventUploader`,void 0),t(this,`deliveryUploader`,void 0),t(this,`onEpochMismatch`,void 0),t(this,`getAuthHeaders`,void 0),this.onEpochMismatch=r?.onEpochMismatch??(()=>{process.exit(1)}),this.heartbeatIntervalMs=r?.heartbeatIntervalMs??k,this.heartbeatJitterFraction=r?.heartbeatJitterFraction??0,this.getAuthHeaders=r?.getAuthHeaders??v,n.protocol!==`http:`&&n.protocol!==`https:`)throw Error(`CCRClient: Expected http(s) URL, got ${n.protocol}`);let i=n.pathname.replace(/\/$/,``);this.sessionBaseUrl=`${n.protocol}//${n.host}${i}`,this.sessionId=i.split(`/`).pop()||``,this.workerState=new D({send:e=>this.request(`put`,`/worker`,{worker_epoch:this.workerEpoch,...e},`PUT worker`).then(e=>e.ok),baseDelayMs:500,maxDelayMs:3e4,jitterMs:500}),this.eventUploader=new E({maxBatchSize:100,maxBatchBytes:10*1024*1024,maxQueueSize:1e5,send:async e=>{let t=await this.request(`post`,`/worker/events`,{worker_epoch:this.workerEpoch,events:e},`client events`);if(!t.ok)throw new T(`client event POST failed`,t.retryAfterMs)},baseDelayMs:500,maxDelayMs:3e4,jitterMs:500}),this.internalEventUploader=new E({maxBatchSize:100,maxBatchBytes:10*1024*1024,maxQueueSize:200,send:async e=>{let t=await this.request(`post`,`/worker/internal-events`,{worker_epoch:this.workerEpoch,events:e},`internal events`);if(!t.ok)throw new T(`internal event POST failed`,t.retryAfterMs)},baseDelayMs:500,maxDelayMs:3e4,jitterMs:500}),this.deliveryUploader=new E({maxBatchSize:64,maxQueueSize:64,send:async e=>{let t=await this.request(`post`,`/worker/events/delivery`,{worker_epoch:this.workerEpoch,updates:e.map(e=>({event_id:e.eventId,status:e.status}))},`delivery batch`);if(!t.ok)throw new T(`delivery POST failed`,t.retryAfterMs)},baseDelayMs:500,maxDelayMs:3e4,jitterMs:500}),e.setOnEvent(e=>{this.reportDelivery(e.event_id,`received`)})}async initialize(e){let t=Date.now();if(Object.keys(this.getAuthHeaders()).length===0)throw new M(`no_auth_headers`);if(e===void 0){let t=process.env.CLAUDE_CODE_WORKER_EPOCH;e=t?parseInt(t,10):NaN}if(isNaN(e))throw new M(`missing_epoch`);this.workerEpoch=e;let n=this.getWorkerState();if(!(await this.request(`put`,`/worker`,{worker_status:`idle`,worker_epoch:this.workerEpoch,external_metadata:{pending_action:null,task_summary:null,automation_state:null}},`PUT worker (init)`)).ok)throw new M(`worker_register_failed`);this.currentState=`idle`,this.startHeartbeat(),b(()=>{this.writeEvent({type:`keep_alive`})}),c(`CCRClient: initialized, epoch=${this.workerEpoch}`),d(`info`,`cli_worker_lifecycle_initialized`,{epoch:this.workerEpoch,duration_ms:Date.now()-t});let{metadata:r,durationMs:i}=await n;return this.closed||d(`info`,`cli_worker_state_restored`,{duration_ms:i,had_state:r!==null}),r}async getWorkerState(){let e=Date.now(),t=this.getAuthHeaders();return Object.keys(t).length===0?{metadata:null,durationMs:0}:{metadata:(await this.getWithRetry(`${this.sessionBaseUrl}/worker`,t,`worker_state`))?.worker?.external_metadata??null,durationMs:Date.now()-e}}async request(e,t,r,i,{timeout:s=1e4}={}){let l=this.getAuthHeaders();if(Object.keys(l).length===0)return{ok:!1};try{let a=await this.http[e](`${this.sessionBaseUrl}${t}`,r,{headers:{...l,"Content-Type":`application/json`,"anthropic-version":`2023-06-01`,"User-Agent":n()},validateStatus:j,timeout:s});if(a.status>=200&&a.status<300)return this.consecutiveAuthFailures=0,{ok:!0};if(a.status===409&&this.handleEpochMismatch(),a.status===401||a.status===403){let e=_(),t=e?C(e):null;t!==null&&t*1e3<Date.now()&&(c(`CCRClient: session_token expired (exp=${new Date(t*1e3).toISOString()}) — no refresh was delivered, exiting`,{level:`error`}),d(`error`,`cli_worker_token_expired_no_refresh`),this.onEpochMismatch()),this.consecutiveAuthFailures++,this.consecutiveAuthFailures>=N&&(c(`CCRClient: ${this.consecutiveAuthFailures} consecutive auth failures with a valid-looking token — server-side auth unrecoverable, exiting`,{level:`error`}),d(`error`,`cli_worker_auth_failures_exhausted`),this.onEpochMismatch())}if(c(`CCRClient: ${i} returned ${a.status}`,{level:`warn`}),d(`warn`,`cli_worker_request_failed`,{method:e,path:t,status:a.status}),a.status===429){let e=a.headers?.[`retry-after`],t=typeof e==`string`?parseInt(e,10):NaN;if(!isNaN(t)&&t>=0)return{ok:!1,retryAfterMs:t*1e3}}return{ok:!1}}catch(n){return c(`CCRClient: ${i} failed: ${a(n)}`,{level:`warn`}),d(`warn`,`cli_worker_request_error`,{method:e,path:t,error_code:o(n)}),{ok:!1}}}reportState(e,t){e===this.currentState&&!t||(this.currentState=e,this.workerState.enqueue({worker_status:e,requires_action_details:t?{tool_name:t.tool_name,action_description:t.action_description,request_id:t.request_id}:null}))}reportMetadata(e){this.workerState.enqueue({external_metadata:e})}handleEpochMismatch(){c(`CCRClient: Epoch mismatch (409), shutting down`,{level:`error`}),d(`error`,`cli_worker_epoch_mismatch`),this.onEpochMismatch()}startHeartbeat(){this.stopHeartbeat();let e=()=>{let e=this.heartbeatIntervalMs*this.heartbeatJitterFraction*(2*Math.random()-1);this.heartbeatTimer=setTimeout(t,this.heartbeatIntervalMs+e)},t=()=>{this.sendHeartbeat(),this.heartbeatTimer!==null&&e()};e()}stopHeartbeat(){this.heartbeatTimer&&(clearTimeout(this.heartbeatTimer),this.heartbeatTimer=null)}async sendHeartbeat(){if(!this.heartbeatInFlight){this.heartbeatInFlight=!0;try{(await this.request(`post`,`/worker/heartbeat`,{session_id:this.sessionId,worker_epoch:this.workerEpoch},`Heartbeat`,{timeout:5e3})).ok&&c(`CCRClient: Heartbeat sent`)}finally{this.heartbeatInFlight=!1}}}async writeEvent(e){if(e.type===`stream_event`){this.streamEventBuffer.push(e),this.streamEventTimer||(this.streamEventTimer=setTimeout(()=>void this.flushStreamEventBuffer(),A));return}await this.flushStreamEventBuffer(),e.type===`assistant`&&L(this.streamTextAccumulator,e),await this.eventUploader.enqueue(this.toClientEvent(e))}toClientEvent(e){let t=e;return{payload:{...t,uuid:typeof t.uuid==`string`?t.uuid:w()}}}async flushStreamEventBuffer(){if(this.streamEventTimer&&(clearTimeout(this.streamEventTimer),this.streamEventTimer=null),this.streamEventBuffer.length===0)return;let e=this.streamEventBuffer;this.streamEventBuffer=[];let t=I(e,this.streamTextAccumulator);await this.eventUploader.enqueue(t.map(e=>({payload:e,ephemeral:!0})))}async writeInternalEvent(e,t,{isCompaction:n=!1,agentId:r}={}){let i={payload:{type:e,...t,uuid:typeof t.uuid==`string`?t.uuid:w()},...n&&{is_compaction:!0},...r&&{agent_id:r}};await this.internalEventUploader.enqueue(i)}flushInternalEvents(){return this.internalEventUploader.flush()}async flush(){return await this.flushStreamEventBuffer(),this.eventUploader.flush()}async readInternalEvents(){return this.paginatedGet(`/worker/internal-events`,{},`internal_events`)}async readSubagentInternalEvents(){return this.paginatedGet(`/worker/internal-events`,{subagents:`true`},`subagent_events`)}async paginatedGet(e,t,n){let r=this.getAuthHeaders();if(Object.keys(r).length===0)return null;let i=[],a;do{let o=new URL(`${this.sessionBaseUrl}${e}`);for(let[e,n]of Object.entries(t))o.searchParams.set(e,n);a&&o.searchParams.set(`cursor`,a);let s=await this.getWithRetry(o.toString(),r,n);if(!s)return null;i.push(...s.data??[]),a=s.next_cursor}while(a);return c(`CCRClient: Read ${i.length} internal events from ${e}${t.subagents?` (subagents)`:``}`),i}async getWithRetry(e,t,r){for(let r=1;r<=10;r++){let i;try{i=await this.http.get(e,{headers:{...t,"anthropic-version":`2023-06-01`,"User-Agent":n()},validateStatus:j,timeout:3e4})}catch(t){c(`CCRClient: GET ${e} failed (attempt ${r}/10): ${a(t)}`,{level:`warn`}),r<10&&await h(Math.min(500*2**(r-1),3e4)+Math.random()*500);continue}if(i.status>=200&&i.status<300)return i.data;i.status===409&&this.handleEpochMismatch(),c(`CCRClient: GET ${e} returned ${i.status} (attempt ${r}/10)`,{level:`warn`}),r<10&&await h(Math.min(500*2**(r-1),3e4)+Math.random()*500)}return c(`CCRClient: GET retries exhausted`,{level:`error`}),d(`error`,`cli_worker_get_retries_exhausted`,{context:r}),null}reportDelivery(e,t){this.deliveryUploader.enqueue({eventId:e,status:t})}getWorkerEpoch(){return this.workerEpoch}get internalEventsPending(){return this.internalEventUploader.pendingCount}close(){this.closed=!0,this.stopHeartbeat(),x(),this.streamEventTimer&&(clearTimeout(this.streamEventTimer),this.streamEventTimer=null),this.streamEventBuffer=[],this.streamTextAccumulator.byMessage.clear(),this.streamTextAccumulator.scopeToMessage.clear(),this.workerState.close(),this.eventUploader.close(),this.internalEventUploader.close(),this.deliveryUploader.close()}};export{M as n,E as r,R as t};
@@ -0,0 +1 @@
1
+ import{fA as e,gA as t}from"./loadAgentsDir-DI1a76pd.js";e();export{t as settingsChangeDetector};
@@ -1 +1 @@
1
- import{n as e}from"./chunk-DR8-3Aex.js";import{Ln as t,Mn as n,Tt as r,un as i,vt as a,wn as o}from"./schemas-BGAvj1T4.js";import{t as s}from"./v4-f1i_CNUT.js";import{cn as c,y as l}from"./state-sIHsFpDu.js";import{S as u,_ as d}from"./paths-Q2255dD7.js";import{E as f,et as p}from"./log-CzsijfHZ.js";import{n as m,t as h}from"./lazySchema-2sOku3cX.js";import{i as g,n as _,o as v,p as y,r as b}from"./xml-DD_ldd3X.js";function x(){let e=d(`tengu_harbor_ledger`,[]),t=w().safeParse(e);return t.success?t.data:[]}function S(){return!0}function C(e){if(!e)return!1;let{name:t,marketplace:n}=v(e);return n?n===`builtin`&&t===`weixin`?!0:x().some(e=>e.plugin===t&&e.marketplace===n):!1}var w,T=e((()=>{s(),y(),h(),g(),u(),w=m(()=>r(o({marketplace:t(),plugin:t()})))}));function E(e,t,n){let r=Object.entries(n??{}).filter(([e])=>P.test(e)).map(([e,t])=>` ${e}="${_(t)}"`).join(``);return`<${f} source="${_(e)}"${r}>\n${t}\n</${f}>`}function D(e,t){let n=e.split(`:`);return t.find(t=>t.kind===`server`?e===t.name:n[0]===`plugin`&&n[1]===t.name)}function O(e,t,n){if(!t?.experimental?.[`claude/channel`])return{action:`skip`,kind:`capability`,reason:`server did not declare claude/channel capability`};let r=D(e,l());if(!r)return{action:`skip`,kind:`session`,reason:`server ${e} not in --channels list for this session`};if(r.kind===`plugin`){let e=n?v(n).marketplace:void 0;if(e!==r.marketplace)return{action:`skip`,kind:`marketplace`,reason:`you asked for plugin:${r.name}@${r.marketplace} but the installed ${r.name} plugin is from ${e??`an unknown source`}`}}return{action:`register`}}var k,A,j,M,N,P,F=e((()=>{s(),c(),p(),h(),g(),b(),T(),k=m(()=>o({method:i(`notifications/claude/channel`),params:o({content:t(),meta:n(t(),t()).optional()})})),A=`notifications/claude/channel/permission`,j=m(()=>o({method:i(A),params:o({request_id:t(),behavior:a([`allow`,`deny`])})})),M=`notifications/claude/channel/permission_request`,N=m(()=>o({method:i(M),params:o({request_id:t(),tool_name:t(),description:t(),input_preview:t(),channel_context:o({source_server:t().optional(),chat_id:t().optional()}).optional()})})),P=/^[a-zA-Z_][a-zA-Z0-9_]*$/}));export{N as a,F as c,C as d,S as f,j as i,E as l,M as n,D as o,k as r,O as s,A as t,T as u};
1
+ import{n as e}from"./chunk-DR8-3Aex.js";import{Ln as t,Mn as n,Tt as r,un as i,vt as a,wn as o}from"./schemas-BGAvj1T4.js";import{t as s}from"./v4-f1i_CNUT.js";import{cn as c,y as l}from"./state-sIHsFpDu.js";import{S as u,_ as d}from"./paths-BBvuDQl9.js";import{E as f,et as p}from"./log-CzsijfHZ.js";import{n as m,t as h}from"./lazySchema-2sOku3cX.js";import{i as g,n as _,o as v,p as y,r as b}from"./xml-Dx--sNE1.js";function x(){let e=d(`tengu_harbor_ledger`,[]),t=w().safeParse(e);return t.success?t.data:[]}function S(){return!0}function C(e){if(!e)return!1;let{name:t,marketplace:n}=v(e);return n?n===`builtin`&&t===`weixin`?!0:x().some(e=>e.plugin===t&&e.marketplace===n):!1}var w,T=e((()=>{s(),y(),h(),g(),u(),w=m(()=>r(o({marketplace:t(),plugin:t()})))}));function E(e,t,n){let r=Object.entries(n??{}).filter(([e])=>P.test(e)).map(([e,t])=>` ${e}="${_(t)}"`).join(``);return`<${f} source="${_(e)}"${r}>\n${t}\n</${f}>`}function D(e,t){let n=e.split(`:`);return t.find(t=>t.kind===`server`?e===t.name:n[0]===`plugin`&&n[1]===t.name)}function O(e,t,n){if(!t?.experimental?.[`claude/channel`])return{action:`skip`,kind:`capability`,reason:`server did not declare claude/channel capability`};let r=D(e,l());if(!r)return{action:`skip`,kind:`session`,reason:`server ${e} not in --channels list for this session`};if(r.kind===`plugin`){let e=n?v(n).marketplace:void 0;if(e!==r.marketplace)return{action:`skip`,kind:`marketplace`,reason:`you asked for plugin:${r.name}@${r.marketplace} but the installed ${r.name} plugin is from ${e??`an unknown source`}`}}return{action:`register`}}var k,A,j,M,N,P,F=e((()=>{s(),c(),p(),h(),g(),b(),T(),k=m(()=>o({method:i(`notifications/claude/channel`),params:o({content:t(),meta:n(t(),t()).optional()})})),A=`notifications/claude/channel/permission`,j=m(()=>o({method:i(A),params:o({request_id:t(),behavior:a([`allow`,`deny`])})})),M=`notifications/claude/channel/permission_request`,N=m(()=>o({method:i(M),params:o({request_id:t(),tool_name:t(),description:t(),input_preview:t(),channel_context:o({source_server:t().optional(),chat_id:t().optional()}).optional()})})),P=/^[a-zA-Z_][a-zA-Z0-9_]*$/}));export{N as a,F as c,C as d,S as f,j as i,E as l,M as n,D as o,k as r,O as s,A as t,T as u};
@@ -0,0 +1 @@
1
+ import{a as e,c as t}from"./channelNotification-B7A-9DIl.js";t();export{e as ChannelPermissionRequestNotificationSchema};
@@ -1 +1 @@
1
- import{n as e,o as t}from"./chunk-DR8-3Aex.js";import{f as n,s as r}from"./envUtils-BWeoiL4Y.js";import{Rn as i,b as a,f as o,t as s,x as c}from"./src-Di342QoJ.js";import{t as l}from"./jsx-runtime-D-D469L8.js";import{Ac as u,Pc as d,Sc as f,dn as p,on as m}from"./paths-Q2255dD7.js";import{a as h,n as g}from"./env-chR0gV31.js";import{Dx as _,MS as v,Ox as y,jS as b}from"./loadAgentsDir-Ci5mr0vm.js";import{n as x,t as S}from"./browser-fLRXxIsQ.js";import{c as C,d as w,t as T}from"./common-CMCv4N_v.js";import{n as E,t as D}from"./setup-BKUG46jQ.js";function O({onDone:e,isExtensionInstalled:t,configEnabled:r,isClaudeAISubscriber:i,isWSL:s}){let l=v(e=>e.mcp.clients),[u,f]=(0,k.useState)(0),[p,m]=(0,k.useState)(r??!1),[h,g]=(0,k.useState)(!1),[y,b]=(0,k.useState)(t),S=process.env.USER_TYPE===`ant`&&n(),C=l.find(e=>e.name===T)?.type===`connected`;function D(e){S?x(e):w(e)}function O(e){switch(e){case`install-extension`:f(e=>e+1),g(!0),D(j);break;case`reconnect`:f(e=>e+1),E().then(e=>{b(e),e&&g(!1)}),D(N);break;case`manage-permissions`:f(e=>e+1),D(M);break;case`toggle-default`:{let e=!p;d(t=>({...t,claudeInChromeDefaultEnabled:e})),m(e);break}}}let P=[],F=y?``:` (requires extension)`;!y&&!S&&P.push({label:`Install Chrome extension`,value:`install-extension`}),P.push({label:(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(a,{children:`Manage permissions`}),(0,A.jsx)(a,{dimColor:!0,children:F})]}),value:`manage-permissions`},{label:(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(a,{children:`Reconnect extension`}),(0,A.jsx)(a,{dimColor:!0,children:F})]}),value:`reconnect`},{label:`Enabled by default: ${p?`Yes`:`No`}`,value:`toggle-default`});let I=s||process.env.USER_TYPE!==`ant`&&!i;return(0,A.jsx)(o,{title:`Claude in Chrome (Beta)`,onCancel:()=>e(),color:`chromeYellow`,children:(0,A.jsxs)(c,{flexDirection:`column`,gap:1,children:[(0,A.jsx)(a,{children:`Claude in Chrome works with the Chrome extension to let you control your browser directly from Claude Code. Navigate websites, fill forms, capture screenshots, record GIFs, and debug with console logs and network requests.`}),s&&(0,A.jsx)(a,{color:`error`,children:`Claude in Chrome is not supported in WSL at this time.`}),process.env.USER_TYPE!==`ant`&&!i&&(0,A.jsx)(a,{color:`error`,children:`Claude in Chrome requires a claude.ai subscription.`}),!I&&(0,A.jsxs)(A.Fragment,{children:[!S&&(0,A.jsxs)(c,{flexDirection:`column`,children:[(0,A.jsxs)(a,{children:[`Status: `,C?(0,A.jsx)(a,{color:`success`,children:`Enabled`}):(0,A.jsx)(a,{color:`inactive`,children:`Disabled`})]}),(0,A.jsxs)(a,{children:[`Extension:`,` `,y?(0,A.jsx)(a,{color:`success`,children:`Installed`}):(0,A.jsx)(a,{color:`warning`,children:`Not detected`})]})]}),(0,A.jsx)(_,{options:P,onChange:O,hideIndexes:!0},u),h&&(0,A.jsxs)(a,{color:`warning`,children:[`Once installed, select `,`"Reconnect extension"`,` to connect.`]}),(0,A.jsxs)(a,{children:[(0,A.jsx)(a,{dimColor:!0,children:`Usage: `}),(0,A.jsx)(a,{children:`claude --chrome`}),(0,A.jsx)(a,{dimColor:!0,children:` or `}),(0,A.jsx)(a,{children:`claude --no-chrome`})]}),(0,A.jsx)(a,{dimColor:!0,children:`Site-level permissions are inherited from the Chrome extension. Manage permissions in the Chrome extension settings to control which sites Claude can browse, click, and type on.`})]}),(0,A.jsx)(a,{dimColor:!0,children:`Learn more: https://code.claude.com/docs/en/chrome`})]})})}var k,A,j,M,N,P;e((()=>{k=t(i(),1),y(),s(),b(),m(),S(),C(),D(),u(),h(),r(),A=l(),j=`https://claude.ai/chrome`,M=`https://clau.de/chrome/permissions`,N=`https://clau.de/chrome/reconnect`,P=async function(e){let t=await E(),n=f(),r=p(),i=g.isWslEnvironment();return(0,A.jsx)(O,{onDone:e,isExtensionInstalled:t,configEnabled:n.claudeInChromeDefaultEnabled,isClaudeAISubscriber:r,isWSL:i})}}))();export{P as call};
1
+ import{n as e,o as t}from"./chunk-DR8-3Aex.js";import{f as n,s as r}from"./envUtils-BWeoiL4Y.js";import{Rn as i,b as a,f as o,t as s,x as c}from"./src-Di342QoJ.js";import{t as l}from"./jsx-runtime-D-D469L8.js";import{Ac as u,Pc as d,Sc as f,dn as p,on as m}from"./paths-BBvuDQl9.js";import{a as h,n as g}from"./env-chR0gV31.js";import{Dx as _,MS as v,Ox as y,jS as b}from"./loadAgentsDir-DI1a76pd.js";import{n as x,t as S}from"./browser-fLRXxIsQ.js";import{c as C,d as w,t as T}from"./common-CMCv4N_v.js";import{n as E,t as D}from"./setup-B1JbPepL.js";function O({onDone:e,isExtensionInstalled:t,configEnabled:r,isClaudeAISubscriber:i,isWSL:s}){let l=v(e=>e.mcp.clients),[u,f]=(0,k.useState)(0),[p,m]=(0,k.useState)(r??!1),[h,g]=(0,k.useState)(!1),[y,b]=(0,k.useState)(t),S=process.env.USER_TYPE===`ant`&&n(),C=l.find(e=>e.name===T)?.type===`connected`;function D(e){S?x(e):w(e)}function O(e){switch(e){case`install-extension`:f(e=>e+1),g(!0),D(j);break;case`reconnect`:f(e=>e+1),E().then(e=>{b(e),e&&g(!1)}),D(N);break;case`manage-permissions`:f(e=>e+1),D(M);break;case`toggle-default`:{let e=!p;d(t=>({...t,claudeInChromeDefaultEnabled:e})),m(e);break}}}let P=[],F=y?``:` (requires extension)`;!y&&!S&&P.push({label:`Install Chrome extension`,value:`install-extension`}),P.push({label:(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(a,{children:`Manage permissions`}),(0,A.jsx)(a,{dimColor:!0,children:F})]}),value:`manage-permissions`},{label:(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(a,{children:`Reconnect extension`}),(0,A.jsx)(a,{dimColor:!0,children:F})]}),value:`reconnect`},{label:`Enabled by default: ${p?`Yes`:`No`}`,value:`toggle-default`});let I=s||process.env.USER_TYPE!==`ant`&&!i;return(0,A.jsx)(o,{title:`Claude in Chrome (Beta)`,onCancel:()=>e(),color:`chromeYellow`,children:(0,A.jsxs)(c,{flexDirection:`column`,gap:1,children:[(0,A.jsx)(a,{children:`Claude in Chrome works with the Chrome extension to let you control your browser directly from Claude Code. Navigate websites, fill forms, capture screenshots, record GIFs, and debug with console logs and network requests.`}),s&&(0,A.jsx)(a,{color:`error`,children:`Claude in Chrome is not supported in WSL at this time.`}),process.env.USER_TYPE!==`ant`&&!i&&(0,A.jsx)(a,{color:`error`,children:`Claude in Chrome requires a claude.ai subscription.`}),!I&&(0,A.jsxs)(A.Fragment,{children:[!S&&(0,A.jsxs)(c,{flexDirection:`column`,children:[(0,A.jsxs)(a,{children:[`Status: `,C?(0,A.jsx)(a,{color:`success`,children:`Enabled`}):(0,A.jsx)(a,{color:`inactive`,children:`Disabled`})]}),(0,A.jsxs)(a,{children:[`Extension:`,` `,y?(0,A.jsx)(a,{color:`success`,children:`Installed`}):(0,A.jsx)(a,{color:`warning`,children:`Not detected`})]})]}),(0,A.jsx)(_,{options:P,onChange:O,hideIndexes:!0},u),h&&(0,A.jsxs)(a,{color:`warning`,children:[`Once installed, select `,`"Reconnect extension"`,` to connect.`]}),(0,A.jsxs)(a,{children:[(0,A.jsx)(a,{dimColor:!0,children:`Usage: `}),(0,A.jsx)(a,{children:`claude --chrome`}),(0,A.jsx)(a,{dimColor:!0,children:` or `}),(0,A.jsx)(a,{children:`claude --no-chrome`})]}),(0,A.jsx)(a,{dimColor:!0,children:`Site-level permissions are inherited from the Chrome extension. Manage permissions in the Chrome extension settings to control which sites Claude can browse, click, and type on.`})]}),(0,A.jsx)(a,{dimColor:!0,children:`Learn more: https://code.claude.com/docs/en/chrome`})]})})}var k,A,j,M,N,P;e((()=>{k=t(i(),1),y(),s(),b(),m(),S(),C(),D(),u(),h(),r(),A=l(),j=`https://claude.ai/chrome`,M=`https://clau.de/chrome/permissions`,N=`https://clau.de/chrome/reconnect`,P=async function(e){let t=await E(),n=f(),r=p(),i=g.isWslEnvironment();return(0,A.jsx)(O,{onDone:e,isExtensionInstalled:t,configEnabled:n.claudeInChromeDefaultEnabled,isClaudeAISubscriber:r,isWSL:i})}}))();export{P as call};
@@ -0,0 +1 @@
1
+ import{n as e}from"./chunk-DR8-3Aex.js";import{n as t,t as n}from"./conversation-DKlz47xf.js";var r;e((()=>{t(),r=async(e,t)=>(await n(t),{type:`text`,value:``})}))();export{r as call};
@@ -0,0 +1 @@
1
+ import{la as e,ua as t}from"./paths-BBvuDQl9.js";t();export{e as getOrganizationUUID};
@@ -1 +1 @@
1
- import{n as e}from"./chunk-DR8-3Aex.js";import{Ct as t,cn as n}from"./state-sIHsFpDu.js";import{f as r,l as i}from"./teammate-DMYOtLTK.js";import{Ar as a,Tr as o,Xy as s,pi as c,qy as l}from"./loadAgentsDir-Ci5mr0vm.js";async function u(e,n,i){if(r())return e(`Cannot set color: This session is a swarm teammate. Teammate colors are assigned by the team leader.`,{display:`system`}),null;if(!i||i.trim()===``)return e(`Please provide a color. Available colors: ${l.join(`, `)}, default`,{display:`system`}),null;let a=i.trim().toLowerCase();return d.includes(a)?(await c(t(),`default`,o()),n.setAppState(e=>({...e,standaloneAgentContext:{...e.standaloneAgentContext,name:e.standaloneAgentContext?.name??``,color:void 0}})),e(`Session color reset to default`,{display:`system`}),null):l.includes(a)?(await c(t(),a,o()),n.setAppState(e=>({...e,standaloneAgentContext:{...e.standaloneAgentContext,name:e.standaloneAgentContext?.name??``,color:a}})),e(`Session color set to: ${a}`,{display:`system`}),null):(e(`Invalid color "${a}". Available colors: ${l.join(`, `)}, default`,{display:`system`}),null)}var d;e((()=>{n(),s(),a(),i(),d=[`default`,`reset`,`none`,`gray`,`grey`]}))();export{u as call};
1
+ import{n as e}from"./chunk-DR8-3Aex.js";import{Ct as t,cn as n}from"./state-sIHsFpDu.js";import{f as r,l as i}from"./teammate-DMYOtLTK.js";import{Ar as a,Tr as o,Xy as s,pi as c,qy as l}from"./loadAgentsDir-DI1a76pd.js";async function u(e,n,i){if(r())return e(`Cannot set color: This session is a swarm teammate. Teammate colors are assigned by the team leader.`,{display:`system`}),null;if(!i||i.trim()===``)return e(`Please provide a color. Available colors: ${l.join(`, `)}, default`,{display:`system`}),null;let a=i.trim().toLowerCase();return d.includes(a)?(await c(t(),`default`,o()),n.setAppState(e=>({...e,standaloneAgentContext:{...e.standaloneAgentContext,name:e.standaloneAgentContext?.name??``,color:void 0}})),e(`Session color reset to default`,{display:`system`}),null):l.includes(a)?(await c(t(),a,o()),n.setAppState(e=>({...e,standaloneAgentContext:{...e.standaloneAgentContext,name:e.standaloneAgentContext?.name??``,color:a}})),e(`Session color set to: ${a}`,{display:`system`}),null):(e(`Invalid color "${a}". Available colors: ${l.join(`, `)}, default`,{display:`system`}),null)}var d;e((()=>{n(),s(),a(),i(),d=[`default`,`reset`,`none`,`gray`,`grey`]}))();export{u as call};
@@ -0,0 +1 @@
1
+ import{Gi as e,Xi as t,zi as n}from"./loadAgentsDir-DI1a76pd.js";t();export{n as clearCommandsCache,e as getCommands};
@@ -0,0 +1 @@
1
+ import{d as e,l as t}from"./commitAttribution-C22a3OCi.js";t();export{e as isInternalModelRepo};
@@ -1,2 +1,2 @@
1
- import{n as e}from"./chunk-DR8-3Aex.js";import{Ct as t,cn as n,ot as r}from"./state-sIHsFpDu.js";import{Pr as i,mc as a,pc as o}from"./paths-Q2255dD7.js";import{h as s,s as c}from"./debug-UI3T040K.js";import{n as l,t as u}from"./cwd--iizewsn.js";import{E as d,T as f,_ as p,r as m,v as h}from"./git-CN3qtTb_.js";import{o as g}from"./log-CzsijfHZ.js";import{n as _,r as v}from"./execFileNoThrow-CuQN1sz8.js";import{basename as y,extname as b,join as x,posix as S,sep as C}from"path";import{randomUUID as w}from"crypto";import{stat as T}from"fs/promises";function E(e){let t=S.sep+e.split(C).join(S.sep).replace(/^\/+/,``),n=y(e).toLowerCase(),r=b(e).toLowerCase();if(D.has(n)||O.has(r))return!0;let i=n.split(`.`);if(i.length>2){let e=`.`+i.slice(-2).join(`.`);if(O.has(e))return!0}for(let e of k)if(t.includes(e))return!0;for(let e of A)if(e.test(n))return!0;return!1}var D,O,k,A,j=e((()=>{D=new Set([`package-lock.json`,`yarn.lock`,`pnpm-lock.yaml`,`bun.lockb`,`bun.lock`,`composer.lock`,`gemfile.lock`,`cargo.lock`,`poetry.lock`,`pipfile.lock`,`shrinkwrap.json`,`npm-shrinkwrap.json`]),O=new Set([`.lock`,`.min.js`,`.min.css`,`.min.html`,`.bundle.js`,`.bundle.css`,`.generated.ts`,`.generated.js`,`.d.ts`]),k=[`/dist/`,`/build/`,`/out/`,`/output/`,`/node_modules/`,`/vendor/`,`/vendored/`,`/third_party/`,`/third-party/`,`/external/`,`/.next/`,`/.nuxt/`,`/.svelte-kit/`,`/coverage/`,`/__pycache__/`,`/.tox/`,`/venv/`,`/.venv/`,`/target/release/`,`/target/debug/`],A=[/^.*\.min\.[a-z]+$/i,/^.*-min\.[a-z]+$/i,/^.*\.bundle\.[a-z]+$/i,/^.*\.generated\.[a-z]+$/i,/^.*\.gen\.[a-z]+$/i,/^.*\.auto\.[a-z]+$/i,/^.*_generated\.[a-z]+$/i,/^.*_gen\.[a-z]+$/i,/^.*\.pb\.(go|js|ts|py|rb)$/i,/^.*_pb2?\.py$/i,/^.*\.pb\.h$/i,/^.*\.grpc\.[a-z]+$/i,/^.*\.swagger\.[a-z]+$/i,/^.*\.openapi\.[a-z]+$/i]}));function M(){return m(u())??r()}function N(){return W}function P(){return process.env.CLAUDE_CODE_ENTRYPOINT??`cli`}function F(){return{fileStates:new Map,sessionBaselines:new Map,surface:P(),startingHeadSha:null,promptCount:0,promptCountAtLastCommit:0,permissionPromptCount:0,permissionPromptCountAtLastCommit:0,escapeCount:0,escapeCountAtLastCommit:0}}async function I(e,n){let r=M(),i=t(),a={},o=[],s=new Set,c={},l=0,u=0,d=new Map,f=new Map;for(let t of e){s.add(t.surface);let e=t.sessionBaselines instanceof Map?t.sessionBaselines:new Map(Object.entries(t.sessionBaselines??{}));for(let[t,n]of e)f.has(t)||f.set(t,n);let n=t.fileStates instanceof Map?t.fileStates:new Map(Object.entries(t.fileStates??{}));for(let[e,t]of n){let n=d.get(e);n?d.set(e,{...t,claudeContribution:n.claudeContribution+t.claudeContribution}):d.set(e,t)}}let p=await Promise.all(n.map(async t=>{if(E(t))return{type:`generated`,file:t};let n=x(r,t),i=d.get(t),a=f.get(t),o=e[0].surface,s=0,c=0;if(await R(t))if(i)s=i.claudeContribution,c=0;else{let e=await L(t);c=e>0?e:100}else try{let e=await T(n);if(i)s=i.claudeContribution,c=0;else if(a){let n=await L(t);c=n>0?n:e.size}else c=e.size}catch{return null}s=Math.max(0,s),c=Math.max(0,c);let l=s+c,u=l>0?Math.round(s/l*100):0;return{type:`file`,file:t,claudeChars:s,humanChars:c,percent:u,surface:o}}));for(let e of p)if(e){if(e.type===`generated`){o.push(e.file);continue}a[e.file]={claudeChars:e.claudeChars,humanChars:e.humanChars,percent:e.percent,surface:e.surface},l+=e.claudeChars,u+=e.humanChars,c[e.surface]=(c[e.surface]??0)+e.claudeChars}let m=l+u,h=m>0?Math.round(l/m*100):0,g={};for(let[e,t]of Object.entries(c))g[e]={claudeChars:t,percent:m>0?Math.round(t/m*100):0};return{version:1,summary:{claudePercent:h,claudeChars:l,humanChars:u,surfaces:Array.from(s)},files:a,surfaceBreakdown:g,excludedGenerated:o,sessions:[i]}}async function L(e){let t=M();try{let n=await _(p(),[`diff`,`--cached`,`--stat`,`--`,e],{cwd:t,timeout:5e3});if(n.code!==0||!n.stdout)return 0;let r=n.stdout.split(`
1
+ import{n as e}from"./chunk-DR8-3Aex.js";import{Ct as t,cn as n,ot as r}from"./state-sIHsFpDu.js";import{Pr as i,mc as a,pc as o}from"./paths-BBvuDQl9.js";import{h as s,s as c}from"./debug-UI3T040K.js";import{n as l,t as u}from"./cwd--iizewsn.js";import{E as d,T as f,_ as p,r as m,v as h}from"./git-CN3qtTb_.js";import{o as g}from"./log-CzsijfHZ.js";import{n as _,r as v}from"./execFileNoThrow-CuQN1sz8.js";import{basename as y,extname as b,join as x,posix as S,sep as C}from"path";import{randomUUID as w}from"crypto";import{stat as T}from"fs/promises";function E(e){let t=S.sep+e.split(C).join(S.sep).replace(/^\/+/,``),n=y(e).toLowerCase(),r=b(e).toLowerCase();if(D.has(n)||O.has(r))return!0;let i=n.split(`.`);if(i.length>2){let e=`.`+i.slice(-2).join(`.`);if(O.has(e))return!0}for(let e of k)if(t.includes(e))return!0;for(let e of A)if(e.test(n))return!0;return!1}var D,O,k,A,j=e((()=>{D=new Set([`package-lock.json`,`yarn.lock`,`pnpm-lock.yaml`,`bun.lockb`,`bun.lock`,`composer.lock`,`gemfile.lock`,`cargo.lock`,`poetry.lock`,`pipfile.lock`,`shrinkwrap.json`,`npm-shrinkwrap.json`]),O=new Set([`.lock`,`.min.js`,`.min.css`,`.min.html`,`.bundle.js`,`.bundle.css`,`.generated.ts`,`.generated.js`,`.d.ts`]),k=[`/dist/`,`/build/`,`/out/`,`/output/`,`/node_modules/`,`/vendor/`,`/vendored/`,`/third_party/`,`/third-party/`,`/external/`,`/.next/`,`/.nuxt/`,`/.svelte-kit/`,`/coverage/`,`/__pycache__/`,`/.tox/`,`/venv/`,`/.venv/`,`/target/release/`,`/target/debug/`],A=[/^.*\.min\.[a-z]+$/i,/^.*-min\.[a-z]+$/i,/^.*\.bundle\.[a-z]+$/i,/^.*\.generated\.[a-z]+$/i,/^.*\.gen\.[a-z]+$/i,/^.*\.auto\.[a-z]+$/i,/^.*_generated\.[a-z]+$/i,/^.*_gen\.[a-z]+$/i,/^.*\.pb\.(go|js|ts|py|rb)$/i,/^.*_pb2?\.py$/i,/^.*\.pb\.h$/i,/^.*\.grpc\.[a-z]+$/i,/^.*\.swagger\.[a-z]+$/i,/^.*\.openapi\.[a-z]+$/i]}));function M(){return m(u())??r()}function N(){return W}function P(){return process.env.CLAUDE_CODE_ENTRYPOINT??`cli`}function F(){return{fileStates:new Map,sessionBaselines:new Map,surface:P(),startingHeadSha:null,promptCount:0,promptCountAtLastCommit:0,permissionPromptCount:0,permissionPromptCountAtLastCommit:0,escapeCount:0,escapeCountAtLastCommit:0}}async function I(e,n){let r=M(),i=t(),a={},o=[],s=new Set,c={},l=0,u=0,d=new Map,f=new Map;for(let t of e){s.add(t.surface);let e=t.sessionBaselines instanceof Map?t.sessionBaselines:new Map(Object.entries(t.sessionBaselines??{}));for(let[t,n]of e)f.has(t)||f.set(t,n);let n=t.fileStates instanceof Map?t.fileStates:new Map(Object.entries(t.fileStates??{}));for(let[e,t]of n){let n=d.get(e);n?d.set(e,{...t,claudeContribution:n.claudeContribution+t.claudeContribution}):d.set(e,t)}}let p=await Promise.all(n.map(async t=>{if(E(t))return{type:`generated`,file:t};let n=x(r,t),i=d.get(t),a=f.get(t),o=e[0].surface,s=0,c=0;if(await R(t))if(i)s=i.claudeContribution,c=0;else{let e=await L(t);c=e>0?e:100}else try{let e=await T(n);if(i)s=i.claudeContribution,c=0;else if(a){let n=await L(t);c=n>0?n:e.size}else c=e.size}catch{return null}s=Math.max(0,s),c=Math.max(0,c);let l=s+c,u=l>0?Math.round(s/l*100):0;return{type:`file`,file:t,claudeChars:s,humanChars:c,percent:u,surface:o}}));for(let e of p)if(e){if(e.type===`generated`){o.push(e.file);continue}a[e.file]={claudeChars:e.claudeChars,humanChars:e.humanChars,percent:e.percent,surface:e.surface},l+=e.claudeChars,u+=e.humanChars,c[e.surface]=(c[e.surface]??0)+e.claudeChars}let m=l+u,h=m>0?Math.round(l/m*100):0,g={};for(let[e,t]of Object.entries(c))g[e]={claudeChars:t,percent:m>0?Math.round(t/m*100):0};return{version:1,summary:{claudePercent:h,claudeChars:l,humanChars:u,surfaces:Array.from(s)},files:a,surfaceBreakdown:g,excludedGenerated:o,sessions:[i]}}async function L(e){let t=M();try{let n=await _(p(),[`diff`,`--cached`,`--stat`,`--`,e],{cwd:t,timeout:5e3});if(n.code!==0||!n.stdout)return 0;let r=n.stdout.split(`
2
2
  `).filter(Boolean),i=0;for(let e of r)if(e.includes(`file changed`)||e.includes(`files changed`)){let t=e.match(/(\d+) insertions?/),n=e.match(/(\d+) deletions?/),r=t?parseInt(t[1],10):0,a=n?parseInt(n[1],10):0;i+=(r+a)*40}return i}catch{return 0}}async function R(e){let t=M();try{let n=await _(p(),[`diff`,`--cached`,`--name-status`,`--`,e],{cwd:t,timeout:5e3});if(n.code===0&&n.stdout)return n.stdout.trim().startsWith(`D `)}catch{}return!1}function z(e,t){let n={};for(let[t,r]of e.fileStates)n[t]=r;return{type:`attribution-snapshot`,messageId:t,surface:e.surface,fileStates:n,promptCount:e.promptCount,promptCountAtLastCommit:e.promptCountAtLastCommit,permissionPromptCount:e.permissionPromptCount,permissionPromptCountAtLastCommit:e.permissionPromptCountAtLastCommit,escapeCount:e.escapeCount,escapeCountAtLastCommit:e.escapeCountAtLastCommit}}function B(e){let t=F(),n=e[e.length-1];if(!n)return t;t.surface=n.surface;for(let[e,r]of Object.entries(n.fileStates))t.fileStates.set(e,r);return t.promptCount=n.promptCount??0,t.promptCountAtLastCommit=n.promptCountAtLastCommit??0,t.permissionPromptCount=n.permissionPromptCount??0,t.permissionPromptCountAtLastCommit=n.permissionPromptCountAtLastCommit??0,t.escapeCount=n.escapeCount??0,t.escapeCountAtLastCommit=n.escapeCountAtLastCommit??0,t}function V(e,t){t(B(e))}function H(e,t){let n={...e,promptCount:e.promptCount+1};return t(z(n,w())),n}var U,W,G,K=e((()=>{n(),l(),c(),v(),s(),j(),d(),h(),g(),i(),o(),U=`github.com:anthropics/claude-cli-internal,github.com/anthropics/claude-cli-internal,github.com:anthropics/anthropic,github.com/anthropics/anthropic,github.com:anthropics/apps,github.com/anthropics/apps,github.com:anthropics/casino,github.com/anthropics/casino,github.com:anthropics/dbt,github.com/anthropics/dbt,github.com:anthropics/dotfiles,github.com/anthropics/dotfiles,github.com:anthropics/terraform-config,github.com/anthropics/terraform-config,github.com:anthropics/hex-export,github.com/anthropics/hex-export,github.com:anthropics/feedback-v2,github.com/anthropics/feedback-v2,github.com:anthropics/labs,github.com/anthropics/labs,github.com:anthropics/argo-rollouts,github.com/anthropics/argo-rollouts,github.com:anthropics/starling-configs,github.com/anthropics/starling-configs,github.com:anthropics/ts-tools,github.com/anthropics/ts-tools,github.com:anthropics/ts-capsules,github.com/anthropics/ts-capsules,github.com:anthropics/feldspar-testing,github.com/anthropics/feldspar-testing,github.com:anthropics/trellis,github.com/anthropics/trellis,github.com:anthropics/claude-for-hiring,github.com/anthropics/claude-for-hiring,github.com:anthropics/forge-web,github.com/anthropics/forge-web,github.com:anthropics/infra-manifests,github.com/anthropics/infra-manifests,github.com:anthropics/mycro_manifests,github.com/anthropics/mycro_manifests,github.com:anthropics/mycro_configs,github.com/anthropics/mycro_configs,github.com:anthropics/mobile-apps,github.com/anthropics/mobile-apps`.split(`,`),W=null,G=a(async()=>{if(W!==null)return W===`internal`;let e=await f(M());if(!e)return W=`none`,!1;let t=U.some(t=>e.includes(t));return W=t?`internal`:`external`,t})}));export{P as a,H as c,G as d,B as f,M as i,K as l,I as n,L as o,z as p,F as r,N as s,V as t,R as u};
@@ -1,3 +1,3 @@
1
- import{n as e}from"./chunk-DR8-3Aex.js";import{In as t,Ln as n}from"./src-Di342QoJ.js";import{cn as r,dn as i}from"./state-sIHsFpDu.js";import{B as a,V as o}from"./debug-UI3T040K.js";import{o as s,s as c}from"./log-CzsijfHZ.js";import{$w as l,Ak as u,Cl as d,Dk as f,Ek as p,Fk as m,Gg as h,JO as g,Kg as _,Lo as v,Oo as y,Pk as b,Sl as x,_l as S,bl as C,dk as w,dl as T,dt as E,eT as D,ed as O,ek as k,fk as A,ft as j,hl as M,jk as N,ll as P,pk as F,qt as I,td as L,vl as R,wl as z,yl as B,yn as V}from"./loadAgentsDir-Ci5mr0vm.js";async function H(e,t,n,r){t.onCompactProgress?.({type:`hooks_start`,hookType:`pre_compact`}),t.setSDKStatus?.(`compacting`);try{let[i,a]=await Promise.all([I({trigger:`manual`,customInstructions:n||null},t.abortController.signal),W(t,e)]),o=z(n,i.newCustomInstructions);t.setStreamMode?.(`requesting`),t.setResponseLength?.(()=>0),t.onCompactProgress?.({type:`compact_start`});let s=await r.reactiveCompactOnPromptTooLong(e,a,{customInstructions:o,trigger:`manual`});if(!s.ok)switch(s.reason){case`too_few_groups`:throw Error(B);case`aborted`:throw Error(C);case`exhausted`:case`error`:case`media_unstrippable`:throw Error(R)}k(void 0),S(),N(),A.cache.clear?.();let c=[i.userDisplayMessage,s.result.userDisplayMessage].filter(Boolean).join(`
1
+ import{n as e}from"./chunk-DR8-3Aex.js";import{In as t,Ln as n}from"./src-Di342QoJ.js";import{cn as r,dn as i}from"./state-sIHsFpDu.js";import{B as a,V as o}from"./debug-UI3T040K.js";import{o as s,s as c}from"./log-CzsijfHZ.js";import{$w as l,Ak as u,Cl as d,Dk as f,Ek as p,Fk as m,Gg as h,JO as g,Kg as _,Lo as v,Oo as y,Pk as b,Sl as x,_l as S,bl as C,dk as w,dl as T,dt as E,eT as D,ed as O,ek as k,fk as A,ft as j,hl as M,jk as N,ll as P,pk as F,qt as I,td as L,vl as R,wl as z,yl as B,yn as V}from"./loadAgentsDir-DI1a76pd.js";async function H(e,t,n,r){t.onCompactProgress?.({type:`hooks_start`,hookType:`pre_compact`}),t.setSDKStatus?.(`compacting`);try{let[i,a]=await Promise.all([I({trigger:`manual`,customInstructions:n||null},t.abortController.signal),W(t,e)]),o=z(n,i.newCustomInstructions);t.setStreamMode?.(`requesting`),t.setResponseLength?.(()=>0),t.onCompactProgress?.({type:`compact_start`});let s=await r.reactiveCompactOnPromptTooLong(e,a,{customInstructions:o,trigger:`manual`});if(!s.ok)switch(s.reason){case`too_few_groups`:throw Error(B);case`aborted`:throw Error(C);case`exhausted`:case`error`:case`media_unstrippable`:throw Error(R)}k(void 0),S(),N(),A.cache.clear?.();let c=[i.userDisplayMessage,s.result.userDisplayMessage].filter(Boolean).join(`
2
2
  `)||void 0;return{type:`compact`,compactionResult:{...s.result,userDisplayMessage:c},displayText:U(t,c)}}finally{t.setStreamMode?.(`requesting`),t.setResponseLength?.(()=>0),t.onCompactProgress?.({type:`compact_end`}),t.setSDKStatus?.(``)}}function U(e,n){let r=h(`tip`),i=l(`app:toggleTranscript`,`Global`,`ctrl+o`),a=[...e.options.verbose?[]:[`(${i} to see full summary)`],...n?[n]:[],...r?[r]:[]];return t.dim(`Compacted `+a.join(`
3
3
  `))}async function W(e,t){let n=e.getAppState(),r=await E(e.options.tools,e.options.mainLoopModel,Array.from(n.toolPermissionContext.additionalWorkingDirectories.keys()),e.options.mcpClients),i=O({mainThreadAgentDefinition:void 0,toolUseContext:e,customSystemPrompt:e.options.customSystemPrompt,defaultSystemPrompt:r,appendSystemPrompt:e.options.appendSystemPrompt}),[a,o]=await Promise.all([A(),w()]);return{systemPrompt:i,userContext:a,systemContext:o,toolUseContext:e,forkContextMessages:t}}var G,K;e((()=>{n(),r(),j(),F(),D(),b(),d(),u(),p(),M(),P(),g(),o(),V(),s(),v(),_(),L(),G=null,K=async(e,t)=>{let{abortController:n}=t,{messages:r}=t;if(r=y(r),r.length===0)throw Error(`No messages to compact`);let o=e.trim();try{if(!o){let e=await T(r,t.agentId);if(e)return A.cache.clear?.(),S(),m(t.options.querySource??`compact`,t.agentId),i(),N(),{type:`compact`,compactionResult:e,displayText:U(t)}}if(G?.isReactiveOnlyMode())return await H(r,t,o,G);let e=(await f(r,t)).messages,n=await x(e,t,await W(t,e),!1,o,!1);return k(void 0),N(),A.cache.clear?.(),S(),{type:`compact`,compactionResult:n,displayText:U(t,n.userDisplayMessage)}}catch(e){throw n.signal.aborted?Error(`Compaction canceled.`):a(e,`Not enough messages to compact. Send a few more messages first, then try again.`)?Error(B):a(e,`Compaction interrupted · This may be due to network issues — please try again.`)?Error(R):(c(e),Error(`Error during compaction: ${e}`))}}}))();export{K as call};
@@ -1 +1 @@
1
- import{n as e}from"./chunk-DR8-3Aex.js";import{Ac as t,Sc as n}from"./paths-Q2255dD7.js";var r,i,a,o,s,c,l,u,d,f,p,m,h,g,_,v,y,b,x,S,C,w,T,E,D,O,k,A=e((()=>{r=[`common`,`uncommon`,`rare`,`epic`,`legendary`],i=String.fromCharCode,a=i(100,117,99,107),o=i(103,111,111,115,101),s=i(98,108,111,98),c=i(99,97,116),l=i(100,114,97,103,111,110),u=i(111,99,116,111,112,117,115),d=i(111,119,108),f=i(112,101,110,103,117,105,110),p=i(116,117,114,116,108,101),m=i(115,110,97,105,108),h=i(103,104,111,115,116),g=i(97,120,111,108,111,116,108),_=i(99,97,112,121,98,97,114,97),v=i(99,97,99,116,117,115),y=i(114,111,98,111,116),b=i(114,97,98,98,105,116),x=i(109,117,115,104,114,111,111,109),S=i(99,104,111,110,107),C=[a,o,s,c,l,u,d,f,p,m,h,g,_,v,y,b,x,S],w=[`·`,`✦`,`×`,`◉`,`@`,`°`],T=[`none`,`crown`,`tophat`,`propeller`,`halo`,`wizard`,`beanie`,`tinyduck`],E=[`DEBUGGING`,`PATIENCE`,`CHAOS`,`WISDOM`,`SNARK`],D={common:60,uncommon:25,rare:10,epic:4,legendary:1},O={common:`★`,uncommon:`★★`,rare:`★★★`,epic:`★★★★`,legendary:`★★★★★`},k={common:`inactive`,uncommon:`success`,rare:`permission`,epic:`autoAccept`,legendary:`warning`}}));function j(e){let t=e>>>0;return function(){t|=0,t=t+1831565813|0;let e=Math.imul(t^t>>>15,1|t);return e=e+Math.imul(e^e>>>7,61|e)^e,((e^e>>>14)>>>0)/4294967296}}function M(e){if(typeof Bun<`u`)return Number(BigInt(Bun.hash(e))&4294967295n);let t=2166136261;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return t>>>0}function N(e,t){return t[Math.floor(e()*t.length)]}function P(e){let t=Object.values(D).reduce((e,t)=>e+t,0),n=e()*t;for(let e of r)if(n-=D[e],n<0)return e;return`common`}function F(e,t){let n=U[t],r=N(e,E),i=N(e,E);for(;i===r;)i=N(e,E);let a={};for(let t of E)t===r?a[t]=Math.min(100,n+50+Math.floor(e()*30)):t===i?a[t]=Math.max(1,n-10+Math.floor(e()*15)):a[t]=n+Math.floor(e()*40);return a}function I(e){let t=P(e);return{bones:{rarity:t,species:N(e,C),eye:N(e,w),hat:t===`common`?`none`:N(e,T),shiny:e()<.01,stats:F(e,t)},inspirationSeed:Math.floor(e()*1e9)}}function L(e){return I(j(M(e)))}function R(){return`rehatch-${Date.now()}-${Math.random().toString(36).slice(2,10)}`}function z(){let e=n();return e.oauthAccount?.accountUuid??e.userID??`anon`}function B(e,t){return RegExp(`(^|${W})${t}($|${W})`).test(e)}function V(e){if(e.seed)return{};let t=`${e.name} ${e.personality}`.toLowerCase(),n={},i=C.find(e=>B(t,e)),a=r.find(e=>B(t,e));return i&&(n.species=i),a&&(n.rarity=a),n}function H(){let e=n().companion;if(!e)return;let{bones:t}=L(e.seed??z()),r=V(e);return{...e,...t,...r}}var U,W,G=e((()=>{t(),A(),U={common:5,uncommon:15,rare:25,epic:35,legendary:50},W=`[^a-z0-9]+`}));export{b as C,p as E,f as S,m as T,o as _,k as a,u as b,g as c,_ as d,c as f,h as g,a as h,L as i,s as l,l as m,H as n,O as o,S as p,G as r,E as s,R as t,v as u,A as v,y as w,d as x,x as y};
1
+ import{n as e}from"./chunk-DR8-3Aex.js";import{Ac as t,Sc as n}from"./paths-BBvuDQl9.js";var r,i,a,o,s,c,l,u,d,f,p,m,h,g,_,v,y,b,x,S,C,w,T,E,D,O,k,A=e((()=>{r=[`common`,`uncommon`,`rare`,`epic`,`legendary`],i=String.fromCharCode,a=i(100,117,99,107),o=i(103,111,111,115,101),s=i(98,108,111,98),c=i(99,97,116),l=i(100,114,97,103,111,110),u=i(111,99,116,111,112,117,115),d=i(111,119,108),f=i(112,101,110,103,117,105,110),p=i(116,117,114,116,108,101),m=i(115,110,97,105,108),h=i(103,104,111,115,116),g=i(97,120,111,108,111,116,108),_=i(99,97,112,121,98,97,114,97),v=i(99,97,99,116,117,115),y=i(114,111,98,111,116),b=i(114,97,98,98,105,116),x=i(109,117,115,104,114,111,111,109),S=i(99,104,111,110,107),C=[a,o,s,c,l,u,d,f,p,m,h,g,_,v,y,b,x,S],w=[`·`,`✦`,`×`,`◉`,`@`,`°`],T=[`none`,`crown`,`tophat`,`propeller`,`halo`,`wizard`,`beanie`,`tinyduck`],E=[`DEBUGGING`,`PATIENCE`,`CHAOS`,`WISDOM`,`SNARK`],D={common:60,uncommon:25,rare:10,epic:4,legendary:1},O={common:`★`,uncommon:`★★`,rare:`★★★`,epic:`★★★★`,legendary:`★★★★★`},k={common:`inactive`,uncommon:`success`,rare:`permission`,epic:`autoAccept`,legendary:`warning`}}));function j(e){let t=e>>>0;return function(){t|=0,t=t+1831565813|0;let e=Math.imul(t^t>>>15,1|t);return e=e+Math.imul(e^e>>>7,61|e)^e,((e^e>>>14)>>>0)/4294967296}}function M(e){if(typeof Bun<`u`)return Number(BigInt(Bun.hash(e))&4294967295n);let t=2166136261;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return t>>>0}function N(e,t){return t[Math.floor(e()*t.length)]}function P(e){let t=Object.values(D).reduce((e,t)=>e+t,0),n=e()*t;for(let e of r)if(n-=D[e],n<0)return e;return`common`}function F(e,t){let n=U[t],r=N(e,E),i=N(e,E);for(;i===r;)i=N(e,E);let a={};for(let t of E)t===r?a[t]=Math.min(100,n+50+Math.floor(e()*30)):t===i?a[t]=Math.max(1,n-10+Math.floor(e()*15)):a[t]=n+Math.floor(e()*40);return a}function I(e){let t=P(e);return{bones:{rarity:t,species:N(e,C),eye:N(e,w),hat:t===`common`?`none`:N(e,T),shiny:e()<.01,stats:F(e,t)},inspirationSeed:Math.floor(e()*1e9)}}function L(e){return I(j(M(e)))}function R(){return`rehatch-${Date.now()}-${Math.random().toString(36).slice(2,10)}`}function z(){let e=n();return e.oauthAccount?.accountUuid??e.userID??`anon`}function B(e,t){return RegExp(`(^|${W})${t}($|${W})`).test(e)}function V(e){if(e.seed)return{};let t=`${e.name} ${e.personality}`.toLowerCase(),n={},i=C.find(e=>B(t,e)),a=r.find(e=>B(t,e));return i&&(n.species=i),a&&(n.rarity=a),n}function H(){let e=n().companion;if(!e)return;let{bones:t}=L(e.seed??z()),r=V(e);return{...e,...t,...r}}var U,W,G=e((()=>{t(),A(),U={common:5,uncommon:15,rare:25,epic:35,legendary:50},W=`[^a-z0-9]+`}));export{b as C,p as E,f as S,m as T,o as _,k as a,u as b,g as c,_ as d,c as f,h as g,a as h,L as i,s as l,l as m,H as n,O as o,S as p,G as r,E as s,R as t,v as u,A as v,y as w,d as x,x as y};
@@ -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"./Settings-CreAhCsb.js";var i,a;e((()=>{n(),i=t(),a=async(e,t)=>(0,i.jsx)(r,{onClose:e,context:t,defaultTab:`Config`})}))();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"./Settings-vfFvcweR.js";var i,a;e((()=>{n(),i=t(),a=async(e,t)=>(0,i.jsx)(r,{onClose:e,context:t,defaultTab:`Config`})}))();export{a as call};
@@ -1 +1 @@
1
- import{Ac as e,Nc as t,Pc as n,Sc as r,_c as i,bc as a,gc as o}from"./paths-Q2255dD7.js";e();export{o as checkHasTrustDialogAccepted,i as enableConfigs,a as getCurrentProjectConfig,r as getGlobalConfig,t as saveCurrentProjectConfig,n as saveGlobalConfig};
1
+ import{Ac as e,Nc as t,Pc as n,Sc as r,_c as i,bc as a,gc as o}from"./paths-BBvuDQl9.js";e();export{o as checkHasTrustDialogAccepted,i as enableConfigs,a as getCurrentProjectConfig,r as getGlobalConfig,t as saveCurrentProjectConfig,n as saveGlobalConfig};
@@ -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-Q2255dD7.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-Ci5mr0vm.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-DEPUnJdB.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-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};
@@ -0,0 +1 @@
1
+ import{n as e,r as t,t as n}from"./context-noninteractive-yiyJriiw.js";t();export{n as call,e as collectContextData};
@@ -1,4 +1,4 @@
1
- import{n as e}from"./chunk-DR8-3Aex.js";import{nc as t,tc as n}from"./paths-Q2255dD7.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-Ci5mr0vm.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-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
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
@@ -1 +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{$y as h,Ar as g,Cv as _,Du as v,Eu as y,F_ as b,Fv as x,Hm as S,Hv as C,Mn as w,P_ as T,Qy as E,Sv as D,Um as O,Yt as k,ad as A,cE as j,di as M,fr as N,gE as P,id as F,jn as ee,kn as I,mE as L,nr as R,sE as z,un as B,wi as V,wt as H,xi as U,xt as W,yn as G}from"./loadAgentsDir-Ci5mr0vm.js";import{C as K,y as q}from"./rcDebugLog-BbPkkigY.js";import{l as J,r as Y}from"./commitAttribution-BFshsh2H.js";import{n as X,t as Z}from"./caches-BUBkfP2Q.js";import{randomUUID as Q}from"crypto";function $(){let e=F();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:y,setAppState:S,setConversationId:C}){let w=B();await k(`clear`,{getAppState:y,setAppState:S,signal:AbortSignal.timeout(w),timeoutMs:w});let T=a();T&&f(`tengu_cache_eviction_hint`,{scope:`conversation_clear`,last_request_id:T});let E=new Set,D=[],A=e=>`isBackgrounded`in e&&e.isBackgrounded===!1;if(y)for(let e of Object.values(y().tasks))A(e)||(v(e)?(E.add(e.agentId),D.push(e)):h(e)&&E.add(e.identity.agentId));t(()=>[]),$();{let{setContextBlocked:t}=(q(),e(K));t(!1)}C&&C(Q()),Z(E),l(null),r(null),i(null),u(),O(c()),o.clear(),d?.clear(),p?.clear(),S&&S(e=>{let t={};for(let[n,r]of Object.entries(e.tasks)){if(!A(r)){t[n]=r;continue}try{r.status===`running`&&(b(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)}I(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}}}),x(),R(),s({setCurrentAsParent:!0}),process.env.USER_TYPE===`ant`&&process.env.CLAUDE_CODE_SESSION_ID&&(process.env.CLAUDE_CODE_SESSION_ID=n()),await M();for(let e of D)e.status===`running`&&ee(e.id,N(L(e.agentId)));{let{saveMode:t}=(g(),e(V)),{isCoordinatorMode:n}=(j(),e(z));t(n()?`coordinator`:`normal`)}let P=W();P&&U(P);let F=await _(`clear`);F.length>0&&t(()=>F)}var ne=t((()=>{A(),o(),d(),E(),y(),T(),P(),J(),G(),p(),C(),S(),D(),g(),w(),H(),X()}));export{ne as n,te as t};
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{$y as h,Ar as g,Cv as _,Du as v,Eu as y,F_ as b,Fv as x,Hm as S,Hv as C,Mn as w,P_ as T,Qy as E,Sv as D,Um as O,Yt as k,ad as A,cE as j,di as M,fr as N,gE as P,id as F,jn as ee,kn as I,mE as L,nr as R,sE as z,un as B,wi as V,wt as H,xi as U,xt as W,yn as G}from"./loadAgentsDir-DI1a76pd.js";import{C as K,y as q}from"./rcDebugLog-CPKZCtR8.js";import{l as J,r as Y}from"./commitAttribution-C22a3OCi.js";import{n as X,t as Z}from"./caches-B5QZDncQ.js";import{randomUUID as Q}from"crypto";function $(){let e=F();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:y,setAppState:S,setConversationId:C}){let w=B();await k(`clear`,{getAppState:y,setAppState:S,signal:AbortSignal.timeout(w),timeoutMs:w});let T=a();T&&f(`tengu_cache_eviction_hint`,{scope:`conversation_clear`,last_request_id:T});let E=new Set,D=[],A=e=>`isBackgrounded`in e&&e.isBackgrounded===!1;if(y)for(let e of Object.values(y().tasks))A(e)||(v(e)?(E.add(e.agentId),D.push(e)):h(e)&&E.add(e.identity.agentId));t(()=>[]),$();{let{setContextBlocked:t}=(q(),e(K));t(!1)}C&&C(Q()),Z(E),l(null),r(null),i(null),u(),O(c()),o.clear(),d?.clear(),p?.clear(),S&&S(e=>{let t={};for(let[n,r]of Object.entries(e.tasks)){if(!A(r)){t[n]=r;continue}try{r.status===`running`&&(b(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)}I(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}}}),x(),R(),s({setCurrentAsParent:!0}),process.env.USER_TYPE===`ant`&&process.env.CLAUDE_CODE_SESSION_ID&&(process.env.CLAUDE_CODE_SESSION_ID=n()),await M();for(let e of D)e.status===`running`&&ee(e.id,N(L(e.agentId)));{let{saveMode:t}=(g(),e(V)),{isCoordinatorMode:n}=(j(),e(z));t(n()?`coordinator`:`normal`)}let P=W();P&&U(P);let F=await _(`clear`);F.length>0&&t(()=>F)}var ne=t((()=>{A(),o(),d(),E(),y(),T(),P(),J(),G(),p(),C(),S(),D(),g(),w(),H(),X()}));export{ne as n,te as t};
@@ -0,0 +1 @@
1
+ import{n as e,t}from"./conversation-DKlz47xf.js";e();export{t as clearConversation};
@@ -1,4 +1,4 @@
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-Q2255dD7.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-Ci5mr0vm.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-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,`
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(`
@@ -1,4 +1,4 @@
1
- import{n as e,t}from"./defineProperty-80gRi2ZW.js";import{Jt as n,on as r}from"./paths-Q2255dD7.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-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(`
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(`
@@ -0,0 +1 @@
1
+ import{a as e,i as t,n,r}from"./createSession-kiTHYXSL.js";t();export{n as createBridgeSession,r as getBridgeSession,e as updateBridgeSessionTitle};
@@ -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-CqURlg4d.js`),{getOrganizationUUID:p}=await import(`./client-B47ZvTMo.js`),{getOauthConfig:m}=await import(`./oauth-CmensepG.js`),{getOAuthHeaders:h}=await import(`./api-Dz_3z1kl.js`),{parseGitHubRepository:g}=await import(`./detectRepository-DCTvg4p0.js`),{getDefaultBranch:_}=await import(`./git-D23Mzu_K.js`),{getMainLoopModel:v}=await import(`./model-DdbcxKub.js`),{default:y}=await import(`./axios-DLnc2dVy.js`),{isSelfHostedBridge:b}=await import(`./bridgeConfig-CNbOKpAg.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-CqURlg4d.js`),{getOrganizationUUID:a}=await import(`./client-B47ZvTMo.js`),{getOauthConfig:o}=await import(`./oauth-CmensepG.js`),{getOAuthHeaders:c}=await import(`./api-Dz_3z1kl.js`),{default:l}=await import(`./axios-DLnc2dVy.js`),{isSelfHostedBridge:u}=await import(`./bridgeConfig-CNbOKpAg.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-CqURlg4d.js`),{getOrganizationUUID:i}=await import(`./client-B47ZvTMo.js`),{getOauthConfig:a}=await import(`./oauth-CmensepG.js`),{getOAuthHeaders:o}=await import(`./api-Dz_3z1kl.js`),{default:c}=await import(`./axios-DLnc2dVy.js`),{isSelfHostedBridge:l}=await import(`./bridgeConfig-CNbOKpAg.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-CqURlg4d.js`),{getOrganizationUUID:c}=await import(`./client-B47ZvTMo.js`),{getOauthConfig:l}=await import(`./oauth-CmensepG.js`),{getOAuthHeaders:u}=await import(`./api-Dz_3z1kl.js`),{default:d}=await import(`./axios-DLnc2dVy.js`),{isSelfHostedBridge:f}=await import(`./bridgeConfig-CNbOKpAg.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-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};