@readmagic/workmate 0.0.8 → 0.0.9

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 (501) hide show
  1. package/dist/chunks/AddWorkspaceDirectory-qFZy3FOD.js +1 -0
  2. package/dist/chunks/App-DW4elk6E.js +1 -0
  3. package/dist/chunks/ApproveApiKey-D05WywHU.js +1 -0
  4. package/dist/chunks/ApproveApiKey-DHAbdwkC.js +1 -0
  5. package/dist/chunks/BackgroundTasksDialog-QgFwoaaC.js +2 -0
  6. package/dist/chunks/BypassPermissionsModeDialog-BuRFF1fQ.js +1 -0
  7. package/dist/chunks/ClaudeMdExternalIncludesDialog-CDrArsSX.js +1 -0
  8. package/dist/chunks/ClaudeMdExternalIncludesDialog-DpecRCAt.js +1 -0
  9. package/dist/chunks/ConsoleOAuthFlow-D1MYL1dJ.js +1 -0
  10. package/dist/chunks/DiffDialog-BIcwpgSr.js +6 -0
  11. package/dist/chunks/Doctor-D160J8Ad.js +3 -0
  12. package/dist/chunks/Doctor-VhJi2cmL.js +1 -0
  13. package/dist/chunks/ExitFlow-CoWHhKHJ.js +2 -0
  14. package/dist/chunks/Grove-BmirUB6V.js +11 -0
  15. package/dist/chunks/{HybridTransport-BJPOG2wl.js → HybridTransport-BVmSUHf0.js} +1 -1
  16. package/dist/chunks/InvalidConfigDialog-WRywkKeS.js +1 -0
  17. package/dist/chunks/InvalidSettingsDialog-C4n3A72C.js +1 -0
  18. package/dist/chunks/MCPConnectionManager-DPFe4hPh.js +1 -0
  19. package/dist/chunks/MCPToolListView-BPmE0C2o.js +1 -0
  20. package/dist/chunks/McpParsingWarnings-CH4yyMAL.js +1 -0
  21. package/dist/chunks/MessageSelector-kOn2GaU-.js +3 -0
  22. package/dist/chunks/Messages-4EnHFeh1.js +11 -0
  23. package/dist/chunks/Onboarding-BboWs1pp.js +1 -0
  24. package/dist/chunks/{PermissionDialog-0ya1CU5k.js → PermissionDialog-Cb3z8OUP.js} +1 -1
  25. package/dist/chunks/{PressEnterToContinue-Dl9Hg9Mf.js → PressEnterToContinue-Dq0Imo9c.js} +1 -1
  26. package/dist/chunks/PromptInputFooterSuggestions-BpC9COmh.js +1 -0
  27. package/dist/chunks/PromptInputHelpMenu-BvcAzbSi.js +1 -0
  28. package/dist/chunks/QueryEngine-J6ElcO16.js +1 -0
  29. package/dist/chunks/REPL-DBjbAJsm.js +133 -0
  30. package/dist/chunks/REPL-oBemMXvp.js +1 -0
  31. package/dist/chunks/RemoteSessionManager-CoIyFKKa.js +2 -0
  32. package/dist/chunks/ResumeConversation-wBG8OD9P.js +1 -0
  33. package/dist/chunks/{SSETransport-CrwbKuVt.js → SSETransport-1KBBUikF.js} +1 -1
  34. package/dist/chunks/{SearchBox-vfLXEPed.js → SearchBox-C9vUA4IM.js} +1 -1
  35. package/dist/chunks/SearchExtraToolsTool-BugrzImr.js +1 -0
  36. package/dist/chunks/Settings-DptKuJE7.js +2 -0
  37. package/dist/chunks/TeleportProgress-BmgPAZAi.js +1 -0
  38. package/dist/chunks/TeleportRepoMismatchDialog-sgxNOeM_.js +1 -0
  39. package/dist/chunks/TeleportResumeWrapper-GptvrUdv.js +1 -0
  40. package/dist/chunks/ThemePicker-gAMqqD1P.js +1 -0
  41. package/dist/chunks/{TrustDialog-BukWGvHZ.js → TrustDialog-CWt-4Evl.js} +1 -1
  42. package/dist/chunks/{ValidationErrorsList-DokTJQwi.js → ValidationErrorsList-De3kzHtz.js} +1 -1
  43. package/dist/chunks/{WelcomeV2-Ci9VwPYh.js → WelcomeV2-BWF-cJOu.js} +1 -1
  44. package/dist/chunks/add-dir-DBVT1cEK.js +1 -0
  45. package/dist/chunks/{agentDisplay-DBQYOaOh.js → agentDisplay-5gnCQwUY.js} +1 -1
  46. package/dist/chunks/{agents-HlKk68Qc.js → agents-Bz1MLp4A.js} +1 -1
  47. package/dist/chunks/agents-CnwTOlqO.js +103 -0
  48. package/dist/chunks/allErrors-DYw_q14e.js +1 -0
  49. package/dist/chunks/analytics-DJobLaWP.js +1 -0
  50. package/dist/chunks/api-DXDXTFGa.js +1 -0
  51. package/dist/chunks/{api-CF5IVtj0.js → api-DzccRM_z.js} +1 -1
  52. package/dist/chunks/auth-Cjnyy10u.js +15 -0
  53. package/dist/chunks/auth-CnLb6RWc.js +1 -0
  54. package/dist/chunks/auth-D-SGHS0K.js +1 -0
  55. package/dist/chunks/{autoMode-Cr0AhS1G.js → autoMode-CQ5nqP9c.js} +4 -4
  56. package/dist/chunks/{autonomy-ARUQt-Lu.js → autonomy-CPUCe-YU.js} +1 -1
  57. package/dist/chunks/autonomy-dSJl0hN1.js +15 -0
  58. package/dist/chunks/{autonomyPanel-BQK9MoeB.js → autonomyPanel-Ccr9ilei.js} +1 -1
  59. package/dist/chunks/backgroundHousekeeping--cs5crp7.js +17 -0
  60. package/dist/chunks/backgroundHousekeeping-CcbHitKC.js +1 -0
  61. package/dist/chunks/{banner-Ca7rki2V.js → banner-BJZNMppT.js} +1 -1
  62. package/dist/chunks/bg-DWloqGwk.js +1 -0
  63. package/dist/chunks/{bg-DxRHF1yn.js → bg-w3Vlsm3Y.js} +2 -2
  64. package/dist/chunks/branch-CG0AKS1J.js +3 -0
  65. package/dist/chunks/{break-cache-BKvoMOZx.js → break-cache-DXV0brco.js} +2 -2
  66. package/dist/chunks/bridgeConfig-Dmc1ZDev.js +1 -0
  67. package/dist/chunks/{bridgeConfig-jDEva6Eh.js → bridgeConfig-vORehbGG.js} +1 -1
  68. package/dist/chunks/{bridgeMessaging-YqYdl6ej.js → bridgeMessaging-DlczTV9X.js} +1 -1
  69. package/dist/chunks/{bridgePointer-DIM0sj0x.js → bridgePointer-D4W9GpWw.js} +1 -1
  70. package/dist/chunks/btw-DDUC_t0w.js +1 -0
  71. package/dist/chunks/caches-1IFb6_M_.js +1 -0
  72. package/dist/chunks/caches-CB8MHqy2.js +1 -0
  73. package/dist/chunks/{capacityWake-CKOiRELo.js → capacityWake-L7b1mMft.js} +1 -1
  74. package/dist/chunks/{ccrClient-BC2q3k44.js → ccrClient-CG6HTv_n.js} +1 -1
  75. package/dist/chunks/{claudeDesktop-DQXL5bGm.js → claudeDesktop-CAmnheYx.js} +1 -1
  76. package/dist/chunks/{clear-1etSJhdg.js → clear-DdWexxbM.js} +1 -1
  77. package/dist/chunks/{cliLaunch-CQjLYRzM.js → cliLaunch-BWWOgBFh.js} +1 -1
  78. package/dist/chunks/{client-DQwf_b9o.js → client-CoXtVRzi.js} +1 -1
  79. package/dist/chunks/client-Crrwkw7g.js +1 -0
  80. package/dist/chunks/client-D8hKghba.js +1 -0
  81. package/dist/chunks/color-Cuq0c6xy.js +1 -0
  82. package/dist/chunks/commands-D3sESsTp.js +1 -0
  83. package/dist/chunks/compact-DIpwuBDq.js +2 -0
  84. package/dist/chunks/config-CVvUNkj2.js +1 -0
  85. package/dist/chunks/config-D4G8_MqJ.js +3 -0
  86. package/dist/chunks/config-q9D4hFiK.js +1 -0
  87. package/dist/chunks/context-BWcfhhDj.js +1 -0
  88. package/dist/chunks/context-noninteractive-Bwt9A3XD.js +1 -0
  89. package/dist/chunks/{context-noninteractive-Ct_ttQfP.js → context-noninteractive-c7jGVWHQ.js} +2 -2
  90. package/dist/chunks/conversation-Bjo_8kia.js +1 -0
  91. package/dist/chunks/conversation-DrHZIQX2.js +1 -0
  92. package/dist/chunks/{createSSHSession-BmHXA2me.js → createSSHSession-DP7B8yvb.js} +1 -1
  93. package/dist/chunks/{createSession-C4rukWkv.js → createSession-CPo6GBSb.js} +1 -1
  94. package/dist/chunks/createSession-DnykRoia.js +1 -0
  95. package/dist/chunks/crossProjectResume-D2A-qjgP.js +40 -0
  96. package/dist/chunks/cwd--q1ONL7P.js +1 -0
  97. package/dist/chunks/{cwd-C5ce-7WB.js → cwd-L4wygFqJ.js} +1 -1
  98. package/dist/chunks/{daemon-ZtpTZWgQ.js → daemon-D2vFIVOz.js} +1 -1
  99. package/dist/chunks/datadog-DrmHyl3_.js +1 -0
  100. package/dist/chunks/{debug-RZ4NuXyS.js → debug-BdqxZ7rV.js} +4 -4
  101. package/dist/chunks/{debugUtils-D30M1cbN.js → debugUtils-CezNYZ-4.js} +1 -1
  102. package/dist/chunks/{detached-jrVP11oU.js → detached-CkPpYMJj.js} +1 -1
  103. package/dist/chunks/detectRepository-DA1Q_Skc.js +1 -0
  104. package/dist/chunks/{detectRepository-CFiHe6Rv.js → detectRepository-DvxoaPlk.js} +1 -1
  105. package/dist/chunks/{diff-BKiK3xHv.js → diff-DHzz9WAp.js} +1 -1
  106. package/dist/chunks/directoryCompletion-D5AvL7TF.js +1 -0
  107. package/dist/chunks/doctor-PWqB46xd.js +1 -0
  108. package/dist/chunks/entry-4JtoJONR.js +14 -0
  109. package/dist/chunks/envUtils-BDhHQY0-.js +1 -0
  110. package/dist/chunks/{esm-BLPbfHQd.js → esm-DcIr7tVd.js} +1 -1
  111. package/dist/chunks/{execFileNoThrow-CCX-JY8h.js → execFileNoThrow-5SylUnAI.js} +1 -1
  112. package/dist/chunks/{execSyncWrapper-dhRSYGFW.js → execSyncWrapper-DKuxVTaf.js} +1 -1
  113. package/dist/chunks/exit-OW9g7b9A.js +1 -0
  114. package/dist/chunks/extraUsage-Dt5mw35U.js +1 -0
  115. package/dist/chunks/extractMemories-1VlmCGwa.js +1 -0
  116. package/dist/chunks/fast-ClYQcEv5.js +1 -0
  117. package/dist/chunks/fast-CrvLdpy3.js +1 -0
  118. package/dist/chunks/fileSuggestions-fNxREjpe.js +3 -0
  119. package/dist/chunks/firstPartyEventLogger-BBXEQUf0.js +1 -0
  120. package/dist/chunks/firstPartyEventLogger-DhEPWcit.js +5 -0
  121. package/dist/chunks/{flushGate-Cnsu4HET.js → flushGate-ch-Tvwjj.js} +1 -1
  122. package/dist/chunks/{fpsMetrics-Cf_hdtiJ.js → fpsMetrics-DffAomdg.js} +1 -1
  123. package/dist/chunks/{gemini-Cudre91e.js → gemini-fZ0VPU2A.js} +1 -1
  124. package/dist/chunks/generateRecap-BIBVlB__.js +1 -0
  125. package/dist/chunks/generateSessionName-nZj_VvKZ.js +1 -0
  126. package/dist/chunks/{genericProcessUtils-DVfMHhfy.js → genericProcessUtils-BmDSLcMf.js} +1 -1
  127. package/dist/chunks/{git-BerW9bId.js → git-B9uvt96d.js} +1 -1
  128. package/dist/chunks/git-BfS5Hk4S.js +1 -0
  129. package/dist/chunks/githubRepoPathMapping-Cqx3pSfc.js +1 -0
  130. package/dist/chunks/goal-IasZVqKh.js +3 -0
  131. package/dist/chunks/grok-Dk3LyzMa.js +1 -0
  132. package/dist/chunks/grove-BE4fQ6tG.js +7 -0
  133. package/dist/chunks/help-D2-v9Ug9.js +1 -0
  134. package/dist/chunks/{hooks-BZJTWD07.js → hooks-BrKy5XWQ.js} +2 -2
  135. package/dist/chunks/hooks-DGd02IKF.js +1 -0
  136. package/dist/chunks/initReplBridge-RhCAlmHE.js +1 -0
  137. package/dist/chunks/{install-BI---dv0.js → install-CVGZ55wV.js} +1 -1
  138. package/dist/chunks/{instrumentation-CcWzhGfE.js → instrumentation-BmWotlxR.js} +4 -4
  139. package/dist/chunks/{job-B0ftcqPF.js → job-DEXxW_Zo.js} +1 -1
  140. package/dist/chunks/{jwtUtils-C0cE-1Ey.js → jwtUtils-C9sdGhvT.js} +1 -1
  141. package/dist/chunks/keybindings-BRdSOSUD.js +2 -0
  142. package/dist/chunks/language-C0cIpKE2.js +1 -0
  143. package/dist/chunks/{language-s-dLbdVz.js → language-CxThoWRC.js} +1 -1
  144. package/dist/chunks/launchLocalMemory-CLSSVFoj.js +3 -0
  145. package/dist/chunks/launchOnboarding-BkJfKviO.js +8 -0
  146. package/dist/chunks/loadAgentsDir-8UprzS4w.js +1 -0
  147. package/dist/chunks/{loadAgentsDir-ByO8eJqU.js → loadAgentsDir-CKSb56Gp.js} +673 -759
  148. package/dist/chunks/loadPluginHooks-LbaURHVH.js +1 -0
  149. package/dist/chunks/{localSearch-CHHCH16D.js → localSearch-CPOnyi8I.js} +1 -1
  150. package/dist/chunks/localSearch-DNjbr4S9.js +1 -0
  151. package/dist/chunks/{log-CZ0zYP_c.js → log-CTFl4qpD.js} +1 -1
  152. package/dist/chunks/logoV2Utils-we1sfJvf.js +1 -0
  153. package/dist/chunks/{magicDocs-C5i5ruuU.js → magicDocs-DmKlTQvK.js} +3 -3
  154. package/dist/chunks/main-BIiwW4mM.js +605 -0
  155. package/dist/chunks/{main-BLD4QAQg.js → main-ClXu1ilx.js} +2 -2
  156. package/dist/chunks/{managedEnv-C-9XSN14.js → managedEnv-Cl7YbYzf.js} +1 -1
  157. package/dist/chunks/managedEnv-CpiiQx_v.js +1 -0
  158. package/dist/chunks/{mappers-CHRFic5q.js → mappers-xQC-Z4-h.js} +1 -1
  159. package/dist/chunks/mcp-B_m1XBDt.js +6 -0
  160. package/dist/chunks/mcp-BiyfH9Sd.js +1 -0
  161. package/dist/chunks/mcp-BjlaPUWX.js +2 -0
  162. package/dist/chunks/{memoize-B8hfb1JN.js → memoize-FJv2HV1u.js} +1 -1
  163. package/dist/chunks/memory-LN8f_p2b.js +1 -0
  164. package/dist/chunks/{modalContext-DFjKLCB6.js → modalContext-CUThy6Ph.js} +1 -1
  165. package/dist/chunks/mode-lYTs0XHs.js +2 -0
  166. package/dist/chunks/model-C2e73CJD.js +1 -0
  167. package/dist/chunks/model-CvmS-Esk.js +1 -0
  168. package/dist/chunks/model-DJ8mFfuR.js +1 -0
  169. package/dist/chunks/modelOptions-efCGKnXT.js +1 -0
  170. package/dist/chunks/nativeInstaller-DQIFwdat.js +1 -0
  171. package/dist/chunks/oauth-BN2I0_jl.js +1 -0
  172. package/dist/chunks/oauth-C9VBDB0Y.js +1 -0
  173. package/dist/chunks/omit-CLPZGevl.js +1 -0
  174. package/dist/chunks/onChangeAppState-DhBO34OK.js +1 -0
  175. package/dist/chunks/{openai-DPH6rXOZ.js → openai-DJLYqiRl.js} +2 -2
  176. package/dist/chunks/{panel-mD094ALT.js → panel-q0_iT9cg.js} +1 -1
  177. package/dist/chunks/panelCall-sum-3zvi.js +1 -0
  178. package/dist/chunks/parser-BcdhBGx0.js +1 -0
  179. package/dist/chunks/{parser-dbHRgXb8.js → parser-BdCj2GrE.js} +1 -1
  180. package/dist/chunks/partition-CpfoVrg1.js +1 -0
  181. package/dist/chunks/permissions-DTb9wkAP.js +3 -0
  182. package/dist/chunks/pidLock-BR5M6RQw.js +3 -0
  183. package/dist/chunks/{pipeTransport-DVOKR4c_.js → pipeTransport-B3TIkTAp.js} +1 -1
  184. package/dist/chunks/plan-BeoIjNPv.js +1 -0
  185. package/dist/chunks/{platform-DCXXznJg.js → platform-D6IMiyqT.js} +1 -1
  186. package/dist/chunks/plugin-D_dHjTud.js +17 -0
  187. package/dist/chunks/pluginAutoupdate-BHKlOOXI.js +1 -0
  188. package/dist/chunks/pluginBlocklist-D93Hd1GF.js +1 -0
  189. package/dist/chunks/pluginCliCommands-vv0wNt4O.js +1 -0
  190. package/dist/chunks/{pluginFlagging-pBxSselw.js → pluginFlagging-CxuRF2Vc.js} +1 -1
  191. package/dist/chunks/pluginOperations-BTq4AjYB.js +2 -0
  192. package/dist/chunks/{pluginStartupCheck-Di4LjHXf.js → pluginStartupCheck-B6leNWq9.js} +1 -1
  193. package/dist/chunks/pluginStartupCheck-DBOCHUHQ.js +1 -0
  194. package/dist/chunks/plugins-pmipe7kE.js +4 -0
  195. package/dist/chunks/{poorMode-CYXmr_mU.js → poorMode-BxsyllUK.js} +1 -1
  196. package/dist/chunks/poorMode-iV1NwC5L.js +1 -0
  197. package/dist/chunks/print-CAUvczBM.js +23 -0
  198. package/dist/chunks/processBashCommand-CdeQg_c6.js +1 -0
  199. package/dist/chunks/processSlashCommand-CbkshIC6.js +5 -0
  200. package/dist/chunks/{projectContext-D9MDwJUF.js → projectContext-CIxul6vA.js} +1 -1
  201. package/dist/chunks/{projectContext-BaDZBAoK.js → projectContext-RUMJB798.js} +1 -1
  202. package/dist/chunks/prompt-CybUvG8G.js +139 -0
  203. package/dist/chunks/prompt-RBn4JdEg.js +1 -0
  204. package/dist/chunks/prompt-Rb8zXlDo.js +1 -0
  205. package/dist/chunks/promptEditor-0Ug93P2I.js +4 -0
  206. package/dist/chunks/{protocolHandler-RNKkhq91.js → protocolHandler-ClfbHTjI.js} +1 -1
  207. package/dist/chunks/{proxy-BmtEnJ02.js → proxy-Blq4W6Ox.js} +1 -1
  208. package/dist/chunks/reconciler-Drq3HSkj.js +4 -0
  209. package/dist/chunks/refresh-D8TLHO_T.js +1 -0
  210. package/dist/chunks/{registerProtocol-DoKqmqu2.js → registerProtocol-3_ozAuDK.js} +1 -1
  211. package/dist/chunks/reload-plugins-Dn1ibOiI.js +1 -0
  212. package/dist/chunks/{remoteBridgeCore-Cddqv2WW.js → remoteBridgeCore-Dpg6Se9C.js} +1 -1
  213. package/dist/chunks/remoteManagedSettings-CCrq-qL-.js +1 -0
  214. package/dist/chunks/rename-CKsSc7Z3.js +1 -0
  215. package/dist/chunks/{renderOptions-ChLwxtVu.js → renderOptions-CLcco6fc.js} +1 -1
  216. package/dist/chunks/replBridgeHandle-DNC797_T.js +1 -0
  217. package/dist/chunks/resume-B1a5gLVR.js +2 -0
  218. package/dist/chunks/ripgrep-BisRODQ2.js +1 -0
  219. package/dist/chunks/{ripgrep-gaT9Njwi.js → ripgrep-DkL2S7-I.js} +1 -1
  220. package/dist/chunks/{runtimeObserver-CsIwinzh.js → runtimeObserver-B0xfyLiA.js} +1 -1
  221. package/dist/chunks/{runtimeObserver-Dbxxw4ls.js → runtimeObserver-DonWCJOx.js} +4 -4
  222. package/dist/chunks/sandbox-adapter-BnBOSkKJ.js +1 -0
  223. package/dist/chunks/sandbox-toggle-CSdnHWp-.js +1 -0
  224. package/dist/chunks/searchExtraTools-DbgfnQkH.js +1 -0
  225. package/dist/chunks/session-BbQlh2S5.js +2 -0
  226. package/dist/chunks/sessionFileAccessHooks-Xfr1NiXG.js +1 -0
  227. package/dist/chunks/sessionMemory-7UOFdp29.js +1 -0
  228. package/dist/chunks/sessionMemory-fAzgAS7Q.js +1 -0
  229. package/dist/chunks/sessionMemoryUtils-DVjFw5Bd.js +1 -0
  230. package/dist/chunks/sessionObserver-Cl26OdaW.js +1 -0
  231. package/dist/chunks/{sessionObserver-DoYc0ZOP.js → sessionObserver-XV6N0XER.js} +2 -2
  232. package/dist/chunks/{sessionState-CjNY991n.js → sessionState-BvECKycx.js} +1 -1
  233. package/dist/chunks/sessionStorage-DSj9yZkl.js +1 -0
  234. package/dist/chunks/{sessionStoragePortable-Cx6JQ5Ye.js → sessionStoragePortable-JZnGwqUM.js} +1 -1
  235. package/dist/chunks/sessionTitle-E1FvsKM9.js +14 -0
  236. package/dist/chunks/sessionTracing-ClGQ08jM.js +11 -0
  237. package/dist/chunks/settings-B-R9ZJNY.js +1 -0
  238. package/dist/chunks/settings-Xbq6AaD-.js +20 -0
  239. package/dist/chunks/settingsSync-NCN0a4sc.js +1 -0
  240. package/dist/chunks/setup-uZ0dSekt.js +3 -0
  241. package/dist/chunks/shadowedRuleDetection-B9iSx6mB.js +1 -0
  242. package/dist/chunks/{shellQuote-BUVKMu_P.js → shellQuote-Bth6IZgX.js} +1 -1
  243. package/dist/chunks/{sideQuestion-C780iYwd.js → sideQuestion-D2dPToW8.js} +3 -3
  244. package/dist/chunks/sinks-C7q46rvE.js +2 -0
  245. package/dist/chunks/sinks-D3bXeHlQ.js +1 -0
  246. package/dist/chunks/skillChangeDetector-C1EJ7rUL.js +1 -0
  247. package/dist/chunks/{skillGapStore-Dc1arohs.js → skillGapStore-DylpOKJ6.js} +2 -2
  248. package/dist/chunks/{skillLifecycle-DP6mY1Kp.js → skillLifecycle-GK-8eyyn.js} +2 -2
  249. package/dist/chunks/{skillSearchPanel-CpLTImaL.js → skillSearchPanel-mpaC62y4.js} +4 -4
  250. package/dist/chunks/skills-t6krW8GZ.js +1 -0
  251. package/dist/chunks/{src-CDCSSo0U2.js → src-P_wYS_NJ2.js} +1 -1
  252. package/dist/chunks/{src-CST_jFnT.js → src-r6ZFgWPx2.js} +1 -1
  253. package/dist/chunks/startupProfiler-BaiXZ9tr.js +1 -0
  254. package/dist/chunks/{startupProfiler-DCn_NxMH.js → startupProfiler-jeId9f2i.js} +2 -2
  255. package/dist/chunks/state-B4HwLt8i.js +1 -0
  256. package/dist/chunks/{state-Cn_m2NOf.js → state-BAGmpVBn.js} +1 -1
  257. package/dist/chunks/state-Bs5xweDL.js +1 -0
  258. package/dist/chunks/{staticRender-BIxpgNUq.js → staticRender-DrU6eWoq.js} +1 -1
  259. package/dist/chunks/{stats-Duk7_xjQ.js → stats-BJBhl-Lc.js} +1 -1
  260. package/dist/chunks/{status-peiVB_2j.js → status-BtsnKNVY.js} +1 -1
  261. package/dist/chunks/status-nZQEar7T.js +2 -0
  262. package/dist/chunks/{statusNoticeHelpers-B5U5c9PE.js → statusNoticeHelpers-DMqRGFOh.js} +1 -1
  263. package/dist/chunks/{stringUtils-B6FudhoZ.js → stringUtils-CbS6OkmE.js} +1 -1
  264. package/dist/chunks/subprocessEnv-CZkA9Cdp.js +1 -0
  265. package/dist/chunks/{subprocessEnv-vrwzMgKn.js → subprocessEnv-Ci8VV_bi.js} +1 -1
  266. package/dist/chunks/{switcher-BAMqSX7Z.js → switcher-77h2J5HC.js} +1 -1
  267. package/dist/chunks/switcher-B2CYzCC_.js +1 -0
  268. package/dist/chunks/{syncCache-Zl9kZRRl.js → syncCache-By_-buUC.js} +1 -1
  269. package/dist/chunks/tasks-BNrdmF9p.js +1 -0
  270. package/dist/chunks/teleport-mdnhIZBj.js +1 -0
  271. package/dist/chunks/{templateJobs-DR5fKFiO.js → templateJobs-Dkv4I9c1.js} +1 -1
  272. package/dist/chunks/{terminalSetup-DgRBt-JJ.js → terminalSetup-DQopnSPR.js} +1 -1
  273. package/dist/chunks/terminalSetup-DTGm1Eo2.js +33 -0
  274. package/dist/chunks/{theme-Bz6esfST.js → theme-BjpBVRf5.js} +1 -1
  275. package/dist/chunks/{tmux-DSU9tYIo.js → tmux-CMRiI6CD.js} +1 -1
  276. package/dist/chunks/{toolEventObserver-BSekCkM2.js → toolEventObserver-D-sNBvOe.js} +1 -1
  277. package/dist/chunks/toolPool-Di30gn_Y.js +1 -0
  278. package/dist/chunks/trustedDevice-CupLMpO8.js +1 -0
  279. package/dist/chunks/{trustedDevice-B0x9X0fb.js → trustedDevice-j1u2TG5U.js} +1 -1
  280. package/dist/chunks/{types-D7_37tP2.js → types-DWRxAH0E.js} +1 -1
  281. package/dist/chunks/{udsClient-CHoMMH28.js → udsClient-Cm3HqYUu.js} +1 -1
  282. package/dist/chunks/{updateCCB-D_kGQKPT.js → updateCCB-BlUAU2Vp.js} +8 -8
  283. package/dist/chunks/{upstreamproxy-Hmq-n8fw.js → upstreamproxy-DDVMwoRi.js} +1 -1
  284. package/dist/chunks/useExitOnCtrlCDWithKeybindings-D2FvHieH.js +1 -0
  285. package/dist/chunks/useMainLoopModel-ylPQNj7Z.js +1 -0
  286. package/dist/chunks/useManagePlugins-BbWJNLe8.js +1 -0
  287. package/dist/chunks/useMergedTools-B-Z9XQ6U.js +1 -0
  288. package/dist/chunks/useSearchInput-C6d6nt9S.js +1 -0
  289. package/dist/chunks/useSettingsErrors-DKh4rkGi.js +1 -0
  290. package/dist/chunks/{userAgent-BxTG7IMk.js → userAgent-Ng_TTjWr.js} +1 -1
  291. package/dist/chunks/util-D-X8i5Z2.js +1 -0
  292. package/dist/chunks/validatePlugin-DSw08u76.js +1 -0
  293. package/dist/chunks/vim-3mUqsEJm.js +1 -0
  294. package/dist/chunks/{which-CHLNJmtJ.js → which-DznMOwny.js} +1 -1
  295. package/dist/chunks/windowsPaths-1mgenSWa.js +1 -0
  296. package/dist/chunks/{windowsPaths-o62uq6LF.js → windowsPaths-BVztIhXM.js} +1 -1
  297. package/dist/chunks/{workSecret-DG9shvG0.js → workSecret-DtiFreRl.js} +1 -1
  298. package/dist/chunks/workerRegistry-DdOYjLm3.js +6 -0
  299. package/dist/chunks/worktree-BX1ULzrw.js +1 -0
  300. package/dist/cli.js +1 -1
  301. package/package.json +1 -1
  302. package/dist/chunks/AddWorkspaceDirectory-CwLtQld4.js +0 -1
  303. package/dist/chunks/App-Ba52HvYC.js +0 -1
  304. package/dist/chunks/ApproveApiKey-CEIfuUh0.js +0 -1
  305. package/dist/chunks/ApproveApiKey-D2MLQu2P.js +0 -1
  306. package/dist/chunks/BackgroundTasksDialog-IGDrkbWl.js +0 -2
  307. package/dist/chunks/BypassPermissionsModeDialog-GYhq--JR.js +0 -1
  308. package/dist/chunks/ClaudeMdExternalIncludesDialog-C-CTa-95.js +0 -1
  309. package/dist/chunks/ClaudeMdExternalIncludesDialog-Catv6BCJ.js +0 -1
  310. package/dist/chunks/ConsoleOAuthFlow-BeQXqUtX.js +0 -1
  311. package/dist/chunks/DiffDialog-AC5DSJrq.js +0 -6
  312. package/dist/chunks/Doctor-B9Rxsoy0.js +0 -1
  313. package/dist/chunks/Doctor-lhUBhEy5.js +0 -3
  314. package/dist/chunks/ExitFlow-Cu8SoQHs.js +0 -2
  315. package/dist/chunks/Grove-Bc4CofEj.js +0 -11
  316. package/dist/chunks/InvalidConfigDialog-BI13il58.js +0 -1
  317. package/dist/chunks/InvalidSettingsDialog-CtOheV1K.js +0 -1
  318. package/dist/chunks/MCPConnectionManager-ao-P3xSA.js +0 -1
  319. package/dist/chunks/MCPToolListView-dkofcJs4.js +0 -1
  320. package/dist/chunks/McpParsingWarnings-BS4JoR5l.js +0 -1
  321. package/dist/chunks/MessageSelector-B88b2ypw.js +0 -3
  322. package/dist/chunks/Messages-BPeI7lLV.js +0 -11
  323. package/dist/chunks/Onboarding-c2fQ8Io_.js +0 -1
  324. package/dist/chunks/PromptInputFooterSuggestions-D1cH9sDX.js +0 -1
  325. package/dist/chunks/PromptInputHelpMenu-DDD5WuK0.js +0 -1
  326. package/dist/chunks/QueryEngine-Cv_meCam.js +0 -1
  327. package/dist/chunks/REPL-BXhAQOXb.js +0 -139
  328. package/dist/chunks/REPL-YqjLnr3A.js +0 -1
  329. package/dist/chunks/RemoteSessionManager-CT7T8BaR.js +0 -2
  330. package/dist/chunks/ResumeConversation-CIZCjms9.js +0 -1
  331. package/dist/chunks/SearchExtraToolsTool-Dx6093yw.js +0 -1
  332. package/dist/chunks/Settings-CyUm0AtU.js +0 -2
  333. package/dist/chunks/TeleportProgress-C3qyp5zy.js +0 -1
  334. package/dist/chunks/TeleportRepoMismatchDialog-BV--nyYn.js +0 -1
  335. package/dist/chunks/TeleportResumeWrapper-Blo2cZg-.js +0 -1
  336. package/dist/chunks/ThemePicker-EQ6hPUeI.js +0 -1
  337. package/dist/chunks/add-dir-DPQV0qml.js +0 -1
  338. package/dist/chunks/agents-DmybpgDN.js +0 -103
  339. package/dist/chunks/allErrors-BPn_2TrB.js +0 -1
  340. package/dist/chunks/analytics-CkYUHW_U.js +0 -1
  341. package/dist/chunks/ant-DjdvlLOo.js +0 -1
  342. package/dist/chunks/api-AMgj1zf_.js +0 -1
  343. package/dist/chunks/asciicast-BJNYO5sh.js +0 -4
  344. package/dist/chunks/asciicast-CH6hdK0a.js +0 -1
  345. package/dist/chunks/auth-CNjDn1VY.js +0 -15
  346. package/dist/chunks/auth-CZzP483s.js +0 -1
  347. package/dist/chunks/auth-DDSBm_Yj.js +0 -1
  348. package/dist/chunks/autonomy-D4xZLOdJ.js +0 -15
  349. package/dist/chunks/backgroundHousekeeping--eBgphcg.js +0 -17
  350. package/dist/chunks/backgroundHousekeeping-VV1V_Y2Z.js +0 -1
  351. package/dist/chunks/bg-BK_9J6F6.js +0 -1
  352. package/dist/chunks/branch-BYq0zpzT.js +0 -3
  353. package/dist/chunks/bridgeConfig-C82un7rJ.js +0 -1
  354. package/dist/chunks/btw-CUV3nRrE.js +0 -1
  355. package/dist/chunks/caches-BZ59_En6.js +0 -1
  356. package/dist/chunks/caches-Cg-HtWKG.js +0 -1
  357. package/dist/chunks/client-DQXvVKND.js +0 -1
  358. package/dist/chunks/client-DkgC-mFB.js +0 -1
  359. package/dist/chunks/color-CBsNbt1s.js +0 -1
  360. package/dist/chunks/commands-qM5z_Uld.js +0 -1
  361. package/dist/chunks/compact-BclJiRJe.js +0 -2
  362. package/dist/chunks/completionCache-BMHAktkM.js +0 -1
  363. package/dist/chunks/config-CE058cvr.js +0 -3
  364. package/dist/chunks/config-D81avYye.js +0 -1
  365. package/dist/chunks/config-DpOOllGk.js +0 -1
  366. package/dist/chunks/context-noninteractive-DJb8H_hN.js +0 -1
  367. package/dist/chunks/context-sR9fJmXE.js +0 -1
  368. package/dist/chunks/conversation-D48Kt3ar.js +0 -1
  369. package/dist/chunks/conversation-fOFTa7k5.js +0 -1
  370. package/dist/chunks/createSession-CSwlW2T2.js +0 -1
  371. package/dist/chunks/crossProjectResume-lDFB2ZcY.js +0 -40
  372. package/dist/chunks/cwd-5Xr-Qka6.js +0 -1
  373. package/dist/chunks/datadog-BJn5ECIu.js +0 -1
  374. package/dist/chunks/detectRepository-DqQvyj_a.js +0 -1
  375. package/dist/chunks/directoryCompletion-BagQcynj.js +0 -1
  376. package/dist/chunks/doctor-BEHYm34V.js +0 -1
  377. package/dist/chunks/entry-BzL1MFQG.js +0 -14
  378. package/dist/chunks/envUtils-DSxRz_kt.js +0 -1
  379. package/dist/chunks/eventLoopStallDetector-Cg_RXU1q.js +0 -1
  380. package/dist/chunks/exit-DE2YiAhQ.js +0 -1
  381. package/dist/chunks/extraUsage-Dw7AXiH7.js +0 -1
  382. package/dist/chunks/extractMemories-DxTUMiv3.js +0 -1
  383. package/dist/chunks/fast-CHmMkIpE.js +0 -1
  384. package/dist/chunks/fast-uQASHWqR.js +0 -1
  385. package/dist/chunks/fileSuggestions-Dyu2kQtE.js +0 -3
  386. package/dist/chunks/firstPartyEventLogger-D5ohKbIe.js +0 -5
  387. package/dist/chunks/firstPartyEventLogger-LsNY6yOt.js +0 -1
  388. package/dist/chunks/generateRecap-CiFxXlmH.js +0 -1
  389. package/dist/chunks/generateSessionName-DitoBxJT.js +0 -1
  390. package/dist/chunks/git-D6dOU2mT.js +0 -1
  391. package/dist/chunks/githubRepoPathMapping-DGr0kJ8D.js +0 -1
  392. package/dist/chunks/goal-DuUayfDg.js +0 -3
  393. package/dist/chunks/grok-tRbmZzEh.js +0 -1
  394. package/dist/chunks/grove-Cv19v6Sv.js +0 -7
  395. package/dist/chunks/help-DkqxbFDM.js +0 -1
  396. package/dist/chunks/hooks-CsP42iOp.js +0 -1
  397. package/dist/chunks/initReplBridge-DdsSWVqN.js +0 -1
  398. package/dist/chunks/keybindings-DZU3vwo3.js +0 -2
  399. package/dist/chunks/language-DHhXLb_Y.js +0 -1
  400. package/dist/chunks/launchLocalMemory-twLxpPvg.js +0 -3
  401. package/dist/chunks/launchOnboarding-BWz2XSb9.js +0 -8
  402. package/dist/chunks/lib-rQZENxQg.js +0 -8
  403. package/dist/chunks/loadAgentsDir-CMNFLt7R.js +0 -1
  404. package/dist/chunks/loadPluginHooks-BPnxcgrL.js +0 -1
  405. package/dist/chunks/localSearch-DzQODFap.js +0 -1
  406. package/dist/chunks/logoV2Utils-CGUJ-5gY.js +0 -1
  407. package/dist/chunks/main-D4Uk-WUs.js +0 -862
  408. package/dist/chunks/managedEnv-DLVRBaA9.js +0 -1
  409. package/dist/chunks/mcp-BMVdGknC.js +0 -1
  410. package/dist/chunks/mcp-COS5RJFS.js +0 -6
  411. package/dist/chunks/mcp-tGsOW1GN.js +0 -2
  412. package/dist/chunks/memory-DR6poqeH.js +0 -1
  413. package/dist/chunks/mode-QV-NW1Wd.js +0 -2
  414. package/dist/chunks/model-BF_4ebyl.js +0 -1
  415. package/dist/chunks/model-BNU_ulDJ.js +0 -1
  416. package/dist/chunks/model-CwO-g1RW.js +0 -1
  417. package/dist/chunks/nativeInstaller-B-lNJjM-.js +0 -1
  418. package/dist/chunks/oauth-BqJqV-2M.js +0 -1
  419. package/dist/chunks/oauth-C8X_p8Gc.js +0 -1
  420. package/dist/chunks/omit-DZCEXri5.js +0 -1
  421. package/dist/chunks/onChangeAppState-BmfM5g-D.js +0 -1
  422. package/dist/chunks/p-map-B1EeBuI8.js +0 -1
  423. package/dist/chunks/p-map-HKDr3iDo.js +0 -1
  424. package/dist/chunks/panelCall-SbffM7G4.js +0 -1
  425. package/dist/chunks/parser-DrBC8nWp.js +0 -1
  426. package/dist/chunks/partition-DKuAFJkc.js +0 -1
  427. package/dist/chunks/path-Cv9QMBAX.js +0 -1
  428. package/dist/chunks/permissions-ey-bfanE.js +0 -3
  429. package/dist/chunks/pidLock-DJnS_38v.js +0 -3
  430. package/dist/chunks/plan-Brg9XnRr.js +0 -1
  431. package/dist/chunks/plugin-CRwa39Y1.js +0 -17
  432. package/dist/chunks/pluginAutoupdate-D0LIP7cy.js +0 -1
  433. package/dist/chunks/pluginBlocklist-PwHHD3nj.js +0 -1
  434. package/dist/chunks/pluginCliCommands-BJM5Bdpf.js +0 -1
  435. package/dist/chunks/pluginOperations-C7p_Qr2r.js +0 -2
  436. package/dist/chunks/pluginStartupCheck-C0HqhG6D.js +0 -1
  437. package/dist/chunks/plugins-DUKNjLq6.js +0 -4
  438. package/dist/chunks/poorMode-CejPNCp-.js +0 -1
  439. package/dist/chunks/print-gyTOCJzk.js +0 -23
  440. package/dist/chunks/processBashCommand-Cze9vCm6.js +0 -1
  441. package/dist/chunks/processSlashCommand-BRajh1v7.js +0 -5
  442. package/dist/chunks/prompt-B7joRiqj.js +0 -139
  443. package/dist/chunks/prompt-DqSMh2x9.js +0 -1
  444. package/dist/chunks/prompt-Eysh8Et_.js +0 -1
  445. package/dist/chunks/promptEditor-R_acDAgI.js +0 -4
  446. package/dist/chunks/reconciler-BfkO6X2X.js +0 -4
  447. package/dist/chunks/refresh-C1X3sptR.js +0 -1
  448. package/dist/chunks/reload-plugins-C0osFcNh.js +0 -1
  449. package/dist/chunks/remoteManagedSettings-B1mnRDmA.js +0 -1
  450. package/dist/chunks/rename-B3tf-YiD.js +0 -1
  451. package/dist/chunks/replBridgeHandle-CNwNIijW.js +0 -1
  452. package/dist/chunks/resume-Be1G_GBL.js +0 -2
  453. package/dist/chunks/ripgrep-C2PhTJDh.js +0 -1
  454. package/dist/chunks/rollback-BPWRKlIZ.js +0 -11
  455. package/dist/chunks/sandbox-adapter-C6GBuJPB.js +0 -1
  456. package/dist/chunks/sandbox-toggle-jEySONTW.js +0 -1
  457. package/dist/chunks/sdkHeapDumpMonitor-WdXUV7DV.js +0 -1
  458. package/dist/chunks/searchExtraTools-C_UTryh_.js +0 -1
  459. package/dist/chunks/session-DDI1Eb2x.js +0 -2
  460. package/dist/chunks/sessionDataUploader-CaCjwsA2.js +0 -1
  461. package/dist/chunks/sessionFileAccessHooks-DfJ7Htfl.js +0 -1
  462. package/dist/chunks/sessionMemory-CQBxPkTQ.js +0 -1
  463. package/dist/chunks/sessionMemory-s0ALUHvc.js +0 -1
  464. package/dist/chunks/sessionMemoryUtils-xt7dTHGC.js +0 -1
  465. package/dist/chunks/sessionObserver-C2sYqWL3.js +0 -1
  466. package/dist/chunks/sessionStorage-DqsY-7pi.js +0 -1
  467. package/dist/chunks/sessionTitle-B0OYf5nM.js +0 -14
  468. package/dist/chunks/sessionTracing-CwsXt_uA.js +0 -11
  469. package/dist/chunks/settings-BWtOA9A7.js +0 -1
  470. package/dist/chunks/settings-hQDLwPVj.js +0 -20
  471. package/dist/chunks/settingsSync-DdFagwHV.js +0 -1
  472. package/dist/chunks/setup-DzC22EkN.js +0 -3
  473. package/dist/chunks/shadowedRuleDetection-C86PTj1m.js +0 -1
  474. package/dist/chunks/sinks-5G_xhc1Q.js +0 -1
  475. package/dist/chunks/sinks-Cftq7Es0.js +0 -2
  476. package/dist/chunks/skillChangeDetector-plLveEbf.js +0 -1
  477. package/dist/chunks/skills-zGYaYfFV.js +0 -1
  478. package/dist/chunks/startupProfiler-JbpAkfNE.js +0 -1
  479. package/dist/chunks/state-C2OSZkV1.js +0 -1
  480. package/dist/chunks/state-DU9lRJ9x.js +0 -1
  481. package/dist/chunks/status-CFw-FpZM.js +0 -2
  482. package/dist/chunks/subprocessEnv-BSQSomcK.js +0 -1
  483. package/dist/chunks/switcher-hgBgVzLb.js +0 -1
  484. package/dist/chunks/tasks-BxpyRhmD.js +0 -1
  485. package/dist/chunks/teleport-CwxeD5vL.js +0 -1
  486. package/dist/chunks/terminalSetup-DlaFWI81.js +0 -33
  487. package/dist/chunks/toolPool-B7SIoDw5.js +0 -1
  488. package/dist/chunks/trustedDevice-CjHQtVkO.js +0 -1
  489. package/dist/chunks/up-B8wBSpLg.js +0 -12
  490. package/dist/chunks/useExitOnCtrlCDWithKeybindings-Cce612uS.js +0 -1
  491. package/dist/chunks/useMainLoopModel-BICP6_Fi.js +0 -1
  492. package/dist/chunks/useManagePlugins-DtbY_vPL.js +0 -1
  493. package/dist/chunks/useMergedTools-Ckx2IEhF.js +0 -1
  494. package/dist/chunks/useSearchInput-BAgljZUl.js +0 -1
  495. package/dist/chunks/useSettingsErrors-CAJR_wpd.js +0 -1
  496. package/dist/chunks/util-DDtmyq_r.js +0 -1
  497. package/dist/chunks/validatePlugin-AHl-g4ct.js +0 -1
  498. package/dist/chunks/vim-kg-mRVbu.js +0 -1
  499. package/dist/chunks/windowsPaths-Pmx8LDR6.js +0 -1
  500. package/dist/chunks/workerRegistry-C7H_lsQX.js +0 -6
  501. package/dist/chunks/worktree-O2p-mJdF.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{Ew as i,I as a,L as o,R as s,Sd as c,_m as l,dd as u,fd as d,vm as f,xd as p}from"./loadAgentsDir-CKSb56Gp.js";import{D as m,I as h,P as g,T as _,Wt as v,fi as y,t as b,vn as x,y as S,yn as C}from"./src-P_wYS_NJ2.js";import{t as w}from"./jsx-runtime-Bb4Xn-E0.js";import{r as T,t as E}from"./directoryCompletion-D5AvL7TF.js";import{r as D,t as O}from"./PromptInputFooterSuggestions-BpC9COmh.js";function k(){return(0,P.jsx)(g,{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)(h,{flexDirection:`column`,paddingX:2,gap:1,children:[(0,P.jsx)(g,{color:`permission`,children:e}),(0,P.jsx)(k,{})]})}function j({value:e,onChange:t,onSubmit:n,error:i,suggestions:a,selectedSuggestion:o}){return(0,P.jsxs)(h,{flexDirection:`column`,children:[(0,P.jsx)(g,{children:`Enter the path to the directory:`}),(0,P.jsx)(h,{borderDimColor:!0,borderStyle:`round`,marginY:1,paddingLeft:1,children:(0,P.jsx)(p,{showCursor:!0,placeholder:`Directory path${r.ellipsis}`,value:e,onChange:t,onSubmit:n,columns:80,cursorOffset:e.length,onChangeCursorOffset:()=>{}})}),a.length>0&&(0,P.jsx)(h,{marginBottom:1,children:(0,P.jsx)(O,{suggestions:a,selectedSuggestion:o})}),i&&(0,P.jsx)(g,{color:`error`,children:i})]})}function M({onAddDirectory:e,onCancel:t,permissionContext:n,directoryPath:r}){let[i,o]=(0,N.useState)(``),[c,d]=(0,N.useState)(null),[f,p]=(0,N.useState)([]),[y,b]=(0,N.useState)(0),x=(0,N.useMemo)(()=>F,[]),w=C((0,N.useCallback)(async e=>{if(!e){p([]),b(0);return}let t=await E(e);p(t),b(0)},[]),100);(0,N.useEffect)(()=>{w(i)},[i,w]);let T=(0,N.useCallback)(e=>{let t=e.id+`/`;o(t),d(null)},[]),D=(0,N.useCallback)(async t=>{let r=await s(t,n);r.resultType===`success`?e(r.absolutePath,!1):d(a(r))},[n,e]);v(`confirm:no`,t,{context:`Settings`});let O=(0,N.useCallback)(e=>{if(f.length>0){if(e.key===`tab`){e.preventDefault();let t=f[y];t&&T(t);return}if(e.key===`return`){e.preventDefault();let t=f[y];t&&D(t.id+`/`);return}if(e.key===`up`||e.ctrl&&e.key===`p`){e.preventDefault(),b(e=>e<=0?f.length-1:e-1);return}if(e.key===`down`||e.ctrl&&e.key===`n`){e.preventDefault(),b(e=>e>=f.length-1?0:e+1);return}}},[f,y,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)(h,{flexDirection:`column`,tabIndex:0,autoFocus:!0,onKeyDown:O,children:(0,P.jsx)(S,{title:`Add directory to workspace`,onCancel:t,color:`permission`,isCancelActive:!1,inputGuide:r?void 0:e=>e.pending?(0,P.jsxs)(g,{children:[`Press `,e.keyName,` again to exit`]}):(0,P.jsxs)(_,{children:[(0,P.jsx)(m,{shortcut:`Tab`,action:`complete`}),(0,P.jsx)(m,{shortcut:`Enter`,action:`add`}),(0,P.jsx)(l,{action:`confirm:no`,context:`Settings`,fallback:`Esc`,description:`cancel`})]}),children:r?(0,P.jsxs)(h,{flexDirection:`column`,gap:1,children:[(0,P.jsx)(A,{path:r}),(0,P.jsx)(u,{options:x,onChange:M,onCancel:()=>M(`no`)})]}):(0,P.jsxs)(h,{flexDirection:`column`,gap:1,marginX:2,children:[(0,P.jsx)(k,{}),(0,P.jsx)(j,{value:i,onChange:o,onSubmit:D,error:c,suggestions:f,selectedSuggestion:y})]})})})}var N,P,F,I=e((()=>{n(),y(),N=t(y(),1),x(),o(),c(),b(),i(),T(),f(),d(),D(),P=w(),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{av as e,ov as t}from"./loadAgentsDir-CKSb56Gp.js";import{R as n,fi as r,t as i}from"./src-P_wYS_NJ2.js";import{t as a}from"./jsx-runtime-Bb4Xn-E0.js";import{c as o,h as s,y as c}from"./config-D4G8_MqJ.js";import{n as l}from"./onChangeAppState-DhBO34OK.js";import{t as u}from"./fpsMetrics-DffAomdg.js";import{t as d}from"./stats-BJBhl-Lc.js";r(),t(),i(),s();var f=a();function p({getFpsMetrics:t,stats:r,initialState:i,children:a}){return(0,f.jsx)(u,{getFpsMetrics:t,children:(0,f.jsx)(d,{store:r,children:(0,f.jsx)(e,{initialState:i,onChangeAppState:l,children:(0,f.jsx)(n,{initialState:o().theme,onThemeSave:e=>c(t=>({...t,theme:e})),children:a})})})})}export{p as App};
@@ -0,0 +1 @@
1
+ import{t as e}from"./ApproveApiKey-DHAbdwkC.js";export{e as ApproveApiKey};
@@ -0,0 +1 @@
1
+ import"./rolldown-runtime-DaDcL9Zw.js";import{dd as e,ud as t}from"./loadAgentsDir-CKSb56Gp.js";import{P as n,fi as r,t as i,y as a}from"./src-P_wYS_NJ2.js";import{t as o}from"./jsx-runtime-Bb4Xn-E0.js";import{h as s,y as c}from"./config-D4G8_MqJ.js";r(),i(),s(),t();var l=o();function u({customApiKeyTruncated:t,onDone:r}){function i(e){switch(e){case`yes`:c(e=>({...e,customApiKeyResponses:{...e.customApiKeyResponses,approved:[...e.customApiKeyResponses?.approved??[],t]}})),r(!0);break;case`no`:c(e=>({...e,customApiKeyResponses:{...e.customApiKeyResponses,rejected:[...e.customApiKeyResponses?.rejected??[],t]}})),r(!1);break}}return(0,l.jsxs)(a,{title:`Detected a custom API key in your environment`,color:`warning`,onCancel:()=>i(`no`),children:[(0,l.jsxs)(n,{children:[(0,l.jsx)(n,{bold:!0,children:`ANTHROPIC_API_KEY`}),(0,l.jsxs)(n,{children:[`: sk-ant-...`,t]})]}),(0,l.jsx)(n,{children:`Do you want to use this API key?`}),(0,l.jsx)(e,{defaultValue:`no`,defaultFocusValue:`no`,options:[{label:`Yes`,value:`yes`},{label:(0,l.jsxs)(n,{children:[`No (`,(0,l.jsx)(n,{bold:!0,children:`recommended`}),`)`]}),value:`no`}],onChange:e=>i(e),onCancel:()=>i(`no`)})]})}export{u as t};
@@ -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{Dw as o,Ew as s,Jp as c,Of as l,Ow as u,Qa as d,Qf as f,Ra as p,Sm as m,Xf as h,Xs as ee,Yp as g,Zs as _,aw as v,cu as y,dd as b,dl as x,du as S,fd as te,fl as ne,hd as re,hu as ie,iv as ae,iw as oe,iy as se,jn as C,kf as ce,kn as le,lu as ue,lv as de,ma as fe,nm as pe,np as me,oo as he,ov as ge,pw as _e,rp as ve,rv as ye,su as be,sv as xe,sy as Se,tm as Ce,uu as we,vd as Te,xm as Ee,yu as De}from"./loadAgentsDir-CKSb56Gp.js";import{D as w,Gt as T,H as Oe,I as E,Lt as ke,P as D,T as O,fi as k,mt as Ae,ot as je,t as A,y as j}from"./src-P_wYS_NJ2.js";import{t as M}from"./jsx-runtime-Bb4Xn-E0.js";import{F as Me,p as Ne,v as Pe,z as Fe}from"./debug-BdqxZ7rV.js";import{In as Ie,Ln as Le,Rn as Re,Ut as ze}from"./settings-Xbq6AaD-.js";import{C as Be,b as N,f as Ve,l as He,u as Ue,v as P}from"./startupProfiler-jeId9f2i.js";import{l as F,o as We}from"./stringUtils-CbS6OkmE.js";import{Ct as Ge,bn as Ke,vn as qe,yn as Je}from"./prompt-CybUvG8G.js";import{i as Ye,n as Xe}from"./mappers-xQC-Z4-h.js";function I(e,t,n=1e3,r=0,i){let a=()=>He(Math.max(0,(i??Date.now())-e-r));return(0,Ze.useSyncExternalStore)((0,Ze.useCallback)(e=>{if(!t)return()=>{};let r=setInterval(e,n);return()=>clearInterval(r)},[t,n]),a,a)}var Ze,L=t((()=>{Ze=n(k(),1),P()}));function Qe(e,t,n){let r=qe(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,$e.jsxs)(D,{children:[a,`(`,o,`)`]}):a}catch{return e.toolName}}var $e,et=t((()=>{k(),A(),Ke(),$e=M()}));function tt(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 nt(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 rt(e,t){if(!t)return!1;let n=!1;for(let t of Object.values(e))if(ve(t))return n=!0,!1;return n}var it=t((()=>{i(),me()}));function at({agent:e,onDone:t,onKillAgent:n,onBack:r}){let[i]=Oe(),a=(0,ot.useMemo)(()=>x(Je()),[]),o=I(e.startTime,e.status===`running`,1e3,e.totalPausedMs??0);T({"confirm:yes":t},{context:`Confirmation`});let s=i=>{i.key===` `?(i.preventDefault(),t()):i.key===`left`&&r?(i.preventDefault(),r()):i.key===`x`&&e.status===`running`&&n&&(i.preventDefault(),n())},c=p(e.prompt,`plan`),l=e.prompt.length>300?e.prompt.substring(0,297)+`…`:e.prompt,u=e.result?.totalTokens??e.progress?.tokenCount,d=e.result?.totalToolUseCount??e.progress?.toolUseCount;return(0,R.jsx)(E,{flexDirection:`column`,tabIndex:0,autoFocus:!0,onKeyDown:s,children:(0,R.jsx)(j,{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:nt(e.status),children:[tt(e.status),` `,e.status===`completed`?`Completed`:e.status===`failed`?`Failed`:`Stopped`,` · `]}),(0,R.jsxs)(D,{dimColor:!0,children:[o,u!==void 0&&u>0&&(0,R.jsxs)(R.Fragment,{children:[` · `,Ve(u),` tokens`]}),d!==void 0&&d>0&&(0,R.jsxs)(R.Fragment,{children:[` `,`· `,d,` `,d===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)(O,{children:[r&&(0,R.jsx)(w,{shortcut:`←`,action:`go back`}),(0,R.jsx)(w,{shortcut:`Esc/Enter/Space`,action:`close`}),e.status===`running`&&n&&(0,R.jsx)(w,{shortcut:`x`,action:`stop`})]}),children:(0,R.jsxs)(E,{flexDirection:`column`,children:[e.status===`running`&&e.progress?.recentActivities&&e.progress.recentActivities.length>0&&(0,R.jsxs)(E,{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?`› `:` `,Qe(t,a,i)]},n))]}),c?(0,R.jsx)(E,{marginTop:1,children:(0,R.jsx)(Ce,{addMargin:!1,planContent:c})}):(0,R.jsxs)(E,{flexDirection:`column`,marginTop:1,children:[(0,R.jsx)(D,{bold:!0,dimColor:!0,children:`Prompt`}),(0,R.jsx)(D,{wrap:`wrap`,children:l})]}),e.status===`failed`&&e.error&&(0,R.jsxs)(E,{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 ot,R,st=t((()=>{ot=n(k(),1),L(),A(),s(),Ke(),ne(),P(),d(),pe(),et(),it(),R=M()}));function ct(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 lt({text:e,phase:t=0}){return(0,z.jsx)(z.Fragment,{children:[...e].map((e,n)=>(0,z.jsx)(D,{color:c(n+t),children:e},n))})}function ut(e,t,n){let r=(0,pt.useRef)(e),i=(0,pt.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 dt({session:e}){let t=ae().prefersReducedMotion??!1,n=e.reviewProgress,r=e.status===`running`,[,i]=Ae(r&&!t?mt:null),a=n?.bugsFound??0,o=n?.bugsVerified??0,s=n?.bugsRefuted??0,c=t||!r,l=ut(a,i,c),u=ut(o,i,c),d=ut(s,i,c),f=Math.floor(i/(mt*3))%7;if(e.status===`completed`)return(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(D,{color:`background`,children:[`◆`,` `]}),(0,z.jsx)(lt,{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)(lt,{text:`ultrareview`,phase:0}),(0,z.jsxs)(D,{color:`error`,dimColor:!0,children:[` · `,`error`]})]});let p=n?ct(n.stage,l,u,d):`setting up`;return(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(D,{color:`background`,children:[`◇`,` `]}),(0,z.jsx)(lt,{text:`ultrareview`,phase:r?f:0}),(0,z.jsxs)(D,{dimColor:!0,children:[` · `,p]})]})}function ft({session:e}){if(e.isRemoteReview)return(0,z.jsx)(dt,{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=Ie(e.todoList,e=>e.status===`completed`),n=e.todoList.length;return(0,z.jsxs)(D,{dimColor:!0,children:[t,`/`,n]})}var pt,z,mt,ht=t((()=>{pt=n(k(),1),ze(),ye(),A(),Le(),g(),z=M(),mt=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 gt({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,_t=t((()=>{A(),V=M()}));function vt({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)(gt,{shell:e})]});case`remote_agent`:return e.isRemoteReview?(0,H.jsx)(D,{children:(0,H.jsx)(ft,{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)(ft,{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,yt=t((()=>{k(),A(),P(),We(),ze(),ht(),_t(),H=M()}));function bt({task:e,onDone:t,onBack:n,onKill:r}){let i=I(e.startTime,e.status===`running`,1e3,0);T({"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())},o=e.turns.filter(e=>e.text!==``),s=o.slice(-6),c=o.length-s.length;return(0,U.jsx)(E,{flexDirection:`column`,tabIndex:0,autoFocus:!0,onKeyDown:a,children:(0,U.jsx)(j,{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)(O,{children:[n&&(0,U.jsx)(w,{shortcut:`←`,action:`go back`}),(0,U.jsx)(w,{shortcut:`Esc/Enter/Space`,action:`close`}),e.status===`running`&&r&&(0,U.jsx)(w,{shortcut:`x`,action:`stop`})]}),children:(0,U.jsxs)(E,{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})]}),s.length===0?(0,U.jsx)(D,{dimColor:!0,children:e.status===`running`?`Starting…`:`(no text output)`}):(0,U.jsxs)(U.Fragment,{children:[c>0&&(0,U.jsxs)(D,{dimColor:!0,children:[`(`,c,` earlier `,F(c,`turn`),`)`]}),s.map((e,t)=>(0,U.jsxs)(E,{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,xt=t((()=>{k(),L(),A(),s(),We(),U=M()}));function St({stage:e,completed:t,hasProgress:n}){let r=e?Et.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:` → `}),Et.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:Dt[e]}):(0,G.jsx)(D,{dimColor:!0,children:Dt[e]})]},e)}),t&&(0,G.jsx)(D,{color:`success`,children:` ✓`})]})}function Ct(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 ct(t.stage,t.bugsFound,n,r)}function wt({session:e,onDone:t,onBack:n,onKill:r}){let i=e.status===`completed`,a=e.status===`running`||e.status===`pending`,[o,s]=(0,W.useState)(!1),c=I(e.startTime,a,1e3,0,e.endTime),l=()=>t(`Remote session details dismissed`,{display:`system`}),u=n??l,d=we(e.sessionId),f=i?`ready`:a?`running`:e.status;if(o)return(0,G.jsx)(j,{title:`Stop ultrareview?`,onCancel:()=>s(!1),color:`background`,children:(0,G.jsxs)(E,{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)(b,{options:[{label:`Stop ultrareview`,value:`stop`},{label:`Back`,value:`back`}],onChange:e=>{e===`stop`?(r?.(),u()):s(!1)}})]})});let p=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)(j,{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:[` · `,c,` · `,f]})]}),onCancel:u,color:`background`,inputGuide:e=>e.pending?(0,G.jsxs)(D,{children:[`Press `,e.keyName,` again to exit`]}):(0,G.jsxs)(O,{children:[(0,G.jsx)(w,{shortcut:`Enter`,action:`select`}),(0,G.jsx)(w,{shortcut:`Esc`,action:`go back`})]}),children:(0,G.jsxs)(E,{flexDirection:`column`,gap:1,children:[(0,G.jsx)(St,{stage:e.reviewProgress?.stage,completed:i,hasProgress:!!e.reviewProgress}),(0,G.jsxs)(E,{flexDirection:`column`,children:[(0,G.jsx)(D,{children:Ct(e)}),(0,G.jsx)(ke,{url:d,children:(0,G.jsx)(D,{dimColor:!0,children:d})})]}),(0,G.jsx)(b,{options:p,onChange:e=>{switch(e){case`open`:v(d),t();break;case`stop`:s(!0);break;case`back`:u();break;case`dismiss`:l();break}}})]})})}function Tt({session:e,toolUseContext:t,onDone:n,onBack:r,onKill:i}){let[a,o]=(0,W.useState)(!1),[s,c]=(0,W.useState)(null),l=(0,W.useMemo)(()=>e.isRemoteReview?[]:he(Ye(e.log)).filter(e=>e.type!==`progress`).slice(-3),[e]);if(e.isRemoteReview)return(0,G.jsx)(wt,{session:e,onDone:n,onBack:r,onKill:i});let u=()=>n(`Remote session details dismissed`,{display:`system`}),d=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(),f()):e.key===`return`&&(e.preventDefault(),u())};async function f(){o(!0),c(null);try{await De(e.sessionId)}catch(e){c(Me(e))}finally{o(!1)}}let p=Be(e.title,50),m=e.status===`pending`?`starting`:e.status;return(0,G.jsx)(E,{flexDirection:`column`,tabIndex:0,autoFocus:!0,onKeyDown:d,children:(0,G.jsxs)(j,{title:`Remote session details`,onCancel:u,color:`background`,inputGuide:e=>e.pending?(0,G.jsxs)(D,{children:[`Press `,e.keyName,` again to exit`]}):(0,G.jsxs)(O,{children:[r&&(0,G.jsx)(w,{shortcut:`←`,action:`go back`}),(0,G.jsx)(w,{shortcut:`Esc/Enter/Space`,action:`close`}),!a&&(0,G.jsx)(w,{shortcut:`t`,action:`teleport`})]}),children:[(0,G.jsxs)(E,{flexDirection:`column`,children:[(0,G.jsxs)(D,{children:[(0,G.jsx)(D,{bold:!0,children:`Status`}),`:`,` `,m===`running`||m===`starting`?(0,G.jsx)(D,{color:`background`,children:m}):m===`completed`?(0,G.jsx)(D,{color:`success`,children:m}):(0,G.jsx)(D,{color:`error`,children:m})]}),(0,G.jsxs)(D,{children:[(0,G.jsx)(D,{bold:!0,children:`Runtime`}),`: `,He((e.endTime??Date.now())-e.startTime)]}),(0,G.jsxs)(D,{wrap:`truncate-end`,children:[(0,G.jsx)(D,{bold:!0,children:`Title`}),`: `,p]}),(0,G.jsxs)(D,{children:[(0,G.jsx)(D,{bold:!0,children:`Progress`}),`: `,(0,G.jsx)(ft,{session:e})]}),(0,G.jsxs)(D,{children:[(0,G.jsx)(D,{bold:!0,children:`Session URL`}),`:`,` `,(0,G.jsx)(ke,{url:we(e.sessionId),children:(0,G.jsx)(D,{dimColor:!0,children:we(e.sessionId)})})]})]}),e.log.length>0&&(0,G.jsxs)(E,{flexDirection:`column`,marginTop:1,children:[(0,G.jsxs)(D,{children:[(0,G.jsx)(D,{bold:!0,children:`Recent messages`}),`:`]}),(0,G.jsx)(E,{flexDirection:`column`,height:10,overflowY:`hidden`,children:l.map((e,n)=>(0,G.jsx)(h,{message:e,lookups:fe,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)(E,{marginTop:1,children:(0,G.jsxs)(D,{dimColor:!0,italic:!0,children:[`Showing last `,l.length,` of `,e.log.length,` messages`]})})]}),s&&(0,G.jsx)(E,{marginTop:1,children:(0,G.jsxs)(D,{color:`error`,children:[`Teleport failed: `,s]})}),a&&(0,G.jsx)(D,{color:`background`,children:`Teleporting to session…`})]})})}var W,G,Et,Dt,Ot=t((()=>{W=n(k(),1),ze(),L(),A(),S(),Ge(),oe(),Fe(),P(),Xe(),d(),We(),ie(),te(),f(),ht(),G=M(),Et=[`finding`,`verifying`,`synthesizing`],Dt={finding:`Find`,verifying:`Verify`,synthesizing:`Dedupe`}}));async function kt(e){let t=le(e.id);try{let e=await Pe(t,Mt);return{content:e.content,bytesTotal:e.bytesTotal}}catch{return{content:``,bytesTotal:0}}}function At({shell:e,onDone:t,onKillShell:n,onBack:r}){let{columns:i}=je(),[a,o]=(0,K.useState)(()=>kt(e)),s=(0,K.useDeferredValue)(a);(0,K.useEffect)(()=>{if(e.status!==`running`)return;let t=setInterval((e,t)=>e(kt(t)),1e3,o,e);return()=>clearInterval(t)},[e.id,e.status]);let c=()=>t(`Shell details dismissed`,{display:`system`});T({"confirm:yes":c},{context:`Confirmation`});let l=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())},u=e.kind===`monitor`,d=Be(e.command,280);return(0,q.jsx)(E,{flexDirection:`column`,tabIndex:0,autoFocus:!0,onKeyDown:l,children:(0,q.jsxs)(j,{title:u?`Monitor details`:`Shell details`,onCancel:c,color:`background`,inputGuide:t=>t.pending?(0,q.jsxs)(D,{children:[`Press `,t.keyName,` again to exit`]}):(0,q.jsxs)(O,{children:[r&&(0,q.jsx)(w,{shortcut:`←`,action:`go back`}),(0,q.jsx)(w,{shortcut:`Esc/Enter/Space`,action:`close`}),e.status===`running`&&n&&(0,q.jsx)(w,{shortcut:`x`,action:`stop`})]}),children:[(0,q.jsxs)(E,{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:`}),` `,He((e.endTime??Date.now())-e.startTime)]}),(0,q.jsxs)(D,{wrap:`wrap`,children:[(0,q.jsx)(D,{bold:!0,children:u?`Script:`:`Command:`}),` `,d]})]}),(0,q.jsxs)(E,{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)(jt,{outputPromise:s,columns:i})})]})]})})}function jt({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)(E,{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 ${Ue(r)}`:``]})]})}var K,q,Mt,Nt=t((()=>{K=n(k(),1),_e(),A(),s(),P(),Ne(),C(),q=M(),Mt=8192})),Pt=t((()=>{A()})),Ft=t((()=>{A()})),It=t((()=>{A()})),Lt=r({MonitorMcpDetailDialog:()=>Rt});function Rt({task:e,onBack:t,onKill:n}){let r=I(e.startTime,e.status===`running`,1e3,0);return T({},{context:`MonitorMcpDetail`}),(0,J.jsx)(E,{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)(j,{title:`MCP Monitor`,subtitle:(0,J.jsxs)(D,{dimColor:!0,children:[r,` · `,e.serverName,`:`,e.resourceUri]}),onCancel:t??(()=>{}),inputGuide:()=>(0,J.jsxs)(O,{children:[t&&(0,J.jsx)(w,{shortcut:`←`,action:`go back`}),(0,J.jsx)(w,{shortcut:`Esc`,action:`close`}),e.status===`running`&&n&&(0,J.jsx)(w,{shortcut:`x`,action:`stop`})]}),children:(0,J.jsxs)(E,{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,zt=t((()=>{k(),L(),A(),s(),Pt(),Ft(),It(),J=M()}));function Bt(e,t){return Object.values(e??{}).filter(ve).filter(e=>!(e.type===`local_agent`&&e.id===t))}function Vt({onDone:e,toolUseContext:t,initialDetailTaskId:n}){let r=xe(e=>e.tasks),i=xe(e=>e.foregroundedTaskId),a=de(),o=u(`chat:killAgents`,`Chat`,`ctrl+x ctrl+k`),s=r,c=(0,X.useRef)(!1),[d,f]=(0,X.useState)(()=>{if(n)return c.current=!0,{mode:`detail`,itemId:n};let e=Bt(s,i);return e.length===1?(c.current=!0,{mode:`detail`,itemId:e[0].id}):{mode:`list`}}),[p,m]=(0,X.useState)(0);Te(`background-tasks-dialog`);let{bashTasks:h,remoteSessions:g,agentTasks:_,workflowTasks:v,mcpMonitors:y,dreamTasks:b,allSelectableItems:x}=(0,X.useMemo)(()=>{let e=Object.values(s??{}).filter(ve).map(Ht).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`),c=e.filter(e=>e.type===`dream`);return{bashTasks:t,remoteSessions:n,agentTasks:r,workflowTasks:a,mcpMonitors:o,dreamTasks:c,allSelectableItems:[...t,...o,...n,...r,...a,...c]}},[s,i]),S=x[p]??null;T({"confirm:previous":()=>m(e=>Math.max(0,e-1)),"confirm:next":()=>m(e=>Math.min(x.length-1,e+1)),"confirm:yes":()=>{let e=x[p];e&&f({mode:`detail`,itemId:e.id})}},{context:`Confirmation`,isActive:d.mode===`list`});let te=t=>{if(d.mode!==`list`)return;if(t.key===`left`){t.preventDefault(),e(`Background tasks dialog dismissed`,{display:`system`});return}let n=x[p];n&&t.key===`x`&&(t.preventDefault(),n.type===`local_bash`&&n.status===`running`?ne(n.id):n.type===`local_agent`&&n.status===`running`?re(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`?ie(n.id):n.type===`remote_agent`&&n.status===`running`&&ae(n.id))};async function ne(e){await se.kill(e,a)}async function re(e){await ee.kill(e,a)}async function ie(e){await l.kill(e,a)}async function ae(e){await ue.kill(e,a)}let oe=(0,X.useEffectEvent)(e);(0,X.useEffect)(()=>{if(d.mode!==`list`){let e=(s??{})[d.itemId];(!e||e.type!==`local_workflow`&&!ve(e))&&(c.current?oe(`Background tasks dialog dismissed`,{display:`system`}):f({mode:`list`}))}let e=x.length;p>=e&&e>0&&m(e-1)},[d,s,p,x,oe]);let C=()=>{c.current&&x.length<=1?e(`Background tasks dialog dismissed`,{display:`system`}):(c.current=!1,f({mode:`list`}))};if(d.mode!==`list`&&s){let n=s[d.itemId];if(!n)return null;switch(n.type){case`local_bash`:return(0,Z.jsx)(At,{shell:n,onDone:e,onKillShell:()=>void ne(n.id),onBack:C},`shell-${n.id}`);case`local_agent`:return(0,Z.jsx)(at,{agent:n,onDone:e,onKillAgent:()=>void re(n.id),onBack:C},`agent-${n.id}`);case`remote_agent`:return(0,Z.jsx)(Tt,{session:n,onDone:e,toolUseContext:t,onBack:C,onKill:n.status===`running`?()=>void ae(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)(E,{flexDirection:`column`,tabIndex:0,borderStyle:`round`,onKeyDown:t=>{t.key===`left`?(t.preventDefault(),C()):t.key===`x`&&e&&(t.preventDefault(),e())},children:(0,Z.jsx)(j,{title:n.workflowName,subtitle:(0,Z.jsxs)(D,{dimColor:!0,children:[n.status,n.summary?` · ${n.summary}`:``]}),onCancel:C,inputGuide:()=>(0,Z.jsxs)(O,{children:[(0,Z.jsx)(w,{shortcut:`←`,action:`go back`}),(0,Z.jsx)(w,{shortcut:`Esc`,action:`close`}),e&&(0,Z.jsx)(w,{shortcut:`x`,action:`stop`})]}),children:n.status===`failed`&&n.error?(0,Z.jsxs)(E,{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 Ut?(0,Z.jsx)(Ut,{task:n,onKill:n.status===`running`&&$?()=>$(n.id,a):void 0,onBack:C},`monitor-mcp-${n.id}`):null;case`dream`:return(0,Z.jsx)(bt,{task:n,onDone:()=>e(`Background tasks dialog dismissed`,{display:`system`}),onBack:C,onKill:n.status===`running`?()=>void ie(n.id):void 0},`dream-${n.id}`)}}let ce=Ie(h,e=>e.status===`running`),le=Ie(g,e=>e.status===`running`||e.status===`pending`)+Ie(_,e=>e.status===`running`),fe=Re([...ce>0?[(0,Z.jsxs)(D,{children:[ce,` `,ce===1?`active shell`:`active shells`]},`shells`)]:[],...le>0?[(0,Z.jsxs)(D,{children:[le,` `,le===1?`active agent`:`active agents`]},`agents`)]:[]],e=>(0,Z.jsx)(D,{children:` · `},`separator-${e}`)),pe=[(0,Z.jsx)(w,{shortcut:`↑/↓`,action:`select`},`upDown`),(0,Z.jsx)(w,{shortcut:`Enter`,action:`view`},`enter`),...(S?.type===`local_bash`||S?.type===`local_agent`||S?.type===`local_workflow`||S?.type===`monitor_mcp`||S?.type===`dream`||S?.type===`remote_agent`)&&S.status===`running`?[(0,Z.jsx)(w,{shortcut:`x`,action:`stop`},`kill`)]:[],..._.some(e=>e.status===`running`)?[(0,Z.jsx)(w,{shortcut:o,action:`stop all agents`},`kill-all`)]:[],(0,Z.jsx)(w,{shortcut:`←/Esc`,action:`close`},`esc`)],me=()=>e(`Background tasks dialog dismissed`,{display:`system`});function he(e){return e.pending?(0,Z.jsxs)(D,{children:[`Press `,e.keyName,` again to exit`]}):(0,Z.jsx)(O,{children:pe})}return(0,Z.jsx)(E,{flexDirection:`column`,tabIndex:0,autoFocus:!0,onKeyDown:te,children:(0,Z.jsx)(j,{title:`Background tasks`,subtitle:(0,Z.jsx)(Z.Fragment,{children:fe}),onCancel:me,color:`background`,inputGuide:he,children:x.length===0?(0,Z.jsx)(D,{dimColor:!0,children:`No tasks currently running`}):(0,Z.jsxs)(E,{flexDirection:`column`,children:[h.length>0&&(0,Z.jsxs)(E,{flexDirection:`column`,children:[(g.length>0||_.length>0)&&(0,Z.jsxs)(D,{dimColor:!0,children:[(0,Z.jsxs)(D,{bold:!0,children:[` `,`Shells`]}),` (`,h.length,`)`]}),(0,Z.jsx)(E,{flexDirection:`column`,children:h.map(e=>(0,Z.jsx)(Y,{item:e,isSelected:e.id===S?.id},e.id))})]}),y.length>0&&(0,Z.jsxs)(E,{flexDirection:`column`,marginTop:+(h.length>0),children:[(0,Z.jsxs)(D,{dimColor:!0,children:[(0,Z.jsxs)(D,{bold:!0,children:[` `,`Monitors`]}),` (`,y.length,`)`]}),(0,Z.jsx)(E,{flexDirection:`column`,children:y.map(e=>(0,Z.jsx)(Y,{item:e,isSelected:e.id===S?.id},e.id))})]}),g.length>0&&(0,Z.jsxs)(E,{flexDirection:`column`,marginTop:+(h.length>0||y.length>0),children:[(0,Z.jsxs)(D,{dimColor:!0,children:[(0,Z.jsxs)(D,{bold:!0,children:[` `,`Remote agents`]}),` (`,g.length,`)`]}),(0,Z.jsx)(E,{flexDirection:`column`,children:g.map(e=>(0,Z.jsx)(Y,{item:e,isSelected:e.id===S?.id},e.id))})]}),_.length>0&&(0,Z.jsxs)(E,{flexDirection:`column`,marginTop:+(h.length>0||y.length>0||g.length>0),children:[(0,Z.jsxs)(D,{dimColor:!0,children:[(0,Z.jsxs)(D,{bold:!0,children:[` `,`Local agents`]}),` (`,_.length,`)`]}),(0,Z.jsx)(E,{flexDirection:`column`,children:_.map(e=>(0,Z.jsx)(Y,{item:e,isSelected:e.id===S?.id},e.id))})]}),v.length>0&&(0,Z.jsxs)(E,{flexDirection:`column`,marginTop:+(h.length>0||y.length>0||g.length>0||_.length>0),children:[(0,Z.jsxs)(D,{dimColor:!0,children:[(0,Z.jsxs)(D,{bold:!0,children:[` `,`Workflows`]}),` (`,v.length,`)`]}),(0,Z.jsx)(E,{flexDirection:`column`,children:v.map(e=>(0,Z.jsx)(Y,{item:e,isSelected:e.id===S?.id},e.id))})]}),b.length>0&&(0,Z.jsx)(E,{flexDirection:`column`,marginTop:+(h.length>0||y.length>0||g.length>0||_.length>0||v.length>0),children:(0,Z.jsx)(E,{flexDirection:`column`,children:b.map(e=>(0,Z.jsx)(Y,{item:e,isSelected:e.id===S?.id},e.id))})})]})})})}function Ht(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}=je(),r=Math.max(30,n-26);return(0,Z.jsxs)(E,{flexDirection:`row`,children:[(0,Z.jsx)(D,{children:t?a.pointer+` `:` `}),(0,Z.jsx)(D,{color:t?`suggestion`:void 0,children:(0,Z.jsx)(vt,{task:e.task,maxActivityWidth:r})})]})}var X,Z,Q,$,Ut,Wt=t((()=>{i(),X=n(k(),1),_e(),ge(),ce(),_(),Se(),S(),me(),Le(),re(),A(),s(),o(),st(),yt(),xt(),Ot(),Nt(),Z=M(),Q=(y(),e(be))?.killWorkflowTask??null,$=(m(),e(Ee))?.killMonitorMcp??null,Ut=(zt(),e(Lt)).MonitorMcpDetailDialog}));export{L as a,rt as i,Wt as n,I as o,it as r,Vt as t};
@@ -0,0 +1 @@
1
+ import{o as e}from"./rolldown-runtime-DaDcL9Zw.js";import{dd as t,df as n,ff as r,ud as i}from"./loadAgentsDir-CKSb56Gp.js";import{I as a,Lt as o,P as s,fi as c,kt as l,t as u,y as d}from"./src-P_wYS_NJ2.js";import{t as f}from"./jsx-runtime-Bb4Xn-E0.js";import{g as p,x as m}from"./settings-Xbq6AaD-.js";import{n as h,r as g}from"./analytics-DJobLaWP.js";var _=e(c(),1);h(),u(),r(),p(),i();var v=f();function y({onAccept:e}){let[r,i]=_.useState(null);_.useEffect(()=>{if(r!==null){let e=r,t=setTimeout(()=>n(e));return()=>clearTimeout(t)}},[r]),_.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`:i(1);break}}let u=(0,_.useCallback)(()=>{i(0)},[]);return r===null?(0,v.jsxs)(d,{title:`WARNING: Claude Code running in Bypass Permissions mode`,color:`error`,onCancel:u,children:[(0,v.jsxs)(a,{flexDirection:`column`,gap:1,children:[(0,v.jsxs)(s,{children:[`In Bypass Permissions mode, Claude Code will not ask for your approval before running potentially dangerous commands.`,(0,v.jsx)(l,{}),`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)(s,{children:`By proceeding, you accept all responsibility for actions taken while running in Bypass Permissions mode.`}),(0,v.jsx)(o,{url:`https://code.claude.com/docs/en/security`})]}),(0,v.jsx)(t,{options:[{label:`No, exit`,value:`decline`},{label:`Yes, I accept`,value:`accept`}],onChange:e=>c(e)})]}):null}export{y as BypassPermissionsModeDialog};
@@ -0,0 +1 @@
1
+ import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{dd as n,ud as r}from"./loadAgentsDir-CKSb56Gp.js";import{I as i,Lt as a,P as o,fi as s,t as c,y as l}from"./src-P_wYS_NJ2.js";import{t as u}from"./jsx-runtime-Bb4Xn-E0.js";import{h as d,v as f}from"./config-D4G8_MqJ.js";import{n as p,r as m}from"./analytics-DJobLaWP.js";function h({onDone:e,isStandaloneDialog:t,externalIncludes:r}){g.useEffect(()=>{m(`tengu_claude_md_includes_dialog_shown`,{})},[]);let s=(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)(l,{title:`Allow external CLAUDE.md file imports?`,color:`warning`,onCancel:(0,g.useCallback)(()=>{s(`no`)},[s]),hideBorder:!t,hideInputGuide:!t,children:[(0,_.jsx)(o,{children:`This project's CLAUDE.md imports files outside the current working directory. Never allow this for third-party repositories.`}),r&&r.length>0&&(0,_.jsxs)(i,{flexDirection:`column`,children:[(0,_.jsx)(o,{dimColor:!0,children:`External imports:`}),r.map((e,t)=>(0,_.jsxs)(o,{dimColor:!0,children:[` `,e.path]},t))]}),(0,_.jsxs)(o,{dimColor:!0,children:[`Important: Only use Claude Code with files you trust. Accessing untrusted files may pose security risks`,` `,(0,_.jsx)(a,{url:`https://code.claude.com/docs/en/security`}),` `]}),(0,_.jsx)(n,{options:[{label:`Yes, allow external imports`,value:`yes`},{label:`No, disable external imports`,value:`no`}],onChange:e=>s(e)})]})}var g,_,v=e((()=>{g=t(s(),1),p(),c(),d(),r(),_=u()}));export{v as n,h as t};
@@ -0,0 +1 @@
1
+ import{n as e,t}from"./ClaudeMdExternalIncludesDialog-CDrArsSX.js";e();export{t as ClaudeMdExternalIncludesDialog};
@@ -0,0 +1 @@
1
+ import{bd as e,yd as t}from"./loadAgentsDir-CKSb56Gp.js";e();export{t as ConsoleOAuthFlow};
@@ -0,0 +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{Dw as i,Ew as a,Ow as o,U_ as s,W_ as c,hd as l,pw as u,vd as d}from"./loadAgentsDir-CKSb56Gp.js";import{C as f,Gt as ee,I as p,P as m,T as h,fi as g,ot as _,t as v,y as te}from"./src-P_wYS_NJ2.js";import{t as y}from"./jsx-runtime-Bb4Xn-E0.js";import{n as b,t as x}from"./cwd-L4wygFqJ.js";import{An as S,Cn as C}from"./settings-Xbq6AaD-.js";import{l as w,m as T,p as E,s as D}from"./git-B9uvt96d.js";import{r as O,t as k}from"./execFileNoThrow-5SylUnAI.js";import{S as ne,v as re}from"./startupProfiler-jeId9f2i.js";import{l as A,o as j}from"./stringUtils-CbS6OkmE.js";import{i as ie}from"./detectRepository-DvxoaPlk.js";import{join as M,resolve as ae}from"path";import{access as oe}from"fs/promises";async function se(){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 N(){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=>oe(M(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([se(),N()]);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,W=e((()=>{H=t(g(),1),B(),U=400}));function fe(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(fe(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(g(),1)}));function ve({filePath:e,hunks:t,isLargeFile:n,isBinary:r,isTruncated:i,isUntracked:a}){let{columns:o}=_(),{firstLine:c,fileContent:l}=(0,q.useMemo)(()=>{if(!e)return{firstLine:null,fileContent:void 0};let t=S(ae(x(),e));return{firstLine:t?.split(`
6
+ `)[0]??null,fileContent:t??void 0}},[e]);return a?(0,J.jsxs)(p,{flexDirection:`column`,width:`100%`,children:[(0,J.jsxs)(p,{children:[(0,J.jsx)(m,{bold:!0,children:e}),(0,J.jsx)(m,{dimColor:!0,children:` (untracked)`})]}),(0,J.jsx)(f,{padding:4}),(0,J.jsxs)(p,{flexDirection:`column`,children:[(0,J.jsx)(m,{dimColor:!0,italic:!0,children:`New file not yet staged.`}),(0,J.jsxs)(m,{dimColor:!0,italic:!0,children:["Run `git add ",e,"` to see line counts."]})]})]}):r?(0,J.jsxs)(p,{flexDirection:`column`,width:`100%`,children:[(0,J.jsx)(p,{children:(0,J.jsx)(m,{bold:!0,children:e})}),(0,J.jsx)(f,{padding:4}),(0,J.jsx)(p,{flexDirection:`column`,children:(0,J.jsx)(m,{dimColor:!0,italic:!0,children:`Binary file - cannot display diff`})})]}):n?(0,J.jsxs)(p,{flexDirection:`column`,width:`100%`,children:[(0,J.jsx)(p,{children:(0,J.jsx)(m,{bold:!0,children:e})}),(0,J.jsx)(f,{padding:4}),(0,J.jsx)(p,{flexDirection:`column`,children:(0,J.jsx)(m,{dimColor:!0,italic:!0,children:`Large file - diff exceeds 1 MB limit`})})]}):(0,J.jsxs)(p,{flexDirection:`column`,width:`100%`,children:[(0,J.jsxs)(p,{children:[(0,J.jsx)(m,{bold:!0,children:e}),i&&(0,J.jsx)(m,{dimColor:!0,children:` (truncated)`})]}),(0,J.jsx)(f,{padding:4}),(0,J.jsx)(p,{flexDirection:`column`,children:t.length===0?(0,J.jsx)(m,{dimColor:!0,children:`No diff content`}):t.map((t,n)=>(0,J.jsx)(s,{patch:t,filePath:e,firstLine:c,fileContent:l,dim:!1,width:o-2-2},n))}),i&&(0,J.jsx)(m,{dimColor:!0,italic:!0,children:`… diff truncated (exceeded 400 line limit)`})]})}var q,J,ye=e((()=>{q=t(g(),1),u(),v(),b(),C(),c(),J=y()}));function be({files:e,selectedIndex:t}){let{columns:n}=_(),{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)(m,{dimColor:!0,children:`No changed files`});let a=e.slice(r,i),o=r>0,s=i<e.length,c=e.length>Z,l=Math.max(20,n-16-3-4);return(0,X.jsxs)(p,{flexDirection:`column`,children:[c&&(0,X.jsx)(m,{dimColor:!0,children:o?` ↑ ${r} more ${A(r,`file`)}`:` `}),a.map((e,n)=>(0,X.jsx)(xe,{file:e,isSelected:r+n===t,maxPathWidth:l},e.path)),c&&(0,X.jsx)(m,{dimColor:!0,children:s?` ↓ ${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)(p,{flexDirection:`row`,children:[(0,X.jsx)(m,{bold:t,color:t?`background`:void 0,inverse:t,children:a}),(0,X.jsx)(p,{flexGrow:1}),(0,X.jsx)(Se,{file:e,isSelected:t})]})}function Se({file:e,isSelected:t}){return e.isUntracked?(0,X.jsx)(m,{dimColor:!t,italic:!0,children:`untracked`}):e.isBinary?(0,X.jsx)(m,{dimColor:!t,italic:!0,children:`Binary file`}):e.isLargeFile?(0,X.jsx)(m,{dimColor:!t,italic:!0,children:`Large file modified`}):(0,X.jsxs)(m,{children:[e.linesAdded>0&&(0,X.jsxs)(m,{color:`diffAddedWord`,bold:t,children:[`+`,e.linesAdded]}),e.linesAdded>0&&e.linesRemoved>0&&` `,e.linesRemoved>0&&(0,X.jsxs)(m,{color:`diffRemovedWord`,bold:t,children:[`-`,e.linesRemoved]}),e.isTruncated&&(0,X.jsx)(m,{dimColor:!t,children:` (truncated)`})]})}var Y,X,Z,Ce=e((()=>{n(),Y=t(g(),1),u(),v(),re(),j(),X=y(),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,a]=(0,Q.useState)(`list`),[s,c]=(0,Q.useState)(0),[l,u]=(0,Q.useState)(0),f=(0,Q.useMemo)(()=>[{type:`current`},...r.map(e=>({type:`turn`,turn:e}))],[r]),g=f[l],_=g?.type===`turn`?g.turn:null,v=(0,Q.useMemo)(()=>_?we(_):n,[_,n]),y=v.files[s],b=(0,Q.useMemo)(()=>y&&v.hunks.get(y.path)||[],[y,v.hunks]);(0,Q.useEffect)(()=>{l>=f.length&&u(Math.max(0,f.length-1))},[f.length,l]);let x=(0,Q.useRef)(l);(0,Q.useEffect)(()=>{x.current!==l&&(c(0),x.current=l)},[l]),d(`diff-dialog`),ee({"diff:previousSource":()=>{i===`detail`?a(`list`):i===`list`&&f.length>1&&u(e=>Math.max(0,e-1))},"diff:nextSource":()=>{i===`list`&&f.length>1&&u(e=>Math.min(f.length-1,e+1))},"diff:back":()=>{i===`detail`&&a(`list`)},"diff:viewDetails":()=>{i===`list`&&y&&a(`detail`)},"diff:previousFile":()=>{i===`list`&&c(e=>Math.max(0,e-1))},"diff:nextFile":()=>{i===`list`&&c(e=>Math.min(v.files.length-1,e+1))}},{context:`DiffDialog`});let S=v.stats?(0,$.jsxs)(m,{dimColor:!0,children:[v.stats.filesCount,` `,A(v.stats.filesCount,`file`),` changed`,v.stats.linesAdded>0&&(0,$.jsxs)(m,{color:`diffAddedWord`,children:[` +`,v.stats.linesAdded]}),v.stats.linesRemoved>0&&(0,$.jsxs)(m,{color:`diffRemovedWord`,children:[` -`,v.stats.linesRemoved]})]}):null,C=_?`Turn ${_.turnIndex}`:`Uncommitted changes`,w=_?_.userPromptPreview?`"${_.userPromptPreview}"`:``:`(git diff HEAD)`,T=f.length>1?(0,$.jsxs)(p,{children:[l>0&&(0,$.jsx)(m,{dimColor:!0,children:`◀ `}),f.map((e,t)=>{let n=t===l,r=e.type===`current`?`Current`:`T${e.turn.turnIndex}`;return(0,$.jsxs)(m,{dimColor:!n,bold:n,children:[t>0?` · `:``,r]},t)}),l<f.length-1&&(0,$.jsx)(m,{dimColor:!0,children:` ▶`})]}):null,E=o(`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)(m,{children:[C,w&&(0,$.jsxs)(m,{dimColor:!0,children:[` `,w]})]});function k(){i===`detail`?a(`list`):t(`Diff dialog dismissed`,{display:`system`})}return(0,$.jsxs)(te,{title:O,onCancel:k,color:`background`,inputGuide:e=>e.pending?(0,$.jsxs)(m,{children:[`Press `,e.keyName,` again to exit`]}):i===`list`?(0,$.jsxs)(h,{children:[f.length>1&&(0,$.jsx)(m,{children:`←/→ source`}),(0,$.jsx)(m,{children:`↑/↓ select`}),(0,$.jsx)(m,{children:`Enter view`}),(0,$.jsxs)(m,{children:[E,` close`]})]}):(0,$.jsxs)(h,{children:[(0,$.jsx)(m,{children:`← back`}),(0,$.jsxs)(m,{children:[E,` close`]})]}),children:[T,S,v.files.length===0?(0,$.jsx)(p,{marginTop:1,children:(0,$.jsx)(m,{dimColor:!0,children:D})}):i===`list`?(0,$.jsx)(p,{flexDirection:`column`,marginTop:1,children:(0,$.jsx)(be,{files:v.files,selectedIndex:s})}):(0,$.jsx)(p,{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(g(),1),l(),W(),_e(),v(),a(),i(),j(),ye(),Ce(),$=y()}))();export{Te as DiffDialog};
@@ -0,0 +1,3 @@
1
+ import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{n,o as r}from"./envUtils-BDhHQY0-.js";import{n as i,t as a}from"./figures-5ThXQEtq.js";import{Av as o,Ax as s,Ew as c,Fg as l,Fw as u,Ig as d,Ix as f,Mv as p,Mw as m,Nv as h,Nw as g,Nx as _,Pv as ee,Pw as v,Px as y,aE as b,cE as x,eD as te,eu as ne,fa as S,jv as re,nu as ie,ov as ae,pa as C,sv as w,tD as T,tu as oe}from"./loadAgentsDir-CKSb56Gp.js";import{Gt as se,I as E,P as D,fi as O,t as k,x as A}from"./src-P_wYS_NJ2.js";import{t as j}from"./jsx-runtime-Bb4Xn-E0.js";import{Kt as ce,tt as le}from"./state-Bs5xweDL.js";import{Cn as M,H as N,On as P,g as F,n as I,z as L}from"./settings-Xbq6AaD-.js";import{l as R,o as z}from"./stringUtils-CbS6OkmE.js";import{Kn as B,Un as V,_ as H,u as U}from"./model-C2e73CJD.js";import{n as W,t as ue}from"./ValidationErrorsList-De3kzHtz.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-BR5M6RQw.js";import{a as ye,i as be}from"./xdg-DcF9ejUM.js";import{n as xe,t as Se}from"./useExitOnCtrlCDWithKeybindings-D2FvHieH.js";import{n as Ce,t as we}from"./McpParsingWarnings-CH4yyMAL.js";import{n as Te,t as Ee}from"./PressEnterToContinue-Dq0Imo9c.js";import{n as De,t as Oe}from"./useSettingsErrors-DKh4rkGi.js";import{n as ke,t as Ae}from"./shadowedRuleDetection-B9iSx6mB.js";import{n as je,r as Me,t as K}from"./statusNoticeHelpers-DMqRGFOh.js";import{join as q}from"path";function Ne(){if(!u())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)(E,{flexDirection:`column`,marginTop:1,marginBottom:1,children:[(0,J.jsx)(D,{bold:!0,color:t.length>0?`error`:`warning`,children:`Keybinding Configuration Issues`}),(0,J.jsxs)(E,{children:[(0,J.jsx)(D,{dimColor:!0,children:`Location: `}),(0,J.jsx)(D,{dimColor:!0,children:g()})]}),(0,J.jsxs)(E,{marginLeft:1,flexDirection:`column`,marginTop:1,children:[t.map((e,t)=>(0,J.jsxs)(E,{flexDirection:`column`,children:[(0,J.jsxs)(E,{children:[(0,J.jsx)(D,{dimColor:!0,children:`└ `}),(0,J.jsx)(D,{color:`error`,children:`[Error]`}),(0,J.jsxs)(D,{dimColor:!0,children:[` `,e.message]})]}),e.suggestion&&(0,J.jsx)(E,{marginLeft:3,children:(0,J.jsxs)(D,{dimColor:!0,children:[`→ `,e.suggestion]})})]},`error-${t}`)),n.map((e,t)=>(0,J.jsxs)(E,{flexDirection:`column`,children:[(0,J.jsxs)(E,{children:[(0,J.jsx)(D,{dimColor:!0,children:`└ `}),(0,J.jsx)(D,{color:`warning`,children:`[Warning]`}),(0,J.jsxs)(D,{dimColor:!0,children:[` `,e.message]})]}),e.suggestion&&(0,J.jsx)(E,{marginLeft:3,children:(0,J.jsxs)(D,{dimColor:!0,children:[`→ `,e.suggestion]})})]},`warning-${t}`))]})]})}var J,Pe=e((()=>{O(),k(),v(),J=j()}));function Fe(){if(!b.isSupportedPlatform()||!b.isSandboxEnabledInSettings())return null;let e=b.checkDependencies(),t=e.errors.length>0,n=e.warnings.length>0;return!t&&!n?null:(0,Y.jsxs)(E,{flexDirection:`column`,children:[(0,Y.jsx)(D,{bold:!0,children:`Sandbox`}),(0,Y.jsxs)(D,{children:[`└ Status: `,(0,Y.jsx)(D,{color:t?`error`:`warning`,children:t?`Missing dependencies`:`Available (with warnings)`})]}),e.errors.map((e,t)=>(0,Y.jsxs)(D,{color:`error`,children:[`└ `,e]},t)),e.warnings.map((e,t)=>(0,Y.jsxs)(D,{color:`warning`,children:[`└ `,e]},t)),t&&(0,Y.jsx)(D,{dimColor:!0,children:`└ Run /sandbox for install instructions`})]})}var Y,Ie=e((()=>{O(),k(),x(),Y=j()}));async function Le(){let e=_(await y());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 > ${s.toLocaleString()})`:`${e.length} large CLAUDE.md files detected (each > ${s.toLocaleString()} chars)`,details:t,currentValue:e.length,threshold:s}}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:C(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 l(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+C(((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:b.isSandboxingEnabled()&&b.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((()=>{S(),d(),f(),H(),L(),ke(),x(),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)(D,{children:[`└ Stable version: `,t.stable]}),(0,$.jsxs)(D,{children:[`└ Latest version: `,t.latest]})]}):(0,$.jsx)(D,{dimColor:!0,children:`└ Failed to fetch versions`})}function Ue({onDone:e}){let t=w(e=>e.agentDefinitions),r=w(e=>e.mcp.tools),i=w(e=>e.toolPermissionContext),s=w(e=>e.plugins.errors);xe();let c=(0,Q.useMemo)(()=>r||[],[r]),[l,u]=(0,Q.useState)(null),[d,f]=(0,Q.useState)(null),[p,m]=(0,Q.useState)(null),[h,g]=(0,Q.useState)(null),_=De(),v=(0,Q.useMemo)(()=>G().then(e=>(e.installationType===`native`?fe:he)().catch(()=>({latest:null,stable:null}))),[]),y=I()?.autoUpdatesChannel??`latest`,b=_.filter(e=>e.mcpErrorMetadata===void 0),x=(0,Q.useMemo)(()=>[{name:`BASH_MAX_OUTPUT_LENGTH`,default:o,upperLimit:re},{name:`TASK_MAX_OUTPUT_LENGTH`,default:ne,upperLimit:oe},{name:`CLAUDE_CODE_MAX_OUTPUT_TOKENS`,...V(`claude-opus-4-7`)}].map(e=>{let t=process.env[e.name],n=ee(e.name,t,e.default,e.upperLimit);return{name:e.name,...n}}).filter(e=>e.status!==`valid`),[]);(0,Q.useEffect)(()=>{G().then(u),(async()=>{let e=q(n(),`agents`),r=q(le(),`.claude`,`agents`),{activeAgents:a,allAgents:o,failedFiles:s}=t,[l,u]=await Promise.all([P(e),P(r)]),d={activeAgents:a.map(e=>({agentType:e.agentType,source:e.source})),userAgentsDir:e,projectAgentsDir:r,userDirExists:l,projectDirExists:u,failedFiles:s};f(d);let p=await Be(c,{activeAgents:a,allAgents:o,failedFiles:s},async()=>i);if(m(p),_e()){let e=q(be(),`claude`,`locks`),t=ge(e),n=ve(e);g({enabled:!0,locks:n,locksDir:e,staleLocksCleaned:t})}else g({enabled:!1,locks:[],locksDir:``,staleLocksCleaned:0})})()},[i,c,t]);let S=(0,Q.useCallback)(()=>{e(`Claude Code diagnostics dismissed`,{display:`system`})},[e]);return se({"confirm:yes":S,"confirm:no":S},{context:`Confirmation`}),l?(0,$.jsxs)(A,{children:[(0,$.jsxs)(E,{flexDirection:`column`,children:[(0,$.jsx)(D,{bold:!0,children:`Diagnostics`}),(0,$.jsxs)(D,{children:[`└ Currently running: `,l.installationType,` (`,l.version,`)`]}),l.packageManager&&(0,$.jsxs)(D,{children:[`└ Package manager: `,l.packageManager]}),(0,$.jsxs)(D,{children:[`└ Path: `,l.installationPath]}),(0,$.jsxs)(D,{children:[`└ Invoked: `,l.invokedBinary]}),(0,$.jsxs)(D,{children:[`└ Config install method: `,l.configInstallMethod]}),(0,$.jsxs)(D,{children:[`└ Search: `,l.ripgrepStatus.working?`OK`:`Not working`,` (`,l.ripgrepStatus.mode===`embedded`?`bundled`:l.ripgrepStatus.mode===`builtin`?`vendor`:l.ripgrepStatus.systemPath||`system`,`)`]}),l.ripgrepStatus.note&&(0,$.jsxs)(D,{color:`warning`,children:[`└ Note: `,l.ripgrepStatus.note]}),l.recommendation&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(D,{}),(0,$.jsxs)(D,{color:`warning`,children:[`Recommendation: `,l.recommendation.split(`
2
+ `)[0]]}),(0,$.jsx)(D,{dimColor:!0,children:l.recommendation.split(`
3
+ `)[1]})]}),l.multipleInstallations.length>1&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(D,{}),(0,$.jsx)(D,{color:`warning`,children:`Warning: Multiple installations found`}),l.multipleInstallations.map((e,t)=>(0,$.jsxs)(D,{children:[`└ `,e.type,` at `,e.path]},t))]}),l.warnings.length>0&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(D,{}),l.warnings.map((e,t)=>(0,$.jsxs)(E,{flexDirection:`column`,children:[(0,$.jsxs)(D,{color:`warning`,children:[`Warning: `,e.issue]}),(0,$.jsxs)(D,{children:[`Fix: `,e.fix]})]},t))]}),b.length>0&&(0,$.jsxs)(E,{flexDirection:`column`,marginTop:1,marginBottom:1,children:[(0,$.jsx)(D,{bold:!0,children:`Invalid Settings`}),(0,$.jsx)(ue,{errors:b})]})]}),(0,$.jsxs)(E,{flexDirection:`column`,children:[(0,$.jsx)(D,{bold:!0,children:`Updates`}),(0,$.jsxs)(D,{children:[`└ Auto-updates: `,l.packageManager?`Managed by package manager`:l.autoUpdates]}),l.hasUpdatePermissions!==null&&(0,$.jsxs)(D,{children:[`└ Update permissions: `,l.hasUpdatePermissions?`Yes`:`No (requires sudo)`]}),(0,$.jsxs)(D,{children:[`└ Auto-update channel: `,y]}),(0,$.jsx)(Q.Suspense,{fallback:null,children:(0,$.jsx)(He,{promise:v})})]}),(0,$.jsx)(Fe,{}),(0,$.jsx)(we,{}),(0,$.jsx)(Ne,{}),x.length>0&&(0,$.jsxs)(E,{flexDirection:`column`,children:[(0,$.jsx)(D,{bold:!0,children:`Environment Variables`}),x.map((e,t)=>(0,$.jsxs)(D,{children:[`└ `,e.name,`:`,` `,(0,$.jsx)(D,{color:e.status===`capped`?`warning`:`error`,children:e.message})]},t))]}),h?.enabled&&(0,$.jsxs)(E,{flexDirection:`column`,children:[(0,$.jsx)(D,{bold:!0,children:`Version Locks`}),h.staleLocksCleaned>0&&(0,$.jsxs)(D,{dimColor:!0,children:[`└ Cleaned `,h.staleLocksCleaned,` stale lock(s)`]}),h.locks.length===0?(0,$.jsx)(D,{dimColor:!0,children:`└ No active version locks`}):h.locks.map((e,t)=>(0,$.jsxs)(D,{children:[`└ `,e.version,`: PID `,e.pid,` `,e.isProcessRunning?(0,$.jsx)(D,{children:`(running)`}):(0,$.jsx)(D,{color:`warning`,children:`(stale)`})]},t))]}),d?.failedFiles&&d.failedFiles.length>0&&(0,$.jsxs)(E,{flexDirection:`column`,children:[(0,$.jsx)(D,{bold:!0,color:`error`,children:`Agent Parse Errors`}),(0,$.jsxs)(D,{color:`error`,children:[`└ Failed to parse `,d.failedFiles.length,` agent file(s):`]}),d.failedFiles.map((e,t)=>(0,$.jsxs)(D,{dimColor:!0,children:[` `,`└ `,e.path,`: `,e.error]},t))]}),s.length>0&&(0,$.jsxs)(E,{flexDirection:`column`,children:[(0,$.jsx)(D,{bold:!0,color:`error`,children:`Plugin Errors`}),(0,$.jsxs)(D,{color:`error`,children:[`└ `,s.length,` plugin error(s) detected:`]}),s.map((e,t)=>(0,$.jsxs)(D,{dimColor:!0,children:[` `,`└ `,e.source||`unknown`,`plugin`in e&&e.plugin?` [${e.plugin}]`:``,`: `,te(e)]},t))]}),p?.unreachableRulesWarning&&(0,$.jsxs)(E,{flexDirection:`column`,children:[(0,$.jsx)(D,{bold:!0,color:`warning`,children:`Unreachable Permission Rules`}),(0,$.jsxs)(D,{children:[`└`,` `,(0,$.jsxs)(D,{color:`warning`,children:[a.warning,` `,p.unreachableRulesWarning.message]})]}),p.unreachableRulesWarning.details.map((e,t)=>(0,$.jsxs)(D,{dimColor:!0,children:[` `,`└ `,e]},t))]}),p&&(p.claudeMdWarning||p.agentWarning||p.mcpWarning)&&(0,$.jsxs)(E,{flexDirection:`column`,children:[(0,$.jsx)(D,{bold:!0,children:`Context Usage Warnings`}),p.claudeMdWarning&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(D,{children:[`└`,` `,(0,$.jsxs)(D,{color:`warning`,children:[a.warning,` `,p.claudeMdWarning.message]})]}),(0,$.jsxs)(D,{children:[` `,`└ Files:`]}),p.claudeMdWarning.details.map((e,t)=>(0,$.jsxs)(D,{dimColor:!0,children:[` `,`└ `,e]},t))]}),p.agentWarning&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(D,{children:[`└`,` `,(0,$.jsxs)(D,{color:`warning`,children:[a.warning,` `,p.agentWarning.message]})]}),(0,$.jsxs)(D,{children:[` `,`└ Top contributors:`]}),p.agentWarning.details.map((e,t)=>(0,$.jsxs)(D,{dimColor:!0,children:[` `,`└ `,e]},t))]}),p.mcpWarning&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(D,{children:[`└`,` `,(0,$.jsxs)(D,{color:`warning`,children:[a.warning,` `,p.mcpWarning.message]})]}),(0,$.jsxs)(D,{children:[` `,`└ MCP servers:`]}),p.mcpWarning.details.map((e,t)=>(0,$.jsxs)(D,{dimColor:!0,children:[` `,`└ `,e]},t))]})]}),(0,$.jsx)(E,{children:(0,$.jsx)(Ee,{})})]}):(0,$.jsx)(A,{children:(0,$.jsx)(D,{dimColor:!0,children:`Checking installation status…`})})}var Q,$,We=e((()=>{i(),Q=t(O(),1),Pe(),Ce(),B(),r(),ce(),k(),Te(),Ie(),W(),Oe(),Se(),c(),ae(),T(),pe(),Ve(),de(),h(),M(),me(),F(),p(),ie(),ye(),$=j()}));export{We as n,Ue as t};
@@ -0,0 +1 @@
1
+ import{n as e,t}from"./Doctor-D160J8Ad.js";e();export{t as Doctor};
@@ -0,0 +1,2 @@
1
+ import{a as e,n as t,o as n}from"./rolldown-runtime-DaDcL9Zw.js";import{Ar as r,Dt as i,FT as a,Ot as o,PT as s,SE as c,St as l,Ti as u,Tt as d,Vu as f,bv as p,dd as m,fd as h,ff as g,ht as _,uf as v,xE as y,xv as b,zu as x}from"./loadAgentsDir-CKSb56Gp.js";import{I as S,P as C,fi as w,t as T,y as E}from"./src-P_wYS_NJ2.js";import{t as D}from"./jsx-runtime-Bb4Xn-E0.js";import{a as O,l as k}from"./debug-BdqxZ7rV.js";import{r as A,t as j}from"./execFileNoThrow-5SylUnAI.js";import{n as M,r as N}from"./analytics-DJobLaWP.js";function P(){(r(),e(u)).saveWorktreeState(null)}function F({onDone:e,onCancel:t}){let[n,r]=(0,I.useState)(`loading`),[a,c]=(0,I.useState)([]),[u,d]=(0,I.useState)(0),[f,p]=(0,I.useState)(),h=l();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){r(`removing`),_().then(()=>{process.chdir(h.originalCwd),b(h.originalCwd),P(),s.cache.clear?.(),p(`Worktree removed (no changes)`)}).catch(e=>{k(`Failed to clean up worktree: ${e}`,{level:`error`}),p(`Worktree cleanup failed, exiting anyway`)}).then(()=>{r(`done`)});return}else r(`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 g(e){if(!h)return;let t=!!h.tmuxSessionName;if(e===`keep`||e===`keep-with-tmux`)r(`keeping`),N(`tengu_worktree_kept`,{commits:u,changed_files:a.length}),await i(),process.chdir(h.originalCwd),b(h.originalCwd),P(),s.cache.clear?.(),p(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}`),r(`done`);else if(e===`keep-kill-tmux`)r(`keeping`),N(`tengu_worktree_kept`,{commits:u,changed_files:a.length}),h.tmuxSessionName&&await o(h.tmuxSessionName),await i(),process.chdir(h.originalCwd),b(h.originalCwd),P(),s.cache.clear?.(),p(`Worktree kept at ${h.worktreePath} on branch ${h.worktreeBranch}. Tmux session terminated.`),r(`done`);else if(e===`remove`||e===`remove-with-tmux`){r(`removing`),N(`tengu_worktree_removed`,{commits:u,changed_files:a.length}),h.tmuxSessionName&&await o(h.tmuxSessionName);try{await _(),process.chdir(h.originalCwd),b(h.originalCwd),P(),s.cache.clear?.()}catch(e){k(`Failed to clean up worktree: ${e}`,{level:`error`}),p(`Worktree cleanup failed, exiting anyway`),r(`done`);return}let e=t?` Tmux session terminated.`:``;u>0&&a.length>0?p(`Worktree removed. ${u} ${u===1?`commit`:`commits`} and uncommitted changes were discarded.${e}`):u>0?p(`Worktree removed. ${u} ${u===1?`commit`:`commits`} on ${h.worktreeBranch} ${u===1?`was`:`were`} discarded.${e}`):a.length>0?p(`Worktree removed. Uncommitted changes were discarded.${e}`):p(`Worktree removed.${e}`),r(`done`)}}if(n===`keeping`)return(0,L.jsxs)(S,{flexDirection:`row`,marginY:1,children:[(0,L.jsx)(x,{}),(0,L.jsx)(C,{children:`Keeping worktree…`})]});if(n===`removing`)return(0,L.jsxs)(S,{flexDirection:`row`,marginY:1,children:[(0,L.jsx)(x,{}),(0,L.jsx)(C,{children:`Removing worktree…`})]});let v=h.worktreeBranch,y=a.length>0,w=u>0,T=``;T=y&&w?`You have ${a.length} uncommitted ${a.length===1?`file`:`files`} and ${u} ${u===1?`commit`:`commits`} on ${v}. All will be lost if you remove.`:y?`You have ${a.length} uncommitted ${a.length===1?`file`:`files`}. These will be lost if you remove the worktree.`:w?`You have ${u} ${u===1?`commit`:`commits`} on ${v}. 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 D(){if(t){t();return}g(`keep`)}let O=y||w?`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)(E,{title:`Exiting worktree session`,subtitle:T,onCancel:D,children:(0,L.jsx)(m,{defaultFocusValue:A?`keep-with-tmux`:`keep`,options:M,onChange:g})})}var I,L,R=t((()=>{I=n(w(),1),M(),O(),T(),A(),a(),p(),d(),h(),f(),L=D()}));function z(){return c(H)??`Goodbye!`}function B({showWorktree:e,onDone:t,onCancel:n}){async function r(e){t(e??z()),await v(0,`prompt_input_exit`)}return e?(0,V.jsx)(F,{onDone:r,onCancel:n}):null}var V,H,U=t((()=>{y(),w(),g(),R(),V=D(),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{dd as t,ud as n}from"./loadAgentsDir-CKSb56Gp.js";import{D as r,I as i,Lt as a,P as o,T as s,fi as c,t as l,y as u}from"./src-P_wYS_NJ2.js";import{t as d}from"./jsx-runtime-Bb4Xn-E0.js";import{n as f,r as p}from"./analytics-DJobLaWP.js";import{i as m,o as h,r as g,s as _,t as v}from"./grove-BE4fQ6tG.js";var y=e(c(),1);f(),l(),n();var b=d(),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)(o,{children:[`An update to our Consumer Terms and Privacy Policy will take effect on `,(0,b.jsx)(o,{bold:!0,children:`October 8, 2025`}),`. You can accept the updated terms today.`]}),(0,b.jsxs)(i,{flexDirection:`column`,children:[(0,b.jsx)(o,{children:`What's changing?`}),(0,b.jsx)(i,{paddingLeft:1,children:(0,b.jsxs)(o,{children:[(0,b.jsx)(o,{children:`· `}),(0,b.jsx)(o,{bold:!0,children:`You can help improve Claude `}),(0,b.jsxs)(o,{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)(a,{url:`https://claude.ai/settings/data-privacy-controls`}),`).`]})]})}),(0,b.jsx)(i,{paddingLeft:1,children:(0,b.jsxs)(o,{children:[(0,b.jsx)(o,{children:`· `}),(0,b.jsx)(o,{bold:!0,children:`Updates to data retention `}),(0,b.jsx)(o,{children:`— To help us improve our AI models and safety protections, we're extending data retention to 5 years.`})]})})]}),(0,b.jsxs)(o,{children:[`Learn more (`,(0,b.jsx)(a,{url:`https://www.anthropic.com/news/updates-to-our-consumer-terms`}),`) or read the updated Consumer Terms (`,(0,b.jsx)(a,{url:`https://anthropic.com/legal/terms`}),`) and Privacy Policy (`,(0,b.jsx)(a,{url:`https://anthropic.com/legal/privacy`}),`)`]})]})}function C(){return(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(o,{children:`We've updated our Consumer Terms and Privacy Policy.`}),(0,b.jsxs)(i,{flexDirection:`column`,gap:1,children:[(0,b.jsx)(o,{children:`What's changing?`}),(0,b.jsxs)(i,{flexDirection:`column`,children:[(0,b.jsx)(o,{bold:!0,children:`Help improve Claude`}),(0,b.jsx)(o,{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)(a,{url:`https://claude.ai/settings/data-privacy-controls`})]}),(0,b.jsxs)(i,{flexDirection:`column`,children:[(0,b.jsx)(o,{bold:!0,children:`How this affects data retention`}),(0,b.jsx)(o,{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)(o,{children:[`Learn more (`,(0,b.jsx)(a,{url:`https://www.anthropic.com/news/updates-to-our-consumer-terms`}),`) or read the updated Consumer Terms (`,(0,b.jsx)(a,{url:`https://anthropic.com/legal/terms`}),`) and Privacy Policy (`,(0,b.jsx)(a,{url:`https://anthropic.com/legal/privacy`}),`)`]})]})}function w({showIfAlreadyViewed:e,location:n,onDone:a}){let[c,l]=(0,y.useState)(null),[d,f]=(0,y.useState)(null);if((0,y.useEffect)(()=>{async function t(){let[t,r]=await Promise.all([m(),g()]),i=r.success?r.data:null;f(i);let o=v(t,r,e);if(l(o),!o){a(`skip_rendering`);return}h(),p(`tengu_grove_policy_viewed`,{location:n,dismissable:i?.notice_is_grace_period})}t()},[e,n,a]),c===null||!c)return null;async function w(e){switch(e){case`accept_opt_in`:await _(!0),p(`tengu_grove_policy_submitted`,{state:!0,dismissable:d?.notice_is_grace_period});break;case`accept_opt_out`:await _(!1),p(`tengu_grove_policy_submitted`,{state:!1,dismissable:d?.notice_is_grace_period});break;case`defer`:p(`tengu_grove_policy_dismissed`,{state:!0});break;case`escape`:p(`tengu_grove_policy_escaped`,{});break}a(e)}let T=d?.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(d?.notice_is_grace_period){w(`defer`);return}w(`escape`)}return(0,b.jsxs)(u,{title:`Updates to Consumer Terms and Policies`,color:`professionalBlue`,onCancel:E,inputGuide:e=>e.pending?(0,b.jsxs)(o,{children:[`Press `,e.keyName,` again to exit`]}):(0,b.jsxs)(s,{children:[(0,b.jsx)(r,{shortcut:`Enter`,action:`confirm`}),(0,b.jsx)(r,{shortcut:`Esc`,action:`cancel`})]}),children:[(0,b.jsxs)(i,{flexDirection:`row`,children:[(0,b.jsx)(i,{flexDirection:`column`,gap:1,flexGrow:1,children:d?.notice_is_grace_period?(0,b.jsx)(S,{}):(0,b.jsx)(C,{})}),(0,b.jsx)(i,{flexShrink:0,children:(0,b.jsx)(o,{color:`professionalBlue`,children:x})})]}),(0,b.jsxs)(i,{flexDirection:`column`,gap:1,children:[(0,b.jsxs)(i,{flexDirection:`column`,children:[(0,b.jsx)(o,{bold:!0,children:`Please select how you'd like to continue`}),(0,b.jsx)(o,{children:`Your choice takes effect immediately upon confirmation.`})]}),(0,b.jsx)(t,{options:[...T,...d?.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{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"}
1
+ import{l as e,o as t}from"./envUtils-BDhHQY0-.js";import{n,t as r}from"./defineProperty-C-QyHrDq.js";import{n as i,t as a}from"./axios-DaWTGg7G.js";import{Fv as o,Iv as s}from"./loadAgentsDir-CKSb56Gp.js";import{S as c,a as l,l as u,w as d}from"./debug-BdqxZ7rV.js";import{O as f,k as p}from"./git-B9uvt96d.js";import{n as m,r as h}from"./analytics-DJobLaWP.js";import{c as g,h as _,l as v,m as y,s as b}from"./proxy-Blq4W6Ox.js";import{F as x,I as S,S as C,g as w,v as T}from"./sessionState-BvECKycx.js";import{n as E,t as D}from"./rcDebugLog-CARUIORE.js";import{r as O}from"./ccrClient-CG6HTv_n.js";a(),S(),m(),s(),l(),D(),f(),t(),_(),v(),w(),c(),n();var k=`{"type":"keep_alive"}
2
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
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};
@@ -0,0 +1 @@
1
+ import"./rolldown-runtime-DaDcL9Zw.js";import{Fu as e,Pu as t,av as n,dd as r,ov as i,ud as a}from"./loadAgentsDir-CKSb56Gp.js";import{I as o,P as s,fi as c,kn as l,t as u,y as d}from"./src-P_wYS_NJ2.js";import{t as f}from"./jsx-runtime-Bb4Xn-E0.js";import{E as p,S as m,w as h}from"./debug-BdqxZ7rV.js";import{t as g}from"./renderOptions-CLcco6fc.js";c(),u(),e(),i(),m(),a();var _=f();function v({filePath:e,errorDescription:t,onExit:n,onReset:i}){return(0,_.jsxs)(d,{title:`Configuration Error`,color:`error`,onCancel:n,children:[(0,_.jsxs)(o,{flexDirection:`column`,gap:1,children:[(0,_.jsxs)(s,{children:[`The configuration file at `,(0,_.jsx)(s,{bold:!0,children:e}),` contains invalid JSON.`]}),(0,_.jsx)(s,{children:t})]}),(0,_.jsxs)(o,{flexDirection:`column`,children:[(0,_.jsx)(s,{bold:!0,children:`Choose an option:`}),(0,_.jsx)(r,{options:[{label:`Exit and fix manually`,value:`exit`},{label:`Reset with default configuration`,value:`reset`}],onChange:e=>{e===`exit`?n():i()},onCancel:n})]})]})}var y=`dark`;async function b({error:e}){let r={...g(!1),theme:y};await new Promise(async i=>{let{unmount:a}=await l((0,_.jsx)(n,{children:(0,_.jsx)(t,{children:(0,_.jsx)(v,{filePath:e.filePath,errorDescription:e.message,onExit:()=>{a(),i(),process.exit(1)},onReset:()=>{p(e.filePath,h(e.defaultConfig,null,2),{flush:!1,encoding:`utf8`}),a(),i(),process.exit(0)}})})}),r)})}export{b as showInvalidConfigDialog};
@@ -0,0 +1 @@
1
+ import"./rolldown-runtime-DaDcL9Zw.js";import{dd as e,ud as t}from"./loadAgentsDir-CKSb56Gp.js";import{P as n,fi as r,t as i,y as a}from"./src-P_wYS_NJ2.js";import{t as o}from"./jsx-runtime-Bb4Xn-E0.js";import{n as s,t as c}from"./ValidationErrorsList-De3kzHtz.js";r(),i(),t(),s();var l=o();function u({settingsErrors:t,onContinue:r,onExit:i}){function o(e){e===`exit`?i():r()}return(0,l.jsxs)(a,{title:`Settings Error`,onCancel:i,color:`warning`,children:[(0,l.jsx)(c,{errors:t}),(0,l.jsx)(n,{dimColor:!0,children:`Files with errors are skipped entirely, not just the invalid settings.`}),(0,l.jsx)(e,{options:[{label:`Exit and fix manually`,value:`exit`},{label:`Continue without these settings`,value:`continue`}],onChange:o})]})}export{u as InvalidSettingsDialog};
@@ -0,0 +1 @@
1
+ import{a as e,n as t,o as n}from"./rolldown-runtime-DaDcL9Zw.js";import{CE as r,CS as i,CT as a,EC as o,ES as s,LC as c,MC as l,NC as u,OC as d,RC as f,ST as p,TC as m,TS as h,VC as g,_S as _,bS as v,cf as y,cv as ee,fC as te,gS as b,lf as ne,lv as x,mS as S,oC as C,ov as w,sv as T,vS as E,vT as re,wC as ie,wE as D,xS as O,yC as k,yT as ae,zC as oe}from"./loadAgentsDir-CKSb56Gp.js";import{fi as A}from"./src-P_wYS_NJ2.js";import{t as j}from"./jsx-runtime-Bb4Xn-E0.js";import{Kt as se,mt as ce}from"./state-Bs5xweDL.js";import{F as M,a as le,l as ue,z as N}from"./debug-BdqxZ7rV.js";import{it as P,nt as F}from"./settings-Xbq6AaD-.js";import{c as I,l as L,o as R}from"./log-CTFl4qpD.js";import{n as z,r as B}from"./analytics-DJobLaWP.js";import{n as V,t as H}from"./omit-CLPZGevl.js";import{o as de,s as fe}from"./localSearch-CPOnyi8I.js";function U(e){let t=`plugin`in e?e.plugin:`no-plugin`;return`${e.type}:${e.source}:${t}`}function W(e,t){t.length!==0&&e(e=>{let n=new Set(e.plugins.errors.map(e=>U(e))),r=t.filter(e=>!n.has(U(e)));return r.length===0?e:{...e,plugins:{...e.plugins,errors:[...e.plugins.errors,...r]}}})}function pe(e,t=!1){let n=ee(),r=T(e=>e.authVersion),a=T(e=>e.mcp.pluginReconnectKey),l=x(),h=(0,G.useRef)(new Map),{addNotification:g}=ne(),y=(0,G.useRef)([]),w=(0,G.useRef)(null),O=(0,G.useCallback)(()=>{w.current=null;let e=y.current;e.length!==0&&(y.current=[],l(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=F(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:[...D(n.tools,e=>e.name?.startsWith(l)),...o],f=s===void 0?n.commands:[...D(n.commands,e=>C(e,a.name)),...s],p=c===void 0?n.resources:{...n.resources,...c.length>0?{[a.name]:c}:V(n.resources,a.name)};n={...n,clients:u,tools:d,commands:f,resources:p}}return{...t,mcp:n}}))},[l]),k=(0,G.useCallback)(e=>{y.current.push(e),w.current===null&&(w.current=setTimeout(O,16))},[O]),A=(0,G.useCallback)(({client:e,tools:t,commands:n,resources:r})=>{switch(k({...e,tools:t,commands:n,resources:r}),e.type){case`connected`:s(e.client,e.name,l),e.client.onclose=()=>{let t=e.config.type??`stdio`;if(S(e.name,e.config).catch(()=>{ue(`Failed to invalidate the server cache: ${e.name}`)}),u(e.name)){I(e.name,`Server is disabled, skipping automatic reconnection`);return}if(t!==`stdio`&&t!==`sdk`){let n=me(t);I(e.name,`${n} transport closed/disconnected, attempting automatic reconnection`);let r=h.current.get(e.name);r&&(clearTimeout(r),h.current.delete(e.name)),(async()=>{for(let t=1;t<=q;t++){if(u(e.name)){I(e.name,`Server disabled during reconnection, stopping retry`),h.current.delete(e.name);return}k({...e,type:`pending`,reconnectAttempt:t,maxReconnectAttempts:q});let r=Date.now();try{let a=await i(e.name,e.config),o=Date.now()-r;if(a.client.type===`connected`){I(e.name,`${n} reconnection successful after ${o}ms (attempt ${t})`),h.current.delete(e.name),A(a);return}if(I(e.name,`${n} reconnection attempt ${t} completed with status: ${a.client.type}`),t===q){I(e.name,`Max reconnection attempts (${q}) reached, giving up`),h.current.delete(e.name),A(a);return}}catch(i){let a=Date.now()-r;if(L(e.name,`${n} reconnection attempt ${t} failed after ${a}ms: ${i}`),t===q){I(e.name,`Max reconnection attempts (${q}) reached, giving up`),h.current.delete(e.name),k({...e,type:`failed`});return}}let a=Math.min(J*2**(t-1),Y);I(e.name,`Scheduling reconnection attempt ${t+1} in ${a}ms`),await new Promise(t=>{let n=setTimeout(t,a);h.current.set(e.name,n)})}})()}else k({...e,type:`failed`})},e.capabilities?.tools?.listChanged&&e.client.setNotificationHandler(p,async()=>{I(e.name,`Received tools/list_changed notification, refreshing tools`);try{let t=E.cache.get(e.name);E.cache.delete(e.name);let n=await E(e),r=n.length;t?t.then(e=>{B(`tengu_mcp_list_changed`,{type:`tools`,previousCount:e.length,newCount:r})},()=>{B(`tengu_mcp_list_changed`,{type:`tools`,newCount:r})}):B(`tengu_mcp_list_changed`,{type:`tools`,newCount:r}),k({...e,tools:n})}catch(t){L(e.name,`Failed to refresh tools after list_changed notification: ${M(t)}`)}}),e.capabilities?.prompts?.listChanged&&e.client.setNotificationHandler(re,async()=>{I(e.name,`Received prompts/list_changed notification, refreshing prompts`),B(`tengu_mcp_list_changed`,{type:`prompts`});try{b.cache.delete(e.name);let[t,n]=await Promise.all([b(e),Promise.resolve([])]);k({...e,commands:[...t,...n]}),K?.()}catch(t){L(e.name,`Failed to refresh prompts after list_changed notification: ${M(t)}`)}}),e.capabilities?.resources?.listChanged&&e.client.setNotificationHandler(ae,async()=>{I(e.name,`Received resources/list_changed notification, refreshing resources`),B(`tengu_mcp_list_changed`,{type:`resources`});try{_.cache.delete(e.name);{let t=await _(e);k({...e,resources:t})}}catch(t){L(e.name,`Failed to refresh resources after list_changed notification: ${M(t)}`)}});break;case`needs-auth`:case`failed`:case`pending`:case`disabled`:break}},[k]),j=ce();return(0,G.useEffect)(()=>{async function n(){let{servers:n,errors:r}=t?{servers:{},errors:[]}:await d(e),i={...n,...e};W(l,r),l(e=>{let{stale:t,...n}=te(e.mcp,i);for(let e of t){let t=h.current.get(e.name);t&&(clearTimeout(t),h.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:u(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=>{L(`useManageMCPConnections`,`Failed to initialize servers as pending: ${M(e)}`)})},[t,e,l,j,a]),(0,G.useEffect)(()=>{let n=!1;async function r(){let r;t||m()?r=Promise.resolve({}):(f(),r=oe());let{servers:i,errors:a}=t?{servers:{},errors:[]}:await d(e,r);if(n)return;W(l,a);let s={...i,...e},c=Object.fromEntries(Object.entries(s).filter(([e])=>!u(e)));v(A,c).catch(e=>{L(`useManageMcpConnections`,`Failed to get MCP resources: ${M(e)}`)});let p={};if(!t){if(p=o(await r).allowed,n)return;if(Object.keys(p).length>0){let{servers:e}=ie(p,s);p=e}if(Object.keys(p).length>0){l(e=>{let t=new Set(e.mcp.clients.map(e=>e.name)),n=Object.entries(p).filter(([e])=>!t.has(e)).map(([e,t])=>({name:e,type:u(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(p).filter(([e])=>!u(e)));v(A,e).catch(e=>{L(`useManageMcpConnections`,`Failed to get claude.ai MCP resources: ${M(e)}`)})}}let h={...s,...p},g={enterprise:0,global:0,project:0,user:0,plugin:0,claudeai:0};for(let[e,t]of Object.entries(h))t.scope===`enterprise`?g.enterprise++:t.scope===`user`?g.global++:t.scope===`project`?g.project++:t.scope===`local`?g.user++:t.scope===`dynamic`?g.plugin++:t.scope===`claudeai`&&g.claudeai++;B(`tengu_mcp_servers`,{...g})}return r(),()=>{n=!0}},[t,e,A,l,r,j,a]),(0,G.useEffect)(()=>{let e=h.current;return()=>{for(let t of e.values())clearTimeout(t);e.clear(),w.current!==null&&(clearTimeout(w.current),w.current=null,O())}},[O]),{reconnectMcpServer:(0,G.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=h.current.get(e);r&&(clearTimeout(r),h.current.delete(e));let a=await i(e,t.config);return A(a),a},[n,A]),toggleMcpServer:(0,G.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=h.current.get(e);n&&(clearTimeout(n),h.current.delete(e)),c(e,!1),t.type===`connected`&&await S(e,t.config),k({name:e,type:`disabled`,config:t.config})}else{c(e,!0),k({name:e,type:`pending`,config:t.config});let n=await i(e,t.config);A(n)}},[n,k,A])}}function me(e){switch(e){case`http`:return`HTTP`;case`ws`:case`ws-ide`:return`WebSocket`;default:return`SSE`}}var G,K,q,J,Y,he=t((()=>{G=n(A(),1),se(),O(),a(),H(),r(),z(),l(),le(),y(),w(),N(),R(),h(),g(),P(),k(),K=(de(),e(fe)).clearSkillIndexCache,q=5,J=1e3,Y=3e4}));function ge(){let e=(0,Z.useContext)($);if(!e)throw Error(`useMcpReconnect must be used within MCPConnectionManager`);return e.reconnectMcpServer}function X(){let e=(0,Z.useContext)($);if(!e)throw Error(`useMcpToggleEnabled must be used within MCPConnectionManager`);return e.toggleMcpServer}function _e({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,$,ve=t((()=>{Z=n(A(),1),he(),Q=j(),$=(0,Z.createContext)(null)}));export{X as i,ve as n,ge as r,_e 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{Ew as i,GS as a,MC as o,Sd as s,Vu as c,WS as l,_m as u,aw as ee,dC as d,dd as te,gC as ne,hC as re,iw as f,kC as p,lv as ie,mS as ae,ov as m,pC as h,pw as g,qS as oe,sC as se,sv as ce,uC as le,ud as _,vm as v,xS as y,xd as ue,yC as b,zS as de,zu as x}from"./loadAgentsDir-CKSb56Gp.js";import{D as S,H as fe,I as C,Lt as pe,P as w,T,Wt as me,dr as he,fi as E,hn as ge,j as D,ot as _e,t as O,y as k}from"./src-P_wYS_NJ2.js";import{t as A}from"./jsx-runtime-Bb4Xn-E0.js";import{F as ve,z as j}from"./debug-BdqxZ7rV.js";import{et as M,it as N,tt as P}from"./settings-Xbq6AaD-.js";import{c as ye,o as F}from"./log-CTFl4qpD.js";import{n as I,r as L}from"./analytics-DJobLaWP.js";import{l as be,u as R}from"./oauth-C9VBDB0Y.js";import{l as xe,n as Se,o as z}from"./stringUtils-CbS6OkmE.js";import{Bt as B,jt as Ce}from"./model-C2e73CJD.js";import{i as we,n as V,r as Te}from"./MCPConnectionManager-DPFe4hPh.js";import{n as Ee,t as H}from"./useExitOnCtrlCDWithKeybindings-D2FvHieH.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)(C,{children:[(0,U.jsx)(w,{bold:!0,children:`Capabilities: `}),(0,U.jsx)(w,{color:`text`,children:r.length>0?(0,U.jsx)(T,{children:r}):`none`})]})}var U,Oe=e((()=>{E(),O(),U=A()}));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:i,onComplete:o,borderless:s=!1}){let[c]=fe(),l=Ee(),{columns:ne}=_e(),[f,p]=G.useState(!1),[m,g]=G.useState(null),_=ce(e=>e.mcp),v=ie(),[y,b]=G.useState(null),[E,O]=(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),O(!0);try{let t=await Y(e.name),n=t.client.type===`connected`;L(`tengu_claudeai_mcp_auth_completed`,{success:n}),n?o?.(`Authentication successful. Connected to ${e.name}.`):t.client.type===`needs-auth`?o?.(`Authentication successful, but server still requires authentication. You may need to manually restart Claude Code.`):o?.(`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}),o?.(Ae(t,e.name))}finally{O(!1)}},[Y,e.name,o]),X=G.useCallback(async()=>{await ae(e.name,{...e.config,scope:e.scope}),v(t=>{let n=t.mcp.clients.map(t=>t.name===e.name?{...t,type:`needs-auth`}:t),r=h(t.mcp.tools,e.name),i=le(t.mcp.commands,e.name),a=d(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`,{}),o?.(`Disconnected from ${e.name}.`),F(!1),R(null),z(!1)},[e.name,e.config,e.scope,v,o]);me(`confirm:no`,()=>{k.current?.abort(),k.current=null,p(!1),b(null)},{context:`Confirmation`,isActive:f}),me(`confirm:no`,()=>{j(!1),N(null)},{context:`Confirmation`,isActive:A}),me(`confirm:no`,()=>{F(!1),R(null),z(!1)},{context:`Confirmation`,isActive:P}),ge((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),ee(e)}if(e===`c`&&!B){let e=y||M||I;e&&he(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(_.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 ee(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`}),i()}catch(n){o?.(`Failed to ${t?`disable`:`enable`} MCP server '${e.name}': ${ve(n)}`)}},[e.client.type,e.config.type,e.name,Ie,i,o]),ze=G.useCallback(async()=>{if(e.config.type===`claudeai-proxy`)return;p(!0),g(null);let t=new AbortController;k.current=t;try{if(e.isAuthenticated&&e.config&&await oe(e.name,e.config,{preserveStepUpState:!0}),e.config){await a(e.name,e.config,b,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}.`;o?.(t)}else n.client.type===`needs-auth`?o?.(`Authentication successful, but server still requires authentication. You may need to manually restart Claude Code.`):(ye(e.name,`Reconnection failed after authentication`),o?.(`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 de)&&g(e.message)}finally{p(!1),k.current=null,q(null),W(``)}},[e.isAuthenticated,e.config,e.name,o,Y,J]),Be=async()=>{e.config.type!==`claudeai-proxy`&&e.config&&(await oe(e.name,e.config),L(`tengu_mcp_auth_config_clear`,{}),await ae(e.name,{...e.config,scope:e.scope}),v(t=>{let n=t.mcp.clients.map(t=>t.name===e.name?{...t,type:`failed`}:t),r=h(t.mcp.tools,e.name),i=le(t.mcp.commands,e.name),a=d(t.mcp.resources,e.name);return{...t,mcp:{...t.mcp,clients:n,tools:r,commands:i,resources:a}}}),o?.(`Authentication cleared for ${e.name}.`))};if(f){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)(C,{flexDirection:`column`,gap:1,padding:1,children:[(0,K.jsxs)(w,{color:`claude`,children:[`Authenticating with `,e.name,`…`]}),(0,K.jsxs)(C,{children:[(0,K.jsx)(x,{}),(0,K.jsx)(w,{children:t})]}),y&&(0,K.jsxs)(C,{flexDirection:`column`,children:[(0,K.jsxs)(C,{children:[(0,K.jsx)(w,{dimColor:!0,children:`If your browser doesn't open automatically, copy this URL manually `}),B?(0,K.jsx)(w,{color:`success`,children:`(Copied!)`}):(0,K.jsx)(w,{dimColor:!0,children:(0,K.jsx)(S,{shortcut:`c`,action:`copy`,parens:!0})})]}),(0,K.jsx)(pe,{url:y})]}),f&&y&&Ne&&(0,K.jsxs)(C,{flexDirection:`column`,marginTop:1,children:[(0,K.jsx)(w,{dimColor:!0,children:`If the redirect page shows a connection error, paste the URL from your browser's address bar:`}),(0,K.jsxs)(C,{children:[(0,K.jsxs)(w,{dimColor:!0,children:[`URL `,`>`,` `]}),(0,K.jsx)(ue,{value:Oe,onChange:W,onSubmit:e=>{Ne(e.trim()),W(``)},cursorOffset:je,onChangeCursorOffset:Me,columns:ne-8})]})]}),(0,K.jsx)(C,{marginLeft:3,children:(0,K.jsx)(w,{dimColor:!0,children:`Return here after authenticating in your browser. Press Esc to go back.`})})]})}if(A)return(0,K.jsxs)(C,{flexDirection:`column`,gap:1,padding:1,children:[(0,K.jsxs)(w,{color:`claude`,children:[`Authenticating with `,e.name,`…`]}),(0,K.jsxs)(C,{children:[(0,K.jsx)(x,{}),(0,K.jsx)(w,{children:` A browser window will open for authentication`})]}),M&&(0,K.jsxs)(C,{flexDirection:`column`,children:[(0,K.jsxs)(C,{children:[(0,K.jsx)(w,{dimColor:!0,children:`If your browser doesn't open automatically, copy this URL manually `}),B?(0,K.jsx)(w,{color:`success`,children:`(Copied!)`}):(0,K.jsx)(w,{dimColor:!0,children:(0,K.jsx)(S,{shortcut:`c`,action:`copy`,parens:!0})})]}),(0,K.jsx)(pe,{url:M})]}),(0,K.jsxs)(C,{marginLeft:3,flexDirection:`column`,children:[(0,K.jsxs)(w,{color:`permission`,children:[`Press `,(0,K.jsx)(w,{bold:!0,children:`Enter`}),` after authenticating in your browser.`]}),(0,K.jsx)(w,{dimColor:!0,italic:!0,children:(0,K.jsx)(u,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})})]})]});if(P)return(0,K.jsxs)(C,{flexDirection:`column`,gap:1,padding:1,children:[(0,K.jsxs)(w,{color:`claude`,children:[`Clear authentication for `,e.name]}),xe?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(w,{children:`Find the MCP server in the browser and click "Disconnect".`}),I&&(0,K.jsxs)(C,{flexDirection:`column`,children:[(0,K.jsxs)(C,{children:[(0,K.jsx)(w,{dimColor:!0,children:`If your browser didn't open automatically, copy this URL manually `}),B?(0,K.jsx)(w,{color:`success`,children:`(Copied!)`}):(0,K.jsx)(w,{dimColor:!0,children:(0,K.jsx)(S,{shortcut:`c`,action:`copy`,parens:!0})})]}),(0,K.jsx)(pe,{url:I})]}),(0,K.jsxs)(C,{marginLeft:3,flexDirection:`column`,children:[(0,K.jsxs)(w,{color:`permission`,children:[`Press `,(0,K.jsx)(w,{bold:!0,children:`Enter`}),` when done.`]}),(0,K.jsx)(w,{dimColor:!0,italic:!0,children:(0,K.jsx)(u,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})})]})]}):(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(w,{children:`This will open claude.ai in the browser. Find the MCP server in the list and click "Disconnect".`}),(0,K.jsxs)(C,{marginLeft:3,flexDirection:`column`,children:[(0,K.jsxs)(w,{color:`permission`,children:[`Press `,(0,K.jsx)(w,{bold:!0,children:`Enter`}),` to open the browser.`]}),(0,K.jsx)(w,{dimColor:!0,italic:!0,children:(0,K.jsx)(u,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})})]})]})]});if(E)return(0,K.jsxs)(C,{flexDirection:`column`,gap:1,padding:1,children:[(0,K.jsxs)(w,{color:`text`,children:[`Connecting to `,(0,K.jsx)(w,{bold:!0,children:e.name}),`…`]}),(0,K.jsxs)(C,{children:[(0,K.jsx)(x,{}),(0,K.jsx)(w,{children:` Establishing connection to MCP server`})]}),(0,K.jsx)(w,{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)(C,{flexDirection:`column`,children:[(0,K.jsxs)(C,{flexDirection:`column`,paddingX:1,borderStyle:s?void 0:`round`,children:[(0,K.jsx)(C,{marginBottom:1,children:(0,K.jsxs)(w,{bold:!0,children:[Z,` MCP Server`]})}),(0,K.jsxs)(C,{flexDirection:`column`,gap:0,children:[(0,K.jsxs)(C,{children:[(0,K.jsx)(w,{bold:!0,children:`Status: `}),e.client.type===`disabled`?(0,K.jsxs)(w,{children:[D(`inactive`,c)(r.radioOff),` disabled`]}):e.client.type===`connected`?(0,K.jsxs)(w,{children:[D(`success`,c)(r.tick),` connected`]}):e.client.type===`pending`?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(w,{dimColor:!0,children:r.radioOff}),(0,K.jsx)(w,{children:` connecting…`})]}):e.client.type===`needs-auth`?(0,K.jsxs)(w,{children:[D(`warning`,c)(r.triangleUpOutline),` needs authentication`]}):(0,K.jsxs)(w,{children:[D(`error`,c)(r.cross),` failed`]})]}),e.transport!==`claudeai-proxy`&&(0,K.jsxs)(C,{children:[(0,K.jsx)(w,{bold:!0,children:`Auth: `}),J?(0,K.jsxs)(w,{children:[D(`success`,c)(r.tick),` authenticated`]}):(0,K.jsxs)(w,{children:[D(`error`,c)(r.cross),` not authenticated`]})]}),(0,K.jsxs)(C,{children:[(0,K.jsx)(w,{bold:!0,children:`URL: `}),(0,K.jsx)(w,{dimColor:!0,children:e.config.url})]}),(0,K.jsxs)(C,{children:[(0,K.jsx)(w,{bold:!0,children:`Config location: `}),(0,K.jsx)(w,{dimColor:!0,children:se(e.scope)})]}),e.client.type===`connected`&&(0,K.jsx)(De,{serverToolsCount:t,serverPromptsCount:Fe,serverResourcesCount:_.resources[e.name]?.length||0}),e.client.type===`connected`&&t>0&&(0,K.jsxs)(C,{children:[(0,K.jsx)(w,{bold:!0,children:`Tools: `}),(0,K.jsxs)(w,{dimColor:!0,children:[t,` tools`]})]})]}),m&&(0,K.jsx)(C,{marginTop:1,children:(0,K.jsxs)(w,{color:`error`,children:[`Error: `,m]})}),$.length>0&&(0,K.jsx)(C,{marginTop:1,children:(0,K.jsx)(te,{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`:O(!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);o?.(n)}catch(t){e.config.type===`claudeai-proxy`&&L(`tengu_claudeai_mcp_reconnect`,{success:!1}),o?.(Ae(t,e.name))}finally{O(!1)}break;case`toggle-enabled`:await Re();break;case`back`:i();break}},onCancel:i})})]}),(0,K.jsx)(C,{marginTop:1,children:(0,K.jsx)(w,{dimColor:!0,italic:!0,children:l.pending?(0,K.jsxs)(K.Fragment,{children:[`Press `,l.keyName,` again to exit`]}):(0,K.jsxs)(T,{children:[(0,K.jsx)(S,{shortcut:`↑↓`,action:`navigate`}),(0,K.jsx)(S,{shortcut:`Enter`,action:`select`}),(0,K.jsx)(u,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]})})})]})}var G,K,Me=e((()=>{n(),G=t(E(),1),I(),R(),H(),g(),O(),i(),l(),y(),V(),b(),m(),B(),f(),j(),F(),z(),v(),_(),c(),s(),Oe(),W(),K=A()}));function Ne({server:e,serverToolsCount:t,onViewTools:n,onCancel:i,onComplete:a,borderless:o=!1}){let[s]=fe(),c=Ee(),l=ce(e=>e.mcp),ee=Te(),d=we(),[ne,f]=(0,q.useState)(!1),ie=q.useCallback(async()=>{let t=e.client.type!==`disabled`;try{await d(e.name),i()}catch(n){a(`Failed to ${t?`disable`:`enable`} MCP server '${e.name}': ${ve(n)}`)}},[e.client.type,e.name,d,i,a]),ae=Se(String(e.name)),m=re(l.commands,e.name).length,h=[];return e.client.type!==`disabled`&&t>0&&h.push({label:`View tools`,value:`tools`}),e.client.type!==`disabled`&&h.push({label:`Reconnect`,value:`reconnectMcpServer`}),h.push({label:e.client.type===`disabled`?`Enable`:`Disable`,value:`toggle-enabled`}),h.length===0&&h.push({label:`Back`,value:`back`}),ne?(0,J.jsxs)(C,{flexDirection:`column`,gap:1,padding:1,children:[(0,J.jsxs)(w,{color:`text`,children:[`Reconnecting to `,(0,J.jsx)(w,{bold:!0,children:e.name})]}),(0,J.jsxs)(C,{children:[(0,J.jsx)(x,{}),(0,J.jsx)(w,{children:` Restarting MCP server process`})]}),(0,J.jsx)(w,{dimColor:!0,children:`This may take a few moments.`})]}):(0,J.jsxs)(C,{flexDirection:`column`,children:[(0,J.jsxs)(C,{flexDirection:`column`,paddingX:1,borderStyle:o?void 0:`round`,children:[(0,J.jsx)(C,{marginBottom:1,children:(0,J.jsxs)(w,{bold:!0,children:[ae,` MCP Server`]})}),(0,J.jsxs)(C,{flexDirection:`column`,gap:0,children:[(0,J.jsxs)(C,{children:[(0,J.jsx)(w,{bold:!0,children:`Status: `}),e.client.type===`disabled`?(0,J.jsxs)(w,{children:[D(`inactive`,s)(r.radioOff),` disabled`]}):e.client.type===`connected`?(0,J.jsxs)(w,{children:[D(`success`,s)(r.tick),` connected`]}):e.client.type===`pending`?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(w,{dimColor:!0,children:r.radioOff}),(0,J.jsx)(w,{children:` connecting…`})]}):(0,J.jsxs)(w,{children:[D(`error`,s)(r.cross),` failed`]})]}),(0,J.jsxs)(C,{children:[(0,J.jsx)(w,{bold:!0,children:`Command: `}),(0,J.jsx)(w,{dimColor:!0,children:e.config.command})]}),e.config.args&&e.config.args.length>0&&(0,J.jsxs)(C,{children:[(0,J.jsx)(w,{bold:!0,children:`Args: `}),(0,J.jsx)(w,{dimColor:!0,children:e.config.args.join(` `)})]}),(0,J.jsxs)(C,{children:[(0,J.jsx)(w,{bold:!0,children:`Config location: `}),(0,J.jsx)(w,{dimColor:!0,children:se(p(e.name)?.scope??`dynamic`)})]}),e.client.type===`connected`&&(0,J.jsx)(De,{serverToolsCount:t,serverPromptsCount:m,serverResourcesCount:l.resources[e.name]?.length||0}),e.client.type===`connected`&&t>0&&(0,J.jsxs)(C,{children:[(0,J.jsx)(w,{bold:!0,children:`Tools: `}),(0,J.jsxs)(w,{dimColor:!0,children:[t,` tools`]})]})]}),h.length>0&&(0,J.jsx)(C,{marginTop:1,children:(0,J.jsx)(te,{options:h,onChange:async t=>{if(t===`tools`)n();else if(t===`reconnectMcpServer`){f(!0);try{let{message:t}=ke(await ee(e.name),e.name);a?.(t)}catch(t){a?.(Ae(t,e.name))}finally{f(!1)}}else t===`toggle-enabled`?await ie():t===`back`&&i()},onCancel:i})})]}),(0,J.jsx)(C,{marginTop:1,children:(0,J.jsx)(w,{dimColor:!0,italic:!0,children:c.pending?(0,J.jsxs)(J.Fragment,{children:[`Press `,c.keyName,` again to exit`]}):(0,J.jsxs)(T,{children:[(0,J.jsx)(S,{shortcut:`↑↓`,action:`navigate`}),(0,J.jsx)(S,{shortcut:`Enter`,action:`select`}),(0,J.jsx)(u,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]})})})]})}var q,J,Y=e((()=>{n(),q=t(E(),1),H(),O(),o(),V(),b(),m(),j(),z(),v(),_(),c(),Oe(),W(),J=A()}));function Pe({tool:e,server:t,onBack:n}){let[r,i]=X.useState(``),a=P(e.name,t.name),o=M(e.userFacingName?e.userFacingName({}):a),s=e.isReadOnly?.({})??!1,c=e.isDestructive?.({})??!1,l=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)(k,{title:(0,Z.jsxs)(Z.Fragment,{children:[o,s&&(0,Z.jsx)(w,{color:`success`,children:` [read-only]`}),c&&(0,Z.jsx)(w,{color:`error`,children:` [destructive]`}),l&&(0,Z.jsx)(w,{dimColor:!0,children:` [open-world]`})]}),subtitle:t.name,onCancel:n,inputGuide:e=>e.pending?(0,Z.jsxs)(w,{children:[`Press `,e.keyName,` again to exit`]}):(0,Z.jsx)(u,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`}),children:(0,Z.jsxs)(C,{flexDirection:`column`,children:[(0,Z.jsxs)(C,{children:[(0,Z.jsx)(w,{bold:!0,children:`Tool name: `}),(0,Z.jsx)(w,{dimColor:!0,children:a})]}),(0,Z.jsxs)(C,{children:[(0,Z.jsx)(w,{bold:!0,children:`Full name: `}),(0,Z.jsx)(w,{dimColor:!0,children:e.name})]}),r&&(0,Z.jsxs)(C,{flexDirection:`column`,marginTop:1,children:[(0,Z.jsx)(w,{bold:!0,children:`Description:`}),(0,Z.jsx)(w,{wrap:`wrap`,children:r})]}),e.inputJSONSchema&&e.inputJSONSchema.properties&&Object.keys(e.inputJSONSchema.properties).length>0&&(0,Z.jsxs)(C,{flexDirection:`column`,marginTop:1,children:[(0,Z.jsx)(w,{bold:!0,children:`Parameters:`}),(0,Z.jsx)(C,{marginLeft:2,flexDirection:`column`,children:Object.entries(e.inputJSONSchema.properties).map(([t,n])=>{let r=(e.inputJSONSchema?.required)?.includes(t);return(0,Z.jsxs)(w,{children:[`• `,t,r&&(0,Z.jsx)(w,{dimColor:!0,children:` (required)`}),`:`,` `,(0,Z.jsx)(w,{dimColor:!0,children:typeof n==`object`&&n&&`type`in n?String(n.type):`unknown`}),typeof n==`object`&&n&&`description`in n&&(0,Z.jsxs)(w,{dimColor:!0,children:[` - `,String(n.description)]})]},t)})})]})]})})}var X,Z,Fe=e((()=>{X=t(E(),1),O(),N(),v(),Z=A()}));function Ie({server:e,onSelectTool:t,onBack:n}){let r=ce(e=>e.mcp.tools),i=Le.useMemo(()=>e.client.type===`connected`?ne(r,e.name):[],[e,r]),a=i.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)(k,{title:`Tools for ${e.name}`,subtitle:`${i.length} ${xe(i.length,`tool`)}`,onCancel:n,inputGuide:e=>e.pending?(0,Q.jsxs)(w,{children:[`Press `,e.keyName,` again to exit`]}):(0,Q.jsxs)(T,{children:[(0,Q.jsx)(S,{shortcut:`↑↓`,action:`navigate`}),(0,Q.jsx)(S,{shortcut:`Enter`,action:`select`}),(0,Q.jsx)(u,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]}),children:i.length===0?(0,Q.jsx)(w,{dimColor:!0,children:`No tools available`}):(0,Q.jsx)(te,{options:a,onChange:e=>{let n=parseInt(e,10),r=i[n];r&&t(r,n)},onCancel:n})})}var Le,Q,Re=e((()=>{Le=t(E(),1),O(),N(),b(),m(),z(),v(),_(),Q=A()}));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};
@@ -0,0 +1 @@
1
+ import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{AC as n,MC as r,sC as i,vC as a,yC as o}from"./loadAgentsDir-CKSb56Gp.js";import{I as s,Lt as c,P as l,fi as u,t as d}from"./src-P_wYS_NJ2.js";import{t as f}from"./jsx-runtime-Bb4Xn-E0.js";function p({scope:e,parsingErrors:t,warnings:n}){let r=t.length>0,o=n.length>0;return!r&&!o?null:(0,_.jsxs)(s,{flexDirection:`column`,marginTop:1,children:[(0,_.jsxs)(s,{children:[(r||o)&&(0,_.jsxs)(l,{color:r?`error`:`warning`,children:[`[`,r?`Failed to parse`:`Contains warnings`,`] `]}),(0,_.jsx)(l,{children:a(e)})]}),(0,_.jsxs)(s,{children:[(0,_.jsx)(l,{dimColor:!0,children:`Location: `}),(0,_.jsx)(l,{dimColor:!0,children:i(e)})]}),(0,_.jsxs)(s,{marginLeft:1,flexDirection:`column`,children:[t.map((e,t)=>{let n=e.mcpErrorMetadata?.serverName;return(0,_.jsx)(s,{children:(0,_.jsxs)(l,{children:[(0,_.jsx)(l,{dimColor:!0,children:`└ `}),(0,_.jsx)(l,{color:`error`,children:`[Error]`}),(0,_.jsxs)(l,{dimColor:!0,children:[` `,n&&`[${n}] `,e.path&&e.path!==``?`${e.path}: `:``,e.message]})]})},`error-${t}`)}),n.map((e,t)=>{let n=e.mcpErrorMetadata?.serverName;return(0,_.jsx)(s,{children:(0,_.jsxs)(l,{children:[(0,_.jsx)(l,{dimColor:!0,children:`└ `}),(0,_.jsx)(l,{color:`warning`,children:`[Warning]`}),(0,_.jsxs)(l,{dimColor:!0,children:[` `,n&&`[${n}] `,e.path&&e.path!==``?`${e.path}: `:``,e.message]})]})},`warning-${t}`)})]})]})}function m(){let e=(0,g.useMemo)(()=>[{scope:`user`,config:n(`user`)},{scope:`project`,config:n(`project`)},{scope:`local`,config:n(`local`)},{scope:`enterprise`,config:n(`enterprise`)}],[]),t=e.some(({config:e})=>h(e.errors,`fatal`).length>0),r=e.some(({config:e})=>h(e.errors,`warning`).length>0);return!t&&!r?null:(0,_.jsxs)(s,{flexDirection:`column`,marginTop:1,marginBottom:1,children:[(0,_.jsx)(l,{bold:!0,children:`MCP Config Diagnostics`}),(0,_.jsx)(s,{marginTop:1,children:(0,_.jsxs)(l,{dimColor:!0,children:[`For help configuring MCP servers, see:`,` `,(0,_.jsx)(c,{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(u(),1),r(),o(),d(),_=f()}));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{Dx as a,Ew as o,Ex as s,Gv as c,Ha as l,Hp as u,Ia as d,Kv as f,Na as p,Qa as m,Ra as h,Rs as g,Vs as _,Vu as v,Wp as y,Wv as b,Zv as x,an as S,dd as C,el as w,eo as T,fd as E,il as D,io as O,lw as k,mn as A,nl as j,no as M,ov as ee,pw as te,sv as ne,sw as N,tl as re,uw as P,vn as ie,yo as F,zs as ae,zu as oe}from"./loadAgentsDir-CKSb56Gp.js";import{C as se,Gt as ce,I,P as L,Wt as le,fi as R,ot as ue,t as de}from"./src-P_wYS_NJ2.js";import{t as fe}from"./jsx-runtime-Bb4Xn-E0.js";import{Kt as z,ft as B,mt as pe,qn as V}from"./state-Bs5xweDL.js";import{n as me,t as he}from"./cwd-L4wygFqJ.js";import{In as ge,Ln as _e,Q as ve,Y as ye,f as be,g as xe}from"./settings-Xbq6AaD-.js";import{J as Se,h as Ce,m as we,o as Te,s as H,w as Ee}from"./log-CTFl4qpD.js";import{n as U,r as W}from"./analytics-DJobLaWP.js";import{b as De,m as Oe,v as ke}from"./startupProfiler-jeId9f2i.js";import{Bt as Ae,St as je,Y as Me,et as Ne}from"./model-C2e73CJD.js";import{E as Pe,T as Fe,c as Ie,d as Le,w as Re}from"./sessionTracing-ClGQ08jM.js";import{n as ze,t as Be}from"./useExitOnCtrlCDWithKeybindings-D2FvHieH.js";import*as G from"path";import{randomUUID as K}from"crypto";R();var q=fe();r(),de(),z(),me(),Se(),we(),Te(),_e(),U(),ke(),ve(),xe(),Ae(),k(),s(),Re(),u(),Ie(),j(),w(),_(),F(),m(),ie();function Ve(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 He(e){let t=e.toLowerCase().trim();return t===`continue`||/\b(keep going|go on)\b/.test(t)}function Ue(e,t,n,r,i,a,o){let s=K();V(s);let c=typeof e==`string`?e:e.find(e=>e.type===`text`)?.text||``;Le(c);let l=typeof e==`string`?e:e.findLast(e=>e.type===`text`)?.text||``;return l&&Fe(`user_prompt`,{prompt_length:String(l.length),prompt:Pe(l),"prompt.id":s}),W(`tengu_input_prompt`,{is_negative:Ve(c),is_keep_going:He(c)}),t.length>0?{messages:[d({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:[d({content:e,uuid:i,permissionMode:a,isMeta:o||void 0}),...r],shouldQuery:!0}}U(),m();async function We({input:e,preExpansionInput:t,mode:n,setToolJSX:r,context:i,pastedContents:a,ideSelection:o,messages:s,setUserInputOnProcessing:c,uuid:u,isAlreadyProcessing:f,querySource:m,canUseTool:h,skipSlashCommands:_,bridgeOrigin:v,isMeta:y,skipAttachments:b,autonomy:x}){let C=typeof e==`string`?e:null,w=C?.startsWith(`/`)&&!_;n===`prompt`&&C!==null&&!y&&!w&&c?.(C),D(`query_process_user_input_base_start`);let T=i.getAppState(),E=await Ke(e,n,r,i,a,o,s,u,f,m,h,T.toolPermissionContext.mode,_,v,y,b,t,x);if(D(`query_process_user_input_base_end`),!E.shouldQuery)return E;D(`query_hooks_start`);let O=l(e)||``;for await(let t of S(O,T.toolPermissionContext.mode,i,i.requestPrompt))if(t.message?.type!==`progress`){if(t.blockingError)return{messages:[p(`${A(t.blockingError)}\n\nOriginal prompt: ${e}`,`warning`)],shouldQuery:!1,allowedTools:E.allowedTools};if(t.preventContinuation){let e=t.stopReason?`Operation stopped by hook: ${t.stopReason}`:`Operation stopped by hook`;return E.messages.push(d({content:e})),E.shouldQuery=!1,E}if(t.additionalContexts&&t.additionalContexts.length>0&&E.messages.push(g({type:`hook_additional_context`,content:t.additionalContexts.map(Ge),hookName:`UserPromptSubmit`,toolUseID:`hook-${K()}`,hookEvent:`UserPromptSubmit`})),t.message)switch(t.message.attachment.type){case`hook_success`:if(!t.message.attachment.content)break;E.messages.push({...t.message,attachment:{...t.message.attachment,content:Ge(t.message.attachment.content)}});break;default:E.messages.push(t.message);break}}return D(`query_hooks_end`),E}var J=1e4;function Ge(e){return e.length>J?`${e.substring(0,J)}… [output truncated - exceeded ${J} characters]`:e}async function Ke(e,t,n,r,i,o,s,c,l,u,d,f,p,m,h,g,_,v){let b=null,x=[],S=[],C=e;if(typeof e==`string`)b=e;else if(e.length>0){D(`query_image_processing_start`);let t=[];for(let n of e)if(n.type===`image`){let e=await P(n);if(e.dimensions){let t=N(e.dimensions);t&&S.push(t)}t.push(e.block)}else t.push(n);C=t,D(`query_image_processing_end`);let n=t[t.length-1];n?.type===`text`?(b=n.text,x=t.slice(0,-1)):x=t}if(b===null&&t!==`prompt`)throw Error(`Mode: ${t} requires a string input.`);let w=i?Object.values(i).filter(a):[],T=w.map(e=>e.id),E=i?await y(i):new Map;D(`query_pasted_image_processing_start`);let O=await Promise.all(w.map(async e=>{let t={type:`image`,source:{type:`base64`,media_type:e.mediaType||`image/png`,data:e.content}};return W(`tengu_pasted_image_resize_attempt`,{original_size_bytes:e.content.length}),{resized:await P(t),originalDimensions:e.dimensions,sourcePath:e.sourcePath??E.get(e.id)}})),k=[];for(let{resized:e,originalDimensions:t,sourcePath:n}of O){if(e.dimensions){let t=N(e.dimensions,n);t&&S.push(t)}else if(t){let e=N(t,n);e&&S.push(e)}else n&&S.push(`[Image source: ${n}]`);k.push(e.block)}D(`query_pasted_image_processing_end`);let A=p,j=!g&&b!==null&&(t!==`prompt`||A||!b.startsWith(`/`));D(`query_attachment_loading_start`);let M=j?await re(ae(b,r,o??null,[],s,u)):[];if(D(`query_attachment_loading_end`),b!==null&&t===`bash`){let{processBashCommand:e}=await import(`./processBashCommand-CdeQg_c6.js`);return Y(await e(b,x,M,r,n),S)}if(b!==null&&!A&&b.startsWith(`/`)){let{processSlashCommand:e}=await import(`./processSlashCommand-CbkshIC6.js`);return Y(await e(b,x,k,M,r,n,c,l,d,v),S)}if(b!==null&&t===`prompt`){let e=b.trim(),t=M.find(e=>e.attachment.type===`agent_mention`);if(t){let n=`@agent-${t.attachment.agentType}`,r=e===n;W(`tengu_subagent_at_mention`,{is_subagent_only:r,is_prefix:e.startsWith(n)&&!r})}}return Y(Ue(C,k,T,M,c,f,h),S)}function Y(e,t){return t.length>0&&e.messages.push(d({content:t.map(e=>({type:`text`,text:e})),isMeta:!0})),e}z(),Ne();function qe(e){return e===`Agent`?ye:e}function Je(e){let t=be()?.outputStyle??`default`,n={type:`system`,subtype:`init`,cwd:he(),session_id:pe(),tools:e.tools.map(e=>qe(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:je().source,betas:B(),claude_code_version:`0.0.9`,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:K()};return n.fast_mode_state=Me(e.model,e.fastMode),n}var Ye=n({MessageSelector:()=>Ze,messagesAfterAreOnlySynthetic:()=>it,selectableUserMessagesFilter:()=>Z});function Xe(e){return e.type===`text`}function X(e){return e===`summarize`}function Ze({messages:e,onPreRestore:t,onRestoreMessage:n,onRestoreCode:r,onSummarize:a,onClose:o,preselectedMessage:s}){let l=ne(e=>e.fileHistory),[u,p]=(0,Q.useState)(void 0),m=c(),h=(0,Q.useMemo)(K,[]),g=(0,Q.useMemo)(()=>[...e.filter(Z),{...d({content:``}),uuid:h}],[e,h]),[_,v]=(0,Q.useState)(g.length-1),y=Math.max(0,Math.min(_-Math.floor($/2),g.length-$)),x=g.length>1,[S,w]=(0,Q.useState)(s),[T,E]=(0,Q.useState)(void 0);(0,Q.useEffect)(()=>{if(!s||!m)return;let e=!1;return f(l,s.uuid).then(t=>{e||E(t)}),()=>{e=!0}},[s,m,l]);let[D,O]=(0,Q.useState)(!1),[k,A]=(0,Q.useState)(null),[j,M]=(0,Q.useState)(`both`),[ee,te]=(0,Q.useState)(``);function N(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`}];return t.push({value:`summarize`,label:`Summarize from here`,type:`input`,placeholder:`add context (optional)`,initialValue:``,allowEmptySubmitToCancel:!0,showLabelWithValue:!0,labelValueSeparator:`: `,onChange:te}),t.push({value:`nevermind`,label:`Never mind`}),t}(0,Q.useEffect)(()=>{W(`tengu_message_selector_opened`,{})},[]);async function re(e){t(),O(!0);try{await n(e),O(!1),o()}catch(e){H(e),O(!1),p(`Failed to restore the conversation:\n${e}`)}}async function P(t){let n=e.indexOf(t);if(W(`tengu_message_selector_selected`,{index_from_end:e.length-1-n,message_type:t.type,is_current_prompt:!1}),!e.includes(t)){o();return}if(!m){await re(t);return}let r=await f(l,t.uuid);w(t),E(r)}async function ie(e){if(W(`tengu_message_selector_restore_option_selected`,{option:e}),!S){p(`Message not found.`);return}if(e===`nevermind`){s?o():w(void 0);return}if(X(e)){t(),O(!0),A(e),p(void 0);try{let e=ee.trim()||void 0;await a(S,e,`from`),O(!1),A(null),w(void 0),o()}catch(e){H(e),O(!1),A(null),w(void 0),p(`Failed to summarize:\n${e}`)}return}t(),O(!0),p(void 0);let i=null,c=null;if(e===`code`||e===`both`)try{await r(S)}catch(e){i=e,H(i)}if(e===`conversation`||e===`both`)try{await n(S)}catch(e){c=e,H(c)}O(!1),w(void 0),c&&i?p(`Failed to restore the conversation and code:\n${c}\n${i}`):c?p(`Failed to restore the conversation:\n${c}`):i?p(`Failed to restore the code:\n${i}`):o()}let F=ze(),ae=(0,Q.useCallback)(()=>{if(S&&!s){w(void 0);return}W(`tengu_message_selector_cancelled`,{}),o()},[o,S,s]),R=(0,Q.useCallback)(()=>v(e=>Math.max(0,e-1)),[]),ue=(0,Q.useCallback)(()=>v(e=>Math.min(g.length-1,e+1)),[g.length]),de=(0,Q.useCallback)(()=>v(0),[]),fe=(0,Q.useCallback)(()=>v(g.length-1),[g.length]),z=(0,Q.useCallback)(()=>{let e=g[_];e&&P(e)},[g,_,P]);le(`confirm:no`,ae,{context:`Confirmation`,isActive:!S}),ce({"messageSelector:up":R,"messageSelector:down":ue,"messageSelector:top":de,"messageSelector:bottom":fe,"messageSelector:select":z},{context:`MessageSelector`,isActive:!D&&!u&&!S&&x});let[B,pe]=(0,Q.useState)({});(0,Q.useEffect)(()=>{async function t(){m&&Promise.all(g.map(async(t,n)=>{if(t.uuid!==h){let r=b(l,t.uuid),i=g.at(n+1),a=r?rt(e,t.uuid,i?.uuid===h?void 0:i?.uuid):void 0;pe(a===void 0?e=>({...e,[n]:void 0}):e=>({...e,[n]:a}))}}))}t()},[g,e,h,l,m]);let V=m&&T?.filesChanged&&T.filesChanged.length>0,me=!u&&!S&&!s&&x;return(0,q.jsxs)(I,{flexDirection:`column`,width:`100%`,children:[(0,q.jsx)(se,{color:`suggestion`}),(0,q.jsxs)(I,{flexDirection:`column`,marginX:1,gap:1,children:[(0,q.jsx)(L,{bold:!0,color:`suggestion`,children:`Rewind`}),u&&(0,q.jsx)(q.Fragment,{children:(0,q.jsxs)(L,{color:`error`,children:[`Error: `,u]})}),!x&&(0,q.jsx)(q.Fragment,{children:(0,q.jsx)(L,{children:`Nothing to rewind to yet.`})}),!u&&S&&x&&(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(L,{children:[`Confirm you want to restore `,!T&&`the conversation `,`to the point before you sent this message:`]}),(0,q.jsxs)(I,{flexDirection:`column`,paddingLeft:1,borderStyle:`single`,borderRight:!1,borderTop:!1,borderBottom:!1,borderLeft:!0,borderLeftDimColor:!0,children:[(0,q.jsx)(nt,{userMessage:S,color:`text`,isCurrent:!1}),(0,q.jsxs)(L,{dimColor:!0,children:[`(`,Oe(new Date(S.timestamp)),`)`]})]}),(0,q.jsx)($e,{selectedRestoreOption:j,canRestoreCode:!!V,diffStatsForRestore:T}),D&&X(k)?(0,q.jsxs)(I,{flexDirection:`row`,gap:1,children:[(0,q.jsx)(oe,{}),(0,q.jsx)(L,{children:`Summarizing…`})]}):(0,q.jsx)(C,{isDisabled:D,options:N(!!V),defaultFocusValue:V?`both`:`conversation`,onFocus:e=>M(e),onChange:e=>ie(e),onCancel:()=>s?o():w(void 0)}),V&&(0,q.jsx)(I,{marginBottom:1,children:(0,q.jsxs)(L,{dimColor:!0,children:[i.warning,` Rewinding does not affect files edited manually or via bash.`]})})]}),me&&(0,q.jsxs)(q.Fragment,{children:[m?(0,q.jsx)(L,{children:`Restore the code and/or conversation to the point before…`}):(0,q.jsx)(L,{children:`Restore and fork the conversation to the point before…`}),(0,q.jsx)(I,{width:`100%`,flexDirection:`column`,children:g.slice(y,y+$).map((e,t)=>{let n=y+t,r=n===_,a=e.uuid===h,o=n in B,s=B[n],c=s?.filesChanged&&s.filesChanged.length;return(0,q.jsxs)(I,{height:m?3:2,overflow:`hidden`,width:`100%`,flexDirection:`row`,children:[(0,q.jsx)(I,{width:2,minWidth:2,children:r?(0,q.jsxs)(L,{color:`permission`,bold:!0,children:[i.pointer,` `]}):(0,q.jsx)(L,{children:` `})}),(0,q.jsxs)(I,{flexDirection:`column`,children:[(0,q.jsx)(I,{flexShrink:1,height:1,overflow:`hidden`,children:(0,q.jsx)(nt,{userMessage:e,color:r?`suggestion`:void 0,isCurrent:a,paddingRight:10})}),m&&o&&(0,q.jsx)(I,{height:1,flexDirection:`row`,children:s?(0,q.jsx)(q.Fragment,{children:(0,q.jsx)(L,{dimColor:!r,color:`inactive`,children:c?(0,q.jsxs)(q.Fragment,{children:[c===1&&s.filesChanged[0]?`${G.basename(s.filesChanged[0])} `:`${c} files changed `,(0,q.jsx)(tt,{diffStats:s})]}):(0,q.jsx)(q.Fragment,{children:`No code changes`})})}):(0,q.jsxs)(L,{dimColor:!0,color:`warning`,children:[i.warning,` No code restore`]})})]})]},e.uuid)})})]}),!S&&(0,q.jsx)(L,{dimColor:!0,italic:!0,children:F.pending?(0,q.jsxs)(q.Fragment,{children:[`Press `,F.keyName,` again to exit`]}):(0,q.jsxs)(q.Fragment,{children:[!u&&x&&`Enter to continue · `,`Esc to exit`]})})]})]})}function Qe(e){switch(e){case`summarize`:return`Messages after this point will be summarized.`;case`both`:case`conversation`:return`The conversation will be forked.`;case`code`:case`nevermind`:return`The conversation will be unchanged.`}}function $e({selectedRestoreOption:e,canRestoreCode:t,diffStatsForRestore:n}){let r=t&&(e===`both`||e===`code`);return(0,q.jsxs)(I,{flexDirection:`column`,children:[(0,q.jsx)(L,{dimColor:!0,children:Qe(e)}),!X(e)&&(r?(0,q.jsx)(et,{diffStatsForRestore:n}):(0,q.jsx)(L,{dimColor:!0,children:`The code will be unchanged.`}))]})}function et({diffStatsForRestore:e}){if(e===void 0)return;if(!e.filesChanged||!e.filesChanged[0])return(0,q.jsx)(L,{dimColor:!0,children:`The code has not changed (nothing will be restored).`});let t=e.filesChanged.length,n=``;return n=t===1?G.basename(e.filesChanged[0]||``):t===2?`${G.basename(e.filesChanged[0]||``)} and ${G.basename(e.filesChanged[1]||``)}`:`${G.basename(e.filesChanged[0]||``)} and ${e.filesChanged.length-1} other files`,(0,q.jsx)(q.Fragment,{children:(0,q.jsxs)(L,{dimColor:!0,children:[`The code will be restored `,(0,q.jsx)(tt,{diffStats:e}),` in `,n,`.`]})})}function tt({diffStats:e}){if(!(!e||!e.filesChanged))return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(L,{color:`diffAddedWord`,children:[`+`,e.insertions,` `]}),(0,q.jsxs)(L,{color:`diffRemovedWord`,children:[`-`,e.deletions]})]})}function nt({userMessage:e,color:t,dimColor:n,isCurrent:r,paddingRight:i}){let{columns:a}=ue();if(r)return(0,q.jsx)(I,{width:`100%`,children:(0,q.jsx)(L,{italic:!0,color:t,dimColor:n,children:`(current)`})});let o=e.message.content,s=typeof o==`string`?null:o[o.length-1],c=Ce(typeof o==`string`?o.trim():s&&Xe(s)?s.text.trim():`(no prompt)`);if(T(c))return(0,q.jsx)(I,{flexDirection:`row`,width:`100%`,children:(0,q.jsx)(L,{italic:!0,color:t,dimColor:n,children:`((empty message))`})});if(c.includes(`<bash-input>`)){let e=h(c,`bash-input`);if(e)return(0,q.jsxs)(I,{flexDirection:`row`,width:`100%`,children:[(0,q.jsx)(L,{color:`bashBorder`,children:`!`}),(0,q.jsxs)(L,{color:t,dimColor:n,children:[` `,e]})]})}if(c.includes(`<command-message>`)){let e=h(c,Ee),r=h(c,`command-args`),i=h(c,`skill-format`)===`true`;if(e)return i?(0,q.jsx)(I,{flexDirection:`row`,width:`100%`,children:(0,q.jsxs)(L,{color:t,dimColor:n,children:[`Skill(`,e,`)`]})}):(0,q.jsx)(I,{flexDirection:`row`,width:`100%`,children:(0,q.jsxs)(L,{color:t,dimColor:n,children:[`/`,e,` `,r]})})}return(0,q.jsx)(I,{flexDirection:`row`,width:`100%`,children:(0,q.jsx)(L,{color:t,dimColor:n,children:i?De(c,a-i,!0):c.slice(0,500).split(`
2
+ `).slice(0,4).join(`
3
+ `)})})}function rt(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||!O(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=ge(e.lines,e=>e.startsWith(`+`)),n=ge(e.lines,e=>e.startsWith(`-`));o+=t,s+=n}}catch{}}}return{filesChanged:a,insertions:o,deletions:s}}function Z(e){if(e.type!==`user`||Array.isArray(e.message.content)&&e.message.content[0]?.type===`tool_result`||M(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&&Xe(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&&!M(t)&&!O(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(R(),1),U(),ee(),x(),Be(),o(),m(),E(),v(),te(),$=7}));export{Z as a,We as c,it as i,Ye as n,Je as o,at as r,qe as s,Ze as t};
@@ -0,0 +1,11 @@
1
+ import{a as e,n as t,o as n}from"./rolldown-runtime-DaDcL9Zw.js";import{l as r,o as i}from"./envUtils-BDhHQY0-.js";import{n as a,t as o}from"./figures-5ThXQEtq.js";import{$_ as s,Ax as c,Ca as l,Cw as u,Dw as d,Ga as f,Ix as p,Ja as m,Ju as h,Ka as g,Ku as _,La as v,Nx as y,Oa as b,Ow as x,Px as S,Qa as C,Qf as w,Ra as T,Sw as ee,Sx as E,Wa as D,Xf as te,Za as ne,Zf as re,_a as ie,aE as ae,am as oe,aw as O,bw as k,cE as A,cp as j,dp as se,ev as ce,fo as le,fp as M,ga as ue,ha as de,ip as N,iw as fe,lo as pe,lp as me,mm as he,o_ as P,om as ge,oo as _e,ov as ve,ow as ye,pm as be,pw as xe,qa as F,qu as Se,s_ as Ce,sp as we,sv as I,sy as Te,to as Ee,uo as De,up as Oe,vw as ke,wa as Ae,ww as je,xw as Me,xx as Ne}from"./loadAgentsDir-CKSb56Gp.js";import{C as Pe,Gr as L,I as R,N as Fe,P as z,Pn as Ie,Rn as Le,di as Re,fi as B,j as ze,mt as Be,ot as Ve,t as V,ui as He,xt as Ue}from"./src-P_wYS_NJ2.js";import{t as H}from"./jsx-runtime-Bb4Xn-E0.js";import{B as We,Kt as Ge}from"./state-Bs5xweDL.js";import{n as Ke,t as qe}from"./cwd-L4wygFqJ.js";import{a as Je,l as Ye,o as Xe,r as Ze,s as Qe}from"./debug-BdqxZ7rV.js";import{Ut as $e,Vt as et,g as tt,n as nt}from"./settings-Xbq6AaD-.js";import{c as rt,h as it,y as at}from"./config-D4G8_MqJ.js";import{B as ot,J as st,L as ct,R as lt}from"./log-CTFl4qpD.js";import{b as ut,f as dt,m as ft,v as pt}from"./startupProfiler-jeId9f2i.js";import{l as mt,o as ht}from"./stringUtils-CbS6OkmE.js";import{Bt as gt,Dt as _t,E as vt,Gt as yt,St as bt,Tt as xt,_ as St,_n as Ct,b as wt,vn as Tt}from"./model-C2e73CJD.js";import{bn as Et,vn as Dt}from"./prompt-CybUvG8G.js";import{C as Ot,D as kt}from"./sessionState-BvECKycx.js";import{d as At,f as jt,h as Mt,p as Nt}from"./terminalSetup-DTGm1Eo2.js";import{n as Pt,t as Ft}from"./systemTheme-Ceakddth.js";import{n as It,r as Lt}from"./PromptInputFooterSuggestions-BpC9COmh.js";import{n as Rt,t as zt}from"./useMainLoopModel-ylPQNj7Z.js";import{n as Bt,t as Vt}from"./modalContext-CUThy6Ph.js";import{n as Ht,r as Ut,t as Wt}from"./statusNoticeHelpers-DMqRGFOh.js";import{a as Gt,c as Kt,i as qt,l as Jt,n as Yt,o as Xt,r as Zt,t as Qt,u as $t}from"./logoV2Utils-we1sfJvf.js";import{homedir as en}from"os";import{relative as tn}from"path";import{fileURLToPath as nn}from"url";function rn(e,t){for(let n of e)if(!t.has(n))return!1;return!0}var an=t((()=>{}));function on(e){if(e.type!==`user`)return!1;let t=Array.isArray(e.message.content)?e.message.content[0]:void 0;return!t||typeof t==`string`||t?.type!==`text`||!t.text.includes(`<task-notification`)||T(t.text,`status`)!==`completed`?!1:T(t.text,`summary`)?.startsWith(`Background command `)??!1}function sn(e,t){if(!ce()||t)return e;let n=[],r=0;for(;r<e.length;){let t=e[r];if(on(t)){let i=0;for(;r<e.length&&on(e[r]);)i++,r++;i===1?n.push(t):n.push({...t,message:{role:`user`,content:[{type:`text`,text:`<${ot}><${ct}>completed</${ct}><${lt}>${i} background commands completed</${lt}></${ot}>`}]}})}else n.push(t),r++}return n}var cn=t((()=>{st(),Te(),s(),C()}));function ln(e){return e.type===`system`&&e.subtype===`stop_hook_summary`&&e.hookLabel!==void 0}function un(e){let t=[],n=0;for(;n<e.length;){let r=e[n];if(ln(r)){let i=r.hookLabel,a=[];for(;n<e.length;){let t=e[n];if(!ln(t)||t.hookLabel!==i)break;a.push(t),n++}a.length===1?t.push(r):t.push({...r,hookCount:a.reduce((e,t)=>e+t.hookCount,0),hookInfos:a.flatMap(e=>e.hookInfos),hookErrors:a.flatMap(e=>e.hookErrors),preventedContinuation:a.some(e=>e.preventedContinuation),hasOutput:a.some(e=>e.hasOutput),totalDurationMs:Math.max(...a.map(e=>e.totalDurationMs??0))})}else t.push(r),n++}return t}var dn=t((()=>{}));function fn(e){let t=hn.get(e);return t||(t=new Set(e.filter(e=>e.renderGroupedToolUse).map(e=>e.name)),hn.set(e,t)),t}function pn(e){if(e.type===`assistant`&&e.message?.content&&Array.isArray(e.message.content)&&e.message.content[0]?.type===`tool_use`){let t=e.message.content[0];return{messageId:e.message.id,toolUseId:t.id,toolName:t.name}}return null}function mn(e,t,n=!1){if(n)return{messages:e};let r=fn(t),i=new Map;for(let t of e){let e=pn(t);if(e&&r.has(e.toolName)){let n=`${e.messageId}:${e.toolName}`,r=i.get(n)??[];r.push(t),i.set(n,r)}}let a=new Map,o=new Set;for(let[e,t]of i)if(t.length>=2){a.set(e,t);for(let e of t){let t=pn(e);t&&o.add(t.toolUseId)}}let s=new Map;for(let t of e)if(t.type===`user`&&t.message?.content&&Array.isArray(t.message.content))for(let e of t.message.content)e.type===`tool_result`&&o.has(e.tool_use_id)&&s.set(e.tool_use_id,t);let c=[],l=new Set;for(let t of e){let e=pn(t);if(e){let t=`${e.messageId}:${e.toolName}`,n=a.get(t);if(n){if(!l.has(t)){l.add(t);let r=n[0],i=[];for(let e of n){let t=e.message.content[0].id,n=s.get(t);n&&i.push(n)}let a={type:`grouped_tool_use`,toolName:e.toolName,messages:n,results:i,displayMessage:r,uuid:`grouped-${r.uuid}`,timestamp:r.timestamp,messageId:e.messageId};c.push(a)}continue}}if(t.type===`user`&&t.message?.content&&Array.isArray(t.message.content)){let e=t.message.content.filter(e=>e.type===`tool_result`);if(e.length>0&&e.every(e=>o.has(e.tool_use_id)))continue}c.push(t)}return{messages:c}}var hn,gn=t((()=>{hn=new WeakMap}));function _n(e){let t=Cn.get(e);if(t!==void 0)return t;let n=vn(e).toLowerCase();return Cn.set(e,n),n}function vn(e){let t=``;switch(e.type){case`user`:{let n=e.message.content;if(typeof n==`string`)t=Sn.has(n)?``:n;else{let r=[];for(let t of n??[])t.type===`text`?Sn.has(t.text)||r.push(t.text):t.type===`tool_result`&&r.push(bn(e.toolUseResult));t=r.join(`
2
+ `)}break}case`assistant`:{let n=e.message.content;Array.isArray(n)&&(t=n.flatMap(e=>e.type===`text`?[e.text]:e.type===`tool_use`?[yn(e.input)]:[]).join(`
3
+ `));break}case`attachment`:if(e.attachment.type===`relevant_memories`)t=(e.attachment.memories??[]).map(e=>e.content).join(`
4
+ `);else if(e.attachment.type===`queued_command`&&e.attachment.commandMode!==`task-notification`&&!e.attachment.isMeta){let n=e.attachment.prompt;t=typeof n==`string`?n:n.flatMap(e=>e.type===`text`?[e.text]:[]).join(`
5
+ `)}break;case`collapsed_read_search`:e.relevantMemories&&(t=e.relevantMemories.map(e=>e.content).join(`
6
+ `));break;default:break}let n=t,r=n.indexOf(`<system-reminder>`);for(;r>=0;){let e=n.indexOf(xn,r);if(e<0)break;n=n.slice(0,r)+n.slice(e+18),r=n.indexOf(`<system-reminder>`)}return n}function yn(e){if(!e||typeof e!=`object`)return``;let t=e,n=[];for(let e of[`command`,`pattern`,`file_path`,`path`,`prompt`,`description`,`query`,`url`,`skill`]){let r=t[e];typeof r==`string`&&n.push(r)}for(let e of[`args`,`files`]){let r=t[e];Array.isArray(r)&&r.every(e=>typeof e==`string`)&&n.push(r.join(` `))}return n.join(`
7
+ `)}function bn(e){if(!e||typeof e!=`object`)return typeof e==`string`?e:``;let t=e;if(typeof t.stdout==`string`){let e=typeof t.stderr==`string`?t.stderr:``;return t.stdout+(e?`
8
+ `+e:``)}if(t.file&&typeof t.file==`object`&&typeof t.file.content==`string`)return t.file.content;let n=[];for(let e of[`content`,`output`,`result`,`text`,`message`]){let r=t[e];typeof r==`string`&&n.push(r)}for(let e of[`filenames`,`lines`,`results`]){let r=t[e];Array.isArray(r)&&r.every(e=>typeof e==`string`)&&n.push(r.join(`
9
+ `))}return n.join(`
10
+ `)}var xn,Sn,Cn,wn=t((()=>{C(),xn=`</system-reminder>`,Sn=new Set([ue,ie]),Cn=new WeakMap}));function Tn({pose:e=`default`}={}){return(0,En.jsxs)(R,{flexDirection:`column`,alignItems:`center`,children:[(0,En.jsx)(z,{color:`clawd_body`,children:` █████ `}),(0,En.jsx)(z,{color:`clawd_body`,children:`██ ● ● ██`}),(0,En.jsx)(z,{color:`clawd_body`,children:`██ ▄▄▄ ██`}),(0,En.jsx)(z,{color:`clawd_body`,children:` █ █ █ █ `})]})}var En,Dn=t((()=>{B(),V(),En=H()}));function On(e){let{title:t,lines:n,footer:r,emptyMessage:i,customContent:a}=e,o=L(t);if(a!==void 0)o=Math.max(o,a.width);else if(n.length===0&&i)o=Math.max(o,L(i));else{let e=Math.max(0,...n.map(e=>e.timestamp?L(e.timestamp):0));for(let t of n){let n=e>0?e:0,r=L(t.text)+(n>0?n+2:0);o=Math.max(o,r)}}return r&&(o=Math.max(o,L(r))),o}function kn({config:e,actualWidth:t}){let{title:n,lines:r,footer:i,emptyMessage:a,customContent:o}=e,s=Math.max(0,...r.map(e=>e.timestamp?L(e.timestamp):0));return(0,U.jsxs)(R,{flexDirection:`column`,width:t,children:[(0,U.jsx)(z,{bold:!0,color:`claude`,children:n}),o?(0,U.jsxs)(U.Fragment,{children:[o.content,i&&(0,U.jsx)(z,{dimColor:!0,italic:!0,children:ut(i,t)})]}):r.length===0&&a?(0,U.jsx)(z,{dimColor:!0,children:ut(a,t)}):(0,U.jsxs)(U.Fragment,{children:[r.map((e,n)=>{let r=Math.max(10,t-(s>0?s+2:0));return(0,U.jsxs)(z,{children:[s>0&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(z,{dimColor:!0,children:(e.timestamp||``).padEnd(s)}),` `]}),(0,U.jsx)(z,{children:ut(e.text,r)})]},n)}),i&&(0,U.jsx)(z,{dimColor:!0,italic:!0,children:ut(i,t)})]})]})}var U,An=t((()=>{B(),V(),pt(),U=H()}));function jn({feeds:e,maxWidth:t}){let n=e.map(e=>On(e)),r=Math.max(...n),i=Math.min(r,t);return(0,Nn.jsx)(R,{flexDirection:`column`,children:e.map((t,n)=>(0,Nn.jsxs)(Mn.Fragment,{children:[(0,Nn.jsx)(kn,{config:t,actualWidth:i}),n<e.length-1&&(0,Nn.jsx)(Pe,{color:`claude`,width:i})]},n))})}var Mn,Nn,Pn=t((()=>{Mn=n(B(),1),V(),An(),Nn=H()}));function Fn(e){let t=e.map(e=>{let t=ft(e.modified);return{text:(e.summary&&e.summary!==`No prompt`?e.summary:e.firstPrompt)||``,timestamp:t}});return{title:`Recent activity`,lines:t,footer:t.length>0?`/resume for more`:void 0,emptyMessage:`No recent activity`}}function In(e){let t=e.filter(({isEnabled:e})=>e).sort((e,t)=>Number(e.isComplete)-Number(t.isComplete)).map(({text:e,isComplete:t})=>({text:`${t?`${o.tick} `:``}${e}`})),n=qe()===en()?`Note: You have launched claude in your home directory. For the best experience, launch it in a project directory instead.`:void 0;return n&&t.push({text:n}),{title:`Tips for getting started`,lines:t}}var Ln=t((()=>{a(),Ke(),pt()}));function Rn(e,t,n){return Array.from({length:n},()=>({pose:e,offset:t}))}function zn(){let{pose:e,bounceOffset:t,onClick:n}=Bn();return(0,Hn.jsx)(R,{height:Jn,flexDirection:`column`,onClick:n,children:(0,Hn.jsx)(R,{marginTop:t,flexShrink:0,children:(0,Hn.jsx)(Tn,{pose:e})})})}function Bn(){let[e]=(0,Vn.useState)(()=>nt().prefersReducedMotion??!1),[t,n]=(0,Vn.useState)(-1),r=(0,Vn.useRef)(Un),i=()=>{e||t!==-1||(r.current=Wn[Math.floor(Math.random()*Wn.length)],n(0))};(0,Vn.useEffect)(()=>{if(t===-1)return;if(t>=r.current.length){n(-1);return}let e=setTimeout(n,Kn,qn);return()=>clearTimeout(e)},[t]);let a=r.current,o=t>=0&&t<a.length?a[t]:Gn;return{pose:o.pose,bounceOffset:o.offset,onClick:i}}var Vn,Hn,Un,Wn,Gn,Kn,qn,Jn,Yn=t((()=>{B(),Vn=n(B(),1),V(),tt(),Dn(),Hn=H(),Un=[...Rn(`default`,1,2),...Rn(`arms-up`,0,3),...Rn(`default`,0,1),...Rn(`default`,1,2),...Rn(`arms-up`,0,3),...Rn(`default`,0,1)],Wn=[Un,[...Rn(`look-right`,0,5),...Rn(`look-left`,0,5),...Rn(`default`,0,1)]],Gn={pose:`default`,offset:0},Kn=60,qn=e=>e+1,Jn=3}));function Xn(){let{columns:e}=Ve(),t=I(e=>e.agent),n=vt(Rt()),{version:r,cwd:i,billingType:a,agentName:o}=Xt(),s=t??o,c=Math.max(e-15,20),l=ut(r,Math.max(c-11,6)),{shouldSplit:u,truncatedModel:d,truncatedBilling:f}=Zt(n,a,c),p=s?c-1-L(s)-3:c,m=$t(i,Math.max(p,10));return(0,W.jsx)(P,{children:(0,W.jsxs)(R,{flexDirection:`row`,gap:2,alignItems:`center`,children:[ce()?(0,W.jsx)(zn,{}):(0,W.jsx)(Tn,{}),(0,W.jsxs)(R,{flexDirection:`column`,children:[(0,W.jsxs)(z,{children:[(0,W.jsx)(z,{bold:!0,children:`Work Mate`}),` `,(0,W.jsxs)(z,{dimColor:!0,children:[`v`,l]})]}),u?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(z,{dimColor:!0,children:d}),(0,W.jsx)(z,{dimColor:!0,children:f})]}):(0,W.jsxs)(z,{dimColor:!0,children:[d,` · `,f]}),(0,W.jsx)(z,{dimColor:!0,children:s?`@${s} · ${m}`:m})]})]})})}var W,Zn=t((()=>{zt(),xe(),V(),ve(),pt(),s(),Jt(),St(),Ce(),Yn(),Dn(),W=H()}));function Qn(){let e=(0,er.useMemo)($n,[]),t=(0,er.useMemo)(()=>rt().lastShownEmergencyTip,[]),n=e.tip&&e.tip!==t;return(0,er.useEffect)(()=>{n&&at(t=>t.lastShownEmergencyTip===e.tip?t:{...t,lastShownEmergencyTip:e.tip})},[n,e.tip]),n?(0,tr.jsx)(R,{paddingLeft:2,flexDirection:`column`,children:(0,tr.jsx)(z,{...e.color===`warning`?{color:`warning`}:e.color===`error`?{color:`error`}:{dimColor:!0},children:e.tip})}):null}function $n(){return nr}var er,tr,nr,rr=t((()=>{B(),er=n(B(),1),V(),it(),tr=H(),nr={tip:``,color:`dim`}}));function ir({char:e=`✻`}){let[t]=(0,ar.useState)(()=>nt().prefersReducedMotion??!1),[n,r]=(0,ar.useState)(t),i=(0,ar.useRef)(null),[a,o]=Be(n?null:50);return(0,ar.useEffect)(()=>{if(n)return;let e=setTimeout(r,cr,!0);return()=>clearTimeout(e)},[n]),n?(0,or.jsx)(R,{ref:a,children:(0,or.jsx)(z,{color:lr,children:e})}):(i.current===null&&(i.current=o),(0,or.jsx)(R,{ref:a,children:(0,or.jsx)(z,{color:h(_((o-i.current)/sr*360%360)),children:e})}))}var ar,or,sr,cr,lr,ur=t((()=>{B(),ar=n(B(),1),$e(),V(),tt(),Se(),or=H(),sr=1500,cr=sr*2,lr=h({r:153,g:153,b:153})}));function dr(){return wt()&&(rt().opus1mMergeNoticeSeenCount??0)<hr}function fr(){let[e]=(0,pr.useState)(dr);return(0,pr.useEffect)(()=>{if(!e)return;let t=(rt().opus1mMergeNoticeSeenCount??0)+1;at(e=>(e.opus1mMergeNoticeSeenCount??0)>=t?e:{...e,opus1mMergeNoticeSeenCount:t})},[e]),e?(0,mr.jsxs)(R,{paddingLeft:2,children:[(0,mr.jsx)(ir,{char:`↑`}),(0,mr.jsx)(z,{dimColor:!0,children:` Opus now defaults to 1M context · 5x more room, same pricing`})]}):null}var pr,mr,hr,gr=t((()=>{B(),pr=n(B(),1),$e(),V(),it(),St(),ur(),mr=H(),hr=6}));function _r(){let e=Kt(),t=rt().oauthAccount?.displayName??``,{columns:n}=Ve(),i=Mt(),a=ae.isSandboxingEnabled(),o=I(e=>e.agent),s=rt(),[c]=(0,vr.useState)(()=>{let e=nt().companyAnnouncements;if(!(!e||e.length===0))return s.numStartups===1?e[0]:e[Math.floor(Math.random()*e.length)]});(0,vr.useEffect)(()=>{i&&jt()},[i]),!i&&r(process.env.CLAUDE_CODE_FORCE_FULL_LOGO);let l=vt(Rt()),{version:u,cwd:d,billingType:f,agentName:p}=Xt(),m=o??p,h=ut(l,yr-20);if(!i&&!r(process.env.CLAUDE_CODE_FORCE_FULL_LOGO))return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Xn,{}),(0,G.jsx)(fr,{}),Xe()&&(0,G.jsxs)(R,{paddingLeft:2,flexDirection:`column`,children:[(0,G.jsx)(z,{color:`warning`,children:`Debug mode enabled`}),(0,G.jsxs)(z,{dimColor:!0,children:[`Logging to: `,Qe()?`stderr`:Ze()]})]}),(0,G.jsx)(Qn,{}),process.env.CLAUDE_CODE_TMUX_SESSION&&(0,G.jsxs)(R,{paddingLeft:2,flexDirection:`column`,children:[(0,G.jsxs)(z,{dimColor:!0,children:[`tmux session: `,process.env.CLAUDE_CODE_TMUX_SESSION]}),(0,G.jsx)(z,{dimColor:!0,children:process.env.CLAUDE_CODE_TMUX_PREFIX_CONFLICTS?`Detach: ${process.env.CLAUDE_CODE_TMUX_PREFIX} ${process.env.CLAUDE_CODE_TMUX_PREFIX} d (press prefix twice - Claude uses ${process.env.CLAUDE_CODE_TMUX_PREFIX})`:`Detach: ${process.env.CLAUDE_CODE_TMUX_PREFIX} d`})]}),c&&(0,G.jsxs)(R,{paddingLeft:2,flexDirection:`column`,children:[!process.env.IS_DEMO&&s.oauthAccount?.organizationName&&(0,G.jsxs)(z,{dimColor:!0,children:[`Message from `,s.oauthAccount.organizationName,`:`]}),(0,G.jsx)(z,{children:c})]})]});let g=Gt(n),_=Pt(rt().theme),v=` ${ze(`claude`,_)(`Work Mate`)} ${ze(`inactive`,_)(`v${u}`)} `,y=ze(`claude`,_)(` Work Mate `);if(g===`compact`){let e=qt(t);L(e)>n-4&&(e=qt(null));let r=m?n-4-1-L(m)-3:n-4,i=$t(d,Math.max(r,10));return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(P,{children:(0,G.jsxs)(R,{flexDirection:`column`,borderStyle:`round`,borderColor:`claude`,borderText:{content:y,position:`top`,align:`start`,offset:1},paddingX:1,paddingY:1,alignItems:`center`,width:n,children:[(0,G.jsx)(z,{bold:!0,children:e}),(0,G.jsx)(R,{marginY:1,children:(0,G.jsx)(Tn,{})}),(0,G.jsx)(z,{dimColor:!0,children:h}),(0,G.jsx)(z,{dimColor:!0,children:f}),(0,G.jsx)(z,{dimColor:!0,children:m?`@${m} · ${i}`:i})]})}),(0,G.jsx)(fr,{}),a&&(0,G.jsx)(R,{marginTop:1,flexDirection:`column`,children:(0,G.jsx)(z,{color:`warning`,children:`Your bash commands will be sandboxed. Disable with /sandbox.`})})]})}let b=qt(t),x=!process.env.IS_DEMO&&s.oauthAccount?.organizationName?`${h} · ${f} · ${s.oauthAccount.organizationName}`:`${h} · ${f}`,S=m?yr-1-L(m)-3:yr,C=$t(d,Math.max(S,10)),w=m?`@${m} · ${C}`:C,{leftWidth:T,rightWidth:ee}=Qt(n,g,Yt(b,w,x));return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(P,{children:(0,G.jsx)(R,{flexDirection:`column`,borderStyle:`round`,borderColor:`claude`,borderText:{content:v,position:`top`,align:`start`,offset:3},children:(0,G.jsxs)(R,{flexDirection:g===`horizontal`?`row`:`column`,paddingX:1,gap:1,children:[(0,G.jsxs)(R,{flexDirection:`column`,width:T,justifyContent:`space-between`,alignItems:`center`,minHeight:9,children:[(0,G.jsx)(R,{marginTop:1,children:(0,G.jsx)(z,{bold:!0,children:b})}),(0,G.jsx)(Tn,{}),(0,G.jsxs)(R,{flexDirection:`column`,alignItems:`center`,children:[(0,G.jsx)(z,{dimColor:!0,children:x}),(0,G.jsx)(z,{dimColor:!0,children:w})]})]}),g===`horizontal`&&(0,G.jsx)(R,{height:`100%`,borderStyle:`single`,borderColor:`claude`,borderDimColor:!0,borderTop:!1,borderBottom:!1,borderLeft:!1}),g===`horizontal`&&(0,G.jsx)(jn,{feeds:i?[In(At()),Fn(e)]:[Fn(e)],maxWidth:ee})]})})}),(0,G.jsx)(fr,{}),Xe()&&(0,G.jsxs)(R,{paddingLeft:2,flexDirection:`column`,children:[(0,G.jsx)(z,{color:`warning`,children:`Debug mode enabled`}),(0,G.jsxs)(z,{dimColor:!0,children:[`Logging to: `,Qe()?`stderr`:Ze()]})]}),(0,G.jsx)(Qn,{}),process.env.CLAUDE_CODE_TMUX_SESSION&&(0,G.jsxs)(R,{paddingLeft:2,flexDirection:`column`,children:[(0,G.jsxs)(z,{dimColor:!0,children:[`tmux session: `,process.env.CLAUDE_CODE_TMUX_SESSION]}),(0,G.jsx)(z,{dimColor:!0,children:process.env.CLAUDE_CODE_TMUX_PREFIX_CONFLICTS?`Detach: ${process.env.CLAUDE_CODE_TMUX_PREFIX} ${process.env.CLAUDE_CODE_TMUX_PREFIX} d (press prefix twice - Claude uses ${process.env.CLAUDE_CODE_TMUX_PREFIX})`:`Detach: ${process.env.CLAUDE_CODE_TMUX_PREFIX} d`})]}),c&&(0,G.jsxs)(R,{paddingLeft:2,flexDirection:`column`,children:[!process.env.IS_DEMO&&s.oauthAccount?.organizationName&&(0,G.jsxs)(z,{dimColor:!0,children:[`Message from `,s.oauthAccount.organizationName,`:`]}),(0,G.jsx)(z,{children:c})]}),a&&(0,G.jsx)(R,{paddingLeft:2,flexDirection:`column`,children:(0,G.jsx)(z,{color:`warning`,children:`Your bash commands will be sandboxed. Disable with /sandbox.`})})]})}var vr,G,yr,br=t((()=>{B(),V(),xe(),Jt(),pt(),Dn(),Pn(),Ln(),it(),Ft(),tt(),Je(),vr=n(B(),1),Nt(),Zn(),Ce(),i(),rr(),gr(),A(),ve(),zt(),St(),G=H(),yr=50}));function xr({message:e,isTranscriptMode:t}){let n=e.message?.content,r=Array.isArray(n)?n:[];if(!(t&&e.type===`assistant`&&e.message?.model&&r.some(e=>e?.type===`text`)))return null;let i=e.message.model;return(0,Sr.jsx)(R,{minWidth:L(i)+8,children:(0,Sr.jsx)(z,{dimColor:!0,children:i})})}var Sr,Cr=t((()=>{B(),V(),Sr=H()}));function wr({message:e,isTranscriptMode:t}){if(!(t&&e.timestamp&&e.type===`assistant`&&Array.isArray(e.message.content)&&e.message.content.some(e=>e.type===`text`)))return null;let n=new Date(e.timestamp).toLocaleTimeString(`en-US`,{hour:`2-digit`,minute:`2-digit`,hour12:!0});return(0,Tr.jsx)(R,{minWidth:L(n),children:(0,Tr.jsx)(z,{dimColor:!0,children:n})})}var Tr,Er=t((()=>{B(),V(),Tr=H()}));function Dr(e,t,n,r){for(let i=t+1;i<e.length;i++){let t=e[i];if(t?.type===`assistant`){let e=Pr(t.message.content);if(e?.type===`thinking`||e?.type===`redacted_thinking`||e?.type===`tool_use`&&(me(e.name,e.input,n).isCollapsible||r.has(e.id)))continue;return!0}if(!(t?.type===`system`||t?.type===`attachment`)&&!(t?.type===`user`&&Pr(t.message.content)?.type===`tool_result`)){if(t?.type===`grouped_tool_use`){let e=Pr(t.messages[0]?.message.content)?.input;if(me(t.toolName,e,n).isCollapsible)continue}return!0}}return!1}function Or({message:e,isUserContinuation:t,hasContentAfter:n,tools:r,commands:i,verbose:a,inProgressToolUseIDs:o,streamingToolUseIDs:s,screen:c,canAnimate:l,lastThinkingBlockId:u,latestBashOutputUUID:d,columns:p,isLoading:m,lookups:h,shouldCollapseDiffs:_}){let v=c===`transcript`,y=e.type===`grouped_tool_use`,b=e.type===`collapsed_read_search`,x=b&&(se(e,o)||m&&!n),S=y?e.displayMessage:b?j(e):e,C=y||b?[]:f(e,h),w=Xi(e,s,o,y||b?de:g(e,h),c,h),T=!1;if(l)if(y)T=e.messages.some(e=>{let t=Pr(e.message.content);return t?.type===`tool_use`&&o.has(t.id)});else if(b)T=se(e,o);else{let t=F(e);T=!t||o.has(t)}let ee=v&&S.type===`assistant`&&Array.isArray(S.message.content)&&S.message.content.some(e=>e.type===`text`)&&(S.timestamp||S.message.model),E=(0,Nr.jsx)(te,{message:e,lookups:h,addMargin:!ee,containerWidth:ee?void 0:p,tools:r,commands:i,verbose:a,inProgressToolUseIDs:o,progressMessagesForMessage:C,shouldAnimate:T,shouldShowDot:!0,isTranscriptMode:v,isStatic:w,isActiveCollapsedGroup:x,isUserContinuation:t,lastThinkingBlockId:u,latestBashOutputUUID:d,shouldCollapseDiffs:_});return ee?(0,Nr.jsx)(P,{children:(0,Nr.jsxs)(R,{width:p,flexDirection:`column`,children:[(0,Nr.jsxs)(R,{flexDirection:`row`,justifyContent:`flex-end`,gap:1,marginTop:1,children:[(0,Nr.jsx)(wr,{message:S,isTranscriptMode:v}),(0,Nr.jsx)(xr,{message:S,isTranscriptMode:v})]}),E]})}):(0,Nr.jsx)(P,{children:E})}function kr(e,t){if(e.type===`grouped_tool_use`)return e.messages.some(e=>{let n=Pr(e.message.content);return n?.type===`tool_use`&&t.has(n.id)});if(e.type===`collapsed_read_search`)return Oe(e).some(e=>t.has(e));let n=F(e);return!!n&&t.has(n)}function Ar(e,t){if(e.type===`grouped_tool_use`)return e.messages.every(e=>{let n=Pr(e.message.content);return n?.type===`tool_use`&&t.has(n.id)});if(e.type===`collapsed_read_search`)return Oe(e).every(e=>t.has(e));if(e.type===`assistant`){let n=Pr(e.message.content);if(n?.type===`server_tool_use`)return t.has(n.id)}let n=F(e);return!n||t.has(n)}function jr(e,t){if(e.message!==t.message||e.screen!==t.screen||e.verbose!==t.verbose||e.message.type===`collapsed_read_search`&&t.screen!==`transcript`||e.columns!==t.columns||e.latestBashOutputUUID===e.message.uuid!=(t.latestBashOutputUUID===t.message.uuid)||e.lastThinkingBlockId!==t.lastThinkingBlockId&&re(t.message))return!1;let n=kr(e.message,e.streamingToolUseIDs),r=Ar(e.message,e.lookups.resolvedToolUseIDs);return!(n||!r)}var Mr,Nr,Pr,Fr,Ir=t((()=>{Mr=n(B(),1),V(),M(),C(),w(),Nr=H(),Cr(),sa(),Er(),Ce(),Pr=e=>{if(!Array.isArray(e))return;let t=e[0];if(!(t==null||typeof t==`string`))return t},Fr=Mr.memo(Or,jr)}));function Lr(e){return e.type===`attachment`&&Rr.has(e.attachment.type)}var Rr,zr=t((()=>{Rr=new Set(`hook_success.hook_additional_context.hook_cancelled.command_permissions.agent_mention.budget_usd.critical_system_reminder.edited_image_file.edited_text_file.opened_file_in_ide.output_style.plan_mode.plan_mode_exit.plan_mode_reentry.structured_output.todo_reminder.context_efficiency.deferred_tools_delta.mcp_instructions_delta.token_usage.max_turns_reached.task_reminder.auto_mode.auto_mode_exit.output_token_usage.verify_plan_reminder.current_session_memory.compaction_reminder.date_change`.split(`.`))}));function Br(e){return Kr.filter(t=>t.isActive(e))}var K,Vr,Hr,Ur,Wr,Gr,Kr,qr=t((()=>{V(),B(),p(),a(),Ke(),pt(),gt(),Ut(),K=H(),Vr={id:`large-memory-files`,type:`warning`,isActive:e=>y(e.memoryFiles).length>0,render:e=>(0,K.jsx)(K.Fragment,{children:y(e.memoryFiles).map(e=>{let t=e.path.startsWith(qe())?tn(qe(),e.path):e.path;return(0,K.jsxs)(R,{flexDirection:`row`,children:[(0,K.jsx)(z,{color:`warning`,children:o.warning}),(0,K.jsxs)(z,{color:`warning`,children:[`Large `,(0,K.jsx)(z,{bold:!0,children:t}),` will impact performance (`,dt(e.content.length),` chars > `,dt(c),`)`,(0,K.jsx)(z,{dimColor:!0,children:` · /memory to edit`})]})]},e.path)})})},Hr={id:`claude-ai-external-token`,type:`warning`,isActive:()=>{let e=_t();return yt()&&(e.source===`ANTHROPIC_AUTH_TOKEN`||e.source===`apiKeyHelper`)},render:()=>{let e=_t();return(0,K.jsxs)(R,{flexDirection:`row`,marginTop:1,children:[(0,K.jsx)(z,{color:`warning`,children:o.warning}),(0,K.jsxs)(z,{color:`warning`,children:[`Auth conflict: Using `,e.source,` instead of Claude account subscription token. Either unset`,` `,e.source,", or run `claude /logout`."]})]})}},Ur={id:`api-key-conflict`,type:`warning`,isActive:()=>{let{source:e}=bt({skipRetrievingKeyFromApiKeyHelper:!0});return!!xt()&&(e===`ANTHROPIC_API_KEY`||e===`apiKeyHelper`)},render:()=>{let{source:e}=bt({skipRetrievingKeyFromApiKeyHelper:!0});return(0,K.jsxs)(R,{flexDirection:`row`,marginTop:1,children:[(0,K.jsx)(z,{color:`warning`,children:o.warning}),(0,K.jsxs)(z,{color:`warning`,children:[`Auth conflict: Using `,e,` instead of Console key. Either unset `,e,", or run `claude /logout`."]})]})}},Wr={id:`both-auth-methods`,type:`warning`,isActive:()=>{let{source:e}=bt({skipRetrievingKeyFromApiKeyHelper:!0}),t=_t();return e!==`none`&&t.source!==`none`&&!(e===`apiKeyHelper`&&t.source===`apiKeyHelper`)},render:()=>{let{source:e}=bt({skipRetrievingKeyFromApiKeyHelper:!0}),t=_t();return(0,K.jsxs)(R,{flexDirection:`column`,marginTop:1,children:[(0,K.jsxs)(R,{flexDirection:`row`,children:[(0,K.jsx)(z,{color:`warning`,children:o.warning}),(0,K.jsxs)(z,{color:`warning`,children:[`Auth conflict: Both a token (`,t.source,`) and an API key (`,e,`) are set. This may lead to unexpected behavior.`]})]}),(0,K.jsxs)(R,{flexDirection:`column`,marginLeft:3,children:[(0,K.jsxs)(z,{color:`warning`,children:[`· Trying to use `,t.source===`claude.ai`?`claude.ai`:t.source,`?`,` `,e===`ANTHROPIC_API_KEY`?`Unset the ANTHROPIC_API_KEY environment variable, or claude /logout then say "No" to the API key approval before login.`:e===`apiKeyHelper`?`Unset the apiKeyHelper setting.`:`claude /logout`]}),(0,K.jsxs)(z,{color:`warning`,children:[`· Trying to use `,e,`?`,` `,t.source===`claude.ai`?`claude /logout to sign out of claude.ai.`:`Unset the ${t.source} environment variable.`]})]})]})}},Gr={id:`large-agent-descriptions`,type:`warning`,isActive:e=>Ht(e.agentDefinitions)>Wt,render:e=>{let t=Ht(e.agentDefinitions);return(0,K.jsxs)(R,{flexDirection:`row`,children:[(0,K.jsx)(z,{color:`warning`,children:o.warning}),(0,K.jsxs)(z,{color:`warning`,children:[`Large cumulative agent descriptions will impact performance (~`,dt(t),` tokens > `,dt(Wt),`)`,(0,K.jsx)(z,{dimColor:!0,children:` · /agents to manage`})]})]})}},Kr=[Vr,Gr,Hr,Ur,Wr]}));function Jr({agentDefinitions:e}={}){let t={config:rt(),agentDefinitions:e,memoryFiles:(0,Xr.use)(S())},n=Br(t);return n.length===0?null:(0,Zr.jsx)(R,{flexDirection:`column`,paddingLeft:1,children:n.map(e=>(0,Zr.jsx)(Yr.Fragment,{children:e.render(t)},e.id))})}var Yr,Xr,Zr,Qr=t((()=>{Yr=n(B(),1),Xr=n(B(),1),V(),p(),it(),qr(),Zr=H()}));function $r(e,t,n){let r=(0,q.useRef)(new Map),i=(0,q.useRef)(0),a=(0,q.useRef)(0),o=(0,q.useRef)({arr:new Float64Array,version:-1,n:-1}),s=(0,q.useRef)(new Map),c=(0,q.useRef)(new Map),l=(0,q.useRef)(n),u=(0,q.useRef)(!1),d=(0,q.useRef)(null),f=(0,q.useRef)(0);if(l.current!==n){let e=l.current/n;l.current=n;for(let[t,n]of r.current)r.current.set(t,Math.max(1,Math.round(n*e)));i.current++,u.current=!0,f.current=2}let p=f.current>0?d.current:null,m=(0,q.useRef)(0),h=(0,q.useRef)(null);(0,q.useSyncExternalStore)((0,q.useCallback)(t=>e.current?.subscribe(t)??si,[e]),()=>{let t=e.current;if(!t)return NaN;let n=t.getScrollTop()+t.getPendingDelta(),r=Math.floor(n/ri);return t.isSticky()?~r:r});let g=e.current?.getScrollTop()??-1,_=e.current?.getPendingDelta()??0,v=e.current?.getViewportHeight()??0,y=e.current?.isSticky()??!0;(0,q.useMemo)(()=>{let e=new Set(t),n=!1;for(let t of r.current.keys())e.has(t)||(r.current.delete(t),n=!0);for(let t of c.current.keys())e.has(t)||c.current.delete(t);n&&i.current++},[t]);let b=t.length;if(o.current.version!==i.current||o.current.n!==b){let e=o.current.arr.length>=b+1?o.current.arr:new Float64Array(b+1);e[0]=0;for(let n=0;n<b;n++)e[n+1]=e[n]+(r.current.get(t[n])??ei);o.current={arr:e,version:i.current,n:b}}let x=o.current.arr,S=x[b],C,w;if(p)[C,w]=p,C=Math.min(C,b),w=Math.min(w,b);else if(v===0||g<0)C=Math.max(0,b-ni),w=b;else{if(y){let e=v+ti;for(C=b;C>0&&S-x[C-1]<e;)C--;w=b}else{let e=m.current,n=v*3,i=Math.min(g,g+_),a=Math.max(g,g+_),o=a-i,c=o>n&&_<0?a-n:i,l=c+Math.min(o,n),u=Math.max(0,c-e),f=l-e,p=u-ti;{let e=0,t=b;for(;e<t;){let n=e+t>>1;x[n+1]<=p?e=n+1:t=n}C=e}{let e=d.current;if(e&&e[0]<C)for(let n=e[0];n<Math.min(C,e[1]);n++){let e=t[n];if(s.current.has(e)&&!r.current.has(e)){C=n;break}}}let h=v+2*ti,y=Math.min(b,C+ai),S=0;for(w=C;w<y&&(S<h||x[w]<f+v+ti);)S+=r.current.get(t[w])??ii,w++}let e=v+2*ti,n=Math.max(0,w-ai),i=0;for(let e=C;e<w;e++)i+=r.current.get(t[e])??ii;for(;C>n&&i<e;)C--,i+=r.current.get(t[C])??ii;let o=d.current,c=Math.abs(g-a.current)+Math.abs(_);if(o&&c>v*2){let[e,t]=o;C<e-oi&&(C=e-oi),w>t+oi&&(w=t+oi),C>w&&(w=Math.min(C+oi,b))}a.current=g}f.current>0?f.current--:d.current=[C,w];let T=(0,q.useDeferredValue)(C),ee=(0,q.useDeferredValue)(w),E=C<T?T:C,D=w>ee?ee:w;if((E>D||y)&&(E=C,D=w),_>0&&(D=w),D-E>ai){let e=(x[E]+x[D])/2;g-m.current<e?D=E+ai:E=D-ai}let te=m.current,ne=x[E],re=E===0?0:ne+te,ie=D===b?1/0:Math.max(ne,x[D]-v)+te;(0,q.useLayoutEffect)(()=>{y?e.current?.setClampBounds(void 0,void 0):e.current?.setClampBounds(re,ie)}),(0,q.useLayoutEffect)(()=>{let e=h.current?.yogaNode;if(e&&e.getComputedWidth()>0&&(m.current=e.getComputedTop()),u.current){u.current=!1;return}let t=!1;for(let[e,n]of s.current){let i=n.yogaNode;if(!i)continue;let a=i.getComputedHeight(),o=r.current.get(e);a>0?o!==a&&(r.current.set(e,a),t=!0):i.getComputedWidth()>0&&o!==0&&(r.current.set(e,0),t=!0)}t&&i.current++});let ae=(0,q.useCallback)(e=>{let t=c.current.get(e);return t||(t=t=>{if(t)s.current.set(e,t);else{let t=s.current.get(e)?.yogaNode;if(t&&!u.current){let n=t.getComputedHeight();(n>0||t.getComputedWidth()>0)&&r.current.get(e)!==n&&(r.current.set(e,n),i.current++)}s.current.delete(e)}},c.current.set(e,t)),t},[]),oe=(0,q.useCallback)(e=>{let n=s.current.get(t[e])?.yogaNode;return!n||n.getComputedWidth()===0?-1:n.getComputedTop()},[t]),O=(0,q.useCallback)(e=>s.current.get(t[e])??null,[t]),k=(0,q.useCallback)(e=>r.current.get(t[e]),[t]),A=(0,q.useCallback)(t=>{let n=o.current;t<0||t>=n.n||e.current?.scrollTo(n.arr[t]+m.current)},[e]),j=S-x[D];return{range:[E,D],topSpacer:ne,bottomSpacer:j,measureRef:ae,spacerRef:h,offsets:x,getItemTop:oe,getItemElement:O,getItemHeight:k,scrollToIndex:A}}var q,ei,ti,ni,ri,ii,ai,oi,si,ci=t((()=>{q=n(B(),1),ei=3,ti=40,ni=30,ri=20,ii=1,ai=200,oi=25,si=()=>{}}));function li({children:e}){let[t,n]=(0,J.useState)(null),[r,i]=(0,J.useState)(null);return(0,mi.jsx)(gi.Provider,{value:n,children:(0,mi.jsx)(vi.Provider,{value:i,children:(0,mi.jsx)(hi.Provider,{value:t,children:(0,mi.jsx)(_i.Provider,{value:r,children:e})})})})}function ui(){return(0,J.useContext)(hi)}function di(){return(0,J.useContext)(_i)}function fi(e){let t=(0,J.useContext)(gi);(0,J.useEffect)(()=>{if(t)return t(e),()=>t(null)},[t,e])}function pi(e){let t=(0,J.useContext)(vi);(0,J.useEffect)(()=>{if(t)return t(e),()=>t(null)},[t,e])}var J,mi,hi,gi,_i,vi,yi=t((()=>{J=n(B(),1),mi=H(),hi=(0,J.createContext)(null),gi=(0,J.createContext)(null),_i=(0,J.createContext)(null),vi=(0,J.createContext)(null)}));function bi(e){let[t,n]=(0,Y.useState)(null),r=(0,Y.useRef)(e);r.current=e;let i=(0,Y.useRef)(null),a=(0,Y.useCallback)(()=>{n(null)},[]),o=(0,Y.useCallback)(e=>{let t=Math.max(0,e.getScrollHeight()-e.getViewportHeight());e.getScrollTop()+e.getPendingDelta()>=t||i.current===null&&(i.current=e.getScrollHeight(),n(r.current))},[]),s=(0,Y.useCallback)(e=>{e&&e.scrollToBottom()},[]);return(0,Y.useEffect)(()=>{t===null?i.current=null:e<t&&(i.current=null,n(null))},[e,t]),{dividerIndex:t,dividerYRef:i,onScrollAway:o,onRepin:a,jumpToNew:s,shiftDivider:(0,Y.useCallback)((e,t)=>{n(t=>t===null?null:t+e),i.current!==null&&(i.current+=t)},[])}}function xi(e,t){let n=0,r=!1;for(let i=t;i<e.length;i++){let t=e[i];if(t.type===`progress`||t.type===`assistant`&&!Si(t))continue;let a=t.type===`assistant`;a&&!r&&n++,r=a}return n}function Si(e){if(e.type!==`assistant`||!Array.isArray(e.message.content))return!1;for(let t of e.message.content)if(typeof t!=`string`&&t.type===`text`&&t.text.trim()!==``)return!0;return!1}function Ci(e,t){if(t===null)return;let n=t;for(;n<e.length&&(e[n]?.type===`progress`||Lr(e[n]));)n++;let r=e[n]?.uuid;if(!r)return;let i=xi(e,t);return{firstUnseenUuid:r,count:Math.max(1,i)}}function wi({scrollable:e,bottom:t,overlay:n,bottomFloat:r,modal:i,modalScrollRef:a,scrollRef:o,dividerYRef:s,hidePill:c=!1,hideSticky:l=!1,newMessageCount:u=0,onPillClick:d}){let{rows:f,columns:p}=Ve(),[m,h]=(0,Y.useState)(null),g=(0,Y.useMemo)(()=>({setStickyPrompt:h}),[]),_=(0,Y.useSyncExternalStore)((0,Y.useCallback)(e=>o?.current?.subscribe(e)??(()=>{}),[o]),()=>{let e=o?.current,t=s?.current;return!e||t==null?!1:e.getScrollTop()+e.getPendingDelta()+e.getViewportHeight()<t});if((0,Y.useLayoutEffect)(()=>{if(!ce())return;let e=Le.get(process.stdout);if(e)return e.onHyperlinkClick=e=>{if(e.startsWith(`file:`))try{ye(nn(e))}catch{}else O(e)},()=>{e.onHyperlinkClick=void 0}},[]),ce()){let s=l?null:m,h=s!=null&&s!==`clicked`&&n==null?s:null,v=s!=null&&n==null;return(0,X.jsxs)(li,{children:[(0,X.jsx)(R,{flexDirection:`row`,flexGrow:1,overflow:`hidden`,width:`100%`,children:(0,X.jsxs)(R,{flexDirection:`column`,flexGrow:1,width:p,overflow:`hidden`,children:[(0,X.jsxs)(R,{flexGrow:1,flexDirection:`column`,overflow:`hidden`,children:[h&&(0,X.jsx)(Ei,{text:h.text,onClick:h.scrollTo}),(0,X.jsxs)(Ue,{ref:o,flexGrow:1,flexDirection:`column`,paddingTop:+!v,stickyScroll:!0,children:[(0,X.jsx)(Ai,{value:g,children:e}),n]}),!c&&_&&n==null&&(0,X.jsx)(Ti,{count:u,onClick:d}),r!=null&&(0,X.jsx)(R,{position:`absolute`,bottom:0,right:0,opaque:!0,children:r})]}),(0,X.jsxs)(R,{flexDirection:`column`,flexShrink:0,width:`100%`,maxHeight:`50%`,children:[(0,X.jsx)(Di,{}),(0,X.jsx)(Oi,{}),(0,X.jsx)(R,{flexDirection:`column`,width:`100%`,flexGrow:1,overflowY:`hidden`,children:t})]})]})}),i!=null&&(0,X.jsx)(Vt,{value:{rows:f-ki-1,columns:p-4,scrollRef:a??null},children:(0,X.jsxs)(R,{position:`absolute`,bottom:0,left:0,right:0,maxHeight:f-ki,flexDirection:`column`,overflow:`hidden`,opaque:!0,children:[(0,X.jsx)(R,{flexShrink:0,children:(0,X.jsx)(z,{color:`permission`,children:`▔`.repeat(p)})}),(0,X.jsx)(R,{flexDirection:`column`,paddingX:2,flexShrink:0,overflow:`hidden`,children:i})]})})]})}return(0,X.jsxs)(X.Fragment,{children:[e,t,n,i]})}function Ti({count:e,onClick:t}){let[n,r]=(0,Y.useState)(!1);return(0,X.jsx)(R,{position:`absolute`,bottom:0,left:0,right:0,justifyContent:`center`,children:(0,X.jsx)(R,{onClick:t,onMouseEnter:()=>r(!0),onMouseLeave:()=>r(!1),children:(0,X.jsxs)(z,{backgroundColor:n?`userMessageBackgroundHover`:`userMessageBackground`,dimColor:!0,children:[` `,e>0?`${e} new ${mt(e,`message`)}`:`Jump to bottom`,` `,o.arrowDown,` `]})})})}function Ei({text:e,onClick:t}){let[n,r]=(0,Y.useState)(!1);return(0,X.jsx)(R,{flexShrink:0,width:`100%`,height:1,paddingRight:1,backgroundColor:n?`userMessageBackgroundHover`:`userMessageBackground`,onClick:t,onMouseEnter:()=>r(!0),onMouseLeave:()=>r(!1),children:(0,X.jsxs)(z,{color:`subtle`,wrap:`truncate-end`,children:[o.pointer,` `,e]})})}function Di(){let e=ui();return!e||e.suggestions.length===0?null:(0,X.jsx)(R,{position:`absolute`,bottom:`100%`,left:0,right:0,paddingX:2,paddingTop:1,flexDirection:`column`,opaque:!0,children:(0,X.jsx)(It,{suggestions:e.suggestions,selectedSuggestion:e.selectedSuggestion,maxColumnWidth:e.maxColumnWidth,overlay:!0})})}function Oi(){let e=di();return e?(0,X.jsx)(R,{position:`absolute`,bottom:`100%`,left:0,right:0,opaque:!0,children:e}):null}var Y,X,ki,Ai,ji=t((()=>{a(),Y=n(B(),1),Bt(),yi(),xe(),V(),fe(),s(),ht(),zr(),Lt(),X=H(),ki=2,Ai=(0,Y.createContext)({setStickyPrompt:()=>{}})}));function Mi(e){let t=Bi.get(e);if(t!==void 0)return t;let n=_n(e);return Bi.set(e,n),n}function Ni(e){let t=Hi.get(e);if(t!==void 0)return t;let n=Pi(e);return Hi.set(e,n),n}function Pi(e){let t=null;if(e.type===`user`){if(e.isMeta||e.isVisibleInTranscriptOnly)return null;let n=e.message.content[0];if(n?.type!==`text`)return null;t=n.text??null}else if(e.type===`attachment`&&e.attachment.type===`queued_command`&&e.attachment.commandMode!==`task-notification`&&!e.attachment.isMeta){let n=e.attachment.prompt;t=typeof n==`string`?n:n.flatMap(e=>e.type===`text`?[e.text??``]:[]).join(`
11
+ `)}if(t===null)return null;let n=u(t);return n.startsWith(`<`)||n===``?null:n}function Fi({itemKey:e,msg:t,idx:n,measureRef:r,expanded:i,hovered:a,clickable:o,onClickK:s,onEnterK:c,onLeaveK:l,renderItem:u}){return(0,Ri.jsx)(R,{ref:r(e),flexDirection:`column`,backgroundColor:i?`userMessageBackgroundHover`:void 0,paddingBottom:i?1:void 0,onClick:o?e=>s(t,e.cellIsBlank):void 0,onMouseEnter:o?()=>c(e):void 0,onMouseLeave:o?()=>l(e):void 0,children:(0,Ri.jsx)(Fe.Provider,{value:a&&!i?`text`:void 0,children:u(t,n)})})}function Ii({messages:e,scrollRef:t,columns:n,itemKey:r,renderItem:i,onItemClick:a,isItemClickable:o,isItemExpanded:s,extractSearchText:c=Mi,trackStickyPrompt:l,selectedIndex:u,cursorNavRef:d,setCursor:f,jumpRef:p,onSearchMatchesChange:m,scanElement:h,setPositions:g}){let _=(0,Z.useRef)([]),v=(0,Z.useRef)(e),y=(0,Z.useRef)(r);if(y.current!==r||e.length<_.current.length||e[0]!==v.current[0])_.current=e.map(e=>r(e));else for(let t=_.current.length;t<e.length;t++)_.current.push(r(e[t]));v.current=e,y.current=r;let b=_.current,{range:x,topSpacer:S,bottomSpacer:C,measureRef:w,spacerRef:T,offsets:E,getItemTop:D,getItemElement:te,getItemHeight:ne,scrollToIndex:re}=$r(t,b,n),[ie,ae]=x,oe=(0,Z.useCallback)(t=>ne(t)!==0&&ee(e[t]),[ne,e]);(0,Z.useImperativeHandle)(d,()=>{let n=e=>f?.({uuid:e.uuid,msgType:e.type,expanded:!1,toolName:je(e)?.name}),r=u??-1,i=(t,r,i=oe)=>{for(let a=t;a>=0&&a<e.length;a+=r)if(i(a))return n(e[a]),!0;return!1},a=t=>oe(t)&&e[t].type===`user`;return{enterCursor:()=>i(e.length-1,-1,a),navigatePrev:()=>i(r-1,-1),navigateNext:()=>{i(r+1,1)||(t.current?.scrollToBottom(),f?.(null))},navigatePrevUser:()=>i(r-1,-1,a),navigateNextUser:()=>i(r+1,1,a),navigateTop:()=>i(0,1),navigateBottom:()=>i(e.length-1,-1),getSelected:()=>r>=0?e[r]??null:null}},[e,u,f,oe]);let O=(0,Z.useRef)({offsets:E,start:ie,getItemElement:te,getItemTop:D,messages:e,scrollToIndex:re});O.current={offsets:E,start:ie,getItemElement:te,getItemTop:D,messages:e,scrollToIndex:re},(0,Z.useEffect)(()=>{if(u===void 0)return;let e=O.current,n=e.getItemElement(u);n?t.current?.scrollToElement(n,1):e.scrollToIndex(u)},[u,t]);let k=(0,Z.useRef)(null),A=(0,Z.useRef)({msgIdx:-1,positions:[]}),j=(0,Z.useRef)(-1),se=(0,Z.useRef)(0),ce=(0,Z.useRef)(0),le=(0,Z.useRef)(()=>{}),M=(0,Z.useRef)(()=>{}),ue=(0,Z.useRef)({matches:[],ptr:0,screenOrd:0,prefixSum:[]}),de=(0,Z.useRef)(-1),N=(0,Z.useRef)(!1);function fe(e){let t=O.current.getItemTop(e);return Math.max(0,t-zi)}function pe(e){let n=t.current,{msgIdx:r,positions:i}=A.current;if(!n||i.length===0||r<0){g?.(null);return}let a=Math.max(0,Math.min(e,i.length-1)),o=i[a],s=O.current.getItemTop(r),c=n.getViewportTop(),l=s-n.getScrollTop(),u=n.getViewportHeight(),d=c+l+o.row;(d<c||d>=c+u)&&(n.scrollTo(Math.max(0,s+o.row-zi)),l=s-n.getScrollTop(),d=c+l+o.row),g?.({positions:i,rowOffset:c+l,currentIdx:a});let f=ue.current,p=f.prefixSum.at(-1)??0,h=(f.prefixSum[f.ptr]??0)+a+1;m?.(p,h),Ye(`highlight(i=${r}, ord=${a}/${i.length}): pos={row:${o.row},col:${o.col}} lo=${l} screenRow=${d} badge=${h}/${p}`)}M.current=pe;let[me,he]=(0,Z.useState)(0),P=(0,Z.useCallback)(()=>he(e=>e+1),[]);(0,Z.useEffect)(()=>{let e=k.current;if(!e)return;let{idx:n,wantLast:r,tries:i}=e,a=t.current;if(!a)return;let{getItemElement:o,getItemTop:s,scrollToIndex:c}=O.current,l=o(n),u=l?.yogaNode?.getComputedHeight()??0;if(!l||u===0){if(i>1){k.current=null,Ye(`seek(i=${n}): no mount after scrollToIndex, skip`),le.current(r?-1:1);return}k.current={idx:n,wantLast:r,tries:i+1},c(n),P();return}k.current=null,a.scrollTo(Math.max(0,s(n)-zi));let d=h?.(l)??[];if(A.current={msgIdx:n,positions:d},Ye(`seek(i=${n} t=${i}): ${d.length} positions`),d.length===0){if(++se.current>20){se.current=0;return}le.current(r?-1:1);return}se.current=0;let f=r?d.length-1:0;ue.current.screenOrd=f,j.current=-1,M.current(f);let p=ce.current;p&&(ce.current=0,le.current(p))},[me]);function ge(e,n){let r=t.current;if(!r)return;let i=O.current,{getItemElement:a,scrollToIndex:o}=i;if(e<0||e>=i.messages.length)return;g?.(null),A.current={msgIdx:-1,positions:[]},k.current={idx:e,wantLast:n,tries:0};let s=a(e),c=s?.yogaNode?.getComputedHeight()??0;s&&c>0?r.scrollTo(fe(e)):o(e),P()}function _e(e){let t=ue.current,{matches:n,prefixSum:r}=t,i=r.at(-1)??0;if(n.length===0)return;if(k.current){ce.current=e;return}j.current<0&&(j.current=t.ptr);let{positions:a}=A.current,o=t.screenOrd+e;if(o>=0&&o<a.length){t.screenOrd=o,pe(o),j.current=-1;return}let s=(t.ptr+e+n.length)%n.length;if(s===j.current){g?.(null),j.current=-1,Ye(`step: wraparound at ptr=${s}, all ${n.length} msgs phantoms`);return}t.ptr=s,t.screenOrd=0,ge(n[s],e<0);let c=e<0?r[s+1]??i:r[s]+1;m?.(i,c)}le.current=_e,(0,Z.useImperativeHandle)(p,()=>({jumpToIndex:e=>{let n=t.current;n&&n.scrollTo(fe(e))},setSearchQuery:e=>{k.current=null,A.current={msgIdx:-1,positions:[]},j.current=-1,g?.(null);let n=e.toLowerCase(),r=[],i=[0];if(n){let e=O.current.messages;for(let t=0;t<e.length;t++){let a=c(e[t]),o=a.indexOf(n),s=0;for(;o>=0;)s++,o=a.indexOf(n,o+n.length);s>0&&(r.push(t),i.push(i.at(-1)+s))}}let a=i.at(-1),o=0,s=t.current,{offsets:l,start:u,getItemTop:d}=O.current,f=d(u),p=f>=0?f-l[u]:0;if(r.length>0&&s){let t=de.current>=0?de.current:s.getScrollTop(),n=1/0;for(let e=0;e<r.length;e++){let i=Math.abs(p+l[r[e]]-t);i<=n&&(n=i,o=e)}Ye(`setSearchQuery('${e}'): ${r.length} msgs · ptr=${o} msgIdx=${r[o]} curTop=${t} origin=${p}`)}ue.current={matches:r,ptr:o,screenOrd:0,prefixSum:i},r.length>0?ge(r[o],!0):de.current>=0&&s&&s.scrollTo(de.current),m?.(a,r.length>0?i[o+1]??a:0)},nextMatch:()=>_e(1),prevMatch:()=>_e(-1),setAnchor:()=>{let e=t.current;e&&(de.current=e.getScrollTop())},disarmSearch:()=>{g?.(null),k.current=null,A.current={msgIdx:-1,positions:[]},j.current=-1},warmSearchIndex:async()=>{if(N.current)return 0;let e=O.current.messages,t=0,n=performance.now();for(let n=0;n<e.length;n+=500){await Tt(0);let r=performance.now(),i=Math.min(n+500,e.length);for(let t=n;t<i;t++)c(e[t]);t+=performance.now()-r}let r=Math.round(performance.now()-n);return Ye(`warmSearchIndex: ${e.length} msgs · work=${Math.round(t)}ms wall=${r}ms chunks=${Math.ceil(e.length/500)}`),N.current=!0,Math.round(t)}}),[t]);let[ve,ye]=(0,Z.useState)(null),be=(0,Z.useRef)({onItemClick:a,setHoveredKey:ye});be.current={onItemClick:a,setHoveredKey:ye};let xe=(0,Z.useCallback)((e,t)=>{let n=be.current;!t&&n.onItemClick&&n.onItemClick(e)},[]),F=(0,Z.useCallback)(e=>{be.current.setHoveredKey(e)},[]),Se=(0,Z.useCallback)(e=>{be.current.setHoveredKey(t=>t===e?null:t)},[]);return(0,Ri.jsxs)(Ri.Fragment,{children:[(0,Ri.jsx)(R,{ref:T,height:S,flexShrink:0}),e.slice(ie,ae).map((e,t)=>{let n=ie+t,r=b[n],c=!!a&&(o?.(e)??!0),l=c&&ve===r,u=s?.(e);return(0,Ri.jsx)(Fi,{itemKey:r,msg:e,idx:n,measureRef:w,expanded:u,hovered:l,clickable:c,onClickK:xe,onEnterK:F,onLeaveK:Se,renderItem:i},r)}),C>0&&(0,Ri.jsx)(R,{height:C,flexShrink:0}),l&&(0,Ri.jsx)(Li,{messages:e,start:ie,end:ae,offsets:E,getItemTop:D,getItemElement:te,scrollRef:t})]})}function Li({messages:e,start:t,end:n,offsets:r,getItemTop:i,getItemElement:a,scrollRef:o}){let{setStickyPrompt:s}=(0,Z.useContext)(Ai);(0,Z.useSyncExternalStore)((0,Z.useCallback)(e=>o.current?.subscribe(e)??Ui,[o]),()=>{let e=o.current;if(!e)return NaN;let t=e.getScrollTop()+e.getPendingDelta();return e.isSticky()?-1-t:t});let c=o.current?.isSticky()??!0,l=Math.max(0,(o.current?.getScrollTop()??0)+(o.current?.getPendingDelta()??0)),u=t,d=-1;for(let e=n-1;e>=t;e--){let t=i(e);if(t>=0){if(t<l)break;d=t}u=e}let f=-1,p=null;if(u>0&&!c)for(let t=u-1;t>=0;t--){let n=Ni(e[t]);if(n===null)continue;let r=i(t);if(!(r>=0&&r+1>=l)){f=t,p=n;break}}let m=d>=0?d-r[u]:0,h=f>=0?Math.max(0,m+r[f]):-1,g=(0,Z.useRef)({idx:-1,tries:0}),_=(0,Z.useRef)(`none`),v=(0,Z.useRef)(-1);return(0,Z.useEffect)(()=>{if(g.current.idx>=0)return;if(_.current===`armed`){_.current=`force`;return}let e=_.current===`force`;if(_.current=`none`,!e&&v.current===f)return;if(v.current=f,p===null){s(null);return}let t=p.trimStart(),n=t.search(/\n\s*\n/),r=(n>=0?t.slice(0,n):t).slice(0,Vi).replace(/\s+/g,` `).trim();if(r===``){s(null);return}let i=f,c=h;s({text:r,scrollTo:()=>{s(`clicked`),_.current=`armed`;let e=a(i);e?o.current?.scrollToElement(e,1):(o.current?.scrollTo(c),g.current={idx:i,tries:0})}})}),(0,Z.useEffect)(()=>{if(g.current.idx<0)return;let e=a(g.current.idx);e?(o.current?.scrollToElement(e,1),g.current={idx:-1,tries:0}):++g.current.tries>5&&(g.current={idx:-1,tries:0})}),null}var Z,Ri,zi,Bi,Vi,Hi,Ui,Wi=t((()=>{B(),Z=n(B(),1),ci(),V(),N(),ji(),Ri=H(),Je(),Ct(),wn(),Me(),zi=3,Bi=new WeakMap,Vi=500,Hi=new WeakMap,Ui=()=>{}}));function Gi(e,t){let n=new Set(t),r=new Set;return e.filter(e=>{if(e.type===`system`)return e.subtype!==`api_metrics`;let t=e.message?.content[0];if(e.type===`assistant`)return e.isApiErrorMessage?!0:t?.type===`tool_use`&&t.name&&n.has(t.name)?(`id`in t&&r.add(t.id),!0):!1;if(e.type===`user`)return t?.type===`tool_result`?t.tool_use_id!==void 0&&r.has(t.tool_use_id):!e.isMeta;if(e.type===`attachment`){let t=e.attachment;return t?.type===`queued_command`&&t.commandMode===`prompt`&&!t.isMeta&&t.origin===void 0}return!1})}function Ki(e,t){let n=new Set(t),r=new Set,i=[],a=0;for(let t=0;t<e.length;t++){let o=e[t],s=o.message?.content[0];if(o.type===`user`&&s?.type!==`tool_result`&&!o.isMeta){a++;continue}o.type===`assistant`&&(s?.type===`text`?i[t]=a:s?.type===`tool_use`&&s.name&&n.has(s.name)&&r.add(a))}return r.size===0?e:e.filter((e,t)=>{let n=i[t];return n===void 0||!r.has(n)})}function qi(e,t,n=ra,r=ia){let i=t.current,a=i?e.findIndex(e=>e.uuid===i.uuid):-1,o=a>=0?a:i?Math.min(i.idx,Math.max(0,e.length-n)):0;e.length-o>n+r&&(o=e.length-n);let s=e[o];return s&&(i?.uuid!==s.uuid||i.idx!==o)?t.current={uuid:s.uuid,idx:o}:!s&&i&&(t.current=null),o}function Ji(e){return(e.type===`assistant`||e.type===`user`?F(e):null)??e.uuid}function Yi(e,t){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}function Xi(e,t,n,r,i,a){if(i===`transcript`)return!0;switch(e.type){case`attachment`:case`user`:case`assistant`:{if(e.type===`assistant`){let t=e.message.content[0];if(t?.type===`server_tool_use`)return a.resolvedToolUseIDs.has(t.id)}let i=F(e);return i?t.has(i)||n.has(i)||ne(i,`PostToolUse`,a)?!1:rn(r,a.resolvedToolUseIDs):!0}case`system`:return e.subtype!==`api_error`;case`grouped_tool_use`:return e.messages.every(e=>{let t=e.message.content[0];return t?.type===`tool_use`&&a.resolvedToolUseIDs.has(t.id)});case`collapsed_read_search`:return!1;default:return!0}}var Zi,Q,$,Qi,$i,ea,ta,na,ra,ia,aa,oa,sa=t((()=>{Re(),Zi=n(B(),1),Q=n(B(),1),an(),Ge(),$e(),xe(),V(),d(),Et(),Ne(),cn(),dn(),M(),it(),i(),s(),gn(),C(),ht(),wn(),br(),he(),Ir(),Me(),ge(),zr(),Ce(),Qr(),$=H(),Wi(),Qi=Zi.memo(function({agentDefinitions:e}){return(0,$.jsx)(P,{children:(0,$.jsxs)(R,{flexDirection:`column`,gap:1,children:[(0,$.jsx)(_r,{}),(0,$.jsx)(Zi.Suspense,{fallback:null,children:(0,$.jsx)(Jr,{agentDefinitions:e})})]})})}),$i=(Ot(),e(kt)),ea=null,ta=null,na=30,ra=200,ia=50,aa=({messages:e,tools:t,commands:n,verbose:i,toolJSX:a,toolUseConfirmQueue:o,inProgressToolUseIDs:s,isMessageSelectorVisible:c,conversationId:u,screen:d,streamingToolUses:f,showAllInTranscript:p=!1,agentDefinitions:h,hideLogo:g=!1,isLoading:_,hidePastThinking:y=!1,streamingThinking:S,streamingText:C,isBriefOnly:w=!1,unseenDivider:T,scrollRef:ee,trackStickyPrompt:te,jumpRef:ne,onSearchMatchesChange:re,scanElement:ie,setPositions:ae,disableRenderCap:O=!1,cursor:A=null,setCursor:j,cursorNavRef:se,renderRange:M})=>{let{columns:ue}=Ve(),de=x(`transcript:toggleShowAll`,`Transcript`,`Ctrl+E`),N=(0,Q.useMemo)(()=>_e(e).filter(Ee),[e]),fe=(0,Q.useMemo)(()=>S?S.isStreaming?!0:S.streamingEndedAt?Date.now()-S.streamingEndedAt<3e4:!1:!1,[S]),{lastThinkingBlockId:me,latestBashOutputUUID:he}=(0,Q.useMemo)(()=>{let e=null,t=null,n=y&&!fe;y&&fe&&(e=`streaming`);for(let r=N.length-1;r>=0;r--){let i=N[r];if(i?.type===`user`){let r=i.message.content;if(!t){for(let e of r)if(e.type===`text`){let n=e.text??``;if(n.startsWith(`<bash-stdout`)||n.startsWith(`<bash-stderr`)){t=i.uuid;break}}}n&&!e&&(r.some(e=>e.type===`tool_result`)||(e=`no-thinking`))}else if(i?.type===`assistant`&&n&&!e){let t=i.message.content;for(let n=t.length-1;n>=0;n--)if(t[n]?.type===`thinking`){e=`${i.uuid}:${n}`;break}}if(e!==null&&t)break}return y||(e=null),{lastThinkingBlockId:e,latestBashOutputUUID:t}},[N,y,fe]),P=(0,Q.useMemo)(()=>m(N),[N]),ge=(0,Q.useMemo)(()=>f.filter(e=>!s.has(e.contentBlock.id)&&!P.has(e.contentBlock.id)),[f,s,P]),ve=(0,Q.useMemo)(()=>ge.flatMap(e=>{let t=b({content:[e.contentBlock]});return t.uuid=v(e.contentBlock.id,0),_e([t])}),[ge]),ye=d===`transcript`,xe=(0,Q.useMemo)(()=>r(process.env.CLAUDE_CODE_DISABLE_VIRTUAL_SCROLL),[]),F=ee!=null&&!xe,Se=ye&&!p&&!F,Ce=(0,Q.useRef)(null),I=(0,Q.useRef)(null),{collapsed:Te,lookups:Oe,hasTruncatedMessages:je,hiddenMessageCount:Me}=(0,Q.useMemo)(()=>{let e=pe((i||ce()?N:D(N,{includeSnipped:!0})).filter(e=>e.type!==`progress`&&!Lr(e)&&De(e,ye)),ve),n=[ea,ta].filter(e=>e!==null),r=[ea].filter(e=>e!==null),a=n.length>0&&!ye?w?Gi(e,n):r.length>0?Ki(e,r):e:e,o=Se?a.slice(-30):a,s=Se&&a.length>na,{messages:c}=mn(o,t,i),u=sn(un(we(c,t)),i),d=Ae(N,o),f=(()=>{let e=o.at(-1);return e?.type===`assistant`?e.message?.id:void 0})(),p;if(I.current&&I.current.key===d)p=I.current.lookups;else if(I.current&&N.length>=I.current.normalizedCount&&o.length>=I.current.messageCount&&I.current.lastAssistantMsgId===f){let e=le(I.current.lookups,I.current.normalizedCount,I.current.messageCount,N,o);e?(p=e,I.current={key:d,lookups:p,normalizedCount:N.length,messageCount:o.length,lastAssistantMsgId:f}):(p=l(N,o),I.current={key:d,lookups:p,normalizedCount:N.length,messageCount:o.length,lastAssistantMsgId:f})}else p=l(N,o),I.current={key:d,lookups:p,normalizedCount:N.length,messageCount:o.length,lastAssistantMsgId:f};let m=e.length-na;return{collapsed:u,lookups:p,hasTruncatedMessages:s,hiddenMessageCount:m}},[i,N,ye,ve,Se,t,w]),Ne=(0,Q.useMemo)(()=>{let e=!F&&!O?qi(Te,Ce):0;return M?Te.slice(M[0],M[1]):e>0?Te.slice(e):Te},[Te,M,F,O]),L=(0,Q.useMemo)(()=>new Set(f.map(e=>e.contentBlock.id)),[f]),{dividerBeforeIndex:Fe,selectedIdx:Le}=(0,Q.useMemo)(()=>{if(!T&&!A)return{dividerBeforeIndex:-1,selectedIdx:-1};let e=-1,t=-1,n=T?.firstUnseenUuid.slice(0,24);for(let r=0;r<Ne.length;r++){let i=Ne[r];if(e===-1&&n&&i.uuid.slice(0,24)===n&&(e=r),t===-1&&A&&i.uuid===A.uuid&&(t=r),e!==-1&&t!==-1)break}return{dividerBeforeIndex:e,selectedIdx:t}},[T,A,Ne]),[Re,B]=(0,Q.useState)(()=>new Set),ze=(0,Q.useCallback)(e=>{let t=Ji(e);B(e=>{let n=new Set(e);return n.has(t)?n.delete(t):n.add(t),n})},[]),Be=(0,Q.useCallback)(e=>Re.size>0&&Re.has(Ji(e)),[Re]),V=(0,Q.useRef)(Oe);V.current=Oe;let Ue=(0,Q.useCallback)(e=>{if(e.type===`collapsed_read_search`)return!0;if(e.type===`assistant`){let t=e.message.content,n=Array.isArray(t)?t[0]:void 0;return n!=null&&E(n)&&n.type===`advisor_tool_result`&&n.content.type===`advisor_result`}if(e.type!==`user`)return!1;let n=e.message.content[0];if(n?.type!==`tool_result`||n.is_error||!e.toolUseResult)return!1;let r=V.current.toolUseByToolUseID.get(n.tool_use_id??``)?.name;return(r?Dt(t,r):void 0)?.isResultTruncated?.(e.toolUseResult)??!1},[t]),H=(!a||!!a.shouldContinueAnimation)&&!o.length&&!c,Ge=s.size>0,{progress:Ke}=Ie(),qe=(0,Q.useRef)(null),Je=rt().terminalProgressBarEnabled&&!We()&&!($i?.isProactiveActive()??!1);(0,Q.useEffect)(()=>{let e=Je?Ge?`indeterminate`:`completed`:null;qe.current!==e&&(qe.current=e,Ke(e))},[Ke,Je,Ge]),(0,Q.useEffect)(()=>()=>Ke(null),[Ke]);let Ye=(0,Q.useCallback)(e=>`${e.uuid}-${u}`,[u]),Xe=(e,r)=>{let a=r>0?Ne[r-1]?.type:void 0,o=e.type===`user`&&a===`user`,c=e.type===`collapsed_read_search`&&(!!C||Dr(Ne,r,t,L)),l=Ne.length-1-r>0,u=Ye(e),f=(0,$.jsx)(Fr,{message:e,isUserContinuation:o,hasContentAfter:c,tools:t,commands:n,verbose:i||Be(e)||A?.expanded===!0&&r===Le,inProgressToolUseIDs:s,streamingToolUseIDs:L,screen:d,canAnimate:H,lastThinkingBlockId:me,latestBashOutputUUID:he,columns:ue,isLoading:_,lookups:Oe,shouldCollapseDiffs:l},u),p=(0,$.jsx)(k.Provider,{value:r===Le,children:f},u);return T&&r===Fe?[(0,$.jsx)(R,{marginTop:1,children:(0,$.jsx)(Pe,{title:`${T.count} new ${mt(T.count,`message`)}`,width:ue,color:`inactive`})},`unseen-divider`),p]:p},Ze=(0,Q.useRef)(new WeakMap),Qe=(0,Q.useCallback)(e=>{let n=Ze.current.get(e);if(n!==void 0)return n;let r=_n(e);if(e.type===`user`&&e.toolUseResult&&Array.isArray(e.message.content)){let n=e.message.content.find(e=>e.type===`tool_result`);if(n&&`tool_use_id`in n){let i=Oe.toolUseByToolUseID.get(n.tool_use_id),a=(i&&Dt(t,i.name))?.extractSearchText?.(e.toolUseResult);a!==void 0&&(r=a)}}let i=r.toLowerCase();return Ze.current.set(e,i),i},[t,Oe]);return(0,$.jsxs)($.Fragment,{children:[!g&&!(M&&M[0]>0)&&(0,$.jsx)(Qi,{agentDefinitions:h}),je&&(0,$.jsx)(Pe,{title:`${de} to show ${He.bold(Me)} previous messages`,width:ue}),ye&&p&&Me>0&&!O&&(0,$.jsx)(Pe,{title:`${de} to hide ${He.bold(Me)} previous messages`,width:ue}),F?(0,$.jsx)(ke.Provider,{value:!0,children:(0,$.jsx)(Ii,{messages:Ne,scrollRef:ee,columns:ue,itemKey:Ye,renderItem:Xe,onItemClick:ze,isItemClickable:Ue,isItemExpanded:Be,trackStickyPrompt:te,selectedIndex:Le>=0?Le:void 0,cursorNavRef:se,setCursor:j,jumpRef:ne,onSearchMatchesChange:re,scanElement:ie,setPositions:ae,extractSearchText:Qe})}):Ne.flatMap(Xe),C&&!w&&(0,$.jsx)(R,{alignItems:`flex-start`,flexDirection:`row`,marginTop:1,width:`100%`,children:(0,$.jsxs)(R,{flexDirection:`row`,children:[(0,$.jsx)(R,{minWidth:2,children:(0,$.jsx)(z,{color:`text`,children:et})}),(0,$.jsx)(R,{flexDirection:`column`,children:(0,$.jsx)(be,{children:C})})]})}),fe&&S&&!w&&(0,$.jsx)(R,{marginTop:1,children:(0,$.jsx)(oe,{param:{type:`thinking`,thinking:S.thinking},addMargin:!1,isTranscriptMode:!0,verbose:i,hideInTranscript:!1})})]})},oa=Zi.memo(aa,(e,t)=>{let n=Object.keys(e);for(let r of n)if(!(r===`scrollRef`||r===`trackStickyPrompt`||r===`setCursor`||r===`cursorNavRef`||r===`jumpRef`||r===`onSearchMatchesChange`||r===`scanElement`||r===`setPositions`)&&e[r]!==t[r]){if(r===`streamingToolUses`){let n=e.streamingToolUses,r=t.streamingToolUses;if(n.length===r.length&&n.every((e,t)=>e.contentBlock===r[t]?.contentBlock))continue}if(r===`inProgressToolUseIDs`&&Yi(e.inProgressToolUseIDs,t.inProgressToolUseIDs))continue;if(r===`unseenDivider`){let n=e.unseenDivider,r=t.unseenDivider;if(n?.firstUnseenUuid===r?.firstUnseenUuid&&n?.count===r?.count)continue}if(r===`tools`){let n=e.tools,r=t.tools;if(n.length===r.length&&n.every((e,t)=>e.name===r[t]?.name))continue}return!1}return!0})}));export{ji as a,fi as c,Ci as i,pi as l,sa as n,bi as o,wi as r,yi as s,oa as t};
@@ -0,0 +1 @@
1
+ import{o as e}from"./rolldown-runtime-DaDcL9Zw.js";import{d as t,o as n}from"./envUtils-BDhHQY0-.js";import{Ew as r,Vu as i,bd as a,dd as o,fd as s,yd as c}from"./loadAgentsDir-CKSb56Gp.js";import{Gt as l,H as u,I as d,Lt as f,P as p,fi as m,kt as h,t as g}from"./src-P_wYS_NJ2.js";import{t as _}from"./jsx-runtime-Bb4Xn-E0.js";import{Gt as v,Jt as y}from"./settings-Xbq6AaD-.js";import{h as b,s as x}from"./config-D4G8_MqJ.js";import{n as S,r as C}from"./analytics-DJobLaWP.js";import{Bt as w,Ht as T,Sr as E,xr as D}from"./model-C2e73CJD.js";import{c as O,i as k,s as A}from"./terminalSetup-DTGm1Eo2.js";import{t as j}from"./WelcomeV2-BWF-cJOu.js";import{n as M,t as N}from"./useExitOnCtrlCDWithKeybindings-D2FvHieH.js";import{n as P,t as F}from"./ThemePicker-gAMqqD1P.js";import{n as I,t as L}from"./PressEnterToContinue-Dq0Imo9c.js";import{t as R}from"./ApproveApiKey-DHAbdwkC.js";n();var z=e(m(),1),B=_();S(),y(),b(),D(),w(),r(),k(),N(),g(),g(),i(),a(),s(),P(),I(),g();var V=(0,z.createContext)({marker:``});function H({children:e}){let{marker:t}=(0,z.useContext)(V);return(0,B.jsxs)(d,{gap:1,children:[(0,B.jsx)(p,{dimColor:!0,children:t}),(0,B.jsx)(d,{flexDirection:`column`,children:e})]})}g();var U=(0,z.createContext)({marker:``});function W({children:e}){let{marker:t}=(0,z.useContext)(U),n=0;for(let t of z.Children.toArray(e))!(0,z.isValidElement)(t)||t.type!==H||n++;let r=String(n).length;return(0,B.jsx)(d,{flexDirection:`column`,children:z.Children.map(e,(e,n)=>{if(!(0,z.isValidElement)(e)||e.type!==H)return e;let i=`${String(n+1).padStart(r)}.`,a=`${t}${i}`;return(0,B.jsx)(U.Provider,{value:{marker:a},children:(0,B.jsx)(V.Provider,{value:{marker:a},children:e})})})})}W.Item=H;var G=W;g();function K({onDone:e}){let[n,r]=(0,z.useState)(0),[i,a]=(0,z.useState)(!1),[s]=(0,z.useState)(()=>T()),[m,g]=u();(0,z.useEffect)(()=>{C(`tengu_began_setup`,{oauthEnabled:s})},[s]);function _(){if(n<N.length-1){let e=n+1;r(e),C(`tengu_onboarding_step`,{oauthEnabled:s,stepId:N[e]?.id})}else e()}function y(e){g(e),_()}let b=M(),S=(0,B.jsx)(d,{marginX:1,children:(0,B.jsx)(F,{onThemeSelect:y,showIntroText:!0,helpText:`To change this later, run /theme`,hideEscToCancel:!0,skipExitHandling:!0})}),w=(0,B.jsxs)(d,{flexDirection:`column`,gap:1,paddingLeft:1,children:[(0,B.jsx)(p,{bold:!0,children:`Before you start, keep in mind:`}),(0,B.jsx)(d,{flexDirection:`column`,width:70,children:(0,B.jsxs)(G,{children:[(0,B.jsxs)(G.Item,{children:[(0,B.jsx)(p,{children:`Always review changes before accepting`}),(0,B.jsxs)(p,{dimColor:!0,wrap:`wrap`,children:[`Claude can make mistakes — especially when running commands`,(0,B.jsx)(h,{}),`or editing files. You stay in control of every action.`,(0,B.jsx)(h,{})]})]}),(0,B.jsxs)(G.Item,{children:[(0,B.jsx)(p,{children:`Only use Claude Code on projects you trust`}),(0,B.jsxs)(p,{dimColor:!0,wrap:`wrap`,children:[`Untrusted code could contain prompt injection attacks.`,(0,B.jsx)(h,{}),(0,B.jsx)(f,{url:`https://code.claude.com/docs/en/security`})]})]})]})}),(0,B.jsx)(L,{})]}),D=(0,z.useMemo)(()=>{if(!process.env.ANTHROPIC_API_KEY||t())return``;let e=E(process.env.ANTHROPIC_API_KEY);if(x(e)===`new`)return e},[]);function k(e){e&&a(!0),_()}let N=[];N.push({id:`theme`,component:S}),D&&N.push({id:`api-key`,component:(0,B.jsx)(R,{customApiKeyTruncated:D,onDone:k})}),s&&N.push({id:`oauth`,component:(0,B.jsx)(q,{skip:i,onSkip:_,children:(0,B.jsx)(c,{onDone:_})})}),N.push({id:`security`,component:w}),O()&&N.push({id:`terminal-setup`,component:(0,B.jsxs)(d,{flexDirection:`column`,gap:1,paddingLeft:1,children:[(0,B.jsx)(p,{bold:!0,children:`Use Claude Code's terminal setup?`}),(0,B.jsxs)(d,{flexDirection:`column`,width:70,gap:1,children:[(0,B.jsxs)(p,{children:[`For the optimal coding experience, enable the recommended settings`,(0,B.jsx)(h,{}),`for your terminal:`,` `,v.terminal===`Apple_Terminal`?`Option+Enter for newlines and visual bell`:`Shift+Enter for newlines`]}),(0,B.jsx)(o,{options:[{label:`Yes, use recommended settings`,value:`install`},{label:`No, maybe later with /terminal-setup`,value:`no`}],onChange:e=>{e===`install`?A(m).catch(()=>{}).finally(_):_()},onCancel:()=>_()}),(0,B.jsx)(p,{dimColor:!0,children:b.pending?(0,B.jsxs)(B.Fragment,{children:[`Press `,b.keyName,` again to exit`]}):(0,B.jsx)(B.Fragment,{children:`Enter to confirm · Esc to skip`})})]})]})});let P=N[n],I=(0,z.useCallback)(()=>{n===N.length-1?e():_()},[n,N.length,s,e]),V=(0,z.useCallback)(()=>{_()},[n,N.length,s,e]);return l({"confirm:yes":I},{context:`Confirmation`,isActive:P?.id===`security`}),l({"confirm:no":V},{context:`Confirmation`,isActive:P?.id===`terminal-setup`}),(0,B.jsxs)(d,{flexDirection:`column`,children:[(0,B.jsx)(j,{}),(0,B.jsxs)(d,{flexDirection:`column`,marginTop:1,children:[P?.component,b.pending&&(0,B.jsx)(d,{padding:1,children:(0,B.jsxs)(p,{dimColor:!0,children:[`Press `,b.keyName,` again to exit`]})})]})]})}function q({skip:e,onSkip:t,children:n}){return(0,z.useEffect)(()=>{e&&t()},[e,t]),e?null:n}export{K as Onboarding};