@readmagic/workmate 0.0.17 → 0.0.19

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 (385) hide show
  1. package/dist/chunks/{AddWorkspaceDirectory-YAhnVwyN.js → AddWorkspaceDirectory-9FcHMKgX.js} +1 -1
  2. package/dist/chunks/AgentsMdExternalIncludesDialog-Bny8WDwC.js +1 -0
  3. package/dist/chunks/{AgentsMdExternalIncludesDialog-Ba4GYFl3.js → AgentsMdExternalIncludesDialog-DLnj3JQO.js} +1 -1
  4. package/dist/chunks/{App-mri25OrC.js → App-NkBqbDbC.js} +1 -1
  5. package/dist/chunks/ApproveApiKey-BKzkEkW-.js +1 -0
  6. package/dist/chunks/{ApproveApiKey-DCw6d7dm.js → ApproveApiKey-rgB6AsYD.js} +1 -1
  7. package/dist/chunks/BackgroundTasksDialog-CcViruUO.js +2 -0
  8. package/dist/chunks/{BypassPermissionsModeDialog-B5QBJTB4.js → BypassPermissionsModeDialog-D254L98G.js} +1 -1
  9. package/dist/chunks/{DiffDialog-Bd-DcTsK.js → DiffDialog-6Srcz3NW.js} +2 -2
  10. package/dist/chunks/Doctor-DYEdLRxR.js +1 -0
  11. package/dist/chunks/Doctor-DiNxlXfC.js +3 -0
  12. package/dist/chunks/ExitFlow-Bt2De110.js +2 -0
  13. package/dist/chunks/{Grove-CClEZT2e.js → Grove-DC4jyxeB.js} +1 -1
  14. package/dist/chunks/{HybridTransport-DyEuslQB.js → HybridTransport-DArmWb1V.js} +1 -1
  15. package/dist/chunks/{InvalidConfigDialog-Wyrk_cXR.js → InvalidConfigDialog-DFiB0Kzc.js} +1 -1
  16. package/dist/chunks/{InvalidSettingsDialog-Cr9fmSyh.js → InvalidSettingsDialog-BHNo2__T.js} +1 -1
  17. package/dist/chunks/MCPConnectionManager-CdpO2Tj9.js +1 -0
  18. package/dist/chunks/MCPToolListView-Ch4jOk_x.js +1 -0
  19. package/dist/chunks/{McpParsingWarnings-BF4np2Y3.js → McpParsingWarnings-D4UQ8Q2e.js} +1 -1
  20. package/dist/chunks/MessageSelector-BgsrdJur.js +3 -0
  21. package/dist/chunks/Messages-DB1pmDY_.js +10 -0
  22. package/dist/chunks/{Onboarding-BAJXV7Ay.js → Onboarding-BnjdTwci.js} +1 -1
  23. package/dist/chunks/{PromptInputFooterSuggestions-Cm4WN3qd.js → PromptInputFooterSuggestions-Chg9U-BC.js} +1 -1
  24. package/dist/chunks/{PromptInputHelpMenu-ESj8sOpK.js → PromptInputHelpMenu-C0ZSo12s.js} +1 -1
  25. package/dist/chunks/QueryEngine-bKlupZpA.js +1 -0
  26. package/dist/chunks/REPL-Cg8UXYpX.js +128 -0
  27. package/dist/chunks/REPL-yzvMFfaU.js +1 -0
  28. package/dist/chunks/RemoteSessionManager-CRWOHvKf.js +2 -0
  29. package/dist/chunks/{ResumeConversation-NSVT3gn7.js → ResumeConversation-Ld7tYLKO.js} +1 -1
  30. package/dist/chunks/{SSETransport-CDGMGrxN.js → SSETransport-pPrlSZNF.js} +1 -1
  31. package/dist/chunks/SearchExtraToolsTool-CdgQlm--.js +1 -0
  32. package/dist/chunks/Settings-CsOlPcIW.js +2 -0
  33. package/dist/chunks/{TeleportProgress-8cS6aHVO.js → TeleportProgress-Di-PMey7.js} +1 -1
  34. package/dist/chunks/{TeleportRepoMismatchDialog-B0epkMgp.js → TeleportRepoMismatchDialog-CDv1cbo-.js} +1 -1
  35. package/dist/chunks/{TeleportResumeWrapper-Bb14JeEk.js → TeleportResumeWrapper-Bmf13tGU.js} +1 -1
  36. package/dist/chunks/{ThemePicker-CnX8faYA.js → ThemePicker-B3AO3_jA.js} +1 -1
  37. package/dist/chunks/{TrustDialog-6wJF3W6K.js → TrustDialog-C0aiR_LU.js} +1 -1
  38. package/dist/chunks/{ValidationErrorsList-Cuq6W2yc.js → ValidationErrorsList-BfZ5gcIv.js} +1 -1
  39. package/dist/chunks/add-dir-w1Ay3861.js +1 -0
  40. package/dist/chunks/{agentDisplay-QqGqcHGz.js → agentDisplay-D01ZlnVX.js} +1 -1
  41. package/dist/chunks/agents-B_hUgPnR.js +101 -0
  42. package/dist/chunks/{agents-DFPEienW.js → agents-Bxenhf8S.js} +1 -1
  43. package/dist/chunks/allErrors-C_iHQOlK.js +1 -0
  44. package/dist/chunks/{api-B3Wnozaf.js → api-C5ULzZny.js} +1 -1
  45. package/dist/chunks/api-CB3e0De0.js +1 -0
  46. package/dist/chunks/auth-CsYEYXBO.js +1 -0
  47. package/dist/chunks/auth-CubXYcRl.js +1 -0
  48. package/dist/chunks/{auth-CQGJitIV.js → auth-DvcZHXGk.js} +1 -1
  49. package/dist/chunks/backgroundHousekeeping-BGKR5cdA.js +17 -0
  50. package/dist/chunks/backgroundHousekeeping-CykbtljP.js +1 -0
  51. package/dist/chunks/{banner-HfMnBd03.js → banner-BkUdig-T.js} +1 -1
  52. package/dist/chunks/{bg-DltfF1_K.js → bg-tGgpwpYx.js} +2 -2
  53. package/dist/chunks/branch-CqQxCSHG.js +2 -0
  54. package/dist/chunks/{break-cache-Cd1yQ-0h.js → break-cache-CcwOjTKt.js} +3 -3
  55. package/dist/chunks/bridgeConfig-Cp2x_wtE.js +1 -0
  56. package/dist/chunks/{bridgeConfig-B3mR0kJ0.js → bridgeConfig-MxsnEEPx.js} +1 -1
  57. package/dist/chunks/{bridgeMessaging-wZ5EKxW_.js → bridgeMessaging-Bx5pkkkx.js} +1 -1
  58. package/dist/chunks/bridgePointer-DfTOjgtX.js +1 -0
  59. package/dist/chunks/bridgeStatusUtil-B9EcQksI.js +1 -0
  60. package/dist/chunks/btw-DeznoRrw.js +1 -0
  61. package/dist/chunks/caches-BiVRgePi.js +1 -0
  62. package/dist/chunks/caches-CGzKSWiP.js +1 -0
  63. package/dist/chunks/{capacityWake-LRiPhPeM.js → capacityWake-BpP6c7x3.js} +1 -1
  64. package/dist/chunks/{ccrClient-EisctZbc.js → ccrClient-CimQTd0b.js} +1 -1
  65. package/dist/chunks/{claudeDesktop-CB3UCt7U.js → claudeDesktop-DPc_SaVn.js} +1 -1
  66. package/dist/chunks/{clear-BjtPf2Jb.js → clear-KvoD-lFN.js} +1 -1
  67. package/dist/chunks/{cliLaunch-xIVvtPZy.js → cliLaunch-DDtwAolw.js} +1 -1
  68. package/dist/chunks/{client-DNEVh6Wu.js → client-9uHzAmFH.js} +1 -1
  69. package/dist/chunks/client-BVal_QII.js +1 -0
  70. package/dist/chunks/{client-Bb2eZnuq.js → client-C_jBL1yC.js} +1 -1
  71. package/dist/chunks/client-CmnPWgLq.js +1 -0
  72. package/dist/chunks/client-Dd7CKMRX.js +1 -0
  73. package/dist/chunks/commands-CrzVgHxp.js +1 -0
  74. package/dist/chunks/{compact-w8AhLkr6.js → compact-Dgzve3dI.js} +2 -2
  75. package/dist/chunks/{config-BSkuQZNf.js → config-DRy1I12M.js} +2 -2
  76. package/dist/chunks/config-Df8jooTW.js +1 -0
  77. package/dist/chunks/{config-D78R57VA.js → config-e0Goy478.js} +1 -1
  78. package/dist/chunks/{context-Btn2JU2y.js → context-Dz-bbYCw.js} +1 -1
  79. package/dist/chunks/{context-noninteractive-044464Vs.js → context-noninteractive-ApbVPU86.js} +5 -5
  80. package/dist/chunks/context-noninteractive-m4O3VtG7.js +1 -0
  81. package/dist/chunks/conversation-BYBX07j8.js +1 -0
  82. package/dist/chunks/conversation-CJ-d0O-U.js +1 -0
  83. package/dist/chunks/{createSSHSession-C0KSI0fJ.js → createSSHSession-DOz_Ox1_.js} +1 -1
  84. package/dist/chunks/createSession-C_-ZEQT5.js +1 -0
  85. package/dist/chunks/{createSession-8ScCWTKb.js → createSession-yR87Rhiv.js} +1 -1
  86. package/dist/chunks/crossProjectResume-DNnZo3gU.js +40 -0
  87. package/dist/chunks/cwd-DLK3znO7.js +1 -0
  88. package/dist/chunks/cwd-Nh5IZNKO.js +1 -0
  89. package/dist/chunks/{datadog-BqINRWAW.js → datadog-DBgIEaEd.js} +1 -1
  90. package/dist/chunks/{debug-BQj6h99Q.js → debug-D58GQBDG.js} +1 -1
  91. package/dist/chunks/{debugUtils-B86DM1Sp.js → debugUtils-DXBRbwCE.js} +1 -1
  92. package/dist/chunks/{detached--wGwkuHX.js → detached-Biz-xhu0.js} +1 -1
  93. package/dist/chunks/{detectRepository-Qy3zKoyn.js → detectRepository-CDOJ-M7h.js} +1 -1
  94. package/dist/chunks/detectRepository-Cv9-k6dg.js +1 -0
  95. package/dist/chunks/{diff-CcrSQNvQ.js → diff-qOom_T1G.js} +1 -1
  96. package/dist/chunks/{directoryCompletion-i2oWpaUe.js → directoryCompletion-BDGcGDuv.js} +1 -1
  97. package/dist/chunks/doctor-CflXjqVK.js +1 -0
  98. package/dist/chunks/{entry-oVZ7Z59B.js → entry-EmOA7oWN.js} +4 -4
  99. package/dist/chunks/{esm-BZciQG9N.js → esm-DBMVQDVv.js} +1 -1
  100. package/dist/chunks/{execFileNoThrow-DYm1GeGn.js → execFileNoThrow-Bmb5HEFz.js} +1 -1
  101. package/dist/chunks/{execSyncWrapper-CqvQqke-.js → execSyncWrapper-C3ZFV9od.js} +1 -1
  102. package/dist/chunks/{exit-jikLI2Zh.js → exit-DDrAFCzE.js} +1 -1
  103. package/dist/chunks/{extraUsage-BT3in1Aj.js → extraUsage-DylXI7Fc.js} +1 -1
  104. package/dist/chunks/extractMemories-B_8wZpXA.js +1 -0
  105. package/dist/chunks/fast-4ajfJv-M.js +1 -0
  106. package/dist/chunks/{fast-CKhtBOx7.js → fast-BCkhj9Dq.js} +1 -1
  107. package/dist/chunks/{fetchModelList-DmaMgpa2.js → fetchModelList-BbjuFHQT.js} +1 -1
  108. package/dist/chunks/fetchModelList-V8_e2O1N.js +1 -0
  109. package/dist/chunks/{fileSuggestions-BfG3sbET.js → fileSuggestions-Ct7vKEpR.js} +2 -2
  110. package/dist/chunks/{firstPartyEventLogger-Q3fMF0BR.js → firstPartyEventLogger-CxUuXQhL.js} +2 -2
  111. package/dist/chunks/firstPartyEventLogger-YQm0DoVu.js +1 -0
  112. package/dist/chunks/flushGate-BZe_QwEz.js +1 -0
  113. package/dist/chunks/{gemini-L8Gj2B4H.js → gemini-8sSwOtEf.js} +1 -1
  114. package/dist/chunks/{generateSessionName-cAL5T7pG.js → generateSessionName-vT1khubt.js} +1 -1
  115. package/dist/chunks/{genericProcessUtils-Bbcbi11g.js → genericProcessUtils-6E7fB1dI.js} +1 -1
  116. package/dist/chunks/{git-DplvjXEY.js → git-By_J4XJL.js} +1 -1
  117. package/dist/chunks/git-zJCasBa6.js +1 -0
  118. package/dist/chunks/githubRepoPathMapping-CzgPGOHQ.js +1 -0
  119. package/dist/chunks/{goal-D-x2WXm7.js → goal-CznQA1n1.js} +1 -1
  120. package/dist/chunks/{grok-DtypRM4d.js → grok-cEzUsG-s.js} +1 -1
  121. package/dist/chunks/{grove-CSivzrhe.js → grove--HtQL4QZ.js} +1 -1
  122. package/dist/chunks/{help-DKZhC0lL.js → help-B6A_kDQA.js} +1 -1
  123. package/dist/chunks/hooks-CJY5Vfy6.js +1 -0
  124. package/dist/chunks/{hooks-D_afUDcs.js → hooks-CN5hLrhi.js} +2 -2
  125. package/dist/chunks/initReplBridge-BJhmlcVt.js +1 -0
  126. package/dist/chunks/install-DUOtI2Hq.js +1 -0
  127. package/dist/chunks/{instrumentation-IljwxX0V.js → instrumentation-DpgB3GFx.js} +4 -4
  128. package/dist/chunks/{job-N25KhSUu.js → job-DDoX1iFe.js} +1 -1
  129. package/dist/chunks/{jwtUtils-YCoZL0FW.js → jwtUtils-C_LG1txt.js} +1 -1
  130. package/dist/chunks/keybindings-BGTuYfk-.js +1 -0
  131. package/dist/chunks/{launchLocalMemory-DJsuNLIf.js → launchLocalMemory-CoWeLNeP.js} +1 -1
  132. package/dist/chunks/{launchOnboarding-CVvuxeH-.js → launchOnboarding-CTIBGSLV.js} +1 -1
  133. package/dist/chunks/{external-CEp-aPkt.js → lazySchema-DULtBUCI.js} +1 -1
  134. package/dist/chunks/{loadAgentsDir-CbtNPJV3.js → loadAgentsDir-DXOkUcW3.js} +587 -597
  135. package/dist/chunks/loadAgentsDir-Dxz1vp3F.js +1 -0
  136. package/dist/chunks/{loadPluginHooks-BxkDBFd6.js → loadPluginHooks-DrNVtTBq.js} +1 -1
  137. package/dist/chunks/loader-C33o_5kS.js +1 -0
  138. package/dist/chunks/localSearch-CCs5fOd_.js +1 -0
  139. package/dist/chunks/{localSearch-B5mTHBwK.js → localSearch-DnT21UkF.js} +1 -1
  140. package/dist/chunks/{log-BlJ7CcKG.js → log-CZ7ploQm.js} +1 -1
  141. package/dist/chunks/{logoV2Utils-D5nRpirL.js → logoUtils-YwL3izJt.js} +1 -1
  142. package/dist/chunks/{magicDocs-C9aIo4Oe.js → magicDocs-rxv0rR8E.js} +2 -2
  143. package/dist/chunks/{main-DeUt_aE2.js → main-BOvY4O6D.js} +30 -30
  144. package/dist/chunks/{main-Zh18lf2J.js → main-Blm02_Js.js} +2 -2
  145. package/dist/chunks/managedEnv-CpgCYISH.js +1 -0
  146. package/dist/chunks/managedEnv-CrnBYTtQ.js +1 -0
  147. package/dist/chunks/{mappers-Del1KoA7.js → mappers-DYtq2XVS.js} +1 -1
  148. package/dist/chunks/mcp-BPvcoKDY.js +1 -0
  149. package/dist/chunks/mcp-BfqsHRx0.js +2 -0
  150. package/dist/chunks/mcp-BoU3TNFs.js +6 -0
  151. package/dist/chunks/{memoize-_2f7NWDv.js → memoize-CumjjK2Q.js} +1 -1
  152. package/dist/chunks/memory-BPKRdkBb.js +1 -0
  153. package/dist/chunks/{mode-DPbrxU32.js → mode-CXpXux2s.js} +1 -1
  154. package/dist/chunks/model-CxPYKiW1.js +1 -0
  155. package/dist/chunks/model-Cxx3suBa.js +1 -0
  156. package/dist/chunks/model-aEJ54cMA.js +1 -0
  157. package/dist/chunks/{modelOptions-SMq3one0.js → modelOptions-BqBHEyiR.js} +1 -1
  158. package/dist/chunks/{nativeInstaller-DTJ4clp-.js → nativeInstaller-CaXwRpoR.js} +1 -1
  159. package/dist/chunks/omit-DZUxsClb.js +1 -0
  160. package/dist/chunks/onChangeAppState-qHXqufwy.js +1 -0
  161. package/dist/chunks/{openai-D9KvLMrj.js → openai-_FQ9EhuR.js} +2 -2
  162. package/dist/chunks/{panel-Bg_0PHE6.js → panel-CVd1dzYl.js} +1 -1
  163. package/dist/chunks/parser-Cq9X7HMP.js +1 -0
  164. package/dist/chunks/{parser-a2S_eFyE.js → parser-eVu-cTRs.js} +1 -1
  165. package/dist/chunks/partition-BgwHlPsO.js +1 -0
  166. package/dist/chunks/permissions-Dv5d5Nu3.js +3 -0
  167. package/dist/chunks/pidLock-CEhbTkBE.js +3 -0
  168. package/dist/chunks/{plan-dG2H4eQl.js → plan-DVPBW5OS.js} +1 -1
  169. package/dist/chunks/{platform-DVeTi9mp.js → platform-DMQxcm4K.js} +1 -1
  170. package/dist/chunks/plugin-Bh2eBwLW.js +17 -0
  171. package/dist/chunks/{pluginAutoupdate-B9W_vxOG.js → pluginAutoupdate-C2YbEHrP.js} +1 -1
  172. package/dist/chunks/{pluginBlocklist-BvdBsnJG.js → pluginBlocklist-B2NAKaB9.js} +1 -1
  173. package/dist/chunks/{pluginCliCommands-NKIgFTUF.js → pluginCliCommands-Cw5TrYYb.js} +1 -1
  174. package/dist/chunks/{pluginFlagging-C0PtAJEg.js → pluginFlagging-BDTgCYuC.js} +1 -1
  175. package/dist/chunks/pluginOperations-BBwGEdfC.js +2 -0
  176. package/dist/chunks/pluginStartupCheck-CHx379_R.js +1 -0
  177. package/dist/chunks/{pluginStartupCheck-p0njap1l.js → pluginStartupCheck-DhhMk3dA.js} +1 -1
  178. package/dist/chunks/{plugins-B9WBqOAW.js → plugins-r0h93GT_.js} +4 -4
  179. package/dist/chunks/pollConfig-2nFzv6Hy.js +1 -0
  180. package/dist/chunks/poorMode-BTIe8W_H.js +1 -0
  181. package/dist/chunks/poorMode-CKQfWf3S.js +1 -0
  182. package/dist/chunks/print-CDzhHi2F.js +14 -0
  183. package/dist/chunks/processBashCommand-DmdCAWOR.js +1 -0
  184. package/dist/chunks/processSlashCommand-B43TkiaI.js +5 -0
  185. package/dist/chunks/prompt-C50mDqWv.js +1 -0
  186. package/dist/chunks/{prompt-BRGC5U9Y.js → prompt-DEioJrx_.js} +17 -17
  187. package/dist/chunks/prompt-WGH9CcXh.js +1 -0
  188. package/dist/chunks/{promptEditor-CRIw6vJS.js → promptEditor-eJzbtNn4.js} +1 -1
  189. package/dist/chunks/{protocolHandler--eQQuSyx.js → protocolHandler-C-CFTcUJ.js} +1 -1
  190. package/dist/chunks/{proxy-C0j74LqT.js → proxy-BhIc7-mj.js} +1 -1
  191. package/dist/chunks/reconciler-DZP4dJJG.js +1 -0
  192. package/dist/chunks/refresh-vaY-Sr80.js +1 -0
  193. package/dist/chunks/{registerProtocol-DrWIX3Lb.js → registerProtocol-Xsq4ldwg.js} +1 -1
  194. package/dist/chunks/{reload-plugins-Cl6wvT6V.js → reload-plugins-m9CzoIxu.js} +1 -1
  195. package/dist/chunks/{remoteBridgeCore-DnFZoXaw.js → remoteBridgeCore-C4vSr1gp.js} +1 -1
  196. package/dist/chunks/remoteManagedSettings-6RAHPt_g.js +1 -0
  197. package/dist/chunks/{rename-CdzxOzN5.js → rename-DmauGVBX.js} +1 -1
  198. package/dist/chunks/{renderOptions-CkqTbz6d.js → renderOptions-D-aQZbzS.js} +1 -1
  199. package/dist/chunks/resume-ut_pBrLN.js +2 -0
  200. package/dist/chunks/{ripgrep-DsLUmulz.js → ripgrep-C3jtZL7k.js} +1 -1
  201. package/dist/chunks/ripgrep-CBUbn6Po.js +1 -0
  202. package/dist/chunks/{runtimeObserver-Dov-m2dl.js → runtimeObserver-C2vjqtCE.js} +2 -2
  203. package/dist/chunks/{runtimeObserver-CwtRE2cj.js → runtimeObserver-CSroopId.js} +1 -1
  204. package/dist/chunks/sandbox-adapter-CL0qdcxn.js +1 -0
  205. package/dist/chunks/{sandbox-toggle-DWCrG9zV.js → sandbox-toggle-BJKd1ZYk.js} +1 -1
  206. package/dist/chunks/searchExtraTools-ByWuNCGo.js +1 -0
  207. package/dist/chunks/{session-L5191BSn.js → session-DTin6hOR.js} +1 -1
  208. package/dist/chunks/sessionFileAccessHooks-DorzHolr.js +1 -0
  209. package/dist/chunks/sessionObserver-Dy6NFlzL.js +1 -0
  210. package/dist/chunks/{sessionObserver-DpY0DOjI.js → sessionObserver-iAJLH92a.js} +1 -1
  211. package/dist/chunks/{sessionState-BlbRQ3Y6.js → sessionState-DAcub-HK.js} +2 -2
  212. package/dist/chunks/sessionStorage-DItJMkwx.js +1 -0
  213. package/dist/chunks/{sessionTracing-DqVx8aFD.js → sessionTracing-Dvi520eN.js} +1 -1
  214. package/dist/chunks/{settings-CvhsRFaT.js → settings-3xZ0fsvE.js} +5 -5
  215. package/dist/chunks/settings-Crx1cI1u.js +1 -0
  216. package/dist/chunks/settingsSync-aHn3p-6J.js +1 -0
  217. package/dist/chunks/setup-CK3ybjjM.js +3 -0
  218. package/dist/chunks/{shadowedRuleDetection-Gerk3t93.js → shadowedRuleDetection-BL7dEv-u.js} +1 -1
  219. package/dist/chunks/{shellQuote-D3Ocv_U-.js → shellQuote-Ddgr1vif.js} +1 -1
  220. package/dist/chunks/{sideQuestion-RndkXExy.js → sideQuestion-Ct87yvOR.js} +1 -1
  221. package/dist/chunks/{sinks-CfzgqLH5.js → sinks-Bmn3li0M.js} +1 -1
  222. package/dist/chunks/sinks-QQ_6Op7q.js +1 -0
  223. package/dist/chunks/skillChangeDetector-Bco3UoeW.js +1 -0
  224. package/dist/chunks/{skillGapStore-CLxhWLyq.js → skillGapStore-MtlRyYmT.js} +2 -2
  225. package/dist/chunks/{skillLifecycle-CSNX2qOH.js → skillLifecycle-Drs6gEv9.js} +2 -2
  226. package/dist/chunks/{skillSearchPanel-CsQDjy_E.js → skillSearchPanel-DkvmjNaw.js} +3 -3
  227. package/dist/chunks/{skills-DM9ACPW-.js → skills-axToWEo0.js} +1 -1
  228. package/dist/chunks/{startupProfiler-2sjXZkIP.js → startupProfiler-CbzxVmbv.js} +1 -1
  229. package/dist/chunks/startupProfiler-uHetQush.js +1 -0
  230. package/dist/chunks/state-BStOuCh4.js +1 -0
  231. package/dist/chunks/{state-BPFYBqm1.js → state-D5D6QpTX.js} +1 -1
  232. package/dist/chunks/{stats-Dq-5qizS.js → stats-Ce15gc3E.js} +1 -1
  233. package/dist/chunks/status-3uevwSMo.js +1 -0
  234. package/dist/chunks/{status-C5v7KsX4.js → status-CGp4uRlH.js} +2 -2
  235. package/dist/chunks/{statusNoticeHelpers-BY_8pK19.js → statusNoticeHelpers-BrN_2q7H.js} +1 -1
  236. package/dist/chunks/{stringUtils-BjnclTLB.js → stringUtils-CKD8qDqx.js} +1 -1
  237. package/dist/chunks/switcher-99gm2vpe.js +1 -0
  238. package/dist/chunks/switcher-DJDxjLPQ.js +1 -0
  239. package/dist/chunks/syncCache-B3OVvp8K.js +1 -0
  240. package/dist/chunks/{tasks-qVyXOLBf.js → tasks-t5zT_D32.js} +1 -1
  241. package/dist/chunks/{teleport-Deq_ecN9.js → teleport-CvX_nUjQ.js} +1 -1
  242. package/dist/chunks/{templateJobs-CntPyct-.js → templateJobs-Bm8bovHx.js} +1 -1
  243. package/dist/chunks/{terminalSetup-DDvQ0K5e.js → terminalSetup-7PdC4fV5.js} +1 -1
  244. package/dist/chunks/{terminalSetup-JJiXmszo.js → terminalSetup-kWdZRKWq.js} +1 -1
  245. package/dist/chunks/{theme-DVWYzSct.js → theme-DzaSXOpQ.js} +1 -1
  246. package/dist/chunks/{tmux-g0cQ0Buz.js → tmux-CpGd0Aca.js} +1 -1
  247. package/dist/chunks/{toolEventObserver-BZn8ZJB5.js → toolEventObserver-C_nHI27x.js} +1 -1
  248. package/dist/chunks/toolPool-CgKK0K8f.js +1 -0
  249. package/dist/chunks/{trustedDevice-CdLAZK6m.js → trustedDevice-Bb7O8_tj.js} +1 -1
  250. package/dist/chunks/trustedDevice-C2gnF9Lc.js +1 -0
  251. package/dist/chunks/{types-BomO8WUz.js → types-APu4OCXJ.js} +2 -2
  252. package/dist/chunks/{udsClient-DSvRPCvR.js → udsClient-U7MEfYj7.js} +1 -1
  253. package/dist/chunks/{upstreamproxy-DYoLvdM9.js → upstreamproxy-CTOuotLO.js} +1 -1
  254. package/dist/chunks/{useExitOnCtrlCDWithKeybindings-YSWYVWk6.js → useExitOnCtrlCDWithKeybindings-D0uqGxGw.js} +1 -1
  255. package/dist/chunks/useMainLoopModel-BGPOmBkl.js +1 -0
  256. package/dist/chunks/useManagePlugins-ITVFO9dz.js +1 -0
  257. package/dist/chunks/{useMergedTools-B4qRVJ8b.js → useMergedTools-rQ19rFvH.js} +1 -1
  258. package/dist/chunks/{useSearchInput-DfUNYhqC.js → useSearchInput-CXTa-leH.js} +1 -1
  259. package/dist/chunks/useSettingsErrors-Xc6RYjYF.js +1 -0
  260. package/dist/chunks/{userAgent-CNPTS7ix.js → userAgent-CJ5Rp9kc.js} +1 -1
  261. package/dist/chunks/{util-6aJHnBQ_.js → util-CD3ar4of.js} +1 -1
  262. package/dist/chunks/validatePlugin-CxrlCKc1.js +1 -0
  263. package/dist/chunks/{vim-s-wmybpU.js → vim-BagKUX4j.js} +1 -1
  264. package/dist/chunks/{which-BR8YVCCW.js → which-BxQ1hpjp.js} +1 -1
  265. package/dist/chunks/{windowsPaths-BmXyrasP.js → windowsPaths-BdhjMYTm.js} +1 -1
  266. package/dist/chunks/windowsPaths-DtGZ83kH.js +1 -0
  267. package/dist/chunks/{workSecret-BUd8cQ6-.js → workSecret-CaM2yIJD.js} +1 -1
  268. package/dist/chunks/{workerRegistry-BwJ54Lzk.js → workerRegistry-BGJtgrko.js} +2 -2
  269. package/dist/chunks/worktree-CanG5GhE.js +1 -0
  270. package/dist/cli.js +1 -1
  271. package/package.json +1 -1
  272. package/dist/chunks/AgentsMdExternalIncludesDialog--D4BeNAN.js +0 -1
  273. package/dist/chunks/ApproveApiKey-lv4Sg0RR.js +0 -1
  274. package/dist/chunks/BackgroundTasksDialog-CZND8e_Z.js +0 -2
  275. package/dist/chunks/Doctor-C9t7udHN.js +0 -3
  276. package/dist/chunks/Doctor-V-JLC4e3.js +0 -1
  277. package/dist/chunks/ExitFlow-CShdrKmr.js +0 -2
  278. package/dist/chunks/MCPConnectionManager-BnUw0nYN.js +0 -1
  279. package/dist/chunks/MCPToolListView-CY2EezWF.js +0 -1
  280. package/dist/chunks/MessageSelector-Dtt2Sf65.js +0 -3
  281. package/dist/chunks/Messages-D5Uuapmf.js +0 -10
  282. package/dist/chunks/QueryEngine-B79JLwG4.js +0 -1
  283. package/dist/chunks/REPL-B7evbhvN.js +0 -1
  284. package/dist/chunks/REPL-cAXdORs2.js +0 -128
  285. package/dist/chunks/RemoteSessionManager-C5pAD0Lh.js +0 -2
  286. package/dist/chunks/SearchExtraToolsTool-CddjJcAH.js +0 -1
  287. package/dist/chunks/Settings-_b5Yxt_9.js +0 -2
  288. package/dist/chunks/add-dir-LLAv-rGS.js +0 -1
  289. package/dist/chunks/agents-C8wRUTNV.js +0 -101
  290. package/dist/chunks/allErrors-DUYYPpdH.js +0 -1
  291. package/dist/chunks/api-BAT--5sp.js +0 -1
  292. package/dist/chunks/auth-DaJXqwN5.js +0 -1
  293. package/dist/chunks/auth-DkhPycBL.js +0 -1
  294. package/dist/chunks/backgroundHousekeeping-Bjb_Jc7L.js +0 -17
  295. package/dist/chunks/backgroundHousekeeping-V-dg2j2E.js +0 -1
  296. package/dist/chunks/branch-BWq5ynjm.js +0 -2
  297. package/dist/chunks/bridgeConfig-D31i4BRi.js +0 -1
  298. package/dist/chunks/bridgePointer-CiHy2tTN.js +0 -1
  299. package/dist/chunks/bridgeStatusUtil-mvVQSVN-.js +0 -1
  300. package/dist/chunks/btw-XNgXHnNr.js +0 -1
  301. package/dist/chunks/caches-ByLjTvdy.js +0 -1
  302. package/dist/chunks/caches-ckqJ4Qso.js +0 -1
  303. package/dist/chunks/client-Bl43xcRk.js +0 -1
  304. package/dist/chunks/client-Pap_HyZZ.js +0 -1
  305. package/dist/chunks/client-zhozU2ws.js +0 -1
  306. package/dist/chunks/commands-BDhn7EPO.js +0 -1
  307. package/dist/chunks/config-CbAvTdZ7.js +0 -1
  308. package/dist/chunks/context-noninteractive-ulRLlYg5.js +0 -1
  309. package/dist/chunks/conversation-D08lU377.js +0 -1
  310. package/dist/chunks/conversation-a82khZ_n.js +0 -1
  311. package/dist/chunks/createSession-CnlPXXkA.js +0 -1
  312. package/dist/chunks/crossProjectResume-BCN462Wa.js +0 -40
  313. package/dist/chunks/cwd-Besi3Os3.js +0 -1
  314. package/dist/chunks/cwd-DpqwaYHw.js +0 -1
  315. package/dist/chunks/detectRepository-tRUoPOKy.js +0 -1
  316. package/dist/chunks/doctor-DRFDBrH1.js +0 -1
  317. package/dist/chunks/extractMemories-BsQU2bVO.js +0 -1
  318. package/dist/chunks/fast-B9vVL3sY.js +0 -1
  319. package/dist/chunks/fetchModelList-BeL40TyR.js +0 -1
  320. package/dist/chunks/firstPartyEventLogger-6GwZ6VLr.js +0 -1
  321. package/dist/chunks/flushGate-COa_KO98.js +0 -1
  322. package/dist/chunks/git-BaSq69E7.js +0 -1
  323. package/dist/chunks/githubRepoPathMapping-Px3_GeD1.js +0 -1
  324. package/dist/chunks/hooks-DvVuNKRx.js +0 -1
  325. package/dist/chunks/initReplBridge-sTaq4a0K.js +0 -1
  326. package/dist/chunks/install-BWe3Jz4M.js +0 -1
  327. package/dist/chunks/keybindings-DLEorhlY.js +0 -1
  328. package/dist/chunks/lazySchema-B4D4qJVE.js +0 -1
  329. package/dist/chunks/loadAgentsDir-D0gl_H2S.js +0 -1
  330. package/dist/chunks/localSearch-D3UrYUre.js +0 -1
  331. package/dist/chunks/managedEnv-ADMKY7-G.js +0 -1
  332. package/dist/chunks/managedEnv-CDxyrUw1.js +0 -1
  333. package/dist/chunks/mcp-Bh3MNBIj.js +0 -6
  334. package/dist/chunks/mcp-D7vMhEOV.js +0 -2
  335. package/dist/chunks/mcp-nnBVM5Lt.js +0 -1
  336. package/dist/chunks/memory-DtqQhHu8.js +0 -1
  337. package/dist/chunks/model-B50j-O5v.js +0 -1
  338. package/dist/chunks/model-DLG1nrnf.js +0 -1
  339. package/dist/chunks/model-DlLO7TSx.js +0 -1
  340. package/dist/chunks/omit-CMldTqqy.js +0 -1
  341. package/dist/chunks/onChangeAppState-EAnsmOuo.js +0 -1
  342. package/dist/chunks/parser-x-w3ikxt.js +0 -1
  343. package/dist/chunks/partition-B8Y4jvjW.js +0 -1
  344. package/dist/chunks/permissions-cDtIZRM1.js +0 -3
  345. package/dist/chunks/pidLock-Br3_YNi_.js +0 -3
  346. package/dist/chunks/plugin-CzQHuIlP.js +0 -17
  347. package/dist/chunks/pluginOperations-wUUdFpu9.js +0 -2
  348. package/dist/chunks/pluginStartupCheck-hDT6pEAd.js +0 -1
  349. package/dist/chunks/pollConfig-BgpfHQPJ.js +0 -1
  350. package/dist/chunks/poorMode-DD88nPJ4.js +0 -1
  351. package/dist/chunks/poorMode-wm2WkPF0.js +0 -1
  352. package/dist/chunks/print-G3DgPTxy.js +0 -14
  353. package/dist/chunks/processBashCommand-zLWgCRws.js +0 -1
  354. package/dist/chunks/processSlashCommand-BHBnHBjj.js +0 -5
  355. package/dist/chunks/prompt-Ct3Ryb3C.js +0 -1
  356. package/dist/chunks/prompt-TZJKyomz.js +0 -1
  357. package/dist/chunks/reconciler-DiU1RvGD.js +0 -1
  358. package/dist/chunks/refresh-DEXe3Lmx.js +0 -1
  359. package/dist/chunks/remoteManagedSettings-BboLJ46D.js +0 -1
  360. package/dist/chunks/resume-DgFXYWTN.js +0 -2
  361. package/dist/chunks/ripgrep-Di-2j8Ws.js +0 -1
  362. package/dist/chunks/sandbox-adapter-CtEngx-6.js +0 -1
  363. package/dist/chunks/searchExtraTools-zFMN5MqY.js +0 -1
  364. package/dist/chunks/sessionFileAccessHooks-C2VjT-PU.js +0 -1
  365. package/dist/chunks/sessionObserver-BuhXr3FP.js +0 -1
  366. package/dist/chunks/sessionStorage-CiYSwyY3.js +0 -1
  367. package/dist/chunks/settings-BgHApyGL.js +0 -1
  368. package/dist/chunks/settingsSync-BhlegQAU.js +0 -1
  369. package/dist/chunks/setup-DvnKMqDy.js +0 -3
  370. package/dist/chunks/sinks-Cf4vx9UX.js +0 -1
  371. package/dist/chunks/skillChangeDetector-BQx4xe_b.js +0 -1
  372. package/dist/chunks/startupProfiler-B2fyaBEa.js +0 -1
  373. package/dist/chunks/state-CsdHk8n-.js +0 -1
  374. package/dist/chunks/status-C3z0CSBw.js +0 -1
  375. package/dist/chunks/switcher-C9VsM-ip.js +0 -1
  376. package/dist/chunks/switcher-CnBKuiNp.js +0 -1
  377. package/dist/chunks/syncCache-Dff4hbz4.js +0 -1
  378. package/dist/chunks/toolPool-Dzp1ob3I.js +0 -1
  379. package/dist/chunks/trustedDevice-1Q4FTNyX.js +0 -1
  380. package/dist/chunks/useMainLoopModel-C1JRp4zE.js +0 -1
  381. package/dist/chunks/useManagePlugins-DfuI4Nhd.js +0 -1
  382. package/dist/chunks/useSettingsErrors-Bls74ocI.js +0 -1
  383. package/dist/chunks/validatePlugin-BajM6yNf.js +0 -1
  384. package/dist/chunks/windowsPaths-BybjGW7e.js +0 -1
  385. package/dist/chunks/worktree-BFP10vim.js +0 -1
