@readmagic/workmate 0.0.7 → 0.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (558) hide show
  1. package/dist/chunks/AddWorkspaceDirectory-CwLtQld4.js +1 -0
  2. package/dist/chunks/App-Ba52HvYC.js +1 -0
  3. package/dist/chunks/{ApproveApiKey-B2HJUD7h.js → ApproveApiKey-CEIfuUh0.js} +1 -1
  4. package/dist/chunks/ApproveApiKey-D2MLQu2P.js +1 -0
  5. package/dist/chunks/BackgroundTasksDialog-IGDrkbWl.js +2 -0
  6. package/dist/chunks/{BypassPermissionsModeDialog-DllL8dxU.js → BypassPermissionsModeDialog-GYhq--JR.js} +1 -1
  7. package/dist/chunks/{ClaudeMdExternalIncludesDialog-BZSyRqeq.js → ClaudeMdExternalIncludesDialog-C-CTa-95.js} +1 -1
  8. package/dist/chunks/ClaudeMdExternalIncludesDialog-Catv6BCJ.js +1 -0
  9. package/dist/chunks/ConsoleOAuthFlow-BeQXqUtX.js +1 -0
  10. package/dist/chunks/{DiffDialog-B7hx8i_Y.js → DiffDialog-AC5DSJrq.js} +6 -6
  11. package/dist/chunks/Doctor-B9Rxsoy0.js +1 -0
  12. package/dist/chunks/Doctor-lhUBhEy5.js +3 -0
  13. package/dist/chunks/ExitFlow-Cu8SoQHs.js +2 -0
  14. package/dist/chunks/Grove-Bc4CofEj.js +11 -0
  15. package/dist/chunks/{HybridTransport-rK83Qijz.js → HybridTransport-BJPOG2wl.js} +3 -3
  16. package/dist/chunks/{InvalidConfigDialog-DdO0AxyF.js → InvalidConfigDialog-BI13il58.js} +1 -1
  17. package/dist/chunks/{InvalidSettingsDialog-s1G0DwXF.js → InvalidSettingsDialog-CtOheV1K.js} +1 -1
  18. package/dist/chunks/MCPConnectionManager-ao-P3xSA.js +1 -0
  19. package/dist/chunks/MCPToolListView-dkofcJs4.js +1 -0
  20. package/dist/chunks/{McpParsingWarnings-Du5IxZos.js → McpParsingWarnings-BS4JoR5l.js} +1 -1
  21. package/dist/chunks/MessageSelector-B88b2ypw.js +3 -0
  22. package/dist/chunks/Messages-BPeI7lLV.js +11 -0
  23. package/dist/chunks/Onboarding-c2fQ8Io_.js +1 -0
  24. package/dist/chunks/{PromptInputFooterSuggestions-BmsFdOu9.js → PromptInputFooterSuggestions-D1cH9sDX.js} +1 -1
  25. package/dist/chunks/{PromptInputHelpMenu-DX-0wEDo.js → PromptInputHelpMenu-DDD5WuK0.js} +1 -1
  26. package/dist/chunks/QueryEngine-Cv_meCam.js +1 -0
  27. package/dist/chunks/REPL-BXhAQOXb.js +139 -0
  28. package/dist/chunks/REPL-YqjLnr3A.js +1 -0
  29. package/dist/chunks/RemoteSessionManager-CT7T8BaR.js +2 -0
  30. package/dist/chunks/ResumeConversation-CIZCjms9.js +1 -0
  31. package/dist/chunks/{SSETransport-5VK5okFv.js → SSETransport-CrwbKuVt.js} +3 -3
  32. package/dist/chunks/SearchExtraToolsTool-Dx6093yw.js +1 -0
  33. package/dist/chunks/Settings-CyUm0AtU.js +2 -0
  34. package/dist/chunks/{TeleportProgress-DxN0bQL2.js → TeleportProgress-C3qyp5zy.js} +1 -1
  35. package/dist/chunks/TeleportRepoMismatchDialog-BV--nyYn.js +1 -0
  36. package/dist/chunks/TeleportResumeWrapper-Blo2cZg-.js +1 -0
  37. package/dist/chunks/ThemePicker-EQ6hPUeI.js +1 -0
  38. package/dist/chunks/TrustDialog-BukWGvHZ.js +1 -0
  39. package/dist/chunks/{ValidationErrorsList-BYsDtAvX.js → ValidationErrorsList-DokTJQwi.js} +1 -1
  40. package/dist/chunks/{WelcomeV2-C1BfrqC5.js → WelcomeV2-Ci9VwPYh.js} +1 -1
  41. package/dist/chunks/{add-dir-DfLYgwox.js → add-dir-DPQV0qml.js} +1 -1
  42. package/dist/chunks/{agentDisplay-CMmHIl86.js → agentDisplay-DBQYOaOh.js} +1 -1
  43. package/dist/chunks/agents-DmybpgDN.js +103 -0
  44. package/dist/chunks/{agents-DE_4mAHG.js → agents-HlKk68Qc.js} +1 -1
  45. package/dist/chunks/allErrors-BPn_2TrB.js +1 -0
  46. package/dist/chunks/analytics-CkYUHW_U.js +1 -0
  47. package/dist/chunks/ant-DjdvlLOo.js +1 -0
  48. package/dist/chunks/api-AMgj1zf_.js +1 -0
  49. package/dist/chunks/api-CF5IVtj0.js +1 -0
  50. package/dist/chunks/{asciicast-CbAjUHT_.js → asciicast-BJNYO5sh.js} +1 -1
  51. package/dist/chunks/asciicast-CH6hdK0a.js +1 -0
  52. package/dist/chunks/auth-CNjDn1VY.js +15 -0
  53. package/dist/chunks/auth-CZzP483s.js +1 -0
  54. package/dist/chunks/auth-DDSBm_Yj.js +1 -0
  55. package/dist/chunks/{autoMode-ZW70mpr0.js → autoMode-Cr0AhS1G.js} +5 -5
  56. package/dist/chunks/{autonomy-CwbWsCnv.js → autonomy-ARUQt-Lu.js} +1 -1
  57. package/dist/chunks/{autonomy-Oui8yK8G.js → autonomy-D4xZLOdJ.js} +7 -7
  58. package/dist/chunks/{autonomyPanel-Mq50H7iM.js → autonomyPanel-BQK9MoeB.js} +1 -1
  59. package/dist/chunks/backgroundHousekeeping--eBgphcg.js +17 -0
  60. package/dist/chunks/backgroundHousekeeping-VV1V_Y2Z.js +1 -0
  61. package/dist/chunks/{banner-CWkrK10u.js → banner-Ca7rki2V.js} +2 -2
  62. package/dist/chunks/bg-BK_9J6F6.js +1 -0
  63. package/dist/chunks/{bg-WnYN5ifx.js → bg-DxRHF1yn.js} +2 -2
  64. package/dist/chunks/{branch-DU5O9KZ0.js → branch-BYq0zpzT.js} +1 -1
  65. package/dist/chunks/{break-cache-C_p7Kmx2.js → break-cache-BKvoMOZx.js} +2 -2
  66. package/dist/chunks/bridgeConfig-C82un7rJ.js +1 -0
  67. package/dist/chunks/{bridgeConfig-CE6dMsiJ.js → bridgeConfig-jDEva6Eh.js} +1 -1
  68. package/dist/chunks/bridgeMessaging-YqYdl6ej.js +1 -0
  69. package/dist/chunks/bridgePointer-DIM0sj0x.js +1 -0
  70. package/dist/chunks/btw-CUV3nRrE.js +1 -0
  71. package/dist/chunks/caches-BZ59_En6.js +1 -0
  72. package/dist/chunks/caches-Cg-HtWKG.js +1 -0
  73. package/dist/chunks/capacityWake-CKOiRELo.js +3 -0
  74. package/dist/chunks/ccrClient-BC2q3k44.js +1 -0
  75. package/dist/chunks/{claudeDesktop-Fe-QL-sN.js → claudeDesktop-DQXL5bGm.js} +1 -1
  76. package/dist/chunks/{clear-D8m2utXW.js → clear-1etSJhdg.js} +1 -1
  77. package/dist/chunks/{cliLaunch-BkPAatcs.js → cliLaunch-CQjLYRzM.js} +1 -1
  78. package/dist/chunks/client-DQXvVKND.js +1 -0
  79. package/dist/chunks/{client-C6MbjvOB.js → client-DQwf_b9o.js} +1 -1
  80. package/dist/chunks/client-DkgC-mFB.js +1 -0
  81. package/dist/chunks/{color-DWhgZH7A.js → color-CBsNbt1s.js} +1 -1
  82. package/dist/chunks/commands-qM5z_Uld.js +1 -0
  83. package/dist/chunks/compact-BclJiRJe.js +2 -0
  84. package/dist/chunks/completionCache-BMHAktkM.js +1 -0
  85. package/dist/chunks/config-CE058cvr.js +3 -0
  86. package/dist/chunks/config-D81avYye.js +1 -0
  87. package/dist/chunks/config-DpOOllGk.js +1 -0
  88. package/dist/chunks/context-noninteractive-Ct_ttQfP.js +29 -0
  89. package/dist/chunks/context-noninteractive-DJb8H_hN.js +1 -0
  90. package/dist/chunks/context-sR9fJmXE.js +1 -0
  91. package/dist/chunks/conversation-D48Kt3ar.js +1 -0
  92. package/dist/chunks/conversation-fOFTa7k5.js +1 -0
  93. package/dist/chunks/{createSSHSession-BOdTAX3N.js → createSSHSession-BmHXA2me.js} +1 -1
  94. package/dist/chunks/createSession-C4rukWkv.js +1 -0
  95. package/dist/chunks/createSession-CSwlW2T2.js +1 -0
  96. package/dist/chunks/crossProjectResume-lDFB2ZcY.js +40 -0
  97. package/dist/chunks/cwd-5Xr-Qka6.js +1 -0
  98. package/dist/chunks/cwd-C5ce-7WB.js +1 -0
  99. package/dist/chunks/{daemon-YtZbMQtn.js → daemon-ZtpTZWgQ.js} +1 -1
  100. package/dist/chunks/{datadog-DqHxqiwY.js → datadog-BJn5ECIu.js} +1 -1
  101. package/dist/chunks/{debug-BrXObCdR.js → debug-RZ4NuXyS.js} +1 -1
  102. package/dist/chunks/debugUtils-D30M1cbN.js +1 -0
  103. package/dist/chunks/{detached-TYk4hMFj.js → detached-jrVP11oU.js} +1 -1
  104. package/dist/chunks/{detectRepository-BPr0VWNO.js → detectRepository-CFiHe6Rv.js} +1 -1
  105. package/dist/chunks/detectRepository-DqQvyj_a.js +1 -0
  106. package/dist/chunks/{diff-CJEKvOA5.js → diff-BKiK3xHv.js} +1 -1
  107. package/dist/chunks/directoryCompletion-BagQcynj.js +1 -0
  108. package/dist/chunks/doctor-BEHYm34V.js +1 -0
  109. package/dist/chunks/{entry-DE0uMIf0.js → entry-BzL1MFQG.js} +4 -4
  110. package/dist/chunks/esm-BLPbfHQd.js +1 -0
  111. package/dist/chunks/{execFileNoThrow-D244NytW.js → execFileNoThrow-CCX-JY8h.js} +1 -1
  112. package/dist/chunks/{execSyncWrapper-CCMQShK-.js → execSyncWrapper-dhRSYGFW.js} +1 -1
  113. package/dist/chunks/exit-DE2YiAhQ.js +1 -0
  114. package/dist/chunks/{lazySchema-DULtBUCI.js → external-CEp-aPkt.js} +1 -1
  115. package/dist/chunks/extraUsage-Dw7AXiH7.js +1 -0
  116. package/dist/chunks/extractMemories-DxTUMiv3.js +1 -0
  117. package/dist/chunks/fast-CHmMkIpE.js +1 -0
  118. package/dist/chunks/fast-uQASHWqR.js +1 -0
  119. package/dist/chunks/fileSuggestions-Dyu2kQtE.js +3 -0
  120. package/dist/chunks/firstPartyEventLogger-D5ohKbIe.js +5 -0
  121. package/dist/chunks/firstPartyEventLogger-LsNY6yOt.js +1 -0
  122. package/dist/chunks/flushGate-Cnsu4HET.js +1 -0
  123. package/dist/chunks/gemini-Cudre91e.js +1 -0
  124. package/dist/chunks/generateRecap-CiFxXlmH.js +1 -0
  125. package/dist/chunks/generateSessionName-DitoBxJT.js +1 -0
  126. package/dist/chunks/{genericProcessUtils-CdQTApYX.js → genericProcessUtils-DVfMHhfy.js} +1 -1
  127. package/dist/chunks/git-BerW9bId.js +6 -0
  128. package/dist/chunks/git-D6dOU2mT.js +1 -0
  129. package/dist/chunks/githubRepoPathMapping-DGr0kJ8D.js +1 -0
  130. package/dist/chunks/{goal-B4GsR54_.js → goal-DuUayfDg.js} +3 -3
  131. package/dist/chunks/grok-tRbmZzEh.js +1 -0
  132. package/dist/chunks/grove-Cv19v6Sv.js +7 -0
  133. package/dist/chunks/help-DkqxbFDM.js +1 -0
  134. package/dist/chunks/{hooks-CkA9bhHl.js → hooks-BZJTWD07.js} +2 -2
  135. package/dist/chunks/hooks-CsP42iOp.js +1 -0
  136. package/dist/chunks/initReplBridge-DdsSWVqN.js +1 -0
  137. package/dist/chunks/{install-Dzlm4u58.js → install-BI---dv0.js} +1 -1
  138. package/dist/chunks/{instrumentation-Yt31gxWN.js → instrumentation-CcWzhGfE.js} +4 -4
  139. package/dist/chunks/{job-BXujwZNa.js → job-B0ftcqPF.js} +1 -1
  140. package/dist/chunks/{jwtUtils-DE2GPUcx.js → jwtUtils-C0cE-1Ey.js} +1 -1
  141. package/dist/chunks/keybindings-DZU3vwo3.js +2 -0
  142. package/dist/chunks/language-DHhXLb_Y.js +1 -0
  143. package/dist/chunks/{language-Ca4B018X.js → language-s-dLbdVz.js} +1 -1
  144. package/dist/chunks/launchLocalMemory-twLxpPvg.js +3 -0
  145. package/dist/chunks/{launchOnboarding-gOVAFEFp.js → launchOnboarding-BWz2XSb9.js} +1 -1
  146. package/dist/chunks/lazySchema-B4D4qJVE.js +1 -0
  147. package/dist/chunks/{loadAgentsDir-x3rlgED4.js → loadAgentsDir-ByO8eJqU.js} +1710 -1977
  148. package/dist/chunks/loadAgentsDir-CMNFLt7R.js +1 -0
  149. package/dist/chunks/loadPluginHooks-BPnxcgrL.js +1 -0
  150. package/dist/chunks/{localSearch-DtplGF-l.js → localSearch-CHHCH16D.js} +1 -1
  151. package/dist/chunks/localSearch-DzQODFap.js +1 -0
  152. package/dist/chunks/log-CZ0zYP_c.js +1 -0
  153. package/dist/chunks/logoV2Utils-CGUJ-5gY.js +1 -0
  154. package/dist/chunks/{magicDocs-qdDB_mKb.js → magicDocs-C5i5ruuU.js} +3 -3
  155. package/dist/chunks/{main-D862LI_d.js → main-BLD4QAQg.js} +2 -2
  156. package/dist/chunks/{main-OWFSddRx.js → main-D4Uk-WUs.js} +87 -84
  157. package/dist/chunks/{managedEnv-Aq5BXfY7.js → managedEnv-C-9XSN14.js} +1 -1
  158. package/dist/chunks/managedEnv-DLVRBaA9.js +1 -0
  159. package/dist/chunks/{mappers-04gNXJ3w.js → mappers-CHRFic5q.js} +1 -1
  160. package/dist/chunks/mcp-BMVdGknC.js +1 -0
  161. package/dist/chunks/mcp-COS5RJFS.js +6 -0
  162. package/dist/chunks/mcp-tGsOW1GN.js +2 -0
  163. package/dist/chunks/memoize-B8hfb1JN.js +1 -0
  164. package/dist/chunks/memory-DR6poqeH.js +1 -0
  165. package/dist/chunks/{mode-DY087x_x.js → mode-QV-NW1Wd.js} +2 -2
  166. package/dist/chunks/model-BF_4ebyl.js +1 -0
  167. package/dist/chunks/{model-D0EfJBuw.js → model-BNU_ulDJ.js} +1 -1
  168. package/dist/chunks/model-CwO-g1RW.js +1 -0
  169. package/dist/chunks/nativeInstaller-B-lNJjM-.js +1 -0
  170. package/dist/chunks/observationStore-BpjlK0pG.js +3 -0
  171. package/dist/chunks/omit-DZCEXri5.js +1 -0
  172. package/dist/chunks/onChangeAppState-BmfM5g-D.js +1 -0
  173. package/dist/chunks/{openai-EYRnUsco.js → openai-DPH6rXOZ.js} +3 -3
  174. package/dist/chunks/{panel-BSZGX6jN.js → panel-mD094ALT.js} +1 -1
  175. package/dist/chunks/{panelCall-dMvRPAGE.js → panelCall-SbffM7G4.js} +1 -1
  176. package/dist/chunks/parser-DrBC8nWp.js +1 -0
  177. package/dist/chunks/{parser-DFwaTGf7.js → parser-dbHRgXb8.js} +1 -1
  178. package/dist/chunks/partition-DKuAFJkc.js +1 -0
  179. package/dist/chunks/{path-D5U-tm91.js → path-Cv9QMBAX.js} +1 -1
  180. package/dist/chunks/permissions-ey-bfanE.js +3 -0
  181. package/dist/chunks/{pidLock-CbC_il6r.js → pidLock-DJnS_38v.js} +2 -2
  182. package/dist/chunks/{pipeTransport-CqCnc-Ys.js → pipeTransport-DVOKR4c_.js} +1 -1
  183. package/dist/chunks/{plan-rsb_83Fo.js → plan-Brg9XnRr.js} +1 -1
  184. package/dist/chunks/{platform-BrYefG_2.js → platform-DCXXznJg.js} +1 -1
  185. package/dist/chunks/plugin-CRwa39Y1.js +17 -0
  186. package/dist/chunks/{pluginAutoupdate-0k03PVff.js → pluginAutoupdate-D0LIP7cy.js} +1 -1
  187. package/dist/chunks/pluginBlocklist-PwHHD3nj.js +1 -0
  188. package/dist/chunks/pluginCliCommands-BJM5Bdpf.js +1 -0
  189. package/dist/chunks/pluginFlagging-pBxSselw.js +1 -0
  190. package/dist/chunks/pluginOperations-C7p_Qr2r.js +2 -0
  191. package/dist/chunks/pluginStartupCheck-C0HqhG6D.js +1 -0
  192. package/dist/chunks/pluginStartupCheck-Di4LjHXf.js +1 -0
  193. package/dist/chunks/{plugins-CQNKZmjP.js → plugins-DUKNjLq6.js} +4 -4
  194. package/dist/chunks/pollConfig-BgpfHQPJ.js +1 -0
  195. package/dist/chunks/{poorMode-CBOtooa0.js → poorMode-CYXmr_mU.js} +1 -1
  196. package/dist/chunks/poorMode-CejPNCp-.js +1 -0
  197. package/dist/chunks/print-gyTOCJzk.js +23 -0
  198. package/dist/chunks/processBashCommand-Cze9vCm6.js +1 -0
  199. package/dist/chunks/processSlashCommand-BRajh1v7.js +5 -0
  200. package/dist/chunks/prompt-B7joRiqj.js +139 -0
  201. package/dist/chunks/prompt-DqSMh2x9.js +1 -0
  202. package/dist/chunks/prompt-Eysh8Et_.js +1 -0
  203. package/dist/chunks/{promptEditor-CyTzyjwG.js → promptEditor-R_acDAgI.js} +2 -2
  204. package/dist/chunks/{protocolHandler-JR8pASdH.js → protocolHandler-RNKkhq91.js} +1 -1
  205. package/dist/chunks/{proxy-CRN7jYIi.js → proxy-BmtEnJ02.js} +1 -1
  206. package/dist/chunks/rcDebugLog-CARUIORE.js +1 -0
  207. package/dist/chunks/reconciler-BfkO6X2X.js +4 -0
  208. package/dist/chunks/refresh-C1X3sptR.js +1 -0
  209. package/dist/chunks/registerProtocol-DoKqmqu2.js +36 -0
  210. package/dist/chunks/{reload-plugins-B9ApSp2m.js → reload-plugins-C0osFcNh.js} +1 -1
  211. package/dist/chunks/remoteBridgeCore-Cddqv2WW.js +1 -0
  212. package/dist/chunks/remoteManagedSettings-B1mnRDmA.js +1 -0
  213. package/dist/chunks/rename-B3tf-YiD.js +1 -0
  214. package/dist/chunks/{renderOptions-BUJB9nAm.js → renderOptions-ChLwxtVu.js} +1 -1
  215. package/dist/chunks/replBridgeHandle-CNwNIijW.js +1 -0
  216. package/dist/chunks/{resume-BicEjsPd.js → resume-Be1G_GBL.js} +2 -2
  217. package/dist/chunks/ripgrep-C2PhTJDh.js +1 -0
  218. package/dist/chunks/{ripgrep-BXmXjAzA.js → ripgrep-gaT9Njwi.js} +1 -1
  219. package/dist/chunks/{runtimeObserver-CiwnPFjK.js → runtimeObserver-CsIwinzh.js} +1 -1
  220. package/dist/chunks/runtimeObserver-Dbxxw4ls.js +10 -0
  221. package/dist/chunks/sandbox-adapter-C6GBuJPB.js +1 -0
  222. package/dist/chunks/sandbox-toggle-jEySONTW.js +1 -0
  223. package/dist/chunks/searchExtraTools-C_UTryh_.js +1 -0
  224. package/dist/chunks/session-DDI1Eb2x.js +2 -0
  225. package/dist/chunks/sessionFileAccessHooks-DfJ7Htfl.js +1 -0
  226. package/dist/chunks/sessionIdCompat-DMayYBrf.js +1 -0
  227. package/dist/chunks/sessionMemory-CQBxPkTQ.js +1 -0
  228. package/dist/chunks/sessionMemory-s0ALUHvc.js +1 -0
  229. package/dist/chunks/sessionMemoryUtils-xt7dTHGC.js +1 -0
  230. package/dist/chunks/sessionObserver-C2sYqWL3.js +1 -0
  231. package/dist/chunks/sessionObserver-DoYc0ZOP.js +20 -0
  232. package/dist/chunks/sessionState-CjNY991n.js +11 -0
  233. package/dist/chunks/sessionStorage-DqsY-7pi.js +1 -0
  234. package/dist/chunks/{sessionTitle-DAnM73S0.js → sessionTitle-B0OYf5nM.js} +3 -3
  235. package/dist/chunks/sessionTracing-CwsXt_uA.js +11 -0
  236. package/dist/chunks/settings-BWtOA9A7.js +1 -0
  237. package/dist/chunks/settings-hQDLwPVj.js +20 -0
  238. package/dist/chunks/settingsSync-DdFagwHV.js +1 -0
  239. package/dist/chunks/setup-DzC22EkN.js +3 -0
  240. package/dist/chunks/{shadowedRuleDetection-C6R5zOUe.js → shadowedRuleDetection-C86PTj1m.js} +1 -1
  241. package/dist/chunks/{shellQuote-DkSy9MYE.js → shellQuote-BUVKMu_P.js} +1 -1
  242. package/dist/chunks/{sideQuestion-hUhxls9r.js → sideQuestion-C780iYwd.js} +3 -3
  243. package/dist/chunks/sinks-5G_xhc1Q.js +1 -0
  244. package/dist/chunks/{sinks-BuE17DeZ.js → sinks-Cftq7Es0.js} +2 -2
  245. package/dist/chunks/skillChangeDetector-plLveEbf.js +1 -0
  246. package/dist/chunks/skillGapStore-Dc1arohs.js +5 -0
  247. package/dist/chunks/skillLifecycle-DP6mY1Kp.js +8 -0
  248. package/dist/chunks/{skillSearchPanel-Cll9ccA5.js → skillSearchPanel-CpLTImaL.js} +4 -4
  249. package/dist/chunks/{skills-BPPeYBy7.js → skills-zGYaYfFV.js} +1 -1
  250. package/dist/chunks/{src-D06Xyj4g.js → src-BN7QRYLl.js} +1 -1
  251. package/dist/chunks/startupProfiler-DCn_NxMH.js +3 -0
  252. package/dist/chunks/startupProfiler-JbpAkfNE.js +1 -0
  253. package/dist/chunks/{state-ix0xIunV.js → state-C2OSZkV1.js} +1 -1
  254. package/dist/chunks/state-DU9lRJ9x.js +1 -0
  255. package/dist/chunks/{stats-CqfF4Axp.js → stats-Duk7_xjQ.js} +1 -1
  256. package/dist/chunks/{status-D4IQpsNK.js → status-CFw-FpZM.js} +2 -2
  257. package/dist/chunks/{status-CC9Q-2Yn.js → status-peiVB_2j.js} +1 -1
  258. package/dist/chunks/statusNoticeHelpers-B5U5c9PE.js +1 -0
  259. package/dist/chunks/{stringUtils-DGLPkqJ4.js → stringUtils-B6FudhoZ.js} +1 -1
  260. package/dist/chunks/switcher-BAMqSX7Z.js +1 -0
  261. package/dist/chunks/switcher-hgBgVzLb.js +1 -0
  262. package/dist/chunks/syncCache-Zl9kZRRl.js +1 -0
  263. package/dist/chunks/{tasks-CZvWJYGr.js → tasks-BxpyRhmD.js} +1 -1
  264. package/dist/chunks/teleport-CwxeD5vL.js +1 -0
  265. package/dist/chunks/{templateJobs-D1BdhZsv.js → templateJobs-DR5fKFiO.js} +1 -1
  266. package/dist/chunks/{terminalSetup-Cn6jeYw1.js → terminalSetup-DgRBt-JJ.js} +1 -1
  267. package/dist/chunks/terminalSetup-DlaFWI81.js +33 -0
  268. package/dist/chunks/{theme-Cg4GNOoQ.js → theme-Bz6esfST.js} +1 -1
  269. package/dist/chunks/{tmux-BY7IdQ1f.js → tmux-DSU9tYIo.js} +1 -1
  270. package/dist/chunks/{toolEventObserver-SFwURL5F.js → toolEventObserver-BSekCkM2.js} +1 -1
  271. package/dist/chunks/toolPool-B7SIoDw5.js +1 -0
  272. package/dist/chunks/{trustedDevice-CKedohmT.js → trustedDevice-B0x9X0fb.js} +1 -1
  273. package/dist/chunks/trustedDevice-CjHQtVkO.js +1 -0
  274. package/dist/chunks/{types-Dut4311z.js → types-D7_37tP2.js} +2 -2
  275. package/dist/chunks/{udsClient-BuCtv7dN.js → udsClient-CHoMMH28.js} +1 -1
  276. package/dist/chunks/{up-BHkC97_C.js → up-B8wBSpLg.js} +1 -1
  277. package/dist/chunks/{updateCCB-C2G-U-qA.js → updateCCB-D_kGQKPT.js} +1 -1
  278. package/dist/chunks/{upstreamproxy-DyR_eXO8.js → upstreamproxy-Hmq-n8fw.js} +1 -1
  279. package/dist/chunks/useExitOnCtrlCDWithKeybindings-Cce612uS.js +1 -0
  280. package/dist/chunks/useMainLoopModel-BICP6_Fi.js +1 -0
  281. package/dist/chunks/useManagePlugins-DtbY_vPL.js +1 -0
  282. package/dist/chunks/useMergedTools-Ckx2IEhF.js +1 -0
  283. package/dist/chunks/{useSearchInput-C5OzQnX6.js → useSearchInput-BAgljZUl.js} +1 -1
  284. package/dist/chunks/useSettingsErrors-CAJR_wpd.js +1 -0
  285. package/dist/chunks/userAgent-BxTG7IMk.js +1 -0
  286. package/dist/chunks/{util-8EHwfg4A.js → util-DDtmyq_r.js} +1 -1
  287. package/dist/chunks/validatePlugin-AHl-g4ct.js +1 -0
  288. package/dist/chunks/{vim-CNDzwoTd.js → vim-kg-mRVbu.js} +1 -1
  289. package/dist/chunks/{which-CKQnSouy.js → which-CHLNJmtJ.js} +1 -1
  290. package/dist/chunks/windowsPaths-Pmx8LDR6.js +1 -0
  291. package/dist/chunks/{windowsPaths-DtapVxOo.js → windowsPaths-o62uq6LF.js} +1 -1
  292. package/dist/chunks/{workSecret-CNWiR2uQ.js → workSecret-DG9shvG0.js} +1 -1
  293. package/dist/chunks/workerRegistry-C7H_lsQX.js +6 -0
  294. package/dist/chunks/worktree-O2p-mJdF.js +1 -0
  295. package/dist/cli.js +1 -1
  296. package/package.json +1 -1
  297. package/dist/chunks/AddWorkspaceDirectory-CFrrXnt9.js +0 -1
  298. package/dist/chunks/App-Buad9Llp.js +0 -1
  299. package/dist/chunks/ApproveApiKey-BQbHdvc3.js +0 -1
  300. package/dist/chunks/AssistantSessionChooser-4lm4eXQ8.js +0 -1
  301. package/dist/chunks/BackgroundTasksDialog-D4qA0M5O.js +0 -2
  302. package/dist/chunks/ClaudeMdExternalIncludesDialog--ywODh81.js +0 -1
  303. package/dist/chunks/ConsoleOAuthFlow-Wkfw7Ts-.js +0 -1
  304. package/dist/chunks/DesktopHandoff-DaP4Riar.js +0 -1
  305. package/dist/chunks/Dialog-vfLXEPed.js +0 -1
  306. package/dist/chunks/Doctor-89OgoAUA.js +0 -1
  307. package/dist/chunks/Doctor-CuKJ-nGt.js +0 -3
  308. package/dist/chunks/ExitFlow-DnPydE17.js +0 -2
  309. package/dist/chunks/Feedback-SmGiR3mf.js +0 -2
  310. package/dist/chunks/Grove-CjN9DO47.js +0 -11
  311. package/dist/chunks/Grove-Cq88VBmM.js +0 -1
  312. package/dist/chunks/ListItem-vfLXEPed.js +0 -1
  313. package/dist/chunks/MCPConnectionManager-NRfIjdlj.js +0 -1
  314. package/dist/chunks/MessageSelector-iIroHvXo.js +0 -3
  315. package/dist/chunks/Messages-D4Hm4gaY.js +0 -11
  316. package/dist/chunks/Onboarding-BiZByBK-.js +0 -1
  317. package/dist/chunks/OverageCreditUpsell-BM7szLgm.js +0 -1
  318. package/dist/chunks/PluginSettings-uY5KTCtK.js +0 -17
  319. package/dist/chunks/QueryEngine-CGYaShXD.js +0 -1
  320. package/dist/chunks/REPL-CRJB2t2z.js +0 -142
  321. package/dist/chunks/REPL-u4Yq29Du.js +0 -1
  322. package/dist/chunks/RemoteCallout-B-tyvQOe.js +0 -1
  323. package/dist/chunks/RemoteSessionManager-DCd0O5_l.js +0 -2
  324. package/dist/chunks/ResumeConversation-DAAXlOCd.js +0 -1
  325. package/dist/chunks/SearchExtraToolsTool-B-7Bworf.js +0 -1
  326. package/dist/chunks/Settings-CUjWlncb.js +0 -2
  327. package/dist/chunks/TeleportRepoMismatchDialog-A5Ss0kuk.js +0 -1
  328. package/dist/chunks/TeleportResumeWrapper-Bz14mUqR.js +0 -1
  329. package/dist/chunks/ThemePicker-CVSRqTzW.js +0 -1
  330. package/dist/chunks/TrustDialog-CY8an_Tg.js +0 -1
  331. package/dist/chunks/TungstenTool-Cb7gJvq4.js +0 -1
  332. package/dist/chunks/TungstenTool-CxMQVCuF.js +0 -1
  333. package/dist/chunks/agents-DJtPfvnL.js +0 -103
  334. package/dist/chunks/allErrors-CQE2k0zO.js +0 -1
  335. package/dist/chunks/analytics-BotDBGh0.js +0 -1
  336. package/dist/chunks/ant-ClQkuQjZ.js +0 -1
  337. package/dist/chunks/api-2cdIPaeq.js +0 -1
  338. package/dist/chunks/api-CG-lhKe-.js +0 -1
  339. package/dist/chunks/asciicast-BsWpcxrc.js +0 -1
  340. package/dist/chunks/assistant-Bje16tQx.js +0 -1
  341. package/dist/chunks/assistant-C83quuNj.js +0 -1
  342. package/dist/chunks/assistant-z2o4-UJe.js +0 -1
  343. package/dist/chunks/auth-DMfEiQrC.js +0 -1
  344. package/dist/chunks/auth-D_cGl8WD.js +0 -1
  345. package/dist/chunks/auth-DqcKPbw8.js +0 -15
  346. package/dist/chunks/backgroundHousekeeping-BpLtI45r.js +0 -1
  347. package/dist/chunks/backgroundHousekeeping-DtJNx4Ja.js +0 -17
  348. package/dist/chunks/bg-B0iMGM9C.js +0 -1
  349. package/dist/chunks/bridge-DNNxtPlz.js +0 -2
  350. package/dist/chunks/bridgeConfig-DP9dD1Cv.js +0 -1
  351. package/dist/chunks/bridgeEnabled-Cc0mGlTb.js +0 -1
  352. package/dist/chunks/bridgeEnabled-D8wP3DWQ.js +0 -1
  353. package/dist/chunks/bridgeMain-CwxMa_pd.js +0 -1
  354. package/dist/chunks/bridgeMain-D11t1BYQ.js +0 -68
  355. package/dist/chunks/bridgeMessaging-DdvApEqW.js +0 -1
  356. package/dist/chunks/bridgePointer-DqHMHa2B.js +0 -1
  357. package/dist/chunks/browser-BmZuQom6.js +0 -1
  358. package/dist/chunks/btw-CejSEdNl.js +0 -1
  359. package/dist/chunks/caches-5HVQSevy.js +0 -3
  360. package/dist/chunks/caches-B-nJoHLM.js +0 -1
  361. package/dist/chunks/capacityWake-CV_x9H8j.js +0 -1
  362. package/dist/chunks/ccrClient-BFyfO67b.js +0 -1
  363. package/dist/chunks/client-DKXCfdde.js +0 -1
  364. package/dist/chunks/client-xxikkAoZ.js +0 -1
  365. package/dist/chunks/commands-CxJpmEKF.js +0 -1
  366. package/dist/chunks/commitAttribution-DM6SBMwl.js +0 -1
  367. package/dist/chunks/commitAttribution-DPnHHKSA.js +0 -2
  368. package/dist/chunks/compact-CblM7306.js +0 -2
  369. package/dist/chunks/completionCache-MN3_MqK8.js +0 -4
  370. package/dist/chunks/completionCache-c4aiyZ_f.js +0 -1
  371. package/dist/chunks/config-BLVBFi5v.js +0 -1
  372. package/dist/chunks/config-CMnqm6Se.js +0 -1
  373. package/dist/chunks/config-DRDuVyzE.js +0 -3
  374. package/dist/chunks/context-CdSMMM-0.js +0 -1
  375. package/dist/chunks/context-noninteractive-CPkf2vB9.js +0 -1
  376. package/dist/chunks/context-noninteractive-DNury4JI.js +0 -54
  377. package/dist/chunks/conversation-DCMw_rsE.js +0 -1
  378. package/dist/chunks/conversation-pUtvc-cE.js +0 -1
  379. package/dist/chunks/createSession-8Ei-Lj7V.js +0 -1
  380. package/dist/chunks/createSession-CjqxVh_Q.js +0 -1
  381. package/dist/chunks/cron-3LntnnhJ.js +0 -1
  382. package/dist/chunks/crossProjectResume-Bj_Pe8oe.js +0 -40
  383. package/dist/chunks/cwd--nvsx73T.js +0 -1
  384. package/dist/chunks/cwd-CYmmnQVS.js +0 -1
  385. package/dist/chunks/debugUtils-NO5KtXqi.js +0 -1
  386. package/dist/chunks/desktop-Z5FAfunZ.js +0 -1
  387. package/dist/chunks/detectRepository-BTPgN89l.js +0 -1
  388. package/dist/chunks/directoryCompletion-CW2ckkQg.js +0 -1
  389. package/dist/chunks/doctor-BA2ZLDTl.js +0 -1
  390. package/dist/chunks/envLessBridgeConfig-B-LKYNvv.js +0 -1
  391. package/dist/chunks/envLessBridgeConfig-DyD9XCda.js +0 -1
  392. package/dist/chunks/esm-5w3xFBnt.js +0 -1
  393. package/dist/chunks/exit-Dt9kHtJO.js +0 -1
  394. package/dist/chunks/extra-usage-C7E2Z1p1.js +0 -1
  395. package/dist/chunks/extra-usage-D0Kkjp-2.js +0 -1
  396. package/dist/chunks/extra-usage-core-DjdaD1qO.js +0 -1
  397. package/dist/chunks/extra-usage-noninteractive-BnD1RhKK.js +0 -1
  398. package/dist/chunks/extraUsage-CpgRTcMk.js +0 -1
  399. package/dist/chunks/extractMemories-DhUprYa7.js +0 -1
  400. package/dist/chunks/fast-C4ZevUNL.js +0 -1
  401. package/dist/chunks/fast-CChxlAAF.js +0 -1
  402. package/dist/chunks/feedback-BIhBhV6n.js +0 -1
  403. package/dist/chunks/file-DcZWPH2V.js +0 -12
  404. package/dist/chunks/fileStateCache-DDW5toIs.js +0 -1
  405. package/dist/chunks/files-Cz1-PK3r.js +0 -2
  406. package/dist/chunks/firstPartyEventLogger-BXY1IJ2D.js +0 -5
  407. package/dist/chunks/firstPartyEventLogger-CnkGSojw.js +0 -1
  408. package/dist/chunks/flushGate-CgHq81Gw.js +0 -1
  409. package/dist/chunks/gemini-C1J-x1g7.js +0 -1
  410. package/dist/chunks/generateRecap-C0jjCg0Z.js +0 -1
  411. package/dist/chunks/generateSessionName-w0BMtwS7.js +0 -1
  412. package/dist/chunks/git-CbcnOf0E.js +0 -1
  413. package/dist/chunks/git-Do0wJvux.js +0 -6
  414. package/dist/chunks/githubRepoPathMapping-8D0kpsif.js +0 -1
  415. package/dist/chunks/grok-ffNyU3Lt.js +0 -1
  416. package/dist/chunks/grove-BQisE2JM.js +0 -7
  417. package/dist/chunks/heapdump-DiCjAPR3.js +0 -5
  418. package/dist/chunks/help-2hn8VK2-.js +0 -1
  419. package/dist/chunks/hooks-CBmrBO-J.js +0 -1
  420. package/dist/chunks/hostGuard-BHI6Q8Mt.js +0 -1
  421. package/dist/chunks/inboundAttachments-C5K3XPTC.js +0 -1
  422. package/dist/chunks/inboundAttachments-IH-g95jo.js +0 -1
  423. package/dist/chunks/index.min-D75yiGLN.js +0 -1
  424. package/dist/chunks/initReplBridge-C-P4dgAG.js +0 -1
  425. package/dist/chunks/keybindings-D8FXoO89.js +0 -2
  426. package/dist/chunks/language-Baosud0X.js +0 -1
  427. package/dist/chunks/launchAgentsPlatform-D6DmNuDt.js +0 -1
  428. package/dist/chunks/launchCommand-1qkTCKpf.js +0 -1
  429. package/dist/chunks/launchLocalMemory-C0FzUq7x.js +0 -3
  430. package/dist/chunks/launchLocalVault-DkYAre4O.js +0 -3
  431. package/dist/chunks/launchMemoryStores-D2rKWAPs.js +0 -1
  432. package/dist/chunks/launchSchedule-IZdFstT_.js +0 -1
  433. package/dist/chunks/launchSkillStore-B7LamM1d.js +0 -1
  434. package/dist/chunks/launchTeleport-C2BQMfYP.js +0 -3
  435. package/dist/chunks/launchVault-C60WUcCI.js +0 -1
  436. package/dist/chunks/loadAgentsDir-B9c3Emvg.js +0 -1
  437. package/dist/chunks/loadPluginHooks-BhNdAjeY.js +0 -1
  438. package/dist/chunks/localSearch-BLCGsdyM.js +0 -1
  439. package/dist/chunks/log-BMCygSzM.js +0 -1
  440. package/dist/chunks/logoV2Utils-gGK9gErT.js +0 -1
  441. package/dist/chunks/managedEnv-BHoeDjpS.js +0 -1
  442. package/dist/chunks/mcp-BSNdwbxR.js +0 -1
  443. package/dist/chunks/mcp-CMnDNI-4.js +0 -6
  444. package/dist/chunks/mcp-D1yA9E56.js +0 -2
  445. package/dist/chunks/memoize-B0zhbT8Z.js +0 -1
  446. package/dist/chunks/memory-D1zbyjxN.js +0 -1
  447. package/dist/chunks/model-CZViyZnE.js +0 -1
  448. package/dist/chunks/model-DLLkVV6S.js +0 -1
  449. package/dist/chunks/nativeInstaller-yj81F75v.js +0 -1
  450. package/dist/chunks/observationStore-DzCdXq8U.js +0 -4
  451. package/dist/chunks/onChangeAppState-DhGKPG9g.js +0 -1
  452. package/dist/chunks/output-style-BM3qAHLA.js +0 -1
  453. package/dist/chunks/overageCreditGrant-Du3dOYVu.js +0 -1
  454. package/dist/chunks/panel-Be-OxtqL.js +0 -1
  455. package/dist/chunks/parser-Bf6iasPV.js +0 -1
  456. package/dist/chunks/partition-C4FWzYVm.js +0 -1
  457. package/dist/chunks/passes-Daz-ARWD.js +0 -1
  458. package/dist/chunks/permissions-CeYKbtSC.js +0 -1
  459. package/dist/chunks/permissions-Cn_6f8CB.js +0 -1
  460. package/dist/chunks/permissions-DF8tAmDF.js +0 -3
  461. package/dist/chunks/plugin-Cm31-nej.js +0 -1
  462. package/dist/chunks/pluginBlocklist-wPFCUPdm.js +0 -1
  463. package/dist/chunks/pluginCliCommands-DhL9LbH0.js +0 -1
  464. package/dist/chunks/pluginFlagging-CAdaFV_D.js +0 -1
  465. package/dist/chunks/pluginOperations-Cs_Z4C6O.js +0 -2
  466. package/dist/chunks/pluginStartupCheck-BRXGKGjG.js +0 -1
  467. package/dist/chunks/pluginStartupCheck-KeU0efTj.js +0 -1
  468. package/dist/chunks/policyLimits-D2s8M8P2.js +0 -1
  469. package/dist/chunks/pollConfig-2nFzv6Hy.js +0 -1
  470. package/dist/chunks/poor-DXumVTR4.js +0 -1
  471. package/dist/chunks/poorMode-yNZL5uYf.js +0 -1
  472. package/dist/chunks/print-uxCF5ka5.js +0 -23
  473. package/dist/chunks/privacy-settings-BncbJCV0.js +0 -1
  474. package/dist/chunks/processBashCommand-CGdwvPmD.js +0 -1
  475. package/dist/chunks/processSlashCommand-DQarepEb.js +0 -5
  476. package/dist/chunks/prompt-BgOdcHkd.js +0 -1
  477. package/dist/chunks/prompt-CE3sFmZV.js +0 -139
  478. package/dist/chunks/prompt-CLJKFebn.js +0 -1
  479. package/dist/chunks/rate-limit-options-C-EqWjeI.js +0 -1
  480. package/dist/chunks/rcDebugLog-DBB9r8aw.js +0 -11
  481. package/dist/chunks/reconciler-CYD_XpG4.js +0 -4
  482. package/dist/chunks/referral-CKmHHxj_.js +0 -1
  483. package/dist/chunks/refresh-ZqZdmLK5.js +0 -1
  484. package/dist/chunks/registerProtocol-wZv2uiW_.js +0 -36
  485. package/dist/chunks/release-notes-B5K7wVqZ.js +0 -4
  486. package/dist/chunks/releaseNotes-B8gbyFFJ.js +0 -2
  487. package/dist/chunks/remote-env-CAt1dHIS.js +0 -1
  488. package/dist/chunks/remoteBridgeCore-Bk3UdSLJ.js +0 -1
  489. package/dist/chunks/remoteManagedSettings-bswzAB6W.js +0 -1
  490. package/dist/chunks/rename-CE_U6KE6.js +0 -1
  491. package/dist/chunks/ripgrep-BfIpz5uC.js +0 -1
  492. package/dist/chunks/runtimeObserver-BrGF5QWX.js +0 -10
  493. package/dist/chunks/sandbox-adapter-BtMiHImm.js +0 -1
  494. package/dist/chunks/sandbox-toggle-D8eebdyI.js +0 -1
  495. package/dist/chunks/sanitization-DV-94a9Z.js +0 -1
  496. package/dist/chunks/searchExtraTools-hLLPuh7c.js +0 -1
  497. package/dist/chunks/semver-BMRJYn3q.js +0 -1
  498. package/dist/chunks/session-BZIlR9Gc.js +0 -2
  499. package/dist/chunks/sessionDiscovery-DfDqTrF1.js +0 -1
  500. package/dist/chunks/sessionFileAccessHooks-Bm8wiqwe.js +0 -1
  501. package/dist/chunks/sessionMemory-D37S0-jX.js +0 -1
  502. package/dist/chunks/sessionMemory-DmlAG3jq.js +0 -1
  503. package/dist/chunks/sessionMemoryUtils-6EWDHSGU.js +0 -1
  504. package/dist/chunks/sessionObserver-BUw2rzKl.js +0 -1
  505. package/dist/chunks/sessionObserver-KgquhGWw.js +0 -20
  506. package/dist/chunks/sessionStorage-CucBSK5Q.js +0 -1
  507. package/dist/chunks/sessionTracing-_Hh5VXxt.js +0 -11
  508. package/dist/chunks/settings-BeLFUeie.js +0 -19
  509. package/dist/chunks/settings-Cl16Haug.js +0 -1
  510. package/dist/chunks/settingsSync-BNvFYH3c.js +0 -1
  511. package/dist/chunks/setup-D8kXv3ts.js +0 -3
  512. package/dist/chunks/sinks-FevoYQqP.js +0 -1
  513. package/dist/chunks/skill-learning-CMdxGtxr.js +0 -5
  514. package/dist/chunks/skillChangeDetector-C65ZLSYV.js +0 -1
  515. package/dist/chunks/skillGapStore-D18LRJAM.js +0 -5
  516. package/dist/chunks/skillGapStore-Ep62R-2_.js +0 -1
  517. package/dist/chunks/skillGenerator-Bc7WwNT8.js +0 -8
  518. package/dist/chunks/skillLearning-Cs9fJgkV.js +0 -1
  519. package/dist/chunks/skillLearning-duPZl69A.js +0 -1
  520. package/dist/chunks/skillPanel-Cyzby746.js +0 -28
  521. package/dist/chunks/slashCommandParsing-RQb_7Xzt.js +0 -1
  522. package/dist/chunks/startupProfiler-DIWVcO4e.js +0 -1
  523. package/dist/chunks/startupProfiler-xa3NmN7Z.js +0 -3
  524. package/dist/chunks/state-BOa-3Av3.js +0 -1
  525. package/dist/chunks/statusNoticeHelpers-CEGvdm5d.js +0 -1
  526. package/dist/chunks/stickers-D5teCKMN.js +0 -1
  527. package/dist/chunks/syncCache-CANQZ9mQ.js +0 -1
  528. package/dist/chunks/systemPromptSections-CR_AoPIX.js +0 -1
  529. package/dist/chunks/systemPromptSections-DN0HGVye.js +0 -1
  530. package/dist/chunks/tag-DDbNqBMu.js +0 -11
  531. package/dist/chunks/teleport-Dk5j03Ix.js +0 -1
  532. package/dist/chunks/terminalSetup-3JNy6i_J.js +0 -33
  533. package/dist/chunks/thinkback-p-vKIRW_.js +0 -1
  534. package/dist/chunks/thinkback-play-DnPTDE8B.js +0 -1
  535. package/dist/chunks/thinkback-rFA1do6F.js +0 -1
  536. package/dist/chunks/toolEventObserver-CzsCuUMc.js +0 -1
  537. package/dist/chunks/toolPool-BR27AMJO.js +0 -1
  538. package/dist/chunks/trustedDevice-BYt39fui.js +0 -1
  539. package/dist/chunks/tui-C2yuCuOU.js +0 -6
  540. package/dist/chunks/types-Bh9S_JG5.js +0 -3
  541. package/dist/chunks/types-DHkZVzJe.js +0 -1
  542. package/dist/chunks/ultrareviewCommand-C_4OSBTW.js +0 -3
  543. package/dist/chunks/undercover-D30rKimg.js +0 -31
  544. package/dist/chunks/undercover-DRSwLozU.js +0 -1
  545. package/dist/chunks/upgrade-Bi-bIz7R.js +0 -1
  546. package/dist/chunks/upgrade-Chs-OQFd.js +0 -1
  547. package/dist/chunks/upload-D8FWMSQx.js +0 -1
  548. package/dist/chunks/usage-BxVeUt60.js +0 -1
  549. package/dist/chunks/usage-DUO7Yy1f.js +0 -1
  550. package/dist/chunks/useExitOnCtrlCDWithKeybindings-BwsZ5f0s.js +0 -1
  551. package/dist/chunks/useMainLoopModel-Gy1Vv4Qr.js +0 -1
  552. package/dist/chunks/useManagePlugins-B11_87VN.js +0 -1
  553. package/dist/chunks/useMergedTools-CR56my9t.js +0 -1
  554. package/dist/chunks/useSettingsErrors-B9vOZL41.js +0 -1
  555. package/dist/chunks/validatePlugin-6q1qmnAC.js +0 -1
  556. package/dist/chunks/windowsPaths-9pEkw0oV.js +0 -1
  557. package/dist/chunks/workerRegistry-CvyHvwx-.js +0 -1
  558. package/dist/chunks/worktree-ogmNCIpz.js +0 -1
