@readmagic/workmate 0.0.26 → 0.0.27

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 (335) hide show
  1. package/dist/chunks/{AddWorkspaceDirectory-mS8iUoWY.js → AddWorkspaceDirectory-DqlPtsVK.js} +1 -1
  2. package/dist/chunks/AgentsMdExternalIncludesDialog-CgSethgo.js +1 -0
  3. package/dist/chunks/{AgentsMdExternalIncludesDialog-BHBkysy0.js → AgentsMdExternalIncludesDialog-rJS5l6yk.js} +1 -1
  4. package/dist/chunks/{App-D--vtCyq.js → App-DzRQpRKr.js} +1 -1
  5. package/dist/chunks/BackgroundTasksDialog-CBhSmdz_.js +2 -0
  6. package/dist/chunks/{BypassPermissionsModeDialog-DyqI98d2.js → BypassPermissionsModeDialog-zz-lnmJt.js} +1 -1
  7. package/dist/chunks/CustomSelect-CYmc4vRh.js +1 -0
  8. package/dist/chunks/{DiffDialog-BQAU2pJx.js → DiffDialog-CTUIAcEE.js} +6 -6
  9. package/dist/chunks/{Doctor-DJOMbSDE.js → Doctor-CLOYkPRR.js} +2 -2
  10. package/dist/chunks/Doctor-CiZNe_qx.js +1 -0
  11. package/dist/chunks/{ExitFlow-xBOnvhiW.js → ExitFlow-CATwJC4c.js} +1 -1
  12. package/dist/chunks/{InvalidConfigDialog-NiuhcaG5.js → InvalidConfigDialog-B-9Z58oD.js} +1 -1
  13. package/dist/chunks/{InvalidSettingsDialog-DrromC1I.js → InvalidSettingsDialog-B4EWjbp7.js} +1 -1
  14. package/dist/chunks/KeybindingProviderSetup-Dzg77_Xn.js +1 -0
  15. package/dist/chunks/MCPConnectionManager-CBY8nqdU.js +1 -0
  16. package/dist/chunks/MCPToolListView-C7HT6rrl.js +1 -0
  17. package/dist/chunks/{McpParsingWarnings-BYG2yqjO.js → McpParsingWarnings-Dj_Fu5o-.js} +1 -1
  18. package/dist/chunks/MessageSelector-Dw_ERK_Z.js +3 -0
  19. package/dist/chunks/Messages-RBfRELKn.js +10 -0
  20. package/dist/chunks/Onboarding-BRSXxc2E.js +1 -0
  21. package/dist/chunks/{PermissionDialog-tEMMa5-a.js → PermissionDialog-DjCRuzSm.js} +1 -1
  22. package/dist/chunks/{PressEnterToContinue-CPOaYnym.js → PressEnterToContinue-DE1RxMX_.js} +1 -1
  23. package/dist/chunks/{PromptInputFooterSuggestions-CwqAsTI2.js → PromptInputFooterSuggestions-ChpyD9B7.js} +1 -1
  24. package/dist/chunks/PromptInputHelpMenu-CrTT8MKE.js +1 -0
  25. package/dist/chunks/{ProviderSetup-J6Ty-Wj8.js → ProviderSetup-BEV95bnz.js} +1 -1
  26. package/dist/chunks/QueryEngine-BBBkZWu2.js +1 -0
  27. package/dist/chunks/REPL-BDnZnm__.js +124 -0
  28. package/dist/chunks/REPL-BHk0vZDf.js +1 -0
  29. package/dist/chunks/{ResumeConversation-Cmsbo5m7.js → ResumeConversation-BuSqBrm1.js} +1 -1
  30. package/dist/chunks/{SearchBox-DQBLKyzJ.js → SearchBox-zA5QwIpO.js} +1 -1
  31. package/dist/chunks/SearchExtraToolsTool-CdWB9sO8.js +1 -0
  32. package/dist/chunks/Settings-DYKmPdbd.js +2 -0
  33. package/dist/chunks/Spinner-DOI8qqZi.js +1 -0
  34. package/dist/chunks/SpinnerGlyph-BR_SiV9L.js +1 -0
  35. package/dist/chunks/{TextInput-BboKIug2.js → TextInput-ZKU-x_FD.js} +7 -7
  36. package/dist/chunks/{ThemePicker-DTpXbEY0.js → ThemePicker-B69oDgXN.js} +1 -1
  37. package/dist/chunks/TrustDialog-BSG8Ibh8.js +1 -0
  38. package/dist/chunks/{ValidationErrorsList-C_gDQfm1.js → ValidationErrorsList-BUYHEft4.js} +1 -1
  39. package/dist/chunks/{_baseEach-DGbaIpJA.js → _baseEach-P0u1zIx6.js} +1 -1
  40. package/dist/chunks/{add-dir-B576wzi9.js → add-dir-C8RmmyQK.js} +1 -1
  41. package/dist/chunks/{agentDisplay-ZuFoBZYu.js → agentDisplay-np7CH47m.js} +1 -1
  42. package/dist/chunks/{agents-Dy4_hDic.js → agents-DRQlR5M1.js} +1 -1
  43. package/dist/chunks/agents-DedoH0Q4.js +101 -0
  44. package/dist/chunks/allErrors-DvcU0w0F.js +1 -0
  45. package/dist/chunks/{appleTerminalBackup-C9kjzdM9.js → appleTerminalBackup-Bemd4RXh.js} +1 -1
  46. package/dist/chunks/backgroundHousekeeping-B56nFTzq.js +1 -0
  47. package/dist/chunks/{backgroundHousekeeping-PyLNnGdw.js → backgroundHousekeeping-BtEJ6TeC.js} +1 -1
  48. package/dist/chunks/banner-CuoceXzz.js +2 -0
  49. package/dist/chunks/branch-ClhlS7f8.js +2 -0
  50. package/dist/chunks/{break-cache-DL95nKZl.js → break-cache-B1nuWtD_.js} +2 -2
  51. package/dist/chunks/{btw-Y44ctueB.js → btw-B-FLxlx-.js} +1 -1
  52. package/dist/chunks/bundledMode-D9omqD3L.js +2 -0
  53. package/dist/chunks/caches-D7arwhaa.js +1 -0
  54. package/dist/chunks/caches-Dn8yrJmL.js +1 -0
  55. package/dist/chunks/{clear-DtTkA707.js → clear-BnWv0i65.js} +1 -1
  56. package/dist/chunks/{client-aJ2Nr_sh.js → client-2w-g5kMx.js} +1 -1
  57. package/dist/chunks/client-B0ngS4Uu.js +1 -0
  58. package/dist/chunks/client-BP4DOH3K.js +1 -0
  59. package/dist/chunks/{client-Bw_L3lSc.js → client-pA7fKk0-.js} +1 -1
  60. package/dist/chunks/commands-AcfFLgl5.js +1 -0
  61. package/dist/chunks/{compact-CvNOtu7J.js → compact-Banc-SNk.js} +1 -1
  62. package/dist/chunks/config-BDn2YIjC.js +3 -0
  63. package/dist/chunks/config-BhBcadjZ.js +1 -0
  64. package/dist/chunks/config-Bm5pVdCq.js +1 -0
  65. package/dist/chunks/{context-Opu4E8dL.js → context-BvDBAyJ9.js} +1 -1
  66. package/dist/chunks/context-noninteractive-BK2IDLSS.js +1 -0
  67. package/dist/chunks/{context-noninteractive-B1V2Mp26.js → context-noninteractive-CuHHniJn.js} +9 -9
  68. package/dist/chunks/conversation-B2dX3X4Z.js +1 -0
  69. package/dist/chunks/{conversation-CG_z7TLE.js → conversation-Cjaftrrw.js} +1 -1
  70. package/dist/chunks/conversationRecovery-NL05oJb1.js +1 -0
  71. package/dist/chunks/crossProjectResume-BzltC4NJ.js +40 -0
  72. package/dist/chunks/{debug-kBjDaVkQ.js → debug-2pVES-2G.js} +1 -1
  73. package/dist/chunks/detectRepository--luIRv5H.js +1 -0
  74. package/dist/chunks/{diff-Cv7tX2-P.js → diff--6gQCx_x.js} +1 -1
  75. package/dist/chunks/directoryCompletion-BC0qRmrz.js +1 -0
  76. package/dist/chunks/doctor-CQf8xPZH.js +1 -0
  77. package/dist/chunks/entry-DWYOrkFS.js +13 -0
  78. package/dist/chunks/{envUtils-DZ_SvEVz.js → envUtils-QyzA_cFM.js} +1 -1
  79. package/dist/chunks/{execFileNoThrow-BfZFnCGa.js → execFileNoThrow-DXSEj8ZO.js} +1 -1
  80. package/dist/chunks/{exit-OKEV_ddw.js → exit-uKtXb5U3.js} +1 -1
  81. package/dist/chunks/{extraUsage-BlRL3yeb.js → extraUsage-Dr0YXm1w.js} +1 -1
  82. package/dist/chunks/extractMemories-8yvMGZ1J.js +1 -0
  83. package/dist/chunks/fast-C5-lNCQi.js +1 -0
  84. package/dist/chunks/fast-aNkj6WvB.js +1 -0
  85. package/dist/chunks/fetchModelList-9w1E4Ue8.js +1 -0
  86. package/dist/chunks/fetchModelList-D2quBF6M.js +1 -0
  87. package/dist/chunks/fileSuggestions-BYD78vcF.js +3 -0
  88. package/dist/chunks/{fpsMetrics-Ixd0J4CH.js → fpsMetrics-DIpm2-xw.js} +1 -1
  89. package/dist/chunks/{gemini-BfVyavwQ.js → gemini-BNBptTET.js} +1 -1
  90. package/dist/chunks/generateSessionName-CO2484aJ.js +1 -0
  91. package/dist/chunks/{genericProcessUtils-CVtQOTO2.js → genericProcessUtils-GqURdVAv.js} +1 -1
  92. package/dist/chunks/{goal-BidR-GFa.js → goal-j0wdadwM.js} +1 -1
  93. package/dist/chunks/{grok-DLcuI-U7.js → grok-BpO1ZwK_.js} +1 -1
  94. package/dist/chunks/{help-CZuvYhXj.js → help-DwhA0qQ6.js} +1 -1
  95. package/dist/chunks/{history-BxPGftQw.js → history-CUrqO9rV.js} +1 -1
  96. package/dist/chunks/hooks-B5Wq-KxE.js +1 -0
  97. package/dist/chunks/{hooks-ehqfAM5F.js → hooks-DG4_WdZ2.js} +2 -2
  98. package/dist/chunks/install-BbmCNCuM.js +1 -0
  99. package/dist/chunks/{instrumentation-B9bfF2mA.js → instrumentation-DpPmDyNF.js} +4 -4
  100. package/dist/chunks/{job-Coztdn6A.js → job-GcmX1ALd.js} +1 -1
  101. package/dist/chunks/{keybindings-DwSdLpaE.js → keybindings-CxgQqQJe.js} +1 -1
  102. package/dist/chunks/{launchLocalMemory-DRzfpIOB.js → launchLocalMemory-CDgT5lst.js} +1 -1
  103. package/dist/chunks/{launchOnboarding-D2zFCJf-.js → launchOnboarding-uQ_ux9sS.js} +1 -1
  104. package/dist/chunks/loadAgentsDir-BBbIAiay.js +1 -0
  105. package/dist/chunks/{loadAgentsDir-DR5PVAc3.js → loadAgentsDir-uuZYOgKn.js} +392 -392
  106. package/dist/chunks/{loadPluginHooks-BiQgGfUJ.js → loadPluginHooks-QoVXsBjy.js} +1 -1
  107. package/dist/chunks/loader-BMAtuwRa.js +1 -0
  108. package/dist/chunks/localSearch-D6MhwvnR.js +1 -0
  109. package/dist/chunks/{localSearch-CzkxDuOR.js → localSearch-yVCDrVrf.js} +1 -1
  110. package/dist/chunks/{log-DWZny1vM.js → log-L1kqxa_P.js} +1 -1
  111. package/dist/chunks/{logoUtils-DR5T0pr3.js → logoUtils-B4wCDKs9.js} +1 -1
  112. package/dist/chunks/{magicDocs-BwBxjfLo.js → magicDocs-D53lV8b5.js} +2 -2
  113. package/dist/chunks/{main-Ryi27wYq.js → main-fy_XSXGj.js} +34 -34
  114. package/dist/chunks/{managedEnv-Do9fgLpk.js → managedEnv-B8YWmM4A.js} +1 -1
  115. package/dist/chunks/managedEnv-ulQBH73B.js +1 -0
  116. package/dist/chunks/{managedEnvConstants-CWcT7nYr.js → managedEnvConstants-BPY8yF1A.js} +1 -1
  117. package/dist/chunks/{mcp-BCpnF6wD.js → mcp--LmEVBRg.js} +1 -1
  118. package/dist/chunks/mcp-CZUVaPb3.js +5 -0
  119. package/dist/chunks/{mcp-CZBTxbhu.js → mcp-DCl-Tz-C.js} +1 -1
  120. package/dist/chunks/memory-Bu5ku7y9.js +1 -0
  121. package/dist/chunks/{modalContext-CBE8xuck.js → modalContext-sU2lfR08.js} +1 -1
  122. package/dist/chunks/{mode-wq70cR44.js → mode-Bteqe2QG.js} +1 -1
  123. package/dist/chunks/{model-DVk9-2dk.js → model-CHDU5yqH.js} +1 -1
  124. package/dist/chunks/model-CcHyMyBv.js +1 -0
  125. package/dist/chunks/modelOptions-CJV1R3Jt.js +1 -0
  126. package/dist/chunks/nativeInstaller-CIUYh1aD.js +1 -0
  127. package/dist/chunks/{notifications-dGBuNvFj.js → notifications-GLnjirCl.js} +1 -1
  128. package/dist/chunks/{observationStore-D0rm3GhP.js → observationStore-pnSSxec_.js} +1 -1
  129. package/dist/chunks/{onChangeAppState-B4K-rSaF.js → onChangeAppState-CxGW2d-l.js} +1 -1
  130. package/dist/chunks/{openai-DAwnAV9K.js → openai-BpGQT2Iv.js} +1 -1
  131. package/dist/chunks/{overlayContext-B6i_6y_0.js → overlayContext-7wgLio1O.js} +1 -1
  132. package/dist/chunks/{panel-C0CF3noE.js → panel-DNiXDhBX.js} +1 -1
  133. package/dist/chunks/{parser-DThLwgdM.js → parser-CTnaXFVJ.js} +1 -1
  134. package/dist/chunks/parser-Diihup2V.js +1 -0
  135. package/dist/chunks/{partition-BRQHofxD.js → partition-djFY9gGI.js} +1 -1
  136. package/dist/chunks/{pasteStore-BmehVo5j.js → pasteStore-njJCBMKr.js} +1 -1
  137. package/dist/chunks/permissions-DNedQyLg.js +3 -0
  138. package/dist/chunks/pidLock-CFUBtZck.js +3 -0
  139. package/dist/chunks/{plan-B6U3ioer.js → plan-DI0n7LIV.js} +1 -1
  140. package/dist/chunks/plugin-BQ8gRVYF.js +17 -0
  141. package/dist/chunks/pluginAutoupdate-CNrHb4RJ.js +1 -0
  142. package/dist/chunks/{pluginBlocklist-DAoUENwc.js → pluginBlocklist-CKCsgWdY.js} +1 -1
  143. package/dist/chunks/{pluginCliCommands-CaHnj0C_.js → pluginCliCommands-CACeyIwz.js} +1 -1
  144. package/dist/chunks/{pluginFlagging-BCj9LJP3.js → pluginFlagging-CUvkKGOB.js} +1 -1
  145. package/dist/chunks/pluginOperations-Ca_T-HYn.js +2 -0
  146. package/dist/chunks/pluginStartupCheck-DftTiXct.js +1 -0
  147. package/dist/chunks/pluginStartupCheck-Du9yx2P8.js +1 -0
  148. package/dist/chunks/{plugins-D7zyI9c4.js → plugins-Divl-P-X.js} +1 -1
  149. package/dist/chunks/{poorMode-Ocff_UT1.js → poorMode-CG2JNTD0.js} +1 -1
  150. package/dist/chunks/poorMode-eMIFCAC_.js +1 -0
  151. package/dist/chunks/print-DSHypGJa.js +13 -0
  152. package/dist/chunks/processBashCommand-BLcFmbyG.js +1 -0
  153. package/dist/chunks/processSlashCommand-Caif46Gi.js +5 -0
  154. package/dist/chunks/{projectContext-QN5U3Ggr.js → projectContext-BFfHgAMh.js} +1 -1
  155. package/dist/chunks/{projectContext-COeHKDrk.js → projectContext-DnJHynXv.js} +1 -1
  156. package/dist/chunks/{projectOnboardingState-KqcpRXls.js → projectOnboardingState-nTCycGCD.js} +1 -1
  157. package/dist/chunks/prompt-BZmu5CeK.js +1 -0
  158. package/dist/chunks/{prompt-CTByhpUI.js → prompt-BfXryFt-.js} +8 -8
  159. package/dist/chunks/prompt-Cogr_WZr.js +1 -0
  160. package/dist/chunks/promptEditor-14TB3MYt.js +4 -0
  161. package/dist/chunks/protocolHandler-VigBkAQQ.js +13 -0
  162. package/dist/chunks/{proxy-BtWuysHM.js → proxy--_NfbJhm.js} +1 -1
  163. package/dist/chunks/reconciler-B9XFdL4f.js +1 -0
  164. package/dist/chunks/{refresh-B4pqFp12.js → refresh-CBHbWTGg.js} +1 -1
  165. package/dist/chunks/reject-CBxnwckZ.js +1 -0
  166. package/dist/chunks/{reload-plugins-DXQqk7q6.js → reload-plugins-5eFWrQlL.js} +1 -1
  167. package/dist/chunks/{rename-D4XBmTBI.js → rename-Cw7cMerG.js} +1 -1
  168. package/dist/chunks/{renderOptions-DkP98P_d.js → renderOptions-B0RFpjRI.js} +1 -1
  169. package/dist/chunks/{resume-DzIev0JI.js → resume-U2D0ybfU.js} +1 -1
  170. package/dist/chunks/ripgrep-67m14ImZ.js +5 -0
  171. package/dist/chunks/ripgrep-DB7KB8RZ.js +1 -0
  172. package/dist/chunks/{runtimeObserver-BPqlbu0B.js → runtimeObserver-CWaYMJG8.js} +2 -2
  173. package/dist/chunks/{runtimeObserver-BUHs3qjs.js → runtimeObserver-DOYlxx9H.js} +1 -1
  174. package/dist/chunks/sandbox-adapter-Df7Wpt77.js +1 -0
  175. package/dist/chunks/sandbox-toggle-BtiPyjT3.js +1 -0
  176. package/dist/chunks/searchExtraTools-CbJVb_Zk.js +1 -0
  177. package/dist/chunks/select-BuTJbu_Q.js +1 -0
  178. package/dist/chunks/sessionFileAccessHooks-_mxyfQmn.js +1 -0
  179. package/dist/chunks/sessionObserver-BZVgzp3W.js +1 -0
  180. package/dist/chunks/{sessionObserver-B6xzxckA.js → sessionObserver-cfwD8pV8.js} +1 -1
  181. package/dist/chunks/sessionStorage-SC5RfnUP.js +1 -0
  182. package/dist/chunks/sessionTracing-DsdcOqvc.js +11 -0
  183. package/dist/chunks/settings-D4M13toi.js +104 -0
  184. package/dist/chunks/settings-Dfit5gGT.js +1 -0
  185. package/dist/chunks/setup-DR-KEmxL.js +3 -0
  186. package/dist/chunks/{shadowedRuleDetection-D6R2OeoH.js → shadowedRuleDetection-DiZUDzxU.js} +1 -1
  187. package/dist/chunks/{sideQuestion-5jcbOMsR.js → sideQuestion-CdgUarC2.js} +1 -1
  188. package/dist/chunks/{sinks-B-kFqjjd.js → sinks-Cy3NqVbk.js} +1 -1
  189. package/dist/chunks/sinks-D41OiGE4.js +1 -0
  190. package/dist/chunks/{skillChangeDetector-103-nEle.js → skillChangeDetector-CVFCJcG7.js} +1 -1
  191. package/dist/chunks/{skillGapStore-DOz1KCqo.js → skillGapStore-BJV8ZIB1.js} +2 -2
  192. package/dist/chunks/{skillLifecycle-D9NkIwFQ.js → skillLifecycle-iO_3s9Ff.js} +2 -2
  193. package/dist/chunks/{skillSearchPanel-DFiSZaJ4.js → skillSearchPanel-BL5gXTHU.js} +2 -2
  194. package/dist/chunks/skills-BEp3_RyT.js +1 -0
  195. package/dist/chunks/sleep-xKMbXTJe.js +1 -0
  196. package/dist/chunks/{src-WZ94ZKI3.js → src-BX54x08P.js} +1 -1
  197. package/dist/chunks/{src-Cy5_qH26.js → src-HB5wLari.js} +1 -1
  198. package/dist/chunks/{startupProfiler-DIM_Ihyp.js → startupProfiler-B9Qv2QGH.js} +1 -1
  199. package/dist/chunks/startupProfiler-DWcM4QBl.js +1 -0
  200. package/dist/chunks/{staticRender-RHUIg5ln.js → staticRender-Bt82RvGc.js} +1 -1
  201. package/dist/chunks/status-6JMz8jmM.js +1 -0
  202. package/dist/chunks/{statusNoticeHelpers-DI45AH-c.js → statusNoticeHelpers-BoloSeXY.js} +1 -1
  203. package/dist/chunks/{stringUtils-D_xPrwGQ.js → stringUtils-Cs6E5f-B.js} +1 -1
  204. package/dist/chunks/switcher-95d4TrQH.js +1 -0
  205. package/dist/chunks/{switcher-DhZCaAun.js → switcher-DSt2cVjA.js} +1 -1
  206. package/dist/chunks/{tasks-6suPhqsK.js → tasks-DyBUXnQb.js} +1 -1
  207. package/dist/chunks/{templateJobs-BKVEWCsb.js → templateJobs-BBnReWWj.js} +7 -7
  208. package/dist/chunks/{terminalSetup-7PUR4hfo.js → terminalSetup-CDpFfqqV.js} +1 -1
  209. package/dist/chunks/{terminalSetup-Cqy5_PhJ.js → terminalSetup-DedaY1P7.js} +4 -4
  210. package/dist/chunks/{theme-B-HG2PUs.js → theme-BZOy9Iqh.js} +1 -1
  211. package/dist/chunks/tipRegistry-Cl5sdLRX.js +2 -0
  212. package/dist/chunks/{toolEventObserver-BY3QVnr6.js → toolEventObserver-ClwWmVbH.js} +1 -1
  213. package/dist/chunks/{toolPool-BcwIF8Q_.js → toolPool-DSTbgGmX.js} +1 -1
  214. package/dist/chunks/{udsClient-CCxgLiZy.js → udsClient-CWeoNrm3.js} +1 -1
  215. package/dist/chunks/{useDoublePress-DQBLKyzJ.js → useDoublePress-zA5QwIpO.js} +1 -1
  216. package/dist/chunks/{useExitOnCtrlCDWithKeybindings-BgJrnuDl.js → useExitOnCtrlCDWithKeybindings-ClN4NJnB.js} +1 -1
  217. package/dist/chunks/useMainLoopModel-Bgxpmn2Q.js +1 -0
  218. package/dist/chunks/useManagePlugins-CxHz-gUP.js +1 -0
  219. package/dist/chunks/useMergedTools-BUuWew0-.js +1 -0
  220. package/dist/chunks/{useSearchInput-BITV_Txn.js → useSearchInput-BIQN_-Hm.js} +1 -1
  221. package/dist/chunks/{useSettingsErrors-CO0fTNzn.js → useSettingsErrors-BDJCLei_.js} +1 -1
  222. package/dist/chunks/util-BHr5l6Bx.js +1 -0
  223. package/dist/chunks/validatePlugin-fx1Y8vam.js +1 -0
  224. package/dist/chunks/{vim-qgMS88ss.js → vim-CYjMtnwH.js} +1 -1
  225. package/dist/chunks/worktree-CGu_58ue.js +1 -0
  226. package/dist/cli.js +1 -1
  227. package/package.json +2 -2
  228. package/dist/chunks/AgentsMdExternalIncludesDialog-DuStmCjj.js +0 -1
  229. package/dist/chunks/BackgroundTasksDialog-mcDuiNGs.js +0 -2
  230. package/dist/chunks/CustomSelect-CpMbxYbt.js +0 -1
  231. package/dist/chunks/Doctor-BU69VQzw.js +0 -1
  232. package/dist/chunks/KeybindingProviderSetup-CSUkJHTT.js +0 -1
  233. package/dist/chunks/MCPConnectionManager-Bn1PDn3R.js +0 -1
  234. package/dist/chunks/MCPToolListView-BRxjOaOL.js +0 -1
  235. package/dist/chunks/MessageSelector-B7xAQqZI.js +0 -3
  236. package/dist/chunks/Messages-CxMsfjOa.js +0 -10
  237. package/dist/chunks/Onboarding-CkATe87e.js +0 -1
  238. package/dist/chunks/PromptInputHelpMenu-krq-hiFO.js +0 -1
  239. package/dist/chunks/QueryEngine-Mdi_kUaL.js +0 -1
  240. package/dist/chunks/REPL-BgzQtSFF.js +0 -1
  241. package/dist/chunks/REPL-rirm6s_7.js +0 -124
  242. package/dist/chunks/SearchExtraToolsTool-D1-7C04z.js +0 -1
  243. package/dist/chunks/SelectMulti-BpAjjhsn.js +0 -1
  244. package/dist/chunks/Settings-B6DImvca.js +0 -2
  245. package/dist/chunks/Spinner-DhhSOFcN.js +0 -1
  246. package/dist/chunks/SpinnerGlyph-CmVXC-_9.js +0 -1
  247. package/dist/chunks/TrustDialog-CZ8JpySm.js +0 -1
  248. package/dist/chunks/agents-HIOBiw4w.js +0 -101
  249. package/dist/chunks/allErrors-CxPNR2WN.js +0 -1
  250. package/dist/chunks/backgroundHousekeeping-ZCMPmQuU.js +0 -1
  251. package/dist/chunks/banner-DqFectPg.js +0 -2
  252. package/dist/chunks/branch-B_BL5N9N.js +0 -2
  253. package/dist/chunks/bundledMode-BxyD5cqq.js +0 -1
  254. package/dist/chunks/caches-5xZ4dSXt.js +0 -1
  255. package/dist/chunks/caches-Be9saXxV.js +0 -1
  256. package/dist/chunks/claudeDesktop-g8eUUY2E.js +0 -1
  257. package/dist/chunks/client-mnUISv_N.js +0 -1
  258. package/dist/chunks/client-wPqIdEVm.js +0 -1
  259. package/dist/chunks/commands-wfE12a4L.js +0 -1
  260. package/dist/chunks/config-D3K87Mm1.js +0 -3
  261. package/dist/chunks/config-DTga6Ku8.js +0 -1
  262. package/dist/chunks/config-DtmqWusU.js +0 -1
  263. package/dist/chunks/context-noninteractive-eIlneYiL.js +0 -1
  264. package/dist/chunks/conversation-CHesBfFZ.js +0 -1
  265. package/dist/chunks/conversationRecovery-OhitW-7g.js +0 -1
  266. package/dist/chunks/crossProjectResume-mmYx8PrZ.js +0 -40
  267. package/dist/chunks/detectRepository-M6K2wc7h.js +0 -1
  268. package/dist/chunks/directoryCompletion-BHyjyKAM.js +0 -1
  269. package/dist/chunks/doctor-DeBG5SL5.js +0 -1
  270. package/dist/chunks/entry-CbhyIWgj.js +0 -13
  271. package/dist/chunks/extractMemories-jnsv-_n_.js +0 -1
  272. package/dist/chunks/fast-4I_qPJCd.js +0 -1
  273. package/dist/chunks/fast-DiolM1M7.js +0 -1
  274. package/dist/chunks/fetchModelList-BRFTQim4.js +0 -1
  275. package/dist/chunks/fetchModelList-qPKAuu4m.js +0 -1
  276. package/dist/chunks/fileSuggestions-iWVXvvLB.js +0 -3
  277. package/dist/chunks/generateSessionName-CGaTTXCA.js +0 -1
  278. package/dist/chunks/hooks-Bg9WIjZQ.js +0 -1
  279. package/dist/chunks/install-ACGY0vhM.js +0 -1
  280. package/dist/chunks/loadAgentsDir-DqAbnpB-.js +0 -1
  281. package/dist/chunks/loader-6MqzNGmV.js +0 -1
  282. package/dist/chunks/localSearch-DW3JT2MA.js +0 -1
  283. package/dist/chunks/managedEnv-DCEJh3z3.js +0 -1
  284. package/dist/chunks/mcp-CJ6SDJEK.js +0 -6
  285. package/dist/chunks/memory-BQO6Y0ak.js +0 -1
  286. package/dist/chunks/model-D42epddJ.js +0 -1
  287. package/dist/chunks/modelOptions-beLgXORr.js +0 -1
  288. package/dist/chunks/nativeInstaller-ChGSz1lb.js +0 -1
  289. package/dist/chunks/parser-BZt0VFd_.js +0 -1
  290. package/dist/chunks/permissions-DkfWKN-B.js +0 -3
  291. package/dist/chunks/pidLock-YvAaIrIY.js +0 -3
  292. package/dist/chunks/platform-Vl9IynC3.js +0 -2
  293. package/dist/chunks/plugin-CTA2_-F7.js +0 -17
  294. package/dist/chunks/pluginAutoupdate-Dy5W3HWE.js +0 -1
  295. package/dist/chunks/pluginOperations-ClXNOOG6.js +0 -2
  296. package/dist/chunks/pluginStartupCheck-CiwMKGjx.js +0 -1
  297. package/dist/chunks/pluginStartupCheck-U8_xk25t.js +0 -1
  298. package/dist/chunks/poorMode-DtzWNhsY.js +0 -1
  299. package/dist/chunks/print-BzljdXem.js +0 -13
  300. package/dist/chunks/processBashCommand-RUkmyAl4.js +0 -1
  301. package/dist/chunks/processSlashCommand-DRLO-jNV.js +0 -5
  302. package/dist/chunks/prompt-DTpfW6yP.js +0 -1
  303. package/dist/chunks/prompt-D__eHY_5.js +0 -1
  304. package/dist/chunks/promptEditor-CpUFgGzc.js +0 -4
  305. package/dist/chunks/protocolHandler-BQSLVGnG.js +0 -13
  306. package/dist/chunks/reconciler-D6BUq8WB.js +0 -1
  307. package/dist/chunks/reject-C6IvUvBt.js +0 -1
  308. package/dist/chunks/ripgrep-CYP26Fhg.js +0 -1
  309. package/dist/chunks/ripgrep-D1f1pbCz.js +0 -5
  310. package/dist/chunks/sandbox-adapter-CumL75tU.js +0 -1
  311. package/dist/chunks/sandbox-toggle-CTtET6Xq.js +0 -1
  312. package/dist/chunks/searchExtraTools-BMCU2zEf.js +0 -1
  313. package/dist/chunks/select-FrwoTzuc.js +0 -1
  314. package/dist/chunks/sessionFileAccessHooks-WO8WTdT9.js +0 -1
  315. package/dist/chunks/sessionObserver-CBrM4opL.js +0 -1
  316. package/dist/chunks/sessionStorage-C1EAxDWG.js +0 -1
  317. package/dist/chunks/sessionTracing-UFK96PxT.js +0 -11
  318. package/dist/chunks/settings-BK6gCko-.js +0 -1
  319. package/dist/chunks/settings-YIDksG5Z.js +0 -24
  320. package/dist/chunks/setup-BBvZyrfz.js +0 -3
  321. package/dist/chunks/sinks-DB_D4lmu.js +0 -1
  322. package/dist/chunks/skills-DgeLr52a.js +0 -1
  323. package/dist/chunks/sleep-BbWr_FL1.js +0 -1
  324. package/dist/chunks/startupProfiler-FpGsKWYk.js +0 -1
  325. package/dist/chunks/status-CKLecQZV.js +0 -1
  326. package/dist/chunks/switcher-D2Z2ZNQ0.js +0 -1
  327. package/dist/chunks/tipRegistry-BR_lSGRw.js +0 -2
  328. package/dist/chunks/types-CD25a50S.js +0 -81
  329. package/dist/chunks/use-select-navigation-CW5alA9r.js +0 -1
  330. package/dist/chunks/useMainLoopModel-BVgJo4hN.js +0 -1
  331. package/dist/chunks/useManagePlugins-CrWjzESW.js +0 -1
  332. package/dist/chunks/useMergedTools-r6GQq5mI.js +0 -1
  333. package/dist/chunks/util-_zo3I1y8.js +0 -1
  334. package/dist/chunks/validatePlugin-DFGdRhA-.js +0 -1
  335. package/dist/chunks/worktree-CR_M6Qfy.js +0 -1