@@ -1 +0,0 @@
1
- import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{$h as n,Ab as r,Ax as i,Cx as a,Db as o,Eb as s,Fb as c,Fx as l,GS as u,Gx as d,HS as f,Hx as p,Ib as m,Ix as h,KS as g,Lx as _,Nb as v,Ob as y,Ox as ee,Qh as te,Ux as b,VS as x,Vx as S,Xd as C,Xh as w,Yd as T,Zh as E,bT as D,gx as ne,jb as O,kx as re,ux as ie,wb as k,yT as A}from"./loadAgentsDir-CbtNPJV3.js";import{ai as j}from"./src-DL3w8VPk2.js";import{t as M}from"./jsx-runtime-Bb4Xn-E0.js";import{Wt as N,pt as P}from"./state-BPFYBqm1.js";import{P as F,R as ae,c as oe,i as se}from"./debug-BQj6h99Q.js";import{it as ce,nt as I}from"./settings-CvhsRFaT.js";import{c as L,l as R,o as z}from"./log-BlJ7CcKG.js";import{n as B,r as V}from"./analytics-DJobLaWP.js";import{o as H,t as U}from"./localSearch-B5mTHBwK.js";import{n as W,t as le}from"./omit-CMldTqqy.js";function G(e){let t=`plugin`in e?e.plugin:`no-plugin`;return`${e.type}:${e.source}:${t}`}function K(e,t){t.length!==0&&e(e=>{let n=new Set(e.plugins.errors.map(e=>G(e))),r=t.filter(e=>!n.has(G(e)));return r.length===0?e:{...e,plugins:{...e.plugins,errors:[...e.plugins.errors,...r]}}})}function ue(e,t=!1){let a=te(),c=E(e=>e.authVersion),d=E(e=>e.mcp.pluginReconnectKey),h=n(),g=(0,q.useRef)(new Map),{addNotification:w}=C(),T=(0,q.useRef)([]),O=(0,q.useRef)(null),A=(0,q.useCallback)(()=>{O.current=null;let e=T.current;e.length!==0&&(T.current=[],h(t=>{let n=t.mcp;for(let t of e){let{tools:e,commands:r,resources:i,...a}=t,o=a.type===`disabled`||a.type===`failed`?e??[]:e,s=a.type===`disabled`||a.type===`failed`?r??[]:r,c=a.type===`disabled`||a.type===`failed`?i??[]:i,l=I(a.name),u=n.clients.findIndex(e=>e.name===a.name)===-1?[...n.clients,a]:n.clients.map(e=>e.name===a.name?a:e),d=o===void 0?n.tools:[...D(n.tools,e=>e.name?.startsWith(l)),...o],f=s===void 0?n.commands:[...D(n.commands,e=>ie(e,a.name)),...s],p=c===void 0?n.resources:{...n.resources,...c.length>0?{[a.name]:c}:W(n.resources,a.name)};n={...n,clients:u,tools:d,commands:f,resources:p}}return{...t,mcp:n}}))},[h]),j=(0,q.useCallback)(e=>{T.current.push(e),O.current===null&&(O.current=setTimeout(A,16))},[A]),M=(0,q.useCallback)(({client:e,tools:t,commands:n,resources:r})=>{switch(j({...e,tools:t,commands:n,resources:r}),e.type){case`connected`:m(e.client,e.name,h),e.client.onclose=()=>{let t=e.config.type??`stdio`;if(k(e.name,e.config).catch(()=>{oe(`Failed to invalidate the server cache: ${e.name}`)}),_(e.name)){L(e.name,`Server is disabled, skipping automatic reconnection`);return}if(t!==`stdio`&&t!==`sdk`){let n=de(t);L(e.name,`${n} transport closed/disconnected, attempting automatic reconnection`);let r=g.current.get(e.name);r&&(clearTimeout(r),g.current.delete(e.name)),(async()=>{for(let t=1;t<=J;t++){if(_(e.name)){L(e.name,`Server disabled during reconnection, stopping retry`),g.current.delete(e.name);return}j({...e,type:`pending`,reconnectAttempt:t,maxReconnectAttempts:J});let r=Date.now();try{let i=await v(e.name,e.config),a=Date.now()-r;if(i.client.type===`connected`){L(e.name,`${n} reconnection successful after ${a}ms (attempt ${t})`),g.current.delete(e.name),M(i);return}if(L(e.name,`${n} reconnection attempt ${t} completed with status: ${i.client.type}`),t===J){L(e.name,`Max reconnection attempts (${J}) reached, giving up`),g.current.delete(e.name),M(i);return}}catch(i){let a=Date.now()-r;if(R(e.name,`${n} reconnection attempt ${t} failed after ${a}ms: ${i}`),t===J){L(e.name,`Max reconnection attempts (${J}) reached, giving up`),g.current.delete(e.name),j({...e,type:`failed`});return}}let i=Math.min(Y*2**(t-1),X);L(e.name,`Scheduling reconnection attempt ${t+1} in ${i}ms`),await new Promise(t=>{let n=setTimeout(t,i);g.current.set(e.name,n)})}})()}else j({...e,type:`failed`})},e.capabilities?.tools?.listChanged&&e.client.setNotificationHandler(u,async()=>{L(e.name,`Received tools/list_changed notification, refreshing tools`);try{let t=y.cache.get(e.name);y.cache.delete(e.name);let n=await y(e),r=n.length;t?t.then(e=>{V(`tengu_mcp_list_changed`,{type:`tools`,previousCount:e.length,newCount:r})},()=>{V(`tengu_mcp_list_changed`,{type:`tools`,newCount:r})}):V(`tengu_mcp_list_changed`,{type:`tools`,newCount:r}),j({...e,tools:n})}catch(t){R(e.name,`Failed to refresh tools after list_changed notification: ${F(t)}`)}}),e.capabilities?.prompts?.listChanged&&e.client.setNotificationHandler(x,async()=>{L(e.name,`Received prompts/list_changed notification, refreshing prompts`),V(`tengu_mcp_list_changed`,{type:`prompts`});try{s.cache.delete(e.name);let[t,n]=await Promise.all([s(e),Promise.resolve([])]);j({...e,commands:[...t,...n]}),U()}catch(t){R(e.name,`Failed to refresh prompts after list_changed notification: ${F(t)}`)}}),e.capabilities?.resources?.listChanged&&e.client.setNotificationHandler(f,async()=>{L(e.name,`Received resources/list_changed notification, refreshing resources`),V(`tengu_mcp_list_changed`,{type:`resources`});try{o.cache.delete(e.name);{let t=await o(e);j({...e,resources:t})}}catch(t){R(e.name,`Failed to refresh resources after list_changed notification: ${F(t)}`)}});break;case`needs-auth`:case`failed`:case`pending`:case`disabled`:break}},[j]),N=P();return(0,q.useEffect)(()=>{async function n(){let{servers:n,errors:r}=t?{servers:{},errors:[]}:await l(e),i={...n,...e};K(h,r),h(e=>{let{stale:t,...n}=ne(e.mcp,i);for(let e of t){let t=g.current.get(e.name);t&&(clearTimeout(t),g.current.delete(e.name)),e.type===`connected`&&(e.client.onclose=void 0,k(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:_(e)?`disabled`:`pending`,config:t}));return a.length===0&&t.length===0?e:{...e,mcp:{...e.mcp,...n,clients:[...n.clients,...a]}}})}n().catch(e=>{R(`useManageMCPConnections`,`Failed to initialize servers as pending: ${F(e)}`)})},[t,e,h,N,d]),(0,q.useEffect)(()=>{let n=!1;async function a(){let a;t||re()?a=Promise.resolve({}):(p(),a=b());let{servers:o,errors:s}=t?{servers:{},errors:[]}:await l(e,a);if(n)return;K(h,s);let c={...o,...e},u=Object.fromEntries(Object.entries(c).filter(([e])=>!_(e)));r(M,u).catch(e=>{R(`useManageMcpConnections`,`Failed to get MCP resources: ${F(e)}`)});let d={};if(!t){if(d=i(await a).allowed,n)return;if(Object.keys(d).length>0){let{servers:e}=ee(d,c);d=e}if(Object.keys(d).length>0){h(e=>{let t=new Set(e.mcp.clients.map(e=>e.name)),n=Object.entries(d).filter(([e])=>!t.has(e)).map(([e,t])=>({name:e,type:_(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(d).filter(([e])=>!_(e)));r(M,e).catch(e=>{R(`useManageMcpConnections`,`Failed to get claude.ai MCP resources: ${F(e)}`)})}}let f={...c,...d},m={enterprise:0,global:0,project:0,user:0,plugin:0,claudeai:0};for(let[e,t]of Object.entries(f))t.scope===`enterprise`?m.enterprise++:t.scope===`user`?m.global++:t.scope===`project`?m.project++:t.scope===`local`?m.user++:t.scope===`dynamic`?m.plugin++:t.scope===`claudeai`&&m.claudeai++;V(`tengu_mcp_servers`,{...m})}return a(),()=>{n=!0}},[t,e,M,h,c,N,d]),(0,q.useEffect)(()=>{let e=g.current;return()=>{for(let t of e.values())clearTimeout(t);e.clear(),O.current!==null&&(clearTimeout(O.current),O.current=null,A())}},[A]),{reconnectMcpServer:(0,q.useCallback)(async e=>{let t=a.getState().mcp.clients.find(t=>t.name===e);if(!t)throw Error(`MCP server ${e} not found`);let n=g.current.get(e);n&&(clearTimeout(n),g.current.delete(e));let r=await v(e,t.config);return M(r),r},[a,M]),toggleMcpServer:(0,q.useCallback)(async e=>{let t=a.getState().mcp.clients.find(t=>t.name===e);if(!t)throw Error(`MCP server ${e} not found`);if(t.type!==`disabled`){let n=g.current.get(e);n&&(clearTimeout(n),g.current.delete(e)),S(e,!1),t.type===`connected`&&await k(e,t.config),j({name:e,type:`disabled`,config:t.config})}else{S(e,!0),j({name:e,type:`pending`,config:t.config});let n=await v(e,t.config);M(n)}},[a,j,M])}}function de(e){switch(e){case`http`:return`HTTP`;case`ws`:case`ws-ide`:return`WebSocket`;default:return`SSE`}}var q,J,Y,X,fe=e((()=>{q=t(j(),1),N(),O(),H(),g(),le(),A(),B(),h(),se(),T(),w(),ae(),z(),c(),d(),ce(),a(),J=5,Y=1e3,X=3e4}));function pe(){let e=(0,Z.useContext)($);if(!e)throw Error(`useMcpReconnect must be used within MCPConnectionManager`);return e.reconnectMcpServer}function me(){let e=(0,Z.useContext)($);if(!e)throw Error(`useMcpToggleEnabled must be used within MCPConnectionManager`);return e.toggleMcpServer}function he({children:e,dynamicMcpConfig:t,isStrictMcpConfig:n}){let{reconnectMcpServer:r,toggleMcpServer:i}=ue(t,n),a=(0,Z.useMemo)(()=>({reconnectMcpServer:r,toggleMcpServer:i}),[r,i]);return(0,Q.jsx)($.Provider,{value:a,children:e})}var Z,Q,$,ge=e((()=>{Z=t(j(),1),fe(),Q=M(),$=(0,Z.createContext)(null)}));export{me as i,ge as n,pe as r,he as t};
@@ -1 +0,0 @@
1
- import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{n,t as r}from"./figures-5ThXQEtq.js";import{$h as i,Cx as a,Dp as o,Ix as s,Jb as c,Mu as l,Mx as u,Op as d,Pu as f,Qu as ee,Ub as te,Xh as p,Yb as ne,Zb as m,Zh as re,Zu as h,_x as g,aS as _,bx as v,cd as ie,dx as ae,hC as oe,hx as se,jb as y,ld as b,mx as ce,oS as le,wb as ue,xC as de,yx as fe}from"./loadAgentsDir-CbtNPJV3.js";import{D as x,H as pe,I as S,Lt as C,P as w,T,Wt as me,ai as E,dr as he,hn as ge,j as D,ot as _e,t as O,y as k}from"./src-DL3w8VPk2.js";import{t as A}from"./jsx-runtime-Bb4Xn-E0.js";import{P as ve,R as j}from"./debug-BQj6h99Q.js";import{et as M,it as N,tt as P}from"./settings-CvhsRFaT.js";import{c as ye,o as F}from"./log-BlJ7CcKG.js";import{n as I,r as L}from"./analytics-DJobLaWP.js";import{l as be,u as R}from"./oauth-D38aRTUb.js";import{l as xe,n as Se,o as z}from"./stringUtils-BjnclTLB.js";import{Pt as B,Tt as Ce}from"./model-DlLO7TSx.js";import{i as we,n as V,r as Te}from"./MCPConnectionManager-BnUw0nYN.js";import{n as Ee,t as H}from"./useExitOnCtrlCDWithKeybindings-YSWYVWk6.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)(S,{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((()=>{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:a,onComplete:s,borderless:c=!1}){let[u]=pe(),d=Ee(),{columns:f}=_e(),[p,h]=G.useState(!1),[_,v]=G.useState(null),oe=re(e=>e.mcp),y=i(),[b,de]=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?s?.(`Authentication successful. Connected to ${e.name}.`):t.client.type===`needs-auth`?s?.(`Authentication successful, but server still requires authentication. You may need to manually restart Work Mate.`):s?.(`Authentication successful, but server reconnection failed. You may need to manually restart Work Mate for the changes to take effect.`)}catch(t){L(`tengu_claudeai_mcp_auth_completed`,{success:!1}),s?.(Ae(t,e.name))}finally{O(!1)}},[Y,e.name,s]),X=G.useCallback(async()=>{await ue(e.name,{...e.config,scope:e.scope}),y(t=>{let n=t.mcp.clients.map(t=>t.name===e.name?{...t,type:`needs-auth`}:t),r=g(t.mcp.tools,e.name),i=ce(t.mcp.commands,e.name),a=se(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`,{}),s?.(`Disconnected from ${e.name}.`),F(!1),R(null),z(!1)},[e.name,e.config,e.scope,y,s]);me(`confirm:no`,()=>{k.current?.abort(),k.current=null,h(!1),de(null)},{context:`Confirmation`,isActive:p}),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),le(e)}if(e===`c`&&!B){let e=b||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=fe(oe.commands,e.name).length,Ie=we(),Le=G.useCallback(async()=>{let t=be().CLAUDE_AI_ORIGIN,n=Ce()?.organizationUuid,r;r=n&&e.config.type===`claudeai-proxy`&&e.config.id?`${t}/api/organizations/${n}/mcp/start-auth/${e.config.id.startsWith(`mcprs`)?`mcpsrv${e.config.id.slice(5)}`:e.config.id}?product_surface=${encodeURIComponent(process.env.CLAUDE_CODE_ENTRYPOINT||`cli`)}`:`${t}/settings/connectors`,N(r),j(!0),L(`tengu_claudeai_mcp_auth_started`,{}),await le(r)},[e.config]),Q=G.useCallback(()=>{F(!0),L(`tengu_claudeai_mcp_clear_auth_started`,{})},[]),Re=G.useCallback(async()=>{let t=e.client.type!==`disabled`;try{await Ie(e.name),e.config.type===`claudeai-proxy`&&L(`tengu_claudeai_mcp_toggle`,{new_state:t?`disabled`:`enabled`}),a()}catch(n){s?.(`Failed to ${t?`disable`:`enable`} MCP server '${e.name}': ${ve(n)}`)}},[e.client.type,e.config.type,e.name,Ie,a,s]),ze=G.useCallback(async()=>{if(e.config.type===`claudeai-proxy`)return;h(!0),v(null);let t=new AbortController;k.current=t;try{if(e.isAuthenticated&&e.config&&await m(e.name,e.config,{preserveStepUpState:!0}),e.config){await ne(e.name,e.config,de,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}.`;s?.(t)}else n.client.type===`needs-auth`?s?.(`Authentication successful, but server still requires authentication. You may need to manually restart Work Mate.`):(ye(e.name,`Reconnection failed after authentication`),s?.(`Authentication successful, but server reconnection failed. You may need to manually restart Work Mate for the changes to take effect.`))}}catch(e){e instanceof Error&&!(e instanceof te)&&v(e.message)}finally{h(!1),k.current=null,q(null),W(``)}},[e.isAuthenticated,e.config,e.name,s,Y,J]),Be=async()=>{e.config.type!==`claudeai-proxy`&&e.config&&(await m(e.name,e.config),L(`tengu_mcp_auth_config_clear`,{}),await ue(e.name,{...e.config,scope:e.scope}),y(t=>{let n=t.mcp.clients.map(t=>t.name===e.name?{...t,type:`failed`}:t),r=g(t.mcp.tools,e.name),i=ce(t.mcp.commands,e.name),a=se(t.mcp.resources,e.name);return{...t,mcp:{...t.mcp,clients:n,tools:r,commands:i,resources:a}}}),s?.(`Authentication cleared for ${e.name}.`))};if(p){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)(S,{flexDirection:`column`,gap:1,padding:1,children:[(0,K.jsxs)(w,{color:`claude`,children:[`Authenticating with `,e.name,`…`]}),(0,K.jsxs)(S,{children:[(0,K.jsx)(l,{}),(0,K.jsx)(w,{children:t})]}),b&&(0,K.jsxs)(S,{flexDirection:`column`,children:[(0,K.jsxs)(S,{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)(x,{shortcut:`c`,action:`copy`,parens:!0})})]}),(0,K.jsx)(C,{url:b})]}),p&&b&&Ne&&(0,K.jsxs)(S,{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)(S,{children:[(0,K.jsxs)(w,{dimColor:!0,children:[`URL `,`>`,` `]}),(0,K.jsx)(ie,{value:Oe,onChange:W,onSubmit:e=>{Ne(e.trim()),W(``)},cursorOffset:je,onChangeCursorOffset:Me,columns:f-8})]})]}),(0,K.jsx)(S,{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)(S,{flexDirection:`column`,gap:1,padding:1,children:[(0,K.jsxs)(w,{color:`claude`,children:[`Authenticating with `,e.name,`…`]}),(0,K.jsxs)(S,{children:[(0,K.jsx)(l,{}),(0,K.jsx)(w,{children:` A browser window will open for authentication`})]}),M&&(0,K.jsxs)(S,{flexDirection:`column`,children:[(0,K.jsxs)(S,{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)(x,{shortcut:`c`,action:`copy`,parens:!0})})]}),(0,K.jsx)(C,{url:M})]}),(0,K.jsxs)(S,{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)(o,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})})]})]});if(P)return(0,K.jsxs)(S,{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)(S,{flexDirection:`column`,children:[(0,K.jsxs)(S,{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)(x,{shortcut:`c`,action:`copy`,parens:!0})})]}),(0,K.jsx)(C,{url:I})]}),(0,K.jsxs)(S,{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)(o,{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)(S,{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)(o,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})})]})]})]});if(E)return(0,K.jsxs)(S,{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)(S,{children:[(0,K.jsx)(l,{}),(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)(S,{flexDirection:`column`,children:[(0,K.jsxs)(S,{flexDirection:`column`,paddingX:1,borderStyle:c?void 0:`round`,children:[(0,K.jsx)(S,{marginBottom:1,children:(0,K.jsxs)(w,{bold:!0,children:[Z,` MCP Server`]})}),(0,K.jsxs)(S,{flexDirection:`column`,gap:0,children:[(0,K.jsxs)(S,{children:[(0,K.jsx)(w,{bold:!0,children:`Status: `}),e.client.type===`disabled`?(0,K.jsxs)(w,{children:[D(`inactive`,u)(r.radioOff),` disabled`]}):e.client.type===`connected`?(0,K.jsxs)(w,{children:[D(`success`,u)(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`,u)(r.triangleUpOutline),` needs authentication`]}):(0,K.jsxs)(w,{children:[D(`error`,u)(r.cross),` failed`]})]}),e.transport!==`claudeai-proxy`&&(0,K.jsxs)(S,{children:[(0,K.jsx)(w,{bold:!0,children:`Auth: `}),J?(0,K.jsxs)(w,{children:[D(`success`,u)(r.tick),` authenticated`]}):(0,K.jsxs)(w,{children:[D(`error`,u)(r.cross),` not authenticated`]})]}),(0,K.jsxs)(S,{children:[(0,K.jsx)(w,{bold:!0,children:`URL: `}),(0,K.jsx)(w,{dimColor:!0,children:e.config.url})]}),(0,K.jsxs)(S,{children:[(0,K.jsx)(w,{bold:!0,children:`Config location: `}),(0,K.jsx)(w,{dimColor:!0,children:ae(e.scope)})]}),e.client.type===`connected`&&(0,K.jsx)(De,{serverToolsCount:t,serverPromptsCount:Fe,serverResourcesCount:oe.resources[e.name]?.length||0}),e.client.type===`connected`&&t>0&&(0,K.jsxs)(S,{children:[(0,K.jsx)(w,{bold:!0,children:`Tools: `}),(0,K.jsxs)(w,{dimColor:!0,children:[t,` tools`]})]})]}),_&&(0,K.jsx)(S,{marginTop:1,children:(0,K.jsxs)(w,{color:`error`,children:[`Error: `,_]})}),$.length>0&&(0,K.jsx)(S,{marginTop:1,children:(0,K.jsx)(ee,{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);s?.(n)}catch(t){e.config.type===`claudeai-proxy`&&L(`tengu_claudeai_mcp_reconnect`,{success:!1}),s?.(Ae(t,e.name))}finally{O(!1)}break;case`toggle-enabled`:await Re();break;case`back`:a();break}},onCancel:a})})]}),(0,K.jsx)(S,{marginTop:1,children:(0,K.jsx)(w,{dimColor:!0,italic:!0,children:d.pending?(0,K.jsxs)(K.Fragment,{children:[`Press `,d.keyName,` again to exit`]}):(0,K.jsxs)(T,{children:[(0,K.jsx)(x,{shortcut:`↑↓`,action:`navigate`}),(0,K.jsx)(x,{shortcut:`Enter`,action:`select`}),(0,K.jsx)(o,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]})})})]})}var G,K,Me=e((()=>{n(),G=t(E(),1),I(),R(),H(),de(),O(),oe(),c(),y(),V(),a(),p(),B(),_(),j(),F(),z(),d(),h(),f(),b(),Oe(),W(),K=A()}));function Ne({server:e,serverToolsCount:t,onViewTools:n,onCancel:i,onComplete:a,borderless:s=!1}){let[c]=pe(),d=Ee(),f=re(e=>e.mcp),te=Te(),p=we(),[ne,m]=(0,q.useState)(!1),h=q.useCallback(async()=>{let t=e.client.type!==`disabled`;try{await p(e.name),i()}catch(n){a(`Failed to ${t?`disable`:`enable`} MCP server '${e.name}': ${ve(n)}`)}},[e.client.type,e.name,p,i,a]),g=Se(String(e.name)),_=fe(f.commands,e.name).length,v=[];return e.client.type!==`disabled`&&t>0&&v.push({label:`View tools`,value:`tools`}),e.client.type!==`disabled`&&v.push({label:`Reconnect`,value:`reconnectMcpServer`}),v.push({label:e.client.type===`disabled`?`Enable`:`Disable`,value:`toggle-enabled`}),v.length===0&&v.push({label:`Back`,value:`back`}),ne?(0,J.jsxs)(S,{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)(S,{children:[(0,J.jsx)(l,{}),(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)(S,{flexDirection:`column`,children:[(0,J.jsxs)(S,{flexDirection:`column`,paddingX:1,borderStyle:s?void 0:`round`,children:[(0,J.jsx)(S,{marginBottom:1,children:(0,J.jsxs)(w,{bold:!0,children:[g,` MCP Server`]})}),(0,J.jsxs)(S,{flexDirection:`column`,gap:0,children:[(0,J.jsxs)(S,{children:[(0,J.jsx)(w,{bold:!0,children:`Status: `}),e.client.type===`disabled`?(0,J.jsxs)(w,{children:[D(`inactive`,c)(r.radioOff),` disabled`]}):e.client.type===`connected`?(0,J.jsxs)(w,{children:[D(`success`,c)(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`,c)(r.cross),` failed`]})]}),(0,J.jsxs)(S,{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)(S,{children:[(0,J.jsx)(w,{bold:!0,children:`Args: `}),(0,J.jsx)(w,{dimColor:!0,children:e.config.args.join(` `)})]}),(0,J.jsxs)(S,{children:[(0,J.jsx)(w,{bold:!0,children:`Config location: `}),(0,J.jsx)(w,{dimColor:!0,children:ae(u(e.name)?.scope??`dynamic`)})]}),e.client.type===`connected`&&(0,J.jsx)(De,{serverToolsCount:t,serverPromptsCount:_,serverResourcesCount:f.resources[e.name]?.length||0}),e.client.type===`connected`&&t>0&&(0,J.jsxs)(S,{children:[(0,J.jsx)(w,{bold:!0,children:`Tools: `}),(0,J.jsxs)(w,{dimColor:!0,children:[t,` tools`]})]})]}),v.length>0&&(0,J.jsx)(S,{marginTop:1,children:(0,J.jsx)(ee,{options:v,onChange:async t=>{if(t===`tools`)n();else if(t===`reconnectMcpServer`){m(!0);try{let{message:t}=ke(await te(e.name),e.name);a?.(t)}catch(t){a?.(Ae(t,e.name))}finally{m(!1)}}else t===`toggle-enabled`?await h():t===`back`&&i()},onCancel:i})})]}),(0,J.jsx)(S,{marginTop:1,children:(0,J.jsx)(w,{dimColor:!0,italic:!0,children:d.pending?(0,J.jsxs)(J.Fragment,{children:[`Press `,d.keyName,` again to exit`]}):(0,J.jsxs)(T,{children:[(0,J.jsx)(x,{shortcut:`↑↓`,action:`navigate`}),(0,J.jsx)(x,{shortcut:`Enter`,action:`select`}),(0,J.jsx)(o,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]})})})]})}var q,J,Y=e((()=>{n(),q=t(E(),1),H(),O(),s(),V(),a(),p(),j(),z(),d(),h(),f(),Oe(),W(),J=A()}));function Pe({tool:e,server:t,onBack:n}){let[r,i]=X.useState(``),a=P(e.name,t.name),s=M(e.userFacingName?e.userFacingName({}):a),c=e.isReadOnly?.({})??!1,l=e.isDestructive?.({})??!1,u=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:[s,c&&(0,Z.jsx)(w,{color:`success`,children:` [read-only]`}),l&&(0,Z.jsx)(w,{color:`error`,children:` [destructive]`}),u&&(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)(o,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`}),children:(0,Z.jsxs)(S,{flexDirection:`column`,children:[(0,Z.jsxs)(S,{children:[(0,Z.jsx)(w,{bold:!0,children:`Tool name: `}),(0,Z.jsx)(w,{dimColor:!0,children:a})]}),(0,Z.jsxs)(S,{children:[(0,Z.jsx)(w,{bold:!0,children:`Full name: `}),(0,Z.jsx)(w,{dimColor:!0,children:e.name})]}),r&&(0,Z.jsxs)(S,{flexDirection:`column`,marginTop:1,children:[(0,Z.jsx)(w,{bold:!0,children:`Description:`}),(0,Z.jsx)(w,{wrap:`wrap`,children:r})]}),e.inputJSONSchema?.properties&&Object.keys(e.inputJSONSchema.properties).length>0&&(0,Z.jsxs)(S,{flexDirection:`column`,marginTop:1,children:[(0,Z.jsx)(w,{bold:!0,children:`Parameters:`}),(0,Z.jsx)(S,{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(),d(),Z=A()}));function Ie({server:e,onSelectTool:t,onBack:n}){let r=re(e=>e.mcp.tools),i=Le.useMemo(()=>e.client.type===`connected`?v(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)(x,{shortcut:`↑↓`,action:`navigate`}),(0,Q.jsx)(x,{shortcut:`Enter`,action:`select`}),(0,Q.jsx)(o,{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)(ee,{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(),a(),p(),z(),d(),h(),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};
@@ -1,3 +0,0 @@
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{$u as a,Da as o,Ds as s,Fc as c,Ic as l,Iy as u,La as d,Lc as f,Ly as p,Mu as m,Pu as h,Qu as g,Sa as _,Ts as v,Ua as y,Va as b,Xh as x,Zh as S,bg as C,dn as w,ep as T,hC as E,hg as D,hn as O,iw as k,mg as A,nn as j,np as ee,pg as te,rw as M,tw as N,wa as P,ws as ne,xC as re,ya as F,za as ie,zc as I}from"./loadAgentsDir-CbtNPJV3.js";import{C as ae,Gt as oe,I as L,P as R,Wt as se,ai as ce,ot as le,t as ue}from"./src-DL3w8VPk2.js";import{t as de}from"./jsx-runtime-Bb4Xn-E0.js";import{Gn as fe,Wt as pe}from"./state-BPFYBqm1.js";import{Ln as z,Rn as me}from"./settings-CvhsRFaT.js";import{h as B,m as he,o as ge,q as _e,s as V,w as ve}from"./log-BlJ7CcKG.js";import{n as H,r as U}from"./analytics-DJobLaWP.js";import{b as ye,m as be,v as xe}from"./startupProfiler-2sjXZkIP.js";import{E as Se,T as Ce,c as we,d as Te,w as Ee}from"./sessionTracing-DqVx8aFD.js";import{n as De,t as Oe}from"./useExitOnCtrlCDWithKeybindings-YSWYVWk6.js";import*as W from"path";import{randomUUID as G}from"crypto";var K=t(ce(),1),q=de();ue(),pe(),_e(),he(),ge(),me(),H(),xe(),M(),u(),Ee(),T(),we(),f(),c(),s(),d(),O();function ke(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 Ae(e){let t=e.toLowerCase().trim();return t===`continue`||/\b(keep going|go on)\b/.test(t)}function je(e,t,n,r,i,a,o){let s=G();fe(s);let c=typeof e==`string`?e:e.find(e=>e.type===`text`)?.text||``;Te(c);let l=typeof e==`string`?e:e.findLast(e=>e.type===`text`)?.text||``;return l&&Ce(`user_prompt`,{prompt_length:String(l.length),prompt:Se(l),"prompt.id":s}),U(`tengu_input_prompt`,{is_negative:ke(c),is_keep_going:Ae(c)}),t.length>0?{messages:[_({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:[_({content:e,uuid:i,permissionMode:a,isMeta:o||void 0}),...r],shouldQuery:!0}}H(),d();async function Me({input:e,preExpansionInput:t,mode:n,setToolJSX:r,context:i,pastedContents:a,ideSelection:s,messages:c,setUserInputOnProcessing:l,uuid:u,isAlreadyProcessing:d,querySource:f,canUseTool:p,skipSlashCommands:m,bridgeOrigin:h,isMeta:g,skipAttachments:v,autonomy:y}){let b=typeof e==`string`?e:null,x=b?.startsWith(`/`)&&!m;n===`prompt`&&b!==null&&!g&&!x&&l?.(b),I(`query_process_user_input_base_start`);let S=i.getAppState(),C=await Pe(e,n,r,i,a,s,c,u,d,f,p,S.toolPermissionContext.mode,m,h,g,v,t,y);if(I(`query_process_user_input_base_end`),!C.shouldQuery)return C;I(`query_hooks_start`);let T=o(e)||``;for await(let t of j(T,S.toolPermissionContext.mode,i,i.requestPrompt))if(t.message?.type!==`progress`){if(t.blockingError)return{messages:[F(`${w(t.blockingError)}\n\nOriginal prompt: ${e}`,`warning`)],shouldQuery:!1,allowedTools:C.allowedTools};if(t.preventContinuation){let e=t.stopReason?`Operation stopped by hook: ${t.stopReason}`:`Operation stopped by hook`;return C.messages.push(_({content:e})),C.shouldQuery=!1,C}if(t.additionalContexts&&t.additionalContexts.length>0&&C.messages.push(ne({type:`hook_additional_context`,content:t.additionalContexts.map(Ne),hookName:`UserPromptSubmit`,toolUseID:`hook-${G()}`,hookEvent:`UserPromptSubmit`})),t.message)switch(t.message.attachment.type){case`hook_success`:if(!t.message.attachment.content)break;C.messages.push({...t.message,attachment:{...t.message.attachment,content:Ne(t.message.attachment.content)}});break;default:C.messages.push(t.message);break}}return I(`query_hooks_end`),C}var J=1e4;function Ne(e){return e.length>J?`${e.substring(0,J)}… [output truncated - exceeded ${J} characters]`:e}async function Pe(e,t,n,r,i,a,o,s,c,u,d,f,m,h,g,_,y,b){let x=null,S=[],C=[],w=e;if(typeof e==`string`)x=e;else if(e.length>0){I(`query_image_processing_start`);let t=[];for(let n of e)if(n.type===`image`){let e=await k(n);if(e.dimensions){let t=N(e.dimensions);t&&C.push(t)}t.push(e.block)}else t.push(n);w=t,I(`query_image_processing_end`);let n=t[t.length-1];n?.type===`text`?(x=n.text,S=t.slice(0,-1)):S=t}if(x===null&&t!==`prompt`)throw Error(`Mode: ${t} requires a string input.`);let T=i?Object.values(i).filter(p):[],E=T.map(e=>e.id),D=i?await ee(i):new Map;I(`query_pasted_image_processing_start`);let O=await Promise.all(T.map(async e=>{let t={type:`image`,source:{type:`base64`,media_type:e.mediaType||`image/png`,data:e.content}};return U(`tengu_pasted_image_resize_attempt`,{original_size_bytes:e.content.length}),{resized:await k(t),originalDimensions:e.dimensions,sourcePath:e.sourcePath??D.get(e.id)}})),A=[];for(let{resized:e,originalDimensions:t,sourcePath:n}of O){if(e.dimensions){let t=N(e.dimensions,n);t&&C.push(t)}else if(t){let e=N(t,n);e&&C.push(e)}else n&&C.push(`[Image source: ${n}]`);A.push(e.block)}I(`query_pasted_image_processing_end`);let j=m,te=!_&&x!==null&&(t!==`prompt`||j||!x.startsWith(`/`));I(`query_attachment_loading_start`);let M=te?await l(v(x,r,a??null,[],o,u)):[];if(I(`query_attachment_loading_end`),x!==null&&t===`bash`){let{processBashCommand:e}=await import(`./processBashCommand-zLWgCRws.js`);return Y(await e(x,S,M,r,n),C)}if(x!==null&&!j&&x.startsWith(`/`)){let{processSlashCommand:e}=await import(`./processSlashCommand-BHBnHBjj.js`);return Y(await e(x,S,A,M,r,n,s,c,d,b),C)}if(x!==null&&t===`prompt`){let e=x.trim(),t=M.find(e=>e.attachment.type===`agent_mention`);if(t){let n=`@agent-${t.attachment.agentType}`,r=e===n;U(`tengu_subagent_at_mention`,{is_subagent_only:r,is_prefix:e.startsWith(n)&&!r})}}return Y(je(w,A,E,M,s,f,g),C)}function Y(e,t){return t.length>0&&e.messages.push(_({content:t.map(e=>({type:`text`,text:e})),isMeta:!0})),e}var Fe=n({MessageSelector:()=>Z,messagesAfterAreOnlySynthetic:()=>Ue,selectableUserMessagesFilter:()=>Q});function Ie(e){return e.type===`text`}function X(e){return e===`summarize`}function Z({messages:e,onPreRestore:t,onRestoreMessage:n,onRestoreCode:r,onSummarize:a,onClose:o,preselectedMessage:s}){let c=S(e=>e.fileHistory),[l,u]=(0,K.useState)(void 0),d=A(),f=(0,K.useMemo)(G,[]),p=(0,K.useMemo)(()=>[...e.filter(Q),{..._({content:``}),uuid:f}],[e,f]),[h,v]=(0,K.useState)(p.length-1),y=Math.max(0,Math.min(h-Math.floor($/2),p.length-$)),b=p.length>1,[x,C]=(0,K.useState)(s),[w,T]=(0,K.useState)(void 0);(0,K.useEffect)(()=>{if(!s||!d)return;let e=!1;return D(c,s.uuid).then(t=>{e||T(t)}),()=>{e=!0}},[s,d,c]);let[E,O]=(0,K.useState)(!1),[k,j]=(0,K.useState)(null),[ee,M]=(0,K.useState)(`both`),[N,P]=(0,K.useState)(``);function ne(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:P}),t.push({value:`nevermind`,label:`Never mind`}),t}(0,K.useEffect)(()=>{U(`tengu_message_selector_opened`,{})},[]);async function re(e){t(),O(!0);try{await n(e),O(!1),o()}catch(e){V(e),O(!1),u(`Failed to restore the conversation:\n${e}`)}}async function F(t){let n=e.indexOf(t);if(U(`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(!d){await re(t);return}let r=await D(c,t.uuid);C(t),T(r)}async function ie(e){if(U(`tengu_message_selector_restore_option_selected`,{option:e}),!x){u(`Message not found.`);return}if(e===`nevermind`){s?o():C(void 0);return}if(X(e)){t(),O(!0),j(e),u(void 0);try{let e=N.trim()||void 0;await a(x,e,`from`),O(!1),j(null),C(void 0),o()}catch(e){V(e),O(!1),j(null),C(void 0),u(`Failed to summarize:\n${e}`)}return}t(),O(!0),u(void 0);let i=null,c=null;if(e===`code`||e===`both`)try{await r(x)}catch(e){i=e,V(i)}if(e===`conversation`||e===`both`)try{await n(x)}catch(e){c=e,V(c)}O(!1),C(void 0),c&&i?u(`Failed to restore the conversation and code:\n${c}\n${i}`):c?u(`Failed to restore the conversation:\n${c}`):i?u(`Failed to restore the code:\n${i}`):o()}let I=De(),ce=(0,K.useCallback)(()=>{if(x&&!s){C(void 0);return}U(`tengu_message_selector_cancelled`,{}),o()},[o,x,s]),le=(0,K.useCallback)(()=>v(e=>Math.max(0,e-1)),[]),ue=(0,K.useCallback)(()=>v(e=>Math.min(p.length-1,e+1)),[p.length]),de=(0,K.useCallback)(()=>v(0),[]),fe=(0,K.useCallback)(()=>v(p.length-1),[p.length]),pe=(0,K.useCallback)(()=>{let e=p[h];e&&F(e)},[p,h,F]);se(`confirm:no`,ce,{context:`Confirmation`,isActive:!x}),oe({"messageSelector:up":le,"messageSelector:down":ue,"messageSelector:top":de,"messageSelector:bottom":fe,"messageSelector:select":pe},{context:`MessageSelector`,isActive:!E&&!l&&!x&&b});let[z,me]=(0,K.useState)({});(0,K.useEffect)(()=>{async function t(){d&&Promise.all(p.map(async(t,n)=>{if(t.uuid!==f){let r=te(c,t.uuid),i=p.at(n+1),a=r?He(e,t.uuid,i?.uuid===f?void 0:i?.uuid):void 0;me(a===void 0?e=>({...e,[n]:void 0}):e=>({...e,[n]:a}))}}))}t()},[p,e,f,c,d]);let B=d&&w?.filesChanged&&w.filesChanged.length>0,he=!l&&!x&&!s&&b;return(0,q.jsxs)(L,{flexDirection:`column`,width:`100%`,children:[(0,q.jsx)(ae,{color:`suggestion`}),(0,q.jsxs)(L,{flexDirection:`column`,marginX:1,gap:1,children:[(0,q.jsx)(R,{bold:!0,color:`suggestion`,children:`Rewind`}),l&&(0,q.jsxs)(R,{color:`error`,children:[`Error: `,l]}),!b&&(0,q.jsx)(R,{children:`Nothing to rewind to yet.`}),!l&&x&&b&&(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(R,{children:[`Confirm you want to restore `,!w&&`the conversation `,`to the point before you sent this message:`]}),(0,q.jsxs)(L,{flexDirection:`column`,paddingLeft:1,borderStyle:`single`,borderRight:!1,borderTop:!1,borderBottom:!1,borderLeft:!0,borderLeftDimColor:!0,children:[(0,q.jsx)(Ve,{userMessage:x,color:`text`,isCurrent:!1}),(0,q.jsxs)(R,{dimColor:!0,children:[`(`,be(new Date(x.timestamp)),`)`]})]}),(0,q.jsx)(Re,{selectedRestoreOption:ee,canRestoreCode:!!B,diffStatsForRestore:w}),E&&X(k)?(0,q.jsxs)(L,{flexDirection:`row`,gap:1,children:[(0,q.jsx)(m,{}),(0,q.jsx)(R,{children:`Summarizing…`})]}):(0,q.jsx)(g,{isDisabled:E,options:ne(!!B),defaultFocusValue:B?`both`:`conversation`,onFocus:e=>M(e),onChange:e=>ie(e),onCancel:()=>s?o():C(void 0)}),B&&(0,q.jsx)(L,{marginBottom:1,children:(0,q.jsxs)(R,{dimColor:!0,children:[i.warning,` Rewinding does not affect files edited manually or via bash.`]})})]}),he&&(0,q.jsxs)(q.Fragment,{children:[d?(0,q.jsx)(R,{children:`Restore the code and/or conversation to the point before…`}):(0,q.jsx)(R,{children:`Restore and fork the conversation to the point before…`}),(0,q.jsx)(L,{width:`100%`,flexDirection:`column`,children:p.slice(y,y+$).map((e,t)=>{let n=y+t,r=n===h,a=e.uuid===f,o=n in z,s=z[n],c=s?.filesChanged?.length;return(0,q.jsxs)(L,{height:d?3:2,overflow:`hidden`,width:`100%`,flexDirection:`row`,children:[(0,q.jsx)(L,{width:2,minWidth:2,children:r?(0,q.jsxs)(R,{color:`permission`,bold:!0,children:[i.pointer,` `]}):(0,q.jsx)(R,{children:` `})}),(0,q.jsxs)(L,{flexDirection:`column`,children:[(0,q.jsx)(L,{flexShrink:1,height:1,overflow:`hidden`,children:(0,q.jsx)(Ve,{userMessage:e,color:r?`suggestion`:void 0,isCurrent:a,paddingRight:10})}),d&&o&&(0,q.jsx)(L,{height:1,flexDirection:`row`,children:s?(0,q.jsx)(R,{dimColor:!r,color:`inactive`,children:c?(0,q.jsxs)(q.Fragment,{children:[c===1&&s.filesChanged[0]?`${W.basename(s.filesChanged[0])} `:`${c} files changed `,(0,q.jsx)(Be,{diffStats:s})]}):(0,q.jsx)(q.Fragment,{children:`No code changes`})}):(0,q.jsxs)(R,{dimColor:!0,color:`warning`,children:[i.warning,` No code restore`]})})]})]},e.uuid)})})]}),!x&&(0,q.jsx)(R,{dimColor:!0,italic:!0,children:I.pending?(0,q.jsxs)(q.Fragment,{children:[`Press `,I.keyName,` again to exit`]}):(0,q.jsxs)(q.Fragment,{children:[!l&&b&&`Enter to continue · `,`Esc to exit`]})})]})]})}function Le(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 Re({selectedRestoreOption:e,canRestoreCode:t,diffStatsForRestore:n}){let r=t&&(e===`both`||e===`code`);return(0,q.jsxs)(L,{flexDirection:`column`,children:[(0,q.jsx)(R,{dimColor:!0,children:Le(e)}),!X(e)&&(r?(0,q.jsx)(ze,{diffStatsForRestore:n}):(0,q.jsx)(R,{dimColor:!0,children:`The code will be unchanged.`}))]})}function ze({diffStatsForRestore:e}){if(e===void 0)return;if(!e.filesChanged?.[0])return(0,q.jsx)(R,{dimColor:!0,children:`The code has not changed (nothing will be restored).`});let t=e.filesChanged.length,n=``;return n=t===1?W.basename(e.filesChanged[0]||``):t===2?`${W.basename(e.filesChanged[0]||``)} and ${W.basename(e.filesChanged[1]||``)}`:`${W.basename(e.filesChanged[0]||``)} and ${e.filesChanged.length-1} other files`,(0,q.jsxs)(R,{dimColor:!0,children:[`The code will be restored `,(0,q.jsx)(Be,{diffStats:e}),` in `,n,`.`]})}function Be({diffStats:e}){if(e?.filesChanged)return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(R,{color:`diffAddedWord`,children:[`+`,e.insertions,` `]}),(0,q.jsxs)(R,{color:`diffRemovedWord`,children:[`-`,e.deletions]})]})}function Ve({userMessage:e,color:t,dimColor:n,isCurrent:r,paddingRight:i}){let{columns:a}=le();if(r)return(0,q.jsx)(L,{width:`100%`,children:(0,q.jsx)(R,{italic:!0,color:t,dimColor:n,children:`(current)`})});let o=e.message.content,s=typeof o==`string`?null:o[o.length-1],c=B(typeof o==`string`?o.trim():s&&Ie(s)?s.text.trim():`(no prompt)`);if(ie(c))return(0,q.jsx)(L,{flexDirection:`row`,width:`100%`,children:(0,q.jsx)(R,{italic:!0,color:t,dimColor:n,children:`((empty message))`})});if(c.includes(`<bash-input>`)){let e=P(c,`bash-input`);if(e)return(0,q.jsxs)(L,{flexDirection:`row`,width:`100%`,children:[(0,q.jsx)(R,{color:`bashBorder`,children:`!`}),(0,q.jsxs)(R,{color:t,dimColor:n,children:[` `,e]})]})}if(c.includes(`<command-message>`)){let e=P(c,ve),r=P(c,`command-args`),i=P(c,`skill-format`)===`true`;if(e)return i?(0,q.jsx)(L,{flexDirection:`row`,width:`100%`,children:(0,q.jsxs)(R,{color:t,dimColor:n,children:[`Skill(`,e,`)`]})}):(0,q.jsx)(L,{flexDirection:`row`,width:`100%`,children:(0,q.jsxs)(R,{color:t,dimColor:n,children:[`/`,e,` `,r]})})}return(0,q.jsx)(L,{flexDirection:`row`,width:`100%`,children:(0,q.jsx)(R,{color:t,dimColor:n,children:i?ye(c,a-i,!0):c.slice(0,500).split(`
2
- `).slice(0,4).join(`
3
- `)})})}function He(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||!y(n))continue;let r=n.toolUseResult;if(!(!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=z(e.lines,e=>e.startsWith(`+`)),n=z(e.lines,e=>e.startsWith(`-`));o+=t,s+=n}}catch{}}}return{filesChanged:a,insertions:o,deletions:s}}function Q(e){if(e.type!==`user`||Array.isArray(e.message.content)&&e.message.content[0]?.type===`tool_result`||b(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&&Ie(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 Ue(e,t){for(let n=t+1;n<e.length;n++){let t=e[n];if(t&&!b(t)&&!y(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 $,We=e((()=>{r(),H(),x(),C(),Oe(),E(),d(),a(),h(),re(),$=7}));export{Q as a,Ue as i,Fe as n,Me as o,We as r,Z as t};
@@ -1,10 +0,0 @@
1
- import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{l as n,o as r}from"./envUtils-DcaKZlRU.js";import{n as i,t as a}from"./figures-5ThXQEtq.js";import{$w as o,Aa as s,Af as c,Ag as l,Ba as u,Bu as d,By as f,Ca as p,Cp as m,Ga as h,Gf as g,Hf as _,Ia as v,Ja as ee,Jm as y,Kf as b,Ky as x,La as S,Ma as C,Mf as w,Na as te,Qw as T,Rf as E,Uf as D,Uh as O,Uy as ne,Vf as re,Vu as ie,Wf as k,Wh as A,Wy as j,Xh as M,Ya as ae,Za as oe,Zh as se,_C as ce,aS as N,dC as le,fC as ue,gC as P,gp as de,hp as fe,ja as pe,jf as me,ka as he,lC as ge,la as _e,ma as ve,na as ye,oS as be,oT as xe,pC as Se,qm as Ce,rT as we,ra as Te,sC as Ee,sS as De,ta as F,uC as Oe,ua as ke,wa as Ae,wp as je,xC as Me,zu as I}from"./loadAgentsDir-CbtNPJV3.js";import{C as Ne,Gr as L,I as R,N as Pe,P as z,Pn as Fe,Rn as Ie,ai as B,di as Le,fi as Re,j as ze,mt as Be,ot as Ve,t as V,xt as He}from"./src-DL3w8VPk2.js";import{t as H}from"./jsx-runtime-Bb4Xn-E0.js";import{B as Ue,Wt as We}from"./state-BPFYBqm1.js";import{n as Ge,t as Ke}from"./cwd-Besi3Os3.js";import{a as qe,c as Je,i as Ye,n as Xe,o as Ze}from"./debug-BQj6h99Q.js";import{Ht as Qe,Wt as $e,g as et,n as tt}from"./settings-CvhsRFaT.js";import{c as nt,h as rt,y as it}from"./config-BSkuQZNf.js";import{B as at,L as ot,R as st,q as ct}from"./log-BlJ7CcKG.js";import{b as lt,f as ut,m as dt,v as ft}from"./startupProfiler-2sjXZkIP.js";import{l as pt,o as mt}from"./stringUtils-BjnclTLB.js";import{E as ht,Pt as gt,_ as _t,b as vt,dn as yt,fn as bt,gt as xt,xt as St,yt as Ct,zt as wt}from"./model-DlLO7TSx.js";import{_n as Tt,yn as Et}from"./prompt-BRGC5U9Y.js";import{d as Dt,f as Ot,h as kt,p as At}from"./terminalSetup-JJiXmszo.js";import{at as jt,st as Mt}from"./sessionState-BlbRQ3Y6.js";import{n as Nt,t as Pt}from"./systemTheme-Ceakddth.js";import{n as Ft,r as It}from"./PromptInputFooterSuggestions-Cm4WN3qd.js";import{n as Lt,t as Rt}from"./useMainLoopModel-C1JRp4zE.js";import{n as zt,t as Bt}from"./modalContext-wY9CeN4G.js";import{n as Vt,r as Ht,t as Ut}from"./statusNoticeHelpers-BY_8pK19.js";import{a as Wt,c as Gt,i as Kt,l as qt,n as Jt,o as Yt,r as Xt,t as Zt,u as Qt}from"./logoV2Utils-D5nRpirL.js";import{homedir as $t}from"os";import{relative as en}from"path";import{fileURLToPath as tn}from"url";function nn(e,t){for(let n of e)if(!t.has(n))return!1;return!0}var rn=e((()=>{}));function an(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`)||Ae(t.text,`status`)!==`completed`?!1:Ae(t.text,`summary`)?.startsWith(`Background command `)??!1}function on(e,t){if(!A()||t)return e;let n=[],r=0;for(;r<e.length;){let t=e[r];if(an(t)){let i=0;for(;r<e.length&&an(e[r]);)i++,r++;i===1?n.push(t):n.push({...t,message:{role:`user`,content:[{type:`text`,text:`<${at}><${ot}>completed</${ot}><${st}>${i} background commands completed</${st}></${at}>`}]}})}else n.push(t),r++}return n}var sn=e((()=>{ct(),l(),O(),S()}));function cn(e){return e.type===`system`&&e.subtype===`stop_hook_summary`&&e.hookLabel!==void 0}function ln(e){let t=[],n=0;for(;n<e.length;){let r=e[n];if(cn(r)){let i=r.hookLabel,a=[];for(;n<e.length;){let t=e[n];if(!cn(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 un=e((()=>{}));function dn(e){let t=mn.get(e);return t||(t=new Set(e.filter(e=>e.renderGroupedToolUse).map(e=>e.name)),mn.set(e,t)),t}function fn(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 pn(e,t,n=!1){if(n)return{messages:e};let r=dn(t),i=new Map;for(let t of e){let e=fn(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=fn(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=fn(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 mn,hn=e((()=>{mn=new WeakMap}));function gn(e){let t=Sn.get(e);if(t!==void 0)return t;let n=_n(e).toLowerCase();return Sn.set(e,n),n}function _n(e){let t=``;switch(e.type){case`user`:{let n=e.message.content;if(typeof n==`string`)t=xn.has(n)?``:n;else{let r=[];for(let t of n??[])t.type===`text`?xn.has(t.text)||r.push(t.text):t.type===`tool_result`&&r.push(yn(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`?[vn(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(bn,r);if(e<0)break;n=n.slice(0,r)+n.slice(e+18),r=n.indexOf(`<system-reminder>`)}return n}function vn(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 yn(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?`\n${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(`
8
- `))}return n.join(`
9
- `)}var bn,xn,Sn,Cn=e((()=>{S(),bn=`</system-reminder>`,xn=new Set([ye,Te]),Sn=new WeakMap}));function wn({pose:e=`default`}={}){return(0,Tn.jsxs)(R,{flexDirection:`column`,alignItems:`center`,children:[(0,Tn.jsx)(z,{color:`clawd_body`,children:` █████ `}),(0,Tn.jsx)(z,{color:`clawd_body`,children:`██ ● ● ██`}),(0,Tn.jsx)(z,{color:`clawd_body`,children:`██ ▄▄▄ ██`}),(0,Tn.jsx)(z,{color:`clawd_body`,children:` █ █ █ █ `})]})}var Tn,En=e((()=>{V(),Tn=H()}));function Dn(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 On({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:lt(i,t)})]}):r.length===0&&a?(0,U.jsx)(z,{dimColor:!0,children:lt(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:lt(e.text,r)})]},n)}),i&&(0,U.jsx)(z,{dimColor:!0,italic:!0,children:lt(i,t)})]})]})}var U,kn=e((()=>{V(),ft(),U=H()}));function An({feeds:e,maxWidth:t}){let n=e.map(e=>Dn(e)),r=Math.max(...n),i=Math.min(r,t);return(0,Mn.jsx)(R,{flexDirection:`column`,children:e.map((t,n)=>(0,Mn.jsxs)(jn.Fragment,{children:[(0,Mn.jsx)(On,{config:t,actualWidth:i}),n<e.length-1&&(0,Mn.jsx)(Ne,{color:`claude`,width:i})]},n))})}var jn,Mn,Nn=e((()=>{jn=t(B(),1),V(),kn(),Mn=H()}));function Pn(e){let t=e.map(e=>{let t=dt(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 Fn(e){let t=e.filter(({isEnabled:e})=>e).sort((e,t)=>Number(e.isComplete)-Number(t.isComplete)).map(({text:e,isComplete:t})=>({text:`${t?`${a.tick} `:``}${e}`})),n=Ke()===$t()?`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 In=e((()=>{i(),Ge(),ft()}));function Ln(e,t,n){return Array.from({length:n},()=>({pose:e,offset:t}))}function Rn(){let{pose:e,bounceOffset:t,onClick:n}=zn();return(0,Vn.jsx)(R,{height:qn,flexDirection:`column`,onClick:n,children:(0,Vn.jsx)(R,{marginTop:t,flexShrink:0,children:(0,Vn.jsx)(wn,{pose:e})})})}function zn(){let[e]=(0,Bn.useState)(()=>tt().prefersReducedMotion??!1),[t,n]=(0,Bn.useState)(-1),r=(0,Bn.useRef)(Hn),i=()=>{e||t!==-1||(r.current=Un[Math.floor(Math.random()*Un.length)],n(0))};(0,Bn.useEffect)(()=>{if(t===-1)return;if(t>=r.current.length){n(-1);return}let e=setTimeout(n,Gn,Kn);return()=>clearTimeout(e)},[t]);let a=r.current,o=t>=0&&t<a.length?a[t]:Wn;return{pose:o.pose,bounceOffset:o.offset,onClick:i}}var Bn,Vn,Hn,Un,Wn,Gn,Kn,qn,Jn=e((()=>{Bn=t(B(),1),V(),et(),En(),Vn=H(),Hn=[...Ln(`default`,1,2),...Ln(`arms-up`,0,3),...Ln(`default`,0,1),...Ln(`default`,1,2),...Ln(`arms-up`,0,3),...Ln(`default`,0,1)],Un=[Hn,[...Ln(`look-right`,0,5),...Ln(`look-left`,0,5),...Ln(`default`,0,1)]],Wn={pose:`default`,offset:0},Gn=60,Kn=e=>e+1,qn=3}));function Yn(){let{columns:e}=Ve(),t=se(e=>e.agent),n=ht(Lt()),{version:r,cwd:i,billingType:a,agentName:o}=Yt(),s=t??o,c=Math.max(e-15,20),l=lt(r,Math.max(c-11,6)),{shouldSplit:u,truncatedModel:d,truncatedBilling:f}=Xt(n,a,c),p=s?c-1-L(s)-3:c,m=Qt(i,Math.max(p,10));return(0,W.jsx)(Ce,{children:(0,W.jsxs)(R,{flexDirection:`row`,gap:2,alignItems:`center`,children:[A()?(0,W.jsx)(Rn,{}):(0,W.jsx)(wn,{}),(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,Xn=e((()=>{Rt(),Me(),V(),M(),ft(),O(),qt(),_t(),y(),Jn(),En(),W=H()}));function Zn(){let e=(0,$n.useMemo)(Qn,[]),t=(0,$n.useMemo)(()=>nt().lastShownEmergencyTip,[]),n=e.tip&&e.tip!==t;return(0,$n.useEffect)(()=>{n&&it(t=>t.lastShownEmergencyTip===e.tip?t:{...t,lastShownEmergencyTip:e.tip})},[n,e.tip]),n?(0,er.jsx)(R,{paddingLeft:2,flexDirection:`column`,children:(0,er.jsx)(z,{...e.color===`warning`?{color:`warning`}:e.color===`error`?{color:`error`}:{dimColor:!0},children:e.tip})}):null}function Qn(){return tr}var $n,er,tr,nr=e((()=>{$n=t(B(),1),V(),rt(),er=H(),tr={tip:``,color:`dim`}}));function rr({char:e=`✻`}){let[t]=(0,ir.useState)(()=>tt().prefersReducedMotion??!1),[n,r]=(0,ir.useState)(t),i=(0,ir.useRef)(null),[a,o]=Be(n?null:50);return(0,ir.useEffect)(()=>{if(n)return;let e=setTimeout(r,sr,!0);return()=>clearTimeout(e)},[n]),n?(0,ar.jsx)(R,{ref:a,children:(0,ar.jsx)(z,{color:cr,children:e})}):(i.current===null&&(i.current=o),(0,ar.jsx)(R,{ref:a,children:(0,ar.jsx)(z,{color:ie(I((o-i.current)/or*360%360)),children:e})}))}var ir,ar,or,sr,cr,lr=e((()=>{ir=t(B(),1),$e(),V(),et(),d(),ar=H(),or=1500,sr=or*2,cr=ie({r:153,g:153,b:153})}));function ur(){return vt()&&(nt().opus1mMergeNoticeSeenCount??0)<mr}function dr(){let[e]=(0,fr.useState)(ur);return(0,fr.useEffect)(()=>{if(!e)return;let t=(nt().opus1mMergeNoticeSeenCount??0)+1;it(e=>(e.opus1mMergeNoticeSeenCount??0)>=t?e:{...e,opus1mMergeNoticeSeenCount:t})},[e]),e?(0,pr.jsxs)(R,{paddingLeft:2,children:[(0,pr.jsx)(rr,{char:`↑`}),(0,pr.jsx)(z,{dimColor:!0,children:` Opus now defaults to 1M context · 5x more room, same pricing`})]}):null}var fr,pr,mr,hr=e((()=>{fr=t(B(),1),$e(),V(),rt(),_t(),lr(),pr=H(),mr=6}));function gr(){let e=Gt(),t=nt().oauthAccount?.displayName??``,{columns:r}=Ve(),i=kt(),a=we.isSandboxingEnabled(),o=se(e=>e.agent),s=nt(),[c]=(0,_r.useState)(()=>{let e=tt().companyAnnouncements;if(!(!e||e.length===0))return s.numStartups===1?e[0]:e[Math.floor(Math.random()*e.length)]});(0,_r.useEffect)(()=>{i&&Ot()},[i]),!i&&n(process.env.CLAUDE_CODE_FORCE_FULL_LOGO);let l=ht(Lt()),{version:u,cwd:d,billingType:f,agentName:p}=Yt(),m=o??p,h=lt(l,vr-20);if(!i&&!n(process.env.CLAUDE_CODE_FORCE_FULL_LOGO))return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Yn,{}),(0,G.jsx)(dr,{}),qe()&&(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: `,Ze()?`stderr`:Xe()]})]}),(0,G.jsx)(Zn,{}),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 - Work Mate 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=Wt(r),_=Nt(nt().theme),v=` ${ze(`claude`,_)(`Work Mate`)} ${ze(`inactive`,_)(`v${u}`)} `,ee=ze(`claude`,_)(` Work Mate `);if(g===`compact`){let e=Kt(t);L(e)>r-4&&(e=Kt(null));let n=m?r-4-1-L(m)-3:r-4,i=Qt(d,Math.max(n,10));return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Ce,{children:(0,G.jsxs)(R,{flexDirection:`column`,borderStyle:`round`,borderColor:`claude`,borderText:{content:ee,position:`top`,align:`start`,offset:1},paddingX:1,paddingY:1,alignItems:`center`,width:r,children:[(0,G.jsx)(z,{bold:!0,children:e}),(0,G.jsx)(R,{marginY:1,children:(0,G.jsx)(wn,{})}),(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)(dr,{}),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 y=Kt(t),b=!process.env.IS_DEMO&&s.oauthAccount?.organizationName?`${h} · ${f} · ${s.oauthAccount.organizationName}`:`${h} · ${f}`,x=m?vr-1-L(m)-3:vr,S=Qt(d,Math.max(x,10)),C=m?`@${m} · ${S}`:S,{leftWidth:w,rightWidth:te}=Zt(r,g,Jt(y,C,b));return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Ce,{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:w,justifyContent:`space-between`,alignItems:`center`,minHeight:9,children:[(0,G.jsx)(R,{marginTop:1,children:(0,G.jsx)(z,{bold:!0,children:y})}),(0,G.jsx)(wn,{}),(0,G.jsxs)(R,{flexDirection:`column`,alignItems:`center`,children:[(0,G.jsx)(z,{dimColor:!0,children:b}),(0,G.jsx)(z,{dimColor:!0,children:C})]})]}),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)(An,{feeds:i?[Fn(Dt()),Pn(e)]:[Pn(e)],maxWidth:te})]})})}),(0,G.jsx)(dr,{}),qe()&&(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: `,Ze()?`stderr`:Xe()]})]}),(0,G.jsx)(Zn,{}),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 - Work Mate 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 _r,G,vr,yr=e((()=>{V(),Me(),qt(),ft(),En(),Nn(),In(),rt(),Pt(),et(),Ye(),_r=t(B(),1),At(),Xn(),y(),r(),nr(),hr(),xe(),M(),Rt(),_t(),G=H(),vr=50}));function br({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,xr.jsx)(R,{minWidth:L(i)+8,children:(0,xr.jsx)(z,{dimColor:!0,children:i})})}var xr,Sr=e((()=>{V(),xr=H()}));function Cr({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,wr.jsx)(R,{minWidth:L(n),children:(0,wr.jsx)(z,{dimColor:!0,children:n})})}var wr,Tr=e((()=>{V(),wr=H()}));function Er(e,t,n,r){for(let i=t+1;i<e.length;i++){let t=e[i];if(t?.type===`assistant`){let e=Nr(t.message.content);if(e?.type===`thinking`||e?.type===`redacted_thinking`||e?.type===`tool_use`&&(D(e.name,e.input,n).isCollapsible||r.has(e.id)))continue;return!0}if(!(t?.type===`system`||t?.type===`attachment`)&&!(t?.type===`user`&&Nr(t.message.content)?.type===`tool_result`)){if(t?.type===`grouped_tool_use`){let e=Nr(t.messages[0]?.message.content)?.input;if(D(t.toolName,e,n).isCollapsible)continue}return!0}}return!1}function Dr({message:e,isUserContinuation:t,hasContentAfter:n,tools:r,commands:i,verbose:a,inProgressToolUseIDs:o,streamingToolUseIDs:l,screen:u,canAnimate:d,lastThinkingBlockId:f,latestBashOutputUUID:p,columns:m,isLoading:h,lookups:v,shouldCollapseDiffs:ee}){let y=u===`transcript`,b=e.type===`grouped_tool_use`,x=e.type===`collapsed_read_search`,S=x&&(g(e,o)||h&&!n),w=b?e.displayMessage:x?_(e):e,te=b||x?[]:s(e,v),T=qi(e,l,o,b||x?F:pe(e,v),u,v),E=!1;if(d)if(b)E=e.messages.some(e=>{let t=Nr(e.message.content);return t?.type===`tool_use`&&o.has(t.id)});else if(x)E=g(e,o);else{let t=C(e);E=!t||o.has(t)}let D=y&&w.type===`assistant`&&Array.isArray(w.message.content)&&w.message.content.some(e=>e.type===`text`)&&(w.timestamp||w.message.model),O=(0,Mr.jsx)(c,{message:e,lookups:v,addMargin:!D,containerWidth:D?void 0:m,tools:r,commands:i,verbose:a,inProgressToolUseIDs:o,progressMessagesForMessage:te,shouldAnimate:E,shouldShowDot:!0,isTranscriptMode:y,isStatic:T,isActiveCollapsedGroup:S,isUserContinuation:t,lastThinkingBlockId:f,latestBashOutputUUID:p,shouldCollapseDiffs:ee});return D?(0,Mr.jsx)(Ce,{children:(0,Mr.jsxs)(R,{width:m,flexDirection:`column`,children:[(0,Mr.jsxs)(R,{flexDirection:`row`,justifyContent:`flex-end`,gap:1,marginTop:1,children:[(0,Mr.jsx)(Cr,{message:w,isTranscriptMode:y}),(0,Mr.jsx)(br,{message:w,isTranscriptMode:y})]}),O]})}):(0,Mr.jsx)(Ce,{children:O})}function Or(e,t){if(e.type===`grouped_tool_use`)return e.messages.some(e=>{let n=Nr(e.message.content);return n?.type===`tool_use`&&t.has(n.id)});if(e.type===`collapsed_read_search`)return k(e).some(e=>t.has(e));let n=C(e);return!!n&&t.has(n)}function kr(e,t){if(e.type===`grouped_tool_use`)return e.messages.every(e=>{let n=Nr(e.message.content);return n?.type===`tool_use`&&t.has(n.id)});if(e.type===`collapsed_read_search`)return k(e).every(e=>t.has(e));if(e.type===`assistant`){let n=Nr(e.message.content);if(n?.type===`server_tool_use`)return t.has(n.id)}let n=C(e);return!n||t.has(n)}function Ar(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&&me(t.message))return!1;let n=Or(e.message,e.streamingToolUseIDs),r=kr(e.message,e.lookups.resolvedToolUseIDs);return!(n||!r)}var jr,Mr,Nr,Pr,Fr=e((()=>{jr=t(B(),1),V(),b(),S(),w(),Mr=H(),Sr(),ta(),Tr(),y(),Nr=e=>{if(!Array.isArray(e))return;let t=e[0];if(!(t==null||typeof t==`string`))return t},Pr=jr.memo(Dr,Ar)}));function Ir(e){return e.type===`attachment`&&Lr.has(e.attachment.type)}var Lr,Rr=e((()=>{Lr=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 zr(e){return Gr.filter(t=>t.isActive(e))}var K,Br,Vr,Hr,Ur,Wr,Gr,Kr=e((()=>{V(),x(),i(),Ge(),ft(),gt(),Ht(),K=H(),Br={id:`large-memory-files`,type:`warning`,isActive:e=>ne(e.memoryFiles).length>0,render:e=>(0,K.jsx)(K.Fragment,{children:ne(e.memoryFiles).map(e=>{let t=e.path.startsWith(Ke())?en(Ke(),e.path):e.path;return(0,K.jsxs)(R,{flexDirection:`row`,children:[(0,K.jsx)(z,{color:`warning`,children:a.warning}),(0,K.jsxs)(z,{color:`warning`,children:[`Large `,(0,K.jsx)(z,{bold:!0,children:t}),` will impact performance (`,ut(e.content.length),` chars > `,ut(f),`)`,(0,K.jsx)(z,{dimColor:!0,children:` · /memory to edit`})]})]},e.path)})})},Vr={id:`claude-ai-external-token`,type:`warning`,isActive:()=>{let e=St();return wt()&&(e.source===`ANTHROPIC_AUTH_TOKEN`||e.source===`apiKeyHelper`)},render:()=>{let e=St();return(0,K.jsxs)(R,{flexDirection:`row`,marginTop:1,children:[(0,K.jsx)(z,{color:`warning`,children:a.warning}),(0,K.jsxs)(z,{color:`warning`,children:[`Auth conflict: Using `,e.source,` instead of Work Mate account subscription token. Either unset`,` `,e.source,", or run `claude /logout`."]})]})}},Hr={id:`api-key-conflict`,type:`warning`,isActive:()=>{let{source:e}=xt({skipRetrievingKeyFromApiKeyHelper:!0});return!!Ct()&&(e===`ANTHROPIC_API_KEY`||e===`apiKeyHelper`)},render:()=>{let{source:e}=xt({skipRetrievingKeyFromApiKeyHelper:!0});return(0,K.jsxs)(R,{flexDirection:`row`,marginTop:1,children:[(0,K.jsx)(z,{color:`warning`,children:a.warning}),(0,K.jsxs)(z,{color:`warning`,children:[`Auth conflict: Using `,e,` instead of Console key. Either unset `,e,", or run `claude /logout`."]})]})}},Ur={id:`both-auth-methods`,type:`warning`,isActive:()=>{let{source:e}=xt({skipRetrievingKeyFromApiKeyHelper:!0}),t=St();return e!==`none`&&t.source!==`none`&&!(e===`apiKeyHelper`&&t.source===`apiKeyHelper`)},render:()=>{let{source:e}=xt({skipRetrievingKeyFromApiKeyHelper:!0}),t=St();return(0,K.jsxs)(R,{flexDirection:`column`,marginTop:1,children:[(0,K.jsxs)(R,{flexDirection:`row`,children:[(0,K.jsx)(z,{color:`warning`,children:a.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.`]})]})]})}},Wr={id:`large-agent-descriptions`,type:`warning`,isActive:e=>Vt(e.agentDefinitions)>Ut,render:e=>{let t=Vt(e.agentDefinitions);return(0,K.jsxs)(R,{flexDirection:`row`,children:[(0,K.jsx)(z,{color:`warning`,children:a.warning}),(0,K.jsxs)(z,{color:`warning`,children:[`Large cumulative agent descriptions will impact performance (~`,ut(t),` tokens > `,ut(Ut),`)`,(0,K.jsx)(z,{dimColor:!0,children:` · /agents to manage`})]})]})}},Gr=[Br,Wr,Vr,Hr,Ur]}));function qr({agentDefinitions:e}={}){let t={config:nt(),agentDefinitions:e,memoryFiles:(0,Yr.use)(j())},n=zr(t);return n.length===0?null:(0,Xr.jsx)(R,{flexDirection:`column`,paddingLeft:1,children:n.map(e=>(0,Xr.jsx)(Jr.Fragment,{children:e.render(t)},e.id))})}var Jr,Yr,Xr,Zr=e((()=>{Jr=t(B(),1),Yr=t(B(),1),V(),x(),rt(),Kr(),Xr=H()}));function Qr(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)??oi,[e]),()=>{let t=e.current;if(!t)return NaN;let n=t.getScrollTop()+t.getPendingDelta(),r=Math.floor(n/ni);return t.isSticky()?~r:r});let g=e.current?.getScrollTop()??-1,_=e.current?.getPendingDelta()??0,v=e.current?.getViewportHeight()??0,ee=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 y=t.length;if(o.current.version!==i.current||o.current.n!==y){let e=o.current.arr.length>=y+1?o.current.arr:new Float64Array(y+1);e[0]=0;for(let n=0;n<y;n++)e[n+1]=e[n]+(r.current.get(t[n])??$r);o.current={arr:e,version:i.current,n:y}}let b=o.current.arr,x=b[y],S,C;if(p)[S,C]=p,S=Math.min(S,y),C=Math.min(C,y);else if(v===0||g<0)S=Math.max(0,y-ti),C=y;else{if(ee){let e=v+ei;for(S=y;S>0&&x-b[S-1]<e;)S--;C=y}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-ei;{let e=0,t=y;for(;e<t;){let n=e+t>>1;b[n+1]<=p?e=n+1:t=n}S=e}{let e=d.current;if(e&&e[0]<S)for(let n=e[0];n<Math.min(S,e[1]);n++){let e=t[n];if(s.current.has(e)&&!r.current.has(e)){S=n;break}}}let h=v+2*ei,ee=Math.min(y,S+ii),x=0;for(C=S;C<ee&&(x<h||b[C]<f+v+ei);)x+=r.current.get(t[C])??ri,C++}let e=v+2*ei,n=Math.max(0,C-ii),i=0;for(let e=S;e<C;e++)i+=r.current.get(t[e])??ri;for(;S>n&&i<e;)S--,i+=r.current.get(t[S])??ri;let o=d.current,c=Math.abs(g-a.current)+Math.abs(_);if(o&&c>v*2){let[e,t]=o;S<e-ai&&(S=e-ai),C>t+ai&&(C=t+ai),S>C&&(C=Math.min(S+ai,y))}a.current=g}f.current>0?f.current--:d.current=[S,C];let w=(0,q.useDeferredValue)(S),te=(0,q.useDeferredValue)(C),T=S<w?w:S,E=C>te?te:C;if((T>E||ee)&&(T=S,E=C),_>0&&(E=C),E-T>ii){let e=(b[T]+b[E])/2;g-m.current<e?E=T+ii:T=E-ii}let D=m.current,O=b[T],ne=T===0?0:O+D,re=E===y?1/0:Math.max(O,b[E]-v)+D;(0,q.useLayoutEffect)(()=>{ee?e.current?.setClampBounds(void 0,void 0):e.current?.setClampBounds(ne,re)}),(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 ie=(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},[]),k=(0,q.useCallback)(e=>{let n=s.current.get(t[e])?.yogaNode;return!n||n.getComputedWidth()===0?-1:n.getComputedTop()},[t]),A=(0,q.useCallback)(e=>s.current.get(t[e])??null,[t]),j=(0,q.useCallback)(e=>r.current.get(t[e]),[t]),M=(0,q.useCallback)(t=>{let n=o.current;t<0||t>=n.n||e.current?.scrollTo(n.arr[t]+m.current)},[e]),ae=x-b[E];return{range:[T,E],topSpacer:O,bottomSpacer:ae,measureRef:ie,spacerRef:h,offsets:b,getItemTop:k,getItemElement:A,getItemHeight:j,scrollToIndex:M}}var q,$r,ei,ti,ni,ri,ii,ai,oi,si=e((()=>{q=t(B(),1),$r=3,ei=40,ti=30,ni=20,ri=1,ii=200,ai=25,oi=()=>{}}));function ci({children:e}){let[t,n]=(0,J.useState)(null),[r,i]=(0,J.useState)(null);return(0,pi.jsx)(hi.Provider,{value:n,children:(0,pi.jsx)(_i.Provider,{value:i,children:(0,pi.jsx)(mi.Provider,{value:t,children:(0,pi.jsx)(gi.Provider,{value:r,children:e})})})})}function li(){return(0,J.useContext)(mi)}function ui(){return(0,J.useContext)(gi)}function di(e){let t=(0,J.useContext)(hi);(0,J.useEffect)(()=>{if(t)return t(e),()=>t(null)},[t,e])}function fi(e){let t=(0,J.useContext)(_i);(0,J.useEffect)(()=>{if(t)return t(e),()=>t(null)},[t,e])}var J,pi,mi,hi,gi,_i,vi=e((()=>{J=t(B(),1),pi=H(),mi=(0,J.createContext)(null),hi=(0,J.createContext)(null),gi=(0,J.createContext)(null),_i=(0,J.createContext)(null)}));function yi(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 bi(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`&&!xi(t))continue;let a=t.type===`assistant`;a&&!r&&n++,r=a}return n}function xi(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 Si(e,t){if(t===null)return;let n=t;for(;n<e.length&&(e[n]?.type===`progress`||Ir(e[n]));)n++;let r=e[n]?.uuid;if(!r)return;let i=bi(e,t);return{firstUnseenUuid:r,count:Math.max(1,i)}}function Ci({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(!A())return;let e=Ie.get(process.stdout);if(e)return e.onHyperlinkClick=e=>{if(e.startsWith(`file:`))try{De(tn(e))}catch{}else be(e)},()=>{e.onHyperlinkClick=void 0}},[]),A()){let s=l?null:m,h=s!=null&&s!==`clicked`&&n==null?s:null,v=s!=null&&n==null;return(0,X.jsxs)(ci,{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)(Ti,{text:h.text,onClick:h.scrollTo}),(0,X.jsxs)(He,{ref:o,flexGrow:1,flexDirection:`column`,paddingTop:+!v,stickyScroll:!0,children:[(0,X.jsx)(ki,{value:g,children:e}),n]}),!c&&_&&n==null&&(0,X.jsx)(wi,{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)(Ei,{}),(0,X.jsx)(Di,{}),(0,X.jsx)(R,{flexDirection:`column`,width:`100%`,flexGrow:1,overflowY:`hidden`,children:t})]})]})}),i!=null&&(0,X.jsx)(Bt,{value:{rows:f-Oi-1,columns:p-4,scrollRef:a??null},children:(0,X.jsxs)(R,{position:`absolute`,bottom:0,left:0,right:0,maxHeight:f-Oi,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 wi({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 ${pt(e,`message`)}`:`Jump to bottom`,` `,a.arrowDown,` `]})})})}function Ti({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:[a.pointer,` `,e]})})}function Ei(){let e=li();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)(Ft,{suggestions:e.suggestions,selectedSuggestion:e.selectedSuggestion,maxColumnWidth:e.maxColumnWidth,overlay:!0})})}function Di(){let e=ui();return e?(0,X.jsx)(R,{position:`absolute`,bottom:`100%`,left:0,right:0,opaque:!0,children:e}):null}var Y,X,Oi,ki,Ai=e((()=>{i(),Y=t(B(),1),zt(),vi(),Me(),V(),N(),O(),mt(),Rr(),It(),X=H(),Oi=2,ki=(0,Y.createContext)({setStickyPrompt:()=>{}})}));function ji(e){let t=zi.get(e);if(t!==void 0)return t;let n=gn(e);return zi.set(e,n),n}function Mi(e){let t=Vi.get(e);if(t!==void 0)return t;let n=Ni(e);return Vi.set(e,n),n}function Ni(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(`
10
- `)}if(t===null)return null;let n=ue(t);return n.startsWith(`<`)||n===``?null:n}function Pi({itemKey:e,msg:t,idx:n,measureRef:r,expanded:i,hovered:a,clickable:o,onClickK:s,onEnterK:c,onLeaveK:l,renderItem:u}){return(0,Li.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,Li.jsx)(Pe.Provider,{value:a&&!i?`text`:void 0,children:u(t,n)})})}function Fi({messages:e,scrollRef:t,columns:n,itemKey:r,renderItem:i,onItemClick:a,isItemClickable:o,isItemExpanded:s,extractSearchText:c=ji,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),ee=(0,Z.useRef)(r);if(ee.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,ee.current=r;let y=_.current,{range:b,topSpacer:x,bottomSpacer:S,measureRef:C,spacerRef:w,offsets:te,getItemTop:T,getItemElement:E,getItemHeight:D,scrollToIndex:O}=Qr(t,y,n),[ne,re]=b,ie=(0,Z.useCallback)(t=>D(t)!==0&&le(e[t]),[D,e]);(0,Z.useImperativeHandle)(d,()=>{let n=e=>f?.({uuid:e.uuid,msgType:e.type,expanded:!1,toolName:Se(e)?.name}),r=u??-1,i=(t,r,i=ie)=>{for(let a=t;a>=0&&a<e.length;a+=r)if(i(a))return n(e[a]),!0;return!1},a=t=>ie(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,ie]);let k=(0,Z.useRef)({offsets:te,start:ne,getItemElement:E,getItemTop:T,messages:e,scrollToIndex:O});k.current={offsets:te,start:ne,getItemElement:E,getItemTop:T,messages:e,scrollToIndex:O},(0,Z.useEffect)(()=>{if(u===void 0)return;let e=k.current,n=e.getItemElement(u);n?t.current?.scrollToElement(n,1):e.scrollToIndex(u)},[u,t]);let A=(0,Z.useRef)(null),j=(0,Z.useRef)({msgIdx:-1,positions:[]}),M=(0,Z.useRef)(-1),ae=(0,Z.useRef)(0),oe=(0,Z.useRef)(0),se=(0,Z.useRef)(()=>{}),ce=(0,Z.useRef)(()=>{}),N=(0,Z.useRef)({matches:[],ptr:0,screenOrd:0,prefixSum:[]}),ue=(0,Z.useRef)(-1),P=(0,Z.useRef)(!1);function de(e){let t=k.current.getItemTop(e);return Math.max(0,t-Ri)}function fe(e){let n=t.current,{msgIdx:r,positions:i}=j.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=k.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-Ri)),l=s-n.getScrollTop(),d=c+l+o.row),g?.({positions:i,rowOffset:c+l,currentIdx:a});let f=N.current,p=f.prefixSum.at(-1)??0,h=(f.prefixSum[f.ptr]??0)+a+1;m?.(p,h),Je(`highlight(i=${r}, ord=${a}/${i.length}): pos={row:${o.row},col:${o.col}} lo=${l} screenRow=${d} badge=${h}/${p}`)}ce.current=fe;let[pe,me]=(0,Z.useState)(0),he=(0,Z.useCallback)(()=>me(e=>e+1),[]);(0,Z.useEffect)(()=>{let e=A.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}=k.current,l=o(n),u=l?.yogaNode?.getComputedHeight()??0;if(!l||u===0){if(i>1){A.current=null,Je(`seek(i=${n}): no mount after scrollToIndex, skip`),se.current(r?-1:1);return}A.current={idx:n,wantLast:r,tries:i+1},c(n),he();return}A.current=null,a.scrollTo(Math.max(0,s(n)-Ri));let d=h?.(l)??[];if(j.current={msgIdx:n,positions:d},Je(`seek(i=${n} t=${i}): ${d.length} positions`),d.length===0){if(++ae.current>20){ae.current=0;return}se.current(r?-1:1);return}ae.current=0;let f=r?d.length-1:0;N.current.screenOrd=f,M.current=-1,ce.current(f);let p=oe.current;p&&(oe.current=0,se.current(p))},[pe]);function ge(e,n){let r=t.current;if(!r)return;let i=k.current,{getItemElement:a,scrollToIndex:o}=i;if(e<0||e>=i.messages.length)return;g?.(null),j.current={msgIdx:-1,positions:[]},A.current={idx:e,wantLast:n,tries:0};let s=a(e),c=s?.yogaNode?.getComputedHeight()??0;s&&c>0?r.scrollTo(de(e)):o(e),he()}function _e(e){let t=N.current,{matches:n,prefixSum:r}=t,i=r.at(-1)??0;if(n.length===0)return;if(A.current){oe.current=e;return}M.current<0&&(M.current=t.ptr);let{positions:a}=j.current,o=t.screenOrd+e;if(o>=0&&o<a.length){t.screenOrd=o,fe(o),M.current=-1;return}let s=(t.ptr+e+n.length)%n.length;if(s===M.current){g?.(null),M.current=-1,Je(`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)}se.current=_e,(0,Z.useImperativeHandle)(p,()=>({jumpToIndex:e=>{let n=t.current;n&&n.scrollTo(de(e))},setSearchQuery:e=>{A.current=null,j.current={msgIdx:-1,positions:[]},M.current=-1,g?.(null);let n=e.toLowerCase(),r=[],i=[0];if(n){let e=k.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}=k.current,f=d(u),p=f>=0?f-l[u]:0;if(r.length>0&&s){let t=ue.current>=0?ue.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)}Je(`setSearchQuery('${e}'): ${r.length} msgs · ptr=${o} msgIdx=${r[o]} curTop=${t} origin=${p}`)}N.current={matches:r,ptr:o,screenOrd:0,prefixSum:i},r.length>0?ge(r[o],!0):ue.current>=0&&s&&s.scrollTo(ue.current),m?.(a,r.length>0?i[o+1]??a:0)},nextMatch:()=>_e(1),prevMatch:()=>_e(-1),setAnchor:()=>{let e=t.current;e&&(ue.current=e.getScrollTop())},disarmSearch:()=>{g?.(null),A.current=null,j.current={msgIdx:-1,positions:[]},M.current=-1},warmSearchIndex:async()=>{if(P.current)return 0;let e=k.current.messages,t=0,n=performance.now();for(let n=0;n<e.length;n+=500){await bt(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 Je(`warmSearchIndex: ${e.length} msgs · work=${Math.round(t)}ms wall=${r}ms chunks=${Math.ceil(e.length/500)}`),P.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)},[]),Ce=(0,Z.useCallback)(e=>{be.current.setHoveredKey(e)},[]),we=(0,Z.useCallback)(e=>{be.current.setHoveredKey(t=>t===e?null:t)},[]);return(0,Li.jsxs)(Li.Fragment,{children:[(0,Li.jsx)(R,{ref:w,height:x,flexShrink:0}),e.slice(ne,re).map((e,t)=>{let n=ne+t,r=y[n],c=!!a&&(o?.(e)??!0),l=c&&ve===r,u=s?.(e);return(0,Li.jsx)(Pi,{itemKey:r,msg:e,idx:n,measureRef:C,expanded:u,hovered:l,clickable:c,onClickK:xe,onEnterK:Ce,onLeaveK:we,renderItem:i},r)}),S>0&&(0,Li.jsx)(R,{height:S,flexShrink:0}),l&&(0,Li.jsx)(Ii,{messages:e,start:ne,end:re,offsets:te,getItemTop:T,getItemElement:E,scrollRef:t})]})}function Ii({messages:e,start:t,end:n,offsets:r,getItemTop:i,getItemElement:a,scrollRef:o}){let{setStickyPrompt:s}=(0,Z.useContext)(ki);(0,Z.useSyncExternalStore)((0,Z.useCallback)(e=>o.current?.subscribe(e)??Hi,[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=Mi(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,Bi).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,Li,Ri,zi,Bi,Vi,Hi,Ui=e((()=>{Z=t(B(),1),si(),V(),E(),Ai(),Li=H(),Ye(),yt(),Cn(),Oe(),Ri=3,zi=new WeakMap,Bi=500,Vi=new WeakMap,Hi=()=>{}}));function Wi(e,t,n=Zi,r=Qi){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 Gi(e){return(e.type===`assistant`||e.type===`user`?C(e):null)??e.uuid}function Ki(e,t){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}function qi(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=C(e);return i?t.has(i)||n.has(i)||v(i,`PostToolUse`,a)?!1:nn(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 Ji,Q,$,Yi,Xi,Zi,Qi,$i,ea,ta=e((()=>{Re(),Ji=t(B(),1),Q=t(B(),1),rn(),We(),$e(),Me(),V(),P(),Et(),T(),sn(),un(),b(),rt(),r(),O(),hn(),S(),mt(),Cn(),yr(),je(),Fr(),Oe(),de(),Rr(),y(),Zr(),$=H(),jt(),Ui(),Yi=Ji.memo(function({agentDefinitions:e}){return(0,$.jsx)(Ce,{children:(0,$.jsxs)(R,{flexDirection:`column`,gap:1,children:[(0,$.jsx)(gr,{}),(0,$.jsx)(Ji.Suspense,{fallback:null,children:(0,$.jsx)(qr,{agentDefinitions:e})})]})})}),Xi=30,Zi=200,Qi=50,$i=({messages:e,tools:t,commands:r,verbose:i,toolJSX:a,toolUseConfirmQueue:s,inProgressToolUseIDs:c,isMessageSelectorVisible:l,conversationId:d,screen:f,streamingToolUses:g,showAllInTranscript:_=!1,agentDefinitions:v,hideLogo:y=!1,isLoading:b,hidePastThinking:x=!1,streamingThinking:S,streamingText:C,unseenDivider:w,scrollRef:T,trackStickyPrompt:E,jumpRef:D,onSearchMatchesChange:O,scanElement:ne,setPositions:ie,disableRenderCap:k=!1,cursor:j=null,setCursor:M,cursorNavRef:se,renderRange:N})=>{let{columns:le}=Ve(),ue=ce(`transcript:toggleShowAll`,`Transcript`,`Ctrl+E`),P=(0,Q.useMemo)(()=>h(e).filter(u),[e]),de=(0,Q.useMemo)(()=>S?S.isStreaming?!0:S.streamingEndedAt?Date.now()-S.streamingEndedAt<3e4:!1:!1,[S]),{lastThinkingBlockId:pe,latestBashOutputUUID:me}=(0,Q.useMemo)(()=>{let e=null,t=null,n=x&&!de;x&&de&&(e=`streaming`);for(let r=P.length-1;r>=0;r--){let i=P[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 x||(e=null),{lastThinkingBlockId:e,latestBashOutputUUID:t}},[P,x,de]),ye=(0,Q.useMemo)(()=>te(P),[P]),be=(0,Q.useMemo)(()=>g.filter(e=>!c.has(e.contentBlock.id)&&!ye.has(e.contentBlock.id)),[g,c,ye]),xe=(0,Q.useMemo)(()=>be.flatMap(e=>{let t=ve({content:[e.contentBlock]});return t.uuid=p(e.contentBlock.id,0),h([t])}),[be]),Se=f===`transcript`,Ce=(0,Q.useMemo)(()=>n(process.env.CLAUDE_CODE_DISABLE_VIRTUAL_SCROLL),[]),we=T!=null&&!Ce,Te=Se&&!_&&!we,De=(0,Q.useRef)(null),F=(0,Q.useRef)(null),{collapsed:Oe,lookups:Ae,hasTruncatedMessages:je,hiddenMessageCount:Me}=(0,Q.useMemo)(()=>{let e=ee((i||A()?P:he(P,{includeSnipped:!0})).filter(e=>e.type!==`progress`&&!Ir(e)&&ae(e,Se)),xe),n=Te?e.slice(-30):e,r=Te&&e.length>Xi,{messages:a}=pn(n,t,i),o=on(ln(re(a,t)),i),s=ke(P,n),c=(()=>{let e=n.at(-1);return e?.type===`assistant`?e.message?.id:void 0})(),l;if(F.current&&F.current.key===s)l=F.current.lookups;else if(F.current&&P.length>=F.current.normalizedCount&&n.length>=F.current.messageCount&&F.current.lastAssistantMsgId===c){let e=oe(F.current.lookups,F.current.normalizedCount,F.current.messageCount,P,n);e?(l=e,F.current={key:s,lookups:l,normalizedCount:P.length,messageCount:n.length,lastAssistantMsgId:c}):(l=_e(P,n),F.current={key:s,lookups:l,normalizedCount:P.length,messageCount:n.length,lastAssistantMsgId:c})}else l=_e(P,n),F.current={key:s,lookups:l,normalizedCount:P.length,messageCount:n.length,lastAssistantMsgId:c};let u=e.length-Xi;return{collapsed:o,lookups:l,hasTruncatedMessages:r,hiddenMessageCount:u}},[i,P,Se,xe,Te,t]),I=(0,Q.useMemo)(()=>{let e=!we&&!k?Wi(Oe,De):0;return N?Oe.slice(N[0],N[1]):e>0?Oe.slice(e):Oe},[Oe,N,we,k]),L=(0,Q.useMemo)(()=>new Set(g.map(e=>e.contentBlock.id)),[g]),{dividerBeforeIndex:Pe,selectedIdx:Ie}=(0,Q.useMemo)(()=>{if(!w&&!j)return{dividerBeforeIndex:-1,selectedIdx:-1};let e=-1,t=-1,n=w?.firstUnseenUuid.slice(0,24);for(let r=0;r<I.length;r++){let i=I[r];if(e===-1&&n&&i.uuid.slice(0,24)===n&&(e=r),t===-1&&j&&i.uuid===j.uuid&&(t=r),e!==-1&&t!==-1)break}return{dividerBeforeIndex:e,selectedIdx:t}},[w,j,I]),[B,Re]=(0,Q.useState)(()=>new Set),ze=(0,Q.useCallback)(e=>{let t=Gi(e);Re(e=>{let n=new Set(e);return n.has(t)?n.delete(t):n.add(t),n})},[]),Be=(0,Q.useCallback)(e=>B.size>0&&B.has(Gi(e)),[B]),V=(0,Q.useRef)(Ae);V.current=Ae;let He=(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&&o(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?Tt(t,r):void 0)?.isResultTruncated?.(e.toolUseResult)??!1},[t]),H=(!a||!!a.shouldContinueAnimation)&&!s.length&&!l,We=c.size>0,{progress:Ge}=Fe(),Ke=(0,Q.useRef)(null),qe=nt().terminalProgressBarEnabled&&!Ue()&&!Mt();(0,Q.useEffect)(()=>{let e=qe?We?`indeterminate`:`completed`:null;Ke.current!==e&&(Ke.current=e,Ge(e))},[Ge,qe,We]),(0,Q.useEffect)(()=>()=>Ge(null),[Ge]);let Je=(0,Q.useCallback)(e=>`${e.uuid}-${d}`,[d]),Ye=(e,n)=>{let a=n>0?I[n-1]?.type:void 0,o=e.type===`user`&&a===`user`,s=e.type===`collapsed_read_search`&&(!!C||Er(I,n,t,L)),l=I.length-1-n>0,u=Je(e),d=(0,$.jsx)(Pr,{message:e,isUserContinuation:o,hasContentAfter:s,tools:t,commands:r,verbose:i||Be(e)||j?.expanded===!0&&n===Ie,inProgressToolUseIDs:c,streamingToolUseIDs:L,screen:f,canAnimate:H,lastThinkingBlockId:pe,latestBashOutputUUID:me,columns:le,isLoading:b,lookups:Ae,shouldCollapseDiffs:l},u),p=(0,$.jsx)(ge.Provider,{value:n===Ie,children:d},u);return w&&n===Pe?[(0,$.jsx)(R,{marginTop:1,children:(0,$.jsx)(Ne,{title:`${w.count} new ${pt(w.count,`message`)}`,width:le,color:`inactive`})},`unseen-divider`),p]:p},Xe=(0,Q.useRef)(new WeakMap),Ze=(0,Q.useCallback)(e=>{let n=Xe.current.get(e);if(n!==void 0)return n;let r=gn(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=Ae.toolUseByToolUseID.get(n.tool_use_id),a=(i&&Tt(t,i.name))?.extractSearchText?.(e.toolUseResult);a!==void 0&&(r=a)}}let i=r.toLowerCase();return Xe.current.set(e,i),i},[t,Ae]);return(0,$.jsxs)($.Fragment,{children:[!y&&!(N&&N[0]>0)&&(0,$.jsx)(Yi,{agentDefinitions:v}),je&&(0,$.jsx)(Ne,{title:`${ue} to show ${Le.bold(Me)} previous messages`,width:le}),Se&&_&&Me>0&&!k&&(0,$.jsx)(Ne,{title:`${ue} to hide ${Le.bold(Me)} previous messages`,width:le}),we?(0,$.jsx)(Ee.Provider,{value:!0,children:(0,$.jsx)(Fi,{messages:I,scrollRef:T,columns:le,itemKey:Je,renderItem:Ye,onItemClick:ze,isItemClickable:He,isItemExpanded:Be,trackStickyPrompt:E,selectedIndex:Ie>=0?Ie:void 0,cursorNavRef:se,setCursor:M,jumpRef:D,onSearchMatchesChange:O,scanElement:ne,setPositions:ie,extractSearchText:Ze})}):I.flatMap(Ye),C&&(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:Qe})}),(0,$.jsx)(R,{flexDirection:`column`,children:(0,$.jsx)(m,{children:C})})]})}),de&&S&&(0,$.jsx)(R,{marginTop:1,children:(0,$.jsx)(fe,{param:{type:`thinking`,thinking:S.thinking},addMargin:!1,isTranscriptMode:!0,verbose:i,hideInTranscript:!1})})]})},ea=Ji.memo($i,(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`&&Ki(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{Ai as a,di as c,Si as i,fi as l,ta as n,yi as o,Ci as r,vi as s,ea as t};
@@ -1 +0,0 @@
1
- import{a as e}from"./rolldown-runtime-DaDcL9Zw.js";import{l as t,o as n,s as r}from"./envUtils-DcaKZlRU.js";import{n as i,t as a}from"./defineProperty-C-QyHrDq.js";import{$ as o,$n as s,$y as c,Bb as l,CT as u,FC as d,Fi as ee,J_ as f,Js as p,Ks as m,La as h,Li as g,Mv as _,Nv as te,Ny as ne,PC as v,X as y,Xr as b,Y as re,Y_ as x,Ys as S,Zy as ie,_g as ae,_n as C,at as w,bg as T,br as E,by as D,ca as oe,co as O,da as se,fc as ce,fm as le,lE as k,mg as ue,no as A,ot as de,pc as fe,q_ as j,qs as M,sp as N,uE as pe,um as P,uo as me,up as he,vn as ge,wT as _e,zb as F}from"./loadAgentsDir-CbtNPJV3.js";import{Kr as ve,qr as ye}from"./src-DL3w8VPk2.js";import{Et as I,Gt as be,Q as L,St as R,Wt as z,dt as xe,pt as B}from"./state-BPFYBqm1.js";import{n as V,t as Se}from"./cwd-Besi3Os3.js";import{Q as H,Y as Ce,f as we,g as U}from"./settings-CvhsRFaT.js";import{M as W,c as Te,h as Ee,j as De}from"./config-BSkuQZNf.js";import{i as Oe,o as ke,q as Ae}from"./log-BlJ7CcKG.js";import{C as je,J as Me,Pt as G,U as K,_ as Ne,gt as Pe,u as Fe}from"./model-DlLO7TSx.js";import{at as Ie,nt as Le,xn as Re,yn as q}from"./prompt-BRGC5U9Y.js";import{Q as ze,T as Be,et as Ve}from"./sessionState-BlbRQ3Y6.js";import{a as He,n as Ue,r as We}from"./mappers-Del1KoA7.js";import{n as J,o as Ge,r as Y}from"./MessageSelector-Dtt2Sf65.js";import{n as Ke,t as qe}from"./systemTheme-Ceakddth.js";import{randomUUID as X}from"crypto";n(),i(),ve(),z(),V(),Ae(),ke(),H(),U(),W(),q(),Ee(),k(),G(),Me(),u(),Be(),c(),ne(),Ie(),te(),T(),le(),ce(),O(),A(),h(),g(),E(),C(),y(),de(),x(),l(),Ne(),D(),N();async function Je({tools:e,mainLoopModel:t,additionalWorkingDirectories:n,mcpClients:r,customSystemPrompt:i}){let[a,o,s]=await Promise.all([i===void 0?w(e,t,n,r):Promise.resolve([]),f(),i===void 0?j():Promise.resolve({})]);return{defaultSystemPrompt:a,userContext:o,systemContext:s}}async function Ye({tools:e,commands:t,mcpClients:n,messages:r,readFileState:i,getAppState:a,setAppState:o,customSystemPrompt:s,appendSystemPrompt:c,thinkingConfig:l,agents:u}){let d=Fe(),ee=a(),{defaultSystemPrompt:f,userContext:p,systemContext:m}=await Je({tools:e,mainLoopModel:d,additionalWorkingDirectories:Array.from(ee.toolPermissionContext.additionalWorkingDirectories.keys()),mcpClients:n,customSystemPrompt:s}),h=ze([...s===void 0?f:[s],...c?[c]:[]]),g=r.at(-1),_=g?.type===`assistant`&&g.message.stop_reason===null?r.slice(0,-1):r;return{systemPrompt:h,userContext:p,systemContext:m,toolUseContext:{options:{commands:t,debug:!1,mainLoopModel:d,tools:e,verbose:!1,thinkingConfig:l??(he()===!1?{type:`disabled`}:{type:`adaptive`}),mcpClients:n,mcpResources:{},isNonInteractiveSession:!0,agentDefinitions:{activeAgents:u,allAgents:[]},customSystemPrompt:s,appendSystemPrompt:c},abortController:F(),readFileState:i,getAppState:a,setAppState:o,messages:_,setInProgressToolUseIDs:()=>{},setResponseLength:()=>{},updateFileHistoryState:()=>{},updateAttributionState:()=>{}},forkContextMessages:_}}v(),Ue(),qe();function Xe(e){return e===`Agent`?Ce:e}function Ze(e){let t=we()?.outputStyle??`default`,n={type:`system`,subtype:`init`,cwd:Se(),session_id:B(),tools:e.tools.map(e=>Xe(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:Pe().source,betas:xe(),claude_code_version:`0.0.17`,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:X()};return n.fast_mode_state=K(e.model,e.fastMode),n}z(),l(),V(),Me(),Ne(),D(),N(),M();var Qe=()=>{try{return Y(),e(J)}catch{return null}},Z=class{constructor(e){a(this,`config`,void 0),a(this,`mutableMessages`,void 0),a(this,`abortController`,void 0),a(this,`permissionDenials`,void 0),a(this,`totalUsage`,void 0),a(this,`hasHandledOrphanedPermission`,!1),a(this,`readFileState`,void 0),a(this,`discoveredSkillNames`,new Set),a(this,`loadedNestedMemoryPaths`,new Set),this.config=e,this.mutableMessages=e.initialMessages??[],this.abortController=e.abortController??F(),this.permissionDenials=[],this.readFileState=e.readFileCache,this.totalUsage=Ve}async*submitMessage(e,n){let{cwd:i,commands:a,tools:c,mcpClients:l,verbose:u=!1,thinkingConfig:f,maxTurns:h,maxBudgetUsd:g,taskBudget:te,canUseTool:ne,customSystemPrompt:v,appendSystemPrompt:y,userSpecifiedModel:x,fallbackModel:ie,jsonSchema:C,getAppState:w,setAppState:T,replayUserMessages:E=!1,includePartialMessages:D=!1,agents:O=[],setSDKStatus:ce,orphanedPermission:le}=this.config;this.discoveredSkillNames.clear(),this.permissionDenials=[],d(i);let k=!be(),A=Date.now(),de=async(e,t,n,r,i,a)=>{let o=await ne(e,t,n,r,i,a);return o.behavior!==`allow`&&this.permissionDenials.push({type:`permission_denial`,tool_name:Xe(e.name),tool_use_id:i,tool_input:t}),o},j=w(),M=x?je(x):Fe(),N=f||(he()===!1?{type:`disabled`}:{type:`adaptive`});P(`before_getSystemPrompt`);let F=typeof v==`string`?v:void 0,{defaultSystemPrompt:ve,userContext:z,systemContext:xe}=await Je({tools:c,mainLoopModel:M,additionalWorkingDirectories:Array.from(j.toolPermissionContext.additionalWorkingDirectories.keys()),mcpClients:l,customSystemPrompt:F});P(`after_getSystemPrompt`);let V={...z},H=F!==void 0&&De()?await pe():null,Ce=ze([...F===void 0?ve:[F],...H?[H]:[],...y?[y]:[]]),we=c.some(e=>Re(e,Le));C&&we&&ge(T,B());let U={messages:this.mutableMessages,setMessages:e=>{this.mutableMessages=e(this.mutableMessages)},onChangeAPIKey:()=>{},handleElicitation:this.config.handleElicitation,options:{commands:a,debug:!1,tools:c,verbose:u,mainLoopModel:M,thinkingConfig:N,mcpClients:l,mcpResources:{},ideInstallationStatus:null,isNonInteractiveSession:!0,customSystemPrompt:v,appendSystemPrompt:y,agentDefinitions:{activeAgents:O,allAgents:[]},theme:Ke(Te().theme),maxBudgetUsd:g},getAppState:w,setAppState:T,abortController:this.abortController,readFileState:this.readFileState,nestedMemoryAttachmentTriggers:new Set,loadedNestedMemoryPaths:this.loadedNestedMemoryPaths,dynamicSkillDirTriggers:new Set,discoveredSkillNames:this.discoveredSkillNames,setInProgressToolUseIDs:()=>{},setResponseLength:()=>{},updateFileHistoryState:e=>{T(t=>{let n=e(t.fileHistory);return n===t.fileHistory?t:{...t,fileHistory:n}})},updateAttributionState:e=>{T(t=>{let n=e(t.attribution);return n===t.attribution?t:{...t,attribution:n}})},setSDKStatus:ce};if(le&&!this.hasHandledOrphanedPermission){this.hasHandledOrphanedPermission=!0;for await(let e of m(le,c,this.mutableMessages,U))yield e}let{messages:W,shouldQuery:Ee,allowedTools:ke,model:Ae,resultText:Me}=await Ge({input:e,mode:`prompt`,setToolJSX:()=>{},context:{...U,messages:this.mutableMessages},messages:this.mutableMessages,uuid:n?.uuid,isMeta:n?.isMeta,querySource:`sdk`});this.mutableMessages.push(...W);let G=[...this.mutableMessages];if(k&&W.length>0){let e=b(G);r()||(await e,(t(process.env.CLAUDE_CODE_EAGER_FLUSH)||t(process.env.CLAUDE_CODE_IS_COWORK))&&await s())}let Ne=Qe(),Pe=W.filter(e=>e.type===`user`&&!e.isMeta&&!e.toolUseResult&&(Ne?.selectableUserMessagesFilter(e)??!0)||e.type===`system`&&e.subtype===`compact_boundary`),Ie=E?Pe:[];T(e=>({...e,toolPermissionContext:{...e.toolPermissionContext,alwaysAllowRules:{...e.toolPermissionContext.alwaysAllowRules,command:ke}}}));let q=Ae??M;U={messages:G,setMessages:()=>{},onChangeAPIKey:()=>{},handleElicitation:this.config.handleElicitation,options:{commands:a,debug:!1,tools:c,verbose:u,mainLoopModel:q,thinkingConfig:N,mcpClients:l,mcpResources:{},ideInstallationStatus:null,isNonInteractiveSession:!0,customSystemPrompt:v,appendSystemPrompt:y,theme:Ke(Te().theme),agentDefinitions:{activeAgents:O,allAgents:[]},maxBudgetUsd:g},getAppState:w,setAppState:T,abortController:this.abortController,readFileState:this.readFileState,nestedMemoryAttachmentTriggers:new Set,loadedNestedMemoryPaths:this.loadedNestedMemoryPaths,dynamicSkillDirTriggers:new Set,discoveredSkillNames:this.discoveredSkillNames,setInProgressToolUseIDs:()=>{},setResponseLength:()=>{},updateFileHistoryState:U.updateFileHistoryState,updateAttributionState:U.updateAttributionState,setSDKStatus:ce},P(`before_skills_plugins`);let[Be,{enabled:Ue}]=await Promise.all([ee(Se()),me()]);if(P(`after_skills_plugins`),yield Ze({tools:c,mcpClients:l,model:q,permissionMode:j.toolPermissionContext.mode,commands:a,agents:O,skills:Be,plugins:Ue,fastMode:j.fastMode}),P(`system_message_yielded`),!Ee){for(let e of W)if(e.type===`user`&&typeof e.message.content==`string`&&(e.message.content.includes(`<local-command-stdout>`)||e.message.content.includes(`<local-command-stderr>`)||e.isCompactSummary)&&(yield{type:`user`,message:{...e.message,content:ye(e.message.content)},session_id:B(),parent_tool_use_id:null,uuid:e.uuid,timestamp:e.timestamp,isReplay:!e.isCompactSummary,isSynthetic:e.isMeta||e.isVisibleInTranscriptOnly}),e.type===`system`&&e.subtype===`local_command`&&typeof e.content==`string`&&(e.content.includes(`<local-command-stdout>`)||e.content.includes(`<local-command-stderr>`))&&(yield We(e.content,e.uuid)),e.type===`system`&&e.subtype===`compact_boundary`){let t=e;yield{type:`system`,subtype:`compact_boundary`,session_id:B(),uuid:e.uuid,compact_metadata:He(t.compactMetadata)}}k&&(await b(G),(t(process.env.CLAUDE_CODE_EAGER_FLUSH)||t(process.env.CLAUDE_CODE_IS_COWORK))&&await s()),yield{type:`result`,subtype:`success`,is_error:!1,duration_ms:Date.now()-A,duration_api_ms:R(),num_turns:G.length-1,result:Me??``,stop_reason:null,session_id:B(),total_cost_usd:I(),usage:this.totalUsage,modelUsage:L(),permission_denials:this.permissionDenials,fast_mode_state:K(q,j.fastMode),uuid:X()};return}if(ue()&&k){let e=Qe()?.selectableUserMessagesFilter??(e=>!0);W.filter(e).forEach(e=>{ae(e=>{T(t=>({...t,fileHistory:e(t.fileHistory)}))},e.uuid)})}let J=Ve,Y=1,qe=!1,Ye,Z=null,Q=Oe().at(-1),$e=C?se(this.mutableMessages,Le):0;for await(let e of fe({messages:G,systemPrompt:Ce,userContext:V,systemContext:xe,canUseTool:de,toolUseContext:U,fallbackModel:ie,querySource:`sdk`,maxTurns:h,taskBudget:te})){if(e.type===`assistant`||e.type===`user`||e.type===`system`&&e.subtype===`compact_boundary`){if(k&&e.type===`system`&&e.subtype===`compact_boundary`){let t=e.compactMetadata?.preservedSegment?.tailUuid;if(t){let e=this.mutableMessages.findLastIndex(e=>e.uuid===t);e!==-1&&await b(this.mutableMessages.slice(0,e+1))}}if(G.push(e),k&&(e.type===`assistant`?b(G):await b(G)),!qe&&Ie.length>0){qe=!0;for(let e of Ie)e.type===`user`&&(yield{type:`user`,message:e.message,session_id:B(),parent_tool_use_id:null,uuid:e.uuid,timestamp:e.timestamp,isReplay:!0})}}switch(e.type===`user`&&Y++,e.type){case`tombstone`:break;case`assistant`:{let t=e,n=t.message?.stop_reason;n!=null&&(Z=n),this.mutableMessages.push(t),yield*S(t);break}case`progress`:{let t=e;this.mutableMessages.push(t),k&&(G.push(t),b(G)),yield*S(t);break}case`user`:{let t=e;this.mutableMessages.push(t),yield*S(t);break}case`stream_event`:{let t=e.event;if(t.type===`message_start`){J=Ve;let e=t.message;J=o(J,e.usage)}if(t.type===`message_delta`){J=o(J,t.usage);let e=t.delta;e.stop_reason!=null&&(Z=e.stop_reason)}t.type===`message_stop`&&(this.totalUsage=re(this.totalUsage,J)),D&&(yield{type:`stream_event`,event:t,session_id:B(),parent_tool_use_id:null,uuid:X()});break}case`attachment`:{let n=e;this.mutableMessages.push(n),k&&(G.push(n),b(G));let r=n.attachment;if(r.type===`structured_output`)Ye=r.data;else if(r.type===`max_turns_reached`){k&&(t(process.env.CLAUDE_CODE_EAGER_FLUSH)||t(process.env.CLAUDE_CODE_IS_COWORK))&&await s(),yield{type:`result`,subtype:`error_max_turns`,duration_ms:Date.now()-A,duration_api_ms:R(),is_error:!0,num_turns:r.turnCount,stop_reason:Z,session_id:B(),total_cost_usd:I(),usage:this.totalUsage,modelUsage:L(),permission_denials:this.permissionDenials,fast_mode_state:K(q,j.fastMode),uuid:X(),errors:[`Reached maximum number of turns (${r.maxTurns})`]};return}else E&&r.type===`queued_command`&&(yield{type:`user`,message:{role:`user`,content:r.prompt},session_id:B(),parent_tool_use_id:null,uuid:r.source_uuid||n.uuid,timestamp:n.timestamp,isReplay:!0});break}case`stream_request_start`:break;case`system`:{let t=e,n=this.config.snipReplay?.(t,this.mutableMessages);if(n!==void 0){n.executed&&(this.mutableMessages.length=0,this.mutableMessages.push(...n.messages));break}if(this.mutableMessages.push(t),t.subtype===`compact_boundary`&&t.compactMetadata){let e=t,n=this.mutableMessages.length-1;n>0&&this.mutableMessages.splice(0,n);let r=G.length-1;r>0&&G.splice(0,r),yield{type:`system`,subtype:`compact_boundary`,session_id:B(),uuid:t.uuid,compact_metadata:He(e.compactMetadata)}}if(t.subtype===`api_error`){let e=t;yield{type:`system`,subtype:`api_retry`,attempt:e.retryAttempt,max_retries:e.maxRetries,retry_delay_ms:e.retryInMs,error_status:e.error.status??null,error:_(e.error),session_id:B(),uuid:t.uuid}}break}case`tool_use_summary`:{let t=e;yield{type:`tool_use_summary`,summary:t.summary,preceding_tool_use_ids:t.precedingToolUseIds,session_id:B(),uuid:t.uuid};break}}if(g!==void 0&&I()>=g){k&&(t(process.env.CLAUDE_CODE_EAGER_FLUSH)||t(process.env.CLAUDE_CODE_IS_COWORK))&&await s(),yield{type:`result`,subtype:`error_max_budget_usd`,duration_ms:Date.now()-A,duration_api_ms:R(),is_error:!0,num_turns:Y,stop_reason:Z,session_id:B(),total_cost_usd:I(),usage:this.totalUsage,modelUsage:L(),permission_denials:this.permissionDenials,fast_mode_state:K(q,j.fastMode),uuid:X(),errors:[`Reached maximum budget ($${g}). Increase the limit with --max-budget-usd or start a new session.`]};return}if(e.type===`user`&&C){let e=se(this.mutableMessages,Le)-$e,n=parseInt(process.env.MAX_STRUCTURED_OUTPUT_RETRIES||`5`,10);if(e>=n){k&&(t(process.env.CLAUDE_CODE_EAGER_FLUSH)||t(process.env.CLAUDE_CODE_IS_COWORK))&&await s(),yield{type:`result`,subtype:`error_max_structured_output_retries`,duration_ms:Date.now()-A,duration_api_ms:R(),is_error:!0,num_turns:Y,stop_reason:Z,session_id:B(),total_cost_usd:I(),usage:this.totalUsage,modelUsage:L(),permission_denials:this.permissionDenials,fast_mode_state:K(q,j.fastMode),uuid:X(),errors:[`Failed to provide valid structured output after ${n} attempts`]};return}}}let $=G.findLast(e=>e.type===`assistant`||e.type===`user`),et=$?.type??`undefined`,tt=$?.type===`assistant`?_e($.message.content)?.type??`none`:`n/a`;if(k&&(t(process.env.CLAUDE_CODE_EAGER_FLUSH)||t(process.env.CLAUDE_CODE_IS_COWORK))&&await s(),!p($,Z)){yield{type:`result`,subtype:`error_during_execution`,duration_ms:Date.now()-A,duration_api_ms:R(),is_error:!0,num_turns:Y,stop_reason:Z,session_id:B(),total_cost_usd:I(),usage:this.totalUsage,modelUsage:L(),permission_denials:this.permissionDenials,fast_mode_state:K(q,j.fastMode),uuid:X(),errors:(()=>{let e=Oe(),t=Q?e.lastIndexOf(Q)+1:0;return[`[ede_diagnostic] result_type=${et} last_content_type=${tt} stop_reason=${Z}`,...e.slice(t).map(e=>e.error)]})()};return}let nt=``,rt=!1;if($.type===`assistant`){let e=_e($.message.content);e?.type===`text`&&!oe.has(e.text)&&(nt=e.text),rt=!!$.isApiErrorMessage}yield{type:`result`,subtype:`success`,is_error:rt,duration_ms:Date.now()-A,duration_api_ms:R(),num_turns:Y,result:nt,stop_reason:Z,session_id:B(),total_cost_usd:I(),usage:this.totalUsage,modelUsage:L(),permission_denials:this.permissionDenials,structured_output:Ye,fast_mode_state:K(q,j.fastMode),uuid:X()}}interrupt(){this.abortController.abort()}resetAbortController(){this.abortController=F()}getAbortSignal(){return this.abortController.signal}getMessages(){return this.mutableMessages}getReadFileState(){return this.readFileState}getSessionId(){return B()}setModel(e){this.config.userSpecifiedModel=e}};async function*Q({commands:e,prompt:t,promptUuid:n,isMeta:r,cwd:i,tools:a,mcpClients:o,verbose:s=!1,thinkingConfig:c,maxTurns:l,maxBudgetUsd:u,taskBudget:d,canUseTool:ee,mutableMessages:f=[],getReadFileCache:p,setReadFileCache:m,customSystemPrompt:h,appendSystemPrompt:g,userSpecifiedModel:_,fallbackModel:te,jsonSchema:ne,getAppState:v,setAppState:y,abortController:b,replayUserMessages:re=!1,includePartialMessages:x=!1,handleElicitation:S,agents:ae=[],setSDKStatus:C,orphanedPermission:w}){let T=new Z({cwd:i,tools:a,commands:e,mcpClients:o,agents:ae??[],canUseTool:ee,getAppState:v,setAppState:y,initialMessages:f,readFileCache:ie(p()),customSystemPrompt:h,appendSystemPrompt:g,userSpecifiedModel:_,fallbackModel:te,thinkingConfig:c,maxTurns:l,maxBudgetUsd:u,taskBudget:d,jsonSchema:ne,verbose:s,handleElicitation:S,replayUserMessages:re,includePartialMessages:x,setSDKStatus:C,abortController:b,orphanedPermission:w});try{yield*T.submitMessage(t,{uuid:n,isMeta:r})}finally{m(T.getReadFileState())}}export{Q as n,Ye as r,Z as t};
@@ -1 +0,0 @@
1
- import{t as e}from"./REPL-cAXdORs2.js";export{e as REPL};