@readmagic/workmate 0.0.25 → 0.0.26

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 (355) hide show
  1. package/dist/chunks/{AddWorkspaceDirectory-Y5S_lMjD.js → AddWorkspaceDirectory-mS8iUoWY.js} +1 -1
  2. package/dist/chunks/{AgentsMdExternalIncludesDialog-DVbU-BaD.js → AgentsMdExternalIncludesDialog-BHBkysy0.js} +1 -1
  3. package/dist/chunks/AgentsMdExternalIncludesDialog-DuStmCjj.js +1 -0
  4. package/dist/chunks/App-D--vtCyq.js +1 -0
  5. package/dist/chunks/BackgroundTasksDialog-mcDuiNGs.js +2 -0
  6. package/dist/chunks/{BypassPermissionsModeDialog-DjqGAL4C.js → BypassPermissionsModeDialog-DyqI98d2.js} +1 -1
  7. package/dist/chunks/CustomSelect-CpMbxYbt.js +1 -0
  8. package/dist/chunks/DiffDialog-BQAU2pJx.js +6 -0
  9. package/dist/chunks/Doctor-BU69VQzw.js +1 -0
  10. package/dist/chunks/Doctor-DJOMbSDE.js +3 -0
  11. package/dist/chunks/{ExitFlow-Dh9QdaYK.js → ExitFlow-xBOnvhiW.js} +2 -2
  12. package/dist/chunks/{InvalidConfigDialog-C9boykQn.js → InvalidConfigDialog-NiuhcaG5.js} +1 -1
  13. package/dist/chunks/{InvalidSettingsDialog-UN5mleCK.js → InvalidSettingsDialog-DrromC1I.js} +1 -1
  14. package/dist/chunks/KeybindingProviderSetup-CSUkJHTT.js +1 -0
  15. package/dist/chunks/MCPConnectionManager-Bn1PDn3R.js +1 -0
  16. package/dist/chunks/MCPToolListView-BRxjOaOL.js +1 -0
  17. package/dist/chunks/{McpParsingWarnings-zkM_lGd0.js → McpParsingWarnings-BYG2yqjO.js} +1 -1
  18. package/dist/chunks/MessageSelector-B7xAQqZI.js +3 -0
  19. package/dist/chunks/Messages-CxMsfjOa.js +10 -0
  20. package/dist/chunks/{Onboarding-BT90cFkn.js → Onboarding-CkATe87e.js} +1 -1
  21. package/dist/chunks/{PermissionDialog-BaibiQae.js → PermissionDialog-tEMMa5-a.js} +1 -1
  22. package/dist/chunks/{PressEnterToContinue-DZc_s_pE.js → PressEnterToContinue-CPOaYnym.js} +1 -1
  23. package/dist/chunks/{PromptInputFooterSuggestions-CCTZYbWI.js → PromptInputFooterSuggestions-CwqAsTI2.js} +1 -1
  24. package/dist/chunks/PromptInputHelpMenu-krq-hiFO.js +1 -0
  25. package/dist/chunks/{ProviderSetup-yIj8YOKF.js → ProviderSetup-J6Ty-Wj8.js} +1 -1
  26. package/dist/chunks/QueryEngine-Mdi_kUaL.js +1 -0
  27. package/dist/chunks/REPL-BgzQtSFF.js +1 -0
  28. package/dist/chunks/REPL-rirm6s_7.js +124 -0
  29. package/dist/chunks/ResumeConversation-Cmsbo5m7.js +1 -0
  30. package/dist/chunks/{SearchBox-C9xxQzh1.js → SearchBox-DQBLKyzJ.js} +1 -1
  31. package/dist/chunks/SearchExtraToolsTool-D1-7C04z.js +1 -0
  32. package/dist/chunks/{SelectMulti-BW7Ffk1G.js → SelectMulti-BpAjjhsn.js} +1 -1
  33. package/dist/chunks/Settings-B6DImvca.js +2 -0
  34. package/dist/chunks/Spinner-DhhSOFcN.js +1 -0
  35. package/dist/chunks/{SpinnerGlyph-CqrOK3Mx.js → SpinnerGlyph-CmVXC-_9.js} +1 -1
  36. package/dist/chunks/{TextInput-Cev5Awdd.js → TextInput-BboKIug2.js} +11 -11
  37. package/dist/chunks/ThemePicker-DTpXbEY0.js +1 -0
  38. package/dist/chunks/{TrustDialog-8Sjmuu0e.js → TrustDialog-CZ8JpySm.js} +1 -1
  39. package/dist/chunks/{ValidationErrorsList-INwwoerV.js → ValidationErrorsList-C_gDQfm1.js} +1 -1
  40. package/dist/chunks/{_baseEach-DrPH_FGo.js → _baseEach-DGbaIpJA.js} +1 -1
  41. package/dist/chunks/_baseSlice-D67_NpZ1.js +1 -0
  42. package/dist/chunks/{add-dir-D3RMaYxy.js → add-dir-B576wzi9.js} +1 -1
  43. package/dist/chunks/{agentDisplay-B3npXoCS.js → agentDisplay-ZuFoBZYu.js} +1 -1
  44. package/dist/chunks/{agents-2mPGmeq6.js → agents-Dy4_hDic.js} +1 -1
  45. package/dist/chunks/agents-HIOBiw4w.js +101 -0
  46. package/dist/chunks/allErrors-CxPNR2WN.js +1 -0
  47. package/dist/chunks/appleTerminalBackup-C9kjzdM9.js +1 -0
  48. package/dist/chunks/{backgroundHousekeeping-BkFxfjOf.js → backgroundHousekeeping-PyLNnGdw.js} +1 -1
  49. package/dist/chunks/backgroundHousekeeping-ZCMPmQuU.js +1 -0
  50. package/dist/chunks/{banner-DHpTmEO7.js → banner-DqFectPg.js} +2 -2
  51. package/dist/chunks/{branch-Be_yDFU8.js → branch-B_BL5N9N.js} +2 -2
  52. package/dist/chunks/{break-cache-UUt6Dkf2.js → break-cache-DL95nKZl.js} +2 -2
  53. package/dist/chunks/{btw-DUml5L1w.js → btw-Y44ctueB.js} +1 -1
  54. package/dist/chunks/bundledMode-BxyD5cqq.js +1 -0
  55. package/dist/chunks/caches-5xZ4dSXt.js +1 -0
  56. package/dist/chunks/caches-Be9saXxV.js +1 -0
  57. package/dist/chunks/{claudeDesktop-mBGFDbI6.js → claudeDesktop-g8eUUY2E.js} +1 -1
  58. package/dist/chunks/{clear-CrGjNe6E.js → clear-DtTkA707.js} +1 -1
  59. package/dist/chunks/{client-BDuhbzLD.js → client-Bw_L3lSc.js} +1 -1
  60. package/dist/chunks/{client-BYFVVMcf.js → client-aJ2Nr_sh.js} +1 -1
  61. package/dist/chunks/client-mnUISv_N.js +1 -0
  62. package/dist/chunks/client-wPqIdEVm.js +1 -0
  63. package/dist/chunks/commands-wfE12a4L.js +1 -0
  64. package/dist/chunks/compact-CvNOtu7J.js +2 -0
  65. package/dist/chunks/config-D3K87Mm1.js +3 -0
  66. package/dist/chunks/config-DTga6Ku8.js +1 -0
  67. package/dist/chunks/config-DtmqWusU.js +1 -0
  68. package/dist/chunks/{context-mV5zjqmc.js → context-Opu4E8dL.js} +1 -1
  69. package/dist/chunks/{context-noninteractive-DvfVvmSE.js → context-noninteractive-B1V2Mp26.js} +5 -5
  70. package/dist/chunks/context-noninteractive-eIlneYiL.js +1 -0
  71. package/dist/chunks/conversation-CG_z7TLE.js +1 -0
  72. package/dist/chunks/conversation-CHesBfFZ.js +1 -0
  73. package/dist/chunks/conversationRecovery-OhitW-7g.js +1 -0
  74. package/dist/chunks/crossProjectResume-mmYx8PrZ.js +40 -0
  75. package/dist/chunks/cwd-BH2f3u0o.js +1 -0
  76. package/dist/chunks/{cwd-BvNt_018.js → cwd-DrEEb4f5.js} +1 -1
  77. package/dist/chunks/{debug-CRnGsZOV.js → debug-kBjDaVkQ.js} +3 -3
  78. package/dist/chunks/{detectRepository-CsJLbVEe.js → detectRepository-M6K2wc7h.js} +1 -1
  79. package/dist/chunks/{diff-DUEoNCnJ.js → diff-Cv7tX2-P.js} +1 -1
  80. package/dist/chunks/{directoryCompletion-Bgi8DBT5.js → directoryCompletion-BHyjyKAM.js} +1 -1
  81. package/dist/chunks/doctor-DeBG5SL5.js +1 -0
  82. package/dist/chunks/{entry-D1iD76SW.js → entry-CbhyIWgj.js} +5 -5
  83. package/dist/chunks/envUtils-DZ_SvEVz.js +1 -0
  84. package/dist/chunks/execFileNoThrow-BfZFnCGa.js +1 -0
  85. package/dist/chunks/execa-CBhG1doD.js +34 -0
  86. package/dist/chunks/exit-OKEV_ddw.js +1 -0
  87. package/dist/chunks/{extraUsage-BtHE-SBX.js → extraUsage-BlRL3yeb.js} +1 -1
  88. package/dist/chunks/extractMemories-jnsv-_n_.js +1 -0
  89. package/dist/chunks/fast-4I_qPJCd.js +1 -0
  90. package/dist/chunks/fast-DiolM1M7.js +1 -0
  91. package/dist/chunks/{fetchModelList-Cjow_QGy.js → fetchModelList-BRFTQim4.js} +1 -1
  92. package/dist/chunks/fetchModelList-qPKAuu4m.js +1 -0
  93. package/dist/chunks/{fileSuggestions-C96V9-Ne.js → fileSuggestions-iWVXvvLB.js} +3 -3
  94. package/dist/chunks/{fpsMetrics-wxj9GAsd.js → fpsMetrics-Ixd0J4CH.js} +1 -1
  95. package/dist/chunks/{gemini-4YGElN3H.js → gemini-BfVyavwQ.js} +2 -2
  96. package/dist/chunks/{generateSessionName-BHIKyXpz.js → generateSessionName-CGaTTXCA.js} +1 -1
  97. package/dist/chunks/genericProcessUtils-CVtQOTO2.js +12 -0
  98. package/dist/chunks/{goal-ePK_jLo3.js → goal-BidR-GFa.js} +1 -1
  99. package/dist/chunks/grok-DLcuI-U7.js +1 -0
  100. package/dist/chunks/{help-B7xRle-V.js → help-CZuvYhXj.js} +1 -1
  101. package/dist/chunks/history-BxPGftQw.js +1 -0
  102. package/dist/chunks/hooks-Bg9WIjZQ.js +1 -0
  103. package/dist/chunks/{hooks-BN5f58HY.js → hooks-ehqfAM5F.js} +2 -2
  104. package/dist/chunks/install-ACGY0vhM.js +1 -0
  105. package/dist/chunks/{instrumentation-Oj5xagJG.js → instrumentation-B9bfF2mA.js} +5 -5
  106. package/dist/chunks/{job-D9ypO0cd.js → job-Coztdn6A.js} +1 -1
  107. package/dist/chunks/keybindings-DwSdLpaE.js +1 -0
  108. package/dist/chunks/{launchLocalMemory-DliLezJw.js → launchLocalMemory-DRzfpIOB.js} +1 -1
  109. package/dist/chunks/{launchOnboarding-A-kk-7ID.js → launchOnboarding-D2zFCJf-.js} +1 -1
  110. package/dist/chunks/{loadAgentsDir-DGozQu_6.js → loadAgentsDir-DR5PVAc3.js} +557 -561
  111. package/dist/chunks/loadAgentsDir-DqAbnpB-.js +1 -0
  112. package/dist/chunks/{loadPluginHooks-BiHPKDaY.js → loadPluginHooks-BiQgGfUJ.js} +1 -1
  113. package/dist/chunks/{loader-CtoR-vO-.js → loader-6MqzNGmV.js} +1 -1
  114. package/dist/chunks/{localSearch-BU02Qsv9.js → localSearch-CzkxDuOR.js} +1 -1
  115. package/dist/chunks/localSearch-DW3JT2MA.js +1 -0
  116. package/dist/chunks/lockfile-D_9vif6E.js +1 -0
  117. package/dist/chunks/{log-DoSpAwRP.js → log-DWZny1vM.js} +1 -1
  118. package/dist/chunks/{logoUtils-DLd6JKqW.js → logoUtils-DR5T0pr3.js} +1 -1
  119. package/dist/chunks/{magicDocs-Bj8LYrN2.js → magicDocs-BwBxjfLo.js} +2 -2
  120. package/dist/chunks/main-Ryi27wYq.js +345 -0
  121. package/dist/chunks/managedEnv-DCEJh3z3.js +1 -0
  122. package/dist/chunks/managedEnv-Do9fgLpk.js +1 -0
  123. package/dist/chunks/managedEnvConstants-CWcT7nYr.js +1 -0
  124. package/dist/chunks/mcp-BCpnF6wD.js +1 -0
  125. package/dist/chunks/mcp-CJ6SDJEK.js +6 -0
  126. package/dist/chunks/mcp-CZBTxbhu.js +2 -0
  127. package/dist/chunks/memory-BQO6Y0ak.js +1 -0
  128. package/dist/chunks/{modalContext-DDZdU1J8.js → modalContext-CBE8xuck.js} +1 -1
  129. package/dist/chunks/{mode-CBKawxnD.js → mode-wq70cR44.js} +1 -1
  130. package/dist/chunks/model-D42epddJ.js +1 -0
  131. package/dist/chunks/{model-DwbqvCY2.js → model-DVk9-2dk.js} +1 -1
  132. package/dist/chunks/{modelOptions-CXBfKFXA.js → modelOptions-beLgXORr.js} +1 -1
  133. package/dist/chunks/nativeInstaller-ChGSz1lb.js +1 -0
  134. package/dist/chunks/{notifications-ql0eSo0Y.js → notifications-dGBuNvFj.js} +1 -1
  135. package/dist/chunks/{onChangeAppState-D85b33R5.js → onChangeAppState-B4K-rSaF.js} +1 -1
  136. package/dist/chunks/openai-DAwnAV9K.js +2 -0
  137. package/dist/chunks/{overlayContext-CLjlCFBl.js → overlayContext-B6i_6y_0.js} +1 -1
  138. package/dist/chunks/{panel-DMZkOEiU.js → panel-C0CF3noE.js} +1 -1
  139. package/dist/chunks/parser-BZt0VFd_.js +1 -0
  140. package/dist/chunks/{parser-UqADrvxF.js → parser-DThLwgdM.js} +1 -1
  141. package/dist/chunks/{partition-CwxTlmMd.js → partition-BRQHofxD.js} +1 -1
  142. package/dist/chunks/{pasteStore-ovtxMVR5.js → pasteStore-BmehVo5j.js} +1 -1
  143. package/dist/chunks/{permissions-CgsvWOk_.js → permissions-DkfWKN-B.js} +3 -3
  144. package/dist/chunks/pidLock-YvAaIrIY.js +3 -0
  145. package/dist/chunks/plan-B6U3ioer.js +1 -0
  146. package/dist/chunks/{platform-DsMIk3eq.js → platform-Vl9IynC3.js} +1 -1
  147. package/dist/chunks/plugin-CTA2_-F7.js +17 -0
  148. package/dist/chunks/{pluginAutoupdate-DQqYDPVg.js → pluginAutoupdate-Dy5W3HWE.js} +1 -1
  149. package/dist/chunks/{pluginBlocklist-BAr9WTup.js → pluginBlocklist-DAoUENwc.js} +1 -1
  150. package/dist/chunks/pluginCliCommands-CaHnj0C_.js +1 -0
  151. package/dist/chunks/{pluginFlagging-BO_3qjfs.js → pluginFlagging-BCj9LJP3.js} +1 -1
  152. package/dist/chunks/pluginOperations-ClXNOOG6.js +2 -0
  153. package/dist/chunks/pluginStartupCheck-CiwMKGjx.js +1 -0
  154. package/dist/chunks/{pluginStartupCheck-BX6cv-vs.js → pluginStartupCheck-U8_xk25t.js} +1 -1
  155. package/dist/chunks/{plugins-9crasx2V.js → plugins-D7zyI9c4.js} +4 -4
  156. package/dist/chunks/{poller-CpLBoB-N.js → poller-BeyVwHAf.js} +1 -1
  157. package/dist/chunks/poorMode-DtzWNhsY.js +1 -0
  158. package/dist/chunks/poorMode-Ocff_UT1.js +1 -0
  159. package/dist/chunks/print-BzljdXem.js +13 -0
  160. package/dist/chunks/processBashCommand-RUkmyAl4.js +1 -0
  161. package/dist/chunks/processSlashCommand-DRLO-jNV.js +5 -0
  162. package/dist/chunks/{projectContext-5fmRr6Sd.js → projectContext-COeHKDrk.js} +1 -1
  163. package/dist/chunks/{projectContext-DhtjLv3k.js → projectContext-QN5U3Ggr.js} +1 -1
  164. package/dist/chunks/{projectOnboardingState--L3BKjOE.js → projectOnboardingState-KqcpRXls.js} +1 -1
  165. package/dist/chunks/{prompt-DzO1um1h.js → prompt-CTByhpUI.js} +20 -20
  166. package/dist/chunks/prompt-DTpfW6yP.js +1 -0
  167. package/dist/chunks/prompt-D__eHY_5.js +1 -0
  168. package/dist/chunks/promptEditor-CpUFgGzc.js +4 -0
  169. package/dist/chunks/{protocolHandler-BWgH1jaF.js → protocolHandler-BQSLVGnG.js} +2 -2
  170. package/dist/chunks/{proxy-BjkGlmBu.js → proxy-BtWuysHM.js} +2 -2
  171. package/dist/chunks/{reconciler-CVMmAaCy.js → reconciler-D6BUq8WB.js} +1 -1
  172. package/dist/chunks/refresh-B4pqFp12.js +1 -0
  173. package/dist/chunks/reject-C6IvUvBt.js +1 -0
  174. package/dist/chunks/{reload-plugins-DeyJTx4s.js → reload-plugins-DXQqk7q6.js} +1 -1
  175. package/dist/chunks/rename-D4XBmTBI.js +1 -0
  176. package/dist/chunks/{renderOptions-DRS2EslG.js → renderOptions-DkP98P_d.js} +1 -1
  177. package/dist/chunks/{resume-N4O5YI-S.js → resume-DzIev0JI.js} +2 -2
  178. package/dist/chunks/ripgrep-CYP26Fhg.js +1 -0
  179. package/dist/chunks/ripgrep-D1f1pbCz.js +5 -0
  180. package/dist/chunks/{runtimeObserver-DMSzdFWt.js → runtimeObserver-BPqlbu0B.js} +4 -4
  181. package/dist/chunks/{runtimeObserver-C0CJvA3q.js → runtimeObserver-BUHs3qjs.js} +1 -1
  182. package/dist/chunks/sandbox-adapter-CumL75tU.js +1 -0
  183. package/dist/chunks/{sandbox-toggle-Tbbaw18C.js → sandbox-toggle-CTtET6Xq.js} +1 -1
  184. package/dist/chunks/searchExtraTools-BMCU2zEf.js +1 -0
  185. package/dist/chunks/{select-Fq6g2Ejk.js → select-FrwoTzuc.js} +1 -1
  186. package/dist/chunks/sessionFileAccessHooks-WO8WTdT9.js +1 -0
  187. package/dist/chunks/{sessionObserver-CRie77tp.js → sessionObserver-B6xzxckA.js} +2 -2
  188. package/dist/chunks/sessionObserver-CBrM4opL.js +1 -0
  189. package/dist/chunks/sessionStorage-C1EAxDWG.js +1 -0
  190. package/dist/chunks/sessionTracing-UFK96PxT.js +11 -0
  191. package/dist/chunks/settings-BK6gCko-.js +1 -0
  192. package/dist/chunks/settings-YIDksG5Z.js +24 -0
  193. package/dist/chunks/setup-BBvZyrfz.js +3 -0
  194. package/dist/chunks/{shadowedRuleDetection-CTnYVrmP.js → shadowedRuleDetection-D6R2OeoH.js} +1 -1
  195. package/dist/chunks/{sideQuestion-Cl8m2qYx.js → sideQuestion-5jcbOMsR.js} +3 -3
  196. package/dist/chunks/{sinks-CiupmfTg.js → sinks-B-kFqjjd.js} +1 -1
  197. package/dist/chunks/sinks-DB_D4lmu.js +1 -0
  198. package/dist/chunks/skillChangeDetector-103-nEle.js +1 -0
  199. package/dist/chunks/{skillGapStore-es3K-aYe.js → skillGapStore-DOz1KCqo.js} +2 -2
  200. package/dist/chunks/{skillLifecycle-BcgoOQBk.js → skillLifecycle-D9NkIwFQ.js} +2 -2
  201. package/dist/chunks/{skillSearchPanel-CuDDb1L-.js → skillSearchPanel-DFiSZaJ4.js} +2 -2
  202. package/dist/chunks/skills-DgeLr52a.js +1 -0
  203. package/dist/chunks/sleep-BbWr_FL1.js +1 -0
  204. package/dist/chunks/{src-9vmGsuSI.js → src-Cy5_qH26.js} +1 -1
  205. package/dist/chunks/{src-DL3w8VPk.js → src-WZ94ZKI3.js} +4 -4
  206. package/dist/chunks/{startupProfiler-DF0AjiDf.js → startupProfiler-DIM_Ihyp.js} +2 -2
  207. package/dist/chunks/startupProfiler-FpGsKWYk.js +1 -0
  208. package/dist/chunks/{state-BQ4BEGin.js → state-CXY-q5gr.js} +1 -1
  209. package/dist/chunks/state-DXt6rahM.js +1 -0
  210. package/dist/chunks/{staticRender-BVWx0IM1.js → staticRender-RHUIg5ln.js} +1 -1
  211. package/dist/chunks/status-CKLecQZV.js +1 -0
  212. package/dist/chunks/{statusNoticeHelpers-BfmIub5L.js → statusNoticeHelpers-DI45AH-c.js} +1 -1
  213. package/dist/chunks/stringUtils-D_xPrwGQ.js +4 -0
  214. package/dist/chunks/switcher-D2Z2ZNQ0.js +1 -0
  215. package/dist/chunks/switcher-DhZCaAun.js +1 -0
  216. package/dist/chunks/{tasks-B6gYXxOx.js → tasks-6suPhqsK.js} +1 -1
  217. package/dist/chunks/{templateJobs-BW6TaqEC.js → templateJobs-BKVEWCsb.js} +1 -1
  218. package/dist/chunks/{terminalSetup-C-g9Xvj3.js → terminalSetup-7PUR4hfo.js} +1 -1
  219. package/dist/chunks/{terminalSetup-BgIXFBpd.js → terminalSetup-Cqy5_PhJ.js} +4 -4
  220. package/dist/chunks/{theme-9AZceq_m.js → theme-B-HG2PUs.js} +1 -1
  221. package/dist/chunks/tipRegistry-BR_lSGRw.js +2 -0
  222. package/dist/chunks/{toolEventObserver-DTuJcREC.js → toolEventObserver-BY3QVnr6.js} +1 -1
  223. package/dist/chunks/toolPool-BcwIF8Q_.js +1 -0
  224. package/dist/chunks/{types-97nL3naE.js → types-CD25a50S.js} +1 -1
  225. package/dist/chunks/udsClient-CCxgLiZy.js +1 -0
  226. package/dist/chunks/urlHandler-BNsQKqba.js +1 -0
  227. package/dist/chunks/{use-select-navigation-BStVRvcX.js → use-select-navigation-CW5alA9r.js} +1 -1
  228. package/dist/chunks/{useDoublePress-C9xxQzh1.js → useDoublePress-DQBLKyzJ.js} +1 -1
  229. package/dist/chunks/{useExitOnCtrlCDWithKeybindings-DWRFdFoU.js → useExitOnCtrlCDWithKeybindings-BgJrnuDl.js} +1 -1
  230. package/dist/chunks/useMainLoopModel-BVgJo4hN.js +1 -0
  231. package/dist/chunks/useManagePlugins-CrWjzESW.js +1 -0
  232. package/dist/chunks/useMergedTools-r6GQq5mI.js +1 -0
  233. package/dist/chunks/{useSearchInput-B_mY9wBq.js → useSearchInput-BITV_Txn.js} +1 -1
  234. package/dist/chunks/{useSettingsErrors-CM7tThcp.js → useSettingsErrors-CO0fTNzn.js} +1 -1
  235. package/dist/chunks/{util-Bb2S6g9N.js → util-_zo3I1y8.js} +1 -1
  236. package/dist/chunks/validatePlugin-DFGdRhA-.js +1 -0
  237. package/dist/chunks/{vim-Dpnhgoz_.js → vim-qgMS88ss.js} +1 -1
  238. package/dist/chunks/worktree-CR_M6Qfy.js +1 -0
  239. package/dist/cli.js +1 -1
  240. package/package.json +1 -1
  241. package/scripts/postinstall.cjs +16 -16
  242. package/dist/chunks/AgentsMdExternalIncludesDialog-Bnb1jWcg.js +0 -1
  243. package/dist/chunks/App-B8q8PV77.js +0 -1
  244. package/dist/chunks/BackgroundTasksDialog-i0TkZgQp.js +0 -2
  245. package/dist/chunks/CustomSelect-BvTftqEH.js +0 -1
  246. package/dist/chunks/DiffDialog-v5r8cBKW.js +0 -6
  247. package/dist/chunks/Doctor-DKpBnbuI.js +0 -1
  248. package/dist/chunks/Doctor-uvO6NM5m.js +0 -3
  249. package/dist/chunks/KeybindingProviderSetup-DsJqfEt-.js +0 -1
  250. package/dist/chunks/MCPConnectionManager-DkZVxLEj.js +0 -1
  251. package/dist/chunks/MCPToolListView-De1W4jpj.js +0 -1
  252. package/dist/chunks/MessageSelector-DW_itlX-.js +0 -3
  253. package/dist/chunks/Messages-BFsCpACq.js +0 -10
  254. package/dist/chunks/PromptInputHelpMenu-Bm5KY0Ma.js +0 -1
  255. package/dist/chunks/QueryEngine-egz5mbaW.js +0 -1
  256. package/dist/chunks/REPL-D27CE4WN.js +0 -124
  257. package/dist/chunks/REPL-e8wAT1wN.js +0 -1
  258. package/dist/chunks/ResumeConversation-CWA27Lke.js +0 -1
  259. package/dist/chunks/SearchExtraToolsTool-BRchtZ9Q.js +0 -1
  260. package/dist/chunks/Settings-axHLvYIy.js +0 -3
  261. package/dist/chunks/Spinner-VjwI7m_g.js +0 -1
  262. package/dist/chunks/ThemePicker-CtQYHmOr.js +0 -1
  263. package/dist/chunks/agents-DEnmg8Xo.js +0 -101
  264. package/dist/chunks/allErrors-C9kx6lnk.js +0 -1
  265. package/dist/chunks/appleTerminalBackup-CT7g8yOs.js +0 -1
  266. package/dist/chunks/backgroundHousekeeping-CvWfd99M.js +0 -1
  267. package/dist/chunks/caches-DWjwe-DN.js +0 -1
  268. package/dist/chunks/caches-VLs1tQkZ.js +0 -1
  269. package/dist/chunks/client-CO_6v4yl.js +0 -1
  270. package/dist/chunks/client-DO-O441l.js +0 -1
  271. package/dist/chunks/commands-Cn1P7Tms.js +0 -1
  272. package/dist/chunks/compact-DGUhdXcc.js +0 -2
  273. package/dist/chunks/config-C7GTF4iI.js +0 -1
  274. package/dist/chunks/config-CWPHVTic.js +0 -3
  275. package/dist/chunks/config-Cox0TM2Z.js +0 -1
  276. package/dist/chunks/context-noninteractive--OuiZUzL.js +0 -1
  277. package/dist/chunks/conversation--y8PD2Lk.js +0 -1
  278. package/dist/chunks/conversation-BIPJEOwO.js +0 -1
  279. package/dist/chunks/conversationRecovery-BBJzrA0g.js +0 -1
  280. package/dist/chunks/crossProjectResume-CwZb3cEU.js +0 -40
  281. package/dist/chunks/cwd-BZMp3CZ8.js +0 -1
  282. package/dist/chunks/doctor-4NiE46ZG.js +0 -1
  283. package/dist/chunks/envUtils-DfkgIdYf.js +0 -1
  284. package/dist/chunks/execFileNoThrow-BgRsj_SW.js +0 -34
  285. package/dist/chunks/exit-CrsQsjbx.js +0 -1
  286. package/dist/chunks/extractMemories-kogJzpit.js +0 -1
  287. package/dist/chunks/fast-CuNVwVTr.js +0 -1
  288. package/dist/chunks/fast-RlFnwGRV.js +0 -1
  289. package/dist/chunks/fetchModelList-uiCPVqbJ.js +0 -1
  290. package/dist/chunks/genericProcessUtils-BNlr-QxM.js +0 -23
  291. package/dist/chunks/grok-DnmklTrm.js +0 -1
  292. package/dist/chunks/history-kOw3CcLT.js +0 -1
  293. package/dist/chunks/hooks-BDY1jMbS.js +0 -1
  294. package/dist/chunks/install-DrMiHa2Q.js +0 -1
  295. package/dist/chunks/keybindings-BRRN_eap.js +0 -1
  296. package/dist/chunks/loadAgentsDir-CJAK4kif.js +0 -1
  297. package/dist/chunks/localSearch-DyaB2Rm-.js +0 -1
  298. package/dist/chunks/main-B_09WbaG.js +0 -345
  299. package/dist/chunks/managedEnv-BJGfe3m7.js +0 -1
  300. package/dist/chunks/managedEnv-CIWJsuty.js +0 -1
  301. package/dist/chunks/managedEnvConstants-BPwL2aWI.js +0 -1
  302. package/dist/chunks/mcp-1nBvcNxw.js +0 -1
  303. package/dist/chunks/mcp-7DXpXMdT.js +0 -2
  304. package/dist/chunks/mcp-kw99WVi2.js +0 -6
  305. package/dist/chunks/memory-CjWvzR_9.js +0 -1
  306. package/dist/chunks/model-DpZaKZMb.js +0 -1
  307. package/dist/chunks/nativeInstaller-SmPeEisk.js +0 -1
  308. package/dist/chunks/openai-D_j7-KW6.js +0 -2
  309. package/dist/chunks/parser-2usBI4G-.js +0 -1
  310. package/dist/chunks/pidLock-B-SW3Nhx.js +0 -3
  311. package/dist/chunks/plan-BJrWtXEh.js +0 -1
  312. package/dist/chunks/plugin-D97VJAxW.js +0 -17
  313. package/dist/chunks/pluginCliCommands-CUGPc853.js +0 -1
  314. package/dist/chunks/pluginOperations-rTrzu6Vg.js +0 -2
  315. package/dist/chunks/pluginStartupCheck-BRHnXlym.js +0 -1
  316. package/dist/chunks/poorMode-BaS0DBUO.js +0 -1
  317. package/dist/chunks/poorMode-DmvzFAz_.js +0 -1
  318. package/dist/chunks/print-Bi3xVdB3.js +0 -13
  319. package/dist/chunks/processBashCommand-BBtnCx-7.js +0 -1
  320. package/dist/chunks/processSlashCommand-jzF0GmLO.js +0 -5
  321. package/dist/chunks/prompt-CmijKW7G.js +0 -1
  322. package/dist/chunks/prompt-DYBx_D0H.js +0 -1
  323. package/dist/chunks/promptEditor-B6S_Rzcu.js +0 -4
  324. package/dist/chunks/refresh-CAGv8BJY.js +0 -1
  325. package/dist/chunks/reject-CEUkoI2G.js +0 -1
  326. package/dist/chunks/rename-DPFis9g_.js +0 -1
  327. package/dist/chunks/ripgrep-3omwGI-l.js +0 -1
  328. package/dist/chunks/ripgrep-CgQrN3XX.js +0 -5
  329. package/dist/chunks/sandbox-adapter-D15jjHJR.js +0 -1
  330. package/dist/chunks/searchExtraTools-BoFc__Eg.js +0 -1
  331. package/dist/chunks/sessionFileAccessHooks-Rgsp4_Ex.js +0 -1
  332. package/dist/chunks/sessionObserver-PcaVCVkX.js +0 -1
  333. package/dist/chunks/sessionStorage-Dkf7FRgA.js +0 -1
  334. package/dist/chunks/sessionTracing-D7rekMdW.js +0 -11
  335. package/dist/chunks/settings-8fwIkMDV.js +0 -1
  336. package/dist/chunks/settings-CodSADx8.js +0 -24
  337. package/dist/chunks/setup-DBiIrXrh.js +0 -3
  338. package/dist/chunks/sinks-DH83d_kd.js +0 -1
  339. package/dist/chunks/skillChangeDetector-BrrZaFkT.js +0 -1
  340. package/dist/chunks/skills-BRtgqnLz.js +0 -1
  341. package/dist/chunks/startupProfiler-D1NRu2nj.js +0 -1
  342. package/dist/chunks/state-D3gvDiu8.js +0 -1
  343. package/dist/chunks/status-WXA16wIM.js +0 -1
  344. package/dist/chunks/stringUtils-Bu_lJH5c.js +0 -4
  345. package/dist/chunks/switcher-5gilU5_R.js +0 -1
  346. package/dist/chunks/switcher-DMfuKuw_.js +0 -1
  347. package/dist/chunks/tipRegistry-DtO1H_Wo.js +0 -2
  348. package/dist/chunks/toolPool-DHS8jWaL.js +0 -1
  349. package/dist/chunks/udsClient-CmYHFiBD.js +0 -1
  350. package/dist/chunks/urlHandler-DLz3FZm1.js +0 -1
  351. package/dist/chunks/useMainLoopModel-DSN5HjV1.js +0 -1
  352. package/dist/chunks/useManagePlugins-ntnOf5OU.js +0 -1
  353. package/dist/chunks/useMergedTools-C5Yns9Ij.js +0 -1
  354. package/dist/chunks/validatePlugin-D8WQ5z4W.js +0 -1
  355. package/dist/chunks/worktree-a5oOPSYl.js +0 -1
