@readmagic/workmate 0.0.14 → 0.0.16

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 (312) hide show
  1. package/dist/chunks/AddWorkspaceDirectory-DAtfMH4o.js +1 -0
  2. package/dist/chunks/{AgentsMdExternalIncludesDialog-D58Vn3SK.js → AgentsMdExternalIncludesDialog-BTYgjY5c.js} +1 -1
  3. package/dist/chunks/AgentsMdExternalIncludesDialog-C6VH6JG6.js +1 -0
  4. package/dist/chunks/{App-CeC-2dzL.js → App-HF0bvxi_.js} +1 -1
  5. package/dist/chunks/ApproveApiKey-B7mKgSqY.js +1 -0
  6. package/dist/chunks/{ApproveApiKey-DFpddLyp.js → ApproveApiKey-BBFLw2B7.js} +1 -1
  7. package/dist/chunks/{BackgroundTasksDialog-9ruzl1jm.js → BackgroundTasksDialog-Coc0ecUd.js} +1 -1
  8. package/dist/chunks/BypassPermissionsModeDialog--Gx9ARd4.js +1 -0
  9. package/dist/chunks/{DiffDialog-LTdtTqsC.js → DiffDialog-tlINuFS1.js} +1 -1
  10. package/dist/chunks/Doctor-BJf49FWX.js +1 -0
  11. package/dist/chunks/{Doctor-Yvrzcrvx.js → Doctor-Wh7z6CnF.js} +2 -2
  12. package/dist/chunks/ExitFlow-B1zHTqQt.js +2 -0
  13. package/dist/chunks/Grove-1Kf7xxIV.js +11 -0
  14. package/dist/chunks/{HybridTransport-CEWG9ZRi.js → HybridTransport-DWqWUZCH.js} +1 -1
  15. package/dist/chunks/{InvalidConfigDialog-Ue3kJUPJ.js → InvalidConfigDialog-OZPFQSnC.js} +1 -1
  16. package/dist/chunks/{InvalidSettingsDialog-BO2AOTVf.js → InvalidSettingsDialog-BNCm-eyC.js} +1 -1
  17. package/dist/chunks/MCPConnectionManager-7H84oi5n.js +1 -0
  18. package/dist/chunks/MCPToolListView-CVgtg3Iq.js +1 -0
  19. package/dist/chunks/{McpParsingWarnings-BsCDFWci.js → McpParsingWarnings-CN8f449l.js} +1 -1
  20. package/dist/chunks/{MessageSelector-DY5K0NHd.js → MessageSelector-B9j6zZ5w.js} +1 -1
  21. package/dist/chunks/Messages-yz1m39eI.js +10 -0
  22. package/dist/chunks/{Onboarding-w0-VVsDz.js → Onboarding-bFbgae8m.js} +1 -1
  23. package/dist/chunks/{PromptInputFooterSuggestions-OEXx0Abp.js → PromptInputFooterSuggestions-CE_yVun1.js} +1 -1
  24. package/dist/chunks/PromptInputHelpMenu-TPWuGwAy.js +1 -0
  25. package/dist/chunks/QueryEngine-CRobcENE.js +1 -0
  26. package/dist/chunks/REPL-BhCC0JP6.js +1 -0
  27. package/dist/chunks/REPL-C33mMf_q.js +128 -0
  28. package/dist/chunks/RemoteSessionManager-BjVD918g.js +2 -0
  29. package/dist/chunks/{ResumeConversation-BbNrpSFB.js → ResumeConversation-CXd8d8po.js} +1 -1
  30. package/dist/chunks/{SSETransport-CLiI2qnD.js → SSETransport-BSilVN9e.js} +1 -1
  31. package/dist/chunks/SearchExtraToolsTool-DoiCI2uJ.js +1 -0
  32. package/dist/chunks/Settings-ClcLl0C1.js +2 -0
  33. package/dist/chunks/{TeleportProgress-IB--CbqZ.js → TeleportProgress-DonJUoPc.js} +1 -1
  34. package/dist/chunks/{TeleportRepoMismatchDialog-KjdlS_gA.js → TeleportRepoMismatchDialog-ByOuSVVz.js} +1 -1
  35. package/dist/chunks/TeleportResumeWrapper-BBtELwF1.js +1 -0
  36. package/dist/chunks/{ThemePicker-BrD_T7xF.js → ThemePicker-1QQJFOEv.js} +1 -1
  37. package/dist/chunks/{TrustDialog-L0rvvpit.js → TrustDialog-DwJ9L_u4.js} +1 -1
  38. package/dist/chunks/{ValidationErrorsList-QZvtUrAy.js → ValidationErrorsList-Cuq6W2yc.js} +1 -1
  39. package/dist/chunks/{add-dir-CpWXReCi.js → add-dir-DOKdPFT2.js} +1 -1
  40. package/dist/chunks/{agentDisplay-CrQvGkTT.js → agentDisplay-TX1bh-lX.js} +1 -1
  41. package/dist/chunks/{agents-C99yMsVF.js → agents-C58tRxpi.js} +1 -1
  42. package/dist/chunks/agents-CbRjX9Pj.js +101 -0
  43. package/dist/chunks/{allErrors-uyOMiF9U.js → allErrors-DRiW7i6Y.js} +1 -1
  44. package/dist/chunks/api-C8uOHD-v.js +1 -0
  45. package/dist/chunks/{api-C5I2xwgd.js → api-CazVavfB.js} +1 -1
  46. package/dist/chunks/auth-BL238vgr.js +1 -0
  47. package/dist/chunks/auth-CfrCl9BZ.js +10 -0
  48. package/dist/chunks/auth-D3GkU6d7.js +1 -0
  49. package/dist/chunks/{backgroundHousekeeping-CjD8bACB.js → backgroundHousekeeping-CPLlaWcV.js} +2 -2
  50. package/dist/chunks/backgroundHousekeeping-Du2tN2WE.js +1 -0
  51. package/dist/chunks/{branch-BOWBZo5K.js → branch-pAa0oBaj.js} +1 -1
  52. package/dist/chunks/{bridgeConfig-CgAVrQfz.js → bridgeConfig-DnFfCpGd.js} +1 -1
  53. package/dist/chunks/bridgeConfig-joBqeK0j.js +1 -0
  54. package/dist/chunks/{bridgeMessaging-cOFtbkf_.js → bridgeMessaging-B_hnuUHb.js} +1 -1
  55. package/dist/chunks/bridgeStatusUtil-Dwz4YHNA.js +1 -0
  56. package/dist/chunks/{btw-B0UmiVKl.js → btw-CkVkYeRr.js} +1 -1
  57. package/dist/chunks/{caches-wN3JyvNE.js → caches-BLQUkrIG.js} +1 -1
  58. package/dist/chunks/caches-DsFl83sh.js +1 -0
  59. package/dist/chunks/{ccrClient-wtUIz75R.js → ccrClient-AfdUbWzY.js} +1 -1
  60. package/dist/chunks/claudeDesktop-CB3UCt7U.js +1 -0
  61. package/dist/chunks/{clear-CNzBoL7O.js → clear-Ac3qYi_-.js} +1 -1
  62. package/dist/chunks/client-BX0r6K3I.js +1 -0
  63. package/dist/chunks/client-Bb2eZnuq.js +1 -0
  64. package/dist/chunks/client-DNEVh6Wu.js +1 -0
  65. package/dist/chunks/client-Pap_HyZZ.js +1 -0
  66. package/dist/chunks/client-zhozU2ws.js +1 -0
  67. package/dist/chunks/commands-BKLsl6gK.js +1 -0
  68. package/dist/chunks/{compact-Bj8mdDYN.js → compact-CXuDr5qM.js} +1 -1
  69. package/dist/chunks/{config-BkbL2e5Q.js → config-BSkuQZNf.js} +1 -1
  70. package/dist/chunks/{config-WMxn2jLl.js → config-D78R57VA.js} +1 -1
  71. package/dist/chunks/config-DrY1SvhQ.js +1 -0
  72. package/dist/chunks/{context-DB1Ar85E.js → context-C2plOqH4.js} +1 -1
  73. package/dist/chunks/context-noninteractive-DpVlZ-wP.js +1 -0
  74. package/dist/chunks/{context-noninteractive-CqnJTDcI.js → context-noninteractive-fVQtwEkw.js} +1 -1
  75. package/dist/chunks/conversation-C0yysXds.js +1 -0
  76. package/dist/chunks/{conversation-DOgBzrm0.js → conversation-DQpS6nvg.js} +1 -1
  77. package/dist/chunks/{createSSHSession-Cf2tOgK_.js → createSSHSession-CfyFuJMH.js} +1 -1
  78. package/dist/chunks/createSession-CmBawnsh.js +1 -0
  79. package/dist/chunks/{createSession-DD5YaQKM.js → createSession-qk9C66lK.js} +1 -1
  80. package/dist/chunks/{crossProjectResume-CkiPQYYE.js → crossProjectResume-DY1ZBO5P.js} +1 -1
  81. package/dist/chunks/{datadog-DcLf1QpG.js → datadog-Cr0VKbct.js} +1 -1
  82. package/dist/chunks/{diff-dfXWiuLA.js → diff-BNjcCXDr.js} +1 -1
  83. package/dist/chunks/{directoryCompletion-BtlRKLzw.js → directoryCompletion-i2oWpaUe.js} +1 -1
  84. package/dist/chunks/doctor-BkCtT7H1.js +1 -0
  85. package/dist/chunks/{entry-wISucmYc.js → entry-o9IZPS4g.js} +3 -3
  86. package/dist/chunks/{esm-CrJVXrKW.js → esm-BI3tFLyy.js} +1 -1
  87. package/dist/chunks/exit-Dlyj7nY8.js +1 -0
  88. package/dist/chunks/extraUsage-5Ueiyw6W.js +1 -0
  89. package/dist/chunks/extractMemories-DnTBWFOW.js +1 -0
  90. package/dist/chunks/fast-B3fRp1xO.js +1 -0
  91. package/dist/chunks/fast-ClOKONyD.js +1 -0
  92. package/dist/chunks/fetchModelList-B8KG79EK.js +1 -0
  93. package/dist/chunks/fetchModelList-gh_jFYai.js +1 -0
  94. package/dist/chunks/{fileSuggestions-Dy2BUZzd.js → fileSuggestions-DK7W8kLF.js} +1 -1
  95. package/dist/chunks/{firstPartyEventLogger-D4yuDP-n.js → firstPartyEventLogger-BMnXb9cv.js} +2 -2
  96. package/dist/chunks/firstPartyEventLogger-YYOb8aIo.js +1 -0
  97. package/dist/chunks/{flushGate-B6ecrC4j.js → flushGate-n4kK6H1U.js} +1 -1
  98. package/dist/chunks/{gemini-BC-BxZmj.js → gemini-C8-QHnsC.js} +1 -1
  99. package/dist/chunks/{generateSessionName-JTR8nPYD.js → generateSessionName-C8DnAVaa.js} +1 -1
  100. package/dist/chunks/{githubRepoPathMapping-Bk4FZrng.js → githubRepoPathMapping-Px3_GeD1.js} +1 -1
  101. package/dist/chunks/{goal-B09SOyra.js → goal-DMmzlZOF.js} +1 -1
  102. package/dist/chunks/grok-LLjpAwP_.js +1 -0
  103. package/dist/chunks/{grove-DsAIY-rZ.js → grove-CQBCzeHf.js} +1 -1
  104. package/dist/chunks/help-JH7WzjZP.js +1 -0
  105. package/dist/chunks/hooks-COhKt_pF.js +1 -0
  106. package/dist/chunks/{hooks-BI4NY5IC.js → hooks-DD2jpRfx.js} +7 -7
  107. package/dist/chunks/initReplBridge-BDaN0hpY.js +1 -0
  108. package/dist/chunks/install-CD4or0vj.js +1 -0
  109. package/dist/chunks/{instrumentation-5cSwEKaF.js → instrumentation-n-otwpYf.js} +4 -4
  110. package/dist/chunks/{job-rW1mEYtm.js → job-B-pEWgXI.js} +1 -1
  111. package/dist/chunks/keybindings-qed9q9tx.js +1 -0
  112. package/dist/chunks/{launchLocalMemory-CPucX8Xj.js → launchLocalMemory-cBovdGMT.js} +1 -1
  113. package/dist/chunks/{launchOnboarding--GCJWeeS.js → launchOnboarding-B__wtt7p.js} +1 -1
  114. package/dist/chunks/{loadAgentsDir-JrGMJN05.js → loadAgentsDir-PPiD2Mfq.js} +574 -574
  115. package/dist/chunks/loadAgentsDir-qvqrTVuS.js +1 -0
  116. package/dist/chunks/{loadPluginHooks-C4zrlV0u.js → loadPluginHooks-DUCuU3_8.js} +1 -1
  117. package/dist/chunks/localSearch-CDk_stXJ.js +1 -0
  118. package/dist/chunks/{localSearch-C-stDP9C.js → localSearch-Cvs9WfoX.js} +1 -1
  119. package/dist/chunks/{logoV2Utils-J2Sqfube.js → logoV2Utils-Bkj74dtY.js} +1 -1
  120. package/dist/chunks/{magicDocs-Dpe3YhyL.js → magicDocs-3U6peChg.js} +2 -2
  121. package/dist/chunks/main-DkjxhBIC.js +356 -0
  122. package/dist/chunks/{managedEnv-C8SisyLk.js → managedEnv-BUrzwaD3.js} +1 -1
  123. package/dist/chunks/managedEnv-XOUMOtEF.js +1 -0
  124. package/dist/chunks/{mappers-CMJorgSL.js → mappers-ZGgwqDOK.js} +1 -1
  125. package/dist/chunks/mcp-COZxwgJZ.js +6 -0
  126. package/dist/chunks/{mcp-SuAh71Ht.js → mcp-CdyNeNzh.js} +1 -1
  127. package/dist/chunks/{mcp-_tBxhPV-.js → mcp-CysOyBIn.js} +1 -1
  128. package/dist/chunks/{memory-DK8bOrUr.js → memory-B5h2TTSS.js} +1 -1
  129. package/dist/chunks/{mode-BhfhEpnW.js → mode-D3yY1fdK.js} +1 -1
  130. package/dist/chunks/model-Bz4JHoU0.js +1 -0
  131. package/dist/chunks/model-g6XBcNAG.js +1 -0
  132. package/dist/chunks/model-sviY1inu.js +1 -0
  133. package/dist/chunks/modelOptions-DYQqTLPi.js +1 -0
  134. package/dist/chunks/{nativeInstaller-xxyUjXbl.js → nativeInstaller-N1xiUpCP.js} +1 -1
  135. package/dist/chunks/{omit-od_CYp5o.js → omit-BOILu8jW.js} +1 -1
  136. package/dist/chunks/{onChangeAppState-CqTb0yEa.js → onChangeAppState-COFFZAXb.js} +1 -1
  137. package/dist/chunks/{openai-qW8mATAs.js → openai-BHM5kEFo.js} +2 -2
  138. package/dist/chunks/openai-CR3CcjCE.js +17 -0
  139. package/dist/chunks/{partition-CYoWXLNU.js → partition-C1SFDk_L.js} +1 -1
  140. package/dist/chunks/{permissions--iKUbWBw.js → permissions-uy_NFbfy.js} +3 -3
  141. package/dist/chunks/{pidLock-BR4hzYgp.js → pidLock-DuMVSwnN.js} +2 -2
  142. package/dist/chunks/{plan-DiHCGXhM.js → plan-DF9YSB5M.js} +1 -1
  143. package/dist/chunks/{plugin-BeC4D7XF.js → plugin-GRPzqgTr.js} +1 -1
  144. package/dist/chunks/{pluginAutoupdate-Bj-CrFuO.js → pluginAutoupdate-AMD-FvKB.js} +1 -1
  145. package/dist/chunks/{pluginBlocklist-DzOs-RS1.js → pluginBlocklist-DNxkAxH6.js} +1 -1
  146. package/dist/chunks/{pluginCliCommands-DwIGn58t.js → pluginCliCommands-BFoR1ZXx.js} +1 -1
  147. package/dist/chunks/{pluginFlagging-BzuymJuf.js → pluginFlagging-CW2IZWSI.js} +1 -1
  148. package/dist/chunks/{pluginOperations-CP1v-nu0.js → pluginOperations-DlWE0idP.js} +1 -1
  149. package/dist/chunks/{pluginStartupCheck-BUeBiYVq.js → pluginStartupCheck-AQGV0DCS.js} +1 -1
  150. package/dist/chunks/pluginStartupCheck-DWpquqxx.js +1 -0
  151. package/dist/chunks/{plugins-D1N31THW.js → plugins-CwUSTE4E.js} +1 -1
  152. package/dist/chunks/poorMode-DD88nPJ4.js +1 -0
  153. package/dist/chunks/{poorMode-D4L_-yWS.js → poorMode-wm2WkPF0.js} +1 -1
  154. package/dist/chunks/print-9wR_ijrL.js +14 -0
  155. package/dist/chunks/{processBashCommand-BGCIqxc9.js → processBashCommand-Deqwq1IE.js} +1 -1
  156. package/dist/chunks/{processSlashCommand-qR_j1DE8.js → processSlashCommand-U9LJ4Keq.js} +2 -2
  157. package/dist/chunks/prompt-BBeDQXIs.js +1 -0
  158. package/dist/chunks/{prompt-DnPppVz8.js → prompt-CQmEvnKN.js} +1 -1
  159. package/dist/chunks/prompt-CXhdqgB7.js +1 -0
  160. package/dist/chunks/{promptEditor-Cilc9N3L.js → promptEditor-Bf72KNF-.js} +1 -1
  161. package/dist/chunks/{protocolHandler-DdbiucQa.js → protocolHandler--eQQuSyx.js} +1 -1
  162. package/dist/chunks/{reconciler-Bte4gdP-.js → reconciler-Css9bs07.js} +1 -1
  163. package/dist/chunks/{refresh-MiZ0acBm.js → refresh-B87z39Zs.js} +1 -1
  164. package/dist/chunks/{registerProtocol-Bpte9dly.js → registerProtocol-DrWIX3Lb.js} +1 -1
  165. package/dist/chunks/{reload-plugins-GdqFZblC.js → reload-plugins-BpmUIkfm.js} +1 -1
  166. package/dist/chunks/{remoteBridgeCore-CAl3_H-O.js → remoteBridgeCore-BCLIIygk.js} +1 -1
  167. package/dist/chunks/{remoteManagedSettings-BcLJLEr7.js → remoteManagedSettings-Ahgn2e80.js} +1 -1
  168. package/dist/chunks/{rename-BDo5qIK0.js → rename-BUt3PliQ.js} +1 -1
  169. package/dist/chunks/{resume-Bbweh2hA.js → resume-uZI9p_FE.js} +1 -1
  170. package/dist/chunks/ripgrep-Di-2j8Ws.js +1 -0
  171. package/dist/chunks/{ripgrep-X5m4gJ-3.js → ripgrep-DsLUmulz.js} +1 -1
  172. package/dist/chunks/{runtimeObserver-CxXxUcrm.js → runtimeObserver-AKOWfdZ_.js} +1 -1
  173. package/dist/chunks/{runtimeObserver-Hjbo43xj.js → runtimeObserver-By59MZKJ.js} +2 -2
  174. package/dist/chunks/sandbox-adapter-D4Uho1vF.js +1 -0
  175. package/dist/chunks/sandbox-toggle-BdvylnWS.js +1 -0
  176. package/dist/chunks/searchExtraTools-BHMkqGBf.js +1 -0
  177. package/dist/chunks/{session-CkuTMD_4.js → session-Tm2-rzBY.js} +1 -1
  178. package/dist/chunks/sessionFileAccessHooks-BaWZ8sqn.js +1 -0
  179. package/dist/chunks/{sessionObserver-CvQ6oyoj.js → sessionObserver-BAr8AWeL.js} +1 -1
  180. package/dist/chunks/sessionObserver-KB1UL_n2.js +1 -0
  181. package/dist/chunks/{sessionState-C2REgUrs.js → sessionState-BTFowSpR.js} +2 -2
  182. package/dist/chunks/sessionStorage-D6nlmaI-.js +1 -0
  183. package/dist/chunks/{sessionTitle-2IWcNB8H.js → sessionTitle-SCqmSDYM.js} +1 -1
  184. package/dist/chunks/{sessionTracing-Bm7hQKHA.js → sessionTracing-CvY4udYI.js} +1 -1
  185. package/dist/chunks/settings-BgHApyGL.js +1 -0
  186. package/dist/chunks/{settings-aUygByiZ.js → settings-CvhsRFaT.js} +1 -1
  187. package/dist/chunks/{settingsSync-DgzCU1BZ.js → settingsSync-nxeaGM2-.js} +1 -1
  188. package/dist/chunks/setup-D4FPeBnM.js +3 -0
  189. package/dist/chunks/{shadowedRuleDetection-CWCQ5dZ0.js → shadowedRuleDetection-Co8m1q1D.js} +1 -1
  190. package/dist/chunks/{sideQuestion-BoW-xYkh.js → sideQuestion-4TJYn-Az.js} +1 -1
  191. package/dist/chunks/{sinks-ZHKfs6gv.js → sinks-Bb2i50kz.js} +1 -1
  192. package/dist/chunks/sinks-D1opmy_x.js +1 -0
  193. package/dist/chunks/skillChangeDetector-BU9AFG0i.js +1 -0
  194. package/dist/chunks/{skillGapStore-CCNeSjIb.js → skillGapStore-BcVP3ZUb.js} +2 -2
  195. package/dist/chunks/{skillLifecycle-wU4JDNYQ.js → skillLifecycle-CG2XmS8f.js} +2 -2
  196. package/dist/chunks/{skillSearchPanel-Cxr1QQn4.js → skillSearchPanel-DOJmUBXB.js} +4 -4
  197. package/dist/chunks/{skills-BghnKnNo.js → skills-DIgCWvzX.js} +1 -1
  198. package/dist/chunks/{stats-unp6R0Ah.js → stats-Dq-5qizS.js} +1 -1
  199. package/dist/chunks/status-Ber2xOXc.js +2 -0
  200. package/dist/chunks/status-CVcXPoOZ.js +1 -0
  201. package/dist/chunks/{statusNoticeHelpers-Dm1aiibR.js → statusNoticeHelpers-CYkrPUpN.js} +1 -1
  202. package/dist/chunks/{switcher-BUNSEJ-7.js → switcher-BIP3rbQn.js} +1 -1
  203. package/dist/chunks/switcher-zbG6T9dN.js +1 -0
  204. package/dist/chunks/syncCache-AMQMQ_HR.js +1 -0
  205. package/dist/chunks/{tasks-BjFot03S.js → tasks-BKERIO4G.js} +1 -1
  206. package/dist/chunks/{teleport-Dj2Kvbmx.js → teleport-DOXbf2sQ.js} +1 -1
  207. package/dist/chunks/{templateJobs-CY7GNRo5.js → templateJobs-dg2F45ZJ.js} +1 -1
  208. package/dist/chunks/{terminalSetup-Ty8T8ePM.js → terminalSetup-DDvQ0K5e.js} +1 -1
  209. package/dist/chunks/{terminalSetup-CpMNk6dc.js → terminalSetup-JJiXmszo.js} +1 -1
  210. package/dist/chunks/{theme-c6grxWNn.js → theme-BGxytGjA.js} +1 -1
  211. package/dist/chunks/{toolEventObserver-D7WbjgFR.js → toolEventObserver-CJhg_p3P.js} +1 -1
  212. package/dist/chunks/toolPool-C0d7Bznl.js +1 -0
  213. package/dist/chunks/{trustedDevice-BF78PNK8.js → trustedDevice-BtXHXu-T.js} +1 -1
  214. package/dist/chunks/trustedDevice-hw3iq84W.js +1 -0
  215. package/dist/chunks/{useExitOnCtrlCDWithKeybindings-qLfN0tc-.js → useExitOnCtrlCDWithKeybindings-C9orgrub.js} +1 -1
  216. package/dist/chunks/useMainLoopModel-BigVcn2T.js +1 -0
  217. package/dist/chunks/{useManagePlugins-E0Qzj-ws.js → useManagePlugins-Bt-DYAnX.js} +1 -1
  218. package/dist/chunks/{useMergedTools-B7iYaNwM.js → useMergedTools-CZeQBdky.js} +1 -1
  219. package/dist/chunks/{useSearchInput-CsxiM9i0.js → useSearchInput-DdKrVHJS.js} +1 -1
  220. package/dist/chunks/{useSettingsErrors-DdVTahNa.js → useSettingsErrors-BR9Wws7D.js} +1 -1
  221. package/dist/chunks/{userAgent-BggRZ-ZE.js → userAgent-DUt0q-Vl.js} +1 -1
  222. package/dist/chunks/{util-Xdy1nOjj.js → util-h-Hmdke_.js} +1 -1
  223. package/dist/chunks/validatePlugin-mWVKNtJa.js +1 -0
  224. package/dist/chunks/{vim-cFcxfuac.js → vim-s-wmybpU.js} +1 -1
  225. package/dist/chunks/{workerRegistry-GrD7IAVQ.js → workerRegistry-dlfqtySm.js} +2 -2
  226. package/dist/chunks/worktree-IxcFe7g-.js +1 -0
  227. package/dist/cli.js +1 -1
  228. package/package.json +1 -1
  229. package/dist/chunks/AddWorkspaceDirectory-m2d3nOQJ.js +0 -1
  230. package/dist/chunks/AgentsMdExternalIncludesDialog-BRXGkHO4.js +0 -1
  231. package/dist/chunks/ApproveApiKey-NXTWIAMj.js +0 -1
  232. package/dist/chunks/BypassPermissionsModeDialog-C4QGpcBT.js +0 -1
  233. package/dist/chunks/Doctor-DmiDH-lg.js +0 -1
  234. package/dist/chunks/ExitFlow-DH0L3tyY.js +0 -2
  235. package/dist/chunks/Grove-BhhnrFX9.js +0 -11
  236. package/dist/chunks/MCPConnectionManager-Ciy9y9VV.js +0 -1
  237. package/dist/chunks/MCPToolListView-Ddmu2UcL.js +0 -1
  238. package/dist/chunks/Messages-LD6ZO301.js +0 -10
  239. package/dist/chunks/PromptInputHelpMenu-DyaUsvNx.js +0 -1
  240. package/dist/chunks/QueryEngine-sH-KjJIq.js +0 -1
  241. package/dist/chunks/REPL-BMH_RItw.js +0 -128
  242. package/dist/chunks/REPL-DkPd3vk5.js +0 -1
  243. package/dist/chunks/RemoteSessionManager-DJhrR1dz.js +0 -2
  244. package/dist/chunks/SearchExtraToolsTool-DupzA6Vm.js +0 -1
  245. package/dist/chunks/Settings-B1EI5LOU.js +0 -2
  246. package/dist/chunks/TeleportResumeWrapper-DnHTI39O.js +0 -1
  247. package/dist/chunks/agents-BYQO6DbG.js +0 -101
  248. package/dist/chunks/api-j0iE1mkR.js +0 -1
  249. package/dist/chunks/auth-BYCRa_mb.js +0 -10
  250. package/dist/chunks/auth-C9FUZzpW.js +0 -1
  251. package/dist/chunks/auth-DwPrlTHv.js +0 -1
  252. package/dist/chunks/backgroundHousekeeping-BxcVB3By.js +0 -1
  253. package/dist/chunks/bridgeConfig-Bxs5dqjH.js +0 -1
  254. package/dist/chunks/bridgeStatusUtil-BQF0AJDO.js +0 -1
  255. package/dist/chunks/caches-C9--b9a7.js +0 -1
  256. package/dist/chunks/claudeDesktop-DPIJpc1V.js +0 -1
  257. package/dist/chunks/client-B7WkO81L.js +0 -17
  258. package/dist/chunks/client-BCzhAEd0.js +0 -1
  259. package/dist/chunks/client-Dr9AYB-r.js +0 -1
  260. package/dist/chunks/commands-DTB0Qzd5.js +0 -1
  261. package/dist/chunks/config-B1kYcRIP.js +0 -1
  262. package/dist/chunks/context-noninteractive-Bno2Xsmp.js +0 -1
  263. package/dist/chunks/conversation-hNXWaswI.js +0 -1
  264. package/dist/chunks/createSession-BZx-2UIB.js +0 -1
  265. package/dist/chunks/doctor-aKE2bG5C.js +0 -1
  266. package/dist/chunks/exit-pjN4EJHV.js +0 -1
  267. package/dist/chunks/extraUsage-CwDhpClH.js +0 -1
  268. package/dist/chunks/extractMemories-WmPLOLUT.js +0 -1
  269. package/dist/chunks/fast-BVABmasw.js +0 -1
  270. package/dist/chunks/fast-Cuj3bfFm.js +0 -1
  271. package/dist/chunks/firstPartyEventLogger-CabA8fu0.js +0 -1
  272. package/dist/chunks/grok-BBo3jGfP.js +0 -1
  273. package/dist/chunks/help-CELr6oJZ.js +0 -1
  274. package/dist/chunks/hooks-9rkDD2iw.js +0 -1
  275. package/dist/chunks/initReplBridge-BYrL6ou1.js +0 -1
  276. package/dist/chunks/install-Dn3_M1Ui.js +0 -1
  277. package/dist/chunks/keybindings-B5kUoxvg.js +0 -1
  278. package/dist/chunks/loadAgentsDir-D-a1uUb5.js +0 -1
  279. package/dist/chunks/localSearch-hOERAH9v.js +0 -1
  280. package/dist/chunks/main-C_PDzJdv.js +0 -356
  281. package/dist/chunks/managedEnv-AEhH_HUs.js +0 -1
  282. package/dist/chunks/mcp-B2mJmWKt.js +0 -6
  283. package/dist/chunks/model-BCM7RpVk.js +0 -1
  284. package/dist/chunks/model-BWR43D3c.js +0 -1
  285. package/dist/chunks/model-CmDF8O9G.js +0 -1
  286. package/dist/chunks/modelOptions-DEQat7lU.js +0 -1
  287. package/dist/chunks/pluginStartupCheck-BGN6Je6d.js +0 -1
  288. package/dist/chunks/poorMode-XDBnxTiF.js +0 -1
  289. package/dist/chunks/print-DaJi1wF_.js +0 -14
  290. package/dist/chunks/prompt-B0gADAvI.js +0 -1
  291. package/dist/chunks/prompt-DqyEtC_I2.js +0 -1
  292. package/dist/chunks/ripgrep-DrpZ79Pp.js +0 -1
  293. package/dist/chunks/sandbox-adapter-DQ_fJSIo.js +0 -1
  294. package/dist/chunks/sandbox-toggle-DmNSThQK.js +0 -1
  295. package/dist/chunks/searchExtraTools-C7b2x2p_.js +0 -1
  296. package/dist/chunks/sessionFileAccessHooks-CQvGAbvL.js +0 -1
  297. package/dist/chunks/sessionObserver-BoQY7nOa.js +0 -1
  298. package/dist/chunks/sessionStorage-BeaEgnaa.js +0 -1
  299. package/dist/chunks/settings-Da6ax5aI.js +0 -1
  300. package/dist/chunks/setup-CvaG4nl5.js +0 -3
  301. package/dist/chunks/sinks-B_ehGpvp.js +0 -1
  302. package/dist/chunks/skillChangeDetector-C-HWR_8v.js +0 -1
  303. package/dist/chunks/status-BraYBx4N.js +0 -2
  304. package/dist/chunks/status-DwyWiaVc.js +0 -1
  305. package/dist/chunks/switcher-DDUnWU_4.js +0 -1
  306. package/dist/chunks/syncCache-1s9xV8WV.js +0 -1
  307. package/dist/chunks/toolPool-O5nkEFb1.js +0 -1
  308. package/dist/chunks/trustedDevice-D_z7bAQh.js +0 -1
  309. package/dist/chunks/updateCCB-ts7Joyve.js +0 -5
  310. package/dist/chunks/useMainLoopModel-DkjG_ikT.js +0 -1
  311. package/dist/chunks/validatePlugin-Be5aSSnP.js +0 -1
  312. package/dist/chunks/worktree-V7xiUAtl.js +0 -1
