claude-code-best 2.7.2 → 2.8.0

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 (476) hide show
  1. package/dist/chunks/{AddWorkspaceDirectory-V2tF7iCY.js → AddWorkspaceDirectory-DRO4tbYd.js} +1 -1
  2. package/dist/chunks/{App-DLdRpU7c.js → App-DJyiiVKi.js} +1 -1
  3. package/dist/chunks/{ApproveApiKey-DPws3jax.js → ApproveApiKey-DygOEAkM.js} +1 -1
  4. package/dist/chunks/ApproveApiKey-oTZKoMvB.js +1 -0
  5. package/dist/chunks/{AssistantSessionChooser-D6rS0OVe.js → AssistantSessionChooser-C67mOxVi.js} +1 -1
  6. package/dist/chunks/{BackgroundTasksDialog-hGlbm5z5.js → BackgroundTasksDialog-Bqk_Cn3j.js} +1 -1
  7. package/dist/chunks/{BypassPermissionsModeDialog-CuEpdRVd.js → BypassPermissionsModeDialog-C4z7RkFV.js} +1 -1
  8. package/dist/chunks/{ClaudeInChromeOnboarding-CTTKMRbt.js → ClaudeInChromeOnboarding-CyVFdjBe.js} +1 -1
  9. package/dist/chunks/ClaudeMdExternalIncludesDialog-5FCT81WS.js +1 -0
  10. package/dist/chunks/{ClaudeMdExternalIncludesDialog-B-GkVoA_.js → ClaudeMdExternalIncludesDialog-IpqqBuJs.js} +1 -1
  11. package/dist/chunks/ConsoleOAuthFlow-BmGziW64.js +1 -0
  12. package/dist/chunks/{DesktopHandoff-BjPylhOT.js → DesktopHandoff-CJpa8Xy-.js} +1 -1
  13. package/dist/chunks/{DevChannelsDialog-c4YVqBX9.js → DevChannelsDialog-CfAuHVRL.js} +1 -1
  14. package/dist/chunks/Dialog-C8eGKH-e.js +1 -0
  15. package/dist/chunks/{DiffDialog-I5wuXw2C.js → DiffDialog-CV3brWsG.js} +1 -1
  16. package/dist/chunks/{Doctor-Cr_MlSPc.js → Doctor-D3GysagF.js} +1 -1
  17. package/dist/chunks/Doctor-DohPtIKu.js +1 -0
  18. package/dist/chunks/{ExitFlow-Bz5grDWv.js → ExitFlow-L2sh80sm.js} +1 -1
  19. package/dist/chunks/{Feedback-COgMI5tY.js → Feedback-DfkBCvva.js} +1 -1
  20. package/dist/chunks/{Grove-m57x4tY1.js → Grove-Bo74aZx-.js} +1 -1
  21. package/dist/chunks/Grove-C_ocvHd3.js +1 -0
  22. package/dist/chunks/{HybridTransport-Bok4-Ptt.js → HybridTransport-BItIDJyC.js} +1 -1
  23. package/dist/chunks/{ITermBackend-BBSP-NNa.js → ITermBackend-3iS8Bvmo.js} +1 -1
  24. package/dist/chunks/{InvalidConfigDialog-uTSuSBvO.js → InvalidConfigDialog-6lPGcuOX.js} +1 -1
  25. package/dist/chunks/{InvalidSettingsDialog-B-Os12-H.js → InvalidSettingsDialog-D8DwHiys.js} +1 -1
  26. package/dist/chunks/ListItem-DDMe4CJ3.js +1 -0
  27. package/dist/chunks/{MCPConnectionManager-y97Inszc.js → MCPConnectionManager-CsPizxTx.js} +1 -1
  28. package/dist/chunks/{McpParsingWarnings-DMFUZw92.js → McpParsingWarnings-Cepe7RPZ.js} +1 -1
  29. package/dist/chunks/{MessageSelector-DwdAC2io.js → MessageSelector-BzUQUeDn.js} +2 -2
  30. package/dist/chunks/{Messages-FEBcX-cT.js → Messages-KmeXIJqL.js} +2 -2
  31. package/dist/chunks/{Onboarding-B8qMJaBh.js → Onboarding-BZUXID6q.js} +1 -1
  32. package/dist/chunks/{OverageCreditUpsell-DnFv5z-z.js → OverageCreditUpsell-Dhm7HBuD.js} +1 -1
  33. package/dist/chunks/{PermissionDialog-_WQPRYHQ.js → PermissionDialog-BrRBxx5o.js} +1 -1
  34. package/dist/chunks/{PluginSettings-B_xVgTTp.js → PluginSettings-BZ-PX9Tg.js} +1 -1
  35. package/dist/chunks/{PressEnterToContinue-BJ58eCFC.js → PressEnterToContinue-DtA_p3X6.js} +1 -1
  36. package/dist/chunks/{PromptInputFooterSuggestions-DhIQ0Nge.js → PromptInputFooterSuggestions-Da8Fty6P.js} +1 -1
  37. package/dist/chunks/{PromptInputHelpMenu-CoMkWchC.js → PromptInputHelpMenu-Bz7EPzzq.js} +1 -1
  38. package/dist/chunks/{QueryEngine-C7r7O-hH.js → QueryEngine-CmJK27jU.js} +1 -1
  39. package/dist/chunks/REPL-BBmn_itf.js +1 -0
  40. package/dist/chunks/{REPL-CmJdJrGO.js → REPL-DxEJZpIp.js} +6 -6
  41. package/dist/chunks/{RemoteCallout-4JOZROfT.js → RemoteCallout-DONJj8l2.js} +1 -1
  42. package/dist/chunks/RemoteSessionManager-BvvNspY8.js +2 -0
  43. package/dist/chunks/{ResumeConversation-CZ2Uedkf.js → ResumeConversation-EpjJdFHu.js} +1 -1
  44. package/dist/chunks/{SSETransport-kEH_p4Yq.js → SSETransport-D51Jfdaj.js} +1 -1
  45. package/dist/chunks/SearchBox-CciJ8giD.js +1 -0
  46. package/dist/chunks/SearchExtraToolsTool-kjVFsFkT.js +1 -0
  47. package/dist/chunks/SentryErrorBoundary-DsrmgmKF.js +1 -0
  48. package/dist/chunks/{SentryErrorBoundary-97iY7Nb7.js → SentryErrorBoundary-nYTimi4l.js} +1 -1
  49. package/dist/chunks/{Settings-CuljH0mu.js → Settings-C2vEJjLx.js} +2 -2
  50. package/dist/chunks/{TeleportProgress-Ctdqi7iS.js → TeleportProgress--jgrqIfW.js} +1 -1
  51. package/dist/chunks/{TeleportRepoMismatchDialog-DyTBg1YD.js → TeleportRepoMismatchDialog-BKDaFT_L.js} +1 -1
  52. package/dist/chunks/{TeleportResumeWrapper-B66clYsG.js → TeleportResumeWrapper-CxlpiHIz.js} +1 -1
  53. package/dist/chunks/{ThemePicker-WKmYvrqz.js → ThemePicker-CYL4C-F-.js} +1 -1
  54. package/dist/chunks/{TmuxBackend-OKX2NP14.js → TmuxBackend-C_N4ww8i.js} +1 -1
  55. package/dist/chunks/{TrustDialog-0anSIf-G.js → TrustDialog-CYdftZ1M.js} +1 -1
  56. package/dist/chunks/{ValidationErrorsList-CfgC1KJb.js → ValidationErrorsList-CaTwOP3f.js} +1 -1
  57. package/dist/chunks/{WelcomeV2-BMHXiNt3.js → WelcomeV2-5rgKm4Mz.js} +1 -1
  58. package/dist/chunks/{WindowsTerminalBackend-fCSGVe4W.js → WindowsTerminalBackend-BzoSs0VA.js} +1 -1
  59. package/dist/chunks/{add-dir-CMtuW667.js → add-dir-RNzFR3XZ.js} +1 -1
  60. package/dist/chunks/{agentDisplay-CgYKW3G7.js → agentDisplay-DgeOQY1E.js} +1 -1
  61. package/dist/chunks/{agents-CdqcGm9o.js → agents-D7cgzb3f.js} +1 -1
  62. package/dist/chunks/{agents-D90TsYOf.js → agents-iMtFurok.js} +1 -1
  63. package/dist/chunks/{ant-DZjimiuz.js → ant-CF1iRpXD.js} +1 -1
  64. package/dist/chunks/{api-CQWbpxLP.js → api-DMbWqJlK.js} +1 -1
  65. package/dist/chunks/api-DkgaFAzq.js +1 -0
  66. package/dist/chunks/artifacts-D2kY_AMp.js +1 -0
  67. package/dist/chunks/{assistant-CyVcFPIR.js → assistant-CZ4VXgzH.js} +1 -1
  68. package/dist/chunks/assistant-CiNV3Q0f.js +1 -0
  69. package/dist/chunks/{assistant-CEmC_DlU.js → assistant-JAqAZqaE.js} +1 -1
  70. package/dist/chunks/{auth-DsQEVs9W.js → auth-BemPA3ot.js} +1 -1
  71. package/dist/chunks/auth-CbQCc9vz.js +1 -0
  72. package/dist/chunks/{autoMode-DEbM9UaE.js → autoMode-CGovMAzJ.js} +1 -1
  73. package/dist/chunks/{autonomy-Clap6Swl.js → autonomy-BVXyNEj0.js} +1 -1
  74. package/dist/chunks/{autonomy-lNpGnyiu.js → autonomy-BnAHLZWH.js} +1 -1
  75. package/dist/chunks/{autonomyPanel-BqEvfI0e.js → autonomyPanel-COMI2iR0.js} +1 -1
  76. package/dist/chunks/{backgroundHousekeeping-KvOpP_4M.js → backgroundHousekeeping-BRtG20l2.js} +2 -2
  77. package/dist/chunks/backgroundHousekeeping-LYpOamcN.js +1 -0
  78. package/dist/chunks/{banner-D9Cq292T.js → banner-D_rqe2XQ.js} +1 -1
  79. package/dist/chunks/{branch-CSYB04xC.js → branch-BnKwIQtC.js} +1 -1
  80. package/dist/chunks/{break-cache-DrIa8RdW.js → break-cache-CDzQDHwY.js} +1 -1
  81. package/dist/chunks/{bridge-DDgASypO.js → bridge-ChVjEHVq.js} +2 -2
  82. package/dist/chunks/bridgeConfig-Budgp2Go.js +1 -0
  83. package/dist/chunks/{bridgeConfig-DjC4oig1.js → bridgeConfig-e0MGfed6.js} +1 -1
  84. package/dist/chunks/{bridgeEnabled-Csn6Ym3k.js → bridgeEnabled-DR-v8AXw.js} +1 -1
  85. package/dist/chunks/bridgeEnabled-DmvmwuUY.js +1 -0
  86. package/dist/chunks/bridgeMain-KYR5iq6H.js +1 -0
  87. package/dist/chunks/{bridgeMain-B5wsmwkN.js → bridgeMain-OsR-_PRp.js} +6 -6
  88. package/dist/chunks/{bridgeMessaging-ChOzzVWj.js → bridgeMessaging-BvBnxgD4.js} +1 -1
  89. package/dist/chunks/{btw-BgjcOoeo.js → btw-_b16RGoh.js} +1 -1
  90. package/dist/chunks/{buddy-C1wE3noR.js → buddy-DJ3QSQyd.js} +1 -1
  91. package/dist/chunks/{bypassPermissionsKillswitch-C0diGLRB.js → bypassPermissionsKillswitch-OhGSWZrB.js} +1 -1
  92. package/dist/chunks/{caches-CIoVGP24.js → caches-Bp4F7tZ5.js} +2 -2
  93. package/dist/chunks/caches-CkH9F-Fd.js +1 -0
  94. package/dist/chunks/{ccrClient-C1msT1E3.js → ccrClient-D7pEGzQa.js} +1 -1
  95. package/dist/chunks/changeDetector-IFbty4jj.js +1 -0
  96. package/dist/chunks/{channelNotification-CWlu9ZWs.js → channelNotification-BZFMAWln.js} +1 -1
  97. package/dist/chunks/channelNotification-CIyWY0hs.js +1 -0
  98. package/dist/chunks/{chrome-Bo9uNZ7s.js → chrome-B5IxDA16.js} +1 -1
  99. package/dist/chunks/clear-BVjSQsUL.js +1 -0
  100. package/dist/chunks/client-BUUsZdSe.js +1 -0
  101. package/dist/chunks/{color-CkzktPHt.js → color-BYVWpzI8.js} +1 -1
  102. package/dist/chunks/commands-pTQdOvN6.js +1 -0
  103. package/dist/chunks/{commitAttribution-csu3NO7Y.js → commitAttribution-ClSlXMPG.js} +1 -1
  104. package/dist/chunks/commitAttribution-QPrKt_BF.js +1 -0
  105. package/dist/chunks/{compact-DNGIVZRN.js → compact-B9c12JXf.js} +1 -1
  106. package/dist/chunks/{companion-Diuav3lA.js → companion-C8e7dVlu.js} +1 -1
  107. package/dist/chunks/completionCache-BB7-y2BX.js +1 -0
  108. package/dist/chunks/{completionCache-C7hDqIDL.js → completionCache-Br6OwASx.js} +1 -1
  109. package/dist/chunks/{config-ODoYZY8i.js → config-Bxgfx_nO.js} +1 -1
  110. package/dist/chunks/{config-B25IrkTA.js → config-C-yz-f4W.js} +1 -1
  111. package/dist/chunks/{context-CZ5enuPE.js → context-Bf5t6C-a.js} +1 -1
  112. package/dist/chunks/{context-noninteractive-62P5EnN5.js → context-noninteractive-CJu7hZCM.js} +1 -1
  113. package/dist/chunks/context-noninteractive-OUTZ6BKj.js +1 -0
  114. package/dist/chunks/{conversation-DyhWeHw2.js → conversation-BYMS5Hqa.js} +1 -1
  115. package/dist/chunks/conversation-Bs8l0KNl.js +1 -0
  116. package/dist/chunks/{copy-9JLr2-Xs.js → copy-C0BZ7Gm0.js} +1 -1
  117. package/dist/chunks/{createSSHSession-B1hTuDpB.js → createSSHSession-DNXCWneI.js} +1 -1
  118. package/dist/chunks/{createSession-fzjzy0aS.js → createSession-DjM6Ev45.js} +1 -1
  119. package/dist/chunks/createSession-DpqtD4ML.js +1 -0
  120. package/dist/chunks/{cronJitterConfig-9OmmYmIT.js → cronJitterConfig-CaFkPXKB.js} +1 -1
  121. package/dist/chunks/{crossProjectResume-B6efoIur.js → crossProjectResume-BCr6jfGz.js} +1 -1
  122. package/dist/chunks/{daemon-BRKR4D1D.js → daemon-Bu0Uy-qG.js} +1 -1
  123. package/dist/chunks/{datadog-SSxsxcC-.js → datadog-ClZjR-jM.js} +1 -1
  124. package/dist/chunks/datadog-DlzPb5oG.js +1 -0
  125. package/dist/chunks/desktop-WH8s-9-6.js +1 -0
  126. package/dist/chunks/{diff-uAwKYa51.js → diff-D9hjPq4W.js} +1 -1
  127. package/dist/chunks/{doctor-CBF0fkBF.js → doctor-4-im_J_h.js} +1 -1
  128. package/dist/chunks/earlyInput-DEZaWwKF.js +1 -0
  129. package/dist/chunks/{effort-F-bhAM2u.js → effort-Bz-9GIpe.js} +1 -1
  130. package/dist/chunks/entry-CEBaLwEG.js +14 -0
  131. package/dist/chunks/{envLessBridgeConfig-Dg0hNsdi.js → envLessBridgeConfig-DW4-nPbZ.js} +1 -1
  132. package/dist/chunks/envLessBridgeConfig-izoVnE8s.js +1 -0
  133. package/dist/chunks/{exit-CqcvZJwI.js → exit-DBNDTR4b.js} +1 -1
  134. package/dist/chunks/{export-c6WoGlsG.js → export-CQHUM_Nv.js} +1 -1
  135. package/dist/chunks/{exportRenderer-CaegIP5N.js → exportRenderer-CuIDQBLH.js} +1 -1
  136. package/dist/chunks/{extra-usage-Cj8fokgc.js → extra-usage-DTr6gExD.js} +1 -1
  137. package/dist/chunks/extra-usage-VSASGlte.js +1 -0
  138. package/dist/chunks/{extra-usage-core-sHzc4eE1.js → extra-usage-core-D3CwYO_8.js} +1 -1
  139. package/dist/chunks/{extra-usage-noninteractive-D0kqrqsg.js → extra-usage-noninteractive-d-QVg1D5.js} +1 -1
  140. package/dist/chunks/{extraUsage-CbkqfG1U.js → extraUsage-BNRQOkgU.js} +1 -1
  141. package/dist/chunks/extractMemories-hQlhiVOD.js +1 -0
  142. package/dist/chunks/fast-2gWrhEFZ.js +1 -0
  143. package/dist/chunks/{fast-DS3iQ1CH.js → fast-bkGXbuHX.js} +1 -1
  144. package/dist/chunks/{feedback-QJynmG5q.js → feedback-BvFgE_FF.js} +1 -1
  145. package/dist/chunks/{firstPartyEventLogger-DlW8BUXq.js → firstPartyEventLogger-D-ifHvWu.js} +1 -1
  146. package/dist/chunks/{flushGate-CK5B9-Zn.js → flushGate-BA24vFBg.js} +1 -1
  147. package/dist/chunks/{fpsMetrics-DKWp7vng.js → fpsMetrics-CBFlAGTS.js} +1 -1
  148. package/dist/chunks/{gates-vlrMjO-X.js → gates-C66Nz9b2.js} +1 -1
  149. package/dist/chunks/gates-dO6m4Hdp.js +1 -0
  150. package/dist/chunks/{gemini-B5ZRjDrh.js → gemini-DuQl4hTA.js} +1 -1
  151. package/dist/chunks/{generateRecap-SgRMdsyN.js → generateRecap-CwBU76xi.js} +1 -1
  152. package/dist/chunks/{generateSessionName-sZFzpwsq.js → generateSessionName-LnmjE9jh.js} +1 -1
  153. package/dist/chunks/{githubRepoPathMapping-DUGvTwPB.js → githubRepoPathMapping-DrreQj47.js} +1 -1
  154. package/dist/chunks/{goal-Dy-GGn9r.js → goal-BIvjF6B7.js} +1 -1
  155. package/dist/chunks/{grok-BG4_buNt.js → grok-KNLYSRBQ.js} +1 -1
  156. package/dist/chunks/{growthbook-Br1dDRtd.js → growthbook-ksjGAskq.js} +1 -1
  157. package/dist/chunks/{heapdump-B9PVKMxa.js → heapdump-Cz8vkcOr.js} +1 -1
  158. package/dist/chunks/{help-BfWF7xij.js → help-Cx9OordP.js} +1 -1
  159. package/dist/chunks/{hooks-KK32pxq3.js → hooks-BW-d9Bdu.js} +1 -1
  160. package/dist/chunks/hooks-BWoN0nQP.js +1 -0
  161. package/dist/chunks/{hostAdapter-TBJav3vX.js → hostAdapter-DLmaB6eN.js} +1 -1
  162. package/dist/chunks/{ide-BU1A79BE.js → ide-CECrIg1r.js} +1 -1
  163. package/dist/chunks/{inboundAttachments-D4tBPCB8.js → inboundAttachments-B0sGIu79.js} +1 -1
  164. package/dist/chunks/inboundAttachments-D8vq1NQO.js +1 -0
  165. package/dist/chunks/{initReplBridge-99sUBVEk.js → initReplBridge-BAEMZEcg.js} +1 -1
  166. package/dist/chunks/{insights-lDHodCMG.js → insights-DeWggLxC.js} +1 -1
  167. package/dist/chunks/{install-github-app-RLbUq5EL.js → install-github-app-DqKEiHQ1.js} +1 -1
  168. package/dist/chunks/{install-Bg4ZgW81.js → install-pxH_HR1p.js} +1 -1
  169. package/dist/chunks/{install-slack-app-CHmIwsbm.js → install-slack-app-P1L9x-YI.js} +1 -1
  170. package/dist/chunks/{instrumentation-BCiV3SKX.js → instrumentation-Dx0s2jzr.js} +3 -3
  171. package/dist/chunks/{job-xOGf0j5Q.js → job-CbxxkPgE.js} +1 -1
  172. package/dist/chunks/{keybindings-DMbReZ4p.js → keybindings-BBPC7FAc.js} +1 -1
  173. package/dist/chunks/{lang-A6LUGP_7.js → lang-CKp0Tn76.js} +1 -1
  174. package/dist/chunks/language-CSDpzbTz.js +1 -0
  175. package/dist/chunks/{language-CGfURU2y.js → language-iERMuOEu.js} +1 -1
  176. package/dist/chunks/{launchAgentsPlatform-Dbpm7Jyo.js → launchAgentsPlatform-DQvKVtl2.js} +1 -1
  177. package/dist/chunks/{launchAutofixPr-RZfqx5eM.js → launchAutofixPr-B7hu9C8h.js} +1 -1
  178. package/dist/chunks/{launchCommand-9eYsPG7W.js → launchCommand-CJsikSlW.js} +1 -1
  179. package/dist/chunks/{launchLocalMemory-DIntbsvg.js → launchLocalMemory-Cpz7L5j5.js} +1 -1
  180. package/dist/chunks/{launchLocalVault-CCUw0ayu.js → launchLocalVault-XLfOQtP7.js} +1 -1
  181. package/dist/chunks/{launchMemoryStores-QJTh8KSP.js → launchMemoryStores-Cz04PaDE.js} +1 -1
  182. package/dist/chunks/{launchOnboarding--Pe30AYd.js → launchOnboarding-XPbUNdHS.js} +1 -1
  183. package/dist/chunks/{launchSchedule-DjN1RbRX.js → launchSchedule-B1VEe3o-.js} +1 -1
  184. package/dist/chunks/{launchSkillStore-CcKmVDz1.js → launchSkillStore-Cy59z5xx.js} +1 -1
  185. package/dist/chunks/{launchTeleport-BKlEo0yF.js → launchTeleport-ZPM_DvzK.js} +1 -1
  186. package/dist/chunks/{launchVault-C7UHA-IG.js → launchVault-BhnTOZq8.js} +1 -1
  187. package/dist/chunks/loadAgentsDir-B-4D2dVE.js +1 -0
  188. package/dist/chunks/{loadAgentsDir-ClTeo0nk.js → loadAgentsDir-CQF8qhne.js} +751 -751
  189. package/dist/chunks/{loadPluginHooks-DVZmzYLl.js → loadPluginHooks-TyULD8KH.js} +1 -1
  190. package/dist/chunks/{localSearch-Koc8naSr.js → localSearch-BNYypHsK.js} +1 -1
  191. package/dist/chunks/localSearch-DsFH9yls.js +1 -0
  192. package/dist/chunks/login-CEJEl2mW.js +1 -0
  193. package/dist/chunks/{login-C3MZQTDL.js → login-CxbcJk9_.js} +1 -1
  194. package/dist/chunks/{logoV2Utils-DAIIwt5R.js → logoV2Utils-Br_w1z39.js} +1 -1
  195. package/dist/chunks/logout-BXr4jzNY.js +1 -0
  196. package/dist/chunks/{magicDocs-C_inI3JJ.js → magicDocs-DnxdS9yV.js} +1 -1
  197. package/dist/chunks/{main-qqcmncHA.js → main-FBmdv32j.js} +139 -60
  198. package/dist/chunks/{mappers-7BSMbYvH.js → mappers-BNI_df3v.js} +1 -1
  199. package/dist/chunks/{mcp-DV8Prhgi.js → mcp-BhAGhDQE.js} +1 -1
  200. package/dist/chunks/{mcp-DRBiobrN.js → mcp-DbqUZ1Cf.js} +1 -1
  201. package/dist/chunks/{mcp-HQ8-nEZ1.js → mcp-esqdO_lV.js} +3 -3
  202. package/dist/chunks/{mcpServer-DS0yRfcu.js → mcpServer-Ct-GVL-y.js} +1 -1
  203. package/dist/chunks/{mcpServer-CLIYAgGs.js → mcpServer-DeL2ADSF.js} +1 -1
  204. package/dist/chunks/{memory-Cz_JaFLF.js → memory-DwapBEsD.js} +1 -1
  205. package/dist/chunks/{mobile-BMglW1NB.js → mobile-D7MSmMhc.js} +1 -1
  206. package/dist/chunks/{modalContext-c5Yqx_CQ.js → modalContext-DxfeT_3m.js} +1 -1
  207. package/dist/chunks/{mode-Kx0kSZkr.js → mode-B5cmHCvz.js} +1 -1
  208. package/dist/chunks/{model-CNXtfiLg.js → model-BePO0VaC.js} +1 -1
  209. package/dist/chunks/model-CgH43-hO.js +1 -0
  210. package/dist/chunks/{onChangeAppState-C4ic-Mib.js → onChangeAppState-B3d5iy6T.js} +1 -1
  211. package/dist/chunks/{openai-CGGSfpPh.js → openai-fRhGOIQq.js} +1 -1
  212. package/dist/chunks/{overageCreditGrant-BqW_6R5v.js → overageCreditGrant-B6sx7IFi.js} +1 -1
  213. package/dist/chunks/{panel-D3wvAEFE.js → panel-CAVG5BOM.js} +1 -1
  214. package/dist/chunks/{panel-BYfvo_mR.js → panel-DU8y_jcf.js} +1 -1
  215. package/dist/chunks/{panelCall-DgPjuhQf.js → panelCall-DUQdjDee.js} +1 -1
  216. package/dist/chunks/{passes-sYE91Vtr.js → passes-CWPPUigp.js} +1 -1
  217. package/dist/chunks/{paths-DO4WOQtD.js → paths-4ZWdjPP4.js} +3 -3
  218. package/dist/chunks/{permissions-BPerbf1I.js → permissions-DW8CRuJp.js} +1 -1
  219. package/dist/chunks/{pipeTransport-CW9zF_UN.js → pipeTransport-CUeYRWJn.js} +1 -1
  220. package/dist/chunks/{plan-CDKBVRw6.js → plan-Cf-tHvGq.js} +1 -1
  221. package/dist/chunks/plugin-DXhCgoNC.js +1 -0
  222. package/dist/chunks/{pluginAutoupdate-BQKtcAhC.js → pluginAutoupdate-CdmKzIRf.js} +1 -1
  223. package/dist/chunks/{pluginBlocklist-B8DKXi0i.js → pluginBlocklist-C9XwbFSo.js} +1 -1
  224. package/dist/chunks/{pluginCliCommands-DWCeXYTl.js → pluginCliCommands-CmY_maYg.js} +1 -1
  225. package/dist/chunks/{pluginFlagging-DFMlWw2P.js → pluginFlagging-DyzxZolj.js} +1 -1
  226. package/dist/chunks/{pluginOperations-CKmwDC3G.js → pluginOperations-mr4I7Jw9.js} +1 -1
  227. package/dist/chunks/{pluginStartupCheck-D6IbyWKe.js → pluginStartupCheck-B6OdK29Z.js} +1 -1
  228. package/dist/chunks/pluginStartupCheck-BFuZqpnX.js +1 -0
  229. package/dist/chunks/{plugins-BwZIRMh_.js → plugins-rdPgpjF8.js} +1 -1
  230. package/dist/chunks/policyLimits-B3dtp_Fe.js +1 -0
  231. package/dist/chunks/{pollConfig-C3NjXYFc.js → pollConfig-DLbuHBse.js} +1 -1
  232. package/dist/chunks/{poor-BHhbua95.js → poor-pmz2b7zu.js} +1 -1
  233. package/dist/chunks/poorMode-BPIUnFFi.js +1 -0
  234. package/dist/chunks/{poorMode-mtlnXU-z.js → poorMode-DD-q_w6Z.js} +1 -1
  235. package/dist/chunks/{print-kxnXkqGc.js → print-luaON-Cg.js} +4 -4
  236. package/dist/chunks/{privacy-settings-DjY1annR.js → privacy-settings-BpigC4oX.js} +1 -1
  237. package/dist/chunks/{processBashCommand-BrqLqSva.js → processBashCommand-f_84bSlP.js} +1 -1
  238. package/dist/chunks/{processSlashCommand-DJGdVGbK.js → processSlashCommand-BkBqV3Jd.js} +1 -1
  239. package/dist/chunks/{projectContext-Cd7V9pES.js → projectContext-fS1t-xRh.js} +1 -1
  240. package/dist/chunks/{prompt-CfM_xGPc.js → prompt-CogZQuTN.js} +1 -1
  241. package/dist/chunks/prompt-CriAIdkT.js +1 -0
  242. package/dist/chunks/prompt-TGc_H1cL.js +1 -0
  243. package/dist/chunks/{promptEditor-FI_ewCpV.js → promptEditor-C___2FFs.js} +1 -1
  244. package/dist/chunks/{protocolHandler-B7ybKpgJ.js → protocolHandler-qwll5gSY.js} +1 -1
  245. package/dist/chunks/{rate-limit-options-DPJMNNou.js → rate-limit-options-nQcTipEp.js} +1 -1
  246. package/dist/chunks/{rcDebugLog-CwU_wJBE.js → rcDebugLog-DOXxIr8l.js} +1 -1
  247. package/dist/chunks/{referral-Da4mpbd3.js → referral-CMPZjf3I.js} +1 -1
  248. package/dist/chunks/{refresh-B6X4xb9r.js → refresh-CP7Dnjp4.js} +1 -1
  249. package/dist/chunks/{registerProtocol-D8fFnceq.js → registerProtocol-DCNuqdCC.js} +1 -1
  250. package/dist/chunks/{registry-y_z3pTg3.js → registry-DLqZJleQ.js} +1 -1
  251. package/dist/chunks/{release-notes--tnd4K56.js → release-notes-BsDW6T9f.js} +1 -1
  252. package/dist/chunks/{releaseNotes-BPA229-J.js → releaseNotes-Tbd018Qz.js} +2 -2
  253. package/dist/chunks/{reload-plugins-yQ7tEUVh.js → reload-plugins-iG9ZE9wF.js} +1 -1
  254. package/dist/chunks/{remote-env-CER5UxTX.js → remote-env-BFntnltf.js} +1 -1
  255. package/dist/chunks/{remoteBridgeCore-Bi31i8gt.js → remoteBridgeCore-Dpko9c-J.js} +1 -1
  256. package/dist/chunks/{remoteControlServer-oUAcWB4i.js → remoteControlServer-D3P82kVF.js} +1 -1
  257. package/dist/chunks/{rename-BTngRRZU.js → rename-Codm2nfB.js} +1 -1
  258. package/dist/chunks/{resume-DZHKfBmm.js → resume-BB1ceL_x.js} +1 -1
  259. package/dist/chunks/{runtimeObserver-B4KekIF0.js → runtimeObserver-BpRn0RiL.js} +1 -1
  260. package/dist/chunks/{runtimeObserver-BUOcYxiK.js → runtimeObserver-D6aF77Dq.js} +2 -2
  261. package/dist/chunks/sandbox-adapter-DrHD1mch.js +1 -0
  262. package/dist/chunks/{sandbox-toggle-DLBL7myN.js → sandbox-toggle-DZ-8qXDS.js} +1 -1
  263. package/dist/chunks/searchExtraTools-Dwg6ZafS.js +1 -0
  264. package/dist/chunks/{sentry-B7ZBc8fA.js → sentry-CVdHlmNQ.js} +1 -1
  265. package/dist/chunks/{session-DWYQk9YN.js → session-B4j1ViVc.js} +1 -1
  266. package/dist/chunks/{sessionDiscovery-BP0nv36F.js → sessionDiscovery-DkIIFsWX.js} +1 -1
  267. package/dist/chunks/sessionFileAccessHooks-n7HcOfZ7.js +1 -0
  268. package/dist/chunks/{sessionMemory-pT4lc1C-.js → sessionMemory-CnT3-Mj7.js} +1 -1
  269. package/dist/chunks/sessionMemory-DVq43VXP.js +1 -0
  270. package/dist/chunks/sessionMemoryUtils-BjkdLRvh.js +1 -0
  271. package/dist/chunks/sessionObserver-CrfmnMzL.js +1 -0
  272. package/dist/chunks/{sessionObserver-D4SV0Ar3.js → sessionObserver-gjdJ91cv.js} +1 -1
  273. package/dist/chunks/sessionStorage-BTbr9wkZ.js +1 -0
  274. package/dist/chunks/{sessionTitle-CkrnWEW1.js → sessionTitle-CSU5-VK9.js} +1 -1
  275. package/dist/chunks/{sessionTracing-Caw-kvQr.js → sessionTracing-BDN64fWh.js} +1 -1
  276. package/dist/chunks/{settingsSync-Dn_lGonC.js → settingsSync-Nixbcaox.js} +1 -1
  277. package/dist/chunks/{setup-Dihjl7jo.js → setup-9nXlu56r.js} +1 -1
  278. package/dist/chunks/{setup-II1titXI.js → setup-CZxLEcQh.js} +1 -1
  279. package/dist/chunks/{setup-DGkOT4DX.js → setup-n3Ixr_gs.js} +3 -2
  280. package/dist/chunks/{shadowedRuleDetection-DASW3j9H.js → shadowedRuleDetection-CCS7R7F1.js} +1 -1
  281. package/dist/chunks/{sideQuestion-C1qbLTAL.js → sideQuestion-MzExGTvn.js} +1 -1
  282. package/dist/chunks/{sink-CqOAfFlL.js → sink-BL75jACh.js} +1 -1
  283. package/dist/chunks/sink-CoUVbLFs.js +1 -0
  284. package/dist/chunks/{sinks-BT_lBY6T.js → sinks-C-gxj_Eu.js} +2 -2
  285. package/dist/chunks/sinks-wuo1yQ_m.js +1 -0
  286. package/dist/chunks/{skill-learning-kh0HKn6u.js → skill-learning-B9Msm4jG.js} +1 -1
  287. package/dist/chunks/{skillChangeDetector-DQuNepIV.js → skillChangeDetector-DlWPJTny.js} +1 -1
  288. package/dist/chunks/{skillGapStore-CFmLJlYm.js → skillGapStore-Cpmbwyo3.js} +1 -1
  289. package/dist/chunks/{skillGapStore-B1gUQXhE.js → skillGapStore-CsADiV5a.js} +2 -2
  290. package/dist/chunks/{skillGenerator-DIAwRpPg.js → skillGenerator-_khb-Gmc.js} +2 -2
  291. package/dist/chunks/skillLearning-CFnZiM5J.js +1 -0
  292. package/dist/chunks/skillLearning-D6mvGN90.js +1 -0
  293. package/dist/chunks/{skillPanel-B9zJLHKV.js → skillPanel-DQmj3Yh1.js} +3 -3
  294. package/dist/chunks/{skillSearchPanel-C1O9sxYS.js → skillSearchPanel-6w_zzoI3.js} +2 -2
  295. package/dist/chunks/{skills-C6_3snFY.js → skills-B3LN9tp9.js} +1 -1
  296. package/dist/chunks/{sprites-59l7vF4l.js → sprites-8JVWnXzp.js} +1 -1
  297. package/dist/chunks/{src-poaoYkuc.js → src-BJM0zMNO.js} +1 -1
  298. package/dist/chunks/{src-Di342QoJ.js → src-KjMLauwe.js} +1 -1
  299. package/dist/chunks/startupProfiler-BmnoJtfF.js +1 -0
  300. package/dist/chunks/{startupProfiler-CAntGAbs.js → startupProfiler-rCtNuhXz.js} +1 -1
  301. package/dist/chunks/{staticRender-C5v46np_.js → staticRender-DboURbK0.js} +1 -1
  302. package/dist/chunks/{stats-BmGdg4nj.js → stats-BDlygx5X.js} +1 -1
  303. package/dist/chunks/status-DlT1tUmc.js +1 -0
  304. package/dist/chunks/{statusNoticeHelpers-DuqyBY-N.js → statusNoticeHelpers-Cd_LDPvn.js} +1 -1
  305. package/dist/chunks/{tag-0vahEnrx.js → tag-BLPgXlQZ.js} +1 -1
  306. package/dist/chunks/tasks-Bf1Nf3WX.js +1 -0
  307. package/dist/chunks/{teamHelpers-CXAmvFco.js → teamHelpers-B-poMJeE.js} +1 -1
  308. package/dist/chunks/teamHelpers-DeQCfdgu.js +1 -0
  309. package/dist/chunks/{teammateModeSnapshot-CdiglTzv.js → teammateModeSnapshot-B1_3D1CQ.js} +1 -1
  310. package/dist/chunks/teammateModeSnapshot-BRuKcJNr.js +1 -0
  311. package/dist/chunks/{teleport-D6PvdjPy.js → teleport-CSo3PT05.js} +1 -1
  312. package/dist/chunks/{templateJobs-Ox5ZTKjW.js → templateJobs-BVebX2BK.js} +1 -1
  313. package/dist/chunks/{terminalSetup-hLCi-2uB.js → terminalSetup-DHWL0gnz.js} +1 -1
  314. package/dist/chunks/{terminalSetup-Dh70ynBX.js → terminalSetup-DZTEKKne.js} +1 -1
  315. package/dist/chunks/{theme-DxgUVq9C.js → theme-BHQSNwSe.js} +1 -1
  316. package/dist/chunks/thinkback-CVYpxAyO.js +1 -0
  317. package/dist/chunks/{thinkback-DWgU7Qhr.js → thinkback-DOzxcgMy.js} +1 -1
  318. package/dist/chunks/{thinkback-play-CDzY6Ux4.js → thinkback-play-CK1C_F7G.js} +1 -1
  319. package/dist/chunks/{toolEventObserver-jO6-mlFU.js → toolEventObserver-BIjUIh4k.js} +1 -1
  320. package/dist/chunks/{toolEventObserver-DPoMAJwr.js → toolEventObserver-XPorjjtG.js} +1 -1
  321. package/dist/chunks/toolPool-CDEeuQd2.js +1 -0
  322. package/dist/chunks/{toolPool-Dgn1Clq8.js → toolPool-hQlvQn-j.js} +1 -1
  323. package/dist/chunks/{trustedDevice-CYR5AgSB.js → trustedDevice-CyfQd_GU.js} +1 -1
  324. package/dist/chunks/{trustedDevice-D35gYkBT.js → trustedDevice-D-L5uAor.js} +1 -1
  325. package/dist/chunks/{tui-DoOiz2RW.js → tui-C7aBeORE.js} +1 -1
  326. package/dist/chunks/{ultrareviewCommand-o4GjzoXK.js → ultrareviewCommand-rnMsUWTn.js} +1 -1
  327. package/dist/chunks/undercover-BviGW-bQ.js +1 -0
  328. package/dist/chunks/{undercover-B4xr62Ux.js → undercover-ClLYK52H.js} +1 -1
  329. package/dist/chunks/{updateCCB-Cthn50OV.js → updateCCB-pqkACWbs.js} +1 -1
  330. package/dist/chunks/upgrade-DAuhXFVI.js +1 -0
  331. package/dist/chunks/{upgrade-D4Id4ebd.js → upgrade-DpfZlPyC.js} +1 -1
  332. package/dist/chunks/{upload-BFDXvdfb.js → upload-D98tqZnO.js} +1 -1
  333. package/dist/chunks/{usage-Csbso5mD.js → usage-BWd5R6DU.js} +1 -1
  334. package/dist/chunks/{usage-DxudeFLL.js → usage-CRquq5_O.js} +1 -1
  335. package/dist/chunks/{useExitOnCtrlCDWithKeybindings-BHi41Ku_.js → useExitOnCtrlCDWithKeybindings-Dkcp6EkA.js} +1 -1
  336. package/dist/chunks/useKeybinding-DOjEx42R.js +1 -0
  337. package/dist/chunks/useMainLoopModel-BZoZdEdj.js +1 -0
  338. package/dist/chunks/{useManagePlugins-BmS3Adja.js → useManagePlugins-DMY74XAk.js} +1 -1
  339. package/dist/chunks/{useMergedTools-wR6Bglqq.js → useMergedTools-NN58Kguw.js} +1 -1
  340. package/dist/chunks/{useSearchInput-BhKAGgEN.js → useSearchInput-CodP_5SB.js} +1 -1
  341. package/dist/chunks/{useSettingsErrors-CjK3P-Ki.js → useSettingsErrors-BRxaYl6B.js} +1 -1
  342. package/dist/chunks/useTerminalSize-mqo2Swmk.js +1 -0
  343. package/dist/chunks/{useVoice-DP1hHBWA.js → useVoice-ByU-q_w4.js} +1 -1
  344. package/dist/chunks/{util-CMSErQoz.js → util-SpgBY5_I.js} +1 -1
  345. package/dist/chunks/utils-CM5oEyAY.js +1 -0
  346. package/dist/chunks/{validatePlugin-_g0AqWZG.js → validatePlugin-CxCXNV8o.js} +1 -1
  347. package/dist/chunks/{vim-8y-2Q09k.js → vim-ByXlYzf9.js} +1 -1
  348. package/dist/chunks/{voice-BJAsr0K-.js → voice-BnLS_SdQ.js} +1 -1
  349. package/dist/chunks/voiceModeEnabled-B3njLfhA.js +1 -0
  350. package/dist/chunks/{voiceModeEnabled-BD9GZhQ3.js → voiceModeEnabled-D070o6QK.js} +1 -1
  351. package/dist/chunks/voiceStreamSTT-BkeyhhFJ.js +1 -0
  352. package/dist/chunks/{voiceStreamSTT-B1T-8adN.js → voiceStreamSTT-vkQ-Aop7.js} +1 -1
  353. package/dist/chunks/{web-tools-DVIvcP41.js → web-tools-1yM0ZBfA.js} +1 -1
  354. package/dist/chunks/{workerRegistry-60_UCyc3.js → workerRegistry-7xGv_sNB.js} +1 -1
  355. package/dist/chunks/worktree-UA9gKCwL.js +1 -0
  356. package/dist/chunks/{xml-CTdKuU6f.js → xml-BUaEXGXx.js} +1 -1
  357. package/dist/cli.js +1 -1
  358. package/package.json +1 -1
  359. package/dist/chunks/ApproveApiKey-B7_TCGwt.js +0 -1
  360. package/dist/chunks/ClaudeMdExternalIncludesDialog-DxJK9NiM.js +0 -1
  361. package/dist/chunks/ConsoleOAuthFlow-LPZ97jsm.js +0 -1
  362. package/dist/chunks/Dialog-91X6ZGg9.js +0 -1
  363. package/dist/chunks/Doctor-hgf3dMAW.js +0 -1
  364. package/dist/chunks/Grove-Bwmghb-e.js +0 -1
  365. package/dist/chunks/ListItem-DCQhApdJ.js +0 -1
  366. package/dist/chunks/REPL-nP7H_-qa.js +0 -1
  367. package/dist/chunks/RemoteSessionManager-jcPnywfY.js +0 -2
  368. package/dist/chunks/SearchBox-CkO4rQ-9.js +0 -1
  369. package/dist/chunks/SearchExtraToolsTool-C64oVFUD.js +0 -1
  370. package/dist/chunks/SentryErrorBoundary-2E2qGV11.js +0 -1
  371. package/dist/chunks/api-quOYYOhi.js +0 -1
  372. package/dist/chunks/assistant-B5_xx00q.js +0 -1
  373. package/dist/chunks/auth-CjtaiRtF.js +0 -1
  374. package/dist/chunks/backgroundHousekeeping-D-jt-ocx.js +0 -1
  375. package/dist/chunks/bridgeConfig-BdZVEqhx.js +0 -1
  376. package/dist/chunks/bridgeEnabled-DLRIH243.js +0 -1
  377. package/dist/chunks/bridgeMain-BN0Sag35.js +0 -1
  378. package/dist/chunks/caches-DMYdTEAr.js +0 -1
  379. package/dist/chunks/changeDetector-DoOBZOt1.js +0 -1
  380. package/dist/chunks/channelNotification-oZ6vG5R5.js +0 -1
  381. package/dist/chunks/clear-BxdX_MUP.js +0 -1
  382. package/dist/chunks/client-BSoJ_vaA.js +0 -1
  383. package/dist/chunks/commands-hyVX9-Lh.js +0 -1
  384. package/dist/chunks/commitAttribution-BwT0TbYF.js +0 -1
  385. package/dist/chunks/completionCache-BQgiR45Q.js +0 -1
  386. package/dist/chunks/context-noninteractive-CjuzL9q5.js +0 -1
  387. package/dist/chunks/conversation-uY-V0SNK.js +0 -1
  388. package/dist/chunks/createSession-Qurw-N4x.js +0 -1
  389. package/dist/chunks/datadog-C-llbwzP.js +0 -1
  390. package/dist/chunks/desktop-CQnMcbex.js +0 -1
  391. package/dist/chunks/earlyInput-D3OhUZ4G.js +0 -1
  392. package/dist/chunks/entry-DHN_Gr1b.js +0 -14
  393. package/dist/chunks/envLessBridgeConfig-CDVtIEWT.js +0 -1
  394. package/dist/chunks/extra-usage-Dk-wcvAu.js +0 -1
  395. package/dist/chunks/extractMemories-BP8Opsbp.js +0 -1
  396. package/dist/chunks/fast-DklfqySb.js +0 -1
  397. package/dist/chunks/gates-6amRNsYl.js +0 -1
  398. package/dist/chunks/hooks-BVrhxysz.js +0 -1
  399. package/dist/chunks/inboundAttachments-DWJplT9p.js +0 -1
  400. package/dist/chunks/language-Bzp5KDCE.js +0 -1
  401. package/dist/chunks/loadAgentsDir-CshktEpX.js +0 -1
  402. package/dist/chunks/localSearch-BtLNJRij.js +0 -1
  403. package/dist/chunks/login-BngE89_j.js +0 -1
  404. package/dist/chunks/logout-CXZBaUen.js +0 -1
  405. package/dist/chunks/model-Bwvn_acH.js +0 -1
  406. package/dist/chunks/plugin-C6US4b8W.js +0 -1
  407. package/dist/chunks/pluginStartupCheck-cYnLsWOs.js +0 -1
  408. package/dist/chunks/policyLimits-CFLBtFh3.js +0 -1
  409. package/dist/chunks/poorMode-CCK7Ek5w.js +0 -1
  410. package/dist/chunks/prompt-BZjXpviP.js +0 -1
  411. package/dist/chunks/prompt-CusKF4-p.js +0 -1
  412. package/dist/chunks/sandbox-adapter-C--j-c76.js +0 -1
  413. package/dist/chunks/searchExtraTools-CBYp5XeI.js +0 -1
  414. package/dist/chunks/sessionFileAccessHooks-DVilA3Mm.js +0 -1
  415. package/dist/chunks/sessionMemory-cMgcTxtP.js +0 -1
  416. package/dist/chunks/sessionMemoryUtils-BgYf2OvX.js +0 -1
  417. package/dist/chunks/sessionObserver-CzyEF7mg.js +0 -1
  418. package/dist/chunks/sessionStorage-CXBgVAx-.js +0 -1
  419. package/dist/chunks/sink-BSPyC453.js +0 -1
  420. package/dist/chunks/sinks-CpuRIC3H.js +0 -1
  421. package/dist/chunks/skillLearning-Bxu1Uzl-.js +0 -1
  422. package/dist/chunks/skillLearning-CxAbHYEk.js +0 -1
  423. package/dist/chunks/startupProfiler-WtUzkMKV.js +0 -1
  424. package/dist/chunks/status-KLPT7uYP.js +0 -1
  425. package/dist/chunks/tasks-zVPemGv7.js +0 -1
  426. package/dist/chunks/teamHelpers-B83RwCCC.js +0 -1
  427. package/dist/chunks/teammateModeSnapshot-AdUFmPGC.js +0 -1
  428. package/dist/chunks/thinkback-C5vFU8dM.js +0 -1
  429. package/dist/chunks/toolPool-BmA-BnAq.js +0 -1
  430. package/dist/chunks/undercover-nakrQDLh.js +0 -1
  431. package/dist/chunks/upgrade-DJTCV8sr.js +0 -1
  432. package/dist/chunks/useKeybinding-DPOUuymz.js +0 -1
  433. package/dist/chunks/useMainLoopModel-CEqP4HOc.js +0 -1
  434. package/dist/chunks/useTerminalSize-Du-EamDN.js +0 -1
  435. package/dist/chunks/utils-CAQfwbv8.js +0 -1
  436. package/dist/chunks/voiceModeEnabled-DZbxaFIg.js +0 -1
  437. package/dist/chunks/voiceStreamSTT-B39XaGOU.js +0 -1
  438. package/dist/chunks/worktree-DNK8NprA.js +0 -1
  439. /package/dist/chunks/{InProcessTransport-B9II3BiO.js → InProcessTransport-DW2ed2Hs.js} +0 -0
  440. /package/dist/chunks/{attributionHooks-VGSpz4mk.js → attributionHooks-COqmxGy1.js} +0 -0
  441. /package/dist/chunks/{attributionTrailer-C8uqiLIb.js → attributionTrailer-Nx8I_ZRK.js} +0 -0
  442. /package/dist/chunks/{autoModeDenials-DlO5g6E9.js → autoModeDenials-BDpcFLb7.js} +0 -0
  443. /package/dist/chunks/{bedrockClient-BUmO2U-X.js → bedrockClient-BfPpXPI0.js} +0 -0
  444. /package/dist/chunks/{ccshareResume-DKwcd0Vc.js → ccshareResume-DPP1blaU.js} +0 -0
  445. /package/dist/chunks/{chromeNativeHost-BldB1Zzi.js → chromeNativeHost-DfYuJafI.js} +0 -0
  446. /package/dist/chunks/{claudeDesktop-BqTW_pbB.js → claudeDesktop-CEQCLZmG.js} +0 -0
  447. /package/dist/chunks/{cleanup-rCLlo4w8.js → cleanup-DUVwlFl7.js} +0 -0
  448. /package/dist/chunks/{connectHeadless-ByewVfOb.js → connectHeadless-DutPm1RT.js} +0 -0
  449. /package/dist/chunks/{dangerousBackend-Dkjtndh1.js → dangerousBackend-BDKHrF6i.js} +0 -0
  450. /package/dist/chunks/{earlyInput-CFYRGxau.js → earlyInput-B3U01GAm.js} +0 -0
  451. /package/dist/chunks/{eventLoopStallDetector-bYy0fesH.js → eventLoopStallDetector-MNrFR4OH.js} +0 -0
  452. /package/dist/chunks/{files-Bdr_PQyV.js → files-BGuNpYgH.js} +0 -0
  453. /package/dist/chunks/{fuse-D3B-UE5Y.js → fuse-D7icKomM.js} +0 -0
  454. /package/dist/chunks/{instinctParser-DOtj1Kni.js → instinctParser-BMtAMLSx.js} +0 -0
  455. /package/dist/chunks/{lockfile-C3JsqLpb.js → lockfile-DEaq0BaL.js} +0 -0
  456. /package/dist/chunks/{main-CfkIGrBF.js → main-SFdnVz-G.js} +0 -0
  457. /package/dist/chunks/{observationStore-rLlDwRtG.js → observationStore-Bi1rRKcD.js} +0 -0
  458. /package/dist/chunks/{openaiShared-C-AuktRP.js → openaiShared-BkVgd2rZ.js} +0 -0
  459. /package/dist/chunks/{output-style-B64-Zum6.js → output-style-F8fBWFZo.js} +0 -0
  460. /package/dist/chunks/{parseConnectUrl-DL390ePs.js → parseConnectUrl-CVT_db9n.js} +0 -0
  461. /package/dist/chunks/{poller-BA1jhG3F.js → poller-DhLgWNxJ.js} +0 -0
  462. /package/dist/chunks/{postCommitAttribution-D8MoHFoz.js → postCommitAttribution-Br4g4R6h.js} +0 -0
  463. /package/dist/chunks/{projectContext-Dn7umMp6.js → projectContext-2Z2w8AI8.js} +0 -0
  464. /package/dist/chunks/{renderOptions-Caca3bCd.js → renderOptions-4HxIPoDZ.js} +0 -0
  465. /package/dist/chunks/{rewind-Djt1zU_3.js → rewind-FKh7loMA.js} +0 -0
  466. /package/dist/chunks/{sanitization-Ds6zRQyx.js → sanitization-B-JlvWcf.js} +0 -0
  467. /package/dist/chunks/{sdkHeapDumpMonitor-DLMMNeqo.js → sdkHeapDumpMonitor-DTHI5WbD.js} +0 -0
  468. /package/dist/chunks/{server-DONKdvGc.js → server-BsxW1FVq.js} +0 -0
  469. /package/dist/chunks/{serverBanner-DIyjgIM-.js → serverBanner-DR3GYXpH.js} +0 -0
  470. /package/dist/chunks/{serverLog-D1N5yx8A.js → serverLog-CH1fCGsD.js} +0 -0
  471. /package/dist/chunks/{sessionDataUploader-CsNePsOb.js → sessionDataUploader-BgmJTXQr.js} +0 -0
  472. /package/dist/chunks/{sessionManager-BOmgJd1l.js → sessionManager-mesT4zIQ.js} +0 -0
  473. /package/dist/chunks/{stickers-DDAm--86.js → stickers-B0P4weWp.js} +0 -0
  474. /package/dist/chunks/{udsClient-CBF_cZFW.js → udsClient-B85rNglp.js} +0 -0
  475. /package/dist/chunks/{upstreamproxy-CLf1UaJv.js → upstreamproxy-D-6vdoIJ.js} +0 -0
  476. /package/dist/chunks/{voice-YtzCcIoM.js → voice-BXg-kzte.js} +0 -0
