@readmagic/workmate 0.0.28 → 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 (240) hide show
  1. package/dist/chunks/{AddWorkspaceDirectory-Bmgh8VS3.js → AddWorkspaceDirectory-C0lrhffT.js} +1 -1
  2. package/dist/chunks/AgentsMdExternalIncludesDialog-DIahWLha.js +1 -0
  3. package/dist/chunks/{AgentsMdExternalIncludesDialog-BJfHqScU.js → AgentsMdExternalIncludesDialog-Dmjjx4ql.js} +1 -1
  4. package/dist/chunks/App-COz7knHS.js +1 -0
  5. package/dist/chunks/{BackgroundTasksDialog-WkoL4g5Q.js → BackgroundTasksDialog-5IkCQ8lN.js} +2 -2
  6. package/dist/chunks/{BypassPermissionsModeDialog-BT9yl0Qt.js → BypassPermissionsModeDialog-g1FMGfQF.js} +1 -1
  7. package/dist/chunks/{CustomSelect-t4wXuXWH.js → CustomSelect-BsEd2To5.js} +1 -1
  8. package/dist/chunks/{DiffDialog-CXZxnb7Y.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-riLYEaUP.js → InvalidConfigDialog-Di6HZYDV.js} +1 -1
  13. package/dist/chunks/{InvalidSettingsDialog-BGXl3V1A.js → InvalidSettingsDialog-BHL-MERJ.js} +1 -1
  14. package/dist/chunks/{KeybindingProviderSetup-syiDgtpB.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-Czze2JPd.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-CD_Uv5h9.js → Onboarding-BfWLRx3n.js} +1 -1
  21. package/dist/chunks/{PromptInputFooterSuggestions-CHXJsTtQ.js → PromptInputFooterSuggestions-BRyJj7XR.js} +1 -1
  22. package/dist/chunks/{PromptInputHelpMenu-BZIVCV7V.js → PromptInputHelpMenu-DLuRCXVS.js} +1 -1
  23. package/dist/chunks/{ProviderSetup-CwMvjmjh.js → ProviderSetup-CKZGG2B9.js} +1 -1
  24. package/dist/chunks/QueryEngine-B27MOtBA.js +1 -0
  25. package/dist/chunks/{REPL-CtFtb35A.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-ou7ZhpVY.js → TextInput-BVEWdRz9.js} +5 -5
  32. package/dist/chunks/{ThemePicker-CVFWqSc7.js → ThemePicker-th2jdUjh.js} +1 -1
  33. package/dist/chunks/{TrustDialog-CGXv_LF4.js → TrustDialog-YsYqHyRR.js} +1 -1
  34. package/dist/chunks/{_baseEach-BYhqv77g.js → _baseEach-Bz5fQbIq.js} +1 -1
  35. package/dist/chunks/{add-dir-BSizpuef.js → add-dir-BsO6l8Ue.js} +1 -1
  36. package/dist/chunks/{agentDisplay-JKfYFD1m.js → agentDisplay-ChkgiTIH.js} +1 -1
  37. package/dist/chunks/{agents-MEaV8P2G.js → agents-BV1nan6b.js} +6 -6
  38. package/dist/chunks/{agents-BDTCH6YB.js → agents-DqEB6iwV.js} +1 -1
  39. package/dist/chunks/allErrors-CkdguCDv.js +1 -0
  40. package/dist/chunks/{backgroundHousekeeping-CsXlkIg3.js → backgroundHousekeeping-1VsWy8xd.js} +1 -1
  41. package/dist/chunks/backgroundHousekeeping-pMtrl4K2.js +1 -0
  42. package/dist/chunks/{branch-BllXcYwS.js → branch-CTIHtpwz.js} +2 -2
  43. package/dist/chunks/{bridgeControl-aDnUrYZR.js → bridgeControl-C8xaGuwO.js} +1 -1
  44. package/dist/chunks/{btw-DzaRBa6o.js → btw-BA39Zrhm.js} +1 -1
  45. package/dist/chunks/caches-DHZHqVhf.js +1 -0
  46. package/dist/chunks/caches-fqs-Y-kW.js +1 -0
  47. package/dist/chunks/channel-B5FkNSZ3.js +1 -0
  48. package/dist/chunks/{channel-Gw6skpUh.js → channel-C5yKM1wf.js} +1 -1
  49. package/dist/chunks/{clear-CDQs9_5P.js → clear-BmlaYYrD.js} +1 -1
  50. package/dist/chunks/commands-EUcHifS4.js +1 -0
  51. package/dist/chunks/compact-D3uePeI7.js +2 -0
  52. package/dist/chunks/config-GgGdlJ9h.js +1 -0
  53. package/dist/chunks/{context-TkdzCK3Y.js → context-CBEWyVpE.js} +1 -1
  54. package/dist/chunks/{context-noninteractive-BcBo64vo.js → context-noninteractive-B03nuxfN.js} +2 -2
  55. package/dist/chunks/context-noninteractive-BLCyyyGL.js +1 -0
  56. package/dist/chunks/conversation-BFL0rEIx.js +1 -0
  57. package/dist/chunks/conversation-D-ker4RO.js +1 -0
  58. package/dist/chunks/{conversationRecovery-_hWC7JBO.js → conversationRecovery-Bt84CYO6.js} +1 -1
  59. package/dist/chunks/crossProjectResume-DwlYY6lV.js +40 -0
  60. package/dist/chunks/{diff-BzVUPO4Z.js → diff-CewYzu3Y.js} +1 -1
  61. package/dist/chunks/doctor-CrQ0UfG2.js +1 -0
  62. package/dist/chunks/{entry-333L52Lo.js → entry-DdVUdGWV.js} +3 -3
  63. package/dist/chunks/exit-QwCo2aJo.js +1 -0
  64. package/dist/chunks/{extraUsage-CmgRR-zH.js → extraUsage-Cu0aV35i.js} +1 -1
  65. package/dist/chunks/extractMemories-DHlbRc5g.js +1 -0
  66. package/dist/chunks/{fast-D7oNjaZ3.js → fast-BlhpCQ2f.js} +1 -1
  67. package/dist/chunks/fast-C3JeBy3A.js +1 -0
  68. package/dist/chunks/{fetchModelList-Cv1vWIpC.js → fetchModelList-DjFCMjVN.js} +1 -1
  69. package/dist/chunks/fetchModelList-L2XarfAj.js +1 -0
  70. package/dist/chunks/{fileSuggestions-DF3HTRKr.js → fileSuggestions-BRwKV_KA.js} +2 -2
  71. package/dist/chunks/{gemini-ou7_YyXc.js → gemini-I-M5_sUA.js} +2 -2
  72. package/dist/chunks/{generateSessionName-CeN9EZNY.js → generateSessionName-CJ0sh6HD.js} +1 -1
  73. package/dist/chunks/{goal-CCxo4Wyf.js → goal-DIrBBT5J.js} +3 -3
  74. package/dist/chunks/{grok-BMmUcNbI.js → grok-ZLjJN6b9.js} +1 -1
  75. package/dist/chunks/{help-CYtogTZk.js → help-CDMjVOl6.js} +1 -1
  76. package/dist/chunks/{hooks-ByVkvodY.js → hooks-BNKCE023.js} +2 -2
  77. package/dist/chunks/hooks-ERYtmuNW.js +1 -0
  78. package/dist/chunks/{install-DIxyfdXG.js → install-xlfTw1j6.js} +1 -1
  79. package/dist/chunks/{instrumentation-BmHivmxs.js → instrumentation-DSt0UvGn.js} +3 -3
  80. package/dist/chunks/{job-D534P26R.js → job-BVElGsu0.js} +1 -1
  81. package/dist/chunks/{launchLocalMemory-CWXLb3KF.js → launchLocalMemory-DUkJCKmd.js} +2 -2
  82. package/dist/chunks/{launchOnboarding-CocPmwzz.js → launchOnboarding-BvD-E_jC.js} +1 -1
  83. package/dist/chunks/loadAgentsDir-BImZsKrh.js +1 -0
  84. package/dist/chunks/{loadAgentsDir-bmpKLPdG.js → loadAgentsDir-BfLCckVj.js} +22 -22
  85. package/dist/chunks/loadPluginHooks-BPwWtBzO.js +1 -0
  86. package/dist/chunks/{localSearch-Da8cVYoI.js → localSearch-BHG8sp8p.js} +1 -1
  87. package/dist/chunks/localSearch-D3rvcRRC.js +1 -0
  88. package/dist/chunks/{logoUtils-qNuBc2nI.js → logoUtils-BsNLv-qi.js} +1 -1
  89. package/dist/chunks/{magicDocs-BsEiBLQl.js → magicDocs-Bue9vxzY.js} +2 -2
  90. package/dist/chunks/{main-B31aPMPP.js → main-U71X4Thd.js} +22 -22
  91. package/dist/chunks/{mcp-Dd8TBfQQ.js → mcp-C4CxCMwJ.js} +3 -3
  92. package/dist/chunks/mcp-D9HFARDy.js +1 -0
  93. package/dist/chunks/mcp-De3QGKvT.js +2 -0
  94. package/dist/chunks/memory-DVRdJFfI.js +1 -0
  95. package/dist/chunks/{mode-SM8doWgC.js → mode-Bd5w-RBX.js} +2 -2
  96. package/dist/chunks/{model-C2r-PaR4.js → model-BCIcUhrc.js} +1 -1
  97. package/dist/chunks/{model-Dd3x121y.js → model-BIf2i1is.js} +1 -1
  98. package/dist/chunks/{modelOptions-BQL4gbNk.js → modelOptions-COIU5U3w.js} +1 -1
  99. package/dist/chunks/{nativeInstaller-DMkZdsof.js → nativeInstaller-CGSNzGNn.js} +1 -1
  100. package/dist/chunks/{notifications-BwS1XsnZ.js → notifications-B5gzCmPC.js} +1 -1
  101. package/dist/chunks/{onChangeAppState-C9cYQJPF.js → onChangeAppState-NWwSE-I4.js} +1 -1
  102. package/dist/chunks/{openai-Bea4I2Od.js → openai-CyJ3m4dI.js} +2 -2
  103. package/dist/chunks/{overlayContext-C5WPACKC.js → overlayContext-DYrGDe63.js} +1 -1
  104. package/dist/chunks/{partition-CKgWl7p4.js → partition-BavNaw1S.js} +1 -1
  105. package/dist/chunks/permissions-CLYcBXIu.js +3 -0
  106. package/dist/chunks/{pidLock-CqkC3-nD.js → pidLock-Bao7SU6Z.js} +2 -2
  107. package/dist/chunks/{plan-Ce6wfjjI.js → plan-Dwj_ZX8G.js} +1 -1
  108. package/dist/chunks/plugin-Cscvf8st.js +17 -0
  109. package/dist/chunks/{pluginAutoupdate-ByokIVEs.js → pluginAutoupdate-D5XyiZrP.js} +1 -1
  110. package/dist/chunks/pluginBlocklist-CpkjXXKQ.js +1 -0
  111. package/dist/chunks/pluginCliCommands-DmLsxs1M.js +1 -0
  112. package/dist/chunks/{pluginFlagging-B2ZX5_oB.js → pluginFlagging-CRuX6sHR.js} +1 -1
  113. package/dist/chunks/pluginOperations-orq3bOCp.js +2 -0
  114. package/dist/chunks/{pluginStartupCheck-QG0d95dE.js → pluginStartupCheck-DGDl1WOZ.js} +1 -1
  115. package/dist/chunks/pluginStartupCheck-GHO77nmg.js +1 -0
  116. package/dist/chunks/plugins-Cq5c-Qs1.js +4 -0
  117. package/dist/chunks/{print-dUT7E1g9.js → print-zo7Z--Ll.js} +9 -9
  118. package/dist/chunks/processBashCommand-C7oVqf0B.js +1 -0
  119. package/dist/chunks/processSlashCommand-CPQB5_0w.js +5 -0
  120. package/dist/chunks/prompt-CAzFDybL.js +1 -0
  121. package/dist/chunks/prompt-Cm8SKZXY.js +1 -0
  122. package/dist/chunks/{prompt-BnDapYGL.js → prompt-DaYH88Oe.js} +1 -1
  123. package/dist/chunks/{reconciler-C_HKsocm.js → reconciler-B5Kr4do0.js} +1 -1
  124. package/dist/chunks/refresh-DurNMJeS.js +1 -0
  125. package/dist/chunks/{reject-Tug1RmkE.js → reject-CzjtO3fU.js} +1 -1
  126. package/dist/chunks/{reload-plugins-CL9LWzpq.js → reload-plugins-C38i_Eb3.js} +1 -1
  127. package/dist/chunks/rename-BV-3ZpFx.js +1 -0
  128. package/dist/chunks/{resume-BZ42SpS2.js → resume-CUzQIor4.js} +2 -2
  129. package/dist/chunks/{runtimeObserver-DT5P2_XL.js → runtimeObserver-BKoQ5IEO.js} +4 -4
  130. package/dist/chunks/{runtimeObserver-BLq2guVy.js → runtimeObserver-Ess1Cn8Y.js} +1 -1
  131. package/dist/chunks/sandbox-adapter-ClRO21Ci.js +1 -0
  132. package/dist/chunks/{sandbox-toggle-DghmaJhK.js → sandbox-toggle-Bp6Xpjh3.js} +1 -1
  133. package/dist/chunks/searchExtraTools-CV_fkuD6.js +1 -0
  134. package/dist/chunks/{select-CaxQ-BVq.js → select-Bm29ymsI.js} +1 -1
  135. package/dist/chunks/sessionFileAccessHooks-B5kAD4ol.js +1 -0
  136. package/dist/chunks/{sessionObserver-DBoZUvWL.js → sessionObserver-CBlzrJt1.js} +1 -1
  137. package/dist/chunks/sessionObserver-CayxkuxO.js +1 -0
  138. package/dist/chunks/sessionStorage-vLxCo1Mh.js +1 -0
  139. package/dist/chunks/{sessionTracing-5a7HDF4e.js → sessionTracing-TDsq54Uc.js} +1 -1
  140. package/dist/chunks/setup-BbyfyeQk.js +3 -0
  141. package/dist/chunks/{shadowedRuleDetection-L3tnySui.js → shadowedRuleDetection-BG3jtA9Y.js} +1 -1
  142. package/dist/chunks/{sideQuestion-BJTVma-5.js → sideQuestion-C8GNVo4R.js} +3 -3
  143. package/dist/chunks/{sinks-CV0SWuZW.js → sinks-BafJR6Fw.js} +1 -1
  144. package/dist/chunks/sinks-CHtjg7sn.js +1 -0
  145. package/dist/chunks/skillChangeDetector-CY17weG4.js +1 -0
  146. package/dist/chunks/{skillGapStore-Cposc03e.js → skillGapStore-Cl4J1WoZ.js} +2 -2
  147. package/dist/chunks/{skillLifecycle-RXQp0JU7.js → skillLifecycle-DdfeUHBf.js} +2 -2
  148. package/dist/chunks/{skillSearchPanel-B2pjskqk.js → skillSearchPanel-DtQYF9gN.js} +4 -4
  149. package/dist/chunks/{skills-D2ZjMtv4.js → skills-Fd12LJal.js} +1 -1
  150. package/dist/chunks/status-CGEMRiPI.js +1 -0
  151. package/dist/chunks/statusNoticeHelpers-D0tonVy0.js +1 -0
  152. package/dist/chunks/{switcher-rep86o4_.js → switcher-BCq9Az_q.js} +1 -1
  153. package/dist/chunks/switcher-DQMr6Anx.js +1 -0
  154. package/dist/chunks/{tasks-B4coTfrq.js → tasks-DQmkY_xD.js} +1 -1
  155. package/dist/chunks/{templateJobs-C5ukh6H3.js → templateJobs-CEDUbFAY.js} +1 -1
  156. package/dist/chunks/{theme-7RmvErYJ.js → theme-DQjJ4R0o.js} +1 -1
  157. package/dist/chunks/tipRegistry-BwxZ_G0j.js +2 -0
  158. package/dist/chunks/{toolEventObserver-Dzwzi5Vi.js → toolEventObserver-DdZ30on9.js} +1 -1
  159. package/dist/chunks/toolPool-CWIXwdX7.js +1 -0
  160. package/dist/chunks/{useExitOnCtrlCDWithKeybindings-BT0nexZw.js → useExitOnCtrlCDWithKeybindings-ClrtNKJ6.js} +1 -1
  161. package/dist/chunks/useMainLoopModel-CULw8pB_.js +1 -0
  162. package/dist/chunks/{useManagePlugins-pGaGzsEg.js → useManagePlugins-CmsPSHor.js} +1 -1
  163. package/dist/chunks/useMergedTools-C8PxReh0.js +1 -0
  164. package/dist/chunks/{useSearchInput-j12K4wEo.js → useSearchInput-BZhTzjgN.js} +1 -1
  165. package/dist/chunks/useSettingsErrors-GWIxCYyd.js +1 -0
  166. package/dist/chunks/{util-CCEK8oze.js → util-Bih2g-pV.js} +1 -1
  167. package/dist/chunks/validatePlugin-BwcC_Wbr.js +1 -0
  168. package/dist/chunks/worktree-BB9lFWBB.js +1 -0
  169. package/dist/cli.js +1 -1
  170. package/package.json +1 -1
  171. package/dist/chunks/AgentsMdExternalIncludesDialog-BjbUilCE.js +0 -1
  172. package/dist/chunks/App-COdpsR2w.js +0 -1
  173. package/dist/chunks/Doctor-B6isid5K.js +0 -1
  174. package/dist/chunks/Doctor-COj-tZBc.js +0 -3
  175. package/dist/chunks/ExitFlow-CcMYH5iI.js +0 -2
  176. package/dist/chunks/MCPConnectionManager-C7RmKzJh.js +0 -1
  177. package/dist/chunks/MCPToolListView-CewNLJus.js +0 -1
  178. package/dist/chunks/MessageSelector-Kc6JlnDX.js +0 -3
  179. package/dist/chunks/Messages-BvFYO4Zn.js +0 -10
  180. package/dist/chunks/QueryEngine-DAwfp_ht.js +0 -1
  181. package/dist/chunks/REPL-tFT1FGQF.js +0 -1
  182. package/dist/chunks/ResumeConversation-CERzSBvg.js +0 -1
  183. package/dist/chunks/SearchExtraToolsTool-ndh4aEwQ.js +0 -1
  184. package/dist/chunks/Settings-CPaqWNdP.js +0 -2
  185. package/dist/chunks/Spinner-C0qHjfIY.js +0 -1
  186. package/dist/chunks/allErrors-Dhnf6rqg.js +0 -1
  187. package/dist/chunks/backgroundHousekeeping-Bu-zRFCx.js +0 -1
  188. package/dist/chunks/caches-CMF-MmR-.js +0 -1
  189. package/dist/chunks/caches-CW5YnYNS.js +0 -1
  190. package/dist/chunks/channel-DVx21qde.js +0 -1
  191. package/dist/chunks/commands-CfYMwgP7.js +0 -1
  192. package/dist/chunks/compact-6F2tuItE.js +0 -2
  193. package/dist/chunks/config-BDkzWBnL.js +0 -1
  194. package/dist/chunks/context-noninteractive-oFcnY1Er.js +0 -1
  195. package/dist/chunks/conversation-CYZyg1U1.js +0 -1
  196. package/dist/chunks/conversation-DXzlRhNw.js +0 -1
  197. package/dist/chunks/crossProjectResume-CCo3iZrB.js +0 -40
  198. package/dist/chunks/doctor-B4jQbGQr.js +0 -1
  199. package/dist/chunks/exit-D5DYnRvR.js +0 -1
  200. package/dist/chunks/extractMemories-CVUrBFMj.js +0 -1
  201. package/dist/chunks/fast-CRhW9zha.js +0 -1
  202. package/dist/chunks/fetchModelList-DIa1HwAJ.js +0 -1
  203. package/dist/chunks/hooks-CBGUcyCs.js +0 -1
  204. package/dist/chunks/loadAgentsDir-Zw648oQO.js +0 -1
  205. package/dist/chunks/loadPluginHooks-BIfM53-_.js +0 -1
  206. package/dist/chunks/localSearch-Dbj8cXyO.js +0 -1
  207. package/dist/chunks/mcp-BMeWtYCx.js +0 -2
  208. package/dist/chunks/mcp-CYbesbfl.js +0 -1
  209. package/dist/chunks/memory-DtQQGyPS.js +0 -1
  210. package/dist/chunks/permissions-Dv_PCfY0.js +0 -3
  211. package/dist/chunks/plugin-aK4tDrVg.js +0 -17
  212. package/dist/chunks/pluginBlocklist-ByRQaVPu.js +0 -1
  213. package/dist/chunks/pluginCliCommands-Dyk4HYHs.js +0 -1
  214. package/dist/chunks/pluginOperations-BCvJvfOC.js +0 -2
  215. package/dist/chunks/pluginStartupCheck-o_TC7wIt.js +0 -1
  216. package/dist/chunks/plugins-DzsTDNWJ.js +0 -4
  217. package/dist/chunks/processBashCommand-DtGCgTkF.js +0 -1
  218. package/dist/chunks/processSlashCommand-wXblpK2C.js +0 -5
  219. package/dist/chunks/prompt-BdH2zk0S.js +0 -1
  220. package/dist/chunks/prompt-D0TFER0A.js +0 -1
  221. package/dist/chunks/refresh-Cm4jZzLa.js +0 -1
  222. package/dist/chunks/rename-OfKJSazJ.js +0 -1
  223. package/dist/chunks/sandbox-adapter-982rx2cm.js +0 -1
  224. package/dist/chunks/searchExtraTools-B4N1bpy0.js +0 -1
  225. package/dist/chunks/sessionFileAccessHooks-BqQ58T7e.js +0 -1
  226. package/dist/chunks/sessionObserver-qYpA90El.js +0 -1
  227. package/dist/chunks/sessionStorage-CC0v4zMs.js +0 -1
  228. package/dist/chunks/setup-DVLnIlse.js +0 -3
  229. package/dist/chunks/sinks-C9NdbjLo.js +0 -1
  230. package/dist/chunks/skillChangeDetector-DlodgOyC.js +0 -1
  231. package/dist/chunks/status-BcSkj9nE.js +0 -1
  232. package/dist/chunks/statusNoticeHelpers-DsrqBOQt.js +0 -1
  233. package/dist/chunks/switcher-BietN6il.js +0 -1
  234. package/dist/chunks/tipRegistry-BYpJZIjR.js +0 -2
  235. package/dist/chunks/toolPool-BGfiNj6h.js +0 -1
  236. package/dist/chunks/useMainLoopModel-QuE7VkgX.js +0 -1
  237. package/dist/chunks/useMergedTools-BLsIT3R_.js +0 -1
  238. package/dist/chunks/useSettingsErrors-C8VIzdws.js +0 -1
  239. package/dist/chunks/validatePlugin-CTVnWx9H.js +0 -1
  240. package/dist/chunks/worktree-BWL0vR4o.js +0 -1