@@ -0,0 +1 @@
1
+ import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{n,t as r}from"./figures-5ThXQEtq.js";import{D as i,I as a,P as o,T as s,Wt as c,fi as l,t as u,vn as d,y as f,yn as p}from"./src-CDCSSo0U2.js";import{t as m}from"./jsx-runtime-Bb4Xn-E0.js";import{Bp as h,Jp as g,L as _,Pw as v,R as y,im as b,qp as x,rm as S,z as C,zp as w}from"./loadAgentsDir-ByO8eJqU.js";import{r as T,t as E}from"./directoryCompletion-BagQcynj.js";import{r as D,t as O}from"./PromptInputFooterSuggestions-D1cH9sDX.js";function k(){return(0,P.jsx)(o,{dimColor:!0,children:`Claude Code will be able to read files in this directory and make edits when auto-accept edits is on.`})}function A({path:e}){return(0,P.jsxs)(a,{flexDirection:`column`,paddingX:2,gap:1,children:[(0,P.jsx)(o,{color:`permission`,children:e}),(0,P.jsx)(k,{})]})}function j({value:e,onChange:t,onSubmit:n,error:i,suggestions:s,selectedSuggestion:c}){return(0,P.jsxs)(a,{flexDirection:`column`,children:[(0,P.jsx)(o,{children:`Enter the path to the directory:`}),(0,P.jsx)(a,{borderDimColor:!0,borderStyle:`round`,marginY:1,paddingLeft:1,children:(0,P.jsx)(S,{showCursor:!0,placeholder:`Directory path${r.ellipsis}`,value:e,onChange:t,onSubmit:n,columns:80,cursorOffset:e.length,onChangeCursorOffset:()=>{}})}),s.length>0&&(0,P.jsx)(a,{marginBottom:1,children:(0,P.jsx)(O,{suggestions:s,selectedSuggestion:c})}),i&&(0,P.jsx)(o,{color:`error`,children:i})]})}function M({onAddDirectory:e,onCancel:t,permissionContext:n,directoryPath:r}){let[l,u]=(0,N.useState)(``),[d,m]=(0,N.useState)(null),[h,g]=(0,N.useState)([]),[v,y]=(0,N.useState)(0),b=(0,N.useMemo)(()=>F,[]),S=p((0,N.useCallback)(async e=>{if(!e){g([]),y(0);return}let t=await E(e);g(t),y(0)},[]),100);(0,N.useEffect)(()=>{S(l)},[l,S]);let T=(0,N.useCallback)(e=>{let t=e.id+`/`;u(t),m(null)},[]),D=(0,N.useCallback)(async t=>{let r=await C(t,n);r.resultType===`success`?e(r.absolutePath,!1):m(_(r))},[n,e]);c(`confirm:no`,t,{context:`Settings`});let O=(0,N.useCallback)(e=>{if(h.length>0){if(e.key===`tab`){e.preventDefault();let t=h[v];t&&T(t);return}if(e.key===`return`){e.preventDefault();let t=h[v];t&&D(t.id+`/`);return}if(e.key===`up`||e.ctrl&&e.key===`p`){e.preventDefault(),y(e=>e<=0?h.length-1:e-1);return}if(e.key===`down`||e.ctrl&&e.key===`n`){e.preventDefault(),y(e=>e>=h.length-1?0:e+1);return}}},[h,v,T,D]),M=(0,N.useCallback)(n=>{if(r)switch(n){case`yes-session`:e(r,!1);break;case`yes-remember`:e(r,!0);break;case`no`:t();break}},[r,e,t]);return(0,P.jsx)(a,{flexDirection:`column`,tabIndex:0,autoFocus:!0,onKeyDown:O,children:(0,P.jsx)(f,{title:`Add directory to workspace`,onCancel:t,color:`permission`,isCancelActive:!1,inputGuide:r?void 0:e=>e.pending?(0,P.jsxs)(o,{children:[`Press `,e.keyName,` again to exit`]}):(0,P.jsxs)(s,{children:[(0,P.jsx)(i,{shortcut:`Tab`,action:`complete`}),(0,P.jsx)(i,{shortcut:`Enter`,action:`add`}),(0,P.jsx)(x,{action:`confirm:no`,context:`Settings`,fallback:`Esc`,description:`cancel`})]}),children:r?(0,P.jsxs)(a,{flexDirection:`column`,gap:1,children:[(0,P.jsx)(A,{path:r}),(0,P.jsx)(w,{options:b,onChange:M,onCancel:()=>M(`no`)})]}):(0,P.jsxs)(a,{flexDirection:`column`,gap:1,marginX:2,children:[(0,P.jsx)(k,{}),(0,P.jsx)(j,{value:l,onChange:u,onSubmit:D,error:d,suggestions:h,selectedSuggestion:v})]})})})}var N,P,F,I=e((()=>{n(),l(),N=t(l(),1),d(),y(),b(),u(),v(),T(),g(),h(),D(),P=m(),F=[{value:`yes-session`,label:`Yes, for this session`},{value:`yes-remember`,label:`Yes, and remember this directory`},{value:`no`,label:`No`}]}));export{I as n,M as t};
@@ -0,0 +1 @@
1
+ import"./rolldown-runtime-DaDcL9Zw.js";import{R as e,fi as t,t as n}from"./src-CDCSSo0U2.js";import{t as r}from"./jsx-runtime-Bb4Xn-E0.js";import{_v as i,gv as a}from"./loadAgentsDir-ByO8eJqU.js";import{b as o,c as s,g as c}from"./config-CE058cvr.js";import{n as l}from"./onChangeAppState-BmfM5g-D.js";import{t as u}from"./fpsMetrics-Cf_hdtiJ.js";import{t as d}from"./stats-Duk7_xjQ.js";t(),i(),n(),c();var f=r();function p({getFpsMetrics:t,stats:n,initialState:r,children:i}){return(0,f.jsx)(u,{getFpsMetrics:t,children:(0,f.jsx)(d,{store:n,children:(0,f.jsx)(a,{initialState:r,onChangeAppState:l,children:(0,f.jsx)(e,{initialState:s().theme,onThemeSave:e=>o(t=>({...t,theme:e})),children:i})})})})}export{p as App};
@@ -1 +1 @@
1
- import"./rolldown-runtime-DaDcL9Zw.js";import{P as e,fi as t,t as n,y as r}from"./src-CDCSSo0U2.js";import{t as i}from"./jsx-runtime-Bb4Xn-E0.js";import{ix as a,rx as o}from"./loadAgentsDir-x3rlgED4.js";import{b as s,g as c}from"./config-DRDuVyzE.js";t(),n(),c(),o();var l=i();function u({customApiKeyTruncated:t,onDone:n}){function i(e){switch(e){case`yes`:s(e=>({...e,customApiKeyResponses:{...e.customApiKeyResponses,approved:[...e.customApiKeyResponses?.approved??[],t]}})),n(!0);break;case`no`:s(e=>({...e,customApiKeyResponses:{...e.customApiKeyResponses,rejected:[...e.customApiKeyResponses?.rejected??[],t]}})),n(!1);break}}return(0,l.jsxs)(r,{title:`Detected a custom API key in your environment`,color:`warning`,onCancel:()=>i(`no`),children:[(0,l.jsxs)(e,{children:[(0,l.jsx)(e,{bold:!0,children:`ANTHROPIC_API_KEY`}),(0,l.jsxs)(e,{children:[`: sk-ant-...`,t]})]}),(0,l.jsx)(e,{children:`Do you want to use this API key?`}),(0,l.jsx)(a,{defaultValue:`no`,defaultFocusValue:`no`,options:[{label:`Yes`,value:`yes`},{label:(0,l.jsxs)(e,{children:[`No (`,(0,l.jsx)(e,{bold:!0,children:`recommended`}),`)`]}),value:`no`}],onChange:e=>i(e),onCancel:()=>i(`no`)})]})}export{u as t};
1
+ import"./rolldown-runtime-DaDcL9Zw.js";import{P as e,fi as t,t as n,y as r}from"./src-CDCSSo0U2.js";import{t as i}from"./jsx-runtime-Bb4Xn-E0.js";import{Rp as a,zp as o}from"./loadAgentsDir-ByO8eJqU.js";import{b as s,g as c}from"./config-CE058cvr.js";t(),n(),c(),a();var l=i();function u({customApiKeyTruncated:t,onDone:n}){function i(e){switch(e){case`yes`:s(e=>({...e,customApiKeyResponses:{...e.customApiKeyResponses,approved:[...e.customApiKeyResponses?.approved??[],t]}})),n(!0);break;case`no`:s(e=>({...e,customApiKeyResponses:{...e.customApiKeyResponses,rejected:[...e.customApiKeyResponses?.rejected??[],t]}})),n(!1);break}}return(0,l.jsxs)(r,{title:`Detected a custom API key in your environment`,color:`warning`,onCancel:()=>i(`no`),children:[(0,l.jsxs)(e,{children:[(0,l.jsx)(e,{bold:!0,children:`ANTHROPIC_API_KEY`}),(0,l.jsxs)(e,{children:[`: sk-ant-...`,t]})]}),(0,l.jsx)(e,{children:`Do you want to use this API key?`}),(0,l.jsx)(o,{defaultValue:`no`,defaultFocusValue:`no`,options:[{label:`Yes`,value:`yes`},{label:(0,l.jsxs)(e,{children:[`No (`,(0,l.jsx)(e,{bold:!0,children:`recommended`}),`)`]}),value:`no`}],onChange:e=>i(e),onCancel:()=>i(`no`)})]})}export{u as t};
@@ -0,0 +1 @@
1
+ import{t as e}from"./ApproveApiKey-CEIfuUh0.js";export{e as ApproveApiKey};
@@ -0,0 +1,2 @@
1
+ import{a as e,n as t,o as n,r}from"./rolldown-runtime-DaDcL9Zw.js";import{n as i,t as a}from"./figures-5ThXQEtq.js";import{D as o,Gt as s,H as c,I as l,Lt as u,P as d,T as f,fi as p,mt as m,ot as h,t as g,y as _}from"./src-CDCSSo0U2.js";import{t as v}from"./jsx-runtime-Bb4Xn-E0.js";import{$s as y,Ad as b,An as x,Bp as S,Bu as C,Ff as ee,Fw as te,Gf as w,Hu as T,If as E,Iw as ne,Kp as re,Ld as ie,Lf as D,Mn as ae,Pw as O,Qs as oe,Rd as se,Up as k,Vf as ce,_u as A,_v as le,bv as ue,co as de,eo as fe,fw as pe,gu as me,hl as he,hp as j,hv as ge,hy as _e,jd as ve,ma as ye,ml as be,mp as xe,mv as Se,nf as Ce,pw as we,tc as Te,tf as Ee,vu as De,vv as Oe,vy as ke,xw as Ae,yu as je,za as Me,zp as Ne}from"./loadAgentsDir-ByO8eJqU.js";import{F as Pe,p as Fe,v as Ie,z as Le}from"./debug-RZ4NuXyS.js";import{In as M,Ln as Re,Rn as ze,Ut as Be}from"./settings-hQDLwPVj.js";import{d as Ve,p as He,u as Ue,w as We,x as N,y as P}from"./startupProfiler-DCn_NxMH.js";import{l as F,o as Ge}from"./stringUtils-B6FudhoZ.js";import{bn as Ke,wt as qe,xn as Je,yn as Ye}from"./prompt-B7joRiqj.js";import{i as Xe,n as Ze}from"./mappers-CHRFic5q.js";function I(e,t,n=1e3,r=0,i){let a=()=>Ue(Math.max(0,(i??Date.now())-e-r));return(0,Qe.useSyncExternalStore)((0,Qe.useCallback)(e=>{if(!t)return()=>{};let r=setInterval(e,n);return()=>clearInterval(r)},[t,n]),a,a)}var Qe,L=t((()=>{Qe=n(p(),1),P()}));function $e(e,t,n){let r=Ye(t,e.toolName);if(!r)return e.toolName;try{let t=r.inputSchema.safeParse(e.input),i=t.success?t.data:{},a=r.userFacingName(i);if(!a)return e.toolName;let o=r.renderToolUseMessage(i,{theme:n,verbose:!1});return o?(0,et.jsxs)(d,{children:[a,`(`,o,`)`]}):a}catch{return e.toolName}}var et,tt=t((()=>{p(),g(),Je(),et=v()}));function nt(e,t){let{isIdle:n,awaitingApproval:r,hasError:i,shutdownRequested:o}=t??{};return i?a.cross:r?a.questionMarkPrefix:o?a.warning:e===`running`?n?a.ellipsis:a.play:e===`completed`?a.tick:e===`failed`||e===`killed`?a.cross:a.bullet}function rt(e,t){let{isIdle:n,awaitingApproval:r,hasError:i,shutdownRequested:a}=t??{};return i?`error`:r||a?`warning`:n?`background`:e===`completed`?`success`:e===`failed`?`error`:e===`killed`?`warning`:`background`}function it(e,t){if(!t)return!1;let n=!1;for(let t of Object.values(e))if(!(!j(t)||process.env.USER_TYPE===`ant`&&Te(t)))return n=!0,!1;return n}var at=t((()=>{i(),y(),xe()}));function ot({agent:e,onDone:t,onKillAgent:n,onBack:r}){let[i]=c(),a=(0,st.useMemo)(()=>be(Ke()),[]),u=I(e.startTime,e.status===`running`,1e3,e.totalPausedMs??0);s({"confirm:yes":t},{context:`Confirmation`});let p=i=>{i.key===` `?(i.preventDefault(),t()):i.key===`left`&&r?(i.preventDefault(),r()):i.key===`x`&&e.status===`running`&&n&&(i.preventDefault(),n())},m=Me(e.prompt,`plan`),h=e.prompt.length>300?e.prompt.substring(0,297)+`…`:e.prompt,g=e.result?.totalTokens??e.progress?.tokenCount,v=e.result?.totalToolUseCount??e.progress?.toolUseCount;return(0,R.jsx)(l,{flexDirection:`column`,tabIndex:0,autoFocus:!0,onKeyDown:p,children:(0,R.jsx)(_,{title:(0,R.jsxs)(d,{children:[e.selectedAgent?.agentType??`agent`,` › `,e.description||`Async agent`]}),subtitle:(0,R.jsxs)(d,{children:[e.status!==`running`&&(0,R.jsxs)(d,{color:rt(e.status),children:[nt(e.status),` `,e.status===`completed`?`Completed`:e.status===`failed`?`Failed`:`Stopped`,` · `]}),(0,R.jsxs)(d,{dimColor:!0,children:[u,g!==void 0&&g>0&&(0,R.jsxs)(R.Fragment,{children:[` · `,He(g),` tokens`]}),v!==void 0&&v>0&&(0,R.jsxs)(R.Fragment,{children:[` `,`· `,v,` `,v===1?`tool`:`tools`]})]})]}),onCancel:t,color:`background`,inputGuide:t=>t.pending?(0,R.jsxs)(d,{children:[`Press `,t.keyName,` again to exit`]}):(0,R.jsxs)(f,{children:[r&&(0,R.jsx)(o,{shortcut:`←`,action:`go back`}),(0,R.jsx)(o,{shortcut:`Esc/Enter/Space`,action:`close`}),e.status===`running`&&n&&(0,R.jsx)(o,{shortcut:`x`,action:`stop`})]}),children:(0,R.jsxs)(l,{flexDirection:`column`,children:[e.status===`running`&&e.progress?.recentActivities&&e.progress.recentActivities.length>0&&(0,R.jsxs)(l,{flexDirection:`column`,children:[(0,R.jsx)(d,{bold:!0,dimColor:!0,children:`Progress`}),e.progress.recentActivities.map((t,n)=>(0,R.jsxs)(d,{dimColor:n<e.progress.recentActivities.length-1,wrap:`truncate-end`,children:[n===e.progress.recentActivities.length-1?`› `:` `,$e(t,a,i)]},n))]}),m?(0,R.jsx)(l,{marginTop:1,children:(0,R.jsx)(ie,{addMargin:!1,planContent:m})}):(0,R.jsxs)(l,{flexDirection:`column`,marginTop:1,children:[(0,R.jsx)(d,{bold:!0,dimColor:!0,children:`Prompt`}),(0,R.jsx)(d,{wrap:`wrap`,children:h})]}),e.status===`failed`&&e.error&&(0,R.jsxs)(l,{flexDirection:`column`,marginTop:1,children:[(0,R.jsx)(d,{bold:!0,color:`error`,children:`Error`}),(0,R.jsx)(d,{color:`error`,wrap:`wrap`,children:e.error})]})]})})})}var st,R,ct=t((()=>{st=n(p(),1),L(),g(),O(),Je(),he(),P(),fe(),se(),tt(),at(),R=v()}));function lt(e,t,n,r){if(!e)return`${t} found · ${n} verified`;if(e===`synthesizing`){let e=[`${n} verified`];return r>0&&e.push(`${r} refuted`),e.push(`deduping`),e.join(` · `)}if(e===`verifying`){let e=[`${t} found`,`${n} verified`];return r>0&&e.push(`${r} refuted`),e.join(` · `)}return t>0?`${t} found`:`finding`}function ut({text:e,phase:t=0}){return(0,z.jsx)(z.Fragment,{children:[...e].map((e,n)=>(0,z.jsx)(d,{color:b(n+t),children:e},n))})}function dt(e,t,n){let r=(0,mt.useRef)(e),i=(0,mt.useRef)(t);return n||e<r.current?r.current=e:e>r.current&&t!==i.current&&(r.current+=1,i.current=t),r.current}function ft({session:e}){let t=ge().prefersReducedMotion??!1,n=e.reviewProgress,r=e.status===`running`,[,i]=m(r&&!t?ht:null),a=n?.bugsFound??0,o=n?.bugsVerified??0,s=n?.bugsRefuted??0,c=t||!r,l=dt(a,i,c),u=dt(o,i,c),f=dt(s,i,c),p=Math.floor(i/(ht*3))%7;if(e.status===`completed`)return(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(d,{color:`background`,children:[`◆`,` `]}),(0,z.jsx)(ut,{text:`ultrareview`,phase:0}),(0,z.jsx)(d,{dimColor:!0,children:` ready · shift+↓ to view`})]});if(e.status===`failed`)return(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(d,{color:`background`,children:[`◆`,` `]}),(0,z.jsx)(ut,{text:`ultrareview`,phase:0}),(0,z.jsxs)(d,{color:`error`,dimColor:!0,children:[` · `,`error`]})]});let h=n?lt(n.stage,l,u,f):`setting up`;return(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(d,{color:`background`,children:[`◇`,` `]}),(0,z.jsx)(ut,{text:`ultrareview`,phase:r?p:0}),(0,z.jsxs)(d,{dimColor:!0,children:[` · `,h]})]})}function pt({session:e}){if(e.isRemoteReview)return(0,z.jsx)(ft,{session:e});if(e.status===`completed`)return(0,z.jsx)(d,{bold:!0,color:`success`,dimColor:!0,children:`done`});if(e.status===`failed`)return(0,z.jsx)(d,{bold:!0,color:`error`,dimColor:!0,children:`error`});if(!e.todoList.length)return(0,z.jsxs)(d,{dimColor:!0,children:[e.status,`…`]});let t=M(e.todoList,e=>e.status===`completed`),n=e.todoList.length;return(0,z.jsxs)(d,{dimColor:!0,children:[t,`/`,n]})}var mt,z,ht,gt=t((()=>{mt=n(p(),1),Be(),Se(),g(),Re(),ve(),z=v(),ht=80}));function B({status:e,label:t,suffix:n}){return(0,V.jsxs)(d,{color:e===`completed`?`success`:e===`failed`?`error`:e===`killed`?`warning`:void 0,dimColor:!0,children:[`(`,t??e,n,`)`]})}function _t({shell:e}){switch(e.status){case`completed`:return(0,V.jsx)(B,{status:`completed`,label:`done`});case`failed`:return(0,V.jsx)(B,{status:`failed`,label:`error`});case`killed`:return(0,V.jsx)(B,{status:`killed`,label:`stopped`});case`running`:case`pending`:return(0,V.jsx)(B,{status:`running`})}}var V,vt=t((()=>{g(),V=v()}));function yt({task:e,maxActivityWidth:t}){let n=t??40;switch(e.type){case`local_bash`:return(0,H.jsxs)(d,{children:[N(e.kind===`monitor`?e.description:e.command,n,!0),` `,(0,H.jsx)(_t,{shell:e})]});case`remote_agent`:return e.isRemoteReview?(0,H.jsx)(d,{children:(0,H.jsx)(pt,{session:e})}):(0,H.jsxs)(d,{children:[(0,H.jsxs)(d,{dimColor:!0,children:[e.status===`running`||e.status===`pending`?`◇`:`◆`,` `]}),N(e.title,n,!0),(0,H.jsx)(d,{dimColor:!0,children:` · `}),(0,H.jsx)(pt,{session:e})]});case`local_agent`:return(0,H.jsxs)(d,{children:[N(e.description,n,!0),` `,(0,H.jsx)(B,{status:e.status,label:e.status===`completed`?`done`:void 0,suffix:e.status===`completed`&&!e.notified?`, unread`:void 0})]});case`local_workflow`:{let t=e;return(0,H.jsxs)(d,{children:[N(t.workflowName??e.summary??e.description,n,!0),` `,(0,H.jsx)(B,{status:e.status,label:e.status===`running`?`${t.agentCount} ${F(t.agentCount,`agent`)}`:e.status===`completed`?`done`:void 0,suffix:e.status===`completed`&&!e.notified?`, unread`:void 0})]})}case`monitor_mcp`:return(0,H.jsxs)(d,{children:[N(e.description,n,!0),` `,(0,H.jsx)(B,{status:e.status,label:e.status===`completed`?`done`:void 0,suffix:e.status===`completed`&&!e.notified?`, unread`:void 0})]});case`dream`:{let t=e.filesTouched.length,n=e.phase===`updating`&&t>0?`${t} ${F(t,`file`)}`:`${e.sessionsReviewing} ${F(e.sessionsReviewing,`session`)}`;return(0,H.jsxs)(d,{children:[e.description,` `,(0,H.jsxs)(d,{dimColor:!0,children:[`· `,e.phase,` · `,n]}),` `,(0,H.jsx)(B,{status:e.status,label:e.status===`completed`?`done`:void 0,suffix:e.status===`completed`&&!e.notified?`, unread`:void 0})]})}}}var H,bt=t((()=>{p(),g(),P(),Ge(),Be(),gt(),vt(),H=v()}));function xt({task:e,onDone:t,onBack:n,onKill:r}){let i=I(e.startTime,e.status===`running`,1e3,0);s({"confirm:yes":t},{context:`Confirmation`});let a=i=>{i.key===` `?(i.preventDefault(),t()):i.key===`left`&&n?(i.preventDefault(),n()):i.key===`x`&&e.status===`running`&&r&&(i.preventDefault(),r())},c=e.turns.filter(e=>e.text!==``),u=c.slice(-6),p=c.length-u.length;return(0,U.jsx)(l,{flexDirection:`column`,tabIndex:0,autoFocus:!0,onKeyDown:a,children:(0,U.jsx)(_,{title:`Memory consolidation`,subtitle:(0,U.jsxs)(d,{dimColor:!0,children:[i,` · reviewing `,e.sessionsReviewing,` `,F(e.sessionsReviewing,`session`),e.filesTouched.length>0&&(0,U.jsxs)(U.Fragment,{children:[` `,`· `,e.filesTouched.length,` `,F(e.filesTouched.length,`file`),` touched`]})]}),onCancel:t,color:`background`,inputGuide:t=>t.pending?(0,U.jsxs)(d,{children:[`Press `,t.keyName,` again to exit`]}):(0,U.jsxs)(f,{children:[n&&(0,U.jsx)(o,{shortcut:`←`,action:`go back`}),(0,U.jsx)(o,{shortcut:`Esc/Enter/Space`,action:`close`}),e.status===`running`&&r&&(0,U.jsx)(o,{shortcut:`x`,action:`stop`})]}),children:(0,U.jsxs)(l,{flexDirection:`column`,gap:1,children:[(0,U.jsxs)(d,{children:[(0,U.jsx)(d,{bold:!0,children:`Status:`}),` `,e.status===`running`?(0,U.jsx)(d,{color:`background`,children:`running`}):e.status===`completed`?(0,U.jsx)(d,{color:`success`,children:e.status}):(0,U.jsx)(d,{color:`error`,children:e.status})]}),u.length===0?(0,U.jsx)(d,{dimColor:!0,children:e.status===`running`?`Starting…`:`(no text output)`}):(0,U.jsxs)(U.Fragment,{children:[p>0&&(0,U.jsxs)(d,{dimColor:!0,children:[`(`,p,` earlier `,F(p,`turn`),`)`]}),u.map((e,t)=>(0,U.jsxs)(l,{flexDirection:`column`,children:[(0,U.jsx)(d,{wrap:`wrap`,children:e.text}),e.toolUseCount>0&&(0,U.jsxs)(d,{dimColor:!0,children:[` `,`(`,e.toolUseCount,` `,F(e.toolUseCount,`tool`),`)`]})]},t))]})]})})})}var U,St=t((()=>{p(),L(),g(),O(),Ge(),U=v()}));function Ct({stage:e,completed:t,hasProgress:n}){let r=e?Dt.indexOf(e):-1,i=!t&&!n;return(0,G.jsxs)(d,{children:[i?(0,G.jsx)(d,{color:`background`,children:`Setup`}):(0,G.jsx)(d,{dimColor:!0,children:`Setup`}),(0,G.jsx)(d,{dimColor:!0,children:` → `}),Dt.map((e,n)=>{let a=!t&&!i&&n===r;return(0,G.jsxs)(W.Fragment,{children:[n>0&&(0,G.jsx)(d,{dimColor:!0,children:` → `}),a?(0,G.jsx)(d,{color:`background`,children:Ot[e]}):(0,G.jsx)(d,{dimColor:!0,children:Ot[e]})]},e)}),t&&(0,G.jsx)(d,{color:`success`,children:` ✓`})]})}function wt(e){let t=e.reviewProgress;if(!t)return e.status===`completed`?`done`:`setting up`;let n=t.bugsVerified,r=t.bugsRefuted??0;if(e.status===`completed`){let e=[`${n} ${F(n,`finding`)}`];return r>0&&e.push(`${r} refuted`),e.join(` · `)}return lt(t.stage,t.bugsFound,n,r)}function Tt({session:e,onDone:t,onBack:n,onKill:r}){let i=e.status===`completed`,a=e.status===`running`||e.status===`pending`,[s,c]=(0,W.useState)(!1),p=I(e.startTime,a,1e3,0,e.endTime),m=()=>t(`Remote session details dismissed`,{display:`system`}),h=n??m,g=E(e.sessionId),v=i?`ready`:a?`running`:e.status;if(s)return(0,G.jsx)(_,{title:`Stop ultrareview?`,onCancel:()=>c(!1),color:`background`,children:(0,G.jsxs)(l,{flexDirection:`column`,gap:1,children:[(0,G.jsx)(d,{dimColor:!0,children:`This archives the remote session and stops local tracking. The review will not complete and any findings so far are discarded.`}),(0,G.jsx)(Ne,{options:[{label:`Stop ultrareview`,value:`stop`},{label:`Back`,value:`back`}],onChange:e=>{e===`stop`?(r?.(),h()):c(!1)}})]})});let y=i?[{label:`Open in Claude Code on the web`,value:`open`},{label:`Dismiss`,value:`dismiss`}]:[{label:`Open in Claude Code on the web`,value:`open`},...r&&a?[{label:`Stop ultrareview`,value:`stop`}]:[],{label:`Back`,value:`back`}];return(0,G.jsx)(_,{title:(0,G.jsxs)(d,{children:[(0,G.jsxs)(d,{color:`background`,children:[i?`◆`:`◇`,` `]}),(0,G.jsx)(d,{bold:!0,children:`ultrareview`}),(0,G.jsxs)(d,{dimColor:!0,children:[` · `,p,` · `,v]})]}),onCancel:h,color:`background`,inputGuide:e=>e.pending?(0,G.jsxs)(d,{children:[`Press `,e.keyName,` again to exit`]}):(0,G.jsxs)(f,{children:[(0,G.jsx)(o,{shortcut:`Enter`,action:`select`}),(0,G.jsx)(o,{shortcut:`Esc`,action:`go back`})]}),children:(0,G.jsxs)(l,{flexDirection:`column`,gap:1,children:[(0,G.jsx)(Ct,{stage:e.reviewProgress?.stage,completed:i,hasProgress:!!e.reviewProgress}),(0,G.jsxs)(l,{flexDirection:`column`,children:[(0,G.jsx)(d,{children:wt(e)}),(0,G.jsx)(u,{url:g,children:(0,G.jsx)(d,{dimColor:!0,children:g})})]}),(0,G.jsx)(Ne,{options:y,onChange:e=>{switch(e){case`open`:we(g),t();break;case`stop`:c(!0);break;case`back`:h();break;case`dismiss`:m();break}}})]})})}function Et({session:e,toolUseContext:t,onDone:n,onBack:r,onKill:i}){let[a,s]=(0,W.useState)(!1),[c,p]=(0,W.useState)(null),m=(0,W.useMemo)(()=>e.isRemoteReview?[]:de(Xe(e.log)).filter(e=>e.type!==`progress`).slice(-3),[e]);if(e.isRemoteReview)return(0,G.jsx)(Tt,{session:e,onDone:n,onBack:r,onKill:i});let h=()=>n(`Remote session details dismissed`,{display:`system`}),g=e=>{e.key===` `?(e.preventDefault(),n(`Remote session details dismissed`,{display:`system`})):e.key===`left`&&r?(e.preventDefault(),r()):e.key===`t`&&!a?(e.preventDefault(),v()):e.key===`return`&&(e.preventDefault(),h())};async function v(){s(!0),p(null);try{await w(e.sessionId)}catch(e){p(Pe(e))}finally{s(!1)}}let y=We(e.title,50),b=e.status===`pending`?`starting`:e.status;return(0,G.jsx)(l,{flexDirection:`column`,tabIndex:0,autoFocus:!0,onKeyDown:g,children:(0,G.jsxs)(_,{title:`Remote session details`,onCancel:h,color:`background`,inputGuide:e=>e.pending?(0,G.jsxs)(d,{children:[`Press `,e.keyName,` again to exit`]}):(0,G.jsxs)(f,{children:[r&&(0,G.jsx)(o,{shortcut:`←`,action:`go back`}),(0,G.jsx)(o,{shortcut:`Esc/Enter/Space`,action:`close`}),!a&&(0,G.jsx)(o,{shortcut:`t`,action:`teleport`})]}),children:[(0,G.jsxs)(l,{flexDirection:`column`,children:[(0,G.jsxs)(d,{children:[(0,G.jsx)(d,{bold:!0,children:`Status`}),`:`,` `,b===`running`||b===`starting`?(0,G.jsx)(d,{color:`background`,children:b}):b===`completed`?(0,G.jsx)(d,{color:`success`,children:b}):(0,G.jsx)(d,{color:`error`,children:b})]}),(0,G.jsxs)(d,{children:[(0,G.jsx)(d,{bold:!0,children:`Runtime`}),`: `,Ue((e.endTime??Date.now())-e.startTime)]}),(0,G.jsxs)(d,{wrap:`truncate-end`,children:[(0,G.jsx)(d,{bold:!0,children:`Title`}),`: `,y]}),(0,G.jsxs)(d,{children:[(0,G.jsx)(d,{bold:!0,children:`Progress`}),`: `,(0,G.jsx)(pt,{session:e})]}),(0,G.jsxs)(d,{children:[(0,G.jsx)(d,{bold:!0,children:`Session URL`}),`:`,` `,(0,G.jsx)(u,{url:E(e.sessionId),children:(0,G.jsx)(d,{dimColor:!0,children:E(e.sessionId)})})]})]}),e.log.length>0&&(0,G.jsxs)(l,{flexDirection:`column`,marginTop:1,children:[(0,G.jsxs)(d,{children:[(0,G.jsx)(d,{bold:!0,children:`Recent messages`}),`:`]}),(0,G.jsx)(l,{flexDirection:`column`,height:10,overflowY:`hidden`,children:m.map((e,n)=>(0,G.jsx)(C,{message:e,lookups:ye,addMargin:n>0,tools:t.options.tools,commands:t.options.commands,verbose:t.options.verbose,inProgressToolUseIDs:new Set,progressMessagesForMessage:[],shouldAnimate:!1,shouldShowDot:!1,style:`condensed`,isTranscriptMode:!1,isStatic:!0},n))}),(0,G.jsx)(l,{marginTop:1,children:(0,G.jsxs)(d,{dimColor:!0,italic:!0,children:[`Showing last `,m.length,` of `,e.log.length,` messages`]})})]}),c&&(0,G.jsx)(l,{marginTop:1,children:(0,G.jsxs)(d,{color:`error`,children:[`Teleport failed: `,c]})}),a&&(0,G.jsx)(d,{color:`background`,children:`Teleporting to session…`})]})})}var W,G,Dt,Ot,kt=t((()=>{W=n(p(),1),Be(),L(),g(),D(),qe(),pe(),Le(),P(),Ze(),fe(),Ge(),ce(),S(),T(),gt(),G=v(),Dt=[`finding`,`verifying`,`synthesizing`],Ot={finding:`Find`,verifying:`Verify`,synthesizing:`Dedupe`}}));async function At(e){let t=x(e.id);try{let e=await Ie(t,Nt);return{content:e.content,bytesTotal:e.bytesTotal}}catch{return{content:``,bytesTotal:0}}}function jt({shell:e,onDone:t,onKillShell:n,onBack:r}){let{columns:i}=h(),[a,c]=(0,K.useState)(()=>At(e)),u=(0,K.useDeferredValue)(a);(0,K.useEffect)(()=>{if(e.status!==`running`)return;let t=setInterval((e,t)=>e(At(t)),1e3,c,e);return()=>clearInterval(t)},[e.id,e.status]);let p=()=>t(`Shell details dismissed`,{display:`system`});s({"confirm:yes":p},{context:`Confirmation`});let m=i=>{i.key===` `?(i.preventDefault(),t(`Shell details dismissed`,{display:`system`})):i.key===`left`&&r?(i.preventDefault(),r()):i.key===`x`&&e.status===`running`&&n&&(i.preventDefault(),n())},g=e.kind===`monitor`,v=We(e.command,280);return(0,q.jsx)(l,{flexDirection:`column`,tabIndex:0,autoFocus:!0,onKeyDown:m,children:(0,q.jsxs)(_,{title:g?`Monitor details`:`Shell details`,onCancel:p,color:`background`,inputGuide:t=>t.pending?(0,q.jsxs)(d,{children:[`Press `,t.keyName,` again to exit`]}):(0,q.jsxs)(f,{children:[r&&(0,q.jsx)(o,{shortcut:`←`,action:`go back`}),(0,q.jsx)(o,{shortcut:`Esc/Enter/Space`,action:`close`}),e.status===`running`&&n&&(0,q.jsx)(o,{shortcut:`x`,action:`stop`})]}),children:[(0,q.jsxs)(l,{flexDirection:`column`,children:[(0,q.jsxs)(d,{children:[(0,q.jsx)(d,{bold:!0,children:`Status:`}),` `,e.status===`running`?(0,q.jsxs)(d,{color:`background`,children:[e.status,e.result?.code!==void 0&&` (exit code: ${e.result.code})`]}):e.status===`completed`?(0,q.jsxs)(d,{color:`success`,children:[e.status,e.result?.code!==void 0&&` (exit code: ${e.result.code})`]}):(0,q.jsxs)(d,{color:`error`,children:[e.status,e.result?.code!==void 0&&` (exit code: ${e.result.code})`]})]}),(0,q.jsxs)(d,{children:[(0,q.jsx)(d,{bold:!0,children:`Runtime:`}),` `,Ue((e.endTime??Date.now())-e.startTime)]}),(0,q.jsxs)(d,{wrap:`wrap`,children:[(0,q.jsx)(d,{bold:!0,children:g?`Script:`:`Command:`}),` `,v]})]}),(0,q.jsxs)(l,{flexDirection:`column`,children:[(0,q.jsx)(d,{bold:!0,children:`Output:`}),(0,q.jsx)(K.Suspense,{fallback:(0,q.jsx)(d,{dimColor:!0,children:`Loading output…`}),children:(0,q.jsx)(Mt,{outputPromise:u,columns:i})})]})]})})}function Mt({outputPromise:e,columns:t}){let{content:n,bytesTotal:r}=(0,K.use)(e);if(!n)return(0,q.jsx)(d,{dimColor:!0,children:`No output available`});let i=[],a=n.length;for(let e=0;e<10&&a>0;e++){let e=n.lastIndexOf(`
2
+ `,a-1);i.push(e+1),a=e}i.reverse();let o=r>n.length,s=[];for(let e=0;e<i.length;e++){let t=i[e],r=e<i.length-1?i[e+1]-1:n.length,a=n.slice(t,r);a&&s.push(a)}return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(l,{borderStyle:`round`,paddingX:1,flexDirection:`column`,height:12,maxWidth:t-6,children:s.map((e,t)=>(0,q.jsx)(d,{wrap:`truncate-end`,children:e},t))}),(0,q.jsxs)(d,{dimColor:!0,italic:!0,children:[`Showing ${s.length} lines`,o?` of ${Ve(r)}`:``]})]})}var K,q,Nt,Pt=t((()=>{K=n(p(),1),Ae(),g(),O(),P(),Fe(),ae(),q=v(),Nt=8192})),Ft=t((()=>{g()})),It=t((()=>{g()})),Lt=t((()=>{g()})),Rt=r({MonitorMcpDetailDialog:()=>zt});function zt({task:e,onBack:t,onKill:n}){let r=I(e.startTime,e.status===`running`,1e3,0);return s({},{context:`MonitorMcpDetail`}),(0,J.jsx)(l,{flexDirection:`column`,tabIndex:0,borderStyle:`round`,onKeyDown:r=>{r.key===`left`&&t?(r.preventDefault(),t()):r.key===`x`&&e.status===`running`&&n&&(r.preventDefault(),n())},children:(0,J.jsx)(_,{title:`MCP Monitor`,subtitle:(0,J.jsxs)(d,{dimColor:!0,children:[r,` · `,e.serverName,`:`,e.resourceUri]}),onCancel:t??(()=>{}),inputGuide:()=>(0,J.jsxs)(f,{children:[t&&(0,J.jsx)(o,{shortcut:`←`,action:`go back`}),(0,J.jsx)(o,{shortcut:`Esc`,action:`close`}),e.status===`running`&&n&&(0,J.jsx)(o,{shortcut:`x`,action:`stop`})]}),children:(0,J.jsxs)(l,{flexDirection:`column`,gap:1,children:[(0,J.jsxs)(d,{children:[(0,J.jsx)(d,{bold:!0,children:`Status:`}),` `,e.status===`running`?(0,J.jsx)(d,{color:`ansi:green`,children:`running`}):e.status===`completed`?(0,J.jsx)(d,{color:`ansi:green`,children:e.status}):(0,J.jsx)(d,{color:`ansi:red`,children:e.status})]}),(0,J.jsxs)(d,{children:[(0,J.jsx)(d,{bold:!0,children:`Description:`}),` `,e.description]}),(0,J.jsxs)(d,{children:[(0,J.jsx)(d,{bold:!0,children:`Server:`}),` `,e.serverName]}),(0,J.jsxs)(d,{children:[(0,J.jsx)(d,{bold:!0,children:`Resource:`}),` `,e.resourceUri]}),e.command&&(0,J.jsxs)(d,{children:[(0,J.jsx)(d,{bold:!0,children:`Command:`}),` `,e.command]})]})})})}var J,Bt=t((()=>{p(),L(),g(),O(),Ft(),It(),Lt(),J=v()}));function Vt(e,t){return Object.values(e??{}).filter(j).filter(e=>!(e.type===`local_agent`&&e.id===t))}function Ht({onDone:e,toolUseContext:t,initialDetailTaskId:n}){let r=Oe(e=>e.tasks),i=Oe(e=>e.foregroundedTaskId),a=ue(),c=ne(`chat:killAgents`,`Chat`,`ctrl+x ctrl+k`),u=r,p=(0,X.useRef)(!1),[m,h]=(0,X.useState)(()=>{if(n)return p.current=!0,{mode:`detail`,itemId:n};let e=Vt(u,i);return e.length===1?(p.current=!0,{mode:`detail`,itemId:e[0].id}):{mode:`list`}}),[g,v]=(0,X.useState)(0);re(`background-tasks-dialog`);let{bashTasks:y,remoteSessions:b,agentTasks:x,workflowTasks:S,mcpMonitors:C,dreamTasks:te,allSelectableItems:w}=(0,X.useMemo)(()=>{let e=Object.values(u??{}).filter(j).map(Ut).sort((e,t)=>{let n=e.status,r=t.status;if(n===`running`&&r!==`running`)return-1;if(n!==`running`&&r===`running`)return 1;let i=`task`in e?e.task.startTime:0;return(`task`in t?t.task.startTime:0)-i}),t=e.filter(e=>e.type===`local_bash`),n=e.filter(e=>e.type===`remote_agent`),r=e.filter(e=>e.type===`local_agent`&&e.id!==i),a=e.filter(e=>e.type===`local_workflow`),o=e.filter(e=>e.type===`monitor_mcp`),s=e.filter(e=>e.type===`dream`);return{bashTasks:t,remoteSessions:n,agentTasks:r,workflowTasks:a,mcpMonitors:o,dreamTasks:s,allSelectableItems:[...t,...o,...n,...r,...a,...s]}},[u,i]),T=w[g]??null;s({"confirm:previous":()=>v(e=>Math.max(0,e-1)),"confirm:next":()=>v(e=>Math.min(w.length-1,e+1)),"confirm:yes":()=>{let e=w[g];e&&h({mode:`detail`,itemId:e.id})}},{context:`Confirmation`,isActive:m.mode===`list`});let E=t=>{if(m.mode!==`list`)return;if(t.key===`left`){t.preventDefault(),e(`Background tasks dialog dismissed`,{display:`system`});return}let n=w[g];n&&t.key===`x`&&(t.preventDefault(),n.type===`local_bash`&&n.status===`running`?ie(n.id):n.type===`local_agent`&&n.status===`running`?D(n.id):n.type===`local_workflow`&&n.status===`running`&&Q?Q(n.id,a):n.type===`monitor_mcp`&&n.status===`running`&&$?$(n.id,a):n.type===`dream`&&n.status===`running`?ae(n.id):n.type===`remote_agent`&&n.status===`running`&&O(n.id))};async function ie(e){await _e.kill(e,a)}async function D(e){await oe.kill(e,a)}async function ae(e){await De.kill(e,a)}async function O(e){await ee.kill(e,a)}let se=(0,X.useEffectEvent)(e);(0,X.useEffect)(()=>{if(m.mode!==`list`){let e=(u??{})[m.itemId];(!e||e.type!==`local_workflow`&&!j(e))&&(p.current?se(`Background tasks dialog dismissed`,{display:`system`}):h({mode:`list`}))}let e=w.length;g>=e&&e>0&&v(e-1)},[m,u,g,w,se]);let k=()=>{p.current&&w.length<=1?e(`Background tasks dialog dismissed`,{display:`system`}):(p.current=!1,h({mode:`list`}))};if(m.mode!==`list`&&u){let n=u[m.itemId];if(!n)return null;switch(n.type){case`local_bash`:return(0,Z.jsx)(jt,{shell:n,onDone:e,onKillShell:()=>void ie(n.id),onBack:k},`shell-${n.id}`);case`local_agent`:return(0,Z.jsx)(ot,{agent:n,onDone:e,onKillAgent:()=>void D(n.id),onBack:k},`agent-${n.id}`);case`remote_agent`:return(0,Z.jsx)(Et,{session:n,onDone:e,toolUseContext:t,onBack:k,onKill:n.status===`running`?()=>void O(n.id):void 0},`session-${n.id}`);case`local_workflow`:{let e=n.status===`running`&&Q?()=>Q(n.id,a):void 0;return(0,Z.jsx)(l,{flexDirection:`column`,tabIndex:0,borderStyle:`round`,onKeyDown:t=>{t.key===`left`?(t.preventDefault(),k()):t.key===`x`&&e&&(t.preventDefault(),e())},children:(0,Z.jsx)(_,{title:n.workflowName,subtitle:(0,Z.jsxs)(d,{dimColor:!0,children:[n.status,n.summary?` · ${n.summary}`:``]}),onCancel:k,inputGuide:()=>(0,Z.jsxs)(f,{children:[(0,Z.jsx)(o,{shortcut:`←`,action:`go back`}),(0,Z.jsx)(o,{shortcut:`Esc`,action:`close`}),e&&(0,Z.jsx)(o,{shortcut:`x`,action:`stop`})]}),children:n.status===`failed`&&n.error?(0,Z.jsxs)(l,{flexDirection:`column`,children:[(0,Z.jsxs)(d,{color:`error`,children:[`失败原因:`,n.error]}),(0,Z.jsx)(d,{color:`subtle`,children:`用 /workflows 查看阶段与 agent 实时进度`})]}):(0,Z.jsx)(d,{color:`subtle`,children:`用 /workflows 查看阶段与 agent 实时进度`})})},`workflow-${n.id}`)}case`monitor_mcp`:return Wt?(0,Z.jsx)(Wt,{task:n,onKill:n.status===`running`&&$?()=>$(n.id,a):void 0,onBack:k},`monitor-mcp-${n.id}`):null;case`dream`:return(0,Z.jsx)(xt,{task:n,onDone:()=>e(`Background tasks dialog dismissed`,{display:`system`}),onBack:k,onKill:n.status===`running`?()=>void ae(n.id):void 0},`dream-${n.id}`)}}let ce=M(y,e=>e.status===`running`),A=M(b,e=>e.status===`running`||e.status===`pending`)+M(x,e=>e.status===`running`),le=ze([...ce>0?[(0,Z.jsxs)(d,{children:[ce,` `,ce===1?`active shell`:`active shells`]},`shells`)]:[],...A>0?[(0,Z.jsxs)(d,{children:[A,` `,A===1?`active agent`:`active agents`]},`agents`)]:[]],e=>(0,Z.jsx)(d,{children:` · `},`separator-${e}`)),de=[(0,Z.jsx)(o,{shortcut:`↑/↓`,action:`select`},`upDown`),(0,Z.jsx)(o,{shortcut:`Enter`,action:`view`},`enter`),...(T?.type===`local_bash`||T?.type===`local_agent`||T?.type===`local_workflow`||T?.type===`monitor_mcp`||T?.type===`dream`||T?.type===`remote_agent`)&&T.status===`running`?[(0,Z.jsx)(o,{shortcut:`x`,action:`stop`},`kill`)]:[],...x.some(e=>e.status===`running`)?[(0,Z.jsx)(o,{shortcut:c,action:`stop all agents`},`kill-all`)]:[],(0,Z.jsx)(o,{shortcut:`←/Esc`,action:`close`},`esc`)],fe=()=>e(`Background tasks dialog dismissed`,{display:`system`});function pe(e){return e.pending?(0,Z.jsxs)(d,{children:[`Press `,e.keyName,` again to exit`]}):(0,Z.jsx)(f,{children:de})}return(0,Z.jsx)(l,{flexDirection:`column`,tabIndex:0,autoFocus:!0,onKeyDown:E,children:(0,Z.jsx)(_,{title:`Background tasks`,subtitle:(0,Z.jsx)(Z.Fragment,{children:le}),onCancel:fe,color:`background`,inputGuide:pe,children:w.length===0?(0,Z.jsx)(d,{dimColor:!0,children:`No tasks currently running`}):(0,Z.jsxs)(l,{flexDirection:`column`,children:[y.length>0&&(0,Z.jsxs)(l,{flexDirection:`column`,children:[(b.length>0||x.length>0)&&(0,Z.jsxs)(d,{dimColor:!0,children:[(0,Z.jsxs)(d,{bold:!0,children:[` `,`Shells`]}),` (`,y.length,`)`]}),(0,Z.jsx)(l,{flexDirection:`column`,children:y.map(e=>(0,Z.jsx)(Y,{item:e,isSelected:e.id===T?.id},e.id))})]}),C.length>0&&(0,Z.jsxs)(l,{flexDirection:`column`,marginTop:+(y.length>0),children:[(0,Z.jsxs)(d,{dimColor:!0,children:[(0,Z.jsxs)(d,{bold:!0,children:[` `,`Monitors`]}),` (`,C.length,`)`]}),(0,Z.jsx)(l,{flexDirection:`column`,children:C.map(e=>(0,Z.jsx)(Y,{item:e,isSelected:e.id===T?.id},e.id))})]}),b.length>0&&(0,Z.jsxs)(l,{flexDirection:`column`,marginTop:+(y.length>0||C.length>0),children:[(0,Z.jsxs)(d,{dimColor:!0,children:[(0,Z.jsxs)(d,{bold:!0,children:[` `,`Remote agents`]}),` (`,b.length,`)`]}),(0,Z.jsx)(l,{flexDirection:`column`,children:b.map(e=>(0,Z.jsx)(Y,{item:e,isSelected:e.id===T?.id},e.id))})]}),x.length>0&&(0,Z.jsxs)(l,{flexDirection:`column`,marginTop:+(y.length>0||C.length>0||b.length>0),children:[(0,Z.jsxs)(d,{dimColor:!0,children:[(0,Z.jsxs)(d,{bold:!0,children:[` `,`Local agents`]}),` (`,x.length,`)`]}),(0,Z.jsx)(l,{flexDirection:`column`,children:x.map(e=>(0,Z.jsx)(Y,{item:e,isSelected:e.id===T?.id},e.id))})]}),S.length>0&&(0,Z.jsxs)(l,{flexDirection:`column`,marginTop:+(y.length>0||C.length>0||b.length>0||x.length>0),children:[(0,Z.jsxs)(d,{dimColor:!0,children:[(0,Z.jsxs)(d,{bold:!0,children:[` `,`Workflows`]}),` (`,S.length,`)`]}),(0,Z.jsx)(l,{flexDirection:`column`,children:S.map(e=>(0,Z.jsx)(Y,{item:e,isSelected:e.id===T?.id},e.id))})]}),te.length>0&&(0,Z.jsx)(l,{flexDirection:`column`,marginTop:+(y.length>0||C.length>0||b.length>0||x.length>0||S.length>0),children:(0,Z.jsx)(l,{flexDirection:`column`,children:te.map(e=>(0,Z.jsx)(Y,{item:e,isSelected:e.id===T?.id},e.id))})})]})})})}function Ut(e){switch(e.type){case`local_bash`:return{id:e.id,type:`local_bash`,label:e.kind===`monitor`?e.description:e.command,status:e.status,task:e};case`remote_agent`:return{id:e.id,type:`remote_agent`,label:e.title,status:e.status,task:e};case`local_agent`:return{id:e.id,type:`local_agent`,label:e.description,status:e.status,task:e};case`local_workflow`:return{id:e.id,type:`local_workflow`,label:e.summary??e.description,status:e.status,task:e};case`monitor_mcp`:return{id:e.id,type:`monitor_mcp`,label:e.description,status:e.status,task:e};case`dream`:return{id:e.id,type:`dream`,label:e.description,status:e.status,task:e}}}function Y({item:e,isSelected:t}){let{columns:n}=h(),r=Math.max(30,n-26);return(0,Z.jsxs)(l,{flexDirection:`row`,children:[(0,Z.jsx)(d,{children:t?a.pointer+` `:` `}),(0,Z.jsx)(d,{color:t?`suggestion`:void 0,children:(0,Z.jsx)(yt,{task:e.task,maxActivityWidth:r})})]})}var X,Z,Q,$,Wt,Gt=t((()=>{i(),X=n(p(),1),Ae(),le(),je(),y(),ke(),D(),xe(),Re(),k(),g(),O(),te(),ct(),bt(),St(),kt(),Pt(),Z=v(),Q=(A(),e(me))?.killWorkflowTask??null,$=(Ce(),e(Ee))?.killMonitorMcp??null,Wt=(Bt(),e(Rt)).MonitorMcpDetailDialog}));export{L as a,it as i,Gt as n,I as o,at as r,Ht as t};
@@ -1 +1 @@
1
- import{o as e}from"./rolldown-runtime-DaDcL9Zw.js";import{I as t,Lt as n,P as r,fi as i,kt as a,t as o,y as s}from"./src-CDCSSo0U2.js";import{t as c}from"./jsx-runtime-Bb4Xn-E0.js";import{$S as l,QS as u,ix as d,rx as f}from"./loadAgentsDir-x3rlgED4.js";import{g as p,x as m}from"./settings-BeLFUeie.js";import{n as h,r as g}from"./analytics-BotDBGh0.js";var _=e(i(),1);h(),o(),l(),p(),f();var v=c();function y({onAccept:e}){let[i,o]=_.useState(null);_.useEffect(()=>{if(i!==null){let e=i,t=setTimeout(()=>u(e));return()=>clearTimeout(t)}},[i]),_.useEffect(()=>{g(`tengu_bypass_permissions_mode_dialog_shown`,{})},[]);function c(t){switch(t){case`accept`:g(`tengu_bypass_permissions_mode_dialog_accept`,{}),m(`userSettings`,{skipDangerousModePermissionPrompt:!0}),e();break;case`decline`:o(1);break}}let l=(0,_.useCallback)(()=>{o(0)},[]);return i===null?(0,v.jsxs)(s,{title:`WARNING: Claude Code running in Bypass Permissions mode`,color:`error`,onCancel:l,children:[(0,v.jsxs)(t,{flexDirection:`column`,gap:1,children:[(0,v.jsxs)(r,{children:[`In Bypass Permissions mode, Claude Code will not ask for your approval before running potentially dangerous commands.`,(0,v.jsx)(a,{}),`This mode should only be used in a sandboxed container/VM that has restricted internet access and can easily be restored if damaged.`]}),(0,v.jsx)(r,{children:`By proceeding, you accept all responsibility for actions taken while running in Bypass Permissions mode.`}),(0,v.jsx)(n,{url:`https://code.claude.com/docs/en/security`})]}),(0,v.jsx)(d,{options:[{label:`No, exit`,value:`decline`},{label:`Yes, I accept`,value:`accept`}],onChange:e=>c(e)})]}):null}export{y as BypassPermissionsModeDialog};
1
+ import{o as e}from"./rolldown-runtime-DaDcL9Zw.js";import{I as t,Lt as n,P as r,fi as i,kt as a,t as o,y as s}from"./src-CDCSSo0U2.js";import{t as c}from"./jsx-runtime-Bb4Xn-E0.js";import{Jm as l,Rp as u,qm as d,zp as f}from"./loadAgentsDir-ByO8eJqU.js";import{g as p,x as m}from"./settings-hQDLwPVj.js";import{n as h,r as g}from"./analytics-CkYUHW_U.js";var _=e(i(),1);h(),o(),l(),p(),u();var v=c();function y({onAccept:e}){let[i,o]=_.useState(null);_.useEffect(()=>{if(i!==null){let e=i,t=setTimeout(()=>d(e));return()=>clearTimeout(t)}},[i]),_.useEffect(()=>{g(`tengu_bypass_permissions_mode_dialog_shown`,{})},[]);function c(t){switch(t){case`accept`:g(`tengu_bypass_permissions_mode_dialog_accept`,{}),m(`userSettings`,{skipDangerousModePermissionPrompt:!0}),e();break;case`decline`:o(1);break}}let l=(0,_.useCallback)(()=>{o(0)},[]);return i===null?(0,v.jsxs)(s,{title:`WARNING: Claude Code running in Bypass Permissions mode`,color:`error`,onCancel:l,children:[(0,v.jsxs)(t,{flexDirection:`column`,gap:1,children:[(0,v.jsxs)(r,{children:[`In Bypass Permissions mode, Claude Code will not ask for your approval before running potentially dangerous commands.`,(0,v.jsx)(a,{}),`This mode should only be used in a sandboxed container/VM that has restricted internet access and can easily be restored if damaged.`]}),(0,v.jsx)(r,{children:`By proceeding, you accept all responsibility for actions taken while running in Bypass Permissions mode.`}),(0,v.jsx)(n,{url:`https://code.claude.com/docs/en/security`})]}),(0,v.jsx)(f,{options:[{label:`No, exit`,value:`decline`},{label:`Yes, I accept`,value:`accept`}],onChange:e=>c(e)})]}):null}export{y as BypassPermissionsModeDialog};
@@ -1 +1 @@
1
- import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{I as n,Lt as r,P as i,fi as a,t as o,y as s}from"./src-CDCSSo0U2.js";import{t as c}from"./jsx-runtime-Bb4Xn-E0.js";import{ix as l,rx as u}from"./loadAgentsDir-x3rlgED4.js";import{g as d,y as f}from"./config-DRDuVyzE.js";import{n as p,r as m}from"./analytics-BotDBGh0.js";function h({onDone:e,isStandaloneDialog:t,externalIncludes:a}){g.useEffect(()=>{m(`tengu_claude_md_includes_dialog_shown`,{})},[]);let o=(0,g.useCallback)(t=>{t===`no`?(m(`tengu_claude_md_external_includes_dialog_declined`,{}),f(e=>({...e,hasClaudeMdExternalIncludesApproved:!1,hasClaudeMdExternalIncludesWarningShown:!0}))):(m(`tengu_claude_md_external_includes_dialog_accepted`,{}),f(e=>({...e,hasClaudeMdExternalIncludesApproved:!0,hasClaudeMdExternalIncludesWarningShown:!0}))),e()},[e]);return(0,_.jsxs)(s,{title:`Allow external CLAUDE.md file imports?`,color:`warning`,onCancel:(0,g.useCallback)(()=>{o(`no`)},[o]),hideBorder:!t,hideInputGuide:!t,children:[(0,_.jsx)(i,{children:`This project's CLAUDE.md imports files outside the current working directory. Never allow this for third-party repositories.`}),a&&a.length>0&&(0,_.jsxs)(n,{flexDirection:`column`,children:[(0,_.jsx)(i,{dimColor:!0,children:`External imports:`}),a.map((e,t)=>(0,_.jsxs)(i,{dimColor:!0,children:[` `,e.path]},t))]}),(0,_.jsxs)(i,{dimColor:!0,children:[`Important: Only use Claude Code with files you trust. Accessing untrusted files may pose security risks`,` `,(0,_.jsx)(r,{url:`https://code.claude.com/docs/en/security`}),` `]}),(0,_.jsx)(l,{options:[{label:`Yes, allow external imports`,value:`yes`},{label:`No, disable external imports`,value:`no`}],onChange:e=>o(e)})]})}var g,_,v=e((()=>{g=t(a(),1),p(),o(),d(),u(),_=c()}));export{v as n,h as t};
1
+ import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{I as n,Lt as r,P as i,fi as a,t as o,y as s}from"./src-CDCSSo0U2.js";import{t as c}from"./jsx-runtime-Bb4Xn-E0.js";import{Rp as l,zp as u}from"./loadAgentsDir-ByO8eJqU.js";import{g as d,y as f}from"./config-CE058cvr.js";import{n as p,r as m}from"./analytics-CkYUHW_U.js";function h({onDone:e,isStandaloneDialog:t,externalIncludes:a}){g.useEffect(()=>{m(`tengu_claude_md_includes_dialog_shown`,{})},[]);let o=(0,g.useCallback)(t=>{t===`no`?(m(`tengu_claude_md_external_includes_dialog_declined`,{}),f(e=>({...e,hasClaudeMdExternalIncludesApproved:!1,hasClaudeMdExternalIncludesWarningShown:!0}))):(m(`tengu_claude_md_external_includes_dialog_accepted`,{}),f(e=>({...e,hasClaudeMdExternalIncludesApproved:!0,hasClaudeMdExternalIncludesWarningShown:!0}))),e()},[e]);return(0,_.jsxs)(s,{title:`Allow external CLAUDE.md file imports?`,color:`warning`,onCancel:(0,g.useCallback)(()=>{o(`no`)},[o]),hideBorder:!t,hideInputGuide:!t,children:[(0,_.jsx)(i,{children:`This project's CLAUDE.md imports files outside the current working directory. Never allow this for third-party repositories.`}),a&&a.length>0&&(0,_.jsxs)(n,{flexDirection:`column`,children:[(0,_.jsx)(i,{dimColor:!0,children:`External imports:`}),a.map((e,t)=>(0,_.jsxs)(i,{dimColor:!0,children:[` `,e.path]},t))]}),(0,_.jsxs)(i,{dimColor:!0,children:[`Important: Only use Claude Code with files you trust. Accessing untrusted files may pose security risks`,` `,(0,_.jsx)(r,{url:`https://code.claude.com/docs/en/security`}),` `]}),(0,_.jsx)(u,{options:[{label:`Yes, allow external imports`,value:`yes`},{label:`No, disable external imports`,value:`no`}],onChange:e=>o(e)})]})}var g,_,v=e((()=>{g=t(a(),1),p(),o(),d(),l(),_=c()}));export{v as n,h as t};
@@ -0,0 +1 @@
1
+ import{n as e,t}from"./ClaudeMdExternalIncludesDialog-C-CTa-95.js";e();export{t as ClaudeMdExternalIncludesDialog};
@@ -0,0 +1 @@
1
+ import{nm as e,tm as t}from"./loadAgentsDir-ByO8eJqU.js";e();export{t as ConsoleOAuthFlow};
@@ -1,6 +1,6 @@
1
- import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{n,t as r}from"./figures-5ThXQEtq.js";import{C as i,Gt as a,I as o,P as s,T as c,fi as l,ot as u,t as d,y as f}from"./src-CDCSSo0U2.js";import{t as p}from"./jsx-runtime-Bb4Xn-E0.js";import{Rf as m,XS as h,cx as g,dx as ee,hx as te,mx as _,zf as v}from"./loadAgentsDir-x3rlgED4.js";import{n as y,t as b}from"./cwd-CYmmnQVS.js";import{_ as x,d as S,g as C,s as w}from"./git-Do0wJvux.js";import{r as T,t as E}from"./execFileNoThrow-D244NytW.js";import{f as D,y as O}from"./file-DcZWPH2V.js";import{b as k,w as ne}from"./startupProfiler-xa3NmN7Z.js";import{l as A,o as j}from"./stringUtils-DGLPkqJ4.js";import{i as re}from"./detectRepository-BPr0VWNO.js";import{u as ie}from"./referral-CKmHHxj_.js";import{join as ae,resolve as oe}from"path";import{access as M}from"fs/promises";async function se(){if(!await S()||await P())return null;let{stdout:e,code:t}=await E(C(),[`--no-optional-locks`,`diff`,`HEAD`,`--shortstat`],{timeout:F,preserveOutputOnError:!1});if(t===0){let t=de(e);if(t&&t.filesCount>z)return{stats:t,perFileStats:new Map,hunks:new Map}}let{stdout:n,code:r}=await E(C(),[`--no-optional-locks`,`diff`,`HEAD`,`--numstat`],{timeout:F,preserveOutputOnError:!1});if(r!==0)return null;let{stats:i,perFileStats:a}=le(n),o=I-a.size;if(o>0){let e=await ue(o);if(e){i.filesCount+=e.size;for(let[t,n]of e)a.set(t,n)}}return{stats:i,perFileStats:a,hunks:new Map}}async function ce(){if(!await S()||await P())return new Map;let{stdout:e,code:t}=await E(C(),[`--no-optional-locks`,`diff`,`HEAD`],{timeout:F,preserveOutputOnError:!1});return t===0?N(e):new Map}function le(e){let t=e.trim().split(`
2
- `).filter(Boolean),n=0,r=0,i=0,a=new Map;for(let e of t){let t=e.split(` `);if(t.length<3)continue;i++;let o=t[0],s=t[1],c=t.slice(2).join(` `),l=o===`-`||s===`-`,u=l?0:parseInt(o??`0`,10)||0,d=l?0:parseInt(s??`0`,10)||0;n+=u,r+=d,a.size<I&&a.set(c,{added:u,removed:d,isBinary:l})}return{stats:{filesCount:i,linesAdded:n,linesRemoved:r},perFileStats:a}}function N(e){let t=new Map;if(!e.trim())return t;let n=e.split(/^diff --git /m).filter(Boolean);for(let e of n){if(t.size>=I)break;if(e.length>L)continue;let n=e.split(`
3
- `),r=n[0]?.match(/^a\/(.+?) b\/(.+)$/);if(!r)continue;let i=r[2]??r[1]??``,a=[],o=null,s=0;for(let e=1;e<n.length;e++){let t=n[e]??``,r=t.match(/^@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/);if(r){o&&a.push(o),o={oldStart:parseInt(r[1]??`0`,10),oldLines:parseInt(r[2]??`1`,10),newStart:parseInt(r[3]??`0`,10),newLines:parseInt(r[4]??`1`,10),lines:[]};continue}if(!(t.startsWith(`index `)||t.startsWith(`---`)||t.startsWith(`+++`)||t.startsWith(`new file`)||t.startsWith(`deleted file`)||t.startsWith(`old mode`)||t.startsWith(`new mode`)||t.startsWith(`Binary files`))&&o&&(t.startsWith(`+`)||t.startsWith(`-`)||t.startsWith(` `)||t===``)){if(s>=R)continue;o.lines.push(``+t),s++}}o&&a.push(o),a.length>0&&t.set(i,a)}return t}async function P(){let e=await w(b());return e?(await Promise.all([`MERGE_HEAD`,`REBASE_HEAD`,`CHERRY_PICK_HEAD`,`REVERT_HEAD`].map(t=>M(ae(e,t)).then(()=>!0).catch(()=>!1)))).some(Boolean):!1}async function ue(e){let{stdout:t,code:n}=await E(C(),[`--no-optional-locks`,`ls-files`,`--others`,`--exclude-standard`],{timeout:F,preserveOutputOnError:!1});if(n!==0||!t.trim())return null;let r=t.trim().split(`
4
- `).filter(Boolean);if(r.length===0)return null;let i=new Map;for(let t of r.slice(0,e))i.set(t,{added:0,removed:0,isBinary:!1,isUntracked:!0});return i}function de(e){let t=e.match(/(\d+)\s+files?\s+changed(?:,\s+(\d+)\s+insertions?\(\+\))?(?:,\s+(\d+)\s+deletions?\(-\))?/);return t?{filesCount:parseInt(t[1]??`0`,10),linesAdded:parseInt(t[2]??`0`,10),linesRemoved:parseInt(t[3]??`0`,10)}:null}var F,I,L,R,z,B=e((()=>{y(),re(),T(),D(),x(),F=5e3,I=50,L=1e6,R=400,z=500}));function V(){let[e,t]=(0,H.useState)(null),[n,r]=(0,H.useState)(new Map),[i,a]=(0,H.useState)(!0);return(0,H.useEffect)(()=>{let e=!1;async function n(){try{let[n,i]=await Promise.all([se(),ce()]);e||(t(n),r(i),a(!1))}catch{e||(t(null),r(new Map),a(!1))}}return n(),()=>{e=!0}},[]),(0,H.useMemo)(()=>{if(!e)return{stats:null,files:[],hunks:new Map,loading:i};let{stats:t,perFileStats:r}=e,a=[];for(let[e,t]of r){let r=n.get(e),i=t.isUntracked??!1,o=!t.isBinary&&!i&&!r,s=t.added+t.removed,c=!o&&!t.isBinary&&s>U;a.push({path:e,linesAdded:t.added,linesRemoved:t.removed,isBinary:t.isBinary,isLargeFile:o,isTruncated:c,isUntracked:i})}return a.sort((e,t)=>e.path.localeCompare(t.path)),{stats:t,files:a,hunks:n,loading:!1}},[e,n,i])}var H,U,fe=e((()=>{H=t(l(),1),B(),U=400}));function pe(e){if(!e||typeof e!=`object`)return!1;let t=e,n=typeof t.filePath==`string`,r=Array.isArray(t.structuredPatch)&&t.structuredPatch.length>0,i=t.type===`create`&&typeof t.content==`string`;return n&&(r||i)}function W(e){return`type`in e&&(e.type===`create`||e.type===`update`)}function me(e){let t=0,n=0;for(let r of e)for(let e of r.lines)e.startsWith(`+`)?t++:e.startsWith(`-`)&&n++;return{added:t,removed:n}}function he(e){if(e.type!==`user`)return``;let t=e.message.content,n=typeof t==`string`?t:``;return n.length<=30?n:n.slice(0,29)+`…`}function G(e){let t=0,n=0;for(let r of e.files.values())t+=r.linesAdded,n+=r.linesRemoved;e.stats={filesChanged:e.files.size,linesAdded:t,linesRemoved:n}}function ge(e){let t=(0,K.useRef)({completedTurns:[],currentTurn:null,lastProcessedIndex:0,lastTurnIndex:0});return(0,K.useMemo)(()=>{let n=t.current;e.length<n.lastProcessedIndex&&(n.completedTurns=[],n.currentTurn=null,n.lastProcessedIndex=0,n.lastTurnIndex=0);for(let t=n.lastProcessedIndex;t<e.length;t++){let r=e[t];if(!(!r||r.type!==`user`)){if(!(r.toolUseResult||Array.isArray(r.message.content)&&r.message.content[0]?.type===`tool_result`)&&!r.isMeta)n.currentTurn&&n.currentTurn.files.size>0&&(G(n.currentTurn),n.completedTurns.push(n.currentTurn)),n.lastTurnIndex++,n.currentTurn={turnIndex:n.lastTurnIndex,userPromptPreview:he(r),timestamp:r.timestamp,files:new Map,stats:{filesChanged:0,linesAdded:0,linesRemoved:0}};else if(n.currentTurn&&r.toolUseResult){let e=r.toolUseResult;if(pe(e)){let{filePath:t,structuredPatch:r}=e,i=`type`in e&&e.type===`create`,a=n.currentTurn.files.get(t);if(a||(a={filePath:t,hunks:[],isNewFile:i,linesAdded:0,linesRemoved:0},n.currentTurn.files.set(t,a)),i&&r.length===0&&W(e)){let t=e.content.split(`
5
- `),n={oldStart:0,oldLines:0,newStart:1,newLines:t.length,lines:t.map(e=>`+`+e)};a.hunks.push(n),a.linesAdded+=t.length}else{a.hunks.push(...r);let{added:e,removed:t}=me(r);a.linesAdded+=e,a.linesRemoved+=t}i&&(a.isNewFile=!0)}}}}n.lastProcessedIndex=e.length;let r=[...n.completedTurns];return n.currentTurn&&n.currentTurn.files.size>0&&(G(n.currentTurn),r.push(n.currentTurn)),r.reverse()},[e])}var K,_e=e((()=>{K=t(l(),1)}));function ve({filePath:e,hunks:t,isLargeFile:n,isBinary:r,isTruncated:a,isUntracked:c}){let{columns:l}=u(),{firstLine:d,fileContent:f}=(0,q.useMemo)(()=>{if(!e)return{firstLine:null,fileContent:void 0};let t=O(oe(b(),e));return{firstLine:t?.split(`
6
- `)[0]??null,fileContent:t??void 0}},[e]);return c?(0,J.jsxs)(o,{flexDirection:`column`,width:`100%`,children:[(0,J.jsxs)(o,{children:[(0,J.jsx)(s,{bold:!0,children:e}),(0,J.jsx)(s,{dimColor:!0,children:` (untracked)`})]}),(0,J.jsx)(i,{padding:4}),(0,J.jsxs)(o,{flexDirection:`column`,children:[(0,J.jsx)(s,{dimColor:!0,italic:!0,children:`New file not yet staged.`}),(0,J.jsxs)(s,{dimColor:!0,italic:!0,children:["Run `git add ",e,"` to see line counts."]})]})]}):r?(0,J.jsxs)(o,{flexDirection:`column`,width:`100%`,children:[(0,J.jsx)(o,{children:(0,J.jsx)(s,{bold:!0,children:e})}),(0,J.jsx)(i,{padding:4}),(0,J.jsx)(o,{flexDirection:`column`,children:(0,J.jsx)(s,{dimColor:!0,italic:!0,children:`Binary file - cannot display diff`})})]}):n?(0,J.jsxs)(o,{flexDirection:`column`,width:`100%`,children:[(0,J.jsx)(o,{children:(0,J.jsx)(s,{bold:!0,children:e})}),(0,J.jsx)(i,{padding:4}),(0,J.jsx)(o,{flexDirection:`column`,children:(0,J.jsx)(s,{dimColor:!0,italic:!0,children:`Large file - diff exceeds 1 MB limit`})})]}):(0,J.jsxs)(o,{flexDirection:`column`,width:`100%`,children:[(0,J.jsxs)(o,{children:[(0,J.jsx)(s,{bold:!0,children:e}),a&&(0,J.jsx)(s,{dimColor:!0,children:` (truncated)`})]}),(0,J.jsx)(i,{padding:4}),(0,J.jsx)(o,{flexDirection:`column`,children:t.length===0?(0,J.jsx)(s,{dimColor:!0,children:`No diff content`}):t.map((t,n)=>(0,J.jsx)(m,{patch:t,filePath:e,firstLine:d,fileContent:f,dim:!1,width:l-2-2},n))}),a&&(0,J.jsx)(s,{dimColor:!0,italic:!0,children:`… diff truncated (exceeded 400 line limit)`})]})}var q,J,ye=e((()=>{q=t(l(),1),h(),d(),y(),D(),v(),J=p()}));function be({files:e,selectedIndex:t}){let{columns:n}=u(),{startIndex:r,endIndex:i}=(0,Y.useMemo)(()=>{if(e.length===0||e.length<=Z)return{startIndex:0,endIndex:e.length};let n=Math.max(0,t-Math.floor(Z/2)),r=n+Z;return r>e.length&&(r=e.length,n=Math.max(0,r-Z)),{startIndex:n,endIndex:r}},[e.length,t]);if(e.length===0)return(0,X.jsx)(s,{dimColor:!0,children:`No changed files`});let a=e.slice(r,i),c=r>0,l=i<e.length,d=e.length>Z,f=Math.max(20,n-16-3-4);return(0,X.jsxs)(o,{flexDirection:`column`,children:[d&&(0,X.jsx)(s,{dimColor:!0,children:c?` ↑ ${r} more ${A(r,`file`)}`:` `}),a.map((e,n)=>(0,X.jsx)(xe,{file:e,isSelected:r+n===t,maxPathWidth:f},e.path)),d&&(0,X.jsx)(s,{dimColor:!0,children:l?` ↓ ${e.length-i} more ${A(e.length-i,`file`)}`:` `})]})}function xe({file:e,isSelected:t,maxPathWidth:n}){let i=ne(e.path,n),a=`${t?r.pointer+` `:` `}${i}`;return(0,X.jsxs)(o,{flexDirection:`row`,children:[(0,X.jsx)(s,{bold:t,color:t?`background`:void 0,inverse:t,children:a}),(0,X.jsx)(o,{flexGrow:1}),(0,X.jsx)(Se,{file:e,isSelected:t})]})}function Se({file:e,isSelected:t}){return e.isUntracked?(0,X.jsx)(s,{dimColor:!t,italic:!0,children:`untracked`}):e.isBinary?(0,X.jsx)(s,{dimColor:!t,italic:!0,children:`Binary file`}):e.isLargeFile?(0,X.jsx)(s,{dimColor:!t,italic:!0,children:`Large file modified`}):(0,X.jsxs)(s,{children:[e.linesAdded>0&&(0,X.jsxs)(s,{color:`diffAddedWord`,bold:t,children:[`+`,e.linesAdded]}),e.linesAdded>0&&e.linesRemoved>0&&` `,e.linesRemoved>0&&(0,X.jsxs)(s,{color:`diffRemovedWord`,bold:t,children:[`-`,e.linesRemoved]}),e.isTruncated&&(0,X.jsx)(s,{dimColor:!t,children:` (truncated)`})]})}var Y,X,Z,Ce=e((()=>{n(),Y=t(l(),1),h(),d(),k(),j(),X=p(),Z=5}));function we(e){let t=Array.from(e.files.values()).map(e=>({path:e.filePath,linesAdded:e.linesAdded,linesRemoved:e.linesRemoved,isBinary:!1,isLargeFile:!1,isTruncated:!1,isNewFile:e.isNewFile})).sort((e,t)=>e.path.localeCompare(t.path)),n=new Map;for(let t of e.files.values())n.set(t.filePath,t.hunks);return{stats:{filesCount:e.stats.filesChanged,linesAdded:e.stats.linesAdded,linesRemoved:e.stats.linesRemoved},files:t,hunks:n,loading:!1}}function Te({messages:e,onDone:t}){let n=V(),r=ge(e),[i,l]=(0,Q.useState)(`list`),[u,d]=(0,Q.useState)(0),[p,m]=(0,Q.useState)(0),h=(0,Q.useMemo)(()=>[{type:`current`},...r.map(e=>({type:`turn`,turn:e}))],[r]),g=h[p],_=g?.type===`turn`?g.turn:null,v=(0,Q.useMemo)(()=>_?we(_):n,[_,n]),y=v.files[u],b=(0,Q.useMemo)(()=>y&&v.hunks.get(y.path)||[],[y,v.hunks]);(0,Q.useEffect)(()=>{p>=h.length&&m(Math.max(0,h.length-1))},[h.length,p]);let x=(0,Q.useRef)(p);(0,Q.useEffect)(()=>{x.current!==p&&(d(0),x.current=p)},[p]),ee(`diff-dialog`),a({"diff:previousSource":()=>{i===`detail`?l(`list`):i===`list`&&h.length>1&&m(e=>Math.max(0,e-1))},"diff:nextSource":()=>{i===`list`&&h.length>1&&m(e=>Math.min(h.length-1,e+1))},"diff:back":()=>{i===`detail`&&l(`list`)},"diff:viewDetails":()=>{i===`list`&&y&&l(`detail`)},"diff:previousFile":()=>{i===`list`&&d(e=>Math.max(0,e-1))},"diff:nextFile":()=>{i===`list`&&d(e=>Math.min(v.files.length-1,e+1))}},{context:`DiffDialog`});let S=v.stats?(0,$.jsxs)(s,{dimColor:!0,children:[v.stats.filesCount,` `,A(v.stats.filesCount,`file`),` changed`,v.stats.linesAdded>0&&(0,$.jsxs)(s,{color:`diffAddedWord`,children:[` +`,v.stats.linesAdded]}),v.stats.linesRemoved>0&&(0,$.jsxs)(s,{color:`diffRemovedWord`,children:[` -`,v.stats.linesRemoved]})]}):null,C=_?`Turn ${_.turnIndex}`:`Uncommitted changes`,w=_?_.userPromptPreview?`"${_.userPromptPreview}"`:``:`(git diff HEAD)`,T=h.length>1?(0,$.jsxs)(o,{children:[p>0&&(0,$.jsx)(s,{dimColor:!0,children:`◀ `}),h.map((e,t)=>{let n=t===p,r=e.type===`current`?`Current`:`T${e.turn.turnIndex}`;return(0,$.jsxs)(s,{dimColor:!n,bold:n,children:[t>0?` · `:``,r]},t)}),p<h.length-1&&(0,$.jsx)(s,{dimColor:!0,children:` ▶`})]}):null,E=te(`diff:dismiss`,`DiffDialog`,`esc`),D=v.loading?`Loading diff…`:_?`No file changes in this turn`:v.stats&&v.stats.filesCount>0&&v.files.length===0?`Too many files to display details`:`Working tree is clean`,O=(0,$.jsxs)(s,{children:[C,w&&(0,$.jsxs)(s,{dimColor:!0,children:[` `,w]})]});function k(){i===`detail`?l(`list`):t(`Diff dialog dismissed`,{display:`system`})}return(0,$.jsxs)(f,{title:O,onCancel:k,color:`background`,inputGuide:e=>e.pending?(0,$.jsxs)(s,{children:[`Press `,e.keyName,` again to exit`]}):i===`list`?(0,$.jsxs)(c,{children:[h.length>1&&(0,$.jsx)(s,{children:`←/→ source`}),(0,$.jsx)(s,{children:`↑/↓ select`}),(0,$.jsx)(s,{children:`Enter view`}),(0,$.jsxs)(s,{children:[E,` close`]})]}):(0,$.jsxs)(c,{children:[(0,$.jsx)(s,{children:`← back`}),(0,$.jsxs)(s,{children:[E,` close`]})]}),children:[T,S,v.files.length===0?(0,$.jsx)(o,{marginTop:1,children:(0,$.jsx)(s,{dimColor:!0,children:D})}):i===`list`?(0,$.jsx)(o,{flexDirection:`column`,marginTop:1,children:(0,$.jsx)(be,{files:v.files,selectedIndex:u})}):(0,$.jsx)(o,{flexDirection:`column`,marginTop:1,children:(0,$.jsx)(ve,{filePath:y?.path||``,hunks:b,isLargeFile:y?.isLargeFile,isBinary:y?.isBinary,isTruncated:y?.isTruncated,isUntracked:y?.isUntracked})})]})}var Q,$;e((()=>{Q=t(l(),1),g(),fe(),_e(),d(),ie(),_(),j(),ye(),Ce(),$=p()}))();export{Te as DiffDialog};
1
+ import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{n,t as r}from"./figures-5ThXQEtq.js";import{C as i,Gt as a,I as o,P as s,T as c,fi as l,ot as u,t as d,y as f}from"./src-CDCSSo0U2.js";import{t as p}from"./jsx-runtime-Bb4Xn-E0.js";import{Fw as m,Iw as ee,Kp as te,Pw as h,Up as g,ev as _,tv as v,xw as y}from"./loadAgentsDir-ByO8eJqU.js";import{n as b,t as x}from"./cwd-C5ce-7WB.js";import{An as S,Cn as C}from"./settings-hQDLwPVj.js";import{l as w,m as T,p as E,s as D}from"./git-BerW9bId.js";import{r as O,t as k}from"./execFileNoThrow-CCX-JY8h.js";import{C as ne,y as re}from"./startupProfiler-DCn_NxMH.js";import{l as A,o as j}from"./stringUtils-B6FudhoZ.js";import{i as ie}from"./detectRepository-CFiHe6Rv.js";import{join as ae,resolve as M}from"path";import{access as N}from"fs/promises";async function oe(){if(!await w()||await P())return null;let{stdout:e,code:t}=await k(E(),[`--no-optional-locks`,`diff`,`HEAD`,`--shortstat`],{timeout:F,preserveOutputOnError:!1});if(t===0){let t=de(e);if(t&&t.filesCount>z)return{stats:t,perFileStats:new Map,hunks:new Map}}let{stdout:n,code:r}=await k(E(),[`--no-optional-locks`,`diff`,`HEAD`,`--numstat`],{timeout:F,preserveOutputOnError:!1});if(r!==0)return null;let{stats:i,perFileStats:a}=ce(n),o=I-a.size;if(o>0){let e=await ue(o);if(e){i.filesCount+=e.size;for(let[t,n]of e)a.set(t,n)}}return{stats:i,perFileStats:a,hunks:new Map}}async function se(){if(!await w()||await P())return new Map;let{stdout:e,code:t}=await k(E(),[`--no-optional-locks`,`diff`,`HEAD`],{timeout:F,preserveOutputOnError:!1});return t===0?le(e):new Map}function ce(e){let t=e.trim().split(`
2
+ `).filter(Boolean),n=0,r=0,i=0,a=new Map;for(let e of t){let t=e.split(` `);if(t.length<3)continue;i++;let o=t[0],s=t[1],c=t.slice(2).join(` `),l=o===`-`||s===`-`,u=l?0:parseInt(o??`0`,10)||0,d=l?0:parseInt(s??`0`,10)||0;n+=u,r+=d,a.size<I&&a.set(c,{added:u,removed:d,isBinary:l})}return{stats:{filesCount:i,linesAdded:n,linesRemoved:r},perFileStats:a}}function le(e){let t=new Map;if(!e.trim())return t;let n=e.split(/^diff --git /m).filter(Boolean);for(let e of n){if(t.size>=I)break;if(e.length>L)continue;let n=e.split(`
3
+ `),r=n[0]?.match(/^a\/(.+?) b\/(.+)$/);if(!r)continue;let i=r[2]??r[1]??``,a=[],o=null,s=0;for(let e=1;e<n.length;e++){let t=n[e]??``,r=t.match(/^@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/);if(r){o&&a.push(o),o={oldStart:parseInt(r[1]??`0`,10),oldLines:parseInt(r[2]??`1`,10),newStart:parseInt(r[3]??`0`,10),newLines:parseInt(r[4]??`1`,10),lines:[]};continue}if(!(t.startsWith(`index `)||t.startsWith(`---`)||t.startsWith(`+++`)||t.startsWith(`new file`)||t.startsWith(`deleted file`)||t.startsWith(`old mode`)||t.startsWith(`new mode`)||t.startsWith(`Binary files`))&&o&&(t.startsWith(`+`)||t.startsWith(`-`)||t.startsWith(` `)||t===``)){if(s>=R)continue;o.lines.push(``+t),s++}}o&&a.push(o),a.length>0&&t.set(i,a)}return t}async function P(){let e=await D(x());return e?(await Promise.all([`MERGE_HEAD`,`REBASE_HEAD`,`CHERRY_PICK_HEAD`,`REVERT_HEAD`].map(t=>N(ae(e,t)).then(()=>!0).catch(()=>!1)))).some(Boolean):!1}async function ue(e){let{stdout:t,code:n}=await k(E(),[`--no-optional-locks`,`ls-files`,`--others`,`--exclude-standard`],{timeout:F,preserveOutputOnError:!1});if(n!==0||!t.trim())return null;let r=t.trim().split(`
4
+ `).filter(Boolean);if(r.length===0)return null;let i=new Map;for(let t of r.slice(0,e))i.set(t,{added:0,removed:0,isBinary:!1,isUntracked:!0});return i}function de(e){let t=e.match(/(\d+)\s+files?\s+changed(?:,\s+(\d+)\s+insertions?\(\+\))?(?:,\s+(\d+)\s+deletions?\(-\))?/);return t?{filesCount:parseInt(t[1]??`0`,10),linesAdded:parseInt(t[2]??`0`,10),linesRemoved:parseInt(t[3]??`0`,10)}:null}var F,I,L,R,z,B=e((()=>{b(),ie(),O(),C(),T(),F=5e3,I=50,L=1e6,R=400,z=500}));function V(){let[e,t]=(0,H.useState)(null),[n,r]=(0,H.useState)(new Map),[i,a]=(0,H.useState)(!0);return(0,H.useEffect)(()=>{let e=!1;async function n(){try{let[n,i]=await Promise.all([oe(),se()]);e||(t(n),r(i),a(!1))}catch{e||(t(null),r(new Map),a(!1))}}return n(),()=>{e=!0}},[]),(0,H.useMemo)(()=>{if(!e)return{stats:null,files:[],hunks:new Map,loading:i};let{stats:t,perFileStats:r}=e,a=[];for(let[e,t]of r){let r=n.get(e),i=t.isUntracked??!1,o=!t.isBinary&&!i&&!r,s=t.added+t.removed,c=!o&&!t.isBinary&&s>U;a.push({path:e,linesAdded:t.added,linesRemoved:t.removed,isBinary:t.isBinary,isLargeFile:o,isTruncated:c,isUntracked:i})}return a.sort((e,t)=>e.path.localeCompare(t.path)),{stats:t,files:a,hunks:n,loading:!1}},[e,n,i])}var H,U,fe=e((()=>{H=t(l(),1),B(),U=400}));function W(e){if(!e||typeof e!=`object`)return!1;let t=e,n=typeof t.filePath==`string`,r=Array.isArray(t.structuredPatch)&&t.structuredPatch.length>0,i=t.type===`create`&&typeof t.content==`string`;return n&&(r||i)}function pe(e){return`type`in e&&(e.type===`create`||e.type===`update`)}function me(e){let t=0,n=0;for(let r of e)for(let e of r.lines)e.startsWith(`+`)?t++:e.startsWith(`-`)&&n++;return{added:t,removed:n}}function he(e){if(e.type!==`user`)return``;let t=e.message.content,n=typeof t==`string`?t:``;return n.length<=30?n:n.slice(0,29)+`…`}function G(e){let t=0,n=0;for(let r of e.files.values())t+=r.linesAdded,n+=r.linesRemoved;e.stats={filesChanged:e.files.size,linesAdded:t,linesRemoved:n}}function ge(e){let t=(0,K.useRef)({completedTurns:[],currentTurn:null,lastProcessedIndex:0,lastTurnIndex:0});return(0,K.useMemo)(()=>{let n=t.current;e.length<n.lastProcessedIndex&&(n.completedTurns=[],n.currentTurn=null,n.lastProcessedIndex=0,n.lastTurnIndex=0);for(let t=n.lastProcessedIndex;t<e.length;t++){let r=e[t];if(!(!r||r.type!==`user`)){if(!(r.toolUseResult||Array.isArray(r.message.content)&&r.message.content[0]?.type===`tool_result`)&&!r.isMeta)n.currentTurn&&n.currentTurn.files.size>0&&(G(n.currentTurn),n.completedTurns.push(n.currentTurn)),n.lastTurnIndex++,n.currentTurn={turnIndex:n.lastTurnIndex,userPromptPreview:he(r),timestamp:r.timestamp,files:new Map,stats:{filesChanged:0,linesAdded:0,linesRemoved:0}};else if(n.currentTurn&&r.toolUseResult){let e=r.toolUseResult;if(W(e)){let{filePath:t,structuredPatch:r}=e,i=`type`in e&&e.type===`create`,a=n.currentTurn.files.get(t);if(a||(a={filePath:t,hunks:[],isNewFile:i,linesAdded:0,linesRemoved:0},n.currentTurn.files.set(t,a)),i&&r.length===0&&pe(e)){let t=e.content.split(`
5
+ `),n={oldStart:0,oldLines:0,newStart:1,newLines:t.length,lines:t.map(e=>`+`+e)};a.hunks.push(n),a.linesAdded+=t.length}else{a.hunks.push(...r);let{added:e,removed:t}=me(r);a.linesAdded+=e,a.linesRemoved+=t}i&&(a.isNewFile=!0)}}}}n.lastProcessedIndex=e.length;let r=[...n.completedTurns];return n.currentTurn&&n.currentTurn.files.size>0&&(G(n.currentTurn),r.push(n.currentTurn)),r.reverse()},[e])}var K,_e=e((()=>{K=t(l(),1)}));function ve({filePath:e,hunks:t,isLargeFile:n,isBinary:r,isTruncated:a,isUntracked:c}){let{columns:l}=u(),{firstLine:d,fileContent:f}=(0,q.useMemo)(()=>{if(!e)return{firstLine:null,fileContent:void 0};let t=S(M(x(),e));return{firstLine:t?.split(`
6
+ `)[0]??null,fileContent:t??void 0}},[e]);return c?(0,J.jsxs)(o,{flexDirection:`column`,width:`100%`,children:[(0,J.jsxs)(o,{children:[(0,J.jsx)(s,{bold:!0,children:e}),(0,J.jsx)(s,{dimColor:!0,children:` (untracked)`})]}),(0,J.jsx)(i,{padding:4}),(0,J.jsxs)(o,{flexDirection:`column`,children:[(0,J.jsx)(s,{dimColor:!0,italic:!0,children:`New file not yet staged.`}),(0,J.jsxs)(s,{dimColor:!0,italic:!0,children:["Run `git add ",e,"` to see line counts."]})]})]}):r?(0,J.jsxs)(o,{flexDirection:`column`,width:`100%`,children:[(0,J.jsx)(o,{children:(0,J.jsx)(s,{bold:!0,children:e})}),(0,J.jsx)(i,{padding:4}),(0,J.jsx)(o,{flexDirection:`column`,children:(0,J.jsx)(s,{dimColor:!0,italic:!0,children:`Binary file - cannot display diff`})})]}):n?(0,J.jsxs)(o,{flexDirection:`column`,width:`100%`,children:[(0,J.jsx)(o,{children:(0,J.jsx)(s,{bold:!0,children:e})}),(0,J.jsx)(i,{padding:4}),(0,J.jsx)(o,{flexDirection:`column`,children:(0,J.jsx)(s,{dimColor:!0,italic:!0,children:`Large file - diff exceeds 1 MB limit`})})]}):(0,J.jsxs)(o,{flexDirection:`column`,width:`100%`,children:[(0,J.jsxs)(o,{children:[(0,J.jsx)(s,{bold:!0,children:e}),a&&(0,J.jsx)(s,{dimColor:!0,children:` (truncated)`})]}),(0,J.jsx)(i,{padding:4}),(0,J.jsx)(o,{flexDirection:`column`,children:t.length===0?(0,J.jsx)(s,{dimColor:!0,children:`No diff content`}):t.map((t,n)=>(0,J.jsx)(_,{patch:t,filePath:e,firstLine:d,fileContent:f,dim:!1,width:l-2-2},n))}),a&&(0,J.jsx)(s,{dimColor:!0,italic:!0,children:`… diff truncated (exceeded 400 line limit)`})]})}var q,J,ye=e((()=>{q=t(l(),1),y(),d(),b(),C(),v(),J=p()}));function be({files:e,selectedIndex:t}){let{columns:n}=u(),{startIndex:r,endIndex:i}=(0,Y.useMemo)(()=>{if(e.length===0||e.length<=Z)return{startIndex:0,endIndex:e.length};let n=Math.max(0,t-Math.floor(Z/2)),r=n+Z;return r>e.length&&(r=e.length,n=Math.max(0,r-Z)),{startIndex:n,endIndex:r}},[e.length,t]);if(e.length===0)return(0,X.jsx)(s,{dimColor:!0,children:`No changed files`});let a=e.slice(r,i),c=r>0,l=i<e.length,d=e.length>Z,f=Math.max(20,n-16-3-4);return(0,X.jsxs)(o,{flexDirection:`column`,children:[d&&(0,X.jsx)(s,{dimColor:!0,children:c?` ↑ ${r} more ${A(r,`file`)}`:` `}),a.map((e,n)=>(0,X.jsx)(xe,{file:e,isSelected:r+n===t,maxPathWidth:f},e.path)),d&&(0,X.jsx)(s,{dimColor:!0,children:l?` ↓ ${e.length-i} more ${A(e.length-i,`file`)}`:` `})]})}function xe({file:e,isSelected:t,maxPathWidth:n}){let i=ne(e.path,n),a=`${t?r.pointer+` `:` `}${i}`;return(0,X.jsxs)(o,{flexDirection:`row`,children:[(0,X.jsx)(s,{bold:t,color:t?`background`:void 0,inverse:t,children:a}),(0,X.jsx)(o,{flexGrow:1}),(0,X.jsx)(Se,{file:e,isSelected:t})]})}function Se({file:e,isSelected:t}){return e.isUntracked?(0,X.jsx)(s,{dimColor:!t,italic:!0,children:`untracked`}):e.isBinary?(0,X.jsx)(s,{dimColor:!t,italic:!0,children:`Binary file`}):e.isLargeFile?(0,X.jsx)(s,{dimColor:!t,italic:!0,children:`Large file modified`}):(0,X.jsxs)(s,{children:[e.linesAdded>0&&(0,X.jsxs)(s,{color:`diffAddedWord`,bold:t,children:[`+`,e.linesAdded]}),e.linesAdded>0&&e.linesRemoved>0&&` `,e.linesRemoved>0&&(0,X.jsxs)(s,{color:`diffRemovedWord`,bold:t,children:[`-`,e.linesRemoved]}),e.isTruncated&&(0,X.jsx)(s,{dimColor:!t,children:` (truncated)`})]})}var Y,X,Z,Ce=e((()=>{n(),Y=t(l(),1),y(),d(),re(),j(),X=p(),Z=5}));function we(e){let t=Array.from(e.files.values()).map(e=>({path:e.filePath,linesAdded:e.linesAdded,linesRemoved:e.linesRemoved,isBinary:!1,isLargeFile:!1,isTruncated:!1,isNewFile:e.isNewFile})).sort((e,t)=>e.path.localeCompare(t.path)),n=new Map;for(let t of e.files.values())n.set(t.filePath,t.hunks);return{stats:{filesCount:e.stats.filesChanged,linesAdded:e.stats.linesAdded,linesRemoved:e.stats.linesRemoved},files:t,hunks:n,loading:!1}}function Te({messages:e,onDone:t}){let n=V(),r=ge(e),[i,l]=(0,Q.useState)(`list`),[u,d]=(0,Q.useState)(0),[p,m]=(0,Q.useState)(0),h=(0,Q.useMemo)(()=>[{type:`current`},...r.map(e=>({type:`turn`,turn:e}))],[r]),g=h[p],_=g?.type===`turn`?g.turn:null,v=(0,Q.useMemo)(()=>_?we(_):n,[_,n]),y=v.files[u],b=(0,Q.useMemo)(()=>y&&v.hunks.get(y.path)||[],[y,v.hunks]);(0,Q.useEffect)(()=>{p>=h.length&&m(Math.max(0,h.length-1))},[h.length,p]);let x=(0,Q.useRef)(p);(0,Q.useEffect)(()=>{x.current!==p&&(d(0),x.current=p)},[p]),te(`diff-dialog`),a({"diff:previousSource":()=>{i===`detail`?l(`list`):i===`list`&&h.length>1&&m(e=>Math.max(0,e-1))},"diff:nextSource":()=>{i===`list`&&h.length>1&&m(e=>Math.min(h.length-1,e+1))},"diff:back":()=>{i===`detail`&&l(`list`)},"diff:viewDetails":()=>{i===`list`&&y&&l(`detail`)},"diff:previousFile":()=>{i===`list`&&d(e=>Math.max(0,e-1))},"diff:nextFile":()=>{i===`list`&&d(e=>Math.min(v.files.length-1,e+1))}},{context:`DiffDialog`});let S=v.stats?(0,$.jsxs)(s,{dimColor:!0,children:[v.stats.filesCount,` `,A(v.stats.filesCount,`file`),` changed`,v.stats.linesAdded>0&&(0,$.jsxs)(s,{color:`diffAddedWord`,children:[` +`,v.stats.linesAdded]}),v.stats.linesRemoved>0&&(0,$.jsxs)(s,{color:`diffRemovedWord`,children:[` -`,v.stats.linesRemoved]})]}):null,C=_?`Turn ${_.turnIndex}`:`Uncommitted changes`,w=_?_.userPromptPreview?`"${_.userPromptPreview}"`:``:`(git diff HEAD)`,T=h.length>1?(0,$.jsxs)(o,{children:[p>0&&(0,$.jsx)(s,{dimColor:!0,children:`◀ `}),h.map((e,t)=>{let n=t===p,r=e.type===`current`?`Current`:`T${e.turn.turnIndex}`;return(0,$.jsxs)(s,{dimColor:!n,bold:n,children:[t>0?` · `:``,r]},t)}),p<h.length-1&&(0,$.jsx)(s,{dimColor:!0,children:` ▶`})]}):null,E=ee(`diff:dismiss`,`DiffDialog`,`esc`),D=v.loading?`Loading diff…`:_?`No file changes in this turn`:v.stats&&v.stats.filesCount>0&&v.files.length===0?`Too many files to display details`:`Working tree is clean`,O=(0,$.jsxs)(s,{children:[C,w&&(0,$.jsxs)(s,{dimColor:!0,children:[` `,w]})]});function k(){i===`detail`?l(`list`):t(`Diff dialog dismissed`,{display:`system`})}return(0,$.jsxs)(f,{title:O,onCancel:k,color:`background`,inputGuide:e=>e.pending?(0,$.jsxs)(s,{children:[`Press `,e.keyName,` again to exit`]}):i===`list`?(0,$.jsxs)(c,{children:[h.length>1&&(0,$.jsx)(s,{children:`←/→ source`}),(0,$.jsx)(s,{children:`↑/↓ select`}),(0,$.jsx)(s,{children:`Enter view`}),(0,$.jsxs)(s,{children:[E,` close`]})]}):(0,$.jsxs)(c,{children:[(0,$.jsx)(s,{children:`← back`}),(0,$.jsxs)(s,{children:[E,` close`]})]}),children:[T,S,v.files.length===0?(0,$.jsx)(o,{marginTop:1,children:(0,$.jsx)(s,{dimColor:!0,children:D})}):i===`list`?(0,$.jsx)(o,{flexDirection:`column`,marginTop:1,children:(0,$.jsx)(be,{files:v.files,selectedIndex:u})}):(0,$.jsx)(o,{flexDirection:`column`,marginTop:1,children:(0,$.jsx)(ve,{filePath:y?.path||``,hunks:b,isLargeFile:y?.isLargeFile,isBinary:y?.isBinary,isTruncated:y?.isTruncated,isUntracked:y?.isUntracked})})]})}var Q,$;e((()=>{Q=t(l(),1),g(),fe(),_e(),d(),h(),m(),j(),ye(),Ce(),$=p()}))();export{Te as DiffDialog};
@@ -0,0 +1 @@
1
+ import{n as e,t}from"./Doctor-lhUBhEy5.js";e();export{t as Doctor};
@@ -0,0 +1,3 @@
1
+ import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{n,o as r}from"./envUtils-DSxRz_kt.js";import{n as i,t as a}from"./figures-5ThXQEtq.js";import{Gt as o,I as s,P as c,fi as l,t as u,x as d}from"./src-CDCSSo0U2.js";import{t as f}from"./jsx-runtime-Bb4Xn-E0.js";import{$t as p,tt as ee}from"./state-C2OSZkV1.js";import{Bw as m,Gg as h,Gv as te,Hv as g,Hw as _,Hx as v,Kg as y,Pw as b,Rx as x,SE as S,TE as C,Uv as w,Uw as T,Vv as E,Vw as D,Vx as ne,Wv as re,Wx as ie,_D as ae,_v as oe,du as se,fa as ce,lu as le,pa as O,uu as k,vD as A,vv as j}from"./loadAgentsDir-ByO8eJqU.js";import{Cn as M,H as N,On as P,g as F,n as I,z as L}from"./settings-hQDLwPVj.js";import{l as R,o as z}from"./stringUtils-B6FudhoZ.js";import{Kn as B,Un as V,_ as H,u as U}from"./model-CwO-g1RW.js";import{n as W,t as ue}from"./ValidationErrorsList-DokTJQwi.js";import{d as de,f as fe,h as pe,i as me,m as he,n as ge,o as _e,r as ve,u as G}from"./pidLock-DJnS_38v.js";import{a as ye,i as be}from"./xdg-DcF9ejUM.js";import{n as xe,t as Se}from"./useExitOnCtrlCDWithKeybindings-Cce612uS.js";import{n as Ce,t as we}from"./McpParsingWarnings-BS4JoR5l.js";import{n as Te,t as Ee}from"./PressEnterToContinue-Dl9Hg9Mf.js";import{n as De,t as Oe}from"./useSettingsErrors-CAJR_wpd.js";import{n as ke,t as Ae}from"./shadowedRuleDetection-C86PTj1m.js";import{n as je,r as Me,t as K}from"./statusNoticeHelpers-B5U5c9PE.js";import{join as q}from"path";function Ne(){if(!T())return null;let e=m();if(e.length===0)return null;let t=e.filter(e=>e.severity===`error`),n=e.filter(e=>e.severity===`warning`);return(0,J.jsxs)(s,{flexDirection:`column`,marginTop:1,marginBottom:1,children:[(0,J.jsx)(c,{bold:!0,color:t.length>0?`error`:`warning`,children:`Keybinding Configuration Issues`}),(0,J.jsxs)(s,{children:[(0,J.jsx)(c,{dimColor:!0,children:`Location: `}),(0,J.jsx)(c,{dimColor:!0,children:D()})]}),(0,J.jsxs)(s,{marginLeft:1,flexDirection:`column`,marginTop:1,children:[t.map((e,t)=>(0,J.jsxs)(s,{flexDirection:`column`,children:[(0,J.jsxs)(s,{children:[(0,J.jsx)(c,{dimColor:!0,children:`└ `}),(0,J.jsx)(c,{color:`error`,children:`[Error]`}),(0,J.jsxs)(c,{dimColor:!0,children:[` `,e.message]})]}),e.suggestion&&(0,J.jsx)(s,{marginLeft:3,children:(0,J.jsxs)(c,{dimColor:!0,children:[`→ `,e.suggestion]})})]},`error-${t}`)),n.map((e,t)=>(0,J.jsxs)(s,{flexDirection:`column`,children:[(0,J.jsxs)(s,{children:[(0,J.jsx)(c,{dimColor:!0,children:`└ `}),(0,J.jsx)(c,{color:`warning`,children:`[Warning]`}),(0,J.jsxs)(c,{dimColor:!0,children:[` `,e.message]})]}),e.suggestion&&(0,J.jsx)(s,{marginLeft:3,children:(0,J.jsxs)(c,{dimColor:!0,children:[`→ `,e.suggestion]})})]},`warning-${t}`))]})]})}var J,Pe=e((()=>{l(),u(),_(),J=f()}));function Fe(){if(!S.isSupportedPlatform()||!S.isSandboxEnabledInSettings())return null;let e=S.checkDependencies(),t=e.errors.length>0,n=e.warnings.length>0;return!t&&!n?null:(0,Y.jsxs)(s,{flexDirection:`column`,children:[(0,Y.jsx)(c,{bold:!0,children:`Sandbox`}),(0,Y.jsxs)(c,{children:[`└ Status: `,(0,Y.jsx)(c,{color:t?`error`:`warning`,children:t?`Missing dependencies`:`Available (with warnings)`})]}),e.errors.map((e,t)=>(0,Y.jsxs)(c,{color:`error`,children:[`└ `,e]},t)),e.warnings.map((e,t)=>(0,Y.jsxs)(c,{color:`warning`,children:[`└ `,e]},t)),t&&(0,Y.jsx)(c,{dimColor:!0,children:`└ Run /sandbox for install instructions`})]})}var Y,Ie=e((()=>{l(),u(),C(),Y=f()}));async function Le(){let e=ne(await v());if(e.length===0)return null;let t=e.sort((e,t)=>t.content.length-e.content.length).map(e=>`${e.path}: ${e.content.length.toLocaleString()} chars`);return{type:`claudemd_files`,severity:`warning`,message:e.length===1?`Large CLAUDE.md file detected (${e[0].content.length.toLocaleString()} chars > ${x.toLocaleString()})`:`${e.length} large CLAUDE.md files detected (each > ${x.toLocaleString()} chars)`,details:t,currentValue:e.length,threshold:x}}async function X(e){if(!e)return null;let t=je(e);if(t<=15e3)return null;let n=e.activeAgents.filter(e=>e.source!==`built-in`).map(e=>{let t=`${e.agentType}: ${e.whenToUse}`;return{name:e.agentType,tokens:O(t)}}).sort((e,t)=>t.tokens-e.tokens),r=n.slice(0,5).map(e=>`${e.name}: ~${e.tokens.toLocaleString()} tokens`);return n.length>5&&r.push(`(${n.length-5} more custom agents)`),{type:`agent_descriptions`,severity:`warning`,message:`Large agent descriptions (~${t.toLocaleString()} tokens > ${K.toLocaleString()})`,details:r,currentValue:t,threshold:K}}async function Re(e,t,n){let r=e.filter(e=>e.isMcp);if(r.length===0)return null;try{let{mcpToolTokens:r,mcpToolDetails:i}=await h(e,t,n,U());if(r<=Z)return null;let a=new Map;for(let e of i){let t=e.name.split(`__`)[1]||`unknown`,n=a.get(t)||{count:0,tokens:0};a.set(t,{count:n.count+1,tokens:n.tokens+e.tokens})}let o=Array.from(a.entries()).sort((e,t)=>t[1].tokens-e[1].tokens),s=o.slice(0,5).map(([e,t])=>`${e}: ${t.count} tools (~${t.tokens.toLocaleString()} tokens)`);return o.length>5&&s.push(`(${o.length-5} more servers)`),{type:`mcp_tools`,severity:`warning`,message:`Large MCP tools context (~${r.toLocaleString()} tokens > ${Z.toLocaleString()})`,details:s,currentValue:r,threshold:Z}}catch{let e=r.reduce((e,t)=>e+O(((t.name?.length||0)+t.description.length).toString()),0);return e<=Z?null:{type:`mcp_tools`,severity:`warning`,message:`Large MCP tools context (~${e.toLocaleString()} tokens estimated > ${Z.toLocaleString()})`,details:[`${r.length} MCP tools detected (token count estimated)`],currentValue:e,threshold:Z}}}async function ze(e){let t=Ae(await e(),{sandboxAutoAllowEnabled:S.isSandboxingEnabled()&&S.isAutoAllowBashIfSandboxedEnabled()});if(t.length===0)return null;let n=t.flatMap(e=>[`${N(e.rule.ruleValue)}: ${e.reason}`,` Fix: ${e.fix}`]);return{type:`unreachable_rules`,severity:`warning`,message:`${t.length} ${R(t.length,`unreachable permission rule`)} detected`,details:n,currentValue:t.length,threshold:0}}async function Be(e,t,n){let[r,i,a,o]=await Promise.all([Le(),X(t),Re(e,n,t),ze(n)]);return{claudeMdWarning:r,agentWarning:i,mcpWarning:a,unreachableRulesWarning:o}}var Z,Ve=e((()=>{ce(),y(),ie(),H(),L(),ke(),C(),Me(),z(),Z=25e3}));function He({promise:e}){let t=(0,Q.use)(e);return t.latest?(0,$.jsxs)($.Fragment,{children:[t.stable&&(0,$.jsxs)(c,{children:[`└ Stable version: `,t.stable]}),(0,$.jsxs)(c,{children:[`└ Latest version: `,t.latest]})]}):(0,$.jsx)(c,{dimColor:!0,children:`└ Failed to fetch versions`})}function Ue({onDone:e}){let t=j(e=>e.agentDefinitions),r=j(e=>e.mcp.tools),i=j(e=>e.toolPermissionContext),l=j(e=>e.plugins.errors);xe();let u=(0,Q.useMemo)(()=>r||[],[r]),[f,p]=(0,Q.useState)(null),[m,h]=(0,Q.useState)(null),[_,v]=(0,Q.useState)(null),[y,b]=(0,Q.useState)(null),x=De(),S=(0,Q.useMemo)(()=>G().then(e=>(e.installationType===`native`?fe:he)().catch(()=>({latest:null,stable:null}))),[]),C=I()?.autoUpdatesChannel??`latest`,w=x.filter(e=>e.mcpErrorMetadata===void 0),T=(0,Q.useMemo)(()=>[{name:`BASH_MAX_OUTPUT_LENGTH`,default:E,upperLimit:g},{name:`TASK_MAX_OUTPUT_LENGTH`,default:le,upperLimit:k},{name:`CLAUDE_CODE_MAX_OUTPUT_TOKENS`,...V(`claude-opus-4-7`)}].map(e=>{let t=process.env[e.name],n=te(e.name,t,e.default,e.upperLimit);return{name:e.name,...n}}).filter(e=>e.status!==`valid`),[]);(0,Q.useEffect)(()=>{G().then(p),(async()=>{let e=q(n(),`agents`),r=q(ee(),`.claude`,`agents`),{activeAgents:a,allAgents:o,failedFiles:s}=t,[c,l]=await Promise.all([P(e),P(r)]),d={activeAgents:a.map(e=>({agentType:e.agentType,source:e.source})),userAgentsDir:e,projectAgentsDir:r,userDirExists:c,projectDirExists:l,failedFiles:s};h(d);let f=await Be(u,{activeAgents:a,allAgents:o,failedFiles:s},async()=>i);if(v(f),_e()){let e=q(be(),`claude`,`locks`),t=ge(e),n=ve(e);b({enabled:!0,locks:n,locksDir:e,staleLocksCleaned:t})}else b({enabled:!1,locks:[],locksDir:``,staleLocksCleaned:0})})()},[i,u,t]);let D=(0,Q.useCallback)(()=>{e(`Claude Code diagnostics dismissed`,{display:`system`})},[e]);return o({"confirm:yes":D,"confirm:no":D},{context:`Confirmation`}),f?(0,$.jsxs)(d,{children:[(0,$.jsxs)(s,{flexDirection:`column`,children:[(0,$.jsx)(c,{bold:!0,children:`Diagnostics`}),(0,$.jsxs)(c,{children:[`└ Currently running: `,f.installationType,` (`,f.version,`)`]}),f.packageManager&&(0,$.jsxs)(c,{children:[`└ Package manager: `,f.packageManager]}),(0,$.jsxs)(c,{children:[`└ Path: `,f.installationPath]}),(0,$.jsxs)(c,{children:[`└ Invoked: `,f.invokedBinary]}),(0,$.jsxs)(c,{children:[`└ Config install method: `,f.configInstallMethod]}),(0,$.jsxs)(c,{children:[`└ Search: `,f.ripgrepStatus.working?`OK`:`Not working`,` (`,f.ripgrepStatus.mode===`embedded`?`bundled`:f.ripgrepStatus.mode===`builtin`?`vendor`:f.ripgrepStatus.systemPath||`system`,`)`]}),f.ripgrepStatus.note&&(0,$.jsxs)(c,{color:`warning`,children:[`└ Note: `,f.ripgrepStatus.note]}),f.recommendation&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(c,{}),(0,$.jsxs)(c,{color:`warning`,children:[`Recommendation: `,f.recommendation.split(`
2
+ `)[0]]}),(0,$.jsx)(c,{dimColor:!0,children:f.recommendation.split(`
3
+ `)[1]})]}),f.multipleInstallations.length>1&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(c,{}),(0,$.jsx)(c,{color:`warning`,children:`Warning: Multiple installations found`}),f.multipleInstallations.map((e,t)=>(0,$.jsxs)(c,{children:[`└ `,e.type,` at `,e.path]},t))]}),f.warnings.length>0&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(c,{}),f.warnings.map((e,t)=>(0,$.jsxs)(s,{flexDirection:`column`,children:[(0,$.jsxs)(c,{color:`warning`,children:[`Warning: `,e.issue]}),(0,$.jsxs)(c,{children:[`Fix: `,e.fix]})]},t))]}),w.length>0&&(0,$.jsxs)(s,{flexDirection:`column`,marginTop:1,marginBottom:1,children:[(0,$.jsx)(c,{bold:!0,children:`Invalid Settings`}),(0,$.jsx)(ue,{errors:w})]})]}),(0,$.jsxs)(s,{flexDirection:`column`,children:[(0,$.jsx)(c,{bold:!0,children:`Updates`}),(0,$.jsxs)(c,{children:[`└ Auto-updates: `,f.packageManager?`Managed by package manager`:f.autoUpdates]}),f.hasUpdatePermissions!==null&&(0,$.jsxs)(c,{children:[`└ Update permissions: `,f.hasUpdatePermissions?`Yes`:`No (requires sudo)`]}),(0,$.jsxs)(c,{children:[`└ Auto-update channel: `,C]}),(0,$.jsx)(Q.Suspense,{fallback:null,children:(0,$.jsx)(He,{promise:S})})]}),(0,$.jsx)(Fe,{}),(0,$.jsx)(we,{}),(0,$.jsx)(Ne,{}),T.length>0&&(0,$.jsxs)(s,{flexDirection:`column`,children:[(0,$.jsx)(c,{bold:!0,children:`Environment Variables`}),T.map((e,t)=>(0,$.jsxs)(c,{children:[`└ `,e.name,`:`,` `,(0,$.jsx)(c,{color:e.status===`capped`?`warning`:`error`,children:e.message})]},t))]}),y?.enabled&&(0,$.jsxs)(s,{flexDirection:`column`,children:[(0,$.jsx)(c,{bold:!0,children:`Version Locks`}),y.staleLocksCleaned>0&&(0,$.jsxs)(c,{dimColor:!0,children:[`└ Cleaned `,y.staleLocksCleaned,` stale lock(s)`]}),y.locks.length===0?(0,$.jsx)(c,{dimColor:!0,children:`└ No active version locks`}):y.locks.map((e,t)=>(0,$.jsxs)(c,{children:[`└ `,e.version,`: PID `,e.pid,` `,e.isProcessRunning?(0,$.jsx)(c,{children:`(running)`}):(0,$.jsx)(c,{color:`warning`,children:`(stale)`})]},t))]}),m?.failedFiles&&m.failedFiles.length>0&&(0,$.jsxs)(s,{flexDirection:`column`,children:[(0,$.jsx)(c,{bold:!0,color:`error`,children:`Agent Parse Errors`}),(0,$.jsxs)(c,{color:`error`,children:[`└ Failed to parse `,m.failedFiles.length,` agent file(s):`]}),m.failedFiles.map((e,t)=>(0,$.jsxs)(c,{dimColor:!0,children:[` `,`└ `,e.path,`: `,e.error]},t))]}),l.length>0&&(0,$.jsxs)(s,{flexDirection:`column`,children:[(0,$.jsx)(c,{bold:!0,color:`error`,children:`Plugin Errors`}),(0,$.jsxs)(c,{color:`error`,children:[`└ `,l.length,` plugin error(s) detected:`]}),l.map((e,t)=>(0,$.jsxs)(c,{dimColor:!0,children:[` `,`└ `,e.source||`unknown`,`plugin`in e&&e.plugin?` [${e.plugin}]`:``,`: `,ae(e)]},t))]}),_?.unreachableRulesWarning&&(0,$.jsxs)(s,{flexDirection:`column`,children:[(0,$.jsx)(c,{bold:!0,color:`warning`,children:`Unreachable Permission Rules`}),(0,$.jsxs)(c,{children:[`└`,` `,(0,$.jsxs)(c,{color:`warning`,children:[a.warning,` `,_.unreachableRulesWarning.message]})]}),_.unreachableRulesWarning.details.map((e,t)=>(0,$.jsxs)(c,{dimColor:!0,children:[` `,`└ `,e]},t))]}),_&&(_.claudeMdWarning||_.agentWarning||_.mcpWarning)&&(0,$.jsxs)(s,{flexDirection:`column`,children:[(0,$.jsx)(c,{bold:!0,children:`Context Usage Warnings`}),_.claudeMdWarning&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(c,{children:[`└`,` `,(0,$.jsxs)(c,{color:`warning`,children:[a.warning,` `,_.claudeMdWarning.message]})]}),(0,$.jsxs)(c,{children:[` `,`└ Files:`]}),_.claudeMdWarning.details.map((e,t)=>(0,$.jsxs)(c,{dimColor:!0,children:[` `,`└ `,e]},t))]}),_.agentWarning&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(c,{children:[`└`,` `,(0,$.jsxs)(c,{color:`warning`,children:[a.warning,` `,_.agentWarning.message]})]}),(0,$.jsxs)(c,{children:[` `,`└ Top contributors:`]}),_.agentWarning.details.map((e,t)=>(0,$.jsxs)(c,{dimColor:!0,children:[` `,`└ `,e]},t))]}),_.mcpWarning&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(c,{children:[`└`,` `,(0,$.jsxs)(c,{color:`warning`,children:[a.warning,` `,_.mcpWarning.message]})]}),(0,$.jsxs)(c,{children:[` `,`└ MCP servers:`]}),_.mcpWarning.details.map((e,t)=>(0,$.jsxs)(c,{dimColor:!0,children:[` `,`└ `,e]},t))]})]}),(0,$.jsx)(s,{children:(0,$.jsx)(Ee,{})})]}):(0,$.jsx)(d,{children:(0,$.jsx)(c,{dimColor:!0,children:`Checking installation status…`})})}var Q,$,We=e((()=>{i(),Q=t(l(),1),Pe(),Ce(),B(),r(),p(),u(),Te(),Ie(),W(),Oe(),Se(),b(),oe(),A(),pe(),Ve(),de(),re(),M(),me(),F(),w(),se(),ye(),$=f()}));export{We as n,Ue as t};
@@ -0,0 +1,2 @@
1
+ import{a as e,n as t,o as n}from"./rolldown-runtime-DaDcL9Zw.js";import{I as r,P as i,fi as a,t as o,y as s}from"./src-CDCSSo0U2.js";import{t as c}from"./jsx-runtime-Bb4Xn-E0.js";import{Bp as l,Ct as u,Ei as d,Et as f,HT as p,Jm as m,Km as h,Mv as g,Ot as _,RE as v,UT as y,dp as b,gt as x,jr as S,jv as C,kt as w,pp as T,zE as E,zp as D}from"./loadAgentsDir-ByO8eJqU.js";import{a as O,l as k}from"./debug-RZ4NuXyS.js";import{r as A,t as j}from"./execFileNoThrow-CCX-JY8h.js";import{n as M,r as N}from"./analytics-CkYUHW_U.js";function P(){(S(),e(d)).saveWorktreeState(null)}function F({onDone:e,onCancel:t}){let[n,a]=(0,I.useState)(`loading`),[o,c]=(0,I.useState)([]),[l,d]=(0,I.useState)(0),[f,m]=(0,I.useState)(),h=u();if((0,I.useEffect)(()=>{async function e(){let e=[],t=await j(`git`,[`status`,`--porcelain`]);if(t.stdout&&(e=t.stdout.split(`
2
+ `).filter(e=>e.trim()!==``),c(e)),h){let{stdout:t}=await j(`git`,[`rev-list`,`--count`,`${h.originalHeadCommit}..HEAD`]),n=parseInt(t.trim(),10)||0;if(d(n),e.length===0&&n===0){a(`removing`),x().then(()=>{process.chdir(h.originalCwd),g(h.originalCwd),P(),p.cache.clear?.(),m(`Worktree removed (no changes)`)}).catch(e=>{k(`Failed to clean up worktree: ${e}`,{level:`error`}),m(`Worktree cleanup failed, exiting anyway`)}).then(()=>{a(`done`)});return}else a(`asking`)}}e()},[h]),(0,I.useEffect)(()=>{n===`done`&&e(f)},[n,e,f]),!h)return e(`No active worktree session found`,{display:`system`}),null;if(n===`loading`||n===`done`)return null;async function v(e){if(!h)return;let t=!!h.tmuxSessionName;if(e===`keep`||e===`keep-with-tmux`)a(`keeping`),N(`tengu_worktree_kept`,{commits:l,changed_files:o.length}),await _(),process.chdir(h.originalCwd),g(h.originalCwd),P(),p.cache.clear?.(),m(t?`Worktree kept. Your work is saved at ${h.worktreePath} on branch ${h.worktreeBranch}. Reattach to tmux session with: tmux attach -t ${h.tmuxSessionName}`:`Worktree kept. Your work is saved at ${h.worktreePath} on branch ${h.worktreeBranch}`),a(`done`);else if(e===`keep-kill-tmux`)a(`keeping`),N(`tengu_worktree_kept`,{commits:l,changed_files:o.length}),h.tmuxSessionName&&await w(h.tmuxSessionName),await _(),process.chdir(h.originalCwd),g(h.originalCwd),P(),p.cache.clear?.(),m(`Worktree kept at ${h.worktreePath} on branch ${h.worktreeBranch}. Tmux session terminated.`),a(`done`);else if(e===`remove`||e===`remove-with-tmux`){a(`removing`),N(`tengu_worktree_removed`,{commits:l,changed_files:o.length}),h.tmuxSessionName&&await w(h.tmuxSessionName);try{await x(),process.chdir(h.originalCwd),g(h.originalCwd),P(),p.cache.clear?.()}catch(e){k(`Failed to clean up worktree: ${e}`,{level:`error`}),m(`Worktree cleanup failed, exiting anyway`),a(`done`);return}let e=t?` Tmux session terminated.`:``;l>0&&o.length>0?m(`Worktree removed. ${l} ${l===1?`commit`:`commits`} and uncommitted changes were discarded.${e}`):l>0?m(`Worktree removed. ${l} ${l===1?`commit`:`commits`} on ${h.worktreeBranch} ${l===1?`was`:`were`} discarded.${e}`):o.length>0?m(`Worktree removed. Uncommitted changes were discarded.${e}`):m(`Worktree removed.${e}`),a(`done`)}}if(n===`keeping`)return(0,L.jsxs)(r,{flexDirection:`row`,marginY:1,children:[(0,L.jsx)(b,{}),(0,L.jsx)(i,{children:`Keeping worktree…`})]});if(n===`removing`)return(0,L.jsxs)(r,{flexDirection:`row`,marginY:1,children:[(0,L.jsx)(b,{}),(0,L.jsx)(i,{children:`Removing worktree…`})]});let y=h.worktreeBranch,S=o.length>0,C=l>0,T=``;T=S&&C?`You have ${o.length} uncommitted ${o.length===1?`file`:`files`} and ${l} ${l===1?`commit`:`commits`} on ${y}. All will be lost if you remove.`:S?`You have ${o.length} uncommitted ${o.length===1?`file`:`files`}. These will be lost if you remove the worktree.`:C?`You have ${l} ${l===1?`commit`:`commits`} on ${y}. The branch will be deleted if you remove the worktree.`:`You are working in a worktree. Keep it to continue working there, or remove it to clean up.`;function E(){if(t){t();return}v(`keep`)}let O=S||C?`All changes and commits will be lost.`:`Clean up the worktree directory.`,A=!!h.tmuxSessionName,M=A?[{label:`Keep worktree and tmux session`,value:`keep-with-tmux`,description:`Stays at ${h.worktreePath}. Reattach with: tmux attach -t ${h.tmuxSessionName}`},{label:`Keep worktree, kill tmux session`,value:`keep-kill-tmux`,description:`Keeps worktree at ${h.worktreePath}, terminates tmux session.`},{label:`Remove worktree and tmux session`,value:`remove-with-tmux`,description:O}]:[{label:`Keep worktree`,value:`keep`,description:`Stays at ${h.worktreePath}`},{label:`Remove worktree`,value:`remove`,description:O}];return(0,L.jsx)(s,{title:`Exiting worktree session`,subtitle:T,onCancel:E,children:(0,L.jsx)(D,{defaultFocusValue:A?`keep-with-tmux`:`keep`,options:M,onChange:v})})}var I,L,R=t((()=>{I=n(a(),1),M(),O(),o(),A(),y(),C(),f(),l(),T(),L=c()}));function z(){return E(H)??`Goodbye!`}function B({showWorktree:e,onDone:t,onCancel:n}){async function r(e){t(e??z()),await h(0,`prompt_input_exit`)}return e?(0,V.jsx)(F,{onDone:r,onCancel:n}):null}var V,H,U=t((()=>{v(),a(),m(),R(),V=c(),H=[`Goodbye!`,`See ya!`,`Bye!`,`Catch you later!`]}));export{U as n,B as t};
@@ -0,0 +1,11 @@
1
+ import{o as e}from"./rolldown-runtime-DaDcL9Zw.js";import{D as t,I as n,Lt as r,P as i,T as a,fi as o,t as s,y as c}from"./src-CDCSSo0U2.js";import{t as l}from"./jsx-runtime-Bb4Xn-E0.js";import{Rp as u,zp as d}from"./loadAgentsDir-ByO8eJqU.js";import{n as f,r as p}from"./analytics-CkYUHW_U.js";import{i as m,o as h,r as g,s as _,t as v}from"./grove-Cv19v6Sv.js";var y=e(o(),1);f(),s(),u();var b=l(),x=` _____________
2
+ | \\ \\
3
+ | NEW TERMS \\__\\
4
+ | |
5
+ | ---------- |
6
+ | ---------- |
7
+ | ---------- |
8
+ | ---------- |
9
+ | ---------- |
10
+ | |
11
+ |______________|`;function S(){return(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)(i,{children:[`An update to our Consumer Terms and Privacy Policy will take effect on `,(0,b.jsx)(i,{bold:!0,children:`October 8, 2025`}),`. You can accept the updated terms today.`]}),(0,b.jsxs)(n,{flexDirection:`column`,children:[(0,b.jsx)(i,{children:`What's changing?`}),(0,b.jsx)(n,{paddingLeft:1,children:(0,b.jsxs)(i,{children:[(0,b.jsx)(i,{children:`· `}),(0,b.jsx)(i,{bold:!0,children:`You can help improve Claude `}),(0,b.jsxs)(i,{children:[`— Allow the use of your chats and coding sessions to train and improve Claude AI models. Change anytime in your Privacy Settings (`,(0,b.jsx)(r,{url:`https://claude.ai/settings/data-privacy-controls`}),`).`]})]})}),(0,b.jsx)(n,{paddingLeft:1,children:(0,b.jsxs)(i,{children:[(0,b.jsx)(i,{children:`· `}),(0,b.jsx)(i,{bold:!0,children:`Updates to data retention `}),(0,b.jsx)(i,{children:`— To help us improve our AI models and safety protections, we're extending data retention to 5 years.`})]})})]}),(0,b.jsxs)(i,{children:[`Learn more (`,(0,b.jsx)(r,{url:`https://www.anthropic.com/news/updates-to-our-consumer-terms`}),`) or read the updated Consumer Terms (`,(0,b.jsx)(r,{url:`https://anthropic.com/legal/terms`}),`) and Privacy Policy (`,(0,b.jsx)(r,{url:`https://anthropic.com/legal/privacy`}),`)`]})]})}function C(){return(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(i,{children:`We've updated our Consumer Terms and Privacy Policy.`}),(0,b.jsxs)(n,{flexDirection:`column`,gap:1,children:[(0,b.jsx)(i,{children:`What's changing?`}),(0,b.jsxs)(n,{flexDirection:`column`,children:[(0,b.jsx)(i,{bold:!0,children:`Help improve Claude`}),(0,b.jsx)(i,{children:`Allow the use of your chats and coding sessions to train and improve Claude AI models. You can change this anytime in Privacy Settings`}),(0,b.jsx)(r,{url:`https://claude.ai/settings/data-privacy-controls`})]}),(0,b.jsxs)(n,{flexDirection:`column`,children:[(0,b.jsx)(i,{bold:!0,children:`How this affects data retention`}),(0,b.jsx)(i,{children:`Turning ON the improve Claude setting extends data retention from 30 days to 5 years. Turning it OFF keeps the default 30-day data retention. Delete data anytime.`})]})]}),(0,b.jsxs)(i,{children:[`Learn more (`,(0,b.jsx)(r,{url:`https://www.anthropic.com/news/updates-to-our-consumer-terms`}),`) or read the updated Consumer Terms (`,(0,b.jsx)(r,{url:`https://anthropic.com/legal/terms`}),`) and Privacy Policy (`,(0,b.jsx)(r,{url:`https://anthropic.com/legal/privacy`}),`)`]})]})}function w({showIfAlreadyViewed:e,location:r,onDone:o}){let[s,l]=(0,y.useState)(null),[u,f]=(0,y.useState)(null);if((0,y.useEffect)(()=>{async function t(){let[t,n]=await Promise.all([m(),g()]),i=n.success?n.data:null;f(i);let a=v(t,n,e);if(l(a),!a){o(`skip_rendering`);return}h(),p(`tengu_grove_policy_viewed`,{location:r,dismissable:i?.notice_is_grace_period})}t()},[e,r,o]),s===null||!s)return null;async function w(e){switch(e){case`accept_opt_in`:await _(!0),p(`tengu_grove_policy_submitted`,{state:!0,dismissable:u?.notice_is_grace_period});break;case`accept_opt_out`:await _(!1),p(`tengu_grove_policy_submitted`,{state:!1,dismissable:u?.notice_is_grace_period});break;case`defer`:p(`tengu_grove_policy_dismissed`,{state:!0});break;case`escape`:p(`tengu_grove_policy_escaped`,{});break}o(e)}let T=u?.domain_excluded?[{label:`Accept terms · Help improve Claude: OFF (for emails with your domain)`,value:`accept_opt_out`}]:[{label:`Accept terms · Help improve Claude: ON`,value:`accept_opt_in`},{label:`Accept terms · Help improve Claude: OFF`,value:`accept_opt_out`}];function E(){if(u?.notice_is_grace_period){w(`defer`);return}w(`escape`)}return(0,b.jsxs)(c,{title:`Updates to Consumer Terms and Policies`,color:`professionalBlue`,onCancel:E,inputGuide:e=>e.pending?(0,b.jsxs)(i,{children:[`Press `,e.keyName,` again to exit`]}):(0,b.jsxs)(a,{children:[(0,b.jsx)(t,{shortcut:`Enter`,action:`confirm`}),(0,b.jsx)(t,{shortcut:`Esc`,action:`cancel`})]}),children:[(0,b.jsxs)(n,{flexDirection:`row`,children:[(0,b.jsx)(n,{flexDirection:`column`,gap:1,flexGrow:1,children:u?.notice_is_grace_period?(0,b.jsx)(S,{}):(0,b.jsx)(C,{})}),(0,b.jsx)(n,{flexShrink:0,children:(0,b.jsx)(i,{color:`professionalBlue`,children:x})})]}),(0,b.jsxs)(n,{flexDirection:`column`,gap:1,children:[(0,b.jsxs)(n,{flexDirection:`column`,children:[(0,b.jsx)(i,{bold:!0,children:`Please select how you'd like to continue`}),(0,b.jsx)(i,{children:`Your choice takes effect immediately upon confirmation.`})]}),(0,b.jsx)(d,{options:[...T,...u?.notice_is_grace_period?[{label:`Not now`,value:`defer`}]:[]],onChange:e=>w(e),onCancel:E})]})]})}export{w as GroveDialog};
@@ -1,4 +1,4 @@
1
- import{l as e,o as t}from"./envUtils-DSxRz_kt.js";import{n,t as r}from"./defineProperty-C-QyHrDq.js";import{n as i,t as a}from"./axios-DaWTGg7G.js";import{Kp as o,qp as s}from"./loadAgentsDir-x3rlgED4.js";import{S as c,a as l,l as u,w as d}from"./debug-BrXObCdR.js";import{M as f,j as p}from"./git-Do0wJvux.js";import{n as m,r as h}from"./analytics-BotDBGh0.js";import{c as g,h as _,l as v,m as y,s as b}from"./proxy-CRN7jYIi.js";import{D as x,O as S,a as C,l as w,n as T,r as E,t as D}from"./rcDebugLog-DBB9r8aw.js";import{r as O}from"./ccrClient-BFyfO67b.js";a(),S(),m(),s(),l(),D(),p(),t(),_(),v(),E(),c(),n();var k=`{"type":"keep_alive"}
2
- `,A=1e3,j=1e3,M=3e4,N=6e5,P=1e4,F=12e4,I=M*2,L=new Set([1002,4001,4003]),R=class{constructor(e,t={},n,i,a){r(this,`ws`,null),r(this,`lastSentId`,null),r(this,`url`,void 0),r(this,`state`,`idle`),r(this,`onData`,void 0),r(this,`onCloseCallback`,void 0),r(this,`onConnectCallback`,void 0),r(this,`headers`,void 0),r(this,`sessionId`,void 0),r(this,`autoReconnect`,void 0),r(this,`isBridge`,void 0),r(this,`reconnectAttempts`,0),r(this,`reconnectStartTime`,null),r(this,`reconnectTimer`,null),r(this,`lastReconnectAttemptTime`,null),r(this,`lastActivityTime`,0),r(this,`pingInterval`,null),r(this,`pongReceived`,!0),r(this,`keepAliveInterval`,null),r(this,`messageBuffer`,void 0),r(this,`isBunWs`,!1),r(this,`connectStartTime`,0),r(this,`refreshHeaders`,void 0),r(this,`onBunOpen`,()=>{this.handleOpenEvent(),this.lastSentId&&this.replayBufferedMessages(``)}),r(this,`onBunMessage`,e=>{let t=typeof e.data==`string`?e.data:String(e.data);this.lastActivityTime=Date.now(),f(`info`,`cli_websocket_message_received`,{length:t.length}),this.onData&&this.onData(t)}),r(this,`onBunError`,()=>{u(`WebSocketTransport: Error`,{level:`error`}),f(`error`,`cli_websocket_connect_error`)}),r(this,`onBunClose`,e=>{let t=e.code===1e3||e.code===1001;u(`WebSocketTransport: Closed: ${e.code}`,t?void 0:{level:`error`}),f(`error`,`cli_websocket_connect_closed`),this.handleConnectionError(e.code)}),r(this,`onNodeOpen`,()=>{let e=this.ws;if(this.handleOpenEvent(),!e)return;let t=e.upgradeReq;if(t?.headers?.[`x-last-request-id`]){let e=t.headers[`x-last-request-id`];this.replayBufferedMessages(e)}}),r(this,`onNodeMessage`,e=>{let t=e.toString();this.lastActivityTime=Date.now(),f(`info`,`cli_websocket_message_received`,{length:t.length}),this.onData&&this.onData(t)}),r(this,`onNodeError`,e=>{u(`WebSocketTransport: Error: ${e.message}`,{level:`error`}),f(`error`,`cli_websocket_connect_error`)}),r(this,`onNodeClose`,(e,t)=>{let n=e===1e3||e===1001;u(`WebSocketTransport: Closed: ${e}`,n?void 0:{level:`error`}),f(`error`,`cli_websocket_connect_closed`),this.handleConnectionError(e)}),r(this,`onPong`,()=>{this.pongReceived=!0}),this.url=e,this.headers=t,this.sessionId=n,this.refreshHeaders=i,this.autoReconnect=a?.autoReconnect??!0,this.isBridge=a?.isBridge??!1,this.messageBuffer=new o(A)}async connect(){if(this.state!==`idle`&&this.state!==`reconnecting`){u(`WebSocketTransport: Cannot connect, current state is ${this.state}`,{level:`error`}),f(`error`,`cli_websocket_connect_failed`);return}this.state=`reconnecting`,this.connectStartTime=Date.now(),u(`WebSocketTransport: Opening ${this.url.href}`),f(`info`,`cli_websocket_connect_opening`);let e={...this.headers};if(this.lastSentId&&(e[`X-Last-Request-Id`]=this.lastSentId,u(`WebSocketTransport: Adding X-Last-Request-Id header: ${this.lastSentId}`)),typeof Bun<`u`){let t=new globalThis.WebSocket(this.url.href,{headers:e,proxy:g(this.url.href),tls:y()||void 0});this.ws=t,this.isBunWs=!0,t.addEventListener(`open`,this.onBunOpen),t.addEventListener(`message`,this.onBunMessage),t.addEventListener(`error`,this.onBunError),t.addEventListener(`close`,this.onBunClose),t.addEventListener(`pong`,this.onPong)}else{let{default:t}=await import(`./wrapper-K8ZapJVu.js`),n=new t(this.url.href,{headers:e,agent:b(this.url.href),...y()});this.ws=n,this.isBunWs=!1,n.on(`open`,this.onNodeOpen),n.on(`message`,this.onNodeMessage),n.on(`error`,this.onNodeError),n.on(`close`,this.onNodeClose),n.on(`pong`,this.onPong)}}handleOpenEvent(){let e=Date.now()-this.connectStartTime;u(`WebSocketTransport: Connected`),f(`info`,`cli_websocket_connect_connected`,{duration_ms:e}),this.isBridge&&this.reconnectStartTime!==null&&h(`tengu_ws_transport_reconnected`,{attempts:this.reconnectAttempts,downtimeMs:Date.now()-this.reconnectStartTime}),this.reconnectAttempts=0,this.reconnectStartTime=null,this.lastReconnectAttemptTime=null,this.lastActivityTime=Date.now(),this.state=`connected`,this.onConnectCallback?.(),this.startPingInterval(),this.startKeepaliveInterval(),C(()=>{this.write({type:`keep_alive`})})}sendLine(e){if(!this.ws||this.state!==`connected`)return u(`WebSocketTransport: Not connected`),f(`info`,`cli_websocket_send_not_connected`),!1;try{return this.ws.send(e),this.lastActivityTime=Date.now(),!0}catch(e){return u(`WebSocketTransport: Failed to send: ${e}`,{level:`error`}),f(`error`,`cli_websocket_send_error`),this.handleConnectionError(),!1}}removeWsListeners(e){if(this.isBunWs){let t=e;t.removeEventListener(`open`,this.onBunOpen),t.removeEventListener(`message`,this.onBunMessage),t.removeEventListener(`error`,this.onBunError),t.removeEventListener(`close`,this.onBunClose),t.removeEventListener(`pong`,this.onPong)}else{let t=e;t.off(`open`,this.onNodeOpen),t.off(`message`,this.onNodeMessage),t.off(`error`,this.onNodeError),t.off(`close`,this.onNodeClose),t.off(`pong`,this.onPong)}}doDisconnect(){this.stopPingInterval(),this.stopKeepaliveInterval(),w(),this.ws&&(this.removeWsListeners(this.ws),this.ws.close(),this.ws=null)}handleConnectionError(e){if(T(`WS handleConnectionError: code=${e} state=${this.state} url=${this.url.href.replace(/token=[^&]+/,`token=***`)} msSinceLastActivity=${this.lastActivityTime>0?Date.now()-this.lastActivityTime:-1} reconnectAttempts=${this.reconnectAttempts}`),u(`WebSocketTransport: Disconnected from ${this.url.href}`+(e==null?``:` (code ${e})`)),f(`info`,`cli_websocket_disconnected`),this.isBridge&&h(`tengu_ws_transport_closed`,{closeCode:e,msSinceLastActivity:this.lastActivityTime>0?Date.now()-this.lastActivityTime:-1,wasConnected:this.state===`connected`,reconnectAttempts:this.reconnectAttempts}),this.doDisconnect(),this.state===`closing`||this.state===`closed`)return;let t=!1;if(e===4003&&this.refreshHeaders){let e=this.refreshHeaders();e.Authorization!==this.headers.Authorization&&(Object.assign(this.headers,e),t=!0,u(`WebSocketTransport: 4003 received but headers refreshed, scheduling reconnect`),f(`info`,`cli_websocket_4003_token_refreshed`))}if(e!=null&&L.has(e)&&!t){u(`WebSocketTransport: Permanent close code ${e}, not reconnecting`,{level:`error`}),f(`error`,`cli_websocket_permanent_close`,{closeCode:e}),this.state=`closed`,this.onCloseCallback?.(e);return}if(!this.autoReconnect){this.state=`closed`,this.onCloseCallback?.(e);return}let n=Date.now();this.reconnectStartTime||(this.reconnectStartTime=n),this.lastReconnectAttemptTime!==null&&n-this.lastReconnectAttemptTime>I&&(u(`WebSocketTransport: Detected system sleep (${Math.round((n-this.lastReconnectAttemptTime)/1e3)}s gap), resetting reconnection budget`),f(`info`,`cli_websocket_sleep_detected`,{gapMs:n-this.lastReconnectAttemptTime}),this.reconnectStartTime=n,this.reconnectAttempts=0),this.lastReconnectAttemptTime=n;let r=n-this.reconnectStartTime;if(r<N){if(this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null),!t&&this.refreshHeaders){let e=this.refreshHeaders();Object.assign(this.headers,e),u(`WebSocketTransport: Refreshed headers for reconnect`)}this.state=`reconnecting`,this.reconnectAttempts++;let e=Math.min(j*2**(this.reconnectAttempts-1),M),n=Math.max(0,e+e*.25*(2*Math.random()-1));u(`WebSocketTransport: Reconnecting in ${Math.round(n)}ms (attempt ${this.reconnectAttempts}, ${Math.round(r/1e3)}s elapsed)`),f(`error`,`cli_websocket_reconnect_attempt`,{reconnectAttempts:this.reconnectAttempts}),this.isBridge&&h(`tengu_ws_transport_reconnecting`,{attempt:this.reconnectAttempts,elapsedMs:r,delayMs:Math.round(n)}),this.reconnectTimer=setTimeout(()=>{this.reconnectTimer=null,this.connect()},n)}else u(`WebSocketTransport: Reconnection time budget exhausted after ${Math.round(r/1e3)}s for ${this.url.href}`,{level:`error`}),f(`error`,`cli_websocket_reconnect_exhausted`,{reconnectAttempts:this.reconnectAttempts,elapsedMs:r}),this.state=`closed`,this.onCloseCallback&&this.onCloseCallback(e)}close(){this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null),this.stopPingInterval(),this.stopKeepaliveInterval(),w(),this.state=`closing`,this.doDisconnect()}replayBufferedMessages(e){let t=this.messageBuffer.toArray();if(t.length===0)return;let n=0;if(e){let r=t.findIndex(t=>`uuid`in t&&t.uuid===e);if(r>=0){n=r+1;let e=t.slice(n);this.messageBuffer.clear(),this.messageBuffer.addAll(e),e.length===0&&(this.lastSentId=null),u(`WebSocketTransport: Evicted ${n} confirmed messages, ${e.length} remaining`),f(`info`,`cli_websocket_evicted_confirmed_messages`,{evicted:n,remaining:e.length})}}let r=t.slice(n);if(r.length===0){u(`WebSocketTransport: No new messages to replay`),f(`info`,`cli_websocket_no_messages_to_replay`);return}u(`WebSocketTransport: Replaying ${r.length} buffered messages`),f(`info`,`cli_websocket_messages_to_replay`,{count:r.length});for(let e of r){let t=d(e)+`
1
+ import{l as e,o as t}from"./envUtils-DSxRz_kt.js";import{n,t as r}from"./defineProperty-C-QyHrDq.js";import{n as i,t as a}from"./axios-DaWTGg7G.js";import{Kv as o,qv as s}from"./loadAgentsDir-ByO8eJqU.js";import{S as c,a as l,l as u,w as d}from"./debug-RZ4NuXyS.js";import{O as f,k as p}from"./git-BerW9bId.js";import{n as m,r as h}from"./analytics-CkYUHW_U.js";import{c as g,h as _,l as v,m as y,s as b}from"./proxy-BmtEnJ02.js";import{F as x,I as S,S as C,g as w,v as T}from"./sessionState-CjNY991n.js";import{n as E,t as D}from"./rcDebugLog-CARUIORE.js";import{r as O}from"./ccrClient-BC2q3k44.js";a(),S(),m(),s(),l(),D(),f(),t(),_(),v(),w(),c(),n();var k=`{"type":"keep_alive"}
2
+ `,A=1e3,j=1e3,M=3e4,N=6e5,P=1e4,F=12e4,I=M*2,L=new Set([1002,4001,4003]),R=class{constructor(e,t={},n,i,a){r(this,`ws`,null),r(this,`lastSentId`,null),r(this,`url`,void 0),r(this,`state`,`idle`),r(this,`onData`,void 0),r(this,`onCloseCallback`,void 0),r(this,`onConnectCallback`,void 0),r(this,`headers`,void 0),r(this,`sessionId`,void 0),r(this,`autoReconnect`,void 0),r(this,`isBridge`,void 0),r(this,`reconnectAttempts`,0),r(this,`reconnectStartTime`,null),r(this,`reconnectTimer`,null),r(this,`lastReconnectAttemptTime`,null),r(this,`lastActivityTime`,0),r(this,`pingInterval`,null),r(this,`pongReceived`,!0),r(this,`keepAliveInterval`,null),r(this,`messageBuffer`,void 0),r(this,`isBunWs`,!1),r(this,`connectStartTime`,0),r(this,`refreshHeaders`,void 0),r(this,`onBunOpen`,()=>{this.handleOpenEvent(),this.lastSentId&&this.replayBufferedMessages(``)}),r(this,`onBunMessage`,e=>{let t=typeof e.data==`string`?e.data:String(e.data);this.lastActivityTime=Date.now(),p(`info`,`cli_websocket_message_received`,{length:t.length}),this.onData&&this.onData(t)}),r(this,`onBunError`,()=>{u(`WebSocketTransport: Error`,{level:`error`}),p(`error`,`cli_websocket_connect_error`)}),r(this,`onBunClose`,e=>{let t=e.code===1e3||e.code===1001;u(`WebSocketTransport: Closed: ${e.code}`,t?void 0:{level:`error`}),p(`error`,`cli_websocket_connect_closed`),this.handleConnectionError(e.code)}),r(this,`onNodeOpen`,()=>{let e=this.ws;if(this.handleOpenEvent(),!e)return;let t=e.upgradeReq;if(t?.headers?.[`x-last-request-id`]){let e=t.headers[`x-last-request-id`];this.replayBufferedMessages(e)}}),r(this,`onNodeMessage`,e=>{let t=e.toString();this.lastActivityTime=Date.now(),p(`info`,`cli_websocket_message_received`,{length:t.length}),this.onData&&this.onData(t)}),r(this,`onNodeError`,e=>{u(`WebSocketTransport: Error: ${e.message}`,{level:`error`}),p(`error`,`cli_websocket_connect_error`)}),r(this,`onNodeClose`,(e,t)=>{let n=e===1e3||e===1001;u(`WebSocketTransport: Closed: ${e}`,n?void 0:{level:`error`}),p(`error`,`cli_websocket_connect_closed`),this.handleConnectionError(e)}),r(this,`onPong`,()=>{this.pongReceived=!0}),this.url=e,this.headers=t,this.sessionId=n,this.refreshHeaders=i,this.autoReconnect=a?.autoReconnect??!0,this.isBridge=a?.isBridge??!1,this.messageBuffer=new o(A)}async connect(){if(this.state!==`idle`&&this.state!==`reconnecting`){u(`WebSocketTransport: Cannot connect, current state is ${this.state}`,{level:`error`}),p(`error`,`cli_websocket_connect_failed`);return}this.state=`reconnecting`,this.connectStartTime=Date.now(),u(`WebSocketTransport: Opening ${this.url.href}`),p(`info`,`cli_websocket_connect_opening`);let e={...this.headers};if(this.lastSentId&&(e[`X-Last-Request-Id`]=this.lastSentId,u(`WebSocketTransport: Adding X-Last-Request-Id header: ${this.lastSentId}`)),typeof Bun<`u`){let t=new globalThis.WebSocket(this.url.href,{headers:e,proxy:g(this.url.href),tls:y()||void 0});this.ws=t,this.isBunWs=!0,t.addEventListener(`open`,this.onBunOpen),t.addEventListener(`message`,this.onBunMessage),t.addEventListener(`error`,this.onBunError),t.addEventListener(`close`,this.onBunClose),t.addEventListener(`pong`,this.onPong)}else{let{default:t}=await import(`./wrapper-K8ZapJVu.js`),n=new t(this.url.href,{headers:e,agent:b(this.url.href),...y()});this.ws=n,this.isBunWs=!1,n.on(`open`,this.onNodeOpen),n.on(`message`,this.onNodeMessage),n.on(`error`,this.onNodeError),n.on(`close`,this.onNodeClose),n.on(`pong`,this.onPong)}}handleOpenEvent(){let e=Date.now()-this.connectStartTime;u(`WebSocketTransport: Connected`),p(`info`,`cli_websocket_connect_connected`,{duration_ms:e}),this.isBridge&&this.reconnectStartTime!==null&&h(`tengu_ws_transport_reconnected`,{attempts:this.reconnectAttempts,downtimeMs:Date.now()-this.reconnectStartTime}),this.reconnectAttempts=0,this.reconnectStartTime=null,this.lastReconnectAttemptTime=null,this.lastActivityTime=Date.now(),this.state=`connected`,this.onConnectCallback?.(),this.startPingInterval(),this.startKeepaliveInterval(),T(()=>{this.write({type:`keep_alive`})})}sendLine(e){if(!this.ws||this.state!==`connected`)return u(`WebSocketTransport: Not connected`),p(`info`,`cli_websocket_send_not_connected`),!1;try{return this.ws.send(e),this.lastActivityTime=Date.now(),!0}catch(e){return u(`WebSocketTransport: Failed to send: ${e}`,{level:`error`}),p(`error`,`cli_websocket_send_error`),this.handleConnectionError(),!1}}removeWsListeners(e){if(this.isBunWs){let t=e;t.removeEventListener(`open`,this.onBunOpen),t.removeEventListener(`message`,this.onBunMessage),t.removeEventListener(`error`,this.onBunError),t.removeEventListener(`close`,this.onBunClose),t.removeEventListener(`pong`,this.onPong)}else{let t=e;t.off(`open`,this.onNodeOpen),t.off(`message`,this.onNodeMessage),t.off(`error`,this.onNodeError),t.off(`close`,this.onNodeClose),t.off(`pong`,this.onPong)}}doDisconnect(){this.stopPingInterval(),this.stopKeepaliveInterval(),C(),this.ws&&(this.removeWsListeners(this.ws),this.ws.close(),this.ws=null)}handleConnectionError(e){if(E(`WS handleConnectionError: code=${e} state=${this.state} url=${this.url.href.replace(/token=[^&]+/,`token=***`)} msSinceLastActivity=${this.lastActivityTime>0?Date.now()-this.lastActivityTime:-1} reconnectAttempts=${this.reconnectAttempts}`),u(`WebSocketTransport: Disconnected from ${this.url.href}`+(e==null?``:` (code ${e})`)),p(`info`,`cli_websocket_disconnected`),this.isBridge&&h(`tengu_ws_transport_closed`,{closeCode:e,msSinceLastActivity:this.lastActivityTime>0?Date.now()-this.lastActivityTime:-1,wasConnected:this.state===`connected`,reconnectAttempts:this.reconnectAttempts}),this.doDisconnect(),this.state===`closing`||this.state===`closed`)return;let t=!1;if(e===4003&&this.refreshHeaders){let e=this.refreshHeaders();e.Authorization!==this.headers.Authorization&&(Object.assign(this.headers,e),t=!0,u(`WebSocketTransport: 4003 received but headers refreshed, scheduling reconnect`),p(`info`,`cli_websocket_4003_token_refreshed`))}if(e!=null&&L.has(e)&&!t){u(`WebSocketTransport: Permanent close code ${e}, not reconnecting`,{level:`error`}),p(`error`,`cli_websocket_permanent_close`,{closeCode:e}),this.state=`closed`,this.onCloseCallback?.(e);return}if(!this.autoReconnect){this.state=`closed`,this.onCloseCallback?.(e);return}let n=Date.now();this.reconnectStartTime||(this.reconnectStartTime=n),this.lastReconnectAttemptTime!==null&&n-this.lastReconnectAttemptTime>I&&(u(`WebSocketTransport: Detected system sleep (${Math.round((n-this.lastReconnectAttemptTime)/1e3)}s gap), resetting reconnection budget`),p(`info`,`cli_websocket_sleep_detected`,{gapMs:n-this.lastReconnectAttemptTime}),this.reconnectStartTime=n,this.reconnectAttempts=0),this.lastReconnectAttemptTime=n;let r=n-this.reconnectStartTime;if(r<N){if(this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null),!t&&this.refreshHeaders){let e=this.refreshHeaders();Object.assign(this.headers,e),u(`WebSocketTransport: Refreshed headers for reconnect`)}this.state=`reconnecting`,this.reconnectAttempts++;let e=Math.min(j*2**(this.reconnectAttempts-1),M),n=Math.max(0,e+e*.25*(2*Math.random()-1));u(`WebSocketTransport: Reconnecting in ${Math.round(n)}ms (attempt ${this.reconnectAttempts}, ${Math.round(r/1e3)}s elapsed)`),p(`error`,`cli_websocket_reconnect_attempt`,{reconnectAttempts:this.reconnectAttempts}),this.isBridge&&h(`tengu_ws_transport_reconnecting`,{attempt:this.reconnectAttempts,elapsedMs:r,delayMs:Math.round(n)}),this.reconnectTimer=setTimeout(()=>{this.reconnectTimer=null,this.connect()},n)}else u(`WebSocketTransport: Reconnection time budget exhausted after ${Math.round(r/1e3)}s for ${this.url.href}`,{level:`error`}),p(`error`,`cli_websocket_reconnect_exhausted`,{reconnectAttempts:this.reconnectAttempts,elapsedMs:r}),this.state=`closed`,this.onCloseCallback&&this.onCloseCallback(e)}close(){this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null),this.stopPingInterval(),this.stopKeepaliveInterval(),C(),this.state=`closing`,this.doDisconnect()}replayBufferedMessages(e){let t=this.messageBuffer.toArray();if(t.length===0)return;let n=0;if(e){let r=t.findIndex(t=>`uuid`in t&&t.uuid===e);if(r>=0){n=r+1;let e=t.slice(n);this.messageBuffer.clear(),this.messageBuffer.addAll(e),e.length===0&&(this.lastSentId=null),u(`WebSocketTransport: Evicted ${n} confirmed messages, ${e.length} remaining`),p(`info`,`cli_websocket_evicted_confirmed_messages`,{evicted:n,remaining:e.length})}}let r=t.slice(n);if(r.length===0){u(`WebSocketTransport: No new messages to replay`),p(`info`,`cli_websocket_no_messages_to_replay`);return}u(`WebSocketTransport: Replaying ${r.length} buffered messages`),p(`info`,`cli_websocket_messages_to_replay`,{count:r.length});for(let e of r){let t=d(e)+`
3
3
  `;if(!this.sendLine(t)){this.handleConnectionError();break}}}isConnectedStatus(){return this.state===`connected`}isClosedStatus(){return this.state===`closed`}setOnData(e){this.onData=e}setOnConnect(e){this.onConnectCallback=e}setOnClose(e){this.onCloseCallback=e}getStateLabel(){return this.state}async write(e){`uuid`in e&&typeof e.uuid==`string`&&(this.messageBuffer.add(e),this.lastSentId=e.uuid);let t=d(e)+`
4
- `;if(this.state!==`connected`)return;let n=this.sessionId?` session=${this.sessionId}`:``,r=this.getControlMessageDetailLabel(e);u(`WebSocketTransport: Sending message type=${e.type}${n}${r}`),this.sendLine(t)}getControlMessageDetailLabel(e){if(e.type===`control_request`){let{request_id:t,request:n}=e,r=n.subtype===`can_use_tool`?n.tool_name:``;return` subtype=${n.subtype} request_id=${t}${r?` tool=${r}`:``}`}if(e.type===`control_response`){let{subtype:t,request_id:n}=e.response;return` subtype=${t} request_id=${n}`}return``}startPingInterval(){this.stopPingInterval(),this.pongReceived=!0;let e=Date.now();this.pingInterval=setInterval(()=>{if(this.state===`connected`&&this.ws){let t=Date.now(),n=t-e;if(e=t,n>I){u(`WebSocketTransport: ${Math.round(n/1e3)}s tick gap detected — process was suspended, forcing reconnect`),f(`info`,`cli_websocket_sleep_detected_on_ping`,{gapMs:n}),this.handleConnectionError();return}if(!this.pongReceived){u(`WebSocketTransport: No pong received, connection appears dead`,{level:`error`}),f(`error`,`cli_websocket_pong_timeout`),this.handleConnectionError();return}this.pongReceived=!1;try{this.ws.ping?.()}catch(e){u(`WebSocketTransport: Ping failed: ${e}`,{level:`error`}),f(`error`,`cli_websocket_ping_failed`)}}},P)}stopPingInterval(){this.pingInterval&&(clearInterval(this.pingInterval),this.pingInterval=null)}startKeepaliveInterval(){this.stopKeepaliveInterval(),!e(process.env.CLAUDE_CODE_REMOTE)&&(this.keepAliveInterval=setInterval(()=>{if(this.state===`connected`&&this.ws)try{this.ws.send(k),this.lastActivityTime=Date.now(),u(`WebSocketTransport: Sent periodic keep_alive data frame`)}catch(e){u(`WebSocketTransport: Periodic keep_alive failed: ${e}`,{level:`error`}),f(`error`,`cli_websocket_keepalive_failed`)}},F))}stopKeepaliveInterval(){this.keepAliveInterval&&(clearInterval(this.keepAliveInterval),this.keepAliveInterval=null)}};l(),D(),p(),n();var z=100,B=15e3,V=3e3,H=class extends R{constructor(e,t={},n,i,a){super(e,t,n,i,a),r(this,`postUrl`,void 0),r(this,`uploader`,void 0),r(this,`streamEventBuffer`,[]),r(this,`streamEventTimer`,null);let{maxConsecutiveFailures:o,onBatchDropped:s}=a??{};this.postUrl=U(e),this.uploader=new O({maxBatchSize:500,maxQueueSize:1e4,baseDelayMs:500,maxDelayMs:8e3,jitterMs:1e3,maxConsecutiveFailures:o,onBatchDropped:(e,t)=>{f(`error`,`cli_hybrid_batch_dropped_max_failures`,{batchSize:e,failures:t}),s?.(e,t)},send:e=>this.postOnce(e)}),u(`HybridTransport: POST URL = ${this.postUrl}`),f(`info`,`cli_hybrid_transport_initialized`)}async write(e){if(e.type===`stream_event`){this.streamEventBuffer.push(e),this.streamEventTimer||(this.streamEventTimer=setTimeout(()=>this.flushStreamEvents(),z));return}return await this.uploader.enqueue([...this.takeStreamEvents(),e]),this.uploader.flush()}async writeBatch(e){return await this.uploader.enqueue([...this.takeStreamEvents(),...e]),this.uploader.flush()}get droppedBatchCount(){return this.uploader.droppedBatchCount}flush(){return this.uploader.enqueue(this.takeStreamEvents()),this.uploader.flush()}takeStreamEvents(){this.streamEventTimer&&(clearTimeout(this.streamEventTimer),this.streamEventTimer=null);let e=this.streamEventBuffer;return this.streamEventBuffer=[],e}flushStreamEvents(){this.streamEventTimer=null,this.uploader.enqueue(this.takeStreamEvents())}close(){this.streamEventTimer&&(clearTimeout(this.streamEventTimer),this.streamEventTimer=null),this.streamEventBuffer=[];let e=this.uploader,t;Promise.race([e.flush(),new Promise(e=>{t=setTimeout(e,V)})]).finally(()=>{clearTimeout(t),e.close()}),super.close()}async postOnce(e){let t=x();if(!t){u(`HybridTransport: No session token available for POST`),f(`warn`,`cli_hybrid_post_no_token`);return}let n={Authorization:`Bearer ${t}`,"Content-Type":`application/json`},r;try{r=await i.post(this.postUrl,{events:e},{headers:n,validateStatus:()=>!0,timeout:B})}catch(e){throw u(`HybridTransport: POST error: ${e.message}`),f(`warn`,`cli_hybrid_post_network_error`),e}if(r.status>=200&&r.status<300){u(`HybridTransport: POST success count=${e.length}`);return}if(r.status>=400&&r.status<500&&r.status!==429){T(`Hybrid POST ${r.status}: url=${this.postUrl.replace(/token=[^&]+/,`token=***`)} events=${e.length} body=${JSON.stringify(r.data).slice(0,200)}`),u(`HybridTransport: POST returned ${r.status} (permanent), dropping`),f(`warn`,`cli_hybrid_post_client_error`,{status:r.status});return}throw u(`HybridTransport: POST returned ${r.status} (retryable)`),f(`warn`,`cli_hybrid_post_retryable_error`,{status:r.status}),Error(`POST failed with ${r.status}`)}};function U(e){let t=e.protocol===`wss:`?`https:`:`http:`,n=e.pathname;return n=n.replace(`/ws/`,`/session/`),n.endsWith(`/events`)||(n=n.endsWith(`/`)?n+`events`:n+`/events`),`${t}//${e.host}${n}${e.search}`}export{R as n,H as t};
4
+ `;if(this.state!==`connected`)return;let n=this.sessionId?` session=${this.sessionId}`:``,r=this.getControlMessageDetailLabel(e);u(`WebSocketTransport: Sending message type=${e.type}${n}${r}`),this.sendLine(t)}getControlMessageDetailLabel(e){if(e.type===`control_request`){let{request_id:t,request:n}=e,r=n.subtype===`can_use_tool`?n.tool_name:``;return` subtype=${n.subtype} request_id=${t}${r?` tool=${r}`:``}`}if(e.type===`control_response`){let{subtype:t,request_id:n}=e.response;return` subtype=${t} request_id=${n}`}return``}startPingInterval(){this.stopPingInterval(),this.pongReceived=!0;let e=Date.now();this.pingInterval=setInterval(()=>{if(this.state===`connected`&&this.ws){let t=Date.now(),n=t-e;if(e=t,n>I){u(`WebSocketTransport: ${Math.round(n/1e3)}s tick gap detected — process was suspended, forcing reconnect`),p(`info`,`cli_websocket_sleep_detected_on_ping`,{gapMs:n}),this.handleConnectionError();return}if(!this.pongReceived){u(`WebSocketTransport: No pong received, connection appears dead`,{level:`error`}),p(`error`,`cli_websocket_pong_timeout`),this.handleConnectionError();return}this.pongReceived=!1;try{this.ws.ping?.()}catch(e){u(`WebSocketTransport: Ping failed: ${e}`,{level:`error`}),p(`error`,`cli_websocket_ping_failed`)}}},P)}stopPingInterval(){this.pingInterval&&(clearInterval(this.pingInterval),this.pingInterval=null)}startKeepaliveInterval(){this.stopKeepaliveInterval(),!e(process.env.CLAUDE_CODE_REMOTE)&&(this.keepAliveInterval=setInterval(()=>{if(this.state===`connected`&&this.ws)try{this.ws.send(k),this.lastActivityTime=Date.now(),u(`WebSocketTransport: Sent periodic keep_alive data frame`)}catch(e){u(`WebSocketTransport: Periodic keep_alive failed: ${e}`,{level:`error`}),p(`error`,`cli_websocket_keepalive_failed`)}},F))}stopKeepaliveInterval(){this.keepAliveInterval&&(clearInterval(this.keepAliveInterval),this.keepAliveInterval=null)}};l(),D(),f(),n();var z=100,B=15e3,V=3e3,H=class extends R{constructor(e,t={},n,i,a){super(e,t,n,i,a),r(this,`postUrl`,void 0),r(this,`uploader`,void 0),r(this,`streamEventBuffer`,[]),r(this,`streamEventTimer`,null);let{maxConsecutiveFailures:o,onBatchDropped:s}=a??{};this.postUrl=U(e),this.uploader=new O({maxBatchSize:500,maxQueueSize:1e4,baseDelayMs:500,maxDelayMs:8e3,jitterMs:1e3,maxConsecutiveFailures:o,onBatchDropped:(e,t)=>{p(`error`,`cli_hybrid_batch_dropped_max_failures`,{batchSize:e,failures:t}),s?.(e,t)},send:e=>this.postOnce(e)}),u(`HybridTransport: POST URL = ${this.postUrl}`),p(`info`,`cli_hybrid_transport_initialized`)}async write(e){if(e.type===`stream_event`){this.streamEventBuffer.push(e),this.streamEventTimer||(this.streamEventTimer=setTimeout(()=>this.flushStreamEvents(),z));return}return await this.uploader.enqueue([...this.takeStreamEvents(),e]),this.uploader.flush()}async writeBatch(e){return await this.uploader.enqueue([...this.takeStreamEvents(),...e]),this.uploader.flush()}get droppedBatchCount(){return this.uploader.droppedBatchCount}flush(){return this.uploader.enqueue(this.takeStreamEvents()),this.uploader.flush()}takeStreamEvents(){this.streamEventTimer&&(clearTimeout(this.streamEventTimer),this.streamEventTimer=null);let e=this.streamEventBuffer;return this.streamEventBuffer=[],e}flushStreamEvents(){this.streamEventTimer=null,this.uploader.enqueue(this.takeStreamEvents())}close(){this.streamEventTimer&&(clearTimeout(this.streamEventTimer),this.streamEventTimer=null),this.streamEventBuffer=[];let e=this.uploader,t;Promise.race([e.flush(),new Promise(e=>{t=setTimeout(e,V)})]).finally(()=>{clearTimeout(t),e.close()}),super.close()}async postOnce(e){let t=x();if(!t){u(`HybridTransport: No session token available for POST`),p(`warn`,`cli_hybrid_post_no_token`);return}let n={Authorization:`Bearer ${t}`,"Content-Type":`application/json`},r;try{r=await i.post(this.postUrl,{events:e},{headers:n,validateStatus:()=>!0,timeout:B})}catch(e){throw u(`HybridTransport: POST error: ${e.message}`),p(`warn`,`cli_hybrid_post_network_error`),e}if(r.status>=200&&r.status<300){u(`HybridTransport: POST success count=${e.length}`);return}if(r.status>=400&&r.status<500&&r.status!==429){E(`Hybrid POST ${r.status}: url=${this.postUrl.replace(/token=[^&]+/,`token=***`)} events=${e.length} body=${JSON.stringify(r.data).slice(0,200)}`),u(`HybridTransport: POST returned ${r.status} (permanent), dropping`),p(`warn`,`cli_hybrid_post_client_error`,{status:r.status});return}throw u(`HybridTransport: POST returned ${r.status} (retryable)`),p(`warn`,`cli_hybrid_post_retryable_error`,{status:r.status}),Error(`POST failed with ${r.status}`)}};function U(e){let t=e.protocol===`wss:`?`https:`:`http:`,n=e.pathname;return n=n.replace(`/ws/`,`/session/`),n.endsWith(`/events`)||(n=n.endsWith(`/`)?n+`events`:n+`/events`),`${t}//${e.host}${n}${e.search}`}export{R as n,H as t};
@@ -1 +1 @@
1
- import"./rolldown-runtime-DaDcL9Zw.js";import{I as e,P as t,fi as n,kn as r,t as i,y as a}from"./src-CDCSSo0U2.js";import{t as o}from"./jsx-runtime-Bb4Xn-E0.js";import{NS as s,PS as c,bb as l,ix as u,rx as d,yb as f}from"./loadAgentsDir-x3rlgED4.js";import{E as p,S as m,w as h}from"./debug-BrXObCdR.js";import{t as g}from"./renderOptions-BUJB9nAm.js";n(),i(),l(),c(),m(),d();var _=o();function v({filePath:n,errorDescription:r,onExit:i,onReset:o}){return(0,_.jsxs)(a,{title:`Configuration Error`,color:`error`,onCancel:i,children:[(0,_.jsxs)(e,{flexDirection:`column`,gap:1,children:[(0,_.jsxs)(t,{children:[`The configuration file at `,(0,_.jsx)(t,{bold:!0,children:n}),` contains invalid JSON.`]}),(0,_.jsx)(t,{children:r})]}),(0,_.jsxs)(e,{flexDirection:`column`,children:[(0,_.jsx)(t,{bold:!0,children:`Choose an option:`}),(0,_.jsx)(u,{options:[{label:`Exit and fix manually`,value:`exit`},{label:`Reset with default configuration`,value:`reset`}],onChange:e=>{e===`exit`?i():o()},onCancel:i})]})]})}var y=`dark`;async function b({error:e}){let t={...g(!1),theme:y};await new Promise(async n=>{let{unmount:i}=await r((0,_.jsx)(s,{children:(0,_.jsx)(f,{children:(0,_.jsx)(v,{filePath:e.filePath,errorDescription:e.message,onExit:()=>{i(),n(),process.exit(1)},onReset:()=>{p(e.filePath,h(e.defaultConfig,null,2),{flush:!1,encoding:`utf8`}),i(),n(),process.exit(0)}})})}),t)})}export{b as showInvalidConfigDialog};
1
+ import"./rolldown-runtime-DaDcL9Zw.js";import{I as e,P as t,fi as n,kn as r,t as i,y as a}from"./src-CDCSSo0U2.js";import{t as o}from"./jsx-runtime-Bb4Xn-E0.js";import{Rp as s,_v as c,gv as l,op as u,sp as d,zp as f}from"./loadAgentsDir-ByO8eJqU.js";import{E as p,S as m,w as h}from"./debug-RZ4NuXyS.js";import{t as g}from"./renderOptions-ChLwxtVu.js";n(),i(),d(),c(),m(),s();var _=o();function v({filePath:n,errorDescription:r,onExit:i,onReset:o}){return(0,_.jsxs)(a,{title:`Configuration Error`,color:`error`,onCancel:i,children:[(0,_.jsxs)(e,{flexDirection:`column`,gap:1,children:[(0,_.jsxs)(t,{children:[`The configuration file at `,(0,_.jsx)(t,{bold:!0,children:n}),` contains invalid JSON.`]}),(0,_.jsx)(t,{children:r})]}),(0,_.jsxs)(e,{flexDirection:`column`,children:[(0,_.jsx)(t,{bold:!0,children:`Choose an option:`}),(0,_.jsx)(f,{options:[{label:`Exit and fix manually`,value:`exit`},{label:`Reset with default configuration`,value:`reset`}],onChange:e=>{e===`exit`?i():o()},onCancel:i})]})]})}var y=`dark`;async function b({error:e}){let t={...g(!1),theme:y};await new Promise(async n=>{let{unmount:i}=await r((0,_.jsx)(l,{children:(0,_.jsx)(u,{children:(0,_.jsx)(v,{filePath:e.filePath,errorDescription:e.message,onExit:()=>{i(),n(),process.exit(1)},onReset:()=>{p(e.filePath,h(e.defaultConfig,null,2),{flush:!1,encoding:`utf8`}),i(),n(),process.exit(0)}})})}),t)})}export{b as showInvalidConfigDialog};
@@ -1 +1 @@
1
- import"./rolldown-runtime-DaDcL9Zw.js";import{P as e,fi as t,t as n,y as r}from"./src-CDCSSo0U2.js";import{t as i}from"./jsx-runtime-Bb4Xn-E0.js";import{ix as a,rx as o}from"./loadAgentsDir-x3rlgED4.js";import{n as s,t as c}from"./ValidationErrorsList-BYsDtAvX.js";t(),n(),o(),s();var l=i();function u({settingsErrors:t,onContinue:n,onExit:i}){function o(e){e===`exit`?i():n()}return(0,l.jsxs)(r,{title:`Settings Error`,onCancel:i,color:`warning`,children:[(0,l.jsx)(c,{errors:t}),(0,l.jsx)(e,{dimColor:!0,children:`Files with errors are skipped entirely, not just the invalid settings.`}),(0,l.jsx)(a,{options:[{label:`Exit and fix manually`,value:`exit`},{label:`Continue without these settings`,value:`continue`}],onChange:o})]})}export{u as InvalidSettingsDialog};
1
+ import"./rolldown-runtime-DaDcL9Zw.js";import{P as e,fi as t,t as n,y as r}from"./src-CDCSSo0U2.js";import{t as i}from"./jsx-runtime-Bb4Xn-E0.js";import{Rp as a,zp as o}from"./loadAgentsDir-ByO8eJqU.js";import{n as s,t as c}from"./ValidationErrorsList-DokTJQwi.js";t(),n(),a(),s();var l=i();function u({settingsErrors:t,onContinue:n,onExit:i}){function a(e){e===`exit`?i():n()}return(0,l.jsxs)(r,{title:`Settings Error`,onCancel:i,color:`warning`,children:[(0,l.jsx)(c,{errors:t}),(0,l.jsx)(e,{dimColor:!0,children:`Files with errors are skipped entirely, not just the invalid settings.`}),(0,l.jsx)(o,{options:[{label:`Exit and fix manually`,value:`exit`},{label:`Continue without these settings`,value:`continue`}],onChange:a})]})}export{u as InvalidSettingsDialog};
@@ -0,0 +1 @@
1
+ import{a as e,n as t,o as n}from"./rolldown-runtime-DaDcL9Zw.js";import{fi as r}from"./src-CDCSSo0U2.js";import{t as i}from"./jsx-runtime-Bb4Xn-E0.js";import{$t as a,mt as o}from"./state-C2OSZkV1.js";import{AT as s,BC as c,BE as l,DC as u,DT as d,ES as f,ET as p,GC as m,Gm as ee,IC as h,KC as g,MC as _,NC as v,NS as y,OS as b,PC as te,PS as x,SS as S,TS as C,VC as w,VE as T,Wm as E,YC as D,_v as O,bC as ne,bv as re,jS as k,jT as A,kS as ie,mC as ae,qC as oe,vv as j,wS as M,yv as se}from"./loadAgentsDir-ByO8eJqU.js";import{F as N,a as ce,l as le,z as P}from"./debug-RZ4NuXyS.js";import{it as F,nt as I}from"./settings-hQDLwPVj.js";import{c as L,l as R,o as z}from"./log-CZ0zYP_c.js";import{n as B,r as V}from"./analytics-CkYUHW_U.js";import{n as H,t as U}from"./omit-DZCEXri5.js";import{o as ue,s as de}from"./localSearch-CHHCH16D.js";import{basename as fe}from"path";function W(e){let t=`plugin`in e?e.plugin:`no-plugin`;return`${e.type}:${e.source}:${t}`}function G(e,t){t.length!==0&&e(e=>{let n=new Set(e.plugins.errors.map(e=>W(e))),r=t.filter(e=>!n.has(W(e)));return r.length===0?e:{...e,plugins:{...e.plugins,errors:[...e.plugins.errors,...r]}}})}function pe(e,t=!1){let n=se(),r=j(e=>e.authVersion),i=j(e=>e.mcp.pluginReconnectKey),a=re(),c=(0,K.useRef)(new Map),{addNotification:l}=ee(),u=(0,K.useRef)([]),y=(0,K.useRef)(null),E=(0,K.useCallback)(()=>{y.current=null;let e=u.current;e.length!==0&&(u.current=[],a(t=>{let n=t.mcp;for(let t of e){let{tools:e,commands:r,resources:i,...a}=t,o=a.type===`disabled`||a.type===`failed`?e??[]:e,s=a.type===`disabled`||a.type===`failed`?r??[]:r,c=a.type===`disabled`||a.type===`failed`?i??[]:i,l=I(a.name),u=n.clients.findIndex(e=>e.name===a.name)===-1?[...n.clients,a]:n.clients.map(e=>e.name===a.name?a:e),d=o===void 0?n.tools:[...T(n.tools,e=>e.name?.startsWith(l)),...o],f=s===void 0?n.commands:[...T(n.commands,e=>ae(e,a.name)),...s],p=c===void 0?n.resources:{...n.resources,...c.length>0?{[a.name]:c}:H(n.resources,a.name)};n={...n,clients:u,tools:d,commands:f,resources:p}}return{...t,mcp:n}}))},[a]),D=(0,K.useCallback)(e=>{u.current.push(e),y.current===null&&(y.current=setTimeout(E,16))},[E]),O=(0,K.useCallback)(({client:e,tools:t,commands:n,resources:r})=>{switch(D({...e,tools:t,commands:n,resources:r}),e.type){case`connected`:x(e.client,e.name,a),e.client.onclose=()=>{let t=e.config.type??`stdio`;if(S(e.name,e.config).catch(()=>{le(`Failed to invalidate the server cache: ${e.name}`)}),w(e.name)){L(e.name,`Server is disabled, skipping automatic reconnection`);return}if(t!==`stdio`&&t!==`sdk`){let n=me(t);L(e.name,`${n} transport closed/disconnected, attempting automatic reconnection`);let r=c.current.get(e.name);r&&(clearTimeout(r),c.current.delete(e.name)),(async()=>{for(let t=1;t<=J;t++){if(w(e.name)){L(e.name,`Server disabled during reconnection, stopping retry`),c.current.delete(e.name);return}D({...e,type:`pending`,reconnectAttempt:t,maxReconnectAttempts:J});let r=Date.now();try{let i=await k(e.name,e.config),a=Date.now()-r;if(i.client.type===`connected`){L(e.name,`${n} reconnection successful after ${a}ms (attempt ${t})`),c.current.delete(e.name),O(i);return}if(L(e.name,`${n} reconnection attempt ${t} completed with status: ${i.client.type}`),t===J){L(e.name,`Max reconnection attempts (${J}) reached, giving up`),c.current.delete(e.name),O(i);return}}catch(i){let a=Date.now()-r;if(R(e.name,`${n} reconnection attempt ${t} failed after ${a}ms: ${i}`),t===J){L(e.name,`Max reconnection attempts (${J}) reached, giving up`),c.current.delete(e.name),D({...e,type:`failed`});return}}let i=Math.min(Y*2**(t-1),X);L(e.name,`Scheduling reconnection attempt ${t+1} in ${i}ms`),await new Promise(t=>{let n=setTimeout(t,i);c.current.set(e.name,n)})}})()}else D({...e,type:`failed`})},e.capabilities?.tools?.listChanged&&e.client.setNotificationHandler(s,async()=>{L(e.name,`Received tools/list_changed notification, refreshing tools`);try{let t=f.cache.get(e.name);f.cache.delete(e.name);let n=await f(e),r=n.length;t?t.then(e=>{V(`tengu_mcp_list_changed`,{type:`tools`,previousCount:e.length,newCount:r})},()=>{V(`tengu_mcp_list_changed`,{type:`tools`,newCount:r})}):V(`tengu_mcp_list_changed`,{type:`tools`,newCount:r}),D({...e,tools:n})}catch(t){R(e.name,`Failed to refresh tools after list_changed notification: ${N(t)}`)}}),e.capabilities?.prompts?.listChanged&&e.client.setNotificationHandler(p,async()=>{L(e.name,`Received prompts/list_changed notification, refreshing prompts`),V(`tengu_mcp_list_changed`,{type:`prompts`});try{M.cache.delete(e.name);let[t,n]=await Promise.all([M(e),Promise.resolve([])]);D({...e,commands:[...t,...n]}),q?.()}catch(t){R(e.name,`Failed to refresh prompts after list_changed notification: ${N(t)}`)}}),e.capabilities?.resources?.listChanged&&e.client.setNotificationHandler(d,async()=>{L(e.name,`Received resources/list_changed notification, refreshing resources`),V(`tengu_mcp_list_changed`,{type:`resources`});try{C.cache.delete(e.name);{let t=await C(e);D({...e,resources:t})}}catch(t){R(e.name,`Failed to refresh resources after list_changed notification: ${N(t)}`)}});break;case`needs-auth`:case`failed`:case`pending`:case`disabled`:break}},[D]),A=o();return(0,K.useEffect)(()=>{async function n(){let{servers:n,errors:r}=t?{servers:{},errors:[]}:await h(e),i={...n,...e};G(a,r),a(e=>{let{stale:t,...n}=ne(e.mcp,i);for(let e of t){let t=c.current.get(e.name);t&&(clearTimeout(t),c.current.delete(e.name)),e.type===`connected`&&(e.client.onclose=void 0,S(e.name,e.config).catch(()=>{}))}let r=new Set(n.clients.map(e=>e.name)),a=Object.entries(i).filter(([e])=>!r.has(e)).map(([e,t])=>({name:e,type:w(e)?`disabled`:`pending`,config:t}));return a.length===0&&t.length===0?e:{...e,mcp:{...e.mcp,...n,clients:[...n.clients,...a]}}})}n().catch(e=>{R(`useManageMCPConnections`,`Failed to initialize servers as pending: ${N(e)}`)})},[t,e,a,A,i]),(0,K.useEffect)(()=>{let n=!1;async function r(){let r;t||v()?r=Promise.resolve({}):(g(),r=oe());let{servers:i,errors:o}=t?{servers:{},errors:[]}:await h(e,r);if(n)return;G(a,o);let s={...i,...e},c=Object.fromEntries(Object.entries(s).filter(([e])=>!w(e)));b(O,c).catch(e=>{R(`useManageMcpConnections`,`Failed to get MCP resources: ${N(e)}`)});let l={};if(!t){if(l=te(await r).allowed,n)return;if(Object.keys(l).length>0){let{servers:e}=_(l,s);l=e}if(Object.keys(l).length>0){a(e=>{let t=new Set(e.mcp.clients.map(e=>e.name)),n=Object.entries(l).filter(([e])=>!t.has(e)).map(([e,t])=>({name:e,type:w(e)?`disabled`:`pending`,config:t}));return n.length===0?e:{...e,mcp:{...e.mcp,clients:[...e.mcp.clients,...n]}}});let e=Object.fromEntries(Object.entries(l).filter(([e])=>!w(e)));b(O,e).catch(e=>{R(`useManageMcpConnections`,`Failed to get claude.ai MCP resources: ${N(e)}`)})}}let u={...s,...l},d={enterprise:0,global:0,project:0,user:0,plugin:0,claudeai:0},f=[];for(let[e,t]of Object.entries(u))t.scope===`enterprise`?d.enterprise++:t.scope===`user`?d.global++:t.scope===`project`?d.project++:t.scope===`local`?d.user++:t.scope===`dynamic`?d.plugin++:t.scope===`claudeai`&&d.claudeai++,process.env.USER_TYPE===`ant`&&!w(e)&&(t.type===void 0||t.type===`stdio`)&&`command`in t&&f.push(fe(t.command));V(`tengu_mcp_servers`,{...d,...process.env.USER_TYPE===`ant`&&f.length>0?{stdio_commands:f.sort().join(`,`)}:{}})}return r(),()=>{n=!0}},[t,e,O,a,r,A,i]),(0,K.useEffect)(()=>{let e=c.current;return()=>{for(let t of e.values())clearTimeout(t);e.clear(),y.current!==null&&(clearTimeout(y.current),y.current=null,E())}},[E]),{reconnectMcpServer:(0,K.useCallback)(async e=>{let t=n.getState().mcp.clients.find(t=>t.name===e);if(!t)throw Error(`MCP server ${e} not found`);let r=c.current.get(e);r&&(clearTimeout(r),c.current.delete(e));let i=await k(e,t.config);return O(i),i},[n,O]),toggleMcpServer:(0,K.useCallback)(async e=>{let t=n.getState().mcp.clients.find(t=>t.name===e);if(!t)throw Error(`MCP server ${e} not found`);if(t.type!==`disabled`){let n=c.current.get(e);n&&(clearTimeout(n),c.current.delete(e)),m(e,!1),t.type===`connected`&&await S(e,t.config),D({name:e,type:`disabled`,config:t.config})}else{m(e,!0),D({name:e,type:`pending`,config:t.config});let n=await k(e,t.config);O(n)}},[n,D,O])}}function me(e){switch(e){case`http`:return`HTTP`;case`ws`:case`ws-ide`:return`WebSocket`;default:return`SSE`}}var K,q,J,Y,X,he=t((()=>{K=n(r(),1),a(),ie(),A(),U(),l(),B(),c(),ce(),E(),O(),P(),z(),y(),D(),F(),u(),q=(ue(),e(de)).clearSkillIndexCache,J=5,Y=1e3,X=3e4}));function ge(){let e=(0,Z.useContext)($);if(!e)throw Error(`useMcpReconnect must be used within MCPConnectionManager`);return e.reconnectMcpServer}function _e(){let e=(0,Z.useContext)($);if(!e)throw Error(`useMcpToggleEnabled must be used within MCPConnectionManager`);return e.toggleMcpServer}function ve({children:e,dynamicMcpConfig:t,isStrictMcpConfig:n}){let{reconnectMcpServer:r,toggleMcpServer:i}=pe(t,n),a=(0,Z.useMemo)(()=>({reconnectMcpServer:r,toggleMcpServer:i}),[r,i]);return(0,Q.jsx)($.Provider,{value:a,children:e})}var Z,Q,$,ye=t((()=>{Z=n(r(),1),he(),Q=i(),$=(0,Z.createContext)(null)}));export{_e as i,ye as n,ge as r,ve as t};
@@ -0,0 +1 @@
1
+ import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{n,t as r}from"./figures-5ThXQEtq.js";import{D as i,H as a,I as o,Lt as s,P as c,T as l,Wt as u,dr as ee,fi as d,hn as f,j as p,ot as te,t as m,y as h}from"./src-CDCSSo0U2.js";import{t as g}from"./jsx-runtime-Bb4Xn-E0.js";import{$S as ne,BC as _,CC as re,DC as v,Jp as y,LC as b,Pw as x,QS as S,Rp as C,SS as ie,_v as w,bv as ae,dp as T,fw as E,hC as oe,im as se,kS as ce,pp as D,pw as le,qS as ue,qp as O,rm as de,tC as fe,vC as pe,vv as me,wC as k,xC as he,xw as A,yC as ge,zp as _e}from"./loadAgentsDir-ByO8eJqU.js";import{F as ve,z as j}from"./debug-RZ4NuXyS.js";import{et as M,it as N,tt as P}from"./settings-hQDLwPVj.js";import{c as ye,o as F}from"./log-CZ0zYP_c.js";import{n as I,r as L}from"./analytics-CkYUHW_U.js";import{l as be,u as R}from"./oauth-BqJqV-2M.js";import{l as xe,n as Se,o as z}from"./stringUtils-B6FudhoZ.js";import{Bt as B,jt as Ce}from"./model-CwO-g1RW.js";import{i as we,n as V,r as Te}from"./MCPConnectionManager-ao-P3xSA.js";import{n as Ee,t as H}from"./useExitOnCtrlCDWithKeybindings-Cce612uS.js";function De({serverToolsCount:e,serverPromptsCount:t,serverResourcesCount:n}){let r=[];return e>0&&r.push(`tools`),n>0&&r.push(`resources`),t>0&&r.push(`prompts`),(0,U.jsxs)(o,{children:[(0,U.jsx)(c,{bold:!0,children:`Capabilities: `}),(0,U.jsx)(c,{color:`text`,children:r.length>0?(0,U.jsx)(l,{children:r}):`none`})]})}var U,Oe=e((()=>{d(),m(),U=g()}));function ke(e,t){switch(e.client.type){case`connected`:return{message:`Reconnected to ${t}.`,success:!0};case`needs-auth`:return{message:`${t} requires authentication. Use the 'Authenticate' option.`,success:!1};case`failed`:return{message:`Failed to reconnect to ${t}.`,success:!1};default:return{message:`Unknown result when reconnecting to ${t}.`,success:!1}}}function Ae(e,t){return`Error reconnecting to ${t}: ${e instanceof Error?e.message:String(e)}`}var W=e((()=>{}));function je({server:e,serverToolsCount:t,onViewTools:n,onCancel:d,onComplete:m,borderless:h=!1}){let[g]=a(),_=Ee(),{columns:v}=te(),[y,b]=G.useState(!1),[x,S]=G.useState(null),C=me(e=>e.mcp),w=ae(),[E,se]=G.useState(null),[ce,D]=(0,G.useState)(!1),k=(0,G.useRef)(null),[A,j]=(0,G.useState)(!1),[M,N]=(0,G.useState)(null),[P,F]=(0,G.useState)(!1),[I,R]=(0,G.useState)(null),[xe,z]=(0,G.useState)(!1),[B,V]=(0,G.useState)(!1),H=(0,G.useRef)(void 0),U=(0,G.useRef)(!1),[Oe,W]=(0,G.useState)(``),[je,Me]=(0,G.useState)(0),[Ne,q]=(0,G.useState)(null);(0,G.useEffect)(()=>()=>{U.current=!0,k.current?.abort(),H.current!==void 0&&clearTimeout(H.current)},[]);let J=e.isAuthenticated||e.client.type===`connected`&&t>0,Y=Te(),Pe=G.useCallback(async()=>{j(!1),N(null),D(!0);try{let t=await Y(e.name),n=t.client.type===`connected`;L(`tengu_claudeai_mcp_auth_completed`,{success:n}),n?m?.(`Authentication successful. Connected to ${e.name}.`):t.client.type===`needs-auth`?m?.(`Authentication successful, but server still requires authentication. You may need to manually restart Claude Code.`):m?.(`Authentication successful, but server reconnection failed. You may need to manually restart Claude Code for the changes to take effect.`)}catch(t){L(`tengu_claudeai_mcp_auth_completed`,{success:!1}),m?.(Ae(t,e.name))}finally{D(!1)}},[Y,e.name,m]),X=G.useCallback(async()=>{await ie(e.name,{...e.config,scope:e.scope}),w(t=>{let n=t.mcp.clients.map(t=>t.name===e.name?{...t,type:`needs-auth`}:t),r=he(t.mcp.tools,e.name),i=pe(t.mcp.commands,e.name),a=ge(t.mcp.resources,e.name);return{...t,mcp:{...t.mcp,clients:n,tools:r,commands:i,resources:a}}}),L(`tengu_claudeai_mcp_clear_auth_completed`,{}),m?.(`Disconnected from ${e.name}.`),F(!1),R(null),z(!1)},[e.name,e.config,e.scope,w,m]);u(`confirm:no`,()=>{k.current?.abort(),k.current=null,b(!1),se(null)},{context:`Confirmation`,isActive:y}),u(`confirm:no`,()=>{j(!1),N(null)},{context:`Confirmation`,isActive:A}),u(`confirm:no`,()=>{F(!1),R(null),z(!1)},{context:`Confirmation`,isActive:P}),f((e,t)=>{if(t.return&&A&&Pe(),t.return&&P)if(xe)X();else{let e=`${be().CLAUDE_AI_ORIGIN}/settings/connectors`;R(e),z(!0),le(e)}if(e===`c`&&!B){let e=E||M||I;e&&ee(e).then(e=>{U.current||(e&&process.stdout.write(e),V(!0),H.current!==void 0&&clearTimeout(H.current),H.current=setTimeout(V,2e3,!1))})}});let Z=Se(String(e.name)),Fe=re(C.commands,e.name).length,Ie=we(),Le=G.useCallback(async()=>{let t=be().CLAUDE_AI_ORIGIN,n=Ce()?.organizationUuid,r;r=n&&e.config.type===`claudeai-proxy`&&e.config.id?`${t}/api/organizations/${n}/mcp/start-auth/${e.config.id.startsWith(`mcprs`)?`mcpsrv`+e.config.id.slice(5):e.config.id}?product_surface=${encodeURIComponent(process.env.CLAUDE_CODE_ENTRYPOINT||`cli`)}`:`${t}/settings/connectors`,N(r),j(!0),L(`tengu_claudeai_mcp_auth_started`,{}),await le(r)},[e.config]),Q=G.useCallback(()=>{F(!0),L(`tengu_claudeai_mcp_clear_auth_started`,{})},[]),Re=G.useCallback(async()=>{let t=e.client.type!==`disabled`;try{await Ie(e.name),e.config.type===`claudeai-proxy`&&L(`tengu_claudeai_mcp_toggle`,{new_state:t?`disabled`:`enabled`}),d()}catch(n){m?.(`Failed to ${t?`disable`:`enable`} MCP server '${e.name}': ${ve(n)}`)}},[e.client.type,e.config.type,e.name,Ie,d,m]),ze=G.useCallback(async()=>{if(e.config.type===`claudeai-proxy`)return;b(!0),S(null);let t=new AbortController;k.current=t;try{if(e.isAuthenticated&&e.config&&await fe(e.name,e.config,{preserveStepUpState:!0}),e.config){await ne(e.name,e.config,se,t.signal,{onWaitingForCallback:e=>{q(()=>e)}}),L(`tengu_mcp_auth_config_authenticate`,{wasAuthenticated:e.isAuthenticated});let n=await Y(e.name);if(n.client.type===`connected`){let t=J?`Authentication successful. Reconnected to ${e.name}.`:`Authentication successful. Connected to ${e.name}.`;m?.(t)}else n.client.type===`needs-auth`?m?.(`Authentication successful, but server still requires authentication. You may need to manually restart Claude Code.`):(ye(e.name,`Reconnection failed after authentication`),m?.(`Authentication successful, but server reconnection failed. You may need to manually restart Claude Code for the changes to take effect.`))}}catch(e){e instanceof Error&&!(e instanceof ue)&&S(e.message)}finally{b(!1),k.current=null,q(null),W(``)}},[e.isAuthenticated,e.config,e.name,m,Y,J]),Be=async()=>{e.config.type!==`claudeai-proxy`&&e.config&&(await fe(e.name,e.config),L(`tengu_mcp_auth_config_clear`,{}),await ie(e.name,{...e.config,scope:e.scope}),w(t=>{let n=t.mcp.clients.map(t=>t.name===e.name?{...t,type:`failed`}:t),r=he(t.mcp.tools,e.name),i=pe(t.mcp.commands,e.name),a=ge(t.mcp.resources,e.name);return{...t,mcp:{...t.mcp,clients:n,tools:r,commands:i,resources:a}}}),m?.(`Authentication cleared for ${e.name}.`))};if(y){let t=e.config.type!==`claudeai-proxy`&&e.config.oauth?.xaa?` Authenticating via your identity provider`:` A browser window will open for authentication`;return(0,K.jsxs)(o,{flexDirection:`column`,gap:1,padding:1,children:[(0,K.jsxs)(c,{color:`claude`,children:[`Authenticating with `,e.name,`…`]}),(0,K.jsxs)(o,{children:[(0,K.jsx)(T,{}),(0,K.jsx)(c,{children:t})]}),E&&(0,K.jsxs)(o,{flexDirection:`column`,children:[(0,K.jsxs)(o,{children:[(0,K.jsx)(c,{dimColor:!0,children:`If your browser doesn't open automatically, copy this URL manually `}),B?(0,K.jsx)(c,{color:`success`,children:`(Copied!)`}):(0,K.jsx)(c,{dimColor:!0,children:(0,K.jsx)(i,{shortcut:`c`,action:`copy`,parens:!0})})]}),(0,K.jsx)(s,{url:E})]}),y&&E&&Ne&&(0,K.jsxs)(o,{flexDirection:`column`,marginTop:1,children:[(0,K.jsx)(c,{dimColor:!0,children:`If the redirect page shows a connection error, paste the URL from your browser's address bar:`}),(0,K.jsxs)(o,{children:[(0,K.jsxs)(c,{dimColor:!0,children:[`URL `,`>`,` `]}),(0,K.jsx)(de,{value:Oe,onChange:W,onSubmit:e=>{Ne(e.trim()),W(``)},cursorOffset:je,onChangeCursorOffset:Me,columns:v-8})]})]}),(0,K.jsx)(o,{marginLeft:3,children:(0,K.jsx)(c,{dimColor:!0,children:`Return here after authenticating in your browser. Press Esc to go back.`})})]})}if(A)return(0,K.jsxs)(o,{flexDirection:`column`,gap:1,padding:1,children:[(0,K.jsxs)(c,{color:`claude`,children:[`Authenticating with `,e.name,`…`]}),(0,K.jsxs)(o,{children:[(0,K.jsx)(T,{}),(0,K.jsx)(c,{children:` A browser window will open for authentication`})]}),M&&(0,K.jsxs)(o,{flexDirection:`column`,children:[(0,K.jsxs)(o,{children:[(0,K.jsx)(c,{dimColor:!0,children:`If your browser doesn't open automatically, copy this URL manually `}),B?(0,K.jsx)(c,{color:`success`,children:`(Copied!)`}):(0,K.jsx)(c,{dimColor:!0,children:(0,K.jsx)(i,{shortcut:`c`,action:`copy`,parens:!0})})]}),(0,K.jsx)(s,{url:M})]}),(0,K.jsxs)(o,{marginLeft:3,flexDirection:`column`,children:[(0,K.jsxs)(c,{color:`permission`,children:[`Press `,(0,K.jsx)(c,{bold:!0,children:`Enter`}),` after authenticating in your browser.`]}),(0,K.jsx)(c,{dimColor:!0,italic:!0,children:(0,K.jsx)(O,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})})]})]});if(P)return(0,K.jsxs)(o,{flexDirection:`column`,gap:1,padding:1,children:[(0,K.jsxs)(c,{color:`claude`,children:[`Clear authentication for `,e.name]}),xe?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(c,{children:`Find the MCP server in the browser and click "Disconnect".`}),I&&(0,K.jsxs)(o,{flexDirection:`column`,children:[(0,K.jsxs)(o,{children:[(0,K.jsx)(c,{dimColor:!0,children:`If your browser didn't open automatically, copy this URL manually `}),B?(0,K.jsx)(c,{color:`success`,children:`(Copied!)`}):(0,K.jsx)(c,{dimColor:!0,children:(0,K.jsx)(i,{shortcut:`c`,action:`copy`,parens:!0})})]}),(0,K.jsx)(s,{url:I})]}),(0,K.jsxs)(o,{marginLeft:3,flexDirection:`column`,children:[(0,K.jsxs)(c,{color:`permission`,children:[`Press `,(0,K.jsx)(c,{bold:!0,children:`Enter`}),` when done.`]}),(0,K.jsx)(c,{dimColor:!0,italic:!0,children:(0,K.jsx)(O,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})})]})]}):(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(c,{children:`This will open claude.ai in the browser. Find the MCP server in the list and click "Disconnect".`}),(0,K.jsxs)(o,{marginLeft:3,flexDirection:`column`,children:[(0,K.jsxs)(c,{color:`permission`,children:[`Press `,(0,K.jsx)(c,{bold:!0,children:`Enter`}),` to open the browser.`]}),(0,K.jsx)(c,{dimColor:!0,italic:!0,children:(0,K.jsx)(O,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})})]})]})]});if(ce)return(0,K.jsxs)(o,{flexDirection:`column`,gap:1,padding:1,children:[(0,K.jsxs)(c,{color:`text`,children:[`Connecting to `,(0,K.jsx)(c,{bold:!0,children:e.name}),`…`]}),(0,K.jsxs)(o,{children:[(0,K.jsx)(T,{}),(0,K.jsx)(c,{children:` Establishing connection to MCP server`})]}),(0,K.jsx)(c,{dimColor:!0,children:`This may take a few moments.`})]});let $=[];return e.client.type===`disabled`&&$.push({label:`Enable`,value:`toggle-enabled`}),e.client.type===`connected`&&t>0&&$.push({label:`View tools`,value:`tools`}),e.config.type===`claudeai-proxy`?e.client.type===`connected`?$.push({label:`Clear authentication`,value:`claudeai-clear-auth`}):e.client.type!==`disabled`&&$.push({label:`Authenticate`,value:`claudeai-auth`}):(J&&($.push({label:`Re-authenticate`,value:`reauth`}),$.push({label:`Clear authentication`,value:`clear-auth`})),J||$.push({label:`Authenticate`,value:`auth`})),e.client.type!==`disabled`&&(e.client.type!==`needs-auth`&&$.push({label:`Reconnect`,value:`reconnectMcpServer`}),$.push({label:`Disable`,value:`toggle-enabled`})),$.length===0&&$.push({label:`Back`,value:`back`}),(0,K.jsxs)(o,{flexDirection:`column`,children:[(0,K.jsxs)(o,{flexDirection:`column`,paddingX:1,borderStyle:h?void 0:`round`,children:[(0,K.jsx)(o,{marginBottom:1,children:(0,K.jsxs)(c,{bold:!0,children:[Z,` MCP Server`]})}),(0,K.jsxs)(o,{flexDirection:`column`,gap:0,children:[(0,K.jsxs)(o,{children:[(0,K.jsx)(c,{bold:!0,children:`Status: `}),e.client.type===`disabled`?(0,K.jsxs)(c,{children:[p(`inactive`,g)(r.radioOff),` disabled`]}):e.client.type===`connected`?(0,K.jsxs)(c,{children:[p(`success`,g)(r.tick),` connected`]}):e.client.type===`pending`?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(c,{dimColor:!0,children:r.radioOff}),(0,K.jsx)(c,{children:` connecting…`})]}):e.client.type===`needs-auth`?(0,K.jsxs)(c,{children:[p(`warning`,g)(r.triangleUpOutline),` needs authentication`]}):(0,K.jsxs)(c,{children:[p(`error`,g)(r.cross),` failed`]})]}),e.transport!==`claudeai-proxy`&&(0,K.jsxs)(o,{children:[(0,K.jsx)(c,{bold:!0,children:`Auth: `}),J?(0,K.jsxs)(c,{children:[p(`success`,g)(r.tick),` authenticated`]}):(0,K.jsxs)(c,{children:[p(`error`,g)(r.cross),` not authenticated`]})]}),(0,K.jsxs)(o,{children:[(0,K.jsx)(c,{bold:!0,children:`URL: `}),(0,K.jsx)(c,{dimColor:!0,children:e.config.url})]}),(0,K.jsxs)(o,{children:[(0,K.jsx)(c,{bold:!0,children:`Config location: `}),(0,K.jsx)(c,{dimColor:!0,children:oe(e.scope)})]}),e.client.type===`connected`&&(0,K.jsx)(De,{serverToolsCount:t,serverPromptsCount:Fe,serverResourcesCount:C.resources[e.name]?.length||0}),e.client.type===`connected`&&t>0&&(0,K.jsxs)(o,{children:[(0,K.jsx)(c,{bold:!0,children:`Tools: `}),(0,K.jsxs)(c,{dimColor:!0,children:[t,` tools`]})]})]}),x&&(0,K.jsx)(o,{marginTop:1,children:(0,K.jsxs)(c,{color:`error`,children:[`Error: `,x]})}),$.length>0&&(0,K.jsx)(o,{marginTop:1,children:(0,K.jsx)(_e,{options:$,onChange:async t=>{switch(t){case`tools`:n();break;case`auth`:case`reauth`:await ze();break;case`clear-auth`:await Be();break;case`claudeai-auth`:await Le();break;case`claudeai-clear-auth`:Q();break;case`reconnectMcpServer`:D(!0);try{let t=await Y(e.name);e.config.type===`claudeai-proxy`&&L(`tengu_claudeai_mcp_reconnect`,{success:t.client.type===`connected`});let{message:n}=ke(t,e.name);m?.(n)}catch(t){e.config.type===`claudeai-proxy`&&L(`tengu_claudeai_mcp_reconnect`,{success:!1}),m?.(Ae(t,e.name))}finally{D(!1)}break;case`toggle-enabled`:await Re();break;case`back`:d();break}},onCancel:d})})]}),(0,K.jsx)(o,{marginTop:1,children:(0,K.jsx)(c,{dimColor:!0,italic:!0,children:_.pending?(0,K.jsxs)(K.Fragment,{children:[`Press `,_.keyName,` again to exit`]}):(0,K.jsxs)(l,{children:[(0,K.jsx)(i,{shortcut:`↑↓`,action:`navigate`}),(0,K.jsx)(i,{shortcut:`Enter`,action:`select`}),(0,K.jsx)(O,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]})})})]})}var G,K,Me=e((()=>{n(),G=t(d(),1),I(),R(),H(),A(),m(),x(),S(),ce(),V(),v(),w(),B(),E(),j(),F(),z(),y(),C(),D(),se(),Oe(),W(),K=g()}));function Ne({server:e,serverToolsCount:t,onViewTools:n,onCancel:s,onComplete:u,borderless:ee=!1}){let[d]=a(),f=Ee(),te=me(e=>e.mcp),m=Te(),h=we(),[g,ne]=(0,q.useState)(!1),_=q.useCallback(async()=>{let t=e.client.type!==`disabled`;try{await h(e.name),s()}catch(n){u(`Failed to ${t?`disable`:`enable`} MCP server '${e.name}': ${ve(n)}`)}},[e.client.type,e.name,h,s,u]),v=Se(String(e.name)),y=re(te.commands,e.name).length,x=[];return e.client.type!==`disabled`&&t>0&&x.push({label:`View tools`,value:`tools`}),e.client.type!==`disabled`&&x.push({label:`Reconnect`,value:`reconnectMcpServer`}),x.push({label:e.client.type===`disabled`?`Enable`:`Disable`,value:`toggle-enabled`}),x.length===0&&x.push({label:`Back`,value:`back`}),g?(0,J.jsxs)(o,{flexDirection:`column`,gap:1,padding:1,children:[(0,J.jsxs)(c,{color:`text`,children:[`Reconnecting to `,(0,J.jsx)(c,{bold:!0,children:e.name})]}),(0,J.jsxs)(o,{children:[(0,J.jsx)(T,{}),(0,J.jsx)(c,{children:` Restarting MCP server process`})]}),(0,J.jsx)(c,{dimColor:!0,children:`This may take a few moments.`})]}):(0,J.jsxs)(o,{flexDirection:`column`,children:[(0,J.jsxs)(o,{flexDirection:`column`,paddingX:1,borderStyle:ee?void 0:`round`,children:[(0,J.jsx)(o,{marginBottom:1,children:(0,J.jsxs)(c,{bold:!0,children:[v,` MCP Server`]})}),(0,J.jsxs)(o,{flexDirection:`column`,gap:0,children:[(0,J.jsxs)(o,{children:[(0,J.jsx)(c,{bold:!0,children:`Status: `}),e.client.type===`disabled`?(0,J.jsxs)(c,{children:[p(`inactive`,d)(r.radioOff),` disabled`]}):e.client.type===`connected`?(0,J.jsxs)(c,{children:[p(`success`,d)(r.tick),` connected`]}):e.client.type===`pending`?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(c,{dimColor:!0,children:r.radioOff}),(0,J.jsx)(c,{children:` connecting…`})]}):(0,J.jsxs)(c,{children:[p(`error`,d)(r.cross),` failed`]})]}),(0,J.jsxs)(o,{children:[(0,J.jsx)(c,{bold:!0,children:`Command: `}),(0,J.jsx)(c,{dimColor:!0,children:e.config.command})]}),e.config.args&&e.config.args.length>0&&(0,J.jsxs)(o,{children:[(0,J.jsx)(c,{bold:!0,children:`Args: `}),(0,J.jsx)(c,{dimColor:!0,children:e.config.args.join(` `)})]}),(0,J.jsxs)(o,{children:[(0,J.jsx)(c,{bold:!0,children:`Config location: `}),(0,J.jsx)(c,{dimColor:!0,children:oe(b(e.name)?.scope??`dynamic`)})]}),e.client.type===`connected`&&(0,J.jsx)(De,{serverToolsCount:t,serverPromptsCount:y,serverResourcesCount:te.resources[e.name]?.length||0}),e.client.type===`connected`&&t>0&&(0,J.jsxs)(o,{children:[(0,J.jsx)(c,{bold:!0,children:`Tools: `}),(0,J.jsxs)(c,{dimColor:!0,children:[t,` tools`]})]})]}),x.length>0&&(0,J.jsx)(o,{marginTop:1,children:(0,J.jsx)(_e,{options:x,onChange:async t=>{if(t===`tools`)n();else if(t===`reconnectMcpServer`){ne(!0);try{let{message:t}=ke(await m(e.name),e.name);u?.(t)}catch(t){u?.(Ae(t,e.name))}finally{ne(!1)}}else t===`toggle-enabled`?await _():t===`back`&&s()},onCancel:s})})]}),(0,J.jsx)(o,{marginTop:1,children:(0,J.jsx)(c,{dimColor:!0,italic:!0,children:f.pending?(0,J.jsxs)(J.Fragment,{children:[`Press `,f.keyName,` again to exit`]}):(0,J.jsxs)(l,{children:[(0,J.jsx)(i,{shortcut:`↑↓`,action:`navigate`}),(0,J.jsx)(i,{shortcut:`Enter`,action:`select`}),(0,J.jsx)(O,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]})})})]})}var q,J,Y=e((()=>{n(),q=t(d(),1),H(),m(),_(),V(),v(),w(),j(),z(),y(),C(),D(),Oe(),W(),J=g()}));function Pe({tool:e,server:t,onBack:n}){let[r,i]=X.useState(``),a=P(e.name,t.name),s=M(e.userFacingName?e.userFacingName({}):a),l=e.isReadOnly?.({})??!1,u=e.isDestructive?.({})??!1,ee=e.isOpenWorld?.({})??!1;return X.useEffect(()=>{async function t(){try{let t=await e.description({},{isNonInteractiveSession:!1,toolPermissionContext:{mode:`default`,additionalWorkingDirectories:new Map,alwaysAllowRules:{},alwaysDenyRules:{},alwaysAskRules:{},isBypassPermissionsModeAvailable:!1},tools:[]});i(t)}catch{i(`Failed to load description`)}}t()},[e]),(0,Z.jsx)(h,{title:(0,Z.jsxs)(Z.Fragment,{children:[s,l&&(0,Z.jsx)(c,{color:`success`,children:` [read-only]`}),u&&(0,Z.jsx)(c,{color:`error`,children:` [destructive]`}),ee&&(0,Z.jsx)(c,{dimColor:!0,children:` [open-world]`})]}),subtitle:t.name,onCancel:n,inputGuide:e=>e.pending?(0,Z.jsxs)(c,{children:[`Press `,e.keyName,` again to exit`]}):(0,Z.jsx)(O,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`}),children:(0,Z.jsxs)(o,{flexDirection:`column`,children:[(0,Z.jsxs)(o,{children:[(0,Z.jsx)(c,{bold:!0,children:`Tool name: `}),(0,Z.jsx)(c,{dimColor:!0,children:a})]}),(0,Z.jsxs)(o,{children:[(0,Z.jsx)(c,{bold:!0,children:`Full name: `}),(0,Z.jsx)(c,{dimColor:!0,children:e.name})]}),r&&(0,Z.jsxs)(o,{flexDirection:`column`,marginTop:1,children:[(0,Z.jsx)(c,{bold:!0,children:`Description:`}),(0,Z.jsx)(c,{wrap:`wrap`,children:r})]}),e.inputJSONSchema&&e.inputJSONSchema.properties&&Object.keys(e.inputJSONSchema.properties).length>0&&(0,Z.jsxs)(o,{flexDirection:`column`,marginTop:1,children:[(0,Z.jsx)(c,{bold:!0,children:`Parameters:`}),(0,Z.jsx)(o,{marginLeft:2,flexDirection:`column`,children:Object.entries(e.inputJSONSchema.properties).map(([t,n])=>{let r=(e.inputJSONSchema?.required)?.includes(t);return(0,Z.jsxs)(c,{children:[`• `,t,r&&(0,Z.jsx)(c,{dimColor:!0,children:` (required)`}),`:`,` `,(0,Z.jsx)(c,{dimColor:!0,children:typeof n==`object`&&n&&`type`in n?String(n.type):`unknown`}),typeof n==`object`&&n&&`description`in n&&(0,Z.jsxs)(c,{dimColor:!0,children:[` - `,String(n.description)]})]},t)})})]})]})})}var X,Z,Fe=e((()=>{X=t(d(),1),m(),N(),y(),Z=g()}));function Ie({server:e,onSelectTool:t,onBack:n}){let r=me(e=>e.mcp.tools),a=Le.useMemo(()=>e.client.type===`connected`?k(r,e.name):[],[e,r]),o=a.map((t,n)=>{let r=P(t.name,e.name),i=M(t.userFacingName?t.userFacingName({}):r),a=t.isReadOnly?.({})??!1,o=t.isDestructive?.({})??!1,s=t.isOpenWorld?.({})??!1,c=[];return a&&c.push(`read-only`),o&&c.push(`destructive`),s&&c.push(`open-world`),{label:i,value:n.toString(),description:c.length>0?c.join(`, `):void 0,descriptionColor:o?`error`:a?`success`:void 0}});return(0,Q.jsx)(h,{title:`Tools for ${e.name}`,subtitle:`${a.length} ${xe(a.length,`tool`)}`,onCancel:n,inputGuide:e=>e.pending?(0,Q.jsxs)(c,{children:[`Press `,e.keyName,` again to exit`]}):(0,Q.jsxs)(l,{children:[(0,Q.jsx)(i,{shortcut:`↑↓`,action:`navigate`}),(0,Q.jsx)(i,{shortcut:`Enter`,action:`select`}),(0,Q.jsx)(O,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]}),children:a.length===0?(0,Q.jsx)(c,{dimColor:!0,children:`No tools available`}):(0,Q.jsx)(_e,{options:o,onChange:e=>{let n=parseInt(e,10),r=a[n];r&&t(r,n)},onCancel:n})})}var Le,Q,Re=e((()=>{Le=t(d(),1),m(),N(),v(),w(),z(),y(),C(),Q=g()}));export{Ne as a,Me as c,Fe as i,Re as n,Y as o,Pe as r,je as s,Ie as t};
@@ -1 +1 @@
1
- import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{I as n,Lt as r,P as i,fi as a,t as o}from"./src-CDCSSo0U2.js";import{t as s}from"./jsx-runtime-Bb4Xn-E0.js";import{A_ as c,M_ as l,s_ as u,v_ as d,y_ as f}from"./loadAgentsDir-x3rlgED4.js";function p({scope:e,parsingErrors:t,warnings:r}){let a=t.length>0,o=r.length>0;return!a&&!o?null:(0,_.jsxs)(n,{flexDirection:`column`,marginTop:1,children:[(0,_.jsxs)(n,{children:[(a||o)&&(0,_.jsxs)(i,{color:a?`error`:`warning`,children:[`[`,a?`Failed to parse`:`Contains warnings`,`] `]}),(0,_.jsx)(i,{children:d(e)})]}),(0,_.jsxs)(n,{children:[(0,_.jsx)(i,{dimColor:!0,children:`Location: `}),(0,_.jsx)(i,{dimColor:!0,children:u(e)})]}),(0,_.jsxs)(n,{marginLeft:1,flexDirection:`column`,children:[t.map((e,t)=>{let r=e.mcpErrorMetadata?.serverName;return(0,_.jsx)(n,{children:(0,_.jsxs)(i,{children:[(0,_.jsx)(i,{dimColor:!0,children:`└ `}),(0,_.jsx)(i,{color:`error`,children:`[Error]`}),(0,_.jsxs)(i,{dimColor:!0,children:[` `,r&&`[${r}] `,e.path&&e.path!==``?`${e.path}: `:``,e.message]})]})},`error-${t}`)}),r.map((e,t)=>{let r=e.mcpErrorMetadata?.serverName;return(0,_.jsx)(n,{children:(0,_.jsxs)(i,{children:[(0,_.jsx)(i,{dimColor:!0,children:`└ `}),(0,_.jsx)(i,{color:`warning`,children:`[Warning]`}),(0,_.jsxs)(i,{dimColor:!0,children:[` `,r&&`[${r}] `,e.path&&e.path!==``?`${e.path}: `:``,e.message]})]})},`warning-${t}`)})]})]})}function m(){let e=(0,g.useMemo)(()=>[{scope:`user`,config:c(`user`)},{scope:`project`,config:c(`project`)},{scope:`local`,config:c(`local`)},{scope:`enterprise`,config:c(`enterprise`)}],[]),t=e.some(({config:e})=>h(e.errors,`fatal`).length>0),a=e.some(({config:e})=>h(e.errors,`warning`).length>0);return!t&&!a?null:(0,_.jsxs)(n,{flexDirection:`column`,marginTop:1,marginBottom:1,children:[(0,_.jsx)(i,{bold:!0,children:`MCP Config Diagnostics`}),(0,_.jsx)(n,{marginTop:1,children:(0,_.jsxs)(i,{dimColor:!0,children:[`For help configuring MCP servers, see:`,` `,(0,_.jsx)(r,{url:`https://code.claude.com/docs/en/mcp`,children:`https://code.claude.com/docs/en/mcp`})]})}),e.map(({scope:e,config:t})=>(0,_.jsx)(p,{scope:e,parsingErrors:h(t.errors,`fatal`),warnings:h(t.errors,`warning`)},e))]})}function h(e,t){return e.filter(e=>e.mcpErrorMetadata?.severity===t)}var g,_,v=e((()=>{g=t(a(),1),l(),f(),o(),_=s()}));export{v as n,m as t};
1
+ import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{I as n,Lt as r,P as i,fi as a,t as o}from"./src-CDCSSo0U2.js";import{t as s}from"./jsx-runtime-Bb4Xn-E0.js";import{BC as c,DC as l,EC as u,RC as d,hC as f}from"./loadAgentsDir-ByO8eJqU.js";function p({scope:e,parsingErrors:t,warnings:r}){let a=t.length>0,o=r.length>0;return!a&&!o?null:(0,_.jsxs)(n,{flexDirection:`column`,marginTop:1,children:[(0,_.jsxs)(n,{children:[(a||o)&&(0,_.jsxs)(i,{color:a?`error`:`warning`,children:[`[`,a?`Failed to parse`:`Contains warnings`,`] `]}),(0,_.jsx)(i,{children:u(e)})]}),(0,_.jsxs)(n,{children:[(0,_.jsx)(i,{dimColor:!0,children:`Location: `}),(0,_.jsx)(i,{dimColor:!0,children:f(e)})]}),(0,_.jsxs)(n,{marginLeft:1,flexDirection:`column`,children:[t.map((e,t)=>{let r=e.mcpErrorMetadata?.serverName;return(0,_.jsx)(n,{children:(0,_.jsxs)(i,{children:[(0,_.jsx)(i,{dimColor:!0,children:`└ `}),(0,_.jsx)(i,{color:`error`,children:`[Error]`}),(0,_.jsxs)(i,{dimColor:!0,children:[` `,r&&`[${r}] `,e.path&&e.path!==``?`${e.path}: `:``,e.message]})]})},`error-${t}`)}),r.map((e,t)=>{let r=e.mcpErrorMetadata?.serverName;return(0,_.jsx)(n,{children:(0,_.jsxs)(i,{children:[(0,_.jsx)(i,{dimColor:!0,children:`└ `}),(0,_.jsx)(i,{color:`warning`,children:`[Warning]`}),(0,_.jsxs)(i,{dimColor:!0,children:[` `,r&&`[${r}] `,e.path&&e.path!==``?`${e.path}: `:``,e.message]})]})},`warning-${t}`)})]})]})}function m(){let e=(0,g.useMemo)(()=>[{scope:`user`,config:d(`user`)},{scope:`project`,config:d(`project`)},{scope:`local`,config:d(`local`)},{scope:`enterprise`,config:d(`enterprise`)}],[]),t=e.some(({config:e})=>h(e.errors,`fatal`).length>0),a=e.some(({config:e})=>h(e.errors,`warning`).length>0);return!t&&!a?null:(0,_.jsxs)(n,{flexDirection:`column`,marginTop:1,marginBottom:1,children:[(0,_.jsx)(i,{bold:!0,children:`MCP Config Diagnostics`}),(0,_.jsx)(n,{marginTop:1,children:(0,_.jsxs)(i,{dimColor:!0,children:[`For help configuring MCP servers, see:`,` `,(0,_.jsx)(r,{url:`https://code.claude.com/docs/en/mcp`,children:`https://code.claude.com/docs/en/mcp`})]})}),e.map(({scope:e,config:t})=>(0,_.jsx)(p,{scope:e,parsingErrors:h(t.errors,`fatal`),warnings:h(t.errors,`warning`)},e))]})}function h(e,t){return e.filter(e=>e.mcpErrorMetadata?.severity===t)}var g,_,v=e((()=>{g=t(a(),1),c(),l(),o(),_=s()}));export{v as n,m as t};
@@ -0,0 +1,3 @@
1
+ import{n as e,o as t,r as n}from"./rolldown-runtime-DaDcL9Zw.js";import{n as r,t as i}from"./figures-5ThXQEtq.js";import{C as a,Gt as o,I as s,P as c,Wt as l,fi as u,ot as d,t as f}from"./src-CDCSSo0U2.js";import{t as p}from"./jsx-runtime-Bb4Xn-E0.js";import{$t as m,er as h,ft as g,mt as _}from"./state-C2OSZkV1.js";import{Bp as v,Bs as y,Fx as b,La as x,Pa as S,Pw as C,Px as w,Qp as T,Ua as E,Us as D,Vs as O,_v as k,_w as A,al as j,cy as ee,dp as te,em as ne,eo as M,hn as re,hw as N,il as ie,io as P,no as ae,ny as oe,on as F,oo as I,pp as L,rl as se,ry as ce,sl as R,ty as le,vv as ue,vw as z,xo as de,xw as fe,yn as pe,za as B,zp as me}from"./loadAgentsDir-ByO8eJqU.js";import{n as he,t as V}from"./cwd-C5ce-7WB.js";import{In as H,Ln as ge,Q as _e,Y as ve,f as ye,g as be}from"./settings-hQDLwPVj.js";import{J as xe,h as Se,m as Ce,o as we,s as U,w as Te}from"./log-CZ0zYP_c.js";import{n as W,r as G}from"./analytics-CkYUHW_U.js";import{h as Ee,x as De,y as Oe}from"./startupProfiler-DCn_NxMH.js";import{Bt as ke,St as Ae,Y as je,et as Me}from"./model-CwO-g1RW.js";import{E as Ne,T as Pe,c as Fe,d as Ie,w as Le}from"./sessionTracing-CwsXt_uA.js";import{n as Re,t as ze}from"./useExitOnCtrlCDWithKeybindings-Cce612uS.js";import*as K from"path";import{randomUUID as q}from"crypto";u();var J=p();r(),f(),m(),he(),xe(),Ce(),we(),ge(),W(),Oe(),_e(),be(),ke(),A(),w(),Le(),T(),Fe(),j(),se(),D(),de(),M(),pe();function Be(e){let t=e.toLowerCase();return/\b(wtf|wth|ffs|omfg|shit(ty|tiest)?|dumbass|horrible|awful|piss(ed|ing)? off|piece of (shit|crap|junk)|what the (fuck|hell)|fucking? (broken|useless|terrible|awful|horrible)|fuck you|screw (this|you)|so frustrating|this sucks|damn it)\b/.test(t)}function Ve(e){let t=e.toLowerCase().trim();return t===`continue`||/\b(keep going|go on)\b/.test(t)}function He(e,t,n,r,i,a,o){let s=q();h(s);let c=typeof e==`string`?e:e.find(e=>e.type===`text`)?.text||``;Ie(c);let l=typeof e==`string`?e:e.findLast(e=>e.type===`text`)?.text||``;return l&&Pe(`user_prompt`,{prompt_length:String(l.length),prompt:Ne(l),"prompt.id":s}),G(`tengu_input_prompt`,{is_negative:Be(c),is_keep_going:Ve(c)}),t.length>0?{messages:[x({content:[...typeof e==`string`?e.trim()?[{type:`text`,text:e}]:[]:e,...t],uuid:i,imagePasteIds:n.length>0?n:void 0,permissionMode:a,isMeta:o||void 0}),...r],shouldQuery:!0}:{messages:[x({content:e,uuid:i,permissionMode:a,isMeta:o||void 0}),...r],shouldQuery:!0}}W(),M();async function Ue({input:e,preExpansionInput:t,mode:n,setToolJSX:r,context:i,pastedContents:a,ideSelection:o,messages:s,setUserInputOnProcessing:c,uuid:l,isAlreadyProcessing:u,querySource:d,canUseTool:f,skipSlashCommands:p,bridgeOrigin:m,isMeta:h,skipAttachments:g,autonomy:_}){let v=typeof e==`string`?e:null,b=v?.startsWith(`/`)&&!p;n===`prompt`&&v!==null&&!h&&!b&&c?.(v),R(`query_process_user_input_base_start`);let C=i.getAppState(),w=await Ge(e,n,r,i,a,o,s,l,u,d,f,C.toolPermissionContext.mode,p,m,h,g,t,_);if(R(`query_process_user_input_base_end`),!w.shouldQuery)return w;R(`query_hooks_start`);let T=E(e)||``;for await(let t of F(T,C.toolPermissionContext.mode,i,i.requestPrompt))if(t.message?.type!==`progress`){if(t.blockingError)return{messages:[S(`${re(t.blockingError)}\n\nOriginal prompt: ${e}`,`warning`)],shouldQuery:!1,allowedTools:w.allowedTools};if(t.preventContinuation){let e=t.stopReason?`Operation stopped by hook: ${t.stopReason}`:`Operation stopped by hook`;return w.messages.push(x({content:e})),w.shouldQuery=!1,w}if(t.additionalContexts&&t.additionalContexts.length>0&&w.messages.push(y({type:`hook_additional_context`,content:t.additionalContexts.map(We),hookName:`UserPromptSubmit`,toolUseID:`hook-${q()}`,hookEvent:`UserPromptSubmit`})),t.message)switch(t.message.attachment.type){case`hook_success`:if(!t.message.attachment.content)break;w.messages.push({...t.message,attachment:{...t.message.attachment,content:We(t.message.attachment.content)}});break;default:w.messages.push(t.message);break}}return R(`query_hooks_end`),w}var Y=1e4;function We(e){return e.length>Y?`${e.substring(0,Y)}… [output truncated - exceeded ${Y} characters]`:e}async function Ge(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_){let v=null,y=[],x=[],S=e;if(typeof e==`string`)v=e;else if(e.length>0){R(`query_image_processing_start`);let t=[];for(let n of e)if(n.type===`image`){let e=await z(n);if(e.dimensions){let t=N(e.dimensions);t&&x.push(t)}t.push(e.block)}else t.push(n);S=t,R(`query_image_processing_end`);let n=t[t.length-1];n?.type===`text`?(v=n.text,y=t.slice(0,-1)):y=t}if(v===null&&t!==`prompt`)throw Error(`Mode: ${t} requires a string input.`);let C=i?Object.values(i).filter(b):[],w=C.map(e=>e.id),T=i?await ne(i):new Map;R(`query_pasted_image_processing_start`);let E=await Promise.all(C.map(async e=>{let t={type:`image`,source:{type:`base64`,media_type:e.mediaType||`image/png`,data:e.content}};return G(`tengu_pasted_image_resize_attempt`,{original_size_bytes:e.content.length}),{resized:await z(t),originalDimensions:e.dimensions,sourcePath:e.sourcePath??T.get(e.id)}})),D=[];for(let{resized:e,originalDimensions:t,sourcePath:n}of E){if(e.dimensions){let t=N(e.dimensions,n);t&&x.push(t)}else if(t){let e=N(t,n);e&&x.push(e)}else n&&x.push(`[Image source: ${n}]`);D.push(e.block)}R(`query_pasted_image_processing_end`);let k=f,A=!h&&v!==null&&(t!==`prompt`||k||!v.startsWith(`/`));R(`query_attachment_loading_start`);let j=A?await ie(O(v,r,a??null,[],o,l)):[];if(R(`query_attachment_loading_end`),v!==null&&t===`bash`){let{processBashCommand:e}=await import(`./processBashCommand-Cze9vCm6.js`);return X(await e(v,y,j,r,n),x)}if(v!==null&&!k&&v.startsWith(`/`)){let{processSlashCommand:e}=await import(`./processSlashCommand-BRajh1v7.js`);return X(await e(v,y,D,j,r,n,s,c,u,_),x)}if(v!==null&&t===`prompt`){let e=v.trim(),t=j.find(e=>e.attachment.type===`agent_mention`);if(t){let n=`@agent-${t.attachment.agentType}`,r=e===n;G(`tengu_subagent_at_mention`,{is_subagent_only:r,is_prefix:e.startsWith(n)&&!r})}}return X(He(S,D,w,j,s,d,m),x)}function X(e,t){return t.length>0&&e.messages.push(x({content:t.map(e=>({type:`text`,text:e})),isMeta:!0})),e}m(),Me();function Ke(e){return e===`Agent`?ve:e}function qe(e){let t=ye()?.outputStyle??`default`,n={type:`system`,subtype:`init`,cwd:V(),session_id:_(),tools:e.tools.map(e=>Ke(e.name)),mcp_servers:e.mcpClients.map(e=>({name:e.name,status:e.type})),model:e.model,permissionMode:e.permissionMode,slash_commands:e.commands.filter(e=>e.userInvocable!==!1).map(e=>e.name),apiKeySource:Ae().source,betas:g(),claude_code_version:`0.0.8`,output_style:t,agents:e.agents.map(e=>e.agentType),skills:e.skills.filter(e=>e.userInvocable!==!1).map(e=>e.name),plugins:e.plugins.map(e=>({name:e.name,path:e.path,source:e.source})),uuid:q()};return n.fast_mode_state=je(e.model,e.fastMode),n}var Je=n({MessageSelector:()=>Xe,messagesAfterAreOnlySynthetic:()=>it,selectableUserMessagesFilter:()=>rt});function Ye(e){return e.type===`text`}function Z(e){return e===`summarize`||e===`summarize_up_to`}function Xe({messages:e,onPreRestore:t,onRestoreMessage:n,onRestoreCode:r,onSummarize:u,onClose:d,preselectedMessage:f}){let p=ue(e=>e.fileHistory),[m,h]=(0,Q.useState)(void 0),g=oe(),_=(0,Q.useMemo)(q,[]),v=(0,Q.useMemo)(()=>[...e.filter(rt),{...x({content:``}),uuid:_}],[e,_]),[y,b]=(0,Q.useState)(v.length-1),S=Math.max(0,Math.min(y-Math.floor($/2),v.length-$)),C=v.length>1,[w,T]=(0,Q.useState)(f),[E,D]=(0,Q.useState)(void 0);(0,Q.useEffect)(()=>{if(!f||!g)return;let e=!1;return ce(p,f.uuid).then(t=>{e||D(t)}),()=>{e=!0}},[f,g,p]);let[O,k]=(0,Q.useState)(!1),[A,j]=(0,Q.useState)(null),[ee,ne]=(0,Q.useState)(`both`),[M,re]=(0,Q.useState)(``),[N,ie]=(0,Q.useState)(``);function P(e){let t=e?[{value:`both`,label:`Restore code and conversation`},{value:`conversation`,label:`Restore conversation`},{value:`code`,label:`Restore code`}]:[{value:`conversation`,label:`Restore conversation`}],n={type:`input`,placeholder:`add context (optional)`,initialValue:``,allowEmptySubmitToCancel:!0,showLabelWithValue:!0,labelValueSeparator:`: `};return t.push({value:`summarize`,label:`Summarize from here`,...n,onChange:re}),process.env.USER_TYPE===`ant`&&t.push({value:`summarize_up_to`,label:`Summarize up to here`,...n,onChange:ie}),t.push({value:`nevermind`,label:`Never mind`}),t}(0,Q.useEffect)(()=>{G(`tengu_message_selector_opened`,{})},[]);async function ae(e){t(),k(!0);try{await n(e),k(!1),d()}catch(e){U(e),k(!1),h(`Failed to restore the conversation:\n${e}`)}}async function F(t){let n=e.indexOf(t);if(G(`tengu_message_selector_selected`,{index_from_end:e.length-1-n,message_type:t.type,is_current_prompt:!1}),!e.includes(t)){d();return}if(!g){await ae(t);return}let r=await ce(p,t.uuid);T(t),D(r)}async function I(e){if(G(`tengu_message_selector_restore_option_selected`,{option:e}),!w){h(`Message not found.`);return}if(e===`nevermind`){f?d():T(void 0);return}if(Z(e)){t(),k(!0),j(e),h(void 0);try{let t=e===`summarize_up_to`?`up_to`:`from`,n=(t===`up_to`?N:M).trim()||void 0;await u(w,n,t),k(!1),j(null),T(void 0),d()}catch(e){U(e),k(!1),j(null),T(void 0),h(`Failed to summarize:\n${e}`)}return}t(),k(!0),h(void 0);let i=null,a=null;if(e===`code`||e===`both`)try{await r(w)}catch(e){i=e,U(i)}if(e===`conversation`||e===`both`)try{await n(w)}catch(e){a=e,U(a)}k(!1),T(void 0),a&&i?h(`Failed to restore the conversation and code:\n${a}\n${i}`):a?h(`Failed to restore the conversation:\n${a}`):i?h(`Failed to restore the code:\n${i}`):d()}let L=Re(),se=(0,Q.useCallback)(()=>{if(w&&!f){T(void 0);return}G(`tengu_message_selector_cancelled`,{}),d()},[d,w,f]),R=(0,Q.useCallback)(()=>b(e=>Math.max(0,e-1)),[]),z=(0,Q.useCallback)(()=>b(e=>Math.min(v.length-1,e+1)),[v.length]),de=(0,Q.useCallback)(()=>b(0),[]),fe=(0,Q.useCallback)(()=>b(v.length-1),[v.length]),pe=(0,Q.useCallback)(()=>{let e=v[y];e&&F(e)},[v,y,F]);l(`confirm:no`,se,{context:`Confirmation`,isActive:!w}),o({"messageSelector:up":R,"messageSelector:down":z,"messageSelector:top":de,"messageSelector:bottom":fe,"messageSelector:select":pe},{context:`MessageSelector`,isActive:!O&&!m&&!w&&C});let[B,he]=(0,Q.useState)({});(0,Q.useEffect)(()=>{async function t(){g&&Promise.all(v.map(async(t,n)=>{if(t.uuid!==_){let r=le(p,t.uuid),i=v.at(n+1),a=r?nt(e,t.uuid,i?.uuid===_?void 0:i?.uuid):void 0;he(a===void 0?e=>({...e,[n]:void 0}):e=>({...e,[n]:a}))}}))}t()},[v,e,_,p,g]);let V=g&&E?.filesChanged&&E.filesChanged.length>0,H=!m&&!w&&!f&&C;return(0,J.jsxs)(s,{flexDirection:`column`,width:`100%`,children:[(0,J.jsx)(a,{color:`suggestion`}),(0,J.jsxs)(s,{flexDirection:`column`,marginX:1,gap:1,children:[(0,J.jsx)(c,{bold:!0,color:`suggestion`,children:`Rewind`}),m&&(0,J.jsx)(J.Fragment,{children:(0,J.jsxs)(c,{color:`error`,children:[`Error: `,m]})}),!C&&(0,J.jsx)(J.Fragment,{children:(0,J.jsx)(c,{children:`Nothing to rewind to yet.`})}),!m&&w&&C&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(c,{children:[`Confirm you want to restore `,!E&&`the conversation `,`to the point before you sent this message:`]}),(0,J.jsxs)(s,{flexDirection:`column`,paddingLeft:1,borderStyle:`single`,borderRight:!1,borderTop:!1,borderBottom:!1,borderLeft:!0,borderLeftDimColor:!0,children:[(0,J.jsx)(tt,{userMessage:w,color:`text`,isCurrent:!1}),(0,J.jsxs)(c,{dimColor:!0,children:[`(`,Ee(new Date(w.timestamp)),`)`]})]}),(0,J.jsx)(Qe,{selectedRestoreOption:ee,canRestoreCode:!!V,diffStatsForRestore:E}),O&&Z(A)?(0,J.jsxs)(s,{flexDirection:`row`,gap:1,children:[(0,J.jsx)(te,{}),(0,J.jsx)(c,{children:`Summarizing…`})]}):(0,J.jsx)(me,{isDisabled:O,options:P(!!V),defaultFocusValue:V?`both`:`conversation`,onFocus:e=>ne(e),onChange:e=>I(e),onCancel:()=>f?d():T(void 0)}),V&&(0,J.jsx)(s,{marginBottom:1,children:(0,J.jsxs)(c,{dimColor:!0,children:[i.warning,` Rewinding does not affect files edited manually or via bash.`]})})]}),H&&(0,J.jsxs)(J.Fragment,{children:[g?(0,J.jsx)(c,{children:`Restore the code and/or conversation to the point before…`}):(0,J.jsx)(c,{children:`Restore and fork the conversation to the point before…`}),(0,J.jsx)(s,{width:`100%`,flexDirection:`column`,children:v.slice(S,S+$).map((e,t)=>{let n=S+t,r=n===y,a=e.uuid===_,o=n in B,l=B[n],u=l?.filesChanged&&l.filesChanged.length;return(0,J.jsxs)(s,{height:g?3:2,overflow:`hidden`,width:`100%`,flexDirection:`row`,children:[(0,J.jsx)(s,{width:2,minWidth:2,children:r?(0,J.jsxs)(c,{color:`permission`,bold:!0,children:[i.pointer,` `]}):(0,J.jsx)(c,{children:` `})}),(0,J.jsxs)(s,{flexDirection:`column`,children:[(0,J.jsx)(s,{flexShrink:1,height:1,overflow:`hidden`,children:(0,J.jsx)(tt,{userMessage:e,color:r?`suggestion`:void 0,isCurrent:a,paddingRight:10})}),g&&o&&(0,J.jsx)(s,{height:1,flexDirection:`row`,children:l?(0,J.jsx)(J.Fragment,{children:(0,J.jsx)(c,{dimColor:!r,color:`inactive`,children:u?(0,J.jsxs)(J.Fragment,{children:[u===1&&l.filesChanged[0]?`${K.basename(l.filesChanged[0])} `:`${u} files changed `,(0,J.jsx)(et,{diffStats:l})]}):(0,J.jsx)(J.Fragment,{children:`No code changes`})})}):(0,J.jsxs)(c,{dimColor:!0,color:`warning`,children:[i.warning,` No code restore`]})})]})]},e.uuid)})})]}),!w&&(0,J.jsx)(c,{dimColor:!0,italic:!0,children:L.pending?(0,J.jsxs)(J.Fragment,{children:[`Press `,L.keyName,` again to exit`]}):(0,J.jsxs)(J.Fragment,{children:[!m&&C&&`Enter to continue · `,`Esc to exit`]})})]})]})}function Ze(e){switch(e){case`summarize`:return`Messages after this point will be summarized.`;case`summarize_up_to`:return`Preceding messages will be summarized. This and subsequent messages will remain unchanged — you will stay at the end of the conversation.`;case`both`:case`conversation`:return`The conversation will be forked.`;case`code`:case`nevermind`:return`The conversation will be unchanged.`}}function Qe({selectedRestoreOption:e,canRestoreCode:t,diffStatsForRestore:n}){let r=t&&(e===`both`||e===`code`);return(0,J.jsxs)(s,{flexDirection:`column`,children:[(0,J.jsx)(c,{dimColor:!0,children:Ze(e)}),!Z(e)&&(r?(0,J.jsx)($e,{diffStatsForRestore:n}):(0,J.jsx)(c,{dimColor:!0,children:`The code will be unchanged.`}))]})}function $e({diffStatsForRestore:e}){if(e===void 0)return;if(!e.filesChanged||!e.filesChanged[0])return(0,J.jsx)(c,{dimColor:!0,children:`The code has not changed (nothing will be restored).`});let t=e.filesChanged.length,n=``;return n=t===1?K.basename(e.filesChanged[0]||``):t===2?`${K.basename(e.filesChanged[0]||``)} and ${K.basename(e.filesChanged[1]||``)}`:`${K.basename(e.filesChanged[0]||``)} and ${e.filesChanged.length-1} other files`,(0,J.jsx)(J.Fragment,{children:(0,J.jsxs)(c,{dimColor:!0,children:[`The code will be restored `,(0,J.jsx)(et,{diffStats:e}),` in `,n,`.`]})})}function et({diffStats:e}){if(!(!e||!e.filesChanged))return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(c,{color:`diffAddedWord`,children:[`+`,e.insertions,` `]}),(0,J.jsxs)(c,{color:`diffRemovedWord`,children:[`-`,e.deletions]})]})}function tt({userMessage:e,color:t,dimColor:n,isCurrent:r,paddingRight:i}){let{columns:a}=d();if(r)return(0,J.jsx)(s,{width:`100%`,children:(0,J.jsx)(c,{italic:!0,color:t,dimColor:n,children:`(current)`})});let o=e.message.content,l=typeof o==`string`?null:o[o.length-1],u=Se(typeof o==`string`?o.trim():l&&Ye(l)?l.text.trim():`(no prompt)`);if(ae(u))return(0,J.jsx)(s,{flexDirection:`row`,width:`100%`,children:(0,J.jsx)(c,{italic:!0,color:t,dimColor:n,children:`((empty message))`})});if(u.includes(`<bash-input>`)){let e=B(u,`bash-input`);if(e)return(0,J.jsxs)(s,{flexDirection:`row`,width:`100%`,children:[(0,J.jsx)(c,{color:`bashBorder`,children:`!`}),(0,J.jsxs)(c,{color:t,dimColor:n,children:[` `,e]})]})}if(u.includes(`<command-message>`)){let e=B(u,Te),r=B(u,`command-args`),i=B(u,`skill-format`)===`true`;if(e)return i?(0,J.jsx)(s,{flexDirection:`row`,width:`100%`,children:(0,J.jsxs)(c,{color:t,dimColor:n,children:[`Skill(`,e,`)`]})}):(0,J.jsx)(s,{flexDirection:`row`,width:`100%`,children:(0,J.jsxs)(c,{color:t,dimColor:n,children:[`/`,e,` `,r]})})}return(0,J.jsx)(s,{flexDirection:`row`,width:`100%`,children:(0,J.jsx)(c,{color:t,dimColor:n,children:i?De(u,a-i,!0):u.slice(0,500).split(`
2
+ `).slice(0,4).join(`
3
+ `)})})}function nt(e,t,n){let r=e.findIndex(e=>e.uuid===t);if(r===-1)return;let i=n?e.findIndex(e=>e.uuid===n):e.length;i===-1&&(i=e.length);let a=[],o=0,s=0;for(let t=r+1;t<i;t++){let n=e[t];if(!n||!I(n))continue;let r=n.toolUseResult;if(!(!r||!r.filePath||!r.structuredPatch)){a.includes(r.filePath)||a.push(r.filePath);try{if(`type`in r&&r.type===`create`)o+=r.content.split(/\r?\n/).length;else for(let e of r.structuredPatch){let t=H(e.lines,e=>e.startsWith(`+`)),n=H(e.lines,e=>e.startsWith(`-`));o+=t,s+=n}}catch{}}}return{filesChanged:a,insertions:o,deletions:s}}function rt(e){if(e.type!==`user`||Array.isArray(e.message.content)&&e.message.content[0]?.type===`tool_result`||P(e)||e.isMeta||e.isCompactSummary||e.isVisibleInTranscriptOnly)return!1;let t=e.message.content,n=typeof t==`string`?null:t[t.length-1],r=typeof t==`string`?t.trim():n&&Ye(n)?n.text.trim():``;return!(r.indexOf(`<local-command-stdout>`)!==-1||r.indexOf(`<local-command-stderr>`)!==-1||r.indexOf(`<bash-stdout>`)!==-1||r.indexOf(`<bash-stderr>`)!==-1||r.indexOf(`<task-notification>`)!==-1||r.indexOf(`<tick>`)!==-1)}function it(e,t){for(let n=t+1;n<e.length;n++){let t=e[n];if(t&&!P(t)&&!I(t)&&t.type!==`progress`&&t.type!==`system`&&t.type!==`attachment`&&!(t.type===`user`&&t.isMeta)){if(t.type===`assistant`){let e=t.message.content;if(Array.isArray(e)&&e.some(e=>e.type===`text`&&e.text.trim()||e.type===`tool_use`))return!1;continue}if(t.type===`user`)return!1}}return!0}var Q,$,at=e((()=>{Q=t(u(),1),W(),k(),ee(),ze(),C(),M(),v(),L(),fe(),$=7}));export{rt as a,Ue as c,it as i,Je as n,qe as o,at as r,Ke as s,Xe as t};