@readmagic/workmate 0.0.27 → 0.0.28

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 (216) hide show
  1. package/dist/chunks/{AddWorkspaceDirectory-DqlPtsVK.js → AddWorkspaceDirectory-Bmgh8VS3.js} +1 -1
  2. package/dist/chunks/{AgentsMdExternalIncludesDialog-rJS5l6yk.js → AgentsMdExternalIncludesDialog-BJfHqScU.js} +1 -1
  3. package/dist/chunks/AgentsMdExternalIncludesDialog-BjbUilCE.js +1 -0
  4. package/dist/chunks/{App-DzRQpRKr.js → App-COdpsR2w.js} +1 -1
  5. package/dist/chunks/{BackgroundTasksDialog-CBhSmdz_.js → BackgroundTasksDialog-WkoL4g5Q.js} +1 -1
  6. package/dist/chunks/{BypassPermissionsModeDialog-zz-lnmJt.js → BypassPermissionsModeDialog-BT9yl0Qt.js} +1 -1
  7. package/dist/chunks/{CustomSelect-CYmc4vRh.js → CustomSelect-t4wXuXWH.js} +1 -1
  8. package/dist/chunks/{DiffDialog-CTUIAcEE.js → DiffDialog-CXZxnb7Y.js} +1 -1
  9. package/dist/chunks/Doctor-B6isid5K.js +1 -0
  10. package/dist/chunks/{Doctor-CLOYkPRR.js → Doctor-COj-tZBc.js} +1 -1
  11. package/dist/chunks/{ExitFlow-CATwJC4c.js → ExitFlow-CcMYH5iI.js} +1 -1
  12. package/dist/chunks/{InvalidConfigDialog-B-9Z58oD.js → InvalidConfigDialog-riLYEaUP.js} +1 -1
  13. package/dist/chunks/{InvalidSettingsDialog-B4EWjbp7.js → InvalidSettingsDialog-BGXl3V1A.js} +1 -1
  14. package/dist/chunks/{KeybindingProviderSetup-Dzg77_Xn.js → KeybindingProviderSetup-syiDgtpB.js} +1 -1
  15. package/dist/chunks/{MCPConnectionManager-CBY8nqdU.js → MCPConnectionManager-C7RmKzJh.js} +1 -1
  16. package/dist/chunks/{MCPToolListView-C7HT6rrl.js → MCPToolListView-CewNLJus.js} +1 -1
  17. package/dist/chunks/{McpParsingWarnings-Dj_Fu5o-.js → McpParsingWarnings-Czze2JPd.js} +1 -1
  18. package/dist/chunks/{MessageSelector-Dw_ERK_Z.js → MessageSelector-Kc6JlnDX.js} +1 -1
  19. package/dist/chunks/{Messages-RBfRELKn.js → Messages-BvFYO4Zn.js} +1 -1
  20. package/dist/chunks/{Onboarding-BRSXxc2E.js → Onboarding-CD_Uv5h9.js} +1 -1
  21. package/dist/chunks/{PromptInputFooterSuggestions-ChpyD9B7.js → PromptInputFooterSuggestions-CHXJsTtQ.js} +1 -1
  22. package/dist/chunks/{PromptInputHelpMenu-CrTT8MKE.js → PromptInputHelpMenu-BZIVCV7V.js} +1 -1
  23. package/dist/chunks/{ProviderSetup-BEV95bnz.js → ProviderSetup-CwMvjmjh.js} +1 -1
  24. package/dist/chunks/{QueryEngine-BBBkZWu2.js → QueryEngine-DAwfp_ht.js} +1 -1
  25. package/dist/chunks/{REPL-BDnZnm__.js → REPL-CtFtb35A.js} +4 -4
  26. package/dist/chunks/REPL-tFT1FGQF.js +1 -0
  27. package/dist/chunks/{ResumeConversation-BuSqBrm1.js → ResumeConversation-CERzSBvg.js} +1 -1
  28. package/dist/chunks/SearchExtraToolsTool-ndh4aEwQ.js +1 -0
  29. package/dist/chunks/{Settings-DYKmPdbd.js → Settings-CPaqWNdP.js} +2 -2
  30. package/dist/chunks/{Spinner-DOI8qqZi.js → Spinner-C0qHjfIY.js} +1 -1
  31. package/dist/chunks/{TextInput-ZKU-x_FD.js → TextInput-ou7ZhpVY.js} +1 -1
  32. package/dist/chunks/{ThemePicker-B69oDgXN.js → ThemePicker-CVFWqSc7.js} +1 -1
  33. package/dist/chunks/{TrustDialog-BSG8Ibh8.js → TrustDialog-CGXv_LF4.js} +1 -1
  34. package/dist/chunks/{ValidationErrorsList-BUYHEft4.js → ValidationErrorsList-CKeHoN2Z.js} +1 -1
  35. package/dist/chunks/{_baseEach-P0u1zIx6.js → _baseEach-BYhqv77g.js} +1 -1
  36. package/dist/chunks/{add-dir-C8RmmyQK.js → add-dir-BSizpuef.js} +1 -1
  37. package/dist/chunks/{agentDisplay-np7CH47m.js → agentDisplay-JKfYFD1m.js} +1 -1
  38. package/dist/chunks/{agents-DRQlR5M1.js → agents-BDTCH6YB.js} +1 -1
  39. package/dist/chunks/{agents-DedoH0Q4.js → agents-MEaV8P2G.js} +1 -1
  40. package/dist/chunks/{allErrors-DvcU0w0F.js → allErrors-Dhnf6rqg.js} +1 -1
  41. package/dist/chunks/{appleTerminalBackup-Bemd4RXh.js → appleTerminalBackup-CN8kS74J.js} +1 -1
  42. package/dist/chunks/backgroundHousekeeping-Bu-zRFCx.js +1 -0
  43. package/dist/chunks/{backgroundHousekeeping-BtEJ6TeC.js → backgroundHousekeeping-CsXlkIg3.js} +1 -1
  44. package/dist/chunks/{banner-CuoceXzz.js → banner-BKOzHotb.js} +1 -1
  45. package/dist/chunks/{branch-ClhlS7f8.js → branch-BllXcYwS.js} +1 -1
  46. package/dist/chunks/bridgeControl-aDnUrYZR.js +2 -0
  47. package/dist/chunks/{btw-B-FLxlx-.js → btw-DzaRBa6o.js} +1 -1
  48. package/dist/chunks/caches-CMF-MmR-.js +1 -0
  49. package/dist/chunks/{caches-Dn8yrJmL.js → caches-CW5YnYNS.js} +1 -1
  50. package/dist/chunks/channel-DVx21qde.js +1 -0
  51. package/dist/chunks/channel-Gw6skpUh.js +1 -0
  52. package/dist/chunks/{clear-BnWv0i65.js → clear-CDQs9_5P.js} +1 -1
  53. package/dist/chunks/commands-CfYMwgP7.js +1 -0
  54. package/dist/chunks/{compact-Banc-SNk.js → compact-6F2tuItE.js} +1 -1
  55. package/dist/chunks/config-BDkzWBnL.js +1 -0
  56. package/dist/chunks/{config-BDn2YIjC.js → config-Bio2EjUK.js} +1 -1
  57. package/dist/chunks/config-C_AEhZrn.js +1 -0
  58. package/dist/chunks/{context-BvDBAyJ9.js → context-TkdzCK3Y.js} +1 -1
  59. package/dist/chunks/{context-noninteractive-CuHHniJn.js → context-noninteractive-BcBo64vo.js} +1 -1
  60. package/dist/chunks/context-noninteractive-oFcnY1Er.js +1 -0
  61. package/dist/chunks/{conversation-Cjaftrrw.js → conversation-CYZyg1U1.js} +1 -1
  62. package/dist/chunks/conversation-DXzlRhNw.js +1 -0
  63. package/dist/chunks/{conversationRecovery-NL05oJb1.js → conversationRecovery-_hWC7JBO.js} +1 -1
  64. package/dist/chunks/{crossProjectResume-BzltC4NJ.js → crossProjectResume-CCo3iZrB.js} +1 -1
  65. package/dist/chunks/{diff--6gQCx_x.js → diff-BzVUPO4Z.js} +1 -1
  66. package/dist/chunks/doctor-B4jQbGQr.js +1 -0
  67. package/dist/chunks/{entry-DWYOrkFS.js → entry-333L52Lo.js} +1 -1
  68. package/dist/chunks/{exit-uKtXb5U3.js → exit-D5DYnRvR.js} +1 -1
  69. package/dist/chunks/{extraUsage-Dr0YXm1w.js → extraUsage-CmgRR-zH.js} +1 -1
  70. package/dist/chunks/extractMemories-CVUrBFMj.js +1 -0
  71. package/dist/chunks/fast-CRhW9zha.js +1 -0
  72. package/dist/chunks/{fast-C5-lNCQi.js → fast-D7oNjaZ3.js} +1 -1
  73. package/dist/chunks/{fetchModelList-9w1E4Ue8.js → fetchModelList-Cv1vWIpC.js} +1 -1
  74. package/dist/chunks/fetchModelList-DIa1HwAJ.js +1 -0
  75. package/dist/chunks/{fileSuggestions-BYD78vcF.js → fileSuggestions-DF3HTRKr.js} +1 -1
  76. package/dist/chunks/{gemini-BNBptTET.js → gemini-ou7_YyXc.js} +1 -1
  77. package/dist/chunks/{generateSessionName-CO2484aJ.js → generateSessionName-CeN9EZNY.js} +1 -1
  78. package/dist/chunks/{goal-j0wdadwM.js → goal-CCxo4Wyf.js} +1 -1
  79. package/dist/chunks/{grok-BpO1ZwK_.js → grok-BMmUcNbI.js} +1 -1
  80. package/dist/chunks/{help-DwhA0qQ6.js → help-CYtogTZk.js} +1 -1
  81. package/dist/chunks/{hooks-DG4_WdZ2.js → hooks-ByVkvodY.js} +1 -1
  82. package/dist/chunks/hooks-CBGUcyCs.js +1 -0
  83. package/dist/chunks/{install-BbmCNCuM.js → install-DIxyfdXG.js} +1 -1
  84. package/dist/chunks/{instrumentation-DpPmDyNF.js → instrumentation-BmHivmxs.js} +3 -3
  85. package/dist/chunks/{job-GcmX1ALd.js → job-D534P26R.js} +1 -1
  86. package/dist/chunks/{launchLocalMemory-CDgT5lst.js → launchLocalMemory-CWXLb3KF.js} +1 -1
  87. package/dist/chunks/{launchOnboarding-uQ_ux9sS.js → launchOnboarding-CocPmwzz.js} +1 -1
  88. package/dist/chunks/loadAgentsDir-Zw648oQO.js +1 -0
  89. package/dist/chunks/{loadAgentsDir-uuZYOgKn.js → loadAgentsDir-bmpKLPdG.js} +343 -343
  90. package/dist/chunks/{loadPluginHooks-QoVXsBjy.js → loadPluginHooks-BIfM53-_.js} +1 -1
  91. package/dist/chunks/{localSearch-yVCDrVrf.js → localSearch-Da8cVYoI.js} +1 -1
  92. package/dist/chunks/localSearch-Dbj8cXyO.js +1 -0
  93. package/dist/chunks/{logoUtils-B4wCDKs9.js → logoUtils-qNuBc2nI.js} +1 -1
  94. package/dist/chunks/{magicDocs-D53lV8b5.js → magicDocs-BsEiBLQl.js} +1 -1
  95. package/dist/chunks/{main-fy_XSXGj.js → main-B31aPMPP.js} +6 -6
  96. package/dist/chunks/managedEnv-DCGLDTP_.js +1 -0
  97. package/dist/chunks/{managedEnv-B8YWmM4A.js → managedEnv-EZ2IirNa.js} +1 -1
  98. package/dist/chunks/{mcp-DCl-Tz-C.js → mcp-BMeWtYCx.js} +1 -1
  99. package/dist/chunks/{mcp--LmEVBRg.js → mcp-CYbesbfl.js} +1 -1
  100. package/dist/chunks/{mcp-CZUVaPb3.js → mcp-Dd8TBfQQ.js} +1 -1
  101. package/dist/chunks/{memory-Bu5ku7y9.js → memory-DtQQGyPS.js} +1 -1
  102. package/dist/chunks/{mode-Bteqe2QG.js → mode-SM8doWgC.js} +1 -1
  103. package/dist/chunks/{model-CHDU5yqH.js → model-C2r-PaR4.js} +1 -1
  104. package/dist/chunks/{model-CcHyMyBv.js → model-Dd3x121y.js} +1 -1
  105. package/dist/chunks/{modelOptions-CJV1R3Jt.js → modelOptions-BQL4gbNk.js} +1 -1
  106. package/dist/chunks/{nativeInstaller-CIUYh1aD.js → nativeInstaller-DMkZdsof.js} +1 -1
  107. package/dist/chunks/{notifications-GLnjirCl.js → notifications-BwS1XsnZ.js} +1 -1
  108. package/dist/chunks/{onChangeAppState-CxGW2d-l.js → onChangeAppState-C9cYQJPF.js} +1 -1
  109. package/dist/chunks/{openai-BpGQT2Iv.js → openai-Bea4I2Od.js} +1 -1
  110. package/dist/chunks/{overlayContext-7wgLio1O.js → overlayContext-C5WPACKC.js} +1 -1
  111. package/dist/chunks/{partition-djFY9gGI.js → partition-CKgWl7p4.js} +1 -1
  112. package/dist/chunks/{permissions-DNedQyLg.js → permissions-Dv_PCfY0.js} +1 -1
  113. package/dist/chunks/{pidLock-CFUBtZck.js → pidLock-CqkC3-nD.js} +2 -2
  114. package/dist/chunks/{plan-DI0n7LIV.js → plan-Ce6wfjjI.js} +1 -1
  115. package/dist/chunks/{plugin-BQ8gRVYF.js → plugin-aK4tDrVg.js} +1 -1
  116. package/dist/chunks/{pluginAutoupdate-CNrHb4RJ.js → pluginAutoupdate-ByokIVEs.js} +1 -1
  117. package/dist/chunks/{pluginBlocklist-CKCsgWdY.js → pluginBlocklist-ByRQaVPu.js} +1 -1
  118. package/dist/chunks/{pluginCliCommands-CACeyIwz.js → pluginCliCommands-Dyk4HYHs.js} +1 -1
  119. package/dist/chunks/{pluginFlagging-CUvkKGOB.js → pluginFlagging-B2ZX5_oB.js} +1 -1
  120. package/dist/chunks/{pluginOperations-Ca_T-HYn.js → pluginOperations-BCvJvfOC.js} +1 -1
  121. package/dist/chunks/{pluginStartupCheck-DftTiXct.js → pluginStartupCheck-QG0d95dE.js} +1 -1
  122. package/dist/chunks/pluginStartupCheck-o_TC7wIt.js +1 -0
  123. package/dist/chunks/{plugins-Divl-P-X.js → plugins-DzsTDNWJ.js} +1 -1
  124. package/dist/chunks/{print-DSHypGJa.js → print-dUT7E1g9.js} +2 -2
  125. package/dist/chunks/{processBashCommand-BLcFmbyG.js → processBashCommand-DtGCgTkF.js} +1 -1
  126. package/dist/chunks/{processSlashCommand-Caif46Gi.js → processSlashCommand-wXblpK2C.js} +1 -1
  127. package/dist/chunks/{projectOnboardingState-nTCycGCD.js → projectOnboardingState-D-_ijZnG.js} +1 -1
  128. package/dist/chunks/prompt-BdH2zk0S.js +1 -0
  129. package/dist/chunks/{prompt-BfXryFt-.js → prompt-BnDapYGL.js} +1 -1
  130. package/dist/chunks/prompt-D0TFER0A.js +1 -0
  131. package/dist/chunks/{protocolHandler-VigBkAQQ.js → protocolHandler-CJO3CRYW.js} +1 -1
  132. package/dist/chunks/{reconciler-B9XFdL4f.js → reconciler-C_HKsocm.js} +1 -1
  133. package/dist/chunks/{refresh-CBHbWTGg.js → refresh-Cm4jZzLa.js} +1 -1
  134. package/dist/chunks/{reject-CBxnwckZ.js → reject-Tug1RmkE.js} +1 -1
  135. package/dist/chunks/{reload-plugins-5eFWrQlL.js → reload-plugins-CL9LWzpq.js} +1 -1
  136. package/dist/chunks/{rename-Cw7cMerG.js → rename-OfKJSazJ.js} +1 -1
  137. package/dist/chunks/{resume-U2D0ybfU.js → resume-BZ42SpS2.js} +1 -1
  138. package/dist/chunks/{runtimeObserver-DOYlxx9H.js → runtimeObserver-BLq2guVy.js} +1 -1
  139. package/dist/chunks/{runtimeObserver-CWaYMJG8.js → runtimeObserver-DT5P2_XL.js} +2 -2
  140. package/dist/chunks/sandbox-adapter-982rx2cm.js +1 -0
  141. package/dist/chunks/{sandbox-toggle-BtiPyjT3.js → sandbox-toggle-DghmaJhK.js} +1 -1
  142. package/dist/chunks/searchExtraTools-B4N1bpy0.js +1 -0
  143. package/dist/chunks/{select-BuTJbu_Q.js → select-CaxQ-BVq.js} +1 -1
  144. package/dist/chunks/sessionFileAccessHooks-BqQ58T7e.js +1 -0
  145. package/dist/chunks/{sessionObserver-cfwD8pV8.js → sessionObserver-DBoZUvWL.js} +1 -1
  146. package/dist/chunks/sessionObserver-qYpA90El.js +1 -0
  147. package/dist/chunks/sessionStorage-CC0v4zMs.js +1 -0
  148. package/dist/chunks/{sessionTracing-DsdcOqvc.js → sessionTracing-5a7HDF4e.js} +1 -1
  149. package/dist/chunks/{setup-DR-KEmxL.js → setup-DVLnIlse.js} +2 -2
  150. package/dist/chunks/{shadowedRuleDetection-DiZUDzxU.js → shadowedRuleDetection-L3tnySui.js} +1 -1
  151. package/dist/chunks/{sideQuestion-CdgUarC2.js → sideQuestion-BJTVma-5.js} +1 -1
  152. package/dist/chunks/sinks-C9NdbjLo.js +1 -0
  153. package/dist/chunks/{sinks-Cy3NqVbk.js → sinks-CV0SWuZW.js} +1 -1
  154. package/dist/chunks/{skillChangeDetector-CVFCJcG7.js → skillChangeDetector-DlodgOyC.js} +1 -1
  155. package/dist/chunks/{skillGapStore-BJV8ZIB1.js → skillGapStore-Cposc03e.js} +2 -2
  156. package/dist/chunks/{skillLifecycle-iO_3s9Ff.js → skillLifecycle-RXQp0JU7.js} +2 -2
  157. package/dist/chunks/{skillSearchPanel-BL5gXTHU.js → skillSearchPanel-B2pjskqk.js} +2 -2
  158. package/dist/chunks/{skills-BEp3_RyT.js → skills-D2ZjMtv4.js} +1 -1
  159. package/dist/chunks/status-BcSkj9nE.js +1 -0
  160. package/dist/chunks/{statusNoticeHelpers-BoloSeXY.js → statusNoticeHelpers-DsrqBOQt.js} +1 -1
  161. package/dist/chunks/switcher-BietN6il.js +1 -0
  162. package/dist/chunks/{switcher-DSt2cVjA.js → switcher-rep86o4_.js} +1 -1
  163. package/dist/chunks/{tasks-DyBUXnQb.js → tasks-B4coTfrq.js} +1 -1
  164. package/dist/chunks/{templateJobs-BBnReWWj.js → templateJobs-C5ukh6H3.js} +1 -1
  165. package/dist/chunks/{terminalSetup-CDpFfqqV.js → terminalSetup-CaGbEVjB.js} +1 -1
  166. package/dist/chunks/{terminalSetup-DedaY1P7.js → terminalSetup-xe_P98fY.js} +1 -1
  167. package/dist/chunks/{theme-BZOy9Iqh.js → theme-7RmvErYJ.js} +1 -1
  168. package/dist/chunks/{tipRegistry-Cl5sdLRX.js → tipRegistry-BYpJZIjR.js} +1 -1
  169. package/dist/chunks/{toolEventObserver-ClwWmVbH.js → toolEventObserver-Dzwzi5Vi.js} +1 -1
  170. package/dist/chunks/{toolPool-DSTbgGmX.js → toolPool-BGfiNj6h.js} +1 -1
  171. package/dist/chunks/{useExitOnCtrlCDWithKeybindings-ClN4NJnB.js → useExitOnCtrlCDWithKeybindings-BT0nexZw.js} +1 -1
  172. package/dist/chunks/useMainLoopModel-QuE7VkgX.js +1 -0
  173. package/dist/chunks/{useManagePlugins-CxHz-gUP.js → useManagePlugins-pGaGzsEg.js} +1 -1
  174. package/dist/chunks/{useMergedTools-BUuWew0-.js → useMergedTools-BLsIT3R_.js} +1 -1
  175. package/dist/chunks/{useSearchInput-BIQN_-Hm.js → useSearchInput-j12K4wEo.js} +1 -1
  176. package/dist/chunks/{useSettingsErrors-BDJCLei_.js → useSettingsErrors-C8VIzdws.js} +1 -1
  177. package/dist/chunks/{util-BHr5l6Bx.js → util-CCEK8oze.js} +1 -1
  178. package/dist/chunks/{validatePlugin-fx1Y8vam.js → validatePlugin-CTVnWx9H.js} +1 -1
  179. package/dist/chunks/{vim-CYjMtnwH.js → vim-BlO9V5_5.js} +1 -1
  180. package/dist/chunks/worktree-BWL0vR4o.js +1 -0
  181. package/dist/chunks/wrapper-B-Q3Illb.js +1 -0
  182. package/dist/chunks/{wrapper-K8ZapJVu.js → wrapper-DVKxC5fR.js} +1 -1
  183. package/dist/cli.js +1 -1
  184. package/package.json +2 -1
  185. package/dist/chunks/AgentsMdExternalIncludesDialog-CgSethgo.js +0 -1
  186. package/dist/chunks/Doctor-CiZNe_qx.js +0 -1
  187. package/dist/chunks/REPL-BHk0vZDf.js +0 -1
  188. package/dist/chunks/SearchExtraToolsTool-CdWB9sO8.js +0 -1
  189. package/dist/chunks/backgroundHousekeeping-B56nFTzq.js +0 -1
  190. package/dist/chunks/caches-D7arwhaa.js +0 -1
  191. package/dist/chunks/commands-AcfFLgl5.js +0 -1
  192. package/dist/chunks/config-BhBcadjZ.js +0 -1
  193. package/dist/chunks/config-Bm5pVdCq.js +0 -1
  194. package/dist/chunks/context-noninteractive-BK2IDLSS.js +0 -1
  195. package/dist/chunks/conversation-B2dX3X4Z.js +0 -1
  196. package/dist/chunks/doctor-CQf8xPZH.js +0 -1
  197. package/dist/chunks/extractMemories-8yvMGZ1J.js +0 -1
  198. package/dist/chunks/fast-aNkj6WvB.js +0 -1
  199. package/dist/chunks/fetchModelList-D2quBF6M.js +0 -1
  200. package/dist/chunks/hooks-B5Wq-KxE.js +0 -1
  201. package/dist/chunks/loadAgentsDir-BBbIAiay.js +0 -1
  202. package/dist/chunks/localSearch-D6MhwvnR.js +0 -1
  203. package/dist/chunks/managedEnv-ulQBH73B.js +0 -1
  204. package/dist/chunks/pluginStartupCheck-Du9yx2P8.js +0 -1
  205. package/dist/chunks/prompt-BZmu5CeK.js +0 -1
  206. package/dist/chunks/prompt-Cogr_WZr.js +0 -1
  207. package/dist/chunks/sandbox-adapter-Df7Wpt77.js +0 -1
  208. package/dist/chunks/searchExtraTools-CbJVb_Zk.js +0 -1
  209. package/dist/chunks/sessionFileAccessHooks-_mxyfQmn.js +0 -1
  210. package/dist/chunks/sessionObserver-BZVgzp3W.js +0 -1
  211. package/dist/chunks/sessionStorage-SC5RfnUP.js +0 -1
  212. package/dist/chunks/sinks-D41OiGE4.js +0 -1
  213. package/dist/chunks/status-6JMz8jmM.js +0 -1
  214. package/dist/chunks/switcher-95d4TrQH.js +0 -1
  215. package/dist/chunks/useMainLoopModel-Bgxpmn2Q.js +0 -1
  216. package/dist/chunks/worktree-CGu_58ue.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-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};
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-bmpKLPdG.js";import{n as x,t as S}from"./TextInput-ou7ZhpVY.js";import{n as C,t as w}from"./select-CaxQ-BVq.js";import{r as T,t as E}from"./directoryCompletion-BC0qRmrz.js";import{r as D,t as O}from"./PromptInputFooterSuggestions-CHXJsTtQ.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 +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-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
+ 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-Bio2EjUK.js";import{n as d}from"./analytics-COpjZpvd.js";import{t as f}from"./select-CaxQ-BVq.js";import{t as p}from"./CustomSelect-t4wXuXWH.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};
@@ -0,0 +1 @@
1
+ import{n as e,t}from"./AgentsMdExternalIncludesDialog-BJfHqScU.js";e();export{t as AgentsMdExternalIncludesDialog};
@@ -1 +1 @@
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};
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-bmpKLPdG.js";import{d as a,h as o,o as s}from"./config-Bio2EjUK.js";import{t as c}from"./fpsMetrics-DIpm2-xw.js";import{n as l,t as u}from"./onChangeAppState-C9cYQJPF.js";i(),t(),a();var d=n();function f({getFpsMetrics:t,stats:n,initialState:i,children:a}){return(0,d.jsx)(c,{getFpsMetrics:t,children:(0,d.jsx)(l,{store:n,children:(0,d.jsx)(r,{initialState:i,onChangeAppState:u,children:(0,d.jsx)(e,{initialState:s().theme,onThemeSave:e=>o(t=>({...t,theme:e})),children:a})})})})}export{f as App};
@@ -1,2 +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(`
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-bmpKLPdG.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-BnDapYGL.js";import{i as ge,t as _e}from"./overlayContext-C5WPACKC.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
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-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};
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-bmpKLPdG.js";import{n as p}from"./analytics-COpjZpvd.js";import{t as m}from"./select-CaxQ-BVq.js";import{t as h}from"./CustomSelect-t4wXuXWH.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};
@@ -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{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
+ 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-CaxQ-BVq.js";import{i as b,t as x}from"./overlayContext-C5WPACKC.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,4 +1,4 @@
1
- import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{n,t as r}from"./figures-5ThXQEtq.js";import{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(`
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-bmpKLPdG.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-C5WPACKC.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
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
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
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(`
@@ -0,0 +1 @@
1
+ import{n as e,t}from"./Doctor-COj-tZBc.js";e();export{t as Doctor};
@@ -1,3 +1,3 @@
1
- import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{i as n,o as r}from"./envUtils-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(`
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-bmpKLPdG.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-Dd3x121y.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-CKeHoN2Z.js";import{n as G,t as le}from"./useExitOnCtrlCDWithKeybindings-BT0nexZw.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-CqkC3-nD.js";import{n as ve,t as ye}from"./McpParsingWarnings-Czze2JPd.js";import{n as be,t as xe}from"./PressEnterToContinue-DE1RxMX_.js";import{n as Se,t as Ce}from"./useSettingsErrors-C8VIzdws.js";import{n as we,t as Te}from"./shadowedRuleDetection-L3tnySui.js";import{n as Ee,r as De,t as K}from"./statusNoticeHelpers-DsrqBOQt.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
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};
@@ -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-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(`
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-bmpKLPdG.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-CaxQ-BVq.js";import{r as j,t as M}from"./Spinner-C0qHjfIY.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-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
+ 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-bmpKLPdG.js";import{C as c,T as l,x as u}from"./debug-2pVES-2G.js";import{t as d}from"./KeybindingProviderSetup-syiDgtpB.js";import{t as f}from"./select-CaxQ-BVq.js";import{t as p}from"./CustomSelect-t4wXuXWH.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-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};
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-CKeHoN2Z.js";import{t as o}from"./select-CaxQ-BVq.js";import{t as s}from"./CustomSelect-t4wXuXWH.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 +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};
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-BwS1XsnZ.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};
@@ -1 +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};
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-bmpKLPdG.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-Tug1RmkE.js";import{n as V,t as H}from"./notifications-BwS1XsnZ.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};
@@ -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,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
+ 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-bmpKLPdG.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-C7RmKzJh.js";import{n as F,t as I}from"./useExitOnCtrlCDWithKeybindings-BT0nexZw.js";import{t as L}from"./select-CaxQ-BVq.js";import{r as R,t as z}from"./Spinner-C0qHjfIY.js";import{t as B}from"./CustomSelect-t4wXuXWH.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-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};
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-bmpKLPdG.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,3 +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(`
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-bmpKLPdG.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-5a7HDF4e.js";import{n as xe,t as Se}from"./useExitOnCtrlCDWithKeybindings-BT0nexZw.js";import{n as Ce,t as we}from"./select-CaxQ-BVq.js";import{r as Te,t as Ee}from"./Spinner-C0qHjfIY.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-DtGCgTkF.js`);return X(await e(_,v,j,r,n),b)}if(_!==null&&!D&&_.startsWith(`/`)){let{processSlashCommand:e}=await import(`./processSlashCommand-wXblpK2C.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
2
  `).slice(0,4).join(`
3
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};
@@ -1,4 +1,4 @@
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(`
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-bmpKLPdG.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-Bio2EjUK.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-Dd3x121y.js";import{gn as _t,vn as vt}from"./prompt-BnDapYGL.js";import{a as yt,n as bt,r as xt,t as St}from"./projectOnboardingState-D-_ijZnG.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-CHXJsTtQ.js";import{n as Mt,t as Nt}from"./useMainLoopModel-QuE7VkgX.js";import{n as Pt,t as Ft}from"./modalContext-sU2lfR08.js";import{n as It,r as Lt,t as Rt}from"./statusNoticeHelpers-DsrqBOQt.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-qNuBc2nI.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
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
3
  `));break}case`attachment`:if(e.attachment.type===`relevant_memories`)t=(e.attachment.memories??[]).map(e=>e.content).join(`
4
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(`
@@ -1 +1 @@
1
- import{o as e}from"./rolldown-runtime-DaDcL9Zw.js";import{Gt as t,H as n,I as r,Lt as i,P as a,ai as o,kt as s,t as c}from"./src-BX54x08P.js";import{t as l}from"./jsx-runtime-Bb4Xn-E0.js";import{Xt as u,qt as d}from"./settings-D4M13toi.js";import{tb as f}from"./loadAgentsDir-uuZYOgKn.js";import{n as p}from"./analytics-COpjZpvd.js";import{n as m,t as h}from"./useExitOnCtrlCDWithKeybindings-ClN4NJnB.js";import{n as g,t as _}from"./select-BuTJbu_Q.js";import{c as v,i as y,s as b}from"./terminalSetup-DedaY1P7.js";import{r as x}from"./Spinner-DOI8qqZi.js";import{n as S,t as C}from"./ThemePicker-B69oDgXN.js";import{n as w,t as T}from"./PressEnterToContinue-DE1RxMX_.js";var E=e(o(),1),D=l();p(),u(),f(),h(),y(),c(),c(),x(),g(),c();var O=58;function k(){let[e]=n(),t=`Welcome to Work Mate`;return d.terminal===`Apple_Terminal`?(0,D.jsx)(A,{theme:e,welcomeMessage:t}):[`light`,`light-daltonized`,`light-ansi`].includes(e)?(0,D.jsxs)(r,{width:O,flexDirection:`column`,children:[(0,D.jsxs)(a,{children:[(0,D.jsxs)(a,{color:`workmateBlue_FOR_SYSTEM_SPINNER`,children:[t,` `]}),(0,D.jsxs)(a,{dimColor:!0,children:[`v`,`0.0.27`,` `]})]}),(0,D.jsx)(a,{children:`…………………………………………………………………………………………………………………………………………………………`}),(0,D.jsx)(a,{children:` ░░░░░░ `}),(0,D.jsx)(a,{children:` ░░░ ░░░░░░░░░░ `}),(0,D.jsx)(a,{children:` ░░░░░░░░░░░░░░░░░░░ `}),(0,D.jsx)(a,{children:` `})]}):(0,D.jsxs)(r,{width:O,flexDirection:`column`,children:[(0,D.jsxs)(a,{children:[(0,D.jsxs)(a,{color:`workmateBlue_FOR_SYSTEM_SPINNER`,children:[t,` `]}),(0,D.jsxs)(a,{dimColor:!0,children:[`v`,`0.0.27`,` `]})]}),(0,D.jsx)(a,{children:`…………………………………………………………………………………………………………………………………………………………`}),(0,D.jsx)(a,{children:` * █████▓▓░ `}),(0,D.jsx)(a,{children:` * ███▓░ ░░ `}),(0,D.jsx)(a,{children:` ░░░░░░ ███▓░ `}),(0,D.jsx)(a,{children:` ░░░ ░░░░░░░░░░ ███▓░ `}),(0,D.jsxs)(a,{children:[(0,D.jsx)(a,{children:` ░░░░░░░░░░░░░░░░░░░ `}),(0,D.jsx)(a,{bold:!0,children:`*`}),(0,D.jsx)(a,{children:` ██▓░░ ▓ `})]}),(0,D.jsx)(a,{children:` ░▓▓███▓▓░ `}),(0,D.jsx)(a,{dimColor:!0,children:` * ░░░░ `}),(0,D.jsx)(a,{dimColor:!0,children:` ░░░░░░░░ `}),(0,D.jsx)(a,{dimColor:!0,children:` * ░░░░░░░░░░░░░░░░ `}),(0,D.jsx)(a,{dimColor:!0,children:` * `})]})}function A({theme:e,welcomeMessage:t}){return[`light`,`light-daltonized`,`light-ansi`].includes(e)?(0,D.jsxs)(r,{width:O,flexDirection:`column`,children:[(0,D.jsxs)(a,{children:[(0,D.jsxs)(a,{color:`workmateBlue_FOR_SYSTEM_SPINNER`,children:[t,` `]}),(0,D.jsxs)(a,{dimColor:!0,children:[`v`,`0.0.27`,` `]})]}),(0,D.jsx)(a,{children:`…………………………………………………………………………………………………………………………………………………………`}),(0,D.jsx)(a,{children:` ░░░░░░ `}),(0,D.jsx)(a,{children:` ░░░ ░░░░░░░░░░ `}),(0,D.jsx)(a,{children:` ░░░░░░░░░░░░░░░░░░░ `}),(0,D.jsx)(a,{children:` `})]}):(0,D.jsxs)(r,{width:O,flexDirection:`column`,children:[(0,D.jsxs)(a,{children:[(0,D.jsxs)(a,{color:`workmateBlue_FOR_SYSTEM_SPINNER`,children:[t,` `]}),(0,D.jsxs)(a,{dimColor:!0,children:[`v`,`0.0.27`,` `]})]}),(0,D.jsx)(a,{children:`…………………………………………………………………………………………………………………………………………………………`}),(0,D.jsx)(a,{children:` * █████▓▓░ `}),(0,D.jsx)(a,{children:` * ███▓░ ░░ `}),(0,D.jsx)(a,{children:` ░░░░░░ ███▓░ `}),(0,D.jsx)(a,{children:` ░░░ ░░░░░░░░░░ ███▓░ `}),(0,D.jsxs)(a,{children:[(0,D.jsx)(a,{children:` ░░░░░░░░░░░░░░░░░░░ `}),(0,D.jsx)(a,{bold:!0,children:`*`}),(0,D.jsx)(a,{children:` ██▓░░ ▓ `})]}),(0,D.jsx)(a,{children:` ░▓▓███▓▓░ `}),(0,D.jsx)(a,{dimColor:!0,children:` * ░░░░ `}),(0,D.jsx)(a,{dimColor:!0,children:` ░░░░░░░░ `}),(0,D.jsx)(a,{dimColor:!0,children:` ░░░░░░░░░░░░░░░░ `})]})}S(),w(),c();var j=(0,E.createContext)({marker:``});function M({children:e}){let{marker:t}=(0,E.useContext)(j);return(0,D.jsxs)(r,{gap:1,children:[(0,D.jsx)(a,{dimColor:!0,children:t}),(0,D.jsx)(r,{flexDirection:`column`,children:e})]})}c();var N=(0,E.createContext)({marker:``});function P({children:e}){let{marker:t}=(0,E.useContext)(N),n=0;for(let t of E.Children.toArray(e))!(0,E.isValidElement)(t)||t.type!==M||n++;let i=String(n).length;return(0,D.jsx)(r,{flexDirection:`column`,children:E.Children.map(e,(e,n)=>{if(!(0,E.isValidElement)(e)||e.type!==M)return e;let r=`${String(n+1).padStart(i)}.`,a=`${t}${r}`;return(0,D.jsx)(N.Provider,{value:{marker:a},children:(0,D.jsx)(j.Provider,{value:{marker:a},children:e})})})})}P.Item=M;var F=P;c(),u();function I({onDone:e}){let[o,c]=(0,E.useState)(0),[l,u]=n();(0,E.useEffect)(()=>{},[]);function f(){if(o<x.length-1){let e=o+1;c(e),x[e]?.id}else e()}function p(e){u(e),f()}let h=m(),g=(0,D.jsx)(r,{marginX:1,children:(0,D.jsx)(C,{onThemeSelect:p,showIntroText:!0,helpText:`To change this later, run /theme`,hideEscToCancel:!0,skipExitHandling:!0})}),y=(0,D.jsxs)(r,{flexDirection:`column`,gap:1,paddingLeft:1,children:[(0,D.jsx)(a,{bold:!0,children:`Before you start, keep in mind:`}),(0,D.jsx)(r,{flexDirection:`column`,width:70,children:(0,D.jsxs)(F,{children:[(0,D.jsxs)(F.Item,{children:[(0,D.jsx)(a,{children:`Always review changes before accepting`}),(0,D.jsxs)(a,{dimColor:!0,wrap:`wrap`,children:[`Work Mate can make mistakes — especially when running commands`,(0,D.jsx)(s,{}),`or editing files. You stay in control of every action.`,(0,D.jsx)(s,{})]})]}),(0,D.jsxs)(F.Item,{children:[(0,D.jsx)(a,{children:`Only use Work Mate on projects you trust`}),(0,D.jsxs)(a,{dimColor:!0,wrap:`wrap`,children:[`Untrusted code could contain prompt injection attacks.`,(0,D.jsx)(s,{}),(0,D.jsx)(i,{url:`https://code.workmate.com/docs/en/security`})]})]})]})}),(0,D.jsx)(T,{})]}),x=[];x.push({id:`theme`,component:g}),x.push({id:`security`,component:y}),v()&&x.push({id:`terminal-setup`,component:(0,D.jsxs)(r,{flexDirection:`column`,gap:1,paddingLeft:1,children:[(0,D.jsx)(a,{bold:!0,children:`Use Work Mate's terminal setup?`}),(0,D.jsxs)(r,{flexDirection:`column`,width:70,gap:1,children:[(0,D.jsxs)(a,{children:[`For the optimal coding experience, enable the recommended settings`,(0,D.jsx)(s,{}),`for your terminal:`,` `,d.terminal===`Apple_Terminal`?`Option+Enter for newlines and visual bell`:`Shift+Enter for newlines`]}),(0,D.jsx)(_,{options:[{label:`Yes, use recommended settings`,value:`install`},{label:`No, maybe later with /terminal-setup`,value:`no`}],onChange:e=>{e===`install`?b(l).catch(()=>{}).finally(f):f()},onCancel:()=>f()}),(0,D.jsx)(a,{dimColor:!0,children:h.pending?(0,D.jsxs)(D.Fragment,{children:[`Press `,h.keyName,` again to exit`]}):(0,D.jsx)(D.Fragment,{children:`Enter to confirm · Esc to skip`})})]})]})});let S=x[o],w=(0,E.useCallback)(()=>{o===x.length-1?e():f()},[o,x.length,e]),O=(0,E.useCallback)(()=>{f()},[o,x.length,e]);return t({"confirm:yes":w},{context:`Confirmation`,isActive:S?.id===`security`}),t({"confirm:no":O},{context:`Confirmation`,isActive:S?.id===`terminal-setup`}),(0,D.jsxs)(r,{flexDirection:`column`,children:[(0,D.jsx)(k,{}),(0,D.jsxs)(r,{flexDirection:`column`,marginTop:1,children:[S?.component,h.pending&&(0,D.jsx)(r,{padding:1,children:(0,D.jsxs)(a,{dimColor:!0,children:[`Press `,h.keyName,` again to exit`]})})]})]})}export{I as Onboarding};
1
+ import{o as e}from"./rolldown-runtime-DaDcL9Zw.js";import{Gt as t,H as n,I as r,Lt as i,P as a,ai as o,kt as s,t as c}from"./src-BX54x08P.js";import{t as l}from"./jsx-runtime-Bb4Xn-E0.js";import{Xt as u,qt as d}from"./settings-D4M13toi.js";import{tb as f}from"./loadAgentsDir-bmpKLPdG.js";import{n as p}from"./analytics-COpjZpvd.js";import{n as m,t as h}from"./useExitOnCtrlCDWithKeybindings-BT0nexZw.js";import{n as g,t as _}from"./select-CaxQ-BVq.js";import{c as v,i as y,s as b}from"./terminalSetup-xe_P98fY.js";import{r as x}from"./Spinner-C0qHjfIY.js";import{n as S,t as C}from"./ThemePicker-CVFWqSc7.js";import{n as w,t as T}from"./PressEnterToContinue-DE1RxMX_.js";var E=e(o(),1),D=l();p(),u(),f(),h(),y(),c(),c(),x(),g(),c();var O=58;function k(){let[e]=n(),t=`Welcome to Work Mate`;return d.terminal===`Apple_Terminal`?(0,D.jsx)(A,{theme:e,welcomeMessage:t}):[`light`,`light-daltonized`,`light-ansi`].includes(e)?(0,D.jsxs)(r,{width:O,flexDirection:`column`,children:[(0,D.jsxs)(a,{children:[(0,D.jsxs)(a,{color:`workmateBlue_FOR_SYSTEM_SPINNER`,children:[t,` `]}),(0,D.jsxs)(a,{dimColor:!0,children:[`v`,`0.0.28`,` `]})]}),(0,D.jsx)(a,{children:`…………………………………………………………………………………………………………………………………………………………`}),(0,D.jsx)(a,{children:` ░░░░░░ `}),(0,D.jsx)(a,{children:` ░░░ ░░░░░░░░░░ `}),(0,D.jsx)(a,{children:` ░░░░░░░░░░░░░░░░░░░ `}),(0,D.jsx)(a,{children:` `})]}):(0,D.jsxs)(r,{width:O,flexDirection:`column`,children:[(0,D.jsxs)(a,{children:[(0,D.jsxs)(a,{color:`workmateBlue_FOR_SYSTEM_SPINNER`,children:[t,` `]}),(0,D.jsxs)(a,{dimColor:!0,children:[`v`,`0.0.28`,` `]})]}),(0,D.jsx)(a,{children:`…………………………………………………………………………………………………………………………………………………………`}),(0,D.jsx)(a,{children:` * █████▓▓░ `}),(0,D.jsx)(a,{children:` * ███▓░ ░░ `}),(0,D.jsx)(a,{children:` ░░░░░░ ███▓░ `}),(0,D.jsx)(a,{children:` ░░░ ░░░░░░░░░░ ███▓░ `}),(0,D.jsxs)(a,{children:[(0,D.jsx)(a,{children:` ░░░░░░░░░░░░░░░░░░░ `}),(0,D.jsx)(a,{bold:!0,children:`*`}),(0,D.jsx)(a,{children:` ██▓░░ ▓ `})]}),(0,D.jsx)(a,{children:` ░▓▓███▓▓░ `}),(0,D.jsx)(a,{dimColor:!0,children:` * ░░░░ `}),(0,D.jsx)(a,{dimColor:!0,children:` ░░░░░░░░ `}),(0,D.jsx)(a,{dimColor:!0,children:` * ░░░░░░░░░░░░░░░░ `}),(0,D.jsx)(a,{dimColor:!0,children:` * `})]})}function A({theme:e,welcomeMessage:t}){return[`light`,`light-daltonized`,`light-ansi`].includes(e)?(0,D.jsxs)(r,{width:O,flexDirection:`column`,children:[(0,D.jsxs)(a,{children:[(0,D.jsxs)(a,{color:`workmateBlue_FOR_SYSTEM_SPINNER`,children:[t,` `]}),(0,D.jsxs)(a,{dimColor:!0,children:[`v`,`0.0.28`,` `]})]}),(0,D.jsx)(a,{children:`…………………………………………………………………………………………………………………………………………………………`}),(0,D.jsx)(a,{children:` ░░░░░░ `}),(0,D.jsx)(a,{children:` ░░░ ░░░░░░░░░░ `}),(0,D.jsx)(a,{children:` ░░░░░░░░░░░░░░░░░░░ `}),(0,D.jsx)(a,{children:` `})]}):(0,D.jsxs)(r,{width:O,flexDirection:`column`,children:[(0,D.jsxs)(a,{children:[(0,D.jsxs)(a,{color:`workmateBlue_FOR_SYSTEM_SPINNER`,children:[t,` `]}),(0,D.jsxs)(a,{dimColor:!0,children:[`v`,`0.0.28`,` `]})]}),(0,D.jsx)(a,{children:`…………………………………………………………………………………………………………………………………………………………`}),(0,D.jsx)(a,{children:` * █████▓▓░ `}),(0,D.jsx)(a,{children:` * ███▓░ ░░ `}),(0,D.jsx)(a,{children:` ░░░░░░ ███▓░ `}),(0,D.jsx)(a,{children:` ░░░ ░░░░░░░░░░ ███▓░ `}),(0,D.jsxs)(a,{children:[(0,D.jsx)(a,{children:` ░░░░░░░░░░░░░░░░░░░ `}),(0,D.jsx)(a,{bold:!0,children:`*`}),(0,D.jsx)(a,{children:` ██▓░░ ▓ `})]}),(0,D.jsx)(a,{children:` ░▓▓███▓▓░ `}),(0,D.jsx)(a,{dimColor:!0,children:` * ░░░░ `}),(0,D.jsx)(a,{dimColor:!0,children:` ░░░░░░░░ `}),(0,D.jsx)(a,{dimColor:!0,children:` ░░░░░░░░░░░░░░░░ `})]})}S(),w(),c();var j=(0,E.createContext)({marker:``});function M({children:e}){let{marker:t}=(0,E.useContext)(j);return(0,D.jsxs)(r,{gap:1,children:[(0,D.jsx)(a,{dimColor:!0,children:t}),(0,D.jsx)(r,{flexDirection:`column`,children:e})]})}c();var N=(0,E.createContext)({marker:``});function P({children:e}){let{marker:t}=(0,E.useContext)(N),n=0;for(let t of E.Children.toArray(e))!(0,E.isValidElement)(t)||t.type!==M||n++;let i=String(n).length;return(0,D.jsx)(r,{flexDirection:`column`,children:E.Children.map(e,(e,n)=>{if(!(0,E.isValidElement)(e)||e.type!==M)return e;let r=`${String(n+1).padStart(i)}.`,a=`${t}${r}`;return(0,D.jsx)(N.Provider,{value:{marker:a},children:(0,D.jsx)(j.Provider,{value:{marker:a},children:e})})})})}P.Item=M;var F=P;c(),u();function I({onDone:e}){let[o,c]=(0,E.useState)(0),[l,u]=n();(0,E.useEffect)(()=>{},[]);function f(){if(o<x.length-1){let e=o+1;c(e),x[e]?.id}else e()}function p(e){u(e),f()}let h=m(),g=(0,D.jsx)(r,{marginX:1,children:(0,D.jsx)(C,{onThemeSelect:p,showIntroText:!0,helpText:`To change this later, run /theme`,hideEscToCancel:!0,skipExitHandling:!0})}),y=(0,D.jsxs)(r,{flexDirection:`column`,gap:1,paddingLeft:1,children:[(0,D.jsx)(a,{bold:!0,children:`Before you start, keep in mind:`}),(0,D.jsx)(r,{flexDirection:`column`,width:70,children:(0,D.jsxs)(F,{children:[(0,D.jsxs)(F.Item,{children:[(0,D.jsx)(a,{children:`Always review changes before accepting`}),(0,D.jsxs)(a,{dimColor:!0,wrap:`wrap`,children:[`Work Mate can make mistakes — especially when running commands`,(0,D.jsx)(s,{}),`or editing files. You stay in control of every action.`,(0,D.jsx)(s,{})]})]}),(0,D.jsxs)(F.Item,{children:[(0,D.jsx)(a,{children:`Only use Work Mate on projects you trust`}),(0,D.jsxs)(a,{dimColor:!0,wrap:`wrap`,children:[`Untrusted code could contain prompt injection attacks.`,(0,D.jsx)(s,{}),(0,D.jsx)(i,{url:`https://code.workmate.com/docs/en/security`})]})]})]})}),(0,D.jsx)(T,{})]}),x=[];x.push({id:`theme`,component:g}),x.push({id:`security`,component:y}),v()&&x.push({id:`terminal-setup`,component:(0,D.jsxs)(r,{flexDirection:`column`,gap:1,paddingLeft:1,children:[(0,D.jsx)(a,{bold:!0,children:`Use Work Mate's terminal setup?`}),(0,D.jsxs)(r,{flexDirection:`column`,width:70,gap:1,children:[(0,D.jsxs)(a,{children:[`For the optimal coding experience, enable the recommended settings`,(0,D.jsx)(s,{}),`for your terminal:`,` `,d.terminal===`Apple_Terminal`?`Option+Enter for newlines and visual bell`:`Shift+Enter for newlines`]}),(0,D.jsx)(_,{options:[{label:`Yes, use recommended settings`,value:`install`},{label:`No, maybe later with /terminal-setup`,value:`no`}],onChange:e=>{e===`install`?b(l).catch(()=>{}).finally(f):f()},onCancel:()=>f()}),(0,D.jsx)(a,{dimColor:!0,children:h.pending?(0,D.jsxs)(D.Fragment,{children:[`Press `,h.keyName,` again to exit`]}):(0,D.jsx)(D.Fragment,{children:`Enter to confirm · Esc to skip`})})]})]})});let S=x[o],w=(0,E.useCallback)(()=>{o===x.length-1?e():f()},[o,x.length,e]),O=(0,E.useCallback)(()=>{f()},[o,x.length,e]);return t({"confirm:yes":w},{context:`Confirmation`,isActive:S?.id===`security`}),t({"confirm:no":O},{context:`Confirmation`,isActive:S?.id===`terminal-setup`}),(0,D.jsxs)(r,{flexDirection:`column`,children:[(0,D.jsx)(k,{}),(0,D.jsxs)(r,{flexDirection:`column`,marginTop:1,children:[S?.component,h.pending&&(0,D.jsx)(r,{padding:1,children:(0,D.jsxs)(a,{dimColor:!0,children:[`Press `,h.keyName,` again to exit`]})})]})]})}export{I as Onboarding};
@@ -1 +1 @@
1
- import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{Gr as n,I as r,P as i,ai as a,ot as o,t as s}from"./src-BX54x08P.js";import{t as c}from"./jsx-runtime-Bb4Xn-E0.js";import{sb as l}from"./loadAgentsDir-uuZYOgKn.js";import{S as u,_ as d,b as f}from"./startupProfiler-B9Qv2QGH.js";function p(e){return e.startsWith(`file-`)?`+`:e.startsWith(`mcp-resource-`)?`◇`:e.startsWith(`agent-`)?`*`:`+`}function m(e){return e.startsWith(`file-`)||e.startsWith(`mcp-resource-`)||e.startsWith(`agent-`)}function h({suggestions:e,selectedSuggestion:t,maxColumnWidth:i,overlay:a}){let{rows:s}=o(),c=a?5:Math.min(6,Math.max(1,s-3));if(e.length===0)return null;let l=i??Math.max(...e.map(e=>n(e.displayText)))+5,u=Math.max(0,Math.min(t-Math.floor(c/2),e.length-c)),d=Math.min(u+c,e.length),f=e.slice(u,d);return(0,_.jsx)(r,{flexDirection:`column`,justifyContent:a?void 0:`flex-end`,children:f.map(n=>(0,_.jsx)(v,{item:n,maxColumnWidth:l,isSelected:n.id===e[t]?.id},n.id))})}var g,_,v,y,b=e((()=>{g=t(a(),1),l(),s(),d(),_=c(),v=(0,g.memo)(function({item:e,maxColumnWidth:t,isSelected:r}){let a=o().columns;if(m(e.id)){let t=p(e.id),o=r?`suggestion`:void 0,s=!r,c=e.id.startsWith(`file-`),l=e.id.startsWith(`mcp-resource-`),d=e.description?3:0,m;if(c){let t=e.description?Math.min(20,n(e.description)):0,r=a-2-4-d-t;m=f(e.displayText,r)}else m=l?u(e.displayText,30):e.displayText;let h=a-2-n(m)-d-4,g;if(e.description){let n=Math.max(0,h),r=u(e.description.replace(/\s+/g,` `),n);g=`${t} ${m} – ${r}`}else g=`${t} ${m}`;return(0,_.jsx)(i,{color:o,dimColor:s,wrap:`truncate`,children:g})}let s=Math.floor(a*.4),c=Math.min(t??n(e.displayText)+5,s),l=e.color||(r?`suggestion`:void 0),d=!r,h=e.displayText;n(h)>c-2&&(h=u(h,c-2));let g=h+` `.repeat(Math.max(0,c-n(h))),v=e.tag?`[${e.tag}] `:``,y=n(v),b=Math.max(0,a-c-y-4),x=e.description?u(e.description.replace(/\s+/g,` `),b):``;return(0,_.jsxs)(i,{wrap:`truncate`,children:[(0,_.jsx)(i,{color:l,dimColor:d,children:g}),v?(0,_.jsx)(i,{color:e.tag===`local`?`ansi:yellow`:void 0,dimColor:e.tag!==`local`,children:v}):null,(0,_.jsx)(i,{color:r?`suggestion`:void 0,dimColor:!r,children:x})]})}),y=(0,g.memo)(h)}));export{y as n,b as r,h as t};
1
+ import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{Gr as n,I as r,P as i,ai as a,ot as o,t as s}from"./src-BX54x08P.js";import{t as c}from"./jsx-runtime-Bb4Xn-E0.js";import{sb as l}from"./loadAgentsDir-bmpKLPdG.js";import{S as u,_ as d,b as f}from"./startupProfiler-B9Qv2QGH.js";function p(e){return e.startsWith(`file-`)?`+`:e.startsWith(`mcp-resource-`)?`◇`:e.startsWith(`agent-`)?`*`:`+`}function m(e){return e.startsWith(`file-`)||e.startsWith(`mcp-resource-`)||e.startsWith(`agent-`)}function h({suggestions:e,selectedSuggestion:t,maxColumnWidth:i,overlay:a}){let{rows:s}=o(),c=a?5:Math.min(6,Math.max(1,s-3));if(e.length===0)return null;let l=i??Math.max(...e.map(e=>n(e.displayText)))+5,u=Math.max(0,Math.min(t-Math.floor(c/2),e.length-c)),d=Math.min(u+c,e.length),f=e.slice(u,d);return(0,_.jsx)(r,{flexDirection:`column`,justifyContent:a?void 0:`flex-end`,children:f.map(n=>(0,_.jsx)(v,{item:n,maxColumnWidth:l,isSelected:n.id===e[t]?.id},n.id))})}var g,_,v,y,b=e((()=>{g=t(a(),1),l(),s(),d(),_=c(),v=(0,g.memo)(function({item:e,maxColumnWidth:t,isSelected:r}){let a=o().columns;if(m(e.id)){let t=p(e.id),o=r?`suggestion`:void 0,s=!r,c=e.id.startsWith(`file-`),l=e.id.startsWith(`mcp-resource-`),d=e.description?3:0,m;if(c){let t=e.description?Math.min(20,n(e.description)):0,r=a-2-4-d-t;m=f(e.displayText,r)}else m=l?u(e.displayText,30):e.displayText;let h=a-2-n(m)-d-4,g;if(e.description){let n=Math.max(0,h),r=u(e.description.replace(/\s+/g,` `),n);g=`${t} ${m} – ${r}`}else g=`${t} ${m}`;return(0,_.jsx)(i,{color:o,dimColor:s,wrap:`truncate`,children:g})}let s=Math.floor(a*.4),c=Math.min(t??n(e.displayText)+5,s),l=e.color||(r?`suggestion`:void 0),d=!r,h=e.displayText;n(h)>c-2&&(h=u(h,c-2));let g=h+` `.repeat(Math.max(0,c-n(h))),v=e.tag?`[${e.tag}] `:``,y=n(v),b=Math.max(0,a-c-y-4),x=e.description?u(e.description.replace(/\s+/g,` `),b):``;return(0,_.jsxs)(i,{wrap:`truncate`,children:[(0,_.jsx)(i,{color:l,dimColor:d,children:g}),v?(0,_.jsx)(i,{color:e.tag===`local`?`ansi:yellow`:void 0,dimColor:e.tag!==`local`,children:v}):null,(0,_.jsx)(i,{color:r?`suggestion`:void 0,dimColor:!r,children:x})]})}),y=(0,g.memo)(h)}));export{y as n,b as r,h as t};