@readmagic/workmate 0.0.21 → 0.0.22

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 (461) hide show
  1. package/dist/chunks/AddWorkspaceDirectory-DWgTWJ7R.js +1 -0
  2. package/dist/chunks/AgentsMdExternalIncludesDialog-DCvgQ6n3.js +1 -0
  3. package/dist/chunks/AgentsMdExternalIncludesDialog-s0Orgord.js +1 -0
  4. package/dist/chunks/App-BcEI6U5j.js +1 -0
  5. package/dist/chunks/ApproveApiKey-DegdTXZl.js +1 -0
  6. package/dist/chunks/ApproveApiKey-_VXIMSwY.js +1 -0
  7. package/dist/chunks/BackgroundTasksDialog-CjBt1L0p.js +2 -0
  8. package/dist/chunks/BypassPermissionsModeDialog-D2Gesf-u.js +1 -0
  9. package/dist/chunks/CustomSelect-B46Eh0gU.js +1 -0
  10. package/dist/chunks/DiffDialog-v2IiYyi3.js +6 -0
  11. package/dist/chunks/Doctor-BP0Rqraa.js +1 -0
  12. package/dist/chunks/Doctor-By_y3C2V.js +3 -0
  13. package/dist/chunks/ExitFlow-BasHk1mk.js +2 -0
  14. package/dist/chunks/Grove-C3mhgshv.js +11 -0
  15. package/dist/chunks/InvalidConfigDialog-DYVQK5js.js +1 -0
  16. package/dist/chunks/InvalidSettingsDialog-Dg6OiStR.js +1 -0
  17. package/dist/chunks/KeybindingProviderSetup-Bn1jzN5F.js +1 -0
  18. package/dist/chunks/MCPConnectionManager-ChN4Ayjk.js +1 -0
  19. package/dist/chunks/MCPToolListView-DLSrQHDc.js +1 -0
  20. package/dist/chunks/{McpParsingWarnings-6ENzOklf.js → McpParsingWarnings-DZejAh8b.js} +1 -1
  21. package/dist/chunks/MessageSelector-CdDlJE48.js +3 -0
  22. package/dist/chunks/Messages-DuL_r1Or.js +10 -0
  23. package/dist/chunks/Onboarding-CE2GNA-h.js +1 -0
  24. package/dist/chunks/{PromptInputFooterSuggestions-Blzgj5yW.js → PromptInputFooterSuggestions-lkr_A5jQ.js} +1 -1
  25. package/dist/chunks/PromptInputHelpMenu-DaQKKyM5.js +1 -0
  26. package/dist/chunks/QueryEngine-DNNy1UCD.js +1 -0
  27. package/dist/chunks/REPL-CEhW-C41.js +1 -0
  28. package/dist/chunks/REPL-CkSL4C_8.js +124 -0
  29. package/dist/chunks/ResumeConversation-BMCO_3X7.js +1 -0
  30. package/dist/chunks/SearchExtraToolsTool-DSy_jDhf.js +1 -0
  31. package/dist/chunks/SelectMulti-CNE06VAN.js +1 -0
  32. package/dist/chunks/Settings-mDykHLok.js +2 -0
  33. package/dist/chunks/Spinner-DwsJJUtn.js +1 -0
  34. package/dist/chunks/SpinnerGlyph-A6G-gloN.js +1 -0
  35. package/dist/chunks/TextInput-7uqPhq9T.js +22 -0
  36. package/dist/chunks/ThemePicker-DT9zVy-0.js +1 -0
  37. package/dist/chunks/TrustDialog-G4jM9IfM.js +1 -0
  38. package/dist/chunks/{ValidationErrorsList-2QWIs_6h.js → ValidationErrorsList-BLtP647v.js} +1 -1
  39. package/dist/chunks/add-dir-7RfQAC3h.js +1 -0
  40. package/dist/chunks/{agentDisplay-1Y-N-gqz.js → agentDisplay-vLQHFrmq.js} +1 -1
  41. package/dist/chunks/agents-BNg_skSm.js +101 -0
  42. package/dist/chunks/{agents-CvW8XjoJ.js → agents-DLz0kfsr.js} +1 -1
  43. package/dist/chunks/allErrors-DaztSMrw.js +1 -0
  44. package/dist/chunks/appleTerminalBackup-BYKdf3of.js +1 -0
  45. package/dist/chunks/auth-BTB00dq5.js +10 -0
  46. package/dist/chunks/auth-Bbc0Ny8i.js +1 -0
  47. package/dist/chunks/backgroundHousekeeping-DYz83_8C.js +1 -0
  48. package/dist/chunks/backgroundHousekeeping-bEZtlJSf.js +17 -0
  49. package/dist/chunks/banner-mqZEluky.js +2 -0
  50. package/dist/chunks/branch-exFKkymg.js +2 -0
  51. package/dist/chunks/{break-cache-BZ_UMtEL.js → break-cache-BL2gnDLX.js} +2 -2
  52. package/dist/chunks/btw-3l78DYET.js +1 -0
  53. package/dist/chunks/caches-6Nx6tsk9.js +1 -0
  54. package/dist/chunks/caches-ouaWB9bY.js +1 -0
  55. package/dist/chunks/claudeDesktop-D3PEgx3U.js +1 -0
  56. package/dist/chunks/{clear-D2KRoibg.js → clear-CXfhVRp8.js} +1 -1
  57. package/dist/chunks/client-C01Bnxxv.js +1 -0
  58. package/dist/chunks/client-DYRgRQsr.js +1 -0
  59. package/dist/chunks/{client-C_jBL1yC.js → client-DdenNfkQ.js} +1 -1
  60. package/dist/chunks/client-DvhWKIOx.js +1 -0
  61. package/dist/chunks/commands-BoxOw75F.js +1 -0
  62. package/dist/chunks/compact-BOYr105K.js +2 -0
  63. package/dist/chunks/config-BddEvZZl.js +3 -0
  64. package/dist/chunks/config-GEv9hUzz.js +1 -0
  65. package/dist/chunks/config-kw4xg7Nk.js +1 -0
  66. package/dist/chunks/{context-Db9tH1VF.js → context-3s9wtn4L.js} +1 -1
  67. package/dist/chunks/{context-noninteractive-CacA9VlT.js → context-noninteractive-CJhUu_4y.js} +9 -9
  68. package/dist/chunks/context-noninteractive-DFvoZ2L9.js +1 -0
  69. package/dist/chunks/conversation-CoGharlH.js +1 -0
  70. package/dist/chunks/conversation-MxEVm54C.js +1 -0
  71. package/dist/chunks/conversationRecovery-Da_8uldZ.js +1 -0
  72. package/dist/chunks/crossProjectResume-CzPCHq_K.js +40 -0
  73. package/dist/chunks/cwd-BcO6WHKo.js +1 -0
  74. package/dist/chunks/cwd-CDUelriw.js +1 -0
  75. package/dist/chunks/{datadog-BuElf2EQ.js → datadog-v_mXWncN.js} +1 -1
  76. package/dist/chunks/{debug-D58GQBDG.js → debug-8DCufdSp.js} +4 -4
  77. package/dist/chunks/detectRepository-DfX8xXw2.js +1 -0
  78. package/dist/chunks/{diff-yA6v_dpP.js → diff-DJSt7QO6.js} +1 -1
  79. package/dist/chunks/directoryCompletion-CT6YVeg7.js +1 -0
  80. package/dist/chunks/doctor-DWvioSU9.js +1 -0
  81. package/dist/chunks/entry-ex0-RyYV.js +13 -0
  82. package/dist/chunks/esm-BQY8jJNR.js +1 -0
  83. package/dist/chunks/{execFileNoThrow-B_KRY4cT.js → execFileNoThrow-BsfuytkN.js} +1 -1
  84. package/dist/chunks/exit-BxC_ZEtO.js +1 -0
  85. package/dist/chunks/extraUsage-DYm33Occ.js +1 -0
  86. package/dist/chunks/extractMemories-CzN3Ax2B.js +1 -0
  87. package/dist/chunks/fast-DqUpl_Lr.js +1 -0
  88. package/dist/chunks/fast-NUdUyAaM.js +1 -0
  89. package/dist/chunks/fetchModelList-CqsTAWEN.js +1 -0
  90. package/dist/chunks/fetchModelList-DBMHE6Ng.js +1 -0
  91. package/dist/chunks/fileSuggestions-B-SLfb-o.js +3 -0
  92. package/dist/chunks/firstPartyEventLogger-C0q45h_4.js +3 -0
  93. package/dist/chunks/firstPartyEventLogger-CP8hCBDj.js +1 -0
  94. package/dist/chunks/gemini-BC9kHhwe.js +2 -0
  95. package/dist/chunks/generateSessionName-ChvKBVxB.js +1 -0
  96. package/dist/chunks/{genericProcessUtils-Cnyun_Wr.js → genericProcessUtils-BYi0OefF.js} +1 -1
  97. package/dist/chunks/goal-ByyimpVU.js +3 -0
  98. package/dist/chunks/grok-DenjixMl.js +1 -0
  99. package/dist/chunks/grove-Dq8QbQ9o.js +7 -0
  100. package/dist/chunks/help-CK90i4hE.js +1 -0
  101. package/dist/chunks/history-CNQNd6hT.js +1 -0
  102. package/dist/chunks/{hooks-BDgToO1Z.js → hooks-BRFDg9DV.js} +2 -2
  103. package/dist/chunks/hooks-BaYwmkxD.js +1 -0
  104. package/dist/chunks/install-ZMll-dAa.js +1 -0
  105. package/dist/chunks/instrumentation-BwVyvRfY.js +21 -0
  106. package/dist/chunks/{job-DYMfSglZ.js → job-G_ukhLc4.js} +1 -1
  107. package/dist/chunks/keybindings-wNxBzDVQ.js +1 -0
  108. package/dist/chunks/launchLocalMemory-BcRlXLm6.js +3 -0
  109. package/dist/chunks/launchOnboarding-CDjQ64RO.js +8 -0
  110. package/dist/chunks/{loadAgentsDir-C96o6gCj.js → loadAgentsDir-C1LkW7gl.js} +551 -621
  111. package/dist/chunks/loadAgentsDir-DKXap_Om.js +1 -0
  112. package/dist/chunks/{loadPluginHooks-0nGlugZ4.js → loadPluginHooks-DtmHtEiS.js} +1 -1
  113. package/dist/chunks/{loader-C33o_5kS.js → loader-C61fB6vU.js} +1 -1
  114. package/dist/chunks/localSearch-BB9x5C2N.js +1 -0
  115. package/dist/chunks/{localSearch-DLz5IGGu.js → localSearch-DFo_WTMm.js} +1 -1
  116. package/dist/chunks/log-DaILwWJa.js +1 -0
  117. package/dist/chunks/logoUtils-Dj_2SWmO.js +1 -0
  118. package/dist/chunks/{magicDocs-DmPNMnNY.js → magicDocs-DYc9TFmI.js} +2 -2
  119. package/dist/chunks/main-BRg8L_aw.js +346 -0
  120. package/dist/chunks/managedEnv-DsqAYOJ4.js +1 -0
  121. package/dist/chunks/managedEnv-lybrMred.js +1 -0
  122. package/dist/chunks/mcp-Bsw3cMiJ.js +6 -0
  123. package/dist/chunks/mcp-DDdud6Y7.js +1 -0
  124. package/dist/chunks/mcp-DbgTDUt7.js +2 -0
  125. package/dist/chunks/memory-CzwTzihf.js +1 -0
  126. package/dist/chunks/mode-Pan-Q2c4.js +2 -0
  127. package/dist/chunks/model-BYfmXKHf.js +1 -0
  128. package/dist/chunks/model-BwBE0Pt5.js +1 -0
  129. package/dist/chunks/modelOptions-DvNBapgG.js +1 -0
  130. package/dist/chunks/nativeInstaller-DnSNJWIi.js +1 -0
  131. package/dist/chunks/notifications-B0DTaYoy.js +1 -0
  132. package/dist/chunks/omit-Dl1Us_PY.js +1 -0
  133. package/dist/chunks/onChangeAppState-4KOJMN82.js +1 -0
  134. package/dist/chunks/openai-C_6C1_0N.js +10 -0
  135. package/dist/chunks/overlayContext-CMV7nYR9.js +1 -0
  136. package/dist/chunks/{panel-Cm23FDVt.js → panel-D9fGQgln.js} +1 -1
  137. package/dist/chunks/parser-BKAVMTyD.js +1 -0
  138. package/dist/chunks/{parser-eVu-cTRs.js → parser-D8slvrJP.js} +1 -1
  139. package/dist/chunks/partition-B504IgAa.js +1 -0
  140. package/dist/chunks/pasteStore-DNV1M5Xd.js +1 -0
  141. package/dist/chunks/permissions-CLFMhdRk.js +3 -0
  142. package/dist/chunks/pidLock-D9do1Afy.js +3 -0
  143. package/dist/chunks/{plan-s228H7IU.js → plan-CQLnPLuE.js} +1 -1
  144. package/dist/chunks/{platform-DMQxcm4K.js → platform-Dzff1WWw.js} +1 -1
  145. package/dist/chunks/plugin-BYdF7uob.js +17 -0
  146. package/dist/chunks/{pluginAutoupdate-aLXhSUVD.js → pluginAutoupdate-BJaAqwTH.js} +1 -1
  147. package/dist/chunks/{pluginBlocklist-BprCv0En.js → pluginBlocklist-DKKmOnWM.js} +1 -1
  148. package/dist/chunks/pluginCliCommands-z8TtJMKH.js +1 -0
  149. package/dist/chunks/{pluginFlagging-BSLuTk3M.js → pluginFlagging-DQP8tBi2.js} +1 -1
  150. package/dist/chunks/pluginOperations-BcfJCDco.js +2 -0
  151. package/dist/chunks/{pluginStartupCheck-xQbHZ5gf.js → pluginStartupCheck-CfRvCrFg.js} +1 -1
  152. package/dist/chunks/pluginStartupCheck-Cq4PvULa.js +1 -0
  153. package/dist/chunks/plugins-CTM8jpOw.js +4 -0
  154. package/dist/chunks/policyLimits-a7ix6GnU.js +1 -0
  155. package/dist/chunks/poorMode-C11JEH3d.js +1 -0
  156. package/dist/chunks/{poorMode-Bt_A2arj.js → poorMode-J5SYJvoY.js} +1 -1
  157. package/dist/chunks/print-u6MzL5Cr.js +13 -0
  158. package/dist/chunks/processBashCommand-DIwrI2QC.js +1 -0
  159. package/dist/chunks/processSlashCommand-B-Gujpxm.js +5 -0
  160. package/dist/chunks/projectOnboardingState-CJycxw5P.js +1 -0
  161. package/dist/chunks/{prompt-BNNE5tsG.js → prompt-BGqgPgCU.js} +3 -3
  162. package/dist/chunks/prompt-BPJDGlx5.js +1 -0
  163. package/dist/chunks/prompt-DEdZzkEz.js +1 -0
  164. package/dist/chunks/promptEditor-CmQ9p4oe.js +4 -0
  165. package/dist/chunks/{protocolHandler-DukQ6b4Q.js → protocolHandler-CJo9-PfZ.js} +2 -2
  166. package/dist/chunks/{proxy-BhIc7-mj.js → proxy-CB17QimU.js} +2 -2
  167. package/dist/chunks/reconciler-DSKLuOS7.js +1 -0
  168. package/dist/chunks/refresh-BbZFCNpn.js +1 -0
  169. package/dist/chunks/registerProtocol-CLIpzVwF.js +1 -0
  170. package/dist/chunks/reload-plugins-DjugL8jH.js +1 -0
  171. package/dist/chunks/rename-DOtCOtEr.js +1 -0
  172. package/dist/chunks/{renderOptions-D-aQZbzS.js → renderOptions-Zqfm2U1y.js} +1 -1
  173. package/dist/chunks/resume-BB4T4WIV.js +2 -0
  174. package/dist/chunks/ripgrep-BuzOTf1S.js +5 -0
  175. package/dist/chunks/ripgrep-CZ2CqaHb.js +1 -0
  176. package/dist/chunks/{runtimeObserver-DS1PK6We.js → runtimeObserver-CK_iZ6OB.js} +1 -1
  177. package/dist/chunks/{runtimeObserver-CsZw5XBt.js → runtimeObserver-CpP0L9T9.js} +4 -4
  178. package/dist/chunks/sandbox-adapter-DhJJ6WOV.js +1 -0
  179. package/dist/chunks/sandbox-toggle-KOHYvbQT.js +1 -0
  180. package/dist/chunks/searchExtraTools-CdJghGkj.js +1 -0
  181. package/dist/chunks/select-C_KXmqbI.js +1 -0
  182. package/dist/chunks/sessionFileAccessHooks-D7KbWFp7.js +1 -0
  183. package/dist/chunks/sessionObserver-DB-sLv-X.js +1 -0
  184. package/dist/chunks/{sessionObserver-N7fORFdL.js → sessionObserver-WOYv2n7C.js} +2 -2
  185. package/dist/chunks/sessionStorage-sgOAbDn7.js +1 -0
  186. package/dist/chunks/{sessionTracing-fIp8g04N.js → sessionTracing-yBre24PH.js} +2 -2
  187. package/dist/chunks/settings-C-KNkvsM.js +1 -0
  188. package/dist/chunks/settings-DKN4xSpQ.js +24 -0
  189. package/dist/chunks/setup-CN_Pk7AR.js +3 -0
  190. package/dist/chunks/{shadowedRuleDetection-DEo1hvGi.js → shadowedRuleDetection-Df-kZ_pK.js} +1 -1
  191. package/dist/chunks/{sideQuestion-C11KgNGL.js → sideQuestion-CMB8hfgX.js} +3 -3
  192. package/dist/chunks/sinks-BS17vtN0.js +1 -0
  193. package/dist/chunks/sinks-D1EjkHb4.js +1 -0
  194. package/dist/chunks/skillChangeDetector-CBKuGuEi.js +1 -0
  195. package/dist/chunks/{skillGapStore-H4MkUFUY.js → skillGapStore-CfmlO6pb.js} +2 -2
  196. package/dist/chunks/{skillLifecycle-ADUTDK7D.js → skillLifecycle-BQ2LMfMx.js} +2 -2
  197. package/dist/chunks/{skillSearchPanel-PpfVDMGR.js → skillSearchPanel-BwYuwLFs.js} +4 -4
  198. package/dist/chunks/skills-BVHPQma0.js +1 -0
  199. package/dist/chunks/startupProfiler-B_U4QDtf.js +1 -0
  200. package/dist/chunks/startupProfiler-DTs9w9EN.js +3 -0
  201. package/dist/chunks/{state-D5D6QpTX.js → state-BowF111d.js} +1 -1
  202. package/dist/chunks/state-CGuyDES7.js +1 -0
  203. package/dist/chunks/status-BurdTfyz.js +2 -0
  204. package/dist/chunks/status-DMq1An5h.js +1 -0
  205. package/dist/chunks/statusNoticeHelpers-X75JNlx5.js +1 -0
  206. package/dist/chunks/stringUtils-BQm3OfeJ.js +4 -0
  207. package/dist/chunks/{switcher-DWfKi17X.js → switcher-Bq1Ct_Sn.js} +1 -1
  208. package/dist/chunks/switcher-DGD4ORVf.js +1 -0
  209. package/dist/chunks/{tasks-BwSsj2vI.js → tasks-0c8Uy04D.js} +1 -1
  210. package/dist/chunks/tempfile-CHO5wXsV.js +1 -0
  211. package/dist/chunks/{templateJobs-fiKuu4DK.js → templateJobs-BdFzE9XG.js} +1 -1
  212. package/dist/chunks/terminalSetup-Cf_r6pwK.js +32 -0
  213. package/dist/chunks/{terminalSetup-Cte5a4hM.js → terminalSetup-D7J6bxcn.js} +1 -1
  214. package/dist/chunks/{theme-CAoGjf2D.js → theme-Bby4fssR.js} +1 -1
  215. package/dist/chunks/tipRegistry-CyRXWWTz.js +2 -0
  216. package/dist/chunks/{toolEventObserver-Cq_ZV7x9.js → toolEventObserver-CzFZUIsM.js} +1 -1
  217. package/dist/chunks/toolPool-CnrZcprA.js +1 -0
  218. package/dist/chunks/types-zk5Ltv5q.js +81 -0
  219. package/dist/chunks/udsClient-ftP0yIpe.js +1 -0
  220. package/dist/chunks/use-select-navigation-DMaC_3iw.js +1 -0
  221. package/dist/chunks/useDoublePress-C9xxQzh1.js +1 -0
  222. package/dist/chunks/useExitOnCtrlCDWithKeybindings-CjW3gUOt.js +1 -0
  223. package/dist/chunks/useMainLoopModel-DWscpA9I.js +1 -0
  224. package/dist/chunks/useManagePlugins-CYXVcql2.js +1 -0
  225. package/dist/chunks/useMergedTools-DarmnCEw.js +1 -0
  226. package/dist/chunks/useSearchInput-C2JuUW3g.js +1 -0
  227. package/dist/chunks/useSettingsErrors-DutJBiKZ.js +1 -0
  228. package/dist/chunks/util-Bq5l7FF5.js +1 -0
  229. package/dist/chunks/validatePlugin-DIdEydz_.js +1 -0
  230. package/dist/chunks/{vim-xruiCyUd.js → vim-D8prM2IH.js} +1 -1
  231. package/dist/chunks/worktree-Caqt2WRZ.js +1 -0
  232. package/dist/cli.js +1 -1
  233. package/package.json +1 -1
  234. package/dist/chunks/AddWorkspaceDirectory-DgAxYgBY.js +0 -1
  235. package/dist/chunks/AgentsMdExternalIncludesDialog-DGMRVexR.js +0 -1
  236. package/dist/chunks/AgentsMdExternalIncludesDialog-Dp6CwZyI.js +0 -1
  237. package/dist/chunks/App-VWyPd524.js +0 -1
  238. package/dist/chunks/ApproveApiKey-Bolw0sPs.js +0 -1
  239. package/dist/chunks/ApproveApiKey-CyNPMd6g.js +0 -1
  240. package/dist/chunks/BackgroundTasksDialog-DxagIOOw.js +0 -2
  241. package/dist/chunks/BypassPermissionsModeDialog-OS2S66zQ.js +0 -1
  242. package/dist/chunks/DiffDialog-CMtml9iw.js +0 -6
  243. package/dist/chunks/Doctor-Bk9P37mU.js +0 -1
  244. package/dist/chunks/Doctor-D9F3tKsr.js +0 -3
  245. package/dist/chunks/ExitFlow-DhRv5JPj.js +0 -2
  246. package/dist/chunks/Grove-Bbh8PpH0.js +0 -11
  247. package/dist/chunks/HybridTransport-P1vEUwhv.js +0 -2
  248. package/dist/chunks/InvalidConfigDialog-xAYpE-20.js +0 -1
  249. package/dist/chunks/InvalidSettingsDialog-CXFSISy3.js +0 -1
  250. package/dist/chunks/MCPConnectionManager-CoId-C__.js +0 -1
  251. package/dist/chunks/MCPToolListView-BQkQ-hyF.js +0 -1
  252. package/dist/chunks/MessageSelector-BvRVrfg6.js +0 -3
  253. package/dist/chunks/Messages-Cykztq1O.js +0 -10
  254. package/dist/chunks/Onboarding-CfeRwPNQ.js +0 -1
  255. package/dist/chunks/PromptInputHelpMenu-Ckp0k8E3.js +0 -1
  256. package/dist/chunks/QueryEngine-DduzztIG.js +0 -1
  257. package/dist/chunks/REPL-B8e5UU3H.js +0 -128
  258. package/dist/chunks/REPL-C4mbOhyL.js +0 -1
  259. package/dist/chunks/RemoteSessionManager-BPESC6Wu.js +0 -2
  260. package/dist/chunks/ResumeConversation-DG1sLryB.js +0 -1
  261. package/dist/chunks/SSETransport-CDNP2PlK.js +0 -2
  262. package/dist/chunks/SearchExtraToolsTool-vK2PP628.js +0 -1
  263. package/dist/chunks/Settings-B7n_dfP-.js +0 -2
  264. package/dist/chunks/TeleportProgress-QL3ibQfK.js +0 -1
  265. package/dist/chunks/TeleportRepoMismatchDialog-f-xl7biD.js +0 -1
  266. package/dist/chunks/TeleportResumeWrapper-DzVcrFuP.js +0 -1
  267. package/dist/chunks/ThemePicker-CIFKZza0.js +0 -1
  268. package/dist/chunks/TrustDialog-C0HEwZPk.js +0 -1
  269. package/dist/chunks/add-dir-DmEhPnvj.js +0 -1
  270. package/dist/chunks/agents-D96ng5I9.js +0 -101
  271. package/dist/chunks/allErrors-CT2dbBF3.js +0 -1
  272. package/dist/chunks/api-DTyrmy1O.js +0 -1
  273. package/dist/chunks/api-DumFOErN.js +0 -1
  274. package/dist/chunks/auth-CZ4EsFWF.js +0 -10
  275. package/dist/chunks/auth-QvonHoG9.js +0 -1
  276. package/dist/chunks/auth-jV5THRH8.js +0 -1
  277. package/dist/chunks/backgroundHousekeeping-C72oPgfD.js +0 -17
  278. package/dist/chunks/backgroundHousekeeping-D9PScHES.js +0 -1
  279. package/dist/chunks/banner-ChT5Ri7Q.js +0 -2
  280. package/dist/chunks/bg-qG2osBbP.js +0 -9
  281. package/dist/chunks/branch-K8X6jx0i.js +0 -2
  282. package/dist/chunks/bridgeConfig-C-bI-slm.js +0 -1
  283. package/dist/chunks/bridgeConfig-_xpxhGB5.js +0 -1
  284. package/dist/chunks/bridgeMessaging-DSJlYarJ.js +0 -1
  285. package/dist/chunks/bridgePointer-DfTOjgtX.js +0 -1
  286. package/dist/chunks/bridgeStatusUtil-DaEq5c69.js +0 -1
  287. package/dist/chunks/btw-BNs5OX7x.js +0 -1
  288. package/dist/chunks/bundledMode--fG1S62b.js +0 -1
  289. package/dist/chunks/caches-CC5NHwAz.js +0 -1
  290. package/dist/chunks/caches-nHxJWXgO.js +0 -1
  291. package/dist/chunks/capacityWake-BpP6c7x3.js +0 -3
  292. package/dist/chunks/ccrClient-JnhF5b3z.js +0 -1
  293. package/dist/chunks/claudeDesktop-DPc_SaVn.js +0 -1
  294. package/dist/chunks/cliLaunch-DDtwAolw.js +0 -1
  295. package/dist/chunks/client-9uHzAmFH.js +0 -1
  296. package/dist/chunks/client-BVal_QII.js +0 -1
  297. package/dist/chunks/client-BtTkq0YS.js +0 -1
  298. package/dist/chunks/client-Dd7CKMRX.js +0 -1
  299. package/dist/chunks/commands-C_rYjyQZ.js +0 -1
  300. package/dist/chunks/compact-Cqd6vKpn.js +0 -2
  301. package/dist/chunks/config-Be0BkAAr.js +0 -1
  302. package/dist/chunks/config-DUTgj3js.js +0 -3
  303. package/dist/chunks/config-DoEDgAfv.js +0 -1
  304. package/dist/chunks/context-noninteractive-D9tJYwi7.js +0 -1
  305. package/dist/chunks/controlMessageCompat-IFu4Gc1y.js +0 -1
  306. package/dist/chunks/conversation-DWfE4KGH.js +0 -1
  307. package/dist/chunks/conversation-Tvo4EDpQ.js +0 -1
  308. package/dist/chunks/createSSHSession-BQ83MMtr.js +0 -5
  309. package/dist/chunks/createSession-CqHnHhCR.js +0 -1
  310. package/dist/chunks/createSession-DqTtBycR.js +0 -1
  311. package/dist/chunks/crossProjectResume-DIXtiODF.js +0 -40
  312. package/dist/chunks/cwd-DLK3znO7.js +0 -1
  313. package/dist/chunks/cwd-Nh5IZNKO.js +0 -1
  314. package/dist/chunks/debugUtils-DXBRbwCE.js +0 -1
  315. package/dist/chunks/detached-Biz-xhu0.js +0 -4
  316. package/dist/chunks/detectRepository-DUJBh5s2.js +0 -1
  317. package/dist/chunks/detectRepository-pRAVv8SH.js +0 -1
  318. package/dist/chunks/directoryCompletion-CuA3_YIT.js +0 -1
  319. package/dist/chunks/doctor-eNAm6OiS.js +0 -1
  320. package/dist/chunks/entry-DidpiR-D.js +0 -13
  321. package/dist/chunks/esm-BCUC71kt.js +0 -1
  322. package/dist/chunks/execSyncWrapper-C3ZFV9od.js +0 -1
  323. package/dist/chunks/exit-DywUeiYd.js +0 -1
  324. package/dist/chunks/extraUsage-DiAirtuk.js +0 -1
  325. package/dist/chunks/extractMemories-_xiTnX95.js +0 -1
  326. package/dist/chunks/fast-DCXZACT9.js +0 -1
  327. package/dist/chunks/fast-Qo4WVqiW.js +0 -1
  328. package/dist/chunks/fetchModelList-fQDsmR3E.js +0 -1
  329. package/dist/chunks/fetchModelList-woVzIVde.js +0 -1
  330. package/dist/chunks/fileSuggestions-CRx1D6uk.js +0 -3
  331. package/dist/chunks/firstPartyEventLogger-B261Wksn.js +0 -3
  332. package/dist/chunks/firstPartyEventLogger-DtFTeHy-.js +0 -1
  333. package/dist/chunks/flushGate-BA8dSr0i.js +0 -1
  334. package/dist/chunks/gemini-BXAyy1JN.js +0 -1
  335. package/dist/chunks/generateSessionName-Cwmk2N3F.js +0 -1
  336. package/dist/chunks/git-Wid-XppW.js +0 -5
  337. package/dist/chunks/git-hO-TMvXc.js +0 -1
  338. package/dist/chunks/githubRepoPathMapping-OV8U1VFK.js +0 -1
  339. package/dist/chunks/goal-C9clrwEH.js +0 -3
  340. package/dist/chunks/grok-CjeCecsZ.js +0 -1
  341. package/dist/chunks/grove-DqTnK9nn.js +0 -7
  342. package/dist/chunks/hash-Tu-My5Vp.js +0 -1
  343. package/dist/chunks/help-Bb6LdzXK.js +0 -1
  344. package/dist/chunks/hooks-BX2s7aoL.js +0 -1
  345. package/dist/chunks/initReplBridge-D7cuY_os.js +0 -1
  346. package/dist/chunks/install-eCA8UACi.js +0 -1
  347. package/dist/chunks/instrumentation-BaRKojJh.js +0 -21
  348. package/dist/chunks/jwtUtils-JE2okZ70.js +0 -1
  349. package/dist/chunks/keybindings-iBqc1KHL.js +0 -1
  350. package/dist/chunks/launchLocalMemory-IZPGEzMk.js +0 -3
  351. package/dist/chunks/launchOnboarding-BeNf51Ig.js +0 -8
  352. package/dist/chunks/lazySchema-DULtBUCI.js +0 -65
  353. package/dist/chunks/lib-BlVGipXx.js +0 -14
  354. package/dist/chunks/loadAgentsDir-Bpke9CtB.js +0 -1
  355. package/dist/chunks/localSearch-dodgnjGn.js +0 -1
  356. package/dist/chunks/log-CZ7ploQm.js +0 -1
  357. package/dist/chunks/logoUtils-Cg_6QV1Z.js +0 -1
  358. package/dist/chunks/main-7ssnA9Yb.js +0 -31
  359. package/dist/chunks/main-BEv6MqMX.js +0 -356
  360. package/dist/chunks/managedEnv-CHYvwXBH.js +0 -1
  361. package/dist/chunks/managedEnv-CbjOQmEe.js +0 -1
  362. package/dist/chunks/mappers-D8VLUZ2N.js +0 -1
  363. package/dist/chunks/mcp-BUn3yqsT.js +0 -1
  364. package/dist/chunks/mcp-BskLq9iP.js +0 -2
  365. package/dist/chunks/mcp-C-0DMaXx.js +0 -6
  366. package/dist/chunks/memoize-CumjjK2Q.js +0 -1
  367. package/dist/chunks/memory-vDkJM58W.js +0 -1
  368. package/dist/chunks/mode-Dbh21H2Y.js +0 -2
  369. package/dist/chunks/model-BaMclMXn.js +0 -1
  370. package/dist/chunks/model-atn3_JBi.js +0 -1
  371. package/dist/chunks/model-vS1Iewyq.js +0 -1
  372. package/dist/chunks/modelOptions-Cw1ThINb.js +0 -1
  373. package/dist/chunks/nativeInstaller-CfZ5uNTh.js +0 -1
  374. package/dist/chunks/oauth-D38aRTUb.js +0 -1
  375. package/dist/chunks/oauth-U649LV5H.js +0 -1
  376. package/dist/chunks/omit-B7eQ9q0x.js +0 -1
  377. package/dist/chunks/onChangeAppState-kEAt8nxV.js +0 -1
  378. package/dist/chunks/openai-wh8AX5iz.js +0 -10
  379. package/dist/chunks/parser-Cq9X7HMP.js +0 -1
  380. package/dist/chunks/partition-CENvOfiS.js +0 -1
  381. package/dist/chunks/permissions-ChuIx-d4.js +0 -3
  382. package/dist/chunks/pidLock-C1hmh3YQ.js +0 -3
  383. package/dist/chunks/plugin-DVBEWwMP.js +0 -17
  384. package/dist/chunks/pluginCliCommands-WzzqR1Sr.js +0 -1
  385. package/dist/chunks/pluginOperations-Ca9Lup5G.js +0 -2
  386. package/dist/chunks/pluginStartupCheck-DdtxcNwH.js +0 -1
  387. package/dist/chunks/plugins-DdIaXpNb.js +0 -4
  388. package/dist/chunks/pollConfig-2nFzv6Hy.js +0 -1
  389. package/dist/chunks/poorMode-ZIq2oz7q.js +0 -1
  390. package/dist/chunks/print-vxrRE1O2.js +0 -14
  391. package/dist/chunks/processBashCommand-ISucgwpi.js +0 -1
  392. package/dist/chunks/processSlashCommand-BnpXO_fI.js +0 -5
  393. package/dist/chunks/prompt-2AA5W7EH.js +0 -1
  394. package/dist/chunks/prompt-AXiS2LoO.js +0 -1
  395. package/dist/chunks/promptEditor-DT6egmcb.js +0 -4
  396. package/dist/chunks/rcDebugLog-DSchf3Hs.js +0 -1
  397. package/dist/chunks/reconciler-D3zyJCnV.js +0 -1
  398. package/dist/chunks/refresh-BSG0t4cf.js +0 -1
  399. package/dist/chunks/registerProtocol-BOEYaX-X.js +0 -1
  400. package/dist/chunks/reload-plugins-BFMRhbv8.js +0 -1
  401. package/dist/chunks/remoteBridgeCore-D5OwvmAz.js +0 -1
  402. package/dist/chunks/remoteManagedSettings-DyGVvvcW.js +0 -1
  403. package/dist/chunks/rename-BrEwj3Xw.js +0 -1
  404. package/dist/chunks/resume-DR5JbICs.js +0 -2
  405. package/dist/chunks/ripgrep-Dt4a91S5.js +0 -5
  406. package/dist/chunks/ripgrep-KTOU5s9J.js +0 -1
  407. package/dist/chunks/sandbox-adapter-BqDyWcol.js +0 -1
  408. package/dist/chunks/sandbox-toggle-B9f_0NQI.js +0 -1
  409. package/dist/chunks/searchExtraTools-2pIT2C8u.js +0 -1
  410. package/dist/chunks/session-wkRTfdo8.js +0 -2
  411. package/dist/chunks/sessionFileAccessHooks-DV22q9JO.js +0 -1
  412. package/dist/chunks/sessionIdCompat-Dgp6PW_1.js +0 -1
  413. package/dist/chunks/sessionObserver-BLJg0qm_.js +0 -1
  414. package/dist/chunks/sessionState-8jutEorw.js +0 -11
  415. package/dist/chunks/sessionStorage-DRV7IhZF.js +0 -1
  416. package/dist/chunks/sessionStoragePortable-x0Yn02-G.js +0 -3
  417. package/dist/chunks/settings-BowI3jp-.js +0 -19
  418. package/dist/chunks/settings-CHn0gJCG.js +0 -1
  419. package/dist/chunks/settingsSync-DF4JgSNc.js +0 -1
  420. package/dist/chunks/setup-UiEO9i7F.js +0 -3
  421. package/dist/chunks/shellQuote-Ddgr1vif.js +0 -4
  422. package/dist/chunks/sinks-DnLqRPEC.js +0 -1
  423. package/dist/chunks/sinks-mGBiINp8.js +0 -1
  424. package/dist/chunks/skillChangeDetector-Dc6YZXJE.js +0 -1
  425. package/dist/chunks/skills-DKtN17ch.js +0 -1
  426. package/dist/chunks/startupProfiler-B90b5vuq.js +0 -3
  427. package/dist/chunks/startupProfiler-DG2TN5R_.js +0 -1
  428. package/dist/chunks/state-BStOuCh4.js +0 -1
  429. package/dist/chunks/stats-D4LEtkrw.js +0 -1
  430. package/dist/chunks/status-0ZBx6Ls0.js +0 -2
  431. package/dist/chunks/status-BUJ4-omB.js +0 -1
  432. package/dist/chunks/statusNoticeHelpers-BrpQWj0l.js +0 -1
  433. package/dist/chunks/stringUtils-D7oJIyY2.js +0 -4
  434. package/dist/chunks/subprocessEnv-CNBOhlDV.js +0 -1
  435. package/dist/chunks/subprocessEnv-DtBCqQIo.js +0 -1
  436. package/dist/chunks/switcher-D7Ey5uIi.js +0 -1
  437. package/dist/chunks/syncCache-DUhciJLz.js +0 -1
  438. package/dist/chunks/teleport-DwZMevmQ.js +0 -1
  439. package/dist/chunks/terminalSetup-a7-BNS4T.js +0 -32
  440. package/dist/chunks/tmux-DA06aewY.js +0 -1
  441. package/dist/chunks/toolPool-mdsxlKWR.js +0 -1
  442. package/dist/chunks/trustedDevice-C1m--Yjw.js +0 -1
  443. package/dist/chunks/trustedDevice-CeDIk_ln.js +0 -1
  444. package/dist/chunks/types-APu4OCXJ.js +0 -17
  445. package/dist/chunks/udsClient-BcwsY0XE.js +0 -1
  446. package/dist/chunks/upstreamproxy-CTOuotLO.js +0 -10
  447. package/dist/chunks/useExitOnCtrlCDWithKeybindings-L5idX6Kz.js +0 -1
  448. package/dist/chunks/useMainLoopModel-VXeS2EC6.js +0 -1
  449. package/dist/chunks/useManagePlugins-CAXp5CfH.js +0 -1
  450. package/dist/chunks/useMergedTools-DYXrPTIA.js +0 -1
  451. package/dist/chunks/useSearchInput-Bxl4wGcZ.js +0 -1
  452. package/dist/chunks/useSettingsErrors-sbjsaT7k.js +0 -1
  453. package/dist/chunks/userAgent-NbKd-hN7.js +0 -1
  454. package/dist/chunks/util-DU63xTwZ.js +0 -1
  455. package/dist/chunks/validatePlugin-DQ_9OCpP.js +0 -1
  456. package/dist/chunks/which-B8rchd8P.js +0 -1
  457. package/dist/chunks/windowsPaths-BdhjMYTm.js +0 -1
  458. package/dist/chunks/windowsPaths-DtGZ83kH.js +0 -1
  459. package/dist/chunks/workSecret-CaM2yIJD.js +0 -1
  460. package/dist/chunks/workerRegistry-BBgquE8F.js +0 -2
  461. package/dist/chunks/worktree-C28I8mFB.js +0 -1
