@readmagic/workmate 0.0.15 → 0.0.16

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 (273) hide show
  1. package/dist/chunks/{AddWorkspaceDirectory-DcVnvL_u.js → AddWorkspaceDirectory-DAtfMH4o.js} +1 -1
  2. package/dist/chunks/{AgentsMdExternalIncludesDialog-D6DopTxc.js → AgentsMdExternalIncludesDialog-BTYgjY5c.js} +1 -1
  3. package/dist/chunks/AgentsMdExternalIncludesDialog-C6VH6JG6.js +1 -0
  4. package/dist/chunks/{App-BoI5EJry.js → App-HF0bvxi_.js} +1 -1
  5. package/dist/chunks/ApproveApiKey-B7mKgSqY.js +1 -0
  6. package/dist/chunks/{ApproveApiKey-BjlQDcMx.js → ApproveApiKey-BBFLw2B7.js} +1 -1
  7. package/dist/chunks/{BackgroundTasksDialog-ClSMkcGp.js → BackgroundTasksDialog-Coc0ecUd.js} +1 -1
  8. package/dist/chunks/{BypassPermissionsModeDialog-KCZv-PXl.js → BypassPermissionsModeDialog--Gx9ARd4.js} +1 -1
  9. package/dist/chunks/{DiffDialog-BGBkuVIn.js → DiffDialog-tlINuFS1.js} +1 -1
  10. package/dist/chunks/Doctor-BJf49FWX.js +1 -0
  11. package/dist/chunks/{Doctor-CI04juFO.js → Doctor-Wh7z6CnF.js} +2 -2
  12. package/dist/chunks/ExitFlow-B1zHTqQt.js +2 -0
  13. package/dist/chunks/{Grove-B-M3DWD3.js → Grove-1Kf7xxIV.js} +1 -1
  14. package/dist/chunks/{HybridTransport-n5jji6SI.js → HybridTransport-DWqWUZCH.js} +1 -1
  15. package/dist/chunks/{InvalidConfigDialog-By-j6fHE.js → InvalidConfigDialog-OZPFQSnC.js} +1 -1
  16. package/dist/chunks/{InvalidSettingsDialog-C_reeMzL.js → InvalidSettingsDialog-BNCm-eyC.js} +1 -1
  17. package/dist/chunks/MCPConnectionManager-7H84oi5n.js +1 -0
  18. package/dist/chunks/{MCPToolListView-jw0tITfc.js → MCPToolListView-CVgtg3Iq.js} +1 -1
  19. package/dist/chunks/{McpParsingWarnings-BeZ3Bn8N.js → McpParsingWarnings-CN8f449l.js} +1 -1
  20. package/dist/chunks/{MessageSelector-Ci6N-gCw.js → MessageSelector-B9j6zZ5w.js} +1 -1
  21. package/dist/chunks/Messages-yz1m39eI.js +10 -0
  22. package/dist/chunks/{Onboarding-DDkVEq-G.js → Onboarding-bFbgae8m.js} +1 -1
  23. package/dist/chunks/{PromptInputFooterSuggestions-BlhZuQ5F.js → PromptInputFooterSuggestions-CE_yVun1.js} +1 -1
  24. package/dist/chunks/PromptInputHelpMenu-TPWuGwAy.js +1 -0
  25. package/dist/chunks/QueryEngine-CRobcENE.js +1 -0
  26. package/dist/chunks/REPL-BhCC0JP6.js +1 -0
  27. package/dist/chunks/REPL-C33mMf_q.js +128 -0
  28. package/dist/chunks/{RemoteSessionManager-mWVrdNfS.js → RemoteSessionManager-BjVD918g.js} +2 -2
  29. package/dist/chunks/{ResumeConversation-BzTn_1jS.js → ResumeConversation-CXd8d8po.js} +1 -1
  30. package/dist/chunks/{SSETransport-D86IVNn1.js → SSETransport-BSilVN9e.js} +1 -1
  31. package/dist/chunks/SearchExtraToolsTool-DoiCI2uJ.js +1 -0
  32. package/dist/chunks/Settings-ClcLl0C1.js +2 -0
  33. package/dist/chunks/{TeleportProgress-CW8mLRy2.js → TeleportProgress-DonJUoPc.js} +1 -1
  34. package/dist/chunks/{TeleportRepoMismatchDialog-DZD32R-l.js → TeleportRepoMismatchDialog-ByOuSVVz.js} +1 -1
  35. package/dist/chunks/{TeleportResumeWrapper-BhuUE1aq.js → TeleportResumeWrapper-BBtELwF1.js} +1 -1
  36. package/dist/chunks/{ThemePicker-ByQZgIbH.js → ThemePicker-1QQJFOEv.js} +1 -1
  37. package/dist/chunks/{TrustDialog-BzwibD_8.js → TrustDialog-DwJ9L_u4.js} +1 -1
  38. package/dist/chunks/{add-dir-BQ-ljgk6.js → add-dir-DOKdPFT2.js} +1 -1
  39. package/dist/chunks/{agentDisplay-tRprY4gB.js → agentDisplay-TX1bh-lX.js} +1 -1
  40. package/dist/chunks/{agents-Dq4BCf0H.js → agents-C58tRxpi.js} +1 -1
  41. package/dist/chunks/{agents-DMyQUXwl.js → agents-CbRjX9Pj.js} +6 -6
  42. package/dist/chunks/{allErrors-CQWZ6BPw.js → allErrors-DRiW7i6Y.js} +1 -1
  43. package/dist/chunks/api-C8uOHD-v.js +1 -0
  44. package/dist/chunks/{api-ClAyS7cQ.js → api-CazVavfB.js} +1 -1
  45. package/dist/chunks/auth-BL238vgr.js +1 -0
  46. package/dist/chunks/auth-CfrCl9BZ.js +10 -0
  47. package/dist/chunks/auth-D3GkU6d7.js +1 -0
  48. package/dist/chunks/{backgroundHousekeeping-rzQFJiND.js → backgroundHousekeeping-CPLlaWcV.js} +2 -2
  49. package/dist/chunks/backgroundHousekeeping-Du2tN2WE.js +1 -0
  50. package/dist/chunks/{branch-BWbCrXBJ.js → branch-pAa0oBaj.js} +1 -1
  51. package/dist/chunks/{bridgeConfig-CPHAyzdg.js → bridgeConfig-DnFfCpGd.js} +1 -1
  52. package/dist/chunks/bridgeConfig-joBqeK0j.js +1 -0
  53. package/dist/chunks/{bridgeMessaging-vR7uQXB9.js → bridgeMessaging-B_hnuUHb.js} +1 -1
  54. package/dist/chunks/{bridgeStatusUtil-CHTx7XwJ.js → bridgeStatusUtil-Dwz4YHNA.js} +1 -1
  55. package/dist/chunks/{btw-IGcgP-Qq.js → btw-CkVkYeRr.js} +1 -1
  56. package/dist/chunks/{caches-FP8mGB4k.js → caches-BLQUkrIG.js} +1 -1
  57. package/dist/chunks/caches-DsFl83sh.js +1 -0
  58. package/dist/chunks/{ccrClient--8aPutWE.js → ccrClient-AfdUbWzY.js} +1 -1
  59. package/dist/chunks/{clear-CF-FZwpe.js → clear-Ac3qYi_-.js} +1 -1
  60. package/dist/chunks/client-BX0r6K3I.js +1 -0
  61. package/dist/chunks/client-Bb2eZnuq.js +1 -0
  62. package/dist/chunks/client-DNEVh6Wu.js +1 -0
  63. package/dist/chunks/client-Pap_HyZZ.js +1 -0
  64. package/dist/chunks/client-zhozU2ws.js +1 -0
  65. package/dist/chunks/commands-BKLsl6gK.js +1 -0
  66. package/dist/chunks/{compact-BrJGpEFZ.js → compact-CXuDr5qM.js} +1 -1
  67. package/dist/chunks/config-DrY1SvhQ.js +1 -0
  68. package/dist/chunks/{context-DADnwl4t.js → context-C2plOqH4.js} +1 -1
  69. package/dist/chunks/context-noninteractive-DpVlZ-wP.js +1 -0
  70. package/dist/chunks/{context-noninteractive-kACWzgS1.js → context-noninteractive-fVQtwEkw.js} +1 -1
  71. package/dist/chunks/conversation-C0yysXds.js +1 -0
  72. package/dist/chunks/{conversation-C8w1DtXk.js → conversation-DQpS6nvg.js} +1 -1
  73. package/dist/chunks/{createSSHSession-B71Plec6.js → createSSHSession-CfyFuJMH.js} +1 -1
  74. package/dist/chunks/createSession-CmBawnsh.js +1 -0
  75. package/dist/chunks/{createSession-BJeDECzt.js → createSession-qk9C66lK.js} +1 -1
  76. package/dist/chunks/{crossProjectResume-B1I6YzXr.js → crossProjectResume-DY1ZBO5P.js} +1 -1
  77. package/dist/chunks/{datadog-C9uqPA6N.js → datadog-Cr0VKbct.js} +1 -1
  78. package/dist/chunks/{diff-CzChvQyK.js → diff-BNjcCXDr.js} +1 -1
  79. package/dist/chunks/doctor-BkCtT7H1.js +1 -0
  80. package/dist/chunks/{entry-BoL8sy1Y.js → entry-o9IZPS4g.js} +2 -2
  81. package/dist/chunks/{esm-DtcV71xh.js → esm-BI3tFLyy.js} +1 -1
  82. package/dist/chunks/exit-Dlyj7nY8.js +1 -0
  83. package/dist/chunks/extraUsage-5Ueiyw6W.js +1 -0
  84. package/dist/chunks/extractMemories-DnTBWFOW.js +1 -0
  85. package/dist/chunks/fast-B3fRp1xO.js +1 -0
  86. package/dist/chunks/fast-ClOKONyD.js +1 -0
  87. package/dist/chunks/fetchModelList-B8KG79EK.js +1 -0
  88. package/dist/chunks/fetchModelList-gh_jFYai.js +1 -0
  89. package/dist/chunks/{fileSuggestions-DU7gmksK.js → fileSuggestions-DK7W8kLF.js} +1 -1
  90. package/dist/chunks/{firstPartyEventLogger-7pAyUdbp.js → firstPartyEventLogger-BMnXb9cv.js} +2 -2
  91. package/dist/chunks/firstPartyEventLogger-YYOb8aIo.js +1 -0
  92. package/dist/chunks/{flushGate-4DfYr-Ru.js → flushGate-n4kK6H1U.js} +1 -1
  93. package/dist/chunks/{gemini-Cll4fVQn.js → gemini-C8-QHnsC.js} +1 -1
  94. package/dist/chunks/{generateSessionName-BgGMwpps.js → generateSessionName-C8DnAVaa.js} +1 -1
  95. package/dist/chunks/{goal-D4E2WQVn.js → goal-DMmzlZOF.js} +1 -1
  96. package/dist/chunks/grok-LLjpAwP_.js +1 -0
  97. package/dist/chunks/{grove-Bck1zFaD.js → grove-CQBCzeHf.js} +1 -1
  98. package/dist/chunks/{help-DJp61Job.js → help-JH7WzjZP.js} +1 -1
  99. package/dist/chunks/hooks-COhKt_pF.js +1 -0
  100. package/dist/chunks/{hooks-CJ17byYD.js → hooks-DD2jpRfx.js} +1 -1
  101. package/dist/chunks/initReplBridge-BDaN0hpY.js +1 -0
  102. package/dist/chunks/{install-Dd5fw0cA.js → install-CD4or0vj.js} +1 -1
  103. package/dist/chunks/{instrumentation-jsPu6qqs.js → instrumentation-n-otwpYf.js} +4 -4
  104. package/dist/chunks/{job-BHhkQbvu.js → job-B-pEWgXI.js} +1 -1
  105. package/dist/chunks/keybindings-qed9q9tx.js +1 -0
  106. package/dist/chunks/{launchLocalMemory-DsaijVcO.js → launchLocalMemory-cBovdGMT.js} +1 -1
  107. package/dist/chunks/{launchOnboarding-DHOylaqn.js → launchOnboarding-B__wtt7p.js} +1 -1
  108. package/dist/chunks/{loadAgentsDir-CwEfQDOw.js → loadAgentsDir-PPiD2Mfq.js} +569 -569
  109. package/dist/chunks/loadAgentsDir-qvqrTVuS.js +1 -0
  110. package/dist/chunks/{loadPluginHooks-C-Yk5KlI.js → loadPluginHooks-DUCuU3_8.js} +1 -1
  111. package/dist/chunks/localSearch-CDk_stXJ.js +1 -0
  112. package/dist/chunks/{localSearch-BEnlgSB7.js → localSearch-Cvs9WfoX.js} +1 -1
  113. package/dist/chunks/{logoV2Utils-DG9GwFjl.js → logoV2Utils-Bkj74dtY.js} +1 -1
  114. package/dist/chunks/{magicDocs-qGHR3Cqh.js → magicDocs-3U6peChg.js} +2 -2
  115. package/dist/chunks/{main-CBVQ8bRm.js → main-DkjxhBIC.js} +26 -26
  116. package/dist/chunks/{managedEnv-3MbOWrVs.js → managedEnv-BUrzwaD3.js} +1 -1
  117. package/dist/chunks/managedEnv-XOUMOtEF.js +1 -0
  118. package/dist/chunks/{mappers-CdY45PDA.js → mappers-ZGgwqDOK.js} +1 -1
  119. package/dist/chunks/{mcp-DvY_FibT.js → mcp-COZxwgJZ.js} +3 -3
  120. package/dist/chunks/{mcp-DI8pGrqi.js → mcp-CdyNeNzh.js} +1 -1
  121. package/dist/chunks/{mcp-BA8XQ6h1.js → mcp-CysOyBIn.js} +1 -1
  122. package/dist/chunks/{memory-C2U7CCmM.js → memory-B5h2TTSS.js} +1 -1
  123. package/dist/chunks/{mode-ByV6NqmB.js → mode-D3yY1fdK.js} +1 -1
  124. package/dist/chunks/model-Bz4JHoU0.js +1 -0
  125. package/dist/chunks/model-g6XBcNAG.js +1 -0
  126. package/dist/chunks/{model-CeG-iOKF.js → model-sviY1inu.js} +1 -1
  127. package/dist/chunks/modelOptions-DYQqTLPi.js +1 -0
  128. package/dist/chunks/{nativeInstaller-CXFD8LDV.js → nativeInstaller-N1xiUpCP.js} +1 -1
  129. package/dist/chunks/{omit-B65XeX8r.js → omit-BOILu8jW.js} +1 -1
  130. package/dist/chunks/{onChangeAppState-EtUxsgYz.js → onChangeAppState-COFFZAXb.js} +1 -1
  131. package/dist/chunks/{openai-Dx5mvMjY.js → openai-BHM5kEFo.js} +2 -2
  132. package/dist/chunks/openai-CR3CcjCE.js +17 -0
  133. package/dist/chunks/{partition-8vZDG3rY.js → partition-C1SFDk_L.js} +1 -1
  134. package/dist/chunks/{permissions-CJUBfBTr.js → permissions-uy_NFbfy.js} +2 -2
  135. package/dist/chunks/{pidLock-tjm2n1Nd.js → pidLock-DuMVSwnN.js} +2 -2
  136. package/dist/chunks/{plan-eFur8bdH.js → plan-DF9YSB5M.js} +1 -1
  137. package/dist/chunks/{plugin-fYLRLdOY.js → plugin-GRPzqgTr.js} +1 -1
  138. package/dist/chunks/{pluginAutoupdate-B4w7SSYc.js → pluginAutoupdate-AMD-FvKB.js} +1 -1
  139. package/dist/chunks/{pluginBlocklist-CMwb7gmY.js → pluginBlocklist-DNxkAxH6.js} +1 -1
  140. package/dist/chunks/{pluginCliCommands-3YCj7Y3Q.js → pluginCliCommands-BFoR1ZXx.js} +1 -1
  141. package/dist/chunks/{pluginFlagging-srvq9H7p.js → pluginFlagging-CW2IZWSI.js} +1 -1
  142. package/dist/chunks/{pluginOperations-C7BCR7pw.js → pluginOperations-DlWE0idP.js} +1 -1
  143. package/dist/chunks/{pluginStartupCheck-BLc0U7W7.js → pluginStartupCheck-AQGV0DCS.js} +1 -1
  144. package/dist/chunks/pluginStartupCheck-DWpquqxx.js +1 -0
  145. package/dist/chunks/{plugins-CPtmmDDi.js → plugins-CwUSTE4E.js} +1 -1
  146. package/dist/chunks/print-9wR_ijrL.js +14 -0
  147. package/dist/chunks/{processBashCommand-C9-FonuX.js → processBashCommand-Deqwq1IE.js} +1 -1
  148. package/dist/chunks/{processSlashCommand-Bi8_1MRC.js → processSlashCommand-U9LJ4Keq.js} +2 -2
  149. package/dist/chunks/prompt-BBeDQXIs.js +1 -0
  150. package/dist/chunks/{prompt-Bm2EEG4F.js → prompt-CQmEvnKN.js} +1 -1
  151. package/dist/chunks/prompt-CXhdqgB7.js +1 -0
  152. package/dist/chunks/{promptEditor-DQ9fpdQD.js → promptEditor-Bf72KNF-.js} +1 -1
  153. package/dist/chunks/{reconciler-DgQ4y1Vn.js → reconciler-Css9bs07.js} +1 -1
  154. package/dist/chunks/{refresh-CayVRWUY.js → refresh-B87z39Zs.js} +1 -1
  155. package/dist/chunks/{reload-plugins-6xcH3dLg.js → reload-plugins-BpmUIkfm.js} +1 -1
  156. package/dist/chunks/{remoteBridgeCore-BnZYGaMH.js → remoteBridgeCore-BCLIIygk.js} +1 -1
  157. package/dist/chunks/{remoteManagedSettings-CfFmrRze.js → remoteManagedSettings-Ahgn2e80.js} +1 -1
  158. package/dist/chunks/{rename-mDtCTbnD.js → rename-BUt3PliQ.js} +1 -1
  159. package/dist/chunks/{resume-DRvz4QFs.js → resume-uZI9p_FE.js} +1 -1
  160. package/dist/chunks/{runtimeObserver-Ba6SM-sI.js → runtimeObserver-AKOWfdZ_.js} +1 -1
  161. package/dist/chunks/{runtimeObserver-Dt5sGJVb.js → runtimeObserver-By59MZKJ.js} +2 -2
  162. package/dist/chunks/sandbox-adapter-D4Uho1vF.js +1 -0
  163. package/dist/chunks/{sandbox-toggle-DKcw3SbO.js → sandbox-toggle-BdvylnWS.js} +1 -1
  164. package/dist/chunks/searchExtraTools-BHMkqGBf.js +1 -0
  165. package/dist/chunks/{session-COVyD8UU.js → session-Tm2-rzBY.js} +1 -1
  166. package/dist/chunks/sessionFileAccessHooks-BaWZ8sqn.js +1 -0
  167. package/dist/chunks/{sessionObserver-iAgSetlC.js → sessionObserver-BAr8AWeL.js} +1 -1
  168. package/dist/chunks/sessionObserver-KB1UL_n2.js +1 -0
  169. package/dist/chunks/{sessionState-zhvcDpb2.js → sessionState-BTFowSpR.js} +2 -2
  170. package/dist/chunks/sessionStorage-D6nlmaI-.js +1 -0
  171. package/dist/chunks/{sessionTitle-QPRly1tZ.js → sessionTitle-SCqmSDYM.js} +1 -1
  172. package/dist/chunks/{sessionTracing-C4uqAdud.js → sessionTracing-CvY4udYI.js} +1 -1
  173. package/dist/chunks/{settingsSync-BGo6dHJo.js → settingsSync-nxeaGM2-.js} +1 -1
  174. package/dist/chunks/setup-D4FPeBnM.js +3 -0
  175. package/dist/chunks/{shadowedRuleDetection-CzRAzcC1.js → shadowedRuleDetection-Co8m1q1D.js} +1 -1
  176. package/dist/chunks/{sideQuestion-oIYrx5ar.js → sideQuestion-4TJYn-Az.js} +1 -1
  177. package/dist/chunks/{sinks-Bje3hCkR.js → sinks-Bb2i50kz.js} +1 -1
  178. package/dist/chunks/sinks-D1opmy_x.js +1 -0
  179. package/dist/chunks/skillChangeDetector-BU9AFG0i.js +1 -0
  180. package/dist/chunks/{skillGapStore-CJjt3IW7.js → skillGapStore-BcVP3ZUb.js} +2 -2
  181. package/dist/chunks/{skillLifecycle-BsgH84vl.js → skillLifecycle-CG2XmS8f.js} +2 -2
  182. package/dist/chunks/{skillSearchPanel-CneXymsb.js → skillSearchPanel-DOJmUBXB.js} +4 -4
  183. package/dist/chunks/{skills-DZRBy7vT.js → skills-DIgCWvzX.js} +1 -1
  184. package/dist/chunks/{status-BP_R8051.js → status-Ber2xOXc.js} +2 -2
  185. package/dist/chunks/status-CVcXPoOZ.js +1 -0
  186. package/dist/chunks/{statusNoticeHelpers-ODrnrLAZ.js → statusNoticeHelpers-CYkrPUpN.js} +1 -1
  187. package/dist/chunks/{switcher-BkGOeIzI.js → switcher-BIP3rbQn.js} +1 -1
  188. package/dist/chunks/switcher-zbG6T9dN.js +1 -0
  189. package/dist/chunks/syncCache-AMQMQ_HR.js +1 -0
  190. package/dist/chunks/{tasks-CIUuwrX4.js → tasks-BKERIO4G.js} +1 -1
  191. package/dist/chunks/{teleport-IzyDplC7.js → teleport-DOXbf2sQ.js} +1 -1
  192. package/dist/chunks/{templateJobs-De57J461.js → templateJobs-dg2F45ZJ.js} +1 -1
  193. package/dist/chunks/{theme-Nwii7354.js → theme-BGxytGjA.js} +1 -1
  194. package/dist/chunks/{toolEventObserver-Cq-uBb0-.js → toolEventObserver-CJhg_p3P.js} +1 -1
  195. package/dist/chunks/toolPool-C0d7Bznl.js +1 -0
  196. package/dist/chunks/{trustedDevice-DWZxDUxS.js → trustedDevice-BtXHXu-T.js} +1 -1
  197. package/dist/chunks/trustedDevice-hw3iq84W.js +1 -0
  198. package/dist/chunks/{useExitOnCtrlCDWithKeybindings-D48aDPG9.js → useExitOnCtrlCDWithKeybindings-C9orgrub.js} +1 -1
  199. package/dist/chunks/useMainLoopModel-BigVcn2T.js +1 -0
  200. package/dist/chunks/{useManagePlugins-EqoQELMT.js → useManagePlugins-Bt-DYAnX.js} +1 -1
  201. package/dist/chunks/{useMergedTools-BJ4L9QSK.js → useMergedTools-CZeQBdky.js} +1 -1
  202. package/dist/chunks/{useSearchInput-DkVER3cm.js → useSearchInput-DdKrVHJS.js} +1 -1
  203. package/dist/chunks/{useSettingsErrors-D3MlQ1GF.js → useSettingsErrors-BR9Wws7D.js} +1 -1
  204. package/dist/chunks/{userAgent-aoe_xVAb.js → userAgent-DUt0q-Vl.js} +1 -1
  205. package/dist/chunks/{util-g-5UX5gH.js → util-h-Hmdke_.js} +1 -1
  206. package/dist/chunks/{validatePlugin-CSE8zjZn.js → validatePlugin-mWVKNtJa.js} +1 -1
  207. package/dist/chunks/{workerRegistry-DGwy0YHB.js → workerRegistry-dlfqtySm.js} +2 -2
  208. package/dist/chunks/worktree-IxcFe7g-.js +1 -0
  209. package/dist/cli.js +1 -1
  210. package/package.json +1 -1
  211. package/dist/chunks/AgentsMdExternalIncludesDialog-0Qdg3Rh7.js +0 -1
  212. package/dist/chunks/ApproveApiKey-PWFcscjY.js +0 -1
  213. package/dist/chunks/Doctor-DCrqcW68.js +0 -1
  214. package/dist/chunks/ExitFlow-qrCDVA9i.js +0 -2
  215. package/dist/chunks/MCPConnectionManager-BNG7iSlw.js +0 -1
  216. package/dist/chunks/Messages-D6CRTH2m.js +0 -10
  217. package/dist/chunks/PromptInputHelpMenu-kKyPIMau.js +0 -1
  218. package/dist/chunks/QueryEngine-DXpS0Ytq.js +0 -1
  219. package/dist/chunks/REPL-D1BCm7cR.js +0 -128
  220. package/dist/chunks/REPL-JQgCrSEv.js +0 -1
  221. package/dist/chunks/SearchExtraToolsTool-BXIja1MR.js +0 -1
  222. package/dist/chunks/Settings-D_i8HzEW.js +0 -2
  223. package/dist/chunks/api-CpD5jeKe.js +0 -1
  224. package/dist/chunks/auth-CWAvPfX7.js +0 -10
  225. package/dist/chunks/auth-DG5bkWDc.js +0 -1
  226. package/dist/chunks/auth-DuHfQBuH.js +0 -1
  227. package/dist/chunks/backgroundHousekeeping-kf_v7Vfr.js +0 -1
  228. package/dist/chunks/bridgeConfig-CABsoOum.js +0 -1
  229. package/dist/chunks/caches-Dj1YhqrG.js +0 -1
  230. package/dist/chunks/client-B7WkO81L.js +0 -17
  231. package/dist/chunks/client-BCzhAEd0.js +0 -1
  232. package/dist/chunks/client-BU7upHOb.js +0 -1
  233. package/dist/chunks/commands-Cr1p7OPH.js +0 -1
  234. package/dist/chunks/config-BohF3_IV.js +0 -1
  235. package/dist/chunks/context-noninteractive-BAbzwNxu.js +0 -1
  236. package/dist/chunks/conversation-Ds7zRD0x.js +0 -1
  237. package/dist/chunks/createSession-Bozo4Bu8.js +0 -1
  238. package/dist/chunks/doctor-DdvdGkNX.js +0 -1
  239. package/dist/chunks/exit-Af27f74w.js +0 -1
  240. package/dist/chunks/extraUsage-DsFwXMAj.js +0 -1
  241. package/dist/chunks/extractMemories-B1KbTMY0.js +0 -1
  242. package/dist/chunks/fast-BGU8p2uY.js +0 -1
  243. package/dist/chunks/fast-CuUjONVV.js +0 -1
  244. package/dist/chunks/firstPartyEventLogger-sMeCTEUW.js +0 -1
  245. package/dist/chunks/grok-HF1PHxXb.js +0 -1
  246. package/dist/chunks/hooks-CjR3Eq0Z.js +0 -1
  247. package/dist/chunks/initReplBridge-D09JEKHt.js +0 -1
  248. package/dist/chunks/keybindings-Ch5lzNB8.js +0 -1
  249. package/dist/chunks/loadAgentsDir-8FioUEwX.js +0 -1
  250. package/dist/chunks/localSearch-LcgRjjl3.js +0 -1
  251. package/dist/chunks/managedEnv-B4YV3A_y.js +0 -1
  252. package/dist/chunks/model-C73ETGu9.js +0 -1
  253. package/dist/chunks/model-CVG_RRTy.js +0 -1
  254. package/dist/chunks/modelOptions-A5jrCUBp.js +0 -1
  255. package/dist/chunks/pluginStartupCheck-nzVDPI1k.js +0 -1
  256. package/dist/chunks/print-BCud0ukQ.js +0 -14
  257. package/dist/chunks/prompt-CX_v9F3s.js +0 -1
  258. package/dist/chunks/prompt-V0WQJrkO2.js +0 -1
  259. package/dist/chunks/sandbox-adapter-Cmrd6tBj.js +0 -1
  260. package/dist/chunks/searchExtraTools-DIgC0CFB.js +0 -1
  261. package/dist/chunks/sessionFileAccessHooks-yAPDTrbm.js +0 -1
  262. package/dist/chunks/sessionObserver-BizdPx8P.js +0 -1
  263. package/dist/chunks/sessionStorage-LMY409Ji.js +0 -1
  264. package/dist/chunks/setup-Bjw5VS6x.js +0 -3
  265. package/dist/chunks/sinks-FaljTZ-c.js +0 -1
  266. package/dist/chunks/skillChangeDetector-v6mAYzXX.js +0 -1
  267. package/dist/chunks/status-CZYD3NGb.js +0 -1
  268. package/dist/chunks/switcher-DwKN9daN.js +0 -1
  269. package/dist/chunks/syncCache-CpmpvjfC.js +0 -1
  270. package/dist/chunks/toolPool-BBU4ll_p.js +0 -1
  271. package/dist/chunks/trustedDevice-BKzkA7fq.js +0 -1
  272. package/dist/chunks/useMainLoopModel-89eUU13X.js +0 -1
  273. package/dist/chunks/worktree-jjuORs7p.js +0 -1
