@readmagic/workmate 0.0.27 → 0.0.29

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 (255) hide show
  1. package/dist/chunks/{AddWorkspaceDirectory-DqlPtsVK.js → AddWorkspaceDirectory-C0lrhffT.js} +1 -1
  2. package/dist/chunks/AgentsMdExternalIncludesDialog-DIahWLha.js +1 -0
  3. package/dist/chunks/{AgentsMdExternalIncludesDialog-rJS5l6yk.js → AgentsMdExternalIncludesDialog-Dmjjx4ql.js} +1 -1
  4. package/dist/chunks/App-COz7knHS.js +1 -0
  5. package/dist/chunks/{BackgroundTasksDialog-CBhSmdz_.js → BackgroundTasksDialog-5IkCQ8lN.js} +2 -2
  6. package/dist/chunks/{BypassPermissionsModeDialog-zz-lnmJt.js → BypassPermissionsModeDialog-g1FMGfQF.js} +1 -1
  7. package/dist/chunks/{CustomSelect-CYmc4vRh.js → CustomSelect-BsEd2To5.js} +1 -1
  8. package/dist/chunks/{DiffDialog-CTUIAcEE.js → DiffDialog-Cwf8CdxZ.js} +5 -5
  9. package/dist/chunks/Doctor-CcLoI7tF.js +1 -0
  10. package/dist/chunks/Doctor-GmT5aeAc.js +3 -0
  11. package/dist/chunks/ExitFlow-DPgUFqeC.js +2 -0
  12. package/dist/chunks/{InvalidConfigDialog-B-9Z58oD.js → InvalidConfigDialog-Di6HZYDV.js} +1 -1
  13. package/dist/chunks/{InvalidSettingsDialog-B4EWjbp7.js → InvalidSettingsDialog-BHL-MERJ.js} +1 -1
  14. package/dist/chunks/{KeybindingProviderSetup-Dzg77_Xn.js → KeybindingProviderSetup-eE3o0bfp.js} +1 -1
  15. package/dist/chunks/MCPConnectionManager-D-qpUJLV.js +1 -0
  16. package/dist/chunks/MCPToolListView-DtHRw4jQ.js +1 -0
  17. package/dist/chunks/{McpParsingWarnings-Dj_Fu5o-.js → McpParsingWarnings-ByyErvR3.js} +1 -1
  18. package/dist/chunks/MessageSelector-CFz30wBL.js +3 -0
  19. package/dist/chunks/Messages-CfY-Oj3M.js +10 -0
  20. package/dist/chunks/{Onboarding-BRSXxc2E.js → Onboarding-BfWLRx3n.js} +1 -1
  21. package/dist/chunks/{PromptInputFooterSuggestions-ChpyD9B7.js → PromptInputFooterSuggestions-BRyJj7XR.js} +1 -1
  22. package/dist/chunks/{PromptInputHelpMenu-CrTT8MKE.js → PromptInputHelpMenu-DLuRCXVS.js} +1 -1
  23. package/dist/chunks/{ProviderSetup-BEV95bnz.js → ProviderSetup-CKZGG2B9.js} +1 -1
  24. package/dist/chunks/QueryEngine-B27MOtBA.js +1 -0
  25. package/dist/chunks/{REPL-BDnZnm__.js → REPL-DMRD5wSN.js} +23 -23
  26. package/dist/chunks/REPL-gzolQvzu.js +1 -0
  27. package/dist/chunks/ResumeConversation-7eURPHmQ.js +1 -0
  28. package/dist/chunks/SearchExtraToolsTool-BINZTstr.js +1 -0
  29. package/dist/chunks/Settings-4TNYpfUs.js +2 -0
  30. package/dist/chunks/Spinner-BgjmQLjw.js +1 -0
  31. package/dist/chunks/{TextInput-ZKU-x_FD.js → TextInput-BVEWdRz9.js} +5 -5
  32. package/dist/chunks/{ThemePicker-B69oDgXN.js → ThemePicker-th2jdUjh.js} +1 -1
  33. package/dist/chunks/{TrustDialog-BSG8Ibh8.js → TrustDialog-YsYqHyRR.js} +1 -1
  34. package/dist/chunks/{ValidationErrorsList-BUYHEft4.js → ValidationErrorsList-CKeHoN2Z.js} +1 -1
  35. package/dist/chunks/{_baseEach-P0u1zIx6.js → _baseEach-Bz5fQbIq.js} +1 -1
  36. package/dist/chunks/{add-dir-C8RmmyQK.js → add-dir-BsO6l8Ue.js} +1 -1
  37. package/dist/chunks/{agentDisplay-np7CH47m.js → agentDisplay-ChkgiTIH.js} +1 -1
  38. package/dist/chunks/{agents-DedoH0Q4.js → agents-BV1nan6b.js} +6 -6
  39. package/dist/chunks/{agents-DRQlR5M1.js → agents-DqEB6iwV.js} +1 -1
  40. package/dist/chunks/allErrors-CkdguCDv.js +1 -0
  41. package/dist/chunks/{appleTerminalBackup-Bemd4RXh.js → appleTerminalBackup-CN8kS74J.js} +1 -1
  42. package/dist/chunks/{backgroundHousekeeping-BtEJ6TeC.js → backgroundHousekeeping-1VsWy8xd.js} +1 -1
  43. package/dist/chunks/backgroundHousekeeping-pMtrl4K2.js +1 -0
  44. package/dist/chunks/{banner-CuoceXzz.js → banner-BKOzHotb.js} +1 -1
  45. package/dist/chunks/{branch-ClhlS7f8.js → branch-CTIHtpwz.js} +2 -2
  46. package/dist/chunks/bridgeControl-C8xaGuwO.js +2 -0
  47. package/dist/chunks/{btw-B-FLxlx-.js → btw-BA39Zrhm.js} +1 -1
  48. package/dist/chunks/caches-DHZHqVhf.js +1 -0
  49. package/dist/chunks/caches-fqs-Y-kW.js +1 -0
  50. package/dist/chunks/channel-B5FkNSZ3.js +1 -0
  51. package/dist/chunks/channel-C5yKM1wf.js +1 -0
  52. package/dist/chunks/{clear-BnWv0i65.js → clear-BmlaYYrD.js} +1 -1
  53. package/dist/chunks/commands-EUcHifS4.js +1 -0
  54. package/dist/chunks/compact-D3uePeI7.js +2 -0
  55. package/dist/chunks/{config-BDn2YIjC.js → config-Bio2EjUK.js} +1 -1
  56. package/dist/chunks/config-C_AEhZrn.js +1 -0
  57. package/dist/chunks/config-GgGdlJ9h.js +1 -0
  58. package/dist/chunks/{context-BvDBAyJ9.js → context-CBEWyVpE.js} +1 -1
  59. package/dist/chunks/{context-noninteractive-CuHHniJn.js → context-noninteractive-B03nuxfN.js} +2 -2
  60. package/dist/chunks/context-noninteractive-BLCyyyGL.js +1 -0
  61. package/dist/chunks/conversation-BFL0rEIx.js +1 -0
  62. package/dist/chunks/conversation-D-ker4RO.js +1 -0
  63. package/dist/chunks/{conversationRecovery-NL05oJb1.js → conversationRecovery-Bt84CYO6.js} +1 -1
  64. package/dist/chunks/crossProjectResume-DwlYY6lV.js +40 -0
  65. package/dist/chunks/{diff--6gQCx_x.js → diff-CewYzu3Y.js} +1 -1
  66. package/dist/chunks/doctor-CrQ0UfG2.js +1 -0
  67. package/dist/chunks/{entry-DWYOrkFS.js → entry-DdVUdGWV.js} +3 -3
  68. package/dist/chunks/exit-QwCo2aJo.js +1 -0
  69. package/dist/chunks/{extraUsage-Dr0YXm1w.js → extraUsage-Cu0aV35i.js} +1 -1
  70. package/dist/chunks/extractMemories-DHlbRc5g.js +1 -0
  71. package/dist/chunks/{fast-C5-lNCQi.js → fast-BlhpCQ2f.js} +1 -1
  72. package/dist/chunks/fast-C3JeBy3A.js +1 -0
  73. package/dist/chunks/{fetchModelList-9w1E4Ue8.js → fetchModelList-DjFCMjVN.js} +1 -1
  74. package/dist/chunks/fetchModelList-L2XarfAj.js +1 -0
  75. package/dist/chunks/{fileSuggestions-BYD78vcF.js → fileSuggestions-BRwKV_KA.js} +2 -2
  76. package/dist/chunks/{gemini-BNBptTET.js → gemini-I-M5_sUA.js} +2 -2
  77. package/dist/chunks/{generateSessionName-CO2484aJ.js → generateSessionName-CJ0sh6HD.js} +1 -1
  78. package/dist/chunks/{goal-j0wdadwM.js → goal-DIrBBT5J.js} +3 -3
  79. package/dist/chunks/{grok-BpO1ZwK_.js → grok-ZLjJN6b9.js} +1 -1
  80. package/dist/chunks/{help-DwhA0qQ6.js → help-CDMjVOl6.js} +1 -1
  81. package/dist/chunks/{hooks-DG4_WdZ2.js → hooks-BNKCE023.js} +2 -2
  82. package/dist/chunks/hooks-ERYtmuNW.js +1 -0
  83. package/dist/chunks/{install-BbmCNCuM.js → install-xlfTw1j6.js} +1 -1
  84. package/dist/chunks/{instrumentation-DpPmDyNF.js → instrumentation-DSt0UvGn.js} +3 -3
  85. package/dist/chunks/{job-GcmX1ALd.js → job-BVElGsu0.js} +1 -1
  86. package/dist/chunks/{launchLocalMemory-CDgT5lst.js → launchLocalMemory-DUkJCKmd.js} +2 -2
  87. package/dist/chunks/{launchOnboarding-uQ_ux9sS.js → launchOnboarding-BvD-E_jC.js} +1 -1
  88. package/dist/chunks/loadAgentsDir-BImZsKrh.js +1 -0
  89. package/dist/chunks/{loadAgentsDir-uuZYOgKn.js → loadAgentsDir-BfLCckVj.js} +343 -343
  90. package/dist/chunks/loadPluginHooks-BPwWtBzO.js +1 -0
  91. package/dist/chunks/{localSearch-yVCDrVrf.js → localSearch-BHG8sp8p.js} +1 -1
  92. package/dist/chunks/localSearch-D3rvcRRC.js +1 -0
  93. package/dist/chunks/{logoUtils-B4wCDKs9.js → logoUtils-BsNLv-qi.js} +1 -1
  94. package/dist/chunks/{magicDocs-D53lV8b5.js → magicDocs-Bue9vxzY.js} +2 -2
  95. package/dist/chunks/{main-fy_XSXGj.js → main-U71X4Thd.js} +22 -22
  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-CZUVaPb3.js → mcp-C4CxCMwJ.js} +3 -3
  99. package/dist/chunks/mcp-D9HFARDy.js +1 -0
  100. package/dist/chunks/mcp-De3QGKvT.js +2 -0
  101. package/dist/chunks/memory-DVRdJFfI.js +1 -0
  102. package/dist/chunks/{mode-Bteqe2QG.js → mode-Bd5w-RBX.js} +2 -2
  103. package/dist/chunks/{model-CHDU5yqH.js → model-BCIcUhrc.js} +1 -1
  104. package/dist/chunks/{model-CcHyMyBv.js → model-BIf2i1is.js} +1 -1
  105. package/dist/chunks/{modelOptions-CJV1R3Jt.js → modelOptions-COIU5U3w.js} +1 -1
  106. package/dist/chunks/{nativeInstaller-CIUYh1aD.js → nativeInstaller-CGSNzGNn.js} +1 -1
  107. package/dist/chunks/{notifications-GLnjirCl.js → notifications-B5gzCmPC.js} +1 -1
  108. package/dist/chunks/{onChangeAppState-CxGW2d-l.js → onChangeAppState-NWwSE-I4.js} +1 -1
  109. package/dist/chunks/{openai-BpGQT2Iv.js → openai-CyJ3m4dI.js} +2 -2
  110. package/dist/chunks/{overlayContext-7wgLio1O.js → overlayContext-DYrGDe63.js} +1 -1
  111. package/dist/chunks/{partition-djFY9gGI.js → partition-BavNaw1S.js} +1 -1
  112. package/dist/chunks/permissions-CLYcBXIu.js +3 -0
  113. package/dist/chunks/{pidLock-CFUBtZck.js → pidLock-Bao7SU6Z.js} +2 -2
  114. package/dist/chunks/{plan-DI0n7LIV.js → plan-Dwj_ZX8G.js} +1 -1
  115. package/dist/chunks/plugin-Cscvf8st.js +17 -0
  116. package/dist/chunks/{pluginAutoupdate-CNrHb4RJ.js → pluginAutoupdate-D5XyiZrP.js} +1 -1
  117. package/dist/chunks/pluginBlocklist-CpkjXXKQ.js +1 -0
  118. package/dist/chunks/pluginCliCommands-DmLsxs1M.js +1 -0
  119. package/dist/chunks/{pluginFlagging-CUvkKGOB.js → pluginFlagging-CRuX6sHR.js} +1 -1
  120. package/dist/chunks/pluginOperations-orq3bOCp.js +2 -0
  121. package/dist/chunks/{pluginStartupCheck-DftTiXct.js → pluginStartupCheck-DGDl1WOZ.js} +1 -1
  122. package/dist/chunks/pluginStartupCheck-GHO77nmg.js +1 -0
  123. package/dist/chunks/plugins-Cq5c-Qs1.js +4 -0
  124. package/dist/chunks/{print-DSHypGJa.js → print-zo7Z--Ll.js} +9 -9
  125. package/dist/chunks/processBashCommand-C7oVqf0B.js +1 -0
  126. package/dist/chunks/processSlashCommand-CPQB5_0w.js +5 -0
  127. package/dist/chunks/{projectOnboardingState-nTCycGCD.js → projectOnboardingState-D-_ijZnG.js} +1 -1
  128. package/dist/chunks/prompt-CAzFDybL.js +1 -0
  129. package/dist/chunks/prompt-Cm8SKZXY.js +1 -0
  130. package/dist/chunks/{prompt-BfXryFt-.js → prompt-DaYH88Oe.js} +1 -1
  131. package/dist/chunks/{protocolHandler-VigBkAQQ.js → protocolHandler-CJO3CRYW.js} +1 -1
  132. package/dist/chunks/{reconciler-B9XFdL4f.js → reconciler-B5Kr4do0.js} +1 -1
  133. package/dist/chunks/refresh-DurNMJeS.js +1 -0
  134. package/dist/chunks/{reject-CBxnwckZ.js → reject-CzjtO3fU.js} +1 -1
  135. package/dist/chunks/{reload-plugins-5eFWrQlL.js → reload-plugins-C38i_Eb3.js} +1 -1
  136. package/dist/chunks/rename-BV-3ZpFx.js +1 -0
  137. package/dist/chunks/{resume-U2D0ybfU.js → resume-CUzQIor4.js} +2 -2
  138. package/dist/chunks/{runtimeObserver-CWaYMJG8.js → runtimeObserver-BKoQ5IEO.js} +4 -4
  139. package/dist/chunks/{runtimeObserver-DOYlxx9H.js → runtimeObserver-Ess1Cn8Y.js} +1 -1
  140. package/dist/chunks/sandbox-adapter-ClRO21Ci.js +1 -0
  141. package/dist/chunks/{sandbox-toggle-BtiPyjT3.js → sandbox-toggle-Bp6Xpjh3.js} +1 -1
  142. package/dist/chunks/searchExtraTools-CV_fkuD6.js +1 -0
  143. package/dist/chunks/{select-BuTJbu_Q.js → select-Bm29ymsI.js} +1 -1
  144. package/dist/chunks/sessionFileAccessHooks-B5kAD4ol.js +1 -0
  145. package/dist/chunks/{sessionObserver-cfwD8pV8.js → sessionObserver-CBlzrJt1.js} +1 -1
  146. package/dist/chunks/sessionObserver-CayxkuxO.js +1 -0
  147. package/dist/chunks/sessionStorage-vLxCo1Mh.js +1 -0
  148. package/dist/chunks/{sessionTracing-DsdcOqvc.js → sessionTracing-TDsq54Uc.js} +1 -1
  149. package/dist/chunks/setup-BbyfyeQk.js +3 -0
  150. package/dist/chunks/{shadowedRuleDetection-DiZUDzxU.js → shadowedRuleDetection-BG3jtA9Y.js} +1 -1
  151. package/dist/chunks/{sideQuestion-CdgUarC2.js → sideQuestion-C8GNVo4R.js} +3 -3
  152. package/dist/chunks/{sinks-Cy3NqVbk.js → sinks-BafJR6Fw.js} +1 -1
  153. package/dist/chunks/sinks-CHtjg7sn.js +1 -0
  154. package/dist/chunks/skillChangeDetector-CY17weG4.js +1 -0
  155. package/dist/chunks/{skillGapStore-BJV8ZIB1.js → skillGapStore-Cl4J1WoZ.js} +2 -2
  156. package/dist/chunks/{skillLifecycle-iO_3s9Ff.js → skillLifecycle-DdfeUHBf.js} +2 -2
  157. package/dist/chunks/{skillSearchPanel-BL5gXTHU.js → skillSearchPanel-DtQYF9gN.js} +4 -4
  158. package/dist/chunks/{skills-BEp3_RyT.js → skills-Fd12LJal.js} +1 -1
  159. package/dist/chunks/status-CGEMRiPI.js +1 -0
  160. package/dist/chunks/statusNoticeHelpers-D0tonVy0.js +1 -0
  161. package/dist/chunks/{switcher-DSt2cVjA.js → switcher-BCq9Az_q.js} +1 -1
  162. package/dist/chunks/switcher-DQMr6Anx.js +1 -0
  163. package/dist/chunks/{tasks-DyBUXnQb.js → tasks-DQmkY_xD.js} +1 -1
  164. package/dist/chunks/{templateJobs-BBnReWWj.js → templateJobs-CEDUbFAY.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-DQjJ4R0o.js} +1 -1
  168. package/dist/chunks/tipRegistry-BwxZ_G0j.js +2 -0
  169. package/dist/chunks/{toolEventObserver-ClwWmVbH.js → toolEventObserver-DdZ30on9.js} +1 -1
  170. package/dist/chunks/toolPool-CWIXwdX7.js +1 -0
  171. package/dist/chunks/{useExitOnCtrlCDWithKeybindings-ClN4NJnB.js → useExitOnCtrlCDWithKeybindings-ClrtNKJ6.js} +1 -1
  172. package/dist/chunks/useMainLoopModel-CULw8pB_.js +1 -0
  173. package/dist/chunks/{useManagePlugins-CxHz-gUP.js → useManagePlugins-CmsPSHor.js} +1 -1
  174. package/dist/chunks/useMergedTools-C8PxReh0.js +1 -0
  175. package/dist/chunks/{useSearchInput-BIQN_-Hm.js → useSearchInput-BZhTzjgN.js} +1 -1
  176. package/dist/chunks/useSettingsErrors-GWIxCYyd.js +1 -0
  177. package/dist/chunks/{util-BHr5l6Bx.js → util-Bih2g-pV.js} +1 -1
  178. package/dist/chunks/validatePlugin-BwcC_Wbr.js +1 -0
  179. package/dist/chunks/{vim-CYjMtnwH.js → vim-BlO9V5_5.js} +1 -1
  180. package/dist/chunks/worktree-BB9lFWBB.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/App-DzRQpRKr.js +0 -1
  187. package/dist/chunks/Doctor-CLOYkPRR.js +0 -3
  188. package/dist/chunks/Doctor-CiZNe_qx.js +0 -1
  189. package/dist/chunks/ExitFlow-CATwJC4c.js +0 -2
  190. package/dist/chunks/MCPConnectionManager-CBY8nqdU.js +0 -1
  191. package/dist/chunks/MCPToolListView-C7HT6rrl.js +0 -1
  192. package/dist/chunks/MessageSelector-Dw_ERK_Z.js +0 -3
  193. package/dist/chunks/Messages-RBfRELKn.js +0 -10
  194. package/dist/chunks/QueryEngine-BBBkZWu2.js +0 -1
  195. package/dist/chunks/REPL-BHk0vZDf.js +0 -1
  196. package/dist/chunks/ResumeConversation-BuSqBrm1.js +0 -1
  197. package/dist/chunks/SearchExtraToolsTool-CdWB9sO8.js +0 -1
  198. package/dist/chunks/Settings-DYKmPdbd.js +0 -2
  199. package/dist/chunks/Spinner-DOI8qqZi.js +0 -1
  200. package/dist/chunks/allErrors-DvcU0w0F.js +0 -1
  201. package/dist/chunks/backgroundHousekeeping-B56nFTzq.js +0 -1
  202. package/dist/chunks/caches-D7arwhaa.js +0 -1
  203. package/dist/chunks/caches-Dn8yrJmL.js +0 -1
  204. package/dist/chunks/commands-AcfFLgl5.js +0 -1
  205. package/dist/chunks/compact-Banc-SNk.js +0 -2
  206. package/dist/chunks/config-BhBcadjZ.js +0 -1
  207. package/dist/chunks/config-Bm5pVdCq.js +0 -1
  208. package/dist/chunks/context-noninteractive-BK2IDLSS.js +0 -1
  209. package/dist/chunks/conversation-B2dX3X4Z.js +0 -1
  210. package/dist/chunks/conversation-Cjaftrrw.js +0 -1
  211. package/dist/chunks/crossProjectResume-BzltC4NJ.js +0 -40
  212. package/dist/chunks/doctor-CQf8xPZH.js +0 -1
  213. package/dist/chunks/exit-uKtXb5U3.js +0 -1
  214. package/dist/chunks/extractMemories-8yvMGZ1J.js +0 -1
  215. package/dist/chunks/fast-aNkj6WvB.js +0 -1
  216. package/dist/chunks/fetchModelList-D2quBF6M.js +0 -1
  217. package/dist/chunks/hooks-B5Wq-KxE.js +0 -1
  218. package/dist/chunks/loadAgentsDir-BBbIAiay.js +0 -1
  219. package/dist/chunks/loadPluginHooks-QoVXsBjy.js +0 -1
  220. package/dist/chunks/localSearch-D6MhwvnR.js +0 -1
  221. package/dist/chunks/managedEnv-ulQBH73B.js +0 -1
  222. package/dist/chunks/mcp--LmEVBRg.js +0 -1
  223. package/dist/chunks/mcp-DCl-Tz-C.js +0 -2
  224. package/dist/chunks/memory-Bu5ku7y9.js +0 -1
  225. package/dist/chunks/permissions-DNedQyLg.js +0 -3
  226. package/dist/chunks/plugin-BQ8gRVYF.js +0 -17
  227. package/dist/chunks/pluginBlocklist-CKCsgWdY.js +0 -1
  228. package/dist/chunks/pluginCliCommands-CACeyIwz.js +0 -1
  229. package/dist/chunks/pluginOperations-Ca_T-HYn.js +0 -2
  230. package/dist/chunks/pluginStartupCheck-Du9yx2P8.js +0 -1
  231. package/dist/chunks/plugins-Divl-P-X.js +0 -4
  232. package/dist/chunks/processBashCommand-BLcFmbyG.js +0 -1
  233. package/dist/chunks/processSlashCommand-Caif46Gi.js +0 -5
  234. package/dist/chunks/prompt-BZmu5CeK.js +0 -1
  235. package/dist/chunks/prompt-Cogr_WZr.js +0 -1
  236. package/dist/chunks/refresh-CBHbWTGg.js +0 -1
  237. package/dist/chunks/rename-Cw7cMerG.js +0 -1
  238. package/dist/chunks/sandbox-adapter-Df7Wpt77.js +0 -1
  239. package/dist/chunks/searchExtraTools-CbJVb_Zk.js +0 -1
  240. package/dist/chunks/sessionFileAccessHooks-_mxyfQmn.js +0 -1
  241. package/dist/chunks/sessionObserver-BZVgzp3W.js +0 -1
  242. package/dist/chunks/sessionStorage-SC5RfnUP.js +0 -1
  243. package/dist/chunks/setup-DR-KEmxL.js +0 -3
  244. package/dist/chunks/sinks-D41OiGE4.js +0 -1
  245. package/dist/chunks/skillChangeDetector-CVFCJcG7.js +0 -1
  246. package/dist/chunks/status-6JMz8jmM.js +0 -1
  247. package/dist/chunks/statusNoticeHelpers-BoloSeXY.js +0 -1
  248. package/dist/chunks/switcher-95d4TrQH.js +0 -1
  249. package/dist/chunks/tipRegistry-Cl5sdLRX.js +0 -2
  250. package/dist/chunks/toolPool-DSTbgGmX.js +0 -1
  251. package/dist/chunks/useMainLoopModel-Bgxpmn2Q.js +0 -1
  252. package/dist/chunks/useMergedTools-BUuWew0-.js +0 -1
  253. package/dist/chunks/useSettingsErrors-BDJCLei_.js +0 -1
  254. package/dist/chunks/validatePlugin-fx1Y8vam.js +0 -1
  255. package/dist/chunks/worktree-CGu_58ue.js +0 -1
