@readmagic/workmate 0.0.10 → 0.0.11

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 (399) hide show
  1. package/dist/chunks/{AddWorkspaceDirectory-Vmmm7p1c.js → AddWorkspaceDirectory-ag2JTpmU.js} +1 -1
  2. package/dist/chunks/App-BuKmqFPm.js +1 -0
  3. package/dist/chunks/ApproveApiKey-CIWOi_7v.js +1 -0
  4. package/dist/chunks/ApproveApiKey-M6U-NafA.js +1 -0
  5. package/dist/chunks/BackgroundTasksDialog-Pnpl3Ixx.js +2 -0
  6. package/dist/chunks/{BypassPermissionsModeDialog-CLSACUmo.js → BypassPermissionsModeDialog-B05t83wa.js} +1 -1
  7. package/dist/chunks/{ClaudeMdExternalIncludesDialog-BqNxQOXJ.js → ClaudeMdExternalIncludesDialog-CSywJdVL.js} +1 -1
  8. package/dist/chunks/ClaudeMdExternalIncludesDialog-D-w166RC.js +1 -0
  9. package/dist/chunks/ConsoleOAuthFlow-CV6PcJOP.js +1 -0
  10. package/dist/chunks/{DiffDialog-9AYwtupw.js → DiffDialog-DUbFrzKu.js} +2 -2
  11. package/dist/chunks/Doctor-BcnUfJ4I.js +1 -0
  12. package/dist/chunks/Doctor-Dz4TuYas.js +3 -0
  13. package/dist/chunks/ExitFlow-BwyAtIHx.js +2 -0
  14. package/dist/chunks/{Grove-B9-hhkZA.js → Grove-BDoVj02t.js} +2 -2
  15. package/dist/chunks/{HybridTransport-MxJ_W_np.js → HybridTransport-C_U0IJfz.js} +4 -4
  16. package/dist/chunks/InvalidConfigDialog-bih293Xt.js +1 -0
  17. package/dist/chunks/{InvalidSettingsDialog-YyQcHocx.js → InvalidSettingsDialog-Br8kQOHz.js} +1 -1
  18. package/dist/chunks/MCPConnectionManager-B9n4SXN4.js +1 -0
  19. package/dist/chunks/MCPToolListView-DJ06N1DG.js +1 -0
  20. package/dist/chunks/{McpParsingWarnings-BCpfHaBK.js → McpParsingWarnings-COa71S9q.js} +1 -1
  21. package/dist/chunks/MessageSelector-o4ULADFg.js +3 -0
  22. package/dist/chunks/Messages-qqwHuAW5.js +11 -0
  23. package/dist/chunks/{Onboarding-ClwHS5rh.js → Onboarding-BzuQjney.js} +1 -1
  24. package/dist/chunks/{PromptInputFooterSuggestions-BSA9NrZc.js → PromptInputFooterSuggestions-to5eYBvI.js} +1 -1
  25. package/dist/chunks/{PromptInputHelpMenu-Bb4KdIX_.js → PromptInputHelpMenu-CfMFx-TF.js} +1 -1
  26. package/dist/chunks/QueryEngine-Dt0BKUeF.js +1 -0
  27. package/dist/chunks/REPL-CUbEDqEl.js +133 -0
  28. package/dist/chunks/REPL-DMaKNhTa.js +1 -0
  29. package/dist/chunks/{RemoteSessionManager-CS6mywIn.js → RemoteSessionManager-Bf44A0Ol.js} +2 -2
  30. package/dist/chunks/ResumeConversation-Ctw5Q1g9.js +1 -0
  31. package/dist/chunks/{SSETransport-CoxQ8YpH.js → SSETransport-DN4tCDEh.js} +3 -3
  32. package/dist/chunks/SearchExtraToolsTool-C80OdtPZ.js +1 -0
  33. package/dist/chunks/Settings-DfdcmvOV.js +2 -0
  34. package/dist/chunks/{TeleportProgress-Doucj-50.js → TeleportProgress-C2LQVLav.js} +1 -1
  35. package/dist/chunks/TeleportRepoMismatchDialog-BZL8Zblz.js +1 -0
  36. package/dist/chunks/{TeleportResumeWrapper-D6kpr2c6.js → TeleportResumeWrapper-wPiIs8xg.js} +1 -1
  37. package/dist/chunks/{ThemePicker-DrC8tlp0.js → ThemePicker-BT_NaRQC.js} +1 -1
  38. package/dist/chunks/{TrustDialog-Fk4m_Sy4.js → TrustDialog-ACaJ_m7A.js} +1 -1
  39. package/dist/chunks/{ValidationErrorsList-D_OUa4RT.js → ValidationErrorsList-C-hWdy_8.js} +1 -1
  40. package/dist/chunks/{WelcomeV2-DvfQHnZY.js → WelcomeV2-ZQRKlcT4.js} +1 -1
  41. package/dist/chunks/add-dir-SAKTkw0S.js +1 -0
  42. package/dist/chunks/{agentDisplay-B755vMZE.js → agentDisplay-CuSHqgZc.js} +1 -1
  43. package/dist/chunks/{agents-CIvP8l0s.js → agents-CMC0iQP4.js} +1 -1
  44. package/dist/chunks/agents-ZgRKpjHv.js +103 -0
  45. package/dist/chunks/allErrors-_cOQksHC.js +1 -0
  46. package/dist/chunks/{api-nSHc_GIQ.js → api-BbJfMXRS.js} +1 -1
  47. package/dist/chunks/api-DS1MiW01.js +1 -0
  48. package/dist/chunks/{auth-5QB6tsfB.js → auth-7mJGtlZp.js} +2 -2
  49. package/dist/chunks/auth-DGZzCbU0.js +1 -0
  50. package/dist/chunks/auth-DN1MUpB8.js +1 -0
  51. package/dist/chunks/{autoMode-BnUiK9Cu.js → autoMode-CBtY7ACs.js} +6 -6
  52. package/dist/chunks/{autonomy-Src6sKCp.js → autonomy-DuQmYhq6.js} +9 -9
  53. package/dist/chunks/{autonomy-C1aSgWPQ.js → autonomy-lJV7yWUl.js} +1 -1
  54. package/dist/chunks/autonomyPanel-DAQm6lDz.js +1 -0
  55. package/dist/chunks/backgroundHousekeeping-BTy71bcY.js +1 -0
  56. package/dist/chunks/backgroundHousekeeping-Cc7Ag7JG.js +17 -0
  57. package/dist/chunks/{banner-D0P7wXdw.js → banner-1Wyeyawe.js} +1 -1
  58. package/dist/chunks/{bg-DAPORXF3.js → bg-CJ0YWFli.js} +2 -2
  59. package/dist/chunks/bg-CeUrRz_7.js +1 -0
  60. package/dist/chunks/{branch-DFWa4Oxo.js → branch-k3kirqbA.js} +2 -2
  61. package/dist/chunks/{break-cache-Chj9i9MP.js → break-cache-CAoZ9b72.js} +1 -1
  62. package/dist/chunks/bridgeConfig-CzRUPn-D.js +1 -0
  63. package/dist/chunks/{bridgeConfig-Bb6URf4Q.js → bridgeConfig-UgaUfuP6.js} +1 -1
  64. package/dist/chunks/{bridgeMessaging-C3huGcR3.js → bridgeMessaging-Ci5H68MX.js} +1 -1
  65. package/dist/chunks/{bridgePointer-DLYyvRKb.js → bridgePointer-BL8-lGvN.js} +1 -1
  66. package/dist/chunks/{bridgeStatusUtil-DFMftajD.js → bridgeStatusUtil-C36w15ge.js} +1 -1
  67. package/dist/chunks/btw-nVoVuIae.js +1 -0
  68. package/dist/chunks/caches-B8sM3Zys.js +1 -0
  69. package/dist/chunks/caches-Bp9MZ7IE.js +1 -0
  70. package/dist/chunks/{capacityWake-amzeeBz0.js → capacityWake-BOySRJUJ.js} +1 -1
  71. package/dist/chunks/ccrClient-Br4LAofR.js +1 -0
  72. package/dist/chunks/{claudeDesktop-CsJfF1b-.js → claudeDesktop-Bgds1-YT.js} +1 -1
  73. package/dist/chunks/{clear-ClFDpWVJ.js → clear-C4Vtnbye.js} +1 -1
  74. package/dist/chunks/{cliLaunch-BWcoyZDP.js → cliLaunch-BTpfAGGI.js} +1 -1
  75. package/dist/chunks/{client-DFlE4fYh.js → client-B9404qIP.js} +1 -1
  76. package/dist/chunks/client-BCAbKdNz.js +1 -0
  77. package/dist/chunks/client-CJE6gEvU.js +1 -0
  78. package/dist/chunks/commands-DL-BzoMQ.js +1 -0
  79. package/dist/chunks/compact-Cx7BPXLU.js +2 -0
  80. package/dist/chunks/config-S5OW4Xqr.js +1 -0
  81. package/dist/chunks/{config-Do1870_d.js → config-aRiTrtCv.js} +2 -2
  82. package/dist/chunks/{config-CVHMRMwd.js → config-kB2eazPX.js} +1 -1
  83. package/dist/chunks/context-BN7DEjoH.js +1 -0
  84. package/dist/chunks/{context-noninteractive-D5iQhasu.js → context-noninteractive-D91W2B8e.js} +5 -5
  85. package/dist/chunks/context-noninteractive-DPacEFJ1.js +1 -0
  86. package/dist/chunks/conversation-D5Nbu9eT.js +1 -0
  87. package/dist/chunks/conversation-hcUx9e-C.js +1 -0
  88. package/dist/chunks/{createSSHSession-CJtzNQdZ.js → createSSHSession-DecOR6M5.js} +6 -6
  89. package/dist/chunks/createSession-D27zvmOs.js +1 -0
  90. package/dist/chunks/createSession-DRqkLZWt.js +1 -0
  91. package/dist/chunks/crossProjectResume-Bw3U0Ty6.js +40 -0
  92. package/dist/chunks/{datadog-DjeJThpV.js → datadog-bm551AVV.js} +1 -1
  93. package/dist/chunks/debug-BecbSVoN.js +39 -0
  94. package/dist/chunks/{debugUtils-DX0KAXNK.js → debugUtils-CmJfIUxW.js} +1 -1
  95. package/dist/chunks/{detached-X_yjYR7x.js → detached-CIyF0M5O.js} +1 -1
  96. package/dist/chunks/detectRepository-C15umvKN.js +1 -0
  97. package/dist/chunks/detectRepository-DDfLfKcM.js +1 -0
  98. package/dist/chunks/{diff-jEJJe58I.js → diff-DeK4bwjw.js} +1 -1
  99. package/dist/chunks/{directoryCompletion-BbXR2bfy.js → directoryCompletion-BJCu19HJ.js} +1 -1
  100. package/dist/chunks/doctor-BJORBomU.js +1 -0
  101. package/dist/chunks/{entry-oIqjxIjQ.js → entry-mdegyj8z.js} +3 -3
  102. package/dist/chunks/{esm-Cf4nSRjF.js → esm-Ka3lhafK.js} +1 -1
  103. package/dist/chunks/{execFileNoThrow-Dwu6psHW.js → execFileNoThrow-DHyW8FMX.js} +2 -2
  104. package/dist/chunks/execSyncWrapper-CDzB0BM1.js +1 -0
  105. package/dist/chunks/exit-CF3KBl-S.js +1 -0
  106. package/dist/chunks/{extraUsage-Mi66JwFZ.js → extraUsage-BrKbpBK-.js} +1 -1
  107. package/dist/chunks/extractMemories-4lBn134y.js +1 -0
  108. package/dist/chunks/fast-0Vi354KI.js +1 -0
  109. package/dist/chunks/{fast-BU4iUZ8E.js → fast-DWn40OcQ.js} +1 -1
  110. package/dist/chunks/{fileSuggestions-BMfQIDdW.js → fileSuggestions-C7Pwq2yj.js} +3 -3
  111. package/dist/chunks/{firstPartyEventLogger-B3cXgR67.js → firstPartyEventLogger-BHjBQH0J.js} +2 -2
  112. package/dist/chunks/firstPartyEventLogger-BNBnLYPK.js +1 -0
  113. package/dist/chunks/{flushGate-DgSDVGKZ.js → flushGate-DdJjxCes.js} +1 -1
  114. package/dist/chunks/gemini-DHv2iVfy.js +1 -0
  115. package/dist/chunks/generateSessionName-DhS_6oHd.js +1 -0
  116. package/dist/chunks/{genericProcessUtils-CmsUPyRz.js → genericProcessUtils-B2HcDYhg.js} +1 -1
  117. package/dist/chunks/git-DBlOv64X.js +6 -0
  118. package/dist/chunks/git-DF4RFFaT.js +1 -0
  119. package/dist/chunks/githubRepoPathMapping-CK56bUDe.js +1 -0
  120. package/dist/chunks/{goal-ZmSRBx4q.js → goal-BZG4gtnb.js} +3 -3
  121. package/dist/chunks/{grok-BXMvezWb.js → grok-BS57ZhyW.js} +1 -1
  122. package/dist/chunks/{grove-CeOjTaY6.js → grove-_zlQ83yR.js} +2 -2
  123. package/dist/chunks/{help-5DNZO6_H.js → help-C_2tdXHC.js} +1 -1
  124. package/dist/chunks/{hooks-C637tFtd.js → hooks-C7Bn7MBe.js} +2 -2
  125. package/dist/chunks/hooks-DT80Arzc.js +1 -0
  126. package/dist/chunks/{initReplBridge-D1h10vQ9.js → initReplBridge-NkZRcM77.js} +1 -1
  127. package/dist/chunks/{install-C-6ItpH0.js → install-Du-DSVzj.js} +1 -1
  128. package/dist/chunks/{instrumentation-DaiPDUst.js → instrumentation-DMs3b82f.js} +5 -5
  129. package/dist/chunks/{job-BeYzQUiR.js → job-rbX1VZmp.js} +1 -1
  130. package/dist/chunks/jwtUtils-OzxN2zts.js +1 -0
  131. package/dist/chunks/keybindings-CwdC_8S0.js +2 -0
  132. package/dist/chunks/{launchLocalMemory-CE4J98xO.js → launchLocalMemory-BLRCK1_o.js} +2 -2
  133. package/dist/chunks/{launchOnboarding-BfTdC6vp.js → launchOnboarding-Al_X75Vz.js} +1 -1
  134. package/dist/chunks/{loadAgentsDir-C7lOqvfh.js → loadAgentsDir-BL93ulMm.js} +619 -619
  135. package/dist/chunks/loadAgentsDir-eVKq8efm.js +1 -0
  136. package/dist/chunks/loadPluginHooks-B0au35a4.js +1 -0
  137. package/dist/chunks/{localSearch-BKrznW5x.js → localSearch-C5ipegd9.js} +1 -1
  138. package/dist/chunks/localSearch-CZlFfR_X.js +1 -0
  139. package/dist/chunks/{log-CezCRpAN.js → log-Dauqle-Z.js} +1 -1
  140. package/dist/chunks/{logoV2Utils-BkQfyQ1-.js → logoV2Utils-CkvOihX7.js} +1 -1
  141. package/dist/chunks/{magicDocs-BpVcON9o.js → magicDocs-DLav5QK0.js} +3 -3
  142. package/dist/chunks/main-CVNWNAoh.js +513 -0
  143. package/dist/chunks/{main-CvOv59-7.js → main-LMyE3jXY.js} +2 -2
  144. package/dist/chunks/managedEnv-CYepSnm8.js +1 -0
  145. package/dist/chunks/{managedEnv-DhWRJ5DK.js → managedEnv-DJSCuqCb.js} +1 -1
  146. package/dist/chunks/{mappers-bOab8ipV.js → mappers-DQxMcezy.js} +1 -1
  147. package/dist/chunks/mcp-BAbbEaBA.js +1 -0
  148. package/dist/chunks/mcp-Ct4Sum6A.js +6 -0
  149. package/dist/chunks/{mcp-VcGPYCkW.js → mcp-D5HkCqUh.js} +2 -2
  150. package/dist/chunks/{memoize-DsqYrbeR.js → memoize-FeyE7JEh.js} +1 -1
  151. package/dist/chunks/memory-COa7aUbx.js +1 -0
  152. package/dist/chunks/{mode-DlKnUM8l.js → mode-Bl2RZC8M.js} +2 -2
  153. package/dist/chunks/model-B7rtZ7KV.js +1 -0
  154. package/dist/chunks/{model-BsZ4sP_H.js → model-Bgh_r4lg.js} +1 -1
  155. package/dist/chunks/model-DiuEAv6h.js +1 -0
  156. package/dist/chunks/{modelOptions-CxP067Qv.js → modelOptions-BtEZe5BB.js} +1 -1
  157. package/dist/chunks/nativeInstaller-BEwayifa.js +1 -0
  158. package/dist/chunks/omit--yH_T4rf.js +1 -0
  159. package/dist/chunks/onChangeAppState-ZdwI7boX.js +1 -0
  160. package/dist/chunks/{openai-B9C2XN5Q.js → openai-DWs4D-nQ.js} +3 -3
  161. package/dist/chunks/panel-CoNfXy3K.js +1 -0
  162. package/dist/chunks/{parser-BwPXQomy.js → parser-BH4u7QiV.js} +1 -1
  163. package/dist/chunks/parser-BMIaRErw.js +1 -0
  164. package/dist/chunks/{partition-D-UhsUCx.js → partition-DLcW5Oo_.js} +1 -1
  165. package/dist/chunks/permissions-CaucYK3s.js +3 -0
  166. package/dist/chunks/pidLock-DgOBc1Xo.js +3 -0
  167. package/dist/chunks/{plan-CyU2zrCK.js → plan-BNYDTnQd.js} +1 -1
  168. package/dist/chunks/{platform-BMPbglug.js → platform-B0uTQc9P.js} +1 -1
  169. package/dist/chunks/plugin-BN-of1_H.js +17 -0
  170. package/dist/chunks/pluginAutoupdate-BBU9Jn4p.js +1 -0
  171. package/dist/chunks/pluginBlocklist-DXQlbG0P.js +1 -0
  172. package/dist/chunks/pluginCliCommands-CfdVNs8D.js +1 -0
  173. package/dist/chunks/pluginFlagging-DcJ_FQuv.js +1 -0
  174. package/dist/chunks/pluginOperations-DnhzFbYI.js +2 -0
  175. package/dist/chunks/pluginStartupCheck-CKBFaMFr.js +1 -0
  176. package/dist/chunks/pluginStartupCheck-CpNB4jxG.js +1 -0
  177. package/dist/chunks/plugins-CBW7kPyp.js +4 -0
  178. package/dist/chunks/{poorMode-DEwQOAJt.js → poorMode-B_xEvuEV.js} +1 -1
  179. package/dist/chunks/poorMode-yH1o41cQ.js +1 -0
  180. package/dist/chunks/{print-eCRv_Li-.js → print-BZOx09SU.js} +16 -16
  181. package/dist/chunks/processBashCommand-dcCNCiBp.js +1 -0
  182. package/dist/chunks/processSlashCommand-YDiM63Qr.js +5 -0
  183. package/dist/chunks/prompt-CXGy0llt.js +1 -0
  184. package/dist/chunks/prompt-DovNDmcx.js +1 -0
  185. package/dist/chunks/{prompt-M2lu8_Oa.js → prompt-Dx7IWhBt.js} +2 -2
  186. package/dist/chunks/{promptEditor-DhcZY-iu.js → promptEditor-WCkmpejM.js} +2 -2
  187. package/dist/chunks/{protocolHandler-CkFaJKKo.js → protocolHandler-BiVWrpHi.js} +4 -4
  188. package/dist/chunks/{proxy-CuMaO_YV.js → proxy-CVn7o19p.js} +3 -3
  189. package/dist/chunks/reconciler-C2Nd_e4n.js +1 -0
  190. package/dist/chunks/refresh-B84H2Ezd.js +1 -0
  191. package/dist/chunks/{registerProtocol-CsNYRZKr.js → registerProtocol-E0Iu5hEx.js} +2 -2
  192. package/dist/chunks/{reload-plugins-B7JAE3b4.js → reload-plugins-D-3AUT9g.js} +1 -1
  193. package/dist/chunks/{remoteBridgeCore-CFLJhsB6.js → remoteBridgeCore-CV6we3ZA.js} +1 -1
  194. package/dist/chunks/remoteManagedSettings-D26Q09-7.js +1 -0
  195. package/dist/chunks/{rename-BCp2Vtqu.js → rename-CSavuBIE.js} +1 -1
  196. package/dist/chunks/{renderOptions-Q5oCLFIC.js → renderOptions-DDLbSMQU.js} +1 -1
  197. package/dist/chunks/resume-CROylN3J.js +2 -0
  198. package/dist/chunks/ripgrep-2M1GkXqJ.js +1 -0
  199. package/dist/chunks/{ripgrep-DvOOsDMv.js → ripgrep-C1ydIMzT.js} +5 -5
  200. package/dist/chunks/{runtimeObserver-CS_3BDNo.js → runtimeObserver-L7pSIWBT.js} +2 -2
  201. package/dist/chunks/{runtimeObserver-DYUva6g-.js → runtimeObserver-OU8KrZQG.js} +1 -1
  202. package/dist/chunks/sandbox-adapter-6UwMLh6e.js +1 -0
  203. package/dist/chunks/{sandbox-toggle--zNSKce_.js → sandbox-toggle-YrQNWGsr.js} +1 -1
  204. package/dist/chunks/searchExtraTools-Bdv5HJ74.js +1 -0
  205. package/dist/chunks/{session-CO3gEqQP.js → session-DUYsfPy_.js} +2 -2
  206. package/dist/chunks/sessionFileAccessHooks-Czen7Ejz.js +1 -0
  207. package/dist/chunks/sessionObserver-B0zucj_c.js +1 -0
  208. package/dist/chunks/{sessionObserver-YkRHC-Aa.js → sessionObserver-Dv3Ba8eA.js} +2 -2
  209. package/dist/chunks/{sessionState-Bifmu95-.js → sessionState-D-SaBzWD.js} +2 -2
  210. package/dist/chunks/sessionStorage-BM1x51Z7.js +1 -0
  211. package/dist/chunks/{sessionTitle-COBSgSXS.js → sessionTitle-uCuYaNif.js} +2 -2
  212. package/dist/chunks/{sessionTracing-BrNx1k2V.js → sessionTracing-Bqb3vJTt.js} +3 -3
  213. package/dist/chunks/settings-BG15IFYx.js +1 -0
  214. package/dist/chunks/settings-D4CpDv2y.js +20 -0
  215. package/dist/chunks/settingsSync-BSrpnyqo.js +1 -0
  216. package/dist/chunks/setup-C62oq4AZ.js +3 -0
  217. package/dist/chunks/{shadowedRuleDetection-DEaw-X5j.js → shadowedRuleDetection-BzAZ57p2.js} +1 -1
  218. package/dist/chunks/{shellQuote-BYeOv3Ip.js → shellQuote-DS6WrivY.js} +2 -2
  219. package/dist/chunks/{sideQuestion-D0OKljee.js → sideQuestion-CvMBBjI8.js} +2 -2
  220. package/dist/chunks/sinks-WJ7nzLQs.js +1 -0
  221. package/dist/chunks/sinks-f7qYjbKJ.js +2 -0
  222. package/dist/chunks/skillChangeDetector-U5kRU5nd.js +1 -0
  223. package/dist/chunks/{skillGapStore-N_kmvXML.js → skillGapStore-CqaT8c0C.js} +2 -2
  224. package/dist/chunks/{skillLifecycle-C4F5RXuh.js → skillLifecycle-CnR8IqJM.js} +2 -2
  225. package/dist/chunks/skillSearchPanel-D9qrOXpI.js +21 -0
  226. package/dist/chunks/{skills-C4CTRN9o.js → skills-BgcFh0vy.js} +1 -1
  227. package/dist/chunks/startupProfiler-B4HBBbHN.js +1 -0
  228. package/dist/chunks/{startupProfiler-L_UWZ03w.js → startupProfiler-CmH_aVy2.js} +2 -2
  229. package/dist/chunks/{stats-IzV0_vEc.js → stats-B8uQ-UDi.js} +1 -1
  230. package/dist/chunks/{status-CeVP_uDT.js → status-BekdWoIj.js} +1 -1
  231. package/dist/chunks/status-D6KlRJmR.js +2 -0
  232. package/dist/chunks/{statusNoticeHelpers-Bb9gxdSt.js → statusNoticeHelpers-BMM8_uJ1.js} +1 -1
  233. package/dist/chunks/{stringUtils-C84IJ91d.js → stringUtils-C8PaYpQF.js} +1 -1
  234. package/dist/chunks/switcher-Ck9CrXrr.js +1 -0
  235. package/dist/chunks/{switcher-CCs9xl1z.js → switcher-DnAhkyIn.js} +1 -1
  236. package/dist/chunks/syncCache-ClP9aBqK.js +1 -0
  237. package/dist/chunks/{tasks-DZDhgx0w.js → tasks-Dmh6qikm.js} +1 -1
  238. package/dist/chunks/teleport-DH3IuAUQ.js +1 -0
  239. package/dist/chunks/{templateJobs-CrNPEKkh.js → templateJobs-CxqU-s5i.js} +1 -1
  240. package/dist/chunks/{terminalSetup-CBqcwQll.js → terminalSetup-BKGcmlWp.js} +1 -1
  241. package/dist/chunks/{terminalSetup-D-N8YPiQ.js → terminalSetup-Cy19F1Js.js} +4 -4
  242. package/dist/chunks/{theme-Dazsirbw.js → theme-U7lMFHQ0.js} +1 -1
  243. package/dist/chunks/{tmux-DewYVEBm.js → tmux-D5EvHWi3.js} +1 -1
  244. package/dist/chunks/{toolEventObserver-lnHJ9fLQ.js → toolEventObserver-D9qjoVl5.js} +1 -1
  245. package/dist/chunks/toolPool-69mfSPAs.js +1 -0
  246. package/dist/chunks/trustedDevice-B6AKlsl_.js +1 -0
  247. package/dist/chunks/trustedDevice-DL0pWP4_.js +1 -0
  248. package/dist/chunks/{types-3j8PS-Du.js → types-DafcFtmb.js} +2 -2
  249. package/dist/chunks/udsClient-CWnfsgFP.js +1 -0
  250. package/dist/chunks/{updateCCB-BPe9_FW6.js → updateCCB-C6XftzIG.js} +6 -6
  251. package/dist/chunks/{upstreamproxy-DF00RzGG.js → upstreamproxy-CXmjxHpl.js} +2 -2
  252. package/dist/chunks/{useExitOnCtrlCDWithKeybindings-ChqBs9Lr.js → useExitOnCtrlCDWithKeybindings-DEEJhm_W.js} +1 -1
  253. package/dist/chunks/useMainLoopModel-6w7mhwhU.js +1 -0
  254. package/dist/chunks/useManagePlugins-CjnsO-Of.js +1 -0
  255. package/dist/chunks/{useMergedTools-Dk5cPqLc.js → useMergedTools-DbhqKk1-.js} +1 -1
  256. package/dist/chunks/{useSearchInput-C7Y1I9P9.js → useSearchInput-gUDbkLaC.js} +1 -1
  257. package/dist/chunks/{useSettingsErrors-DAEO7AyB.js → useSettingsErrors-CgPad-H0.js} +1 -1
  258. package/dist/chunks/{userAgent-CIq27vUR.js → userAgent-CU7Ndh79.js} +1 -1
  259. package/dist/chunks/util-B4oMhJKh.js +1 -0
  260. package/dist/chunks/validatePlugin-y_O_tCEL.js +1 -0
  261. package/dist/chunks/{vim-EYQn94Kx.js → vim-w37BfGZ5.js} +1 -1
  262. package/dist/chunks/{which-DzFN5TNM.js → which-BRWBO7Gu.js} +1 -1
  263. package/dist/chunks/windowsPaths-BY-IVNwQ.js +1 -0
  264. package/dist/chunks/windowsPaths-DtWHLjmE.js +1 -0
  265. package/dist/chunks/{workSecret-DUqdPy44.js → workSecret-BEhXgH2M.js} +1 -1
  266. package/dist/chunks/{workerRegistry-C07BcZIw.js → workerRegistry-Bq9bS5pw.js} +5 -5
  267. package/dist/chunks/worktree-4SUJ4dtz.js +1 -0
  268. package/dist/cli.js +1 -1
  269. package/package.json +2 -3
  270. package/dist/chunks/App-C2yQjBgY.js +0 -1
  271. package/dist/chunks/ApproveApiKey-CKbv5C1x.js +0 -1
  272. package/dist/chunks/ApproveApiKey-MscC-ssL.js +0 -1
  273. package/dist/chunks/BackgroundTasksDialog-CL5NWsFL.js +0 -2
  274. package/dist/chunks/ClaudeMdExternalIncludesDialog-C0-psohX.js +0 -1
  275. package/dist/chunks/ConsoleOAuthFlow-4mOvEer_.js +0 -1
  276. package/dist/chunks/Doctor-DmgAwce2.js +0 -1
  277. package/dist/chunks/Doctor-jEs9chPk.js +0 -3
  278. package/dist/chunks/ExitFlow-DVKxFdpX.js +0 -2
  279. package/dist/chunks/InvalidConfigDialog-o9DF1REI.js +0 -1
  280. package/dist/chunks/MCPConnectionManager-CUTuaa8T.js +0 -1
  281. package/dist/chunks/MCPToolListView-CvqB4nCw.js +0 -1
  282. package/dist/chunks/MessageSelector-BLzw172f.js +0 -3
  283. package/dist/chunks/Messages-4K5sLmNh.js +0 -11
  284. package/dist/chunks/QueryEngine-DPHLSsax.js +0 -1
  285. package/dist/chunks/REPL-Bf46iQCN.js +0 -1
  286. package/dist/chunks/REPL-DIaAo9M9.js +0 -133
  287. package/dist/chunks/ResumeConversation-Br2KsBoe.js +0 -1
  288. package/dist/chunks/SearchExtraToolsTool-i_YO3QvV.js +0 -1
  289. package/dist/chunks/Settings-BMXysXIx.js +0 -2
  290. package/dist/chunks/TeleportRepoMismatchDialog-B5I73j7Y.js +0 -1
  291. package/dist/chunks/add-dir-CZ6Clvq8.js +0 -1
  292. package/dist/chunks/agents-DHnNg4h6.js +0 -103
  293. package/dist/chunks/allErrors-CU89tF-z.js +0 -1
  294. package/dist/chunks/api-BSeE6MwB.js +0 -1
  295. package/dist/chunks/auth-BIGJth5U.js +0 -1
  296. package/dist/chunks/auth-CDQMhIZP.js +0 -1
  297. package/dist/chunks/autonomyPanel-DnHpuiy4.js +0 -1
  298. package/dist/chunks/backgroundHousekeeping-B-cw0UcS.js +0 -17
  299. package/dist/chunks/backgroundHousekeeping-BS_8z3_x.js +0 -1
  300. package/dist/chunks/bg-50rllUNh.js +0 -1
  301. package/dist/chunks/bridgeConfig-BeqChxJC.js +0 -1
  302. package/dist/chunks/btw-DSK9R2C8.js +0 -1
  303. package/dist/chunks/caches-BTQAW9zc.js +0 -1
  304. package/dist/chunks/caches-BVtSCnV1.js +0 -1
  305. package/dist/chunks/ccrClient-Bu7Tf1Z5.js +0 -1
  306. package/dist/chunks/client-BWQ4-rN7.js +0 -1
  307. package/dist/chunks/client-c-3-PW1F.js +0 -1
  308. package/dist/chunks/commands-Bi7k3Wg-.js +0 -1
  309. package/dist/chunks/compact-J-h0Yf4b.js +0 -2
  310. package/dist/chunks/config-yyFe87vW.js +0 -1
  311. package/dist/chunks/context-Tb1Ca2Q-.js +0 -1
  312. package/dist/chunks/context-noninteractive-soPYKAc9.js +0 -1
  313. package/dist/chunks/conversation-CSEtUxOY.js +0 -1
  314. package/dist/chunks/conversation-Dk1WDQuN.js +0 -1
  315. package/dist/chunks/createSession-DkT1GL8y.js +0 -1
  316. package/dist/chunks/createSession-eE8mswkv.js +0 -1
  317. package/dist/chunks/crossProjectResume-04n3Ppy9.js +0 -40
  318. package/dist/chunks/debug-RAynG_nM.js +0 -39
  319. package/dist/chunks/detectRepository-DgpNd87p.js +0 -1
  320. package/dist/chunks/detectRepository-ctF9KDbb.js +0 -1
  321. package/dist/chunks/doctor-B-Wag4C1.js +0 -1
  322. package/dist/chunks/execSyncWrapper-BTZJjCuv.js +0 -1
  323. package/dist/chunks/exit-BtW7LfRX.js +0 -1
  324. package/dist/chunks/extractMemories-CUrdiNcr.js +0 -1
  325. package/dist/chunks/fast-C60p6AqJ.js +0 -1
  326. package/dist/chunks/firstPartyEventLogger-BfCYN7lt.js +0 -1
  327. package/dist/chunks/gemini-BwvSxGgn.js +0 -1
  328. package/dist/chunks/generateSessionName-DlrdedOk.js +0 -1
  329. package/dist/chunks/git-2c7WlGDL.js +0 -6
  330. package/dist/chunks/git-XtKbtJMc.js +0 -1
  331. package/dist/chunks/githubRepoPathMapping-DbWG4hFQ.js +0 -1
  332. package/dist/chunks/hooks-DWg07LmS.js +0 -1
  333. package/dist/chunks/jwtUtils-CUPXdX3W.js +0 -1
  334. package/dist/chunks/keybindings-DgIPdBy9.js +0 -2
  335. package/dist/chunks/loadAgentsDir-zikjxLvn.js +0 -1
  336. package/dist/chunks/loadPluginHooks-Cp8MSwAc.js +0 -1
  337. package/dist/chunks/localSearch-ZFyFy5FN.js +0 -1
  338. package/dist/chunks/main-9r5gLzUW.js +0 -605
  339. package/dist/chunks/managedEnv-B61yLpwp.js +0 -1
  340. package/dist/chunks/mcp-BckPBjaM.js +0 -6
  341. package/dist/chunks/mcp-CS1DA3JL.js +0 -1
  342. package/dist/chunks/memory-C5ohwh-T.js +0 -1
  343. package/dist/chunks/model-BGu1AGq0.js +0 -1
  344. package/dist/chunks/model-D19IIcll.js +0 -1
  345. package/dist/chunks/nativeInstaller-QB8cEJ18.js +0 -1
  346. package/dist/chunks/omit-DDUIPHnl.js +0 -1
  347. package/dist/chunks/onChangeAppState-RBl6H7ho.js +0 -1
  348. package/dist/chunks/panel-KW-wmEvU.js +0 -1
  349. package/dist/chunks/parser-xSBaQRLH.js +0 -1
  350. package/dist/chunks/permissions-BoLXYN1j.js +0 -3
  351. package/dist/chunks/pidLock-nJHbufJN.js +0 -3
  352. package/dist/chunks/plugin-C6-GQke5.js +0 -17
  353. package/dist/chunks/pluginAutoupdate-SlRFJlTT.js +0 -1
  354. package/dist/chunks/pluginBlocklist-n6Imlh3y.js +0 -1
  355. package/dist/chunks/pluginCliCommands-Bd96zSOQ.js +0 -1
  356. package/dist/chunks/pluginFlagging-DZaYzecY.js +0 -1
  357. package/dist/chunks/pluginOperations-D90IRawu.js +0 -2
  358. package/dist/chunks/pluginStartupCheck-Bxkxpm4k.js +0 -1
  359. package/dist/chunks/pluginStartupCheck-CB2q2dLv.js +0 -1
  360. package/dist/chunks/plugins-B9eSjLSA.js +0 -4
  361. package/dist/chunks/poorMode-BAnubpn1.js +0 -1
  362. package/dist/chunks/processBashCommand-B5F2Cl7K.js +0 -1
  363. package/dist/chunks/processSlashCommand-BC_D3cH5.js +0 -5
  364. package/dist/chunks/prompt-C1JPqinc.js +0 -1
  365. package/dist/chunks/prompt-DZhBz_Vu.js +0 -1
  366. package/dist/chunks/reconciler-B4GDm_iC.js +0 -1
  367. package/dist/chunks/refresh-DBVizOzg.js +0 -1
  368. package/dist/chunks/remoteManagedSettings-xh_MViZH.js +0 -1
  369. package/dist/chunks/resume-DVCSzKvv.js +0 -2
  370. package/dist/chunks/ripgrep-e-iewvTf.js +0 -1
  371. package/dist/chunks/sandbox-adapter-BFZFHplu.js +0 -1
  372. package/dist/chunks/searchExtraTools-ui5y2VSE.js +0 -1
  373. package/dist/chunks/sessionFileAccessHooks-CZvCqQJ6.js +0 -1
  374. package/dist/chunks/sessionObserver-Ba7um95p.js +0 -1
  375. package/dist/chunks/sessionStorage-CedwLLQs.js +0 -1
  376. package/dist/chunks/settings-DkDH7WQT.js +0 -1
  377. package/dist/chunks/settings-DnptdP79.js +0 -20
  378. package/dist/chunks/settingsSync-PmU7SmkU.js +0 -1
  379. package/dist/chunks/setup-BEsBuzsk.js +0 -3
  380. package/dist/chunks/sinks-BJHgxz6Y.js +0 -1
  381. package/dist/chunks/sinks-D5-yhcgU.js +0 -2
  382. package/dist/chunks/skillChangeDetector-Dd0WPdkO.js +0 -1
  383. package/dist/chunks/skillSearchPanel-CftorvAM.js +0 -21
  384. package/dist/chunks/startupProfiler-D4FBdEQr.js +0 -1
  385. package/dist/chunks/status-Dzuw3hBv.js +0 -2
  386. package/dist/chunks/switcher-4KzBvuKH.js +0 -1
  387. package/dist/chunks/syncCache-CBRiRU5x.js +0 -1
  388. package/dist/chunks/teleport-Bw0jSxe9.js +0 -1
  389. package/dist/chunks/toolPool-CkXFlqsn.js +0 -1
  390. package/dist/chunks/trustedDevice-CFf5yaG-.js +0 -1
  391. package/dist/chunks/trustedDevice-CuwSv8dG.js +0 -1
  392. package/dist/chunks/udsClient-e9dIkwVA.js +0 -1
  393. package/dist/chunks/useMainLoopModel-2-eujv0n.js +0 -1
  394. package/dist/chunks/useManagePlugins-CYBIkaB1.js +0 -1
  395. package/dist/chunks/util-VO98TdOz.js +0 -1
  396. package/dist/chunks/validatePlugin-Kk6pxnO2.js +0 -1
  397. package/dist/chunks/windowsPaths-BU3yQWTB.js +0 -1
  398. package/dist/chunks/windowsPaths-DgZ3YY4a.js +0 -1
  399. package/dist/chunks/worktree-dFUkhVE_.js +0 -1