@@ -0,0 +1 @@
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};
@@ -0,0 +1 @@
1
+ import{eh as e,th as t}from"./loadAgentsDir-C1LkW7gl.js";t();export{e as clearSearchExtraToolsDescriptionCache};
@@ -0,0 +1 @@
1
+ import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{n,t as r}from"./figures-5ThXQEtq.js";import{I as i,P as a,ai as o,hn as s,t as c}from"./src-DL3w8VPk.js";import{t as l}from"./jsx-runtime-Bb4Xn-E0.js";import{c as u,o as d,s as f}from"./stringUtils-BQm3OfeJ.js";import{a as p,i as m,n as h,o as g,r as _,t as v}from"./use-select-navigation-DMaC_3iw.js";import{i as y,t as b}from"./overlayContext-CMV7nYR9.js";import{isDeepStrictEqual as x}from"util";function S({isDisabled:e=!1,visibleOptionCount:t=5,options:n,defaultValue:r=[],onChange:i,onCancel:a,onFocus:o,focusValue:c,submitButtonText:l,onSubmit:d,onDownFromLastItem:p,onUpFromFirstItem:m,initialFocusLast:g,hideIndexes:_=!1}){let[v,b]=(0,C.useState)(r),[S,w]=(0,C.useState)(!1),[T,E]=(0,C.useState)(n);n!==T&&!x(n,T)&&(b(r),E(n));let[D,O]=(0,C.useState)(()=>{let e=new Map;return n.forEach(t=>{t.type===`input`&&t.initialValue&&e.set(t.value,t.initialValue)}),e}),k=(0,C.useCallback)(e=>{let t=typeof e==`function`?e(v):e;b(t),i?.(t)},[v,i]),A=h({visibleOptionCount:t,options:n,initialFocusValue:g?n[n.length-1]?.value:void 0,onFocus:o,focusValue:c});y(`multi-select`,void 0);let j=(0,C.useCallback)((e,t)=>{O(n=>{let r=new Map(n);return r.set(e,t),r});let r=n.find(t=>t.value===e);r&&r.type===`input`&&r.onChange(t),k(n=>t?n.includes(e)?n:[...n,e]:n.filter(t=>t!==e))},[n,k]);return s((e,t,r)=>{let i=f(e),o=n.find(e=>e.value===A.focusedValue)?.type===`input`;if(o&&!(t.upArrow||t.downArrow||t.escape||t.tab||t.return||t.ctrl&&(e===`n`||e===`p`||t.return)))return;let s=n[n.length-1]?.value;if(t.tab&&!t.shift){l&&d&&A.focusedValue===s&&!S?w(!0):S||A.focusNextOption();return}if(t.tab&&t.shift){l&&d&&S?(w(!1),A.focusOption(s)):A.focusPreviousOption();return}if(t.downArrow||t.ctrl&&e===`n`||!t.ctrl&&!t.shift&&e===`j`){S&&p?p():l&&d&&A.focusedValue===s&&!S?w(!0):!l&&p&&A.focusedValue===s?p():S||A.focusNextOption();return}if(t.upArrow||t.ctrl&&e===`p`||!t.ctrl&&!t.shift&&e===`k`){l&&d&&S?(w(!1),A.focusOption(s)):m&&A.focusedValue===n[0]?.value?m():A.focusPreviousOption();return}if(t.pageDown){A.focusNextPage();return}if(t.pageUp){A.focusPreviousPage();return}if(t.return||u(e)===` `){if(t.ctrl&&t.return&&o&&d){d(v);return}if(S&&d){d(v);return}if(t.return&&!l&&d){d(v);return}if(A.focusedValue!==void 0){let e=v.includes(A.focusedValue)?v.filter(e=>e!==A.focusedValue):[...v,A.focusedValue];k(e)}return}if(!_&&/^[0-9]+$/.test(i)){let e=parseInt(i,10)-1;if(e>=0&&e<n.length){let t=n[e].value,r=v.includes(t)?v.filter(e=>e!==t):[...v,t];k(r)}return}t.escape&&(a(),r.stopImmediatePropagation())},{isActive:!e}),{...A,selectedValues:v,inputValues:D,isSubmitFocused:S,updateInputValue:j,onCancel:a}}var C,w=e((()=>{C=t(o(),1),b(),c(),d(),v()}));function T({isDisabled:e=!1,visibleOptionCount:t=5,options:n,defaultValue:o=[],onCancel:s,onChange:c,onFocus:l,focusValue:u,submitButtonText:d,onSubmit:f,onDownFromLastItem:m,onUpFromFirstItem:h,initialFocusLast:g,onOpenEditor:v,hideIndexes:y=!1,onImagePaste:b,pastedContents:x,onRemoveImage:C}){let w=S({isDisabled:e,visibleOptionCount:t,options:n,defaultValue:o,onChange:c,onCancel:s,onFocus:l,focusValue:u,submitButtonText:d,onSubmit:f,onDownFromLastItem:m,onUpFromFirstItem:h,initialFocusLast:g,hideIndexes:y}),T=n.length.toString().length;return(0,E.jsxs)(i,{flexDirection:`column`,children:[(0,E.jsx)(i,{flexDirection:`column`,children:w.visibleOptions.map((t,o)=>{let c=!e&&w.focusedValue===t.value&&!w.isSubmitFocused,l=w.selectedValues.includes(t.value),u=t.index===w.visibleFromIndex,d=t.index===w.visibleToIndex-1,f=w.visibleToIndex<n.length,m=w.visibleFromIndex>0,h=w.visibleFromIndex+o+1;if(t.type===`input`){let e=w.inputValues.get(t.value)||``;return(0,E.jsx)(i,{gap:1,children:(0,E.jsx)(_,{option:t,isFocused:c,isSelected:!1,shouldShowDownArrow:f&&d,shouldShowUpArrow:m&&u,maxIndexWidth:T,index:h,inputValue:e,onInputChange:e=>{w.updateInputValue(t.value,e)},onSubmit:()=>{},onExit:()=>{s()},layout:`compact`,onOpenEditor:v,onImagePaste:b,pastedContents:x,onRemoveImage:C,children:(0,E.jsxs)(a,{color:l?`success`:void 0,children:[`[`,l?r.tick:` `,`] `]})})},String(t.value))}return(0,E.jsx)(i,{gap:1,children:(0,E.jsxs)(p,{isFocused:c,isSelected:!1,shouldShowDownArrow:f&&d,shouldShowUpArrow:m&&u,description:t.description,children:[!y&&(0,E.jsx)(a,{dimColor:!0,children:`${h}.`.padEnd(T)}),(0,E.jsxs)(a,{color:l?`success`:void 0,children:[`[`,l?r.tick:` `,`]`]}),(0,E.jsx)(a,{color:c?`suggestion`:void 0,children:t.label})]})},String(t.value))})}),d&&f&&(0,E.jsxs)(i,{marginTop:0,gap:1,children:[w.isSubmitFocused?(0,E.jsx)(a,{color:`suggestion`,children:r.pointer}):(0,E.jsx)(a,{children:` `}),(0,E.jsx)(i,{marginLeft:3,children:(0,E.jsx)(a,{color:w.isSubmitFocused?`suggestion`:void 0,bold:!0,children:d})})]})]})}var E,D=e((()=>{n(),c(),m(),g(),w(),E=l()}));export{D as n,T as t};
@@ -0,0 +1,2 @@
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};
@@ -0,0 +1 @@
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};
@@ -0,0 +1 @@
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{H as t,I as n,P as r,fi as i,t as a,ui as o}from"./src-DL3w8VPk.js";import{t as s}from"./jsx-runtime-Bb4Xn-E0.js";import{Wt as c,qt as l}from"./settings-DKN4xSpQ.js";function u(e){switch(e){case`light`:return f;case`light-ansi`:return p;case`dark-ansi`:return m;case`light-daltonized`:return h;case`dark-daltonized`:return _;default:return g}}var d,f,p,m,h,g,_,v=e((()=>{i(),l(),d=[`dark`,`light`,`light-daltonized`,`dark-daltonized`,`light-ansi`,`dark-ansi`],[...d],f={autoAccept:`rgb(135,0,255)`,bashBorder:`rgb(255,0,135)`,claude:`rgb(215,119,87)`,claudeShimmer:`rgb(245,149,117)`,claudeBlue_FOR_SYSTEM_SPINNER:`rgb(87,105,247)`,claudeBlueShimmer_FOR_SYSTEM_SPINNER:`rgb(117,135,255)`,permission:`rgb(87,105,247)`,permissionShimmer:`rgb(137,155,255)`,planMode:`rgb(0,102,102)`,ide:`rgb(71,130,200)`,promptBorder:`rgb(153,153,153)`,promptBorderShimmer:`rgb(183,183,183)`,text:`rgb(0,0,0)`,inverseText:`rgb(255,255,255)`,inactive:`rgb(102,102,102)`,inactiveShimmer:`rgb(142,142,142)`,subtle:`rgb(175,175,175)`,suggestion:`rgb(87,105,247)`,remember:`rgb(0,0,255)`,background:`rgb(0,153,153)`,success:`rgb(44,122,57)`,error:`rgb(171,43,63)`,warning:`rgb(150,108,30)`,merged:`rgb(135,0,255)`,warningShimmer:`rgb(200,158,80)`,diffAdded:`rgb(105,219,124)`,diffRemoved:`rgb(255,168,180)`,diffAddedDimmed:`rgb(199,225,203)`,diffRemovedDimmed:`rgb(253,210,216)`,diffAddedWord:`rgb(47,157,68)`,diffRemovedWord:`rgb(209,69,75)`,red_FOR_SUBAGENTS_ONLY:`rgb(220,38,38)`,blue_FOR_SUBAGENTS_ONLY:`rgb(37,99,235)`,green_FOR_SUBAGENTS_ONLY:`rgb(22,163,74)`,yellow_FOR_SUBAGENTS_ONLY:`rgb(202,138,4)`,purple_FOR_SUBAGENTS_ONLY:`rgb(147,51,234)`,orange_FOR_SUBAGENTS_ONLY:`rgb(234,88,12)`,pink_FOR_SUBAGENTS_ONLY:`rgb(219,39,119)`,cyan_FOR_SUBAGENTS_ONLY:`rgb(8,145,178)`,professionalBlue:`rgb(106,155,204)`,chromeYellow:`rgb(251,188,4)`,clawd_body:`rgb(215,119,87)`,clawd_background:`rgb(0,0,0)`,userMessageBackground:`rgb(240, 240, 240)`,userMessageBackgroundHover:`rgb(252, 252, 252)`,messageActionsBackground:`rgb(232, 236, 244)`,selectionBg:`rgb(180, 213, 255)`,bashMessageBackgroundColor:`rgb(250, 245, 250)`,memoryBackgroundColor:`rgb(230, 245, 250)`,rate_limit_fill:`rgb(87,105,247)`,rate_limit_empty:`rgb(39,47,111)`,fastMode:`rgb(255,106,0)`,fastModeShimmer:`rgb(255,150,50)`,rainbow_red:`rgb(235,95,87)`,rainbow_orange:`rgb(245,139,87)`,rainbow_yellow:`rgb(250,195,95)`,rainbow_green:`rgb(145,200,130)`,rainbow_blue:`rgb(130,170,220)`,rainbow_indigo:`rgb(155,130,200)`,rainbow_violet:`rgb(200,130,180)`,rainbow_red_shimmer:`rgb(250,155,147)`,rainbow_orange_shimmer:`rgb(255,185,137)`,rainbow_yellow_shimmer:`rgb(255,225,155)`,rainbow_green_shimmer:`rgb(185,230,180)`,rainbow_blue_shimmer:`rgb(180,205,240)`,rainbow_indigo_shimmer:`rgb(195,180,230)`,rainbow_violet_shimmer:`rgb(230,180,210)`},p={autoAccept:`ansi:magenta`,bashBorder:`ansi:magenta`,claude:`ansi:redBright`,claudeShimmer:`ansi:yellowBright`,claudeBlue_FOR_SYSTEM_SPINNER:`ansi:blue`,claudeBlueShimmer_FOR_SYSTEM_SPINNER:`ansi:blueBright`,permission:`ansi:blue`,permissionShimmer:`ansi:blueBright`,planMode:`ansi:cyan`,ide:`ansi:blueBright`,promptBorder:`ansi:white`,promptBorderShimmer:`ansi:whiteBright`,text:`ansi:black`,inverseText:`ansi:white`,inactive:`ansi:blackBright`,inactiveShimmer:`ansi:white`,subtle:`ansi:blackBright`,suggestion:`ansi:blue`,remember:`ansi:blue`,background:`ansi:cyan`,success:`ansi:green`,error:`ansi:red`,warning:`ansi:yellow`,merged:`ansi:magenta`,warningShimmer:`ansi:yellowBright`,diffAdded:`ansi:green`,diffRemoved:`ansi:red`,diffAddedDimmed:`ansi:green`,diffRemovedDimmed:`ansi:red`,diffAddedWord:`ansi:greenBright`,diffRemovedWord:`ansi:redBright`,red_FOR_SUBAGENTS_ONLY:`ansi:red`,blue_FOR_SUBAGENTS_ONLY:`ansi:blue`,green_FOR_SUBAGENTS_ONLY:`ansi:green`,yellow_FOR_SUBAGENTS_ONLY:`ansi:yellow`,purple_FOR_SUBAGENTS_ONLY:`ansi:magenta`,orange_FOR_SUBAGENTS_ONLY:`ansi:redBright`,pink_FOR_SUBAGENTS_ONLY:`ansi:magentaBright`,cyan_FOR_SUBAGENTS_ONLY:`ansi:cyan`,professionalBlue:`ansi:blueBright`,chromeYellow:`ansi:yellow`,clawd_body:`ansi:redBright`,clawd_background:`ansi:black`,userMessageBackground:`ansi:white`,userMessageBackgroundHover:`ansi:whiteBright`,messageActionsBackground:`ansi:white`,selectionBg:`ansi:cyan`,bashMessageBackgroundColor:`ansi:whiteBright`,memoryBackgroundColor:`ansi:white`,rate_limit_fill:`ansi:yellow`,rate_limit_empty:`ansi:black`,fastMode:`ansi:red`,fastModeShimmer:`ansi:redBright`,rainbow_red:`ansi:red`,rainbow_orange:`ansi:redBright`,rainbow_yellow:`ansi:yellow`,rainbow_green:`ansi:green`,rainbow_blue:`ansi:cyan`,rainbow_indigo:`ansi:blue`,rainbow_violet:`ansi:magenta`,rainbow_red_shimmer:`ansi:redBright`,rainbow_orange_shimmer:`ansi:yellow`,rainbow_yellow_shimmer:`ansi:yellowBright`,rainbow_green_shimmer:`ansi:greenBright`,rainbow_blue_shimmer:`ansi:cyanBright`,rainbow_indigo_shimmer:`ansi:blueBright`,rainbow_violet_shimmer:`ansi:magentaBright`},m={autoAccept:`ansi:magentaBright`,bashBorder:`ansi:magentaBright`,claude:`ansi:redBright`,claudeShimmer:`ansi:yellowBright`,claudeBlue_FOR_SYSTEM_SPINNER:`ansi:blueBright`,claudeBlueShimmer_FOR_SYSTEM_SPINNER:`ansi:blueBright`,permission:`ansi:blueBright`,permissionShimmer:`ansi:blueBright`,planMode:`ansi:cyanBright`,ide:`ansi:blue`,promptBorder:`ansi:white`,promptBorderShimmer:`ansi:whiteBright`,text:`ansi:whiteBright`,inverseText:`ansi:black`,inactive:`ansi:white`,inactiveShimmer:`ansi:whiteBright`,subtle:`ansi:white`,suggestion:`ansi:blueBright`,remember:`ansi:blueBright`,background:`ansi:cyanBright`,success:`ansi:greenBright`,error:`ansi:redBright`,warning:`ansi:yellowBright`,merged:`ansi:magentaBright`,warningShimmer:`ansi:yellowBright`,diffAdded:`ansi:green`,diffRemoved:`ansi:red`,diffAddedDimmed:`ansi:green`,diffRemovedDimmed:`ansi:red`,diffAddedWord:`ansi:greenBright`,diffRemovedWord:`ansi:redBright`,red_FOR_SUBAGENTS_ONLY:`ansi:redBright`,blue_FOR_SUBAGENTS_ONLY:`ansi:blueBright`,green_FOR_SUBAGENTS_ONLY:`ansi:greenBright`,yellow_FOR_SUBAGENTS_ONLY:`ansi:yellowBright`,purple_FOR_SUBAGENTS_ONLY:`ansi:magentaBright`,orange_FOR_SUBAGENTS_ONLY:`ansi:redBright`,pink_FOR_SUBAGENTS_ONLY:`ansi:magentaBright`,cyan_FOR_SUBAGENTS_ONLY:`ansi:cyanBright`,professionalBlue:`rgb(106,155,204)`,chromeYellow:`ansi:yellowBright`,clawd_body:`ansi:redBright`,clawd_background:`ansi:black`,userMessageBackground:`ansi:blackBright`,userMessageBackgroundHover:`ansi:white`,messageActionsBackground:`ansi:blackBright`,selectionBg:`ansi:blue`,bashMessageBackgroundColor:`ansi:black`,memoryBackgroundColor:`ansi:blackBright`,rate_limit_fill:`ansi:yellow`,rate_limit_empty:`ansi:white`,fastMode:`ansi:redBright`,fastModeShimmer:`ansi:redBright`,rainbow_red:`ansi:red`,rainbow_orange:`ansi:redBright`,rainbow_yellow:`ansi:yellow`,rainbow_green:`ansi:green`,rainbow_blue:`ansi:cyan`,rainbow_indigo:`ansi:blue`,rainbow_violet:`ansi:magenta`,rainbow_red_shimmer:`ansi:redBright`,rainbow_orange_shimmer:`ansi:yellow`,rainbow_yellow_shimmer:`ansi:yellowBright`,rainbow_green_shimmer:`ansi:greenBright`,rainbow_blue_shimmer:`ansi:cyanBright`,rainbow_indigo_shimmer:`ansi:blueBright`,rainbow_violet_shimmer:`ansi:magentaBright`},h={autoAccept:`rgb(135,0,255)`,bashBorder:`rgb(0,102,204)`,claude:`rgb(255,153,51)`,claudeShimmer:`rgb(255,183,101)`,claudeBlue_FOR_SYSTEM_SPINNER:`rgb(51,102,255)`,claudeBlueShimmer_FOR_SYSTEM_SPINNER:`rgb(101,152,255)`,permission:`rgb(51,102,255)`,permissionShimmer:`rgb(101,152,255)`,planMode:`rgb(51,102,102)`,ide:`rgb(71,130,200)`,promptBorder:`rgb(153,153,153)`,promptBorderShimmer:`rgb(183,183,183)`,text:`rgb(0,0,0)`,inverseText:`rgb(255,255,255)`,inactive:`rgb(102,102,102)`,inactiveShimmer:`rgb(142,142,142)`,subtle:`rgb(175,175,175)`,suggestion:`rgb(51,102,255)`,remember:`rgb(51,102,255)`,background:`rgb(0,153,153)`,success:`rgb(0,102,153)`,error:`rgb(204,0,0)`,warning:`rgb(255,153,0)`,merged:`rgb(135,0,255)`,warningShimmer:`rgb(255,183,50)`,diffAdded:`rgb(153,204,255)`,diffRemoved:`rgb(255,204,204)`,diffAddedDimmed:`rgb(209,231,253)`,diffRemovedDimmed:`rgb(255,233,233)`,diffAddedWord:`rgb(51,102,204)`,diffRemovedWord:`rgb(153,51,51)`,red_FOR_SUBAGENTS_ONLY:`rgb(204,0,0)`,blue_FOR_SUBAGENTS_ONLY:`rgb(0,102,204)`,green_FOR_SUBAGENTS_ONLY:`rgb(0,204,0)`,yellow_FOR_SUBAGENTS_ONLY:`rgb(255,204,0)`,purple_FOR_SUBAGENTS_ONLY:`rgb(128,0,128)`,orange_FOR_SUBAGENTS_ONLY:`rgb(255,128,0)`,pink_FOR_SUBAGENTS_ONLY:`rgb(255,102,178)`,cyan_FOR_SUBAGENTS_ONLY:`rgb(0,178,178)`,professionalBlue:`rgb(106,155,204)`,chromeYellow:`rgb(251,188,4)`,clawd_body:`rgb(215,119,87)`,clawd_background:`rgb(0,0,0)`,userMessageBackground:`rgb(220, 220, 220)`,userMessageBackgroundHover:`rgb(232, 232, 232)`,messageActionsBackground:`rgb(210, 216, 226)`,selectionBg:`rgb(180, 213, 255)`,bashMessageBackgroundColor:`rgb(250, 245, 250)`,memoryBackgroundColor:`rgb(230, 245, 250)`,rate_limit_fill:`rgb(51,102,255)`,rate_limit_empty:`rgb(23,46,114)`,fastMode:`rgb(255,106,0)`,fastModeShimmer:`rgb(255,150,50)`,rainbow_red:`rgb(235,95,87)`,rainbow_orange:`rgb(245,139,87)`,rainbow_yellow:`rgb(250,195,95)`,rainbow_green:`rgb(145,200,130)`,rainbow_blue:`rgb(130,170,220)`,rainbow_indigo:`rgb(155,130,200)`,rainbow_violet:`rgb(200,130,180)`,rainbow_red_shimmer:`rgb(250,155,147)`,rainbow_orange_shimmer:`rgb(255,185,137)`,rainbow_yellow_shimmer:`rgb(255,225,155)`,rainbow_green_shimmer:`rgb(185,230,180)`,rainbow_blue_shimmer:`rgb(180,205,240)`,rainbow_indigo_shimmer:`rgb(195,180,230)`,rainbow_violet_shimmer:`rgb(230,180,210)`},g={autoAccept:`rgb(175,135,255)`,bashBorder:`rgb(253,93,177)`,claude:`rgb(215,119,87)`,claudeShimmer:`rgb(235,159,127)`,claudeBlue_FOR_SYSTEM_SPINNER:`rgb(147,165,255)`,claudeBlueShimmer_FOR_SYSTEM_SPINNER:`rgb(177,195,255)`,permission:`rgb(177,185,249)`,permissionShimmer:`rgb(207,215,255)`,planMode:`rgb(72,150,140)`,ide:`rgb(71,130,200)`,promptBorder:`rgb(136,136,136)`,promptBorderShimmer:`rgb(166,166,166)`,text:`rgb(255,255,255)`,inverseText:`rgb(0,0,0)`,inactive:`rgb(153,153,153)`,inactiveShimmer:`rgb(193,193,193)`,subtle:`rgb(80,80,80)`,suggestion:`rgb(177,185,249)`,remember:`rgb(177,185,249)`,background:`rgb(0,204,204)`,success:`rgb(78,186,101)`,error:`rgb(255,107,128)`,warning:`rgb(255,193,7)`,merged:`rgb(175,135,255)`,warningShimmer:`rgb(255,223,57)`,diffAdded:`rgb(34,92,43)`,diffRemoved:`rgb(122,41,54)`,diffAddedDimmed:`rgb(71,88,74)`,diffRemovedDimmed:`rgb(105,72,77)`,diffAddedWord:`rgb(56,166,96)`,diffRemovedWord:`rgb(179,89,107)`,red_FOR_SUBAGENTS_ONLY:`rgb(220,38,38)`,blue_FOR_SUBAGENTS_ONLY:`rgb(37,99,235)`,green_FOR_SUBAGENTS_ONLY:`rgb(22,163,74)`,yellow_FOR_SUBAGENTS_ONLY:`rgb(202,138,4)`,purple_FOR_SUBAGENTS_ONLY:`rgb(147,51,234)`,orange_FOR_SUBAGENTS_ONLY:`rgb(234,88,12)`,pink_FOR_SUBAGENTS_ONLY:`rgb(219,39,119)`,cyan_FOR_SUBAGENTS_ONLY:`rgb(8,145,178)`,professionalBlue:`rgb(106,155,204)`,chromeYellow:`rgb(251,188,4)`,clawd_body:`rgb(215,119,87)`,clawd_background:`rgb(0,0,0)`,userMessageBackground:`rgb(55, 55, 55)`,userMessageBackgroundHover:`rgb(70, 70, 70)`,messageActionsBackground:`rgb(44, 50, 62)`,selectionBg:`rgb(38, 79, 120)`,bashMessageBackgroundColor:`rgb(65, 60, 65)`,memoryBackgroundColor:`rgb(55, 65, 70)`,rate_limit_fill:`rgb(177,185,249)`,rate_limit_empty:`rgb(80,83,112)`,fastMode:`rgb(255,120,20)`,fastModeShimmer:`rgb(255,165,70)`,rainbow_red:`rgb(235,95,87)`,rainbow_orange:`rgb(245,139,87)`,rainbow_yellow:`rgb(250,195,95)`,rainbow_green:`rgb(145,200,130)`,rainbow_blue:`rgb(130,170,220)`,rainbow_indigo:`rgb(155,130,200)`,rainbow_violet:`rgb(200,130,180)`,rainbow_red_shimmer:`rgb(250,155,147)`,rainbow_orange_shimmer:`rgb(255,185,137)`,rainbow_yellow_shimmer:`rgb(255,225,155)`,rainbow_green_shimmer:`rgb(185,230,180)`,rainbow_blue_shimmer:`rgb(180,205,240)`,rainbow_indigo_shimmer:`rgb(195,180,230)`,rainbow_violet_shimmer:`rgb(230,180,210)`},_={autoAccept:`rgb(175,135,255)`,bashBorder:`rgb(51,153,255)`,claude:`rgb(255,153,51)`,claudeShimmer:`rgb(255,183,101)`,claudeBlue_FOR_SYSTEM_SPINNER:`rgb(153,204,255)`,claudeBlueShimmer_FOR_SYSTEM_SPINNER:`rgb(183,224,255)`,permission:`rgb(153,204,255)`,permissionShimmer:`rgb(183,224,255)`,planMode:`rgb(102,153,153)`,ide:`rgb(71,130,200)`,promptBorder:`rgb(136,136,136)`,promptBorderShimmer:`rgb(166,166,166)`,text:`rgb(255,255,255)`,inverseText:`rgb(0,0,0)`,inactive:`rgb(153,153,153)`,inactiveShimmer:`rgb(193,193,193)`,subtle:`rgb(80,80,80)`,suggestion:`rgb(153,204,255)`,remember:`rgb(153,204,255)`,background:`rgb(0,204,204)`,success:`rgb(51,153,255)`,error:`rgb(255,102,102)`,warning:`rgb(255,204,0)`,merged:`rgb(175,135,255)`,warningShimmer:`rgb(255,234,50)`,diffAdded:`rgb(0,68,102)`,diffRemoved:`rgb(102,0,0)`,diffAddedDimmed:`rgb(62,81,91)`,diffRemovedDimmed:`rgb(62,44,44)`,diffAddedWord:`rgb(0,119,179)`,diffRemovedWord:`rgb(179,0,0)`,red_FOR_SUBAGENTS_ONLY:`rgb(255,102,102)`,blue_FOR_SUBAGENTS_ONLY:`rgb(102,178,255)`,green_FOR_SUBAGENTS_ONLY:`rgb(102,255,102)`,yellow_FOR_SUBAGENTS_ONLY:`rgb(255,255,102)`,purple_FOR_SUBAGENTS_ONLY:`rgb(178,102,255)`,orange_FOR_SUBAGENTS_ONLY:`rgb(255,178,102)`,pink_FOR_SUBAGENTS_ONLY:`rgb(255,153,204)`,cyan_FOR_SUBAGENTS_ONLY:`rgb(102,204,204)`,professionalBlue:`rgb(106,155,204)`,chromeYellow:`rgb(251,188,4)`,clawd_body:`rgb(215,119,87)`,clawd_background:`rgb(0,0,0)`,userMessageBackground:`rgb(55, 55, 55)`,userMessageBackgroundHover:`rgb(70, 70, 70)`,messageActionsBackground:`rgb(44, 50, 62)`,selectionBg:`rgb(38, 79, 120)`,bashMessageBackgroundColor:`rgb(65, 60, 65)`,memoryBackgroundColor:`rgb(55, 65, 70)`,rate_limit_fill:`rgb(153,204,255)`,rate_limit_empty:`rgb(69,92,115)`,fastMode:`rgb(255,120,20)`,fastModeShimmer:`rgb(255,165,70)`,rainbow_red:`rgb(235,95,87)`,rainbow_orange:`rgb(245,139,87)`,rainbow_yellow:`rgb(250,195,95)`,rainbow_green:`rgb(145,200,130)`,rainbow_blue:`rgb(130,170,220)`,rainbow_indigo:`rgb(155,130,200)`,rainbow_violet:`rgb(200,130,180)`,rainbow_red_shimmer:`rgb(250,155,147)`,rainbow_orange_shimmer:`rgb(255,185,137)`,rainbow_yellow_shimmer:`rgb(255,225,155)`,rainbow_green_shimmer:`rgb(185,230,180)`,rainbow_blue_shimmer:`rgb(180,205,240)`,rainbow_indigo_shimmer:`rgb(195,180,230)`,rainbow_violet_shimmer:`rgb(230,180,210)`},c.terminal===`Apple_Terminal`&&new o({level:2})}));function y(){return[`.`,`*`,`+`,`x`,`+`,`*`]}function b(e,t,n){return{r:Math.round(e.r+(t.r-e.r)*n),g:Math.round(e.g+(t.g-e.g)*n),b:Math.round(e.b+(t.b-e.b)*n)}}function x(e){return`rgb(${e.r},${e.g},${e.b})`}function S(e){let t=(e%360+360)%360,n=.8*.7,r=n*(1-Math.abs(t/60%2-1)),i=.6-n/2,a=0,o=0,s=0;return t<60?(a=n,o=r):t<120?(a=r,o=n):t<180?(o=n,s=r):t<240?(o=r,s=n):t<300?(a=r,s=n):(a=n,s=r),{r:Math.round((a+i)*255),g:Math.round((o+i)*255),b:Math.round((s+i)*255)}}function C(e){let t=w.get(e);if(t!==void 0)return t;let n=e.match(/rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)/),r=n?{r:parseInt(n[1],10),g:parseInt(n[2],10),b:parseInt(n[3],10)}:null;return w.set(e,r),r}var w,T=e((()=>{w=new Map}));function E({frame:e,messageColor:i,stalledIntensity:a=0,reducedMotion:o=!1,time:s=0}){let[c]=t(),l=u(c);if(o)return(0,D.jsx)(n,{flexWrap:`wrap`,height:1,width:2,children:(0,D.jsx)(r,{color:i,dimColor:Math.floor(s/(j/2))%2==1,children:A})});let d=k[e%k.length];if(a>0){let e=l[i],t=e?C(e):null;return t?(0,D.jsx)(n,{flexWrap:`wrap`,height:1,width:2,children:(0,D.jsx)(r,{color:x(b(t,M,a)),children:d})}):(0,D.jsx)(n,{flexWrap:`wrap`,height:1,width:2,children:(0,D.jsx)(r,{color:a>.5?`error`:i,children:d})})}return(0,D.jsx)(n,{flexWrap:`wrap`,height:1,width:2,children:(0,D.jsx)(r,{color:i,children:d})})}var D,O,k,A,j,M,N=e((()=>{a(),v(),T(),D=s(),O=y(),k=[...O,...[...O].reverse()],A=`●`,j=2e3,M={r:171,g:43,b:63}}));export{T as a,x as c,S as i,u as l,N as n,b as o,y as r,C as s,E as t,v as u};
@@ -0,0 +1,22 @@
1
+ import{a as e,n as t,o as n}from"./rolldown-runtime-DaDcL9Zw.js";import{l as r,o as i}from"./envUtils-DcaKZlRU.js";import{n as a,t as o}from"./defineProperty-C-QyHrDq.js";import{Cp as s,Fx as c,Ix as l,Jb as u,Lx as d,Mx as f,Px as p,bp as m,jx as h,qb as g,wp as _,yp as v}from"./loadAgentsDir-C1LkW7gl.js";import{Fr as y,Ft as b,G as x,Gr as S,H as C,Hr as w,I as T,Kr as E,Lr as ee,P as D,Pr as te,Vr as ne,Xn as re,ai as O,di as k,et as ie,fi as ae,hn as oe,j as se,mt as ce,qr as le,t as A,vn as ue,yn as de,zr as fe}from"./src-DL3w8VPk.js";import{t as j}from"./jsx-runtime-Bb4Xn-E0.js";import{c as pe,f as me,i as he,u as M}from"./debug-8DCufdSp.js";import{Wt as ge,qt as _e}from"./settings-DKN4xSpQ.js";import{a as N,i as ve,n as ye,s as be}from"./execFileNoThrow-BsfuytkN.js";import{o as xe,s as P}from"./log-DaILwWJa.js";import{i as Se,o as Ce}from"./platform-Dzff1WWw.js";import{a as we,n as F,o as Te,t as Ee}from"./intl-D2kgJmX7.js";import{n as De,t as Oe}from"./notifications-B0DTaYoy.js";import{i as ke,o as Ae}from"./terminalSetup-Cf_r6pwK.js";import{s as je,t as Me}from"./history-CNQNd6hT.js";import{r as Ne,t as Pe}from"./modifiersNative-BYHdmWw1.js";import{t as Fe}from"./useDoublePress-C9xxQzh1.js";import{tmpdir as Ie}from"os";import{basename as Le,extname as Re,isAbsolute as ze,join as Be}from"path";import{randomBytes as Ve}from"crypto";function He(){let e=process.platform,t=process.env.CLAUDE_CODE_TMPDIR||(e===`win32`?process.env.TEMP||`C:\\Temp`:Ie()),n=`claude_cli_latest_screenshot.png`,r={darwin:Be(t,n),linux:Be(t,n),win32:Be(t,n)},i=r[e]||r.linux,a={darwin:{checkImage:`osascript -e 'the clipboard as «class PNGf»'`,saveImage:`osascript -e 'set png_data to (the clipboard as «class PNGf»)' -e 'set fp to open for access POSIX file "${i}" with write permission' -e 'write png_data to fp' -e 'close access fp'`,getPath:`osascript -e 'get POSIX path of (the clipboard as «class furl»)'`,deleteFile:`rm -f "${i}"`},linux:{checkImage:`xclip -selection clipboard -t TARGETS -o 2>/dev/null | grep -E "image/(png|jpeg|jpg|gif|webp|bmp)" || wl-paste -l 2>/dev/null | grep -E "image/(png|jpeg|jpg|gif|webp|bmp)"`,saveImage:`xclip -selection clipboard -t image/png -o > "${i}" 2>/dev/null || wl-paste --type image/png > "${i}" 2>/dev/null || xclip -selection clipboard -t image/bmp -o > "${i}" 2>/dev/null || wl-paste --type image/bmp > "${i}"`,getPath:`xclip -selection clipboard -t text/plain -o 2>/dev/null || wl-paste 2>/dev/null`,deleteFile:`rm -f "${i}"`},win32:{checkImage:`powershell -NoProfile -Command "(Get-Clipboard -Format Image) -ne $null"`,saveImage:`powershell -NoProfile -Command "$img = Get-Clipboard -Format Image; if ($img) { $img.Save('${i.replace(/\\/g,`\\\\`)}', [System.Drawing.Imaging.ImageFormat]::Png) }"`,getPath:`powershell -NoProfile -Command "Get-Clipboard"`,deleteFile:`del /f "${i}"`}};return{commands:a[e]||a.linux,screenshotPath:i}}async function Ue(){return process.platform===`darwin`&&(await ye(`osascript`,[`-e`,`the clipboard as «class PNGf»`])).code===0}async function We(){let{commands:e,screenshotPath:t}=He();try{if((await N(e.checkImage,{shell:!0,reject:!1})).exitCode!==0||(await N(e.saveImage,{shell:!0,reject:!1})).exitCode!==0)return null;let n=M().readFileBytesSync(t);n.length>=2&&n[0]===66&&n[1]===77&&(n=await(await c())(n).png().toBuffer());let r=await p(n,n.length,`png`),i=r.buffer.toString(`base64`),a=h(i);return N(e.deleteFile,{shell:!0,reject:!1}),{base64:i,mediaType:a,dimensions:r.dimensions}}catch{return null}}async function Ge(){let{commands:e}=He();try{let t=await N(e.getPath,{shell:!0,reject:!1});return t.exitCode!==0||!t.stdout?null:t.stdout.trim()}catch(e){return P(e),null}}function Ke(e){return e.startsWith(`"`)&&e.endsWith(`"`)||e.startsWith(`'`)&&e.endsWith(`'`)?e.slice(1,-1):e}function qe(e){if(process.platform===`win32`)return e;let t=`__DOUBLE_BACKSLASH_${Ve(8).toString(`hex`)}__`;return e.replace(/\\\\/g,t).replace(/\\(.)/g,`$1`).replace(new RegExp(t,`g`),`\\`)}function I(e){let t=qe(Ke(e.trim()));return Xe.test(t)}function Je(e){let t=qe(Ke(e.trim()));return Xe.test(t)?t:null}async function Ye(e){let t=Je(e);if(!t)return null;let n=t,r;try{if(ze(n))r=M().readFileBytesSync(n);else{let e=await Ge();e&&n===Le(e)&&(r=M().readFileBytesSync(e))}}catch(e){return P(e),null}if(!r)return null;if(r.length===0)return pe(`Image file is empty: ${n}`,{level:`warn`}),null;r.length>=2&&r[0]===66&&r[1]===77&&(r=await(await c())(r).png().toBuffer());let i=Re(n).slice(1).toLowerCase()||`png`,a=await p(r,r.length,i),o=a.buffer.toString(`base64`);return{path:n,base64:o,mediaType:h(o),dimensions:a.dimensions}}var Xe,Ze=t((()=>{be(),d(),l(),he(),ve(),me(),f(),xe(),Xe=/\.(png|jpe?g|gif|webp)$/i}));function Qe(e,t){let{addNotification:n}=De(),r=(0,L.useRef)(e),i=(0,L.useRef)(0),a=(0,L.useRef)(null);(0,L.useEffect)(()=>{let o=r.current;if(r.current=e,!(!t||!e||o))return a.current&&clearTimeout(a.current),a.current=setTimeout(async(e,t,n)=>{e.current=null;let r=Date.now();r-t.current<tt||await Ue()&&(t.current=r,n({key:$e,text:`Image in clipboard · ${g(`chat:imagePaste`,`Chat`,`ctrl+v`)} to paste`,priority:`immediate`,timeoutMs:8e3}))},et,a,i,n),()=>{a.current&&(clearTimeout(a.current),a.current=null)}},[e,t,n])}var L,$e,et,tt,nt=t((()=>{L=n(O(),1),Oe(),u(),Ze(),$e=`clipboard-image-hint`,et=1e3,tt=3e4}));function rt(e,t){switch(t){case`bash`:return`!${e}`;default:return e}}function it(e){return e.startsWith(`!`)?`bash`:`prompt`}function at(e){return it(e)===`prompt`?e:e.slice(1)}function ot(e){return e===`!`}var st=t((()=>{}));function R(e,t=`append`){e.length>0&&(V&&z.length>0?t===`prepend`?z[0]=e+z[0]:z[0]+=e:(z.unshift(e),z.length>mt&&z.pop()),V=!0,U=!1)}function ct(){return z[0]??``}function lt(){V=!1}function ut(e,t){ht=e,H=t,U=!0,B=0}function dt(){return!U||z.length<=1?null:(B=(B+1)%z.length,{text:z[B]??``,start:ht,length:H})}function ft(e){H=e}function pt(){U=!1}var mt,z,B,V,ht,H,U,gt,W,G,_t,K,q,J,vt,yt=t((()=>{A(),Te(),a(),mt=10,z=[],B=0,V=!1,ht=0,H=0,U=!1,gt=/^[\p{L}\p{N}\p{M}_]$/u,W=/\s/,G=e=>gt.test(e),_t=e=>W.test(e),K=e=>e.length>0&&!_t(e)&&!G(e),q=class e{constructor(e,t=0,n=0){o(this,`measuredText`,void 0),o(this,`selection`,void 0),o(this,`offset`,void 0),this.measuredText=e,this.selection=n,this.offset=Math.max(0,Math.min(this.text.length,t))}static fromText(t,n,r=0,i=0){return new e(new vt(t,n-1),r,i)}getViewportStartLine(e){if(e===void 0||e<=0)return 0;let{line:t}=this.getPosition(),n=this.measuredText.getWrappedText();if(n.length<=e)return 0;let r=Math.floor(e/2),i=Math.max(0,t-r),a=Math.min(n.length,i+e);return a-i<e&&(i=Math.max(0,a-e)),i}getViewportCharOffset(e){let t=this.getViewportStartLine(e);return t===0?0:this.measuredText.getWrappedLines()[t]?.startOffset??0}getViewportCharEnd(e){let t=this.getViewportStartLine(e),n=this.measuredText.getWrappedLines();if(e===void 0||e<=0)return this.text.length;let r=Math.min(n.length,t+e);return r>=n.length?this.text.length:n[r]?.startOffset??this.text.length}render(e,t,n,r,i){let{line:a,column:o}=this.getPosition(),s=this.measuredText.getWrappedText(),c=this.getViewportStartLine(i),l=i!==void 0&&i>0?Math.min(s.length,c+i):s.length;return s.slice(c,l).map((i,l)=>{let u=l+c,d=i;if(t){let e=Array.from(F().segment(i));if(u===s.length-1){let n=Math.min(6,e.length),r=e.length-n,a=e.length>n?e[r].index:0;d=t.repeat(r)+i.slice(a)}else d=t.repeat(e.length)}if(a!==u)return d.trimEnd();let f=``,p=e,m=``,h=0,g=!1;for(let{segment:e}of F().segment(d)){if(g){m+=e;continue}let t=h+S(e);t>o?(p=e,g=!0):(h=t,f+=e)}let _,v=``;if(r&&u===s.length-1&&this.isAtEnd()&&r.text.length>0){let t=Ee(r.text)||r.text[0];_=e?n(t):t;let i=r.text.slice(t.length);i.length>0&&(v=r.dim(i))}else _=e?n(p):p;return f+_+v+m.trimEnd()}).join(`
2
+ `)}left(){if(this.offset===0)return this;let t=this.imageRefEndingAt(this.offset);if(t)return new e(this.measuredText,t.start);let n=this.measuredText.prevOffset(this.offset);return new e(this.measuredText,n)}right(){if(this.offset>=this.text.length)return this;let t=this.imageRefStartingAt(this.offset);if(t)return new e(this.measuredText,t.end);let n=this.measuredText.nextOffset(this.offset);return new e(this.measuredText,Math.min(n,this.text.length))}imageRefEndingAt(e){let t=this.text.slice(0,e).match(/\[Image #\d+\]$/);return t?{start:e-t[0].length,end:e}:null}imageRefStartingAt(e){let t=this.text.slice(e).match(/^\[Image #\d+\]/);return t?{start:e,end:e+t[0].length}:null}snapOutOfImageRef(e,t){let n=/\[Image #\d+\]/g,r;for(;(r=n.exec(this.text))!==null;){let n=r.index,i=n+r[0].length;if(e>n&&e<i)return t===`start`?n:i}return e}up(){let{line:t,column:n}=this.getPosition();if(t===0)return this;let r=this.measuredText.getWrappedText()[t-1];if(r===void 0)return this;let i=S(r);if(n>i){let n=this.getOffset({line:t-1,column:i});return new e(this.measuredText,n,0)}let a=this.getOffset({line:t-1,column:n});return new e(this.measuredText,a,0)}down(){let{line:t,column:n}=this.getPosition();if(t>=this.measuredText.lineCount-1)return this;let r=this.measuredText.getWrappedText()[t+1];if(r===void 0)return this;let i=S(r);if(n>i){let n=this.getOffset({line:t+1,column:i});return new e(this.measuredText,n,0)}let a=this.getOffset({line:t+1,column:n});return new e(this.measuredText,a,0)}startOfCurrentLine(){let{line:t}=this.getPosition();return new e(this.measuredText,this.getOffset({line:t,column:0}),0)}startOfLine(){let{line:t,column:n}=this.getPosition();return n===0&&t>0?new e(this.measuredText,this.getOffset({line:t-1,column:0}),0):this.startOfCurrentLine()}firstNonBlankInLine(){let{line:t}=this.getPosition(),n=(this.measuredText.getWrappedText()[t]||``).match(/^\s*\S/),r=n?.index?n.index+n[0].length-1:0,i=this.getOffset({line:t,column:r});return new e(this.measuredText,i,0)}endOfLine(){let{line:t}=this.getPosition(),n=this.measuredText.getLineLength(t),r=this.getOffset({line:t,column:n});return new e(this.measuredText,r,0)}findLogicalLineStart(e=this.offset){let t=this.text.lastIndexOf(`
3
+ `,e-1);return t===-1?0:t+1}findLogicalLineEnd(e=this.offset){let t=this.text.indexOf(`
4
+ `,e);return t===-1?this.text.length:t}getLogicalLineBounds(){return{start:this.findLogicalLineStart(),end:this.findLogicalLineEnd()}}createCursorWithColumn(t,n,r){let i=n-t,a=t+Math.min(r,i),o=this.measuredText.snapToGraphemeBoundary(a);return new e(this.measuredText,o,0)}endOfLogicalLine(){return new e(this.measuredText,this.findLogicalLineEnd(),0)}startOfLogicalLine(){return new e(this.measuredText,this.findLogicalLineStart(),0)}firstNonBlankInLogicalLine(){let{start:t,end:n}=this.getLogicalLineBounds(),r=t+(this.text.slice(t,n).match(/\S/)?.index??0);return new e(this.measuredText,r,0)}upLogicalLine(){let{start:t}=this.getLogicalLineBounds();if(t===0)return new e(this.measuredText,0,0);let n=this.offset-t,r=t-1,i=this.findLogicalLineStart(r);return this.createCursorWithColumn(i,r,n)}downLogicalLine(){let{start:t,end:n}=this.getLogicalLineBounds();if(n>=this.text.length)return new e(this.measuredText,this.text.length,0);let r=this.offset-t,i=n+1,a=this.findLogicalLineEnd(i);return this.createCursorWithColumn(i,a,r)}nextWord(){if(this.isAtEnd())return this;let t=this.measuredText.getWordBoundaries();for(let n of t)if(n.isWordLike&&n.start>this.offset)return new e(this.measuredText,n.start);return new e(this.measuredText,this.text.length)}endOfWord(){if(this.isAtEnd())return this;let t=this.measuredText.getWordBoundaries();for(let n of t)if(n.isWordLike){if(this.offset>=n.start&&this.offset<n.end-1)return new e(this.measuredText,n.end-1);if(this.offset===n.end-1){for(let n of t)if(n.isWordLike&&n.start>this.offset)return new e(this.measuredText,n.end-1);return this}}for(let n of t)if(n.isWordLike&&n.start>this.offset)return new e(this.measuredText,n.end-1);return this}prevWord(){if(this.isAtStart())return this;let t=this.measuredText.getWordBoundaries(),n=null;for(let r of t)if(r.isWordLike&&r.start<this.offset){if(this.offset>r.start&&this.offset<=r.end)return new e(this.measuredText,r.start);n=r.start}return n===null?new e(this.measuredText,0):new e(this.measuredText,n)}nextVimWord(){if(this.isAtEnd())return this;let t=this.offset,n=e=>this.measuredText.nextOffset(e),r=this.graphemeAt(t);if(!r)return this;if(G(r))for(;t<this.text.length&&G(this.graphemeAt(t));)t=n(t);else if(K(r))for(;t<this.text.length&&K(this.graphemeAt(t));)t=n(t);for(;t<this.text.length&&W.test(this.graphemeAt(t));)t=n(t);return new e(this.measuredText,t)}endOfVimWord(){if(this.isAtEnd())return this;let t=this.text,n=this.offset,r=e=>this.measuredText.nextOffset(e);if(this.graphemeAt(n)===``)return this;for(n=r(n);n<t.length&&W.test(this.graphemeAt(n));)n=r(n);if(n>=t.length)return new e(this.measuredText,t.length);let i=this.graphemeAt(n);if(G(i))for(;n<t.length;){let e=r(n);if(e>=t.length||!G(this.graphemeAt(e)))break;n=e}else if(K(i))for(;n<t.length;){let e=r(n);if(e>=t.length||!K(this.graphemeAt(e)))break;n=e}return new e(this.measuredText,n)}prevVimWord(){if(this.isAtStart())return this;let t=this.offset,n=e=>this.measuredText.prevOffset(e);for(t=n(t);t>0&&W.test(this.graphemeAt(t));)t=n(t);if(t===0&&W.test(this.graphemeAt(0)))return new e(this.measuredText,0);let r=this.graphemeAt(t);if(G(r))for(;t>0;){let e=n(t);if(!G(this.graphemeAt(e)))break;t=e}else if(K(r))for(;t>0;){let e=n(t);if(!K(this.graphemeAt(e)))break;t=e}return new e(this.measuredText,t)}nextWORD(){let e=this;for(;!e.isOverWhitespace()&&!e.isAtEnd();)e=e.right();for(;e.isOverWhitespace()&&!e.isAtEnd();)e=e.right();return e}endOfWORD(){if(this.isAtEnd())return this;let e=this;if(!e.isOverWhitespace()&&(e.right().isOverWhitespace()||e.right().isAtEnd()))return e=e.right(),e.endOfWORD();for(e.isOverWhitespace()&&(e=e.nextWORD());!e.right().isOverWhitespace()&&!e.isAtEnd();)e=e.right();return e}prevWORD(){let e=this;for(e.left().isOverWhitespace()&&(e=e.left());e.isOverWhitespace()&&!e.isAtStart();)e=e.left();if(!e.isOverWhitespace())for(;!e.left().isOverWhitespace()&&!e.isAtStart();)e=e.left();return e}modifyText(t,n=``){let r=this.offset,i=t.offset,a=this.text.slice(0,r)+n+this.text.slice(i);return e.fromText(a,this.columns,r+n.normalize(`NFC`).length)}insert(e){return this.modifyText(this,e)}del(){return this.isAtEnd()?this:this.modifyText(this.right())}backspace(){return this.isAtStart()?this:this.left().modifyText(this)}deleteToLineStart(){if(this.offset>0&&this.text[this.offset-1]===`
5
+ `)return{cursor:this.left().modifyText(this),killed:`
6
+ `};let e=this.startOfLine(),t=this.text.slice(e.offset,this.offset);return{cursor:e.modifyText(this),killed:t}}deleteToLineEnd(){if(this.text[this.offset]===`
7
+ `)return{cursor:this.modifyText(this.right()),killed:`
8
+ `};let e=this.endOfLine(),t=this.text.slice(this.offset,e.offset);return{cursor:this.modifyText(e),killed:t}}deleteToLogicalLineEnd(){return this.text[this.offset]===`
9
+ `?this.modifyText(this.right()):this.modifyText(this.endOfLogicalLine())}deleteWordBefore(){if(this.isAtStart())return{cursor:this,killed:``};let t=this.snapOutOfImageRef(this.prevWord().offset,`start`),n=new e(this.measuredText,t),r=this.text.slice(n.offset,this.offset);return{cursor:n.modifyText(this),killed:r}}deleteTokenBefore(){let t=this.imageRefStartingAt(this.offset);if(t){let n=this.text[t.end]===` `?t.end+1:t.end;return this.modifyText(new e(this.measuredText,n))}if(this.isAtStart())return null;let n=this.text[this.offset];if(n!==void 0&&!/\s/.test(n))return null;let r=this.text.slice(0,this.offset).match(/(^|\s)\[(Pasted text #\d+(?: \+\d+ lines)?|Image #\d+|\.\.\.Truncated text #\d+ \+\d+ lines\.\.\.)\]$/);if(r){let t=r.index+r[1].length;return new e(this.measuredText,t).modifyText(this)}return null}deleteWordAfter(){if(this.isAtEnd())return this;let t=this.snapOutOfImageRef(this.nextWord().offset,`end`);return this.modifyText(new e(this.measuredText,t))}graphemeAt(e){if(e>=this.text.length)return``;let t=this.measuredText.nextOffset(e);return this.text.slice(e,t)}isOverWhitespace(){let e=this.text[this.offset]??``;return/\s/.test(e)}equals(e){return this.offset===e.offset&&this.measuredText===e.measuredText}isAtStart(){return this.offset===0}isAtEnd(){return this.offset>=this.text.length}startOfFirstLine(){return new e(this.measuredText,0,0)}startOfLastLine(){let t=this.text.lastIndexOf(`
10
+ `);return t===-1?this.startOfLine():new e(this.measuredText,t+1,0)}goToLine(t){let n=this.text.split(`
11
+ `),r=Math.min(Math.max(0,t-1),n.length-1),i=0;for(let e=0;e<r;e++)i+=(n[e]?.length??0)+1;return new e(this.measuredText,i,0)}endOfFile(){return new e(this.measuredText,this.text.length,0)}get text(){return this.measuredText.text}get columns(){return this.measuredText.columns+1}getPosition(){return this.measuredText.getPositionFromOffset(this.offset)}getOffset(e){return this.measuredText.getOffsetFromPosition(e)}findCharacter(e,t,n=1){let r=this.text,i=t===`f`||t===`t`,a=t===`t`||t===`T`,o=0;if(i){let t=this.measuredText.nextOffset(this.offset);for(;t<r.length;){if(this.graphemeAt(t)===e&&(o++,o===n))return a?Math.max(this.offset,this.measuredText.prevOffset(t)):t;t=this.measuredText.nextOffset(t)}}else{if(this.offset===0)return null;let t=this.measuredText.prevOffset(this.offset);for(;t>=0;){if(this.graphemeAt(t)===e&&(o++,o===n))return a?Math.min(this.offset,this.measuredText.nextOffset(t)):t;if(t===0)break;t=this.measuredText.prevOffset(t)}}return null}},J=class{constructor(e,t,n,r=!1){o(this,`text`,void 0),o(this,`startOffset`,void 0),o(this,`isPrecededByNewline`,void 0),o(this,`endsWithNewline`,void 0),this.text=e,this.startOffset=t,this.isPrecededByNewline=n,this.endsWithNewline=r}equals(e){return this.text===e.text&&this.startOffset===e.startOffset}get length(){return this.text.length+ +!!this.endsWithNewline}},vt=class{constructor(e,t){o(this,`columns`,void 0),o(this,`_wrappedLines`,void 0),o(this,`text`,void 0),o(this,`navigationCache`,void 0),o(this,`graphemeBoundaries`,void 0),o(this,`wordBoundariesCache`,void 0),this.columns=t,this.text=e.normalize(`NFC`),this.navigationCache=new Map}get wrappedLines(){return this._wrappedLines||(this._wrappedLines=this.measureWrappedText()),this._wrappedLines}getGraphemeBoundaries(){if(!this.graphemeBoundaries){this.graphemeBoundaries=[];for(let{index:e}of F().segment(this.text))this.graphemeBoundaries.push(e);this.graphemeBoundaries.push(this.text.length)}return this.graphemeBoundaries}getWordBoundaries(){if(!this.wordBoundariesCache){this.wordBoundariesCache=[];for(let e of we().segment(this.text))this.wordBoundariesCache.push({start:e.index,end:e.index+e.segment.length,isWordLike:e.isWordLike??!1})}return this.wordBoundariesCache}binarySearchBoundary(e,t,n){let r=0,i=e.length-1,a=n?this.text.length:0;for(;r<=i;){let o=Math.floor((r+i)/2),s=e[o];if(s===void 0)break;n?s>t?(a=s,i=o-1):r=o+1:s<t?(a=s,r=o+1):i=o-1}return a}stringIndexToDisplayWidth(e,t){return t<=0?0:t>=e.length?S(e):S(e.substring(0,t))}displayWidthToStringIndex(e,t){if(t<=0||!e)return 0;if(e===this.text)return this.offsetAtDisplayWidth(t);let n=0,r=0;for(let{segment:i,index:a}of F().segment(e)){let e=S(i);if(n+e>t)break;n+=e,r=a+i.length}return r}offsetAtDisplayWidth(e){if(e<=0)return 0;let t=0,n=this.getGraphemeBoundaries();for(let r=0;r<n.length-1;r++){let i=n[r],a=n[r+1];if(i===void 0||a===void 0)continue;let o=S(this.text.substring(i,a));if(t+o>e)return i;t+=o}return this.text.length}measureWrappedText(){let e=te(this.text,this.columns,{hard:!0,trim:!1}),t=[],n=0,r=-1,i=e.split(`
12
+ `);for(let e=0;e<i.length;e++){let a=i[e],o=t=>e===0||t>0&&this.text[t-1]===`
13
+ `;if(a.length===0)if(r=this.text.indexOf(`
14
+ `,r+1),r!==-1){let e=r;t.push(new J(a,e,o(e),!0))}else{let e=this.text.length;t.push(new J(a,e,o(e),!1))}else{let e=this.text.indexOf(a,n);if(e===-1)throw Error(`Failed to find wrapped line in text`);n=e+a.length;let i=e+a.length,s=i<this.text.length&&this.text[i]===`
15
+ `;s&&(r=i),t.push(new J(a,e,o(e),s))}}return t}getWrappedText(){return this.wrappedLines.map(e=>e.isPrecededByNewline?e.text:e.text.trimStart())}getWrappedLines(){return this.wrappedLines}getLine(e){let t=this.wrappedLines;return t[Math.max(0,Math.min(e,t.length-1))]}getOffsetFromPosition(e){let t=this.getLine(e.line);if(t.text.length===0&&t.endsWithNewline)return t.startOffset;let n=t.isPrecededByNewline?0:t.text.length-t.text.trimStart().length,r=e.column+n,i=this.displayWidthToStringIndex(t.text,r),a=t.startOffset+i,o=t.startOffset+t.text.length,s=o,c=S(t.text);return t.endsWithNewline&&e.column>c&&(s=o+1),Math.min(a,s)}getLineLength(e){return S(this.getLine(e).text)}getPositionFromOffset(e){let t=this.wrappedLines;for(let n=0;n<t.length;n++){let r=t[n],i=t[n+1];if(e>=r.startOffset&&(!i||e<i.startOffset)){let t=e-r.startOffset,i;if(r.isPrecededByNewline)i=this.stringIndexToDisplayWidth(r.text,t);else{let e=r.text.length-r.text.trimStart().length;if(t<e)i=0;else{let n=r.text.trimStart(),a=t-e;i=this.stringIndexToDisplayWidth(n,a)}}return{line:n,column:Math.max(0,i)}}}let n=t.length-1,r=this.wrappedLines[n];return{line:n,column:S(r.text)}}get lineCount(){return this.wrappedLines.length}withCache(e,t){let n=this.navigationCache.get(e);if(n!==void 0)return n;let r=t();return this.navigationCache.set(e,r),r}nextOffset(e){return this.withCache(`next:${e}`,()=>{let t=this.getGraphemeBoundaries();return this.binarySearchBoundary(t,e,!0)})}prevOffset(e){return e<=0?0:this.withCache(`prev:${e}`,()=>{let t=this.getGraphemeBoundaries();return this.binarySearchBoundary(t,e,!1)})}snapToGraphemeBoundary(e){if(e<=0)return 0;if(e>=this.text.length)return this.text.length;let t=this.getGraphemeBoundaries(),n=0,r=t.length-1;for(;n<r;){let i=n+r+1>>1;t[i]<=e?n=i:r=i-1}return t[n]}}}));function bt(){St||process.platform!==`darwin`||(St=!0,import(`./modifiersNative-D7nm70eq.js`).then(({prewarm:e})=>e()).catch(()=>{}))}function xt(t){if(process.platform!==`darwin`)return!1;try{let{isModifierPressed:n}=(Pe(),e(Ne));return n(t)}catch{return!1}}var St,Ct=t((()=>{St=!1}));function wt(e){let t=new Map(e);return e=>(t.get(e)??Y)(e)}function Tt({value:e,onChange:t,onSubmit:n,onExit:r,onExitMessage:i,onHistoryUp:a,onHistoryDown:o,onHistoryReset:s,onClearInput:c,mask:l=``,multiline:u=!1,cursorChar:d,invert:f,columns:p,onImagePaste:h,disableCursorMovementForUpDownKeys:g=!1,disableEscapeDoublePress:_=!1,maxVisibleLines:v,externalOffset:y,onOffsetChange:b,inputFilter:x,inlineGhostText:S,dim:C}){ge.terminal===`Apple_Terminal`&&bt();let w=y,T=b,E=q.fromText(e,p,w),{addNotification:ee,removeNotification:D}=De(),te=ie(e=>{i?.(e,`Ctrl-C`)},()=>r?.(),()=>{e&&(t(``),T(0),s?.())}),ne=ie(t=>{!e||!t||ee({key:`escape-again-to-clear`,text:`Esc again to clear`,priority:`immediate`,timeoutMs:1e3})},()=>{D(`escape-again-to-clear`),c?.(),e&&(e.trim()!==``&&Me(e),t(``),T(0),s?.())}),re=ie(t=>{e===``&&i?.(t,`Ctrl-D`)},()=>{e===``&&r?.()});function O(){return E.text===``?(re(),E):E.del()}function k(){let{cursor:e,killed:t}=E.deleteToLineEnd();return R(t,`append`),e}function ae(){let{cursor:e,killed:t}=E.deleteToLineStart();return R(t,`prepend`),e}function oe(){let{cursor:e,killed:t}=E.deleteWordBefore();return R(t,`prepend`),e}function se(){let e=ct();if(e.length>0){let t=E.offset,n=E.insert(e);return ut(t,e.length),n}return E}function ce(){let e=dt();if(!e)return E;let{text:t,start:n,length:r}=e,i=E.text.slice(0,n),a=E.text.slice(n+r),o=i+t+a,s=n+t.length;return ft(t.length),q.fromText(o,p,s)}let A=wt([[`a`,()=>E.startOfLine()],[`b`,()=>E.left()],[`c`,te],[`d`,O],[`e`,()=>E.endOfLine()],[`f`,()=>E.right()],[`h`,()=>E.deleteTokenBefore()??E.backspace()],[`k`,k],[`n`,()=>j()],[`p`,()=>fe()],[`u`,ae],[`w`,oe],[`y`,se]]),ue=wt([[`b`,()=>E.prevWord()],[`f`,()=>E.nextWord()],[`d`,()=>E.deleteWordAfter()],[`y`,ce]]);function de(t){if(u&&E.offset>0&&E.text[E.offset-1]===`\\`)return Ae(),E.backspace().insert(`
16
+ `);if(t.meta||t.shift||ge.terminal===`Apple_Terminal`&&xt(`shift`))return E.insert(`
17
+ `);n?.(e)}function fe(){if(g)return a?.(),E;let e=E.up();if(!e.equals(E))return e;if(u){let e=E.upLogicalLine();if(!e.equals(E))return e}return a?.(),E}function j(){if(g)return o?.(),E;let e=E.down();if(!e.equals(E))return e;if(u){let e=E.downLogicalLine();if(!e.equals(E))return e}return o?.(),E}function pe(e){switch(!0){case e.escape:return()=>(_||ne(),E);case e.leftArrow&&(e.ctrl||e.meta||e.fn):return()=>E.prevWord();case e.rightArrow&&(e.ctrl||e.meta||e.fn):return()=>E.nextWord();case e.backspace:return e.meta||e.ctrl?oe:()=>E.deleteTokenBefore()??E.backspace();case e.delete:return e.meta?k:()=>E.del();case e.ctrl:return A;case e.home:return()=>E.startOfLine();case e.end:return()=>E.endOfLine();case e.pageDown:return m()?Y:()=>E.endOfLine();case e.pageUp:return m()?Y:()=>E.startOfLine();case e.wheelUp:case e.wheelDown:return Y;case e.return:return()=>de(e);case e.meta:return ue;case e.tab:return()=>E;case e.upArrow&&!e.shift:return fe;case e.downArrow&&!e.shift:return j;case e.leftArrow:return()=>E.left();case e.rightArrow:return()=>E.right();default:return e=>{switch(!0){case e===`\x1B[H`||e===`\x1B[1~`:return E.startOfLine();case e===`\x1B[F`||e===`\x1B[4~`:return E.endOfLine();default:{let t=le(e).replace(/(?<=[^\\\r\n])\r$/,``).replace(/\r/g,`
18
+ `);return E.isAtStart()&&ot(e)?E.insert(t).left():E.insert(t)}}}}}function me(e,t){return!!(e.ctrl&&(t===`k`||t===`u`||t===`w`)||e.meta&&(e.backspace||e.delete))}function he(e,t){return(e.ctrl||e.meta)&&t===`y`}function M(e,r){let i=x?x(e,r):e;if(i===``&&e!==``)return;if(!r.backspace&&!r.delete&&e.includes(``)){let n=(e.match(/\x7f/g)||[]).length,r=E;for(let e=0;e<n;e++)r=r.deleteTokenBefore()??r.backspace();E.equals(r)||(E.text!==r.text&&t(r.text),T(r.offset)),lt(),pt();return}me(r,i)||lt(),he(r,i)||pt();let a=pe(r)(i);a&&(E.equals(a)||(E.text!==a.text&&t(a.text),T(a.offset)),i.length>1&&i.endsWith(`\r`)&&!i.slice(0,-1).includes(`\r`)&&i[i.length-2]!==`\\`&&n?.(a.text))}let _e=S&&C&&S.insertPosition===w?{text:S.text,dim:C}:void 0,N=E.getPosition();return{onInput:M,renderedValue:E.render(d,l,f,_e,v),offset:w,setOffset:T,cursorLine:N.line-E.getViewportStartLine(v),cursorColumn:N.column,viewportCharOffset:E.getViewportCharOffset(v),viewportCharEnd:E.getViewportCharEnd(v)}}var Y,Et=t((()=>{st(),Oe(),E(),ke(),je(),yt(),_e(),v(),Ct(),Fe(),Y=()=>{}}));function Dt({placeholder:e,value:t,showCursor:n,focus:r,terminalFocus:i=!0,invert:a=k.inverse,hidePlaceholderText:o=!1}){let s;e&&(o?s=n&&r&&i?a(` `):``:(s=k.dim(e),n&&r&&i&&(s=e.length>0?a(e[0])+k.dim(e.slice(1)):a(` `))));let c=t.length===0&&!!e;return{renderedPlaceholder:s,showPlaceholder:c}}var Ot=t((()=>{ae()}));function kt({onPaste:e,onInput:t,onImagePaste:n}){let[r,i]=X.useState({chunks:[],timeoutId:null}),[a,o]=X.useState(!1),s=X.useRef(!0),c=X.useRef(!1),l=X.useMemo(()=>Se()===`macos`,[]);X.useEffect(()=>()=>{s.current=!1},[]);let u=de(X.useCallback(()=>{!n||!s.current||We().then(e=>{e&&s.current&&n(e.base64,e.mediaType,void 0,e.dimensions)}).catch(e=>{s.current&&P(e)}).finally(()=>{s.current&&o(!1)})},[n]),At),d=X.useCallback(t=>(t&&clearTimeout(t),setTimeout((e,t,n,r,i,a,o)=>{o.current=!1,e(({chunks:e})=>{let o=e.join(``).replace(/\[I$/,``).replace(/\[O$/,``),s=o.split(/ (?=\/|[A-Za-z]:\\)/).flatMap(e=>e.split(`
19
+ `)).filter(e=>e.trim()),c=s.filter(e=>I(e));if(t&&c.length>0){let e=/\/TemporaryItems\/.*screencaptureui.*\/Screenshot/i.test(o);return Promise.all(c.map(e=>Ye(e))).then(c=>{let l=c.filter(e=>e!==null);if(l.length>0){for(let e of l){let n=Le(e.path);t(e.base64,e.mediaType,n,e.dimensions,e.path)}let e=s.filter(e=>!I(e));e.length>0&&n&&n(e.join(`
20
+ `)),r(!1)}else e&&a?i():(n&&n(o),r(!1))}),{chunks:[],timeoutId:null}}return a&&t&&o.length===0?(i(),{chunks:[],timeoutId:null}):(n&&n(o),r(!1),{chunks:[],timeoutId:null})})},jt,i,n,e,o,u,l,c)),[u,l,n,e]);return{wrappedOnInput:(r,a,s)=>{let f=s.keypress.isPasted;f&&o(!0);let p=r.split(/ (?=\/|[A-Za-z]:\\)/).flatMap(e=>e.split(`
21
+ `)).some(e=>I(e.trim()));if(f&&r.length===0&&l&&n){u(),o(!1);return}if(e&&(r.length>800||c.current||p||f||r.length>=3&&!a.return&&!a.tab&&!a.escape&&!a.upArrow&&!a.downArrow&&!a.leftArrow&&!a.rightArrow)){c.current=!0,i(({chunks:e,timeoutId:t})=>({chunks:[...e,r],timeoutId:d(t)}));return}t(r,a),r.length>10&&o(!1)},pasteState:r,isPasting:a}}var X,At,jt,Mt=t((()=>{X=n(O(),1),xe(),ue(),Ze(),Ce(),At=50,jt=100}));function Nt(e,t){if(t.length===0)return[{text:e,start:0}];let n=[...t].sort((e,t)=>e.start===t.start?t.priority-e.priority:e.start-t.start),r=[],i=[];for(let e of n)e.start!==e.end&&(i.some(t=>e.start>=t.start&&e.start<t.end||e.end>t.start&&e.end<=t.end||e.start<=t.start&&e.end>=t.end)||(r.push(e),i.push({start:e.start,end:e.end})));return new Ft(e).segment(r)}function Pt(e){return ne(e).filter(e=>e.code!==e.endCode)}var Ft,It=t((()=>{y(),a(),Ft=class{constructor(e){o(this,`text`,void 0),o(this,`tokens`,void 0),o(this,`visiblePos`,0),o(this,`stringPos`,0),o(this,`tokenIdx`,0),o(this,`charIdx`,0),o(this,`codes`,[]),this.text=e,this.tokens=ee(e)}segment(e){let t=[];for(let n of e){let e=this.segmentTo(n.start);e&&t.push(e);let r=this.segmentTo(n.end);r&&(r.highlight=n,t.push(r))}let n=this.segmentTo(1/0);return n&&t.push(n),t}segmentTo(e){if(this.tokenIdx>=this.tokens.length||e<=this.visiblePos)return null;let t=this.visiblePos;for(;this.tokenIdx<this.tokens.length;){let e=this.tokens[this.tokenIdx];if(e.type!==`ansi`)break;this.codes.push(e),this.stringPos+=e.code.length,this.tokenIdx++}let n=this.stringPos,r=[...this.codes];for(;this.visiblePos<e&&this.tokenIdx<this.tokens.length;){let t=this.tokens[this.tokenIdx];if(t.type===`ansi`)this.codes.push(t),this.stringPos+=t.code.length,this.tokenIdx++;else{let n=e-this.visiblePos,r=t.value.length-this.charIdx,i=Math.min(n,r);this.stringPos+=i,this.visiblePos+=i,this.charIdx+=i,this.charIdx>=t.value.length&&(this.tokenIdx++,this.charIdx=0)}}if(this.stringPos===n)return null;let i=Pt(r),a=Pt(this.codes);this.codes=a;let o=w(i),s=w(fe(a));return{text:o+this.text.substring(n,this.stringPos)+s,start:t}}}}));function Lt({char:e,index:t,glimmerIndex:n,messageColor:r,shimmerColor:i}){let a=t===n,o=Math.abs(t-n)===1;return(0,Rt.jsx)(D,{color:a||o?i:r,children:e})}var Rt,zt=t((()=>{A(),Rt=j()}));function Bt({text:e,highlights:t}){let{lines:n,hasShimmer:r,sweepStart:i,cycleLength:a}=Vt.useMemo(()=>{let n=Nt(e,t),r=[[]],i=0;for(let e of n){let t=e.text.split(`
22
+ `);for(let n=0;n<t.length;n++){n>0&&(r.push([]),i+=1);let a=t[n];a.length>0&&r[r.length-1].push({text:a,highlight:e.highlight,start:i}),i+=a.length}}let a=t.some(e=>e.shimmerColor),o=0,s=1;if(a){let e=1/0,n=-1/0;for(let r of t)r.shimmerColor&&(e=Math.min(e,r.start),n=Math.max(n,r.end));o=e-10,s=n-e+20}return{lines:r,hasShimmer:a,sweepStart:o,cycleLength:s}},[e,t]),[o,s]=ce(r?50:null),c=r?i+Math.floor(s/50)%a:-100;return(0,Z.jsx)(T,{ref:o,flexDirection:`column`,children:n.map((e,t)=>(0,Z.jsx)(T,{children:e.length===0?(0,Z.jsx)(D,{children:` `}):e.map((e,t)=>e.highlight?.shimmerColor&&e.highlight.color?(0,Z.jsx)(D,{children:e.text.split(``).map((t,n)=>(0,Z.jsx)(Lt,{char:t,index:e.start+n,glimmerIndex:c,messageColor:e.highlight.color,shimmerColor:e.highlight.shimmerColor},n))},t):(0,Z.jsx)(D,{color:e.highlight?.color,dimColor:e.highlight?.dimColor,inverse:e.highlight?.inverse,children:(0,Z.jsx)(b,{children:e.text})},t))},t))})}var Vt,Z,Ht=t((()=>{Vt=n(O(),1),A(),It(),zt(),Z=j()}));function Ut({inputState:e,children:t,terminalFocus:n,invert:r,hidePlaceholderText:i,...a}){let{onInput:o,renderedValue:s,cursorLine:c,cursorColumn:l}=e,u=x({line:c,column:l,active:!!(a.focus&&a.showCursor&&n)}),{wrappedOnInput:d,isPasting:f}=kt({onPaste:a.onPaste,onInput:(e,t)=>{f&&t.return||o(e,t)},onImagePaste:a.onImagePaste}),{onIsPastingChange:p}=a;Wt.useEffect(()=>{p&&p(f)},[f,p]);let{showPlaceholder:m,renderedPlaceholder:h}=Dt({placeholder:a.placeholder,value:a.value,showCursor:a.showCursor,focus:a.focus,terminalFocus:n,invert:r,hidePlaceholderText:i});oe(d,{isActive:a.focus});let g=a.value&&a.value.trim().indexOf(` `)===-1||a.value?.endsWith(` `),_=!!(a.argumentHint&&a.value&&g&&a.value.startsWith(`/`)),v=a.showCursor&&a.highlights?a.highlights.filter(e=>e.dimColor||a.cursorOffset<e.start||a.cursorOffset>=e.end):a.highlights,{viewportCharOffset:y,viewportCharEnd:S}=e,C=v&&y>0?v.filter(e=>e.end>y&&e.start<S).map(e=>({...e,start:Math.max(0,e.start-y),end:e.end-y})):v;return C&&C.length>0?(0,Q.jsxs)(T,{ref:u,children:[(0,Q.jsx)(Bt,{text:s,highlights:C}),_&&(0,Q.jsxs)(D,{dimColor:!0,children:[a.value?.endsWith(` `)?``:` `,a.argumentHint]}),t]}):(0,Q.jsx)(T,{ref:u,children:(0,Q.jsxs)(D,{wrap:`truncate-end`,dimColor:a.dimColor,children:[m&&a.placeholderElement?a.placeholderElement:m&&h?(0,Q.jsx)(b,{children:h}):(0,Q.jsx)(b,{children:s}),_&&(0,Q.jsxs)(D,{dimColor:!0,children:[a.value?.endsWith(` `)?``:` `,a.argumentHint]}),t]})})}var Wt,Q,Gt=t((()=>{Wt=n(O(),1),Ot(),Mt(),A(),Ht(),Q=j()}));function Kt(e){let[t]=C(),n=re(),i=(0,qt.useMemo)(()=>r(process.env.CLAUDE_CODE_ACCESSIBILITY),[]);_().prefersReducedMotion,Qe(n,!!e.onImagePaste);let a=n&&!i?k.inverse:e=>e;return(0,$.jsx)(T,{children:(0,$.jsx)(Ut,{inputState:Tt({value:e.value,onChange:e.onChange,onSubmit:e.onSubmit,onExit:e.onExit,onExitMessage:e.onExitMessage,onHistoryReset:e.onHistoryReset,onHistoryUp:e.onHistoryUp,onHistoryDown:e.onHistoryDown,onClearInput:e.onClearInput,focus:e.focus,mask:e.mask,multiline:e.multiline,cursorChar:e.showCursor?` `:``,highlightPastedText:e.highlightPastedText,invert:a,themeText:se(`text`,t),columns:e.columns,maxVisibleLines:e.maxVisibleLines,onImagePaste:e.onImagePaste,disableCursorMovementForUpDownKeys:e.disableCursorMovementForUpDownKeys,disableEscapeDoublePress:e.disableEscapeDoublePress,externalOffset:e.cursorOffset,onOffsetChange:e.onChangeCursorOffset,inputFilter:e.inputFilter,inlineGhostText:e.inlineGhostText,dim:k.dim}),terminalFocus:n,highlights:e.highlights,invert:a,...e})})}var qt,$,Jt=t((()=>{ae(),qt=n(O(),1),nt(),s(),Et(),A(),i(),Gt(),$=j()}));export{st as C,We as D,Qe as E,Ze as O,at as S,nt as T,lt as _,Lt as a,dt as b,Tt as c,yt as d,K as f,ut as g,R as h,Gt as i,q as l,G as m,Jt as n,zt as o,_t as p,Ut as r,Et as s,Kt as t,ct as u,pt as v,rt as w,it as x,ft as y};
@@ -0,0 +1 @@
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{Ap as t,Dp as n,Gb as r,Kb as i,Op as a,Ub as o,Wb as s,Yb as c,gi as l,hp as u,lp as d,mp as f,pp as p,up as m,vi as h}from"./loadAgentsDir-C1LkW7gl.js";import{D as g,H as _,I as v,P as y,T as b,U as x,V as S,Wt as C,Xt as w,ot as T,t as E}from"./src-DL3w8VPk.js";import{t as D}from"./jsx-runtime-Bb4Xn-E0.js";import{b as O,h as k}from"./settings-DKN4xSpQ.js";import{n as A,t as j}from"./useExitOnCtrlCDWithKeybindings-CjW3gUOt.js";import{t as M}from"./select-C_KXmqbI.js";import{t as N}from"./CustomSelect-B46Eh0gU.js";function P({onThemeSelect:e,showIntroText:n=!1,helpText:i=``,showHelpTextBelow:o=!1,hideEscToCancel:s=!1,skipExitHandling:c=!1,onCancel:u}){let[m]=_(),h=x(),{columns:E}=T(),D=p(),k=D===null?f(m):null,{setPreviewTheme:j,savePreview:N,cancelPreview:P}=S(),I=a(e=>e.settings.syntaxHighlightingDisabled)??!1,L=t();w(`ThemePicker`);let R=r(`theme:toggleSyntaxHighlighting`,`ThemePicker`,`ctrl+t`);C(`theme:toggleSyntaxHighlighting`,()=>{if(D===null){let e=!I;O(`userSettings`,{syntaxHighlightingDisabled:e}),L(t=>({...t,settings:{...t.settings,syntaxHighlightingDisabled:e}}))}},{context:`ThemePicker`});let z=A(c?()=>{}:void 0),B=[{label:`Dark mode`,value:`dark`},{label:`Light mode`,value:`light`},{label:`Dark mode (colorblind-friendly)`,value:`dark-daltonized`},{label:`Light mode (colorblind-friendly)`,value:`light-daltonized`},{label:`Dark mode (ANSI colors only)`,value:`dark-ansi`},{label:`Light mode (ANSI colors only)`,value:`light-ansi`}],V=(0,F.jsxs)(v,{flexDirection:`column`,gap:1,children:[(0,F.jsxs)(v,{flexDirection:`column`,gap:1,children:[n?(0,F.jsx)(y,{children:`Let's get started.`}):(0,F.jsx)(y,{bold:!0,color:`permission`,children:`Theme`}),(0,F.jsxs)(v,{flexDirection:`column`,children:[(0,F.jsx)(y,{bold:!0,children:`Choose the text style that looks best with your terminal`}),i&&!o&&(0,F.jsx)(y,{dimColor:!0,children:i})]}),(0,F.jsx)(M,{options:B,onFocus:e=>{j(e)},onChange:t=>{N(),e(t)},onCancel:c?()=>{P(),u?.()}:async()=>{P(),await l(0)},visibleOptionCount:B.length,defaultValue:h,defaultFocusValue:h})]}),(0,F.jsxs)(v,{flexDirection:`column`,width:`100%`,children:[(0,F.jsx)(v,{flexDirection:`column`,borderTop:!0,borderBottom:!0,borderLeft:!1,borderRight:!1,borderStyle:`dashed`,borderColor:`subtle`,children:(0,F.jsx)(d,{patch:{oldStart:1,newStart:1,oldLines:3,newLines:3,lines:[` function greet() {`,`- console.log("Hello, World!");`,`+ console.log("Hello, Work Mate!");`,` }`]},dim:!1,filePath:`demo.js`,firstLine:null,width:E})}),(0,F.jsxs)(y,{dimColor:!0,children:[` `,D===`env`?`Syntax highlighting disabled (via CLAUDE_CODE_SYNTAX_HIGHLIGHT=${process.env.CLAUDE_CODE_SYNTAX_HIGHLIGHT})`:I?`Syntax highlighting disabled (${R} to enable)`:k?`Syntax theme: ${k.theme}${k.source?` (from ${k.source})`:``} (${R} to disable)`:`Syntax highlighting enabled (${R} to disable)`]})]})]});return n?V:(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(v,{flexDirection:`column`,children:V}),(0,F.jsxs)(v,{marginTop:1,children:[o&&i&&(0,F.jsx)(v,{marginLeft:3,children:(0,F.jsx)(y,{dimColor:!0,children:i})}),!s&&(0,F.jsx)(v,{children:(0,F.jsx)(y,{dimColor:!0,italic:!0,children:z.pending?(0,F.jsxs)(F.Fragment,{children:[`Press `,z.keyName,` again to exit`]}):(0,F.jsxs)(b,{children:[(0,F.jsx)(g,{shortcut:`Enter`,action:`select`}),(0,F.jsx)(g,{shortcut:`Esc`,action:`cancel`})]})})})]})]})}var F,I=e((()=>{j(),c(),E(),i(),o(),s(),n(),h(),k(),N(),u(),m(),F=D()}));export{I as n,P as t};
@@ -0,0 +1 @@
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,2 +1,2 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{n as t,t as n}from"./figures-5ThXQEtq.js";import{H as r,I as i,P as a,j as o,t as s}from"./src-DL3w8VPk.js";import{t as c}from"./jsx-runtime-Bb4Xn-E0.js";import{D as l,E as u}from"./config-DUTgj3js.js";function d(e,t,n,r){return r=typeof r==`function`?r:void 0,e==null?e:u(e,t,n,r)}var f=e((()=>{l()}));function p(e,t={}){let{showValues:n=!0,hideFunctions:r=!1,themeName:i=`dark`,treeCharColors:a={}}=t,s=[],c=new WeakSet;function l(e,t){return t?o(t,i)(e):e}function u(e,t,i,o=0){if(typeof e==`string`){s.push(t+l(e,a.value));return}if(typeof e!=`object`||!e){if(n){let n=String(e);s.push(t+l(n,a.value))}return}if(c.has(e)){s.push(t+l(`[Circular]`,a.value));return}c.add(e);let d=Object.keys(e).filter(t=>{let n=e[t];return!(r&&typeof n==`function`)});d.forEach((r,i)=>{let f=e[r],p=i===d.length-1,h=o===0&&i===0?``:t,g=l(p?m.lastBranch:m.branch,a.treeChar),_=r.trim()===``?``:l(r,a.key),v=h+g+(_?` ${_}`:``),y=r.trim()!==``;if(f&&typeof f==`object`&&c.has(f)){let e=l(`[Circular]`,a.value);s.push(v+(y?`: `:v?` `:``)+e)}else if(f&&typeof f==`object`&&!Array.isArray(f))s.push(v),u(f,`${h+l(p?m.empty:m.line,a.treeChar)} `,p,o+1);else if(Array.isArray(f))s.push(v+(y?`: `:v?` `:``)+`[Array(`+f.length+`)]`);else if(n){let e=l(typeof f==`function`?`[Function]`:String(f),a.value);v+=(y?`: `:v?` `:``)+e,s.push(v)}else s.push(v)})}let d=Object.keys(e);if(d.length===0)return l(`(empty)`,a.value);if(d.length===1&&d[0]!==void 0&&d[0].trim()===``&&typeof e[d[0]]==`string`){let t=d[0];return`${l(m.lastBranch,a.treeChar)} ${l(e[t],a.value)}`}return u(e,``,!0),s.join(`
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{n as t,t as n}from"./figures-5ThXQEtq.js";import{H as r,I as i,P as a,j as o,t as s}from"./src-DL3w8VPk.js";import{t as c}from"./jsx-runtime-Bb4Xn-E0.js";import{E as l,T as u}from"./config-BddEvZZl.js";function d(e,t,n,r){return r=typeof r==`function`?r:void 0,e==null?e:u(e,t,n,r)}var f=e((()=>{l()}));function p(e,t={}){let{showValues:n=!0,hideFunctions:r=!1,themeName:i=`dark`,treeCharColors:a={}}=t,s=[],c=new WeakSet;function l(e,t){return t?o(t,i)(e):e}function u(e,t,i,o=0){if(typeof e==`string`){s.push(t+l(e,a.value));return}if(typeof e!=`object`||!e){if(n){let n=String(e);s.push(t+l(n,a.value))}return}if(c.has(e)){s.push(t+l(`[Circular]`,a.value));return}c.add(e);let d=Object.keys(e).filter(t=>{let n=e[t];return!(r&&typeof n==`function`)});d.forEach((r,i)=>{let f=e[r],p=i===d.length-1,h=o===0&&i===0?``:t,g=l(p?m.lastBranch:m.branch,a.treeChar),_=r.trim()===``?``:l(r,a.key),v=h+g+(_?` ${_}`:``),y=r.trim()!==``;if(f&&typeof f==`object`&&c.has(f)){let e=l(`[Circular]`,a.value);s.push(v+(y?`: `:v?` `:``)+e)}else if(f&&typeof f==`object`&&!Array.isArray(f))s.push(v),u(f,`${h+l(p?m.empty:m.line,a.treeChar)} `,p,o+1);else if(Array.isArray(f))s.push(v+(y?`: `:v?` `:``)+`[Array(`+f.length+`)]`);else if(n){let e=l(typeof f==`function`?`[Function]`:String(f),a.value);v+=(y?`: `:v?` `:``)+e,s.push(v)}else s.push(v)})}let d=Object.keys(e);if(d.length===0)return l(`(empty)`,a.value);if(d.length===1&&d[0]!==void 0&&d[0].trim()===``&&typeof e[d[0]]==`string`){let t=d[0];return`${l(m.lastBranch,a.treeChar)} ${l(e[t],a.value)}`}return u(e,``,!0),s.join(`
2
2
  `)}var m,h=e((()=>{t(),s(),m={branch:n.lineUpDownRight,lastBranch:n.lineUpRight,line:n.lineVertical,empty:` `}}));function g(e){let t={};return e.forEach(e=>{if(!e.path){t[``]=e.message;return}let n=e.path.split(`.`),r=e.path;if(e.invalidValue!==null&&e.invalidValue!==void 0&&n.length>0){let t=[];for(let r=0;r<n.length;r++){let i=n[r];if(i)if(!isNaN(parseInt(i,10))&&r===n.length-1){let n;n=typeof e.invalidValue==`string`?`"${e.invalidValue}"`:e.invalidValue===null?`null`:e.invalidValue===void 0?`undefined`:String(e.invalidValue),t.push(n)}else t.push(i)}r=t.join(`.`)}d(t,r,e.message,Object)}),t}function _({errors:e}){let[t]=r();if(e.length===0)return null;let n=e.reduce((e,t)=>{let n=t.file||`(file not specified)`;return e[n]||(e[n]=[]),e[n].push(t),e},{});return(0,v.jsx)(i,{flexDirection:`column`,children:Object.keys(n).sort().map(e=>{let r=n[e]||[];r.sort((e,t)=>!e.path&&t.path?-1:e.path&&!t.path?1:(e.path||``).localeCompare(t.path||``));let o=g(r),s=new Map;r.forEach(e=>{if(e.suggestion||e.docLink){let t=`${e.suggestion||``}|${e.docLink||``}`;s.has(t)||s.set(t,{suggestion:e.suggestion,docLink:e.docLink})}});let c=p(o,{showValues:!0,themeName:t,treeCharColors:{treeChar:`inactive`,key:`text`,value:`inactive`}});return(0,v.jsxs)(i,{flexDirection:`column`,children:[(0,v.jsx)(a,{children:e}),(0,v.jsx)(i,{marginLeft:1,children:(0,v.jsx)(a,{dimColor:!0,children:c})}),s.size>0&&(0,v.jsx)(i,{flexDirection:`column`,marginTop:1,children:Array.from(s.values()).map((e,t)=>(0,v.jsxs)(i,{flexDirection:`column`,marginBottom:1,children:[e.suggestion&&(0,v.jsx)(a,{dimColor:!0,wrap:`wrap`,children:e.suggestion}),e.docLink&&(0,v.jsxs)(a,{dimColor:!0,wrap:`wrap`,children:[`Learn more: `,e.docLink]})]},`suggestion-pair-${t}`))})]},e)})})}var v,y=e((()=>{f(),s(),h(),v=c()}));export{y as n,_ as t};
@@ -0,0 +1 @@
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 +1 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{Ap as t,kp as n}from"./loadAgentsDir-C96o6gCj.js";import{cn as r,sn as i}from"./settings-BowI3jp-.js";function a(e,t){let n=new Map;for(let e of t)n.set(e.agentType,e);let r=new Set,i=[];for(let t of e){let e=`${t.agentType}:${t.source}`;if(r.has(e))continue;r.add(e);let a=n.get(t.agentType),o=a&&a.source!==t.source?a.source:void 0;i.push({...t,overriddenBy:o})}return i}function o(e){let t=e.model||n();if(t)return t===`inherit`?`inherit`:t}function s(e){return i(e).toLowerCase()}function c(e,t){return e.agentType.localeCompare(t.agentType,void 0,{sensitivity:`base`})}var l,u=e((()=>{t(),r(),l=[{label:`User agents`,source:`userSettings`},{label:`Project agents`,source:`projectSettings`},{label:`Local agents`,source:`localSettings`},{label:`Managed agents`,source:`policySettings`},{label:`Plugin agents`,source:`plugin`},{label:`CLI arg agents`,source:`flagSettings`},{label:`Built-in agents`,source:`built-in`}]}));export{o as a,u as i,c as n,a as o,s as r,l as t};
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{Md as t,jd as n}from"./loadAgentsDir-C1LkW7gl.js";import{hn as r,mn as i}from"./settings-DKN4xSpQ.js";function a(e,t){let n=new Map;for(let e of t)n.set(e.agentType,e);let r=new Set,i=[];for(let t of e){let e=`${t.agentType}:${t.source}`;if(r.has(e))continue;r.add(e);let a=n.get(t.agentType),o=a&&a.source!==t.source?a.source:void 0;i.push({...t,overriddenBy:o})}return i}function o(e){let t=e.model||n();if(t)return t===`inherit`?`inherit`:t}function s(e){return i(e).toLowerCase()}function c(e,t){return e.agentType.localeCompare(t.agentType,void 0,{sensitivity:`base`})}var l,u=e((()=>{t(),r(),l=[{label:`User agents`,source:`userSettings`},{label:`Project agents`,source:`projectSettings`},{label:`Local agents`,source:`localSettings`},{label:`Managed agents`,source:`policySettings`},{label:`Plugin agents`,source:`plugin`},{label:`CLI arg agents`,source:`flagSettings`},{label:`Built-in agents`,source:`built-in`}]}));export{o as a,u as i,c as n,a as o,s as r,l as t};
@@ -0,0 +1,101 @@
1
+ import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{i as n,o as r}from"./envUtils-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,2 +1,2 @@
1
- import{i as e,o as t,r as n}from"./loadAgentsDir-C96o6gCj.js";import{n as r,t as i}from"./cwd-Nh5IZNKO.js";import{a,i as o,n as s,o as c,r as l,t as u}from"./agentDisplay-1Y-N-gqz.js";o(),t(),r();function d(e){let t=a(e),n=[e.agentType];return t&&n.push(t),e.memory&&n.push(`${e.memory} memory`),n.join(` · `)}async function f(){let{allAgents:t}=await e(i()),r=c(t,n(t)),a=[],o=0;for(let{label:e,source:t}of u){let n=r.filter(e=>e.source===t).sort(s);if(n.length!==0){a.push(`${e}:`);for(let e of n)if(e.overriddenBy){let t=l(e.overriddenBy);a.push(` (shadowed by ${t}) ${d(e)}`)}else a.push(` ${d(e)}`),o++;a.push(``)}}a.length===0?console.log(`No agents found.`):(console.log(`${o} active agents\n`),console.log(a.join(`
1
+ import{i as e,o as t,r as n}from"./loadAgentsDir-C1LkW7gl.js";import{n as r,t as i}from"./cwd-BcO6WHKo.js";import{a,i as o,n as s,o as c,r as l,t as u}from"./agentDisplay-vLQHFrmq.js";o(),t(),r();function d(e){let t=a(e),n=[e.agentType];return t&&n.push(t),e.memory&&n.push(`${e.memory} memory`),n.join(` · `)}async function f(){let{allAgents:t}=await e(i()),r=c(t,n(t)),a=[],o=0;for(let{label:e,source:t}of u){let n=r.filter(e=>e.source===t).sort(s);if(n.length!==0){a.push(`${e}:`);for(let e of n)if(e.overriddenBy){let t=l(e.overriddenBy);a.push(` (shadowed by ${t}) ${d(e)}`)}else a.push(` ${d(e)}`),o++;a.push(``)}}a.length===0?console.log(`No agents found.`):(console.log(`${o} active agents\n`),console.log(a.join(`
2
2
  `).trimEnd()))}export{f as agentsHandler};
@@ -0,0 +1 @@
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};
@@ -0,0 +1 @@
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{c as t,m as n,v as r}from"./config-BddEvZZl.js";import{i,t as a}from"./execFileNoThrow-BsfuytkN.js";import{o,s}from"./log-DaILwWJa.js";import{homedir as c}from"os";import{join as l}from"path";import{stat as u}from"fs/promises";function d(e){r(t=>({...t,appleTerminalSetupInProgress:!0,appleTerminalBackupPath:e}))}function f(){r(e=>({...e,appleTerminalSetupInProgress:!1}))}function p(){let e=t();return{inProgress:e.appleTerminalSetupInProgress??!1,backupPath:e.appleTerminalBackupPath||null}}function m(){return l(c(),`Library`,`Preferences`,`com.apple.Terminal.plist`)}async function h(){let e=m(),t=`${e}.bak`;try{let{code:n}=await a(`defaults`,[`export`,`com.apple.Terminal`,e]);if(n!==0)return null;try{await u(e)}catch{return null}return await a(`defaults`,[`export`,`com.apple.Terminal`,t]),d(t),t}catch(e){return s(e),null}}async function g(){let{inProgress:e,backupPath:t}=p();if(!e)return{status:`no_backup`};if(!t)return f(),{status:`no_backup`};try{await u(t)}catch{return f(),{status:`no_backup`}}try{let{code:e}=await a(`defaults`,[`import`,`com.apple.Terminal`,t]);return e===0?(await a(`killall`,[`cfprefsd`]),f(),{status:`restored`}):{status:`failed`,backupPath:t}}catch(e){return s(Error(`Failed to restore Terminal.app settings with: ${e}`)),f(),{status:`failed`,backupPath:t}}}var _=e((()=>{n(),i(),o()}));export{f as a,_ as i,g as n,m as r,h as t};