@@ -1 +1 @@
1
- import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{Gt as n,ai as r,et as i,t as a,vt as o}from"./src-DL3w8VPk.js";import{Cb as s}from"./loadAgentsDir-DGozQu_6.js";import{t as c}from"./useDoublePress-C9xxQzh1.js";function l(e,t,n,r=!0){let{exit:a}=o(),[s,c]=(0,u.useState)({pending:!1,keyName:null}),l=(0,u.useMemo)(()=>n??a,[n,a]),d=i(e=>c({pending:e,keyName:`Ctrl-C`}),l),f=i(e=>c({pending:e,keyName:`Ctrl-D`}),l),p=(0,u.useCallback)(()=>{t?.()||d()},[d,t]),m=(0,u.useCallback)(()=>{f()},[f]);return e((0,u.useMemo)(()=>({"app:interrupt":p,"app:exit":m}),[p,m]),{context:`Global`,isActive:r}),s}var u,d=e((()=>{u=t(r(),1),a(),c()}));function f(e,t,r){return l(n,t,e,r)}var p=e((()=>{s(),d()}));export{f as n,p as t};
1
+ import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{Gt as n,ai as r,et as i,t as a,vt as o}from"./src-WZ94ZKI3.js";import{tb as s}from"./loadAgentsDir-DR5PVAc3.js";import{t as c}from"./useDoublePress-DQBLKyzJ.js";function l(e,t,n,r=!0){let{exit:a}=o(),[s,c]=(0,u.useState)({pending:!1,keyName:null}),l=(0,u.useMemo)(()=>n??a,[n,a]),d=i(e=>c({pending:e,keyName:`Ctrl-C`}),l),f=i(e=>c({pending:e,keyName:`Ctrl-D`}),l),p=(0,u.useCallback)(()=>{t?.()||d()},[d,t]),m=(0,u.useCallback)(()=>{f()},[f]);return e((0,u.useMemo)(()=>({"app:interrupt":p,"app:exit":m}),[p,m]),{context:`Global`,isActive:r}),s}var u,d=e((()=>{u=t(r(),1),a(),c()}));function f(e,t,r){return l(n,t,e,r)}var p=e((()=>{s(),d()}));export{f as n,p as t};
@@ -0,0 +1 @@
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{Bh as t,zh as n}from"./loadAgentsDir-DR5PVAc3.js";import{f as r,i,v as a}from"./model-D42epddJ.js";function o(){let e=t(e=>e.mainLoopModel);return a(t(e=>e.mainLoopModelForSession)??e??i())}var s=e((()=>{n(),r()}));export{o as n,s as t};
@@ -0,0 +1 @@
1
+ import{o as e}from"./rolldown-runtime-DaDcL9Zw.js";import{ai as t}from"./src-WZ94ZKI3.js";import{Bh as n,Fa as r,Go as i,Hh as a,Hm as o,Km as s,Ko as c,Pa as l,Wm as u,Xo as d,Zo as f,_f as p,c_ as m,qm as h,s_ as g,vf as _,zh as v}from"./loadAgentsDir-DR5PVAc3.js";import{I as y,V as b,c as x,i as S}from"./debug-kBjDaVkQ.js";import{Bn as C,Kr as w,qr as T,zn as E}from"./settings-YIDksG5Z.js";import{o as D,s as O}from"./log-DWZny1vM.js";import{n as k}from"./analytics-COpjZpvd.js";import{n as A,t as j}from"./notifications-dGBuNvFj.js";import{n as M,r as N}from"./pluginFlagging-BCj9LJP3.js";import{t as P}from"./pluginBlocklist-DAoUENwc.js";var F=e(t(),1);j(),k(),o(),v(),C(),S(),w(),y(),D(),d(),c(),g(),s(),p(),N(),l();function I({enabled:e=!0}={}){let t=a(),o=n(e=>e.plugins.needsRefresh),{addNotification:s}=A(),c=(0,F.useCallback)(async()=>{try{let{enabled:e,disabled:n,errors:a}=await r();await P();let o=M();Object.keys(o).length>0&&s({key:`plugin-delisted-flagged`,text:`Plugins flagged. Check /plugins`,color:`warning`,priority:`high`});let c=[],l=[];try{c=await i()}catch(e){let t=e instanceof Error?e.message:String(e);a.push({type:`generic-error`,source:`plugin-commands`,error:`Failed to load plugin commands: ${t}`})}try{l=await f()}catch(e){let t=e instanceof Error?e.message:String(e);a.push({type:`generic-error`,source:`plugin-agents`,error:`Failed to load plugin agents: ${t}`})}try{await m()}catch(e){let t=e instanceof Error?e.message:String(e);a.push({type:`generic-error`,source:`plugin-hooks`,error:`Failed to load plugin hooks: ${t}`})}let d=(await Promise.all(e.map(async e=>{if(e.mcpServers)return Object.keys(e.mcpServers).length;let t=await _(e,a);return t&&(e.mcpServers=t),t?Object.keys(t).length:0}))).reduce((e,t)=>e+t,0),p=(await Promise.all(e.map(async e=>{if(e.lspServers)return Object.keys(e.lspServers).length;let t=await h(e,a);return t&&(e.lspServers=t),t?Object.keys(t).length:0}))).reduce((e,t)=>e+t,0);u(),t(t=>{let r=t.plugins.errors.filter(e=>e.source===`lsp-manager`||e.source.startsWith(`plugin:`)),i=new Set(a.map(e=>e.type===`generic-error`?`generic-error:${e.source}:${e.error}`:`${e.type}:${e.source}`)),o=[...r.filter(e=>{let t=e.type===`generic-error`?`generic-error:${e.source}:${e.error}`:`${e.type}:${e.source}`;return!i.has(t)}),...a];return{...t,plugins:{...t.plugins,enabled:e,disabled:n,commands:c,errors:o}}}),x(`Loaded plugins - Enabled: ${e.length}, Disabled: ${n.length}, Commands: ${c.length}, Agents: ${l.length}, Errors: ${a.length}`);let g=e.reduce((e,t)=>t.hooksConfig?e+Object.values(t.hooksConfig).reduce((e,t)=>e+(t?.reduce((e,t)=>e+t.hooks.length,0)??0),0):e,0);return{enabled_count:e.length,disabled_count:n.length,inline_count:E(e,e=>e.source.endsWith(`@inline`)),marketplace_count:E(e,e=>!e.source.endsWith(`@inline`)),error_count:a.length,skill_count:c.length,agent_count:l.length,hook_count:g,mcp_count:d,lsp_count:p}}catch(e){let n=b(e);return O(n),x(`Error loading plugins: ${e}`),t(e=>{let t=e.plugins.errors.filter(e=>e.source===`lsp-manager`||e.source.startsWith(`plugin:`)),r={type:`generic-error`,source:`plugin-system`,error:n.message};return{...e,plugins:{...e.plugins,enabled:[],disabled:[],commands:[],errors:[...t,r]}}}),{enabled_count:0,disabled_count:0,inline_count:0,marketplace_count:0,error_count:1,skill_count:0,agent_count:0,hook_count:0,mcp_count:0,lsp_count:0,load_failed:!0,ant_enabled_names:void 0}}},[t,s]);(0,F.useEffect)(()=>{e&&c().then(e=>{let{ant_enabled_names:t,...n}=e,r={...n,has_custom_plugin_cache_dir:!!process.env.WORKMATE_PLUGIN_CACHE_DIR};({...r,...t!==void 0&&{enabled_names:t}}),T(`info`,`tengu_plugins_loaded`,r)})},[c,e]),(0,F.useEffect)(()=>{!e||!o||s({key:`plugin-reload-pending`,text:`Plugins changed. Run /reload-plugins to activate.`,color:`suggestion`,priority:`low`})},[e,o,s])}export{I as t};
@@ -0,0 +1 @@
1
+ import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{ai as n}from"./src-WZ94ZKI3.js";import{Cc as r,Dc as i}from"./loadAgentsDir-DR5PVAc3.js";import{n as a,t as o}from"./toolPool-BcwIF8Q_.js";function s(e,t,n){return(0,c.useMemo)(()=>a(e,r(n,t),n.mode),[e,t,n,!1,!1])}var c,l=e((()=>{c=t(n(),1),i(),o()}));export{s as n,l as t};
@@ -1 +1 @@
1
- import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{Vn as n,ai as r,hn as i,ot as a,t as o}from"./src-DL3w8VPk.js";import{kb as s}from"./loadAgentsDir-DGozQu_6.js";import{_ as c,b as l,d as u,g as d,h as f,l as p,u as m,v as h,y as g}from"./TextInput-Cev5Awdd.js";function _(e){return!!(e.ctrl&&(e.key===`k`||e.key===`u`||e.key===`w`)||e.meta&&e.key===`backspace`)}function v(e){return(e.ctrl||e.meta)&&e.key===`y`}function y({isActive:e,onExit:t,onCancel:r,onExitUp:o,columns:s,passthroughCtrlKeys:u=[],initialQuery:y=``,backspaceExitsOnEmpty:S=!0}){let{columns:C}=a(),w=s??C,[T,E]=(0,b.useState)(y),[D,O]=(0,b.useState)(y.length),k=(0,b.useCallback)(e=>{E(e),O(e.length)},[]),A=n=>{if(!e)return;let i=p.fromText(T,w,D);if(!(n.ctrl&&u.includes(n.key.toLowerCase()))){if(_(n)||c(),v(n)||h(),n.key===`return`||n.key===`down`){n.preventDefault(),t();return}if(n.key===`up`){n.preventDefault(),o&&o();return}if(n.key===`escape`){n.preventDefault(),r?r():T.length>0?(E(``),O(0)):t();return}if(n.key===`backspace`){if(n.preventDefault(),n.meta){let{cursor:e,killed:t}=i.deleteWordBefore();f(t,`prepend`),E(e.text),O(e.offset);return}if(T.length===0){S&&(r??t)();return}let e=i.backspace();E(e.text),O(e.offset);return}if(n.key===`delete`){n.preventDefault();let e=i.del();E(e.text),O(e.offset);return}if(n.key===`left`&&(n.ctrl||n.meta||n.fn)){n.preventDefault();let e=i.prevWord();O(e.offset);return}if(n.key===`right`&&(n.ctrl||n.meta||n.fn)){n.preventDefault();let e=i.nextWord();O(e.offset);return}if(n.key===`left`){n.preventDefault();let e=i.left();O(e.offset);return}if(n.key===`right`){n.preventDefault();let e=i.right();O(e.offset);return}if(n.key===`home`){n.preventDefault(),O(0);return}if(n.key===`end`){n.preventDefault(),O(T.length);return}if(n.ctrl){switch(n.preventDefault(),n.key.toLowerCase()){case`a`:O(0);return;case`e`:O(T.length);return;case`b`:O(i.left().offset);return;case`f`:O(i.right().offset);return;case`d`:{if(T.length===0){(r??t)();return}let e=i.del();E(e.text),O(e.offset);return}case`h`:{if(T.length===0){S&&(r??t)();return}let e=i.backspace();E(e.text),O(e.offset);return}case`k`:{let{cursor:e,killed:t}=i.deleteToLineEnd();f(t,`append`),E(e.text),O(e.offset);return}case`u`:{let{cursor:e,killed:t}=i.deleteToLineStart();f(t,`prepend`),E(e.text),O(e.offset);return}case`w`:{let{cursor:e,killed:t}=i.deleteWordBefore();f(t,`prepend`),E(e.text),O(e.offset);return}case`y`:{let e=m();if(e.length>0){let t=i.offset,n=i.insert(e);d(t,e.length),E(n.text),O(n.offset)}return}case`g`:case`c`:if(r){r();return}}return}if(n.meta){switch(n.preventDefault(),n.key.toLowerCase()){case`b`:O(i.prevWord().offset);return;case`f`:O(i.nextWord().offset);return;case`d`:{let e=i.deleteWordAfter();E(e.text),O(e.offset);return}case`y`:{let e=l();if(e){let{text:t,start:n,length:r}=e,i=T.slice(0,n),a=T.slice(n+r),o=i+t+a,s=n+t.length;g(t.length),E(o),O(s)}return}}return}if(n.key!==`tab`&&n.key.length>=1&&!x.has(n.key)){n.preventDefault();let e=i.insert(n.key);E(e.text),O(e.offset)}}};return i((e,t,r)=>{A(new n(r.keypress))},{isActive:e}),{query:T,setQuery:k,cursorOffset:D,handleKeyDown:A}}var b,x,S=e((()=>{b=t(r(),1),o(),u(),s(),x=new Set([`pageup`,`pagedown`,`insert`,`wheelup`,`wheeldown`,`mouse`,`f1`,`f2`,`f3`,`f4`,`f5`,`f6`,`f7`,`f8`,`f9`,`f10`,`f11`,`f12`])}));export{y as n,S as t};
1
+ import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{Vn as n,ai as r,hn as i,ot as a,t as o}from"./src-WZ94ZKI3.js";import{sb as s}from"./loadAgentsDir-DR5PVAc3.js";import{_ as c,b as l,d as u,g as d,h as f,l as p,u as m,v as h,y as g}from"./TextInput-BboKIug2.js";function _(e){return!!(e.ctrl&&(e.key===`k`||e.key===`u`||e.key===`w`)||e.meta&&e.key===`backspace`)}function v(e){return(e.ctrl||e.meta)&&e.key===`y`}function y({isActive:e,onExit:t,onCancel:r,onExitUp:o,columns:s,passthroughCtrlKeys:u=[],initialQuery:y=``,backspaceExitsOnEmpty:S=!0}){let{columns:C}=a(),w=s??C,[T,E]=(0,b.useState)(y),[D,O]=(0,b.useState)(y.length),k=(0,b.useCallback)(e=>{E(e),O(e.length)},[]),A=n=>{if(!e)return;let i=p.fromText(T,w,D);if(!(n.ctrl&&u.includes(n.key.toLowerCase()))){if(_(n)||c(),v(n)||h(),n.key===`return`||n.key===`down`){n.preventDefault(),t();return}if(n.key===`up`){n.preventDefault(),o&&o();return}if(n.key===`escape`){n.preventDefault(),r?r():T.length>0?(E(``),O(0)):t();return}if(n.key===`backspace`){if(n.preventDefault(),n.meta){let{cursor:e,killed:t}=i.deleteWordBefore();f(t,`prepend`),E(e.text),O(e.offset);return}if(T.length===0){S&&(r??t)();return}let e=i.backspace();E(e.text),O(e.offset);return}if(n.key===`delete`){n.preventDefault();let e=i.del();E(e.text),O(e.offset);return}if(n.key===`left`&&(n.ctrl||n.meta||n.fn)){n.preventDefault();let e=i.prevWord();O(e.offset);return}if(n.key===`right`&&(n.ctrl||n.meta||n.fn)){n.preventDefault();let e=i.nextWord();O(e.offset);return}if(n.key===`left`){n.preventDefault();let e=i.left();O(e.offset);return}if(n.key===`right`){n.preventDefault();let e=i.right();O(e.offset);return}if(n.key===`home`){n.preventDefault(),O(0);return}if(n.key===`end`){n.preventDefault(),O(T.length);return}if(n.ctrl){switch(n.preventDefault(),n.key.toLowerCase()){case`a`:O(0);return;case`e`:O(T.length);return;case`b`:O(i.left().offset);return;case`f`:O(i.right().offset);return;case`d`:{if(T.length===0){(r??t)();return}let e=i.del();E(e.text),O(e.offset);return}case`h`:{if(T.length===0){S&&(r??t)();return}let e=i.backspace();E(e.text),O(e.offset);return}case`k`:{let{cursor:e,killed:t}=i.deleteToLineEnd();f(t,`append`),E(e.text),O(e.offset);return}case`u`:{let{cursor:e,killed:t}=i.deleteToLineStart();f(t,`prepend`),E(e.text),O(e.offset);return}case`w`:{let{cursor:e,killed:t}=i.deleteWordBefore();f(t,`prepend`),E(e.text),O(e.offset);return}case`y`:{let e=m();if(e.length>0){let t=i.offset,n=i.insert(e);d(t,e.length),E(n.text),O(n.offset)}return}case`g`:case`c`:if(r){r();return}}return}if(n.meta){switch(n.preventDefault(),n.key.toLowerCase()){case`b`:O(i.prevWord().offset);return;case`f`:O(i.nextWord().offset);return;case`d`:{let e=i.deleteWordAfter();E(e.text),O(e.offset);return}case`y`:{let e=l();if(e){let{text:t,start:n,length:r}=e,i=T.slice(0,n),a=T.slice(n+r),o=i+t+a,s=n+t.length;g(t.length),E(o),O(s)}return}}return}if(n.key!==`tab`&&n.key.length>=1&&!x.has(n.key)){n.preventDefault();let e=i.insert(n.key);E(e.text),O(e.offset)}}};return i((e,t,r)=>{A(new n(r.keypress))},{isActive:e}),{query:T,setQuery:k,cursorOffset:D,handleKeyDown:A}}var b,x,S=e((()=>{b=t(r(),1),o(),u(),s(),x=new Set([`pageup`,`pagedown`,`insert`,`wheelup`,`wheeldown`,`mouse`,`f1`,`f2`,`f3`,`f4`,`f5`,`f6`,`f7`,`f8`,`f9`,`f10`,`f11`,`f12`])}));export{y as n,S as t};
@@ -1 +1 @@
1
- import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{ai as n}from"./src-DL3w8VPk.js";import{Gp as r,Kp as i}from"./loadAgentsDir-DGozQu_6.js";import{n as a,t as o}from"./notifications-ql0eSo0Y.js";import{n as s,t as c}from"./allErrors-C9kx6lnk.js";function l(){let{addNotification:e,removeNotification:t}=a(),[n,r]=(0,u.useState)(()=>{let{errors:e}=c();return e});return i((0,u.useCallback)(()=>{let{errors:e}=c();r(e)},[])),(0,u.useEffect)(()=>{if(n.length>0){let t=`Found ${n.length} settings ${n.length===1?`issue`:`issues`} · /doctor for details`;e({key:d,text:t,color:`warning`,priority:`high`,timeoutMs:6e4})}else t(d)},[n,e,t]),n}var u,d,f=e((()=>{u=t(n(),1),o(),s(),r(),d=`settings-errors`}));export{l as n,f as t};
1
+ import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{ai as n}from"./src-WZ94ZKI3.js";import{Gh as r,Kh as i}from"./loadAgentsDir-DR5PVAc3.js";import{n as a,t as o}from"./notifications-dGBuNvFj.js";import{n as s,t as c}from"./allErrors-CxPNR2WN.js";function l(){let{addNotification:e,removeNotification:t}=a(),[n,r]=(0,u.useState)(()=>{let{errors:e}=c();return e});return i((0,u.useCallback)(()=>{let{errors:e}=c();r(e)},[])),(0,u.useEffect)(()=>{if(n.length>0){let t=`Found ${n.length} settings ${n.length===1?`issue`:`issues`} · /doctor for details`;e({key:d,text:t,color:`warning`,priority:`high`,timeoutMs:6e4})}else t(d)},[n,e,t]),n}var u,d,f=e((()=>{u=t(n(),1),o(),s(),r(),d=`settings-errors`}));export{l as n,f as t};
@@ -1 +1 @@
1
- import{o as e}from"./rolldown-runtime-DaDcL9Zw.js";import{ai as t}from"./src-DL3w8VPk.js";import{t as n}from"./jsx-runtime-Bb4Xn-E0.js";import{Lp as r,zp as i}from"./loadAgentsDir-DGozQu_6.js";import{n as a}from"./analytics-COpjZpvd.js";import{t as o}from"./KeybindingProviderSetup-DsJqfEt-.js";import{t as s}from"./useManagePlugins-ntnOf5OU.js";import{n as c,t as l}from"./MCPConnectionManager-DkZVxLEj.js";import{cwd as u}from"process";var d=e(t(),1);a(),c(),i();var f=n(),p=d.lazy(()=>import(`./Doctor-DKpBnbuI.js`).then(e=>({default:e.Doctor})));function m({onDone:e}){return s(),(0,f.jsx)(d.Suspense,{fallback:null,children:(0,f.jsx)(p,{onDone:e})})}async function h(e){await new Promise(t=>{e.render((0,f.jsx)(r,{children:(0,f.jsx)(o,{children:(0,f.jsx)(l,{dynamicMcpConfig:void 0,isStrictMcpConfig:!1,children:(0,f.jsx)(m,{onDone:()=>{t()}})})})}))}),e.unmount(),process.exit(0)}async function g(e,t){let{setup:n}=await import(`./setup-DBiIrXrh.js`);await n(u(),`default`,!1,!1,void 0,!1);let{install:r}=await import(`./install-DrMiHa2Q.js`);await new Promise(n=>{let i=[];e&&i.push(e),t.force&&i.push(`--force`),r.call(e=>{n(),process.exit(+!!e.includes(`failed`))},{},i)})}export{h as doctorHandler,g as installHandler};
1
+ import{o as e}from"./rolldown-runtime-DaDcL9Zw.js";import{ai as t}from"./src-WZ94ZKI3.js";import{t as n}from"./jsx-runtime-Bb4Xn-E0.js";import{Lh as r,zh as i}from"./loadAgentsDir-DR5PVAc3.js";import{n as a}from"./analytics-COpjZpvd.js";import{t as o}from"./KeybindingProviderSetup-CSUkJHTT.js";import{t as s}from"./useManagePlugins-CrWjzESW.js";import{n as c,t as l}from"./MCPConnectionManager-Bn1PDn3R.js";import{cwd as u}from"process";var d=e(t(),1);a(),c(),i();var f=n(),p=d.lazy(()=>import(`./Doctor-BU69VQzw.js`).then(e=>({default:e.Doctor})));function m({onDone:e}){return s(),(0,f.jsx)(d.Suspense,{fallback:null,children:(0,f.jsx)(p,{onDone:e})})}async function h(e){await new Promise(t=>{e.render((0,f.jsx)(r,{children:(0,f.jsx)(o,{children:(0,f.jsx)(l,{dynamicMcpConfig:void 0,isStrictMcpConfig:!1,children:(0,f.jsx)(m,{onDone:()=>{t()}})})})}))}),e.unmount(),process.exit(0)}async function g(e,t){let{setup:n}=await import(`./setup-BBvZyrfz.js`);await n(u(),`default`,!1,!1,void 0,!1);let{install:r}=await import(`./install-ACGY0vhM.js`);await new Promise(n=>{let i=[];e&&i.push(e),t.force&&i.push(`--force`),r.call(e=>{n(),process.exit(+!!e.includes(`failed`))},{},i)})}export{h as doctorHandler,g as installHandler};
@@ -0,0 +1 @@
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{n as t,t as n}from"./axios-DaWTGg7G.js";import{N as r,b as i}from"./types-CD25a50S.js";import{_w as a,bw as o,cx as s,gx as c,hx as l,lx as u,mx as d,vw as ee,xw as f}from"./loadAgentsDir-DR5PVAc3.js";import{C as p,I as m,M as h,N as g,R as _,S as v,c as y,f as b,i as te,u as x,x as S}from"./debug-kBjDaVkQ.js";import{dt as C,gt as w,ht as T,mt as ne,pt as re}from"./settings-YIDksG5Z.js";import{o as ie,s as E}from"./log-DWZny1vM.js";import{homedir as ae}from"os";import*as D from"path";import{join as oe,resolve as se}from"path";import{randomBytes as O}from"crypto";import{readFile as k,readdir as A,rename as j,stat as M,unlink as N,writeFile as P}from"fs/promises";function F(){return oe(s(),H)}async function I(){let e=F();try{let t=v(await k(e,{encoding:`utf-8`}));if(typeof t!=`object`||!t||!(`version`in t)||!(`fetchedAt`in t)||!(`counts`in t))return y(`Install counts cache has invalid structure`),null;let n=t;if(n.version!==V)return y(`Install counts cache version mismatch (got ${n.version}, expected ${V})`),null;if(typeof n.fetchedAt!=`string`||!Array.isArray(n.counts))return y(`Install counts cache has invalid structure`),null;let r=new Date(n.fetchedAt).getTime();return Number.isNaN(r)?(y(`Install counts cache has invalid fetchedAt timestamp`),null):n.counts.every(e=>typeof e==`object`&&!!e&&typeof e.plugin==`string`&&typeof e.unique_installs==`number`)?Date.now()-r>W?(y(`Install counts cache is stale (>24h old)`),null):{version:n.version,fetchedAt:n.fetchedAt,counts:n.counts}:(y(`Install counts cache has malformed entries`),null)}catch(e){return g(e)!==`ENOENT`&&y(`Failed to load install counts cache: ${h(e)}`),null}}async function L(e){let t=F(),n=`${t}.${O(8).toString(`hex`)}.tmp`;try{let r=s();await x().mkdir(r),await P(n,p(e,null,2),{encoding:`utf-8`,mode:384}),await j(n,t),y(`Install counts cache saved successfully`)}catch(e){E(e);try{await N(n)}catch{}}}async function R(){y(`Fetching install counts from ${U}`);let e=performance.now();try{let n=await t.get(U,{timeout:1e4});if(!n.data?.plugins||!Array.isArray(n.data.plugins))throw Error(`Invalid response format from install counts API`);return c(`install_counts`,U,`success`,performance.now()-e),n.data.plugins}catch(t){throw c(`install_counts`,U,`failure`,performance.now()-e,d(t)),t}}async function z(){let e=await I();if(e){y(`Using cached install counts`),c(`install_counts`,U,`cache_hit`,0);let t=new Map;for(let n of e.counts)t.set(n.plugin,n.unique_installs);return t}try{let e=await R();await L({version:V,fetchedAt:new Date().toISOString(),counts:e});let t=new Map;for(let n of e)t.set(n.plugin,n.unique_installs);return t}catch(e){return E(e),y(`Failed to fetch install counts: ${h(e)}`),null}}function B(e){if(e<1e3)return String(e);if(e<1e6){let t=(e/1e3).toFixed(1);return t.endsWith(`.0`)?`${t.slice(0,-2)}K`:`${t}K`}let t=(e/1e6).toFixed(1);return t.endsWith(`.0`)?`${t.slice(0,-2)}M`:`${t}M`}var V,H,U,W,G=e((()=>{n(),te(),m(),b(),ie(),S(),l(),u(),V=1,H=`install-counts-cache.json`,U=`https://raw.githubusercontent.com/anthropics/claude-plugins-official/refs/heads/stats/stats/plugin-installs.json`,W=1440*60*1e3}));async function K(e){let t=e.trim(),n=x(),r=t.match(/^([a-zA-Z0-9._-]+@[^:]+:.+?(?:\.git)?)(#(.+))?$/);if(r?.[1]){let e=r[1],t=r[3];return t?{source:`git`,url:e,ref:t}:{source:`git`,url:e}}if(t.startsWith(`http://`)||t.startsWith(`https://`)){let e=t.match(/^([^#]+)(#(.+))?$/),n=e?.[1]||t,r=e?.[3];if(n.endsWith(`.git`)||n.includes(`/_git/`))return r?{source:`git`,url:n,ref:r}:{source:`git`,url:n};let i;try{i=new URL(n)}catch{return{source:`url`,url:n}}if((i.hostname===`github.com`||i.hostname===`www.github.com`)&&i.pathname.match(/^\/([^/]+\/[^/]+?)(\/|\.git|$)/)?.[1]){let e=n.endsWith(`.git`)?n:`${n}.git`;return r?{source:`git`,url:e,ref:r}:{source:`git`,url:e}}return{source:`url`,url:n}}let i=process.platform===`win32`&&(t.startsWith(`.\\`)||t.startsWith(`..\\`)||/^[a-zA-Z]:[/\\]/.test(t));if(t.startsWith(`./`)||t.startsWith(`../`)||t.startsWith(`/`)||t.startsWith(`~`)||i){let e=se(t.startsWith(`~`)?t.replace(/^~/,ae()):t),r;try{r=await n.stat(e)}catch(t){let n=g(t);return{error:n===`ENOENT`?`Path does not exist: ${e}`:`Cannot access path: ${e} (${n??t})`}}return r.isFile()?e.endsWith(`.json`)?{source:`file`,path:e}:{error:`File path must point to a .json file (marketplace.json), but got: ${e}`}:r.isDirectory()?{source:`directory`,path:e}:{error:`Path is neither a file nor a directory: ${e}`}}if(t.includes(`/`)&&!t.startsWith(`@`)){if(t.includes(`:`))return null;let e=t.match(/^([^#@]+)(?:[#@](.+))?$/),n=e?.[1]||t,r=e?.[2];return r?{source:`github`,repo:n,ref:r}:{source:`github`,repo:n}}return null}var ce=e((()=>{m(),b()}));function le(e){let t=D.basename(e),n=D.basename(D.dirname(e));return t===`plugin.json`?`plugin`:t===`marketplace.json`?`marketplace`:n===`.claude-plugin`?`plugin`:`unknown`}function q(e){return e.issues.map(e=>({path:e.path.join(`.`)||`root`,message:e.message,code:e.code}))}function J(e,t,n,r){e.includes(`..`)&&n.push({path:t,message:r?`Path contains "..": ${e}. ${r}`:`Path contains ".." which could be a path traversal attempt: ${e}`})}function ue(e){let t=e.replace(/^(\.\.\/)+/,``);return`Plugin source paths are resolved relative to the marketplace root (the directory containing .claude-plugin/), not relative to marketplace.json. Use "${t===e?`./plugins/my-plugin`:`./${t}`}" instead of "${e}".`}async function Y(e){let t=[],n=[],r=D.resolve(e),i;try{i=await k(r,{encoding:`utf-8`})}catch(e){let t=g(e),n;return n=t===`ENOENT`?`File not found: ${r}`:t===`EISDIR`?`Path is not a file: ${r}`:`Failed to read file: ${h(e)}`,{success:!1,errors:[{path:`file`,message:n,code:t}],warnings:[],filePath:r,fileType:`plugin`}}let a;try{a=v(i)}catch(e){return{success:!1,errors:[{path:`json`,message:`Invalid JSON syntax: ${h(e)}`}],warnings:[],filePath:r,fileType:`plugin`}}if(a&&typeof a==`object`){let e=a;e.commands&&(Array.isArray(e.commands)?e.commands:[e.commands]).forEach((e,n)=>{typeof e==`string`&&J(e,`commands[${n}]`,t)}),e.agents&&(Array.isArray(e.agents)?e.agents:[e.agents]).forEach((e,n)=>{typeof e==`string`&&J(e,`agents[${n}]`,t)}),e.skills&&(Array.isArray(e.skills)?e.skills:[e.skills]).forEach((e,n)=>{typeof e==`string`&&J(e,`skills[${n}]`,t)})}let o=a;if(typeof a==`object`&&a){let e=a,t=Object.keys(e).filter(e=>$.has(e));if(t.length>0){let r={...e};for(let e of t)delete r[e],n.push({path:e,message:`Field '${e}' belongs in the marketplace entry (marketplace.json), not plugin.json. It's harmless here but unused — Work Mate ignores it at load time.`});o=r}}let s=re().strict().safeParse(o);if(s.success||t.push(...q(s.error)),s.success){let e=s.data;/^[a-z0-9]+(-[a-z0-9]+)*$/.test(e.name)||n.push({path:`name`,message:`Plugin name "${e.name}" is not kebab-case. Work Mate accepts it, but the Claude.ai marketplace sync requires kebab-case (lowercase letters, digits, and hyphens only, e.g., "my-plugin").`}),e.version||n.push({path:`version`,message:`No version specified. Consider adding a version following semver (e.g., "1.0.0")`}),e.description||n.push({path:`description`,message:`No description provided. Adding a description helps users understand what your plugin does`}),e.author||n.push({path:`author`,message:`No author information provided. Consider adding author details for plugin attribution`})}return{success:t.length===0,errors:t,warnings:n,filePath:r,fileType:`plugin`}}async function X(e){let t=[],n=[],i=D.resolve(e),a;try{a=await k(i,{encoding:`utf-8`})}catch(e){let t=g(e),n;return n=t===`ENOENT`?`File not found: ${i}`:t===`EISDIR`?`Path is not a file: ${i}`:`Failed to read file: ${h(e)}`,{success:!1,errors:[{path:`file`,message:n,code:t}],warnings:[],filePath:i,fileType:`marketplace`}}let o;try{o=v(a)}catch(e){return{success:!1,errors:[{path:`json`,message:`Invalid JSON syntax: ${h(e)}`}],warnings:[],filePath:i,fileType:`marketplace`}}if(o&&typeof o==`object`){let e=o;Array.isArray(e.plugins)&&e.plugins.forEach((e,n)=>{if(e&&typeof e==`object`&&`source`in e){let r=e.source;typeof r==`string`&&J(r,`plugins[${n}].source`,t,ue(r)),r&&typeof r==`object`&&`path`in r&&typeof r.path==`string`&&J(r.path,`plugins[${n}].source.path`,t)}})}let s=T().extend({plugins:r(ne().strict())}).strict().safeParse(o);if(s.success||t.push(...q(s.error)),s.success){let e=s.data;if((!e.plugins||e.plugins.length===0)&&n.push({path:`plugins`,message:`Marketplace has no plugins defined`}),e.plugins){e.plugins.forEach((n,r)=>{e.plugins.filter(e=>e.name===n.name).length>1&&t.push({path:`plugins[${r}].name`,message:`Duplicate plugin name "${n.name}" found in marketplace`})});let r=D.dirname(i),a=D.basename(r)===`.claude-plugin`?D.dirname(r):r;for(let[t,r]of e.plugins.entries()){if(!r.version||typeof r.source!=`string`||!r.source.startsWith(`./`))continue;let e=D.join(a,r.source,`.claude-plugin`,`plugin.json`),i;try{let t=v(await k(e,{encoding:`utf-8`}));typeof t.version==`string`&&(i=t.version)}catch{continue}i&&i!==r.version&&n.push({path:`plugins[${t}].version`,message:`Entry declares version "${r.version}" but ${r.source}/.claude-plugin/plugin.json says "${i}". At install time, plugin.json wins (calculatePluginVersion precedence) — the entry version is silently ignored. Update this entry to "${i}" to match.`})}}e.metadata?.description||n.push({path:`metadata.description`,message:`No marketplace description provided. Adding a description helps users understand what this marketplace offers`})}return{success:t.length===0,errors:t,warnings:n,filePath:i,fileType:`marketplace`}}function de(e,t,n){let r=[],i=[],o=t.match(a);if(!o)return i.push({path:`frontmatter`,message:`No frontmatter block found. Add YAML frontmatter between --- delimiters at the top of the file to set description and other metadata.`}),{success:!0,errors:r,warnings:i,filePath:e,fileType:n};let s=o[1]||``,c;try{c=f(s)}catch(t){return r.push({path:`frontmatter`,message:`YAML frontmatter failed to parse: ${h(t)}. At runtime this ${n} loads with empty metadata (all frontmatter fields silently dropped).`}),{success:!1,errors:r,warnings:i,filePath:e,fileType:n}}if(typeof c!=`object`||!c||Array.isArray(c))return r.push({path:`frontmatter`,message:`Frontmatter must be a YAML mapping (key: value pairs), got ${Array.isArray(c)?`an array`:c===null?`null`:typeof c}.`}),{success:!1,errors:r,warnings:i,filePath:e,fileType:n};let l=c;if(l.description!==void 0){let e=l.description;typeof e!=`string`&&typeof e!=`number`&&typeof e!=`boolean`&&e!==null&&r.push({path:`description`,message:`description must be a string, got ${Array.isArray(e)?`array`:typeof e}. At runtime this value is dropped.`})}else i.push({path:`description`,message:`No description in frontmatter. A description helps users and Work Mate understand when to use this ${n}.`});l.name!==void 0&&l.name!==null&&typeof l.name!=`string`&&r.push({path:`name`,message:`name must be a string, got ${typeof l.name}.`});let u=l[`allowed-tools`];u!=null&&(typeof u!=`string`&&!Array.isArray(u)?r.push({path:`allowed-tools`,message:`allowed-tools must be a string or array of strings, got ${typeof u}.`}):Array.isArray(u)&&u.some(e=>typeof e!=`string`)&&r.push({path:`allowed-tools`,message:`allowed-tools array must contain only strings.`}));let d=l.shell;if(d!=null)if(typeof d!=`string`)r.push({path:`shell`,message:`shell must be a string, got ${typeof d}.`});else{let e=d.trim().toLowerCase();e!==`bash`&&e!==`powershell`&&r.push({path:`shell`,message:`shell must be 'bash' or 'powershell', got '${d}'.`})}return{success:r.length===0,errors:r,warnings:i,filePath:e,fileType:n}}async function Z(e){let t;try{t=await k(e,{encoding:`utf-8`})}catch(t){return g(t)===`ENOENT`?{success:!0,errors:[],warnings:[],filePath:e,fileType:`hooks`}:{success:!1,errors:[{path:`file`,message:`Failed to read file: ${h(t)}`}],warnings:[],filePath:e,fileType:`hooks`}}let n;try{n=v(t)}catch(t){return{success:!1,errors:[{path:`json`,message:`Invalid JSON syntax: ${h(t)}. At runtime this breaks the entire plugin load.`}],warnings:[],filePath:e,fileType:`hooks`}}let r=C().safeParse(n);return r.success?{success:!0,errors:[],warnings:[],filePath:e,fileType:`hooks`}:{success:!1,errors:q(r.error),warnings:[],filePath:e,fileType:`hooks`}}async function Q(e,t){let n;try{n=await A(e,{withFileTypes:!0})}catch(e){let t=g(e);if(t===`ENOENT`||t===`ENOTDIR`)return[];throw e}if(t)return n.filter(e=>e.isDirectory()).map(t=>D.join(e,t.name,`SKILL.md`));let r=[];for(let t of n){let n=D.join(e,t.name);t.isDirectory()?r.push(...await Q(n,!1)):t.isFile()&&t.name.toLowerCase().endsWith(`.md`)&&r.push(n)}return r}async function fe(e){let t=[],n=[[`skill`,D.join(e,`skills`)],[`agent`,D.join(e,`agents`)],[`command`,D.join(e,`commands`)]];for(let[e,r]of n){let n=await Q(r,e===`skill`);for(let r of n){let n;try{n=await k(r,{encoding:`utf-8`})}catch(n){if(_(n))continue;t.push({success:!1,errors:[{path:`file`,message:`Failed to read: ${h(n)}`}],warnings:[],filePath:r,fileType:e});continue}let i=de(r,n,e);(i.errors.length>0||i.warnings.length>0)&&t.push(i)}}let r=await Z(D.join(e,`hooks`,`hooks.json`));return(r.errors.length>0||r.warnings.length>0)&&t.push(r),t}async function pe(e){let t=D.resolve(e),n=null;try{n=await M(t)}catch(e){if(!_(e))throw e}if(n?.isDirectory()){let e=await X(D.join(t,`.claude-plugin`,`marketplace.json`));if(e.errors[0]?.code!==`ENOENT`)return e;let n=await Y(D.join(t,`.claude-plugin`,`plugin.json`));return n.errors[0]?.code===`ENOENT`?{success:!1,errors:[{path:`directory`,message:`No manifest found in directory. Expected .claude-plugin/marketplace.json or .claude-plugin/plugin.json`}],warnings:[],filePath:t,fileType:`plugin`}:n}switch(le(e)){case`plugin`:return Y(e);case`marketplace`:return X(e);case`unknown`:try{let n=v(await k(t,{encoding:`utf-8`}));if(Array.isArray(n.plugins))return X(e)}catch(e){if(g(e)===`ENOENT`)return{success:!1,errors:[{path:`file`,message:`File not found: ${t}`}],warnings:[],filePath:t,fileType:`plugin`}}return Y(e)}}var $,me=e((()=>{i(),m(),ee(),S(),o(),w(),$=new Set([`category`,`source`,`tags`,`strict`,`id`])}));export{K as a,G as c,ce as i,pe as n,B as o,fe as r,z as s,me as t};
@@ -1 +1 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{d as t,h as n,o as r}from"./config-CWPHVTic.js";import{n as i}from"./analytics-COpjZpvd.js";var a;e((()=>{i(),t(),a=async()=>{let e=r().editorMode||`normal`;e===`emacs`&&(e=`normal`);let t=e===`normal`?`vim`:`normal`;return n(e=>({...e,editorMode:t})),{type:`text`,value:`Editor mode set to ${t}. ${t===`vim`?`Use Escape key to toggle between INSERT and NORMAL modes.`:`Using standard (readline) keyboard bindings.`}`}}}))();export{a as call};
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{d as t,h as n,o as r}from"./config-D3K87Mm1.js";import{n as i}from"./analytics-COpjZpvd.js";var a;e((()=>{i(),t(),a=async()=>{let e=r().editorMode||`normal`;e===`emacs`&&(e=`normal`);let t=e===`normal`?`vim`:`normal`;return n(e=>({...e,editorMode:t})),{type:`text`,value:`Editor mode set to ${t}. ${t===`vim`?`Use Escape key to toggle between INSERT and NORMAL modes.`:`Using standard (readline) keyboard bindings.`}`}}}))();export{a as call};
@@ -0,0 +1 @@
1
+ import{St as e,_t as t}from"./loadAgentsDir-DR5PVAc3.js";e();export{t as execIntoTmuxWorktree};
package/dist/cli.js CHANGED
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env bun
2
- import{l as e,o as t}from"./chunks/envUtils-DfkgIdYf.js";var n=globalThis.performance,r=new Map,i=new Map;function a(){return n.now()}function o(e){return r.set(e,a()),{name:e,entryType:`mark`,startTime:r.get(e),duration:0}}function s(e,t,n){let o,s;if(typeof t==`string`){let e=r.get(t),i=n?r.get(n):a();o=e??a(),s=(i??a())-o}else t&&typeof t==`object`?(o=t.start??0,s=(t.end??a())-o):(o=0,s=a());i.set(e,{name:e,startTime:o,duration:s})}function c(e){return e===`mark`?[...r.entries()].map(([e,t])=>({name:e,entryType:`mark`,startTime:t,duration:0})):e===`measure`?[...i.values()].map(e=>({name:e.name,entryType:`measure`,startTime:e.startTime,duration:e.duration})):[]}function l(e,t){return c(t??`mark`).concat(t===void 0?c(`measure`):[]).filter(t=>t.name===e)}function u(e){e===void 0?r.clear():r.delete(e)}function d(e){e===void 0?i.clear():i.delete(e)}var f={now:a,mark:o,measure:s,getEntriesByType:c,getEntriesByName:l,clearMarks:u,clearMeasures:d,clearResourceTimings:(()=>{}),setResourceTimingBufferSize:(()=>{}),markResourceTiming:(()=>{}),get timeOrigin(){return n.timeOrigin},get onresourcetimingbufferfull(){return n.onresourcetimingbufferfull},set onresourcetimingbufferfull(e){},toJSON(){return n.toJSON()}};function p(){globalThis.__performanceShimInstalled||(globalThis.__performanceShimInstalled=!0,globalThis.performance=f)}if(p(),t(),globalThis.MACRO===void 0&&(globalThis.MACRO={VERSION:process.env.CLAUDE_CODE_VERSION||`2.1.888`,BUILD_TIME:new Date().toISOString(),FEEDBACK_CHANNEL:``,ISSUES_EXPLAINER:``,NATIVE_PACKAGE_URL:``,PACKAGE_URL:``,VERSION_CHANGELOG:``}),e(process.env.CLAUDE_CODE_FORCE_INTERACTIVE)){for(let e of[process.stdin,process.stdout,process.stderr])if(!e.isTTY)try{Object.defineProperty(e,"isTTY",{value:!0,configurable:!0})}catch{}}process.env.COREPACK_ENABLE_AUTO_PIN=`0`;async function m(){let e=process.argv.slice(2);if(e.length===1&&(e[0]===`--version`||e[0]===`-v`||e[0]===`-V`)){console.log(`0.0.25 (Work Mate)`);return}let{profileCheckpoint:t}=await import(`./chunks/startupProfiler-D1NRu2nj.js`);if(t(`cli_entry`),process.argv[2]===`--acp`){t(`cli_acp_path`);let{runAcpAgent:e}=await import(`./chunks/entry-D1iD76SW.js`);await e();return}if(e[0]===`job`){t(`cli_templates_path`);let{templatesMain:n}=await import(`./chunks/templateJobs-BW6TaqEC.js`);await n(e.slice(1)),process.exit(0)}if(e[0]===`new`||e[0]===`list`||e[0]===`reply`){console.error(`[deprecated] Use: claude job ${e[0]} ${e.slice(1).join(` `)}`.trim()),t(`cli_templates_path`);let{templatesMain:n}=await import(`./chunks/templateJobs-BW6TaqEC.js`);await n(e),process.exit(0)}if((e.includes(`--tmux`)||e.includes(`--tmux=classic`))&&(e.includes(`-w`)||e.includes(`--worktree`)||e.some(e=>e.startsWith(`--worktree=`)))){t(`cli_tmux_worktree_fast_path`);let{enableConfigs:n}=await import(`./chunks/config-Cox0TM2Z.js`);n();let{isWorktreeModeEnabled:r}=await import(`./chunks/worktreeModeEnabled-D68iEHpC.js`);if(r()){let{execIntoTmuxWorktree:t}=await import(`./chunks/worktree-a5oOPSYl.js`),n=await t(e);if(n.handled)return;if(n.error){let{exitWithError:e}=await import(`./chunks/process-CNfq37LF.js`);e(n.error)}}}e.includes(`--bare`)&&(process.env.CLAUDE_CODE_SIMPLE=`1`);let{startCapturingEarlyInput:n}=await import(`./chunks/earlyInput-BEjRkAtH.js`);n(),t(`cli_before_main_import`);let{main:r}=await import(`./chunks/main-B_09WbaG.js`);t(`cli_after_main_import`),await r(),t(`cli_after_main_complete`)}await m();export{};
2
+ import{l as e,o as t}from"./chunks/envUtils-DZ_SvEVz.js";var n=globalThis.performance,r=new Map,i=new Map;function a(){return n.now()}function o(e){return r.set(e,a()),{name:e,entryType:`mark`,startTime:r.get(e),duration:0}}function s(e,t,n){let o,s;if(typeof t==`string`){let e=r.get(t),i=n?r.get(n):a();o=e??a(),s=(i??a())-o}else t&&typeof t==`object`?(o=t.start??0,s=(t.end??a())-o):(o=0,s=a());i.set(e,{name:e,startTime:o,duration:s})}function c(e){return e===`mark`?[...r.entries()].map(([e,t])=>({name:e,entryType:`mark`,startTime:t,duration:0})):e===`measure`?[...i.values()].map(e=>({name:e.name,entryType:`measure`,startTime:e.startTime,duration:e.duration})):[]}function l(e,t){return c(t??`mark`).concat(t===void 0?c(`measure`):[]).filter(t=>t.name===e)}function u(e){e===void 0?r.clear():r.delete(e)}function d(e){e===void 0?i.clear():i.delete(e)}var f={now:a,mark:o,measure:s,getEntriesByType:c,getEntriesByName:l,clearMarks:u,clearMeasures:d,clearResourceTimings:(()=>{}),setResourceTimingBufferSize:(()=>{}),markResourceTiming:(()=>{}),get timeOrigin(){return n.timeOrigin},get onresourcetimingbufferfull(){return n.onresourcetimingbufferfull},set onresourcetimingbufferfull(e){},toJSON(){return n.toJSON()}};function p(){globalThis.__performanceShimInstalled||(globalThis.__performanceShimInstalled=!0,globalThis.performance=f)}if(p(),t(),globalThis.MACRO===void 0&&(globalThis.MACRO={VERSION:process.env.WORKMATE_VERSION||`2.1.888`,BUILD_TIME:new Date().toISOString(),FEEDBACK_CHANNEL:``,ISSUES_EXPLAINER:``,NATIVE_PACKAGE_URL:``,PACKAGE_URL:``,VERSION_CHANGELOG:``}),e(process.env.WORKMATE_FORCE_INTERACTIVE)){for(let e of[process.stdin,process.stdout,process.stderr])if(!e.isTTY)try{Object.defineProperty(e,"isTTY",{value:!0,configurable:!0})}catch{}}process.env.COREPACK_ENABLE_AUTO_PIN=`0`;async function m(){let e=process.argv.slice(2);if(e.length===1&&(e[0]===`--version`||e[0]===`-v`||e[0]===`-V`)){console.log(`0.0.26 (Work Mate)`);return}let{profileCheckpoint:t}=await import(`./chunks/startupProfiler-FpGsKWYk.js`);if(t(`cli_entry`),process.argv[2]===`--acp`){t(`cli_acp_path`);let{runAcpAgent:e}=await import(`./chunks/entry-CbhyIWgj.js`);await e();return}if(e[0]===`job`){t(`cli_templates_path`);let{templatesMain:n}=await import(`./chunks/templateJobs-BKVEWCsb.js`);await n(e.slice(1)),process.exit(0)}if(e[0]===`new`||e[0]===`list`||e[0]===`reply`){console.error(`[deprecated] Use: claude job ${e[0]} ${e.slice(1).join(` `)}`.trim()),t(`cli_templates_path`);let{templatesMain:n}=await import(`./chunks/templateJobs-BKVEWCsb.js`);await n(e),process.exit(0)}if((e.includes(`--tmux`)||e.includes(`--tmux=classic`))&&(e.includes(`-w`)||e.includes(`--worktree`)||e.some(e=>e.startsWith(`--worktree=`)))){t(`cli_tmux_worktree_fast_path`);let{enableConfigs:n}=await import(`./chunks/config-DtmqWusU.js`);n();let{isWorktreeModeEnabled:r}=await import(`./chunks/worktreeModeEnabled-D68iEHpC.js`);if(r()){let{execIntoTmuxWorktree:t}=await import(`./chunks/worktree-CR_M6Qfy.js`),n=await t(e);if(n.handled)return;if(n.error){let{exitWithError:e}=await import(`./chunks/process-CNfq37LF.js`);e(n.error)}}}e.includes(`--bare`)&&(process.env.WORKMATE_SIMPLE=`1`);let{startCapturingEarlyInput:n}=await import(`./chunks/earlyInput-BEjRkAtH.js`);n(),t(`cli_before_main_import`);let{main:r}=await import(`./chunks/main-Ryi27wYq.js`);t(`cli_after_main_import`),await r(),t(`cli_after_main_complete`)}await m();export{};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@readmagic/workmate",
3
- "version": "0.0.25",
3
+ "version": "0.0.26",
4
4
  "description": "workMate",
5
5
  "type": "module",
6
6
  "author": "Frandy",
@@ -1,11 +1,11 @@
1
1
  #!/usr/bin/env node
2
2
  /**
3
- * Postinstall scriptruns automatically after `bun install` or `npm install`.
3
+ * Postinstall 脚本 `bun install` `npm install` 后自动运行。
4
4
  *
5
- * Downloads ripgrep binary (idempotent, skips if exists).
6
- * Works in dev mode (src/ exists), published mode (dist/ exists), with bun or node.
5
+ * 下载 ripgrep 二进制(幂等,已存在则跳过)。
6
+ * 同时支持 dev 模式(src/ 存在)、发布模式(dist/ 存在),bun node 均可。
7
7
  *
8
- * Usage:
8
+ * 用法:
9
9
  * node scripts/postinstall.js
10
10
  * node scripts/postinstall.js --force
11
11
  * bun run scripts/postinstall.js
@@ -26,14 +26,14 @@ const { setDefaultResultOrder } = require('node:dns')
26
26
  const path = require('path')
27
27
  const os = require('os')
28
28
 
29
- // Prefer IPv4 first — Bun on Windows sometimes fails GitHub over broken IPv6 paths.
29
+ // 优先使用 IPv4 — Bun Windows 上有时因 IPv6 路径损坏而无法访问 GitHub
30
30
  try {
31
31
  setDefaultResultOrder('ipv4first')
32
32
  } catch {
33
33
  /* ignore */
34
34
  }
35
35
 
36
- // --- Config ---
36
+ // --- 配置 ---
37
37
 
38
38
  const RG_VERSION = '15.0.1'
39
39
  const DEFAULT_RELEASE_BASE = `https://github.com/microsoft/ripgrep-prebuilt/releases/download/v${RG_VERSION}`
@@ -45,7 +45,7 @@ const RELEASE_BASE = (
45
45
  const scriptDir = path.dirname(__filename)
46
46
  const projectRoot = path.resolve(scriptDir, '..')
47
47
 
48
- // --- Platform mapping ---
48
+ // --- 平台映射 ---
49
49
 
50
50
  function getPlatformMapping() {
51
51
  const arch = process.arch
@@ -91,7 +91,7 @@ function detectMusl() {
91
91
  }
92
92
  }
93
93
 
94
- // --- Paths ---
94
+ // --- 路径 ---
95
95
 
96
96
  function getVendorDir() {
97
97
  if (existsSync(path.join(projectRoot, 'src'))) {
@@ -107,7 +107,7 @@ function getBinaryPath() {
107
107
  return path.resolve(dir, subdir, binary)
108
108
  }
109
109
 
110
- // --- Download helpers ---
110
+ // --- 下载辅助 ---
111
111
 
112
112
  function proxyEnvSet() {
113
113
  const v = s => (s ?? '').trim()
@@ -150,14 +150,14 @@ function tryCurlDownload(url, dest) {
150
150
 
151
151
  async function fetchRelease(url) {
152
152
  if (proxyEnvSet()) {
153
- // Dynamic require so it works in node without bundling issues
153
+ // 动态 require 以避免打包问题,在 node 中也能用
154
154
  const undici = require('undici')
155
155
  return await undici.fetch(url, {
156
156
  redirect: 'follow',
157
157
  dispatcher: new undici.EnvHttpProxyAgent(),
158
158
  })
159
159
  }
160
- // Node 18+ has global fetch, Bun has it too
160
+ // Node 18+ 有全局 fetchBun 也有
161
161
  return await fetch(url, { redirect: 'follow' })
162
162
  }
163
163
 
@@ -199,7 +199,7 @@ async function downloadUrlToBufferWithFallback(url) {
199
199
  throw firstError
200
200
  }
201
201
 
202
- // --- Extract ---
202
+ // --- 解压 ---
203
203
 
204
204
  function findZipEntryKey(files, want) {
205
205
  return Object.keys(files).find(k => {
@@ -210,7 +210,7 @@ function findZipEntryKey(files, want) {
210
210
 
211
211
  async function extractZip(buffer, binaryPath, extractedBinary) {
212
212
  const binaryDir = path.dirname(binaryPath)
213
- // Try fflate first (bundled dep)
213
+ // 先用 fflate(内置依赖)
214
214
  let fflateError
215
215
  try {
216
216
  const { unzipSync } = require('fflate')
@@ -225,7 +225,7 @@ async function extractZip(buffer, binaryPath, extractedBinary) {
225
225
  fflateError = e
226
226
  }
227
227
 
228
- // Fallback: PowerShell Expand-Archive or unzip CLI
228
+ // 回退:PowerShell Expand-Archive unzip CLI
229
229
  const tmpDir = path.join(binaryDir, '.tmp-download')
230
230
  rmSync(tmpDir, { recursive: true, force: true })
231
231
  mkdirSync(tmpDir, { recursive: true })
@@ -304,7 +304,7 @@ async function extractTarGz(buffer, binaryPath, extractedBinary, assetName) {
304
304
  }
305
305
  }
306
306
 
307
- // --- Main ---
307
+ // --- 主逻辑 ---
308
308
 
309
309
  async function downloadAndExtract() {
310
310
  const { target, ext } = getPlatformMapping()
@@ -384,6 +384,6 @@ main().catch(error => {
384
384
  console.error(
385
385
  `[postinstall] You can install ripgrep manually: https://github.com/BurntSushi/ripgrep#installation`,
386
386
  )
387
- // Never exit with error code — postinstall must not break install
387
+ // 永不返回错误码 — postinstall 不能破坏安装
388
388
  process.exit(0)
389
389
  })
@@ -1 +0,0 @@
1
- import{n as e,t}from"./AgentsMdExternalIncludesDialog-DVbU-BaD.js";e();export{t as AgentsMdExternalIncludesDialog};
@@ -1 +0,0 @@
1
- import{R as e,t}from"./src-DL3w8VPk.js";import{t as n}from"./jsx-runtime-Bb4Xn-E0.js";import{Lp as r,zp as i}from"./loadAgentsDir-DGozQu_6.js";import{d as a,h as o,o as s}from"./config-CWPHVTic.js";import{t as c}from"./fpsMetrics-wxj9GAsd.js";import{n as l,t as u}from"./onChangeAppState-D85b33R5.js";i(),t(),a();var d=n();function f({getFpsMetrics:t,stats:n,initialState:i,children:a}){return(0,d.jsx)(c,{getFpsMetrics:t,children:(0,d.jsx)(l,{store:n,children:(0,d.jsx)(r,{initialState:i,onChangeAppState:u,children:(0,d.jsx)(e,{initialState:s().theme,onThemeSave:e=>o(t=>({...t,theme:e})),children:a})})})})}export{f as App};
@@ -1,2 +0,0 @@
1
- import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{n,t as r}from"./figures-5ThXQEtq.js";import{D as i,Gt as a,H as o,I as s,P as c,T as l,ai as u,ot as d,t as f,y as p}from"./src-DL3w8VPk.js";import{t as m}from"./jsx-runtime-Bb4Xn-E0.js";import{Bp as h,Cb as g,Dc as _,Ec as v,En as y,Gl as b,Hl as x,Hp as ee,Ji as S,Tb as te,Ul as C,Wl as ne,Xu as w,Yu as T,_u as E,fm as re,fs as ie,gu as D,hm as O,kb as k,nS as A,ps as j,wb as M,wn as N,zp as P}from"./loadAgentsDir-DGozQu_6.js";import{_ as ae,f as oe}from"./debug-CRnGsZOV.js";import{Hn as se,Un as ce,Vn as F}from"./settings-CodSADx8.js";import{l as I,o as L}from"./stringUtils-Bu_lJH5c.js";import{S as le,_ as R,f as ue,l as de,u as fe,y as z}from"./startupProfiler-DF0AjiDf.js";import{_n as pe,gn as me,vn as he}from"./prompt-DzO1um1h.js";import{i as ge,t as _e}from"./overlayContext-CLjlCFBl.js";function B(e,t,n=1e3,r=0,i){let a=()=>de(Math.max(0,(i??Date.now())-e-r));return(0,V.useSyncExternalStore)((0,V.useCallback)(e=>{if(!t)return()=>{};let r=setInterval(e,n);return()=>clearInterval(r)},[t,n]),a,a)}var V,H=e((()=>{V=t(u(),1),R()}));function ve(e,t,n){let r=me(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,ye.jsxs)(c,{children:[a,`(`,o,`)`]}):a}catch{return e.toolName}}var ye,be=e((()=>{f(),he(),ye=m()}));function xe(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 Se(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 Ce(e,t){if(!t)return!1;let n=!1;for(let t of Object.values(e))if(E(t))return n=!0,!1;return n}var we=e((()=>{n(),D()}));function Te({agent:e,onDone:t,onKillAgent:n,onBack:r}){let[u]=o(),d=(0,Ee.useMemo)(()=>v(pe()),[]),f=B(e.startTime,e.status===`running`,1e3,e.totalPausedMs??0);a({"confirm:yes":t},{context:`Confirmation`});let m=i=>{i.key===` `?(i.preventDefault(),t()):i.key===`left`&&r?(i.preventDefault(),r()):i.key===`x`&&e.status===`running`&&n&&(i.preventDefault(),n())},h=A(e.prompt,`plan`),g=e.prompt.length>300?`${e.prompt.substring(0,297)}…`:e.prompt,_=e.result?.totalTokens??e.progress?.tokenCount,y=e.result?.totalToolUseCount??e.progress?.toolUseCount;return(0,U.jsx)(s,{flexDirection:`column`,tabIndex:0,autoFocus:!0,onKeyDown:m,children:(0,U.jsx)(p,{title:(0,U.jsxs)(c,{children:[e.selectedAgent?.agentType??`agent`,` › `,e.description||`Async agent`]}),subtitle:(0,U.jsxs)(c,{children:[e.status!==`running`&&(0,U.jsxs)(c,{color:Se(e.status),children:[xe(e.status),` `,e.status===`completed`?`Completed`:e.status===`failed`?`Failed`:`Stopped`,` · `]}),(0,U.jsxs)(c,{dimColor:!0,children:[f,_!==void 0&&_>0&&(0,U.jsxs)(U.Fragment,{children:[` · `,ue(_),` tokens`]}),y!==void 0&&y>0&&(0,U.jsxs)(U.Fragment,{children:[` `,`· `,y,` `,y===1?`tool`:`tools`]})]})]}),onCancel:t,color:`background`,inputGuide:t=>t.pending?(0,U.jsxs)(c,{children:[`Press `,t.keyName,` again to exit`]}):(0,U.jsxs)(l,{children:[r&&(0,U.jsx)(i,{shortcut:`←`,action:`go back`}),(0,U.jsx)(i,{shortcut:`Esc/Enter/Space`,action:`close`}),e.status===`running`&&n&&(0,U.jsx)(i,{shortcut:`x`,action:`stop`})]}),children:(0,U.jsxs)(s,{flexDirection:`column`,children:[e.status===`running`&&e.progress?.recentActivities&&e.progress.recentActivities.length>0&&(0,U.jsxs)(s,{flexDirection:`column`,children:[(0,U.jsx)(c,{bold:!0,dimColor:!0,children:`Progress`}),e.progress.recentActivities.map((t,n)=>(0,U.jsxs)(c,{dimColor:n<e.progress.recentActivities.length-1,wrap:`truncate-end`,children:[n===e.progress.recentActivities.length-1?`› `:` `,ve(t,d,u)]},n))]}),h?(0,U.jsx)(s,{marginTop:1,children:(0,U.jsx)(T,{addMargin:!1,planContent:h})}):(0,U.jsxs)(s,{flexDirection:`column`,marginTop:1,children:[(0,U.jsx)(c,{bold:!0,dimColor:!0,children:`Prompt`}),(0,U.jsx)(c,{wrap:`wrap`,children:g})]}),e.status===`failed`&&e.error&&(0,U.jsxs)(s,{flexDirection:`column`,marginTop:1,children:[(0,U.jsx)(c,{bold:!0,color:`error`,children:`Error`}),(0,U.jsx)(c,{color:`error`,wrap:`wrap`,children:e.error})]})]})})})}var Ee,U,De=e((()=>{Ee=t(u(),1),H(),f(),g(),he(),_(),R(),S(),w(),be(),we(),U=m()}));function W({status:e,label:t,suffix:n}){return(0,G.jsxs)(c,{color:e===`completed`?`success`:e===`failed`?`error`:e===`killed`?`warning`:void 0,dimColor:!0,children:[`(`,t??e,n,`)`]})}function Oe({shell:e}){switch(e.status){case`completed`:return(0,G.jsx)(W,{status:`completed`,label:`done`});case`failed`:return(0,G.jsx)(W,{status:`failed`,label:`error`});case`killed`:return(0,G.jsx)(W,{status:`killed`,label:`stopped`});case`running`:case`pending`:return(0,G.jsx)(W,{status:`running`})}}var G,ke=e((()=>{f(),G=m()}));function Ae({task:e,maxActivityWidth:t}){let n=t??40;switch(e.type){case`local_bash`:return(0,K.jsxs)(c,{children:[z(e.command,n,!0),` `,(0,K.jsx)(Oe,{shell:e})]});case`local_agent`:return(0,K.jsxs)(c,{children:[z(e.description,n,!0),` `,(0,K.jsx)(W,{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,K.jsxs)(c,{children:[z(t.workflowName??e.summary??e.description,n,!0),` `,(0,K.jsx)(W,{status:e.status,label:e.status===`running`?`${t.agentCount} ${I(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} ${I(t,`file`)}`:`${e.sessionsReviewing} ${I(e.sessionsReviewing,`session`)}`;return(0,K.jsxs)(c,{children:[e.description,` `,(0,K.jsxs)(c,{dimColor:!0,children:[`· `,e.phase,` · `,n]}),` `,(0,K.jsx)(W,{status:e.status,label:e.status===`completed`?`done`:void 0,suffix:e.status===`completed`&&!e.notified?`, unread`:void 0})]})}}}var K,je=e((()=>{f(),R(),L(),ke(),K=m()}));function Me({task:e,onDone:t,onBack:n,onKill:r}){let o=B(e.startTime,e.status===`running`,1e3,0);a({"confirm:yes":t},{context:`Confirmation`});let u=i=>{i.key===` `?(i.preventDefault(),t()):i.key===`left`&&n?(i.preventDefault(),n()):i.key===`x`&&e.status===`running`&&r&&(i.preventDefault(),r())},d=e.turns.filter(e=>e.text!==``),f=d.slice(-6),m=d.length-f.length;return(0,q.jsx)(s,{flexDirection:`column`,tabIndex:0,autoFocus:!0,onKeyDown:u,children:(0,q.jsx)(p,{title:`Memory consolidation`,subtitle:(0,q.jsxs)(c,{dimColor:!0,children:[o,` · reviewing `,e.sessionsReviewing,` `,I(e.sessionsReviewing,`session`),e.filesTouched.length>0&&(0,q.jsxs)(q.Fragment,{children:[` `,`· `,e.filesTouched.length,` `,I(e.filesTouched.length,`file`),` touched`]})]}),onCancel:t,color:`background`,inputGuide:t=>t.pending?(0,q.jsxs)(c,{children:[`Press `,t.keyName,` again to exit`]}):(0,q.jsxs)(l,{children:[n&&(0,q.jsx)(i,{shortcut:`←`,action:`go back`}),(0,q.jsx)(i,{shortcut:`Esc/Enter/Space`,action:`close`}),e.status===`running`&&r&&(0,q.jsx)(i,{shortcut:`x`,action:`stop`})]}),children:(0,q.jsxs)(s,{flexDirection:`column`,gap:1,children:[(0,q.jsxs)(c,{children:[(0,q.jsx)(c,{bold:!0,children:`Status:`}),` `,e.status===`running`?(0,q.jsx)(c,{color:`background`,children:`running`}):e.status===`completed`?(0,q.jsx)(c,{color:`success`,children:e.status}):(0,q.jsx)(c,{color:`error`,children:e.status})]}),f.length===0?(0,q.jsx)(c,{dimColor:!0,children:e.status===`running`?`Starting…`:`(no text output)`}):(0,q.jsxs)(q.Fragment,{children:[m>0&&(0,q.jsxs)(c,{dimColor:!0,children:[`(`,m,` earlier `,I(m,`turn`),`)`]}),f.map((e,t)=>(0,q.jsxs)(s,{flexDirection:`column`,children:[(0,q.jsx)(c,{wrap:`wrap`,children:e.text}),e.toolUseCount>0&&(0,q.jsxs)(c,{dimColor:!0,children:[` `,`(`,e.toolUseCount,` `,I(e.toolUseCount,`tool`),`)`]})]},t))]})]})})})}var q,Ne=e((()=>{H(),f(),g(),L(),q=m()}));async function Pe(e){let t=N(e.id);try{let e=await ae(t,Le);return{content:e.content,bytesTotal:e.bytesTotal}}catch{return{content:``,bytesTotal:0}}}function Fe({shell:e,onDone:t,onKillShell:n,onBack:r}){let{columns:o}=d(),[u,f]=(0,J.useState)(()=>Pe(e)),m=(0,J.useDeferredValue)(u);(0,J.useEffect)(()=>{if(e.status!==`running`)return;let t=setInterval((e,t)=>e(Pe(t)),1e3,f,e);return()=>clearInterval(t)},[e.id,e.status]);let h=()=>t(`Shell details dismissed`,{display:`system`});a({"confirm:yes":h},{context:`Confirmation`});let g=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())},_=le(e.command,280);return(0,Y.jsx)(s,{flexDirection:`column`,tabIndex:0,autoFocus:!0,onKeyDown:g,children:(0,Y.jsxs)(p,{title:`Shell details`,onCancel:h,color:`background`,inputGuide:t=>t.pending?(0,Y.jsxs)(c,{children:[`Press `,t.keyName,` again to exit`]}):(0,Y.jsxs)(l,{children:[r&&(0,Y.jsx)(i,{shortcut:`←`,action:`go back`}),(0,Y.jsx)(i,{shortcut:`Esc/Enter/Space`,action:`close`}),e.status===`running`&&n&&(0,Y.jsx)(i,{shortcut:`x`,action:`stop`})]}),children:[(0,Y.jsxs)(s,{flexDirection:`column`,children:[(0,Y.jsxs)(c,{children:[(0,Y.jsx)(c,{bold:!0,children:`Status:`}),` `,e.status===`running`?(0,Y.jsxs)(c,{color:`background`,children:[e.status,e.result?.code!==void 0&&` (exit code: ${e.result.code})`]}):e.status===`completed`?(0,Y.jsxs)(c,{color:`success`,children:[e.status,e.result?.code!==void 0&&` (exit code: ${e.result.code})`]}):(0,Y.jsxs)(c,{color:`error`,children:[e.status,e.result?.code!==void 0&&` (exit code: ${e.result.code})`]})]}),(0,Y.jsxs)(c,{children:[(0,Y.jsx)(c,{bold:!0,children:`Runtime:`}),` `,de((e.endTime??Date.now())-e.startTime)]}),(0,Y.jsxs)(c,{wrap:`wrap`,children:[(0,Y.jsx)(c,{bold:!0,children:`Command:`}),` `,_]})]}),(0,Y.jsxs)(s,{flexDirection:`column`,children:[(0,Y.jsx)(c,{bold:!0,children:`Output:`}),(0,Y.jsx)(J.Suspense,{fallback:(0,Y.jsx)(c,{dimColor:!0,children:`Loading output…`}),children:(0,Y.jsx)(Ie,{outputPromise:m,columns:o})})]})]})})}function Ie({outputPromise:e,columns:t}){let{content:n,bytesTotal:r}=(0,J.use)(e);if(!n)return(0,Y.jsx)(c,{dimColor:!0,children:`No output available`});let i=[],a=n.length;for(let e=0;e<10&&a>0;e++){let e=n.lastIndexOf(`
2
- `,a-1);i.push(e+1),a=e}i.reverse();let o=r>n.length,l=[];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&&l.push(a)}return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(s,{borderStyle:`round`,paddingX:1,flexDirection:`column`,height:12,maxWidth:t-6,children:l.map((e,t)=>(0,Y.jsx)(c,{wrap:`truncate-end`,children:e},t))}),(0,Y.jsxs)(c,{dimColor:!0,italic:!0,children:[`Showing ${l.length} lines`,o?` of ${fe(r)}`:``]})]})}var J,Y,Le,Re=e((()=>{J=t(u(),1),k(),f(),g(),R(),oe(),y(),Y=m(),Le=8192}));function ze(e,t){return Object.values(e??{}).filter(E).filter(e=>!(e.type===`local_agent`&&e.id===t))}function Be({onDone:e,toolUseContext:t,initialDetailTaskId:n}){let r=h(e=>e.tasks),o=h(e=>e.foregroundedTaskId),u=ee(),d=te(`chat:killAgents`,`Chat`,`ctrl+x ctrl+k`),f=r,m=(0,Z.useRef)(!1),[g,_]=(0,Z.useState)(()=>{if(n)return m.current=!0,{mode:`detail`,itemId:n};let e=ze(f,o);return e.length===1?(m.current=!0,{mode:`detail`,itemId:e[0].id}):{mode:`list`}}),[v,y]=(0,Z.useState)(0);ge(`background-tasks-dialog`);let{bashTasks:b,agentTasks:x,workflowTasks:S,dreamTasks:C,allSelectableItems:w}=(0,Z.useMemo)(()=>{let e=Object.values(f??{}).filter(E).map(Ve).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===`local_agent`&&e.id!==o),r=e.filter(e=>e.type===`local_workflow`),i=e.filter(e=>e.type===`dream`);return{bashTasks:t,agentTasks:n,workflowTasks:r,dreamTasks:i,allSelectableItems:[...t,...n,...r,...i]}},[f,o]),T=w[v]??null;a({"confirm:previous":()=>y(e=>Math.max(0,e-1)),"confirm:next":()=>y(e=>Math.min(w.length-1,e+1)),"confirm:yes":()=>{let e=w[v];e&&_({mode:`detail`,itemId:e.id})}},{context:`Confirmation`,isActive:g.mode===`list`});let D=t=>{if(g.mode!==`list`)return;if(t.key===`left`){t.preventDefault(),e(`Background tasks dialog dismissed`,{display:`system`});return}let n=w[v];n&&t.key===`x`&&(t.preventDefault(),n.type===`local_bash`&&n.status===`running`?O(n.id):n.type===`local_agent`&&n.status===`running`?k(n.id):n.type===`local_workflow`&&n.status===`running`?$(n.id,u):n.type===`dream`&&n.status===`running`&&A(n.id))};async function O(e){await re.kill(e,u)}async function k(e){await ie.kill(e,u)}async function A(e){await ne.kill(e,u)}let j=(0,Z.useEffectEvent)(e);(0,Z.useEffect)(()=>{if(g.mode!==`list`){let e=f?.[g.itemId];(!e||e.type!==`local_workflow`&&!E(e))&&(m.current?j(`Background tasks dialog dismissed`,{display:`system`}):_({mode:`list`}))}let e=w.length;v>=e&&e>0&&y(e-1)},[g,f,v,w,j]);let M=()=>{m.current&&w.length<=1?e(`Background tasks dialog dismissed`,{display:`system`}):(m.current=!1,_({mode:`list`}))};if(g.mode!==`list`&&f){let t=f[g.itemId];if(!t)return null;switch(t.type){case`local_bash`:return(0,Q.jsx)(Fe,{shell:t,onDone:e,onKillShell:()=>void O(t.id),onBack:M},`shell-${t.id}`);case`local_agent`:return(0,Q.jsx)(Te,{agent:t,onDone:e,onKillAgent:()=>void k(t.id),onBack:M},`agent-${t.id}`);case`local_workflow`:{let e=t.status===`running`?()=>$(t.id,u):void 0;return(0,Q.jsx)(s,{flexDirection:`column`,tabIndex:0,borderStyle:`round`,onKeyDown:t=>{t.key===`left`?(t.preventDefault(),M()):t.key===`x`&&e&&(t.preventDefault(),e())},children:(0,Q.jsx)(p,{title:t.workflowName,subtitle:(0,Q.jsxs)(c,{dimColor:!0,children:[t.status,t.summary?` · ${t.summary}`:``]}),onCancel:M,inputGuide:()=>(0,Q.jsxs)(l,{children:[(0,Q.jsx)(i,{shortcut:`←`,action:`go back`}),(0,Q.jsx)(i,{shortcut:`Esc`,action:`close`}),e&&(0,Q.jsx)(i,{shortcut:`x`,action:`stop`})]}),children:t.status===`failed`&&t.error?(0,Q.jsxs)(c,{color:`error`,children:[`失败原因:`,t.error]}):null})},`workflow-${t.id}`)}case`dream`:return(0,Q.jsx)(Me,{task:t,onDone:()=>e(`Background tasks dialog dismissed`,{display:`system`}),onBack:M,onKill:t.status===`running`?()=>void A(t.id):void 0},`dream-${t.id}`)}}let N=F(b,e=>e.status===`running`),P=F(x,e=>e.status===`running`),ae=ce([...N>0?[(0,Q.jsxs)(c,{children:[N,` `,N===1?`active shell`:`active shells`]},`shells`)]:[],...P>0?[(0,Q.jsxs)(c,{children:[P,` `,P===1?`active agent`:`active agents`]},`agents`)]:[]],e=>(0,Q.jsx)(c,{children:` · `},`separator-${e}`)),oe=[(0,Q.jsx)(i,{shortcut:`↑/↓`,action:`select`},`upDown`),(0,Q.jsx)(i,{shortcut:`Enter`,action:`view`},`enter`),...(T?.type===`local_bash`||T?.type===`local_agent`||T?.type===`local_workflow`||T?.type===`dream`)&&T.status===`running`?[(0,Q.jsx)(i,{shortcut:`x`,action:`stop`},`kill`)]:[],...x.some(e=>e.status===`running`)?[(0,Q.jsx)(i,{shortcut:d,action:`stop all agents`},`kill-all`)]:[],(0,Q.jsx)(i,{shortcut:`←/Esc`,action:`close`},`esc`)],se=()=>e(`Background tasks dialog dismissed`,{display:`system`});function I(e){return e.pending?(0,Q.jsxs)(c,{children:[`Press `,e.keyName,` again to exit`]}):(0,Q.jsx)(l,{children:oe})}return(0,Q.jsx)(s,{flexDirection:`column`,tabIndex:0,autoFocus:!0,onKeyDown:D,children:(0,Q.jsx)(p,{title:`Background tasks`,subtitle:ae,onCancel:se,color:`background`,inputGuide:I,children:w.length===0?(0,Q.jsx)(c,{dimColor:!0,children:`No tasks currently running`}):(0,Q.jsxs)(s,{flexDirection:`column`,children:[b.length>0&&(0,Q.jsxs)(s,{flexDirection:`column`,children:[x.length>0&&(0,Q.jsxs)(c,{dimColor:!0,children:[(0,Q.jsxs)(c,{bold:!0,children:[` `,`Shells`]}),` (`,b.length,`)`]}),(0,Q.jsx)(s,{flexDirection:`column`,children:b.map(e=>(0,Q.jsx)(X,{item:e,isSelected:e.id===T?.id},e.id))})]}),x.length>0&&(0,Q.jsxs)(s,{flexDirection:`column`,marginTop:+(b.length>0),children:[(0,Q.jsxs)(c,{dimColor:!0,children:[(0,Q.jsxs)(c,{bold:!0,children:[` `,`Local agents`]}),` (`,x.length,`)`]}),(0,Q.jsx)(s,{flexDirection:`column`,children:x.map(e=>(0,Q.jsx)(X,{item:e,isSelected:e.id===T?.id},e.id))})]}),S.length>0&&(0,Q.jsxs)(s,{flexDirection:`column`,marginTop:+(b.length>0||x.length>0),children:[(0,Q.jsxs)(c,{dimColor:!0,children:[(0,Q.jsxs)(c,{bold:!0,children:[` `,`Workflows`]}),` (`,S.length,`)`]}),(0,Q.jsx)(s,{flexDirection:`column`,children:S.map(e=>(0,Q.jsx)(X,{item:e,isSelected:e.id===T?.id},e.id))})]}),C.length>0&&(0,Q.jsx)(s,{flexDirection:`column`,marginTop:+(b.length>0||x.length>0||S.length>0),children:(0,Q.jsx)(s,{flexDirection:`column`,children:C.map(e=>(0,Q.jsx)(X,{item:e,isSelected:e.id===T?.id},e.id))})})]})})})}function Ve(e){switch(e.type){case`local_bash`:return{id:e.id,type:`local_bash`,label:e.command,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 X({item:e,isSelected:t}){let{columns:n}=d(),i=Math.max(30,n-26);return(0,Q.jsxs)(s,{flexDirection:`row`,children:[(0,Q.jsx)(c,{children:t?`${r.pointer} `:` `}),(0,Q.jsx)(c,{color:t?`suggestion`:void 0,children:(0,Q.jsx)(Ae,{task:e.task,maxActivityWidth:i})})]})}var Z,Q,$,He=e((()=>{n(),Z=t(u(),1),k(),P(),b(),j(),O(),D(),se(),_e(),f(),g(),M(),De(),je(),Ne(),Re(),x(),Q=m(),$=C}));export{H as a,Ce as i,He as n,B as o,we as r,Be as t};
@@ -1 +0,0 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{n as t}from"./SelectMulti-BW7Ffk1G.js";import{n}from"./select-Fq6g2Ejk.js";var r=e((()=>{t(),n()}));export{r as t};
@@ -1,6 +0,0 @@
1
- import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{n,t as r}from"./figures-5ThXQEtq.js";import{C as i,Gt as a,I as o,P as s,T as c,ai as l,ot as u,t as d,y as f}from"./src-DL3w8VPk.js";import{t as p}from"./jsx-runtime-Bb4Xn-E0.js";import{Cb as m,Sp as h,Tb as ee,kb as g,wb as _,xp as v}from"./loadAgentsDir-DGozQu_6.js";import{n as y,t as b}from"./cwd-BvNt_018.js";import{Fr as x,Ir as S,Mr as C,jn as w,jr as T,wn as E}from"./settings-CodSADx8.js";import{i as D,t as O}from"./execFileNoThrow-BgRsj_SW.js";import{l as k,o as A}from"./stringUtils-Bu_lJH5c.js";import{_ as te,x as ne}from"./startupProfiler-DF0AjiDf.js";import{i as re,t as ie}from"./overlayContext-CLjlCFBl.js";import{r as ae}from"./detectRepository-CsJLbVEe.js";import{join as oe,resolve as se}from"path";import{access as j}from"fs/promises";async function M(){if(!await C()||await N())return null;let{stdout:e,code:t}=await O(x(),[`--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 O(x(),[`--no-optional-locks`,`diff`,`HEAD`,`--numstat`],{timeout:F,preserveOutputOnError:!1});if(r!==0)return null;let{stats:i,perFileStats:a}=le(n),o=I-a.size;if(o>0){let e=await P(o);if(e){i.filesCount+=e.size;for(let[t,n]of e)a.set(t,n)}}return{stats:i,perFileStats:a,hunks:new Map}}async function ce(){if(!await C()||await N())return new Map;let{stdout:e,code:t}=await O(x(),[`--no-optional-locks`,`diff`,`HEAD`],{timeout:F,preserveOutputOnError:!1});return t===0?ue(e):new Map}function le(e){let t=e.trim().split(`
2
- `).filter(Boolean),n=0,r=0,i=0,a=new Map;for(let e of t){let t=e.split(` `);if(t.length<3)continue;i++;let o=t[0],s=t[1],c=t.slice(2).join(` `),l=o===`-`||s===`-`,u=l?0:parseInt(o??`0`,10)||0,d=l?0:parseInt(s??`0`,10)||0;n+=u,r+=d,a.size<I&&a.set(c,{added:u,removed:d,isBinary:l})}return{stats:{filesCount:i,linesAdded:n,linesRemoved:r},perFileStats:a}}function ue(e){let t=new Map;if(!e.trim())return t;let n=e.split(/^diff --git /m).filter(Boolean);for(let e of n){if(t.size>=I)break;if(e.length>L)continue;let n=e.split(`
3
- `),r=n[0]?.match(/^a\/(.+?) b\/(.+)$/);if(!r)continue;let i=r[2]??r[1]??``,a=[],o=null,s=0;for(let e=1;e<n.length;e++){let t=n[e]??``,r=t.match(/^@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/);if(r){o&&a.push(o),o={oldStart:parseInt(r[1]??`0`,10),oldLines:parseInt(r[2]??`1`,10),newStart:parseInt(r[3]??`0`,10),newLines:parseInt(r[4]??`1`,10),lines:[]};continue}if(!(t.startsWith(`index `)||t.startsWith(`---`)||t.startsWith(`+++`)||t.startsWith(`new file`)||t.startsWith(`deleted file`)||t.startsWith(`old mode`)||t.startsWith(`new mode`)||t.startsWith(`Binary files`))&&o&&(t.startsWith(`+`)||t.startsWith(`-`)||t.startsWith(` `)||t===``)){if(s>=R)continue;o.lines.push(`${t}`),s++}}o&&a.push(o),a.length>0&&t.set(i,a)}return t}async function N(){let e=await T(b());return e?(await Promise.all([`MERGE_HEAD`,`REBASE_HEAD`,`CHERRY_PICK_HEAD`,`REVERT_HEAD`].map(t=>j(oe(e,t)).then(()=>!0).catch(()=>!1)))).some(Boolean):!1}async function P(e){let{stdout:t,code:n}=await O(x(),[`--no-optional-locks`,`ls-files`,`--others`,`--exclude-standard`],{timeout:F,preserveOutputOnError:!1});if(n!==0||!t.trim())return null;let r=t.trim().split(`
4
- `).filter(Boolean);if(r.length===0)return null;let i=new Map;for(let t of r.slice(0,e))i.set(t,{added:0,removed:0,isBinary:!1,isUntracked:!0});return i}function de(e){let t=e.match(/(\d+)\s+files?\s+changed(?:,\s+(\d+)\s+insertions?\(\+\))?(?:,\s+(\d+)\s+deletions?\(-\))?/);return t?{filesCount:parseInt(t[1]??`0`,10),linesAdded:parseInt(t[2]??`0`,10),linesRemoved:parseInt(t[3]??`0`,10)}:null}var F,I,L,R,z,B=e((()=>{y(),ae(),D(),E(),S(),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([M(),ce()]);e||(t(n),r(i),a(!1))}catch{e||(t(null),r(new Map),a(!1))}}return n(),()=>{e=!0}},[]),(0,H.useMemo)(()=>{if(!e)return{stats:null,files:[],hunks:new Map,loading:i};let{stats:t,perFileStats:r}=e,a=[];for(let[e,t]of r){let r=n.get(e),i=t.isUntracked??!1,o=!t.isBinary&&!i&&!r,s=t.added+t.removed,c=!o&&!t.isBinary&&s>U;a.push({path:e,linesAdded:t.added,linesRemoved:t.removed,isBinary:t.isBinary,isLargeFile:o,isTruncated:c,isUntracked:i})}return a.sort((e,t)=>e.path.localeCompare(t.path)),{stats:t,files:a,hunks:n,loading:!1}},[e,n,i])}var H,U,fe=e((()=>{H=t(l(),1),B(),U=400}));function pe(e){if(!e||typeof e!=`object`)return!1;let t=e,n=typeof t.filePath==`string`,r=Array.isArray(t.structuredPatch)&&t.structuredPatch.length>0,i=t.type===`create`&&typeof t.content==`string`;return n&&(r||i)}function W(e){return`type`in e&&(e.type===`create`||e.type===`update`)}function me(e){let t=0,n=0;for(let r of e)for(let e of r.lines)e.startsWith(`+`)?t++:e.startsWith(`-`)&&n++;return{added:t,removed:n}}function he(e){if(e.type!==`user`)return``;let t=e.message.content,n=typeof t==`string`?t:``;return n.length<=30?n:`${n.slice(0,29)}…`}function G(e){let t=0,n=0;for(let r of e.files.values())t+=r.linesAdded,n+=r.linesRemoved;e.stats={filesChanged:e.files.size,linesAdded:t,linesRemoved:n}}function ge(e){let t=(0,K.useRef)({completedTurns:[],currentTurn:null,lastProcessedIndex:0,lastTurnIndex:0});return(0,K.useMemo)(()=>{let n=t.current;e.length<n.lastProcessedIndex&&(n.completedTurns=[],n.currentTurn=null,n.lastProcessedIndex=0,n.lastTurnIndex=0);for(let t=n.lastProcessedIndex;t<e.length;t++){let r=e[t];if(r?.type===`user`){if(!(r.toolUseResult||Array.isArray(r.message.content)&&r.message.content[0]?.type===`tool_result`)&&!r.isMeta)n.currentTurn&&n.currentTurn.files.size>0&&(G(n.currentTurn),n.completedTurns.push(n.currentTurn)),n.lastTurnIndex++,n.currentTurn={turnIndex:n.lastTurnIndex,userPromptPreview:he(r),timestamp:r.timestamp,files:new Map,stats:{filesChanged:0,linesAdded:0,linesRemoved:0}};else if(n.currentTurn&&r.toolUseResult){let e=r.toolUseResult;if(pe(e)){let{filePath:t,structuredPatch:r}=e,i=`type`in e&&e.type===`create`,a=n.currentTurn.files.get(t);if(a||(a={filePath:t,hunks:[],isNewFile:i,linesAdded:0,linesRemoved:0},n.currentTurn.files.set(t,a)),i&&r.length===0&&W(e)){let t=e.content.split(`
5
- `),n={oldStart:0,oldLines:0,newStart:1,newLines:t.length,lines:t.map(e=>`+${e}`)};a.hunks.push(n),a.linesAdded+=t.length}else{a.hunks.push(...r);let{added:e,removed:t}=me(r);a.linesAdded+=e,a.linesRemoved+=t}i&&(a.isNewFile=!0)}}}}n.lastProcessedIndex=e.length;let r=[...n.completedTurns];return n.currentTurn&&n.currentTurn.files.size>0&&(G(n.currentTurn),r.push(n.currentTurn)),r.reverse()},[e])}var K,_e=e((()=>{K=t(l(),1)}));function ve({filePath:e,hunks:t,isLargeFile:n,isBinary:r,isTruncated:a,isUntracked:c}){let{columns:l}=u(),{firstLine:d,fileContent:f}=(0,q.useMemo)(()=>{if(!e)return{firstLine:null,fileContent:void 0};let t=w(se(b(),e));return{firstLine:t?.split(`
6
- `)[0]??null,fileContent:t??void 0}},[e]);return c?(0,J.jsxs)(o,{flexDirection:`column`,width:`100%`,children:[(0,J.jsxs)(o,{children:[(0,J.jsx)(s,{bold:!0,children:e}),(0,J.jsx)(s,{dimColor:!0,children:` (untracked)`})]}),(0,J.jsx)(i,{padding:4}),(0,J.jsxs)(o,{flexDirection:`column`,children:[(0,J.jsx)(s,{dimColor:!0,italic:!0,children:`New file not yet staged.`}),(0,J.jsxs)(s,{dimColor:!0,italic:!0,children:["Run `git add ",e,"` to see line counts."]})]})]}):r?(0,J.jsxs)(o,{flexDirection:`column`,width:`100%`,children:[(0,J.jsx)(o,{children:(0,J.jsx)(s,{bold:!0,children:e})}),(0,J.jsx)(i,{padding:4}),(0,J.jsx)(o,{flexDirection:`column`,children:(0,J.jsx)(s,{dimColor:!0,italic:!0,children:`Binary file - cannot display diff`})})]}):n?(0,J.jsxs)(o,{flexDirection:`column`,width:`100%`,children:[(0,J.jsx)(o,{children:(0,J.jsx)(s,{bold:!0,children:e})}),(0,J.jsx)(i,{padding:4}),(0,J.jsx)(o,{flexDirection:`column`,children:(0,J.jsx)(s,{dimColor:!0,italic:!0,children:`Large file - diff exceeds 1 MB limit`})})]}):(0,J.jsxs)(o,{flexDirection:`column`,width:`100%`,children:[(0,J.jsxs)(o,{children:[(0,J.jsx)(s,{bold:!0,children:e}),a&&(0,J.jsx)(s,{dimColor:!0,children:` (truncated)`})]}),(0,J.jsx)(i,{padding:4}),(0,J.jsx)(o,{flexDirection:`column`,children:t.length===0?(0,J.jsx)(s,{dimColor:!0,children:`No diff content`}):t.map((t,n)=>(0,J.jsx)(v,{patch:t,filePath:e,firstLine:d,fileContent:f,dim:!1,width:l-2-2},n))}),a&&(0,J.jsx)(s,{dimColor:!0,italic:!0,children:`… diff truncated (exceeded 400 line limit)`})]})}var q,J,ye=e((()=>{q=t(l(),1),g(),d(),y(),E(),h(),J=p()}));function be({files:e,selectedIndex:t}){let{columns:n}=u(),{startIndex:r,endIndex:i}=(0,Y.useMemo)(()=>{if(e.length===0||e.length<=Z)return{startIndex:0,endIndex:e.length};let n=Math.max(0,t-Math.floor(Z/2)),r=n+Z;return r>e.length&&(r=e.length,n=Math.max(0,r-Z)),{startIndex:n,endIndex:r}},[e.length,t]);if(e.length===0)return(0,X.jsx)(s,{dimColor:!0,children:`No changed files`});let a=e.slice(r,i),c=r>0,l=i<e.length,d=e.length>Z,f=Math.max(20,n-16-3-4);return(0,X.jsxs)(o,{flexDirection:`column`,children:[d&&(0,X.jsx)(s,{dimColor:!0,children:c?` ↑ ${r} more ${k(r,`file`)}`:` `}),a.map((e,n)=>(0,X.jsx)(xe,{file:e,isSelected:r+n===t,maxPathWidth:f},e.path)),d&&(0,X.jsx)(s,{dimColor:!0,children:l?` ↓ ${e.length-i} more ${k(e.length-i,`file`)}`:` `})]})}function xe({file:e,isSelected:t,maxPathWidth:n}){let i=ne(e.path,n),a=`${t?`${r.pointer} `:` `}${i}`;return(0,X.jsxs)(o,{flexDirection:`row`,children:[(0,X.jsx)(s,{bold:t,color:t?`background`:void 0,inverse:t,children:a}),(0,X.jsx)(o,{flexGrow:1}),(0,X.jsx)(Se,{file:e,isSelected:t})]})}function Se({file:e,isSelected:t}){return e.isUntracked?(0,X.jsx)(s,{dimColor:!t,italic:!0,children:`untracked`}):e.isBinary?(0,X.jsx)(s,{dimColor:!t,italic:!0,children:`Binary file`}):e.isLargeFile?(0,X.jsx)(s,{dimColor:!t,italic:!0,children:`Large file modified`}):(0,X.jsxs)(s,{children:[e.linesAdded>0&&(0,X.jsxs)(s,{color:`diffAddedWord`,bold:t,children:[`+`,e.linesAdded]}),e.linesAdded>0&&e.linesRemoved>0&&` `,e.linesRemoved>0&&(0,X.jsxs)(s,{color:`diffRemovedWord`,bold:t,children:[`-`,e.linesRemoved]}),e.isTruncated&&(0,X.jsx)(s,{dimColor:!t,children:` (truncated)`})]})}var Y,X,Z,Ce=e((()=>{n(),Y=t(l(),1),g(),d(),te(),A(),X=p(),Z=5}));function we(e){let t=Array.from(e.files.values()).map(e=>({path:e.filePath,linesAdded:e.linesAdded,linesRemoved:e.linesRemoved,isBinary:!1,isLargeFile:!1,isTruncated:!1,isNewFile:e.isNewFile})).sort((e,t)=>e.path.localeCompare(t.path)),n=new Map;for(let t of e.files.values())n.set(t.filePath,t.hunks);return{stats:{filesCount:e.stats.filesChanged,linesAdded:e.stats.linesAdded,linesRemoved:e.stats.linesRemoved},files:t,hunks:n,loading:!1}}function Te({messages:e,onDone:t}){let n=V(),r=ge(e),[i,l]=(0,Q.useState)(`list`),[u,d]=(0,Q.useState)(0),[p,m]=(0,Q.useState)(0),h=(0,Q.useMemo)(()=>[{type:`current`},...r.map(e=>({type:`turn`,turn:e}))],[r]),g=h[p],_=g?.type===`turn`?g.turn:null,v=(0,Q.useMemo)(()=>_?we(_):n,[_,n]),y=v.files[u],b=(0,Q.useMemo)(()=>y&&v.hunks.get(y.path)||[],[y,v.hunks]);(0,Q.useEffect)(()=>{p>=h.length&&m(Math.max(0,h.length-1))},[h.length,p]);let x=(0,Q.useRef)(p);(0,Q.useEffect)(()=>{x.current!==p&&(d(0),x.current=p)},[p]),re(`diff-dialog`),a({"diff:previousSource":()=>{i===`detail`?l(`list`):i===`list`&&h.length>1&&m(e=>Math.max(0,e-1))},"diff:nextSource":()=>{i===`list`&&h.length>1&&m(e=>Math.min(h.length-1,e+1))},"diff:back":()=>{i===`detail`&&l(`list`)},"diff:viewDetails":()=>{i===`list`&&y&&l(`detail`)},"diff:previousFile":()=>{i===`list`&&d(e=>Math.max(0,e-1))},"diff:nextFile":()=>{i===`list`&&d(e=>Math.min(v.files.length-1,e+1))}},{context:`DiffDialog`});let S=v.stats?(0,$.jsxs)(s,{dimColor:!0,children:[v.stats.filesCount,` `,k(v.stats.filesCount,`file`),` changed`,v.stats.linesAdded>0&&(0,$.jsxs)(s,{color:`diffAddedWord`,children:[` +`,v.stats.linesAdded]}),v.stats.linesRemoved>0&&(0,$.jsxs)(s,{color:`diffRemovedWord`,children:[` -`,v.stats.linesRemoved]})]}):null,C=_?`Turn ${_.turnIndex}`:`Uncommitted changes`,w=_?_.userPromptPreview?`"${_.userPromptPreview}"`:``:`(git diff HEAD)`,T=h.length>1?(0,$.jsxs)(o,{children:[p>0&&(0,$.jsx)(s,{dimColor:!0,children:`◀ `}),h.map((e,t)=>{let n=t===p,r=e.type===`current`?`Current`:`T${e.turn.turnIndex}`;return(0,$.jsxs)(s,{dimColor:!n,bold:n,children:[t>0?` · `:``,r]},t)}),p<h.length-1&&(0,$.jsx)(s,{dimColor:!0,children:` ▶`})]}):null,E=ee(`diff:dismiss`,`DiffDialog`,`esc`),D=v.loading?`Loading diff…`:_?`No file changes in this turn`:v.stats&&v.stats.filesCount>0&&v.files.length===0?`Too many files to display details`:`Working tree is clean`,O=(0,$.jsxs)(s,{children:[C,w&&(0,$.jsxs)(s,{dimColor:!0,children:[` `,w]})]});function A(){i===`detail`?l(`list`):t(`Diff dialog dismissed`,{display:`system`})}return(0,$.jsxs)(f,{title:O,onCancel:A,color:`background`,inputGuide:e=>e.pending?(0,$.jsxs)(s,{children:[`Press `,e.keyName,` again to exit`]}):i===`list`?(0,$.jsxs)(c,{children:[h.length>1&&(0,$.jsx)(s,{children:`←/→ source`}),(0,$.jsx)(s,{children:`↑/↓ select`}),(0,$.jsx)(s,{children:`Enter view`}),(0,$.jsxs)(s,{children:[E,` close`]})]}):(0,$.jsxs)(c,{children:[(0,$.jsx)(s,{children:`← back`}),(0,$.jsxs)(s,{children:[E,` close`]})]}),children:[T,S,v.files.length===0?(0,$.jsx)(o,{marginTop:1,children:(0,$.jsx)(s,{dimColor:!0,children:D})}):i===`list`?(0,$.jsx)(o,{flexDirection:`column`,marginTop:1,children:(0,$.jsx)(be,{files:v.files,selectedIndex:u})}):(0,$.jsx)(o,{flexDirection:`column`,marginTop:1,children:(0,$.jsx)(ve,{filePath:y?.path||``,hunks:b,isLargeFile:y?.isLargeFile,isBinary:y?.isBinary,isTruncated:y?.isTruncated,isUntracked:y?.isUntracked})})]})}var Q,$;e((()=>{Q=t(l(),1),ie(),fe(),_e(),d(),m(),_(),A(),ye(),Ce(),$=p()}))();export{Te as DiffDialog};
@@ -1 +0,0 @@
1
- import{n as e,t}from"./Doctor-uvO6NM5m.js";e();export{t as Doctor};
@@ -1,3 +0,0 @@
1
- import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{i as n,o as r}from"./envUtils-DfkgIdYf.js";import{n as i,t as a}from"./figures-5ThXQEtq.js";import{Gt as o,I as s,P as c,ai as l,t as u,x as d}from"./src-DL3w8VPk.js";import{t as f}from"./jsx-runtime-Bb4Xn-E0.js";import{Pt as p,q as ee}from"./state-BQ4BEGin.js";import{A_ as m,Ah as h,Al as g,Bp as _,Cb as v,DC as y,D_ as b,Dw as x,Ki as S,O_ as C,Ol as w,Ow as T,ax as E,cx as te,eS as ne,ix as re,jw as ie,kC as D,kh as ae,kl as oe,kw as se,ox as ce,qi as O,sx as k,tS as A,w_ as j,zp as M}from"./loadAgentsDir-DGozQu_6.js";import{R as N,V as P,kn as F,wn as I}from"./settings-CodSADx8.js";import{l as L,o as R}from"./stringUtils-Bu_lJH5c.js";import{at as z,f as B,nt as V,s as H}from"./model-DpZaKZMb.js";import{n as U,t as W}from"./ValidationErrorsList-INwwoerV.js";import{n as G,t as le}from"./useExitOnCtrlCDWithKeybindings-DWRFdFoU.js";import{f as ue,g as de,h as fe,i as pe,n as me,o as he,p as ge,r as _e}from"./pidLock-B-SW3Nhx.js";import{n as ve,t as ye}from"./McpParsingWarnings-zkM_lGd0.js";import{n as be,t as xe}from"./PressEnterToContinue-DZc_s_pE.js";import{n as Se,t as Ce}from"./useSettingsErrors-CM7tThcp.js";import{n as we,t as Te}from"./shadowedRuleDetection-CTnYVrmP.js";import{n as Ee,r as De,t as K}from"./statusNoticeHelpers-BfmIub5L.js";import{join as q}from"path";function Oe(){if(!ie())return null;let e=x();if(e.length===0)return null;let t=e.filter(e=>e.severity===`error`),n=e.filter(e=>e.severity===`warning`);return(0,J.jsxs)(s,{flexDirection:`column`,marginTop:1,marginBottom:1,children:[(0,J.jsx)(c,{bold:!0,color:t.length>0?`error`:`warning`,children:`Keybinding Configuration Issues`}),(0,J.jsxs)(s,{children:[(0,J.jsx)(c,{dimColor:!0,children:`Location: `}),(0,J.jsx)(c,{dimColor:!0,children:T()})]}),(0,J.jsxs)(s,{marginLeft:1,flexDirection:`column`,marginTop:1,children:[t.map((e,t)=>(0,J.jsxs)(s,{flexDirection:`column`,children:[(0,J.jsxs)(s,{children:[(0,J.jsx)(c,{dimColor:!0,children:`└ `}),(0,J.jsx)(c,{color:`error`,children:`[Error]`}),(0,J.jsxs)(c,{dimColor:!0,children:[` `,e.message]})]}),e.suggestion&&(0,J.jsx)(s,{marginLeft:3,children:(0,J.jsxs)(c,{dimColor:!0,children:[`→ `,e.suggestion]})})]},`error-${t}`)),n.map((e,t)=>(0,J.jsxs)(s,{flexDirection:`column`,children:[(0,J.jsxs)(s,{children:[(0,J.jsx)(c,{dimColor:!0,children:`└ `}),(0,J.jsx)(c,{color:`warning`,children:`[Warning]`}),(0,J.jsxs)(c,{dimColor:!0,children:[` `,e.message]})]}),e.suggestion&&(0,J.jsx)(s,{marginLeft:3,children:(0,J.jsxs)(c,{dimColor:!0,children:[`→ `,e.suggestion]})})]},`warning-${t}`))]})]})}var J,ke=e((()=>{u(),se(),J=f()}));function Ae(){if(!y.isSupportedPlatform()||!y.isSandboxEnabledInSettings())return null;let e=y.checkDependencies(),t=e.errors.length>0,n=e.warnings.length>0;return!t&&!n?null:(0,Y.jsxs)(s,{flexDirection:`column`,children:[(0,Y.jsx)(c,{bold:!0,children:`Sandbox`}),(0,Y.jsxs)(c,{children:[`└ Status: `,(0,Y.jsx)(c,{color:t?`error`:`warning`,children:t?`Missing dependencies`:`Available (with warnings)`})]}),e.errors.map((e,t)=>(0,Y.jsxs)(c,{color:`error`,children:[`└ `,e]},t)),e.warnings.map((e,t)=>(0,Y.jsxs)(c,{color:`warning`,children:[`└ `,e]},t)),t&&(0,Y.jsx)(c,{dimColor:!0,children:`└ Run /sandbox for install instructions`})]})}var Y,je=e((()=>{u(),D(),Y=f()}));async function Me(){let e=b(await C());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 > ${j.toLocaleString()})`:`${e.length} large AGENTS.md files detected (each > ${j.toLocaleString()} chars)`,details:t,currentValue:e.length,threshold:j}}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 ae(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:y.isSandboxingEnabled()&&y.isAutoAllowBashIfSandboxedEnabled()});if(t.length===0)return null;let n=t.flatMap(e=>[`${P(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((()=>{S(),h(),m(),B(),N(),we(),D(),De(),R(),Z=25e3}));function Le({onDone:e}){let t=_(e=>e.agentDefinitions),r=_(e=>e.mcp.tools),i=_(e=>e.toolPermissionContext),l=_(e=>e.plugins.errors);G();let u=(0,Q.useMemo)(()=>r||[],[r]),[f,p]=(0,Q.useState)(null),[m,h]=(0,Q.useState)(null),[g,v]=(0,Q.useState)(null),[y,b]=(0,Q.useState)(null),x=Se().filter(e=>e.mcpErrorMetadata===void 0),S=(0,Q.useMemo)(()=>[{name:`BASH_MAX_OUTPUT_LENGTH`,default:re,upperLimit:E},{name:`TASK_MAX_OUTPUT_LENGTH`,default:w,upperLimit:oe},{name:`CLAUDE_CODE_MAX_OUTPUT_TOKENS`,...V(`claude-opus-4-7`)}].map(e=>{let t=process.env[e.name],n=te(e.name,t,e.default,e.upperLimit);return{name:e.name,...n}}).filter(e=>e.status!==`valid`),[]);(0,Q.useEffect)(()=>{fe().then(p),(async()=>{let e=q(n(),`agents`),r=q(ee(),`.workmate`,`agents`),{activeAgents:a,allAgents:o,failedFiles:s}=t,[c,l]=await Promise.all([F(e),F(r)]),d={activeAgents:a.map(e=>({agentType:e.agentType,source:e.source})),userAgentsDir:e,projectAgentsDir:r,userDirExists:c,projectDirExists:l,failedFiles:s};h(d);let f=await Fe(u,{activeAgents:a,allAgents:o,failedFiles:s},async()=>i);if(v(f),he()){let e=q(ue(),`claude`,`locks`),t=me(e),n=_e(e);b({enabled:!0,locks:n,locksDir:e,staleLocksCleaned:t})}else b({enabled:!1,locks:[],locksDir:``,staleLocksCleaned:0})})()},[i,u,t]);let C=(0,Q.useCallback)(()=>{e(`Work Mate diagnostics dismissed`,{display:`system`})},[e]);return o({"confirm:yes":C,"confirm:no":C},{context:`Confirmation`}),f?(0,$.jsxs)(d,{children:[(0,$.jsxs)(s,{flexDirection:`column`,children:[(0,$.jsx)(c,{bold:!0,children:`Diagnostics`}),(0,$.jsxs)(c,{children:[`└ Currently running: `,f.installationType,` (`,f.version,`)`]}),f.packageManager&&(0,$.jsxs)(c,{children:[`└ Package manager: `,f.packageManager]}),(0,$.jsxs)(c,{children:[`└ Path: `,f.installationPath]}),(0,$.jsxs)(c,{children:[`└ Invoked: `,f.invokedBinary]}),(0,$.jsxs)(c,{children:[`└ Config install method: `,f.configInstallMethod]}),(0,$.jsxs)(c,{children:[`└ Search: `,f.ripgrepStatus.working?`OK`:`Not working`,` (`,f.ripgrepStatus.mode===`embedded`?`bundled`:f.ripgrepStatus.mode===`builtin`?`vendor`:f.ripgrepStatus.systemPath||`system`,`)`]}),f.ripgrepStatus.note&&(0,$.jsxs)(c,{color:`warning`,children:[`└ Note: `,f.ripgrepStatus.note]}),f.recommendation&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(c,{}),(0,$.jsxs)(c,{color:`warning`,children:[`Recommendation: `,f.recommendation.split(`
2
- `)[0]]}),(0,$.jsx)(c,{dimColor:!0,children:f.recommendation.split(`
3
- `)[1]})]}),f.multipleInstallations.length>1&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(c,{}),(0,$.jsx)(c,{color:`warning`,children:`Warning: Multiple installations found`}),f.multipleInstallations.map((e,t)=>(0,$.jsxs)(c,{children:[`└ `,e.type,` at `,e.path]},t))]}),f.warnings.length>0&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(c,{}),f.warnings.map((e,t)=>(0,$.jsxs)(s,{flexDirection:`column`,children:[(0,$.jsxs)(c,{color:`warning`,children:[`Warning: `,e.issue]}),(0,$.jsxs)(c,{children:[`Fix: `,e.fix]})]},t))]}),x.length>0&&(0,$.jsxs)(s,{flexDirection:`column`,marginTop:1,marginBottom:1,children:[(0,$.jsx)(c,{bold:!0,children:`Invalid Settings`}),(0,$.jsx)(W,{errors:x})]})]}),(0,$.jsx)(Ae,{}),(0,$.jsx)(ye,{}),(0,$.jsx)(Oe,{}),S.length>0&&(0,$.jsxs)(s,{flexDirection:`column`,children:[(0,$.jsx)(c,{bold:!0,children:`Environment Variables`}),S.map((e,t)=>(0,$.jsxs)(c,{children:[`└ `,e.name,`:`,` `,(0,$.jsx)(c,{color:e.status===`capped`?`warning`:`error`,children:e.message})]},t))]}),y?.enabled&&(0,$.jsxs)(s,{flexDirection:`column`,children:[(0,$.jsx)(c,{bold:!0,children:`Version Locks`}),y.staleLocksCleaned>0&&(0,$.jsxs)(c,{dimColor:!0,children:[`└ Cleaned `,y.staleLocksCleaned,` stale lock(s)`]}),y.locks.length===0?(0,$.jsx)(c,{dimColor:!0,children:`└ No active version locks`}):y.locks.map((e,t)=>(0,$.jsxs)(c,{children:[`└ `,e.version,`: PID `,e.pid,` `,e.isProcessRunning?(0,$.jsx)(c,{children:`(running)`}):(0,$.jsx)(c,{color:`warning`,children:`(stale)`})]},t))]}),m?.failedFiles&&m.failedFiles.length>0&&(0,$.jsxs)(s,{flexDirection:`column`,children:[(0,$.jsx)(c,{bold:!0,color:`error`,children:`Agent Parse Errors`}),(0,$.jsxs)(c,{color:`error`,children:[`└ Failed to parse `,m.failedFiles.length,` agent file(s):`]}),m.failedFiles.map((e,t)=>(0,$.jsxs)(c,{dimColor:!0,children:[` `,`└ `,e.path,`: `,e.error]},t))]}),l.length>0&&(0,$.jsxs)(s,{flexDirection:`column`,children:[(0,$.jsx)(c,{bold:!0,color:`error`,children:`Plugin Errors`}),(0,$.jsxs)(c,{color:`error`,children:[`└ `,l.length,` plugin error(s) detected:`]}),l.map((e,t)=>(0,$.jsxs)(c,{dimColor:!0,children:[` `,`└ `,e.source||`unknown`,`plugin`in e&&e.plugin?` [${e.plugin}]`:``,`: `,ne(e)]},t))]}),g?.unreachableRulesWarning&&(0,$.jsxs)(s,{flexDirection:`column`,children:[(0,$.jsx)(c,{bold:!0,color:`warning`,children:`Unreachable Permission Rules`}),(0,$.jsxs)(c,{children:[`└`,` `,(0,$.jsxs)(c,{color:`warning`,children:[a.warning,` `,g.unreachableRulesWarning.message]})]}),g.unreachableRulesWarning.details.map((e,t)=>(0,$.jsxs)(c,{dimColor:!0,children:[` `,`└ `,e]},t))]}),g&&(g.agentsMdWarning||g.agentWarning||g.mcpWarning)&&(0,$.jsxs)(s,{flexDirection:`column`,children:[(0,$.jsx)(c,{bold:!0,children:`Context Usage Warnings`}),g.agentsMdWarning&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(c,{children:[`└`,` `,(0,$.jsxs)(c,{color:`warning`,children:[a.warning,` `,g.agentsMdWarning.message]})]}),(0,$.jsxs)(c,{children:[` `,`└ Files:`]}),g.agentsMdWarning.details.map((e,t)=>(0,$.jsxs)(c,{dimColor:!0,children:[` `,`└ `,e]},t))]}),g.agentWarning&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(c,{children:[`└`,` `,(0,$.jsxs)(c,{color:`warning`,children:[a.warning,` `,g.agentWarning.message]})]}),(0,$.jsxs)(c,{children:[` `,`└ Top contributors:`]}),g.agentWarning.details.map((e,t)=>(0,$.jsxs)(c,{dimColor:!0,children:[` `,`└ `,e]},t))]}),g.mcpWarning&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(c,{children:[`└`,` `,(0,$.jsxs)(c,{color:`warning`,children:[a.warning,` `,g.mcpWarning.message]})]}),(0,$.jsxs)(c,{children:[` `,`└ MCP servers:`]}),g.mcpWarning.details.map((e,t)=>(0,$.jsxs)(c,{dimColor:!0,children:[` `,`└ `,e]},t))]})]}),(0,$.jsx)(s,{children:(0,$.jsx)(xe,{})})]}):(0,$.jsx)(d,{children:(0,$.jsx)(c,{dimColor:!0,children:`Checking installation status…`})})}var Q,$,Re=e((()=>{i(),Q=t(l(),1),ke(),ve(),z(),r(),p(),u(),be(),je(),U(),Ce(),le(),v(),M(),A(),Ie(),de(),k(),I(),pe(),ce(),g(),ge(),$=f()}));export{Re as n,Le as t};
@@ -1 +0,0 @@
1
- import{o as e}from"./rolldown-runtime-DaDcL9Zw.js";import{Vt as t,ai as n,t as r}from"./src-DL3w8VPk.js";import{t as i}from"./jsx-runtime-Bb4Xn-E0.js";import{Aw as a,Mw as o,Nw as s,kw as c}from"./loadAgentsDir-DGozQu_6.js";import{c as l,i as u}from"./debug-CRnGsZOV.js";import{Hn as d,Vn as f}from"./settings-CodSADx8.js";import{l as p,o as m}from"./stringUtils-Bu_lJH5c.js";import{n as h,t as g}from"./notifications-ql0eSo0Y.js";var _=e(n(),1);g(),d(),u(),m(),r(),c();var v=i();function y({children:e}){let{addNotification:n,removeNotification:r}=h();return(0,v.jsx)(t,{loadBindings:o,subscribeToChanges:s,initWatcher:a,onWarnings:(0,_.useCallback)((e,t)=>{let i=`keybinding-config-warning`;if(e.length===0){r(i);return}let a=f(e,e=>e.severity===`error`),o=f(e,e=>e.severity===`warning`),s;s=a>0&&o>0?`Found ${a} keybinding ${p(a,`error`)} and ${o} ${p(o,`warning`)}`:a>0?`Found ${a} keybinding ${p(a,`error`)}`:`Found ${o} keybinding ${p(o,`warning`)}`,s+=` · /doctor for details`,n({key:i,text:s,color:a>0?`error`:`warning`,priority:a>0?`immediate`:`high`,timeoutMs:6e4})},[n,r]),onDebugLog:l,children:e})}export{y as t};
@@ -1 +0,0 @@
1
- import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{ai as n}from"./src-DL3w8VPk.js";import{t as r}from"./jsx-runtime-Bb4Xn-E0.js";import{Pt as i,at as a}from"./state-BQ4BEGin.js";import{$_ as o,Bp as s,Cv as c,Fv as l,Gy as u,Hp as d,Jy as f,Nv as p,Pv as m,Vp as ee,Wy as te,Yy as h,Z_ as g,ay as _,ev as v,gv as y,iv as b,iy as x,ov as S,rv as C,tv as w,uv as ne,zp as T,zv as E}from"./loadAgentsDir-DGozQu_6.js";import{I as D,M as O,c as k,i as A}from"./debug-CRnGsZOV.js";import{rt as j,tt as M}from"./settings-CodSADx8.js";import{c as N,l as P,o as F}from"./log-DoSpAwRP.js";import{n as I}from"./analytics-COpjZpvd.js";import{i as L,n as R,r as z,t as B}from"./reject-CEUkoI2G.js";import{n as V,t as H}from"./notifications-ql0eSo0Y.js";function U(e){let t=`plugin`in e?e.plugin:`no-plugin`;return`${e.type}:${e.source}:${t}`}function W(e,t){t.length!==0&&e(e=>{let n=new Set(e.plugins.errors.map(e=>U(e))),r=t.filter(e=>!n.has(U(e)));return r.length===0?e:{...e,plugins:{...e.plugins,errors:[...e.plugins.errors,...r]}}})}function G(e,t=!1){let n=ee(),r=s(e=>e.mcp.pluginReconnectKey),i=d(),c=(0,q.useRef)(new Map),{addNotification:m}=V(),h=(0,q.useRef)([]),b=(0,q.useRef)(null),x=(0,q.useCallback)(()=>{b.current=null;let e=h.current;e.length!==0&&(h.current=[],i(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=M(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:[...R(n.tools,e=>e.name?.startsWith(l)),...o],f=s===void 0?n.commands:[...R(n.commands,e=>ne(e,a.name)),...s],p=c===void 0?n.resources:{...n.resources,...c.length>0?{[a.name]:c}:L(n.resources,a.name)};n={...n,clients:u,tools:d,commands:f,resources:p}}return{...t,mcp:n}}))},[i]),T=(0,q.useCallback)(e=>{h.current.push(e),b.current===null&&(b.current=setTimeout(x,16))},[x]),D=(0,q.useCallback)(({client:e,tools:t,commands:n,resources:r})=>{switch(T({...e,tools:t,commands:n,resources:r}),e.type){case`connected`:_(e.client,e.name,i),e.client.onclose=()=>{let t=e.config.type??`stdio`;if(g(e.name,e.config).catch(()=>{k(`Failed to invalidate the server cache: ${e.name}`)}),l(e.name)){N(e.name,`Server is disabled, skipping automatic reconnection`);return}if(t!==`stdio`&&t!==`sdk`){let n=K(t);N(e.name,`${n} transport closed/disconnected, attempting automatic reconnection`);let r=c.current.get(e.name);r&&(clearTimeout(r),c.current.delete(e.name)),(async()=>{for(let t=1;t<=J;t++){if(l(e.name)){N(e.name,`Server disabled during reconnection, stopping retry`),c.current.delete(e.name);return}T({...e,type:`pending`,reconnectAttempt:t,maxReconnectAttempts:J});let r=Date.now();try{let i=await S(e.name,e.config),a=Date.now()-r;if(i.client.type===`connected`){N(e.name,`${n} reconnection successful after ${a}ms (attempt ${t})`),c.current.delete(e.name),D(i);return}if(N(e.name,`${n} reconnection attempt ${t} completed with status: ${i.client.type}`),t===J){N(e.name,`Max reconnection attempts (${J}) reached, giving up`),c.current.delete(e.name),D(i);return}}catch(i){let a=Date.now()-r;if(P(e.name,`${n} reconnection attempt ${t} failed after ${a}ms: ${i}`),t===J){N(e.name,`Max reconnection attempts (${J}) reached, giving up`),c.current.delete(e.name),T({...e,type:`failed`});return}}let i=Math.min(Y*2**(t-1),X);N(e.name,`Scheduling reconnection attempt ${t+1} in ${i}ms`),await new Promise(t=>{let n=setTimeout(t,i);c.current.set(e.name,n)})}})()}else T({...e,type:`failed`})},e.capabilities?.tools?.listChanged&&e.client.setNotificationHandler(f,async()=>{N(e.name,`Received tools/list_changed notification, refreshing tools`);try{let t=w.cache.get(e.name);w.cache.delete(e.name);let n=await w(e);n.length,t&&t.then(e=>{e.length},()=>{}),T({...e,tools:n})}catch(t){P(e.name,`Failed to refresh tools after list_changed notification: ${O(t)}`)}}),e.capabilities?.prompts?.listChanged&&e.client.setNotificationHandler(te,async()=>{N(e.name,`Received prompts/list_changed notification, refreshing prompts`);try{o.cache.delete(e.name);let t=await o(e);T({...e,commands:t})}catch(t){P(e.name,`Failed to refresh prompts after list_changed notification: ${O(t)}`)}}),e.capabilities?.resources?.listChanged&&e.client.setNotificationHandler(u,async()=>{N(e.name,`Received resources/list_changed notification, refreshing resources`);try{v.cache.delete(e.name);let t=await v(e);T({...e,resources:t})}catch(t){P(e.name,`Failed to refresh resources after list_changed notification: ${O(t)}`)}});break;case`needs-auth`:case`failed`:case`pending`:case`disabled`:break}},[T]),A=a();return(0,q.useEffect)(()=>{async function n(){let{servers:n,errors:r}=t?{servers:{},errors:[]}:await p(e),a={...n,...e};W(i,r),i(e=>{let{stale:t,...n}=y(e.mcp,a);for(let e of t){let t=c.current.get(e.name);t&&(clearTimeout(t),c.current.delete(e.name)),e.type===`connected`&&(e.client.onclose=void 0,g(e.name,e.config).catch(()=>{}))}let r=new Set(n.clients.map(e=>e.name)),i=Object.entries(a).filter(([e])=>!r.has(e)).map(([e,t])=>({name:e,type:l(e)?`disabled`:`pending`,config:t}));return i.length===0&&t.length===0?e:{...e,mcp:{...e.mcp,...n,clients:[...n.clients,...i]}}})}n().catch(e=>{P(`useManageMCPConnections`,`Failed to initialize servers as pending: ${O(e)}`)})},[t,e,i,A,r]),(0,q.useEffect)(()=>{let n=!1;async function r(){let r=Promise.resolve({}),{servers:a,errors:o}=t?{servers:{},errors:[]}:await p(e,r);if(n)return;W(i,o);let s={...a,...e},c=Object.fromEntries(Object.entries(s).filter(([e])=>!l(e)));C(D,c).catch(e=>{P(`useManageMcpConnections`,`Failed to get MCP resources: ${O(e)}`)});let u={},d={...s,...u},f={enterprise:0,global:0,project:0,user:0,plugin:0,claudeai:0};for(let[e,t]of Object.entries(d))t.scope===`enterprise`?f.enterprise++:t.scope===`user`?f.global++:t.scope===`project`?f.project++:t.scope===`local`?f.user++:t.scope===`dynamic`?f.plugin++:t.scope===`claudeai`&&f.claudeai++;({...f})}return r(),()=>{n=!0}},[t,e,D,i,A,r]),(0,q.useEffect)(()=>{let e=c.current;return()=>{for(let t of e.values())clearTimeout(t);e.clear(),b.current!==null&&(clearTimeout(b.current),b.current=null,x())}},[x]),{reconnectMcpServer:(0,q.useCallback)(async e=>{let t=n.getState().mcp.clients.find(t=>t.name===e);if(!t)throw Error(`MCP server ${e} not found`);let r=c.current.get(e);r&&(clearTimeout(r),c.current.delete(e));let i=await S(e,t.config);return D(i),i},[n,D]),toggleMcpServer:(0,q.useCallback)(async e=>{let t=n.getState().mcp.clients.find(t=>t.name===e);if(!t)throw Error(`MCP server ${e} not found`);if(t.type!==`disabled`){let n=c.current.get(e);n&&(clearTimeout(n),c.current.delete(e)),E(e,!1),t.type===`connected`&&await g(e,t.config),T({name:e,type:`disabled`,config:t.config})}else{E(e,!0),T({name:e,type:`pending`,config:t.config});let n=await S(e,t.config);D(n)}},[n,T,D])}}function K(e){switch(e){case`http`:return`HTTP`;case`ws`:case`ws-ide`:return`WebSocket`;default:return`SSE`}}var q,J,Y,X,re=e((()=>{q=t(n(),1),i(),b(),h(),z(),B(),I(),m(),A(),H(),T(),D(),F(),x(),j(),c(),J=5,Y=1e3,X=3e4}));function ie(){let e=(0,Z.useContext)($);if(!e)throw Error(`useMcpReconnect must be used within MCPConnectionManager`);return e.reconnectMcpServer}function ae(){let e=(0,Z.useContext)($);if(!e)throw Error(`useMcpToggleEnabled must be used within MCPConnectionManager`);return e.toggleMcpServer}function oe({children:e,dynamicMcpConfig:t,isStrictMcpConfig:n}){let{reconnectMcpServer:r,toggleMcpServer:i}=G(t,n),a=(0,Z.useMemo)(()=>({reconnectMcpServer:r,toggleMcpServer:i}),[r,i]);return(0,Q.jsx)($.Provider,{value:a,children:e})}var Z,Q,$,se=e((()=>{Z=t(n(),1),re(),Q=r(),$=(0,Z.createContext)(null)}));export{ae as i,se as n,ie as r,oe as t};
@@ -1 +0,0 @@
1
- import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{n,t as r}from"./figures-5ThXQEtq.js";import{D as i,H as a,I as o,P as s,T as c,ai as l,j as u,t as d,y as f}from"./src-DL3w8VPk.js";import{t as p}from"./jsx-runtime-Bb4Xn-E0.js";import{Bp as m,Cv as h,Hp as g,Pv as _,Z_ as v,_v as y,bv as b,dv as x,hd as S,hv as ee,iv as C,jv as w,md as T,mv as E,yv as D,zp as O}from"./loadAgentsDir-DGozQu_6.js";import{I as k,M as te}from"./debug-CRnGsZOV.js";import{$ as A,et as j,rt as M}from"./settings-CodSADx8.js";import{l as ne,n as re,o as N}from"./stringUtils-Bu_lJH5c.js";import{n as ie}from"./analytics-COpjZpvd.js";import{i as P,n as ae,r as oe}from"./MCPConnectionManager-DkZVxLEj.js";import{n as F,t as I}from"./useExitOnCtrlCDWithKeybindings-DWRFdFoU.js";import{t as L}from"./select-Fq6g2Ejk.js";import{r as R,t as z}from"./Spinner-VjwI7m_g.js";import{t as B}from"./CustomSelect-BvTftqEH.js";function V({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,H.jsxs)(o,{children:[(0,H.jsx)(s,{bold:!0,children:`Capabilities: `}),(0,H.jsx)(s,{color:`text`,children:r.length>0?(0,H.jsx)(c,{children:r}):`none`})]})}var H,U=e((()=>{d(),H=p()}));function W(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 G(e,t){return`Error reconnecting to ${t}: ${e instanceof Error?e.message:String(e)}`}var K=e((()=>{}));function se({server:e,serverToolsCount:t,onViewTools:n,onCancel:l,onComplete:d,borderless:f=!1}){let[p]=a(),h=F(),_=m(e=>e.mcp),b=g(),[S,C]=(0,q.useState)(!1),[w,O]=(0,q.useState)(null),k=oe(),A=P(),j=re(String(e.name)),M=D(_.commands,e.name).length,ne=q.useCallback(async()=>{let t=e.client.type!==`disabled`;try{await A(e.name),e.config.type,l()}catch(n){d?.(`Failed to ${t?`disable`:`enable`} MCP server '${e.name}': ${te(n)}`)}},[e.client.type,e.config.type,e.name,A,l,d]);if(S)return(0,J.jsxs)(o,{flexDirection:`column`,gap:1,padding:1,children:[(0,J.jsxs)(s,{color:`text`,children:[`Connecting to `,(0,J.jsx)(s,{bold:!0,children:e.name}),`…`]}),(0,J.jsxs)(o,{children:[(0,J.jsx)(z,{}),(0,J.jsx)(s,{children:` Establishing connection to MCP server`})]}),(0,J.jsx)(s,{dimColor:!0,children:`This may take a few moments.`})]});let N=[];return e.client.type===`disabled`&&N.push({label:`Enable`,value:`toggle-enabled`}),e.client.type===`connected`&&t>0&&N.push({label:`View tools`,value:`tools`}),e.client.type!==`disabled`&&(e.client.type!==`needs-auth`&&N.push({label:`Reconnect`,value:`reconnectMcpServer`}),N.push({label:`Disable`,value:`toggle-enabled`})),N.length===0&&N.push({label:`Back`,value:`back`}),(0,J.jsxs)(o,{flexDirection:`column`,children:[(0,J.jsxs)(o,{flexDirection:`column`,paddingX:1,borderStyle:f?void 0:`round`,children:[(0,J.jsx)(o,{marginBottom:1,children:(0,J.jsxs)(s,{bold:!0,children:[j,` MCP Server`]})}),(0,J.jsxs)(o,{flexDirection:`column`,gap:0,children:[(0,J.jsxs)(o,{children:[(0,J.jsx)(s,{bold:!0,children:`Status: `}),e.client.type===`disabled`?(0,J.jsxs)(s,{children:[u(`inactive`,p)(r.radioOff),` disabled`]}):e.client.type===`connected`?(0,J.jsxs)(s,{children:[u(`success`,p)(r.tick),` connected`]}):e.client.type===`pending`?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(s,{dimColor:!0,children:r.radioOff}),(0,J.jsx)(s,{children:` connecting…`})]}):e.client.type===`needs-auth`?(0,J.jsxs)(s,{children:[u(`warning`,p)(r.triangleUpOutline),` needs authentication`]}):(0,J.jsxs)(s,{children:[u(`error`,p)(r.cross),` failed`]})]}),(0,J.jsxs)(o,{children:[(0,J.jsx)(s,{bold:!0,children:`URL: `}),(0,J.jsx)(s,{dimColor:!0,children:e.config.url})]}),(0,J.jsxs)(o,{children:[(0,J.jsx)(s,{bold:!0,children:`Config location: `}),(0,J.jsx)(s,{dimColor:!0,children:x(e.scope)})]}),e.client.type===`connected`&&(0,J.jsx)(V,{serverToolsCount:t,serverPromptsCount:M,serverResourcesCount:_.resources[e.name]?.length||0}),e.client.type===`connected`&&t>0&&(0,J.jsxs)(o,{children:[(0,J.jsx)(s,{bold:!0,children:`Tools: `}),(0,J.jsxs)(s,{dimColor:!0,children:[t,` tools`]})]})]}),w&&(0,J.jsx)(o,{marginTop:1,children:(0,J.jsxs)(s,{color:`error`,children:[`Error: `,w]})}),N.length>0&&(0,J.jsx)(o,{marginTop:1,children:(0,J.jsx)(L,{options:N,onChange:async t=>{switch(t){case`tools`:n();break;case`reconnectMcpServer`:C(!0),O(null);try{await v(e.name,{...e.config,scope:e.scope}),b(t=>{let n=t.mcp.clients.map(t=>t.name===e.name?{...t,type:`pending`}:t),r=y(t.mcp.tools,e.name),i=E(t.mcp.commands,e.name),a=ee(t.mcp.resources,e.name);return{...t,mcp:{...t.mcp,clients:n,tools:r,commands:i,resources:a}}});let{message:t}=W(await k(e.name),e.name);d?.(t)}catch(t){d?.(G(t,e.name))}finally{C(!1)}break;case`toggle-enabled`:await ne();break;case`back`:l();break}},onCancel:l})})]}),(0,J.jsx)(o,{marginTop:1,children:(0,J.jsx)(s,{dimColor:!0,italic:!0,children:h.pending?(0,J.jsxs)(J.Fragment,{children:[`Press `,h.keyName,` again to exit`]}):(0,J.jsxs)(c,{children:[(0,J.jsx)(i,{shortcut:`↑↓`,action:`navigate`}),(0,J.jsx)(i,{shortcut:`Enter`,action:`select`}),(0,J.jsx)(T,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]})})})]})}var q,J,ce=e((()=>{n(),q=t(l(),1),ie(),I(),d(),C(),ae(),h(),O(),k(),N(),S(),B(),R(),U(),K(),J=p()}));function le({server:e,serverToolsCount:t,onViewTools:n,onCancel:l,onComplete:d,borderless:f=!1}){let[p]=a(),h=F(),g=m(e=>e.mcp),_=oe(),v=P(),[y,b]=(0,Y.useState)(!1),S=Y.useCallback(async()=>{let t=e.client.type!==`disabled`;try{await v(e.name),l()}catch(n){d(`Failed to ${t?`disable`:`enable`} MCP server '${e.name}': ${te(n)}`)}},[e.client.type,e.name,v,l,d]),ee=re(String(e.name)),C=D(g.commands,e.name).length,E=[];return e.client.type!==`disabled`&&t>0&&E.push({label:`View tools`,value:`tools`}),e.client.type!==`disabled`&&E.push({label:`Reconnect`,value:`reconnectMcpServer`}),E.push({label:e.client.type===`disabled`?`Enable`:`Disable`,value:`toggle-enabled`}),E.length===0&&E.push({label:`Back`,value:`back`}),y?(0,X.jsxs)(o,{flexDirection:`column`,gap:1,padding:1,children:[(0,X.jsxs)(s,{color:`text`,children:[`Reconnecting to `,(0,X.jsx)(s,{bold:!0,children:e.name})]}),(0,X.jsxs)(o,{children:[(0,X.jsx)(z,{}),(0,X.jsx)(s,{children:` Restarting MCP server process`})]}),(0,X.jsx)(s,{dimColor:!0,children:`This may take a few moments.`})]}):(0,X.jsxs)(o,{flexDirection:`column`,children:[(0,X.jsxs)(o,{flexDirection:`column`,paddingX:1,borderStyle:f?void 0:`round`,children:[(0,X.jsx)(o,{marginBottom:1,children:(0,X.jsxs)(s,{bold:!0,children:[ee,` MCP Server`]})}),(0,X.jsxs)(o,{flexDirection:`column`,gap:0,children:[(0,X.jsxs)(o,{children:[(0,X.jsx)(s,{bold:!0,children:`Status: `}),e.client.type===`disabled`?(0,X.jsxs)(s,{children:[u(`inactive`,p)(r.radioOff),` disabled`]}):e.client.type===`connected`?(0,X.jsxs)(s,{children:[u(`success`,p)(r.tick),` connected`]}):e.client.type===`pending`?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(s,{dimColor:!0,children:r.radioOff}),(0,X.jsx)(s,{children:` connecting…`})]}):(0,X.jsxs)(s,{children:[u(`error`,p)(r.cross),` failed`]})]}),(0,X.jsxs)(o,{children:[(0,X.jsx)(s,{bold:!0,children:`Command: `}),(0,X.jsx)(s,{dimColor:!0,children:e.config.command})]}),e.config.args&&e.config.args.length>0&&(0,X.jsxs)(o,{children:[(0,X.jsx)(s,{bold:!0,children:`Args: `}),(0,X.jsx)(s,{dimColor:!0,children:e.config.args.join(` `)})]}),(0,X.jsxs)(o,{children:[(0,X.jsx)(s,{bold:!0,children:`Config location: `}),(0,X.jsx)(s,{dimColor:!0,children:x(w(e.name)?.scope??`dynamic`)})]}),e.client.type===`connected`&&(0,X.jsx)(V,{serverToolsCount:t,serverPromptsCount:C,serverResourcesCount:g.resources[e.name]?.length||0}),e.client.type===`connected`&&t>0&&(0,X.jsxs)(o,{children:[(0,X.jsx)(s,{bold:!0,children:`Tools: `}),(0,X.jsxs)(s,{dimColor:!0,children:[t,` tools`]})]})]}),E.length>0&&(0,X.jsx)(o,{marginTop:1,children:(0,X.jsx)(L,{options:E,onChange:async t=>{if(t===`tools`)n();else if(t===`reconnectMcpServer`){b(!0);try{let{message:t}=W(await _(e.name),e.name);d?.(t)}catch(t){d?.(G(t,e.name))}finally{b(!1)}}else t===`toggle-enabled`?await S():t===`back`&&l()},onCancel:l})})]}),(0,X.jsx)(o,{marginTop:1,children:(0,X.jsx)(s,{dimColor:!0,italic:!0,children:h.pending?(0,X.jsxs)(X.Fragment,{children:[`Press `,h.keyName,` again to exit`]}):(0,X.jsxs)(c,{children:[(0,X.jsx)(i,{shortcut:`↑↓`,action:`navigate`}),(0,X.jsx)(i,{shortcut:`Enter`,action:`select`}),(0,X.jsx)(T,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]})})})]})}var Y,X,ue=e((()=>{n(),Y=t(l(),1),I(),d(),_(),ae(),h(),O(),k(),N(),S(),B(),R(),U(),K(),X=p()}));function de({tool:e,server:t,onBack:n}){let[r,i]=Z.useState(``),a=j(e.name,t.name),c=A(e.userFacingName?e.userFacingName({}):a),l=e.isReadOnly?.({})??!1,u=e.isDestructive?.({})??!1,d=e.isOpenWorld?.({})??!1;return Z.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,Q.jsx)(f,{title:(0,Q.jsxs)(Q.Fragment,{children:[c,l&&(0,Q.jsx)(s,{color:`success`,children:` [read-only]`}),u&&(0,Q.jsx)(s,{color:`error`,children:` [destructive]`}),d&&(0,Q.jsx)(s,{dimColor:!0,children:` [open-world]`})]}),subtitle:t.name,onCancel:n,inputGuide:e=>e.pending?(0,Q.jsxs)(s,{children:[`Press `,e.keyName,` again to exit`]}):(0,Q.jsx)(T,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`}),children:(0,Q.jsxs)(o,{flexDirection:`column`,children:[(0,Q.jsxs)(o,{children:[(0,Q.jsx)(s,{bold:!0,children:`Tool name: `}),(0,Q.jsx)(s,{dimColor:!0,children:a})]}),(0,Q.jsxs)(o,{children:[(0,Q.jsx)(s,{bold:!0,children:`Full name: `}),(0,Q.jsx)(s,{dimColor:!0,children:e.name})]}),r&&(0,Q.jsxs)(o,{flexDirection:`column`,marginTop:1,children:[(0,Q.jsx)(s,{bold:!0,children:`Description:`}),(0,Q.jsx)(s,{wrap:`wrap`,children:r})]}),e.inputJSONSchema?.properties&&Object.keys(e.inputJSONSchema.properties).length>0&&(0,Q.jsxs)(o,{flexDirection:`column`,marginTop:1,children:[(0,Q.jsx)(s,{bold:!0,children:`Parameters:`}),(0,Q.jsx)(o,{marginLeft:2,flexDirection:`column`,children:Object.entries(e.inputJSONSchema.properties).map(([t,n])=>{let r=(e.inputJSONSchema?.required)?.includes(t);return(0,Q.jsxs)(s,{children:[`• `,t,r&&(0,Q.jsx)(s,{dimColor:!0,children:` (required)`}),`:`,` `,(0,Q.jsx)(s,{dimColor:!0,children:typeof n==`object`&&n&&`type`in n?String(n.type):`unknown`}),typeof n==`object`&&n&&`description`in n&&(0,Q.jsxs)(s,{dimColor:!0,children:[` - `,String(n.description)]})]},t)})})]})]})})}var Z,Q,fe=e((()=>{Z=t(l(),1),d(),M(),S(),Q=p()}));function pe({server:e,onSelectTool:t,onBack:n}){let r=m(e=>e.mcp.tools),a=me.useMemo(()=>e.client.type===`connected`?b(r,e.name):[],[e,r]),o=a.map((t,n)=>{let r=j(t.name,e.name),i=A(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,$.jsx)(f,{title:`Tools for ${e.name}`,subtitle:`${a.length} ${ne(a.length,`tool`)}`,onCancel:n,inputGuide:e=>e.pending?(0,$.jsxs)(s,{children:[`Press `,e.keyName,` again to exit`]}):(0,$.jsxs)(c,{children:[(0,$.jsx)(i,{shortcut:`↑↓`,action:`navigate`}),(0,$.jsx)(i,{shortcut:`Enter`,action:`select`}),(0,$.jsx)(T,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]}),children:a.length===0?(0,$.jsx)(s,{dimColor:!0,children:`No tools available`}):(0,$.jsx)(L,{options:o,onChange:e=>{let n=parseInt(e,10),r=a[n];r&&t(r,n)},onCancel:n})})}var me,$,he=e((()=>{me=t(l(),1),d(),M(),h(),O(),N(),S(),B(),$=p()}));export{le as a,ce as c,fe as i,he as n,ue as o,de as r,se as s,pe as t};
@@ -1,3 +0,0 @@
1
- import{n as e,o as t,r as n}from"./rolldown-runtime-DaDcL9Zw.js";import{n as r,t as i}from"./figures-5ThXQEtq.js";import{C as a,Gt as o,I as s,P as c,Wt as l,ai as u,ot as d,t as f}from"./src-DL3w8VPk.js";import{t as p}from"./jsx-runtime-Bb4Xn-E0.js";import{An as m,Pt as h}from"./state-BQ4BEGin.js";import{$o as g,$p as ee,Bp as _,Bu as v,Cb as y,Ji as b,LS as x,Qo as S,Qp as C,Ru as w,_c as T,am as E,b_ as D,dx as O,em as k,fx as A,gc as j,hc as M,iS as N,kb as te,lx as P,mn as ne,nS as F,nn as re,ts as ie,un as I,vS as ae,wa as L,xS as R,x_ as oe,xa as se,yc as z,zp as ce}from"./loadAgentsDir-DGozQu_6.js";import{Hn as le,Vn as B}from"./settings-CodSADx8.js";import{D as V,h as ue,m as H,o as de,q as fe,s as U}from"./log-DoSpAwRP.js";import{n as W}from"./analytics-COpjZpvd.js";import{_ as pe,p as me,y as he}from"./startupProfiler-DF0AjiDf.js";import{E as ge,T as _e,c as ve,d as ye,w as be}from"./sessionTracing-D7rekMdW.js";import{n as xe,t as Se}from"./useExitOnCtrlCDWithKeybindings-DWRFdFoU.js";import{n as Ce,t as we}from"./select-Fq6g2Ejk.js";import{r as Te,t as Ee}from"./Spinner-VjwI7m_g.js";import*as G from"path";import{randomUUID as K}from"crypto";var q=t(u(),1),J=p();f(),h(),fe(),H(),de(),le(),W(),pe(),O(),D(),be(),w(),ve(),T(),M(),ie(),b(),ne();function De(e){let t=e.toLowerCase();return/\b(wtf|wth|ffs|omfg|shit(ty|tiest)?|dumbass|horrible|awful|piss(ed|ing)? off|piece of (shit|crap|junk)|what the (fuck|hell)|fucking? (broken|useless|terrible|awful|horrible)|fuck you|screw (this|you)|so frustrating|this sucks|damn it)\b/.test(t)}function Oe(e){let t=e.toLowerCase().trim();return t===`continue`||/\b(keep going|go on)\b/.test(t)}function ke(e,t,n,r,i,a,o){let s=K();m(s);let c=typeof e==`string`?e:e.find(e=>e.type===`text`)?.text||``;ye(c);let l=typeof e==`string`?e:e.findLast(e=>e.type===`text`)?.text||``;return l&&_e(`user_prompt`,{prompt_length:String(l.length),prompt:ge(l),"prompt.id":s}),De(c),Oe(c),t.length>0?{messages:[R({content:[...typeof e==`string`?e.trim()?[{type:`text`,text:e}]:[]:e,...t],uuid:i,imagePasteIds:n.length>0?n:void 0,permissionMode:a,isMeta:o||void 0}),...r],shouldQuery:!0}:{messages:[R({content:e,uuid:i,permissionMode:a,isMeta:o||void 0}),...r],shouldQuery:!0}}W(),b();async function Ae({input:e,preExpansionInput:t,mode:n,setToolJSX:r,context:i,pastedContents:a,ideSelection:o,messages:s,setUserInputOnProcessing:c,uuid:l,isAlreadyProcessing:u,querySource:d,canUseTool:f,skipSlashCommands:p,bridgeOrigin:m,isMeta:h,skipAttachments:g,autonomy:ee}){let _=typeof e==`string`?e:null,v=_?.startsWith(`/`)&&!p;n===`prompt`&&_!==null&&!h&&!v&&c?.(_),z(`query_process_user_input_base_start`);let y=i.getAppState(),b=await Me(e,n,r,i,a,o,s,l,u,d,f,y.toolPermissionContext.mode,p,m,h,g,t,ee);if(z(`query_process_user_input_base_end`),!b.shouldQuery)return b;z(`query_hooks_start`);let x=N(e)||``;for await(let t of re(x,y.toolPermissionContext.mode,i,i.requestPrompt))if(t.message?.type!==`progress`){if(t.blockingError)return{messages:[ae(`${I(t.blockingError)}\n\nOriginal prompt: ${e}`,`warning`)],shouldQuery:!1,allowedTools:b.allowedTools};if(t.preventContinuation){let e=t.stopReason?`Operation stopped by hook: ${t.stopReason}`:`Operation stopped by hook`;return b.messages.push(R({content:e})),b.shouldQuery=!1,b}if(t.additionalContexts&&t.additionalContexts.length>0&&b.messages.push(S({type:`hook_additional_context`,content:t.additionalContexts.map(je),hookName:`UserPromptSubmit`,toolUseID:`hook-${K()}`,hookEvent:`UserPromptSubmit`})),t.message)switch(t.message.attachment.type){case`hook_success`:if(!t.message.attachment.content)break;b.messages.push({...t.message,attachment:{...t.message.attachment,content:je(t.message.attachment.content)}});break;default:b.messages.push(t.message);break}}return z(`query_hooks_end`),b}var Y=1e4;function je(e){return e.length>Y?`${e.substring(0,Y)}… [output truncated - exceeded ${Y} characters]`:e}async function Me(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,ee,_){let y=null,b=[],x=[],S=e;if(typeof e==`string`)y=e;else if(e.length>0){z(`query_image_processing_start`);let t=[];for(let n of e)if(n.type===`image`){let e=await A(n);if(e.dimensions){let t=P(e.dimensions);t&&x.push(t)}t.push(e.block)}else t.push(n);S=t,z(`query_image_processing_end`);let n=t[t.length-1];n?.type===`text`?(y=n.text,b=t.slice(0,-1)):b=t}if(y===null&&t!==`prompt`)throw Error(`Mode: ${t} requires a string input.`);let C=i?Object.values(i).filter(oe):[],w=C.map(e=>e.id),T=i?await v(i):new Map;z(`query_pasted_image_processing_start`);let E=await Promise.all(C.map(async e=>{let t={type:`image`,source:{type:`base64`,media_type:e.mediaType||`image/png`,data:e.content}};return e.content.length,{resized:await A(t),originalDimensions:e.dimensions,sourcePath:e.sourcePath??T.get(e.id)}})),D=[];for(let{resized:e,originalDimensions:t,sourcePath:n}of E){if(e.dimensions){let t=P(e.dimensions,n);t&&x.push(t)}else if(t){let e=P(t,n);e&&x.push(e)}else n&&x.push(`[Image source: ${n}]`);D.push(e.block)}z(`query_pasted_image_processing_end`);let O=f,k=!h&&y!==null&&(t!==`prompt`||O||!y.startsWith(`/`));z(`query_attachment_loading_start`);let M=k?await j(g(y,r,a??null,[],o,l)):[];if(z(`query_attachment_loading_end`),y!==null&&t===`bash`){let{processBashCommand:e}=await import(`./processBashCommand-BBtnCx-7.js`);return X(await e(y,b,M,r,n),x)}if(y!==null&&!O&&y.startsWith(`/`)){let{processSlashCommand:e}=await import(`./processSlashCommand-jzF0GmLO.js`);return X(await e(y,b,D,M,r,n,s,c,u,_),x)}if(y!==null&&t===`prompt`){let e=y.trim(),t=M.find(e=>e.attachment.type===`agent_mention`);if(t){let n=`@agent-${t.attachment.agentType}`;e.startsWith(n)}}return X(ke(S,D,w,M,s,d,m),x)}function X(e,t){return t.length>0&&e.messages.push(R({content:t.map(e=>({type:`text`,text:e})),isMeta:!0})),e}var Ne=n({MessageSelector:()=>Fe,messagesAfterAreOnlySynthetic:()=>He,selectableUserMessagesFilter:()=>Q});function Pe(e){return e.type===`text`}function Z(e){return e===`summarize`}function Fe({messages:e,onPreRestore:t,onRestoreMessage:n,onRestoreCode:r,onSummarize:u,onClose:d,preselectedMessage:f}){let p=_(e=>e.fileHistory),[m,h]=(0,q.useState)(void 0),g=ee(),v=(0,q.useMemo)(K,[]),y=(0,q.useMemo)(()=>[...e.filter(Q),{...R({content:``}),uuid:v}],[e,v]),[b,x]=(0,q.useState)(y.length-1),S=Math.max(0,Math.min(b-Math.floor($/2),y.length-$)),w=y.length>1,[T,E]=(0,q.useState)(f),[D,O]=(0,q.useState)(void 0);(0,q.useEffect)(()=>{if(!f||!g)return;let e=!1;return k(p,f.uuid).then(t=>{e||O(t)}),()=>{e=!0}},[f,g,p]);let[A,j]=(0,q.useState)(!1),[M,N]=(0,q.useState)(null),[te,P]=(0,q.useState)(`both`),[ne,F]=(0,q.useState)(``);function re(e){let t=e?[{value:`both`,label:`Restore code and conversation`},{value:`conversation`,label:`Restore conversation`},{value:`code`,label:`Restore code`}]:[{value:`conversation`,label:`Restore conversation`}];return t.push({value:`summarize`,label:`Summarize from here`,type:`input`,placeholder:`add context (optional)`,initialValue:``,allowEmptySubmitToCancel:!0,showLabelWithValue:!0,labelValueSeparator:`: `,onChange:F}),t.push({value:`nevermind`,label:`Never mind`}),t}(0,q.useEffect)(()=>{},[]);async function ie(e){t(),j(!0);try{await n(e),j(!1),d()}catch(e){U(e),j(!1),h(`Failed to restore the conversation:\n${e}`)}}async function I(t){let n=e.indexOf(t);if(e.length-1-n,t.type,!e.includes(t)){d();return}if(!g){await ie(t);return}let r=await k(p,t.uuid);E(t),O(r)}async function ae(e){if(!T){h(`Message not found.`);return}if(e===`nevermind`){f?d():E(void 0);return}if(Z(e)){t(),j(!0),N(e),h(void 0);try{let e=ne.trim()||void 0;await u(T,e,`from`),j(!1),N(null),E(void 0),d()}catch(e){U(e),j(!1),N(null),E(void 0),h(`Failed to summarize:\n${e}`)}return}t(),j(!0),h(void 0);let i=null,a=null;if(e===`code`||e===`both`)try{await r(T)}catch(e){i=e,U(i)}if(e===`conversation`||e===`both`)try{await n(T)}catch(e){a=e,U(a)}j(!1),E(void 0),a&&i?h(`Failed to restore the conversation and code:\n${a}\n${i}`):a?h(`Failed to restore the conversation:\n${a}`):i?h(`Failed to restore the code:\n${i}`):d()}let L=xe(),oe=(0,q.useCallback)(()=>{if(T&&!f){E(void 0);return}d()},[d,T,f]),se=(0,q.useCallback)(()=>x(e=>Math.max(0,e-1)),[]),z=(0,q.useCallback)(()=>x(e=>Math.min(y.length-1,e+1)),[y.length]),ce=(0,q.useCallback)(()=>x(0),[]),le=(0,q.useCallback)(()=>x(y.length-1),[y.length]),B=(0,q.useCallback)(()=>{let e=y[b];e&&I(e)},[y,b,I]);l(`confirm:no`,oe,{context:`Confirmation`,isActive:!T}),o({"messageSelector:up":se,"messageSelector:down":z,"messageSelector:top":ce,"messageSelector:bottom":le,"messageSelector:select":B},{context:`MessageSelector`,isActive:!A&&!m&&!T&&w});let[V,ue]=(0,q.useState)({});(0,q.useEffect)(()=>{async function t(){g&&Promise.all(y.map(async(t,n)=>{if(t.uuid!==v){let r=C(p,t.uuid),i=y.at(n+1),a=r?Ve(e,t.uuid,i?.uuid===v?void 0:i?.uuid):void 0;ue(a===void 0?e=>({...e,[n]:void 0}):e=>({...e,[n]:a}))}}))}t()},[y,e,v,p,g]);let H=g&&D?.filesChanged&&D.filesChanged.length>0,de=!m&&!T&&!f&&w;return(0,J.jsxs)(s,{flexDirection:`column`,width:`100%`,children:[(0,J.jsx)(a,{color:`suggestion`}),(0,J.jsxs)(s,{flexDirection:`column`,marginX:1,gap:1,children:[(0,J.jsx)(c,{bold:!0,color:`suggestion`,children:`Rewind`}),m&&(0,J.jsxs)(c,{color:`error`,children:[`Error: `,m]}),!w&&(0,J.jsx)(c,{children:`Nothing to rewind to yet.`}),!m&&T&&w&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(c,{children:[`Confirm you want to restore `,!D&&`the conversation `,`to the point before you sent this message:`]}),(0,J.jsxs)(s,{flexDirection:`column`,paddingLeft:1,borderStyle:`single`,borderRight:!1,borderTop:!1,borderBottom:!1,borderLeft:!0,borderLeftDimColor:!0,children:[(0,J.jsx)(Be,{userMessage:T,color:`text`,isCurrent:!1}),(0,J.jsxs)(c,{dimColor:!0,children:[`(`,me(new Date(T.timestamp)),`)`]})]}),(0,J.jsx)(Le,{selectedRestoreOption:te,canRestoreCode:!!H,diffStatsForRestore:D}),A&&Z(M)?(0,J.jsxs)(s,{flexDirection:`row`,gap:1,children:[(0,J.jsx)(Ee,{}),(0,J.jsx)(c,{children:`Summarizing…`})]}):(0,J.jsx)(we,{isDisabled:A,options:re(!!H),defaultFocusValue:H?`both`:`conversation`,onFocus:e=>P(e),onChange:e=>ae(e),onCancel:()=>f?d():E(void 0)}),H&&(0,J.jsx)(s,{marginBottom:1,children:(0,J.jsxs)(c,{dimColor:!0,children:[i.warning,` Rewinding does not affect files edited manually or via bash.`]})})]}),de&&(0,J.jsxs)(J.Fragment,{children:[g?(0,J.jsx)(c,{children:`Restore the code and/or conversation to the point before…`}):(0,J.jsx)(c,{children:`Restore and fork the conversation to the point before…`}),(0,J.jsx)(s,{width:`100%`,flexDirection:`column`,children:y.slice(S,S+$).map((e,t)=>{let n=S+t,r=n===b,a=e.uuid===v,o=n in V,l=V[n],u=l?.filesChanged?.length;return(0,J.jsxs)(s,{height:g?3:2,overflow:`hidden`,width:`100%`,flexDirection:`row`,children:[(0,J.jsx)(s,{width:2,minWidth:2,children:r?(0,J.jsxs)(c,{color:`permission`,bold:!0,children:[i.pointer,` `]}):(0,J.jsx)(c,{children:` `})}),(0,J.jsxs)(s,{flexDirection:`column`,children:[(0,J.jsx)(s,{flexShrink:1,height:1,overflow:`hidden`,children:(0,J.jsx)(Be,{userMessage:e,color:r?`suggestion`:void 0,isCurrent:a,paddingRight:10})}),g&&o&&(0,J.jsx)(s,{height:1,flexDirection:`row`,children:l?(0,J.jsx)(c,{dimColor:!r,color:`inactive`,children:u?(0,J.jsxs)(J.Fragment,{children:[u===1&&l.filesChanged[0]?`${G.basename(l.filesChanged[0])} `:`${u} files changed `,(0,J.jsx)(ze,{diffStats:l})]}):(0,J.jsx)(J.Fragment,{children:`No code changes`})}):(0,J.jsxs)(c,{dimColor:!0,color:`warning`,children:[i.warning,` No code restore`]})})]})]},e.uuid)})})]}),!T&&(0,J.jsx)(c,{dimColor:!0,italic:!0,children:L.pending?(0,J.jsxs)(J.Fragment,{children:[`Press `,L.keyName,` again to exit`]}):(0,J.jsxs)(J.Fragment,{children:[!m&&w&&`Enter to continue · `,`Esc to exit`]})})]})]})}function Ie(e){switch(e){case`summarize`:return`Messages after this point will be summarized.`;case`both`:case`conversation`:return`The conversation will be forked.`;case`code`:case`nevermind`:return`The conversation will be unchanged.`}}function Le({selectedRestoreOption:e,canRestoreCode:t,diffStatsForRestore:n}){let r=t&&(e===`both`||e===`code`);return(0,J.jsxs)(s,{flexDirection:`column`,children:[(0,J.jsx)(c,{dimColor:!0,children:Ie(e)}),!Z(e)&&(r?(0,J.jsx)(Re,{diffStatsForRestore:n}):(0,J.jsx)(c,{dimColor:!0,children:`The code will be unchanged.`}))]})}function Re({diffStatsForRestore:e}){if(e===void 0)return;if(!e.filesChanged?.[0])return(0,J.jsx)(c,{dimColor:!0,children:`The code has not changed (nothing will be restored).`});let t=e.filesChanged.length,n=``;return n=t===1?G.basename(e.filesChanged[0]||``):t===2?`${G.basename(e.filesChanged[0]||``)} and ${G.basename(e.filesChanged[1]||``)}`:`${G.basename(e.filesChanged[0]||``)} and ${e.filesChanged.length-1} other files`,(0,J.jsxs)(c,{dimColor:!0,children:[`The code will be restored `,(0,J.jsx)(ze,{diffStats:e}),` in `,n,`.`]})}function ze({diffStats:e}){if(e?.filesChanged)return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(c,{color:`diffAddedWord`,children:[`+`,e.insertions,` `]}),(0,J.jsxs)(c,{color:`diffRemovedWord`,children:[`-`,e.deletions]})]})}function Be({userMessage:e,color:t,dimColor:n,isCurrent:r,paddingRight:i}){let{columns:a}=d();if(r)return(0,J.jsx)(s,{width:`100%`,children:(0,J.jsx)(c,{italic:!0,color:t,dimColor:n,children:`(current)`})});let o=e.message.content,l=typeof o==`string`?null:o[o.length-1],u=ue(typeof o==`string`?o.trim():l&&Pe(l)?l.text.trim():`(no prompt)`);if(se(u))return(0,J.jsx)(s,{flexDirection:`row`,width:`100%`,children:(0,J.jsx)(c,{italic:!0,color:t,dimColor:n,children:`((empty message))`})});if(u.includes(`<bash-input>`)){let e=F(u,`bash-input`);if(e)return(0,J.jsxs)(s,{flexDirection:`row`,width:`100%`,children:[(0,J.jsx)(c,{color:`bashBorder`,children:`!`}),(0,J.jsxs)(c,{color:t,dimColor:n,children:[` `,e]})]})}if(u.includes(`<command-message>`)){let e=F(u,V),r=F(u,`command-args`),i=F(u,`skill-format`)===`true`;if(e)return i?(0,J.jsx)(s,{flexDirection:`row`,width:`100%`,children:(0,J.jsxs)(c,{color:t,dimColor:n,children:[`Skill(`,e,`)`]})}):(0,J.jsx)(s,{flexDirection:`row`,width:`100%`,children:(0,J.jsxs)(c,{color:t,dimColor:n,children:[`/`,e,` `,r]})})}return(0,J.jsx)(s,{flexDirection:`row`,width:`100%`,children:(0,J.jsx)(c,{color:t,dimColor:n,children:i?he(u,a-i,!0):u.slice(0,500).split(`
2
- `).slice(0,4).join(`
3
- `)})})}function Ve(e,t,n){let r=e.findIndex(e=>e.uuid===t);if(r===-1)return;let i=n?e.findIndex(e=>e.uuid===n):e.length;i===-1&&(i=e.length);let a=[],o=0,s=0;for(let t=r+1;t<i;t++){let n=e[t];if(!n||!L(n))continue;let r=n.toolUseResult;if(!(!r?.filePath||!r.structuredPatch)){a.includes(r.filePath)||a.push(r.filePath);try{if(`type`in r&&r.type===`create`)o+=r.content.split(/\r?\n/).length;else for(let e of r.structuredPatch){let t=B(e.lines,e=>e.startsWith(`+`)),n=B(e.lines,e=>e.startsWith(`-`));o+=t,s+=n}}catch{}}}return{filesChanged:a,insertions:o,deletions:s}}function Q(e){if(e.type!==`user`||Array.isArray(e.message.content)&&e.message.content[0]?.type===`tool_result`||x(e)||e.isMeta||e.isCompactSummary||e.isVisibleInTranscriptOnly)return!1;let t=e.message.content,n=typeof t==`string`?null:t[t.length-1],r=typeof t==`string`?t.trim():n&&Pe(n)?n.text.trim():``;return!(r.indexOf(`<local-command-stdout>`)!==-1||r.indexOf(`<local-command-stderr>`)!==-1||r.indexOf(`<bash-stdout>`)!==-1||r.indexOf(`<bash-stderr>`)!==-1||r.indexOf(`<task-notification>`)!==-1||r.indexOf(`<tick>`)!==-1)}function He(e,t){for(let n=t+1;n<e.length;n++){let t=e[n];if(t&&!x(t)&&!L(t)&&t.type!==`progress`&&t.type!==`system`&&t.type!==`attachment`&&!(t.type===`user`&&t.isMeta)){if(t.type===`assistant`){let e=t.message.content;if(Array.isArray(e)&&e.some(e=>e.type===`text`&&e.text.trim()||e.type===`tool_use`))return!1;continue}if(t.type===`user`)return!1}}return!0}var $,Ue=e((()=>{r(),W(),ce(),E(),Se(),y(),b(),Ce(),Te(),te(),$=7}));export{Q as a,He as i,Ne as n,Ae as o,Ue as r,Fe as t};