@@ -1 +1 @@
1
- import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{n,t as r}from"./figures-5ThXQEtq.js";import{D as i,I as a,P as o,T as s,Wt as c,ai as l,t as u,vn as d,y as f,yn as p}from"./src-WZ94ZKI3.js";import{t as m}from"./jsx-runtime-Bb4Xn-E0.js";import{F as h,N as g,P as _,hd as v,md as y,tb as b}from"./loadAgentsDir-DR5PVAc3.js";import{n as x,t as S}from"./TextInput-BboKIug2.js";import{n as C,t as w}from"./select-FrwoTzuc.js";import{r as T,t as E}from"./directoryCompletion-BHyjyKAM.js";import{r as D,t as O}from"./PromptInputFooterSuggestions-CwqAsTI2.js";function k(){return(0,P.jsx)(o,{dimColor:!0,children:`Work Mate will be able to read files in this directory and make edits when auto-accept edits is on.`})}function A({path:e}){return(0,P.jsxs)(a,{flexDirection:`column`,paddingX:2,gap:1,children:[(0,P.jsx)(o,{color:`permission`,children:e}),(0,P.jsx)(k,{})]})}function j({value:e,onChange:t,onSubmit:n,error:i,suggestions:s,selectedSuggestion:c}){return(0,P.jsxs)(a,{flexDirection:`column`,children:[(0,P.jsx)(o,{children:`Enter the path to the directory:`}),(0,P.jsx)(a,{borderDimColor:!0,borderStyle:`round`,marginY:1,paddingLeft:1,children:(0,P.jsx)(S,{showCursor:!0,placeholder:`Directory path${r.ellipsis}`,value:e,onChange:t,onSubmit:n,columns:80,cursorOffset:e.length,onChangeCursorOffset:()=>{}})}),s.length>0&&(0,P.jsx)(a,{marginBottom:1,children:(0,P.jsx)(O,{suggestions:s,selectedSuggestion:c})}),i&&(0,P.jsx)(o,{color:`error`,children:i})]})}function M({onAddDirectory:e,onCancel:t,permissionContext:n,directoryPath:r}){let[l,u]=(0,N.useState)(``),[d,m]=(0,N.useState)(null),[_,v]=(0,N.useState)([]),[b,x]=(0,N.useState)(0),S=(0,N.useMemo)(()=>F,[]),C=p((0,N.useCallback)(async e=>{if(!e){v([]),x(0);return}let t=await E(e);v(t),x(0)},[]),100);(0,N.useEffect)(()=>{C(l)},[l,C]);let T=(0,N.useCallback)(e=>{let t=`${e.id}/`;u(t),m(null)},[]),D=(0,N.useCallback)(async t=>{let r=await h(t,n);r.resultType===`success`?e(r.absolutePath,!1):m(g(r))},[n,e]);c(`confirm:no`,t,{context:`Settings`});let O=(0,N.useCallback)(e=>{if(_.length>0){if(e.key===`tab`){e.preventDefault();let t=_[b];t&&T(t);return}if(e.key===`return`){e.preventDefault();let t=_[b];t&&D(`${t.id}/`);return}if(e.key===`up`||e.ctrl&&e.key===`p`){e.preventDefault(),x(e=>e<=0?_.length-1:e-1);return}if(e.key===`down`||e.ctrl&&e.key===`n`){e.preventDefault(),x(e=>e>=_.length-1?0:e+1);return}}},[_,b,T,D]),M=(0,N.useCallback)(n=>{if(r)switch(n){case`yes-session`:e(r,!1);break;case`yes-remember`:e(r,!0);break;case`no`:t();break}},[r,e,t]);return(0,P.jsx)(a,{flexDirection:`column`,tabIndex:0,autoFocus:!0,onKeyDown:O,children:(0,P.jsx)(f,{title:`Add directory to workspace`,onCancel:t,color:`permission`,isCancelActive:!1,inputGuide:r?void 0:e=>e.pending?(0,P.jsxs)(o,{children:[`Press `,e.keyName,` again to exit`]}):(0,P.jsxs)(s,{children:[(0,P.jsx)(i,{shortcut:`Tab`,action:`complete`}),(0,P.jsx)(i,{shortcut:`Enter`,action:`add`}),(0,P.jsx)(y,{action:`confirm:no`,context:`Settings`,fallback:`Esc`,description:`cancel`})]}),children:r?(0,P.jsxs)(a,{flexDirection:`column`,gap:1,children:[(0,P.jsx)(A,{path:r}),(0,P.jsx)(w,{options:S,onChange:M,onCancel:()=>M(`no`)})]}):(0,P.jsxs)(a,{flexDirection:`column`,gap:1,marginX:2,children:[(0,P.jsx)(k,{}),(0,P.jsx)(j,{value:l,onChange:u,onSubmit:D,error:d,suggestions:_,selectedSuggestion:b})]})})})}var N,P,F,I=e((()=>{n(),N=t(l(),1),d(),_(),x(),u(),b(),T(),v(),C(),D(),P=m(),F=[{value:`yes-session`,label:`Yes, for this session`},{value:`yes-remember`,label:`Yes, and remember this directory`},{value:`no`,label:`No`}]}));export{I as n,M as t};
1
+ import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{n,t as r}from"./figures-5ThXQEtq.js";import{D as i,I as a,P as o,T as s,Wt as c,ai as l,t as u,vn as d,y as f,yn as p}from"./src-BX54x08P.js";import{t as m}from"./jsx-runtime-Bb4Xn-E0.js";import{F as h,N as g,P as _,hd as v,md as y,tb as b}from"./loadAgentsDir-uuZYOgKn.js";import{n as x,t as S}from"./TextInput-ZKU-x_FD.js";import{n as C,t as w}from"./select-BuTJbu_Q.js";import{r as T,t as E}from"./directoryCompletion-BC0qRmrz.js";import{r as D,t as O}from"./PromptInputFooterSuggestions-ChpyD9B7.js";function k(){return(0,P.jsx)(o,{dimColor:!0,children:`Work Mate will be able to read files in this directory and make edits when auto-accept edits is on.`})}function A({path:e}){return(0,P.jsxs)(a,{flexDirection:`column`,paddingX:2,gap:1,children:[(0,P.jsx)(o,{color:`permission`,children:e}),(0,P.jsx)(k,{})]})}function j({value:e,onChange:t,onSubmit:n,error:i,suggestions:s,selectedSuggestion:c}){return(0,P.jsxs)(a,{flexDirection:`column`,children:[(0,P.jsx)(o,{children:`Enter the path to the directory:`}),(0,P.jsx)(a,{borderDimColor:!0,borderStyle:`round`,marginY:1,paddingLeft:1,children:(0,P.jsx)(S,{showCursor:!0,placeholder:`Directory path${r.ellipsis}`,value:e,onChange:t,onSubmit:n,columns:80,cursorOffset:e.length,onChangeCursorOffset:()=>{}})}),s.length>0&&(0,P.jsx)(a,{marginBottom:1,children:(0,P.jsx)(O,{suggestions:s,selectedSuggestion:c})}),i&&(0,P.jsx)(o,{color:`error`,children:i})]})}function M({onAddDirectory:e,onCancel:t,permissionContext:n,directoryPath:r}){let[l,u]=(0,N.useState)(``),[d,m]=(0,N.useState)(null),[_,v]=(0,N.useState)([]),[b,x]=(0,N.useState)(0),S=(0,N.useMemo)(()=>F,[]),C=p((0,N.useCallback)(async e=>{if(!e){v([]),x(0);return}let t=await E(e);v(t),x(0)},[]),100);(0,N.useEffect)(()=>{C(l)},[l,C]);let T=(0,N.useCallback)(e=>{let t=`${e.id}/`;u(t),m(null)},[]),D=(0,N.useCallback)(async t=>{let r=await h(t,n);r.resultType===`success`?e(r.absolutePath,!1):m(g(r))},[n,e]);c(`confirm:no`,t,{context:`Settings`});let O=(0,N.useCallback)(e=>{if(_.length>0){if(e.key===`tab`){e.preventDefault();let t=_[b];t&&T(t);return}if(e.key===`return`){e.preventDefault();let t=_[b];t&&D(`${t.id}/`);return}if(e.key===`up`||e.ctrl&&e.key===`p`){e.preventDefault(),x(e=>e<=0?_.length-1:e-1);return}if(e.key===`down`||e.ctrl&&e.key===`n`){e.preventDefault(),x(e=>e>=_.length-1?0:e+1);return}}},[_,b,T,D]),M=(0,N.useCallback)(n=>{if(r)switch(n){case`yes-session`:e(r,!1);break;case`yes-remember`:e(r,!0);break;case`no`:t();break}},[r,e,t]);return(0,P.jsx)(a,{flexDirection:`column`,tabIndex:0,autoFocus:!0,onKeyDown:O,children:(0,P.jsx)(f,{title:`Add directory to workspace`,onCancel:t,color:`permission`,isCancelActive:!1,inputGuide:r?void 0:e=>e.pending?(0,P.jsxs)(o,{children:[`Press `,e.keyName,` again to exit`]}):(0,P.jsxs)(s,{children:[(0,P.jsx)(i,{shortcut:`Tab`,action:`complete`}),(0,P.jsx)(i,{shortcut:`Enter`,action:`add`}),(0,P.jsx)(y,{action:`confirm:no`,context:`Settings`,fallback:`Esc`,description:`cancel`})]}),children:r?(0,P.jsxs)(a,{flexDirection:`column`,gap:1,children:[(0,P.jsx)(A,{path:r}),(0,P.jsx)(w,{options:S,onChange:M,onCancel:()=>M(`no`)})]}):(0,P.jsxs)(a,{flexDirection:`column`,gap:1,marginX:2,children:[(0,P.jsx)(k,{}),(0,P.jsx)(j,{value:l,onChange:u,onSubmit:D,error:d,suggestions:_,selectedSuggestion:b})]})})})}var N,P,F,I=e((()=>{n(),N=t(l(),1),d(),_(),x(),u(),b(),T(),v(),C(),D(),P=m(),F=[{value:`yes-session`,label:`Yes, for this session`},{value:`yes-remember`,label:`Yes, and remember this directory`},{value:`no`,label:`No`}]}));export{I as n,M as t};
@@ -0,0 +1 @@
1
+ import{n as e,t}from"./AgentsMdExternalIncludesDialog-rJS5l6yk.js";e();export{t as AgentsMdExternalIncludesDialog};
@@ -1 +1 @@
1
- import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{I as n,Lt as r,P as i,ai as a,t as o,y as s}from"./src-WZ94ZKI3.js";import{t as c}from"./jsx-runtime-Bb4Xn-E0.js";import{d as l,m as u}from"./config-D3K87Mm1.js";import{n as d}from"./analytics-COpjZpvd.js";import{t as f}from"./select-FrwoTzuc.js";import{t as p}from"./CustomSelect-CpMbxYbt.js";function m({onDone:e,isStandaloneDialog:t,externalIncludes:a}){h.useEffect(()=>{},[]);let o=(0,h.useCallback)(t=>{u(t===`no`?e=>({...e,hasAgentsMdExternalIncludesApproved:!1,hasAgentsMdExternalIncludesWarningShown:!0}):e=>({...e,hasAgentsMdExternalIncludesApproved:!0,hasAgentsMdExternalIncludesWarningShown:!0})),e()},[e]);return(0,g.jsxs)(s,{title:`Allow external AGENTS.md file imports?`,color:`warning`,onCancel:(0,h.useCallback)(()=>{o(`no`)},[o]),hideBorder:!t,hideInputGuide:!t,children:[(0,g.jsx)(i,{children:`This project's AGENTS.md imports files outside the current working directory. Never allow this for third-party repositories.`}),a&&a.length>0&&(0,g.jsxs)(n,{flexDirection:`column`,children:[(0,g.jsx)(i,{dimColor:!0,children:`External imports:`}),a.map((e,t)=>(0,g.jsxs)(i,{dimColor:!0,children:[` `,e.path]},t))]}),(0,g.jsxs)(i,{dimColor:!0,children:[`Important: Only use Work Mate with files you trust. Accessing untrusted files may pose security risks`,` `,(0,g.jsx)(r,{url:`https://code.workmate.com/docs/en/security`}),` `]}),(0,g.jsx)(f,{options:[{label:`Yes, allow external imports`,value:`yes`},{label:`No, disable external imports`,value:`no`}],onChange:e=>o(e)})]})}var h,g,_=e((()=>{h=t(a(),1),d(),o(),l(),p(),g=c()}));export{_ as n,m as t};
1
+ import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{I as n,Lt as r,P as i,ai as a,t as o,y as s}from"./src-BX54x08P.js";import{t as c}from"./jsx-runtime-Bb4Xn-E0.js";import{d as l,m as u}from"./config-BDn2YIjC.js";import{n as d}from"./analytics-COpjZpvd.js";import{t as f}from"./select-BuTJbu_Q.js";import{t as p}from"./CustomSelect-CYmc4vRh.js";function m({onDone:e,isStandaloneDialog:t,externalIncludes:a}){h.useEffect(()=>{},[]);let o=(0,h.useCallback)(t=>{u(t===`no`?e=>({...e,hasAgentsMdExternalIncludesApproved:!1,hasAgentsMdExternalIncludesWarningShown:!0}):e=>({...e,hasAgentsMdExternalIncludesApproved:!0,hasAgentsMdExternalIncludesWarningShown:!0})),e()},[e]);return(0,g.jsxs)(s,{title:`Allow external AGENTS.md file imports?`,color:`warning`,onCancel:(0,h.useCallback)(()=>{o(`no`)},[o]),hideBorder:!t,hideInputGuide:!t,children:[(0,g.jsx)(i,{children:`This project's AGENTS.md imports files outside the current working directory. Never allow this for third-party repositories.`}),a&&a.length>0&&(0,g.jsxs)(n,{flexDirection:`column`,children:[(0,g.jsx)(i,{dimColor:!0,children:`External imports:`}),a.map((e,t)=>(0,g.jsxs)(i,{dimColor:!0,children:[` `,e.path]},t))]}),(0,g.jsxs)(i,{dimColor:!0,children:[`Important: Only use Work Mate with files you trust. Accessing untrusted files may pose security risks`,` `,(0,g.jsx)(r,{url:`https://code.workmate.com/docs/en/security`}),` `]}),(0,g.jsx)(f,{options:[{label:`Yes, allow external imports`,value:`yes`},{label:`No, disable external imports`,value:`no`}],onChange:e=>o(e)})]})}var h,g,_=e((()=>{h=t(a(),1),d(),o(),l(),p(),g=c()}));export{_ as n,m as t};
@@ -1 +1 @@
1
- import{R as e,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{d as a,h as o,o as s}from"./config-D3K87Mm1.js";import{t as c}from"./fpsMetrics-Ixd0J4CH.js";import{n as l,t as u}from"./onChangeAppState-B4K-rSaF.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
+ import{R as e,t}from"./src-BX54x08P.js";import{t as n}from"./jsx-runtime-Bb4Xn-E0.js";import{Lh as r,zh as i}from"./loadAgentsDir-uuZYOgKn.js";import{d as a,h as o,o as s}from"./config-BDn2YIjC.js";import{t as c}from"./fpsMetrics-DIpm2-xw.js";import{n as l,t as u}from"./onChangeAppState-CxGW2d-l.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};
@@ -0,0 +1,2 @@
1
+ import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{n,t as r}from"./figures-5ThXQEtq.js";import{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-BX54x08P.js";import{t as m}from"./jsx-runtime-Bb4Xn-E0.js";import{$n as h,Qn as g,er as _}from"./settings-D4M13toi.js";import{Bh as v,Dc as y,Ec as b,En as x,Gl as S,Hh as ee,Hl as C,Ji as w,Px as T,Ul as E,Wl as te,Xu as D,Yu as ne,_u as O,fg as re,fs as ie,gu as k,hg as A,nb as j,ps as M,rb as ae,sb as N,tb as P,wn as F,zh as oe}from"./loadAgentsDir-uuZYOgKn.js";import{_ as se,f as ce}from"./debug-2pVES-2G.js";import{S as le,_ as I,f as ue,l as de,u as fe,y as L}from"./startupProfiler-B9Qv2QGH.js";import{l as R,o as z}from"./stringUtils-Cs6E5f-B.js";import{_n as pe,gn as me,vn as he}from"./prompt-BfXryFt-.js";import{i as ge,t as _e}from"./overlayContext-7wgLio1O.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),I()}));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(O(t))return n=!0,!1;return n}var we=e((()=>{n(),k()}));function Te({agent:e,onDone:t,onKillAgent:n,onBack:r}){let[u]=o(),d=(0,Ee.useMemo)(()=>b(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=T(e.prompt,`plan`),g=e.prompt.length>300?`${e.prompt.substring(0,297)}…`:e.prompt,_=e.result?.totalTokens??e.progress?.tokenCount,v=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`]}),v!==void 0&&v>0&&(0,U.jsxs)(U.Fragment,{children:[` `,`· `,v,` `,v===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)(ne,{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(),P(),he(),y(),I(),w(),D(),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:[L(e.command,n,!0),` `,(0,K.jsx)(Oe,{shell:e})]});case`local_agent`:return(0,K.jsxs)(c,{children:[L(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:[L(t.workflowName??e.summary??e.description,n,!0),` `,(0,K.jsx)(W,{status:e.status,label:e.status===`running`?`${t.agentCount} ${R(t.agentCount,`agent`)}`:e.status===`completed`?`done`:void 0,suffix:e.status===`completed`&&!e.notified?`, unread`:void 0})]})}case`dream`:{let t=e.filesTouched.length,n=e.phase===`updating`&&t>0?`${t} ${R(t,`file`)}`:`${e.sessionsReviewing} ${R(e.sessionsReviewing,`session`)}`;return(0,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(),I(),z(),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,` `,R(e.sessionsReviewing,`session`),e.filesTouched.length>0&&(0,q.jsxs)(q.Fragment,{children:[` `,`· `,e.filesTouched.length,` `,R(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 `,R(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,` `,R(e.toolUseCount,`tool`),`)`]})]},t))]})]})})})}var q,Ne=e((()=>{H(),f(),P(),z(),q=m()}));async function Pe(e){let t=F(e.id);try{let e=await se(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),N(),f(),P(),I(),ce(),x(),Y=m(),Le=8192}));function ze(e,t){return Object.values(e??{}).filter(O).filter(e=>!(e.type===`local_agent`&&e.id===t))}function Be({onDone:e,toolUseContext:t,initialDetailTaskId:n}){let r=v(e=>e.tasks),o=v(e=>e.foregroundedTaskId),u=ee(),d=ae(`chat:killAgents`,`Chat`,`ctrl+x ctrl+k`),f=r,m=(0,Z.useRef)(!1),[h,y]=(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`}}),[b,x]=(0,Z.useState)(0);ge(`background-tasks-dialog`);let{bashTasks:S,agentTasks:C,workflowTasks:w,dreamTasks:T,allSelectableItems:E}=(0,Z.useMemo)(()=>{let e=Object.values(f??{}).filter(O).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]),D=E[b]??null;a({"confirm:previous":()=>x(e=>Math.max(0,e-1)),"confirm:next":()=>x(e=>Math.min(E.length-1,e+1)),"confirm:yes":()=>{let e=E[b];e&&y({mode:`detail`,itemId:e.id})}},{context:`Confirmation`,isActive:h.mode===`list`});let ne=t=>{if(h.mode!==`list`)return;if(t.key===`left`){t.preventDefault(),e(`Background tasks dialog dismissed`,{display:`system`});return}let n=E[b];n&&t.key===`x`&&(t.preventDefault(),n.type===`local_bash`&&n.status===`running`?k(n.id):n.type===`local_agent`&&n.status===`running`?A(n.id):n.type===`local_workflow`&&n.status===`running`?$(n.id,u):n.type===`dream`&&n.status===`running`&&j(n.id))};async function k(e){await re.kill(e,u)}async function A(e){await ie.kill(e,u)}async function j(e){await te.kill(e,u)}let M=(0,Z.useEffectEvent)(e);(0,Z.useEffect)(()=>{if(h.mode!==`list`){let e=f?.[h.itemId];(!e||e.type!==`local_workflow`&&!O(e))&&(m.current?M(`Background tasks dialog dismissed`,{display:`system`}):y({mode:`list`}))}let e=E.length;b>=e&&e>0&&x(e-1)},[h,f,b,E,M]);let N=()=>{m.current&&E.length<=1?e(`Background tasks dialog dismissed`,{display:`system`}):(m.current=!1,y({mode:`list`}))};if(h.mode!==`list`&&f){let t=f[h.itemId];if(!t)return null;switch(t.type){case`local_bash`:return(0,Q.jsx)(Fe,{shell:t,onDone:e,onKillShell:()=>void k(t.id),onBack:N},`shell-${t.id}`);case`local_agent`:return(0,Q.jsx)(Te,{agent:t,onDone:e,onKillAgent:()=>void A(t.id),onBack:N},`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(),N()):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:N,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:N,onKill:t.status===`running`?()=>void j(t.id):void 0},`dream-${t.id}`)}}let P=g(S,e=>e.status===`running`),F=g(C,e=>e.status===`running`),oe=_([...P>0?[(0,Q.jsxs)(c,{children:[P,` `,P===1?`active shell`:`active shells`]},`shells`)]:[],...F>0?[(0,Q.jsxs)(c,{children:[F,` `,F===1?`active agent`:`active agents`]},`agents`)]:[]],e=>(0,Q.jsx)(c,{children:` · `},`separator-${e}`)),se=[(0,Q.jsx)(i,{shortcut:`↑/↓`,action:`select`},`upDown`),(0,Q.jsx)(i,{shortcut:`Enter`,action:`view`},`enter`),...(D?.type===`local_bash`||D?.type===`local_agent`||D?.type===`local_workflow`||D?.type===`dream`)&&D.status===`running`?[(0,Q.jsx)(i,{shortcut:`x`,action:`stop`},`kill`)]:[],...C.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`)],ce=()=>e(`Background tasks dialog dismissed`,{display:`system`});function le(e){return e.pending?(0,Q.jsxs)(c,{children:[`Press `,e.keyName,` again to exit`]}):(0,Q.jsx)(l,{children:se})}return(0,Q.jsx)(s,{flexDirection:`column`,tabIndex:0,autoFocus:!0,onKeyDown:ne,children:(0,Q.jsx)(p,{title:`Background tasks`,subtitle:oe,onCancel:ce,color:`background`,inputGuide:le,children:E.length===0?(0,Q.jsx)(c,{dimColor:!0,children:`No tasks currently running`}):(0,Q.jsxs)(s,{flexDirection:`column`,children:[S.length>0&&(0,Q.jsxs)(s,{flexDirection:`column`,children:[C.length>0&&(0,Q.jsxs)(c,{dimColor:!0,children:[(0,Q.jsxs)(c,{bold:!0,children:[` `,`Shells`]}),` (`,S.length,`)`]}),(0,Q.jsx)(s,{flexDirection:`column`,children:S.map(e=>(0,Q.jsx)(X,{item:e,isSelected:e.id===D?.id},e.id))})]}),C.length>0&&(0,Q.jsxs)(s,{flexDirection:`column`,marginTop:+(S.length>0),children:[(0,Q.jsxs)(c,{dimColor:!0,children:[(0,Q.jsxs)(c,{bold:!0,children:[` `,`Local agents`]}),` (`,C.length,`)`]}),(0,Q.jsx)(s,{flexDirection:`column`,children:C.map(e=>(0,Q.jsx)(X,{item:e,isSelected:e.id===D?.id},e.id))})]}),w.length>0&&(0,Q.jsxs)(s,{flexDirection:`column`,marginTop:+(S.length>0||C.length>0),children:[(0,Q.jsxs)(c,{dimColor:!0,children:[(0,Q.jsxs)(c,{bold:!0,children:[` `,`Workflows`]}),` (`,w.length,`)`]}),(0,Q.jsx)(s,{flexDirection:`column`,children:w.map(e=>(0,Q.jsx)(X,{item:e,isSelected:e.id===D?.id},e.id))})]}),T.length>0&&(0,Q.jsx)(s,{flexDirection:`column`,marginTop:+(S.length>0||C.length>0||w.length>0),children:(0,Q.jsx)(s,{flexDirection:`column`,children:T.map(e=>(0,Q.jsx)(X,{item:e,isSelected:e.id===D?.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),N(),oe(),S(),M(),A(),k(),h(),_e(),f(),P(),j(),De(),je(),Ne(),Re(),C(),Q=m(),$=E}));export{H as a,Ce as i,He as n,B as o,we as r,Be as t};
@@ -1 +1 @@
1
- import{o as e}from"./rolldown-runtime-DaDcL9Zw.js";import{I as t,Lt as n,P as r,ai as i,kt as a,t as o,y as s}from"./src-WZ94ZKI3.js";import{t as c}from"./jsx-runtime-Bb4Xn-E0.js";import{gi as l,hi as u}from"./loadAgentsDir-DR5PVAc3.js";import{m as d,y as f}from"./settings-YIDksG5Z.js";import{n as p}from"./analytics-COpjZpvd.js";import{t as m}from"./select-FrwoTzuc.js";import{t as h}from"./CustomSelect-CpMbxYbt.js";var g=e(i(),1);p(),o(),l(),d(),h();var _=c();function v({onAccept:e}){let[i,o]=g.useState(null);g.useEffect(()=>{if(i!==null){let e=i,t=setTimeout(()=>u(e));return()=>clearTimeout(t)}},[i]),g.useEffect(()=>{},[]);function c(t){switch(t){case`accept`:f(`userSettings`,{skipDangerousModePermissionPrompt:!0}),e();break;case`decline`:o(1);break}}let l=(0,g.useCallback)(()=>{o(0)},[]);return i===null?(0,_.jsxs)(s,{title:`WARNING: Work Mate running in Bypass Permissions mode`,color:`error`,onCancel:l,children:[(0,_.jsxs)(t,{flexDirection:`column`,gap:1,children:[(0,_.jsxs)(r,{children:[`In Bypass Permissions mode, Work Mate will not ask for your approval before running potentially dangerous commands.`,(0,_.jsx)(a,{}),`This mode should only be used in a sandboxed container/VM that has restricted internet access and can easily be restored if damaged.`]}),(0,_.jsx)(r,{children:`By proceeding, you accept all responsibility for actions taken while running in Bypass Permissions mode.`}),(0,_.jsx)(n,{url:`https://code.workmate.com/docs/en/security`})]}),(0,_.jsx)(m,{options:[{label:`No, exit`,value:`decline`},{label:`Yes, I accept`,value:`accept`}],onChange:e=>c(e)})]}):null}export{v as BypassPermissionsModeDialog};
1
+ import{o as e}from"./rolldown-runtime-DaDcL9Zw.js";import{I as t,Lt as n,P as r,ai as i,kt as a,t as o,y as s}from"./src-BX54x08P.js";import{t as c}from"./jsx-runtime-Bb4Xn-E0.js";import{m as l,y as u}from"./settings-D4M13toi.js";import{gi as d,hi as f}from"./loadAgentsDir-uuZYOgKn.js";import{n as p}from"./analytics-COpjZpvd.js";import{t as m}from"./select-BuTJbu_Q.js";import{t as h}from"./CustomSelect-CYmc4vRh.js";var g=e(i(),1);p(),o(),d(),l(),h();var _=c();function v({onAccept:e}){let[i,o]=g.useState(null);g.useEffect(()=>{if(i!==null){let e=i,t=setTimeout(()=>f(e));return()=>clearTimeout(t)}},[i]),g.useEffect(()=>{},[]);function c(t){switch(t){case`accept`:u(`userSettings`,{skipDangerousModePermissionPrompt:!0}),e();break;case`decline`:o(1);break}}let l=(0,g.useCallback)(()=>{o(0)},[]);return i===null?(0,_.jsxs)(s,{title:`WARNING: Work Mate running in Bypass Permissions mode`,color:`error`,onCancel:l,children:[(0,_.jsxs)(t,{flexDirection:`column`,gap:1,children:[(0,_.jsxs)(r,{children:[`In Bypass Permissions mode, Work Mate will not ask for your approval before running potentially dangerous commands.`,(0,_.jsx)(a,{}),`This mode should only be used in a sandboxed container/VM that has restricted internet access and can easily be restored if damaged.`]}),(0,_.jsx)(r,{children:`By proceeding, you accept all responsibility for actions taken while running in Bypass Permissions mode.`}),(0,_.jsx)(n,{url:`https://code.workmate.com/docs/en/security`})]}),(0,_.jsx)(m,{options:[{label:`No, exit`,value:`decline`},{label:`Yes, I accept`,value:`accept`}],onChange:e=>c(e)})]}):null}export{v as BypassPermissionsModeDialog};
@@ -0,0 +1 @@
1
+ import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{n,t as r}from"./figures-5ThXQEtq.js";import{I as i,P as a,ai as o,hn as s,t as c}from"./src-BX54x08P.js";import{t as l}from"./jsx-runtime-Bb4Xn-E0.js";import{c as u,o as d,s as f}from"./stringUtils-Cs6E5f-B.js";import{a as p,c as m,i as h,n as g,o as _,r as v,s as y}from"./select-BuTJbu_Q.js";import{i as b,t as x}from"./overlayContext-7wgLio1O.js";import{isDeepStrictEqual as S}from"util";function C({isDisabled:e=!1,visibleOptionCount:t=5,options:n,defaultValue:r=[],onChange:i,onCancel:a,onFocus:o,focusValue:c,submitButtonText:l,onSubmit:d,onDownFromLastItem:p,onUpFromFirstItem:m,initialFocusLast:g,hideIndexes:_=!1}){let[v,y]=(0,w.useState)(r),[x,C]=(0,w.useState)(!1),[T,E]=(0,w.useState)(n);n!==T&&!S(n,T)&&(y(r),E(n));let[D,O]=(0,w.useState)(()=>{let e=new Map;return n.forEach(t=>{t.type===`input`&&t.initialValue&&e.set(t.value,t.initialValue)}),e}),k=(0,w.useCallback)(e=>{let t=typeof e==`function`?e(v):e;y(t),i?.(t)},[v,i]),A=h({visibleOptionCount:t,options:n,initialFocusValue:g?n[n.length-1]?.value:void 0,onFocus:o,focusValue:c});b(`multi-select`,void 0);let j=(0,w.useCallback)((e,t)=>{O(n=>{let r=new Map(n);return r.set(e,t),r});let r=n.find(t=>t.value===e);r&&r.type===`input`&&r.onChange(t),k(n=>t?n.includes(e)?n:[...n,e]:n.filter(t=>t!==e))},[n,k]);return s((e,t,r)=>{let i=f(e),o=n.find(e=>e.value===A.focusedValue)?.type===`input`;if(o&&!(t.upArrow||t.downArrow||t.escape||t.tab||t.return||t.ctrl&&(e===`n`||e===`p`||t.return)))return;let s=n[n.length-1]?.value;if(t.tab&&!t.shift){l&&d&&A.focusedValue===s&&!x?C(!0):x||A.focusNextOption();return}if(t.tab&&t.shift){l&&d&&x?(C(!1),A.focusOption(s)):A.focusPreviousOption();return}if(t.downArrow||t.ctrl&&e===`n`||!t.ctrl&&!t.shift&&e===`j`){x&&p?p():l&&d&&A.focusedValue===s&&!x?C(!0):!l&&p&&A.focusedValue===s?p():x||A.focusNextOption();return}if(t.upArrow||t.ctrl&&e===`p`||!t.ctrl&&!t.shift&&e===`k`){l&&d&&x?(C(!1),A.focusOption(s)):m&&A.focusedValue===n[0]?.value?m():A.focusPreviousOption();return}if(t.pageDown){A.focusNextPage();return}if(t.pageUp){A.focusPreviousPage();return}if(t.return||u(e)===` `){if(t.ctrl&&t.return&&o&&d){d(v);return}if(x&&d){d(v);return}if(t.return&&!l&&d){d(v);return}if(A.focusedValue!==void 0){let e=v.includes(A.focusedValue)?v.filter(e=>e!==A.focusedValue):[...v,A.focusedValue];k(e)}return}if(!_&&/^[0-9]+$/.test(i)){let e=parseInt(i,10)-1;if(e>=0&&e<n.length){let t=n[e].value,r=v.includes(t)?v.filter(e=>e!==t):[...v,t];k(r)}return}t.escape&&(a(),r.stopImmediatePropagation())},{isActive:!e}),{...A,selectedValues:v,inputValues:D,isSubmitFocused:x,updateInputValue:j,onCancel:a}}var w,T=e((()=>{w=t(o(),1),x(),c(),d(),v()}));function E({isDisabled:e=!1,visibleOptionCount:t=5,options:n,defaultValue:o=[],onCancel:s,onChange:c,onFocus:l,focusValue:u,submitButtonText:d,onSubmit:f,onDownFromLastItem:m,onUpFromFirstItem:h,initialFocusLast:g,onOpenEditor:_,hideIndexes:v=!1,onImagePaste:b,pastedContents:x,onRemoveImage:S}){let w=C({isDisabled:e,visibleOptionCount:t,options:n,defaultValue:o,onChange:c,onCancel:s,onFocus:l,focusValue:u,submitButtonText:d,onSubmit:f,onDownFromLastItem:m,onUpFromFirstItem:h,initialFocusLast:g,hideIndexes:v}),T=n.length.toString().length;return(0,D.jsxs)(i,{flexDirection:`column`,children:[(0,D.jsx)(i,{flexDirection:`column`,children:w.visibleOptions.map((t,o)=>{let c=!e&&w.focusedValue===t.value&&!w.isSubmitFocused,l=w.selectedValues.includes(t.value),u=t.index===w.visibleFromIndex,d=t.index===w.visibleToIndex-1,f=w.visibleToIndex<n.length,m=w.visibleFromIndex>0,h=w.visibleFromIndex+o+1;if(t.type===`input`){let e=w.inputValues.get(t.value)||``;return(0,D.jsx)(i,{gap:1,children:(0,D.jsx)(p,{option:t,isFocused:c,isSelected:!1,shouldShowDownArrow:f&&d,shouldShowUpArrow:m&&u,maxIndexWidth:T,index:h,inputValue:e,onInputChange:e=>{w.updateInputValue(t.value,e)},onSubmit:()=>{},onExit:()=>{s()},layout:`compact`,onOpenEditor:_,onImagePaste:b,pastedContents:x,onRemoveImage:S,children:(0,D.jsxs)(a,{color:l?`success`:void 0,children:[`[`,l?r.tick:` `,`] `]})})},String(t.value))}return(0,D.jsx)(i,{gap:1,children:(0,D.jsxs)(y,{isFocused:c,isSelected:!1,shouldShowDownArrow:f&&d,shouldShowUpArrow:m&&u,description:t.description,children:[!v&&(0,D.jsx)(a,{dimColor:!0,children:`${h}.`.padEnd(T)}),(0,D.jsxs)(a,{color:l?`success`:void 0,children:[`[`,l?r.tick:` `,`]`]}),(0,D.jsx)(a,{color:c?`suggestion`:void 0,children:t.label})]})},String(t.value))})}),d&&f&&(0,D.jsxs)(i,{marginTop:0,gap:1,children:[w.isSubmitFocused?(0,D.jsx)(a,{color:`suggestion`,children:r.pointer}):(0,D.jsx)(a,{children:` `}),(0,D.jsx)(i,{marginLeft:3,children:(0,D.jsx)(a,{color:w.isSubmitFocused?`suggestion`:void 0,bold:!0,children:d})})]})]})}var D,O=e((()=>{n(),c(),_(),m(),T(),D=l()})),k=e((()=>{O(),g()}));export{E as n,O as r,k as t};
@@ -1,6 +1,6 @@
1
- import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{n,t as r}from"./figures-5ThXQEtq.js";import{C as i,Gt as a,I as o,P as s,T as c,ai as l,ot as u,t as d,y as f}from"./src-WZ94ZKI3.js";import{t as p}from"./jsx-runtime-Bb4Xn-E0.js";import{Sh as m,nb as h,rb as ee,sb as g,tb as _,xh as v}from"./loadAgentsDir-DR5PVAc3.js";import{n as y,t as b}from"./cwd-DrEEb4f5.js";import{Ar as x,Cn as S,Nr as C,Pr as w,kn as T,kr as E}from"./settings-YIDksG5Z.js";import{i as D,t as O}from"./execFileNoThrow-BfZFnCGa.js";import{_ as k,x as te}from"./startupProfiler-DIM_Ihyp.js";import{l as A,o as j}from"./stringUtils-D_xPrwGQ.js";import{i as ne,t as re}from"./overlayContext-B6i_6y_0.js";import{r as ie}from"./detectRepository-M6K2wc7h.js";import{join as ae,resolve as oe}from"path";import{access as M}from"fs/promises";async function se(){if(!await x()||await N())return null;let{stdout:e,code:t}=await O(C(),[`--no-optional-locks`,`diff`,`HEAD`,`--shortstat`],{timeout:F,preserveOutputOnError:!1});if(t===0){let t=de(e);if(t&&t.filesCount>z)return{stats:t,perFileStats:new Map,hunks:new Map}}let{stdout:n,code:r}=await O(C(),[`--no-optional-locks`,`diff`,`HEAD`,`--numstat`],{timeout:F,preserveOutputOnError:!1});if(r!==0)return null;let{stats:i,perFileStats:a}=le(n),o=I-a.size;if(o>0){let e=await 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 x()||await N())return new Map;let{stdout:e,code:t}=await O(C(),[`--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 E(b());return e?(await Promise.all([`MERGE_HEAD`,`REBASE_HEAD`,`CHERRY_PICK_HEAD`,`REVERT_HEAD`].map(t=>M(ae(e,t)).then(()=>!0).catch(()=>!1)))).some(Boolean):!1}async function P(e){let{stdout:t,code:n}=await O(C(),[`--no-optional-locks`,`ls-files`,`--others`,`--exclude-standard`],{timeout:F,preserveOutputOnError:!1});if(n!==0||!t.trim())return null;let r=t.trim().split(`
4
- `).filter(Boolean);if(r.length===0)return null;let i=new Map;for(let t of r.slice(0,e))i.set(t,{added:0,removed:0,isBinary:!1,isUntracked:!0});return i}function de(e){let t=e.match(/(\d+)\s+files?\s+changed(?:,\s+(\d+)\s+insertions?\(\+\))?(?:,\s+(\d+)\s+deletions?\(-\))?/);return t?{filesCount:parseInt(t[1]??`0`,10),linesAdded:parseInt(t[2]??`0`,10),linesRemoved:parseInt(t[3]??`0`,10)}:null}var F,I,L,R,z,B=e((()=>{y(),ie(),D(),S(),w(),F=5e3,I=50,L=1e6,R=400,z=500}));function V(){let[e,t]=(0,H.useState)(null),[n,r]=(0,H.useState)(new Map),[i,a]=(0,H.useState)(!0);return(0,H.useEffect)(()=>{let e=!1;async function n(){try{let[n,i]=await Promise.all([se(),ce()]);e||(t(n),r(i),a(!1))}catch{e||(t(null),r(new Map),a(!1))}}return n(),()=>{e=!0}},[]),(0,H.useMemo)(()=>{if(!e)return{stats:null,files:[],hunks:new Map,loading:i};let{stats:t,perFileStats:r}=e,a=[];for(let[e,t]of r){let r=n.get(e),i=t.isUntracked??!1,o=!t.isBinary&&!i&&!r,s=t.added+t.removed,c=!o&&!t.isBinary&&s>U;a.push({path:e,linesAdded:t.added,linesRemoved:t.removed,isBinary:t.isBinary,isLargeFile:o,isTruncated:c,isUntracked:i})}return a.sort((e,t)=>e.path.localeCompare(t.path)),{stats:t,files:a,hunks:n,loading:!1}},[e,n,i])}var H,U,fe=e((()=>{H=t(l(),1),B(),U=400}));function pe(e){if(!e||typeof e!=`object`)return!1;let t=e,n=typeof t.filePath==`string`,r=Array.isArray(t.structuredPatch)&&t.structuredPatch.length>0,i=t.type===`create`&&typeof t.content==`string`;return n&&(r||i)}function W(e){return`type`in e&&(e.type===`create`||e.type===`update`)}function me(e){let t=0,n=0;for(let r of e)for(let e of r.lines)e.startsWith(`+`)?t++:e.startsWith(`-`)&&n++;return{added:t,removed:n}}function he(e){if(e.type!==`user`)return``;let t=e.message.content,n=typeof t==`string`?t:``;return n.length<=30?n:`${n.slice(0,29)}…`}function G(e){let t=0,n=0;for(let r of e.files.values())t+=r.linesAdded,n+=r.linesRemoved;e.stats={filesChanged:e.files.size,linesAdded:t,linesRemoved:n}}function ge(e){let t=(0,K.useRef)({completedTurns:[],currentTurn:null,lastProcessedIndex:0,lastTurnIndex:0});return(0,K.useMemo)(()=>{let n=t.current;e.length<n.lastProcessedIndex&&(n.completedTurns=[],n.currentTurn=null,n.lastProcessedIndex=0,n.lastTurnIndex=0);for(let t=n.lastProcessedIndex;t<e.length;t++){let r=e[t];if(r?.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=T(oe(b(),e));return{firstLine:t?.split(`
6
- `)[0]??null,fileContent:t??void 0}},[e]);return c?(0,J.jsxs)(o,{flexDirection:`column`,width:`100%`,children:[(0,J.jsxs)(o,{children:[(0,J.jsx)(s,{bold:!0,children:e}),(0,J.jsx)(s,{dimColor:!0,children:` (untracked)`})]}),(0,J.jsx)(i,{padding:4}),(0,J.jsxs)(o,{flexDirection:`column`,children:[(0,J.jsx)(s,{dimColor:!0,italic:!0,children:`New file not yet staged.`}),(0,J.jsxs)(s,{dimColor:!0,italic:!0,children:["Run `git add ",e,"` to see line counts."]})]})]}):r?(0,J.jsxs)(o,{flexDirection:`column`,width:`100%`,children:[(0,J.jsx)(o,{children:(0,J.jsx)(s,{bold:!0,children:e})}),(0,J.jsx)(i,{padding:4}),(0,J.jsx)(o,{flexDirection:`column`,children:(0,J.jsx)(s,{dimColor:!0,italic:!0,children:`Binary file - cannot display diff`})})]}):n?(0,J.jsxs)(o,{flexDirection:`column`,width:`100%`,children:[(0,J.jsx)(o,{children:(0,J.jsx)(s,{bold:!0,children:e})}),(0,J.jsx)(i,{padding:4}),(0,J.jsx)(o,{flexDirection:`column`,children:(0,J.jsx)(s,{dimColor:!0,italic:!0,children:`Large file - diff exceeds 1 MB limit`})})]}):(0,J.jsxs)(o,{flexDirection:`column`,width:`100%`,children:[(0,J.jsxs)(o,{children:[(0,J.jsx)(s,{bold:!0,children:e}),a&&(0,J.jsx)(s,{dimColor:!0,children:` (truncated)`})]}),(0,J.jsx)(i,{padding:4}),(0,J.jsx)(o,{flexDirection:`column`,children:t.length===0?(0,J.jsx)(s,{dimColor:!0,children:`No diff content`}):t.map((t,n)=>(0,J.jsx)(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(),S(),m(),J=p()}));function be({files:e,selectedIndex:t}){let{columns:n}=u(),{startIndex:r,endIndex:i}=(0,Y.useMemo)(()=>{if(e.length===0||e.length<=Z)return{startIndex:0,endIndex:e.length};let n=Math.max(0,t-Math.floor(Z/2)),r=n+Z;return r>e.length&&(r=e.length,n=Math.max(0,r-Z)),{startIndex:n,endIndex:r}},[e.length,t]);if(e.length===0)return(0,X.jsx)(s,{dimColor:!0,children:`No changed files`});let a=e.slice(r,i),c=r>0,l=i<e.length,d=e.length>Z,f=Math.max(20,n-16-3-4);return(0,X.jsxs)(o,{flexDirection:`column`,children:[d&&(0,X.jsx)(s,{dimColor:!0,children:c?` ↑ ${r} more ${A(r,`file`)}`:` `}),a.map((e,n)=>(0,X.jsx)(xe,{file:e,isSelected:r+n===t,maxPathWidth:f},e.path)),d&&(0,X.jsx)(s,{dimColor:!0,children:l?` ↓ ${e.length-i} more ${A(e.length-i,`file`)}`:` `})]})}function xe({file:e,isSelected:t,maxPathWidth:n}){let i=te(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(),k(),j(),X=p(),Z=5}));function we(e){let t=Array.from(e.files.values()).map(e=>({path:e.filePath,linesAdded:e.linesAdded,linesRemoved:e.linesRemoved,isBinary:!1,isLargeFile:!1,isTruncated:!1,isNewFile:e.isNewFile})).sort((e,t)=>e.path.localeCompare(t.path)),n=new Map;for(let t of e.files.values())n.set(t.filePath,t.hunks);return{stats:{filesCount:e.stats.filesChanged,linesAdded:e.stats.linesAdded,linesRemoved:e.stats.linesRemoved},files:t,hunks:n,loading:!1}}function Te({messages:e,onDone:t}){let n=V(),r=ge(e),[i,l]=(0,Q.useState)(`list`),[u,d]=(0,Q.useState)(0),[p,m]=(0,Q.useState)(0),h=(0,Q.useMemo)(()=>[{type:`current`},...r.map(e=>({type:`turn`,turn:e}))],[r]),g=h[p],_=g?.type===`turn`?g.turn:null,v=(0,Q.useMemo)(()=>_?we(_):n,[_,n]),y=v.files[u],b=(0,Q.useMemo)(()=>y&&v.hunks.get(y.path)||[],[y,v.hunks]);(0,Q.useEffect)(()=>{p>=h.length&&m(Math.max(0,h.length-1))},[h.length,p]);let x=(0,Q.useRef)(p);(0,Q.useEffect)(()=>{x.current!==p&&(d(0),x.current=p)},[p]),ne(`diff-dialog`),a({"diff:previousSource":()=>{i===`detail`?l(`list`):i===`list`&&h.length>1&&m(e=>Math.max(0,e-1))},"diff:nextSource":()=>{i===`list`&&h.length>1&&m(e=>Math.min(h.length-1,e+1))},"diff:back":()=>{i===`detail`&&l(`list`)},"diff:viewDetails":()=>{i===`list`&&y&&l(`detail`)},"diff:previousFile":()=>{i===`list`&&d(e=>Math.max(0,e-1))},"diff:nextFile":()=>{i===`list`&&d(e=>Math.min(v.files.length-1,e+1))}},{context:`DiffDialog`});let S=v.stats?(0,$.jsxs)(s,{dimColor:!0,children:[v.stats.filesCount,` `,A(v.stats.filesCount,`file`),` changed`,v.stats.linesAdded>0&&(0,$.jsxs)(s,{color:`diffAddedWord`,children:[` +`,v.stats.linesAdded]}),v.stats.linesRemoved>0&&(0,$.jsxs)(s,{color:`diffRemovedWord`,children:[` -`,v.stats.linesRemoved]})]}):null,C=_?`Turn ${_.turnIndex}`:`Uncommitted changes`,w=_?_.userPromptPreview?`"${_.userPromptPreview}"`:``:`(git diff HEAD)`,T=h.length>1?(0,$.jsxs)(o,{children:[p>0&&(0,$.jsx)(s,{dimColor:!0,children:`◀ `}),h.map((e,t)=>{let n=t===p,r=e.type===`current`?`Current`:`T${e.turn.turnIndex}`;return(0,$.jsxs)(s,{dimColor:!n,bold:n,children:[t>0?` · `:``,r]},t)}),p<h.length-1&&(0,$.jsx)(s,{dimColor:!0,children:` ▶`})]}):null,E=ee(`diff:dismiss`,`DiffDialog`,`esc`),D=v.loading?`Loading diff…`:_?`No file changes in this turn`:v.stats&&v.stats.filesCount>0&&v.files.length===0?`Too many files to display details`:`Working tree is clean`,O=(0,$.jsxs)(s,{children:[C,w&&(0,$.jsxs)(s,{dimColor:!0,children:[` `,w]})]});function k(){i===`detail`?l(`list`):t(`Diff dialog dismissed`,{display:`system`})}return(0,$.jsxs)(f,{title:O,onCancel:k,color:`background`,inputGuide:e=>e.pending?(0,$.jsxs)(s,{children:[`Press `,e.keyName,` again to exit`]}):i===`list`?(0,$.jsxs)(c,{children:[h.length>1&&(0,$.jsx)(s,{children:`←/→ source`}),(0,$.jsx)(s,{children:`↑/↓ select`}),(0,$.jsx)(s,{children:`Enter view`}),(0,$.jsxs)(s,{children:[E,` close`]})]}):(0,$.jsxs)(c,{children:[(0,$.jsx)(s,{children:`← back`}),(0,$.jsxs)(s,{children:[E,` close`]})]}),children:[T,S,v.files.length===0?(0,$.jsx)(o,{marginTop:1,children:(0,$.jsx)(s,{dimColor:!0,children:D})}):i===`list`?(0,$.jsx)(o,{flexDirection:`column`,marginTop:1,children:(0,$.jsx)(be,{files:v.files,selectedIndex:u})}):(0,$.jsx)(o,{flexDirection:`column`,marginTop:1,children:(0,$.jsx)(ve,{filePath:y?.path||``,hunks:b,isLargeFile:y?.isLargeFile,isBinary:y?.isBinary,isTruncated:y?.isTruncated,isUntracked:y?.isUntracked})})]})}var Q,$;e((()=>{Q=t(l(),1),re(),fe(),_e(),d(),_(),h(),j(),ye(),Ce(),$=p()}))();export{Te as DiffDialog};
1
+ import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{n,t as r}from"./figures-5ThXQEtq.js";import{C as i,Gt as a,I as o,P as s,T as c,ai as l,ot as u,t as d,y as f}from"./src-BX54x08P.js";import{t as p}from"./jsx-runtime-Bb4Xn-E0.js";import{Hn as m,Hr as h,In as g,Kr as _,Ur as v,qr as y}from"./settings-D4M13toi.js";import{Sh as b,nb as x,rb as ee,sb as S,tb as C,xh as w}from"./loadAgentsDir-uuZYOgKn.js";import{n as T,t as E}from"./cwd-DrEEb4f5.js";import{i as D,t as O}from"./execFileNoThrow-DXSEj8ZO.js";import{_ as k,x as te}from"./startupProfiler-B9Qv2QGH.js";import{l as A,o as j}from"./stringUtils-Cs6E5f-B.js";import{i as ne,t as re}from"./overlayContext-7wgLio1O.js";import{r as ie}from"./detectRepository--luIRv5H.js";import{join as ae,resolve as M}from"path";import{access as oe}from"fs/promises";async function se(){if(!await v()||await P())return null;let{stdout:e,code:t}=await O(_(),[`--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(_(),[`--no-optional-locks`,`diff`,`HEAD`,`--numstat`],{timeout:F,preserveOutputOnError:!1});if(r!==0)return null;let{stats:i,perFileStats:a}=le(n),o=I-a.size;if(o>0){let e=await ue(o);if(e){i.filesCount+=e.size;for(let[t,n]of e)a.set(t,n)}}return{stats:i,perFileStats:a,hunks:new Map}}async function ce(){if(!await v()||await P())return new Map;let{stdout:e,code:t}=await O(_(),[`--no-optional-locks`,`diff`,`HEAD`],{timeout:F,preserveOutputOnError:!1});return t===0?N(e):new Map}function le(e){let t=e.trim().split(`
2
+ `).filter(Boolean),n=0,r=0,i=0,a=new Map;for(let e of t){let t=e.split(` `);if(t.length<3)continue;i++;let o=t[0],s=t[1],c=t.slice(2).join(` `),l=o===`-`||s===`-`,u=l?0:parseInt(o??`0`,10)||0,d=l?0:parseInt(s??`0`,10)||0;n+=u,r+=d,a.size<I&&a.set(c,{added:u,removed:d,isBinary:l})}return{stats:{filesCount:i,linesAdded:n,linesRemoved:r},perFileStats:a}}function N(e){let t=new Map;if(!e.trim())return t;let n=e.split(/^diff --git /m).filter(Boolean);for(let e of n){if(t.size>=I)break;if(e.length>L)continue;let n=e.split(`
3
+ `),r=n[0]?.match(/^a\/(.+?) b\/(.+)$/);if(!r)continue;let i=r[2]??r[1]??``,a=[],o=null,s=0;for(let e=1;e<n.length;e++){let t=n[e]??``,r=t.match(/^@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/);if(r){o&&a.push(o),o={oldStart:parseInt(r[1]??`0`,10),oldLines:parseInt(r[2]??`1`,10),newStart:parseInt(r[3]??`0`,10),newLines:parseInt(r[4]??`1`,10),lines:[]};continue}if(!(t.startsWith(`index `)||t.startsWith(`---`)||t.startsWith(`+++`)||t.startsWith(`new file`)||t.startsWith(`deleted file`)||t.startsWith(`old mode`)||t.startsWith(`new mode`)||t.startsWith(`Binary files`))&&o&&(t.startsWith(`+`)||t.startsWith(`-`)||t.startsWith(` `)||t===``)){if(s>=R)continue;o.lines.push(`${t}`),s++}}o&&a.push(o),a.length>0&&t.set(i,a)}return t}async function P(){let e=await h(E());return e?(await Promise.all([`MERGE_HEAD`,`REBASE_HEAD`,`CHERRY_PICK_HEAD`,`REVERT_HEAD`].map(t=>oe(ae(e,t)).then(()=>!0).catch(()=>!1)))).some(Boolean):!1}async function ue(e){let{stdout:t,code:n}=await O(_(),[`--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((()=>{T(),ie(),D(),g(),y(),F=5e3,I=50,L=1e6,R=400,z=500}));function V(){let[e,t]=(0,H.useState)(null),[n,r]=(0,H.useState)(new Map),[i,a]=(0,H.useState)(!0);return(0,H.useEffect)(()=>{let e=!1;async function n(){try{let[n,i]=await Promise.all([se(),ce()]);e||(t(n),r(i),a(!1))}catch{e||(t(null),r(new Map),a(!1))}}return n(),()=>{e=!0}},[]),(0,H.useMemo)(()=>{if(!e)return{stats:null,files:[],hunks:new Map,loading:i};let{stats:t,perFileStats:r}=e,a=[];for(let[e,t]of r){let r=n.get(e),i=t.isUntracked??!1,o=!t.isBinary&&!i&&!r,s=t.added+t.removed,c=!o&&!t.isBinary&&s>U;a.push({path:e,linesAdded:t.added,linesRemoved:t.removed,isBinary:t.isBinary,isLargeFile:o,isTruncated:c,isUntracked:i})}return a.sort((e,t)=>e.path.localeCompare(t.path)),{stats:t,files:a,hunks:n,loading:!1}},[e,n,i])}var H,U,fe=e((()=>{H=t(l(),1),B(),U=400}));function W(e){if(!e||typeof e!=`object`)return!1;let t=e,n=typeof t.filePath==`string`,r=Array.isArray(t.structuredPatch)&&t.structuredPatch.length>0,i=t.type===`create`&&typeof t.content==`string`;return n&&(r||i)}function pe(e){return`type`in e&&(e.type===`create`||e.type===`update`)}function me(e){let t=0,n=0;for(let r of e)for(let e of r.lines)e.startsWith(`+`)?t++:e.startsWith(`-`)&&n++;return{added:t,removed:n}}function he(e){if(e.type!==`user`)return``;let t=e.message.content,n=typeof t==`string`?t:``;return n.length<=30?n:`${n.slice(0,29)}…`}function G(e){let t=0,n=0;for(let r of e.files.values())t+=r.linesAdded,n+=r.linesRemoved;e.stats={filesChanged:e.files.size,linesAdded:t,linesRemoved:n}}function ge(e){let t=(0,K.useRef)({completedTurns:[],currentTurn:null,lastProcessedIndex:0,lastTurnIndex:0});return(0,K.useMemo)(()=>{let n=t.current;e.length<n.lastProcessedIndex&&(n.completedTurns=[],n.currentTurn=null,n.lastProcessedIndex=0,n.lastTurnIndex=0);for(let t=n.lastProcessedIndex;t<e.length;t++){let r=e[t];if(r?.type===`user`){if(!(r.toolUseResult||Array.isArray(r.message.content)&&r.message.content[0]?.type===`tool_result`)&&!r.isMeta)n.currentTurn&&n.currentTurn.files.size>0&&(G(n.currentTurn),n.completedTurns.push(n.currentTurn)),n.lastTurnIndex++,n.currentTurn={turnIndex:n.lastTurnIndex,userPromptPreview:he(r),timestamp:r.timestamp,files:new Map,stats:{filesChanged:0,linesAdded:0,linesRemoved:0}};else if(n.currentTurn&&r.toolUseResult){let e=r.toolUseResult;if(W(e)){let{filePath:t,structuredPatch:r}=e,i=`type`in e&&e.type===`create`,a=n.currentTurn.files.get(t);if(a||(a={filePath:t,hunks:[],isNewFile:i,linesAdded:0,linesRemoved:0},n.currentTurn.files.set(t,a)),i&&r.length===0&&pe(e)){let t=e.content.split(`
5
+ `),n={oldStart:0,oldLines:0,newStart:1,newLines:t.length,lines:t.map(e=>`+${e}`)};a.hunks.push(n),a.linesAdded+=t.length}else{a.hunks.push(...r);let{added:e,removed:t}=me(r);a.linesAdded+=e,a.linesRemoved+=t}i&&(a.isNewFile=!0)}}}}n.lastProcessedIndex=e.length;let r=[...n.completedTurns];return n.currentTurn&&n.currentTurn.files.size>0&&(G(n.currentTurn),r.push(n.currentTurn)),r.reverse()},[e])}var K,_e=e((()=>{K=t(l(),1)}));function ve({filePath:e,hunks:t,isLargeFile:n,isBinary:r,isTruncated:a,isUntracked:c}){let{columns:l}=u(),{firstLine:d,fileContent:f}=(0,q.useMemo)(()=>{if(!e)return{firstLine:null,fileContent:void 0};let t=m(M(E(),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)(w,{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),S(),d(),T(),g(),b(),J=p()}));function be({files:e,selectedIndex:t}){let{columns:n}=u(),{startIndex:r,endIndex:i}=(0,Y.useMemo)(()=>{if(e.length===0||e.length<=Z)return{startIndex:0,endIndex:e.length};let n=Math.max(0,t-Math.floor(Z/2)),r=n+Z;return r>e.length&&(r=e.length,n=Math.max(0,r-Z)),{startIndex:n,endIndex:r}},[e.length,t]);if(e.length===0)return(0,X.jsx)(s,{dimColor:!0,children:`No changed files`});let a=e.slice(r,i),c=r>0,l=i<e.length,d=e.length>Z,f=Math.max(20,n-16-3-4);return(0,X.jsxs)(o,{flexDirection:`column`,children:[d&&(0,X.jsx)(s,{dimColor:!0,children:c?` ↑ ${r} more ${A(r,`file`)}`:` `}),a.map((e,n)=>(0,X.jsx)(xe,{file:e,isSelected:r+n===t,maxPathWidth:f},e.path)),d&&(0,X.jsx)(s,{dimColor:!0,children:l?` ↓ ${e.length-i} more ${A(e.length-i,`file`)}`:` `})]})}function xe({file:e,isSelected:t,maxPathWidth:n}){let i=te(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),S(),d(),k(),j(),X=p(),Z=5}));function we(e){let t=Array.from(e.files.values()).map(e=>({path:e.filePath,linesAdded:e.linesAdded,linesRemoved:e.linesRemoved,isBinary:!1,isLargeFile:!1,isTruncated:!1,isNewFile:e.isNewFile})).sort((e,t)=>e.path.localeCompare(t.path)),n=new Map;for(let t of e.files.values())n.set(t.filePath,t.hunks);return{stats:{filesCount:e.stats.filesChanged,linesAdded:e.stats.linesAdded,linesRemoved:e.stats.linesRemoved},files:t,hunks:n,loading:!1}}function Te({messages:e,onDone:t}){let n=V(),r=ge(e),[i,l]=(0,Q.useState)(`list`),[u,d]=(0,Q.useState)(0),[p,m]=(0,Q.useState)(0),h=(0,Q.useMemo)(()=>[{type:`current`},...r.map(e=>({type:`turn`,turn:e}))],[r]),g=h[p],_=g?.type===`turn`?g.turn:null,v=(0,Q.useMemo)(()=>_?we(_):n,[_,n]),y=v.files[u],b=(0,Q.useMemo)(()=>y&&v.hunks.get(y.path)||[],[y,v.hunks]);(0,Q.useEffect)(()=>{p>=h.length&&m(Math.max(0,h.length-1))},[h.length,p]);let x=(0,Q.useRef)(p);(0,Q.useEffect)(()=>{x.current!==p&&(d(0),x.current=p)},[p]),ne(`diff-dialog`),a({"diff:previousSource":()=>{i===`detail`?l(`list`):i===`list`&&h.length>1&&m(e=>Math.max(0,e-1))},"diff:nextSource":()=>{i===`list`&&h.length>1&&m(e=>Math.min(h.length-1,e+1))},"diff:back":()=>{i===`detail`&&l(`list`)},"diff:viewDetails":()=>{i===`list`&&y&&l(`detail`)},"diff:previousFile":()=>{i===`list`&&d(e=>Math.max(0,e-1))},"diff:nextFile":()=>{i===`list`&&d(e=>Math.min(v.files.length-1,e+1))}},{context:`DiffDialog`});let S=v.stats?(0,$.jsxs)(s,{dimColor:!0,children:[v.stats.filesCount,` `,A(v.stats.filesCount,`file`),` changed`,v.stats.linesAdded>0&&(0,$.jsxs)(s,{color:`diffAddedWord`,children:[` +`,v.stats.linesAdded]}),v.stats.linesRemoved>0&&(0,$.jsxs)(s,{color:`diffRemovedWord`,children:[` -`,v.stats.linesRemoved]})]}):null,C=_?`Turn ${_.turnIndex}`:`Uncommitted changes`,w=_?_.userPromptPreview?`"${_.userPromptPreview}"`:``:`(git diff HEAD)`,T=h.length>1?(0,$.jsxs)(o,{children:[p>0&&(0,$.jsx)(s,{dimColor:!0,children:`◀ `}),h.map((e,t)=>{let n=t===p,r=e.type===`current`?`Current`:`T${e.turn.turnIndex}`;return(0,$.jsxs)(s,{dimColor:!n,bold:n,children:[t>0?` · `:``,r]},t)}),p<h.length-1&&(0,$.jsx)(s,{dimColor:!0,children:` ▶`})]}):null,E=ee(`diff:dismiss`,`DiffDialog`,`esc`),D=v.loading?`Loading diff…`:_?`No file changes in this turn`:v.stats&&v.stats.filesCount>0&&v.files.length===0?`Too many files to display details`:`Working tree is clean`,O=(0,$.jsxs)(s,{children:[C,w&&(0,$.jsxs)(s,{dimColor:!0,children:[` `,w]})]});function k(){i===`detail`?l(`list`):t(`Diff dialog dismissed`,{display:`system`})}return(0,$.jsxs)(f,{title:O,onCancel:k,color:`background`,inputGuide:e=>e.pending?(0,$.jsxs)(s,{children:[`Press `,e.keyName,` again to exit`]}):i===`list`?(0,$.jsxs)(c,{children:[h.length>1&&(0,$.jsx)(s,{children:`←/→ source`}),(0,$.jsx)(s,{children:`↑/↓ select`}),(0,$.jsx)(s,{children:`Enter view`}),(0,$.jsxs)(s,{children:[E,` close`]})]}):(0,$.jsxs)(c,{children:[(0,$.jsx)(s,{children:`← back`}),(0,$.jsxs)(s,{children:[E,` close`]})]}),children:[T,S,v.files.length===0?(0,$.jsx)(o,{marginTop:1,children:(0,$.jsx)(s,{dimColor:!0,children:D})}):i===`list`?(0,$.jsx)(o,{flexDirection:`column`,marginTop:1,children:(0,$.jsx)(be,{files:v.files,selectedIndex:u})}):(0,$.jsx)(o,{flexDirection:`column`,marginTop:1,children:(0,$.jsx)(ve,{filePath:y?.path||``,hunks:b,isLargeFile:y?.isLargeFile,isBinary:y?.isBinary,isTruncated:y?.isTruncated,isUntracked:y?.isUntracked})})]})}var Q,$;e((()=>{Q=t(l(),1),re(),fe(),_e(),d(),C(),x(),j(),ye(),Ce(),$=p()}))();export{Te as DiffDialog};
@@ -1,3 +1,3 @@
1
- import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{i as n,o as r}from"./envUtils-DZ_SvEVz.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-WZ94ZKI3.js";import{t as f}from"./jsx-runtime-Bb4Xn-E0.js";import{Pt as p,q as ee}from"./state-CXY-q5gr.js";import{A_ as m,Al as h,Bb as g,Bh as _,Cy as v,Dy as y,Ey as b,Ib as te,Ki as x,Lb as ne,Mx as re,Nx as S,Ol as ie,Rb as C,aC as w,k_ as ae,kl as oe,ky as se,qi as T,sC as E,tb as ce,zb as D,zh as O}from"./loadAgentsDir-DR5PVAc3.js";import{B as k,Cn as A,L as j,On as M}from"./settings-YIDksG5Z.js";import{l as N,o as P}from"./stringUtils-D_xPrwGQ.js";import{at as F,f as I,nt as L,s as R}from"./model-D42epddJ.js";import{a as z,i as B,r as V,s as H}from"./sleep-BbWr_FL1.js";import{n as U,t as W}from"./ValidationErrorsList-C_gDQfm1.js";import{n as G,t as le}from"./useExitOnCtrlCDWithKeybindings-BgJrnuDl.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-YvAaIrIY.js";import{n as ve,t as ye}from"./McpParsingWarnings-BYG2yqjO.js";import{n as be,t as xe}from"./PressEnterToContinue-CPOaYnym.js";import{n as Se,t as Ce}from"./useSettingsErrors-CO0fTNzn.js";import{n as we,t as Te}from"./shadowedRuleDetection-D6R2OeoH.js";import{n as Ee,r as De,t as K}from"./statusNoticeHelpers-DI45AH-c.js";import{join as q}from"path";function Oe(){if(!H())return null;let e=V();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:B()})]}),(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(),z(),J=f()}));function Ae(){if(!w.isSupportedPlatform()||!w.isSandboxEnabledInSettings())return null;let e=w.checkDependencies(),t=e.errors.length>0,n=e.warnings.length>0;return!t&&!n?null:(0,Y.jsxs)(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(),E(),Y=f()}));async function Me(){let e=b(await y());if(e.length===0)return null;let t=e.sort((e,t)=>t.content.length-e.content.length).map(e=>`${e.path}: ${e.content.length.toLocaleString()} chars`);return{type:`agentsmd_files`,severity:`warning`,message:e.length===1?`Large AGENTS.md file detected (${e[0].content.length.toLocaleString()} chars > ${v.toLocaleString()})`:`${e.length} large AGENTS.md files detected (each > ${v.toLocaleString()} chars)`,details:t,currentValue:e.length,threshold:v}}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:T(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,R());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+T(((t.name?.length||0)+t.description.length).toString()),0);return e<=Z?null:{type:`mcp_tools`,severity:`warning`,message:`Large MCP tools context (~${e.toLocaleString()} tokens estimated > ${Z.toLocaleString()})`,details:[`${r.length} MCP tools detected (token count estimated)`],currentValue:e,threshold:Z}}}async function Pe(e){let t=Te(await e(),{sandboxAutoAllowEnabled:w.isSandboxingEnabled()&&w.isAutoAllowBashIfSandboxedEnabled()});if(t.length===0)return null;let n=t.flatMap(e=>[`${k(e.rule.ruleValue)}: ${e.reason}`,` Fix: ${e.fix}`]);return{type:`unreachable_rules`,severity:`warning`,message:`${t.length} ${N(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((()=>{x(),m(),se(),I(),j(),we(),E(),De(),P(),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),[v,y]=(0,Q.useState)(null),[b,x]=(0,Q.useState)(null),S=Se().filter(e=>e.mcpErrorMetadata===void 0),C=(0,Q.useMemo)(()=>[{name:`BASH_MAX_OUTPUT_LENGTH`,default:te,upperLimit:ne},{name:`TASK_MAX_OUTPUT_LENGTH`,default:ie,upperLimit:oe},{name:`WORKMATE_MAX_OUTPUT_TOKENS`,...L(`claude-opus-4-7`)}].map(e=>{let t=process.env[e.name],n=g(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([M(e),M(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(y(f),he()){let e=q(ue(),`claude`,`locks`),t=me(e),n=_e(e);x({enabled:!0,locks:n,locksDir:e,staleLocksCleaned:t})}else x({enabled:!1,locks:[],locksDir:``,staleLocksCleaned:0})})()},[i,u,t]);let w=(0,Q.useCallback)(()=>{e(`Work Mate diagnostics dismissed`,{display:`system`})},[e]);return o({"confirm:yes":w,"confirm:no":w},{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(`
1
+ import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{i as n,o as r}from"./envUtils-QyzA_cFM.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-BX54x08P.js";import{t as f}from"./jsx-runtime-Bb4Xn-E0.js";import{B as p,In as m,L as h,Vn as g}from"./settings-D4M13toi.js";import{Pt as _,q as v}from"./state-CXY-q5gr.js";import{A_ as y,Al as b,Bb as ee,Bh as x,Cy as S,Dy as C,Ey as w,Ib as T,Ki as E,Lb as te,Mx as ne,Nx as re,Ol as ie,Rb as ae,aC as D,k_ as oe,kl as se,ky as ce,qi as O,sC as k,tb as A,zb as j,zh as M}from"./loadAgentsDir-uuZYOgKn.js";import{l as N,o as P}from"./stringUtils-Cs6E5f-B.js";import{at as F,f as I,nt as L,s as R}from"./model-CcHyMyBv.js";import{a as z,i as B,r as V,s as H}from"./sleep-xKMbXTJe.js";import{n as U,t as W}from"./ValidationErrorsList-BUYHEft4.js";import{n as G,t as le}from"./useExitOnCtrlCDWithKeybindings-ClN4NJnB.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-CFUBtZck.js";import{n as ve,t as ye}from"./McpParsingWarnings-Dj_Fu5o-.js";import{n as be,t as xe}from"./PressEnterToContinue-DE1RxMX_.js";import{n as Se,t as Ce}from"./useSettingsErrors-BDJCLei_.js";import{n as we,t as Te}from"./shadowedRuleDetection-DiZUDzxU.js";import{n as Ee,r as De,t as K}from"./statusNoticeHelpers-BoloSeXY.js";import{join as q}from"path";function Oe(){if(!H())return null;let e=V();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:B()})]}),(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(),z(),J=f()}));function Ae(){if(!D.isSupportedPlatform()||!D.isSandboxEnabledInSettings())return null;let e=D.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(),k(),Y=f()}));async function Me(){let e=w(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 > ${S.toLocaleString()})`:`${e.length} large AGENTS.md files detected (each > ${S.toLocaleString()} chars)`,details:t,currentValue:e.length,threshold:S}}async function Ne(e){if(!e)return null;let t=Ee(e);if(t<=15e3)return null;let n=e.activeAgents.filter(e=>e.source!==`built-in`).map(e=>{let t=`${e.agentType}: ${e.whenToUse}`;return{name:e.agentType,tokens:O(t)}}).sort((e,t)=>t.tokens-e.tokens),r=n.slice(0,5).map(e=>`${e.name}: ~${e.tokens.toLocaleString()} tokens`);return n.length>5&&r.push(`(${n.length-5} more custom agents)`),{type:`agent_descriptions`,severity:`warning`,message:`Large agent descriptions (~${t.toLocaleString()} tokens > ${K.toLocaleString()})`,details:r,currentValue:t,threshold:K}}async function X(e,t,n){let r=e.filter(e=>e.isMcp);if(r.length===0)return null;try{let{mcpToolTokens:r,mcpToolDetails:i}=await oe(e,t,n,R());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:D.isSandboxingEnabled()&&D.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} ${N(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((()=>{E(),y(),ce(),I(),h(),we(),k(),De(),P(),Z=25e3}));function Le({onDone:e}){let t=x(e=>e.agentDefinitions),r=x(e=>e.mcp.tools),i=x(e=>e.toolPermissionContext),l=x(e=>e.plugins.errors);G();let u=(0,Q.useMemo)(()=>r||[],[r]),[f,p]=(0,Q.useState)(null),[m,h]=(0,Q.useState)(null),[_,y]=(0,Q.useState)(null),[b,S]=(0,Q.useState)(null),C=Se().filter(e=>e.mcpErrorMetadata===void 0),w=(0,Q.useMemo)(()=>[{name:`BASH_MAX_OUTPUT_LENGTH`,default:T,upperLimit:te},{name:`TASK_MAX_OUTPUT_LENGTH`,default:ie,upperLimit:se},{name:`WORKMATE_MAX_OUTPUT_TOKENS`,...L(`claude-opus-4-7`)}].map(e=>{let t=process.env[e.name],n=ee(e.name,t,e.default,e.upperLimit);return{name:e.name,...n}}).filter(e=>e.status!==`valid`),[]);(0,Q.useEffect)(()=>{fe().then(p),(async()=>{let e=q(n(),`agents`),r=q(v(),`.workmate`,`agents`),{activeAgents:a,allAgents:o,failedFiles:s}=t,[c,l]=await Promise.all([g(e),g(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(y(f),he()){let e=q(ue(),`claude`,`locks`),t=me(e),n=_e(e);S({enabled:!0,locks:n,locksDir:e,staleLocksCleaned:t})}else S({enabled:!1,locks:[],locksDir:``,staleLocksCleaned:0})})()},[i,u,t]);let E=(0,Q.useCallback)(()=>{e(`Work Mate diagnostics dismissed`,{display:`system`})},[e]);return o({"confirm:yes":E,"confirm:no":E},{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
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))]}),S.length>0&&(0,$.jsxs)(s,{flexDirection:`column`,marginTop:1,marginBottom:1,children:[(0,$.jsx)(c,{bold:!0,children:`Invalid Settings`}),(0,$.jsx)(W,{errors:S})]})]}),(0,$.jsx)(Ae,{}),(0,$.jsx)(ye,{}),(0,$.jsx)(Oe,{}),C.length>0&&(0,$.jsxs)(s,{flexDirection:`column`,children:[(0,$.jsx)(c,{bold:!0,children:`Environment Variables`}),C.map((e,t)=>(0,$.jsxs)(c,{children:[`└ `,e.name,`:`,` `,(0,$.jsx)(c,{color:e.status===`capped`?`warning`:`error`,children:e.message})]},t))]}),b?.enabled&&(0,$.jsxs)(s,{flexDirection:`column`,children:[(0,$.jsx)(c,{bold:!0,children:`Version Locks`}),b.staleLocksCleaned>0&&(0,$.jsxs)(c,{dimColor:!0,children:[`└ Cleaned `,b.staleLocksCleaned,` stale lock(s)`]}),b.locks.length===0?(0,$.jsx)(c,{dimColor:!0,children:`└ No active version locks`}):b.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}]`:``,`: `,re(e)]},t))]}),v?.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,` `,v.unreachableRulesWarning.message]})]}),v.unreachableRulesWarning.details.map((e,t)=>(0,$.jsxs)(c,{dimColor:!0,children:[` `,`└ `,e]},t))]}),v&&(v.agentsMdWarning||v.agentWarning||v.mcpWarning)&&(0,$.jsxs)(s,{flexDirection:`column`,children:[(0,$.jsx)(c,{bold:!0,children:`Context Usage Warnings`}),v.agentsMdWarning&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(c,{children:[`└`,` `,(0,$.jsxs)(c,{color:`warning`,children:[a.warning,` `,v.agentsMdWarning.message]})]}),(0,$.jsxs)(c,{children:[` `,`└ Files:`]}),v.agentsMdWarning.details.map((e,t)=>(0,$.jsxs)(c,{dimColor:!0,children:[` `,`└ `,e]},t))]}),v.agentWarning&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(c,{children:[`└`,` `,(0,$.jsxs)(c,{color:`warning`,children:[a.warning,` `,v.agentWarning.message]})]}),(0,$.jsxs)(c,{children:[` `,`└ Top contributors:`]}),v.agentWarning.details.map((e,t)=>(0,$.jsxs)(c,{dimColor:!0,children:[` `,`└ `,e]},t))]}),v.mcpWarning&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(c,{children:[`└`,` `,(0,$.jsxs)(c,{color:`warning`,children:[a.warning,` `,v.mcpWarning.message]})]}),(0,$.jsxs)(c,{children:[` `,`└ MCP servers:`]}),v.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(),F(),r(),p(),u(),be(),je(),U(),Ce(),le(),ce(),O(),S(),Ie(),de(),D(),A(),pe(),C(),h(),ge(),$=f()}));export{Re as n,Le as t};
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))]}),C.length>0&&(0,$.jsxs)(s,{flexDirection:`column`,marginTop:1,marginBottom:1,children:[(0,$.jsx)(c,{bold:!0,children:`Invalid Settings`}),(0,$.jsx)(W,{errors:C})]})]}),(0,$.jsx)(Ae,{}),(0,$.jsx)(ye,{}),(0,$.jsx)(Oe,{}),w.length>0&&(0,$.jsxs)(s,{flexDirection:`column`,children:[(0,$.jsx)(c,{bold:!0,children:`Environment Variables`}),w.map((e,t)=>(0,$.jsxs)(c,{children:[`└ `,e.name,`:`,` `,(0,$.jsx)(c,{color:e.status===`capped`?`warning`:`error`,children:e.message})]},t))]}),b?.enabled&&(0,$.jsxs)(s,{flexDirection:`column`,children:[(0,$.jsx)(c,{bold:!0,children:`Version Locks`}),b.staleLocksCleaned>0&&(0,$.jsxs)(c,{dimColor:!0,children:[`└ Cleaned `,b.staleLocksCleaned,` stale lock(s)`]}),b.locks.length===0?(0,$.jsx)(c,{dimColor:!0,children:`└ No active version locks`}):b.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))]}),_?.unreachableRulesWarning&&(0,$.jsxs)(s,{flexDirection:`column`,children:[(0,$.jsx)(c,{bold:!0,color:`warning`,children:`Unreachable Permission Rules`}),(0,$.jsxs)(c,{children:[`└`,` `,(0,$.jsxs)(c,{color:`warning`,children:[a.warning,` `,_.unreachableRulesWarning.message]})]}),_.unreachableRulesWarning.details.map((e,t)=>(0,$.jsxs)(c,{dimColor:!0,children:[` `,`└ `,e]},t))]}),_&&(_.agentsMdWarning||_.agentWarning||_.mcpWarning)&&(0,$.jsxs)(s,{flexDirection:`column`,children:[(0,$.jsx)(c,{bold:!0,children:`Context Usage Warnings`}),_.agentsMdWarning&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(c,{children:[`└`,` `,(0,$.jsxs)(c,{color:`warning`,children:[a.warning,` `,_.agentsMdWarning.message]})]}),(0,$.jsxs)(c,{children:[` `,`└ Files:`]}),_.agentsMdWarning.details.map((e,t)=>(0,$.jsxs)(c,{dimColor:!0,children:[` `,`└ `,e]},t))]}),_.agentWarning&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(c,{children:[`└`,` `,(0,$.jsxs)(c,{color:`warning`,children:[a.warning,` `,_.agentWarning.message]})]}),(0,$.jsxs)(c,{children:[` `,`└ Top contributors:`]}),_.agentWarning.details.map((e,t)=>(0,$.jsxs)(c,{dimColor:!0,children:[` `,`└ `,e]},t))]}),_.mcpWarning&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(c,{children:[`└`,` `,(0,$.jsxs)(c,{color:`warning`,children:[a.warning,` `,_.mcpWarning.message]})]}),(0,$.jsxs)(c,{children:[` `,`└ MCP servers:`]}),_.mcpWarning.details.map((e,t)=>(0,$.jsxs)(c,{dimColor:!0,children:[` `,`└ `,e]},t))]})]}),(0,$.jsx)(s,{children:(0,$.jsx)(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(),F(),r(),_(),u(),be(),je(),U(),Ce(),le(),A(),M(),re(),Ie(),de(),j(),m(),pe(),ae(),b(),ge(),$=f()}));export{Re as n,Le as t};
@@ -0,0 +1 @@
1
+ import{n as e,t}from"./Doctor-CLOYkPRR.js";e();export{t as Doctor};
@@ -1,2 +1,2 @@
1
- import{a as e,n as t,o as n}from"./rolldown-runtime-DaDcL9Zw.js";import{I as r,P as i,ai as a,t as o,y as s}from"./src-WZ94ZKI3.js";import{t as c}from"./jsx-runtime-Bb4Xn-E0.js";import{St as l,Tt as u,bb as d,ci as f,cw as p,gi as m,gr as h,mC as g,mi as _,pC as v,pt as y,sw as b,wt as x,xb as S,yt as C}from"./loadAgentsDir-DR5PVAc3.js";import{c as w,i as T}from"./debug-kBjDaVkQ.js";import{i as E,t as D}from"./execFileNoThrow-BfZFnCGa.js";import{n as O}from"./analytics-COpjZpvd.js";import{n as k,t as A}from"./select-FrwoTzuc.js";import{r as j,t as M}from"./Spinner-DhhSOFcN.js";function N(){(h(),e(f)).saveWorktreeState(null)}function P({onDone:e,onCancel:t}){let[n,a]=(0,F.useState)(`loading`),[o,c]=(0,F.useState)([]),[l,d]=(0,F.useState)(0),[f,p]=(0,F.useState)(),m=C();if((0,F.useEffect)(()=>{async function e(){let e=[],t=await D(`git`,[`status`,`--porcelain`]);if(t.stdout&&(e=t.stdout.split(`
1
+ import{a as e,n as t,o as n}from"./rolldown-runtime-DaDcL9Zw.js";import{I as r,P as i,ai as a,t as o,y as s}from"./src-BX54x08P.js";import{t as c}from"./jsx-runtime-Bb4Xn-E0.js";import{St as l,Tt as u,bb as d,ci as f,cw as p,gi as m,gr as h,mC as g,mi as _,pC as v,pt as y,sw as b,wt as x,xb as S,yt as C}from"./loadAgentsDir-uuZYOgKn.js";import{c as w,i as T}from"./debug-2pVES-2G.js";import{i as E,t as D}from"./execFileNoThrow-DXSEj8ZO.js";import{n as O}from"./analytics-COpjZpvd.js";import{n as k,t as A}from"./select-BuTJbu_Q.js";import{r as j,t as M}from"./Spinner-DOI8qqZi.js";function N(){(h(),e(f)).saveWorktreeState(null)}function P({onDone:e,onCancel:t}){let[n,a]=(0,F.useState)(`loading`),[o,c]=(0,F.useState)([]),[l,d]=(0,F.useState)(0),[f,p]=(0,F.useState)(),m=C();if((0,F.useEffect)(()=>{async function e(){let e=[],t=await D(`git`,[`status`,`--porcelain`]);if(t.stdout&&(e=t.stdout.split(`
2
2
  `).filter(e=>e.trim()!==``),c(e)),m){let{stdout:t}=await D(`git`,[`rev-list`,`--count`,`${m.originalHeadCommit}..HEAD`]),n=parseInt(t.trim(),10)||0;if(d(n),e.length===0&&n===0){a(`removing`),y().then(()=>{process.chdir(m.originalCwd),S(m.originalCwd),N(),b.cache.clear?.(),p(`Worktree removed (no changes)`)}).catch(e=>{w(`Failed to clean up worktree: ${e}`,{level:`error`}),p(`Worktree cleanup failed, exiting anyway`)}).then(()=>{a(`done`)});return}else a(`asking`)}}e()},[m]),(0,F.useEffect)(()=>{n===`done`&&e(f)},[n,e,f]),!m)return e(`No active worktree session found`,{display:`system`}),null;if(n===`loading`||n===`done`)return null;async function h(e){if(!m)return;let t=!!m.tmuxSessionName;if(e===`keep`||e===`keep-with-tmux`)a(`keeping`),o.length,await x(),process.chdir(m.originalCwd),S(m.originalCwd),N(),b.cache.clear?.(),p(t?`Worktree kept. Your work is saved at ${m.worktreePath} on branch ${m.worktreeBranch}. Reattach to tmux session with: tmux attach -t ${m.tmuxSessionName}`:`Worktree kept. Your work is saved at ${m.worktreePath} on branch ${m.worktreeBranch}`),a(`done`);else if(e===`keep-kill-tmux`)a(`keeping`),o.length,m.tmuxSessionName&&await u(m.tmuxSessionName),await x(),process.chdir(m.originalCwd),S(m.originalCwd),N(),b.cache.clear?.(),p(`Worktree kept at ${m.worktreePath} on branch ${m.worktreeBranch}. Tmux session terminated.`),a(`done`);else if(e===`remove`||e===`remove-with-tmux`){a(`removing`),o.length,m.tmuxSessionName&&await u(m.tmuxSessionName);try{await y(),process.chdir(m.originalCwd),S(m.originalCwd),N(),b.cache.clear?.()}catch(e){w(`Failed to clean up worktree: ${e}`,{level:`error`}),p(`Worktree cleanup failed, exiting anyway`),a(`done`);return}let e=t?` Tmux session terminated.`:``;l>0&&o.length>0?p(`Worktree removed. ${l} ${l===1?`commit`:`commits`} and uncommitted changes were discarded.${e}`):l>0?p(`Worktree removed. ${l} ${l===1?`commit`:`commits`} on ${m.worktreeBranch} ${l===1?`was`:`were`} discarded.${e}`):o.length>0?p(`Worktree removed. Uncommitted changes were discarded.${e}`):p(`Worktree removed.${e}`),a(`done`)}}if(n===`keeping`)return(0,I.jsxs)(r,{flexDirection:`row`,marginY:1,children:[(0,I.jsx)(M,{}),(0,I.jsx)(i,{children:`Keeping worktree…`})]});if(n===`removing`)return(0,I.jsxs)(r,{flexDirection:`row`,marginY:1,children:[(0,I.jsx)(M,{}),(0,I.jsx)(i,{children:`Removing worktree…`})]});let g=m.worktreeBranch,_=o.length>0,v=l>0,T=``;T=_&&v?`You have ${o.length} uncommitted ${o.length===1?`file`:`files`} and ${l} ${l===1?`commit`:`commits`} on ${g}. All will be lost if you remove.`:_?`You have ${o.length} uncommitted ${o.length===1?`file`:`files`}. These will be lost if you remove the worktree.`:v?`You have ${l} ${l===1?`commit`:`commits`} on ${g}. The branch will be deleted if you remove the worktree.`:`You are working in a worktree. Keep it to continue working there, or remove it to clean up.`;function E(){if(t){t();return}h(`keep`)}let O=_||v?`All changes and commits will be lost.`:`Clean up the worktree directory.`,k=!!m.tmuxSessionName,j=k?[{label:`Keep worktree and tmux session`,value:`keep-with-tmux`,description:`Stays at ${m.worktreePath}. Reattach with: tmux attach -t ${m.tmuxSessionName}`},{label:`Keep worktree, kill tmux session`,value:`keep-kill-tmux`,description:`Keeps worktree at ${m.worktreePath}, terminates tmux session.`},{label:`Remove worktree and tmux session`,value:`remove-with-tmux`,description:O}]:[{label:`Keep worktree`,value:`keep`,description:`Stays at ${m.worktreePath}`},{label:`Remove worktree`,value:`remove`,description:O}];return(0,I.jsx)(s,{title:`Exiting worktree session`,subtitle:T,onCancel:E,children:(0,I.jsx)(A,{defaultFocusValue:k?`keep-with-tmux`:`keep`,options:j,onChange:h})})}var F,I,L=t((()=>{F=n(a(),1),O(),T(),o(),E(),p(),d(),l(),k(),j(),I=c()}));function R(){return g(V)??`Goodbye!`}function z({showWorktree:e,onDone:t,onCancel:n}){async function r(e){t(e??R()),await _(0,`prompt_input_exit`)}return e?(0,B.jsx)(P,{onDone:r,onCancel:n}):null}var B,V,H=t((()=>{v(),m(),L(),B=c(),V=[`Goodbye!`,`See ya!`,`Bye!`,`Catch you later!`]}));export{H as n,z as t};
@@ -1 +1 @@
1
- import{I as e,P as t,kn as n,t as r,y as i}from"./src-WZ94ZKI3.js";import{t as a}from"./jsx-runtime-Bb4Xn-E0.js";import{Lh as o,zh as s}from"./loadAgentsDir-DR5PVAc3.js";import{C as c,T as l,x as u}from"./debug-kBjDaVkQ.js";import{t as d}from"./KeybindingProviderSetup-CSUkJHTT.js";import{t as f}from"./select-FrwoTzuc.js";import{t as p}from"./CustomSelect-CpMbxYbt.js";import{t as m}from"./renderOptions-DkP98P_d.js";r(),s(),u(),p();var h=a();function g({filePath:n,errorDescription:r,onExit:a,onReset:o}){return(0,h.jsxs)(i,{title:`Configuration Error`,color:`error`,onCancel:a,children:[(0,h.jsxs)(e,{flexDirection:`column`,gap:1,children:[(0,h.jsxs)(t,{children:[`The configuration file at `,(0,h.jsx)(t,{bold:!0,children:n}),` contains invalid JSON.`]}),(0,h.jsx)(t,{children:r})]}),(0,h.jsxs)(e,{flexDirection:`column`,children:[(0,h.jsx)(t,{bold:!0,children:`Choose an option:`}),(0,h.jsx)(f,{options:[{label:`Exit and fix manually`,value:`exit`},{label:`Reset with default configuration`,value:`reset`}],onChange:e=>{e===`exit`?a():o()},onCancel:a})]})]})}var _=`dark`;async function v({error:e}){let t={...m(!1),theme:_};await new Promise(async r=>{let{unmount:i}=await n((0,h.jsx)(o,{children:(0,h.jsx)(d,{children:(0,h.jsx)(g,{filePath:e.filePath,errorDescription:e.message,onExit:()=>{i(),r(),process.exit(1)},onReset:()=>{l(e.filePath,c(e.defaultConfig,null,2),{flush:!1,encoding:`utf8`}),i(),r(),process.exit(0)}})})}),t)})}export{v as showInvalidConfigDialog};
1
+ import{I as e,P as t,kn as n,t as r,y as i}from"./src-BX54x08P.js";import{t as a}from"./jsx-runtime-Bb4Xn-E0.js";import{Lh as o,zh as s}from"./loadAgentsDir-uuZYOgKn.js";import{C as c,T as l,x as u}from"./debug-2pVES-2G.js";import{t as d}from"./KeybindingProviderSetup-Dzg77_Xn.js";import{t as f}from"./select-BuTJbu_Q.js";import{t as p}from"./CustomSelect-CYmc4vRh.js";import{t as m}from"./renderOptions-B0RFpjRI.js";r(),s(),u(),p();var h=a();function g({filePath:n,errorDescription:r,onExit:a,onReset:o}){return(0,h.jsxs)(i,{title:`Configuration Error`,color:`error`,onCancel:a,children:[(0,h.jsxs)(e,{flexDirection:`column`,gap:1,children:[(0,h.jsxs)(t,{children:[`The configuration file at `,(0,h.jsx)(t,{bold:!0,children:n}),` contains invalid JSON.`]}),(0,h.jsx)(t,{children:r})]}),(0,h.jsxs)(e,{flexDirection:`column`,children:[(0,h.jsx)(t,{bold:!0,children:`Choose an option:`}),(0,h.jsx)(f,{options:[{label:`Exit and fix manually`,value:`exit`},{label:`Reset with default configuration`,value:`reset`}],onChange:e=>{e===`exit`?a():o()},onCancel:a})]})]})}var _=`dark`;async function v({error:e}){let t={...m(!1),theme:_};await new Promise(async r=>{let{unmount:i}=await n((0,h.jsx)(o,{children:(0,h.jsx)(d,{children:(0,h.jsx)(g,{filePath:e.filePath,errorDescription:e.message,onExit:()=>{i(),r(),process.exit(1)},onReset:()=>{l(e.filePath,c(e.defaultConfig,null,2),{flush:!1,encoding:`utf8`}),i(),r(),process.exit(0)}})})}),t)})}export{v as showInvalidConfigDialog};
@@ -1 +1 @@
1
- import{P as e,t,y as n}from"./src-WZ94ZKI3.js";import{t as r}from"./jsx-runtime-Bb4Xn-E0.js";import{n as i,t as a}from"./ValidationErrorsList-C_gDQfm1.js";import{t as o}from"./select-FrwoTzuc.js";import{t as s}from"./CustomSelect-CpMbxYbt.js";t(),s(),i();var c=r();function l({settingsErrors:t,onContinue:r,onExit:i}){function s(e){e===`exit`?i():r()}return(0,c.jsxs)(n,{title:`Settings Error`,onCancel:i,color:`warning`,children:[(0,c.jsx)(a,{errors:t}),(0,c.jsx)(e,{dimColor:!0,children:`Files with errors are skipped entirely, not just the invalid settings.`}),(0,c.jsx)(o,{options:[{label:`Exit and fix manually`,value:`exit`},{label:`Continue without these settings`,value:`continue`}],onChange:s})]})}export{l as InvalidSettingsDialog};
1
+ import{P as e,t,y as n}from"./src-BX54x08P.js";import{t as r}from"./jsx-runtime-Bb4Xn-E0.js";import{n as i,t as a}from"./ValidationErrorsList-BUYHEft4.js";import{t as o}from"./select-BuTJbu_Q.js";import{t as s}from"./CustomSelect-CYmc4vRh.js";t(),s(),i();var c=r();function l({settingsErrors:t,onContinue:r,onExit:i}){function s(e){e===`exit`?i():r()}return(0,c.jsxs)(n,{title:`Settings Error`,onCancel:i,color:`warning`,children:[(0,c.jsx)(a,{errors:t}),(0,c.jsx)(e,{dimColor:!0,children:`Files with errors are skipped entirely, not just the invalid settings.`}),(0,c.jsx)(o,{options:[{label:`Exit and fix manually`,value:`exit`},{label:`Continue without these settings`,value:`continue`}],onChange:s})]})}export{l as InvalidSettingsDialog};
@@ -0,0 +1 @@
1
+ import{o as e}from"./rolldown-runtime-DaDcL9Zw.js";import{Vt as t,ai as n,t as r}from"./src-BX54x08P.js";import{t as i}from"./jsx-runtime-Bb4Xn-E0.js";import{$n as a,Qn as o}from"./settings-D4M13toi.js";import{c as s,i as c}from"./debug-2pVES-2G.js";import{l,o as u}from"./stringUtils-Cs6E5f-B.js";import{a as d,l as f,o as p,u as m}from"./sleep-xKMbXTJe.js";import{n as h,t as g}from"./notifications-GLnjirCl.js";var _=e(n(),1);g(),a(),c(),u(),r(),d();var v=i();function y({children:e}){let{addNotification:n,removeNotification:r}=h();return(0,v.jsx)(t,{loadBindings:f,subscribeToChanges:m,initWatcher:p,onWarnings:(0,_.useCallback)((e,t)=>{let i=`keybinding-config-warning`;if(e.length===0){r(i);return}let a=o(e,e=>e.severity===`error`),s=o(e,e=>e.severity===`warning`),c;c=a>0&&s>0?`Found ${a} keybinding ${l(a,`error`)} and ${s} ${l(s,`warning`)}`:a>0?`Found ${a} keybinding ${l(a,`error`)}`:`Found ${s} keybinding ${l(s,`warning`)}`,c+=` · /doctor for details`,n({key:i,text:c,color:a>0?`error`:`warning`,priority:a>0?`immediate`:`high`,timeoutMs:6e4})},[n,r]),onDebugLog:s,children:e})}export{y as t};
@@ -0,0 +1 @@
1
+ import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{ai as n}from"./src-BX54x08P.js";import{t as r}from"./jsx-runtime-Bb4Xn-E0.js";import{et as i,nt as a}from"./settings-D4M13toi.js";import{Pt as o,at as s}from"./state-CXY-q5gr.js";import{$d as c,Bd as l,Bh as u,Fd as d,Hh as f,Id as p,Kd as m,Md as h,Nd as g,Rd as _,Vh as v,bf as y,cp as b,df as x,hf as S,ip as ee,jd as C,kd as w,lf as T,rp as E,sp as D,uf as O,yf as k,zh as A}from"./loadAgentsDir-uuZYOgKn.js";import{I as j,M,c as N,i as P}from"./debug-2pVES-2G.js";import{c as F,l as I,o as L}from"./log-L1kqxa_P.js";import{n as te}from"./analytics-COpjZpvd.js";import{i as ne,n as R,r as z,t as B}from"./reject-CBxnwckZ.js";import{n as V,t as H}from"./notifications-GLnjirCl.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=v(),r=u(e=>e.mcp.pluginReconnectKey),a=f(),o=(0,q.useRef)(new Map),{addNotification:c}=V(),p=(0,q.useRef)([]),b=(0,q.useRef)(null),O=(0,q.useCallback)(()=>{b.current=null;let e=p.current;e.length!==0&&(p.current=[],a(t=>{let n=t.mcp;for(let t of e){let{tools:e,commands:r,resources:a,...o}=t,s=o.type===`disabled`||o.type===`failed`?e??[]:e,c=o.type===`disabled`||o.type===`failed`?r??[]:r,u=o.type===`disabled`||o.type===`failed`?a??[]:a,d=i(o.name),f=n.clients.findIndex(e=>e.name===o.name)===-1?[...n.clients,o]:n.clients.map(e=>e.name===o.name?o:e),p=s===void 0?n.tools:[...R(n.tools,e=>e.name?.startsWith(d)),...s],m=c===void 0?n.commands:[...R(n.commands,e=>l(e,o.name)),...c],h=u===void 0?n.resources:{...n.resources,...u.length>0?{[o.name]:u}:ne(n.resources,o.name)};n={...n,clients:f,tools:p,commands:m,resources:h}}return{...t,mcp:n}}))},[a]),k=(0,q.useCallback)(e=>{p.current.push(e),b.current===null&&(b.current=setTimeout(O,16))},[O]),A=(0,q.useCallback)(({client:e,tools:t,commands:n,resources:r})=>{switch(k({...e,tools:t,commands:n,resources:r}),e.type){case`connected`:y(e.client,e.name,a),e.client.onclose=()=>{let t=e.config.type??`stdio`;if(w(e.name,e.config).catch(()=>{N(`Failed to invalidate the server cache: ${e.name}`)}),x(e.name)){F(e.name,`Server is disabled, skipping automatic reconnection`);return}if(t!==`stdio`&&t!==`sdk`){let n=K(t);F(e.name,`${n} transport closed/disconnected, attempting automatic reconnection`);let r=o.current.get(e.name);r&&(clearTimeout(r),o.current.delete(e.name)),(async()=>{for(let t=1;t<=J;t++){if(x(e.name)){F(e.name,`Server disabled during reconnection, stopping retry`),o.current.delete(e.name);return}k({...e,type:`pending`,reconnectAttempt:t,maxReconnectAttempts:J});let r=Date.now();try{let i=await _(e.name,e.config),a=Date.now()-r;if(i.client.type===`connected`){F(e.name,`${n} reconnection successful after ${a}ms (attempt ${t})`),o.current.delete(e.name),A(i);return}if(F(e.name,`${n} reconnection attempt ${t} completed with status: ${i.client.type}`),t===J){F(e.name,`Max reconnection attempts (${J}) reached, giving up`),o.current.delete(e.name),A(i);return}}catch(i){let a=Date.now()-r;if(I(e.name,`${n} reconnection attempt ${t} failed after ${a}ms: ${i}`),t===J){F(e.name,`Max reconnection attempts (${J}) reached, giving up`),o.current.delete(e.name),k({...e,type:`failed`});return}}let i=Math.min(Y*2**(t-1),X);F(e.name,`Scheduling reconnection attempt ${t+1} in ${i}ms`),await new Promise(t=>{let n=setTimeout(t,i);o.current.set(e.name,n)})}})()}else k({...e,type:`failed`})},e.capabilities?.tools?.listChanged&&e.client.setNotificationHandler(D,async()=>{F(e.name,`Received tools/list_changed notification, refreshing tools`);try{let t=g.cache.get(e.name);g.cache.delete(e.name);let n=await g(e);n.length,t&&t.then(e=>{e.length},()=>{}),k({...e,tools:n})}catch(t){I(e.name,`Failed to refresh tools after list_changed notification: ${M(t)}`)}}),e.capabilities?.prompts?.listChanged&&e.client.setNotificationHandler(E,async()=>{F(e.name,`Received prompts/list_changed notification, refreshing prompts`);try{C.cache.delete(e.name);let t=await C(e);k({...e,commands:t})}catch(t){I(e.name,`Failed to refresh prompts after list_changed notification: ${M(t)}`)}}),e.capabilities?.resources?.listChanged&&e.client.setNotificationHandler(ee,async()=>{F(e.name,`Received resources/list_changed notification, refreshing resources`);try{h.cache.delete(e.name);let t=await h(e);k({...e,resources:t})}catch(t){I(e.name,`Failed to refresh resources after list_changed notification: ${M(t)}`)}});break;case`needs-auth`:case`failed`:case`pending`:case`disabled`:break}},[k]),j=s();return(0,q.useEffect)(()=>{async function n(){let{servers:n,errors:r}=t?{servers:{},errors:[]}:await T(e),i={...n,...e};W(a,r),a(e=>{let{stale:t,...n}=m(e.mcp,i);for(let e of t){let t=o.current.get(e.name);t&&(clearTimeout(t),o.current.delete(e.name)),e.type===`connected`&&(e.client.onclose=void 0,w(e.name,e.config).catch(()=>{}))}let r=new Set(n.clients.map(e=>e.name)),a=Object.entries(i).filter(([e])=>!r.has(e)).map(([e,t])=>({name:e,type:x(e)?`disabled`:`pending`,config:t}));return a.length===0&&t.length===0?e:{...e,mcp:{...e.mcp,...n,clients:[...n.clients,...a]}}})}n().catch(e=>{I(`useManageMCPConnections`,`Failed to initialize servers as pending: ${M(e)}`)})},[t,e,a,j,r]),(0,q.useEffect)(()=>{let n=!1;async function r(){let r=Promise.resolve({}),{servers:i,errors:o}=t?{servers:{},errors:[]}:await T(e,r);if(n)return;W(a,o);let s={...i,...e},c=Object.fromEntries(Object.entries(s).filter(([e])=>!x(e)));d(A,c).catch(e=>{I(`useManageMcpConnections`,`Failed to get MCP resources: ${M(e)}`)});let l={},u={...s,...l},f={enterprise:0,global:0,project:0,user:0,plugin:0,claudeai:0};for(let[e,t]of Object.entries(u))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,A,a,j,r]),(0,q.useEffect)(()=>{let e=o.current;return()=>{for(let t of e.values())clearTimeout(t);e.clear(),b.current!==null&&(clearTimeout(b.current),b.current=null,O())}},[O]),{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=o.current.get(e);r&&(clearTimeout(r),o.current.delete(e));let i=await _(e,t.config);return A(i),i},[n,A]),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=o.current.get(e);n&&(clearTimeout(n),o.current.delete(e)),S(e,!1),t.type===`connected`&&await w(e,t.config),k({name:e,type:`disabled`,config:t.config})}else{S(e,!0),k({name:e,type:`pending`,config:t.config});let n=await _(e,t.config);A(n)}},[n,k,A])}}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),o(),p(),b(),z(),B(),te(),O(),P(),H(),A(),j(),L(),k(),a(),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};
@@ -0,0 +1 @@
1
+ import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{n,t as r}from"./figures-5ThXQEtq.js";import{D as i,H as a,I as o,P as s,T as c,ai as l,j as u,t as d,y as f}from"./src-BX54x08P.js";import{t as p}from"./jsx-runtime-Bb4Xn-E0.js";import{$ as m,Q as h,nt as g}from"./settings-D4M13toi.js";import{$d as _,Bh as v,Gd as y,Hh as b,Id as x,Vd as ee,Wd as te,Xd as S,Yd as C,hd as w,kd as ne,md as T,qd as re,sf as E,uf as D,zh as O}from"./loadAgentsDir-uuZYOgKn.js";import{I as k,M as ie}from"./debug-2pVES-2G.js";import{n as ae}from"./analytics-COpjZpvd.js";import{l as A,n as oe,o as j}from"./stringUtils-Cs6E5f-B.js";import{i as M,n as N,r as P}from"./MCPConnectionManager-CBY8nqdU.js";import{n as F,t as I}from"./useExitOnCtrlCDWithKeybindings-ClN4NJnB.js";import{t as L}from"./select-BuTJbu_Q.js";import{r as R,t as z}from"./Spinner-DOI8qqZi.js";import{t as B}from"./CustomSelect-CYmc4vRh.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(),m=F(),h=v(e=>e.mcp),g=b(),[_,x]=(0,q.useState)(!1),[S,w]=(0,q.useState)(null),E=P(),D=M(),O=oe(String(e.name)),k=C(h.commands,e.name).length,ae=q.useCallback(async()=>{let t=e.client.type!==`disabled`;try{await D(e.name),e.config.type,l()}catch(n){d?.(`Failed to ${t?`disable`:`enable`} MCP server '${e.name}': ${ie(n)}`)}},[e.client.type,e.config.type,e.name,D,l,d]);if(_)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 A=[];return e.client.type===`disabled`&&A.push({label:`Enable`,value:`toggle-enabled`}),e.client.type===`connected`&&t>0&&A.push({label:`View tools`,value:`tools`}),e.client.type!==`disabled`&&(e.client.type!==`needs-auth`&&A.push({label:`Reconnect`,value:`reconnectMcpServer`}),A.push({label:`Disable`,value:`toggle-enabled`})),A.length===0&&A.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:[O,` 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:ee(e.scope)})]}),e.client.type===`connected`&&(0,J.jsx)(V,{serverToolsCount:t,serverPromptsCount:k,serverResourcesCount:h.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`]})]})]}),S&&(0,J.jsx)(o,{marginTop:1,children:(0,J.jsxs)(s,{color:`error`,children:[`Error: `,S]})}),A.length>0&&(0,J.jsx)(o,{marginTop:1,children:(0,J.jsx)(L,{options:A,onChange:async t=>{switch(t){case`tools`:n();break;case`reconnectMcpServer`:x(!0),w(null);try{await ne(e.name,{...e.config,scope:e.scope}),g(t=>{let n=t.mcp.clients.map(t=>t.name===e.name?{...t,type:`pending`}:t),r=re(t.mcp.tools,e.name),i=te(t.mcp.commands,e.name),a=y(t.mcp.resources,e.name);return{...t,mcp:{...t.mcp,clients:n,tools:r,commands:i,resources:a}}});let{message:t}=W(await E(e.name),e.name);d?.(t)}catch(t){d?.(G(t,e.name))}finally{x(!1)}break;case`toggle-enabled`:await ae();break;case`back`:l();break}},onCancel:l})})]}),(0,J.jsx)(o,{marginTop:1,children:(0,J.jsx)(s,{dimColor:!0,italic:!0,children:m.pending?(0,J.jsxs)(J.Fragment,{children:[`Press `,m.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),ae(),I(),d(),x(),N(),_(),O(),k(),j(),w(),B(),R(),U(),K(),J=p()}));function le({server:e,serverToolsCount:t,onViewTools:n,onCancel:l,onComplete:d,borderless:f=!1}){let[p]=a(),m=F(),h=v(e=>e.mcp),g=P(),_=M(),[y,b]=(0,Y.useState)(!1),x=Y.useCallback(async()=>{let t=e.client.type!==`disabled`;try{await _(e.name),l()}catch(n){d(`Failed to ${t?`disable`:`enable`} MCP server '${e.name}': ${ie(n)}`)}},[e.client.type,e.name,_,l,d]),te=oe(String(e.name)),S=C(h.commands,e.name).length,w=[];return e.client.type!==`disabled`&&t>0&&w.push({label:`View tools`,value:`tools`}),e.client.type!==`disabled`&&w.push({label:`Reconnect`,value:`reconnectMcpServer`}),w.push({label:e.client.type===`disabled`?`Enable`:`Disable`,value:`toggle-enabled`}),w.length===0&&w.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:[te,` 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:ee(E(e.name)?.scope??`dynamic`)})]}),e.client.type===`connected`&&(0,X.jsx)(V,{serverToolsCount:t,serverPromptsCount:S,serverResourcesCount:h.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`]})]})]}),w.length>0&&(0,X.jsx)(o,{marginTop:1,children:(0,X.jsx)(L,{options:w,onChange:async t=>{if(t===`tools`)n();else if(t===`reconnectMcpServer`){b(!0);try{let{message:t}=W(await g(e.name),e.name);d?.(t)}catch(t){d?.(G(t,e.name))}finally{b(!1)}}else t===`toggle-enabled`?await x():t===`back`&&l()},onCancel:l})})]}),(0,X.jsx)(o,{marginTop:1,children:(0,X.jsx)(s,{dimColor:!0,italic:!0,children:m.pending?(0,X.jsxs)(X.Fragment,{children:[`Press `,m.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(),D(),N(),_(),O(),k(),j(),w(),B(),R(),U(),K(),X=p()}));function de({tool:e,server:t,onBack:n}){let[r,i]=Z.useState(``),a=m(e.name,t.name),c=h(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(),g(),w(),Q=p()}));function pe({server:e,onSelectTool:t,onBack:n}){let r=v(e=>e.mcp.tools),a=me.useMemo(()=>e.client.type===`connected`?S(r,e.name):[],[e,r]),o=a.map((t,n)=>{let r=m(t.name,e.name),i=h(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} ${A(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(),g(),_(),O(),j(),w(),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 +1 @@
1
- import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{I as n,Lt as r,P as i,ai as a,t as o}from"./src-WZ94ZKI3.js";import{t as s}from"./jsx-runtime-Bb4Xn-E0.js";import{$d as c,Qd as l,Vd as u,cf as d,uf as f}from"./loadAgentsDir-DR5PVAc3.js";function p({scope:e,parsingErrors:t,warnings:r}){let a=t.length>0,o=r.length>0;return!a&&!o?null:(0,_.jsxs)(n,{flexDirection:`column`,marginTop:1,children:[(0,_.jsxs)(n,{children:[(a||o)&&(0,_.jsxs)(i,{color:a?`error`:`warning`,children:[`[`,a?`Failed to parse`:`Contains warnings`,`] `]}),(0,_.jsx)(i,{children:l(e)})]}),(0,_.jsxs)(n,{children:[(0,_.jsx)(i,{dimColor:!0,children:`Location: `}),(0,_.jsx)(i,{dimColor:!0,children:u(e)})]}),(0,_.jsxs)(n,{marginLeft:1,flexDirection:`column`,children:[t.map((e,t)=>{let r=e.mcpErrorMetadata?.serverName;return(0,_.jsx)(n,{children:(0,_.jsxs)(i,{children:[(0,_.jsx)(i,{dimColor:!0,children:`└ `}),(0,_.jsx)(i,{color:`error`,children:`[Error]`}),(0,_.jsxs)(i,{dimColor:!0,children:[` `,r&&`[${r}] `,e.path&&e.path!==``?`${e.path}: `:``,e.message]})]})},`error-${t}`)}),r.map((e,t)=>{let r=e.mcpErrorMetadata?.serverName;return(0,_.jsx)(n,{children:(0,_.jsxs)(i,{children:[(0,_.jsx)(i,{dimColor:!0,children:`└ `}),(0,_.jsx)(i,{color:`warning`,children:`[Warning]`}),(0,_.jsxs)(i,{dimColor:!0,children:[` `,r&&`[${r}] `,e.path&&e.path!==``?`${e.path}: `:``,e.message]})]})},`warning-${t}`)})]})]})}function m(){let e=(0,g.useMemo)(()=>[{scope:`user`,config:d(`user`)},{scope:`project`,config:d(`project`)},{scope:`local`,config:d(`local`)},{scope:`enterprise`,config:d(`enterprise`)}],[]),t=e.some(({config:e})=>h(e.errors,`fatal`).length>0),a=e.some(({config:e})=>h(e.errors,`warning`).length>0);return!t&&!a?null:(0,_.jsxs)(n,{flexDirection:`column`,marginTop:1,marginBottom:1,children:[(0,_.jsx)(i,{bold:!0,children:`MCP Config Diagnostics`}),(0,_.jsx)(n,{marginTop:1,children:(0,_.jsxs)(i,{dimColor:!0,children:[`For help configuring MCP servers, see:`,` `,(0,_.jsx)(r,{url:`https://code.workmate.com/docs/en/mcp`,children:`https://code.workmate.com/docs/en/mcp`})]})}),e.map(({scope:e,config:t})=>(0,_.jsx)(p,{scope:e,parsingErrors:h(t.errors,`fatal`),warnings:h(t.errors,`warning`)},e))]})}function h(e,t){return e.filter(e=>e.mcpErrorMetadata?.severity===t)}var g,_,v=e((()=>{g=t(a(),1),f(),c(),o(),_=s()}));export{v as n,m as t};
1
+ import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{I as n,Lt as r,P as i,ai as a,t as o}from"./src-BX54x08P.js";import{t as s}from"./jsx-runtime-Bb4Xn-E0.js";import{$d as c,Qd as l,Vd as u,cf as d,uf as f}from"./loadAgentsDir-uuZYOgKn.js";function p({scope:e,parsingErrors:t,warnings:r}){let a=t.length>0,o=r.length>0;return!a&&!o?null:(0,_.jsxs)(n,{flexDirection:`column`,marginTop:1,children:[(0,_.jsxs)(n,{children:[(a||o)&&(0,_.jsxs)(i,{color:a?`error`:`warning`,children:[`[`,a?`Failed to parse`:`Contains warnings`,`] `]}),(0,_.jsx)(i,{children:l(e)})]}),(0,_.jsxs)(n,{children:[(0,_.jsx)(i,{dimColor:!0,children:`Location: `}),(0,_.jsx)(i,{dimColor:!0,children:u(e)})]}),(0,_.jsxs)(n,{marginLeft:1,flexDirection:`column`,children:[t.map((e,t)=>{let r=e.mcpErrorMetadata?.serverName;return(0,_.jsx)(n,{children:(0,_.jsxs)(i,{children:[(0,_.jsx)(i,{dimColor:!0,children:`└ `}),(0,_.jsx)(i,{color:`error`,children:`[Error]`}),(0,_.jsxs)(i,{dimColor:!0,children:[` `,r&&`[${r}] `,e.path&&e.path!==``?`${e.path}: `:``,e.message]})]})},`error-${t}`)}),r.map((e,t)=>{let r=e.mcpErrorMetadata?.serverName;return(0,_.jsx)(n,{children:(0,_.jsxs)(i,{children:[(0,_.jsx)(i,{dimColor:!0,children:`└ `}),(0,_.jsx)(i,{color:`warning`,children:`[Warning]`}),(0,_.jsxs)(i,{dimColor:!0,children:[` `,r&&`[${r}] `,e.path&&e.path!==``?`${e.path}: `:``,e.message]})]})},`warning-${t}`)})]})]})}function m(){let e=(0,g.useMemo)(()=>[{scope:`user`,config:d(`user`)},{scope:`project`,config:d(`project`)},{scope:`local`,config:d(`local`)},{scope:`enterprise`,config:d(`enterprise`)}],[]),t=e.some(({config:e})=>h(e.errors,`fatal`).length>0),a=e.some(({config:e})=>h(e.errors,`warning`).length>0);return!t&&!a?null:(0,_.jsxs)(n,{flexDirection:`column`,marginTop:1,marginBottom:1,children:[(0,_.jsx)(i,{bold:!0,children:`MCP Config Diagnostics`}),(0,_.jsx)(n,{marginTop:1,children:(0,_.jsxs)(i,{dimColor:!0,children:[`For help configuring MCP servers, see:`,` `,(0,_.jsx)(r,{url:`https://code.workmate.com/docs/en/mcp`,children:`https://code.workmate.com/docs/en/mcp`})]})}),e.map(({scope:e,config:t})=>(0,_.jsx)(p,{scope:e,parsingErrors:h(t.errors,`fatal`),warnings:h(t.errors,`warning`)},e))]})}function h(e,t){return e.filter(e=>e.mcpErrorMetadata?.severity===t)}var g,_,v=e((()=>{g=t(a(),1),f(),c(),o(),_=s()}));export{v as n,m as t};
@@ -0,0 +1,3 @@
1
+ import{n as e,o as t,r as n}from"./rolldown-runtime-DaDcL9Zw.js";import{n as r,t as i}from"./figures-5ThXQEtq.js";import{C as a,Gt as o,I as s,P as c,Wt as l,ai as u,ot as d,t as f}from"./src-BX54x08P.js";import{t as p}from"./jsx-runtime-Bb4Xn-E0.js";import{$n as m,Qn as h}from"./settings-D4M13toi.js";import{An as g,Pt as _}from"./state-CXY-q5gr.js";import{$h as v,$o as y,$x as b,Bh as x,Bu as S,Ix as C,Ji as w,Px as T,Qh as ee,Qo as E,Ru as D,Ub as O,Vb as k,Wb as A,Xx as j,_c as te,ag as M,by as ne,eg as re,gc as ie,hS as N,hc as ae,mn as P,nn as oe,sb as F,tb as se,ts as I,un as ce,wa as L,xa as le,yc as R,yy as ue,zh as de}from"./loadAgentsDir-uuZYOgKn.js";import{D as z,h as B,m as V,o as H,q as fe,s as U}from"./log-L1kqxa_P.js";import{n as W}from"./analytics-COpjZpvd.js";import{_ as pe,p as me,y as he}from"./startupProfiler-B9Qv2QGH.js";import{E as ge,T as _e,c as ve,d as ye,w as be}from"./sessionTracing-DsdcOqvc.js";import{n as xe,t as Se}from"./useExitOnCtrlCDWithKeybindings-ClN4NJnB.js";import{n as Ce,t as we}from"./select-BuTJbu_Q.js";import{r as Te,t as Ee}from"./Spinner-DOI8qqZi.js";import*as G from"path";import{randomUUID as K}from"crypto";var q=t(u(),1),J=p();f(),_(),fe(),V(),H(),m(),W(),pe(),O(),ue(),be(),D(),ve(),te(),ae(),I(),w(),P();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();g(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:[b({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:[b({content:e,uuid:i,permissionMode:a,isMeta:o||void 0}),...r],shouldQuery:!0}}W(),w();async function Ae({input:e,preExpansionInput:t,mode:n,setToolJSX:r,context:i,pastedContents:a,messages:o,setUserInputOnProcessing:s,uuid:c,isAlreadyProcessing:l,querySource:u,canUseTool:d,skipSlashCommands:f,bridgeOrigin:p,isMeta:m,skipAttachments:h,autonomy:g}){let _=typeof e==`string`?e:null,v=_?.startsWith(`/`)&&!f;n===`prompt`&&_!==null&&!m&&!v&&s?.(_),R(`query_process_user_input_base_start`);let y=i.getAppState(),x=await Me(e,n,r,i,a,o,c,l,u,d,y.toolPermissionContext.mode,f,p,m,h,t,g);if(R(`query_process_user_input_base_end`),!x.shouldQuery)return x;R(`query_hooks_start`);let S=C(e)||``;for await(let t of oe(S,y.toolPermissionContext.mode,i,i.requestPrompt))if(t.message?.type!==`progress`){if(t.blockingError)return{messages:[j(`${ce(t.blockingError)}\n\nOriginal prompt: ${e}`,`warning`)],shouldQuery:!1,allowedTools:x.allowedTools};if(t.preventContinuation){let e=t.stopReason?`Operation stopped by hook: ${t.stopReason}`:`Operation stopped by hook`;return x.messages.push(b({content:e})),x.shouldQuery=!1,x}if(t.additionalContexts&&t.additionalContexts.length>0&&x.messages.push(E({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;x.messages.push({...t.message,attachment:{...t.message.attachment,content:je(t.message.attachment.content)}});break;default:x.messages.push(t.message);break}}return R(`query_hooks_end`),x}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,g){let _=null,v=[],b=[],x=e;if(typeof e==`string`)_=e;else if(e.length>0){R(`query_image_processing_start`);let t=[];for(let n of e)if(n.type===`image`){let e=await A(n);if(e.dimensions){let t=k(e.dimensions);t&&b.push(t)}t.push(e.block)}else t.push(n);x=t,R(`query_image_processing_end`);let n=t[t.length-1];n?.type===`text`?(_=n.text,v=t.slice(0,-1)):v=t}if(_===null&&t!==`prompt`)throw Error(`Mode: ${t} requires a string input.`);let C=i?Object.values(i).filter(ne):[],w=C.map(e=>e.id),T=i?await S(i):new Map;R(`query_pasted_image_processing_start`);let ee=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)}})),E=[];for(let{resized:e,originalDimensions:t,sourcePath:n}of ee){if(e.dimensions){let t=k(e.dimensions,n);t&&b.push(t)}else if(t){let e=k(t,n);e&&b.push(e)}else n&&b.push(`[Image source: ${n}]`);E.push(e.block)}R(`query_pasted_image_processing_end`);let D=d,O=!m&&_!==null&&(t!==`prompt`||D||!_.startsWith(`/`));R(`query_attachment_loading_start`);let j=O?await ie(y(_,r,[],a,c)):[];if(R(`query_attachment_loading_end`),_!==null&&t===`bash`){let{processBashCommand:e}=await import(`./processBashCommand-BLcFmbyG.js`);return X(await e(_,v,j,r,n),b)}if(_!==null&&!D&&_.startsWith(`/`)){let{processSlashCommand:e}=await import(`./processSlashCommand-Caif46Gi.js`);return X(await e(_,v,E,j,r,n,o,s,l,g),b)}if(_!==null&&t===`prompt`){let e=_.trim(),t=j.find(e=>e.attachment.type===`agent_mention`);if(t){let n=`@agent-${t.attachment.agentType}`;e.startsWith(n)}}return X(ke(x,E,w,j,o,u,p),b)}function X(e,t){return t.length>0&&e.messages.push(b({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=x(e=>e.fileHistory),[m,h]=(0,q.useState)(void 0),g=v(),_=(0,q.useMemo)(K,[]),y=(0,q.useMemo)(()=>[...e.filter(Q),{...b({content:``}),uuid:_}],[e,_]),[S,C]=(0,q.useState)(y.length-1),w=Math.max(0,Math.min(S-Math.floor($/2),y.length-$)),T=y.length>1,[E,D]=(0,q.useState)(f),[O,k]=(0,q.useState)(void 0);(0,q.useEffect)(()=>{if(!f||!g)return;let e=!1;return re(p,f.uuid).then(t=>{e||k(t)}),()=>{e=!0}},[f,g,p]);let[A,j]=(0,q.useState)(!1),[te,M]=(0,q.useState)(null),[ne,ie]=(0,q.useState)(`both`),[N,ae]=(0,q.useState)(``);function P(e){let t=e?[{value:`both`,label:`Restore code and conversation`},{value:`conversation`,label:`Restore conversation`},{value:`code`,label:`Restore code`}]:[{value:`conversation`,label:`Restore conversation`}];return t.push({value:`summarize`,label:`Summarize from here`,type:`input`,placeholder:`add context (optional)`,initialValue:``,allowEmptySubmitToCancel:!0,showLabelWithValue:!0,labelValueSeparator:`: `,onChange:ae}),t.push({value:`nevermind`,label:`Never mind`}),t}(0,q.useEffect)(()=>{},[]);async function oe(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 F(t){let n=e.indexOf(t);if(e.length-1-n,t.type,!e.includes(t)){d();return}if(!g){await oe(t);return}let r=await re(p,t.uuid);D(t),k(r)}async function se(e){if(!E){h(`Message not found.`);return}if(e===`nevermind`){f?d():D(void 0);return}if(Z(e)){t(),j(!0),M(e),h(void 0);try{let e=N.trim()||void 0;await u(E,e,`from`),j(!1),M(null),D(void 0),d()}catch(e){U(e),j(!1),M(null),D(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(E)}catch(e){i=e,U(i)}if(e===`conversation`||e===`both`)try{await n(E)}catch(e){a=e,U(a)}j(!1),D(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 I=xe(),ce=(0,q.useCallback)(()=>{if(E&&!f){D(void 0);return}d()},[d,E,f]),L=(0,q.useCallback)(()=>C(e=>Math.max(0,e-1)),[]),le=(0,q.useCallback)(()=>C(e=>Math.min(y.length-1,e+1)),[y.length]),R=(0,q.useCallback)(()=>C(0),[]),ue=(0,q.useCallback)(()=>C(y.length-1),[y.length]),de=(0,q.useCallback)(()=>{let e=y[S];e&&F(e)},[y,S,F]);l(`confirm:no`,ce,{context:`Confirmation`,isActive:!E}),o({"messageSelector:up":L,"messageSelector:down":le,"messageSelector:top":R,"messageSelector:bottom":ue,"messageSelector:select":de},{context:`MessageSelector`,isActive:!A&&!m&&!E&&T});let[z,B]=(0,q.useState)({});(0,q.useEffect)(()=>{async function t(){g&&Promise.all(y.map(async(t,n)=>{if(t.uuid!==_){let r=ee(p,t.uuid),i=y.at(n+1),a=r?Ve(e,t.uuid,i?.uuid===_?void 0:i?.uuid):void 0;B(a===void 0?e=>({...e,[n]:void 0}):e=>({...e,[n]:a}))}}))}t()},[y,e,_,p,g]);let V=g&&O?.filesChanged&&O.filesChanged.length>0,H=!m&&!E&&!f&&T;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]}),!T&&(0,J.jsx)(c,{children:`Nothing to rewind to yet.`}),!m&&E&&T&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(c,{children:[`Confirm you want to restore `,!O&&`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:E,color:`text`,isCurrent:!1}),(0,J.jsxs)(c,{dimColor:!0,children:[`(`,me(new Date(E.timestamp)),`)`]})]}),(0,J.jsx)(Le,{selectedRestoreOption:ne,canRestoreCode:!!V,diffStatsForRestore:O}),A&&Z(te)?(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:P(!!V),defaultFocusValue:V?`both`:`conversation`,onFocus:e=>ie(e),onChange:e=>se(e),onCancel:()=>f?d():D(void 0)}),V&&(0,J.jsx)(s,{marginBottom:1,children:(0,J.jsxs)(c,{dimColor:!0,children:[i.warning,` Rewinding does not affect files edited manually or via bash.`]})})]}),H&&(0,J.jsxs)(J.Fragment,{children:[g?(0,J.jsx)(c,{children:`Restore the code and/or conversation to the point before…`}):(0,J.jsx)(c,{children:`Restore and fork the conversation to the point before…`}),(0,J.jsx)(s,{width:`100%`,flexDirection:`column`,children:y.slice(w,w+$).map((e,t)=>{let n=w+t,r=n===S,a=e.uuid===_,o=n in z,l=z[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)})})]}),!E&&(0,J.jsx)(c,{dimColor:!0,italic:!0,children:I.pending?(0,J.jsxs)(J.Fragment,{children:[`Press `,I.keyName,` again to exit`]}):(0,J.jsxs)(J.Fragment,{children:[!m&&T&&`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=B(typeof o==`string`?o.trim():l&&Pe(l)?l.text.trim():`(no prompt)`);if(le(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=T(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=T(u,z),r=T(u,`command-args`),i=T(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=h(e.lines,e=>e.startsWith(`+`)),n=h(e.lines,e=>e.startsWith(`-`));o+=t,s+=n}}catch{}}}return{filesChanged:a,insertions:o,deletions:s}}function Q(e){if(e.type!==`user`||Array.isArray(e.message.content)&&e.message.content[0]?.type===`tool_result`||N(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&&!N(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(),de(),M(),Se(),se(),w(),Ce(),Te(),F(),$=7}));export{Q as a,He as i,Ne as n,Ae as o,Ue as r,Fe as t};
@@ -0,0 +1,10 @@
1
+ import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{l as n,o as r}from"./envUtils-QyzA_cFM.js";import{n as i,t as a}from"./figures-5ThXQEtq.js";import{C as o,Gr as s,I as c,N as l,P as u,Pn as d,Rn as f,ai as p,di as m,fi as h,j as g,mt as _,ot as v,t as y,xt as b}from"./src-BX54x08P.js";import{t as x}from"./jsx-runtime-Bb4Xn-E0.js";import{Gt as S,Wt as C,m as w,t as T}from"./settings-D4M13toi.js";import{$i as E,$u as D,$y as O,Bh as k,Cy as A,Du as ee,Dy as te,Eu as j,Ey as ne,Gx as re,Ji as M,KC as N,Mh as P,Ou as F,Px as ie,QS as ae,Qi as oe,Qy as se,Rx as ce,Sa as le,Tu as I,WC as ue,Xy as de,Yy as fe,ZS as L,Zy as pe,aC as me,aS as he,aa as ge,bm as R,bu as _e,da as ve,dd as ye,du as be,ea as xe,ed as Se,fu as Ce,ha as we,hg as Te,jh as z,ku as Ee,ky as De,la as Oe,na as ke,nb as Ae,oS as je,pa as Me,qy as Ne,ra as B,rb as Pe,sC as Fe,sS as Ie,sb as Le,ta as Re,ud as ze,uu as Be,vu as Ve,wu as He,xm as Ue,xu as We,yu as Ge,zh as Ke,zx as qe}from"./loadAgentsDir-uuZYOgKn.js";import{n as Je,t as Ye}from"./cwd-DrEEb4f5.js";import{a as Xe,c as Ze,i as Qe,n as $e,o as et}from"./debug-2pVES-2G.js";import{d as tt,h as nt,o as rt}from"./config-BDn2YIjC.js";import{B as it,L as at,R as ot,q as st}from"./log-L1kqxa_P.js";import{_ as ct,f as lt,p as ut,y as dt}from"./startupProfiler-B9Qv2QGH.js";import{l as ft,o as pt}from"./stringUtils-Cs6E5f-B.js";import{f as mt,h as ht,x as gt}from"./model-CcHyMyBv.js";import{gn as _t,vn as vt}from"./prompt-BfXryFt-.js";import{a as yt,n as bt,r as xt,t as St}from"./projectOnboardingState-nTCycGCD.js";import{n as Ct,t as wt}from"./sleep-xKMbXTJe.js";import{n as Tt,t as Et}from"./systemTheme-Ceakddth.js";import{a as Dt,c as Ot,i as kt}from"./SpinnerGlyph-BR_SiV9L.js";import{n as At,r as jt}from"./PromptInputFooterSuggestions-ChpyD9B7.js";import{n as Mt,t as Nt}from"./useMainLoopModel-Bgxpmn2Q.js";import{n as Pt,t as Ft}from"./modalContext-sU2lfR08.js";import{n as It,r as Lt,t as Rt}from"./statusNoticeHelpers-BoloSeXY.js";import{a as zt,c as Bt,i as Vt,l as Ht,n as Ut,o as Wt,r as Gt,t as Kt,u as qt}from"./logoUtils-B4wCDKs9.js";import{homedir as Jt}from"os";import{relative as Yt}from"path";import{fileURLToPath as Xt}from"url";function Zt(e,t){for(let n of e)if(!t.has(n))return!1;return!0}var Qt=e((()=>{}));function $t(e){if(e.type!==`user`)return!1;let t=Array.isArray(e.message.content)?e.message.content[0]:void 0;return!t||typeof t==`string`||t?.type!==`text`||!t.text.includes(`<task-notification`)||ie(t.text,`status`)!==`completed`?!1:ie(t.text,`summary`)?.startsWith(`Background command `)??!1}function en(e,t){if(!P()||t)return e;let n=[],r=0;for(;r<e.length;){let t=e[r];if($t(t)){let i=0;for(;r<e.length&&$t(e[r]);)i++,r++;i===1?n.push(t):n.push({...t,message:{role:`user`,content:[{type:`text`,text:`<${it}><${at}>completed</${at}><${ot}>${i} background commands completed</${ot}></${it}>`}]}})}else n.push(t),r++}return n}var tn=e((()=>{st(),Te(),z(),M()}));function nn(e){return e.type===`system`&&e.subtype===`stop_hook_summary`&&e.hookLabel!==void 0}function rn(e){let t=[],n=0;for(;n<e.length;){let r=e[n];if(nn(r)){let i=r.hookLabel,a=[];for(;n<e.length;){let t=e[n];if(!nn(t)||t.hookLabel!==i)break;a.push(t),n++}a.length===1?t.push(r):t.push({...r,hookCount:a.reduce((e,t)=>e+t.hookCount,0),hookInfos:a.flatMap(e=>e.hookInfos),hookErrors:a.flatMap(e=>e.hookErrors),preventedContinuation:a.some(e=>e.preventedContinuation),hasOutput:a.some(e=>e.hasOutput),totalDurationMs:Math.max(...a.map(e=>e.totalDurationMs??0))})}else t.push(r),n++}return t}var an=e((()=>{}));function on(e){let t=ln.get(e);return t||(t=new Set(e.filter(e=>e.renderGroupedToolUse).map(e=>e.name)),ln.set(e,t)),t}function sn(e){if(e.type===`assistant`&&e.message?.content&&Array.isArray(e.message.content)&&e.message.content[0]?.type===`tool_use`){let t=e.message.content[0];return{messageId:e.message.id,toolUseId:t.id,toolName:t.name}}return null}function cn(e,t,n=!1){if(n)return{messages:e};let r=on(t),i=new Map;for(let t of e){let e=sn(t);if(e&&r.has(e.toolName)){let n=`${e.messageId}:${e.toolName}`,r=i.get(n)??[];r.push(t),i.set(n,r)}}let a=new Map,o=new Set;for(let[e,t]of i)if(t.length>=2){a.set(e,t);for(let e of t){let t=sn(e);t&&o.add(t.toolUseId)}}let s=new Map;for(let t of e)if(t.type===`user`&&t.message?.content&&Array.isArray(t.message.content))for(let e of t.message.content)e.type===`tool_result`&&o.has(e.tool_use_id)&&s.set(e.tool_use_id,t);let c=[],l=new Set;for(let t of e){let e=sn(t);if(e){let t=`${e.messageId}:${e.toolName}`,n=a.get(t);if(n){if(!l.has(t)){l.add(t);let r=n[0],i=[];for(let e of n){let t=e.message.content[0].id,n=s.get(t);n&&i.push(n)}let a={type:`grouped_tool_use`,toolName:e.toolName,messages:n,results:i,displayMessage:r,uuid:`grouped-${r.uuid}`,timestamp:r.timestamp,messageId:e.messageId};c.push(a)}continue}}if(t.type===`user`&&t.message?.content&&Array.isArray(t.message.content)){let e=t.message.content.filter(e=>e.type===`tool_result`);if(e.length>0&&e.every(e=>o.has(e.tool_use_id)))continue}c.push(t)}return{messages:c}}var ln,un=e((()=>{ln=new WeakMap}));function dn(e){let t=_n.get(e);if(t!==void 0)return t;let n=fn(e).toLowerCase();return _n.set(e,n),n}function fn(e){let t=``;switch(e.type){case`user`:{let n=e.message.content;if(typeof n==`string`)t=gn.has(n)?``:n;else{let r=[];for(let t of n??[])t.type===`text`?gn.has(t.text)||r.push(t.text):t.type===`tool_result`&&r.push(mn(e.toolUseResult));t=r.join(`
2
+ `)}break}case`assistant`:{let n=e.message.content;Array.isArray(n)&&(t=n.flatMap(e=>e.type===`text`?[e.text]:e.type===`tool_use`?[pn(e.input)]:[]).join(`
3
+ `));break}case`attachment`:if(e.attachment.type===`relevant_memories`)t=(e.attachment.memories??[]).map(e=>e.content).join(`
4
+ `);else if(e.attachment.type===`queued_command`&&e.attachment.commandMode!==`task-notification`&&!e.attachment.isMeta){let n=e.attachment.prompt;t=typeof n==`string`?n:n.flatMap(e=>e.type===`text`?[e.text]:[]).join(`
5
+ `)}break;case`collapsed_read_search`:e.relevantMemories&&(t=e.relevantMemories.map(e=>e.content).join(`
6
+ `));break;default:break}let n=t,r=n.indexOf(`<system-reminder>`);for(;r>=0;){let e=n.indexOf(hn,r);if(e<0)break;n=n.slice(0,r)+n.slice(e+18),r=n.indexOf(`<system-reminder>`)}return n}function pn(e){if(!e||typeof e!=`object`)return``;let t=e,n=[];for(let e of[`command`,`pattern`,`file_path`,`path`,`prompt`,`description`,`query`,`url`,`skill`]){let r=t[e];typeof r==`string`&&n.push(r)}for(let e of[`args`,`files`]){let r=t[e];Array.isArray(r)&&r.every(e=>typeof e==`string`)&&n.push(r.join(` `))}return n.join(`
7
+ `)}function mn(e){if(!e||typeof e!=`object`)return typeof e==`string`?e:``;let t=e;if(typeof t.stdout==`string`){let e=typeof t.stderr==`string`?t.stderr:``;return t.stdout+(e?`\n${e}`:``)}if(t.file&&typeof t.file==`object`&&typeof t.file.content==`string`)return t.file.content;let n=[];for(let e of[`content`,`output`,`result`,`text`,`message`]){let r=t[e];typeof r==`string`&&n.push(r)}for(let e of[`filenames`,`lines`,`results`]){let r=t[e];Array.isArray(r)&&r.every(e=>typeof e==`string`)&&n.push(r.join(`
8
+ `))}return n.join(`
9
+ `)}var hn,gn,_n,vn=e((()=>{M(),hn=`</system-reminder>`,gn=new Set([je,Ie]),_n=new WeakMap}));function yn({pose:e=`default`}={}){return(0,bn.jsxs)(c,{flexDirection:`column`,alignItems:`center`,children:[(0,bn.jsx)(u,{color:`clawd_body`,children:` █████ `}),(0,bn.jsx)(u,{color:`clawd_body`,children:`██ ● ● ██`}),(0,bn.jsx)(u,{color:`clawd_body`,children:`██ ▄▄▄ ██`}),(0,bn.jsx)(u,{color:`clawd_body`,children:` █ █ █ █ `})]})}var bn,xn=e((()=>{y(),bn=x()}));function Sn(e){let{title:t,lines:n,footer:r,emptyMessage:i,customContent:a}=e,o=s(t);if(a!==void 0)o=Math.max(o,a.width);else if(n.length===0&&i)o=Math.max(o,s(i));else{let e=Math.max(0,...n.map(e=>e.timestamp?s(e.timestamp):0));for(let t of n){let n=e>0?e:0,r=s(t.text)+(n>0?n+2:0);o=Math.max(o,r)}}return r&&(o=Math.max(o,s(r))),o}function Cn({config:e,actualWidth:t}){let{title:n,lines:r,footer:i,emptyMessage:a,customContent:o}=e,l=Math.max(0,...r.map(e=>e.timestamp?s(e.timestamp):0));return(0,V.jsxs)(c,{flexDirection:`column`,width:t,children:[(0,V.jsx)(u,{bold:!0,color:`claude`,children:n}),o?(0,V.jsxs)(V.Fragment,{children:[o.content,i&&(0,V.jsx)(u,{dimColor:!0,italic:!0,children:dt(i,t)})]}):r.length===0&&a?(0,V.jsx)(u,{dimColor:!0,children:dt(a,t)}):(0,V.jsxs)(V.Fragment,{children:[r.map((e,n)=>{let r=Math.max(10,t-(l>0?l+2:0));return(0,V.jsxs)(u,{children:[l>0&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(u,{dimColor:!0,children:(e.timestamp||``).padEnd(l)}),` `]}),(0,V.jsx)(u,{children:dt(e.text,r)})]},n)}),i&&(0,V.jsx)(u,{dimColor:!0,italic:!0,children:dt(i,t)})]})]})}var V,wn=e((()=>{y(),ct(),V=x()}));function Tn({feeds:e,maxWidth:t}){let n=e.map(e=>Sn(e)),r=Math.max(...n),i=Math.min(r,t);return(0,Dn.jsx)(c,{flexDirection:`column`,children:e.map((t,n)=>(0,Dn.jsxs)(En.Fragment,{children:[(0,Dn.jsx)(Cn,{config:t,actualWidth:i}),n<e.length-1&&(0,Dn.jsx)(o,{color:`claude`,width:i})]},n))})}var En,Dn,On=e((()=>{En=t(p(),1),y(),wn(),Dn=x()}));function kn(e){let t=e.map(e=>{let t=ut(e.modified);return{text:(e.summary&&e.summary!==`No prompt`?e.summary:e.firstPrompt)||``,timestamp:t}});return{title:`Recent activity`,lines:t,footer:t.length>0?`/resume for more`:void 0,emptyMessage:`No recent activity`}}function An(e){let t=e.filter(({isEnabled:e})=>e).sort((e,t)=>Number(e.isComplete)-Number(t.isComplete)).map(({text:e,isComplete:t})=>({text:`${t?`${a.tick} `:``}${e}`})),n=Ye()===Jt()?`Note: You have launched Work Mate in your home directory. For the best experience, launch it in a project directory instead.`:void 0;return n&&t.push({text:n}),{title:`Tips for getting started`,lines:t}}var jn=e((()=>{i(),Je(),ct()}));function H(e,t,n){return Array.from({length:n},()=>({pose:e,offset:t}))}function Mn(){let{pose:e,bounceOffset:t,onClick:n}=Nn();return(0,Fn.jsx)(c,{height:Vn,flexDirection:`column`,onClick:n,children:(0,Fn.jsx)(c,{marginTop:t,flexShrink:0,children:(0,Fn.jsx)(yn,{pose:e})})})}function Nn(){let[e]=(0,Pn.useState)(()=>T().prefersReducedMotion??!1),[t,n]=(0,Pn.useState)(-1),r=(0,Pn.useRef)(In),i=()=>{e||t!==-1||(r.current=Ln[Math.floor(Math.random()*Ln.length)],n(0))};(0,Pn.useEffect)(()=>{if(t===-1)return;if(t>=r.current.length){n(-1);return}let e=setTimeout(n,zn,Bn);return()=>clearTimeout(e)},[t]);let a=r.current,o=t>=0&&t<a.length?a[t]:Rn;return{pose:o.pose,bounceOffset:o.offset,onClick:i}}var Pn,Fn,In,Ln,Rn,zn,Bn,Vn,Hn=e((()=>{Pn=t(p(),1),y(),w(),xn(),Fn=x(),In=[...H(`default`,1,2),...H(`arms-up`,0,3),...H(`default`,0,1),...H(`default`,1,2),...H(`arms-up`,0,3),...H(`default`,0,1)],Ln=[In,[...H(`look-right`,0,5),...H(`look-left`,0,5),...H(`default`,0,1)]],Rn={pose:`default`,offset:0},zn=60,Bn=e=>e+1,Vn=3}));function Un(){let{columns:e}=v(),t=k(e=>e.agent),n=gt(Mt()),{version:r,cwd:i,billingType:a,agentName:o}=Wt(),l=t??o,d=Math.max(e-15,20),f=dt(r,Math.max(d-11,6)),{shouldSplit:p,truncatedModel:m,truncatedBilling:h}=Gt(n,a,d),g=l?d-1-s(l)-3:d,_=qt(i,Math.max(g,10));return(0,U.jsx)(R,{children:(0,U.jsxs)(c,{flexDirection:`row`,gap:2,alignItems:`center`,children:[P()?(0,U.jsx)(Mn,{}):(0,U.jsx)(yn,{}),(0,U.jsxs)(c,{flexDirection:`column`,children:[(0,U.jsxs)(u,{children:[(0,U.jsx)(u,{bold:!0,children:`Work Mate`}),` `,(0,U.jsxs)(u,{dimColor:!0,children:[`v`,f]})]}),p?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(u,{dimColor:!0,children:m}),(0,U.jsx)(u,{dimColor:!0,children:h})]}):(0,U.jsxs)(u,{dimColor:!0,children:[m,` · `,h]}),(0,U.jsx)(u,{dimColor:!0,children:l?`@${l} · ${_}`:_})]})]})})}var U,Wn=e((()=>{Nt(),Le(),y(),Ke(),ct(),z(),Ht(),mt(),Ue(),Hn(),xn(),U=x()}));function Gn(){let e=(0,qn.useMemo)(Kn,[]),t=(0,qn.useMemo)(()=>rt().lastShownEmergencyTip,[]),n=e.tip&&e.tip!==t;return(0,qn.useEffect)(()=>{n&&nt(t=>t.lastShownEmergencyTip===e.tip?t:{...t,lastShownEmergencyTip:e.tip})},[n,e.tip]),n?(0,Jn.jsx)(c,{paddingLeft:2,flexDirection:`column`,children:(0,Jn.jsx)(u,{...e.color===`warning`?{color:`warning`}:e.color===`error`?{color:`error`}:{dimColor:!0},children:e.tip})}):null}function Kn(){return Yn}var qn,Jn,Yn,Xn=e((()=>{qn=t(p(),1),y(),tt(),Jn=x(),Yn={tip:``,color:`dim`}}));function Zn({char:e=`✻`}){let[t]=(0,Qn.useState)(()=>T().prefersReducedMotion??!1),[n,r]=(0,Qn.useState)(t),i=(0,Qn.useRef)(null),[a,o]=_(n?null:50);return(0,Qn.useEffect)(()=>{if(n)return;let e=setTimeout(r,tr,!0);return()=>clearTimeout(e)},[n]),n?(0,$n.jsx)(c,{ref:a,children:(0,$n.jsx)(u,{color:nr,children:e})}):(i.current===null&&(i.current=o),(0,$n.jsx)(c,{ref:a,children:(0,$n.jsx)(u,{color:Ot(kt((o-i.current)/er*360%360)),children:e})}))}var Qn,$n,er,tr,nr,rr=e((()=>{Qn=t(p(),1),S(),y(),w(),Dt(),$n=x(),er=1500,tr=er*2,nr=Ot({r:153,g:153,b:153})}));function ir(){return ht()&&(rt().opus1mMergeNoticeSeenCount??0)<cr}function ar(){let[e]=(0,or.useState)(ir);return(0,or.useEffect)(()=>{if(!e)return;let t=(rt().opus1mMergeNoticeSeenCount??0)+1;nt(e=>(e.opus1mMergeNoticeSeenCount??0)>=t?e:{...e,opus1mMergeNoticeSeenCount:t})},[e]),e?(0,sr.jsxs)(c,{paddingLeft:2,children:[(0,sr.jsx)(Zn,{char:`↑`}),(0,sr.jsx)(u,{dimColor:!0,children:` Opus now defaults to 1M context · 5x more room, same pricing`})]}):null}var or,sr,cr,lr=e((()=>{or=t(p(),1),S(),y(),tt(),mt(),rr(),sr=x(),cr=6}));function ur(){let e=Bt(),{columns:t}=v(),r=yt(),i=me.isSandboxingEnabled(),a=k(e=>e.agent),o=rt(),[l]=(0,dr.useState)(()=>{let e=T().companyAnnouncements;if(!(!e||e.length===0))return o.numStartups===1?e[0]:e[Math.floor(Math.random()*e.length)]});(0,dr.useEffect)(()=>{r&&bt()},[r]),!r&&n(process.env.WORKMATE_FORCE_FULL_LOGO);let d=gt(Mt()),{version:f,cwd:p,billingType:m,agentName:h}=Wt(),_=a??h,y=dt(d,fr-20);if(!r&&!n(process.env.WORKMATE_FORCE_FULL_LOGO))return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(Un,{}),(0,W.jsx)(ar,{}),Xe()&&(0,W.jsxs)(c,{paddingLeft:2,flexDirection:`column`,children:[(0,W.jsx)(u,{color:`warning`,children:`Debug mode enabled`}),(0,W.jsxs)(u,{dimColor:!0,children:[`Logging to: `,et()?`stderr`:$e()]})]}),(0,W.jsx)(Gn,{}),process.env.WORKMATE_TMUX_SESSION&&(0,W.jsxs)(c,{paddingLeft:2,flexDirection:`column`,children:[(0,W.jsxs)(u,{dimColor:!0,children:[`tmux session: `,process.env.WORKMATE_TMUX_SESSION]}),(0,W.jsx)(u,{dimColor:!0,children:process.env.WORKMATE_TMUX_PREFIX_CONFLICTS?`Detach: ${process.env.WORKMATE_TMUX_PREFIX} ${process.env.WORKMATE_TMUX_PREFIX} d (press prefix twice - Work Mate uses ${process.env.WORKMATE_TMUX_PREFIX})`:`Detach: ${process.env.WORKMATE_TMUX_PREFIX} d`})]}),l&&(0,W.jsx)(c,{paddingLeft:2,flexDirection:`column`,children:(0,W.jsx)(u,{children:l})})]});let b=zt(t),x=Tt(rt().theme),S=` ${g(`claude`,x)(`Work Mate`)} ${g(`inactive`,x)(`v${f}`)} `,C=g(`claude`,x)(` Work Mate `);if(b===`compact`){let e=Vt(null);s(e)>t-4&&(e=Vt(null));let n=_?t-4-1-s(_)-3:t-4,r=qt(p,Math.max(n,10));return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(R,{children:(0,W.jsxs)(c,{flexDirection:`column`,borderStyle:`round`,borderColor:`claude`,borderText:{content:C,position:`top`,align:`start`,offset:1},paddingX:1,paddingY:1,alignItems:`center`,width:t,children:[(0,W.jsx)(u,{bold:!0,children:e}),(0,W.jsx)(c,{marginY:1,children:(0,W.jsx)(yn,{})}),(0,W.jsx)(u,{dimColor:!0,children:y}),(0,W.jsx)(u,{dimColor:!0,children:m}),(0,W.jsx)(u,{dimColor:!0,children:_?`@${_} · ${r}`:r})]})}),(0,W.jsx)(ar,{}),i&&(0,W.jsx)(c,{marginTop:1,flexDirection:`column`,children:(0,W.jsx)(u,{color:`warning`,children:`Your bash commands will be sandboxed. Disable with /sandbox.`})})]})}let w=Vt(null),E=`${y} · ${m}`,D=_?fr-1-s(_)-3:fr,O=qt(p,Math.max(D,10)),A=_?`@${_} · ${O}`:O,{leftWidth:ee,rightWidth:te}=Kt(t,b,Ut(w,A,E));return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(R,{children:(0,W.jsx)(c,{flexDirection:`column`,borderStyle:`round`,borderColor:`claude`,borderText:{content:S,position:`top`,align:`start`,offset:3},children:(0,W.jsxs)(c,{flexDirection:b===`horizontal`?`row`:`column`,paddingX:1,gap:1,children:[(0,W.jsxs)(c,{flexDirection:`column`,width:ee,justifyContent:`space-between`,alignItems:`center`,minHeight:9,children:[(0,W.jsx)(c,{marginTop:1,children:(0,W.jsx)(u,{bold:!0,children:w})}),(0,W.jsx)(yn,{}),(0,W.jsxs)(c,{flexDirection:`column`,alignItems:`center`,children:[(0,W.jsx)(u,{dimColor:!0,children:E}),(0,W.jsx)(u,{dimColor:!0,children:A})]})]}),b===`horizontal`&&(0,W.jsx)(c,{height:`100%`,borderStyle:`single`,borderColor:`claude`,borderDimColor:!0,borderTop:!1,borderBottom:!1,borderLeft:!1}),b===`horizontal`&&(0,W.jsx)(Tn,{feeds:r?[An(St()),kn(e)]:[kn(e)],maxWidth:te})]})})}),(0,W.jsx)(ar,{}),Xe()&&(0,W.jsxs)(c,{paddingLeft:2,flexDirection:`column`,children:[(0,W.jsx)(u,{color:`warning`,children:`Debug mode enabled`}),(0,W.jsxs)(u,{dimColor:!0,children:[`Logging to: `,et()?`stderr`:$e()]})]}),(0,W.jsx)(Gn,{}),process.env.WORKMATE_TMUX_SESSION&&(0,W.jsxs)(c,{paddingLeft:2,flexDirection:`column`,children:[(0,W.jsxs)(u,{dimColor:!0,children:[`tmux session: `,process.env.WORKMATE_TMUX_SESSION]}),(0,W.jsx)(u,{dimColor:!0,children:process.env.WORKMATE_TMUX_PREFIX_CONFLICTS?`Detach: ${process.env.WORKMATE_TMUX_PREFIX} ${process.env.WORKMATE_TMUX_PREFIX} d (press prefix twice - Work Mate uses ${process.env.WORKMATE_TMUX_PREFIX})`:`Detach: ${process.env.WORKMATE_TMUX_PREFIX} d`})]}),l&&(0,W.jsx)(c,{paddingLeft:2,flexDirection:`column`,children:(0,W.jsx)(u,{children:l})}),i&&(0,W.jsx)(c,{paddingLeft:2,flexDirection:`column`,children:(0,W.jsx)(u,{color:`warning`,children:`Your bash commands will be sandboxed. Disable with /sandbox.`})})]})}var dr,W,fr,pr=e((()=>{y(),Le(),Ht(),ct(),xn(),On(),jn(),tt(),Et(),w(),Qe(),dr=t(p(),1),xt(),Wn(),Ue(),r(),Xn(),lr(),Fe(),Ke(),Nt(),mt(),W=x(),fr=50}));function mr({message:e,isTranscriptMode:t}){let n=e.message?.content,r=Array.isArray(n)?n:[];if(!(t&&e.type===`assistant`&&e.message?.model&&r.some(e=>e?.type===`text`)))return null;let i=e.message.model;return(0,hr.jsx)(c,{minWidth:s(i)+8,children:(0,hr.jsx)(u,{dimColor:!0,children:i})})}var hr,gr=e((()=>{y(),hr=x()}));function _r({message:e,isTranscriptMode:t}){if(!(t&&e.timestamp&&e.type===`assistant`&&Array.isArray(e.message.content)&&e.message.content.some(e=>e.type===`text`)))return null;let n=new Date(e.timestamp).toLocaleTimeString(`en-US`,{hour:`2-digit`,minute:`2-digit`,hour12:!0});return(0,vr.jsx)(c,{minWidth:s(n),children:(0,vr.jsx)(u,{dimColor:!0,children:n})})}var vr,yr=e((()=>{y(),vr=x()}));function br(e,t,n,r){for(let i=t+1;i<e.length;i++){let t=e[i];if(t?.type===`assistant`){let e=Dr(t.message.content);if(e?.type===`thinking`||e?.type===`redacted_thinking`||e?.type===`tool_use`&&(j(e.name,e.input,n).isCollapsible||r.has(e.id)))continue;return!0}if(!(t?.type===`system`||t?.type===`attachment`)&&!(t?.type===`user`&&Dr(t.message.content)?.type===`tool_result`)){if(t?.type===`grouped_tool_use`){let e=Dr(t.messages[0]?.message.content)?.input;if(j(t.toolName,e,n).isCollapsible)continue}return!0}}return!1}function xr({message:e,isUserContinuation:t,hasContentAfter:n,tools:r,commands:i,verbose:a,inProgressToolUseIDs:o,streamingToolUseIDs:s,screen:l,canAnimate:u,lastThinkingBlockId:d,latestBashOutputUUID:f,columns:p,isLoading:m,lookups:h,shouldCollapseDiffs:g}){let _=l===`transcript`,v=e.type===`grouped_tool_use`,y=e.type===`collapsed_read_search`,b=y&&(F(e,o)||m&&!n),x=v?e.displayMessage:y?I(e):e,S=v||y?[]:xe(e,h),C=Li(e,s,o,v||y?he:Re(e,h),l,h),w=!1;if(u)if(v)w=e.messages.some(e=>{let t=Dr(e.message.content);return t?.type===`tool_use`&&o.has(t.id)});else if(y)w=F(e,o);else{let t=qe(e);w=!t||o.has(t)}let T=_&&x.type===`assistant`&&Array.isArray(x.message.content)&&x.message.content.some(e=>e.type===`text`)&&(x.timestamp||x.message.model),E=(0,Er.jsx)(Be,{message:e,lookups:h,addMargin:!T,containerWidth:T?void 0:p,tools:r,commands:i,verbose:a,inProgressToolUseIDs:o,progressMessagesForMessage:S,shouldAnimate:w,shouldShowDot:!0,isTranscriptMode:_,isStatic:C,isActiveCollapsedGroup:b,isUserContinuation:t,lastThinkingBlockId:d,latestBashOutputUUID:f,shouldCollapseDiffs:g});return T?(0,Er.jsx)(R,{children:(0,Er.jsxs)(c,{width:p,flexDirection:`column`,children:[(0,Er.jsxs)(c,{flexDirection:`row`,justifyContent:`flex-end`,gap:1,marginTop:1,children:[(0,Er.jsx)(_r,{message:x,isTranscriptMode:_}),(0,Er.jsx)(mr,{message:x,isTranscriptMode:_})]}),E]})}):(0,Er.jsx)(R,{children:E})}function Sr(e,t){if(e.type===`grouped_tool_use`)return e.messages.some(e=>{let n=Dr(e.message.content);return n?.type===`tool_use`&&t.has(n.id)});if(e.type===`collapsed_read_search`)return ee(e).some(e=>t.has(e));let n=qe(e);return!!n&&t.has(n)}function Cr(e,t){if(e.type===`grouped_tool_use`)return e.messages.every(e=>{let n=Dr(e.message.content);return n?.type===`tool_use`&&t.has(n.id)});if(e.type===`collapsed_read_search`)return ee(e).every(e=>t.has(e));if(e.type===`assistant`){let n=Dr(e.message.content);if(n?.type===`server_tool_use`)return t.has(n.id)}let n=qe(e);return!n||t.has(n)}function wr(e,t){if(e.message!==t.message||e.screen!==t.screen||e.verbose!==t.verbose||e.message.type===`collapsed_read_search`&&t.screen!==`transcript`||e.columns!==t.columns||e.latestBashOutputUUID===e.message.uuid!=(t.latestBashOutputUUID===t.message.uuid)||e.lastThinkingBlockId!==t.lastThinkingBlockId&&be(t.message))return!1;let n=Sr(e.message,e.streamingToolUseIDs),r=Cr(e.message,e.lookups.resolvedToolUseIDs);return!(n||!r)}var Tr,Er,Dr,Or,kr=e((()=>{Tr=t(p(),1),y(),Ee(),M(),Ce(),Er=x(),gr(),Gi(),yr(),Ue(),Dr=e=>{if(!Array.isArray(e))return;let t=e[0];if(!(t==null||typeof t==`string`))return t},Or=Tr.memo(xr,wr)}));function Ar(e){return e.type===`attachment`&&jr.has(e.attachment.type)}var jr,Mr=e((()=>{jr=new Set(`hook_success.hook_additional_context.hook_cancelled.command_permissions.agent_mention.budget_usd.critical_system_reminder.edited_image_file.edited_text_file.opened_file_in_ide.output_style.plan_mode.plan_mode_exit.plan_mode_reentry.structured_output.todo_reminder.context_efficiency.deferred_tools_delta.mcp_instructions_delta.token_usage.max_turns_reached.task_reminder.auto_mode.auto_mode_exit.output_token_usage.verify_plan_reminder.current_session_memory.compaction_reminder.date_change`.split(`.`))}));function Nr(e){return Ir.filter(t=>t.isActive(e))}var G,Pr,Fr,Ir,Lr=e((()=>{y(),De(),i(),Je(),ct(),Lt(),G=x(),Pr={id:`large-memory-files`,type:`warning`,isActive:e=>ne(e.memoryFiles).length>0,render:e=>(0,G.jsx)(G.Fragment,{children:ne(e.memoryFiles).map(e=>{let t=e.path.startsWith(Ye())?Yt(Ye(),e.path):e.path;return(0,G.jsxs)(c,{flexDirection:`row`,children:[(0,G.jsx)(u,{color:`warning`,children:a.warning}),(0,G.jsxs)(u,{color:`warning`,children:[`Large `,(0,G.jsx)(u,{bold:!0,children:t}),` will impact performance (`,lt(e.content.length),` chars > `,lt(A),`)`,(0,G.jsx)(u,{dimColor:!0,children:` · /memory to edit`})]})]},e.path)})})},Fr={id:`large-agent-descriptions`,type:`warning`,isActive:e=>It(e.agentDefinitions)>Rt,render:e=>{let t=It(e.agentDefinitions);return(0,G.jsxs)(c,{flexDirection:`row`,children:[(0,G.jsx)(u,{color:`warning`,children:a.warning}),(0,G.jsxs)(u,{color:`warning`,children:[`Large cumulative agent descriptions will impact performance (~`,lt(t),` tokens > `,lt(Rt),`)`,(0,G.jsx)(u,{dimColor:!0,children:` · /agents to manage`})]})]})}},Ir=[Pr,Fr]}));function Rr({agentDefinitions:e}={}){let t={config:rt(),agentDefinitions:e,memoryFiles:(0,Br.use)(te())},n=Nr(t);return n.length===0?null:(0,Vr.jsx)(c,{flexDirection:`column`,paddingLeft:1,children:n.map(e=>(0,Vr.jsx)(zr.Fragment,{children:e.render(t)},e.id))})}var zr,Br,Vr,Hr=e((()=>{zr=t(p(),1),Br=t(p(),1),y(),De(),tt(),Lr(),Vr=x()}));function Ur(e,t,n){let r=(0,K.useRef)(new Map),i=(0,K.useRef)(0),a=(0,K.useRef)(0),o=(0,K.useRef)({arr:new Float64Array,version:-1,n:-1}),s=(0,K.useRef)(new Map),c=(0,K.useRef)(new Map),l=(0,K.useRef)(n),u=(0,K.useRef)(!1),d=(0,K.useRef)(null),f=(0,K.useRef)(0);if(l.current!==n){let e=l.current/n;l.current=n;for(let[t,n]of r.current)r.current.set(t,Math.max(1,Math.round(n*e)));i.current++,u.current=!0,f.current=2}let p=f.current>0?d.current:null,m=(0,K.useRef)(0),h=(0,K.useRef)(null);(0,K.useSyncExternalStore)((0,K.useCallback)(t=>e.current?.subscribe(t)??Zr,[e]),()=>{let t=e.current;if(!t)return NaN;let n=t.getScrollTop()+t.getPendingDelta(),r=Math.floor(n/qr);return t.isSticky()?~r:r});let g=e.current?.getScrollTop()??-1,_=e.current?.getPendingDelta()??0,v=e.current?.getViewportHeight()??0,y=e.current?.isSticky()??!0;(0,K.useMemo)(()=>{let e=new Set(t),n=!1;for(let t of r.current.keys())e.has(t)||(r.current.delete(t),n=!0);for(let t of c.current.keys())e.has(t)||c.current.delete(t);n&&i.current++},[t]);let b=t.length;if(o.current.version!==i.current||o.current.n!==b){let e=o.current.arr.length>=b+1?o.current.arr:new Float64Array(b+1);e[0]=0;for(let n=0;n<b;n++)e[n+1]=e[n]+(r.current.get(t[n])??Wr);o.current={arr:e,version:i.current,n:b}}let x=o.current.arr,S=x[b],C,w;if(p)[C,w]=p,C=Math.min(C,b),w=Math.min(w,b);else if(v===0||g<0)C=Math.max(0,b-Kr),w=b;else{if(y){let e=v+Gr;for(C=b;C>0&&S-x[C-1]<e;)C--;w=b}else{let e=m.current,n=v*3,i=Math.min(g,g+_),a=Math.max(g,g+_),o=a-i,c=o>n&&_<0?a-n:i,l=c+Math.min(o,n),u=Math.max(0,c-e),f=l-e,p=u-Gr;{let e=0,t=b;for(;e<t;){let n=e+t>>1;x[n+1]<=p?e=n+1:t=n}C=e}{let e=d.current;if(e&&e[0]<C)for(let n=e[0];n<Math.min(C,e[1]);n++){let e=t[n];if(s.current.has(e)&&!r.current.has(e)){C=n;break}}}let h=v+2*Gr,y=Math.min(b,C+Yr),S=0;for(w=C;w<y&&(S<h||x[w]<f+v+Gr);)S+=r.current.get(t[w])??Jr,w++}let e=v+2*Gr,n=Math.max(0,w-Yr),i=0;for(let e=C;e<w;e++)i+=r.current.get(t[e])??Jr;for(;C>n&&i<e;)C--,i+=r.current.get(t[C])??Jr;let o=d.current,c=Math.abs(g-a.current)+Math.abs(_);if(o&&c>v*2){let[e,t]=o;C<e-Xr&&(C=e-Xr),w>t+Xr&&(w=t+Xr),C>w&&(w=Math.min(C+Xr,b))}a.current=g}f.current>0?f.current--:d.current=[C,w];let T=(0,K.useDeferredValue)(C),E=(0,K.useDeferredValue)(w),D=C<T?T:C,O=w>E?E:w;if((D>O||y)&&(D=C,O=w),_>0&&(O=w),O-D>Yr){let e=(x[D]+x[O])/2;g-m.current<e?O=D+Yr:D=O-Yr}let k=m.current,A=x[D],ee=D===0?0:A+k,te=O===b?1/0:Math.max(A,x[O]-v)+k;(0,K.useLayoutEffect)(()=>{y?e.current?.setClampBounds(void 0,void 0):e.current?.setClampBounds(ee,te)}),(0,K.useLayoutEffect)(()=>{let e=h.current?.yogaNode;if(e&&e.getComputedWidth()>0&&(m.current=e.getComputedTop()),u.current){u.current=!1;return}let t=!1;for(let[e,n]of s.current){let i=n.yogaNode;if(!i)continue;let a=i.getComputedHeight(),o=r.current.get(e);a>0?o!==a&&(r.current.set(e,a),t=!0):i.getComputedWidth()>0&&o!==0&&(r.current.set(e,0),t=!0)}t&&i.current++});let j=(0,K.useCallback)(e=>{let t=c.current.get(e);return t||(t=t=>{if(t)s.current.set(e,t);else{let t=s.current.get(e)?.yogaNode;if(t&&!u.current){let n=t.getComputedHeight();(n>0||t.getComputedWidth()>0)&&r.current.get(e)!==n&&(r.current.set(e,n),i.current++)}s.current.delete(e)}},c.current.set(e,t)),t},[]),ne=(0,K.useCallback)(e=>{let n=s.current.get(t[e])?.yogaNode;return!n||n.getComputedWidth()===0?-1:n.getComputedTop()},[t]),re=(0,K.useCallback)(e=>s.current.get(t[e])??null,[t]),M=(0,K.useCallback)(e=>r.current.get(t[e]),[t]),N=(0,K.useCallback)(t=>{let n=o.current;t<0||t>=n.n||e.current?.scrollTo(n.arr[t]+m.current)},[e]),P=S-x[O];return{range:[D,O],topSpacer:A,bottomSpacer:P,measureRef:j,spacerRef:h,offsets:x,getItemTop:ne,getItemElement:re,getItemHeight:M,scrollToIndex:N}}var K,Wr,Gr,Kr,qr,Jr,Yr,Xr,Zr,Qr=e((()=>{K=t(p(),1),Wr=3,Gr=40,Kr=30,qr=20,Jr=1,Yr=200,Xr=25,Zr=()=>{}}));function $r({children:e}){let[t,n]=(0,q.useState)(null),[r,i]=(0,q.useState)(null);return(0,ii.jsx)(oi.Provider,{value:n,children:(0,ii.jsx)(ci.Provider,{value:i,children:(0,ii.jsx)(ai.Provider,{value:t,children:(0,ii.jsx)(si.Provider,{value:r,children:e})})})})}function ei(){return(0,q.useContext)(ai)}function ti(){return(0,q.useContext)(si)}function ni(e){let t=(0,q.useContext)(oi);(0,q.useEffect)(()=>{if(t)return t(e),()=>t(null)},[t,e])}function ri(e){let t=(0,q.useContext)(ci);(0,q.useEffect)(()=>{if(t)return t(e),()=>t(null)},[t,e])}var q,ii,ai,oi,si,ci,li=e((()=>{q=t(p(),1),ii=x(),ai=(0,q.createContext)(null),oi=(0,q.createContext)(null),si=(0,q.createContext)(null),ci=(0,q.createContext)(null)}));function ui(e){let[t,n]=(0,J.useState)(null),r=(0,J.useRef)(e);r.current=e;let i=(0,J.useRef)(null),a=(0,J.useCallback)(()=>{n(null)},[]),o=(0,J.useCallback)(e=>{let t=Math.max(0,e.getScrollHeight()-e.getViewportHeight());e.getScrollTop()+e.getPendingDelta()>=t||i.current===null&&(i.current=e.getScrollHeight(),n(r.current))},[]),s=(0,J.useCallback)(e=>{e&&e.scrollToBottom()},[]);return(0,J.useEffect)(()=>{t===null?i.current=null:e<t&&(i.current=null,n(null))},[e,t]),{dividerIndex:t,dividerYRef:i,onScrollAway:o,onRepin:a,jumpToNew:s,shiftDivider:(0,J.useCallback)((e,t)=>{n(t=>t===null?null:t+e),i.current!==null&&(i.current+=t)},[])}}function di(e,t){let n=0,r=!1;for(let i=t;i<e.length;i++){let t=e[i];if(t.type===`progress`||t.type===`assistant`&&!fi(t))continue;let a=t.type===`assistant`;a&&!r&&n++,r=a}return n}function fi(e){if(e.type!==`assistant`||!Array.isArray(e.message.content))return!1;for(let t of e.message.content)if(typeof t!=`string`&&t.type===`text`&&t.text.trim()!==``)return!0;return!1}function pi(e,t){if(t===null)return;let n=t;for(;n<e.length&&(e[n]?.type===`progress`||Ar(e[n]));)n++;let r=e[n]?.uuid;if(!r)return;let i=di(e,t);return{firstUnseenUuid:r,count:Math.max(1,i)}}function mi({scrollable:e,bottom:t,overlay:n,bottomFloat:r,modal:i,modalScrollRef:a,scrollRef:o,dividerYRef:s,hidePill:l=!1,hideSticky:d=!1,newMessageCount:p=0,onPillClick:m}){let{rows:h,columns:g}=v(),[_,y]=(0,J.useState)(null),x=(0,J.useMemo)(()=>({setStickyPrompt:y}),[]),S=(0,J.useSyncExternalStore)((0,J.useCallback)(e=>o?.current?.subscribe(e)??(()=>{}),[o]),()=>{let e=o?.current,t=s?.current;return!e||t==null?!1:e.getScrollTop()+e.getPendingDelta()+e.getViewportHeight()<t});if((0,J.useLayoutEffect)(()=>{if(!P())return;let e=f.get(process.stdout);if(e)return e.onHyperlinkClick=e=>{if(e.startsWith(`file:`))try{We(Xt(e))}catch{}else _e(e)},()=>{e.onHyperlinkClick=void 0}},[]),P()){let s=d?null:_,f=s!=null&&s!==`clicked`&&n==null?s:null,v=s!=null&&n==null;return(0,Y.jsxs)($r,{children:[(0,Y.jsx)(c,{flexDirection:`row`,flexGrow:1,overflow:`hidden`,width:`100%`,children:(0,Y.jsxs)(c,{flexDirection:`column`,flexGrow:1,width:g,overflow:`hidden`,children:[(0,Y.jsxs)(c,{flexGrow:1,flexDirection:`column`,overflow:`hidden`,children:[f&&(0,Y.jsx)(gi,{text:f.text,onClick:f.scrollTo}),(0,Y.jsxs)(b,{ref:o,flexGrow:1,flexDirection:`column`,paddingTop:+!v,stickyScroll:!0,children:[(0,Y.jsx)(bi,{value:x,children:e}),n]}),!l&&S&&n==null&&(0,Y.jsx)(hi,{count:p,onClick:m}),r!=null&&(0,Y.jsx)(c,{position:`absolute`,bottom:0,right:0,opaque:!0,children:r})]}),(0,Y.jsxs)(c,{flexDirection:`column`,flexShrink:0,width:`100%`,maxHeight:`50%`,children:[(0,Y.jsx)(_i,{}),(0,Y.jsx)(vi,{}),(0,Y.jsx)(c,{flexDirection:`column`,width:`100%`,flexGrow:1,overflowY:`hidden`,children:t})]})]})}),i!=null&&(0,Y.jsx)(Ft,{value:{rows:h-yi-1,columns:g-4,scrollRef:a??null},children:(0,Y.jsxs)(c,{position:`absolute`,bottom:0,left:0,right:0,maxHeight:h-yi,flexDirection:`column`,overflow:`hidden`,opaque:!0,children:[(0,Y.jsx)(c,{flexShrink:0,children:(0,Y.jsx)(u,{color:`permission`,children:`▔`.repeat(g)})}),(0,Y.jsx)(c,{flexDirection:`column`,paddingX:2,flexShrink:0,overflow:`hidden`,children:i})]})})]})}return(0,Y.jsxs)(Y.Fragment,{children:[e,t,n,i]})}function hi({count:e,onClick:t}){let[n,r]=(0,J.useState)(!1);return(0,Y.jsx)(c,{position:`absolute`,bottom:0,left:0,right:0,justifyContent:`center`,children:(0,Y.jsx)(c,{onClick:t,onMouseEnter:()=>r(!0),onMouseLeave:()=>r(!1),children:(0,Y.jsxs)(u,{backgroundColor:n?`userMessageBackgroundHover`:`userMessageBackground`,dimColor:!0,children:[` `,e>0?`${e} new ${ft(e,`message`)}`:`Jump to bottom`,` `,a.arrowDown,` `]})})})}function gi({text:e,onClick:t}){let[n,r]=(0,J.useState)(!1);return(0,Y.jsx)(c,{flexShrink:0,width:`100%`,height:1,paddingRight:1,backgroundColor:n?`userMessageBackgroundHover`:`userMessageBackground`,onClick:t,onMouseEnter:()=>r(!0),onMouseLeave:()=>r(!1),children:(0,Y.jsxs)(u,{color:`subtle`,wrap:`truncate-end`,children:[a.pointer,` `,e]})})}function _i(){let e=ei();return!e||e.suggestions.length===0?null:(0,Y.jsx)(c,{position:`absolute`,bottom:`100%`,left:0,right:0,paddingX:2,paddingTop:1,flexDirection:`column`,opaque:!0,children:(0,Y.jsx)(At,{suggestions:e.suggestions,selectedSuggestion:e.selectedSuggestion,maxColumnWidth:e.maxColumnWidth,overlay:!0})})}function vi(){let e=ti();return e?(0,Y.jsx)(c,{position:`absolute`,bottom:`100%`,left:0,right:0,opaque:!0,children:e}):null}var J,Y,yi,bi,xi=e((()=>{i(),J=t(p(),1),Pt(),li(),Le(),y(),Ge(),z(),pt(),Mr(),jt(),Y=x(),yi=2,bi=(0,J.createContext)({setStickyPrompt:()=>{}})}));function Si(e){let t=ki.get(e);if(t!==void 0)return t;let n=dn(e);return ki.set(e,n),n}function Ci(e){let t=ji.get(e);if(t!==void 0)return t;let n=wi(e);return ji.set(e,n),n}function wi(e){let t=null;if(e.type===`user`){if(e.isMeta||e.isVisibleInTranscriptOnly)return null;let n=e.message.content[0];if(n?.type!==`text`)return null;t=n.text??null}else if(e.type===`attachment`&&e.attachment.type===`queued_command`&&e.attachment.commandMode!==`task-notification`&&!e.attachment.isMeta){let n=e.attachment.prompt;t=typeof n==`string`?n:n.flatMap(e=>e.type===`text`?[e.text??``]:[]).join(`
10
+ `)}if(t===null)return null;let n=se(t);return n.startsWith(`<`)||n===``?null:n}function Ti({itemKey:e,msg:t,idx:n,measureRef:r,expanded:i,hovered:a,clickable:o,onClickK:s,onEnterK:u,onLeaveK:d,renderItem:f}){return(0,Z.jsx)(c,{ref:r(e),flexDirection:`column`,backgroundColor:i?`userMessageBackgroundHover`:void 0,paddingBottom:i?1:void 0,onClick:o?e=>s(t,e.cellIsBlank):void 0,onMouseEnter:o?()=>u(e):void 0,onMouseLeave:o?()=>d(e):void 0,children:(0,Z.jsx)(l.Provider,{value:a&&!i?`text`:void 0,children:f(t,n)})})}function Ei({messages:e,scrollRef:t,columns:n,itemKey:r,renderItem:i,onItemClick:a,isItemClickable:o,isItemExpanded:s,extractSearchText:l=Si,trackStickyPrompt:u,selectedIndex:d,cursorNavRef:f,setCursor:p,jumpRef:m,onSearchMatchesChange:h,scanElement:g,setPositions:_}){let v=(0,X.useRef)([]),y=(0,X.useRef)(e),b=(0,X.useRef)(r);if(b.current!==r||e.length<v.current.length||e[0]!==y.current[0])v.current=e.map(e=>r(e));else for(let t=v.current.length;t<e.length;t++)v.current.push(r(e[t]));y.current=e,b.current=r;let x=v.current,{range:S,topSpacer:C,bottomSpacer:w,measureRef:T,spacerRef:E,offsets:D,getItemTop:k,getItemElement:A,getItemHeight:ee,scrollToIndex:te}=Ur(t,x,n),[j,ne]=S,re=(0,X.useCallback)(t=>ee(t)!==0&&pe(e[t]),[ee,e]);(0,X.useImperativeHandle)(f,()=>{let n=e=>p?.({uuid:e.uuid,msgType:e.type,expanded:!1,toolName:O(e)?.name}),r=d??-1,i=(t,r,i=re)=>{for(let a=t;a>=0&&a<e.length;a+=r)if(i(a))return n(e[a]),!0;return!1},a=t=>re(t)&&e[t].type===`user`;return{enterCursor:()=>i(e.length-1,-1,a),navigatePrev:()=>i(r-1,-1),navigateNext:()=>{i(r+1,1)||(t.current?.scrollToBottom(),p?.(null))},navigatePrevUser:()=>i(r-1,-1,a),navigateNextUser:()=>i(r+1,1,a),navigateTop:()=>i(0,1),navigateBottom:()=>i(e.length-1,-1),getSelected:()=>r>=0?e[r]??null:null}},[e,d,p,re]);let M=(0,X.useRef)({offsets:D,start:j,getItemElement:A,getItemTop:k,messages:e,scrollToIndex:te});M.current={offsets:D,start:j,getItemElement:A,getItemTop:k,messages:e,scrollToIndex:te},(0,X.useEffect)(()=>{if(d===void 0)return;let e=M.current,n=e.getItemElement(d);n?t.current?.scrollToElement(n,1):e.scrollToIndex(d)},[d,t]);let N=(0,X.useRef)(null),P=(0,X.useRef)({msgIdx:-1,positions:[]}),F=(0,X.useRef)(-1),ie=(0,X.useRef)(0),ae=(0,X.useRef)(0),oe=(0,X.useRef)(()=>{}),se=(0,X.useRef)(()=>{}),ce=(0,X.useRef)({matches:[],ptr:0,screenOrd:0,prefixSum:[]}),le=(0,X.useRef)(-1),I=(0,X.useRef)(!1);function ue(e){let t=M.current.getItemTop(e);return Math.max(0,t-Oi)}function de(e){let n=t.current,{msgIdx:r,positions:i}=P.current;if(!n||i.length===0||r<0){_?.(null);return}let a=Math.max(0,Math.min(e,i.length-1)),o=i[a],s=M.current.getItemTop(r),c=n.getViewportTop(),l=s-n.getScrollTop(),u=n.getViewportHeight(),d=c+l+o.row;(d<c||d>=c+u)&&(n.scrollTo(Math.max(0,s+o.row-Oi)),l=s-n.getScrollTop(),d=c+l+o.row),_?.({positions:i,rowOffset:c+l,currentIdx:a});let f=ce.current,p=f.prefixSum.at(-1)??0,m=(f.prefixSum[f.ptr]??0)+a+1;h?.(p,m),Ze(`highlight(i=${r}, ord=${a}/${i.length}): pos={row:${o.row},col:${o.col}} lo=${l} screenRow=${d} badge=${m}/${p}`)}se.current=de;let[fe,L]=(0,X.useState)(0),me=(0,X.useCallback)(()=>L(e=>e+1),[]);(0,X.useEffect)(()=>{let e=N.current;if(!e)return;let{idx:n,wantLast:r,tries:i}=e,a=t.current;if(!a)return;let{getItemElement:o,getItemTop:s,scrollToIndex:c}=M.current,l=o(n),u=l?.yogaNode?.getComputedHeight()??0;if(!l||u===0){if(i>1){N.current=null,Ze(`seek(i=${n}): no mount after scrollToIndex, skip`),oe.current(r?-1:1);return}N.current={idx:n,wantLast:r,tries:i+1},c(n),me();return}N.current=null,a.scrollTo(Math.max(0,s(n)-Oi));let d=g?.(l)??[];if(P.current={msgIdx:n,positions:d},Ze(`seek(i=${n} t=${i}): ${d.length} positions`),d.length===0){if(++ie.current>20){ie.current=0;return}oe.current(r?-1:1);return}ie.current=0;let f=r?d.length-1:0;ce.current.screenOrd=f,F.current=-1,se.current(f);let p=ae.current;p&&(ae.current=0,oe.current(p))},[fe]);function he(e,n){let r=t.current;if(!r)return;let i=M.current,{getItemElement:a,scrollToIndex:o}=i;if(e<0||e>=i.messages.length)return;_?.(null),P.current={msgIdx:-1,positions:[]},N.current={idx:e,wantLast:n,tries:0};let s=a(e),c=s?.yogaNode?.getComputedHeight()??0;s&&c>0?r.scrollTo(ue(e)):o(e),me()}function ge(e){let t=ce.current,{matches:n,prefixSum:r}=t,i=r.at(-1)??0;if(n.length===0)return;if(N.current){ae.current=e;return}F.current<0&&(F.current=t.ptr);let{positions:a}=P.current,o=t.screenOrd+e;if(o>=0&&o<a.length){t.screenOrd=o,de(o),F.current=-1;return}let s=(t.ptr+e+n.length)%n.length;if(s===F.current){_?.(null),F.current=-1,Ze(`step: wraparound at ptr=${s}, all ${n.length} msgs phantoms`);return}t.ptr=s,t.screenOrd=0,he(n[s],e<0);let c=e<0?r[s+1]??i:r[s]+1;h?.(i,c)}oe.current=ge,(0,X.useImperativeHandle)(m,()=>({jumpToIndex:e=>{let n=t.current;n&&n.scrollTo(ue(e))},setSearchQuery:e=>{N.current=null,P.current={msgIdx:-1,positions:[]},F.current=-1,_?.(null);let n=e.toLowerCase(),r=[],i=[0];if(n){let e=M.current.messages;for(let t=0;t<e.length;t++){let a=l(e[t]),o=a.indexOf(n),s=0;for(;o>=0;)s++,o=a.indexOf(n,o+n.length);s>0&&(r.push(t),i.push(i.at(-1)+s))}}let a=i.at(-1),o=0,s=t.current,{offsets:c,start:u,getItemTop:d}=M.current,f=d(u),p=f>=0?f-c[u]:0;if(r.length>0&&s){let t=le.current>=0?le.current:s.getScrollTop(),n=1/0;for(let e=0;e<r.length;e++){let i=Math.abs(p+c[r[e]]-t);i<=n&&(n=i,o=e)}Ze(`setSearchQuery('${e}'): ${r.length} msgs · ptr=${o} msgIdx=${r[o]} curTop=${t} origin=${p}`)}ce.current={matches:r,ptr:o,screenOrd:0,prefixSum:i},r.length>0?he(r[o],!0):le.current>=0&&s&&s.scrollTo(le.current),h?.(a,r.length>0?i[o+1]??a:0)},nextMatch:()=>ge(1),prevMatch:()=>ge(-1),setAnchor:()=>{let e=t.current;e&&(le.current=e.getScrollTop())},disarmSearch:()=>{_?.(null),N.current=null,P.current={msgIdx:-1,positions:[]},F.current=-1},warmSearchIndex:async()=>{if(I.current)return 0;let e=M.current.messages,t=0,n=performance.now();for(let n=0;n<e.length;n+=500){await Ct(0);let r=performance.now(),i=Math.min(n+500,e.length);for(let t=n;t<i;t++)l(e[t]);t+=performance.now()-r}let r=Math.round(performance.now()-n);return Ze(`warmSearchIndex: ${e.length} msgs · work=${Math.round(t)}ms wall=${r}ms chunks=${Math.ceil(e.length/500)}`),I.current=!0,Math.round(t)}}),[t]);let[R,_e]=(0,X.useState)(null),ve=(0,X.useRef)({onItemClick:a,setHoveredKey:_e});ve.current={onItemClick:a,setHoveredKey:_e};let ye=(0,X.useCallback)((e,t)=>{let n=ve.current;!t&&n.onItemClick&&n.onItemClick(e)},[]),be=(0,X.useCallback)(e=>{ve.current.setHoveredKey(e)},[]),xe=(0,X.useCallback)(e=>{ve.current.setHoveredKey(t=>t===e?null:t)},[]);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(c,{ref:E,height:C,flexShrink:0}),e.slice(j,ne).map((e,t)=>{let n=j+t,r=x[n],c=!!a&&(o?.(e)??!0),l=c&&R===r,u=s?.(e);return(0,Z.jsx)(Ti,{itemKey:r,msg:e,idx:n,measureRef:T,expanded:u,hovered:l,clickable:c,onClickK:ye,onEnterK:be,onLeaveK:xe,renderItem:i},r)}),w>0&&(0,Z.jsx)(c,{height:w,flexShrink:0}),u&&(0,Z.jsx)(Di,{messages:e,start:j,end:ne,offsets:D,getItemTop:k,getItemElement:A,scrollRef:t})]})}function Di({messages:e,start:t,end:n,offsets:r,getItemTop:i,getItemElement:a,scrollRef:o}){let{setStickyPrompt:s}=(0,X.useContext)(bi);(0,X.useSyncExternalStore)((0,X.useCallback)(e=>o.current?.subscribe(e)??Mi,[o]),()=>{let e=o.current;if(!e)return NaN;let t=e.getScrollTop()+e.getPendingDelta();return e.isSticky()?-1-t:t});let c=o.current?.isSticky()??!0,l=Math.max(0,(o.current?.getScrollTop()??0)+(o.current?.getPendingDelta()??0)),u=t,d=-1;for(let e=n-1;e>=t;e--){let t=i(e);if(t>=0){if(t<l)break;d=t}u=e}let f=-1,p=null;if(u>0&&!c)for(let t=u-1;t>=0;t--){let n=Ci(e[t]);if(n===null)continue;let r=i(t);if(!(r>=0&&r+1>=l)){f=t,p=n;break}}let m=d>=0?d-r[u]:0,h=f>=0?Math.max(0,m+r[f]):-1,g=(0,X.useRef)({idx:-1,tries:0}),_=(0,X.useRef)(`none`),v=(0,X.useRef)(-1);return(0,X.useEffect)(()=>{if(g.current.idx>=0)return;if(_.current===`armed`){_.current=`force`;return}let e=_.current===`force`;if(_.current=`none`,!e&&v.current===f)return;if(v.current=f,p===null){s(null);return}let t=p.trimStart(),n=t.search(/\n\s*\n/),r=(n>=0?t.slice(0,n):t).slice(0,Ai).replace(/\s+/g,` `).trim();if(r===``){s(null);return}let i=f,c=h;s({text:r,scrollTo:()=>{s(`clicked`),_.current=`armed`;let e=a(i);e?o.current?.scrollToElement(e,1):(o.current?.scrollTo(c),g.current={idx:i,tries:0})}})}),(0,X.useEffect)(()=>{if(g.current.idx<0)return;let e=a(g.current.idx);e?(o.current?.scrollToElement(e,1),g.current={idx:-1,tries:0}):++g.current.tries>5&&(g.current={idx:-1,tries:0})}),null}var X,Z,Oi,ki,Ai,ji,Mi,Ni=e((()=>{X=t(p(),1),Qr(),y(),Ve(),xi(),Z=x(),Qe(),wt(),vn(),de(),Oi=3,ki=new WeakMap,Ai=500,ji=new WeakMap,Mi=()=>{}}));function Pi(e,t,n=Vi,r=Hi){let i=t.current,a=i?e.findIndex(e=>e.uuid===i.uuid):-1,o=a>=0?a:i?Math.min(i.idx,Math.max(0,e.length-n)):0;e.length-o>n+r&&(o=e.length-n);let s=e[o];return s&&(i?.uuid!==s.uuid||i.idx!==o)?t.current={uuid:s.uuid,idx:o}:!s&&i&&(t.current=null),o}function Fi(e){return(e.type===`assistant`||e.type===`user`?qe(e):null)??e.uuid}function Ii(e,t){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}function Li(e,t,n,r,i,a){if(i===`transcript`)return!0;switch(e.type){case`attachment`:case`user`:case`assistant`:{if(e.type===`assistant`){let t=e.message.content[0];if(t?.type===`server_tool_use`)return a.resolvedToolUseIDs.has(t.id)}let i=qe(e);return i?t.has(i)||n.has(i)||B(i,`PostToolUse`,a)?!1:Zt(r,a.resolvedToolUseIDs):!0}case`system`:return e.subtype!==`api_error`;case`grouped_tool_use`:return e.messages.every(e=>{let t=e.message.content[0];return t?.type===`tool_use`&&a.resolvedToolUseIDs.has(t.id)});case`collapsed_read_search`:return!1;default:return!0}}var Ri,Q,$,zi,Bi,Vi,Hi,Ui,Wi,Gi=e((()=>{h(),Ri=t(p(),1),Q=t(p(),1),Qt(),S(),Le(),y(),Ae(),vt(),L(),tn(),an(),Ee(),tt(),r(),z(),un(),M(),pt(),vn(),pr(),ye(),kr(),de(),Se(),Mr(),Ue(),Hr(),$=x(),ue(),Ni(),zi=Ri.memo(function({agentDefinitions:e}){return(0,$.jsx)(R,{children:(0,$.jsxs)(c,{flexDirection:`column`,gap:1,children:[(0,$.jsx)(ur,{}),(0,$.jsx)(Ri.Suspense,{fallback:null,children:(0,$.jsx)(Rr,{agentDefinitions:e})})]})})}),Bi=30,Vi=200,Hi=50,Ui=({messages:e,tools:t,commands:r,verbose:i,toolJSX:a,toolUseConfirmQueue:s,inProgressToolUseIDs:l,isMessageSelectorVisible:f,conversationId:p,screen:h,streamingToolUses:g,showAllInTranscript:_=!1,agentDefinitions:y,hideLogo:b=!1,isLoading:x,hidePastThinking:S=!1,streamingThinking:w,streamingText:T,unseenDivider:O,scrollRef:k,trackStickyPrompt:A,jumpRef:ee,onSearchMatchesChange:te,scanElement:j,setPositions:ne,disableRenderCap:M=!1,cursor:F=null,setCursor:ie,cursorNavRef:se,renderRange:I})=>{let{columns:ue}=v(),de=Pe(`transcript:toggleShowAll`,`Transcript`,`Ctrl+E`),L=(0,Q.useMemo)(()=>Oe(e).filter(le),[e]),pe=(0,Q.useMemo)(()=>w?w.isStreaming?!0:w.streamingEndedAt?Date.now()-w.streamingEndedAt<3e4:!1:!1,[w]),{lastThinkingBlockId:me,latestBashOutputUUID:he}=(0,Q.useMemo)(()=>{let e=null,t=null,n=S&&!pe;S&&pe&&(e=`streaming`);for(let r=L.length-1;r>=0;r--){let i=L[r];if(i?.type===`user`){let r=i.message.content;if(!t){for(let e of r)if(e.type===`text`){let n=e.text??``;if(n.startsWith(`<bash-stdout`)||n.startsWith(`<bash-stderr`)){t=i.uuid;break}}}n&&!e&&(r.some(e=>e.type===`tool_result`)||(e=`no-thinking`))}else if(i?.type===`assistant`&&n&&!e){let t=i.message.content;for(let n=t.length-1;n>=0;n--)if(t[n]?.type===`thinking`){e=`${i.uuid}:${n}`;break}}if(e!==null&&t)break}return S||(e=null),{lastThinkingBlockId:e,latestBashOutputUUID:t}},[L,S,pe]),R=(0,Q.useMemo)(()=>ke(L),[L]),_e=(0,Q.useMemo)(()=>g.filter(e=>!l.has(e.contentBlock.id)&&!R.has(e.contentBlock.id)),[g,l,R]),ye=(0,Q.useMemo)(()=>_e.flatMap(e=>{let t=re({content:[e.contentBlock]});return t.uuid=Me(e.contentBlock.id,0),Oe([t])}),[_e]),be=h===`transcript`,xe=(0,Q.useMemo)(()=>n(process.env.WORKMATE_DISABLE_VIRTUAL_SCROLL),[]),Se=k!=null&&!xe,Ce=be&&!_&&!Se,Te=(0,Q.useRef)(null),z=(0,Q.useRef)(null),{collapsed:Ee,lookups:De,hasTruncatedMessages:Ae,hiddenMessageCount:je}=(0,Q.useMemo)(()=>{let e=ve((i||P()?L:ce(L,{includeSnipped:!0})).filter(e=>e.type!==`progress`&&!Ar(e)&&we(e,be)),ye),n=Ce?e.slice(-30):e,r=Ce&&e.length>Bi,{messages:a}=cn(n,t,i),o=en(rn(He(a,t)),i),s=E(L,n),c=(()=>{let e=n.at(-1);return e?.type===`assistant`?e.message?.id:void 0})(),l;if(z.current&&z.current.key===s)l=z.current.lookups;else if(z.current&&L.length>=z.current.normalizedCount&&n.length>=z.current.messageCount&&z.current.lastAssistantMsgId===c){let e=ge(z.current.lookups,z.current.normalizedCount,z.current.messageCount,L,n);e?(l=e,z.current={key:s,lookups:l,normalizedCount:L.length,messageCount:n.length,lastAssistantMsgId:c}):(l=oe(L,n),z.current={key:s,lookups:l,normalizedCount:L.length,messageCount:n.length,lastAssistantMsgId:c})}else l=oe(L,n),z.current={key:s,lookups:l,normalizedCount:L.length,messageCount:n.length,lastAssistantMsgId:c};let u=e.length-Bi;return{collapsed:o,lookups:l,hasTruncatedMessages:r,hiddenMessageCount:u}},[i,L,be,ye,Ce,t]),B=(0,Q.useMemo)(()=>{let e=!Se&&!M?Pi(Ee,Te):0;return I?Ee.slice(I[0],I[1]):e>0?Ee.slice(e):Ee},[Ee,I,Se,M]),Fe=(0,Q.useMemo)(()=>new Set(g.map(e=>e.contentBlock.id)),[g]),{dividerBeforeIndex:Ie,selectedIdx:Le}=(0,Q.useMemo)(()=>{if(!O&&!F)return{dividerBeforeIndex:-1,selectedIdx:-1};let e=-1,t=-1,n=O?.firstUnseenUuid.slice(0,24);for(let r=0;r<B.length;r++){let i=B[r];if(e===-1&&n&&i.uuid.slice(0,24)===n&&(e=r),t===-1&&F&&i.uuid===F.uuid&&(t=r),e!==-1&&t!==-1)break}return{dividerBeforeIndex:e,selectedIdx:t}},[O,F,B]),[Re,Be]=(0,Q.useState)(()=>new Set),Ve=(0,Q.useCallback)(e=>{let t=Fi(e);Be(e=>{let n=new Set(e);return n.has(t)?n.delete(t):n.add(t),n})},[]),Ue=(0,Q.useCallback)(e=>Re.size>0&&Re.has(Fi(e)),[Re]),We=(0,Q.useRef)(De);We.current=De;let Ge=(0,Q.useCallback)(e=>{if(e.type===`collapsed_read_search`)return!0;if(e.type===`assistant`){let t=e.message.content,n=Array.isArray(t)?t[0]:void 0;return n!=null&&ae(n)&&n.type===`advisor_tool_result`&&n.content.type===`advisor_result`}if(e.type!==`user`)return!1;let n=e.message.content[0];if(n?.type!==`tool_result`||n.is_error||!e.toolUseResult)return!1;let r=We.current.toolUseByToolUseID.get(n.tool_use_id??``)?.name;return(r?_t(t,r):void 0)?.isResultTruncated?.(e.toolUseResult)??!1},[t]),Ke=(!a||!!a.shouldContinueAnimation)&&!s.length&&!f,qe=l.size>0,{progress:Je}=d(),Ye=(0,Q.useRef)(null),Xe=rt().terminalProgressBarEnabled&&!N();(0,Q.useEffect)(()=>{let e=Xe?qe?`indeterminate`:`completed`:null;Ye.current!==e&&(Ye.current=e,Je(e))},[Je,Xe,qe]),(0,Q.useEffect)(()=>()=>Je(null),[Je]);let Ze=(0,Q.useCallback)(e=>`${e.uuid}-${p}`,[p]),Qe=(e,n)=>{let a=n>0?B[n-1]?.type:void 0,s=e.type===`user`&&a===`user`,u=e.type===`collapsed_read_search`&&(!!T||br(B,n,t,Fe)),d=B.length-1-n>0,f=Ze(e),p=(0,$.jsx)(Or,{message:e,isUserContinuation:s,hasContentAfter:u,tools:t,commands:r,verbose:i||Ue(e)||F?.expanded===!0&&n===Le,inProgressToolUseIDs:l,streamingToolUseIDs:Fe,screen:h,canAnimate:Ke,lastThinkingBlockId:me,latestBashOutputUUID:he,columns:ue,isLoading:x,lookups:De,shouldCollapseDiffs:d},f),m=(0,$.jsx)(fe.Provider,{value:n===Le,children:p},f);return O&&n===Ie?[(0,$.jsx)(c,{marginTop:1,children:(0,$.jsx)(o,{title:`${O.count} new ${ft(O.count,`message`)}`,width:ue,color:`inactive`})},`unseen-divider`),m]:m},$e=(0,Q.useRef)(new WeakMap),et=(0,Q.useCallback)(e=>{let n=$e.current.get(e);if(n!==void 0)return n;let r=dn(e);if(e.type===`user`&&e.toolUseResult&&Array.isArray(e.message.content)){let n=e.message.content.find(e=>e.type===`tool_result`);if(n&&`tool_use_id`in n){let i=De.toolUseByToolUseID.get(n.tool_use_id),a=(i&&_t(t,i.name))?.extractSearchText?.(e.toolUseResult);a!==void 0&&(r=a)}}let i=r.toLowerCase();return $e.current.set(e,i),i},[t,De]);return(0,$.jsxs)($.Fragment,{children:[!b&&!(I&&I[0]>0)&&(0,$.jsx)(zi,{agentDefinitions:y}),Ae&&(0,$.jsx)(o,{title:`${de} to show ${m.bold(je)} previous messages`,width:ue}),be&&_&&je>0&&!M&&(0,$.jsx)(o,{title:`${de} to hide ${m.bold(je)} previous messages`,width:ue}),Se?(0,$.jsx)(Ne.Provider,{value:!0,children:(0,$.jsx)(Ei,{messages:B,scrollRef:k,columns:ue,itemKey:Ze,renderItem:Qe,onItemClick:Ve,isItemClickable:Ge,isItemExpanded:Ue,trackStickyPrompt:A,selectedIndex:Le>=0?Le:void 0,cursorNavRef:se,setCursor:ie,jumpRef:ee,onSearchMatchesChange:te,scanElement:j,setPositions:ne,extractSearchText:et})}):B.flatMap(Qe),T&&(0,$.jsx)(c,{alignItems:`flex-start`,flexDirection:`row`,marginTop:1,width:`100%`,children:(0,$.jsxs)(c,{flexDirection:`row`,children:[(0,$.jsx)(c,{minWidth:2,children:(0,$.jsx)(u,{color:`text`,children:C})}),(0,$.jsx)(c,{flexDirection:`column`,children:(0,$.jsx)(ze,{children:T})})]})}),pe&&w&&(0,$.jsx)(c,{marginTop:1,children:(0,$.jsx)(D,{param:{type:`thinking`,thinking:w.thinking},addMargin:!1,isTranscriptMode:!0,verbose:i,hideInTranscript:!1})})]})},Wi=Ri.memo(Ui,(e,t)=>{let n=Object.keys(e);for(let r of n)if(!(r===`scrollRef`||r===`trackStickyPrompt`||r===`setCursor`||r===`cursorNavRef`||r===`jumpRef`||r===`onSearchMatchesChange`||r===`scanElement`||r===`setPositions`)&&e[r]!==t[r]){if(r===`streamingToolUses`){let n=e.streamingToolUses,r=t.streamingToolUses;if(n.length===r.length&&n.every((e,t)=>e.contentBlock===r[t]?.contentBlock))continue}if(r===`inProgressToolUseIDs`&&Ii(e.inProgressToolUseIDs,t.inProgressToolUseIDs))continue;if(r===`unseenDivider`){let n=e.unseenDivider,r=t.unseenDivider;if(n?.firstUnseenUuid===r?.firstUnseenUuid&&n?.count===r?.count)continue}if(r===`tools`){let n=e.tools,r=t.tools;if(n.length===r.length&&n.every((e,t)=>e.name===r[t]?.name))continue}return!1}return!0})}));export{xi as a,ni as c,pi as i,ri as l,Gi as n,ui as o,mi as r,li as s,Wi as t};