@readmagic/workmate 0.0.24 → 0.0.26

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (436) hide show
  1. package/dist/chunks/AddWorkspaceDirectory-mS8iUoWY.js +1 -0
  2. package/dist/chunks/AgentsMdExternalIncludesDialog-BHBkysy0.js +1 -0
  3. package/dist/chunks/AgentsMdExternalIncludesDialog-DuStmCjj.js +1 -0
  4. package/dist/chunks/App-D--vtCyq.js +1 -0
  5. package/dist/chunks/BackgroundTasksDialog-mcDuiNGs.js +2 -0
  6. package/dist/chunks/BypassPermissionsModeDialog-DyqI98d2.js +1 -0
  7. package/dist/chunks/CustomSelect-CpMbxYbt.js +1 -0
  8. package/dist/chunks/DiffDialog-BQAU2pJx.js +6 -0
  9. package/dist/chunks/Doctor-BU69VQzw.js +1 -0
  10. package/dist/chunks/Doctor-DJOMbSDE.js +3 -0
  11. package/dist/chunks/ExitFlow-xBOnvhiW.js +2 -0
  12. package/dist/chunks/InvalidConfigDialog-NiuhcaG5.js +1 -0
  13. package/dist/chunks/{InvalidSettingsDialog-iwh8H52b.js → InvalidSettingsDialog-DrromC1I.js} +1 -1
  14. package/dist/chunks/KeybindingProviderSetup-CSUkJHTT.js +1 -0
  15. package/dist/chunks/MCPConnectionManager-Bn1PDn3R.js +1 -0
  16. package/dist/chunks/MCPToolListView-BRxjOaOL.js +1 -0
  17. package/dist/chunks/McpParsingWarnings-BYG2yqjO.js +1 -0
  18. package/dist/chunks/MessageSelector-B7xAQqZI.js +3 -0
  19. package/dist/chunks/Messages-CxMsfjOa.js +10 -0
  20. package/dist/chunks/Onboarding-CkATe87e.js +1 -0
  21. package/dist/chunks/{PermissionDialog-BaibiQae.js → PermissionDialog-tEMMa5-a.js} +1 -1
  22. package/dist/chunks/{PressEnterToContinue-DZc_s_pE.js → PressEnterToContinue-CPOaYnym.js} +1 -1
  23. package/dist/chunks/PromptInputFooterSuggestions-CwqAsTI2.js +1 -0
  24. package/dist/chunks/PromptInputHelpMenu-krq-hiFO.js +1 -0
  25. package/dist/chunks/{ProviderSetup-BCSPsvfv.js → ProviderSetup-J6Ty-Wj8.js} +1 -1
  26. package/dist/chunks/QueryEngine-Mdi_kUaL.js +1 -0
  27. package/dist/chunks/REPL-BgzQtSFF.js +1 -0
  28. package/dist/chunks/REPL-rirm6s_7.js +124 -0
  29. package/dist/chunks/ResumeConversation-Cmsbo5m7.js +1 -0
  30. package/dist/chunks/{SearchBox-C9xxQzh1.js → SearchBox-DQBLKyzJ.js} +1 -1
  31. package/dist/chunks/SearchExtraToolsTool-D1-7C04z.js +1 -0
  32. package/dist/chunks/{SelectMulti-BQRHed-d.js → SelectMulti-BpAjjhsn.js} +1 -1
  33. package/dist/chunks/Settings-B6DImvca.js +2 -0
  34. package/dist/chunks/Spinner-DhhSOFcN.js +1 -0
  35. package/dist/chunks/{SpinnerGlyph-CmkRUvHe.js → SpinnerGlyph-CmVXC-_9.js} +1 -1
  36. package/dist/chunks/TextInput-BboKIug2.js +22 -0
  37. package/dist/chunks/ThemePicker-DTpXbEY0.js +1 -0
  38. package/dist/chunks/TrustDialog-CZ8JpySm.js +1 -0
  39. package/dist/chunks/{ValidationErrorsList-DgNzJQUP.js → ValidationErrorsList-C_gDQfm1.js} +1 -1
  40. package/dist/chunks/_baseEach-DGbaIpJA.js +1 -0
  41. package/dist/chunks/_baseSlice-D67_NpZ1.js +1 -0
  42. package/dist/chunks/add-dir-B576wzi9.js +1 -0
  43. package/dist/chunks/{agentDisplay-M4pfwbMC.js → agentDisplay-ZuFoBZYu.js} +1 -1
  44. package/dist/chunks/{agents-DddX7lLX.js → agents-Dy4_hDic.js} +1 -1
  45. package/dist/chunks/agents-HIOBiw4w.js +101 -0
  46. package/dist/chunks/allErrors-CxPNR2WN.js +1 -0
  47. package/dist/chunks/analytics-COpjZpvd.js +1 -0
  48. package/dist/chunks/appleTerminalBackup-C9kjzdM9.js +1 -0
  49. package/dist/chunks/backgroundHousekeeping-PyLNnGdw.js +1 -0
  50. package/dist/chunks/backgroundHousekeeping-ZCMPmQuU.js +1 -0
  51. package/dist/chunks/banner-DqFectPg.js +2 -0
  52. package/dist/chunks/branch-B_BL5N9N.js +2 -0
  53. package/dist/chunks/{break-cache-BMXqFTeS.js → break-cache-DL95nKZl.js} +2 -2
  54. package/dist/chunks/btw-Y44ctueB.js +1 -0
  55. package/dist/chunks/bundledMode-BxyD5cqq.js +1 -0
  56. package/dist/chunks/caches-5xZ4dSXt.js +1 -0
  57. package/dist/chunks/caches-Be9saXxV.js +1 -0
  58. package/dist/chunks/{claudeDesktop-D8ml2767.js → claudeDesktop-g8eUUY2E.js} +1 -1
  59. package/dist/chunks/{clear-B8ZtFPOK.js → clear-DtTkA707.js} +1 -1
  60. package/dist/chunks/{client-CpTCeWba.js → client-Bw_L3lSc.js} +1 -1
  61. package/dist/chunks/{client-4iqhC8xq.js → client-aJ2Nr_sh.js} +1 -1
  62. package/dist/chunks/client-mnUISv_N.js +1 -0
  63. package/dist/chunks/client-wPqIdEVm.js +1 -0
  64. package/dist/chunks/commands-wfE12a4L.js +1 -0
  65. package/dist/chunks/compact-CvNOtu7J.js +2 -0
  66. package/dist/chunks/config-D3K87Mm1.js +3 -0
  67. package/dist/chunks/config-DTga6Ku8.js +1 -0
  68. package/dist/chunks/config-DtmqWusU.js +1 -0
  69. package/dist/chunks/context-Opu4E8dL.js +1 -0
  70. package/dist/chunks/{context-noninteractive-C7wrRZnM.js → context-noninteractive-B1V2Mp26.js} +5 -5
  71. package/dist/chunks/context-noninteractive-eIlneYiL.js +1 -0
  72. package/dist/chunks/conversation-CG_z7TLE.js +1 -0
  73. package/dist/chunks/conversation-CHesBfFZ.js +1 -0
  74. package/dist/chunks/conversationRecovery-OhitW-7g.js +1 -0
  75. package/dist/chunks/crossProjectResume-mmYx8PrZ.js +40 -0
  76. package/dist/chunks/cwd-BH2f3u0o.js +1 -0
  77. package/dist/chunks/cwd-DrEEb4f5.js +1 -0
  78. package/dist/chunks/debug-kBjDaVkQ.js +39 -0
  79. package/dist/chunks/{detectRepository-CfX8Lc0A.js → detectRepository-M6K2wc7h.js} +1 -1
  80. package/dist/chunks/{diff-DdpHThJ7.js → diff-Cv7tX2-P.js} +1 -1
  81. package/dist/chunks/{directoryCompletion-D_Rtg-4j.js → directoryCompletion-BHyjyKAM.js} +1 -1
  82. package/dist/chunks/doctor-DeBG5SL5.js +1 -0
  83. package/dist/chunks/entry-CbhyIWgj.js +13 -0
  84. package/dist/chunks/envUtils-DZ_SvEVz.js +1 -0
  85. package/dist/chunks/{esm-CGx9qY3q.js → esm-DUH16IqH.js} +1 -1
  86. package/dist/chunks/execAsync-D6SA-YsV.js +1 -0
  87. package/dist/chunks/execFileNoThrow-BfZFnCGa.js +1 -0
  88. package/dist/chunks/execa-CBhG1doD.js +34 -0
  89. package/dist/chunks/exit-OKEV_ddw.js +1 -0
  90. package/dist/chunks/extraUsage-BlRL3yeb.js +1 -0
  91. package/dist/chunks/extractMemories-jnsv-_n_.js +1 -0
  92. package/dist/chunks/fast-4I_qPJCd.js +1 -0
  93. package/dist/chunks/fast-DiolM1M7.js +1 -0
  94. package/dist/chunks/fetchModelList-BRFTQim4.js +1 -0
  95. package/dist/chunks/fetchModelList-qPKAuu4m.js +1 -0
  96. package/dist/chunks/fileSuggestions-iWVXvvLB.js +3 -0
  97. package/dist/chunks/firstPartyEventLogger-CN9UOmEC.js +1 -0
  98. package/dist/chunks/firstPartyEventLogger-RR5rvDtk.js +1 -0
  99. package/dist/chunks/{fpsMetrics-wxj9GAsd.js → fpsMetrics-Ixd0J4CH.js} +1 -1
  100. package/dist/chunks/{gemini-C_ApXgwc.js → gemini-BfVyavwQ.js} +2 -2
  101. package/dist/chunks/generateSessionName-CGaTTXCA.js +1 -0
  102. package/dist/chunks/genericProcessUtils-CVtQOTO2.js +12 -0
  103. package/dist/chunks/getMachineId-bsd-DTYGimUN.js +1 -0
  104. package/dist/chunks/getMachineId-darwin-DqIFUVvd.js +2 -0
  105. package/dist/chunks/getMachineId-linux-CnCTmdzd.js +1 -0
  106. package/dist/chunks/getMachineId-unsupported-Cx21ssu1.js +1 -0
  107. package/dist/chunks/getMachineId-win-vZhex7KX.js +1 -0
  108. package/dist/chunks/goal-BidR-GFa.js +3 -0
  109. package/dist/chunks/grok-DLcuI-U7.js +1 -0
  110. package/dist/chunks/help-CZuvYhXj.js +1 -0
  111. package/dist/chunks/history-BxPGftQw.js +1 -0
  112. package/dist/chunks/hooks-Bg9WIjZQ.js +1 -0
  113. package/dist/chunks/{hooks-DR3IYPJ3.js → hooks-ehqfAM5F.js} +2 -2
  114. package/dist/chunks/install-ACGY0vhM.js +1 -0
  115. package/dist/chunks/instrumentation-B9bfF2mA.js +21 -0
  116. package/dist/chunks/{job-YhJQWgE0.js → job-Coztdn6A.js} +1 -1
  117. package/dist/chunks/keybindings-DwSdLpaE.js +1 -0
  118. package/dist/chunks/launchLocalMemory-DRzfpIOB.js +3 -0
  119. package/dist/chunks/launchOnboarding-D2zFCJf-.js +8 -0
  120. package/dist/chunks/{loadAgentsDir-B0Anodo0.js → loadAgentsDir-DR5PVAc3.js} +590 -594
  121. package/dist/chunks/loadAgentsDir-DqAbnpB-.js +1 -0
  122. package/dist/chunks/{loadPluginHooks-BSwCtQ6T.js → loadPluginHooks-BiQgGfUJ.js} +1 -1
  123. package/dist/chunks/{loader-CICGtLp2.js → loader-6MqzNGmV.js} +1 -1
  124. package/dist/chunks/{localSearch-BxLYi6w_.js → localSearch-CzkxDuOR.js} +1 -1
  125. package/dist/chunks/localSearch-DW3JT2MA.js +1 -0
  126. package/dist/chunks/lockfile-D_9vif6E.js +1 -0
  127. package/dist/chunks/{log-D2TIwHBV.js → log-DWZny1vM.js} +1 -1
  128. package/dist/chunks/logoUtils-DR5T0pr3.js +1 -0
  129. package/dist/chunks/{magicDocs-Bkz7ZcmL.js → magicDocs-BwBxjfLo.js} +2 -2
  130. package/dist/chunks/main-Ryi27wYq.js +345 -0
  131. package/dist/chunks/managedEnv-DCEJh3z3.js +1 -0
  132. package/dist/chunks/managedEnv-Do9fgLpk.js +1 -0
  133. package/dist/chunks/managedEnvConstants-CWcT7nYr.js +1 -0
  134. package/dist/chunks/mcp-BCpnF6wD.js +1 -0
  135. package/dist/chunks/mcp-CJ6SDJEK.js +6 -0
  136. package/dist/chunks/mcp-CZBTxbhu.js +2 -0
  137. package/dist/chunks/memory-BQO6Y0ak.js +1 -0
  138. package/dist/chunks/{modalContext-DDZdU1J8.js → modalContext-CBE8xuck.js} +1 -1
  139. package/dist/chunks/mode-wq70cR44.js +2 -0
  140. package/dist/chunks/model-D42epddJ.js +1 -0
  141. package/dist/chunks/model-DVk9-2dk.js +1 -0
  142. package/dist/chunks/modelOptions-beLgXORr.js +1 -0
  143. package/dist/chunks/nativeInstaller-ChGSz1lb.js +1 -0
  144. package/dist/chunks/{notifications-Bc6k-Ozy.js → notifications-dGBuNvFj.js} +1 -1
  145. package/dist/chunks/onChangeAppState-B4K-rSaF.js +1 -0
  146. package/dist/chunks/open-Cyrr4E5x.js +1 -0
  147. package/dist/chunks/openai-DAwnAV9K.js +2 -0
  148. package/dist/chunks/overlayContext-B6i_6y_0.js +1 -0
  149. package/dist/chunks/{panel-CVS4SK_E.js → panel-C0CF3noE.js} +1 -1
  150. package/dist/chunks/parser-BZt0VFd_.js +1 -0
  151. package/dist/chunks/{parser-Cg6hSCmn.js → parser-DThLwgdM.js} +1 -1
  152. package/dist/chunks/partition-BRQHofxD.js +1 -0
  153. package/dist/chunks/{pasteStore-P0zP-ch0.js → pasteStore-BmehVo5j.js} +1 -1
  154. package/dist/chunks/permissions-DkfWKN-B.js +3 -0
  155. package/dist/chunks/pidLock-YvAaIrIY.js +3 -0
  156. package/dist/chunks/plan-B6U3ioer.js +1 -0
  157. package/dist/chunks/platform-Vl9IynC3.js +2 -0
  158. package/dist/chunks/plugin-CTA2_-F7.js +17 -0
  159. package/dist/chunks/{pluginAutoupdate-ennb9k8_.js → pluginAutoupdate-Dy5W3HWE.js} +1 -1
  160. package/dist/chunks/{pluginBlocklist-9OrNEh--.js → pluginBlocklist-DAoUENwc.js} +1 -1
  161. package/dist/chunks/pluginCliCommands-CaHnj0C_.js +1 -0
  162. package/dist/chunks/{pluginFlagging-js_-WmYj.js → pluginFlagging-BCj9LJP3.js} +1 -1
  163. package/dist/chunks/pluginOperations-ClXNOOG6.js +2 -0
  164. package/dist/chunks/pluginStartupCheck-CiwMKGjx.js +1 -0
  165. package/dist/chunks/{pluginStartupCheck-SRXOyqr7.js → pluginStartupCheck-U8_xk25t.js} +1 -1
  166. package/dist/chunks/plugins-D7zyI9c4.js +4 -0
  167. package/dist/chunks/{poller-CpLBoB-N.js → poller-BeyVwHAf.js} +1 -1
  168. package/dist/chunks/poorMode-DtzWNhsY.js +1 -0
  169. package/dist/chunks/poorMode-Ocff_UT1.js +1 -0
  170. package/dist/chunks/print-BzljdXem.js +13 -0
  171. package/dist/chunks/processBashCommand-RUkmyAl4.js +1 -0
  172. package/dist/chunks/processSlashCommand-DRLO-jNV.js +5 -0
  173. package/dist/chunks/{projectContext-5fmRr6Sd.js → projectContext-COeHKDrk.js} +1 -1
  174. package/dist/chunks/{projectContext-DhtjLv3k.js → projectContext-QN5U3Ggr.js} +1 -1
  175. package/dist/chunks/{projectOnboardingState-B5YATuc6.js → projectOnboardingState-KqcpRXls.js} +1 -1
  176. package/dist/chunks/{prompt-CJ1l3XXk.js → prompt-CTByhpUI.js} +21 -21
  177. package/dist/chunks/prompt-DTpfW6yP.js +1 -0
  178. package/dist/chunks/prompt-D__eHY_5.js +1 -0
  179. package/dist/chunks/promptEditor-CpUFgGzc.js +4 -0
  180. package/dist/chunks/protocolHandler-BQSLVGnG.js +13 -0
  181. package/dist/chunks/{proxy-CDBfZjO7.js → proxy-BtWuysHM.js} +2 -2
  182. package/dist/chunks/reconciler-D6BUq8WB.js +1 -0
  183. package/dist/chunks/refresh-B4pqFp12.js +1 -0
  184. package/dist/chunks/reject-C6IvUvBt.js +1 -0
  185. package/dist/chunks/{reload-plugins-CQZFQLWP.js → reload-plugins-DXQqk7q6.js} +1 -1
  186. package/dist/chunks/rename-D4XBmTBI.js +1 -0
  187. package/dist/chunks/{renderOptions-DV0dn0IW.js → renderOptions-DkP98P_d.js} +1 -1
  188. package/dist/chunks/resume-DzIev0JI.js +2 -0
  189. package/dist/chunks/ripgrep-CYP26Fhg.js +1 -0
  190. package/dist/chunks/ripgrep-D1f1pbCz.js +5 -0
  191. package/dist/chunks/{runtimeObserver-PJ1o8GRA.js → runtimeObserver-BPqlbu0B.js} +4 -4
  192. package/dist/chunks/{runtimeObserver-DEuR8z0f.js → runtimeObserver-BUHs3qjs.js} +1 -1
  193. package/dist/chunks/sandbox-adapter-CumL75tU.js +1 -0
  194. package/dist/chunks/sandbox-toggle-CTtET6Xq.js +1 -0
  195. package/dist/chunks/searchExtraTools-BMCU2zEf.js +1 -0
  196. package/dist/chunks/select-FrwoTzuc.js +1 -0
  197. package/dist/chunks/sessionFileAccessHooks-WO8WTdT9.js +1 -0
  198. package/dist/chunks/{sessionObserver-BtKjvteq.js → sessionObserver-B6xzxckA.js} +2 -2
  199. package/dist/chunks/sessionObserver-CBrM4opL.js +1 -0
  200. package/dist/chunks/sessionStorage-C1EAxDWG.js +1 -0
  201. package/dist/chunks/sessionTracing-UFK96PxT.js +11 -0
  202. package/dist/chunks/settings-BK6gCko-.js +1 -0
  203. package/dist/chunks/settings-YIDksG5Z.js +24 -0
  204. package/dist/chunks/setup-BBvZyrfz.js +3 -0
  205. package/dist/chunks/{shadowedRuleDetection-Bg_aIc5Z.js → shadowedRuleDetection-D6R2OeoH.js} +1 -1
  206. package/dist/chunks/{sideQuestion-D49GsfH7.js → sideQuestion-5jcbOMsR.js} +3 -3
  207. package/dist/chunks/sinks-B-kFqjjd.js +1 -0
  208. package/dist/chunks/sinks-DB_D4lmu.js +1 -0
  209. package/dist/chunks/skillChangeDetector-103-nEle.js +1 -0
  210. package/dist/chunks/{skillGapStore-CcFoHNLl.js → skillGapStore-DOz1KCqo.js} +2 -2
  211. package/dist/chunks/{skillLifecycle-Bnz_4wE5.js → skillLifecycle-D9NkIwFQ.js} +2 -2
  212. package/dist/chunks/{skillSearchPanel-C_5yUhqn.js → skillSearchPanel-DFiSZaJ4.js} +4 -4
  213. package/dist/chunks/skills-DgeLr52a.js +1 -0
  214. package/dist/chunks/sleep-BbWr_FL1.js +1 -0
  215. package/dist/chunks/{src-CiJCsqUl.js → src-C8gyNm5a.js} +1 -1
  216. package/dist/chunks/{src-9vmGsuSI.js → src-Cy5_qH26.js} +1 -1
  217. package/dist/chunks/src-Db7K3F_i.js +3 -0
  218. package/dist/chunks/{src-DL3w8VPk.js → src-WZ94ZKI3.js} +4 -4
  219. package/dist/chunks/startupProfiler-DIM_Ihyp.js +3 -0
  220. package/dist/chunks/startupProfiler-FpGsKWYk.js +1 -0
  221. package/dist/chunks/{state-B4jiUise.js → state-CXY-q5gr.js} +1 -1
  222. package/dist/chunks/state-DXt6rahM.js +1 -0
  223. package/dist/chunks/{staticRender-BVWx0IM1.js → staticRender-RHUIg5ln.js} +1 -1
  224. package/dist/chunks/status-CKLecQZV.js +1 -0
  225. package/dist/chunks/statusNoticeHelpers-DI45AH-c.js +1 -0
  226. package/dist/chunks/stringUtils-D_xPrwGQ.js +4 -0
  227. package/dist/chunks/switcher-D2Z2ZNQ0.js +1 -0
  228. package/dist/chunks/switcher-DhZCaAun.js +1 -0
  229. package/dist/chunks/{tasks-DdcUQEeD.js → tasks-6suPhqsK.js} +1 -1
  230. package/dist/chunks/{templateJobs-C8qsPrLj.js → templateJobs-BKVEWCsb.js} +1 -1
  231. package/dist/chunks/{terminalSetup-qc2PlvOm.js → terminalSetup-7PUR4hfo.js} +1 -1
  232. package/dist/chunks/{terminalSetup-B_10N_gE.js → terminalSetup-Cqy5_PhJ.js} +4 -4
  233. package/dist/chunks/{theme-f1h2QI8J.js → theme-B-HG2PUs.js} +1 -1
  234. package/dist/chunks/tipRegistry-BR_lSGRw.js +2 -0
  235. package/dist/chunks/{toolEventObserver-7QP38x4t.js → toolEventObserver-BY3QVnr6.js} +1 -1
  236. package/dist/chunks/toolPool-BcwIF8Q_.js +1 -0
  237. package/dist/chunks/{types-Dx7P7JLQ.js → types-CD25a50S.js} +16 -16
  238. package/dist/chunks/udsClient-CCxgLiZy.js +1 -0
  239. package/dist/chunks/urlHandler-BNsQKqba.js +1 -0
  240. package/dist/chunks/{use-select-navigation-hWL5VHnL.js → use-select-navigation-CW5alA9r.js} +1 -1
  241. package/dist/chunks/{useDoublePress-C9xxQzh1.js → useDoublePress-DQBLKyzJ.js} +1 -1
  242. package/dist/chunks/useExitOnCtrlCDWithKeybindings-BgJrnuDl.js +1 -0
  243. package/dist/chunks/useMainLoopModel-BVgJo4hN.js +1 -0
  244. package/dist/chunks/useManagePlugins-CrWjzESW.js +1 -0
  245. package/dist/chunks/useMergedTools-r6GQq5mI.js +1 -0
  246. package/dist/chunks/useSearchInput-BITV_Txn.js +1 -0
  247. package/dist/chunks/useSettingsErrors-CO0fTNzn.js +1 -0
  248. package/dist/chunks/util-_zo3I1y8.js +1 -0
  249. package/dist/chunks/validatePlugin-DFGdRhA-.js +1 -0
  250. package/dist/chunks/vim-qgMS88ss.js +1 -0
  251. package/dist/chunks/worktree-CR_M6Qfy.js +1 -0
  252. package/dist/cli.js +1 -1
  253. package/package.json +1 -12
  254. package/scripts/postinstall.cjs +16 -16
  255. package/dist/chunks/AddWorkspaceDirectory-Ch8IcWXO.js +0 -1
  256. package/dist/chunks/AgentsMdExternalIncludesDialog-Cyia0s4g.js +0 -1
  257. package/dist/chunks/AgentsMdExternalIncludesDialog-LjI_H_Au.js +0 -1
  258. package/dist/chunks/App-BOqh_1tN.js +0 -1
  259. package/dist/chunks/BackgroundTasksDialog-CSEuuoq9.js +0 -2
  260. package/dist/chunks/BypassPermissionsModeDialog-CwfCwUr9.js +0 -1
  261. package/dist/chunks/CustomSelect-wmZ9jz0W.js +0 -1
  262. package/dist/chunks/DiffDialog-BpXIEWiE.js +0 -6
  263. package/dist/chunks/Doctor-CMpr7tdf.js +0 -1
  264. package/dist/chunks/Doctor-DqW6j3_B.js +0 -3
  265. package/dist/chunks/ExitFlow-DacaBTlk.js +0 -2
  266. package/dist/chunks/Grove-CNqYPWI6.js +0 -11
  267. package/dist/chunks/InvalidConfigDialog-0TMJItCC.js +0 -1
  268. package/dist/chunks/KeybindingProviderSetup-D49HHTXD.js +0 -1
  269. package/dist/chunks/MCPConnectionManager-Cie77ZAK.js +0 -1
  270. package/dist/chunks/MCPToolListView-B4ehtkXd.js +0 -1
  271. package/dist/chunks/McpParsingWarnings-Bff66RtJ.js +0 -1
  272. package/dist/chunks/MessageSelector-Dpd6Iywp.js +0 -3
  273. package/dist/chunks/Messages-DN7M3oS_.js +0 -10
  274. package/dist/chunks/Onboarding-CQmE3rUf.js +0 -1
  275. package/dist/chunks/PromptInputFooterSuggestions-HI6HH3TP.js +0 -1
  276. package/dist/chunks/PromptInputHelpMenu-3QNUC2Cg.js +0 -1
  277. package/dist/chunks/QueryEngine-DdLWvJv6.js +0 -1
  278. package/dist/chunks/REPL-BqO9KcK_.js +0 -124
  279. package/dist/chunks/REPL-CmZmypfF.js +0 -1
  280. package/dist/chunks/ResumeConversation-DBqX7gva.js +0 -1
  281. package/dist/chunks/SearchExtraToolsTool-BsSoILFj.js +0 -1
  282. package/dist/chunks/Settings-B-7yBewS.js +0 -3
  283. package/dist/chunks/Spinner-ByQXTvAA.js +0 -1
  284. package/dist/chunks/TextInput-B8ruWRf2.js +0 -22
  285. package/dist/chunks/ThemePicker-BQErFFW1.js +0 -1
  286. package/dist/chunks/TrustDialog-BIhz6AZE.js +0 -1
  287. package/dist/chunks/_baseEach-CsIRoaTH.js +0 -1
  288. package/dist/chunks/add-dir-CrUDs19x.js +0 -1
  289. package/dist/chunks/agents-CGaCQeLw.js +0 -101
  290. package/dist/chunks/allErrors-BF73lon8.js +0 -1
  291. package/dist/chunks/analytics-DJobLaWP.js +0 -1
  292. package/dist/chunks/appleTerminalBackup-BArZWB21.js +0 -1
  293. package/dist/chunks/backgroundHousekeeping-Bq3LMsVR.js +0 -17
  294. package/dist/chunks/backgroundHousekeeping-Cl3Ox7Qh.js +0 -1
  295. package/dist/chunks/banner-Cu2-XUek.js +0 -2
  296. package/dist/chunks/branch-Yg_taNlT.js +0 -2
  297. package/dist/chunks/btw-udbprVvu.js +0 -1
  298. package/dist/chunks/caches-ChjIEcdd.js +0 -1
  299. package/dist/chunks/caches-DLJ6urv-.js +0 -1
  300. package/dist/chunks/client-BiqbIkwr.js +0 -1
  301. package/dist/chunks/client-CZ8nyVh5.js +0 -1
  302. package/dist/chunks/commands-CVCpJo7M.js +0 -1
  303. package/dist/chunks/compact-izk6RKHQ.js +0 -2
  304. package/dist/chunks/config-C-Y2qtB2.js +0 -3
  305. package/dist/chunks/config-CFqpXMFX.js +0 -1
  306. package/dist/chunks/config-DD8fCYXn.js +0 -1
  307. package/dist/chunks/context-BbVm4SWK.js +0 -1
  308. package/dist/chunks/context-noninteractive-x0HAzWhc.js +0 -1
  309. package/dist/chunks/conversation-DouVzO0K.js +0 -1
  310. package/dist/chunks/conversation-DrVkifKy.js +0 -1
  311. package/dist/chunks/conversationRecovery-DliPBo_z.js +0 -1
  312. package/dist/chunks/crossProjectResume-DxMy05_P.js +0 -40
  313. package/dist/chunks/cwd-Dc3NV7s8.js +0 -1
  314. package/dist/chunks/cwd-Pa83R95t.js +0 -1
  315. package/dist/chunks/datadog-Cu3s7P48.js +0 -1
  316. package/dist/chunks/debug-Bglx1aTu.js +0 -39
  317. package/dist/chunks/doctor-D_kV_D_l.js +0 -1
  318. package/dist/chunks/entry-Bxseqbi_.js +0 -13
  319. package/dist/chunks/envUtils-DfkgIdYf.js +0 -1
  320. package/dist/chunks/esm-BXTZz3av.js +0 -1
  321. package/dist/chunks/execAsync-Bv2yxuGe.js +0 -1
  322. package/dist/chunks/execFileNoThrow-BTachNBI.js +0 -34
  323. package/dist/chunks/exit-C_R_FgzR.js +0 -1
  324. package/dist/chunks/extraUsage-xMuDiNKh.js +0 -1
  325. package/dist/chunks/extractMemories-D4Dl1itt.js +0 -1
  326. package/dist/chunks/fast-DH-C5IZs.js +0 -1
  327. package/dist/chunks/fast-bopOPrtf.js +0 -1
  328. package/dist/chunks/fetchModelList-DC4VQpqa.js +0 -1
  329. package/dist/chunks/fetchModelList-FE8tzTDc.js +0 -1
  330. package/dist/chunks/fileSuggestions-C-9unnoJ.js +0 -3
  331. package/dist/chunks/firstPartyEventLogger-QmjjQmgt.js +0 -3
  332. package/dist/chunks/firstPartyEventLogger-lFeqhtfh.js +0 -1
  333. package/dist/chunks/generateSessionName-CQ03xlYI.js +0 -1
  334. package/dist/chunks/genericProcessUtils-DwQFuna9.js +0 -23
  335. package/dist/chunks/getMachineId-bsd-Cut1kHoA.js +0 -1
  336. package/dist/chunks/getMachineId-darwin-CsRhaP3y.js +0 -2
  337. package/dist/chunks/getMachineId-linux-Bd7UBNRQ.js +0 -1
  338. package/dist/chunks/getMachineId-unsupported-vFGP8E_8.js +0 -1
  339. package/dist/chunks/getMachineId-win-DamF2CH_.js +0 -1
  340. package/dist/chunks/goal-CdL29Y8C.js +0 -3
  341. package/dist/chunks/grok-C6WAslUT.js +0 -1
  342. package/dist/chunks/grove-O6qp7ITR.js +0 -1
  343. package/dist/chunks/help-DxanITNN.js +0 -1
  344. package/dist/chunks/history-BMycjPTT.js +0 -1
  345. package/dist/chunks/hooks-D9ApLkBp.js +0 -1
  346. package/dist/chunks/install-0D9u2dZw.js +0 -1
  347. package/dist/chunks/instrumentation-BFiGwntt.js +0 -21
  348. package/dist/chunks/keybindings-DZrF9iNd.js +0 -1
  349. package/dist/chunks/launchLocalMemory-DhJ56KDc.js +0 -3
  350. package/dist/chunks/launchOnboarding-DmMoZwv5.js +0 -8
  351. package/dist/chunks/loadAgentsDir-BbUR6pqH.js +0 -1
  352. package/dist/chunks/localSearch-zfn7jgrh.js +0 -1
  353. package/dist/chunks/logoUtils-CRxTutvr.js +0 -1
  354. package/dist/chunks/main-9ksgUUY_.js +0 -345
  355. package/dist/chunks/managedEnv-BEqrGqn1.js +0 -1
  356. package/dist/chunks/managedEnv-OPlzUPbJ.js +0 -1
  357. package/dist/chunks/managedEnvConstants-BPwL2aWI.js +0 -1
  358. package/dist/chunks/mcp-ChF12reQ.js +0 -1
  359. package/dist/chunks/mcp-DoEl5uah.js +0 -2
  360. package/dist/chunks/mcp-hp9qqjAy.js +0 -6
  361. package/dist/chunks/memory-Qv-wGNQ5.js +0 -1
  362. package/dist/chunks/mode-bFXPCR2P.js +0 -2
  363. package/dist/chunks/model-6lkW4o2c.js +0 -1
  364. package/dist/chunks/model-BvQFFOf8.js +0 -1
  365. package/dist/chunks/modelOptions-BBvF3wHK.js +0 -1
  366. package/dist/chunks/nativeInstaller-CdjmE9Zy.js +0 -1
  367. package/dist/chunks/onChangeAppState-DLjZ1x95.js +0 -1
  368. package/dist/chunks/open-BtQHzzL9.js +0 -1
  369. package/dist/chunks/openai-D46QvESE.js +0 -2
  370. package/dist/chunks/overlayContext-8--_fbvY.js +0 -1
  371. package/dist/chunks/parser-CG5RuOCK.js +0 -1
  372. package/dist/chunks/partition-DznN4XZH.js +0 -1
  373. package/dist/chunks/permissions-DmGFViHI.js +0 -3
  374. package/dist/chunks/pidLock-Cm4sW35f.js +0 -3
  375. package/dist/chunks/plan-CzGBz_87.js +0 -1
  376. package/dist/chunks/platform-BacQ6ACS.js +0 -2
  377. package/dist/chunks/plugin-CluR79xX.js +0 -17
  378. package/dist/chunks/pluginCliCommands-CJv5uhOG.js +0 -1
  379. package/dist/chunks/pluginOperations-CcUSHAIa.js +0 -2
  380. package/dist/chunks/pluginStartupCheck-CRBUO9gP.js +0 -1
  381. package/dist/chunks/plugins-IwwaCDba.js +0 -4
  382. package/dist/chunks/poorMode-B0QGV6Ci.js +0 -1
  383. package/dist/chunks/poorMode-G-pnu6NM.js +0 -1
  384. package/dist/chunks/print-CgszM1ea.js +0 -13
  385. package/dist/chunks/processBashCommand-D098WsqY.js +0 -1
  386. package/dist/chunks/processSlashCommand-DOQFjJ88.js +0 -5
  387. package/dist/chunks/prompt-BKPmDAuL.js +0 -1
  388. package/dist/chunks/prompt-CgOklk7z.js +0 -1
  389. package/dist/chunks/promptEditor-DoGHJN_W.js +0 -4
  390. package/dist/chunks/protocolHandler-DjQALaU2.js +0 -13
  391. package/dist/chunks/reconciler-ykkSPR-i.js +0 -1
  392. package/dist/chunks/refresh-Dn_I1R4v.js +0 -1
  393. package/dist/chunks/registerProtocol-CAsDme_E.js +0 -1
  394. package/dist/chunks/reject-DtcCfuZV.js +0 -1
  395. package/dist/chunks/rename-DyEfsZiq.js +0 -1
  396. package/dist/chunks/resume-BcXEDUqZ.js +0 -2
  397. package/dist/chunks/ripgrep-DLs8MraF.js +0 -1
  398. package/dist/chunks/ripgrep-Dl3y5r4m.js +0 -5
  399. package/dist/chunks/sandbox-adapter-DfB9kgQD.js +0 -1
  400. package/dist/chunks/sandbox-toggle-D9GDUsTl.js +0 -1
  401. package/dist/chunks/searchExtraTools-D4gMMQv0.js +0 -1
  402. package/dist/chunks/select-DIxfl_VN.js +0 -1
  403. package/dist/chunks/sessionFileAccessHooks-lbgHnVvi.js +0 -1
  404. package/dist/chunks/sessionObserver-D6qzEdGJ.js +0 -1
  405. package/dist/chunks/sessionStorage-C_7gow_z.js +0 -1
  406. package/dist/chunks/sessionTracing-CtbeAD0s.js +0 -11
  407. package/dist/chunks/settings-B2jvL8Dp.js +0 -24
  408. package/dist/chunks/settings-CisDe8DB.js +0 -1
  409. package/dist/chunks/setup-qecdf-ES.js +0 -3
  410. package/dist/chunks/sinks-C-lP7uyO.js +0 -1
  411. package/dist/chunks/sinks-De-B1lPQ.js +0 -1
  412. package/dist/chunks/skillChangeDetector-DkOJoNhT.js +0 -1
  413. package/dist/chunks/skills-BE5scC-g.js +0 -1
  414. package/dist/chunks/src-CHw1lvBc.js +0 -3
  415. package/dist/chunks/startupProfiler-BH0FoI66.js +0 -1
  416. package/dist/chunks/startupProfiler-CJdr3SxP.js +0 -3
  417. package/dist/chunks/state-BhOKSFi5.js +0 -1
  418. package/dist/chunks/status-Dw09WZLd.js +0 -1
  419. package/dist/chunks/statusNoticeHelpers-BRQpUIlH.js +0 -1
  420. package/dist/chunks/stringUtils-C718f5ey.js +0 -4
  421. package/dist/chunks/switcher-CgZVah7U.js +0 -1
  422. package/dist/chunks/switcher-DZwUo5Ed.js +0 -1
  423. package/dist/chunks/tipRegistry-B71o4qWr.js +0 -2
  424. package/dist/chunks/toolPool-V-7Yv0GA.js +0 -1
  425. package/dist/chunks/udsClient-cQz6nJ_T.js +0 -1
  426. package/dist/chunks/urlHandler-DLz3FZm1.js +0 -1
  427. package/dist/chunks/useExitOnCtrlCDWithKeybindings-BKwzUpgb.js +0 -1
  428. package/dist/chunks/useMainLoopModel-DxvV70Ru.js +0 -1
  429. package/dist/chunks/useManagePlugins-BXLXazrR.js +0 -1
  430. package/dist/chunks/useMergedTools-CCgnBJzO.js +0 -1
  431. package/dist/chunks/useSearchInput-CzopttqC.js +0 -1
  432. package/dist/chunks/useSettingsErrors-SFPWfxsA.js +0 -1
  433. package/dist/chunks/util-Cbb3S6SX.js +0 -1
  434. package/dist/chunks/validatePlugin-BMSoeb_b.js +0 -1
  435. package/dist/chunks/vim-CoRp9lY1.js +0 -1
  436. package/dist/chunks/worktree-Vm-SNY5x.js +0 -1