@@ -1 +1 @@
1
- import{n as e,t}from"./defineProperty-80gRi2ZW.js";import{D as n,E as r,U as i,l as a,p as o,z as s}from"./debug-otxXY3j-.js";import{n as c,r as l}from"./analytics-DqMQntaB.js";import{B as u,J as d,K as f,M as p,S as m,T as h,W as g,X as _,et as v,g as y,m as b,z as x}from"./log-DSV4Ht5l.js";import{P as S,Z as C,n as w,t as T}from"./rcDebugLog-CwU_wJBE.js";import{t as E}from"./controlMessageCompat-Ds-CF-sM.js";import{randomUUID as D}from"crypto";c(),S(),a(),T(),b(),i(),r(),v(),e();function O(e){return typeof e==`object`&&!!e&&`type`in e&&typeof e.type==`string`}function k(e){return typeof e==`object`&&!!e&&`type`in e&&e.type===`control_response`&&`response`in e}function A(e){return typeof e==`object`&&!!e&&`type`in e&&e.type===`control_request`&&`request_id`in e&&`request`in e}function j(e){return(e.type===`user`||e.type===`assistant`)&&e.isVirtual?!1:e.type===`user`||e.type===`assistant`||e.type===`system`&&e.subtype===`local_command`}function M(e){if(e.type!==`user`||e.isMeta||e.toolUseResult||e.isCompactSummary||e.origin&&e.origin.kind!==`human`)return;let t=e.message.content,n;if(typeof t==`string`)n=t;else for(let e of t??[])if(e.type===`text`){n=e.text;break}if(n)return y(n)||void 0}var N=`system-reminder`,P=/\s*<([a-z][\w-]*)(?:\s[^>]*)?>[\s\S]*?<\/\1>\s*/gy,F=new Set([m,h,p,x,u,g,f,d,_]);function I(e){let t=e.message?.content;return typeof t==`string`?t:Array.isArray(t)?t.filter(e=>!!e&&typeof e==`object`&&e.type===`text`&&typeof e.text==`string`).map(e=>e.text).join(``):``}function L(e){let t=e.trim();if(!t)return null;P.lastIndex=0;let n=[];for(;P.lastIndex<t.length;){let e=P.exec(t);if(!e)return null;n.push(e[1])}return n.length>0?n:null}function R(e){if(e.type!==`user`||e.isVisibleInTranscriptOnly)return!1;if(e.toolUseResult!==void 0||!e.isMeta)return!0;let t=L(I(e));return t?t.some(e=>e!==`local-command-caveat`&&e!==N&&F.has(e)):!0}function z(e){return e.some(R)}function B(e,t,r,i,a,c){try{let s=E(n(e));if(k(s)){o(`[bridge:repl] Ingress message type=control_response`),a?.(s);return}if(A(s)){o(`[bridge:repl] Inbound control_request subtype=${s.request.subtype}`),c?.(s);return}if(!O(s))return;let u=`uuid`in s&&typeof s.uuid==`string`?s.uuid:void 0;if(u&&t.has(u)){o(`[bridge:repl] Ignoring echo: type=${s.type} uuid=${u}`);return}if(u&&r.has(u)){o(`[bridge:repl] Ignoring re-delivered inbound: type=${s.type} uuid=${u}`);return}o(`[bridge:repl] Ingress message type=${s.type}${u?` uuid=${u}`:``}`),s.type===`user`?(u&&r.add(u),l(`tengu_bridge_message_received`,{is_repl:!0}),i?.(s)):o(`[bridge:repl] Ignoring non-user inbound message: type=${s.type}`)}catch(e){o(`[bridge:repl] Failed to parse ingress message: ${s(e)}`)}}var V=`This session is outbound-only. Enable Remote Control locally to allow inbound control.`;function H(e,t){let{transport:n,sessionId:r,outboundOnly:i,onInterrupt:a,onSetModel:s,onSetMaxThinkingTokens:c,onSetPermissionMode:l}=t;if(!n){o(`[bridge:repl] Cannot respond to control_request: transport not configured`);return}let u,d=e.request;if(i&&d.subtype!==`initialize`){u={type:`control_response`,response:{subtype:`error`,request_id:e.request_id,error:V}};let t={...u,session_id:r};n.write(t),o(`[bridge:repl] Rejected ${d.subtype} (outbound-only) request_id=${e.request_id}`);return}switch(d.subtype){case`initialize`:u={type:`control_response`,response:{subtype:`success`,request_id:e.request_id,response:{commands:[],output_style:`normal`,available_output_styles:[`normal`],models:[],account:{},pid:process.pid}}};break;case`set_model`:s?.(d.model),u={type:`control_response`,response:{subtype:`success`,request_id:e.request_id}};break;case`set_max_thinking_tokens`:c?.(d.max_thinking_tokens??null),u={type:`control_response`,response:{subtype:`success`,request_id:e.request_id}};break;case`set_permission_mode`:{let t=l?.(d.mode)??{ok:!1,error:`set_permission_mode is not supported in this context (onSetPermissionMode callback not registered)`};u=t.ok?{type:`control_response`,response:{subtype:`success`,request_id:e.request_id}}:{type:`control_response`,response:{subtype:`error`,request_id:e.request_id,error:t.error}};break}case`interrupt`:a?.(),u={type:`control_response`,response:{subtype:`success`,request_id:e.request_id}};break;default:u={type:`control_response`,response:{subtype:`error`,request_id:e.request_id,error:`REPL bridge does not handle control_request subtype: ${d.subtype}`}}}let f={...u,session_id:r};n.write(f),w(`control_response: subtype=${d.subtype} request_id=${e.request_id} result=${u.response.subtype}`),o(`[bridge:repl] Sent control_response for ${d.subtype} request_id=${e.request_id} result=${u.response.subtype}`)}function U(e){return{type:`result_success`,subtype:`success`,duration_ms:0,duration_api_ms:0,is_error:!1,num_turns:0,result:``,stop_reason:null,total_cost_usd:0,usage:{...C},modelUsage:{},permission_denials:[],session_id:e,uuid:D()}}var W=class{constructor(e){t(this,`capacity`,void 0),t(this,`ring`,void 0),t(this,`set`,new Set),t(this,`writeIdx`,0),this.capacity=e,this.ring=Array(e)}add(e){if(this.set.has(e))return;let t=this.ring[this.writeIdx];t!==void 0&&this.set.delete(t),this.ring[this.writeIdx]=e,this.set.add(e),this.writeIdx=(this.writeIdx+1)%this.capacity}has(e){return this.set.has(e)}clear(){this.set.clear(),this.ring.fill(void 0),this.writeIdx=0}};export{j as a,z as c,H as i,M as n,U as o,B as r,R as s,W as t};
1
+ import{n as e,t}from"./defineProperty-80gRi2ZW.js";import{D as n,E as r,U as i,l as a,p as o,z as s}from"./debug-otxXY3j-.js";import{n as c,r as l}from"./analytics-DqMQntaB.js";import{B as u,J as d,K as f,M as p,S as m,T as h,W as g,X as _,et as v,g as y,m as b,z as x}from"./log-DSV4Ht5l.js";import{P as S,Z as C,n as w,t as T}from"./rcDebugLog-DOXxIr8l.js";import{t as E}from"./controlMessageCompat-Ds-CF-sM.js";import{randomUUID as D}from"crypto";c(),S(),a(),T(),b(),i(),r(),v(),e();function O(e){return typeof e==`object`&&!!e&&`type`in e&&typeof e.type==`string`}function k(e){return typeof e==`object`&&!!e&&`type`in e&&e.type===`control_response`&&`response`in e}function A(e){return typeof e==`object`&&!!e&&`type`in e&&e.type===`control_request`&&`request_id`in e&&`request`in e}function j(e){return(e.type===`user`||e.type===`assistant`)&&e.isVirtual?!1:e.type===`user`||e.type===`assistant`||e.type===`system`&&e.subtype===`local_command`}function M(e){if(e.type!==`user`||e.isMeta||e.toolUseResult||e.isCompactSummary||e.origin&&e.origin.kind!==`human`)return;let t=e.message.content,n;if(typeof t==`string`)n=t;else for(let e of t??[])if(e.type===`text`){n=e.text;break}if(n)return y(n)||void 0}var N=`system-reminder`,P=/\s*<([a-z][\w-]*)(?:\s[^>]*)?>[\s\S]*?<\/\1>\s*/gy,F=new Set([m,h,p,x,u,g,f,d,_]);function I(e){let t=e.message?.content;return typeof t==`string`?t:Array.isArray(t)?t.filter(e=>!!e&&typeof e==`object`&&e.type===`text`&&typeof e.text==`string`).map(e=>e.text).join(``):``}function L(e){let t=e.trim();if(!t)return null;P.lastIndex=0;let n=[];for(;P.lastIndex<t.length;){let e=P.exec(t);if(!e)return null;n.push(e[1])}return n.length>0?n:null}function R(e){if(e.type!==`user`||e.isVisibleInTranscriptOnly)return!1;if(e.toolUseResult!==void 0||!e.isMeta)return!0;let t=L(I(e));return t?t.some(e=>e!==`local-command-caveat`&&e!==N&&F.has(e)):!0}function z(e){return e.some(R)}function B(e,t,r,i,a,c){try{let s=E(n(e));if(k(s)){o(`[bridge:repl] Ingress message type=control_response`),a?.(s);return}if(A(s)){o(`[bridge:repl] Inbound control_request subtype=${s.request.subtype}`),c?.(s);return}if(!O(s))return;let u=`uuid`in s&&typeof s.uuid==`string`?s.uuid:void 0;if(u&&t.has(u)){o(`[bridge:repl] Ignoring echo: type=${s.type} uuid=${u}`);return}if(u&&r.has(u)){o(`[bridge:repl] Ignoring re-delivered inbound: type=${s.type} uuid=${u}`);return}o(`[bridge:repl] Ingress message type=${s.type}${u?` uuid=${u}`:``}`),s.type===`user`?(u&&r.add(u),l(`tengu_bridge_message_received`,{is_repl:!0}),i?.(s)):o(`[bridge:repl] Ignoring non-user inbound message: type=${s.type}`)}catch(e){o(`[bridge:repl] Failed to parse ingress message: ${s(e)}`)}}var V=`This session is outbound-only. Enable Remote Control locally to allow inbound control.`;function H(e,t){let{transport:n,sessionId:r,outboundOnly:i,onInterrupt:a,onSetModel:s,onSetMaxThinkingTokens:c,onSetPermissionMode:l}=t;if(!n){o(`[bridge:repl] Cannot respond to control_request: transport not configured`);return}let u,d=e.request;if(i&&d.subtype!==`initialize`){u={type:`control_response`,response:{subtype:`error`,request_id:e.request_id,error:V}};let t={...u,session_id:r};n.write(t),o(`[bridge:repl] Rejected ${d.subtype} (outbound-only) request_id=${e.request_id}`);return}switch(d.subtype){case`initialize`:u={type:`control_response`,response:{subtype:`success`,request_id:e.request_id,response:{commands:[],output_style:`normal`,available_output_styles:[`normal`],models:[],account:{},pid:process.pid}}};break;case`set_model`:s?.(d.model),u={type:`control_response`,response:{subtype:`success`,request_id:e.request_id}};break;case`set_max_thinking_tokens`:c?.(d.max_thinking_tokens??null),u={type:`control_response`,response:{subtype:`success`,request_id:e.request_id}};break;case`set_permission_mode`:{let t=l?.(d.mode)??{ok:!1,error:`set_permission_mode is not supported in this context (onSetPermissionMode callback not registered)`};u=t.ok?{type:`control_response`,response:{subtype:`success`,request_id:e.request_id}}:{type:`control_response`,response:{subtype:`error`,request_id:e.request_id,error:t.error}};break}case`interrupt`:a?.(),u={type:`control_response`,response:{subtype:`success`,request_id:e.request_id}};break;default:u={type:`control_response`,response:{subtype:`error`,request_id:e.request_id,error:`REPL bridge does not handle control_request subtype: ${d.subtype}`}}}let f={...u,session_id:r};n.write(f),w(`control_response: subtype=${d.subtype} request_id=${e.request_id} result=${u.response.subtype}`),o(`[bridge:repl] Sent control_response for ${d.subtype} request_id=${e.request_id} result=${u.response.subtype}`)}function U(e){return{type:`result_success`,subtype:`success`,duration_ms:0,duration_api_ms:0,is_error:!1,num_turns:0,result:``,stop_reason:null,total_cost_usd:0,usage:{...C},modelUsage:{},permission_denials:[],session_id:e,uuid:D()}}var W=class{constructor(e){t(this,`capacity`,void 0),t(this,`ring`,void 0),t(this,`set`,new Set),t(this,`writeIdx`,0),this.capacity=e,this.ring=Array(e)}add(e){if(this.set.has(e))return;let t=this.ring[this.writeIdx];t!==void 0&&this.set.delete(t),this.ring[this.writeIdx]=e,this.set.add(e),this.writeIdx=(this.writeIdx+1)%this.capacity}has(e){return this.set.has(e)}clear(){this.set.clear(),this.ring.fill(void 0),this.writeIdx=0}};export{j as a,z as c,H as i,M as n,U as o,B as r,R as s,W as t};
@@ -1 +1 @@
1
- import{n as e,o as t}from"./chunk-DR8-3Aex.js";import{Ct as n,F as r,Rn as i,Tt as a,W as o,b as s,t as c,x as l}from"./src-Di342QoJ.js";import{t as u}from"./jsx-runtime-D-D469L8.js";import{Cc as d,Ps as f,yc as p}from"./paths-DO4WOQtD.js";import{U as m,z as h}from"./debug-otxXY3j-.js";import{$D as g,Hk as _,Ll as v,Po as y,Rl as b,Uk as x,Uo as S,Wk as C,ck as w,d_ as T,dt as E,eO as D,ft as O,mb as k,p_ as A,pb as j}from"./loadAgentsDir-ClTeo0nk.js";import{X as M}from"./rcDebugLog-CwU_wJBE.js";import{t as N}from"./useTerminalSize-Du-EamDN.js";import{n as P,r as F}from"./sideQuestion-C1qbLTAL.js";import{i as I,n as L}from"./modalContext-c5Yqx_CQ.js";function R({question:e,context:t,onDone:n}){let[i,c]=(0,H.useState)(null),[u,d]=(0,H.useState)(null),[f,p]=(0,H.useState)(0),m=(0,H.useRef)(null),{rows:_}=I(r());a(()=>p(e=>e+1),i||u?null:80);function v(e){if(e.key===`escape`||e.key===`return`||e.key===` `||e.ctrl&&(e.key===`c`||e.key===`d`)){e.preventDefault(),n(void 0,{display:`skip`});return}(e.key===`up`||e.ctrl&&e.key===`p`)&&(e.preventDefault(),m.current?.scrollBy(-K)),(e.key===`down`||e.ctrl&&e.key===`n`)&&(e.preventDefault(),m.current?.scrollBy(K))}(0,H.useEffect)(()=>{let n=g();async function r(){try{let r=await F({question:e,cacheSafeParams:await B(t)});n.signal.aborted||(r.response?c(r.response):d(`No response received`))}catch(e){n.signal.aborted||d(h(e)||`Failed to get response`)}}return r(),()=>{n.abort()}},[e,t]);let y=Math.max(5,_-W-G);return(0,U.jsxs)(l,{flexDirection:`column`,paddingLeft:2,marginTop:1,tabIndex:0,autoFocus:!0,onKeyDown:v,children:[(0,U.jsxs)(l,{children:[(0,U.jsxs)(s,{color:`warning`,bold:!0,children:[`/btw`,` `]}),(0,U.jsx)(s,{dimColor:!0,children:e})]}),(0,U.jsx)(l,{marginTop:1,marginLeft:2,maxHeight:y,children:(0,U.jsx)(o,{ref:m,flexDirection:`column`,flexGrow:1,children:u?(0,U.jsx)(s,{color:`error`,children:u}):i?(0,U.jsx)(T,{children:i}):(0,U.jsxs)(l,{children:[(0,U.jsx)(j,{frame:f,messageColor:`warning`}),(0,U.jsx)(s,{color:`warning`,children:`Answering...`})]})})}),(i||u)&&(0,U.jsx)(l,{marginTop:1,children:(0,U.jsxs)(s,{dimColor:!0,children:[`↑`,`/`,`↓`,` to scroll · Space, Enter, or Escape to dismiss`]})})]})}function z(e){let t=e.at(-1);return t?.type===`assistant`&&t.message.stop_reason===null?e.slice(0,-1):e}async function B(e){let t=y(z(e.messages)),n=v();if(n)return{systemPrompt:n.systemPrompt,userContext:n.userContext,systemContext:n.systemContext,toolUseContext:e,forkContextMessages:t};let[r,i,a]=await Promise.all([E(e.options.tools,e.options.mainLoopModel,[],e.options.mcpClients),x(),_()]);return{systemPrompt:M(r),userContext:i,systemContext:a,toolUseContext:e,forkContextMessages:t}}async function V(e,t,n){let r=n?.trim();return r?(d(e=>({...e,btwUseCount:e.btwUseCount+1})),(0,U.jsx)(R,{question:r,context:t,onDone:e})):(e(`Usage: /btw <your question>`,{display:`system`}),null)}var H,U,W,G,K;e((()=>{i(),H=t(i(),1),n(),A(),k(),f(),O(),L(),C(),N(),c(),D(),p(),m(),b(),S(),P(),w(),U=u(),W=5,G=6,K=3}))();export{V as call};
1
+ import{n as e,o as t}from"./chunk-DR8-3Aex.js";import{Ct as n,F as r,Rn as i,Tt as a,W as o,b as s,t as c,x as l}from"./src-KjMLauwe.js";import{t as u}from"./jsx-runtime-D-D469L8.js";import{Cc as d,Ps as f,yc as p}from"./paths-4ZWdjPP4.js";import{U as m,z as h}from"./debug-otxXY3j-.js";import{$D as g,Hk as _,Ll as v,Po as y,Rl as b,Uk as x,Uo as S,Wk as C,ck as w,d_ as T,dt as E,eO as D,ft as O,mb as k,p_ as A,pb as j}from"./loadAgentsDir-CQF8qhne.js";import{X as M}from"./rcDebugLog-DOXxIr8l.js";import{t as N}from"./useTerminalSize-mqo2Swmk.js";import{n as P,r as F}from"./sideQuestion-MzExGTvn.js";import{i as I,n as L}from"./modalContext-DxfeT_3m.js";function R({question:e,context:t,onDone:n}){let[i,c]=(0,H.useState)(null),[u,d]=(0,H.useState)(null),[f,p]=(0,H.useState)(0),m=(0,H.useRef)(null),{rows:_}=I(r());a(()=>p(e=>e+1),i||u?null:80);function v(e){if(e.key===`escape`||e.key===`return`||e.key===` `||e.ctrl&&(e.key===`c`||e.key===`d`)){e.preventDefault(),n(void 0,{display:`skip`});return}(e.key===`up`||e.ctrl&&e.key===`p`)&&(e.preventDefault(),m.current?.scrollBy(-K)),(e.key===`down`||e.ctrl&&e.key===`n`)&&(e.preventDefault(),m.current?.scrollBy(K))}(0,H.useEffect)(()=>{let n=g();async function r(){try{let r=await F({question:e,cacheSafeParams:await B(t)});n.signal.aborted||(r.response?c(r.response):d(`No response received`))}catch(e){n.signal.aborted||d(h(e)||`Failed to get response`)}}return r(),()=>{n.abort()}},[e,t]);let y=Math.max(5,_-W-G);return(0,U.jsxs)(l,{flexDirection:`column`,paddingLeft:2,marginTop:1,tabIndex:0,autoFocus:!0,onKeyDown:v,children:[(0,U.jsxs)(l,{children:[(0,U.jsxs)(s,{color:`warning`,bold:!0,children:[`/btw`,` `]}),(0,U.jsx)(s,{dimColor:!0,children:e})]}),(0,U.jsx)(l,{marginTop:1,marginLeft:2,maxHeight:y,children:(0,U.jsx)(o,{ref:m,flexDirection:`column`,flexGrow:1,children:u?(0,U.jsx)(s,{color:`error`,children:u}):i?(0,U.jsx)(T,{children:i}):(0,U.jsxs)(l,{children:[(0,U.jsx)(j,{frame:f,messageColor:`warning`}),(0,U.jsx)(s,{color:`warning`,children:`Answering...`})]})})}),(i||u)&&(0,U.jsx)(l,{marginTop:1,children:(0,U.jsxs)(s,{dimColor:!0,children:[`↑`,`/`,`↓`,` to scroll · Space, Enter, or Escape to dismiss`]})})]})}function z(e){let t=e.at(-1);return t?.type===`assistant`&&t.message.stop_reason===null?e.slice(0,-1):e}async function B(e){let t=y(z(e.messages)),n=v();if(n)return{systemPrompt:n.systemPrompt,userContext:n.userContext,systemContext:n.systemContext,toolUseContext:e,forkContextMessages:t};let[r,i,a]=await Promise.all([E(e.options.tools,e.options.mainLoopModel,[],e.options.mcpClients),x(),_()]);return{systemPrompt:M(r),userContext:i,systemContext:a,toolUseContext:e,forkContextMessages:t}}async function V(e,t,n){let r=n?.trim();return r?(d(e=>({...e,btwUseCount:e.btwUseCount+1})),(0,U.jsx)(R,{question:r,context:t,onDone:e})):(e(`Usage: /btw <your question>`,{display:`system`}),null)}var H,U,W,G,K;e((()=>{i(),H=t(i(),1),n(),A(),k(),f(),O(),L(),C(),N(),c(),D(),p(),m(),b(),S(),P(),w(),U=u(),W=5,G=6,K=3}))();export{V as call};
@@ -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{Cc as c,Jt as l,St as u,dc as d,on as f,wt as p,yc as m}from"./paths-DO4WOQtD.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-Diuav3lA.js";import{r as T,t as E}from"./sprites-59l7vF4l.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-KjMLauwe.js";import{t as s}from"./jsx-runtime-D-D469L8.js";import{Cc as c,Jt as l,St as u,dc as d,on as f,wt as p,yc as m}from"./paths-4ZWdjPP4.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-C8e7dVlu.js";import{r as T,t as E}from"./sprites-8JVWnXzp.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":u()},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(),m(),f(),g(),p(),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 c(e=>({...e,companionMuted:!0})),e(`companion muted`,{display:`system`}),null;if(r===`on`)return c(e=>({...e,companionMuted:!1})),e(`companion unmuted`,{display:`system`}),null;if(r===`pet`){let n=y();return n?(c(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&&c(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),l=K[s.bones.species]??`Buddy`,u=q[s.bones.species]??`Mysterious and code-savvy.`,f={name:l,personality:u,seed:o,hatchedAt:Date.now()};c(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,``,`${l} the ${U(s.bones.species)}${h}`,`Rarity: ${p} (${s.bones.rarity})`,`"${u}"`,``,`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(),m(),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{J as a,U as o}from"./debug-otxXY3j-.js";import{o as s,s as c}from"./log-DSV4Ht5l.js";import{L as l,dC as u,fC as d,lC as f,uC as p,w as m}from"./loadAgentsDir-ClTeo0nk.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=p(e=>e.mainLoopModel),t=p(e=>e.mainLoopModelForSession),n=p(e=>e.fastMode),i=d(),o=u(),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(),f(),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-KjMLauwe.js";import{W as r,cn as i}from"./state-sIHsFpDu.js";import{J as a,U as o}from"./debug-otxXY3j-.js";import{o as s,s as c}from"./log-DSV4Ht5l.js";import{L as l,dC as u,fC as d,lC as f,uC as p,w as m}from"./loadAgentsDir-CQF8qhne.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=p(e=>e.mainLoopModel),t=p(e=>e.mainLoopModelForSession),n=p(e=>e.fastMode),i=d(),o=u(),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(),f(),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{Ka as u,dc as d,oo as f,yc as p}from"./paths-DO4WOQtD.js";import{U as m,_ as h,h as g,l as _,p as v,z as y}from"./debug-otxXY3j-.js";import{n as b,r as x}from"./analytics-DqMQntaB.js";import{n as S,t as C}from"./cwd--iizewsn.js";import{E as ee,S as te,_ as ne,r as re,v as ie}from"./git-C0IuvuIy.js";import{o as ae,s as w}from"./log-DSV4Ht5l.js";import{i as oe,n as se}from"./path-BE28AJwZ.js";import{n as T,r as ce}from"./execFileNoThrow-azCkYhmF.js";import{$d as le,$k as ue,AC as de,Cl as fe,Cn as pe,Fc as me,Gi as he,Gk as ge,Gm as _e,Hk as ve,Ic as ye,Kh as be,Lt as xe,My as Se,Ny as Ce,Q as we,Qk as Te,Uk as Ee,Ut as De,Vk as Oe,Wk as ke,X as Ae,Xd as je,Ym as Me,_ as Ne,dA as Pe,gh as Fe,hh as Ie,jC as Le,m as Re,na as ze,pA as Be,qh as Ve,rO as He,tO as Ue,v as We,xl as Ge}from"./loadAgentsDir-ClTeo0nk.js";import{nn as Ke,tn as qe}from"./prompt-CfM_xGPc.js";import{a as Je,s as Ye}from"./ripgrep-Bzwdi5-K.js";import{a as Xe,t as Ze}from"./detectRepository-2ICvGD0U.js";import{r as Qe,t as $e}from"./magicDocs-C_inI3JJ.js";import*as E from"path";import{statSync as et}from"fs";function D(e,t,n){if(t===0)return n?M:0;let r=e.charCodeAt(t-1);return tt(r)?A:nt(r)&&rt(e.charCodeAt(t))?at:0}function tt(e){return e===47||e===92||e===45||e===95||e===46||e===32}function nt(e){return e>=97&&e<=122}function rt(e){return e>=65&&e<=90}function O(){return new Promise(e=>setImmediate(e))}function it(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 k,A,at,j,M,ot,st,ct,N,P,lt,ut=e((()=>{n(),k=16,A=8,at=6,j=4,M=8,ot=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 O(),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 O(),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=it(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*(k+A)+M+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],y=p[e],b=Math.max(0,32-(y>>2)),x=-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+=j:n+=ot+i*st,u=t}if(!d||c.length===t&&s+o-n+b<=l)continue;let f=i*k+o-n;f+=D(v,P[0],!0);for(let e=1;e<i;e++)f+=D(v,P[e],!1);f+=b,f>x&&(x=f)}if(x===-1/0)continue;let S=x;if(c.length<t)c.push({path:v,fuzzScore:S}),c.length===t&&(c.sort((e,t)=>e.fuzzScore-t.fuzzScore),l=c[0].fuzzScore);else if(S>l){let e=0,t=c.length;for(;e<t;){let n=e+t>>1;c[n].fuzzScore<S?e=n+1:t=n}c.splice(e,0,{path:v,fuzzScore:S}),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=re(C());if(!e)return null;try{return et(E.join(e,`.git`,`index`)).mtimeMs}catch{return null}}function mt(e,t,n){return n===t?e:e.map(e=>{let r=E.join(t,e);return E.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){v(`[FileIndex] skipped index rebuild — merged paths unchanged`);return}await R.loadFromFileListAsync(n).done,Z=r,v(`[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=g(),i=[`.ignore`,`.rgignore`],a=[...new Set([e,t])],o=(0,kt.default)(),s=!1,c=a.flatMap(e=>i.map(t=>E.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,v(`[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();v(`[FileIndex] getFilesUsingGit called`);let r=C(),i=re(r);if(!i)return v(`[FileIndex] not a git repo, returning null`),null;try{let a=Date.now(),o=await T(ne(),[`-c`,`core.quotepath=false`,`ls-files`,`--recurse-submodules`],{timeout:5e3,abortSignal:e,cwd:i});if(v(`[FileIndex] git ls-files (tracked) took ${Date.now()-a}ms`),o.code!==0)return v(`[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{Ka as u,dc as d,oo as f,yc as p}from"./paths-4ZWdjPP4.js";import{U as m,_ as h,h as g,l as _,p as v,z as y}from"./debug-otxXY3j-.js";import{n as b,r as x}from"./analytics-DqMQntaB.js";import{n as S,t as C}from"./cwd--iizewsn.js";import{E as ee,S as te,_ as ne,r as re,v as ie}from"./git-C0IuvuIy.js";import{o as ae,s as w}from"./log-DSV4Ht5l.js";import{i as oe,n as se}from"./path-BE28AJwZ.js";import{n as T,r as ce}from"./execFileNoThrow-azCkYhmF.js";import{$d as le,$k as ue,AC as de,Cl as fe,Cn as pe,Fc as me,Gi as he,Gk as ge,Gm as _e,Hk as ve,Ic as ye,Kh as be,Lt as xe,My as Se,Ny as Ce,Q as we,Qk as Te,Uk as Ee,Ut as De,Vk as Oe,Wk as ke,X as Ae,Xd as je,Ym as Me,_ as Ne,dA as Pe,gh as Fe,hh as Ie,jC as Le,m as Re,na as ze,pA as Be,qh as Ve,rO as He,tO as Ue,v as We,xl as Ge}from"./loadAgentsDir-CQF8qhne.js";import{nn as Ke,tn as qe}from"./prompt-CogZQuTN.js";import{a as Je,s as Ye}from"./ripgrep-Bzwdi5-K.js";import{a as Xe,t as Ze}from"./detectRepository-2ICvGD0U.js";import{r as Qe,t as $e}from"./magicDocs-DnxdS9yV.js";import*as E from"path";import{statSync as et}from"fs";function D(e,t,n){if(t===0)return n?M:0;let r=e.charCodeAt(t-1);return tt(r)?A:nt(r)&&rt(e.charCodeAt(t))?at:0}function tt(e){return e===47||e===92||e===45||e===95||e===46||e===32}function nt(e){return e>=97&&e<=122}function rt(e){return e>=65&&e<=90}function O(){return new Promise(e=>setImmediate(e))}function it(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 k,A,at,j,M,ot,st,ct,N,P,lt,ut=e((()=>{n(),k=16,A=8,at=6,j=4,M=8,ot=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 O(),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 O(),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=it(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*(k+A)+M+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],y=p[e],b=Math.max(0,32-(y>>2)),x=-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+=j:n+=ot+i*st,u=t}if(!d||c.length===t&&s+o-n+b<=l)continue;let f=i*k+o-n;f+=D(v,P[0],!0);for(let e=1;e<i;e++)f+=D(v,P[e],!1);f+=b,f>x&&(x=f)}if(x===-1/0)continue;let S=x;if(c.length<t)c.push({path:v,fuzzScore:S}),c.length===t&&(c.sort((e,t)=>e.fuzzScore-t.fuzzScore),l=c[0].fuzzScore);else if(S>l){let e=0,t=c.length;for(;e<t;){let n=e+t>>1;c[n].fuzzScore<S?e=n+1:t=n}c.splice(e,0,{path:v,fuzzScore:S}),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=re(C());if(!e)return null;try{return et(E.join(e,`.git`,`index`)).mtimeMs}catch{return null}}function mt(e,t,n){return n===t?e:e.map(e=>{let r=E.join(t,e);return E.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){v(`[FileIndex] skipped index rebuild — merged paths unchanged`);return}await R.loadFromFileListAsync(n).done,Z=r,v(`[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=g(),i=[`.ignore`,`.rgignore`],a=[...new Set([e,t])],o=(0,kt.default)(),s=!1,c=a.flatMap(e=>i.map(t=>E.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,v(`[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();v(`[FileIndex] getFilesUsingGit called`);let r=C(),i=re(r);if(!i)return v(`[FileIndex] not a git repo, returning null`),null;try{let a=Date.now(),o=await T(ne(),[`-c`,`core.quotepath=false`,`ls-files`,`--recurse-submodules`],{timeout:5e3,abortSignal:e,cwd:i});if(v(`[FileIndex] git ls-files (tracked) took ${Date.now()-a}ms`),o.code!==0)return v(`[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),v(`[FileIndex] applied ignore patterns: ${e} -> ${s.length} files`)}U=s;let l=Date.now()-n;if(v(`[FileIndex] git ls-files: ${s.length} tracked files in ${l}ms`),x(`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=T(ne(),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),v(`[FileIndex] applied ignore patterns to untracked: ${e} -> ${t.length} files`)}v(`[FileIndex] background untracked fetch: ${t.length} files`),ht(t)}}).catch(e=>{v(`[FileIndex] background untracked fetch failed: ${e}`)}).finally(()=>{H=null})}return s}catch(e){return v(`[FileIndex] git ls-files error: ${y(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 O(),n=performance.now());return[...t].map(e=>e+E.sep)}function yt(e,t,n,r){for(let i=t;i<n;i++){let t=E.dirname(e[i]);for(;t!==`.`&&!r.has(t);){let e=E.dirname(t);if(e===t)break;r.add(t),t=e}}}async function bt(e){return(await Promise.all(Re.map(t=>We(t,e)))).flatMap(e=>e.map(e=>e.filePath))}async function xt(e,t){v(`[FileIndex] getProjectFiles called, respectGitignore=${t}`);let n=await _t(e,t);if(n!==null)return v(`[FileIndex] using git ls-files result (${n.length} files)`),n;v(`[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 Ye(i,`.`,e)).map(e=>E.relative(C(),e)),o=Date.now()-r;return v(`[FileIndex] ripgrep: ${a.length} files in ${o}ms`),x(`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=u(),r=d(),i=n.respectGitignore??r.respectGitignore??!0,a=C(),[o,s]=await Promise.all([xt(e,i),bt(a)]);W=s;let c=[...o,...s],l=await vt(c);G=l;let f=[...l,...c],p=ft(f);p===X?v(`[FileIndex] skipped index rebuild — tracked paths unchanged`):(await t.loadFromFileListAsync(f).done,X=p,Z=null)}catch(e){w(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(),v(`[FileIndex] cache refresh completed in ${Date.now()-n}ms`),r):r).catch(e=>(v(`[FileIndex] Cache refresh failed: ${y(e)}`),w(e),t===V&&(z=null),F()))}async function Et(){let e=g(),t=C();try{return(await e.readdir(t)).map(e=>{let n=E.join(t,e.name),r=E.relative(t,n);return e.isDirectory()?r+E.sep:r})}catch(e){return w(e),[]}}async function Dt(e,t=!1){if(!e&&!t)return[];if(u().fileSuggestion?.type===`command`)return(await De({...xe(),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=`.`+E.sep;e.startsWith(i)&&(r=e.substring(2)),r.startsWith(`~`)&&(r=se(r));let a=R?Tt(R,r):[],o=Date.now()-n;return v(`[FileIndex] generateFileSuggestions: ${a.length} results in ${o}ms (${t?`partial`:`full`} index)`),x(`tengu_file_suggestions_query`,{duration_ms:o,cache_hit:!t,result_count:a.length,query_length:e.length}),a}catch(e){return w(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),Ne(),ut(),b(),p(),S(),_(),m(),ce(),h(),ie(),pe(),ae(),oe(),Je(),f(),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;Ee.cache.clear?.(),ve.cache.clear?.(),Oe.cache.clear?.(),qe.cache.clear?.(),dt(),he(),t||Be(),ge(null),s(null),fe(),ye(),ue(`session_start`),de(),Se(),t||je(),process.env.USER_TYPE===`ant`&&import(`./TungstenTool-B40YHYXC.js`).then(({clearSessionsWithTungstenUsage:e,resetInitializationState:t})=>{e(),t()}),import(`./attributionHooks-VGSpz4mk.js`).then(({clearAttributionCaches:e})=>e()),Ze(),Ae(),t||Ue(),l(e),te(),_e(),Ve(),$e(),Ie(),import(`./utils-CAQfwbv8.js`).then(({clearWebFetchCache:e})=>e()),import(`./SearchExtraToolsTool-C64oVFUD.js`).then(({clearSearchExtraToolsDescriptionCache:e})=>e()),import(`./loadAgentsDir-CshktEpX.js`).then(({clearAgentDefinitionsCache:e})=>e()),import(`./prompt-CusKF4-p.js`).then(({clearPromptCache:e})=>e())}var Nt=e((()=>{c(),ze(),Ke(),ke(),$(),le(),He(),Pe(),Ce(),Ge(),be(),Qe(),Me(),me(),we(),Te(),Xe(),ee(),Le(),Fe()}));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),v(`[FileIndex] applied ignore patterns to untracked: ${e} -> ${t.length} files`)}v(`[FileIndex] background untracked fetch: ${t.length} files`),ht(t)}}).catch(e=>{v(`[FileIndex] background untracked fetch failed: ${e}`)}).finally(()=>{H=null})}return s}catch(e){return v(`[FileIndex] git ls-files error: ${y(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 O(),n=performance.now());return[...t].map(e=>e+E.sep)}function yt(e,t,n,r){for(let i=t;i<n;i++){let t=E.dirname(e[i]);for(;t!==`.`&&!r.has(t);){let e=E.dirname(t);if(e===t)break;r.add(t),t=e}}}async function bt(e){return(await Promise.all(Re.map(t=>We(t,e)))).flatMap(e=>e.map(e=>e.filePath))}async function xt(e,t){v(`[FileIndex] getProjectFiles called, respectGitignore=${t}`);let n=await _t(e,t);if(n!==null)return v(`[FileIndex] using git ls-files result (${n.length} files)`),n;v(`[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 Ye(i,`.`,e)).map(e=>E.relative(C(),e)),o=Date.now()-r;return v(`[FileIndex] ripgrep: ${a.length} files in ${o}ms`),x(`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=u(),r=d(),i=n.respectGitignore??r.respectGitignore??!0,a=C(),[o,s]=await Promise.all([xt(e,i),bt(a)]);W=s;let c=[...o,...s],l=await vt(c);G=l;let f=[...l,...c],p=ft(f);p===X?v(`[FileIndex] skipped index rebuild — tracked paths unchanged`):(await t.loadFromFileListAsync(f).done,X=p,Z=null)}catch(e){w(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(),v(`[FileIndex] cache refresh completed in ${Date.now()-n}ms`),r):r).catch(e=>(v(`[FileIndex] Cache refresh failed: ${y(e)}`),w(e),t===V&&(z=null),F()))}async function Et(){let e=g(),t=C();try{return(await e.readdir(t)).map(e=>{let n=E.join(t,e.name),r=E.relative(t,n);return e.isDirectory()?r+E.sep:r})}catch(e){return w(e),[]}}async function Dt(e,t=!1){if(!e&&!t)return[];if(u().fileSuggestion?.type===`command`)return(await De({...xe(),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=`.`+E.sep;e.startsWith(i)&&(r=e.substring(2)),r.startsWith(`~`)&&(r=se(r));let a=R?Tt(R,r):[],o=Date.now()-n;return v(`[FileIndex] generateFileSuggestions: ${a.length} results in ${o}ms (${t?`partial`:`full`} index)`),x(`tengu_file_suggestions_query`,{duration_ms:o,cache_hit:!t,result_count:a.length,query_length:e.length}),a}catch(e){return w(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),Ne(),ut(),b(),p(),S(),_(),m(),ce(),h(),ie(),pe(),ae(),oe(),Je(),f(),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;Ee.cache.clear?.(),ve.cache.clear?.(),Oe.cache.clear?.(),qe.cache.clear?.(),dt(),he(),t||Be(),ge(null),s(null),fe(),ye(),ue(`session_start`),de(),Se(),t||je(),process.env.USER_TYPE===`ant`&&import(`./TungstenTool-B40YHYXC.js`).then(({clearSessionsWithTungstenUsage:e,resetInitializationState:t})=>{e(),t()}),import(`./attributionHooks-COqmxGy1.js`).then(({clearAttributionCaches:e})=>e()),Ze(),Ae(),t||Ue(),l(e),te(),_e(),Ve(),$e(),Ie(),import(`./utils-CM5oEyAY.js`).then(({clearWebFetchCache:e})=>e()),import(`./SearchExtraToolsTool-kjVFsFkT.js`).then(({clearSearchExtraToolsDescriptionCache:e})=>e()),import(`./loadAgentsDir-B-4D2dVE.js`).then(({clearAgentDefinitionsCache:e})=>e()),import(`./prompt-TGc_H1cL.js`).then(({clearPromptCache:e})=>e())}var Nt=e((()=>{c(),ze(),Ke(),ke(),$(),le(),He(),Pe(),Ce(),Ge(),be(),Qe(),Me(),me(),we(),Te(),Xe(),ee(),Le(),Fe()}));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-Bp4F7tZ5.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-DO4WOQtD.js";import{B as i,E as a,O as o,U as s,l as c,p as l,z as u}from"./debug-otxXY3j-.js";import{F as d,P as f}from"./git-C0IuvuIy.js";import{r as p,u as m}from"./proxy-CF7ZDxaW.js";import{n as h,t as g}from"./sleep-C6koP5Ka.js";import{D as _,E as v,O as y,a as b,l as x,r as S}from"./rcDebugLog-CwU_wJBE.js";import{n as C}from"./jwtUtils-BQXXBwqW.js";import{randomUUID as w}from"crypto";s(),c(),f(),m(),g(),r(),y(),S(),a(),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(o(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`})}),l(`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,a,{timeout:o=1e4}={}){let s=this.getAuthHeaders();if(Object.keys(s).length===0)return{ok:!1};try{let i=await this.http[e](`${this.sessionBaseUrl}${t}`,r,{headers:{...s,"Content-Type":`application/json`,"anthropic-version":`2023-06-01`,"User-Agent":n()},validateStatus:j,timeout:o});if(i.status>=200&&i.status<300)return this.consecutiveAuthFailures=0,{ok:!0};if(i.status===409&&this.handleEpochMismatch(),i.status===401||i.status===403){let e=_(),t=e?C(e):null;t!==null&&t*1e3<Date.now()&&(l(`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&&(l(`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(l(`CCRClient: ${a} returned ${i.status}`,{level:`warn`}),d(`warn`,`cli_worker_request_failed`,{method:e,path:t,status:i.status}),i.status===429){let e=i.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 l(`CCRClient: ${a} failed: ${u(n)}`,{level:`warn`}),d(`warn`,`cli_worker_request_error`,{method:e,path:t,error_code:i(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(){l(`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&&l(`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 l(`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){l(`CCRClient: GET ${e} failed (attempt ${r}/10): ${u(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(),l(`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 l(`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-4ZWdjPP4.js";import{B as i,E as a,O as o,U as s,l as c,p as l,z as u}from"./debug-otxXY3j-.js";import{F as d,P as f}from"./git-C0IuvuIy.js";import{r as p,u as m}from"./proxy-CF7ZDxaW.js";import{n as h,t as g}from"./sleep-C6koP5Ka.js";import{D as _,E as v,O as y,a as b,l as x,r as S}from"./rcDebugLog-DOXxIr8l.js";import{n as C}from"./jwtUtils-BQXXBwqW.js";import{randomUUID as w}from"crypto";s(),c(),f(),m(),g(),r(),y(),S(),a(),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(o(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`})}),l(`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,a,{timeout:o=1e4}={}){let s=this.getAuthHeaders();if(Object.keys(s).length===0)return{ok:!1};try{let i=await this.http[e](`${this.sessionBaseUrl}${t}`,r,{headers:{...s,"Content-Type":`application/json`,"anthropic-version":`2023-06-01`,"User-Agent":n()},validateStatus:j,timeout:o});if(i.status>=200&&i.status<300)return this.consecutiveAuthFailures=0,{ok:!0};if(i.status===409&&this.handleEpochMismatch(),i.status===401||i.status===403){let e=_(),t=e?C(e):null;t!==null&&t*1e3<Date.now()&&(l(`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&&(l(`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(l(`CCRClient: ${a} returned ${i.status}`,{level:`warn`}),d(`warn`,`cli_worker_request_failed`,{method:e,path:t,status:i.status}),i.status===429){let e=i.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 l(`CCRClient: ${a} failed: ${u(n)}`,{level:`warn`}),d(`warn`,`cli_worker_request_error`,{method:e,path:t,error_code:i(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(){l(`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&&l(`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 l(`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){l(`CCRClient: GET ${e} failed (attempt ${r}/10): ${u(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(),l(`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 l(`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{BA as e,WA as t}from"./loadAgentsDir-CQF8qhne.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-DO4WOQtD.js";import{E as f,et as p}from"./log-DSV4Ht5l.js";import{n as m,t as h}from"./lazySchema-B0QShMaQ.js";import{i as g,n as _,o as v,p as y,r as b}from"./xml-CTdKuU6f.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-4ZWdjPP4.js";import{E as f,et as p}from"./log-DSV4Ht5l.js";import{n as m,t as h}from"./lazySchema-B0QShMaQ.js";import{i as g,n as _,o as v,p as y,r as b}from"./xml-BUaEXGXx.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-BZFMAWln.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{Cc as u,dc as d,dn as f,on as p,yc as m}from"./paths-DO4WOQtD.js";import{a as h,n as g}from"./env-C2A9gV_G.js";import{aS as _,lC as v,oS as y,uC as b}from"./loadAgentsDir-ClTeo0nk.js";import{n as x,t as S}from"./browser-Bt-ckCaU.js";import{c as C,d as w,t as T}from"./common-Da57Qwms.js";import{n as E,t as D}from"./setup-Dihjl7jo.js";function O({onDone:e,isExtensionInstalled:t,configEnabled:r,isClaudeAISubscriber:i,isWSL:s}){let l=b(e=>e.mcp.clients),[d,f]=(0,k.useState)(0),[p,m]=(0,k.useState)(r??!1),[h,g]=(0,k.useState)(!1),[v,y]=(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=>{y(e),e&&g(!1)}),D(N);break;case`manage-permissions`:f(e=>e+1),D(M);break;case`toggle-default`:{let e=!p;u(t=>({...t,claudeInChromeDefaultEnabled:e})),m(e);break}}}let P=[],F=v?``:` (requires extension)`;!v&&!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:`,` `,v?(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},d),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(),v(),p(),S(),C(),D(),m(),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=d(),r=f(),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-KjMLauwe.js";import{t as l}from"./jsx-runtime-D-D469L8.js";import{Cc as u,dc as d,dn as f,on as p,yc as m}from"./paths-4ZWdjPP4.js";import{a as h,n as g}from"./env-C2A9gV_G.js";import{aS as _,lC as v,oS as y,uC as b}from"./loadAgentsDir-CQF8qhne.js";import{n as x,t as S}from"./browser-Bt-ckCaU.js";import{c as C,d as w,t as T}from"./common-Da57Qwms.js";import{n as E,t as D}from"./setup-9nXlu56r.js";function O({onDone:e,isExtensionInstalled:t,configEnabled:r,isClaudeAISubscriber:i,isWSL:s}){let l=b(e=>e.mcp.clients),[d,f]=(0,k.useState)(0),[p,m]=(0,k.useState)(r??!1),[h,g]=(0,k.useState)(!1),[v,y]=(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=>{y(e),e&&g(!1)}),D(N);break;case`manage-permissions`:f(e=>e+1),D(M);break;case`toggle-default`:{let e=!p;u(t=>({...t,claudeInChromeDefaultEnabled:e})),m(e);break}}}let P=[],F=v?``:` (requires extension)`;!v&&!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:`,` `,v?(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},d),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(),v(),p(),S(),C(),D(),m(),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=d(),r=f(),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-BYMS5Hqa.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-4ZWdjPP4.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-CbskW5G9.js";import{Ar as a,Cb as o,Eb as s,Fr as c,vi as l}from"./loadAgentsDir-ClTeo0nk.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: ${o.join(`, `)}, default`,{display:`system`}),null;let s=i.trim().toLowerCase();return d.includes(s)?(await l(t(),`default`,a()),n.setAppState(e=>({...e,standaloneAgentContext:{...e.standaloneAgentContext,name:e.standaloneAgentContext?.name??``,color:void 0}})),e(`Session color reset to default`,{display:`system`}),null):o.includes(s)?(await l(t(),s,a()),n.setAppState(e=>({...e,standaloneAgentContext:{...e.standaloneAgentContext,name:e.standaloneAgentContext?.name??``,color:s}})),e(`Session color set to: ${s}`,{display:`system`}),null):(e(`Invalid color "${s}". Available colors: ${o.join(`, `)}, default`,{display:`system`}),null)}var d;e((()=>{n(),s(),c(),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-CbskW5G9.js";import{Ar as a,Cb as o,Eb as s,Fr as c,vi as l}from"./loadAgentsDir-CQF8qhne.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: ${o.join(`, `)}, default`,{display:`system`}),null;let s=i.trim().toLowerCase();return d.includes(s)?(await l(t(),`default`,a()),n.setAppState(e=>({...e,standaloneAgentContext:{...e.standaloneAgentContext,name:e.standaloneAgentContext?.name??``,color:void 0}})),e(`Session color reset to default`,{display:`system`}),null):o.includes(s)?(await l(t(),s,a()),n.setAppState(e=>({...e,standaloneAgentContext:{...e.standaloneAgentContext,name:e.standaloneAgentContext?.name??``,color:s}})),e(`Session color set to: ${s}`,{display:`system`}),null):(e(`Invalid color "${s}". Available colors: ${o.join(`, `)}, default`,{display:`system`}),null)}var d;e((()=>{n(),s(),c(),i(),d=[`default`,`reset`,`none`,`gray`,`grey`]}))();export{u as call};
@@ -0,0 +1 @@
1
+ import{Gi as e,Zi as t,na as n}from"./loadAgentsDir-CQF8qhne.js";n();export{e as clearCommandsCache,t as getCommands};
@@ -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,nc as a,rc as o}from"./paths-DO4WOQtD.js";import{_ as s,l as c}from"./debug-otxXY3j-.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-C0IuvuIy.js";import{o as g}from"./log-DSV4Ht5l.js";import{n as _,r as v}from"./execFileNoThrow-azCkYhmF.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,nc as a,rc as o}from"./paths-4ZWdjPP4.js";import{_ as s,l as c}from"./debug-otxXY3j-.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-C0IuvuIy.js";import{o as g}from"./log-DSV4Ht5l.js";import{n as _,r as v}from"./execFileNoThrow-azCkYhmF.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(),a(),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=o(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};
@@ -0,0 +1 @@
1
+ import{d as e,l as t}from"./commitAttribution-ClSlXMPG.js";t();export{e as isInternalModelRepo};
@@ -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{H as a,U as o}from"./debug-otxXY3j-.js";import{o as s,s as c}from"./log-DSV4Ht5l.js";import{AT as l,Al as u,Cl as d,Cn as f,El as p,Hk as m,Ol as h,Po as g,Tk as _,Tl as v,Uk as y,Uo as b,Wk as x,Zt as S,__ as C,_l as w,cA as T,dA as E,dd as D,dt as O,fA as k,fd as A,ft as j,g_ as M,hl as N,iA as P,jT as F,jk as I,kl as L,rA as R,sA as z,wl as B,xl as V}from"./loadAgentsDir-ClTeo0nk.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([S({trigger:`manual`,customInstructions:n||null},t.abortController.signal),W(t,e)]),o=u(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(v);case`aborted`:throw Error(p);case`exhausted`:case`error`:case`media_unstrippable`:throw Error(B)}I(void 0),d(),T(),y.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-KjMLauwe.js";import{cn as r,dn as i}from"./state-sIHsFpDu.js";import{H as a,U as o}from"./debug-otxXY3j-.js";import{o as s,s as c}from"./log-DSV4Ht5l.js";import{AT as l,Al as u,Cl as d,Cn as f,El as p,Hk as m,Ol as h,Po as g,Tk as _,Tl as v,Uk as y,Uo as b,Wk as x,Zt as S,__ as C,_l as w,cA as T,dA as E,dd as D,dt as O,fA as k,fd as A,ft as j,g_ as M,hl as N,iA as P,jT as F,jk as I,kl as L,rA as R,sA as z,wl as B,xl as V}from"./loadAgentsDir-CQF8qhne.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([S({trigger:`manual`,customInstructions:n||null},t.abortController.signal),W(t,e)]),o=u(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(v);case`aborted`:throw Error(p);case`exhausted`:case`error`:case`media_unstrippable`:throw Error(B)}I(void 0),d(),T(),y.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=M(`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 O(e.options.tools,e.options.mainLoopModel,Array.from(n.toolPermissionContext.additionalWorkingDirectories.keys()),e.options.mcpClients),i=D({mainThreadAgentDefinition:void 0,toolUseContext:e,customSystemPrompt:e.options.customSystemPrompt,defaultSystemPrompt:r,appendSystemPrompt:e.options.appendSystemPrompt}),[a,o]=await Promise.all([y(),m()]);return{systemPrompt:i,userContext:a,systemContext:o,toolUseContext:e,forkContextMessages:t}}var G,K;e((()=>{n(),r(),j(),x(),F(),E(),L(),z(),R(),V(),N(),_(),o(),f(),s(),b(),C(),A(),G=null,K=async(e,t)=>{let{abortController:n}=t,{messages:r}=t;if(r=g(r),r.length===0)throw Error(`No messages to compact`);let o=e.trim();try{if(!o){let e=await w(r,t.agentId);if(e)return y.cache.clear?.(),d(),k(t.options.querySource??`compact`,t.agentId),i(),T(),{type:`compact`,compactionResult:e,displayText:U(t)}}if(G?.isReactiveOnlyMode())return await H(r,t,o,G);let e=(await P(r,t)).messages,n=await h(e,t,await W(t,e),!1,o,!1);return I(void 0),T(),y.cache.clear?.(),d(),{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(v):a(e,`Compaction interrupted · This may be due to network issues — please try again.`)?Error(B):(c(e),Error(`Error during compaction: ${e}`))}}}))();export{K as call};
@@ -1 +1 @@
1
- import{n as e}from"./chunk-DR8-3Aex.js";import{dc as t,yc as n}from"./paths-DO4WOQtD.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=t();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=t().companion;if(!e)return;let{bones:n}=L(e.seed??z()),r=V(e);return{...e,...n,...r}}var U,W,G=e((()=>{n(),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{dc as t,yc as n}from"./paths-4ZWdjPP4.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=t();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=t().companion;if(!e)return;let{bones:n}=L(e.seed??z()),r=V(e);return{...e,...n,...r}}var U,W,G=e((()=>{n(),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};
@@ -0,0 +1 @@
1
+ import{n as e,t}from"./completionCache-Br6OwASx.js";t();export{e as regenerateCompletionCache};
@@ -1,4 +1,4 @@
1
- import{n as e}from"./chunk-DR8-3Aex.js";import{$ as t,In as n,Ln as r,t as i,v as a}from"./src-Di342QoJ.js";import{G as o,U as s,l as c,p as l}from"./debug-otxXY3j-.js";import{o as u,s as d}from"./log-DSV4Ht5l.js";import{r as f,t as p}from"./execFileNoThrow-azCkYhmF.js";import{homedir as m}from"os";import{dirname as h,join as g}from"path";import{mkdir as _,readFile as v,writeFile as y}from"fs/promises";import{pathToFileURL as b}from"url";function x(){let e=process.env.SHELL||``,t=m(),n=g(t,`.claude`);if(e.endsWith(`/zsh`)||e.endsWith(`/zsh.exe`)){let e=g(n,`completion.zsh`);return{name:`zsh`,rcFile:g(t,`.zshrc`),cacheFile:e,completionLine:`[[ -f "${e}" ]] && source "${e}"`,shellFlag:`zsh`}}if(e.endsWith(`/bash`)||e.endsWith(`/bash.exe`)){let e=g(n,`completion.bash`);return{name:`bash`,rcFile:g(t,`.bashrc`),cacheFile:e,completionLine:`[ -f "${e}" ] && source "${e}"`,shellFlag:`bash`}}if(e.endsWith(`/fish`)||e.endsWith(`/fish.exe`)){let e=process.env.XDG_CONFIG_HOME||g(t,`.config`),r=g(n,`completion.fish`);return{name:`fish`,rcFile:g(e,`fish`,`config.fish`),cacheFile:r,completionLine:`[ -f "${r}" ] && source "${r}"`,shellFlag:`fish`}}return null}function S(e){return t()?`\x1b]8;;${b(e).href}\x07${e}\x1b]8;;\x07`:e}async function C(e){let t=x();if(!t)return``;try{await _(h(t.cacheFile),{recursive:!0})}catch(r){return d(r),`${T}${a(`warning`,e)(`Could not write ${t.name} completion cache`)}${T}${n.dim(`Run manually: claude completion ${t.shellFlag} > ${t.cacheFile}`)}${T}`}if((await p(process.argv[1]||`claude`,[`completion`,t.shellFlag,`--output`,t.cacheFile])).code!==0)return`${T}${a(`warning`,e)(`Could not generate ${t.name} shell completions`)}${T}${n.dim(`Run manually: claude completion ${t.shellFlag} > ${t.cacheFile}`)}${T}`;let r=``;try{if(r=await v(t.rcFile,{encoding:`utf-8`}),r.includes(`claude completion`)||r.includes(t.cacheFile))return`${T}${a(`success`,e)(`Shell completions updated for ${t.name}`)}${T}${n.dim(`See ${S(t.rcFile)}`)}${T}`}catch(r){if(!o(r))return d(r),`${T}${a(`warning`,e)(`Could not install ${t.name} shell completions`)}${T}${n.dim(`Add this to ${S(t.rcFile)}:`)}${T}${n.dim(t.completionLine)}${T}`}try{await _(h(t.rcFile),{recursive:!0});let i=r&&!r.endsWith(`
1
+ import{n as e}from"./chunk-DR8-3Aex.js";import{$ as t,In as n,Ln as r,t as i,v as a}from"./src-KjMLauwe.js";import{G as o,U as s,l as c,p as l}from"./debug-otxXY3j-.js";import{o as u,s as d}from"./log-DSV4Ht5l.js";import{r as f,t as p}from"./execFileNoThrow-azCkYhmF.js";import{homedir as m}from"os";import{dirname as h,join as g}from"path";import{mkdir as _,readFile as v,writeFile as y}from"fs/promises";import{pathToFileURL as b}from"url";function x(){let e=process.env.SHELL||``,t=m(),n=g(t,`.claude`);if(e.endsWith(`/zsh`)||e.endsWith(`/zsh.exe`)){let e=g(n,`completion.zsh`);return{name:`zsh`,rcFile:g(t,`.zshrc`),cacheFile:e,completionLine:`[[ -f "${e}" ]] && source "${e}"`,shellFlag:`zsh`}}if(e.endsWith(`/bash`)||e.endsWith(`/bash.exe`)){let e=g(n,`completion.bash`);return{name:`bash`,rcFile:g(t,`.bashrc`),cacheFile:e,completionLine:`[ -f "${e}" ] && source "${e}"`,shellFlag:`bash`}}if(e.endsWith(`/fish`)||e.endsWith(`/fish.exe`)){let e=process.env.XDG_CONFIG_HOME||g(t,`.config`),r=g(n,`completion.fish`);return{name:`fish`,rcFile:g(e,`fish`,`config.fish`),cacheFile:r,completionLine:`[ -f "${r}" ] && source "${r}"`,shellFlag:`fish`}}return null}function S(e){return t()?`\x1b]8;;${b(e).href}\x07${e}\x1b]8;;\x07`:e}async function C(e){let t=x();if(!t)return``;try{await _(h(t.cacheFile),{recursive:!0})}catch(r){return d(r),`${T}${a(`warning`,e)(`Could not write ${t.name} completion cache`)}${T}${n.dim(`Run manually: claude completion ${t.shellFlag} > ${t.cacheFile}`)}${T}`}if((await p(process.argv[1]||`claude`,[`completion`,t.shellFlag,`--output`,t.cacheFile])).code!==0)return`${T}${a(`warning`,e)(`Could not generate ${t.name} shell completions`)}${T}${n.dim(`Run manually: claude completion ${t.shellFlag} > ${t.cacheFile}`)}${T}`;let r=``;try{if(r=await v(t.rcFile,{encoding:`utf-8`}),r.includes(`claude completion`)||r.includes(t.cacheFile))return`${T}${a(`success`,e)(`Shell completions updated for ${t.name}`)}${T}${n.dim(`See ${S(t.rcFile)}`)}${T}`}catch(r){if(!o(r))return d(r),`${T}${a(`warning`,e)(`Could not install ${t.name} shell completions`)}${T}${n.dim(`Add this to ${S(t.rcFile)}:`)}${T}${n.dim(t.completionLine)}${T}`}try{await _(h(t.rcFile),{recursive:!0});let i=r&&!r.endsWith(`
2
2
  `)?`
3
3
  `:``,o=`${r}${i}\n# Claude Code shell completions\n${t.completionLine}\n`;return await y(t.rcFile,o,{encoding:`utf-8`}),`${T}${a(`success`,e)(`Installed ${t.name} shell completions`)}${T}${n.dim(`Added to ${S(t.rcFile)}`)}${T}${n.dim(`Run: source ${t.rcFile}`)}${T}`}catch(r){return d(r),`${T}${a(`warning`,e)(`Could not install ${t.name} shell completions`)}${T}${n.dim(`Add this to ${S(t.rcFile)}:`)}${T}${n.dim(t.completionLine)}${T}`}}async function w(){let e=x();if(e){if(l(`update: Regenerating ${e.name} completion cache`),(await p(process.argv[1]||`claude`,[`completion`,e.shellFlag,`--output`,e.cacheFile])).code!==0){l(`update: Failed to regenerate ${e.name} completion cache`);return}l(`update: Regenerated ${e.name} completion cache at ${e.cacheFile}`)}}var T,E=e((()=>{r(),i(),c(),s(),f(),u(),T=`
4
4
  `}));export{w as n,C as r,E as t};
@@ -1 +1 @@
1
- import{Cc as e,Sc as t,ac as n,dc as r,lc as i,oc as a,yc as o}from"./paths-DO4WOQtD.js";o();export{n as checkHasTrustDialogAccepted,a as enableConfigs,i as getCurrentProjectConfig,r as getGlobalConfig,t as saveCurrentProjectConfig,e as saveGlobalConfig};
1
+ import{Cc as e,Sc as t,ac as n,dc as r,lc as i,oc as a,yc as o}from"./paths-4ZWdjPP4.js";o();export{n as checkHasTrustDialogAccepted,a as enableConfigs,i as getCurrentProjectConfig,r as getGlobalConfig,t as saveCurrentProjectConfig,e as saveGlobalConfig};
@@ -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-CuljH0mu.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-C2vEJjLx.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{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{Bc as l,Gs as u,Uc as d,Ws as f}from"./paths-DO4WOQtD.js";import{b as p,x as m}from"./startupProfiler-CAntGAbs.js";import{Po as h,Uo as g,dl as _,iA as v,ll as y,rA as b}from"./loadAgentsDir-ClTeo0nk.js";import{En as x,Gn as S,Kn as C,Mn as w,Un as T,hn as E,mn as D,qn as O}from"./prompt-CfM_xGPc.js";import{n as k,t as A}from"./staticRender-C5v46np_.js";function ee(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 C: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 x: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 T: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===x);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((()=>{O(),w(),S(),E(),d(),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:ee(e)})]})}var X,Z,Q,te=e((()=>{r(),o(),U(),d(),m(),u(),K(),X=c(),Z=`Autocompact buffer`,Q=[`Project`,`User`,`Managed`,`Plugin`,`Built-in`]}));function ne(e){return h(e)}async function re(e,t){let{messages:n,getAppState:r,options:{mainLoopModel:i,tools:a}}=t,o=ne(n),{messages:s}=await v(o),c=process.stdout.columns||80,l=r();return e(await k((0,$.jsx)(Y,{data:await y(s,i,async()=>l.toolPermissionContext,a,l.agentDefinitions,c,t,void 0,o)}))),null}var $;e((()=>{r(),te(),b(),_(),g(),A(),$=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-KjMLauwe.js";import{t as c}from"./jsx-runtime-D-D469L8.js";import{Bc as l,Gs as u,Uc as d,Ws as f}from"./paths-4ZWdjPP4.js";import{b as p,x as m}from"./startupProfiler-rCtNuhXz.js";import{Po as h,Uo as g,dl as _,iA as v,ll as y,rA as b}from"./loadAgentsDir-CQF8qhne.js";import{En as x,Gn as S,Kn as C,Mn as w,Un as T,hn as E,mn as D,qn as O}from"./prompt-CogZQuTN.js";import{n as k,t as A}from"./staticRender-DboURbK0.js";function ee(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 C: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 x: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 T: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===x);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((()=>{O(),w(),S(),E(),d(),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:ee(e)})]})}var X,Z,Q,te=e((()=>{r(),o(),U(),d(),m(),u(),K(),X=c(),Z=`Autocompact buffer`,Q=[`Project`,`User`,`Managed`,`Plugin`,`Built-in`]}));function ne(e){return h(e)}async function re(e,t){let{messages:n,getAppState:r,options:{mainLoopModel:i,tools:a}}=t,o=ne(n),{messages:s}=await v(o),c=process.stdout.columns||80,l=r();return e(await k((0,$.jsx)(Y,{data:await y(s,i,async()=>l.toolPermissionContext,a,l.agentDefinitions,c,t,void 0,o)}))),null}var $;e((()=>{r(),te(),b(),_(),g(),A(),$=c()}))();export{re as call};
@@ -1,4 +1,4 @@
1
- import{n as e}from"./chunk-DR8-3Aex.js";import{Gs as t,Ws as n}from"./paths-DO4WOQtD.js";import{b as r,x as i}from"./startupProfiler-CAntGAbs.js";import{Po as a,Uo as o,dl as s,iA as c,ll as l,rA as u}from"./loadAgentsDir-ClTeo0nk.js";async function d(e){let{messages:t,getAppState:n,options:{mainLoopModel:r,tools:i,agentDefinitions:o,customSystemPrompt:s,appendSystemPrompt:u}}=e,d=a(t),{messages:f}=await c(d),p=n();return l(f,r,async()=>p.toolPermissionContext,i,o,void 0,{options:{customSystemPrompt:s,appendSystemPrompt:u}},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{Gs as t,Ws as n}from"./paths-4ZWdjPP4.js";import{b as r,x as i}from"./startupProfiler-rCtNuhXz.js";import{Po as a,Uo as o,dl as s,iA as c,ll as l,rA as u}from"./loadAgentsDir-CQF8qhne.js";async function d(e){let{messages:t,getAppState:n,options:{mainLoopModel:r,tools:i,agentDefinitions:o,customSystemPrompt:s,appendSystemPrompt:u}}=e,d=a(t),{messages:f}=await c(d),p=n();return l(f,r,async()=>p.toolPermissionContext,i,o,void 0,{options:{customSystemPrompt:s,appendSystemPrompt:u}},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
@@ -0,0 +1 @@
1
+ import{n as e,r as t,t as n}from"./context-noninteractive-CJu7hZCM.js";t();export{n as call,e as collectContextData};
@@ -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-DSV4Ht5l.js";import{$t as h,$v as g,Ai as ee,Au as _,Cn as v,Di as y,Fn as b,Fr as x,GE as S,In as C,Nn as w,Ob as T,Ot as E,Qv as D,RE as O,Tt as k,_r as A,cv as j,dy as M,gd as N,gi as P,hd as F,ju as I,kb as L,mh as R,mn as z,ph as B,qE as V,sr as H,sv as U,vy as W,zE as G}from"./loadAgentsDir-ClTeo0nk.js";import{C as K,y as q}from"./rcDebugLog-CwU_wJBE.js";import{l as J,r as Y}from"./commitAttribution-csu3NO7Y.js";import{n as X,t as Z}from"./caches-CIoVGP24.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:_,setAppState:v,setConversationId:C}){let T=z();await h(`clear`,{getAppState:_,setAppState:v,signal:AbortSignal.timeout(T),timeoutMs:T});let E=a();E&&f(`tengu_cache_eviction_hint`,{scope:`conversation_clear`,last_request_id:E});let D=new Set,N=[],F=e=>`isBackgrounded`in e&&e.isBackgrounded===!1;if(_)for(let e of Object.values(_().tasks))F(e)||(I(e)?(D.add(e.agentId),N.push(e)):L(e)&&D.add(e.identity.agentId));t(()=>[]),$();{let{setContextBlocked:t}=(q(),e(K));t(!1)}C&&C(Q()),Z(D),l(null),r(null),i(null),u(),R(c()),o.clear(),d?.clear(),p?.clear(),v&&v(e=>{let t={};for(let[n,r]of Object.entries(e.tasks)){if(!F(r)){t[n]=r;continue}try{r.status===`running`&&(j(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)}w(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}}}),M(),H(),s({setCurrentAsParent:!0}),process.env.USER_TYPE===`ant`&&process.env.CLAUDE_CODE_SESSION_ID&&(process.env.CLAUDE_CODE_SESSION_ID=n()),await P();for(let e of N)e.status===`running`&&b(e.id,A(S(e.agentId)));{let{saveMode:t}=(x(),e(ee)),{isCoordinatorMode:n}=(G(),e(O));t(n()?`coordinator`:`normal`)}let B=k();B&&y(B);let V=await g(`clear`);V.length>0&&t(()=>V)}var ne=t((()=>{N(),o(),d(),T(),_(),U(),V(),J(),v(),p(),W(),B(),D(),x(),C(),E(),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-DSV4Ht5l.js";import{$t as h,$v as g,Ai as ee,Au as _,Cn as v,Di as y,Fn as b,Fr as x,GE as S,In as C,Nn as w,Ob as T,Ot as E,Qv as D,RE as O,Tt as k,_r as A,cv as j,dy as M,gd as N,gi as P,hd as F,ju as I,kb as L,mh as R,mn as z,ph as B,qE as V,sr as H,sv as U,vy as W,zE as G}from"./loadAgentsDir-CQF8qhne.js";import{C as K,y as q}from"./rcDebugLog-DOXxIr8l.js";import{l as J,r as Y}from"./commitAttribution-ClSlXMPG.js";import{n as X,t as Z}from"./caches-Bp4F7tZ5.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:_,setAppState:v,setConversationId:C}){let T=z();await h(`clear`,{getAppState:_,setAppState:v,signal:AbortSignal.timeout(T),timeoutMs:T});let E=a();E&&f(`tengu_cache_eviction_hint`,{scope:`conversation_clear`,last_request_id:E});let D=new Set,N=[],F=e=>`isBackgrounded`in e&&e.isBackgrounded===!1;if(_)for(let e of Object.values(_().tasks))F(e)||(I(e)?(D.add(e.agentId),N.push(e)):L(e)&&D.add(e.identity.agentId));t(()=>[]),$();{let{setContextBlocked:t}=(q(),e(K));t(!1)}C&&C(Q()),Z(D),l(null),r(null),i(null),u(),R(c()),o.clear(),d?.clear(),p?.clear(),v&&v(e=>{let t={};for(let[n,r]of Object.entries(e.tasks)){if(!F(r)){t[n]=r;continue}try{r.status===`running`&&(j(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)}w(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}}}),M(),H(),s({setCurrentAsParent:!0}),process.env.USER_TYPE===`ant`&&process.env.CLAUDE_CODE_SESSION_ID&&(process.env.CLAUDE_CODE_SESSION_ID=n()),await P();for(let e of N)e.status===`running`&&b(e.id,A(S(e.agentId)));{let{saveMode:t}=(x(),e(ee)),{isCoordinatorMode:n}=(G(),e(O));t(n()?`coordinator`:`normal`)}let B=k();B&&y(B);let V=await g(`clear`);V.length>0&&t(()=>V)}var ne=t((()=>{N(),o(),d(),T(),_(),U(),V(),J(),v(),p(),W(),B(),D(),x(),C(),E(),X()}));export{ne as n,te as t};
@@ -0,0 +1 @@
1
+ import{n as e,t}from"./conversation-BYMS5Hqa.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{Cc as f,dc as p,yc as m}from"./paths-DO4WOQtD.js";import{n as h,r as g}from"./analytics-DqMQntaB.js";import{o as _,r as v}from"./stringUtils-KZoO4GUd.js";import{Uo as y,aS as b,ko as x,nA as S,ns as C,oS as w,tA as T}from"./loadAgentsDir-ClTeo0nk.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(C(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=x(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-KjMLauwe.js";import{t as d}from"./jsx-runtime-D-D469L8.js";import{Cc as f,dc as p,yc as m}from"./paths-4ZWdjPP4.js";import{n as h,r as g}from"./analytics-DqMQntaB.js";import{o as _,r as v}from"./stringUtils-KZoO4GUd.js";import{Uo as y,aS as b,ko as x,nA as S,ns as C,oS as w,tA as T}from"./loadAgentsDir-CQF8qhne.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(C(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=x(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=v(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-DO4WOQtD.js";import{D as i,E as a,O as o,l as s,p as c}from"./debug-otxXY3j-.js";import{l,u}from"./oauth-CdZEzMww.js";import{i as d,t as f}from"./cliLaunch-Citfs01Q.js";import{resolve as p}from"path";import{existsSync as m,unlinkSync as h}from"fs";import{randomUUID as g}from"crypto";s(),a(),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-4ZWdjPP4.js";import{D as i,E as a,O as o,l as s,p as c}from"./debug-otxXY3j-.js";import{l,u}from"./oauth-CdZEzMww.js";import{i as d,t as f}from"./cliLaunch-Citfs01Q.js";import{resolve as p}from"path";import{existsSync as m,unlinkSync as h}from"fs";import{randomUUID as g}from"crypto";s(),a(),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){c(`[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=i(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):(c(`[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=o({type:`user`,message:{role:`user`,content:e},parent_tool_use_id:null,session_id:``});return this.writeToStdin(t)}sendInterrupt(){let e=o({type:`control_request`,request_id:crypto.randomUUID(),request:{subtype:`interrupt`}});this.writeToStdin(e)}respondToPermissionRequest(e,t){let n=o({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=o({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 o=new Headers(e.headers);for(let[e,t]of Object.entries(a))o.set(e,t);o.delete(`host`),o.delete(`x-auth-nonce`),c(`[SSHAuthProxy] ${e.method} ${r.pathname} -> ${i}`);try{let t=await fetch(i,{method:e.method,headers:o,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 c(`[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 c(`[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 c(`[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 o=i.split(`
4
4
  `).map(e=>e.trim()).filter(Boolean);c(`[SSHProbe] raw lines: ${JSON.stringify(o)}`);let s=o.findIndex(e=>/^(Linux|Darwin)\s/.test(e));if(s===-1)throw new A(`Could not detect remote platform (uname output missing)`);let l=s>=2&&o[s-2]||null,u=s>=1&&o[s-1]||null,d=u&&/^\d+\.\d+/.test(u)?u:null,f=l!==null&&l.startsWith(`/`),p=o[s+1]||`/`,[m,h]=o[s].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.`);c(`[SSHDeploy] deploying to ${t} (${n}/${r}, v${i})`);let o=L();c(`[SSHDeploy] local binary: ${o}`),a?.(`Creating remote directory...`);let s=await I(t,`mkdir -p ${N}`);if(s.exitCode!==0)throw Error(`Failed to create remote directory: ${s.stderr}`);a?.(`Uploading binary...`);let l=`${N}/${P}`,u=Bun.spawn([`scp`,`-o`,`ConnectTimeout=10`,o,`${t}:${l}`],{stdout:`pipe`,stderr:`pipe`}),d=setTimeout(()=>u.kill(),M),f=await new Response(u.stderr).text(),p=await u.exited;if(clearTimeout(d),p!==0)throw Error(`SCP upload failed (exit ${p}): ${f.trim()}`);a?.(`Installing wrapper script...`);let m=await I(t,[`cat > ${N}/${F} << 'WRAPPER'`,`#!/bin/sh`,`exec bun ${N}/${P} "$@"`,`WRAPPER`,`chmod +x ${N}/${F}`].join(`
@@ -1 +1 @@
1
- import{n as e}from"./chunk-DR8-3Aex.js";import{U as t,l as n,p as r,z as i}from"./debug-otxXY3j-.js";import{c as a,d as o,i as s,o as c}from"./debugUtils-l8nsUZ6R.js";async function l({environmentId:e,title:t,events:n,gitRepoUrl:a,branch:o,signal:c,baseUrl:l,getAccessToken:u,permissionMode:d}){let{getClaudeAIOAuthTokens:f}=await import(`./auth-DsQEVs9W.js`),{getOrganizationUUID:p}=await import(`./client-BSoJ_vaA.js`),{getOauthConfig:m}=await import(`./oauth-CmensepG.js`),{getOAuthHeaders:h}=await import(`./api-quOYYOhi.js`),{parseGitHubRepository:g}=await import(`./detectRepository-BLwSmun2.js`),{getDefaultBranch:_}=await import(`./git-hSvFiuiG.js`),{getMainLoopModel:v}=await import(`./model-Bwvn_acH.js`),{default:y}=await import(`./axios-DLnc2dVy.js`),{isSelfHostedBridge:b}=await import(`./bridgeConfig-BdZVEqhx.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-BLwSmun2.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={...t!==void 0&&{title:t},events:n,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: ${i(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,t){let{getClaudeAIOAuthTokens:n}=await import(`./auth-DsQEVs9W.js`),{getOrganizationUUID:a}=await import(`./client-BSoJ_vaA.js`),{getOauthConfig:o}=await import(`./oauth-CmensepG.js`),{getOAuthHeaders:c}=await import(`./api-quOYYOhi.js`),{default:l}=await import(`./axios-DLnc2dVy.js`),{isSelfHostedBridge:u}=await import(`./bridgeConfig-BdZVEqhx.js`),d=t?.getAccessToken?.()??n()?.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=`${t?.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: ${i(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-DsQEVs9W.js`),{getOrganizationUUID:i}=await import(`./client-BSoJ_vaA.js`),{getOauthConfig:a}=await import(`./oauth-CmensepG.js`),{getOAuthHeaders:o}=await import(`./api-quOYYOhi.js`),{default:c}=await import(`./axios-DLnc2dVy.js`),{isSelfHostedBridge:l}=await import(`./bridgeConfig-BdZVEqhx.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,t,n){let{getClaudeAIOAuthTokens:a}=await import(`./auth-DsQEVs9W.js`),{getOrganizationUUID:c}=await import(`./client-BSoJ_vaA.js`),{getOauthConfig:l}=await import(`./oauth-CmensepG.js`),{getOAuthHeaders:u}=await import(`./api-quOYYOhi.js`),{default:d}=await import(`./axios-DLnc2dVy.js`),{isSelfHostedBridge:f}=await import(`./bridgeConfig-BdZVEqhx.js`),p=n?.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),_=`${n?.baseUrl??l().BASE_API_URL}/v1/sessions/${g}`;r(`[bridge] Updating session title: ${g} → ${t}`);try{let e=await d.patch(_,{title:t},{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: ${i(e)}`)}}var p=e((()=>{n(),t(),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{U as t,l as n,p as r,z as i}from"./debug-otxXY3j-.js";import{c as a,d as o,i as s,o as c}from"./debugUtils-l8nsUZ6R.js";async function l({environmentId:e,title:t,events:n,gitRepoUrl:a,branch:o,signal:c,baseUrl:l,getAccessToken:u,permissionMode:d}){let{getClaudeAIOAuthTokens:f}=await import(`./auth-BemPA3ot.js`),{getOrganizationUUID:p}=await import(`./client-BUUsZdSe.js`),{getOauthConfig:m}=await import(`./oauth-CmensepG.js`),{getOAuthHeaders:h}=await import(`./api-DkgaFAzq.js`),{parseGitHubRepository:g}=await import(`./detectRepository-BLwSmun2.js`),{getDefaultBranch:_}=await import(`./git-hSvFiuiG.js`),{getMainLoopModel:v}=await import(`./model-CgH43-hO.js`),{default:y}=await import(`./axios-DLnc2dVy.js`),{isSelfHostedBridge:b}=await import(`./bridgeConfig-Budgp2Go.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-BLwSmun2.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={...t!==void 0&&{title:t},events:n,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: ${i(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,t){let{getClaudeAIOAuthTokens:n}=await import(`./auth-BemPA3ot.js`),{getOrganizationUUID:a}=await import(`./client-BUUsZdSe.js`),{getOauthConfig:o}=await import(`./oauth-CmensepG.js`),{getOAuthHeaders:c}=await import(`./api-DkgaFAzq.js`),{default:l}=await import(`./axios-DLnc2dVy.js`),{isSelfHostedBridge:u}=await import(`./bridgeConfig-Budgp2Go.js`),d=t?.getAccessToken?.()??n()?.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=`${t?.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: ${i(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-BemPA3ot.js`),{getOrganizationUUID:i}=await import(`./client-BUUsZdSe.js`),{getOauthConfig:a}=await import(`./oauth-CmensepG.js`),{getOAuthHeaders:o}=await import(`./api-DkgaFAzq.js`),{default:c}=await import(`./axios-DLnc2dVy.js`),{isSelfHostedBridge:l}=await import(`./bridgeConfig-Budgp2Go.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,t,n){let{getClaudeAIOAuthTokens:a}=await import(`./auth-BemPA3ot.js`),{getOrganizationUUID:c}=await import(`./client-BUUsZdSe.js`),{getOauthConfig:l}=await import(`./oauth-CmensepG.js`),{getOAuthHeaders:u}=await import(`./api-DkgaFAzq.js`),{default:d}=await import(`./axios-DLnc2dVy.js`),{isSelfHostedBridge:f}=await import(`./bridgeConfig-Budgp2Go.js`),p=n?.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),_=`${n?.baseUrl??l().BASE_API_URL}/v1/sessions/${g}`;r(`[bridge] Updating session title: ${g} → ${t}`);try{let e=await d.patch(_,{title:t},{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: ${i(e)}`)}}var p=e((()=>{n(),t(),c(),a()}));export{f as a,p as i,l as n,u as r,d as t};
@@ -0,0 +1 @@
1
+ import{a as e,i as t,n,r}from"./createSession-DjM6Ev45.js";t();export{n as createBridgeSession,r as getBridgeSession,e as updateBridgeSessionTitle};