@readmagic/workmate 0.0.21 → 0.0.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (493) hide show
  1. package/dist/chunks/AddWorkspaceDirectory-OgcBcK5A.js +1 -0
  2. package/dist/chunks/AgentsMdExternalIncludesDialog-CDNd5-7E.js +1 -0
  3. package/dist/chunks/AgentsMdExternalIncludesDialog-CNEifEyV.js +1 -0
  4. package/dist/chunks/App-B-3tPQ3k.js +1 -0
  5. package/dist/chunks/BackgroundTasksDialog-COuhHcey.js +2 -0
  6. package/dist/chunks/BypassPermissionsModeDialog-bJek4siJ.js +1 -0
  7. package/dist/chunks/CustomSelect-DoeEXOIP.js +1 -0
  8. package/dist/chunks/DiffDialog-B3X9FMpO.js +6 -0
  9. package/dist/chunks/Doctor-6PXyjIi6.js +3 -0
  10. package/dist/chunks/Doctor-DNgkgYhB.js +1 -0
  11. package/dist/chunks/ExitFlow-DgAZp_8U.js +2 -0
  12. package/dist/chunks/Grove-CHatOzcE.js +11 -0
  13. package/dist/chunks/InvalidConfigDialog-DXL92MN9.js +1 -0
  14. package/dist/chunks/InvalidSettingsDialog-Dtmpzeps.js +1 -0
  15. package/dist/chunks/KeybindingProviderSetup-DA37QUFs.js +1 -0
  16. package/dist/chunks/MCPConnectionManager-thZd-xA_.js +1 -0
  17. package/dist/chunks/MCPToolListView-CpY-YJg4.js +1 -0
  18. package/dist/chunks/{McpParsingWarnings-6ENzOklf.js → McpParsingWarnings-JvChf3xr.js} +1 -1
  19. package/dist/chunks/MessageSelector-C0_iw7SI.js +3 -0
  20. package/dist/chunks/Messages-K4DDsDP9.js +10 -0
  21. package/dist/chunks/Onboarding-C1UdzM-1.js +1 -0
  22. package/dist/chunks/{PromptInputFooterSuggestions-Blzgj5yW.js → PromptInputFooterSuggestions-AyLog8p7.js} +1 -1
  23. package/dist/chunks/PromptInputHelpMenu-oyic20ip.js +1 -0
  24. package/dist/chunks/ProviderSetup-XcBHjUnd.js +1 -0
  25. package/dist/chunks/QueryEngine-DYxBjJ4i.js +1 -0
  26. package/dist/chunks/REPL-CQBJRrT0.js +124 -0
  27. package/dist/chunks/REPL-CrVuMQY2.js +1 -0
  28. package/dist/chunks/ResumeConversation-Dl8H9Gfy.js +1 -0
  29. package/dist/chunks/SearchExtraToolsTool-lv7VE50N.js +1 -0
  30. package/dist/chunks/SelectMulti-Bc6l11_K.js +1 -0
  31. package/dist/chunks/Settings-TGp3fPrS.js +3 -0
  32. package/dist/chunks/Spinner-zYPFVFHN.js +1 -0
  33. package/dist/chunks/SpinnerGlyph-CmkRUvHe.js +1 -0
  34. package/dist/chunks/TextInput-CD9iau2k.js +22 -0
  35. package/dist/chunks/ThemePicker-0F0hZYPX.js +1 -0
  36. package/dist/chunks/TrustDialog-C76YiMKz.js +1 -0
  37. package/dist/chunks/{ValidationErrorsList-2QWIs_6h.js → ValidationErrorsList-DgNzJQUP.js} +1 -1
  38. package/dist/chunks/_baseEach-4ff-vRlp.js +1 -0
  39. package/dist/chunks/add-dir-JMsRLGfx.js +1 -0
  40. package/dist/chunks/{agentDisplay-1Y-N-gqz.js → agentDisplay-BReJUBWg.js} +1 -1
  41. package/dist/chunks/agents-9qQ8I6zW.js +101 -0
  42. package/dist/chunks/{agents-CvW8XjoJ.js → agents-B3x8yJ_r.js} +1 -1
  43. package/dist/chunks/allErrors-DfWylHSw.js +1 -0
  44. package/dist/chunks/appleTerminalBackup-BArZWB21.js +1 -0
  45. package/dist/chunks/backgroundHousekeeping-BGxHB_OX.js +1 -0
  46. package/dist/chunks/backgroundHousekeeping-CVNIhQg8.js +17 -0
  47. package/dist/chunks/banner-Cu2-XUek.js +2 -0
  48. package/dist/chunks/{bedrockClient-DxE_mHFI.js → bedrockClient-CfiDN-kF.js} +2 -2
  49. package/dist/chunks/branch-C4TsMEkx.js +2 -0
  50. package/dist/chunks/{break-cache-BZ_UMtEL.js → break-cache-BMXqFTeS.js} +2 -2
  51. package/dist/chunks/btw-Dn1eYFAz.js +1 -0
  52. package/dist/chunks/caches-BGzKwpnc.js +1 -0
  53. package/dist/chunks/caches-DArHxBgL.js +1 -0
  54. package/dist/chunks/claudeDesktop-D8ml2767.js +1 -0
  55. package/dist/chunks/{clear-D2KRoibg.js → clear-Bdhb6b39.js} +1 -1
  56. package/dist/chunks/{client-C_jBL1yC.js → client-4iqhC8xq.js} +1 -1
  57. package/dist/chunks/client-BiqbIkwr.js +1 -0
  58. package/dist/chunks/client-CZ8nyVh5.js +1 -0
  59. package/dist/chunks/client-CpTCeWba.js +1 -0
  60. package/dist/chunks/commands-QepeBbFn.js +1 -0
  61. package/dist/chunks/compact-Bu9BUpxV.js +2 -0
  62. package/dist/chunks/config-C-Y2qtB2.js +3 -0
  63. package/dist/chunks/config-D58C3_Lu.js +1 -0
  64. package/dist/chunks/config-DD8fCYXn.js +1 -0
  65. package/dist/chunks/{context-Db9tH1VF.js → context-CY_yfdYa.js} +1 -1
  66. package/dist/chunks/context-noninteractive-BDDi3NLF.js +1 -0
  67. package/dist/chunks/{context-noninteractive-CacA9VlT.js → context-noninteractive-Dd4xIoP1.js} +10 -10
  68. package/dist/chunks/conversation-B0wxBwzv.js +1 -0
  69. package/dist/chunks/conversation-DUu9qBnq.js +1 -0
  70. package/dist/chunks/conversationRecovery-2ft8sCPE.js +1 -0
  71. package/dist/chunks/crossProjectResume-6boHMUBx.js +40 -0
  72. package/dist/chunks/cwd-Dc3NV7s8.js +1 -0
  73. package/dist/chunks/cwd-Pa83R95t.js +1 -0
  74. package/dist/chunks/{datadog-BuElf2EQ.js → datadog-BPuGcxxC.js} +1 -1
  75. package/dist/chunks/{debug-D58GQBDG.js → debug-Bglx1aTu.js} +5 -5
  76. package/dist/chunks/detectRepository-CfX8Lc0A.js +1 -0
  77. package/dist/chunks/{diff-yA6v_dpP.js → diff-BOAElpfQ.js} +1 -1
  78. package/dist/chunks/directoryCompletion-D_Rtg-4j.js +1 -0
  79. package/dist/chunks/dist-es-B3-7VFf2.js +1 -0
  80. package/dist/chunks/dist-es-B7j_mv242.js +1 -0
  81. package/dist/chunks/dist-es-BSKD_hOQ.js +1 -0
  82. package/dist/chunks/dist-es-BSRN-2nA.js +9 -0
  83. package/dist/chunks/{dist-es-yHGBqhBe.js → dist-es-BXXmyhQ2.js} +1 -1
  84. package/dist/chunks/{dist-es-C3reqy7X.js → dist-es-BaQndfvh2.js} +1 -1
  85. package/dist/chunks/dist-es-CzTYn7xo.js +1 -0
  86. package/dist/chunks/dist-es-DSkyibcN.js +1 -0
  87. package/dist/chunks/{dist-es-BOPBJQo3.js → dist-es-_UNJQniz.js} +1 -1
  88. package/dist/chunks/dist-es-hwK6468D.js +1 -0
  89. package/dist/chunks/dist-es-ovsdbtwh.js +1 -0
  90. package/dist/chunks/doctor-CkLzqAMd.js +1 -0
  91. package/dist/chunks/entry-TNOoyy7_.js +13 -0
  92. package/dist/chunks/{envUtils-DcaKZlRU.js → envUtils-DfkgIdYf.js} +1 -1
  93. package/dist/chunks/esm-eTAUP-La.js +1 -0
  94. package/dist/chunks/{execFileNoThrow-B_KRY4cT.js → execFileNoThrow-BTachNBI.js} +1 -1
  95. package/dist/chunks/exit-DXApFJIP.js +1 -0
  96. package/dist/chunks/extraUsage-CmQaLPV1.js +1 -0
  97. package/dist/chunks/extractMemories-xP63mv6R.js +1 -0
  98. package/dist/chunks/fast-C5nQH8rm.js +1 -0
  99. package/dist/chunks/fast-eGx2IxD7.js +1 -0
  100. package/dist/chunks/fetchModelList-CxLsVNsu.js +1 -0
  101. package/dist/chunks/fetchModelList-D24lRIgR.js +1 -0
  102. package/dist/chunks/fileSuggestions-DHxdwq28.js +3 -0
  103. package/dist/chunks/firstPartyEventLogger-BVAogAX8.js +1 -0
  104. package/dist/chunks/firstPartyEventLogger-M6UMli2c.js +3 -0
  105. package/dist/chunks/gemini-D_ORb_L6.js +2 -0
  106. package/dist/chunks/generateSessionName-BQoDduyA.js +1 -0
  107. package/dist/chunks/{genericProcessUtils-Cnyun_Wr.js → genericProcessUtils-DwQFuna9.js} +1 -1
  108. package/dist/chunks/goal-D7c2mSds.js +3 -0
  109. package/dist/chunks/grok-B2-ZbUiR.js +1 -0
  110. package/dist/chunks/grove-O6qp7ITR.js +1 -0
  111. package/dist/chunks/help-CZJdRviD.js +1 -0
  112. package/dist/chunks/history-CQiUERTL.js +1 -0
  113. package/dist/chunks/hooks-BNuUlMzL.js +1 -0
  114. package/dist/chunks/{hooks-BDgToO1Z.js → hooks-DIvN6gdv.js} +3 -3
  115. package/dist/chunks/install-T_CV1Slu.js +1 -0
  116. package/dist/chunks/instrumentation-BjqUZ383.js +21 -0
  117. package/dist/chunks/{job-DYMfSglZ.js → job-R6c4-3c8.js} +1 -1
  118. package/dist/chunks/keybindings-CLRaiL_Z.js +1 -0
  119. package/dist/chunks/launchLocalMemory-DrbKrwXc.js +3 -0
  120. package/dist/chunks/{launchOnboarding-BeNf51Ig.js → launchOnboarding-tqsMD8ni.js} +1 -1
  121. package/dist/chunks/loadAgentsDir-CcmY8zCj.js +1 -0
  122. package/dist/chunks/loadAgentsDir-DlPbtIsS.js +3349 -0
  123. package/dist/chunks/loadPluginHooks-C_msxVIc.js +1 -0
  124. package/dist/chunks/{loader-C33o_5kS.js → loader-CICGtLp2.js} +1 -1
  125. package/dist/chunks/{localSearch-DLz5IGGu.js → localSearch-CK-sFzPm.js} +1 -1
  126. package/dist/chunks/localSearch-DrUj0B-d.js +1 -0
  127. package/dist/chunks/log-D2TIwHBV.js +1 -0
  128. package/dist/chunks/logoUtils-x2pHV-Nl.js +1 -0
  129. package/dist/chunks/{magicDocs-DmPNMnNY.js → magicDocs-BEF8D3if.js} +3 -3
  130. package/dist/chunks/main-kOVUGxOS.js +345 -0
  131. package/dist/chunks/managedEnv-BEqrGqn1.js +1 -0
  132. package/dist/chunks/managedEnv-OPlzUPbJ.js +1 -0
  133. package/dist/chunks/mcp-BNd29r6p.js +6 -0
  134. package/dist/chunks/mcp-D0wAJrRT.js +1 -0
  135. package/dist/chunks/mcp-mgOlm1cY.js +2 -0
  136. package/dist/chunks/memory-DDLk9_LJ.js +1 -0
  137. package/dist/chunks/mode-CcNsWgK3.js +2 -0
  138. package/dist/chunks/model-BwBG0V1u.js +1 -0
  139. package/dist/chunks/model-DzCP4K-9.js +1 -0
  140. package/dist/chunks/modelOptions-DRaG3bo0.js +1 -0
  141. package/dist/chunks/nativeInstaller-C3pVPqrZ.js +1 -0
  142. package/dist/chunks/notifications-4wP1Tx9Y.js +1 -0
  143. package/dist/chunks/onChangeAppState-BlaoFbYF.js +1 -0
  144. package/dist/chunks/openai-CDN71NdX.js +2 -0
  145. package/dist/chunks/overlayContext-BT2Lq8ei.js +1 -0
  146. package/dist/chunks/{panel-Cm23FDVt.js → panel-CVS4SK_E.js} +1 -1
  147. package/dist/chunks/parser-CG5RuOCK.js +1 -0
  148. package/dist/chunks/{parser-eVu-cTRs.js → parser-Cg6hSCmn.js} +1 -1
  149. package/dist/chunks/partition-CIl_ORUT.js +1 -0
  150. package/dist/chunks/pasteStore-P0zP-ch0.js +1 -0
  151. package/dist/chunks/permissions-zSNOZSwr.js +3 -0
  152. package/dist/chunks/pidLock-BTqO-h7Y.js +3 -0
  153. package/dist/chunks/{plan-s228H7IU.js → plan-Bs6em6lk.js} +1 -1
  154. package/dist/chunks/{platform-DMQxcm4K.js → platform-BacQ6ACS.js} +1 -1
  155. package/dist/chunks/plugin-DDDxjBa0.js +17 -0
  156. package/dist/chunks/pluginAutoupdate-8qugAFhb.js +1 -0
  157. package/dist/chunks/pluginBlocklist-q01ackCf.js +1 -0
  158. package/dist/chunks/pluginCliCommands-DXZfCZsv.js +1 -0
  159. package/dist/chunks/{pluginFlagging-BSLuTk3M.js → pluginFlagging-BG2MHCQJ.js} +1 -1
  160. package/dist/chunks/pluginOperations-hXYLrzM2.js +2 -0
  161. package/dist/chunks/{pluginStartupCheck-xQbHZ5gf.js → pluginStartupCheck-DTMa6TgL.js} +1 -1
  162. package/dist/chunks/pluginStartupCheck-HS1ZceZa.js +1 -0
  163. package/dist/chunks/plugins-COoGBYk6.js +4 -0
  164. package/dist/chunks/{poorMode-Bt_A2arj.js → poorMode-B0QGV6Ci.js} +1 -1
  165. package/dist/chunks/poorMode-G-pnu6NM.js +1 -0
  166. package/dist/chunks/print-BASybEtO.js +13 -0
  167. package/dist/chunks/processBashCommand-DDi_Pymt.js +1 -0
  168. package/dist/chunks/processSlashCommand-Cq9kaoSF.js +5 -0
  169. package/dist/chunks/{projectContext-Bw3o5BrN.js → projectContext-5fmRr6Sd.js} +1 -1
  170. package/dist/chunks/{projectContext-BN2ZWzOG.js → projectContext-DhtjLv3k.js} +1 -1
  171. package/dist/chunks/projectOnboardingState-B5YATuc6.js +1 -0
  172. package/dist/chunks/prompt-CHobfCB1.js +1 -0
  173. package/dist/chunks/prompt-CMm6RHHc.js +1 -0
  174. package/dist/chunks/{prompt-BNNE5tsG.js → prompt-mM79EGnT.js} +3 -3
  175. package/dist/chunks/promptEditor-DLGN_eLu.js +4 -0
  176. package/dist/chunks/{protocolHandler-DukQ6b4Q.js → protocolHandler-DjQALaU2.js} +2 -2
  177. package/dist/chunks/{proxy-BhIc7-mj.js → proxy-CDBfZjO7.js} +2 -2
  178. package/dist/chunks/reconciler-CeXqh95g.js +1 -0
  179. package/dist/chunks/refresh-Ce2yk28a.js +1 -0
  180. package/dist/chunks/registerProtocol-CAsDme_E.js +1 -0
  181. package/dist/chunks/reject-Bld5E-bn.js +1 -0
  182. package/dist/chunks/reload-plugins-C42xSB5l.js +1 -0
  183. package/dist/chunks/rename-CtBghpxZ.js +1 -0
  184. package/dist/chunks/{renderOptions-D-aQZbzS.js → renderOptions-DV0dn0IW.js} +1 -1
  185. package/dist/chunks/resume-BWkaTDqd.js +2 -0
  186. package/dist/chunks/ripgrep-DLs8MraF.js +1 -0
  187. package/dist/chunks/ripgrep-Dl3y5r4m.js +5 -0
  188. package/dist/chunks/{runtimeObserver-DS1PK6We.js → runtimeObserver-1wQO8HSZ.js} +1 -1
  189. package/dist/chunks/{runtimeObserver-CsZw5XBt.js → runtimeObserver-XQrOux41.js} +4 -4
  190. package/dist/chunks/sandbox-adapter-8GO6eJxw.js +1 -0
  191. package/dist/chunks/sandbox-toggle-Dir9Polo.js +1 -0
  192. package/dist/chunks/searchExtraTools-BhDq8DTJ.js +1 -0
  193. package/dist/chunks/select-Bxf5-5sI.js +1 -0
  194. package/dist/chunks/sessionFileAccessHooks-CozocHQE.js +1 -0
  195. package/dist/chunks/sessionObserver-DGEQM4cO.js +1 -0
  196. package/dist/chunks/{sessionObserver-N7fORFdL.js → sessionObserver-DS4G6mb9.js} +2 -2
  197. package/dist/chunks/sessionStorage-BcAscOGE.js +1 -0
  198. package/dist/chunks/sessionTracing-BoDDYLxW.js +11 -0
  199. package/dist/chunks/settings-B2jvL8Dp.js +24 -0
  200. package/dist/chunks/settings-CisDe8DB.js +1 -0
  201. package/dist/chunks/setup-BRypY6iT.js +3 -0
  202. package/dist/chunks/{shadowedRuleDetection-DEo1hvGi.js → shadowedRuleDetection-BRxZjobz.js} +1 -1
  203. package/dist/chunks/{sideQuestion-C11KgNGL.js → sideQuestion-DLJxyrlp.js} +3 -3
  204. package/dist/chunks/sinks-CGdKmq_8.js +1 -0
  205. package/dist/chunks/sinks-Cz2HfgMU.js +1 -0
  206. package/dist/chunks/skillChangeDetector-xviGstqm.js +1 -0
  207. package/dist/chunks/{skillGapStore-H4MkUFUY.js → skillGapStore-CKN_d3pO.js} +2 -2
  208. package/dist/chunks/{skillLifecycle-ADUTDK7D.js → skillLifecycle-BMY2JGGG.js} +2 -2
  209. package/dist/chunks/{skillSearchPanel-PpfVDMGR.js → skillSearchPanel-D9trHULQ.js} +4 -4
  210. package/dist/chunks/skills-CX_AvwLG.js +1 -0
  211. package/dist/chunks/startupProfiler-BH0FoI66.js +1 -0
  212. package/dist/chunks/startupProfiler-CJdr3SxP.js +3 -0
  213. package/dist/chunks/state-B4jiUise.js +1 -0
  214. package/dist/chunks/state-BhOKSFi5.js +1 -0
  215. package/dist/chunks/status-Daaak6Bo.js +1 -0
  216. package/dist/chunks/statusNoticeHelpers-vFVgIYuw.js +1 -0
  217. package/dist/chunks/stringUtils-C718f5ey.js +4 -0
  218. package/dist/chunks/sts-ei3CGBNu.js +1 -0
  219. package/dist/chunks/switcher-BpgmH4AI.js +1 -0
  220. package/dist/chunks/{switcher-DWfKi17X.js → switcher-CAajZeNL.js} +1 -1
  221. package/dist/chunks/{tasks-BwSsj2vI.js → tasks-BWNQr2d3.js} +1 -1
  222. package/dist/chunks/tempfile-CHO5wXsV.js +1 -0
  223. package/dist/chunks/{templateJobs-fiKuu4DK.js → templateJobs-gUET39Ho.js} +1 -1
  224. package/dist/chunks/terminalSetup-B_10N_gE.js +32 -0
  225. package/dist/chunks/{terminalSetup-Cte5a4hM.js → terminalSetup-qc2PlvOm.js} +1 -1
  226. package/dist/chunks/{theme-CAoGjf2D.js → theme-B7fKI6E5.js} +1 -1
  227. package/dist/chunks/tipRegistry-DamZr34w.js +2 -0
  228. package/dist/chunks/{toolEventObserver-Cq_ZV7x9.js → toolEventObserver-BL06sDI4.js} +1 -1
  229. package/dist/chunks/toolPool-CX5wDBi1.js +1 -0
  230. package/dist/chunks/types-Dx7P7JLQ.js +81 -0
  231. package/dist/chunks/udsClient-cQz6nJ_T.js +1 -0
  232. package/dist/chunks/use-select-navigation-BiUJdWai.js +1 -0
  233. package/dist/chunks/useDoublePress-C9xxQzh1.js +1 -0
  234. package/dist/chunks/useExitOnCtrlCDWithKeybindings-C9BYG8Bo.js +1 -0
  235. package/dist/chunks/useMainLoopModel-DwjSVzzO.js +1 -0
  236. package/dist/chunks/useManagePlugins-BqfIVa6E.js +1 -0
  237. package/dist/chunks/useMergedTools-Bw8FchX8.js +1 -0
  238. package/dist/chunks/useSearchInput-B25K1RnK.js +1 -0
  239. package/dist/chunks/useSettingsErrors-DYQ44kX4.js +1 -0
  240. package/dist/chunks/util-CtlC2dsN.js +1 -0
  241. package/dist/chunks/validatePlugin-D6tFo87L.js +1 -0
  242. package/dist/chunks/vim-CoRp9lY1.js +1 -0
  243. package/dist/chunks/worktree-B8apCnVe.js +1 -0
  244. package/dist/cli.js +1 -1
  245. package/package.json +1 -5
  246. package/dist/chunks/AddWorkspaceDirectory-DgAxYgBY.js +0 -1
  247. package/dist/chunks/AgentsMdExternalIncludesDialog-DGMRVexR.js +0 -1
  248. package/dist/chunks/AgentsMdExternalIncludesDialog-Dp6CwZyI.js +0 -1
  249. package/dist/chunks/App-VWyPd524.js +0 -1
  250. package/dist/chunks/ApproveApiKey-Bolw0sPs.js +0 -1
  251. package/dist/chunks/ApproveApiKey-CyNPMd6g.js +0 -1
  252. package/dist/chunks/BackgroundTasksDialog-DxagIOOw.js +0 -2
  253. package/dist/chunks/BypassPermissionsModeDialog-OS2S66zQ.js +0 -1
  254. package/dist/chunks/DiffDialog-CMtml9iw.js +0 -6
  255. package/dist/chunks/Doctor-Bk9P37mU.js +0 -1
  256. package/dist/chunks/Doctor-D9F3tKsr.js +0 -3
  257. package/dist/chunks/ExitFlow-DhRv5JPj.js +0 -2
  258. package/dist/chunks/Grove-Bbh8PpH0.js +0 -11
  259. package/dist/chunks/HybridTransport-P1vEUwhv.js +0 -2
  260. package/dist/chunks/InvalidConfigDialog-xAYpE-20.js +0 -1
  261. package/dist/chunks/InvalidSettingsDialog-CXFSISy3.js +0 -1
  262. package/dist/chunks/MCPConnectionManager-CoId-C__.js +0 -1
  263. package/dist/chunks/MCPToolListView-BQkQ-hyF.js +0 -1
  264. package/dist/chunks/MessageSelector-BvRVrfg6.js +0 -3
  265. package/dist/chunks/Messages-Cykztq1O.js +0 -10
  266. package/dist/chunks/Onboarding-CfeRwPNQ.js +0 -1
  267. package/dist/chunks/PromptInputHelpMenu-Ckp0k8E3.js +0 -1
  268. package/dist/chunks/QueryEngine-DduzztIG.js +0 -1
  269. package/dist/chunks/REPL-B8e5UU3H.js +0 -128
  270. package/dist/chunks/REPL-C4mbOhyL.js +0 -1
  271. package/dist/chunks/RemoteSessionManager-BPESC6Wu.js +0 -2
  272. package/dist/chunks/ResumeConversation-DG1sLryB.js +0 -1
  273. package/dist/chunks/SSETransport-CDNP2PlK.js +0 -2
  274. package/dist/chunks/SearchExtraToolsTool-vK2PP628.js +0 -1
  275. package/dist/chunks/Settings-B7n_dfP-.js +0 -2
  276. package/dist/chunks/TeleportProgress-QL3ibQfK.js +0 -1
  277. package/dist/chunks/TeleportRepoMismatchDialog-f-xl7biD.js +0 -1
  278. package/dist/chunks/TeleportResumeWrapper-DzVcrFuP.js +0 -1
  279. package/dist/chunks/ThemePicker-CIFKZza0.js +0 -1
  280. package/dist/chunks/TrustDialog-C0HEwZPk.js +0 -1
  281. package/dist/chunks/add-dir-DmEhPnvj.js +0 -1
  282. package/dist/chunks/agents-D96ng5I9.js +0 -101
  283. package/dist/chunks/allErrors-CT2dbBF3.js +0 -1
  284. package/dist/chunks/api-DTyrmy1O.js +0 -1
  285. package/dist/chunks/api-DumFOErN.js +0 -1
  286. package/dist/chunks/auth-CZ4EsFWF.js +0 -10
  287. package/dist/chunks/auth-QvonHoG9.js +0 -1
  288. package/dist/chunks/auth-jV5THRH8.js +0 -1
  289. package/dist/chunks/backgroundHousekeeping-C72oPgfD.js +0 -17
  290. package/dist/chunks/backgroundHousekeeping-D9PScHES.js +0 -1
  291. package/dist/chunks/banner-ChT5Ri7Q.js +0 -2
  292. package/dist/chunks/bg-qG2osBbP.js +0 -9
  293. package/dist/chunks/branch-K8X6jx0i.js +0 -2
  294. package/dist/chunks/bridgeConfig-C-bI-slm.js +0 -1
  295. package/dist/chunks/bridgeConfig-_xpxhGB5.js +0 -1
  296. package/dist/chunks/bridgeMessaging-DSJlYarJ.js +0 -1
  297. package/dist/chunks/bridgePointer-DfTOjgtX.js +0 -1
  298. package/dist/chunks/bridgeStatusUtil-DaEq5c69.js +0 -1
  299. package/dist/chunks/btw-BNs5OX7x.js +0 -1
  300. package/dist/chunks/bundledMode--fG1S62b.js +0 -1
  301. package/dist/chunks/caches-CC5NHwAz.js +0 -1
  302. package/dist/chunks/caches-nHxJWXgO.js +0 -1
  303. package/dist/chunks/capacityWake-BpP6c7x3.js +0 -3
  304. package/dist/chunks/ccrClient-JnhF5b3z.js +0 -1
  305. package/dist/chunks/claudeDesktop-DPc_SaVn.js +0 -1
  306. package/dist/chunks/cliLaunch-DDtwAolw.js +0 -1
  307. package/dist/chunks/client-9uHzAmFH.js +0 -1
  308. package/dist/chunks/client-BVal_QII.js +0 -1
  309. package/dist/chunks/client-BtTkq0YS.js +0 -1
  310. package/dist/chunks/client-Dd7CKMRX.js +0 -1
  311. package/dist/chunks/commands-C_rYjyQZ.js +0 -1
  312. package/dist/chunks/compact-Cqd6vKpn.js +0 -2
  313. package/dist/chunks/config-Be0BkAAr.js +0 -1
  314. package/dist/chunks/config-DUTgj3js.js +0 -3
  315. package/dist/chunks/config-DoEDgAfv.js +0 -1
  316. package/dist/chunks/context-noninteractive-D9tJYwi7.js +0 -1
  317. package/dist/chunks/controlMessageCompat-IFu4Gc1y.js +0 -1
  318. package/dist/chunks/conversation-DWfE4KGH.js +0 -1
  319. package/dist/chunks/conversation-Tvo4EDpQ.js +0 -1
  320. package/dist/chunks/createSSHSession-BQ83MMtr.js +0 -5
  321. package/dist/chunks/createSession-CqHnHhCR.js +0 -1
  322. package/dist/chunks/createSession-DqTtBycR.js +0 -1
  323. package/dist/chunks/crossProjectResume-DIXtiODF.js +0 -40
  324. package/dist/chunks/cwd-DLK3znO7.js +0 -1
  325. package/dist/chunks/cwd-Nh5IZNKO.js +0 -1
  326. package/dist/chunks/debugUtils-DXBRbwCE.js +0 -1
  327. package/dist/chunks/detached-Biz-xhu0.js +0 -4
  328. package/dist/chunks/detectRepository-DUJBh5s2.js +0 -1
  329. package/dist/chunks/detectRepository-pRAVv8SH.js +0 -1
  330. package/dist/chunks/directoryCompletion-CuA3_YIT.js +0 -1
  331. package/dist/chunks/dist-es-5t7v8oaj.js +0 -1
  332. package/dist/chunks/dist-es-BIjDeceU.js +0 -1
  333. package/dist/chunks/dist-es-C-OjW2Ao.js +0 -1
  334. package/dist/chunks/dist-es-CEk66gUu.js +0 -1
  335. package/dist/chunks/dist-es-CIULjvtA2.js +0 -1
  336. package/dist/chunks/dist-es-CMtO44xC.js +0 -1
  337. package/dist/chunks/dist-es-CYPVg66r.js +0 -9
  338. package/dist/chunks/dist-es-D1Y8zSMI.js +0 -1
  339. package/dist/chunks/dist-es-Gt_DpXlP.js +0 -1
  340. package/dist/chunks/dist-es-kj-F5A132.js +0 -1
  341. package/dist/chunks/doctor-eNAm6OiS.js +0 -1
  342. package/dist/chunks/entry-DidpiR-D.js +0 -13
  343. package/dist/chunks/esm-BCUC71kt.js +0 -1
  344. package/dist/chunks/execSyncWrapper-C3ZFV9od.js +0 -1
  345. package/dist/chunks/exit-DywUeiYd.js +0 -1
  346. package/dist/chunks/extraUsage-DiAirtuk.js +0 -1
  347. package/dist/chunks/extractMemories-_xiTnX95.js +0 -1
  348. package/dist/chunks/fast-DCXZACT9.js +0 -1
  349. package/dist/chunks/fast-Qo4WVqiW.js +0 -1
  350. package/dist/chunks/fetchModelList-fQDsmR3E.js +0 -1
  351. package/dist/chunks/fetchModelList-woVzIVde.js +0 -1
  352. package/dist/chunks/fileSuggestions-CRx1D6uk.js +0 -3
  353. package/dist/chunks/firstPartyEventLogger-B261Wksn.js +0 -3
  354. package/dist/chunks/firstPartyEventLogger-DtFTeHy-.js +0 -1
  355. package/dist/chunks/flushGate-BA8dSr0i.js +0 -1
  356. package/dist/chunks/gemini-BXAyy1JN.js +0 -1
  357. package/dist/chunks/generateSessionName-Cwmk2N3F.js +0 -1
  358. package/dist/chunks/git-Wid-XppW.js +0 -5
  359. package/dist/chunks/git-hO-TMvXc.js +0 -1
  360. package/dist/chunks/githubRepoPathMapping-OV8U1VFK.js +0 -1
  361. package/dist/chunks/goal-C9clrwEH.js +0 -3
  362. package/dist/chunks/grok-CjeCecsZ.js +0 -1
  363. package/dist/chunks/grove-DqTnK9nn.js +0 -7
  364. package/dist/chunks/hash-Tu-My5Vp.js +0 -1
  365. package/dist/chunks/help-Bb6LdzXK.js +0 -1
  366. package/dist/chunks/hooks-BX2s7aoL.js +0 -1
  367. package/dist/chunks/initReplBridge-D7cuY_os.js +0 -1
  368. package/dist/chunks/install-eCA8UACi.js +0 -1
  369. package/dist/chunks/instrumentation-BaRKojJh.js +0 -21
  370. package/dist/chunks/jwtUtils-JE2okZ70.js +0 -1
  371. package/dist/chunks/keybindings-iBqc1KHL.js +0 -1
  372. package/dist/chunks/launchLocalMemory-IZPGEzMk.js +0 -3
  373. package/dist/chunks/lazySchema-DULtBUCI.js +0 -65
  374. package/dist/chunks/lib-BlVGipXx.js +0 -14
  375. package/dist/chunks/loadAgentsDir-Bpke9CtB.js +0 -1
  376. package/dist/chunks/loadAgentsDir-C96o6gCj.js +0 -3422
  377. package/dist/chunks/loadPluginHooks-0nGlugZ4.js +0 -1
  378. package/dist/chunks/localSearch-dodgnjGn.js +0 -1
  379. package/dist/chunks/log-CZ7ploQm.js +0 -1
  380. package/dist/chunks/logoUtils-Cg_6QV1Z.js +0 -1
  381. package/dist/chunks/main-7ssnA9Yb.js +0 -31
  382. package/dist/chunks/main-BEv6MqMX.js +0 -356
  383. package/dist/chunks/managedEnv-CHYvwXBH.js +0 -1
  384. package/dist/chunks/managedEnv-CbjOQmEe.js +0 -1
  385. package/dist/chunks/mappers-D8VLUZ2N.js +0 -1
  386. package/dist/chunks/mcp-BUn3yqsT.js +0 -1
  387. package/dist/chunks/mcp-BskLq9iP.js +0 -2
  388. package/dist/chunks/mcp-C-0DMaXx.js +0 -6
  389. package/dist/chunks/memoize-CumjjK2Q.js +0 -1
  390. package/dist/chunks/memory-vDkJM58W.js +0 -1
  391. package/dist/chunks/mode-Dbh21H2Y.js +0 -2
  392. package/dist/chunks/model-BaMclMXn.js +0 -1
  393. package/dist/chunks/model-atn3_JBi.js +0 -1
  394. package/dist/chunks/model-vS1Iewyq.js +0 -1
  395. package/dist/chunks/modelOptions-Cw1ThINb.js +0 -1
  396. package/dist/chunks/nativeInstaller-CfZ5uNTh.js +0 -1
  397. package/dist/chunks/oauth-D38aRTUb.js +0 -1
  398. package/dist/chunks/oauth-U649LV5H.js +0 -1
  399. package/dist/chunks/omit-B7eQ9q0x.js +0 -1
  400. package/dist/chunks/onChangeAppState-kEAt8nxV.js +0 -1
  401. package/dist/chunks/openai-wh8AX5iz.js +0 -10
  402. package/dist/chunks/parser-Cq9X7HMP.js +0 -1
  403. package/dist/chunks/partition-CENvOfiS.js +0 -1
  404. package/dist/chunks/permissions-ChuIx-d4.js +0 -3
  405. package/dist/chunks/pidLock-C1hmh3YQ.js +0 -3
  406. package/dist/chunks/plugin-DVBEWwMP.js +0 -17
  407. package/dist/chunks/pluginAutoupdate-aLXhSUVD.js +0 -1
  408. package/dist/chunks/pluginBlocklist-BprCv0En.js +0 -1
  409. package/dist/chunks/pluginCliCommands-WzzqR1Sr.js +0 -1
  410. package/dist/chunks/pluginOperations-Ca9Lup5G.js +0 -2
  411. package/dist/chunks/pluginStartupCheck-DdtxcNwH.js +0 -1
  412. package/dist/chunks/plugins-DdIaXpNb.js +0 -4
  413. package/dist/chunks/pollConfig-2nFzv6Hy.js +0 -1
  414. package/dist/chunks/poorMode-ZIq2oz7q.js +0 -1
  415. package/dist/chunks/print-vxrRE1O2.js +0 -14
  416. package/dist/chunks/processBashCommand-ISucgwpi.js +0 -1
  417. package/dist/chunks/processSlashCommand-BnpXO_fI.js +0 -5
  418. package/dist/chunks/prompt-2AA5W7EH.js +0 -1
  419. package/dist/chunks/prompt-AXiS2LoO.js +0 -1
  420. package/dist/chunks/promptEditor-DT6egmcb.js +0 -4
  421. package/dist/chunks/rcDebugLog-DSchf3Hs.js +0 -1
  422. package/dist/chunks/reconciler-D3zyJCnV.js +0 -1
  423. package/dist/chunks/refresh-BSG0t4cf.js +0 -1
  424. package/dist/chunks/registerProtocol-BOEYaX-X.js +0 -1
  425. package/dist/chunks/reload-plugins-BFMRhbv8.js +0 -1
  426. package/dist/chunks/remoteBridgeCore-D5OwvmAz.js +0 -1
  427. package/dist/chunks/remoteManagedSettings-DyGVvvcW.js +0 -1
  428. package/dist/chunks/rename-BrEwj3Xw.js +0 -1
  429. package/dist/chunks/resume-DR5JbICs.js +0 -2
  430. package/dist/chunks/ripgrep-Dt4a91S5.js +0 -5
  431. package/dist/chunks/ripgrep-KTOU5s9J.js +0 -1
  432. package/dist/chunks/sandbox-adapter-BqDyWcol.js +0 -1
  433. package/dist/chunks/sandbox-toggle-B9f_0NQI.js +0 -1
  434. package/dist/chunks/searchExtraTools-2pIT2C8u.js +0 -1
  435. package/dist/chunks/session-wkRTfdo8.js +0 -2
  436. package/dist/chunks/sessionFileAccessHooks-DV22q9JO.js +0 -1
  437. package/dist/chunks/sessionIdCompat-Dgp6PW_1.js +0 -1
  438. package/dist/chunks/sessionObserver-BLJg0qm_.js +0 -1
  439. package/dist/chunks/sessionState-8jutEorw.js +0 -11
  440. package/dist/chunks/sessionStorage-DRV7IhZF.js +0 -1
  441. package/dist/chunks/sessionStoragePortable-x0Yn02-G.js +0 -3
  442. package/dist/chunks/sessionTracing-fIp8g04N.js +0 -11
  443. package/dist/chunks/settings-BowI3jp-.js +0 -19
  444. package/dist/chunks/settings-CHn0gJCG.js +0 -1
  445. package/dist/chunks/settingsSync-DF4JgSNc.js +0 -1
  446. package/dist/chunks/setup-UiEO9i7F.js +0 -3
  447. package/dist/chunks/shellQuote-Ddgr1vif.js +0 -4
  448. package/dist/chunks/sinks-DnLqRPEC.js +0 -1
  449. package/dist/chunks/sinks-mGBiINp8.js +0 -1
  450. package/dist/chunks/skillChangeDetector-Dc6YZXJE.js +0 -1
  451. package/dist/chunks/skills-DKtN17ch.js +0 -1
  452. package/dist/chunks/startupProfiler-B90b5vuq.js +0 -3
  453. package/dist/chunks/startupProfiler-DG2TN5R_.js +0 -1
  454. package/dist/chunks/state-BStOuCh4.js +0 -1
  455. package/dist/chunks/state-D5D6QpTX.js +0 -1
  456. package/dist/chunks/stats-D4LEtkrw.js +0 -1
  457. package/dist/chunks/status-0ZBx6Ls0.js +0 -2
  458. package/dist/chunks/status-BUJ4-omB.js +0 -1
  459. package/dist/chunks/statusNoticeHelpers-BrpQWj0l.js +0 -1
  460. package/dist/chunks/stringUtils-D7oJIyY2.js +0 -4
  461. package/dist/chunks/sts-C2Gf2WYN.js +0 -1
  462. package/dist/chunks/subprocessEnv-CNBOhlDV.js +0 -1
  463. package/dist/chunks/subprocessEnv-DtBCqQIo.js +0 -1
  464. package/dist/chunks/switcher-D7Ey5uIi.js +0 -1
  465. package/dist/chunks/syncCache-DUhciJLz.js +0 -1
  466. package/dist/chunks/teleport-DwZMevmQ.js +0 -1
  467. package/dist/chunks/terminalSetup-a7-BNS4T.js +0 -32
  468. package/dist/chunks/tmux-DA06aewY.js +0 -1
  469. package/dist/chunks/toolPool-mdsxlKWR.js +0 -1
  470. package/dist/chunks/trustedDevice-C1m--Yjw.js +0 -1
  471. package/dist/chunks/trustedDevice-CeDIk_ln.js +0 -1
  472. package/dist/chunks/types-APu4OCXJ.js +0 -17
  473. package/dist/chunks/udsClient-BcwsY0XE.js +0 -1
  474. package/dist/chunks/upstreamproxy-CTOuotLO.js +0 -10
  475. package/dist/chunks/useExitOnCtrlCDWithKeybindings-L5idX6Kz.js +0 -1
  476. package/dist/chunks/useMainLoopModel-VXeS2EC6.js +0 -1
  477. package/dist/chunks/useManagePlugins-CAXp5CfH.js +0 -1
  478. package/dist/chunks/useMergedTools-DYXrPTIA.js +0 -1
  479. package/dist/chunks/useSearchInput-Bxl4wGcZ.js +0 -1
  480. package/dist/chunks/useSettingsErrors-sbjsaT7k.js +0 -1
  481. package/dist/chunks/userAgent-NbKd-hN7.js +0 -1
  482. package/dist/chunks/util-DU63xTwZ.js +0 -1
  483. package/dist/chunks/validatePlugin-DQ_9OCpP.js +0 -1
  484. package/dist/chunks/vim-xruiCyUd.js +0 -1
  485. package/dist/chunks/which-B8rchd8P.js +0 -1
  486. package/dist/chunks/windowsPaths-BdhjMYTm.js +0 -1
  487. package/dist/chunks/windowsPaths-DtGZ83kH.js +0 -1
  488. package/dist/chunks/workSecret-CaM2yIJD.js +0 -1
  489. package/dist/chunks/workerRegistry-BBgquE8F.js +0 -2
  490. package/dist/chunks/worktree-C28I8mFB.js +0 -1
  491. /package/dist/chunks/{dist-es-Cgsa8pb82.js → dist-es-Cgsa8pb8.js} +0 -0
  492. /package/dist/chunks/{dist-es-Cwru7c2B2.js → dist-es-Cwru7c2B.js} +0 -0
  493. /package/dist/chunks/{dist-es-DXIR5NLi2.js → dist-es-DXIR5NLi.js} +0 -0