@@ -0,0 +1,101 @@
1
+ import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{i as n,o as r}from"./envUtils-DZ_SvEVz.js";import{n as i,t as a}from"./figures-5ThXQEtq.js";import{C as o,D as s,I as c,P as l,T as u,Wt as d,ai as f,di as p,fi as m,t as h,y as g}from"./src-WZ94ZKI3.js";import{t as _}from"./jsx-runtime-Bb4Xn-E0.js";import{hr as v,mr as y}from"./state-CXY-q5gr.js";import{$d as b,$x as ee,Ap as x,Au as te,Bh as S,Bv as ne,By as re,Cf as ie,Cp as ae,Dc as oe,Dl as se,Dp as ce,Ec as le,Ef as ue,El as de,Em as fe,F_ as pe,GS as me,Hh as he,I_ as ge,Ji as _e,Mm as ve,Mu as ye,Nm as be,Nu as xe,Op as Se,Pm as Ce,Q as we,Rl as Te,Rm as Ee,Sp as De,Tf as Oe,Tl as ke,Tm as Ae,X as je,_m as Me,_p as Ne,bp as Pe,c as Fe,dd as Ie,ef as Le,et as Re,fw as ze,gm as Be,gp as Ve,hd as C,jm as He,ju as Ue,l as We,ld as Ge,md as w,mw as Ke,nt as qe,o as Je,pw as Ye,r as Xe,s as Ze,t as Qe,tb as T,ty as $e,ua as et,vp as tt,wf as nt,wl as rt,xp as it,yp as at,zh as ot,zl as st,zm as ct,zv as lt,zy as ut}from"./loadAgentsDir-DR5PVAc3.js";import{n as dt,t as ft}from"./cwd-DrEEb4f5.js";import{H as pt,I as mt,N as ht,S as gt,V as _t,Y as vt,x as yt}from"./debug-kBjDaVkQ.js";import{Bn as bt,K as xt,X as St,Yt as Ct,Zt as wt,cn as Tt,nt as Et,on as Dt,rt as Ot,zn as kt}from"./settings-YIDksG5Z.js";import{C as At,T as jt}from"./config-D3K87Mm1.js";import{o as Mt,s as Nt}from"./log-DWZny1vM.js";import{n as Pt}from"./analytics-COpjZpvd.js";import{S as Ft,_ as It}from"./startupProfiler-DIM_Ihyp.js";import{l as Lt,n as Rt,o as zt}from"./stringUtils-D_xPrwGQ.js";import{_n as Bt,vn as Vt}from"./prompt-CTByhpUI.js";import{n as Ht,t as Ut}from"./_baseSlice-D67_NpZ1.js";import{a as Wt,i as Gt,n as Kt,o as qt,r as Jt,t as Yt}from"./agentDisplay-ZuFoBZYu.js";import{n as Xt,t as Zt}from"./TextInput-BboKIug2.js";import{n as Qt,t as $t}from"./useExitOnCtrlCDWithKeybindings-BgJrnuDl.js";import{n as en,t as tn}from"./select-FrwoTzuc.js";import{r as nn,t as rn}from"./Spinner-DhhSOFcN.js";import{n as an,t as on}from"./useMergedTools-r6GQq5mI.js";import{n as sn,r as cn,t as ln}from"./promptEditor-CpUFgGzc.js";import{n as un,t as dn}from"./useMainLoopModel-BVgJo4hN.js";import{join as E}from"path";import{mkdir as fn,open as pn,unlink as mn}from"fs/promises";function hn(e,t,n){var r=e.length;return n=n===void 0?r:n,!t&&n>=r?e:Ut(e,t,n)}var gn=e((()=>{Ht()}));function _n(e){return vn.test(e)}var vn,yn=e((()=>{vn=RegExp(`[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]`)}));function bn(e){return e.split(``)}var xn=e((()=>{}));function Sn(e){return e.match(zn)||[]}var Cn,wn,Tn,En,Dn,On,kn,An,jn,Mn,Nn,Pn,Fn,In,Ln,Rn,zn,Bn=e((()=>{Cn=`\\ud800-\\udfff`,wn=`\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff`,Tn=`\\ufe0e\\ufe0f`,En=`[`+Cn+`]`,Dn=`[`+wn+`]`,On=`\\ud83c[\\udffb-\\udfff]`,kn=`(?:`+Dn+`|`+On+`)`,An=`[^`+Cn+`]`,jn=`(?:\\ud83c[\\udde6-\\uddff]){2}`,Mn=`[\\ud800-\\udbff][\\udc00-\\udfff]`,Nn=`\\u200d`,Pn=kn+`?`,Fn=`[`+Tn+`]?`,In=`(?:`+Nn+`(?:`+[An,jn,Mn].join(`|`)+`)`+Fn+Pn+`)*`,Ln=Fn+Pn+In,Rn=`(?:`+[An+Dn+`?`,Dn,jn,Mn,En].join(`|`)+`)`,zn=RegExp(On+`(?=`+On+`)|`+Rn+Ln,`g`)}));function Vn(e){return _n(e)?Sn(e):bn(e)}var Hn=e((()=>{xn(),yn(),Bn()}));function Un(e){return function(t){t=v(t);var n=_n(t)?Vn(t):void 0,r=n?n[0]:t.charAt(0),i=n?hn(n,1).join(``):t.slice(1);return r[e]()+i}}var Wn=e((()=>{gn(),yn(),Hn(),y()})),Gn,Kn=e((()=>{Wn(),Gn=Un(`toUpperCase`)}));function qn(e){return Gn(v(e).toLowerCase())}var Jn=e((()=>{y(),Kn()})),D,Yn=e((()=>{D={FOLDER_NAME:`.workmate`,AGENTS_DIR:`agents`}}));function Xn(e,t,n,r,i,a,o){return`---
2
+ name: ${e}
3
+ description: "${t.replace(/\\/g,`\\\\`).replace(/"/g,`\\"`).replace(/\n/g,`\\\\n`)}"${n===void 0||n.length===1&&n[0]===`*`?``:`\ntools: ${n.join(`, `)}`}${a?`\nmodel: ${a}`:``}${i?`\ncolor: ${i}`:``}${o?`\nmemory: ${o}`:``}
4
+ ---
5
+
6
+ ${r}
7
+ `}function Zn(e){switch(e){case`flagSettings`:throw Error(`Cannot get directory path for ${e} agents`);case`userSettings`:return E(n(),D.AGENTS_DIR);case`projectSettings`:return E(ft(),D.FOLDER_NAME,D.AGENTS_DIR);case`policySettings`:return E(Ct(),D.FOLDER_NAME,D.AGENTS_DIR);case`localSettings`:return E(ft(),D.FOLDER_NAME,D.AGENTS_DIR)}}function Qn(e){switch(e){case`projectSettings`:return E(`.`,D.FOLDER_NAME,D.AGENTS_DIR);default:return Zn(e)}}function $n(e){return E(Zn(e.source),`${e.agentType}.md`)}function er(e){if(e.source===`built-in`)return`Built-in`;if(e.source===`plugin`)throw Error(`Cannot get file path for plugin agents`);return E(Zn(e.source),`${e.filename||e.agentType}.md`)}function tr(e){return e.source===`built-in`?`Built-in`:E(Qn(e.source),`${e.agentType}.md`)}function nr(e){return Ze(e)?`Built-in`:We(e)?`Plugin: ${e.plugin||`Unknown`}`:e.source===`flagSettings`?`CLI argument`:E(Qn(e.source),`${e.filename||e.agentType}.md`)}async function rr(e){let t=Zn(e);return await fn(t,{recursive:!0}),t}async function ir(e,t,n,r,i,a=!0,o,s,c){if(e===`built-in`)throw Error(`Cannot save built-in agents`);await rr(e);let l=$n({source:e,agentType:t}),u=Xn(t,n,r,i,o,s,c);try{await sr(l,u,a?`wx`:`w`)}catch(e){throw ht(e)===`EEXIST`?Error(`Agent file already exists: ${l}`):e}}async function ar(e,t,n,r,i,a,o){if(e.source===`built-in`)throw Error(`Cannot update built-in agents`);await sr(er(e),Xn(e.agentType,t,n,r,i,a,o))}async function or(e){if(e.source===`built-in`)throw Error(`Cannot delete built-in agents`);let t=er(e);try{await mn(t)}catch(e){if(ht(e)!==`ENOENT`)throw e}}async function sr(e,t,n=`w`){let r=await pn(e,n);try{await r.writeFile(t,{encoding:`utf-8`}),await r.datasync()}finally{await r.close()}}var cr=e((()=>{wt(),Je(),dt(),r(),mt(),Yn()}));function lr({agent:e,tools:t,onBack:n}){let r=tt(e,t,!1),i=nr(e),o=it(e.agentType);d(`confirm:no`,n,{context:`Confirmation`});let s=e=>{e.key===`return`&&(e.preventDefault(),n())};function u(){return r.hasWildcard?(0,O.jsx)(l,{children:`All tools`}):!e.tools||e.tools.length===0?(0,O.jsx)(l,{children:`None`}):(0,O.jsxs)(O.Fragment,{children:[r.validTools.length>0&&(0,O.jsx)(l,{children:r.validTools.join(`, `)}),r.invalidTools.length>0&&(0,O.jsxs)(l,{color:`warning`,children:[a.warning,` Unrecognized: `,r.invalidTools.join(`, `)]})]})}return(0,O.jsxs)(c,{flexDirection:`column`,gap:1,tabIndex:0,autoFocus:!0,onKeyDown:s,children:[(0,O.jsx)(l,{dimColor:!0,children:i}),(0,O.jsxs)(c,{flexDirection:`column`,children:[(0,O.jsxs)(l,{children:[(0,O.jsx)(l,{bold:!0,children:`Description`}),` (tells Work Mate when to use this agent):`]}),(0,O.jsx)(c,{marginLeft:2,children:(0,O.jsx)(l,{children:e.whenToUse})})]}),(0,O.jsxs)(c,{children:[(0,O.jsxs)(l,{children:[(0,O.jsx)(l,{bold:!0,children:`Tools`}),`:`,` `]}),u()]}),(0,O.jsxs)(l,{children:[(0,O.jsx)(l,{bold:!0,children:`Model`}),`: `,ce(e.model)]}),e.permissionMode&&(0,O.jsxs)(l,{children:[(0,O.jsx)(l,{bold:!0,children:`Permission mode`}),`: `,e.permissionMode]}),e.memory&&(0,O.jsxs)(l,{children:[(0,O.jsx)(l,{bold:!0,children:`Memory`}),`: `,ze(e.memory)]}),e.hooks&&Object.keys(e.hooks).length>0&&(0,O.jsxs)(l,{children:[(0,O.jsx)(l,{bold:!0,children:`Hooks`}),`: `,Object.keys(e.hooks).join(`, `)]}),e.skills&&e.skills.length>0&&(0,O.jsxs)(l,{children:[(0,O.jsx)(l,{bold:!0,children:`Skills`}),`:`,` `,e.skills.length>10?`${e.skills.length} skills`:e.skills.join(`, `)]}),o&&(0,O.jsx)(c,{children:(0,O.jsxs)(l,{children:[(0,O.jsx)(l,{bold:!0,children:`Color`}),`:`,` `,(0,O.jsxs)(l,{backgroundColor:o,color:`inverseText`,children:[` `,e.agentType,` `]})]})}),!Ze(e)&&(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(c,{children:(0,O.jsxs)(l,{children:[(0,O.jsx)(l,{bold:!0,children:`System prompt`}),`:`]})}),(0,O.jsx)(c,{marginLeft:2,marginRight:2,children:(0,O.jsx)(Ge,{children:e.getSystemPrompt()})})]})]})}var O,ur=e((()=>{i(),h(),T(),De(),Ye(),Ne(),Je(),x(),Ie(),cr(),O=_()}));function dr({agentName:e,currentColor:t=`automatic`,onConfirm:n}){let[r,i]=(0,fr.useState)(Math.max(0,A.indexOf(t))),o=e=>{if(e.key===`up`)e.preventDefault(),i(e=>e>0?e-1:A.length-1);else if(e.key===`down`)e.preventDefault(),i(e=>e<A.length-1?e+1:0);else if(e.key===`return`){e.preventDefault();let t=A[r];n(t===`automatic`?void 0:t)}},s=A[r];return(0,k.jsxs)(c,{flexDirection:`column`,gap:1,tabIndex:0,autoFocus:!0,onKeyDown:o,children:[(0,k.jsx)(c,{flexDirection:`column`,children:A.map((e,t)=>{let n=t===r;return(0,k.jsxs)(c,{flexDirection:`row`,gap:1,children:[(0,k.jsx)(l,{color:n?`suggestion`:void 0,children:n?a.pointer:` `}),e===`automatic`?(0,k.jsx)(l,{bold:n,children:`Automatic color`}):(0,k.jsxs)(c,{gap:1,children:[(0,k.jsx)(l,{backgroundColor:Pe[e],color:`inverseText`,children:` `}),(0,k.jsx)(l,{bold:n,children:Rt(e)})]})]},e)})}),(0,k.jsxs)(c,{marginTop:1,children:[(0,k.jsx)(l,{children:`Preview: `}),s===void 0||s===`automatic`?(0,k.jsxs)(l,{inverse:!0,bold:!0,children:[` `,`@`,e,` `]}):(0,k.jsxs)(l,{backgroundColor:Pe[s],color:`inverseText`,bold:!0,children:[` `,`@`,e,` `]})]})]})}var fr,k,A,pr=e((()=>{i(),fr=t(f(),1),h(),De(),zt(),k=_(),A=[`automatic`,...at]}));function mr({initialModel:e,onComplete:t,onCancel:n}){let r=hr.useMemo(()=>{let t=Se();return e&&!t.some(t=>t.value===e)?[{value:e,label:e,description:`Current model (custom ID)`},...t]:t},[e]);return(0,gr.jsxs)(c,{flexDirection:`column`,children:[(0,gr.jsx)(c,{marginBottom:1,children:(0,gr.jsx)(l,{dimColor:!0,children:`Model determines the agent's reasoning capabilities and speed.`})}),(0,gr.jsx)(tn,{options:r,defaultValue:e??`sonnet`,onChange:t,onCancel:()=>n?n():t(void 0)})]})}var hr,gr,_r=e((()=>{hr=t(f(),1),h(),x(),en(),gr=_()}));function vr(){return{READ_ONLY:{name:`Read-only tools`,toolNames:new Set([He.name,be.name,rt.name,ut.name,Ae.name,Te.name,de.name,Oe.name,ie.name])},EDIT:{name:`Edit tools`,toolNames:new Set([ye.name,Ee.name,te.name])},EXECUTION:{name:`Execution tools`,toolNames:new Set([Be.name])},MCP:{name:`MCP tools`,toolNames:new Set,isMcp:!0},OTHER:{name:`Other tools`,toolNames:new Set}}}function yr(e){let t=new Map;return e.forEach(e=>{if(Le(e)){let n=Ot(e.name);if(n?.serverName){let r=t.get(n.serverName)||[];r.push(e),t.set(n.serverName,r)}}}),Array.from(t.entries()).map(([e,t])=>({serverName:e,tools:t})).sort((e,t)=>e.serverName.localeCompare(t.serverName))}function br({tools:e,initialTools:t,onComplete:n,onCancel:r}){let i=(0,j.useMemo)(()=>Ve({tools:e,isBuiltIn:!1,isAsync:!1}),[e]),[s,u]=(0,j.useState)(!t||t.includes(`*`)?i.map(e=>e.name):t),[f,p]=(0,j.useState)(0),[m,h]=(0,j.useState)(!1),g=(0,j.useMemo)(()=>{let e=new Set(i.map(e=>e.name));return s.filter(t=>e.has(t))},[s,i]),_=new Set(g),v=g.length===i.length&&i.length>0,y=e=>{e&&u(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},b=(e,t)=>{u(n=>{if(t){let t=e.filter(e=>!n.includes(e));return[...n,...t]}else return n.filter(t=>!e.includes(t))})},ee=()=>{let e=i.map(e=>e.name);n(g.length===e.length&&e.every(e=>g.includes(e))?void 0:g)},x=(0,j.useMemo)(()=>{let e=vr(),t={readOnly:[],edit:[],execution:[],mcp:[],other:[]};return i.forEach(n=>{Le(n)?t.mcp.push(n):e.READ_ONLY.toolNames.has(n.name)?t.readOnly.push(n):e.EDIT.toolNames.has(n.name)?t.edit.push(n):e.EXECUTION.toolNames.has(n.name)?t.execution.push(n):n.name!==`Agent`&&t.other.push(n)}),t},[i]),te=e=>{let t=kt(e,e=>_.has(e.name))<e.length;return()=>{let n=e.map(e=>e.name);b(n,t)}},S=[];S.push({id:`continue`,label:`Continue`,action:ee,isContinue:!0}),S.push({id:`bucket-all`,label:`${v?a.checkboxOn:a.checkboxOff} All tools`,action:()=>{let e=i.map(e=>e.name);b(e,!v)}});let ne=vr();[{id:`bucket-readonly`,name:ne.READ_ONLY.name,tools:x.readOnly},{id:`bucket-edit`,name:ne.EDIT.name,tools:x.edit},{id:`bucket-execution`,name:ne.EXECUTION.name,tools:x.execution},{id:`bucket-mcp`,name:ne.MCP.name,tools:x.mcp},{id:`bucket-other`,name:ne.OTHER.name,tools:x.other}].forEach(({id:e,name:t,tools:n})=>{if(n.length===0)return;let r=kt(n,e=>_.has(e.name))===n.length;S.push({id:e,label:`${r?a.checkboxOn:a.checkboxOff} ${t}`,action:te(n)})});let re=S.length;S.push({id:`toggle-individual`,label:m?`Hide advanced options`:`Show advanced options`,action:()=>{h(!m),m&&f>re&&p(re)},isToggle:!0});let ie=(0,j.useMemo)(()=>yr(i),[i]);return m&&(ie.length>0&&(S.push({id:`mcp-servers-header`,label:`MCP Servers:`,action:()=>{},isHeader:!0}),ie.forEach(({serverName:e,tools:t})=>{let n=kt(t,e=>_.has(e.name))===t.length;S.push({id:`mcp-server-${e}`,label:`${n?a.checkboxOn:a.checkboxOff} ${e} (${t.length} ${Lt(t.length,`tool`)})`,action:()=>{let e=t.map(e=>e.name);b(e,!n)}})}),S.push({id:`tools-header`,label:`Individual Tools:`,action:()=>{},isHeader:!0})),i.forEach(e=>{let t=e.name;if(e.name.startsWith(`mcp__`)){let n=Ot(e.name);t=n?`${n.toolName} (${n.serverName})`:e.name}S.push({id:`tool-${e.name}`,label:`${_.has(e.name)?a.checkboxOn:a.checkboxOff} ${t}`,action:()=>y(e.name)})})),d(`confirm:no`,(0,j.useCallback)(()=>{r?r():n(t)},[r,n,t]),{context:`Confirmation`}),(0,M.jsxs)(c,{flexDirection:`column`,marginTop:1,tabIndex:0,autoFocus:!0,onKeyDown:e=>{if(e.key===`return`){e.preventDefault();let t=S[f];t&&!t.isHeader&&t.action()}else if(e.key===`up`){e.preventDefault();let t=f-1;for(;t>0&&S[t]?.isHeader;)t--;p(Math.max(0,t))}else if(e.key===`down`){e.preventDefault();let t=f+1;for(;t<S.length-1&&S[t]?.isHeader;)t++;p(Math.min(S.length-1,t))}},children:[(0,M.jsxs)(l,{color:f===0?`suggestion`:void 0,bold:f===0,children:[f===0?`${a.pointer} `:` `,`[ Continue ]`]}),(0,M.jsx)(o,{width:40}),S.slice(1).map((e,t)=>{let n=t+1===f,r=e.isToggle,i=e.isHeader;return(0,M.jsxs)(j.Fragment,{children:[r&&(0,M.jsx)(o,{width:40}),i&&t>0&&(0,M.jsx)(c,{marginTop:1}),(0,M.jsxs)(l,{color:i?void 0:n?`suggestion`:void 0,dimColor:i,bold:r&&n,children:[i?``:n?`${a.pointer} `:` `,r?`[ ${e.label} ]`:e.label]})]},e.id)}),(0,M.jsx)(c,{marginTop:1,flexDirection:`column`,children:(0,M.jsx)(l,{dimColor:!0,children:v?`All tools selected`:`${_.size} of ${i.length} tools selected`})})]})}var j,M,xr=e((()=>{i(),j=t(f(),1),Et(),b(),Ne(),St(),Me(),ke(),xe(),re(),ct(),ve(),Ce(),ue(),Ue(),nt(),se(),st(),fe(),h(),T(),bt(),zt(),M=_()}));function Sr(e){return e===`all`?`Agents`:e===`built-in`?`Built-in agents`:e===`plugin`?`Plugin agents`:qn(Dt(e))}var Cr=e((()=>{Jn(),Tt()}));function wr({agent:e,tools:t,onSaved:n,onBack:r}){let i=he(),[o,s]=(0,N.useState)(`menu`),[u,f]=(0,N.useState)(0),[m,h]=(0,N.useState)(null),[g,_]=(0,N.useState)(e.color),v=(0,N.useCallback)(async()=>{let t=await ln(er(e));t.error?h(t.error):n(`Opened ${e.agentType} in editor. If you made edits, restart to load the latest version.`)},[e,n]),y=(0,N.useCallback)(async(t={})=>{let{tools:r,color:a,model:o}=t,s=a??g,c=r!==void 0,l=o!==void 0,u=s!==e.color;if(!c&&!l&&!u)return!1;try{return!Fe(e)&&!We(e)?!1:(await ar(e,e.whenToUse,r??e.tools,e.getSystemPrompt(),s,o??e.model),u&&s&&ae(e.agentType,s),i(t=>{let n=t.agentDefinitions.allAgents.map(t=>t.agentType===e.agentType?{...t,tools:r??t.tools,color:s,model:o??t.model}:t);return{...t,agentDefinitions:{...t.agentDefinitions,activeAgents:Xe(n),allAgents:n}}}),n(`Updated agent: ${p.bold(e.agentType)}`),!0)}catch(e){return h(e instanceof Error?e.message:`Failed to save agent`),!1}},[e,g,n,i]),b=(0,N.useMemo)(()=>[{label:`Open in editor`,action:v},{label:`Edit tools`,action:()=>s(`edit-tools`)},{label:`Edit model`,action:()=>s(`edit-model`)},{label:`Edit color`,action:()=>s(`edit-color`)}],[v]),ee=(0,N.useCallback)(()=>{h(null),o===`menu`?r():s(`menu`)},[o,r]),x=(0,N.useCallback)(e=>{if(e.key===`up`)e.preventDefault(),f(e=>Math.max(0,e-1));else if(e.key===`down`)e.preventDefault(),f(e=>Math.min(b.length-1,e+1));else if(e.key===`return`){e.preventDefault();let t=b[u];t&&t.action()}},[b,u]);d(`confirm:no`,ee,{context:`Confirmation`});let te=()=>(0,P.jsxs)(c,{flexDirection:`column`,tabIndex:0,autoFocus:!0,onKeyDown:x,children:[(0,P.jsxs)(l,{dimColor:!0,children:[`Source: `,Sr(e.source)]}),(0,P.jsx)(c,{marginTop:1,flexDirection:`column`,children:b.map((e,t)=>(0,P.jsxs)(l,{color:t===u?`suggestion`:void 0,children:[t===u?`${a.pointer} `:` `,e.label]},e.label))}),m&&(0,P.jsx)(c,{marginTop:1,children:(0,P.jsx)(l,{color:`error`,children:m})})]});switch(o){case`menu`:return te();case`edit-tools`:return(0,P.jsx)(br,{tools:t,initialTools:e.tools,onComplete:async e=>{s(`menu`),await y({tools:e})}});case`edit-color`:return(0,P.jsx)(dr,{agentName:e.agentType,currentColor:g||e.color||`automatic`,onConfirm:async e=>{_(e),s(`menu`),await y({color:e})}});case`edit-model`:return(0,P.jsx)(mr,{initialModel:e.model,onComplete:async e=>{s(`menu`),await y({model:e})}});default:return null}}var N,P,Tr=e((()=>{m(),i(),N=t(f(),1),ot(),h(),T(),De(),Je(),cn(),cr(),pr(),_r(),xr(),Cr(),P=_()}));function Er({instructions:e=`Press ↑↓ to navigate · Enter to select · Esc to go back`}){let t=Qt();return(0,Dr.jsx)(c,{marginLeft:2,children:(0,Dr.jsx)(l,{dimColor:!0,children:t.pending?`Press ${t.keyName} again to exit`:e})})}var Dr,Or=e((()=>{$t(),h(),Dr=_()}));function kr({source:e,agents:t,onBack:n,onSelect:r,onCreateNew:i,changes:s}){let[u,d]=F.useState(null),[f,p]=F.useState(!0),m=F.useMemo(()=>[...t].sort(Kt),[t]),h=e=>({isOverridden:!!e.overriddenBy,overriddenBy:e.overriddenBy||null}),_=()=>(0,I.jsxs)(c,{children:[(0,I.jsx)(l,{color:f?`suggestion`:void 0,children:f?`${a.pointer} `:` `}),(0,I.jsx)(l,{color:f?`suggestion`:void 0,children:`Create new agent`})]}),v=e=>{let t=e.source===`built-in`,n=!t&&!f&&u?.agentType===e.agentType&&u?.source===e.source,{isOverridden:r,overriddenBy:i}=h(e),o=t||r,s=!t&&n?`suggestion`:void 0,d=Wt(e);return(0,I.jsxs)(c,{children:[(0,I.jsx)(l,{dimColor:o&&!n,color:s,children:t?``:n?`${a.pointer} `:` `}),(0,I.jsx)(l,{dimColor:o&&!n,color:s,children:e.agentType}),d&&(0,I.jsxs)(l,{dimColor:!0,color:s,children:[` · `,d]}),e.memory&&(0,I.jsxs)(l,{dimColor:!0,color:s,children:[` · `,e.memory,` memory`]}),i&&(0,I.jsxs)(l,{dimColor:!n,color:n?`warning`:void 0,children:[` `,a.warning,` shadowed by `,Jt(i)]})]},`${e.agentType}-${e.source}`)},y=F.useMemo(()=>{let t=m.filter(e=>e.source!==`built-in`);return e===`all`?Yt.filter(e=>e.source!==`built-in`).flatMap(({source:e})=>t.filter(t=>t.source===e)):t},[m,e]);F.useEffect(()=>{!u&&!f&&y.length>0&&(i?p(!0):d(y[0]||null))},[y,u,f,i]);let b=e=>{if(e.key===`return`){e.preventDefault(),f&&i?i():u&&r(u);return}if(e.key!==`up`&&e.key!==`down`)return;e.preventDefault();let t=!!i,n=y.length+ +!!t;if(n===0)return;let a=0;if(!f&&u){let e=y.findIndex(e=>e.agentType===u.agentType&&e.source===u.source);e>=0&&(a=t?e+1:e)}let o=e.key===`up`?a===0?n-1:a-1:a===n-1?0:a+1;if(t&&o===0)p(!0),d(null);else{let e=t?o-1:o,n=y[e];n&&(p(!1),d(n))}},ee=(e=`Built-in (always available):`)=>{let t=m.filter(e=>e.source===`built-in`);return(0,I.jsxs)(c,{flexDirection:`column`,marginBottom:1,paddingLeft:2,children:[(0,I.jsx)(l,{bold:!0,dimColor:!0,children:e}),t.map(v)]})},x=(e,t)=>{if(!t.length)return null;let n=t[0]?.baseDir;return(0,I.jsxs)(c,{flexDirection:`column`,marginBottom:1,children:[(0,I.jsxs)(c,{paddingLeft:2,children:[(0,I.jsx)(l,{bold:!0,dimColor:!0,children:e}),n&&(0,I.jsxs)(l,{dimColor:!0,children:[` (`,n,`)`]})]}),t.map(e=>v(e))]})},te=Sr(e),S=m.filter(e=>e.source===`built-in`);return!m.length||e!==`built-in`&&!m.some(e=>e.source!==`built-in`)?(0,I.jsx)(g,{title:te,subtitle:`No agents found`,onCancel:n,hideInputGuide:!0,children:(0,I.jsxs)(c,{flexDirection:`column`,gap:1,tabIndex:0,autoFocus:!0,onKeyDown:b,children:[i&&(0,I.jsx)(c,{children:_()}),(0,I.jsx)(l,{dimColor:!0,children:`No agents found. Create specialized subagents that Work Mate can delegate to.`}),(0,I.jsx)(l,{dimColor:!0,children:`Each subagent has its own context window, custom system prompt, and specific tools.`}),(0,I.jsx)(l,{dimColor:!0,children:`Try creating: Code Reviewer, Code Simplifier, Security Reviewer, Tech Lead, or UX Reviewer.`}),e!==`built-in`&&m.some(e=>e.source===`built-in`)&&(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(o,{}),ee()]})]})}):(0,I.jsxs)(g,{title:te,subtitle:`${kt(m,e=>!e.overriddenBy)} agents`,onCancel:n,hideInputGuide:!0,children:[s&&s.length>0&&(0,I.jsx)(c,{marginTop:1,children:(0,I.jsx)(l,{dimColor:!0,children:s[s.length-1]})}),(0,I.jsxs)(c,{flexDirection:`column`,tabIndex:0,autoFocus:!0,onKeyDown:b,children:[i&&(0,I.jsx)(c,{marginBottom:1,children:_()}),e===`all`?(0,I.jsxs)(I.Fragment,{children:[Yt.filter(e=>e.source!==`built-in`).map(({label:e,source:t})=>(0,I.jsx)(F.Fragment,{children:x(e,m.filter(e=>e.source===t))},t)),S.length>0&&(0,I.jsxs)(c,{flexDirection:`column`,marginBottom:1,paddingLeft:2,children:[(0,I.jsxs)(l,{dimColor:!0,children:[(0,I.jsx)(l,{bold:!0,children:`Built-in agents`}),` (always available)`]}),S.map(v)]})]}):e===`built-in`?(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(l,{dimColor:!0,italic:!0,children:`Built-in agents are provided by default and cannot be modified.`}),(0,I.jsx)(c,{marginTop:1,flexDirection:`column`,children:m.map(e=>v(e))})]}):(0,I.jsxs)(I.Fragment,{children:[m.filter(e=>e.source!==`built-in`).map(e=>v(e)),m.some(e=>e.source===`built-in`)&&(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(o,{}),ee()]})]})]})]})}var F,I,Ar=e((()=>{i(),F=t(f(),1),h(),Gt(),bt(),Cr(),I=_()}));function jr({steps:e,initialData:t={},onComplete:n,onCancel:r,children:i,title:a,showStepCounter:o=!0}){let[s,c]=(0,L.useState)(0),[l,u]=(0,L.useState)(t),[d,f]=(0,L.useState)(!1),[p,m]=(0,L.useState)([]);Qt(),(0,L.useEffect)(()=>{d&&(m([]),n(l))},[d,l,n]);let h=(0,L.useCallback)(()=>{s<e.length-1?(p.length>0&&m(e=>[...e,s]),c(e=>e+1)):f(!0)},[s,e.length,p]),g=(0,L.useCallback)(()=>{if(p.length>0){let e=p[p.length-1];e!==void 0&&(m(e=>e.slice(0,-1)),c(e))}else s>0?c(e=>e-1):r&&r()},[s,p,r]),_=(0,L.useCallback)(t=>{t>=0&&t<e.length&&(m(e=>[...e,s]),c(t))},[s,e.length]),v=(0,L.useCallback)(()=>{m([]),r&&r()},[r]),y=(0,L.useCallback)(e=>{u(t=>({...t,...e}))},[]),b=(0,L.useMemo)(()=>({currentStepIndex:s,totalSteps:e.length,wizardData:l,setWizardData:u,updateWizardData:y,goNext:h,goBack:g,goToStep:_,cancel:v,title:a,showStepCounter:o}),[s,e.length,l,y,h,g,_,v,a,o]),ee=e[s];return!ee||d?null:(0,Mr.jsx)(Nr.Provider,{value:b,children:i||(0,Mr.jsx)(ee,{})})}var L,Mr,Nr,Pr=e((()=>{L=t(f(),1),$t(),Mr=_(),Nr=(0,L.createContext)(null)}));function R(){let e=(0,Fr.useContext)(Nr);if(!e)throw Error(`useWizard must be used within a WizardProvider`);return e}var Fr,Ir=e((()=>{Fr=t(f(),1),Pr()}));function Lr({instructions:e=(0,Rr.jsxs)(u,{children:[(0,Rr.jsx)(s,{shortcut:`↑↓`,action:`navigate`}),(0,Rr.jsx)(s,{shortcut:`Enter`,action:`select`}),(0,Rr.jsx)(w,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`})]})}){let t=Qt();return(0,Rr.jsx)(c,{marginLeft:3,marginTop:1,children:(0,Rr.jsx)(l,{dimColor:!0,children:t.pending?`Press ${t.keyName} again to exit`:e})})}var Rr,zr=e((()=>{$t(),h(),C(),Rr=_()}));function z({title:e,color:t=`suggestion`,children:n,subtitle:r,footerText:i}){let{currentStepIndex:a,totalSteps:o,title:s,showStepCounter:c,goBack:l}=R();return(0,Br.jsxs)(Br.Fragment,{children:[(0,Br.jsx)(g,{title:`${e||s||`Wizard`}${c===!1?``:` (${a+1}/${o})`}`,subtitle:r,onCancel:l,color:t,hideInputGuide:!0,isCancelActive:!1,children:n}),(0,Br.jsx)(Lr,{instructions:i})]})}var Br,B=e((()=>{h(),Ir(),zr(),Br=_()})),V=e((()=>{Ir(),B(),zr(),Pr()}));function Vr(){let{goNext:e,goBack:t,updateWizardData:n,wizardData:r}=R();return d(`confirm:no`,t,{context:`Confirmation`}),(0,H.jsx)(z,{subtitle:`Choose background color`,footerText:(0,H.jsxs)(u,{children:[(0,H.jsx)(s,{shortcut:`↑↓`,action:`navigate`}),(0,H.jsx)(s,{shortcut:`Enter`,action:`select`}),(0,H.jsx)(w,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`})]}),children:(0,H.jsx)(c,{children:(0,H.jsx)(dr,{agentName:r.agentType||`agent`,currentColor:`automatic`,onConfirm:t=>{n({selectedColor:t,finalAgent:{agentType:r.agentType,whenToUse:r.whenToUse,getSystemPrompt:()=>r.systemPrompt,tools:r.selectedTools,...r.selectedModel?{model:r.selectedModel}:{},...t?{color:t}:{},source:r.location}}),e()}})})})}var H,Hr=e((()=>{h(),T(),C(),V(),B(),pr(),H=_()}));function Ur(e){return e?/^[a-zA-Z0-9][a-zA-Z0-9-]*[a-zA-Z0-9]$/.test(e)?e.length<3?`Agent type must be at least 3 characters long`:e.length>50?`Agent type must be less than 50 characters`:null:`Agent type must start and end with alphanumeric characters and contain only letters, numbers, and hyphens`:`Agent type is required`}function Wr(e,t,n){let r=[],i=[];if(!e.agentType)r.push(`Agent type is required`);else{let t=Ur(e.agentType);t&&r.push(t);let i=n.find(t=>t.agentType===e.agentType&&t.source!==e.source);i&&r.push(`Agent type "${e.agentType}" already exists in ${Sr(i.source)}`)}if(e.whenToUse?e.whenToUse.length<10?i.push(`Description should be more descriptive (at least 10 characters)`):e.whenToUse.length>5e3&&i.push(`Description is very long (over 5000 characters)`):r.push(`Description (description) is required`),e.tools!==void 0&&!Array.isArray(e.tools))r.push(`Tools must be an array`);else{e.tools===void 0?i.push(`Agent has access to all tools`):e.tools.length===0&&i.push(`No tools selected - agent will have very limited capabilities`);let n=tt(e,t,!1);n.invalidTools.length>0&&r.push(`Invalid tools: ${n.invalidTools.join(`, `)}`)}let a=e.getSystemPrompt();return a?a.length<20?r.push(`System prompt is too short (minimum 20 characters)`):a.length>1e4&&i.push(`System prompt is very long (over 10,000 characters)`):r.push(`System prompt is required`),{isValid:r.length===0,errors:r,warnings:i}}var Gr=e((()=>{Ne(),Cr()}));function Kr({tools:e,existingAgents:t,onSave:n,onSaveAndEdit:r,error:i}){let{goBack:a,wizardData:o}=R();d(`confirm:no`,a,{context:`Confirmation`});let f=e=>{e.key===`s`||e.key===`return`?(e.preventDefault(),n()):e.key===`e`&&(e.preventDefault(),r())},p=o.finalAgent,m=Wr(p,e,t),h=Ft(p.getSystemPrompt(),240),g=Ft(p.whenToUse,240),_=e=>e===void 0?`All tools`:e.length===0?`None`:e.length===1?e[0]||`None`:e.length===2?e.join(` and `):`${e.slice(0,-1).join(`, `)}, and ${e[e.length-1]}`,v=jt()?(0,U.jsxs)(l,{children:[(0,U.jsx)(l,{bold:!0,children:`Memory`}),`: `,ze(p.memory)]}):null;return(0,U.jsx)(z,{subtitle:`Confirm and save`,footerText:(0,U.jsxs)(u,{children:[(0,U.jsx)(s,{shortcut:`s/Enter`,action:`save`}),(0,U.jsx)(s,{shortcut:`e`,action:`edit in your editor`}),(0,U.jsx)(w,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})]}),children:(0,U.jsxs)(c,{flexDirection:`column`,tabIndex:0,autoFocus:!0,onKeyDown:f,children:[(0,U.jsxs)(l,{children:[(0,U.jsx)(l,{bold:!0,children:`Name`}),`: `,p.agentType]}),(0,U.jsxs)(l,{children:[(0,U.jsx)(l,{bold:!0,children:`Location`}),`:`,` `,tr({source:o.location,agentType:p.agentType})]}),(0,U.jsxs)(l,{children:[(0,U.jsx)(l,{bold:!0,children:`Tools`}),`: `,_(p.tools)]}),(0,U.jsxs)(l,{children:[(0,U.jsx)(l,{bold:!0,children:`Model`}),`: `,ce(p.model)]}),v,(0,U.jsx)(c,{marginTop:1,children:(0,U.jsxs)(l,{children:[(0,U.jsx)(l,{bold:!0,children:`Description`}),` (tells Work Mate when to use this agent):`]})}),(0,U.jsx)(c,{marginLeft:2,marginTop:1,children:(0,U.jsx)(l,{children:g})}),(0,U.jsx)(c,{marginTop:1,children:(0,U.jsxs)(l,{children:[(0,U.jsx)(l,{bold:!0,children:`System prompt`}),`:`]})}),(0,U.jsx)(c,{marginLeft:2,marginTop:1,children:(0,U.jsx)(l,{children:h})}),m.warnings.length>0&&(0,U.jsxs)(c,{marginTop:1,flexDirection:`column`,children:[(0,U.jsx)(l,{color:`warning`,children:`Warnings:`}),m.warnings.map((e,t)=>(0,U.jsxs)(l,{dimColor:!0,children:[` `,`• `,e]},t))]}),m.errors.length>0&&(0,U.jsxs)(c,{marginTop:1,flexDirection:`column`,children:[(0,U.jsx)(l,{color:`error`,children:`Errors:`}),m.errors.map((e,t)=>(0,U.jsxs)(l,{color:`error`,children:[` `,`• `,e]},t))]}),i&&(0,U.jsx)(c,{marginTop:1,children:(0,U.jsx)(l,{color:`error`,children:i})}),(0,U.jsx)(c,{marginTop:2,children:(0,U.jsxs)(l,{color:`success`,children:[`Press `,(0,U.jsx)(l,{bold:!0,children:`s`}),` or `,(0,U.jsx)(l,{bold:!0,children:`Enter`}),` to save, `,(0,U.jsx)(l,{bold:!0,children:`e`}),` to save and edit`]})})]})})}var U,qr=e((()=>{h(),T(),At(),Ye(),It(),x(),C(),V(),B(),cr(),Gr(),U=_()}));function Jr({tools:e,existingAgents:t,onComplete:n}){let{wizardData:r}=R(),[i,a]=(0,Yr.useState)(null),o=he(),s=(0,Yr.useCallback)(async e=>{if(r?.finalAgent)try{await ir(r.location,r.finalAgent.agentType,r.finalAgent.whenToUse,r.finalAgent.tools,r.finalAgent.getSystemPrompt(),!0,r.finalAgent.color,r.finalAgent.model,r.finalAgent.memory),o(e=>{if(!r.finalAgent)return e;let t=e.agentDefinitions.allAgents.concat(r.finalAgent);return{...e,agentDefinitions:{...e.agentDefinitions,activeAgents:Xe(t),allAgents:t}}}),Qe(),e&&await ln($n({source:r.location,agentType:r.finalAgent.agentType})),r.finalAgent.agentType,r.wasGenerated,r.location,r.finalAgent.tools?.length,r.finalAgent.model,r.finalAgent.color,r.finalAgent.memory,r.finalAgent.memory,{...e?{opened_in_editor:!0}:{}},n(e?`Created agent: ${p.bold(r.finalAgent.agentType)} and opened in editor. If you made edits, restart to load the latest version.`:`Created agent: ${p.bold(r.finalAgent.agentType)}`)}catch(e){a(e instanceof Error?e.message:`Failed to save agent`)}},[r,n,o]);return(0,Xr.jsx)(Kr,{tools:e,existingAgents:t,onSave:(0,Yr.useCallback)(()=>s(!1),[s]),onSaveAndEdit:(0,Yr.useCallback)(()=>s(!0),[s]),error:i})}var Yr,Xr,Zr=e((()=>{m(),Yr=t(f(),1),Pt(),ot(),Je(),cn(),V(),cr(),qr(),Xr=_()}));function Qr(){let{goNext:e,goBack:t,updateWizardData:n,wizardData:r}=R(),[i,a]=(0,$r.useState)(r.whenToUse||``),[o,f]=(0,$r.useState)(i.length),[p,m]=(0,$r.useState)(null);return d(`confirm:no`,t,{context:`Settings`}),d(`chat:externalEditor`,(0,$r.useCallback)(async()=>{let e=await sn(i);e.content!==null&&(a(e.content),f(e.content.length))},[i]),{context:`Chat`}),(0,W.jsx)(z,{subtitle:`Description (tell Work Mate when to use this agent)`,footerText:(0,W.jsxs)(u,{children:[(0,W.jsx)(s,{shortcut:`Type`,action:`enter text`}),(0,W.jsx)(s,{shortcut:`Enter`,action:`continue`}),(0,W.jsx)(w,{action:`chat:externalEditor`,context:`Chat`,fallback:`ctrl+g`,description:`open in editor`}),(0,W.jsx)(w,{action:`confirm:no`,context:`Settings`,fallback:`Esc`,description:`go back`})]}),children:(0,W.jsxs)(c,{flexDirection:`column`,children:[(0,W.jsx)(l,{children:`When should Work Mate use this agent?`}),(0,W.jsx)(c,{marginTop:1,children:(0,W.jsx)(Zt,{value:i,onChange:a,onSubmit:t=>{let r=t.trim();if(!r){m(`Description is required`);return}m(null),n({whenToUse:r}),e()},placeholder:`e.g., use this agent after you're done writing code...`,columns:80,cursorOffset:o,onChangeCursorOffset:f,focus:!0,showCursor:!0})}),p&&(0,W.jsx)(c,{marginTop:1,children:(0,W.jsx)(l,{color:`error`,children:p})})]})})}var $r,W,ei=e((()=>{$r=t(f(),1),h(),T(),cn(),C(),Xt(),V(),B(),W=_()}));async function ti(e,t,n,r){let i=ee({content:`Create an agent configuration based on this request: "${e}".${n.length>0?`\n\nIMPORTANT: The following identifiers already exist and must NOT be used: ${n.join(`, `)}`:``}
8
+ Return ONLY the JSON object, no other text.`}),a=await pe(),o=qe([i],a),s=jt()?ni+ri:ni,c=await we({messages:et(o),systemPrompt:me([s]),thinkingConfig:{type:`disabled`},tools:[],signal:r,options:{getToolPermissionContext:async()=>Bt(),model:t,toolChoice:void 0,agents:[],isNonInteractiveSession:!1,hasAppendSystemPrompt:!1,querySource:`agent_creation`,mcpTools:[]}}),l=(Array.isArray(c.message.content)?c.message.content:[]).filter(e=>e.type===`text`).map(e=>e.text).join(`
9
+ `),u;try{u=gt(l.trim())}catch{let e=l.match(/\{[\s\S]*\}/);if(!e)throw Error(`No JSON object found in response`);u=gt(e[0])}if(!u.identifier||!u.whenToUse||!u.systemPrompt)throw Error(`Invalid agent configuration generated`);return u.identifier,{identifier:u.identifier,whenToUse:u.whenToUse,systemPrompt:u.systemPrompt}}var ni,ri,ii=e((()=>{ge(),je(),Vt(),St(),Re(),_e(),At(),Pt(),yt(),$e(),ni=`You are an elite AI agent architect specializing in crafting high-performance agent configurations. Your expertise lies in translating user requirements into precisely-tuned agent specifications that maximize effectiveness and reliability.
10
+
11
+ **Important Context**: You may have access to project-specific instructions from AGENTS.md files and other context that may include coding standards, project structure, and custom requirements. Consider this context when creating agents to ensure they align with the project's established patterns and practices.
12
+
13
+ When a user describes what they want an agent to do, you will:
14
+
15
+ 1. **Extract Core Intent**: Identify the fundamental purpose, key responsibilities, and success criteria for the agent. Look for both explicit requirements and implicit needs. Consider any project-specific context from AGENTS.md files. For agents that are meant to review code, you should assume that the user is asking to review recently written code and not the whole codebase, unless the user has explicitly instructed you otherwise.
16
+
17
+ 2. **Design Expert Persona**: Create a compelling expert identity that embodies deep domain knowledge relevant to the task. The persona should inspire confidence and guide the agent's decision-making approach.
18
+
19
+ 3. **Architect Comprehensive Instructions**: Develop a system prompt that:
20
+ - Establishes clear behavioral boundaries and operational parameters
21
+ - Provides specific methodologies and best practices for task execution
22
+ - Anticipates edge cases and provides guidance for handling them
23
+ - Incorporates any specific requirements or preferences mentioned by the user
24
+ - Defines output format expectations when relevant
25
+ - Aligns with project-specific coding standards and patterns from AGENTS.md
26
+
27
+ 4. **Optimize for Performance**: Include:
28
+ - Decision-making frameworks appropriate to the domain
29
+ - Quality control mechanisms and self-verification steps
30
+ - Efficient workflow patterns
31
+ - Clear escalation or fallback strategies
32
+
33
+ 5. **Create Identifier**: Design a concise, descriptive identifier that:
34
+ - Uses lowercase letters, numbers, and hyphens only
35
+ - Is typically 2-4 words joined by hyphens
36
+ - Clearly indicates the agent's primary function
37
+ - Is memorable and easy to type
38
+ - Avoids generic terms like "helper" or "assistant"
39
+
40
+ 6 **Example agent descriptions**:
41
+ - in the 'whenToUse' field of the JSON object, you should include examples of when this agent should be used.
42
+ - examples should be of the form:
43
+ - <example>
44
+ Context: The user is creating a test-runner agent that should be called after a logical chunk of code is written.
45
+ user: "Please write a function that checks if a number is prime"
46
+ assistant: "Here is the relevant function: "
47
+ <function call omitted for brevity only for this example>
48
+ <commentary>
49
+ Since a significant piece of code was written, use the ${xt} tool to launch the test-runner agent to run the tests.
50
+ </commentary>
51
+ assistant: "Now let me use the test-runner agent to run the tests"
52
+ </example>
53
+ - <example>
54
+ Context: User is creating an agent to respond to the word "hello" with a friendly jok.
55
+ user: "Hello"
56
+ assistant: "I'm going to use the ${xt} tool to launch the greeting-responder agent to respond with a friendly joke"
57
+ <commentary>
58
+ Since the user is greeting, use the greeting-responder agent to respond with a friendly joke.
59
+ </commentary>
60
+ </example>
61
+ - If the user mentioned or implied that the agent should be used proactively, you should include examples of this.
62
+ - NOTE: Ensure that in the examples, you are making the assistant use the Agent tool and not simply respond directly to the task.
63
+
64
+ Your output must be a valid JSON object with exactly these fields:
65
+ {
66
+ "identifier": "A unique, descriptive identifier using lowercase letters, numbers, and hyphens (e.g., 'test-runner', 'api-docs-writer', 'code-formatter')",
67
+ "whenToUse": "A precise, actionable description starting with 'Use this agent when...' that clearly defines the triggering conditions and use cases. Ensure you include examples as described above.",
68
+ "systemPrompt": "The complete system prompt that will govern the agent's behavior, written in second person ('You are...', 'You will...') and structured for maximum clarity and effectiveness"
69
+ }
70
+
71
+ Key principles for your system prompts:
72
+ - Be specific rather than generic - avoid vague instructions
73
+ - Include concrete examples when they would clarify behavior
74
+ - Balance comprehensiveness with clarity - every instruction should add value
75
+ - Ensure the agent has enough context to handle variations of the core task
76
+ - Make the agent proactive in seeking clarification when needed
77
+ - Build in quality assurance and self-correction mechanisms
78
+
79
+ Remember: The agents you create should be autonomous experts capable of handling their designated tasks with minimal additional guidance. Your system prompts are their complete operational manual.
80
+ `,ri=`
81
+
82
+ 7. **Agent Memory Instructions**: If the user mentions "memory", "remember", "learn", "persist", or similar concepts, OR if the agent would benefit from building up knowledge across conversations (e.g., code reviewers learning patterns, architects learning codebase structure, etc.), include domain-specific memory update instructions in the systemPrompt.
83
+
84
+ Add a section like this to the systemPrompt, tailored to the agent's specific domain:
85
+
86
+ "**Update your agent memory** as you discover [domain-specific items]. This builds up institutional knowledge across conversations. Write concise notes about what you found and where.
87
+
88
+ Examples of what to record:
89
+ - [domain-specific item 1]
90
+ - [domain-specific item 2]
91
+ - [domain-specific item 3]"
92
+
93
+ Examples of domain-specific memory instructions:
94
+ - For a code-reviewer: "Update your agent memory as you discover code patterns, style conventions, common issues, and architectural decisions in this codebase."
95
+ - For a test-runner: "Update your agent memory as you discover test patterns, common failure modes, flaky tests, and testing best practices."
96
+ - For an architect: "Update your agent memory as you discover codepaths, library locations, key architectural decisions, and component relationships."
97
+ - For a documentation writer: "Update your agent memory as you discover documentation patterns, API structures, and terminology conventions."
98
+
99
+ The memory instructions should be specific to what the agent would naturally learn while performing its core tasks.
100
+ `}));function ai(){let{updateWizardData:e,goBack:t,goToStep:n,wizardData:r}=R(),[i,a]=(0,G.useState)(r.generationPrompt||``),[o,s]=(0,G.useState)(!1),[f,p]=(0,G.useState)(null),[m,h]=(0,G.useState)(i.length),g=un(),_=(0,G.useRef)(null);d(`confirm:no`,(0,G.useCallback)(()=>{_.current&&(_.current.abort(),_.current=null,s(!1),p(`Generation cancelled`))},[]),{context:`Settings`,isActive:o}),d(`chat:externalEditor`,(0,G.useCallback)(async()=>{let e=await sn(i);e.content!==null&&(a(e.content),h(e.content.length))},[i]),{context:`Chat`,isActive:!o}),d(`confirm:no`,(0,G.useCallback)(()=>{e({generationPrompt:``,agentType:``,systemPrompt:``,whenToUse:``,generatedAgent:void 0,wasGenerated:!1}),a(``),p(null),t()},[e,t]),{context:`Settings`,isActive:!o});let v=async()=>{let t=i.trim();if(!t){p(`Please describe what the agent should do`);return}p(null),s(!0),e({generationPrompt:t,isGenerating:!0});let r=lt();_.current=r;try{let i=await ti(t,g,[],r.signal);e({agentType:i.identifier,whenToUse:i.whenToUse,systemPrompt:i.systemPrompt,generatedAgent:i,isGenerating:!1,wasGenerated:!0}),n(6)}catch(t){t instanceof vt||t instanceof Error&&!t.message.includes(`No assistant message found`)&&p(t.message||`Failed to generate agent`),e({isGenerating:!1})}finally{s(!1),_.current=null}},y=`Describe what this agent should do and when it should be used (be comprehensive for best results)`;return o?(0,K.jsx)(z,{subtitle:y,footerText:(0,K.jsx)(w,{action:`confirm:no`,context:`Settings`,fallback:`Esc`,description:`cancel`}),children:(0,K.jsxs)(c,{flexDirection:`row`,alignItems:`center`,children:[(0,K.jsx)(rn,{}),(0,K.jsx)(l,{color:`suggestion`,children:` Generating agent from description...`})]})}):(0,K.jsx)(z,{subtitle:y,footerText:(0,K.jsxs)(u,{children:[(0,K.jsx)(w,{action:`confirm:yes`,context:`Confirmation`,fallback:`Enter`,description:`submit`}),(0,K.jsx)(w,{action:`chat:externalEditor`,context:`Chat`,fallback:`ctrl+g`,description:`open in editor`}),(0,K.jsx)(w,{action:`confirm:no`,context:`Settings`,fallback:`Esc`,description:`go back`})]}),children:(0,K.jsxs)(c,{flexDirection:`column`,children:[f&&(0,K.jsx)(c,{marginBottom:1,children:(0,K.jsx)(l,{color:`error`,children:f})}),(0,K.jsx)(Zt,{value:i,onChange:a,onSubmit:v,placeholder:`e.g., Help me write unit tests for my code...`,columns:80,cursorOffset:m,onChangeCursorOffset:h,focus:!0,showCursor:!0})]})})}var G,K,oi=e((()=>{pt(),G=t(f(),1),dn(),h(),T(),ne(),cn(),C(),nn(),Xt(),V(),B(),ii(),K=_()}));function si(){let{goNext:e,updateWizardData:t,cancel:n}=R();return(0,q.jsx)(z,{subtitle:`Choose location`,footerText:(0,q.jsxs)(u,{children:[(0,q.jsx)(s,{shortcut:`↑↓`,action:`navigate`}),(0,q.jsx)(s,{shortcut:`Enter`,action:`select`}),(0,q.jsx)(w,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})]}),children:(0,q.jsx)(c,{children:(0,q.jsx)(tn,{options:[{label:`Project (.workmate/agents/)`,value:`projectSettings`},{label:`Personal (~/.workmate/agents/)`,value:`userSettings`}],onChange:n=>{t({location:n}),e()},onCancel:()=>n()},`location-select`)})})}var q,ci=e((()=>{h(),C(),en(),V(),B(),q=_()}));function li(){let{goNext:e,goBack:t,updateWizardData:n,wizardData:r}=R();d(`confirm:no`,t,{context:`Confirmation`});let i=r.location===`userSettings`?[{label:`User scope (~/.workmate/agent-memory/) (Recommended)`,value:`user`},{label:`None (no persistent memory)`,value:`none`},{label:`Project scope (.workmate/agent-memory/)`,value:`project`},{label:`Local scope (.workmate/agent-memory-local/)`,value:`local`}]:[{label:`Project scope (.workmate/agent-memory/) (Recommended)`,value:`project`},{label:`None (no persistent memory)`,value:`none`},{label:`User scope (~/.workmate/agent-memory/)`,value:`user`},{label:`Local scope (.workmate/agent-memory-local/)`,value:`local`}];return(0,J.jsx)(z,{subtitle:`Configure agent memory`,footerText:(0,J.jsxs)(u,{children:[(0,J.jsx)(s,{shortcut:`↑↓`,action:`navigate`}),(0,J.jsx)(s,{shortcut:`Enter`,action:`select`}),(0,J.jsx)(w,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`})]}),children:(0,J.jsx)(c,{children:(0,J.jsx)(tn,{options:i,onChange:t=>{let i=t===`none`?void 0:t,a=r.finalAgent?.agentType;n({selectedMemory:i,finalAgent:r.finalAgent?{...r.finalAgent,memory:i,getSystemPrompt:jt()&&i&&a?()=>`${r.systemPrompt}\n\n${Ke(a,i)}`:()=>r.systemPrompt}:void 0}),e()},onCancel:t},`memory-select`)})})}var J,ui=e((()=>{h(),T(),At(),Ye(),C(),en(),V(),B(),J=_()}));function di(){let{goNext:e,goBack:t,updateWizardData:n,goToStep:r}=R();return(0,Y.jsx)(z,{subtitle:`Creation method`,footerText:(0,Y.jsxs)(u,{children:[(0,Y.jsx)(s,{shortcut:`↑↓`,action:`navigate`}),(0,Y.jsx)(s,{shortcut:`Enter`,action:`select`}),(0,Y.jsx)(w,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`})]}),children:(0,Y.jsx)(c,{children:(0,Y.jsx)(tn,{options:[{label:`Generate with Work Mate (recommended)`,value:`generate`},{label:`Manual configuration`,value:`manual`}],onChange:t=>{let i=t;n({method:i,wasGenerated:i===`generate`}),i===`generate`?e():r(3)},onCancel:()=>t()},`method-select`)})})}var Y,fi=e((()=>{h(),C(),en(),V(),B(),Y=_()}));function pi(){let{goNext:e,goBack:t,updateWizardData:n,wizardData:r}=R();return(0,mi.jsx)(z,{subtitle:`Select model`,footerText:(0,mi.jsxs)(u,{children:[(0,mi.jsx)(s,{shortcut:`↑↓`,action:`navigate`}),(0,mi.jsx)(s,{shortcut:`Enter`,action:`select`}),(0,mi.jsx)(w,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`})]}),children:(0,mi.jsx)(mr,{initialModel:r.selectedModel,onComplete:t=>{n({selectedModel:t}),e()},onCancel:t})})}var mi,hi=e((()=>{C(),h(),V(),B(),_r(),mi=_()}));function gi(){let{goNext:e,goBack:t,updateWizardData:n,wizardData:r}=R(),[i,a]=(0,_i.useState)(r.systemPrompt||``),[o,f]=(0,_i.useState)(i.length),[p,m]=(0,_i.useState)(null);return d(`confirm:no`,t,{context:`Settings`}),d(`chat:externalEditor`,(0,_i.useCallback)(async()=>{let e=await sn(i);e.content!==null&&(a(e.content),f(e.content.length))},[i]),{context:`Chat`}),(0,X.jsx)(z,{subtitle:`System prompt`,footerText:(0,X.jsxs)(u,{children:[(0,X.jsx)(s,{shortcut:`Type`,action:`enter text`}),(0,X.jsx)(s,{shortcut:`Enter`,action:`continue`}),(0,X.jsx)(w,{action:`chat:externalEditor`,context:`Chat`,fallback:`ctrl+g`,description:`open in editor`}),(0,X.jsx)(w,{action:`confirm:no`,context:`Settings`,fallback:`Esc`,description:`go back`})]}),children:(0,X.jsxs)(c,{flexDirection:`column`,children:[(0,X.jsx)(l,{children:`Enter the system prompt for your agent:`}),(0,X.jsx)(l,{dimColor:!0,children:`Be comprehensive for best results`}),(0,X.jsx)(c,{marginTop:1,children:(0,X.jsx)(Zt,{value:i,onChange:a,onSubmit:()=>{let t=i.trim();if(!t){m(`System prompt is required`);return}m(null),n({systemPrompt:t}),e()},placeholder:`You are a helpful code reviewer who...`,columns:80,cursorOffset:o,onChangeCursorOffset:f,focus:!0,showCursor:!0})}),p&&(0,X.jsx)(c,{marginTop:1,children:(0,X.jsx)(l,{color:`error`,children:p})})]})})}var _i,X,vi=e((()=>{_i=t(f(),1),h(),T(),cn(),C(),Xt(),V(),B(),X=_()}));function yi({tools:e}){let{goNext:t,goBack:n,updateWizardData:r,wizardData:i}=R(),a=e=>{r({selectedTools:e}),t()},o=i.selectedTools;return(0,Z.jsx)(z,{subtitle:`Select tools`,footerText:(0,Z.jsxs)(u,{children:[(0,Z.jsx)(s,{shortcut:`Enter`,action:`toggle selection`}),(0,Z.jsx)(s,{shortcut:`↑↓`,action:`navigate`}),(0,Z.jsx)(w,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`})]}),children:(0,Z.jsx)(br,{tools:e,initialTools:o,onComplete:a,onCancel:n})})}var Z,bi=e((()=>{h(),C(),V(),B(),xr(),Z=_()}));function xi(e){let{goNext:t,goBack:n,updateWizardData:r,wizardData:i}=R(),[a,o]=(0,Si.useState)(i.agentType||``),[f,p]=(0,Si.useState)(null),[m,h]=(0,Si.useState)(a.length);return d(`confirm:no`,n,{context:`Settings`}),(0,Q.jsx)(z,{subtitle:`Agent type (identifier)`,footerText:(0,Q.jsxs)(u,{children:[(0,Q.jsx)(s,{shortcut:`Type`,action:`enter text`}),(0,Q.jsx)(s,{shortcut:`Enter`,action:`continue`}),(0,Q.jsx)(w,{action:`confirm:no`,context:`Settings`,fallback:`Esc`,description:`go back`})]}),children:(0,Q.jsxs)(c,{flexDirection:`column`,children:[(0,Q.jsx)(l,{children:`Enter a unique identifier for your agent:`}),(0,Q.jsx)(c,{marginTop:1,children:(0,Q.jsx)(Zt,{value:a,onChange:o,onSubmit:e=>{let n=e.trim(),i=Ur(n);if(i){p(i);return}p(null),r({agentType:n}),t()},placeholder:`e.g., test-runner, tech-lead, etc`,columns:60,cursorOffset:m,onChangeCursorOffset:h,focus:!0,showCursor:!0})}),f&&(0,Q.jsx)(c,{marginTop:1,children:(0,Q.jsx)(l,{color:`error`,children:f})})]})})}var Si,Q,Ci=e((()=>{Si=t(f(),1),h(),T(),C(),Xt(),V(),B(),Gr(),Q=_()}));function wi({tools:e,existingAgents:t,onComplete:n,onCancel:r}){return(0,Ti.jsx)(jr,{steps:[si,di,ai,()=>(0,Ti.jsx)(xi,{existingAgents:t}),gi,Qr,()=>(0,Ti.jsx)(yi,{tools:e}),pi,Vr,...jt()?[li]:[],()=>(0,Ti.jsx)(Jr,{tools:e,existingAgents:t,onComplete:n})],initialData:{},onComplete:()=>{},onCancel:r,title:`Create new agent`,showStepCounter:!1})}var Ti,Ei=e((()=>{At(),V(),Hr(),Zr(),ei(),oi(),ci(),ui(),fi(),hi(),vi(),bi(),Ci(),Ti=_()}));function Di({tools:e,onExit:t}){let[n,r]=(0,Oi.useState)({mode:`list-agents`,source:`all`}),i=S(e=>e.agentDefinitions),a=S(e=>e.mcp.tools),o=S(e=>e.toolPermissionContext),s=he(),{allAgents:u,activeAgents:d}=i,[f,m]=(0,Oi.useState)([]),h=an(e,a,o);Qt();let _=(0,Oi.useMemo)(()=>({"built-in":u.filter(e=>e.source===`built-in`),userSettings:u.filter(e=>e.source===`userSettings`),projectSettings:u.filter(e=>e.source===`projectSettings`),policySettings:u.filter(e=>e.source===`policySettings`),localSettings:u.filter(e=>e.source===`localSettings`),flagSettings:u.filter(e=>e.source===`flagSettings`),plugin:u.filter(e=>e.source===`plugin`),all:u}),[u]),v=(0,Oi.useCallback)(e=>{m(t=>[...t,e]),r({mode:`list-agents`,source:`all`})},[]),y=(0,Oi.useCallback)(async e=>{try{await or(e),s(t=>{let n=t.agentDefinitions.allAgents.filter(t=>!(t.agentType===e.agentType&&t.source===e.source));return{...t,agentDefinitions:{...t.agentDefinitions,allAgents:n,activeAgents:Xe(n)}}}),m(t=>[...t,`Deleted agent: ${p.bold(e.agentType)}`]),r({mode:`list-agents`,source:`all`})}catch(e){Nt(_t(e))}},[s]);switch(n.mode){case`list-agents`:{let e=qt(n.source===`all`?[..._[`built-in`],..._.userSettings,..._.projectSettings,..._.localSettings,..._.policySettings,..._.flagSettings,..._.plugin]:_[n.source],d);return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(kr,{source:n.source,agents:e,onBack:()=>{t((f.length>0?`Agent changes:\n${f.join(`
101
+ `)}`:void 0)??`Agents dialog dismissed`,{display:f.length===0?`system`:void 0})},onSelect:e=>r({mode:`agent-menu`,agent:e,previousMode:n}),onCreateNew:()=>r({mode:`create-agent`}),changes:f}),(0,$.jsx)(Er,{})]})}case`create-agent`:return(0,$.jsx)(wi,{tools:h,existingAgents:d,onComplete:v,onCancel:()=>r({mode:`list-agents`,source:`all`})});case`agent-menu`:{let e=u.find(e=>e.agentType===n.agent.agentType&&e.source===n.agent.source)||n.agent,t=[{label:`View agent`,value:`view`},...e.source!==`built-in`&&e.source!==`plugin`&&e.source!==`flagSettings`?[{label:`Edit agent`,value:`edit`},{label:`Delete agent`,value:`delete`}]:[],{label:`Back`,value:`back`}];return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(g,{title:n.agent.agentType,onCancel:()=>r(n.previousMode),hideInputGuide:!0,children:(0,$.jsxs)(c,{flexDirection:`column`,children:[(0,$.jsx)(tn,{options:t,onChange:t=>{switch(t){case`view`:r({mode:`view-agent`,agent:e,previousMode:n.previousMode});break;case`edit`:r({mode:`edit-agent`,agent:e,previousMode:n});break;case`delete`:r({mode:`delete-confirm`,agent:e,previousMode:n});break;case`back`:r(n.previousMode);break}},onCancel:()=>r(n.previousMode)}),f.length>0&&(0,$.jsx)(c,{marginTop:1,children:(0,$.jsx)(l,{dimColor:!0,children:f[f.length-1]})})]})}),(0,$.jsx)(Er,{})]})}case`view-agent`:{let e=u.find(e=>e.agentType===n.agent.agentType&&e.source===n.agent.source)||n.agent;return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(g,{title:e.agentType,onCancel:()=>r({mode:`agent-menu`,agent:e,previousMode:n.previousMode}),hideInputGuide:!0,children:(0,$.jsx)(lr,{agent:e,tools:h,allAgents:u,onBack:()=>r({mode:`agent-menu`,agent:e,previousMode:n.previousMode})})}),(0,$.jsx)(Er,{instructions:`Press Enter or Esc to go back`})]})}case`delete-confirm`:return(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(g,{title:`Delete agent`,onCancel:()=>{`previousMode`in n&&r(n.previousMode)},color:`error`,children:[(0,$.jsxs)(l,{children:[`Are you sure you want to delete the agent `,(0,$.jsx)(l,{bold:!0,children:n.agent.agentType}),`?`]}),(0,$.jsx)(c,{marginTop:1,children:(0,$.jsxs)(l,{dimColor:!0,children:[`Source: `,n.agent.source]})}),(0,$.jsx)(c,{marginTop:1,children:(0,$.jsx)(tn,{options:[{label:`Yes, delete`,value:`yes`},{label:`No, cancel`,value:`no`}],onChange:e=>{e===`yes`?y(n.agent):`previousMode`in n&&r(n.previousMode)},onCancel:()=>{`previousMode`in n&&r(n.previousMode)}})})]}),(0,$.jsx)(Er,{instructions:`Press ↑↓ to navigate, Enter to select, Esc to cancel`})]});case`edit-agent`:{let e=u.find(e=>e.agentType===n.agent.agentType&&e.source===n.agent.source)||n.agent;return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(g,{title:`Edit agent: ${e.agentType}`,onCancel:()=>r(n.previousMode),hideInputGuide:!0,children:(0,$.jsx)(wr,{agent:e,tools:h,onSaved:e=>{v(e),r(n.previousMode)},onBack:()=>r(n.previousMode)})}),(0,$.jsx)(Er,{})]})}default:return null}}var Oi,$,ki=e((()=>{m(),Oi=t(f(),1),$t(),on(),h(),ot(),Gt(),Je(),mt(),Mt(),en(),ur(),Tr(),Or(),Ar(),cr(),Ei(),$=_()}));async function Ai(e,t){let n=t.getAppState().toolPermissionContext;return(0,ji.jsx)(Di,{tools:le(n),onExit:e})}var ji;e((()=>{ki(),oe(),ji=_()}))();export{Ai as call};
@@ -0,0 +1 @@
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{cf as t,uf as n}from"./loadAgentsDir-DR5PVAc3.js";import{l as r,m as i}from"./settings-YIDksG5Z.js";function a(){let e=r(),n=[`user`,`project`,`local`].flatMap(e=>t(e).errors);return{settings:e.settings,errors:[...e.errors,...n]}}var o=e((()=>{n(),i()}));export{o as n,a as t};
@@ -0,0 +1 @@
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";function t(e){}function n(e,t){}var r=e((()=>{}));export{r as n,n as r,t};
@@ -0,0 +1 @@
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{d as t,h as n,o as r}from"./config-D3K87Mm1.js";import{o as i,s as a}from"./log-DWZny1vM.js";import{i as o,t as s}from"./execFileNoThrow-BfZFnCGa.js";import{homedir as c}from"os";import{join as l}from"path";import{stat as u}from"fs/promises";function d(e){n(t=>({...t,appleTerminalSetupInProgress:!0,appleTerminalBackupPath:e}))}function f(){n(e=>({...e,appleTerminalSetupInProgress:!1}))}function p(){let e=r();return{inProgress:e.appleTerminalSetupInProgress??!1,backupPath:e.appleTerminalBackupPath||null}}function m(){return l(c(),`Library`,`Preferences`,`com.apple.Terminal.plist`)}async function h(){let e=m(),t=`${e}.bak`;try{let{code:n}=await s(`defaults`,[`export`,`com.apple.Terminal`,e]);if(n!==0)return null;try{await u(e)}catch{return null}return await s(`defaults`,[`export`,`com.apple.Terminal`,t]),d(t),t}catch(e){return a(e),null}}async function g(){let{inProgress:e,backupPath:t}=p();if(!e)return{status:`no_backup`};if(!t)return f(),{status:`no_backup`};try{await u(t)}catch{return f(),{status:`no_backup`}}try{let{code:e}=await s(`defaults`,[`import`,`com.apple.Terminal`,t]);return e===0?(await s(`killall`,[`cfprefsd`]),f(),{status:`restored`}):{status:`failed`,backupPath:t}}catch(e){return a(Error(`Failed to restore Terminal.app settings with: ${e}`)),f(),{status:`failed`,backupPath:t}}}var _=e((()=>{t(),o(),i()}));export{f as a,_ as i,g as n,m as r,h as t};
@@ -0,0 +1 @@
1
+ import{i as e,o as t}from"./envUtils-DZ_SvEVz.js";import{P as n,Pt as r,z as i}from"./state-CXY-q5gr.js";import{Fu as a,Ru as o,St as s,db as c,ft as l,gr as u,ic as d,or as f,pb as p,rc as m}from"./loadAgentsDir-DR5PVAc3.js";import{c as h,f as g,i as _,u as v}from"./debug-kBjDaVkQ.js";import{_ as y,d as b,m as x}from"./settings-YIDksG5Z.js";import{_ as S,o as C,s as w,v as T}from"./log-DWZny1vM.js";import{n as E}from"./analytics-COpjZpvd.js";import{r as D,t as O}from"./pasteStore-BmehVo5j.js";import{r as k}from"./magicDocs-BwBxjfLo.js";import{i as A,t as j}from"./nativeInstaller-ChGSz1lb.js";import{n as M,t as N}from"./allErrors-CxPNR2WN.js";import{n as P,t as F}from"./pluginAutoupdate-Dy5W3HWE.js";import{join as I}from"path";r(),d(),k(),E(),T(),_(),t(),g(),o(),C(),D(),u(),M(),x(),p(),s();var L=30;function R(){let e=((b()||{}).cleanupPeriodDays??L)*24*60*60*1e3;return new Date(Date.now()-e)}function z(e,t){return{messages:e.messages+t.messages,errors:e.errors+t.errors}}function B(e){let t=e.split(`.`)[0].replace(/T(\d{2})-(\d{2})-(\d{2})-(\d{3})Z/,`T$1:$2:$3.$4Z`);return new Date(t)}async function V(e,t,n){let r={messages:0,errors:0};try{let i=await v().readdir(e);for(let a of i)try{B(a.name)<t&&(await v().unlink(I(e,a.name)),n?r.messages++:r.errors++)}catch(e){w(e)}}catch(e){e instanceof Error&&`code`in e&&e.code!==`ENOENT`&&w(e)}return r}async function H(){let e=v(),t=R(),n=S.errors(),r=S.baseLogs(),i=await V(n,t,!1);try{let n;try{n=await e.readdir(r)}catch{return i}let a=n.filter(e=>e.isDirectory()&&e.name.startsWith(`mcp-logs-`)).map(e=>I(r,e.name));for(let n of a)i=z(i,await V(n,t,!0)),await W(n,e)}catch(e){e instanceof Error&&`code`in e&&e.code!==`ENOENT`&&w(e)}return i}async function U(e,t,n){return(await n.stat(e)).mtime<t?(await n.unlink(e),!0):!1}async function W(e,t){try{await t.rmdir(e)}catch{}}async function G(){let e=R(),t={messages:0,errors:0},n=f(),r=v(),i;try{i=await r.readdir(n)}catch{return t}for(let a of i){if(!a.isDirectory())continue;let i=I(n,a.name),o;try{o=await r.readdir(i)}catch{t.errors++;continue}for(let n of o)if(n.isFile()){if(!n.name.endsWith(`.jsonl`)&&!n.name.endsWith(`.cast`))continue;try{await U(I(i,n.name),e,r)&&t.messages++}catch{t.errors++}}else if(n.isDirectory()){let a=I(i,n.name),o=I(a,c),s;try{s=await r.readdir(o)}catch{await W(a,r);continue}for(let n of s)if(n.isFile())try{await U(I(o,n.name),e,r)&&t.messages++}catch{t.errors++}else if(n.isDirectory()){let i=I(o,n.name),a;try{a=await r.readdir(i)}catch{continue}for(let n of a)if(n.isFile())try{await U(I(i,n.name),e,r)&&t.messages++}catch{t.errors++}await W(i,r)}await W(o,r),await W(a,r)}await W(i,r)}return t}async function K(e,t,n=!0){let r=R(),i={messages:0,errors:0},a=v(),o;try{o=await a.readdir(e)}catch{return i}for(let n of o)if(!(!n.isFile()||!n.name.endsWith(t)))try{await U(I(e,n.name),r,a)&&i.messages++}catch{i.errors++}return n&&await W(e,a),i}function q(){return K(I(e(),`plans`),`.md`)}async function J(){let t=R(),n={messages:0,errors:0},r=v();try{let i=I(e(),`file-history`),a;try{a=await r.readdir(i)}catch{return n}let o=a.filter(e=>e.isDirectory()).map(e=>I(i,e.name));await Promise.all(o.map(async e=>{try{(await r.stat(e)).mtime<t&&(await r.rm(e,{recursive:!0,force:!0}),n.messages++)}catch{n.errors++}})),await W(i,r)}catch(e){w(e)}return n}async function Y(){let t=R(),n={messages:0,errors:0},r=v();try{let i=I(e(),`session-env`),a;try{a=await r.readdir(i)}catch{return n}let o=a.filter(e=>e.isDirectory()).map(e=>I(i,e.name));for(let e of o)try{(await r.stat(e)).mtime<t&&(await r.rm(e,{recursive:!0,force:!0}),n.messages++)}catch{n.errors++}await W(i,r)}catch(e){w(e)}return n}async function X(){let t=R(),n={messages:0,errors:0},r=v(),i=I(e(),`debug`),a;try{a=await r.readdir(i)}catch{return n}for(let e of a)if(!(!e.isFile()||!e.name.endsWith(`.txt`)||e.name===`latest`))try{await U(I(i,e.name),t,r)&&n.messages++}catch{n.errors++}return n}async function Z(){let{errors:e}=N();if(e.length>0&&y(`cleanupPeriodDays`)){h(`Skipping cleanup: settings have validation errors but cleanupPeriodDays was explicitly set. Fix settings errors to enable cleanup.`);return}await H(),await G(),await q(),await J(),await Y(),await X(),await a(),await O(R()),await l(R())}j(),P();var Q=600*1e3;function $(){import(`./extractMemories-jnsv-_n_.js`).then(({initExtractMemories:e})=>{e()}).catch(()=>{}),m(),F();let e=!0;async function t(){if(n()&&i()>Date.now()-1e3*60){setTimeout(t,Q).unref();return}if(e&&(e=!1,await Z()),n()&&i()>Date.now()-1e3*60){setTimeout(t,Q).unref();return}await A()}setTimeout(t,Q).unref()}export{$ as t};
@@ -0,0 +1 @@
1
+ import{t as e}from"./backgroundHousekeeping-PyLNnGdw.js";export{e as startBackgroundHousekeeping};
@@ -0,0 +1,2 @@
1
+ import{Pt as e,q as t}from"./state-CXY-q5gr.js";import{c as n,i as r}from"./debug-kBjDaVkQ.js";import{Br as i,Cn as a,Er as o,Lr as s,On as c,Pr as l,kr as u}from"./settings-YIDksG5Z.js";import{d,h as f,o as p}from"./config-D3K87Mm1.js";import{_ as m,f as h,p as g}from"./startupProfiler-DIM_Ihyp.js";import{n as _,r as v}from"./detectRepository-M6K2wc7h.js";import{homedir as y}from"os";import{join as b,sep as x}from"path";import{realpath as S,stat as C}from"fs/promises";e(),d(),r(),v(),a(),i(),l();async function w(){try{let e=await _();if(!e){n(`Not in a GitHub repository, skipping path mapping update`);return}let r=t(),i=o(r)??r,a;try{a=(await S(i)).normalize(`NFC`)}catch{a=i}let s=e.toLowerCase(),c=p().githubRepoPaths?.[s]??[];if(c[0]===a){n(`Path ${a} already tracked for repo ${s}`);return}let l=c.filter(e=>e!==a),u=[a,...l];f(e=>({...e,githubRepoPaths:{...e.githubRepoPaths,[s]:u}})),n(`Added ${a} to tracked paths for repo ${s}`)}catch(e){n(`Error updating repo path mapping: ${e}`)}}function T(e){let t=p(),n=e.toLowerCase();return t.githubRepoPaths?.[n]??[]}async function E(e){let t=await Promise.all(e.map(c));return e.filter((e,n)=>t[n])}m(),i(),l();var D=10080*60*1e3,O=1e3;function k(e){let t=[`This session was opened by an external deep link in ${M(e.cwd)}`];if(e.repo){let n=e.lastFetch?g(e.lastFetch):`never`,r=!e.lastFetch||Date.now()-e.lastFetch.getTime()>D;t.push(`Resolved ${e.repo} from local clones · last fetched ${n}${r?` — AGENTS.md may be stale`:``}`)}return e.prefillLength&&t.push(e.prefillLength>O?`The prompt below (${h(e.prefillLength)} chars) was supplied by the link — scroll to review the entire prompt before pressing Enter.`:`The prompt below was supplied by the link — review carefully before pressing Enter.`),t.join(`
2
+ `)}async function A(e){let t=await u(e);if(!t)return;let n=await s(t),[r,i]=await Promise.all([j(b(t,`FETCH_HEAD`)),n?j(b(n,`FETCH_HEAD`)):Promise.resolve(void 0)]);return r&&i?r>i?r:i:r??i}async function j(e){try{let{mtime:t}=await C(e);return t}catch{return}}function M(e){let t=y();return e===t?`~`:e.startsWith(t+x)?`~${e.slice(t.length)}`:e}export{w as a,T as i,A as n,E as r,k as t};
@@ -0,0 +1,2 @@
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{l as t,u as n}from"./types-CD25a50S.js";import{Pt as r,at as i,q as a}from"./state-CXY-q5gr.js";import{Sr as o,ar as s,ei as c,fr as l,gr as u,oi as d,pr as f}from"./loadAgentsDir-DR5PVAc3.js";import{C as p,x as m}from"./debug-kBjDaVkQ.js";import{n as h}from"./analytics-COpjZpvd.js";import{i as g,o as _}from"./stringUtils-D_xPrwGQ.js";import{randomUUID as v}from"crypto";import{mkdir as y,readFile as b,writeFile as x}from"fs/promises";function S(e){let t=e?.message?.content;if(!t)return`Branched conversation`;let n=typeof t==`string`?t:t.find(e=>e.type===`text`)?.text;return n&&n.replace(/\s+/g,` `).trim().slice(0,100)||`Branched conversation`}async function C(e){let t=v(),r=i(),c=s(a()),u=f(t),d=l();await y(c,{recursive:!0,mode:448});let m;try{m=await b(d)}catch{throw Error(`No conversation to branch`)}if(m.length===0)throw Error(`No conversation to branch`);let h=n(m),g=h.filter(e=>o(e)&&!e.isSidechain),_=h.filter(e=>e.type===`content-replacement`&&e.sessionId===r).flatMap(e=>e.replacements);if(g.length===0)throw Error(`No messages to branch`);let S=null,C=[],w=[];for(let e of g){let n={...e,sessionId:t,parentUuid:S,isSidechain:!1,forkedFrom:{sessionId:r,messageUuid:e.uuid}},i={...e,sessionId:t};w.push(i),C.push(p(n)),e.type!==`progress`&&(S=e.uuid)}if(_.length>0){let e={type:`content-replacement`,sessionId:t,replacements:_};C.push(p(e))}return await x(u,`${C.join(`
2
+ `)}\n`,{encoding:`utf8`,mode:384}),{sessionId:t,title:e,forkPath:u,serializedMessages:w,contentReplacementRecords:_}}async function w(e){let t=`${e} (Branch)`;if((await d(t,{exact:!0})).length===0)return t;let n=await d(`${e} (Branch`),r=new Set([1]),i=RegExp(`^${g(e)} \\(Branch(?: (\\d+))?\\)$`);for(let e of n){let t=e.customTitle?.match(i);t&&(t[1]?r.add(parseInt(t[1],10)):r.add(1))}let a=2;for(;r.has(a);)a++;return`${e} (Branch ${a})`}async function T(e,t,n){let r=n?.trim()||void 0,a=i();try{let{sessionId:n,title:i,forkPath:o,serializedMessages:s,contentReplacementRecords:l}=await C(r),u=new Date,d=S(s.find(e=>e.type===`user`)),f=await w(i??d);await c(n,f,o),s.length;let p={date:u.toISOString().split(`T`)[0],messages:s,fullPath:o,value:u.getTime(),created:u,modified:u,firstPrompt:d,messageCount:s.length,isSidechain:!1,sessionId:n,customTitle:f,contentReplacements:l},m=i?` "${i}"`:``,h=`Branched conversation${m}. You are now in the branch.${`\nTo resume the original: claude -r ${a}`}`;return t.resume?(await t.resume(n,p,`fork`),e(h,{display:`system`})):e(`Branched conversation${m}. Resume with: /resume ${n}`),null}catch(t){return e(`Failed to branch conversation: ${t instanceof Error?t.message:`Unknown error occurred`}`),null}}e((()=>{r(),h(),t(),u(),m(),_()}))();export{T as call,S as deriveFirstPrompt};
@@ -1,7 +1,7 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{i as t,o as n}from"./envUtils-DfkgIdYf.js";import{I as r,It as i}from"./state-B4jiUise.js";import{join as a}from"node:path";import{appendFileSync as o,existsSync as s,mkdirSync as c,readFileSync as l,unlinkSync as u,writeFileSync as d}from"node:fs";function f(){return a(t(),`.next-request-no-cache`)}function p(){return a(t(),`.break-cache-always`)}function m(){return a(t(),`break-cache-events.jsonl`)}function h(){try{let e=l(m(),`utf8`).trim().split(`
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{i as t,o as n}from"./envUtils-DZ_SvEVz.js";import{F as r,Pt as i}from"./state-CXY-q5gr.js";import{join as a}from"node:path";import{appendFileSync as o,existsSync as s,mkdirSync as c,readFileSync as l,unlinkSync as u,writeFileSync as d}from"node:fs";function f(){return a(t(),`.next-request-no-cache`)}function p(){return a(t(),`.break-cache-always`)}function m(){return a(t(),`break-cache-events.jsonl`)}function h(){try{let e=l(m(),`utf8`).trim().split(`
2
2
  `).filter(Boolean).map(e=>{try{return JSON.parse(e)}catch{return null}}).filter(e=>e!==null),t=e.filter(e=>e.kind===`once`),n=e[e.length-1],r=e.filter(e=>e.kind===`always_on`||e.kind===`always_off`),i=r[r.length-1];return{totalBreaks:t.length,lastBreakAt:n?.at??null,alwaysModeEnabled:i?.kind===`always_on`}}catch{return{totalBreaks:0,lastBreakAt:null,alwaysModeEnabled:!1}}}function g(e){let n=m();c(t(),{recursive:!0});let r={at:new Date().toISOString(),kind:e};o(n,`${JSON.stringify(r)}\n`,`utf8`)}function _(){g(`once`)}async function v(e){let t=e.trim().toLowerCase(),n=f(),r=p();if(t===`status`){let e=h(),t=s(n),i=s(r);return{type:`text`,value:[`## Break-Cache Status`,``,` Once marker: ${t?`ACTIVE (next call will bust cache)`:`not set`}`,` Always mode: ${i?`ON (every call busts cache)`:`off`}`,``,`## Stats`,` total_breaks: ${e.totalBreaks}`,` last_break_at: ${e.lastBreakAt??`never`}`].join(`
3
3
  `)}}if(t===`off`){let e=!1;return s(n)&&(u(n),e=!0),s(r)&&(u(r),e=!0),g(`always_off`),{type:`text`,value:e?`Break-cache disabled. Removed once marker and/or always flag.`:`Break-cache was not active.`}}if(t===`--clear`)return s(n)?(u(n),{type:`text`,value:`Cache-break marker cleared.\n \`${n}\``}):{type:`text`,value:`No cache-break marker was set.`};if(t===`always`)return d(r,new Date().toISOString(),`utf8`),g(`always_on`),{type:`text`,value:[`## Always-on cache break enabled`,``,`Flag written: \`${r}\``,``,`Every API call will now append a random nonce to the system prompt,`,`permanently preventing prompt-cache hits for this session.`,``,"To disable: `/break-cache off`"].join(`
4
4
  `)};if(t===``||t===`once`){let e=new Date().toISOString();d(n,e,`utf8`),_();let t=h();return{type:`text`,value:[`## Cache break scheduled`,``,`Marker written: \`${n}\``,`Timestamp: ${e}`,``,`The next API call will append a random nonce to the system prompt,`,`causing a cache miss. The marker is removed automatically after use.`,``,"To cancel before the next call: `/break-cache --clear`","For every call: `/break-cache always`",``,`Total breaks this session: ${t.totalBreaks}`,``,`_How it works: The prompt cache keys on the system-prompt prefix hash._`,`_A unique nonce invalidates the hash, forcing a fresh compute._`].join(`
5
5
  `)}}return{type:`text`,value:[`Unknown scope: "${t}"`,``,y].join(`
6
6
  `)}}var y,b,x,S=e((()=>{i(),n(),y=[`Usage: /break-cache [scope]`,``,` (no args) Schedule a one-time cache break for the next API call`,` once Same as no args`,` always Enable persistent cache-break mode (every request)`,` off Disable always mode and clear any pending marker`,` --clear Clear the pending once marker (cancel before next call)`,` status Show current break-cache status and stats`,``,`How it works:`,` The prompt cache keys on the system-prompt prefix hash.`,` A unique nonce invalidates the hash, forcing a fresh compute.`,` This is useful when you want to ensure a clean context window.`].join(`
7
- `),b={type:`local-jsx`,name:`break-cache`,description:`管理 prompt cache 的打断。打开操作面板,或运行:once、status、always、off`,isHidden:!1,isEnabled:()=>!r(),argumentHint:`[once|status|always|off|--clear]`,load:()=>import(`./panel-CVS4SK_E.js`)},x={type:`local`,name:`break-cache`,description:`强制下一次(或所有)API 调用不命中 prompt cache。作用域:once、status、always、off`,isHidden:!1,isEnabled:()=>r(),supportsNonInteractive:!0,load:async()=>({call:v})}}));export{f as a,p as i,x as n,S as o,v as r,b as t};
7
+ `),b={type:`local-jsx`,name:`break-cache`,description:`管理 prompt cache 的打断。打开操作面板,或运行:once、status、always、off`,isHidden:!1,isEnabled:()=>!r(),argumentHint:`[once|status|always|off|--clear]`,load:()=>import(`./panel-C0CF3noE.js`)},x={type:`local`,name:`break-cache`,description:`强制下一次(或所有)API 调用不命中 prompt cache。作用域:once、status、always、off`,isHidden:!1,isEnabled:()=>r(),supportsNonInteractive:!0,load:async()=>({call:v})}}));export{f as a,p as i,x as n,S as o,v as r,b as t};
@@ -0,0 +1 @@
1
+ import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{I as n,P as r,ai as i,bn as a,ot as o,t as s,vn as c,xt as l}from"./src-WZ94ZKI3.js";import{t as u}from"./jsx-runtime-Bb4Xn-E0.js";import{Bv as d,F_ as f,GS as p,I_ as m,Ji as h,P_ as g,Rx as _,Us as v,Ws as y,dd as b,ld as x,ot as S,sb as C,st as w,ty as T,zv as E}from"./loadAgentsDir-DR5PVAc3.js";import{I as D,M as O}from"./debug-kBjDaVkQ.js";import{Vt as k}from"./settings-YIDksG5Z.js";import{d as A,h as j}from"./config-D3K87Mm1.js";import{n as M,t as N}from"./SpinnerGlyph-CmVXC-_9.js";import{n as P,r as F}from"./sideQuestion-5jcbOMsR.js";import{i as I,n as L}from"./modalContext-CBE8xuck.js";function R({question:e,context:t,onDone:i}){let[s,c]=(0,H.useState)(null),[u,d]=(0,H.useState)(null),[f,p]=(0,H.useState)(0),m=(0,H.useRef)(null),{rows:h}=I(o());a(()=>p(e=>e+1),s||u?null:80);function g(e){if(e.key===`escape`||e.key===`return`||e.key===` `||e.ctrl&&(e.key===`c`||e.key===`d`)){e.preventDefault(),i(void 0,{display:`skip`});return}(e.key===`up`||e.ctrl&&e.key===`p`)&&(e.preventDefault(),m.current?.scrollBy(-3)),(e.key===`down`||e.ctrl&&e.key===`n`)&&(e.preventDefault(),m.current?.scrollBy(K))}(0,H.useEffect)(()=>{let n=E();async function r(){try{let r=await F({question:e,cacheSafeParams:await B(t)});n.signal.aborted||(r.response?c(r.response):d(`No response received`))}catch(e){n.signal.aborted||d(O(e)||`Failed to get response`)}}return r(),()=>{n.abort()}},[e,t]);let _=Math.max(5,h-W-G);return(0,U.jsxs)(n,{flexDirection:`column`,paddingLeft:2,marginTop:1,tabIndex:0,autoFocus:!0,onKeyDown:g,children:[(0,U.jsxs)(n,{children:[(0,U.jsxs)(r,{color:`warning`,bold:!0,children:[`/btw`,` `]}),(0,U.jsx)(r,{dimColor:!0,children:e})]}),(0,U.jsx)(n,{marginTop:1,marginLeft:2,maxHeight:_,children:(0,U.jsx)(l,{ref:m,flexDirection:`column`,flexGrow:1,children:u?(0,U.jsx)(r,{color:`error`,children:u}):s?(0,U.jsx)(x,{children:s}):(0,U.jsxs)(n,{children:[(0,U.jsx)(N,{frame:f,messageColor:`warning`}),(0,U.jsx)(r,{color:`warning`,children:`Answering...`})]})})}),(s||u)&&(0,U.jsx)(n,{marginTop:1,children:(0,U.jsxs)(r,{dimColor:!0,children:[`↑`,`/`,`↓`,` to scroll · Space, Enter, or Escape to dismiss`]})})]})}function z(e){let t=e.at(-1);return t?.type===`assistant`&&t.message.stop_reason===null?e.slice(0,-1):e}async function B(e){let t=_(z(e.messages)),n=v();if(n)return{systemPrompt:n.systemPrompt,userContext:n.userContext,systemContext:n.systemContext,toolUseContext:e,forkContextMessages:t};let[r,i,a]=await Promise.all([S(e.options.tools,e.options.mainLoopModel,[],e.options.mcpClients),f(),g()]);return{systemPrompt:p(r),userContext:i,systemContext:a,toolUseContext:e,forkContextMessages:t}}async function V(e,t,n){let r=n?.trim();return r?(j(e=>({...e,btwUseCount:e.btwUseCount+1})),(0,U.jsx)(R,{question:r,context:t,onDone:e})):(e(`Usage: /btw <your question>`,{display:`system`}),null)}var H,U,W,G,K;e((()=>{H=t(i(),1),c(),b(),M(),k(),w(),L(),m(),C(),s(),d(),A(),D(),y(),h(),P(),T(),U=u(),W=5,G=6,K=3}))();export{V as call};
@@ -0,0 +1 @@
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{w as t,x as n}from"./debug-kBjDaVkQ.js";import{r,t as i}from"./execa-CBhG1doD.js";import{execSync as a}from"child_process";function o(e,n){return t`execSync: ${e.slice(0,100)}`,a(e,n)}var s=e((()=>{n()}));async function c(e){if(process.platform===`win32`){let t=await i(`where.exe ${e}`,{shell:!0,stderr:`ignore`,reject:!1});return t.exitCode!==0||!t.stdout?null:t.stdout.trim().split(/\r?\n/)[0]||null}let t=await i(`which ${e}`,{shell:!0,stderr:`ignore`,reject:!1});return t.exitCode!==0||!t.stdout?null:t.stdout.trim()}function l(e){if(process.platform===`win32`)try{return o(`where.exe ${e}`,{encoding:`utf-8`,stdio:[`ignore`,`pipe`,`ignore`]}).toString().trim().split(/\r?\n/)[0]||null}catch{return null}try{return o(`which ${e}`,{encoding:`utf-8`,stdio:[`ignore`,`pipe`,`ignore`]}).toString().trim()||null}catch{return null}}var u,d,f,p=e((()=>{r(),s(),u=typeof Bun<`u`&&typeof Bun.which==`function`?Bun.which:null,d=u?async e=>u(e):c,f=u??l}));function m(){return process.versions.bun!==void 0}function h(){return typeof Bun<`u`&&Array.isArray(Bun.embeddedFiles)&&Bun.embeddedFiles.length>0}var g=e((()=>{}));export{d as a,s as c,p as i,h as n,f as o,m as r,o as s,g as t};
@@ -0,0 +1 @@
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{Pt as t,l as n,mn as r}from"./state-CXY-q5gr.js";import{Ay as i,Bi as a,Cb as o,Ci as s,F_ as c,G as l,I_ as u,Iu as d,L_ as f,Mi as p,Mp as m,N_ as h,P_ as g,R_ as _,Ru as v,Sb as y,Wi as b,hp as x,ky as S,lh as C,lm as w,ns as T,pp as E,q as D,sm as O,ts as k,uh as A,z_ as j}from"./loadAgentsDir-DR5PVAc3.js";import{Br as M,Ir as N}from"./settings-YIDksG5Z.js";import{a as P,n as F}from"./fileSuggestions-iWVXvvLB.js";import{r as I,t as L}from"./magicDocs-BwBxjfLo.js";import{r as R,t as z}from"./detectRepository-M6K2wc7h.js";function B(e=new Set){let t=e.size>0;c.cache.clear?.(),g.cache.clear?.(),h.cache.clear?.(),_.cache.clear?.(),F(),s(),t||x(),f(null),r(null),w(),T(),i(`session_start`),d(),z(),l(),n(e),N(),a(),A(),L(),y(),import(`./SearchExtraToolsTool-D1-7C04z.js`).then(({clearSearchExtraToolsDescriptionCache:e})=>e()),import(`./loadAgentsDir-DqAbnpB-.js`).then(({clearAgentDefinitionsCache:e})=>e()),import(`./prompt-DTpfW6yP.js`).then(({clearPromptCache:e})=>e())}var V=e((()=>{t(),p(),j(),u(),P(),m(),E(),O(),C(),I(),b(),k(),D(),S(),R(),M(),v(),o()}));export{V as n,B as t};
@@ -0,0 +1 @@
1
+ import{n as e,t}from"./caches-5xZ4dSXt.js";e();export{t as clearSessionCaches};
@@ -1 +1 @@
1
- import{a as e,f as t,i as n,l as r}from"./types-Dx7P7JLQ.js";import{I as i,N as a}from"./debug-Bglx1aTu.js";import{o,s}from"./log-D2TIwHBV.js";import{i as c,o as l,t as u}from"./platform-BacQ6ACS.js";import{homedir as d}from"os";import{join as f}from"path";import{readFile as p,readdir as m,stat as h}from"fs/promises";e(),i(),r(),o(),l();async function g(){let e=c();if(!u.includes(e))throw Error(`Unsupported platform: ${e} - Work Mate Desktop integration only works on macOS and WSL.`);if(e===`macos`)return f(d(),`Library`,`Application Support`,`Work Mate`,`claude_desktop_config.json`);let t=process.env.USERPROFILE?process.env.USERPROFILE.replace(/\\/g,`/`):null;if(t){let e=`/mnt/c${t.replace(/^[A-Z]:/,``)}/AppData/Roaming/Work Mate/claude_desktop_config.json`;try{return await h(e),e}catch{}}try{let e=`/mnt/c/Users`;try{let t=await m(e,{withFileTypes:!0});for(let n of t){if(n.name===`Public`||n.name===`Default`||n.name===`Default User`||n.name===`All Users`)continue;let t=f(e,n.name,`AppData`,`Roaming`,`Work Mate`,`claude_desktop_config.json`);try{return await h(t),t}catch{}}}catch{}}catch(e){s(e)}throw Error(`Could not find Work Mate Desktop config file in Windows. Make sure Work Mate Desktop is installed on Windows.`)}async function _(){if(!u.includes(c()))throw Error(`Unsupported platform - Work Mate Desktop integration only works on macOS and WSL.`);try{let e=await g(),r;try{r=await p(e,{encoding:`utf8`})}catch(e){if(a(e)===`ENOENT`)return{};throw e}let i=t(r);if(!i||typeof i!=`object`)return{};let o=i.mcpServers;if(!o||typeof o!=`object`)return{};let s={};for(let[e,t]of Object.entries(o)){if(!t||typeof t!=`object`)continue;let r=n().safeParse(t);r.success&&(s[e]=r.data)}return s}catch(e){return s(e),{}}}export{_ as readClaudeDesktopMcpServers};
1
+ import{a as e,d as t,i as n,l as r}from"./types-CD25a50S.js";import{I as i,N as a}from"./debug-kBjDaVkQ.js";import{o,s}from"./log-DWZny1vM.js";import{i as c,n as l,t as u}from"./platform-Vl9IynC3.js";import{homedir as d}from"os";import{join as f}from"path";import{readFile as p,readdir as m,stat as h}from"fs/promises";e(),i(),r(),o(),c();async function g(){let e=l();if(!u.includes(e))throw Error(`Unsupported platform: ${e} - Work Mate Desktop integration only works on macOS and WSL.`);if(e===`macos`)return f(d(),`Library`,`Application Support`,`Work Mate`,`claude_desktop_config.json`);let t=process.env.USERPROFILE?process.env.USERPROFILE.replace(/\\/g,`/`):null;if(t){let e=`/mnt/c${t.replace(/^[A-Z]:/,``)}/AppData/Roaming/Work Mate/claude_desktop_config.json`;try{return await h(e),e}catch{}}try{let e=`/mnt/c/Users`;try{let t=await m(e,{withFileTypes:!0});for(let n of t){if(n.name===`Public`||n.name===`Default`||n.name===`Default User`||n.name===`All Users`)continue;let t=f(e,n.name,`AppData`,`Roaming`,`Work Mate`,`claude_desktop_config.json`);try{return await h(t),t}catch{}}}catch{}}catch(e){s(e)}throw Error(`Could not find Work Mate Desktop config file in Windows. Make sure Work Mate Desktop is installed on Windows.`)}async function _(){if(!u.includes(l()))throw Error(`Unsupported platform - Work Mate Desktop integration only works on macOS and WSL.`);try{let e=await g(),r;try{r=await p(e,{encoding:`utf8`})}catch(e){if(a(e)===`ENOENT`)return{};throw e}let i=t(r);if(!i||typeof i!=`object`)return{};let o=i.mcpServers;if(!o||typeof o!=`object`)return{};let s={};for(let[e,t]of Object.entries(o)){if(!t||typeof t!=`object`)continue;let r=n().safeParse(t);r.success&&(s[e]=r.data)}return s}catch(e){return s(e),{}}}export{_ as readClaudeDesktopMcpServers};
@@ -1 +1 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{n as t,t as n}from"./conversation-DrVkifKy.js";var r;e((()=>{t(),r=async(e,t)=>(await n(t),{type:`text`,value:``})}))();export{r as call};
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{n as t,t as n}from"./conversation-CG_z7TLE.js";var r;e((()=>{t(),r=async(e,t)=>(await n(t),{type:`text`,value:``})}))();export{r as call};
@@ -1 +1 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{c as t,i as n}from"./proxy-CDBfZjO7.js";import{n as r,t as i}from"./openai-CR3CcjCE.js";function a(e){if(s)return s;let t=new r({apiKey:process.env.GROK_API_KEY||process.env.XAI_API_KEY||``,baseURL:process.env.GROK_BASE_URL||o,maxRetries:e?.maxRetries??0,timeout:parseInt(process.env.API_TIMEOUT_MS||`600000`,10),dangerouslyAllowBrowser:!0,fetchOptions:n({forAnthropicAPI:!1}),...e?.fetchOverride&&{fetch:e.fetchOverride}});return e?.fetchOverride||(s=t),t}var o,s,c=e((()=>{i(),t(),o=`https://api.x.ai/v1`,s=null}));export{c as n,a as t};
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{c as t,i as n}from"./proxy-BtWuysHM.js";import{n as r,t as i}from"./openai-CR3CcjCE.js";function a(e){if(s)return s;let t=new r({apiKey:process.env.GROK_API_KEY||process.env.XAI_API_KEY||``,baseURL:process.env.GROK_BASE_URL||o,maxRetries:e?.maxRetries??0,timeout:parseInt(process.env.API_TIMEOUT_MS||`600000`,10),dangerouslyAllowBrowser:!0,fetchOptions:n({forAnthropicAPI:!1}),...e?.fetchOverride&&{fetch:e.fetchOverride}});return e?.fetchOverride||(s=t),t}var o,s,c=e((()=>{i(),t(),o=`https://api.x.ai/v1`,s=null}));export{c as n,a as t};
@@ -1 +1 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{c as t,i as n}from"./proxy-CDBfZjO7.js";import{n as r,t as i}from"./openai-CR3CcjCE.js";import{r as a,t as o}from"./store-Z8rTjDHe.js";function s(e){if(!e)return 0;let t=0,n=/(\d+(?:\.\d+)?)(ms|s|m|h|d)/g,r;for(;(r=n.exec(e))!==null;){let e=Number(r[1]);switch(r[2]){case`ms`:t+=e/1e3;break;case`s`:t+=e;break;case`m`:t+=e*60;break;case`h`:t+=e*3600;break;case`d`:t+=e*86400;break}}if(t===0){let n=Number(e);Number.isFinite(n)&&(t=n)}return t<=0?0:Math.floor(Date.now()/1e3)+t}function c(e,t){if(e===null||t===null)return null;let n=Number(e),r=Number(t);if(!Number.isFinite(n)||!Number.isFinite(r)||r<=0)return null;let i=Math.max(0,r-n);return Math.min(1,Math.max(0,i/r))}var l,u=e((()=>{l={providerId:`openai`,parseHeaders(e){let t=[],n=c(e.get(`x-ratelimit-remaining-requests`),e.get(`x-ratelimit-limit-requests`));n!==null&&t.push({kind:`requests`,label:`RPM`,utilization:n,resetsAt:s(e.get(`x-ratelimit-reset-requests`))||void 0});let r=c(e.get(`x-ratelimit-remaining-tokens`),e.get(`x-ratelimit-limit-tokens`));return r!==null&&t.push({kind:`tokens`,label:`TPM`,utilization:r,resetsAt:s(e.get(`x-ratelimit-reset-tokens`))||void 0}),t}}}));function d(e){return async(...t)=>{let n=await e(...t);try{a(`openai`,l.parseHeaders(n.headers))}catch{}return n}}function f(e){if(m)return m;let t=process.env.OPENAI_API_KEY||``,i=process.env.OPENAI_BASE_URL,a=d(e?.fetchOverride??globalThis.fetch),o=new r({apiKey:t,...i&&{baseURL:i},maxRetries:e?.maxRetries??0,timeout:parseInt(process.env.API_TIMEOUT_MS||`600000`,10),dangerouslyAllowBrowser:!0,...process.env.OPENAI_ORG_ID&&{organization:process.env.OPENAI_ORG_ID},...process.env.OPENAI_PROJECT_ID&&{project:process.env.OPENAI_PROJECT_ID},fetchOptions:n({forAnthropicAPI:!1}),fetch:a});return e?.fetchOverride||(m=o),o}function p(){m=null}var m,h=e((()=>{i(),u(),o(),t(),m=null}));export{f as n,h as r,p as t};
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{c as t,i as n}from"./proxy-BtWuysHM.js";import{n as r,t as i}from"./openai-CR3CcjCE.js";import{r as a,t as o}from"./store-Z8rTjDHe.js";function s(e){if(!e)return 0;let t=0,n=/(\d+(?:\.\d+)?)(ms|s|m|h|d)/g,r;for(;(r=n.exec(e))!==null;){let e=Number(r[1]);switch(r[2]){case`ms`:t+=e/1e3;break;case`s`:t+=e;break;case`m`:t+=e*60;break;case`h`:t+=e*3600;break;case`d`:t+=e*86400;break}}if(t===0){let n=Number(e);Number.isFinite(n)&&(t=n)}return t<=0?0:Math.floor(Date.now()/1e3)+t}function c(e,t){if(e===null||t===null)return null;let n=Number(e),r=Number(t);if(!Number.isFinite(n)||!Number.isFinite(r)||r<=0)return null;let i=Math.max(0,r-n);return Math.min(1,Math.max(0,i/r))}var l,u=e((()=>{l={providerId:`openai`,parseHeaders(e){let t=[],n=c(e.get(`x-ratelimit-remaining-requests`),e.get(`x-ratelimit-limit-requests`));n!==null&&t.push({kind:`requests`,label:`RPM`,utilization:n,resetsAt:s(e.get(`x-ratelimit-reset-requests`))||void 0});let r=c(e.get(`x-ratelimit-remaining-tokens`),e.get(`x-ratelimit-limit-tokens`));return r!==null&&t.push({kind:`tokens`,label:`TPM`,utilization:r,resetsAt:s(e.get(`x-ratelimit-reset-tokens`))||void 0}),t}}}));function d(e){return async(...t)=>{let n=await e(...t);try{a(`openai`,l.parseHeaders(n.headers))}catch{}return n}}function f(e){if(m)return m;let t=process.env.OPENAI_API_KEY||``,i=process.env.OPENAI_BASE_URL,a=d(e?.fetchOverride??globalThis.fetch),o=new r({apiKey:t,...i&&{baseURL:i},maxRetries:e?.maxRetries??0,timeout:parseInt(process.env.API_TIMEOUT_MS||`600000`,10),dangerouslyAllowBrowser:!0,...process.env.OPENAI_ORG_ID&&{organization:process.env.OPENAI_ORG_ID},...process.env.OPENAI_PROJECT_ID&&{project:process.env.OPENAI_PROJECT_ID},fetchOptions:n({forAnthropicAPI:!1}),fetch:a});return e?.fetchOverride||(m=o),o}function p(){m=null}var m,h=e((()=>{i(),u(),o(),t(),m=null}));export{f as n,h as r,p as t};
@@ -0,0 +1 @@
1
+ import{r as e,t}from"./client-aJ2Nr_sh.js";e();export{t as clearOpenAIClientCache};
@@ -0,0 +1 @@
1
+ import{n as e,t}from"./client-Bw_L3lSc.js";e();export{t as getGrokClient};
@@ -0,0 +1 @@
1
+ import{Ci as e,Di as t,Mi as n}from"./loadAgentsDir-DR5PVAc3.js";n();export{e as clearCommandsCache,t as getCommands};
@@ -0,0 +1,2 @@
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{di as t,fi as n}from"./src-WZ94ZKI3.js";import{It as r,Pt as i}from"./state-CXY-q5gr.js";import{$_ as a,B_ as o,F_ as s,G_ as c,I_ as l,Jg as u,Ji as d,M_ as f,P_ as p,Rx as m,V_ as h,W_ as g,Xg as _,Zg as v,ab as y,av as b,j_ as x,lm as S,mn as C,mp as w,nd as T,nm as E,ob as D,ot as O,pp as k,qg as A,rm as j,sm as M,st as N,td as P}from"./loadAgentsDir-DR5PVAc3.js";import{F,I}from"./debug-kBjDaVkQ.js";import{o as L,s as R}from"./log-DWZny1vM.js";function z(e,n){let r=P(`tip`),i=y(`app:toggleTranscript`,`Global`,`ctrl+o`),a=[...e.options.verbose?[]:[`(${i} to see full summary)`],...n?[n]:[],...r?[r]:[]];return t.dim(`Compacted ${a.join(`
2
+ `)}`)}async function B(e,t){let n=e.getAppState(),r=await O(e.options.tools,e.options.mainLoopModel,Array.from(n.toolPermissionContext.additionalWorkingDirectories.keys()),e.options.mcpClients),i=x({mainThreadAgentDefinition:void 0,toolUseContext:e,customSystemPrompt:e.options.customSystemPrompt,defaultSystemPrompt:r,appendSystemPrompt:e.options.appendSystemPrompt}),[a,o]=await Promise.all([s(),p()]);return{systemPrompt:i,userContext:a,systemContext:o,toolUseContext:e,forkContextMessages:t}}var V;e((()=>{n(),i(),N(),l(),D(),k(),v(),g(),o(),M(),E(),a(),I(),C(),L(),d(),T(),f(),V=async(e,t)=>{let{abortController:n}=t,{messages:i}=t;if(i=m(i),i.length===0)throw Error(`No messages to compact`);let a=e.trim();try{if(!a){let e=await j(i,t.agentId);if(e)return s.cache.clear?.(),S(),w(t.options.querySource??`compact`,t.agentId),r(),c(),{type:`compact`,compactionResult:e,displayText:z(t)}}let e=(await h(i,t)).messages,n=await _(e,t,await B(t,e),!1,a,!1);return b(void 0),c(),s.cache.clear?.(),S(),{type:`compact`,compactionResult:n,displayText:z(t,n.userDisplayMessage)}}catch(e){throw n.signal.aborted?Error(`Compaction canceled.`):F(e,`Not enough messages to compact. Send a few more messages first, then try again.`)?Error(u):F(e,`Compaction interrupted · This may be due to network issues — please try again.`)?Error(A):(R(e),Error(`Error during compaction: ${e}`))}}}))();export{V as call};
@@ -0,0 +1,3 @@
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{n as t,t as n}from"./isObject-C6qM3WEW.js";import{n as r,t as i}from"./memoize-BK3gG5ob.js";import{c as a,i as o,l as s,o as c}from"./envUtils-DZ_SvEVz.js";import{d as l,l as u,m as d,p as ee}from"./types-CD25a50S.js";import{Hr as te,Jr as ne,Pt as re,Ur as ie,X as f,Xr as ae,Yr as oe,Zr as se,_r as ce,ai as le,ar as ue,cr as de,dr as fe,ei as pe,fr as me,gr as he,ii as ge,ir as _e,lr as ve,pr as ye,q as be,st as xe,ti as Se,ur as Ce}from"./state-CXY-q5gr.js";import{n as we,t as Te}from"./cwd-DrEEb4f5.js";import{$ as Ee,C as p,I as De,N as m,O as h,S as Oe,c as g,et as ke,f as Ae,i as je,u as _,x as Me}from"./debug-kBjDaVkQ.js";import{Cn as Ne,Gt as v,Kr as Pe,Kt as Fe,Nn as Ie,Pr as Le,Tr as Re,Yt as y,Zt as ze,ci as Be,di as Ve,er as b,fi as He,gr as Ue,m as We,ni as Ge,qr as Ke,s as x,si as qe,t as Je,ti as Ye,tr as S}from"./settings-YIDksG5Z.js";import{d as Xe,o as Ze,s as Qe,u as $e}from"./log-DWZny1vM.js";import{n as et}from"./analytics-COpjZpvd.js";import{i as tt,n as nt}from"./lockfile-D_9vif6E.js";import{homedir as rt}from"os";import{basename as C,dirname as w,isAbsolute as it,join as T,normalize as E,resolve as D,sep as O}from"path";import{unwatchFile as at,watchFile as ot}from"fs";import{randomBytes as st}from"crypto";var k,ct=e((()=>{le(),Ge(),oe(),ae(),k=Object.getOwnPropertySymbols?function(e){for(var t=[];e;)ge(t,ne(e)),e=Ye(e);return t}:se}));function lt(e){return pe(e,Be,k)}var ut=e((()=>{Se(),ct(),qe()}));function dt(){let e=process.env.WORKMATE_DISABLE_AUTO_MEMORY;if(s(e))return!1;if(a(e))return!0;if(s(process.env.WORKMATE_SIMPLE)||s(process.env.WORKMATE_REMOTE)&&!process.env.WORKMATE_REMOTE_MEMORY_DIR)return!1;let t=Je();return t.autoMemoryEnabled===void 0||t.autoMemoryEnabled}function ft(){return!1}function pt(){return process.env.WORKMATE_REMOTE_MEMORY_DIR?process.env.WORKMATE_REMOTE_MEMORY_DIR:o()}function mt(e,t){if(!e)return;let n=e;if(t&&(n.startsWith(`~/`)||n.startsWith(`~\\`))){let e=n.slice(2),t=E(e||`.`);if(t===`.`||t===`..`)return;n=T(rt(),e)}let r=E(n).replace(/[/\\]+$/,``);if(!(!it(r)||r.length<3||/^[A-Za-z]:$/.test(r)||r.startsWith(`\\\\`)||r.startsWith(`//`)||r.includes(`\0`)))return(r+O).normalize(`NFC`)}function ht(){return mt(process.env.CLAUDE_COWORK_MEMORY_PATH_OVERRIDE,!1)}function gt(){return mt(x(`policySettings`)?.autoMemoryDirectory??x(`flagSettings`)?.autoMemoryDirectory??x(`localSettings`)?.autoMemoryDirectory??x(`userSettings`)?.autoMemoryDirectory,!0)}function _t(){return ht()!==void 0}function vt(){return Re(f())??f()}function yt(){return T(A(),St)}function bt(e){return E(e).startsWith(A())}var xt,St,A,Ct=e((()=>{i(),re(),c(),Le(),b(),We(),xt=`memory`,St=`MEMORY.md`,A=r(()=>(ht()??gt())||(T(T(pt(),`projects`),Ue(vt()),xt)+O).normalize(`NFC`),()=>f())}));function j(e,n,r,i){if(!t(e))return e;n=me(n,e);for(var a=-1,o=n.length,s=o-1,c=e;c!=null&&++a<o;){var l=fe(n[a]),u=r;if(l===`__proto__`||l===`constructor`||l===`prototype`)return e;if(a!=s){var d=c[l];u=i?i(d,l,c):void 0,u===void 0&&(u=t(d)?d:ie(n[a+1])?[]:{})}Ve(c,l,u),c=c[l]}return e}var M=e((()=>{He(),ye(),te(),n(),Ce()}));function wt(e,t,n){for(var r=-1,i=t.length,a={};++r<i;){var o=t[r],s=de(e,o);n(s,o)&&j(a,me(o,e),s)}return a}var Tt=e((()=>{ve(),M(),ye()}));function N(e,t){if(e==null)return{};var n=he(lt(e),function(e){return[e]});return t=_e(t),wt(e,n,function(e,n){return t(e,n[0])})}var Et=e((()=>{ce(),ue(),Tt(),ut()}));function P(){return{numStartups:0,installMethod:void 0,autoUpdates:void 0,theme:`dark`,preferredNotifChannel:`auto`,verbose:!1,editorMode:`normal`,autoCompactEnabled:!0,showTurnDuration:!0,hasSeenTasksHint:!1,hasUsedStash:!1,hasUsedBackgroundTask:!1,queuedCommandUpHintCount:0,diffTool:`auto`,env:{},tipsHistory:{},memoryUsageCount:0,promptQueueUseCount:0,btwUseCount:0,todoFeatureEnabled:!0,showExpandedTodos:!1,messageIdleNotifThresholdMs:6e4,fileCheckpointingEnabled:!0,terminalProgressBarEnabled:!0,cachedStatsigGates:{},cachedDynamicConfigs:{},respectGitignore:!0}}function Dt(){return G||(G=Ot())}function Ot(){if(xe())return!0;let e=z(),t=$();if(e.projects?.[t]?.hasTrustDialogAccepted)return!0;let n=S(Te());for(;;){if(e.projects?.[n]?.hasTrustDialogAccepted)return!0;let t=S(D(n,`..`));if(t===n)break;n=t}return!1}function F(e){let t=K.config;return t?t.hasCompletedOnboarding===!0&&e.hasCompletedOnboarding!==!0:!1}function I(e){let t=null;try{Nt(v(),P,n=>{let r=e(n);return r===n?n:(t={...r,projects:At(n.projects)},t)})&&t&&R(t)}catch(n){g(`Failed to save config with lock: ${n}`,{level:`error`});let r=V(v(),P);if(F(r)){g(`saveGlobalConfig fallback: re-read config is missing auth that cache has; refusing to write. See GH #3117.`,{level:`error`});return}let i=e(r);if(i===r)return;t={...i,projects:At(r.projects)},Mt(v(),t,W),R(t)}}function kt(){let e=J+Y;e>0&&J/e,J=0,Y=0}function L(e){if(e.installMethod!==void 0)return e;let t=e,n=`unknown`,r=e.autoUpdates??!0;switch(t.autoUpdaterStatus){case`migrated`:n=`local`;break;case`installed`:n=`native`;break;case`disabled`:r=!1;break;case`enabled`:case`no_permissions`:case`not_configured`:n=`global`;break;case void 0:break}return{...e,installMethod:n,autoUpdates:r}}function At(e){if(!e)return e;let t={},n=!1;for(let[r,i]of Object.entries(e)){let e=i;if(e.history!==void 0){n=!0;let{history:i,...a}=e;t[r]=a}else t[r]=i}return n?t:e}function jt(){if(Z)return;Z=!0;let e=v();ot(e,{interval:qt,persistent:!1},t=>{t.mtimeMs<=K.mtime||_().readFile(e,{encoding:`utf-8`}).then(e=>{if(t.mtimeMs<=K.mtime)return;let n=l(d(e));typeof n!=`object`||!n||(K={config:L({...P(),...n}),mtime:t.mtimeMs},q={mtime:t.mtimeMs,size:t.size})}).catch(()=>{})}),ke(async()=>{at(e),Z=!1})}function R(e){K={config:e,mtime:Date.now()},q=null}function z(){if(K.config)return J++,K.config;Y++;try{let e=null;try{e=_().statSync(v())}catch{}let t=L(V(v(),P));return K={config:t,mtime:e?.mtimeMs??Date.now()},q=e?{mtime:e.mtimeMs,size:e.size}:null,jt(),t}catch{return L(V(v(),P))}}function Mt(e,t,n){let r=w(e);_().mkdirSync(r),Ie(e,p(N(t,(e,t)=>p(e)!==p(n[t])),null,2),{encoding:`utf-8`,mode:384}),e===v()&&X++}function Nt(e,t,n){let r=t(),i=w(e),a=_();a.mkdirSync(i);let o;try{let i=`${e}.lock`,s=Date.now();if(o=tt(e,{lockfilePath:i,onCompromised:e=>{g(`Config lock compromised: ${e}`,{level:`error`})}}),Date.now()-s>100&&g(`Lock acquisition took longer than expected - another Work Mate instance may be running`),q&&e===v())try{let t=a.statSync(e);(t.mtimeMs!==q.mtime||t.size!==q.size)&&(q.mtime,t.mtimeMs,q.size,t.size)}catch(e){if(m(e)!==`ENOENT`)throw e}let c=V(e,t);if(e===v()&&F(c))return g(`saveConfigWithLock: re-read config is missing auth that cache has; refusing to write to avoid wiping ~/.workmate.json. See GH #3117.`,{level:`error`}),!1;let l=n(c);if(l===c)return!1;let u=N(l,(e,t)=>p(e)!==p(r[t]));try{let t=C(e),n=B();try{a.mkdirSync(n)}catch(e){if(m(e)!==`EEXIST`)throw e}let r=a.readdirStringSync(n).filter(e=>e.startsWith(`${t}.backup.`)).sort().reverse(),i=r[0],o=i?Number(i.split(`.backup.`).pop()):0,s=Number.isNaN(o)||Date.now()-o>=6e4;if(s){let r=T(n,`${t}.backup.${Date.now()}`);a.copyFileSync(e,r)}let c=s?a.readdirStringSync(n).filter(e=>e.startsWith(`${t}.backup.`)).sort().reverse():r;for(let e of c.slice(5))try{a.unlinkSync(T(n,e))}catch{}}catch(e){m(e)!==`ENOENT`&&g(`Failed to backup config: ${e}`,{level:`error`})}return Ie(e,p(u,null,2),{encoding:`utf-8`,mode:384}),e===v()&&X++,!0}finally{o&&o()}}function Pt(){if(Q)return;let e=Date.now();Ke(`info`,`enable_configs_started`),Q=!0,V(v(),P,!0),Ke(`info`,`enable_configs_completed`,{duration_ms:Date.now()-e})}function B(){return T(o(),`backups`)}function Ft(e){let t=_(),n=C(e),r=B();try{let e=t.readdirStringSync(r).filter(e=>e.startsWith(`${n}.backup.`)).sort().at(-1);if(e)return T(r,e)}catch{}let i=w(e);try{let r=t.readdirStringSync(i).filter(e=>e.startsWith(`${n}.backup.`)).sort().at(-1);if(r)return T(i,r);let a=`${e}.backup`;try{return t.statSync(a),a}catch{}}catch{}return null}function V(e,t,n){if(!Q)throw Error(`Config accessed before allowed.`);let r=_();try{let n=r.readFileSync(e,{encoding:`utf-8`});try{let e=Oe(d(n));return{...t(),...e}}catch(n){throw new h(n instanceof Error?n.message:String(n),e,t())}}catch(i){if(m(i)===`ENOENT`){let n=Ft(e);return n&&process.stderr.write(`\nWork Mate configuration file not found at: ${e}\nA backup file exists at: ${n}\nYou can manually restore it by running: cp "${n}" "${e}"\n\n`),t()}if(i instanceof h&&n)throw i;if(i instanceof h){if(g(`Config file corrupted, resetting to defaults: ${i.message}`,{level:`error`}),!H){H=!0;try{Qe(i);try{r.statSync(`${e}.backup`)}catch{}}finally{H=!1}}process.stderr.write(`\nWork Mate configuration file at ${e} is corrupted: ${i.message}\n`);let t=C(e),n=B();try{r.mkdirSync(n)}catch(e){if(m(e)!==`EEXIST`)throw e}let a=r.readdirStringSync(n).filter(e=>e.startsWith(`${t}.corrupted.`)),o,s=!1,c=r.readFileSync(e,{encoding:`utf-8`});for(let e of a)try{if(c===r.readFileSync(T(n,e),{encoding:`utf-8`})){s=!0;break}}catch{}if(!s){o=T(n,`${t}.corrupted.${Date.now()}`);try{r.copyFileSync(e,o),g(`Corrupted config backed up to: ${o}`,{level:`error`})}catch{}}let l=Ft(e);o?process.stderr.write(`The corrupted file has been backed up to: ${o}\n`):s&&process.stderr.write(`The corrupted file has already been backed up.
2
+ `),l?process.stderr.write(`A backup file exists at: ${l}\nYou can manually restore it by running: cp "${l}" "${e}"\n\n`):process.stderr.write(`
3
+ `)}return t()}}function It(){let e=$(),t=z();if(!t.projects)return U;let n=t.projects[e]??U;return typeof n.allowedTools==`string`&&(n.allowedTools=l(n.allowedTools)??[]),n}function Lt(e){let t=$(),n=null;try{Nt(v(),P,r=>{let i=r.projects?.[t]??U,a=e(i);return a===i?r:(n={...r,projects:{...r.projects,[t]:a}},n)})&&n&&R(n)}catch(r){g(`Failed to save config with lock: ${r}`,{level:`error`});let i=V(v(),P);if(F(i)){g(`saveCurrentProjectConfig fallback: re-read config is missing auth that cache has; refusing to write. See GH #3117.`,{level:`error`});return}let a=i.projects?.[t]??U,o=e(a);if(o===a)return;n={...i,projects:{...i.projects,[t]:o}},Mt(v(),n,W),R(n)}}function Rt(){return Vt()!==null}function zt(){return Rt()&&!s(process.env.FORCE_AUTOUPDATE_PLUGINS)}function Bt(e){switch(e.type){case`development`:return`development build`;case`env`:return`${e.envVar} set`;case`config`:return`config`}}function Vt(){if(!s(process.env.ENABLE_AUTOUPDATER))return{type:`config`};if(s(process.env.DISABLE_AUTOUPDATER))return{type:`env`,envVar:`DISABLE_AUTOUPDATER`};let e=$e();if(e)return{type:`env`,envVar:e};let t=z();return t.autoUpdates===!1&&(t.installMethod!==`native`||t.autoUpdatesProtectedForNative!==!0)?{type:`config`}:null}function Ht(){let e=z();if(e.userID)return e.userID;let t=st(32).toString(`hex`);return I(e=>({...e,userID:t})),t}function Ut(){if(!z().firstStartTime){let e=new Date().toISOString();I(t=>({...t,firstStartTime:t.firstStartTime??e}))}}function Wt(e){let t=be();switch(e){case`User`:return T(o(),`AGENTS.md`);case`Local`:return T(t,`AGENTS.local.md`);case`Project`:return T(t,`AGENTS.md`);case`Managed`:return T(y(),`AGENTS.md`);case`AutoMem`:return yt();default:return T(o(),`AGENTS.md`)}}function Gt(){return T(y(),`.workmate`,`rules`)}function Kt(){return T(o(),`rules`)}var H,U,W,G,K,q,J,Y,X,qt,Z,Q,$,Jt=e((()=>{i(),Et(),re(),Ct(),et(),we(),Ee(),je(),Pe(),Fe(),c(),De(),Ne(),Ae(),Le(),u(),ee(),nt(),Ze(),b(),Xe(),ze(),Me(),H=!1,U={allowedTools:[],mcpContextUris:[],mcpServers:{},enabledMcpjsonServers:[],disabledMcpjsonServers:[],hasTrustDialogAccepted:!1,projectOnboardingSeenCount:0,hasAgentsMdExternalIncludesApproved:!1,hasAgentsMdExternalIncludesWarningShown:!1},W=P(),G=!1,{...W},{...U},K={config:null,mtime:0},q=null,J=0,Y=0,X=0,ke(async()=>{kt()}),qt=1e3,Z=!1,Q=!1,$=r(()=>{let e=be();return S(Re(e)||D(e))})}));export{ct as A,Ct as C,lt as D,ft as E,ut as O,_t as S,dt as T,j as _,It as a,A as b,Wt as c,Jt as d,Rt as f,zt as g,I as h,Vt as i,k,Ht as l,Lt as m,Pt as n,z as o,Ut as p,Bt as r,Gt as s,Dt as t,Kt as u,M as v,bt as w,pt as x,yt as y};
@@ -0,0 +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"./Settings-B6DImvca.js";var i,a;e((()=>{n(),i=t(),a=async(e,t)=>(0,i.jsx)(r,{onClose:e,context:t,defaultTab:`Config`})}))();export{a as call};
@@ -0,0 +1 @@
1
+ import{d as e,n as t}from"./config-D3K87Mm1.js";e();export{t as enableConfigs};
@@ -0,0 +1 @@
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{n as t,t as n}from"./figures-5ThXQEtq.js";import{I as r,P as i,s as a,t as o}from"./src-WZ94ZKI3.js";import{t as s}from"./jsx-runtime-Bb4Xn-E0.js";import{A_ as c,B_ as l,Ji as u,O_ as d,Rx as f,V_ as p}from"./loadAgentsDir-DR5PVAc3.js";import{Cn as m,bn as h,cn as g,sn as _}from"./settings-YIDksG5Z.js";import{_ as v,g as y}from"./startupProfiler-DIM_Ihyp.js";import{At as b,Ot as x,Yt as S,in as C,rn as w,tn as T}from"./prompt-CTByhpUI.js";import{n as E,t as D}from"./staticRender-RHUIg5ln.js";function O(e){let t=[];return k(e,t),A(e,t),M(e,t),ee(e,t),N(e,t),t.sort((e,t)=>e.severity===t.severity?(t.savingsTokens??0)-(e.savingsTokens??0):e.severity===`warning`?-1:1),t}function k(e,t){e.percentage>=L&&t.push({severity:`warning`,title:`Context is ${e.percentage}% full`,detail:e.isAutoCompactEnabled?`Autocompact will trigger soon, which discards older messages. Use /compact now to control what gets kept.`:`Autocompact is disabled. Use /compact to free space, or enable autocompact in /config.`})}function A(e,t){if(e.messageBreakdown)for(let n of e.messageBreakdown.toolCallsByType){let r=n.callTokens+n.resultTokens,i=r/e.rawMaxTokens*100;if(i<P||r<F)continue;let a=j(n.name,r,i);a&&t.push(a)}}function j(e,t,n){let r=y(t);switch(e){case w:return{severity:`warning`,title:`Bash results using ${r} tokens (${n.toFixed(0)}%)`,detail:`Pipe output through head, tail, or grep to reduce result size. Avoid cat on large files — use Read with offset/limit instead.`,savingsTokens:Math.floor(t*.5)};case S:return{severity:`info`,title:`Read results using ${r} tokens (${n.toFixed(0)}%)`,detail:`Use offset and limit parameters to read only the sections you need. Avoid re-reading entire files when you only need a few lines.`,savingsTokens:Math.floor(t*.3)};case x:return{severity:`info`,title:`Grep results using ${r} tokens (${n.toFixed(0)}%)`,detail:`Add more specific patterns or use the glob or type parameter to narrow file types. Consider Glob for file discovery instead of Grep.`,savingsTokens:Math.floor(t*.3)};default:return n>=20?{severity:`info`,title:`${e} using ${r} tokens (${n.toFixed(0)}%)`,detail:`This tool is consuming a significant portion of context.`,savingsTokens:Math.floor(t*.2)}:null}}function M(e,t){if(!e.messageBreakdown)return;let n=e.messageBreakdown.toolCallsByType.find(e=>e.name===S);if(!n)return;let r=n.callTokens+n.resultTokens,i=r/e.rawMaxTokens*100,a=n.resultTokens/e.rawMaxTokens*100;i>=P&&r>=F||a>=I&&n.resultTokens>=F&&t.push({severity:`info`,title:`File reads using ${y(n.resultTokens)} tokens (${a.toFixed(0)}%)`,detail:`If you are re-reading files, consider referencing earlier reads. Use offset/limit for large files.`,savingsTokens:Math.floor(n.resultTokens*.3)})}function ee(e,t){let n=e.memoryFiles.reduce((e,t)=>e+t.tokens,0),r=n/e.rawMaxTokens*100;if(r>=R&&n>=z){let i=[...e.memoryFiles].sort((e,t)=>t.tokens-e.tokens).slice(0,3).map(e=>`${h(e.path)} (${y(e.tokens)})`).join(`, `);t.push({severity:`info`,title:`Memory files using ${y(n)} tokens (${r.toFixed(0)}%)`,detail:`Largest: ${i}. Use /memory to review and prune stale entries.`,savingsTokens:Math.floor(n*.3)})}}function N(e,t){!e.isAutoCompactEnabled&&e.percentage>=50&&e.percentage<L&&t.push({severity:`info`,title:`Autocompact is disabled`,detail:`Without autocompact, you will hit context limits and lose the conversation. Enable it in /config or use /compact manually.`})}var P,F,I,L,R,z,B=e((()=>{C(),T(),b(),m(),v(),P=15,F=1e4,I=5,L=80,R=5,z=5e3}));function V({suggestions:e}){return e.length===0?null:(0,H.jsxs)(r,{flexDirection:`column`,marginTop:1,children:[(0,H.jsx)(i,{bold:!0,children:`Suggestions`}),e.map((e,t)=>(0,H.jsxs)(r,{flexDirection:`column`,marginTop:t===0?0:1,children:[(0,H.jsxs)(r,{children:[(0,H.jsx)(a,{status:e.severity,withSpace:!0}),(0,H.jsx)(i,{bold:!0,children:e.title}),e.savingsTokens?(0,H.jsxs)(i,{dimColor:!0,children:[` `,n.arrowRight,` save ~`,y(e.savingsTokens)]}):null]}),(0,H.jsx)(r,{marginLeft:2,children:(0,H.jsx)(i,{dimColor:!0,children:e.detail})})]},t))]})}var H,U=e((()=>{t(),o(),v(),H=s()}));function W(){return null}function G(e){let t=new Map;for(let n of e){let e=_(n.source),r=t.get(e)||[];r.push(n),t.set(e,r)}for(let[e,n]of t.entries())t.set(e,n.sort((e,t)=>t.tokens-e.tokens));let n=new Map;for(let e of Y){let r=t.get(e);r&&n.set(e,r)}return n}function K({data:e}){let{categories:t,totalTokens:n,rawMaxTokens:a,percentage:o,gridRows:s,model:c,memoryFiles:l,mcpTools:u,deferredBuiltinTools:d=[],agents:f,skills:p,cacheHitRate:m,cacheThreshold:g}=e,_=t.filter(e=>e.tokens>0&&e.name!==`Free space`&&e.name!==J&&!e.isDeferred),v=t.some(e=>e.isDeferred&&e.name.includes(`MCP`)),b=t.find(e=>e.name===J);return(0,q.jsxs)(r,{flexDirection:`column`,paddingLeft:1,children:[(0,q.jsx)(i,{bold:!0,children:`Context Usage`}),(0,q.jsxs)(r,{flexDirection:`row`,gap:2,children:[(0,q.jsx)(r,{flexDirection:`column`,flexShrink:0,children:s.map((e,t)=>(0,q.jsx)(r,{flexDirection:`row`,marginLeft:-1,children:e.map((e,t)=>e.categoryName===`Free space`?(0,q.jsx)(i,{dimColor:!0,children:`⛶ `},t):e.categoryName===J?(0,q.jsx)(i,{color:e.color,children:`⛝ `},t):(0,q.jsx)(i,{color:e.color,children:e.squareFullness>=.7?`⛁ `:`⛀ `},t))},t))}),(0,q.jsxs)(r,{flexDirection:`column`,gap:0,flexShrink:0,children:[(0,q.jsxs)(i,{dimColor:!0,children:[c,` · `,y(n),`/`,y(a),` tokens (`,o,`%)`]}),(0,q.jsx)(W,{}),m!==void 0&&g!==void 0&&(0,q.jsxs)(i,{color:m<g?`warning`:void 0,children:[`Cache hit rate: `,m.toFixed(0),`%`,m<g?` (below ${g}% threshold)`:``]}),(0,q.jsx)(i,{children:` `}),(0,q.jsx)(i,{dimColor:!0,italic:!0,children:`Estimated usage by category`}),_.map((e,t)=>{let n=y(e.tokens),o=e.isDeferred?`N/A`:`${(e.tokens/a*100).toFixed(1)}%`,s=e.name===J,c=e.name,l=e.isDeferred?` `:s?`⛝`:`⛁`;return(0,q.jsxs)(r,{children:[(0,q.jsx)(i,{color:e.color,children:l}),(0,q.jsxs)(i,{children:[` `,c,`: `]}),(0,q.jsxs)(i,{dimColor:!0,children:[n,` tokens (`,o,`)`]})]},t)}),(t.find(e=>e.name===`Free space`)?.tokens??0)>0&&(0,q.jsxs)(r,{children:[(0,q.jsx)(i,{dimColor:!0,children:`⛶`}),(0,q.jsx)(i,{children:` Free space: `}),(0,q.jsxs)(i,{dimColor:!0,children:[y(t.find(e=>e.name===`Free space`)?.tokens||0),` (`,((t.find(e=>e.name===`Free space`)?.tokens||0)/a*100).toFixed(1),`%)`]})]}),b&&b.tokens>0&&(0,q.jsxs)(r,{children:[(0,q.jsx)(i,{color:b.color,children:`⛝`}),(0,q.jsxs)(i,{dimColor:!0,children:[` `,b.name,`: `]}),(0,q.jsxs)(i,{dimColor:!0,children:[y(b.tokens),` tokens (`,(b.tokens/a*100).toFixed(1),`%)`]})]})]})]}),(0,q.jsxs)(r,{flexDirection:`column`,marginLeft:-1,children:[u.length>0&&(0,q.jsxs)(r,{flexDirection:`column`,marginTop:1,children:[(0,q.jsxs)(r,{children:[(0,q.jsx)(i,{bold:!0,children:`MCP tools`}),(0,q.jsxs)(i,{dimColor:!0,children:[` · /mcp`,v?` (loaded on-demand)`:``]})]}),u.some(e=>e.isLoaded)&&(0,q.jsxs)(r,{flexDirection:`column`,marginTop:1,children:[(0,q.jsx)(i,{dimColor:!0,children:`Loaded`}),u.filter(e=>e.isLoaded).map((e,t)=>(0,q.jsxs)(r,{children:[(0,q.jsxs)(i,{children:[`└ `,e.name,`: `]}),(0,q.jsxs)(i,{dimColor:!0,children:[y(e.tokens),` tokens`]})]},t))]}),v&&u.some(e=>!e.isLoaded)&&(0,q.jsxs)(r,{flexDirection:`column`,marginTop:1,children:[(0,q.jsx)(i,{dimColor:!0,children:`Available`}),u.filter(e=>!e.isLoaded).map((e,t)=>(0,q.jsx)(r,{children:(0,q.jsxs)(i,{dimColor:!0,children:[`└ `,e.name]})},t))]}),!v&&u.map((e,t)=>(0,q.jsxs)(r,{children:[(0,q.jsxs)(i,{children:[`└ `,e.name,`: `]}),(0,q.jsxs)(i,{dimColor:!0,children:[y(e.tokens),` tokens`]})]},t))]}),f.length>0&&(0,q.jsxs)(r,{flexDirection:`column`,marginTop:1,children:[(0,q.jsxs)(r,{children:[(0,q.jsx)(i,{bold:!0,children:`Custom agents`}),(0,q.jsx)(i,{dimColor:!0,children:` · /agents`})]}),Array.from(G(f).entries()).map(([e,t])=>(0,q.jsxs)(r,{flexDirection:`column`,marginTop:1,children:[(0,q.jsx)(i,{dimColor:!0,children:e}),t.map((e,t)=>(0,q.jsxs)(r,{children:[(0,q.jsxs)(i,{children:[`└ `,e.agentType,`: `]}),(0,q.jsxs)(i,{dimColor:!0,children:[y(e.tokens),` tokens`]})]},t))]},e))]}),l.length>0&&(0,q.jsxs)(r,{flexDirection:`column`,marginTop:1,children:[(0,q.jsxs)(r,{children:[(0,q.jsx)(i,{bold:!0,children:`Memory files`}),(0,q.jsx)(i,{dimColor:!0,children:` · /memory`})]}),l.map((e,t)=>(0,q.jsxs)(r,{children:[(0,q.jsxs)(i,{children:[`└ `,h(e.path),`: `]}),(0,q.jsxs)(i,{dimColor:!0,children:[y(e.tokens),` tokens`]})]},t))]}),p&&p.tokens>0&&(0,q.jsxs)(r,{flexDirection:`column`,marginTop:1,children:[(0,q.jsxs)(r,{children:[(0,q.jsx)(i,{bold:!0,children:`Skills`}),(0,q.jsx)(i,{dimColor:!0,children:` · /skills`})]}),Array.from(G(p.skillFrontmatter).entries()).map(([e,t])=>(0,q.jsxs)(r,{flexDirection:`column`,marginTop:1,children:[(0,q.jsx)(i,{dimColor:!0,children:e}),t.map((e,t)=>(0,q.jsxs)(r,{children:[(0,q.jsxs)(i,{children:[`└ `,e.name,`: `]}),(0,q.jsxs)(i,{dimColor:!0,children:[y(e.tokens),` tokens`]})]},t))]},e))]})]}),(0,q.jsx)(V,{suggestions:O(e)})]})}var q,J,Y,X=e((()=>{o(),B(),m(),v(),g(),U(),q=s(),J=`Autocompact buffer`,Y=[`Project`,`User`,`Managed`,`Plugin`,`Built-in`]}));function Z(e){return f(e)}async function Q(e,t){let{messages:n,getAppState:r,options:{mainLoopModel:i,tools:a}}=t,o=Z(n),{messages:s}=await p(o),c=process.stdout.columns||80,l=r();return e(await E((0,$.jsx)(K,{data:await d(s,i,async()=>l.toolPermissionContext,a,l.agentDefinitions,c,t,void 0,o)}))),null}var $;e((()=>{X(),l(),c(),u(),D(),$=s()}))();export{Q as call};
@@ -1,4 +1,4 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{Dh as t,Lh as n,Qx as r,Rh as i,Th as a,Yi as o}from"./loadAgentsDir-B0Anodo0.js";import{cn as s,ln as c}from"./settings-B2jvL8Dp.js";import{_ as l,g as u}from"./startupProfiler-CJdr3SxP.js";async function d(e){let{messages:t,getAppState:n,options:{mainLoopModel:o,tools:s,agentDefinitions:c,customSystemPrompt:l,appendSystemPrompt:u}}=e,d=r(t),{messages:f}=await i(d),p=n();return a(f,o,async()=>p.toolPermissionContext,s,c,void 0,{options:{customSystemPrompt:l,appendSystemPrompt:u}},void 0,d)}async function f(e,t){return{type:`text`,value:p(await d(t))}}function p(e){let{categories:t,totalTokens:n,rawMaxTokens:r,percentage:i,model:a,memoryFiles:o,mcpTools:c,agents:l,skills:d}=e,f=`## Context Usage
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{A_ as t,B_ as n,Ji as r,O_ as i,Rx as a,V_ as o}from"./loadAgentsDir-DR5PVAc3.js";import{cn as s,sn as c}from"./settings-YIDksG5Z.js";import{_ as l,g as u}from"./startupProfiler-DIM_Ihyp.js";async function d(e){let{messages:t,getAppState:n,options:{mainLoopModel:r,tools:s,agentDefinitions:c,customSystemPrompt:l,appendSystemPrompt:u}}=e,d=a(t),{messages:f}=await o(d),p=n();return i(f,r,async()=>p.toolPermissionContext,s,c,void 0,{options:{customSystemPrompt:l,appendSystemPrompt:u}},void 0,d)}async function f(e,t){return{type:`text`,value:p(await d(t))}}function p(e){let{categories:t,totalTokens:n,rawMaxTokens:r,percentage:i,model:a,memoryFiles:o,mcpTools:s,agents:l,skills:d}=e,f=`## Context Usage
2
2
 
3
3
  `;f+=`**Model:** ${a} \n`,f+=`**Tokens:** ${u(n)} / ${u(r)} (${i}%)\n`,f+=`
4
4
  `;let p=t.filter(e=>e.tokens>0&&e.name!==`Free space`&&e.name!==`Autocompact buffer`);if(p.length>0){f+=`### Estimated usage by category
@@ -6,11 +6,11 @@ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{Dh as t,Lh as n,Qx as
6
6
  `,f+=`| Category | Tokens | Percentage |
7
7
  `,f+=`|----------|--------|------------|
8
8
  `;for(let e of p){let t=(e.tokens/r*100).toFixed(1);f+=`| ${e.name} | ${u(e.tokens)} | ${t}% |\n`}let e=t.find(e=>e.name===`Free space`);if(e&&e.tokens>0){let t=(e.tokens/r*100).toFixed(1);f+=`| Free space | ${u(e.tokens)} | ${t}% |\n`}let n=t.find(e=>e.name===`Autocompact buffer`);if(n&&n.tokens>0){let e=(n.tokens/r*100).toFixed(1);f+=`| Autocompact buffer | ${u(n.tokens)} | ${e}% |\n`}f+=`
9
- `}if(c.length>0){f+=`### MCP Tools
9
+ `}if(s.length>0){f+=`### MCP Tools
10
10
 
11
11
  `,f+=`| Tool | Server | Tokens |
12
12
  `,f+=`|------|--------|--------|
13
- `;for(let e of c)f+=`| ${e.name} | ${e.serverName} | ${u(e.tokens)} |\n`;f+=`
13
+ `;for(let e of s)f+=`| ${e.name} | ${e.serverName} | ${u(e.tokens)} |\n`;f+=`
14
14
  `}if(l.length>0){f+=`### Custom Agents
15
15
 
16
16
  `,f+=`| Agent Type | Source | Tokens |
@@ -25,5 +25,5 @@ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{Dh as t,Lh as n,Qx as
25
25
 
26
26
  `,f+=`| Skill | Source | Tokens |
27
27
  `,f+=`|-------|--------|--------|
28
- `;for(let e of d.skillFrontmatter)f+=`| ${e.name} | ${s(e.source)} | ${u(e.tokens)} |\n`;f+=`
29
- `}return f}var m=e((()=>{n(),t(),l(),o(),c()}));export{d as n,m as r,f as t};
28
+ `;for(let e of d.skillFrontmatter)f+=`| ${e.name} | ${c(e.source)} | ${u(e.tokens)} |\n`;f+=`
29
+ `}return f}var m=e((()=>{n(),t(),l(),r(),s()}));export{d as n,m as r,f as t};
@@ -0,0 +1 @@
1
+ import{n as e,r as t,t as n}from"./context-noninteractive-B1V2Mp26.js";t();export{n as call,e as collectContextData};
@@ -0,0 +1 @@
1
+ import{a as e,n as t}from"./rolldown-runtime-DaDcL9Zw.js";import{B as n,Pt as r,Ut as i,Vt as a,dn as o,pn as s,q as c,un as l}from"./state-CXY-q5gr.js";import{Cn as u,En as d,Qn as f,Sg as p,St as m,Tn as h,WC as g,Wn as _,YC as v,Yr as y,_g as b,ai as x,bb as S,ci as C,cw as w,dh as T,gg as E,gr as D,mn as O,ms as k,n_ as A,on as j,ph as M,ps as N,qt as P,t_ as F,tw as I,wg as L,xb as R,yt as z}from"./loadAgentsDir-DR5PVAc3.js";import{o as B,s as V}from"./log-DWZny1vM.js";import{n as H}from"./analytics-COpjZpvd.js";import{n as U,t as W}from"./caches-5xZ4dSXt.js";import{randomUUID as G}from"crypto";async function K({setMessages:t,readFileState:r,discoveredSkillNames:d,loadedNestedMemoryPaths:m,getAppState:S,setAppState:w,setConversationId:E}){let O=j();await P(`clear`,{getAppState:S,setAppState:w,signal:AbortSignal.timeout(O),timeoutMs:O}),n();let M=new Set,N=[],F=e=>`isBackgrounded`in e&&e.isBackgrounded===!1;if(S)for(let e of Object.values(S().tasks))F(e)||k(e)&&(M.add(e.agentId),N.push(e));t(()=>[]);let{setContextBlocked:L}=(g(),e(v));L(!1),E&&E(G()),W(M),l(null),o(null),s(null),i(),R(c()),r.clear(),d?.clear(),m?.clear(),w&&w(e=>{let t={};for(let[n,r]of Object.entries(e.tasks)){if(!F(r)){t[n]=r;continue}try{r.status===`running`&&(b(r)&&(r.shellCommand?.kill(),r.shellCommand?.cleanup(),r.cleanupTimeoutId&&clearTimeout(r.cleanupTimeoutId)),`abortController`in r&&r.abortController?.abort(),`unregisterCleanup`in r&&r.unregisterCleanup?.())}catch(e){V(e)}u(n)}return{...e,tasks:t,attribution:T(),standaloneAgentContext:void 0,fileHistory:{snapshots:[],trackedFiles:new Set,snapshotSequence:0},mcp:{clients:[],tools:[],commands:[],resources:{},pluginReconnectKey:e.mcp.pluginReconnectKey}}}),I(),_(),a({setCurrentAsParent:!0}),await y();for(let e of N)e.status===`running`&&h(e.id,f(p(e.agentId)));let{saveMode:B}=(D(),e(C));B(`normal`);let H=z();H&&x(H);let U=await A(`clear`);U.length>0&&t(()=>U)}var q=t((()=>{r(),H(),N(),E(),L(),M(),O(),B(),w(),S(),F(),D(),d(),m(),U()}));export{q as n,K as t};
@@ -0,0 +1 @@
1
+ import{n as e,t}from"./conversation-CG_z7TLE.js";e();export{t as clearConversation};
@@ -0,0 +1 @@
1
+ import{Pt as e,t}from"./state-CXY-q5gr.js";import{$x as n,Cg as r,Gr as i,Gx as a,Ji as o,Ln as s,Nr as c,Or as l,Zh as u,_a as d,ag as f,br as p,cS as m,cw as h,gr as g,is as _,kr as v,la as y,lr as b,n_ as x,nr as S,oa as C,rs as w,rw as T,t_ as E,ts as D,va as O,wa as k,wg as A,zn as j}from"./loadAgentsDir-DR5PVAc3.js";import{n as M,t as N}from"./cwd-DrEEb4f5.js";import{Rt as P,zt as F}from"./settings-YIDksG5Z.js";import{o as I,s as L}from"./log-DWZny1vM.js";import{relative as R}from"path";M(),e(),A(),F(),D(),f(),I(),o(),h(),E(),g();function z(e){if(e.type!==`attachment`)return e;let t=e.attachment;if(t.type===`new_file`)return{...e,attachment:{...t,type:`file`,displayPath:R(N(),t.filename)}};if(t.type===`new_directory`)return{...e,attachment:{...t,type:`directory`,displayPath:R(N(),t.path)}};if(!(`displayPath`in t)){let n=`filename`in t?t.filename:`path`in t?t.path:`skillDir`in t?t.skillDir:void 0;if(n)return{...e,attachment:{...t,displayPath:R(N(),n)}}}return e}function B(e){return V(e).messages}function V(e){try{let t=e.map(z),r=new Set(P);for(let e of t)e.type===`user`&&e.permissionMode!==void 0&&!r.has(e.permissionMode)&&(e.permissionMode=void 0);let i=C(d(O(t))),o=H(i),s;if(o.kind===`interrupted_turn`){let[e]=y([n({content:`Continue from where you left off.`,isMeta:!0})]);i.push(e),s={kind:`interrupted_prompt`,message:e}}else s=o;let c=i.findLastIndex(e=>e.type!==`system`&&e.type!==`progress`);return c!==-1&&i[c].type===`user`&&i.splice(c+1,0,a({content:m})),{messages:i,turnInterruptionState:s}}catch(e){throw L(e),e}}function H(e){if(e.length===0)return{kind:`none`};let t=e.findLastIndex(e=>e.type!==`system`&&e.type!==`progress`&&!(e.type===`assistant`&&e.isApiErrorMessage)),n=t===-1?void 0:e[t];return!n||n.type===`assistant`?{kind:`none`}:n.type===`user`?n.isMeta||n.isCompactSummary?{kind:`none`}:k(n)?{kind:`interrupted_turn`}:{kind:`interrupted_prompt`,message:n}:n.type===`attachment`?{kind:`interrupted_turn`}:{kind:`none`}}function U(e){for(let n of e)if(n.type===`attachment`){if(n.attachment.type===`invoked_skills`){let e=n.attachment.skills;for(let n of e)n.name&&n.path&&n.content&&t(n.name,n.path,n.content,null)}n.attachment.type===`skill_listing`&&_()}_(),w()}async function W(e){let{messages:t,leafUuids:n}=await c(e),r=null,a=0;for(let e of t.values()){if(e.isSidechain||!n.has(e.uuid))continue;let t=new Date(e.timestamp).getTime();t>a&&(a=t,r=e)}return r?{messages:i(s(t,r)),sessionId:r.sessionId}:{messages:[],sessionId:void 0}}async function G(e,t){try{let n=null,i=null,a;if(e===void 0){let e=v(),t=new Set;try{let{listAllLiveSessions:e}=await import(`./udsClient-CCxgLiZy.js`),n=await e();t=new Set(n.flatMap(e=>e.kind&&e.kind!==`interactive`&&e.sessionId?[e.sessionId]:[]))}catch{}n=(await e).find(e=>{let n=b(e);return!n||!t.has(n)})??null}else if(t){let e=await W(t);i=e.messages,a=e.sessionId}else typeof e==`string`?(n=await S(e),a=e):n=e;if(!n&&!i)return null;n&&(p(n)&&(n=await l(n)),a||(a=b(n)),a&&await T(n,r(a)),u(n),i=n.messages,j(i)),U(i);let o=V(i);i=o.messages;let s=await x(`resume`,{sessionId:a});return i.push(...s),{messages:i,turnInterruptionState:o.turnInterruptionState,fileHistorySnapshots:n?.fileHistorySnapshots,attributionSnapshots:n?.attributionSnapshots,contentReplacements:n?.contentReplacements,contextCollapseCommits:n?.contextCollapseCommits,contextCollapseSnapshot:n?.contextCollapseSnapshot,sessionId:a,agentName:n?.agentName,agentColor:n?.agentColor,agentSetting:n?.agentSetting,customTitle:n?.customTitle,tag:n?.tag,mode:n?.mode,worktreeSession:n?.worktreeSession,prNumber:n?.prNumber,prUrl:n?.prUrl,prRepository:n?.prRepository,fullPath:n?.fullPath,goal:n?.goal}}catch(e){throw L(e),e}}export{G as n,B as t};
@@ -0,0 +1,40 @@
1
+ import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{C as n,D as r,Gr as i,H as a,I as o,P as s,T as c,Wt as l,Xn as u,ai as d,di as f,fi as p,hn as m,k as ee,oi as te,ot as ne,p as h,t as g}from"./src-WZ94ZKI3.js";import{t as _}from"./jsx-runtime-Bb4Xn-E0.js";import{Pt as v,at as re,q as ie}from"./state-CXY-q5gr.js";import{Dc as y,Or as ae,Tb as b,Tc as oe,bi as x,br as S,ei as se,gr as ce,hd as le,lr as C,md as w,sb as ue,tb as T,tr as de,vS as fe,vr as pe,wb as me,yS as he,yi as ge}from"./loadAgentsDir-DR5PVAc3.js";import{S as E,c as D,i as O,x as _e}from"./debug-kBjDaVkQ.js";import{Bn as ve,Dr as ye,Pr as be,zn as k}from"./settings-YIDksG5Z.js";import{a as A,o as xe,s as Se}from"./log-DWZny1vM.js";import{n as Ce}from"./analytics-COpjZpvd.js";import{S as we,_ as j,d as Te,p as Ee}from"./startupProfiler-DIM_Ihyp.js";import{f as De,u as Oe}from"./model-D42epddJ.js";import{n as M,t as ke}from"./TextInput-BboKIug2.js";import{n as Ae,t as N}from"./useExitOnCtrlCDWithKeybindings-BgJrnuDl.js";import{n as je,t as Me}from"./select-FrwoTzuc.js";import{r as Ne,t as Pe}from"./Spinner-DhhSOFcN.js";import{l as Fe,u as Ie}from"./SpinnerGlyph-CmVXC-_9.js";import{t as Le}from"./SearchBox-DQBLKyzJ.js";import{n as Re,t as ze}from"./useSearchInput-BITV_Txn.js";import{n as P,t as F}from"./Messages-CxMsfjOa.js";function Be({log:e,onExit:t,onSelect:n}){let[i,a]=I.useState(null);I.useEffect(()=>{a(null),S(e)&&ae(e).then(a)},[e]);let u=S(e)&&i===null,d=i??e,f=C(d)||``,p=oe();return l(`confirm:no`,t,{context:`Confirmation`}),l(`confirm:yes`,(0,I.useCallback)(()=>{n(i??e)},[n,i,e]),{context:`Confirmation`}),u?(0,L.jsxs)(o,{flexDirection:`column`,padding:1,children:[(0,L.jsx)(h,{message:`Loading session…`}),(0,L.jsx)(s,{dimColor:!0,children:(0,L.jsx)(c,{children:(0,L.jsx)(w,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})})})]}):(0,L.jsxs)(o,{flexDirection:`column`,children:[(0,L.jsx)(F,{messages:d.messages,tools:p,commands:[],verbose:!0,toolJSX:null,toolUseConfirmQueue:[],inProgressToolUseIDs:new Set,isMessageSelectorVisible:!1,conversationId:f,screen:`transcript`,streamingToolUses:[],showAllInTranscript:!0,isLoading:!1}),(0,L.jsxs)(o,{flexShrink:0,flexDirection:`column`,borderTopDimColor:!0,borderBottom:!1,borderLeft:!1,borderRight:!1,borderStyle:`single`,paddingLeft:2,children:[(0,L.jsxs)(s,{children:[Ee(d.modified),` · `,d.messageCount,` messages`,d.gitBranch?` · ${d.gitBranch}`:``]}),(0,L.jsx)(s,{dimColor:!0,children:(0,L.jsxs)(c,{children:[(0,L.jsx)(r,{shortcut:`Enter`,action:`resume`}),(0,L.jsx)(w,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})]})})]})]})}var I,L,Ve=e((()=>{I=t(d(),1),g(),T(),y(),j(),ce(),le(),P(),L=_()}));function R(e,t){if(e===B)return 5;let n=i(e),r=t?Math.min(n,t-V-H):n;return Math.max(0,r)+V+H}function He(e,t){let n=t-V-H;return i(e)<=n?e:n<=1?e.charAt(0):we(e,n)}function Ue({tabs:e,selectedIndex:t,availableWidth:n,showAllProjects:r=!1}){let i=r?`Resume (All Projects)`:`Resume`,a=i.length+1,c=Math.max(Je,W),l=n-a-c-2,u=Math.max(0,Math.min(t,e.length-1)),d=Math.max(20,Math.floor(l/2)),f=e.map(e=>R(e,d)),p=0,m=e.length;if(f.reduce((e,t,n)=>e+t+ +(n<f.length-1),0)>l){let t=l-qe,n=f[u]??0;for(p=u,m=u+1;p>0||m<e.length;){let r=p>0,i=m<e.length;if(r){let e=(f[p-1]??0)+1;if(n+e<=t){p--,n+=e;continue}}if(i){let e=(f[m]??0)+1;if(n+e<=t){m++,n+=e;continue}}break}}let ee=p,te=e.length-m,ne=e.slice(p,m),h=ne.map((e,t)=>p+t);return(0,z.jsxs)(o,{flexDirection:`row`,gap:1,children:[(0,z.jsx)(s,{color:`suggestion`,children:i}),ee>0&&(0,z.jsxs)(s,{dimColor:!0,children:[U,ee]}),ne.map((e,t)=>{let n=h[t]===u,r=e===B?e:`#${He(e,d-V)}`;return(0,z.jsxs)(s,{backgroundColor:n?`suggestion`:void 0,color:n?`inverseText`:void 0,bold:n,children:[` `,r,` `]},e)}),te>0?(0,z.jsxs)(s,{dimColor:!0,children:[We,te,Ge]}):(0,z.jsx)(s,{dimColor:!0,children:Ke})]})}var z,B,V,H,U,We,Ge,Ke,qe,Je,W,G=e((()=>{g(),j(),z=_(),B=`All`,V=2,H=1,U=`← `,We=`→`,Ge=` (tab to cycle)`,Ke=`(tab to cycle)`,qe=5,Je=18,W=14}));function Ye({nodes:e,onSelect:t,onCancel:n,onFocus:r,focusNodeId:i,visibleOptionCount:a,layout:s=`expanded`,isDisabled:c=!1,hideIndexes:l=!1,isNodeExpanded:u,onExpand:d,onCollapse:f,getParentPrefix:p,getChildPrefix:m,onUpFromFirstItem:ee}){let[te,ne]=K.useState(new Set),h=K.useRef(!1),g=K.useRef(null),_=K.useCallback(e=>u?u(e):te.has(e),[u,te]),v=K.useMemo(()=>{let t=[];function n(e,r,i){let a=!!e.children&&e.children.length>0,o=_(e.id);if(t.push({node:e,depth:r,isExpanded:o,hasChildren:a,parentId:i}),a&&o&&e.children)for(let t of e.children)n(t,r+1,e.id)}for(let t of e)n(t,0);return t},[e,_]),re=K.useCallback(e=>e?`▼ `:`▶ `,[]),ie=K.useCallback(e=>` ▸ `,[]),y=p??re,ae=m??ie,b=K.useCallback(e=>{let t=``;return e.hasChildren?t=y(e.isExpanded):e.depth>0&&(t=ae(e.depth)),t+e.node.label},[y,ae]),oe=K.useMemo(()=>v.map(e=>({label:b(e),description:e.node.description,dimDescription:e.node.dimDescription??!0,value:e.node.id})),[v,b]),x=K.useMemo(()=>{let e=new Map;return v.forEach(t=>e.set(t.node.id,t.node)),e},[v]),S=K.useCallback(e=>v.find(t=>t.node.id===e),[v]),se=K.useCallback((e,t)=>{S(e)?.hasChildren&&(t?d?d(e):ne(t=>new Set(t).add(e)):f?f(e):ne(t=>{let n=new Set(t);return n.delete(e),n}))},[S,d,f]);return(0,Xe.jsx)(o,{tabIndex:0,autoFocus:!0,onKeyDown:e=>{if(!i||c)return;let t=S(i);if(t){if(e.key===`right`&&t.hasChildren)e.preventDefault(),se(i,!0);else if(e.key===`left`){if(t.hasChildren&&t.isExpanded)e.preventDefault(),se(i,!1);else if(t.parentId!==void 0&&(e.preventDefault(),h.current=!0,se(t.parentId,!1),r)){let e=x.get(t.parentId);e&&r(e)}}}},children:(0,Xe.jsx)(Me,{options:oe,onChange:K.useCallback(e=>{let n=x.get(e);n&&t(n)},[x,t]),onFocus:K.useCallback(e=>{if(h.current){h.current=!1;return}if(g.current!==e&&(g.current=e,r)){let t=x.get(e);t&&r(t)}},[r,x]),onCancel:n,defaultFocusValue:i,visibleOptionCount:a,layout:s,isDisabled:c,hideIndexes:l,onUpFromFirstItem:ee})})}var K,Xe,Ze=e((()=>{K=t(d(),1),g(),je(),Xe=_()}));function Qe(e,t){return we(e.replace(/\s+/g,` `).trim(),t)}function $e({before:e,match:t,after:n},r){return f.dim(e)+r(t)+f.dim(n)}function et(e,t,n){let r=e.toLowerCase().indexOf(t.toLowerCase());if(r===-1)return null;let i=r+t.length,a=Math.max(0,r-n),o=Math.min(e.length,i+n),s=e.slice(a,r),c=e.slice(r,i),l=e.slice(i,o);return{before:(a>0?`…`:``)+s.replace(/\s+/g,` `).trimStart(),match:c.trim(),after:l.replace(/\s+/g,` `).trimEnd()+(o<e.length?`…`:``)}}function tt(e,t,n){let{isGroupHeader:r=!1,isChild:i=!1,forkCount:a=0}=n||{},o=r&&a>0?ct:i?lt:0,s=r&&a>0?` (+${a} other ${a===1?`session`:`sessions`})`:``,c=e.isSidechain?` (sidechain)`:``,l=t-o-c.length-s.length;return`${Qe(A(e),l)}${c}${s}`}function nt(e,t){let{isChild:n=!1,showProjectPath:r=!1}=t||{},i=n?` `:``,a=Te(e),o=r&&e.projectPath?` · ${e.projectPath}`:``;return i+a+o}function rt({logs:e,maxHeight:t=1/0,forceWidth:i,onCancel:d,onSelect:f,onLogsChanged:p,onLoadMore:h,initialSearchQuery:g,showAllProjects:_=!1,onToggleAllProjects:v,onAgenticSearch:y}){let ae=ne(),b=i===void 0?ae.columns:i,oe=Ae(d),x=u(),S=pe(),[ce]=a(),le=Fe(ce),ue=q.useMemo(()=>e=>te(e,le.warning),[le.warning]),[T,fe]=q.useState(null),[me,he]=q.useState(!1),[E,D]=q.useState(!1),[O,_e]=q.useState(!1),ve=q.useMemo(()=>ie(),[]),[be,k]=q.useState(``),[xe,Se]=q.useState(0),[Ce,we]=q.useState(new Set),[j,Ee]=q.useState(null),[De,Oe]=q.useState(1),[M,N]=q.useState(`list`),[je,Ne]=q.useState(null),Ie=q.useRef(null),[Le,ze]=q.useState(0),[P,F]=q.useState({status:`idle`}),[I,L]=q.useState(!1),Ve=q.useRef(null),{query:R,setQuery:He,cursorOffset:z}=Re({isActive:M===`search`&&P.status!==`searching`,onExit:()=>{N(`list`)},onExitUp:()=>{N(`list`)},passthroughCtrlKeys:[`n`],initialQuery:g||``}),B=q.useDeferredValue(R),[V,H]=q.useState(``);q.useEffect(()=>{if(!B){H(``);return}let e=setTimeout(H,300,B);return()=>clearTimeout(e)},[B]);let[U,We]=q.useState(null),[Ge,Ke]=q.useState(!1);q.useEffect(()=>{ye().then(e=>fe(e)),ge(ve).then(e=>{_e(e.length>1)})},[ve]);let qe=q.useMemo(()=>new Map(e.map(e=>[e,at(e)])),[e]),Je=q.useMemo(()=>null,[e,qe,!1]),W=q.useMemo(()=>st(e),[e]),G=W.length>0,K=q.useMemo(()=>G?[`All`,...W]:[],[G,W]),Xe=K.length>0&&Le<K.length?Le:0,Ze=K[Xe],rt=Ze===`All`?void 0:Ze,it=+!!G,ct=q.useMemo(()=>{let t=e;return S&&(t=e.filter(e=>{let t=re(),n=C(e);return!!(t&&n===t||e.customTitle||de(e.messages)||e.firstPrompt||e.customTitle)})),rt!==void 0&&(t=t.filter(e=>e.tag===rt)),me&&T&&(t=t.filter(e=>e.gitBranch===T)),O&&!E&&(t=t.filter(e=>e.projectPath===ve)),t},[e,S,rt,me,T,O,E,ve]),lt=q.useMemo(()=>{if(!R)return ct;let e=R.toLowerCase();return ct.filter(t=>{let n=A(t).toLowerCase(),r=(t.gitBranch||``).toLowerCase(),i=(t.tag||``).toLowerCase(),a=t.prNumber?`pr #${t.prNumber} ${t.prRepository||``}`.toLowerCase():``;return n.includes(e)||r.includes(e)||i.includes(e)||a.includes(e)})},[ct,R]);q.useEffect(()=>{},[B,V,!1]),q.useEffect(()=>{We(null),Ke(!1)},[V,Je,!1]);let{filteredLogs:ut,snippets:Y}=q.useMemo(()=>{let e=new Map,t=lt;if(U&&V&&U.query===V){for(let t of U.results)if(t.searchableText){let n=et(t.searchableText,V,dt);n&&e.set(t.log,n)}let n=new Set(t.map(e=>e.messages[0]?.uuid)),r=U.results.map(e=>e.log).filter(e=>!n.has(e.messages[0]?.uuid));t=[...t,...r]}return{filteredLogs:t,snippets:e}},[lt,U,V]),X=q.useMemo(()=>P.status===`results`&&P.results.length>0?P.results:ut,[P,ut]),Z=Math.max(30,b-4),ft=q.useMemo(()=>{if(!S)return[];let e=ot(X);return Array.from(e.entries()).map(([e,t])=>{let n=t[0],r=X.indexOf(n),i=Y.get(n),a=i?$e(i,ue):null;if(t.length===1){let t=nt(n,{showProjectPath:_});return{id:`log:${e}:0`,value:{log:n,indexInFiltered:r},label:tt(n,Z),description:a?`${t}\n ${a}`:t,dimDescription:!0}}let o=t.length-1,s=t.slice(1).map((t,n)=>{let r=X.indexOf(t),i=Y.get(t),a=i?$e(i,ue):null,o=nt(t,{isChild:!0,showProjectPath:_});return{id:`log:${e}:${n+1}`,value:{log:t,indexInFiltered:r},label:tt(t,Z,{isChild:!0}),description:a?`${o}\n ${a}`:o,dimDescription:!0}}),c=nt(n,{showProjectPath:_});return{id:`group:${e}`,value:{log:n,indexInFiltered:r},label:tt(n,Z,{isGroupHeader:!0,forkCount:o}),description:a?`${c}\n ${a}`:c,dimDescription:!0,children:s}})},[S,X,Z,_,Y,ue]),pt=q.useMemo(()=>S?[]:X.map((e,t)=>{let n=Qe(A(e)+(e.isSidechain?` (sidechain)`:``),Z),r=Te(e),i=_&&e.projectPath?` · ${e.projectPath}`:``,a=Y.get(e),o=a?$e(a,ue):null;return{label:n,description:o?`${r}${i}\n ${o}`:r+i,dimDescription:!0,value:t.toString()}}),[S,X,ue,Z,_,Y]),Q=j?.value.log??null,mt=()=>{if(!S||!Q)return``;let e=C(Q);if(!e)return``;let t=X.filter(t=>C(t)===e);if(!(t.length>1))return``;let n=Ce.has(e);return t.indexOf(Q)>0||n?`← to collapse`:`→ to expand`},ht=q.useCallback(async()=>{let e=Q?C(Q):void 0;if(!Q||!e){N(`list`),k(``);return}be.trim()&&(await se(e,be.trim(),Q.fullPath),S&&p&&p()),N(`list`),k(``)},[Q,be,p,S]),gt=q.useCallback(()=>{N(`list`)},[]),_t=q.useCallback(()=>{N(`search`)},[]),vt=q.useCallback(async()=>{if(!R.trim()||!y||!0)return;Ve.current?.abort();let t=new AbortController;Ve.current=t,F({status:`searching`}),R.length;try{let n=await y(R,e,t.signal);if(t.signal.aborted)return;F({status:`results`,results:n,query:R}),R.length,n.length}catch(e){if(t.signal.aborted)return;F({status:`error`,message:e instanceof Error?e.message:`Search failed`}),R.length}},[R,y,!1,e]);q.useEffect(()=>{P.status!==`idle`&&P.status!==`searching`&&(P.status===`results`&&P.query!==R||P.status===`error`)&&F({status:`idle`})},[R,P]),q.useEffect(()=>()=>{Ve.current?.abort()},[]);let yt=q.useRef(P.status);q.useEffect(()=>{let e=yt.current;if(yt.current=P.status,e===`searching`&&P.status===`results`){if(S&&ft.length>0)Ee(ft[0]);else if(!S&&X.length>0){let e=X[0];Ee({id:`0`,value:{log:e,indexInFiltered:0},label:``})}}},[P.status,S,ft,X]);let bt=q.useCallback(e=>{let t=parseInt(e,10),n=X[t];!n||Ie.current===t.toString()||(Ie.current=t.toString(),Ee({id:t.toString(),value:{log:n,indexInFiltered:t},label:``}),Oe(t+1))},[X]),xt=q.useCallback(e=>{Ee(e);let t=X.findIndex(t=>C(t)===C(e.value.log));t>=0&&Oe(t+1)},[X]);l(`confirm:no`,()=>{Ve.current?.abort(),F({status:`idle`})},{context:`Confirmation`,isActive:M!==`preview`&&P.status===`searching`}),l(`confirm:no`,()=>{N(`list`),k(``)},{context:`Settings`,isActive:M===`rename`&&P.status!==`searching`}),l(`confirm:no`,()=>{He(``),L(!1),d?.()},{context:`Confirmation`,isActive:M!==`preview`&&M!==`rename`&&M!==`search`&&I&&P.status!==`searching`}),m((e,t)=>{if(M!==`preview`&&P.status!==`searching`&&M!==`rename`)if(M===`search`)e.toLowerCase()===`n`&&t.ctrl?gt():(t.return||t.downArrow)&&R.trim();else{if(I){if(t.return){vt(),L(!1);return}else if(t.downArrow){L(!1);return}else if(t.upArrow){N(`search`),L(!1);return}}if(G&&t.tab){let e=t.shift?-1:1;ze(t=>{let n=((t<K.length?t:0)+K.length+e)%K.length;return K[n],W.length,n});return}let n=!t.ctrl&&!t.meta,r=e.toLowerCase();r===`a`&&t.ctrl&&v?v():r===`b`&&t.ctrl?he(!me):r===`w`&&t.ctrl&&O?D(!E):r===`/`&&n?N(`search`):r===`r`&&t.ctrl&&Q?(N(`rename`),k(``)):r===`v`&&t.ctrl&&Q?(Ne(Q),N(`preview`),Q.messageCount):Q&&n&&e.length>0&&!/^\s+$/.test(e)&&(N(`search`),He(e))}},{isActive:!0});let St=[];me&&T&&St.push(T),O&&!E&&St.push(`current worktree`);let Ct=8+ +(St.length>0&&M!==`search`)+it,$=Math.max(1,Math.floor((t-Ct-2)/3));return q.useEffect(()=>{if(!h)return;let e=$*2;De+e>=X.length&&h($*3)},[De,$,X.length,h]),e.length===0?null:M===`preview`&&je&&S?(0,J.jsx)(Be,{log:je,onExit:()=>{N(`list`),Ne(null)},onSelect:f}):(0,J.jsxs)(o,{flexDirection:`column`,height:t-1,children:[(0,J.jsx)(o,{flexShrink:0,children:(0,J.jsx)(n,{color:`suggestion`})}),(0,J.jsx)(o,{flexShrink:0,children:(0,J.jsx)(s,{children:` `})}),G?(0,J.jsx)(Ue,{tabs:K,selectedIndex:Xe,availableWidth:b,showAllProjects:_}):(0,J.jsx)(o,{flexShrink:0,children:(0,J.jsxs)(s,{bold:!0,color:`suggestion`,children:[`Resume Session`,M===`list`&&X.length>$&&(0,J.jsxs)(s,{dimColor:!0,children:[` `,`(`,De,` of `,X.length,`)`]})]})}),(0,J.jsx)(ee,{query:R,isFocused:M===`search`,isTerminalFocused:x,cursorOffset:z}),St.length>0&&M!==`search`&&(0,J.jsx)(o,{flexShrink:0,paddingLeft:2,children:(0,J.jsx)(s,{dimColor:!0,children:(0,J.jsx)(c,{children:St})})}),(0,J.jsx)(o,{flexShrink:0,children:(0,J.jsx)(s,{children:` `})}),P.status===`searching`&&(0,J.jsxs)(o,{paddingLeft:1,flexShrink:0,children:[(0,J.jsx)(Pe,{}),(0,J.jsx)(s,{children:` Searching…`})]}),P.status===`results`&&P.results.length>0&&(0,J.jsx)(o,{paddingLeft:1,marginBottom:1,flexShrink:0,children:(0,J.jsx)(s,{dimColor:!0,italic:!0,children:`Work Mate found these results:`})}),P.status===`results`&&P.results.length===0&&ut.length===0&&(0,J.jsx)(o,{paddingLeft:1,marginBottom:1,flexShrink:0,children:(0,J.jsx)(s,{dimColor:!0,italic:!0,children:`No matching sessions found.`})}),P.status===`error`&&ut.length===0&&(0,J.jsx)(o,{paddingLeft:1,marginBottom:1,flexShrink:0,children:(0,J.jsx)(s,{dimColor:!0,italic:!0,children:`No matching sessions found.`})}),!!R.trim()&&y&&!1,P.status===`searching`?null:M===`rename`&&Q?(0,J.jsxs)(o,{paddingLeft:2,flexDirection:`column`,children:[(0,J.jsx)(s,{bold:!0,children:`Rename session:`}),(0,J.jsx)(o,{paddingTop:1,children:(0,J.jsx)(ke,{value:be,onChange:k,onSubmit:ht,placeholder:A(Q,`Enter new session name`),columns:b,cursorOffset:xe,onChangeCursorOffset:Se,showCursor:!0})})]}):S?(0,J.jsx)(Ye,{nodes:ft,onSelect:e=>{f(e.value.log)},onFocus:xt,onCancel:d,focusNodeId:j?.id,visibleOptionCount:$,layout:`expanded`,isDisabled:M===`search`||I,hideIndexes:!1,isNodeExpanded:e=>{if(M===`search`||me)return!0;let t=typeof e==`string`&&e.startsWith(`group:`)?e.substring(6):null;return t?Ce.has(t):!1},onExpand:e=>{let t=typeof e==`string`&&e.startsWith(`group:`)?e.substring(6):null;t&&we(e=>new Set(e).add(t))},onCollapse:e=>{let t=typeof e==`string`&&e.startsWith(`group:`)?e.substring(6):null;t&&we(e=>{let n=new Set(e);return n.delete(t),n})},onUpFromFirstItem:_t}):(0,J.jsx)(Me,{options:pt,onChange:e=>{let t=X[parseInt(e,10)];t&&f(t)},visibleOptionCount:$,onCancel:d,onFocus:bt,defaultFocusValue:j?.id.toString(),layout:`expanded`,isDisabled:M===`search`||I,onUpFromFirstItem:_t}),(0,J.jsx)(o,{paddingLeft:2,children:oe.pending?(0,J.jsxs)(s,{dimColor:!0,children:[`Press `,oe.keyName,` again to exit`]}):M===`rename`?(0,J.jsx)(s,{dimColor:!0,children:(0,J.jsxs)(c,{children:[(0,J.jsx)(r,{shortcut:`Enter`,action:`save`}),(0,J.jsx)(w,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})]})}):P.status===`searching`?(0,J.jsx)(s,{dimColor:!0,children:(0,J.jsxs)(c,{children:[(0,J.jsx)(s,{children:`Searching with Work Mate…`}),(0,J.jsx)(w,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})]})}):I?(0,J.jsx)(s,{dimColor:!0,children:(0,J.jsxs)(c,{children:[(0,J.jsx)(r,{shortcut:`Enter`,action:`search`}),(0,J.jsx)(r,{shortcut:`↓`,action:`skip`}),(0,J.jsx)(w,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})]})}):M===`search`?(0,J.jsx)(s,{dimColor:!0,children:(0,J.jsxs)(c,{children:[(0,J.jsx)(s,{children:`Type to Search`}),(0,J.jsx)(r,{shortcut:`Enter`,action:`select`}),(0,J.jsx)(w,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`clear`})]})}):(0,J.jsx)(s,{dimColor:!0,children:(0,J.jsxs)(c,{children:[v&&(0,J.jsx)(r,{shortcut:`Ctrl+A`,action:`show ${_?`current dir`:`all projects`}`}),T&&(0,J.jsx)(r,{shortcut:`Ctrl+B`,action:`toggle branch`}),O&&(0,J.jsx)(r,{shortcut:`Ctrl+W`,action:`show ${E?`current worktree`:`all worktrees`}`}),(0,J.jsx)(r,{shortcut:`Ctrl+V`,action:`preview`}),(0,J.jsx)(r,{shortcut:`Ctrl+R`,action:`rename`}),(0,J.jsx)(s,{children:`Type to search`}),(0,J.jsx)(w,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`}),mt()&&(0,J.jsx)(s,{children:mt()})]})})})]})}function it(e){if(e.type!==`user`&&e.type!==`assistant`)return``;let t=`message`in e?e.message?.content:void 0;return t?typeof t==`string`?t:Array.isArray(t)?t.map(e=>typeof e==`string`?e:`text`in e&&typeof e.text==`string`?e.text:``).filter(Boolean).join(` `):``:``}function at(e){let t=(e.messages.length<=ut?e.messages:[...e.messages.slice(0,Y),...e.messages.slice(-1e3)]).map(it).filter(Boolean).join(` `),n=`${[e.customTitle,e.summary,e.firstPrompt,e.gitBranch,e.tag,e.prNumber?`PR #${e.prNumber}`:void 0,e.prRepository].filter(Boolean).join(` `)} ${t}`.trim();return n.length>X?n.slice(0,X):n}function ot(e){let t=new Map;for(let n of e){let e=C(n);if(e){let r=t.get(e);r?r.push(n):t.set(e,[n])}}return t.forEach(e=>e.sort((e,t)=>new Date(t.modified).getTime()-new Date(e.modified).getTime())),t}function st(e){let t=new Set;for(let n of e)n.tag&&t.add(n.tag);return Array.from(t).sort((e,t)=>e.localeCompare(t))}var q,J,ct,lt,ut,Y,X,dt,Z=e((()=>{p(),q=t(d(),1),v(),N(),ze(),ue(),g(),T(),Ce(),j(),x(),be(),xe(),ce(),Ie(),le(),je(),Le(),Ve(),Ne(),G(),M(),Ze(),J=_(),ct=2,lt=4,ut=2e3,Y=1e3,X=5e4,dt=50}));function ft(e){if(e.type!==`user`&&e.type!==`assistant`)return``;let t=`message`in e?e.message?.content:void 0;return t?typeof t==`string`?t:Array.isArray(t)?t.map(e=>typeof e==`string`?e:`text`in e&&typeof e.text==`string`?e.text:``).filter(Boolean).join(` `):``:``}function pt(e){if(e.length===0)return``;let t=(e.length<=gt?e:[...e.slice(0,gt/2),...e.slice(-100/2)]).map(ft).filter(Boolean).join(` `).replace(/\s+/g,` `).trim();return t.length>ht?`${t.slice(0,ht)}…`:t}function Q(e,t){return!!(A(e).toLowerCase().includes(t)||e.customTitle?.toLowerCase().includes(t)||e.tag?.toLowerCase().includes(t)||e.gitBranch?.toLowerCase().includes(t)||e.summary?.toLowerCase().includes(t)||e.firstPrompt?.toLowerCase().includes(t)||e.messages&&e.messages.length>0&&pt(e.messages).toLowerCase().includes(t))}async function mt(e,t,n){if(!e.trim()||t.length===0)return[];let r=e.toLowerCase(),i=t.filter(e=>Q(e,r)),a;if(i.length>=_t)a=i.slice(0,_t);else{let e=t.filter(e=>!Q(e,r)),n=_t-i.length;a=[...i,...e.slice(0,n)]}D(`Agentic search: ${a.length}/${t.length} logs, query="${e}", matching: ${i.length}, with messages: ${k(a,e=>e.messages?.length>0)}`);let o=a.map(async e=>{if(S(e))try{return await ae(e)}catch(t){return Se(t),e}return e}),s=await Promise.all(o);D(`Agentic search: loaded ${k(s,e=>e.messages?.length>0)}/${a.length} logs with transcripts`);let c=`Sessions:
2
+ ${s.map((e,t)=>{let n=[`${t}:`],r=A(e);if(n.push(r),e.customTitle&&e.customTitle!==r&&n.push(`[custom title: ${e.customTitle}]`),e.tag&&n.push(`[tag: ${e.tag}]`),e.gitBranch&&n.push(`[branch: ${e.gitBranch}]`),e.summary&&n.push(`- Summary: ${e.summary}`),e.firstPrompt&&e.firstPrompt!==`No prompt`&&n.push(`- First message: ${e.firstPrompt.slice(0,300)}`),e.messages&&e.messages.length>0){let t=pt(e.messages);t&&n.push(`- Transcript: ${t}`)}return n.join(` `)}).join(`
3
+ `)}
4
+
5
+ Search query: "${e}"
6
+
7
+ Find the sessions that are most relevant to this query.`;D(`Agentic search prompt (first 500 chars): ${c.slice(0,500)}...`);try{let e=Oe();D(`Agentic search using model: ${e}`);let t=(await he({model:e,system:vt,messages:[{role:`user`,content:c}],signal:n,querySource:`session_search`})).content.find(e=>e.type===`text`);if(t?.type!==`text`)return D(`No text content in agentic search response`),[];D(`Agentic search response: ${t.text}`);let r=t.text.match(/\{[\s\S]*\}/);if(!r)return D(`Could not find JSON in agentic search response`),[];let i=(E(r[0]).relevant_indices||[]).filter(e=>e>=0&&e<s.length).map(e=>s[e]);return D(`Agentic search found ${i.length} relevant sessions`),i}catch(e){return Se(e),D(`Agentic search error: ${e}`),[]}}var ht,gt,_t,vt,yt=e((()=>{ve(),O(),xe(),De(),ce(),fe(),_e(),ht=2e3,gt=100,_t=100,vt=`Your goal is to find relevant sessions based on a user's search query.
8
+
9
+ You will be given a list of sessions with their metadata and a search query. Identify which sessions are most relevant to the query.
10
+
11
+ Each session may include:
12
+ - Title (display name or custom title)
13
+ - Tag (user-assigned category, shown as [tag: name] - users tag sessions with /tag command to categorize them)
14
+ - Branch (git branch name, shown as [branch: name])
15
+ - Summary (AI-generated summary)
16
+ - First message (beginning of the conversation)
17
+ - Transcript (excerpt of conversation content)
18
+
19
+ IMPORTANT: Tags are user-assigned labels that indicate the session's topic or category. If the query matches a tag exactly or partially, those sessions should be highly prioritized.
20
+
21
+ For each session, consider (in order of priority):
22
+ 1. Exact tag matches (highest priority - user explicitly categorized this session)
23
+ 2. Partial tag matches or tag-related terms
24
+ 3. Title matches (custom titles or first message content)
25
+ 4. Branch name matches
26
+ 5. Summary and transcript content matches
27
+ 6. Semantic similarity and related concepts
28
+
29
+ CRITICAL: Be VERY inclusive in your matching. Include sessions that:
30
+ - Contain the query term anywhere in any field
31
+ - Are semantically related to the query (e.g., "testing" matches sessions about "tests", "unit tests", "QA", etc.)
32
+ - Discuss topics that could be related to the query
33
+ - Have transcripts that mention the concept even in passing
34
+
35
+ When in doubt, INCLUDE the session. It's better to return too many results than too few. The user can easily scan through results, but missing relevant sessions is frustrating.
36
+
37
+ Return sessions ordered by relevance (most relevant first). If truly no sessions have ANY connection to the query, return an empty array - but this should be rare.
38
+
39
+ Respond with ONLY the JSON object, no markdown formatting:
40
+ {"relevant_indices": [2, 5, 0]}`}));function bt(e,t){let n=ie();if(!t||!e.projectPath||e.projectPath===n)return{isCrossProject:!1};let r=C(e);return{isCrossProject:!0,isSameRepoWorktree:!1,command:`cd ${b([e.projectPath])} && claude --resume ${r}`,projectPath:e.projectPath}}var xt=e((()=>{v(),me(),ce()}));export{rt as a,yt as i,xt as n,Z as o,mt as r,bt as t};
@@ -0,0 +1 @@
1
+ import{n as e,t}from"./cwd-DrEEb4f5.js";e();export{t as getCwd};
@@ -0,0 +1 @@
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{Pt as t,T as n,q as r}from"./state-CXY-q5gr.js";import{AsyncLocalStorage as i}from"async_hooks";function a(e,t){return c.run(e,t)}function o(){return c.getStore()??n()}function s(){try{return o()}catch{return r()}}var c,l=e((()=>{t(),c=new i}));export{a as i,l as n,o as r,s as t};