@@ -1 +0,0 @@
1
- import{t as e}from"./REPL-BMH_RItw.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{$y as i,Dw as a,Io as o,Ro as s,Sr as c,To as ee,Xy as l,bC as te,bT as u,bg as ne,br as re,db as d,gb as f,hb as p,kw as m,lb as h,mb as g,mg as _,pb as v,rb as y,sb as b,xo as ie,yC as x,yT as ae}from"./loadAgentsDir-JrGMJN05.js";import{di as oe,fi as se,j as S,t as ce}from"./src-DL3w8VPk2.js";import{n as le,t as C}from"./cwd-Besi3Os3.js";import{C as w,P as ue,R as de,S as fe,c as T,i as E,x as D}from"./debug-BQj6h99Q.js";import{Kt as O,Yt as k,f as A,g as j,n as M}from"./settings-aUygByiZ.js";import{c as N,h as P,o as F,v as I,y as L}from"./config-BkbL2e5Q.js";import{f as R,l as z,m as B,p as V}from"./git-DplvjXEY.js";import{n as H,r as pe}from"./execFileNoThrow-DYm1GeGn.js";import{o as U,s as W}from"./log-BlJ7CcKG.js";import{i as G,o as me}from"./platform-DVeTi9mp.js";import{l as he,u as ge}from"./oauth-D38aRTUb.js";import{Bt as _e,Vt as ve,_ as ye,g as be,ii as xe,oi as Se}from"./model-CmDF8O9G.js";import{c as Ce,h as we,l as Te,m as K,s as Ee}from"./proxy-C0j74LqT.js";import{c as De,i as Oe}from"./terminalSetup-CpMNk6dc.js";import{l as ke,o as Ae}from"./api-C5I2xwgd.js";import{c as je,u as Me}from"./firstPartyEventLogger-D4yuDP-n.js";import{randomUUID as Ne}from"crypto";t(),ae(),le(),P(),k(),pe(),B(),U(),Me();var Pe=[/(?:^|\/)(?: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 Fe(e){return!Pe.some(t=>t.test(e))}function Ie(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(!Fe(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 Le(){if(O.platform===`win32`||!await z())return[];try{let e=await je(),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 H(`git`,[...t,`--author=${e}`],{cwd:C()});r(n)}if(n.size<10){let{stdout:e}=await H(V(),t,{cwd:C()});r(e)}return Ie(Array.from(n.entries()).sort((e,t)=>t[1]-e[1]).map(([e])=>e),5)}catch(e){return W(e),[]}}var Re=10080*60*1e3,ze=e(()=>{let e=F(),t=e.exampleFiles?.length?u(e.exampleFiles):`<filepath>`;return`Try "${u([`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...`])}"`}),Be=e(async()=>{let e=F();Date.now()-(e.exampleFilesGeneratedAt??0)>Re&&(e.exampleFiles=[]),e.exampleFiles?.length||Le().then(e=>{e.length&&I(t=>({...t,exampleFiles:e,exampleFilesGeneratedAt:Date.now()}))})});Se();var Ve={"claude-3-opus":{modelName:`Claude 3 Opus`,retirementDates:{firstParty:`January 5, 2026`,bedrock:`January 15, 2026`,vertex:`January 5, 2026`,foundry:`January 5, 2026`}},"claude-3-7-sonnet":{modelName:`Claude 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:`Claude 3.5 Haiku`,retirementDates:{firstParty:`February 19, 2026`,bedrock:null,vertex:null,foundry:null}}};function He(e){let t=e.toLowerCase(),n=xe();for(let[e,r]of Object.entries(Ve)){let i=r.retirementDates[n];if(!(!t.includes(e)||!i))return{isDeprecated:!0,modelName:r.modelName,retirementDate:i}}return{isDeprecated:!1}}function Ue(e){if(!e)return null;let t=He(e);return t.isDeprecated?`⚠ ${t.modelName} will be retired on ${t.retirementDate}. Consider switching to a newer model.`:null}n(),se(),ce(),de(),D(),E(),me(),ge(),j(),_e(),ye(),m(),te(),h(),i(),ne(),Oe(),o(),ie(),re(),P();function We(e){let t=N().numStartups;L(n=>{let r=n.tipsHistory??{};return r[e]===t?n:{...n,tipsHistory:{...r,[e]:t}}})}function q(e){let t=N(),n=t.tipsHistory?.[e];return n?t.numStartups-n:1/0}P(),k(),B();var J;async function Ge(){return J===void 0&&(J=a in await s()),J}async function Y(e,t,n){if(!await Ge()||ee(`${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&&l(t.readFileState).some(e=>n.filePath.test(e)))}var Ke=[{id:`new-user-warmup`,content:async()=>`Start with small features or bug fixes, tell Claude to propose a plan, and verify its suggested edits`,cooldownSessions:3,async isRelevant(){return N().numStartups<10}},{id:`plan-mode-for-complex-tasks`,content:async()=>`Use Plan Mode to prepare for a complex request before making changes. Press ${x(`chat:cycleMode`,`Chat`,`shift+tab`)} twice to enable.`,cooldownSessions:5,isRelevant:async()=>{let e=N();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=N(),t=A(),n=!!e.lastPlanModeUse,r=!!t?.permissions?.defaultMode;return n&&!r}catch(e){return T(`Failed to check default-permission-mode-config tip relevance: ${e}`,{level:`warn`}),!1}}},{id:`git-worktrees`,content:async()=>`Use git worktrees to run multiple Claude sessions in parallel.`,cooldownSessions:10,isRelevant:async()=>{try{let e=N();return await R()<=1&&e.numStartups>50}catch{return!1}}},{id:`terminal-setup`,content:async()=>O.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=N();return O.terminal===`Apple_Terminal`?!e.optionAsMetaKeyInstalled:!e.shiftEnterKeyBindingInstalled}},{id:`shift-enter`,content:async()=>O.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=N();return!!((O.terminal===`Apple_Terminal`?e.optionAsMetaKeyInstalled:e.shiftEnterKeyBindingInstalled)&&e.numStartups>3)}},{id:`shift-enter-setup`,content:async()=>O.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(!De())return!1;let e=N();return!(O.terminal===`Apple_Terminal`?e.optionAsMetaKeyInstalled:e.shiftEnterKeyBindingInstalled)}},{id:`memory-command`,content:async()=>`Use /memory to view and manage Claude memory`,cooldownSessions:15,async isRelevant(){return N().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&&oe.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()=>G()===`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()=>A().statusLine===void 0},{id:`prompt-queue`,content:async()=>`Hit Enter to queue up additional messages while Claude is working.`,cooldownSessions:5,async isRelevant(){return N().promptQueueUseCount<=3}},{id:`enter-to-steer-in-relatime`,content:async()=>`Send messages to Claude while it works to steer Claude in real-time`,cooldownSessions:20,isRelevant:async()=>!0},{id:`todo-list`,content:async()=>`Ask Claude to create a todo list when working on complex tasks to track progress and remain on track`,cooldownSessions:20,isRelevant:async()=>!0},{id:`vscode-command-install`,content:async()=>`Open the Command Palette (Cmd+Shift+P) and run "Shell Command: Install '${O.terminal===`vscode`?`code`:O.terminal}' command in PATH" to enable IDE integration`,cooldownSessions:0,async isRelevant(){if(!g()||G()!==`macos`)return!1;switch(O.terminal){case`vscode`:return!await p();case`cursor`:return!await d();case`windsurf`:return!await f();default:return!1}}},{id:`ide-upsell-external-terminal`,content:async()=>`Connect Claude to your IDE · /ide`,cooldownSessions:4,async isRelevant(){return v()||(await b()).length!==0?!1:(await y()).length>0}},{id:`permissions`,content:async()=>`Use /permissions to pre-approve and pre-deny bash, edit, and MCP tools`,cooldownSessions:10,async isRelevant(){return N().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()=>!O.isSSH()},{id:`paste-images-mac`,content:async()=>`Paste images into Work Mate using control+v (not cmd+v!)`,cooldownSessions:10,isRelevant:async()=>G()===`macos`},{id:`double-esc`,content:async()=>`Double-tap esc to rewind the conversation to a previous point in time`,cooldownSessions:10,isRelevant:async()=>!_()},{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()=>_()},{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()=>c()&&N().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 N().numStartups>10}},{id:`shift-tab`,content:async()=>`Hit ${x(`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 ${x(`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 N().numStartups>5}},{id:`agent-flag`,content:async()=>`Use --agent <agent_name> to directly start a conversation with a subagent`,cooldownSessions:15,async isRelevant(){return N().numStartups>5}},{id:`web-app`,content:async()=>`Run tasks in the cloud while you keep coding locally · clau.de/web`,cooldownSessions:15,isRelevant:async()=>!0},{id:`opusplan-mode-reminder`,content:async()=>`Your default model setting is Opus Plan Mode. Press ${x(`chat:cycleMode`,`Chat`,`shift+tab`)} twice to activate Plan Mode and plan with Claude Opus.`,cooldownSessions:2,async isRelevant(){let e=N(),t=be()===`opusplan`,n=e.lastPlanModeUse?(Date.now()-e.lastPlanModeUse)/(1e3*60*60*24):1/0;return t&&n>3}},{id:`frontend-design-plugin`,content:async e=>`Working with HTML/CSS? Install the frontend-design plugin:\n${S(`suggestion`,e?.theme??`dark`)(`/plugin install frontend-design@${a}`)}`,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${S(`suggestion`,e?.theme??`dark`)(`/plugin install vercel@${a}`)}`,cooldownSessions:3,isRelevant:async e=>Y(`vercel`,e,{filePath:/(?:^|[/\\])vercel\.json$/i,cli:[`vercel`]})},{id:`subagent-fanout-nudge`,content:async e=>`Say ${S(`suggestion`,e?.theme??`dark`)(`"fan out subagents"`)} and Claude sends a team. Each one digs deep so nothing gets missed.`,cooldownSessions:3,isRelevant:async()=>(ve(),!1)}],qe=[];function X(){let e=M().spinnerTipsOverride;return e?.tips?.length?e.tips.map((e,t)=>({id:`custom-tip-${t}`,content:async()=>e,cooldownSessions:0,isRelevant:async()=>!0})):[]}async function Je(e){let t=M().spinnerTipsOverride,n=X();if(t?.excludeDefault&&n.length>0)return n;let r=[...Ke,...qe],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]}Ae(),E(),U(),we(),Te();var Z=2e3,Q=5,Ye=3e4,$=3,Xe=new Set([4003]);function Ze(e){return typeof e!=`object`||!e||!(`type`in e)?!1:typeof e.type==`string`}var Qe=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`){T(`[SessionsWebSocket] Already connecting`);return}this.state=`connecting`;let e=`${he().BASE_API_URL.replace(`http`,`ws`)}/v1/sessions/ws/${this.sessionId}/subscribe?organization_uuid=${this.orgUuid}`;T(`[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:Ce(e),tls:K()||void 0});this.ws=n,n.addEventListener(`open`,()=>{T(`[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`);W(e),this.callbacks.onError?.(e)}),n.addEventListener(`close`,e=>{T(`[SessionsWebSocket] Closed: code=${e.code} reason=${e.reason}`),this.handleClose(e.code)}),n.addEventListener(`pong`,()=>{T(`[SessionsWebSocket] Pong received`)})}else{let{default:n}=await import(`./wrapper-K8ZapJVu.js`),r=new n(e,{headers:t,agent:Ee(e),...K()});this.ws=r,r.on(`open`,()=>{T(`[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=>{W(Error(`[SessionsWebSocket] Error: ${e.message}`)),this.callbacks.onError?.(e)}),r.on(`close`,(e,t)=>{T(`[SessionsWebSocket] Closed: code=${e} reason=${t.toString()}`),this.handleClose(e)}),r.on(`pong`,()=>{T(`[SessionsWebSocket] Pong received`)})}}handleMessage(e){try{let t=fe(e);Ze(t)?this.callbacks.onMessage(t):T(`[SessionsWebSocket] Ignoring message type: ${typeof t==`object`&&t&&`type`in t?String(t.type):`unknown`}`)}catch(e){W(Error(`[SessionsWebSocket] Failed to parse message: ${ue(e)}`))}}handleClose(e){if(this.stopPingInterval(),this.state===`closed`)return;this.ws=null;let t=this.state;if(this.state=`closed`,Xe.has(e)){T(`[SessionsWebSocket] Permanent close code ${e}, not reconnecting`),this.callbacks.onClose?.();return}if(e===4001){if(this.sessionNotFoundRetries++,this.sessionNotFoundRetries>$){T(`[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}`)):(T(`[SessionsWebSocket] Not reconnecting`),this.callbacks.onClose?.())}scheduleReconnect(e,t){this.callbacks.onReconnecting?.(),T(`[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{}},Ye)}stopPingInterval(){this.pingInterval&&(clearInterval(this.pingInterval),this.pingInterval=null)}sendControlResponse(e){if(!this.ws||this.state!==`connected`){W(Error(`[SessionsWebSocket] Cannot send: not connected`));return}T(`[SessionsWebSocket] Sending control response`),this.ws.send(w(e))}sendControlRequest(e){if(!this.ws||this.state!==`connected`){W(Error(`[SessionsWebSocket] Cannot send: not connected`));return}let t={type:`control_request`,request_id:Ne(),request:e};T(`[SessionsWebSocket] Sending control request: ${e.subtype}`),this.ws.send(w(t))}isConnected(){return this.state===`connected`}close(){T(`[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(){T(`[SessionsWebSocket] Force reconnecting`),this.reconnectAttempts=0,this.sessionNotFoundRetries=0,this.close(),this.reconnectTimer=setTimeout(()=>{this.reconnectTimer=null,this.connect()},500)}};E(),U(),n();function $e(e){return e.type!==`control_request`&&e.type!==`control_response`&&e.type!==`control_cancel_request`}var et=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(){T(`[RemoteSessionManager] Connecting to session ${this.config.sessionId}`);let e={onMessage:e=>this.handleMessage(e),onConnected:()=>{T(`[RemoteSessionManager] Connected`),this.callbacks.onConnected?.()},onClose:()=>{T(`[RemoteSessionManager] Disconnected`),this.callbacks.onDisconnected?.()},onReconnecting:()=>{T(`[RemoteSessionManager] Reconnecting`),this.callbacks.onReconnecting?.()},onError:e=>{W(e),this.callbacks.onError?.(e)}};this.websocket=new Qe(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);T(`[RemoteSessionManager] Permission request cancelled: ${t}`),this.pendingPermissionRequests.delete(t),this.callbacks.onPermissionCancelled?.(t,n?.tool_use_id);return}if(e.type===`control_response`){T(`[RemoteSessionManager] Received control response`);return}$e(e)&&this.callbacks.onMessage(e)}handleControlRequest(e){let t=e.request_id,n=e.request;if(n.subtype===`can_use_tool`)T(`[RemoteSessionManager] Permission request for tool: ${n.tool_name}`),this.pendingPermissionRequests.set(t,n),this.callbacks.onPermissionRequest(n,t);else{T(`[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){T(`[RemoteSessionManager] Sending message to session ${this.config.sessionId}`);let n=await ke(this.config.sessionId,e,t);return n||W(Error(`[RemoteSessionManager] Failed to send message to session ${this.config.sessionId}`)),n}respondToPermissionRequest(e,t){if(!this.pendingPermissionRequests.get(e)){W(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}}}};T(`[RemoteSessionManager] Sending permission response: ${t.behavior}`),this.websocket?.sendControlResponse(n)}isConnected(){return this.websocket?.isConnected()??!1}cancelSession(){T(`[RemoteSessionManager] Sending interrupt signal`),this.websocket?.sendControlRequest({subtype:`interrupt`})}getSessionId(){return this.config.sessionId}disconnect(){T(`[RemoteSessionManager] Disconnecting`),this.websocket?.close(),this.websocket=null,this.pendingPermissionRequests.clear()}reconnect(){T(`[RemoteSessionManager] Reconnecting WebSocket`),this.websocket?.reconnect()}};function tt(e,t,n,r=!1,i=!1){return{sessionId:e,getAccessToken:t,orgUuid:n,hasInitialPrompt:r,viewerOnly:i}}export{We as a,Be as c,q as i,tt as n,Ue as o,Je as r,ze as s,et as t};
@@ -1 +0,0 @@
1
- import{E_ as e,T_ as t}from"./loadAgentsDir-JrGMJN05.js";e();export{t 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{$h as ee,$u as te,Dp as s,Gy as ne,Hy as re,Ky as c,Op as ie,Qh as ae,Qu as oe,Uh as se,Wh as ce,Wy as le,Xh as l,Zh as u,Zu as d,b as f,br as p,cb as ue,cd as m,eo as h,hC as g,j as de,lb as fe,ld as _,no as pe,pb as me,rr as he,to as v,xC as ge}from"./loadAgentsDir-JrGMJN05.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-DL3w8VPk2.js";import{t as k}from"./jsx-runtime-Bb4Xn-E0.js";import{Wt as De,pt as Oe}from"./state-BPFYBqm1.js";import{n as ke,t as A}from"./cwd-Besi3Os3.js";import{Bt as Ae,Ft as je,It as Me,Mt as j,Pt as Ne,c as Pe,g as Fe,n as Ie,x as M,zt as Le}from"./settings-aUygByiZ.js";import{a as Re,c as N,h as ze,i as Be,o as Ve,y as P}from"./config-BkbL2e5Q.js";import{o as He,s as Ue}from"./log-BlJ7CcKG.js";import{n as We,r as F}from"./analytics-DJobLaWP.js";import{G as Ge,K as Ke,_ as I,b as qe,br as Je,et as L,it as Ye,q as Xe,rt as Ze,tt as Qe,x as $e,xr as et}from"./model-CmDF8O9G.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-BraYBx4N.js";import{n as V,t as lt}from"./useExitOnCtrlCDWithKeybindings-qLfN0tc-.js";import{i as ut,n as dt,r as ft}from"./modalContext-wY9CeN4G.js";import{n as pt,t as mt}from"./ThemePicker-BrD_T7xF.js";import{i as ht,n as gt,r as _t,t as vt}from"./extraUsage-CwDhpClH.js";import{n as yt,t as bt}from"./AgentsMdExternalIncludesDialog-D58Vn3SK.js";import{t as H}from"./SearchBox-CwwV0W-w.js";import{n as xt,t as St}from"./useSearchInput-CsxiM9i0.js";function Ct(){let e=Oe();return[{label:`Version`,value:`0.0.14`},{label:`Session name`,value:he(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=u(e=>e.mainLoopModel),r=u(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)(s,{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(),l(),ke(),p(),rt(),ie(),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)(oe,{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(),d(),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,ee]=(0,Pt.useState)(!0);(0,Pt.useEffect)(()=>{v(A()).then(e=>{let t=Mt(e);a(t),ee(!1)}).catch(()=>{let e=Mt(h);a(e),ee(!1)})},[]);let te=(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 Claude Code communicates with you`})}),o?(0,q.jsx)(x,{dimColor:!0,children:`Loading output styles…`}):(0,q.jsx)(oe,{options:i,onChange:te,visibleOptionCount:10,defaultValue:e})]})})}var Pt,q,Ft,It,Lt=e((()=>{Pt=t(C(),1),pe(),D(),ke(),te(),q=k(),Ft=`Default`,It=`Claude 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 te(){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)(m,{value:r??``,onChange:i,onSubmit:te,focus:!0,showCursor:!0,placeholder:`e.g., Japanese, 日本語, Español${o.ellipsis}`,columns:60,cursorOffset:a,onChangeCursorOffset:ee})]}),(0,J.jsx)(x,{dimColor:!0,children:`Leave empty for default (English)`})]})}var zt,J,Bt=e((()=>{a(),zt=t(C(),1),D(),g(),_(),J=k()}));function Vt({onClose:e,context:t,setTabsHidden:i,onIsSearchModeChange:a,contentHeight:te}){let{headerFocused:c,focusHeader:ie}=Se(),se=ft(),[,l]=ve(),d=ye(),[f,p]=(0,X.useState)(N()),m=Y.useRef(N()),[h,g]=(0,X.useState)(Ie()),fe=Y.useRef(Ie()),[_,pe]=(0,X.useState)(h?.outputStyle||`default`),he=Y.useRef(_),[v,ge]=(0,X.useState)(h?.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=te??Math.min(Math.floor(Oe*.8),30),A=Math.max(5,ke-10),j=u(e=>e.mainLoopModel),Fe=u(e=>e.verbose),ze=u(e=>e.thinkingEnabled),He=u(e=>Ze()?e.fastMode:!1);u(e=>e.promptSuggestionEnabled);let We=je(h?.permissions?.defaultMode??`default`),I=ee(),[Je,L]=(0,X.useState)({}),tt=Y.useRef(ze),[nt]=(0,X.useState)(()=>Pe(`localSettings`)),[rt]=(0,X.useState)(()=>Pe(`userSettings`)),it=Y.useRef(d),at=ae(),[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&&!c,onExit:()=>k(!1),onExitUp:ie,passthroughCtrlKeys:[`c`,`d`]}),dt=O&&!c;Y.useEffect(()=>{a?.(dt)},[dt,a]);let pt=ue(t.options.mcpClients),ht=!r(process.env.CLAUDE_CODE_DISABLE_FILE_CHECKPOINTING),vt=Y.use(le(!0)),yt=ne(vt),H=Re();function St(e){F(`tengu_config_model_changed`,{from_model:j,to_model:e}),I(t=>({...t,mainLoopModel:e,mainLoopModelForSession:null})),L(t=>{let n=$e(e)+(gt(e,!1,qe())?` · 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})),p({...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:f.autoCompactEnabled,type:`boolean`,onChange(e){P(t=>({...t,autoCompactEnabled:e})),p({...N(),autoCompactEnabled:e}),F(`tengu_auto_compact_setting_changed`,{enabled:e})}},{id:`spinnerTipsEnabled`,label:`Show tips`,value:h?.spinnerTipsEnabled??!0,type:`boolean`,onChange(e){M(`localSettings`,{spinnerTipsEnabled:e}),g(t=>({...t,spinnerTipsEnabled:e})),F(`tengu_tips_setting_changed`,{enabled:e})}},{id:`cacheWarningEnabled`,label:`Cache warnings`,value:h?.cacheWarningEnabled??!0,type:`boolean`,onChange(e){M(`localSettings`,{cacheWarningEnabled:e}),g(t=>({...t,cacheWarningEnabled:e})),F(`tengu_cache_warning_setting_changed`,{enabled:e})}},{id:`prefersReducedMotion`,label:`Reduce motion`,value:h?.prefersReducedMotion??!1,type:`boolean`,onChange(e){M(`localSettings`,{prefersReducedMotion:e}),g(t=>({...t,prefersReducedMotion:e})),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})),M(`userSettings`,{alwaysThinkingEnabled:e?void 0:!1}),F(`tengu_thinking_toggled`,{enabled:e})}},...Ze()&&Qe()?[{id:`fastMode`,label:`Fast mode (${Ge} only)`,value:!!He,type:`boolean`,onChange(e){Ke(),M(`userSettings`,{fastMode:e?!0:void 0}),e?(I(e=>({...e,mainLoopModel:Xe(),mainLoopModelForSession:null,fastMode:!0})),L(e=>({...e,model:Xe(),"Fast mode":`ON`}))):(I(e=>({...e,fastMode:!1})),L(e=>({...e,"Fast mode":`OFF`})))}}]:[],...ht?[{id:`fileCheckpointingEnabled`,label:`Rewind code (checkpoints)`,value:f.fileCheckpointingEnabled,type:`boolean`,onChange(e){P(t=>({...t,fileCheckpointingEnabled:e})),p({...N(),fileCheckpointingEnabled:e}),F(`tengu_file_history_snapshots_setting_changed`,{enabled:e})}}]:[],{id:`verbose`,label:`Verbose output`,value:Fe,type:`boolean`,onChange:Ct},{id:`terminalProgressBarEnabled`,label:`Terminal progress bar`,value:f.terminalProgressBarEnabled,type:`boolean`,onChange(e){P(t=>({...t,terminalProgressBarEnabled:e})),p({...N(),terminalProgressBarEnabled:e}),F(`tengu_terminal_progress_bar_setting_changed`,{enabled:e})}},{id:`showTurnDuration`,label:`Show turn duration`,value:f.showTurnDuration,type:`boolean`,onChange(e){P(t=>({...t,showTurnDuration:e})),p({...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,...Ae.filter(t=>!e.includes(t))]})(),type:`enum`,onChange(e){let t=je(e),n=t===`auto`?t:Ne(t)?Le(t):t,r=M(`userSettings`,{permissions:{...h?.permissions,defaultMode:n}});if(r.error){Ue(r.error);return}g(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:f.respectGitignore,type:`boolean`,onChange(e){P(t=>({...t,respectGitignore:e})),p({...N(),respectGitignore:e}),F(`tengu_respect_gitignore_setting_changed`,{enabled:e})}},...ce()?[{id:`copyOnSelect`,label:`Copy on select`,value:f.copyOnSelect??!0,type:`boolean`,onChange(e){P(t=>({...t,copyOnSelect:e})),p({...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:h?.autoUpdatesChannel??`latest`,type:`managedEnum`,onChange(){}},{id:`theme`,label:`Theme`,value:d,type:`managedEnum`,onChange:l},{id:`notifChannel`,label:`Notifications`,value:f.preferredNotifChannel,options:[`auto`,`iterm2`,`terminal_bell`,`iterm2_with_bell`,`kitty`,`ghostty`,`notifications_disabled`],type:`enum`,onChange(e){P(t=>({...t,preferredNotifChannel:e})),p({...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:f.editorMode===`emacs`?`normal`:f.editorMode||`normal`,options:[`normal`,`vim`],type:`enum`,onChange(e){P(t=>({...t,editorMode:e})),p({...N(),editorMode:e}),F(`tengu_editor_mode_changed`,{mode:e,source:`config_panel`})}},{id:`prStatusFooterEnabled`,label:`Show PR status footer`,value:f.prStatusFooterEnabled??!0,type:`boolean`,onChange(e){P(t=>t.prStatusFooterEnabled===e?t:{...t,prStatusFooterEnabled:e}),p({...N(),prStatusFooterEnabled:e}),F(`tengu_pr_status_footer_setting_changed`,{enabled:e})}},{id:`model`,label:`Model`,value:j===null?`Default (recommended)`:j,type:`managedEnum`,onChange:St},...pt?[{id:`diffTool`,label:`Diff tool`,value:f.diffTool??`auto`,options:[`terminal`,`auto`],type:`enum`,onChange(e){P(t=>({...t,diffTool:e})),p({...N(),diffTool:e}),F(`tengu_diff_tool_changed`,{tool:e,source:`config_panel`})}}]:[],...me()?[]:[{id:`autoConnectIde`,label:`Auto-connect to IDE (external terminal)`,value:f.autoConnectIde??!1,type:`boolean`,onChange(e){P(t=>({...t,autoConnectIde:e})),p({...N(),autoConnectIde:e}),F(`tengu_auto_connect_ide_changed`,{enabled:e,source:`config_panel`})}}],...me()?[{id:`autoInstallIdeExtension`,label:`Auto-install IDE extension`,value:f.autoInstallIdeExtension??!0,type:`boolean`,onChange(e){P(t=>({...t,autoInstallIdeExtension:e})),p({...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:et(process.env.ANTHROPIC_API_KEY)})]}),searchText:`Use custom API key`,value:!!(process.env.ANTHROPIC_API_KEY&&f.customApiKeyResponses?.approved?.includes(et(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=et(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}),p(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(Je).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&&m.current.customApiKeyResponses?.approved?.includes(et(r))),a=!!(r&&f.customApiKeyResponses?.approved?.includes(et(r)));if(i!==a&&(t.push(`${a?`Enabled`:`Disabled`} custom API key`),F(`tengu_config_changed`,{key:`env.ANTHROPIC_API_KEY`,value:a})),f.theme!==m.current.theme&&t.push(`Set theme to ${w.bold(f.theme)}`),f.preferredNotifChannel!==m.current.preferredNotifChannel&&t.push(`Set notifications to ${w.bold(f.preferredNotifChannel)}`),_!==he.current&&t.push(`Set output style to ${w.bold(_)}`),v!==C.current&&t.push(`Set response language to ${w.bold(v??`Default (English)`)}`),f.editorMode!==m.current.editorMode&&t.push(`Set editor mode to ${w.bold(f.editorMode||`emacs`)}`),f.diffTool!==m.current.diffTool&&t.push(`Set diff tool to ${w.bold(f.diffTool)}`),f.autoConnectIde!==m.current.autoConnectIde&&t.push(`${f.autoConnectIde?`Enabled`:`Disabled`} auto-connect to IDE`),f.autoInstallIdeExtension!==m.current.autoInstallIdeExtension&&t.push(`${f.autoInstallIdeExtension?`Enabled`:`Disabled`} auto-install IDE extension`),f.autoCompactEnabled!==m.current.autoCompactEnabled&&t.push(`${f.autoCompactEnabled?`Enabled`:`Disabled`} auto-compact`),f.respectGitignore!==m.current.respectGitignore&&t.push(`${f.respectGitignore?`Enabled`:`Disabled`} respect .gitignore in file picker`),f.copyOnSelect!==m.current.copyOnSelect&&t.push(`${f.copyOnSelect?`Enabled`:`Disabled`} copy on select`),f.terminalProgressBarEnabled!==m.current.terminalProgressBarEnabled&&t.push(`${f.terminalProgressBarEnabled?`Enabled`:`Disabled`} terminal progress bar`),f.showStatusInTerminalTab!==m.current.showStatusInTerminalTab&&t.push(`${f.showStatusInTerminalTab?`Enabled`:`Disabled`} terminal tab status`),f.showTurnDuration!==m.current.showTurnDuration&&t.push(`${f.showTurnDuration?`Enabled`:`Disabled`} turn duration`),f.remoteControlAtStartup!==m.current.remoteControlAtStartup){let e=f.remoteControlAtStartup===void 0?`Reset Remote Control to default`:`${f.remoteControlAtStartup?`Enabled`:`Disabled`} Remote Control for all sessions`;t.push(e)}h?.autoUpdatesChannel!==fe.current?.autoUpdatesChannel&&t.push(`Set auto-update channel to ${w.bold(h?.autoUpdatesChannel??`latest`)}`),t.length>0?e(t.join(`
2
- `)):e(`Config dialog dismissed`,{display:`system`})},[z,Je,f,j,_,v,h?.autoUpdatesChannel,Ze()?h?.fastMode:void 0,e]),Dt=(0,X.useCallback)(()=>{d!==it.current&&l(it.current),P(()=>m.current);let e=nt;M(`localSettings`,{spinnerTipsEnabled:e?.spinnerTipsEnabled,prefersReducedMotion:e?.prefersReducedMotion,defaultView:e?.defaultView,outputStyle:e?.outputStyle});let t=rt;M(`userSettings`,{alwaysThinkingEnabled:t?.alwaysThinkingEnabled,fastMode:t?.fastMode,promptSuggestionEnabled:t?.promptSuggestionEnabled,autoUpdatesChannel:t?.autoUpdatesChannel,minimumVersion:t?.minimumVersion,language:t?.language,syntaxHighlightingDisabled:t?.syntaxHighlightingDisabled,permissions:t?.permissions===void 0?void 0:{...t.permissions,defaultMode:t.permissions.defaultMode}});let n=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:de(e.toolPermissionContext)}))},[d,l,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&&!c}),be(`settings:close`,Et,{context:`Settings`,isActive:z===null&&!O&&!c});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}(h?.autoUpdatesChannel??`latest`)===`latest`?(B(`ChannelDowngrade`),i(!0)):(R.current=!0,M(`userSettings`,{autoUpdatesChannel:`latest`,minimumVersion:void 0}),g(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,h?.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&&!c}),(0,Z.jsx)(b,{flexDirection:`column`,width:`100%`,tabIndex:0,autoFocus:!0,onKeyDown:(0,X.useCallback)(e=>{if(z===null&&!c){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,c,O,V,lt,W]),children:z===`Theme`?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(mt,{onThemeSelect:e=>{R.current=!0,l(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)(s,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})]})})})]}):z===`Model`?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(_t,{initial:j,onSelect:e=>{R.current=!0,St(e),B(null),i(!1)},onCancel:()=>{B(null),i(!1)},showFastModeNotice:Ze()?He&&Ye(j)&&Qe():!1}),(0,Z.jsx)(x,{dimColor:!0,children:(0,Z.jsxs)(S,{children:[(0,Z.jsx)(y,{shortcut:`Enter`,action:`confirm`}),(0,Z.jsx)(s,{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:re(vt)}),(0,Z.jsx)(x,{dimColor:!0,children:(0,Z.jsxs)(S,{children:[(0,Z.jsx)(y,{shortcut:`Enter`,action:`confirm`}),(0,Z.jsx)(s,{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,pe(e??`default`),B(null),i(!1),M(`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)(s,{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,ge(e),B(null),i(!1),M(`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)(s,{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)(oe,{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})),p({...N(),autoUpdates:!0}),M(`userSettings`,{autoUpdatesChannel:e,minimumVersion:void 0}),g(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.14`,onChoice:e=>{if(B(null),i(!1),e===`cancel`)return;R.current=!0;let t={autoUpdatesChannel:`stable`};e===`stay`&&(t.minimumVersion=`0.0.14`),M(`userSettings`,t),g(e=>({...e,...t})),F(`tengu_autoupdate_channel_changed`,{channel:`stable`,minimum_version_set:e===`stay`})}}):(0,Z.jsxs)(b,{flexDirection:`column`,gap:1,marginY:se?void 0:1,children:[(0,Z.jsx)(Ce,{query:V,isFocused:O&&!c,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&&!c&&!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:Me(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`]})]})}),c?(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)(s,{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)(s,{action:`confirm:no`,context:`Settings`,fallback:`Esc`,description:`clear`})]})}):(0,Z.jsx)(x,{dimColor:!0,children:(0,Z.jsxs)(S,{children:[(0,Z.jsx)(s,{action:`select:accept`,context:`Settings`,fallback:`Space`,description:`change`}),(0,Z.jsx)(s,{action:`settings:close`,context:`Settings`,fallback:`Enter`,description:`save`}),(0,Z.jsx)(s,{action:`settings:search`,context:`Settings`,fallback:`/`,description:`search`}),(0,Z.jsx)(s,{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),g(),a(),ze(),Je(),T(),j(),f(),He(),We(),pt(),l(),ht(),I(),vt(),yt(),jt(),d(),Lt(),Bt(),c(),ie(),dt(),H(),fe(),Fe(),pe(),i(),St(),ge(),L(),se(),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,te]=(0,Q.useState)(!1),s=ft(),{rows:ne}=ut(Te()),re=s?ne+1:Math.max(15,Math.min(Math.floor(ne*.8),30)),[c]=(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||s?void 0:re,children:[(0,$.jsx)(we,{title:`Status`,children:(0,$.jsx)(Et,{context:t,diagnosticsPromise:c})},`status`),(0,$.jsx)(we,{title:`Config`,children:(0,$.jsx)(Q.Suspense,{fallback:null,children:(0,$.jsx)(Vt,{context:t,onClose:e,setTabsHidden:o,onIsSearchModeChange:te,contentHeight:re})})},`config`)]})})}var Q,$,Kt=e((()=>{Q=t(C(),1),g(),lt(),ge(),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{Au as t,Dp as n,Mu as r,Op as i,Pu as a,Qu as o,Zu as s,_C as c,gC as l,hC as u,ju as d,lu as f,pu as p,xC as m}from"./loadAgentsDir-JrGMJN05.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-DL3w8VPk2.js";import{t as w}from"./jsx-runtime-Bb4Xn-E0.js";import{Wt as T,nr as E}from"./state-BPFYBqm1.js";import{M as D,P as O,R as k,c as A,i as j}from"./debug-BQj6h99Q.js";import{n as M,r as N}from"./analytics-DJobLaWP.js";import{p as P,v as F}from"./startupProfiler-2sjXZkIP.js";import{i as I,n as L}from"./detectRepository-Qy3zKoyn.js";import{n as R,o as z}from"./api-C5I2xwgd.js";var B=e(b(),1);T(),M(),k(),f();function V(e){let[t,n]=(0,B.useState)(!1),[r,i]=(0,B.useState)(null),[a,o]=(0,B.useState)(null);return{resumeSession:(0,B.useCallback)(async t=>{n(!0),i(null),o(t),N(`tengu_teleport_resume_session`,{source:e,session_id:t.id});try{let e=await p(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:a,clearError:(0,B.useCallback)(()=>{i(null)},[])}}m(),z(),C(),u(),l(),j(),I(),F(),i(),s(),a(),d();var H=w(),U=`Updated`,W=` `;function G({onSelect:e,onCancel:i,isEmbedded:a=!1}){let{rows:s}=S(),[l,u]=(0,B.useState)([]),[d,f]=(0,B.useState)(null),[p,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=c(`confirm:no`,`Confirmation`,`Esc`),M=(0,B.useCallback)(async()=>{try{m(!0),C(null);let e=await L();f(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()});u(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`,i,{context:`Confirmation`}),x((e,t)=>{if(t.ctrl&&e===`c`){i();return}if(t.ctrl&&e===`r`&&b){N();return}if(b!==null&&t.return){i();return}});let F=(0,B.useCallback)(()=>{D(!0),M()},[D,M]);if(!E)return(0,H.jsx)(t,{onComplete:F});if(p)return(0,H.jsxs)(g,{flexDirection:`column`,padding:1,children:[(0,H.jsxs)(g,{flexDirection:`row`,children:[(0,H.jsx)(r,{}),(0,H.jsx)(_,{bold:!0,children:`Loading Claude Code sessions…`})]}),(0,H.jsx)(_,{dimColor:!0,children:w?`Retrying…`:`Fetching your Claude Code sessions…`})]});if(b)return(0,H.jsxs)(g,{flexDirection:`column`,padding:1,children:[(0,H.jsx)(_,{bold:!0,color:`error`,children:`Error loading Claude Code 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(l.length===0)return(0,H.jsxs)(g,{flexDirection:`column`,padding:1,children:[(0,H.jsxs)(_,{bold:!0,children:[`No Claude Code sessions found`,d&&(0,H.jsxs)(_,{children:[` for `,d]})]}),(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=l.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,a?Math.min(l.length,5,s-6-7):Math.min(l.length,s-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`,l.length>G&&(0,H.jsxs)(_,{dimColor:!0,children:[` `,`(`,O,` of `,l.length,`)`]}),d&&(0,H.jsxs)(_,{dimColor:!0,children:[` (`,d,`)`]}),`:`]}),(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)(o,{visibleOptionCount:G,options:V,onChange:t=>{let n=l.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)(n,{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 Claude account`})});case`api`:return(0,H.jsx)(g,{marginY:1,flexDirection:`column`,children:(0,H.jsx)(_,{dimColor:!0,children:`Sorry, Claude encountered an error`})});case`other`:return(0,H.jsx)(g,{marginY:1,flexDirection:`row`,children:(0,H.jsx)(_,{dimColor:!0,children:`Sorry, Claude Code encountered an error`})})}}M(),C(),u(),a();function J({onComplete:e,onCancel:t,onError:n,isEmbedded:i=!1,source:a}){let{resumeSession:o,isResuming:s,error:c,selectedSession:l}=V(a);(0,B.useEffect)(()=>{N(`tengu_teleport_started`,{source:a})},[a]);let u=async t=>{let r=await o(t);r?e(r):c&&n&&n(c.message,c.formattedMessage)},d=()=>{N(`tengu_teleport_cancelled`,{}),t()};return y(`app:interrupt`,d,{context:`Global`,isActive:!!c&&!n}),s&&l?(0,H.jsxs)(g,{flexDirection:`column`,padding:1,children:[(0,H.jsxs)(g,{flexDirection:`row`,children:[(0,H.jsx)(r,{}),(0,H.jsx)(_,{bold:!0,children:`Resuming session…`})]}),(0,H.jsxs)(_,{dimColor:!0,children:[`Loading "`,l.title,`"…`]})]}):c&&!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:c.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:u,onCancel:d,isEmbedded:i})}export{J as TeleportResumeWrapper};
@@ -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{$S as o,$h as s,$m as c,$p as l,$u as u,AT as d,Bb as f,Cx as p,Dp as m,Gl as h,Gp as g,Hb as _,Hp as v,J_ as ee,Jf as y,Jp as b,Ka as te,Kc as ne,Kl as re,Kp as ie,La as ae,Mu as oe,Op as x,Pu as se,Q as ce,Ql as le,Qm as ue,Qp as de,Qu as fe,Sa as pe,Sp as me,Um as he,Up as ge,Vb as _e,Vp as ve,Wl as ye,Wm as be,Wp as xe,X as Se,Xf as Ce,Xh as we,Y_ as Te,Yf as Ee,Zh as De,Zl as Oe,ah as ke,by as Ae,c as je,cE as Me,cS as Ne,cd as Pe,dh as Fe,eC as Ie,fh as Le,hC as S,ih as Re,kT as ze,l as Be,lE as Ve,lS as He,ld as Ue,o as We,oh as Ge,qc as Ke,qf as qe,ql as Je,qp as Ye,r as Xe,rt as Ze,s as Qe,sh as $e,t as et,tm as tt,tt as nt,uE as rt,wp as it,wx as at,zb as ot}from"./loadAgentsDir-JrGMJN05.js";import{C as st,D as C,I as w,P as T,T as E,Wt as D,ai as O,di as ct,fi as lt,t as k,y as ut}from"./src-DL3w8VPk2.js";import{t as A}from"./jsx-runtime-Bb4Xn-E0.js";import{n as dt,t as ft}from"./cwd-Besi3Os3.js";import{F as pt,R as mt,S as ht,U as gt,W as _t,Z as vt,x as yt}from"./debug-BQj6h99Q.js";import{J as bt,Ln as xt,Q as St,Qt as Ct,Rn as wt,Xt as Tt,at as Et,it as Dt,ln as Ot,sn as kt}from"./settings-aUygByiZ.js";import{M as At,P as jt}from"./config-BkbL2e5Q.js";import{o as Mt,s as Nt}from"./log-BlJ7CcKG.js";import{n as Pt,r as Ft}from"./analytics-DJobLaWP.js";import{C as It,v as Lt}from"./startupProfiler-2sjXZkIP.js";import{l as Rt,n as zt,o as Bt}from"./stringUtils-BjnclTLB.js";import{vn as Vt,yn as Ht}from"./prompt-DnPppVz8.js";import{Q as Ut}from"./sessionState-C2REgUrs.js";import{a as Wt,i as Gt,n as Kt,o as qt,r as Jt,t as Yt}from"./agentDisplay-CrQvGkTT.js";import{n as Xt,t as Zt}from"./useExitOnCtrlCDWithKeybindings-qLfN0tc-.js";import{n as Qt,t as $t}from"./useMergedTools-B7iYaNwM.js";import{n as en,r as tn,t as nn}from"./promptEditor-Cilc9N3L.js";import{n as rn,t as an}from"./useMainLoopModel-DkjG_ikT.js";import{join as j}from"path";import{mkdir as on,open as sn,unlink as cn}from"fs/promises";var M,ln=e((()=>{M={FOLDER_NAME:`.workmate`,AGENTS_DIR:`agents`}}));function un(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 dn(e){switch(e){case`flagSettings`:throw Error(`Cannot get directory path for ${e} agents`);case`userSettings`:return j(n(),M.AGENTS_DIR);case`projectSettings`:return j(ft(),M.FOLDER_NAME,M.AGENTS_DIR);case`policySettings`:return j(Tt(),M.FOLDER_NAME,M.AGENTS_DIR);case`localSettings`:return j(ft(),M.FOLDER_NAME,M.AGENTS_DIR)}}function fn(e){switch(e){case`projectSettings`:return j(`.`,M.FOLDER_NAME,M.AGENTS_DIR);default:return dn(e)}}function pn(e){return j(dn(e.source),`${e.agentType}.md`)}function mn(e){if(e.source===`built-in`)return`Built-in`;if(e.source===`plugin`)throw Error(`Cannot get file path for plugin agents`);return j(dn(e.source),`${e.filename||e.agentType}.md`)}function hn(e){return e.source===`built-in`?`Built-in`:j(fn(e.source),`${e.agentType}.md`)}function gn(e){return Qe(e)?`Built-in`:Be(e)?`Plugin: ${e.plugin||`Unknown`}`:e.source===`flagSettings`?`CLI argument`:j(fn(e.source),`${e.filename||e.agentType}.md`)}async function _n(e){let t=dn(e);return await on(t,{recursive:!0}),t}async function vn(e,t,n,r,i,a=!0,o,s,c){if(e===`built-in`)throw Error(`Cannot save built-in agents`);await _n(e);let l=pn({source:e,agentType:t}),u=un(t,n,r,i,o,s,c);try{await xn(l,u,a?`wx`:`w`)}catch(e){throw pt(e)===`EEXIST`?Error(`Agent file already exists: ${l}`):e}}async function yn(e,t,n,r,i,a,o){if(e.source===`built-in`)throw Error(`Cannot update built-in agents`);await xn(mn(e),un(e.agentType,t,n,r,i,a,o))}async function bn(e){if(e.source===`built-in`)throw Error(`Cannot delete built-in agents`);let t=mn(e);try{await cn(t)}catch(e){if(pt(e)!==`ENOENT`)throw e}}async function xn(e,t,n=`w`){let r=await sn(e,n);try{await r.writeFile(t,{encoding:`utf-8`}),await r.datasync()}finally{await r.close()}}var Sn=e((()=>{Ct(),We(),dt(),r(),mt(),ln()}));function Cn({agent:e,tools:t,onBack:n}){let r=ge(e,t,!1),i=gn(e),o=ie(e.agentType);D(`confirm:no`,n,{context:`Confirmation`});let s=e=>{e.key===`return`&&(e.preventDefault(),n())};function c(){return r.hasWildcard?(0,N.jsx)(T,{children:`All tools`}):!e.tools||e.tools.length===0?(0,N.jsx)(T,{children:`None`}):(0,N.jsxs)(N.Fragment,{children:[r.validTools.length>0&&(0,N.jsx)(T,{children:r.validTools.join(`, `)}),r.invalidTools.length>0&&(0,N.jsxs)(T,{color:`warning`,children:[a.warning,` Unrecognized: `,r.invalidTools.join(`, `)]})]})}return(0,N.jsxs)(w,{flexDirection:`column`,gap:1,tabIndex:0,autoFocus:!0,onKeyDown:s,children:[(0,N.jsx)(T,{dimColor:!0,children:i}),(0,N.jsxs)(w,{flexDirection:`column`,children:[(0,N.jsxs)(T,{children:[(0,N.jsx)(T,{bold:!0,children:`Description`}),` (tells Claude when to use this agent):`]}),(0,N.jsx)(w,{marginLeft:2,children:(0,N.jsx)(T,{children:e.whenToUse})})]}),(0,N.jsxs)(w,{children:[(0,N.jsxs)(T,{children:[(0,N.jsx)(T,{bold:!0,children:`Tools`}),`:`,` `]}),c()]}),(0,N.jsxs)(T,{children:[(0,N.jsx)(T,{bold:!0,children:`Model`}),`: `,de(e.model)]}),e.permissionMode&&(0,N.jsxs)(T,{children:[(0,N.jsx)(T,{bold:!0,children:`Permission mode`}),`: `,e.permissionMode]}),e.memory&&(0,N.jsxs)(T,{children:[(0,N.jsx)(T,{bold:!0,children:`Memory`}),`: `,Me(e.memory)]}),e.hooks&&Object.keys(e.hooks).length>0&&(0,N.jsxs)(T,{children:[(0,N.jsx)(T,{bold:!0,children:`Hooks`}),`: `,Object.keys(e.hooks).join(`, `)]}),e.skills&&e.skills.length>0&&(0,N.jsxs)(T,{children:[(0,N.jsx)(T,{bold:!0,children:`Skills`}),`:`,` `,e.skills.length>10?`${e.skills.length} skills`:e.skills.join(`, `)]}),o&&(0,N.jsx)(w,{children:(0,N.jsxs)(T,{children:[(0,N.jsx)(T,{bold:!0,children:`Color`}),`:`,` `,(0,N.jsxs)(T,{backgroundColor:o,color:`inverseText`,children:[` `,e.agentType,` `]})]})}),!Qe(e)&&(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(w,{children:(0,N.jsxs)(T,{children:[(0,N.jsx)(T,{bold:!0,children:`System prompt`}),`:`]})}),(0,N.jsx)(w,{marginLeft:2,marginRight:2,children:(0,N.jsx)(me,{children:e.getSystemPrompt()})})]})]})}var N,wn=e((()=>{i(),k(),S(),Ye(),Ve(),v(),We(),tt(),it(),Sn(),N=A()}));function Tn({agentName:e,currentColor:t=`automatic`,onConfirm:n}){let[r,i]=(0,En.useState)(Math.max(0,Dn.indexOf(t))),o=e=>{if(e.key===`up`)e.preventDefault(),i(e=>e>0?e-1:Dn.length-1);else if(e.key===`down`)e.preventDefault(),i(e=>e<Dn.length-1?e+1:0);else if(e.key===`return`){e.preventDefault();let t=Dn[r];n(t===`automatic`?void 0:t)}},s=Dn[r];return(0,P.jsxs)(w,{flexDirection:`column`,gap:1,tabIndex:0,autoFocus:!0,onKeyDown:o,children:[(0,P.jsx)(w,{flexDirection:`column`,children:Dn.map((e,t)=>{let n=t===r;return(0,P.jsxs)(w,{flexDirection:`row`,gap:1,children:[(0,P.jsx)(T,{color:n?`suggestion`:void 0,children:n?a.pointer:` `}),e===`automatic`?(0,P.jsx)(T,{bold:n,children:`Automatic color`}):(0,P.jsxs)(w,{gap:1,children:[(0,P.jsx)(T,{backgroundColor:g[e],color:`inverseText`,children:` `}),(0,P.jsx)(T,{bold:n,children:zt(e)})]})]},e)})}),(0,P.jsxs)(w,{marginTop:1,children:[(0,P.jsx)(T,{children:`Preview: `}),s===void 0||s===`automatic`?(0,P.jsxs)(T,{inverse:!0,bold:!0,children:[` `,`@`,e,` `]}):(0,P.jsxs)(T,{backgroundColor:g[s],color:`inverseText`,bold:!0,children:[` `,`@`,e,` `]})]})]})}var En,P,Dn,On=e((()=>{i(),En=t(O(),1),k(),Ye(),Bt(),P=A(),Dn=[`automatic`,...xe]}));function kn({initialModel:e,onComplete:t,onCancel:n}){let r=An.useMemo(()=>{let t=l();return e&&!t.some(t=>t.value===e)?[{value:e,label:e,description:`Current model (custom ID)`},...t]:t},[e]);return(0,jn.jsxs)(w,{flexDirection:`column`,children:[(0,jn.jsx)(w,{marginBottom:1,children:(0,jn.jsx)(T,{dimColor:!0,children:`Model determines the agent's reasoning capabilities and speed.`})}),(0,jn.jsx)(fe,{options:r,defaultValue:e??`sonnet`,onChange:t,onCancel:()=>n?n():t(void 0)})]})}var An,jn,Mn=e((()=>{An=t(O(),1),k(),tt(),u(),jn=A()}));function Nn(){return{READ_ONLY:{name:`Read-only tools`,toolNames:new Set([Re.name,Ge.name,ye.name,o.name,ue.name,Oe.name,re.name,Ne.name,_e.name])},EDIT:{name:`Edit tools`,toolNames:new Set([Ee.name,Fe.name,qe.name])},EXECUTION:{name:`Execution tools`,toolNames:new Set([he.name])},MCP:{name:`MCP tools`,toolNames:new Set,isMcp:!0},OTHER:{name:`Other tools`,toolNames:new Set}}}function Pn(e){let t=new Map;return e.forEach(e=>{if(at(e)){let n=Et(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 Fn({tools:e,initialTools:t,onComplete:n,onCancel:r}){let i=(0,F.useMemo)(()=>ve({tools:e,isBuiltIn:!1,isAsync:!1}),[e]),[o,s]=(0,F.useState)(!t||t.includes(`*`)?i.map(e=>e.name):t),[c,l]=(0,F.useState)(0),[u,d]=(0,F.useState)(!1),f=(0,F.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,F.useMemo)(()=>{let e=Nn(),t={readOnly:[],edit:[],execution:[],mcp:[],other:[]};return i.forEach(n=>{at(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=xt(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=Nn();[{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=xt(n,e=>p.has(e.name))===n.length;y.push({id:e,label:`${r?a.checkboxOn:a.checkboxOff} ${t}`,action:ee(n)})});let te=y.length;y.push({id:`toggle-individual`,label:u?`Hide advanced options`:`Show advanced options`,action:()=>{d(!u),u&&c>te&&l(te)},isToggle:!0});let ne=(0,F.useMemo)(()=>Pn(i),[i]);return u&&(ne.length>0&&(y.push({id:`mcp-servers-header`,label:`MCP Servers:`,action:()=>{},isHeader:!0}),ne.forEach(({serverName:e,tools:t})=>{let n=xt(t,e=>p.has(e.name))===t.length;y.push({id:`mcp-server-${e}`,label:`${n?a.checkboxOn:a.checkboxOff} ${e} (${t.length} ${Rt(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=Et(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)})})),D(`confirm:no`,(0,F.useCallback)(()=>{r?r():n(t)},[r,n,t]),{context:`Confirmation`}),(0,I.jsxs)(w,{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,I.jsxs)(T,{color:c===0?`suggestion`:void 0,bold:c===0,children:[c===0?`${a.pointer} `:` `,`[ Continue ]`]}),(0,I.jsx)(st,{width:40}),y.slice(1).map((e,t)=>{let n=t+1===c,r=e.isToggle,i=e.isHeader;return(0,I.jsxs)(F.Fragment,{children:[r&&(0,I.jsx)(st,{width:40}),i&&t>0&&(0,I.jsx)(w,{marginTop:1}),(0,I.jsxs)(T,{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,I.jsx)(w,{marginTop:1,flexDirection:`column`,children:(0,I.jsx)(T,{dimColor:!0,children:m?`All tools selected`:`${p.size} of ${i.length} tools selected`})})]})}var F,I,In=e((()=>{i(),F=t(O(),1),Dt(),p(),v(),St(),be(),h(),Ce(),Ie(),Le(),ke(),$e(),He(),y(),_(),Je(),le(),c(),k(),S(),wt(),Bt(),I=A()}));function Ln(e){return e===`all`?`Agents`:e===`built-in`?`Built-in agents`:e===`plugin`?`Plugin agents`:ze(kt(e))}var Rn=e((()=>{d(),Ot()}));function zn({agent:e,tools:t,onSaved:n,onBack:r}){let i=s(),[o,c]=(0,L.useState)(`menu`),[l,u]=(0,L.useState)(0),[d,f]=(0,L.useState)(null),[p,m]=(0,L.useState)(e.color),h=(0,L.useCallback)(async()=>{let t=await nn(mn(e));t.error?f(t.error):n(`Opened ${e.agentType} in editor. If you made edits, restart to load the latest version.`)},[e,n]),g=(0,L.useCallback)(async(t={})=>{let{tools:r,color:a,model:o}=t,s=a??p,c=r!==void 0,l=o!==void 0,u=s!==e.color;if(!c&&!l&&!u)return!1;try{return!je(e)&&!Be(e)?!1:(await yn(e,e.whenToUse,r??e.tools,e.getSystemPrompt(),s,o??e.model),u&&s&&b(e.agentType,s),i(t=>{let n=t.agentDefinitions.allAgents.map(t=>t.agentType===e.agentType?{...t,tools:r??t.tools,color:s,model:o??t.model}:t);return{...t,agentDefinitions:{...t.agentDefinitions,activeAgents:Xe(n),allAgents:n}}}),n(`Updated agent: ${ct.bold(e.agentType)}`),!0)}catch(e){return f(e instanceof Error?e.message:`Failed to save agent`),!1}},[e,p,n,i]),_=(0,L.useMemo)(()=>[{label:`Open in editor`,action:h},{label:`Edit tools`,action:()=>c(`edit-tools`)},{label:`Edit model`,action:()=>c(`edit-model`)},{label:`Edit color`,action:()=>c(`edit-color`)}],[h]),v=(0,L.useCallback)(()=>{f(null),o===`menu`?r():c(`menu`)},[o,r]),ee=(0,L.useCallback)(e=>{if(e.key===`up`)e.preventDefault(),u(e=>Math.max(0,e-1));else if(e.key===`down`)e.preventDefault(),u(e=>Math.min(_.length-1,e+1));else if(e.key===`return`){e.preventDefault();let t=_[l];t&&t.action()}},[_,l]);D(`confirm:no`,v,{context:`Confirmation`});let y=()=>(0,R.jsxs)(w,{flexDirection:`column`,tabIndex:0,autoFocus:!0,onKeyDown:ee,children:[(0,R.jsxs)(T,{dimColor:!0,children:[`Source: `,Ln(e.source)]}),(0,R.jsx)(w,{marginTop:1,flexDirection:`column`,children:_.map((e,t)=>(0,R.jsxs)(T,{color:t===l?`suggestion`:void 0,children:[t===l?`${a.pointer} `:` `,e.label]},e.label))}),d&&(0,R.jsx)(w,{marginTop:1,children:(0,R.jsx)(T,{color:`error`,children:d})})]});switch(o){case`menu`:return y();case`edit-tools`:return(0,R.jsx)(Fn,{tools:t,initialTools:e.tools,onComplete:async e=>{c(`menu`),await g({tools:e})}});case`edit-color`:return(0,R.jsx)(Tn,{agentName:e.agentType,currentColor:p||e.color||`automatic`,onConfirm:async e=>{m(e),c(`menu`),await g({color:e})}});case`edit-model`:return(0,R.jsx)(kn,{initialModel:e.model,onComplete:async e=>{c(`menu`),await g({model:e})}});default:return null}}var L,R,Bn=e((()=>{lt(),i(),L=t(O(),1),we(),k(),S(),Ye(),We(),tn(),Sn(),On(),Mn(),In(),Rn(),R=A()}));function Vn({instructions:e=`Press ↑↓ to navigate · Enter to select · Esc to go back`}){let t=Xt();return(0,Hn.jsx)(w,{marginLeft:2,children:(0,Hn.jsx)(T,{dimColor:!0,children:t.pending?`Press ${t.keyName} again to exit`:e})})}var Hn,Un=e((()=>{Zt(),k(),Hn=A()}));function Wn({source:e,agents:t,onBack:n,onSelect:r,onCreateNew:i,changes:o}){let[s,c]=Gn.useState(null),[l,u]=Gn.useState(!0),d=Gn.useMemo(()=>[...t].sort(Kt),[t]),f=e=>({isOverridden:!!e.overriddenBy,overriddenBy:e.overriddenBy||null}),p=()=>(0,z.jsxs)(w,{children:[(0,z.jsx)(T,{color:l?`suggestion`:void 0,children:l?`${a.pointer} `:` `}),(0,z.jsx)(T,{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=Wt(e);return(0,z.jsxs)(w,{children:[(0,z.jsx)(T,{dimColor:o&&!n,color:c,children:t?``:n?`${a.pointer} `:` `}),(0,z.jsx)(T,{dimColor:o&&!n,color:c,children:e.agentType}),u&&(0,z.jsxs)(T,{dimColor:!0,color:c,children:[` · `,u]}),e.memory&&(0,z.jsxs)(T,{dimColor:!0,color:c,children:[` · `,e.memory,` memory`]}),i&&(0,z.jsxs)(T,{dimColor:!n,color:n?`warning`:void 0,children:[` `,a.warning,` shadowed by `,Jt(i)]})]},`${e.agentType}-${e.source}`)},h=Gn.useMemo(()=>{let t=d.filter(e=>e.source!==`built-in`);return e===`all`?Yt.filter(e=>e.source!==`built-in`).flatMap(({source:e})=>t.filter(t=>t.source===e)):t},[d,e]);Gn.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,z.jsxs)(w,{flexDirection:`column`,marginBottom:1,paddingLeft:2,children:[(0,z.jsx)(T,{bold:!0,dimColor:!0,children:e}),t.map(m)]})},v=(e,t)=>{if(!t.length)return null;let n=t[0]?.baseDir;return(0,z.jsxs)(w,{flexDirection:`column`,marginBottom:1,children:[(0,z.jsxs)(w,{paddingLeft:2,children:[(0,z.jsx)(T,{bold:!0,dimColor:!0,children:e}),n&&(0,z.jsxs)(T,{dimColor:!0,children:[` (`,n,`)`]})]}),t.map(e=>m(e))]})},ee=Ln(e),y=d.filter(e=>e.source===`built-in`);return!d.length||e!==`built-in`&&!d.some(e=>e.source!==`built-in`)?(0,z.jsx)(ut,{title:ee,subtitle:`No agents found`,onCancel:n,hideInputGuide:!0,children:(0,z.jsxs)(w,{flexDirection:`column`,gap:1,tabIndex:0,autoFocus:!0,onKeyDown:g,children:[i&&(0,z.jsx)(w,{children:p()}),(0,z.jsx)(T,{dimColor:!0,children:`No agents found. Create specialized subagents that Claude can delegate to.`}),(0,z.jsx)(T,{dimColor:!0,children:`Each subagent has its own context window, custom system prompt, and specific tools.`}),(0,z.jsx)(T,{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,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(st,{}),_()]})]})}):(0,z.jsxs)(ut,{title:ee,subtitle:`${xt(d,e=>!e.overriddenBy)} agents`,onCancel:n,hideInputGuide:!0,children:[o&&o.length>0&&(0,z.jsx)(w,{marginTop:1,children:(0,z.jsx)(T,{dimColor:!0,children:o[o.length-1]})}),(0,z.jsxs)(w,{flexDirection:`column`,tabIndex:0,autoFocus:!0,onKeyDown:g,children:[i&&(0,z.jsx)(w,{marginBottom:1,children:p()}),e===`all`?(0,z.jsxs)(z.Fragment,{children:[Yt.filter(e=>e.source!==`built-in`).map(({label:e,source:t})=>(0,z.jsx)(Gn.Fragment,{children:v(e,d.filter(e=>e.source===t))},t)),y.length>0&&(0,z.jsxs)(w,{flexDirection:`column`,marginBottom:1,paddingLeft:2,children:[(0,z.jsxs)(T,{dimColor:!0,children:[(0,z.jsx)(T,{bold:!0,children:`Built-in agents`}),` (always available)`]}),y.map(m)]})]}):e===`built-in`?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(T,{dimColor:!0,italic:!0,children:`Built-in agents are provided by default and cannot be modified.`}),(0,z.jsx)(w,{marginTop:1,flexDirection:`column`,children:d.map(e=>m(e))})]}):(0,z.jsxs)(z.Fragment,{children:[d.filter(e=>e.source!==`built-in`).map(e=>m(e)),d.some(e=>e.source===`built-in`)&&(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(st,{}),_()]})]})]})]})}var Gn,z,Kn=e((()=>{i(),Gn=t(O(),1),k(),Gt(),wt(),Rn(),z=A()}));function qn({steps:e,initialData:t={},onComplete:n,onCancel:r,children:i,title:a,showStepCounter:o=!0}){let[s,c]=(0,B.useState)(0),[l,u]=(0,B.useState)(t),[d,f]=(0,B.useState)(!1),[p,m]=(0,B.useState)([]);Xt(),(0,B.useEffect)(()=>{d&&(m([]),n(l))},[d,l,n]);let h=(0,B.useCallback)(()=>{s<e.length-1?(p.length>0&&m(e=>[...e,s]),c(e=>e+1)):f(!0)},[s,e.length,p]),g=(0,B.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,B.useCallback)(t=>{t>=0&&t<e.length&&(m(e=>[...e,s]),c(t))},[s,e.length]),v=(0,B.useCallback)(()=>{m([]),r&&r()},[r]),ee=(0,B.useCallback)(e=>{u(t=>({...t,...e}))},[]),y=(0,B.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,Jn.jsx)(Yn.Provider,{value:y,children:i||(0,Jn.jsx)(b,{})})}var B,Jn,Yn,Xn=e((()=>{B=t(O(),1),Zt(),Jn=A(),Yn=(0,B.createContext)(null)}));function V(){let e=(0,Zn.useContext)(Yn);if(!e)throw Error(`useWizard must be used within a WizardProvider`);return e}var Zn,Qn=e((()=>{Zn=t(O(),1),Xn()}));function $n({instructions:e=(0,er.jsxs)(E,{children:[(0,er.jsx)(C,{shortcut:`↑↓`,action:`navigate`}),(0,er.jsx)(C,{shortcut:`Enter`,action:`select`}),(0,er.jsx)(m,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`})]})}){let t=Xt();return(0,er.jsx)(w,{marginLeft:3,marginTop:1,children:(0,er.jsx)(T,{dimColor:!0,children:t.pending?`Press ${t.keyName} again to exit`:e})})}var er,tr=e((()=>{Zt(),k(),x(),er=A()}));function H({title:e,color:t=`suggestion`,children:n,subtitle:r,footerText:i}){let{currentStepIndex:a,totalSteps:o,title:s,showStepCounter:c,goBack:l}=V();return(0,nr.jsxs)(nr.Fragment,{children:[(0,nr.jsx)(ut,{title:`${e||s||`Wizard`}${c===!1?``:` (${a+1}/${o})`}`,subtitle:r,onCancel:l,color:t,hideInputGuide:!0,isCancelActive:!1,children:n}),(0,nr.jsx)($n,{instructions:i})]})}var nr,U=e((()=>{k(),Qn(),tr(),nr=A()})),W=e((()=>{Qn(),U(),tr(),Xn()}));function rr(){let{goNext:e,goBack:t,updateWizardData:n,wizardData:r}=V();return D(`confirm:no`,t,{context:`Confirmation`}),(0,ir.jsx)(H,{subtitle:`Choose background color`,footerText:(0,ir.jsxs)(E,{children:[(0,ir.jsx)(C,{shortcut:`↑↓`,action:`navigate`}),(0,ir.jsx)(C,{shortcut:`Enter`,action:`select`}),(0,ir.jsx)(m,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`})]}),children:(0,ir.jsx)(w,{children:(0,ir.jsx)(Tn,{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 ir,ar=e((()=>{k(),S(),x(),W(),U(),On(),ir=A()}));function or(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 sr(e,t,n){let r=[],i=[];if(!e.agentType)r.push(`Agent type is required`);else{let t=or(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 ${Ln(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=ge(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 cr=e((()=>{v(),Rn()}));function lr({tools:e,existingAgents:t,onSave:n,onSaveAndEdit:r,error:i}){let{goBack:a,wizardData:o}=V();D(`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=sr(c,e,t),u=It(c.getSystemPrompt(),240),d=It(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=jt()?(0,G.jsxs)(T,{children:[(0,G.jsx)(T,{bold:!0,children:`Memory`}),`: `,Me(c.memory)]}):null;return(0,G.jsx)(H,{subtitle:`Confirm and save`,footerText:(0,G.jsxs)(E,{children:[(0,G.jsx)(C,{shortcut:`s/Enter`,action:`save`}),(0,G.jsx)(C,{shortcut:`e`,action:`edit in your editor`}),(0,G.jsx)(m,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})]}),children:(0,G.jsxs)(w,{flexDirection:`column`,tabIndex:0,autoFocus:!0,onKeyDown:s,children:[(0,G.jsxs)(T,{children:[(0,G.jsx)(T,{bold:!0,children:`Name`}),`: `,c.agentType]}),(0,G.jsxs)(T,{children:[(0,G.jsx)(T,{bold:!0,children:`Location`}),`:`,` `,hn({source:o.location,agentType:c.agentType})]}),(0,G.jsxs)(T,{children:[(0,G.jsx)(T,{bold:!0,children:`Tools`}),`: `,f(c.tools)]}),(0,G.jsxs)(T,{children:[(0,G.jsx)(T,{bold:!0,children:`Model`}),`: `,de(c.model)]}),p,(0,G.jsx)(w,{marginTop:1,children:(0,G.jsxs)(T,{children:[(0,G.jsx)(T,{bold:!0,children:`Description`}),` (tells Claude when to use this agent):`]})}),(0,G.jsx)(w,{marginLeft:2,marginTop:1,children:(0,G.jsx)(T,{children:d})}),(0,G.jsx)(w,{marginTop:1,children:(0,G.jsxs)(T,{children:[(0,G.jsx)(T,{bold:!0,children:`System prompt`}),`:`]})}),(0,G.jsx)(w,{marginLeft:2,marginTop:1,children:(0,G.jsx)(T,{children:u})}),l.warnings.length>0&&(0,G.jsxs)(w,{marginTop:1,flexDirection:`column`,children:[(0,G.jsx)(T,{color:`warning`,children:`Warnings:`}),l.warnings.map((e,t)=>(0,G.jsxs)(T,{dimColor:!0,children:[` `,`• `,e]},t))]}),l.errors.length>0&&(0,G.jsxs)(w,{marginTop:1,flexDirection:`column`,children:[(0,G.jsx)(T,{color:`error`,children:`Errors:`}),l.errors.map((e,t)=>(0,G.jsxs)(T,{color:`error`,children:[` `,`• `,e]},t))]}),i&&(0,G.jsx)(w,{marginTop:1,children:(0,G.jsx)(T,{color:`error`,children:i})}),(0,G.jsx)(w,{marginTop:2,children:(0,G.jsxs)(T,{color:`success`,children:[`Press `,(0,G.jsx)(T,{bold:!0,children:`s`}),` or `,(0,G.jsx)(T,{bold:!0,children:`Enter`}),` to save, `,(0,G.jsx)(T,{bold:!0,children:`e`}),` to save and edit`]})})]})})}var G,ur=e((()=>{k(),S(),At(),Ve(),Lt(),tt(),x(),W(),U(),Sn(),cr(),G=A()}));function dr({tools:e,existingAgents:t,onComplete:n}){let{wizardData:r}=V(),[i,a]=(0,fr.useState)(null),o=s(),c=(0,fr.useCallback)(async e=>{if(r?.finalAgent)try{await vn(r.location,r.finalAgent.agentType,r.finalAgent.whenToUse,r.finalAgent.tools,r.finalAgent.getSystemPrompt(),!0,r.finalAgent.color,r.finalAgent.model,r.finalAgent.memory),o(e=>{if(!r.finalAgent)return e;let t=e.agentDefinitions.allAgents.concat(r.finalAgent);return{...e,agentDefinitions:{...e.agentDefinitions,activeAgents:Xe(t),allAgents:t}}}),et(),e&&await nn(pn({source:r.location,agentType:r.finalAgent.agentType})),Ft(`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: ${ct.bold(r.finalAgent.agentType)} and opened in editor. If you made edits, restart to load the latest version.`:`Created agent: ${ct.bold(r.finalAgent.agentType)}`)}catch(e){a(e instanceof Error?e.message:`Failed to save agent`)}},[r,n,o]);return(0,pr.jsx)(lr,{tools:e,existingAgents:t,onSave:(0,fr.useCallback)(()=>c(!1),[c]),onSaveAndEdit:(0,fr.useCallback)(()=>c(!0),[c]),error:i})}var fr,pr,mr=e((()=>{lt(),fr=t(O(),1),Pt(),we(),We(),tn(),W(),Sn(),ur(),pr=A()}));function hr(){let{goNext:e,goBack:t,updateWizardData:n,wizardData:r}=V(),[i,a]=(0,gr.useState)(r.whenToUse||``),[o,s]=(0,gr.useState)(i.length),[c,l]=(0,gr.useState)(null);return D(`confirm:no`,t,{context:`Settings`}),D(`chat:externalEditor`,(0,gr.useCallback)(async()=>{let e=await en(i);e.content!==null&&(a(e.content),s(e.content.length))},[i]),{context:`Chat`}),(0,K.jsx)(H,{subtitle:`Description (tell Claude when to use this agent)`,footerText:(0,K.jsxs)(E,{children:[(0,K.jsx)(C,{shortcut:`Type`,action:`enter text`}),(0,K.jsx)(C,{shortcut:`Enter`,action:`continue`}),(0,K.jsx)(m,{action:`chat:externalEditor`,context:`Chat`,fallback:`ctrl+g`,description:`open in editor`}),(0,K.jsx)(m,{action:`confirm:no`,context:`Settings`,fallback:`Esc`,description:`go back`})]}),children:(0,K.jsxs)(w,{flexDirection:`column`,children:[(0,K.jsx)(T,{children:`When should Claude use this agent?`}),(0,K.jsx)(w,{marginTop:1,children:(0,K.jsx)(Pe,{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,K.jsx)(w,{marginTop:1,children:(0,K.jsx)(T,{color:`error`,children:c})})]})})}var gr,K,_r=e((()=>{gr=t(O(),1),k(),S(),tn(),x(),Ue(),W(),U(),K=A()}));async function vr(e,t,n,r){let i=pe({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 ee(),o=Ze([i],a),s=jt()?yr+br:yr,c=await ce({messages:te(o),systemPrompt:Ut([s]),thinkingConfig:{type:`disabled`},tools:[],signal:r,options:{getToolPermissionContext:async()=>Vt(),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=ht(l.trim())}catch{let e=l.match(/\{[\s\S]*\}/);if(!e)throw Error(`No JSON object found in response`);u=ht(e[0])}if(!u.identifier||!u.whenToUse||!u.systemPrompt)throw Error(`Invalid agent configuration generated`);return Ft(`tengu_agent_definition_generated`,{agent_identifier:u.identifier}),{identifier:u.identifier,whenToUse:u.whenToUse,systemPrompt:u.systemPrompt}}var yr,br,xr=e((()=>{Te(),Se(),Ht(),St(),nt(),ae(),At(),Pt(),yt(),Ae(),yr=`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 ${bt} 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 ${bt} 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
- `,br=`
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 Sr(){let{updateWizardData:e,goBack:t,goToStep:n,wizardData:r}=V(),[i,a]=(0,q.useState)(r.generationPrompt||``),[o,s]=(0,q.useState)(!1),[c,l]=(0,q.useState)(null),[u,d]=(0,q.useState)(i.length),f=rn(),p=(0,q.useRef)(null);D(`confirm:no`,(0,q.useCallback)(()=>{p.current&&(p.current.abort(),p.current=null,s(!1),l(`Generation cancelled`))},[]),{context:`Settings`,isActive:o}),D(`chat:externalEditor`,(0,q.useCallback)(async()=>{let e=await en(i);e.content!==null&&(a(e.content),d(e.content.length))},[i]),{context:`Chat`,isActive:!o}),D(`confirm:no`,(0,q.useCallback)(()=>{e({generationPrompt:``,agentType:``,systemPrompt:``,whenToUse:``,generatedAgent:void 0,wasGenerated:!1}),a(``),l(null),t()},[e,t]),{context:`Settings`,isActive:!o});let h=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=ot();p.current=r;try{let i=await vr(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 vt||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}},g=`Describe what this agent should do and when it should be used (be comprehensive for best results)`;return o?(0,J.jsx)(H,{subtitle:g,footerText:(0,J.jsx)(m,{action:`confirm:no`,context:`Settings`,fallback:`Esc`,description:`cancel`}),children:(0,J.jsxs)(w,{flexDirection:`row`,alignItems:`center`,children:[(0,J.jsx)(oe,{}),(0,J.jsx)(T,{color:`suggestion`,children:` Generating agent from description...`})]})}):(0,J.jsx)(H,{subtitle:g,footerText:(0,J.jsxs)(E,{children:[(0,J.jsx)(m,{action:`confirm:yes`,context:`Confirmation`,fallback:`Enter`,description:`submit`}),(0,J.jsx)(m,{action:`chat:externalEditor`,context:`Chat`,fallback:`ctrl+g`,description:`open in editor`}),(0,J.jsx)(m,{action:`confirm:no`,context:`Settings`,fallback:`Esc`,description:`go back`})]}),children:(0,J.jsxs)(w,{flexDirection:`column`,children:[c&&(0,J.jsx)(w,{marginBottom:1,children:(0,J.jsx)(T,{color:`error`,children:c})}),(0,J.jsx)(Pe,{value:i,onChange:a,onSubmit:h,placeholder:`e.g., Help me write unit tests for my code...`,columns:80,cursorOffset:u,onChangeCursorOffset:d,focus:!0,showCursor:!0})]})})}var q,J,Cr=e((()=>{_t(),q=t(O(),1),an(),k(),S(),f(),tn(),x(),se(),Ue(),W(),U(),xr(),J=A()}));function wr(){let{goNext:e,updateWizardData:t,cancel:n}=V();return(0,Y.jsx)(H,{subtitle:`Choose location`,footerText:(0,Y.jsxs)(E,{children:[(0,Y.jsx)(C,{shortcut:`↑↓`,action:`navigate`}),(0,Y.jsx)(C,{shortcut:`Enter`,action:`select`}),(0,Y.jsx)(m,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})]}),children:(0,Y.jsx)(w,{children:(0,Y.jsx)(fe,{options:[{label:`Project (.workmate/agents/)`,value:`projectSettings`},{label:`Personal (~/.workmate/agents/)`,value:`userSettings`}],onChange:n=>{t({location:n}),e()},onCancel:()=>n()},`location-select`)})})}var Y,Tr=e((()=>{k(),x(),u(),W(),U(),Y=A()}));function Er(){let{goNext:e,goBack:t,updateWizardData:n,wizardData:r}=V();D(`confirm:no`,t,{context:`Confirmation`});let i=r.location===`userSettings`?[{label:`User scope (~/.workmate/agent-memory/) (Recommended)`,value:`user`},{label:`None (no persistent memory)`,value:`none`},{label:`Project scope (.workmate/agent-memory/)`,value:`project`},{label:`Local scope (.workmate/agent-memory-local/)`,value:`local`}]:[{label:`Project scope (.workmate/agent-memory/) (Recommended)`,value:`project`},{label:`None (no persistent memory)`,value:`none`},{label:`User scope (~/.workmate/agent-memory/)`,value:`user`},{label:`Local scope (.workmate/agent-memory-local/)`,value:`local`}];return(0,X.jsx)(H,{subtitle:`Configure agent memory`,footerText:(0,X.jsxs)(E,{children:[(0,X.jsx)(C,{shortcut:`↑↓`,action:`navigate`}),(0,X.jsx)(C,{shortcut:`Enter`,action:`select`}),(0,X.jsx)(m,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`})]}),children:(0,X.jsx)(w,{children:(0,X.jsx)(fe,{options:i,onChange:t=>{let i=t===`none`?void 0:t,a=r.finalAgent?.agentType;n({selectedMemory:i,finalAgent:r.finalAgent?{...r.finalAgent,memory:i,getSystemPrompt:jt()&&i&&a?()=>`${r.systemPrompt}\n\n${rt(a,i)}`:()=>r.systemPrompt}:void 0}),e()},onCancel:t},`memory-select`)})})}var X,Dr=e((()=>{k(),S(),At(),Ve(),x(),u(),W(),U(),X=A()}));function Or(){let{goNext:e,goBack:t,updateWizardData:n,goToStep:r}=V();return(0,kr.jsx)(H,{subtitle:`Creation method`,footerText:(0,kr.jsxs)(E,{children:[(0,kr.jsx)(C,{shortcut:`↑↓`,action:`navigate`}),(0,kr.jsx)(C,{shortcut:`Enter`,action:`select`}),(0,kr.jsx)(m,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`})]}),children:(0,kr.jsx)(w,{children:(0,kr.jsx)(fe,{options:[{label:`Generate with Claude (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((()=>{k(),x(),u(),W(),U(),kr=A()}));function jr(){let{goNext:e,goBack:t,updateWizardData:n,wizardData:r}=V();return(0,Mr.jsx)(H,{subtitle:`Select model`,footerText:(0,Mr.jsxs)(E,{children:[(0,Mr.jsx)(C,{shortcut:`↑↓`,action:`navigate`}),(0,Mr.jsx)(C,{shortcut:`Enter`,action:`select`}),(0,Mr.jsx)(m,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`})]}),children:(0,Mr.jsx)(kn,{initialModel:r.selectedModel,onComplete:t=>{n({selectedModel:t}),e()},onCancel:t})})}var Mr,Nr=e((()=>{x(),k(),W(),U(),Mn(),Mr=A()}));function Pr(){let{goNext:e,goBack:t,updateWizardData:n,wizardData:r}=V(),[i,a]=(0,Fr.useState)(r.systemPrompt||``),[o,s]=(0,Fr.useState)(i.length),[c,l]=(0,Fr.useState)(null);return D(`confirm:no`,t,{context:`Settings`}),D(`chat:externalEditor`,(0,Fr.useCallback)(async()=>{let e=await en(i);e.content!==null&&(a(e.content),s(e.content.length))},[i]),{context:`Chat`}),(0,Z.jsx)(H,{subtitle:`System prompt`,footerText:(0,Z.jsxs)(E,{children:[(0,Z.jsx)(C,{shortcut:`Type`,action:`enter text`}),(0,Z.jsx)(C,{shortcut:`Enter`,action:`continue`}),(0,Z.jsx)(m,{action:`chat:externalEditor`,context:`Chat`,fallback:`ctrl+g`,description:`open in editor`}),(0,Z.jsx)(m,{action:`confirm:no`,context:`Settings`,fallback:`Esc`,description:`go back`})]}),children:(0,Z.jsxs)(w,{flexDirection:`column`,children:[(0,Z.jsx)(T,{children:`Enter the system prompt for your agent:`}),(0,Z.jsx)(T,{dimColor:!0,children:`Be comprehensive for best results`}),(0,Z.jsx)(w,{marginTop:1,children:(0,Z.jsx)(Pe,{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)(w,{marginTop:1,children:(0,Z.jsx)(T,{color:`error`,children:c})})]})})}var Fr,Z,Ir=e((()=>{Fr=t(O(),1),k(),S(),tn(),x(),Ue(),W(),U(),Z=A()}));function Lr({tools:e}){let{goNext:t,goBack:n,updateWizardData:r,wizardData:i}=V(),a=e=>{r({selectedTools:e}),t()},o=i.selectedTools;return(0,Rr.jsx)(H,{subtitle:`Select tools`,footerText:(0,Rr.jsxs)(E,{children:[(0,Rr.jsx)(C,{shortcut:`Enter`,action:`toggle selection`}),(0,Rr.jsx)(C,{shortcut:`↑↓`,action:`navigate`}),(0,Rr.jsx)(m,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`})]}),children:(0,Rr.jsx)(Fn,{tools:e,initialTools:o,onComplete:a,onCancel:n})})}var Rr,zr=e((()=>{k(),x(),W(),U(),In(),Rr=A()}));function Br(e){let{goNext:t,goBack:n,updateWizardData:r,wizardData:i}=V(),[a,o]=(0,Vr.useState)(i.agentType||``),[s,c]=(0,Vr.useState)(null),[l,u]=(0,Vr.useState)(a.length);return D(`confirm:no`,n,{context:`Settings`}),(0,Q.jsx)(H,{subtitle:`Agent type (identifier)`,footerText:(0,Q.jsxs)(E,{children:[(0,Q.jsx)(C,{shortcut:`Type`,action:`enter text`}),(0,Q.jsx)(C,{shortcut:`Enter`,action:`continue`}),(0,Q.jsx)(m,{action:`confirm:no`,context:`Settings`,fallback:`Esc`,description:`go back`})]}),children:(0,Q.jsxs)(w,{flexDirection:`column`,children:[(0,Q.jsx)(T,{children:`Enter a unique identifier for your agent:`}),(0,Q.jsx)(w,{marginTop:1,children:(0,Q.jsx)(Pe,{value:a,onChange:o,onSubmit:e=>{let n=e.trim(),i=or(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)(w,{marginTop:1,children:(0,Q.jsx)(T,{color:`error`,children:s})})]})})}var Vr,Q,Hr=e((()=>{Vr=t(O(),1),k(),S(),x(),Ue(),W(),U(),cr(),Q=A()}));function Ur({tools:e,existingAgents:t,onComplete:n,onCancel:r}){return(0,Wr.jsx)(qn,{steps:[wr,Or,Sr,()=>(0,Wr.jsx)(Br,{existingAgents:t}),Pr,hr,()=>(0,Wr.jsx)(Lr,{tools:e}),jr,rr,...jt()?[Er]:[],()=>(0,Wr.jsx)(dr,{tools:e,existingAgents:t,onComplete:n})],initialData:{},onComplete:()=>{},onCancel:r,title:`Create new agent`,showStepCounter:!1})}var Wr,Gr=e((()=>{At(),W(),ar(),mr(),_r(),Cr(),Tr(),Dr(),Ar(),Nr(),Ir(),zr(),Hr(),Wr=A()}));function Kr({tools:e,onExit:t}){let[n,r]=(0,qr.useState)({mode:`list-agents`,source:`all`}),i=De(e=>e.agentDefinitions),a=De(e=>e.mcp.tools),o=De(e=>e.toolPermissionContext),c=s(),{allAgents:l,activeAgents:u}=i,[d,f]=(0,qr.useState)([]),p=Qt(e,a,o);Xt();let m=(0,qr.useMemo)(()=>({"built-in":l.filter(e=>e.source===`built-in`),userSettings:l.filter(e=>e.source===`userSettings`),projectSettings:l.filter(e=>e.source===`projectSettings`),policySettings:l.filter(e=>e.source===`policySettings`),localSettings:l.filter(e=>e.source===`localSettings`),flagSettings:l.filter(e=>e.source===`flagSettings`),plugin:l.filter(e=>e.source===`plugin`),all:l}),[l]),h=(0,qr.useCallback)(e=>{f(t=>[...t,e]),r({mode:`list-agents`,source:`all`})},[]),g=(0,qr.useCallback)(async e=>{try{await bn(e),c(t=>{let n=t.agentDefinitions.allAgents.filter(t=>!(t.agentType===e.agentType&&t.source===e.source));return{...t,agentDefinitions:{...t.agentDefinitions,allAgents:n,activeAgents:Xe(n)}}}),f(t=>[...t,`Deleted agent: ${ct.bold(e.agentType)}`]),r({mode:`list-agents`,source:`all`})}catch(e){Nt(gt(e))}},[c]);switch(n.mode){case`list-agents`:{let e=qt(n.source===`all`?[...m[`built-in`],...m.userSettings,...m.projectSettings,...m.localSettings,...m.policySettings,...m.flagSettings,...m.plugin]:m[n.source],u);return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Wn,{source:n.source,agents:e,onBack:()=>{t((d.length>0?`Agent changes:\n${d.join(`
101
- `)}`:void 0)??`Agents dialog dismissed`,{display:d.length===0?`system`:void 0})},onSelect:e=>r({mode:`agent-menu`,agent:e,previousMode:n}),onCreateNew:()=>r({mode:`create-agent`}),changes:d}),(0,$.jsx)(Vn,{})]})}case`create-agent`:return(0,$.jsx)(Ur,{tools:p,existingAgents:u,onComplete:h,onCancel:()=>r({mode:`list-agents`,source:`all`})});case`agent-menu`:{let e=l.find(e=>e.agentType===n.agent.agentType&&e.source===n.agent.source)||n.agent,t=[{label:`View agent`,value:`view`},...e.source!==`built-in`&&e.source!==`plugin`&&e.source!==`flagSettings`?[{label:`Edit agent`,value:`edit`},{label:`Delete agent`,value:`delete`}]:[],{label:`Back`,value:`back`}];return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(ut,{title:n.agent.agentType,onCancel:()=>r(n.previousMode),hideInputGuide:!0,children:(0,$.jsxs)(w,{flexDirection:`column`,children:[(0,$.jsx)(fe,{options:t,onChange:t=>{switch(t){case`view`:r({mode:`view-agent`,agent:e,previousMode:n.previousMode});break;case`edit`:r({mode:`edit-agent`,agent:e,previousMode:n});break;case`delete`:r({mode:`delete-confirm`,agent:e,previousMode:n});break;case`back`:r(n.previousMode);break}},onCancel:()=>r(n.previousMode)}),d.length>0&&(0,$.jsx)(w,{marginTop:1,children:(0,$.jsx)(T,{dimColor:!0,children:d[d.length-1]})})]})}),(0,$.jsx)(Vn,{})]})}case`view-agent`:{let e=l.find(e=>e.agentType===n.agent.agentType&&e.source===n.agent.source)||n.agent;return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(ut,{title:e.agentType,onCancel:()=>r({mode:`agent-menu`,agent:e,previousMode:n.previousMode}),hideInputGuide:!0,children:(0,$.jsx)(Cn,{agent:e,tools:p,allAgents:l,onBack:()=>r({mode:`agent-menu`,agent:e,previousMode:n.previousMode})})}),(0,$.jsx)(Vn,{instructions:`Press Enter or Esc to go back`})]})}case`delete-confirm`:return(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(ut,{title:`Delete agent`,onCancel:()=>{`previousMode`in n&&r(n.previousMode)},color:`error`,children:[(0,$.jsxs)(T,{children:[`Are you sure you want to delete the agent `,(0,$.jsx)(T,{bold:!0,children:n.agent.agentType}),`?`]}),(0,$.jsx)(w,{marginTop:1,children:(0,$.jsxs)(T,{dimColor:!0,children:[`Source: `,n.agent.source]})}),(0,$.jsx)(w,{marginTop:1,children:(0,$.jsx)(fe,{options:[{label:`Yes, delete`,value:`yes`},{label:`No, cancel`,value:`no`}],onChange:e=>{e===`yes`?g(n.agent):`previousMode`in n&&r(n.previousMode)},onCancel:()=>{`previousMode`in n&&r(n.previousMode)}})})]}),(0,$.jsx)(Vn,{instructions:`Press ↑↓ to navigate, Enter to select, Esc to cancel`})]});case`edit-agent`:{let e=l.find(e=>e.agentType===n.agent.agentType&&e.source===n.agent.source)||n.agent;return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(ut,{title:`Edit agent: ${e.agentType}`,onCancel:()=>r(n.previousMode),hideInputGuide:!0,children:(0,$.jsx)(zn,{agent:e,tools:p,onSaved:e=>{h(e),r(n.previousMode)},onBack:()=>r(n.previousMode)})}),(0,$.jsx)(Vn,{})]})}default:return null}}var qr,$,Jr=e((()=>{lt(),qr=t(O(),1),Zt(),$t(),k(),we(),Gt(),We(),mt(),Mt(),u(),wn(),Bn(),Un(),Kn(),Sn(),Gr(),$=A()}));async function Yr(e,t){let n=t.getAppState().toolPermissionContext;return(0,Xr.jsx)(Kr,{tools:ne(n),onExit:e})}var Xr;e((()=>{Jr(),Ke(),Xr=A()}))();export{Yr as call};
@@ -1 +0,0 @@
1
- import{a as e,o as t}from"./api-C5I2xwgd.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{aS as o,nf as s,oS as c,rf as l}from"./loadAgentsDir-JrGMJN05.js";import{C as ee,P as u,R as te,c as d,i as ne,x as f}from"./debug-BQj6h99Q.js";import{g as p,n as m}from"./settings-aUygByiZ.js";import{c as re,h,y as g}from"./config-BkbL2e5Q.js";import{o as _,s as v}from"./log-BlJ7CcKG.js";import{n as y,r as b}from"./analytics-DJobLaWP.js";import{l as x,u as S}from"./oauth-D38aRTUb.js";import{$n as ie,Ar as ae,Br as C,Bt as w,Cn as oe,Dt as se,En as ce,Ft as le,Hr as T,Ir as E,Mr as D,Or as O,Ot as k,Pr as A,Rr as j,Sn as M,St as N,Ur as P,fn as F,gn as I,ii as L,jn as R,jr as z,jt as B,kr as V,mn as H,nn as U,nr as W,oi as ue,pn as G,un as de,yt as fe,zr as K}from"./model-CmDF8O9G.js";import{n as pe,t as me}from"./userAgent-BggRZ-ZE.js";import{F as q,T as he}from"./sessionState-C2REgUrs.js";import{d as ge,u as _e}from"./firstPartyEventLogger-D4yuDP-n.js";import{n as ve}from"./trustedDevice-BF78PNK8.js";import{i as ye,r as be}from"./grove-DsAIY-rZ.js";import{t as xe}from"./remoteManagedSettings-BcLJLEr7.js";import{d as Se,n as Ce,t as we}from"./status-BraYBx4N.js";import{createHash as Te,randomBytes as J}from"crypto";import{createServer as Ee}from"http";l(),w(),R(),h(),oe(),I(),_e();async function Y(){k.cache?.clear?.(),ve(),ce(),H(),ge(),be.cache?.clear?.(),ye.cache?.clear?.(),await xe(),await s()}async function De({clearOnboarding:e=!1}){let{flushTelemetry:t}=await import(`./instrumentation-5cSwEKaF.js`);await t(),await de(),M().delete(),await Y(),g(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(),y(),p(),ue(),P(),A(),he(),a(),S(),h(),W(),_(),pe();async function Oe(){try{if(re().claudeCodeFirstTokenDate!==void 0)return;let e=ie();if(e.error){v(Error(`Failed to get auth headers: ${e.error}`));return}let t=`${x().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)){v(Error(`Received invalid first_token_date from API: ${n}`));return}}g(e=>({...e,claudeCodeFirstTokenDate:n}))}catch(e){v(e)}}o(),S(),_();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,b(`tengu_oauth_automatic_redirect`,{custom_handler:!0});return}let n=K(e)?x().CLAUDEAI_SUCCESS_URL:x().CONSOLE_SUCCESS_URL;this.pendingResponse.writeHead(302,{Location:n}),this.pendingResponse.end(),this.pendingResponse=null,b(`tengu_oauth_automatic_redirect`,{})}handleErrorRedirect(){if(!this.pendingResponse)return;let e=x().CLAUDEAI_SUCCESS_URL;this.pendingResponse.writeHead(302,{Location:e}),this.pendingResponse.end(),this.pendingResponse=null,b(`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){v(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))}y(),A(),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=O({...i,isManual:!0}),o=O({...i,isManual:!1}),s=await this.waitForAuthorizationCode(r,async()=>{t?.skipBrowserOpen?await e(a,o):(await e(a),await c(o))}),l=this.authCodeListener?.hasPendingResponse()??!1;b(`tengu_oauth_auth_code_received`,{automatic:l});try{let e=await ae(s,r,this.codeVerifier,this.port,!l,t?.expiresIn),n=await D(e.access_token);if(l){let t=E(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:E(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}};y(),A(),w(),h(),_(),Se();async function $(e){await De({clearOnboarding:!1});let t=e.profile??await T(e.accessToken);t?C({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&&C({accountUuid:e.tokenAccount.uuid,emailAddress:e.tokenAccount.emailAddress,organizationUuid:e.tokenAccount.organizationUuid});let n=F(e);if(fe(),n.warning&&b(`tengu_oauth_storage_warning`,{warning:n.warning}),await z(e.accessToken).catch(e=>d(String(e),{level:`error`})),K(e.scopes))await Oe().catch(e=>d(String(e),{level:`error`}));else if(!await V(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{b(`tengu_login_from_refresh_token`,{});let e=await j(s,{scopes:t});await $(e);let n=await G();n.valid||(process.stderr.write(`${n.message}\n`),process.exit(1)),g(e=>e.hasCompletedOnboarding?e:{...e,hasCompletedOnboarding:!0}),b(`tengu_oauth_success`,{loginWithClaudeAi:K(e.scopes)}),process.stdout.write(`Login successful.
6
- `),process.exit(0)}catch(e){v(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{b(`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 G();t.valid||(process.stderr.write(`${t.message}\n`),process.exit(1)),b(`tengu_oauth_success`,{loginWithClaudeAi:a}),process.stdout.write(`Login successful.
8
- `),process.exit(0)}catch(e){v(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}=se(),{source:i}=N(),a=!!process.env.ANTHROPIC_API_KEY&&!e(),o=B(),s=le(),c=U(),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=L(),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-BYCRa_mb.js";export{t as authLogin,e as authStatus};
@@ -1 +0,0 @@
1
- import{Bt as e,It as t,Ot as n,mt as r,yt as i}from"./model-CmDF8O9G.js";e();export{r as checkAndRefreshOAuthTokenIfNeeded,i as clearOAuthTokenCache,n as getClaudeAIOAuthTokens,t as handleOAuth401Error};
@@ -1 +0,0 @@
1
- import{t as e}from"./backgroundHousekeeping-CjD8bACB.js";export{e as startBackgroundHousekeeping};
@@ -1 +0,0 @@
1
- import{a as e,n as t,o as n,t as r}from"./bridgeConfig-CgAVrQfz.js";e();export{r as getBridgeAccessToken,t as getBridgeBaseUrl,n as isSelfHostedBridge};
@@ -1 +0,0 @@
1
- import{fS as e,uS as t}from"./loadAgentsDir-JrGMJN05.js";import{t as n}from"./src-DL3w8VPk2.js";import{v as r}from"./startupProfiler-2sjXZkIP.js";import{a as i,n as a,o}from"./bridgeConfig-CgAVrQfz.js";e(),i(),n(),r();function s(e,n){return`${o()?a():t(void 0,n)}/code?bridge=${e}`}function c({error:e,connected:t,sessionActive:n,reconnecting:r}){return e?{label:`Remote Control failed`,color:`error`}:r?{label:`Remote Control reconnecting`,color:`warning`}:n||t?{label:`Remote Control active`,color:`success`}:{label:`Remote Control connecting…`,color:`warning`}}function l(e){return`Code everywhere with the Claude app or ${e}`}function u(e){return`Continue coding in the Claude app or ${e}`}var d=`Something went wrong, please try again`;export{c as a,l as i,u as n,s as r,d as t};
@@ -1 +0,0 @@
1
- import{n as e,t}from"./caches-wN3JyvNE.js";e();export{t as clearSessionCaches};
@@ -1 +0,0 @@
1
- import{F as e,R as t}from"./debug-BQj6h99Q.js";import{o as n,s as r}from"./log-BlJ7CcKG.js";import{i,o as a,t as o}from"./platform-DVeTi9mp.js";import{a as s,i as c,s as l,u}from"./types-BomO8WUz.js";import{homedir as d}from"os";import{join as f}from"path";import{readFile as p,readdir as m,stat as h}from"fs/promises";s(),t(),l(),n(),a();async function g(){let e=i();if(!o.includes(e))throw Error(`Unsupported platform: ${e} - Claude Desktop integration only works on macOS and WSL.`);if(e===`macos`)return f(d(),`Library`,`Application Support`,`Claude`,`claude_desktop_config.json`);let t=process.env.USERPROFILE?process.env.USERPROFILE.replace(/\\/g,`/`):null;if(t){let e=`/mnt/c${t.replace(/^[A-Z]:/,``)}/AppData/Roaming/Claude/claude_desktop_config.json`;try{return await h(e),e}catch{}}try{let e=`/mnt/c/Users`;try{let t=await m(e,{withFileTypes:!0});for(let n of t){if(n.name===`Public`||n.name===`Default`||n.name===`Default User`||n.name===`All Users`)continue;let t=f(e,n.name,`AppData`,`Roaming`,`Claude`,`claude_desktop_config.json`);try{return await h(t),t}catch{}}}catch{}}catch(e){r(e)}throw Error(`Could not find Claude Desktop config file in Windows. Make sure Claude Desktop is installed on Windows.`)}async function _(){if(!o.includes(i()))throw Error(`Unsupported platform - Claude Desktop integration only works on macOS and WSL.`);try{let t=await g(),n;try{n=await p(t,{encoding:`utf8`})}catch(t){if(e(t)===`ENOENT`)return{};throw t}let r=u(n);if(!r||typeof r!=`object`)return{};let i=r.mcpServers;if(!i||typeof i!=`object`)return{};let a={};for(let[e,t]of Object.entries(i)){if(!t||typeof t!=`object`)continue;let n=c().safeParse(t);n.success&&(a[e]=n.data)}return a}catch(e){return r(e),{}}}export{_ as readClaudeDesktopMcpServers};