@@ -0,0 +1 @@
1
+ import{a as e,r as t}from"./switcher-BCq9Az_q.js";t();export{e as restoreActiveProvider};
@@ -1 +1 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{t}from"./jsx-runtime-Bb4Xn-E0.js";import{n,t as r}from"./BackgroundTasksDialog-WkoL4g5Q.js";async function i(e,t){return(0,a.jsx)(r,{toolUseContext:t,onDone:e})}var a;e((()=>{n(),a=t()}))();export{i as call};
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{t}from"./jsx-runtime-Bb4Xn-E0.js";import{n,t as r}from"./BackgroundTasksDialog-5IkCQ8lN.js";async function i(e,t){return(0,a.jsx)(r,{toolUseContext:t,onDone:e})}var a;e((()=>{n(),a=t()}))();export{i as call};
@@ -1,4 +1,4 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{i as t,o as n}from"./envUtils-QyzA_cFM.js";import{g as r,h as i,m as a,vw as o,yw as s}from"./loadAgentsDir-bmpKLPdG.js";import{basename as c,join as l}from"path";import{appendFileSync as u,mkdirSync as d,readFileSync as f,readdirSync as p,writeFileSync as m}from"fs";import{randomUUID as h}from"crypto";function g(){let e=i(`templates`,process.cwd()),n=l(t(),`templates`);try{return p(n),[...e,n]}catch{return e}}function _(){let e=[],t=new Set;for(let n of g()){let r;try{r=p(n)}catch{continue}for(let i of r){if(!i.endsWith(`.md`))continue;let r=c(i,`.md`);if(t.has(r))continue;t.add(r);let o=l(n,i);try{let{frontmatter:t,content:n}=s(f(o,`utf-8`),o),i=(typeof t.description==`string`?t.description:``)||a(n,`No description`);e.push({name:r,description:i,filePath:o,frontmatter:t,content:n})}catch{}}}return e}function v(e){return _().find(t=>t.name===e)??null}var y=e((()=>{o(),n(),r()}));function b(){return l(t(),`jobs`)}function x(e){return l(b(),e)}function S(e,t,n,r,i){let a=x(e);d(a,{recursive:!0});let o=new Date().toISOString(),s={jobId:e,templateName:t,createdAt:o,updatedAt:o,status:`created`,args:i};return m(l(a,`state.json`),JSON.stringify(s,null,2),`utf-8`),m(l(a,`template.md`),n,`utf-8`),m(l(a,`input.txt`),r,`utf-8`),a}function C(e){try{let t=f(l(x(e),`state.json`),`utf-8`),n=JSON.parse(t);if(typeof n!=`object`||!n)return null;let r=n;return typeof r.jobId!=`string`||typeof r.status!=`string`?null:r}catch{return null}}function w(e,t){let n=x(e),r=C(e);if(!r)return!1;let i=l(n,`replies.jsonl`),a=JSON.stringify({text:t,timestamp:new Date().toISOString()});try{u(i,`${a}\n`,`utf-8`)}catch{m(i,`${a}\n`,`utf-8`)}let o={...r,updatedAt:new Date().toISOString()};return m(l(n,`state.json`),JSON.stringify(o,null,2),`utf-8`),!0}var T=e((()=>{n()}));async function E(e){let t=e[0];switch(t){case`list`:k();break;case`new`:A(e.slice(1));break;case`reply`:j(e.slice(1));break;case`status`:O(e.slice(1));break;default:console.error(`Unknown template command: ${t}`),D(),process.exitCode=1}}function D(){console.log(`
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{i as t,o as n}from"./envUtils-QyzA_cFM.js";import{bw as r,g as i,h as a,m as o,xw as s}from"./loadAgentsDir-BfLCckVj.js";import{basename as c,join as l}from"path";import{appendFileSync as u,mkdirSync as d,readFileSync as f,readdirSync as p,writeFileSync as m}from"fs";import{randomUUID as h}from"crypto";function g(){let e=a(`templates`,process.cwd()),n=l(t(),`templates`);try{return p(n),[...e,n]}catch{return e}}function _(){let e=[],t=new Set;for(let n of g()){let r;try{r=p(n)}catch{continue}for(let i of r){if(!i.endsWith(`.md`))continue;let r=c(i,`.md`);if(t.has(r))continue;t.add(r);let a=l(n,i);try{let{frontmatter:t,content:n}=s(f(a,`utf-8`),a),i=(typeof t.description==`string`?t.description:``)||o(n,`No description`);e.push({name:r,description:i,filePath:a,frontmatter:t,content:n})}catch{}}}return e}function v(e){return _().find(t=>t.name===e)??null}var y=e((()=>{r(),n(),i()}));function b(){return l(t(),`jobs`)}function x(e){return l(b(),e)}function S(e,t,n,r,i){let a=x(e);d(a,{recursive:!0});let o=new Date().toISOString(),s={jobId:e,templateName:t,createdAt:o,updatedAt:o,status:`created`,args:i};return m(l(a,`state.json`),JSON.stringify(s,null,2),`utf-8`),m(l(a,`template.md`),n,`utf-8`),m(l(a,`input.txt`),r,`utf-8`),a}function C(e){try{let t=f(l(x(e),`state.json`),`utf-8`),n=JSON.parse(t);if(typeof n!=`object`||!n)return null;let r=n;return typeof r.jobId!=`string`||typeof r.status!=`string`?null:r}catch{return null}}function w(e,t){let n=x(e),r=C(e);if(!r)return!1;let i=l(n,`replies.jsonl`),a=JSON.stringify({text:t,timestamp:new Date().toISOString()});try{u(i,`${a}\n`,`utf-8`)}catch{m(i,`${a}\n`,`utf-8`)}let o={...r,updatedAt:new Date().toISOString()};return m(l(n,`state.json`),JSON.stringify(o,null,2),`utf-8`),!0}var T=e((()=>{n()}));async function E(e){let t=e[0];switch(t){case`list`:k();break;case`new`:A(e.slice(1));break;case`reply`:j(e.slice(1));break;case`status`:O(e.slice(1));break;default:console.error(`Unknown template command: ${t}`),D(),process.exitCode=1}}function D(){console.log(`
2
2
  Template Job Commands:
3
3
 
4
4
  wm job list List available templates
@@ -1 +1 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{H as t,t as n,x as r}from"./src-BX54x08P.js";import{t as i}from"./jsx-runtime-Bb4Xn-E0.js";import{n as a,t as o}from"./ThemePicker-CVFWqSc7.js";function s({onDone:e}){let[,n]=t();return(0,c.jsx)(r,{color:`permission`,children:(0,c.jsx)(o,{onThemeSelect:t=>{n(t),e(`Theme set to ${t}`)},onCancel:()=>{e(`Theme picker dismissed`,{display:`system`})},skipExitHandling:!0})})}var c,l;e((()=>{n(),a(),c=i(),l=async(e,t)=>(0,c.jsx)(s,{onDone:e})}))();export{l as call};
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{H as t,t as n,x as r}from"./src-BX54x08P.js";import{t as i}from"./jsx-runtime-Bb4Xn-E0.js";import{n as a,t as o}from"./ThemePicker-th2jdUjh.js";function s({onDone:e}){let[,n]=t();return(0,c.jsx)(r,{color:`permission`,children:(0,c.jsx)(o,{onThemeSelect:t=>{n(t),e(`Theme set to ${t}`)},onCancel:()=>{e(`Theme picker dismissed`,{display:`system`})},skipExitHandling:!0})})}var c,l;e((()=>{n(),a(),c=i(),l=async(e,t)=>(0,c.jsx)(s,{onDone:e})}))();export{l as call};
@@ -0,0 +1,2 @@
1
+ import{n as e,t}from"./memoize-BK3gG5ob.js";import{l as n,o as r}from"./envUtils-QyzA_cFM.js";import{di as i,fi as a,j as o,t as s}from"./src-BX54x08P.js";import{Gr as c,Jt as l,Kr as u,Ur as ee,Xt as d,d as f,m as p,qr as m,qt as h,t as g}from"./settings-D4M13toi.js";import{Pt as _,at as v}from"./state-CXY-q5gr.js";import{Wv as y,Za as b,br as x,cb as S,fo as C,gC as w,hC as T,mo as te,qv as ne,sb as E,sg as D,tg as O,to as k,vr as A,xx as j,yx as M}from"./loadAgentsDir-BfLCckVj.js";import{n as N,t as P}from"./cwd-DrEEb4f5.js";import{c as F,i as I}from"./debug-2pVES-2G.js";import{a as L,d as R,h as z,l as B,m as V,o as H}from"./config-Bio2EjUK.js";import{r as U,t as W}from"./execa-CBhG1doD.js";import{o as G,s as K}from"./log-L1kqxa_P.js";import{i as q,n as J}from"./execFileNoThrow-DXSEj8ZO.js";import{i as Y,o as re}from"./bundledMode-D9omqD3L.js";import{Mt as X,Pt as ie}from"./model-BIf2i1is.js";import{c as ae,i as oe}from"./terminalSetup-xe_P98fY.js";I(),G(),q(),m(),T(),U(),t(),_(),R(),N(),d(),r();async function se(){}e(e=>({deviceId:B(),sessionId:v(),email:void 0,appVersion:`0.0.29`,platform:l(),userType:process.env.USER_TYPE,...n(process.env.GITHUB_ACTIONS)&&{githubActionsMetadata:{actor:process.env.GITHUB_ACTOR,actorId:process.env.GITHUB_ACTOR_ID,repository:process.env.GITHUB_REPOSITORY,repositoryId:process.env.GITHUB_REPOSITORY_ID,repositoryOwner:process.env.GITHUB_REPOSITORY_OWNER,repositoryOwnerId:process.env.GITHUB_REPOSITORY_OWNER_ID}}}));var ce=e(async()=>{let e=await W(`git config --get user.email`,{shell:!0,reject:!1,cwd:P()});return e.exitCode===0&&e.stdout?e.stdout.trim():void 0});t(),N(),R(),d();var le=[/(?:^|\/)(?:package-lock\.json|yarn\.lock|bun\.lock|bun\.lockb|pnpm-lock\.yaml|Pipfile\.lock|poetry\.lock|Cargo\.lock|Gemfile\.lock|go\.sum|composer\.lock|uv\.lock)$/,/\.generated\./,/(?:^|\/)(?:dist|build|out|target|node_modules|\.next|__pycache__)\//,/\.(?:min\.js|min\.css|map|pyc|pyo)$/,/\.(?:json|ya?ml|toml|xml|ini|cfg|conf|env|lock|txt|md|mdx|rst|csv|log|svg)$/i,/(?:^|\/)\.?(?:eslintrc|prettierrc|babelrc|editorconfig|gitignore|gitattributes|dockerignore|npmrc)/,/(?:^|\/)(?:tsconfig|jsconfig|biome|vitest\.config|jest\.config|webpack\.config|vite\.config|rollup\.config)\.[a-z]+$/,/(?:^|\/)\.(?:github|vscode|idea|claude)\//,/(?:^|\/)(?:CHANGELOG|LICENSE|CONTRIBUTING|CODEOWNERS|README)(?:\.[a-z]+)?$/i];function ue(e){return!le.some(t=>t.test(e))}function de(e,t){let n=[],r=new Set,i=new Map;for(let a=1;n.length<t&&a<=t;a++)for(let o of e){if(n.length>=t)break;if(!ue(o))continue;let e=Math.max(o.lastIndexOf(`/`),o.lastIndexOf(`\\`)),s=e>=0?o.slice(e+1):o;if(!s||r.has(s))continue;let c=e>=0?o.slice(0,e):`.`;(i.get(c)??0)>=a||(n.push(s),r.add(s),i.set(c,(i.get(c)??0)+1))}return n.length>=t?n:[]}async function fe(){if(h.platform===`win32`||!await ee())return[];try{let e=await ce(),t=[`log`,`-n`,`1000`,`--pretty=format:`,`--name-only`,`--diff-filter=M`],n=new Map,r=e=>{for(let t of e.split(`
2
+ `)){let e=t.trim();e&&n.set(e,(n.get(e)??0)+1)}};if(e){let{stdout:n}=await J(`git`,[...t,`--author=${e}`],{cwd:P()});r(n)}if(n.size<10){let{stdout:e}=await J(u(),t,{cwd:P()});r(e)}return de(Array.from(n.entries()).sort((e,t)=>t[1]-e[1]).map(([e])=>e),5)}catch(e){return K(e),[]}}var pe=10080*60*1e3,me=e(()=>{let e=L(),t=e.exampleFiles?.length?w(e.exampleFiles):`<filepath>`;return`Try "${w([`fix lint errors`,`fix typecheck errors`,`how does ${t} work?`,`refactor ${t}`,`how do I log an error?`,`edit ${t} to...`,`write a test for ${t}`,`create a util logging.py that...`])}"`}),he=e(async()=>{let e=L();Date.now()-(e.exampleFilesGeneratedAt??0)>pe&&(e.exampleFiles=[]),e.exampleFiles?.length||fe().then(e=>{e.length&&V(t=>({...t,exampleFiles:e,exampleFilesGeneratedAt:Date.now()}))})});ie();var ge={"claude-3-opus":{modelName:`Work Mate 3 Opus`,retirementDates:{firstParty:`January 5, 2026`,bedrock:`January 15, 2026`,vertex:`January 5, 2026`,foundry:`January 5, 2026`}},"claude-3-7-sonnet":{modelName:`Work Mate 3.7 Sonnet`,retirementDates:{firstParty:`February 19, 2026`,bedrock:`April 28, 2026`,vertex:`May 11, 2026`,foundry:`February 19, 2026`}},"claude-3-5-haiku":{modelName:`Work Mate 3.5 Haiku`,retirementDates:{firstParty:`February 19, 2026`,bedrock:null,vertex:null,foundry:null}}};function _e(e){let t=e.toLowerCase(),n=X();for(let[e,r]of Object.entries(ge)){let i=r.retirementDates[n];if(!(!t.includes(e)||!i))return{isDeprecated:!0,modelName:r.modelName,retirementDate:i}}return{isDeprecated:!1}}function ve(e){if(!e)return null;let t=_e(e);return t.isDeprecated?`⚠ ${t.modelName} will be retired on ${t.retirementDate}. Consider switching to a newer model.`:null}a(),s(),re(),p(),j(),S(),ne(),D(),C(),b(),A(),oe(),R();function ye(e){let t=H().numStartups;z(n=>{let r=n.tipsHistory??{};return r[e]===t?n:{...n,tipsHistory:{...r,[e]:t}}})}function Z(e){let t=H(),n=t.tipsHistory?.[e];return n?t.numStartups-n:1/0}R(),d(),m();var Q;async function be(){return Q===void 0&&(Q=M in await te()),Q}async function $(e,t,n){if(!await be()||k(`${e}@claude-plugins-official`))return!1;let{bashTools:r}=t??{};return!!(n.cli&&r?.size&&n.cli.some(e=>r.has(e))||n.filePath&&t?.readFileState&&y(t.readFileState).some(e=>n.filePath.test(e)))}var xe=[{id:`new-user-warmup`,content:async()=>`Start with small features or bug fixes, tell Work Mate to propose a plan, and verify its suggested edits`,cooldownSessions:3,async isRelevant(){return H().numStartups<10}},{id:`plan-mode-for-complex-tasks`,content:async()=>`Use Plan Mode to prepare for a complex request before making changes. Press ${E(`chat:cycleMode`,`Chat`,`shift+tab`)} twice to enable.`,cooldownSessions:5,isRelevant:async()=>{let e=H();return(e.lastPlanModeUse?(Date.now()-e.lastPlanModeUse)/(1e3*60*60*24):1/0)>7}},{id:`default-permission-mode-config`,content:async()=>`Use /config to change your default permission mode (including Plan Mode)`,cooldownSessions:10,isRelevant:async()=>{try{let e=H(),t=f(),n=!!e.lastPlanModeUse,r=!!t?.permissions?.defaultMode;return n&&!r}catch(e){return F(`Failed to check default-permission-mode-config tip relevance: ${e}`,{level:`warn`}),!1}}},{id:`git-worktrees`,content:async()=>`Use git worktrees to run multiple Work Mate sessions in parallel.`,cooldownSessions:10,isRelevant:async()=>{try{let e=H();return await c()<=1&&e.numStartups>50}catch{return!1}}},{id:`terminal-setup`,content:async()=>h.terminal===`Apple_Terminal`?`Run /terminal-setup to enable convenient terminal integration like Option + Enter for new line and more`:`Run /terminal-setup to enable convenient terminal integration like Shift + Enter for new line and more`,cooldownSessions:10,async isRelevant(){let e=H();return h.terminal===`Apple_Terminal`?!e.optionAsMetaKeyInstalled:!e.shiftEnterKeyBindingInstalled}},{id:`shift-enter`,content:async()=>h.terminal===`Apple_Terminal`?`Press Option+Enter to send a multi-line message`:`Press Shift+Enter to send a multi-line message`,cooldownSessions:10,async isRelevant(){let e=H();return!!((h.terminal===`Apple_Terminal`?e.optionAsMetaKeyInstalled:e.shiftEnterKeyBindingInstalled)&&e.numStartups>3)}},{id:`shift-enter-setup`,content:async()=>h.terminal===`Apple_Terminal`?`Run /terminal-setup to enable Option+Enter for new lines`:`Run /terminal-setup to enable Shift+Enter for new lines`,cooldownSessions:10,async isRelevant(){if(!ae())return!1;let e=H();return!(h.terminal===`Apple_Terminal`?e.optionAsMetaKeyInstalled:e.shiftEnterKeyBindingInstalled)}},{id:`memory-command`,content:async()=>`Use /memory to view and manage Work Mate memory`,cooldownSessions:15,async isRelevant(){return H().memoryUsageCount<=0}},{id:`theme-command`,content:async()=>`Use /theme to change the color theme`,cooldownSessions:20,isRelevant:async()=>!0},{id:`colorterm-truecolor`,content:async()=>`Try setting environment variable COLORTERM=truecolor for richer colors`,cooldownSessions:30,isRelevant:async()=>!process.env.COLORTERM&&i.level<3},{id:`powershell-tool-env`,content:async()=>`Set WORKMATE_USE_POWERSHELL_TOOL=1 to enable the PowerShell tool (preview)`,cooldownSessions:10,isRelevant:async()=>Y()===`windows`&&process.env.WORKMATE_USE_POWERSHELL_TOOL===void 0},{id:`status-line`,content:async()=>`Use /statusline to set up a custom status line that will display beneath the input box`,cooldownSessions:25,isRelevant:async()=>f().statusLine===void 0},{id:`prompt-queue`,content:async()=>`Hit Enter to queue up additional messages while Work Mate is working.`,cooldownSessions:5,async isRelevant(){return H().promptQueueUseCount<=3}},{id:`enter-to-steer-in-relatime`,content:async()=>`Send messages to Work Mate while it works to steer Work Mate in real-time`,cooldownSessions:20,isRelevant:async()=>!0},{id:`todo-list`,content:async()=>`Ask Work Mate to create a todo list when working on complex tasks to track progress and remain on track`,cooldownSessions:20,isRelevant:async()=>!0},{id:`permissions`,content:async()=>`Use /permissions to pre-approve and pre-deny bash, edit, and MCP tools`,cooldownSessions:10,async isRelevant(){return H().numStartups>10}},{id:`drag-and-drop-images`,content:async()=>`Did you know you can drag and drop image files into your terminal?`,cooldownSessions:10,isRelevant:async()=>!h.isSSH()},{id:`paste-images-mac`,content:async()=>`Paste images into Work Mate using control+v (not cmd+v!)`,cooldownSessions:10,isRelevant:async()=>Y()===`macos`},{id:`double-esc`,content:async()=>`Double-tap esc to rewind the conversation to a previous point in time`,cooldownSessions:10,isRelevant:async()=>!O()},{id:`double-esc-code-restore`,content:async()=>`Double-tap esc to rewind the code and/or conversation to a previous point in time`,cooldownSessions:10,isRelevant:async()=>O()},{id:`continue`,content:async()=>`Run claude --continue or claude --resume to resume a conversation`,cooldownSessions:10,isRelevant:async()=>!0},{id:`rename-conversation`,content:async()=>`Name your conversations with /rename to find them easily in /resume later`,cooldownSessions:15,isRelevant:async()=>x()&&H().numStartups>10},{id:`custom-commands`,content:async()=>`Create skills by adding .md files to .workmate/skills/ in your project or ~/.workmate/skills/ for skills that work in any project`,cooldownSessions:15,async isRelevant(){return H().numStartups>10}},{id:`shift-tab`,content:async()=>`Hit ${E(`chat:cycleMode`,`Chat`,`shift+tab`)} to cycle between default, accept edits, plan, auto, and bypass modes`,cooldownSessions:10,isRelevant:async()=>!0},{id:`image-paste`,content:async()=>`Use ${E(`chat:imagePaste`,`Chat`,`ctrl+v`)} to paste images from your clipboard`,cooldownSessions:20,isRelevant:async()=>!0},{id:`custom-agents`,content:async()=>`Use /agents to optimize specific tasks. Eg. Software Architect, Code Writer, Code Reviewer`,cooldownSessions:15,async isRelevant(){return H().numStartups>5}},{id:`agent-flag`,content:async()=>`Use --agent <agent_name> to directly start a conversation with a subagent`,cooldownSessions:15,async isRelevant(){return H().numStartups>5}},{id:`frontend-design-plugin`,content:async e=>`Working with HTML/CSS? Install the frontend-design plugin:\n${o(`suggestion`,e?.theme??`dark`)(`/plugin install frontend-design@${M}`)}`,cooldownSessions:3,isRelevant:async e=>$(`frontend-design`,e,{filePath:/\.(html|css|htm)$/i})},{id:`vercel-plugin`,content:async e=>`Working with Vercel? Install the vercel plugin:\n${o(`suggestion`,e?.theme??`dark`)(`/plugin install vercel@${M}`)}`,cooldownSessions:3,isRelevant:async e=>$(`vercel`,e,{filePath:/(?:^|[/\\])vercel\.json$/i,cli:[`vercel`]})},{id:`subagent-fanout-nudge`,content:async e=>`Say ${o(`suggestion`,e?.theme??`dark`)(`"fan out subagents"`)} and Work Mate sends a team. Each one digs deep so nothing gets missed.`,cooldownSessions:3,isRelevant:async()=>!1}],Se=[];function Ce(){let e=g().spinnerTipsOverride;return e?.tips?.length?e.tips.map((e,t)=>({id:`custom-tip-${t}`,content:async()=>e,cooldownSessions:0,isRelevant:async()=>!0})):[]}async function we(e){let t=g().spinnerTipsOverride,n=Ce();if(t?.excludeDefault&&n.length>0)return n;let r=[...xe,...Se],i=await Promise.all(r.map(t=>t.isRelevant?.(e)??Promise.resolve(!0)));return[...r.filter((e,t)=>i[t]).filter(e=>Z(e.id)>=e.cooldownSessions),...n]}export{me as a,ve as i,Z as n,he as o,ye as r,se as s,we as t};
@@ -1 +1 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{c as t,i as n}from"./debug-2pVES-2G.js";import{o as r,s as i}from"./log-L1kqxa_P.js";import{r as a,t as o}from"./observationStore-pnSSxec_.js";import{randomUUID as s}from"node:crypto";function c(){for(let[e,t]of T)if(t.size>x){let e=t.values(),n=t.size-S;for(let r=0;r<n;r++){let n=e.next();if(n.done)break;t.delete(n.value)}}if(T.size>C){let e=T.size-w,t=0;for(let n of T.keys()){if(t>=e)break;T.delete(n),t++}}}function l(e,t){let n=T.get(e)??new Set;n.add(t),T.delete(e),T.set(e,n),c()}function u(e,t){return T.get(e)?.has(t)??!1}function d(){T.clear()}function f(e){return{id:s(),sessionId:e.sessionId,projectId:e.projectId,projectName:e.projectName,cwd:e.cwd,timestamp:new Date().toISOString(),source:`tool-hook`,turn:e.turn}}function p(){return E||(E=Promise.all([import(`./projectContext-DnJHynXv.js`),import(`./featureCheck-JOur3pHb.js`),import(`./runtimeObserver-BLq2guVy.js`)]).then(([e,t,n])=>({resolveProjectContext:e.resolveProjectContext,isSkillLearningEnabled:t.isSkillLearningEnabled,RUNTIME_SESSION_ID:n.RUNTIME_SESSION_ID,getRuntimeTurn:n.getRuntimeTurn}))),E}function m(){E=void 0}async function h(e,n,r,a){let o;try{let{resolveProjectContext:s,isSkillLearningEnabled:c,RUNTIME_SESSION_ID:l,getRuntimeTurn:u}=await p();if(!c())return a();let d=s(process.cwd());o={sessionId:r.sessionId??l,turn:r.turn??u(),projectId:d.projectId,projectName:d.projectName,cwd:d.cwd,project:d},g(o,e,n).catch(e=>{t(`skill-learning: recordToolStart error`),i(e)})}catch(e){t(`skill-learning: hook setup error`),i(e)}try{let n=await a();return o&&_(o,e,n,`success`).catch(e=>{t(`skill-learning: recordToolComplete error`),i(e)}),n}catch(n){throw o&&v(o,e,n).catch(e=>{t(`skill-learning: recordToolError error`),i(e)}),n}}async function g(e,t,n){return l(e.sessionId,e.turn),o({...f(e),event:`tool_start`,toolName:t,toolInput:b(n)},{project:e.project})}async function _(e,t,n,r=`success`){return l(e.sessionId,e.turn),o({...f(e),event:`tool_complete`,toolName:t,toolOutput:b(n),outcome:r},{project:e.project})}async function v(e,t,n){return l(e.sessionId,e.turn),o({...f(e),event:`tool_complete`,toolName:t,toolOutput:b(n),outcome:`failure`},{project:e.project})}async function y(e,t){return l(e.sessionId,e.turn),o({...f(e),event:`user_message`,messageText:t},{project:e.project})}function b(e){if(e!=null){if(typeof e==`string`)return e;try{return JSON.stringify(e)}catch{return String(e)}}}var x,S,C,w,T,E;e((()=>{a(),n(),r(),x=500,S=250,C=50,w=25,T=new Map}))();export{u as hasToolHookObservationsForTurn,c as pruneEmittedTurns,_ as recordToolComplete,v as recordToolError,g as recordToolStart,y as recordUserCorrection,d as resetToolHookBookkeeping,m as resetToolHookDepsCache,h as runToolCallWithSkillLearningHooks};
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{c as t,i as n}from"./debug-2pVES-2G.js";import{o as r,s as i}from"./log-L1kqxa_P.js";import{r as a,t as o}from"./observationStore-pnSSxec_.js";import{randomUUID as s}from"node:crypto";function c(){for(let[e,t]of T)if(t.size>x){let e=t.values(),n=t.size-S;for(let r=0;r<n;r++){let n=e.next();if(n.done)break;t.delete(n.value)}}if(T.size>C){let e=T.size-w,t=0;for(let n of T.keys()){if(t>=e)break;T.delete(n),t++}}}function l(e,t){let n=T.get(e)??new Set;n.add(t),T.delete(e),T.set(e,n),c()}function u(e,t){return T.get(e)?.has(t)??!1}function d(){T.clear()}function f(e){return{id:s(),sessionId:e.sessionId,projectId:e.projectId,projectName:e.projectName,cwd:e.cwd,timestamp:new Date().toISOString(),source:`tool-hook`,turn:e.turn}}function p(){return E||(E=Promise.all([import(`./projectContext-DnJHynXv.js`),import(`./featureCheck-JOur3pHb.js`),import(`./runtimeObserver-Ess1Cn8Y.js`)]).then(([e,t,n])=>({resolveProjectContext:e.resolveProjectContext,isSkillLearningEnabled:t.isSkillLearningEnabled,RUNTIME_SESSION_ID:n.RUNTIME_SESSION_ID,getRuntimeTurn:n.getRuntimeTurn}))),E}function m(){E=void 0}async function h(e,n,r,a){let o;try{let{resolveProjectContext:s,isSkillLearningEnabled:c,RUNTIME_SESSION_ID:l,getRuntimeTurn:u}=await p();if(!c())return a();let d=s(process.cwd());o={sessionId:r.sessionId??l,turn:r.turn??u(),projectId:d.projectId,projectName:d.projectName,cwd:d.cwd,project:d},g(o,e,n).catch(e=>{t(`skill-learning: recordToolStart error`),i(e)})}catch(e){t(`skill-learning: hook setup error`),i(e)}try{let n=await a();return o&&_(o,e,n,`success`).catch(e=>{t(`skill-learning: recordToolComplete error`),i(e)}),n}catch(n){throw o&&v(o,e,n).catch(e=>{t(`skill-learning: recordToolError error`),i(e)}),n}}async function g(e,t,n){return l(e.sessionId,e.turn),o({...f(e),event:`tool_start`,toolName:t,toolInput:b(n)},{project:e.project})}async function _(e,t,n,r=`success`){return l(e.sessionId,e.turn),o({...f(e),event:`tool_complete`,toolName:t,toolOutput:b(n),outcome:r},{project:e.project})}async function v(e,t,n){return l(e.sessionId,e.turn),o({...f(e),event:`tool_complete`,toolName:t,toolOutput:b(n),outcome:`failure`},{project:e.project})}async function y(e,t){return l(e.sessionId,e.turn),o({...f(e),event:`user_message`,messageText:t},{project:e.project})}function b(e){if(e!=null){if(typeof e==`string`)return e;try{return JSON.stringify(e)}catch{return String(e)}}}var x,S,C,w,T,E;e((()=>{a(),n(),r(),x=500,S=250,C=50,w=25,T=new Map}))();export{u as hasToolHookObservationsForTurn,c as pruneEmittedTurns,_ as recordToolComplete,v as recordToolError,g as recordToolStart,y as recordUserCorrection,d as resetToolHookBookkeeping,m as resetToolHookDepsCache,h as runToolCallWithSkillLearningHooks};
@@ -0,0 +1 @@
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{mC as t,nf as n,pC as r,tf as i}from"./loadAgentsDir-BfLCckVj.js";import{n as a,t as o}from"./partition-BavNaw1S.js";function s(e,r,i){let[o,s]=a(t([...e,...r],`name`),n),c=(e,t)=>e.name.localeCompare(t.name);return[...s.sort(c),...o.sort(c)]}var c=e((()=>{o(),r(),i()}));export{s as n,c as t};
@@ -1 +1 @@
1
- import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{Gt as n,ai as r,et as i,t as a,vt as o}from"./src-BX54x08P.js";import{tb as s}from"./loadAgentsDir-bmpKLPdG.js";import{t as c}from"./useDoublePress-zA5QwIpO.js";function l(e,t,n,r=!0){let{exit:a}=o(),[s,c]=(0,u.useState)({pending:!1,keyName:null}),l=(0,u.useMemo)(()=>n??a,[n,a]),d=i(e=>c({pending:e,keyName:`Ctrl-C`}),l),f=i(e=>c({pending:e,keyName:`Ctrl-D`}),l),p=(0,u.useCallback)(()=>{t?.()||d()},[d,t]),m=(0,u.useCallback)(()=>{f()},[f]);return e((0,u.useMemo)(()=>({"app:interrupt":p,"app:exit":m}),[p,m]),{context:`Global`,isActive:r}),s}var u,d=e((()=>{u=t(r(),1),a(),c()}));function f(e,t,r){return l(n,t,e,r)}var p=e((()=>{s(),d()}));export{f as n,p as t};
1
+ import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{Gt as n,ai as r,et as i,t as a,vt as o}from"./src-BX54x08P.js";import{rb as s}from"./loadAgentsDir-BfLCckVj.js";import{t as c}from"./useDoublePress-zA5QwIpO.js";function l(e,t,n,r=!0){let{exit:a}=o(),[s,c]=(0,u.useState)({pending:!1,keyName:null}),l=(0,u.useMemo)(()=>n??a,[n,a]),d=i(e=>c({pending:e,keyName:`Ctrl-C`}),l),f=i(e=>c({pending:e,keyName:`Ctrl-D`}),l),p=(0,u.useCallback)(()=>{t?.()||d()},[d,t]),m=(0,u.useCallback)(()=>{f()},[f]);return e((0,u.useMemo)(()=>({"app:interrupt":p,"app:exit":m}),[p,m]),{context:`Global`,isActive:r}),s}var u,d=e((()=>{u=t(r(),1),a(),c()}));function f(e,t,r){return l(n,t,e,r)}var p=e((()=>{s(),d()}));export{f as n,p as t};
@@ -0,0 +1 @@
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{Hh as t,Vh as n}from"./loadAgentsDir-BfLCckVj.js";import{f as r,i,v as a}from"./model-BIf2i1is.js";function o(){let e=t(e=>e.mainLoopModel);return a(t(e=>e.mainLoopModelForSession)??e??i())}var s=e((()=>{n(),r()}));export{o as n,s as t};
@@ -1 +1 @@
1
- import{o as e}from"./rolldown-runtime-DaDcL9Zw.js";import{ai as t}from"./src-BX54x08P.js";import{$n as n,Qn as r,di as i,ui as a}from"./settings-D4M13toi.js";import{Bh as o,Fa as s,Go as c,Hh as l,Hm as u,Km as d,Ko as f,Pa as p,Wm as m,Xo as h,Zo as g,_f as _,c_ as v,qm as y,s_ as b,vf as x,zh as S}from"./loadAgentsDir-bmpKLPdG.js";import{I as C,V as w,c as T,i as E}from"./debug-2pVES-2G.js";import{o as D,s as O}from"./log-L1kqxa_P.js";import{n as k}from"./analytics-COpjZpvd.js";import{n as A,t as j}from"./notifications-BwS1XsnZ.js";import{n as M,r as N}from"./pluginFlagging-B2ZX5_oB.js";import{t as P}from"./pluginBlocklist-ByRQaVPu.js";var F=e(t(),1);j(),k(),u(),S(),n(),E(),a(),C(),D(),h(),f(),b(),d(),_(),N(),p();function I({enabled:e=!0}={}){let t=l(),n=o(e=>e.plugins.needsRefresh),{addNotification:a}=A(),u=(0,F.useCallback)(async()=>{try{let{enabled:e,disabled:n,errors:i}=await s();await P();let o=M();Object.keys(o).length>0&&a({key:`plugin-delisted-flagged`,text:`Plugins flagged. Check /plugins`,color:`warning`,priority:`high`});let l=[],u=[];try{l=await c()}catch(e){let t=e instanceof Error?e.message:String(e);i.push({type:`generic-error`,source:`plugin-commands`,error:`Failed to load plugin commands: ${t}`})}try{u=await g()}catch(e){let t=e instanceof Error?e.message:String(e);i.push({type:`generic-error`,source:`plugin-agents`,error:`Failed to load plugin agents: ${t}`})}try{await v()}catch(e){let t=e instanceof Error?e.message:String(e);i.push({type:`generic-error`,source:`plugin-hooks`,error:`Failed to load plugin hooks: ${t}`})}let d=(await Promise.all(e.map(async e=>{if(e.mcpServers)return Object.keys(e.mcpServers).length;let t=await x(e,i);return t&&(e.mcpServers=t),t?Object.keys(t).length:0}))).reduce((e,t)=>e+t,0),f=(await Promise.all(e.map(async e=>{if(e.lspServers)return Object.keys(e.lspServers).length;let t=await y(e,i);return t&&(e.lspServers=t),t?Object.keys(t).length:0}))).reduce((e,t)=>e+t,0);m(),t(t=>{let r=t.plugins.errors.filter(e=>e.source===`lsp-manager`||e.source.startsWith(`plugin:`)),a=new Set(i.map(e=>e.type===`generic-error`?`generic-error:${e.source}:${e.error}`:`${e.type}:${e.source}`)),o=[...r.filter(e=>{let t=e.type===`generic-error`?`generic-error:${e.source}:${e.error}`:`${e.type}:${e.source}`;return!a.has(t)}),...i];return{...t,plugins:{...t.plugins,enabled:e,disabled:n,commands:l,errors:o}}}),T(`Loaded plugins - Enabled: ${e.length}, Disabled: ${n.length}, Commands: ${l.length}, Agents: ${u.length}, Errors: ${i.length}`);let p=e.reduce((e,t)=>t.hooksConfig?e+Object.values(t.hooksConfig).reduce((e,t)=>e+(t?.reduce((e,t)=>e+t.hooks.length,0)??0),0):e,0);return{enabled_count:e.length,disabled_count:n.length,inline_count:r(e,e=>e.source.endsWith(`@inline`)),marketplace_count:r(e,e=>!e.source.endsWith(`@inline`)),error_count:i.length,skill_count:l.length,agent_count:u.length,hook_count:p,mcp_count:d,lsp_count:f}}catch(e){let n=w(e);return O(n),T(`Error loading plugins: ${e}`),t(e=>{let t=e.plugins.errors.filter(e=>e.source===`lsp-manager`||e.source.startsWith(`plugin:`)),r={type:`generic-error`,source:`plugin-system`,error:n.message};return{...e,plugins:{...e.plugins,enabled:[],disabled:[],commands:[],errors:[...t,r]}}}),{enabled_count:0,disabled_count:0,inline_count:0,marketplace_count:0,error_count:1,skill_count:0,agent_count:0,hook_count:0,mcp_count:0,lsp_count:0,load_failed:!0,ant_enabled_names:void 0}}},[t,a]);(0,F.useEffect)(()=>{e&&u().then(e=>{let{ant_enabled_names:t,...n}=e,r={...n,has_custom_plugin_cache_dir:!!process.env.WORKMATE_PLUGIN_CACHE_DIR};({...r,...t!==void 0&&{enabled_names:t}}),i(`info`,`tengu_plugins_loaded`,r)})},[u,e]),(0,F.useEffect)(()=>{!e||!n||a({key:`plugin-reload-pending`,text:`Plugins changed. Run /reload-plugins to activate.`,color:`suggestion`,priority:`low`})},[e,n,a])}export{I as t};
1
+ import{o as e}from"./rolldown-runtime-DaDcL9Zw.js";import{ai as t}from"./src-BX54x08P.js";import{$n as n,Qn as r,di as i,ui as a}from"./settings-D4M13toi.js";import{$o as o,Hh as s,Ia as c,Jm as l,Jo as u,Km as d,La as f,Qo as p,Vh as m,Wh as h,Wm as g,Ym as _,bf as v,l_ as y,qo as b,u_ as x,yf as S}from"./loadAgentsDir-BfLCckVj.js";import{I as C,V as w,c as T,i as E}from"./debug-2pVES-2G.js";import{o as D,s as O}from"./log-L1kqxa_P.js";import{n as k}from"./analytics-COpjZpvd.js";import{n as A,t as j}from"./notifications-B5gzCmPC.js";import{n as M,r as N}from"./pluginFlagging-CRuX6sHR.js";import{t as P}from"./pluginBlocklist-CpkjXXKQ.js";var F=e(t(),1);j(),k(),g(),m(),n(),E(),a(),C(),D(),p(),u(),y(),l(),S(),N(),c();function I({enabled:e=!0}={}){let t=h(),n=s(e=>e.plugins.needsRefresh),{addNotification:a}=A(),c=(0,F.useCallback)(async()=>{try{let{enabled:e,disabled:n,errors:i}=await f();await P();let s=M();Object.keys(s).length>0&&a({key:`plugin-delisted-flagged`,text:`Plugins flagged. Check /plugins`,color:`warning`,priority:`high`});let c=[],l=[];try{c=await b()}catch(e){let t=e instanceof Error?e.message:String(e);i.push({type:`generic-error`,source:`plugin-commands`,error:`Failed to load plugin commands: ${t}`})}try{l=await o()}catch(e){let t=e instanceof Error?e.message:String(e);i.push({type:`generic-error`,source:`plugin-agents`,error:`Failed to load plugin agents: ${t}`})}try{await x()}catch(e){let t=e instanceof Error?e.message:String(e);i.push({type:`generic-error`,source:`plugin-hooks`,error:`Failed to load plugin hooks: ${t}`})}let u=(await Promise.all(e.map(async e=>{if(e.mcpServers)return Object.keys(e.mcpServers).length;let t=await v(e,i);return t&&(e.mcpServers=t),t?Object.keys(t).length:0}))).reduce((e,t)=>e+t,0),p=(await Promise.all(e.map(async e=>{if(e.lspServers)return Object.keys(e.lspServers).length;let t=await _(e,i);return t&&(e.lspServers=t),t?Object.keys(t).length:0}))).reduce((e,t)=>e+t,0);d(),t(t=>{let r=t.plugins.errors.filter(e=>e.source===`lsp-manager`||e.source.startsWith(`plugin:`)),a=new Set(i.map(e=>e.type===`generic-error`?`generic-error:${e.source}:${e.error}`:`${e.type}:${e.source}`)),o=[...r.filter(e=>{let t=e.type===`generic-error`?`generic-error:${e.source}:${e.error}`:`${e.type}:${e.source}`;return!a.has(t)}),...i];return{...t,plugins:{...t.plugins,enabled:e,disabled:n,commands:c,errors:o}}}),T(`Loaded plugins - Enabled: ${e.length}, Disabled: ${n.length}, Commands: ${c.length}, Agents: ${l.length}, Errors: ${i.length}`);let m=e.reduce((e,t)=>t.hooksConfig?e+Object.values(t.hooksConfig).reduce((e,t)=>e+(t?.reduce((e,t)=>e+t.hooks.length,0)??0),0):e,0);return{enabled_count:e.length,disabled_count:n.length,inline_count:r(e,e=>e.source.endsWith(`@inline`)),marketplace_count:r(e,e=>!e.source.endsWith(`@inline`)),error_count:i.length,skill_count:c.length,agent_count:l.length,hook_count:m,mcp_count:u,lsp_count:p}}catch(e){let n=w(e);return O(n),T(`Error loading plugins: ${e}`),t(e=>{let t=e.plugins.errors.filter(e=>e.source===`lsp-manager`||e.source.startsWith(`plugin:`)),r={type:`generic-error`,source:`plugin-system`,error:n.message};return{...e,plugins:{...e.plugins,enabled:[],disabled:[],commands:[],errors:[...t,r]}}}),{enabled_count:0,disabled_count:0,inline_count:0,marketplace_count:0,error_count:1,skill_count:0,agent_count:0,hook_count:0,mcp_count:0,lsp_count:0,load_failed:!0,ant_enabled_names:void 0}}},[t,a]);(0,F.useEffect)(()=>{e&&c().then(e=>{let{ant_enabled_names:t,...n}=e,r={...n,has_custom_plugin_cache_dir:!!process.env.WORKMATE_PLUGIN_CACHE_DIR};({...r,...t!==void 0&&{enabled_names:t}}),i(`info`,`tengu_plugins_loaded`,r)})},[c,e]),(0,F.useEffect)(()=>{!e||!n||a({key:`plugin-reload-pending`,text:`Plugins changed. Run /reload-plugins to activate.`,color:`suggestion`,priority:`low`})},[e,n,a])}export{I as t};
@@ -0,0 +1 @@
1
+ import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{ai as n}from"./src-BX54x08P.js";import{Tc as r,kc as i}from"./loadAgentsDir-BfLCckVj.js";import{n as a,t as o}from"./toolPool-CWIXwdX7.js";function s(e,t,n){return(0,c.useMemo)(()=>a(e,r(n,t),n.mode),[e,t,n,!1,!1])}var c,l=e((()=>{c=t(n(),1),i(),o()}));export{s as n,l as t};
@@ -1 +1 @@
1
- import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{Vn as n,ai as r,hn as i,ot as a,t as o}from"./src-BX54x08P.js";import{sb as s}from"./loadAgentsDir-bmpKLPdG.js";import{_ as c,b as l,d as u,g as d,h as f,l as p,u as m,v as h,y as g}from"./TextInput-ou7ZhpVY.js";function _(e){return!!(e.ctrl&&(e.key===`k`||e.key===`u`||e.key===`w`)||e.meta&&e.key===`backspace`)}function v(e){return(e.ctrl||e.meta)&&e.key===`y`}function y({isActive:e,onExit:t,onCancel:r,onExitUp:o,columns:s,passthroughCtrlKeys:u=[],initialQuery:y=``,backspaceExitsOnEmpty:S=!0}){let{columns:C}=a(),w=s??C,[T,E]=(0,b.useState)(y),[D,O]=(0,b.useState)(y.length),k=(0,b.useCallback)(e=>{E(e),O(e.length)},[]),A=n=>{if(!e)return;let i=p.fromText(T,w,D);if(!(n.ctrl&&u.includes(n.key.toLowerCase()))){if(_(n)||c(),v(n)||h(),n.key===`return`||n.key===`down`){n.preventDefault(),t();return}if(n.key===`up`){n.preventDefault(),o&&o();return}if(n.key===`escape`){n.preventDefault(),r?r():T.length>0?(E(``),O(0)):t();return}if(n.key===`backspace`){if(n.preventDefault(),n.meta){let{cursor:e,killed:t}=i.deleteWordBefore();f(t,`prepend`),E(e.text),O(e.offset);return}if(T.length===0){S&&(r??t)();return}let e=i.backspace();E(e.text),O(e.offset);return}if(n.key===`delete`){n.preventDefault();let e=i.del();E(e.text),O(e.offset);return}if(n.key===`left`&&(n.ctrl||n.meta||n.fn)){n.preventDefault();let e=i.prevWord();O(e.offset);return}if(n.key===`right`&&(n.ctrl||n.meta||n.fn)){n.preventDefault();let e=i.nextWord();O(e.offset);return}if(n.key===`left`){n.preventDefault();let e=i.left();O(e.offset);return}if(n.key===`right`){n.preventDefault();let e=i.right();O(e.offset);return}if(n.key===`home`){n.preventDefault(),O(0);return}if(n.key===`end`){n.preventDefault(),O(T.length);return}if(n.ctrl){switch(n.preventDefault(),n.key.toLowerCase()){case`a`:O(0);return;case`e`:O(T.length);return;case`b`:O(i.left().offset);return;case`f`:O(i.right().offset);return;case`d`:{if(T.length===0){(r??t)();return}let e=i.del();E(e.text),O(e.offset);return}case`h`:{if(T.length===0){S&&(r??t)();return}let e=i.backspace();E(e.text),O(e.offset);return}case`k`:{let{cursor:e,killed:t}=i.deleteToLineEnd();f(t,`append`),E(e.text),O(e.offset);return}case`u`:{let{cursor:e,killed:t}=i.deleteToLineStart();f(t,`prepend`),E(e.text),O(e.offset);return}case`w`:{let{cursor:e,killed:t}=i.deleteWordBefore();f(t,`prepend`),E(e.text),O(e.offset);return}case`y`:{let e=m();if(e.length>0){let t=i.offset,n=i.insert(e);d(t,e.length),E(n.text),O(n.offset)}return}case`g`:case`c`:if(r){r();return}}return}if(n.meta){switch(n.preventDefault(),n.key.toLowerCase()){case`b`:O(i.prevWord().offset);return;case`f`:O(i.nextWord().offset);return;case`d`:{let e=i.deleteWordAfter();E(e.text),O(e.offset);return}case`y`:{let e=l();if(e){let{text:t,start:n,length:r}=e,i=T.slice(0,n),a=T.slice(n+r),o=i+t+a,s=n+t.length;g(t.length),E(o),O(s)}return}}return}if(n.key!==`tab`&&n.key.length>=1&&!x.has(n.key)){n.preventDefault();let e=i.insert(n.key);E(e.text),O(e.offset)}}};return i((e,t,r)=>{A(new n(r.keypress))},{isActive:e}),{query:T,setQuery:k,cursorOffset:D,handleKeyDown:A}}var b,x,S=e((()=>{b=t(r(),1),o(),u(),s(),x=new Set([`pageup`,`pagedown`,`insert`,`wheelup`,`wheeldown`,`mouse`,`f1`,`f2`,`f3`,`f4`,`f5`,`f6`,`f7`,`f8`,`f9`,`f10`,`f11`,`f12`])}));export{y as n,S as t};
1
+ import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{Vn as n,ai as r,hn as i,ot as a,t as o}from"./src-BX54x08P.js";import{lb as s}from"./loadAgentsDir-BfLCckVj.js";import{_ as c,b as l,d as u,g as d,h as f,l as p,u as m,v as h,y as g}from"./TextInput-BVEWdRz9.js";function _(e){return!!(e.ctrl&&(e.key===`k`||e.key===`u`||e.key===`w`)||e.meta&&e.key===`backspace`)}function v(e){return(e.ctrl||e.meta)&&e.key===`y`}function y({isActive:e,onExit:t,onCancel:r,onExitUp:o,columns:s,passthroughCtrlKeys:u=[],initialQuery:y=``,backspaceExitsOnEmpty:S=!0}){let{columns:C}=a(),w=s??C,[T,E]=(0,b.useState)(y),[D,O]=(0,b.useState)(y.length),k=(0,b.useCallback)(e=>{E(e),O(e.length)},[]),A=n=>{if(!e)return;let i=p.fromText(T,w,D);if(!(n.ctrl&&u.includes(n.key.toLowerCase()))){if(_(n)||c(),v(n)||h(),n.key===`return`||n.key===`down`){n.preventDefault(),t();return}if(n.key===`up`){n.preventDefault(),o&&o();return}if(n.key===`escape`){n.preventDefault(),r?r():T.length>0?(E(``),O(0)):t();return}if(n.key===`backspace`){if(n.preventDefault(),n.meta){let{cursor:e,killed:t}=i.deleteWordBefore();f(t,`prepend`),E(e.text),O(e.offset);return}if(T.length===0){S&&(r??t)();return}let e=i.backspace();E(e.text),O(e.offset);return}if(n.key===`delete`){n.preventDefault();let e=i.del();E(e.text),O(e.offset);return}if(n.key===`left`&&(n.ctrl||n.meta||n.fn)){n.preventDefault();let e=i.prevWord();O(e.offset);return}if(n.key===`right`&&(n.ctrl||n.meta||n.fn)){n.preventDefault();let e=i.nextWord();O(e.offset);return}if(n.key===`left`){n.preventDefault();let e=i.left();O(e.offset);return}if(n.key===`right`){n.preventDefault();let e=i.right();O(e.offset);return}if(n.key===`home`){n.preventDefault(),O(0);return}if(n.key===`end`){n.preventDefault(),O(T.length);return}if(n.ctrl){switch(n.preventDefault(),n.key.toLowerCase()){case`a`:O(0);return;case`e`:O(T.length);return;case`b`:O(i.left().offset);return;case`f`:O(i.right().offset);return;case`d`:{if(T.length===0){(r??t)();return}let e=i.del();E(e.text),O(e.offset);return}case`h`:{if(T.length===0){S&&(r??t)();return}let e=i.backspace();E(e.text),O(e.offset);return}case`k`:{let{cursor:e,killed:t}=i.deleteToLineEnd();f(t,`append`),E(e.text),O(e.offset);return}case`u`:{let{cursor:e,killed:t}=i.deleteToLineStart();f(t,`prepend`),E(e.text),O(e.offset);return}case`w`:{let{cursor:e,killed:t}=i.deleteWordBefore();f(t,`prepend`),E(e.text),O(e.offset);return}case`y`:{let e=m();if(e.length>0){let t=i.offset,n=i.insert(e);d(t,e.length),E(n.text),O(n.offset)}return}case`g`:case`c`:if(r){r();return}}return}if(n.meta){switch(n.preventDefault(),n.key.toLowerCase()){case`b`:O(i.prevWord().offset);return;case`f`:O(i.nextWord().offset);return;case`d`:{let e=i.deleteWordAfter();E(e.text),O(e.offset);return}case`y`:{let e=l();if(e){let{text:t,start:n,length:r}=e,i=T.slice(0,n),a=T.slice(n+r),o=i+t+a,s=n+t.length;g(t.length),E(o),O(s)}return}}return}if(n.key!==`tab`&&n.key.length>=1&&!x.has(n.key)){n.preventDefault();let e=i.insert(n.key);E(e.text),O(e.offset)}}};return i((e,t,r)=>{A(new n(r.keypress))},{isActive:e}),{query:T,setQuery:k,cursorOffset:D,handleKeyDown:A}}var b,x,S=e((()=>{b=t(r(),1),o(),u(),s(),x=new Set([`pageup`,`pagedown`,`insert`,`wheelup`,`wheeldown`,`mouse`,`f1`,`f2`,`f3`,`f4`,`f5`,`f6`,`f7`,`f8`,`f9`,`f10`,`f11`,`f12`])}));export{y as n,S as t};
@@ -0,0 +1 @@
1
+ import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{ai as n}from"./src-BX54x08P.js";import{Jh as r,qh as i}from"./loadAgentsDir-BfLCckVj.js";import{n as a,t as o}from"./notifications-B5gzCmPC.js";import{n as s,t as c}from"./allErrors-CkdguCDv.js";function l(){let{addNotification:e,removeNotification:t}=a(),[n,i]=(0,u.useState)(()=>{let{errors:e}=c();return e});return r((0,u.useCallback)(()=>{let{errors:e}=c();i(e)},[])),(0,u.useEffect)(()=>{if(n.length>0){let t=`Found ${n.length} settings ${n.length===1?`issue`:`issues`} · /doctor for details`;e({key:d,text:t,color:`warning`,priority:`high`,timeoutMs:6e4})}else t(d)},[n,e,t]),n}var u,d,f=e((()=>{u=t(n(),1),o(),s(),i(),d=`settings-errors`}));export{l as n,f as t};
@@ -1 +1 @@
1
- import{o as e}from"./rolldown-runtime-DaDcL9Zw.js";import{ai as t}from"./src-BX54x08P.js";import{t as n}from"./jsx-runtime-Bb4Xn-E0.js";import{Lh as r,zh as i}from"./loadAgentsDir-bmpKLPdG.js";import{n as a}from"./analytics-COpjZpvd.js";import{t as o}from"./useManagePlugins-pGaGzsEg.js";import{t as s}from"./KeybindingProviderSetup-syiDgtpB.js";import{n as c,t as l}from"./MCPConnectionManager-C7RmKzJh.js";import{cwd as u}from"process";var d=e(t(),1);a(),c(),i();var f=n(),p=d.lazy(()=>import(`./Doctor-B6isid5K.js`).then(e=>({default:e.Doctor})));function m({onDone:e}){return o(),(0,f.jsx)(d.Suspense,{fallback:null,children:(0,f.jsx)(p,{onDone:e})})}async function h(e){await new Promise(t=>{e.render((0,f.jsx)(r,{children:(0,f.jsx)(s,{children:(0,f.jsx)(l,{dynamicMcpConfig:void 0,isStrictMcpConfig:!1,children:(0,f.jsx)(m,{onDone:()=>{t()}})})})}))}),e.unmount(),process.exit(0)}async function g(e,t){let{setup:n}=await import(`./setup-DVLnIlse.js`);await n(u(),`default`,!1,!1,void 0,!1);let{install:r}=await import(`./install-DIxyfdXG.js`);await new Promise(n=>{let i=[];e&&i.push(e),t.force&&i.push(`--force`),r.call(e=>{n(),process.exit(+!!e.includes(`failed`))},{},i)})}export{h as doctorHandler,g as installHandler};
1
+ import{o as e}from"./rolldown-runtime-DaDcL9Zw.js";import{ai as t}from"./src-BX54x08P.js";import{t as n}from"./jsx-runtime-Bb4Xn-E0.js";import{Vh as r,zh as i}from"./loadAgentsDir-BfLCckVj.js";import{n as a}from"./analytics-COpjZpvd.js";import{t as o}from"./useManagePlugins-CmsPSHor.js";import{t as s}from"./KeybindingProviderSetup-eE3o0bfp.js";import{n as c,t as l}from"./MCPConnectionManager-D-qpUJLV.js";import{cwd as u}from"process";var d=e(t(),1);a(),c(),r();var f=n(),p=d.lazy(()=>import(`./Doctor-CcLoI7tF.js`).then(e=>({default:e.Doctor})));function m({onDone:e}){return o(),(0,f.jsx)(d.Suspense,{fallback:null,children:(0,f.jsx)(p,{onDone:e})})}async function h(e){await new Promise(t=>{e.render((0,f.jsx)(i,{children:(0,f.jsx)(s,{children:(0,f.jsx)(l,{dynamicMcpConfig:void 0,isStrictMcpConfig:!1,children:(0,f.jsx)(m,{onDone:()=>{t()}})})})}))}),e.unmount(),process.exit(0)}async function g(e,t){let{setup:n}=await import(`./setup-BbyfyeQk.js`);await n(u(),`default`,!1,!1,void 0,!1);let{install:r}=await import(`./install-xlfTw1j6.js`);await new Promise(n=>{let i=[];e&&i.push(e),t.force&&i.push(`--force`),r.call(e=>{n(),process.exit(+!!e.includes(`failed`))},{},i)})}export{h as doctorHandler,g as installHandler};
@@ -0,0 +1 @@
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{n as t,t as n}from"./axios-DaWTGg7G.js";import{Ni as r,Wi as i,dt as a,gt as o,ht as s,mt as c,pt as l}from"./settings-D4M13toi.js";import{Cw as ee,Sw as u,_x as d,bw as f,dx as p,gx as te,ux as m,vx as h,yw as g}from"./loadAgentsDir-BfLCckVj.js";import{C as _,I as v,M as y,N as b,R as x,S,c as C,f as w,i as T,u as E,x as D}from"./debug-2pVES-2G.js";import{o as ne,s as O}from"./log-L1kqxa_P.js";import{homedir as re}from"os";import*as k from"path";import{join as ie,resolve as ae}from"path";import{randomBytes as oe}from"crypto";import{readFile as A,readdir as j,rename as M,stat as N,unlink as P,writeFile as F}from"fs/promises";function I(){return ie(m(),U)}async function L(){let e=I();try{let t=S(await A(e,{encoding:`utf-8`}));if(typeof t!=`object`||!t||!(`version`in t)||!(`fetchedAt`in t)||!(`counts`in t))return C(`Install counts cache has invalid structure`),null;let n=t;if(n.version!==H)return C(`Install counts cache version mismatch (got ${n.version}, expected ${H})`),null;if(typeof n.fetchedAt!=`string`||!Array.isArray(n.counts))return C(`Install counts cache has invalid structure`),null;let r=new Date(n.fetchedAt).getTime();return Number.isNaN(r)?(C(`Install counts cache has invalid fetchedAt timestamp`),null):n.counts.every(e=>typeof e==`object`&&!!e&&typeof e.plugin==`string`&&typeof e.unique_installs==`number`)?Date.now()-r>G?(C(`Install counts cache is stale (>24h old)`),null):{version:n.version,fetchedAt:n.fetchedAt,counts:n.counts}:(C(`Install counts cache has malformed entries`),null)}catch(e){return b(e)!==`ENOENT`&&C(`Failed to load install counts cache: ${y(e)}`),null}}async function R(e){let t=I(),n=`${t}.${oe(8).toString(`hex`)}.tmp`;try{let r=m();await E().mkdir(r),await F(n,_(e,null,2),{encoding:`utf-8`,mode:384}),await M(n,t),C(`Install counts cache saved successfully`)}catch(e){O(e);try{await P(n)}catch{}}}async function z(){C(`Fetching install counts from ${W}`);let e=performance.now();try{let n=await t.get(W,{timeout:1e4});if(!n.data?.plugins||!Array.isArray(n.data.plugins))throw Error(`Invalid response format from install counts API`);return h(`install_counts`,W,`success`,performance.now()-e),n.data.plugins}catch(t){throw h(`install_counts`,W,`failure`,performance.now()-e,te(t)),t}}async function B(){let e=await L();if(e){C(`Using cached install counts`),h(`install_counts`,W,`cache_hit`,0);let t=new Map;for(let n of e.counts)t.set(n.plugin,n.unique_installs);return t}try{let e=await z();await R({version:H,fetchedAt:new Date().toISOString(),counts:e});let t=new Map;for(let n of e)t.set(n.plugin,n.unique_installs);return t}catch(e){return O(e),C(`Failed to fetch install counts: ${y(e)}`),null}}function V(e){if(e<1e3)return String(e);if(e<1e6){let t=(e/1e3).toFixed(1);return t.endsWith(`.0`)?`${t.slice(0,-2)}K`:`${t}K`}let t=(e/1e6).toFixed(1);return t.endsWith(`.0`)?`${t.slice(0,-2)}M`:`${t}M`}var H,U,W,G,K=e((()=>{n(),T(),v(),w(),ne(),D(),d(),p(),H=1,U=`install-counts-cache.json`,W=`https://raw.githubusercontent.com/anthropics/claude-plugins-official/refs/heads/stats/stats/plugin-installs.json`,G=1440*60*1e3}));async function se(e){let t=e.trim(),n=E(),r=t.match(/^([a-zA-Z0-9._-]+@[^:]+:.+?(?:\.git)?)(#(.+))?$/);if(r?.[1]){let e=r[1],t=r[3];return t?{source:`git`,url:e,ref:t}:{source:`git`,url:e}}if(t.startsWith(`http://`)||t.startsWith(`https://`)){let e=t.match(/^([^#]+)(#(.+))?$/),n=e?.[1]||t,r=e?.[3];if(n.endsWith(`.git`)||n.includes(`/_git/`))return r?{source:`git`,url:n,ref:r}:{source:`git`,url:n};let i;try{i=new URL(n)}catch{return{source:`url`,url:n}}if((i.hostname===`github.com`||i.hostname===`www.github.com`)&&i.pathname.match(/^\/([^/]+\/[^/]+?)(\/|\.git|$)/)?.[1]){let e=n.endsWith(`.git`)?n:`${n}.git`;return r?{source:`git`,url:e,ref:r}:{source:`git`,url:e}}return{source:`url`,url:n}}let i=process.platform===`win32`&&(t.startsWith(`.\\`)||t.startsWith(`..\\`)||/^[a-zA-Z]:[/\\]/.test(t));if(t.startsWith(`./`)||t.startsWith(`../`)||t.startsWith(`/`)||t.startsWith(`~`)||i){let e=ae(t.startsWith(`~`)?t.replace(/^~/,re()):t),r;try{r=await n.stat(e)}catch(t){let n=b(t);return{error:n===`ENOENT`?`Path does not exist: ${e}`:`Cannot access path: ${e} (${n??t})`}}return r.isFile()?e.endsWith(`.json`)?{source:`file`,path:e}:{error:`File path must point to a .json file (marketplace.json), but got: ${e}`}:r.isDirectory()?{source:`directory`,path:e}:{error:`Path is neither a file nor a directory: ${e}`}}if(t.includes(`/`)&&!t.startsWith(`@`)){if(t.includes(`:`))return null;let e=t.match(/^([^#@]+)(?:[#@](.+))?$/),n=e?.[1]||t,r=e?.[2];return r?{source:`github`,repo:n,ref:r}:{source:`github`,repo:n}}return null}var ce=e((()=>{v(),w()}));function le(e){let t=k.basename(e),n=k.basename(k.dirname(e));return t===`plugin.json`?`plugin`:t===`marketplace.json`?`marketplace`:n===`.claude-plugin`?`plugin`:`unknown`}function q(e){return e.issues.map(e=>({path:e.path.join(`.`)||`root`,message:e.message,code:e.code}))}function J(e,t,n,r){e.includes(`..`)&&n.push({path:t,message:r?`Path contains "..": ${e}. ${r}`:`Path contains ".." which could be a path traversal attempt: ${e}`})}function ue(e){let t=e.replace(/^(\.\.\/)+/,``);return`Plugin source paths are resolved relative to the marketplace root (the directory containing .claude-plugin/), not relative to marketplace.json. Use "${t===e?`./plugins/my-plugin`:`./${t}`}" instead of "${e}".`}async function Y(e){let t=[],n=[],r=k.resolve(e),i;try{i=await A(r,{encoding:`utf-8`})}catch(e){let t=b(e),n;return n=t===`ENOENT`?`File not found: ${r}`:t===`EISDIR`?`Path is not a file: ${r}`:`Failed to read file: ${y(e)}`,{success:!1,errors:[{path:`file`,message:n,code:t}],warnings:[],filePath:r,fileType:`plugin`}}let a;try{a=S(i)}catch(e){return{success:!1,errors:[{path:`json`,message:`Invalid JSON syntax: ${y(e)}`}],warnings:[],filePath:r,fileType:`plugin`}}if(a&&typeof a==`object`){let e=a;e.commands&&(Array.isArray(e.commands)?e.commands:[e.commands]).forEach((e,n)=>{typeof e==`string`&&J(e,`commands[${n}]`,t)}),e.agents&&(Array.isArray(e.agents)?e.agents:[e.agents]).forEach((e,n)=>{typeof e==`string`&&J(e,`agents[${n}]`,t)}),e.skills&&(Array.isArray(e.skills)?e.skills:[e.skills]).forEach((e,n)=>{typeof e==`string`&&J(e,`skills[${n}]`,t)})}let o=a;if(typeof a==`object`&&a){let e=a,t=Object.keys(e).filter(e=>$.has(e));if(t.length>0){let r={...e};for(let e of t)delete r[e],n.push({path:e,message:`Field '${e}' belongs in the marketplace entry (marketplace.json), not plugin.json. It's harmless here but unused — Work Mate ignores it at load time.`});o=r}}let s=l().strict().safeParse(o);if(s.success||t.push(...q(s.error)),s.success){let e=s.data;/^[a-z0-9]+(-[a-z0-9]+)*$/.test(e.name)||n.push({path:`name`,message:`Plugin name "${e.name}" is not kebab-case. Work Mate accepts it, but the Claude.ai marketplace sync requires kebab-case (lowercase letters, digits, and hyphens only, e.g., "my-plugin").`}),e.version||n.push({path:`version`,message:`No version specified. Consider adding a version following semver (e.g., "1.0.0")`}),e.description||n.push({path:`description`,message:`No description provided. Adding a description helps users understand what your plugin does`}),e.author||n.push({path:`author`,message:`No author information provided. Consider adding author details for plugin attribution`})}return{success:t.length===0,errors:t,warnings:n,filePath:r,fileType:`plugin`}}async function X(e){let t=[],n=[],r=k.resolve(e),a;try{a=await A(r,{encoding:`utf-8`})}catch(e){let t=b(e),n;return n=t===`ENOENT`?`File not found: ${r}`:t===`EISDIR`?`Path is not a file: ${r}`:`Failed to read file: ${y(e)}`,{success:!1,errors:[{path:`file`,message:n,code:t}],warnings:[],filePath:r,fileType:`marketplace`}}let o;try{o=S(a)}catch(e){return{success:!1,errors:[{path:`json`,message:`Invalid JSON syntax: ${y(e)}`}],warnings:[],filePath:r,fileType:`marketplace`}}if(o&&typeof o==`object`){let e=o;Array.isArray(e.plugins)&&e.plugins.forEach((e,n)=>{if(e&&typeof e==`object`&&`source`in e){let r=e.source;typeof r==`string`&&J(r,`plugins[${n}].source`,t,ue(r)),r&&typeof r==`object`&&`path`in r&&typeof r.path==`string`&&J(r.path,`plugins[${n}].source.path`,t)}})}let l=s().extend({plugins:i(c().strict())}).strict().safeParse(o);if(l.success||t.push(...q(l.error)),l.success){let e=l.data;if((!e.plugins||e.plugins.length===0)&&n.push({path:`plugins`,message:`Marketplace has no plugins defined`}),e.plugins){e.plugins.forEach((n,r)=>{e.plugins.filter(e=>e.name===n.name).length>1&&t.push({path:`plugins[${r}].name`,message:`Duplicate plugin name "${n.name}" found in marketplace`})});let i=k.dirname(r),a=k.basename(i)===`.claude-plugin`?k.dirname(i):i;for(let[t,r]of e.plugins.entries()){if(!r.version||typeof r.source!=`string`||!r.source.startsWith(`./`))continue;let e=k.join(a,r.source,`.claude-plugin`,`plugin.json`),i;try{let t=S(await A(e,{encoding:`utf-8`}));typeof t.version==`string`&&(i=t.version)}catch{continue}i&&i!==r.version&&n.push({path:`plugins[${t}].version`,message:`Entry declares version "${r.version}" but ${r.source}/.claude-plugin/plugin.json says "${i}". At install time, plugin.json wins (calculatePluginVersion precedence) — the entry version is silently ignored. Update this entry to "${i}" to match.`})}}e.metadata?.description||n.push({path:`metadata.description`,message:`No marketplace description provided. Adding a description helps users understand what this marketplace offers`})}return{success:t.length===0,errors:t,warnings:n,filePath:r,fileType:`marketplace`}}function de(e,t,n){let r=[],i=[],a=t.match(g);if(!a)return i.push({path:`frontmatter`,message:`No frontmatter block found. Add YAML frontmatter between --- delimiters at the top of the file to set description and other metadata.`}),{success:!0,errors:r,warnings:i,filePath:e,fileType:n};let o=a[1]||``,s;try{s=ee(o)}catch(t){return r.push({path:`frontmatter`,message:`YAML frontmatter failed to parse: ${y(t)}. At runtime this ${n} loads with empty metadata (all frontmatter fields silently dropped).`}),{success:!1,errors:r,warnings:i,filePath:e,fileType:n}}if(typeof s!=`object`||!s||Array.isArray(s))return r.push({path:`frontmatter`,message:`Frontmatter must be a YAML mapping (key: value pairs), got ${Array.isArray(s)?`an array`:s===null?`null`:typeof s}.`}),{success:!1,errors:r,warnings:i,filePath:e,fileType:n};let c=s;if(c.description!==void 0){let e=c.description;typeof e!=`string`&&typeof e!=`number`&&typeof e!=`boolean`&&e!==null&&r.push({path:`description`,message:`description must be a string, got ${Array.isArray(e)?`array`:typeof e}. At runtime this value is dropped.`})}else i.push({path:`description`,message:`No description in frontmatter. A description helps users and Work Mate understand when to use this ${n}.`});c.name!==void 0&&c.name!==null&&typeof c.name!=`string`&&r.push({path:`name`,message:`name must be a string, got ${typeof c.name}.`});let l=c[`allowed-tools`];l!=null&&(typeof l!=`string`&&!Array.isArray(l)?r.push({path:`allowed-tools`,message:`allowed-tools must be a string or array of strings, got ${typeof l}.`}):Array.isArray(l)&&l.some(e=>typeof e!=`string`)&&r.push({path:`allowed-tools`,message:`allowed-tools array must contain only strings.`}));let u=c.shell;if(u!=null)if(typeof u!=`string`)r.push({path:`shell`,message:`shell must be a string, got ${typeof u}.`});else{let e=u.trim().toLowerCase();e!==`bash`&&e!==`powershell`&&r.push({path:`shell`,message:`shell must be 'bash' or 'powershell', got '${u}'.`})}return{success:r.length===0,errors:r,warnings:i,filePath:e,fileType:n}}async function Z(e){let t;try{t=await A(e,{encoding:`utf-8`})}catch(t){return b(t)===`ENOENT`?{success:!0,errors:[],warnings:[],filePath:e,fileType:`hooks`}:{success:!1,errors:[{path:`file`,message:`Failed to read file: ${y(t)}`}],warnings:[],filePath:e,fileType:`hooks`}}let n;try{n=S(t)}catch(t){return{success:!1,errors:[{path:`json`,message:`Invalid JSON syntax: ${y(t)}. At runtime this breaks the entire plugin load.`}],warnings:[],filePath:e,fileType:`hooks`}}let r=a().safeParse(n);return r.success?{success:!0,errors:[],warnings:[],filePath:e,fileType:`hooks`}:{success:!1,errors:q(r.error),warnings:[],filePath:e,fileType:`hooks`}}async function Q(e,t){let n;try{n=await j(e,{withFileTypes:!0})}catch(e){let t=b(e);if(t===`ENOENT`||t===`ENOTDIR`)return[];throw e}if(t)return n.filter(e=>e.isDirectory()).map(t=>k.join(e,t.name,`SKILL.md`));let r=[];for(let t of n){let n=k.join(e,t.name);t.isDirectory()?r.push(...await Q(n,!1)):t.isFile()&&t.name.toLowerCase().endsWith(`.md`)&&r.push(n)}return r}async function fe(e){let t=[],n=[[`skill`,k.join(e,`skills`)],[`agent`,k.join(e,`agents`)],[`command`,k.join(e,`commands`)]];for(let[e,r]of n){let n=await Q(r,e===`skill`);for(let r of n){let n;try{n=await A(r,{encoding:`utf-8`})}catch(n){if(x(n))continue;t.push({success:!1,errors:[{path:`file`,message:`Failed to read: ${y(n)}`}],warnings:[],filePath:r,fileType:e});continue}let i=de(r,n,e);(i.errors.length>0||i.warnings.length>0)&&t.push(i)}}let r=await Z(k.join(e,`hooks`,`hooks.json`));return(r.errors.length>0||r.warnings.length>0)&&t.push(r),t}async function pe(e){let t=k.resolve(e),n=null;try{n=await N(t)}catch(e){if(!x(e))throw e}if(n?.isDirectory()){let e=await X(k.join(t,`.claude-plugin`,`marketplace.json`));if(e.errors[0]?.code!==`ENOENT`)return e;let n=await Y(k.join(t,`.claude-plugin`,`plugin.json`));return n.errors[0]?.code===`ENOENT`?{success:!1,errors:[{path:`directory`,message:`No manifest found in directory. Expected .claude-plugin/marketplace.json or .claude-plugin/plugin.json`}],warnings:[],filePath:t,fileType:`plugin`}:n}switch(le(e)){case`plugin`:return Y(e);case`marketplace`:return X(e);case`unknown`:try{let n=S(await A(t,{encoding:`utf-8`}));if(Array.isArray(n.plugins))return X(e)}catch(e){if(b(e)===`ENOENT`)return{success:!1,errors:[{path:`file`,message:`File not found: ${t}`}],warnings:[],filePath:t,fileType:`plugin`}}return Y(e)}}var $,me=e((()=>{r(),v(),f(),D(),u(),o(),$=new Set([`category`,`source`,`tags`,`strict`,`id`])}));export{se as a,K as c,ce as i,pe as n,V as o,fe as r,B as s,me as t};
@@ -0,0 +1 @@
1
+ import{wt as e,yt as t}from"./loadAgentsDir-BfLCckVj.js";e();export{t as execIntoTmuxWorktree};
package/dist/cli.js CHANGED
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env bun
2
- import{l as e,o as t}from"./chunks/envUtils-QyzA_cFM.js";var n=globalThis.performance,r=new Map,i=new Map;function a(){return n.now()}function o(e){return r.set(e,a()),{name:e,entryType:`mark`,startTime:r.get(e),duration:0}}function s(e,t,n){let o,s;if(typeof t==`string`){let e=r.get(t),i=n?r.get(n):a();o=e??a(),s=(i??a())-o}else t&&typeof t==`object`?(o=t.start??0,s=(t.end??a())-o):(o=0,s=a());i.set(e,{name:e,startTime:o,duration:s})}function c(e){return e===`mark`?[...r.entries()].map(([e,t])=>({name:e,entryType:`mark`,startTime:t,duration:0})):e===`measure`?[...i.values()].map(e=>({name:e.name,entryType:`measure`,startTime:e.startTime,duration:e.duration})):[]}function l(e,t){return c(t??`mark`).concat(t===void 0?c(`measure`):[]).filter(t=>t.name===e)}function u(e){e===void 0?r.clear():r.delete(e)}function d(e){e===void 0?i.clear():i.delete(e)}var f={now:a,mark:o,measure:s,getEntriesByType:c,getEntriesByName:l,clearMarks:u,clearMeasures:d,clearResourceTimings:(()=>{}),setResourceTimingBufferSize:(()=>{}),markResourceTiming:(()=>{}),get timeOrigin(){return n.timeOrigin},get onresourcetimingbufferfull(){return n.onresourcetimingbufferfull},set onresourcetimingbufferfull(e){},toJSON(){return n.toJSON()}};function p(){globalThis.__performanceShimInstalled||(globalThis.__performanceShimInstalled=!0,globalThis.performance=f)}if(p(),t(),globalThis.MACRO===void 0&&(globalThis.MACRO={VERSION:process.env.WORKMATE_VERSION||`2.1.888`,BUILD_TIME:new Date().toISOString(),FEEDBACK_CHANNEL:``,ISSUES_EXPLAINER:``,NATIVE_PACKAGE_URL:``,PACKAGE_URL:``,VERSION_CHANGELOG:``}),e(process.env.WORKMATE_FORCE_INTERACTIVE)){for(let e of[process.stdin,process.stdout,process.stderr])if(!e.isTTY)try{Object.defineProperty(e,"isTTY",{value:!0,configurable:!0})}catch{}}process.env.COREPACK_ENABLE_AUTO_PIN=`0`;async function m(){let e=process.argv.slice(2);if(e.length===1&&(e[0]===`--version`||e[0]===`-v`||e[0]===`-V`)){console.log(`0.0.28 (Work Mate)`);return}let{profileCheckpoint:t}=await import(`./chunks/startupProfiler-DWcM4QBl.js`);if(t(`cli_entry`),process.argv[2]===`--acp`){t(`cli_acp_path`);let{runAcpAgent:e}=await import(`./chunks/entry-333L52Lo.js`);await e();return}if(e[0]===`job`){t(`cli_templates_path`);let{templatesMain:n}=await import(`./chunks/templateJobs-C5ukh6H3.js`);await n(e.slice(1)),process.exit(0)}if(e[0]===`new`||e[0]===`list`||e[0]===`reply`){console.error(`[deprecated] Use: wm job ${e[0]} ${e.slice(1).join(` `)}`.trim()),t(`cli_templates_path`);let{templatesMain:n}=await import(`./chunks/templateJobs-C5ukh6H3.js`);await n(e),process.exit(0)}if(e[0]===`channel`){t(`cli_channel_path`);let{enableConfigs:n}=await import(`./chunks/config-C_AEhZrn.js`);n();let{channelMain:r}=await import(`./chunks/channel-DVx21qde.js`);await r(e.slice(1));return}if((e.includes(`--tmux`)||e.includes(`--tmux=classic`))&&(e.includes(`-w`)||e.includes(`--worktree`)||e.some(e=>e.startsWith(`--worktree=`)))){t(`cli_tmux_worktree_fast_path`);let{enableConfigs:n}=await import(`./chunks/config-C_AEhZrn.js`);n();let{isWorktreeModeEnabled:r}=await import(`./chunks/worktreeModeEnabled-D68iEHpC.js`);if(r()){let{execIntoTmuxWorktree:t}=await import(`./chunks/worktree-BWL0vR4o.js`),n=await t(e);if(n.handled)return;if(n.error){let{exitWithError:e}=await import(`./chunks/process-CNfq37LF.js`);e(n.error)}}}e.includes(`--bare`)&&(process.env.WORKMATE_SIMPLE=`1`);let{startCapturingEarlyInput:n}=await import(`./chunks/earlyInput-BEjRkAtH.js`);n(),t(`cli_before_main_import`);let{main:r}=await import(`./chunks/main-B31aPMPP.js`);t(`cli_after_main_import`),await r(),t(`cli_after_main_complete`)}await m();export{};
2
+ import{l as e,o as t}from"./chunks/envUtils-QyzA_cFM.js";var n=globalThis.performance,r=new Map,i=new Map;function a(){return n.now()}function o(e){return r.set(e,a()),{name:e,entryType:`mark`,startTime:r.get(e),duration:0}}function s(e,t,n){let o,s;if(typeof t==`string`){let e=r.get(t),i=n?r.get(n):a();o=e??a(),s=(i??a())-o}else t&&typeof t==`object`?(o=t.start??0,s=(t.end??a())-o):(o=0,s=a());i.set(e,{name:e,startTime:o,duration:s})}function c(e){return e===`mark`?[...r.entries()].map(([e,t])=>({name:e,entryType:`mark`,startTime:t,duration:0})):e===`measure`?[...i.values()].map(e=>({name:e.name,entryType:`measure`,startTime:e.startTime,duration:e.duration})):[]}function l(e,t){return c(t??`mark`).concat(t===void 0?c(`measure`):[]).filter(t=>t.name===e)}function u(e){e===void 0?r.clear():r.delete(e)}function d(e){e===void 0?i.clear():i.delete(e)}var f={now:a,mark:o,measure:s,getEntriesByType:c,getEntriesByName:l,clearMarks:u,clearMeasures:d,clearResourceTimings:(()=>{}),setResourceTimingBufferSize:(()=>{}),markResourceTiming:(()=>{}),get timeOrigin(){return n.timeOrigin},get onresourcetimingbufferfull(){return n.onresourcetimingbufferfull},set onresourcetimingbufferfull(e){},toJSON(){return n.toJSON()}};function p(){globalThis.__performanceShimInstalled||(globalThis.__performanceShimInstalled=!0,globalThis.performance=f)}if(p(),t(),globalThis.MACRO===void 0&&(globalThis.MACRO={VERSION:process.env.WORKMATE_VERSION||`2.1.888`,BUILD_TIME:new Date().toISOString(),FEEDBACK_CHANNEL:``,ISSUES_EXPLAINER:``,NATIVE_PACKAGE_URL:``,PACKAGE_URL:``,VERSION_CHANGELOG:``}),e(process.env.WORKMATE_FORCE_INTERACTIVE)){for(let e of[process.stdin,process.stdout,process.stderr])if(!e.isTTY)try{Object.defineProperty(e,"isTTY",{value:!0,configurable:!0})}catch{}}process.env.COREPACK_ENABLE_AUTO_PIN=`0`;async function m(){let e=process.argv.slice(2);if(e.length===1&&(e[0]===`--version`||e[0]===`-v`||e[0]===`-V`)){console.log(`0.0.29 (Work Mate)`);return}let{profileCheckpoint:t}=await import(`./chunks/startupProfiler-DWcM4QBl.js`);if(t(`cli_entry`),process.argv[2]===`--acp`){t(`cli_acp_path`);let{runAcpAgent:e}=await import(`./chunks/entry-DdVUdGWV.js`);await e();return}if(e[0]===`job`){t(`cli_templates_path`);let{templatesMain:n}=await import(`./chunks/templateJobs-CEDUbFAY.js`);await n(e.slice(1)),process.exit(0)}if(e[0]===`new`||e[0]===`list`||e[0]===`reply`){console.error(`[deprecated] Use: wm job ${e[0]} ${e.slice(1).join(` `)}`.trim()),t(`cli_templates_path`);let{templatesMain:n}=await import(`./chunks/templateJobs-CEDUbFAY.js`);await n(e),process.exit(0)}if(e[0]===`channel`){t(`cli_channel_path`);let{enableConfigs:n}=await import(`./chunks/config-C_AEhZrn.js`);n();let{channelMain:r}=await import(`./chunks/channel-B5FkNSZ3.js`);await r(e.slice(1));return}if((e.includes(`--tmux`)||e.includes(`--tmux=classic`))&&(e.includes(`-w`)||e.includes(`--worktree`)||e.some(e=>e.startsWith(`--worktree=`)))){t(`cli_tmux_worktree_fast_path`);let{enableConfigs:n}=await import(`./chunks/config-C_AEhZrn.js`);n();let{isWorktreeModeEnabled:r}=await import(`./chunks/worktreeModeEnabled-D68iEHpC.js`);if(r()){let{execIntoTmuxWorktree:t}=await import(`./chunks/worktree-BB9lFWBB.js`),n=await t(e);if(n.handled)return;if(n.error){let{exitWithError:e}=await import(`./chunks/process-CNfq37LF.js`);e(n.error)}}}e.includes(`--bare`)&&(process.env.WORKMATE_SIMPLE=`1`);let{startCapturingEarlyInput:n}=await import(`./chunks/earlyInput-BEjRkAtH.js`);n(),t(`cli_before_main_import`);let{main:r}=await import(`./chunks/main-U71X4Thd.js`);t(`cli_after_main_import`),await r(),t(`cli_after_main_complete`)}await m();export{};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@readmagic/workmate",
3
- "version": "0.0.28",
3
+ "version": "0.0.29",
4
4
  "description": "workMate",
5
5
  "type": "module",
6
6
  "author": "Frandy",
@@ -1 +0,0 @@
1
- import{n as e,t}from"./AgentsMdExternalIncludesDialog-BJfHqScU.js";e();export{t as AgentsMdExternalIncludesDialog};
@@ -1 +0,0 @@
1
- import{R as e,t}from"./src-BX54x08P.js";import{t as n}from"./jsx-runtime-Bb4Xn-E0.js";import{Lh as r,zh as i}from"./loadAgentsDir-bmpKLPdG.js";import{d as a,h as o,o as s}from"./config-Bio2EjUK.js";import{t as c}from"./fpsMetrics-DIpm2-xw.js";import{n as l,t as u}from"./onChangeAppState-C9cYQJPF.js";i(),t(),a();var d=n();function f({getFpsMetrics:t,stats:n,initialState:i,children:a}){return(0,d.jsx)(c,{getFpsMetrics:t,children:(0,d.jsx)(l,{store:n,children:(0,d.jsx)(r,{initialState:i,onChangeAppState:u,children:(0,d.jsx)(e,{initialState:s().theme,onThemeSave:e=>o(t=>({...t,theme:e})),children:a})})})})}export{f as App};
@@ -1 +0,0 @@
1
- import{n as e,t}from"./Doctor-COj-tZBc.js";e();export{t as Doctor};
@@ -1,3 +0,0 @@
1
- import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{i as n,o as r}from"./envUtils-QyzA_cFM.js";import{n as i,t as a}from"./figures-5ThXQEtq.js";import{Gt as o,I as s,P as c,ai as l,t as u,x as d}from"./src-BX54x08P.js";import{t as f}from"./jsx-runtime-Bb4Xn-E0.js";import{B as p,In as m,L as h,Vn as g}from"./settings-D4M13toi.js";import{Pt as _,q as v}from"./state-CXY-q5gr.js";import{A_ as y,Al as b,Bb as ee,Bh as x,Cy as S,Dy as C,Ey as w,Ib as T,Ki as E,Lb as te,Mx as ne,Nx as re,Ol as ie,Rb as ae,aC as D,k_ as oe,kl as se,ky as ce,qi as O,sC as k,tb as A,zb as j,zh as M}from"./loadAgentsDir-bmpKLPdG.js";import{l as N,o as P}from"./stringUtils-Cs6E5f-B.js";import{at as F,f as I,nt as L,s as R}from"./model-Dd3x121y.js";import{a as z,i as B,r as V,s as H}from"./sleep-xKMbXTJe.js";import{n as U,t as W}from"./ValidationErrorsList-CKeHoN2Z.js";import{n as G,t as le}from"./useExitOnCtrlCDWithKeybindings-BT0nexZw.js";import{f as ue,g as de,h as fe,i as pe,n as me,o as he,p as ge,r as _e}from"./pidLock-CqkC3-nD.js";import{n as ve,t as ye}from"./McpParsingWarnings-Czze2JPd.js";import{n as be,t as xe}from"./PressEnterToContinue-DE1RxMX_.js";import{n as Se,t as Ce}from"./useSettingsErrors-C8VIzdws.js";import{n as we,t as Te}from"./shadowedRuleDetection-L3tnySui.js";import{n as Ee,r as De,t as K}from"./statusNoticeHelpers-DsrqBOQt.js";import{join as q}from"path";function Oe(){if(!H())return null;let e=V();if(e.length===0)return null;let t=e.filter(e=>e.severity===`error`),n=e.filter(e=>e.severity===`warning`);return(0,J.jsxs)(s,{flexDirection:`column`,marginTop:1,marginBottom:1,children:[(0,J.jsx)(c,{bold:!0,color:t.length>0?`error`:`warning`,children:`Keybinding Configuration Issues`}),(0,J.jsxs)(s,{children:[(0,J.jsx)(c,{dimColor:!0,children:`Location: `}),(0,J.jsx)(c,{dimColor:!0,children:B()})]}),(0,J.jsxs)(s,{marginLeft:1,flexDirection:`column`,marginTop:1,children:[t.map((e,t)=>(0,J.jsxs)(s,{flexDirection:`column`,children:[(0,J.jsxs)(s,{children:[(0,J.jsx)(c,{dimColor:!0,children:`└ `}),(0,J.jsx)(c,{color:`error`,children:`[Error]`}),(0,J.jsxs)(c,{dimColor:!0,children:[` `,e.message]})]}),e.suggestion&&(0,J.jsx)(s,{marginLeft:3,children:(0,J.jsxs)(c,{dimColor:!0,children:[`→ `,e.suggestion]})})]},`error-${t}`)),n.map((e,t)=>(0,J.jsxs)(s,{flexDirection:`column`,children:[(0,J.jsxs)(s,{children:[(0,J.jsx)(c,{dimColor:!0,children:`└ `}),(0,J.jsx)(c,{color:`warning`,children:`[Warning]`}),(0,J.jsxs)(c,{dimColor:!0,children:[` `,e.message]})]}),e.suggestion&&(0,J.jsx)(s,{marginLeft:3,children:(0,J.jsxs)(c,{dimColor:!0,children:[`→ `,e.suggestion]})})]},`warning-${t}`))]})]})}var J,ke=e((()=>{u(),z(),J=f()}));function Ae(){if(!D.isSupportedPlatform()||!D.isSandboxEnabledInSettings())return null;let e=D.checkDependencies(),t=e.errors.length>0,n=e.warnings.length>0;return!t&&!n?null:(0,Y.jsxs)(s,{flexDirection:`column`,children:[(0,Y.jsx)(c,{bold:!0,children:`Sandbox`}),(0,Y.jsxs)(c,{children:[`└ Status: `,(0,Y.jsx)(c,{color:t?`error`:`warning`,children:t?`Missing dependencies`:`Available (with warnings)`})]}),e.errors.map((e,t)=>(0,Y.jsxs)(c,{color:`error`,children:[`└ `,e]},t)),e.warnings.map((e,t)=>(0,Y.jsxs)(c,{color:`warning`,children:[`└ `,e]},t)),t&&(0,Y.jsx)(c,{dimColor:!0,children:`└ Run /sandbox for install instructions`})]})}var Y,je=e((()=>{u(),k(),Y=f()}));async function Me(){let e=w(await C());if(e.length===0)return null;let t=e.sort((e,t)=>t.content.length-e.content.length).map(e=>`${e.path}: ${e.content.length.toLocaleString()} chars`);return{type:`agentsmd_files`,severity:`warning`,message:e.length===1?`Large AGENTS.md file detected (${e[0].content.length.toLocaleString()} chars > ${S.toLocaleString()})`:`${e.length} large AGENTS.md files detected (each > ${S.toLocaleString()} chars)`,details:t,currentValue:e.length,threshold:S}}async function Ne(e){if(!e)return null;let t=Ee(e);if(t<=15e3)return null;let n=e.activeAgents.filter(e=>e.source!==`built-in`).map(e=>{let t=`${e.agentType}: ${e.whenToUse}`;return{name:e.agentType,tokens:O(t)}}).sort((e,t)=>t.tokens-e.tokens),r=n.slice(0,5).map(e=>`${e.name}: ~${e.tokens.toLocaleString()} tokens`);return n.length>5&&r.push(`(${n.length-5} more custom agents)`),{type:`agent_descriptions`,severity:`warning`,message:`Large agent descriptions (~${t.toLocaleString()} tokens > ${K.toLocaleString()})`,details:r,currentValue:t,threshold:K}}async function X(e,t,n){let r=e.filter(e=>e.isMcp);if(r.length===0)return null;try{let{mcpToolTokens:r,mcpToolDetails:i}=await oe(e,t,n,R());if(r<=Z)return null;let a=new Map;for(let e of i){let t=e.name.split(`__`)[1]||`unknown`,n=a.get(t)||{count:0,tokens:0};a.set(t,{count:n.count+1,tokens:n.tokens+e.tokens})}let o=Array.from(a.entries()).sort((e,t)=>t[1].tokens-e[1].tokens),s=o.slice(0,5).map(([e,t])=>`${e}: ${t.count} tools (~${t.tokens.toLocaleString()} tokens)`);return o.length>5&&s.push(`(${o.length-5} more servers)`),{type:`mcp_tools`,severity:`warning`,message:`Large MCP tools context (~${r.toLocaleString()} tokens > ${Z.toLocaleString()})`,details:s,currentValue:r,threshold:Z}}catch{let e=r.reduce((e,t)=>e+O(((t.name?.length||0)+t.description.length).toString()),0);return e<=Z?null:{type:`mcp_tools`,severity:`warning`,message:`Large MCP tools context (~${e.toLocaleString()} tokens estimated > ${Z.toLocaleString()})`,details:[`${r.length} MCP tools detected (token count estimated)`],currentValue:e,threshold:Z}}}async function Pe(e){let t=Te(await e(),{sandboxAutoAllowEnabled:D.isSandboxingEnabled()&&D.isAutoAllowBashIfSandboxedEnabled()});if(t.length===0)return null;let n=t.flatMap(e=>[`${p(e.rule.ruleValue)}: ${e.reason}`,` Fix: ${e.fix}`]);return{type:`unreachable_rules`,severity:`warning`,message:`${t.length} ${N(t.length,`unreachable permission rule`)} detected`,details:n,currentValue:t.length,threshold:0}}async function Fe(e,t,n){let[r,i,a,o]=await Promise.all([Me(),Ne(t),X(e,n,t),Pe(n)]);return{agentsMdWarning:r,agentWarning:i,mcpWarning:a,unreachableRulesWarning:o}}var Z,Ie=e((()=>{E(),y(),ce(),I(),h(),we(),k(),De(),P(),Z=25e3}));function Le({onDone:e}){let t=x(e=>e.agentDefinitions),r=x(e=>e.mcp.tools),i=x(e=>e.toolPermissionContext),l=x(e=>e.plugins.errors);G();let u=(0,Q.useMemo)(()=>r||[],[r]),[f,p]=(0,Q.useState)(null),[m,h]=(0,Q.useState)(null),[_,y]=(0,Q.useState)(null),[b,S]=(0,Q.useState)(null),C=Se().filter(e=>e.mcpErrorMetadata===void 0),w=(0,Q.useMemo)(()=>[{name:`BASH_MAX_OUTPUT_LENGTH`,default:T,upperLimit:te},{name:`TASK_MAX_OUTPUT_LENGTH`,default:ie,upperLimit:se},{name:`WORKMATE_MAX_OUTPUT_TOKENS`,...L(`claude-opus-4-7`)}].map(e=>{let t=process.env[e.name],n=ee(e.name,t,e.default,e.upperLimit);return{name:e.name,...n}}).filter(e=>e.status!==`valid`),[]);(0,Q.useEffect)(()=>{fe().then(p),(async()=>{let e=q(n(),`agents`),r=q(v(),`.workmate`,`agents`),{activeAgents:a,allAgents:o,failedFiles:s}=t,[c,l]=await Promise.all([g(e),g(r)]),d={activeAgents:a.map(e=>({agentType:e.agentType,source:e.source})),userAgentsDir:e,projectAgentsDir:r,userDirExists:c,projectDirExists:l,failedFiles:s};h(d);let f=await Fe(u,{activeAgents:a,allAgents:o,failedFiles:s},async()=>i);if(y(f),he()){let e=q(ue(),`claude`,`locks`),t=me(e),n=_e(e);S({enabled:!0,locks:n,locksDir:e,staleLocksCleaned:t})}else S({enabled:!1,locks:[],locksDir:``,staleLocksCleaned:0})})()},[i,u,t]);let E=(0,Q.useCallback)(()=>{e(`Work Mate diagnostics dismissed`,{display:`system`})},[e]);return o({"confirm:yes":E,"confirm:no":E},{context:`Confirmation`}),f?(0,$.jsxs)(d,{children:[(0,$.jsxs)(s,{flexDirection:`column`,children:[(0,$.jsx)(c,{bold:!0,children:`Diagnostics`}),(0,$.jsxs)(c,{children:[`└ Currently running: `,f.installationType,` (`,f.version,`)`]}),f.packageManager&&(0,$.jsxs)(c,{children:[`└ Package manager: `,f.packageManager]}),(0,$.jsxs)(c,{children:[`└ Path: `,f.installationPath]}),(0,$.jsxs)(c,{children:[`└ Invoked: `,f.invokedBinary]}),(0,$.jsxs)(c,{children:[`└ Config install method: `,f.configInstallMethod]}),(0,$.jsxs)(c,{children:[`└ Search: `,f.ripgrepStatus.working?`OK`:`Not working`,` (`,f.ripgrepStatus.mode===`embedded`?`bundled`:f.ripgrepStatus.mode===`builtin`?`vendor`:f.ripgrepStatus.systemPath||`system`,`)`]}),f.ripgrepStatus.note&&(0,$.jsxs)(c,{color:`warning`,children:[`└ Note: `,f.ripgrepStatus.note]}),f.recommendation&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(c,{}),(0,$.jsxs)(c,{color:`warning`,children:[`Recommendation: `,f.recommendation.split(`
2
- `)[0]]}),(0,$.jsx)(c,{dimColor:!0,children:f.recommendation.split(`
3
- `)[1]})]}),f.multipleInstallations.length>1&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(c,{}),(0,$.jsx)(c,{color:`warning`,children:`Warning: Multiple installations found`}),f.multipleInstallations.map((e,t)=>(0,$.jsxs)(c,{children:[`└ `,e.type,` at `,e.path]},t))]}),f.warnings.length>0&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(c,{}),f.warnings.map((e,t)=>(0,$.jsxs)(s,{flexDirection:`column`,children:[(0,$.jsxs)(c,{color:`warning`,children:[`Warning: `,e.issue]}),(0,$.jsxs)(c,{children:[`Fix: `,e.fix]})]},t))]}),C.length>0&&(0,$.jsxs)(s,{flexDirection:`column`,marginTop:1,marginBottom:1,children:[(0,$.jsx)(c,{bold:!0,children:`Invalid Settings`}),(0,$.jsx)(W,{errors:C})]})]}),(0,$.jsx)(Ae,{}),(0,$.jsx)(ye,{}),(0,$.jsx)(Oe,{}),w.length>0&&(0,$.jsxs)(s,{flexDirection:`column`,children:[(0,$.jsx)(c,{bold:!0,children:`Environment Variables`}),w.map((e,t)=>(0,$.jsxs)(c,{children:[`└ `,e.name,`:`,` `,(0,$.jsx)(c,{color:e.status===`capped`?`warning`:`error`,children:e.message})]},t))]}),b?.enabled&&(0,$.jsxs)(s,{flexDirection:`column`,children:[(0,$.jsx)(c,{bold:!0,children:`Version Locks`}),b.staleLocksCleaned>0&&(0,$.jsxs)(c,{dimColor:!0,children:[`└ Cleaned `,b.staleLocksCleaned,` stale lock(s)`]}),b.locks.length===0?(0,$.jsx)(c,{dimColor:!0,children:`└ No active version locks`}):b.locks.map((e,t)=>(0,$.jsxs)(c,{children:[`└ `,e.version,`: PID `,e.pid,` `,e.isProcessRunning?(0,$.jsx)(c,{children:`(running)`}):(0,$.jsx)(c,{color:`warning`,children:`(stale)`})]},t))]}),m?.failedFiles&&m.failedFiles.length>0&&(0,$.jsxs)(s,{flexDirection:`column`,children:[(0,$.jsx)(c,{bold:!0,color:`error`,children:`Agent Parse Errors`}),(0,$.jsxs)(c,{color:`error`,children:[`└ Failed to parse `,m.failedFiles.length,` agent file(s):`]}),m.failedFiles.map((e,t)=>(0,$.jsxs)(c,{dimColor:!0,children:[` `,`└ `,e.path,`: `,e.error]},t))]}),l.length>0&&(0,$.jsxs)(s,{flexDirection:`column`,children:[(0,$.jsx)(c,{bold:!0,color:`error`,children:`Plugin Errors`}),(0,$.jsxs)(c,{color:`error`,children:[`└ `,l.length,` plugin error(s) detected:`]}),l.map((e,t)=>(0,$.jsxs)(c,{dimColor:!0,children:[` `,`└ `,e.source||`unknown`,`plugin`in e&&e.plugin?` [${e.plugin}]`:``,`: `,ne(e)]},t))]}),_?.unreachableRulesWarning&&(0,$.jsxs)(s,{flexDirection:`column`,children:[(0,$.jsx)(c,{bold:!0,color:`warning`,children:`Unreachable Permission Rules`}),(0,$.jsxs)(c,{children:[`└`,` `,(0,$.jsxs)(c,{color:`warning`,children:[a.warning,` `,_.unreachableRulesWarning.message]})]}),_.unreachableRulesWarning.details.map((e,t)=>(0,$.jsxs)(c,{dimColor:!0,children:[` `,`└ `,e]},t))]}),_&&(_.agentsMdWarning||_.agentWarning||_.mcpWarning)&&(0,$.jsxs)(s,{flexDirection:`column`,children:[(0,$.jsx)(c,{bold:!0,children:`Context Usage Warnings`}),_.agentsMdWarning&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(c,{children:[`└`,` `,(0,$.jsxs)(c,{color:`warning`,children:[a.warning,` `,_.agentsMdWarning.message]})]}),(0,$.jsxs)(c,{children:[` `,`└ Files:`]}),_.agentsMdWarning.details.map((e,t)=>(0,$.jsxs)(c,{dimColor:!0,children:[` `,`└ `,e]},t))]}),_.agentWarning&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(c,{children:[`└`,` `,(0,$.jsxs)(c,{color:`warning`,children:[a.warning,` `,_.agentWarning.message]})]}),(0,$.jsxs)(c,{children:[` `,`└ Top contributors:`]}),_.agentWarning.details.map((e,t)=>(0,$.jsxs)(c,{dimColor:!0,children:[` `,`└ `,e]},t))]}),_.mcpWarning&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(c,{children:[`└`,` `,(0,$.jsxs)(c,{color:`warning`,children:[a.warning,` `,_.mcpWarning.message]})]}),(0,$.jsxs)(c,{children:[` `,`└ MCP servers:`]}),_.mcpWarning.details.map((e,t)=>(0,$.jsxs)(c,{dimColor:!0,children:[` `,`└ `,e]},t))]})]}),(0,$.jsx)(s,{children:(0,$.jsx)(xe,{})})]}):(0,$.jsx)(d,{children:(0,$.jsx)(c,{dimColor:!0,children:`Checking installation status…`})})}var Q,$,Re=e((()=>{i(),Q=t(l(),1),ke(),ve(),F(),r(),_(),u(),be(),je(),U(),Ce(),le(),A(),M(),re(),Ie(),de(),j(),m(),pe(),ae(),b(),ge(),$=f()}));export{Re as n,Le as t};
@@ -1,2 +0,0 @@
1
- import{a as e,n as t,o as n}from"./rolldown-runtime-DaDcL9Zw.js";import{I as r,P as i,ai as a,t as o,y as s}from"./src-BX54x08P.js";import{t as c}from"./jsx-runtime-Bb4Xn-E0.js";import{St as l,Tt as u,bb as d,ci as f,cw as p,gi as m,gr as h,mC as g,mi as _,pC as v,pt as y,sw as b,wt as x,xb as S,yt as C}from"./loadAgentsDir-bmpKLPdG.js";import{c as w,i as T}from"./debug-2pVES-2G.js";import{i as E,t as D}from"./execFileNoThrow-DXSEj8ZO.js";import{n as O}from"./analytics-COpjZpvd.js";import{n as k,t as A}from"./select-CaxQ-BVq.js";import{r as j,t as M}from"./Spinner-C0qHjfIY.js";function N(){(h(),e(f)).saveWorktreeState(null)}function P({onDone:e,onCancel:t}){let[n,a]=(0,F.useState)(`loading`),[o,c]=(0,F.useState)([]),[l,d]=(0,F.useState)(0),[f,p]=(0,F.useState)(),m=C();if((0,F.useEffect)(()=>{async function e(){let e=[],t=await D(`git`,[`status`,`--porcelain`]);if(t.stdout&&(e=t.stdout.split(`
2
- `).filter(e=>e.trim()!==``),c(e)),m){let{stdout:t}=await D(`git`,[`rev-list`,`--count`,`${m.originalHeadCommit}..HEAD`]),n=parseInt(t.trim(),10)||0;if(d(n),e.length===0&&n===0){a(`removing`),y().then(()=>{process.chdir(m.originalCwd),S(m.originalCwd),N(),b.cache.clear?.(),p(`Worktree removed (no changes)`)}).catch(e=>{w(`Failed to clean up worktree: ${e}`,{level:`error`}),p(`Worktree cleanup failed, exiting anyway`)}).then(()=>{a(`done`)});return}else a(`asking`)}}e()},[m]),(0,F.useEffect)(()=>{n===`done`&&e(f)},[n,e,f]),!m)return e(`No active worktree session found`,{display:`system`}),null;if(n===`loading`||n===`done`)return null;async function h(e){if(!m)return;let t=!!m.tmuxSessionName;if(e===`keep`||e===`keep-with-tmux`)a(`keeping`),o.length,await x(),process.chdir(m.originalCwd),S(m.originalCwd),N(),b.cache.clear?.(),p(t?`Worktree kept. Your work is saved at ${m.worktreePath} on branch ${m.worktreeBranch}. Reattach to tmux session with: tmux attach -t ${m.tmuxSessionName}`:`Worktree kept. Your work is saved at ${m.worktreePath} on branch ${m.worktreeBranch}`),a(`done`);else if(e===`keep-kill-tmux`)a(`keeping`),o.length,m.tmuxSessionName&&await u(m.tmuxSessionName),await x(),process.chdir(m.originalCwd),S(m.originalCwd),N(),b.cache.clear?.(),p(`Worktree kept at ${m.worktreePath} on branch ${m.worktreeBranch}. Tmux session terminated.`),a(`done`);else if(e===`remove`||e===`remove-with-tmux`){a(`removing`),o.length,m.tmuxSessionName&&await u(m.tmuxSessionName);try{await y(),process.chdir(m.originalCwd),S(m.originalCwd),N(),b.cache.clear?.()}catch(e){w(`Failed to clean up worktree: ${e}`,{level:`error`}),p(`Worktree cleanup failed, exiting anyway`),a(`done`);return}let e=t?` Tmux session terminated.`:``;l>0&&o.length>0?p(`Worktree removed. ${l} ${l===1?`commit`:`commits`} and uncommitted changes were discarded.${e}`):l>0?p(`Worktree removed. ${l} ${l===1?`commit`:`commits`} on ${m.worktreeBranch} ${l===1?`was`:`were`} discarded.${e}`):o.length>0?p(`Worktree removed. Uncommitted changes were discarded.${e}`):p(`Worktree removed.${e}`),a(`done`)}}if(n===`keeping`)return(0,I.jsxs)(r,{flexDirection:`row`,marginY:1,children:[(0,I.jsx)(M,{}),(0,I.jsx)(i,{children:`Keeping worktree…`})]});if(n===`removing`)return(0,I.jsxs)(r,{flexDirection:`row`,marginY:1,children:[(0,I.jsx)(M,{}),(0,I.jsx)(i,{children:`Removing worktree…`})]});let g=m.worktreeBranch,_=o.length>0,v=l>0,T=``;T=_&&v?`You have ${o.length} uncommitted ${o.length===1?`file`:`files`} and ${l} ${l===1?`commit`:`commits`} on ${g}. All will be lost if you remove.`:_?`You have ${o.length} uncommitted ${o.length===1?`file`:`files`}. These will be lost if you remove the worktree.`:v?`You have ${l} ${l===1?`commit`:`commits`} on ${g}. The branch will be deleted if you remove the worktree.`:`You are working in a worktree. Keep it to continue working there, or remove it to clean up.`;function E(){if(t){t();return}h(`keep`)}let O=_||v?`All changes and commits will be lost.`:`Clean up the worktree directory.`,k=!!m.tmuxSessionName,j=k?[{label:`Keep worktree and tmux session`,value:`keep-with-tmux`,description:`Stays at ${m.worktreePath}. Reattach with: tmux attach -t ${m.tmuxSessionName}`},{label:`Keep worktree, kill tmux session`,value:`keep-kill-tmux`,description:`Keeps worktree at ${m.worktreePath}, terminates tmux session.`},{label:`Remove worktree and tmux session`,value:`remove-with-tmux`,description:O}]:[{label:`Keep worktree`,value:`keep`,description:`Stays at ${m.worktreePath}`},{label:`Remove worktree`,value:`remove`,description:O}];return(0,I.jsx)(s,{title:`Exiting worktree session`,subtitle:T,onCancel:E,children:(0,I.jsx)(A,{defaultFocusValue:k?`keep-with-tmux`:`keep`,options:j,onChange:h})})}var F,I,L=t((()=>{F=n(a(),1),O(),T(),o(),E(),p(),d(),l(),k(),j(),I=c()}));function R(){return g(V)??`Goodbye!`}function z({showWorktree:e,onDone:t,onCancel:n}){async function r(e){t(e??R()),await _(0,`prompt_input_exit`)}return e?(0,B.jsx)(P,{onDone:r,onCancel:n}):null}var B,V,H=t((()=>{v(),m(),L(),B=c(),V=[`Goodbye!`,`See ya!`,`Bye!`,`Catch you later!`]}));export{H as n,z as t};
@@ -1 +0,0 @@
1
- import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{ai as n}from"./src-BX54x08P.js";import{t as r}from"./jsx-runtime-Bb4Xn-E0.js";import{et as i,nt as a}from"./settings-D4M13toi.js";import{Pt as o,at as s}from"./state-CXY-q5gr.js";import{$d as c,Bd as l,Bh as u,Fd as d,Hh as f,Id as p,Kd as m,Md as h,Nd as g,Rd as _,Vh as v,bf as y,cp as b,df as x,hf as S,ip as ee,jd as C,kd as w,lf as T,rp as E,sp as D,uf as O,yf as k,zh as A}from"./loadAgentsDir-bmpKLPdG.js";import{I as j,M,c as N,i as P}from"./debug-2pVES-2G.js";import{c as F,l as I,o as L}from"./log-L1kqxa_P.js";import{n as te}from"./analytics-COpjZpvd.js";import{i as ne,n as R,r as z,t as B}from"./reject-Tug1RmkE.js";import{n as V,t as H}from"./notifications-BwS1XsnZ.js";function U(e){let t=`plugin`in e?e.plugin:`no-plugin`;return`${e.type}:${e.source}:${t}`}function W(e,t){t.length!==0&&e(e=>{let n=new Set(e.plugins.errors.map(e=>U(e))),r=t.filter(e=>!n.has(U(e)));return r.length===0?e:{...e,plugins:{...e.plugins,errors:[...e.plugins.errors,...r]}}})}function G(e,t=!1){let n=v(),r=u(e=>e.mcp.pluginReconnectKey),a=f(),o=(0,q.useRef)(new Map),{addNotification:c}=V(),p=(0,q.useRef)([]),b=(0,q.useRef)(null),O=(0,q.useCallback)(()=>{b.current=null;let e=p.current;e.length!==0&&(p.current=[],a(t=>{let n=t.mcp;for(let t of e){let{tools:e,commands:r,resources:a,...o}=t,s=o.type===`disabled`||o.type===`failed`?e??[]:e,c=o.type===`disabled`||o.type===`failed`?r??[]:r,u=o.type===`disabled`||o.type===`failed`?a??[]:a,d=i(o.name),f=n.clients.findIndex(e=>e.name===o.name)===-1?[...n.clients,o]:n.clients.map(e=>e.name===o.name?o:e),p=s===void 0?n.tools:[...R(n.tools,e=>e.name?.startsWith(d)),...s],m=c===void 0?n.commands:[...R(n.commands,e=>l(e,o.name)),...c],h=u===void 0?n.resources:{...n.resources,...u.length>0?{[o.name]:u}:ne(n.resources,o.name)};n={...n,clients:f,tools:p,commands:m,resources:h}}return{...t,mcp:n}}))},[a]),k=(0,q.useCallback)(e=>{p.current.push(e),b.current===null&&(b.current=setTimeout(O,16))},[O]),A=(0,q.useCallback)(({client:e,tools:t,commands:n,resources:r})=>{switch(k({...e,tools:t,commands:n,resources:r}),e.type){case`connected`:y(e.client,e.name,a),e.client.onclose=()=>{let t=e.config.type??`stdio`;if(w(e.name,e.config).catch(()=>{N(`Failed to invalidate the server cache: ${e.name}`)}),x(e.name)){F(e.name,`Server is disabled, skipping automatic reconnection`);return}if(t!==`stdio`&&t!==`sdk`){let n=K(t);F(e.name,`${n} transport closed/disconnected, attempting automatic reconnection`);let r=o.current.get(e.name);r&&(clearTimeout(r),o.current.delete(e.name)),(async()=>{for(let t=1;t<=J;t++){if(x(e.name)){F(e.name,`Server disabled during reconnection, stopping retry`),o.current.delete(e.name);return}k({...e,type:`pending`,reconnectAttempt:t,maxReconnectAttempts:J});let r=Date.now();try{let i=await _(e.name,e.config),a=Date.now()-r;if(i.client.type===`connected`){F(e.name,`${n} reconnection successful after ${a}ms (attempt ${t})`),o.current.delete(e.name),A(i);return}if(F(e.name,`${n} reconnection attempt ${t} completed with status: ${i.client.type}`),t===J){F(e.name,`Max reconnection attempts (${J}) reached, giving up`),o.current.delete(e.name),A(i);return}}catch(i){let a=Date.now()-r;if(I(e.name,`${n} reconnection attempt ${t} failed after ${a}ms: ${i}`),t===J){F(e.name,`Max reconnection attempts (${J}) reached, giving up`),o.current.delete(e.name),k({...e,type:`failed`});return}}let i=Math.min(Y*2**(t-1),X);F(e.name,`Scheduling reconnection attempt ${t+1} in ${i}ms`),await new Promise(t=>{let n=setTimeout(t,i);o.current.set(e.name,n)})}})()}else k({...e,type:`failed`})},e.capabilities?.tools?.listChanged&&e.client.setNotificationHandler(D,async()=>{F(e.name,`Received tools/list_changed notification, refreshing tools`);try{let t=g.cache.get(e.name);g.cache.delete(e.name);let n=await g(e);n.length,t&&t.then(e=>{e.length},()=>{}),k({...e,tools:n})}catch(t){I(e.name,`Failed to refresh tools after list_changed notification: ${M(t)}`)}}),e.capabilities?.prompts?.listChanged&&e.client.setNotificationHandler(E,async()=>{F(e.name,`Received prompts/list_changed notification, refreshing prompts`);try{C.cache.delete(e.name);let t=await C(e);k({...e,commands:t})}catch(t){I(e.name,`Failed to refresh prompts after list_changed notification: ${M(t)}`)}}),e.capabilities?.resources?.listChanged&&e.client.setNotificationHandler(ee,async()=>{F(e.name,`Received resources/list_changed notification, refreshing resources`);try{h.cache.delete(e.name);let t=await h(e);k({...e,resources:t})}catch(t){I(e.name,`Failed to refresh resources after list_changed notification: ${M(t)}`)}});break;case`needs-auth`:case`failed`:case`pending`:case`disabled`:break}},[k]),j=s();return(0,q.useEffect)(()=>{async function n(){let{servers:n,errors:r}=t?{servers:{},errors:[]}:await T(e),i={...n,...e};W(a,r),a(e=>{let{stale:t,...n}=m(e.mcp,i);for(let e of t){let t=o.current.get(e.name);t&&(clearTimeout(t),o.current.delete(e.name)),e.type===`connected`&&(e.client.onclose=void 0,w(e.name,e.config).catch(()=>{}))}let r=new Set(n.clients.map(e=>e.name)),a=Object.entries(i).filter(([e])=>!r.has(e)).map(([e,t])=>({name:e,type:x(e)?`disabled`:`pending`,config:t}));return a.length===0&&t.length===0?e:{...e,mcp:{...e.mcp,...n,clients:[...n.clients,...a]}}})}n().catch(e=>{I(`useManageMCPConnections`,`Failed to initialize servers as pending: ${M(e)}`)})},[t,e,a,j,r]),(0,q.useEffect)(()=>{let n=!1;async function r(){let r=Promise.resolve({}),{servers:i,errors:o}=t?{servers:{},errors:[]}:await T(e,r);if(n)return;W(a,o);let s={...i,...e},c=Object.fromEntries(Object.entries(s).filter(([e])=>!x(e)));d(A,c).catch(e=>{I(`useManageMcpConnections`,`Failed to get MCP resources: ${M(e)}`)});let l={},u={...s,...l},f={enterprise:0,global:0,project:0,user:0,plugin:0,claudeai:0};for(let[e,t]of Object.entries(u))t.scope===`enterprise`?f.enterprise++:t.scope===`user`?f.global++:t.scope===`project`?f.project++:t.scope===`local`?f.user++:t.scope===`dynamic`?f.plugin++:t.scope===`claudeai`&&f.claudeai++;({...f})}return r(),()=>{n=!0}},[t,e,A,a,j,r]),(0,q.useEffect)(()=>{let e=o.current;return()=>{for(let t of e.values())clearTimeout(t);e.clear(),b.current!==null&&(clearTimeout(b.current),b.current=null,O())}},[O]),{reconnectMcpServer:(0,q.useCallback)(async e=>{let t=n.getState().mcp.clients.find(t=>t.name===e);if(!t)throw Error(`MCP server ${e} not found`);let r=o.current.get(e);r&&(clearTimeout(r),o.current.delete(e));let i=await _(e,t.config);return A(i),i},[n,A]),toggleMcpServer:(0,q.useCallback)(async e=>{let t=n.getState().mcp.clients.find(t=>t.name===e);if(!t)throw Error(`MCP server ${e} not found`);if(t.type!==`disabled`){let n=o.current.get(e);n&&(clearTimeout(n),o.current.delete(e)),S(e,!1),t.type===`connected`&&await w(e,t.config),k({name:e,type:`disabled`,config:t.config})}else{S(e,!0),k({name:e,type:`pending`,config:t.config});let n=await _(e,t.config);A(n)}},[n,k,A])}}function K(e){switch(e){case`http`:return`HTTP`;case`ws`:case`ws-ide`:return`WebSocket`;default:return`SSE`}}var q,J,Y,X,re=e((()=>{q=t(n(),1),o(),p(),b(),z(),B(),te(),O(),P(),H(),A(),j(),L(),k(),a(),c(),J=5,Y=1e3,X=3e4}));function ie(){let e=(0,Z.useContext)($);if(!e)throw Error(`useMcpReconnect must be used within MCPConnectionManager`);return e.reconnectMcpServer}function ae(){let e=(0,Z.useContext)($);if(!e)throw Error(`useMcpToggleEnabled must be used within MCPConnectionManager`);return e.toggleMcpServer}function oe({children:e,dynamicMcpConfig:t,isStrictMcpConfig:n}){let{reconnectMcpServer:r,toggleMcpServer:i}=G(t,n),a=(0,Z.useMemo)(()=>({reconnectMcpServer:r,toggleMcpServer:i}),[r,i]);return(0,Q.jsx)($.Provider,{value:a,children:e})}var Z,Q,$,se=e((()=>{Z=t(n(),1),re(),Q=r(),$=(0,Z.createContext)(null)}));export{ae as i,se as n,ie as r,oe as t};
@@ -1 +0,0 @@
1
- import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{n,t as r}from"./figures-5ThXQEtq.js";import{D as i,H as a,I as o,P as s,T as c,ai as l,j as u,t as d,y as f}from"./src-BX54x08P.js";import{t as p}from"./jsx-runtime-Bb4Xn-E0.js";import{$ as m,Q as h,nt as g}from"./settings-D4M13toi.js";import{$d as _,Bh as v,Gd as y,Hh as b,Id as x,Vd as ee,Wd as te,Xd as S,Yd as C,hd as w,kd as ne,md as T,qd as re,sf as E,uf as D,zh as O}from"./loadAgentsDir-bmpKLPdG.js";import{I as k,M as ie}from"./debug-2pVES-2G.js";import{n as ae}from"./analytics-COpjZpvd.js";import{l as A,n as oe,o as j}from"./stringUtils-Cs6E5f-B.js";import{i as M,n as N,r as P}from"./MCPConnectionManager-C7RmKzJh.js";import{n as F,t as I}from"./useExitOnCtrlCDWithKeybindings-BT0nexZw.js";import{t as L}from"./select-CaxQ-BVq.js";import{r as R,t as z}from"./Spinner-C0qHjfIY.js";import{t as B}from"./CustomSelect-t4wXuXWH.js";function V({serverToolsCount:e,serverPromptsCount:t,serverResourcesCount:n}){let r=[];return e>0&&r.push(`tools`),n>0&&r.push(`resources`),t>0&&r.push(`prompts`),(0,H.jsxs)(o,{children:[(0,H.jsx)(s,{bold:!0,children:`Capabilities: `}),(0,H.jsx)(s,{color:`text`,children:r.length>0?(0,H.jsx)(c,{children:r}):`none`})]})}var H,U=e((()=>{d(),H=p()}));function W(e,t){switch(e.client.type){case`connected`:return{message:`Reconnected to ${t}.`,success:!0};case`needs-auth`:return{message:`${t} requires authentication. Use the 'Authenticate' option.`,success:!1};case`failed`:return{message:`Failed to reconnect to ${t}.`,success:!1};default:return{message:`Unknown result when reconnecting to ${t}.`,success:!1}}}function G(e,t){return`Error reconnecting to ${t}: ${e instanceof Error?e.message:String(e)}`}var K=e((()=>{}));function se({server:e,serverToolsCount:t,onViewTools:n,onCancel:l,onComplete:d,borderless:f=!1}){let[p]=a(),m=F(),h=v(e=>e.mcp),g=b(),[_,x]=(0,q.useState)(!1),[S,w]=(0,q.useState)(null),E=P(),D=M(),O=oe(String(e.name)),k=C(h.commands,e.name).length,ae=q.useCallback(async()=>{let t=e.client.type!==`disabled`;try{await D(e.name),e.config.type,l()}catch(n){d?.(`Failed to ${t?`disable`:`enable`} MCP server '${e.name}': ${ie(n)}`)}},[e.client.type,e.config.type,e.name,D,l,d]);if(_)return(0,J.jsxs)(o,{flexDirection:`column`,gap:1,padding:1,children:[(0,J.jsxs)(s,{color:`text`,children:[`Connecting to `,(0,J.jsx)(s,{bold:!0,children:e.name}),`…`]}),(0,J.jsxs)(o,{children:[(0,J.jsx)(z,{}),(0,J.jsx)(s,{children:` Establishing connection to MCP server`})]}),(0,J.jsx)(s,{dimColor:!0,children:`This may take a few moments.`})]});let A=[];return e.client.type===`disabled`&&A.push({label:`Enable`,value:`toggle-enabled`}),e.client.type===`connected`&&t>0&&A.push({label:`View tools`,value:`tools`}),e.client.type!==`disabled`&&(e.client.type!==`needs-auth`&&A.push({label:`Reconnect`,value:`reconnectMcpServer`}),A.push({label:`Disable`,value:`toggle-enabled`})),A.length===0&&A.push({label:`Back`,value:`back`}),(0,J.jsxs)(o,{flexDirection:`column`,children:[(0,J.jsxs)(o,{flexDirection:`column`,paddingX:1,borderStyle:f?void 0:`round`,children:[(0,J.jsx)(o,{marginBottom:1,children:(0,J.jsxs)(s,{bold:!0,children:[O,` MCP Server`]})}),(0,J.jsxs)(o,{flexDirection:`column`,gap:0,children:[(0,J.jsxs)(o,{children:[(0,J.jsx)(s,{bold:!0,children:`Status: `}),e.client.type===`disabled`?(0,J.jsxs)(s,{children:[u(`inactive`,p)(r.radioOff),` disabled`]}):e.client.type===`connected`?(0,J.jsxs)(s,{children:[u(`success`,p)(r.tick),` connected`]}):e.client.type===`pending`?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(s,{dimColor:!0,children:r.radioOff}),(0,J.jsx)(s,{children:` connecting…`})]}):e.client.type===`needs-auth`?(0,J.jsxs)(s,{children:[u(`warning`,p)(r.triangleUpOutline),` needs authentication`]}):(0,J.jsxs)(s,{children:[u(`error`,p)(r.cross),` failed`]})]}),(0,J.jsxs)(o,{children:[(0,J.jsx)(s,{bold:!0,children:`URL: `}),(0,J.jsx)(s,{dimColor:!0,children:e.config.url})]}),(0,J.jsxs)(o,{children:[(0,J.jsx)(s,{bold:!0,children:`Config location: `}),(0,J.jsx)(s,{dimColor:!0,children:ee(e.scope)})]}),e.client.type===`connected`&&(0,J.jsx)(V,{serverToolsCount:t,serverPromptsCount:k,serverResourcesCount:h.resources[e.name]?.length||0}),e.client.type===`connected`&&t>0&&(0,J.jsxs)(o,{children:[(0,J.jsx)(s,{bold:!0,children:`Tools: `}),(0,J.jsxs)(s,{dimColor:!0,children:[t,` tools`]})]})]}),S&&(0,J.jsx)(o,{marginTop:1,children:(0,J.jsxs)(s,{color:`error`,children:[`Error: `,S]})}),A.length>0&&(0,J.jsx)(o,{marginTop:1,children:(0,J.jsx)(L,{options:A,onChange:async t=>{switch(t){case`tools`:n();break;case`reconnectMcpServer`:x(!0),w(null);try{await ne(e.name,{...e.config,scope:e.scope}),g(t=>{let n=t.mcp.clients.map(t=>t.name===e.name?{...t,type:`pending`}:t),r=re(t.mcp.tools,e.name),i=te(t.mcp.commands,e.name),a=y(t.mcp.resources,e.name);return{...t,mcp:{...t.mcp,clients:n,tools:r,commands:i,resources:a}}});let{message:t}=W(await E(e.name),e.name);d?.(t)}catch(t){d?.(G(t,e.name))}finally{x(!1)}break;case`toggle-enabled`:await ae();break;case`back`:l();break}},onCancel:l})})]}),(0,J.jsx)(o,{marginTop:1,children:(0,J.jsx)(s,{dimColor:!0,italic:!0,children:m.pending?(0,J.jsxs)(J.Fragment,{children:[`Press `,m.keyName,` again to exit`]}):(0,J.jsxs)(c,{children:[(0,J.jsx)(i,{shortcut:`↑↓`,action:`navigate`}),(0,J.jsx)(i,{shortcut:`Enter`,action:`select`}),(0,J.jsx)(T,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]})})})]})}var q,J,ce=e((()=>{n(),q=t(l(),1),ae(),I(),d(),x(),N(),_(),O(),k(),j(),w(),B(),R(),U(),K(),J=p()}));function le({server:e,serverToolsCount:t,onViewTools:n,onCancel:l,onComplete:d,borderless:f=!1}){let[p]=a(),m=F(),h=v(e=>e.mcp),g=P(),_=M(),[y,b]=(0,Y.useState)(!1),x=Y.useCallback(async()=>{let t=e.client.type!==`disabled`;try{await _(e.name),l()}catch(n){d(`Failed to ${t?`disable`:`enable`} MCP server '${e.name}': ${ie(n)}`)}},[e.client.type,e.name,_,l,d]),te=oe(String(e.name)),S=C(h.commands,e.name).length,w=[];return e.client.type!==`disabled`&&t>0&&w.push({label:`View tools`,value:`tools`}),e.client.type!==`disabled`&&w.push({label:`Reconnect`,value:`reconnectMcpServer`}),w.push({label:e.client.type===`disabled`?`Enable`:`Disable`,value:`toggle-enabled`}),w.length===0&&w.push({label:`Back`,value:`back`}),y?(0,X.jsxs)(o,{flexDirection:`column`,gap:1,padding:1,children:[(0,X.jsxs)(s,{color:`text`,children:[`Reconnecting to `,(0,X.jsx)(s,{bold:!0,children:e.name})]}),(0,X.jsxs)(o,{children:[(0,X.jsx)(z,{}),(0,X.jsx)(s,{children:` Restarting MCP server process`})]}),(0,X.jsx)(s,{dimColor:!0,children:`This may take a few moments.`})]}):(0,X.jsxs)(o,{flexDirection:`column`,children:[(0,X.jsxs)(o,{flexDirection:`column`,paddingX:1,borderStyle:f?void 0:`round`,children:[(0,X.jsx)(o,{marginBottom:1,children:(0,X.jsxs)(s,{bold:!0,children:[te,` MCP Server`]})}),(0,X.jsxs)(o,{flexDirection:`column`,gap:0,children:[(0,X.jsxs)(o,{children:[(0,X.jsx)(s,{bold:!0,children:`Status: `}),e.client.type===`disabled`?(0,X.jsxs)(s,{children:[u(`inactive`,p)(r.radioOff),` disabled`]}):e.client.type===`connected`?(0,X.jsxs)(s,{children:[u(`success`,p)(r.tick),` connected`]}):e.client.type===`pending`?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(s,{dimColor:!0,children:r.radioOff}),(0,X.jsx)(s,{children:` connecting…`})]}):(0,X.jsxs)(s,{children:[u(`error`,p)(r.cross),` failed`]})]}),(0,X.jsxs)(o,{children:[(0,X.jsx)(s,{bold:!0,children:`Command: `}),(0,X.jsx)(s,{dimColor:!0,children:e.config.command})]}),e.config.args&&e.config.args.length>0&&(0,X.jsxs)(o,{children:[(0,X.jsx)(s,{bold:!0,children:`Args: `}),(0,X.jsx)(s,{dimColor:!0,children:e.config.args.join(` `)})]}),(0,X.jsxs)(o,{children:[(0,X.jsx)(s,{bold:!0,children:`Config location: `}),(0,X.jsx)(s,{dimColor:!0,children:ee(E(e.name)?.scope??`dynamic`)})]}),e.client.type===`connected`&&(0,X.jsx)(V,{serverToolsCount:t,serverPromptsCount:S,serverResourcesCount:h.resources[e.name]?.length||0}),e.client.type===`connected`&&t>0&&(0,X.jsxs)(o,{children:[(0,X.jsx)(s,{bold:!0,children:`Tools: `}),(0,X.jsxs)(s,{dimColor:!0,children:[t,` tools`]})]})]}),w.length>0&&(0,X.jsx)(o,{marginTop:1,children:(0,X.jsx)(L,{options:w,onChange:async t=>{if(t===`tools`)n();else if(t===`reconnectMcpServer`){b(!0);try{let{message:t}=W(await g(e.name),e.name);d?.(t)}catch(t){d?.(G(t,e.name))}finally{b(!1)}}else t===`toggle-enabled`?await x():t===`back`&&l()},onCancel:l})})]}),(0,X.jsx)(o,{marginTop:1,children:(0,X.jsx)(s,{dimColor:!0,italic:!0,children:m.pending?(0,X.jsxs)(X.Fragment,{children:[`Press `,m.keyName,` again to exit`]}):(0,X.jsxs)(c,{children:[(0,X.jsx)(i,{shortcut:`↑↓`,action:`navigate`}),(0,X.jsx)(i,{shortcut:`Enter`,action:`select`}),(0,X.jsx)(T,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]})})})]})}var Y,X,ue=e((()=>{n(),Y=t(l(),1),I(),d(),D(),N(),_(),O(),k(),j(),w(),B(),R(),U(),K(),X=p()}));function de({tool:e,server:t,onBack:n}){let[r,i]=Z.useState(``),a=m(e.name,t.name),c=h(e.userFacingName?e.userFacingName({}):a),l=e.isReadOnly?.({})??!1,u=e.isDestructive?.({})??!1,d=e.isOpenWorld?.({})??!1;return Z.useEffect(()=>{async function t(){try{let t=await e.description({},{isNonInteractiveSession:!1,toolPermissionContext:{mode:`default`,additionalWorkingDirectories:new Map,alwaysAllowRules:{},alwaysDenyRules:{},alwaysAskRules:{},isBypassPermissionsModeAvailable:!1},tools:[]});i(t)}catch{i(`Failed to load description`)}}t()},[e]),(0,Q.jsx)(f,{title:(0,Q.jsxs)(Q.Fragment,{children:[c,l&&(0,Q.jsx)(s,{color:`success`,children:` [read-only]`}),u&&(0,Q.jsx)(s,{color:`error`,children:` [destructive]`}),d&&(0,Q.jsx)(s,{dimColor:!0,children:` [open-world]`})]}),subtitle:t.name,onCancel:n,inputGuide:e=>e.pending?(0,Q.jsxs)(s,{children:[`Press `,e.keyName,` again to exit`]}):(0,Q.jsx)(T,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`}),children:(0,Q.jsxs)(o,{flexDirection:`column`,children:[(0,Q.jsxs)(o,{children:[(0,Q.jsx)(s,{bold:!0,children:`Tool name: `}),(0,Q.jsx)(s,{dimColor:!0,children:a})]}),(0,Q.jsxs)(o,{children:[(0,Q.jsx)(s,{bold:!0,children:`Full name: `}),(0,Q.jsx)(s,{dimColor:!0,children:e.name})]}),r&&(0,Q.jsxs)(o,{flexDirection:`column`,marginTop:1,children:[(0,Q.jsx)(s,{bold:!0,children:`Description:`}),(0,Q.jsx)(s,{wrap:`wrap`,children:r})]}),e.inputJSONSchema?.properties&&Object.keys(e.inputJSONSchema.properties).length>0&&(0,Q.jsxs)(o,{flexDirection:`column`,marginTop:1,children:[(0,Q.jsx)(s,{bold:!0,children:`Parameters:`}),(0,Q.jsx)(o,{marginLeft:2,flexDirection:`column`,children:Object.entries(e.inputJSONSchema.properties).map(([t,n])=>{let r=(e.inputJSONSchema?.required)?.includes(t);return(0,Q.jsxs)(s,{children:[`• `,t,r&&(0,Q.jsx)(s,{dimColor:!0,children:` (required)`}),`:`,` `,(0,Q.jsx)(s,{dimColor:!0,children:typeof n==`object`&&n&&`type`in n?String(n.type):`unknown`}),typeof n==`object`&&n&&`description`in n&&(0,Q.jsxs)(s,{dimColor:!0,children:[` - `,String(n.description)]})]},t)})})]})]})})}var Z,Q,fe=e((()=>{Z=t(l(),1),d(),g(),w(),Q=p()}));function pe({server:e,onSelectTool:t,onBack:n}){let r=v(e=>e.mcp.tools),a=me.useMemo(()=>e.client.type===`connected`?S(r,e.name):[],[e,r]),o=a.map((t,n)=>{let r=m(t.name,e.name),i=h(t.userFacingName?t.userFacingName({}):r),a=t.isReadOnly?.({})??!1,o=t.isDestructive?.({})??!1,s=t.isOpenWorld?.({})??!1,c=[];return a&&c.push(`read-only`),o&&c.push(`destructive`),s&&c.push(`open-world`),{label:i,value:n.toString(),description:c.length>0?c.join(`, `):void 0,descriptionColor:o?`error`:a?`success`:void 0}});return(0,$.jsx)(f,{title:`Tools for ${e.name}`,subtitle:`${a.length} ${A(a.length,`tool`)}`,onCancel:n,inputGuide:e=>e.pending?(0,$.jsxs)(s,{children:[`Press `,e.keyName,` again to exit`]}):(0,$.jsxs)(c,{children:[(0,$.jsx)(i,{shortcut:`↑↓`,action:`navigate`}),(0,$.jsx)(i,{shortcut:`Enter`,action:`select`}),(0,$.jsx)(T,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]}),children:a.length===0?(0,$.jsx)(s,{dimColor:!0,children:`No tools available`}):(0,$.jsx)(L,{options:o,onChange:e=>{let n=parseInt(e,10),r=a[n];r&&t(r,n)},onCancel:n})})}var me,$,he=e((()=>{me=t(l(),1),d(),g(),_(),O(),j(),w(),B(),$=p()}));export{le as a,ce as c,fe as i,he as n,ue as o,de as r,se as s,pe as t};
@@ -1,3 +0,0 @@
1
- import{n as e,o as t,r as n}from"./rolldown-runtime-DaDcL9Zw.js";import{n as r,t as i}from"./figures-5ThXQEtq.js";import{C as a,Gt as o,I as s,P as c,Wt as l,ai as u,ot as d,t as f}from"./src-BX54x08P.js";import{t as p}from"./jsx-runtime-Bb4Xn-E0.js";import{$n as m,Qn as h}from"./settings-D4M13toi.js";import{An as g,Pt as _}from"./state-CXY-q5gr.js";import{$h as v,$o as y,$x as b,Bh as x,Bu as S,Ix as C,Ji as w,Px as T,Qh as ee,Qo as E,Ru as D,Ub as O,Vb as k,Wb as A,Xx as j,_c as te,ag as M,by as ne,eg as re,gc as ie,hS as N,hc as ae,mn as P,nn as oe,sb as F,tb as se,ts as I,un as ce,wa as L,xa as le,yc as R,yy as ue,zh as de}from"./loadAgentsDir-bmpKLPdG.js";import{D as z,h as B,m as V,o as H,q as fe,s as U}from"./log-L1kqxa_P.js";import{n as W}from"./analytics-COpjZpvd.js";import{_ as pe,p as me,y as he}from"./startupProfiler-B9Qv2QGH.js";import{E as ge,T as _e,c as ve,d as ye,w as be}from"./sessionTracing-5a7HDF4e.js";import{n as xe,t as Se}from"./useExitOnCtrlCDWithKeybindings-BT0nexZw.js";import{n as Ce,t as we}from"./select-CaxQ-BVq.js";import{r as Te,t as Ee}from"./Spinner-C0qHjfIY.js";import*as G from"path";import{randomUUID as K}from"crypto";var q=t(u(),1),J=p();f(),_(),fe(),V(),H(),m(),W(),pe(),O(),ue(),be(),D(),ve(),te(),ae(),I(),w(),P();function De(e){let t=e.toLowerCase();return/\b(wtf|wth|ffs|omfg|shit(ty|tiest)?|dumbass|horrible|awful|piss(ed|ing)? off|piece of (shit|crap|junk)|what the (fuck|hell)|fucking? (broken|useless|terrible|awful|horrible)|fuck you|screw (this|you)|so frustrating|this sucks|damn it)\b/.test(t)}function Oe(e){let t=e.toLowerCase().trim();return t===`continue`||/\b(keep going|go on)\b/.test(t)}function ke(e,t,n,r,i,a,o){let s=K();g(s);let c=typeof e==`string`?e:e.find(e=>e.type===`text`)?.text||``;ye(c);let l=typeof e==`string`?e:e.findLast(e=>e.type===`text`)?.text||``;return l&&_e(`user_prompt`,{prompt_length:String(l.length),prompt:ge(l),"prompt.id":s}),De(c),Oe(c),t.length>0?{messages:[b({content:[...typeof e==`string`?e.trim()?[{type:`text`,text:e}]:[]:e,...t],uuid:i,imagePasteIds:n.length>0?n:void 0,permissionMode:a,isMeta:o||void 0}),...r],shouldQuery:!0}:{messages:[b({content:e,uuid:i,permissionMode:a,isMeta:o||void 0}),...r],shouldQuery:!0}}W(),w();async function Ae({input:e,preExpansionInput:t,mode:n,setToolJSX:r,context:i,pastedContents:a,messages:o,setUserInputOnProcessing:s,uuid:c,isAlreadyProcessing:l,querySource:u,canUseTool:d,skipSlashCommands:f,bridgeOrigin:p,isMeta:m,skipAttachments:h,autonomy:g}){let _=typeof e==`string`?e:null,v=_?.startsWith(`/`)&&!f;n===`prompt`&&_!==null&&!m&&!v&&s?.(_),R(`query_process_user_input_base_start`);let y=i.getAppState(),x=await Me(e,n,r,i,a,o,c,l,u,d,y.toolPermissionContext.mode,f,p,m,h,t,g);if(R(`query_process_user_input_base_end`),!x.shouldQuery)return x;R(`query_hooks_start`);let S=C(e)||``;for await(let t of oe(S,y.toolPermissionContext.mode,i,i.requestPrompt))if(t.message?.type!==`progress`){if(t.blockingError)return{messages:[j(`${ce(t.blockingError)}\n\nOriginal prompt: ${e}`,`warning`)],shouldQuery:!1,allowedTools:x.allowedTools};if(t.preventContinuation){let e=t.stopReason?`Operation stopped by hook: ${t.stopReason}`:`Operation stopped by hook`;return x.messages.push(b({content:e})),x.shouldQuery=!1,x}if(t.additionalContexts&&t.additionalContexts.length>0&&x.messages.push(E({type:`hook_additional_context`,content:t.additionalContexts.map(je),hookName:`UserPromptSubmit`,toolUseID:`hook-${K()}`,hookEvent:`UserPromptSubmit`})),t.message)switch(t.message.attachment.type){case`hook_success`:if(!t.message.attachment.content)break;x.messages.push({...t.message,attachment:{...t.message.attachment,content:je(t.message.attachment.content)}});break;default:x.messages.push(t.message);break}}return R(`query_hooks_end`),x}var Y=1e4;function je(e){return e.length>Y?`${e.substring(0,Y)}… [output truncated - exceeded ${Y} characters]`:e}async function Me(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g){let _=null,v=[],b=[],x=e;if(typeof e==`string`)_=e;else if(e.length>0){R(`query_image_processing_start`);let t=[];for(let n of e)if(n.type===`image`){let e=await A(n);if(e.dimensions){let t=k(e.dimensions);t&&b.push(t)}t.push(e.block)}else t.push(n);x=t,R(`query_image_processing_end`);let n=t[t.length-1];n?.type===`text`?(_=n.text,v=t.slice(0,-1)):v=t}if(_===null&&t!==`prompt`)throw Error(`Mode: ${t} requires a string input.`);let C=i?Object.values(i).filter(ne):[],w=C.map(e=>e.id),T=i?await S(i):new Map;R(`query_pasted_image_processing_start`);let ee=await Promise.all(C.map(async e=>{let t={type:`image`,source:{type:`base64`,media_type:e.mediaType||`image/png`,data:e.content}};return e.content.length,{resized:await A(t),originalDimensions:e.dimensions,sourcePath:e.sourcePath??T.get(e.id)}})),E=[];for(let{resized:e,originalDimensions:t,sourcePath:n}of ee){if(e.dimensions){let t=k(e.dimensions,n);t&&b.push(t)}else if(t){let e=k(t,n);e&&b.push(e)}else n&&b.push(`[Image source: ${n}]`);E.push(e.block)}R(`query_pasted_image_processing_end`);let D=d,O=!m&&_!==null&&(t!==`prompt`||D||!_.startsWith(`/`));R(`query_attachment_loading_start`);let j=O?await ie(y(_,r,[],a,c)):[];if(R(`query_attachment_loading_end`),_!==null&&t===`bash`){let{processBashCommand:e}=await import(`./processBashCommand-DtGCgTkF.js`);return X(await e(_,v,j,r,n),b)}if(_!==null&&!D&&_.startsWith(`/`)){let{processSlashCommand:e}=await import(`./processSlashCommand-wXblpK2C.js`);return X(await e(_,v,E,j,r,n,o,s,l,g),b)}if(_!==null&&t===`prompt`){let e=_.trim(),t=j.find(e=>e.attachment.type===`agent_mention`);if(t){let n=`@agent-${t.attachment.agentType}`;e.startsWith(n)}}return X(ke(x,E,w,j,o,u,p),b)}function X(e,t){return t.length>0&&e.messages.push(b({content:t.map(e=>({type:`text`,text:e})),isMeta:!0})),e}var Ne=n({MessageSelector:()=>Fe,messagesAfterAreOnlySynthetic:()=>He,selectableUserMessagesFilter:()=>Q});function Pe(e){return e.type===`text`}function Z(e){return e===`summarize`}function Fe({messages:e,onPreRestore:t,onRestoreMessage:n,onRestoreCode:r,onSummarize:u,onClose:d,preselectedMessage:f}){let p=x(e=>e.fileHistory),[m,h]=(0,q.useState)(void 0),g=v(),_=(0,q.useMemo)(K,[]),y=(0,q.useMemo)(()=>[...e.filter(Q),{...b({content:``}),uuid:_}],[e,_]),[S,C]=(0,q.useState)(y.length-1),w=Math.max(0,Math.min(S-Math.floor($/2),y.length-$)),T=y.length>1,[E,D]=(0,q.useState)(f),[O,k]=(0,q.useState)(void 0);(0,q.useEffect)(()=>{if(!f||!g)return;let e=!1;return re(p,f.uuid).then(t=>{e||k(t)}),()=>{e=!0}},[f,g,p]);let[A,j]=(0,q.useState)(!1),[te,M]=(0,q.useState)(null),[ne,ie]=(0,q.useState)(`both`),[N,ae]=(0,q.useState)(``);function P(e){let t=e?[{value:`both`,label:`Restore code and conversation`},{value:`conversation`,label:`Restore conversation`},{value:`code`,label:`Restore code`}]:[{value:`conversation`,label:`Restore conversation`}];return t.push({value:`summarize`,label:`Summarize from here`,type:`input`,placeholder:`add context (optional)`,initialValue:``,allowEmptySubmitToCancel:!0,showLabelWithValue:!0,labelValueSeparator:`: `,onChange:ae}),t.push({value:`nevermind`,label:`Never mind`}),t}(0,q.useEffect)(()=>{},[]);async function oe(e){t(),j(!0);try{await n(e),j(!1),d()}catch(e){U(e),j(!1),h(`Failed to restore the conversation:\n${e}`)}}async function F(t){let n=e.indexOf(t);if(e.length-1-n,t.type,!e.includes(t)){d();return}if(!g){await oe(t);return}let r=await re(p,t.uuid);D(t),k(r)}async function se(e){if(!E){h(`Message not found.`);return}if(e===`nevermind`){f?d():D(void 0);return}if(Z(e)){t(),j(!0),M(e),h(void 0);try{let e=N.trim()||void 0;await u(E,e,`from`),j(!1),M(null),D(void 0),d()}catch(e){U(e),j(!1),M(null),D(void 0),h(`Failed to summarize:\n${e}`)}return}t(),j(!0),h(void 0);let i=null,a=null;if(e===`code`||e===`both`)try{await r(E)}catch(e){i=e,U(i)}if(e===`conversation`||e===`both`)try{await n(E)}catch(e){a=e,U(a)}j(!1),D(void 0),a&&i?h(`Failed to restore the conversation and code:\n${a}\n${i}`):a?h(`Failed to restore the conversation:\n${a}`):i?h(`Failed to restore the code:\n${i}`):d()}let I=xe(),ce=(0,q.useCallback)(()=>{if(E&&!f){D(void 0);return}d()},[d,E,f]),L=(0,q.useCallback)(()=>C(e=>Math.max(0,e-1)),[]),le=(0,q.useCallback)(()=>C(e=>Math.min(y.length-1,e+1)),[y.length]),R=(0,q.useCallback)(()=>C(0),[]),ue=(0,q.useCallback)(()=>C(y.length-1),[y.length]),de=(0,q.useCallback)(()=>{let e=y[S];e&&F(e)},[y,S,F]);l(`confirm:no`,ce,{context:`Confirmation`,isActive:!E}),o({"messageSelector:up":L,"messageSelector:down":le,"messageSelector:top":R,"messageSelector:bottom":ue,"messageSelector:select":de},{context:`MessageSelector`,isActive:!A&&!m&&!E&&T});let[z,B]=(0,q.useState)({});(0,q.useEffect)(()=>{async function t(){g&&Promise.all(y.map(async(t,n)=>{if(t.uuid!==_){let r=ee(p,t.uuid),i=y.at(n+1),a=r?Ve(e,t.uuid,i?.uuid===_?void 0:i?.uuid):void 0;B(a===void 0?e=>({...e,[n]:void 0}):e=>({...e,[n]:a}))}}))}t()},[y,e,_,p,g]);let V=g&&O?.filesChanged&&O.filesChanged.length>0,H=!m&&!E&&!f&&T;return(0,J.jsxs)(s,{flexDirection:`column`,width:`100%`,children:[(0,J.jsx)(a,{color:`suggestion`}),(0,J.jsxs)(s,{flexDirection:`column`,marginX:1,gap:1,children:[(0,J.jsx)(c,{bold:!0,color:`suggestion`,children:`Rewind`}),m&&(0,J.jsxs)(c,{color:`error`,children:[`Error: `,m]}),!T&&(0,J.jsx)(c,{children:`Nothing to rewind to yet.`}),!m&&E&&T&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(c,{children:[`Confirm you want to restore `,!O&&`the conversation `,`to the point before you sent this message:`]}),(0,J.jsxs)(s,{flexDirection:`column`,paddingLeft:1,borderStyle:`single`,borderRight:!1,borderTop:!1,borderBottom:!1,borderLeft:!0,borderLeftDimColor:!0,children:[(0,J.jsx)(Be,{userMessage:E,color:`text`,isCurrent:!1}),(0,J.jsxs)(c,{dimColor:!0,children:[`(`,me(new Date(E.timestamp)),`)`]})]}),(0,J.jsx)(Le,{selectedRestoreOption:ne,canRestoreCode:!!V,diffStatsForRestore:O}),A&&Z(te)?(0,J.jsxs)(s,{flexDirection:`row`,gap:1,children:[(0,J.jsx)(Ee,{}),(0,J.jsx)(c,{children:`Summarizing…`})]}):(0,J.jsx)(we,{isDisabled:A,options:P(!!V),defaultFocusValue:V?`both`:`conversation`,onFocus:e=>ie(e),onChange:e=>se(e),onCancel:()=>f?d():D(void 0)}),V&&(0,J.jsx)(s,{marginBottom:1,children:(0,J.jsxs)(c,{dimColor:!0,children:[i.warning,` Rewinding does not affect files edited manually or via bash.`]})})]}),H&&(0,J.jsxs)(J.Fragment,{children:[g?(0,J.jsx)(c,{children:`Restore the code and/or conversation to the point before…`}):(0,J.jsx)(c,{children:`Restore and fork the conversation to the point before…`}),(0,J.jsx)(s,{width:`100%`,flexDirection:`column`,children:y.slice(w,w+$).map((e,t)=>{let n=w+t,r=n===S,a=e.uuid===_,o=n in z,l=z[n],u=l?.filesChanged?.length;return(0,J.jsxs)(s,{height:g?3:2,overflow:`hidden`,width:`100%`,flexDirection:`row`,children:[(0,J.jsx)(s,{width:2,minWidth:2,children:r?(0,J.jsxs)(c,{color:`permission`,bold:!0,children:[i.pointer,` `]}):(0,J.jsx)(c,{children:` `})}),(0,J.jsxs)(s,{flexDirection:`column`,children:[(0,J.jsx)(s,{flexShrink:1,height:1,overflow:`hidden`,children:(0,J.jsx)(Be,{userMessage:e,color:r?`suggestion`:void 0,isCurrent:a,paddingRight:10})}),g&&o&&(0,J.jsx)(s,{height:1,flexDirection:`row`,children:l?(0,J.jsx)(c,{dimColor:!r,color:`inactive`,children:u?(0,J.jsxs)(J.Fragment,{children:[u===1&&l.filesChanged[0]?`${G.basename(l.filesChanged[0])} `:`${u} files changed `,(0,J.jsx)(ze,{diffStats:l})]}):(0,J.jsx)(J.Fragment,{children:`No code changes`})}):(0,J.jsxs)(c,{dimColor:!0,color:`warning`,children:[i.warning,` No code restore`]})})]})]},e.uuid)})})]}),!E&&(0,J.jsx)(c,{dimColor:!0,italic:!0,children:I.pending?(0,J.jsxs)(J.Fragment,{children:[`Press `,I.keyName,` again to exit`]}):(0,J.jsxs)(J.Fragment,{children:[!m&&T&&`Enter to continue · `,`Esc to exit`]})})]})]})}function Ie(e){switch(e){case`summarize`:return`Messages after this point will be summarized.`;case`both`:case`conversation`:return`The conversation will be forked.`;case`code`:case`nevermind`:return`The conversation will be unchanged.`}}function Le({selectedRestoreOption:e,canRestoreCode:t,diffStatsForRestore:n}){let r=t&&(e===`both`||e===`code`);return(0,J.jsxs)(s,{flexDirection:`column`,children:[(0,J.jsx)(c,{dimColor:!0,children:Ie(e)}),!Z(e)&&(r?(0,J.jsx)(Re,{diffStatsForRestore:n}):(0,J.jsx)(c,{dimColor:!0,children:`The code will be unchanged.`}))]})}function Re({diffStatsForRestore:e}){if(e===void 0)return;if(!e.filesChanged?.[0])return(0,J.jsx)(c,{dimColor:!0,children:`The code has not changed (nothing will be restored).`});let t=e.filesChanged.length,n=``;return n=t===1?G.basename(e.filesChanged[0]||``):t===2?`${G.basename(e.filesChanged[0]||``)} and ${G.basename(e.filesChanged[1]||``)}`:`${G.basename(e.filesChanged[0]||``)} and ${e.filesChanged.length-1} other files`,(0,J.jsxs)(c,{dimColor:!0,children:[`The code will be restored `,(0,J.jsx)(ze,{diffStats:e}),` in `,n,`.`]})}function ze({diffStats:e}){if(e?.filesChanged)return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(c,{color:`diffAddedWord`,children:[`+`,e.insertions,` `]}),(0,J.jsxs)(c,{color:`diffRemovedWord`,children:[`-`,e.deletions]})]})}function Be({userMessage:e,color:t,dimColor:n,isCurrent:r,paddingRight:i}){let{columns:a}=d();if(r)return(0,J.jsx)(s,{width:`100%`,children:(0,J.jsx)(c,{italic:!0,color:t,dimColor:n,children:`(current)`})});let o=e.message.content,l=typeof o==`string`?null:o[o.length-1],u=B(typeof o==`string`?o.trim():l&&Pe(l)?l.text.trim():`(no prompt)`);if(le(u))return(0,J.jsx)(s,{flexDirection:`row`,width:`100%`,children:(0,J.jsx)(c,{italic:!0,color:t,dimColor:n,children:`((empty message))`})});if(u.includes(`<bash-input>`)){let e=T(u,`bash-input`);if(e)return(0,J.jsxs)(s,{flexDirection:`row`,width:`100%`,children:[(0,J.jsx)(c,{color:`bashBorder`,children:`!`}),(0,J.jsxs)(c,{color:t,dimColor:n,children:[` `,e]})]})}if(u.includes(`<command-message>`)){let e=T(u,z),r=T(u,`command-args`),i=T(u,`skill-format`)===`true`;if(e)return i?(0,J.jsx)(s,{flexDirection:`row`,width:`100%`,children:(0,J.jsxs)(c,{color:t,dimColor:n,children:[`Skill(`,e,`)`]})}):(0,J.jsx)(s,{flexDirection:`row`,width:`100%`,children:(0,J.jsxs)(c,{color:t,dimColor:n,children:[`/`,e,` `,r]})})}return(0,J.jsx)(s,{flexDirection:`row`,width:`100%`,children:(0,J.jsx)(c,{color:t,dimColor:n,children:i?he(u,a-i,!0):u.slice(0,500).split(`
2
- `).slice(0,4).join(`
3
- `)})})}function Ve(e,t,n){let r=e.findIndex(e=>e.uuid===t);if(r===-1)return;let i=n?e.findIndex(e=>e.uuid===n):e.length;i===-1&&(i=e.length);let a=[],o=0,s=0;for(let t=r+1;t<i;t++){let n=e[t];if(!n||!L(n))continue;let r=n.toolUseResult;if(!(!r?.filePath||!r.structuredPatch)){a.includes(r.filePath)||a.push(r.filePath);try{if(`type`in r&&r.type===`create`)o+=r.content.split(/\r?\n/).length;else for(let e of r.structuredPatch){let t=h(e.lines,e=>e.startsWith(`+`)),n=h(e.lines,e=>e.startsWith(`-`));o+=t,s+=n}}catch{}}}return{filesChanged:a,insertions:o,deletions:s}}function Q(e){if(e.type!==`user`||Array.isArray(e.message.content)&&e.message.content[0]?.type===`tool_result`||N(e)||e.isMeta||e.isCompactSummary||e.isVisibleInTranscriptOnly)return!1;let t=e.message.content,n=typeof t==`string`?null:t[t.length-1],r=typeof t==`string`?t.trim():n&&Pe(n)?n.text.trim():``;return!(r.indexOf(`<local-command-stdout>`)!==-1||r.indexOf(`<local-command-stderr>`)!==-1||r.indexOf(`<bash-stdout>`)!==-1||r.indexOf(`<bash-stderr>`)!==-1||r.indexOf(`<task-notification>`)!==-1||r.indexOf(`<tick>`)!==-1)}function He(e,t){for(let n=t+1;n<e.length;n++){let t=e[n];if(t&&!N(t)&&!L(t)&&t.type!==`progress`&&t.type!==`system`&&t.type!==`attachment`&&!(t.type===`user`&&t.isMeta)){if(t.type===`assistant`){let e=t.message.content;if(Array.isArray(e)&&e.some(e=>e.type===`text`&&e.text.trim()||e.type===`tool_use`))return!1;continue}if(t.type===`user`)return!1}}return!0}var $,Ue=e((()=>{r(),W(),de(),M(),Se(),se(),w(),Ce(),Te(),F(),$=7}));export{Q as a,He as i,Ne as n,Ae as o,Ue as r,Fe as t};
@@ -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-bmpKLPdG.js";import{n as Je,t as Ye}from"./cwd-DrEEb4f5.js";import{a as Xe,c as Ze,i as Qe,n as $e,o as et}from"./debug-2pVES-2G.js";import{d as tt,h as nt,o as rt}from"./config-Bio2EjUK.js";import{B as it,L as at,R as ot,q as st}from"./log-L1kqxa_P.js";import{_ as ct,f as lt,p as ut,y as dt}from"./startupProfiler-B9Qv2QGH.js";import{l as ft,o as pt}from"./stringUtils-Cs6E5f-B.js";import{f as mt,h as ht,x as gt}from"./model-Dd3x121y.js";import{gn as _t,vn as vt}from"./prompt-BnDapYGL.js";import{a as yt,n as bt,r as xt,t as St}from"./projectOnboardingState-D-_ijZnG.js";import{n as Ct,t as wt}from"./sleep-xKMbXTJe.js";import{n as Tt,t as Et}from"./systemTheme-Ceakddth.js";import{a as Dt,c as Ot,i as kt}from"./SpinnerGlyph-BR_SiV9L.js";import{n as At,r as jt}from"./PromptInputFooterSuggestions-CHXJsTtQ.js";import{n as Mt,t as Nt}from"./useMainLoopModel-QuE7VkgX.js";import{n as Pt,t as Ft}from"./modalContext-sU2lfR08.js";import{n as It,r as Lt,t as Rt}from"./statusNoticeHelpers-DsrqBOQt.js";import{a as zt,c as Bt,i as Vt,l as Ht,n as Ut,o as Wt,r as Gt,t as Kt,u as qt}from"./logoUtils-qNuBc2nI.js";import{homedir as Jt}from"os";import{relative as Yt}from"path";import{fileURLToPath as Xt}from"url";function Zt(e,t){for(let n of e)if(!t.has(n))return!1;return!0}var Qt=e((()=>{}));function $t(e){if(e.type!==`user`)return!1;let t=Array.isArray(e.message.content)?e.message.content[0]:void 0;return!t||typeof t==`string`||t?.type!==`text`||!t.text.includes(`<task-notification`)||ie(t.text,`status`)!==`completed`?!1:ie(t.text,`summary`)?.startsWith(`Background command `)??!1}function en(e,t){if(!P()||t)return e;let n=[],r=0;for(;r<e.length;){let t=e[r];if($t(t)){let i=0;for(;r<e.length&&$t(e[r]);)i++,r++;i===1?n.push(t):n.push({...t,message:{role:`user`,content:[{type:`text`,text:`<${it}><${at}>completed</${at}><${ot}>${i} background commands completed</${ot}></${it}>`}]}})}else n.push(t),r++}return n}var tn=e((()=>{st(),Te(),z(),M()}));function nn(e){return e.type===`system`&&e.subtype===`stop_hook_summary`&&e.hookLabel!==void 0}function rn(e){let t=[],n=0;for(;n<e.length;){let r=e[n];if(nn(r)){let i=r.hookLabel,a=[];for(;n<e.length;){let t=e[n];if(!nn(t)||t.hookLabel!==i)break;a.push(t),n++}a.length===1?t.push(r):t.push({...r,hookCount:a.reduce((e,t)=>e+t.hookCount,0),hookInfos:a.flatMap(e=>e.hookInfos),hookErrors:a.flatMap(e=>e.hookErrors),preventedContinuation:a.some(e=>e.preventedContinuation),hasOutput:a.some(e=>e.hasOutput),totalDurationMs:Math.max(...a.map(e=>e.totalDurationMs??0))})}else t.push(r),n++}return t}var an=e((()=>{}));function on(e){let t=ln.get(e);return t||(t=new Set(e.filter(e=>e.renderGroupedToolUse).map(e=>e.name)),ln.set(e,t)),t}function sn(e){if(e.type===`assistant`&&e.message?.content&&Array.isArray(e.message.content)&&e.message.content[0]?.type===`tool_use`){let t=e.message.content[0];return{messageId:e.message.id,toolUseId:t.id,toolName:t.name}}return null}function cn(e,t,n=!1){if(n)return{messages:e};let r=on(t),i=new Map;for(let t of e){let e=sn(t);if(e&&r.has(e.toolName)){let n=`${e.messageId}:${e.toolName}`,r=i.get(n)??[];r.push(t),i.set(n,r)}}let a=new Map,o=new Set;for(let[e,t]of i)if(t.length>=2){a.set(e,t);for(let e of t){let t=sn(e);t&&o.add(t.toolUseId)}}let s=new Map;for(let t of e)if(t.type===`user`&&t.message?.content&&Array.isArray(t.message.content))for(let e of t.message.content)e.type===`tool_result`&&o.has(e.tool_use_id)&&s.set(e.tool_use_id,t);let c=[],l=new Set;for(let t of e){let e=sn(t);if(e){let t=`${e.messageId}:${e.toolName}`,n=a.get(t);if(n){if(!l.has(t)){l.add(t);let r=n[0],i=[];for(let e of n){let t=e.message.content[0].id,n=s.get(t);n&&i.push(n)}let a={type:`grouped_tool_use`,toolName:e.toolName,messages:n,results:i,displayMessage:r,uuid:`grouped-${r.uuid}`,timestamp:r.timestamp,messageId:e.messageId};c.push(a)}continue}}if(t.type===`user`&&t.message?.content&&Array.isArray(t.message.content)){let e=t.message.content.filter(e=>e.type===`tool_result`);if(e.length>0&&e.every(e=>o.has(e.tool_use_id)))continue}c.push(t)}return{messages:c}}var ln,un=e((()=>{ln=new WeakMap}));function dn(e){let t=_n.get(e);if(t!==void 0)return t;let n=fn(e).toLowerCase();return _n.set(e,n),n}function fn(e){let t=``;switch(e.type){case`user`:{let n=e.message.content;if(typeof n==`string`)t=gn.has(n)?``:n;else{let r=[];for(let t of n??[])t.type===`text`?gn.has(t.text)||r.push(t.text):t.type===`tool_result`&&r.push(mn(e.toolUseResult));t=r.join(`
2
- `)}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-bmpKLPdG.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-Bio2EjUK.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-Dd3x121y.js";import{at as K,bn as Be,nt as Ve,vn as He}from"./prompt-BnDapYGL.js";import{n as Ue,o as We,r as q}from"./MessageSelector-Kc6JlnDX.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.28`,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-CtFtb35A.js";export{e as REPL};