@readmagic/workmate 0.0.22 → 0.0.23

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 (394) hide show
  1. package/dist/chunks/{AddWorkspaceDirectory-DWgTWJ7R.js → AddWorkspaceDirectory-OgcBcK5A.js} +1 -1
  2. package/dist/chunks/AgentsMdExternalIncludesDialog-CDNd5-7E.js +1 -0
  3. package/dist/chunks/{AgentsMdExternalIncludesDialog-s0Orgord.js → AgentsMdExternalIncludesDialog-CNEifEyV.js} +1 -1
  4. package/dist/chunks/App-B-3tPQ3k.js +1 -0
  5. package/dist/chunks/BackgroundTasksDialog-COuhHcey.js +2 -0
  6. package/dist/chunks/{BypassPermissionsModeDialog-D2Gesf-u.js → BypassPermissionsModeDialog-bJek4siJ.js} +1 -1
  7. package/dist/chunks/CustomSelect-DoeEXOIP.js +1 -0
  8. package/dist/chunks/{DiffDialog-v2IiYyi3.js → DiffDialog-B3X9FMpO.js} +5 -5
  9. package/dist/chunks/Doctor-6PXyjIi6.js +3 -0
  10. package/dist/chunks/Doctor-DNgkgYhB.js +1 -0
  11. package/dist/chunks/{ExitFlow-BasHk1mk.js → ExitFlow-DgAZp_8U.js} +2 -2
  12. package/dist/chunks/Grove-CHatOzcE.js +11 -0
  13. package/dist/chunks/{InvalidConfigDialog-DYVQK5js.js → InvalidConfigDialog-DXL92MN9.js} +1 -1
  14. package/dist/chunks/{InvalidSettingsDialog-Dg6OiStR.js → InvalidSettingsDialog-Dtmpzeps.js} +1 -1
  15. package/dist/chunks/{KeybindingProviderSetup-Bn1jzN5F.js → KeybindingProviderSetup-DA37QUFs.js} +1 -1
  16. package/dist/chunks/MCPConnectionManager-thZd-xA_.js +1 -0
  17. package/dist/chunks/MCPToolListView-CpY-YJg4.js +1 -0
  18. package/dist/chunks/{McpParsingWarnings-DZejAh8b.js → McpParsingWarnings-JvChf3xr.js} +1 -1
  19. package/dist/chunks/MessageSelector-C0_iw7SI.js +3 -0
  20. package/dist/chunks/Messages-K4DDsDP9.js +10 -0
  21. package/dist/chunks/Onboarding-C1UdzM-1.js +1 -0
  22. package/dist/chunks/{PromptInputFooterSuggestions-lkr_A5jQ.js → PromptInputFooterSuggestions-AyLog8p7.js} +1 -1
  23. package/dist/chunks/{PromptInputHelpMenu-DaQKKyM5.js → PromptInputHelpMenu-oyic20ip.js} +1 -1
  24. package/dist/chunks/ProviderSetup-XcBHjUnd.js +1 -0
  25. package/dist/chunks/QueryEngine-DYxBjJ4i.js +1 -0
  26. package/dist/chunks/REPL-CQBJRrT0.js +124 -0
  27. package/dist/chunks/REPL-CrVuMQY2.js +1 -0
  28. package/dist/chunks/ResumeConversation-Dl8H9Gfy.js +1 -0
  29. package/dist/chunks/SearchExtraToolsTool-lv7VE50N.js +1 -0
  30. package/dist/chunks/{SelectMulti-CNE06VAN.js → SelectMulti-Bc6l11_K.js} +1 -1
  31. package/dist/chunks/Settings-TGp3fPrS.js +3 -0
  32. package/dist/chunks/Spinner-zYPFVFHN.js +1 -0
  33. package/dist/chunks/{SpinnerGlyph-A6G-gloN.js → SpinnerGlyph-CmkRUvHe.js} +1 -1
  34. package/dist/chunks/{TextInput-7uqPhq9T.js → TextInput-CD9iau2k.js} +5 -5
  35. package/dist/chunks/{ThemePicker-DT9zVy-0.js → ThemePicker-0F0hZYPX.js} +1 -1
  36. package/dist/chunks/TrustDialog-C76YiMKz.js +1 -0
  37. package/dist/chunks/{ValidationErrorsList-BLtP647v.js → ValidationErrorsList-DgNzJQUP.js} +1 -1
  38. package/dist/chunks/_baseEach-4ff-vRlp.js +1 -0
  39. package/dist/chunks/add-dir-JMsRLGfx.js +1 -0
  40. package/dist/chunks/{agentDisplay-vLQHFrmq.js → agentDisplay-BReJUBWg.js} +1 -1
  41. package/dist/chunks/agents-9qQ8I6zW.js +101 -0
  42. package/dist/chunks/{agents-DLz0kfsr.js → agents-B3x8yJ_r.js} +1 -1
  43. package/dist/chunks/allErrors-DfWylHSw.js +1 -0
  44. package/dist/chunks/{appleTerminalBackup-BYKdf3of.js → appleTerminalBackup-BArZWB21.js} +1 -1
  45. package/dist/chunks/backgroundHousekeeping-BGxHB_OX.js +1 -0
  46. package/dist/chunks/backgroundHousekeeping-CVNIhQg8.js +17 -0
  47. package/dist/chunks/banner-Cu2-XUek.js +2 -0
  48. package/dist/chunks/{bedrockClient-DxE_mHFI.js → bedrockClient-CfiDN-kF.js} +2 -2
  49. package/dist/chunks/branch-C4TsMEkx.js +2 -0
  50. package/dist/chunks/{break-cache-BL2gnDLX.js → break-cache-BMXqFTeS.js} +2 -2
  51. package/dist/chunks/btw-Dn1eYFAz.js +1 -0
  52. package/dist/chunks/caches-BGzKwpnc.js +1 -0
  53. package/dist/chunks/caches-DArHxBgL.js +1 -0
  54. package/dist/chunks/{claudeDesktop-D3PEgx3U.js → claudeDesktop-D8ml2767.js} +1 -1
  55. package/dist/chunks/{clear-CXfhVRp8.js → clear-Bdhb6b39.js} +1 -1
  56. package/dist/chunks/{client-DdenNfkQ.js → client-4iqhC8xq.js} +1 -1
  57. package/dist/chunks/client-BiqbIkwr.js +1 -0
  58. package/dist/chunks/client-CZ8nyVh5.js +1 -0
  59. package/dist/chunks/{client-DvhWKIOx.js → client-CpTCeWba.js} +1 -1
  60. package/dist/chunks/commands-QepeBbFn.js +1 -0
  61. package/dist/chunks/compact-Bu9BUpxV.js +2 -0
  62. package/dist/chunks/config-C-Y2qtB2.js +3 -0
  63. package/dist/chunks/config-D58C3_Lu.js +1 -0
  64. package/dist/chunks/config-DD8fCYXn.js +1 -0
  65. package/dist/chunks/{context-3s9wtn4L.js → context-CY_yfdYa.js} +1 -1
  66. package/dist/chunks/context-noninteractive-BDDi3NLF.js +1 -0
  67. package/dist/chunks/{context-noninteractive-CJhUu_4y.js → context-noninteractive-Dd4xIoP1.js} +5 -5
  68. package/dist/chunks/conversation-B0wxBwzv.js +1 -0
  69. package/dist/chunks/conversation-DUu9qBnq.js +1 -0
  70. package/dist/chunks/conversationRecovery-2ft8sCPE.js +1 -0
  71. package/dist/chunks/crossProjectResume-6boHMUBx.js +40 -0
  72. package/dist/chunks/cwd-Dc3NV7s8.js +1 -0
  73. package/dist/chunks/cwd-Pa83R95t.js +1 -0
  74. package/dist/chunks/{datadog-v_mXWncN.js → datadog-BPuGcxxC.js} +1 -1
  75. package/dist/chunks/{debug-8DCufdSp.js → debug-Bglx1aTu.js} +5 -5
  76. package/dist/chunks/{detectRepository-DfX8xXw2.js → detectRepository-CfX8Lc0A.js} +1 -1
  77. package/dist/chunks/{diff-DJSt7QO6.js → diff-BOAElpfQ.js} +1 -1
  78. package/dist/chunks/{directoryCompletion-CT6YVeg7.js → directoryCompletion-D_Rtg-4j.js} +1 -1
  79. package/dist/chunks/dist-es-B3-7VFf2.js +1 -0
  80. package/dist/chunks/dist-es-B7j_mv242.js +1 -0
  81. package/dist/chunks/dist-es-BSKD_hOQ.js +1 -0
  82. package/dist/chunks/dist-es-BSRN-2nA.js +9 -0
  83. package/dist/chunks/{dist-es-yHGBqhBe.js → dist-es-BXXmyhQ2.js} +1 -1
  84. package/dist/chunks/{dist-es-C3reqy7X.js → dist-es-BaQndfvh2.js} +1 -1
  85. package/dist/chunks/dist-es-CzTYn7xo.js +1 -0
  86. package/dist/chunks/dist-es-DSkyibcN.js +1 -0
  87. package/dist/chunks/{dist-es-BOPBJQo3.js → dist-es-_UNJQniz.js} +1 -1
  88. package/dist/chunks/dist-es-hwK6468D.js +1 -0
  89. package/dist/chunks/dist-es-ovsdbtwh.js +1 -0
  90. package/dist/chunks/doctor-CkLzqAMd.js +1 -0
  91. package/dist/chunks/{entry-ex0-RyYV.js → entry-TNOoyy7_.js} +4 -4
  92. package/dist/chunks/{envUtils-DcaKZlRU.js → envUtils-DfkgIdYf.js} +1 -1
  93. package/dist/chunks/esm-eTAUP-La.js +1 -0
  94. package/dist/chunks/{execFileNoThrow-BsfuytkN.js → execFileNoThrow-BTachNBI.js} +1 -1
  95. package/dist/chunks/exit-DXApFJIP.js +1 -0
  96. package/dist/chunks/extraUsage-CmQaLPV1.js +1 -0
  97. package/dist/chunks/extractMemories-xP63mv6R.js +1 -0
  98. package/dist/chunks/fast-C5nQH8rm.js +1 -0
  99. package/dist/chunks/fast-eGx2IxD7.js +1 -0
  100. package/dist/chunks/fetchModelList-CxLsVNsu.js +1 -0
  101. package/dist/chunks/fetchModelList-D24lRIgR.js +1 -0
  102. package/dist/chunks/{fileSuggestions-B-SLfb-o.js → fileSuggestions-DHxdwq28.js} +2 -2
  103. package/dist/chunks/firstPartyEventLogger-BVAogAX8.js +1 -0
  104. package/dist/chunks/firstPartyEventLogger-M6UMli2c.js +3 -0
  105. package/dist/chunks/{gemini-BC9kHhwe.js → gemini-D_ORb_L6.js} +2 -2
  106. package/dist/chunks/generateSessionName-BQoDduyA.js +1 -0
  107. package/dist/chunks/{genericProcessUtils-BYi0OefF.js → genericProcessUtils-DwQFuna9.js} +1 -1
  108. package/dist/chunks/goal-D7c2mSds.js +3 -0
  109. package/dist/chunks/grok-B2-ZbUiR.js +1 -0
  110. package/dist/chunks/grove-O6qp7ITR.js +1 -0
  111. package/dist/chunks/{help-CK90i4hE.js → help-CZJdRviD.js} +1 -1
  112. package/dist/chunks/history-CQiUERTL.js +1 -0
  113. package/dist/chunks/hooks-BNuUlMzL.js +1 -0
  114. package/dist/chunks/{hooks-BRFDg9DV.js → hooks-DIvN6gdv.js} +3 -3
  115. package/dist/chunks/{install-ZMll-dAa.js → install-T_CV1Slu.js} +1 -1
  116. package/dist/chunks/instrumentation-BjqUZ383.js +21 -0
  117. package/dist/chunks/{job-G_ukhLc4.js → job-R6c4-3c8.js} +1 -1
  118. package/dist/chunks/keybindings-CLRaiL_Z.js +1 -0
  119. package/dist/chunks/{launchLocalMemory-BcRlXLm6.js → launchLocalMemory-DrbKrwXc.js} +2 -2
  120. package/dist/chunks/launchOnboarding-tqsMD8ni.js +8 -0
  121. package/dist/chunks/loadAgentsDir-CcmY8zCj.js +1 -0
  122. package/dist/chunks/{loadAgentsDir-C1LkW7gl.js → loadAgentsDir-DlPbtIsS.js} +540 -543
  123. package/dist/chunks/loadPluginHooks-C_msxVIc.js +1 -0
  124. package/dist/chunks/{loader-C61fB6vU.js → loader-CICGtLp2.js} +1 -1
  125. package/dist/chunks/{localSearch-DFo_WTMm.js → localSearch-CK-sFzPm.js} +1 -1
  126. package/dist/chunks/localSearch-DrUj0B-d.js +1 -0
  127. package/dist/chunks/{log-DaILwWJa.js → log-D2TIwHBV.js} +1 -1
  128. package/dist/chunks/logoUtils-x2pHV-Nl.js +1 -0
  129. package/dist/chunks/{magicDocs-DYc9TFmI.js → magicDocs-BEF8D3if.js} +3 -3
  130. package/dist/chunks/main-kOVUGxOS.js +345 -0
  131. package/dist/chunks/managedEnv-BEqrGqn1.js +1 -0
  132. package/dist/chunks/managedEnv-OPlzUPbJ.js +1 -0
  133. package/dist/chunks/mcp-BNd29r6p.js +6 -0
  134. package/dist/chunks/mcp-D0wAJrRT.js +1 -0
  135. package/dist/chunks/mcp-mgOlm1cY.js +2 -0
  136. package/dist/chunks/memory-DDLk9_LJ.js +1 -0
  137. package/dist/chunks/{mode-Pan-Q2c4.js → mode-CcNsWgK3.js} +2 -2
  138. package/dist/chunks/model-BwBG0V1u.js +1 -0
  139. package/dist/chunks/model-DzCP4K-9.js +1 -0
  140. package/dist/chunks/modelOptions-DRaG3bo0.js +1 -0
  141. package/dist/chunks/nativeInstaller-C3pVPqrZ.js +1 -0
  142. package/dist/chunks/notifications-4wP1Tx9Y.js +1 -0
  143. package/dist/chunks/onChangeAppState-BlaoFbYF.js +1 -0
  144. package/dist/chunks/openai-CDN71NdX.js +2 -0
  145. package/dist/chunks/{overlayContext-CMV7nYR9.js → overlayContext-BT2Lq8ei.js} +1 -1
  146. package/dist/chunks/{panel-D9fGQgln.js → panel-CVS4SK_E.js} +1 -1
  147. package/dist/chunks/parser-CG5RuOCK.js +1 -0
  148. package/dist/chunks/{parser-D8slvrJP.js → parser-Cg6hSCmn.js} +1 -1
  149. package/dist/chunks/partition-CIl_ORUT.js +1 -0
  150. package/dist/chunks/{pasteStore-DNV1M5Xd.js → pasteStore-P0zP-ch0.js} +1 -1
  151. package/dist/chunks/permissions-zSNOZSwr.js +3 -0
  152. package/dist/chunks/pidLock-BTqO-h7Y.js +3 -0
  153. package/dist/chunks/{plan-CQLnPLuE.js → plan-Bs6em6lk.js} +1 -1
  154. package/dist/chunks/{platform-Dzff1WWw.js → platform-BacQ6ACS.js} +1 -1
  155. package/dist/chunks/plugin-DDDxjBa0.js +17 -0
  156. package/dist/chunks/{pluginAutoupdate-BJaAqwTH.js → pluginAutoupdate-8qugAFhb.js} +1 -1
  157. package/dist/chunks/pluginBlocklist-q01ackCf.js +1 -0
  158. package/dist/chunks/pluginCliCommands-DXZfCZsv.js +1 -0
  159. package/dist/chunks/{pluginFlagging-DQP8tBi2.js → pluginFlagging-BG2MHCQJ.js} +1 -1
  160. package/dist/chunks/pluginOperations-hXYLrzM2.js +2 -0
  161. package/dist/chunks/{pluginStartupCheck-CfRvCrFg.js → pluginStartupCheck-DTMa6TgL.js} +1 -1
  162. package/dist/chunks/pluginStartupCheck-HS1ZceZa.js +1 -0
  163. package/dist/chunks/plugins-COoGBYk6.js +4 -0
  164. package/dist/chunks/{poorMode-J5SYJvoY.js → poorMode-B0QGV6Ci.js} +1 -1
  165. package/dist/chunks/poorMode-G-pnu6NM.js +1 -0
  166. package/dist/chunks/print-BASybEtO.js +13 -0
  167. package/dist/chunks/processBashCommand-DDi_Pymt.js +1 -0
  168. package/dist/chunks/processSlashCommand-Cq9kaoSF.js +5 -0
  169. package/dist/chunks/{projectContext-Bw3o5BrN.js → projectContext-5fmRr6Sd.js} +1 -1
  170. package/dist/chunks/{projectContext-BN2ZWzOG.js → projectContext-DhtjLv3k.js} +1 -1
  171. package/dist/chunks/{projectOnboardingState-CJycxw5P.js → projectOnboardingState-B5YATuc6.js} +1 -1
  172. package/dist/chunks/prompt-CHobfCB1.js +1 -0
  173. package/dist/chunks/prompt-CMm6RHHc.js +1 -0
  174. package/dist/chunks/{prompt-BGqgPgCU.js → prompt-mM79EGnT.js} +1 -1
  175. package/dist/chunks/{promptEditor-CmQ9p4oe.js → promptEditor-DLGN_eLu.js} +1 -1
  176. package/dist/chunks/{protocolHandler-CJo9-PfZ.js → protocolHandler-DjQALaU2.js} +1 -1
  177. package/dist/chunks/{proxy-CB17QimU.js → proxy-CDBfZjO7.js} +2 -2
  178. package/dist/chunks/reconciler-CeXqh95g.js +1 -0
  179. package/dist/chunks/refresh-Ce2yk28a.js +1 -0
  180. package/dist/chunks/{registerProtocol-CLIpzVwF.js → registerProtocol-CAsDme_E.js} +1 -1
  181. package/dist/chunks/reject-Bld5E-bn.js +1 -0
  182. package/dist/chunks/{reload-plugins-DjugL8jH.js → reload-plugins-C42xSB5l.js} +1 -1
  183. package/dist/chunks/rename-CtBghpxZ.js +1 -0
  184. package/dist/chunks/{renderOptions-Zqfm2U1y.js → renderOptions-DV0dn0IW.js} +1 -1
  185. package/dist/chunks/resume-BWkaTDqd.js +2 -0
  186. package/dist/chunks/ripgrep-DLs8MraF.js +1 -0
  187. package/dist/chunks/{ripgrep-BuzOTf1S.js → ripgrep-Dl3y5r4m.js} +1 -1
  188. package/dist/chunks/{runtimeObserver-CK_iZ6OB.js → runtimeObserver-1wQO8HSZ.js} +1 -1
  189. package/dist/chunks/{runtimeObserver-CpP0L9T9.js → runtimeObserver-XQrOux41.js} +4 -4
  190. package/dist/chunks/sandbox-adapter-8GO6eJxw.js +1 -0
  191. package/dist/chunks/{sandbox-toggle-KOHYvbQT.js → sandbox-toggle-Dir9Polo.js} +1 -1
  192. package/dist/chunks/searchExtraTools-BhDq8DTJ.js +1 -0
  193. package/dist/chunks/{select-C_KXmqbI.js → select-Bxf5-5sI.js} +1 -1
  194. package/dist/chunks/sessionFileAccessHooks-CozocHQE.js +1 -0
  195. package/dist/chunks/sessionObserver-DGEQM4cO.js +1 -0
  196. package/dist/chunks/{sessionObserver-WOYv2n7C.js → sessionObserver-DS4G6mb9.js} +2 -2
  197. package/dist/chunks/sessionStorage-BcAscOGE.js +1 -0
  198. package/dist/chunks/sessionTracing-BoDDYLxW.js +11 -0
  199. package/dist/chunks/settings-B2jvL8Dp.js +24 -0
  200. package/dist/chunks/settings-CisDe8DB.js +1 -0
  201. package/dist/chunks/setup-BRypY6iT.js +3 -0
  202. package/dist/chunks/{shadowedRuleDetection-Df-kZ_pK.js → shadowedRuleDetection-BRxZjobz.js} +1 -1
  203. package/dist/chunks/{sideQuestion-CMB8hfgX.js → sideQuestion-DLJxyrlp.js} +3 -3
  204. package/dist/chunks/sinks-CGdKmq_8.js +1 -0
  205. package/dist/chunks/sinks-Cz2HfgMU.js +1 -0
  206. package/dist/chunks/skillChangeDetector-xviGstqm.js +1 -0
  207. package/dist/chunks/{skillGapStore-CfmlO6pb.js → skillGapStore-CKN_d3pO.js} +2 -2
  208. package/dist/chunks/{skillLifecycle-BQ2LMfMx.js → skillLifecycle-BMY2JGGG.js} +2 -2
  209. package/dist/chunks/{skillSearchPanel-BwYuwLFs.js → skillSearchPanel-D9trHULQ.js} +2 -2
  210. package/dist/chunks/{skills-BVHPQma0.js → skills-CX_AvwLG.js} +1 -1
  211. package/dist/chunks/startupProfiler-BH0FoI66.js +1 -0
  212. package/dist/chunks/{startupProfiler-DTs9w9EN.js → startupProfiler-CJdr3SxP.js} +2 -2
  213. package/dist/chunks/state-B4jiUise.js +1 -0
  214. package/dist/chunks/state-BhOKSFi5.js +1 -0
  215. package/dist/chunks/status-Daaak6Bo.js +1 -0
  216. package/dist/chunks/statusNoticeHelpers-vFVgIYuw.js +1 -0
  217. package/dist/chunks/{stringUtils-BQm3OfeJ.js → stringUtils-C718f5ey.js} +1 -1
  218. package/dist/chunks/sts-ei3CGBNu.js +1 -0
  219. package/dist/chunks/switcher-BpgmH4AI.js +1 -0
  220. package/dist/chunks/{switcher-Bq1Ct_Sn.js → switcher-CAajZeNL.js} +1 -1
  221. package/dist/chunks/{tasks-0c8Uy04D.js → tasks-BWNQr2d3.js} +1 -1
  222. package/dist/chunks/{templateJobs-BdFzE9XG.js → templateJobs-gUET39Ho.js} +1 -1
  223. package/dist/chunks/{terminalSetup-Cf_r6pwK.js → terminalSetup-B_10N_gE.js} +3 -3
  224. package/dist/chunks/{terminalSetup-D7J6bxcn.js → terminalSetup-qc2PlvOm.js} +1 -1
  225. package/dist/chunks/{theme-Bby4fssR.js → theme-B7fKI6E5.js} +1 -1
  226. package/dist/chunks/tipRegistry-DamZr34w.js +2 -0
  227. package/dist/chunks/{toolEventObserver-CzFZUIsM.js → toolEventObserver-BL06sDI4.js} +1 -1
  228. package/dist/chunks/toolPool-CX5wDBi1.js +1 -0
  229. package/dist/chunks/{types-zk5Ltv5q.js → types-Dx7P7JLQ.js} +2 -2
  230. package/dist/chunks/udsClient-cQz6nJ_T.js +1 -0
  231. package/dist/chunks/{use-select-navigation-DMaC_3iw.js → use-select-navigation-BiUJdWai.js} +1 -1
  232. package/dist/chunks/{useExitOnCtrlCDWithKeybindings-CjW3gUOt.js → useExitOnCtrlCDWithKeybindings-C9BYG8Bo.js} +1 -1
  233. package/dist/chunks/useMainLoopModel-DwjSVzzO.js +1 -0
  234. package/dist/chunks/useManagePlugins-BqfIVa6E.js +1 -0
  235. package/dist/chunks/{useMergedTools-DarmnCEw.js → useMergedTools-Bw8FchX8.js} +1 -1
  236. package/dist/chunks/{useSearchInput-C2JuUW3g.js → useSearchInput-B25K1RnK.js} +1 -1
  237. package/dist/chunks/useSettingsErrors-DYQ44kX4.js +1 -0
  238. package/dist/chunks/{util-Bq5l7FF5.js → util-CtlC2dsN.js} +1 -1
  239. package/dist/chunks/validatePlugin-D6tFo87L.js +1 -0
  240. package/dist/chunks/vim-CoRp9lY1.js +1 -0
  241. package/dist/chunks/worktree-B8apCnVe.js +1 -0
  242. package/dist/cli.js +1 -1
  243. package/package.json +1 -5
  244. package/dist/chunks/AgentsMdExternalIncludesDialog-DCvgQ6n3.js +0 -1
  245. package/dist/chunks/App-BcEI6U5j.js +0 -1
  246. package/dist/chunks/ApproveApiKey-DegdTXZl.js +0 -1
  247. package/dist/chunks/ApproveApiKey-_VXIMSwY.js +0 -1
  248. package/dist/chunks/BackgroundTasksDialog-CjBt1L0p.js +0 -2
  249. package/dist/chunks/CustomSelect-B46Eh0gU.js +0 -1
  250. package/dist/chunks/Doctor-BP0Rqraa.js +0 -1
  251. package/dist/chunks/Doctor-By_y3C2V.js +0 -3
  252. package/dist/chunks/Grove-C3mhgshv.js +0 -11
  253. package/dist/chunks/MCPConnectionManager-ChN4Ayjk.js +0 -1
  254. package/dist/chunks/MCPToolListView-DLSrQHDc.js +0 -1
  255. package/dist/chunks/MessageSelector-CdDlJE48.js +0 -3
  256. package/dist/chunks/Messages-DuL_r1Or.js +0 -10
  257. package/dist/chunks/Onboarding-CE2GNA-h.js +0 -1
  258. package/dist/chunks/QueryEngine-DNNy1UCD.js +0 -1
  259. package/dist/chunks/REPL-CEhW-C41.js +0 -1
  260. package/dist/chunks/REPL-CkSL4C_8.js +0 -124
  261. package/dist/chunks/ResumeConversation-BMCO_3X7.js +0 -1
  262. package/dist/chunks/SearchExtraToolsTool-DSy_jDhf.js +0 -1
  263. package/dist/chunks/Settings-mDykHLok.js +0 -2
  264. package/dist/chunks/Spinner-DwsJJUtn.js +0 -1
  265. package/dist/chunks/TrustDialog-G4jM9IfM.js +0 -1
  266. package/dist/chunks/add-dir-7RfQAC3h.js +0 -1
  267. package/dist/chunks/agents-BNg_skSm.js +0 -101
  268. package/dist/chunks/allErrors-DaztSMrw.js +0 -1
  269. package/dist/chunks/auth-BTB00dq5.js +0 -10
  270. package/dist/chunks/auth-Bbc0Ny8i.js +0 -1
  271. package/dist/chunks/backgroundHousekeeping-DYz83_8C.js +0 -1
  272. package/dist/chunks/backgroundHousekeeping-bEZtlJSf.js +0 -17
  273. package/dist/chunks/banner-mqZEluky.js +0 -2
  274. package/dist/chunks/branch-exFKkymg.js +0 -2
  275. package/dist/chunks/btw-3l78DYET.js +0 -1
  276. package/dist/chunks/caches-6Nx6tsk9.js +0 -1
  277. package/dist/chunks/caches-ouaWB9bY.js +0 -1
  278. package/dist/chunks/client-C01Bnxxv.js +0 -1
  279. package/dist/chunks/client-DYRgRQsr.js +0 -1
  280. package/dist/chunks/commands-BoxOw75F.js +0 -1
  281. package/dist/chunks/compact-BOYr105K.js +0 -2
  282. package/dist/chunks/config-BddEvZZl.js +0 -3
  283. package/dist/chunks/config-GEv9hUzz.js +0 -1
  284. package/dist/chunks/config-kw4xg7Nk.js +0 -1
  285. package/dist/chunks/context-noninteractive-DFvoZ2L9.js +0 -1
  286. package/dist/chunks/conversation-CoGharlH.js +0 -1
  287. package/dist/chunks/conversation-MxEVm54C.js +0 -1
  288. package/dist/chunks/conversationRecovery-Da_8uldZ.js +0 -1
  289. package/dist/chunks/crossProjectResume-CzPCHq_K.js +0 -40
  290. package/dist/chunks/cwd-BcO6WHKo.js +0 -1
  291. package/dist/chunks/cwd-CDUelriw.js +0 -1
  292. package/dist/chunks/dist-es-5t7v8oaj.js +0 -1
  293. package/dist/chunks/dist-es-BIjDeceU.js +0 -1
  294. package/dist/chunks/dist-es-C-OjW2Ao.js +0 -1
  295. package/dist/chunks/dist-es-CEk66gUu.js +0 -1
  296. package/dist/chunks/dist-es-CIULjvtA2.js +0 -1
  297. package/dist/chunks/dist-es-CMtO44xC.js +0 -1
  298. package/dist/chunks/dist-es-CYPVg66r.js +0 -9
  299. package/dist/chunks/dist-es-D1Y8zSMI.js +0 -1
  300. package/dist/chunks/dist-es-Gt_DpXlP.js +0 -1
  301. package/dist/chunks/dist-es-kj-F5A132.js +0 -1
  302. package/dist/chunks/doctor-DWvioSU9.js +0 -1
  303. package/dist/chunks/esm-BQY8jJNR.js +0 -1
  304. package/dist/chunks/exit-BxC_ZEtO.js +0 -1
  305. package/dist/chunks/extraUsage-DYm33Occ.js +0 -1
  306. package/dist/chunks/extractMemories-CzN3Ax2B.js +0 -1
  307. package/dist/chunks/fast-DqUpl_Lr.js +0 -1
  308. package/dist/chunks/fast-NUdUyAaM.js +0 -1
  309. package/dist/chunks/fetchModelList-CqsTAWEN.js +0 -1
  310. package/dist/chunks/fetchModelList-DBMHE6Ng.js +0 -1
  311. package/dist/chunks/firstPartyEventLogger-C0q45h_4.js +0 -3
  312. package/dist/chunks/firstPartyEventLogger-CP8hCBDj.js +0 -1
  313. package/dist/chunks/generateSessionName-ChvKBVxB.js +0 -1
  314. package/dist/chunks/goal-ByyimpVU.js +0 -3
  315. package/dist/chunks/grok-DenjixMl.js +0 -1
  316. package/dist/chunks/grove-Dq8QbQ9o.js +0 -7
  317. package/dist/chunks/history-CNQNd6hT.js +0 -1
  318. package/dist/chunks/hooks-BaYwmkxD.js +0 -1
  319. package/dist/chunks/instrumentation-BwVyvRfY.js +0 -21
  320. package/dist/chunks/keybindings-wNxBzDVQ.js +0 -1
  321. package/dist/chunks/launchOnboarding-CDjQ64RO.js +0 -8
  322. package/dist/chunks/loadAgentsDir-DKXap_Om.js +0 -1
  323. package/dist/chunks/loadPluginHooks-DtmHtEiS.js +0 -1
  324. package/dist/chunks/localSearch-BB9x5C2N.js +0 -1
  325. package/dist/chunks/logoUtils-Dj_2SWmO.js +0 -1
  326. package/dist/chunks/main-BRg8L_aw.js +0 -346
  327. package/dist/chunks/managedEnv-DsqAYOJ4.js +0 -1
  328. package/dist/chunks/managedEnv-lybrMred.js +0 -1
  329. package/dist/chunks/mcp-Bsw3cMiJ.js +0 -6
  330. package/dist/chunks/mcp-DDdud6Y7.js +0 -1
  331. package/dist/chunks/mcp-DbgTDUt7.js +0 -2
  332. package/dist/chunks/memory-CzwTzihf.js +0 -1
  333. package/dist/chunks/model-BYfmXKHf.js +0 -1
  334. package/dist/chunks/model-BwBE0Pt5.js +0 -1
  335. package/dist/chunks/modelOptions-DvNBapgG.js +0 -1
  336. package/dist/chunks/nativeInstaller-DnSNJWIi.js +0 -1
  337. package/dist/chunks/notifications-B0DTaYoy.js +0 -1
  338. package/dist/chunks/omit-Dl1Us_PY.js +0 -1
  339. package/dist/chunks/onChangeAppState-4KOJMN82.js +0 -1
  340. package/dist/chunks/openai-C_6C1_0N.js +0 -10
  341. package/dist/chunks/parser-BKAVMTyD.js +0 -1
  342. package/dist/chunks/partition-B504IgAa.js +0 -1
  343. package/dist/chunks/permissions-CLFMhdRk.js +0 -3
  344. package/dist/chunks/pidLock-D9do1Afy.js +0 -3
  345. package/dist/chunks/plugin-BYdF7uob.js +0 -17
  346. package/dist/chunks/pluginBlocklist-DKKmOnWM.js +0 -1
  347. package/dist/chunks/pluginCliCommands-z8TtJMKH.js +0 -1
  348. package/dist/chunks/pluginOperations-BcfJCDco.js +0 -2
  349. package/dist/chunks/pluginStartupCheck-Cq4PvULa.js +0 -1
  350. package/dist/chunks/plugins-CTM8jpOw.js +0 -4
  351. package/dist/chunks/policyLimits-a7ix6GnU.js +0 -1
  352. package/dist/chunks/poorMode-C11JEH3d.js +0 -1
  353. package/dist/chunks/print-u6MzL5Cr.js +0 -13
  354. package/dist/chunks/processBashCommand-DIwrI2QC.js +0 -1
  355. package/dist/chunks/processSlashCommand-B-Gujpxm.js +0 -5
  356. package/dist/chunks/prompt-BPJDGlx5.js +0 -1
  357. package/dist/chunks/prompt-DEdZzkEz.js +0 -1
  358. package/dist/chunks/reconciler-DSKLuOS7.js +0 -1
  359. package/dist/chunks/refresh-BbZFCNpn.js +0 -1
  360. package/dist/chunks/rename-DOtCOtEr.js +0 -1
  361. package/dist/chunks/resume-BB4T4WIV.js +0 -2
  362. package/dist/chunks/ripgrep-CZ2CqaHb.js +0 -1
  363. package/dist/chunks/sandbox-adapter-DhJJ6WOV.js +0 -1
  364. package/dist/chunks/searchExtraTools-CdJghGkj.js +0 -1
  365. package/dist/chunks/sessionFileAccessHooks-D7KbWFp7.js +0 -1
  366. package/dist/chunks/sessionObserver-DB-sLv-X.js +0 -1
  367. package/dist/chunks/sessionStorage-sgOAbDn7.js +0 -1
  368. package/dist/chunks/sessionTracing-yBre24PH.js +0 -11
  369. package/dist/chunks/settings-C-KNkvsM.js +0 -1
  370. package/dist/chunks/settings-DKN4xSpQ.js +0 -24
  371. package/dist/chunks/setup-CN_Pk7AR.js +0 -3
  372. package/dist/chunks/sinks-BS17vtN0.js +0 -1
  373. package/dist/chunks/sinks-D1EjkHb4.js +0 -1
  374. package/dist/chunks/skillChangeDetector-CBKuGuEi.js +0 -1
  375. package/dist/chunks/startupProfiler-B_U4QDtf.js +0 -1
  376. package/dist/chunks/state-BowF111d.js +0 -1
  377. package/dist/chunks/state-CGuyDES7.js +0 -1
  378. package/dist/chunks/status-BurdTfyz.js +0 -2
  379. package/dist/chunks/status-DMq1An5h.js +0 -1
  380. package/dist/chunks/statusNoticeHelpers-X75JNlx5.js +0 -1
  381. package/dist/chunks/sts-C2Gf2WYN.js +0 -1
  382. package/dist/chunks/switcher-DGD4ORVf.js +0 -1
  383. package/dist/chunks/tipRegistry-CyRXWWTz.js +0 -2
  384. package/dist/chunks/toolPool-CnrZcprA.js +0 -1
  385. package/dist/chunks/udsClient-ftP0yIpe.js +0 -1
  386. package/dist/chunks/useMainLoopModel-DWscpA9I.js +0 -1
  387. package/dist/chunks/useManagePlugins-CYXVcql2.js +0 -1
  388. package/dist/chunks/useSettingsErrors-DutJBiKZ.js +0 -1
  389. package/dist/chunks/validatePlugin-DIdEydz_.js +0 -1
  390. package/dist/chunks/vim-D8prM2IH.js +0 -1
  391. package/dist/chunks/worktree-Caqt2WRZ.js +0 -1
  392. /package/dist/chunks/{dist-es-Cgsa8pb82.js → dist-es-Cgsa8pb8.js} +0 -0
  393. /package/dist/chunks/{dist-es-Cwru7c2B2.js → dist-es-Cwru7c2B.js} +0 -0
  394. /package/dist/chunks/{dist-es-DXIR5NLi2.js → dist-es-DXIR5NLi.js} +0 -0