@@ -1 +0,0 @@
1
- import{a as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{$C as n,$y as r,Cg as i,Cr as a,Eg as o,Iu as s,Ou as c,Pr as ee,Qn as te,Qy as l,Ru as u,Tc as d,Tr as ne,Vn as re,ai as ie,bc as f,ii as ae,ku as oe,l_ as se,qC as p,qr as m,u_ as h,vl as ce,wg as g,yl as _,zr as v}from"./loadAgentsDir-C7lOqvfh.js";import{I as y,P as b,Wt as x,dr as le,fi as S,ot as C,t as w}from"./src-P_wYS_NJ2.js";import{t as T}from"./jsx-runtime-Bb4Xn-E0.js";import{Wt as E,or as ue}from"./state-BemZdQIl.js";import{o as D,s as O}from"./log-CezCRpAN.js";import{n as k,r as A}from"./analytics-DJobLaWP.js";import{a as de,n as fe,s as j}from"./skillChangeDetector-Dd0WPdkO.js";import{t as M}from"./REPL-DIaAo9M9.js";import{a as N,i as P,n as F,o as I,r as L,t as R}from"./crossProjectResume-04n3Ppy9.js";import{dirname as z}from"path";var B=t(S(),1);n(),E(),I(),u(),l(),w(),p(),k(),i(),h(),P(),f(),c(),F(),D(),a();var V=T();function pe(e){let t=parseInt(e,10);if(!isNaN(t)&&t>0)return t;let n=e.match(/github\.com\/[^/]+\/[^/]+\/pull\/(\d+)/);return n?.[1]?parseInt(n[1],10):null}function H({commands:t,worktreePaths:n,initialTools:i,mcpClients:a,dynamicMcpConfig:c,debug:l,mainThreadAgentDefinition:u,autoConnectIdeFlag:f,strictMcpConfig:p=!1,systemPrompt:h,appendSystemPrompt:x,initialSearchQuery:S,disableSlashCommands:w=!1,forkSession:T,taskListId:E,filterByPr:D,thinkingConfig:k,onTurnComplete:P}){let{rows:F}=C(),I=g(e=>e.agentDefinitions),H=o(),[U,W]=B.useState([]),[ge,G]=B.useState(!0),[_e,ve]=B.useState(!1),[K,ye]=B.useState(!1),[q,be]=B.useState(null),[J,xe]=B.useState(null),Y=B.useRef(null),X=B.useRef(0),Z=B.useMemo(()=>{let e=U.filter(e=>!e.isSidechain);if(D!==void 0){if(D===!0)e=e.filter(e=>e.prNumber!==void 0);else if(typeof D==`number`)e=e.filter(e=>e.prNumber===D);else if(typeof D==`string`){let t=pe(D);t!==null&&(e=e.filter(e=>e.prNumber===t))}}return e},[U,D]),Se=ne();B.useEffect(()=>{v(n).then(e=>{Y.current=e,X.current=e.logs.length,W(e.logs),G(!1)}).catch(e=>{O(e),G(!1)})},[n]);let Q=B.useCallback(e=>{let t=Y.current;!t||t.nextIndex>=t.allStatLogs.length||te(t.allStatLogs,t.nextIndex,e).then(n=>{if(t.nextIndex=n.nextIndex,n.logs.length>0){let e=X.current;n.logs.forEach((t,n)=>{t.value=e+n}),W(e=>e.concat(n.logs)),X.current+=n.logs.length}else t.nextIndex<t.allStatLogs.length&&Q(e)})},[]),$=B.useCallback(e=>{G(!0),(e?ee():v(n)).then(e=>{Y.current=e,X.current=e.logs.length,W(e.logs)}).catch(e=>{O(e)}).finally(()=>{G(!1)})},[n]),Ce=B.useCallback(()=>{let e=!K;ye(e),$(e)},[K,$]);function we(){process.exit(1)}async function Te(t){ve(!0);let n=performance.now(),i=R(t,K);if(i.isCrossProject&&!i.isSameRepoWorktree){let e=i.command,t=await le(e);t&&process.stdout.write(t),xe(e);return}try{let i=await oe(t,void 0);if(!i)throw Error(`Failed to load conversation`);i.sessionId&&!T?(ue(se(i.sessionId),t.fullPath?z(t.fullPath):null),await ae(),r(i.sessionId)):T&&i.contentReplacements?.length&&await m(i.contentReplacements);let{agentDefinition:a}=de(i.agentSetting,u,I);H(e=>({...e,agent:a?.agentType}));let o=fe(i.agentName,i.agentColor);if(o&&H(e=>({...e,standaloneAgentContext:o})),d(i.agentName),ie(T?{...i,worktreeSession:void 0}:i),T||(j(i.worktreeSession),i.sessionId&&re()),i.goal&&i.sessionId){let{hydrateGoalFromTranscript:t}=(_(),e(ce)),n=new Map;n.set(i.sessionId,i.goal),t(n,i.sessionId)}A(`tengu_session_resumed`,{entrypoint:`picker`,success:!0,resume_duration_ms:Math.round(performance.now()-n)}),W([]),be({messages:i.messages,fileHistorySnapshots:i.fileHistorySnapshots,contentReplacements:i.contentReplacements,agentName:i.agentName,agentColor:i.agentColor==="default"?void 0:i.agentColor,mainThreadAgentDefinition:a})}catch(e){throw A(`tengu_session_resumed`,{entrypoint:`picker`,success:!1}),O(e),e}}return J?(0,V.jsx)(he,{command:J}):q?(0,V.jsx)(M,{debug:l,commands:t,initialTools:i,initialMessages:q.messages,initialFileHistorySnapshots:q.fileHistorySnapshots,initialContentReplacements:q.contentReplacements,initialAgentName:q.agentName,initialAgentColor:q.agentColor,mcpClients:a,dynamicMcpConfig:c,strictMcpConfig:p,systemPrompt:h,appendSystemPrompt:x,mainThreadAgentDefinition:q.mainThreadAgentDefinition,autoConnectIdeFlag:f,disableSlashCommands:w,taskListId:E,thinkingConfig:k,onTurnComplete:P}):ge?(0,V.jsxs)(y,{children:[(0,V.jsx)(s,{}),(0,V.jsx)(b,{children:` Loading conversations…`})]}):_e?(0,V.jsxs)(y,{children:[(0,V.jsx)(s,{}),(0,V.jsx)(b,{children:` Resuming conversation…`})]}):Z.length===0?(0,V.jsx)(me,{}):(0,V.jsx)(N,{logs:Z,maxHeight:F,onCancel:we,onSelect:Te,onLogsChanged:Se?()=>$(K):void 0,onLoadMore:Q,initialSearchQuery:S,showAllProjects:K,onToggleAllProjects:Ce,onAgenticSearch:L})}function me(){return x(`app:interrupt`,()=>{process.exit(1)},{context:`Global`}),(0,V.jsxs)(y,{flexDirection:`column`,children:[(0,V.jsx)(b,{children:`No conversations found to resume.`}),(0,V.jsx)(b,{dimColor:!0,children:`Press Ctrl+C to exit and start a new conversation.`})]})}function he({command:e}){return B.useEffect(()=>{let e=setTimeout(()=>{process.exit(0)},100);return()=>clearTimeout(e)},[]),(0,V.jsxs)(y,{flexDirection:`column`,gap:1,children:[(0,V.jsx)(b,{children:`This conversation is from a different directory.`}),(0,V.jsxs)(y,{flexDirection:`column`,children:[(0,V.jsx)(b,{children:`To resume, run:`}),(0,V.jsxs)(b,{children:[` `,e]})]}),(0,V.jsx)(b,{dimColor:!0,children:`(Command copied to clipboard)`})]})}export{H as ResumeConversation};
@@ -1 +0,0 @@
1
- import{$_ as e,Q_ as t}from"./loadAgentsDir-C7lOqvfh.js";e();export{t as clearSearchExtraToolsDescriptionCache};
@@ -1,2 +0,0 @@
1
- import{a as e,n as t,o as n}from"./rolldown-runtime-DaDcL9Zw.js";import{d as r,l as i,o as a}from"./envUtils-BDhHQY0-.js";import{n as o,t as s}from"./figures-5ThXQEtq.js";import{$C as c,Bb as ee,C as l,Cb as te,Cg as ne,Cr as re,Eg as ie,Gb as ae,Ip as u,Lp as d,P as oe,S as se,Sb as ce,Tg as le,Vb as ue,_g as de,ao as f,bb as fe,fd as p,gg as m,nd as pe,oo as h,or as g,pd as me,qC as _,rd as he,so as ge,td as v,v as _e,wb as ve,wg as y}from"./loadAgentsDir-C7lOqvfh.js";import{D as b,Gt as ye,H as be,I as x,P as S,T as C,U as xe,Wt as Se,Xn as Ce,a as we,di as Te,fi as w,k as Ee,n as De,ot as Oe,r as T,t as E,ui as D,x as O,y as ke}from"./src-P_wYS_NJ2.js";import{t as k}from"./jsx-runtime-Bb4Xn-E0.js";import{Wt as Ae,pt as je}from"./state-BemZdQIl.js";import{n as Me,t as A}from"./cwd-Cfdf7z7s.js";import{Ft as Ne,Nt as Pe,Pt as Fe,Rt as Ie,c as Le,g as j,jt as Re,n as ze,x as M,zt as Be}from"./settings-DnptdP79.js";import{a as Ve,c as N,h as He,i as Ue,o as We,y as P}from"./config-Do1870_d.js";import{o as Ge,s as Ke}from"./log-CezCRpAN.js";import{n as qe,r as F}from"./analytics-DJobLaWP.js";import{G as Je,K as Ye,Sr as Xe,_ as Ze,b as Qe,et as I,it as $e,q as et,rt as tt,tt as nt,x as rt,xr as it}from"./model-BsZ4sP_H.js";import{r as at,t as ot}from"./poorMode-DEwQOAJt.js";import{a as L,c as st,d as ct,i as lt,l as ut,n as dt,o as ft,r as R,s as pt,t as mt,u as z}from"./status-Dzuw3hBv.js";import{n as B,t as V}from"./useExitOnCtrlCDWithKeybindings-ChqBs9Lr.js";import{i as H,n as ht,r as gt}from"./modalContext-CUThy6Ph.js";import{n as _t,t as vt}from"./ThemePicker-DrC8tlp0.js";import{i as yt,n as bt,r as xt,t as St}from"./extraUsage-Mi66JwFZ.js";import{n as Ct,t as wt}from"./ClaudeMdExternalIncludesDialog-BqNxQOXJ.js";import{t as Tt}from"./SearchBox-C9vUA4IM.js";import{n as Et,t as U}from"./useSearchInput-C7Y1I9P9.js";function Dt(){let e=je();return[{label:`Version`,value:`0.0.10`},{label:`Session name`,value:g(e)??(0,K.jsx)(S,{dimColor:!0,children:`/rename to add a name`})},{label:`Session ID`,value:e},{label:`cwd`,value:A()},...dt(),...mt()]}function Ot({mainLoopModel:e,mcp:t,theme:n,context:r}){return[{label:`Model`,value:z(e)},...R(t.clients,r.options.ideInstallationStatus,n),...ft(t.clients,n),...st(),...ut()]}async function kt(){return[...await lt(),...await L(),...await pt()]}function W({value:e}){return Array.isArray(e)?(0,K.jsx)(x,{flexWrap:`wrap`,columnGap:1,flexShrink:99,children:e.map((t,n)=>(0,K.jsxs)(S,{children:[t,n<e.length-1?`,`:``]},n))}):typeof e==`string`?(0,K.jsx)(S,{children:e}):e}function At({context:e,diagnosticsPromise:t}){let n=y(e=>e.mainLoopModel),r=y(e=>e.mcp),[i]=be(),a=Mt.useMemo(()=>[Dt(),Ot({mainLoopModel:n,mcp:r,theme:i,context:e})],[n,r,i,e]),o=gt()?1:void 0;return(0,K.jsxs)(x,{flexDirection:`column`,flexGrow:o,children:[(0,K.jsxs)(x,{flexDirection:`column`,gap:1,flexGrow:o,children:[a.map((e,t)=>e.length>0&&(0,K.jsx)(x,{flexDirection:`column`,children:e.map(({label:e,value:t},n)=>(0,K.jsxs)(x,{flexDirection:`row`,gap:1,flexShrink:0,children:[e!==void 0&&(0,K.jsxs)(S,{bold:!0,children:[e,`:`]}),(0,K.jsx)(W,{value:t})]},n))},t)),(0,K.jsx)(G.Suspense,{fallback:null,children:(0,K.jsx)(jt,{promise:t})})]}),(0,K.jsx)(S,{dimColor:!0,children:(0,K.jsx)(u,{action:`confirm:no`,context:`Settings`,fallback:`Esc`,description:`cancel`})})]})}function jt({promise:e}){let t=(0,G.use)(e);return t.length===0?null:(0,K.jsxs)(x,{flexDirection:`column`,paddingBottom:1,children:[(0,K.jsx)(S,{bold:!0,children:`System Diagnostics`}),t.map((e,t)=>(0,K.jsxs)(x,{flexDirection:`row`,gap:1,paddingX:1,children:[(0,K.jsx)(S,{color:`error`,children:s.warning}),typeof e==`string`?(0,K.jsx)(S,{wrap:`wrap`,children:e}):e]},t))]})}var Mt,G,K,Nt=t((()=>{o(),Mt=n(w(),1),G=n(w(),1),Ae(),ht(),E(),ne(),Me(),re(),ct(),d(),K=k()}));function Pt({currentVersion:e,onChoice:t}){function n(e){t(e)}function r(){t(`cancel`)}return(0,Ft.jsxs)(ke,{title:`Switch to Stable Channel`,onCancel:r,color:`permission`,hideBorder:!0,hideInputGuide:!0,children:[(0,Ft.jsxs)(S,{children:[`The stable channel may have an older version than what you're currently running (`,e,`).`]}),(0,Ft.jsx)(S,{dimColor:!0,children:`How would you like to handle this?`}),(0,Ft.jsx)(pe,{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 Ft,It=t((()=>{w(),E(),v(),Ft=k()}));function Lt(e){return Object.entries(e).map(([e,t])=>({label:t?.name??Bt,value:e,description:t?.description??Vt}))}function Rt({initialStyle:e,onComplete:t,onCancel:n,isStandaloneCommand:r}){let[i,a]=(0,zt.useState)([]),[o,s]=(0,zt.useState)(!0);(0,zt.useEffect)(()=>{h(A()).then(e=>{let t=Lt(e);a(t),s(!1)}).catch(()=>{let e=Lt(f);a(e),s(!1)})},[]);let c=(0,zt.useCallback)(e=>{t(e)},[t]);return(0,q.jsx)(ke,{title:`Preferred output style`,onCancel:n,hideInputGuide:!r,hideBorder:!r,children:(0,q.jsxs)(x,{flexDirection:`column`,gap:1,children:[(0,q.jsx)(x,{marginTop:1,children:(0,q.jsx)(S,{dimColor:!0,children:`This changes how Claude Code communicates with you`})}),o?(0,q.jsx)(S,{dimColor:!0,children:`Loading output styles…`}):(0,q.jsx)(pe,{options:i,onChange:c,visibleOptionCount:10,defaultValue:e})]})})}var zt,q,Bt,Vt,Ht=t((()=>{w(),zt=n(w(),1),ge(),E(),Me(),he(),q=k(),Bt=`Default`,Vt=`Claude completes coding tasks efficiently and provides concise responses`}));function Ut({initialLanguage:e,onComplete:t,onCancel:n}){let[r,i]=(0,Wt.useState)(e),[a,o]=(0,Wt.useState)((e??``).length);Se(`confirm:no`,n,{context:`Settings`});function c(){let e=r?.trim();t(e||void 0)}return(0,J.jsxs)(x,{flexDirection:`column`,gap:1,children:[(0,J.jsx)(S,{children:`Enter your preferred response and voice language:`}),(0,J.jsxs)(x,{flexDirection:`row`,gap:1,children:[(0,J.jsx)(S,{children:s.pointer}),(0,J.jsx)(p,{value:r??``,onChange:i,onSubmit:c,focus:!0,showCursor:!0,placeholder:`e.g., Japanese, 日本語, Español${s.ellipsis}`,columns:60,cursorOffset:a,onChangeCursorOffset:o})]}),(0,J.jsx)(S,{dimColor:!0,children:`Leave empty for default (English)`})]})}var Wt,J,Gt=t((()=>{o(),Wt=n(w(),1),E(),_(),me(),J=k()}));function Kt({onClose:t,context:n,setTabsHidden:a,onIsSearchModeChange:o,contentHeight:c}){let{headerFocused:l,focusHeader:ne}=we(),re=gt(),[,d]=be(),ue=xe(),[f,p]=(0,X.useState)(N()),m=Y.useRef(N()),[h,g]=(0,X.useState)(ze()),me=Y.useRef(ze()),[_,he]=(0,X.useState)(h?.outputStyle||`default`),ge=Y.useRef(_),[v,ve]=(0,X.useState)(h?.language),Te=Y.useRef(v),[w,De]=(0,X.useState)(0),[T,E]=(0,X.useState)(0),[O,k]=(0,X.useState)(!1),Ae=Ce(),{rows:je}=Oe(),Me=c??Math.min(Math.floor(je*.8),30),A=Math.max(5,Me-10),j=y(e=>e.mainLoopModel),Re=y(e=>e.verbose),He=y(e=>e.thinkingEnabled),Ge=y(e=>tt()?e.fastMode:!1);y(e=>e.promptSuggestionEnabled);let qe=Fe(h?.permissions?.defaultMode??`default`),Ze=se()||_e()===`enabled`,I=ie(),[it,L]=(0,X.useState)({}),st=Y.useRef(He),[ct]=(0,X.useState)(()=>Le(`localSettings`)),[lt]=(0,X.useState)(()=>Le(`userSettings`)),ut=Y.useRef(ue),dt=le(),[ft]=(0,X.useState)(()=>{let e=dt.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),[pt,mt]=(0,X.useState)(!1),[z,B]=(0,X.useState)(null),{query:V,setQuery:H,cursorOffset:ht}=Et({isActive:O&&z===null&&!l,onExit:()=>k(!1),onExitUp:ne,passthroughCtrlKeys:[`c`,`d`]}),_t=O&&!l;Y.useEffect(()=>{o?.(_t)},[_t,o]);let yt=ee(n.options.mcpClients),St=!i(process.env.CLAUDE_CODE_DISABLE_FILE_CHECKPOINTING),Ct=Y.use(ce(!0)),Tt=te(Ct),U=Ve();function Dt(e){F(`tengu_config_model_changed`,{from_model:j,to_model:e}),I(t=>({...t,mainLoopModel:e,mainLoopModelForSession:null})),L(t=>{let n=rt(e)+(bt(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 Ot(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 kt=[{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:He??!0,type:`boolean`,onChange(e){I(t=>({...t,thinkingEnabled:e})),M(`userSettings`,{alwaysThinkingEnabled:e?void 0:!1}),F(`tengu_thinking_toggled`,{enabled:e})}},...tt()&&nt()?[{id:`fastMode`,label:`Fast mode (${Je} only)`,value:!!Ge,type:`boolean`,onChange(e){Ye(),M(`userSettings`,{fastMode:e?!0:void 0}),e?(I(e=>({...e,mainLoopModel:et(),mainLoopModelForSession:null,fastMode:!0})),L(e=>({...e,model:et(),"Fast mode":`ON`}))):(I(e=>({...e,fastMode:!1})),L(e=>({...e,"Fast mode":`OFF`})))}}]:[],{id:`poorMode`,label:`Poor mode (save tokens)`,value:(ot(),e(at)).isPoorModeActive(),type:`boolean`,onChange(t){(ot(),e(at)).setPoorMode(t),I(e=>({...e,promptSuggestionEnabled:!t}))}},...St?[{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:Re,type:`boolean`,onChange:Ot},{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:qe,options:(()=>{let e=[`default`,`plan`];return[...e,...Be.filter(t=>!e.includes(t))]})(),type:`enum`,onChange(e){let t=Fe(e),n=t===`auto`?t:Pe(t)?Ie(t):t,r=M(`userSettings`,{permissions:{...h?.permissions,defaultMode:n}});if(r.error){Ke(r.error);return}g(e=>({...e,permissions:{...e?.permissions,defaultMode:n}})),L(t=>({...t,defaultPermissionMode:e})),F(`tengu_config_changed`,{setting:`defaultPermissionMode`,value:e})}},...Ze?[{id:`useAutoModeDuringPlan`,label:`Use auto mode during plan`,value:h?.useAutoModeDuringPlan??!0,type:`boolean`,onChange(e){M(`userSettings`,{useAutoModeDuringPlan:e}),g(t=>({...t,useAutoModeDuringPlan:e})),I(e=>{let t=oe(e.toolPermissionContext);return t===e.toolPermissionContext?e:{...e,toolPermissionContext:t}}),L(t=>({...t,"Use auto mode during plan":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})}},...de()?[{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)})}}]:[],U?{id:`autoUpdatesChannel`,label:`Auto-update channel`,value:`disabled`,type:`managedEnum`,onChange(){}}:{id:`autoUpdatesChannel`,label:`Auto-update channel`,value:h?.autoUpdatesChannel??`latest`,type:`managedEnum`,onChange(){}},{id:`theme`,label:`Theme`,value:ue,type:`managedEnum`,onChange:d},{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:Dt},...yt?[{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`})}}]:[],...ae()?[]:[{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`})}}],...ae()?[{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`})}}]:[],...Tt?[{id:`showExternalIncludesDialog`,label:`External CLAUDE.md includes`,value:We().hasClaudeMdExternalIncludesApproved?`true`:`false`,type:`managedEnum`,onChange(){}}]:[],...process.env.ANTHROPIC_API_KEY&&!r()?[{id:`apiKey`,label:(0,Z.jsxs)(S,{children:[`Use custom API key: `,(0,Z.jsx)(S,{bold:!0,children:Xe(process.env.ANTHROPIC_API_KEY)})]}),searchText:`Use custom API key`,value:!!(process.env.ANTHROPIC_API_KEY&&f.customApiKeyResponses?.approved?.includes(Xe(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=Xe(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())}}]:[]],W=Y.useMemo(()=>{if(!V)return kt;let e=V.toLowerCase();return kt.filter(t=>t.id.toLowerCase().includes(e)?!0:(`searchText`in t?t.searchText:t.label).toLowerCase().includes(e))},[kt,V]);Y.useEffect(()=>{if(w>=W.length){let e=Math.max(0,W.length-1);De(e),E(Math.max(0,e-A+1));return}E(e=>w<e?w:w>=e+A?w-A+1:e)},[W.length,w,A]);let At=(0,X.useCallback)(e=>{E(t=>e<t?e:e>=t+A?e-A+1:t)},[A]),jt=(0,X.useCallback)(()=>{if(z!==null)return;let e=Object.entries(it).map(([e,t])=>(F(`tengu_config_changed`,{key:e,value:t}),`Set ${e} to ${D.bold(t)}`)),n=r()?void 0:process.env.ANTHROPIC_API_KEY,i=!!(n&&m.current.customApiKeyResponses?.approved?.includes(Xe(n))),a=!!(n&&f.customApiKeyResponses?.approved?.includes(Xe(n)));if(i!==a&&(e.push(`${a?`Enabled`:`Disabled`} custom API key`),F(`tengu_config_changed`,{key:`env.ANTHROPIC_API_KEY`,value:a})),f.theme!==m.current.theme&&e.push(`Set theme to ${D.bold(f.theme)}`),f.preferredNotifChannel!==m.current.preferredNotifChannel&&e.push(`Set notifications to ${D.bold(f.preferredNotifChannel)}`),_!==ge.current&&e.push(`Set output style to ${D.bold(_)}`),v!==Te.current&&e.push(`Set response language to ${D.bold(v??`Default (English)`)}`),f.editorMode!==m.current.editorMode&&e.push(`Set editor mode to ${D.bold(f.editorMode||`emacs`)}`),f.diffTool!==m.current.diffTool&&e.push(`Set diff tool to ${D.bold(f.diffTool)}`),f.autoConnectIde!==m.current.autoConnectIde&&e.push(`${f.autoConnectIde?`Enabled`:`Disabled`} auto-connect to IDE`),f.autoInstallIdeExtension!==m.current.autoInstallIdeExtension&&e.push(`${f.autoInstallIdeExtension?`Enabled`:`Disabled`} auto-install IDE extension`),f.autoCompactEnabled!==m.current.autoCompactEnabled&&e.push(`${f.autoCompactEnabled?`Enabled`:`Disabled`} auto-compact`),f.respectGitignore!==m.current.respectGitignore&&e.push(`${f.respectGitignore?`Enabled`:`Disabled`} respect .gitignore in file picker`),f.copyOnSelect!==m.current.copyOnSelect&&e.push(`${f.copyOnSelect?`Enabled`:`Disabled`} copy on select`),f.terminalProgressBarEnabled!==m.current.terminalProgressBarEnabled&&e.push(`${f.terminalProgressBarEnabled?`Enabled`:`Disabled`} terminal progress bar`),f.showStatusInTerminalTab!==m.current.showStatusInTerminalTab&&e.push(`${f.showStatusInTerminalTab?`Enabled`:`Disabled`} terminal tab status`),f.showTurnDuration!==m.current.showTurnDuration&&e.push(`${f.showTurnDuration?`Enabled`:`Disabled`} turn duration`),f.remoteControlAtStartup!==m.current.remoteControlAtStartup){let t=f.remoteControlAtStartup===void 0?`Reset Remote Control to default`:`${f.remoteControlAtStartup?`Enabled`:`Disabled`} Remote Control for all sessions`;e.push(t)}h?.autoUpdatesChannel!==me.current?.autoUpdatesChannel&&e.push(`Set auto-update channel to ${D.bold(h?.autoUpdatesChannel??`latest`)}`),e.length>0?t(e.join(`
2
- `)):t(`Config dialog dismissed`,{display:`system`})},[z,it,f,j,_,v,h?.autoUpdatesChannel,tt()?h?.fastMode:void 0,t]),Mt=(0,X.useCallback)(()=>{ue!==ut.current&&d(ut.current),P(()=>m.current);let e=ct;M(`localSettings`,{spinnerTipsEnabled:e?.spinnerTipsEnabled,prefersReducedMotion:e?.prefersReducedMotion,defaultView:e?.defaultView,outputStyle:e?.outputStyle});let t=lt;M(`userSettings`,{alwaysThinkingEnabled:t?.alwaysThinkingEnabled,fastMode:t?.fastMode,promptSuggestionEnabled:t?.promptSuggestionEnabled,autoUpdatesChannel:t?.autoUpdatesChannel,minimumVersion:t?.minimumVersion,language:t?.language,useAutoModeDuringPlan:t?.useAutoModeDuringPlan,syntaxHighlightingDisabled:t?.syntaxHighlightingDisabled,permissions:t?.permissions===void 0?void 0:{...t.permissions,defaultMode:t.permissions.defaultMode}});let n=ft;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:oe(e.toolPermissionContext)}))},[ue,d,ct,lt,ft,I]);Se(`confirm:no`,(0,X.useCallback)(()=>{z===null&&(R.current&&Mt(),t(`Config dialog dismissed`,{display:`system`}))},[z,Mt,t]),{context:`Settings`,isActive:z===null&&!O&&!l}),Se(`settings:close`,jt,{context:`Settings`,isActive:z===null&&!O&&!l});let G=(0,X.useCallback)(()=>{let e=W[w];if(!(!e||!e.onChange)){if(e.type===`boolean`){R.current=!0,e.onChange(!e.value),e.id===`thinkingEnabled`&&(!e.value===st.current?mt(!1):n.messages.some(e=>e.type===`assistant`)&&mt(!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`),a(!0);return;case`model`:B(`Model`),a(!0);return;case`showExternalIncludesDialog`:B(`ExternalIncludes`),a(!0);return;case`outputStyle`:B(`OutputStyle`),a(!0);return;case`language`:B(`Language`),a(!0);return}if(e.id===`autoUpdatesChannel`){if(U){B(`EnableAutoUpdates`),a(!0);return}(h?.autoUpdatesChannel??`latest`)===`latest`?(B(`ChannelDowngrade`),a(!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}}},[U,W,w,h?.autoUpdatesChannel,a]),K=e=>{mt(!1);let t=Math.max(0,Math.min(W.length-1,w+e));De(t),At(t)};return ye({"select:previous":()=>{w===0?(mt(!1),k(!0),E(0)):K(-1)},"select:next":()=>K(1),"scroll:lineUp":()=>K(-1),"scroll:lineDown":()=>K(1),"select:accept":G,"select:previousValue":()=>G(),"select:nextValue":()=>G(),"settings:search":()=>{k(!0),H(``)}},{context:`Settings`,isActive:z===null&&!O&&!l}),(0,Z.jsx)(x,{flexDirection:`column`,width:`100%`,tabIndex:0,autoFocus:!0,onKeyDown:(0,X.useCallback)(e=>{if(z===null&&!l){if(O){if(e.key===`escape`){e.preventDefault(),V.length>0?H(``):k(!1);return}(e.key===`return`||e.key===`down`||e.key===`wheeldown`)&&(e.preventDefault(),k(!1),De(0),E(0));return}if(e.key===`left`||e.key===`right`||e.key===`tab`){e.preventDefault(),G();return}e.ctrl||e.meta||e.key===`j`||e.key===`k`||e.key===`/`||e.key.length===1&&e.key!==` `&&(e.preventDefault(),k(!0),H(e.key))}},[z,l,O,V,H,G]),children:z===`Theme`?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(vt,{onThemeSelect:e=>{R.current=!0,d(e),B(null),a(!1)},onCancel:()=>{B(null),a(!1)},hideEscToCancel:!0,skipExitHandling:!0}),(0,Z.jsx)(x,{children:(0,Z.jsx)(S,{dimColor:!0,italic:!0,children:(0,Z.jsxs)(C,{children:[(0,Z.jsx)(b,{shortcut:`Enter`,action:`select`}),(0,Z.jsx)(u,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})]})})})]}):z===`Model`?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(xt,{initial:j,onSelect:e=>{R.current=!0,Dt(e),B(null),a(!1)},onCancel:()=>{B(null),a(!1)},showFastModeNotice:tt()?Ge&&$e(j)&&nt():!1}),(0,Z.jsx)(S,{dimColor:!0,children:(0,Z.jsxs)(C,{children:[(0,Z.jsx)(b,{shortcut:`Enter`,action:`confirm`}),(0,Z.jsx)(u,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})]})})]}):z===`ExternalIncludes`?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(wt,{onDone:()=>{B(null),a(!1)},externalIncludes:fe(Ct)}),(0,Z.jsx)(S,{dimColor:!0,children:(0,Z.jsxs)(C,{children:[(0,Z.jsx)(b,{shortcut:`Enter`,action:`confirm`}),(0,Z.jsx)(u,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`disable external includes`})]})})]}):z===`OutputStyle`?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Rt,{initialStyle:_,onComplete:e=>{R.current=!0,he(e??`default`),B(null),a(!1),M(`localSettings`,{outputStyle:e}),F(`tengu_output_style_changed`,{style:e??`default`,source:`config_panel`,settings_source:`localSettings`})},onCancel:()=>{B(null),a(!1)}}),(0,Z.jsx)(S,{dimColor:!0,children:(0,Z.jsxs)(C,{children:[(0,Z.jsx)(b,{shortcut:`Enter`,action:`confirm`}),(0,Z.jsx)(u,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})]})})]}):z===`Language`?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Ut,{initialLanguage:v,onComplete:e=>{R.current=!0,ve(e),B(null),a(!1),M(`userSettings`,{language:e}),F(`tengu_language_changed`,{language:e??`default`,source:`config_panel`})},onCancel:()=>{B(null),a(!1)}}),(0,Z.jsx)(S,{dimColor:!0,children:(0,Z.jsxs)(C,{children:[(0,Z.jsx)(b,{shortcut:`Enter`,action:`confirm`}),(0,Z.jsx)(u,{action:`confirm:no`,context:`Settings`,fallback:`Esc`,description:`cancel`})]})})]}):z===`EnableAutoUpdates`?(0,Z.jsx)(ke,{title:`Enable Auto-Updates`,onCancel:()=>{B(null),a(!1)},hideBorder:!0,hideInputGuide:!0,children:U?.type===`config`?(0,Z.jsx)(pe,{options:[{label:`Enable with latest channel`,value:`latest`},{label:`Enable with stable channel`,value:`stable`}],onChange:e=>{R.current=!0,B(null),a(!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)(S,{children:U?.type===`env`?`Auto-updates are controlled by an environment variable and cannot be changed here.`:`Auto-updates are disabled in development builds.`}),U?.type===`env`&&(0,Z.jsxs)(S,{dimColor:!0,children:[`Unset `,U.envVar,` to re-enable auto-updates.`]})]})}):z===`ChannelDowngrade`?(0,Z.jsx)(Pt,{currentVersion:`0.0.10`,onChoice:e=>{if(B(null),a(!1),e===`cancel`)return;R.current=!0;let t={autoUpdatesChannel:`stable`};e===`stay`&&(t.minimumVersion=`0.0.10`),M(`userSettings`,t),g(e=>({...e,...t})),F(`tengu_autoupdate_channel_changed`,{channel:`stable`,minimum_version_set:e===`stay`})}}):(0,Z.jsxs)(x,{flexDirection:`column`,gap:1,marginY:re?void 0:1,children:[(0,Z.jsx)(Ee,{query:V,isFocused:O&&!l,isTerminalFocused:Ae,cursorOffset:ht,placeholder:`Search settings…`}),(0,Z.jsx)(x,{flexDirection:`column`,children:W.length===0?(0,Z.jsxs)(S,{dimColor:!0,italic:!0,children:[`No settings match "`,V,`"`]}):(0,Z.jsxs)(Z.Fragment,{children:[T>0&&(0,Z.jsxs)(S,{dimColor:!0,children:[s.arrowUp,` `,T,` more above`]}),W.slice(T,T+A).map((e,t)=>{let n=T+t===w&&!l&&!O;return(0,Z.jsx)(Y.Fragment,{children:(0,Z.jsxs)(x,{width:`100%`,children:[(0,Z.jsx)(x,{width:44,children:(0,Z.jsxs)(S,{color:n?`suggestion`:void 0,children:[n?s.pointer:` `,` `,e.label]})}),(0,Z.jsx)(x,{flexGrow:1,children:e.type===`boolean`?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(S,{color:n?`suggestion`:void 0,children:e.value.toString()}),pt&&e.id===`thinkingEnabled`&&(0,Z.jsxs)(S,{color:`warning`,children:[` `,`Changing thinking mode mid-conversation will increase latency and may reduce quality.`]})]}):e.id===`theme`?(0,Z.jsx)(S,{color:n?`suggestion`:void 0,children:Jt[e.value.toString()]??e.value.toString()}):e.id===`notifChannel`?(0,Z.jsx)(S,{color:n?`suggestion`:void 0,children:(0,Z.jsx)(qt,{value:e.value.toString()})}):e.id===`defaultPermissionMode`?(0,Z.jsx)(S,{color:n?`suggestion`:void 0,children:Ne(e.value)}):e.id===`autoUpdatesChannel`&&U?(0,Z.jsxs)(x,{flexDirection:`column`,children:[(0,Z.jsx)(S,{color:n?`suggestion`:void 0,children:`disabled`}),(0,Z.jsxs)(S,{dimColor:!0,children:[`(`,Ue(U),`)`]})]}):(0,Z.jsx)(S,{color:n?`suggestion`:void 0,children:e.value.toString()})})]})},e.id)}),T+A<W.length&&(0,Z.jsxs)(S,{dimColor:!0,children:[s.arrowDown,` `,W.length-T-A,` more below`]})]})}),l?(0,Z.jsx)(S,{dimColor:!0,children:(0,Z.jsxs)(C,{children:[(0,Z.jsx)(b,{shortcut:`←/→ tab`,action:`switch`}),(0,Z.jsx)(b,{shortcut:`↓`,action:`return`}),(0,Z.jsx)(u,{action:`confirm:no`,context:`Settings`,fallback:`Esc`,description:`close`})]})}):O?(0,Z.jsx)(S,{dimColor:!0,children:(0,Z.jsxs)(C,{children:[(0,Z.jsx)(S,{children:`Type to filter`}),(0,Z.jsx)(b,{shortcut:`Enter/↓`,action:`select`}),(0,Z.jsx)(b,{shortcut:`↑`,action:`tabs`}),(0,Z.jsx)(u,{action:`confirm:no`,context:`Settings`,fallback:`Esc`,description:`clear`})]})}):(0,Z.jsx)(S,{dimColor:!0,children:(0,Z.jsxs)(C,{children:[(0,Z.jsx)(u,{action:`select:accept`,context:`Settings`,fallback:`Space`,description:`change`}),(0,Z.jsx)(u,{action:`settings:close`,context:`Settings`,fallback:`Enter`,description:`save`}),(0,Z.jsx)(u,{action:`settings:search`,context:`Settings`,fallback:`/`,description:`search`}),(0,Z.jsx)(u,{action:`confirm:no`,context:`Settings`,fallback:`Esc`,description:`cancel`})]})})]})})}function qt({value:e}){switch(e){case`auto`:return`Auto`;case`iterm2`:return(0,Z.jsxs)(S,{children:[`iTerm2 `,(0,Z.jsx)(S,{dimColor:!0,children:`(OSC 9)`})]});case`terminal_bell`:return(0,Z.jsxs)(S,{children:[`Terminal Bell `,(0,Z.jsx)(S,{dimColor:!0,children:`(\\a)`})]});case`kitty`:return(0,Z.jsxs)(S,{children:[`Kitty `,(0,Z.jsx)(S,{dimColor:!0,children:`(OSC 99)`})]});case`ghostty`:return(0,Z.jsxs)(S,{children:[`Ghostty `,(0,Z.jsx)(S,{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,Jt,Yt=t((()=>{E(),Y=n(w(),1),X=n(w(),1),_(),o(),He(),it(),Te(),Re(),l(),Ge(),qe(),_t(),ne(),yt(),Ze(),St(),Ct(),It(),v(),Ht(),Gt(),ve(),d(),ht(),Tt(),ue(),j(),ge(),a(),U(),c(),I(),m(),Z=k(),Jt={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 Xt({onClose:e,context:t,defaultTab:n}){let[r,i]=(0,Q.useState)(n),[a,o]=(0,Q.useState)(!1),[s,c]=(0,Q.useState)(!1),ee=gt(),{rows:l}=H(Oe()),te=ee?l+1:Math.max(15,Math.min(Math.floor(l*.8),30)),[ne]=(0,Q.useState)(()=>kt().catch(()=>[]));return B(),Se(`confirm:no`,()=>{a||e(`Status dialog dismissed`,{display:`system`})},{context:`Settings`,isActive:!a&&!(r===`Config`&&s)}),(0,$.jsx)(O,{color:`permission`,children:(0,$.jsx)(T,{color:`permission`,selectedTab:r,onTabChange:i,hidden:a,initialHeaderFocused:n!==`Config`,contentHeight:a||ee?void 0:te,children:[(0,$.jsx)(De,{title:`Status`,children:(0,$.jsx)(At,{context:t,diagnosticsPromise:ne})},`status`),(0,$.jsx)(De,{title:`Config`,children:(0,$.jsx)(Q.Suspense,{fallback:null,children:(0,$.jsx)(Kt,{context:t,onClose:e,setTabsHidden:o,onIsSearchModeChange:c,contentHeight:te})})},`config`)]})})}var Q,$,Zt=t((()=>{w(),Q=n(w(),1),_(),V(),c(),ht(),E(),Nt(),Yt(),$=k()}));export{Zt as n,Xt as t};
@@ -1 +0,0 @@
1
- import{o as e}from"./rolldown-runtime-DaDcL9Zw.js";import{Iu as t,Ru as n,nd as r,td as i}from"./loadAgentsDir-C7lOqvfh.js";import{I as a,P as o,fi as s,t as c,y as l}from"./src-P_wYS_NJ2.js";import{t as u}from"./jsx-runtime-Bb4Xn-E0.js";import{Cn as d,bn as f}from"./settings-DnptdP79.js";import{a as p,r as m}from"./githubRepoPathMapping-DbWG4hFQ.js";var h=e(s(),1);c(),d(),i(),n();var g=u();function _({targetRepo:e,initialPaths:n,onSelectPath:i,onCancel:s}){let[c,u]=(0,h.useState)(n),[d,_]=(0,h.useState)(null),[v,y]=(0,h.useState)(!1),b=(0,h.useCallback)(async t=>{if(t===`cancel`){s();return}if(y(!0),_(null),await p(t,e)){i(t);return}m(e,t);let n=c.filter(e=>e!==t);u(n),y(!1),_(`${f(t)} no longer contains the correct repository. Select another path.`)},[e,c,i,s]),x=[...c.map(e=>({label:(0,g.jsxs)(o,{children:[`Use `,(0,g.jsx)(o,{bold:!0,children:f(e)})]}),value:e})),{label:`Cancel`,value:`cancel`}];return(0,g.jsx)(l,{title:`Teleport to Repo`,onCancel:s,color:`background`,children:c.length>0?(0,g.jsxs)(g.Fragment,{children:[(0,g.jsxs)(a,{flexDirection:`column`,gap:1,children:[d&&(0,g.jsx)(o,{color:`error`,children:d}),(0,g.jsxs)(o,{children:[`Open Claude Code in `,(0,g.jsx)(o,{bold:!0,children:e}),`:`]})]}),v?(0,g.jsxs)(a,{children:[(0,g.jsx)(t,{}),(0,g.jsx)(o,{children:` Validating repository…`})]}):(0,g.jsx)(r,{options:x,onChange:e=>void b(e)})]}):(0,g.jsxs)(a,{flexDirection:`column`,gap:1,children:[d&&(0,g.jsx)(o,{color:`error`,children:d}),(0,g.jsxs)(o,{dimColor:!0,children:[`Run claude --teleport from a checkout of `,e]})]})})}export{_ as TeleportRepoMismatchDialog};
@@ -1 +0,0 @@
1
- import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{n,t as r}from"./figures-5ThXQEtq.js";import{BT as i,FC as a,I as o,IC as s,L as c,LT as l,R as u,h_ as d,v_ as f,y_ as p}from"./loadAgentsDir-C7lOqvfh.js";import{I as m,P as h,di as g,fi as _,t as v,ui as y}from"./src-P_wYS_NJ2.js";import{t as b}from"./jsx-runtime-Bb4Xn-E0.js";import{Wt as x,h as S,in as C}from"./state-BemZdQIl.js";import{n as w,t as T}from"./AddWorkspaceDirectory-Vmmm7p1c.js";function E({message:e,args:t,onDone:n}){return(0,O.useEffect)(()=>{let e=setTimeout(n,0);return()=>clearTimeout(e)},[n]),(0,k.jsxs)(m,{flexDirection:`column`,children:[(0,k.jsxs)(h,{dimColor:!0,children:[r.pointer,` /add-dir `,t]}),(0,k.jsx)(a,{children:(0,k.jsx)(h,{children:e})})]})}async function D(e,t,n){let r=(n??``).trim(),i=t.getAppState(),a=async(n,r=!1)=>{let i={type:`addDirectories`,directories:[n],destination:r?`localSettings`:`session`},a=d(t.getAppState().toolPermissionContext,i);t.setAppState(e=>({...e,toolPermissionContext:a}));let o=S();o.includes(n)||C([...o,n]),l.refreshConfig();let s;if(r)try{p(i),s=`Added ${y.bold(n)} as a working directory and saved to local settings`}catch(e){s=`Added ${y.bold(n)} as a working directory. Failed to save to local settings: ${e instanceof Error?e.message:`Unknown error`}`}else s=`Added ${y.bold(n)} as a working directory for this session`;e(`${s} ${y.dim(`· /permissions to manage`)}`)};if(!r)return(0,k.jsx)(T,{permissionContext:i.toolPermissionContext,onAddDirectory:a,onCancel:()=>{e(`Did not add a working directory.`)}});let s=await u(r,i.toolPermissionContext);if(s.resultType!==`success`){let t=o(s);return(0,k.jsx)(E,{message:t,args:n??``,onDone:()=>e(t)})}return(0,k.jsx)(T,{directoryPath:s.absolutePath,permissionContext:i.toolPermissionContext,onAddDirectory:a,onCancel:()=>{e(`Did not add ${y.bold(s.absolutePath)} as a working directory.`)}})}var O,k;e((()=>{g(),n(),O=t(_(),1),x(),s(),w(),v(),f(),i(),c(),k=b()}))();export{D as call};
@@ -1,103 +0,0 @@
1
- import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{n,o as r}from"./envUtils-BDhHQY0-.js";import{n as i,t as a}from"./figures-5ThXQEtq.js";import{$ as o,Ah as s,BE as c,BS as l,Ba as u,Cg as d,Ch as f,Cv as p,Eg as m,HE as h,Ih as g,Ip as _,Iu as v,Kl as ee,Lh as y,Lp as b,MC as te,Mh as ne,Np as re,Qp as ie,Ru as ae,Sv as oe,Ta as se,VE as ce,VS as le,Xl as ue,Xp as de,Ya as fe,Zl as pe,Zp as me,_x as he,am as ge,ap as _e,bx as ve,c as ye,cE as be,dm as xe,fd as Se,hh as Ce,im as we,ip as Te,it as Ee,jC as De,jh as Oe,jp as ke,kh as Ae,l as je,mh as Me,nS as Ne,nd as Pe,nl as Fe,nm as Ie,np as Le,nu as Re,o as ze,om as Be,ot as Ve,pd as He,pm as Ue,qC as x,ql as We,r as Ge,rd as Ke,rl as qe,rm as Je,rp as Ye,s as Xe,sE as Ze,t as Qe,tS as $e,tt as et,tu as tt,um as nt,vx as rt,wg as it,wh as at,yv as ot,yx as st}from"./loadAgentsDir-C7lOqvfh.js";import{C as ct,D as S,I as C,P as w,T,Wt as E,di as lt,fi as D,t as O,ui as ut,y as dt}from"./src-P_wYS_NJ2.js";import{t as k}from"./jsx-runtime-Bb4Xn-E0.js";import{n as ft,t as pt}from"./cwd-Cfdf7z7s.js";import{C as mt,G as ht,I as gt,Q as _t,S as vt,W as yt,z as bt}from"./debug-RAynG_nM.js";import{In as xt,J as St,Ln as Ct,Q as wt,Yt as Tt,Zt as Et,at as Dt,cn as Ot,it as kt,on as At}from"./settings-DnptdP79.js";import{M as jt,P as Mt}from"./config-Do1870_d.js";import{o as Nt,s as Pt}from"./log-CezCRpAN.js";import{n as Ft,r as It}from"./analytics-DJobLaWP.js";import{C as Lt,v as Rt}from"./startupProfiler-L_UWZ03w.js";import{l as zt,n as Bt,o as Vt}from"./stringUtils-C84IJ91d.js";import{bn as Ht,yn as Ut}from"./prompt-M2lu8_Oa.js";import{at as Wt}from"./sessionState-Bifmu95-.js";import{a as Gt,i as Kt,n as qt,o as Jt,r as Yt,t as Xt}from"./agentDisplay-B755vMZE.js";import{n as Zt,t as Qt}from"./useExitOnCtrlCDWithKeybindings-ChqBs9Lr.js";import{n as $t,t as en}from"./useMergedTools-Dk5cPqLc.js";import{n as tn,r as nn,t as rn}from"./promptEditor-DhcZY-iu.js";import{n as an,t as on}from"./useMainLoopModel-2-eujv0n.js";import{join as A}from"path";import{mkdir as sn,open as cn,unlink as ln}from"fs/promises";var j,un=e((()=>{j={FOLDER_NAME:`.claude`,AGENTS_DIR:`agents`}}));function dn(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 fn(e){switch(e){case`flagSettings`:throw Error(`Cannot get directory path for ${e} agents`);case`userSettings`:return A(n(),j.AGENTS_DIR);case`projectSettings`:return A(pt(),j.FOLDER_NAME,j.AGENTS_DIR);case`policySettings`:return A(Tt(),j.FOLDER_NAME,j.AGENTS_DIR);case`localSettings`:return A(pt(),j.FOLDER_NAME,j.AGENTS_DIR)}}function pn(e){switch(e){case`projectSettings`:return A(`.`,j.FOLDER_NAME,j.AGENTS_DIR);default:return fn(e)}}function mn(e){return A(fn(e.source),`${e.agentType}.md`)}function hn(e){if(e.source===`built-in`)return`Built-in`;if(e.source===`plugin`)throw Error(`Cannot get file path for plugin agents`);return A(fn(e.source),`${e.filename||e.agentType}.md`)}function gn(e){return e.source===`built-in`?`Built-in`:A(pn(e.source),`${e.agentType}.md`)}function _n(e){return Xe(e)?`Built-in`:je(e)?`Plugin: ${e.plugin||`Unknown`}`:e.source===`flagSettings`?`CLI argument`:A(pn(e.source),`${e.filename||e.agentType}.md`)}async function vn(e){let t=fn(e);return await sn(t,{recursive:!0}),t}async function yn(e,t,n,r,i,a=!0,o,s,c){if(e===`built-in`)throw Error(`Cannot save built-in agents`);await vn(e);let l=mn({source:e,agentType:t}),u=dn(t,n,r,i,o,s,c);try{await Sn(l,u,a?`wx`:`w`)}catch(e){throw gt(e)===`EEXIST`?Error(`Agent file already exists: ${l}`):e}}async function bn(e,t,n,r,i,a,o){if(e.source===`built-in`)throw Error(`Cannot update built-in agents`);await Sn(hn(e),dn(e.agentType,t,n,r,i,a,o))}async function xn(e){if(e.source===`built-in`)throw Error(`Cannot delete built-in agents`);let t=hn(e);try{await ln(t)}catch(e){if(gt(e)!==`ENOENT`)throw e}}async function Sn(e,t,n=`w`){let r=await cn(e,n);try{await r.writeFile(t,{encoding:`utf-8`}),await r.datasync()}finally{await r.close()}}var Cn=e((()=>{Et(),ze(),ft(),r(),bt(),un()}));function wn({agent:e,tools:t,onBack:n}){let r=ie(e,t,!1),i=_n(e),o=we(e.agentType);E(`confirm:no`,n,{context:`Confirmation`});let s=e=>{e.key===`return`&&(e.preventDefault(),n())};function l(){return r.hasWildcard?(0,M.jsx)(w,{children:`All tools`}):!e.tools||e.tools.length===0?(0,M.jsx)(w,{children:`None`}):(0,M.jsxs)(M.Fragment,{children:[r.validTools.length>0&&(0,M.jsx)(w,{children:r.validTools.join(`, `)}),r.invalidTools.length>0&&(0,M.jsxs)(w,{color:`warning`,children:[a.warning,` Unrecognized: `,r.invalidTools.join(`, `)]})]})}return(0,M.jsxs)(C,{flexDirection:`column`,gap:1,tabIndex:0,autoFocus:!0,onKeyDown:s,children:[(0,M.jsx)(w,{dimColor:!0,children:i}),(0,M.jsxs)(C,{flexDirection:`column`,children:[(0,M.jsxs)(w,{children:[(0,M.jsx)(w,{bold:!0,children:`Description`}),` (tells Claude when to use this agent):`]}),(0,M.jsx)(C,{marginLeft:2,children:(0,M.jsx)(w,{children:e.whenToUse})})]}),(0,M.jsxs)(C,{children:[(0,M.jsxs)(w,{children:[(0,M.jsx)(w,{bold:!0,children:`Tools`}),`:`,` `]}),l()]}),(0,M.jsxs)(w,{children:[(0,M.jsx)(w,{bold:!0,children:`Model`}),`: `,nt(e.model)]}),e.permissionMode&&(0,M.jsxs)(w,{children:[(0,M.jsx)(w,{bold:!0,children:`Permission mode`}),`: `,e.permissionMode]}),e.memory&&(0,M.jsxs)(w,{children:[(0,M.jsx)(w,{bold:!0,children:`Memory`}),`: `,c(e.memory)]}),e.hooks&&Object.keys(e.hooks).length>0&&(0,M.jsxs)(w,{children:[(0,M.jsx)(w,{bold:!0,children:`Hooks`}),`: `,Object.keys(e.hooks).join(`, `)]}),e.skills&&e.skills.length>0&&(0,M.jsxs)(w,{children:[(0,M.jsx)(w,{bold:!0,children:`Skills`}),`:`,` `,e.skills.length>10?`${e.skills.length} skills`:e.skills.join(`, `)]}),o&&(0,M.jsx)(C,{children:(0,M.jsxs)(w,{children:[(0,M.jsx)(w,{bold:!0,children:`Color`}),`:`,` `,(0,M.jsxs)(w,{backgroundColor:o,color:`inverseText`,children:[` `,e.agentType,` `]})]})}),!Xe(e)&&(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(C,{children:(0,M.jsxs)(w,{children:[(0,M.jsx)(w,{bold:!0,children:`System prompt`}),`:`]})}),(0,M.jsx)(C,{marginLeft:2,marginRight:2,children:(0,M.jsx)(ke,{children:e.getSystemPrompt()})})]})]})}var M,Tn=e((()=>{i(),D(),O(),x(),ge(),ce(),me(),ze(),Ue(),re(),Cn(),M=k()}));function En({agentName:e,currentColor:t=`automatic`,onConfirm:n}){let[r,i]=(0,Dn.useState)(Math.max(0,On.indexOf(t))),o=e=>{if(e.key===`up`)e.preventDefault(),i(e=>e>0?e-1:On.length-1);else if(e.key===`down`)e.preventDefault(),i(e=>e<On.length-1?e+1:0);else if(e.key===`return`){e.preventDefault();let t=On[r];n(t===`automatic`?void 0:t)}},s=On[r];return(0,N.jsxs)(C,{flexDirection:`column`,gap:1,tabIndex:0,autoFocus:!0,onKeyDown:o,children:[(0,N.jsx)(C,{flexDirection:`column`,children:On.map((e,t)=>{let n=t===r;return(0,N.jsxs)(C,{flexDirection:`row`,gap:1,children:[(0,N.jsx)(w,{color:n?`suggestion`:void 0,children:n?a.pointer:` `}),e===`automatic`?(0,N.jsx)(w,{bold:n,children:`Automatic color`}):(0,N.jsxs)(C,{gap:1,children:[(0,N.jsx)(w,{backgroundColor:Je[e],color:`inverseText`,children:` `}),(0,N.jsx)(w,{bold:n,children:Bt(e)})]})]},e)})}),(0,N.jsxs)(C,{marginTop:1,children:[(0,N.jsx)(w,{children:`Preview: `}),s===void 0||s===`automatic`?(0,N.jsxs)(w,{inverse:!0,bold:!0,children:[` `,`@`,e,` `]}):(0,N.jsxs)(w,{backgroundColor:Je[s],color:`inverseText`,bold:!0,children:[` `,`@`,e,` `]})]})]})}var Dn,N,On,kn=e((()=>{i(),Dn=t(D(),1),O(),ge(),Vt(),N=k(),On=[`automatic`,...Ie]}));function An({initialModel:e,onComplete:t,onCancel:n}){let r=jn.useMemo(()=>{let t=xe();return e&&!t.some(t=>t.value===e)?[{value:e,label:e,description:`Current model (custom ID)`},...t]:t},[e]);return(0,Mn.jsxs)(C,{flexDirection:`column`,children:[(0,Mn.jsx)(C,{marginBottom:1,children:(0,Mn.jsx)(w,{dimColor:!0,children:`Model determines the agent's reasoning capabilities and speed.`})}),(0,Mn.jsx)(Pe,{options:r,defaultValue:e??`sonnet`,onChange:t,onCancel:()=>n?n():t(void 0)})]})}var jn,Mn,Nn=e((()=>{jn=t(D(),1),O(),Ue(),Ke(),Mn=k()}));function Pn(){return{READ_ONLY:{name:`Read-only tools`,toolNames:new Set([Ae.name,Oe.name,ee.name,De.name,f.name,tt.name,ue.name,l.name,st.name])},EDIT:{name:`Edit tools`,toolNames:new Set([Te.name,g.name,Le.name])},EXECUTION:{name:`Execution tools`,toolNames:new Set([Me.name])},MCP:{name:`MCP tools`,toolNames:new Set,isMcp:!0},OTHER:{name:`Other tools`,toolNames:new Set}}}function Fn(e){let t=new Map;return e.forEach(e=>{if(Ne(e)){let n=Dt(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 In({tools:e,initialTools:t,onComplete:n,onCancel:r}){let i=(0,P.useMemo)(()=>de({tools:e,isBuiltIn:!1,isAsync:!1}),[e]),[o,s]=(0,P.useState)(!t||t.includes(`*`)?i.map(e=>e.name):t),[c,l]=(0,P.useState)(0),[u,d]=(0,P.useState)(!1),f=(0,P.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,P.useMemo)(()=>{let e=Pn(),t={readOnly:[],edit:[],execution:[],mcp:[],other:[]};return i.forEach(n=>{Ne(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=Pn();[{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,P.useMemo)(()=>Fn(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} ${zt(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=Dt(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)})})),E(`confirm:no`,(0,P.useCallback)(()=>{r?r():n(t)},[r,n,t]),{context:`Confirmation`}),(0,F.jsxs)(C,{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,F.jsxs)(w,{color:c===0?`suggestion`:void 0,bold:c===0,children:[c===0?`${a.pointer} `:` `,`[ Continue ]`]}),(0,F.jsx)(ct,{width:40}),y.slice(1).map((e,t)=>{let n=t+1===c,r=e.isToggle,i=e.isHeader;return(0,F.jsxs)(P.Fragment,{children:[r&&(0,F.jsx)(ct,{width:40}),i&&t>0&&(0,F.jsx)(C,{marginTop:1}),(0,F.jsxs)(w,{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,F.jsx)(C,{marginTop:1,flexDirection:`column`,children:(0,F.jsx)(w,{dimColor:!0,children:m?`All tools selected`:`${p.size} of ${i.length} tools selected`})})]})}var P,F,Ln=e((()=>{i(),P=t(D(),1),kt(),$e(),me(),wt(),Ce(),We(),_e(),te(),y(),s(),ne(),le(),Ye(),ve(),pe(),Re(),at(),O(),x(),Ct(),Vt(),F=k()}));function Rn(e){return e===`all`?`Agents`:e===`built-in`?`Built-in agents`:e===`plugin`?`Plugin agents`:Ze(At(e))}var zn=e((()=>{be(),Ot()}));function Bn({agent:e,tools:t,onSaved:n,onBack:r}){let i=m(),[o,s]=(0,I.useState)(`menu`),[c,l]=(0,I.useState)(0),[u,d]=(0,I.useState)(null),[f,p]=(0,I.useState)(e.color),h=(0,I.useCallback)(async()=>{let t=await rn(hn(e));t.error?d(t.error):n(`Opened ${e.agentType} in editor. If you made edits, restart to load the latest version.`)},[e,n]),g=(0,I.useCallback)(async(t={})=>{let{tools:r,color:a,model:o}=t,s=a??f,c=r!==void 0,l=o!==void 0,u=s!==e.color;if(!c&&!l&&!u)return!1;try{return!ye(e)&&!je(e)?!1:(await bn(e,e.whenToUse,r??e.tools,e.getSystemPrompt(),s,o??e.model),u&&s&&Be(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:Ge(n),allAgents:n}}}),n(`Updated agent: ${ut.bold(e.agentType)}`),!0)}catch(e){return d(e instanceof Error?e.message:`Failed to save agent`),!1}},[e,f,n,i]),_=(0,I.useMemo)(()=>[{label:`Open in editor`,action:h},{label:`Edit tools`,action:()=>s(`edit-tools`)},{label:`Edit model`,action:()=>s(`edit-model`)},{label:`Edit color`,action:()=>s(`edit-color`)}],[h]),v=(0,I.useCallback)(()=>{d(null),o===`menu`?r():s(`menu`)},[o,r]),ee=(0,I.useCallback)(e=>{if(e.key===`up`)e.preventDefault(),l(e=>Math.max(0,e-1));else if(e.key===`down`)e.preventDefault(),l(e=>Math.min(_.length-1,e+1));else if(e.key===`return`){e.preventDefault();let t=_[c];t&&t.action()}},[_,c]);E(`confirm:no`,v,{context:`Confirmation`});let y=()=>(0,L.jsxs)(C,{flexDirection:`column`,tabIndex:0,autoFocus:!0,onKeyDown:ee,children:[(0,L.jsxs)(w,{dimColor:!0,children:[`Source: `,Rn(e.source)]}),(0,L.jsx)(C,{marginTop:1,flexDirection:`column`,children:_.map((e,t)=>(0,L.jsxs)(w,{color:t===c?`suggestion`:void 0,children:[t===c?`${a.pointer} `:` `,e.label]},e.label))}),u&&(0,L.jsx)(C,{marginTop:1,children:(0,L.jsx)(w,{color:`error`,children:u})})]});switch(o){case`menu`:return y();case`edit-tools`:return(0,L.jsx)(In,{tools:t,initialTools:e.tools,onComplete:async e=>{s(`menu`),await g({tools:e})}});case`edit-color`:return(0,L.jsx)(En,{agentName:e.agentType,currentColor:f||e.color||`automatic`,onConfirm:async e=>{p(e),s(`menu`),await g({color:e})}});case`edit-model`:return(0,L.jsx)(An,{initialModel:e.model,onComplete:async e=>{s(`menu`),await g({model:e})}});default:return null}}var I,L,Vn=e((()=>{lt(),i(),D(),I=t(D(),1),d(),O(),x(),ge(),ze(),nn(),Cn(),kn(),Nn(),Ln(),zn(),L=k()}));function Hn({instructions:e=`Press ↑↓ to navigate · Enter to select · Esc to go back`}){let t=Zt();return(0,Un.jsx)(C,{marginLeft:2,children:(0,Un.jsx)(w,{dimColor:!0,children:t.pending?`Press ${t.keyName} again to exit`:e})})}var Un,Wn=e((()=>{D(),Qt(),O(),Un=k()}));function Gn({source:e,agents:t,onBack:n,onSelect:r,onCreateNew:i,changes:o}){let[s,c]=Kn.useState(null),[l,u]=Kn.useState(!0),d=Kn.useMemo(()=>[...t].sort(qt),[t]),f=e=>({isOverridden:!!e.overriddenBy,overriddenBy:e.overriddenBy||null}),p=()=>(0,R.jsxs)(C,{children:[(0,R.jsx)(w,{color:l?`suggestion`:void 0,children:l?`${a.pointer} `:` `}),(0,R.jsx)(w,{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=Gt(e);return(0,R.jsxs)(C,{children:[(0,R.jsx)(w,{dimColor:o&&!n,color:c,children:t?``:n?`${a.pointer} `:` `}),(0,R.jsx)(w,{dimColor:o&&!n,color:c,children:e.agentType}),u&&(0,R.jsxs)(w,{dimColor:!0,color:c,children:[` · `,u]}),e.memory&&(0,R.jsxs)(w,{dimColor:!0,color:c,children:[` · `,e.memory,` memory`]}),i&&(0,R.jsxs)(w,{dimColor:!n,color:n?`warning`:void 0,children:[` `,a.warning,` shadowed by `,Yt(i)]})]},`${e.agentType}-${e.source}`)},h=Kn.useMemo(()=>{let t=d.filter(e=>e.source!==`built-in`);return e===`all`?Xt.filter(e=>e.source!==`built-in`).flatMap(({source:e})=>t.filter(t=>t.source===e)):t},[d,e]);Kn.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,R.jsxs)(C,{flexDirection:`column`,marginBottom:1,paddingLeft:2,children:[(0,R.jsx)(w,{bold:!0,dimColor:!0,children:e}),t.map(m)]})},v=(e,t)=>{if(!t.length)return null;let n=t[0]?.baseDir;return(0,R.jsxs)(C,{flexDirection:`column`,marginBottom:1,children:[(0,R.jsxs)(C,{paddingLeft:2,children:[(0,R.jsx)(w,{bold:!0,dimColor:!0,children:e}),n&&(0,R.jsxs)(w,{dimColor:!0,children:[` (`,n,`)`]})]}),t.map(e=>m(e))]})},ee=Rn(e),y=d.filter(e=>e.source===`built-in`);return!d.length||e!==`built-in`&&!d.some(e=>e.source!==`built-in`)?(0,R.jsx)(dt,{title:ee,subtitle:`No agents found`,onCancel:n,hideInputGuide:!0,children:(0,R.jsxs)(C,{flexDirection:`column`,gap:1,tabIndex:0,autoFocus:!0,onKeyDown:g,children:[i&&(0,R.jsx)(C,{children:p()}),(0,R.jsx)(w,{dimColor:!0,children:`No agents found. Create specialized subagents that Claude can delegate to.`}),(0,R.jsx)(w,{dimColor:!0,children:`Each subagent has its own context window, custom system prompt, and specific tools.`}),(0,R.jsx)(w,{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,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(ct,{}),_()]})]})}):(0,R.jsxs)(dt,{title:ee,subtitle:`${xt(d,e=>!e.overriddenBy)} agents`,onCancel:n,hideInputGuide:!0,children:[o&&o.length>0&&(0,R.jsx)(C,{marginTop:1,children:(0,R.jsx)(w,{dimColor:!0,children:o[o.length-1]})}),(0,R.jsxs)(C,{flexDirection:`column`,tabIndex:0,autoFocus:!0,onKeyDown:g,children:[i&&(0,R.jsx)(C,{marginBottom:1,children:p()}),e===`all`?(0,R.jsxs)(R.Fragment,{children:[Xt.filter(e=>e.source!==`built-in`).map(({label:e,source:t})=>(0,R.jsx)(Kn.Fragment,{children:v(e,d.filter(e=>e.source===t))},t)),y.length>0&&(0,R.jsxs)(C,{flexDirection:`column`,marginBottom:1,paddingLeft:2,children:[(0,R.jsxs)(w,{dimColor:!0,children:[(0,R.jsx)(w,{bold:!0,children:`Built-in agents`}),` (always available)`]}),y.map(m)]})]}):e===`built-in`?(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(w,{dimColor:!0,italic:!0,children:`Built-in agents are provided by default and cannot be modified.`}),(0,R.jsx)(C,{marginTop:1,flexDirection:`column`,children:d.map(e=>m(e))})]}):(0,R.jsxs)(R.Fragment,{children:[d.filter(e=>e.source!==`built-in`).map(e=>m(e)),d.some(e=>e.source===`built-in`)&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(ct,{}),_()]})]})]})]})}var Kn,R,qn=e((()=>{i(),Kn=t(D(),1),O(),Kt(),Ct(),zn(),R=k()}));function Jn({steps:e,initialData:t={},onComplete:n,onCancel:r,children:i,title:a,showStepCounter:o=!0}){let[s,c]=(0,z.useState)(0),[l,u]=(0,z.useState)(t),[d,f]=(0,z.useState)(!1),[p,m]=(0,z.useState)([]);Zt(),(0,z.useEffect)(()=>{d&&(m([]),n(l))},[d,l,n]);let h=(0,z.useCallback)(()=>{s<e.length-1?(p.length>0&&m(e=>[...e,s]),c(e=>e+1)):f(!0)},[s,e.length,p]),g=(0,z.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,z.useCallback)(t=>{t>=0&&t<e.length&&(m(e=>[...e,s]),c(t))},[s,e.length]),v=(0,z.useCallback)(()=>{m([]),r&&r()},[r]),ee=(0,z.useCallback)(e=>{u(t=>({...t,...e}))},[]),y=(0,z.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,Yn.jsx)(Xn.Provider,{value:y,children:i||(0,Yn.jsx)(b,{})})}var z,Yn,Xn,Zn=e((()=>{z=t(D(),1),Qt(),Yn=k(),Xn=(0,z.createContext)(null)}));function B(){let e=(0,Qn.useContext)(Xn);if(!e)throw Error(`useWizard must be used within a WizardProvider`);return e}var Qn,$n=e((()=>{Qn=t(D(),1),Zn()}));function er({instructions:e=(0,tr.jsxs)(T,{children:[(0,tr.jsx)(S,{shortcut:`↑↓`,action:`navigate`}),(0,tr.jsx)(S,{shortcut:`Enter`,action:`select`}),(0,tr.jsx)(_,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`})]})}){let t=Zt();return(0,tr.jsx)(C,{marginLeft:3,marginTop:1,children:(0,tr.jsx)(w,{dimColor:!0,children:t.pending?`Press ${t.keyName} again to exit`:e})})}var tr,nr=e((()=>{Qt(),O(),b(),tr=k()}));function V({title:e,color:t=`suggestion`,children:n,subtitle:r,footerText:i}){let{currentStepIndex:a,totalSteps:o,title:s,showStepCounter:c,goBack:l}=B();return(0,rr.jsxs)(rr.Fragment,{children:[(0,rr.jsx)(dt,{title:`${e||s||`Wizard`}${c===!1?``:` (${a+1}/${o})`}`,subtitle:r,onCancel:l,color:t,hideInputGuide:!0,isCancelActive:!1,children:n}),(0,rr.jsx)(er,{instructions:i})]})}var rr,H=e((()=>{O(),$n(),nr(),rr=k()})),U=e((()=>{$n(),H(),nr(),Zn()}));function ir(){let{goNext:e,goBack:t,updateWizardData:n,wizardData:r}=B();return E(`confirm:no`,t,{context:`Confirmation`}),(0,ar.jsx)(V,{subtitle:`Choose background color`,footerText:(0,ar.jsxs)(T,{children:[(0,ar.jsx)(S,{shortcut:`↑↓`,action:`navigate`}),(0,ar.jsx)(S,{shortcut:`Enter`,action:`select`}),(0,ar.jsx)(_,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`})]}),children:(0,ar.jsx)(C,{children:(0,ar.jsx)(En,{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 ar,or=e((()=>{O(),x(),b(),U(),H(),kn(),ar=k()}));function sr(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 cr(e,t,n){let r=[],i=[];if(!e.agentType)r.push(`Agent type is required`);else{let t=sr(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 ${Rn(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=ie(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 lr=e((()=>{me(),zn()}));function ur({tools:e,existingAgents:t,onSave:n,onSaveAndEdit:r,error:i}){let{goBack:a,wizardData:o}=B();E(`confirm:no`,a,{context:`Confirmation`});let s=e=>{e.key===`s`||e.key===`return`?(e.preventDefault(),n()):e.key===`e`&&(e.preventDefault(),r())},l=o.finalAgent,u=cr(l,e,t),d=Lt(l.getSystemPrompt(),240),f=Lt(l.whenToUse,240),p=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]}`,m=Mt()?(0,W.jsxs)(w,{children:[(0,W.jsx)(w,{bold:!0,children:`Memory`}),`: `,c(l.memory)]}):null;return(0,W.jsx)(V,{subtitle:`Confirm and save`,footerText:(0,W.jsxs)(T,{children:[(0,W.jsx)(S,{shortcut:`s/Enter`,action:`save`}),(0,W.jsx)(S,{shortcut:`e`,action:`edit in your editor`}),(0,W.jsx)(_,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})]}),children:(0,W.jsxs)(C,{flexDirection:`column`,tabIndex:0,autoFocus:!0,onKeyDown:s,children:[(0,W.jsxs)(w,{children:[(0,W.jsx)(w,{bold:!0,children:`Name`}),`: `,l.agentType]}),(0,W.jsxs)(w,{children:[(0,W.jsx)(w,{bold:!0,children:`Location`}),`:`,` `,gn({source:o.location,agentType:l.agentType})]}),(0,W.jsxs)(w,{children:[(0,W.jsx)(w,{bold:!0,children:`Tools`}),`: `,p(l.tools)]}),(0,W.jsxs)(w,{children:[(0,W.jsx)(w,{bold:!0,children:`Model`}),`: `,nt(l.model)]}),m,(0,W.jsx)(C,{marginTop:1,children:(0,W.jsxs)(w,{children:[(0,W.jsx)(w,{bold:!0,children:`Description`}),` (tells Claude when to use this agent):`]})}),(0,W.jsx)(C,{marginLeft:2,marginTop:1,children:(0,W.jsx)(w,{children:f})}),(0,W.jsx)(C,{marginTop:1,children:(0,W.jsxs)(w,{children:[(0,W.jsx)(w,{bold:!0,children:`System prompt`}),`:`]})}),(0,W.jsx)(C,{marginLeft:2,marginTop:1,children:(0,W.jsx)(w,{children:d})}),u.warnings.length>0&&(0,W.jsxs)(C,{marginTop:1,flexDirection:`column`,children:[(0,W.jsx)(w,{color:`warning`,children:`Warnings:`}),u.warnings.map((e,t)=>(0,W.jsxs)(w,{dimColor:!0,children:[` `,`• `,e]},t))]}),u.errors.length>0&&(0,W.jsxs)(C,{marginTop:1,flexDirection:`column`,children:[(0,W.jsx)(w,{color:`error`,children:`Errors:`}),u.errors.map((e,t)=>(0,W.jsxs)(w,{color:`error`,children:[` `,`• `,e]},t))]}),i&&(0,W.jsx)(C,{marginTop:1,children:(0,W.jsx)(w,{color:`error`,children:i})}),(0,W.jsx)(C,{marginTop:2,children:(0,W.jsxs)(w,{color:`success`,children:[`Press `,(0,W.jsx)(w,{bold:!0,children:`s`}),` or `,(0,W.jsx)(w,{bold:!0,children:`Enter`}),` to save, `,(0,W.jsx)(w,{bold:!0,children:`e`}),` to save and edit`]})})]})})}var W,dr=e((()=>{O(),x(),jt(),ce(),Rt(),Ue(),b(),U(),H(),Cn(),lr(),W=k()}));function fr({tools:e,existingAgents:t,onComplete:n}){let{wizardData:r}=B(),[i,a]=(0,pr.useState)(null),o=m(),s=(0,pr.useCallback)(async e=>{if(r?.finalAgent)try{await yn(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:Ge(t),allAgents:t}}}),Qe(),e&&await rn(mn({source:r.location,agentType:r.finalAgent.agentType})),It(`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: ${ut.bold(r.finalAgent.agentType)} and opened in editor. If you made edits, restart to load the latest version.`:`Created agent: ${ut.bold(r.finalAgent.agentType)}`)}catch(e){a(e instanceof Error?e.message:`Failed to save agent`)}},[r,n,o]);return(0,mr.jsx)(ur,{tools:e,existingAgents:t,onSave:(0,pr.useCallback)(()=>s(!1),[s]),onSaveAndEdit:(0,pr.useCallback)(()=>s(!0),[s]),error:i})}var pr,mr,hr=e((()=>{lt(),pr=t(D(),1),Ft(),d(),ze(),nn(),U(),Cn(),dr(),mr=k()}));function gr(){let{goNext:e,goBack:t,updateWizardData:n,wizardData:r}=B(),[i,a]=(0,_r.useState)(r.whenToUse||``),[o,s]=(0,_r.useState)(i.length),[c,l]=(0,_r.useState)(null);return E(`confirm:no`,t,{context:`Settings`}),E(`chat:externalEditor`,(0,_r.useCallback)(async()=>{let e=await tn(i);e.content!==null&&(a(e.content),s(e.content.length))},[i]),{context:`Chat`}),(0,G.jsx)(V,{subtitle:`Description (tell Claude when to use this agent)`,footerText:(0,G.jsxs)(T,{children:[(0,G.jsx)(S,{shortcut:`Type`,action:`enter text`}),(0,G.jsx)(S,{shortcut:`Enter`,action:`continue`}),(0,G.jsx)(_,{action:`chat:externalEditor`,context:`Chat`,fallback:`ctrl+g`,description:`open in editor`}),(0,G.jsx)(_,{action:`confirm:no`,context:`Settings`,fallback:`Esc`,description:`go back`})]}),children:(0,G.jsxs)(C,{flexDirection:`column`,children:[(0,G.jsx)(w,{children:`When should Claude use this agent?`}),(0,G.jsx)(C,{marginTop:1,children:(0,G.jsx)(Se,{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,G.jsx)(C,{marginTop:1,children:(0,G.jsx)(w,{color:`error`,children:c})})]})})}var _r,G,vr=e((()=>{_r=t(D(),1),O(),x(),nn(),b(),He(),U(),H(),G=k()}));async function yr(e,t,n,r){let i=se({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 oe(),o=Ve([i],a),s=Mt()?br+xr:br,c=await et({messages:fe(o),systemPrompt:Wt([s]),thinkingConfig:{type:`disabled`},tools:[],signal:r,options:{getToolPermissionContext:async()=>Ut(),model:t,toolChoice:void 0,agents:[],isNonInteractiveSession:!1,hasAppendSystemPrompt:!1,querySource:`agent_creation`,mcpTools:[]}}),l=(Array.isArray(c.message.content)?c.message.content:[]).filter(e=>e.type===`text`).map(e=>e.text).join(`
9
- `),u;try{u=mt(l.trim())}catch{let e=l.match(/\{[\s\S]*\}/);if(!e)throw Error(`No JSON object found in response`);u=mt(e[0])}if(!u.identifier||!u.whenToUse||!u.systemPrompt)throw Error(`Invalid agent configuration generated`);return It(`tengu_agent_definition_generated`,{agent_identifier:u.identifier}),{identifier:u.identifier,whenToUse:u.whenToUse,systemPrompt:u.systemPrompt}}var br,xr,Sr=e((()=>{p(),o(),Ht(),wt(),Ee(),u(),jt(),Ft(),vt(),ot(),br=`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 CLAUDE.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 CLAUDE.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 CLAUDE.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 ${St} 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 ${St} 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
- `,xr=`
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 Cr(){let{updateWizardData:e,goBack:t,goToStep:n,wizardData:r}=B(),[i,a]=(0,K.useState)(r.generationPrompt||``),[o,s]=(0,K.useState)(!1),[c,l]=(0,K.useState)(null),[u,d]=(0,K.useState)(i.length),f=an(),p=(0,K.useRef)(null);E(`confirm:no`,(0,K.useCallback)(()=>{p.current&&(p.current.abort(),p.current=null,s(!1),l(`Generation cancelled`))},[]),{context:`Settings`,isActive:o}),E(`chat:externalEditor`,(0,K.useCallback)(async()=>{let e=await tn(i);e.content!==null&&(a(e.content),d(e.content.length))},[i]),{context:`Chat`,isActive:!o}),E(`confirm:no`,(0,K.useCallback)(()=>{e({generationPrompt:``,agentType:``,systemPrompt:``,whenToUse:``,generatedAgent:void 0,wasGenerated:!1}),a(``),l(null),t()},[e,t]),{context:`Settings`,isActive:!o});let m=async()=>{let t=i.trim();if(!t){l(`Please describe what the agent should do`);return}l(null),s(!0),e({generationPrompt:t,isGenerating:!0});let r=he();p.current=r;try{let i=await yr(t,f,[],r.signal);e({agentType:i.identifier,whenToUse:i.whenToUse,systemPrompt:i.systemPrompt,generatedAgent:i,isGenerating:!1,wasGenerated:!0}),n(6)}catch(t){t instanceof _t||t instanceof Error&&!t.message.includes(`No assistant message found`)&&l(t.message||`Failed to generate agent`),e({isGenerating:!1})}finally{s(!1),p.current=null}},h=`Describe what this agent should do and when it should be used (be comprehensive for best results)`;return o?(0,q.jsx)(V,{subtitle:h,footerText:(0,q.jsx)(_,{action:`confirm:no`,context:`Settings`,fallback:`Esc`,description:`cancel`}),children:(0,q.jsxs)(C,{flexDirection:`row`,alignItems:`center`,children:[(0,q.jsx)(v,{}),(0,q.jsx)(w,{color:`suggestion`,children:` Generating agent from description...`})]})}):(0,q.jsx)(V,{subtitle:h,footerText:(0,q.jsxs)(T,{children:[(0,q.jsx)(_,{action:`confirm:yes`,context:`Confirmation`,fallback:`Enter`,description:`submit`}),(0,q.jsx)(_,{action:`chat:externalEditor`,context:`Chat`,fallback:`ctrl+g`,description:`open in editor`}),(0,q.jsx)(_,{action:`confirm:no`,context:`Settings`,fallback:`Esc`,description:`go back`})]}),children:(0,q.jsxs)(C,{flexDirection:`column`,children:[c&&(0,q.jsx)(C,{marginBottom:1,children:(0,q.jsx)(w,{color:`error`,children:c})}),(0,q.jsx)(Se,{value:i,onChange:a,onSubmit:m,placeholder:`e.g., Help me write unit tests for my code...`,columns:80,cursorOffset:u,onChangeCursorOffset:d,focus:!0,showCursor:!0})]})})}var K,q,wr=e((()=>{ht(),K=t(D(),1),on(),O(),x(),rt(),nn(),b(),ae(),He(),U(),H(),Sr(),q=k()}));function Tr(){let{goNext:e,updateWizardData:t,cancel:n}=B();return(0,J.jsx)(V,{subtitle:`Choose location`,footerText:(0,J.jsxs)(T,{children:[(0,J.jsx)(S,{shortcut:`↑↓`,action:`navigate`}),(0,J.jsx)(S,{shortcut:`Enter`,action:`select`}),(0,J.jsx)(_,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})]}),children:(0,J.jsx)(C,{children:(0,J.jsx)(Pe,{options:[{label:`Project (.claude/agents/)`,value:`projectSettings`},{label:`Personal (~/.claude/agents/)`,value:`userSettings`}],onChange:n=>{t({location:n}),e()},onCancel:()=>n()},`location-select`)})})}var J,Er=e((()=>{O(),b(),Ke(),U(),H(),J=k()}));function Dr(){let{goNext:e,goBack:t,updateWizardData:n,wizardData:r}=B();E(`confirm:no`,t,{context:`Confirmation`});let i=r.location===`userSettings`?[{label:`User scope (~/.claude/agent-memory/) (Recommended)`,value:`user`},{label:`None (no persistent memory)`,value:`none`},{label:`Project scope (.claude/agent-memory/)`,value:`project`},{label:`Local scope (.claude/agent-memory-local/)`,value:`local`}]:[{label:`Project scope (.claude/agent-memory/) (Recommended)`,value:`project`},{label:`None (no persistent memory)`,value:`none`},{label:`User scope (~/.claude/agent-memory/)`,value:`user`},{label:`Local scope (.claude/agent-memory-local/)`,value:`local`}];return(0,Y.jsx)(V,{subtitle:`Configure agent memory`,footerText:(0,Y.jsxs)(T,{children:[(0,Y.jsx)(S,{shortcut:`↑↓`,action:`navigate`}),(0,Y.jsx)(S,{shortcut:`Enter`,action:`select`}),(0,Y.jsx)(_,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`})]}),children:(0,Y.jsx)(C,{children:(0,Y.jsx)(Pe,{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:Mt()&&i&&a?()=>r.systemPrompt+`
101
-
102
- `+h(a,i):()=>r.systemPrompt}:void 0}),e()},onCancel:t},`memory-select`)})})}var Y,Or=e((()=>{O(),x(),jt(),ce(),b(),Ke(),U(),H(),Y=k()}));function kr(){let{goNext:e,goBack:t,updateWizardData:n,goToStep:r}=B();return(0,X.jsx)(V,{subtitle:`Creation method`,footerText:(0,X.jsxs)(T,{children:[(0,X.jsx)(S,{shortcut:`↑↓`,action:`navigate`}),(0,X.jsx)(S,{shortcut:`Enter`,action:`select`}),(0,X.jsx)(_,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`})]}),children:(0,X.jsx)(C,{children:(0,X.jsx)(Pe,{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 X,Ar=e((()=>{O(),b(),Ke(),U(),H(),X=k()}));function jr(){let{goNext:e,goBack:t,updateWizardData:n,wizardData:r}=B();return(0,Mr.jsx)(V,{subtitle:`Select model`,footerText:(0,Mr.jsxs)(T,{children:[(0,Mr.jsx)(S,{shortcut:`↑↓`,action:`navigate`}),(0,Mr.jsx)(S,{shortcut:`Enter`,action:`select`}),(0,Mr.jsx)(_,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`})]}),children:(0,Mr.jsx)(An,{initialModel:r.selectedModel,onComplete:t=>{n({selectedModel:t}),e()},onCancel:t})})}var Mr,Nr=e((()=>{b(),O(),U(),H(),Nn(),Mr=k()}));function Pr(){let{goNext:e,goBack:t,updateWizardData:n,wizardData:r}=B(),[i,a]=(0,Fr.useState)(r.systemPrompt||``),[o,s]=(0,Fr.useState)(i.length),[c,l]=(0,Fr.useState)(null);return E(`confirm:no`,t,{context:`Settings`}),E(`chat:externalEditor`,(0,Fr.useCallback)(async()=>{let e=await tn(i);e.content!==null&&(a(e.content),s(e.content.length))},[i]),{context:`Chat`}),(0,Z.jsx)(V,{subtitle:`System prompt`,footerText:(0,Z.jsxs)(T,{children:[(0,Z.jsx)(S,{shortcut:`Type`,action:`enter text`}),(0,Z.jsx)(S,{shortcut:`Enter`,action:`continue`}),(0,Z.jsx)(_,{action:`chat:externalEditor`,context:`Chat`,fallback:`ctrl+g`,description:`open in editor`}),(0,Z.jsx)(_,{action:`confirm:no`,context:`Settings`,fallback:`Esc`,description:`go back`})]}),children:(0,Z.jsxs)(C,{flexDirection:`column`,children:[(0,Z.jsx)(w,{children:`Enter the system prompt for your agent:`}),(0,Z.jsx)(w,{dimColor:!0,children:`Be comprehensive for best results`}),(0,Z.jsx)(C,{marginTop:1,children:(0,Z.jsx)(Se,{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)(C,{marginTop:1,children:(0,Z.jsx)(w,{color:`error`,children:c})})]})})}var Fr,Z,Ir=e((()=>{Fr=t(D(),1),O(),x(),nn(),b(),He(),U(),H(),Z=k()}));function Lr({tools:e}){let{goNext:t,goBack:n,updateWizardData:r,wizardData:i}=B(),a=e=>{r({selectedTools:e}),t()},o=i.selectedTools;return(0,Rr.jsx)(V,{subtitle:`Select tools`,footerText:(0,Rr.jsxs)(T,{children:[(0,Rr.jsx)(S,{shortcut:`Enter`,action:`toggle selection`}),(0,Rr.jsx)(S,{shortcut:`↑↓`,action:`navigate`}),(0,Rr.jsx)(_,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`})]}),children:(0,Rr.jsx)(In,{tools:e,initialTools:o,onComplete:a,onCancel:n})})}var Rr,zr=e((()=>{O(),b(),U(),H(),Ln(),Rr=k()}));function Br(e){let{goNext:t,goBack:n,updateWizardData:r,wizardData:i}=B(),[a,o]=(0,Vr.useState)(i.agentType||``),[s,c]=(0,Vr.useState)(null),[l,u]=(0,Vr.useState)(a.length);return E(`confirm:no`,n,{context:`Settings`}),(0,Q.jsx)(V,{subtitle:`Agent type (identifier)`,footerText:(0,Q.jsxs)(T,{children:[(0,Q.jsx)(S,{shortcut:`Type`,action:`enter text`}),(0,Q.jsx)(S,{shortcut:`Enter`,action:`continue`}),(0,Q.jsx)(_,{action:`confirm:no`,context:`Settings`,fallback:`Esc`,description:`go back`})]}),children:(0,Q.jsxs)(C,{flexDirection:`column`,children:[(0,Q.jsx)(w,{children:`Enter a unique identifier for your agent:`}),(0,Q.jsx)(C,{marginTop:1,children:(0,Q.jsx)(Se,{value:a,onChange:o,onSubmit:e=>{let n=e.trim(),i=sr(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)(C,{marginTop:1,children:(0,Q.jsx)(w,{color:`error`,children:s})})]})})}var Vr,Q,Hr=e((()=>{Vr=t(D(),1),O(),x(),b(),He(),U(),H(),lr(),Q=k()}));function Ur({tools:e,existingAgents:t,onComplete:n,onCancel:r}){return(0,Wr.jsx)(Jn,{steps:[Tr,kr,Cr,()=>(0,Wr.jsx)(Br,{existingAgents:t}),Pr,gr,()=>(0,Wr.jsx)(Lr,{tools:e}),jr,ir,...Mt()?[Dr]:[],()=>(0,Wr.jsx)(fr,{tools:e,existingAgents:t,onComplete:n})],initialData:{},onComplete:()=>{},onCancel:r,title:`Create new agent`,showStepCounter:!1})}var Wr,Gr=e((()=>{jt(),U(),or(),hr(),vr(),wr(),Er(),Or(),Ar(),Nr(),Ir(),zr(),Hr(),Wr=k()}));function Kr({tools:e,onExit:t}){let[n,r]=(0,qr.useState)({mode:`list-agents`,source:`all`}),i=it(e=>e.agentDefinitions),a=it(e=>e.mcp.tools),o=it(e=>e.toolPermissionContext),s=m(),{allAgents:c,activeAgents:l}=i,[u,d]=(0,qr.useState)([]),f=$t(e,a,o);Zt();let p=(0,qr.useMemo)(()=>({"built-in":c.filter(e=>e.source===`built-in`),userSettings:c.filter(e=>e.source===`userSettings`),projectSettings:c.filter(e=>e.source===`projectSettings`),policySettings:c.filter(e=>e.source===`policySettings`),localSettings:c.filter(e=>e.source===`localSettings`),flagSettings:c.filter(e=>e.source===`flagSettings`),plugin:c.filter(e=>e.source===`plugin`),all:c}),[c]),h=(0,qr.useCallback)(e=>{d(t=>[...t,e]),r({mode:`list-agents`,source:`all`})},[]),g=(0,qr.useCallback)(async e=>{try{await xn(e),s(t=>{let n=t.agentDefinitions.allAgents.filter(t=>!(t.agentType===e.agentType&&t.source===e.source));return{...t,agentDefinitions:{...t.agentDefinitions,allAgents:n,activeAgents:Ge(n)}}}),d(t=>[...t,`Deleted agent: ${ut.bold(e.agentType)}`]),r({mode:`list-agents`,source:`all`})}catch(e){Pt(yt(e))}},[s]);switch(n.mode){case`list-agents`:{let e=Jt(n.source===`all`?[...p[`built-in`],...p.userSettings,...p.projectSettings,...p.localSettings,...p.policySettings,...p.flagSettings,...p.plugin]:p[n.source],l);return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Gn,{source:n.source,agents:e,onBack:()=>{t((u.length>0?`Agent changes:\n${u.join(`
103
- `)}`:void 0)??`Agents dialog dismissed`,{display:u.length===0?`system`:void 0})},onSelect:e=>r({mode:`agent-menu`,agent:e,previousMode:n}),onCreateNew:()=>r({mode:`create-agent`}),changes:u}),(0,$.jsx)(Hn,{})]})}case`create-agent`:return(0,$.jsx)(Ur,{tools:f,existingAgents:l,onComplete:h,onCancel:()=>r({mode:`list-agents`,source:`all`})});case`agent-menu`:{let e=c.find(e=>e.agentType===n.agent.agentType&&e.source===n.agent.source)||n.agent,t=[{label:`View agent`,value:`view`},...e.source!==`built-in`&&e.source!==`plugin`&&e.source!==`flagSettings`?[{label:`Edit agent`,value:`edit`},{label:`Delete agent`,value:`delete`}]:[],{label:`Back`,value:`back`}];return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(dt,{title:n.agent.agentType,onCancel:()=>r(n.previousMode),hideInputGuide:!0,children:(0,$.jsxs)(C,{flexDirection:`column`,children:[(0,$.jsx)(Pe,{options:t,onChange:t=>{switch(t){case`view`:r({mode:`view-agent`,agent:e,previousMode:n.previousMode});break;case`edit`:r({mode:`edit-agent`,agent:e,previousMode:n});break;case`delete`:r({mode:`delete-confirm`,agent:e,previousMode:n});break;case`back`:r(n.previousMode);break}},onCancel:()=>r(n.previousMode)}),u.length>0&&(0,$.jsx)(C,{marginTop:1,children:(0,$.jsx)(w,{dimColor:!0,children:u[u.length-1]})})]})}),(0,$.jsx)(Hn,{})]})}case`view-agent`:{let e=c.find(e=>e.agentType===n.agent.agentType&&e.source===n.agent.source)||n.agent;return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(dt,{title:e.agentType,onCancel:()=>r({mode:`agent-menu`,agent:e,previousMode:n.previousMode}),hideInputGuide:!0,children:(0,$.jsx)(wn,{agent:e,tools:f,allAgents:c,onBack:()=>r({mode:`agent-menu`,agent:e,previousMode:n.previousMode})})}),(0,$.jsx)(Hn,{instructions:`Press Enter or Esc to go back`})]})}case`delete-confirm`:return(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(dt,{title:`Delete agent`,onCancel:()=>{`previousMode`in n&&r(n.previousMode)},color:`error`,children:[(0,$.jsxs)(w,{children:[`Are you sure you want to delete the agent `,(0,$.jsx)(w,{bold:!0,children:n.agent.agentType}),`?`]}),(0,$.jsx)(C,{marginTop:1,children:(0,$.jsxs)(w,{dimColor:!0,children:[`Source: `,n.agent.source]})}),(0,$.jsx)(C,{marginTop:1,children:(0,$.jsx)(Pe,{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)(Hn,{instructions:`Press ↑↓ to navigate, Enter to select, Esc to cancel`})]});case`edit-agent`:{let e=c.find(e=>e.agentType===n.agent.agentType&&e.source===n.agent.source)||n.agent;return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(dt,{title:`Edit agent: ${e.agentType}`,onCancel:()=>r(n.previousMode),hideInputGuide:!0,children:(0,$.jsx)(Bn,{agent:e,tools:f,onSaved:e=>{h(e),r(n.previousMode)},onBack:()=>r(n.previousMode)})}),(0,$.jsx)(Hn,{})]})}default:return null}}var qr,$,Jr=e((()=>{lt(),D(),qr=t(D(),1),Qt(),en(),O(),d(),Kt(),ze(),bt(),Nt(),Ke(),Tn(),Vn(),Wn(),qn(),Cn(),Gr(),$=k()}));async function Yr(e,t){let n=t.getAppState().toolPermissionContext;return(0,Xr.jsx)(Kr,{tools:Fe(n),onExit:e})}var Xr;e((()=>{D(),Jr(),qe(),Xr=k()}))();export{Yr as call};
@@ -1 +0,0 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{fS as t,mS as n}from"./loadAgentsDir-C7lOqvfh.js";import{g as r,u as i}from"./settings-DnptdP79.js";function a(){let e=i(),n=[`user`,`project`,`local`].flatMap(e=>t(e).errors);return{settings:e.settings,errors:[...e.errors,...n]}}var o=e((()=>{n(),r()}));export{o as n,a as t};
@@ -1 +0,0 @@
1
- import{a as e,o as t}from"./api-nSHc_GIQ.js";t();export{e as getOAuthHeaders};
@@ -1 +0,0 @@
1
- import{Bt as e,It as t,Ot as n,mt as r,yt as i}from"./model-BsZ4sP_H.js";e();export{r as checkAndRefreshOAuthTokenIfNeeded,i as clearOAuthTokenCache,n as getClaudeAIOAuthTokens,t as handleOAuth401Error};
@@ -1 +0,0 @@
1
- import{n as e,t}from"./auth-5QB6tsfB.js";export{t as authLogin,e as authStatus};
@@ -1 +0,0 @@
1
- import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{Km as n,ld as r,od as i,qm as a}from"./loadAgentsDir-C7lOqvfh.js";import{I as o,P as s,fi as c,hn as l,t as u,y as d}from"./src-P_wYS_NJ2.js";import{t as f}from"./jsx-runtime-Bb4Xn-E0.js";import{c as p,l as m,m as h,p as g}from"./autonomy-Src6sKCp.js";function _(){return S}function v({onDone:e}){r(`autonomy-panel`);let[t,n]=(0,b.useState)(0),[i,c]=(0,b.useState)([]);(0,b.useEffect)(()=>{let e=!1;return a().then(t=>{e||c(t.slice(0,5))}),()=>{e=!0}},[]);let u=(0,b.useMemo)(()=>{let e=[{label:`Overview`,description:`Show run and flow counts plus the latest automatic activity`,run:()=>g()},{label:`Full deep status`,description:`Print every local autonomy surface in one diagnostic report`,run:()=>g({deep:!0})},{label:`Auto mode`,description:`Check whether auto permission mode is available and why`,run:()=>m(`auto-mode`)},{label:`Runs summary`,description:`Show queued/running/completed/failed run totals and latest run`,run:()=>m(`runs`)},{label:`Recent runs`,description:`List recent autonomy run IDs, triggers, statuses, and prompts`,run:()=>p(`runs 10`)},{label:`Flows summary`,description:`Show managed flow totals across queued/running/waiting states`,run:()=>m(`flows`)},{label:`Recent flows`,description:`List recent managed flow IDs, status, current step, and goal`,run:()=>p(`flows 10`)},{label:`Workflow runs`,description:`Show persisted WorkflowTool runs and their current workflow step`,run:()=>m(`workflow-runs`)},{label:`Pipes`,description:`Show UDS/named-pipe and LAN registry for terminal messaging`,run:()=>m(`pipes`)},{label:`Runtime`,description:`Show daemon state and live background or interactive sessions`,run:()=>m(`runtime`)},{label:`Remote Control`,description:`Show bridge mode, base URL, token presence, and entitlement note`,run:()=>m(`remote-control`)},{label:`RemoteTrigger`,description:`Show recent remote trigger audit records, failures, and latest call`,run:()=>m(`remote-trigger`)}],t=i.flatMap(e=>{let t=e.flowId.slice(0,8),n=[{label:`Flow ${t}`,description:`${e.status}: ${e.goal}`,run:()=>p(`flow ${e.flowId}`)}];return e.status===`waiting`&&n.push({label:`Resume ${t}`,description:e.currentStep?`Resume waiting step: ${e.currentStep}`:`Resume waiting flow`,run:()=>p(`flow resume ${e.flowId}`,{enqueueInMemory:!0})}),(e.status===`queued`||e.status===`running`||e.status===`waiting`||e.status===`blocked`)&&n.push({label:`Cancel ${t}`,description:`Cancel ${e.status} flow`,run:()=>p(`flow cancel ${e.flowId}`,{removeQueuedInMemory:!0})}),n});return[...e,...t]},[i]),f=()=>{let n=u[t];n&&n.run().then(t=>{e(t,{display:`system`})})};return l((e,t)=>{if(t.upArrow){n(e=>Math.max(0,e-1));return}if(t.downArrow){n(e=>Math.min(u.length-1,e+1));return}t.return&&f()}),(0,x.jsx)(d,{title:`Autonomy`,subtitle:`${u.length} actions`,onCancel:()=>e(`Autonomy panel dismissed`,{display:`system`}),color:`background`,hideInputGuide:!0,children:(0,x.jsxs)(o,{flexDirection:`column`,children:[u.map((e,n)=>(0,x.jsxs)(o,{flexDirection:`row`,children:[(0,x.jsx)(s,{children:`${n===t?`›`:` `} ${e.label}`.padEnd(C)}),(0,x.jsx)(s,{dimColor:!0,children:e.description})]},`${e.label}-${n}`)),(0,x.jsx)(o,{marginTop:1,children:(0,x.jsx)(s,{dimColor:!0,children:`↑/↓ select · Enter run · Esc close`})})]})})}async function y(e,t,n){let r=n?.trim()??``;return r?(e(await p(r,{enqueueInMemory:!0,removeQueuedInMemory:!0}),{display:`system`}),null):(0,x.jsx)(v,{onDone:e})}var b,x,S,C;e((()=>{b=t(c(),1),u(),i(),h(),n(),x=f(),S=14,C=24}))();export{y as call,_ as getAutonomyPanelBaseActionCountForTests};
@@ -1,17 +0,0 @@
1
- import{a as e}from"./rolldown-runtime-DaDcL9Zw.js";import{n as t,o as n}from"./envUtils-BDhHQY0-.js";import{$ as r,Ba as i,Cr as a,Da as o,Nc as s,Oa as ee,Pc as c,Ta as te,Tt as l,Ud as u,Wd as ne,_x as re,aw as d,bm as f,fr as p,lp as m,mt as h,rw as g,sp as ie,tt as ae,vx as oe,yv as _}from"./loadAgentsDir-C7lOqvfh.js";import{R as v,W as y,Wt as b}from"./state-BemZdQIl.js";import{n as x,t as S}from"./cwd-Cfdf7z7s.js";import{S as C,W as w,a as T,d as E,l as D,p as O,z as k}from"./debug-RAynG_nM.js";import{f as A,g as j,y as M}from"./settings-DnptdP79.js";import{S as N}from"./config-Do1870_d.js";import{o as P,s as F,v as I,y as L}from"./log-CezCRpAN.js";import{n as R,r as z}from"./analytics-DJobLaWP.js";import{_ as B,h as V}from"./model-BsZ4sP_H.js";import{bn as H,yn as U}from"./prompt-M2lu8_Oa.js";import{at as W}from"./sessionState-Bifmu95-.js";import{i as se,t as G}from"./nativeInstaller-QB8cEJ18.js";import{n as K,t as ce}from"./allErrors-CU89tF-z.js";import{r as le}from"./magicDocs-BpVcON9o.js";import{n as ue,t as de}from"./pluginAutoupdate-SlRFJlTT.js";import{n as fe,r as pe}from"./registerProtocol-CsNYRZKr.js";import"os";import{join as q}from"path";import"crypto";n(),b(),x(),C(),O(),T(),L(),j(),H(),B(),c(),a(),le(),r(),P(),k(),i(),_(),r(),oe(),k(),P(),i(),_(),f();async function me(e,t){if(!e)return;let{join:n}=await import(`path`),r=await import(`fs/promises`),i=n(S(),`.claude`,`skills`,e,`SKILL.md`),a;try{a=await r.readFile(i,`utf-8`)}catch{F(Error(`Failed to read skill file for improvement: ${i}`));return}let s=t.map(e=>`- ${e.section}: ${e.change}`).join(`
2
- `),c=V(),l=await ae({messages:[te({content:`You are editing a skill definition file. Apply the following improvements to the skill.
3
-
4
- <current_skill_file>
5
- ${a}
6
- </current_skill_file>
7
-
8
- <improvements>
9
- ${s}
10
- </improvements>
11
-
12
- Rules:
13
- - Integrate the improvements naturally into the existing structure
14
- - Preserve frontmatter (--- block) exactly as-is
15
- - Preserve the overall format and style
16
- - Do not remove existing content unless an improvement explicitly replaces it
17
- - Output the complete updated file inside <updated_file> tags`})],systemPrompt:W([`You edit skill definition files to incorporate user preferences. Output only the updated file content.`]),thinkingConfig:{type:`disabled`},tools:[],signal:re().signal,options:{getToolPermissionContext:async()=>U(),model:c,toolChoice:void 0,isNonInteractiveSession:!1,hasAppendSystemPrompt:!1,temperatureOverride:0,agents:[],querySource:`skill_improvement_apply`,mcpTools:[]}}),u=o(ee(Array.isArray(l.message.content)?l.message.content:[]).trim(),`updated_file`);if(!u){F(Error(`Skill improvement apply: no updated_file tag in response`));return}try{await r.writeFile(i,u,`utf-8`)}catch(e){F(w(e))}}R(),m(),N(),P(),G(),ne(),K(),d(),l();var he=30;function J(){let e=((A()||{}).cleanupPeriodDays??he)*24*60*60*1e3;return new Date(Date.now()-e)}function ge(e,t){return{messages:e.messages+t.messages,errors:e.errors+t.errors}}function _e(e){let t=e.split(`.`)[0].replace(/T(\d{2})-(\d{2})-(\d{2})-(\d{3})Z/,`T$1:$2:$3.$4Z`);return new Date(t)}async function Y(e,t,n){let r={messages:0,errors:0};try{let i=await E().readdir(e);for(let a of i)try{_e(a.name)<t&&(await E().unlink(q(e,a.name)),n?r.messages++:r.errors++)}catch(e){F(e)}}catch(e){e instanceof Error&&`code`in e&&e.code!==`ENOENT`&&F(e)}return r}async function ve(){let e=E(),t=J(),n=I.errors(),r=I.baseLogs(),i=await Y(n,t,!1);try{let n;try{n=await e.readdir(r)}catch{return i}let a=n.filter(e=>e.isDirectory()&&e.name.startsWith(`mcp-logs-`)).map(e=>q(r,e.name));for(let n of a)i=ge(i,await Y(n,t,!0)),await Z(n,e)}catch(e){e instanceof Error&&`code`in e&&e.code!==`ENOENT`&&F(e)}return i}async function X(e,t,n){return(await n.stat(e)).mtime<t?(await n.unlink(e),!0):!1}async function Z(e,t){try{await t.rmdir(e)}catch{}}async function ye(){let e=J(),t={messages:0,errors:0},n=p(),r=E(),i;try{i=await r.readdir(n)}catch{return t}for(let a of i){if(!a.isDirectory())continue;let i=q(n,a.name),o;try{o=await r.readdir(i)}catch{t.errors++;continue}for(let n of o)if(n.isFile()){if(!n.name.endsWith(`.jsonl`)&&!n.name.endsWith(`.cast`))continue;try{await X(q(i,n.name),e,r)&&t.messages++}catch{t.errors++}}else if(n.isDirectory()){let a=q(i,n.name),o=q(a,g),s;try{s=await r.readdir(o)}catch{await Z(a,r);continue}for(let n of s)if(n.isFile())try{await X(q(o,n.name),e,r)&&t.messages++}catch{t.errors++}else if(n.isDirectory()){let i=q(o,n.name),a;try{a=await r.readdir(i)}catch{continue}for(let n of a)if(n.isFile())try{await X(q(i,n.name),e,r)&&t.messages++}catch{t.errors++}await Z(i,r)}await Z(o,r),await Z(a,r)}await Z(i,r)}return t}async function be(e,t,n=!0){let r=J(),i={messages:0,errors:0},a=E(),o;try{o=await a.readdir(e)}catch{return i}for(let n of o)if(!(!n.isFile()||!n.name.endsWith(t)))try{await X(q(e,n.name),r,a)&&i.messages++}catch{i.errors++}return n&&await Z(e,a),i}function xe(){return be(q(t(),`plans`),`.md`)}async function Se(){let e=J(),n={messages:0,errors:0},r=E();try{let i=q(t(),`file-history`),a;try{a=await r.readdir(i)}catch{return n}let o=a.filter(e=>e.isDirectory()).map(e=>q(i,e.name));await Promise.all(o.map(async t=>{try{(await r.stat(t)).mtime<e&&(await r.rm(t,{recursive:!0,force:!0}),n.messages++)}catch{n.errors++}})),await Z(i,r)}catch(e){F(e)}return n}async function Ce(){let e=J(),n={messages:0,errors:0},r=E();try{let i=q(t(),`session-env`),a;try{a=await r.readdir(i)}catch{return n}let o=a.filter(e=>e.isDirectory()).map(e=>q(i,e.name));for(let t of o)try{(await r.stat(t)).mtime<e&&(await r.rm(t,{recursive:!0,force:!0}),n.messages++)}catch{n.errors++}await Z(i,r)}catch(e){F(e)}return n}async function we(){let e=J(),n={messages:0,errors:0},r=E(),i=q(t(),`debug`),a;try{a=await r.readdir(i)}catch{return n}for(let t of a)if(!(!t.isFile()||!t.name.endsWith(`.txt`)||t.name===`latest`))try{await X(q(i,t.name),e,r)&&n.messages++}catch{n.errors++}return n}async function Q(){let{errors:e}=ce();if(e.length>0&&M(`cleanupPeriodDays`)){D(`Skipping cleanup: settings have validation errors but cleanupPeriodDays was explicitly set. Fix settings errors to enable cleanup.`);return}await ve(),await ye(),await xe(),await Se(),await Ce(),await we(),await ie(),await u(J());let t=await h(J());t>0&&z(`tengu_worktree_cleanup`,{removed:t})}b(),G(),ue();var Te=(fe(),e(pe)),$=600*1e3;function Ee(){import(`./extractMemories-CUrdiNcr.js`).then(({initExtractMemories:e})=>{e()}).catch(()=>{}),s(),de(),v()&&Te.ensureDeepLinkProtocolRegistered();let e=!0;async function t(){if(v()&&y()>Date.now()-1e3*60){setTimeout(t,$).unref();return}if(e&&(e=!1,await Q()),v()&&y()>Date.now()-1e3*60){setTimeout(t,$).unref();return}await se()}setTimeout(t,$).unref()}export{me as n,Ee as t};
@@ -1 +0,0 @@
1
- import{t as e}from"./backgroundHousekeeping-B-cw0UcS.js";export{e as startBackgroundHousekeeping};
@@ -1 +0,0 @@
1
- import{a as e,c as t,i as n,r,s as i,t as a}from"./bg-DAPORXF3.js";n();export{a as attachHandler,r as handleBgStart,e as killHandler,i as logsHandler,t as psHandler};
@@ -1 +0,0 @@
1
- import{a as e,n as t,o as n,t as r}from"./bridgeConfig-Bb6URf4Q.js";e();export{r as getBridgeAccessToken,t as getBridgeBaseUrl,n as isSelfHostedBridge};
@@ -1 +0,0 @@
1
- import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{$C as n,Ba as r,Cv as i,Hu as a,Ma as o,Np as s,Sv as c,Vu as l,_x as u,ct as d,jp as f,lt as p,mc as m,pc as h,vx as g,xv as _,yv as v}from"./loadAgentsDir-C7lOqvfh.js";import{I as y,P as b,bn as x,fi as S,ot as C,t as w,vn as T,xt as E}from"./src-P_wYS_NJ2.js";import{t as D}from"./jsx-runtime-Bb4Xn-E0.js";import{F as O,z as k}from"./debug-RAynG_nM.js";import{Ut as A}from"./settings-DnptdP79.js";import{h as j,y as M}from"./config-Do1870_d.js";import{at as N}from"./sessionState-Bifmu95-.js";import{n as P,r as F}from"./sideQuestion-D0OKljee.js";import{i as I,n as L}from"./modalContext-CUThy6Ph.js";function R({question:e,context:t,onDone:n}){let[r,i]=(0,H.useState)(null),[a,o]=(0,H.useState)(null),[s,c]=(0,H.useState)(0),d=(0,H.useRef)(null),{rows:p}=I(C());x(()=>c(e=>e+1),r||a?null:80);function m(e){if(e.key===`escape`||e.key===`return`||e.key===` `||e.ctrl&&(e.key===`c`||e.key===`d`)){e.preventDefault(),n(void 0,{display:`skip`});return}(e.key===`up`||e.ctrl&&e.key===`p`)&&(e.preventDefault(),d.current?.scrollBy(-3)),(e.key===`down`||e.ctrl&&e.key===`n`)&&(e.preventDefault(),d.current?.scrollBy(K))}(0,H.useEffect)(()=>{let n=u();async function r(){try{let r=await F({question:e,cacheSafeParams:await B(t)});n.signal.aborted||(r.response?i(r.response):o(`No response received`))}catch(e){n.signal.aborted||o(O(e)||`Failed to get response`)}}return r(),()=>{n.abort()}},[e,t]);let h=Math.max(5,p-W-G);return(0,U.jsxs)(y,{flexDirection:`column`,paddingLeft:2,marginTop:1,tabIndex:0,autoFocus:!0,onKeyDown:m,children:[(0,U.jsxs)(y,{children:[(0,U.jsxs)(b,{color:`warning`,bold:!0,children:[`/btw`,` `]}),(0,U.jsx)(b,{dimColor:!0,children:e})]}),(0,U.jsx)(y,{marginTop:1,marginLeft:2,maxHeight:h,children:(0,U.jsx)(E,{ref:d,flexDirection:`column`,flexGrow:1,children:a?(0,U.jsx)(b,{color:`error`,children:a}):r?(0,U.jsx)(f,{children:r}):(0,U.jsxs)(y,{children:[(0,U.jsx)(l,{frame:s,messageColor:`warning`}),(0,U.jsx)(b,{color:`warning`,children:`Answering...`})]})})}),(r||a)&&(0,U.jsx)(y,{marginTop:1,children:(0,U.jsxs)(b,{dimColor:!0,children:[`↑`,`/`,`↓`,` to scroll · Space, Enter, or Escape to dismiss`]})})]})}function z(e){let t=e.at(-1);return t?.type===`assistant`&&t.message.stop_reason===null?e.slice(0,-1):e}async function B(e){let t=o(z(e.messages)),n=h();if(n)return{systemPrompt:n.systemPrompt,userContext:n.userContext,systemContext:n.systemContext,toolUseContext:e,forkContextMessages:t};let[r,i,a]=await Promise.all([d(e.options.tools,e.options.mainLoopModel,[],e.options.mcpClients),c(),_()]);return{systemPrompt:N(r),userContext:i,systemContext:a,toolUseContext:e,forkContextMessages:t}}async function V(e,t,n){let r=n?.trim();return r?(M(e=>({...e,btwUseCount:e.btwUseCount+1})),(0,U.jsx)(R,{question:r,context:t,onDone:e})):(e(`Usage: /btw <your question>`,{display:`system`}),null)}var H,U,W,G,K;e((()=>{S(),H=t(S(),1),T(),s(),a(),A(),p(),L(),i(),n(),w(),g(),j(),k(),m(),r(),P(),v(),U=D(),W=5,G=6,K=3}))();export{V as call};
@@ -1 +0,0 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{$i as t,Ai as n,Au as r,Bi as i,Cv as a,Ev as o,J as s,Jv as c,Kh as l,Ms as u,Ns as d,Sv as f,Tb as p,Tv as m,X as h,Xv as g,Yi as _,bv as v,cp as y,hm as b,hw as x,ih as S,ju as C,lp as w,mw as T,oh as E,qh as D,wb as O,wv as k,xv as A}from"./loadAgentsDir-C7lOqvfh.js";import{On as j,Wt as M,l as N}from"./state-BemZdQIl.js";import{S as P,v as F}from"./git-2c7WlGDL.js";import{i as I,t as L}from"./detectRepository-DgpNd87p.js";import{a as R,n as z}from"./fileSuggestions-BMfQIDdW.js";import{r as B,t as V}from"./magicDocs-BpVcON9o.js";function H(e=new Set){let t=e.size>0;f.cache.clear?.(),A.cache.clear?.(),v.cache.clear?.(),m.cache.clear?.(),z(),n(),t||g(),k(null),j(null),E(),d(),p(`session_start`),y(),r(),import(`./attributionHooks-CUAoGkU6.js`).then(({clearAttributionCaches:e})=>e()),L(),s(),N(e),F(),_(),D(),V(),T(),import(`./SearchExtraToolsTool-i_YO3QvV.js`).then(({clearSearchExtraToolsDescriptionCache:e})=>e()),import(`./loadAgentsDir-zikjxLvn.js`).then(({clearAgentDefinitionsCache:e})=>e()),import(`./prompt-DZhBz_Vu.js`).then(({clearPromptCache:e})=>e())}var U=e((()=>{M(),i(),o(),a(),R(),b(),c(),C(),S(),l(),B(),t(),u(),h(),O(),I(),P(),w(),x()}));export{U as n,H as t};
@@ -1 +0,0 @@
1
- import{n as e,t}from"./caches-BTQAW9zc.js";e();export{t as clearSessionCaches};
@@ -1 +0,0 @@
1
- import{n as e,t}from"./defineProperty-C-QyHrDq.js";import{F as n,I as r,S as i,a,l as o,w as s,z as c}from"./debug-RAynG_nM.js";import{O as l,k as u}from"./git-2c7WlGDL.js";import{_n as d,vn as f}from"./model-BsZ4sP_H.js";import{l as p,r as m}from"./proxy-CuMaO_YV.js";import{n as h,t as g}from"./userAgent-CIq27vUR.js";import{A as _,O as v,f as y,g as b,k as x,u as S}from"./sessionState-Bifmu95-.js";import{n as C}from"./jwtUtils-CUPXdX3W.js";import{randomUUID as w}from"crypto";c(),a(),l(),p(),h(),d(),_(),S(),i(),e();var T=class extends Error{constructor(e,n){super(e),t(this,`retryAfterMs`,void 0),this.retryAfterMs=n}},E=class{constructor(e){t(this,`pending`,[]),t(this,`pendingAtClose`,0),t(this,`draining`,!1),t(this,`closed`,!1),t(this,`backpressureResolvers`,[]),t(this,`sleepResolve`,null),t(this,`flushResolvers`,[]),t(this,`droppedBatches`,0),t(this,`config`,void 0),this.config=e}get droppedBatchCount(){return this.droppedBatches}get pendingCount(){return this.closed?this.pendingAtClose:this.pending.length}async enqueue(e){if(this.closed)return;let t=Array.isArray(e)?e:[e];if(t.length!==0){for(;this.pending.length+t.length>this.config.maxQueueSize&&!this.closed;)await new Promise(e=>{this.backpressureResolvers.push(e)});this.closed||(this.pending.push(...t),this.drain())}}flush(){return this.pending.length===0&&!this.draining?Promise.resolve():(this.drain(),new Promise(e=>{this.flushResolvers.push(e)}))}close(){if(!this.closed){this.closed=!0,this.pendingAtClose=this.pending.length,this.pending=[],this.sleepResolve?.(),this.sleepResolve=null;for(let e of this.backpressureResolvers)e();this.backpressureResolvers=[];for(let e of this.flushResolvers)e();this.flushResolvers=[]}}async drain(){if(this.draining||this.closed)return;this.draining=!0;let e=0;try{for(;this.pending.length>0&&!this.closed;){let t=this.takeBatch();if(t.length!==0){try{await this.config.send(t),e=0}catch(n){if(e++,this.config.maxConsecutiveFailures!==void 0&&e>=this.config.maxConsecutiveFailures){this.droppedBatches++,this.config.onBatchDropped?.(t.length,e),e=0,this.releaseBackpressure();continue}this.pending=t.concat(this.pending);let r=n instanceof T?n.retryAfterMs:void 0;await this.sleep(this.retryDelay(e,r));continue}this.releaseBackpressure()}}}finally{if(this.draining=!1,this.pending.length===0){for(let e of this.flushResolvers)e();this.flushResolvers=[]}}}takeBatch(){let{maxBatchSize:e,maxBatchBytes:t}=this.config;if(t===void 0)return this.pending.splice(0,e);let n=0,r=0;for(;r<this.pending.length&&r<e;){let e;try{e=Buffer.byteLength(s(this.pending[r]))}catch{this.pending.splice(r,1);continue}if(r>0&&n+e>t)break;n+=e,r++}return this.pending.splice(0,r)}retryDelay(e,t){let n=Math.random()*this.config.jitterMs;return t===void 0?Math.min(this.config.baseDelayMs*2**(e-1),this.config.maxDelayMs)+n:Math.max(this.config.baseDelayMs,Math.min(t,this.config.maxDelayMs))+n}releaseBackpressure(){let e=this.backpressureResolvers;this.backpressureResolvers=[];for(let t of e)t()}sleep(e){return new Promise(t=>{this.sleepResolve=t,setTimeout((e,t)=>{e.sleepResolve=null,t()},e,this,t)})}};e();var D=class{constructor(e){t(this,`inflight`,null),t(this,`pending`,null),t(this,`closed`,!1),t(this,`config`,void 0),this.config=e}enqueue(e){this.closed||(this.pending=this.pending?O(this.pending,e):e,this.drain())}close(){this.closed=!0,this.pending=null}async drain(){if(this.inflight||this.closed||!this.pending)return;let e=this.pending;this.pending=null,this.inflight=this.sendWithRetry(e).then(()=>{this.inflight=null,this.pending&&!this.closed&&this.drain()})}async sendWithRetry(e){let t=e,n=0;for(;!this.closed;){if(await this.config.send(t))return;n++,await f(this.retryDelay(n)),this.pending&&!this.closed&&(t=O(t,this.pending),this.pending=null)}}retryDelay(e){return Math.min(this.config.baseDelayMs*2**(e-1),this.config.maxDelayMs)+Math.random()*this.config.jitterMs}};function O(e,t){let n={...e};for(let[e,r]of Object.entries(t))(e===`external_metadata`||e===`internal_metadata`)&&n[e]&&typeof n[e]==`object`&&typeof r==`object`&&r?n[e]={...n[e],...r}:n[e]=r;return n}d(),e();var k=2e4,A=100;function j(){return!0}var M=class extends Error{constructor(e){super(`CCRClient init failed: ${e}`),t(this,`reason`,void 0),this.reason=e}},N=10;function P(){return{byMessage:new Map,scopeToMessage:new Map}}function F(e){return`${e.session_id}:${e.parent_tool_use_id??``}`}function I(e,t){let n=[],r=new Map;for(let i of e){let e=i.event;switch(e.type){case`message_start`:{let r=e.message.id,a=t.scopeToMessage.get(F(i));a&&t.byMessage.delete(a),t.scopeToMessage.set(F(i),r),t.byMessage.set(r,[]),n.push(i);break}case`content_block_delta`:{let a=e.delta;if(a.type!==`text_delta`){n.push(i);break}let o=t.scopeToMessage.get(F(i)),s=o?t.byMessage.get(o):void 0;if(!s){n.push(i);break}let c=e.index,l=s[c]??(s[c]=[]);l.push(a.text);let u=r.get(l);if(u){u.event.delta={type:`text_delta`,text:l.join(``)};break}let d={type:`stream_event`,uuid:i.uuid,session_id:i.session_id,parent_tool_use_id:i.parent_tool_use_id,event:{type:`content_block_delta`,index:c,delta:{type:`text_delta`,text:l.join(``)}}};r.set(l,d),n.push(d);break}default:n.push(i)}}return n}function L(e,t){e.byMessage.delete(t.message.id);let n=F(t);e.scopeToMessage.get(n)===t.message.id&&e.scopeToMessage.delete(n)}var R=class{constructor(e,n,r){if(t(this,`workerEpoch`,0),t(this,`heartbeatIntervalMs`,void 0),t(this,`heartbeatJitterFraction`,void 0),t(this,`heartbeatTimer`,null),t(this,`heartbeatInFlight`,!1),t(this,`closed`,!1),t(this,`consecutiveAuthFailures`,0),t(this,`currentState`,null),t(this,`sessionBaseUrl`,void 0),t(this,`sessionId`,void 0),t(this,`http`,m({keepAlive:!0})),t(this,`streamEventBuffer`,[]),t(this,`streamEventTimer`,null),t(this,`streamTextAccumulator`,P()),t(this,`workerState`,void 0),t(this,`eventUploader`,void 0),t(this,`internalEventUploader`,void 0),t(this,`deliveryUploader`,void 0),t(this,`onEpochMismatch`,void 0),t(this,`getAuthHeaders`,void 0),this.onEpochMismatch=r?.onEpochMismatch??(()=>{process.exit(1)}),this.heartbeatIntervalMs=r?.heartbeatIntervalMs??k,this.heartbeatJitterFraction=r?.heartbeatJitterFraction??0,this.getAuthHeaders=r?.getAuthHeaders??v,n.protocol!==`http:`&&n.protocol!==`https:`)throw Error(`CCRClient: Expected http(s) URL, got ${n.protocol}`);let i=n.pathname.replace(/\/$/,``);this.sessionBaseUrl=`${n.protocol}//${n.host}${i}`,this.sessionId=i.split(`/`).pop()||``,this.workerState=new D({send:e=>this.request(`put`,`/worker`,{worker_epoch:this.workerEpoch,...e},`PUT worker`).then(e=>e.ok),baseDelayMs:500,maxDelayMs:3e4,jitterMs:500}),this.eventUploader=new E({maxBatchSize:100,maxBatchBytes:10*1024*1024,maxQueueSize:1e5,send:async e=>{let t=await this.request(`post`,`/worker/events`,{worker_epoch:this.workerEpoch,events:e},`client events`);if(!t.ok)throw new T(`client event POST failed`,t.retryAfterMs)},baseDelayMs:500,maxDelayMs:3e4,jitterMs:500}),this.internalEventUploader=new E({maxBatchSize:100,maxBatchBytes:10*1024*1024,maxQueueSize:200,send:async e=>{let t=await this.request(`post`,`/worker/internal-events`,{worker_epoch:this.workerEpoch,events:e},`internal events`);if(!t.ok)throw new T(`internal event POST failed`,t.retryAfterMs)},baseDelayMs:500,maxDelayMs:3e4,jitterMs:500}),this.deliveryUploader=new E({maxBatchSize:64,maxQueueSize:64,send:async e=>{let t=await this.request(`post`,`/worker/events/delivery`,{worker_epoch:this.workerEpoch,updates:e.map(e=>({event_id:e.eventId,status:e.status}))},`delivery batch`);if(!t.ok)throw new T(`delivery POST failed`,t.retryAfterMs)},baseDelayMs:500,maxDelayMs:3e4,jitterMs:500}),e.setOnEvent(e=>{this.reportDelivery(e.event_id,`received`)})}async initialize(e){let t=Date.now();if(Object.keys(this.getAuthHeaders()).length===0)throw new M(`no_auth_headers`);if(e===void 0){let t=process.env.CLAUDE_CODE_WORKER_EPOCH;e=t?parseInt(t,10):NaN}if(isNaN(e))throw new M(`missing_epoch`);this.workerEpoch=e;let n=this.getWorkerState();if(!(await this.request(`put`,`/worker`,{worker_status:`idle`,worker_epoch:this.workerEpoch,external_metadata:{pending_action:null,task_summary:null,automation_state:null}},`PUT worker (init)`)).ok)throw new M(`worker_register_failed`);this.currentState=`idle`,this.startHeartbeat(),y(()=>{this.writeEvent({type:`keep_alive`})}),o(`CCRClient: initialized, epoch=${this.workerEpoch}`),u(`info`,`cli_worker_lifecycle_initialized`,{epoch:this.workerEpoch,duration_ms:Date.now()-t});let{metadata:r,durationMs:i}=await n;return this.closed||u(`info`,`cli_worker_state_restored`,{duration_ms:i,had_state:r!==null}),r}async getWorkerState(){let e=Date.now(),t=this.getAuthHeaders();return Object.keys(t).length===0?{metadata:null,durationMs:0}:{metadata:(await this.getWithRetry(`${this.sessionBaseUrl}/worker`,t,`worker_state`))?.worker?.external_metadata??null,durationMs:Date.now()-e}}async request(e,t,i,a,{timeout:s=1e4}={}){let c=this.getAuthHeaders();if(Object.keys(c).length===0)return{ok:!1};try{let n=await this.http[e](`${this.sessionBaseUrl}${t}`,i,{headers:{...c,"Content-Type":`application/json`,"anthropic-version":`2023-06-01`,"User-Agent":g()},validateStatus:j,timeout:s});if(n.status>=200&&n.status<300)return this.consecutiveAuthFailures=0,{ok:!0};if(n.status===409&&this.handleEpochMismatch(),n.status===401||n.status===403){let e=x(),t=e?C(e):null;t!==null&&t*1e3<Date.now()&&(o(`CCRClient: session_token expired (exp=${new Date(t*1e3).toISOString()}) — no refresh was delivered, exiting`,{level:`error`}),u(`error`,`cli_worker_token_expired_no_refresh`),this.onEpochMismatch()),this.consecutiveAuthFailures++,this.consecutiveAuthFailures>=N&&(o(`CCRClient: ${this.consecutiveAuthFailures} consecutive auth failures with a valid-looking token — server-side auth unrecoverable, exiting`,{level:`error`}),u(`error`,`cli_worker_auth_failures_exhausted`),this.onEpochMismatch())}if(o(`CCRClient: ${a} returned ${n.status}`,{level:`warn`}),u(`warn`,`cli_worker_request_failed`,{method:e,path:t,status:n.status}),n.status===429){let e=n.headers?.[`retry-after`],t=typeof e==`string`?parseInt(e,10):NaN;if(!isNaN(t)&&t>=0)return{ok:!1,retryAfterMs:t*1e3}}return{ok:!1}}catch(i){return o(`CCRClient: ${a} failed: ${n(i)}`,{level:`warn`}),u(`warn`,`cli_worker_request_error`,{method:e,path:t,error_code:r(i)}),{ok:!1}}}reportState(e,t){e===this.currentState&&!t||(this.currentState=e,this.workerState.enqueue({worker_status:e,requires_action_details:t?{tool_name:t.tool_name,action_description:t.action_description,request_id:t.request_id}:null}))}reportMetadata(e){this.workerState.enqueue({external_metadata:e})}handleEpochMismatch(){o(`CCRClient: Epoch mismatch (409), shutting down`,{level:`error`}),u(`error`,`cli_worker_epoch_mismatch`),this.onEpochMismatch()}startHeartbeat(){this.stopHeartbeat();let e=()=>{let e=this.heartbeatIntervalMs*this.heartbeatJitterFraction*(2*Math.random()-1);this.heartbeatTimer=setTimeout(t,this.heartbeatIntervalMs+e)},t=()=>{this.sendHeartbeat(),this.heartbeatTimer!==null&&e()};e()}stopHeartbeat(){this.heartbeatTimer&&(clearTimeout(this.heartbeatTimer),this.heartbeatTimer=null)}async sendHeartbeat(){if(!this.heartbeatInFlight){this.heartbeatInFlight=!0;try{(await this.request(`post`,`/worker/heartbeat`,{session_id:this.sessionId,worker_epoch:this.workerEpoch},`Heartbeat`,{timeout:5e3})).ok&&o(`CCRClient: Heartbeat sent`)}finally{this.heartbeatInFlight=!1}}}async writeEvent(e){if(e.type===`stream_event`){this.streamEventBuffer.push(e),this.streamEventTimer||(this.streamEventTimer=setTimeout(()=>void this.flushStreamEventBuffer(),A));return}await this.flushStreamEventBuffer(),e.type===`assistant`&&L(this.streamTextAccumulator,e),await this.eventUploader.enqueue(this.toClientEvent(e))}toClientEvent(e){let t=e;return{payload:{...t,uuid:typeof t.uuid==`string`?t.uuid:w()}}}async flushStreamEventBuffer(){if(this.streamEventTimer&&(clearTimeout(this.streamEventTimer),this.streamEventTimer=null),this.streamEventBuffer.length===0)return;let e=this.streamEventBuffer;this.streamEventBuffer=[];let t=I(e,this.streamTextAccumulator);await this.eventUploader.enqueue(t.map(e=>({payload:e,ephemeral:!0})))}async writeInternalEvent(e,t,{isCompaction:n=!1,agentId:r}={}){let i={payload:{type:e,...t,uuid:typeof t.uuid==`string`?t.uuid:w()},...n&&{is_compaction:!0},...r&&{agent_id:r}};await this.internalEventUploader.enqueue(i)}flushInternalEvents(){return this.internalEventUploader.flush()}async flush(){return await this.flushStreamEventBuffer(),this.eventUploader.flush()}async readInternalEvents(){return this.paginatedGet(`/worker/internal-events`,{},`internal_events`)}async readSubagentInternalEvents(){return this.paginatedGet(`/worker/internal-events`,{subagents:`true`},`subagent_events`)}async paginatedGet(e,t,n){let r=this.getAuthHeaders();if(Object.keys(r).length===0)return null;let i=[],a;do{let o=new URL(`${this.sessionBaseUrl}${e}`);for(let[e,n]of Object.entries(t))o.searchParams.set(e,n);a&&o.searchParams.set(`cursor`,a);let s=await this.getWithRetry(o.toString(),r,n);if(!s)return null;i.push(...s.data??[]),a=s.next_cursor}while(a);return o(`CCRClient: Read ${i.length} internal events from ${e}${t.subagents?` (subagents)`:``}`),i}async getWithRetry(e,t,r){for(let r=1;r<=10;r++){let i;try{i=await this.http.get(e,{headers:{...t,"anthropic-version":`2023-06-01`,"User-Agent":g()},validateStatus:j,timeout:3e4})}catch(t){o(`CCRClient: GET ${e} failed (attempt ${r}/10): ${n(t)}`,{level:`warn`}),r<10&&await f(Math.min(500*2**(r-1),3e4)+Math.random()*500);continue}if(i.status>=200&&i.status<300)return i.data;i.status===409&&this.handleEpochMismatch(),o(`CCRClient: GET ${e} returned ${i.status} (attempt ${r}/10)`,{level:`warn`}),r<10&&await f(Math.min(500*2**(r-1),3e4)+Math.random()*500)}return o(`CCRClient: GET retries exhausted`,{level:`error`}),u(`error`,`cli_worker_get_retries_exhausted`,{context:r}),null}reportDelivery(e,t){this.deliveryUploader.enqueue({eventId:e,status:t})}getWorkerEpoch(){return this.workerEpoch}get internalEventsPending(){return this.internalEventUploader.pendingCount}close(){this.closed=!0,this.stopHeartbeat(),b(),this.streamEventTimer&&(clearTimeout(this.streamEventTimer),this.streamEventTimer=null),this.streamEventBuffer=[],this.streamTextAccumulator.byMessage.clear(),this.streamTextAccumulator.scopeToMessage.clear(),this.workerState.close(),this.eventUploader.close(),this.internalEventUploader.close(),this.deliveryUploader.close()}};export{M as n,E as r,R as t};
@@ -1 +0,0 @@
1
- import{Fr as e,Pr as t}from"./model-BsZ4sP_H.js";e();export{t as getOrganizationUUID};
@@ -1 +0,0 @@
1
- import{r as e,t}from"./client-DFlE4fYh.js";e();export{t as clearOpenAIClientCache};
@@ -1 +0,0 @@
1
- import{Ai as e,Bi as t,Fi as n}from"./loadAgentsDir-C7lOqvfh.js";t();export{e as clearCommandsCache,n as getCommands};
@@ -1,2 +0,0 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{Ba as t,Bv as n,Cv as r,Dp as i,Dv as a,Ep as o,I_ as s,Jv as c,Kv as l,L_ as u,Ma as d,Mv as f,N_ as p,Ov as m,P_ as h,QC as g,Qm as _,Sv as v,Yv as y,ZC as b,_v as x,ct as S,eh as C,ih as w,jv as T,lt as E,oh as D,vn as O,vv as k,xv as A}from"./loadAgentsDir-C7lOqvfh.js";import{di as j,ui as M}from"./src-P_wYS_NJ2.js";import{Wt as N,qt as P}from"./state-BemZdQIl.js";import{R as F,z as I}from"./debug-RAynG_nM.js";import{o as L,s as R}from"./log-CezCRpAN.js";function z(e,t){let n=o(`tip`),r=b(`app:toggleTranscript`,`Global`,`ctrl+o`),i=[...e.options.verbose?[]:[`(${r} to see full summary)`],...t?[t]:[],...n?[n]:[]];return M.dim(`Compacted `+i.join(`
2
- `))}async function B(e,t){let n=e.getAppState(),r=await S(e.options.tools,e.options.mainLoopModel,Array.from(n.toolPermissionContext.additionalWorkingDirectories.keys()),e.options.mcpClients),i=x({mainThreadAgentDefinition:void 0,toolUseContext:e,customSystemPrompt:e.options.customSystemPrompt,defaultSystemPrompt:r,appendSystemPrompt:e.options.appendSystemPrompt}),[a,o]=await Promise.all([v(),A()]);return{systemPrompt:i,userContext:a,systemContext:o,toolUseContext:e,forkContextMessages:t}}var V;e((()=>{j(),N(),E(),r(),g(),c(),u(),T(),a(),w(),_(),n(),I(),O(),L(),t(),i(),k(),V=async(e,t)=>{let{abortController:n}=t,{messages:r}=t;if(r=d(r),r.length===0)throw Error(`No messages to compact`);let i=e.trim();try{if(!i){let e=await C(r,t.agentId);if(e)return v.cache.clear?.(),D(),y(t.options.querySource??`compact`,t.agentId),P(),f(),{type:`compact`,compactionResult:e,displayText:z(t)}}let e=(await m(r,t)).messages,n=await s(e,t,await B(t,e),!1,i,!1);return l(void 0),f(),v.cache.clear?.(),D(),{type:`compact`,compactionResult:n,displayText:z(t,n.userDisplayMessage)}}catch(e){throw n.signal.aborted?Error(`Compaction canceled.`):F(e,`Not enough messages to compact. Send a few more messages first, then try again.`)?Error(h):F(e,`Compaction interrupted · This may be due to network issues — please try again.`)?Error(p):(R(e),Error(`Error during compaction: ${e}`))}}}))();export{V as call};
@@ -1 +0,0 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{t}from"./jsx-runtime-Bb4Xn-E0.js";import{n,t as r}from"./Settings-BMXysXIx.js";var i,a;e((()=>{n(),i=t(),a=async(e,t)=>(0,i.jsx)(r,{onClose:e,context:t,defaultTab:`Config`})}))();export{a as call};
@@ -1 +0,0 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{n as t,t as n}from"./figures-5ThXQEtq.js";import{Ba as r,Dv as i,Ma as a,Ov as o,gv as s,mv as c}from"./loadAgentsDir-C7lOqvfh.js";import{I as l,P as u,fi as d,s as f,t as p}from"./src-P_wYS_NJ2.js";import{t as m}from"./jsx-runtime-Bb4Xn-E0.js";import{Cn as h,bn as g,cn as _,sn as v}from"./settings-DnptdP79.js";import{_ as y,v as b}from"./startupProfiler-L_UWZ03w.js";import{Et as x,Zt as S,an as C,on as w,rn as T,wt as E}from"./prompt-M2lu8_Oa.js";import{n as D,t as O}from"./staticRender-DrU6eWoq.js";function k(e){let t=[];return A(e,t),j(e,t),N(e,t),ee(e,t),P(e,t),t.sort((e,t)=>e.severity===t.severity?(t.savingsTokens??0)-(e.savingsTokens??0):e.severity===`warning`?-1:1),t}function A(e,t){e.percentage>=R&&t.push({severity:`warning`,title:`Context is ${e.percentage}% full`,detail:e.isAutoCompactEnabled?`Autocompact will trigger soon, which discards older messages. Use /compact now to control what gets kept.`:`Autocompact is disabled. Use /compact to free space, or enable autocompact in /config.`})}function j(e,t){if(e.messageBreakdown)for(let n of e.messageBreakdown.toolCallsByType){let r=n.callTokens+n.resultTokens,i=r/e.rawMaxTokens*100;if(i<F||r<I)continue;let a=M(n.name,r,i);a&&t.push(a)}}function M(e,t,n){let r=y(t);switch(e){case C:return{severity:`warning`,title:`Bash results using ${r} tokens (${n.toFixed(0)}%)`,detail:`Pipe output through head, tail, or grep to reduce result size. Avoid cat on large files — use Read with offset/limit instead.`,savingsTokens:Math.floor(t*.5)};case S:return{severity:`info`,title:`Read results using ${r} tokens (${n.toFixed(0)}%)`,detail:`Use offset and limit parameters to read only the sections you need. Avoid re-reading entire files when you only need a few lines.`,savingsTokens:Math.floor(t*.3)};case E:return{severity:`info`,title:`Grep results using ${r} tokens (${n.toFixed(0)}%)`,detail:`Add more specific patterns or use the glob or type parameter to narrow file types. Consider Glob for file discovery instead of Grep.`,savingsTokens:Math.floor(t*.3)};default:return n>=20?{severity:`info`,title:`${e} using ${r} tokens (${n.toFixed(0)}%)`,detail:`This tool is consuming a significant portion of context.`,savingsTokens:Math.floor(t*.2)}:null}}function N(e,t){if(!e.messageBreakdown)return;let n=e.messageBreakdown.toolCallsByType.find(e=>e.name===S);if(!n)return;let r=n.callTokens+n.resultTokens,i=r/e.rawMaxTokens*100,a=n.resultTokens/e.rawMaxTokens*100;i>=F&&r>=I||a>=L&&n.resultTokens>=I&&t.push({severity:`info`,title:`File reads using ${y(n.resultTokens)} tokens (${a.toFixed(0)}%)`,detail:`If you are re-reading files, consider referencing earlier reads. Use offset/limit for large files.`,savingsTokens:Math.floor(n.resultTokens*.3)})}function ee(e,t){let n=e.memoryFiles.reduce((e,t)=>e+t.tokens,0),r=n/e.rawMaxTokens*100;if(r>=z&&n>=B){let i=[...e.memoryFiles].sort((e,t)=>t.tokens-e.tokens).slice(0,3).map(e=>`${g(e.path)} (${y(e.tokens)})`).join(`, `);t.push({severity:`info`,title:`Memory files using ${y(n)} tokens (${r.toFixed(0)}%)`,detail:`Largest: ${i}. Use /memory to review and prune stale entries.`,savingsTokens:Math.floor(n*.3)})}}function P(e,t){!e.isAutoCompactEnabled&&e.percentage>=50&&e.percentage<R&&t.push({severity:`info`,title:`Autocompact is disabled`,detail:`Without autocompact, you will hit context limits and lose the conversation. Enable it in /config or use /compact manually.`})}var F,I,L,R,z,B,V=e((()=>{w(),T(),x(),h(),b(),F=15,I=1e4,L=5,R=80,z=5,B=5e3}));function H({suggestions:e}){return e.length===0?null:(0,U.jsxs)(l,{flexDirection:`column`,marginTop:1,children:[(0,U.jsx)(u,{bold:!0,children:`Suggestions`}),e.map((e,t)=>(0,U.jsxs)(l,{flexDirection:`column`,marginTop:t===0?0:1,children:[(0,U.jsxs)(l,{children:[(0,U.jsx)(f,{status:e.severity,withSpace:!0}),(0,U.jsx)(u,{bold:!0,children:e.title}),e.savingsTokens?(0,U.jsxs)(u,{dimColor:!0,children:[` `,n.arrowRight,` save ~`,y(e.savingsTokens)]}):null]}),(0,U.jsx)(l,{marginLeft:2,children:(0,U.jsx)(u,{dimColor:!0,children:e.detail})})]},t))]})}var U,W=e((()=>{t(),d(),p(),b(),U=m()}));function G(){return null}function K(e){let t=new Map;for(let n of e){let e=v(n.source),r=t.get(e)||[];r.push(n),t.set(e,r)}for(let[e,n]of t.entries())t.set(e,n.sort((e,t)=>t.tokens-e.tokens));let n=new Map;for(let e of X){let r=t.get(e);r&&n.set(e,r)}return n}function q({data:e}){let{categories:t,totalTokens:n,rawMaxTokens:r,percentage:i,gridRows:a,model:o,memoryFiles:s,mcpTools:c,deferredBuiltinTools:d=[],agents:f,skills:p,cacheHitRate:m,cacheThreshold:h}=e,_=t.filter(e=>e.tokens>0&&e.name!==`Free space`&&e.name!==Y&&!e.isDeferred),v=t.some(e=>e.isDeferred&&e.name.includes(`MCP`)),b=t.find(e=>e.name===Y);return(0,J.jsxs)(l,{flexDirection:`column`,paddingLeft:1,children:[(0,J.jsx)(u,{bold:!0,children:`Context Usage`}),(0,J.jsxs)(l,{flexDirection:`row`,gap:2,children:[(0,J.jsx)(l,{flexDirection:`column`,flexShrink:0,children:a.map((e,t)=>(0,J.jsx)(l,{flexDirection:`row`,marginLeft:-1,children:e.map((e,t)=>e.categoryName===`Free space`?(0,J.jsx)(u,{dimColor:!0,children:`⛶ `},t):e.categoryName===Y?(0,J.jsx)(u,{color:e.color,children:`⛝ `},t):(0,J.jsx)(u,{color:e.color,children:e.squareFullness>=.7?`⛁ `:`⛀ `},t))},t))}),(0,J.jsxs)(l,{flexDirection:`column`,gap:0,flexShrink:0,children:[(0,J.jsxs)(u,{dimColor:!0,children:[o,` · `,y(n),`/`,y(r),` tokens (`,i,`%)`]}),(0,J.jsx)(G,{}),m!==void 0&&h!==void 0&&(0,J.jsxs)(u,{color:m<h?`warning`:void 0,children:[`Cache hit rate: `,m.toFixed(0),`%`,m<h?` (below ${h}% threshold)`:``]}),(0,J.jsx)(u,{children:` `}),(0,J.jsx)(u,{dimColor:!0,italic:!0,children:`Estimated usage by category`}),_.map((e,t)=>{let n=y(e.tokens),i=e.isDeferred?`N/A`:`${(e.tokens/r*100).toFixed(1)}%`,a=e.name===Y,o=e.name,s=e.isDeferred?` `:a?`⛝`:`⛁`;return(0,J.jsxs)(l,{children:[(0,J.jsx)(u,{color:e.color,children:s}),(0,J.jsxs)(u,{children:[` `,o,`: `]}),(0,J.jsxs)(u,{dimColor:!0,children:[n,` tokens (`,i,`)`]})]},t)}),(t.find(e=>e.name===`Free space`)?.tokens??0)>0&&(0,J.jsxs)(l,{children:[(0,J.jsx)(u,{dimColor:!0,children:`⛶`}),(0,J.jsx)(u,{children:` Free space: `}),(0,J.jsxs)(u,{dimColor:!0,children:[y(t.find(e=>e.name===`Free space`)?.tokens||0),` (`,((t.find(e=>e.name===`Free space`)?.tokens||0)/r*100).toFixed(1),`%)`]})]}),b&&b.tokens>0&&(0,J.jsxs)(l,{children:[(0,J.jsx)(u,{color:b.color,children:`⛝`}),(0,J.jsxs)(u,{dimColor:!0,children:[` `,b.name,`: `]}),(0,J.jsxs)(u,{dimColor:!0,children:[y(b.tokens),` tokens (`,(b.tokens/r*100).toFixed(1),`%)`]})]})]})]}),(0,J.jsxs)(l,{flexDirection:`column`,marginLeft:-1,children:[c.length>0&&(0,J.jsxs)(l,{flexDirection:`column`,marginTop:1,children:[(0,J.jsxs)(l,{children:[(0,J.jsx)(u,{bold:!0,children:`MCP tools`}),(0,J.jsxs)(u,{dimColor:!0,children:[` · /mcp`,v?` (loaded on-demand)`:``]})]}),c.some(e=>e.isLoaded)&&(0,J.jsxs)(l,{flexDirection:`column`,marginTop:1,children:[(0,J.jsx)(u,{dimColor:!0,children:`Loaded`}),c.filter(e=>e.isLoaded).map((e,t)=>(0,J.jsxs)(l,{children:[(0,J.jsxs)(u,{children:[`└ `,e.name,`: `]}),(0,J.jsxs)(u,{dimColor:!0,children:[y(e.tokens),` tokens`]})]},t))]}),v&&c.some(e=>!e.isLoaded)&&(0,J.jsxs)(l,{flexDirection:`column`,marginTop:1,children:[(0,J.jsx)(u,{dimColor:!0,children:`Available`}),c.filter(e=>!e.isLoaded).map((e,t)=>(0,J.jsx)(l,{children:(0,J.jsxs)(u,{dimColor:!0,children:[`└ `,e.name]})},t))]}),!v&&c.map((e,t)=>(0,J.jsxs)(l,{children:[(0,J.jsxs)(u,{children:[`└ `,e.name,`: `]}),(0,J.jsxs)(u,{dimColor:!0,children:[y(e.tokens),` tokens`]})]},t))]}),f.length>0&&(0,J.jsxs)(l,{flexDirection:`column`,marginTop:1,children:[(0,J.jsxs)(l,{children:[(0,J.jsx)(u,{bold:!0,children:`Custom agents`}),(0,J.jsx)(u,{dimColor:!0,children:` · /agents`})]}),Array.from(K(f).entries()).map(([e,t])=>(0,J.jsxs)(l,{flexDirection:`column`,marginTop:1,children:[(0,J.jsx)(u,{dimColor:!0,children:e}),t.map((e,t)=>(0,J.jsxs)(l,{children:[(0,J.jsxs)(u,{children:[`└ `,e.agentType,`: `]}),(0,J.jsxs)(u,{dimColor:!0,children:[y(e.tokens),` tokens`]})]},t))]},e))]}),s.length>0&&(0,J.jsxs)(l,{flexDirection:`column`,marginTop:1,children:[(0,J.jsxs)(l,{children:[(0,J.jsx)(u,{bold:!0,children:`Memory files`}),(0,J.jsx)(u,{dimColor:!0,children:` · /memory`})]}),s.map((e,t)=>(0,J.jsxs)(l,{children:[(0,J.jsxs)(u,{children:[`└ `,g(e.path),`: `]}),(0,J.jsxs)(u,{dimColor:!0,children:[y(e.tokens),` tokens`]})]},t))]}),p&&p.tokens>0&&(0,J.jsxs)(l,{flexDirection:`column`,marginTop:1,children:[(0,J.jsxs)(l,{children:[(0,J.jsx)(u,{bold:!0,children:`Skills`}),(0,J.jsx)(u,{dimColor:!0,children:` · /skills`})]}),Array.from(K(p.skillFrontmatter).entries()).map(([e,t])=>(0,J.jsxs)(l,{flexDirection:`column`,marginTop:1,children:[(0,J.jsx)(u,{dimColor:!0,children:e}),t.map((e,t)=>(0,J.jsxs)(l,{children:[(0,J.jsxs)(u,{children:[`└ `,e.name,`: `]}),(0,J.jsxs)(u,{dimColor:!0,children:[y(e.tokens),` tokens`]})]},t))]},e))]})]}),(0,J.jsx)(H,{suggestions:k(e)})]})}var J,Y,X,Z=e((()=>{d(),p(),V(),h(),b(),_(),W(),J=m(),Y=`Autocompact buffer`,X=[`Project`,`User`,`Managed`,`Plugin`,`Built-in`]}));function Q(e){return a(e)}async function te(e,t){let{messages:n,getAppState:r,options:{mainLoopModel:i,tools:a}}=t,s=Q(n),{messages:l}=await o(s),u=process.stdout.columns||80,d=r();return e(await D((0,$.jsx)(q,{data:await c(l,i,async()=>d.toolPermissionContext,a,d.agentDefinitions,u,t,void 0,s)}))),null}var $;e((()=>{d(),Z(),i(),s(),r(),O(),$=m()}))();export{te as call};
@@ -1 +0,0 @@
1
- import{n as e,r as t,t as n}from"./context-noninteractive-D5iQhasu.js";t();export{n as call,e as collectContextData};
@@ -1 +0,0 @@
1
- import{n as e,t}from"./conversation-Dk1WDQuN.js";e();export{t as clearConversation};
@@ -1 +0,0 @@
1
- import{a as e,n as t}from"./rolldown-runtime-DaDcL9Zw.js";import{An as n,Cr as r,DE as i,H_ as a,Hs as o,On as s,PE as c,St as l,Tt as u,Us as d,V_ as f,Xt as p,Yh as m,Yn as h,Zh as g,_i as _,a_ as v,bc as y,c_ as b,fw as x,i_ as S,ii as C,ir as w,jn as T,mi as E,pw as D,u_ as O,un as k,vn as A}from"./loadAgentsDir-C7lOqvfh.js";import{Dn as j,G as M,Qt as N,Tn as P,Wt as F,en as I,et as L,wn as R}from"./state-BemZdQIl.js";import{o as z,s as B}from"./log-CezCRpAN.js";import{n as V,r as H}from"./analytics-DJobLaWP.js";import{_ as U,x as W}from"./sessionState-Bifmu95-.js";import{n as G,t as K}from"./caches-BTQAW9zc.js";import{randomUUID as q}from"crypto";function J(){return Y}var Y,X=t((()=>{y(),Y=null}));function Z(){let e=J();if(!e)return;e.markTranscriptReset?.();let t={type:`status`,subtype:`status`,status:`conversation_cleared`,message:`conversation_cleared`,uuid:q()};e.writeSdkMessages([t])}async function Q({setMessages:t,readFileState:o,discoveredSkillNames:c,loadedNestedMemoryPaths:u,getAppState:f,setAppState:g,setConversationId:y}){let x=k();await p(`clear`,{getAppState:f,setAppState:g,signal:AbortSignal.timeout(x),timeoutMs:x});let S=M();S&&H(`tengu_cache_eviction_hint`,{scope:`conversation_clear`,last_request_id:S});let T=new Set,O=[],A=e=>`isBackgrounded`in e&&e.isBackgrounded===!1;if(f)for(let e of Object.values(f().tasks))A(e)||d(e)&&(T.add(e.agentId),O.push(e));t(()=>[]),Z();{let{setContextBlocked:t}=(U(),e(W));t(!1)}y&&y(q()),K(T),R(null),P(null),j(null),I(),D(L()),o.clear(),c?.clear(),u?.clear(),g&&g(e=>{let t={};for(let[n,r]of Object.entries(e.tasks)){if(!A(r)){t[n]=r;continue}try{r.status===`running`&&(v(r)&&(r.shellCommand?.kill(),r.shellCommand?.cleanup(),r.cleanupTimeoutId&&clearTimeout(r.cleanupTimeoutId)),`abortController`in r&&r.abortController?.abort(),`unregisterCleanup`in r&&r.unregisterCleanup?.())}catch(e){B(e)}s(n)}return{...e,tasks:t,attribution:m(),standaloneAgentContext:void 0,fileHistory:{snapshots:[],trackedFiles:new Set,snapshotSequence:0},mcp:{clients:[],tools:[],commands:[],resources:{},pluginReconnectKey:e.mcp.pluginReconnectKey}}}),i(),h(),N({setCurrentAsParent:!0}),await C();for(let e of O)e.status===`running`&&n(e.id,w(b(e.agentId)));let{saveMode:F}=(r(),e(_));F(`normal`);let z=l();z&&E(z);let V=await a(`clear`);V.length>0&&t(()=>V)}var $=t((()=>{X(),F(),V(),o(),S(),O(),g(),A(),z(),c(),x(),f(),r(),T(),u(),G()}));export{$ as n,Q as t};
@@ -1 +0,0 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{F as t,a as n,l as r,z as i}from"./debug-RAynG_nM.js";import{i as a,t as o}from"./sessionIdCompat-DMayYBrf.js";import{i as s,o as c}from"./debugUtils-DX0KAXNK.js";async function l({environmentId:e,title:n,events:i,gitRepoUrl:a,branch:o,signal:c,baseUrl:l,getAccessToken:u,permissionMode:d}){let{getClaudeAIOAuthTokens:f}=await import(`./auth-BIGJth5U.js`),{getOrganizationUUID:p}=await import(`./client-BWQ4-rN7.js`),{getOauthConfig:m}=await import(`./oauth-BN2I0_jl.js`),{getOAuthHeaders:h}=await import(`./api-BSeE6MwB.js`),{parseGitHubRepository:g}=await import(`./detectRepository-ctF9KDbb.js`),{getDefaultBranch:_}=await import(`./git-XtKbtJMc.js`),{getMainLoopModel:v}=await import(`./model-D19IIcll.js`),{default:y}=await import(`./axios-BHBm_hhU.js`),{isSelfHostedBridge:b}=await import(`./bridgeConfig-BeqChxJC.js`),x=u?.()??f()?.accessToken;if(!x)return r(`[bridge] No access token for session creation`),null;let S=b()?`self-hosted`:await p();if(!S)return r(`[bridge] No org UUID for session creation`),null;let C=null,w=null;if(a){let{parseGitRemote:e}=await import(`./detectRepository-ctF9KDbb.js`),t=e(a);if(t){let{host:e,owner:n,name:r}=t,i=o||await _()||void 0;C={type:`git_repository`,url:`https://${e}/${n}/${r}`,revision:i},w={type:`git_repository`,git_info:{type:`github`,repo:`${n}/${r}`,branches:[`claude/${o||`task`}`]}}}else{let e=g(a);if(e){let[t,n]=e.split(`/`);if(t&&n){let e=o||await _()||void 0;C={type:`git_repository`,url:`https://github.com/${t}/${n}`,revision:e},w={type:`git_repository`,git_info:{type:`github`,repo:`${t}/${n}`,branches:[`claude/${o||`task`}`]}}}}}}let T={...n!==void 0&&{title:n},events:i,session_context:{sources:C?[C]:[],outcomes:w?[w]:[],model:v()},environment_id:e,source:`remote-control`,...d&&{permission_mode:d}},E={...h(x),"anthropic-beta":`ccr-byoc-2025-07-29`,"x-organization-uuid":S},D=`${l??m().BASE_API_URL}/v1/sessions`,O;try{O=await y.post(D,T,{headers:E,signal:c,validateStatus:e=>e<500})}catch(e){return r(`[bridge] Session creation request failed: ${t(e)}`),null}if(!(O.status===200||O.status===201)){let e=s(O.data);return r(`[bridge] Session creation failed with status ${O.status}${e?`: ${e}`:``}`),null}let k=O.data;return!k||typeof k!=`object`||!(`id`in k)||typeof k.id!=`string`?(r(`[bridge] No session ID in response`),null):k.id}async function u(e,n){let{getClaudeAIOAuthTokens:i}=await import(`./auth-BIGJth5U.js`),{getOrganizationUUID:a}=await import(`./client-BWQ4-rN7.js`),{getOauthConfig:o}=await import(`./oauth-BN2I0_jl.js`),{getOAuthHeaders:c}=await import(`./api-BSeE6MwB.js`),{default:l}=await import(`./axios-BHBm_hhU.js`),{isSelfHostedBridge:u}=await import(`./bridgeConfig-BeqChxJC.js`),d=n?.getAccessToken?.()??i()?.accessToken;if(!d)return r(`[bridge] No access token for session fetch`),null;let f=u()?`self-hosted`:await a();if(!f)return r(`[bridge] No org UUID for session fetch`),null;let p={...c(d),"anthropic-beta":`ccr-byoc-2025-07-29`,"x-organization-uuid":f},m=`${n?.baseUrl??o().BASE_API_URL}/v1/sessions/${e}`;r(`[bridge] Fetching session ${e}`);let h;try{h=await l.get(m,{headers:p,timeout:1e4,validateStatus:e=>e<500})}catch(e){return r(`[bridge] Session fetch request failed: ${t(e)}`),null}if(h.status!==200){let e=s(h.data);return r(`[bridge] Session fetch failed with status ${h.status}${e?`: ${e}`:``}`),null}return h.data}async function d(e,t){let{getClaudeAIOAuthTokens:n}=await import(`./auth-BIGJth5U.js`),{getOrganizationUUID:i}=await import(`./client-BWQ4-rN7.js`),{getOauthConfig:a}=await import(`./oauth-BN2I0_jl.js`),{getOAuthHeaders:o}=await import(`./api-BSeE6MwB.js`),{default:c}=await import(`./axios-BHBm_hhU.js`),{isSelfHostedBridge:l}=await import(`./bridgeConfig-BeqChxJC.js`),u=t?.getAccessToken?.()??n()?.accessToken;if(!u){r(`[bridge] No access token for session archive`);return}let d=l()?`self-hosted`:await i();if(!d){r(`[bridge] No org UUID for session archive`);return}let f={...o(u),"anthropic-beta":`ccr-byoc-2025-07-29`,"x-organization-uuid":d},p=`${t?.baseUrl??a().BASE_API_URL}/v1/sessions/${e}/archive`;r(`[bridge] Archiving session ${e}`);let m=await c.post(p,{},{headers:f,timeout:t?.timeoutMs??1e4,validateStatus:e=>e<500});if(m.status===200)r(`[bridge] Session ${e} archived successfully`);else{let e=s(m.data);r(`[bridge] Session archive failed with status ${m.status}${e?`: ${e}`:``}`)}}async function f(e,n,i){let{getClaudeAIOAuthTokens:o}=await import(`./auth-BIGJth5U.js`),{getOrganizationUUID:c}=await import(`./client-BWQ4-rN7.js`),{getOauthConfig:l}=await import(`./oauth-BN2I0_jl.js`),{getOAuthHeaders:u}=await import(`./api-BSeE6MwB.js`),{default:d}=await import(`./axios-BHBm_hhU.js`),{isSelfHostedBridge:f}=await import(`./bridgeConfig-BeqChxJC.js`),p=i?.getAccessToken?.()??o()?.accessToken;if(!p){r(`[bridge] No access token for session title update`);return}let m=f()?`self-hosted`:await c();if(!m){r(`[bridge] No org UUID for session title update`);return}let h={...u(p),"anthropic-beta":`ccr-byoc-2025-07-29`,"x-organization-uuid":m},g=a(e),_=`${i?.baseUrl??l().BASE_API_URL}/v1/sessions/${g}`;r(`[bridge] Updating session title: ${g} → ${n}`);try{let e=await d.patch(_,{title:n},{headers:h,timeout:1e4,validateStatus:e=>e<500});if(e.status===200)r(`[bridge] Session title updated successfully`);else{let t=s(e.data);r(`[bridge] Session title update failed with status ${e.status}${t?`: ${t}`:``}`)}}catch(e){r(`[bridge] Session title update request failed: ${t(e)}`)}}var p=e((()=>{n(),i(),c(),o()}));export{f as a,p as i,l as n,u as r,d as t};
@@ -1 +0,0 @@
1
- import{a as e,i as t,n,r}from"./createSession-DkT1GL8y.js";t();export{n as createBridgeSession,r as getBridgeSession,e as updateBridgeSessionTitle};