@@ -1 +1 @@
1
- import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{n,t as r}from"./figures-5ThXQEtq.js";import{$u as i,Dp as a,F as o,N as s,Op as c,P as l,Qu as u,cd as d,hC as f,ld as p}from"./loadAgentsDir-CwEfQDOw.js";import{D as m,I as h,P as g,T as _,Wt as v,ai as y,t as b,vn as x,y as S,yn as C}from"./src-DL3w8VPk2.js";import{t as w}from"./jsx-runtime-Bb4Xn-E0.js";import{r as T,t as E}from"./directoryCompletion-i2oWpaUe.js";import{r as D,t as O}from"./PromptInputFooterSuggestions-BlhZuQ5F.js";function k(){return(0,P.jsx)(g,{dimColor:!0,children:`Work Mate will be able to read files in this directory and make edits when auto-accept edits is on.`})}function A({path:e}){return(0,P.jsxs)(h,{flexDirection:`column`,paddingX:2,gap:1,children:[(0,P.jsx)(g,{color:`permission`,children:e}),(0,P.jsx)(k,{})]})}function j({value:e,onChange:t,onSubmit:n,error:i,suggestions:a,selectedSuggestion:o}){return(0,P.jsxs)(h,{flexDirection:`column`,children:[(0,P.jsx)(g,{children:`Enter the path to the directory:`}),(0,P.jsx)(h,{borderDimColor:!0,borderStyle:`round`,marginY:1,paddingLeft:1,children:(0,P.jsx)(d,{showCursor:!0,placeholder:`Directory path${r.ellipsis}`,value:e,onChange:t,onSubmit:n,columns:80,cursorOffset:e.length,onChangeCursorOffset:()=>{}})}),a.length>0&&(0,P.jsx)(h,{marginBottom:1,children:(0,P.jsx)(O,{suggestions:a,selectedSuggestion:o})}),i&&(0,P.jsx)(g,{color:`error`,children:i})]})}function M({onAddDirectory:e,onCancel:t,permissionContext:n,directoryPath:r}){let[i,c]=(0,N.useState)(``),[l,d]=(0,N.useState)(null),[f,p]=(0,N.useState)([]),[y,b]=(0,N.useState)(0),x=(0,N.useMemo)(()=>F,[]),w=C((0,N.useCallback)(async e=>{if(!e){p([]),b(0);return}let t=await E(e);p(t),b(0)},[]),100);(0,N.useEffect)(()=>{w(i)},[i,w]);let T=(0,N.useCallback)(e=>{let t=`${e.id}/`;c(t),d(null)},[]),D=(0,N.useCallback)(async t=>{let r=await o(t,n);r.resultType===`success`?e(r.absolutePath,!1):d(s(r))},[n,e]);v(`confirm:no`,t,{context:`Settings`});let O=(0,N.useCallback)(e=>{if(f.length>0){if(e.key===`tab`){e.preventDefault();let t=f[y];t&&T(t);return}if(e.key===`return`){e.preventDefault();let t=f[y];t&&D(`${t.id}/`);return}if(e.key===`up`||e.ctrl&&e.key===`p`){e.preventDefault(),b(e=>e<=0?f.length-1:e-1);return}if(e.key===`down`||e.ctrl&&e.key===`n`){e.preventDefault(),b(e=>e>=f.length-1?0:e+1);return}}},[f,y,T,D]),M=(0,N.useCallback)(n=>{if(r)switch(n){case`yes-session`:e(r,!1);break;case`yes-remember`:e(r,!0);break;case`no`:t();break}},[r,e,t]);return(0,P.jsx)(h,{flexDirection:`column`,tabIndex:0,autoFocus:!0,onKeyDown:O,children:(0,P.jsx)(S,{title:`Add directory to workspace`,onCancel:t,color:`permission`,isCancelActive:!1,inputGuide:r?void 0:e=>e.pending?(0,P.jsxs)(g,{children:[`Press `,e.keyName,` again to exit`]}):(0,P.jsxs)(_,{children:[(0,P.jsx)(m,{shortcut:`Tab`,action:`complete`}),(0,P.jsx)(m,{shortcut:`Enter`,action:`add`}),(0,P.jsx)(a,{action:`confirm:no`,context:`Settings`,fallback:`Esc`,description:`cancel`})]}),children:r?(0,P.jsxs)(h,{flexDirection:`column`,gap:1,children:[(0,P.jsx)(A,{path:r}),(0,P.jsx)(u,{options:x,onChange:M,onCancel:()=>M(`no`)})]}):(0,P.jsxs)(h,{flexDirection:`column`,gap:1,marginX:2,children:[(0,P.jsx)(k,{}),(0,P.jsx)(j,{value:i,onChange:c,onSubmit:D,error:l,suggestions:f,selectedSuggestion:y})]})})})}var N,P,F,I=e((()=>{n(),N=t(y(),1),x(),l(),p(),b(),f(),T(),c(),i(),D(),P=w(),F=[{value:`yes-session`,label:`Yes, for this session`},{value:`yes-remember`,label:`Yes, and remember this directory`},{value:`no`,label:`No`}]}));export{I as n,M as t};
1
+ import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{n,t as r}from"./figures-5ThXQEtq.js";import{$u as i,Dp as a,F as o,N as s,Op as c,P as l,Qu as u,cd as d,hC as f,ld as p}from"./loadAgentsDir-PPiD2Mfq.js";import{D as m,I as h,P as g,T as _,Wt as v,ai as y,t as b,vn as x,y as S,yn as C}from"./src-DL3w8VPk2.js";import{t as w}from"./jsx-runtime-Bb4Xn-E0.js";import{r as T,t as E}from"./directoryCompletion-i2oWpaUe.js";import{r as D,t as O}from"./PromptInputFooterSuggestions-CE_yVun1.js";function k(){return(0,P.jsx)(g,{dimColor:!0,children:`Work Mate will be able to read files in this directory and make edits when auto-accept edits is on.`})}function A({path:e}){return(0,P.jsxs)(h,{flexDirection:`column`,paddingX:2,gap:1,children:[(0,P.jsx)(g,{color:`permission`,children:e}),(0,P.jsx)(k,{})]})}function j({value:e,onChange:t,onSubmit:n,error:i,suggestions:a,selectedSuggestion:o}){return(0,P.jsxs)(h,{flexDirection:`column`,children:[(0,P.jsx)(g,{children:`Enter the path to the directory:`}),(0,P.jsx)(h,{borderDimColor:!0,borderStyle:`round`,marginY:1,paddingLeft:1,children:(0,P.jsx)(d,{showCursor:!0,placeholder:`Directory path${r.ellipsis}`,value:e,onChange:t,onSubmit:n,columns:80,cursorOffset:e.length,onChangeCursorOffset:()=>{}})}),a.length>0&&(0,P.jsx)(h,{marginBottom:1,children:(0,P.jsx)(O,{suggestions:a,selectedSuggestion:o})}),i&&(0,P.jsx)(g,{color:`error`,children:i})]})}function M({onAddDirectory:e,onCancel:t,permissionContext:n,directoryPath:r}){let[i,c]=(0,N.useState)(``),[l,d]=(0,N.useState)(null),[f,p]=(0,N.useState)([]),[y,b]=(0,N.useState)(0),x=(0,N.useMemo)(()=>F,[]),w=C((0,N.useCallback)(async e=>{if(!e){p([]),b(0);return}let t=await E(e);p(t),b(0)},[]),100);(0,N.useEffect)(()=>{w(i)},[i,w]);let T=(0,N.useCallback)(e=>{let t=`${e.id}/`;c(t),d(null)},[]),D=(0,N.useCallback)(async t=>{let r=await o(t,n);r.resultType===`success`?e(r.absolutePath,!1):d(s(r))},[n,e]);v(`confirm:no`,t,{context:`Settings`});let O=(0,N.useCallback)(e=>{if(f.length>0){if(e.key===`tab`){e.preventDefault();let t=f[y];t&&T(t);return}if(e.key===`return`){e.preventDefault();let t=f[y];t&&D(`${t.id}/`);return}if(e.key===`up`||e.ctrl&&e.key===`p`){e.preventDefault(),b(e=>e<=0?f.length-1:e-1);return}if(e.key===`down`||e.ctrl&&e.key===`n`){e.preventDefault(),b(e=>e>=f.length-1?0:e+1);return}}},[f,y,T,D]),M=(0,N.useCallback)(n=>{if(r)switch(n){case`yes-session`:e(r,!1);break;case`yes-remember`:e(r,!0);break;case`no`:t();break}},[r,e,t]);return(0,P.jsx)(h,{flexDirection:`column`,tabIndex:0,autoFocus:!0,onKeyDown:O,children:(0,P.jsx)(S,{title:`Add directory to workspace`,onCancel:t,color:`permission`,isCancelActive:!1,inputGuide:r?void 0:e=>e.pending?(0,P.jsxs)(g,{children:[`Press `,e.keyName,` again to exit`]}):(0,P.jsxs)(_,{children:[(0,P.jsx)(m,{shortcut:`Tab`,action:`complete`}),(0,P.jsx)(m,{shortcut:`Enter`,action:`add`}),(0,P.jsx)(a,{action:`confirm:no`,context:`Settings`,fallback:`Esc`,description:`cancel`})]}),children:r?(0,P.jsxs)(h,{flexDirection:`column`,gap:1,children:[(0,P.jsx)(A,{path:r}),(0,P.jsx)(u,{options:x,onChange:M,onCancel:()=>M(`no`)})]}):(0,P.jsxs)(h,{flexDirection:`column`,gap:1,marginX:2,children:[(0,P.jsx)(k,{}),(0,P.jsx)(j,{value:i,onChange:c,onSubmit:D,error:l,suggestions:f,selectedSuggestion:y})]})})})}var N,P,F,I=e((()=>{n(),N=t(y(),1),x(),l(),p(),b(),f(),T(),c(),i(),D(),P=w(),F=[{value:`yes-session`,label:`Yes, for this session`},{value:`yes-remember`,label:`Yes, and remember this directory`},{value:`no`,label:`No`}]}));export{I as n,M as t};
@@ -1 +1 @@
1
- import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{Qu as n,Zu as r}from"./loadAgentsDir-CwEfQDOw.js";import{I as i,Lt as a,P as o,ai as s,t as c,y as l}from"./src-DL3w8VPk2.js";import{t as u}from"./jsx-runtime-Bb4Xn-E0.js";import{h as d,v as f}from"./config-BSkuQZNf.js";import{n as p,r as m}from"./analytics-DJobLaWP.js";function h({onDone:e,isStandaloneDialog:t,externalIncludes:r}){g.useEffect(()=>{m(`tengu_claude_md_includes_dialog_shown`,{})},[]);let s=(0,g.useCallback)(t=>{t===`no`?(m(`tengu_claude_md_external_includes_dialog_declined`,{}),f(e=>({...e,hasAgentsMdExternalIncludesApproved:!1,hasAgentsMdExternalIncludesWarningShown:!0}))):(m(`tengu_claude_md_external_includes_dialog_accepted`,{}),f(e=>({...e,hasAgentsMdExternalIncludesApproved:!0,hasAgentsMdExternalIncludesWarningShown:!0}))),e()},[e]);return(0,_.jsxs)(l,{title:`Allow external AGENTS.md file imports?`,color:`warning`,onCancel:(0,g.useCallback)(()=>{s(`no`)},[s]),hideBorder:!t,hideInputGuide:!t,children:[(0,_.jsx)(o,{children:`This project's AGENTS.md imports files outside the current working directory. Never allow this for third-party repositories.`}),r&&r.length>0&&(0,_.jsxs)(i,{flexDirection:`column`,children:[(0,_.jsx)(o,{dimColor:!0,children:`External imports:`}),r.map((e,t)=>(0,_.jsxs)(o,{dimColor:!0,children:[` `,e.path]},t))]}),(0,_.jsxs)(o,{dimColor:!0,children:[`Important: Only use Work Mate with files you trust. Accessing untrusted files may pose security risks`,` `,(0,_.jsx)(a,{url:`https://code.workmate.com/docs/en/security`}),` `]}),(0,_.jsx)(n,{options:[{label:`Yes, allow external imports`,value:`yes`},{label:`No, disable external imports`,value:`no`}],onChange:e=>s(e)})]})}var g,_,v=e((()=>{g=t(s(),1),p(),c(),d(),r(),_=u()}));export{v as n,h as t};
1
+ import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{Qu as n,Zu as r}from"./loadAgentsDir-PPiD2Mfq.js";import{I as i,Lt as a,P as o,ai as s,t as c,y as l}from"./src-DL3w8VPk2.js";import{t as u}from"./jsx-runtime-Bb4Xn-E0.js";import{h as d,v as f}from"./config-BSkuQZNf.js";import{n as p,r as m}from"./analytics-DJobLaWP.js";function h({onDone:e,isStandaloneDialog:t,externalIncludes:r}){g.useEffect(()=>{m(`tengu_claude_md_includes_dialog_shown`,{})},[]);let s=(0,g.useCallback)(t=>{t===`no`?(m(`tengu_claude_md_external_includes_dialog_declined`,{}),f(e=>({...e,hasAgentsMdExternalIncludesApproved:!1,hasAgentsMdExternalIncludesWarningShown:!0}))):(m(`tengu_claude_md_external_includes_dialog_accepted`,{}),f(e=>({...e,hasAgentsMdExternalIncludesApproved:!0,hasAgentsMdExternalIncludesWarningShown:!0}))),e()},[e]);return(0,_.jsxs)(l,{title:`Allow external AGENTS.md file imports?`,color:`warning`,onCancel:(0,g.useCallback)(()=>{s(`no`)},[s]),hideBorder:!t,hideInputGuide:!t,children:[(0,_.jsx)(o,{children:`This project's AGENTS.md imports files outside the current working directory. Never allow this for third-party repositories.`}),r&&r.length>0&&(0,_.jsxs)(i,{flexDirection:`column`,children:[(0,_.jsx)(o,{dimColor:!0,children:`External imports:`}),r.map((e,t)=>(0,_.jsxs)(o,{dimColor:!0,children:[` `,e.path]},t))]}),(0,_.jsxs)(o,{dimColor:!0,children:[`Important: Only use Work Mate with files you trust. Accessing untrusted files may pose security risks`,` `,(0,_.jsx)(a,{url:`https://code.workmate.com/docs/en/security`}),` `]}),(0,_.jsx)(n,{options:[{label:`Yes, allow external imports`,value:`yes`},{label:`No, disable external imports`,value:`no`}],onChange:e=>s(e)})]})}var g,_,v=e((()=>{g=t(s(),1),p(),c(),d(),r(),_=u()}));export{v as n,h as t};
@@ -0,0 +1 @@
1
+ import{n as e,t}from"./AgentsMdExternalIncludesDialog-BTYgjY5c.js";e();export{t as AgentsMdExternalIncludesDialog};
@@ -1 +1 @@
1
- import{Xh as e,Yh as t}from"./loadAgentsDir-CwEfQDOw.js";import{R as n,t as r}from"./src-DL3w8VPk2.js";import{t as i}from"./jsx-runtime-Bb4Xn-E0.js";import{c as a,h as o,y as s}from"./config-BSkuQZNf.js";import{n as c}from"./onChangeAppState-EtUxsgYz.js";import{t as l}from"./fpsMetrics-Dk_pnSHJ.js";import{t as u}from"./stats-Dq-5qizS.js";e(),r(),o();var d=i();function f({getFpsMetrics:e,stats:r,initialState:i,children:o}){return(0,d.jsx)(l,{getFpsMetrics:e,children:(0,d.jsx)(u,{store:r,children:(0,d.jsx)(t,{initialState:i,onChangeAppState:c,children:(0,d.jsx)(n,{initialState:a().theme,onThemeSave:e=>s(t=>({...t,theme:e})),children:o})})})})}export{f as App};
1
+ import{Xh as e,Yh as t}from"./loadAgentsDir-PPiD2Mfq.js";import{R as n,t as r}from"./src-DL3w8VPk2.js";import{t as i}from"./jsx-runtime-Bb4Xn-E0.js";import{c as a,h as o,y as s}from"./config-BSkuQZNf.js";import{n as c}from"./onChangeAppState-COFFZAXb.js";import{t as l}from"./fpsMetrics-Dk_pnSHJ.js";import{t as u}from"./stats-Dq-5qizS.js";e(),r(),o();var d=i();function f({getFpsMetrics:e,stats:r,initialState:i,children:o}){return(0,d.jsx)(l,{getFpsMetrics:e,children:(0,d.jsx)(u,{store:r,children:(0,d.jsx)(t,{initialState:i,onChangeAppState:c,children:(0,d.jsx)(n,{initialState:a().theme,onThemeSave:e=>s(t=>({...t,theme:e})),children:o})})})})}export{f as App};
@@ -0,0 +1 @@
1
+ import{t as e}from"./ApproveApiKey-BBFLw2B7.js";export{e as ApproveApiKey};
@@ -1 +1 @@
1
- import{Qu as e,Zu as t}from"./loadAgentsDir-CwEfQDOw.js";import{P as n,t as r,y as i}from"./src-DL3w8VPk2.js";import{t as a}from"./jsx-runtime-Bb4Xn-E0.js";import{h as o,y as s}from"./config-BSkuQZNf.js";r(),o(),t();var c=a();function l({customApiKeyTruncated:t,onDone:r}){function a(e){switch(e){case`yes`:s(e=>({...e,customApiKeyResponses:{...e.customApiKeyResponses,approved:[...e.customApiKeyResponses?.approved??[],t]}})),r(!0);break;case`no`:s(e=>({...e,customApiKeyResponses:{...e.customApiKeyResponses,rejected:[...e.customApiKeyResponses?.rejected??[],t]}})),r(!1);break}}return(0,c.jsxs)(i,{title:`Detected a custom API key in your environment`,color:`warning`,onCancel:()=>a(`no`),children:[(0,c.jsxs)(n,{children:[(0,c.jsx)(n,{bold:!0,children:`ANTHROPIC_API_KEY`}),(0,c.jsxs)(n,{children:[`: sk-ant-...`,t]})]}),(0,c.jsx)(n,{children:`Do you want to use this API key?`}),(0,c.jsx)(e,{defaultValue:`no`,defaultFocusValue:`no`,options:[{label:`Yes`,value:`yes`},{label:(0,c.jsxs)(n,{children:[`No (`,(0,c.jsx)(n,{bold:!0,children:`recommended`}),`)`]}),value:`no`}],onChange:e=>a(e),onCancel:()=>a(`no`)})]})}export{l as t};
1
+ import{Qu as e,Zu as t}from"./loadAgentsDir-PPiD2Mfq.js";import{P as n,t as r,y as i}from"./src-DL3w8VPk2.js";import{t as a}from"./jsx-runtime-Bb4Xn-E0.js";import{h as o,y as s}from"./config-BSkuQZNf.js";r(),o(),t();var c=a();function l({customApiKeyTruncated:t,onDone:r}){function a(e){switch(e){case`yes`:s(e=>({...e,customApiKeyResponses:{...e.customApiKeyResponses,approved:[...e.customApiKeyResponses?.approved??[],t]}})),r(!0);break;case`no`:s(e=>({...e,customApiKeyResponses:{...e.customApiKeyResponses,rejected:[...e.customApiKeyResponses?.rejected??[],t]}})),r(!1);break}}return(0,c.jsxs)(i,{title:`Detected a custom API key in your environment`,color:`warning`,onCancel:()=>a(`no`),children:[(0,c.jsxs)(n,{children:[(0,c.jsx)(n,{bold:!0,children:`ANTHROPIC_API_KEY`}),(0,c.jsxs)(n,{children:[`: sk-ant-...`,t]})]}),(0,c.jsx)(n,{children:`Do you want to use this API key?`}),(0,c.jsx)(e,{defaultValue:`no`,defaultFocusValue:`no`,options:[{label:`Yes`,value:`yes`},{label:(0,c.jsxs)(n,{children:[`No (`,(0,c.jsx)(n,{bold:!0,children:`recommended`}),`)`]}),value:`no`}],onChange:e=>a(e),onCancel:()=>a(`no`)})]})}export{l as t};
@@ -1,2 +1,2 @@
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,$u as a,Af as o,Ag as s,Dg as c,En as l,Ga as u,If as d,Is as f,Jh as p,Kc as m,La as h,Lf as g,Ls as _,Mf as v,On as y,Qu as b,Xh as ee,Zh as te,_C as ne,aS as x,ad as re,au as S,df as ie,dp as ae,ea as oe,fp as se,gC as ce,hC as C,iu as w,lu as T,nd as le,nu as ue,oS as de,op as fe,pu as pe,qc as me,qh as he,ru as ge,sp as _e,tu as ve,uf as ye,wa as be,xC as xe}from"./loadAgentsDir-CwEfQDOw.js";import{D as E,Gt as D,H as Se,I as O,Lt as Ce,P as k,T as A,ai as j,mt as we,ot as Te,t as M,y as N}from"./src-DL3w8VPk2.js";import{t as P}from"./jsx-runtime-Bb4Xn-E0.js";import{P as Ee,R as De,_ as Oe,f as ke}from"./debug-BQj6h99Q.js";import{Ln as F,Rn as Ae,Wt as je,zn as Me}from"./settings-CvhsRFaT.js";import{C as Ne,b as I,f as Pe,l as Fe,u as Ie,v as L}from"./startupProfiler-2sjXZkIP.js";import{l as R,o as Le}from"./stringUtils-BjnclTLB.js";import{Nt as Re,_n as ze,vn as Be,yn as Ve}from"./prompt-Bm2EEG4F.js";import{i as He,n as Ue}from"./mappers-CdY45PDA.js";function z(e,t,n=1e3,r=0,i){let a=()=>Fe(Math.max(0,(i??Date.now())-e-r));return(0,We.useSyncExternalStore)((0,We.useCallback)(e=>{if(!t)return()=>{};let r=setInterval(e,n);return()=>clearInterval(r)},[t,n]),a,a)}var We,B=e((()=>{We=t(j(),1),L()}));function Ge(e,t,n){let r=ze(t,e.toolName);if(!r)return e.toolName;try{let t=r.inputSchema.safeParse(e.input),i=t.success?t.data:{},a=r.userFacingName(i);if(!a)return e.toolName;let o=r.renderToolUseMessage(i,{theme:n,verbose:!1});return o?(0,Ke.jsxs)(k,{children:[a,`(`,o,`)`]}):a}catch{return e.toolName}}var Ke,qe=e((()=>{M(),Ve(),Ke=P()}));function Je(e,t){let{isIdle:n,awaitingApproval:i,hasError:a,shutdownRequested:o}=t??{};return a?r.cross:i?r.questionMarkPrefix:o?r.warning:e===`running`?n?r.ellipsis:r.play:e===`completed`?r.tick:e===`failed`||e===`killed`?r.cross:r.bullet}function Ye(e,t){let{isIdle:n,awaitingApproval:r,hasError:i,shutdownRequested:a}=t??{};return i?`error`:r||a?`warning`:n?`background`:e===`completed`?`success`:e===`failed`?`error`:e===`killed`?`warning`:`background`}function Xe(e,t){if(!t)return!1;let n=!1;for(let t of Object.values(e))if(g(t))return n=!0,!1;return n}var Ze=e((()=>{n(),d()}));function Qe({agent:e,onDone:t,onKillAgent:n,onBack:r}){let[i]=Se(),a=(0,$e.useMemo)(()=>m(Be()),[]),o=z(e.startTime,e.status===`running`,1e3,e.totalPausedMs??0);D({"confirm:yes":t},{context:`Confirmation`});let s=i=>{i.key===` `?(i.preventDefault(),t()):i.key===`left`&&r?(i.preventDefault(),r()):i.key===`x`&&e.status===`running`&&n&&(i.preventDefault(),n())},c=be(e.prompt,`plan`),l=e.prompt.length>300?`${e.prompt.substring(0,297)}…`:e.prompt,u=e.result?.totalTokens??e.progress?.tokenCount,d=e.result?.totalToolUseCount??e.progress?.toolUseCount;return(0,V.jsx)(O,{flexDirection:`column`,tabIndex:0,autoFocus:!0,onKeyDown:s,children:(0,V.jsx)(N,{title:(0,V.jsxs)(k,{children:[e.selectedAgent?.agentType??`agent`,` › `,e.description||`Async agent`]}),subtitle:(0,V.jsxs)(k,{children:[e.status!==`running`&&(0,V.jsxs)(k,{color:Ye(e.status),children:[Je(e.status),` `,e.status===`completed`?`Completed`:e.status===`failed`?`Failed`:`Stopped`,` · `]}),(0,V.jsxs)(k,{dimColor:!0,children:[o,u!==void 0&&u>0&&(0,V.jsxs)(V.Fragment,{children:[` · `,Pe(u),` tokens`]}),d!==void 0&&d>0&&(0,V.jsxs)(V.Fragment,{children:[` `,`· `,d,` `,d===1?`tool`:`tools`]})]})]}),onCancel:t,color:`background`,inputGuide:t=>t.pending?(0,V.jsxs)(k,{children:[`Press `,t.keyName,` again to exit`]}):(0,V.jsxs)(A,{children:[r&&(0,V.jsx)(E,{shortcut:`←`,action:`go back`}),(0,V.jsx)(E,{shortcut:`Esc/Enter/Space`,action:`close`}),e.status===`running`&&n&&(0,V.jsx)(E,{shortcut:`x`,action:`stop`})]}),children:(0,V.jsxs)(O,{flexDirection:`column`,children:[e.status===`running`&&e.progress?.recentActivities&&e.progress.recentActivities.length>0&&(0,V.jsxs)(O,{flexDirection:`column`,children:[(0,V.jsx)(k,{bold:!0,dimColor:!0,children:`Progress`}),e.progress.recentActivities.map((t,n)=>(0,V.jsxs)(k,{dimColor:n<e.progress.recentActivities.length-1,wrap:`truncate-end`,children:[n===e.progress.recentActivities.length-1?`› `:` `,Ge(t,a,i)]},n))]}),c?(0,V.jsx)(O,{marginTop:1,children:(0,V.jsx)(ae,{addMargin:!1,planContent:c})}):(0,V.jsxs)(O,{flexDirection:`column`,marginTop:1,children:[(0,V.jsx)(k,{bold:!0,dimColor:!0,children:`Prompt`}),(0,V.jsx)(k,{wrap:`wrap`,children:l})]}),e.status===`failed`&&e.error&&(0,V.jsxs)(O,{flexDirection:`column`,marginTop:1,children:[(0,V.jsx)(k,{bold:!0,color:`error`,children:`Error`}),(0,V.jsx)(k,{color:`error`,wrap:`wrap`,children:e.error})]})]})})})}var $e,V,et=e((()=>{$e=t(j(),1),B(),M(),C(),Ve(),me(),L(),h(),se(),qe(),Ze(),V=P()}));function tt(e,t,n,r){if(!e)return`${t} found · ${n} verified`;if(e===`synthesizing`){let e=[`${n} verified`];return r>0&&e.push(`${r} refuted`),e.push(`deduping`),e.join(` · `)}if(e===`verifying`){let e=[`${t} found`,`${n} verified`];return r>0&&e.push(`${r} refuted`),e.join(` · `)}return t>0?`${t} found`:`finding`}function nt({text:e,phase:t=0}){return(0,H.jsx)(H.Fragment,{children:[...e].map((e,n)=>(0,H.jsx)(k,{color:fe(n+t),children:e},n))})}function rt(e,t,n){let r=(0,ot.useRef)(e),i=(0,ot.useRef)(t);return n||e<r.current?r.current=e:e>r.current&&t!==i.current&&(r.current+=1,i.current=t),r.current}function it({session:e}){let t=p().prefersReducedMotion??!1,n=e.reviewProgress,r=e.status===`running`,[,i]=we(r&&!t?st:null),a=n?.bugsFound??0,o=n?.bugsVerified??0,s=n?.bugsRefuted??0,c=t||!r,l=rt(a,i,c),u=rt(o,i,c),d=rt(s,i,c),f=Math.floor(i/(st*3))%7;if(e.status===`completed`)return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(k,{color:`background`,children:[`◆`,` `]}),(0,H.jsx)(nt,{text:`ultrareview`,phase:0}),(0,H.jsx)(k,{dimColor:!0,children:` ready · shift+↓ to view`})]});if(e.status===`failed`)return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(k,{color:`background`,children:[`◆`,` `]}),(0,H.jsx)(nt,{text:`ultrareview`,phase:0}),(0,H.jsxs)(k,{color:`error`,dimColor:!0,children:[` · `,`error`]})]});let m=n?tt(n.stage,l,u,d):`setting up`;return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(k,{color:`background`,children:[`◇`,` `]}),(0,H.jsx)(nt,{text:`ultrareview`,phase:r?f:0}),(0,H.jsxs)(k,{dimColor:!0,children:[` · `,m]})]})}function at({session:e}){if(e.isRemoteReview)return(0,H.jsx)(it,{session:e});if(e.status===`completed`)return(0,H.jsx)(k,{bold:!0,color:`success`,dimColor:!0,children:`done`});if(e.status===`failed`)return(0,H.jsx)(k,{bold:!0,color:`error`,dimColor:!0,children:`error`});if(!e.todoList.length)return(0,H.jsxs)(k,{dimColor:!0,children:[e.status,`…`]});let t=F(e.todoList,e=>e.status===`completed`),n=e.todoList.length;return(0,H.jsxs)(k,{dimColor:!0,children:[t,`/`,n]})}var ot,H,st,ct=e((()=>{ot=t(j(),1),je(),he(),M(),Ae(),_e(),H=P(),st=80}));function U({status:e,label:t,suffix:n}){return(0,W.jsxs)(k,{color:e===`completed`?`success`:e===`failed`?`error`:e===`killed`?`warning`:void 0,dimColor:!0,children:[`(`,t??e,n,`)`]})}function lt({shell:e}){switch(e.status){case`completed`:return(0,W.jsx)(U,{status:`completed`,label:`done`});case`failed`:return(0,W.jsx)(U,{status:`failed`,label:`error`});case`killed`:return(0,W.jsx)(U,{status:`killed`,label:`stopped`});case`running`:case`pending`:return(0,W.jsx)(U,{status:`running`})}}var W,ut=e((()=>{M(),W=P()}));function dt({task:e,maxActivityWidth:t}){let n=t??40;switch(e.type){case`local_bash`:return(0,G.jsxs)(k,{children:[I(e.command,n,!0),` `,(0,G.jsx)(lt,{shell:e})]});case`remote_agent`:return e.isRemoteReview?(0,G.jsx)(k,{children:(0,G.jsx)(at,{session:e})}):(0,G.jsxs)(k,{children:[(0,G.jsxs)(k,{dimColor:!0,children:[e.status===`running`||e.status===`pending`?`◇`:`◆`,` `]}),I(e.title,n,!0),(0,G.jsx)(k,{dimColor:!0,children:` · `}),(0,G.jsx)(at,{session:e})]});case`local_agent`:return(0,G.jsxs)(k,{children:[I(e.description,n,!0),` `,(0,G.jsx)(U,{status:e.status,label:e.status===`completed`?`done`:void 0,suffix:e.status===`completed`&&!e.notified?`, unread`:void 0})]});case`local_workflow`:{let t=e;return(0,G.jsxs)(k,{children:[I(t.workflowName??e.summary??e.description,n,!0),` `,(0,G.jsx)(U,{status:e.status,label:e.status===`running`?`${t.agentCount} ${R(t.agentCount,`agent`)}`:e.status===`completed`?`done`:void 0,suffix:e.status===`completed`&&!e.notified?`, unread`:void 0})]})}case`dream`:{let t=e.filesTouched.length,n=e.phase===`updating`&&t>0?`${t} ${R(t,`file`)}`:`${e.sessionsReviewing} ${R(e.sessionsReviewing,`session`)}`;return(0,G.jsxs)(k,{children:[e.description,` `,(0,G.jsxs)(k,{dimColor:!0,children:[`· `,e.phase,` · `,n]}),` `,(0,G.jsx)(U,{status:e.status,label:e.status===`completed`?`done`:void 0,suffix:e.status===`completed`&&!e.notified?`, unread`:void 0})]})}}}var G,ft=e((()=>{M(),L(),Le(),je(),ct(),ut(),G=P()}));function pt({task:e,onDone:t,onBack:n,onKill:r}){let i=z(e.startTime,e.status===`running`,1e3,0);D({"confirm:yes":t},{context:`Confirmation`});let a=i=>{i.key===` `?(i.preventDefault(),t()):i.key===`left`&&n?(i.preventDefault(),n()):i.key===`x`&&e.status===`running`&&r&&(i.preventDefault(),r())},o=e.turns.filter(e=>e.text!==``),s=o.slice(-6),c=o.length-s.length;return(0,K.jsx)(O,{flexDirection:`column`,tabIndex:0,autoFocus:!0,onKeyDown:a,children:(0,K.jsx)(N,{title:`Memory consolidation`,subtitle:(0,K.jsxs)(k,{dimColor:!0,children:[i,` · reviewing `,e.sessionsReviewing,` `,R(e.sessionsReviewing,`session`),e.filesTouched.length>0&&(0,K.jsxs)(K.Fragment,{children:[` `,`· `,e.filesTouched.length,` `,R(e.filesTouched.length,`file`),` touched`]})]}),onCancel:t,color:`background`,inputGuide:t=>t.pending?(0,K.jsxs)(k,{children:[`Press `,t.keyName,` again to exit`]}):(0,K.jsxs)(A,{children:[n&&(0,K.jsx)(E,{shortcut:`←`,action:`go back`}),(0,K.jsx)(E,{shortcut:`Esc/Enter/Space`,action:`close`}),e.status===`running`&&r&&(0,K.jsx)(E,{shortcut:`x`,action:`stop`})]}),children:(0,K.jsxs)(O,{flexDirection:`column`,gap:1,children:[(0,K.jsxs)(k,{children:[(0,K.jsx)(k,{bold:!0,children:`Status:`}),` `,e.status===`running`?(0,K.jsx)(k,{color:`background`,children:`running`}):e.status===`completed`?(0,K.jsx)(k,{color:`success`,children:e.status}):(0,K.jsx)(k,{color:`error`,children:e.status})]}),s.length===0?(0,K.jsx)(k,{dimColor:!0,children:e.status===`running`?`Starting…`:`(no text output)`}):(0,K.jsxs)(K.Fragment,{children:[c>0&&(0,K.jsxs)(k,{dimColor:!0,children:[`(`,c,` earlier `,R(c,`turn`),`)`]}),s.map((e,t)=>(0,K.jsxs)(O,{flexDirection:`column`,children:[(0,K.jsx)(k,{wrap:`wrap`,children:e.text}),e.toolUseCount>0&&(0,K.jsxs)(k,{dimColor:!0,children:[` `,`(`,e.toolUseCount,` `,R(e.toolUseCount,`tool`),`)`]})]},t))]})]})})})}var K,mt=e((()=>{B(),M(),C(),Le(),K=P()}));function ht({stage:e,completed:t,hasProgress:n}){let r=e?yt.indexOf(e):-1,i=!t&&!n;return(0,J.jsxs)(k,{children:[i?(0,J.jsx)(k,{color:`background`,children:`Setup`}):(0,J.jsx)(k,{dimColor:!0,children:`Setup`}),(0,J.jsx)(k,{dimColor:!0,children:` → `}),yt.map((e,n)=>{let a=!t&&!i&&n===r;return(0,J.jsxs)(q.Fragment,{children:[n>0&&(0,J.jsx)(k,{dimColor:!0,children:` → `}),a?(0,J.jsx)(k,{color:`background`,children:bt[e]}):(0,J.jsx)(k,{dimColor:!0,children:bt[e]})]},e)}),t&&(0,J.jsx)(k,{color:`success`,children:` ✓`})]})}function gt(e){let t=e.reviewProgress;if(!t)return e.status===`completed`?`done`:`setting up`;let n=t.bugsVerified,r=t.bugsRefuted??0;if(e.status===`completed`){let e=[`${n} ${R(n,`finding`)}`];return r>0&&e.push(`${r} refuted`),e.join(` · `)}return tt(t.stage,t.bugsFound,n,r)}function _t({session:e,onDone:t,onBack:n,onKill:r}){let i=e.status===`completed`,a=e.status===`running`||e.status===`pending`,[o,s]=(0,q.useState)(!1),c=z(e.startTime,a,1e3,0,e.endTime),l=()=>t(`Remote session details dismissed`,{display:`system`}),u=n??l,d=w(e.sessionId),f=i?`ready`:a?`running`:e.status;if(o)return(0,J.jsx)(N,{title:`Stop ultrareview?`,onCancel:()=>s(!1),color:`background`,children:(0,J.jsxs)(O,{flexDirection:`column`,gap:1,children:[(0,J.jsx)(k,{dimColor:!0,children:`This archives the remote session and stops local tracking. The review will not complete and any findings so far are discarded.`}),(0,J.jsx)(b,{options:[{label:`Stop ultrareview`,value:`stop`},{label:`Back`,value:`back`}],onChange:e=>{e===`stop`?(r?.(),u()):s(!1)}})]})});let p=i?[{label:`Open in Claude Code on the web`,value:`open`},{label:`Dismiss`,value:`dismiss`}]:[{label:`Open in Claude Code on the web`,value:`open`},...r&&a?[{label:`Stop ultrareview`,value:`stop`}]:[],{label:`Back`,value:`back`}];return(0,J.jsx)(N,{title:(0,J.jsxs)(k,{children:[(0,J.jsxs)(k,{color:`background`,children:[i?`◆`:`◇`,` `]}),(0,J.jsx)(k,{bold:!0,children:`ultrareview`}),(0,J.jsxs)(k,{dimColor:!0,children:[` · `,c,` · `,f]})]}),onCancel:u,color:`background`,inputGuide:e=>e.pending?(0,J.jsxs)(k,{children:[`Press `,e.keyName,` again to exit`]}):(0,J.jsxs)(A,{children:[(0,J.jsx)(E,{shortcut:`Enter`,action:`select`}),(0,J.jsx)(E,{shortcut:`Esc`,action:`go back`})]}),children:(0,J.jsxs)(O,{flexDirection:`column`,gap:1,children:[(0,J.jsx)(ht,{stage:e.reviewProgress?.stage,completed:i,hasProgress:!!e.reviewProgress}),(0,J.jsxs)(O,{flexDirection:`column`,children:[(0,J.jsx)(k,{children:gt(e)}),(0,J.jsx)(Ce,{url:d,children:(0,J.jsx)(k,{dimColor:!0,children:d})})]}),(0,J.jsx)(b,{options:p,onChange:e=>{switch(e){case`open`:de(d),t();break;case`stop`:s(!0);break;case`back`:u();break;case`dismiss`:l();break}}})]})})}function vt({session:e,toolUseContext:t,onDone:n,onBack:r,onKill:i}){let[a,s]=(0,q.useState)(!1),[c,l]=(0,q.useState)(null),d=(0,q.useMemo)(()=>e.isRemoteReview?[]:u(He(e.log)).filter(e=>e.type!==`progress`).slice(-3),[e]);if(e.isRemoteReview)return(0,J.jsx)(_t,{session:e,onDone:n,onBack:r,onKill:i});let f=()=>n(`Remote session details dismissed`,{display:`system`}),p=e=>{e.key===` `?(e.preventDefault(),n(`Remote session details dismissed`,{display:`system`})):e.key===`left`&&r?(e.preventDefault(),r()):e.key===`t`&&!a?(e.preventDefault(),m()):e.key===`return`&&(e.preventDefault(),f())};async function m(){s(!0),l(null);try{await pe(e.sessionId)}catch(e){l(Ee(e))}finally{s(!1)}}let h=Ne(e.title,50),g=e.status===`pending`?`starting`:e.status;return(0,J.jsx)(O,{flexDirection:`column`,tabIndex:0,autoFocus:!0,onKeyDown:p,children:(0,J.jsxs)(N,{title:`Remote session details`,onCancel:f,color:`background`,inputGuide:e=>e.pending?(0,J.jsxs)(k,{children:[`Press `,e.keyName,` again to exit`]}):(0,J.jsxs)(A,{children:[r&&(0,J.jsx)(E,{shortcut:`←`,action:`go back`}),(0,J.jsx)(E,{shortcut:`Esc/Enter/Space`,action:`close`}),!a&&(0,J.jsx)(E,{shortcut:`t`,action:`teleport`})]}),children:[(0,J.jsxs)(O,{flexDirection:`column`,children:[(0,J.jsxs)(k,{children:[(0,J.jsx)(k,{bold:!0,children:`Status`}),`:`,` `,g===`running`||g===`starting`?(0,J.jsx)(k,{color:`background`,children:g}):g===`completed`?(0,J.jsx)(k,{color:`success`,children:g}):(0,J.jsx)(k,{color:`error`,children:g})]}),(0,J.jsxs)(k,{children:[(0,J.jsx)(k,{bold:!0,children:`Runtime`}),`: `,Fe((e.endTime??Date.now())-e.startTime)]}),(0,J.jsxs)(k,{wrap:`truncate-end`,children:[(0,J.jsx)(k,{bold:!0,children:`Title`}),`: `,h]}),(0,J.jsxs)(k,{children:[(0,J.jsx)(k,{bold:!0,children:`Progress`}),`: `,(0,J.jsx)(at,{session:e})]}),(0,J.jsxs)(k,{children:[(0,J.jsx)(k,{bold:!0,children:`Session URL`}),`:`,` `,(0,J.jsx)(Ce,{url:w(e.sessionId),children:(0,J.jsx)(k,{dimColor:!0,children:w(e.sessionId)})})]})]}),e.log.length>0&&(0,J.jsxs)(O,{flexDirection:`column`,marginTop:1,children:[(0,J.jsxs)(k,{children:[(0,J.jsx)(k,{bold:!0,children:`Recent messages`}),`:`]}),(0,J.jsx)(O,{flexDirection:`column`,height:10,overflowY:`hidden`,children:d.map((e,n)=>(0,J.jsx)(o,{message:e,lookups:oe,addMargin:n>0,tools:t.options.tools,commands:t.options.commands,verbose:t.options.verbose,inProgressToolUseIDs:new Set,progressMessagesForMessage:[],shouldAnimate:!1,shouldShowDot:!1,style:`condensed`,isTranscriptMode:!1,isStatic:!0},n))}),(0,J.jsx)(O,{marginTop:1,children:(0,J.jsxs)(k,{dimColor:!0,italic:!0,children:[`Showing last `,d.length,` of `,e.log.length,` messages`]})})]}),c&&(0,J.jsx)(O,{marginTop:1,children:(0,J.jsxs)(k,{color:`error`,children:[`Teleport failed: `,c]})}),a&&(0,J.jsx)(k,{color:`background`,children:`Teleporting to session…`})]})})}var q,J,yt,bt,xt=e((()=>{q=t(j(),1),je(),B(),M(),S(),Re(),x(),De(),L(),Ue(),h(),Le(),T(),a(),v(),ct(),J=P(),yt=[`finding`,`verifying`,`synthesizing`],bt={finding:`Find`,verifying:`Verify`,synthesizing:`Dedupe`}}));async function St(e){let t=l(e.id);try{let e=await Oe(t,Tt);return{content:e.content,bytesTotal:e.bytesTotal}}catch{return{content:``,bytesTotal:0}}}function Ct({shell:e,onDone:t,onKillShell:n,onBack:r}){let{columns:i}=Te(),[a,o]=(0,Y.useState)(()=>St(e)),s=(0,Y.useDeferredValue)(a);(0,Y.useEffect)(()=>{if(e.status!==`running`)return;let t=setInterval((e,t)=>e(St(t)),1e3,o,e);return()=>clearInterval(t)},[e.id,e.status]);let c=()=>t(`Shell details dismissed`,{display:`system`});D({"confirm:yes":c},{context:`Confirmation`});let l=i=>{i.key===` `?(i.preventDefault(),t(`Shell details dismissed`,{display:`system`})):i.key===`left`&&r?(i.preventDefault(),r()):i.key===`x`&&e.status===`running`&&n&&(i.preventDefault(),n())},u=Ne(e.command,280);return(0,X.jsx)(O,{flexDirection:`column`,tabIndex:0,autoFocus:!0,onKeyDown:l,children:(0,X.jsxs)(N,{title:`Shell details`,onCancel:c,color:`background`,inputGuide:t=>t.pending?(0,X.jsxs)(k,{children:[`Press `,t.keyName,` again to exit`]}):(0,X.jsxs)(A,{children:[r&&(0,X.jsx)(E,{shortcut:`←`,action:`go back`}),(0,X.jsx)(E,{shortcut:`Esc/Enter/Space`,action:`close`}),e.status===`running`&&n&&(0,X.jsx)(E,{shortcut:`x`,action:`stop`})]}),children:[(0,X.jsxs)(O,{flexDirection:`column`,children:[(0,X.jsxs)(k,{children:[(0,X.jsx)(k,{bold:!0,children:`Status:`}),` `,e.status===`running`?(0,X.jsxs)(k,{color:`background`,children:[e.status,e.result?.code!==void 0&&` (exit code: ${e.result.code})`]}):e.status===`completed`?(0,X.jsxs)(k,{color:`success`,children:[e.status,e.result?.code!==void 0&&` (exit code: ${e.result.code})`]}):(0,X.jsxs)(k,{color:`error`,children:[e.status,e.result?.code!==void 0&&` (exit code: ${e.result.code})`]})]}),(0,X.jsxs)(k,{children:[(0,X.jsx)(k,{bold:!0,children:`Runtime:`}),` `,Fe((e.endTime??Date.now())-e.startTime)]}),(0,X.jsxs)(k,{wrap:`wrap`,children:[(0,X.jsx)(k,{bold:!0,children:`Command:`}),` `,u]})]}),(0,X.jsxs)(O,{flexDirection:`column`,children:[(0,X.jsx)(k,{bold:!0,children:`Output:`}),(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(k,{dimColor:!0,children:`Loading output…`}),children:(0,X.jsx)(wt,{outputPromise:s,columns:i})})]})]})})}function wt({outputPromise:e,columns:t}){let{content:n,bytesTotal:r}=(0,Y.use)(e);if(!n)return(0,X.jsx)(k,{dimColor:!0,children:`No output available`});let i=[],a=n.length;for(let e=0;e<10&&a>0;e++){let e=n.lastIndexOf(`
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,$u as a,Af as o,Ag as s,Dg as c,En as l,Ga as u,If as d,Is as f,Jh as p,Kc as m,La as h,Lf as g,Ls as _,Mf as v,On as y,Qu as b,Xh as ee,Zh as te,_C as ne,aS as x,ad as re,au as S,df as ie,dp as ae,ea as oe,fp as se,gC as ce,hC as C,iu as w,lu as T,nd as le,nu as ue,oS as de,op as fe,pu as pe,qc as me,qh as he,ru as ge,sp as _e,tu as ve,uf as ye,wa as be,xC as xe}from"./loadAgentsDir-PPiD2Mfq.js";import{D as E,Gt as D,H as Se,I as O,Lt as Ce,P as k,T as A,ai as j,mt as we,ot as Te,t as M,y as N}from"./src-DL3w8VPk2.js";import{t as P}from"./jsx-runtime-Bb4Xn-E0.js";import{P as Ee,R as De,_ as Oe,f as ke}from"./debug-BQj6h99Q.js";import{Ln as F,Rn as Ae,Wt as je,zn as Me}from"./settings-CvhsRFaT.js";import{C as Ne,b as I,f as Pe,l as Fe,u as Ie,v as L}from"./startupProfiler-2sjXZkIP.js";import{l as R,o as Le}from"./stringUtils-BjnclTLB.js";import{Nt as Re,_n as ze,vn as Be,yn as Ve}from"./prompt-CQmEvnKN.js";import{i as He,n as Ue}from"./mappers-ZGgwqDOK.js";function z(e,t,n=1e3,r=0,i){let a=()=>Fe(Math.max(0,(i??Date.now())-e-r));return(0,We.useSyncExternalStore)((0,We.useCallback)(e=>{if(!t)return()=>{};let r=setInterval(e,n);return()=>clearInterval(r)},[t,n]),a,a)}var We,B=e((()=>{We=t(j(),1),L()}));function Ge(e,t,n){let r=ze(t,e.toolName);if(!r)return e.toolName;try{let t=r.inputSchema.safeParse(e.input),i=t.success?t.data:{},a=r.userFacingName(i);if(!a)return e.toolName;let o=r.renderToolUseMessage(i,{theme:n,verbose:!1});return o?(0,Ke.jsxs)(k,{children:[a,`(`,o,`)`]}):a}catch{return e.toolName}}var Ke,qe=e((()=>{M(),Ve(),Ke=P()}));function Je(e,t){let{isIdle:n,awaitingApproval:i,hasError:a,shutdownRequested:o}=t??{};return a?r.cross:i?r.questionMarkPrefix:o?r.warning:e===`running`?n?r.ellipsis:r.play:e===`completed`?r.tick:e===`failed`||e===`killed`?r.cross:r.bullet}function Ye(e,t){let{isIdle:n,awaitingApproval:r,hasError:i,shutdownRequested:a}=t??{};return i?`error`:r||a?`warning`:n?`background`:e===`completed`?`success`:e===`failed`?`error`:e===`killed`?`warning`:`background`}function Xe(e,t){if(!t)return!1;let n=!1;for(let t of Object.values(e))if(g(t))return n=!0,!1;return n}var Ze=e((()=>{n(),d()}));function Qe({agent:e,onDone:t,onKillAgent:n,onBack:r}){let[i]=Se(),a=(0,$e.useMemo)(()=>m(Be()),[]),o=z(e.startTime,e.status===`running`,1e3,e.totalPausedMs??0);D({"confirm:yes":t},{context:`Confirmation`});let s=i=>{i.key===` `?(i.preventDefault(),t()):i.key===`left`&&r?(i.preventDefault(),r()):i.key===`x`&&e.status===`running`&&n&&(i.preventDefault(),n())},c=be(e.prompt,`plan`),l=e.prompt.length>300?`${e.prompt.substring(0,297)}…`:e.prompt,u=e.result?.totalTokens??e.progress?.tokenCount,d=e.result?.totalToolUseCount??e.progress?.toolUseCount;return(0,V.jsx)(O,{flexDirection:`column`,tabIndex:0,autoFocus:!0,onKeyDown:s,children:(0,V.jsx)(N,{title:(0,V.jsxs)(k,{children:[e.selectedAgent?.agentType??`agent`,` › `,e.description||`Async agent`]}),subtitle:(0,V.jsxs)(k,{children:[e.status!==`running`&&(0,V.jsxs)(k,{color:Ye(e.status),children:[Je(e.status),` `,e.status===`completed`?`Completed`:e.status===`failed`?`Failed`:`Stopped`,` · `]}),(0,V.jsxs)(k,{dimColor:!0,children:[o,u!==void 0&&u>0&&(0,V.jsxs)(V.Fragment,{children:[` · `,Pe(u),` tokens`]}),d!==void 0&&d>0&&(0,V.jsxs)(V.Fragment,{children:[` `,`· `,d,` `,d===1?`tool`:`tools`]})]})]}),onCancel:t,color:`background`,inputGuide:t=>t.pending?(0,V.jsxs)(k,{children:[`Press `,t.keyName,` again to exit`]}):(0,V.jsxs)(A,{children:[r&&(0,V.jsx)(E,{shortcut:`←`,action:`go back`}),(0,V.jsx)(E,{shortcut:`Esc/Enter/Space`,action:`close`}),e.status===`running`&&n&&(0,V.jsx)(E,{shortcut:`x`,action:`stop`})]}),children:(0,V.jsxs)(O,{flexDirection:`column`,children:[e.status===`running`&&e.progress?.recentActivities&&e.progress.recentActivities.length>0&&(0,V.jsxs)(O,{flexDirection:`column`,children:[(0,V.jsx)(k,{bold:!0,dimColor:!0,children:`Progress`}),e.progress.recentActivities.map((t,n)=>(0,V.jsxs)(k,{dimColor:n<e.progress.recentActivities.length-1,wrap:`truncate-end`,children:[n===e.progress.recentActivities.length-1?`› `:` `,Ge(t,a,i)]},n))]}),c?(0,V.jsx)(O,{marginTop:1,children:(0,V.jsx)(ae,{addMargin:!1,planContent:c})}):(0,V.jsxs)(O,{flexDirection:`column`,marginTop:1,children:[(0,V.jsx)(k,{bold:!0,dimColor:!0,children:`Prompt`}),(0,V.jsx)(k,{wrap:`wrap`,children:l})]}),e.status===`failed`&&e.error&&(0,V.jsxs)(O,{flexDirection:`column`,marginTop:1,children:[(0,V.jsx)(k,{bold:!0,color:`error`,children:`Error`}),(0,V.jsx)(k,{color:`error`,wrap:`wrap`,children:e.error})]})]})})})}var $e,V,et=e((()=>{$e=t(j(),1),B(),M(),C(),Ve(),me(),L(),h(),se(),qe(),Ze(),V=P()}));function tt(e,t,n,r){if(!e)return`${t} found · ${n} verified`;if(e===`synthesizing`){let e=[`${n} verified`];return r>0&&e.push(`${r} refuted`),e.push(`deduping`),e.join(` · `)}if(e===`verifying`){let e=[`${t} found`,`${n} verified`];return r>0&&e.push(`${r} refuted`),e.join(` · `)}return t>0?`${t} found`:`finding`}function nt({text:e,phase:t=0}){return(0,H.jsx)(H.Fragment,{children:[...e].map((e,n)=>(0,H.jsx)(k,{color:fe(n+t),children:e},n))})}function rt(e,t,n){let r=(0,ot.useRef)(e),i=(0,ot.useRef)(t);return n||e<r.current?r.current=e:e>r.current&&t!==i.current&&(r.current+=1,i.current=t),r.current}function it({session:e}){let t=p().prefersReducedMotion??!1,n=e.reviewProgress,r=e.status===`running`,[,i]=we(r&&!t?st:null),a=n?.bugsFound??0,o=n?.bugsVerified??0,s=n?.bugsRefuted??0,c=t||!r,l=rt(a,i,c),u=rt(o,i,c),d=rt(s,i,c),f=Math.floor(i/(st*3))%7;if(e.status===`completed`)return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(k,{color:`background`,children:[`◆`,` `]}),(0,H.jsx)(nt,{text:`ultrareview`,phase:0}),(0,H.jsx)(k,{dimColor:!0,children:` ready · shift+↓ to view`})]});if(e.status===`failed`)return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(k,{color:`background`,children:[`◆`,` `]}),(0,H.jsx)(nt,{text:`ultrareview`,phase:0}),(0,H.jsxs)(k,{color:`error`,dimColor:!0,children:[` · `,`error`]})]});let m=n?tt(n.stage,l,u,d):`setting up`;return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(k,{color:`background`,children:[`◇`,` `]}),(0,H.jsx)(nt,{text:`ultrareview`,phase:r?f:0}),(0,H.jsxs)(k,{dimColor:!0,children:[` · `,m]})]})}function at({session:e}){if(e.isRemoteReview)return(0,H.jsx)(it,{session:e});if(e.status===`completed`)return(0,H.jsx)(k,{bold:!0,color:`success`,dimColor:!0,children:`done`});if(e.status===`failed`)return(0,H.jsx)(k,{bold:!0,color:`error`,dimColor:!0,children:`error`});if(!e.todoList.length)return(0,H.jsxs)(k,{dimColor:!0,children:[e.status,`…`]});let t=F(e.todoList,e=>e.status===`completed`),n=e.todoList.length;return(0,H.jsxs)(k,{dimColor:!0,children:[t,`/`,n]})}var ot,H,st,ct=e((()=>{ot=t(j(),1),je(),he(),M(),Ae(),_e(),H=P(),st=80}));function U({status:e,label:t,suffix:n}){return(0,W.jsxs)(k,{color:e===`completed`?`success`:e===`failed`?`error`:e===`killed`?`warning`:void 0,dimColor:!0,children:[`(`,t??e,n,`)`]})}function lt({shell:e}){switch(e.status){case`completed`:return(0,W.jsx)(U,{status:`completed`,label:`done`});case`failed`:return(0,W.jsx)(U,{status:`failed`,label:`error`});case`killed`:return(0,W.jsx)(U,{status:`killed`,label:`stopped`});case`running`:case`pending`:return(0,W.jsx)(U,{status:`running`})}}var W,ut=e((()=>{M(),W=P()}));function dt({task:e,maxActivityWidth:t}){let n=t??40;switch(e.type){case`local_bash`:return(0,G.jsxs)(k,{children:[I(e.command,n,!0),` `,(0,G.jsx)(lt,{shell:e})]});case`remote_agent`:return e.isRemoteReview?(0,G.jsx)(k,{children:(0,G.jsx)(at,{session:e})}):(0,G.jsxs)(k,{children:[(0,G.jsxs)(k,{dimColor:!0,children:[e.status===`running`||e.status===`pending`?`◇`:`◆`,` `]}),I(e.title,n,!0),(0,G.jsx)(k,{dimColor:!0,children:` · `}),(0,G.jsx)(at,{session:e})]});case`local_agent`:return(0,G.jsxs)(k,{children:[I(e.description,n,!0),` `,(0,G.jsx)(U,{status:e.status,label:e.status===`completed`?`done`:void 0,suffix:e.status===`completed`&&!e.notified?`, unread`:void 0})]});case`local_workflow`:{let t=e;return(0,G.jsxs)(k,{children:[I(t.workflowName??e.summary??e.description,n,!0),` `,(0,G.jsx)(U,{status:e.status,label:e.status===`running`?`${t.agentCount} ${R(t.agentCount,`agent`)}`:e.status===`completed`?`done`:void 0,suffix:e.status===`completed`&&!e.notified?`, unread`:void 0})]})}case`dream`:{let t=e.filesTouched.length,n=e.phase===`updating`&&t>0?`${t} ${R(t,`file`)}`:`${e.sessionsReviewing} ${R(e.sessionsReviewing,`session`)}`;return(0,G.jsxs)(k,{children:[e.description,` `,(0,G.jsxs)(k,{dimColor:!0,children:[`· `,e.phase,` · `,n]}),` `,(0,G.jsx)(U,{status:e.status,label:e.status===`completed`?`done`:void 0,suffix:e.status===`completed`&&!e.notified?`, unread`:void 0})]})}}}var G,ft=e((()=>{M(),L(),Le(),je(),ct(),ut(),G=P()}));function pt({task:e,onDone:t,onBack:n,onKill:r}){let i=z(e.startTime,e.status===`running`,1e3,0);D({"confirm:yes":t},{context:`Confirmation`});let a=i=>{i.key===` `?(i.preventDefault(),t()):i.key===`left`&&n?(i.preventDefault(),n()):i.key===`x`&&e.status===`running`&&r&&(i.preventDefault(),r())},o=e.turns.filter(e=>e.text!==``),s=o.slice(-6),c=o.length-s.length;return(0,K.jsx)(O,{flexDirection:`column`,tabIndex:0,autoFocus:!0,onKeyDown:a,children:(0,K.jsx)(N,{title:`Memory consolidation`,subtitle:(0,K.jsxs)(k,{dimColor:!0,children:[i,` · reviewing `,e.sessionsReviewing,` `,R(e.sessionsReviewing,`session`),e.filesTouched.length>0&&(0,K.jsxs)(K.Fragment,{children:[` `,`· `,e.filesTouched.length,` `,R(e.filesTouched.length,`file`),` touched`]})]}),onCancel:t,color:`background`,inputGuide:t=>t.pending?(0,K.jsxs)(k,{children:[`Press `,t.keyName,` again to exit`]}):(0,K.jsxs)(A,{children:[n&&(0,K.jsx)(E,{shortcut:`←`,action:`go back`}),(0,K.jsx)(E,{shortcut:`Esc/Enter/Space`,action:`close`}),e.status===`running`&&r&&(0,K.jsx)(E,{shortcut:`x`,action:`stop`})]}),children:(0,K.jsxs)(O,{flexDirection:`column`,gap:1,children:[(0,K.jsxs)(k,{children:[(0,K.jsx)(k,{bold:!0,children:`Status:`}),` `,e.status===`running`?(0,K.jsx)(k,{color:`background`,children:`running`}):e.status===`completed`?(0,K.jsx)(k,{color:`success`,children:e.status}):(0,K.jsx)(k,{color:`error`,children:e.status})]}),s.length===0?(0,K.jsx)(k,{dimColor:!0,children:e.status===`running`?`Starting…`:`(no text output)`}):(0,K.jsxs)(K.Fragment,{children:[c>0&&(0,K.jsxs)(k,{dimColor:!0,children:[`(`,c,` earlier `,R(c,`turn`),`)`]}),s.map((e,t)=>(0,K.jsxs)(O,{flexDirection:`column`,children:[(0,K.jsx)(k,{wrap:`wrap`,children:e.text}),e.toolUseCount>0&&(0,K.jsxs)(k,{dimColor:!0,children:[` `,`(`,e.toolUseCount,` `,R(e.toolUseCount,`tool`),`)`]})]},t))]})]})})})}var K,mt=e((()=>{B(),M(),C(),Le(),K=P()}));function ht({stage:e,completed:t,hasProgress:n}){let r=e?yt.indexOf(e):-1,i=!t&&!n;return(0,J.jsxs)(k,{children:[i?(0,J.jsx)(k,{color:`background`,children:`Setup`}):(0,J.jsx)(k,{dimColor:!0,children:`Setup`}),(0,J.jsx)(k,{dimColor:!0,children:` → `}),yt.map((e,n)=>{let a=!t&&!i&&n===r;return(0,J.jsxs)(q.Fragment,{children:[n>0&&(0,J.jsx)(k,{dimColor:!0,children:` → `}),a?(0,J.jsx)(k,{color:`background`,children:bt[e]}):(0,J.jsx)(k,{dimColor:!0,children:bt[e]})]},e)}),t&&(0,J.jsx)(k,{color:`success`,children:` ✓`})]})}function gt(e){let t=e.reviewProgress;if(!t)return e.status===`completed`?`done`:`setting up`;let n=t.bugsVerified,r=t.bugsRefuted??0;if(e.status===`completed`){let e=[`${n} ${R(n,`finding`)}`];return r>0&&e.push(`${r} refuted`),e.join(` · `)}return tt(t.stage,t.bugsFound,n,r)}function _t({session:e,onDone:t,onBack:n,onKill:r}){let i=e.status===`completed`,a=e.status===`running`||e.status===`pending`,[o,s]=(0,q.useState)(!1),c=z(e.startTime,a,1e3,0,e.endTime),l=()=>t(`Remote session details dismissed`,{display:`system`}),u=n??l,d=w(e.sessionId),f=i?`ready`:a?`running`:e.status;if(o)return(0,J.jsx)(N,{title:`Stop ultrareview?`,onCancel:()=>s(!1),color:`background`,children:(0,J.jsxs)(O,{flexDirection:`column`,gap:1,children:[(0,J.jsx)(k,{dimColor:!0,children:`This archives the remote session and stops local tracking. The review will not complete and any findings so far are discarded.`}),(0,J.jsx)(b,{options:[{label:`Stop ultrareview`,value:`stop`},{label:`Back`,value:`back`}],onChange:e=>{e===`stop`?(r?.(),u()):s(!1)}})]})});let p=i?[{label:`Open in Claude Code on the web`,value:`open`},{label:`Dismiss`,value:`dismiss`}]:[{label:`Open in Claude Code on the web`,value:`open`},...r&&a?[{label:`Stop ultrareview`,value:`stop`}]:[],{label:`Back`,value:`back`}];return(0,J.jsx)(N,{title:(0,J.jsxs)(k,{children:[(0,J.jsxs)(k,{color:`background`,children:[i?`◆`:`◇`,` `]}),(0,J.jsx)(k,{bold:!0,children:`ultrareview`}),(0,J.jsxs)(k,{dimColor:!0,children:[` · `,c,` · `,f]})]}),onCancel:u,color:`background`,inputGuide:e=>e.pending?(0,J.jsxs)(k,{children:[`Press `,e.keyName,` again to exit`]}):(0,J.jsxs)(A,{children:[(0,J.jsx)(E,{shortcut:`Enter`,action:`select`}),(0,J.jsx)(E,{shortcut:`Esc`,action:`go back`})]}),children:(0,J.jsxs)(O,{flexDirection:`column`,gap:1,children:[(0,J.jsx)(ht,{stage:e.reviewProgress?.stage,completed:i,hasProgress:!!e.reviewProgress}),(0,J.jsxs)(O,{flexDirection:`column`,children:[(0,J.jsx)(k,{children:gt(e)}),(0,J.jsx)(Ce,{url:d,children:(0,J.jsx)(k,{dimColor:!0,children:d})})]}),(0,J.jsx)(b,{options:p,onChange:e=>{switch(e){case`open`:de(d),t();break;case`stop`:s(!0);break;case`back`:u();break;case`dismiss`:l();break}}})]})})}function vt({session:e,toolUseContext:t,onDone:n,onBack:r,onKill:i}){let[a,s]=(0,q.useState)(!1),[c,l]=(0,q.useState)(null),d=(0,q.useMemo)(()=>e.isRemoteReview?[]:u(He(e.log)).filter(e=>e.type!==`progress`).slice(-3),[e]);if(e.isRemoteReview)return(0,J.jsx)(_t,{session:e,onDone:n,onBack:r,onKill:i});let f=()=>n(`Remote session details dismissed`,{display:`system`}),p=e=>{e.key===` `?(e.preventDefault(),n(`Remote session details dismissed`,{display:`system`})):e.key===`left`&&r?(e.preventDefault(),r()):e.key===`t`&&!a?(e.preventDefault(),m()):e.key===`return`&&(e.preventDefault(),f())};async function m(){s(!0),l(null);try{await pe(e.sessionId)}catch(e){l(Ee(e))}finally{s(!1)}}let h=Ne(e.title,50),g=e.status===`pending`?`starting`:e.status;return(0,J.jsx)(O,{flexDirection:`column`,tabIndex:0,autoFocus:!0,onKeyDown:p,children:(0,J.jsxs)(N,{title:`Remote session details`,onCancel:f,color:`background`,inputGuide:e=>e.pending?(0,J.jsxs)(k,{children:[`Press `,e.keyName,` again to exit`]}):(0,J.jsxs)(A,{children:[r&&(0,J.jsx)(E,{shortcut:`←`,action:`go back`}),(0,J.jsx)(E,{shortcut:`Esc/Enter/Space`,action:`close`}),!a&&(0,J.jsx)(E,{shortcut:`t`,action:`teleport`})]}),children:[(0,J.jsxs)(O,{flexDirection:`column`,children:[(0,J.jsxs)(k,{children:[(0,J.jsx)(k,{bold:!0,children:`Status`}),`:`,` `,g===`running`||g===`starting`?(0,J.jsx)(k,{color:`background`,children:g}):g===`completed`?(0,J.jsx)(k,{color:`success`,children:g}):(0,J.jsx)(k,{color:`error`,children:g})]}),(0,J.jsxs)(k,{children:[(0,J.jsx)(k,{bold:!0,children:`Runtime`}),`: `,Fe((e.endTime??Date.now())-e.startTime)]}),(0,J.jsxs)(k,{wrap:`truncate-end`,children:[(0,J.jsx)(k,{bold:!0,children:`Title`}),`: `,h]}),(0,J.jsxs)(k,{children:[(0,J.jsx)(k,{bold:!0,children:`Progress`}),`: `,(0,J.jsx)(at,{session:e})]}),(0,J.jsxs)(k,{children:[(0,J.jsx)(k,{bold:!0,children:`Session URL`}),`:`,` `,(0,J.jsx)(Ce,{url:w(e.sessionId),children:(0,J.jsx)(k,{dimColor:!0,children:w(e.sessionId)})})]})]}),e.log.length>0&&(0,J.jsxs)(O,{flexDirection:`column`,marginTop:1,children:[(0,J.jsxs)(k,{children:[(0,J.jsx)(k,{bold:!0,children:`Recent messages`}),`:`]}),(0,J.jsx)(O,{flexDirection:`column`,height:10,overflowY:`hidden`,children:d.map((e,n)=>(0,J.jsx)(o,{message:e,lookups:oe,addMargin:n>0,tools:t.options.tools,commands:t.options.commands,verbose:t.options.verbose,inProgressToolUseIDs:new Set,progressMessagesForMessage:[],shouldAnimate:!1,shouldShowDot:!1,style:`condensed`,isTranscriptMode:!1,isStatic:!0},n))}),(0,J.jsx)(O,{marginTop:1,children:(0,J.jsxs)(k,{dimColor:!0,italic:!0,children:[`Showing last `,d.length,` of `,e.log.length,` messages`]})})]}),c&&(0,J.jsx)(O,{marginTop:1,children:(0,J.jsxs)(k,{color:`error`,children:[`Teleport failed: `,c]})}),a&&(0,J.jsx)(k,{color:`background`,children:`Teleporting to session…`})]})})}var q,J,yt,bt,xt=e((()=>{q=t(j(),1),je(),B(),M(),S(),Re(),x(),De(),L(),Ue(),h(),Le(),T(),a(),v(),ct(),J=P(),yt=[`finding`,`verifying`,`synthesizing`],bt={finding:`Find`,verifying:`Verify`,synthesizing:`Dedupe`}}));async function St(e){let t=l(e.id);try{let e=await Oe(t,Tt);return{content:e.content,bytesTotal:e.bytesTotal}}catch{return{content:``,bytesTotal:0}}}function Ct({shell:e,onDone:t,onKillShell:n,onBack:r}){let{columns:i}=Te(),[a,o]=(0,Y.useState)(()=>St(e)),s=(0,Y.useDeferredValue)(a);(0,Y.useEffect)(()=>{if(e.status!==`running`)return;let t=setInterval((e,t)=>e(St(t)),1e3,o,e);return()=>clearInterval(t)},[e.id,e.status]);let c=()=>t(`Shell details dismissed`,{display:`system`});D({"confirm:yes":c},{context:`Confirmation`});let l=i=>{i.key===` `?(i.preventDefault(),t(`Shell details dismissed`,{display:`system`})):i.key===`left`&&r?(i.preventDefault(),r()):i.key===`x`&&e.status===`running`&&n&&(i.preventDefault(),n())},u=Ne(e.command,280);return(0,X.jsx)(O,{flexDirection:`column`,tabIndex:0,autoFocus:!0,onKeyDown:l,children:(0,X.jsxs)(N,{title:`Shell details`,onCancel:c,color:`background`,inputGuide:t=>t.pending?(0,X.jsxs)(k,{children:[`Press `,t.keyName,` again to exit`]}):(0,X.jsxs)(A,{children:[r&&(0,X.jsx)(E,{shortcut:`←`,action:`go back`}),(0,X.jsx)(E,{shortcut:`Esc/Enter/Space`,action:`close`}),e.status===`running`&&n&&(0,X.jsx)(E,{shortcut:`x`,action:`stop`})]}),children:[(0,X.jsxs)(O,{flexDirection:`column`,children:[(0,X.jsxs)(k,{children:[(0,X.jsx)(k,{bold:!0,children:`Status:`}),` `,e.status===`running`?(0,X.jsxs)(k,{color:`background`,children:[e.status,e.result?.code!==void 0&&` (exit code: ${e.result.code})`]}):e.status===`completed`?(0,X.jsxs)(k,{color:`success`,children:[e.status,e.result?.code!==void 0&&` (exit code: ${e.result.code})`]}):(0,X.jsxs)(k,{color:`error`,children:[e.status,e.result?.code!==void 0&&` (exit code: ${e.result.code})`]})]}),(0,X.jsxs)(k,{children:[(0,X.jsx)(k,{bold:!0,children:`Runtime:`}),` `,Fe((e.endTime??Date.now())-e.startTime)]}),(0,X.jsxs)(k,{wrap:`wrap`,children:[(0,X.jsx)(k,{bold:!0,children:`Command:`}),` `,u]})]}),(0,X.jsxs)(O,{flexDirection:`column`,children:[(0,X.jsx)(k,{bold:!0,children:`Output:`}),(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(k,{dimColor:!0,children:`Loading output…`}),children:(0,X.jsx)(wt,{outputPromise:s,columns:i})})]})]})})}function wt({outputPromise:e,columns:t}){let{content:n,bytesTotal:r}=(0,Y.use)(e);if(!n)return(0,X.jsx)(k,{dimColor:!0,children:`No output available`});let i=[],a=n.length;for(let e=0;e<10&&a>0;e++){let e=n.lastIndexOf(`
2
2
  `,a-1);i.push(e+1),a=e}i.reverse();let o=r>n.length,s=[];for(let e=0;e<i.length;e++){let t=i[e],r=e<i.length-1?i[e+1]-1:n.length,a=n.slice(t,r);a&&s.push(a)}return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(O,{borderStyle:`round`,paddingX:1,flexDirection:`column`,height:12,maxWidth:t-6,children:s.map((e,t)=>(0,X.jsx)(k,{wrap:`truncate-end`,children:e},t))}),(0,X.jsxs)(k,{dimColor:!0,italic:!0,children:[`Showing ${s.length} lines`,o?` of ${Ie(r)}`:``]})]})}var Y,X,Tt,Et=e((()=>{Y=t(j(),1),xe(),M(),C(),L(),ke(),y(),X=P(),Tt=8192}));function Dt(e,t){return Object.values(e??{}).filter(g).filter(e=>!(e.type===`local_agent`&&e.id===t))}function Ot({onDone:e,toolUseContext:t,initialDetailTaskId:n}){let r=te(e=>e.tasks),a=te(e=>e.foregroundedTaskId),o=i(),s=ne(`chat:killAgents`,`Chat`,`ctrl+x ctrl+k`),l=r,u=(0,Q.useRef)(!1),[d,p]=(0,Q.useState)(()=>{if(n)return u.current=!0,{mode:`detail`,itemId:n};let e=Dt(l,a);return e.length===1?(u.current=!0,{mode:`detail`,itemId:e[0].id}):{mode:`list`}}),[m,h]=(0,Q.useState)(0);re(`background-tasks-dialog`);let{bashTasks:_,remoteSessions:v,agentTasks:y,workflowTasks:b,dreamTasks:ee,allSelectableItems:x}=(0,Q.useMemo)(()=>{let e=Object.values(l??{}).filter(g).map(kt).sort((e,t)=>{let n=e.status,r=t.status;if(n===`running`&&r!==`running`)return-1;if(n!==`running`&&r===`running`)return 1;let i=`task`in e?e.task.startTime:0;return(`task`in t?t.task.startTime:0)-i}),t=e.filter(e=>e.type===`local_bash`),n=e.filter(e=>e.type===`remote_agent`),r=e.filter(e=>e.type===`local_agent`&&e.id!==a),i=e.filter(e=>e.type===`local_workflow`),o=e.filter(e=>e.type===`dream`);return{bashTasks:t,remoteSessions:n,agentTasks:r,workflowTasks:i,dreamTasks:o,allSelectableItems:[...t,...n,...r,...i,...o]}},[l,a]),S=x[m]??null;D({"confirm:previous":()=>h(e=>Math.max(0,e-1)),"confirm:next":()=>h(e=>Math.min(x.length-1,e+1)),"confirm:yes":()=>{let e=x[m];e&&p({mode:`detail`,itemId:e.id})}},{context:`Confirmation`,isActive:d.mode===`list`});let ie=t=>{if(d.mode!==`list`)return;if(t.key===`left`){t.preventDefault(),e(`Background tasks dialog dismissed`,{display:`system`});return}let n=x[m];n&&t.key===`x`&&(t.preventDefault(),n.type===`local_bash`&&n.status===`running`?ae(n.id):n.type===`local_agent`&&n.status===`running`?oe(n.id):n.type===`local_workflow`&&n.status===`running`?At(n.id,o):n.type===`dream`&&n.status===`running`?se(n.id):n.type===`remote_agent`&&n.status===`running`&&ce(n.id))};async function ae(e){await c.kill(e,o)}async function oe(e){await f.kill(e,o)}async function se(e){await ye.kill(e,o)}async function ce(e){await ge.kill(e,o)}let C=(0,Q.useEffectEvent)(e);(0,Q.useEffect)(()=>{if(d.mode!==`list`){let e=l?.[d.itemId];(!e||e.type!==`local_workflow`&&!g(e))&&(u.current?C(`Background tasks dialog dismissed`,{display:`system`}):p({mode:`list`}))}let e=x.length;m>=e&&e>0&&h(e-1)},[d,l,m,x,C]);let w=()=>{u.current&&x.length<=1?e(`Background tasks dialog dismissed`,{display:`system`}):(u.current=!1,p({mode:`list`}))};if(d.mode!==`list`&&l){let n=l[d.itemId];if(!n)return null;switch(n.type){case`local_bash`:return(0,$.jsx)(Ct,{shell:n,onDone:e,onKillShell:()=>void ae(n.id),onBack:w},`shell-${n.id}`);case`local_agent`:return(0,$.jsx)(Qe,{agent:n,onDone:e,onKillAgent:()=>void oe(n.id),onBack:w},`agent-${n.id}`);case`remote_agent`:return(0,$.jsx)(vt,{session:n,onDone:e,toolUseContext:t,onBack:w,onKill:n.status===`running`?()=>void ce(n.id):void 0},`session-${n.id}`);case`local_workflow`:{let e=n.status===`running`?()=>At(n.id,o):void 0;return(0,$.jsx)(O,{flexDirection:`column`,tabIndex:0,borderStyle:`round`,onKeyDown:t=>{t.key===`left`?(t.preventDefault(),w()):t.key===`x`&&e&&(t.preventDefault(),e())},children:(0,$.jsx)(N,{title:n.workflowName,subtitle:(0,$.jsxs)(k,{dimColor:!0,children:[n.status,n.summary?` · ${n.summary}`:``]}),onCancel:w,inputGuide:()=>(0,$.jsxs)(A,{children:[(0,$.jsx)(E,{shortcut:`←`,action:`go back`}),(0,$.jsx)(E,{shortcut:`Esc`,action:`close`}),e&&(0,$.jsx)(E,{shortcut:`x`,action:`stop`})]}),children:n.status===`failed`&&n.error?(0,$.jsxs)(k,{color:`error`,children:[`失败原因:`,n.error]}):null})},`workflow-${n.id}`)}case`dream`:return(0,$.jsx)(pt,{task:n,onDone:()=>e(`Background tasks dialog dismissed`,{display:`system`}),onBack:w,onKill:n.status===`running`?()=>void se(n.id):void 0},`dream-${n.id}`)}}let T=F(_,e=>e.status===`running`),le=F(v,e=>e.status===`running`||e.status===`pending`)+F(y,e=>e.status===`running`),ue=Me([...T>0?[(0,$.jsxs)(k,{children:[T,` `,T===1?`active shell`:`active shells`]},`shells`)]:[],...le>0?[(0,$.jsxs)(k,{children:[le,` `,le===1?`active agent`:`active agents`]},`agents`)]:[]],e=>(0,$.jsx)(k,{children:` · `},`separator-${e}`)),de=[(0,$.jsx)(E,{shortcut:`↑/↓`,action:`select`},`upDown`),(0,$.jsx)(E,{shortcut:`Enter`,action:`view`},`enter`),...(S?.type===`local_bash`||S?.type===`local_agent`||S?.type===`local_workflow`||S?.type===`dream`||S?.type===`remote_agent`)&&S.status===`running`?[(0,$.jsx)(E,{shortcut:`x`,action:`stop`},`kill`)]:[],...y.some(e=>e.status===`running`)?[(0,$.jsx)(E,{shortcut:s,action:`stop all agents`},`kill-all`)]:[],(0,$.jsx)(E,{shortcut:`←/Esc`,action:`close`},`esc`)],fe=()=>e(`Background tasks dialog dismissed`,{display:`system`});function pe(e){return e.pending?(0,$.jsxs)(k,{children:[`Press `,e.keyName,` again to exit`]}):(0,$.jsx)(A,{children:de})}return(0,$.jsx)(O,{flexDirection:`column`,tabIndex:0,autoFocus:!0,onKeyDown:ie,children:(0,$.jsx)(N,{title:`Background tasks`,subtitle:ue,onCancel:fe,color:`background`,inputGuide:pe,children:x.length===0?(0,$.jsx)(k,{dimColor:!0,children:`No tasks currently running`}):(0,$.jsxs)(O,{flexDirection:`column`,children:[_.length>0&&(0,$.jsxs)(O,{flexDirection:`column`,children:[(v.length>0||y.length>0)&&(0,$.jsxs)(k,{dimColor:!0,children:[(0,$.jsxs)(k,{bold:!0,children:[` `,`Shells`]}),` (`,_.length,`)`]}),(0,$.jsx)(O,{flexDirection:`column`,children:_.map(e=>(0,$.jsx)(Z,{item:e,isSelected:e.id===S?.id},e.id))})]}),v.length>0&&(0,$.jsxs)(O,{flexDirection:`column`,marginTop:+(_.length>0),children:[(0,$.jsxs)(k,{dimColor:!0,children:[(0,$.jsxs)(k,{bold:!0,children:[` `,`Remote agents`]}),` (`,v.length,`)`]}),(0,$.jsx)(O,{flexDirection:`column`,children:v.map(e=>(0,$.jsx)(Z,{item:e,isSelected:e.id===S?.id},e.id))})]}),y.length>0&&(0,$.jsxs)(O,{flexDirection:`column`,marginTop:+(_.length>0||v.length>0),children:[(0,$.jsxs)(k,{dimColor:!0,children:[(0,$.jsxs)(k,{bold:!0,children:[` `,`Local agents`]}),` (`,y.length,`)`]}),(0,$.jsx)(O,{flexDirection:`column`,children:y.map(e=>(0,$.jsx)(Z,{item:e,isSelected:e.id===S?.id},e.id))})]}),b.length>0&&(0,$.jsxs)(O,{flexDirection:`column`,marginTop:+(_.length>0||v.length>0||y.length>0),children:[(0,$.jsxs)(k,{dimColor:!0,children:[(0,$.jsxs)(k,{bold:!0,children:[` `,`Workflows`]}),` (`,b.length,`)`]}),(0,$.jsx)(O,{flexDirection:`column`,children:b.map(e=>(0,$.jsx)(Z,{item:e,isSelected:e.id===S?.id},e.id))})]}),ee.length>0&&(0,$.jsx)(O,{flexDirection:`column`,marginTop:+(_.length>0||v.length>0||y.length>0||b.length>0),children:(0,$.jsx)(O,{flexDirection:`column`,children:ee.map(e=>(0,$.jsx)(Z,{item:e,isSelected:e.id===S?.id},e.id))})})]})})})}function kt(e){switch(e.type){case`local_bash`:return{id:e.id,type:`local_bash`,label:e.command,status:e.status,task:e};case`remote_agent`:return{id:e.id,type:`remote_agent`,label:e.title,status:e.status,task:e};case`local_agent`:return{id:e.id,type:`local_agent`,label:e.description,status:e.status,task:e};case`local_workflow`:return{id:e.id,type:`local_workflow`,label:e.summary??e.description,status:e.status,task:e};case`dream`:return{id:e.id,type:`dream`,label:e.description,status:e.status,task:e}}}function Z({item:e,isSelected:t}){let{columns:n}=Te(),i=Math.max(30,n-26);return(0,$.jsxs)(O,{flexDirection:`row`,children:[(0,$.jsx)(k,{children:t?`${r.pointer} `:` `}),(0,$.jsx)(k,{color:t?`suggestion`:void 0,children:(0,$.jsx)(dt,{task:e.task,maxActivityWidth:i})})]})}var Q,$,At,jt=e((()=>{n(),Q=t(j(),1),xe(),ee(),ie(),_(),s(),S(),d(),Ae(),le(),M(),C(),ce(),et(),ft(),mt(),xt(),Et(),ve(),$=P(),At=ue}));export{B as a,Xe as i,jt as n,z as o,Ze as r,Ot as t};
@@ -1 +1 @@
1
- import{o as e}from"./rolldown-runtime-DaDcL9Zw.js";import{$d as t,Qd as n,Qu as r,Zu as i}from"./loadAgentsDir-CwEfQDOw.js";import{I as a,Lt as o,P as s,ai as c,kt as l,t as u,y as d}from"./src-DL3w8VPk2.js";import{t as f}from"./jsx-runtime-Bb4Xn-E0.js";import{g as p,x as m}from"./settings-CvhsRFaT.js";import{n as h,r as g}from"./analytics-DJobLaWP.js";var _=e(c(),1);h(),u(),t(),p(),i();var v=f();function y({onAccept:e}){let[t,i]=_.useState(null);_.useEffect(()=>{if(t!==null){let e=t,r=setTimeout(()=>n(e));return()=>clearTimeout(r)}},[t]),_.useEffect(()=>{g(`tengu_bypass_permissions_mode_dialog_shown`,{})},[]);function c(t){switch(t){case`accept`:g(`tengu_bypass_permissions_mode_dialog_accept`,{}),m(`userSettings`,{skipDangerousModePermissionPrompt:!0}),e();break;case`decline`:i(1);break}}let u=(0,_.useCallback)(()=>{i(0)},[]);return t===null?(0,v.jsxs)(d,{title:`WARNING: Work Mate running in Bypass Permissions mode`,color:`error`,onCancel:u,children:[(0,v.jsxs)(a,{flexDirection:`column`,gap:1,children:[(0,v.jsxs)(s,{children:[`In Bypass Permissions mode, Work Mate will not ask for your approval before running potentially dangerous commands.`,(0,v.jsx)(l,{}),`This mode should only be used in a sandboxed container/VM that has restricted internet access and can easily be restored if damaged.`]}),(0,v.jsx)(s,{children:`By proceeding, you accept all responsibility for actions taken while running in Bypass Permissions mode.`}),(0,v.jsx)(o,{url:`https://code.workmate.com/docs/en/security`})]}),(0,v.jsx)(r,{options:[{label:`No, exit`,value:`decline`},{label:`Yes, I accept`,value:`accept`}],onChange:e=>c(e)})]}):null}export{y as BypassPermissionsModeDialog};
1
+ import{o as e}from"./rolldown-runtime-DaDcL9Zw.js";import{$d as t,Qd as n,Qu as r,Zu as i}from"./loadAgentsDir-PPiD2Mfq.js";import{I as a,Lt as o,P as s,ai as c,kt as l,t as u,y as d}from"./src-DL3w8VPk2.js";import{t as f}from"./jsx-runtime-Bb4Xn-E0.js";import{g as p,x as m}from"./settings-CvhsRFaT.js";import{n as h,r as g}from"./analytics-DJobLaWP.js";var _=e(c(),1);h(),u(),t(),p(),i();var v=f();function y({onAccept:e}){let[t,i]=_.useState(null);_.useEffect(()=>{if(t!==null){let e=t,r=setTimeout(()=>n(e));return()=>clearTimeout(r)}},[t]),_.useEffect(()=>{g(`tengu_bypass_permissions_mode_dialog_shown`,{})},[]);function c(t){switch(t){case`accept`:g(`tengu_bypass_permissions_mode_dialog_accept`,{}),m(`userSettings`,{skipDangerousModePermissionPrompt:!0}),e();break;case`decline`:i(1);break}}let u=(0,_.useCallback)(()=>{i(0)},[]);return t===null?(0,v.jsxs)(d,{title:`WARNING: Work Mate running in Bypass Permissions mode`,color:`error`,onCancel:u,children:[(0,v.jsxs)(a,{flexDirection:`column`,gap:1,children:[(0,v.jsxs)(s,{children:[`In Bypass Permissions mode, Work Mate will not ask for your approval before running potentially dangerous commands.`,(0,v.jsx)(l,{}),`This mode should only be used in a sandboxed container/VM that has restricted internet access and can easily be restored if damaged.`]}),(0,v.jsx)(s,{children:`By proceeding, you accept all responsibility for actions taken while running in Bypass Permissions mode.`}),(0,v.jsx)(o,{url:`https://code.workmate.com/docs/en/security`})]}),(0,v.jsx)(r,{options:[{label:`No, exit`,value:`decline`},{label:`Yes, I accept`,value:`accept`}],onChange:e=>c(e)})]}):null}export{y as BypassPermissionsModeDialog};
@@ -1,4 +1,4 @@
1
- import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{n,t as r}from"./figures-5ThXQEtq.js";import{Nh as i,Ph as a,_C as o,ad as s,gC as c,hC as l,nd as u,xC as d}from"./loadAgentsDir-CwEfQDOw.js";import{C as f,Gt as ee,I as p,P as m,T as h,ai as g,ot as _,t as v,y as te}from"./src-DL3w8VPk2.js";import{t as y}from"./jsx-runtime-Bb4Xn-E0.js";import{n as b,t as x}from"./cwd-Besi3Os3.js";import{jn as S,wn as C}from"./settings-CvhsRFaT.js";import{l as w,m as T,p as E,s as D}from"./git-DplvjXEY.js";import{r as O,t as k}from"./execFileNoThrow-DYm1GeGn.js";import{S as ne,v as re}from"./startupProfiler-2sjXZkIP.js";import{l as A,o as j}from"./stringUtils-BjnclTLB.js";import{i as ie}from"./detectRepository-Qy3zKoyn.js";import{join as M,resolve as ae}from"path";import{access as oe}from"fs/promises";async function se(){if(!await w()||await P())return null;let{stdout:e,code:t}=await k(E(),[`--no-optional-locks`,`diff`,`HEAD`,`--shortstat`],{timeout:F,preserveOutputOnError:!1});if(t===0){let t=de(e);if(t&&t.filesCount>z)return{stats:t,perFileStats:new Map,hunks:new Map}}let{stdout:n,code:r}=await k(E(),[`--no-optional-locks`,`diff`,`HEAD`,`--numstat`],{timeout:F,preserveOutputOnError:!1});if(r!==0)return null;let{stats:i,perFileStats:a}=ce(n),o=I-a.size;if(o>0){let e=await ue(o);if(e){i.filesCount+=e.size;for(let[t,n]of e)a.set(t,n)}}return{stats:i,perFileStats:a,hunks:new Map}}async function N(){if(!await w()||await P())return new Map;let{stdout:e,code:t}=await k(E(),[`--no-optional-locks`,`diff`,`HEAD`],{timeout:F,preserveOutputOnError:!1});return t===0?le(e):new Map}function ce(e){let t=e.trim().split(`
1
+ import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{n,t as r}from"./figures-5ThXQEtq.js";import{Nh as i,Ph as a,_C as o,ad as s,gC as c,hC as l,nd as u,xC as d}from"./loadAgentsDir-PPiD2Mfq.js";import{C as f,Gt as ee,I as p,P as m,T as h,ai as g,ot as _,t as v,y as te}from"./src-DL3w8VPk2.js";import{t as y}from"./jsx-runtime-Bb4Xn-E0.js";import{n as b,t as x}from"./cwd-Besi3Os3.js";import{jn as S,wn as C}from"./settings-CvhsRFaT.js";import{l as w,m as T,p as E,s as D}from"./git-DplvjXEY.js";import{r as O,t as k}from"./execFileNoThrow-DYm1GeGn.js";import{S as ne,v as re}from"./startupProfiler-2sjXZkIP.js";import{l as A,o as j}from"./stringUtils-BjnclTLB.js";import{i as ie}from"./detectRepository-Qy3zKoyn.js";import{join as M,resolve as ae}from"path";import{access as oe}from"fs/promises";async function se(){if(!await w()||await P())return null;let{stdout:e,code:t}=await k(E(),[`--no-optional-locks`,`diff`,`HEAD`,`--shortstat`],{timeout:F,preserveOutputOnError:!1});if(t===0){let t=de(e);if(t&&t.filesCount>z)return{stats:t,perFileStats:new Map,hunks:new Map}}let{stdout:n,code:r}=await k(E(),[`--no-optional-locks`,`diff`,`HEAD`,`--numstat`],{timeout:F,preserveOutputOnError:!1});if(r!==0)return null;let{stats:i,perFileStats:a}=ce(n),o=I-a.size;if(o>0){let e=await ue(o);if(e){i.filesCount+=e.size;for(let[t,n]of e)a.set(t,n)}}return{stats:i,perFileStats:a,hunks:new Map}}async function N(){if(!await w()||await P())return new Map;let{stdout:e,code:t}=await k(E(),[`--no-optional-locks`,`diff`,`HEAD`],{timeout:F,preserveOutputOnError:!1});return t===0?le(e):new Map}function ce(e){let t=e.trim().split(`
2
2
  `).filter(Boolean),n=0,r=0,i=0,a=new Map;for(let e of t){let t=e.split(` `);if(t.length<3)continue;i++;let o=t[0],s=t[1],c=t.slice(2).join(` `),l=o===`-`||s===`-`,u=l?0:parseInt(o??`0`,10)||0,d=l?0:parseInt(s??`0`,10)||0;n+=u,r+=d,a.size<I&&a.set(c,{added:u,removed:d,isBinary:l})}return{stats:{filesCount:i,linesAdded:n,linesRemoved:r},perFileStats:a}}function le(e){let t=new Map;if(!e.trim())return t;let n=e.split(/^diff --git /m).filter(Boolean);for(let e of n){if(t.size>=I)break;if(e.length>L)continue;let n=e.split(`
3
3
  `),r=n[0]?.match(/^a\/(.+?) b\/(.+)$/);if(!r)continue;let i=r[2]??r[1]??``,a=[],o=null,s=0;for(let e=1;e<n.length;e++){let t=n[e]??``,r=t.match(/^@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/);if(r){o&&a.push(o),o={oldStart:parseInt(r[1]??`0`,10),oldLines:parseInt(r[2]??`1`,10),newStart:parseInt(r[3]??`0`,10),newLines:parseInt(r[4]??`1`,10),lines:[]};continue}if(!(t.startsWith(`index `)||t.startsWith(`---`)||t.startsWith(`+++`)||t.startsWith(`new file`)||t.startsWith(`deleted file`)||t.startsWith(`old mode`)||t.startsWith(`new mode`)||t.startsWith(`Binary files`))&&o&&(t.startsWith(`+`)||t.startsWith(`-`)||t.startsWith(` `)||t===``)){if(s>=R)continue;o.lines.push(`${t}`),s++}}o&&a.push(o),a.length>0&&t.set(i,a)}return t}async function P(){let e=await D(x());return e?(await Promise.all([`MERGE_HEAD`,`REBASE_HEAD`,`CHERRY_PICK_HEAD`,`REVERT_HEAD`].map(t=>oe(M(e,t)).then(()=>!0).catch(()=>!1)))).some(Boolean):!1}async function ue(e){let{stdout:t,code:n}=await k(E(),[`--no-optional-locks`,`ls-files`,`--others`,`--exclude-standard`],{timeout:F,preserveOutputOnError:!1});if(n!==0||!t.trim())return null;let r=t.trim().split(`
4
4
  `).filter(Boolean);if(r.length===0)return null;let i=new Map;for(let t of r.slice(0,e))i.set(t,{added:0,removed:0,isBinary:!1,isUntracked:!0});return i}function de(e){let t=e.match(/(\d+)\s+files?\s+changed(?:,\s+(\d+)\s+insertions?\(\+\))?(?:,\s+(\d+)\s+deletions?\(-\))?/);return t?{filesCount:parseInt(t[1]??`0`,10),linesAdded:parseInt(t[2]??`0`,10),linesRemoved:parseInt(t[3]??`0`,10)}:null}var F,I,L,R,z,B=e((()=>{b(),ie(),O(),C(),T(),F=5e3,I=50,L=1e6,R=400,z=500}));function V(){let[e,t]=(0,H.useState)(null),[n,r]=(0,H.useState)(new Map),[i,a]=(0,H.useState)(!0);return(0,H.useEffect)(()=>{let e=!1;async function n(){try{let[n,i]=await Promise.all([se(),N()]);e||(t(n),r(i),a(!1))}catch{e||(t(null),r(new Map),a(!1))}}return n(),()=>{e=!0}},[]),(0,H.useMemo)(()=>{if(!e)return{stats:null,files:[],hunks:new Map,loading:i};let{stats:t,perFileStats:r}=e,a=[];for(let[e,t]of r){let r=n.get(e),i=t.isUntracked??!1,o=!t.isBinary&&!i&&!r,s=t.added+t.removed,c=!o&&!t.isBinary&&s>U;a.push({path:e,linesAdded:t.added,linesRemoved:t.removed,isBinary:t.isBinary,isLargeFile:o,isTruncated:c,isUntracked:i})}return a.sort((e,t)=>e.path.localeCompare(t.path)),{stats:t,files:a,hunks:n,loading:!1}},[e,n,i])}var H,U,W=e((()=>{H=t(g(),1),B(),U=400}));function fe(e){if(!e||typeof e!=`object`)return!1;let t=e,n=typeof t.filePath==`string`,r=Array.isArray(t.structuredPatch)&&t.structuredPatch.length>0,i=t.type===`create`&&typeof t.content==`string`;return n&&(r||i)}function pe(e){return`type`in e&&(e.type===`create`||e.type===`update`)}function me(e){let t=0,n=0;for(let r of e)for(let e of r.lines)e.startsWith(`+`)?t++:e.startsWith(`-`)&&n++;return{added:t,removed:n}}function he(e){if(e.type!==`user`)return``;let t=e.message.content,n=typeof t==`string`?t:``;return n.length<=30?n:`${n.slice(0,29)}…`}function G(e){let t=0,n=0;for(let r of e.files.values())t+=r.linesAdded,n+=r.linesRemoved;e.stats={filesChanged:e.files.size,linesAdded:t,linesRemoved:n}}function ge(e){let t=(0,K.useRef)({completedTurns:[],currentTurn:null,lastProcessedIndex:0,lastTurnIndex:0});return(0,K.useMemo)(()=>{let n=t.current;e.length<n.lastProcessedIndex&&(n.completedTurns=[],n.currentTurn=null,n.lastProcessedIndex=0,n.lastTurnIndex=0);for(let t=n.lastProcessedIndex;t<e.length;t++){let r=e[t];if(r?.type===`user`){if(!(r.toolUseResult||Array.isArray(r.message.content)&&r.message.content[0]?.type===`tool_result`)&&!r.isMeta)n.currentTurn&&n.currentTurn.files.size>0&&(G(n.currentTurn),n.completedTurns.push(n.currentTurn)),n.lastTurnIndex++,n.currentTurn={turnIndex:n.lastTurnIndex,userPromptPreview:he(r),timestamp:r.timestamp,files:new Map,stats:{filesChanged:0,linesAdded:0,linesRemoved:0}};else if(n.currentTurn&&r.toolUseResult){let e=r.toolUseResult;if(fe(e)){let{filePath:t,structuredPatch:r}=e,i=`type`in e&&e.type===`create`,a=n.currentTurn.files.get(t);if(a||(a={filePath:t,hunks:[],isNewFile:i,linesAdded:0,linesRemoved:0},n.currentTurn.files.set(t,a)),i&&r.length===0&&pe(e)){let t=e.content.split(`
@@ -0,0 +1 @@
1
+ import{n as e,t}from"./Doctor-Wh7z6CnF.js";e();export{t as Doctor};
@@ -1,3 +1,3 @@
1
- import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{i as n,o as r}from"./envUtils-DcaKZlRU.js";import{n as i,t as a}from"./figures-5ThXQEtq.js";import{$i as o,By as s,FT as c,H_ as l,Hw as u,IT as d,JC as f,Jl as p,Ky as m,LT as h,Qi as g,RT as _,U_ as v,Uw as y,Uy as b,Wy as x,XC as S,Xh as ee,Xl as te,YC as ne,Yl as re,ZC as ie,Zh as C,aT as w,cT as T,hC as ae,qC as oe}from"./loadAgentsDir-CwEfQDOw.js";import{Gt as se,I as E,P as D,ai as ce,t as O,x as k}from"./src-DL3w8VPk2.js";import{t as A}from"./jsx-runtime-Bb4Xn-E0.js";import{Wt as j,et as M}from"./state-BPFYBqm1.js";import{H as N,kn as P,wn as F,z as I}from"./settings-CvhsRFaT.js";import{l as L,o as R}from"./stringUtils-BjnclTLB.js";import{Kn as z,Un as B,_ as V,u as H}from"./model-CeG-iOKF.js";import{n as U,t as W}from"./ValidationErrorsList-Cuq6W2yc.js";import{f as G,g as le,h as ue,i as de,n as fe,o as pe,p as me,r as he}from"./pidLock-tjm2n1Nd.js";import{n as ge,t as _e}from"./useExitOnCtrlCDWithKeybindings-D48aDPG9.js";import{n as ve,t as ye}from"./McpParsingWarnings-BeZ3Bn8N.js";import{n as be,t as xe}from"./PressEnterToContinue-Dwoh6CaW.js";import{n as Se,t as Ce}from"./useSettingsErrors-D3MlQ1GF.js";import{n as we,t as Te}from"./shadowedRuleDetection-CzRAzcC1.js";import{n as Ee,r as De,t as K}from"./statusNoticeHelpers-ODrnrLAZ.js";import{join as q}from"path";function Oe(){if(!_())return null;let e=c();if(e.length===0)return null;let t=e.filter(e=>e.severity===`error`),n=e.filter(e=>e.severity===`warning`);return(0,J.jsxs)(E,{flexDirection:`column`,marginTop:1,marginBottom:1,children:[(0,J.jsx)(D,{bold:!0,color:t.length>0?`error`:`warning`,children:`Keybinding Configuration Issues`}),(0,J.jsxs)(E,{children:[(0,J.jsx)(D,{dimColor:!0,children:`Location: `}),(0,J.jsx)(D,{dimColor:!0,children:d()})]}),(0,J.jsxs)(E,{marginLeft:1,flexDirection:`column`,marginTop:1,children:[t.map((e,t)=>(0,J.jsxs)(E,{flexDirection:`column`,children:[(0,J.jsxs)(E,{children:[(0,J.jsx)(D,{dimColor:!0,children:`└ `}),(0,J.jsx)(D,{color:`error`,children:`[Error]`}),(0,J.jsxs)(D,{dimColor:!0,children:[` `,e.message]})]}),e.suggestion&&(0,J.jsx)(E,{marginLeft:3,children:(0,J.jsxs)(D,{dimColor:!0,children:[`→ `,e.suggestion]})})]},`error-${t}`)),n.map((e,t)=>(0,J.jsxs)(E,{flexDirection:`column`,children:[(0,J.jsxs)(E,{children:[(0,J.jsx)(D,{dimColor:!0,children:`└ `}),(0,J.jsx)(D,{color:`warning`,children:`[Warning]`}),(0,J.jsxs)(D,{dimColor:!0,children:[` `,e.message]})]}),e.suggestion&&(0,J.jsx)(E,{marginLeft:3,children:(0,J.jsxs)(D,{dimColor:!0,children:[`→ `,e.suggestion]})})]},`warning-${t}`))]})]})}var J,ke=e((()=>{O(),h(),J=A()}));function Ae(){if(!w.isSupportedPlatform()||!w.isSandboxEnabledInSettings())return null;let e=w.checkDependencies(),t=e.errors.length>0,n=e.warnings.length>0;return!t&&!n?null:(0,Y.jsxs)(E,{flexDirection:`column`,children:[(0,Y.jsx)(D,{bold:!0,children:`Sandbox`}),(0,Y.jsxs)(D,{children:[`└ Status: `,(0,Y.jsx)(D,{color:t?`error`:`warning`,children:t?`Missing dependencies`:`Available (with warnings)`})]}),e.errors.map((e,t)=>(0,Y.jsxs)(D,{color:`error`,children:[`└ `,e]},t)),e.warnings.map((e,t)=>(0,Y.jsxs)(D,{color:`warning`,children:[`└ `,e]},t)),t&&(0,Y.jsx)(D,{dimColor:!0,children:`└ Run /sandbox for install instructions`})]})}var Y,je=e((()=>{O(),T(),Y=A()}));async function Me(){let e=b(await x());if(e.length===0)return null;let t=e.sort((e,t)=>t.content.length-e.content.length).map(e=>`${e.path}: ${e.content.length.toLocaleString()} chars`);return{type:`agentsmd_files`,severity:`warning`,message:e.length===1?`Large AGENTS.md file detected (${e[0].content.length.toLocaleString()} chars > ${s.toLocaleString()})`:`${e.length} large AGENTS.md files detected (each > ${s.toLocaleString()} chars)`,details:t,currentValue:e.length,threshold:s}}async function Ne(e){if(!e)return null;let t=Ee(e);if(t<=15e3)return null;let n=e.activeAgents.filter(e=>e.source!==`built-in`).map(e=>{let t=`${e.agentType}: ${e.whenToUse}`;return{name:e.agentType,tokens:o(t)}}).sort((e,t)=>t.tokens-e.tokens),r=n.slice(0,5).map(e=>`${e.name}: ~${e.tokens.toLocaleString()} tokens`);return n.length>5&&r.push(`(${n.length-5} more custom agents)`),{type:`agent_descriptions`,severity:`warning`,message:`Large agent descriptions (~${t.toLocaleString()} tokens > ${K.toLocaleString()})`,details:r,currentValue:t,threshold:K}}async function X(e,t,n){let r=e.filter(e=>e.isMcp);if(r.length===0)return null;try{let{mcpToolTokens:r,mcpToolDetails:i}=await l(e,t,n,H());if(r<=Z)return null;let a=new Map;for(let e of i){let t=e.name.split(`__`)[1]||`unknown`,n=a.get(t)||{count:0,tokens:0};a.set(t,{count:n.count+1,tokens:n.tokens+e.tokens})}let o=Array.from(a.entries()).sort((e,t)=>t[1].tokens-e[1].tokens),s=o.slice(0,5).map(([e,t])=>`${e}: ${t.count} tools (~${t.tokens.toLocaleString()} tokens)`);return o.length>5&&s.push(`(${o.length-5} more servers)`),{type:`mcp_tools`,severity:`warning`,message:`Large MCP tools context (~${r.toLocaleString()} tokens > ${Z.toLocaleString()})`,details:s,currentValue:r,threshold:Z}}catch{let e=r.reduce((e,t)=>e+o(((t.name?.length||0)+t.description.length).toString()),0);return e<=Z?null:{type:`mcp_tools`,severity:`warning`,message:`Large MCP tools context (~${e.toLocaleString()} tokens estimated > ${Z.toLocaleString()})`,details:[`${r.length} MCP tools detected (token count estimated)`],currentValue:e,threshold:Z}}}async function Pe(e){let t=Te(await e(),{sandboxAutoAllowEnabled:w.isSandboxingEnabled()&&w.isAutoAllowBashIfSandboxedEnabled()});if(t.length===0)return null;let n=t.flatMap(e=>[`${N(e.rule.ruleValue)}: ${e.reason}`,` Fix: ${e.fix}`]);return{type:`unreachable_rules`,severity:`warning`,message:`${t.length} ${L(t.length,`unreachable permission rule`)} detected`,details:n,currentValue:t.length,threshold:0}}async function Fe(e,t,n){let[r,i,a,o]=await Promise.all([Me(),Ne(t),X(e,n,t),Pe(n)]);return{agentsMdWarning:r,agentWarning:i,mcpWarning:a,unreachableRulesWarning:o}}var Z,Ie=e((()=>{g(),v(),m(),V(),I(),we(),T(),De(),R(),Z=25e3}));function Le({onDone:e}){let t=C(e=>e.agentDefinitions),r=C(e=>e.mcp.tools),i=C(e=>e.toolPermissionContext),o=C(e=>e.plugins.errors);ge();let s=(0,Q.useMemo)(()=>r||[],[r]),[c,l]=(0,Q.useState)(null),[d,m]=(0,Q.useState)(null),[h,g]=(0,Q.useState)(null),[_,v]=(0,Q.useState)(null),y=Se().filter(e=>e.mcpErrorMetadata===void 0),b=(0,Q.useMemo)(()=>[{name:`BASH_MAX_OUTPUT_LENGTH`,default:oe,upperLimit:f},{name:`TASK_MAX_OUTPUT_LENGTH`,default:p,upperLimit:re},{name:`CLAUDE_CODE_MAX_OUTPUT_TOKENS`,...B(`claude-opus-4-7`)}].map(e=>{let t=process.env[e.name],n=ie(e.name,t,e.default,e.upperLimit);return{name:e.name,...n}}).filter(e=>e.status!==`valid`),[]);(0,Q.useEffect)(()=>{ue().then(l),(async()=>{let e=q(n(),`agents`),r=q(M(),`.workmate`,`agents`),{activeAgents:a,allAgents:o,failedFiles:c}=t,[l,u]=await Promise.all([P(e),P(r)]),d={activeAgents:a.map(e=>({agentType:e.agentType,source:e.source})),userAgentsDir:e,projectAgentsDir:r,userDirExists:l,projectDirExists:u,failedFiles:c};m(d);let f=await Fe(s,{activeAgents:a,allAgents:o,failedFiles:c},async()=>i);if(g(f),pe()){let e=q(G(),`claude`,`locks`),t=fe(e),n=he(e);v({enabled:!0,locks:n,locksDir:e,staleLocksCleaned:t})}else v({enabled:!1,locks:[],locksDir:``,staleLocksCleaned:0})})()},[i,s,t]);let x=(0,Q.useCallback)(()=>{e(`Work Mate diagnostics dismissed`,{display:`system`})},[e]);return se({"confirm:yes":x,"confirm:no":x},{context:`Confirmation`}),c?(0,$.jsxs)(k,{children:[(0,$.jsxs)(E,{flexDirection:`column`,children:[(0,$.jsx)(D,{bold:!0,children:`Diagnostics`}),(0,$.jsxs)(D,{children:[`└ Currently running: `,c.installationType,` (`,c.version,`)`]}),c.packageManager&&(0,$.jsxs)(D,{children:[`└ Package manager: `,c.packageManager]}),(0,$.jsxs)(D,{children:[`└ Path: `,c.installationPath]}),(0,$.jsxs)(D,{children:[`└ Invoked: `,c.invokedBinary]}),(0,$.jsxs)(D,{children:[`└ Config install method: `,c.configInstallMethod]}),(0,$.jsxs)(D,{children:[`└ Search: `,c.ripgrepStatus.working?`OK`:`Not working`,` (`,c.ripgrepStatus.mode===`embedded`?`bundled`:c.ripgrepStatus.mode===`builtin`?`vendor`:c.ripgrepStatus.systemPath||`system`,`)`]}),c.ripgrepStatus.note&&(0,$.jsxs)(D,{color:`warning`,children:[`└ Note: `,c.ripgrepStatus.note]}),c.recommendation&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(D,{}),(0,$.jsxs)(D,{color:`warning`,children:[`Recommendation: `,c.recommendation.split(`
1
+ import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{i as n,o as r}from"./envUtils-DcaKZlRU.js";import{n as i,t as a}from"./figures-5ThXQEtq.js";import{$i as o,By as s,FT as c,H_ as l,Hw as u,IT as d,JC as f,Jl as p,Ky as m,NT as h,PT as g,Qi as _,U_ as v,Uw as y,Uy as b,Wy as x,XC as ee,Xh as te,Xl as ne,YC as re,Yl as ie,ZC as ae,Zh as S,hC as C,oT as w,qC as oe,rT as T}from"./loadAgentsDir-PPiD2Mfq.js";import{Gt as se,I as E,P as D,ai as ce,t as O,x as k}from"./src-DL3w8VPk2.js";import{t as A}from"./jsx-runtime-Bb4Xn-E0.js";import{Wt as j,et as M}from"./state-BPFYBqm1.js";import{H as N,kn as P,wn as F,z as I}from"./settings-CvhsRFaT.js";import{l as L,o as R}from"./stringUtils-BjnclTLB.js";import{Bn as z,Ln as B,_ as V,u as H}from"./model-sviY1inu.js";import{n as U,t as W}from"./ValidationErrorsList-Cuq6W2yc.js";import{f as G,g as le,h as ue,i as de,n as fe,o as pe,p as me,r as he}from"./pidLock-DuMVSwnN.js";import{n as ge,t as _e}from"./useExitOnCtrlCDWithKeybindings-C9orgrub.js";import{n as ve,t as ye}from"./McpParsingWarnings-CN8f449l.js";import{n as be,t as xe}from"./PressEnterToContinue-Dwoh6CaW.js";import{n as Se,t as Ce}from"./useSettingsErrors-BR9Wws7D.js";import{n as we,t as Te}from"./shadowedRuleDetection-Co8m1q1D.js";import{n as Ee,r as De,t as K}from"./statusNoticeHelpers-CYkrPUpN.js";import{join as q}from"path";function Oe(){if(!d())return null;let e=h();if(e.length===0)return null;let t=e.filter(e=>e.severity===`error`),n=e.filter(e=>e.severity===`warning`);return(0,J.jsxs)(E,{flexDirection:`column`,marginTop:1,marginBottom:1,children:[(0,J.jsx)(D,{bold:!0,color:t.length>0?`error`:`warning`,children:`Keybinding Configuration Issues`}),(0,J.jsxs)(E,{children:[(0,J.jsx)(D,{dimColor:!0,children:`Location: `}),(0,J.jsx)(D,{dimColor:!0,children:g()})]}),(0,J.jsxs)(E,{marginLeft:1,flexDirection:`column`,marginTop:1,children:[t.map((e,t)=>(0,J.jsxs)(E,{flexDirection:`column`,children:[(0,J.jsxs)(E,{children:[(0,J.jsx)(D,{dimColor:!0,children:`└ `}),(0,J.jsx)(D,{color:`error`,children:`[Error]`}),(0,J.jsxs)(D,{dimColor:!0,children:[` `,e.message]})]}),e.suggestion&&(0,J.jsx)(E,{marginLeft:3,children:(0,J.jsxs)(D,{dimColor:!0,children:[`→ `,e.suggestion]})})]},`error-${t}`)),n.map((e,t)=>(0,J.jsxs)(E,{flexDirection:`column`,children:[(0,J.jsxs)(E,{children:[(0,J.jsx)(D,{dimColor:!0,children:`└ `}),(0,J.jsx)(D,{color:`warning`,children:`[Warning]`}),(0,J.jsxs)(D,{dimColor:!0,children:[` `,e.message]})]}),e.suggestion&&(0,J.jsx)(E,{marginLeft:3,children:(0,J.jsxs)(D,{dimColor:!0,children:[`→ `,e.suggestion]})})]},`warning-${t}`))]})]})}var J,ke=e((()=>{O(),c(),J=A()}));function Ae(){if(!T.isSupportedPlatform()||!T.isSandboxEnabledInSettings())return null;let e=T.checkDependencies(),t=e.errors.length>0,n=e.warnings.length>0;return!t&&!n?null:(0,Y.jsxs)(E,{flexDirection:`column`,children:[(0,Y.jsx)(D,{bold:!0,children:`Sandbox`}),(0,Y.jsxs)(D,{children:[`└ Status: `,(0,Y.jsx)(D,{color:t?`error`:`warning`,children:t?`Missing dependencies`:`Available (with warnings)`})]}),e.errors.map((e,t)=>(0,Y.jsxs)(D,{color:`error`,children:[`└ `,e]},t)),e.warnings.map((e,t)=>(0,Y.jsxs)(D,{color:`warning`,children:[`└ `,e]},t)),t&&(0,Y.jsx)(D,{dimColor:!0,children:`└ Run /sandbox for install instructions`})]})}var Y,je=e((()=>{O(),w(),Y=A()}));async function Me(){let e=b(await x());if(e.length===0)return null;let t=e.sort((e,t)=>t.content.length-e.content.length).map(e=>`${e.path}: ${e.content.length.toLocaleString()} chars`);return{type:`agentsmd_files`,severity:`warning`,message:e.length===1?`Large AGENTS.md file detected (${e[0].content.length.toLocaleString()} chars > ${s.toLocaleString()})`:`${e.length} large AGENTS.md files detected (each > ${s.toLocaleString()} chars)`,details:t,currentValue:e.length,threshold:s}}async function Ne(e){if(!e)return null;let t=Ee(e);if(t<=15e3)return null;let n=e.activeAgents.filter(e=>e.source!==`built-in`).map(e=>{let t=`${e.agentType}: ${e.whenToUse}`;return{name:e.agentType,tokens:o(t)}}).sort((e,t)=>t.tokens-e.tokens),r=n.slice(0,5).map(e=>`${e.name}: ~${e.tokens.toLocaleString()} tokens`);return n.length>5&&r.push(`(${n.length-5} more custom agents)`),{type:`agent_descriptions`,severity:`warning`,message:`Large agent descriptions (~${t.toLocaleString()} tokens > ${K.toLocaleString()})`,details:r,currentValue:t,threshold:K}}async function X(e,t,n){let r=e.filter(e=>e.isMcp);if(r.length===0)return null;try{let{mcpToolTokens:r,mcpToolDetails:i}=await l(e,t,n,H());if(r<=Z)return null;let a=new Map;for(let e of i){let t=e.name.split(`__`)[1]||`unknown`,n=a.get(t)||{count:0,tokens:0};a.set(t,{count:n.count+1,tokens:n.tokens+e.tokens})}let o=Array.from(a.entries()).sort((e,t)=>t[1].tokens-e[1].tokens),s=o.slice(0,5).map(([e,t])=>`${e}: ${t.count} tools (~${t.tokens.toLocaleString()} tokens)`);return o.length>5&&s.push(`(${o.length-5} more servers)`),{type:`mcp_tools`,severity:`warning`,message:`Large MCP tools context (~${r.toLocaleString()} tokens > ${Z.toLocaleString()})`,details:s,currentValue:r,threshold:Z}}catch{let e=r.reduce((e,t)=>e+o(((t.name?.length||0)+t.description.length).toString()),0);return e<=Z?null:{type:`mcp_tools`,severity:`warning`,message:`Large MCP tools context (~${e.toLocaleString()} tokens estimated > ${Z.toLocaleString()})`,details:[`${r.length} MCP tools detected (token count estimated)`],currentValue:e,threshold:Z}}}async function Pe(e){let t=Te(await e(),{sandboxAutoAllowEnabled:T.isSandboxingEnabled()&&T.isAutoAllowBashIfSandboxedEnabled()});if(t.length===0)return null;let n=t.flatMap(e=>[`${N(e.rule.ruleValue)}: ${e.reason}`,` Fix: ${e.fix}`]);return{type:`unreachable_rules`,severity:`warning`,message:`${t.length} ${L(t.length,`unreachable permission rule`)} detected`,details:n,currentValue:t.length,threshold:0}}async function Fe(e,t,n){let[r,i,a,o]=await Promise.all([Me(),Ne(t),X(e,n,t),Pe(n)]);return{agentsMdWarning:r,agentWarning:i,mcpWarning:a,unreachableRulesWarning:o}}var Z,Ie=e((()=>{_(),v(),m(),V(),I(),we(),w(),De(),R(),Z=25e3}));function Le({onDone:e}){let t=S(e=>e.agentDefinitions),r=S(e=>e.mcp.tools),i=S(e=>e.toolPermissionContext),o=S(e=>e.plugins.errors);ge();let s=(0,Q.useMemo)(()=>r||[],[r]),[c,l]=(0,Q.useState)(null),[d,m]=(0,Q.useState)(null),[h,g]=(0,Q.useState)(null),[_,v]=(0,Q.useState)(null),y=Se().filter(e=>e.mcpErrorMetadata===void 0),b=(0,Q.useMemo)(()=>[{name:`BASH_MAX_OUTPUT_LENGTH`,default:oe,upperLimit:f},{name:`TASK_MAX_OUTPUT_LENGTH`,default:p,upperLimit:ie},{name:`CLAUDE_CODE_MAX_OUTPUT_TOKENS`,...B(`claude-opus-4-7`)}].map(e=>{let t=process.env[e.name],n=ae(e.name,t,e.default,e.upperLimit);return{name:e.name,...n}}).filter(e=>e.status!==`valid`),[]);(0,Q.useEffect)(()=>{ue().then(l),(async()=>{let e=q(n(),`agents`),r=q(M(),`.workmate`,`agents`),{activeAgents:a,allAgents:o,failedFiles:c}=t,[l,u]=await Promise.all([P(e),P(r)]),d={activeAgents:a.map(e=>({agentType:e.agentType,source:e.source})),userAgentsDir:e,projectAgentsDir:r,userDirExists:l,projectDirExists:u,failedFiles:c};m(d);let f=await Fe(s,{activeAgents:a,allAgents:o,failedFiles:c},async()=>i);if(g(f),pe()){let e=q(G(),`claude`,`locks`),t=fe(e),n=he(e);v({enabled:!0,locks:n,locksDir:e,staleLocksCleaned:t})}else v({enabled:!1,locks:[],locksDir:``,staleLocksCleaned:0})})()},[i,s,t]);let x=(0,Q.useCallback)(()=>{e(`Work Mate diagnostics dismissed`,{display:`system`})},[e]);return se({"confirm:yes":x,"confirm:no":x},{context:`Confirmation`}),c?(0,$.jsxs)(k,{children:[(0,$.jsxs)(E,{flexDirection:`column`,children:[(0,$.jsx)(D,{bold:!0,children:`Diagnostics`}),(0,$.jsxs)(D,{children:[`└ Currently running: `,c.installationType,` (`,c.version,`)`]}),c.packageManager&&(0,$.jsxs)(D,{children:[`└ Package manager: `,c.packageManager]}),(0,$.jsxs)(D,{children:[`└ Path: `,c.installationPath]}),(0,$.jsxs)(D,{children:[`└ Invoked: `,c.invokedBinary]}),(0,$.jsxs)(D,{children:[`└ Config install method: `,c.configInstallMethod]}),(0,$.jsxs)(D,{children:[`└ Search: `,c.ripgrepStatus.working?`OK`:`Not working`,` (`,c.ripgrepStatus.mode===`embedded`?`bundled`:c.ripgrepStatus.mode===`builtin`?`vendor`:c.ripgrepStatus.systemPath||`system`,`)`]}),c.ripgrepStatus.note&&(0,$.jsxs)(D,{color:`warning`,children:[`└ Note: `,c.ripgrepStatus.note]}),c.recommendation&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(D,{}),(0,$.jsxs)(D,{color:`warning`,children:[`Recommendation: `,c.recommendation.split(`
2
2
  `)[0]]}),(0,$.jsx)(D,{dimColor:!0,children:c.recommendation.split(`
3
- `)[1]})]}),c.multipleInstallations.length>1&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(D,{}),(0,$.jsx)(D,{color:`warning`,children:`Warning: Multiple installations found`}),c.multipleInstallations.map((e,t)=>(0,$.jsxs)(D,{children:[`└ `,e.type,` at `,e.path]},t))]}),c.warnings.length>0&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(D,{}),c.warnings.map((e,t)=>(0,$.jsxs)(E,{flexDirection:`column`,children:[(0,$.jsxs)(D,{color:`warning`,children:[`Warning: `,e.issue]}),(0,$.jsxs)(D,{children:[`Fix: `,e.fix]})]},t))]}),y.length>0&&(0,$.jsxs)(E,{flexDirection:`column`,marginTop:1,marginBottom:1,children:[(0,$.jsx)(D,{bold:!0,children:`Invalid Settings`}),(0,$.jsx)(W,{errors:y})]})]}),(0,$.jsx)(Ae,{}),(0,$.jsx)(ye,{}),(0,$.jsx)(Oe,{}),b.length>0&&(0,$.jsxs)(E,{flexDirection:`column`,children:[(0,$.jsx)(D,{bold:!0,children:`Environment Variables`}),b.map((e,t)=>(0,$.jsxs)(D,{children:[`└ `,e.name,`:`,` `,(0,$.jsx)(D,{color:e.status===`capped`?`warning`:`error`,children:e.message})]},t))]}),_?.enabled&&(0,$.jsxs)(E,{flexDirection:`column`,children:[(0,$.jsx)(D,{bold:!0,children:`Version Locks`}),_.staleLocksCleaned>0&&(0,$.jsxs)(D,{dimColor:!0,children:[`└ Cleaned `,_.staleLocksCleaned,` stale lock(s)`]}),_.locks.length===0?(0,$.jsx)(D,{dimColor:!0,children:`└ No active version locks`}):_.locks.map((e,t)=>(0,$.jsxs)(D,{children:[`└ `,e.version,`: PID `,e.pid,` `,e.isProcessRunning?(0,$.jsx)(D,{children:`(running)`}):(0,$.jsx)(D,{color:`warning`,children:`(stale)`})]},t))]}),d?.failedFiles&&d.failedFiles.length>0&&(0,$.jsxs)(E,{flexDirection:`column`,children:[(0,$.jsx)(D,{bold:!0,color:`error`,children:`Agent Parse Errors`}),(0,$.jsxs)(D,{color:`error`,children:[`└ Failed to parse `,d.failedFiles.length,` agent file(s):`]}),d.failedFiles.map((e,t)=>(0,$.jsxs)(D,{dimColor:!0,children:[` `,`└ `,e.path,`: `,e.error]},t))]}),o.length>0&&(0,$.jsxs)(E,{flexDirection:`column`,children:[(0,$.jsx)(D,{bold:!0,color:`error`,children:`Plugin Errors`}),(0,$.jsxs)(D,{color:`error`,children:[`└ `,o.length,` plugin error(s) detected:`]}),o.map((e,t)=>(0,$.jsxs)(D,{dimColor:!0,children:[` `,`└ `,e.source||`unknown`,`plugin`in e&&e.plugin?` [${e.plugin}]`:``,`: `,u(e)]},t))]}),h?.unreachableRulesWarning&&(0,$.jsxs)(E,{flexDirection:`column`,children:[(0,$.jsx)(D,{bold:!0,color:`warning`,children:`Unreachable Permission Rules`}),(0,$.jsxs)(D,{children:[`└`,` `,(0,$.jsxs)(D,{color:`warning`,children:[a.warning,` `,h.unreachableRulesWarning.message]})]}),h.unreachableRulesWarning.details.map((e,t)=>(0,$.jsxs)(D,{dimColor:!0,children:[` `,`└ `,e]},t))]}),h&&(h.agentsMdWarning||h.agentWarning||h.mcpWarning)&&(0,$.jsxs)(E,{flexDirection:`column`,children:[(0,$.jsx)(D,{bold:!0,children:`Context Usage Warnings`}),h.agentsMdWarning&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(D,{children:[`└`,` `,(0,$.jsxs)(D,{color:`warning`,children:[a.warning,` `,h.agentsMdWarning.message]})]}),(0,$.jsxs)(D,{children:[` `,`└ Files:`]}),h.agentsMdWarning.details.map((e,t)=>(0,$.jsxs)(D,{dimColor:!0,children:[` `,`└ `,e]},t))]}),h.agentWarning&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(D,{children:[`└`,` `,(0,$.jsxs)(D,{color:`warning`,children:[a.warning,` `,h.agentWarning.message]})]}),(0,$.jsxs)(D,{children:[` `,`└ Top contributors:`]}),h.agentWarning.details.map((e,t)=>(0,$.jsxs)(D,{dimColor:!0,children:[` `,`└ `,e]},t))]}),h.mcpWarning&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(D,{children:[`└`,` `,(0,$.jsxs)(D,{color:`warning`,children:[a.warning,` `,h.mcpWarning.message]})]}),(0,$.jsxs)(D,{children:[` `,`└ MCP servers:`]}),h.mcpWarning.details.map((e,t)=>(0,$.jsxs)(D,{dimColor:!0,children:[` `,`└ `,e]},t))]})]}),(0,$.jsx)(E,{children:(0,$.jsx)(xe,{})})]}):(0,$.jsx)(k,{children:(0,$.jsx)(D,{dimColor:!0,children:`Checking installation status…`})})}var Q,$,Re=e((()=>{i(),Q=t(ce(),1),ke(),ve(),z(),r(),j(),O(),be(),je(),U(),Ce(),_e(),ae(),ee(),y(),Ie(),le(),S(),F(),de(),ne(),te(),me(),$=A()}));export{Re as n,Le as t};
3
+ `)[1]})]}),c.multipleInstallations.length>1&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(D,{}),(0,$.jsx)(D,{color:`warning`,children:`Warning: Multiple installations found`}),c.multipleInstallations.map((e,t)=>(0,$.jsxs)(D,{children:[`└ `,e.type,` at `,e.path]},t))]}),c.warnings.length>0&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(D,{}),c.warnings.map((e,t)=>(0,$.jsxs)(E,{flexDirection:`column`,children:[(0,$.jsxs)(D,{color:`warning`,children:[`Warning: `,e.issue]}),(0,$.jsxs)(D,{children:[`Fix: `,e.fix]})]},t))]}),y.length>0&&(0,$.jsxs)(E,{flexDirection:`column`,marginTop:1,marginBottom:1,children:[(0,$.jsx)(D,{bold:!0,children:`Invalid Settings`}),(0,$.jsx)(W,{errors:y})]})]}),(0,$.jsx)(Ae,{}),(0,$.jsx)(ye,{}),(0,$.jsx)(Oe,{}),b.length>0&&(0,$.jsxs)(E,{flexDirection:`column`,children:[(0,$.jsx)(D,{bold:!0,children:`Environment Variables`}),b.map((e,t)=>(0,$.jsxs)(D,{children:[`└ `,e.name,`:`,` `,(0,$.jsx)(D,{color:e.status===`capped`?`warning`:`error`,children:e.message})]},t))]}),_?.enabled&&(0,$.jsxs)(E,{flexDirection:`column`,children:[(0,$.jsx)(D,{bold:!0,children:`Version Locks`}),_.staleLocksCleaned>0&&(0,$.jsxs)(D,{dimColor:!0,children:[`└ Cleaned `,_.staleLocksCleaned,` stale lock(s)`]}),_.locks.length===0?(0,$.jsx)(D,{dimColor:!0,children:`└ No active version locks`}):_.locks.map((e,t)=>(0,$.jsxs)(D,{children:[`└ `,e.version,`: PID `,e.pid,` `,e.isProcessRunning?(0,$.jsx)(D,{children:`(running)`}):(0,$.jsx)(D,{color:`warning`,children:`(stale)`})]},t))]}),d?.failedFiles&&d.failedFiles.length>0&&(0,$.jsxs)(E,{flexDirection:`column`,children:[(0,$.jsx)(D,{bold:!0,color:`error`,children:`Agent Parse Errors`}),(0,$.jsxs)(D,{color:`error`,children:[`└ Failed to parse `,d.failedFiles.length,` agent file(s):`]}),d.failedFiles.map((e,t)=>(0,$.jsxs)(D,{dimColor:!0,children:[` `,`└ `,e.path,`: `,e.error]},t))]}),o.length>0&&(0,$.jsxs)(E,{flexDirection:`column`,children:[(0,$.jsx)(D,{bold:!0,color:`error`,children:`Plugin Errors`}),(0,$.jsxs)(D,{color:`error`,children:[`└ `,o.length,` plugin error(s) detected:`]}),o.map((e,t)=>(0,$.jsxs)(D,{dimColor:!0,children:[` `,`└ `,e.source||`unknown`,`plugin`in e&&e.plugin?` [${e.plugin}]`:``,`: `,u(e)]},t))]}),h?.unreachableRulesWarning&&(0,$.jsxs)(E,{flexDirection:`column`,children:[(0,$.jsx)(D,{bold:!0,color:`warning`,children:`Unreachable Permission Rules`}),(0,$.jsxs)(D,{children:[`└`,` `,(0,$.jsxs)(D,{color:`warning`,children:[a.warning,` `,h.unreachableRulesWarning.message]})]}),h.unreachableRulesWarning.details.map((e,t)=>(0,$.jsxs)(D,{dimColor:!0,children:[` `,`└ `,e]},t))]}),h&&(h.agentsMdWarning||h.agentWarning||h.mcpWarning)&&(0,$.jsxs)(E,{flexDirection:`column`,children:[(0,$.jsx)(D,{bold:!0,children:`Context Usage Warnings`}),h.agentsMdWarning&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(D,{children:[`└`,` `,(0,$.jsxs)(D,{color:`warning`,children:[a.warning,` `,h.agentsMdWarning.message]})]}),(0,$.jsxs)(D,{children:[` `,`└ Files:`]}),h.agentsMdWarning.details.map((e,t)=>(0,$.jsxs)(D,{dimColor:!0,children:[` `,`└ `,e]},t))]}),h.agentWarning&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(D,{children:[`└`,` `,(0,$.jsxs)(D,{color:`warning`,children:[a.warning,` `,h.agentWarning.message]})]}),(0,$.jsxs)(D,{children:[` `,`└ Top contributors:`]}),h.agentWarning.details.map((e,t)=>(0,$.jsxs)(D,{dimColor:!0,children:[` `,`└ `,e]},t))]}),h.mcpWarning&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(D,{children:[`└`,` `,(0,$.jsxs)(D,{color:`warning`,children:[a.warning,` `,h.mcpWarning.message]})]}),(0,$.jsxs)(D,{children:[` `,`└ MCP servers:`]}),h.mcpWarning.details.map((e,t)=>(0,$.jsxs)(D,{dimColor:!0,children:[` `,`└ `,e]},t))]})]}),(0,$.jsx)(E,{children:(0,$.jsx)(xe,{})})]}):(0,$.jsx)(k,{children:(0,$.jsx)(D,{dimColor:!0,children:`Checking installation status…`})})}var Q,$,Re=e((()=>{i(),Q=t(ce(),1),ke(),ve(),z(),r(),j(),O(),be(),je(),U(),Ce(),_e(),C(),te(),y(),Ie(),le(),ee(),F(),de(),re(),ne(),me(),$=A()}));export{Re as n,Le as t};
@@ -0,0 +1,2 @@
1
+ import{a as e,n as t,o as n}from"./rolldown-runtime-DaDcL9Zw.js";import{$T as r,$d as i,$u as a,FC as o,Mu as s,PC as c,Pu as l,Qu as u,St as d,Tt as f,Zd as p,_T as m,br as h,eE as g,ft as _,mi as v,vT as y,wt as b,yt as x}from"./loadAgentsDir-PPiD2Mfq.js";import{I as S,P as C,ai as w,t as T,y as E}from"./src-DL3w8VPk2.js";import{t as D}from"./jsx-runtime-Bb4Xn-E0.js";import{c as O,i as k}from"./debug-BQj6h99Q.js";import{r as A,t as j}from"./execFileNoThrow-DYm1GeGn.js";import{n as M,r as N}from"./analytics-DJobLaWP.js";function P(){(h(),e(v)).saveWorktreeState(null)}function F({onDone:e,onCancel:t}){let[n,i]=(0,I.useState)(`loading`),[a,c]=(0,I.useState)([]),[l,d]=(0,I.useState)(0),[p,m]=(0,I.useState)(),h=x();if((0,I.useEffect)(()=>{async function e(){let e=[],t=await j(`git`,[`status`,`--porcelain`]);if(t.stdout&&(e=t.stdout.split(`
2
+ `).filter(e=>e.trim()!==``),c(e)),h){let{stdout:t}=await j(`git`,[`rev-list`,`--count`,`${h.originalHeadCommit}..HEAD`]),n=parseInt(t.trim(),10)||0;if(d(n),e.length===0&&n===0){i(`removing`),_().then(()=>{process.chdir(h.originalCwd),o(h.originalCwd),P(),r.cache.clear?.(),m(`Worktree removed (no changes)`)}).catch(e=>{O(`Failed to clean up worktree: ${e}`,{level:`error`}),m(`Worktree cleanup failed, exiting anyway`)}).then(()=>{i(`done`)});return}else i(`asking`)}}e()},[h]),(0,I.useEffect)(()=>{n===`done`&&e(p)},[n,e,p]),!h)return e(`No active worktree session found`,{display:`system`}),null;if(n===`loading`||n===`done`)return null;async function g(e){if(!h)return;let t=!!h.tmuxSessionName;if(e===`keep`||e===`keep-with-tmux`)i(`keeping`),N(`tengu_worktree_kept`,{commits:l,changed_files:a.length}),await b(),process.chdir(h.originalCwd),o(h.originalCwd),P(),r.cache.clear?.(),m(t?`Worktree kept. Your work is saved at ${h.worktreePath} on branch ${h.worktreeBranch}. Reattach to tmux session with: tmux attach -t ${h.tmuxSessionName}`:`Worktree kept. Your work is saved at ${h.worktreePath} on branch ${h.worktreeBranch}`),i(`done`);else if(e===`keep-kill-tmux`)i(`keeping`),N(`tengu_worktree_kept`,{commits:l,changed_files:a.length}),h.tmuxSessionName&&await f(h.tmuxSessionName),await b(),process.chdir(h.originalCwd),o(h.originalCwd),P(),r.cache.clear?.(),m(`Worktree kept at ${h.worktreePath} on branch ${h.worktreeBranch}. Tmux session terminated.`),i(`done`);else if(e===`remove`||e===`remove-with-tmux`){i(`removing`),N(`tengu_worktree_removed`,{commits:l,changed_files:a.length}),h.tmuxSessionName&&await f(h.tmuxSessionName);try{await _(),process.chdir(h.originalCwd),o(h.originalCwd),P(),r.cache.clear?.()}catch(e){O(`Failed to clean up worktree: ${e}`,{level:`error`}),m(`Worktree cleanup failed, exiting anyway`),i(`done`);return}let e=t?` Tmux session terminated.`:``;l>0&&a.length>0?m(`Worktree removed. ${l} ${l===1?`commit`:`commits`} and uncommitted changes were discarded.${e}`):l>0?m(`Worktree removed. ${l} ${l===1?`commit`:`commits`} on ${h.worktreeBranch} ${l===1?`was`:`were`} discarded.${e}`):a.length>0?m(`Worktree removed. Uncommitted changes were discarded.${e}`):m(`Worktree removed.${e}`),i(`done`)}}if(n===`keeping`)return(0,L.jsxs)(S,{flexDirection:`row`,marginY:1,children:[(0,L.jsx)(s,{}),(0,L.jsx)(C,{children:`Keeping worktree…`})]});if(n===`removing`)return(0,L.jsxs)(S,{flexDirection:`row`,marginY:1,children:[(0,L.jsx)(s,{}),(0,L.jsx)(C,{children:`Removing worktree…`})]});let v=h.worktreeBranch,y=a.length>0,w=l>0,T=``;T=y&&w?`You have ${a.length} uncommitted ${a.length===1?`file`:`files`} and ${l} ${l===1?`commit`:`commits`} on ${v}. All will be lost if you remove.`:y?`You have ${a.length} uncommitted ${a.length===1?`file`:`files`}. These will be lost if you remove the worktree.`:w?`You have ${l} ${l===1?`commit`:`commits`} on ${v}. The branch will be deleted if you remove the worktree.`:`You are working in a worktree. Keep it to continue working there, or remove it to clean up.`;function D(){if(t){t();return}g(`keep`)}let k=y||w?`All changes and commits will be lost.`:`Clean up the worktree directory.`,A=!!h.tmuxSessionName,M=A?[{label:`Keep worktree and tmux session`,value:`keep-with-tmux`,description:`Stays at ${h.worktreePath}. Reattach with: tmux attach -t ${h.tmuxSessionName}`},{label:`Keep worktree, kill tmux session`,value:`keep-kill-tmux`,description:`Keeps worktree at ${h.worktreePath}, terminates tmux session.`},{label:`Remove worktree and tmux session`,value:`remove-with-tmux`,description:k}]:[{label:`Keep worktree`,value:`keep`,description:`Stays at ${h.worktreePath}`},{label:`Remove worktree`,value:`remove`,description:k}];return(0,L.jsx)(E,{title:`Exiting worktree session`,subtitle:T,onCancel:D,children:(0,L.jsx)(u,{defaultFocusValue:A?`keep-with-tmux`:`keep`,options:M,onChange:g})})}var I,L,R=t((()=>{I=n(w(),1),M(),k(),T(),A(),g(),c(),d(),a(),l(),L=D()}));function z(){return y(H)??`Goodbye!`}function B({showWorktree:e,onDone:t,onCancel:n}){async function r(e){t(e??z()),await p(0,`prompt_input_exit`)}return e?(0,V.jsx)(F,{onDone:r,onCancel:n}):null}var V,H,U=t((()=>{m(),i(),R(),V=D(),H=[`Goodbye!`,`See ya!`,`Bye!`,`Catch you later!`]}));export{U as n,B as t};
@@ -1,4 +1,4 @@
1
- import{o as e}from"./rolldown-runtime-DaDcL9Zw.js";import{Qu as t,Zu as n}from"./loadAgentsDir-CwEfQDOw.js";import{D as r,I as i,Lt as a,P as o,T as s,ai as c,t as l,y as u}from"./src-DL3w8VPk2.js";import{t as d}from"./jsx-runtime-Bb4Xn-E0.js";import{n as f,r as p}from"./analytics-DJobLaWP.js";import{i as m,o as h,r as g,s as _,t as v}from"./grove-Bck1zFaD.js";var y=e(c(),1);f(),l(),n();var b=d(),x=` _____________
1
+ import{o as e}from"./rolldown-runtime-DaDcL9Zw.js";import{Qu as t,Zu as n}from"./loadAgentsDir-PPiD2Mfq.js";import{D as r,I as i,Lt as a,P as o,T as s,ai as c,t as l,y as u}from"./src-DL3w8VPk2.js";import{t as d}from"./jsx-runtime-Bb4Xn-E0.js";import{n as f,r as p}from"./analytics-DJobLaWP.js";import{i as m,o as h,r as g,s as _,t as v}from"./grove-CQBCzeHf.js";var y=e(c(),1);f(),l(),n();var b=d(),x=` _____________
2
2
  | \\ \\