@@ -1 +0,0 @@
1
- import{t as e}from"./REPL-B8e5UU3H.js";export{e as REPL};
@@ -1,2 +0,0 @@
1
- import{n as e,t}from"./memoize-BK3gG5ob.js";import{n,t as r}from"./defineProperty-C-QyHrDq.js";import{$C as i,Oy as a,Sr as o,Ty as s,US as c,Uh as l,WS as u,Xa as ee,Yh as d,ZC as f,bT as p,br as te,do as ne,eo as re,po as ie,xT as m}from"./loadAgentsDir-C96o6gCj.js";import{di as ae,fi as h,j as g,t as _}from"./src-DL3w8VPk.js";import{n as v,t as y}from"./cwd-Nh5IZNKO.js";import{C as b,P as x,R as S,S as oe,c as C,i as w,x as se}from"./debug-D58GQBDG.js";import{Gt as T,Jt as E,d as D,h as ce,t as O}from"./settings-BowI3jp-.js";import{c as k,h as A,o as j,v as M,y as N}from"./config-DUTgj3js.js";import{f as P,l as F,m as I,p as L}from"./git-Wid-XppW.js";import{i as R,n as z}from"./execFileNoThrow-B_KRY4cT.js";import{o as B,s as V}from"./log-CZ7ploQm.js";import{i as H,o as U}from"./platform-DMQxcm4K.js";import{l as W,u as G}from"./oauth-D38aRTUb.js";import{$r as le,Ft as ue,Pt as de,ti as fe}from"./model-BaMclMXn.js";import{c as pe,h as me,l as he,m as K,s as ge}from"./proxy-BhIc7-mj.js";import{c as _e,i as ve}from"./terminalSetup-a7-BNS4T.js";import{l as ye,o as be}from"./api-DTyrmy1O.js";import{c as xe,u as Se}from"./firstPartyEventLogger-B261Wksn.js";import{randomUUID as Ce}from"crypto";t(),p(),v(),A(),E(),R(),I(),B(),Se();var we=[/(?:^|\/)(?:package-lock\.json|yarn\.lock|bun\.lock|bun\.lockb|pnpm-lock\.yaml|Pipfile\.lock|poetry\.lock|Cargo\.lock|Gemfile\.lock|go\.sum|composer\.lock|uv\.lock)$/,/\.generated\./,/(?:^|\/)(?:dist|build|out|target|node_modules|\.next|__pycache__)\//,/\.(?:min\.js|min\.css|map|pyc|pyo)$/,/\.(?:json|ya?ml|toml|xml|ini|cfg|conf|env|lock|txt|md|mdx|rst|csv|log|svg)$/i,/(?:^|\/)\.?(?:eslintrc|prettierrc|babelrc|editorconfig|gitignore|gitattributes|dockerignore|npmrc)/,/(?:^|\/)(?:tsconfig|jsconfig|biome|vitest\.config|jest\.config|webpack\.config|vite\.config|rollup\.config)\.[a-z]+$/,/(?:^|\/)\.(?:github|vscode|idea|claude)\//,/(?:^|\/)(?:CHANGELOG|LICENSE|CONTRIBUTING|CODEOWNERS|README)(?:\.[a-z]+)?$/i];function Te(e){return!we.some(t=>t.test(e))}function Ee(e,t){let n=[],r=new Set,i=new Map;for(let a=1;n.length<t&&a<=t;a++)for(let o of e){if(n.length>=t)break;if(!Te(o))continue;let e=Math.max(o.lastIndexOf(`/`),o.lastIndexOf(`\\`)),s=e>=0?o.slice(e+1):o;if(!s||r.has(s))continue;let c=e>=0?o.slice(0,e):`.`;(i.get(c)??0)>=a||(n.push(s),r.add(s),i.set(c,(i.get(c)??0)+1))}return n.length>=t?n:[]}async function De(){if(T.platform===`win32`||!await F())return[];try{let e=await xe(),t=[`log`,`-n`,`1000`,`--pretty=format:`,`--name-only`,`--diff-filter=M`],n=new Map,r=e=>{for(let t of e.split(`
2
- `)){let e=t.trim();e&&n.set(e,(n.get(e)??0)+1)}};if(e){let{stdout:n}=await z(`git`,[...t,`--author=${e}`],{cwd:y()});r(n)}if(n.size<10){let{stdout:e}=await z(L(),t,{cwd:y()});r(e)}return Ee(Array.from(n.entries()).sort((e,t)=>t[1]-e[1]).map(([e])=>e),5)}catch(e){return V(e),[]}}var Oe=10080*60*1e3,ke=e(()=>{let e=j(),t=e.exampleFiles?.length?m(e.exampleFiles):`<filepath>`;return`Try "${m([`fix lint errors`,`fix typecheck errors`,`how does ${t} work?`,`refactor ${t}`,`how do I log an error?`,`edit ${t} to...`,`write a test for ${t}`,`create a util logging.py that...`])}"`}),Ae=e(async()=>{let e=j();Date.now()-(e.exampleFilesGeneratedAt??0)>Oe&&(e.exampleFiles=[]),e.exampleFiles?.length||De().then(e=>{e.length&&M(t=>({...t,exampleFiles:e,exampleFilesGeneratedAt:Date.now()}))})});fe();var je={"claude-3-opus":{modelName:`Work Mate 3 Opus`,retirementDates:{firstParty:`January 5, 2026`,bedrock:`January 15, 2026`,vertex:`January 5, 2026`,foundry:`January 5, 2026`}},"claude-3-7-sonnet":{modelName:`Work Mate 3.7 Sonnet`,retirementDates:{firstParty:`February 19, 2026`,bedrock:`April 28, 2026`,vertex:`May 11, 2026`,foundry:`February 19, 2026`}},"claude-3-5-haiku":{modelName:`Work Mate 3.5 Haiku`,retirementDates:{firstParty:`February 19, 2026`,bedrock:null,vertex:null,foundry:null}}};function Me(e){let t=e.toLowerCase(),n=le();for(let[e,r]of Object.entries(je)){let i=r.retirementDates[n];if(!(!t.includes(e)||!i))return{isDeprecated:!0,modelName:r.modelName,retirementDate:i}}return{isDeprecated:!1}}function Ne(e){if(!e)return null;let t=Me(e);return t.isDeprecated?`⚠ ${t.modelName} will be retired on ${t.retirementDate}. Consider switching to a newer model.`:null}n(),h(),_(),S(),se(),w(),U(),G(),ce(),de(),i(),u(),a(),d(),ve(),ne(),ee(),te(),A();function Pe(e){let t=k().numStartups;N(n=>{let r=n.tipsHistory??{};return r[e]===t?n:{...n,tipsHistory:{...r,[e]:t}}})}function q(e){let t=k(),n=t.tipsHistory?.[e];return n?t.numStartups-n:1/0}A(),E(),I();var J;async function Fe(){return J===void 0&&(J=f in await ie()),J}async function Y(e,t,n){if(!await Fe()||re(`${e}@claude-plugins-official`))return!1;let{bashTools:r}=t??{};return!!(n.cli&&r?.size&&n.cli.some(e=>r.has(e))||n.filePath&&t?.readFileState&&s(t.readFileState).some(e=>n.filePath.test(e)))}var Ie=[{id:`new-user-warmup`,content:async()=>`Start with small features or bug fixes, tell Work Mate to propose a plan, and verify its suggested edits`,cooldownSessions:3,async isRelevant(){return k().numStartups<10}},{id:`plan-mode-for-complex-tasks`,content:async()=>`Use Plan Mode to prepare for a complex request before making changes. Press ${c(`chat:cycleMode`,`Chat`,`shift+tab`)} twice to enable.`,cooldownSessions:5,isRelevant:async()=>{let e=k();return(e.lastPlanModeUse?(Date.now()-e.lastPlanModeUse)/(1e3*60*60*24):1/0)>7}},{id:`default-permission-mode-config`,content:async()=>`Use /config to change your default permission mode (including Plan Mode)`,cooldownSessions:10,isRelevant:async()=>{try{let e=k(),t=D(),n=!!e.lastPlanModeUse,r=!!t?.permissions?.defaultMode;return n&&!r}catch(e){return C(`Failed to check default-permission-mode-config tip relevance: ${e}`,{level:`warn`}),!1}}},{id:`git-worktrees`,content:async()=>`Use git worktrees to run multiple Work Mate sessions in parallel.`,cooldownSessions:10,isRelevant:async()=>{try{let e=k();return await P()<=1&&e.numStartups>50}catch{return!1}}},{id:`terminal-setup`,content:async()=>T.terminal===`Apple_Terminal`?`Run /terminal-setup to enable convenient terminal integration like Option + Enter for new line and more`:`Run /terminal-setup to enable convenient terminal integration like Shift + Enter for new line and more`,cooldownSessions:10,async isRelevant(){let e=k();return T.terminal===`Apple_Terminal`?!e.optionAsMetaKeyInstalled:!e.shiftEnterKeyBindingInstalled}},{id:`shift-enter`,content:async()=>T.terminal===`Apple_Terminal`?`Press Option+Enter to send a multi-line message`:`Press Shift+Enter to send a multi-line message`,cooldownSessions:10,async isRelevant(){let e=k();return!!((T.terminal===`Apple_Terminal`?e.optionAsMetaKeyInstalled:e.shiftEnterKeyBindingInstalled)&&e.numStartups>3)}},{id:`shift-enter-setup`,content:async()=>T.terminal===`Apple_Terminal`?`Run /terminal-setup to enable Option+Enter for new lines`:`Run /terminal-setup to enable Shift+Enter for new lines`,cooldownSessions:10,async isRelevant(){if(!_e())return!1;let e=k();return!(T.terminal===`Apple_Terminal`?e.optionAsMetaKeyInstalled:e.shiftEnterKeyBindingInstalled)}},{id:`memory-command`,content:async()=>`Use /memory to view and manage Work Mate memory`,cooldownSessions:15,async isRelevant(){return k().memoryUsageCount<=0}},{id:`theme-command`,content:async()=>`Use /theme to change the color theme`,cooldownSessions:20,isRelevant:async()=>!0},{id:`colorterm-truecolor`,content:async()=>`Try setting environment variable COLORTERM=truecolor for richer colors`,cooldownSessions:30,isRelevant:async()=>!process.env.COLORTERM&&ae.level<3},{id:`powershell-tool-env`,content:async()=>`Set CLAUDE_CODE_USE_POWERSHELL_TOOL=1 to enable the PowerShell tool (preview)`,cooldownSessions:10,isRelevant:async()=>H()===`windows`&&process.env.CLAUDE_CODE_USE_POWERSHELL_TOOL===void 0},{id:`status-line`,content:async()=>`Use /statusline to set up a custom status line that will display beneath the input box`,cooldownSessions:25,isRelevant:async()=>D().statusLine===void 0},{id:`prompt-queue`,content:async()=>`Hit Enter to queue up additional messages while Work Mate is working.`,cooldownSessions:5,async isRelevant(){return k().promptQueueUseCount<=3}},{id:`enter-to-steer-in-relatime`,content:async()=>`Send messages to Work Mate while it works to steer Work Mate in real-time`,cooldownSessions:20,isRelevant:async()=>!0},{id:`todo-list`,content:async()=>`Ask Work Mate to create a todo list when working on complex tasks to track progress and remain on track`,cooldownSessions:20,isRelevant:async()=>!0},{id:`permissions`,content:async()=>`Use /permissions to pre-approve and pre-deny bash, edit, and MCP tools`,cooldownSessions:10,async isRelevant(){return k().numStartups>10}},{id:`drag-and-drop-images`,content:async()=>`Did you know you can drag and drop image files into your terminal?`,cooldownSessions:10,isRelevant:async()=>!T.isSSH()},{id:`paste-images-mac`,content:async()=>`Paste images into Work Mate using control+v (not cmd+v!)`,cooldownSessions:10,isRelevant:async()=>H()===`macos`},{id:`double-esc`,content:async()=>`Double-tap esc to rewind the conversation to a previous point in time`,cooldownSessions:10,isRelevant:async()=>!l()},{id:`double-esc-code-restore`,content:async()=>`Double-tap esc to rewind the code and/or conversation to a previous point in time`,cooldownSessions:10,isRelevant:async()=>l()},{id:`continue`,content:async()=>`Run claude --continue or claude --resume to resume a conversation`,cooldownSessions:10,isRelevant:async()=>!0},{id:`rename-conversation`,content:async()=>`Name your conversations with /rename to find them easily in /resume later`,cooldownSessions:15,isRelevant:async()=>o()&&k().numStartups>10},{id:`custom-commands`,content:async()=>`Create skills by adding .md files to .workmate/skills/ in your project or ~/.workmate/skills/ for skills that work in any project`,cooldownSessions:15,async isRelevant(){return k().numStartups>10}},{id:`shift-tab`,content:async()=>`Hit ${c(`chat:cycleMode`,`Chat`,`shift+tab`)} to cycle between default, accept edits, plan, auto, and bypass modes`,cooldownSessions:10,isRelevant:async()=>!0},{id:`image-paste`,content:async()=>`Use ${c(`chat:imagePaste`,`Chat`,`ctrl+v`)} to paste images from your clipboard`,cooldownSessions:20,isRelevant:async()=>!0},{id:`custom-agents`,content:async()=>`Use /agents to optimize specific tasks. Eg. Software Architect, Code Writer, Code Reviewer`,cooldownSessions:15,async isRelevant(){return k().numStartups>5}},{id:`agent-flag`,content:async()=>`Use --agent <agent_name> to directly start a conversation with a subagent`,cooldownSessions:15,async isRelevant(){return k().numStartups>5}},{id:`frontend-design-plugin`,content:async e=>`Working with HTML/CSS? Install the frontend-design plugin:\n${g(`suggestion`,e?.theme??`dark`)(`/plugin install frontend-design@${f}`)}`,cooldownSessions:3,isRelevant:async e=>Y(`frontend-design`,e,{filePath:/\.(html|css|htm)$/i})},{id:`vercel-plugin`,content:async e=>`Working with Vercel? Install the vercel plugin:\n${g(`suggestion`,e?.theme??`dark`)(`/plugin install vercel@${f}`)}`,cooldownSessions:3,isRelevant:async e=>Y(`vercel`,e,{filePath:/(?:^|[/\\])vercel\.json$/i,cli:[`vercel`]})},{id:`subagent-fanout-nudge`,content:async e=>`Say ${g(`suggestion`,e?.theme??`dark`)(`"fan out subagents"`)} and Work Mate sends a team. Each one digs deep so nothing gets missed.`,cooldownSessions:3,isRelevant:async()=>(ue(),!1)}],Le=[];function X(){let e=O().spinnerTipsOverride;return e?.tips?.length?e.tips.map((e,t)=>({id:`custom-tip-${t}`,content:async()=>e,cooldownSessions:0,isRelevant:async()=>!0})):[]}async function Re(e){let t=O().spinnerTipsOverride,n=X();if(t?.excludeDefault&&n.length>0)return n;let r=[...Ie,...Le],i=await Promise.all(r.map(t=>t.isRelevant?.(e)??Promise.resolve(!0)));return[...r.filter((e,t)=>i[t]).filter(e=>q(e.id)>=e.cooldownSessions),...n]}be(),w(),B(),me(),he();var Z=2e3,Q=5,ze=3e4,$=3,Be=new Set([4003]);function Ve(e){return typeof e!=`object`||!e||!(`type`in e)?!1:typeof e.type==`string`}var He=class{constructor(e,t,n,i){r(this,`sessionId`,void 0),r(this,`orgUuid`,void 0),r(this,`getAccessToken`,void 0),r(this,`callbacks`,void 0),r(this,`ws`,null),r(this,`state`,`closed`),r(this,`reconnectAttempts`,0),r(this,`sessionNotFoundRetries`,0),r(this,`pingInterval`,null),r(this,`reconnectTimer`,null),this.sessionId=e,this.orgUuid=t,this.getAccessToken=n,this.callbacks=i}async connect(){if(this.state===`connecting`){C(`[SessionsWebSocket] Already connecting`);return}this.state=`connecting`;let e=`${W().BASE_API_URL.replace(`http`,`ws`)}/v1/sessions/ws/${this.sessionId}/subscribe?organization_uuid=${this.orgUuid}`;C(`[SessionsWebSocket] Connecting to ${e}`);let t={Authorization:`Bearer ${this.getAccessToken()}`,"anthropic-version":`2023-06-01`};if(typeof Bun<`u`){let n=new globalThis.WebSocket(e,{headers:t,proxy:pe(e),tls:K()||void 0});this.ws=n,n.addEventListener(`open`,()=>{C(`[SessionsWebSocket] Connection opened, authenticated via headers`),this.state=`connected`,this.reconnectAttempts=0,this.sessionNotFoundRetries=0,this.startPingInterval(),this.callbacks.onConnected?.()}),n.addEventListener(`message`,e=>{let t=typeof e.data==`string`?e.data:String(e.data);this.handleMessage(t)}),n.addEventListener(`error`,()=>{let e=Error(`[SessionsWebSocket] WebSocket error`);V(e),this.callbacks.onError?.(e)}),n.addEventListener(`close`,e=>{C(`[SessionsWebSocket] Closed: code=${e.code} reason=${e.reason}`),this.handleClose(e.code)}),n.addEventListener(`pong`,()=>{C(`[SessionsWebSocket] Pong received`)})}else{let{default:n}=await import(`./wrapper-K8ZapJVu.js`),r=new n(e,{headers:t,agent:ge(e),...K()});this.ws=r,r.on(`open`,()=>{C(`[SessionsWebSocket] Connection opened, authenticated via headers`),this.state=`connected`,this.reconnectAttempts=0,this.sessionNotFoundRetries=0,this.startPingInterval(),this.callbacks.onConnected?.()}),r.on(`message`,e=>{this.handleMessage(e.toString())}),r.on(`error`,e=>{V(Error(`[SessionsWebSocket] Error: ${e.message}`)),this.callbacks.onError?.(e)}),r.on(`close`,(e,t)=>{C(`[SessionsWebSocket] Closed: code=${e} reason=${t.toString()}`),this.handleClose(e)}),r.on(`pong`,()=>{C(`[SessionsWebSocket] Pong received`)})}}handleMessage(e){try{let t=oe(e);Ve(t)?this.callbacks.onMessage(t):C(`[SessionsWebSocket] Ignoring message type: ${typeof t==`object`&&t&&`type`in t?String(t.type):`unknown`}`)}catch(e){V(Error(`[SessionsWebSocket] Failed to parse message: ${x(e)}`))}}handleClose(e){if(this.stopPingInterval(),this.state===`closed`)return;this.ws=null;let t=this.state;if(this.state=`closed`,Be.has(e)){C(`[SessionsWebSocket] Permanent close code ${e}, not reconnecting`),this.callbacks.onClose?.();return}if(e===4001){if(this.sessionNotFoundRetries++,this.sessionNotFoundRetries>$){C(`[SessionsWebSocket] 4001 retry budget exhausted (${$}), not reconnecting`),this.callbacks.onClose?.();return}this.scheduleReconnect(Z*this.sessionNotFoundRetries,`4001 attempt ${this.sessionNotFoundRetries}/${$}`);return}t===`connected`&&this.reconnectAttempts<Q?(this.reconnectAttempts++,this.scheduleReconnect(Z,`attempt ${this.reconnectAttempts}/${Q}`)):(C(`[SessionsWebSocket] Not reconnecting`),this.callbacks.onClose?.())}scheduleReconnect(e,t){this.callbacks.onReconnecting?.(),C(`[SessionsWebSocket] Scheduling reconnect (${t}) in ${e}ms`),this.reconnectTimer=setTimeout(()=>{this.reconnectTimer=null,this.connect()},e)}startPingInterval(){this.stopPingInterval(),this.pingInterval=setInterval(()=>{if(this.ws&&this.state===`connected`)try{this.ws.ping?.()}catch{}},ze)}stopPingInterval(){this.pingInterval&&(clearInterval(this.pingInterval),this.pingInterval=null)}sendControlResponse(e){if(!this.ws||this.state!==`connected`){V(Error(`[SessionsWebSocket] Cannot send: not connected`));return}C(`[SessionsWebSocket] Sending control response`),this.ws.send(b(e))}sendControlRequest(e){if(!this.ws||this.state!==`connected`){V(Error(`[SessionsWebSocket] Cannot send: not connected`));return}let t={type:`control_request`,request_id:Ce(),request:e};C(`[SessionsWebSocket] Sending control request: ${e.subtype}`),this.ws.send(b(t))}isConnected(){return this.state===`connected`}close(){C(`[SessionsWebSocket] Closing connection`),this.state=`closed`,this.stopPingInterval(),this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null),this.ws&&(this.ws.close(),this.ws=null)}reconnect(){C(`[SessionsWebSocket] Force reconnecting`),this.reconnectAttempts=0,this.sessionNotFoundRetries=0,this.close(),this.reconnectTimer=setTimeout(()=>{this.reconnectTimer=null,this.connect()},500)}};w(),B(),n();function Ue(e){return e.type!==`control_request`&&e.type!==`control_response`&&e.type!==`control_cancel_request`}var We=class{constructor(e,t){r(this,`config`,void 0),r(this,`callbacks`,void 0),r(this,`websocket`,null),r(this,`pendingPermissionRequests`,new Map),this.config=e,this.callbacks=t}connect(){C(`[RemoteSessionManager] Connecting to session ${this.config.sessionId}`);let e={onMessage:e=>this.handleMessage(e),onConnected:()=>{C(`[RemoteSessionManager] Connected`),this.callbacks.onConnected?.()},onClose:()=>{C(`[RemoteSessionManager] Disconnected`),this.callbacks.onDisconnected?.()},onReconnecting:()=>{C(`[RemoteSessionManager] Reconnecting`),this.callbacks.onReconnecting?.()},onError:e=>{V(e),this.callbacks.onError?.(e)}};this.websocket=new He(this.config.sessionId,this.config.orgUuid,this.config.getAccessToken,e),this.websocket.connect()}handleMessage(e){if(e.type===`control_request`){this.handleControlRequest(e);return}if(e.type===`control_cancel_request`){let{request_id:t}=e,n=this.pendingPermissionRequests.get(t);C(`[RemoteSessionManager] Permission request cancelled: ${t}`),this.pendingPermissionRequests.delete(t),this.callbacks.onPermissionCancelled?.(t,n?.tool_use_id);return}if(e.type===`control_response`){C(`[RemoteSessionManager] Received control response`);return}Ue(e)&&this.callbacks.onMessage(e)}handleControlRequest(e){let t=e.request_id,n=e.request;if(n.subtype===`can_use_tool`)C(`[RemoteSessionManager] Permission request for tool: ${n.tool_name}`),this.pendingPermissionRequests.set(t,n),this.callbacks.onPermissionRequest(n,t);else{C(`[RemoteSessionManager] Unsupported control request subtype: ${n.subtype}`);let e={type:`control_response`,response:{subtype:`error`,request_id:t,error:`Unsupported control request subtype: ${n.subtype}`}};this.websocket?.sendControlResponse(e)}}async sendMessage(e,t){C(`[RemoteSessionManager] Sending message to session ${this.config.sessionId}`);let n=await ye(this.config.sessionId,e,t);return n||V(Error(`[RemoteSessionManager] Failed to send message to session ${this.config.sessionId}`)),n}respondToPermissionRequest(e,t){if(!this.pendingPermissionRequests.get(e)){V(Error(`[RemoteSessionManager] No pending permission request with ID: ${e}`));return}this.pendingPermissionRequests.delete(e);let n={type:`control_response`,response:{subtype:`success`,request_id:e,response:{behavior:t.behavior,...t.behavior===`allow`?{updatedInput:t.updatedInput}:{message:t.message}}}};C(`[RemoteSessionManager] Sending permission response: ${t.behavior}`),this.websocket?.sendControlResponse(n)}isConnected(){return this.websocket?.isConnected()??!1}cancelSession(){C(`[RemoteSessionManager] Sending interrupt signal`),this.websocket?.sendControlRequest({subtype:`interrupt`})}getSessionId(){return this.config.sessionId}disconnect(){C(`[RemoteSessionManager] Disconnecting`),this.websocket?.close(),this.websocket=null,this.pendingPermissionRequests.clear()}reconnect(){C(`[RemoteSessionManager] Reconnecting WebSocket`),this.websocket?.reconnect()}};function Ge(e,t,n,r=!1,i=!1){return{sessionId:e,getAccessToken:t,orgUuid:n,hasInitialPrompt:r,viewerOnly:i}}export{Pe as a,Ae as c,q as i,Ge as n,Ne as o,Re as r,ke as s,We as t};
@@ -1 +0,0 @@
1
- import{o as e}from"./rolldown-runtime-DaDcL9Zw.js";import{$l as t,Eh as n,GS as r,Ir as i,Oh as a,Rn as ee,Sr as o,Th as s,Wr as te,Ws as c,Yn as ne,Ys as l,br as u,cy as d,dg as f,eu as p,fg as m,jr as re,lu as h,ly as ie,ni as ae,su as g,ti as oe,zS as _}from"./loadAgentsDir-C96o6gCj.js";import{I as v,P as y,Wt as b,ai as x,dr as S,ot as se,t as C}from"./src-DL3w8VPk.js";import{t as w}from"./jsx-runtime-Bb4Xn-E0.js";import{Ut as T,ar as ce}from"./state-D5D6QpTX.js";import{o as E,s as D}from"./log-CZ7ploQm.js";import{n as O,r as k}from"./analytics-DJobLaWP.js";import{a as le,n as ue,s as de}from"./skillChangeDetector-Dc6YZXJE.js";import{t as fe}from"./REPL-B8e5UU3H.js";import{a as A,i as j,n as M,o as N,r as P,t as F}from"./crossProjectResume-DIXtiODF.js";import{dirname as I}from"path";var L=e(x(),1);r(),T(),N(),h(),d(),C(),_(),O(),s(),m(),j(),c(),t(),M(),E(),u();var R=w();function z(e){let t=parseInt(e,10);if(!isNaN(t)&&t>0)return t;let n=e.match(/github\.com\/[^/]+\/[^/]+\/pull\/(\d+)/);return n?.[1]?parseInt(n[1],10):null}function B({commands:e,worktreePaths:t,initialTools:r,mcpClients:s,dynamicMcpConfig:c,debug:u,mainThreadAgentDefinition:d,autoConnectIdeFlag:m,strictMcpConfig:h=!1,systemPrompt:_,appendSystemPrompt:b,initialSearchQuery:x,disableSlashCommands:C=!1,forkSession:w,taskListId:T,filterByPr:E,thinkingConfig:O,onTurnComplete:j}){let{rows:M}=se(),N=n(e=>e.agentDefinitions),B=a(),[H,U]=L.useState([]),[me,W]=L.useState(!0),[he,ge]=L.useState(!1),[G,_e]=L.useState(!1),[K,ve]=L.useState(null),[q,J]=L.useState(null),Y=L.useRef(null),X=L.useRef(0),Z=L.useMemo(()=>{let e=H.filter(e=>!e.isSidechain);if(E!==void 0){if(E===!0)e=e.filter(e=>e.prNumber!==void 0);else if(typeof E==`number`)e=e.filter(e=>e.prNumber===E);else if(typeof E==`string`){let t=z(E);t!==null&&(e=e.filter(e=>e.prNumber===t))}}return e},[H,E]),ye=o();L.useEffect(()=>{i(t).then(e=>{Y.current=e,X.current=e.logs.length,U(e.logs),W(!1)}).catch(e=>{D(e),W(!1)})},[t]);let Q=L.useCallback(e=>{let t=Y.current;!t||t.nextIndex>=t.allStatLogs.length||ne(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}),U(e=>e.concat(n.logs)),X.current+=n.logs.length}else t.nextIndex<t.allStatLogs.length&&Q(e)})},[]),$=L.useCallback(e=>{W(!0),(e?re():i(t)).then(e=>{Y.current=e,X.current=e.logs.length,U(e.logs)}).catch(e=>{D(e)}).finally(()=>{W(!1)})},[t]),be=L.useCallback(()=>{let e=!G;_e(e),$(e)},[G,$]);function xe(){process.exit(1)}async function Se(e){ge(!0);let t=performance.now(),n=F(e,G);if(n.isCrossProject&&!n.isSameRepoWorktree){let e=n.command,t=await S(e);t&&process.stdout.write(t),J(e);return}try{let n=await p(e,void 0);if(!n)throw Error(`Failed to load conversation`);n.sessionId&&!w?(ce(f(n.sessionId),e.fullPath?I(e.fullPath):null),await oe(),ie(n.sessionId)):w&&n.contentReplacements?.length&&await te(n.contentReplacements);let{agentDefinition:r}=le(n.agentSetting,d,N);B(e=>({...e,agent:r?.agentType}));let i=ue(n.agentName,n.agentColor);i&&B(e=>({...e,standaloneAgentContext:i})),l(n.agentName),ae(w?{...n,worktreeSession:void 0}:n),w||(de(n.worktreeSession),n.sessionId&&ee()),k(`tengu_session_resumed`,{entrypoint:`picker`,success:!0,resume_duration_ms:Math.round(performance.now()-t)}),U([]),ve({messages:n.messages,fileHistorySnapshots:n.fileHistorySnapshots,contentReplacements:n.contentReplacements,agentName:n.agentName,agentColor:n.agentColor==="default"?void 0:n.agentColor,mainThreadAgentDefinition:r})}catch(e){throw k(`tengu_session_resumed`,{entrypoint:`picker`,success:!1}),D(e),e}}return q?(0,R.jsx)(pe,{command:q}):K?(0,R.jsx)(fe,{debug:u,commands:e,initialTools:r,initialMessages:K.messages,initialFileHistorySnapshots:K.fileHistorySnapshots,initialContentReplacements:K.contentReplacements,initialAgentName:K.agentName,initialAgentColor:K.agentColor,mcpClients:s,dynamicMcpConfig:c,strictMcpConfig:h,systemPrompt:_,appendSystemPrompt:b,mainThreadAgentDefinition:K.mainThreadAgentDefinition,autoConnectIdeFlag:m,disableSlashCommands:C,taskListId:T,thinkingConfig:O,onTurnComplete:j}):me?(0,R.jsxs)(v,{children:[(0,R.jsx)(g,{}),(0,R.jsx)(y,{children:` Loading conversations…`})]}):he?(0,R.jsxs)(v,{children:[(0,R.jsx)(g,{}),(0,R.jsx)(y,{children:` Resuming conversation…`})]}):Z.length===0?(0,R.jsx)(V,{}):(0,R.jsx)(A,{logs:Z,maxHeight:M,onCancel:xe,onSelect:Se,onLogsChanged:ye?()=>$(G):void 0,onLoadMore:Q,initialSearchQuery:x,showAllProjects:G,onToggleAllProjects:be,onAgenticSearch:P})}function V(){return b(`app:interrupt`,()=>{process.exit(1)},{context:`Global`}),(0,R.jsxs)(v,{flexDirection:`column`,children:[(0,R.jsx)(y,{children:`No conversations found to resume.`}),(0,R.jsx)(y,{dimColor:!0,children:`Press Ctrl+C to exit and start a new conversation.`})]})}function pe({command:e}){return L.useEffect(()=>{let e=setTimeout(()=>{process.exit(0)},100);return()=>clearTimeout(e)},[]),(0,R.jsxs)(v,{flexDirection:`column`,gap:1,children:[(0,R.jsx)(y,{children:`This conversation is from a different directory.`}),(0,R.jsxs)(v,{flexDirection:`column`,children:[(0,R.jsx)(y,{children:`To resume, run:`}),(0,R.jsxs)(y,{children:[` `,e]})]}),(0,R.jsx)(y,{dimColor:!0,children:`(Command copied to clipboard)`})]})}export{B as ResumeConversation};
@@ -1,2 +0,0 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{n as t,t as n}from"./defineProperty-C-QyHrDq.js";import{n as r,t as i}from"./axios-DaWTGg7G.js";import{C as a,P as o,R as s,S as c,c as l,i as u,x as d}from"./debug-D58GQBDG.js";import{O as f,k as p}from"./git-Wid-XppW.js";import{dn as m,fn as h}from"./model-BaMclMXn.js";import{n as g,t as _}from"./userAgent-NbKd-hN7.js";import{C as v,x as y}from"./sessionState-8jutEorw.js";import{n as b,t as x}from"./rcDebugLog-DSchf3Hs.js";function S(){return!0}function C(e){let t=[],n=0,r=/\r?\n\r?\n/g;r.lastIndex=n;let i;for(;(i=r.exec(e))!==null;){let r=i.index,a=e.slice(n,r);if(n=r+i[0].length,!a.trim())continue;let o={},s=!1;for(let e of a.split(`
2
- `)){let t=e[e.length-1]===`\r`?e.slice(0,-1):e;if(t.startsWith(`:`)){s=!0;continue}let n=t.indexOf(`:`);if(n===-1)continue;let r=t.slice(0,n),i=t[n+1]===` `?t.slice(n+2):t.slice(n+1);switch(r){case`event`:o.event=i;break;case`id`:o.id=i;break;case`data`:o.data=o.data?`${o.data}\n${i}`:i;break}}(o.data||s)&&t.push(o)}return{frames:t,remaining:e.slice(n)}}function w(e){let t=e.pathname;return t.endsWith(`/stream`)&&(t=t.slice(0,-7)),`${e.protocol}//${e.host}${t}`}var T,E,D,O,k,A,j,M,N,P,F=e((()=>{i(),u(),x(),f(),s(),v(),m(),d(),g(),t(),T=1e3,E=3e4,D=6e5,O=45e3,k=new Set([401,403,404]),A=10,j=500,M=8e3,N={stream:!0},P=class{constructor(e,t={},r,i,a,o){n(this,`url`,void 0),n(this,`state`,`idle`),n(this,`onData`,void 0),n(this,`onCloseCallback`,void 0),n(this,`onEventCallback`,void 0),n(this,`headers`,void 0),n(this,`sessionId`,void 0),n(this,`refreshHeaders`,void 0),n(this,`getAuthHeaders`,void 0),n(this,`abortController`,null),n(this,`lastSequenceNum`,0),n(this,`seenSequenceNums`,new Set),n(this,`reconnectAttempts`,0),n(this,`reconnectStartTime`,null),n(this,`reconnectTimer`,null),n(this,`livenessTimer`,null),n(this,`lastActivityTime`,0),n(this,`postUrl`,void 0),n(this,`onLivenessTimeout`,()=>{this.livenessTimer=null,b(`SSE liveness timeout (${O}ms) lastSeqNum=${this.getLastSequenceNum()} state=${this.state}`),l(`SSETransport: Liveness timeout, reconnecting`,{level:`error`}),p(`error`,`cli_sse_liveness_timeout`),this.abortController?.abort(),this.handleConnectionError()}),this.url=e,this.headers=t,this.sessionId=r,this.refreshHeaders=i,this.getAuthHeaders=o??y,this.postUrl=w(e),a!==void 0&&a>0&&(this.lastSequenceNum=a),l(`SSETransport: SSE URL = ${e.href}`),l(`SSETransport: POST URL = ${this.postUrl}`),p(`info`,`cli_sse_transport_initialized`)}getLastSequenceNum(){return this.lastSequenceNum}async connect(){if(this.state!==`idle`&&this.state!==`reconnecting`){l(`SSETransport: Cannot connect, current state is ${this.state}`,{level:`error`}),p(`error`,`cli_sse_connect_failed`);return}this.state=`reconnecting`;let e=Date.now(),t=new URL(this.url.href);this.lastSequenceNum>0&&t.searchParams.set(`from_sequence_num`,String(this.lastSequenceNum));let n=this.getAuthHeaders(),r={...this.headers,...n,Accept:`text/event-stream`,"anthropic-version":`2023-06-01`,"User-Agent":_()};n.Cookie&&delete r.Authorization,this.lastSequenceNum>0&&(r[`Last-Event-ID`]=String(this.lastSequenceNum)),l(`SSETransport: Opening ${t.href}`),p(`info`,`cli_sse_connect_opening`),this.abortController=new AbortController;try{let n=await fetch(t.href,{headers:r,signal:this.abortController.signal});if(!n.ok){let e=k.has(n.status);if(l(`SSETransport: HTTP ${n.status}${e?` (permanent)`:``}`,{level:`error`}),p(`error`,`cli_sse_connect_http_error`,{status:n.status}),e){this.state=`closed`,this.onCloseCallback?.(n.status);return}this.handleConnectionError();return}if(!n.body){l(`SSETransport: No response body`),this.handleConnectionError();return}let i=Date.now()-e;l(`SSETransport: Connected`),p(`info`,`cli_sse_connect_connected`,{duration_ms:i}),this.state=`connected`,this.reconnectAttempts=0,this.reconnectStartTime=null,this.resetLivenessTimer(),await this.readStream(n.body)}catch(e){if(this.abortController?.signal.aborted)return;l(`SSETransport: Connection error: ${o(e)}`,{level:`error`}),p(`error`,`cli_sse_connect_error`),this.handleConnectionError()}}async readStream(e){let t=e.getReader(),n=new TextDecoder,r=``,i=1024*1024;try{for(;;){let{done:e,value:a}=await t.read();if(e)break;if(r+=n.decode(a,N),r.length>i){l(`SSETransport: Buffer exceeded ${i} bytes — dropping connection`,{level:`error`}),p(`error`,`cli_sse_buffer_overflow`);break}let{frames:o,remaining:s}=C(r);r=s;for(let e of o){if(this.resetLivenessTimer(),e.id){let t=parseInt(e.id,10);if(!isNaN(t)){if(this.seenSequenceNums.has(t))l(`SSETransport: DUPLICATE frame seq=${t} (lastSequenceNum=${this.lastSequenceNum}, seenCount=${this.seenSequenceNums.size})`,{level:`warn`}),p(`warn`,`cli_sse_duplicate_sequence`);else if(this.seenSequenceNums.add(t),this.seenSequenceNums.size>1e3){let e=this.lastSequenceNum-200;for(let t of this.seenSequenceNums)t<e&&this.seenSequenceNums.delete(t)}t>this.lastSequenceNum&&(this.lastSequenceNum=t)}}e.event&&e.data?this.handleSSEFrame(e.event,e.data):e.data&&(l(`SSETransport: Frame has data: but no event: field — dropped`,{level:`warn`}),p(`warn`,`cli_sse_frame_missing_event_field`))}}}catch(e){if(this.abortController?.signal.aborted)return;l(`SSETransport: Stream read error: ${o(e)}`,{level:`error`}),p(`error`,`cli_sse_stream_read_error`)}finally{t.releaseLock()}this.state!==`closing`&&this.state!==`closed`&&(l(`SSETransport: Stream ended, reconnecting`),this.handleConnectionError())}handleSSEFrame(e,t){if(e!==`client_event`){l(`SSETransport: Unexpected SSE event type '${e}' on worker stream`,{level:`warn`}),p(`warn`,`cli_sse_unexpected_event_type`,{event_type:e});return}let n;try{n=c(t)}catch(e){l(`SSETransport: Failed to parse client_event data: ${o(e)}`,{level:`error`});return}let r=n.payload;if(r&&typeof r==`object`&&`type`in r){let e=this.sessionId?` session=${this.sessionId}`:``;l(`SSETransport: Event seq=${n.sequence_num} event_id=${n.event_id} event_type=${n.event_type} payload_type=${String(r.type)}${e}`),p(`info`,`cli_sse_message_received`),this.onData?.(`${a(r)}\n`)}else l(`SSETransport: Ignoring client_event with no type in payload: event_id=${n.event_id}`);this.onEventCallback?.(n)}handleConnectionError(){if(b(`SSE handleConnectionError: state=${this.state} lastSeqNum=${this.getLastSequenceNum()} reconnectAttempts=${this.reconnectAttempts} msSinceLastActivity=${this.lastActivityTime>0?Date.now()-this.lastActivityTime:-1}`),this.clearLivenessTimer(),this.state===`closing`||this.state===`closed`)return;this.abortController?.abort(),this.abortController=null;let e=Date.now();this.reconnectStartTime||(this.reconnectStartTime=e);let t=e-this.reconnectStartTime;if(t<D){if(this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null),this.refreshHeaders){let e=this.refreshHeaders();Object.assign(this.headers,e),l(`SSETransport: Refreshed headers for reconnect`)}this.state=`reconnecting`,this.reconnectAttempts++;let e=Math.min(T*2**(this.reconnectAttempts-1),E),n=Math.max(0,e+e*.25*(2*Math.random()-1));l(`SSETransport: Reconnecting in ${Math.round(n)}ms (attempt ${this.reconnectAttempts}, ${Math.round(t/1e3)}s elapsed)`),p(`error`,`cli_sse_reconnect_attempt`,{reconnectAttempts:this.reconnectAttempts}),this.reconnectTimer=setTimeout(()=>{this.reconnectTimer=null,this.connect()},n)}else l(`SSETransport: Reconnection time budget exhausted after ${Math.round(t/1e3)}s`,{level:`error`}),p(`error`,`cli_sse_reconnect_exhausted`,{reconnectAttempts:this.reconnectAttempts,elapsedMs:t}),this.state=`closed`,this.onCloseCallback?.()}resetLivenessTimer(){this.clearLivenessTimer(),this.livenessTimer=setTimeout(this.onLivenessTimeout,O)}clearLivenessTimer(){this.livenessTimer&&(clearTimeout(this.livenessTimer),this.livenessTimer=null)}async write(e){let t=this.getAuthHeaders();if(Object.keys(t).length===0){l(`SSETransport: No session token available for POST`),p(`warn`,`cli_sse_post_no_token`);return}let n={...t,"Content-Type":`application/json`,"anthropic-version":`2023-06-01`,"User-Agent":_()};l(`SSETransport: POST body keys=${Object.keys(e).join(`,`)}`);for(let t=1;t<=A;t++){try{let i=await r.post(this.postUrl,e,{headers:n,validateStatus:S});if(i.status===200||i.status===201){l(`SSETransport: POST success type=${e.type}`);return}if(l(`SSETransport: POST ${i.status} body=${a(i.data).slice(0,200)}`),i.status>=400&&i.status<500&&i.status!==429){l(`SSETransport: POST returned ${i.status} (client error), not retrying`),p(`warn`,`cli_sse_post_client_error`,{status:i.status});return}l(`SSETransport: POST returned ${i.status}, attempt ${t}/${A}`),p(`warn`,`cli_sse_post_retryable_error`,{status:i.status,attempt:t})}catch(e){l(`SSETransport: POST error: ${e.message}, attempt ${t}/${A}`),p(`warn`,`cli_sse_post_network_error`,{attempt:t})}if(t===A){l(`SSETransport: POST failed after ${A} attempts, continuing`),p(`warn`,`cli_sse_post_retries_exhausted`);return}await h(Math.min(j*2**(t-1),M))}}isConnectedStatus(){return this.state===`connected`}isClosedStatus(){return this.state===`closed`}setOnData(e){this.onData=e}setOnClose(e){this.onCloseCallback=e}setOnEvent(e){this.onEventCallback=e}close(){this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null),this.clearLivenessTimer(),this.state=`closing`,this.abortController?.abort(),this.abortController=null}}}));export{F as n,C as r,P as t};
@@ -1 +0,0 @@
1
- import{e_ as e,t_ as t}from"./loadAgentsDir-C96o6gCj.js";t();export{e as clearSearchExtraToolsDescriptionCache};
@@ -1,2 +0,0 @@
1
- import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{d as n,l as r,o as i}from"./envUtils-DcaKZlRU.js";import{n as a,t as o}from"./figures-5ThXQEtq.js";import{Aa as ee,Dh as s,Du as te,Eh as c,Eu as l,Fy as ne,GS as re,Iy as ie,Lu as u,Oh as ae,Ou as oe,Ru as d,Th as f,_y as se,b as p,br as m,by as ce,j as le,ja as h,ka as ue,np as g,rp as _,rr as de,vh as fe,xy as v,yh as pe,yy as me,zS as he,zy as ge}from"./loadAgentsDir-C96o6gCj.js";import{D as y,Gt as _e,H as ve,I as b,P as x,T as S,U as ye,Wt as be,Xn as xe,a as Se,ai as C,di as w,fi as T,k as Ce,n as we,ot as Te,r as E,t as D,x as O,y as Ee}from"./src-DL3w8VPk.js";import{t as k}from"./jsx-runtime-Bb4Xn-E0.js";import{Ut as De,ft as Oe}from"./state-D5D6QpTX.js";import{n as ke,t as A}from"./cwd-Nh5IZNKO.js";import{Ft as Ae,Nt as je,Pt as Me,Rt as Ne,b as j,h as M,jt as Pe,s as Fe,t as Ie,zt as Le}from"./settings-BowI3jp-.js";import{a as Re,c as N,h as ze,i as Be,o as Ve,y as P}from"./config-DUTgj3js.js";import{o as He,s as Ue}from"./log-CZ7ploQm.js";import{n as We,r as F}from"./analytics-DJobLaWP.js";import{B as Ge,J as I,Q as Ke,V as qe,Y as Je,Z as Ye,_ as Xe,b as Ze,hr as Qe,mr as L,x as $e,z as et}from"./model-BaMclMXn.js";import{a as tt,c as nt,d as rt,i as it,l as at,n as ot,o as R,r as st,s as ct,t as z,u as B}from"./status-0ZBx6Ls0.js";import{n as V,t as lt}from"./useExitOnCtrlCDWithKeybindings-L5idX6Kz.js";import{i as ut,n as dt,r as ft}from"./modalContext-DDZdU1J8.js";import{n as pt,t as mt}from"./ThemePicker-CIFKZza0.js";import{i as ht,n as gt,r as _t,t as vt}from"./extraUsage-DiAirtuk.js";import{n as yt,t as bt}from"./AgentsMdExternalIncludesDialog-Dp6CwZyI.js";import{t as H}from"./SearchBox-C9xxQzh1.js";import{n as xt,t as St}from"./useSearchInput-Bxl4wGcZ.js";function Ct(){let e=Oe();return[{label:`Version`,value:`0.0.21`},{label:`Session name`,value:de(e)??(0,K.jsx)(x,{dimColor:!0,children:`/rename to add a name`})},{label:`Session ID`,value:e},{label:`cwd`,value:A()},...ot(),...z()]}function wt({mainLoopModel:e,mcp:t,theme:n,context:r}){return[{label:`Model`,value:B(e)},...st(t.clients,r.options.ideInstallationStatus,n),...R(t.clients,n),...nt(),...at()]}async function U(){return[...await it(),...await tt(),...await ct()]}function Tt({value:e}){return Array.isArray(e)?(0,K.jsx)(b,{flexWrap:`wrap`,columnGap:1,flexShrink:99,children:e.map((t,n)=>(0,K.jsxs)(x,{children:[t,n<e.length-1?`,`:``]},n))}):typeof e==`string`?(0,K.jsx)(x,{children:e}):e}function Et({context:e,diagnosticsPromise:t}){let n=c(e=>e.mainLoopModel),r=c(e=>e.mcp),[i]=ve(),a=W.useMemo(()=>[Ct(),wt({mainLoopModel:n,mcp:r,theme:i,context:e})],[n,r,i,e]),o=ft()?1:void 0;return(0,K.jsxs)(b,{flexDirection:`column`,flexGrow:o,children:[(0,K.jsxs)(b,{flexDirection:`column`,gap:1,flexGrow:o,children:[a.map((e,t)=>e.length>0&&(0,K.jsx)(b,{flexDirection:`column`,children:e.map(({label:e,value:t},n)=>(0,K.jsxs)(b,{flexDirection:`row`,gap:1,flexShrink:0,children:[e!==void 0&&(0,K.jsxs)(x,{bold:!0,children:[e,`:`]}),(0,K.jsx)(Tt,{value:t})]},n))},t)),(0,K.jsx)(G.Suspense,{fallback:null,children:(0,K.jsx)(Dt,{promise:t})})]}),(0,K.jsx)(x,{dimColor:!0,children:(0,K.jsx)(g,{action:`confirm:no`,context:`Settings`,fallback:`Esc`,description:`cancel`})})]})}function Dt({promise:e}){let t=(0,G.use)(e);return t.length===0?null:(0,K.jsxs)(b,{flexDirection:`column`,paddingBottom:1,children:[(0,K.jsx)(x,{bold:!0,children:`System Diagnostics`}),t.map((e,t)=>(0,K.jsxs)(b,{flexDirection:`row`,gap:1,paddingX:1,children:[(0,K.jsx)(x,{color:`error`,children:o.warning}),typeof e==`string`?(0,K.jsx)(x,{wrap:`wrap`,children:e}):e]},t))]})}var W,G,K,Ot=e((()=>{a(),W=t(C(),1),G=t(C(),1),De(),dt(),D(),f(),ke(),m(),rt(),_(),K=k()}));function kt({currentVersion:e,onChoice:t}){function n(e){t(e)}function r(){t(`cancel`)}return(0,At.jsxs)(Ee,{title:`Switch to Stable Channel`,onCancel:r,color:`permission`,hideBorder:!0,hideInputGuide:!0,children:[(0,At.jsxs)(x,{children:[`The stable channel may have an older version than what you're currently running (`,e,`).`]}),(0,At.jsx)(x,{dimColor:!0,children:`How would you like to handle this?`}),(0,At.jsx)(te,{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 At,jt=e((()=>{D(),l(),At=k()}));function Mt(e){return Object.entries(e).map(([e,t])=>({label:t?.name??Ft,value:e,description:t?.description??It}))}function Nt({initialStyle:e,onComplete:t,onCancel:n,isStandaloneCommand:r}){let[i,a]=(0,Pt.useState)([]),[o,s]=(0,Pt.useState)(!0);(0,Pt.useEffect)(()=>{ee(A()).then(e=>{let t=Mt(e);a(t),s(!1)}).catch(()=>{let e=Mt(ue);a(e),s(!1)})},[]);let c=(0,Pt.useCallback)(e=>{t(e)},[t]);return(0,q.jsx)(Ee,{title:`Preferred output style`,onCancel:n,hideInputGuide:!r,hideBorder:!r,children:(0,q.jsxs)(b,{flexDirection:`column`,gap:1,children:[(0,q.jsx)(b,{marginTop:1,children:(0,q.jsx)(x,{dimColor:!0,children:`This changes how Work Mate communicates with you`})}),o?(0,q.jsx)(x,{dimColor:!0,children:`Loading output styles…`}):(0,q.jsx)(te,{options:i,onChange:c,visibleOptionCount:10,defaultValue:e})]})})}var Pt,q,Ft,It,Lt=e((()=>{Pt=t(C(),1),h(),D(),ke(),oe(),q=k(),Ft=`Default`,It=`Work Mate completes coding tasks efficiently and provides concise responses`}));function Rt({initialLanguage:e,onComplete:t,onCancel:n}){let[r,i]=(0,zt.useState)(e),[a,ee]=(0,zt.useState)((e??``).length);be(`confirm:no`,n,{context:`Settings`});function s(){let e=r?.trim();t(e||void 0)}return(0,J.jsxs)(b,{flexDirection:`column`,gap:1,children:[(0,J.jsx)(x,{children:`Enter your preferred response and voice language:`}),(0,J.jsxs)(b,{flexDirection:`row`,gap:1,children:[(0,J.jsx)(x,{children:o.pointer}),(0,J.jsx)(u,{value:r??``,onChange:i,onSubmit:s,focus:!0,showCursor:!0,placeholder:`e.g., Japanese, 日本語, Español${o.ellipsis}`,columns:60,cursorOffset:a,onChangeCursorOffset:ee})]}),(0,J.jsx)(x,{dimColor:!0,children:`Leave empty for default (English)`})]})}var zt,J,Bt=e((()=>{a(),zt=t(C(),1),D(),he(),d(),J=k()}));function Vt({onClose:e,context:t,setTabsHidden:i,onIsSearchModeChange:a,contentHeight:ee}){let{headerFocused:l,focusHeader:re}=Se(),ie=ft(),[,u]=ve(),oe=ye(),[d,f]=(0,X.useState)(N()),p=Y.useRef(N()),[m,h]=(0,X.useState)(Ie()),ue=Y.useRef(Ie()),[_,de]=(0,X.useState)(m?.outputStyle||`default`),fe=Y.useRef(_),[v,he]=(0,X.useState)(m?.language),C=Y.useRef(v),[T,we]=(0,X.useState)(0),[E,D]=(0,X.useState)(0),[O,k]=(0,X.useState)(!1),De=xe(),{rows:Oe}=Te(),ke=ee??Math.min(Math.floor(Oe*.8),30),A=Math.max(5,ke-10),M=c(e=>e.mainLoopModel),Pe=c(e=>e.verbose),ze=c(e=>e.thinkingEnabled),He=c(e=>Ye()?e.fastMode:!1);c(e=>e.promptSuggestionEnabled);let We=Me(m?.permissions?.defaultMode??`default`),I=ae(),[Xe,L]=(0,X.useState)({}),tt=Y.useRef(ze),[nt]=(0,X.useState)(()=>Fe(`localSettings`)),[rt]=(0,X.useState)(()=>Fe(`userSettings`)),it=Y.useRef(oe),at=s(),[ot]=(0,X.useState)(()=>{let e=at.getState();return{mainLoopModel:e.mainLoopModel,mainLoopModelForSession:e.mainLoopModelForSession,verbose:e.verbose,thinkingEnabled:e.thinkingEnabled,fastMode:e.fastMode,promptSuggestionEnabled:e.promptSuggestionEnabled,replBridgeEnabled:e.replBridgeEnabled,replBridgeOutboundOnly:e.replBridgeOutboundOnly,settings:e.settings}}),R=Y.useRef(!1),[st,ct]=(0,X.useState)(!1),[z,B]=(0,X.useState)(null),{query:V,setQuery:lt,cursorOffset:ut}=xt({isActive:O&&z===null&&!l,onExit:()=>k(!1),onExitUp:re,passthroughCtrlKeys:[`c`,`d`]}),dt=O&&!l;Y.useEffect(()=>{a?.(dt)},[dt,a]);let pt=ne(t.options.mcpClients),ht=!r(process.env.CLAUDE_CODE_DISABLE_FILE_CHECKPOINTING),vt=Y.use(me(!0)),yt=ce(vt),H=Re();function St(e){F(`tengu_config_model_changed`,{from_model:M,to_model:e}),I(t=>({...t,mainLoopModel:e,mainLoopModelForSession:null})),L(t=>{let n=$e(e)+(gt(e,!1,Ze())?` · Billed as extra usage`:``);if(`model`in t){let{model:e,...r}=t;return{...r,model:n}}return{...t,model:n}})}function Ct(e){P(t=>({...t,verbose:e})),f({...N(),verbose:e}),I(t=>({...t,verbose:e})),L(t=>{if(`verbose`in t){let{verbose:e,...n}=t;return n}return{...t,verbose:e}})}let wt=[{id:`autoCompactEnabled`,label:`Auto-compact`,value:d.autoCompactEnabled,type:`boolean`,onChange(e){P(t=>({...t,autoCompactEnabled:e})),f({...N(),autoCompactEnabled:e}),F(`tengu_auto_compact_setting_changed`,{enabled:e})}},{id:`spinnerTipsEnabled`,label:`Show tips`,value:m?.spinnerTipsEnabled??!0,type:`boolean`,onChange(e){j(`localSettings`,{spinnerTipsEnabled:e}),h(t=>({...t,spinnerTipsEnabled:e})),F(`tengu_tips_setting_changed`,{enabled:e})}},{id:`cacheWarningEnabled`,label:`Cache warnings`,value:m?.cacheWarningEnabled??!0,type:`boolean`,onChange(e){j(`localSettings`,{cacheWarningEnabled:e}),h(t=>({...t,cacheWarningEnabled:e})),F(`tengu_cache_warning_setting_changed`,{enabled:e})}},{id:`prefersReducedMotion`,label:`Reduce motion`,value:m?.prefersReducedMotion??!1,type:`boolean`,onChange(e){j(`localSettings`,{prefersReducedMotion:e}),h(t=>({...t,prefersReducedMotion:e})),I(t=>({...t,settings:{...t.settings,prefersReducedMotion:e}})),F(`tengu_reduce_motion_setting_changed`,{enabled:e})}},{id:`thinkingEnabled`,label:`Thinking mode`,value:ze??!0,type:`boolean`,onChange(e){I(t=>({...t,thinkingEnabled:e})),j(`userSettings`,{alwaysThinkingEnabled:e?void 0:!1}),F(`tengu_thinking_toggled`,{enabled:e})}},...Ye()&&Je()?[{id:`fastMode`,label:`Fast mode (${et} only)`,value:!!He,type:`boolean`,onChange(e){Ge(),j(`userSettings`,{fastMode:e?!0:void 0}),e?(I(e=>({...e,mainLoopModel:qe(),mainLoopModelForSession:null,fastMode:!0})),L(e=>({...e,model:qe(),"Fast mode":`ON`}))):(I(e=>({...e,fastMode:!1})),L(e=>({...e,"Fast mode":`OFF`})))}}]:[],...ht?[{id:`fileCheckpointingEnabled`,label:`Rewind code (checkpoints)`,value:d.fileCheckpointingEnabled,type:`boolean`,onChange(e){P(t=>({...t,fileCheckpointingEnabled:e})),f({...N(),fileCheckpointingEnabled:e}),F(`tengu_file_history_snapshots_setting_changed`,{enabled:e})}}]:[],{id:`verbose`,label:`Verbose output`,value:Pe,type:`boolean`,onChange:Ct},{id:`terminalProgressBarEnabled`,label:`Terminal progress bar`,value:d.terminalProgressBarEnabled,type:`boolean`,onChange(e){P(t=>({...t,terminalProgressBarEnabled:e})),f({...N(),terminalProgressBarEnabled:e}),F(`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}),F(`tengu_show_turn_duration_setting_changed`,{enabled:e})}},{id:`defaultPermissionMode`,label:`Default permission mode`,value:We,options:(()=>{let e=[`default`,`plan`];return[...e,...Le.filter(t=>!e.includes(t))]})(),type:`enum`,onChange(e){let t=Me(e),n=t===`auto`?t:je(t)?Ne(t):t,r=j(`userSettings`,{permissions:{...m?.permissions,defaultMode:n}});if(r.error){Ue(r.error);return}h(e=>({...e,permissions:{...e?.permissions,defaultMode:n}})),L(t=>({...t,defaultPermissionMode:e})),F(`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}),F(`tengu_respect_gitignore_setting_changed`,{enabled:e})}},...pe()?[{id:`copyOnSelect`,label:`Copy on select`,value:d.copyOnSelect??!0,type:`boolean`,onChange(e){P(t=>({...t,copyOnSelect:e})),f({...N(),copyOnSelect:e}),F(`tengu_config_changed`,{setting:`copyOnSelect`,value:String(e)})}}]:[],H?{id:`autoUpdatesChannel`,label:`Auto-update channel`,value:`disabled`,type:`managedEnum`,onChange(){}}:{id:`autoUpdatesChannel`,label:`Auto-update channel`,value:m?.autoUpdatesChannel??`latest`,type:`managedEnum`,onChange(){}},{id:`theme`,label:`Theme`,value:oe,type:`managedEnum`,onChange:u},{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:v??`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}),F(`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}),F(`tengu_pr_status_footer_setting_changed`,{enabled:e})}},{id:`model`,label:`Model`,value:M===null?`Default (recommended)`:M,type:`managedEnum`,onChange:St},...pt?[{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}),F(`tengu_diff_tool_changed`,{tool:e,source:`config_panel`})}}]:[],...ge()?[]:[{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}),F(`tengu_auto_connect_ide_changed`,{enabled:e,source:`config_panel`})}}],...ge()?[{id:`autoInstallIdeExtension`,label:`Auto-install IDE extension`,value:d.autoInstallIdeExtension??!0,type:`boolean`,onChange(e){P(t=>({...t,autoInstallIdeExtension:e})),f({...N(),autoInstallIdeExtension:e}),F(`tengu_auto_install_ide_extension_changed`,{enabled:e,source:`config_panel`})}}]:[],...yt?[{id:`showExternalIncludesDialog`,label:`External AGENTS.md includes`,value:Ve().hasAgentsMdExternalIncludesApproved?`true`:`false`,type:`managedEnum`,onChange(){}}]:[],...process.env.ANTHROPIC_API_KEY&&!n()?[{id:`apiKey`,label:(0,Z.jsxs)(x,{children:[`Use custom API key: `,(0,Z.jsx)(x,{bold:!0,children:Qe(process.env.ANTHROPIC_API_KEY)})]}),searchText:`Use custom API key`,value:!!(process.env.ANTHROPIC_API_KEY&&d.customApiKeyResponses?.approved?.includes(Qe(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=Qe(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())}}]:[]],U=Y.useMemo(()=>{if(!V)return wt;let e=V.toLowerCase();return wt.filter(t=>t.id.toLowerCase().includes(e)?!0:(`searchText`in t?t.searchText:t.label).toLowerCase().includes(e))},[wt,V]);Y.useEffect(()=>{if(T>=U.length){let e=Math.max(0,U.length-1);we(e),D(Math.max(0,e-A+1));return}D(e=>T<e?T:T>=e+A?T-A+1:e)},[U.length,T,A]);let Tt=(0,X.useCallback)(e=>{D(t=>e<t?e:e>=t+A?e-A+1:t)},[A]),Et=(0,X.useCallback)(()=>{if(z!==null)return;let t=Object.entries(Xe).map(([e,t])=>(F(`tengu_config_changed`,{key:e,value:t}),`Set ${e} to ${w.bold(t)}`)),r=n()?void 0:process.env.ANTHROPIC_API_KEY,i=!!(r&&p.current.customApiKeyResponses?.approved?.includes(Qe(r))),a=!!(r&&d.customApiKeyResponses?.approved?.includes(Qe(r)));if(i!==a&&(t.push(`${a?`Enabled`:`Disabled`} custom API key`),F(`tengu_config_changed`,{key:`env.ANTHROPIC_API_KEY`,value:a})),d.theme!==p.current.theme&&t.push(`Set theme to ${w.bold(d.theme)}`),d.preferredNotifChannel!==p.current.preferredNotifChannel&&t.push(`Set notifications to ${w.bold(d.preferredNotifChannel)}`),_!==fe.current&&t.push(`Set output style to ${w.bold(_)}`),v!==C.current&&t.push(`Set response language to ${w.bold(v??`Default (English)`)}`),d.editorMode!==p.current.editorMode&&t.push(`Set editor mode to ${w.bold(d.editorMode||`emacs`)}`),d.diffTool!==p.current.diffTool&&t.push(`Set diff tool to ${w.bold(d.diffTool)}`),d.autoConnectIde!==p.current.autoConnectIde&&t.push(`${d.autoConnectIde?`Enabled`:`Disabled`} auto-connect to IDE`),d.autoInstallIdeExtension!==p.current.autoInstallIdeExtension&&t.push(`${d.autoInstallIdeExtension?`Enabled`:`Disabled`} auto-install IDE extension`),d.autoCompactEnabled!==p.current.autoCompactEnabled&&t.push(`${d.autoCompactEnabled?`Enabled`:`Disabled`} auto-compact`),d.respectGitignore!==p.current.respectGitignore&&t.push(`${d.respectGitignore?`Enabled`:`Disabled`} respect .gitignore in file picker`),d.copyOnSelect!==p.current.copyOnSelect&&t.push(`${d.copyOnSelect?`Enabled`:`Disabled`} copy on select`),d.terminalProgressBarEnabled!==p.current.terminalProgressBarEnabled&&t.push(`${d.terminalProgressBarEnabled?`Enabled`:`Disabled`} terminal progress bar`),d.showStatusInTerminalTab!==p.current.showStatusInTerminalTab&&t.push(`${d.showStatusInTerminalTab?`Enabled`:`Disabled`} terminal tab status`),d.showTurnDuration!==p.current.showTurnDuration&&t.push(`${d.showTurnDuration?`Enabled`:`Disabled`} turn duration`),d.remoteControlAtStartup!==p.current.remoteControlAtStartup){let e=d.remoteControlAtStartup===void 0?`Reset Remote Control to default`:`${d.remoteControlAtStartup?`Enabled`:`Disabled`} Remote Control for all sessions`;t.push(e)}m?.autoUpdatesChannel!==ue.current?.autoUpdatesChannel&&t.push(`Set auto-update channel to ${w.bold(m?.autoUpdatesChannel??`latest`)}`),t.length>0?e(t.join(`
2
- `)):e(`Config dialog dismissed`,{display:`system`})},[z,Xe,d,M,_,v,m?.autoUpdatesChannel,Ye()?m?.fastMode:void 0,e]),Dt=(0,X.useCallback)(()=>{oe!==it.current&&u(it.current),P(()=>p.current);let e=nt;j(`localSettings`,{spinnerTipsEnabled:e?.spinnerTipsEnabled,prefersReducedMotion:e?.prefersReducedMotion,defaultView:e?.defaultView,outputStyle:e?.outputStyle});let t=rt;j(`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=ot;I(e=>({...e,mainLoopModel:n.mainLoopModel,mainLoopModelForSession:n.mainLoopModelForSession,verbose:n.verbose,thinkingEnabled:n.thinkingEnabled,fastMode:n.fastMode,promptSuggestionEnabled:n.promptSuggestionEnabled,replBridgeEnabled:n.replBridgeEnabled,replBridgeOutboundOnly:n.replBridgeOutboundOnly,settings:n.settings,toolPermissionContext:le(e.toolPermissionContext)}))},[oe,u,nt,rt,ot,I]);be(`confirm:no`,(0,X.useCallback)(()=>{z===null&&(R.current&&Dt(),e(`Config dialog dismissed`,{display:`system`}))},[z,Dt,e]),{context:`Settings`,isActive:z===null&&!O&&!l}),be(`settings:close`,Et,{context:`Settings`,isActive:z===null&&!O&&!l});let W=(0,X.useCallback)(()=>{let e=U[T];if(e?.onChange){if(e.type===`boolean`){R.current=!0,e.onChange(!e.value),e.id===`thinkingEnabled`&&(!e.value===tt.current?ct(!1):t.messages.some(e=>e.type===`assistant`)&&ct(!0));return}if(e.id===`theme`||e.id===`model`||e.id===`showExternalIncludesDialog`||e.id===`outputStyle`||e.id===`language`)switch(e.id){case`theme`:B(`Theme`),i(!0);return;case`model`:B(`Model`),i(!0);return;case`showExternalIncludesDialog`:B(`ExternalIncludes`),i(!0);return;case`outputStyle`:B(`OutputStyle`),i(!0);return;case`language`:B(`Language`),i(!0);return}if(e.id===`autoUpdatesChannel`){if(H){B(`EnableAutoUpdates`),i(!0);return}(m?.autoUpdatesChannel??`latest`)===`latest`?(B(`ChannelDowngrade`),i(!0)):(R.current=!0,j(`userSettings`,{autoUpdatesChannel:`latest`,minimumVersion:void 0}),h(e=>({...e,autoUpdatesChannel:`latest`,minimumVersion:void 0})),F(`tengu_autoupdate_channel_changed`,{channel:`latest`}));return}if(e.type===`enum`){R.current=!0;let t=(e.options.indexOf(e.value)+1)%e.options.length;e.onChange(e.options[t]);return}}},[H,U,T,m?.autoUpdatesChannel,i]),G=e=>{ct(!1);let t=Math.max(0,Math.min(U.length-1,T+e));we(t),Tt(t)};return _e({"select:previous":()=>{T===0?(ct(!1),k(!0),D(0)):G(-1)},"select:next":()=>G(1),"scroll:lineUp":()=>G(-1),"scroll:lineDown":()=>G(1),"select:accept":W,"select:previousValue":()=>W(),"select:nextValue":()=>W(),"settings:search":()=>{k(!0),lt(``)}},{context:`Settings`,isActive:z===null&&!O&&!l}),(0,Z.jsx)(b,{flexDirection:`column`,width:`100%`,tabIndex:0,autoFocus:!0,onKeyDown:(0,X.useCallback)(e=>{if(z===null&&!l){if(O){if(e.key===`escape`){e.preventDefault(),V.length>0?lt(``):k(!1);return}(e.key===`return`||e.key===`down`||e.key===`wheeldown`)&&(e.preventDefault(),k(!1),we(0),D(0));return}if(e.key===`left`||e.key===`right`||e.key===`tab`){e.preventDefault(),W();return}e.ctrl||e.meta||e.key===`j`||e.key===`k`||e.key===`/`||e.key.length===1&&e.key!==` `&&(e.preventDefault(),k(!0),lt(e.key))}},[z,l,O,V,lt,W]),children:z===`Theme`?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(mt,{onThemeSelect:e=>{R.current=!0,u(e),B(null),i(!1)},onCancel:()=>{B(null),i(!1)},hideEscToCancel:!0,skipExitHandling:!0}),(0,Z.jsx)(b,{children:(0,Z.jsx)(x,{dimColor:!0,italic:!0,children:(0,Z.jsxs)(S,{children:[(0,Z.jsx)(y,{shortcut:`Enter`,action:`select`}),(0,Z.jsx)(g,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})]})})})]}):z===`Model`?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(_t,{initial:M,onSelect:e=>{R.current=!0,St(e),B(null),i(!1)},onCancel:()=>{B(null),i(!1)},showFastModeNotice:Ye()?He&&Ke(M)&&Je():!1}),(0,Z.jsx)(x,{dimColor:!0,children:(0,Z.jsxs)(S,{children:[(0,Z.jsx)(y,{shortcut:`Enter`,action:`confirm`}),(0,Z.jsx)(g,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})]})})]}):z===`ExternalIncludes`?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(bt,{onDone:()=>{B(null),i(!1)},externalIncludes:se(vt)}),(0,Z.jsx)(x,{dimColor:!0,children:(0,Z.jsxs)(S,{children:[(0,Z.jsx)(y,{shortcut:`Enter`,action:`confirm`}),(0,Z.jsx)(g,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`disable external includes`})]})})]}):z===`OutputStyle`?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Nt,{initialStyle:_,onComplete:e=>{R.current=!0,de(e??`default`),B(null),i(!1),j(`localSettings`,{outputStyle:e}),F(`tengu_output_style_changed`,{style:e??`default`,source:`config_panel`,settings_source:`localSettings`})},onCancel:()=>{B(null),i(!1)}}),(0,Z.jsx)(x,{dimColor:!0,children:(0,Z.jsxs)(S,{children:[(0,Z.jsx)(y,{shortcut:`Enter`,action:`confirm`}),(0,Z.jsx)(g,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})]})})]}):z===`Language`?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Rt,{initialLanguage:v,onComplete:e=>{R.current=!0,he(e),B(null),i(!1),j(`userSettings`,{language:e}),F(`tengu_language_changed`,{language:e??`default`,source:`config_panel`})},onCancel:()=>{B(null),i(!1)}}),(0,Z.jsx)(x,{dimColor:!0,children:(0,Z.jsxs)(S,{children:[(0,Z.jsx)(y,{shortcut:`Enter`,action:`confirm`}),(0,Z.jsx)(g,{action:`confirm:no`,context:`Settings`,fallback:`Esc`,description:`cancel`})]})})]}):z===`EnableAutoUpdates`?(0,Z.jsx)(Ee,{title:`Enable Auto-Updates`,onCancel:()=>{B(null),i(!1)},hideBorder:!0,hideInputGuide:!0,children:H?.type===`config`?(0,Z.jsx)(te,{options:[{label:`Enable with latest channel`,value:`latest`},{label:`Enable with stable channel`,value:`stable`}],onChange:e=>{R.current=!0,B(null),i(!1),P(e=>({...e,autoUpdates:!0})),f({...N(),autoUpdates:!0}),j(`userSettings`,{autoUpdatesChannel:e,minimumVersion:void 0}),h(t=>({...t,autoUpdatesChannel:e,minimumVersion:void 0})),F(`tengu_autoupdate_enabled`,{channel:e})}}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(x,{children:H?.type===`env`?`Auto-updates are controlled by an environment variable and cannot be changed here.`:`Auto-updates are disabled in development builds.`}),H?.type===`env`&&(0,Z.jsxs)(x,{dimColor:!0,children:[`Unset `,H.envVar,` to re-enable auto-updates.`]})]})}):z===`ChannelDowngrade`?(0,Z.jsx)(kt,{currentVersion:`0.0.21`,onChoice:e=>{if(B(null),i(!1),e===`cancel`)return;R.current=!0;let t={autoUpdatesChannel:`stable`};e===`stay`&&(t.minimumVersion=`0.0.21`),j(`userSettings`,t),h(e=>({...e,...t})),F(`tengu_autoupdate_channel_changed`,{channel:`stable`,minimum_version_set:e===`stay`})}}):(0,Z.jsxs)(b,{flexDirection:`column`,gap:1,marginY:ie?void 0:1,children:[(0,Z.jsx)(Ce,{query:V,isFocused:O&&!l,isTerminalFocused:De,cursorOffset:ut,placeholder:`Search settings…`}),(0,Z.jsx)(b,{flexDirection:`column`,children:U.length===0?(0,Z.jsxs)(x,{dimColor:!0,italic:!0,children:[`No settings match "`,V,`"`]}):(0,Z.jsxs)(Z.Fragment,{children:[E>0&&(0,Z.jsxs)(x,{dimColor:!0,children:[o.arrowUp,` `,E,` more above`]}),U.slice(E,E+A).map((e,t)=>{let n=E+t===T&&!l&&!O;return(0,Z.jsx)(Y.Fragment,{children:(0,Z.jsxs)(b,{width:`100%`,children:[(0,Z.jsx)(b,{width:44,children:(0,Z.jsxs)(x,{color:n?`suggestion`:void 0,children:[n?o.pointer:` `,` `,e.label]})}),(0,Z.jsx)(b,{flexGrow:1,children:e.type===`boolean`?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(x,{color:n?`suggestion`:void 0,children:e.value.toString()}),st&&e.id===`thinkingEnabled`&&(0,Z.jsxs)(x,{color:`warning`,children:[` `,`Changing thinking mode mid-conversation will increase latency and may reduce quality.`]})]}):e.id===`theme`?(0,Z.jsx)(x,{color:n?`suggestion`:void 0,children:Ut[e.value.toString()]??e.value.toString()}):e.id===`notifChannel`?(0,Z.jsx)(x,{color:n?`suggestion`:void 0,children:(0,Z.jsx)(Ht,{value:e.value.toString()})}):e.id===`defaultPermissionMode`?(0,Z.jsx)(x,{color:n?`suggestion`:void 0,children:Ae(e.value)}):e.id===`autoUpdatesChannel`&&H?(0,Z.jsxs)(b,{flexDirection:`column`,children:[(0,Z.jsx)(x,{color:n?`suggestion`:void 0,children:`disabled`}),(0,Z.jsxs)(x,{dimColor:!0,children:[`(`,Be(H),`)`]})]}):(0,Z.jsx)(x,{color:n?`suggestion`:void 0,children:e.value.toString()})})]})},e.id)}),E+A<U.length&&(0,Z.jsxs)(x,{dimColor:!0,children:[o.arrowDown,` `,U.length-E-A,` more below`]})]})}),l?(0,Z.jsx)(x,{dimColor:!0,children:(0,Z.jsxs)(S,{children:[(0,Z.jsx)(y,{shortcut:`←/→ tab`,action:`switch`}),(0,Z.jsx)(y,{shortcut:`↓`,action:`return`}),(0,Z.jsx)(g,{action:`confirm:no`,context:`Settings`,fallback:`Esc`,description:`close`})]})}):O?(0,Z.jsx)(x,{dimColor:!0,children:(0,Z.jsxs)(S,{children:[(0,Z.jsx)(x,{children:`Type to filter`}),(0,Z.jsx)(y,{shortcut:`Enter/↓`,action:`select`}),(0,Z.jsx)(y,{shortcut:`↑`,action:`tabs`}),(0,Z.jsx)(g,{action:`confirm:no`,context:`Settings`,fallback:`Esc`,description:`clear`})]})}):(0,Z.jsx)(x,{dimColor:!0,children:(0,Z.jsxs)(S,{children:[(0,Z.jsx)(g,{action:`select:accept`,context:`Settings`,fallback:`Space`,description:`change`}),(0,Z.jsx)(g,{action:`settings:close`,context:`Settings`,fallback:`Enter`,description:`save`}),(0,Z.jsx)(g,{action:`settings:search`,context:`Settings`,fallback:`/`,description:`search`}),(0,Z.jsx)(g,{action:`confirm:no`,context:`Settings`,fallback:`Esc`,description:`cancel`})]})})]})})}function Ht({value:e}){switch(e){case`auto`:return`Auto`;case`iterm2`:return(0,Z.jsxs)(x,{children:[`iTerm2 `,(0,Z.jsx)(x,{dimColor:!0,children:`(OSC 9)`})]});case`terminal_bell`:return(0,Z.jsxs)(x,{children:[`Terminal Bell `,(0,Z.jsx)(x,{dimColor:!0,children:`(\\a)`})]});case`kitty`:return(0,Z.jsxs)(x,{children:[`Kitty `,(0,Z.jsx)(x,{dimColor:!0,children:`(OSC 99)`})]});case`ghostty`:return(0,Z.jsxs)(x,{children:[`Ghostty `,(0,Z.jsx)(x,{dimColor:!0,children:`(OSC 777)`})]});case`iterm2_with_bell`:return`iTerm2 w/ Bell`;case`notifications_disabled`:return`Disabled`;default:return e}}var Y,X,Z,Ut,Wt=e((()=>{D(),Y=t(C(),1),X=t(C(),1),he(),a(),ze(),L(),T(),Pe(),p(),He(),We(),pt(),f(),ht(),Xe(),vt(),yt(),jt(),l(),Lt(),Bt(),v(),_(),dt(),H(),ie(),M(),h(),i(),St(),re(),I(),fe(),Z=k(),Ut={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 Gt({onClose:e,context:t,defaultTab:n}){let[r,i]=(0,Q.useState)(n),[a,o]=(0,Q.useState)(!1),[ee,s]=(0,Q.useState)(!1),te=ft(),{rows:c}=ut(Te()),l=te?c+1:Math.max(15,Math.min(Math.floor(c*.8),30)),[ne]=(0,Q.useState)(()=>U().catch(()=>[]));return V(),be(`confirm:no`,()=>{a||e(`Status dialog dismissed`,{display:`system`})},{context:`Settings`,isActive:!a&&!(r===`Config`&&ee)}),(0,$.jsx)(O,{color:`permission`,children:(0,$.jsx)(E,{color:`permission`,selectedTab:r,onTabChange:i,hidden:a,initialHeaderFocused:n!==`Config`,contentHeight:a||te?void 0:l,children:[(0,$.jsx)(we,{title:`Status`,children:(0,$.jsx)(Et,{context:t,diagnosticsPromise:ne})},`status`),(0,$.jsx)(we,{title:`Config`,children:(0,$.jsx)(Q.Suspense,{fallback:null,children:(0,$.jsx)(Vt,{context:t,onClose:e,setTabsHidden:o,onIsSearchModeChange:s,contentHeight:l})})},`config`)]})})}var Q,$,Kt=e((()=>{Q=t(C(),1),he(),lt(),re(),dt(),D(),Ot(),Wt(),$=k()}));export{Kt as n,Gt as t};
@@ -1 +0,0 @@
1
- import{o as e}from"./rolldown-runtime-DaDcL9Zw.js";import{n as t,t as n}from"./figures-5ThXQEtq.js";import{Bl as r,Hl as i,Ll as a,Rl as o,Th as s,wh as c}from"./loadAgentsDir-C96o6gCj.js";import{I as l,P as u,ai as d,mt as f,t as p}from"./src-DL3w8VPk.js";import{t as m}from"./jsx-runtime-Bb4Xn-E0.js";t();var h=e(d(),1);p(),s(),o();var g=m(),_=[`◐`,`◓`,`◑`,`◒`],v=[{key:`validating`,label:`Validating session`},{key:`fetching_logs`,label:`Fetching session logs`},{key:`fetching_branch`,label:`Getting branch info`},{key:`checking_out`,label:`Checking out branch`}];function y({currentStep:e,sessionId:t}){let[r,i]=f(100),a=Math.floor(i/100)%_.length,o=v.findIndex(t=>t.key===e);return(0,g.jsxs)(l,{ref:r,flexDirection:`column`,paddingX:1,paddingY:1,children:[(0,g.jsx)(l,{marginBottom:1,children:(0,g.jsxs)(u,{bold:!0,color:`claude`,children:[_[a],` Teleporting session…`]})}),t&&(0,g.jsx)(l,{marginBottom:1,children:(0,g.jsx)(u,{dimColor:!0,children:t})}),(0,g.jsx)(l,{flexDirection:`column`,marginLeft:2,children:v.map((e,t)=>{let r=t<o,i=t===o,s=t>o,c,d;return r?(c=n.tick,d=`green`):i?(c=_[a],d=`claude`):(c=n.circle,d=void 0),(0,g.jsxs)(l,{flexDirection:`row`,children:[(0,g.jsx)(l,{width:2,children:(0,g.jsx)(u,{color:d,dimColor:s,children:c})}),(0,g.jsx)(u,{dimColor:s,bold:i,children:e.label})]},e.key)})})]})}async function b(e,t){let n=()=>{};function o(){let[e,r]=(0,h.useState)(`validating`);return n=r,(0,g.jsx)(y,{currentStep:e,sessionId:t})}e.render((0,g.jsx)(c,{children:(0,g.jsx)(o,{})}));let s=await i(t,n);n(`checking_out`);let{branchName:l,branchError:u}=await a(s.branch);return{messages:r(s.log,u),branchName:l}}export{b as teleportWithProgress};
@@ -1 +0,0 @@
1
- import{o as e}from"./rolldown-runtime-DaDcL9Zw.js";import{Du as t,Eu as n,lu as r,su as i}from"./loadAgentsDir-C96o6gCj.js";import{I as a,P as o,ai as s,t as c,y as l}from"./src-DL3w8VPk.js";import{t as u}from"./jsx-runtime-Bb4Xn-E0.js";import{Cn as d,bn as f}from"./settings-BowI3jp-.js";import{a as p,r as m}from"./githubRepoPathMapping-OV8U1VFK.js";var h=e(s(),1);c(),d(),n(),r();var g=u();function _({targetRepo:e,initialPaths:n,onSelectPath:r,onCancel:s}){let[c,u]=(0,h.useState)(n),[d,_]=(0,h.useState)(null),[v,y]=(0,h.useState)(!1),b=(0,h.useCallback)(async t=>{if(t===`cancel`){s();return}if(y(!0),_(null),await p(t,e)){r(t);return}m(e,t);let n=c.filter(e=>e!==t);u(n),y(!1),_(`${f(t)} no longer contains the correct repository. Select another path.`)},[e,c,r,s]),x=[...c.map(e=>({label:(0,g.jsxs)(o,{children:[`Use `,(0,g.jsx)(o,{bold:!0,children:f(e)})]}),value:e})),{label:`Cancel`,value:`cancel`}];return(0,g.jsx)(l,{title:`Teleport to Repo`,onCancel:s,color:`background`,children:c.length>0?(0,g.jsxs)(g.Fragment,{children:[(0,g.jsxs)(a,{flexDirection:`column`,gap:1,children:[d&&(0,g.jsx)(o,{color:`error`,children:d}),(0,g.jsxs)(o,{children:[`Open Work Mate in `,(0,g.jsx)(o,{bold:!0,children:e}),`:`]})]}),v?(0,g.jsxs)(a,{children:[(0,g.jsx)(i,{}),(0,g.jsx)(o,{children:` Validating repository…`})]}):(0,g.jsx)(t,{options:x,onChange:e=>void b(e)})]}):(0,g.jsxs)(a,{flexDirection:`column`,gap:1,children:[d&&(0,g.jsx)(o,{color:`error`,children:d}),(0,g.jsxs)(o,{dimColor:!0,children:[`Run claude --teleport from a checkout of `,e]})]})})}export{_ as TeleportRepoMismatchDialog};
@@ -1 +0,0 @@
1
- import{o as e}from"./rolldown-runtime-DaDcL9Zw.js";import{BS as t,Du as n,Eu as r,GS as i,Hl as a,Rl as o,VS as s,au as c,lu as l,np as u,ou as d,rp as f,su as p,zS as m}from"./loadAgentsDir-C96o6gCj.js";import{D as h,I as g,P as _,T as v,Wt as y,ai as b,hn as x,ot as S,t as C}from"./src-DL3w8VPk.js";import{t as w}from"./jsx-runtime-Bb4Xn-E0.js";import{Ut as T,tr as E}from"./state-D5D6QpTX.js";import{M as D,P as O,R as k,c as A,i as j}from"./debug-D58GQBDG.js";import{n as M,r as N}from"./analytics-DJobLaWP.js";import{p as P,v as F}from"./startupProfiler-B90b5vuq.js";import{i as I,n as L}from"./detectRepository-pRAVv8SH.js";import{n as R,o as z}from"./api-DTyrmy1O.js";var B=e(b(),1);T(),M(),k(),o();function V(e){let[t,n]=(0,B.useState)(!1),[r,i]=(0,B.useState)(null),[o,s]=(0,B.useState)(null);return{resumeSession:(0,B.useCallback)(async t=>{n(!0),i(null),s(t),N(`tengu_teleport_resume_session`,{source:e,session_id:t.id});try{let e=await a(t.id);return E({sessionId:t.id}),n(!1),e}catch(e){let t={message:e instanceof D?e.message:O(e),formattedMessage:e instanceof D?e.formattedMessage:void 0,isOperationError:e instanceof D};return i(t),n(!1),null}},[e]),isResuming:t,error:r,selectedSession:o,clearError:(0,B.useCallback)(()=>{i(null)},[])}}i(),z(),C(),m(),t(),j(),I(),F(),f(),r(),l(),d();var H=w(),U=`Updated`,W=` `;function G({onSelect:e,onCancel:t,isEmbedded:r=!1}){let{rows:i}=S(),[a,o]=(0,B.useState)([]),[l,d]=(0,B.useState)(null),[f,m]=(0,B.useState)(!0),[b,C]=(0,B.useState)(null),[w,T]=(0,B.useState)(!1),[E,D]=(0,B.useState)(!1),[O,k]=(0,B.useState)(1),j=s(`confirm:no`,`Confirmation`,`Esc`),M=(0,B.useCallback)(async()=>{try{m(!0),C(null);let e=await L();d(e),A(`Current repository: ${e||`not detected`}`);let t=await R(),n=t;e&&(n=t.filter(t=>t.repo?`${t.repo.owner.login}/${t.repo.name}`===e:!1),A(`Filtered ${n.length} sessions for repo ${e} from ${t.length} total`));let r=[...n].sort((e,t)=>{let n=new Date(e.updated_at);return new Date(t.updated_at).getTime()-n.getTime()});o(r)}catch(e){let t=e instanceof Error?e.message:String(e);A(`Error loading code sessions: ${t}`),C(K(t))}finally{m(!1),T(!1)}},[]),N=()=>{T(!0),M()};y(`confirm:no`,t,{context:`Confirmation`}),x((e,n)=>{if(n.ctrl&&e===`c`){t();return}if(n.ctrl&&e===`r`&&b){N();return}if(b!==null&&n.return){t();return}});let F=(0,B.useCallback)(()=>{D(!0),M()},[D,M]);if(!E)return(0,H.jsx)(c,{onComplete:F});if(f)return(0,H.jsxs)(g,{flexDirection:`column`,padding:1,children:[(0,H.jsxs)(g,{flexDirection:`row`,children:[(0,H.jsx)(p,{}),(0,H.jsx)(_,{bold:!0,children:`Loading Work Mate sessions…`})]}),(0,H.jsx)(_,{dimColor:!0,children:w?`Retrying…`:`Fetching your Work Mate sessions…`})]});if(b)return(0,H.jsxs)(g,{flexDirection:`column`,padding:1,children:[(0,H.jsx)(_,{bold:!0,color:`error`,children:`Error loading Work Mate sessions`}),q(b),(0,H.jsxs)(_,{dimColor:!0,children:[`Press `,(0,H.jsx)(_,{bold:!0,children:`Ctrl+R`}),` to retry · Press `,(0,H.jsx)(_,{bold:!0,children:j}),` to cancel`]})]});if(a.length===0)return(0,H.jsxs)(g,{flexDirection:`column`,padding:1,children:[(0,H.jsxs)(_,{bold:!0,children:[`No Work Mate sessions found`,l&&(0,H.jsxs)(_,{children:[` for `,l]})]}),(0,H.jsx)(g,{marginTop:1,children:(0,H.jsxs)(_,{dimColor:!0,children:[`Press `,(0,H.jsx)(_,{bold:!0,children:j}),` to cancel`]})})]});let I=a.map(e=>({...e,timeString:P(new Date(e.updated_at))})),z=Math.max(7,...I.map(e=>e.timeString.length)),V=I.map(({timeString:e,title:t,id:n})=>({label:`${e.padEnd(z,` `)} ${t}`,value:n})),G=Math.max(1,r?Math.min(a.length,5,i-6-7):Math.min(a.length,i-1-7));return(0,H.jsxs)(g,{flexDirection:`column`,padding:1,height:G+7,children:[(0,H.jsxs)(_,{bold:!0,children:[`Select a session to resume`,a.length>G&&(0,H.jsxs)(_,{dimColor:!0,children:[` `,`(`,O,` of `,a.length,`)`]}),l&&(0,H.jsxs)(_,{dimColor:!0,children:[` (`,l,`)`]}),`:`]}),(0,H.jsxs)(g,{flexDirection:`column`,marginTop:1,flexGrow:1,children:[(0,H.jsx)(g,{marginLeft:2,children:(0,H.jsxs)(_,{bold:!0,children:[U.padEnd(z,` `),W,`Session Title`]})}),(0,H.jsx)(n,{visibleOptionCount:G,options:V,onChange:t=>{let n=a.find(e=>e.id===t);n&&e(n)},onFocus:e=>{let t=V.findIndex(t=>t.value===e);t>=0&&k(t+1)}})]}),(0,H.jsx)(g,{flexDirection:`row`,children:(0,H.jsx)(_,{dimColor:!0,children:(0,H.jsxs)(v,{children:[(0,H.jsx)(h,{shortcut:`↑/↓`,action:`select`}),(0,H.jsx)(h,{shortcut:`Enter`,action:`confirm`}),(0,H.jsx)(u,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})]})})})]})}function K(e){let t=e.toLowerCase();return t.includes(`fetch`)||t.includes(`network`)||t.includes(`timeout`)?`network`:t.includes(`auth`)||t.includes(`token`)||t.includes(`permission`)||t.includes(`oauth`)||t.includes(`not authenticated`)||t.includes(`/login`)||t.includes(`console account`)||t.includes(`403`)?`auth`:t.includes(`api`)||t.includes(`rate limit`)||t.includes(`500`)||t.includes(`529`)?`api`:`other`}function q(e){switch(e){case`network`:return(0,H.jsx)(g,{marginY:1,flexDirection:`column`,children:(0,H.jsx)(_,{dimColor:!0,children:`Check your internet connection`})});case`auth`:return(0,H.jsx)(g,{marginY:1,flexDirection:`column`,children:(0,H.jsx)(_,{dimColor:!0,children:`Teleport requires a Work Mate account`})});case`api`:return(0,H.jsx)(g,{marginY:1,flexDirection:`column`,children:(0,H.jsx)(_,{dimColor:!0,children:`Sorry, Work Mate encountered an error`})});case`other`:return(0,H.jsx)(g,{marginY:1,flexDirection:`row`,children:(0,H.jsx)(_,{dimColor:!0,children:`Sorry, Work Mate encountered an error`})})}}M(),C(),m(),l();function J({onComplete:e,onCancel:t,onError:n,isEmbedded:r=!1,source:i}){let{resumeSession:a,isResuming:o,error:s,selectedSession:c}=V(i);(0,B.useEffect)(()=>{N(`tengu_teleport_started`,{source:i})},[i]);let l=async t=>{let r=await a(t);r?e(r):s&&n&&n(s.message,s.formattedMessage)},u=()=>{N(`tengu_teleport_cancelled`,{}),t()};return y(`app:interrupt`,u,{context:`Global`,isActive:!!s&&!n}),o&&c?(0,H.jsxs)(g,{flexDirection:`column`,padding:1,children:[(0,H.jsxs)(g,{flexDirection:`row`,children:[(0,H.jsx)(p,{}),(0,H.jsx)(_,{bold:!0,children:`Resuming session…`})]}),(0,H.jsxs)(_,{dimColor:!0,children:[`Loading "`,c.title,`"…`]})]}):s&&!n?(0,H.jsxs)(g,{flexDirection:`column`,padding:1,children:[(0,H.jsx)(_,{bold:!0,color:`error`,children:`Failed to resume session`}),(0,H.jsx)(_,{dimColor:!0,children:s.message}),(0,H.jsx)(g,{marginTop:1,children:(0,H.jsxs)(_,{dimColor:!0,children:[`Press `,(0,H.jsx)(_,{bold:!0,children:`Esc`}),` to cancel`]})})]}):(0,H.jsx)(G,{onSelect:l,onCancel:u,isEmbedded:r})}export{J as TeleportResumeWrapper};
@@ -1 +0,0 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{BS as t,Du as n,Ed as r,Eh as i,Eu as a,GS as o,HS as s,Od as c,Oh as l,Th as u,VS as d,ch as f,fh as p,lh as m,mh as h,ph as g,zS as _}from"./loadAgentsDir-C96o6gCj.js";import{D as v,H as y,I as b,P as x,T as S,U as C,V as w,Wt as T,Xt as E,ot as D,t as O}from"./src-DL3w8VPk.js";import{t as k}from"./jsx-runtime-Bb4Xn-E0.js";import{b as A,h as j}from"./settings-BowI3jp-.js";import{n as M,t as N}from"./useExitOnCtrlCDWithKeybindings-L5idX6Kz.js";function P({onThemeSelect:e,showIntroText:t=!1,helpText:a=``,showHelpTextBelow:o=!1,hideEscToCancel:s=!1,skipExitHandling:c=!1,onCancel:u}){let[m]=y(),h=C(),{columns:_}=D(),O=p(),k=O===null?g(m):null,{setPreviewTheme:j,savePreview:N,cancelPreview:P}=w(),I=i(e=>e.settings.syntaxHighlightingDisabled)??!1,L=l();E(`ThemePicker`);let R=d(`theme:toggleSyntaxHighlighting`,`ThemePicker`,`ctrl+t`);T(`theme:toggleSyntaxHighlighting`,()=>{if(O===null){let e=!I;A(`userSettings`,{syntaxHighlightingDisabled:e}),L(t=>({...t,settings:{...t.settings,syntaxHighlightingDisabled:e}}))}},{context:`ThemePicker`});let z=M(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)(b,{flexDirection:`column`,gap:1,children:[(0,F.jsxs)(b,{flexDirection:`column`,gap:1,children:[t?(0,F.jsx)(x,{children:`Let's get started.`}):(0,F.jsx)(x,{bold:!0,color:`permission`,children:`Theme`}),(0,F.jsxs)(b,{flexDirection:`column`,children:[(0,F.jsx)(x,{bold:!0,children:`Choose the text style that looks best with your terminal`}),a&&!o&&(0,F.jsx)(x,{dimColor:!0,children:a})]}),(0,F.jsx)(n,{options:B,onFocus:e=>{j(e)},onChange:t=>{N(),e(t)},onCancel:c?()=>{P(),u?.()}:async()=>{P(),await r(0)},visibleOptionCount:B.length,defaultValue:h,defaultFocusValue:h})]}),(0,F.jsxs)(b,{flexDirection:`column`,width:`100%`,children:[(0,F.jsx)(b,{flexDirection:`column`,borderTop:!0,borderBottom:!0,borderLeft:!1,borderRight:!1,borderStyle:`dashed`,borderColor:`subtle`,children:(0,F.jsx)(f,{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:_})}),(0,F.jsxs)(x,{dimColor:!0,children:[` `,O===`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 t?V:(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(b,{flexDirection:`column`,children:V}),(0,F.jsxs)(b,{marginTop:1,children:[o&&a&&(0,F.jsx)(b,{marginLeft:3,children:(0,F.jsx)(x,{dimColor:!0,children:a})}),!s&&(0,F.jsx)(b,{children:(0,F.jsx)(x,{dimColor:!0,italic:!0,children:z.pending?(0,F.jsxs)(F.Fragment,{children:[`Press `,z.keyName,` again to exit`]}):(0,F.jsxs)(S,{children:[(0,F.jsx)(v,{shortcut:`Enter`,action:`select`}),(0,F.jsx)(v,{shortcut:`Esc`,action:`cancel`})]})})})]})]})}var F,I=e((()=>{N(),o(),O(),s(),_(),t(),u(),c(),j(),a(),h(),m(),F=k()}));export{I as n,P as t};
@@ -1 +0,0 @@
1
- import{o as e}from"./rolldown-runtime-DaDcL9Zw.js";import{Dd as t,Du as n,Eu as r,Od as i,Tg as a,ox as o,rx as s,wg as c,zS as l}from"./loadAgentsDir-C96o6gCj.js";import{I as u,P as d,Wt as f,ai as p,t as m}from"./src-DL3w8VPk.js";import{t as h}from"./jsx-runtime-Bb4Xn-E0.js";import{Qn as g,Ut as _}from"./state-D5D6QpTX.js";import{n as v,t as y}from"./cwd-Nh5IZNKO.js";import{f as b,u as x}from"./debug-D58GQBDG.js";import{h as S,s as C}from"./settings-BowI3jp-.js";import{h as w,n as T,v as E}from"./config-DUTgj3js.js";import{n as D,r as O}from"./analytics-DJobLaWP.js";import{in as k}from"./prompt-BNNE5tsG.js";import{n as A,t as j}from"./managedEnvConstants-BPwL2aWI.js";import{n as M,t as N}from"./useExitOnCtrlCDWithKeybindings-L5idX6Kz.js";import{n as P,t as F}from"./PermissionDialog-BaibiQae.js";import{homedir as I}from"os";var L=e(p(),1),R=h();m(),_(),v(),b(),D(),w(),l(),o(),i(),r(),N(),P(),S(),k(),A(),a();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(C(`projectSettings`))&&e.push(`.workmate/settings.json`),z(C(`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(c(`projectSettings`))&&e.push(`.workmate/settings.json`),V(c(`localSettings`))&&e.push(`.workmate/settings.local.json`),e}function U(e){return!!e?.otelHeadersHelper}function W(){let e=[];return U(C(`projectSettings`))&&e.push(`.workmate/settings.json`),U(C(`localSettings`))&&e.push(`.workmate/settings.local.json`),e}function G(e){return!!e?.apiKeyHelper}function K(){let e=[];return G(C(`projectSettings`))&&e.push(`.workmate/settings.json`),G(C(`localSettings`))&&e.push(`.workmate/settings.local.json`),e}function q(e){return!!(e?.awsAuthRefresh||e?.awsCredentialExport)}function J(){let e=[];return q(C(`projectSettings`))&&e.push(`.workmate/settings.json`),q(C(`localSettings`))&&e.push(`.workmate/settings.local.json`),e}function Y(e){return!!e?.gcpAuthRefresh}function X(){let e=[];return Y(C(`projectSettings`))&&e.push(`.workmate/settings.json`),Y(C(`localSettings`))&&e.push(`.workmate/settings.local.json`),e}function Z(e){return e?.env?Object.keys(e.env).some(e=>!j.has(e.toUpperCase())):!1}function Q(){let e=[];return Z(C(`projectSettings`))&&e.push(`.workmate/settings.json`),Z(C(`localSettings`))&&e.push(`.workmate/settings.local.json`),e}k();function $({onDone:e,commands:r}){let{servers:i}=s(`project`),a=Object.keys(i).length>0,o=B().length>0,c=H(),l=K().length>0,p=J().length>0,m=X().length>0,h=W().length>0,_=Q().length>0,v=r?.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=r?.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,S=c.length>0||v||b,C=T(),[w,D]=L.useState(null);L.useEffect(()=>{if(w!==null){let e=w,n=setTimeout(()=>t(e));return()=>clearTimeout(n)}},[w]),L.useEffect(()=>{O(`tengu_trust_dialog_shown`,{isHomeDir:I()===y(),hasMcpServers:a,hasHooks:o,hasBashExecution:S,hasApiKeyHelper:l,hasAwsCommands:p,hasGcpCommands:m,hasOtelHeadersHelper:h,hasDangerousEnvVars:_})},[a,o,S,l,p,m,h,_]);function k(t){if(t===`exit`){D(1);return}let n=I()===y();O(`tengu_trust_dialog_accept`,{isHomeDir:n,hasMcpServers:a,hasHooks:o,hasBashExecution:S,hasApiKeyHelper:l,hasAwsCommands:p,hasGcpCommands:m,hasOtelHeadersHelper:h,hasDangerousEnvVars:_}),n?g(!0):E(e=>({...e,hasTrustDialogAccepted:!0})),e()}let A=M(()=>D(1));return f(`confirm:no`,()=>{D(0)},{context:`Confirmation`}),w===null?C?(setTimeout(e),null):(0,R.jsx)(F,{color:`warning`,titleColor:`warning`,title:`Accessing workspace:`,children:(0,R.jsxs)(u,{flexDirection:`column`,gap:1,paddingTop:1,children:[(0,R.jsx)(d,{bold:!0,children:x().cwd()}),(0,R.jsx)(d,{children:`Is this a project you trust? (Your own code, a well-known open source project, or work from your team).`}),(0,R.jsx)(d,{children:`Once trusted, Work Mate can read, edit, and run commands in this folder.`}),(0,R.jsx)(n,{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)(d,{dimColor:!0,children:A.pending?(0,R.jsxs)(R.Fragment,{children:[`Press `,A.keyName,` again to exit`]}):(0,R.jsx)(R.Fragment,{children:`Enter to confirm · Esc to cancel`})})]})}):null}export{$ as TrustDialog};
@@ -1 +0,0 @@
1
- import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{n,t as r}from"./figures-5ThXQEtq.js";import{DS as i,F as a,N as o,OS as s,P as c,_g as l,bg as u,lT as d,oT as f,xg as p}from"./loadAgentsDir-C96o6gCj.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{Ut as x,h as S,rn as C}from"./state-D5D6QpTX.js";import{n as w,t as T}from"./AddWorkspaceDirectory-DgAxYgBY.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)(i,{children:(0,k.jsx)(h,{children:e})})]})}async function D(e,t,n){let r=(n??``).trim(),i=t.getAppState(),s=async(n,r=!1)=>{let i={type:`addDirectories`,directories:[n],destination:r?`localSettings`:`session`},a=l(t.getAppState().toolPermissionContext,i);t.setAppState(e=>({...e,toolPermissionContext:a}));let o=S();o.includes(n)||C([...o,n]),f.refreshConfig();let s;if(r)try{p(i),s=`Added ${_.bold(n)} as a working directory and saved to local settings`}catch(e){s=`Added ${_.bold(n)} as a working directory. Failed to save to local settings: ${e instanceof Error?e.message:`Unknown error`}`}else s=`Added ${_.bold(n)} as a working directory for this session`;e(`${s} ${_.dim(`· /permissions to manage`)}`)};if(!r)return(0,k.jsx)(T,{permissionContext:i.toolPermissionContext,onAddDirectory:s,onCancel:()=>{e(`Did not add a working directory.`)}});let c=await a(r,i.toolPermissionContext);if(c.resultType!==`success`){let t=o(c);return(0,k.jsx)(E,{message:t,args:n??``,onDone:()=>e(t)})}return(0,k.jsx)(T,{directoryPath:c.absolutePath,permissionContext:i.toolPermissionContext,onAddDirectory:s,onCancel:()=>{e(`Did not add ${_.bold(c.absolutePath)} as a working directory.`)}})}var O,k;e((()=>{v(),n(),O=t(g(),1),x(),s(),w(),y(),u(),d(),c(),k=b()}))();export{D as call};
@@ -1,101 +0,0 @@
1
- import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{i as n,o as r}from"./envUtils-DcaKZlRU.js";import{n as i,t as a}from"./figures-5ThXQEtq.js";import{$f as o,AT as s,Ap as c,Bm as l,CS as u,C_ as d,Cf as f,Cp as p,Dl as m,Dm as h,Dp as g,Du as _,Eh as v,El as ee,Fm as y,Im as b,Jb as te,Lu as ne,Mx as re,Nm as ie,Nw as ae,Nx as oe,Oh as se,Om as ce,Op as le,Ou as ue,Pm as de,Q as fe,Ru as pe,Sc as me,Sf as he,Sl as ge,Sp as _e,Tf as ve,Th as ye,Vm as be,X as xe,Yv as Se,Zf as Ce,_p as we,bl as Te,bp as Ee,c as De,dE as Oe,db as ke,ea as Ae,fb as je,gp as Me,ha as Ne,jT as Pe,l as Fe,lE as Ie,lb as Le,lu as Re,np as x,o as ze,qb as Be,r as Ve,rp as S,rt as He,s as Ue,su as We,t as Ge,tt as Ke,uE as qe,ub as Je,vm as Ye,vp as Xe,wS as Ze,w_ as Qe,wf as $e,xc as et,xl as tt,xp as nt,yl as rt,ym as it,yp as at,zS as C}from"./loadAgentsDir-C96o6gCj.js";import{C as ot,D as w,I as T,P as E,T as D,Wt as O,ai as k,di as st,fi as ct,t as A,y as lt}from"./src-DL3w8VPk.js";import{t as j}from"./jsx-runtime-Bb4Xn-E0.js";import{n as ut,t as dt}from"./cwd-Nh5IZNKO.js";import{F as ft,R as pt,S as mt,U as ht,W as gt,Z as _t,x as vt}from"./debug-D58GQBDG.js";import{In as yt,Ln as bt,Yt as xt,Z as St,Zt as Ct,cn as wt,it as Tt,on as Et,q as Dt,rt as Ot}from"./settings-BowI3jp-.js";import{M as kt,P as At}from"./config-DUTgj3js.js";import{o as jt,s as Mt}from"./log-CZ7ploQm.js";import{n as Nt,r as Pt}from"./analytics-DJobLaWP.js";import{C as Ft,v as It}from"./startupProfiler-B90b5vuq.js";import{l as Lt,n as Rt,o as zt}from"./stringUtils-D7oJIyY2.js";import{_n as Bt,vn as Vt}from"./prompt-BNNE5tsG.js";import{Q as Ht}from"./sessionState-8jutEorw.js";import{a as Ut,i as Wt,n as Gt,o as Kt,r as qt,t as Jt}from"./agentDisplay-1Y-N-gqz.js";import{n as Yt,t as Xt}from"./useExitOnCtrlCDWithKeybindings-L5idX6Kz.js";import{n as Zt,t as Qt}from"./useMergedTools-DYXrPTIA.js";import{n as $t,r as en,t as tn}from"./promptEditor-DT6egmcb.js";import{n as nn,t as rn}from"./useMainLoopModel-VXeS2EC6.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(dt(),N.FOLDER_NAME,N.AGENTS_DIR);case`policySettings`:return M(xt(),N.FOLDER_NAME,N.AGENTS_DIR);case`localSettings`:return M(dt(),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`:Fe(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 ft(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(ft(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((()=>{Ct(),ze(),ut(),r(),pt(),cn()}));function Sn({agent:e,tools:t,onBack:n}){let r=Xe(e,t,!1),i=hn(e),o=nt(e.agentType);O(`confirm:no`,n,{context:`Confirmation`});let s=e=>{e.key===`return`&&(e.preventDefault(),n())};function c(){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:s,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`}),`:`,` `]}),c()]}),(0,P.jsxs)(E,{children:[(0,P.jsx)(E,{bold:!0,children:`Model`}),`: `,g(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`}),`: `,Ie(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(`, `)]}),o&&(0,P.jsx)(T,{children:(0,P.jsxs)(E,{children:[(0,P.jsx)(E,{bold:!0,children:`Color`}),`:`,` `,(0,P.jsxs)(E,{backgroundColor:o,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)(Ce,{children:e.getSystemPrompt()})})]})]})}var P,Cn=e((()=>{i(),A(),C(),_e(),qe(),we(),ze(),c(),o(),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:Ee[e],color:`inverseText`,children:` `}),(0,F.jsx)(E,{bold:n,children:Rt(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:Ee[s],color:`inverseText`,bold:!0,children:[` `,`@`,e,` `]})]})]})}var Tn,F,En,Dn=e((()=>{i(),Tn=t(k(),1),A(),_e(),zt(),F=j(),En=[`automatic`,...at]}));function On({initialModel:e,onComplete:t,onCancel:n}){let r=kn.useMemo(()=>{let t=le();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)(_,{options:r,defaultValue:e??`sonnet`,onChange:t,onCancel:()=>n?n():t(void 0)})]})}var kn,An,jn=e((()=>{kn=t(k(),1),A(),c(),ue(),An=j()}));function Mn(){return{READ_ONLY:{name:`Read-only tools`,toolNames:new Set([ie.name,y.name,rt.name,u.name,h.name,ee.name,tt.name,re.name,ke.name])},EDIT:{name:`Edit tools`,toolNames:new Set([$e.name,l.name,he.name])},EXECUTION:{name:`Execution tools`,toolNames:new Set([Ye.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(te(e)){let n=Tt(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)(()=>Me({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=>{te(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=yt(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=yt(n,e=>p.has(e.name))===n.length;y.push({id:e,label:`${r?a.checkboxOn:a.checkboxOff} ${t}`,action:ee(n)})});let ne=y.length;y.push({id:`toggle-individual`,label:u?`Hide advanced options`:`Show advanced options`,action:()=>{d(!u),u&&c>ne&&l(ne)},isToggle:!0});let re=(0,I.useMemo)(()=>Nn(i),[i]);return u&&(re.length>0&&(y.push({id:`mcp-servers-header`,label:`MCP Servers:`,action:()=>{},isHeader:!0}),re.forEach(({serverName:e,tools:t})=>{let n=yt(t,e=>p.has(e.name))===t.length;y.push({id:`mcp-server-${e}`,label:`${n?a.checkboxOn:a.checkboxOff} ${e} (${t.length} ${Lt(t.length,`tool`)})`,action:()=>{let e=t.map(e=>e.name);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=Tt(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)(ot,{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)(ot,{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),Ot(),Be(),we(),St(),it(),Te(),ve(),Ze(),be(),de(),b(),oe(),f(),je(),ge(),m(),ce(),A(),C(),bt(),zt(),L=j()}));function In(e){return e===`all`?`Agents`:e===`built-in`?`Built-in agents`:e===`plugin`?`Plugin agents`:s(Et(e))}var Ln=e((()=>{Pe(),wt()}));function Rn({agent:e,tools:t,onSaved:n,onBack:r}){let i=se(),[o,s]=(0,R.useState)(`menu`),[c,l]=(0,R.useState)(0),[u,d]=(0,R.useState)(null),[f,m]=(0,R.useState)(e.color),h=(0,R.useCallback)(async()=>{let t=await tn(pn(e));t.error?d(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??f,c=r!==void 0,l=o!==void 0,u=s!==e.color;if(!c&&!l&&!u)return!1;try{return!De(e)&&!Fe(e)?!1:(await vn(e,e.whenToUse,r??e.tools,e.getSystemPrompt(),s,o??e.model),u&&s&&p(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: ${st.bold(e.agentType)}`),!0)}catch(e){return d(e instanceof Error?e.message:`Failed to save agent`),!1}},[e,f,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)(()=>{d(null),o===`menu`?r():s(`menu`)},[o,r]),ee=(0,R.useCallback)(e=>{if(e.key===`up`)e.preventDefault(),l(e=>Math.max(0,e-1));else if(e.key===`down`)e.preventDefault(),l(e=>Math.min(_.length-1,e+1));else if(e.key===`return`){e.preventDefault();let t=_[c];t&&t.action()}},[_,c]);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===c?`suggestion`:void 0,children:[t===c?`${a.pointer} `:` `,e.label]},e.label))}),u&&(0,z.jsx)(T,{marginTop:1,children:(0,z.jsx)(E,{color:`error`,children:u})})]});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:f||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((()=>{ct(),i(),R=t(k(),1),ye(),A(),C(),_e(),ze(),en(),xn(),Dn(),jn(),Fn(),Ln(),z=j()}));function Bn({instructions:e=`Press ↑↓ to navigate · Enter to select · Esc to go back`}){let t=Yt();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((()=>{Xt(),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(Gt),[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=Ut(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 `,qt(i)]})]},`${e.agentType}-${e.source}`)},h=Wn.useMemo(()=>{let t=d.filter(e=>e.source!==`built-in`);return e===`all`?Jt.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)(lt,{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)(ot,{}),_()]})]})}):(0,B.jsxs)(lt,{title:ee,subtitle:`${yt(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:[Jt.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)(ot,{}),_()]})]})]})]})}var Wn,B,Gn=e((()=>{i(),Wn=t(k(),1),A(),Wt(),bt(),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)([]);Yt(),(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),Xt(),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)(x,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`})]})}){let t=Yt();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((()=>{Xt(),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)(lt,{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)(x,{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(),C(),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=Xe(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((()=>{we(),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=Ft(c.getSystemPrompt(),240),d=Ft(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=At()?(0,q.jsxs)(E,{children:[(0,q.jsx)(E,{bold:!0,children:`Memory`}),`: `,Ie(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)(x,{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`}),`: `,g(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(),C(),kt(),qe(),It(),c(),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=se(),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}}}),Ge(),e&&await tn(fn({source:r.location,agentType:r.finalAgent.agentType})),Pt(`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: ${st.bold(r.finalAgent.agentType)} and opened in editor. If you made edits, restart to load the latest version.`:`Created agent: ${st.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((()=>{ct(),ur=t(k(),1),Nt(),ye(),ze(),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)(x,{action:`chat:externalEditor`,context:`Chat`,fallback:`ctrl+g`,description:`open in editor`}),(0,J.jsx)(x,{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)(ne,{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(),C(),en(),S(),pe(),G(),W(),J=j()}));async function gr(e,t,n,r){let i=ae({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=At()?_r+vr:_r,c=await fe({messages:Ne(o),systemPrompt:Ht([s]),thinkingConfig:{type:`disabled`},tools:[],signal:r,options:{getToolPermissionContext:async()=>Bt(),model:t,toolChoice:void 0,agents:[],isNonInteractiveSession:!1,hasAppendSystemPrompt:!1,querySource:`agent_creation`,mcpTools:[]}}),l=(Array.isArray(c.message.content)?c.message.content:[]).filter(e=>e.type===`text`).map(e=>e.text).join(`
9
- `),u;try{u=mt(l.trim())}catch{let e=l.match(/\{[\s\S]*\}/);if(!e)throw Error(`No JSON object found in response`);u=mt(e[0])}if(!u.identifier||!u.whenToUse||!u.systemPrompt)throw Error(`Invalid agent configuration generated`);return Pt(`tengu_agent_definition_generated`,{agent_identifier:u.identifier}),{identifier:u.identifier,whenToUse:u.whenToUse,systemPrompt:u.systemPrompt}}var _r,vr,yr=e((()=>{Qe(),xe(),Vt(),St(),Ke(),Ae(),kt(),Nt(),vt(),Se(),_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 ${Dt} 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 ${Dt} 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=Le();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 _t||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)(x,{action:`confirm:no`,context:`Settings`,fallback:`Esc`,description:`cancel`}),children:(0,X.jsxs)(T,{flexDirection:`row`,alignItems:`center`,children:[(0,X.jsx)(We,{}),(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)(x,{action:`confirm:yes`,context:`Confirmation`,fallback:`Enter`,description:`submit`}),(0,X.jsx)(x,{action:`chat:externalEditor`,context:`Chat`,fallback:`ctrl+g`,description:`open in editor`}),(0,X.jsx)(x,{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)(ne,{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((()=>{gt(),Y=t(k(),1),rn(),A(),C(),Je(),en(),S(),Re(),pe(),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)(x,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})]}),children:(0,Cr.jsx)(T,{children:(0,Cr.jsx)(_,{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(),ue(),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)(x,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`})]}),children:(0,Er.jsx)(T,{children:(0,Er.jsx)(_,{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:At()&&i&&a?()=>`${r.systemPrompt}\n\n${Oe(a,i)}`:()=>r.systemPrompt}:void 0}),e()},onCancel:t},`memory-select`)})})}var Er,Dr=e((()=>{A(),C(),kt(),qe(),S(),ue(),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)(x,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`})]}),children:(0,kr.jsx)(T,{children:(0,kr.jsx)(_,{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(),ue(),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)(x,{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)(x,{action:`chat:externalEditor`,context:`Chat`,fallback:`ctrl+g`,description:`open in editor`}),(0,Z.jsx)(x,{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)(ne,{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(),C(),en(),S(),pe(),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)(x,{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)(x,{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)(ne,{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(),C(),S(),pe(),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,...At()?[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((()=>{kt(),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=v(e=>e.agentDefinitions),a=v(e=>e.mcp.tools),o=v(e=>e.toolPermissionContext),s=se(),{allAgents:c,activeAgents:l}=i,[u,d]=(0,qr.useState)([]),f=Zt(e,a,o);Yt();let p=(0,qr.useMemo)(()=>({"built-in":c.filter(e=>e.source===`built-in`),userSettings:c.filter(e=>e.source===`userSettings`),projectSettings:c.filter(e=>e.source===`projectSettings`),policySettings:c.filter(e=>e.source===`policySettings`),localSettings:c.filter(e=>e.source===`localSettings`),flagSettings:c.filter(e=>e.source===`flagSettings`),plugin:c.filter(e=>e.source===`plugin`),all:c}),[c]),m=(0,qr.useCallback)(e=>{d(t=>[...t,e]),r({mode:`list-agents`,source:`all`})},[]),h=(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)}}}),d(t=>[...t,`Deleted agent: ${st.bold(e.agentType)}`]),r({mode:`list-agents`,source:`all`})}catch(e){Mt(ht(e))}},[s]);switch(n.mode){case`list-agents`:{let e=Kt(n.source===`all`?[...p[`built-in`],...p.userSettings,...p.projectSettings,...p.localSettings,...p.policySettings,...p.flagSettings,...p.plugin]:p[n.source],l);return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Un,{source:n.source,agents:e,onBack:()=>{t((u.length>0?`Agent changes:\n${u.join(`
101
- `)}`:void 0)??`Agents dialog dismissed`,{display:u.length===0?`system`:void 0})},onSelect:e=>r({mode:`agent-menu`,agent:e,previousMode:n}),onCreateNew:()=>r({mode:`create-agent`}),changes:u}),(0,$.jsx)(Bn,{})]})}case`create-agent`:return(0,$.jsx)(Ur,{tools:f,existingAgents:l,onComplete:m,onCancel:()=>r({mode:`list-agents`,source:`all`})});case`agent-menu`:{let e=c.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)(lt,{title:n.agent.agentType,onCancel:()=>r(n.previousMode),hideInputGuide:!0,children:(0,$.jsxs)(T,{flexDirection:`column`,children:[(0,$.jsx)(_,{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)}),u.length>0&&(0,$.jsx)(T,{marginTop:1,children:(0,$.jsx)(E,{dimColor:!0,children:u[u.length-1]})})]})}),(0,$.jsx)(Bn,{})]})}case`view-agent`:{let e=c.find(e=>e.agentType===n.agent.agentType&&e.source===n.agent.source)||n.agent;return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(lt,{title:e.agentType,onCancel:()=>r({mode:`agent-menu`,agent:e,previousMode:n.previousMode}),hideInputGuide:!0,children:(0,$.jsx)(Sn,{agent:e,tools:f,allAgents:c,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)(lt,{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)(_,{options:[{label:`Yes, delete`,value:`yes`},{label:`No, cancel`,value:`no`}],onChange:e=>{e===`yes`?h(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=c.find(e=>e.agentType===n.agent.agentType&&e.source===n.agent.source)||n.agent;return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(lt,{title:`Edit agent: ${e.agentType}`,onCancel:()=>r(n.previousMode),hideInputGuide:!0,children:(0,$.jsx)(Rn,{agent:e,tools:f,onSaved:e=>{m(e),r(n.previousMode)},onBack:()=>r(n.previousMode)})}),(0,$.jsx)(Bn,{})]})}default:return null}}var qr,$,Jr=e((()=>{ct(),qr=t(k(),1),Xt(),Qt(),A(),ye(),Wt(),ze(),pt(),jt(),ue(),Cn(),zn(),Hn(),Gn(),xn(),Gr(),$=j()}));async function Yr(e,t){let n=t.getAppState().toolPermissionContext;return(0,Xr.jsx)(Kr,{tools:et(n),onExit:e})}var Xr;e((()=>{Jr(),me(),Xr=j()}))();export{Yr as call};
@@ -1 +0,0 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{ox as t,rx as n}from"./loadAgentsDir-C96o6gCj.js";import{h as r,l as i}from"./settings-BowI3jp-.js";function a(){let e=i(),t=[`user`,`project`,`local`].flatMap(e=>n(e).errors);return{settings:e.settings,errors:[...e.errors,...t]}}var o=e((()=>{t(),r()}));export{o as n,a as t};
@@ -1 +0,0 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{n as t,t as n}from"./axios-DaWTGg7G.js";import{i as r,n as i,r as a,t as o}from"./lazySchema-DULtBUCI.js";import{C as s,P as c,R as l,U as u,c as d,i as f,x as p}from"./debug-D58GQBDG.js";import{h as m}from"./config-DUTgj3js.js";import{o as h,s as g}from"./log-CZ7ploQm.js";import{l as _,u as v}from"./oauth-D38aRTUb.js";import{Dr as y,Or as b,Pt as x,St as S,dn as C,fn as w}from"./model-BaMclMXn.js";import{a as T,i as E}from"./detectRepository-pRAVv8SH.js";import{randomUUID as D}from"crypto";function O(e){return t.isAxiosError(e)?!e.response||e.response.status>=500:!1}async function k(e,n){let r;for(let i=0;i<=R;i++)try{return await t.get(e,n)}catch(e){if(r=e,!O(e))throw e;if(i>=R)throw d(`Teleport request failed after ${i+1} attempts: ${c(e)}`),e;let t=L[i]??2e3;d(`Teleport request failed (attempt ${i+1}/${R+1}), retrying in ${t}ms: ${c(e)}`),await w(t)}throw r}async function A(){let e=S()?.accessToken;if(e===void 0)throw Error(`Work Mate web sessions require authentication with a Claude.ai account. API key authentication is not sufficient.`);let t=await y();if(!t)throw Error(`Unable to get organization UUID`);return{accessToken:e,orgUUID:t}}async function j(){let{accessToken:e,orgUUID:t}=await A(),n=`${_().BASE_API_URL}/v1/sessions`;try{let r=await k(n,{headers:{...M(e),"anthropic-beta":`ccr-byoc-2025-07-29`,"x-organization-uuid":t}});if(r.status!==200)throw Error(`Failed to fetch code sessions: ${r.statusText}`);return r.data.data.map(e=>{let t=e.session_context.sources.find(e=>e.type===`git_repository`),n=null;if(t?.url){let e=T(t.url);if(e){let[r,i]=e.split(`/`);r&&i&&(n={name:i,owner:{login:r},default_branch:t.revision||void 0})}}return{id:e.id,title:e.title||`Untitled`,description:``,status:e.session_status,repo:n,turns:[],created_at:e.created_at,updated_at:e.updated_at}})}catch(e){throw g(u(e)),e}}function M(e){return{Authorization:`Bearer ${e}`,"Content-Type":`application/json`,"anthropic-version":`2023-06-01`}}async function N(e){let{accessToken:n,orgUUID:r}=await A(),i=`${_().BASE_API_URL}/v1/sessions/${e}`,a={...M(n),"anthropic-beta":`ccr-byoc-2025-07-29`,"x-organization-uuid":r},o=await t.get(i,{headers:a,timeout:15e3,validateStatus:e=>e<500});if(o.status!==200){let t=o.data?.error?.message;throw o.status===404?Error(`Session not found: ${e}`):o.status===401?Error(`Session expired.`):Error(t||`Failed to fetch session: ${o.status} ${o.statusText}`)}return o.data}function P(e){return(e.session_context.outcomes?.find(e=>e.type===`git_repository`))?.git_info?.branches[0]}async function F(e,n,r){try{let{accessToken:i,orgUUID:a}=await A(),o=`${_().BASE_API_URL}/v1/sessions/${e}/events`,c={...M(i),"anthropic-beta":`ccr-byoc-2025-07-29`,"x-organization-uuid":a},l={events:[{uuid:r?.uuid??D(),session_id:e,type:`user`,parent_tool_use_id:null,message:{role:`user`,content:n}}]};d(`[sendEventToRemoteSession] Sending event to session ${e}`);let u=await t.post(o,l,{headers:c,validateStatus:e=>e<500,timeout:3e4});return u.status===200||u.status===201?(d(`[sendEventToRemoteSession] Successfully sent event to session ${e}`),!0):(d(`[sendEventToRemoteSession] Failed with status ${u.status}: ${s(u.data)}`),!1)}catch(e){return d(`[sendEventToRemoteSession] Error: ${c(e)}`),!1}}async function I(e,n){try{let{accessToken:r,orgUUID:i}=await A(),a=`${_().BASE_API_URL}/v1/sessions/${e}`,o={...M(r),"anthropic-beta":`ccr-byoc-2025-07-29`,"x-organization-uuid":i};d(`[updateSessionTitle] Updating title for session ${e}: "${n}"`);let c=await t.patch(a,{title:n},{headers:o,validateStatus:e=>e<500});return c.status===200?(d(`[updateSessionTitle] Successfully updated title for session ${e}`),!0):(d(`[updateSessionTitle] Failed with status ${c.status}: ${s(c.data)}`),!1)}catch(e){return d(`[updateSessionTitle] Error: ${c(e)}`),!1}}var L,R,z=e((()=>{n(),v(),b(),a(),x(),m(),f(),E(),l(),o(),h(),C(),p(),L=[2e3,4e3,8e3,16e3],R=L.length,i(()=>r.object({id:r.string(),title:r.string(),description:r.string(),status:r.enum([`idle`,`working`,`waiting`,`completed`,`archived`,`cancelled`,`rejected`]),repo:r.object({name:r.string(),owner:r.object({login:r.string()}),default_branch:r.string().optional()}).nullable(),turns:r.array(r.string()),created_at:r.string(),updated_at:r.string()}))}));export{M as a,A as c,P as i,F as l,j as n,z as o,N as r,O as s,k as t,I as u};
@@ -1 +0,0 @@
1
- import{a as e,o as t}from"./api-DTyrmy1O.js";t();export{e as getOAuthHeaders};
@@ -1,10 +0,0 @@
1
- import{d as e,o as t}from"./envUtils-DcaKZlRU.js";import{n,t as r}from"./defineProperty-C-QyHrDq.js";import{n as i,t as a}from"./axios-DaWTGg7G.js";import{Ax as o,Md as s,jd as c,kx as l}from"./loadAgentsDir-C96o6gCj.js";import{C as ee,P as u,R as te,c as d,i as ne,x as f}from"./debug-D58GQBDG.js";import{h as p,t as m}from"./settings-BowI3jp-.js";import{c as h,h as g,y as _}from"./config-DUTgj3js.js";import{o as v,s as y}from"./log-CZ7ploQm.js";import{n as b,r as x}from"./analytics-DJobLaWP.js";import{l as S,u as C}from"./oauth-D38aRTUb.js";import{$r as re,Ar as w,Cr as ie,Er as ae,Ir as oe,Lr as se,Mr as ce,Nr as T,Or as E,Pr as D,Pt as O,Sr as k,St as A,Tn as j,Tr as M,Tt as N,Xn as P,Xt as F,_n as I,bn as L,cn as R,gn as z,gt as B,in as V,kt as H,on as U,pt as W,qn as G,sn as K,ti as le,un as ue,wr as de,xt as fe}from"./model-BaMclMXn.js";import{n as pe,t as me}from"./userAgent-NbKd-hN7.js";import{F as q,T as he}from"./sessionState-8jutEorw.js";import{d as ge,u as _e}from"./firstPartyEventLogger-B261Wksn.js";import{n as ve}from"./trustedDevice-C1m--Yjw.js";import{i as ye,r as be}from"./grove-DqTnK9nn.js";import{t as xe}from"./remoteManagedSettings-DyGVvvcW.js";import{d as Se,n as Ce,t as we}from"./status-0ZBx6Ls0.js";import{createHash as Te,randomBytes as J}from"crypto";import{createServer as Ee}from"http";s(),O(),j(),g(),I(),ue(),_e();async function Y(){A.cache?.clear?.(),ve(),L(),R(),ge(),be.cache?.clear?.(),ye.cache?.clear?.(),await xe(),await c()}async function De({clearOnboarding:e=!1}){let{flushTelemetry:t}=await import(`./instrumentation-BaRKojJh.js`);await t(),await V(),z().delete(),await Y(),_(t=>{let n={...t};return e&&(n.hasCompletedOnboarding=!1,n.subscriptionNoticeCount=0,n.hasAvailableSubscription=!1,n.customApiKeyResponses?.approved&&(n.customApiKeyResponses={...n.customApiKeyResponses,approved:[]})),n.oauthAccount=void 0,n})}t(),n(),te(),f(),ne(),b(),p(),le(),se(),E(),he(),a(),C(),g(),P(),v(),pe();async function Oe(){try{if(h().claudeCodeFirstTokenDate!==void 0)return;let e=G();if(e.error){y(Error(`Failed to get auth headers: ${e.error}`));return}let t=`${S().BASE_API_URL}/api/organization/claude_code_first_token_date`,n=(await i.get(t,{headers:{...e.headers,"User-Agent":me()},timeout:1e4})).data?.first_token_date??null;if(n!==null){let e=new Date(n).getTime();if(isNaN(e)){y(Error(`Received invalid first_token_date from API: ${n}`));return}}_(e=>({...e,claudeCodeFirstTokenDate:n}))}catch(e){y(e)}}l(),C(),v();var ke=class{constructor(e=`/callback`){r(this,`localServer`,void 0),r(this,`port`,0),r(this,`promiseResolver`,null),r(this,`promiseRejecter`,null),r(this,`expectedState`,null),r(this,`pendingResponse`,null),r(this,`callbackPath`,void 0),this.localServer=Ee(),this.callbackPath=e}async start(e){return new Promise((t,n)=>{this.localServer.once(`error`,e=>{n(Error(`Failed to start OAuth callback server: ${e.message}`))}),this.localServer.listen(e??0,`localhost`,()=>{let e=this.localServer.address();this.port=e.port,t(this.port)})})}getPort(){return this.port}hasPendingResponse(){return this.pendingResponse!==null}async waitForAuthorization(e,t){return new Promise((n,r)=>{this.promiseResolver=n,this.promiseRejecter=r,this.expectedState=e,this.startLocalListener(t)})}handleSuccessRedirect(e,t){if(!this.pendingResponse)return;if(t){t(this.pendingResponse,e),this.pendingResponse=null,x(`tengu_oauth_automatic_redirect`,{custom_handler:!0});return}let n=T(e)?S().CLAUDEAI_SUCCESS_URL:S().CONSOLE_SUCCESS_URL;this.pendingResponse.writeHead(302,{Location:n}),this.pendingResponse.end(),this.pendingResponse=null,x(`tengu_oauth_automatic_redirect`,{})}handleErrorRedirect(){if(!this.pendingResponse)return;let e=S().CLAUDEAI_SUCCESS_URL;this.pendingResponse.writeHead(302,{Location:e}),this.pendingResponse.end(),this.pendingResponse=null,x(`tengu_oauth_automatic_redirect_error`,{})}startLocalListener(e){this.localServer.on(`request`,this.handleRedirect.bind(this)),this.localServer.on(`error`,this.handleError.bind(this)),e()}handleRedirect(e,t){let n=new URL(e.url||``,`http://${e.headers.host||`localhost`}`);if(n.pathname!==this.callbackPath){t.writeHead(404),t.end();return}let r=n.searchParams.get(`code`)??void 0,i=n.searchParams.get(`state`)??void 0;this.validateAndRespond(r,i,t)}validateAndRespond(e,t,n){if(!e){n.writeHead(400),n.end(`Authorization code not found`),this.reject(Error(`No authorization code received`));return}if(t!==this.expectedState){n.writeHead(400),n.end(`Invalid state parameter`),this.reject(Error(`Invalid state parameter`));return}this.pendingResponse=n,this.resolve(e)}handleError(e){y(e),this.close(),this.reject(e)}resolve(e){this.promiseResolver&&(this.promiseResolver(e),this.promiseResolver=null,this.promiseRejecter=null)}reject(e){this.promiseRejecter&&(this.promiseRejecter(e),this.promiseResolver=null,this.promiseRejecter=null)}close(){this.pendingResponse&&this.handleErrorRedirect(),this.localServer&&(this.localServer.removeAllListeners(),this.localServer.close())}};function X(e){return e.toString(`base64`).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=/g,``)}function Z(){return X(J(32))}function Ae(e){let t=Te(`sha256`);return t.update(e),X(t.digest())}function je(){return X(J(32))}b(),E(),n();var Q=class{constructor(){r(this,`codeVerifier`,void 0),r(this,`authCodeListener`,null),r(this,`port`,null),r(this,`manualAuthCodeResolver`,null),this.codeVerifier=Z()}async startOAuthFlow(e,t){this.authCodeListener=new ke,this.port=await this.authCodeListener.start();let n=Ae(this.codeVerifier),r=je(),i={codeChallenge:n,state:r,port:this.port,loginWithClaudeAi:t?.loginWithClaudeAi,inferenceOnly:t?.inferenceOnly,orgUUID:t?.orgUUID,loginHint:t?.loginHint,loginMethod:t?.loginMethod},a=k({...i,isManual:!0}),s=k({...i,isManual:!1}),c=await this.waitForAuthorizationCode(r,async()=>{t?.skipBrowserOpen?await e(a,s):(await e(a),await o(s))}),l=this.authCodeListener?.hasPendingResponse()??!1;x(`tengu_oauth_auth_code_received`,{automatic:l});try{let e=await de(c,r,this.codeVerifier,this.port,!l,t?.expiresIn),n=await ae(e.access_token);if(l){let t=w(e.scope);this.authCodeListener?.handleSuccessRedirect(t)}return this.formatTokens(e,n.subscriptionType,n.rateLimitTier,n.rawProfile)}catch(e){throw l&&this.authCodeListener?.handleErrorRedirect(),e}finally{this.authCodeListener?.close()}}async waitForAuthorizationCode(e,t){return new Promise((n,r)=>{this.manualAuthCodeResolver=n,this.authCodeListener?.waitForAuthorization(e,t).then(e=>{this.manualAuthCodeResolver=null,n(e)}).catch(e=>{this.manualAuthCodeResolver=null,r(e)})})}handleManualAuthCodeInput(e){this.manualAuthCodeResolver&&(this.manualAuthCodeResolver(e.authorizationCode),this.manualAuthCodeResolver=null,this.authCodeListener?.close())}formatTokens(e,t,n,r){return{accessToken:e.access_token,refreshToken:e.refresh_token,expiresAt:Date.now()+e.expires_in*1e3,scopes:w(e.scope),subscriptionType:t,rateLimitTier:n,profile:r,tokenAccount:e.account?{uuid:e.account.uuid,emailAddress:e.account.email_address,organizationUuid:e.organization?.uuid}:void 0}}cleanup(){this.authCodeListener?.close(),this.manualAuthCodeResolver=null}};b(),E(),O(),g(),v(),Se();async function $(e){await De({clearOnboarding:!1});let t=e.profile??await oe(e.accessToken);t?D({accountUuid:t.account.uuid,emailAddress:t.account.email,organizationUuid:t.organization.uuid,displayName:t.account.display_name||void 0,hasExtraUsageEnabled:t.organization.has_extra_usage_enabled??void 0,billingType:t.organization.billing_type??void 0,subscriptionCreatedAt:t.organization.subscription_created_at??void 0,accountCreatedAt:t.account.created_at}):e.tokenAccount&&D({accountUuid:e.tokenAccount.uuid,emailAddress:e.tokenAccount.emailAddress,organizationUuid:e.tokenAccount.organizationUuid});let n=U(e);if(W(),n.warning&&x(`tengu_oauth_storage_warning`,{warning:n.warning}),await M(e.accessToken).catch(e=>d(String(e),{level:`error`})),T(e.scopes))await Oe().catch(e=>d(String(e),{level:`error`}));else if(!await ie(e.accessToken))throw Error(`Unable to create API key. The server accepted the request but did not return a key.`);await Y()}async function Me({email:e,sso:t,console:n,claudeai:r}){n&&r&&(process.stderr.write(`Error: --console and --claudeai cannot be used together.
2
- `),process.exit(1));let i=m(),a=i.forceLoginMethod?i.forceLoginMethod===`claudeai`:!n,o=i.forceLoginOrgUUID,s=process.env.CLAUDE_CODE_OAUTH_REFRESH_TOKEN;if(s){let e=process.env.CLAUDE_CODE_OAUTH_SCOPES;e||(process.stderr.write(`CLAUDE_CODE_OAUTH_SCOPES is required when using CLAUDE_CODE_OAUTH_REFRESH_TOKEN.
3
- Set it to the space-separated scopes the refresh token was issued with
4
- (e.g. "user:inference" or "user:profile user:inference user:sessions:claude_code user:mcp_servers").
5
- `),process.exit(1));let t=e.split(/\s+/).filter(Boolean);try{x(`tengu_login_from_refresh_token`,{});let e=await ce(s,{scopes:t});await $(e);let n=await K();n.valid||(process.stderr.write(`${n.message}\n`),process.exit(1)),_(e=>e.hasCompletedOnboarding?e:{...e,hasCompletedOnboarding:!0}),x(`tengu_oauth_success`,{loginWithClaudeAi:T(e.scopes)}),process.stdout.write(`Login successful.
6
- `),process.exit(0)}catch(e){y(e);let t=q(e);process.stderr.write(`Login failed: ${u(e)}\n${t?`${t}\n`:``}`),process.exit(1)}}let c=t?`sso`:void 0,l=new Q;try{x(`tengu_oauth_flow_start`,{loginWithClaudeAi:a}),await $(await l.startOAuthFlow(async e=>{process.stdout.write(`Opening browser to sign in…
7
- `),process.stdout.write(`If the browser didn't open, visit: ${e}\n`)},{loginWithClaudeAi:a,loginHint:e,loginMethod:c,orgUUID:o}));let t=await K();t.valid||(process.stderr.write(`${t.message}\n`),process.exit(1)),x(`tengu_oauth_success`,{loginWithClaudeAi:a}),process.stdout.write(`Login successful.
8
- `),process.exit(0)}catch(e){y(e);let t=q(e);process.stderr.write(`Login failed: ${u(e)}\n${t?`${t}\n`:``}`),process.exit(1)}finally{l.cleanup()}}async function Ne(t){let{source:n,hasToken:r}=fe(),{source:i}=B(),a=!!process.env.ANTHROPIC_API_KEY&&!e(),o=N(),s=H(),c=F(),l=r||i!==`none`||a||c,u=`none`;if(c?u=`third_party`:n===`claude.ai`?u=`claude.ai`:n===`apiKeyHelper`?u=`api_key_helper`:n===`none`?i===`ANTHROPIC_API_KEY`||a?u=`api_key`:i===`/login managed key`&&(u=`claude.ai`):u=`oauth_token`,t.text){let e=[...Ce(),...we()],t=!1;for(let n of e){let e=typeof n.value==`string`?n.value:Array.isArray(n.value)?n.value.join(`, `):null;e===null||e===`none`||(t=!0,n.label?process.stdout.write(`${n.label}: ${e}\n`):process.stdout.write(`${e}\n`))}!t&&a&&process.stdout.write(`API key: ANTHROPIC_API_KEY
9
- `),l||process.stdout.write(`Not logged in.
10
- `)}else{let e=re(),t=i===`none`?a?`ANTHROPIC_API_KEY`:null:i,n={loggedIn:l,authMethod:u,apiProvider:e};t&&(n.apiKeySource=t),u===`claude.ai`&&(n.email=o?.emailAddress??null,n.orgId=o?.organizationUuid??null,n.orgName=o?.organizationName??null,n.subscriptionType=s??null),process.stdout.write(`${ee(n,null,2)}\n`)}process.exit(+!l)}export{Q as i,Ne as n,$ as r,Me as t};
@@ -1 +0,0 @@
1
- import{n as e,t}from"./auth-CZ4EsFWF.js";export{t as authLogin,e as authStatus};
@@ -1 +0,0 @@
1
- import{At as e,Pt as t,St as n,ct as r,pt as i}from"./model-BaMclMXn.js";t();export{r as checkAndRefreshOAuthTokenIfNeeded,i as clearOAuthTokenCache,n as getClaudeAIOAuthTokens,e as handleOAuth401Error};
@@ -1,17 +0,0 @@
1
- import{i as e,o as t}from"./envUtils-DcaKZlRU.js";import{$s as n,Df as r,Lp as i,Nw as a,Q as o,Qs as s,St as c,X as l,YS as u,Yv as d,ZS as ee,br as te,dt as ne,ea as f,hd as p,hw as m,kf as h,lb as g,lr as _,md as v,mw as re,ub as ie}from"./loadAgentsDir-C96o6gCj.js";import{L as y,U as b,Ut as x}from"./state-D5D6QpTX.js";import{n as ae,t as oe}from"./cwd-Nh5IZNKO.js";import{R as S,U as C,c as w,f as T,i as E,u as D,x as O}from"./debug-D58GQBDG.js";import{d as k,h as A,v as j}from"./settings-BowI3jp-.js";import{S as M}from"./config-DUTgj3js.js";import{o as N,s as P,v as F,y as I}from"./log-CZ7ploQm.js";import{n as L,r as R}from"./analytics-DJobLaWP.js";import{_ as z,h as B}from"./model-BaMclMXn.js";import{_n as V,vn as H}from"./prompt-BNNE5tsG.js";import{Q as U}from"./sessionState-8jutEorw.js";import{i as W,t as G}from"./nativeInstaller-CfZ5uNTh.js";import{n as se,t as K}from"./allErrors-CT2dbBF3.js";import{r as ce}from"./magicDocs-DmPNMnNY.js";import{n as le,t as ue}from"./pluginAutoupdate-aLXhSUVD.js";import{n as de}from"./registerProtocol-BOEYaX-X.js";import"os";import{join as q}from"path";import"crypto";t(),x(),ae(),O(),T(),E(),I(),A(),H(),z(),n(),te(),ce(),l(),N(),S(),f(),d(),l(),ie(),S(),N(),f(),d(),i();async function fe(e,t){if(!e)return;let{join:n}=await import(`path`),r=await import(`fs/promises`),i=n(oe(),`.workmate`,`skills`,e,`SKILL.md`),s;try{s=await r.readFile(i,`utf-8`)}catch{P(Error(`Failed to read skill file for improvement: ${i}`));return}let c=t.map(e=>`- ${e.section}: ${e.change}`).join(`
2
- `),l=B(),u=await o({messages:[a({content:`You are editing a skill definition file. Apply the following improvements to the skill.
3
-
4
- <current_skill_file>
5
- ${s}
6
- </current_skill_file>
7
-
8
- <improvements>
9
- ${c}
10
- </improvements>
11
-
12
- Rules:
13
- - Integrate the improvements naturally into the existing structure
14
- - Preserve frontmatter (--- block) exactly as-is
15
- - Preserve the overall format and style
16
- - Do not remove existing content unless an improvement explicitly replaces it
17
- - Output the complete updated file inside <updated_file> tags`})],systemPrompt:U([`You edit skill definition files to incorporate user preferences. Output only the updated file content.`]),thinkingConfig:{type:`disabled`},tools:[],signal:g().signal,options:{getToolPermissionContext:async()=>V(),model:l,toolChoice:void 0,isNonInteractiveSession:!1,hasAppendSystemPrompt:!1,temperatureOverride:0,agents:[],querySource:`skill_improvement_apply`,mcpTools:[]}}),d=re(m(Array.isArray(u.message.content)?u.message.content:[]).trim(),`updated_file`);if(!d){P(Error(`Skill improvement apply: no updated_file tag in response`));return}try{await r.writeFile(i,d,`utf-8`)}catch(e){P(C(e))}}L(),h(),M(),N(),G(),p(),se(),ee(),c();var pe=30;function J(){let e=((k()||{}).cleanupPeriodDays??pe)*24*60*60*1e3;return new Date(Date.now()-e)}function me(e,t){return{messages:e.messages+t.messages,errors:e.errors+t.errors}}function he(e){let t=e.split(`.`)[0].replace(/T(\d{2})-(\d{2})-(\d{2})-(\d{3})Z/,`T$1:$2:$3.$4Z`);return new Date(t)}async function Y(e,t,n){let r={messages:0,errors:0};try{let i=await D().readdir(e);for(let a of i)try{he(a.name)<t&&(await D().unlink(q(e,a.name)),n?r.messages++:r.errors++)}catch(e){P(e)}}catch(e){e instanceof Error&&`code`in e&&e.code!==`ENOENT`&&P(e)}return r}async function ge(){let e=D(),t=J(),n=F.errors(),r=F.baseLogs(),i=await Y(n,t,!1);try{let n;try{n=await e.readdir(r)}catch{return i}let a=n.filter(e=>e.isDirectory()&&e.name.startsWith(`mcp-logs-`)).map(e=>q(r,e.name));for(let n of a)i=me(i,await Y(n,t,!0)),await Z(n,e)}catch(e){e instanceof Error&&`code`in e&&e.code!==`ENOENT`&&P(e)}return i}async function X(e,t,n){return(await n.stat(e)).mtime<t?(await n.unlink(e),!0):!1}async function Z(e,t){try{await t.rmdir(e)}catch{}}async function _e(){let e=J(),t={messages:0,errors:0},n=_(),r=D(),i;try{i=await r.readdir(n)}catch{return t}for(let a of i){if(!a.isDirectory())continue;let i=q(n,a.name),o;try{o=await r.readdir(i)}catch{t.errors++;continue}for(let n of o)if(n.isFile()){if(!n.name.endsWith(`.jsonl`)&&!n.name.endsWith(`.cast`))continue;try{await X(q(i,n.name),e,r)&&t.messages++}catch{t.errors++}}else if(n.isDirectory()){let a=q(i,n.name),o=q(a,u),s;try{s=await r.readdir(o)}catch{await Z(a,r);continue}for(let n of s)if(n.isFile())try{await X(q(o,n.name),e,r)&&t.messages++}catch{t.errors++}else if(n.isDirectory()){let i=q(o,n.name),a;try{a=await r.readdir(i)}catch{continue}for(let n of a)if(n.isFile())try{await X(q(i,n.name),e,r)&&t.messages++}catch{t.errors++}await Z(i,r)}await Z(o,r),await Z(a,r)}await Z(i,r)}return t}async function Q(e,t,n=!0){let r=J(),i={messages:0,errors:0},a=D(),o;try{o=await a.readdir(e)}catch{return i}for(let n of o)if(!(!n.isFile()||!n.name.endsWith(t)))try{await X(q(e,n.name),r,a)&&i.messages++}catch{i.errors++}return n&&await Z(e,a),i}function ve(){return Q(q(e(),`plans`),`.md`)}async function ye(){let t=J(),n={messages:0,errors:0},r=D();try{let i=q(e(),`file-history`),a;try{a=await r.readdir(i)}catch{return n}let o=a.filter(e=>e.isDirectory()).map(e=>q(i,e.name));await Promise.all(o.map(async e=>{try{(await r.stat(e)).mtime<t&&(await r.rm(e,{recursive:!0,force:!0}),n.messages++)}catch{n.errors++}})),await Z(i,r)}catch(e){P(e)}return n}async function be(){let t=J(),n={messages:0,errors:0},r=D();try{let i=q(e(),`session-env`),a;try{a=await r.readdir(i)}catch{return n}let o=a.filter(e=>e.isDirectory()).map(e=>q(i,e.name));for(let e of o)try{(await r.stat(e)).mtime<t&&(await r.rm(e,{recursive:!0,force:!0}),n.messages++)}catch{n.errors++}await Z(i,r)}catch(e){P(e)}return n}async function xe(){let t=J(),n={messages:0,errors:0},r=D(),i=q(e(),`debug`),a;try{a=await r.readdir(i)}catch{return n}for(let e of a)if(!(!e.isFile()||!e.name.endsWith(`.txt`)||e.name===`latest`))try{await X(q(i,e.name),t,r)&&n.messages++}catch{n.errors++}return n}async function Se(){let{errors:e}=K();if(e.length>0&&j(`cleanupPeriodDays`)){w(`Skipping cleanup: settings have validation errors but cleanupPeriodDays was explicitly set. Fix settings errors to enable cleanup.`);return}await ge(),await _e(),await ve(),await ye(),await be(),await xe(),await r(),await v(J());let t=await ne(J());t>0&&R(`tengu_worktree_cleanup`,{removed:t})}x(),G(),le();var $=600*1e3;function Ce(){import(`./extractMemories-_xiTnX95.js`).then(({initExtractMemories:e})=>{e()}).catch(()=>{}),s(),ue(),y()&&de();let e=!0;async function t(){if(y()&&b()>Date.now()-1e3*60){setTimeout(t,$).unref();return}if(e&&(e=!1,await Se()),y()&&b()>Date.now()-1e3*60){setTimeout(t,$).unref();return}await W()}setTimeout(t,$).unref()}export{fe as n,Ce as t};
@@ -1 +0,0 @@
1
- import{t as e}from"./backgroundHousekeeping-C72oPgfD.js";export{e as startBackgroundHousekeeping};
@@ -1,2 +0,0 @@
1
- import{S as e,m as t,s as n,y as r}from"./git-Wid-XppW.js";import{f as i,m as a,v as o}from"./startupProfiler-B90b5vuq.js";import{homedir as s}from"os";import{join as c,sep as l}from"path";import{stat as u}from"fs/promises";o(),e(),t();var d=10080*60*1e3,f=1e3;function p(e){let t=[`This session was opened by an external deep link in ${g(e.cwd)}`];if(e.repo){let n=e.lastFetch?a(e.lastFetch):`never`,r=!e.lastFetch||Date.now()-e.lastFetch.getTime()>d;t.push(`Resolved ${e.repo} from local clones · last fetched ${n}${r?` — AGENTS.md may be stale`:``}`)}return e.prefillLength&&t.push(e.prefillLength>f?`The prompt below (${i(e.prefillLength)} chars) was supplied by the link — scroll to review the entire prompt before pressing Enter.`:`The prompt below was supplied by the link — review carefully before pressing Enter.`),t.join(`
2
- `)}async function m(e){let t=await n(e);if(!t)return;let i=await r(t),[a,o]=await Promise.all([h(c(t,`FETCH_HEAD`)),i?h(c(i,`FETCH_HEAD`)):Promise.resolve(void 0)]);return a&&o?a>o?a:o:a??o}async function h(e){try{let{mtime:t}=await u(e);return t}catch{return}}function g(e){let t=s();return e===t?`~`:e.startsWith(t+l)?`~${e.slice(t.length)}`:e}export{m as n,p as t};
@@ -1,9 +0,0 @@
1
- import{i as e,o as t}from"./envUtils-DcaKZlRU.js";import{S as n,x as r}from"./debug-D58GQBDG.js";import{a as i,i as a}from"./genericProcessUtils-Cnyun_Wr.js";import{join as o}from"path";import{randomUUID as s}from"crypto";import{readFile as c,readdir as l,unlink as u}from"fs/promises";t(),r(),a();async function d(){if(process.platform===`win32`){let{DetachedEngine:e}=await import(`./detached-Biz-xhu0.js`);return new e}let{TmuxEngine:e}=await import(`./tmux-DA06aewY.js`),t=new e;if(await t.available())return t;let{DetachedEngine:n}=await import(`./detached-Biz-xhu0.js`);return new n}function f(){return o(e(),`sessions`)}async function p(){let e=f(),t;try{t=await l(e)}catch{return[]}let r=[];for(let a of t)if(/^\d+\.json$/.test(a)){if(!i(parseInt(a.slice(0,-5),10))){u(o(e,a)).catch(()=>{});continue}try{let t=n(await c(o(e,a),`utf-8`));r.push(t)}catch{}}return r}function m(e,t){let n=parseInt(t,10);return e.find(e=>e.sessionId===t||e.pid===n||e.name&&e.name===t)}function h(e){return new Date(e).toLocaleString()}function g(e){return e.engine?e.engine:e.tmuxSessionName?`tmux`:`detached`}async function _(e){let t=await p();if(t.length===0){console.log(`No active sessions.`);return}console.log(`${t.length} active session${t.length>1?`s`:``}:\n`);for(let e of t){let t=g(e),n=[` PID: ${e.pid}`,` Kind: ${e.kind}`,` Engine: ${t}`,` Session: ${e.sessionId}`,` CWD: ${e.cwd}`];e.name&&n.push(` Name: ${e.name}`),e.startedAt&&n.push(` Started: ${h(e.startedAt)}`),e.status&&n.push(` Status: ${e.status}`),e.waitingFor&&n.push(` Waiting for: ${e.waitingFor}`),e.bridgeSessionId&&n.push(` Bridge: ${e.bridgeSessionId}`),e.tmuxSessionName&&n.push(` Tmux: ${e.tmuxSessionName}`),e.logPath&&n.push(` Log: ${e.logPath}`),console.log(n.join(`
2
- `)),console.log()}}async function v(e){let t=await p();if(!e){if(t.length===0){console.log(`No active sessions.`);return}if(t.length===1)e=t[0].sessionId;else{console.log(`Multiple sessions active. Specify one:`);for(let e of t){let t=e.name?`${e.name} (${e.sessionId})`:e.sessionId;console.log(` ${t} PID=${e.pid}`)}return}}let n=m(t,e);if(!n){console.error(`Session not found: ${e}`),process.exitCode=1;return}if(!n.logPath){console.log(`No log path recorded for session ${n.sessionId}`);return}try{let e=await c(n.logPath,`utf-8`);process.stdout.write(e)}catch(e){console.error(`Failed to read log file: ${n.logPath}`),console.error(e instanceof Error?e.message:String(e)),process.exitCode=1}}async function y(e){let t=await p();if(!e){let n=t.filter(e=>e.tmuxSessionName||e.engine===`detached`);if(n.length===0){console.log("No background sessions to attach to. Start one with `claude daemon bg`.");return}if(n.length===1)e=n[0].sessionId;else{console.log(`Multiple background sessions. Specify one:`);for(let e of n){let t=e.name?`${e.name} (${e.sessionId})`:e.sessionId,n=g(e);console.log(` ${t} PID=${e.pid} engine=${n}`)}return}}let n=m(t,e);if(!n){console.error(`Session not found: ${e}`),process.exitCode=1;return}let r=g(n);try{if(r===`tmux`){let{TmuxEngine:e}=await import(`./tmux-DA06aewY.js`),t=new e;if(!await t.available()){console.error(`tmux is no longer available. Cannot attach to tmux session.`),process.exitCode=1;return}await t.attach(n)}else{let{DetachedEngine:e}=await import(`./detached-Biz-xhu0.js`);await new e().attach(n)}}catch(e){console.error(e instanceof Error?e.message:String(e)),process.exitCode=1}}async function b(e){let t=await p();if(!e){if(t.length===0){console.log(`No active sessions to kill.`);return}console.log(`Specify a session to kill:`);for(let e of t){let t=e.name?`${e.name} (${e.sessionId})`:e.sessionId;console.log(` ${t} PID=${e.pid}`)}return}let n=m(t,e);if(!n){console.error(`Session not found: ${e}`),process.exitCode=1;return}console.log(`Killing session ${n.sessionId} (PID: ${n.pid})...`);try{process.kill(n.pid,`SIGTERM`)}catch{console.log(`Session already exited.`);return}if(await new Promise(e=>setTimeout(e,2e3)),i(n.pid))try{process.kill(n.pid,`SIGKILL`),console.log(`Session force-killed.`)}catch{console.log(`Session exited during grace period.`)}else console.log(`Session stopped.`);u(o(f(),`${n.pid}.json`)).catch(()=>{})}async function x(t){let n=await d(),r=t.filter(e=>e!==`--bg`&&e!==`--background`);if(!n.supportsInteractiveInput&&!r.some(e=>e===`-p`||e===`--print`||e===`--pipe`)){console.error(`Error: Background sessions with detached engine require -p/--print flag.
3
- The detached engine has no terminal for interactive input.
4
-
5
- Usage:
6
- claude daemon bg -p "your prompt here"
7
- echo "prompt" | claude daemon bg --pipe`),process.platform!==`win32`&&console.error(`
8
- Alternatively, install tmux for interactive background sessions:
9
- ${process.platform===`darwin`?`brew install tmux`:`sudo apt install tmux`}`),process.exitCode=1;return}let i=`claude-bg-${s().slice(0,8)}`,a=o(e(),`sessions`,`logs`,`${i}.log`);try{let e=await n.start({sessionName:i,args:r,env:{...process.env},logPath:a,cwd:process.cwd()});console.log(`Background session started: ${e.sessionName}`),console.log(` Engine: ${e.engineUsed}`),console.log(` Log: ${e.logPath}`),console.log(),console.log(`Use \`claude daemon attach ${e.sessionName}\` to reconnect.`),console.log("Use `claude daemon status` to check status."),console.log(`Use \`claude daemon kill ${e.sessionName}\` to stop.`)}catch(e){console.error(e instanceof Error?e.message:String(e)),process.exitCode=1}}export{y as attachHandler,x as handleBgStart,b as killHandler,v as logsHandler,_ as psHandler};
@@ -1,2 +0,0 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{Er as t,br as n,cr as r,fi as i,gr as a,hr as o,oi as s}from"./loadAgentsDir-C96o6gCj.js";import{$ as c,Ut as l,ft as u}from"./state-D5D6QpTX.js";import{C as d,x as f}from"./debug-D58GQBDG.js";import{c as p,s as m}from"./types-APu4OCXJ.js";import{n as h,r as g}from"./analytics-DJobLaWP.js";import{i as _,o as v}from"./stringUtils-D7oJIyY2.js";import{randomUUID as y}from"crypto";import{mkdir as b,readFile as x,writeFile as S}from"fs/promises";function C(e){let t=e?.message?.content;if(!t)return`Branched conversation`;let n=typeof t==`string`?t:t.find(e=>e.type===`text`)?.text;return n&&n.replace(/\s+/g,` `).trim().slice(0,100)||`Branched conversation`}async function w(e){let n=y(),i=u(),s=r(c()),l=a(n),f=o();await b(s,{recursive:!0,mode:448});let m;try{m=await x(f)}catch{throw Error(`No conversation to branch`)}if(m.length===0)throw Error(`No conversation to branch`);let h=p(m),g=h.filter(e=>t(e)&&!e.isSidechain),_=h.filter(e=>e.type===`content-replacement`&&e.sessionId===i).flatMap(e=>e.replacements);if(g.length===0)throw Error(`No messages to branch`);let v=null,C=[],w=[];for(let e of g){let t={...e,sessionId:n,parentUuid:v,isSidechain:!1,forkedFrom:{sessionId:i,messageUuid:e.uuid}},r={...e,sessionId:n};w.push(r),C.push(d(t)),e.type!==`progress`&&(v=e.uuid)}if(_.length>0){let e={type:`content-replacement`,sessionId:n,replacements:_};C.push(d(e))}return await S(l,`${C.join(`
2
- `)}\n`,{encoding:`utf8`,mode:384}),{sessionId:n,title:e,forkPath:l,serializedMessages:w,contentReplacementRecords:_}}async function T(e){let t=`${e} (Branch)`;if((await i(t,{exact:!0})).length===0)return t;let n=await i(`${e} (Branch`),r=new Set([1]),a=RegExp(`^${_(e)} \\(Branch(?: (\\d+))?\\)$`);for(let e of n){let t=e.customTitle?.match(a);t&&(t[1]?r.add(parseInt(t[1],10)):r.add(1))}let o=2;for(;r.has(o);)o++;return`${e} (Branch ${o})`}async function E(e,t,n){let r=n?.trim()||void 0,i=u();try{let{sessionId:n,title:a,forkPath:o,serializedMessages:c,contentReplacementRecords:l}=await w(r),u=new Date,d=C(c.find(e=>e.type===`user`)),f=await T(a??d);await s(n,f,o),g(`tengu_conversation_forked`,{message_count:c.length,has_custom_title:!!a});let p={date:u.toISOString().split(`T`)[0],messages:c,fullPath:o,value:u.getTime(),created:u,modified:u,firstPrompt:d,messageCount:c.length,isSidechain:!1,sessionId:n,customTitle:f,contentReplacements:l},m=a?` "${a}"`:``,h=`Branched conversation${m}. You are now in the branch.${`\nTo resume the original: claude -r ${i}`}`;return t.resume?(await t.resume(n,p,`fork`),e(h,{display:`system`})):e(`Branched conversation${m}. Resume with: /resume ${n}`),null}catch(t){return e(`Failed to branch conversation: ${t instanceof Error?t.message:`Unknown error occurred`}`),null}}e((()=>{l(),h(),m(),n(),f(),v()}))();export{E as call,C as deriveFirstPrompt};
@@ -1 +0,0 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{l as t,u as n}from"./oauth-D38aRTUb.js";import{Pt as r,St as i}from"./model-BaMclMXn.js";function a(){return process.env.CLAUDE_BRIDGE_OAUTH_TOKEN||void 0}function o(){return process.env.CLAUDE_BRIDGE_BASE_URL||void 0}function s(){return a()??i()?.accessToken}function c(){return o()??t().BASE_API_URL}function l(){return!!o()}var u=e((()=>{n(),r()}));export{u as a,a as i,c as n,l as o,o as r,s as t};
@@ -1 +0,0 @@
1
- import{a as e,n as t,o as n,t as r}from"./bridgeConfig-C-bI-slm.js";e();export{r as getBridgeAccessToken,t as getBridgeBaseUrl,n as isSelfHostedBridge};