@@ -1 +0,0 @@
1
- import{o as e}from"./rolldown-runtime-DaDcL9Zw.js";import{Ap as t,Br as n,Dp as r,Jn as i,Ks as a,Nr as o,Op as ee,Or as te,Qr as ne,Rn as re,Ub as s,Xs as c,Yb as l,Zr as ie,br as u,d_ as ae,dm as oe,fm as d,u_ as f,vr as p}from"./loadAgentsDir-C1LkW7gl.js";import{I as m,P as h,Wt as g,ai as _,dr as se,ot as v,t as y}from"./src-DL3w8VPk.js";import{t as b}from"./jsx-runtime-Bb4Xn-E0.js";import{Yn as x,zt as S}from"./state-BowF111d.js";import{o as C,s as w}from"./log-DaILwWJa.js";import{n as T,r as E}from"./analytics-DJobLaWP.js";import{n as D}from"./conversationRecovery-Da_8uldZ.js";import{r as O,t as k}from"./Spinner-DwsJJUtn.js";import{a as ce,n as le,s as ue}from"./skillChangeDetector-CBKuGuEi.js";import{t as de}from"./REPL-CkSL4C_8.js";import{a as fe,i as A,n as j,o as M,r as N,t as P}from"./crossProjectResume-CzPCHq_K.js";import{dirname as F}from"path";var I=e(_(),1);l(),S(),M(),O(),f(),y(),s(),T(),r(),d(),A(),a(),j(),C(),p();var L=b();function R(e){let t=parseInt(e,10);if(!isNaN(t)&&t>0)return t;let n=e.match(/github\.com\/[^/]+\/[^/]+\/pull\/(\d+)/);return n?.[1]?parseInt(n[1],10):null}function z({commands:e,worktreePaths:r,initialTools:a,mcpClients:s,dynamicMcpConfig:l,debug:d,mainThreadAgentDefinition:f,autoConnectIdeFlag:p,strictMcpConfig:g=!1,systemPrompt:_,appendSystemPrompt:y,initialSearchQuery:b,disableSlashCommands:S=!1,forkSession:C,taskListId:T,filterByPr:O,thinkingConfig:A,onTurnComplete:j}){let{rows:M}=v(),z=ee(e=>e.agentDefinitions),H=t(),[U,W]=I.useState([]),[pe,G]=I.useState(!0),[me,he]=I.useState(!1),[K,ge]=I.useState(!1),[q,_e]=I.useState(null),[J,ve]=I.useState(null),Y=I.useRef(null),X=I.useRef(0),Z=I.useMemo(()=>{let e=U.filter(e=>!e.isSidechain);if(O!==void 0){if(O===!0)e=e.filter(e=>e.prNumber!==void 0);else if(typeof O==`number`)e=e.filter(e=>e.prNumber===O);else if(typeof O==`string`){let t=R(O);t!==null&&(e=e.filter(e=>e.prNumber===t))}}return e},[U,O]),ye=u();I.useEffect(()=>{o(r).then(e=>{Y.current=e,X.current=e.logs.length,W(e.logs),G(!1)}).catch(e=>{w(e),G(!1)})},[r]);let Q=I.useCallback(e=>{let t=Y.current;!t||t.nextIndex>=t.allStatLogs.length||i(t.allStatLogs,t.nextIndex,e).then(n=>{if(t.nextIndex=n.nextIndex,n.logs.length>0){let e=X.current;n.logs.forEach((t,n)=>{t.value=e+n}),W(e=>e.concat(n.logs)),X.current+=n.logs.length}else t.nextIndex<t.allStatLogs.length&&Q(e)})},[]),$=I.useCallback(e=>{G(!0),(e?te():o(r)).then(e=>{Y.current=e,X.current=e.logs.length,W(e.logs)}).catch(e=>{w(e)}).finally(()=>{G(!1)})},[r]),be=I.useCallback(()=>{let e=!K;ge(e),$(e)},[K,$]);function xe(){process.exit(1)}async function Se(e){he(!0);let t=performance.now(),r=P(e,K);if(r.isCrossProject&&!r.isSameRepoWorktree){let e=r.command,t=await se(e);t&&process.stdout.write(t),ve(e);return}try{let r=await D(e,void 0);if(!r)throw Error(`Failed to load conversation`);r.sessionId&&!C?(x(oe(r.sessionId),e.fullPath?F(e.fullPath):null),await ie(),ae(r.sessionId)):C&&r.contentReplacements?.length&&await n(r.contentReplacements);let{agentDefinition:i}=ce(r.agentSetting,f,z);H(e=>({...e,agent:i?.agentType}));let a=le(r.agentName,r.agentColor);a&&H(e=>({...e,standaloneAgentContext:a})),c(r.agentName),ne(C?{...r,worktreeSession:void 0}:r),C||(ue(r.worktreeSession),r.sessionId&&re()),E(`tengu_session_resumed`,{entrypoint:`picker`,success:!0,resume_duration_ms:Math.round(performance.now()-t)}),W([]),_e({messages:r.messages,fileHistorySnapshots:r.fileHistorySnapshots,contentReplacements:r.contentReplacements,agentName:r.agentName,agentColor:r.agentColor==="default"?void 0:r.agentColor,mainThreadAgentDefinition:i})}catch(e){throw E(`tengu_session_resumed`,{entrypoint:`picker`,success:!1}),w(e),e}}return J?(0,L.jsx)(V,{command:J}):q?(0,L.jsx)(de,{debug:d,commands:e,initialTools:a,initialMessages:q.messages,initialFileHistorySnapshots:q.fileHistorySnapshots,initialContentReplacements:q.contentReplacements,initialAgentName:q.agentName,initialAgentColor:q.agentColor,mcpClients:s,dynamicMcpConfig:l,strictMcpConfig:g,systemPrompt:_,appendSystemPrompt:y,mainThreadAgentDefinition:q.mainThreadAgentDefinition,autoConnectIdeFlag:p,disableSlashCommands:S,taskListId:T,thinkingConfig:A,onTurnComplete:j}):pe?(0,L.jsxs)(m,{children:[(0,L.jsx)(k,{}),(0,L.jsx)(h,{children:` Loading conversations…`})]}):me?(0,L.jsxs)(m,{children:[(0,L.jsx)(k,{}),(0,L.jsx)(h,{children:` Resuming conversation…`})]}):Z.length===0?(0,L.jsx)(B,{}):(0,L.jsx)(fe,{logs:Z,maxHeight:M,onCancel:xe,onSelect:Se,onLogsChanged:ye?()=>$(K):void 0,onLoadMore:Q,initialSearchQuery:b,showAllProjects:K,onToggleAllProjects:be,onAgenticSearch:N})}function B(){return g(`app:interrupt`,()=>{process.exit(1)},{context:`Global`}),(0,L.jsxs)(m,{flexDirection:`column`,children:[(0,L.jsx)(h,{children:`No conversations found to resume.`}),(0,L.jsx)(h,{dimColor:!0,children:`Press Ctrl+C to exit and start a new conversation.`})]})}function V({command:e}){return I.useEffect(()=>{let e=setTimeout(()=>{process.exit(0)},100);return()=>clearTimeout(e)},[]),(0,L.jsxs)(m,{flexDirection:`column`,gap:1,children:[(0,L.jsx)(h,{children:`This conversation is from a different directory.`}),(0,L.jsxs)(m,{flexDirection:`column`,children:[(0,L.jsx)(h,{children:`To resume, run:`}),(0,L.jsxs)(h,{children:[` `,e]})]}),(0,L.jsx)(h,{dimColor:!0,children:`(Command copied to clipboard)`})]})}export{z as ResumeConversation};
@@ -1 +0,0 @@
1
- import{eh as e,th as t}from"./loadAgentsDir-C1LkW7gl.js";t();export{e as clearSearchExtraToolsDescriptionCache};
@@ -1,2 +0,0 @@
1
- import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{d as n,l as r,o as i}from"./envUtils-DcaKZlRU.js";import{n as a,t as o}from"./figures-5ThXQEtq.js";import{Aa as ee,Ap as te,C_ as s,Dp as ne,L_ as re,Op as c,R_ as ie,S_ as ae,Ub as l,V_ as oe,Yb as u,ad as d,b as f,bp as se,id as p,j as ce,ja as m,ka as h,kp as le,nr as g,vr as ue,x_ as de,y_ as fe,yp as _}from"./loadAgentsDir-C1LkW7gl.js";import{D as v,Gt as pe,H as me,I as y,P as b,T as x,U as he,Wt as ge,Xn as _e,a as ve,ai as S,di as C,fi as ye,k as be,n as w,ot as xe,r as Se,t as T,x as E,y as Ce}from"./src-DL3w8VPk.js";import{t as D}from"./jsx-runtime-Bb4Xn-E0.js";import{ut as O,zt as k}from"./state-BowF111d.js";import{n as A,t as j}from"./cwd-BcO6WHKo.js";import{Ft as we,Nt as Te,Pt as Ee,Rt as De,b as M,h as Oe,jt as ke,s as Ae,t as je,zt as Me}from"./settings-DKN4xSpQ.js";import{a as Ne,c as N,i as Pe,m as Fe,o as Ie,v as P}from"./config-BddEvZZl.js";import{o as F,s as Le}from"./log-DaILwWJa.js";import{n as I,r as L}from"./analytics-DJobLaWP.js";import{F as Re,Gn as ze,I as Be,K as Ve,P as He,U as Ue,W as We,Wn as Ge,f as Ke,g as qe,h as Je,q as Ye}from"./model-BwBE0Pt5.js";import{a as Xe,c as R,d as Ze,i as Qe,l as $e,n as et,o as tt,r as nt,s as rt,t as it,u as z}from"./status-BurdTfyz.js";import{n as at,t as ot}from"./TextInput-7uqPhq9T.js";import{n as B,t as V}from"./useExitOnCtrlCDWithKeybindings-CjW3gUOt.js";import{n as H,t as st}from"./select-C_KXmqbI.js";import{i as ct,n as lt,r as ut}from"./modalContext-DDZdU1J8.js";import{t as dt}from"./CustomSelect-B46Eh0gU.js";import{n as ft,t as pt}from"./ThemePicker-DT9zVy-0.js";import{i as mt,n as ht,r as gt,t as _t}from"./extraUsage-DYm33Occ.js";import{n as vt,t as yt}from"./AgentsMdExternalIncludesDialog-s0Orgord.js";import{t as U}from"./SearchBox-C9xxQzh1.js";import{n as bt,t as xt}from"./useSearchInput-C2JuUW3g.js";function St(){let e=O();return[{label:`Version`,value:`0.0.22`},{label:`Session name`,value:g(e)??(0,q.jsx)(b,{dimColor:!0,children:`/rename to add a name`})},{label:`Session ID`,value:e},{label:`cwd`,value:j()},...et(),...it()]}function Ct({mainLoopModel:e,mcp:t,theme:n,context:r}){return[{label:`Model`,value:z(e)},...nt(t.clients,r.options.ideInstallationStatus,n),...tt(t.clients,n),...R(),...$e()]}async function W(){return[...await Qe(),...await Xe(),...await rt()]}function wt({value:e}){return Array.isArray(e)?(0,q.jsx)(y,{flexWrap:`wrap`,columnGap:1,flexShrink:99,children:e.map((t,n)=>(0,q.jsxs)(b,{children:[t,n<e.length-1?`,`:``]},n))}):typeof e==`string`?(0,q.jsx)(b,{children:e}):e}function Tt({context:e,diagnosticsPromise:t}){let n=c(e=>e.mainLoopModel),r=c(e=>e.mcp),[i]=me(),a=G.useMemo(()=>[St(),Ct({mainLoopModel:n,mcp:r,theme:i,context:e})],[n,r,i,e]),o=ut()?1:void 0;return(0,q.jsxs)(y,{flexDirection:`column`,flexGrow:o,children:[(0,q.jsxs)(y,{flexDirection:`column`,gap:1,flexGrow:o,children:[a.map((e,t)=>e.length>0&&(0,q.jsx)(y,{flexDirection:`column`,children:e.map(({label:e,value:t},n)=>(0,q.jsxs)(y,{flexDirection:`row`,gap:1,flexShrink:0,children:[e!==void 0&&(0,q.jsxs)(b,{bold:!0,children:[e,`:`]}),(0,q.jsx)(wt,{value:t})]},n))},t)),(0,q.jsx)(K.Suspense,{fallback:null,children:(0,q.jsx)(Et,{promise:t})})]}),(0,q.jsx)(b,{dimColor:!0,children:(0,q.jsx)(p,{action:`confirm:no`,context:`Settings`,fallback:`Esc`,description:`cancel`})})]})}function Et({promise:e}){let t=(0,K.use)(e);return t.length===0?null:(0,q.jsxs)(y,{flexDirection:`column`,paddingBottom:1,children:[(0,q.jsx)(b,{bold:!0,children:`System Diagnostics`}),t.map((e,t)=>(0,q.jsxs)(y,{flexDirection:`row`,gap:1,paddingX:1,children:[(0,q.jsx)(b,{color:`error`,children:o.warning}),typeof e==`string`?(0,q.jsx)(b,{wrap:`wrap`,children:e}):e]},t))]})}var G,K,q,Dt=e((()=>{a(),G=t(S(),1),K=t(S(),1),k(),lt(),T(),ne(),A(),ue(),Ze(),d(),q=D()}));function Ot({currentVersion:e,onChoice:t}){function n(e){t(e)}function r(){t(`cancel`)}return(0,kt.jsxs)(Ce,{title:`Switch to Stable Channel`,onCancel:r,color:`permission`,hideBorder:!0,hideInputGuide:!0,children:[(0,kt.jsxs)(b,{children:[`The stable channel may have an older version than what you're currently running (`,e,`).`]}),(0,kt.jsx)(b,{dimColor:!0,children:`How would you like to handle this?`}),(0,kt.jsx)(st,{options:[{label:`Allow possible downgrade to stable version`,value:`downgrade`},{label:`Stay on current version (${e}) until stable catches up`,value:`stay`}],onChange:n})]})}var kt,At=e((()=>{T(),dt(),kt=D()}));function jt(e){return Object.entries(e).map(([e,t])=>({label:t?.name??Pt,value:e,description:t?.description??Ft}))}function Mt({initialStyle:e,onComplete:t,onCancel:n,isStandaloneCommand:r}){let[i,a]=(0,Nt.useState)([]),[o,te]=(0,Nt.useState)(!0);(0,Nt.useEffect)(()=>{ee(j()).then(e=>{let t=jt(e);a(t),te(!1)}).catch(()=>{let e=jt(h);a(e),te(!1)})},[]);let s=(0,Nt.useCallback)(e=>{t(e)},[t]);return(0,J.jsx)(Ce,{title:`Preferred output style`,onCancel:n,hideInputGuide:!r,hideBorder:!r,children:(0,J.jsxs)(y,{flexDirection:`column`,gap:1,children:[(0,J.jsx)(y,{marginTop:1,children:(0,J.jsx)(b,{dimColor:!0,children:`This changes how Work Mate communicates with you`})}),o?(0,J.jsx)(b,{dimColor:!0,children:`Loading output styles…`}):(0,J.jsx)(st,{options:i,onChange:s,visibleOptionCount:10,defaultValue:e})]})})}var Nt,J,Pt,Ft,It=e((()=>{Nt=t(S(),1),m(),T(),A(),H(),J=D(),Pt=`Default`,Ft=`Work Mate completes coding tasks efficiently and provides concise responses`}));function Lt({initialLanguage:e,onComplete:t,onCancel:n}){let[r,i]=(0,Rt.useState)(e),[a,ee]=(0,Rt.useState)((e??``).length);ge(`confirm:no`,n,{context:`Settings`});function te(){let e=r?.trim();t(e||void 0)}return(0,Y.jsxs)(y,{flexDirection:`column`,gap:1,children:[(0,Y.jsx)(b,{children:`Enter your preferred response and voice language:`}),(0,Y.jsxs)(y,{flexDirection:`row`,gap:1,children:[(0,Y.jsx)(b,{children:o.pointer}),(0,Y.jsx)(ot,{value:r??``,onChange:i,onSubmit:te,focus:!0,showCursor:!0,placeholder:`e.g., Japanese, 日本語, Español${o.ellipsis}`,columns:60,cursorOffset:a,onChangeCursorOffset:ee})]}),(0,Y.jsx)(b,{dimColor:!0,children:`Leave empty for default (English)`})]})}var Rt,Y,zt=e((()=>{a(),Rt=t(S(),1),T(),l(),at(),Y=D()}));function Bt({onClose:e,context:t,setTabsHidden:i,onIsSearchModeChange:a,contentHeight:ee}){let{headerFocused:s,focusHeader:ne}=ve(),ie=ut(),[,l]=me(),u=he(),[d,f]=(0,Z.useState)(N()),m=X.useRef(N()),[h,g]=(0,Z.useState)(je()),ue=X.useRef(je()),[_,S]=(0,Z.useState)(h?.outputStyle||`default`),ye=X.useRef(_),[w,Se]=(0,Z.useState)(h?.language),T=X.useRef(w),[E,D]=(0,Z.useState)(0),[O,k]=(0,Z.useState)(0),[A,j]=(0,Z.useState)(!1),Oe=_e(),{rows:ke}=xe(),Fe=ee??Math.min(Math.floor(ke*.8),30),F=Math.max(5,Fe-10),I=c(e=>e.mainLoopModel),Ue=c(e=>e.verbose),Ge=c(e=>e.thinkingEnabled),Ke=c(e=>Ve()?e.fastMode:!1);c(e=>e.promptSuggestionEnabled);let Xe=Ee(h?.permissions?.defaultMode??`default`),R=te(),[Ze,Qe]=(0,Z.useState)({}),$e=X.useRef(Ge),[et]=(0,Z.useState)(()=>Ae(`localSettings`)),[tt]=(0,Z.useState)(()=>Ae(`userSettings`)),nt=X.useRef(u),rt=le(),[it]=(0,Z.useState)(()=>{let e=rt.getState();return{mainLoopModel:e.mainLoopModel,mainLoopModelForSession:e.mainLoopModelForSession,verbose:e.verbose,thinkingEnabled:e.thinkingEnabled,fastMode:e.fastMode,promptSuggestionEnabled:e.promptSuggestionEnabled,settings:e.settings}}),z=X.useRef(!1),[at,ot]=(0,Z.useState)(!1),[B,V]=(0,Z.useState)(null),{query:H,setQuery:ct,cursorOffset:lt}=bt({isActive:A&&B===null&&!s,onExit:()=>j(!1),onExitUp:ne,passthroughCtrlKeys:[`c`,`d`]}),dt=A&&!s;X.useEffect(()=>{a?.(dt)},[dt,a]);let ft=re(t.options.mcpClients),mt=!r(process.env.CLAUDE_CODE_DISABLE_FILE_CHECKPOINTING),_t=X.use(de(!0)),vt=ae(_t),U=Ne();function xt(e){L(`tengu_config_model_changed`,{from_model:I,to_model:e}),R(t=>({...t,mainLoopModel:e,mainLoopModelForSession:null})),Qe(t=>{let n=qe(e)+(ht(e,!1,Je())?` · Billed as extra usage`:``);if(`model`in t){let{model:e,...r}=t;return{...r,model:n}}return{...t,model:n}})}function St(e){P(t=>({...t,verbose:e})),f({...N(),verbose:e}),R(t=>({...t,verbose:e})),Qe(t=>{if(`verbose`in t){let{verbose:e,...n}=t;return n}return{...t,verbose:e}})}let Ct=[{id:`autoCompactEnabled`,label:`Auto-compact`,value:d.autoCompactEnabled,type:`boolean`,onChange(e){P(t=>({...t,autoCompactEnabled:e})),f({...N(),autoCompactEnabled:e}),L(`tengu_auto_compact_setting_changed`,{enabled:e})}},{id:`spinnerTipsEnabled`,label:`Show tips`,value:h?.spinnerTipsEnabled??!0,type:`boolean`,onChange(e){M(`localSettings`,{spinnerTipsEnabled:e}),g(t=>({...t,spinnerTipsEnabled:e})),L(`tengu_tips_setting_changed`,{enabled:e})}},{id:`cacheWarningEnabled`,label:`Cache warnings`,value:h?.cacheWarningEnabled??!0,type:`boolean`,onChange(e){M(`localSettings`,{cacheWarningEnabled:e}),g(t=>({...t,cacheWarningEnabled:e})),L(`tengu_cache_warning_setting_changed`,{enabled:e})}},{id:`prefersReducedMotion`,label:`Reduce motion`,value:h?.prefersReducedMotion??!1,type:`boolean`,onChange(e){M(`localSettings`,{prefersReducedMotion:e}),g(t=>({...t,prefersReducedMotion:e})),R(t=>({...t,settings:{...t.settings,prefersReducedMotion:e}})),L(`tengu_reduce_motion_setting_changed`,{enabled:e})}},{id:`thinkingEnabled`,label:`Thinking mode`,value:Ge??!0,type:`boolean`,onChange(e){R(t=>({...t,thinkingEnabled:e})),M(`userSettings`,{alwaysThinkingEnabled:e?void 0:!1}),L(`tengu_thinking_toggled`,{enabled:e})}},...Ve()&&We()?[{id:`fastMode`,label:`Fast mode (${He} only)`,value:!!Ke,type:`boolean`,onChange(e){Re(),M(`userSettings`,{fastMode:e?!0:void 0}),e?(R(e=>({...e,mainLoopModel:Be(),mainLoopModelForSession:null,fastMode:!0})),Qe(e=>({...e,model:Be(),"Fast mode":`ON`}))):(R(e=>({...e,fastMode:!1})),Qe(e=>({...e,"Fast mode":`OFF`})))}}]:[],...mt?[{id:`fileCheckpointingEnabled`,label:`Rewind code (checkpoints)`,value:d.fileCheckpointingEnabled,type:`boolean`,onChange(e){P(t=>({...t,fileCheckpointingEnabled:e})),f({...N(),fileCheckpointingEnabled:e}),L(`tengu_file_history_snapshots_setting_changed`,{enabled:e})}}]:[],{id:`verbose`,label:`Verbose output`,value:Ue,type:`boolean`,onChange:St},{id:`terminalProgressBarEnabled`,label:`Terminal progress bar`,value:d.terminalProgressBarEnabled,type:`boolean`,onChange(e){P(t=>({...t,terminalProgressBarEnabled:e})),f({...N(),terminalProgressBarEnabled:e}),L(`tengu_terminal_progress_bar_setting_changed`,{enabled:e})}},{id:`showTurnDuration`,label:`Show turn duration`,value:d.showTurnDuration,type:`boolean`,onChange(e){P(t=>({...t,showTurnDuration:e})),f({...N(),showTurnDuration:e}),L(`tengu_show_turn_duration_setting_changed`,{enabled:e})}},{id:`defaultPermissionMode`,label:`Default permission mode`,value:Xe,options:(()=>{let e=[`default`,`plan`];return[...e,...Me.filter(t=>!e.includes(t))]})(),type:`enum`,onChange(e){let t=Ee(e),n=t===`auto`?t:Te(t)?De(t):t,r=M(`userSettings`,{permissions:{...h?.permissions,defaultMode:n}});if(r.error){Le(r.error);return}g(e=>({...e,permissions:{...e?.permissions,defaultMode:n}})),Qe(t=>({...t,defaultPermissionMode:e})),L(`tengu_config_changed`,{setting:`defaultPermissionMode`,value:e})}},{id:`respectGitignore`,label:`Respect .gitignore in file picker`,value:d.respectGitignore,type:`boolean`,onChange(e){P(t=>({...t,respectGitignore:e})),f({...N(),respectGitignore:e}),L(`tengu_respect_gitignore_setting_changed`,{enabled:e})}},...se()?[{id:`copyOnSelect`,label:`Copy on select`,value:d.copyOnSelect??!0,type:`boolean`,onChange(e){P(t=>({...t,copyOnSelect:e})),f({...N(),copyOnSelect:e}),L(`tengu_config_changed`,{setting:`copyOnSelect`,value:String(e)})}}]:[],U?{id:`autoUpdatesChannel`,label:`Auto-update channel`,value:`disabled`,type:`managedEnum`,onChange(){}}:{id:`autoUpdatesChannel`,label:`Auto-update channel`,value:h?.autoUpdatesChannel??`latest`,type:`managedEnum`,onChange(){}},{id:`theme`,label:`Theme`,value:u,type:`managedEnum`,onChange:l},{id:`notifChannel`,label:`Notifications`,value:d.preferredNotifChannel,options:[`auto`,`iterm2`,`terminal_bell`,`iterm2_with_bell`,`kitty`,`ghostty`,`notifications_disabled`],type:`enum`,onChange(e){P(t=>({...t,preferredNotifChannel:e})),f({...N(),preferredNotifChannel:e})}},{id:`outputStyle`,label:`Output style`,value:_,type:`managedEnum`,onChange:()=>{}},{id:`language`,label:`Language`,value:w??`Default (English)`,type:`managedEnum`,onChange:()=>{}},{id:`editorMode`,label:`Editor mode`,value:d.editorMode===`emacs`?`normal`:d.editorMode||`normal`,options:[`normal`,`vim`],type:`enum`,onChange(e){P(t=>({...t,editorMode:e})),f({...N(),editorMode:e}),L(`tengu_editor_mode_changed`,{mode:e,source:`config_panel`})}},{id:`prStatusFooterEnabled`,label:`Show PR status footer`,value:d.prStatusFooterEnabled??!0,type:`boolean`,onChange(e){P(t=>t.prStatusFooterEnabled===e?t:{...t,prStatusFooterEnabled:e}),f({...N(),prStatusFooterEnabled:e}),L(`tengu_pr_status_footer_setting_changed`,{enabled:e})}},{id:`model`,label:`Model`,value:I===null?`Default (recommended)`:I,type:`managedEnum`,onChange:xt},...ft?[{id:`diffTool`,label:`Diff tool`,value:d.diffTool??`auto`,options:[`terminal`,`auto`],type:`enum`,onChange(e){P(t=>({...t,diffTool:e})),f({...N(),diffTool:e}),L(`tengu_diff_tool_changed`,{tool:e,source:`config_panel`})}}]:[],...oe()?[]:[{id:`autoConnectIde`,label:`Auto-connect to IDE (external terminal)`,value:d.autoConnectIde??!1,type:`boolean`,onChange(e){P(t=>({...t,autoConnectIde:e})),f({...N(),autoConnectIde:e}),L(`tengu_auto_connect_ide_changed`,{enabled:e,source:`config_panel`})}}],...oe()?[{id:`autoInstallIdeExtension`,label:`Auto-install IDE extension`,value:d.autoInstallIdeExtension??!0,type:`boolean`,onChange(e){P(t=>({...t,autoInstallIdeExtension:e})),f({...N(),autoInstallIdeExtension:e}),L(`tengu_auto_install_ide_extension_changed`,{enabled:e,source:`config_panel`})}}]:[],...vt?[{id:`showExternalIncludesDialog`,label:`External AGENTS.md includes`,value:Ie().hasAgentsMdExternalIncludesApproved?`true`:`false`,type:`managedEnum`,onChange(){}}]:[],...process.env.ANTHROPIC_API_KEY&&!n()?[{id:`apiKey`,label:(0,Q.jsxs)(b,{children:[`Use custom API key: `,(0,Q.jsx)(b,{bold:!0,children:ze(process.env.ANTHROPIC_API_KEY)})]}),searchText:`Use custom API key`,value:!!(process.env.ANTHROPIC_API_KEY&&d.customApiKeyResponses?.approved?.includes(ze(process.env.ANTHROPIC_API_KEY))),type:`boolean`,onChange(e){P(t=>{let n={...t};if(n.customApiKeyResponses||(n.customApiKeyResponses={approved:[],rejected:[]}),n.customApiKeyResponses.approved||(n.customApiKeyResponses={...n.customApiKeyResponses,approved:[]}),n.customApiKeyResponses.rejected||(n.customApiKeyResponses={...n.customApiKeyResponses,rejected:[]}),process.env.ANTHROPIC_API_KEY){let t=ze(process.env.ANTHROPIC_API_KEY);e?n.customApiKeyResponses={...n.customApiKeyResponses,approved:[...(n.customApiKeyResponses.approved??[]).filter(e=>e!==t),t],rejected:(n.customApiKeyResponses.rejected??[]).filter(e=>e!==t)}:n.customApiKeyResponses={...n.customApiKeyResponses,approved:(n.customApiKeyResponses.approved??[]).filter(e=>e!==t),rejected:[...(n.customApiKeyResponses.rejected??[]).filter(e=>e!==t),t]}}return n}),f(N())}}]:[]],W=X.useMemo(()=>{if(!H)return Ct;let e=H.toLowerCase();return Ct.filter(t=>t.id.toLowerCase().includes(e)?!0:(`searchText`in t?t.searchText:t.label).toLowerCase().includes(e))},[Ct,H]);X.useEffect(()=>{if(E>=W.length){let e=Math.max(0,W.length-1);D(e),k(Math.max(0,e-F+1));return}k(e=>E<e?E:E>=e+F?E-F+1:e)},[W.length,E,F]);let wt=(0,Z.useCallback)(e=>{k(t=>e<t?e:e>=t+F?e-F+1:t)},[F]),Tt=(0,Z.useCallback)(()=>{if(B!==null)return;let t=Object.entries(Ze).map(([e,t])=>(L(`tengu_config_changed`,{key:e,value:t}),`Set ${e} to ${C.bold(t)}`)),r=n()?void 0:process.env.ANTHROPIC_API_KEY,i=!!(r&&m.current.customApiKeyResponses?.approved?.includes(ze(r))),a=!!(r&&d.customApiKeyResponses?.approved?.includes(ze(r)));i!==a&&(t.push(`${a?`Enabled`:`Disabled`} custom API key`),L(`tengu_config_changed`,{key:`env.ANTHROPIC_API_KEY`,value:a})),d.theme!==m.current.theme&&t.push(`Set theme to ${C.bold(d.theme)}`),d.preferredNotifChannel!==m.current.preferredNotifChannel&&t.push(`Set notifications to ${C.bold(d.preferredNotifChannel)}`),_!==ye.current&&t.push(`Set output style to ${C.bold(_)}`),w!==T.current&&t.push(`Set response language to ${C.bold(w??`Default (English)`)}`),d.editorMode!==m.current.editorMode&&t.push(`Set editor mode to ${C.bold(d.editorMode||`emacs`)}`),d.diffTool!==m.current.diffTool&&t.push(`Set diff tool to ${C.bold(d.diffTool)}`),d.autoConnectIde!==m.current.autoConnectIde&&t.push(`${d.autoConnectIde?`Enabled`:`Disabled`} auto-connect to IDE`),d.autoInstallIdeExtension!==m.current.autoInstallIdeExtension&&t.push(`${d.autoInstallIdeExtension?`Enabled`:`Disabled`} auto-install IDE extension`),d.autoCompactEnabled!==m.current.autoCompactEnabled&&t.push(`${d.autoCompactEnabled?`Enabled`:`Disabled`} auto-compact`),d.respectGitignore!==m.current.respectGitignore&&t.push(`${d.respectGitignore?`Enabled`:`Disabled`} respect .gitignore in file picker`),d.copyOnSelect!==m.current.copyOnSelect&&t.push(`${d.copyOnSelect?`Enabled`:`Disabled`} copy on select`),d.terminalProgressBarEnabled!==m.current.terminalProgressBarEnabled&&t.push(`${d.terminalProgressBarEnabled?`Enabled`:`Disabled`} terminal progress bar`),d.showStatusInTerminalTab!==m.current.showStatusInTerminalTab&&t.push(`${d.showStatusInTerminalTab?`Enabled`:`Disabled`} terminal tab status`),d.showTurnDuration!==m.current.showTurnDuration&&t.push(`${d.showTurnDuration?`Enabled`:`Disabled`} turn duration`),h?.autoUpdatesChannel!==ue.current?.autoUpdatesChannel&&t.push(`Set auto-update channel to ${C.bold(h?.autoUpdatesChannel??`latest`)}`),t.length>0?e(t.join(`
2
- `)):e(`Config dialog dismissed`,{display:`system`})},[B,Ze,d,I,_,w,h?.autoUpdatesChannel,Ve()?h?.fastMode:void 0,e]),Et=(0,Z.useCallback)(()=>{u!==nt.current&&l(nt.current),P(()=>m.current);let e=et;M(`localSettings`,{spinnerTipsEnabled:e?.spinnerTipsEnabled,prefersReducedMotion:e?.prefersReducedMotion,defaultView:e?.defaultView,outputStyle:e?.outputStyle});let t=tt;M(`userSettings`,{alwaysThinkingEnabled:t?.alwaysThinkingEnabled,fastMode:t?.fastMode,promptSuggestionEnabled:t?.promptSuggestionEnabled,autoUpdatesChannel:t?.autoUpdatesChannel,minimumVersion:t?.minimumVersion,language:t?.language,syntaxHighlightingDisabled:t?.syntaxHighlightingDisabled,permissions:t?.permissions===void 0?void 0:{...t.permissions,defaultMode:t.permissions.defaultMode}});let n=it;R(e=>({...e,mainLoopModel:n.mainLoopModel,mainLoopModelForSession:n.mainLoopModelForSession,verbose:n.verbose,thinkingEnabled:n.thinkingEnabled,fastMode:n.fastMode,promptSuggestionEnabled:n.promptSuggestionEnabled,settings:n.settings,toolPermissionContext:ce(e.toolPermissionContext)}))},[u,l,et,tt,it,R]);ge(`confirm:no`,(0,Z.useCallback)(()=>{B===null&&(z.current&&Et(),e(`Config dialog dismissed`,{display:`system`}))},[B,Et,e]),{context:`Settings`,isActive:B===null&&!A&&!s}),ge(`settings:close`,Tt,{context:`Settings`,isActive:B===null&&!A&&!s});let G=(0,Z.useCallback)(()=>{let e=W[E];if(e?.onChange){if(e.type===`boolean`){z.current=!0,e.onChange(!e.value),e.id===`thinkingEnabled`&&(!e.value===$e.current?ot(!1):t.messages.some(e=>e.type===`assistant`)&&ot(!0));return}if(e.id===`theme`||e.id===`model`||e.id===`showExternalIncludesDialog`||e.id===`outputStyle`||e.id===`language`)switch(e.id){case`theme`:V(`Theme`),i(!0);return;case`model`:V(`Model`),i(!0);return;case`showExternalIncludesDialog`:V(`ExternalIncludes`),i(!0);return;case`outputStyle`:V(`OutputStyle`),i(!0);return;case`language`:V(`Language`),i(!0);return}if(e.id===`autoUpdatesChannel`){if(U){V(`EnableAutoUpdates`),i(!0);return}(h?.autoUpdatesChannel??`latest`)===`latest`?(V(`ChannelDowngrade`),i(!0)):(z.current=!0,M(`userSettings`,{autoUpdatesChannel:`latest`,minimumVersion:void 0}),g(e=>({...e,autoUpdatesChannel:`latest`,minimumVersion:void 0})),L(`tengu_autoupdate_channel_changed`,{channel:`latest`}));return}if(e.type===`enum`){z.current=!0;let t=(e.options.indexOf(e.value)+1)%e.options.length;e.onChange(e.options[t]);return}}},[U,W,E,h?.autoUpdatesChannel,i]),K=e=>{ot(!1);let t=Math.max(0,Math.min(W.length-1,E+e));D(t),wt(t)};return pe({"select:previous":()=>{E===0?(ot(!1),j(!0),k(0)):K(-1)},"select:next":()=>K(1),"scroll:lineUp":()=>K(-1),"scroll:lineDown":()=>K(1),"select:accept":G,"select:previousValue":()=>G(),"select:nextValue":()=>G(),"settings:search":()=>{j(!0),ct(``)}},{context:`Settings`,isActive:B===null&&!A&&!s}),(0,Q.jsx)(y,{flexDirection:`column`,width:`100%`,tabIndex:0,autoFocus:!0,onKeyDown:(0,Z.useCallback)(e=>{if(B===null&&!s){if(A){if(e.key===`escape`){e.preventDefault(),H.length>0?ct(``):j(!1);return}(e.key===`return`||e.key===`down`||e.key===`wheeldown`)&&(e.preventDefault(),j(!1),D(0),k(0));return}if(e.key===`left`||e.key===`right`||e.key===`tab`){e.preventDefault(),G();return}e.ctrl||e.meta||e.key===`j`||e.key===`k`||e.key===`/`||e.key.length===1&&e.key!==` `&&(e.preventDefault(),j(!0),ct(e.key))}},[B,s,A,H,ct,G]),children:B===`Theme`?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(pt,{onThemeSelect:e=>{z.current=!0,l(e),V(null),i(!1)},onCancel:()=>{V(null),i(!1)},hideEscToCancel:!0,skipExitHandling:!0}),(0,Q.jsx)(y,{children:(0,Q.jsx)(b,{dimColor:!0,italic:!0,children:(0,Q.jsxs)(x,{children:[(0,Q.jsx)(v,{shortcut:`Enter`,action:`select`}),(0,Q.jsx)(p,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})]})})})]}):B===`Model`?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(gt,{initial:I,onSelect:e=>{z.current=!0,xt(e),V(null),i(!1)},onCancel:()=>{V(null),i(!1)},showFastModeNotice:Ve()?Ke&&Ye(I)&&We():!1}),(0,Q.jsx)(b,{dimColor:!0,children:(0,Q.jsxs)(x,{children:[(0,Q.jsx)(v,{shortcut:`Enter`,action:`confirm`}),(0,Q.jsx)(p,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})]})})]}):B===`ExternalIncludes`?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(yt,{onDone:()=>{V(null),i(!1)},externalIncludes:fe(_t)}),(0,Q.jsx)(b,{dimColor:!0,children:(0,Q.jsxs)(x,{children:[(0,Q.jsx)(v,{shortcut:`Enter`,action:`confirm`}),(0,Q.jsx)(p,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`disable external includes`})]})})]}):B===`OutputStyle`?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Mt,{initialStyle:_,onComplete:e=>{z.current=!0,S(e??`default`),V(null),i(!1),M(`localSettings`,{outputStyle:e}),L(`tengu_output_style_changed`,{style:e??`default`,source:`config_panel`,settings_source:`localSettings`})},onCancel:()=>{V(null),i(!1)}}),(0,Q.jsx)(b,{dimColor:!0,children:(0,Q.jsxs)(x,{children:[(0,Q.jsx)(v,{shortcut:`Enter`,action:`confirm`}),(0,Q.jsx)(p,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})]})})]}):B===`Language`?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Lt,{initialLanguage:w,onComplete:e=>{z.current=!0,Se(e),V(null),i(!1),M(`userSettings`,{language:e}),L(`tengu_language_changed`,{language:e??`default`,source:`config_panel`})},onCancel:()=>{V(null),i(!1)}}),(0,Q.jsx)(b,{dimColor:!0,children:(0,Q.jsxs)(x,{children:[(0,Q.jsx)(v,{shortcut:`Enter`,action:`confirm`}),(0,Q.jsx)(p,{action:`confirm:no`,context:`Settings`,fallback:`Esc`,description:`cancel`})]})})]}):B===`EnableAutoUpdates`?(0,Q.jsx)(Ce,{title:`Enable Auto-Updates`,onCancel:()=>{V(null),i(!1)},hideBorder:!0,hideInputGuide:!0,children:U?.type===`config`?(0,Q.jsx)(st,{options:[{label:`Enable with latest channel`,value:`latest`},{label:`Enable with stable channel`,value:`stable`}],onChange:e=>{z.current=!0,V(null),i(!1),P(e=>({...e,autoUpdates:!0})),f({...N(),autoUpdates:!0}),M(`userSettings`,{autoUpdatesChannel:e,minimumVersion:void 0}),g(t=>({...t,autoUpdatesChannel:e,minimumVersion:void 0})),L(`tengu_autoupdate_enabled`,{channel:e})}}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(b,{children:U?.type===`env`?`Auto-updates are controlled by an environment variable and cannot be changed here.`:`Auto-updates are disabled in development builds.`}),U?.type===`env`&&(0,Q.jsxs)(b,{dimColor:!0,children:[`Unset `,U.envVar,` to re-enable auto-updates.`]})]})}):B===`ChannelDowngrade`?(0,Q.jsx)(Ot,{currentVersion:`0.0.22`,onChoice:e=>{if(V(null),i(!1),e===`cancel`)return;z.current=!0;let t={autoUpdatesChannel:`stable`};e===`stay`&&(t.minimumVersion=`0.0.22`),M(`userSettings`,t),g(e=>({...e,...t})),L(`tengu_autoupdate_channel_changed`,{channel:`stable`,minimum_version_set:e===`stay`})}}):(0,Q.jsxs)(y,{flexDirection:`column`,gap:1,marginY:ie?void 0:1,children:[(0,Q.jsx)(be,{query:H,isFocused:A&&!s,isTerminalFocused:Oe,cursorOffset:lt,placeholder:`Search settings…`}),(0,Q.jsx)(y,{flexDirection:`column`,children:W.length===0?(0,Q.jsxs)(b,{dimColor:!0,italic:!0,children:[`No settings match "`,H,`"`]}):(0,Q.jsxs)(Q.Fragment,{children:[O>0&&(0,Q.jsxs)(b,{dimColor:!0,children:[o.arrowUp,` `,O,` more above`]}),W.slice(O,O+F).map((e,t)=>{let n=O+t===E&&!s&&!A;return(0,Q.jsx)(X.Fragment,{children:(0,Q.jsxs)(y,{width:`100%`,children:[(0,Q.jsx)(y,{width:44,children:(0,Q.jsxs)(b,{color:n?`suggestion`:void 0,children:[n?o.pointer:` `,` `,e.label]})}),(0,Q.jsx)(y,{flexGrow:1,children:e.type===`boolean`?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(b,{color:n?`suggestion`:void 0,children:e.value.toString()}),at&&e.id===`thinkingEnabled`&&(0,Q.jsxs)(b,{color:`warning`,children:[` `,`Changing thinking mode mid-conversation will increase latency and may reduce quality.`]})]}):e.id===`theme`?(0,Q.jsx)(b,{color:n?`suggestion`:void 0,children:Ht[e.value.toString()]??e.value.toString()}):e.id===`notifChannel`?(0,Q.jsx)(b,{color:n?`suggestion`:void 0,children:(0,Q.jsx)(Vt,{value:e.value.toString()})}):e.id===`defaultPermissionMode`?(0,Q.jsx)(b,{color:n?`suggestion`:void 0,children:we(e.value)}):e.id===`autoUpdatesChannel`&&U?(0,Q.jsxs)(y,{flexDirection:`column`,children:[(0,Q.jsx)(b,{color:n?`suggestion`:void 0,children:`disabled`}),(0,Q.jsxs)(b,{dimColor:!0,children:[`(`,Pe(U),`)`]})]}):(0,Q.jsx)(b,{color:n?`suggestion`:void 0,children:e.value.toString()})})]})},e.id)}),O+F<W.length&&(0,Q.jsxs)(b,{dimColor:!0,children:[o.arrowDown,` `,W.length-O-F,` more below`]})]})}),s?(0,Q.jsx)(b,{dimColor:!0,children:(0,Q.jsxs)(x,{children:[(0,Q.jsx)(v,{shortcut:`←/→ tab`,action:`switch`}),(0,Q.jsx)(v,{shortcut:`↓`,action:`return`}),(0,Q.jsx)(p,{action:`confirm:no`,context:`Settings`,fallback:`Esc`,description:`close`})]})}):A?(0,Q.jsx)(b,{dimColor:!0,children:(0,Q.jsxs)(x,{children:[(0,Q.jsx)(b,{children:`Type to filter`}),(0,Q.jsx)(v,{shortcut:`Enter/↓`,action:`select`}),(0,Q.jsx)(v,{shortcut:`↑`,action:`tabs`}),(0,Q.jsx)(p,{action:`confirm:no`,context:`Settings`,fallback:`Esc`,description:`clear`})]})}):(0,Q.jsx)(b,{dimColor:!0,children:(0,Q.jsxs)(x,{children:[(0,Q.jsx)(p,{action:`select:accept`,context:`Settings`,fallback:`Space`,description:`change`}),(0,Q.jsx)(p,{action:`settings:close`,context:`Settings`,fallback:`Enter`,description:`save`}),(0,Q.jsx)(p,{action:`settings:search`,context:`Settings`,fallback:`/`,description:`search`}),(0,Q.jsx)(p,{action:`confirm:no`,context:`Settings`,fallback:`Esc`,description:`cancel`})]})})]})})}function Vt({value:e}){switch(e){case`auto`:return`Auto`;case`iterm2`:return(0,Q.jsxs)(b,{children:[`iTerm2 `,(0,Q.jsx)(b,{dimColor:!0,children:`(OSC 9)`})]});case`terminal_bell`:return(0,Q.jsxs)(b,{children:[`Terminal Bell `,(0,Q.jsx)(b,{dimColor:!0,children:`(\\a)`})]});case`kitty`:return(0,Q.jsxs)(b,{children:[`Kitty `,(0,Q.jsx)(b,{dimColor:!0,children:`(OSC 99)`})]});case`ghostty`:return(0,Q.jsxs)(b,{children:[`Ghostty `,(0,Q.jsx)(b,{dimColor:!0,children:`(OSC 777)`})]});case`iterm2_with_bell`:return`iTerm2 w/ Bell`;case`notifications_disabled`:return`Disabled`;default:return e}}var X,Z,Q,Ht,Ut=e((()=>{T(),X=t(S(),1),Z=t(S(),1),l(),a(),Fe(),Ge(),ye(),ke(),f(),F(),I(),ft(),ne(),mt(),Ke(),_t(),vt(),At(),dt(),It(),zt(),s(),d(),lt(),U(),ie(),Oe(),m(),i(),xt(),u(),Ue(),_(),Q=D(),Ht={auto:`Auto (match terminal)`,dark:`Dark mode`,light:`Light mode`,"dark-daltonized":`Dark mode (colorblind-friendly)`,"light-daltonized":`Light mode (colorblind-friendly)`,"dark-ansi":`Dark mode (ANSI colors only)`,"light-ansi":`Light mode (ANSI colors only)`}}));function Wt({onClose:e,context:t,defaultTab:n}){let[r,i]=(0,Gt.useState)(n),[a,o]=(0,Gt.useState)(!1),[ee,te]=(0,Gt.useState)(!1),s=ut(),{rows:ne}=ct(xe()),re=s?ne+1:Math.max(15,Math.min(Math.floor(ne*.8),30)),[c]=(0,Gt.useState)(()=>W().catch(()=>[]));return B(),ge(`confirm:no`,()=>{a||e(`Status dialog dismissed`,{display:`system`})},{context:`Settings`,isActive:!a&&!(r===`Config`&&ee)}),(0,$.jsx)(E,{color:`permission`,children:(0,$.jsx)(Se,{color:`permission`,selectedTab:r,onTabChange:i,hidden:a,initialHeaderFocused:n!==`Config`,contentHeight:a||s?void 0:re,children:[(0,$.jsx)(w,{title:`Status`,children:(0,$.jsx)(Tt,{context:t,diagnosticsPromise:c})},`status`),(0,$.jsx)(w,{title:`Config`,children:(0,$.jsx)(Gt.Suspense,{fallback:null,children:(0,$.jsx)(Bt,{context:t,onClose:e,setTabsHidden:o,onIsSearchModeChange:te,contentHeight:re})})},`config`)]})})}var Gt,$,Kt=e((()=>{Gt=t(S(),1),l(),V(),u(),lt(),T(),Dt(),Ut(),$=D()}));export{Kt as n,Wt as t};
@@ -1 +0,0 @@
1
- import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{n,t as r}from"./defineProperty-C-QyHrDq.js";import{a as i,c as a,i as o,n as s,o as c,r as l,s as u,t as d}from"./classPrivateFieldSet2-D4U5K-I3.js";import{n as f,t as p}from"./classPrivateMethodInitSpec-BXQD0Vh4.js";import{n as m,t as h}from"./figures-5ThXQEtq.js";import{Ap as g,Cb as _,Cp as v,Dp as y,Eb as b,Mb as x,Op as S,Sb as C,Tb as w,Yb as ee,bb as te,hs as ne,jb as re,ms as T,ow as ie,sw as ae,wb as E,wp as oe,xb as se}from"./loadAgentsDir-C1LkW7gl.js";import{Gr as D,H as ce,I as O,P as k,T as le,ai as A,mt as ue,ot as de,t as j}from"./src-DL3w8VPk.js";import{t as M}from"./jsx-runtime-Bb4Xn-E0.js";import{$n as N,Qn as fe,m as pe,zt as me}from"./state-BowF111d.js";import{Jn as he,h as ge,qn as P,t as F}from"./settings-DKN4xSpQ.js";import{c as _e,m as ve}from"./config-BddEvZZl.js";import{n as ye,o as be}from"./intl-D2kgJmX7.js";import{S as xe,_ as Se,f as Ce,l as we}from"./startupProfiler-DTs9w9EN.js";import{o as Te}from"./TextInput-7uqPhq9T.js";import{a as Ee,c as De,l as Oe,n as ke,o as Ae,r as je,s as Me,t as Ne,u as Pe}from"./SpinnerGlyph-A6G-gloN.js";import{watch as Fe}from"fs";var Ie,Le,Re=e((()=>{me(),n(),Ie=class e{constructor(e){r(this,`activeOperations`,new Set),r(this,`lastUserActivityTime`,0),r(this,`lastCLIRecordedTime`,void 0),r(this,`isCLIActive`,!1),r(this,`USER_ACTIVITY_TIMEOUT_MS`,5e3),r(this,`getNow`,void 0),r(this,`getActiveTimeCounter`,void 0),this.getNow=e?.getNow??(()=>Date.now()),this.getActiveTimeCounter=e?.getActiveTimeCounter??pe,this.lastCLIRecordedTime=this.getNow()}static getInstance(){return e.instance||(e.instance=new e),e.instance}static resetInstance(){e.instance=null}static createInstance(t){return e.instance=new e(t),e.instance}recordUserActivity(){if(!this.isCLIActive&&this.lastUserActivityTime!==0){let e=(this.getNow()-this.lastUserActivityTime)/1e3;if(e>0){let t=this.getActiveTimeCounter();t&&e<this.USER_ACTIVITY_TIMEOUT_MS/1e3&&t.add(e,{type:`user`})}}this.lastUserActivityTime=this.getNow()}startCLIActivity(e){this.activeOperations.has(e)&&this.endCLIActivity(e);let t=this.activeOperations.size===0;this.activeOperations.add(e),t&&(this.isCLIActive=!0,this.lastCLIRecordedTime=this.getNow())}endCLIActivity(e){if(this.activeOperations.delete(e),this.activeOperations.size===0){let e=this.getNow(),t=(e-this.lastCLIRecordedTime)/1e3;if(t>0){let e=this.getActiveTimeCounter();e&&e.add(t,{type:`cli`})}this.lastCLIRecordedTime=e,this.isCLIActive=!1}}async trackOperation(e,t){this.startCLIActivity(e);try{return await t()}finally{this.endCLIActivity(e)}}getActivityStates(){return{isUserActive:(this.getNow()-this.lastUserActivityTime)/1e3<this.USER_ACTIVITY_TIMEOUT_MS/1e3,isCLIActive:this.isCLIActive,activeOperationCount:this.activeOperations.size}}},r(Ie,`instance`,null),Le=Ie.getInstance()}));function ze(){let e=F().spinnerVerbs;return e?e.mode===`replace`?e.verbs.length>0?e.verbs:Be:[...Be,...e.verbs]:Be}var Be,Ve=e((()=>{ge(),Be=`Accomplishing.Actioning.Actualizing.Architecting.Baking.Beaming.Beboppin'.Befuddling.Billowing.Blanching.Bloviating.Boogieing.Boondoggling.Booping.Bootstrapping.Brewing.Bunning.Burrowing.Calculating.Canoodling.Caramelizing.Cascading.Catapulting.Cerebrating.Channeling.Channelling.Choreographing.Churning.Clauding.Coalescing.Cogitating.Combobulating.Composing.Computing.Concocting.Considering.Contemplating.Cooking.Crafting.Creating.Crunching.Crystallizing.Cultivating.Deciphering.Deliberating.Determining.Dilly-dallying.Discombobulating.Doing.Doodling.Drizzling.Ebbing.Effecting.Elucidating.Embellishing.Enchanting.Envisioning.Evaporating.Fermenting.Fiddle-faddling.Finagling.Flambéing.Flibbertigibbeting.Flowing.Flummoxing.Fluttering.Forging.Forming.Frolicking.Frosting.Gallivanting.Galloping.Garnishing.Generating.Gesticulating.Germinating.Gitifying.Grooving.Gusting.Harmonizing.Hashing.Hatching.Herding.Honking.Hullaballooing.Hyperspacing.Ideating.Imagining.Improvising.Incubating.Inferring.Infusing.Ionizing.Jitterbugging.Julienning.Kneading.Leavening.Levitating.Lollygagging.Manifesting.Marinating.Meandering.Metamorphosing.Misting.Moonwalking.Moseying.Mulling.Mustering.Musing.Nebulizing.Nesting.Newspapering.Noodling.Nucleating.Orbiting.Orchestrating.Osmosing.Perambulating.Percolating.Perusing.Philosophising.Photosynthesizing.Pollinating.Pondering.Pontificating.Pouncing.Precipitating.Prestidigitating.Processing.Proofing.Propagating.Puttering.Puzzling.Quantumizing.Razzle-dazzling.Razzmatazzing.Recombobulating.Reticulating.Roosting.Ruminating.Sautéing.Scampering.Schlepping.Scurrying.Seasoning.Shenaniganing.Shimmying.Simmering.Skedaddling.Sketching.Slithering.Smooshing.Sock-hopping.Spelunking.Spinning.Sprouting.Stewing.Sublimating.Swirling.Swooping.Symbioting.Synthesizing.Tempering.Thinking.Thundering.Tinkering.Tomfoolering.Topsy-turvying.Transfiguring.Transmuting.Twisting.Undulating.Unfurling.Unravelling.Vibing.Waddling.Wandering.Warping.Whatchamacalliting.Whirlpooling.Whirring.Whisking.Wibbling.Working.Wrangling.Zesting.Zigzagging`.split(`.`)}));function I(e,t){let n=parseInt(e.id,10),r=parseInt(t.id,10);return!isNaN(n)&&!isNaN(r)?n-r:e.id.localeCompare(t.id)}function He({tasks:e,isStandalone:t=!1}){let[,n]=L.useState(0),{rows:r,columns:i}=de(),a=L.useRef(new Map),o=L.useRef(null);o.current===null&&(o.current=new Set(e.filter(e=>e.status===`completed`).map(e=>e.id)));let s=r<=10?0:Math.min(10,Math.max(3,r-14)),c=new Set(e.filter(e=>e.status===`completed`).map(e=>e.id)),l=Date.now();for(let e of c)o.current.has(e)||a.current.set(e,l);for(let e of a.current.keys())c.has(e)||a.current.delete(e);if(o.current=c,L.useEffect(()=>{if(a.current.size===0)return;let e=Date.now(),t=1/0;for(let n of a.current.values()){let r=n+Ge;r>e&&r<t&&(t=r)}if(t===1/0)return;let r=setTimeout(e=>e(e=>e+1),t-e,n);return()=>clearTimeout(r)},[e]),!_()||e.length===0)return null;let u=P(e,e=>e.status===`completed`),d=P(e,e=>e.status===`pending`),f=e.length-u-d,p=new Set(e.filter(e=>e.status!==`completed`).map(e=>e.id)),m=e.length>s,h,g;if(m){let t=[],n=[];for(let r of e.filter(e=>e.status===`completed`)){let e=a.current.get(r.id);e&&l-e<Ge?t.push(r):n.push(r)}t.sort(I),n.sort(I);let r=e.filter(e=>e.status===`in_progress`).sort(I),i=e.filter(e=>e.status===`pending`).sort((e,t)=>{let n=e.blockedBy.some(e=>p.has(e));return n===t.blockedBy.some(e=>p.has(e))?I(e,t):n?1:-1}),o=[...t,...r,...i,...n];h=o.slice(0,s),g=o.slice(s)}else h=[...e].sort(I),g=[];let v=``;if(g.length>0){let e=[],t=P(g,e=>e.status===`pending`),n=P(g,e=>e.status===`in_progress`),r=P(g,e=>e.status===`completed`);n>0&&e.push(`${n} in progress`),t>0&&e.push(`${t} pending`),r>0&&e.push(`${r} completed`),v=` … +${e.join(`, `)}`}let y=(0,R.jsxs)(R.Fragment,{children:[h.map(e=>(0,R.jsx)(We,{task:e,openBlockers:e.blockedBy.filter(e=>p.has(e)),columns:i},e.id)),s>0&&v&&(0,R.jsx)(k,{dimColor:!0,children:v})]});return t?(0,R.jsxs)(O,{flexDirection:`column`,marginTop:1,marginLeft:2,children:[(0,R.jsx)(O,{children:(0,R.jsxs)(k,{dimColor:!0,children:[(0,R.jsx)(k,{bold:!0,children:e.length}),` tasks (`,(0,R.jsx)(k,{bold:!0,children:u}),` done, `,f>0&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(k,{bold:!0,children:f}),` in progress, `]}),(0,R.jsx)(k,{bold:!0,children:d}),` open)`]})}),y]}):(0,R.jsx)(O,{flexDirection:`column`,children:y})}function Ue(e){switch(e){case`completed`:return{icon:h.tick,color:`success`};case`in_progress`:return{icon:h.squareSmallFilled,color:`claude`};case`pending`:return{icon:h.squareSmall,color:void 0}}}function We({task:e,openBlockers:t,columns:n}){let r=e.status===`completed`,i=e.status===`in_progress`,a=t.length>0,{icon:o,color:s}=Ue(e.status),c=Math.max(15,n-15),l=xe(e.subject,c);return(0,R.jsx)(O,{flexDirection:`column`,children:(0,R.jsxs)(O,{children:[(0,R.jsxs)(k,{color:s,children:[o,` `]}),(0,R.jsx)(k,{bold:i,strikethrough:r,dimColor:r||a,children:l}),a&&(0,R.jsxs)(k,{dimColor:!0,children:[` `,h.pointerSmall,` blocked by`,` `,[...t].sort((e,t)=>parseInt(e,10)-parseInt(t,10)).map(e=>`#${e}`).join(`, `)]})]})})}var L,R,Ge,Ke=e((()=>{m(),L=t(A(),1),ee(),j(),he(),Se(),C(),R=M(),Ge=3e4}));function qe(){l(at,this).emit()}function Je(e){if(!(e===l(H,this)&&l(V,this)!==null)){l(V,this)?.close(),d(V,this,null),d(H,this,e);try{d(V,this,Fe(e,l(st,this))),l(V,this).unref()}catch{}}}function Ye(e){d(U,this,null);let t=te();t===e&&E(t).then(async e=>{e.length>0&&e.every(e=>e.status===`completed`)&&(await b(t),d(z,this,[]),d(B,this,!0)),i(J,this,qe).call(this)})}function Xe(){l(U,this)&&(clearTimeout(l(U,this)),d(U,this,null))}function Ze(){l(V,this)?.close(),d(V,this,null),d(H,this,null),l(K,this)?.call(this),d(K,this,null),i(J,this,Xe).call(this),l(W,this)&&clearTimeout(l(W,this)),l(G,this)&&clearTimeout(l(G,this)),d(W,this,null),d(G,this,null),d(ot,this,!1)}function Qe(){return ut??(ut=new lt)}function $e(){let e=_()?Qe():null;return(0,tt.useSyncExternalStore)(e?e.subscribe:ft,e?e.getSnapshot:pt)}function et(){let e=$e(),t=g(),n=e===void 0;return(0,tt.useEffect)(()=>{n&&t(e=>e.expandedView===`tasks`?{...e,expandedView:`none`}:e)},[n,t]),e}var tt,nt,rt,it,z,B,V,H,U,W,G,K,at,q,ot,J,st,ct,lt,ut,dt,ft,pt,mt=e((()=>{tt=t(A(),1),y(),N(),C(),f(),a(),n(),o(),s(),c(),nt=5e3,rt=50,it=5e3,z=new WeakMap,B=new WeakMap,V=new WeakMap,H=new WeakMap,U=new WeakMap,W=new WeakMap,G=new WeakMap,K=new WeakMap,at=new WeakMap,q=new WeakMap,ot=new WeakMap,J=new WeakSet,st=new WeakMap,ct=new WeakMap,lt=class{constructor(){p(this,J),u(this,z,void 0),u(this,B,!1),u(this,V,null),u(this,H,null),u(this,U,null),u(this,W,null),u(this,G,null),u(this,K,null),u(this,at,fe()),u(this,q,0),u(this,ot,!1),r(this,`getSnapshot`,()=>l(B,this)?void 0:l(z,this)),r(this,`subscribe`,e=>{var t;let n=l(at,this).subscribe(e);d(q,this,(t=l(q,this),t++,t)),l(ot,this)||(d(ot,this,!0),d(K,this,w(l(st,this))),l(ct,this).call(this));let r=!1;return()=>{var e;r||(r=!0,n(),d(q,this,(e=l(q,this),e--,e)),l(q,this)===0&&i(J,this,Ze).call(this))}}),u(this,st,()=>{l(W,this)&&clearTimeout(l(W,this)),d(W,this,setTimeout(()=>void l(ct,this).call(this),rt)),l(W,this).unref()}),u(this,ct,async()=>{let e=te();i(J,this,Je).call(this,se(e));let t=(await E(e)).filter(e=>!e.metadata?._internal);d(z,this,t);let n=t.some(e=>e.status!==`completed`);n||t.length===0?(d(B,this,t.length===0),i(J,this,Xe).call(this)):l(U,this)===null&&!l(B,this)&&(d(U,this,setTimeout(i(J,this,Ye).bind(this,e),nt)),l(U,this).unref()),i(J,this,qe).call(this),l(G,this)&&(clearTimeout(l(G,this)),d(G,this,null)),n&&(d(G,this,setTimeout(l(st,this),it)),l(G,this).unref())})}},ut=null,dt=()=>{},ft=()=>dt,pt=()=>void 0})),ht=e((()=>{j(),Pe(),M()}));function gt({message:e,mode:t,messageColor:n,glimmerIndex:r,flashOpacity:i,shimmerColor:a,stalledIntensity:o=0}){let[s]=ce(),c=Oe(s),{segments:l,messageWidth:u}=_t.useMemo(()=>{let t=[];for(let{segment:n}of ye().segment(e))t.push({segment:n,width:D(n)});return{segments:t,messageWidth:D(e)}},[e]);if(!e)return null;if(o>0){let t=c[n],r=t?Me(t):null;if(r){let t=De(Ae(r,vt,o));return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(k,{color:t,children:e}),(0,Y.jsx)(k,{color:t,children:` `})]})}let i=o>.5?`error`:n;return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(k,{color:i,children:e}),(0,Y.jsx)(k,{color:i,children:` `})]})}if(t===`tool-use`){let t=c[n],r=c[a],o=t?Me(t):null,s=r?Me(r):null;return o&&s?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(k,{color:De(Ae(o,s,i)),children:e}),(0,Y.jsx)(k,{color:n,children:` `})]}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(k,{color:i>.5?a:n,children:e}),(0,Y.jsx)(k,{color:n,children:` `})]})}let d=r-1,f=r+1;if(d>=u||f<0)return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(k,{color:n,children:e}),(0,Y.jsx)(k,{color:n,children:` `})]});let p=Math.max(0,d),m=0,h=``,g=``,_=``;for(let{segment:e,width:t}of l)m+t<=p?h+=e:m>f?_+=e:g+=e,m+=t;return(0,Y.jsxs)(Y.Fragment,{children:[h&&(0,Y.jsx)(k,{color:n,children:h}),(0,Y.jsx)(k,{color:a,children:g}),_&&(0,Y.jsx)(k,{color:n,children:_}),(0,Y.jsx)(k,{color:n,children:` `})]})}var _t,Y,vt,yt=e((()=>{_t=t(A(),1),j(),be(),Pe(),Ee(),Y=M(),vt={r:171,g:43,b:63}}));function bt(e,t,n){let r=e===`requesting`?50:200,[i,a]=ue(n?null:r),o=(0,xt.useMemo)(()=>D(t),[t]);if(n)return[i,-100];let s=Math.floor(a/r),c=o+20;return e===`requesting`?[i,s%c-10]:[i,o+10-s%c]}var xt,St=e((()=>{xt=t(A(),1),j()}));function Ct(e,t,n=!1,r=!1){let i=(0,X.useRef)(e),a=(0,X.useRef)(t),o=(0,X.useRef)(e),s=(0,X.useRef)(0),c=(0,X.useRef)(e);t>a.current&&(i.current=e,a.current=t,s.current=0,c.current=e);let l;n?(l=0,i.current=e):l=t>0?e-i.current:e-o.current;let u=l>3e3&&!n,d=u?Math.min((l-3e3)/2e3,1):0;if(!r&&(d>0||s.current>0)){let t=e-c.current;if(t>=50){let n=Math.floor(t/50),r=s.current;for(let e=0;e<n;e++){let e=d-r;if(Math.abs(e)<.01){r=d;break}r+=e*.1}s.current=r,c.current=e}}else s.current=d,c.current=e;return{isStalled:u,stalledIntensity:r?d:s.current}}var X,wt=e((()=>{X=t(A(),1)})),Tt=e((()=>{ht(),yt(),Te(),ke(),St(),wt(),Ee()}));function Et({mode:e,reducedMotion:t,hasActiveTools:n,responseLengthRef:r,message:i,messageColor:a,shimmerColor:o,overrideColor:s,loadingStartTimeRef:c,totalPausedMsRef:l,pauseStartTimeRef:u,spinnerSuffix:d,verbose:f,columns:p,agentTokens:m,leaderIsIdle:g=!1,thinkingStatus:_}){let[v,y]=ue(t?null:50),b=Date.now(),x=u.current===null?b-c.current-l.current:u.current-c.current-l.current,S=r.current,{isStalled:C,stalledIntensity:w}=Ct(y,S,n||g,t),ee=t?0:Math.floor(y/120),te=e===`requesting`?50:200,ne=(0,Ot.useMemo)(()=>D(i),[i]),re=ne+20,T=Math.floor(y/te),ie=t||C?-100:e===`requesting`?T%re-10:ne+10-T%re,ae=t?0:e===`tool-use`?(Math.sin(y/1e3*Math.PI)+1)/2:0,E=(0,Ot.useRef)(S);if(t)E.current=S;else{let e=S-E.current;if(e>0){let t;t=e<70?3:e<200?Math.max(8,Math.ceil(e*.15)):50,E.current=Math.min(E.current+t,S)}}let oe=E.current,se=Math.round(oe/4),ce=we(x),A=D(ce),de=se+m,j=Ce(de),M=D(`${h.arrowDown} ${j} tokens`),N=_===`thinking`?`thinking`:typeof _==`number`?`thought for ${Math.max(1,Math.round(_/1e3))}s`:null,fe=N?D(N):0,pe=ne+2,me=kt,he=_!==null,ge=f||x>jt,P=p-pe-5,F=he&&P>fe;!F&&he&&_===`thinking`&&P>At&&(N=`thinking`,fe=At,F=!0);let _e=F?fe+me:0,ve=ge&&P>_e+A,ye=_e+(ve?A+me:0),be=ge&&de>0&&P>ye+M,xe=F&&_===`thinking`&&!d&&!ve&&!be&&!0,Se=(y-Pt)/1e3,Te=y<Pt?0:(Math.sin(Se*Math.PI*2/Ft)+1)/2,Ee=De(Ae(Mt,Nt,Te)),Oe=[...d?[(0,Z.jsx)(k,{dimColor:!0,children:d},`suffix`)]:[],...ve?[(0,Z.jsx)(k,{dimColor:!0,children:ce},`elapsedTime`)]:[],...be?[(0,Z.jsxs)(O,{flexDirection:`row`,children:[(0,Z.jsx)(Dt,{mode:e}),(0,Z.jsxs)(k,{dimColor:!0,children:[j,` tokens`]})]},`tokens`)]:[],...F&&N?[_===`thinking`&&!t?(0,Z.jsx)(k,{color:Ee,children:xe?`(${N})`:N},`thinking`):(0,Z.jsx)(k,{dimColor:!0,children:N},`thinking`)]:[]],ke=Oe.length>0?xe?(0,Z.jsx)(le,{children:Oe}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(k,{dimColor:!0,children:`(`}),(0,Z.jsx)(le,{children:Oe}),(0,Z.jsx)(k,{dimColor:!0,children:`)`})]}):null;return(0,Z.jsxs)(O,{ref:v,flexDirection:`row`,flexWrap:`wrap`,marginTop:1,width:`100%`,children:[(0,Z.jsx)(Ne,{frame:ee,messageColor:a,stalledIntensity:s?0:w,reducedMotion:t,time:y}),(0,Z.jsx)(gt,{message:i,mode:e,messageColor:a,glimmerIndex:ie,flashOpacity:ae,shimmerColor:o,stalledIntensity:s?0:w}),ke]})}function Dt({mode:e}){switch(e){case`tool-input`:case`tool-use`:case`responding`:case`thinking`:return(0,Z.jsx)(O,{width:2,children:(0,Z.jsx)(k,{dimColor:!0,children:h.arrowDown})});case`requesting`:return(0,Z.jsx)(O,{width:2,children:(0,Z.jsx)(k,{dimColor:!0,children:h.arrowUp})})}}var Ot,Z,kt,At,jt,Mt,Nt,Pt,Ft,It=e((()=>{m(),Ot=t(A(),1),j(),Se(),yt(),ke(),wt(),Ee(),Z=M(),kt=D(` · `),At=D(`thinking`),jt=3e4,Mt={r:153,g:153,b:153},Nt={r:185,g:185,b:185},Pt=3e3,Ft=2}));function Lt(e){return(0,$.jsx)(Rt,{...e})}function Rt({mode:e,loadingStartTimeRef:t,totalPausedMsRef:n,pauseStartTimeRef:r,spinnerTip:i,responseLengthRef:a,overrideColor:o,overrideShimmerColor:s,overrideMessage:c,spinnerSuffix:l,verbose:u,hasActiveTools:d=!1,leaderIsIdle:f=!1}){let p=oe(),m=p.prefersReducedMotion??!1,h=S(e=>e.tasks),g=S(e=>e.expandedView)===`tasks`,{columns:_}=de(),v=$e(),[y,b]=(0,Q.useState)(null),x=(0,Q.useRef)(null);(0,Q.useEffect)(()=>{let t=null,n=null;if(e===`thinking`)x.current===null&&(x.current=Date.now(),b(`thinking`));else if(x.current!==null){let e=Date.now()-x.current,r=Date.now()-x.current,i=Math.max(0,2e3-r);x.current=null;let a=()=>{b(e),n=setTimeout(b,2e3,null)};i>0?t=setTimeout(a,i):a()}return()=>{t&&clearTimeout(t),n&&clearTimeout(n)}},[e]);let C=v?.find(e=>e.status!==`pending`&&e.status!==`completed`),w=Bt(v),[ee]=(0,Q.useState)(()=>ae(ze())),te=`${c??C?.activeForm??C?.subject??ee}…`;(0,Q.useEffect)(()=>{let t=`spinner-${e}`;return Le.startCLIActivity(t),()=>{Le.endCLIActivity(t)}},[e]);let T=0;for(let e of Object.values(h))e.status===`running`&&ne(e)&&e.progress?.tokenCount&&(T+=e.progress.tokenCount);let ie=r.current===null?Date.now()-t.current-n.current:r.current-t.current-n.current,E=o??`claude`,se=s??`claudeShimmer`,D=p.spinnerTipsEnabled!==!1,ce=D&&ie>18e5,le=D&&ie>3e4&&!_e().btwUseCount,A=ce&&!w?`Use /clear to start fresh when switching topics and free up context`:le&&!w?`Use /btw to ask a quick side question without interrupting Work Mate's current work`:i;return(0,$.jsxs)(O,{flexDirection:`column`,width:`100%`,alignItems:`flex-start`,children:[(0,$.jsx)(Et,{mode:e,reducedMotion:m,hasActiveTools:d,responseLengthRef:a,message:te,messageColor:E,shimmerColor:se,overrideColor:o,loadingStartTimeRef:t,totalPausedMsRef:n,pauseStartTimeRef:r,spinnerSuffix:l,verbose:u,columns:_,agentTokens:T,leaderIsIdle:f,thinkingStatus:y}),g&&v&&v.length>0?(0,$.jsx)(O,{width:`100%`,flexDirection:`column`,children:(0,$.jsx)(re,{children:(0,$.jsx)(He,{tasks:v})})}):w||A?(0,$.jsxs)(O,{width:`100%`,flexDirection:`column`,children:[null,(w||A)&&(0,$.jsx)(re,{children:(0,$.jsx)(k,{dimColor:!0,children:w?`Next: ${w.subject}`:`Tip: ${A}`})})]}):null]})}function zt(){let e=oe().prefersReducedMotion??!1,[t,n]=ue(e?null:120);if(e)return(0,$.jsx)(O,{ref:t,flexWrap:`wrap`,height:1,width:2,children:(0,$.jsx)(k,{color:`text`,children:`●`})});let r=Math.floor(n/120)%Ht.length;return(0,$.jsx)(O,{ref:t,flexWrap:`wrap`,height:1,width:2,children:(0,$.jsx)(k,{color:`text`,children:Ht[r]})})}function Bt(e){if(!e)return;let t=e.filter(e=>e.status===`pending`);if(t.length===0)return;let n=new Set(e.filter(e=>e.status!==`completed`).map(e=>e.id));return t.find(e=>!e.blockedBy.some(e=>n.has(e)))??t[0]}var Q,$,Vt,Ht,Ut=e((()=>{j(),Q=t(A(),1),ie(),Se(),Re(),Ve(),x(),Ke(),mt(),y(),ee(),Tt(),It(),v(),T(),me(),ve(),$=M(),Vt=je(),Ht=[...Vt,...[...Vt].reverse()]}));export{bt as a,et as c,Le as d,Re as f,St as i,He as l,Lt as n,mt as o,Ut as r,$e as s,zt as t,Ke as u};
@@ -1 +0,0 @@
1
- import{o as e}from"./rolldown-runtime-DaDcL9Zw.js";import{Tm as t,Ub as n,_i as r,ay as i,cy as a,vi as o,wm as s}from"./loadAgentsDir-C1LkW7gl.js";import{I as c,P as l,Wt as u,ai as d,t as f}from"./src-DL3w8VPk.js";import{t as p}from"./jsx-runtime-Bb4Xn-E0.js";import{Un as m,zt as h}from"./state-BowF111d.js";import{n as g,t as _}from"./cwd-BcO6WHKo.js";import{f as v,u as y}from"./debug-8DCufdSp.js";import{h as b,s as x}from"./settings-DKN4xSpQ.js";import{_ as S,m as C,n as w}from"./config-BddEvZZl.js";import{n as T,r as E}from"./analytics-DJobLaWP.js";import{in as D}from"./prompt-BGqgPgCU.js";import{n as O,t as k}from"./useExitOnCtrlCDWithKeybindings-CjW3gUOt.js";import{t as A}from"./select-C_KXmqbI.js";import{t as j}from"./CustomSelect-B46Eh0gU.js";import{n as M,t as N}from"./PermissionDialog-BaibiQae.js";import{n as P,t as F}from"./managedEnvConstants-BPwL2aWI.js";import{homedir as I}from"os";var L=e(d(),1),R=p();f(),h(),g(),v(),T(),C(),n(),a(),o(),k(),j(),M(),b(),D(),P(),t();function z(e){if(e===null||e.disableAllHooks)return!1;if(e.statusLine||e.fileSuggestion)return!0;if(!e.hooks)return!1;for(let t of Object.values(e.hooks))if(t.length>0)return!0;return!1}function B(){let e=[];return z(x(`projectSettings`))&&e.push(`.workmate/settings.json`),z(x(`localSettings`))&&e.push(`.workmate/settings.local.json`),e}function V(e){return e.some(e=>e.ruleBehavior===`allow`&&(e.ruleValue.toolName===`Bash`||e.ruleValue.toolName.startsWith(`Bash(`)))}function H(){let e=[];return V(s(`projectSettings`))&&e.push(`.workmate/settings.json`),V(s(`localSettings`))&&e.push(`.workmate/settings.local.json`),e}function U(e){return!!e?.otelHeadersHelper}function W(){let e=[];return U(x(`projectSettings`))&&e.push(`.workmate/settings.json`),U(x(`localSettings`))&&e.push(`.workmate/settings.local.json`),e}function G(e){return!!e?.apiKeyHelper}function K(){let e=[];return G(x(`projectSettings`))&&e.push(`.workmate/settings.json`),G(x(`localSettings`))&&e.push(`.workmate/settings.local.json`),e}function q(e){return!!(e?.awsAuthRefresh||e?.awsCredentialExport)}function J(){let e=[];return q(x(`projectSettings`))&&e.push(`.workmate/settings.json`),q(x(`localSettings`))&&e.push(`.workmate/settings.local.json`),e}function Y(e){return!!e?.gcpAuthRefresh}function X(){let e=[];return Y(x(`projectSettings`))&&e.push(`.workmate/settings.json`),Y(x(`localSettings`))&&e.push(`.workmate/settings.local.json`),e}function Z(e){return e?.env?Object.keys(e.env).some(e=>!F.has(e.toUpperCase())):!1}function Q(){let e=[];return Z(x(`projectSettings`))&&e.push(`.workmate/settings.json`),Z(x(`localSettings`))&&e.push(`.workmate/settings.local.json`),e}D();function $({onDone:e,commands:t}){let{servers:n}=i(`project`),a=Object.keys(n).length>0,o=B().length>0,s=H(),d=K().length>0,f=J().length>0,p=X().length>0,h=W().length>0,g=Q().length>0,v=t?.some(e=>e.type===`prompt`&&e.loadedFrom===`commands_DEPRECATED`&&(e.source===`projectSettings`||e.source===`localSettings`)&&e.allowedTools?.some(e=>e===`Bash`||e.startsWith(`Bash(`)))??!1,b=t?.some(e=>e.type===`prompt`&&(e.loadedFrom===`skills`||e.loadedFrom===`plugin`)&&(e.source===`projectSettings`||e.source===`localSettings`||e.source===`plugin`)&&e.allowedTools?.some(e=>e===`Bash`||e.startsWith(`Bash(`)))??!1,x=s.length>0||v||b,C=w(),[T,D]=L.useState(null);L.useEffect(()=>{if(T!==null){let e=T,t=setTimeout(()=>r(e));return()=>clearTimeout(t)}},[T]),L.useEffect(()=>{E(`tengu_trust_dialog_shown`,{isHomeDir:I()===_(),hasMcpServers:a,hasHooks:o,hasBashExecution:x,hasApiKeyHelper:d,hasAwsCommands:f,hasGcpCommands:p,hasOtelHeadersHelper:h,hasDangerousEnvVars:g})},[a,o,x,d,f,p,h,g]);function k(t){if(t===`exit`){D(1);return}let n=I()===_();E(`tengu_trust_dialog_accept`,{isHomeDir:n,hasMcpServers:a,hasHooks:o,hasBashExecution:x,hasApiKeyHelper:d,hasAwsCommands:f,hasGcpCommands:p,hasOtelHeadersHelper:h,hasDangerousEnvVars:g}),n?m(!0):S(e=>({...e,hasTrustDialogAccepted:!0})),e()}let j=O(()=>D(1));return u(`confirm:no`,()=>{D(0)},{context:`Confirmation`}),T===null?C?(setTimeout(e),null):(0,R.jsx)(N,{color:`warning`,titleColor:`warning`,title:`Accessing workspace:`,children:(0,R.jsxs)(c,{flexDirection:`column`,gap:1,paddingTop:1,children:[(0,R.jsx)(l,{bold:!0,children:y().cwd()}),(0,R.jsx)(l,{children:`Is this a project you trust? (Your own code, a well-known open source project, or work from your team).`}),(0,R.jsx)(l,{children:`Once trusted, Work Mate can read, edit, and run commands in this folder.`}),(0,R.jsx)(A,{options:[{label:`Yes, I trust this folder`,value:`enable_all`},{label:`No, exit`,value:`exit`}],onChange:e=>k(e),onCancel:()=>k(`exit`)}),(0,R.jsx)(l,{dimColor:!0,children:j.pending?(0,R.jsxs)(R.Fragment,{children:[`Press `,j.keyName,` again to exit`]}):(0,R.jsx)(R.Fragment,{children:`Enter to confirm · Esc to cancel`})})]})}):null}export{$ as TrustDialog};
@@ -1 +0,0 @@
1
- import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{n,t as r}from"./figures-5ThXQEtq.js";import{F as i,KC as a,Mb as o,N as s,P as c,YC as l,_m as u,bm as d,jb as f,xm as p}from"./loadAgentsDir-C1LkW7gl.js";import{I as m,P as h,ai as g,di as _,fi as v,t as y}from"./src-DL3w8VPk.js";import{t as b}from"./jsx-runtime-Bb4Xn-E0.js";import{Qt as x,h as S,zt as C}from"./state-BowF111d.js";import{n as w,t as T}from"./AddWorkspaceDirectory-DWgTWJ7R.js";function E({message:e,args:t,onDone:n}){return(0,O.useEffect)(()=>{let e=setTimeout(n,0);return()=>clearTimeout(e)},[n]),(0,k.jsxs)(m,{flexDirection:`column`,children:[(0,k.jsxs)(h,{dimColor:!0,children:[r.pointer,` /add-dir `,t]}),(0,k.jsx)(f,{children:(0,k.jsx)(h,{children:e})})]})}async function D(e,t,n){let r=(n??``).trim(),o=t.getAppState(),c=async(n,r=!1)=>{let i={type:`addDirectories`,directories:[n],destination:r?`localSettings`:`session`},o=u(t.getAppState().toolPermissionContext,i);t.setAppState(e=>({...e,toolPermissionContext:o}));let s=S();s.includes(n)||x([...s,n]),a.refreshConfig();let c;if(r)try{p(i),c=`Added ${_.bold(n)} as a working directory and saved to local settings`}catch(e){c=`Added ${_.bold(n)} as a working directory. Failed to save to local settings: ${e instanceof Error?e.message:`Unknown error`}`}else c=`Added ${_.bold(n)} as a working directory for this session`;e(`${c} ${_.dim(`· /permissions to manage`)}`)};if(!r)return(0,k.jsx)(T,{permissionContext:o.toolPermissionContext,onAddDirectory:c,onCancel:()=>{e(`Did not add a working directory.`)}});let l=await i(r,o.toolPermissionContext);if(l.resultType!==`success`){let t=s(l);return(0,k.jsx)(E,{message:t,args:n??``,onDone:()=>e(t)})}return(0,k.jsx)(T,{directoryPath:l.absolutePath,permissionContext:o.toolPermissionContext,onAddDirectory:c,onCancel:()=>{e(`Did not add ${_.bold(l.absolutePath)} as a working directory.`)}})}var O,k;e((()=>{v(),n(),O=t(g(),1),C(),o(),w(),y(),d(),l(),c(),k=b()}))();export{D as call};
@@ -1,101 +0,0 @@
1
- import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{i as n,o as r}from"./envUtils-DcaKZlRU.js";import{n as i,t as a}from"./figures-5ThXQEtq.js";import{$u as o,Ad as s,Ap as c,Cc as l,Cd as u,Ch as d,Cl as f,Cu as p,Db as m,Dp as h,Eu as g,FC as _,Ff as v,Fl as ee,Fy as y,HS as b,Hf as te,If as ne,Lf as re,Md as ie,Ob as ae,Of as oe,Op as se,Pf as ce,Pl as le,Py as ue,Q as de,Sc as fe,Sd as pe,Sl as me,Td as he,Tu as ge,Ub as x,Vf as _e,X as ve,Xv as ye,Yv as be,Zg as xe,Zi as Se,_w as Ce,ad as S,bd as we,bf as Te,bl as Ee,c as De,dv as Oe,fT as ke,fv as Ae,gw as je,id as C,kd as Me,kf as Ne,l as Pe,mT as Fe,mv as Ie,o as Le,pT as Re,pa as ze,pv as Be,r as Ve,rt as He,s as Ue,t as We,td as Ge,tt as Ke,vd as qe,wd as Je,wh as Ye,wu as Xe,xd as Ze,xl as Qe,yd as $e,yf as et}from"./loadAgentsDir-C1LkW7gl.js";import{C as tt,D as w,I as T,P as E,T as D,Wt as O,ai as k,di as nt,fi as rt,t as A,y as it}from"./src-DL3w8VPk.js";import{t as j}from"./jsx-runtime-Bb4Xn-E0.js";import{n as at,t as ot}from"./cwd-BcO6WHKo.js";import{H as st,L as ct,P as lt,S as ut,U as dt,X as ft,x as pt}from"./debug-8DCufdSp.js";import{Jn as mt,Z as ht,hn as gt,in as _t,it as vt,nn as yt,pn as bt,q as xt,qn as St,rt as Ct}from"./settings-DKN4xSpQ.js";import{N as wt,j as Tt}from"./config-BddEvZZl.js";import{o as Et,s as Dt}from"./log-DaILwWJa.js";import{l as Ot,n as kt,o as At}from"./stringUtils-BQm3OfeJ.js";import{n as jt,r as Mt}from"./analytics-DJobLaWP.js";import{S as Nt,_ as Pt}from"./startupProfiler-DTs9w9EN.js";import{_n as Ft,vn as It}from"./prompt-BGqgPgCU.js";import{a as Lt,i as Rt,n as zt,o as Bt,r as Vt,t as Ht}from"./agentDisplay-vLQHFrmq.js";import{n as Ut,t as Wt}from"./TextInput-7uqPhq9T.js";import{n as Gt,t as Kt}from"./useExitOnCtrlCDWithKeybindings-CjW3gUOt.js";import{n as qt,t as Jt}from"./select-C_KXmqbI.js";import{r as Yt,t as Xt}from"./Spinner-DwsJJUtn.js";import{n as Zt,t as Qt}from"./useMergedTools-DarmnCEw.js";import{n as $t,r as en,t as tn}from"./promptEditor-CmQ9p4oe.js";import{n as nn,t as rn}from"./useMainLoopModel-DWscpA9I.js";import{join as M}from"path";import{mkdir as an,open as on,unlink as sn}from"fs/promises";var N,cn=e((()=>{N={FOLDER_NAME:`.workmate`,AGENTS_DIR:`agents`}}));function ln(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 un(e){switch(e){case`flagSettings`:throw Error(`Cannot get directory path for ${e} agents`);case`userSettings`:return M(n(),N.AGENTS_DIR);case`projectSettings`:return M(ot(),N.FOLDER_NAME,N.AGENTS_DIR);case`policySettings`:return M(yt(),N.FOLDER_NAME,N.AGENTS_DIR);case`localSettings`:return M(ot(),N.FOLDER_NAME,N.AGENTS_DIR)}}function dn(e){switch(e){case`projectSettings`:return M(`.`,N.FOLDER_NAME,N.AGENTS_DIR);default:return un(e)}}function fn(e){return M(un(e.source),`${e.agentType}.md`)}function pn(e){if(e.source===`built-in`)return`Built-in`;if(e.source===`plugin`)throw Error(`Cannot get file path for plugin agents`);return M(un(e.source),`${e.filename||e.agentType}.md`)}function mn(e){return e.source===`built-in`?`Built-in`:M(dn(e.source),`${e.agentType}.md`)}function hn(e){return Ue(e)?`Built-in`:Pe(e)?`Plugin: ${e.plugin||`Unknown`}`:e.source===`flagSettings`?`CLI argument`:M(dn(e.source),`${e.filename||e.agentType}.md`)}async function gn(e){let t=un(e);return await an(t,{recursive:!0}),t}async function _n(e,t,n,r,i,a=!0,o,s,c){if(e===`built-in`)throw Error(`Cannot save built-in agents`);await gn(e);let l=fn({source:e,agentType:t}),u=ln(t,n,r,i,o,s,c);try{await bn(l,u,a?`wx`:`w`)}catch(e){throw lt(e)===`EEXIST`?Error(`Agent file already exists: ${l}`):e}}async function vn(e,t,n,r,i,a,o){if(e.source===`built-in`)throw Error(`Cannot update built-in agents`);await bn(pn(e),ln(e.agentType,t,n,r,i,a,o))}async function yn(e){if(e.source===`built-in`)throw Error(`Cannot delete built-in agents`);let t=pn(e);try{await sn(t)}catch(e){if(lt(e)!==`ENOENT`)throw e}}async function bn(e,t,n=`w`){let r=await on(e,n);try{await r.writeFile(t,{encoding:`utf-8`}),await r.datasync()}finally{await r.close()}}var xn=e((()=>{_t(),Le(),at(),r(),ct(),cn()}));function Sn({agent:e,tools:t,onBack:n}){let r=we(e,t,!1),i=hn(e),s=u(e.agentType);O(`confirm:no`,n,{context:`Confirmation`});let c=e=>{e.key===`return`&&(e.preventDefault(),n())};function l(){return r.hasWildcard?(0,P.jsx)(E,{children:`All tools`}):!e.tools||e.tools.length===0?(0,P.jsx)(E,{children:`None`}):(0,P.jsxs)(P.Fragment,{children:[r.validTools.length>0&&(0,P.jsx)(E,{children:r.validTools.join(`, `)}),r.invalidTools.length>0&&(0,P.jsxs)(E,{color:`warning`,children:[a.warning,` Unrecognized: `,r.invalidTools.join(`, `)]})]})}return(0,P.jsxs)(T,{flexDirection:`column`,gap:1,tabIndex:0,autoFocus:!0,onKeyDown:c,children:[(0,P.jsx)(E,{dimColor:!0,children:i}),(0,P.jsxs)(T,{flexDirection:`column`,children:[(0,P.jsxs)(E,{children:[(0,P.jsx)(E,{bold:!0,children:`Description`}),` (tells Work Mate when to use this agent):`]}),(0,P.jsx)(T,{marginLeft:2,children:(0,P.jsx)(E,{children:e.whenToUse})})]}),(0,P.jsxs)(T,{children:[(0,P.jsxs)(E,{children:[(0,P.jsx)(E,{bold:!0,children:`Tools`}),`:`,` `]}),l()]}),(0,P.jsxs)(E,{children:[(0,P.jsx)(E,{bold:!0,children:`Model`}),`: `,Me(e.model)]}),e.permissionMode&&(0,P.jsxs)(E,{children:[(0,P.jsx)(E,{bold:!0,children:`Permission mode`}),`: `,e.permissionMode]}),e.memory&&(0,P.jsxs)(E,{children:[(0,P.jsx)(E,{bold:!0,children:`Memory`}),`: `,ke(e.memory)]}),e.hooks&&Object.keys(e.hooks).length>0&&(0,P.jsxs)(E,{children:[(0,P.jsx)(E,{bold:!0,children:`Hooks`}),`: `,Object.keys(e.hooks).join(`, `)]}),e.skills&&e.skills.length>0&&(0,P.jsxs)(E,{children:[(0,P.jsx)(E,{bold:!0,children:`Skills`}),`:`,` `,e.skills.length>10?`${e.skills.length} skills`:e.skills.join(`, `)]}),s&&(0,P.jsx)(T,{children:(0,P.jsxs)(E,{children:[(0,P.jsx)(E,{bold:!0,children:`Color`}),`:`,` `,(0,P.jsxs)(E,{backgroundColor:s,color:`inverseText`,children:[` `,e.agentType,` `]})]})}),!Ue(e)&&(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(T,{children:(0,P.jsxs)(E,{children:[(0,P.jsx)(E,{bold:!0,children:`System prompt`}),`:`]})}),(0,P.jsx)(T,{marginLeft:2,marginRight:2,children:(0,P.jsx)(o,{children:e.getSystemPrompt()})})]})]})}var P,Cn=e((()=>{i(),A(),x(),Je(),Re(),$e(),Le(),ie(),Ge(),xn(),P=j()}));function wn({agentName:e,currentColor:t=`automatic`,onConfirm:n}){let[r,i]=(0,Tn.useState)(Math.max(0,En.indexOf(t))),o=e=>{if(e.key===`up`)e.preventDefault(),i(e=>e>0?e-1:En.length-1);else if(e.key===`down`)e.preventDefault(),i(e=>e<En.length-1?e+1:0);else if(e.key===`return`){e.preventDefault();let t=En[r];n(t===`automatic`?void 0:t)}},s=En[r];return(0,F.jsxs)(T,{flexDirection:`column`,gap:1,tabIndex:0,autoFocus:!0,onKeyDown:o,children:[(0,F.jsx)(T,{flexDirection:`column`,children:En.map((e,t)=>{let n=t===r;return(0,F.jsxs)(T,{flexDirection:`row`,gap:1,children:[(0,F.jsx)(E,{color:n?`suggestion`:void 0,children:n?a.pointer:` `}),e===`automatic`?(0,F.jsx)(E,{bold:n,children:`Automatic color`}):(0,F.jsxs)(T,{gap:1,children:[(0,F.jsx)(E,{backgroundColor:pe[e],color:`inverseText`,children:` `}),(0,F.jsx)(E,{bold:n,children:kt(e)})]})]},e)})}),(0,F.jsxs)(T,{marginTop:1,children:[(0,F.jsx)(E,{children:`Preview: `}),s===void 0||s===`automatic`?(0,F.jsxs)(E,{inverse:!0,bold:!0,children:[` `,`@`,e,` `]}):(0,F.jsxs)(E,{backgroundColor:pe[s],color:`inverseText`,bold:!0,children:[` `,`@`,e,` `]})]})]})}var Tn,F,En,Dn=e((()=>{i(),Tn=t(k(),1),A(),Je(),At(),F=j(),En=[`automatic`,...Ze]}));function On({initialModel:e,onComplete:t,onCancel:n}){let r=kn.useMemo(()=>{let t=s();return e&&!t.some(t=>t.value===e)?[{value:e,label:e,description:`Current model (custom ID)`},...t]:t},[e]);return(0,An.jsxs)(T,{flexDirection:`column`,children:[(0,An.jsx)(T,{marginBottom:1,children:(0,An.jsx)(E,{dimColor:!0,children:`Model determines the agent's reasoning capabilities and speed.`})}),(0,An.jsx)(Jt,{options:r,defaultValue:e??`sonnet`,onChange:t,onCancel:()=>n?n():t(void 0)})]})}var kn,An,jn=e((()=>{kn=t(k(),1),A(),ie(),qt(),An=j()}));function Mn(){return{READ_ONLY:{name:`Read-only tools`,toolNames:new Set([ce.name,ne.name,Ee.name,m.name,oe.name,le.name,me.name,ue.name,Be.name])},EDIT:{name:`Edit tools`,toolNames:new Set([ge.name,_e.name,p.name])},EXECUTION:{name:`Execution tools`,toolNames:new Set([et.name])},MCP:{name:`MCP tools`,toolNames:new Set,isMcp:!0},OTHER:{name:`Other tools`,toolNames:new Set}}}function Nn(e){let t=new Map;return e.forEach(e=>{if(ye(e)){let n=vt(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 Pn({tools:e,initialTools:t,onComplete:n,onCancel:r}){let i=(0,I.useMemo)(()=>qe({tools:e,isBuiltIn:!1,isAsync:!1}),[e]),[o,s]=(0,I.useState)(!t||t.includes(`*`)?i.map(e=>e.name):t),[c,l]=(0,I.useState)(0),[u,d]=(0,I.useState)(!1),f=(0,I.useMemo)(()=>{let e=new Set(i.map(e=>e.name));return o.filter(t=>e.has(t))},[o,i]),p=new Set(f),m=f.length===i.length&&i.length>0,h=e=>{e&&s(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},g=(e,t)=>{s(n=>{if(t){let t=e.filter(e=>!n.includes(e));return[...n,...t]}else return n.filter(t=>!e.includes(t))})},_=()=>{let e=i.map(e=>e.name);n(f.length===e.length&&e.every(e=>f.includes(e))?void 0:f)},v=(0,I.useMemo)(()=>{let e=Mn(),t={readOnly:[],edit:[],execution:[],mcp:[],other:[]};return i.forEach(n=>{ye(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]),ee=e=>{let t=St(e,e=>p.has(e.name))<e.length;return()=>{let n=e.map(e=>e.name);g(n,t)}},y=[];y.push({id:`continue`,label:`Continue`,action:_,isContinue:!0}),y.push({id:`bucket-all`,label:`${m?a.checkboxOn:a.checkboxOff} All tools`,action:()=>{let e=i.map(e=>e.name);g(e,!m)}});let b=Mn();[{id:`bucket-readonly`,name:b.READ_ONLY.name,tools:v.readOnly},{id:`bucket-edit`,name:b.EDIT.name,tools:v.edit},{id:`bucket-execution`,name:b.EXECUTION.name,tools:v.execution},{id:`bucket-mcp`,name:b.MCP.name,tools:v.mcp},{id:`bucket-other`,name:b.OTHER.name,tools:v.other}].forEach(({id:e,name:t,tools:n})=>{if(n.length===0)return;let r=St(n,e=>p.has(e.name))===n.length;y.push({id:e,label:`${r?a.checkboxOn:a.checkboxOff} ${t}`,action:ee(n)})});let te=y.length;y.push({id:`toggle-individual`,label:u?`Hide advanced options`:`Show advanced options`,action:()=>{d(!u),u&&c>te&&l(te)},isToggle:!0});let ne=(0,I.useMemo)(()=>Nn(i),[i]);return u&&(ne.length>0&&(y.push({id:`mcp-servers-header`,label:`MCP Servers:`,action:()=>{},isHeader:!0}),ne.forEach(({serverName:e,tools:t})=>{let n=St(t,e=>p.has(e.name))===t.length;y.push({id:`mcp-server-${e}`,label:`${n?a.checkboxOn:a.checkboxOff} ${e} (${t.length} ${Ot(t.length,`tool`)})`,action:()=>{let e=t.map(e=>e.name);g(e,!n)}})}),y.push({id:`tools-header`,label:`Individual Tools:`,action:()=>{},isHeader:!0})),i.forEach(e=>{let t=e.name;if(e.name.startsWith(`mcp__`)){let n=vt(e.name);t=n?`${n.toolName} (${n.serverName})`:e.name}y.push({id:`tool-${e.name}`,label:`${p.has(e.name)?a.checkboxOn:a.checkboxOff} ${t}`,action:()=>h(e.name)})})),O(`confirm:no`,(0,I.useCallback)(()=>{r?r():n(t)},[r,n,t]),{context:`Confirmation`}),(0,L.jsxs)(T,{flexDirection:`column`,marginTop:1,tabIndex:0,autoFocus:!0,onKeyDown:e=>{if(e.key===`return`){e.preventDefault();let t=y[c];t&&!t.isHeader&&t.action()}else if(e.key===`up`){e.preventDefault();let t=c-1;for(;t>0&&y[t]?.isHeader;)t--;l(Math.max(0,t))}else if(e.key===`down`){e.preventDefault();let t=c+1;for(;t<y.length-1&&y[t]?.isHeader;)t++;l(Math.min(y.length-1,t))}},children:[(0,L.jsxs)(E,{color:c===0?`suggestion`:void 0,bold:c===0,children:[c===0?`${a.pointer} `:` `,`[ Continue ]`]}),(0,L.jsx)(tt,{width:40}),y.slice(1).map((e,t)=>{let n=t+1===c,r=e.isToggle,i=e.isHeader;return(0,L.jsxs)(I.Fragment,{children:[r&&(0,L.jsx)(tt,{width:40}),i&&t>0&&(0,L.jsx)(T,{marginTop:1}),(0,L.jsxs)(E,{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,L.jsx)(T,{marginTop:1,flexDirection:`column`,children:(0,L.jsx)(E,{dimColor:!0,children:m?`All tools selected`:`${p.size} of ${i.length} tools selected`})})]})}var I,L,Fn=e((()=>{i(),I=t(k(),1),Ct(),be(),$e(),ht(),Te(),Qe(),g(),ae(),te(),v(),re(),y(),Xe(),Ie(),f(),ee(),Ne(),A(),x(),mt(),At(),L=j()}));function In(e){return e===`all`?`Agents`:e===`built-in`?`Built-in agents`:e===`plugin`?`Plugin agents`:je(bt(e))}var Ln=e((()=>{Ce(),gt()}));function Rn({agent:e,tools:t,onSaved:n,onBack:r}){let i=c(),[o,s]=(0,R.useState)(`menu`),[l,u]=(0,R.useState)(0),[d,f]=(0,R.useState)(null),[p,m]=(0,R.useState)(e.color),h=(0,R.useCallback)(async()=>{let t=await tn(pn(e));t.error?f(t.error):n(`Opened ${e.agentType} in editor. If you made edits, restart to load the latest version.`)},[e,n]),g=(0,R.useCallback)(async(t={})=>{let{tools:r,color:a,model:o}=t,s=a??p,c=r!==void 0,l=o!==void 0,u=s!==e.color;if(!c&&!l&&!u)return!1;try{return!De(e)&&!Pe(e)?!1:(await vn(e,e.whenToUse,r??e.tools,e.getSystemPrompt(),s,o??e.model),u&&s&&he(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:Ve(n),allAgents:n}}}),n(`Updated agent: ${nt.bold(e.agentType)}`),!0)}catch(e){return f(e instanceof Error?e.message:`Failed to save agent`),!1}},[e,p,n,i]),_=(0,R.useMemo)(()=>[{label:`Open in editor`,action:h},{label:`Edit tools`,action:()=>s(`edit-tools`)},{label:`Edit model`,action:()=>s(`edit-model`)},{label:`Edit color`,action:()=>s(`edit-color`)}],[h]),v=(0,R.useCallback)(()=>{f(null),o===`menu`?r():s(`menu`)},[o,r]),ee=(0,R.useCallback)(e=>{if(e.key===`up`)e.preventDefault(),u(e=>Math.max(0,e-1));else if(e.key===`down`)e.preventDefault(),u(e=>Math.min(_.length-1,e+1));else if(e.key===`return`){e.preventDefault();let t=_[l];t&&t.action()}},[_,l]);O(`confirm:no`,v,{context:`Confirmation`});let y=()=>(0,z.jsxs)(T,{flexDirection:`column`,tabIndex:0,autoFocus:!0,onKeyDown:ee,children:[(0,z.jsxs)(E,{dimColor:!0,children:[`Source: `,In(e.source)]}),(0,z.jsx)(T,{marginTop:1,flexDirection:`column`,children:_.map((e,t)=>(0,z.jsxs)(E,{color:t===l?`suggestion`:void 0,children:[t===l?`${a.pointer} `:` `,e.label]},e.label))}),d&&(0,z.jsx)(T,{marginTop:1,children:(0,z.jsx)(E,{color:`error`,children:d})})]});switch(o){case`menu`:return y();case`edit-tools`:return(0,z.jsx)(Pn,{tools:t,initialTools:e.tools,onComplete:async e=>{s(`menu`),await g({tools:e})}});case`edit-color`:return(0,z.jsx)(wn,{agentName:e.agentType,currentColor:p||e.color||`automatic`,onConfirm:async e=>{m(e),s(`menu`),await g({color:e})}});case`edit-model`:return(0,z.jsx)(On,{initialModel:e.model,onComplete:async e=>{s(`menu`),await g({model:e})}});default:return null}}var R,z,zn=e((()=>{rt(),i(),R=t(k(),1),h(),A(),x(),Je(),Le(),en(),xn(),Dn(),jn(),Fn(),Ln(),z=j()}));function Bn({instructions:e=`Press ↑↓ to navigate · Enter to select · Esc to go back`}){let t=Gt();return(0,Vn.jsx)(T,{marginLeft:2,children:(0,Vn.jsx)(E,{dimColor:!0,children:t.pending?`Press ${t.keyName} again to exit`:e})})}var Vn,Hn=e((()=>{Kt(),A(),Vn=j()}));function Un({source:e,agents:t,onBack:n,onSelect:r,onCreateNew:i,changes:o}){let[s,c]=Wn.useState(null),[l,u]=Wn.useState(!0),d=Wn.useMemo(()=>[...t].sort(zt),[t]),f=e=>({isOverridden:!!e.overriddenBy,overriddenBy:e.overriddenBy||null}),p=()=>(0,B.jsxs)(T,{children:[(0,B.jsx)(E,{color:l?`suggestion`:void 0,children:l?`${a.pointer} `:` `}),(0,B.jsx)(E,{color:l?`suggestion`:void 0,children:`Create new agent`})]}),m=e=>{let t=e.source===`built-in`,n=!t&&!l&&s?.agentType===e.agentType&&s?.source===e.source,{isOverridden:r,overriddenBy:i}=f(e),o=t||r,c=!t&&n?`suggestion`:void 0,u=Lt(e);return(0,B.jsxs)(T,{children:[(0,B.jsx)(E,{dimColor:o&&!n,color:c,children:t?``:n?`${a.pointer} `:` `}),(0,B.jsx)(E,{dimColor:o&&!n,color:c,children:e.agentType}),u&&(0,B.jsxs)(E,{dimColor:!0,color:c,children:[` · `,u]}),e.memory&&(0,B.jsxs)(E,{dimColor:!0,color:c,children:[` · `,e.memory,` memory`]}),i&&(0,B.jsxs)(E,{dimColor:!n,color:n?`warning`:void 0,children:[` `,a.warning,` shadowed by `,Vt(i)]})]},`${e.agentType}-${e.source}`)},h=Wn.useMemo(()=>{let t=d.filter(e=>e.source!==`built-in`);return e===`all`?Ht.filter(e=>e.source!==`built-in`).flatMap(({source:e})=>t.filter(t=>t.source===e)):t},[d,e]);Wn.useEffect(()=>{!s&&!l&&h.length>0&&(i?u(!0):c(h[0]||null))},[h,s,l,i]);let g=e=>{if(e.key===`return`){e.preventDefault(),l&&i?i():s&&r(s);return}if(e.key!==`up`&&e.key!==`down`)return;e.preventDefault();let t=!!i,n=h.length+ +!!t;if(n===0)return;let a=0;if(!l&&s){let e=h.findIndex(e=>e.agentType===s.agentType&&e.source===s.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)u(!0),c(null);else{let e=t?o-1:o,n=h[e];n&&(u(!1),c(n))}},_=(e=`Built-in (always available):`)=>{let t=d.filter(e=>e.source===`built-in`);return(0,B.jsxs)(T,{flexDirection:`column`,marginBottom:1,paddingLeft:2,children:[(0,B.jsx)(E,{bold:!0,dimColor:!0,children:e}),t.map(m)]})},v=(e,t)=>{if(!t.length)return null;let n=t[0]?.baseDir;return(0,B.jsxs)(T,{flexDirection:`column`,marginBottom:1,children:[(0,B.jsxs)(T,{paddingLeft:2,children:[(0,B.jsx)(E,{bold:!0,dimColor:!0,children:e}),n&&(0,B.jsxs)(E,{dimColor:!0,children:[` (`,n,`)`]})]}),t.map(e=>m(e))]})},ee=In(e),y=d.filter(e=>e.source===`built-in`);return!d.length||e!==`built-in`&&!d.some(e=>e.source!==`built-in`)?(0,B.jsx)(it,{title:ee,subtitle:`No agents found`,onCancel:n,hideInputGuide:!0,children:(0,B.jsxs)(T,{flexDirection:`column`,gap:1,tabIndex:0,autoFocus:!0,onKeyDown:g,children:[i&&(0,B.jsx)(T,{children:p()}),(0,B.jsx)(E,{dimColor:!0,children:`No agents found. Create specialized subagents that Work Mate can delegate to.`}),(0,B.jsx)(E,{dimColor:!0,children:`Each subagent has its own context window, custom system prompt, and specific tools.`}),(0,B.jsx)(E,{dimColor:!0,children:`Try creating: Code Reviewer, Code Simplifier, Security Reviewer, Tech Lead, or UX Reviewer.`}),e!==`built-in`&&d.some(e=>e.source===`built-in`)&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(tt,{}),_()]})]})}):(0,B.jsxs)(it,{title:ee,subtitle:`${St(d,e=>!e.overriddenBy)} agents`,onCancel:n,hideInputGuide:!0,children:[o&&o.length>0&&(0,B.jsx)(T,{marginTop:1,children:(0,B.jsx)(E,{dimColor:!0,children:o[o.length-1]})}),(0,B.jsxs)(T,{flexDirection:`column`,tabIndex:0,autoFocus:!0,onKeyDown:g,children:[i&&(0,B.jsx)(T,{marginBottom:1,children:p()}),e===`all`?(0,B.jsxs)(B.Fragment,{children:[Ht.filter(e=>e.source!==`built-in`).map(({label:e,source:t})=>(0,B.jsx)(Wn.Fragment,{children:v(e,d.filter(e=>e.source===t))},t)),y.length>0&&(0,B.jsxs)(T,{flexDirection:`column`,marginBottom:1,paddingLeft:2,children:[(0,B.jsxs)(E,{dimColor:!0,children:[(0,B.jsx)(E,{bold:!0,children:`Built-in agents`}),` (always available)`]}),y.map(m)]})]}):e===`built-in`?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(E,{dimColor:!0,italic:!0,children:`Built-in agents are provided by default and cannot be modified.`}),(0,B.jsx)(T,{marginTop:1,flexDirection:`column`,children:d.map(e=>m(e))})]}):(0,B.jsxs)(B.Fragment,{children:[d.filter(e=>e.source!==`built-in`).map(e=>m(e)),d.some(e=>e.source===`built-in`)&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(tt,{}),_()]})]})]})]})}var Wn,B,Gn=e((()=>{i(),Wn=t(k(),1),A(),Rt(),mt(),Ln(),B=j()}));function Kn({steps:e,initialData:t={},onComplete:n,onCancel:r,children:i,title:a,showStepCounter:o=!0}){let[s,c]=(0,V.useState)(0),[l,u]=(0,V.useState)(t),[d,f]=(0,V.useState)(!1),[p,m]=(0,V.useState)([]);Gt(),(0,V.useEffect)(()=>{d&&(m([]),n(l))},[d,l,n]);let h=(0,V.useCallback)(()=>{s<e.length-1?(p.length>0&&m(e=>[...e,s]),c(e=>e+1)):f(!0)},[s,e.length,p]),g=(0,V.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,V.useCallback)(t=>{t>=0&&t<e.length&&(m(e=>[...e,s]),c(t))},[s,e.length]),v=(0,V.useCallback)(()=>{m([]),r&&r()},[r]),ee=(0,V.useCallback)(e=>{u(t=>({...t,...e}))},[]),y=(0,V.useMemo)(()=>({currentStepIndex:s,totalSteps:e.length,wizardData:l,setWizardData:u,updateWizardData:ee,goNext:h,goBack:g,goToStep:_,cancel:v,title:a,showStepCounter:o}),[s,e.length,l,ee,h,g,_,v,a,o]),b=e[s];return!b||d?null:(0,qn.jsx)(Jn.Provider,{value:y,children:i||(0,qn.jsx)(b,{})})}var V,qn,Jn,Yn=e((()=>{V=t(k(),1),Kt(),qn=j(),Jn=(0,V.createContext)(null)}));function H(){let e=(0,Xn.useContext)(Jn);if(!e)throw Error(`useWizard must be used within a WizardProvider`);return e}var Xn,Zn=e((()=>{Xn=t(k(),1),Yn()}));function Qn({instructions:e=(0,$n.jsxs)(D,{children:[(0,$n.jsx)(w,{shortcut:`↑↓`,action:`navigate`}),(0,$n.jsx)(w,{shortcut:`Enter`,action:`select`}),(0,$n.jsx)(C,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`})]})}){let t=Gt();return(0,$n.jsx)(T,{marginLeft:3,marginTop:1,children:(0,$n.jsx)(E,{dimColor:!0,children:t.pending?`Press ${t.keyName} again to exit`:e})})}var $n,er=e((()=>{Kt(),A(),S(),$n=j()}));function U({title:e,color:t=`suggestion`,children:n,subtitle:r,footerText:i}){let{currentStepIndex:a,totalSteps:o,title:s,showStepCounter:c,goBack:l}=H();return(0,tr.jsxs)(tr.Fragment,{children:[(0,tr.jsx)(it,{title:`${e||s||`Wizard`}${c===!1?``:` (${a+1}/${o})`}`,subtitle:r,onCancel:l,color:t,hideInputGuide:!0,isCancelActive:!1,children:n}),(0,tr.jsx)(Qn,{instructions:i})]})}var tr,W=e((()=>{A(),Zn(),er(),tr=j()})),G=e((()=>{Zn(),W(),er(),Yn()}));function nr(){let{goNext:e,goBack:t,updateWizardData:n,wizardData:r}=H();return O(`confirm:no`,t,{context:`Confirmation`}),(0,K.jsx)(U,{subtitle:`Choose background color`,footerText:(0,K.jsxs)(D,{children:[(0,K.jsx)(w,{shortcut:`↑↓`,action:`navigate`}),(0,K.jsx)(w,{shortcut:`Enter`,action:`select`}),(0,K.jsx)(C,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`})]}),children:(0,K.jsx)(T,{children:(0,K.jsx)(wn,{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 K,rr=e((()=>{A(),x(),S(),G(),W(),Dn(),K=j()}));function ir(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 ar(e,t,n){let r=[],i=[];if(!e.agentType)r.push(`Agent type is required`);else{let t=ir(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 ${In(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=we(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 or=e((()=>{$e(),Ln()}));function sr({tools:e,existingAgents:t,onSave:n,onSaveAndEdit:r,error:i}){let{goBack:a,wizardData:o}=H();O(`confirm:no`,a,{context:`Confirmation`});let s=e=>{e.key===`s`||e.key===`return`?(e.preventDefault(),n()):e.key===`e`&&(e.preventDefault(),r())},c=o.finalAgent,l=ar(c,e,t),u=Nt(c.getSystemPrompt(),240),d=Nt(c.whenToUse,240),f=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]}`,p=wt()?(0,q.jsxs)(E,{children:[(0,q.jsx)(E,{bold:!0,children:`Memory`}),`: `,ke(c.memory)]}):null;return(0,q.jsx)(U,{subtitle:`Confirm and save`,footerText:(0,q.jsxs)(D,{children:[(0,q.jsx)(w,{shortcut:`s/Enter`,action:`save`}),(0,q.jsx)(w,{shortcut:`e`,action:`edit in your editor`}),(0,q.jsx)(C,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})]}),children:(0,q.jsxs)(T,{flexDirection:`column`,tabIndex:0,autoFocus:!0,onKeyDown:s,children:[(0,q.jsxs)(E,{children:[(0,q.jsx)(E,{bold:!0,children:`Name`}),`: `,c.agentType]}),(0,q.jsxs)(E,{children:[(0,q.jsx)(E,{bold:!0,children:`Location`}),`:`,` `,mn({source:o.location,agentType:c.agentType})]}),(0,q.jsxs)(E,{children:[(0,q.jsx)(E,{bold:!0,children:`Tools`}),`: `,f(c.tools)]}),(0,q.jsxs)(E,{children:[(0,q.jsx)(E,{bold:!0,children:`Model`}),`: `,Me(c.model)]}),p,(0,q.jsx)(T,{marginTop:1,children:(0,q.jsxs)(E,{children:[(0,q.jsx)(E,{bold:!0,children:`Description`}),` (tells Work Mate when to use this agent):`]})}),(0,q.jsx)(T,{marginLeft:2,marginTop:1,children:(0,q.jsx)(E,{children:d})}),(0,q.jsx)(T,{marginTop:1,children:(0,q.jsxs)(E,{children:[(0,q.jsx)(E,{bold:!0,children:`System prompt`}),`:`]})}),(0,q.jsx)(T,{marginLeft:2,marginTop:1,children:(0,q.jsx)(E,{children:u})}),l.warnings.length>0&&(0,q.jsxs)(T,{marginTop:1,flexDirection:`column`,children:[(0,q.jsx)(E,{color:`warning`,children:`Warnings:`}),l.warnings.map((e,t)=>(0,q.jsxs)(E,{dimColor:!0,children:[` `,`• `,e]},t))]}),l.errors.length>0&&(0,q.jsxs)(T,{marginTop:1,flexDirection:`column`,children:[(0,q.jsx)(E,{color:`error`,children:`Errors:`}),l.errors.map((e,t)=>(0,q.jsxs)(E,{color:`error`,children:[` `,`• `,e]},t))]}),i&&(0,q.jsx)(T,{marginTop:1,children:(0,q.jsx)(E,{color:`error`,children:i})}),(0,q.jsx)(T,{marginTop:2,children:(0,q.jsxs)(E,{color:`success`,children:[`Press `,(0,q.jsx)(E,{bold:!0,children:`s`}),` or `,(0,q.jsx)(E,{bold:!0,children:`Enter`}),` to save, `,(0,q.jsx)(E,{bold:!0,children:`e`}),` to save and edit`]})})]})})}var q,cr=e((()=>{A(),x(),Tt(),Re(),Pt(),ie(),S(),G(),W(),xn(),or(),q=j()}));function lr({tools:e,existingAgents:t,onComplete:n}){let{wizardData:r}=H(),[i,a]=(0,ur.useState)(null),o=c(),s=(0,ur.useCallback)(async e=>{if(r?.finalAgent)try{await _n(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:Ve(t),allAgents:t}}}),We(),e&&await tn(fn({source:r.location,agentType:r.finalAgent.agentType})),Mt(`tengu_agent_created`,{agent_type:r.finalAgent.agentType,generation_method:r.wasGenerated?`generated`:`manual`,source:r.location,tool_count:r.finalAgent.tools?.length??`all`,has_custom_model:!!r.finalAgent.model,has_custom_color:!!r.finalAgent.color,has_memory:!!r.finalAgent.memory,memory_scope:r.finalAgent.memory??`none`,...e?{opened_in_editor:!0}:{}}),n(e?`Created agent: ${nt.bold(r.finalAgent.agentType)} and opened in editor. If you made edits, restart to load the latest version.`:`Created agent: ${nt.bold(r.finalAgent.agentType)}`)}catch(e){a(e instanceof Error?e.message:`Failed to save agent`)}},[r,n,o]);return(0,dr.jsx)(sr,{tools:e,existingAgents:t,onSave:(0,ur.useCallback)(()=>s(!1),[s]),onSaveAndEdit:(0,ur.useCallback)(()=>s(!0),[s]),error:i})}var ur,dr,fr=e((()=>{rt(),ur=t(k(),1),jt(),h(),Le(),en(),G(),xn(),cr(),dr=j()}));function pr(){let{goNext:e,goBack:t,updateWizardData:n,wizardData:r}=H(),[i,a]=(0,mr.useState)(r.whenToUse||``),[o,s]=(0,mr.useState)(i.length),[c,l]=(0,mr.useState)(null);return O(`confirm:no`,t,{context:`Settings`}),O(`chat:externalEditor`,(0,mr.useCallback)(async()=>{let e=await $t(i);e.content!==null&&(a(e.content),s(e.content.length))},[i]),{context:`Chat`}),(0,J.jsx)(U,{subtitle:`Description (tell Work Mate when to use this agent)`,footerText:(0,J.jsxs)(D,{children:[(0,J.jsx)(w,{shortcut:`Type`,action:`enter text`}),(0,J.jsx)(w,{shortcut:`Enter`,action:`continue`}),(0,J.jsx)(C,{action:`chat:externalEditor`,context:`Chat`,fallback:`ctrl+g`,description:`open in editor`}),(0,J.jsx)(C,{action:`confirm:no`,context:`Settings`,fallback:`Esc`,description:`go back`})]}),children:(0,J.jsxs)(T,{flexDirection:`column`,children:[(0,J.jsx)(E,{children:`When should Work Mate use this agent?`}),(0,J.jsx)(T,{marginTop:1,children:(0,J.jsx)(Wt,{value:i,onChange:a,onSubmit:t=>{let r=t.trim();if(!r){l(`Description is required`);return}l(null),n({whenToUse:r}),e()},placeholder:`e.g., use this agent after you're done writing code...`,columns:80,cursorOffset:o,onChangeCursorOffset:s,focus:!0,showCursor:!0})}),c&&(0,J.jsx)(T,{marginTop:1,children:(0,J.jsx)(E,{color:`error`,children:c})})]})})}var mr,J,hr=e((()=>{mr=t(k(),1),A(),x(),en(),S(),Ut(),G(),W(),J=j()}));async function gr(e,t,n,r){let i=b({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 d(),o=He([i],a),s=wt()?_r+vr:_r,c=await de({messages:ze(o),systemPrompt:_([s]),thinkingConfig:{type:`disabled`},tools:[],signal:r,options:{getToolPermissionContext:async()=>Ft(),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=ut(l.trim())}catch{let e=l.match(/\{[\s\S]*\}/);if(!e)throw Error(`No JSON object found in response`);u=ut(e[0])}if(!u.identifier||!u.whenToUse||!u.systemPrompt)throw Error(`Invalid agent configuration generated`);return Mt(`tengu_agent_definition_generated`,{agent_identifier:u.identifier}),{identifier:u.identifier,whenToUse:u.whenToUse,systemPrompt:u.systemPrompt}}var _r,vr,yr=e((()=>{Ye(),ve(),It(),ht(),Ke(),Se(),Tt(),jt(),pt(),xe(),_r=`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
- `,vr=`
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 br(){let{updateWizardData:e,goBack:t,goToStep:n,wizardData:r}=H(),[i,a]=(0,Y.useState)(r.generationPrompt||``),[o,s]=(0,Y.useState)(!1),[c,l]=(0,Y.useState)(null),[u,d]=(0,Y.useState)(i.length),f=nn(),p=(0,Y.useRef)(null);O(`confirm:no`,(0,Y.useCallback)(()=>{p.current&&(p.current.abort(),p.current=null,s(!1),l(`Generation cancelled`))},[]),{context:`Settings`,isActive:o}),O(`chat:externalEditor`,(0,Y.useCallback)(async()=>{let e=await $t(i);e.content!==null&&(a(e.content),d(e.content.length))},[i]),{context:`Chat`,isActive:!o}),O(`confirm:no`,(0,Y.useCallback)(()=>{e({generationPrompt:``,agentType:``,systemPrompt:``,whenToUse:``,generatedAgent:void 0,wasGenerated:!1}),a(``),l(null),t()},[e,t]),{context:`Settings`,isActive:!o});let m=async()=>{let t=i.trim();if(!t){l(`Please describe what the agent should do`);return}l(null),s(!0),e({generationPrompt:t,isGenerating:!0});let r=Oe();p.current=r;try{let i=await gr(t,f,[],r.signal);e({agentType:i.identifier,whenToUse:i.whenToUse,systemPrompt:i.systemPrompt,generatedAgent:i,isGenerating:!1,wasGenerated:!0}),n(6)}catch(t){t instanceof ft||t instanceof Error&&!t.message.includes(`No assistant message found`)&&l(t.message||`Failed to generate agent`),e({isGenerating:!1})}finally{s(!1),p.current=null}},h=`Describe what this agent should do and when it should be used (be comprehensive for best results)`;return o?(0,X.jsx)(U,{subtitle:h,footerText:(0,X.jsx)(C,{action:`confirm:no`,context:`Settings`,fallback:`Esc`,description:`cancel`}),children:(0,X.jsxs)(T,{flexDirection:`row`,alignItems:`center`,children:[(0,X.jsx)(Xt,{}),(0,X.jsx)(E,{color:`suggestion`,children:` Generating agent from description...`})]})}):(0,X.jsx)(U,{subtitle:h,footerText:(0,X.jsxs)(D,{children:[(0,X.jsx)(C,{action:`confirm:yes`,context:`Confirmation`,fallback:`Enter`,description:`submit`}),(0,X.jsx)(C,{action:`chat:externalEditor`,context:`Chat`,fallback:`ctrl+g`,description:`open in editor`}),(0,X.jsx)(C,{action:`confirm:no`,context:`Settings`,fallback:`Esc`,description:`go back`})]}),children:(0,X.jsxs)(T,{flexDirection:`column`,children:[c&&(0,X.jsx)(T,{marginBottom:1,children:(0,X.jsx)(E,{color:`error`,children:c})}),(0,X.jsx)(Wt,{value:i,onChange:a,onSubmit:m,placeholder:`e.g., Help me write unit tests for my code...`,columns:80,cursorOffset:u,onChangeCursorOffset:d,focus:!0,showCursor:!0})]})})}var Y,X,xr=e((()=>{dt(),Y=t(k(),1),rn(),A(),x(),Ae(),en(),S(),Yt(),Ut(),G(),W(),yr(),X=j()}));function Sr(){let{goNext:e,updateWizardData:t,cancel:n}=H();return(0,Cr.jsx)(U,{subtitle:`Choose location`,footerText:(0,Cr.jsxs)(D,{children:[(0,Cr.jsx)(w,{shortcut:`↑↓`,action:`navigate`}),(0,Cr.jsx)(w,{shortcut:`Enter`,action:`select`}),(0,Cr.jsx)(C,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})]}),children:(0,Cr.jsx)(T,{children:(0,Cr.jsx)(Jt,{options:[{label:`Project (.workmate/agents/)`,value:`projectSettings`},{label:`Personal (~/.workmate/agents/)`,value:`userSettings`}],onChange:n=>{t({location:n}),e()},onCancel:()=>n()},`location-select`)})})}var Cr,wr=e((()=>{A(),S(),qt(),G(),W(),Cr=j()}));function Tr(){let{goNext:e,goBack:t,updateWizardData:n,wizardData:r}=H();O(`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,Er.jsx)(U,{subtitle:`Configure agent memory`,footerText:(0,Er.jsxs)(D,{children:[(0,Er.jsx)(w,{shortcut:`↑↓`,action:`navigate`}),(0,Er.jsx)(w,{shortcut:`Enter`,action:`select`}),(0,Er.jsx)(C,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`})]}),children:(0,Er.jsx)(T,{children:(0,Er.jsx)(Jt,{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:wt()&&i&&a?()=>`${r.systemPrompt}\n\n${Fe(a,i)}`:()=>r.systemPrompt}:void 0}),e()},onCancel:t},`memory-select`)})})}var Er,Dr=e((()=>{A(),x(),Tt(),Re(),S(),qt(),G(),W(),Er=j()}));function Or(){let{goNext:e,goBack:t,updateWizardData:n,goToStep:r}=H();return(0,kr.jsx)(U,{subtitle:`Creation method`,footerText:(0,kr.jsxs)(D,{children:[(0,kr.jsx)(w,{shortcut:`↑↓`,action:`navigate`}),(0,kr.jsx)(w,{shortcut:`Enter`,action:`select`}),(0,kr.jsx)(C,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`})]}),children:(0,kr.jsx)(T,{children:(0,kr.jsx)(Jt,{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 kr,Ar=e((()=>{A(),S(),qt(),G(),W(),kr=j()}));function jr(){let{goNext:e,goBack:t,updateWizardData:n,wizardData:r}=H();return(0,Mr.jsx)(U,{subtitle:`Select model`,footerText:(0,Mr.jsxs)(D,{children:[(0,Mr.jsx)(w,{shortcut:`↑↓`,action:`navigate`}),(0,Mr.jsx)(w,{shortcut:`Enter`,action:`select`}),(0,Mr.jsx)(C,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`})]}),children:(0,Mr.jsx)(On,{initialModel:r.selectedModel,onComplete:t=>{n({selectedModel:t}),e()},onCancel:t})})}var Mr,Nr=e((()=>{S(),A(),G(),W(),jn(),Mr=j()}));function Pr(){let{goNext:e,goBack:t,updateWizardData:n,wizardData:r}=H(),[i,a]=(0,Fr.useState)(r.systemPrompt||``),[o,s]=(0,Fr.useState)(i.length),[c,l]=(0,Fr.useState)(null);return O(`confirm:no`,t,{context:`Settings`}),O(`chat:externalEditor`,(0,Fr.useCallback)(async()=>{let e=await $t(i);e.content!==null&&(a(e.content),s(e.content.length))},[i]),{context:`Chat`}),(0,Z.jsx)(U,{subtitle:`System prompt`,footerText:(0,Z.jsxs)(D,{children:[(0,Z.jsx)(w,{shortcut:`Type`,action:`enter text`}),(0,Z.jsx)(w,{shortcut:`Enter`,action:`continue`}),(0,Z.jsx)(C,{action:`chat:externalEditor`,context:`Chat`,fallback:`ctrl+g`,description:`open in editor`}),(0,Z.jsx)(C,{action:`confirm:no`,context:`Settings`,fallback:`Esc`,description:`go back`})]}),children:(0,Z.jsxs)(T,{flexDirection:`column`,children:[(0,Z.jsx)(E,{children:`Enter the system prompt for your agent:`}),(0,Z.jsx)(E,{dimColor:!0,children:`Be comprehensive for best results`}),(0,Z.jsx)(T,{marginTop:1,children:(0,Z.jsx)(Wt,{value:i,onChange:a,onSubmit:()=>{let t=i.trim();if(!t){l(`System prompt is required`);return}l(null),n({systemPrompt:t}),e()},placeholder:`You are a helpful code reviewer who...`,columns:80,cursorOffset:o,onChangeCursorOffset:s,focus:!0,showCursor:!0})}),c&&(0,Z.jsx)(T,{marginTop:1,children:(0,Z.jsx)(E,{color:`error`,children:c})})]})})}var Fr,Z,Ir=e((()=>{Fr=t(k(),1),A(),x(),en(),S(),Ut(),G(),W(),Z=j()}));function Lr({tools:e}){let{goNext:t,goBack:n,updateWizardData:r,wizardData:i}=H(),a=e=>{r({selectedTools:e}),t()},o=i.selectedTools;return(0,Rr.jsx)(U,{subtitle:`Select tools`,footerText:(0,Rr.jsxs)(D,{children:[(0,Rr.jsx)(w,{shortcut:`Enter`,action:`toggle selection`}),(0,Rr.jsx)(w,{shortcut:`↑↓`,action:`navigate`}),(0,Rr.jsx)(C,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`})]}),children:(0,Rr.jsx)(Pn,{tools:e,initialTools:o,onComplete:a,onCancel:n})})}var Rr,zr=e((()=>{A(),S(),G(),W(),Fn(),Rr=j()}));function Br(e){let{goNext:t,goBack:n,updateWizardData:r,wizardData:i}=H(),[a,o]=(0,Vr.useState)(i.agentType||``),[s,c]=(0,Vr.useState)(null),[l,u]=(0,Vr.useState)(a.length);return O(`confirm:no`,n,{context:`Settings`}),(0,Q.jsx)(U,{subtitle:`Agent type (identifier)`,footerText:(0,Q.jsxs)(D,{children:[(0,Q.jsx)(w,{shortcut:`Type`,action:`enter text`}),(0,Q.jsx)(w,{shortcut:`Enter`,action:`continue`}),(0,Q.jsx)(C,{action:`confirm:no`,context:`Settings`,fallback:`Esc`,description:`go back`})]}),children:(0,Q.jsxs)(T,{flexDirection:`column`,children:[(0,Q.jsx)(E,{children:`Enter a unique identifier for your agent:`}),(0,Q.jsx)(T,{marginTop:1,children:(0,Q.jsx)(Wt,{value:a,onChange:o,onSubmit:e=>{let n=e.trim(),i=ir(n);if(i){c(i);return}c(null),r({agentType:n}),t()},placeholder:`e.g., test-runner, tech-lead, etc`,columns:60,cursorOffset:l,onChangeCursorOffset:u,focus:!0,showCursor:!0})}),s&&(0,Q.jsx)(T,{marginTop:1,children:(0,Q.jsx)(E,{color:`error`,children:s})})]})})}var Vr,Q,Hr=e((()=>{Vr=t(k(),1),A(),x(),S(),Ut(),G(),W(),or(),Q=j()}));function Ur({tools:e,existingAgents:t,onComplete:n,onCancel:r}){return(0,Wr.jsx)(Kn,{steps:[Sr,Or,br,()=>(0,Wr.jsx)(Br,{existingAgents:t}),Pr,pr,()=>(0,Wr.jsx)(Lr,{tools:e}),jr,nr,...wt()?[Tr]:[],()=>(0,Wr.jsx)(lr,{tools:e,existingAgents:t,onComplete:n})],initialData:{},onComplete:()=>{},onCancel:r,title:`Create new agent`,showStepCounter:!1})}var Wr,Gr=e((()=>{Tt(),G(),rr(),fr(),hr(),xr(),wr(),Dr(),Ar(),Nr(),Ir(),zr(),Hr(),Wr=j()}));function Kr({tools:e,onExit:t}){let[n,r]=(0,qr.useState)({mode:`list-agents`,source:`all`}),i=se(e=>e.agentDefinitions),a=se(e=>e.mcp.tools),o=se(e=>e.toolPermissionContext),s=c(),{allAgents:l,activeAgents:u}=i,[d,f]=(0,qr.useState)([]),p=Zt(e,a,o);Gt();let m=(0,qr.useMemo)(()=>({"built-in":l.filter(e=>e.source===`built-in`),userSettings:l.filter(e=>e.source===`userSettings`),projectSettings:l.filter(e=>e.source===`projectSettings`),policySettings:l.filter(e=>e.source===`policySettings`),localSettings:l.filter(e=>e.source===`localSettings`),flagSettings:l.filter(e=>e.source===`flagSettings`),plugin:l.filter(e=>e.source===`plugin`),all:l}),[l]),h=(0,qr.useCallback)(e=>{f(t=>[...t,e]),r({mode:`list-agents`,source:`all`})},[]),g=(0,qr.useCallback)(async e=>{try{await yn(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:Ve(n)}}}),f(t=>[...t,`Deleted agent: ${nt.bold(e.agentType)}`]),r({mode:`list-agents`,source:`all`})}catch(e){Dt(st(e))}},[s]);switch(n.mode){case`list-agents`:{let e=Bt(n.source===`all`?[...m[`built-in`],...m.userSettings,...m.projectSettings,...m.localSettings,...m.policySettings,...m.flagSettings,...m.plugin]:m[n.source],u);return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Un,{source:n.source,agents:e,onBack:()=>{t((d.length>0?`Agent changes:\n${d.join(`
101
- `)}`:void 0)??`Agents dialog dismissed`,{display:d.length===0?`system`:void 0})},onSelect:e=>r({mode:`agent-menu`,agent:e,previousMode:n}),onCreateNew:()=>r({mode:`create-agent`}),changes:d}),(0,$.jsx)(Bn,{})]})}case`create-agent`:return(0,$.jsx)(Ur,{tools:p,existingAgents:u,onComplete:h,onCancel:()=>r({mode:`list-agents`,source:`all`})});case`agent-menu`:{let e=l.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)(it,{title:n.agent.agentType,onCancel:()=>r(n.previousMode),hideInputGuide:!0,children:(0,$.jsxs)(T,{flexDirection:`column`,children:[(0,$.jsx)(Jt,{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)}),d.length>0&&(0,$.jsx)(T,{marginTop:1,children:(0,$.jsx)(E,{dimColor:!0,children:d[d.length-1]})})]})}),(0,$.jsx)(Bn,{})]})}case`view-agent`:{let e=l.find(e=>e.agentType===n.agent.agentType&&e.source===n.agent.source)||n.agent;return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(it,{title:e.agentType,onCancel:()=>r({mode:`agent-menu`,agent:e,previousMode:n.previousMode}),hideInputGuide:!0,children:(0,$.jsx)(Sn,{agent:e,tools:p,allAgents:l,onBack:()=>r({mode:`agent-menu`,agent:e,previousMode:n.previousMode})})}),(0,$.jsx)(Bn,{instructions:`Press Enter or Esc to go back`})]})}case`delete-confirm`:return(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(it,{title:`Delete agent`,onCancel:()=>{`previousMode`in n&&r(n.previousMode)},color:`error`,children:[(0,$.jsxs)(E,{children:[`Are you sure you want to delete the agent `,(0,$.jsx)(E,{bold:!0,children:n.agent.agentType}),`?`]}),(0,$.jsx)(T,{marginTop:1,children:(0,$.jsxs)(E,{dimColor:!0,children:[`Source: `,n.agent.source]})}),(0,$.jsx)(T,{marginTop:1,children:(0,$.jsx)(Jt,{options:[{label:`Yes, delete`,value:`yes`},{label:`No, cancel`,value:`no`}],onChange:e=>{e===`yes`?g(n.agent):`previousMode`in n&&r(n.previousMode)},onCancel:()=>{`previousMode`in n&&r(n.previousMode)}})})]}),(0,$.jsx)(Bn,{instructions:`Press ↑↓ to navigate, Enter to select, Esc to cancel`})]});case`edit-agent`:{let e=l.find(e=>e.agentType===n.agent.agentType&&e.source===n.agent.source)||n.agent;return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(it,{title:`Edit agent: ${e.agentType}`,onCancel:()=>r(n.previousMode),hideInputGuide:!0,children:(0,$.jsx)(Rn,{agent:e,tools:p,onSaved:e=>{h(e),r(n.previousMode)},onBack:()=>r(n.previousMode)})}),(0,$.jsx)(Bn,{})]})}default:return null}}var qr,$,Jr=e((()=>{rt(),qr=t(k(),1),Kt(),Qt(),A(),h(),Rt(),Le(),ct(),Et(),qt(),Cn(),zn(),Hn(),Gn(),xn(),Gr(),$=j()}));async function Yr(e,t){let n=t.getAppState().toolPermissionContext;return(0,Xr.jsx)(Kr,{tools:fe(n),onExit:e})}var Xr;e((()=>{Jr(),l(),Xr=j()}))();export{Yr as call};
@@ -1 +0,0 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{ay as t,cy as n}from"./loadAgentsDir-C1LkW7gl.js";import{h as r,l as i}from"./settings-DKN4xSpQ.js";function a(){let e=i(),n=[`user`,`project`,`local`].flatMap(e=>t(e).errors);return{settings:e.settings,errors:[...e.errors,...n]}}var o=e((()=>{n(),r()}));export{o as n,a as t};
@@ -1,10 +0,0 @@
1
- import{d as e,o as t}from"./envUtils-DcaKZlRU.js";import{n,t as r}from"./defineProperty-C-QyHrDq.js";import{mt as i,pt as a}from"./esm-BQY8jJNR.js";import{n as o,t as s}from"./axios-DaWTGg7G.js";import{My as c,jy as l,lC as u,vC as d}from"./loadAgentsDir-C1LkW7gl.js";import{C as f,L as ee,N as p,c as m,i as h,x as g}from"./debug-8DCufdSp.js";import{en as _,h as v,t as y,tn as b}from"./settings-DKN4xSpQ.js";import{c as te,m as x,v as S}from"./config-BddEvZZl.js";import{o as C,s as w}from"./log-DaILwWJa.js";import{n as T,r as E}from"./analytics-DJobLaWP.js";import{$n as D,Bt as ne,Cn as re,En as ie,Er as ae,Ft as oe,It as se,Jn as O,Kt as k,Lt as A,Qn as j,Rt as M,St as N,Xn as P,Xt as F,Yn as I,Zn as L,ar as R,at as z,cr as B,ct as V,ft as H,ht as U,ir as W,jt as G,pt as K,qt as ce,rr as le,sr as ue,tn as de,tr as q,wr as fe,yt as pe}from"./model-BwBE0Pt5.js";import{d as me,u as he}from"./firstPartyEventLogger-C0q45h_4.js";import{i as ge,r as _e}from"./grove-Dq8QbQ9o.js";import{t as ve}from"./policyLimits-a7ix6GnU.js";import{d as ye,n as be,t as xe}from"./status-BurdTfyz.js";import{createHash as Se,randomBytes as J}from"crypto";import{createServer as Ce}from"http";N(),de(),x(),ce(),ne(),he();async function Y(){K.cache?.clear?.(),F(),M(),me(),_e.cache?.clear?.(),ge.cache?.clear?.(),await ve()}async function X({clearOnboarding:e=!1}){let{flushTelemetry:t}=await import(`./instrumentation-BwVyvRfY.js`);await t(),await oe(),k().delete(),await Y(),S(t=>{let n={...t};return e&&(n.hasCompletedOnboarding=!1,n.subscriptionNoticeCount=0,n.hasAvailableSubscription=!1,n.customApiKeyResponses?.approved&&(n.customApiKeyResponses={...n.customApiKeyResponses,approved:[]})),n.oauthAccount=void 0,n})}t(),n(),ee(),g(),h(),T(),v(),ae(),B(),D(),u(),s(),b(),x(),ie(),C(),i();async function we(){try{if(te().claudeCodeFirstTokenDate!==void 0)return;let e=re();if(e.error){w(Error(`Failed to get auth headers: ${e.error}`));return}let t=`${_().BASE_API_URL}/api/organization/claude_code_first_token_date`,n=(await o.get(t,{headers:{...e.headers,"User-Agent":a()},timeout:1e4})).data?.first_token_date??null;if(n!==null){let e=new Date(n).getTime();if(isNaN(e)){w(Error(`Received invalid first_token_date from API: ${n}`));return}}S(e=>({...e,claudeCodeFirstTokenDate:n}))}catch(e){w(e)}}l(),b(),C();var Te=class{constructor(e=`/callback`){r(this,`localServer`,void 0),r(this,`port`,0),r(this,`promiseResolver`,null),r(this,`promiseRejecter`,null),r(this,`expectedState`,null),r(this,`pendingResponse`,null),r(this,`callbackPath`,void 0),this.localServer=Ce(),this.callbackPath=e}async start(e){return new Promise((t,n)=>{this.localServer.once(`error`,e=>{n(Error(`Failed to start OAuth callback server: ${e.message}`))}),this.localServer.listen(e??0,`localhost`,()=>{let e=this.localServer.address();this.port=e.port,t(this.port)})})}getPort(){return this.port}hasPendingResponse(){return this.pendingResponse!==null}async waitForAuthorization(e,t){return new Promise((n,r)=>{this.promiseResolver=n,this.promiseRejecter=r,this.expectedState=e,this.startLocalListener(t)})}handleSuccessRedirect(e,t){if(!this.pendingResponse)return;if(t){t(this.pendingResponse,e),this.pendingResponse=null,E(`tengu_oauth_automatic_redirect`,{custom_handler:!0});return}let n=W(e)?_().CLAUDEAI_SUCCESS_URL:_().CONSOLE_SUCCESS_URL;this.pendingResponse.writeHead(302,{Location:n}),this.pendingResponse.end(),this.pendingResponse=null,E(`tengu_oauth_automatic_redirect`,{})}handleErrorRedirect(){if(!this.pendingResponse)return;let e=_().CLAUDEAI_SUCCESS_URL;this.pendingResponse.writeHead(302,{Location:e}),this.pendingResponse.end(),this.pendingResponse=null,E(`tengu_oauth_automatic_redirect_error`,{})}startLocalListener(e){this.localServer.on(`request`,this.handleRedirect.bind(this)),this.localServer.on(`error`,this.handleError.bind(this)),e()}handleRedirect(e,t){let n=new URL(e.url||``,`http://${e.headers.host||`localhost`}`);if(n.pathname!==this.callbackPath){t.writeHead(404),t.end();return}let r=n.searchParams.get(`code`)??void 0,i=n.searchParams.get(`state`)??void 0;this.validateAndRespond(r,i,t)}validateAndRespond(e,t,n){if(!e){n.writeHead(400),n.end(`Authorization code not found`),this.reject(Error(`No authorization code received`));return}if(t!==this.expectedState){n.writeHead(400),n.end(`Invalid state parameter`),this.reject(Error(`Invalid state parameter`));return}this.pendingResponse=n,this.resolve(e)}handleError(e){w(e),this.close(),this.reject(e)}resolve(e){this.promiseResolver&&(this.promiseResolver(e),this.promiseResolver=null,this.promiseRejecter=null)}reject(e){this.promiseRejecter&&(this.promiseRejecter(e),this.promiseResolver=null,this.promiseRejecter=null)}close(){this.pendingResponse&&this.handleErrorRedirect(),this.localServer&&(this.localServer.removeAllListeners(),this.localServer.close())}};function Z(e){return e.toString(`base64`).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=/g,``)}function Ee(){return Z(J(32))}function De(e){let t=Se(`sha256`);return t.update(e),Z(t.digest())}function Oe(){return Z(J(32))}T(),D(),n();var Q=class{constructor(){r(this,`codeVerifier`,void 0),r(this,`authCodeListener`,null),r(this,`port`,null),r(this,`manualAuthCodeResolver`,null),this.codeVerifier=Ee()}async startOAuthFlow(e,t){this.authCodeListener=new Te,this.port=await this.authCodeListener.start();let n=De(this.codeVerifier),r=Oe(),i={codeChallenge:n,state:r,port:this.port,loginWithClaudeAi:t?.loginWithClaudeAi,inferenceOnly:t?.inferenceOnly,orgUUID:t?.orgUUID,loginHint:t?.loginHint,loginMethod:t?.loginMethod},a=O({...i,isManual:!0}),o=O({...i,isManual:!1}),s=await this.waitForAuthorizationCode(r,async()=>{t?.skipBrowserOpen?await e(a,o):(await e(a),await c(o))}),l=this.authCodeListener?.hasPendingResponse()??!1;E(`tengu_oauth_auth_code_received`,{automatic:l});try{let e=await P(s,r,this.codeVerifier,this.port,!l,t?.expiresIn),n=await j(e.access_token);if(l){let t=q(e.scope);this.authCodeListener?.handleSuccessRedirect(t)}return this.formatTokens(e,n.subscriptionType,n.rateLimitTier,n.rawProfile)}catch(e){throw l&&this.authCodeListener?.handleErrorRedirect(),e}finally{this.authCodeListener?.close()}}async waitForAuthorizationCode(e,t){return new Promise((n,r)=>{this.manualAuthCodeResolver=n,this.authCodeListener?.waitForAuthorization(e,t).then(e=>{this.manualAuthCodeResolver=null,n(e)}).catch(e=>{this.manualAuthCodeResolver=null,r(e)})})}handleManualAuthCodeInput(e){this.manualAuthCodeResolver&&(this.manualAuthCodeResolver(e.authorizationCode),this.manualAuthCodeResolver=null,this.authCodeListener?.close())}formatTokens(e,t,n,r){return{accessToken:e.access_token,refreshToken:e.refresh_token,expiresAt:Date.now()+e.expires_in*1e3,scopes:q(e.scope),subscriptionType:t,rateLimitTier:n,profile:r,tokenAccount:e.account?{uuid:e.account.uuid,emailAddress:e.account.email_address,organizationUuid:e.organization?.uuid}:void 0}}cleanup(){this.authCodeListener?.close(),this.manualAuthCodeResolver=null}};T(),D(),N(),x(),C(),ye();async function $(e){await X({clearOnboarding:!1});let t=e.profile??await ue(e.accessToken);t?R({accountUuid:t.account.uuid,emailAddress:t.account.email,organizationUuid:t.organization.uuid,displayName:t.account.display_name||void 0,hasExtraUsageEnabled:t.organization.has_extra_usage_enabled??void 0,billingType:t.organization.billing_type??void 0,subscriptionCreatedAt:t.organization.subscription_created_at??void 0,accountCreatedAt:t.account.created_at}):e.tokenAccount&&R({accountUuid:e.tokenAccount.uuid,emailAddress:e.tokenAccount.emailAddress,organizationUuid:e.tokenAccount.organizationUuid});let n=se(e);if(z(),n.warning&&E(`tengu_oauth_storage_warning`,{warning:n.warning}),await L(e.accessToken).catch(e=>m(String(e),{level:`error`})),W(e.scopes))await we().catch(e=>m(String(e),{level:`error`}));else if(!await I(e.accessToken))throw Error(`Unable to create API key. The server accepted the request but did not return a key.`);await Y()}async function ke({email:e,sso:t,console:n,claudeai:r}){n&&r&&(process.stderr.write(`Error: --console and --claudeai cannot be used together.
2
- `),process.exit(1));let i=y(),a=i.forceLoginMethod?i.forceLoginMethod===`claudeai`:!n,o=i.forceLoginOrgUUID,s=process.env.CLAUDE_CODE_OAUTH_REFRESH_TOKEN;if(s){let e=process.env.CLAUDE_CODE_OAUTH_SCOPES;e||(process.stderr.write(`CLAUDE_CODE_OAUTH_SCOPES is required when using CLAUDE_CODE_OAUTH_REFRESH_TOKEN.
3
- Set it to the space-separated scopes the refresh token was issued with
4
- (e.g. "user:inference" or "user:profile user:inference user:sessions:claude_code user:mcp_servers").
5
- `),process.exit(1));let t=e.split(/\s+/).filter(Boolean);try{E(`tengu_login_from_refresh_token`,{});let e=await le(s,{scopes:t});await $(e);let n=await A();n.valid||(process.stderr.write(`${n.message}\n`),process.exit(1)),S(e=>e.hasCompletedOnboarding?e:{...e,hasCompletedOnboarding:!0}),E(`tengu_oauth_success`,{loginWithClaudeAi:W(e.scopes)}),process.stdout.write(`Login successful.
6
- `),process.exit(0)}catch(e){w(e);let t=d(e);process.stderr.write(`Login failed: ${p(e)}\n${t?`${t}\n`:``}`),process.exit(1)}}let c=t?`sso`:void 0,l=new Q;try{E(`tengu_oauth_flow_start`,{loginWithClaudeAi:a}),await $(await l.startOAuthFlow(async e=>{process.stdout.write(`Opening browser to sign in…
7
- `),process.stdout.write(`If the browser didn't open, visit: ${e}\n`)},{loginWithClaudeAi:a,loginHint:e,loginMethod:c,orgUUID:o}));let t=await A();t.valid||(process.stderr.write(`${t.message}\n`),process.exit(1)),E(`tengu_oauth_success`,{loginWithClaudeAi:a}),process.stdout.write(`Login successful.
8
- `),process.exit(0)}catch(e){w(e);let t=d(e);process.stderr.write(`Login failed: ${p(e)}\n${t?`${t}\n`:``}`),process.exit(1)}finally{l.cleanup()}}async function Ae(t){let{source:n,hasToken:r}=H(),{source:i}=V(),a=!!process.env.ANTHROPIC_API_KEY&&!e(),o=U(),s=pe(),c=G(),l=r||i!==`none`||a||c,u=`none`;if(c?u=`third_party`:n===`claude.ai`?u=`claude.ai`:n===`apiKeyHelper`?u=`api_key_helper`:n===`none`?i===`ANTHROPIC_API_KEY`||a?u=`api_key`:i===`/login managed key`&&(u=`claude.ai`):u=`oauth_token`,t.text){let e=[...be(),...xe()],t=!1;for(let n of e){let e=typeof n.value==`string`?n.value:Array.isArray(n.value)?n.value.join(`, `):null;e===null||e===`none`||(t=!0,n.label?process.stdout.write(`${n.label}: ${e}\n`):process.stdout.write(`${e}\n`))}!t&&a&&process.stdout.write(`API key: ANTHROPIC_API_KEY
9
- `),l||process.stdout.write(`Not logged in.
10
- `)}else{let e=fe(),t=i===`none`?a?`ANTHROPIC_API_KEY`:null:i,n={loggedIn:l,authMethod:u,apiProvider:e};t&&(n.apiKeySource=t),u===`claude.ai`&&(n.email=o?.emailAddress??null,n.orgId=o?.organizationUuid??null,n.orgName=o?.organizationName??null,n.subscriptionType=s??null),process.stdout.write(`${f(n,null,2)}\n`)}process.exit(+!l)}export{Q as i,Ae as n,$ as r,ke as t};
@@ -1 +0,0 @@
1
- import{n as e,t}from"./auth-BTB00dq5.js";export{t as authLogin,e as authStatus};
@@ -1 +0,0 @@
1
- import{t as e}from"./backgroundHousekeeping-bEZtlJSf.js";export{e as startBackgroundHousekeeping};
@@ -1,17 +0,0 @@
1
- import{i as e,o as t}from"./envUtils-DcaKZlRU.js";import{$b as n,$s as r,CS as i,FC as a,HS as o,Ou as s,Q as c,St as l,X as u,Zg as d,Zi as f,cr as p,dt as ee,dv as te,ec as ne,fv as re,ju as m,tx as h,vr as g,wS as _,zd as v}from"./loadAgentsDir-C1LkW7gl.js";import{I as y,V as b,zt as x}from"./state-BowF111d.js";import{n as ie,t as ae}from"./cwd-BcO6WHKo.js";import{H as oe,L as S,c as C,f as w,i as T,u as E,x as D}from"./debug-8DCufdSp.js";import{d as O,h as k,v as A}from"./settings-DKN4xSpQ.js";import{x as j}from"./config-BddEvZZl.js";import{_ as M,o as N,s as P,v as F}from"./log-DaILwWJa.js";import{n as I,r as L}from"./analytics-DJobLaWP.js";import{f as R,u as z}from"./model-BwBE0Pt5.js";import{_n as B,vn as V}from"./prompt-BGqgPgCU.js";import{i as H,t as U}from"./nativeInstaller-DnSNJWIi.js";import{n as W,t as G}from"./allErrors-DaztSMrw.js";import{r as K,t as se}from"./pasteStore-DNV1M5Xd.js";import{r as ce}from"./magicDocs-DYc9TFmI.js";import{n as le,t as ue}from"./pluginAutoupdate-BJaAqwTH.js";import{n as de}from"./registerProtocol-CLIpzVwF.js";import"os";import{join as q}from"path";import"crypto";t(),x(),ie(),D(),w(),T(),F(),k(),V(),R(),ne(),g(),ce(),u(),N(),S(),f(),d(),u(),re(),S(),N(),f(),d(),v();async function fe(e,t){if(!e)return;let{join:n}=await import(`path`),r=await import(`fs/promises`),s=n(ae(),`.workmate`,`skills`,e,`SKILL.md`),l;try{l=await r.readFile(s,`utf-8`)}catch{P(Error(`Failed to read skill file for improvement: ${s}`));return}let u=t.map(e=>`- ${e.section}: ${e.change}`).join(`
2
- `),d=z(),f=await c({messages:[o({content:`You are editing a skill definition file. Apply the following improvements to the skill.
3
-
4
- <current_skill_file>
5
- ${l}
6
- </current_skill_file>
7
-
8
- <improvements>
9
- ${u}
10
- </improvements>
11
-
12
- Rules:
13
- - Integrate the improvements naturally into the existing structure
14
- - Preserve frontmatter (--- block) exactly as-is
15
- - Preserve the overall format and style
16
- - Do not remove existing content unless an improvement explicitly replaces it
17
- - Output the complete updated file inside <updated_file> tags`})],systemPrompt:a([`You edit skill definition files to incorporate user preferences. Output only the updated file content.`]),thinkingConfig:{type:`disabled`},tools:[],signal:te().signal,options:{getToolPermissionContext:async()=>B(),model:d,toolChoice:void 0,isNonInteractiveSession:!1,hasAppendSystemPrompt:!1,temperatureOverride:0,agents:[],querySource:`skill_improvement_apply`,mcpTools:[]}}),p=i(_(Array.isArray(f.message.content)?f.message.content:[]).trim(),`updated_file`);if(!p){P(Error(`Skill improvement apply: no updated_file tag in response`));return}try{await r.writeFile(s,p,`utf-8`)}catch(e){P(oe(e))}}I(),m(),j(),N(),U(),K(),W(),h(),l();var pe=30;function J(){let e=((O()||{}).cleanupPeriodDays??pe)*24*60*60*1e3;return new Date(Date.now()-e)}function me(e,t){return{messages:e.messages+t.messages,errors:e.errors+t.errors}}function he(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 Y(e,t,n){let r={messages:0,errors:0};try{let i=await E().readdir(e);for(let a of i)try{he(a.name)<t&&(await E().unlink(q(e,a.name)),n?r.messages++:r.errors++)}catch(e){P(e)}}catch(e){e instanceof Error&&`code`in e&&e.code!==`ENOENT`&&P(e)}return r}async function ge(){let e=E(),t=J(),n=M.errors(),r=M.baseLogs(),i=await Y(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=>q(r,e.name));for(let n of a)i=me(i,await Y(n,t,!0)),await Z(n,e)}catch(e){e instanceof Error&&`code`in e&&e.code!==`ENOENT`&&P(e)}return i}async function X(e,t,n){return(await n.stat(e)).mtime<t?(await n.unlink(e),!0):!1}async function Z(e,t){try{await t.rmdir(e)}catch{}}async function _e(){let e=J(),t={messages:0,errors:0},r=p(),i=E(),a;try{a=await i.readdir(r)}catch{return t}for(let o of a){if(!o.isDirectory())continue;let a=q(r,o.name),s;try{s=await i.readdir(a)}catch{t.errors++;continue}for(let r of s)if(r.isFile()){if(!r.name.endsWith(`.jsonl`)&&!r.name.endsWith(`.cast`))continue;try{await X(q(a,r.name),e,i)&&t.messages++}catch{t.errors++}}else if(r.isDirectory()){let o=q(a,r.name),s=q(o,n),c;try{c=await i.readdir(s)}catch{await Z(o,i);continue}for(let n of c)if(n.isFile())try{await X(q(s,n.name),e,i)&&t.messages++}catch{t.errors++}else if(n.isDirectory()){let r=q(s,n.name),a;try{a=await i.readdir(r)}catch{continue}for(let n of a)if(n.isFile())try{await X(q(r,n.name),e,i)&&t.messages++}catch{t.errors++}await Z(r,i)}await Z(s,i),await Z(o,i)}await Z(a,i)}return t}async function Q(e,t,n=!0){let r=J(),i={messages:0,errors:0},a=E(),o;try{o=await a.readdir(e)}catch{return i}for(let n of o)if(!(!n.isFile()||!n.name.endsWith(t)))try{await X(q(e,n.name),r,a)&&i.messages++}catch{i.errors++}return n&&await Z(e,a),i}function ve(){return Q(q(e(),`plans`),`.md`)}async function ye(){let t=J(),n={messages:0,errors:0},r=E();try{let i=q(e(),`file-history`),a;try{a=await r.readdir(i)}catch{return n}let o=a.filter(e=>e.isDirectory()).map(e=>q(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 Z(i,r)}catch(e){P(e)}return n}async function be(){let t=J(),n={messages:0,errors:0},r=E();try{let i=q(e(),`session-env`),a;try{a=await r.readdir(i)}catch{return n}let o=a.filter(e=>e.isDirectory()).map(e=>q(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 Z(i,r)}catch(e){P(e)}return n}async function xe(){let t=J(),n={messages:0,errors:0},r=E(),i=q(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 X(q(i,e.name),t,r)&&n.messages++}catch{n.errors++}return n}async function Se(){let{errors:e}=G();if(e.length>0&&A(`cleanupPeriodDays`)){C(`Skipping cleanup: settings have validation errors but cleanupPeriodDays was explicitly set. Fix settings errors to enable cleanup.`);return}await ge(),await _e(),await ve(),await ye(),await be(),await xe(),await s(),await se(J());let t=await ee(J());t>0&&L(`tengu_worktree_cleanup`,{removed:t})}x(),U(),le();var $=600*1e3;function Ce(){import(`./extractMemories-CzN3Ax2B.js`).then(({initExtractMemories:e})=>{e()}).catch(()=>{}),r(),ue(),y()&&de();let e=!0;async function t(){if(y()&&b()>Date.now()-1e3*60){setTimeout(t,$).unref();return}if(e&&(e=!1,await Se()),y()&&b()>Date.now()-1e3*60){setTimeout(t,$).unref();return}await H()}setTimeout(t,$).unref()}export{fe as n,Ce as t};
@@ -1,2 +0,0 @@
1
- import{Z as e,zt as t}from"./state-BowF111d.js";import{c as n,i as r}from"./debug-8DCufdSp.js";import{An as i,Fn as a,Kr as o,Lr as s,Pr as c,Ur as l,Yr as u}from"./settings-DKN4xSpQ.js";import{c as d,m as f,v as p}from"./config-BddEvZZl.js";import{_ as m,f as h,p as g}from"./startupProfiler-DTs9w9EN.js";import{n as _,r as v}from"./detectRepository-DfX8xXw2.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";t(),f(),r(),v(),i(),u(),l();async function w(){try{let t=await _();if(!t){n(`Not in a GitHub repository, skipping path mapping update`);return}let r=e(),i=c(r)??r,a;try{a=(await S(i)).normalize(`NFC`)}catch{a=i}let o=t.toLowerCase(),s=d().githubRepoPaths?.[o]??[];if(s[0]===a){n(`Path ${a} already tracked for repo ${o}`);return}let l=s.filter(e=>e!==a),u=[a,...l];p(e=>({...e,githubRepoPaths:{...e.githubRepoPaths,[o]:u}})),n(`Added ${a} to tracked paths for repo ${o}`)}catch(e){n(`Error updating repo path mapping: ${e}`)}}function T(e){let t=d(),n=e.toLowerCase();return t.githubRepoPaths?.[n]??[]}async function E(e){let t=await Promise.all(e.map(a));return e.filter((e,n)=>t[n])}m(),u(),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 s(e);if(!t)return;let n=await o(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};
@@ -1,2 +0,0 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{ci as t,hr as n,mr as r,ni as i,sr as a,vr as o,wr as s}from"./loadAgentsDir-C1LkW7gl.js";import{l as c,u as l}from"./types-zk5Ltv5q.js";import{Z as u,ut as d,zt as f}from"./state-BowF111d.js";import{C as p,x as m}from"./debug-8DCufdSp.js";import{i as h,o as g}from"./stringUtils-BQm3OfeJ.js";import{n as _,r as v}from"./analytics-DJobLaWP.js";import{randomUUID as y}from"crypto";import{mkdir as b,readFile as x,writeFile as S}from"fs/promises";function C(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 w(e){let t=y(),i=d(),o=a(u()),c=n(t),f=r();await b(o,{recursive:!0,mode:448});let m;try{m=await x(f)}catch{throw Error(`No conversation to branch`)}if(m.length===0)throw Error(`No conversation to branch`);let h=l(m),g=h.filter(e=>s(e)&&!e.isSidechain),_=h.filter(e=>e.type===`content-replacement`&&e.sessionId===i).flatMap(e=>e.replacements);if(g.length===0)throw Error(`No messages to branch`);let v=null,C=[],w=[];for(let e of g){let n={...e,sessionId:t,parentUuid:v,isSidechain:!1,forkedFrom:{sessionId:i,messageUuid:e.uuid}},r={...e,sessionId:t};w.push(r),C.push(p(n)),e.type!==`progress`&&(v=e.uuid)}if(_.length>0){let e={type:`content-replacement`,sessionId:t,replacements:_};C.push(p(e))}return await S(c,`${C.join(`
2
- `)}\n`,{encoding:`utf8`,mode:384}),{sessionId:t,title:e,forkPath:c,serializedMessages:w,contentReplacementRecords:_}}async function T(e){let n=`${e} (Branch)`;if((await t(n,{exact:!0})).length===0)return n;let r=await t(`${e} (Branch`),i=new Set([1]),a=RegExp(`^${h(e)} \\(Branch(?: (\\d+))?\\)$`);for(let e of r){let t=e.customTitle?.match(a);t&&(t[1]?i.add(parseInt(t[1],10)):i.add(1))}let o=2;for(;i.has(o);)o++;return`${e} (Branch ${o})`}async function E(e,t,n){let r=n?.trim()||void 0,a=d();try{let{sessionId:n,title:o,forkPath:s,serializedMessages:c,contentReplacementRecords:l}=await w(r),u=new Date,d=C(c.find(e=>e.type===`user`)),f=await T(o??d);await i(n,f,s),v(`tengu_conversation_forked`,{message_count:c.length,has_custom_title:!!o});let p={date:u.toISOString().split(`T`)[0],messages:c,fullPath:s,value:u.getTime(),created:u,modified:u,firstPrompt:d,messageCount:c.length,isSidechain:!1,sessionId:n,customTitle:f,contentReplacements:l},m=o?` "${o}"`:``,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((()=>{f(),_(),c(),o(),m(),g()}))();export{E as call,C as deriveFirstPrompt};
@@ -1 +0,0 @@
1
- import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{$u as n,Bs as r,Ch as i,DS as a,FC as o,Sh as s,Yb as c,Zg as l,Zi as u,at as d,dv as f,fv as p,ot as m,td as h,wh as g,zs as _}from"./loadAgentsDir-C1LkW7gl.js";import{I as v,P as y,ai as b,bn as x,ot as S,t as C,vn as w,xt as T}from"./src-DL3w8VPk.js";import{t as E}from"./jsx-runtime-Bb4Xn-E0.js";import{L as D,N as O}from"./debug-8DCufdSp.js";import{Ht as k}from"./settings-DKN4xSpQ.js";import{m as A,v as j}from"./config-BddEvZZl.js";import{n as M,t as N}from"./SpinnerGlyph-A6G-gloN.js";import{n as P,r as F}from"./sideQuestion-CMB8hfgX.js";import{i as I,n as L}from"./modalContext-DDZdU1J8.js";function R({question:e,context:t,onDone:r}){let[i,a]=(0,H.useState)(null),[o,s]=(0,H.useState)(null),[c,l]=(0,H.useState)(0),u=(0,H.useRef)(null),{rows:d}=I(S());x(()=>l(e=>e+1),i||o?null:80);function p(e){if(e.key===`escape`||e.key===`return`||e.key===` `||e.ctrl&&(e.key===`c`||e.key===`d`)){e.preventDefault(),r(void 0,{display:`skip`});return}(e.key===`up`||e.ctrl&&e.key===`p`)&&(e.preventDefault(),u.current?.scrollBy(-3)),(e.key===`down`||e.ctrl&&e.key===`n`)&&(e.preventDefault(),u.current?.scrollBy(K))}(0,H.useEffect)(()=>{let n=f();async function r(){try{let r=await F({question:e,cacheSafeParams:await B(t)});n.signal.aborted||(r.response?a(r.response):s(`No response received`))}catch(e){n.signal.aborted||s(O(e)||`Failed to get response`)}}return r(),()=>{n.abort()}},[e,t]);let m=Math.max(5,d-W-G);return(0,U.jsxs)(v,{flexDirection:`column`,paddingLeft:2,marginTop:1,tabIndex:0,autoFocus:!0,onKeyDown:p,children:[(0,U.jsxs)(v,{children:[(0,U.jsxs)(y,{color:`warning`,bold:!0,children:[`/btw`,` `]}),(0,U.jsx)(y,{dimColor:!0,children:e})]}),(0,U.jsx)(v,{marginTop:1,marginLeft:2,maxHeight:m,children:(0,U.jsx)(T,{ref:u,flexDirection:`column`,flexGrow:1,children:o?(0,U.jsx)(y,{color:`error`,children:o}):i?(0,U.jsx)(n,{children:i}):(0,U.jsxs)(v,{children:[(0,U.jsx)(N,{frame:c,messageColor:`warning`}),(0,U.jsx)(y,{color:`warning`,children:`Answering...`})]})})}),(i||o)&&(0,U.jsx)(v,{marginTop:1,children:(0,U.jsxs)(y,{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=a(z(e.messages)),n=_();if(n)return{systemPrompt:n.systemPrompt,userContext:n.userContext,systemContext:n.systemContext,toolUseContext:e,forkContextMessages:t};let[r,c,l]=await Promise.all([d(e.options.tools,e.options.mainLoopModel,[],e.options.mcpClients),i(),s()]);return{systemPrompt:o(r),userContext:c,systemContext:l,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(b(),1),w(),h(),M(),k(),m(),L(),g(),c(),C(),p(),A(),D(),r(),u(),P(),l(),U=E(),W=5,G=6,K=3}))();export{V as call};
@@ -1 +0,0 @@
1
- import{n as e,t}from"./caches-ouaWB9bY.js";e();export{t as clearSessionCaches};
@@ -1 +0,0 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{C_ as t,Ch as n,Dh as r,Eh as i,G as a,Pd as o,Pi as s,Qf as c,Sh as l,Th as u,Ti as d,Ui as f,Yh as p,Zf as m,Zh as h,dx as g,ff as _,ju as v,ku as y,ns as b,q as x,qi as S,rs as C,uf as w,ux as T,w_ as E,wh as D,xh as O}from"./loadAgentsDir-C1LkW7gl.js";import{bn as k,l as A,zt as j}from"./state-BowF111d.js";import{Gr as M,Yr as N}from"./settings-DKN4xSpQ.js";import{a as P,n as F}from"./fileSuggestions-B-SLfb-o.js";import{r as I,t as L}from"./magicDocs-DYc9TFmI.js";import{r as R,t as z}from"./detectRepository-DfX8xXw2.js";function B(e=new Set){let t=e.size>0;n.cache.clear?.(),l.cache.clear?.(),O.cache.clear?.(),i.cache.clear?.(),F(),d(),t||h(),u(null),k(null),_(),C(),E(`session_start`),y(),z(),a(),A(e),M(),f(),c(),L(),T(),import(`./SearchExtraToolsTool-DSy_jDhf.js`).then(({clearSearchExtraToolsDescriptionCache:e})=>e()),import(`./loadAgentsDir-DKXap_Om.js`).then(({clearAgentDefinitionsCache:e})=>e()),import(`./prompt-BPJDGlx5.js`).then(({clearPromptCache:e})=>e())}var V=e((()=>{j(),s(),r(),D(),P(),o(),p(),w(),m(),I(),S(),b(),x(),t(),R(),N(),v(),g()}));export{V as n,B as t};
@@ -1 +0,0 @@
1
- import{r as e,t}from"./client-DdenNfkQ.js";e();export{t as clearOpenAIClientCache};
@@ -1 +0,0 @@
1
- import{n as e,t}from"./client-DvhWKIOx.js";e();export{t as getGrokClient};
@@ -1 +0,0 @@
1
- import{Pi as e,Ti as t,ki as n}from"./loadAgentsDir-C1LkW7gl.js";e();export{t as clearCommandsCache,n as getCommands};
@@ -1,2 +0,0 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{Ch as t,DS as n,Fm as r,Im as i,Jb as a,Ju as o,Mh as s,Nh as c,Oh as l,Rm as u,Sh as d,Vh as f,Xh as p,Yh as m,Yu as h,Zi as g,at as _,bh as v,ff as y,hn as b,if as x,kh as S,of as C,ot as w,qb as T,qh as E,uf as D,wh as O,yh as k,zm as A}from"./loadAgentsDir-C1LkW7gl.js";import{di as j,fi as M}from"./src-DL3w8VPk.js";import{Vt as N,zt as P}from"./state-BowF111d.js";import{I as F,L as I}from"./debug-8DCufdSp.js";import{o as L,s as R}from"./log-DaILwWJa.js";function z(e,t){let n=o(`tip`),r=T(`app:toggleTranscript`,`Global`,`ctrl+o`),i=[...e.options.verbose?[]:[`(${r} to see full summary)`],...t?[t]:[],...n?[n]:[]];return j.dim(`Compacted ${i.join(`
2
- `)}`)}async function B(e,n){let r=e.getAppState(),i=await _(e.options.tools,e.options.mainLoopModel,Array.from(r.toolPermissionContext.additionalWorkingDirectories.keys()),e.options.mcpClients),a=k({mainThreadAgentDefinition:void 0,toolUseContext:e,customSystemPrompt:e.options.customSystemPrompt,defaultSystemPrompt:i,appendSystemPrompt:e.options.appendSystemPrompt}),[o,s]=await Promise.all([t(),d()]);return{systemPrompt:a,userContext:o,systemContext:s,toolUseContext:e,forkContextMessages:n}}var V;e((()=>{M(),P(),w(),O(),a(),m(),A(),s(),l(),D(),x(),f(),I(),b(),L(),g(),h(),v(),V=async(e,a)=>{let{abortController:o}=a,{messages:s}=a;if(s=n(s),s.length===0)throw Error(`No messages to compact`);let l=e.trim();try{if(!l){let e=await C(s,a.agentId);if(e)return t.cache.clear?.(),y(),p(a.options.querySource??`compact`,a.agentId),N(),c(),{type:`compact`,compactionResult:e,displayText:z(a)}}let e=(await S(s,a)).messages,n=await u(e,a,await B(a,e),!1,l,!1);return E(void 0),c(),t.cache.clear?.(),y(),{type:`compact`,compactionResult:n,displayText:z(a,n.userDisplayMessage)}}catch(e){throw o.signal.aborted?Error(`Compaction canceled.`):F(e,`Not enough messages to compact. Send a few more messages first, then try again.`)?Error(i):F(e,`Compaction interrupted · This may be due to network issues — please try again.`)?Error(r):(R(e),Error(`Error during compaction: ${e}`))}}}))();export{V as call};
@@ -1,3 +0,0 @@
1
- import{i as e,n as t,t as n}from"./rolldown-runtime-DaDcL9Zw.js";import{n as r,t as i}from"./isObject-C6qM3WEW.js";import{n as a,t as o}from"./memoize-BK3gG5ob.js";import{c as s,i as c,l,o as u}from"./envUtils-DcaKZlRU.js";import{t as d}from"./graceful-fs-DDVg0cja.js";import{f,h as p,l as m,m as h}from"./types-zk5Ltv5q.js";import{Cr as g,Xr as _,Yr as v,Z as ee,_r as te,br as ne,ci as re,di as ie,dr as ae,fi as oe,fr as se,ft as ce,gr as le,hr as ue,ii as de,ni as fe,ri as pe,si as me,ti as he,tt as ge,vr as _e,wr as ve,yr as ye,zt as be}from"./state-BowF111d.js";import{n as xe,t as Se}from"./cwd-BcO6WHKo.js";import{C as y,L as Ce,O as b,P as x,S as we,c as S,et as Te,f as Ee,i as De,tt as Oe,u as C,x as ke}from"./debug-8DCufdSp.js";import{An as Ae,Kt as w,Nr as je,Ur as Me,Vn as Ne,_i as Pe,bi as Fe,cr as Ie,di as Le,gi as Re,h as ze,in as Be,lr as T,ni as Ve,nn as He,qt as Ue,s as E,t as We,ti as Ge,ui as Ke,wr as qe,xi as Je}from"./settings-DKN4xSpQ.js";import{d as Ye,o as Xe,s as Ze,u as Qe}from"./log-DaILwWJa.js";import{n as $e,r as D}from"./analytics-DJobLaWP.js";import{homedir as et}from"os";import{basename as O,dirname as k,isAbsolute as tt,join as A,normalize as j,resolve as nt,sep as rt}from"path";import{unwatchFile as it,watchFile as at}from"fs";import{randomBytes as ot}from"crypto";var M,st=t((()=>{oe(),Le(),fe(),pe(),M=Object.getOwnPropertySymbols?function(e){for(var t=[];e;)ie(t,he(e)),e=Ke(e);return t}:de}));function ct(e){return me(e,Pe,M)}var lt=t((()=>{re(),st(),Re()}));function ut(){let e=process.env.CLAUDE_CODE_DISABLE_AUTO_MEMORY;if(l(e))return!1;if(s(e))return!0;if(l(process.env.CLAUDE_CODE_SIMPLE)||l(process.env.CLAUDE_CODE_REMOTE)&&!process.env.CLAUDE_CODE_REMOTE_MEMORY_DIR)return!1;let t=We();return t.autoMemoryEnabled===void 0||t.autoMemoryEnabled}function dt(){return!1}function ft(){return process.env.CLAUDE_CODE_REMOTE_MEMORY_DIR?process.env.CLAUDE_CODE_REMOTE_MEMORY_DIR:c()}function pt(e,t){if(!e)return;let n=e;if(t&&(n.startsWith(`~/`)||n.startsWith(`~\\`))){let e=n.slice(2),t=j(e||`.`);if(t===`.`||t===`..`)return;n=A(et(),e)}let r=j(n).replace(/[/\\]+$/,``);if(!(!tt(r)||r.length<3||/^[A-Za-z]:$/.test(r)||r.startsWith(`\\\\`)||r.startsWith(`//`)||r.includes(`\0`)))return(r+rt).normalize(`NFC`)}function mt(){return pt(process.env.CLAUDE_COWORK_MEMORY_PATH_OVERRIDE,!1)}function ht(){return pt(E(`policySettings`)?.autoMemoryDirectory??E(`flagSettings`)?.autoMemoryDirectory??E(`localSettings`)?.autoMemoryDirectory??E(`userSettings`)?.autoMemoryDirectory,!0)}function gt(){return mt()!==void 0}function _t(){return je(ge())??ge()}function vt(){return A(N(),xt)}function yt(e){return j(e).startsWith(N())}var bt,xt,N,St=t((()=>{o(),be(),u(),Me(),Ie(),ze(),bt=`memory`,xt=`MEMORY.md`,N=a(()=>(mt()??ht())||(A(A(ft(),`projects`),qe(_t()),bt)+rt).normalize(`NFC`),()=>ge())}));function Ct(e,t,n,i){if(!r(e))return e;t=ye(t,e);for(var a=-1,o=t.length,s=o-1,c=e;c!=null&&++a<o;){var l=_e(t[a]),u=n;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=r(d)?d:_(t[a+1])?[]:{})}Fe(c,l,u),c=c[l]}return e}var wt=t((()=>{Je(),ne(),v(),i(),te()}));function Tt(e,t,n){for(var r=-1,i=t.length,a={};++r<i;){var o=t[r],s=ue(e,o);n(s,o)&&Ct(a,ye(o,e),s)}return a}var Et=t((()=>{le(),wt(),ne()}));function P(e,t){if(e==null)return{};var n=g(ct(e),function(e){return[e]});return t=ae(t),Tt(e,n,function(e,n){return t(e,n[0])})}var Dt=t((()=>{ve(),se(),Et(),lt()})),Ot=n(((e,t)=>{function n(e,t){typeof t==`boolean`&&(t={forever:t}),this._originalTimeouts=JSON.parse(JSON.stringify(e)),this._timeouts=e,this._options=t||{},this._maxRetryTime=t&&t.maxRetryTime||1/0,this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=null,this._operationStart=null,this._options.forever&&(this._cachedTimeouts=this._timeouts.slice(0))}t.exports=n,n.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts},n.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timeouts=[],this._cachedTimeouts=null},n.prototype.retry=function(e){if(this._timeout&&clearTimeout(this._timeout),!e)return!1;var t=new Date().getTime();if(e&&t-this._operationStart>=this._maxRetryTime)return this._errors.unshift(Error(`RetryOperation timeout occurred`)),!1;this._errors.push(e);var n=this._timeouts.shift();if(n===void 0)if(this._cachedTimeouts)this._errors.splice(this._errors.length-1,this._errors.length),this._timeouts=this._cachedTimeouts.slice(0),n=this._timeouts.shift();else return!1;var r=this,i=setTimeout(function(){r._attempts++,r._operationTimeoutCb&&(r._timeout=setTimeout(function(){r._operationTimeoutCb(r._attempts)},r._operationTimeout),r._options.unref&&r._timeout.unref()),r._fn(r._attempts)},n);return this._options.unref&&i.unref(),!0},n.prototype.attempt=function(e,t){this._fn=e,t&&(t.timeout&&(this._operationTimeout=t.timeout),t.cb&&(this._operationTimeoutCb=t.cb));var n=this;this._operationTimeoutCb&&(this._timeout=setTimeout(function(){n._operationTimeoutCb()},n._operationTimeout)),this._operationStart=new Date().getTime(),this._fn(this._attempts)},n.prototype.try=function(e){console.log(`Using RetryOperation.try() is deprecated`),this.attempt(e)},n.prototype.start=function(e){console.log(`Using RetryOperation.start() is deprecated`),this.attempt(e)},n.prototype.start=n.prototype.try,n.prototype.errors=function(){return this._errors},n.prototype.attempts=function(){return this._attempts},n.prototype.mainError=function(){if(this._errors.length===0)return null;for(var e={},t=null,n=0,r=0;r<this._errors.length;r++){var i=this._errors[r],a=i.message,o=(e[a]||0)+1;e[a]=o,o>=n&&(t=i,n=o)}return t}})),kt=n((e=>{var t=Ot();e.operation=function(n){return new t(e.timeouts(n),{forever:n&&n.forever,unref:n&&n.unref,maxRetryTime:n&&n.maxRetryTime})},e.timeouts=function(e){if(e instanceof Array)return[].concat(e);var t={retries:10,factor:2,minTimeout:1*1e3,maxTimeout:1/0,randomize:!1};for(var n in e)t[n]=e[n];if(t.minTimeout>t.maxTimeout)throw Error(`minTimeout is greater than maxTimeout`);for(var r=[],i=0;i<t.retries;i++)r.push(this.createTimeout(i,t));return e&&e.forever&&!r.length&&r.push(this.createTimeout(i,t)),r.sort(function(e,t){return e-t}),r},e.createTimeout=function(e,t){var n=t.randomize?Math.random()+1:1,r=Math.round(n*t.minTimeout*t.factor**+e);return r=Math.min(r,t.maxTimeout),r},e.wrap=function(t,n,r){if(n instanceof Array&&(r=n,n=null),!r)for(var i in r=[],t)typeof t[i]==`function`&&r.push(i);for(var a=0;a<r.length;a++){var o=r[a],s=t[o];t[o]=function(r){var i=e.operation(n),a=Array.prototype.slice.call(arguments,1),o=a.pop();a.push(function(e){i.retry(e)||(e&&(arguments[0]=i.mainError()),o.apply(this,arguments))}),i.attempt(function(){r.apply(t,a)})}.bind(t,s),t[o].options=n}}})),At=n(((e,t)=>{t.exports=kt()})),jt=n(((e,t)=>{t.exports=[`SIGABRT`,`SIGALRM`,`SIGHUP`,`SIGINT`,`SIGTERM`],process.platform!==`win32`&&t.exports.push(`SIGVTALRM`,`SIGXCPU`,`SIGXFSZ`,`SIGUSR2`,`SIGTRAP`,`SIGSYS`,`SIGQUIT`,`SIGIOT`),process.platform===`linux`&&t.exports.push(`SIGIO`,`SIGPOLL`,`SIGPWR`,`SIGSTKFLT`,`SIGUNUSED`)})),Mt=n(((t,n)=>{var r=global.process,i=function(e){return e&&typeof e==`object`&&typeof e.removeListener==`function`&&typeof e.emit==`function`&&typeof e.reallyExit==`function`&&typeof e.listeners==`function`&&typeof e.kill==`function`&&typeof e.pid==`number`&&typeof e.on==`function`};if(!i(r))n.exports=function(){return function(){}};else{var a=e(`assert`),o=jt(),s=/^win/i.test(r.platform),c=e(`events`);typeof c!=`function`&&(c=c.EventEmitter);var l;r.__signal_exit_emitter__?l=r.__signal_exit_emitter__:(l=r.__signal_exit_emitter__=new c,l.count=0,l.emitted={}),l.infinite||(l.setMaxListeners(1/0),l.infinite=!0),n.exports=function(e,t){if(!i(global.process))return function(){};a.equal(typeof e,`function`,`a callback must be provided for exit handler`),p===!1&&m();var n=`exit`;return t&&t.alwaysLast&&(n=`afterexit`),l.on(n,e),function(){l.removeListener(n,e),l.listeners(`exit`).length===0&&l.listeners(`afterexit`).length===0&&u()}};var u=function(){!p||!i(global.process)||(p=!1,o.forEach(function(e){try{r.removeListener(e,f[e])}catch{}}),r.emit=_,r.reallyExit=h,--l.count)};n.exports.unload=u;var d=function(e,t,n){l.emitted[e]||(l.emitted[e]=!0,l.emit(e,t,n))},f={};o.forEach(function(e){f[e]=function(){i(global.process)&&r.listeners(e).length===l.count&&(u(),d(`exit`,null,e),d(`afterexit`,null,e),s&&e===`SIGHUP`&&(e=`SIGINT`),r.kill(r.pid,e))}}),n.exports.signals=function(){return o};var p=!1,m=function(){p||!i(global.process)||(p=!0,l.count+=1,o=o.filter(function(e){try{return r.on(e,f[e]),!0}catch{return!1}}),r.emit=v,r.reallyExit=g)};n.exports.load=m;var h=r.reallyExit,g=function(e){i(global.process)&&(r.exitCode=e||0,d(`exit`,r.exitCode,null),d(`afterexit`,r.exitCode,null),h.call(r,r.exitCode))},_=r.emit,v=function(e,t){if(e===`exit`&&i(global.process)){t!==void 0&&(r.exitCode=t);var n=_.apply(this,arguments);return d(`exit`,r.exitCode,null),d(`afterexit`,r.exitCode,null),n}else return _.apply(this,arguments)}}})),Nt=n(((e,t)=>{var n=Symbol();function r(e,t,r){let i=t[n];if(i)return t.stat(e,(e,t)=>{if(e)return r(e);r(null,t.mtime,i)});let a=new Date(Math.ceil(Date.now()/1e3)*1e3+5);t.utimes(e,a,a,i=>{if(i)return r(i);t.stat(e,(e,i)=>{if(e)return r(e);let a=i.mtime.getTime()%1e3==0?`s`:`ms`;Object.defineProperty(t,n,{value:a}),r(null,i.mtime,a)})})}function i(e){let t=Date.now();return e===`s`&&(t=Math.ceil(t/1e3)*1e3),new Date(t)}t.exports.probe=r,t.exports.getMtime=i})),Pt=n(((t,n)=>{var r=e(`path`),i=d(),a=At(),o=Mt(),s=Nt(),c={};function l(e,t){return t.lockfilePath||`${e}.lock`}function u(e,t,n){if(!t.realpath)return n(null,r.resolve(e));t.fs.realpath(e,n)}function f(e,t,n){let r=l(e,t);t.fs.mkdir(r,i=>{if(!i)return s.probe(r,t.fs,(e,i,a)=>{if(e)return t.fs.rmdir(r,()=>{}),n(e);n(null,i,a)});if(i.code!==`EEXIST`)return n(i);if(t.stale<=0)return n(Object.assign(Error(`Lock file is already being held`),{code:`ELOCKED`,file:e}));t.fs.stat(r,(r,i)=>{if(r)return r.code===`ENOENT`?f(e,{...t,stale:0},n):n(r);if(!p(i,t))return n(Object.assign(Error(`Lock file is already being held`),{code:`ELOCKED`,file:e}));m(e,t,r=>{if(r)return n(r);f(e,{...t,stale:0},n)})})})}function p(e,t){return e.mtime.getTime()<Date.now()-t.stale}function m(e,t,n){t.fs.rmdir(l(e,t),e=>{if(e&&e.code!==`ENOENT`)return n(e);n()})}function h(e,t){let n=c[e];n.updateTimeout||(n.updateDelay=n.updateDelay||t.update,n.updateTimeout=setTimeout(()=>{n.updateTimeout=null,t.fs.stat(n.lockfilePath,(r,i)=>{let a=n.lastUpdate+t.stale<Date.now();if(r)return r.code===`ENOENT`||a?g(e,n,Object.assign(r,{code:`ECOMPROMISED`})):(n.updateDelay=1e3,h(e,t));if(n.mtime.getTime()!==i.mtime.getTime())return g(e,n,Object.assign(Error(`Unable to update lock within the stale threshold`),{code:`ECOMPROMISED`}));let o=s.getMtime(n.mtimePrecision);t.fs.utimes(n.lockfilePath,o,o,r=>{let i=n.lastUpdate+t.stale<Date.now();if(!n.released){if(r)return r.code===`ENOENT`||i?g(e,n,Object.assign(r,{code:`ECOMPROMISED`})):(n.updateDelay=1e3,h(e,t));n.mtime=o,n.lastUpdate=Date.now(),n.updateDelay=null,h(e,t)}})})},n.updateDelay),n.updateTimeout.unref&&n.updateTimeout.unref())}function g(e,t,n){t.released=!0,t.updateTimeout&&clearTimeout(t.updateTimeout),c[e]===t&&delete c[e],t.options.onCompromised(n)}function _(e,t,n){t={stale:1e4,update:null,realpath:!0,retries:0,fs:i,onCompromised:e=>{throw e},...t},t.retries=t.retries||0,t.retries=typeof t.retries==`number`?{retries:t.retries}:t.retries,t.stale=Math.max(t.stale||0,2e3),t.update=t.update==null?t.stale/2:t.update||0,t.update=Math.max(Math.min(t.update,t.stale/2),1e3),u(e,t,(e,r)=>{if(e)return n(e);let i=a.operation(t.retries);i.attempt(()=>{f(r,t,(e,a,o)=>{if(i.retry(e))return;if(e)return n(i.mainError());let s=c[r]={lockfilePath:l(r,t),mtime:a,mtimePrecision:o,options:t,lastUpdate:Date.now()};h(r,t),n(null,e=>{if(s.released)return e&&e(Object.assign(Error(`Lock is already released`),{code:`ERELEASED`}));v(r,{...t,realpath:!1},e)})})})})}function v(e,t,n){t={fs:i,realpath:!0,...t},u(e,t,(e,r)=>{if(e)return n(e);let i=c[r];if(!i)return n(Object.assign(Error(`Lock is not acquired/owned by you`),{code:`ENOTACQUIRED`}));i.updateTimeout&&clearTimeout(i.updateTimeout),i.released=!0,delete c[r],m(r,t,n)})}function ee(e,t,n){t={stale:1e4,realpath:!0,fs:i,...t},t.stale=Math.max(t.stale||0,2e3),u(e,t,(e,r)=>{if(e)return n(e);t.fs.stat(l(r,t),(e,r)=>e?e.code===`ENOENT`?n(null,!1):n(e):n(null,!p(r,t)))})}function te(){return c}o(()=>{for(let e in c){let t=c[e].options;try{t.fs.rmdirSync(l(e,t))}catch{}}}),n.exports.lock=_,n.exports.unlock=v,n.exports.check=ee,n.exports.getLocks=te})),Ft=n(((e,t)=>{var n=d();function r(e){let t=[`mkdir`,`realpath`,`stat`,`rmdir`,`utimes`],n={...e};return t.forEach(t=>{n[t]=(...n)=>{let r=n.pop(),i;try{i=e[`${t}Sync`](...n)}catch(e){return r(e)}r(null,i)}}),n}function i(e){return(...t)=>new Promise((n,r)=>{t.push((e,t)=>{e?r(e):n(t)}),e(...t)})}function a(e){return(...t)=>{let n,r;if(t.push((e,t)=>{n=e,r=t}),e(...t),n)throw n;return r}}function o(e){if(e={...e},e.fs=r(e.fs||n),typeof e.retries==`number`&&e.retries>0||e.retries&&typeof e.retries.retries==`number`&&e.retries.retries>0)throw Object.assign(Error(`Cannot use retries with the sync api`),{code:`ESYNC`});return e}t.exports={toPromise:i,toSync:a,toSyncOptions:o}})),It=n(((e,t)=>{var n=Pt(),{toPromise:r,toSync:i,toSyncOptions:a}=Ft();async function o(e,t){return r(await r(n.lock)(e,t))}function s(e,t){return i(i(n.lock)(e,a(t)))}function c(e,t){return r(n.unlock)(e,t)}function l(e,t){return i(n.unlock)(e,a(t))}function u(e,t){return r(n.check)(e,t)}function d(e,t){return i(n.check)(e,a(t))}t.exports=o,t.exports.lock=o,t.exports.unlock=c,t.exports.lockSync=s,t.exports.unlockSync=l,t.exports.check=u,t.exports.checkSync=d}));function F(){return I||(I=It()),I}function Lt(e,t){return F().lock(e,t)}function Rt(e,t){return F().lockSync(e,t)}function zt(e,t){return F().check(e,t)}var I,Bt=t((()=>{}));function L(){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`,customApiKeyResponses:{approved:[],rejected:[]},env:{},tipsHistory:{},memoryUsageCount:0,promptQueueUseCount:0,btwUseCount:0,todoFeatureEnabled:!0,showExpandedTodos:!1,messageIdleNotifThresholdMs:6e4,autoConnectIde:!1,autoInstallIdeExtension:!0,fileCheckpointingEnabled:!0,terminalProgressBarEnabled:!0,cachedStatsigGates:{},cachedDynamicConfigs:{},respectGitignore:!0}}function Vt(){return un||(un=Ht())}function Ht(){if(ce())return!0;let e=V(),t=$();if(e.projects?.[t]?.hasTrustDialogAccepted)return!0;let n=T(Se());for(;;){if(e.projects?.[n]?.hasTrustDialogAccepted)return!0;let t=T(nt(n,`..`));if(t===n)break;n=t}return!1}function R(e){let t=q.config;if(!t)return!1;let n=t.oauthAccount!==void 0&&e.oauthAccount===void 0,r=t.hasCompletedOnboarding===!0&&e.hasCompletedOnboarding!==!0;return n||r}function z(e){let t=null;try{Yt(w(),L,n=>{let r=e(n);return r===n?n:(t={...r,projects:Gt(n.projects)},t)})&&t&&B(t)}catch(n){S(`Failed to save config with lock: ${n}`,{level:`error`});let r=U(w(),L);if(R(r)){S(`saveGlobalConfig fallback: re-read config is missing auth that cache has; refusing to write. See GH #3117.`,{level:`error`}),D(`tengu_config_auth_loss_prevented`,{});return}let i=e(r);if(i===r)return;t={...i,projects:Gt(r.projects)},Jt(w(),t,K),B(t)}}function Ut(){let e=Y+X;e>0&&D(`tengu_config_cache_stats`,{cache_hits:Y,cache_misses:X,hit_rate:Y/e}),Y=0,X=0}function Wt(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 Gt(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 Kt(){if(Z)return;Z=!0;let e=w();at(e,{interval:fn,persistent:!1},t=>{t.mtimeMs<=q.mtime||C().readFile(e,{encoding:`utf-8`}).then(e=>{if(t.mtimeMs<=q.mtime)return;let n=f(p(e));typeof n!=`object`||!n||(q={config:Wt({...L(),...n}),mtime:t.mtimeMs},J={mtime:t.mtimeMs,size:t.size})}).catch(()=>{})}),Oe(async()=>{it(e),Z=!1})}function B(e){q={config:e,mtime:Date.now()},J=null}function V(){if(q.config)return Y++,q.config;X++;try{let e=null;try{e=C().statSync(w())}catch{}let t=Wt(U(w(),L));return q={config:t,mtime:e?.mtimeMs??Date.now()},J=e?{mtime:e.mtimeMs,size:e.size}:null,Kt(),t}catch{return Wt(U(w(),L))}}function qt(e){let t=V();return t.customApiKeyResponses?.approved?.includes(e)?`approved`:t.customApiKeyResponses?.rejected?.includes(e)?`rejected`:`new`}function Jt(e,t,n){let r=k(e);C().mkdirSync(r),Ne(e,y(P(t,(e,t)=>y(e)!==y(n[t])),null,2),{encoding:`utf-8`,mode:384}),e===w()&&dn++}function Yt(e,t,n){let r=t(),i=k(e),a=C();a.mkdirSync(i);let o;try{let i=`${e}.lock`,s=Date.now();o=Rt(e,{lockfilePath:i,onCompromised:e=>{S(`Config lock compromised: ${e}`,{level:`error`})}});let c=Date.now()-s;if(c>100&&(S(`Lock acquisition took longer than expected - another Work Mate instance may be running`),D(`tengu_config_lock_contention`,{lock_time_ms:c})),J&&e===w())try{let t=a.statSync(e);(t.mtimeMs!==J.mtime||t.size!==J.size)&&D(`tengu_config_stale_write`,{read_mtime:J.mtime,write_mtime:t.mtimeMs,read_size:J.size,write_size:t.size})}catch(e){if(x(e)!==`ENOENT`)throw e}let l=U(e,t);if(e===w()&&R(l))return S(`saveConfigWithLock: re-read config is missing auth that cache has; refusing to write to avoid wiping ~/.workmate.json. See GH #3117.`,{level:`error`}),D(`tengu_config_auth_loss_prevented`,{}),!1;let u=n(l);if(u===l)return!1;let d=P(u,(e,t)=>y(e)!==y(r[t]));try{let t=O(e),n=H();try{a.mkdirSync(n)}catch(e){if(x(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=A(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(A(n,e))}catch{}}catch(e){x(e)!==`ENOENT`&&S(`Failed to backup config: ${e}`,{level:`error`})}return Ne(e,y(d,null,2),{encoding:`utf-8`,mode:384}),e===w()&&dn++,!0}finally{o&&o()}}function Xt(){if(Q)return;let e=Date.now();Ve(`info`,`enable_configs_started`),Q=!0,U(w(),L,!0),Ve(`info`,`enable_configs_completed`,{duration_ms:Date.now()-e})}function H(){return A(c(),`backups`)}function Zt(e){let t=C(),n=O(e),r=H();try{let e=t.readdirStringSync(r).filter(e=>e.startsWith(`${n}.backup.`)).sort().at(-1);if(e)return A(r,e)}catch{}let i=k(e);try{let r=t.readdirStringSync(i).filter(e=>e.startsWith(`${n}.backup.`)).sort().at(-1);if(r)return A(i,r);let a=`${e}.backup`;try{return t.statSync(a),a}catch{}}catch{}return null}function U(e,t,n){if(!Q)throw Error(`Config accessed before allowed.`);let r=C();try{let n=r.readFileSync(e,{encoding:`utf-8`});try{let e=we(p(n));return{...t(),...e}}catch(n){throw new b(n instanceof Error?n.message:String(n),e,t())}}catch(i){if(x(i)===`ENOENT`){let n=Zt(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 b&&n)throw i;if(i instanceof b){if(S(`Config file corrupted, resetting to defaults: ${i.message}`,{level:`error`}),!W){W=!0;try{Ze(i);let t=!1;try{r.statSync(`${e}.backup`),t=!0}catch{}D(`tengu_config_parse_error`,{has_backup:t})}finally{W=!1}}process.stderr.write(`\nWork Mate configuration file at ${e} is corrupted: ${i.message}\n`);let t=O(e),n=H();try{r.mkdirSync(n)}catch(e){if(x(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(A(n,e),{encoding:`utf-8`})){s=!0;break}}catch{}if(!s){o=A(n,`${t}.corrupted.${Date.now()}`);try{r.copyFileSync(e,o),S(`Corrupted config backed up to: ${o}`,{level:`error`})}catch{}}let l=Zt(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 Qt(){let e=$(),t=V();if(!t.projects)return G;let n=t.projects[e]??G;return typeof n.allowedTools==`string`&&(n.allowedTools=f(n.allowedTools)??[]),n}function $t(e){let t=$(),n=null;try{Yt(w(),L,r=>{let i=r.projects?.[t]??G,a=e(i);return a===i?r:(n={...r,projects:{...r.projects,[t]:a}},n)})&&n&&B(n)}catch(r){S(`Failed to save config with lock: ${r}`,{level:`error`});let i=U(w(),L);if(R(i)){S(`saveCurrentProjectConfig fallback: re-read config is missing auth that cache has; refusing to write. See GH #3117.`,{level:`error`}),D(`tengu_config_auth_loss_prevented`,{});return}let a=i.projects?.[t]??G,o=e(a);if(o===a)return;n={...i,projects:{...i.projects,[t]:o}},Jt(w(),n,K),B(n)}}function en(){return rn()!==null}function tn(){return en()&&!l(process.env.FORCE_AUTOUPDATE_PLUGINS)}function nn(e){switch(e.type){case`development`:return`development build`;case`env`:return`${e.envVar} set`;case`config`:return`config`}}function rn(){if(!l(process.env.ENABLE_AUTOUPDATER))return{type:`config`};if(l(process.env.DISABLE_AUTOUPDATER))return{type:`env`,envVar:`DISABLE_AUTOUPDATER`};let e=Qe();if(e)return{type:`env`,envVar:e};let t=V();return t.autoUpdates===!1&&(t.installMethod!==`native`||t.autoUpdatesProtectedForNative!==!0)?{type:`config`}:null}function an(){let e=V();if(e.userID)return e.userID;let t=ot(32).toString(`hex`);return z(e=>({...e,userID:t})),t}function on(){if(!V().firstStartTime){let e=new Date().toISOString();z(t=>({...t,firstStartTime:t.firstStartTime??e}))}}function sn(e){let t=ee();switch(e){case`User`:return A(c(),`AGENTS.md`);case`Local`:return A(t,`AGENTS.local.md`);case`Project`:return A(t,`AGENTS.md`);case`Managed`:return A(He(),`AGENTS.md`);case`AutoMem`:return vt();default:return A(c(),`AGENTS.md`)}}function cn(){return A(He(),`.workmate`,`rules`)}function ln(){return A(c(),`rules`)}var W,G,K,un,q,J,Y,X,dn,fn,Z,Q,$,pn=t((()=>{o(),Dt(),be(),St(),$e(),xe(),Te(),De(),Ge(),Ue(),u(),Ce(),Ae(),Ee(),Me(),m(),h(),Bt(),Xe(),Ie(),Ye(),Be(),ke(),W=!1,G={allowedTools:[],mcpContextUris:[],mcpServers:{},enabledMcpjsonServers:[],disabledMcpjsonServers:[],hasTrustDialogAccepted:!1,projectOnboardingSeenCount:0,hasAgentsMdExternalIncludesApproved:!1,hasAgentsMdExternalIncludesWarningShown:!1},K=L(),un=!1,{...K},{...G},q={config:null,mtime:0},J=null,Y=0,X=0,dn=0,Oe(async()=>{Ut()}),fn=1e3,Z=!1,Q=!1,$=a(()=>{let e=ee();return T(je(e)||nt(e))})}));export{gt as A,Dt as C,vt as D,wt as E,ct as F,lt as I,M as L,yt as M,ut as N,N as O,dt as P,st as R,Lt as S,Ct as T,$t as _,rn as a,zt as b,V as c,an as d,$ as f,on as g,en as h,nn as i,St as j,ft as k,cn as l,pn as m,Vt as n,Qt as o,ln as p,Xt as r,qt as s,K as t,sn as u,z as v,P as w,Bt as x,tn as y};
@@ -1 +0,0 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{t}from"./jsx-runtime-Bb4Xn-E0.js";import{n,t as r}from"./Settings-mDykHLok.js";var i,a;e((()=>{n(),i=t(),a=async(e,t)=>(0,i.jsx)(r,{onClose:e,context:t,defaultTab:`Config`})}))();export{a as call};
@@ -1 +0,0 @@
1
- import{m as e,r as t}from"./config-BddEvZZl.js";e();export{t as enableConfigs};
@@ -1 +0,0 @@
1
- import{n as e,r as t,t as n}from"./context-noninteractive-CJhUu_4y.js";t();export{n as call,e as collectContextData};
@@ -1 +0,0 @@
1
- import{n as e,t}from"./conversation-MxEVm54C.js";e();export{t as clearConversation};
@@ -1 +0,0 @@
1
- import{a as e,n as t}from"./rolldown-runtime-DaDcL9Zw.js";import{$f as n,Aw as r,Dn as i,Kn as a,On as o,St as s,Tn as c,Tw as l,Um as u,Wm as d,Zr as f,cT as p,cx as m,er as h,fm as g,hn as _,hs as v,lx as y,ms as b,om as x,qt as S,si as C,sm as w,sn as T,tT as E,tp as D,ui as O,um as k,vr as A,yt as j}from"./loadAgentsDir-C1LkW7gl.js";import{H as M,Jt as N,Kt as P,Z as F,_n as I,gn as L,yn as R,zt as z}from"./state-BowF111d.js";import{o as B,s as V}from"./log-DaILwWJa.js";import{n as H,r as U}from"./analytics-DJobLaWP.js";import{n as W,t as G}from"./caches-ouaWB9bY.js";import{randomUUID as K}from"crypto";async function q({setMessages:t,readFileState:o,discoveredSkillNames:s,loadedNestedMemoryPaths:u,getAppState:p,setAppState:m,setConversationId:g}){let _=T();await S(`clear`,{getAppState:p,setAppState:m,signal:AbortSignal.timeout(_),timeoutMs:_});let b=M();b&&U(`tengu_cache_eviction_hint`,{scope:`conversation_clear`,last_request_id:b});let x=new Set,D=[],z=e=>`isBackgrounded`in e&&e.isBackgrounded===!1;if(p)for(let e of Object.values(p().tasks))z(e)||v(e)&&(x.add(e.agentId),D.push(e));t(()=>[]);let{setContextBlocked:B}=(l(),e(r));B(!1),g&&g(K()),G(x),L(null),I(null),R(null),N(),y(F()),o.clear(),s?.clear(),u?.clear(),m&&m(e=>{let t={};for(let[n,r]of Object.entries(e.tasks)){if(!z(r)){t[n]=r;continue}try{r.status===`running`&&(w(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)}c(n)}return{...e,tasks:t,attribution:n(),standaloneAgentContext:void 0,fileHistory:{snapshots:[],trackedFiles:new Set,snapshotSequence:0},mcp:{clients:[],tools:[],commands:[],resources:{},pluginReconnectKey:e.mcp.pluginReconnectKey}}}),E(),a(),P({setCurrentAsParent:!0}),await f();for(let e of D)e.status===`running`&&i(e.id,h(k(e.agentId)));let{saveMode:H}=(A(),e(O));H(`normal`);let W=j();W&&C(W);let q=await d(`clear`);q.length>0&&t(()=>q)}var J=t((()=>{z(),H(),b(),x(),g(),D(),_(),B(),p(),m(),u(),A(),o(),s(),W()}));export{J as n,q as t};