3
3
  | NEW TERMS \\__\\
4
4
  | |
@@ -1,2 +1,2 @@
1
- import{l as e,o as t}from"./envUtils-DcaKZlRU.js";import{n,t as r}from"./defineProperty-C-QyHrDq.js";import{n as i,t as a}from"./axios-DaWTGg7G.js";import{$C as o,QC as s}from"./loadAgentsDir-CwEfQDOw.js";import{C as c,c as l,i as u,x as d}from"./debug-BQj6h99Q.js";import{O as f,k as p}from"./git-DplvjXEY.js";import{n as m,r as h}from"./analytics-DJobLaWP.js";import{c as g,h as _,l as v,m as y,s as b}from"./proxy-C0j74LqT.js";import{C as x,S,f as C,g as w,u as T}from"./sessionState-zhvcDpb2.js";import{n as E,t as D}from"./rcDebugLog-DSchf3Hs.js";import{r as O}from"./ccrClient--8aPutWE.js";a(),x(),m(),o(),u(),D(),f(),t(),_(),v(),T(),d(),n();var k=`{"type":"keep_alive"}
1
+ import{l as e,o as t}from"./envUtils-DcaKZlRU.js";import{n,t as r}from"./defineProperty-C-QyHrDq.js";import{n as i,t as a}from"./axios-DaWTGg7G.js";import{$C as o,QC as s}from"./loadAgentsDir-PPiD2Mfq.js";import{C as c,c as l,i as u,x as d}from"./debug-BQj6h99Q.js";import{O as f,k as p}from"./git-DplvjXEY.js";import{n as m,r as h}from"./analytics-DJobLaWP.js";import{c as g,h as _,l as v,m as y,s as b}from"./proxy-C0j74LqT.js";import{C as x,S,f as C,g as w,u as T}from"./sessionState-BTFowSpR.js";import{n as E,t as D}from"./rcDebugLog-DSchf3Hs.js";import{r as O}from"./ccrClient-AfdUbWzY.js";a(),x(),m(),o(),u(),D(),f(),t(),_(),v(),T(),d(),n();var k=`{"type":"keep_alive"}
2
2
  `,A=1e3,j=1e3,M=3e4,N=6e5,P=1e4,F=12e4,I=M*2,L=new Set([1002,4001,4003]),R=class{constructor(e,t={},n,i,a){r(this,`ws`,null),r(this,`lastSentId`,null),r(this,`url`,void 0),r(this,`state`,`idle`),r(this,`onData`,void 0),r(this,`onCloseCallback`,void 0),r(this,`onConnectCallback`,void 0),r(this,`headers`,void 0),r(this,`sessionId`,void 0),r(this,`autoReconnect`,void 0),r(this,`isBridge`,void 0),r(this,`reconnectAttempts`,0),r(this,`reconnectStartTime`,null),r(this,`reconnectTimer`,null),r(this,`lastReconnectAttemptTime`,null),r(this,`lastActivityTime`,0),r(this,`pingInterval`,null),r(this,`pongReceived`,!0),r(this,`keepAliveInterval`,null),r(this,`messageBuffer`,void 0),r(this,`isBunWs`,!1),r(this,`connectStartTime`,0),r(this,`refreshHeaders`,void 0),r(this,`onBunOpen`,()=>{this.handleOpenEvent(),this.lastSentId&&this.replayBufferedMessages(``)}),r(this,`onBunMessage`,e=>{let t=typeof e.data==`string`?e.data:String(e.data);this.lastActivityTime=Date.now(),p(`info`,`cli_websocket_message_received`,{length:t.length}),this.onData&&this.onData(t)}),r(this,`onBunError`,()=>{l(`WebSocketTransport: Error`,{level:`error`}),p(`error`,`cli_websocket_connect_error`)}),r(this,`onBunClose`,e=>{let t=e.code===1e3||e.code===1001;l(`WebSocketTransport: Closed: ${e.code}`,t?void 0:{level:`error`}),p(`error`,`cli_websocket_connect_closed`),this.handleConnectionError(e.code)}),r(this,`onNodeOpen`,()=>{let e=this.ws;if(this.handleOpenEvent(),!e)return;let t=e.upgradeReq;if(t?.headers?.[`x-last-request-id`]){let e=t.headers[`x-last-request-id`];this.replayBufferedMessages(e)}}),r(this,`onNodeMessage`,e=>{let t=e.toString();this.lastActivityTime=Date.now(),p(`info`,`cli_websocket_message_received`,{length:t.length}),this.onData&&this.onData(t)}),r(this,`onNodeError`,e=>{l(`WebSocketTransport: Error: ${e.message}`,{level:`error`}),p(`error`,`cli_websocket_connect_error`)}),r(this,`onNodeClose`,(e,t)=>{let n=e===1e3||e===1001;l(`WebSocketTransport: Closed: ${e}`,n?void 0:{level:`error`}),p(`error`,`cli_websocket_connect_closed`),this.handleConnectionError(e)}),r(this,`onPong`,()=>{this.pongReceived=!0}),this.url=e,this.headers=t,this.sessionId=n,this.refreshHeaders=i,this.autoReconnect=a?.autoReconnect??!0,this.isBridge=a?.isBridge??!1,this.messageBuffer=new s(A)}async connect(){if(this.state!==`idle`&&this.state!==`reconnecting`){l(`WebSocketTransport: Cannot connect, current state is ${this.state}`,{level:`error`}),p(`error`,`cli_websocket_connect_failed`);return}this.state=`reconnecting`,this.connectStartTime=Date.now(),l(`WebSocketTransport: Opening ${this.url.href}`),p(`info`,`cli_websocket_connect_opening`);let e={...this.headers};if(this.lastSentId&&(e[`X-Last-Request-Id`]=this.lastSentId,l(`WebSocketTransport: Adding X-Last-Request-Id header: ${this.lastSentId}`)),typeof Bun<`u`){let t=new globalThis.WebSocket(this.url.href,{headers:e,proxy:g(this.url.href),tls:y()||void 0});this.ws=t,this.isBunWs=!0,t.addEventListener(`open`,this.onBunOpen),t.addEventListener(`message`,this.onBunMessage),t.addEventListener(`error`,this.onBunError),t.addEventListener(`close`,this.onBunClose),t.addEventListener(`pong`,this.onPong)}else{let{default:t}=await import(`./wrapper-K8ZapJVu.js`),n=new t(this.url.href,{headers:e,agent:b(this.url.href),...y()});this.ws=n,this.isBunWs=!1,n.on(`open`,this.onNodeOpen),n.on(`message`,this.onNodeMessage),n.on(`error`,this.onNodeError),n.on(`close`,this.onNodeClose),n.on(`pong`,this.onPong)}}handleOpenEvent(){let e=Date.now()-this.connectStartTime;l(`WebSocketTransport: Connected`),p(`info`,`cli_websocket_connect_connected`,{duration_ms:e}),this.isBridge&&this.reconnectStartTime!==null&&h(`tengu_ws_transport_reconnected`,{attempts:this.reconnectAttempts,downtimeMs:Date.now()-this.reconnectStartTime}),this.reconnectAttempts=0,this.reconnectStartTime=null,this.lastReconnectAttemptTime=null,this.lastActivityTime=Date.now(),this.state=`connected`,this.onConnectCallback?.(),this.startPingInterval(),this.startKeepaliveInterval(),C(()=>{this.write({type:`keep_alive`})})}sendLine(e){if(!this.ws||this.state!==`connected`)return l(`WebSocketTransport: Not connected`),p(`info`,`cli_websocket_send_not_connected`),!1;try{return this.ws.send(e),this.lastActivityTime=Date.now(),!0}catch(e){return l(`WebSocketTransport: Failed to send: ${e}`,{level:`error`}),p(`error`,`cli_websocket_send_error`),this.handleConnectionError(),!1}}removeWsListeners(e){if(this.isBunWs){let t=e;t.removeEventListener(`open`,this.onBunOpen),t.removeEventListener(`message`,this.onBunMessage),t.removeEventListener(`error`,this.onBunError),t.removeEventListener(`close`,this.onBunClose),t.removeEventListener(`pong`,this.onPong)}else{let t=e;t.off(`open`,this.onNodeOpen),t.off(`message`,this.onNodeMessage),t.off(`error`,this.onNodeError),t.off(`close`,this.onNodeClose),t.off(`pong`,this.onPong)}}doDisconnect(){this.stopPingInterval(),this.stopKeepaliveInterval(),w(),this.ws&&(this.removeWsListeners(this.ws),this.ws.close(),this.ws=null)}handleConnectionError(e){if(E(`WS handleConnectionError: code=${e} state=${this.state} url=${this.url.href.replace(/token=[^&]+/,`token=***`)} msSinceLastActivity=${this.lastActivityTime>0?Date.now()-this.lastActivityTime:-1} reconnectAttempts=${this.reconnectAttempts}`),l(`WebSocketTransport: Disconnected from ${this.url.href}`+(e==null?``:` (code ${e})`)),p(`info`,`cli_websocket_disconnected`),this.isBridge&&h(`tengu_ws_transport_closed`,{closeCode:e,msSinceLastActivity:this.lastActivityTime>0?Date.now()-this.lastActivityTime:-1,wasConnected:this.state===`connected`,reconnectAttempts:this.reconnectAttempts}),this.doDisconnect(),this.state===`closing`||this.state===`closed`)return;let t=!1;if(e===4003&&this.refreshHeaders){let e=this.refreshHeaders();e.Authorization!==this.headers.Authorization&&(Object.assign(this.headers,e),t=!0,l(`WebSocketTransport: 4003 received but headers refreshed, scheduling reconnect`),p(`info`,`cli_websocket_4003_token_refreshed`))}if(e!=null&&L.has(e)&&!t){l(`WebSocketTransport: Permanent close code ${e}, not reconnecting`,{level:`error`}),p(`error`,`cli_websocket_permanent_close`,{closeCode:e}),this.state=`closed`,this.onCloseCallback?.(e);return}if(!this.autoReconnect){this.state=`closed`,this.onCloseCallback?.(e);return}let n=Date.now();this.reconnectStartTime||(this.reconnectStartTime=n),this.lastReconnectAttemptTime!==null&&n-this.lastReconnectAttemptTime>I&&(l(`WebSocketTransport: Detected system sleep (${Math.round((n-this.lastReconnectAttemptTime)/1e3)}s gap), resetting reconnection budget`),p(`info`,`cli_websocket_sleep_detected`,{gapMs:n-this.lastReconnectAttemptTime}),this.reconnectStartTime=n,this.reconnectAttempts=0),this.lastReconnectAttemptTime=n;let r=n-this.reconnectStartTime;if(r<N){if(this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null),!t&&this.refreshHeaders){let e=this.refreshHeaders();Object.assign(this.headers,e),l(`WebSocketTransport: Refreshed headers for reconnect`)}this.state=`reconnecting`,this.reconnectAttempts++;let e=Math.min(j*2**(this.reconnectAttempts-1),M),n=Math.max(0,e+e*.25*(2*Math.random()-1));l(`WebSocketTransport: Reconnecting in ${Math.round(n)}ms (attempt ${this.reconnectAttempts}, ${Math.round(r/1e3)}s elapsed)`),p(`error`,`cli_websocket_reconnect_attempt`,{reconnectAttempts:this.reconnectAttempts}),this.isBridge&&h(`tengu_ws_transport_reconnecting`,{attempt:this.reconnectAttempts,elapsedMs:r,delayMs:Math.round(n)}),this.reconnectTimer=setTimeout(()=>{this.reconnectTimer=null,this.connect()},n)}else l(`WebSocketTransport: Reconnection time budget exhausted after ${Math.round(r/1e3)}s for ${this.url.href}`,{level:`error`}),p(`error`,`cli_websocket_reconnect_exhausted`,{reconnectAttempts:this.reconnectAttempts,elapsedMs:r}),this.state=`closed`,this.onCloseCallback&&this.onCloseCallback(e)}close(){this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null),this.stopPingInterval(),this.stopKeepaliveInterval(),w(),this.state=`closing`,this.doDisconnect()}replayBufferedMessages(e){let t=this.messageBuffer.toArray();if(t.length===0)return;let n=0;if(e){let r=t.findIndex(t=>`uuid`in t&&t.uuid===e);if(r>=0){n=r+1;let e=t.slice(n);this.messageBuffer.clear(),this.messageBuffer.addAll(e),e.length===0&&(this.lastSentId=null),l(`WebSocketTransport: Evicted ${n} confirmed messages, ${e.length} remaining`),p(`info`,`cli_websocket_evicted_confirmed_messages`,{evicted:n,remaining:e.length})}}let r=t.slice(n);if(r.length===0){l(`WebSocketTransport: No new messages to replay`),p(`info`,`cli_websocket_no_messages_to_replay`);return}l(`WebSocketTransport: Replaying ${r.length} buffered messages`),p(`info`,`cli_websocket_messages_to_replay`,{count:r.length});for(let e of r){let t=`${c(e)}\n`;if(!this.sendLine(t)){this.handleConnectionError();break}}}isConnectedStatus(){return this.state===`connected`}isClosedStatus(){return this.state===`closed`}setOnData(e){this.onData=e}setOnConnect(e){this.onConnectCallback=e}setOnClose(e){this.onCloseCallback=e}getStateLabel(){return this.state}async write(e){`uuid`in e&&typeof e.uuid==`string`&&(this.messageBuffer.add(e),this.lastSentId=e.uuid);let t=`${c(e)}\n`;if(this.state!==`connected`)return;let n=this.sessionId?` session=${this.sessionId}`:``,r=this.getControlMessageDetailLabel(e);l(`WebSocketTransport: Sending message type=${e.type}${n}${r}`),this.sendLine(t)}getControlMessageDetailLabel(e){if(e.type===`control_request`){let{request_id:t,request:n}=e,r=n.subtype===`can_use_tool`?n.tool_name:``;return` subtype=${n.subtype} request_id=${t}${r?` tool=${r}`:``}`}if(e.type===`control_response`){let{subtype:t,request_id:n}=e.response;return` subtype=${t} request_id=${n}`}return``}startPingInterval(){this.stopPingInterval(),this.pongReceived=!0;let e=Date.now();this.pingInterval=setInterval(()=>{if(this.state===`connected`&&this.ws){let t=Date.now(),n=t-e;if(e=t,n>I){l(`WebSocketTransport: ${Math.round(n/1e3)}s tick gap detected — process was suspended, forcing reconnect`),p(`info`,`cli_websocket_sleep_detected_on_ping`,{gapMs:n}),this.handleConnectionError();return}if(!this.pongReceived){l(`WebSocketTransport: No pong received, connection appears dead`,{level:`error`}),p(`error`,`cli_websocket_pong_timeout`),this.handleConnectionError();return}this.pongReceived=!1;try{this.ws.ping?.()}catch(e){l(`WebSocketTransport: Ping failed: ${e}`,{level:`error`}),p(`error`,`cli_websocket_ping_failed`)}}},P)}stopPingInterval(){this.pingInterval&&(clearInterval(this.pingInterval),this.pingInterval=null)}startKeepaliveInterval(){this.stopKeepaliveInterval(),!e(process.env.CLAUDE_CODE_REMOTE)&&(this.keepAliveInterval=setInterval(()=>{if(this.state===`connected`&&this.ws)try{this.ws.send(k),this.lastActivityTime=Date.now(),l(`WebSocketTransport: Sent periodic keep_alive data frame`)}catch(e){l(`WebSocketTransport: Periodic keep_alive failed: ${e}`,{level:`error`}),p(`error`,`cli_websocket_keepalive_failed`)}},F))}stopKeepaliveInterval(){this.keepAliveInterval&&(clearInterval(this.keepAliveInterval),this.keepAliveInterval=null)}};u(),D(),f(),n();var z=100,B=15e3,V=3e3,H=class extends R{constructor(e,t={},n,i,a){super(e,t,n,i,a),r(this,`postUrl`,void 0),r(this,`uploader`,void 0),r(this,`streamEventBuffer`,[]),r(this,`streamEventTimer`,null);let{maxConsecutiveFailures:o,onBatchDropped:s}=a??{};this.postUrl=U(e),this.uploader=new O({maxBatchSize:500,maxQueueSize:1e4,baseDelayMs:500,maxDelayMs:8e3,jitterMs:1e3,maxConsecutiveFailures:o,onBatchDropped:(e,t)=>{p(`error`,`cli_hybrid_batch_dropped_max_failures`,{batchSize:e,failures:t}),s?.(e,t)},send:e=>this.postOnce(e)}),l(`HybridTransport: POST URL = ${this.postUrl}`),p(`info`,`cli_hybrid_transport_initialized`)}async write(e){if(e.type===`stream_event`){this.streamEventBuffer.push(e),this.streamEventTimer||(this.streamEventTimer=setTimeout(()=>this.flushStreamEvents(),z));return}return await this.uploader.enqueue([...this.takeStreamEvents(),e]),this.uploader.flush()}async writeBatch(e){return await this.uploader.enqueue([...this.takeStreamEvents(),...e]),this.uploader.flush()}get droppedBatchCount(){return this.uploader.droppedBatchCount}flush(){return this.uploader.enqueue(this.takeStreamEvents()),this.uploader.flush()}takeStreamEvents(){this.streamEventTimer&&(clearTimeout(this.streamEventTimer),this.streamEventTimer=null);let e=this.streamEventBuffer;return this.streamEventBuffer=[],e}flushStreamEvents(){this.streamEventTimer=null,this.uploader.enqueue(this.takeStreamEvents())}close(){this.streamEventTimer&&(clearTimeout(this.streamEventTimer),this.streamEventTimer=null),this.streamEventBuffer=[];let e=this.uploader,t;Promise.race([e.flush(),new Promise(e=>{t=setTimeout(e,V)})]).finally(()=>{clearTimeout(t),e.close()}),super.close()}async postOnce(e){let t=S();if(!t){l(`HybridTransport: No session token available for POST`),p(`warn`,`cli_hybrid_post_no_token`);return}let n={Authorization:`Bearer ${t}`,"Content-Type":`application/json`},r;try{r=await i.post(this.postUrl,{events:e},{headers:n,validateStatus:()=>!0,timeout:B})}catch(e){throw l(`HybridTransport: POST error: ${e.message}`),p(`warn`,`cli_hybrid_post_network_error`),e}if(r.status>=200&&r.status<300){l(`HybridTransport: POST success count=${e.length}`);return}if(r.status>=400&&r.status<500&&r.status!==429){E(`Hybrid POST ${r.status}: url=${this.postUrl.replace(/token=[^&]+/,`token=***`)} events=${e.length} body=${JSON.stringify(r.data).slice(0,200)}`),l(`HybridTransport: POST returned ${r.status} (permanent), dropping`),p(`warn`,`cli_hybrid_post_client_error`,{status:r.status});return}throw l(`HybridTransport: POST returned ${r.status} (retryable)`),p(`warn`,`cli_hybrid_post_retryable_error`,{status:r.status}),Error(`POST failed with ${r.status}`)}};function U(e){let t=e.protocol===`wss:`?`https:`:`http:`,n=e.pathname;return n=n.replace(`/ws/`,`/session/`),n.endsWith(`/events`)||(n=n.endsWith(`/`)?`${n}events`:`${n}/events`),`${t}//${e.host}${n}${e.search}`}export{R as n,H as t};