@@ -1,10 +0,0 @@
1
- import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{l as n,o as r}from"./envUtils-QyzA_cFM.js";import{n as i,t as a}from"./figures-5ThXQEtq.js";import{C as o,Gr as s,I as c,N as l,P as u,Pn as d,Rn as f,ai as p,di as m,fi as h,j as g,mt as _,ot as v,t as y,xt as b}from"./src-BX54x08P.js";import{t as x}from"./jsx-runtime-Bb4Xn-E0.js";import{Gt as S,Wt as C,m as w,t as T}from"./settings-D4M13toi.js";import{$i as E,$u as D,$y as O,Bh as k,Cy as A,Du as ee,Dy as te,Eu as j,Ey as ne,Gx as re,Ji as M,KC as N,Mh as P,Ou as F,Px as ie,QS as ae,Qi as oe,Qy as se,Rx as ce,Sa as le,Tu as I,WC as ue,Xy as de,Yy as fe,ZS as L,Zy as pe,aC as me,aS as he,aa as ge,bm as R,bu as _e,da as ve,dd as ye,du as be,ea as xe,ed as Se,fu as Ce,ha as we,hg as Te,jh as z,ku as Ee,ky as De,la as Oe,na as ke,nb as Ae,oS as je,pa as Me,qy as Ne,ra as B,rb as Pe,sC as Fe,sS as Ie,sb as Le,ta as Re,ud as ze,uu as Be,vu as Ve,wu as He,xm as Ue,xu as We,yu as Ge,zh as Ke,zx as qe}from"./loadAgentsDir-uuZYOgKn.js";import{n as Je,t as Ye}from"./cwd-DrEEb4f5.js";import{a as Xe,c as Ze,i as Qe,n as $e,o as et}from"./debug-2pVES-2G.js";import{d as tt,h as nt,o as rt}from"./config-BDn2YIjC.js";import{B as it,L as at,R as ot,q as st}from"./log-L1kqxa_P.js";import{_ as ct,f as lt,p as ut,y as dt}from"./startupProfiler-B9Qv2QGH.js";import{l as ft,o as pt}from"./stringUtils-Cs6E5f-B.js";import{f as mt,h as ht,x as gt}from"./model-CcHyMyBv.js";import{gn as _t,vn as vt}from"./prompt-BfXryFt-.js";import{a as yt,n as bt,r as xt,t as St}from"./projectOnboardingState-nTCycGCD.js";import{n as Ct,t as wt}from"./sleep-xKMbXTJe.js";import{n as Tt,t as Et}from"./systemTheme-Ceakddth.js";import{a as Dt,c as Ot,i as kt}from"./SpinnerGlyph-BR_SiV9L.js";import{n as At,r as jt}from"./PromptInputFooterSuggestions-ChpyD9B7.js";import{n as Mt,t as Nt}from"./useMainLoopModel-Bgxpmn2Q.js";import{n as Pt,t as Ft}from"./modalContext-sU2lfR08.js";import{n as It,r as Lt,t as Rt}from"./statusNoticeHelpers-BoloSeXY.js";import{a as zt,c as Bt,i as Vt,l as Ht,n as Ut,o as Wt,r as Gt,t as Kt,u as qt}from"./logoUtils-B4wCDKs9.js";import{homedir as Jt}from"os";import{relative as Yt}from"path";import{fileURLToPath as Xt}from"url";function Zt(e,t){for(let n of e)if(!t.has(n))return!1;return!0}var Qt=e((()=>{}));function $t(e){if(e.type!==`user`)return!1;let t=Array.isArray(e.message.content)?e.message.content[0]:void 0;return!t||typeof t==`string`||t?.type!==`text`||!t.text.includes(`<task-notification`)||ie(t.text,`status`)!==`completed`?!1:ie(t.text,`summary`)?.startsWith(`Background command `)??!1}function en(e,t){if(!P()||t)return e;let n=[],r=0;for(;r<e.length;){let t=e[r];if($t(t)){let i=0;for(;r<e.length&&$t(e[r]);)i++,r++;i===1?n.push(t):n.push({...t,message:{role:`user`,content:[{type:`text`,text:`<${it}><${at}>completed</${at}><${ot}>${i} background commands completed</${ot}></${it}>`}]}})}else n.push(t),r++}return n}var tn=e((()=>{st(),Te(),z(),M()}));function nn(e){return e.type===`system`&&e.subtype===`stop_hook_summary`&&e.hookLabel!==void 0}function rn(e){let t=[],n=0;for(;n<e.length;){let r=e[n];if(nn(r)){let i=r.hookLabel,a=[];for(;n<e.length;){let t=e[n];if(!nn(t)||t.hookLabel!==i)break;a.push(t),n++}a.length===1?t.push(r):t.push({...r,hookCount:a.reduce((e,t)=>e+t.hookCount,0),hookInfos:a.flatMap(e=>e.hookInfos),hookErrors:a.flatMap(e=>e.hookErrors),preventedContinuation:a.some(e=>e.preventedContinuation),hasOutput:a.some(e=>e.hasOutput),totalDurationMs:Math.max(...a.map(e=>e.totalDurationMs??0))})}else t.push(r),n++}return t}var an=e((()=>{}));function on(e){let t=ln.get(e);return t||(t=new Set(e.filter(e=>e.renderGroupedToolUse).map(e=>e.name)),ln.set(e,t)),t}function sn(e){if(e.type===`assistant`&&e.message?.content&&Array.isArray(e.message.content)&&e.message.content[0]?.type===`tool_use`){let t=e.message.content[0];return{messageId:e.message.id,toolUseId:t.id,toolName:t.name}}return null}function cn(e,t,n=!1){if(n)return{messages:e};let r=on(t),i=new Map;for(let t of e){let e=sn(t);if(e&&r.has(e.toolName)){let n=`${e.messageId}:${e.toolName}`,r=i.get(n)??[];r.push(t),i.set(n,r)}}let a=new Map,o=new Set;for(let[e,t]of i)if(t.length>=2){a.set(e,t);for(let e of t){let t=sn(e);t&&o.add(t.toolUseId)}}let s=new Map;for(let t of e)if(t.type===`user`&&t.message?.content&&Array.isArray(t.message.content))for(let e of t.message.content)e.type===`tool_result`&&o.has(e.tool_use_id)&&s.set(e.tool_use_id,t);let c=[],l=new Set;for(let t of e){let e=sn(t);if(e){let t=`${e.messageId}:${e.toolName}`,n=a.get(t);if(n){if(!l.has(t)){l.add(t);let r=n[0],i=[];for(let e of n){let t=e.message.content[0].id,n=s.get(t);n&&i.push(n)}let a={type:`grouped_tool_use`,toolName:e.toolName,messages:n,results:i,displayMessage:r,uuid:`grouped-${r.uuid}`,timestamp:r.timestamp,messageId:e.messageId};c.push(a)}continue}}if(t.type===`user`&&t.message?.content&&Array.isArray(t.message.content)){let e=t.message.content.filter(e=>e.type===`tool_result`);if(e.length>0&&e.every(e=>o.has(e.tool_use_id)))continue}c.push(t)}return{messages:c}}var ln,un=e((()=>{ln=new WeakMap}));function dn(e){let t=_n.get(e);if(t!==void 0)return t;let n=fn(e).toLowerCase();return _n.set(e,n),n}function fn(e){let t=``;switch(e.type){case`user`:{let n=e.message.content;if(typeof n==`string`)t=gn.has(n)?``:n;else{let r=[];for(let t of n??[])t.type===`text`?gn.has(t.text)||r.push(t.text):t.type===`tool_result`&&r.push(mn(e.toolUseResult));t=r.join(`
2
- `)}break}case`assistant`:{let n=e.message.content;Array.isArray(n)&&(t=n.flatMap(e=>e.type===`text`?[e.text]:e.type===`tool_use`?[pn(e.input)]:[]).join(`
3
- `));break}case`attachment`:if(e.attachment.type===`relevant_memories`)t=(e.attachment.memories??[]).map(e=>e.content).join(`
4
- `);else if(e.attachment.type===`queued_command`&&e.attachment.commandMode!==`task-notification`&&!e.attachment.isMeta){let n=e.attachment.prompt;t=typeof n==`string`?n:n.flatMap(e=>e.type===`text`?[e.text]:[]).join(`
5
- `)}break;case`collapsed_read_search`:e.relevantMemories&&(t=e.relevantMemories.map(e=>e.content).join(`
6
- `));break;default:break}let n=t,r=n.indexOf(`<system-reminder>`);for(;r>=0;){let e=n.indexOf(hn,r);if(e<0)break;n=n.slice(0,r)+n.slice(e+18),r=n.indexOf(`<system-reminder>`)}return n}function pn(e){if(!e||typeof e!=`object`)return``;let t=e,n=[];for(let e of[`command`,`pattern`,`file_path`,`path`,`prompt`,`description`,`query`,`url`,`skill`]){let r=t[e];typeof r==`string`&&n.push(r)}for(let e of[`args`,`files`]){let r=t[e];Array.isArray(r)&&r.every(e=>typeof e==`string`)&&n.push(r.join(` `))}return n.join(`
7
- `)}function mn(e){if(!e||typeof e!=`object`)return typeof e==`string`?e:``;let t=e;if(typeof t.stdout==`string`){let e=typeof t.stderr==`string`?t.stderr:``;return t.stdout+(e?`\n${e}`:``)}if(t.file&&typeof t.file==`object`&&typeof t.file.content==`string`)return t.file.content;let n=[];for(let e of[`content`,`output`,`result`,`text`,`message`]){let r=t[e];typeof r==`string`&&n.push(r)}for(let e of[`filenames`,`lines`,`results`]){let r=t[e];Array.isArray(r)&&r.every(e=>typeof e==`string`)&&n.push(r.join(`
8
- `))}return n.join(`
9
- `)}var hn,gn,_n,vn=e((()=>{M(),hn=`</system-reminder>`,gn=new Set([je,Ie]),_n=new WeakMap}));function yn({pose:e=`default`}={}){return(0,bn.jsxs)(c,{flexDirection:`column`,alignItems:`center`,children:[(0,bn.jsx)(u,{color:`clawd_body`,children:` █████ `}),(0,bn.jsx)(u,{color:`clawd_body`,children:`██ ● ● ██`}),(0,bn.jsx)(u,{color:`clawd_body`,children:`██ ▄▄▄ ██`}),(0,bn.jsx)(u,{color:`clawd_body`,children:` █ █ █ █ `})]})}var bn,xn=e((()=>{y(),bn=x()}));function Sn(e){let{title:t,lines:n,footer:r,emptyMessage:i,customContent:a}=e,o=s(t);if(a!==void 0)o=Math.max(o,a.width);else if(n.length===0&&i)o=Math.max(o,s(i));else{let e=Math.max(0,...n.map(e=>e.timestamp?s(e.timestamp):0));for(let t of n){let n=e>0?e:0,r=s(t.text)+(n>0?n+2:0);o=Math.max(o,r)}}return r&&(o=Math.max(o,s(r))),o}function Cn({config:e,actualWidth:t}){let{title:n,lines:r,footer:i,emptyMessage:a,customContent:o}=e,l=Math.max(0,...r.map(e=>e.timestamp?s(e.timestamp):0));return(0,V.jsxs)(c,{flexDirection:`column`,width:t,children:[(0,V.jsx)(u,{bold:!0,color:`claude`,children:n}),o?(0,V.jsxs)(V.Fragment,{children:[o.content,i&&(0,V.jsx)(u,{dimColor:!0,italic:!0,children:dt(i,t)})]}):r.length===0&&a?(0,V.jsx)(u,{dimColor:!0,children:dt(a,t)}):(0,V.jsxs)(V.Fragment,{children:[r.map((e,n)=>{let r=Math.max(10,t-(l>0?l+2:0));return(0,V.jsxs)(u,{children:[l>0&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(u,{dimColor:!0,children:(e.timestamp||``).padEnd(l)}),` `]}),(0,V.jsx)(u,{children:dt(e.text,r)})]},n)}),i&&(0,V.jsx)(u,{dimColor:!0,italic:!0,children:dt(i,t)})]})]})}var V,wn=e((()=>{y(),ct(),V=x()}));function Tn({feeds:e,maxWidth:t}){let n=e.map(e=>Sn(e)),r=Math.max(...n),i=Math.min(r,t);return(0,Dn.jsx)(c,{flexDirection:`column`,children:e.map((t,n)=>(0,Dn.jsxs)(En.Fragment,{children:[(0,Dn.jsx)(Cn,{config:t,actualWidth:i}),n<e.length-1&&(0,Dn.jsx)(o,{color:`claude`,width:i})]},n))})}var En,Dn,On=e((()=>{En=t(p(),1),y(),wn(),Dn=x()}));function kn(e){let t=e.map(e=>{let t=ut(e.modified);return{text:(e.summary&&e.summary!==`No prompt`?e.summary:e.firstPrompt)||``,timestamp:t}});return{title:`Recent activity`,lines:t,footer:t.length>0?`/resume for more`:void 0,emptyMessage:`No recent activity`}}function An(e){let t=e.filter(({isEnabled:e})=>e).sort((e,t)=>Number(e.isComplete)-Number(t.isComplete)).map(({text:e,isComplete:t})=>({text:`${t?`${a.tick} `:``}${e}`})),n=Ye()===Jt()?`Note: You have launched Work Mate in your home directory. For the best experience, launch it in a project directory instead.`:void 0;return n&&t.push({text:n}),{title:`Tips for getting started`,lines:t}}var jn=e((()=>{i(),Je(),ct()}));function H(e,t,n){return Array.from({length:n},()=>({pose:e,offset:t}))}function Mn(){let{pose:e,bounceOffset:t,onClick:n}=Nn();return(0,Fn.jsx)(c,{height:Vn,flexDirection:`column`,onClick:n,children:(0,Fn.jsx)(c,{marginTop:t,flexShrink:0,children:(0,Fn.jsx)(yn,{pose:e})})})}function Nn(){let[e]=(0,Pn.useState)(()=>T().prefersReducedMotion??!1),[t,n]=(0,Pn.useState)(-1),r=(0,Pn.useRef)(In),i=()=>{e||t!==-1||(r.current=Ln[Math.floor(Math.random()*Ln.length)],n(0))};(0,Pn.useEffect)(()=>{if(t===-1)return;if(t>=r.current.length){n(-1);return}let e=setTimeout(n,zn,Bn);return()=>clearTimeout(e)},[t]);let a=r.current,o=t>=0&&t<a.length?a[t]:Rn;return{pose:o.pose,bounceOffset:o.offset,onClick:i}}var Pn,Fn,In,Ln,Rn,zn,Bn,Vn,Hn=e((()=>{Pn=t(p(),1),y(),w(),xn(),Fn=x(),In=[...H(`default`,1,2),...H(`arms-up`,0,3),...H(`default`,0,1),...H(`default`,1,2),...H(`arms-up`,0,3),...H(`default`,0,1)],Ln=[In,[...H(`look-right`,0,5),...H(`look-left`,0,5),...H(`default`,0,1)]],Rn={pose:`default`,offset:0},zn=60,Bn=e=>e+1,Vn=3}));function Un(){let{columns:e}=v(),t=k(e=>e.agent),n=gt(Mt()),{version:r,cwd:i,billingType:a,agentName:o}=Wt(),l=t??o,d=Math.max(e-15,20),f=dt(r,Math.max(d-11,6)),{shouldSplit:p,truncatedModel:m,truncatedBilling:h}=Gt(n,a,d),g=l?d-1-s(l)-3:d,_=qt(i,Math.max(g,10));return(0,U.jsx)(R,{children:(0,U.jsxs)(c,{flexDirection:`row`,gap:2,alignItems:`center`,children:[P()?(0,U.jsx)(Mn,{}):(0,U.jsx)(yn,{}),(0,U.jsxs)(c,{flexDirection:`column`,children:[(0,U.jsxs)(u,{children:[(0,U.jsx)(u,{bold:!0,children:`Work Mate`}),` `,(0,U.jsxs)(u,{dimColor:!0,children:[`v`,f]})]}),p?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(u,{dimColor:!0,children:m}),(0,U.jsx)(u,{dimColor:!0,children:h})]}):(0,U.jsxs)(u,{dimColor:!0,children:[m,` · `,h]}),(0,U.jsx)(u,{dimColor:!0,children:l?`@${l} · ${_}`:_})]})]})})}var U,Wn=e((()=>{Nt(),Le(),y(),Ke(),ct(),z(),Ht(),mt(),Ue(),Hn(),xn(),U=x()}));function Gn(){let e=(0,qn.useMemo)(Kn,[]),t=(0,qn.useMemo)(()=>rt().lastShownEmergencyTip,[]),n=e.tip&&e.tip!==t;return(0,qn.useEffect)(()=>{n&&nt(t=>t.lastShownEmergencyTip===e.tip?t:{...t,lastShownEmergencyTip:e.tip})},[n,e.tip]),n?(0,Jn.jsx)(c,{paddingLeft:2,flexDirection:`column`,children:(0,Jn.jsx)(u,{...e.color===`warning`?{color:`warning`}:e.color===`error`?{color:`error`}:{dimColor:!0},children:e.tip})}):null}function Kn(){return Yn}var qn,Jn,Yn,Xn=e((()=>{qn=t(p(),1),y(),tt(),Jn=x(),Yn={tip:``,color:`dim`}}));function Zn({char:e=`✻`}){let[t]=(0,Qn.useState)(()=>T().prefersReducedMotion??!1),[n,r]=(0,Qn.useState)(t),i=(0,Qn.useRef)(null),[a,o]=_(n?null:50);return(0,Qn.useEffect)(()=>{if(n)return;let e=setTimeout(r,tr,!0);return()=>clearTimeout(e)},[n]),n?(0,$n.jsx)(c,{ref:a,children:(0,$n.jsx)(u,{color:nr,children:e})}):(i.current===null&&(i.current=o),(0,$n.jsx)(c,{ref:a,children:(0,$n.jsx)(u,{color:Ot(kt((o-i.current)/er*360%360)),children:e})}))}var Qn,$n,er,tr,nr,rr=e((()=>{Qn=t(p(),1),S(),y(),w(),Dt(),$n=x(),er=1500,tr=er*2,nr=Ot({r:153,g:153,b:153})}));function ir(){return ht()&&(rt().opus1mMergeNoticeSeenCount??0)<cr}function ar(){let[e]=(0,or.useState)(ir);return(0,or.useEffect)(()=>{if(!e)return;let t=(rt().opus1mMergeNoticeSeenCount??0)+1;nt(e=>(e.opus1mMergeNoticeSeenCount??0)>=t?e:{...e,opus1mMergeNoticeSeenCount:t})},[e]),e?(0,sr.jsxs)(c,{paddingLeft:2,children:[(0,sr.jsx)(Zn,{char:`↑`}),(0,sr.jsx)(u,{dimColor:!0,children:` Opus now defaults to 1M context · 5x more room, same pricing`})]}):null}var or,sr,cr,lr=e((()=>{or=t(p(),1),S(),y(),tt(),mt(),rr(),sr=x(),cr=6}));function ur(){let e=Bt(),{columns:t}=v(),r=yt(),i=me.isSandboxingEnabled(),a=k(e=>e.agent),o=rt(),[l]=(0,dr.useState)(()=>{let e=T().companyAnnouncements;if(!(!e||e.length===0))return o.numStartups===1?e[0]:e[Math.floor(Math.random()*e.length)]});(0,dr.useEffect)(()=>{r&&bt()},[r]),!r&&n(process.env.WORKMATE_FORCE_FULL_LOGO);let d=gt(Mt()),{version:f,cwd:p,billingType:m,agentName:h}=Wt(),_=a??h,y=dt(d,fr-20);if(!r&&!n(process.env.WORKMATE_FORCE_FULL_LOGO))return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(Un,{}),(0,W.jsx)(ar,{}),Xe()&&(0,W.jsxs)(c,{paddingLeft:2,flexDirection:`column`,children:[(0,W.jsx)(u,{color:`warning`,children:`Debug mode enabled`}),(0,W.jsxs)(u,{dimColor:!0,children:[`Logging to: `,et()?`stderr`:$e()]})]}),(0,W.jsx)(Gn,{}),process.env.WORKMATE_TMUX_SESSION&&(0,W.jsxs)(c,{paddingLeft:2,flexDirection:`column`,children:[(0,W.jsxs)(u,{dimColor:!0,children:[`tmux session: `,process.env.WORKMATE_TMUX_SESSION]}),(0,W.jsx)(u,{dimColor:!0,children:process.env.WORKMATE_TMUX_PREFIX_CONFLICTS?`Detach: ${process.env.WORKMATE_TMUX_PREFIX} ${process.env.WORKMATE_TMUX_PREFIX} d (press prefix twice - Work Mate uses ${process.env.WORKMATE_TMUX_PREFIX})`:`Detach: ${process.env.WORKMATE_TMUX_PREFIX} d`})]}),l&&(0,W.jsx)(c,{paddingLeft:2,flexDirection:`column`,children:(0,W.jsx)(u,{children:l})})]});let b=zt(t),x=Tt(rt().theme),S=` ${g(`claude`,x)(`Work Mate`)} ${g(`inactive`,x)(`v${f}`)} `,C=g(`claude`,x)(` Work Mate `);if(b===`compact`){let e=Vt(null);s(e)>t-4&&(e=Vt(null));let n=_?t-4-1-s(_)-3:t-4,r=qt(p,Math.max(n,10));return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(R,{children:(0,W.jsxs)(c,{flexDirection:`column`,borderStyle:`round`,borderColor:`claude`,borderText:{content:C,position:`top`,align:`start`,offset:1},paddingX:1,paddingY:1,alignItems:`center`,width:t,children:[(0,W.jsx)(u,{bold:!0,children:e}),(0,W.jsx)(c,{marginY:1,children:(0,W.jsx)(yn,{})}),(0,W.jsx)(u,{dimColor:!0,children:y}),(0,W.jsx)(u,{dimColor:!0,children:m}),(0,W.jsx)(u,{dimColor:!0,children:_?`@${_} · ${r}`:r})]})}),(0,W.jsx)(ar,{}),i&&(0,W.jsx)(c,{marginTop:1,flexDirection:`column`,children:(0,W.jsx)(u,{color:`warning`,children:`Your bash commands will be sandboxed. Disable with /sandbox.`})})]})}let w=Vt(null),E=`${y} · ${m}`,D=_?fr-1-s(_)-3:fr,O=qt(p,Math.max(D,10)),A=_?`@${_} · ${O}`:O,{leftWidth:ee,rightWidth:te}=Kt(t,b,Ut(w,A,E));return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(R,{children:(0,W.jsx)(c,{flexDirection:`column`,borderStyle:`round`,borderColor:`claude`,borderText:{content:S,position:`top`,align:`start`,offset:3},children:(0,W.jsxs)(c,{flexDirection:b===`horizontal`?`row`:`column`,paddingX:1,gap:1,children:[(0,W.jsxs)(c,{flexDirection:`column`,width:ee,justifyContent:`space-between`,alignItems:`center`,minHeight:9,children:[(0,W.jsx)(c,{marginTop:1,children:(0,W.jsx)(u,{bold:!0,children:w})}),(0,W.jsx)(yn,{}),(0,W.jsxs)(c,{flexDirection:`column`,alignItems:`center`,children:[(0,W.jsx)(u,{dimColor:!0,children:E}),(0,W.jsx)(u,{dimColor:!0,children:A})]})]}),b===`horizontal`&&(0,W.jsx)(c,{height:`100%`,borderStyle:`single`,borderColor:`claude`,borderDimColor:!0,borderTop:!1,borderBottom:!1,borderLeft:!1}),b===`horizontal`&&(0,W.jsx)(Tn,{feeds:r?[An(St()),kn(e)]:[kn(e)],maxWidth:te})]})})}),(0,W.jsx)(ar,{}),Xe()&&(0,W.jsxs)(c,{paddingLeft:2,flexDirection:`column`,children:[(0,W.jsx)(u,{color:`warning`,children:`Debug mode enabled`}),(0,W.jsxs)(u,{dimColor:!0,children:[`Logging to: `,et()?`stderr`:$e()]})]}),(0,W.jsx)(Gn,{}),process.env.WORKMATE_TMUX_SESSION&&(0,W.jsxs)(c,{paddingLeft:2,flexDirection:`column`,children:[(0,W.jsxs)(u,{dimColor:!0,children:[`tmux session: `,process.env.WORKMATE_TMUX_SESSION]}),(0,W.jsx)(u,{dimColor:!0,children:process.env.WORKMATE_TMUX_PREFIX_CONFLICTS?`Detach: ${process.env.WORKMATE_TMUX_PREFIX} ${process.env.WORKMATE_TMUX_PREFIX} d (press prefix twice - Work Mate uses ${process.env.WORKMATE_TMUX_PREFIX})`:`Detach: ${process.env.WORKMATE_TMUX_PREFIX} d`})]}),l&&(0,W.jsx)(c,{paddingLeft:2,flexDirection:`column`,children:(0,W.jsx)(u,{children:l})}),i&&(0,W.jsx)(c,{paddingLeft:2,flexDirection:`column`,children:(0,W.jsx)(u,{color:`warning`,children:`Your bash commands will be sandboxed. Disable with /sandbox.`})})]})}var dr,W,fr,pr=e((()=>{y(),Le(),Ht(),ct(),xn(),On(),jn(),tt(),Et(),w(),Qe(),dr=t(p(),1),xt(),Wn(),Ue(),r(),Xn(),lr(),Fe(),Ke(),Nt(),mt(),W=x(),fr=50}));function mr({message:e,isTranscriptMode:t}){let n=e.message?.content,r=Array.isArray(n)?n:[];if(!(t&&e.type===`assistant`&&e.message?.model&&r.some(e=>e?.type===`text`)))return null;let i=e.message.model;return(0,hr.jsx)(c,{minWidth:s(i)+8,children:(0,hr.jsx)(u,{dimColor:!0,children:i})})}var hr,gr=e((()=>{y(),hr=x()}));function _r({message:e,isTranscriptMode:t}){if(!(t&&e.timestamp&&e.type===`assistant`&&Array.isArray(e.message.content)&&e.message.content.some(e=>e.type===`text`)))return null;let n=new Date(e.timestamp).toLocaleTimeString(`en-US`,{hour:`2-digit`,minute:`2-digit`,hour12:!0});return(0,vr.jsx)(c,{minWidth:s(n),children:(0,vr.jsx)(u,{dimColor:!0,children:n})})}var vr,yr=e((()=>{y(),vr=x()}));function br(e,t,n,r){for(let i=t+1;i<e.length;i++){let t=e[i];if(t?.type===`assistant`){let e=Dr(t.message.content);if(e?.type===`thinking`||e?.type===`redacted_thinking`||e?.type===`tool_use`&&(j(e.name,e.input,n).isCollapsible||r.has(e.id)))continue;return!0}if(!(t?.type===`system`||t?.type===`attachment`)&&!(t?.type===`user`&&Dr(t.message.content)?.type===`tool_result`)){if(t?.type===`grouped_tool_use`){let e=Dr(t.messages[0]?.message.content)?.input;if(j(t.toolName,e,n).isCollapsible)continue}return!0}}return!1}function xr({message:e,isUserContinuation:t,hasContentAfter:n,tools:r,commands:i,verbose:a,inProgressToolUseIDs:o,streamingToolUseIDs:s,screen:l,canAnimate:u,lastThinkingBlockId:d,latestBashOutputUUID:f,columns:p,isLoading:m,lookups:h,shouldCollapseDiffs:g}){let _=l===`transcript`,v=e.type===`grouped_tool_use`,y=e.type===`collapsed_read_search`,b=y&&(F(e,o)||m&&!n),x=v?e.displayMessage:y?I(e):e,S=v||y?[]:xe(e,h),C=Li(e,s,o,v||y?he:Re(e,h),l,h),w=!1;if(u)if(v)w=e.messages.some(e=>{let t=Dr(e.message.content);return t?.type===`tool_use`&&o.has(t.id)});else if(y)w=F(e,o);else{let t=qe(e);w=!t||o.has(t)}let T=_&&x.type===`assistant`&&Array.isArray(x.message.content)&&x.message.content.some(e=>e.type===`text`)&&(x.timestamp||x.message.model),E=(0,Er.jsx)(Be,{message:e,lookups:h,addMargin:!T,containerWidth:T?void 0:p,tools:r,commands:i,verbose:a,inProgressToolUseIDs:o,progressMessagesForMessage:S,shouldAnimate:w,shouldShowDot:!0,isTranscriptMode:_,isStatic:C,isActiveCollapsedGroup:b,isUserContinuation:t,lastThinkingBlockId:d,latestBashOutputUUID:f,shouldCollapseDiffs:g});return T?(0,Er.jsx)(R,{children:(0,Er.jsxs)(c,{width:p,flexDirection:`column`,children:[(0,Er.jsxs)(c,{flexDirection:`row`,justifyContent:`flex-end`,gap:1,marginTop:1,children:[(0,Er.jsx)(_r,{message:x,isTranscriptMode:_}),(0,Er.jsx)(mr,{message:x,isTranscriptMode:_})]}),E]})}):(0,Er.jsx)(R,{children:E})}function Sr(e,t){if(e.type===`grouped_tool_use`)return e.messages.some(e=>{let n=Dr(e.message.content);return n?.type===`tool_use`&&t.has(n.id)});if(e.type===`collapsed_read_search`)return ee(e).some(e=>t.has(e));let n=qe(e);return!!n&&t.has(n)}function Cr(e,t){if(e.type===`grouped_tool_use`)return e.messages.every(e=>{let n=Dr(e.message.content);return n?.type===`tool_use`&&t.has(n.id)});if(e.type===`collapsed_read_search`)return ee(e).every(e=>t.has(e));if(e.type===`assistant`){let n=Dr(e.message.content);if(n?.type===`server_tool_use`)return t.has(n.id)}let n=qe(e);return!n||t.has(n)}function wr(e,t){if(e.message!==t.message||e.screen!==t.screen||e.verbose!==t.verbose||e.message.type===`collapsed_read_search`&&t.screen!==`transcript`||e.columns!==t.columns||e.latestBashOutputUUID===e.message.uuid!=(t.latestBashOutputUUID===t.message.uuid)||e.lastThinkingBlockId!==t.lastThinkingBlockId&&be(t.message))return!1;let n=Sr(e.message,e.streamingToolUseIDs),r=Cr(e.message,e.lookups.resolvedToolUseIDs);return!(n||!r)}var Tr,Er,Dr,Or,kr=e((()=>{Tr=t(p(),1),y(),Ee(),M(),Ce(),Er=x(),gr(),Gi(),yr(),Ue(),Dr=e=>{if(!Array.isArray(e))return;let t=e[0];if(!(t==null||typeof t==`string`))return t},Or=Tr.memo(xr,wr)}));function Ar(e){return e.type===`attachment`&&jr.has(e.attachment.type)}var jr,Mr=e((()=>{jr=new Set(`hook_success.hook_additional_context.hook_cancelled.command_permissions.agent_mention.budget_usd.critical_system_reminder.edited_image_file.edited_text_file.opened_file_in_ide.output_style.plan_mode.plan_mode_exit.plan_mode_reentry.structured_output.todo_reminder.context_efficiency.deferred_tools_delta.mcp_instructions_delta.token_usage.max_turns_reached.task_reminder.auto_mode.auto_mode_exit.output_token_usage.verify_plan_reminder.current_session_memory.compaction_reminder.date_change`.split(`.`))}));function Nr(e){return Ir.filter(t=>t.isActive(e))}var G,Pr,Fr,Ir,Lr=e((()=>{y(),De(),i(),Je(),ct(),Lt(),G=x(),Pr={id:`large-memory-files`,type:`warning`,isActive:e=>ne(e.memoryFiles).length>0,render:e=>(0,G.jsx)(G.Fragment,{children:ne(e.memoryFiles).map(e=>{let t=e.path.startsWith(Ye())?Yt(Ye(),e.path):e.path;return(0,G.jsxs)(c,{flexDirection:`row`,children:[(0,G.jsx)(u,{color:`warning`,children:a.warning}),(0,G.jsxs)(u,{color:`warning`,children:[`Large `,(0,G.jsx)(u,{bold:!0,children:t}),` will impact performance (`,lt(e.content.length),` chars > `,lt(A),`)`,(0,G.jsx)(u,{dimColor:!0,children:` · /memory to edit`})]})]},e.path)})})},Fr={id:`large-agent-descriptions`,type:`warning`,isActive:e=>It(e.agentDefinitions)>Rt,render:e=>{let t=It(e.agentDefinitions);return(0,G.jsxs)(c,{flexDirection:`row`,children:[(0,G.jsx)(u,{color:`warning`,children:a.warning}),(0,G.jsxs)(u,{color:`warning`,children:[`Large cumulative agent descriptions will impact performance (~`,lt(t),` tokens > `,lt(Rt),`)`,(0,G.jsx)(u,{dimColor:!0,children:` · /agents to manage`})]})]})}},Ir=[Pr,Fr]}));function Rr({agentDefinitions:e}={}){let t={config:rt(),agentDefinitions:e,memoryFiles:(0,Br.use)(te())},n=Nr(t);return n.length===0?null:(0,Vr.jsx)(c,{flexDirection:`column`,paddingLeft:1,children:n.map(e=>(0,Vr.jsx)(zr.Fragment,{children:e.render(t)},e.id))})}var zr,Br,Vr,Hr=e((()=>{zr=t(p(),1),Br=t(p(),1),y(),De(),tt(),Lr(),Vr=x()}));function Ur(e,t,n){let r=(0,K.useRef)(new Map),i=(0,K.useRef)(0),a=(0,K.useRef)(0),o=(0,K.useRef)({arr:new Float64Array,version:-1,n:-1}),s=(0,K.useRef)(new Map),c=(0,K.useRef)(new Map),l=(0,K.useRef)(n),u=(0,K.useRef)(!1),d=(0,K.useRef)(null),f=(0,K.useRef)(0);if(l.current!==n){let e=l.current/n;l.current=n;for(let[t,n]of r.current)r.current.set(t,Math.max(1,Math.round(n*e)));i.current++,u.current=!0,f.current=2}let p=f.current>0?d.current:null,m=(0,K.useRef)(0),h=(0,K.useRef)(null);(0,K.useSyncExternalStore)((0,K.useCallback)(t=>e.current?.subscribe(t)??Zr,[e]),()=>{let t=e.current;if(!t)return NaN;let n=t.getScrollTop()+t.getPendingDelta(),r=Math.floor(n/qr);return t.isSticky()?~r:r});let g=e.current?.getScrollTop()??-1,_=e.current?.getPendingDelta()??0,v=e.current?.getViewportHeight()??0,y=e.current?.isSticky()??!0;(0,K.useMemo)(()=>{let e=new Set(t),n=!1;for(let t of r.current.keys())e.has(t)||(r.current.delete(t),n=!0);for(let t of c.current.keys())e.has(t)||c.current.delete(t);n&&i.current++},[t]);let b=t.length;if(o.current.version!==i.current||o.current.n!==b){let e=o.current.arr.length>=b+1?o.current.arr:new Float64Array(b+1);e[0]=0;for(let n=0;n<b;n++)e[n+1]=e[n]+(r.current.get(t[n])??Wr);o.current={arr:e,version:i.current,n:b}}let x=o.current.arr,S=x[b],C,w;if(p)[C,w]=p,C=Math.min(C,b),w=Math.min(w,b);else if(v===0||g<0)C=Math.max(0,b-Kr),w=b;else{if(y){let e=v+Gr;for(C=b;C>0&&S-x[C-1]<e;)C--;w=b}else{let e=m.current,n=v*3,i=Math.min(g,g+_),a=Math.max(g,g+_),o=a-i,c=o>n&&_<0?a-n:i,l=c+Math.min(o,n),u=Math.max(0,c-e),f=l-e,p=u-Gr;{let e=0,t=b;for(;e<t;){let n=e+t>>1;x[n+1]<=p?e=n+1:t=n}C=e}{let e=d.current;if(e&&e[0]<C)for(let n=e[0];n<Math.min(C,e[1]);n++){let e=t[n];if(s.current.has(e)&&!r.current.has(e)){C=n;break}}}let h=v+2*Gr,y=Math.min(b,C+Yr),S=0;for(w=C;w<y&&(S<h||x[w]<f+v+Gr);)S+=r.current.get(t[w])??Jr,w++}let e=v+2*Gr,n=Math.max(0,w-Yr),i=0;for(let e=C;e<w;e++)i+=r.current.get(t[e])??Jr;for(;C>n&&i<e;)C--,i+=r.current.get(t[C])??Jr;let o=d.current,c=Math.abs(g-a.current)+Math.abs(_);if(o&&c>v*2){let[e,t]=o;C<e-Xr&&(C=e-Xr),w>t+Xr&&(w=t+Xr),C>w&&(w=Math.min(C+Xr,b))}a.current=g}f.current>0?f.current--:d.current=[C,w];let T=(0,K.useDeferredValue)(C),E=(0,K.useDeferredValue)(w),D=C<T?T:C,O=w>E?E:w;if((D>O||y)&&(D=C,O=w),_>0&&(O=w),O-D>Yr){let e=(x[D]+x[O])/2;g-m.current<e?O=D+Yr:D=O-Yr}let k=m.current,A=x[D],ee=D===0?0:A+k,te=O===b?1/0:Math.max(A,x[O]-v)+k;(0,K.useLayoutEffect)(()=>{y?e.current?.setClampBounds(void 0,void 0):e.current?.setClampBounds(ee,te)}),(0,K.useLayoutEffect)(()=>{let e=h.current?.yogaNode;if(e&&e.getComputedWidth()>0&&(m.current=e.getComputedTop()),u.current){u.current=!1;return}let t=!1;for(let[e,n]of s.current){let i=n.yogaNode;if(!i)continue;let a=i.getComputedHeight(),o=r.current.get(e);a>0?o!==a&&(r.current.set(e,a),t=!0):i.getComputedWidth()>0&&o!==0&&(r.current.set(e,0),t=!0)}t&&i.current++});let j=(0,K.useCallback)(e=>{let t=c.current.get(e);return t||(t=t=>{if(t)s.current.set(e,t);else{let t=s.current.get(e)?.yogaNode;if(t&&!u.current){let n=t.getComputedHeight();(n>0||t.getComputedWidth()>0)&&r.current.get(e)!==n&&(r.current.set(e,n),i.current++)}s.current.delete(e)}},c.current.set(e,t)),t},[]),ne=(0,K.useCallback)(e=>{let n=s.current.get(t[e])?.yogaNode;return!n||n.getComputedWidth()===0?-1:n.getComputedTop()},[t]),re=(0,K.useCallback)(e=>s.current.get(t[e])??null,[t]),M=(0,K.useCallback)(e=>r.current.get(t[e]),[t]),N=(0,K.useCallback)(t=>{let n=o.current;t<0||t>=n.n||e.current?.scrollTo(n.arr[t]+m.current)},[e]),P=S-x[O];return{range:[D,O],topSpacer:A,bottomSpacer:P,measureRef:j,spacerRef:h,offsets:x,getItemTop:ne,getItemElement:re,getItemHeight:M,scrollToIndex:N}}var K,Wr,Gr,Kr,qr,Jr,Yr,Xr,Zr,Qr=e((()=>{K=t(p(),1),Wr=3,Gr=40,Kr=30,qr=20,Jr=1,Yr=200,Xr=25,Zr=()=>{}}));function $r({children:e}){let[t,n]=(0,q.useState)(null),[r,i]=(0,q.useState)(null);return(0,ii.jsx)(oi.Provider,{value:n,children:(0,ii.jsx)(ci.Provider,{value:i,children:(0,ii.jsx)(ai.Provider,{value:t,children:(0,ii.jsx)(si.Provider,{value:r,children:e})})})})}function ei(){return(0,q.useContext)(ai)}function ti(){return(0,q.useContext)(si)}function ni(e){let t=(0,q.useContext)(oi);(0,q.useEffect)(()=>{if(t)return t(e),()=>t(null)},[t,e])}function ri(e){let t=(0,q.useContext)(ci);(0,q.useEffect)(()=>{if(t)return t(e),()=>t(null)},[t,e])}var q,ii,ai,oi,si,ci,li=e((()=>{q=t(p(),1),ii=x(),ai=(0,q.createContext)(null),oi=(0,q.createContext)(null),si=(0,q.createContext)(null),ci=(0,q.createContext)(null)}));function ui(e){let[t,n]=(0,J.useState)(null),r=(0,J.useRef)(e);r.current=e;let i=(0,J.useRef)(null),a=(0,J.useCallback)(()=>{n(null)},[]),o=(0,J.useCallback)(e=>{let t=Math.max(0,e.getScrollHeight()-e.getViewportHeight());e.getScrollTop()+e.getPendingDelta()>=t||i.current===null&&(i.current=e.getScrollHeight(),n(r.current))},[]),s=(0,J.useCallback)(e=>{e&&e.scrollToBottom()},[]);return(0,J.useEffect)(()=>{t===null?i.current=null:e<t&&(i.current=null,n(null))},[e,t]),{dividerIndex:t,dividerYRef:i,onScrollAway:o,onRepin:a,jumpToNew:s,shiftDivider:(0,J.useCallback)((e,t)=>{n(t=>t===null?null:t+e),i.current!==null&&(i.current+=t)},[])}}function di(e,t){let n=0,r=!1;for(let i=t;i<e.length;i++){let t=e[i];if(t.type===`progress`||t.type===`assistant`&&!fi(t))continue;let a=t.type===`assistant`;a&&!r&&n++,r=a}return n}function fi(e){if(e.type!==`assistant`||!Array.isArray(e.message.content))return!1;for(let t of e.message.content)if(typeof t!=`string`&&t.type===`text`&&t.text.trim()!==``)return!0;return!1}function pi(e,t){if(t===null)return;let n=t;for(;n<e.length&&(e[n]?.type===`progress`||Ar(e[n]));)n++;let r=e[n]?.uuid;if(!r)return;let i=di(e,t);return{firstUnseenUuid:r,count:Math.max(1,i)}}function mi({scrollable:e,bottom:t,overlay:n,bottomFloat:r,modal:i,modalScrollRef:a,scrollRef:o,dividerYRef:s,hidePill:l=!1,hideSticky:d=!1,newMessageCount:p=0,onPillClick:m}){let{rows:h,columns:g}=v(),[_,y]=(0,J.useState)(null),x=(0,J.useMemo)(()=>({setStickyPrompt:y}),[]),S=(0,J.useSyncExternalStore)((0,J.useCallback)(e=>o?.current?.subscribe(e)??(()=>{}),[o]),()=>{let e=o?.current,t=s?.current;return!e||t==null?!1:e.getScrollTop()+e.getPendingDelta()+e.getViewportHeight()<t});if((0,J.useLayoutEffect)(()=>{if(!P())return;let e=f.get(process.stdout);if(e)return e.onHyperlinkClick=e=>{if(e.startsWith(`file:`))try{We(Xt(e))}catch{}else _e(e)},()=>{e.onHyperlinkClick=void 0}},[]),P()){let s=d?null:_,f=s!=null&&s!==`clicked`&&n==null?s:null,v=s!=null&&n==null;return(0,Y.jsxs)($r,{children:[(0,Y.jsx)(c,{flexDirection:`row`,flexGrow:1,overflow:`hidden`,width:`100%`,children:(0,Y.jsxs)(c,{flexDirection:`column`,flexGrow:1,width:g,overflow:`hidden`,children:[(0,Y.jsxs)(c,{flexGrow:1,flexDirection:`column`,overflow:`hidden`,children:[f&&(0,Y.jsx)(gi,{text:f.text,onClick:f.scrollTo}),(0,Y.jsxs)(b,{ref:o,flexGrow:1,flexDirection:`column`,paddingTop:+!v,stickyScroll:!0,children:[(0,Y.jsx)(bi,{value:x,children:e}),n]}),!l&&S&&n==null&&(0,Y.jsx)(hi,{count:p,onClick:m}),r!=null&&(0,Y.jsx)(c,{position:`absolute`,bottom:0,right:0,opaque:!0,children:r})]}),(0,Y.jsxs)(c,{flexDirection:`column`,flexShrink:0,width:`100%`,maxHeight:`50%`,children:[(0,Y.jsx)(_i,{}),(0,Y.jsx)(vi,{}),(0,Y.jsx)(c,{flexDirection:`column`,width:`100%`,flexGrow:1,overflowY:`hidden`,children:t})]})]})}),i!=null&&(0,Y.jsx)(Ft,{value:{rows:h-yi-1,columns:g-4,scrollRef:a??null},children:(0,Y.jsxs)(c,{position:`absolute`,bottom:0,left:0,right:0,maxHeight:h-yi,flexDirection:`column`,overflow:`hidden`,opaque:!0,children:[(0,Y.jsx)(c,{flexShrink:0,children:(0,Y.jsx)(u,{color:`permission`,children:`▔`.repeat(g)})}),(0,Y.jsx)(c,{flexDirection:`column`,paddingX:2,flexShrink:0,overflow:`hidden`,children:i})]})})]})}return(0,Y.jsxs)(Y.Fragment,{children:[e,t,n,i]})}function hi({count:e,onClick:t}){let[n,r]=(0,J.useState)(!1);return(0,Y.jsx)(c,{position:`absolute`,bottom:0,left:0,right:0,justifyContent:`center`,children:(0,Y.jsx)(c,{onClick:t,onMouseEnter:()=>r(!0),onMouseLeave:()=>r(!1),children:(0,Y.jsxs)(u,{backgroundColor:n?`userMessageBackgroundHover`:`userMessageBackground`,dimColor:!0,children:[` `,e>0?`${e} new ${ft(e,`message`)}`:`Jump to bottom`,` `,a.arrowDown,` `]})})})}function gi({text:e,onClick:t}){let[n,r]=(0,J.useState)(!1);return(0,Y.jsx)(c,{flexShrink:0,width:`100%`,height:1,paddingRight:1,backgroundColor:n?`userMessageBackgroundHover`:`userMessageBackground`,onClick:t,onMouseEnter:()=>r(!0),onMouseLeave:()=>r(!1),children:(0,Y.jsxs)(u,{color:`subtle`,wrap:`truncate-end`,children:[a.pointer,` `,e]})})}function _i(){let e=ei();return!e||e.suggestions.length===0?null:(0,Y.jsx)(c,{position:`absolute`,bottom:`100%`,left:0,right:0,paddingX:2,paddingTop:1,flexDirection:`column`,opaque:!0,children:(0,Y.jsx)(At,{suggestions:e.suggestions,selectedSuggestion:e.selectedSuggestion,maxColumnWidth:e.maxColumnWidth,overlay:!0})})}function vi(){let e=ti();return e?(0,Y.jsx)(c,{position:`absolute`,bottom:`100%`,left:0,right:0,opaque:!0,children:e}):null}var J,Y,yi,bi,xi=e((()=>{i(),J=t(p(),1),Pt(),li(),Le(),y(),Ge(),z(),pt(),Mr(),jt(),Y=x(),yi=2,bi=(0,J.createContext)({setStickyPrompt:()=>{}})}));function Si(e){let t=ki.get(e);if(t!==void 0)return t;let n=dn(e);return ki.set(e,n),n}function Ci(e){let t=ji.get(e);if(t!==void 0)return t;let n=wi(e);return ji.set(e,n),n}function wi(e){let t=null;if(e.type===`user`){if(e.isMeta||e.isVisibleInTranscriptOnly)return null;let n=e.message.content[0];if(n?.type!==`text`)return null;t=n.text??null}else if(e.type===`attachment`&&e.attachment.type===`queued_command`&&e.attachment.commandMode!==`task-notification`&&!e.attachment.isMeta){let n=e.attachment.prompt;t=typeof n==`string`?n:n.flatMap(e=>e.type===`text`?[e.text??``]:[]).join(`
10
- `)}if(t===null)return null;let n=se(t);return n.startsWith(`<`)||n===``?null:n}function Ti({itemKey:e,msg:t,idx:n,measureRef:r,expanded:i,hovered:a,clickable:o,onClickK:s,onEnterK:u,onLeaveK:d,renderItem:f}){return(0,Z.jsx)(c,{ref:r(e),flexDirection:`column`,backgroundColor:i?`userMessageBackgroundHover`:void 0,paddingBottom:i?1:void 0,onClick:o?e=>s(t,e.cellIsBlank):void 0,onMouseEnter:o?()=>u(e):void 0,onMouseLeave:o?()=>d(e):void 0,children:(0,Z.jsx)(l.Provider,{value:a&&!i?`text`:void 0,children:f(t,n)})})}function Ei({messages:e,scrollRef:t,columns:n,itemKey:r,renderItem:i,onItemClick:a,isItemClickable:o,isItemExpanded:s,extractSearchText:l=Si,trackStickyPrompt:u,selectedIndex:d,cursorNavRef:f,setCursor:p,jumpRef:m,onSearchMatchesChange:h,scanElement:g,setPositions:_}){let v=(0,X.useRef)([]),y=(0,X.useRef)(e),b=(0,X.useRef)(r);if(b.current!==r||e.length<v.current.length||e[0]!==y.current[0])v.current=e.map(e=>r(e));else for(let t=v.current.length;t<e.length;t++)v.current.push(r(e[t]));y.current=e,b.current=r;let x=v.current,{range:S,topSpacer:C,bottomSpacer:w,measureRef:T,spacerRef:E,offsets:D,getItemTop:k,getItemElement:A,getItemHeight:ee,scrollToIndex:te}=Ur(t,x,n),[j,ne]=S,re=(0,X.useCallback)(t=>ee(t)!==0&&pe(e[t]),[ee,e]);(0,X.useImperativeHandle)(f,()=>{let n=e=>p?.({uuid:e.uuid,msgType:e.type,expanded:!1,toolName:O(e)?.name}),r=d??-1,i=(t,r,i=re)=>{for(let a=t;a>=0&&a<e.length;a+=r)if(i(a))return n(e[a]),!0;return!1},a=t=>re(t)&&e[t].type===`user`;return{enterCursor:()=>i(e.length-1,-1,a),navigatePrev:()=>i(r-1,-1),navigateNext:()=>{i(r+1,1)||(t.current?.scrollToBottom(),p?.(null))},navigatePrevUser:()=>i(r-1,-1,a),navigateNextUser:()=>i(r+1,1,a),navigateTop:()=>i(0,1),navigateBottom:()=>i(e.length-1,-1),getSelected:()=>r>=0?e[r]??null:null}},[e,d,p,re]);let M=(0,X.useRef)({offsets:D,start:j,getItemElement:A,getItemTop:k,messages:e,scrollToIndex:te});M.current={offsets:D,start:j,getItemElement:A,getItemTop:k,messages:e,scrollToIndex:te},(0,X.useEffect)(()=>{if(d===void 0)return;let e=M.current,n=e.getItemElement(d);n?t.current?.scrollToElement(n,1):e.scrollToIndex(d)},[d,t]);let N=(0,X.useRef)(null),P=(0,X.useRef)({msgIdx:-1,positions:[]}),F=(0,X.useRef)(-1),ie=(0,X.useRef)(0),ae=(0,X.useRef)(0),oe=(0,X.useRef)(()=>{}),se=(0,X.useRef)(()=>{}),ce=(0,X.useRef)({matches:[],ptr:0,screenOrd:0,prefixSum:[]}),le=(0,X.useRef)(-1),I=(0,X.useRef)(!1);function ue(e){let t=M.current.getItemTop(e);return Math.max(0,t-Oi)}function de(e){let n=t.current,{msgIdx:r,positions:i}=P.current;if(!n||i.length===0||r<0){_?.(null);return}let a=Math.max(0,Math.min(e,i.length-1)),o=i[a],s=M.current.getItemTop(r),c=n.getViewportTop(),l=s-n.getScrollTop(),u=n.getViewportHeight(),d=c+l+o.row;(d<c||d>=c+u)&&(n.scrollTo(Math.max(0,s+o.row-Oi)),l=s-n.getScrollTop(),d=c+l+o.row),_?.({positions:i,rowOffset:c+l,currentIdx:a});let f=ce.current,p=f.prefixSum.at(-1)??0,m=(f.prefixSum[f.ptr]??0)+a+1;h?.(p,m),Ze(`highlight(i=${r}, ord=${a}/${i.length}): pos={row:${o.row},col:${o.col}} lo=${l} screenRow=${d} badge=${m}/${p}`)}se.current=de;let[fe,L]=(0,X.useState)(0),me=(0,X.useCallback)(()=>L(e=>e+1),[]);(0,X.useEffect)(()=>{let e=N.current;if(!e)return;let{idx:n,wantLast:r,tries:i}=e,a=t.current;if(!a)return;let{getItemElement:o,getItemTop:s,scrollToIndex:c}=M.current,l=o(n),u=l?.yogaNode?.getComputedHeight()??0;if(!l||u===0){if(i>1){N.current=null,Ze(`seek(i=${n}): no mount after scrollToIndex, skip`),oe.current(r?-1:1);return}N.current={idx:n,wantLast:r,tries:i+1},c(n),me();return}N.current=null,a.scrollTo(Math.max(0,s(n)-Oi));let d=g?.(l)??[];if(P.current={msgIdx:n,positions:d},Ze(`seek(i=${n} t=${i}): ${d.length} positions`),d.length===0){if(++ie.current>20){ie.current=0;return}oe.current(r?-1:1);return}ie.current=0;let f=r?d.length-1:0;ce.current.screenOrd=f,F.current=-1,se.current(f);let p=ae.current;p&&(ae.current=0,oe.current(p))},[fe]);function he(e,n){let r=t.current;if(!r)return;let i=M.current,{getItemElement:a,scrollToIndex:o}=i;if(e<0||e>=i.messages.length)return;_?.(null),P.current={msgIdx:-1,positions:[]},N.current={idx:e,wantLast:n,tries:0};let s=a(e),c=s?.yogaNode?.getComputedHeight()??0;s&&c>0?r.scrollTo(ue(e)):o(e),me()}function ge(e){let t=ce.current,{matches:n,prefixSum:r}=t,i=r.at(-1)??0;if(n.length===0)return;if(N.current){ae.current=e;return}F.current<0&&(F.current=t.ptr);let{positions:a}=P.current,o=t.screenOrd+e;if(o>=0&&o<a.length){t.screenOrd=o,de(o),F.current=-1;return}let s=(t.ptr+e+n.length)%n.length;if(s===F.current){_?.(null),F.current=-1,Ze(`step: wraparound at ptr=${s}, all ${n.length} msgs phantoms`);return}t.ptr=s,t.screenOrd=0,he(n[s],e<0);let c=e<0?r[s+1]??i:r[s]+1;h?.(i,c)}oe.current=ge,(0,X.useImperativeHandle)(m,()=>({jumpToIndex:e=>{let n=t.current;n&&n.scrollTo(ue(e))},setSearchQuery:e=>{N.current=null,P.current={msgIdx:-1,positions:[]},F.current=-1,_?.(null);let n=e.toLowerCase(),r=[],i=[0];if(n){let e=M.current.messages;for(let t=0;t<e.length;t++){let a=l(e[t]),o=a.indexOf(n),s=0;for(;o>=0;)s++,o=a.indexOf(n,o+n.length);s>0&&(r.push(t),i.push(i.at(-1)+s))}}let a=i.at(-1),o=0,s=t.current,{offsets:c,start:u,getItemTop:d}=M.current,f=d(u),p=f>=0?f-c[u]:0;if(r.length>0&&s){let t=le.current>=0?le.current:s.getScrollTop(),n=1/0;for(let e=0;e<r.length;e++){let i=Math.abs(p+c[r[e]]-t);i<=n&&(n=i,o=e)}Ze(`setSearchQuery('${e}'): ${r.length} msgs · ptr=${o} msgIdx=${r[o]} curTop=${t} origin=${p}`)}ce.current={matches:r,ptr:o,screenOrd:0,prefixSum:i},r.length>0?he(r[o],!0):le.current>=0&&s&&s.scrollTo(le.current),h?.(a,r.length>0?i[o+1]??a:0)},nextMatch:()=>ge(1),prevMatch:()=>ge(-1),setAnchor:()=>{let e=t.current;e&&(le.current=e.getScrollTop())},disarmSearch:()=>{_?.(null),N.current=null,P.current={msgIdx:-1,positions:[]},F.current=-1},warmSearchIndex:async()=>{if(I.current)return 0;let e=M.current.messages,t=0,n=performance.now();for(let n=0;n<e.length;n+=500){await Ct(0);let r=performance.now(),i=Math.min(n+500,e.length);for(let t=n;t<i;t++)l(e[t]);t+=performance.now()-r}let r=Math.round(performance.now()-n);return Ze(`warmSearchIndex: ${e.length} msgs · work=${Math.round(t)}ms wall=${r}ms chunks=${Math.ceil(e.length/500)}`),I.current=!0,Math.round(t)}}),[t]);let[R,_e]=(0,X.useState)(null),ve=(0,X.useRef)({onItemClick:a,setHoveredKey:_e});ve.current={onItemClick:a,setHoveredKey:_e};let ye=(0,X.useCallback)((e,t)=>{let n=ve.current;!t&&n.onItemClick&&n.onItemClick(e)},[]),be=(0,X.useCallback)(e=>{ve.current.setHoveredKey(e)},[]),xe=(0,X.useCallback)(e=>{ve.current.setHoveredKey(t=>t===e?null:t)},[]);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(c,{ref:E,height:C,flexShrink:0}),e.slice(j,ne).map((e,t)=>{let n=j+t,r=x[n],c=!!a&&(o?.(e)??!0),l=c&&R===r,u=s?.(e);return(0,Z.jsx)(Ti,{itemKey:r,msg:e,idx:n,measureRef:T,expanded:u,hovered:l,clickable:c,onClickK:ye,onEnterK:be,onLeaveK:xe,renderItem:i},r)}),w>0&&(0,Z.jsx)(c,{height:w,flexShrink:0}),u&&(0,Z.jsx)(Di,{messages:e,start:j,end:ne,offsets:D,getItemTop:k,getItemElement:A,scrollRef:t})]})}function Di({messages:e,start:t,end:n,offsets:r,getItemTop:i,getItemElement:a,scrollRef:o}){let{setStickyPrompt:s}=(0,X.useContext)(bi);(0,X.useSyncExternalStore)((0,X.useCallback)(e=>o.current?.subscribe(e)??Mi,[o]),()=>{let e=o.current;if(!e)return NaN;let t=e.getScrollTop()+e.getPendingDelta();return e.isSticky()?-1-t:t});let c=o.current?.isSticky()??!0,l=Math.max(0,(o.current?.getScrollTop()??0)+(o.current?.getPendingDelta()??0)),u=t,d=-1;for(let e=n-1;e>=t;e--){let t=i(e);if(t>=0){if(t<l)break;d=t}u=e}let f=-1,p=null;if(u>0&&!c)for(let t=u-1;t>=0;t--){let n=Ci(e[t]);if(n===null)continue;let r=i(t);if(!(r>=0&&r+1>=l)){f=t,p=n;break}}let m=d>=0?d-r[u]:0,h=f>=0?Math.max(0,m+r[f]):-1,g=(0,X.useRef)({idx:-1,tries:0}),_=(0,X.useRef)(`none`),v=(0,X.useRef)(-1);return(0,X.useEffect)(()=>{if(g.current.idx>=0)return;if(_.current===`armed`){_.current=`force`;return}let e=_.current===`force`;if(_.current=`none`,!e&&v.current===f)return;if(v.current=f,p===null){s(null);return}let t=p.trimStart(),n=t.search(/\n\s*\n/),r=(n>=0?t.slice(0,n):t).slice(0,Ai).replace(/\s+/g,` `).trim();if(r===``){s(null);return}let i=f,c=h;s({text:r,scrollTo:()=>{s(`clicked`),_.current=`armed`;let e=a(i);e?o.current?.scrollToElement(e,1):(o.current?.scrollTo(c),g.current={idx:i,tries:0})}})}),(0,X.useEffect)(()=>{if(g.current.idx<0)return;let e=a(g.current.idx);e?(o.current?.scrollToElement(e,1),g.current={idx:-1,tries:0}):++g.current.tries>5&&(g.current={idx:-1,tries:0})}),null}var X,Z,Oi,ki,Ai,ji,Mi,Ni=e((()=>{X=t(p(),1),Qr(),y(),Ve(),xi(),Z=x(),Qe(),wt(),vn(),de(),Oi=3,ki=new WeakMap,Ai=500,ji=new WeakMap,Mi=()=>{}}));function Pi(e,t,n=Vi,r=Hi){let i=t.current,a=i?e.findIndex(e=>e.uuid===i.uuid):-1,o=a>=0?a:i?Math.min(i.idx,Math.max(0,e.length-n)):0;e.length-o>n+r&&(o=e.length-n);let s=e[o];return s&&(i?.uuid!==s.uuid||i.idx!==o)?t.current={uuid:s.uuid,idx:o}:!s&&i&&(t.current=null),o}function Fi(e){return(e.type===`assistant`||e.type===`user`?qe(e):null)??e.uuid}function Ii(e,t){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}function Li(e,t,n,r,i,a){if(i===`transcript`)return!0;switch(e.type){case`attachment`:case`user`:case`assistant`:{if(e.type===`assistant`){let t=e.message.content[0];if(t?.type===`server_tool_use`)return a.resolvedToolUseIDs.has(t.id)}let i=qe(e);return i?t.has(i)||n.has(i)||B(i,`PostToolUse`,a)?!1:Zt(r,a.resolvedToolUseIDs):!0}case`system`:return e.subtype!==`api_error`;case`grouped_tool_use`:return e.messages.every(e=>{let t=e.message.content[0];return t?.type===`tool_use`&&a.resolvedToolUseIDs.has(t.id)});case`collapsed_read_search`:return!1;default:return!0}}var Ri,Q,$,zi,Bi,Vi,Hi,Ui,Wi,Gi=e((()=>{h(),Ri=t(p(),1),Q=t(p(),1),Qt(),S(),Le(),y(),Ae(),vt(),L(),tn(),an(),Ee(),tt(),r(),z(),un(),M(),pt(),vn(),pr(),ye(),kr(),de(),Se(),Mr(),Ue(),Hr(),$=x(),ue(),Ni(),zi=Ri.memo(function({agentDefinitions:e}){return(0,$.jsx)(R,{children:(0,$.jsxs)(c,{flexDirection:`column`,gap:1,children:[(0,$.jsx)(ur,{}),(0,$.jsx)(Ri.Suspense,{fallback:null,children:(0,$.jsx)(Rr,{agentDefinitions:e})})]})})}),Bi=30,Vi=200,Hi=50,Ui=({messages:e,tools:t,commands:r,verbose:i,toolJSX:a,toolUseConfirmQueue:s,inProgressToolUseIDs:l,isMessageSelectorVisible:f,conversationId:p,screen:h,streamingToolUses:g,showAllInTranscript:_=!1,agentDefinitions:y,hideLogo:b=!1,isLoading:x,hidePastThinking:S=!1,streamingThinking:w,streamingText:T,unseenDivider:O,scrollRef:k,trackStickyPrompt:A,jumpRef:ee,onSearchMatchesChange:te,scanElement:j,setPositions:ne,disableRenderCap:M=!1,cursor:F=null,setCursor:ie,cursorNavRef:se,renderRange:I})=>{let{columns:ue}=v(),de=Pe(`transcript:toggleShowAll`,`Transcript`,`Ctrl+E`),L=(0,Q.useMemo)(()=>Oe(e).filter(le),[e]),pe=(0,Q.useMemo)(()=>w?w.isStreaming?!0:w.streamingEndedAt?Date.now()-w.streamingEndedAt<3e4:!1:!1,[w]),{lastThinkingBlockId:me,latestBashOutputUUID:he}=(0,Q.useMemo)(()=>{let e=null,t=null,n=S&&!pe;S&&pe&&(e=`streaming`);for(let r=L.length-1;r>=0;r--){let i=L[r];if(i?.type===`user`){let r=i.message.content;if(!t){for(let e of r)if(e.type===`text`){let n=e.text??``;if(n.startsWith(`<bash-stdout`)||n.startsWith(`<bash-stderr`)){t=i.uuid;break}}}n&&!e&&(r.some(e=>e.type===`tool_result`)||(e=`no-thinking`))}else if(i?.type===`assistant`&&n&&!e){let t=i.message.content;for(let n=t.length-1;n>=0;n--)if(t[n]?.type===`thinking`){e=`${i.uuid}:${n}`;break}}if(e!==null&&t)break}return S||(e=null),{lastThinkingBlockId:e,latestBashOutputUUID:t}},[L,S,pe]),R=(0,Q.useMemo)(()=>ke(L),[L]),_e=(0,Q.useMemo)(()=>g.filter(e=>!l.has(e.contentBlock.id)&&!R.has(e.contentBlock.id)),[g,l,R]),ye=(0,Q.useMemo)(()=>_e.flatMap(e=>{let t=re({content:[e.contentBlock]});return t.uuid=Me(e.contentBlock.id,0),Oe([t])}),[_e]),be=h===`transcript`,xe=(0,Q.useMemo)(()=>n(process.env.WORKMATE_DISABLE_VIRTUAL_SCROLL),[]),Se=k!=null&&!xe,Ce=be&&!_&&!Se,Te=(0,Q.useRef)(null),z=(0,Q.useRef)(null),{collapsed:Ee,lookups:De,hasTruncatedMessages:Ae,hiddenMessageCount:je}=(0,Q.useMemo)(()=>{let e=ve((i||P()?L:ce(L,{includeSnipped:!0})).filter(e=>e.type!==`progress`&&!Ar(e)&&we(e,be)),ye),n=Ce?e.slice(-30):e,r=Ce&&e.length>Bi,{messages:a}=cn(n,t,i),o=en(rn(He(a,t)),i),s=E(L,n),c=(()=>{let e=n.at(-1);return e?.type===`assistant`?e.message?.id:void 0})(),l;if(z.current&&z.current.key===s)l=z.current.lookups;else if(z.current&&L.length>=z.current.normalizedCount&&n.length>=z.current.messageCount&&z.current.lastAssistantMsgId===c){let e=ge(z.current.lookups,z.current.normalizedCount,z.current.messageCount,L,n);e?(l=e,z.current={key:s,lookups:l,normalizedCount:L.length,messageCount:n.length,lastAssistantMsgId:c}):(l=oe(L,n),z.current={key:s,lookups:l,normalizedCount:L.length,messageCount:n.length,lastAssistantMsgId:c})}else l=oe(L,n),z.current={key:s,lookups:l,normalizedCount:L.length,messageCount:n.length,lastAssistantMsgId:c};let u=e.length-Bi;return{collapsed:o,lookups:l,hasTruncatedMessages:r,hiddenMessageCount:u}},[i,L,be,ye,Ce,t]),B=(0,Q.useMemo)(()=>{let e=!Se&&!M?Pi(Ee,Te):0;return I?Ee.slice(I[0],I[1]):e>0?Ee.slice(e):Ee},[Ee,I,Se,M]),Fe=(0,Q.useMemo)(()=>new Set(g.map(e=>e.contentBlock.id)),[g]),{dividerBeforeIndex:Ie,selectedIdx:Le}=(0,Q.useMemo)(()=>{if(!O&&!F)return{dividerBeforeIndex:-1,selectedIdx:-1};let e=-1,t=-1,n=O?.firstUnseenUuid.slice(0,24);for(let r=0;r<B.length;r++){let i=B[r];if(e===-1&&n&&i.uuid.slice(0,24)===n&&(e=r),t===-1&&F&&i.uuid===F.uuid&&(t=r),e!==-1&&t!==-1)break}return{dividerBeforeIndex:e,selectedIdx:t}},[O,F,B]),[Re,Be]=(0,Q.useState)(()=>new Set),Ve=(0,Q.useCallback)(e=>{let t=Fi(e);Be(e=>{let n=new Set(e);return n.has(t)?n.delete(t):n.add(t),n})},[]),Ue=(0,Q.useCallback)(e=>Re.size>0&&Re.has(Fi(e)),[Re]),We=(0,Q.useRef)(De);We.current=De;let Ge=(0,Q.useCallback)(e=>{if(e.type===`collapsed_read_search`)return!0;if(e.type===`assistant`){let t=e.message.content,n=Array.isArray(t)?t[0]:void 0;return n!=null&&ae(n)&&n.type===`advisor_tool_result`&&n.content.type===`advisor_result`}if(e.type!==`user`)return!1;let n=e.message.content[0];if(n?.type!==`tool_result`||n.is_error||!e.toolUseResult)return!1;let r=We.current.toolUseByToolUseID.get(n.tool_use_id??``)?.name;return(r?_t(t,r):void 0)?.isResultTruncated?.(e.toolUseResult)??!1},[t]),Ke=(!a||!!a.shouldContinueAnimation)&&!s.length&&!f,qe=l.size>0,{progress:Je}=d(),Ye=(0,Q.useRef)(null),Xe=rt().terminalProgressBarEnabled&&!N();(0,Q.useEffect)(()=>{let e=Xe?qe?`indeterminate`:`completed`:null;Ye.current!==e&&(Ye.current=e,Je(e))},[Je,Xe,qe]),(0,Q.useEffect)(()=>()=>Je(null),[Je]);let Ze=(0,Q.useCallback)(e=>`${e.uuid}-${p}`,[p]),Qe=(e,n)=>{let a=n>0?B[n-1]?.type:void 0,s=e.type===`user`&&a===`user`,u=e.type===`collapsed_read_search`&&(!!T||br(B,n,t,Fe)),d=B.length-1-n>0,f=Ze(e),p=(0,$.jsx)(Or,{message:e,isUserContinuation:s,hasContentAfter:u,tools:t,commands:r,verbose:i||Ue(e)||F?.expanded===!0&&n===Le,inProgressToolUseIDs:l,streamingToolUseIDs:Fe,screen:h,canAnimate:Ke,lastThinkingBlockId:me,latestBashOutputUUID:he,columns:ue,isLoading:x,lookups:De,shouldCollapseDiffs:d},f),m=(0,$.jsx)(fe.Provider,{value:n===Le,children:p},f);return O&&n===Ie?[(0,$.jsx)(c,{marginTop:1,children:(0,$.jsx)(o,{title:`${O.count} new ${ft(O.count,`message`)}`,width:ue,color:`inactive`})},`unseen-divider`),m]:m},$e=(0,Q.useRef)(new WeakMap),et=(0,Q.useCallback)(e=>{let n=$e.current.get(e);if(n!==void 0)return n;let r=dn(e);if(e.type===`user`&&e.toolUseResult&&Array.isArray(e.message.content)){let n=e.message.content.find(e=>e.type===`tool_result`);if(n&&`tool_use_id`in n){let i=De.toolUseByToolUseID.get(n.tool_use_id),a=(i&&_t(t,i.name))?.extractSearchText?.(e.toolUseResult);a!==void 0&&(r=a)}}let i=r.toLowerCase();return $e.current.set(e,i),i},[t,De]);return(0,$.jsxs)($.Fragment,{children:[!b&&!(I&&I[0]>0)&&(0,$.jsx)(zi,{agentDefinitions:y}),Ae&&(0,$.jsx)(o,{title:`${de} to show ${m.bold(je)} previous messages`,width:ue}),be&&_&&je>0&&!M&&(0,$.jsx)(o,{title:`${de} to hide ${m.bold(je)} previous messages`,width:ue}),Se?(0,$.jsx)(Ne.Provider,{value:!0,children:(0,$.jsx)(Ei,{messages:B,scrollRef:k,columns:ue,itemKey:Ze,renderItem:Qe,onItemClick:Ve,isItemClickable:Ge,isItemExpanded:Ue,trackStickyPrompt:A,selectedIndex:Le>=0?Le:void 0,cursorNavRef:se,setCursor:ie,jumpRef:ee,onSearchMatchesChange:te,scanElement:j,setPositions:ne,extractSearchText:et})}):B.flatMap(Qe),T&&(0,$.jsx)(c,{alignItems:`flex-start`,flexDirection:`row`,marginTop:1,width:`100%`,children:(0,$.jsxs)(c,{flexDirection:`row`,children:[(0,$.jsx)(c,{minWidth:2,children:(0,$.jsx)(u,{color:`text`,children:C})}),(0,$.jsx)(c,{flexDirection:`column`,children:(0,$.jsx)(ze,{children:T})})]})}),pe&&w&&(0,$.jsx)(c,{marginTop:1,children:(0,$.jsx)(D,{param:{type:`thinking`,thinking:w.thinking},addMargin:!1,isTranscriptMode:!0,verbose:i,hideInTranscript:!1})})]})},Wi=Ri.memo(Ui,(e,t)=>{let n=Object.keys(e);for(let r of n)if(!(r===`scrollRef`||r===`trackStickyPrompt`||r===`setCursor`||r===`cursorNavRef`||r===`jumpRef`||r===`onSearchMatchesChange`||r===`scanElement`||r===`setPositions`)&&e[r]!==t[r]){if(r===`streamingToolUses`){let n=e.streamingToolUses,r=t.streamingToolUses;if(n.length===r.length&&n.every((e,t)=>e.contentBlock===r[t]?.contentBlock))continue}if(r===`inProgressToolUseIDs`&&Ii(e.inProgressToolUseIDs,t.inProgressToolUseIDs))continue;if(r===`unseenDivider`){let n=e.unseenDivider,r=t.unseenDivider;if(n?.firstUnseenUuid===r?.firstUnseenUuid&&n?.count===r?.count)continue}if(r===`tools`){let n=e.tools,r=t.tools;if(n.length===r.length&&n.every((e,t)=>e.name===r[t]?.name))continue}return!1}return!0})}));export{xi as a,ni as c,pi as i,ri as l,Gi as n,ui as o,mi as r,li as s,Wi as t};
@@ -1 +0,0 @@
1
- import{a as e}from"./rolldown-runtime-DaDcL9Zw.js";import{l as t,o as n,s as r}from"./envUtils-QyzA_cFM.js";import{n as i,t as a}from"./defineProperty-C-QyHrDq.js";import{Kr as o,qr as s}from"./src-BX54x08P.js";import{X as c,d as l,m as u,q as d}from"./settings-D4M13toi.js";import{Ft as ee,K as f,Pt as p,at as m,ft as h,gt as g,rt as _}from"./state-CXY-q5gr.js";import{$ as v,$h as te,AC as y,Ai as ne,Bv as b,Cs as x,DC as S,F_ as C,GS as w,Gu as T,Gv as E,Gx as D,I_ as O,Ia as re,Ji as k,Js as ie,Ju as ae,Mi as oe,Oa as A,P_ as se,Pa as ce,Ss as le,Ts as ue,Uv as j,Vp as M,Wr as N,X as de,Xn as P,Y as fe,_C as F,ag as I,bS as pe,bb as L,cw as me,dy as he,fa as ge,gn as _e,gr as ve,gw as ye,hn as be,hv as R,hw as xe,mv as Se,ng as Ce,ot as we,pS as Te,qS as z,qs as B,st as V,ty as Ee,vC as De,ws as Oe,xb as ke,zp as H,zv as U}from"./loadAgentsDir-uuZYOgKn.js";import{n as Ae,t as je}from"./cwd-DrEEb4f5.js";import{C as Me,S as Ne,d as W,o as Pe}from"./config-BDn2YIjC.js";import{i as Fe,o as Ie,q as Le}from"./log-L1kqxa_P.js";import{f as G,s as Re,v as ze}from"./model-CcHyMyBv.js";import{at as K,bn as Be,nt as Ve,vn as He}from"./prompt-BfXryFt-.js";import{n as Ue,o as We,r as q}from"./MessageSelector-Dw_ERK_Z.js";import{n as Ge,t as J}from"./systemTheme-Ceakddth.js";import{randomUUID as Y}from"crypto";n(),i(),o(),p(),Ae(),Ie(),u(),Me(),He(),W(),xe(),y(),F(),pe(),he(),K(),E(),R(),I(),M(),B(),ce(),k(),oe(),ve(),be(),de(),V(),O(),b(),G(),Ee(),T();async function Ke({tools:e,mainLoopModel:t,additionalWorkingDirectories:n,mcpClients:r,customSystemPrompt:i}){let[a,o,s]=await Promise.all([i===void 0?we(e,t,n,r):Promise.resolve([]),C(),i===void 0?se():Promise.resolve({})]);return{defaultSystemPrompt:a,userContext:o,systemContext:s}}async function qe({tools:e,commands:t,mcpClients:n,messages:r,readFileState:i,getAppState:a,setAppState:o,customSystemPrompt:s,appendSystemPrompt:c,thinkingConfig:l,agents:u}){let d=Re(),ee=a(),{defaultSystemPrompt:f,userContext:p,systemContext:m}=await Ke({tools:e,mainLoopModel:d,additionalWorkingDirectories:Array.from(ee.toolPermissionContext.additionalWorkingDirectories.keys()),mcpClients:n,customSystemPrompt:s}),h=w([...s===void 0?f:[s],...c?[c]:[]]),g=r.at(-1),_=g?.type===`assistant`&&g.message.stop_reason===null?r.slice(0,-1):r;return{systemPrompt:h,userContext:p,systemContext:m,toolUseContext:{options:{commands:t,debug:!1,mainLoopModel:d,tools:e,verbose:!1,thinkingConfig:l??(ae()===!1?{type:`disabled`}:{type:`adaptive`}),mcpClients:n,mcpResources:{},isNonInteractiveSession:!0,agentDefinitions:{activeAgents:u,allAgents:[]},customSystemPrompt:s,appendSystemPrompt:c},abortController:U(),readFileState:i,getAppState:a,setAppState:o,messages:_,setInProgressToolUseIDs:()=>{},setResponseLength:()=>{},updateFileHistoryState:()=>{},updateAttributionState:()=>{}},forkContextMessages:_}}c(),L(),A(),J(),me();function X(e){return e.flatMap(e=>{if(!e)return[];switch(e.type){case`assistant`:return[{type:`assistant`,message:e.message,uuid:e.uuid,requestId:void 0,timestamp:new Date().toISOString()}];case`user`:return[{type:`user`,message:e.message,uuid:e.uuid??Y(),timestamp:e.timestamp??new Date().toISOString(),isMeta:e.isSynthetic}];default:return[]}})}function Je(e){let t=e.preservedSegment;return{trigger:e.trigger,pre_tokens:e.preTokens,...t&&{preserved_segment:{head_uuid:t.headUuid,anchor_uuid:t.anchorUuid,tail_uuid:t.tailUuid}}}}function Ye(e,t){let n=D({content:s(e).replace(/<local-command-stdout>([\s\S]*?)<\/local-command-stdout>/,`$1`).replace(/<local-command-stderr>([\s\S]*?)<\/local-command-stderr>/,`$1`).trim()});return{type:`assistant`,content:n.message?.content,message:n.message,parent_tool_use_id:null,session_id:m(),uuid:t}}function Z(e){if(e)return{type:`rate_limit`,status:e.status,...e.resetsAt!==void 0&&{resetsAt:e.resetsAt},...e.rateLimitType!==void 0&&{rateLimitType:e.rateLimitType},...e.utilization!==void 0&&{utilization:e.utilization},...e.overageStatus!==void 0&&{overageStatus:e.overageStatus},...e.overageResetsAt!==void 0&&{overageResetsAt:e.overageResetsAt},...e.overageDisabledReason!==void 0&&{overageDisabledReason:e.overageDisabledReason},...e.isUsingOverage!==void 0&&{isUsingOverage:e.isUsingOverage},...e.surpassedThreshold!==void 0&&{surpassedThreshold:e.surpassedThreshold}}}p();function Xe(e){return e===`Agent`?d:e}function Ze(e){let t=l()?.outputStyle??`default`,n={type:`system`,subtype:`init`,cwd:je(),session_id:m(),tools:e.tools.map(e=>Xe(e.name)),mcp_servers:e.mcpClients.map(e=>({name:e.name,status:e.type})),model:e.model,permissionMode:e.permissionMode,slash_commands:e.commands.filter(e=>e.userInvocable!==!1).map(e=>e.name),apiKeySource:process.env.ANTHROPIC_API_KEY?`ANTHROPIC_API_KEY`:`none`,betas:_(),claude_code_version:`0.0.27`,output_style:t,agents:e.agents.map(e=>e.agentType),skills:e.skills.filter(e=>e.userInvocable!==!1).map(e=>e.name),plugins:e.plugins.map(e=>({name:e.name,path:e.path,source:e.source})),uuid:Y()};return n.fast_mode_state=S(e.model,e.fastMode),n}p(),o(),Le(),b(),Ae(),y(),k(),G(),Ee(),T(),x();var Qe=()=>{try{return q(),e(Ue)}catch{return null}},Q=class{constructor(e){a(this,`config`,void 0),a(this,`mutableMessages`,void 0),a(this,`abortController`,void 0),a(this,`permissionDenials`,void 0),a(this,`totalUsage`,void 0),a(this,`hasHandledOrphanedPermission`,!1),a(this,`readFileState`,void 0),a(this,`discoveredSkillNames`,new Set),a(this,`loadedNestedMemoryPaths`,new Set),this.config=e,this.mutableMessages=e.initialMessages??[],this.abortController=e.abortController??U(),this.permissionDenials=[],this.readFileState=e.readFileCache,this.totalUsage=z}async*submitMessage(e,n){let{cwd:i,commands:a,tools:o,mcpClients:c,verbose:l=!1,thinkingConfig:u,maxTurns:d,maxBudgetUsd:p,taskBudget:_,canUseTool:y,customSystemPrompt:b,appendSystemPrompt:x,userSpecifiedModel:C,fallbackModel:T,jsonSchema:E,getAppState:D,setAppState:O,replayUserMessages:k=!1,includePartialMessages:oe=!1,agents:A=[],setSDKStatus:se,orphanedPermission:ce}=this.config;this.discoveredSkillNames.clear(),this.permissionDenials=[],ke(i);let j=!ee(),M=Date.now(),de=async(e,t,n,r,i,a)=>{let o=await y(e,t,n,r,i,a);return o.behavior!==`allow`&&this.permissionDenials.push({type:`permission_denial`,tool_name:Xe(e.name),tool_use_id:i,tool_input:t}),o},F=D(),I=C?ze(C):Re(),pe=u||(ae()===!1?{type:`disabled`}:{type:`adaptive`});H(`before_getSystemPrompt`);let L=typeof b==`string`?b:void 0,{defaultSystemPrompt:me,userContext:he,systemContext:ve}=await Ke({tools:o,mainLoopModel:I,additionalWorkingDirectories:Array.from(F.toolPermissionContext.additionalWorkingDirectories.keys()),mcpClients:c,customSystemPrompt:L});H(`after_getSystemPrompt`);let be={...he},R=L!==void 0&&Ne()?await ye():null,xe=w([...L===void 0?me:[L],...R?[R]:[],...x?[x]:[]]),we=o.some(e=>Be(e,Ve));E&&we&&_e(O,m());let B={messages:this.mutableMessages,setMessages:e=>{this.mutableMessages=e(this.mutableMessages)},onChangeAPIKey:()=>{},handleElicitation:this.config.handleElicitation,options:{commands:a,debug:!1,tools:o,verbose:l,mainLoopModel:I,thinkingConfig:pe,mcpClients:c,mcpResources:{},isNonInteractiveSession:!0,customSystemPrompt:b,appendSystemPrompt:x,agentDefinitions:{activeAgents:A,allAgents:[]},theme:Ge(Pe().theme),maxBudgetUsd:p},getAppState:D,setAppState:O,abortController:this.abortController,readFileState:this.readFileState,nestedMemoryAttachmentTriggers:new Set,loadedNestedMemoryPaths:this.loadedNestedMemoryPaths,dynamicSkillDirTriggers:new Set,discoveredSkillNames:this.discoveredSkillNames,setInProgressToolUseIDs:()=>{},setResponseLength:()=>{},updateFileHistoryState:e=>{O(t=>{let n=e(t.fileHistory);return n===t.fileHistory?t:{...t,fileHistory:n}})},updateAttributionState:e=>{O(t=>{let n=e(t.attribution);return n===t.attribution?t:{...t,attribution:n}})},setSDKStatus:se};if(ce&&!this.hasHandledOrphanedPermission){this.hasHandledOrphanedPermission=!0;for await(let e of le(ce,o,this.mutableMessages,B))yield e}let{messages:V,shouldQuery:Ee,allowedTools:U,model:Ae,resultText:Me}=await We({input:e,mode:`prompt`,setToolJSX:()=>{},context:{...B,messages:this.mutableMessages},messages:this.mutableMessages,uuid:n?.uuid,isMeta:n?.isMeta,querySource:`sdk`});this.mutableMessages.push(...V);let W=[...this.mutableMessages];if(j&&V.length>0){let e=N(W);r()||(await e,(t(process.env.WORKMATE_EAGER_FLUSH)||t(process.env.WORKMATE_IS_COWORK))&&await P())}let Ie=Qe(),Le=V.filter(e=>e.type===`user`&&!e.isMeta&&!e.toolUseResult&&(Ie?.selectableUserMessagesFilter(e)??!0)||e.type===`system`&&e.subtype===`compact_boundary`),G=k?Le:[];O(e=>({...e,toolPermissionContext:{...e.toolPermissionContext,alwaysAllowRules:{...e.toolPermissionContext.alwaysAllowRules,command:U}}}));let K=Ae??I;B={messages:W,setMessages:()=>{},onChangeAPIKey:()=>{},handleElicitation:this.config.handleElicitation,options:{commands:a,debug:!1,tools:o,verbose:l,mainLoopModel:K,thinkingConfig:pe,mcpClients:c,mcpResources:{},isNonInteractiveSession:!0,customSystemPrompt:b,appendSystemPrompt:x,theme:Ge(Pe().theme),agentDefinitions:{activeAgents:A,allAgents:[]},maxBudgetUsd:p},getAppState:D,setAppState:O,abortController:this.abortController,readFileState:this.readFileState,nestedMemoryAttachmentTriggers:new Set,loadedNestedMemoryPaths:this.loadedNestedMemoryPaths,dynamicSkillDirTriggers:new Set,discoveredSkillNames:this.discoveredSkillNames,setInProgressToolUseIDs:()=>{},setResponseLength:()=>{},updateFileHistoryState:B.updateFileHistoryState,updateAttributionState:B.updateAttributionState,setSDKStatus:se},H(`before_skills_plugins`);let[He,{enabled:Ue}]=await Promise.all([ne(je()),re()]);if(H(`after_skills_plugins`),yield Ze({tools:o,mcpClients:c,model:K,permissionMode:F.toolPermissionContext.mode,commands:a,agents:A,skills:He,plugins:Ue,fastMode:F.fastMode}),H(`system_message_yielded`),!Ee){for(let e of V)if(e.type===`user`&&typeof e.message.content==`string`&&(e.message.content.includes(`<local-command-stdout>`)||e.message.content.includes(`<local-command-stderr>`)||e.isCompactSummary)&&(yield{type:`user`,message:{...e.message,content:s(e.message.content)},session_id:m(),parent_tool_use_id:null,uuid:e.uuid,timestamp:e.timestamp,isReplay:!e.isCompactSummary,isSynthetic:e.isMeta||e.isVisibleInTranscriptOnly}),e.type===`system`&&e.subtype===`local_command`&&typeof e.content==`string`&&(e.content.includes(`<local-command-stdout>`)||e.content.includes(`<local-command-stderr>`))&&(yield Ye(e.content,e.uuid)),e.type===`system`&&e.subtype===`compact_boundary`){let t=e;yield{type:`system`,subtype:`compact_boundary`,session_id:m(),uuid:e.uuid,compact_metadata:Je(t.compactMetadata)}}j&&(await N(W),(t(process.env.WORKMATE_EAGER_FLUSH)||t(process.env.WORKMATE_IS_COWORK))&&await P()),yield{type:`result`,subtype:`success`,is_error:!1,duration_ms:Date.now()-M,duration_api_ms:h(),num_turns:W.length-1,result:Me??``,stop_reason:null,session_id:m(),total_cost_usd:g(),usage:this.totalUsage,modelUsage:f(),permission_denials:this.permissionDenials,fast_mode_state:S(K,F.fastMode),uuid:Y()};return}if(te()&&j){let e=Qe()?.selectableUserMessagesFilter??(e=>!0);V.filter(e).forEach(e=>{Ce(e=>{O(t=>({...t,fileHistory:e(t.fileHistory)}))},e.uuid)})}let q=z,J=1,qe=!1,X,Z=null,Q=Fe().at(-1),$e=E?ge(this.mutableMessages,Ve):0;for await(let e of ie({messages:W,systemPrompt:xe,userContext:be,systemContext:ve,canUseTool:de,toolUseContext:B,fallbackModel:T,querySource:`sdk`,maxTurns:d,taskBudget:_})){if(e.type===`assistant`||e.type===`user`||e.type===`system`&&e.subtype===`compact_boundary`){if(j&&e.type===`system`&&e.subtype===`compact_boundary`){let t=e.compactMetadata?.preservedSegment?.tailUuid;if(t){let e=this.mutableMessages.findLastIndex(e=>e.uuid===t);e!==-1&&await N(this.mutableMessages.slice(0,e+1))}}if(W.push(e),j&&(e.type===`assistant`?N(W):await N(W)),!qe&&G.length>0){qe=!0;for(let e of G)e.type===`user`&&(yield{type:`user`,message:e.message,session_id:m(),parent_tool_use_id:null,uuid:e.uuid,timestamp:e.timestamp,isReplay:!0})}}switch(e.type===`user`&&J++,e.type){case`tombstone`:break;case`assistant`:{let t=e,n=t.message?.stop_reason;n!=null&&(Z=n),this.mutableMessages.push(t),yield*ue(t);break}case`progress`:{let t=e;this.mutableMessages.push(t),j&&(W.push(t),N(W)),yield*ue(t);break}case`user`:{let t=e;this.mutableMessages.push(t),yield*ue(t);break}case`stream_event`:{let t=e.event;if(t.type===`message_start`){q=z;let e=t.message;q=v(q,e.usage)}if(t.type===`message_delta`){q=v(q,t.usage);let e=t.delta;e.stop_reason!=null&&(Z=e.stop_reason)}t.type===`message_stop`&&(this.totalUsage=fe(this.totalUsage,q)),oe&&(yield{type:`stream_event`,event:t,session_id:m(),parent_tool_use_id:null,uuid:Y()});break}case`attachment`:{let n=e;this.mutableMessages.push(n),j&&(W.push(n),N(W));let r=n.attachment;if(r.type===`structured_output`)X=r.data;else if(r.type===`max_turns_reached`){j&&(t(process.env.WORKMATE_EAGER_FLUSH)||t(process.env.WORKMATE_IS_COWORK))&&await P(),yield{type:`result`,subtype:`error_max_turns`,duration_ms:Date.now()-M,duration_api_ms:h(),is_error:!0,num_turns:r.turnCount,stop_reason:Z,session_id:m(),total_cost_usd:g(),usage:this.totalUsage,modelUsage:f(),permission_denials:this.permissionDenials,fast_mode_state:S(K,F.fastMode),uuid:Y(),errors:[`Reached maximum number of turns (${r.maxTurns})`]};return}else k&&r.type===`queued_command`&&(yield{type:`user`,message:{role:`user`,content:r.prompt},session_id:m(),parent_tool_use_id:null,uuid:r.source_uuid||n.uuid,timestamp:n.timestamp,isReplay:!0});break}case`stream_request_start`:break;case`system`:{let t=e,n=this.config.snipReplay?.(t,this.mutableMessages);if(n!==void 0){n.executed&&(this.mutableMessages.length=0,this.mutableMessages.push(...n.messages));break}if(this.mutableMessages.push(t),t.subtype===`compact_boundary`&&t.compactMetadata){let e=t,n=this.mutableMessages.length-1;n>0&&this.mutableMessages.splice(0,n);let r=W.length-1;r>0&&W.splice(0,r),yield{type:`system`,subtype:`compact_boundary`,session_id:m(),uuid:t.uuid,compact_metadata:Je(e.compactMetadata)}}if(t.subtype===`api_error`){let e=t;yield{type:`system`,subtype:`api_retry`,attempt:e.retryAttempt,max_retries:e.maxRetries,retry_delay_ms:e.retryInMs,error_status:e.error.status??null,error:Se(e.error),session_id:m(),uuid:t.uuid}}break}case`tool_use_summary`:{let t=e;yield{type:`tool_use_summary`,summary:t.summary,preceding_tool_use_ids:t.precedingToolUseIds,session_id:m(),uuid:t.uuid};break}}if(p!==void 0&&g()>=p){j&&(t(process.env.WORKMATE_EAGER_FLUSH)||t(process.env.WORKMATE_IS_COWORK))&&await P(),yield{type:`result`,subtype:`error_max_budget_usd`,duration_ms:Date.now()-M,duration_api_ms:h(),is_error:!0,num_turns:J,stop_reason:Z,session_id:m(),total_cost_usd:g(),usage:this.totalUsage,modelUsage:f(),permission_denials:this.permissionDenials,fast_mode_state:S(K,F.fastMode),uuid:Y(),errors:[`Reached maximum budget ($${p}). Increase the limit with --max-budget-usd or start a new session.`]};return}if(e.type===`user`&&E){let e=ge(this.mutableMessages,Ve)-$e,n=parseInt(process.env.MAX_STRUCTURED_OUTPUT_RETRIES||`5`,10);if(e>=n){j&&(t(process.env.WORKMATE_EAGER_FLUSH)||t(process.env.WORKMATE_IS_COWORK))&&await P(),yield{type:`result`,subtype:`error_max_structured_output_retries`,duration_ms:Date.now()-M,duration_api_ms:h(),is_error:!0,num_turns:J,stop_reason:Z,session_id:m(),total_cost_usd:g(),usage:this.totalUsage,modelUsage:f(),permission_denials:this.permissionDenials,fast_mode_state:S(K,F.fastMode),uuid:Y(),errors:[`Failed to provide valid structured output after ${n} attempts`]};return}}}let $=W.findLast(e=>e.type===`assistant`||e.type===`user`),et=$?.type??`undefined`,tt=$?.type===`assistant`?De($.message.content)?.type??`none`:`n/a`;if(j&&(t(process.env.WORKMATE_EAGER_FLUSH)||t(process.env.WORKMATE_IS_COWORK))&&await P(),!Oe($,Z)){yield{type:`result`,subtype:`error_during_execution`,duration_ms:Date.now()-M,duration_api_ms:h(),is_error:!0,num_turns:J,stop_reason:Z,session_id:m(),total_cost_usd:g(),usage:this.totalUsage,modelUsage:f(),permission_denials:this.permissionDenials,fast_mode_state:S(K,F.fastMode),uuid:Y(),errors:(()=>{let e=Fe(),t=Q?e.lastIndexOf(Q)+1:0;return[`[ede_diagnostic] result_type=${et} last_content_type=${tt} stop_reason=${Z}`,...e.slice(t).map(e=>e.error)]})()};return}let nt=``,rt=!1;if($.type===`assistant`){let e=De($.message.content);e?.type===`text`&&!Te.has(e.text)&&(nt=e.text),rt=!!$.isApiErrorMessage}yield{type:`result`,subtype:`success`,is_error:rt,duration_ms:Date.now()-M,duration_api_ms:h(),num_turns:J,result:nt,stop_reason:Z,session_id:m(),total_cost_usd:g(),usage:this.totalUsage,modelUsage:f(),permission_denials:this.permissionDenials,structured_output:X,fast_mode_state:S(K,F.fastMode),uuid:Y()}}interrupt(){this.abortController.abort()}resetAbortController(){this.abortController=U()}getAbortSignal(){return this.abortController.signal}getMessages(){return this.mutableMessages}getReadFileState(){return this.readFileState}getSessionId(){return m()}setModel(e){this.config.userSpecifiedModel=e}};async function*$e({commands:e,prompt:t,promptUuid:n,isMeta:r,cwd:i,tools:a,mcpClients:o,verbose:s=!1,thinkingConfig:c,maxTurns:l,maxBudgetUsd:u,taskBudget:d,canUseTool:ee,mutableMessages:f=[],getReadFileCache:p,setReadFileCache:m,customSystemPrompt:h,appendSystemPrompt:g,userSpecifiedModel:_,fallbackModel:v,jsonSchema:te,getAppState:y,setAppState:ne,abortController:b,replayUserMessages:x=!1,includePartialMessages:S=!1,handleElicitation:C,agents:w=[],setSDKStatus:T,orphanedPermission:E}){let D=new Q({cwd:i,tools:a,commands:e,mcpClients:o,agents:w??[],canUseTool:ee,getAppState:y,setAppState:ne,initialMessages:f,readFileCache:j(p()),customSystemPrompt:h,appendSystemPrompt:g,userSpecifiedModel:_,fallbackModel:v,thinkingConfig:c,maxTurns:l,maxBudgetUsd:u,taskBudget:d,jsonSchema:te,verbose:s,handleElicitation:C,replayUserMessages:x,includePartialMessages:S,setSDKStatus:T,abortController:b,orphanedPermission:E});try{yield*D.submitMessage(t,{uuid:n,isMeta:r})}finally{m(D.getReadFileState())}}export{qe as a,Z as i,$e as n,X as r,Q as t};
@@ -1 +0,0 @@
1
- import{t as e}from"./REPL-BDnZnm__.js";export{e as REPL};
@@ -1 +0,0 @@
1
- import{o as e}from"./rolldown-runtime-DaDcL9Zw.js";import{I as t,P as n,Wt as r,ai as i,dr as a,ot as o,t as s}from"./src-BX54x08P.js";import{t as c}from"./jsx-runtime-Bb4Xn-E0.js";import{Hn as l,Pt as u}from"./state-CXY-q5gr.js";import{Bh as ee,Cg as te,Er as ne,Hh as re,In as ie,Kn as ae,Rr as oe,Xr as se,Xs as d,Yr as f,dy as p,ec as m,fy as h,gr as g,jr as _,sb as v,tb as y,vr as b,wg as x,zh as S}from"./loadAgentsDir-uuZYOgKn.js";import{o as C,s as w}from"./log-L1kqxa_P.js";import{n as T}from"./analytics-COpjZpvd.js";import{n as E}from"./conversationRecovery-NL05oJb1.js";import{r as D,t as O}from"./Spinner-DOI8qqZi.js";import{a as ce,n as le,s as ue}from"./skillChangeDetector-CVFCJcG7.js";import{t as k}from"./REPL-BDnZnm__.js";import{a as A,i as j,n as M,o as N,r as P,t as F}from"./crossProjectResume-BzltC4NJ.js";import{dirname as I}from"path";var L=e(i(),1);v(),u(),N(),D(),p(),s(),y(),T(),S(),x(),j(),d(),M(),C(),g();var R=c();function z(e){let t=parseInt(e,10);if(!isNaN(t)&&t>0)return t;let n=e.match(/github\.com\/[^/]+\/[^/]+\/pull\/(\d+)/);return n?.[1]?parseInt(n[1],10):null}function B({commands:e,worktreePaths:r,initialTools:i,mcpClients:s,dynamicMcpConfig:c,debug:u,mainThreadAgentDefinition:d,strictMcpConfig:p=!1,systemPrompt:g,appendSystemPrompt:v,initialSearchQuery:y,disableSlashCommands:x=!1,forkSession:S,taskListId:C,filterByPr:T,thinkingConfig:D,onTurnComplete:j}){let{rows:M}=o(),N=ee(e=>e.agentDefinitions),B=re(),[U,W]=L.useState([]),[de,G]=L.useState(!0),[fe,pe]=L.useState(!1),[K,me]=L.useState(!1),[q,he]=L.useState(null),[J,ge]=L.useState(null),Y=L.useRef(null),X=L.useRef(0),Z=L.useMemo(()=>{let e=U.filter(e=>!e.isSidechain);if(T!==void 0){if(T===!0)e=e.filter(e=>e.prNumber!==void 0);else if(typeof T==`number`)e=e.filter(e=>e.prNumber===T);else if(typeof T==`string`){let t=z(T);t!==null&&(e=e.filter(e=>e.prNumber===t))}}return e},[U,T]),_e=b();L.useEffect(()=>{_(r).then(e=>{Y.current=e,X.current=e.logs.length,W(e.logs),G(!1)}).catch(e=>{w(e),G(!1)})},[r]);let Q=L.useCallback(e=>{let t=Y.current;!t||t.nextIndex>=t.allStatLogs.length||ae(t.allStatLogs,t.nextIndex,e).then(n=>{if(t.nextIndex=n.nextIndex,n.logs.length>0){let e=X.current;n.logs.forEach((t,n)=>{t.value=e+n}),W(e=>e.concat(n.logs)),X.current+=n.logs.length}else t.nextIndex<t.allStatLogs.length&&Q(e)})},[]),$=L.useCallback(e=>{G(!0),(e?ne():_(r)).then(e=>{Y.current=e,X.current=e.logs.length,W(e.logs)}).catch(e=>{w(e)}).finally(()=>{G(!1)})},[r]),ve=L.useCallback(()=>{let e=!K;me(e),$(e)},[K,$]);function ye(){process.exit(1)}async function be(e){pe(!0);let t=performance.now(),n=F(e,K);if(n.isCrossProject&&!n.isSameRepoWorktree){let e=n.command,t=await a(e);t&&process.stdout.write(t),ge(e);return}try{let n=await E(e,void 0);if(!n)throw Error(`Failed to load conversation`);n.sessionId&&!S?(l(te(n.sessionId),e.fullPath?I(e.fullPath):null),await f(),h(n.sessionId)):S&&n.contentReplacements?.length&&await oe(n.contentReplacements);let{agentDefinition:r}=ce(n.agentSetting,d,N);B(e=>({...e,agent:r?.agentType}));let i=le(n.agentName,n.agentColor);i&&B(e=>({...e,standaloneAgentContext:i})),m(n.agentName),se(S?{...n,worktreeSession:void 0}:n),S||(ue(n.worktreeSession),n.sessionId&&ie()),Math.round(performance.now()-t),W([]),he({messages:n.messages,fileHistorySnapshots:n.fileHistorySnapshots,contentReplacements:n.contentReplacements,agentName:n.agentName,agentColor:n.agentColor==="default"?void 0:n.agentColor,mainThreadAgentDefinition:r})}catch(e){throw w(e),e}}return J?(0,R.jsx)(H,{command:J}):q?(0,R.jsx)(k,{debug:u,commands:e,initialTools:i,initialMessages:q.messages,initialFileHistorySnapshots:q.fileHistorySnapshots,initialContentReplacements:q.contentReplacements,initialAgentName:q.agentName,initialAgentColor:q.agentColor,mcpClients:s,dynamicMcpConfig:c,strictMcpConfig:p,systemPrompt:g,appendSystemPrompt:v,mainThreadAgentDefinition:q.mainThreadAgentDefinition,disableSlashCommands:x,taskListId:C,thinkingConfig:D,onTurnComplete:j}):de?(0,R.jsxs)(t,{children:[(0,R.jsx)(O,{}),(0,R.jsx)(n,{children:` Loading conversations…`})]}):fe?(0,R.jsxs)(t,{children:[(0,R.jsx)(O,{}),(0,R.jsx)(n,{children:` Resuming conversation…`})]}):Z.length===0?(0,R.jsx)(V,{}):(0,R.jsx)(A,{logs:Z,maxHeight:M,onCancel:ye,onSelect:be,onLogsChanged:_e?()=>$(K):void 0,onLoadMore:Q,initialSearchQuery:y,showAllProjects:K,onToggleAllProjects:ve,onAgenticSearch:P})}function V(){return r(`app:interrupt`,()=>{process.exit(1)},{context:`Global`}),(0,R.jsxs)(t,{flexDirection:`column`,children:[(0,R.jsx)(n,{children:`No conversations found to resume.`}),(0,R.jsx)(n,{dimColor:!0,children:`Press Ctrl+C to exit and start a new conversation.`})]})}function H({command:e}){return L.useEffect(()=>{let e=setTimeout(()=>{process.exit(0)},100);return()=>clearTimeout(e)},[]),(0,R.jsxs)(t,{flexDirection:`column`,gap:1,children:[(0,R.jsx)(n,{children:`This conversation is from a different directory.`}),(0,R.jsxs)(t,{flexDirection:`column`,children:[(0,R.jsx)(n,{children:`To resume, run:`}),(0,R.jsxs)(n,{children:[` `,e]})]}),(0,R.jsx)(n,{dimColor:!0,children:`(Command copied to clipboard)`})]})}export{B as ResumeConversation};
@@ -1 +0,0 @@
1
- import{f_ as e,p_ as t}from"./loadAgentsDir-uuZYOgKn.js";t();export{e as clearSearchExtraToolsDescriptionCache};
@@ -1,2 +0,0 @@
1
- import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{l as n,n as r,o as i,t as a}from"./envUtils-QyzA_cFM.js";import{n as o,t as s}from"./figures-5ThXQEtq.js";import{D as c,Gt as ee,H as te,I as l,P as u,T as d,U as ne,Wt as re,Xn as ie,a as ae,ai as f,di as p,fi as oe,j as m,k as se,n as h,ot as ce,r as g,t as _,x as v,y as le}from"./src-BX54x08P.js";import{t as y}from"./jsx-runtime-Bb4Xn-E0.js";import{Ht as ue,In as b,It as de,Lt as fe,Nn as pe,Pt as x,Rt as me,Vt as he,i as ge,ln as _e,m as S,mn as ve,n as ye,s as be,t as xe,un as C,y as w}from"./settings-D4M13toi.js";import{Pt as Se,at as T}from"./state-CXY-q5gr.js";import{AC as E,Bh as D,CC as Ce,Cy as O,Da as k,Dy as we,Ea as Te,Ey as Ee,Hh as De,Mh as Oe,NC as ke,Oa as Ae,Oy as je,PC as Me,TC as Ne,Ty as Pe,Vh as Fe,b as A,er as j,gr as Ie,hd as Le,j as Re,jC as ze,jh as Be,ky as Ve,md as M,sb as N,tb as He,wC as Ue,zh as P}from"./loadAgentsDir-uuZYOgKn.js";import{n as We,t as Ge}from"./cwd-DrEEb4f5.js";import{a as Ke,d as qe,h as F,i as Je,o as I,r as Ye}from"./config-BDn2YIjC.js";import{o as Xe,s as Ze}from"./log-L1kqxa_P.js";import{n as Qe}from"./analytics-COpjZpvd.js";import{_ as $e,f as L}from"./startupProfiler-B9Qv2QGH.js";import{Mt as et,Pt as tt,f as R,g as nt,h as rt}from"./model-CcHyMyBv.js";import{a as z,c as B,f as it,m as at}from"./proxy--_NfbJhm.js";import{n as ot,t as st}from"./useExitOnCtrlCDWithKeybindings-ClN4NJnB.js";import{n as ct,t as lt}from"./TextInput-ZKU-x_FD.js";import{n as V,t as ut}from"./select-BuTJbu_Q.js";import{i as dt,n as ft,r as pt}from"./modalContext-sU2lfR08.js";import{g as mt,h as H}from"./pidLock-CFUBtZck.js";import{n as ht,t as gt}from"./nativeInstaller-CIUYh1aD.js";import{n as _t,t as U}from"./allErrors-DvcU0w0F.js";import{t as W}from"./CustomSelect-CYmc4vRh.js";import{n as vt,t as yt}from"./ThemePicker-B69oDgXN.js";import{i as bt,n as xt,r as St,t as Ct}from"./extraUsage-Dr0YXm1w.js";import{n as wt,t as Tt}from"./AgentsMdExternalIncludesDialog-rJS5l6yk.js";import{t as Et}from"./SearchBox-zA5QwIpO.js";import{n as Dt,t as Ot}from"./useSearchInput-BIQN_-Hm.js";function kt(){return[]}function At(e=[],t){let n=e.filter(e=>e.name!==`ide`);if(!n.length)return[];let r={connected:0,pending:0,needsAuth:0,failed:0};for(let e of n)e.type===`connected`?r.connected++:e.type===`pending`?r.pending++:e.type===`needs-auth`?r.needsAuth++:r.failed++;let i=[];return r.connected&&i.push(m(`success`,t)(`${r.connected} connected`)),r.needsAuth&&i.push(m(`warning`,t)(`${r.needsAuth} need auth`)),r.pending&&i.push(m(`inactive`,t)(`${r.pending} pending`)),r.failed&&i.push(m(`error`,t)(`${r.failed} failed`)),[{label:`MCP servers`,value:`${i.join(`, `)} ${m(`inactive`,t)(`· /mcp`)}`}]}async function jt(){let e=Ee(await we()),t=[];return e.forEach(e=>{let n=pe(e.path);t.push(`Large ${n} will impact performance (${L(e.content.length)} chars > ${L(O)})`)}),t}function Mt(){return[{label:`Setting sources`,value:_e().filter(e=>{let t=be(e);return t!==null&&Object.keys(t).length>0}).map(e=>{if(e===`policySettings`){let e=ge();if(e===null)return null;switch(e){case`plist`:return`Enterprise managed settings (plist)`;case`hklm`:return`Enterprise managed settings (HKLM)`;case`file`:{let{hasBase:e,hasDropIns:t}=ye();return e&&t?`Enterprise managed settings (file + drop-ins)`:t?`Enterprise managed settings (drop-ins)`:`Enterprise managed settings (file)`}case`hkcu`:return`Enterprise managed settings (HKCU)`}}return C(e)}).filter(e=>e!==null)}]}async function Nt(){return(await ht()).map(e=>e.message)}async function Pt(){let e=await H(),t=[],{errors:n}=U();if(n.length>0){let e=Array.from(new Set(n.map(e=>e.file))).join(`, `);t.push(`Found invalid settings files: ${e}. They will be ignored.`)}return e.warnings.forEach(e=>{t.push(e.issue)}),e.hasUpdatePermissions===!1&&t.push(`No write permissions for auto-updates (requires sudo)`),t}function Ft(){return[]}function It(){let e=et(),t=[];if(e!==`firstParty`){let n={bedrock:`AWS Bedrock`,vertex:`Google Vertex AI`,foundry:`Microsoft Foundry`,gemini:`Gemini API`,grok:`Grok API`,openai:`OpenAI API`}[e];t.push({label:`API provider`,value:n})}if(e===`firstParty`){let e=process.env.ANTHROPIC_BASE_URL;e&&t.push({label:`API base URL`,value:e})}else if(e===`bedrock`){let e=process.env.BEDROCK_BASE_URL;e&&t.push({label:`Bedrock base URL`,value:e}),t.push({label:`AWS region`,value:a()}),n(process.env.WORKMATE_SKIP_BEDROCK_AUTH)&&t.push({value:`AWS auth skipped`})}else if(e===`vertex`){let e=process.env.VERTEX_BASE_URL;e&&t.push({label:`Vertex base URL`,value:e});let i=process.env.ANTHROPIC_VERTEX_PROJECT_ID;i&&t.push({label:`GCP project`,value:i}),t.push({label:`Default region`,value:r()}),n(process.env.WORKMATE_SKIP_VERTEX_AUTH)&&t.push({value:`GCP auth skipped`})}else if(e===`foundry`){let e=process.env.ANTHROPIC_FOUNDRY_BASE_URL;e&&t.push({label:`Microsoft Foundry base URL`,value:e});let r=process.env.ANTHROPIC_FOUNDRY_RESOURCE;r&&t.push({label:`Microsoft Foundry resource`,value:r}),n(process.env.WORKMATE_SKIP_FOUNDRY_AUTH)&&t.push({value:`Microsoft Foundry auth skipped`})}else if(e===`gemini`){let e=process.env.GEMINI_BASE_URL||`https://generativelanguage.googleapis.com/v1beta`;t.push({label:`Gemini base URL`,value:e})}else if(e===`grok`){let e=process.env.GROK_BASE_URL;t.push({label:`Grok base URL`,value:e})}else if(e===`openai`){let e=process.env.OPENAI_BASE_URL;t.push({label:`OpenAI base URL`,value:e})}let i=z();i&&t.push({label:`Proxy`,value:i});let o=it();return process.env.NODE_EXTRA_CA_CERTS&&t.push({label:`Additional CA cert(s)`,value:process.env.NODE_EXTRA_CA_CERTS}),o&&(o.cert&&process.env.WORKMATE_CLIENT_CERT&&t.push({label:`mTLS client cert`,value:process.env.WORKMATE_CLIENT_CERT}),o.key&&process.env.WORKMATE_CLIENT_KEY&&t.push({label:`mTLS client key`,value:process.env.WORKMATE_CLIENT_KEY})),t}function Lt(e){return nt(e)}var Rt=e((()=>{_(),Ve(),mt(),i(),b(),$e(),R(),tt(),at(),gt(),B(),_t(),ve(),S()}));function zt(){let e=T();return[{label:`Version`,value:`0.0.27`},{label:`Session name`,value:j(e)??(0,G.jsx)(u,{dimColor:!0,children:`/rename to add a name`})},{label:`Session ID`,value:e},{label:`cwd`,value:Ge()},...Ft(),...It()]}function Bt({mainLoopModel:e,mcp:t,theme:n,context:r}){return[{label:`Model`,value:Lt(e)},...At(t.clients,n),...kt(),...Mt()]}async function Vt(){return[...await Nt(),...await Pt(),...await jt()]}function Ht({value:e}){return Array.isArray(e)?(0,G.jsx)(l,{flexWrap:`wrap`,columnGap:1,flexShrink:99,children:e.map((t,n)=>(0,G.jsxs)(u,{children:[t,n<e.length-1?`,`:``]},n))}):typeof e==`string`?(0,G.jsx)(u,{children:e}):e}function Ut({context:e,diagnosticsPromise:t}){let n=D(e=>e.mainLoopModel),r=D(e=>e.mcp),[i]=te(),a=Gt.useMemo(()=>[zt(),Bt({mainLoopModel:n,mcp:r,theme:i,context:e})],[n,r,i,e]),o=pt()?1:void 0;return(0,G.jsxs)(l,{flexDirection:`column`,flexGrow:o,children:[(0,G.jsxs)(l,{flexDirection:`column`,gap:1,flexGrow:o,children:[a.map((e,t)=>e.length>0&&(0,G.jsx)(l,{flexDirection:`column`,children:e.map(({label:e,value:t},n)=>(0,G.jsxs)(l,{flexDirection:`row`,gap:1,flexShrink:0,children:[e!==void 0&&(0,G.jsxs)(u,{bold:!0,children:[e,`:`]}),(0,G.jsx)(Ht,{value:t})]},n))},t)),(0,G.jsx)(Kt.Suspense,{fallback:null,children:(0,G.jsx)(Wt,{promise:t})})]}),(0,G.jsx)(u,{dimColor:!0,children:(0,G.jsx)(M,{action:`confirm:no`,context:`Settings`,fallback:`Esc`,description:`cancel`})})]})}function Wt({promise:e}){let t=(0,Kt.use)(e);return t.length===0?null:(0,G.jsxs)(l,{flexDirection:`column`,paddingBottom:1,children:[(0,G.jsx)(u,{bold:!0,children:`System Diagnostics`}),t.map((e,t)=>(0,G.jsxs)(l,{flexDirection:`row`,gap:1,paddingX:1,children:[(0,G.jsx)(u,{color:`error`,children:s.warning}),typeof e==`string`?(0,G.jsx)(u,{wrap:`wrap`,children:e}):e]},t))]})}var Gt,Kt,G,qt=e((()=>{o(),Gt=t(f(),1),Kt=t(f(),1),Se(),ft(),_(),P(),We(),Ie(),Rt(),Le(),G=y()}));function Jt({currentVersion:e,onChoice:t}){function n(e){t(e)}function r(){t(`cancel`)}return(0,K.jsxs)(le,{title:`Switch to Stable Channel`,onCancel:r,color:`permission`,hideBorder:!0,hideInputGuide:!0,children:[(0,K.jsxs)(u,{children:[`The stable channel may have an older version than what you're currently running (`,e,`).`]}),(0,K.jsx)(u,{dimColor:!0,children:`How would you like to handle this?`}),(0,K.jsx)(ut,{options:[{label:`Allow possible downgrade to stable version`,value:`downgrade`},{label:`Stay on current version (${e}) until stable catches up`,value:`stay`}],onChange:n})]})}var K,Yt=e((()=>{_(),W(),K=y()}));function Xt(e){return Object.entries(e).map(([e,t])=>({label:t?.name??$t,value:e,description:t?.description??en}))}function Zt({initialStyle:e,onComplete:t,onCancel:n,isStandaloneCommand:r}){let[i,a]=(0,Qt.useState)([]),[o,s]=(0,Qt.useState)(!0);(0,Qt.useEffect)(()=>{k(Ge()).then(e=>{let t=Xt(e);a(t),s(!1)}).catch(()=>{let e=Xt(Te);a(e),s(!1)})},[]);let c=(0,Qt.useCallback)(e=>{t(e)},[t]);return(0,q.jsx)(le,{title:`Preferred output style`,onCancel:n,hideInputGuide:!r,hideBorder:!r,children:(0,q.jsxs)(l,{flexDirection:`column`,gap:1,children:[(0,q.jsx)(l,{marginTop:1,children:(0,q.jsx)(u,{dimColor:!0,children:`This changes how Work Mate communicates with you`})}),o?(0,q.jsx)(u,{dimColor:!0,children:`Loading output styles…`}):(0,q.jsx)(ut,{options:i,onChange:c,visibleOptionCount:10,defaultValue:e})]})})}var Qt,q,$t,en,tn=e((()=>{Qt=t(f(),1),Ae(),_(),We(),V(),q=y(),$t=`Default`,en=`Work Mate completes coding tasks efficiently and provides concise responses`}));function nn({initialLanguage:e,onComplete:t,onCancel:n}){let[r,i]=(0,rn.useState)(e),[a,o]=(0,rn.useState)((e??``).length);re(`confirm:no`,n,{context:`Settings`});function c(){let e=r?.trim();t(e||void 0)}return(0,J.jsxs)(l,{flexDirection:`column`,gap:1,children:[(0,J.jsx)(u,{children:`Enter your preferred response and voice language:`}),(0,J.jsxs)(l,{flexDirection:`row`,gap:1,children:[(0,J.jsx)(u,{children:s.pointer}),(0,J.jsx)(lt,{value:r??``,onChange:i,onSubmit:c,focus:!0,showCursor:!0,placeholder:`e.g., Japanese, 日本語, Español${s.ellipsis}`,columns:60,cursorOffset:a,onChangeCursorOffset:o})]}),(0,J.jsx)(u,{dimColor:!0,children:`Leave empty for default (English)`})]})}var rn,J,an=e((()=>{o(),rn=t(f(),1),_(),He(),ct(),J=y()}));function on({onClose:e,context:t,setTabsHidden:r,onIsSearchModeChange:i,contentHeight:a}){let{headerFocused:o,focusHeader:f}=ae(),oe=pt(),[,m]=te(),h=ne(),[g,_]=(0,X.useState)(I()),v=Y.useRef(I()),[y,b]=(0,X.useState)(xe()),pe=Y.useRef(xe()),[x,ge]=(0,X.useState)(y?.outputStyle||`default`),_e=Y.useRef(x),[S,ve]=(0,X.useState)(y?.language),ye=Y.useRef(S),[C,Se]=(0,X.useState)(0),[T,E]=(0,X.useState)(0),[O,k]=(0,X.useState)(!1),Te=ie(),{rows:Ee}=ce(),Ae=a??Math.min(Math.floor(Ee*.8),30),A=Math.max(5,Ae-10),j=D(e=>e.mainLoopModel),Ie=D(e=>e.verbose),Le=D(e=>e.thinkingEnabled),Be=D(e=>ke()?e.fastMode:!1);D(e=>e.promptSuggestionEnabled);let Ve=fe(y?.permissions?.defaultMode??`default`),N=De(),[He,P]=(0,X.useState)({}),We=Y.useRef(Le),[Ge]=(0,X.useState)(()=>be(`localSettings`)),[qe]=(0,X.useState)(()=>be(`userSettings`)),Xe=Y.useRef(h),Qe=Fe(),[$e]=(0,X.useState)(()=>{let e=Qe.getState();return{mainLoopModel:e.mainLoopModel,mainLoopModelForSession:e.mainLoopModelForSession,verbose:e.verbose,thinkingEnabled:e.thinkingEnabled,fastMode:e.fastMode,promptSuggestionEnabled:e.promptSuggestionEnabled,settings:e.settings}}),L=Y.useRef(!1),[et,tt]=(0,X.useState)(!1),[R,z]=(0,X.useState)(null),{query:B,setQuery:it,cursorOffset:at}=Dt({isActive:O&&R===null&&!o,onExit:()=>k(!1),onExitUp:f,passthroughCtrlKeys:[`c`,`d`]}),ot=O&&!o;Y.useEffect(()=>{i?.(ot)},[ot,i]);let st=!n(process.env.WORKMATE_DISABLE_FILE_CHECKPOINTING),ct=Y.use(we(!0)),lt=je(ct),V=Je();function dt(e){N(t=>({...t,mainLoopModel:e,mainLoopModelForSession:null})),P(t=>{let n=nt(e)+(xt(e,!1,rt())?` · Billed as extra usage`:``);if(`model`in t){let{model:e,...r}=t;return{...r,model:n}}return{...t,model:n}})}function ft(e){F(t=>({...t,verbose:e})),_({...I(),verbose:e}),N(t=>({...t,verbose:e})),P(t=>{if(`verbose`in t){let{verbose:e,...n}=t;return n}return{...t,verbose:e}})}let mt=[{id:`autoCompactEnabled`,label:`Auto-compact`,value:g.autoCompactEnabled,type:`boolean`,onChange(e){F(t=>({...t,autoCompactEnabled:e})),_({...I(),autoCompactEnabled:e})}},{id:`spinnerTipsEnabled`,label:`Show tips`,value:y?.spinnerTipsEnabled??!0,type:`boolean`,onChange(e){w(`localSettings`,{spinnerTipsEnabled:e}),b(t=>({...t,spinnerTipsEnabled:e}))}},{id:`cacheWarningEnabled`,label:`Cache warnings`,value:y?.cacheWarningEnabled??!0,type:`boolean`,onChange(e){w(`localSettings`,{cacheWarningEnabled:e}),b(t=>({...t,cacheWarningEnabled:e}))}},{id:`prefersReducedMotion`,label:`Reduce motion`,value:y?.prefersReducedMotion??!1,type:`boolean`,onChange(e){w(`localSettings`,{prefersReducedMotion:e}),b(t=>({...t,prefersReducedMotion:e})),N(t=>({...t,settings:{...t.settings,prefersReducedMotion:e}}))}},{id:`thinkingEnabled`,label:`Thinking mode`,value:Le??!0,type:`boolean`,onChange(e){N(t=>({...t,thinkingEnabled:e})),w(`userSettings`,{alwaysThinkingEnabled:e?void 0:!1})}},...ke()&&ze()?[{id:`fastMode`,label:`Fast mode (${Ce} only)`,value:!!Be,type:`boolean`,onChange(e){Ue(),w(`userSettings`,{fastMode:e?!0:void 0}),e?(N(e=>({...e,mainLoopModel:Ne(),mainLoopModelForSession:null,fastMode:!0})),P(e=>({...e,model:Ne(),"Fast mode":`ON`}))):(N(e=>({...e,fastMode:!1})),P(e=>({...e,"Fast mode":`OFF`})))}}]:[],...st?[{id:`fileCheckpointingEnabled`,label:`Rewind code (checkpoints)`,value:g.fileCheckpointingEnabled,type:`boolean`,onChange(e){F(t=>({...t,fileCheckpointingEnabled:e})),_({...I(),fileCheckpointingEnabled:e})}}]:[],{id:`verbose`,label:`Verbose output`,value:Ie,type:`boolean`,onChange:ft},{id:`terminalProgressBarEnabled`,label:`Terminal progress bar`,value:g.terminalProgressBarEnabled,type:`boolean`,onChange(e){F(t=>({...t,terminalProgressBarEnabled:e})),_({...I(),terminalProgressBarEnabled:e})}},{id:`showTurnDuration`,label:`Show turn duration`,value:g.showTurnDuration,type:`boolean`,onChange(e){F(t=>({...t,showTurnDuration:e})),_({...I(),showTurnDuration:e})}},{id:`defaultPermissionMode`,label:`Default permission mode`,value:Ve,options:(()=>{let e=[`default`,`plan`];return[...e,...ue.filter(t=>!e.includes(t))]})(),type:`enum`,onChange(e){let t=fe(e),n=t===`auto`?t:de(t)?he(t):t,r=w(`userSettings`,{permissions:{...y?.permissions,defaultMode:n}});if(r.error){Ze(r.error);return}b(e=>({...e,permissions:{...e?.permissions,defaultMode:n}})),P(t=>({...t,defaultPermissionMode:e}))}},{id:`respectGitignore`,label:`Respect .gitignore in file picker`,value:g.respectGitignore,type:`boolean`,onChange(e){F(t=>({...t,respectGitignore:e})),_({...I(),respectGitignore:e})}},...Oe()?[{id:`copyOnSelect`,label:`Copy on select`,value:g.copyOnSelect??!0,type:`boolean`,onChange(e){F(t=>({...t,copyOnSelect:e})),_({...I(),copyOnSelect:e})}}]:[],V?{id:`autoUpdatesChannel`,label:`Auto-update channel`,value:`disabled`,type:`managedEnum`,onChange(){}}:{id:`autoUpdatesChannel`,label:`Auto-update channel`,value:y?.autoUpdatesChannel??`latest`,type:`managedEnum`,onChange(){}},{id:`theme`,label:`Theme`,value:h,type:`managedEnum`,onChange:m},{id:`notifChannel`,label:`Notifications`,value:g.preferredNotifChannel,options:[`auto`,`iterm2`,`terminal_bell`,`iterm2_with_bell`,`kitty`,`ghostty`,`notifications_disabled`],type:`enum`,onChange(e){F(t=>({...t,preferredNotifChannel:e})),_({...I(),preferredNotifChannel:e})}},{id:`outputStyle`,label:`Output style`,value:x,type:`managedEnum`,onChange:()=>{}},{id:`language`,label:`Language`,value:S??`Default (English)`,type:`managedEnum`,onChange:()=>{}},{id:`editorMode`,label:`Editor mode`,value:g.editorMode===`emacs`?`normal`:g.editorMode||`normal`,options:[`normal`,`vim`],type:`enum`,onChange(e){F(t=>({...t,editorMode:e})),_({...I(),editorMode:e})}},{id:`prStatusFooterEnabled`,label:`Show PR status footer`,value:g.prStatusFooterEnabled??!0,type:`boolean`,onChange(e){F(t=>t.prStatusFooterEnabled===e?t:{...t,prStatusFooterEnabled:e}),_({...I(),prStatusFooterEnabled:e})}},{id:`model`,label:`Model`,value:j===null?`Default (recommended)`:j,type:`managedEnum`,onChange:dt},...lt?[{id:`showExternalIncludesDialog`,label:`External AGENTS.md includes`,value:Ke().hasAgentsMdExternalIncludesApproved?`true`:`false`,type:`managedEnum`,onChange(){}}]:[]],H=Y.useMemo(()=>{if(!B)return mt;let e=B.toLowerCase();return mt.filter(t=>t.id.toLowerCase().includes(e)?!0:(`searchText`in t?t.searchText:t.label).toLowerCase().includes(e))},[mt,B]);Y.useEffect(()=>{if(C>=H.length){let e=Math.max(0,H.length-1);Se(e),E(Math.max(0,e-A+1));return}E(e=>C<e?C:C>=e+A?C-A+1:e)},[H.length,C,A]);let ht=(0,X.useCallback)(e=>{E(t=>e<t?e:e>=t+A?e-A+1:t)},[A]),gt=(0,X.useCallback)(()=>{if(R!==null)return;let t=Object.entries(He).map(([e,t])=>`Set ${e} to ${p.bold(t)}`);g.theme!==v.current.theme&&t.push(`Set theme to ${p.bold(g.theme)}`),g.preferredNotifChannel!==v.current.preferredNotifChannel&&t.push(`Set notifications to ${p.bold(g.preferredNotifChannel)}`),x!==_e.current&&t.push(`Set output style to ${p.bold(x)}`),S!==ye.current&&t.push(`Set response language to ${p.bold(S??`Default (English)`)}`),g.editorMode!==v.current.editorMode&&t.push(`Set editor mode to ${p.bold(g.editorMode||`emacs`)}`),g.diffTool!==v.current.diffTool&&t.push(`Set diff tool to ${p.bold(g.diffTool)}`),g.autoCompactEnabled!==v.current.autoCompactEnabled&&t.push(`${g.autoCompactEnabled?`Enabled`:`Disabled`} auto-compact`),g.respectGitignore!==v.current.respectGitignore&&t.push(`${g.respectGitignore?`Enabled`:`Disabled`} respect .gitignore in file picker`),g.copyOnSelect!==v.current.copyOnSelect&&t.push(`${g.copyOnSelect?`Enabled`:`Disabled`} copy on select`),g.terminalProgressBarEnabled!==v.current.terminalProgressBarEnabled&&t.push(`${g.terminalProgressBarEnabled?`Enabled`:`Disabled`} terminal progress bar`),g.showStatusInTerminalTab!==v.current.showStatusInTerminalTab&&t.push(`${g.showStatusInTerminalTab?`Enabled`:`Disabled`} terminal tab status`),g.showTurnDuration!==v.current.showTurnDuration&&t.push(`${g.showTurnDuration?`Enabled`:`Disabled`} turn duration`),y?.autoUpdatesChannel!==pe.current?.autoUpdatesChannel&&t.push(`Set auto-update channel to ${p.bold(y?.autoUpdatesChannel??`latest`)}`),t.length>0?e(t.join(`
2
- `)):e(`Config dialog dismissed`,{display:`system`})},[R,He,g,j,x,S,y?.autoUpdatesChannel,ke()?y?.fastMode:void 0,e]),_t=(0,X.useCallback)(()=>{h!==Xe.current&&m(Xe.current),F(()=>v.current);let e=Ge;w(`localSettings`,{spinnerTipsEnabled:e?.spinnerTipsEnabled,prefersReducedMotion:e?.prefersReducedMotion,defaultView:e?.defaultView,outputStyle:e?.outputStyle});let t=qe;w(`userSettings`,{alwaysThinkingEnabled:t?.alwaysThinkingEnabled,fastMode:t?.fastMode,promptSuggestionEnabled:t?.promptSuggestionEnabled,autoUpdatesChannel:t?.autoUpdatesChannel,minimumVersion:t?.minimumVersion,language:t?.language,syntaxHighlightingDisabled:t?.syntaxHighlightingDisabled,permissions:t?.permissions===void 0?void 0:{...t.permissions,defaultMode:t.permissions.defaultMode}});let n=$e;N(e=>({...e,mainLoopModel:n.mainLoopModel,mainLoopModelForSession:n.mainLoopModelForSession,verbose:n.verbose,thinkingEnabled:n.thinkingEnabled,fastMode:n.fastMode,promptSuggestionEnabled:n.promptSuggestionEnabled,settings:n.settings,toolPermissionContext:Re(e.toolPermissionContext)}))},[h,m,Ge,qe,$e,N]);re(`confirm:no`,(0,X.useCallback)(()=>{R===null&&(L.current&&_t(),e(`Config dialog dismissed`,{display:`system`}))},[R,_t,e]),{context:`Settings`,isActive:R===null&&!O&&!o}),re(`settings:close`,gt,{context:`Settings`,isActive:R===null&&!O&&!o});let U=(0,X.useCallback)(()=>{let e=H[C];if(e?.onChange){if(e.type===`boolean`){L.current=!0,e.onChange(!e.value),e.id===`thinkingEnabled`&&(!e.value===We.current?tt(!1):t.messages.some(e=>e.type===`assistant`)&&tt(!0));return}if(e.id===`theme`||e.id===`model`||e.id===`showExternalIncludesDialog`||e.id===`outputStyle`||e.id===`language`)switch(e.id){case`theme`:z(`Theme`),r(!0);return;case`model`:z(`Model`),r(!0);return;case`showExternalIncludesDialog`:z(`ExternalIncludes`),r(!0);return;case`outputStyle`:z(`OutputStyle`),r(!0);return;case`language`:z(`Language`),r(!0);return}if(e.id===`autoUpdatesChannel`){if(V){z(`EnableAutoUpdates`),r(!0);return}(y?.autoUpdatesChannel??`latest`)===`latest`?(z(`ChannelDowngrade`),r(!0)):(L.current=!0,w(`userSettings`,{autoUpdatesChannel:`latest`,minimumVersion:void 0}),b(e=>({...e,autoUpdatesChannel:`latest`,minimumVersion:void 0})));return}if(e.type===`enum`){L.current=!0;let t=(e.options.indexOf(e.value)+1)%e.options.length;e.onChange(e.options[t]);return}}},[V,H,C,y?.autoUpdatesChannel,r]),W=e=>{tt(!1);let t=Math.max(0,Math.min(H.length-1,C+e));Se(t),ht(t)};return ee({"select:previous":()=>{C===0?(tt(!1),k(!0),E(0)):W(-1)},"select:next":()=>W(1),"scroll:lineUp":()=>W(-1),"scroll:lineDown":()=>W(1),"select:accept":U,"select:previousValue":()=>U(),"select:nextValue":()=>U(),"settings:search":()=>{k(!0),it(``)}},{context:`Settings`,isActive:R===null&&!O&&!o}),(0,Z.jsx)(l,{flexDirection:`column`,width:`100%`,tabIndex:0,autoFocus:!0,onKeyDown:(0,X.useCallback)(e=>{if(R===null&&!o){if(O){if(e.key===`escape`){e.preventDefault(),B.length>0?it(``):k(!1);return}(e.key===`return`||e.key===`down`||e.key===`wheeldown`)&&(e.preventDefault(),k(!1),Se(0),E(0));return}if(e.key===`left`||e.key===`right`||e.key===`tab`){e.preventDefault(),U();return}e.ctrl||e.meta||e.key===`j`||e.key===`k`||e.key===`/`||e.key.length===1&&e.key!==` `&&(e.preventDefault(),k(!0),it(e.key))}},[R,o,O,B,it,U]),children:R===`Theme`?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(yt,{onThemeSelect:e=>{L.current=!0,m(e),z(null),r(!1)},onCancel:()=>{z(null),r(!1)},hideEscToCancel:!0,skipExitHandling:!0}),(0,Z.jsx)(l,{children:(0,Z.jsx)(u,{dimColor:!0,italic:!0,children:(0,Z.jsxs)(d,{children:[(0,Z.jsx)(c,{shortcut:`Enter`,action:`select`}),(0,Z.jsx)(M,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})]})})})]}):R===`Model`?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(St,{initial:j,onSelect:e=>{L.current=!0,dt(e),z(null),r(!1)},onCancel:()=>{z(null),r(!1)},showFastModeNotice:ke()?Be&&Me(j)&&ze():!1}),(0,Z.jsx)(u,{dimColor:!0,children:(0,Z.jsxs)(d,{children:[(0,Z.jsx)(c,{shortcut:`Enter`,action:`confirm`}),(0,Z.jsx)(M,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})]})})]}):R===`ExternalIncludes`?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Tt,{onDone:()=>{z(null),r(!1)},externalIncludes:Pe(ct)}),(0,Z.jsx)(u,{dimColor:!0,children:(0,Z.jsxs)(d,{children:[(0,Z.jsx)(c,{shortcut:`Enter`,action:`confirm`}),(0,Z.jsx)(M,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`disable external includes`})]})})]}):R===`OutputStyle`?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Zt,{initialStyle:x,onComplete:e=>{L.current=!0,ge(e??`default`),z(null),r(!1),w(`localSettings`,{outputStyle:e})},onCancel:()=>{z(null),r(!1)}}),(0,Z.jsx)(u,{dimColor:!0,children:(0,Z.jsxs)(d,{children:[(0,Z.jsx)(c,{shortcut:`Enter`,action:`confirm`}),(0,Z.jsx)(M,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})]})})]}):R===`Language`?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(nn,{initialLanguage:S,onComplete:e=>{L.current=!0,ve(e),z(null),r(!1),w(`userSettings`,{language:e})},onCancel:()=>{z(null),r(!1)}}),(0,Z.jsx)(u,{dimColor:!0,children:(0,Z.jsxs)(d,{children:[(0,Z.jsx)(c,{shortcut:`Enter`,action:`confirm`}),(0,Z.jsx)(M,{action:`confirm:no`,context:`Settings`,fallback:`Esc`,description:`cancel`})]})})]}):R===`EnableAutoUpdates`?(0,Z.jsx)(le,{title:`Enable Auto-Updates`,onCancel:()=>{z(null),r(!1)},hideBorder:!0,hideInputGuide:!0,children:V?.type===`config`?(0,Z.jsx)(ut,{options:[{label:`Enable with latest channel`,value:`latest`},{label:`Enable with stable channel`,value:`stable`}],onChange:e=>{L.current=!0,z(null),r(!1),F(e=>({...e,autoUpdates:!0})),_({...I(),autoUpdates:!0}),w(`userSettings`,{autoUpdatesChannel:e,minimumVersion:void 0}),b(t=>({...t,autoUpdatesChannel:e,minimumVersion:void 0}))}}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(u,{children:V?.type===`env`?`Auto-updates are controlled by an environment variable and cannot be changed here.`:`Auto-updates are disabled in development builds.`}),V?.type===`env`&&(0,Z.jsxs)(u,{dimColor:!0,children:[`Unset `,V.envVar,` to re-enable auto-updates.`]})]})}):R===`ChannelDowngrade`?(0,Z.jsx)(Jt,{currentVersion:`0.0.27`,onChoice:e=>{if(z(null),r(!1),e===`cancel`)return;L.current=!0;let t={autoUpdatesChannel:`stable`};e===`stay`&&(t.minimumVersion=`0.0.27`),w(`userSettings`,t),b(e=>({...e,...t}))}}):(0,Z.jsxs)(l,{flexDirection:`column`,gap:1,marginY:oe?void 0:1,children:[(0,Z.jsx)(se,{query:B,isFocused:O&&!o,isTerminalFocused:Te,cursorOffset:at,placeholder:`Search settings…`}),(0,Z.jsx)(l,{flexDirection:`column`,children:H.length===0?(0,Z.jsxs)(u,{dimColor:!0,italic:!0,children:[`No settings match "`,B,`"`]}):(0,Z.jsxs)(Z.Fragment,{children:[T>0&&(0,Z.jsxs)(u,{dimColor:!0,children:[s.arrowUp,` `,T,` more above`]}),H.slice(T,T+A).map((e,t)=>{let n=T+t===C&&!o&&!O;return(0,Z.jsx)(Y.Fragment,{children:(0,Z.jsxs)(l,{width:`100%`,children:[(0,Z.jsx)(l,{width:44,children:(0,Z.jsxs)(u,{color:n?`suggestion`:void 0,children:[n?s.pointer:` `,` `,e.label]})}),(0,Z.jsx)(l,{flexGrow:1,children:e.type===`boolean`?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(u,{color:n?`suggestion`:void 0,children:e.value.toString()}),et&&e.id===`thinkingEnabled`&&(0,Z.jsxs)(u,{color:`warning`,children:[` `,`Changing thinking mode mid-conversation will increase latency and may reduce quality.`]})]}):e.id===`theme`?(0,Z.jsx)(u,{color:n?`suggestion`:void 0,children:cn[e.value.toString()]??e.value.toString()}):e.id===`notifChannel`?(0,Z.jsx)(u,{color:n?`suggestion`:void 0,children:(0,Z.jsx)(sn,{value:e.value.toString()})}):e.id===`defaultPermissionMode`?(0,Z.jsx)(u,{color:n?`suggestion`:void 0,children:me(e.value)}):e.id===`autoUpdatesChannel`&&V?(0,Z.jsxs)(l,{flexDirection:`column`,children:[(0,Z.jsx)(u,{color:n?`suggestion`:void 0,children:`disabled`}),(0,Z.jsxs)(u,{dimColor:!0,children:[`(`,Ye(V),`)`]})]}):(0,Z.jsx)(u,{color:n?`suggestion`:void 0,children:e.value.toString()})})]})},e.id)}),T+A<H.length&&(0,Z.jsxs)(u,{dimColor:!0,children:[s.arrowDown,` `,H.length-T-A,` more below`]})]})}),o?(0,Z.jsx)(u,{dimColor:!0,children:(0,Z.jsxs)(d,{children:[(0,Z.jsx)(c,{shortcut:`←/→ tab`,action:`switch`}),(0,Z.jsx)(c,{shortcut:`↓`,action:`return`}),(0,Z.jsx)(M,{action:`confirm:no`,context:`Settings`,fallback:`Esc`,description:`close`})]})}):O?(0,Z.jsx)(u,{dimColor:!0,children:(0,Z.jsxs)(d,{children:[(0,Z.jsx)(u,{children:`Type to filter`}),(0,Z.jsx)(c,{shortcut:`Enter/↓`,action:`select`}),(0,Z.jsx)(c,{shortcut:`↑`,action:`tabs`}),(0,Z.jsx)(M,{action:`confirm:no`,context:`Settings`,fallback:`Esc`,description:`clear`})]})}):(0,Z.jsx)(u,{dimColor:!0,children:(0,Z.jsxs)(d,{children:[(0,Z.jsx)(M,{action:`select:accept`,context:`Settings`,fallback:`Space`,description:`change`}),(0,Z.jsx)(M,{action:`settings:close`,context:`Settings`,fallback:`Enter`,description:`save`}),(0,Z.jsx)(M,{action:`settings:search`,context:`Settings`,fallback:`/`,description:`search`}),(0,Z.jsx)(M,{action:`confirm:no`,context:`Settings`,fallback:`Esc`,description:`cancel`})]})})]})})}function sn({value:e}){switch(e){case`auto`:return`Auto`;case`iterm2`:return(0,Z.jsxs)(u,{children:[`iTerm2 `,(0,Z.jsx)(u,{dimColor:!0,children:`(OSC 9)`})]});case`terminal_bell`:return(0,Z.jsxs)(u,{children:[`Terminal Bell `,(0,Z.jsx)(u,{dimColor:!0,children:`(\\a)`})]});case`kitty`:return(0,Z.jsxs)(u,{children:[`Kitty `,(0,Z.jsx)(u,{dimColor:!0,children:`(OSC 99)`})]});case`ghostty`:return(0,Z.jsxs)(u,{children:[`Ghostty `,(0,Z.jsx)(u,{dimColor:!0,children:`(OSC 777)`})]});case`iterm2_with_bell`:return`iTerm2 w/ Bell`;case`notifications_disabled`:return`Disabled`;default:return e}}var Y,X,Z,cn,ln=e((()=>{_(),Y=t(f(),1),X=t(f(),1),He(),o(),qe(),oe(),x(),A(),Xe(),Qe(),vt(),P(),bt(),R(),Ct(),wt(),Yt(),W(),tn(),an(),Ve(),Le(),ft(),Et(),S(),Ae(),i(),Ot(),N(),E(),Be(),Z=y(),cn={auto:`Auto (match terminal)`,dark:`Dark mode`,light:`Light mode`,"dark-daltonized":`Dark mode (colorblind-friendly)`,"light-daltonized":`Light mode (colorblind-friendly)`,"dark-ansi":`Dark mode (ANSI colors only)`,"light-ansi":`Light mode (ANSI colors only)`}}));function un({onClose:e,context:t,defaultTab:n}){let[r,i]=(0,Q.useState)(n),[a,o]=(0,Q.useState)(!1),[s,c]=(0,Q.useState)(!1),ee=pt(),{rows:te}=dt(ce()),l=ee?te+1:Math.max(15,Math.min(Math.floor(te*.8),30)),[u]=(0,Q.useState)(()=>Vt().catch(()=>[]));return ot(),re(`confirm:no`,()=>{a||e(`Status dialog dismissed`,{display:`system`})},{context:`Settings`,isActive:!a&&!(r===`Config`&&s)}),(0,$.jsx)(v,{color:`permission`,children:(0,$.jsx)(g,{color:`permission`,selectedTab:r,onTabChange:i,hidden:a,initialHeaderFocused:n!==`Config`,contentHeight:a||ee?void 0:l,children:[(0,$.jsx)(h,{title:`Status`,children:(0,$.jsx)(Ut,{context:t,diagnosticsPromise:u})},`status`),(0,$.jsx)(h,{title:`Config`,children:(0,$.jsx)(Q.Suspense,{fallback:null,children:(0,$.jsx)(on,{context:t,onClose:e,setTabsHidden:o,onIsSearchModeChange:c,contentHeight:l})})},`config`)]})})}var Q,$,dn=e((()=>{Q=t(f(),1),He(),st(),N(),ft(),_(),qt(),ln(),$=y()}));export{dn as n,un as t};
@@ -1 +0,0 @@
1
- import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{n,t as r}from"./defineProperty-C-QyHrDq.js";import{a as i,c as a,i as o,n as s,o as c,r as l,s as u,t as d}from"./classPrivateFieldSet2-D4U5K-I3.js";import{n as f,t as p}from"./classPrivateMethodInitSpec-BXQD0Vh4.js";import{n as m,t as h}from"./figures-5ThXQEtq.js";import{Gr as g,H as _,I as v,P as y,T as b,ai as x,mt as S,ot as ee,t as C}from"./src-BX54x08P.js";import{t as w}from"./jsx-runtime-Bb4Xn-E0.js";import{$n as T,Qn as E,m as te,t as D}from"./settings-D4M13toi.js";import{Gn as ne,Kn as re,Pt as O,m as k}from"./state-CXY-q5gr.js";import{Bh as ie,Fh as ae,Fy as oe,Hh as A,Ih as se,Iy as ce,Ly as le,My as ue,Ny as de,Py as fe,Ry as pe,Uy as j,Wy as me,mC as he,ms as ge,pC as _e,ps as ve,sb as M,zh as N}from"./loadAgentsDir-uuZYOgKn.js";import{d as ye,o as be}from"./config-BDn2YIjC.js";import{n as xe,o as Se}from"./intl-D2kgJmX7.js";import{S as Ce,_ as we,f as Te,l as Ee}from"./startupProfiler-B9Qv2QGH.js";import{o as De}from"./TextInput-ZKU-x_FD.js";import{a as Oe,c as ke,l as Ae,n as je,o as Me,r as Ne,s as Pe,t as Fe,u as Ie}from"./SpinnerGlyph-BR_SiV9L.js";import{watch as Le}from"fs";var Re,ze,Be=e((()=>{O(),n(),Re=class e{constructor(e){r(this,`activeOperations`,new Set),r(this,`lastUserActivityTime`,0),r(this,`lastCLIRecordedTime`,void 0),r(this,`isCLIActive`,!1),r(this,`USER_ACTIVITY_TIMEOUT_MS`,5e3),r(this,`getNow`,void 0),r(this,`getActiveTimeCounter`,void 0),this.getNow=e?.getNow??(()=>Date.now()),this.getActiveTimeCounter=e?.getActiveTimeCounter??k,this.lastCLIRecordedTime=this.getNow()}static getInstance(){return e.instance||(e.instance=new e),e.instance}static resetInstance(){e.instance=null}static createInstance(t){return e.instance=new e(t),e.instance}recordUserActivity(){if(!this.isCLIActive&&this.lastUserActivityTime!==0){let e=(this.getNow()-this.lastUserActivityTime)/1e3;if(e>0){let t=this.getActiveTimeCounter();t&&e<this.USER_ACTIVITY_TIMEOUT_MS/1e3&&t.add(e,{type:`user`})}}this.lastUserActivityTime=this.getNow()}startCLIActivity(e){this.activeOperations.has(e)&&this.endCLIActivity(e);let t=this.activeOperations.size===0;this.activeOperations.add(e),t&&(this.isCLIActive=!0,this.lastCLIRecordedTime=this.getNow())}endCLIActivity(e){if(this.activeOperations.delete(e),this.activeOperations.size===0){let e=this.getNow(),t=(e-this.lastCLIRecordedTime)/1e3;if(t>0){let e=this.getActiveTimeCounter();e&&e.add(t,{type:`cli`})}this.lastCLIRecordedTime=e,this.isCLIActive=!1}}async trackOperation(e,t){this.startCLIActivity(e);try{return await t()}finally{this.endCLIActivity(e)}}getActivityStates(){return{isUserActive:(this.getNow()-this.lastUserActivityTime)/1e3<this.USER_ACTIVITY_TIMEOUT_MS/1e3,isCLIActive:this.isCLIActive,activeOperationCount:this.activeOperations.size}}},r(Re,`instance`,null),ze=Re.getInstance()}));function Ve(){let e=D().spinnerVerbs;return e?e.mode===`replace`?e.verbs.length>0?e.verbs:He:[...He,...e.verbs]:He}var He,Ue=e((()=>{te(),He=`Accomplishing.Actioning.Actualizing.Architecting.Baking.Beaming.Beboppin'.Befuddling.Billowing.Blanching.Bloviating.Boogieing.Boondoggling.Booping.Bootstrapping.Brewing.Bunning.Burrowing.Calculating.Canoodling.Caramelizing.Cascading.Catapulting.Cerebrating.Channeling.Channelling.Choreographing.Churning.Clauding.Coalescing.Cogitating.Combobulating.Composing.Computing.Concocting.Considering.Contemplating.Cooking.Crafting.Creating.Crunching.Crystallizing.Cultivating.Deciphering.Deliberating.Determining.Dilly-dallying.Discombobulating.Doing.Doodling.Drizzling.Ebbing.Effecting.Elucidating.Embellishing.Enchanting.Envisioning.Evaporating.Fermenting.Fiddle-faddling.Finagling.Flambéing.Flibbertigibbeting.Flowing.Flummoxing.Fluttering.Forging.Forming.Frolicking.Frosting.Gallivanting.Galloping.Garnishing.Generating.Gesticulating.Germinating.Gitifying.Grooving.Gusting.Harmonizing.Hashing.Hatching.Herding.Honking.Hullaballooing.Hyperspacing.Ideating.Imagining.Improvising.Incubating.Inferring.Infusing.Ionizing.Jitterbugging.Julienning.Kneading.Leavening.Levitating.Lollygagging.Manifesting.Marinating.Meandering.Metamorphosing.Misting.Moonwalking.Moseying.Mulling.Mustering.Musing.Nebulizing.Nesting.Newspapering.Noodling.Nucleating.Orbiting.Orchestrating.Osmosing.Perambulating.Percolating.Perusing.Philosophising.Photosynthesizing.Pollinating.Pondering.Pontificating.Pouncing.Precipitating.Prestidigitating.Processing.Proofing.Propagating.Puttering.Puzzling.Quantumizing.Razzle-dazzling.Razzmatazzing.Recombobulating.Reticulating.Roosting.Ruminating.Sautéing.Scampering.Schlepping.Scurrying.Seasoning.Shenaniganing.Shimmying.Simmering.Skedaddling.Sketching.Slithering.Smooshing.Sock-hopping.Spelunking.Spinning.Sprouting.Stewing.Sublimating.Swirling.Swooping.Symbioting.Synthesizing.Tempering.Thinking.Thundering.Tinkering.Tomfoolering.Topsy-turvying.Transfiguring.Transmuting.Twisting.Undulating.Unfurling.Unravelling.Vibing.Waddling.Wandering.Warping.Whatchamacalliting.Whirlpooling.Whirring.Whisking.Wibbling.Working.Wrangling.Zesting.Zigzagging`.split(`.`)}));function P(e,t){let n=parseInt(e.id,10),r=parseInt(t.id,10);return!isNaN(n)&&!isNaN(r)?n-r:e.id.localeCompare(t.id)}function We({tasks:e,isStandalone:t=!1}){let[,n]=F.useState(0),{rows:r,columns:i}=ee(),a=F.useRef(new Map),o=F.useRef(null);o.current===null&&(o.current=new Set(e.filter(e=>e.status===`completed`).map(e=>e.id)));let s=r<=10?0:Math.min(10,Math.max(3,r-14)),c=new Set(e.filter(e=>e.status===`completed`).map(e=>e.id)),l=Date.now();for(let e of c)o.current.has(e)||a.current.set(e,l);for(let e of a.current.keys())c.has(e)||a.current.delete(e);if(o.current=c,F.useEffect(()=>{if(a.current.size===0)return;let e=Date.now(),t=1/0;for(let n of a.current.values()){let r=n+qe;r>e&&r<t&&(t=r)}if(t===1/0)return;let r=setTimeout(e=>e(e=>e+1),t-e,n);return()=>clearTimeout(r)},[e]),!oe()||e.length===0)return null;let u=E(e,e=>e.status===`completed`),d=E(e,e=>e.status===`pending`),f=e.length-u-d,p=new Set(e.filter(e=>e.status!==`completed`).map(e=>e.id)),m=e.length>s,h,g;if(m){let t=[],n=[];for(let r of e.filter(e=>e.status===`completed`)){let e=a.current.get(r.id);e&&l-e<qe?t.push(r):n.push(r)}t.sort(P),n.sort(P);let r=e.filter(e=>e.status===`in_progress`).sort(P),i=e.filter(e=>e.status===`pending`).sort((e,t)=>{let n=e.blockedBy.some(e=>p.has(e));return n===t.blockedBy.some(e=>p.has(e))?P(e,t):n?1:-1}),o=[...t,...r,...i,...n];h=o.slice(0,s),g=o.slice(s)}else h=[...e].sort(P),g=[];let _=``;if(g.length>0){let e=[],t=E(g,e=>e.status===`pending`),n=E(g,e=>e.status===`in_progress`),r=E(g,e=>e.status===`completed`);n>0&&e.push(`${n} in progress`),t>0&&e.push(`${t} pending`),r>0&&e.push(`${r} completed`),_=` … +${e.join(`, `)}`}let b=(0,I.jsxs)(I.Fragment,{children:[h.map(e=>(0,I.jsx)(Ke,{task:e,openBlockers:e.blockedBy.filter(e=>p.has(e)),columns:i},e.id)),s>0&&_&&(0,I.jsx)(y,{dimColor:!0,children:_})]});return t?(0,I.jsxs)(v,{flexDirection:`column`,marginTop:1,marginLeft:2,children:[(0,I.jsx)(v,{children:(0,I.jsxs)(y,{dimColor:!0,children:[(0,I.jsx)(y,{bold:!0,children:e.length}),` tasks (`,(0,I.jsx)(y,{bold:!0,children:u}),` done, `,f>0&&(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(y,{bold:!0,children:f}),` in progress, `]}),(0,I.jsx)(y,{bold:!0,children:d}),` open)`]})}),b]}):(0,I.jsx)(v,{flexDirection:`column`,children:b})}function Ge(e){switch(e){case`completed`:return{icon:h.tick,color:`success`};case`in_progress`:return{icon:h.squareSmallFilled,color:`claude`};case`pending`:return{icon:h.squareSmall,color:void 0}}}function Ke({task:e,openBlockers:t,columns:n}){let r=e.status===`completed`,i=e.status===`in_progress`,a=t.length>0,{icon:o,color:s}=Ge(e.status),c=Math.max(15,n-15),l=Ce(e.subject,c);return(0,I.jsx)(v,{flexDirection:`column`,children:(0,I.jsxs)(v,{children:[(0,I.jsxs)(y,{color:s,children:[o,` `]}),(0,I.jsx)(y,{bold:i,strikethrough:r,dimColor:r||a,children:l}),a&&(0,I.jsxs)(y,{dimColor:!0,children:[` `,h.pointerSmall,` blocked by`,` `,[...t].sort((e,t)=>parseInt(e,10)-parseInt(t,10)).map(e=>`#${e}`).join(`, `)]})]})})}var F,I,qe,Je=e((()=>{m(),F=t(x(),1),M(),C(),T(),we(),fe(),I=w(),qe=3e4}));function Ye(){l(st,this).emit()}function Xe(e){if(!(e===l(B,this)&&l(z,this)!==null)){l(z,this)?.close(),d(z,this,null),d(B,this,e);try{d(z,this,Le(e,l(J,this))),l(z,this).unref()}catch{}}}function Ze(e){d(V,this,null);let t=ue();t===e&&ce(t).then(async e=>{e.length>0&&e.every(e=>e.status===`completed`)&&(await pe(t),d(L,this,[]),d(R,this,!0)),i(q,this,Ye).call(this)})}function Qe(){l(V,this)&&(clearTimeout(l(V,this)),d(V,this,null))}function $e(){l(z,this)?.close(),d(z,this,null),d(B,this,null),l(W,this)?.call(this),d(W,this,null),i(q,this,Qe).call(this),l(H,this)&&clearTimeout(l(H,this)),l(U,this)&&clearTimeout(l(U,this)),d(H,this,null),d(U,this,null),d(K,this,!1)}function et(){return ut??(ut=new lt)}function tt(){let e=oe()?et():null;return(0,rt.useSyncExternalStore)(e?e.subscribe:ft,e?e.getSnapshot:pt)}function nt(){let e=tt(),t=A(),n=e===void 0;return(0,rt.useEffect)(()=>{n&&t(e=>e.expandedView===`tasks`?{...e,expandedView:`none`}:e)},[n,t]),e}var rt,it,at,ot,L,R,z,B,V,H,U,W,st,G,K,q,J,ct,lt,ut,dt,ft,pt,mt=e((()=>{rt=t(x(),1),N(),re(),fe(),f(),a(),n(),o(),s(),c(),it=5e3,at=50,ot=5e3,L=new WeakMap,R=new WeakMap,z=new WeakMap,B=new WeakMap,V=new WeakMap,H=new WeakMap,U=new WeakMap,W=new WeakMap,st=new WeakMap,G=new WeakMap,K=new WeakMap,q=new WeakSet,J=new WeakMap,ct=new WeakMap,lt=class{constructor(){p(this,q),u(this,L,void 0),u(this,R,!1),u(this,z,null),u(this,B,null),u(this,V,null),u(this,H,null),u(this,U,null),u(this,W,null),u(this,st,ne()),u(this,G,0),u(this,K,!1),r(this,`getSnapshot`,()=>l(R,this)?void 0:l(L,this)),r(this,`subscribe`,e=>{var t;let n=l(st,this).subscribe(e);d(G,this,(t=l(G,this),t++,t)),l(K,this)||(d(K,this,!0),d(W,this,le(l(J,this))),l(ct,this).call(this));let r=!1;return()=>{var e;r||(r=!0,n(),d(G,this,(e=l(G,this),e--,e)),l(G,this)===0&&i(q,this,$e).call(this))}}),u(this,J,()=>{l(H,this)&&clearTimeout(l(H,this)),d(H,this,setTimeout(()=>void l(ct,this).call(this),at)),l(H,this).unref()}),u(this,ct,async()=>{let e=ue();i(q,this,Xe).call(this,de(e));let t=(await ce(e)).filter(e=>!e.metadata?._internal);d(L,this,t);let n=t.some(e=>e.status!==`completed`);n||t.length===0?(d(R,this,t.length===0),i(q,this,Qe).call(this)):l(V,this)===null&&!l(R,this)&&(d(V,this,setTimeout(i(q,this,Ze).bind(this,e),it)),l(V,this).unref()),i(q,this,Ye).call(this),l(U,this)&&(clearTimeout(l(U,this)),d(U,this,null)),n&&(d(U,this,setTimeout(l(J,this),ot)),l(U,this).unref())})}},ut=null,dt=()=>{},ft=()=>dt,pt=()=>void 0})),ht=e((()=>{C(),Ie(),w()}));function gt({message:e,mode:t,messageColor:n,glimmerIndex:r,flashOpacity:i,shimmerColor:a,stalledIntensity:o=0}){let[s]=_(),c=Ae(s),{segments:l,messageWidth:u}=_t.useMemo(()=>{let t=[];for(let{segment:n}of xe().segment(e))t.push({segment:n,width:g(n)});return{segments:t,messageWidth:g(e)}},[e]);if(!e)return null;if(o>0){let t=c[n],r=t?Pe(t):null;if(r){let t=ke(Me(r,vt,o));return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(y,{color:t,children:e}),(0,Y.jsx)(y,{color:t,children:` `})]})}let i=o>.5?`error`:n;return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(y,{color:i,children:e}),(0,Y.jsx)(y,{color:i,children:` `})]})}if(t===`tool-use`){let t=c[n],r=c[a],o=t?Pe(t):null,s=r?Pe(r):null;return o&&s?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(y,{color:ke(Me(o,s,i)),children:e}),(0,Y.jsx)(y,{color:n,children:` `})]}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(y,{color:i>.5?a:n,children:e}),(0,Y.jsx)(y,{color:n,children:` `})]})}let d=r-1,f=r+1;if(d>=u||f<0)return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(y,{color:n,children:e}),(0,Y.jsx)(y,{color:n,children:` `})]});let p=Math.max(0,d),m=0,h=``,v=``,b=``;for(let{segment:e,width:t}of l)m+t<=p?h+=e:m>f?b+=e:v+=e,m+=t;return(0,Y.jsxs)(Y.Fragment,{children:[h&&(0,Y.jsx)(y,{color:n,children:h}),(0,Y.jsx)(y,{color:a,children:v}),b&&(0,Y.jsx)(y,{color:n,children:b}),(0,Y.jsx)(y,{color:n,children:` `})]})}var _t,Y,vt,yt=e((()=>{_t=t(x(),1),C(),Se(),Ie(),Oe(),Y=w(),vt={r:171,g:43,b:63}}));function bt(e,t,n){let r=e===`requesting`?50:200,[i,a]=S(n?null:r),o=(0,xt.useMemo)(()=>g(t),[t]);if(n)return[i,-100];let s=Math.floor(a/r),c=o+20;return e===`requesting`?[i,s%c-10]:[i,o+10-s%c]}var xt,St=e((()=>{xt=t(x(),1),C()}));function Ct(e,t,n=!1,r=!1){let i=(0,X.useRef)(e),a=(0,X.useRef)(t),o=(0,X.useRef)(e),s=(0,X.useRef)(0),c=(0,X.useRef)(e);t>a.current&&(i.current=e,a.current=t,s.current=0,c.current=e);let l;n?(l=0,i.current=e):l=t>0?e-i.current:e-o.current;let u=l>3e3&&!n,d=u?Math.min((l-3e3)/2e3,1):0;if(!r&&(d>0||s.current>0)){let t=e-c.current;if(t>=50){let n=Math.floor(t/50),r=s.current;for(let e=0;e<n;e++){let e=d-r;if(Math.abs(e)<.01){r=d;break}r+=e*.1}s.current=r,c.current=e}}else s.current=d,c.current=e;return{isStalled:u,stalledIntensity:r?d:s.current}}var X,wt=e((()=>{X=t(x(),1)})),Tt=e((()=>{ht(),yt(),De(),je(),St(),wt(),Oe()}));function Et({mode:e,reducedMotion:t,hasActiveTools:n,responseLengthRef:r,message:i,messageColor:a,shimmerColor:o,overrideColor:s,loadingStartTimeRef:c,totalPausedMsRef:l,pauseStartTimeRef:u,spinnerSuffix:d,verbose:f,columns:p,agentTokens:m,leaderIsIdle:_=!1,thinkingStatus:x}){let[ee,C]=S(t?null:50),w=Date.now(),T=u.current===null?w-c.current-l.current:u.current-c.current-l.current,E=r.current,{isStalled:te,stalledIntensity:D}=Ct(C,E,n||_,t),ne=t?0:Math.floor(C/120),re=e===`requesting`?50:200,O=(0,Ot.useMemo)(()=>g(i),[i]),k=O+20,ie=Math.floor(C/re),ae=t||te?-100:e===`requesting`?ie%k-10:O+10-ie%k,oe=t?0:e===`tool-use`?(Math.sin(C/1e3*Math.PI)+1)/2:0,A=(0,Ot.useRef)(E);if(t)A.current=E;else{let e=E-A.current;if(e>0){let t;t=e<70?3:e<200?Math.max(8,Math.ceil(e*.15)):50,A.current=Math.min(A.current+t,E)}}let se=A.current,ce=Math.round(se/4),le=Ee(T),ue=g(le),de=ce+m,fe=Te(de),pe=g(`${h.arrowDown} ${fe} tokens`),j=x===`thinking`?`thinking`:typeof x==`number`?`thought for ${Math.max(1,Math.round(x/1e3))}s`:null,me=j?g(j):0,he=O+2,ge=kt,_e=x!==null,ve=f||T>jt,M=p-he-5,N=_e&&M>me;!N&&_e&&x===`thinking`&&M>At&&(j=`thinking`,me=At,N=!0);let ye=N?me+ge:0,be=ve&&M>ye+ue,xe=ye+(be?ue+ge:0),Se=ve&&de>0&&M>xe+pe,Ce=N&&x===`thinking`&&!d&&!be&&!Se&&!0,we=(C-Pt)/1e3,De=C<Pt?0:(Math.sin(we*Math.PI*2/Ft)+1)/2,Oe=ke(Me(Mt,Nt,De)),Ae=[...d?[(0,Z.jsx)(y,{dimColor:!0,children:d},`suffix`)]:[],...be?[(0,Z.jsx)(y,{dimColor:!0,children:le},`elapsedTime`)]:[],...Se?[(0,Z.jsxs)(v,{flexDirection:`row`,children:[(0,Z.jsx)(Dt,{mode:e}),(0,Z.jsxs)(y,{dimColor:!0,children:[fe,` tokens`]})]},`tokens`)]:[],...N&&j?[x===`thinking`&&!t?(0,Z.jsx)(y,{color:Oe,children:Ce?`(${j})`:j},`thinking`):(0,Z.jsx)(y,{dimColor:!0,children:j},`thinking`)]:[]],je=Ae.length>0?Ce?(0,Z.jsx)(b,{children:Ae}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(y,{dimColor:!0,children:`(`}),(0,Z.jsx)(b,{children:Ae}),(0,Z.jsx)(y,{dimColor:!0,children:`)`})]}):null;return(0,Z.jsxs)(v,{ref:ee,flexDirection:`row`,flexWrap:`wrap`,marginTop:1,width:`100%`,children:[(0,Z.jsx)(Fe,{frame:ne,messageColor:a,stalledIntensity:s?0:D,reducedMotion:t,time:C}),(0,Z.jsx)(gt,{message:i,mode:e,messageColor:a,glimmerIndex:ae,flashOpacity:oe,shimmerColor:o,stalledIntensity:s?0:D}),je]})}function Dt({mode:e}){switch(e){case`tool-input`:case`tool-use`:case`responding`:case`thinking`:return(0,Z.jsx)(v,{width:2,children:(0,Z.jsx)(y,{dimColor:!0,children:h.arrowDown})});case`requesting`:return(0,Z.jsx)(v,{width:2,children:(0,Z.jsx)(y,{dimColor:!0,children:h.arrowUp})})}}var Ot,Z,kt,At,jt,Mt,Nt,Pt,Ft,It=e((()=>{m(),Ot=t(x(),1),C(),we(),yt(),je(),wt(),Oe(),Z=w(),kt=g(` · `),At=g(`thinking`),jt=3e4,Mt={r:153,g:153,b:153},Nt={r:185,g:185,b:185},Pt=3e3,Ft=2}));function Lt(e){return(0,$.jsx)(Rt,{...e})}function Rt({mode:e,loadingStartTimeRef:t,totalPausedMsRef:n,pauseStartTimeRef:r,spinnerTip:i,responseLengthRef:a,overrideColor:o,overrideShimmerColor:s,overrideMessage:c,spinnerSuffix:l,verbose:u,hasActiveTools:d=!1,leaderIsIdle:f=!1}){let p=se(),m=p.prefersReducedMotion??!1,h=ie(e=>e.tasks),g=ie(e=>e.expandedView)===`tasks`,{columns:_}=ee(),b=tt(),[x,S]=(0,Q.useState)(null),C=(0,Q.useRef)(null);(0,Q.useEffect)(()=>{let t=null,n=null;if(e===`thinking`)C.current===null&&(C.current=Date.now(),S(`thinking`));else if(C.current!==null){let e=Date.now()-C.current,r=Date.now()-C.current,i=Math.max(0,2e3-r);C.current=null;let a=()=>{S(e),n=setTimeout(S,2e3,null)};i>0?t=setTimeout(a,i):a()}return()=>{t&&clearTimeout(t),n&&clearTimeout(n)}},[e]);let w=b?.find(e=>e.status!==`pending`&&e.status!==`completed`),T=Bt(b),[E]=(0,Q.useState)(()=>he(Ve())),te=`${c??w?.activeForm??w?.subject??E}…`;(0,Q.useEffect)(()=>{let t=`spinner-${e}`;return ze.startCLIActivity(t),()=>{ze.endCLIActivity(t)}},[e]);let D=0;for(let e of Object.values(h))e.status===`running`&&ge(e)&&e.progress?.tokenCount&&(D+=e.progress.tokenCount);let ne=r.current===null?Date.now()-t.current-n.current:r.current-t.current-n.current,re=o??`claude`,O=s??`workmateShimmer`,k=p.spinnerTipsEnabled!==!1,ae=k&&ne>18e5,oe=k&&ne>3e4&&!be().btwUseCount,A=ae&&!T?`Use /clear to start fresh when switching topics and free up context`:oe&&!T?`Use /btw to ask a quick side question without interrupting Work Mate's current work`:i;return(0,$.jsxs)(v,{flexDirection:`column`,width:`100%`,alignItems:`flex-start`,children:[(0,$.jsx)(Et,{mode:e,reducedMotion:m,hasActiveTools:d,responseLengthRef:a,message:te,messageColor:re,shimmerColor:O,overrideColor:o,loadingStartTimeRef:t,totalPausedMsRef:n,pauseStartTimeRef:r,spinnerSuffix:l,verbose:u,columns:_,agentTokens:D,leaderIsIdle:f,thinkingStatus:x}),g&&b&&b.length>0?(0,$.jsx)(v,{width:`100%`,flexDirection:`column`,children:(0,$.jsx)(j,{children:(0,$.jsx)(We,{tasks:b})})}):T||A?(0,$.jsxs)(v,{width:`100%`,flexDirection:`column`,children:[null,(T||A)&&(0,$.jsx)(j,{children:(0,$.jsx)(y,{dimColor:!0,children:T?`Next: ${T.subject}`:`Tip: ${A}`})})]}):null]})}function zt(){let e=se().prefersReducedMotion??!1,[t,n]=S(e?null:120);if(e)return(0,$.jsx)(v,{ref:t,flexWrap:`wrap`,height:1,width:2,children:(0,$.jsx)(y,{color:`text`,children:`●`})});let r=Math.floor(n/120)%Ht.length;return(0,$.jsx)(v,{ref:t,flexWrap:`wrap`,height:1,width:2,children:(0,$.jsx)(y,{color:`text`,children:Ht[r]})})}function Bt(e){if(!e)return;let t=e.filter(e=>e.status===`pending`);if(t.length===0)return;let n=new Set(e.filter(e=>e.status!==`completed`).map(e=>e.id));return t.find(e=>!e.blockedBy.some(e=>n.has(e)))??t[0]}var Q,$,Vt,Ht,Ut=e((()=>{C(),Q=t(x(),1),_e(),we(),Be(),Ue(),me(),Je(),mt(),N(),M(),Tt(),It(),ae(),ve(),O(),ye(),$=w(),Vt=Ne(),Ht=[...Vt,...[...Vt].reverse()]}));export{bt as a,nt as c,ze as d,Be as f,St as i,We as l,Lt as n,mt as o,Ut as r,tt as s,zt as t,Je as u};
@@ -1 +0,0 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{l as t,m as n}from"./settings-D4M13toi.js";import{cf as r,uf as i}from"./loadAgentsDir-uuZYOgKn.js";function a(){let e=t(),n=[`user`,`project`,`local`].flatMap(e=>r(e).errors);return{settings:e.settings,errors:[...e.errors,...n]}}var o=e((()=>{i(),n()}));export{o as n,a as t};
@@ -1 +0,0 @@
1
- import{t as e}from"./backgroundHousekeeping-BtEJ6TeC.js";export{e as startBackgroundHousekeeping};
@@ -1 +0,0 @@
1
- import{n as e,t}from"./caches-Dn8yrJmL.js";e();export{t as clearSessionCaches};
@@ -1 +0,0 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{ei as t,ii as n}from"./settings-D4M13toi.js";import{Pt as r,l as i,mn as a}from"./state-CXY-q5gr.js";import{Ay as o,Bi as s,Cb as c,Ci as l,F_ as u,G as d,I_ as f,Iu as p,L_ as m,Mi as h,Mp as g,N_ as _,P_ as v,R_ as y,Ru as b,Sb as x,Wi as S,hp as C,ky as w,lh as T,lm as E,ns as D,pp as O,q as k,sm as A,ts as j,uh as M,z_ as N}from"./loadAgentsDir-uuZYOgKn.js";import{a as P,n as F}from"./fileSuggestions-BYD78vcF.js";import{r as I,t as L}from"./magicDocs-D53lV8b5.js";import{r as R,t as z}from"./detectRepository--luIRv5H.js";function B(e=new Set){let n=e.size>0;u.cache.clear?.(),v.cache.clear?.(),_.cache.clear?.(),y.cache.clear?.(),F(),l(),n||C(),m(null),a(null),E(),D(),o(`session_start`),p(),z(),d(),i(e),t(),s(),M(),L(),x(),import(`./SearchExtraToolsTool-CdWB9sO8.js`).then(({clearSearchExtraToolsDescriptionCache:e})=>e()),import(`./loadAgentsDir-BBbIAiay.js`).then(({clearAgentDefinitionsCache:e})=>e()),import(`./prompt-BZmu5CeK.js`).then(({clearPromptCache:e})=>e())}var V=e((()=>{r(),h(),N(),f(),P(),g(),O(),A(),T(),I(),S(),j(),k(),w(),R(),n(),b(),c()}));export{V as n,B as t};
@@ -1 +0,0 @@
1
- import{Ci as e,Di as t,Mi as n}from"./loadAgentsDir-uuZYOgKn.js";n();export{e as clearCommandsCache,t as getCommands};
@@ -1,2 +0,0 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{di as t,fi as n}from"./src-BX54x08P.js";import{It as r,Pt as i}from"./state-CXY-q5gr.js";import{$_ as a,B_ as o,F_ as s,G_ as c,I_ as l,Jg as u,Ji as d,M_ as f,P_ as p,Rx as m,V_ as h,W_ as g,Xg as _,Zg as v,ab as y,av as b,j_ as x,lm as S,mn as C,mp as w,nd as T,nm as E,ob as D,ot as O,pp as k,qg as A,rm as j,sm as M,st as N,td as P}from"./loadAgentsDir-uuZYOgKn.js";import{F,I}from"./debug-2pVES-2G.js";import{o as L,s as R}from"./log-L1kqxa_P.js";function z(e,n){let r=P(`tip`),i=y(`app:toggleTranscript`,`Global`,`ctrl+o`),a=[...e.options.verbose?[]:[`(${i} to see full summary)`],...n?[n]:[],...r?[r]:[]];return t.dim(`Compacted ${a.join(`
2
- `)}`)}async function B(e,t){let n=e.getAppState(),r=await O(e.options.tools,e.options.mainLoopModel,Array.from(n.toolPermissionContext.additionalWorkingDirectories.keys()),e.options.mcpClients),i=x({mainThreadAgentDefinition:void 0,toolUseContext:e,customSystemPrompt:e.options.customSystemPrompt,defaultSystemPrompt:r,appendSystemPrompt:e.options.appendSystemPrompt}),[a,o]=await Promise.all([s(),p()]);return{systemPrompt:i,userContext:a,systemContext:o,toolUseContext:e,forkContextMessages:t}}var V;e((()=>{n(),i(),N(),l(),D(),k(),v(),g(),o(),M(),E(),a(),I(),C(),L(),d(),T(),f(),V=async(e,t)=>{let{abortController:n}=t,{messages:i}=t;if(i=m(i),i.length===0)throw Error(`No messages to compact`);let a=e.trim();try{if(!a){let e=await j(i,t.agentId);if(e)return s.cache.clear?.(),S(),w(t.options.querySource??`compact`,t.agentId),r(),c(),{type:`compact`,compactionResult:e,displayText:z(t)}}let e=(await h(i,t)).messages,n=await _(e,t,await B(t,e),!1,a,!1);return b(void 0),c(),s.cache.clear?.(),S(),{type:`compact`,compactionResult:n,displayText:z(t,n.userDisplayMessage)}}catch(e){throw n.signal.aborted?Error(`Compaction canceled.`):F(e,`Not enough messages to compact. Send a few more messages first, then try again.`)?Error(u):F(e,`Compaction interrupted · This may be due to network issues — please try again.`)?Error(A):(R(e),Error(`Error during compaction: ${e}`))}}}))();export{V as call};
@@ -1 +0,0 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{t}from"./jsx-runtime-Bb4Xn-E0.js";import{n,t as r}from"./Settings-DYKmPdbd.js";var i,a;e((()=>{n(),i=t(),a=async(e,t)=>(0,i.jsx)(r,{onClose:e,context:t,defaultTab:`Config`})}))();export{a as call};
@@ -1 +0,0 @@
1
- import{d as e,n as t}from"./config-BDn2YIjC.js";e();export{t as enableConfigs};
@@ -1 +0,0 @@
1
- import{n as e,r as t,t as n}from"./context-noninteractive-CuHHniJn.js";t();export{n as call,e as collectContextData};
@@ -1 +0,0 @@
1
- import{n as e,t}from"./conversation-Cjaftrrw.js";e();export{t as clearConversation};
@@ -1 +0,0 @@
1
- import{a as e,n as t}from"./rolldown-runtime-DaDcL9Zw.js";import{B as n,Pt as r,Ut as i,Vt as a,dn as o,pn as s,q as c,un as l}from"./state-CXY-q5gr.js";import{Cn as u,En as d,Qn as f,Sg as p,St as m,Tn as h,WC as g,Wn as _,YC as v,Yr as y,_g as b,ai as x,bb as S,ci as C,cw as w,dh as T,gg as E,gr as D,mn as O,ms as k,n_ as A,on as j,ph as M,ps as N,qt as P,t_ as F,tw as I,wg as L,xb as R,yt as z}from"./loadAgentsDir-uuZYOgKn.js";import{o as B,s as V}from"./log-L1kqxa_P.js";import{n as H}from"./analytics-COpjZpvd.js";import{n as U,t as W}from"./caches-Dn8yrJmL.js";import{randomUUID as G}from"crypto";async function K({setMessages:t,readFileState:r,discoveredSkillNames:d,loadedNestedMemoryPaths:m,getAppState:S,setAppState:w,setConversationId:E}){let O=j();await P(`clear`,{getAppState:S,setAppState:w,signal:AbortSignal.timeout(O),timeoutMs:O}),n();let M=new Set,N=[],F=e=>`isBackgrounded`in e&&e.isBackgrounded===!1;if(S)for(let e of Object.values(S().tasks))F(e)||k(e)&&(M.add(e.agentId),N.push(e));t(()=>[]);let{setContextBlocked:L}=(g(),e(v));L(!1),E&&E(G()),W(M),l(null),o(null),s(null),i(),R(c()),r.clear(),d?.clear(),m?.clear(),w&&w(e=>{let t={};for(let[n,r]of Object.entries(e.tasks)){if(!F(r)){t[n]=r;continue}try{r.status===`running`&&(b(r)&&(r.shellCommand?.kill(),r.shellCommand?.cleanup(),r.cleanupTimeoutId&&clearTimeout(r.cleanupTimeoutId)),`abortController`in r&&r.abortController?.abort(),`unregisterCleanup`in r&&r.unregisterCleanup?.())}catch(e){V(e)}u(n)}return{...e,tasks:t,attribution:T(),standaloneAgentContext:void 0,fileHistory:{snapshots:[],trackedFiles:new Set,snapshotSequence:0},mcp:{clients:[],tools:[],commands:[],resources:{},pluginReconnectKey:e.mcp.pluginReconnectKey}}}),I(),_(),a({setCurrentAsParent:!0}),await y();for(let e of N)e.status===`running`&&h(e.id,f(p(e.agentId)));let{saveMode:B}=(D(),e(C));B(`normal`);let H=z();H&&x(H);let U=await A(`clear`);U.length>0&&t(()=>U)}var q=t((()=>{r(),H(),N(),E(),L(),M(),O(),B(),w(),S(),F(),D(),d(),m(),U()}));export{q as n,K as t};
@@ -1,40 +0,0 @@
1
- import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{C as n,D as r,Gr as i,H as a,I as o,P as s,T as c,Wt as l,Xn as u,ai as d,di as f,fi as p,hn as m,k as ee,oi as te,ot as ne,p as h,t as g}from"./src-BX54x08P.js";import{t as _}from"./jsx-runtime-Bb4Xn-E0.js";import{$n as v,Br as re,Qn as y,qr as ie}from"./settings-D4M13toi.js";import{Pt as b,at as ae,q as oe}from"./state-CXY-q5gr.js";import{Dc as x,Or as se,Tb as S,Tc as ce,bi as le,br as C,ei as ue,gr as w,hd as de,lr as T,md as E,sb as D,tb as fe,tr as pe,vS as O,vr as me,wb as he,yS as k,yi as ge}from"./loadAgentsDir-uuZYOgKn.js";import{S as _e,c as A,i as ve,x as j}from"./debug-2pVES-2G.js";import{a as M,o as ye,s as be}from"./log-L1kqxa_P.js";import{n as xe}from"./analytics-COpjZpvd.js";import{S as Se,_ as N,d as Ce,p as we}from"./startupProfiler-B9Qv2QGH.js";import{f as Te,u as Ee}from"./model-CcHyMyBv.js";import{n as De,t as P}from"./useExitOnCtrlCDWithKeybindings-ClN4NJnB.js";import{n as F,t as Oe}from"./TextInput-ZKU-x_FD.js";import{n as ke,t as Ae}from"./select-BuTJbu_Q.js";import{r as je,t as Me}from"./Spinner-DOI8qqZi.js";import{l as Ne,u as Pe}from"./SpinnerGlyph-BR_SiV9L.js";import{t as Fe}from"./SearchBox-zA5QwIpO.js";import{n as Ie,t as Le}from"./useSearchInput-BIQN_-Hm.js";import{n as I,t as L}from"./Messages-RBfRELKn.js";function Re({log:e,onExit:t,onSelect:n}){let[i,a]=R.useState(null);R.useEffect(()=>{a(null),C(e)&&se(e).then(a)},[e]);let u=C(e)&&i===null,d=i??e,f=T(d)||``,p=ce();return l(`confirm:no`,t,{context:`Confirmation`}),l(`confirm:yes`,(0,R.useCallback)(()=>{n(i??e)},[n,i,e]),{context:`Confirmation`}),u?(0,z.jsxs)(o,{flexDirection:`column`,padding:1,children:[(0,z.jsx)(h,{message:`Loading session…`}),(0,z.jsx)(s,{dimColor:!0,children:(0,z.jsx)(c,{children:(0,z.jsx)(E,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})})})]}):(0,z.jsxs)(o,{flexDirection:`column`,children:[(0,z.jsx)(L,{messages:d.messages,tools:p,commands:[],verbose:!0,toolJSX:null,toolUseConfirmQueue:[],inProgressToolUseIDs:new Set,isMessageSelectorVisible:!1,conversationId:f,screen:`transcript`,streamingToolUses:[],showAllInTranscript:!0,isLoading:!1}),(0,z.jsxs)(o,{flexShrink:0,flexDirection:`column`,borderTopDimColor:!0,borderBottom:!1,borderLeft:!1,borderRight:!1,borderStyle:`single`,paddingLeft:2,children:[(0,z.jsxs)(s,{children:[we(d.modified),` · `,d.messageCount,` messages`,d.gitBranch?` · ${d.gitBranch}`:``]}),(0,z.jsx)(s,{dimColor:!0,children:(0,z.jsxs)(c,{children:[(0,z.jsx)(r,{shortcut:`Enter`,action:`resume`}),(0,z.jsx)(E,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})]})})]})]})}var R,z,ze=e((()=>{R=t(d(),1),g(),fe(),x(),N(),w(),de(),I(),z=_()}));function B(e,t){if(e===H)return 5;let n=i(e),r=t?Math.min(n,t-U-W):n;return Math.max(0,r)+U+W}function Be(e,t){let n=t-U-W;return i(e)<=n?e:n<=1?e.charAt(0):Se(e,n)}function Ve({tabs:e,selectedIndex:t,availableWidth:n,showAllProjects:r=!1}){let i=r?`Resume (All Projects)`:`Resume`,a=i.length+1,c=Math.max(Ke,K),l=n-a-c-2,u=Math.max(0,Math.min(t,e.length-1)),d=Math.max(20,Math.floor(l/2)),f=e.map(e=>B(e,d)),p=0,m=e.length;if(f.reduce((e,t,n)=>e+t+ +(n<f.length-1),0)>l){let t=l-Ge,n=f[u]??0;for(p=u,m=u+1;p>0||m<e.length;){let r=p>0,i=m<e.length;if(r){let e=(f[p-1]??0)+1;if(n+e<=t){p--,n+=e;continue}}if(i){let e=(f[m]??0)+1;if(n+e<=t){m++,n+=e;continue}}break}}let ee=p,te=e.length-m,ne=e.slice(p,m),h=ne.map((e,t)=>p+t);return(0,V.jsxs)(o,{flexDirection:`row`,gap:1,children:[(0,V.jsx)(s,{color:`suggestion`,children:i}),ee>0&&(0,V.jsxs)(s,{dimColor:!0,children:[G,ee]}),ne.map((e,t)=>{let n=h[t]===u,r=e===H?e:`#${Be(e,d-U)}`;return(0,V.jsxs)(s,{backgroundColor:n?`suggestion`:void 0,color:n?`inverseText`:void 0,bold:n,children:[` `,r,` `]},e)}),te>0?(0,V.jsxs)(s,{dimColor:!0,children:[He,te,Ue]}):(0,V.jsx)(s,{dimColor:!0,children:We})]})}var V,H,U,W,G,He,Ue,We,Ge,Ke,K,qe=e((()=>{g(),N(),V=_(),H=`All`,U=2,W=1,G=`← `,He=`→`,Ue=` (tab to cycle)`,We=`(tab to cycle)`,Ge=5,Ke=18,K=14}));function Je({nodes:e,onSelect:t,onCancel:n,onFocus:r,focusNodeId:i,visibleOptionCount:a,layout:s=`expanded`,isDisabled:c=!1,hideIndexes:l=!1,isNodeExpanded:u,onExpand:d,onCollapse:f,getParentPrefix:p,getChildPrefix:m,onUpFromFirstItem:ee}){let[te,ne]=q.useState(new Set),h=q.useRef(!1),g=q.useRef(null),_=q.useCallback(e=>u?u(e):te.has(e),[u,te]),v=q.useMemo(()=>{let t=[];function n(e,r,i){let a=!!e.children&&e.children.length>0,o=_(e.id);if(t.push({node:e,depth:r,isExpanded:o,hasChildren:a,parentId:i}),a&&o&&e.children)for(let t of e.children)n(t,r+1,e.id)}for(let t of e)n(t,0);return t},[e,_]),re=q.useCallback(e=>e?`▼ `:`▶ `,[]),y=q.useCallback(e=>` ▸ `,[]),ie=p??re,b=m??y,ae=q.useCallback(e=>{let t=``;return e.hasChildren?t=ie(e.isExpanded):e.depth>0&&(t=b(e.depth)),t+e.node.label},[ie,b]),oe=q.useMemo(()=>v.map(e=>({label:ae(e),description:e.node.description,dimDescription:e.node.dimDescription??!0,value:e.node.id})),[v,ae]),x=q.useMemo(()=>{let e=new Map;return v.forEach(t=>e.set(t.node.id,t.node)),e},[v]),se=q.useCallback(e=>v.find(t=>t.node.id===e),[v]),S=q.useCallback((e,t)=>{se(e)?.hasChildren&&(t?d?d(e):ne(t=>new Set(t).add(e)):f?f(e):ne(t=>{let n=new Set(t);return n.delete(e),n}))},[se,d,f]);return(0,Ye.jsx)(o,{tabIndex:0,autoFocus:!0,onKeyDown:e=>{if(!i||c)return;let t=se(i);if(t){if(e.key===`right`&&t.hasChildren)e.preventDefault(),S(i,!0);else if(e.key===`left`){if(t.hasChildren&&t.isExpanded)e.preventDefault(),S(i,!1);else if(t.parentId!==void 0&&(e.preventDefault(),h.current=!0,S(t.parentId,!1),r)){let e=x.get(t.parentId);e&&r(e)}}}},children:(0,Ye.jsx)(Ae,{options:oe,onChange:q.useCallback(e=>{let n=x.get(e);n&&t(n)},[x,t]),onFocus:q.useCallback(e=>{if(h.current){h.current=!1;return}if(g.current!==e&&(g.current=e,r)){let t=x.get(e);t&&r(t)}},[r,x]),onCancel:n,defaultFocusValue:i,visibleOptionCount:a,layout:s,isDisabled:c,hideIndexes:l,onUpFromFirstItem:ee})})}var q,Ye,Xe=e((()=>{q=t(d(),1),g(),ke(),Ye=_()}));function Ze(e,t){return Se(e.replace(/\s+/g,` `).trim(),t)}function Qe({before:e,match:t,after:n},r){return f.dim(e)+r(t)+f.dim(n)}function $e(e,t,n){let r=e.toLowerCase().indexOf(t.toLowerCase());if(r===-1)return null;let i=r+t.length,a=Math.max(0,r-n),o=Math.min(e.length,i+n),s=e.slice(a,r),c=e.slice(r,i),l=e.slice(i,o);return{before:(a>0?`…`:``)+s.replace(/\s+/g,` `).trimStart(),match:c.trim(),after:l.replace(/\s+/g,` `).trimEnd()+(o<e.length?`…`:``)}}function et(e,t,n){let{isGroupHeader:r=!1,isChild:i=!1,forkCount:a=0}=n||{},o=r&&a>0?st:i?ct:0,s=r&&a>0?` (+${a} other ${a===1?`session`:`sessions`})`:``,c=e.isSidechain?` (sidechain)`:``,l=t-o-c.length-s.length;return`${Ze(M(e),l)}${c}${s}`}function tt(e,t){let{isChild:n=!1,showProjectPath:r=!1}=t||{},i=n?` `:``,a=Ce(e),o=r&&e.projectPath?` · ${e.projectPath}`:``;return i+a+o}function nt({logs:e,maxHeight:t=1/0,forceWidth:i,onCancel:d,onSelect:f,onLogsChanged:p,onLoadMore:h,initialSearchQuery:g,showAllProjects:_=!1,onToggleAllProjects:v,onAgenticSearch:y}){let ie=ne(),b=i===void 0?ie.columns:i,x=De(d),se=u(),S=me(),[ce]=a(),le=Ne(ce),C=J.useMemo(()=>e=>te(e,le.warning),[le.warning]),[w,de]=J.useState(null),[D,fe]=J.useState(!1),[O,he]=J.useState(!1),[k,_e]=J.useState(!1),A=J.useMemo(()=>oe(),[]),[ve,j]=J.useState(``),[ye,be]=J.useState(0),[xe,Se]=J.useState(new Set),[N,we]=J.useState(null),[Te,Ee]=J.useState(1),[P,F]=J.useState(`list`),[ke,je]=J.useState(null),Pe=J.useRef(null),[Fe,Le]=J.useState(0),[I,L]=J.useState({status:`idle`}),[R,z]=J.useState(!1),ze=J.useRef(null),{query:B,setQuery:Be,cursorOffset:V}=Ie({isActive:P===`search`&&I.status!==`searching`,onExit:()=>{F(`list`)},onExitUp:()=>{F(`list`)},passthroughCtrlKeys:[`n`],initialQuery:g||``}),H=J.useDeferredValue(B),[U,W]=J.useState(``);J.useEffect(()=>{if(!H){W(``);return}let e=setTimeout(W,300,H);return()=>clearTimeout(e)},[H]);let[G,He]=J.useState(null),[Ue,We]=J.useState(!1);J.useEffect(()=>{re().then(e=>de(e)),ge(A).then(e=>{_e(e.length>1)})},[A]);let Ge=J.useMemo(()=>new Map(e.map(e=>[e,it(e)])),[e]),Ke=J.useMemo(()=>null,[e,Ge,!1]),K=J.useMemo(()=>ot(e),[e]),qe=K.length>0,q=J.useMemo(()=>qe?[`All`,...K]:[],[qe,K]),Ye=q.length>0&&Fe<q.length?Fe:0,Xe=q[Ye],nt=Xe===`All`?void 0:Xe,rt=+!!qe,st=J.useMemo(()=>{let t=e;return S&&(t=e.filter(e=>{let t=ae(),n=T(e);return!!(t&&n===t||e.customTitle||pe(e.messages)||e.firstPrompt||e.customTitle)})),nt!==void 0&&(t=t.filter(e=>e.tag===nt)),D&&w&&(t=t.filter(e=>e.gitBranch===w)),k&&!O&&(t=t.filter(e=>e.projectPath===A)),t},[e,S,nt,D,w,k,O,A]),ct=J.useMemo(()=>{if(!B)return st;let e=B.toLowerCase();return st.filter(t=>{let n=M(t).toLowerCase(),r=(t.gitBranch||``).toLowerCase(),i=(t.tag||``).toLowerCase(),a=t.prNumber?`pr #${t.prNumber} ${t.prRepository||``}`.toLowerCase():``;return n.includes(e)||r.includes(e)||i.includes(e)||a.includes(e)})},[st,B]);J.useEffect(()=>{},[H,U,!1]),J.useEffect(()=>{He(null),We(!1)},[U,Ke,!1]);let{filteredLogs:lt,snippets:X}=J.useMemo(()=>{let e=new Map,t=ct;if(G&&U&&G.query===U){for(let t of G.results)if(t.searchableText){let n=$e(t.searchableText,U,ut);n&&e.set(t.log,n)}let n=new Set(t.map(e=>e.messages[0]?.uuid)),r=G.results.map(e=>e.log).filter(e=>!n.has(e.messages[0]?.uuid));t=[...t,...r]}return{filteredLogs:t,snippets:e}},[ct,G,U]),Z=J.useMemo(()=>I.status===`results`&&I.results.length>0?I.results:lt,[I,lt]),Q=Math.max(30,b-4),dt=J.useMemo(()=>{if(!S)return[];let e=at(Z);return Array.from(e.entries()).map(([e,t])=>{let n=t[0],r=Z.indexOf(n),i=X.get(n),a=i?Qe(i,C):null;if(t.length===1){let t=tt(n,{showProjectPath:_});return{id:`log:${e}:0`,value:{log:n,indexInFiltered:r},label:et(n,Q),description:a?`${t}\n ${a}`:t,dimDescription:!0}}let o=t.length-1,s=t.slice(1).map((t,n)=>{let r=Z.indexOf(t),i=X.get(t),a=i?Qe(i,C):null,o=tt(t,{isChild:!0,showProjectPath:_});return{id:`log:${e}:${n+1}`,value:{log:t,indexInFiltered:r},label:et(t,Q,{isChild:!0}),description:a?`${o}\n ${a}`:o,dimDescription:!0}}),c=tt(n,{showProjectPath:_});return{id:`group:${e}`,value:{log:n,indexInFiltered:r},label:et(n,Q,{isGroupHeader:!0,forkCount:o}),description:a?`${c}\n ${a}`:c,dimDescription:!0,children:s}})},[S,Z,Q,_,X,C]),ft=J.useMemo(()=>S?[]:Z.map((e,t)=>{let n=Ze(M(e)+(e.isSidechain?` (sidechain)`:``),Q),r=Ce(e),i=_&&e.projectPath?` · ${e.projectPath}`:``,a=X.get(e),o=a?Qe(a,C):null;return{label:n,description:o?`${r}${i}\n ${o}`:r+i,dimDescription:!0,value:t.toString()}}),[S,Z,C,Q,_,X]),$=N?.value.log??null,pt=()=>{if(!S||!$)return``;let e=T($);if(!e)return``;let t=Z.filter(t=>T(t)===e);if(!(t.length>1))return``;let n=xe.has(e);return t.indexOf($)>0||n?`← to collapse`:`→ to expand`},mt=J.useCallback(async()=>{let e=$?T($):void 0;if(!$||!e){F(`list`),j(``);return}ve.trim()&&(await ue(e,ve.trim(),$.fullPath),S&&p&&p()),F(`list`),j(``)},[$,ve,p,S]),ht=J.useCallback(()=>{F(`list`)},[]),gt=J.useCallback(()=>{F(`search`)},[]),_t=J.useCallback(async()=>{if(!B.trim()||!y||!0)return;ze.current?.abort();let t=new AbortController;ze.current=t,L({status:`searching`}),B.length;try{let n=await y(B,e,t.signal);if(t.signal.aborted)return;L({status:`results`,results:n,query:B}),B.length,n.length}catch(e){if(t.signal.aborted)return;L({status:`error`,message:e instanceof Error?e.message:`Search failed`}),B.length}},[B,y,!1,e]);J.useEffect(()=>{I.status!==`idle`&&I.status!==`searching`&&(I.status===`results`&&I.query!==B||I.status===`error`)&&L({status:`idle`})},[B,I]),J.useEffect(()=>()=>{ze.current?.abort()},[]);let vt=J.useRef(I.status);J.useEffect(()=>{let e=vt.current;if(vt.current=I.status,e===`searching`&&I.status===`results`){if(S&&dt.length>0)we(dt[0]);else if(!S&&Z.length>0){let e=Z[0];we({id:`0`,value:{log:e,indexInFiltered:0},label:``})}}},[I.status,S,dt,Z]);let yt=J.useCallback(e=>{let t=parseInt(e,10),n=Z[t];!n||Pe.current===t.toString()||(Pe.current=t.toString(),we({id:t.toString(),value:{log:n,indexInFiltered:t},label:``}),Ee(t+1))},[Z]),bt=J.useCallback(e=>{we(e);let t=Z.findIndex(t=>T(t)===T(e.value.log));t>=0&&Ee(t+1)},[Z]);l(`confirm:no`,()=>{ze.current?.abort(),L({status:`idle`})},{context:`Confirmation`,isActive:P!==`preview`&&I.status===`searching`}),l(`confirm:no`,()=>{F(`list`),j(``)},{context:`Settings`,isActive:P===`rename`&&I.status!==`searching`}),l(`confirm:no`,()=>{Be(``),z(!1),d?.()},{context:`Confirmation`,isActive:P!==`preview`&&P!==`rename`&&P!==`search`&&R&&I.status!==`searching`}),m((e,t)=>{if(P!==`preview`&&I.status!==`searching`&&P!==`rename`)if(P===`search`)e.toLowerCase()===`n`&&t.ctrl?ht():(t.return||t.downArrow)&&B.trim();else{if(R){if(t.return){_t(),z(!1);return}else if(t.downArrow){z(!1);return}else if(t.upArrow){F(`search`),z(!1);return}}if(qe&&t.tab){let e=t.shift?-1:1;Le(t=>{let n=((t<q.length?t:0)+q.length+e)%q.length;return q[n],K.length,n});return}let n=!t.ctrl&&!t.meta,r=e.toLowerCase();r===`a`&&t.ctrl&&v?v():r===`b`&&t.ctrl?fe(!D):r===`w`&&t.ctrl&&k?he(!O):r===`/`&&n?F(`search`):r===`r`&&t.ctrl&&$?(F(`rename`),j(``)):r===`v`&&t.ctrl&&$?(je($),F(`preview`),$.messageCount):$&&n&&e.length>0&&!/^\s+$/.test(e)&&(F(`search`),Be(e))}},{isActive:!0});let xt=[];D&&w&&xt.push(w),k&&!O&&xt.push(`current worktree`);let St=8+ +(xt.length>0&&P!==`search`)+rt,Ct=Math.max(1,Math.floor((t-St-2)/3));return J.useEffect(()=>{if(!h)return;let e=Ct*2;Te+e>=Z.length&&h(Ct*3)},[Te,Ct,Z.length,h]),e.length===0?null:P===`preview`&&ke&&S?(0,Y.jsx)(Re,{log:ke,onExit:()=>{F(`list`),je(null)},onSelect:f}):(0,Y.jsxs)(o,{flexDirection:`column`,height:t-1,children:[(0,Y.jsx)(o,{flexShrink:0,children:(0,Y.jsx)(n,{color:`suggestion`})}),(0,Y.jsx)(o,{flexShrink:0,children:(0,Y.jsx)(s,{children:` `})}),qe?(0,Y.jsx)(Ve,{tabs:q,selectedIndex:Ye,availableWidth:b,showAllProjects:_}):(0,Y.jsx)(o,{flexShrink:0,children:(0,Y.jsxs)(s,{bold:!0,color:`suggestion`,children:[`Resume Session`,P===`list`&&Z.length>Ct&&(0,Y.jsxs)(s,{dimColor:!0,children:[` `,`(`,Te,` of `,Z.length,`)`]})]})}),(0,Y.jsx)(ee,{query:B,isFocused:P===`search`,isTerminalFocused:se,cursorOffset:V}),xt.length>0&&P!==`search`&&(0,Y.jsx)(o,{flexShrink:0,paddingLeft:2,children:(0,Y.jsx)(s,{dimColor:!0,children:(0,Y.jsx)(c,{children:xt})})}),(0,Y.jsx)(o,{flexShrink:0,children:(0,Y.jsx)(s,{children:` `})}),I.status===`searching`&&(0,Y.jsxs)(o,{paddingLeft:1,flexShrink:0,children:[(0,Y.jsx)(Me,{}),(0,Y.jsx)(s,{children:` Searching…`})]}),I.status===`results`&&I.results.length>0&&(0,Y.jsx)(o,{paddingLeft:1,marginBottom:1,flexShrink:0,children:(0,Y.jsx)(s,{dimColor:!0,italic:!0,children:`Work Mate found these results:`})}),I.status===`results`&&I.results.length===0&&lt.length===0&&(0,Y.jsx)(o,{paddingLeft:1,marginBottom:1,flexShrink:0,children:(0,Y.jsx)(s,{dimColor:!0,italic:!0,children:`No matching sessions found.`})}),I.status===`error`&&lt.length===0&&(0,Y.jsx)(o,{paddingLeft:1,marginBottom:1,flexShrink:0,children:(0,Y.jsx)(s,{dimColor:!0,italic:!0,children:`No matching sessions found.`})}),!!B.trim()&&y&&!1,I.status===`searching`?null:P===`rename`&&$?(0,Y.jsxs)(o,{paddingLeft:2,flexDirection:`column`,children:[(0,Y.jsx)(s,{bold:!0,children:`Rename session:`}),(0,Y.jsx)(o,{paddingTop:1,children:(0,Y.jsx)(Oe,{value:ve,onChange:j,onSubmit:mt,placeholder:M($,`Enter new session name`),columns:b,cursorOffset:ye,onChangeCursorOffset:be,showCursor:!0})})]}):S?(0,Y.jsx)(Je,{nodes:dt,onSelect:e=>{f(e.value.log)},onFocus:bt,onCancel:d,focusNodeId:N?.id,visibleOptionCount:Ct,layout:`expanded`,isDisabled:P===`search`||R,hideIndexes:!1,isNodeExpanded:e=>{if(P===`search`||D)return!0;let t=typeof e==`string`&&e.startsWith(`group:`)?e.substring(6):null;return t?xe.has(t):!1},onExpand:e=>{let t=typeof e==`string`&&e.startsWith(`group:`)?e.substring(6):null;t&&Se(e=>new Set(e).add(t))},onCollapse:e=>{let t=typeof e==`string`&&e.startsWith(`group:`)?e.substring(6):null;t&&Se(e=>{let n=new Set(e);return n.delete(t),n})},onUpFromFirstItem:gt}):(0,Y.jsx)(Ae,{options:ft,onChange:e=>{let t=Z[parseInt(e,10)];t&&f(t)},visibleOptionCount:Ct,onCancel:d,onFocus:yt,defaultFocusValue:N?.id.toString(),layout:`expanded`,isDisabled:P===`search`||R,onUpFromFirstItem:gt}),(0,Y.jsx)(o,{paddingLeft:2,children:x.pending?(0,Y.jsxs)(s,{dimColor:!0,children:[`Press `,x.keyName,` again to exit`]}):P===`rename`?(0,Y.jsx)(s,{dimColor:!0,children:(0,Y.jsxs)(c,{children:[(0,Y.jsx)(r,{shortcut:`Enter`,action:`save`}),(0,Y.jsx)(E,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})]})}):I.status===`searching`?(0,Y.jsx)(s,{dimColor:!0,children:(0,Y.jsxs)(c,{children:[(0,Y.jsx)(s,{children:`Searching with Work Mate…`}),(0,Y.jsx)(E,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})]})}):R?(0,Y.jsx)(s,{dimColor:!0,children:(0,Y.jsxs)(c,{children:[(0,Y.jsx)(r,{shortcut:`Enter`,action:`search`}),(0,Y.jsx)(r,{shortcut:`↓`,action:`skip`}),(0,Y.jsx)(E,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})]})}):P===`search`?(0,Y.jsx)(s,{dimColor:!0,children:(0,Y.jsxs)(c,{children:[(0,Y.jsx)(s,{children:`Type to Search`}),(0,Y.jsx)(r,{shortcut:`Enter`,action:`select`}),(0,Y.jsx)(E,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`clear`})]})}):(0,Y.jsx)(s,{dimColor:!0,children:(0,Y.jsxs)(c,{children:[v&&(0,Y.jsx)(r,{shortcut:`Ctrl+A`,action:`show ${_?`current dir`:`all projects`}`}),w&&(0,Y.jsx)(r,{shortcut:`Ctrl+B`,action:`toggle branch`}),k&&(0,Y.jsx)(r,{shortcut:`Ctrl+W`,action:`show ${O?`current worktree`:`all worktrees`}`}),(0,Y.jsx)(r,{shortcut:`Ctrl+V`,action:`preview`}),(0,Y.jsx)(r,{shortcut:`Ctrl+R`,action:`rename`}),(0,Y.jsx)(s,{children:`Type to search`}),(0,Y.jsx)(E,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`}),pt()&&(0,Y.jsx)(s,{children:pt()})]})})})]})}function rt(e){if(e.type!==`user`&&e.type!==`assistant`)return``;let t=`message`in e?e.message?.content:void 0;return t?typeof t==`string`?t:Array.isArray(t)?t.map(e=>typeof e==`string`?e:`text`in e&&typeof e.text==`string`?e.text:``).filter(Boolean).join(` `):``:``}function it(e){let t=(e.messages.length<=lt?e.messages:[...e.messages.slice(0,X),...e.messages.slice(-1e3)]).map(rt).filter(Boolean).join(` `),n=`${[e.customTitle,e.summary,e.firstPrompt,e.gitBranch,e.tag,e.prNumber?`PR #${e.prNumber}`:void 0,e.prRepository].filter(Boolean).join(` `)} ${t}`.trim();return n.length>Z?n.slice(0,Z):n}function at(e){let t=new Map;for(let n of e){let e=T(n);if(e){let r=t.get(e);r?r.push(n):t.set(e,[n])}}return t.forEach(e=>e.sort((e,t)=>new Date(t.modified).getTime()-new Date(e.modified).getTime())),t}function ot(e){let t=new Set;for(let n of e)n.tag&&t.add(n.tag);return Array.from(t).sort((e,t)=>e.localeCompare(t))}var J,Y,st,ct,lt,X,Z,ut,Q=e((()=>{p(),J=t(d(),1),b(),P(),Le(),D(),g(),fe(),xe(),N(),le(),ie(),ye(),w(),Pe(),de(),ke(),Fe(),ze(),je(),qe(),F(),Xe(),Y=_(),st=2,ct=4,lt=2e3,X=1e3,Z=5e4,ut=50}));function dt(e){if(e.type!==`user`&&e.type!==`assistant`)return``;let t=`message`in e?e.message?.content:void 0;return t?typeof t==`string`?t:Array.isArray(t)?t.map(e=>typeof e==`string`?e:`text`in e&&typeof e.text==`string`?e.text:``).filter(Boolean).join(` `):``:``}function ft(e){if(e.length===0)return``;let t=(e.length<=ht?e:[...e.slice(0,ht/2),...e.slice(-100/2)]).map(dt).filter(Boolean).join(` `).replace(/\s+/g,` `).trim();return t.length>mt?`${t.slice(0,mt)}…`:t}function $(e,t){return!!(M(e).toLowerCase().includes(t)||e.customTitle?.toLowerCase().includes(t)||e.tag?.toLowerCase().includes(t)||e.gitBranch?.toLowerCase().includes(t)||e.summary?.toLowerCase().includes(t)||e.firstPrompt?.toLowerCase().includes(t)||e.messages&&e.messages.length>0&&ft(e.messages).toLowerCase().includes(t))}async function pt(e,t,n){if(!e.trim()||t.length===0)return[];let r=e.toLowerCase(),i=t.filter(e=>$(e,r)),a;if(i.length>=gt)a=i.slice(0,gt);else{let e=t.filter(e=>!$(e,r)),n=gt-i.length;a=[...i,...e.slice(0,n)]}A(`Agentic search: ${a.length}/${t.length} logs, query="${e}", matching: ${i.length}, with messages: ${y(a,e=>e.messages?.length>0)}`);let o=a.map(async e=>{if(C(e))try{return await se(e)}catch(t){return be(t),e}return e}),s=await Promise.all(o);A(`Agentic search: loaded ${y(s,e=>e.messages?.length>0)}/${a.length} logs with transcripts`);let c=`Sessions:
2
- ${s.map((e,t)=>{let n=[`${t}:`],r=M(e);if(n.push(r),e.customTitle&&e.customTitle!==r&&n.push(`[custom title: ${e.customTitle}]`),e.tag&&n.push(`[tag: ${e.tag}]`),e.gitBranch&&n.push(`[branch: ${e.gitBranch}]`),e.summary&&n.push(`- Summary: ${e.summary}`),e.firstPrompt&&e.firstPrompt!==`No prompt`&&n.push(`- First message: ${e.firstPrompt.slice(0,300)}`),e.messages&&e.messages.length>0){let t=ft(e.messages);t&&n.push(`- Transcript: ${t}`)}return n.join(` `)}).join(`
3
- `)}
4
-
5
- Search query: "${e}"
6
-
7
- Find the sessions that are most relevant to this query.`;A(`Agentic search prompt (first 500 chars): ${c.slice(0,500)}...`);try{let e=Ee();A(`Agentic search using model: ${e}`);let t=(await k({model:e,system:_t,messages:[{role:`user`,content:c}],signal:n,querySource:`session_search`})).content.find(e=>e.type===`text`);if(t?.type!==`text`)return A(`No text content in agentic search response`),[];A(`Agentic search response: ${t.text}`);let r=t.text.match(/\{[\s\S]*\}/);if(!r)return A(`Could not find JSON in agentic search response`),[];let i=(_e(r[0]).relevant_indices||[]).filter(e=>e>=0&&e<s.length).map(e=>s[e]);return A(`Agentic search found ${i.length} relevant sessions`),i}catch(e){return be(e),A(`Agentic search error: ${e}`),[]}}var mt,ht,gt,_t,vt=e((()=>{v(),ve(),ye(),Te(),w(),O(),j(),mt=2e3,ht=100,gt=100,_t=`Your goal is to find relevant sessions based on a user's search query.
8
-
9
- You will be given a list of sessions with their metadata and a search query. Identify which sessions are most relevant to the query.
10
-
11
- Each session may include:
12
- - Title (display name or custom title)
13
- - Tag (user-assigned category, shown as [tag: name] - users tag sessions with /tag command to categorize them)
14
- - Branch (git branch name, shown as [branch: name])
15
- - Summary (AI-generated summary)
16
- - First message (beginning of the conversation)
17
- - Transcript (excerpt of conversation content)
18
-
19
- IMPORTANT: Tags are user-assigned labels that indicate the session's topic or category. If the query matches a tag exactly or partially, those sessions should be highly prioritized.
20
-
21
- For each session, consider (in order of priority):
22
- 1. Exact tag matches (highest priority - user explicitly categorized this session)
23
- 2. Partial tag matches or tag-related terms
24
- 3. Title matches (custom titles or first message content)
25
- 4. Branch name matches
26
- 5. Summary and transcript content matches
27
- 6. Semantic similarity and related concepts
28
-
29
- CRITICAL: Be VERY inclusive in your matching. Include sessions that:
30
- - Contain the query term anywhere in any field
31
- - Are semantically related to the query (e.g., "testing" matches sessions about "tests", "unit tests", "QA", etc.)
32
- - Discuss topics that could be related to the query
33
- - Have transcripts that mention the concept even in passing
34
-
35
- When in doubt, INCLUDE the session. It's better to return too many results than too few. The user can easily scan through results, but missing relevant sessions is frustrating.
36
-
37
- Return sessions ordered by relevance (most relevant first). If truly no sessions have ANY connection to the query, return an empty array - but this should be rare.
38
-
39
- Respond with ONLY the JSON object, no markdown formatting:
40
- {"relevant_indices": [2, 5, 0]}`}));function yt(e,t){let n=oe();if(!t||!e.projectPath||e.projectPath===n)return{isCrossProject:!1};let r=T(e);return{isCrossProject:!0,isSameRepoWorktree:!1,command:`cd ${S([e.projectPath])} && claude --resume ${r}`,projectPath:e.projectPath}}var bt=e((()=>{b(),he(),w()}));export{nt as a,vt as i,bt as n,Q as o,pt as r,yt as t};
@@ -1 +0,0 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{t}from"./jsx-runtime-Bb4Xn-E0.js";import{n,t as r}from"./Doctor-CLOYkPRR.js";var i,a;e((()=>{n(),i=t(),a=(e,t,n)=>Promise.resolve((0,i.jsx)(r,{onDone:e}))}))();export{a as call};
@@ -1 +0,0 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{t}from"./jsx-runtime-Bb4Xn-E0.js";import{St as n,Xs as r,Zs as i,gi as a,mC as o,mi as s,pC as c,yt as l}from"./loadAgentsDir-uuZYOgKn.js";import{n as u,t as d}from"./ExitFlow-CATwJC4c.js";import{spawnSync as f}from"child_process";function p(){return o(g)??`Goodbye!`}async function m(e){if(i())return e(),f(`tmux`,[`detach-client`],{stdio:`ignore`}),null;let t=l()!==null;return t?(0,h.jsx)(d,{showWorktree:t,onDone:e,onCancel:()=>e()}):(e(p()),await s(0,`prompt_input_exit`),null)}var h,g;e((()=>{c(),u(),r(),a(),n(),h=t(),g=[`Goodbye!`,`See ya!`,`Bye!`,`Catch you later!`]}))();export{m as call};
@@ -1 +0,0 @@
1
- import{cc as e,dc as t,lc as n,uc as r}from"./loadAgentsDir-uuZYOgKn.js";t();export{e as drainPendingExtraction,n as executeExtractMemories,r as initExtractMemories};
@@ -1 +0,0 @@
1
- import{n as e,r as t,t as n}from"./fast-C5-lNCQi.js";t();export{n as FastModePicker,e as call};
@@ -1 +0,0 @@
1
- import{n as e,t}from"./fetchModelList-9w1E4Ue8.js";e();export{t as fetchAvailableModels};
@@ -1 +0,0 @@
1
- import{mn as e,on as t,qt as n}from"./loadAgentsDir-uuZYOgKn.js";e();export{n as executeSessionEndHooks,t as getSessionEndHookTimeoutMs};
@@ -1 +0,0 @@
1
- import{o as e,t}from"./loadAgentsDir-uuZYOgKn.js";e();export{t as clearAgentDefinitionsCache};
@@ -1 +0,0 @@
1
- import{c_ as e,s_ as t,u_ as n}from"./loadAgentsDir-uuZYOgKn.js";t();export{e as loadPluginHooks,n as setupPluginHookHotReload};
@@ -1 +0,0 @@
1
- import{a as e,o as t,s as n,t as r}from"./localSearch-yVCDrVrf.js";t();export{r as clearSkillIndexCache,e as getSkillIndex,n as searchSkills};
@@ -1 +0,0 @@
1
- import{r as e,t}from"./managedEnv-B8YWmM4A.js";e();export{t as applyConfigEnvironmentVariables};
@@ -1 +0,0 @@
1
- import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{n,t as r}from"./figures-5ThXQEtq.js";import{D as i,Gt as a,H as o,I as s,Lt as c,P as l,T as u,ai as d,j as f,t as p,y as m}from"./src-BX54x08P.js";import{t as h}from"./jsx-runtime-Bb4Xn-E0.js";import{$d as g,Bh as _,Jd as v,Vd as y,Vh as b,Xd as x,hd as S,md as C,tb as w,zh as T}from"./loadAgentsDir-uuZYOgKn.js";import{a as ee,i as E}from"./debug-2pVES-2G.js";import{l as te,n as D,o as O}from"./stringUtils-Cs6E5f-B.js";import{i as k,n as A,r as j}from"./MCPConnectionManager-CBY8nqdU.js";import{t as ne}from"./select-BuTJbu_Q.js";import{r as M,t as re}from"./Spinner-DOI8qqZi.js";import{t as ie}from"./CustomSelect-CYmc4vRh.js";import{n as ae,t as N}from"./McpParsingWarnings-Dj_Fu5o-.js";import{a as P,c as oe,i as se,n as ce,o as le,r as ue,s as F,t as I}from"./MCPToolListView-C7HT6rrl.js";function L({agentServer:e,onCancel:t}){let[n]=o();return(0,R.jsxs)(m,{title:`${D(String(e.name))} MCP Server`,subtitle:`agent-only`,onCancel:t,inputGuide:e=>e.pending?(0,R.jsxs)(l,{children:[`Press `,e.keyName,` again to exit`]}):(0,R.jsxs)(u,{children:[(0,R.jsx)(i,{shortcut:`↑↓`,action:`navigate`}),(0,R.jsx)(i,{shortcut:`Enter`,action:`confirm`}),(0,R.jsx)(C,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`})]}),children:[(0,R.jsxs)(s,{flexDirection:`column`,gap:0,children:[(0,R.jsxs)(s,{children:[(0,R.jsx)(l,{bold:!0,children:`Type: `}),(0,R.jsx)(l,{dimColor:!0,children:e.transport})]}),e.url&&(0,R.jsxs)(s,{children:[(0,R.jsx)(l,{bold:!0,children:`URL: `}),(0,R.jsx)(l,{dimColor:!0,children:e.url})]}),e.command&&(0,R.jsxs)(s,{children:[(0,R.jsx)(l,{bold:!0,children:`Command: `}),(0,R.jsx)(l,{dimColor:!0,children:e.command})]}),(0,R.jsxs)(s,{children:[(0,R.jsx)(l,{bold:!0,children:`Used by: `}),(0,R.jsx)(l,{dimColor:!0,children:e.sourceAgents.join(`, `)})]}),(0,R.jsxs)(s,{marginTop:1,children:[(0,R.jsx)(l,{bold:!0,children:`Status: `}),(0,R.jsxs)(l,{children:[f(`inactive`,n)(r.radioOff),` not connected (agent-only)`]})]})]}),(0,R.jsx)(s,{children:(0,R.jsx)(l,{dimColor:!0,children:`This server connects only when running the agent.`})}),(0,R.jsx)(s,{children:(0,R.jsx)(ne,{options:[{label:`Back`,value:`back`}],onChange:e=>{e===`back`&&t()},onCancel:t})})]})}var R,z=e((()=>{n(),p(),O(),S(),ie(),R=h()}));function B(e){switch(e){case`project`:return{label:`Project MCPs`,path:y(e)};case`user`:return{label:`User MCPs`,path:y(e)};case`local`:return{label:`Local MCPs`,path:y(e)};case`enterprise`:return{label:`Enterprise MCPs`};case`dynamic`:return{label:`Built-in MCPs`,path:`always available`};default:return{label:e}}}function V(e){let t=new Map;for(let n of e){let e=n.scope;t.has(e)||t.set(e,[]),t.get(e).push(n)}for(let[,e]of t)e.sort((e,t)=>e.name.localeCompare(t.name));return t}function H({servers:e,agentServers:t=[],onSelectServer:n,onSelectAgentServer:d,onComplete:p}){let[h]=o(),[g,_]=(0,U.useState)(0),v=U.useMemo(()=>V(e.filter(e=>e.client.config.type!==`claudeai-proxy`)),[e]),y=U.useMemo(()=>e.filter(e=>e.client.config.type===`claudeai-proxy`).sort((e,t)=>e.name.localeCompare(t.name)),[e]),b=U.useMemo(()=>(v.get(`dynamic`)??[]).sort((e,t)=>e.name.localeCompare(t.name)),[v]),x=B(`dynamic`),S=U.useMemo(()=>{let e=[];for(let t of G){let n=v.get(t)??[];for(let t of n)e.push({type:`server`,server:t})}for(let t of y)e.push({type:`server`,server:t});for(let n of t)e.push({type:`agent-server`,agentServer:n});for(let t of b)e.push({type:`server`,server:t});return e},[v,y,t,b]),w=(0,U.useCallback)(()=>{p(`MCP dialog dismissed`,{display:`system`})},[p]);a({"confirm:previous":()=>_(e=>e===0?S.length-1:e-1),"confirm:next":()=>_(e=>e===S.length-1?0:e+1),"confirm:yes":(0,U.useCallback)(()=>{let e=S[g];e&&(e.type===`server`?n(e.server):e.type===`agent-server`&&d&&d(e.agentServer))},[S,g,n,d]),"confirm:no":w},{context:`Confirmation`});let T=e=>S.findIndex(t=>t.type===`server`&&t.server===e),E=e=>S.findIndex(t=>t.type===`agent-server`&&t.agentServer===e),D=ee(),O=e.some(e=>e.client.type===`failed`);if(e.length===0&&t.length===0)return null;let k=e=>{let t=T(e),n=g===t,i=``,a=``;if(e.client.type===`disabled`)i=f(`inactive`,h)(r.radioOff),a=`disabled`;else if(e.client.type===`connected`)i=f(`success`,h)(r.tick),a=`connected`;else if(e.client.type===`pending`){i=f(`inactive`,h)(r.radioOff);let{reconnectAttempt:t,maxReconnectAttempts:n}=e.client;a=t&&n?`reconnecting (${t}/${n})…`:`connecting…`}else e.client.type===`needs-auth`?(i=f(`warning`,h)(r.triangleUpOutline),a=`needs authentication`):(i=f(`error`,h)(r.cross),a=`failed`);return(0,W.jsxs)(s,{children:[(0,W.jsx)(l,{color:n?`suggestion`:void 0,children:n?`${r.pointer} `:` `}),(0,W.jsx)(l,{color:n?`suggestion`:void 0,children:e.name}),(0,W.jsxs)(l,{dimColor:!n,children:[` · `,i,` `]}),(0,W.jsx)(l,{dimColor:!n,children:a})]},`${e.name}-${t}`)},A=e=>{let t=E(e),n=g===t,i=e.needsAuth?f(`warning`,h)(r.triangleUpOutline):f(`inactive`,h)(r.radioOff),a=e.needsAuth?`may need auth`:`agent-only`;return(0,W.jsxs)(s,{children:[(0,W.jsx)(l,{color:n?`suggestion`:void 0,children:n?`${r.pointer} `:` `}),(0,W.jsx)(l,{color:n?`suggestion`:void 0,children:e.name}),(0,W.jsxs)(l,{dimColor:!n,children:[` · `,i,` `]}),(0,W.jsx)(l,{dimColor:!n,children:a})]},`agent-${e.name}-${t}`)},j=e.length+t.length;return(0,W.jsxs)(s,{flexDirection:`column`,children:[(0,W.jsx)(N,{}),(0,W.jsx)(m,{title:`Manage MCP servers`,subtitle:`${j} ${te(j,`server`)}`,onCancel:w,hideInputGuide:!0,children:(0,W.jsxs)(s,{flexDirection:`column`,children:[G.map(e=>{let t=v.get(e);if(!t||t.length===0)return null;let n=B(e);return(0,W.jsxs)(s,{flexDirection:`column`,marginBottom:1,children:[(0,W.jsxs)(s,{paddingLeft:2,children:[(0,W.jsx)(l,{bold:!0,children:n.label}),n.path&&(0,W.jsxs)(l,{dimColor:!0,children:[` (`,n.path,`)`]})]}),t.map(e=>k(e))]},e)}),y.length>0&&(0,W.jsxs)(s,{flexDirection:`column`,marginBottom:1,children:[(0,W.jsx)(s,{paddingLeft:2,children:(0,W.jsx)(l,{bold:!0,children:`claude.ai`})}),y.map(e=>k(e))]}),t.length>0&&(0,W.jsxs)(s,{flexDirection:`column`,marginBottom:1,children:[(0,W.jsx)(s,{paddingLeft:2,children:(0,W.jsx)(l,{bold:!0,children:`Agent MCPs`})}),[...new Set(t.flatMap(e=>e.sourceAgents))].map(e=>(0,W.jsxs)(s,{flexDirection:`column`,marginTop:1,children:[(0,W.jsx)(s,{paddingLeft:2,children:(0,W.jsxs)(l,{dimColor:!0,children:[`@`,e]})}),t.filter(t=>t.sourceAgents.includes(e)).map(e=>A(e))]},e))]}),b.length>0&&(0,W.jsxs)(s,{flexDirection:`column`,marginBottom:1,children:[(0,W.jsxs)(s,{paddingLeft:2,children:[(0,W.jsx)(l,{bold:!0,children:x.label}),x.path&&(0,W.jsxs)(l,{dimColor:!0,children:[` (`,x.path,`)`]})]}),b.map(e=>k(e))]}),(0,W.jsxs)(s,{flexDirection:`column`,children:[O&&(0,W.jsx)(l,{dimColor:!0,children:D?`※ Error logs shown inline with --debug`:`※ Run claude --debug to see error logs`}),(0,W.jsxs)(l,{dimColor:!0,children:[(0,W.jsx)(c,{url:`https://code.workmate.com/docs/en/mcp`,children:`https://code.workmate.com/docs/en/mcp`}),` for help`]})]})]})}),(0,W.jsx)(s,{paddingX:1,children:(0,W.jsx)(l,{dimColor:!0,italic:!0,children:(0,W.jsxs)(u,{children:[(0,W.jsx)(i,{shortcut:`↑↓`,action:`navigate`}),(0,W.jsx)(i,{shortcut:`Enter`,action:`confirm`}),(0,W.jsx)(C,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})]})})})]})}var U,W,G,de=e((()=>{n(),U=t(d(),1),p(),w(),g(),E(),O(),S(),ae(),W=h(),G=[`project`,`local`,`user`,`enterprise`]}));function K({onComplete:e}){let t=_(e=>e.mcp),n=_(e=>e.agentDefinitions),r=t.clients,[i,a]=q.useState({type:`list`}),[o,s]=q.useState([]),c=(0,q.useMemo)(()=>v(n.allAgents),[n.allAgents]),l=q.useMemo(()=>r.filter(e=>e.name!==`ide`).sort((e,t)=>e.name.localeCompare(t.name)),[r]);switch(q.useEffect(()=>{let e=!1;async function n(){let n=await Promise.all(l.map(async e=>{let n=e.config.scope,r=e.config.type===`sse`,i=e.config.type===`http`,a=e.config.type===`claudeai-proxy`,o;(r||i)&&(o=e.type===`connected`&&x(t.tools,e.name).length>0);let s={name:e.name,client:e,scope:n};return a?{...s,transport:`claudeai-proxy`,isAuthenticated:!1,config:e.config}:r?{...s,transport:`sse`,isAuthenticated:o,config:e.config}:i?{...s,transport:`http`,isAuthenticated:o,config:e.config}:{...s,transport:`stdio`,config:e.config}}));e||s(n)}return n(),()=>{e=!0}},[l,t.tools]),(0,q.useEffect)(()=>{o.length===0&&l.length>0||o.length===0&&c.length===0&&e("No MCP servers configured. Please run /doctor if this is unexpected. Otherwise, run `claude mcp --help` or visit https://code.workmate.com/docs/en/mcp to learn more.")},[o.length,l.length,c.length,e]),i.type){case`list`:return(0,J.jsx)(H,{servers:o,agentServers:c,onSelectServer:e=>a({type:`server-menu`,server:e}),onSelectAgentServer:e=>a({type:`agent-server-menu`,agentServer:e}),onComplete:e,defaultTab:i.defaultTab});case`server-menu`:{let n=x(t.tools,i.server.name),r=i.server.transport===`claudeai-proxy`?`claude.ai`:`Work Mate`;return i.server.transport===`stdio`?(0,J.jsx)(P,{server:i.server,serverToolsCount:n.length,onViewTools:()=>a({type:`server-tools`,server:i.server}),onCancel:()=>a({type:`list`,defaultTab:r}),onComplete:e}):(0,J.jsx)(F,{server:i.server,serverToolsCount:n.length,onViewTools:()=>a({type:`server-tools`,server:i.server}),onCancel:()=>a({type:`list`,defaultTab:r}),onComplete:e})}case`server-tools`:return(0,J.jsx)(I,{server:i.server,onSelectTool:(e,t)=>a({type:`server-tool-detail`,server:i.server,toolIndex:t}),onBack:()=>a({type:`server-menu`,server:i.server})});case`server-tool-detail`:{let e=x(t.tools,i.server.name)[i.toolIndex];return e?(0,J.jsx)(ue,{tool:e,server:i.server,onBack:()=>a({type:`server-tools`,server:i.server})}):(a({type:`server-tools`,server:i.server}),null)}case`agent-server-menu`:return(0,J.jsx)(L,{agentServer:i.agentServer,onCancel:()=>a({type:`list`,defaultTab:`Agents`}),onComplete:e})}}var q,J,fe=e((()=>{q=t(d(),1),g(),T(),z(),de(),oe(),le(),se(),ce(),J=h()})),pe=e((()=>{fe()}));function me({serverName:e,onComplete:t}){let[n]=o(),i=b(),a=j(),[c,u]=(0,Y.useState)(!0),[d,p]=(0,Y.useState)(null);return(0,Y.useEffect)(()=>{async function n(){try{if(!i.getState().mcp.clients.find(t=>t.name===e)){p(`MCP server "${e}" not found`),u(!1),t(`MCP server "${e}" not found`);return}switch((await a(e)).client.type){case`connected`:u(!1),t(`Successfully reconnected to ${e}`);break;case`needs-auth`:p(`${e} requires authentication`),u(!1),t(`${e} requires authentication.`);break;case`pending`:case`failed`:case`disabled`:p(`Failed to reconnect to ${e}`),u(!1),t(`Failed to reconnect to ${e}`);break}}catch(e){let n=e instanceof Error?e.message:String(e);p(n),u(!1),t(`Error: ${n}`)}}n()},[e,a,i,t]),c?(0,X.jsxs)(s,{flexDirection:`column`,gap:1,padding:1,children:[(0,X.jsxs)(l,{color:`text`,children:[`Reconnecting to `,(0,X.jsx)(l,{bold:!0,children:e})]}),(0,X.jsxs)(s,{children:[(0,X.jsx)(re,{}),(0,X.jsx)(l,{children:` Establishing connection to MCP server`})]})]}):d?(0,X.jsxs)(s,{flexDirection:`column`,gap:1,padding:1,children:[(0,X.jsxs)(s,{children:[(0,X.jsxs)(l,{children:[f(`error`,n)(r.cross),` `]}),(0,X.jsxs)(l,{color:`error`,children:[`Failed to reconnect to `,e]})]}),(0,X.jsxs)(l,{dimColor:!0,children:[`Error: `,d]})]}):null}var Y,X,Z=e((()=>{n(),Y=t(d(),1),p(),A(),T(),M(),X=h()}));function he({action:e,target:t,onComplete:n}){let r=_(e=>e.mcp.clients),i=k(),a=(0,Q.useRef)(!1);return(0,Q.useEffect)(()=>{if(a.current)return;a.current=!0;let o=e===`enable`,s=r.filter(e=>e.name!==`ide`),c=t===`all`?s.filter(e=>o?e.type===`disabled`:e.type!==`disabled`):s.filter(e=>e.name===t);if(c.length===0){n(t===`all`?`All MCP servers are already ${o?`enabled`:`disabled`}`:`MCP server "${t}" not found`);return}for(let e of c)i(e.name);n(t===`all`?`${o?`Enabled`:`Disabled`} ${c.length} MCP server(s)`:`MCP server "${t}" ${o?`enabled`:`disabled`}`)},[e,t,r,i,n]),null}async function ge(e,t,n){if(n){let t=n.trim().split(/\s+/);if(t[0]===`no-redirect`)return(0,$.jsx)(K,{onComplete:e});if(t[0]===`reconnect`&&t[1])return(0,$.jsx)(me,{serverName:t.slice(1).join(` `),onComplete:e});if(t[0]===`enable`||t[0]===`disable`)return(0,$.jsx)(he,{action:t[0],target:t.length>1?t.slice(1).join(` `):`all`,onComplete:e})}return(0,$.jsx)(K,{onComplete:e})}var Q,$;e((()=>{Q=t(d(),1),pe(),Z(),A(),T(),$=h()}))();export{ge as call};
@@ -1,2 +0,0 @@
1
- import{$f as e,Af as t,B as n,Bf as r,Bv as i,D_ as a,Dc as o,Ds as s,E_ as c,Ec as l,Ff as u,Gv as d,Gx as f,Hf as p,If as m,Jf as h,Ji as g,Kf as _,Lf as v,Mf as ee,Nf as te,Os as ne,Pf as y,Qf as b,Rf as x,Uf as S,V as C,Vf as w,Wf as T,Wv as E,Xf as D,Yf as O,Zf as k,ap as A,bb as j,bl as M,cp as N,dp as P,ep as F,fp as I,jf as L,kf as re,lp as R,np as z,op as B,tp as V,up as H,xb as U,xl as W,zf as G,zv as K}from"./loadAgentsDir-uuZYOgKn.js";import{C as q,x as J}from"./debug-2pVES-2G.js";import{o as Y,s as X}from"./log-L1kqxa_P.js";import{f as Z,s as ie}from"./model-CcHyMyBv.js";import{_n as Q,gn as ae,vn as oe}from"./prompt-BfXryFt-.js";import $ from"node:process";H(),x(),m(),N();var se=class{constructor(e){this._server=e}requestStream(e,t,n){return this._server.requestStream(e,t,n)}createMessageStream(e,t){let n=this._server.getClientCapabilities();if((e.tools||e.toolChoice)&&!n?.sampling?.tools)throw Error(`Client does not support sampling tools capability.`);if(e.messages.length>0){let t=e.messages[e.messages.length-1],n=Array.isArray(t.content)?t.content:[t.content],r=n.some(e=>e.type===`tool_result`),i=e.messages.length>1?e.messages[e.messages.length-2]:void 0,a=i?Array.isArray(i.content)?i.content:[i.content]:[],o=a.some(e=>e.type===`tool_use`);if(r){if(n.some(e=>e.type!==`tool_result`))throw Error(`The last message must contain only tool_result content if any is present`);if(!o)throw Error(`tool_result blocks are not matching any tool_use from the previous message`)}if(o){let e=new Set(a.filter(e=>e.type===`tool_use`).map(e=>e.id)),t=new Set(n.filter(e=>e.type===`tool_result`).map(e=>e.toolUseId));if(e.size!==t.size||![...e].every(e=>t.has(e)))throw Error(`ids of tool_result blocks and tool_use blocks from previous message do not match`)}}return this.requestStream({method:`sampling/createMessage`,params:e},p,t)}elicitInputStream(e,t){let n=this._server.getClientCapabilities(),r=e.mode??`form`;switch(r){case`url`:if(!n?.elicitation?.url)throw Error(`Client does not support url elicitation.`);break;case`form`:if(!n?.elicitation?.form)throw Error(`Client does not support form elicitation.`);break}let i=r===`form`&&e.mode===void 0?{...e,mode:`form`}:e;return this.requestStream({method:`elicitation/create`,params:i},_,t)}async getTask(e,t){return this._server.getTask({taskId:e},t)}async getTaskResult(e,t,n){return this._server.getTaskResult({taskId:e},t,n)}async listTasks(e,t){return this._server.listTasks(e?{cursor:e}:void 0,t)}async cancelTask(e,t){return this._server.cancelTask({taskId:e},t)}};N(),y();var ce=class extends v{constructor(e,t){super(t),this._serverInfo=e,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(V.options.map((e,t)=>[e,t])),this.isMessageIgnored=(e,t)=>{let n=this._loggingLevels.get(t);return n?this.LOG_LEVEL_SEVERITY.get(e)<this.LOG_LEVEL_SEVERITY.get(n):!1},this._capabilities=t?.capabilities??{},this._instructions=t?.instructions,this._jsonSchemaValidator=t?.jsonSchemaValidator??new u,this.setRequestHandler(D,e=>this._oninitialize(e)),this.setNotificationHandler(k,()=>this.oninitialized?.()),this._capabilities.logging&&this.setRequestHandler(B,async(e,t)=>{let n=t.sessionId||t.requestInfo?.headers[`mcp-session-id`]||void 0,{level:r}=e.params,i=V.safeParse(r);return i.success&&this._loggingLevels.set(n,i.data),{}})}get experimental(){return this._experimental||(this._experimental={tasks:new se(this)}),this._experimental}registerCapabilities(e){if(this.transport)throw Error(`Cannot register capabilities after connecting to transport`);this._capabilities=G(this._capabilities,e)}setRequestHandler(e,t){let n=R(e)?.method;if(!n)throw Error(`Schema is missing a method literal`);let i;if(P(n)){let e=n;i=e._zod?.def?.value??e.value}else{let e=n;i=e._def?.value??e.value}if(typeof i!=`string`)throw Error(`Schema method literal must be a string`);return i===`tools/call`?super.setRequestHandler(e,async(e,n)=>{let i=I(r,e);if(!i.success){let e=i.error instanceof Error?i.error.message:String(i.error);throw new z(O.InvalidParams,`Invalid tools/call request: ${e}`)}let{params:a}=i.data,o=await Promise.resolve(t(e,n));if(a.task){let e=I(T,o);if(!e.success){let t=e.error instanceof Error?e.error.message:String(e.error);throw new z(O.InvalidParams,`Invalid task creation result: ${t}`)}return e.data}let s=I(w,o);if(!s.success){let e=s.error instanceof Error?s.error.message:String(s.error);throw new z(O.InvalidParams,`Invalid tools/call result: ${e}`)}return s.data}):super.setRequestHandler(e,t)}assertCapabilityForMethod(e){switch(e){case`sampling/createMessage`:if(!this._clientCapabilities?.sampling)throw Error(`Client does not support sampling (required for ${e})`);break;case`elicitation/create`:if(!this._clientCapabilities?.elicitation)throw Error(`Client does not support elicitation (required for ${e})`);break;case`roots/list`:if(!this._clientCapabilities?.roots)throw Error(`Client does not support listing roots (required for ${e})`);break;case`ping`:break}}assertNotificationCapability(e){switch(e){case`notifications/message`:if(!this._capabilities.logging)throw Error(`Server does not support logging (required for ${e})`);break;case`notifications/resources/updated`:case`notifications/resources/list_changed`:if(!this._capabilities.resources)throw Error(`Server does not support notifying about resources (required for ${e})`);break;case`notifications/tools/list_changed`:if(!this._capabilities.tools)throw Error(`Server does not support notifying of tool list changes (required for ${e})`);break;case`notifications/prompts/list_changed`:if(!this._capabilities.prompts)throw Error(`Server does not support notifying of prompt list changes (required for ${e})`);break;case`notifications/elicitation/complete`:if(!this._clientCapabilities?.elicitation?.url)throw Error(`Client does not support URL elicitation (required for ${e})`);break;case`notifications/cancelled`:break;case`notifications/progress`:break}}assertRequestHandlerCapability(e){if(this._capabilities)switch(e){case`completion/complete`:if(!this._capabilities.completions)throw Error(`Server does not support completions (required for ${e})`);break;case`logging/setLevel`:if(!this._capabilities.logging)throw Error(`Server does not support logging (required for ${e})`);break;case`prompts/get`:case`prompts/list`:if(!this._capabilities.prompts)throw Error(`Server does not support prompts (required for ${e})`);break;case`resources/list`:case`resources/templates/list`:case`resources/read`:if(!this._capabilities.resources)throw Error(`Server does not support resources (required for ${e})`);break;case`tools/call`:case`tools/list`:if(!this._capabilities.tools)throw Error(`Server does not support tools (required for ${e})`);break;case`tasks/get`:case`tasks/list`:case`tasks/result`:case`tasks/cancel`:if(!this._capabilities.tasks)throw Error(`Server does not support tasks capability (required for ${e})`);break;case`ping`:case`initialize`:break}}assertTaskCapability(e){ee(this._clientCapabilities?.tasks?.requests,e,`Client`)}assertTaskHandlerCapability(e){this._capabilities&&te(this._capabilities.tasks?.requests,e,`Server`)}async _oninitialize(e){let t=e.params.protocolVersion;return this._clientCapabilities=e.params.capabilities,this._clientVersion=e.params.clientInfo,{protocolVersion:A.includes(t)?t:b,capabilities:this.getCapabilities(),serverInfo:this._serverInfo,...this._instructions&&{instructions:this._instructions}}}getClientCapabilities(){return this._clientCapabilities}getClientVersion(){return this._clientVersion}getCapabilities(){return this._capabilities}async ping(){return this.request({method:`ping`},h)}async createMessage(e,t){if((e.tools||e.toolChoice)&&!this._clientCapabilities?.sampling?.tools)throw Error(`Client does not support sampling tools capability.`);if(e.messages.length>0){let t=e.messages[e.messages.length-1],n=Array.isArray(t.content)?t.content:[t.content],r=n.some(e=>e.type===`tool_result`),i=e.messages.length>1?e.messages[e.messages.length-2]:void 0,a=i?Array.isArray(i.content)?i.content:[i.content]:[],o=a.some(e=>e.type===`tool_use`);if(r){if(n.some(e=>e.type!==`tool_result`))throw Error(`The last message must contain only tool_result content if any is present`);if(!o)throw Error(`tool_result blocks are not matching any tool_use from the previous message`)}if(o){let e=new Set(a.filter(e=>e.type===`tool_use`).map(e=>e.id)),t=new Set(n.filter(e=>e.type===`tool_result`).map(e=>e.toolUseId));if(e.size!==t.size||![...e].every(e=>t.has(e)))throw Error(`ids of tool_result blocks and tool_use blocks from previous message do not match`)}}return e.tools?this.request({method:`sampling/createMessage`,params:e},S,t):this.request({method:`sampling/createMessage`,params:e},p,t)}async elicitInput(e,t){switch(e.mode??`form`){case`url`:{if(!this._clientCapabilities?.elicitation?.url)throw Error(`Client does not support url elicitation.`);let n=e;return this.request({method:`elicitation/create`,params:n},_,t)}case`form`:{if(!this._clientCapabilities?.elicitation?.form)throw Error(`Client does not support form elicitation.`);let n=e.mode===`form`?e:{...e,mode:`form`},r=await this.request({method:`elicitation/create`,params:n},_,t);if(r.action===`accept`&&r.content&&n.requestedSchema)try{let e=this._jsonSchemaValidator.getValidator(n.requestedSchema)(r.content);if(!e.valid)throw new z(O.InvalidParams,`Elicitation response content does not match requested schema: ${e.errorMessage}`)}catch(e){throw e instanceof z?e:new z(O.InternalError,`Error validating elicitation response: ${e instanceof Error?e.message:String(e)}`)}return r}}}createElicitationCompletionNotifier(e,t){if(!this._clientCapabilities?.elicitation?.url)throw Error(`Client does not support URL elicitation (required for notifications/elicitation/complete)`);return()=>this.notification({method:`notifications/elicitation/complete`,params:{elicitationId:e}},t)}async listRoots(t,n){return this.request({method:`roots/list`,params:t},e,n)}async sendLoggingMessage(e,t){if(this._capabilities.logging&&!this.isMessageIgnored(e.level,t))return this.notification({method:`notifications/message`,params:e})}async sendResourceUpdated(e){return this.notification({method:`notifications/resources/updated`,params:e})}async sendResourceListChanged(){return this.notification({method:`notifications/resources/list_changed`})}async sendToolListChanged(){return this.notification({method:`notifications/tools/list_changed`})}async sendPromptListChanged(){return this.notification({method:`notifications/prompts/list_changed`})}};t();var le=class{constructor(e=$.stdin,t=$.stdout){this._stdin=e,this._stdout=t,this._readBuffer=new re,this._started=!1,this._ondata=e=>{this._readBuffer.append(e),this.processReadBuffer()},this._onerror=e=>{this.onerror?.(e)}}async start(){if(this._started)throw Error(`StdioServerTransport already started! If using Server class, note that connect() calls start() automatically.`);this._started=!0,this._stdin.on(`data`,this._ondata),this._stdin.on(`error`,this._onerror)}processReadBuffer(){for(;;)try{let e=this._readBuffer.readMessage();if(e===null)break;this.onmessage?.(e)}catch(e){this.onerror?.(e)}}async close(){this._stdin.off(`data`,this._ondata),this._stdin.off(`error`,this._onerror),this._stdin.listenerCount(`data`)===0&&this._stdin.pause(),this._readBuffer.clear(),this.onclose?.()}send(e){return new Promise(t=>{let n=L(e);this._stdout.write(n)?t():this._stdout.once(`drain`,t)})}};N(),ne(),oe(),o(),i(),d(),Y(),g(),Z(),C(),j(),J(),W(),c();var ue=[];async function de(e,t,i){let o=E(100);U(e);let c=new ce({name:`workmate/tengu`,version:`0.0.27`},{capabilities:{tools:{}}});c.setRequestHandler(F,async()=>{let e=Q(),t=l(e);return{tools:await Promise.all(t.map(async n=>{let r;if(n.outputSchema){let e=a(n.outputSchema);typeof e==`object`&&e&&`type`in e&&e.type===`object`&&(r=e)}return{...n,description:await n.prompt({getToolPermissionContext:async()=>e,tools:t,agents:[]}),inputSchema:a(n.inputSchema),outputSchema:r}}))}}),c.setRequestHandler(r,async({params:{name:e,arguments:r}})=>{let a=l(Q()),c=ae(a,e);if(!c)throw Error(`Tool ${e} not found`);let u={abortController:K(),options:{commands:ue,tools:a,mainLoopModel:ie(),thinkingConfig:{type:`disabled`},mcpClients:[],mcpResources:{},isNonInteractiveSession:!0,debug:t,verbose:i,agentDefinitions:{activeAgents:[],allAgents:[]}},getAppState:()=>s(),setAppState:()=>{},messages:[],readFileState:o,setInProgressToolUseIDs:()=>{},setResponseLength:()=>{},updateFileHistoryState:()=>{},updateAttributionState:()=>{}};try{if(!c.isEnabled())throw Error(`Tool ${e} is not enabled`);let t=await c.validateInput?.(r??{},u);if(t&&!t.result)throw Error(`Tool ${e} input is invalid: ${`message`in t?t.message:String(t)}`);let i=await c.call(r??{},u,n,f({content:[]}));return{content:[{type:`text`,text:typeof i==`string`?i:q(i.data)}]}}catch(e){return X(e),{isError:!0,content:[{type:`text`,text:(e instanceof Error?M(e):[String(e)]).filter(Boolean).join(`
2
- `).trim()||`Error`}]}}});async function u(){let e=new le;await c.connect(e)}return await u()}export{de as startMCPServer};
@@ -1 +0,0 @@
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{I as i,Lt as a,P as o,Wt as s,_ as c,ai as l,di as ee,fi as u,t as d,y as f}from"./src-BX54x08P.js";import{t as p}from"./jsx-runtime-Bb4Xn-E0.js";import{In as m,Nn as te,m as h,qr as g,y as _,zr as v}from"./settings-D4M13toi.js";import{Pt as y,q as b}from"./state-CXY-q5gr.js";import{Bh as x,Dy as S,Kl as C,dw as w,fc as T,ky as E,pc as ne,pw as D,ql as re,tb as O,wy as k,xu as ie,yu as A,zh as j}from"./loadAgentsDir-uuZYOgKn.js";import{n as M,t as N}from"./cwd-DrEEb4f5.js";import{I as P,N as F}from"./debug-2pVES-2G.js";import{C as I,T as L,b as ae}from"./config-BDn2YIjC.js";import{o as R,s as oe}from"./log-L1kqxa_P.js";import{n as se}from"./analytics-COpjZpvd.js";import{_ as ce,p as z}from"./startupProfiler-B9Qv2QGH.js";import{n as B,t as V}from"./useExitOnCtrlCDWithKeybindings-ClN4NJnB.js";import{t as H}from"./select-BuTJbu_Q.js";import{r as U,t as W}from"./promptEditor-14TB3MYt.js";import{t as le}from"./CustomSelect-CYmc4vRh.js";import{homedir as ue}from"os";import{join as G,relative as de}from"path";import{mkdir as K,writeFile as fe}from"fs/promises";function pe(e){return v(e)!==null}var me=e((()=>{g()}));function he({onSelect:e,onCancel:t}){let r=(0,q.use)(S()),a=G(n(),`AGENTS.md`),l=G(b(),`AGENTS.md`),u=r.some(e=>e.path===a),d=r.some(e=>e.path===l),f=[...r.filter(e=>e.type!==`AutoMem`).map(e=>({...e,exists:!0})),...u?[]:[{path:a,type:`User`,content:``,exists:!1}],...d?[]:[{path:l,type:`Project`,content:``,exists:!1}]],p=new Map,m=f.map(e=>{let t=te(e.path),n=e.exists?``:` (new)`,r=e.parent?(p.get(e.parent)??0)+1:0;p.set(e.path,r);let i=r>0?` `.repeat(r-1):``,o;o=e.type===`User`&&!e.isNested&&e.path===a?`User memory`:e.type===`Project`&&!e.isNested&&e.path===l?`Project memory`:r>0?`${i}L ${t}${n}`:`${t}`;let s,c=pe(b());return s=e.type===`User`&&!e.isNested?`Saved in ~/.workmate/AGENTS.md`:e.type===`Project`&&!e.isNested&&e.path===l?`${c?`Checked in at`:`Saved in`} ./AGENTS.md`:e.parent?`@-imported`:e.isNested?`dynamically loaded`:``,{label:o,value:e.path,description:s}}),h=[],g=x(e=>e.agentDefinitions);if(L()){h.push({label:`Open auto-memory folder`,value:`${X}${ae()}`,description:``});for(let e of g.activeAgents)if(e.memory){let t=w(e.agentType,e.memory);h.push({label:`Open ${ee.bold(e.agentType)} agent memory`,value:`${X}${t}`,description:`${e.memory} scope`})}}m.push(...h);let v=Y&&m.some(e=>e.value===Y)?Y:m[0]?.value||``,[y,C]=(0,q.useState)(L),[T,E]=(0,q.useState)(ne),[D]=(0,q.useState)(L),O=x(e=>Object.values(e.tasks).some(e=>e.type===`dream`&&e.status===`running`)),[k,A]=(0,q.useState)(null);(0,q.useEffect)(()=>{D&&re().then(A)},[D,O]);let j=O?`running`:k===null?``:k===0?`never`:`last ran ${z(new Date(k))}`,[M,N]=(0,q.useState)(null),P=M!==null,F=+!!D;function I(){let e=!y;_(`userSettings`,{autoMemoryEnabled:e}),C(e)}function R(){let e=!T;_(`userSettings`,{autoDreamEnabled:e}),E(e)}return B(),s(`confirm:no`,t,{context:`Confirmation`}),s(`confirm:yes`,()=>{M===0?I():M===1&&R()},{context:`Confirmation`,isActive:P}),s(`select:next`,()=>{N(e=>e!==null&&e<F?e+1:null)},{context:`Select`,isActive:P}),s(`select:previous`,()=>{N(e=>e!==null&&e>0?e-1:e)},{context:`Select`,isActive:P}),(0,J.jsxs)(i,{flexDirection:`column`,width:`100%`,children:[(0,J.jsxs)(i,{flexDirection:`column`,marginBottom:1,children:[(0,J.jsx)(c,{isFocused:M===0,children:(0,J.jsxs)(o,{children:[`Auto-memory: `,y?`on`:`off`]})}),D&&(0,J.jsx)(c,{isFocused:M===1,styled:!1,children:(0,J.jsxs)(o,{color:M===1?`suggestion`:void 0,children:[`Auto-dream: `,T?`on`:`off`,j&&(0,J.jsxs)(o,{dimColor:!0,children:[` · `,j]}),!O&&T&&(0,J.jsx)(o,{dimColor:!0,children:` · /dream to run`})]})})]}),(0,J.jsx)(H,{defaultFocusValue:v,options:m,isDisabled:P,onChange:t=>{if(t.startsWith(X)){let e=t.slice(15);K(e,{recursive:!0}).catch(()=>{}).then(()=>ie(e));return}Y=t,e(t)},onCancel:t,onUpFromFirstItem:()=>N(F)})]})}var q,J,Y,X,ge=e((()=>{u(),q=t(l(),1),y(),V(),d(),O(),I(),se(),T(),C(),j(),D(),A(),E(),r(),m(),ce(),me(),h(),le(),J=p(),X=`__open_folder__`}));function _e(e){let t=ue(),n=N(),r=e.startsWith(t)?`~${e.slice(t.length)}`:null,i=e.startsWith(n)?`./${de(n,e)}`:null;return r&&i?r.length<=i.length?r:i:r||i||e}var ve=e((()=>{d(),M(),p()}));function ye({onDone:e}){let t=async t=>{try{t.includes(n())&&await K(n(),{recursive:!0});try{await fe(t,``,{encoding:`utf8`,flag:`wx`})}catch(e){if(F(e)!==`EEXIST`)throw e}await W(t);let r=`default`,i=``;process.env.VISUAL?(r=`$VISUAL`,i=process.env.VISUAL):process.env.EDITOR&&(r=`$EDITOR`,i=process.env.EDITOR);let a=r==="default"?``:`Using ${r}="${i}".`,o=a?`> ${a} To change editor, set $EDITOR or $VISUAL environment variable.`:`> To use a different editor, set the $EDITOR or $VISUAL environment variable.`;e(`Opened memory file at ${_e(t)}\n\n${o}`,{display:`system`})}catch(t){oe(t),e(`Error opening memory file: ${t}`)}},r=()=>{e(`Cancelled memory editing`,{display:`system`})};return(0,Q.jsx)(f,{title:`Memory`,onCancel:r,color:`remember`,children:(0,Q.jsxs)(i,{flexDirection:`column`,children:[(0,Q.jsx)(Z.Suspense,{fallback:null,children:(0,Q.jsx)(he,{onSelect:t,onCancel:r})}),(0,Q.jsx)(i,{marginTop:1,children:(0,Q.jsxs)(o,{dimColor:!0,children:[`Learn more: `,(0,Q.jsx)(a,{url:`https://code.workmate.com/docs/en/memory`})]})})]})})}var Z,Q,$;e((()=>{Z=t(l(),1),d(),ge(),ve(),E(),r(),P(),R(),U(),Q=p(),$=async e=>(k(),await S(),(0,Q.jsx)(ye,{onDone:e}))}))();export{$ as call};