@@ -1 +1 @@
1
- import{Ou as e,Qu as t,Xh as n,Yh as r,Zu as i,ku as a}from"./loadAgentsDir-CwEfQDOw.js";import{I as o,P as s,kn as c,t as l,y as u}from"./src-DL3w8VPk2.js";import{t as d}from"./jsx-runtime-Bb4Xn-E0.js";import{C as f,T as p,x as m}from"./debug-BQj6h99Q.js";import{t as h}from"./renderOptions-CkqTbz6d.js";l(),a(),n(),m(),i();var g=d();function _({filePath:e,errorDescription:n,onExit:r,onReset:i}){return(0,g.jsxs)(u,{title:`Configuration Error`,color:`error`,onCancel:r,children:[(0,g.jsxs)(o,{flexDirection:`column`,gap:1,children:[(0,g.jsxs)(s,{children:[`The configuration file at `,(0,g.jsx)(s,{bold:!0,children:e}),` contains invalid JSON.`]}),(0,g.jsx)(s,{children:n})]}),(0,g.jsxs)(o,{flexDirection:`column`,children:[(0,g.jsx)(s,{bold:!0,children:`Choose an option:`}),(0,g.jsx)(t,{options:[{label:`Exit and fix manually`,value:`exit`},{label:`Reset with default configuration`,value:`reset`}],onChange:e=>{e===`exit`?r():i()},onCancel:r})]})]})}var v=`dark`;async function y({error:t}){let n={...h(!1),theme:v};await new Promise(async i=>{let{unmount:a}=await c((0,g.jsx)(r,{children:(0,g.jsx)(e,{children:(0,g.jsx)(_,{filePath:t.filePath,errorDescription:t.message,onExit:()=>{a(),i(),process.exit(1)},onReset:()=>{p(t.filePath,f(t.defaultConfig,null,2),{flush:!1,encoding:`utf8`}),a(),i(),process.exit(0)}})})}),n)})}export{y as showInvalidConfigDialog};
1
+ import{Ou as e,Qu as t,Xh as n,Yh as r,Zu as i,ku as a}from"./loadAgentsDir-PPiD2Mfq.js";import{I as o,P as s,kn as c,t as l,y as u}from"./src-DL3w8VPk2.js";import{t as d}from"./jsx-runtime-Bb4Xn-E0.js";import{C as f,T as p,x as m}from"./debug-BQj6h99Q.js";import{t as h}from"./renderOptions-CkqTbz6d.js";l(),a(),n(),m(),i();var g=d();function _({filePath:e,errorDescription:n,onExit:r,onReset:i}){return(0,g.jsxs)(u,{title:`Configuration Error`,color:`error`,onCancel:r,children:[(0,g.jsxs)(o,{flexDirection:`column`,gap:1,children:[(0,g.jsxs)(s,{children:[`The configuration file at `,(0,g.jsx)(s,{bold:!0,children:e}),` contains invalid JSON.`]}),(0,g.jsx)(s,{children:n})]}),(0,g.jsxs)(o,{flexDirection:`column`,children:[(0,g.jsx)(s,{bold:!0,children:`Choose an option:`}),(0,g.jsx)(t,{options:[{label:`Exit and fix manually`,value:`exit`},{label:`Reset with default configuration`,value:`reset`}],onChange:e=>{e===`exit`?r():i()},onCancel:r})]})]})}var v=`dark`;async function y({error:t}){let n={...h(!1),theme:v};await new Promise(async i=>{let{unmount:a}=await c((0,g.jsx)(r,{children:(0,g.jsx)(e,{children:(0,g.jsx)(_,{filePath:t.filePath,errorDescription:t.message,onExit:()=>{a(),i(),process.exit(1)},onReset:()=>{p(t.filePath,f(t.defaultConfig,null,2),{flush:!1,encoding:`utf8`}),a(),i(),process.exit(0)}})})}),n)})}export{y as showInvalidConfigDialog};
@@ -1 +1 @@
1
- import{Qu as e,Zu as t}from"./loadAgentsDir-CwEfQDOw.js";import{P as n,t as r,y as i}from"./src-DL3w8VPk2.js";import{t as a}from"./jsx-runtime-Bb4Xn-E0.js";import{n as o,t as s}from"./ValidationErrorsList-Cuq6W2yc.js";r(),t(),o();var c=a();function l({settingsErrors:t,onContinue:r,onExit:a}){function o(e){e===`exit`?a():r()}return(0,c.jsxs)(i,{title:`Settings Error`,onCancel:a,color:`warning`,children:[(0,c.jsx)(s,{errors:t}),(0,c.jsx)(n,{dimColor:!0,children:`Files with errors are skipped entirely, not just the invalid settings.`}),(0,c.jsx)(e,{options:[{label:`Exit and fix manually`,value:`exit`},{label:`Continue without these settings`,value:`continue`}],onChange:o})]})}export{l as InvalidSettingsDialog};
1
+ import{Qu as e,Zu as t}from"./loadAgentsDir-PPiD2Mfq.js";import{P as n,t as r,y as i}from"./src-DL3w8VPk2.js";import{t as a}from"./jsx-runtime-Bb4Xn-E0.js";import{n as o,t as s}from"./ValidationErrorsList-Cuq6W2yc.js";r(),t(),o();var c=a();function l({settingsErrors:t,onContinue:r,onExit:a}){function o(e){e===`exit`?a():r()}return(0,c.jsxs)(i,{title:`Settings Error`,onCancel:a,color:`warning`,children:[(0,c.jsx)(s,{errors:t}),(0,c.jsx)(n,{dimColor:!0,children:`Files with errors are skipped entirely, not just the invalid settings.`}),(0,c.jsx)(e,{options:[{label:`Exit and fix manually`,value:`exit`},{label:`Continue without these settings`,value:`continue`}],onChange:o})]})}export{l as InvalidSettingsDialog};
@@ -0,0 +1 @@
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-PPiD2Mfq.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-Cvs9WfoX.js";import{n as W,t as le}from"./omit-BOILu8jW.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 +1 @@
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-CwEfQDOw.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{Bt as B,jt as Ce}from"./model-CeG-iOKF.js";import{i as we,n as V,r as Te}from"./MCPConnectionManager-BNG7iSlw.js";import{n as Ee,t as H}from"./useExitOnCtrlCDWithKeybindings-D48aDPG9.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
+ 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-PPiD2Mfq.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-sviY1inu.js";import{i as we,n as V,r as Te}from"./MCPConnectionManager-7H84oi5n.js";import{n as Ee,t as H}from"./useExitOnCtrlCDWithKeybindings-C9orgrub.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 +1 @@
1
- import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{Cx as n,Ix as r,Nx as i,Sx as a,dx as o}from"./loadAgentsDir-CwEfQDOw.js";import{I as s,Lt as c,P as l,ai as u,t as d}from"./src-DL3w8VPk2.js";import{t as f}from"./jsx-runtime-Bb4Xn-E0.js";function p({scope:e,parsingErrors:t,warnings:n}){let r=t.length>0,i=n.length>0;return!r&&!i?null:(0,_.jsxs)(s,{flexDirection:`column`,marginTop:1,children:[(0,_.jsxs)(s,{children:[(r||i)&&(0,_.jsxs)(l,{color:r?`error`:`warning`,children:[`[`,r?`Failed to parse`:`Contains warnings`,`] `]}),(0,_.jsx)(l,{children:a(e)})]}),(0,_.jsxs)(s,{children:[(0,_.jsx)(l,{dimColor:!0,children:`Location: `}),(0,_.jsx)(l,{dimColor:!0,children:o(e)})]}),(0,_.jsxs)(s,{marginLeft:1,flexDirection:`column`,children:[t.map((e,t)=>{let n=e.mcpErrorMetadata?.serverName;return(0,_.jsx)(s,{children:(0,_.jsxs)(l,{children:[(0,_.jsx)(l,{dimColor:!0,children:`└ `}),(0,_.jsx)(l,{color:`error`,children:`[Error]`}),(0,_.jsxs)(l,{dimColor:!0,children:[` `,n&&`[${n}] `,e.path&&e.path!==``?`${e.path}: `:``,e.message]})]})},`error-${t}`)}),n.map((e,t)=>{let n=e.mcpErrorMetadata?.serverName;return(0,_.jsx)(s,{children:(0,_.jsxs)(l,{children:[(0,_.jsx)(l,{dimColor:!0,children:`└ `}),(0,_.jsx)(l,{color:`warning`,children:`[Warning]`}),(0,_.jsxs)(l,{dimColor:!0,children:[` `,n&&`[${n}] `,e.path&&e.path!==``?`${e.path}: `:``,e.message]})]})},`warning-${t}`)})]})]})}function m(){let e=(0,g.useMemo)(()=>[{scope:`user`,config:i(`user`)},{scope:`project`,config:i(`project`)},{scope:`local`,config:i(`local`)},{scope:`enterprise`,config:i(`enterprise`)}],[]),t=e.some(({config:e})=>h(e.errors,`fatal`).length>0),n=e.some(({config:e})=>h(e.errors,`warning`).length>0);return!t&&!n?null:(0,_.jsxs)(s,{flexDirection:`column`,marginTop:1,marginBottom:1,children:[(0,_.jsx)(l,{bold:!0,children:`MCP Config Diagnostics`}),(0,_.jsx)(s,{marginTop:1,children:(0,_.jsxs)(l,{dimColor:!0,children:[`For help configuring MCP servers, see:`,` `,(0,_.jsx)(c,{url:`https://code.workmate.com/docs/en/mcp`,children:`https://code.workmate.com/docs/en/mcp`})]})}),e.map(({scope:e,config:t})=>(0,_.jsx)(p,{scope:e,parsingErrors:h(t.errors,`fatal`),warnings:h(t.errors,`warning`)},e))]})}function h(e,t){return e.filter(e=>e.mcpErrorMetadata?.severity===t)}var g,_,v=e((()=>{g=t(u(),1),r(),n(),d(),_=f()}));export{v as n,m as t};
1
+ import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{Cx as n,Ix as r,Nx as i,Sx as a,dx as o}from"./loadAgentsDir-PPiD2Mfq.js";import{I as s,Lt as c,P as l,ai as u,t as d}from"./src-DL3w8VPk2.js";import{t as f}from"./jsx-runtime-Bb4Xn-E0.js";function p({scope:e,parsingErrors:t,warnings:n}){let r=t.length>0,i=n.length>0;return!r&&!i?null:(0,_.jsxs)(s,{flexDirection:`column`,marginTop:1,children:[(0,_.jsxs)(s,{children:[(r||i)&&(0,_.jsxs)(l,{color:r?`error`:`warning`,children:[`[`,r?`Failed to parse`:`Contains warnings`,`] `]}),(0,_.jsx)(l,{children:a(e)})]}),(0,_.jsxs)(s,{children:[(0,_.jsx)(l,{dimColor:!0,children:`Location: `}),(0,_.jsx)(l,{dimColor:!0,children:o(e)})]}),(0,_.jsxs)(s,{marginLeft:1,flexDirection:`column`,children:[t.map((e,t)=>{let n=e.mcpErrorMetadata?.serverName;return(0,_.jsx)(s,{children:(0,_.jsxs)(l,{children:[(0,_.jsx)(l,{dimColor:!0,children:`└ `}),(0,_.jsx)(l,{color:`error`,children:`[Error]`}),(0,_.jsxs)(l,{dimColor:!0,children:[` `,n&&`[${n}] `,e.path&&e.path!==``?`${e.path}: `:``,e.message]})]})},`error-${t}`)}),n.map((e,t)=>{let n=e.mcpErrorMetadata?.serverName;return(0,_.jsx)(s,{children:(0,_.jsxs)(l,{children:[(0,_.jsx)(l,{dimColor:!0,children:`└ `}),(0,_.jsx)(l,{color:`warning`,children:`[Warning]`}),(0,_.jsxs)(l,{dimColor:!0,children:[` `,n&&`[${n}] `,e.path&&e.path!==``?`${e.path}: `:``,e.message]})]})},`warning-${t}`)})]})]})}function m(){let e=(0,g.useMemo)(()=>[{scope:`user`,config:i(`user`)},{scope:`project`,config:i(`project`)},{scope:`local`,config:i(`local`)},{scope:`enterprise`,config:i(`enterprise`)}],[]),t=e.some(({config:e})=>h(e.errors,`fatal`).length>0),n=e.some(({config:e})=>h(e.errors,`warning`).length>0);return!t&&!n?null:(0,_.jsxs)(s,{flexDirection:`column`,marginTop:1,marginBottom:1,children:[(0,_.jsx)(l,{bold:!0,children:`MCP Config Diagnostics`}),(0,_.jsx)(s,{marginTop:1,children:(0,_.jsxs)(l,{dimColor:!0,children:[`For help configuring MCP servers, see:`,` `,(0,_.jsx)(c,{url:`https://code.workmate.com/docs/en/mcp`,children:`https://code.workmate.com/docs/en/mcp`})]})}),e.map(({scope:e,config:t})=>(0,_.jsx)(p,{scope:e,parsingErrors:h(t.errors,`fatal`),warnings:h(t.errors,`warning`)},e))]})}function h(e,t){return e.filter(e=>e.mcpErrorMetadata?.severity===t)}var g,_,v=e((()=>{g=t(u(),1),r(),n(),d(),_=f()}));export{v as n,m as t};