@readmagic/workmate 0.0.9 → 0.0.10

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 (427) hide show
  1. package/dist/chunks/{AddWorkspaceDirectory-qFZy3FOD.js → AddWorkspaceDirectory-Vmmm7p1c.js} +1 -1
  2. package/dist/chunks/App-C2yQjBgY.js +1 -0
  3. package/dist/chunks/ApproveApiKey-CKbv5C1x.js +1 -0
  4. package/dist/chunks/{ApproveApiKey-DHAbdwkC.js → ApproveApiKey-MscC-ssL.js} +1 -1
  5. package/dist/chunks/BackgroundTasksDialog-CL5NWsFL.js +2 -0
  6. package/dist/chunks/{BypassPermissionsModeDialog-BuRFF1fQ.js → BypassPermissionsModeDialog-CLSACUmo.js} +1 -1
  7. package/dist/chunks/{ClaudeMdExternalIncludesDialog-CDrArsSX.js → ClaudeMdExternalIncludesDialog-BqNxQOXJ.js} +1 -1
  8. package/dist/chunks/ClaudeMdExternalIncludesDialog-C0-psohX.js +1 -0
  9. package/dist/chunks/ConsoleOAuthFlow-4mOvEer_.js +1 -0
  10. package/dist/chunks/{DiffDialog-BIcwpgSr.js → DiffDialog-9AYwtupw.js} +3 -3
  11. package/dist/chunks/Doctor-DmgAwce2.js +1 -0
  12. package/dist/chunks/Doctor-jEs9chPk.js +3 -0
  13. package/dist/chunks/ExitFlow-DVKxFdpX.js +2 -0
  14. package/dist/chunks/{Grove-BmirUB6V.js → Grove-B9-hhkZA.js} +1 -1
  15. package/dist/chunks/{HybridTransport-BVmSUHf0.js → HybridTransport-MxJ_W_np.js} +3 -3
  16. package/dist/chunks/{InvalidConfigDialog-WRywkKeS.js → InvalidConfigDialog-o9DF1REI.js} +1 -1
  17. package/dist/chunks/{InvalidSettingsDialog-C4n3A72C.js → InvalidSettingsDialog-YyQcHocx.js} +1 -1
  18. package/dist/chunks/MCPConnectionManager-CUTuaa8T.js +1 -0
  19. package/dist/chunks/MCPToolListView-CvqB4nCw.js +1 -0
  20. package/dist/chunks/{McpParsingWarnings-CH4yyMAL.js → McpParsingWarnings-BCpfHaBK.js} +1 -1
  21. package/dist/chunks/MessageSelector-BLzw172f.js +3 -0
  22. package/dist/chunks/Messages-4K5sLmNh.js +11 -0
  23. package/dist/chunks/{Onboarding-BboWs1pp.js → Onboarding-ClwHS5rh.js} +1 -1
  24. package/dist/chunks/{PromptInputFooterSuggestions-BpC9COmh.js → PromptInputFooterSuggestions-BSA9NrZc.js} +1 -1
  25. package/dist/chunks/PromptInputHelpMenu-Bb4KdIX_.js +1 -0
  26. package/dist/chunks/QueryEngine-DPHLSsax.js +1 -0
  27. package/dist/chunks/REPL-Bf46iQCN.js +1 -0
  28. package/dist/chunks/REPL-DIaAo9M9.js +133 -0
  29. package/dist/chunks/RemoteSessionManager-CS6mywIn.js +2 -0
  30. package/dist/chunks/ResumeConversation-Br2KsBoe.js +1 -0
  31. package/dist/chunks/{SSETransport-1KBBUikF.js → SSETransport-CoxQ8YpH.js} +1 -1
  32. package/dist/chunks/SearchExtraToolsTool-i_YO3QvV.js +1 -0
  33. package/dist/chunks/Settings-BMXysXIx.js +2 -0
  34. package/dist/chunks/{TeleportProgress-BmgPAZAi.js → TeleportProgress-Doucj-50.js} +1 -1
  35. package/dist/chunks/{TeleportRepoMismatchDialog-sgxNOeM_.js → TeleportRepoMismatchDialog-B5I73j7Y.js} +1 -1
  36. package/dist/chunks/{TeleportResumeWrapper-GptvrUdv.js → TeleportResumeWrapper-D6kpr2c6.js} +1 -1
  37. package/dist/chunks/{ThemePicker-gAMqqD1P.js → ThemePicker-DrC8tlp0.js} +1 -1
  38. package/dist/chunks/{TrustDialog-CWt-4Evl.js → TrustDialog-Fk4m_Sy4.js} +1 -1
  39. package/dist/chunks/{ValidationErrorsList-De3kzHtz.js → ValidationErrorsList-D_OUa4RT.js} +1 -1
  40. package/dist/chunks/WelcomeV2-DvfQHnZY.js +1 -0
  41. package/dist/chunks/add-dir-CZ6Clvq8.js +1 -0
  42. package/dist/chunks/{agentDisplay-5gnCQwUY.js → agentDisplay-B755vMZE.js} +1 -1
  43. package/dist/chunks/{agents-Bz1MLp4A.js → agents-CIvP8l0s.js} +1 -1
  44. package/dist/chunks/agents-DHnNg4h6.js +103 -0
  45. package/dist/chunks/allErrors-CU89tF-z.js +1 -0
  46. package/dist/chunks/api-BSeE6MwB.js +1 -0
  47. package/dist/chunks/{api-DzccRM_z.js → api-nSHc_GIQ.js} +1 -1
  48. package/dist/chunks/{auth-Cjnyy10u.js → auth-5QB6tsfB.js} +1 -1
  49. package/dist/chunks/auth-BIGJth5U.js +1 -0
  50. package/dist/chunks/auth-CDQMhIZP.js +1 -0
  51. package/dist/chunks/{autoMode-CQ5nqP9c.js → autoMode-BnUiK9Cu.js} +5 -5
  52. package/dist/chunks/{autonomy-CPUCe-YU.js → autonomy-C1aSgWPQ.js} +1 -1
  53. package/dist/chunks/autonomy-Src6sKCp.js +15 -0
  54. package/dist/chunks/{autonomyPanel-Ccr9ilei.js → autonomyPanel-DnHpuiy4.js} +1 -1
  55. package/dist/chunks/backgroundHousekeeping-B-cw0UcS.js +17 -0
  56. package/dist/chunks/backgroundHousekeeping-BS_8z3_x.js +1 -0
  57. package/dist/chunks/{banner-BJZNMppT.js → banner-D0P7wXdw.js} +1 -1
  58. package/dist/chunks/bg-50rllUNh.js +1 -0
  59. package/dist/chunks/{bg-w3Vlsm3Y.js → bg-DAPORXF3.js} +2 -2
  60. package/dist/chunks/{branch-CG0AKS1J.js → branch-DFWa4Oxo.js} +2 -2
  61. package/dist/chunks/{break-cache-DXV0brco.js → break-cache-Chj9i9MP.js} +2 -2
  62. package/dist/chunks/{bridgeConfig-vORehbGG.js → bridgeConfig-Bb6URf4Q.js} +1 -1
  63. package/dist/chunks/bridgeConfig-BeqChxJC.js +1 -0
  64. package/dist/chunks/bridgeMessaging-C3huGcR3.js +1 -0
  65. package/dist/chunks/{bridgePointer-D4W9GpWw.js → bridgePointer-DLYyvRKb.js} +1 -1
  66. package/dist/chunks/bridgeStatusUtil-DFMftajD.js +1 -0
  67. package/dist/chunks/{btw-DDUC_t0w.js → btw-DSK9R2C8.js} +1 -1
  68. package/dist/chunks/caches-BTQAW9zc.js +1 -0
  69. package/dist/chunks/caches-BVtSCnV1.js +1 -0
  70. package/dist/chunks/{capacityWake-L7b1mMft.js → capacityWake-amzeeBz0.js} +1 -1
  71. package/dist/chunks/{ccrClient-CG6HTv_n.js → ccrClient-Bu7Tf1Z5.js} +1 -1
  72. package/dist/chunks/{claudeDesktop-CAmnheYx.js → claudeDesktop-CsJfF1b-.js} +1 -1
  73. package/dist/chunks/{clear-DdWexxbM.js → clear-ClFDpWVJ.js} +1 -1
  74. package/dist/chunks/{cliLaunch-BWWOgBFh.js → cliLaunch-BWcoyZDP.js} +1 -1
  75. package/dist/chunks/client-BWQ4-rN7.js +1 -0
  76. package/dist/chunks/{client-CoXtVRzi.js → client-DFlE4fYh.js} +1 -1
  77. package/dist/chunks/client-c-3-PW1F.js +1 -0
  78. package/dist/chunks/commands-Bi7k3Wg-.js +1 -0
  79. package/dist/chunks/compact-J-h0Yf4b.js +2 -0
  80. package/dist/chunks/{config-CVvUNkj2.js → config-CVHMRMwd.js} +1 -1
  81. package/dist/chunks/config-Do1870_d.js +3 -0
  82. package/dist/chunks/config-yyFe87vW.js +1 -0
  83. package/dist/chunks/context-Tb1Ca2Q-.js +1 -0
  84. package/dist/chunks/{context-noninteractive-c7jGVWHQ.js → context-noninteractive-D5iQhasu.js} +2 -2
  85. package/dist/chunks/context-noninteractive-soPYKAc9.js +1 -0
  86. package/dist/chunks/conversation-CSEtUxOY.js +1 -0
  87. package/dist/chunks/conversation-Dk1WDQuN.js +1 -0
  88. package/dist/chunks/{createSSHSession-DP7B8yvb.js → createSSHSession-CJtzNQdZ.js} +1 -1
  89. package/dist/chunks/{createSession-CPo6GBSb.js → createSession-DkT1GL8y.js} +1 -1
  90. package/dist/chunks/createSession-eE8mswkv.js +1 -0
  91. package/dist/chunks/crossProjectResume-04n3Ppy9.js +40 -0
  92. package/dist/chunks/cwd-Cfdf7z7s.js +1 -0
  93. package/dist/chunks/cwd-ClLru_7T.js +1 -0
  94. package/dist/chunks/datadog-DjeJThpV.js +1 -0
  95. package/dist/chunks/{debug-BdqxZ7rV.js → debug-RAynG_nM.js} +1 -1
  96. package/dist/chunks/{debugUtils-CezNYZ-4.js → debugUtils-DX0KAXNK.js} +1 -1
  97. package/dist/chunks/{detached-CkPpYMJj.js → detached-X_yjYR7x.js} +1 -1
  98. package/dist/chunks/{detectRepository-DvxoaPlk.js → detectRepository-DgpNd87p.js} +1 -1
  99. package/dist/chunks/detectRepository-ctF9KDbb.js +1 -0
  100. package/dist/chunks/{diff-DHzz9WAp.js → diff-jEJJe58I.js} +1 -1
  101. package/dist/chunks/{directoryCompletion-D5AvL7TF.js → directoryCompletion-BbXR2bfy.js} +1 -1
  102. package/dist/chunks/doctor-B-Wag4C1.js +1 -0
  103. package/dist/chunks/earlyInput-BEjRkAtH.js +1 -0
  104. package/dist/chunks/{earlyInput-BTC_Wucv.js → earlyInput-IghoCjG5.js} +1 -1
  105. package/dist/chunks/entry-oIqjxIjQ.js +14 -0
  106. package/dist/chunks/esm-Cf4nSRjF.js +1 -0
  107. package/dist/chunks/{execFileNoThrow-5SylUnAI.js → execFileNoThrow-Dwu6psHW.js} +1 -1
  108. package/dist/chunks/{execSyncWrapper-DKuxVTaf.js → execSyncWrapper-BTZJjCuv.js} +1 -1
  109. package/dist/chunks/exit-BtW7LfRX.js +1 -0
  110. package/dist/chunks/{extraUsage-Dt5mw35U.js → extraUsage-Mi66JwFZ.js} +1 -1
  111. package/dist/chunks/extractMemories-CUrdiNcr.js +1 -0
  112. package/dist/chunks/{fast-ClYQcEv5.js → fast-BU4iUZ8E.js} +1 -1
  113. package/dist/chunks/fast-C60p6AqJ.js +1 -0
  114. package/dist/chunks/featureCheck-D6FjD-nt.js +1 -0
  115. package/dist/chunks/featureCheck-JOur3pHb.js +1 -0
  116. package/dist/chunks/{fileSuggestions-fNxREjpe.js → fileSuggestions-BMfQIDdW.js} +1 -1
  117. package/dist/chunks/firstPartyEventLogger-B3cXgR67.js +5 -0
  118. package/dist/chunks/firstPartyEventLogger-BfCYN7lt.js +1 -0
  119. package/dist/chunks/flushGate-DgSDVGKZ.js +1 -0
  120. package/dist/chunks/gemini-BwvSxGgn.js +1 -0
  121. package/dist/chunks/{generateSessionName-nZj_VvKZ.js → generateSessionName-DlrdedOk.js} +1 -1
  122. package/dist/chunks/{genericProcessUtils-BmDSLcMf.js → genericProcessUtils-CmsUPyRz.js} +1 -1
  123. package/dist/chunks/{git-B9uvt96d.js → git-2c7WlGDL.js} +1 -1
  124. package/dist/chunks/git-XtKbtJMc.js +1 -0
  125. package/dist/chunks/{githubRepoPathMapping-Cqx3pSfc.js → githubRepoPathMapping-DbWG4hFQ.js} +1 -1
  126. package/dist/chunks/goal-ZmSRBx4q.js +3 -0
  127. package/dist/chunks/{grok-Dk3LyzMa.js → grok-BXMvezWb.js} +1 -1
  128. package/dist/chunks/{grove-BE4fQ6tG.js → grove-CeOjTaY6.js} +1 -1
  129. package/dist/chunks/help-5DNZO6_H.js +1 -0
  130. package/dist/chunks/{hooks-BrKy5XWQ.js → hooks-C637tFtd.js} +2 -2
  131. package/dist/chunks/hooks-DWg07LmS.js +1 -0
  132. package/dist/chunks/initReplBridge-D1h10vQ9.js +1 -0
  133. package/dist/chunks/{install-CVGZ55wV.js → install-C-6ItpH0.js} +1 -1
  134. package/dist/chunks/{instrumentation-BmWotlxR.js → instrumentation-DaiPDUst.js} +4 -4
  135. package/dist/chunks/intl-D2kgJmX7.js +1 -0
  136. package/dist/chunks/{job-DEXxW_Zo.js → job-BeYzQUiR.js} +1 -1
  137. package/dist/chunks/{jwtUtils-C9sdGhvT.js → jwtUtils-CUPXdX3W.js} +1 -1
  138. package/dist/chunks/keybindings-DgIPdBy9.js +2 -0
  139. package/dist/chunks/{launchLocalMemory-CLSSVFoj.js → launchLocalMemory-CE4J98xO.js} +2 -2
  140. package/dist/chunks/{launchOnboarding-BkJfKviO.js → launchOnboarding-BfTdC6vp.js} +1 -1
  141. package/dist/chunks/{loadAgentsDir-CKSb56Gp.js → loadAgentsDir-C7lOqvfh.js} +2194 -2329
  142. package/dist/chunks/loadAgentsDir-zikjxLvn.js +1 -0
  143. package/dist/chunks/loadPluginHooks-Cp8MSwAc.js +1 -0
  144. package/dist/chunks/{localSearch-CPOnyi8I.js → localSearch-BKrznW5x.js} +1 -1
  145. package/dist/chunks/localSearch-ZFyFy5FN.js +1 -0
  146. package/dist/chunks/log-CezCRpAN.js +1 -0
  147. package/dist/chunks/{logoV2Utils-we1sfJvf.js → logoV2Utils-BkQfyQ1-.js} +1 -1
  148. package/dist/chunks/{magicDocs-DmKlTQvK.js → magicDocs-BpVcON9o.js} +2 -2
  149. package/dist/chunks/{main-BIiwW4mM.js → main-9r5gLzUW.js} +55 -55
  150. package/dist/chunks/{main-ClXu1ilx.js → main-CvOv59-7.js} +4 -4
  151. package/dist/chunks/managedEnv-B61yLpwp.js +1 -0
  152. package/dist/chunks/{managedEnv-Cl7YbYzf.js → managedEnv-DhWRJ5DK.js} +1 -1
  153. package/dist/chunks/{mappers-xQC-Z4-h.js → mappers-bOab8ipV.js} +1 -1
  154. package/dist/chunks/mcp-BckPBjaM.js +6 -0
  155. package/dist/chunks/mcp-CS1DA3JL.js +1 -0
  156. package/dist/chunks/mcp-VcGPYCkW.js +2 -0
  157. package/dist/chunks/{memoize-FJv2HV1u.js → memoize-DsqYrbeR.js} +1 -1
  158. package/dist/chunks/memory-C5ohwh-T.js +1 -0
  159. package/dist/chunks/{mode-lYTs0XHs.js → mode-DlKnUM8l.js} +2 -2
  160. package/dist/chunks/model-BGu1AGq0.js +1 -0
  161. package/dist/chunks/model-BsZ4sP_H.js +1 -0
  162. package/dist/chunks/model-D19IIcll.js +1 -0
  163. package/dist/chunks/{modelOptions-efCGKnXT.js → modelOptions-CxP067Qv.js} +1 -1
  164. package/dist/chunks/nativeInstaller-QB8cEJ18.js +1 -0
  165. package/dist/chunks/omit-DDUIPHnl.js +1 -0
  166. package/dist/chunks/onChangeAppState-RBl6H7ho.js +1 -0
  167. package/dist/chunks/{openai-DJLYqiRl.js → openai-B9C2XN5Q.js} +3 -3
  168. package/dist/chunks/{panel-q0_iT9cg.js → panel-KW-wmEvU.js} +1 -1
  169. package/dist/chunks/{parser-BdCj2GrE.js → parser-BwPXQomy.js} +1 -1
  170. package/dist/chunks/parser-xSBaQRLH.js +1 -0
  171. package/dist/chunks/partition-D-UhsUCx.js +1 -0
  172. package/dist/chunks/permissions-BoLXYN1j.js +3 -0
  173. package/dist/chunks/{pidLock-BR5M6RQw.js → pidLock-nJHbufJN.js} +2 -2
  174. package/dist/chunks/plan-CyU2zrCK.js +1 -0
  175. package/dist/chunks/{platform-D6IMiyqT.js → platform-BMPbglug.js} +1 -1
  176. package/dist/chunks/plugin-C6-GQke5.js +17 -0
  177. package/dist/chunks/pluginAutoupdate-SlRFJlTT.js +1 -0
  178. package/dist/chunks/pluginBlocklist-n6Imlh3y.js +1 -0
  179. package/dist/chunks/pluginCliCommands-Bd96zSOQ.js +1 -0
  180. package/dist/chunks/{pluginFlagging-CxuRF2Vc.js → pluginFlagging-DZaYzecY.js} +1 -1
  181. package/dist/chunks/pluginOperations-D90IRawu.js +2 -0
  182. package/dist/chunks/pluginStartupCheck-Bxkxpm4k.js +1 -0
  183. package/dist/chunks/{pluginStartupCheck-B6leNWq9.js → pluginStartupCheck-CB2q2dLv.js} +1 -1
  184. package/dist/chunks/plugins-B9eSjLSA.js +4 -0
  185. package/dist/chunks/poorMode-BAnubpn1.js +1 -0
  186. package/dist/chunks/{poorMode-BxsyllUK.js → poorMode-DEwQOAJt.js} +1 -1
  187. package/dist/chunks/print-eCRv_Li-.js +26 -0
  188. package/dist/chunks/processBashCommand-B5F2Cl7K.js +1 -0
  189. package/dist/chunks/processSlashCommand-BC_D3cH5.js +5 -0
  190. package/dist/chunks/prompt-C1JPqinc.js +1 -0
  191. package/dist/chunks/prompt-DZhBz_Vu.js +1 -0
  192. package/dist/chunks/{prompt-CybUvG8G.js → prompt-M2lu8_Oa.js} +34 -34
  193. package/dist/chunks/{promptEditor-0Ug93P2I.js → promptEditor-DhcZY-iu.js} +2 -2
  194. package/dist/chunks/{protocolHandler-ClfbHTjI.js → protocolHandler-CkFaJKKo.js} +1 -1
  195. package/dist/chunks/{proxy-Blq4W6Ox.js → proxy-CuMaO_YV.js} +1 -1
  196. package/dist/chunks/reconciler-B4GDm_iC.js +1 -0
  197. package/dist/chunks/refresh-DBVizOzg.js +1 -0
  198. package/dist/chunks/{registerProtocol-3_ozAuDK.js → registerProtocol-CsNYRZKr.js} +1 -1
  199. package/dist/chunks/{reload-plugins-Dn1ibOiI.js → reload-plugins-B7JAE3b4.js} +1 -1
  200. package/dist/chunks/{remoteBridgeCore-Dpg6Se9C.js → remoteBridgeCore-CFLJhsB6.js} +1 -1
  201. package/dist/chunks/{remoteManagedSettings-CCrq-qL-.js → remoteManagedSettings-xh_MViZH.js} +1 -1
  202. package/dist/chunks/rename-BCp2Vtqu.js +1 -0
  203. package/dist/chunks/{renderOptions-CLcco6fc.js → renderOptions-Q5oCLFIC.js} +1 -1
  204. package/dist/chunks/resume-DVCSzKvv.js +2 -0
  205. package/dist/chunks/{ripgrep-DkL2S7-I.js → ripgrep-DvOOsDMv.js} +1 -1
  206. package/dist/chunks/ripgrep-e-iewvTf.js +1 -0
  207. package/dist/chunks/{runtimeObserver-DonWCJOx.js → runtimeObserver-CS_3BDNo.js} +4 -4
  208. package/dist/chunks/{runtimeObserver-B0xfyLiA.js → runtimeObserver-DYUva6g-.js} +1 -1
  209. package/dist/chunks/sandbox-adapter-BFZFHplu.js +1 -0
  210. package/dist/chunks/{sandbox-toggle-CSdnHWp-.js → sandbox-toggle--zNSKce_.js} +1 -1
  211. package/dist/chunks/searchExtraTools-ui5y2VSE.js +1 -0
  212. package/dist/chunks/{session-BbQlh2S5.js → session-CO3gEqQP.js} +2 -2
  213. package/dist/chunks/sessionFileAccessHooks-CZvCqQJ6.js +1 -0
  214. package/dist/chunks/sessionObserver-Ba7um95p.js +1 -0
  215. package/dist/chunks/{sessionObserver-XV6N0XER.js → sessionObserver-YkRHC-Aa.js} +1 -1
  216. package/dist/chunks/sessionState-Bifmu95-.js +11 -0
  217. package/dist/chunks/sessionStorage-CedwLLQs.js +1 -0
  218. package/dist/chunks/{sessionTitle-E1FvsKM9.js → sessionTitle-COBSgSXS.js} +2 -2
  219. package/dist/chunks/{sessionTracing-ClGQ08jM.js → sessionTracing-BrNx1k2V.js} +2 -2
  220. package/dist/chunks/settings-DkDH7WQT.js +1 -0
  221. package/dist/chunks/{settings-Xbq6AaD-.js → settings-DnptdP79.js} +5 -5
  222. package/dist/chunks/settingsSync-PmU7SmkU.js +1 -0
  223. package/dist/chunks/setup-BEsBuzsk.js +3 -0
  224. package/dist/chunks/{shadowedRuleDetection-B9iSx6mB.js → shadowedRuleDetection-DEaw-X5j.js} +1 -1
  225. package/dist/chunks/{shellQuote-Bth6IZgX.js → shellQuote-BYeOv3Ip.js} +1 -1
  226. package/dist/chunks/{sideQuestion-D2dPToW8.js → sideQuestion-D0OKljee.js} +3 -3
  227. package/dist/chunks/sinks-BJHgxz6Y.js +1 -0
  228. package/dist/chunks/sinks-D5-yhcgU.js +2 -0
  229. package/dist/chunks/skillChangeDetector-Dd0WPdkO.js +1 -0
  230. package/dist/chunks/{skillGapStore-DylpOKJ6.js → skillGapStore-N_kmvXML.js} +2 -2
  231. package/dist/chunks/{skillLifecycle-GK-8eyyn.js → skillLifecycle-C4F5RXuh.js} +2 -2
  232. package/dist/chunks/{skillSearchPanel-mpaC62y4.js → skillSearchPanel-CftorvAM.js} +3 -3
  233. package/dist/chunks/{skills-t6krW8GZ.js → skills-C4CTRN9o.js} +1 -1
  234. package/dist/chunks/startupProfiler-D4FBdEQr.js +1 -0
  235. package/dist/chunks/{startupProfiler-jeId9f2i.js → startupProfiler-L_UWZ03w.js} +2 -2
  236. package/dist/chunks/state-BemZdQIl.js +1 -0
  237. package/dist/chunks/state-D_lk6z-C.js +1 -0
  238. package/dist/chunks/{stats-BJBhl-Lc.js → stats-IzV0_vEc.js} +1 -1
  239. package/dist/chunks/{status-BtsnKNVY.js → status-CeVP_uDT.js} +1 -1
  240. package/dist/chunks/status-Dzuw3hBv.js +2 -0
  241. package/dist/chunks/statusNoticeHelpers-Bb9gxdSt.js +1 -0
  242. package/dist/chunks/{stringUtils-CbS6OkmE.js → stringUtils-C84IJ91d.js} +1 -1
  243. package/dist/chunks/switcher-4KzBvuKH.js +1 -0
  244. package/dist/chunks/{switcher-77h2J5HC.js → switcher-CCs9xl1z.js} +1 -1
  245. package/dist/chunks/{syncCache-By_-buUC.js → syncCache-CBRiRU5x.js} +1 -1
  246. package/dist/chunks/{tasks-BNrdmF9p.js → tasks-DZDhgx0w.js} +1 -1
  247. package/dist/chunks/teleport-Bw0jSxe9.js +1 -0
  248. package/dist/chunks/{templateJobs-Dkv4I9c1.js → templateJobs-CrNPEKkh.js} +1 -1
  249. package/dist/chunks/{terminalSetup-DQopnSPR.js → terminalSetup-CBqcwQll.js} +1 -1
  250. package/dist/chunks/{terminalSetup-DTGm1Eo2.js → terminalSetup-D-N8YPiQ.js} +1 -1
  251. package/dist/chunks/{theme-BjpBVRf5.js → theme-Dazsirbw.js} +1 -1
  252. package/dist/chunks/{tmux-CMRiI6CD.js → tmux-DewYVEBm.js} +1 -1
  253. package/dist/chunks/{toolEventObserver-D-sNBvOe.js → toolEventObserver-lnHJ9fLQ.js} +1 -1
  254. package/dist/chunks/toolPool-CkXFlqsn.js +1 -0
  255. package/dist/chunks/{trustedDevice-j1u2TG5U.js → trustedDevice-CFf5yaG-.js} +1 -1
  256. package/dist/chunks/trustedDevice-CuwSv8dG.js +1 -0
  257. package/dist/chunks/{types-DWRxAH0E.js → types-3j8PS-Du.js} +1 -1
  258. package/dist/chunks/{udsClient-Cm3HqYUu.js → udsClient-e9dIkwVA.js} +1 -1
  259. package/dist/chunks/{updateCCB-BlUAU2Vp.js → updateCCB-BPe9_FW6.js} +1 -1
  260. package/dist/chunks/{upstreamproxy-DDVMwoRi.js → upstreamproxy-DF00RzGG.js} +1 -1
  261. package/dist/chunks/{useExitOnCtrlCDWithKeybindings-D2FvHieH.js → useExitOnCtrlCDWithKeybindings-ChqBs9Lr.js} +1 -1
  262. package/dist/chunks/useMainLoopModel-2-eujv0n.js +1 -0
  263. package/dist/chunks/useManagePlugins-CYBIkaB1.js +1 -0
  264. package/dist/chunks/{useMergedTools-B-Z9XQ6U.js → useMergedTools-Dk5cPqLc.js} +1 -1
  265. package/dist/chunks/{useSearchInput-C6d6nt9S.js → useSearchInput-C7Y1I9P9.js} +1 -1
  266. package/dist/chunks/useSettingsErrors-DAEO7AyB.js +1 -0
  267. package/dist/chunks/{userAgent-Ng_TTjWr.js → userAgent-CIq27vUR.js} +1 -1
  268. package/dist/chunks/util-VO98TdOz.js +1 -0
  269. package/dist/chunks/validatePlugin-Kk6pxnO2.js +1 -0
  270. package/dist/chunks/{vim-3mUqsEJm.js → vim-EYQn94Kx.js} +1 -1
  271. package/dist/chunks/{which-DznMOwny.js → which-DzFN5TNM.js} +1 -1
  272. package/dist/chunks/{windowsPaths-BVztIhXM.js → windowsPaths-BU3yQWTB.js} +1 -1
  273. package/dist/chunks/windowsPaths-DgZ3YY4a.js +1 -0
  274. package/dist/chunks/{workSecret-DtiFreRl.js → workSecret-DUqdPy44.js} +1 -1
  275. package/dist/chunks/workerRegistry-C07BcZIw.js +6 -0
  276. package/dist/chunks/worktree-dFUkhVE_.js +1 -0
  277. package/dist/cli.js +1 -1
  278. package/package.json +1 -1
  279. package/dist/chunks/App-DW4elk6E.js +0 -1
  280. package/dist/chunks/ApproveApiKey-D05WywHU.js +0 -1
  281. package/dist/chunks/BackgroundTasksDialog-QgFwoaaC.js +0 -2
  282. package/dist/chunks/ClaudeMdExternalIncludesDialog-DpecRCAt.js +0 -1
  283. package/dist/chunks/ConsoleOAuthFlow-D1MYL1dJ.js +0 -1
  284. package/dist/chunks/Doctor-D160J8Ad.js +0 -3
  285. package/dist/chunks/Doctor-VhJi2cmL.js +0 -1
  286. package/dist/chunks/ExitFlow-CoWHhKHJ.js +0 -2
  287. package/dist/chunks/MCPConnectionManager-DPFe4hPh.js +0 -1
  288. package/dist/chunks/MCPToolListView-BPmE0C2o.js +0 -1
  289. package/dist/chunks/MessageSelector-kOn2GaU-.js +0 -3
  290. package/dist/chunks/Messages-4EnHFeh1.js +0 -11
  291. package/dist/chunks/PromptInputHelpMenu-BvcAzbSi.js +0 -1
  292. package/dist/chunks/QueryEngine-J6ElcO16.js +0 -1
  293. package/dist/chunks/REPL-DBjbAJsm.js +0 -133
  294. package/dist/chunks/REPL-oBemMXvp.js +0 -1
  295. package/dist/chunks/RemoteSessionManager-CoIyFKKa.js +0 -2
  296. package/dist/chunks/ResumeConversation-wBG8OD9P.js +0 -1
  297. package/dist/chunks/SearchExtraToolsTool-BugrzImr.js +0 -1
  298. package/dist/chunks/Settings-DptKuJE7.js +0 -2
  299. package/dist/chunks/WelcomeV2-BWF-cJOu.js +0 -1
  300. package/dist/chunks/add-dir-DBVT1cEK.js +0 -1
  301. package/dist/chunks/agents-CnwTOlqO.js +0 -103
  302. package/dist/chunks/allErrors-DYw_q14e.js +0 -1
  303. package/dist/chunks/api-DXDXTFGa.js +0 -1
  304. package/dist/chunks/attributionTrailer-oKKrF3z8.js +0 -1
  305. package/dist/chunks/auth-CnLb6RWc.js +0 -1
  306. package/dist/chunks/auth-D-SGHS0K.js +0 -1
  307. package/dist/chunks/autonomy-dSJl0hN1.js +0 -15
  308. package/dist/chunks/backgroundHousekeeping--cs5crp7.js +0 -17
  309. package/dist/chunks/backgroundHousekeeping-CcbHitKC.js +0 -1
  310. package/dist/chunks/bg-DWloqGwk.js +0 -1
  311. package/dist/chunks/bridgeConfig-Dmc1ZDev.js +0 -1
  312. package/dist/chunks/bridgeMessaging-DlczTV9X.js +0 -1
  313. package/dist/chunks/caches-1IFb6_M_.js +0 -1
  314. package/dist/chunks/caches-CB8MHqy2.js +0 -1
  315. package/dist/chunks/client-Crrwkw7g.js +0 -1
  316. package/dist/chunks/client-D8hKghba.js +0 -1
  317. package/dist/chunks/color-Cuq0c6xy.js +0 -1
  318. package/dist/chunks/commands-D3sESsTp.js +0 -1
  319. package/dist/chunks/compact-DIpwuBDq.js +0 -2
  320. package/dist/chunks/config-D4G8_MqJ.js +0 -3
  321. package/dist/chunks/config-q9D4hFiK.js +0 -1
  322. package/dist/chunks/context-BWcfhhDj.js +0 -1
  323. package/dist/chunks/context-noninteractive-Bwt9A3XD.js +0 -1
  324. package/dist/chunks/conversation-Bjo_8kia.js +0 -1
  325. package/dist/chunks/conversation-DrHZIQX2.js +0 -1
  326. package/dist/chunks/createSession-DnykRoia.js +0 -1
  327. package/dist/chunks/crossProjectResume-D2A-qjgP.js +0 -40
  328. package/dist/chunks/cwd--q1ONL7P.js +0 -1
  329. package/dist/chunks/cwd-L4wygFqJ.js +0 -1
  330. package/dist/chunks/daemon-D2vFIVOz.js +0 -2
  331. package/dist/chunks/datadog-DrmHyl3_.js +0 -1
  332. package/dist/chunks/detectRepository-DA1Q_Skc.js +0 -1
  333. package/dist/chunks/doctor-PWqB46xd.js +0 -1
  334. package/dist/chunks/earlyInput-xcoTbKQn.js +0 -1
  335. package/dist/chunks/entry-4JtoJONR.js +0 -14
  336. package/dist/chunks/esm-DcIr7tVd.js +0 -1
  337. package/dist/chunks/exit-OW9g7b9A.js +0 -1
  338. package/dist/chunks/extractMemories-1VlmCGwa.js +0 -1
  339. package/dist/chunks/fast-CrvLdpy3.js +0 -1
  340. package/dist/chunks/featureCheck-CrJeuheQ.js +0 -1
  341. package/dist/chunks/featureCheck-HslM03dr.js +0 -1
  342. package/dist/chunks/firstPartyEventLogger-BBXEQUf0.js +0 -1
  343. package/dist/chunks/firstPartyEventLogger-DhEPWcit.js +0 -5
  344. package/dist/chunks/flushGate-ch-Tvwjj.js +0 -1
  345. package/dist/chunks/gemini-fZ0VPU2A.js +0 -1
  346. package/dist/chunks/generateRecap-BIBVlB__.js +0 -1
  347. package/dist/chunks/git-BfS5Hk4S.js +0 -1
  348. package/dist/chunks/goal-IasZVqKh.js +0 -3
  349. package/dist/chunks/help-D2-v9Ug9.js +0 -1
  350. package/dist/chunks/hooks-DGd02IKF.js +0 -1
  351. package/dist/chunks/initReplBridge-RhCAlmHE.js +0 -1
  352. package/dist/chunks/intl-cKc-V6Mq.js +0 -1
  353. package/dist/chunks/keybindings-BRdSOSUD.js +0 -2
  354. package/dist/chunks/language-C0cIpKE2.js +0 -1
  355. package/dist/chunks/language-CxThoWRC.js +0 -1
  356. package/dist/chunks/loadAgentsDir-8UprzS4w.js +0 -1
  357. package/dist/chunks/loadPluginHooks-LbaURHVH.js +0 -1
  358. package/dist/chunks/localSearch-DNjbr4S9.js +0 -1
  359. package/dist/chunks/log-CTFl4qpD.js +0 -1
  360. package/dist/chunks/managedEnv-CpiiQx_v.js +0 -1
  361. package/dist/chunks/mcp-B_m1XBDt.js +0 -6
  362. package/dist/chunks/mcp-BiyfH9Sd.js +0 -1
  363. package/dist/chunks/mcp-BjlaPUWX.js +0 -2
  364. package/dist/chunks/memory-LN8f_p2b.js +0 -1
  365. package/dist/chunks/model-C2e73CJD.js +0 -1
  366. package/dist/chunks/model-CvmS-Esk.js +0 -1
  367. package/dist/chunks/model-DJ8mFfuR.js +0 -1
  368. package/dist/chunks/nativeInstaller-DQIFwdat.js +0 -1
  369. package/dist/chunks/omit-CLPZGevl.js +0 -1
  370. package/dist/chunks/onChangeAppState-DhBO34OK.js +0 -1
  371. package/dist/chunks/panelCall-sum-3zvi.js +0 -1
  372. package/dist/chunks/parser-BcdhBGx0.js +0 -1
  373. package/dist/chunks/partition-CpfoVrg1.js +0 -1
  374. package/dist/chunks/permissions-DTb9wkAP.js +0 -3
  375. package/dist/chunks/pipeTransport-B3TIkTAp.js +0 -1
  376. package/dist/chunks/plan-BeoIjNPv.js +0 -1
  377. package/dist/chunks/plugin-D_dHjTud.js +0 -17
  378. package/dist/chunks/pluginAutoupdate-BHKlOOXI.js +0 -1
  379. package/dist/chunks/pluginBlocklist-D93Hd1GF.js +0 -1
  380. package/dist/chunks/pluginCliCommands-vv0wNt4O.js +0 -1
  381. package/dist/chunks/pluginOperations-BTq4AjYB.js +0 -2
  382. package/dist/chunks/pluginStartupCheck-DBOCHUHQ.js +0 -1
  383. package/dist/chunks/plugins-pmipe7kE.js +0 -4
  384. package/dist/chunks/poorMode-iV1NwC5L.js +0 -1
  385. package/dist/chunks/print-CAUvczBM.js +0 -23
  386. package/dist/chunks/processBashCommand-CdeQg_c6.js +0 -1
  387. package/dist/chunks/processSlashCommand-CbkshIC6.js +0 -5
  388. package/dist/chunks/prompt-RBn4JdEg.js +0 -1
  389. package/dist/chunks/prompt-Rb8zXlDo.js +0 -1
  390. package/dist/chunks/reconciler-Drq3HSkj.js +0 -4
  391. package/dist/chunks/refresh-D8TLHO_T.js +0 -1
  392. package/dist/chunks/rename-CKsSc7Z3.js +0 -1
  393. package/dist/chunks/replBridgeHandle-DNC797_T.js +0 -1
  394. package/dist/chunks/resume-B1a5gLVR.js +0 -2
  395. package/dist/chunks/ripgrep-BisRODQ2.js +0 -1
  396. package/dist/chunks/sandbox-adapter-BnBOSkKJ.js +0 -1
  397. package/dist/chunks/searchExtraTools-DbgfnQkH.js +0 -1
  398. package/dist/chunks/sessionFileAccessHooks-Xfr1NiXG.js +0 -1
  399. package/dist/chunks/sessionMemory-7UOFdp29.js +0 -1
  400. package/dist/chunks/sessionMemory-fAzgAS7Q.js +0 -1
  401. package/dist/chunks/sessionMemoryUtils-DVjFw5Bd.js +0 -1
  402. package/dist/chunks/sessionObserver-Cl26OdaW.js +0 -1
  403. package/dist/chunks/sessionState-BvECKycx.js +0 -11
  404. package/dist/chunks/sessionStorage-DSj9yZkl.js +0 -1
  405. package/dist/chunks/settings-B-R9ZJNY.js +0 -1
  406. package/dist/chunks/settingsSync-NCN0a4sc.js +0 -1
  407. package/dist/chunks/setup-uZ0dSekt.js +0 -3
  408. package/dist/chunks/sinks-C7q46rvE.js +0 -2
  409. package/dist/chunks/sinks-D3bXeHlQ.js +0 -1
  410. package/dist/chunks/skillChangeDetector-C1EJ7rUL.js +0 -1
  411. package/dist/chunks/startupProfiler-BaiXZ9tr.js +0 -1
  412. package/dist/chunks/state-B4HwLt8i.js +0 -1
  413. package/dist/chunks/state-Bs5xweDL.js +0 -1
  414. package/dist/chunks/status-nZQEar7T.js +0 -2
  415. package/dist/chunks/statusNoticeHelpers-DMqRGFOh.js +0 -1
  416. package/dist/chunks/switcher-B2CYzCC_.js +0 -1
  417. package/dist/chunks/teleport-mdnhIZBj.js +0 -1
  418. package/dist/chunks/toolPool-Di30gn_Y.js +0 -1
  419. package/dist/chunks/trustedDevice-CupLMpO8.js +0 -1
  420. package/dist/chunks/useMainLoopModel-ylPQNj7Z.js +0 -1
  421. package/dist/chunks/useManagePlugins-BbWJNLe8.js +0 -1
  422. package/dist/chunks/useSettingsErrors-DKh4rkGi.js +0 -1
  423. package/dist/chunks/util-D-X8i5Z2.js +0 -1
  424. package/dist/chunks/validatePlugin-DSw08u76.js +0 -1
  425. package/dist/chunks/windowsPaths-1mgenSWa.js +0 -1
  426. package/dist/chunks/workerRegistry-DdOYjLm3.js +0 -6
  427. package/dist/chunks/worktree-BX1ULzrw.js +0 -1
@@ -1,4 +1,4 @@
1
- import{a as e,i as t,n,o as r,r as i,t as a}from"./rolldown-runtime-DaDcL9Zw.js";import{n as o,t as s}from"./memoize-BK3gG5ob.js";import{a as c,d as l,f as u,l as d,o as f,s as p,u as m}from"./envUtils-BDhHQY0-.js";import{n as ee,t as h}from"./defineProperty-C-QyHrDq.js";import{n as g,t as te}from"./axios-DaWTGg7G.js";import{$S as ne,AC as re,Af as ie,Ar as _,Au as v,Bw as y,C as ae,CC as oe,Cf as se,Ci as ce,Cp as le,Ct as ue,Cu as de,Cx as fe,Cy as pe,Df as me,Do as he,Du as ge,EC as _e,EE as ve,Ef as ye,Et as be,Eu as xe,F as Se,FC as Ce,Fu as we,Fw as Te,Fy as Ee,Gc as De,Gf as Oe,Gi as ke,Hd as Ae,Hw as je,Ia as Me,In as Ne,Io as Pe,Ix as Fe,Iy as Ie,JS as b,JT as Le,Jd as Re,Ji as ze,KS as Be,Kf as Ve,Ln as x,Lo as He,Lw as Ue,M as We,MC as S,Mf as Ge,Mn as Ke,Mp as qe,Mx as Je,Na as Ye,Ni as Xe,O as Ze,OC as Qe,Oc as $e,Ou as et,PC as tt,Pc as nt,Pi as rt,Pp as it,Pu as at,Pw as ot,Px as st,QS as ct,QT as lt,Qa as ut,Qp as dt,Ro as C,Rw as ft,Rx as pt,SC as mt,SS as ht,Sf as gt,Sr as _t,Ss as vt,Su as yt,T as bt,TC as xt,TE as St,Tf as Ct,Tl as wt,To as Tt,Tt as Et,Tu as Dt,Tx as Ot,Ty as kt,Ui as At,Uw as jt,VC as Mt,WS as Nt,Wc as Pt,XS as Ft,Xl as It,Xm as Lt,YS as Rt,Ym as zt,Yn as Bt,Yp as w,Ys as Vt,ZS as T,Zl as Ht,_C as Ut,_c as Wt,_f as Gt,_l as E,_m as D,_u as Kt,aC as O,aE as qt,ag as Jt,at as Yt,av as Xt,bE as Zt,bS as Qt,bs as $t,bv as en,bx as tn,cC as nn,cE as rn,cg as an,dC as on,dD as sn,dc as cn,dd as ln,df as un,dl as dn,eC as fn,f as pn,fD as mn,fE as hn,fc as gn,ff as _n,fl as vn,gb as yn,gf as k,gl as bn,hf as xn,hi as Sn,ho as Cn,hu as wn,i as Tn,iC as En,it as A,jC as Dn,jc as On,jp as kn,ju as An,kc as jn,kt as Mn,lC as Nn,lD as Pn,lg as Fn,mS as In,mc as Ln,md as Rn,mf as zn,mo as Bn,mu as Vn,my as Hn,nC as Un,na as Wn,o as Gn,ov as Kn,pE as qn,pb as Jn,pd as Yn,py as Xn,qf as Zn,qs as Qn,r as $n,rC as er,rE as tr,s as nr,sC as rr,sD as ir,sg as ar,tC as or,tE as sr,ta as cr,uC as lr,uc as ur,ud as dr,uf as j,v as fr,vf as pr,vm as mr,vr as hr,w as gr,wC as _r,wf as vr,wi as yr,wl as br,wp as xr,wu as Sr,wx as Cr,wy as wr,xC as Tr,xS as Er,xf as Dr,xo as Or,xu as kr,xv as Ar,xx as jr,y as Mr,yC as Nr,yE as Pr,yf as Fr,yx as Ir,zC as Lr,zi as Rr,zo as zr,zw as Br}from"./loadAgentsDir-CKSb56Gp.js";import{B as Vr,D as Hr,I as Ur,Lt as Wr,P as Gr,R as Kr,T as qr,di as Jr,fi as Yr,rr as Xr,t as Zr,ui as M,xr as Qr,y as $r}from"./src-P_wYS_NJ2.js";import{t as ei}from"./jsx-runtime-Bb4Xn-E0.js";import{A as N,M as ti,O as ni,j as ri,l as ii,p as ai,u as oi,w as si}from"./external-CEp-aPkt.js";import{n as ci,r as li,t as ui}from"./lazySchema-B4D4qJVE.js";import{$n as di,Cn as fi,F as pi,Fn as mi,Hn as hi,In as gi,Jn as _i,Kt as vi,Pn as yi,Sn as bi,Tn as xi,Xn as Si,Y as Ci,Zn as wi,br as Ti,cn as Ei,dn as Di,er as Oi,ft as ki,ir as Ai,lr as ji,mn as Mi,mt as Ni,nr as Pi,on as Fi,pn as Ii,pt as Li,tr as Ri,tt as zi,vn as Bi,wn as Vi,yr as Hi,z as Ui}from"./state-Bs5xweDL.js";import{n as Wi,t as Gi}from"./cwd-L4wygFqJ.js";import{C as Ki,E as qi,F as P,I as Ji,N as Yi,S as Xi,V as Zi,W as Qi,_ as $i,a as ea,d as ta,k as na,l as F,n as ra,nt as ia,p as aa,r as oa,rt as sa,u as ca,w as la,z as ua}from"./debug-BdqxZ7rV.js";import{In as da,J as fa,Ln as pa,O as ma,Q as ha,S as ga,T as _a,c as va,cn as ya,f as ba,g as I,h as xa,i as Sa,jt as Ca,k as wa,n as Ta,s as Ea,u as Da,un as Oa,x as L,zt as ka}from"./settings-Xbq6AaD-.js";import{M as Aa,P as ja,T as Ma,_ as Na,c as R,g as Pa,h as z,k as Fa,n as Ia,o as La,p as Ra,r as za,s as Ba,v as Va,w as Ha,y as B}from"./config-D4G8_MqJ.js";import{a as Ua,n as Wa,r as Ga}from"./process-gEbdy6uY.js";import{O as Ka,f as qa,i as Ja,k as V,l as Ya,m as Xa,u as Za}from"./git-B9uvt96d.js";import{c as Qa,o as $a}from"./execFileNoThrow-5SylUnAI.js";import{d as eo,f as to,o as no,s as H}from"./log-CTFl4qpD.js";import{n as ro,t as io}from"./which-DznMOwny.js";import{i as ao,o as oo}from"./platform-D6IMiyqT.js";import{i as so,o as co}from"./windowsPaths-BVztIhXM.js";import{s as lo,u as uo}from"./types-DWRxAH0E.js";import{n as U,r as W}from"./analytics-DJobLaWP.js";import{i as fo,n as po,r as G,u as mo,v as ho}from"./startupProfiler-jeId9f2i.js";import{l as go,s as _o,u as vo}from"./oauth-C9VBDB0Y.js";import{n as yo,t as bo}from"./bundledMode--fG1S62b.js";import{l as xo,o as So}from"./stringUtils-CbS6OkmE.js";import{$t as Co,Bt as wo,C as To,Dn as Eo,Fr as Do,Ft as Oo,Gr as ko,Jn as Ao,Kn as jo,Ot as Mo,Rr as No,S as Po,Sr as Fo,Vn as Io,Xt as Lo,Yn as Ro,Z as zo,_ as Bo,ai as Vo,an as Ho,ar as Uo,b as Wo,bn as Go,en as Ko,et as qo,g as Jo,in as Yo,ir as Xo,jn as Zo,lt as Qo,nr as $o,o as es,pn as ts,qr as ns,rr as rs,rt as is,si as as,ut as os,v as ss,xn as cs,xr as ls,xt as us,yn as ds,zt as fs}from"./model-C2e73CJD.js";import{At as ps,Ct as ms,Mt as hs,Ot as gs,Tt as _s,at as vs,jt as ys,ot as bs,st as xs,wt as Ss,yt as Cs}from"./prompt-CybUvG8G.js";import{f as ws,h as Ts,l as Es,n as Ds}from"./proxy-Blq4W6Ox.js";import{n as Os,t as ks}from"./userAgent-Ng_TTjWr.js";import{C as As,D as js,F as Ms,I as Ns}from"./sessionState-BvECKycx.js";import{dt as Ps,ft as Fs}from"./esm-DcIr7tVd.js";import{n as Is,t as Ls}from"./partition-CpfoVrg1.js";import{a as Rs,n as zs}from"./ripgrep-DkL2S7-I.js";import{C as Bs,D as Vs,O as Hs,S as Us}from"./sessionTracing-ClGQ08jM.js";import{i as Ws,n as Gs,o as Ks,r as qs}from"./detectRepository-DvxoaPlk.js";import{c as Js,o as Ys,r as Xs}from"./api-DzccRM_z.js";import{d as Zs,f as Qs,l as $s,p as ec,u as tc}from"./firstPartyEventLogger-DhEPWcit.js";import{n as nc,t as rc}from"./worktreeModeEnabled-BFOYTTTr.js";import{c as ic}from"./switcher-77h2J5HC.js";import{a as ac}from"./grove-BE4fQ6tG.js";import{a as oc,i as sc,n as cc,o as lc,r as uc}from"./remoteManagedSettings-CCrq-qL-.js";import{n as dc,t as fc}from"./allErrors-DYw_q14e.js";import{n as K,t as q}from"./exit-BOhGfSlm.js";import{n as pc,s as mc,t as hc}from"./pluginOperations-BTq4AjYB.js";import"./pluginCliCommands-vv0wNt4O.js";import{n as gc,r as _c,t as vc}from"./managedEnv-Cl7YbYzf.js";import{n as yc}from"./onChangeAppState-DhBO34OK.js";import{i as bc,t as xc}from"./skillChangeDetector-C1EJ7rUL.js";import{n as Sc}from"./stats-BJBhl-Lc.js";import{t as Cc}from"./renderOptions-CLcco6fc.js";import{i as wc,n as Tc,t as Ec}from"./githubRepoPathMapping-Cqx3pSfc.js";import{i as Dc,n as Oc}from"./earlyInput-BTC_Wucv.js";import{t as kc}from"./banner-BJZNMppT.js";import{c as Ac,n as jc,o as Mc,r as Nc}from"./RemoteSessionManager-CoIyFKKa.js";import{posix as Pc,resolve as Fc,win32 as Ic}from"path";import{appendFileSync as Lc,readFileSync as Rc}from"fs";import{open as zc,stat as Bc}from"fs/promises";var Vc=a((e=>{var t=class extends Error{constructor(e,t,n){super(n),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=t,this.exitCode=e,this.nestedError=void 0}},n=class extends t{constructor(e){super(1,`commander.invalidArgument`,e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};e.CommanderError=t,e.InvalidArgumentError=n})),Hc=a((e=>{var{InvalidArgumentError:t}=Vc(),n=class{constructor(e,t){switch(this.description=t||``,this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,e[0]){case`<`:this.required=!0,this._name=e.slice(1,-1);break;case`[`:this.required=!1,this._name=e.slice(1,-1);break;default:this.required=!0,this._name=e;break}this._name.endsWith(`...`)&&(this.variadic=!0,this._name=this._name.slice(0,-3))}name(){return this._name}_collectValue(e,t){return t===this.defaultValue||!Array.isArray(t)?[e]:(t.push(e),t)}default(e,t){return this.defaultValue=e,this.defaultValueDescription=t,this}argParser(e){return this.parseArg=e,this}choices(e){return this.argChoices=e.slice(),this.parseArg=(e,n)=>{if(!this.argChoices.includes(e))throw new t(`Allowed choices are ${this.argChoices.join(`, `)}.`);return this.variadic?this._collectValue(e,n):e},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}};function r(e){let t=e.name()+(e.variadic===!0?`...`:``);return e.required?`<`+t+`>`:`[`+t+`]`}e.Argument=n,e.humanReadableArgName=r})),Uc=a((e=>{var{humanReadableArgName:t}=Hc(),n=class{constructor(){this.helpWidth=void 0,this.minWidthToWrap=40,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}prepareContext(e){this.helpWidth=this.helpWidth??e.helpWidth??80}visibleCommands(e){let t=e.commands.filter(e=>!e._hidden),n=e._getHelpCommand();return n&&!n._hidden&&t.push(n),this.sortSubcommands&&t.sort((e,t)=>e.name().localeCompare(t.name())),t}compareOptions(e,t){let n=e=>e.short?e.short.replace(/^-/,``):e.long.replace(/^--/,``);return n(e).localeCompare(n(t))}visibleOptions(e){let t=e.options.filter(e=>!e.hidden),n=e._getHelpOption();if(n&&!n.hidden){let r=n.short&&e._findOption(n.short),i=n.long&&e._findOption(n.long);!r&&!i?t.push(n):n.long&&!i?t.push(e.createOption(n.long,n.description)):n.short&&!r&&t.push(e.createOption(n.short,n.description))}return this.sortOptions&&t.sort(this.compareOptions),t}visibleGlobalOptions(e){if(!this.showGlobalOptions)return[];let t=[];for(let n=e.parent;n;n=n.parent){let e=n.options.filter(e=>!e.hidden);t.push(...e)}return this.sortOptions&&t.sort(this.compareOptions),t}visibleArguments(e){return e._argsDescription&&e.registeredArguments.forEach(t=>{t.description=t.description||e._argsDescription[t.name()]||``}),e.registeredArguments.find(e=>e.description)?e.registeredArguments:[]}subcommandTerm(e){let n=e.registeredArguments.map(e=>t(e)).join(` `);return e._name+(e._aliases[0]?`|`+e._aliases[0]:``)+(e.options.length?` [options]`:``)+(n?` `+n:``)}optionTerm(e){return e.flags}argumentTerm(e){return e.name()}longestSubcommandTermLength(e,t){return t.visibleCommands(e).reduce((e,n)=>Math.max(e,this.displayWidth(t.styleSubcommandTerm(t.subcommandTerm(n)))),0)}longestOptionTermLength(e,t){return t.visibleOptions(e).reduce((e,n)=>Math.max(e,this.displayWidth(t.styleOptionTerm(t.optionTerm(n)))),0)}longestGlobalOptionTermLength(e,t){return t.visibleGlobalOptions(e).reduce((e,n)=>Math.max(e,this.displayWidth(t.styleOptionTerm(t.optionTerm(n)))),0)}longestArgumentTermLength(e,t){return t.visibleArguments(e).reduce((e,n)=>Math.max(e,this.displayWidth(t.styleArgumentTerm(t.argumentTerm(n)))),0)}commandUsage(e){let t=e._name;e._aliases[0]&&(t=t+`|`+e._aliases[0]);let n=``;for(let t=e.parent;t;t=t.parent)n=t.name()+` `+n;return n+t+` `+e.usage()}commandDescription(e){return e.description()}subcommandDescription(e){return e.summary()||e.description()}optionDescription(e){let t=[];if(e.argChoices&&t.push(`choices: ${e.argChoices.map(e=>JSON.stringify(e)).join(`, `)}`),e.defaultValue!==void 0&&(e.required||e.optional||e.isBoolean()&&typeof e.defaultValue==`boolean`)&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),e.presetArg!==void 0&&e.optional&&t.push(`preset: ${JSON.stringify(e.presetArg)}`),e.envVar!==void 0&&t.push(`env: ${e.envVar}`),t.length>0){let n=`(${t.join(`, `)})`;return e.description?`${e.description} ${n}`:n}return e.description}argumentDescription(e){let t=[];if(e.argChoices&&t.push(`choices: ${e.argChoices.map(e=>JSON.stringify(e)).join(`, `)}`),e.defaultValue!==void 0&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),t.length>0){let n=`(${t.join(`, `)})`;return e.description?`${e.description} ${n}`:n}return e.description}formatItemList(e,t,n){return t.length===0?[]:[n.styleTitle(e),...t,``]}groupItems(e,t,n){let r=new Map;return e.forEach(e=>{let t=n(e);r.has(t)||r.set(t,[])}),t.forEach(e=>{let t=n(e);r.has(t)||r.set(t,[]),r.get(t).push(e)}),r}formatHelp(e,t){let n=t.padWidth(e,t),r=t.helpWidth??80;function i(e,r){return t.formatItem(e,n,r,t)}let a=[`${t.styleTitle(`Usage:`)} ${t.styleUsage(t.commandUsage(e))}`,``],o=t.commandDescription(e);o.length>0&&(a=a.concat([t.boxWrap(t.styleCommandDescription(o),r),``]));let s=t.visibleArguments(e).map(e=>i(t.styleArgumentTerm(t.argumentTerm(e)),t.styleArgumentDescription(t.argumentDescription(e))));if(a=a.concat(this.formatItemList(`Arguments:`,s,t)),this.groupItems(e.options,t.visibleOptions(e),e=>e.helpGroupHeading??`Options:`).forEach((e,n)=>{let r=e.map(e=>i(t.styleOptionTerm(t.optionTerm(e)),t.styleOptionDescription(t.optionDescription(e))));a=a.concat(this.formatItemList(n,r,t))}),t.showGlobalOptions){let n=t.visibleGlobalOptions(e).map(e=>i(t.styleOptionTerm(t.optionTerm(e)),t.styleOptionDescription(t.optionDescription(e))));a=a.concat(this.formatItemList(`Global Options:`,n,t))}return this.groupItems(e.commands,t.visibleCommands(e),e=>e.helpGroup()||`Commands:`).forEach((e,n)=>{let r=e.map(e=>i(t.styleSubcommandTerm(t.subcommandTerm(e)),t.styleSubcommandDescription(t.subcommandDescription(e))));a=a.concat(this.formatItemList(n,r,t))}),a.join(`
1
+ import{a as e,i as t,n,o as r,r as i,t as a}from"./rolldown-runtime-DaDcL9Zw.js";import{n as o,t as s}from"./memoize-BK3gG5ob.js";import{a as c,d as l,f as u,l as d,o as f,s as p,u as m}from"./envUtils-BDhHQY0-.js";import{n as ee,t as h}from"./defineProperty-C-QyHrDq.js";import{n as g,t as te}from"./axios-DaWTGg7G.js";import{$x as ne,AT as re,Ax as ie,BT as ae,Ba as oe,Bh as _,Bi as v,Bs as se,Bx as ce,C as le,CE as ue,CS as de,Cf as fe,Cg as pe,Cl as me,Cr as he,Ct as ge,Cu as _e,Cv as ve,Do as ye,Eb as be,Ei as xe,Eo as Se,Et as Ce,Eu as we,Ex as y,F as Te,FT as Ee,Fc as De,Ff as Oe,Fh as ke,Fi as Ae,Fx as je,GT as Me,Gx as b,H_ as Ne,Hw as Pe,IT as Fe,Ic as Ie,If as x,In as Le,Ip as Re,Ix as S,Ji as C,Jl as ze,Kw as Be,Kx as Ve,LT as He,Li as Ue,Ln as We,Lp as Ge,Lx as Ke,M as qe,MT as w,Mn as Je,Mu as T,Mx as Ye,Nd as Xe,Nu as Ze,Nv as Qe,Nx as $e,O as et,Ou as tt,Ox as nt,PT as rt,Pf as it,Ph as at,Pv as ot,Px as st,Rs as ct,Rx as lt,Sa as ut,Sb as dt,Sc as ft,Sg as pt,Sl as E,Su as mt,Sv as ht,T as gt,Ta as _t,Tc as vt,Ti as yt,To as bt,Tt as xt,Tu as St,US as Ct,U_ as wt,Uh as Tt,Un as Et,Ux as D,V_ as Dt,Vh as Ot,Vx as kt,WS as At,WT as jt,Wx as O,XT as Mt,YT as k,Yh as Nt,Yl as A,Yw as Pt,Zh as Ft,Zw as It,_S as Lt,_f as Rt,_l as zt,aS as Bt,ac as Vt,ad as Ht,af as Ut,at as Wt,bE as Gt,bb as Kt,bc as qt,bu as Jt,cS as Yt,cc as Xt,cf as Zt,cm as Qt,cs as $t,cx as en,cy as tn,dr as nn,dy as rn,f as an,fS as j,ff as on,fu as sn,fw as cn,gE as ln,gS as un,gf as dn,gi as fn,gl as pn,gp as mn,hE as hn,hf as gn,hi as _n,ho as vn,hr as yn,hu as bn,i as xn,iS as Sn,id as Cn,it as wn,jT as Tn,ji as En,jx as Dn,kt as On,ku as kn,l_ as An,lf as jn,lm as Mn,lo as Nn,lx as Pn,mS as Fn,mf as In,nE as Ln,nc as Rn,nd as zn,nf as Bn,nl as Vn,no as Hn,nx as Un,o as Wn,oS as Gn,of as Kn,pS as qn,pf as Jn,po as Yn,pu as Xn,pw as Zn,qi as Qn,qx as $n,r as er,rS as tr,rc as nr,rf as rr,rl as ir,ro as ar,s as or,sS as sr,sf as cr,si as lr,tE as ur,tS as dr,tc as fr,td as pr,tf as M,uS as mr,u_ as hr,uf as gr,us as _r,ux as vr,v as yr,vE as br,vf as xr,w as Sr,wE as Cr,wb as wr,wo as Tr,wu as Er,xE as Dr,xS as Or,xf as kr,xu as Ar,xv as jr,y as Mr,yE as Nr,yc as Pr,yp as Fr,yu as Ir,z_ as Lr,zd as Rr,zx as zr}from"./loadAgentsDir-C7lOqvfh.js";import{B as Br,D as Vr,I as Hr,Lt as Ur,P as Wr,R as Gr,T as Kr,di as qr,fi as Jr,rr as Yr,t as Xr,ui as N,xr as Zr,y as Qr}from"./src-P_wYS_NJ2.js";import{t as $r}from"./jsx-runtime-Bb4Xn-E0.js";import{A as P,M as ei,O as ti,j as ni,l as ri,p as ii,u as ai,w as oi}from"./external-CEp-aPkt.js";import{n as si,r as ci,t as li}from"./lazySchema-B4D4qJVE.js";import{$n as ui,Bn as di,Cn as fi,F as pi,J as mi,Jn as hi,Kn as gi,Mn as _i,Nn as vi,Pn as yi,Qn as bi,Sn as xi,Wt as Si,Yn as Ci,Zn as wi,_r as Ti,bn as Ei,dn as Di,dt as Oi,er as ki,et as Ai,fn as ji,ft as Mi,gn as Ni,gr as Pi,in as Fi,ln as Ii,nr as Li,on as Ri,or as zi,pt as Bi,xn as Vi,z as Hi}from"./state-BemZdQIl.js";import{n as Ui,t as Wi}from"./cwd-Cfdf7z7s.js";import{C as Gi,E as Ki,F,I as qi,N as Ji,S as Yi,V as Xi,W as Zi,_ as Qi,a as $i,d as ea,k as ta,l as I,n as na,nt as ra,p as ia,r as aa,rt as oa,u as sa,w as ca,z as la}from"./debug-RAynG_nM.js";import{In as ua,J as da,Ln as fa,O as pa,Q as ma,S as ha,T as ga,c as _a,cn as va,f as ya,g as L,h as ba,i as xa,jt as Sa,k as Ca,n as wa,s as Ta,u as Ea,un as Da,x as R,zt as Oa}from"./settings-DnptdP79.js";import{M as ka,P as Aa,T as ja,_ as Ma,c as z,g as Na,h as B,k as Pa,n as Fa,o as Ia,p as La,r as Ra,s as za,v as Ba,w as Va,y as V}from"./config-Do1870_d.js";import{a as Ha,n as Ua,r as Wa}from"./process-gEbdy6uY.js";import{O as Ga,f as Ka,i as qa,k as H,l as Ja,m as Ya,u as Xa}from"./git-2c7WlGDL.js";import{c as Za,o as Qa}from"./execFileNoThrow-Dwu6psHW.js";import{d as $a,f as eo,o as to,s as U}from"./log-CezCRpAN.js";import{n as no,t as ro}from"./which-DzFN5TNM.js";import{i as io,o as ao}from"./platform-BMPbglug.js";import{i as oo,o as so}from"./windowsPaths-BU3yQWTB.js";import{s as co,u as lo}from"./types-3j8PS-Du.js";import{n as W,r as G}from"./analytics-DJobLaWP.js";import{i as uo,n as fo,r as K,u as po,v as mo}from"./startupProfiler-L_UWZ03w.js";import{l as ho,s as go,u as _o}from"./oauth-C9VBDB0Y.js";import{n as vo,t as yo}from"./bundledMode--fG1S62b.js";import{l as bo,o as xo}from"./stringUtils-C84IJ91d.js";import{$t as So,Bt as Co,C as wo,Dn as To,Fr as Eo,Ft as Do,Gr as Oo,Jn as ko,Kn as Ao,Ot as jo,Rr as Mo,S as No,Sr as Po,Vn as Fo,Xt as Io,Yn as Lo,Z as Ro,_ as zo,ai as Bo,an as Vo,ar as Ho,b as Uo,bn as Wo,en as Go,et as Ko,g as qo,in as Jo,ir as Yo,jn as Xo,lt as Zo,nr as Qo,o as $o,pn as es,qr as ts,rr as ns,rt as rs,si as is,ut as as,v as os,xn as ss,xr as cs,xt as ls,yn as us,zt as ds}from"./model-BsZ4sP_H.js";import{Bt as fs,Dt as ps,Mt as ms,Nt as hs,Yt as gs,at as _s,jt as vs,ot as ys,qt as bs,st as xs,zt as Ss}from"./prompt-M2lu8_Oa.js";import{f as Cs,h as ws,l as Ts,n as Es}from"./proxy-CuMaO_YV.js";import{n as Ds,t as Os}from"./userAgent-CIq27vUR.js";import{A as ks,_ as As,k as js,x as Ms}from"./sessionState-Bifmu95-.js";import{n as Ns,t as Ps}from"./partition-D-UhsUCx.js";import{a as Fs,n as Is}from"./ripgrep-DvOOsDMv.js";import{c as Ls}from"./switcher-CCs9xl1z.js";import{dt as Rs,ft as zs}from"./esm-Cf4nSRjF.js";import{C as Bs,D as Vs,O as Hs,S as Us}from"./sessionTracing-BrNx1k2V.js";import{i as Ws,n as Gs,o as Ks,r as qs}from"./detectRepository-DgpNd87p.js";import{c as Js,o as Ys,r as Xs}from"./api-nSHc_GIQ.js";import{d as Zs,f as Qs,l as $s,p as ec,u as tc}from"./firstPartyEventLogger-B3cXgR67.js";import{n as nc,t as rc}from"./worktreeModeEnabled-BFOYTTTr.js";import{a as ic}from"./grove-CeOjTaY6.js";import{a as ac,i as oc,n as sc,o as cc,r as lc}from"./remoteManagedSettings-xh_MViZH.js";import{n as uc,t as dc}from"./allErrors-CU89tF-z.js";import{n as fc,t as q}from"./exit-BOhGfSlm.js";import{n as pc,s as mc,t as hc}from"./pluginOperations-D90IRawu.js";import"./pluginCliCommands-Bd96zSOQ.js";import{n as gc,r as _c,t as vc}from"./managedEnv-DhWRJ5DK.js";import{n as yc}from"./onChangeAppState-RBl6H7ho.js";import{i as bc,t as xc}from"./skillChangeDetector-Dd0WPdkO.js";import{n as Sc}from"./stats-IzV0_vEc.js";import{t as Cc}from"./renderOptions-Q5oCLFIC.js";import{i as wc,n as Tc,t as Ec}from"./githubRepoPathMapping-DbWG4hFQ.js";import{i as Dc,n as Oc}from"./earlyInput-IghoCjG5.js";import{t as kc}from"./banner-D0P7wXdw.js";import{c as Ac,n as jc,o as Mc,r as Nc}from"./RemoteSessionManager-CS6mywIn.js";import{posix as Pc,resolve as Fc,win32 as Ic}from"path";import{appendFileSync as Lc,readFileSync as Rc}from"fs";import{open as zc,stat as Bc}from"fs/promises";var Vc=a((e=>{var t=class extends Error{constructor(e,t,n){super(n),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=t,this.exitCode=e,this.nestedError=void 0}},n=class extends t{constructor(e){super(1,`commander.invalidArgument`,e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};e.CommanderError=t,e.InvalidArgumentError=n})),Hc=a((e=>{var{InvalidArgumentError:t}=Vc(),n=class{constructor(e,t){switch(this.description=t||``,this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,e[0]){case`<`:this.required=!0,this._name=e.slice(1,-1);break;case`[`:this.required=!1,this._name=e.slice(1,-1);break;default:this.required=!0,this._name=e;break}this._name.endsWith(`...`)&&(this.variadic=!0,this._name=this._name.slice(0,-3))}name(){return this._name}_collectValue(e,t){return t===this.defaultValue||!Array.isArray(t)?[e]:(t.push(e),t)}default(e,t){return this.defaultValue=e,this.defaultValueDescription=t,this}argParser(e){return this.parseArg=e,this}choices(e){return this.argChoices=e.slice(),this.parseArg=(e,n)=>{if(!this.argChoices.includes(e))throw new t(`Allowed choices are ${this.argChoices.join(`, `)}.`);return this.variadic?this._collectValue(e,n):e},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}};function r(e){let t=e.name()+(e.variadic===!0?`...`:``);return e.required?`<`+t+`>`:`[`+t+`]`}e.Argument=n,e.humanReadableArgName=r})),Uc=a((e=>{var{humanReadableArgName:t}=Hc(),n=class{constructor(){this.helpWidth=void 0,this.minWidthToWrap=40,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}prepareContext(e){this.helpWidth=this.helpWidth??e.helpWidth??80}visibleCommands(e){let t=e.commands.filter(e=>!e._hidden),n=e._getHelpCommand();return n&&!n._hidden&&t.push(n),this.sortSubcommands&&t.sort((e,t)=>e.name().localeCompare(t.name())),t}compareOptions(e,t){let n=e=>e.short?e.short.replace(/^-/,``):e.long.replace(/^--/,``);return n(e).localeCompare(n(t))}visibleOptions(e){let t=e.options.filter(e=>!e.hidden),n=e._getHelpOption();if(n&&!n.hidden){let r=n.short&&e._findOption(n.short),i=n.long&&e._findOption(n.long);!r&&!i?t.push(n):n.long&&!i?t.push(e.createOption(n.long,n.description)):n.short&&!r&&t.push(e.createOption(n.short,n.description))}return this.sortOptions&&t.sort(this.compareOptions),t}visibleGlobalOptions(e){if(!this.showGlobalOptions)return[];let t=[];for(let n=e.parent;n;n=n.parent){let e=n.options.filter(e=>!e.hidden);t.push(...e)}return this.sortOptions&&t.sort(this.compareOptions),t}visibleArguments(e){return e._argsDescription&&e.registeredArguments.forEach(t=>{t.description=t.description||e._argsDescription[t.name()]||``}),e.registeredArguments.find(e=>e.description)?e.registeredArguments:[]}subcommandTerm(e){let n=e.registeredArguments.map(e=>t(e)).join(` `);return e._name+(e._aliases[0]?`|`+e._aliases[0]:``)+(e.options.length?` [options]`:``)+(n?` `+n:``)}optionTerm(e){return e.flags}argumentTerm(e){return e.name()}longestSubcommandTermLength(e,t){return t.visibleCommands(e).reduce((e,n)=>Math.max(e,this.displayWidth(t.styleSubcommandTerm(t.subcommandTerm(n)))),0)}longestOptionTermLength(e,t){return t.visibleOptions(e).reduce((e,n)=>Math.max(e,this.displayWidth(t.styleOptionTerm(t.optionTerm(n)))),0)}longestGlobalOptionTermLength(e,t){return t.visibleGlobalOptions(e).reduce((e,n)=>Math.max(e,this.displayWidth(t.styleOptionTerm(t.optionTerm(n)))),0)}longestArgumentTermLength(e,t){return t.visibleArguments(e).reduce((e,n)=>Math.max(e,this.displayWidth(t.styleArgumentTerm(t.argumentTerm(n)))),0)}commandUsage(e){let t=e._name;e._aliases[0]&&(t=t+`|`+e._aliases[0]);let n=``;for(let t=e.parent;t;t=t.parent)n=t.name()+` `+n;return n+t+` `+e.usage()}commandDescription(e){return e.description()}subcommandDescription(e){return e.summary()||e.description()}optionDescription(e){let t=[];if(e.argChoices&&t.push(`choices: ${e.argChoices.map(e=>JSON.stringify(e)).join(`, `)}`),e.defaultValue!==void 0&&(e.required||e.optional||e.isBoolean()&&typeof e.defaultValue==`boolean`)&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),e.presetArg!==void 0&&e.optional&&t.push(`preset: ${JSON.stringify(e.presetArg)}`),e.envVar!==void 0&&t.push(`env: ${e.envVar}`),t.length>0){let n=`(${t.join(`, `)})`;return e.description?`${e.description} ${n}`:n}return e.description}argumentDescription(e){let t=[];if(e.argChoices&&t.push(`choices: ${e.argChoices.map(e=>JSON.stringify(e)).join(`, `)}`),e.defaultValue!==void 0&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),t.length>0){let n=`(${t.join(`, `)})`;return e.description?`${e.description} ${n}`:n}return e.description}formatItemList(e,t,n){return t.length===0?[]:[n.styleTitle(e),...t,``]}groupItems(e,t,n){let r=new Map;return e.forEach(e=>{let t=n(e);r.has(t)||r.set(t,[])}),t.forEach(e=>{let t=n(e);r.has(t)||r.set(t,[]),r.get(t).push(e)}),r}formatHelp(e,t){let n=t.padWidth(e,t),r=t.helpWidth??80;function i(e,r){return t.formatItem(e,n,r,t)}let a=[`${t.styleTitle(`Usage:`)} ${t.styleUsage(t.commandUsage(e))}`,``],o=t.commandDescription(e);o.length>0&&(a=a.concat([t.boxWrap(t.styleCommandDescription(o),r),``]));let s=t.visibleArguments(e).map(e=>i(t.styleArgumentTerm(t.argumentTerm(e)),t.styleArgumentDescription(t.argumentDescription(e))));if(a=a.concat(this.formatItemList(`Arguments:`,s,t)),this.groupItems(e.options,t.visibleOptions(e),e=>e.helpGroupHeading??`Options:`).forEach((e,n)=>{let r=e.map(e=>i(t.styleOptionTerm(t.optionTerm(e)),t.styleOptionDescription(t.optionDescription(e))));a=a.concat(this.formatItemList(n,r,t))}),t.showGlobalOptions){let n=t.visibleGlobalOptions(e).map(e=>i(t.styleOptionTerm(t.optionTerm(e)),t.styleOptionDescription(t.optionDescription(e))));a=a.concat(this.formatItemList(`Global Options:`,n,t))}return this.groupItems(e.commands,t.visibleCommands(e),e=>e.helpGroup()||`Commands:`).forEach((e,n)=>{let r=e.map(e=>i(t.styleSubcommandTerm(t.subcommandTerm(e)),t.styleSubcommandDescription(t.subcommandDescription(e))));a=a.concat(this.formatItemList(n,r,t))}),a.join(`
2
2
  `)}displayWidth(e){return r(e).length}styleTitle(e){return e}styleUsage(e){return e.split(` `).map(e=>e===`[options]`?this.styleOptionText(e):e===`[command]`?this.styleSubcommandText(e):e[0]===`[`||e[0]===`<`?this.styleArgumentText(e):this.styleCommandText(e)).join(` `)}styleCommandDescription(e){return this.styleDescriptionText(e)}styleOptionDescription(e){return this.styleDescriptionText(e)}styleSubcommandDescription(e){return this.styleDescriptionText(e)}styleArgumentDescription(e){return this.styleDescriptionText(e)}styleDescriptionText(e){return e}styleOptionTerm(e){return this.styleOptionText(e)}styleSubcommandTerm(e){return e.split(` `).map(e=>e===`[options]`?this.styleOptionText(e):e[0]===`[`||e[0]===`<`?this.styleArgumentText(e):this.styleSubcommandText(e)).join(` `)}styleArgumentTerm(e){return this.styleArgumentText(e)}styleOptionText(e){return e}styleArgumentText(e){return e}styleSubcommandText(e){return e}styleCommandText(e){return e}padWidth(e,t){return Math.max(t.longestOptionTermLength(e,t),t.longestGlobalOptionTermLength(e,t),t.longestSubcommandTermLength(e,t),t.longestArgumentTermLength(e,t))}preformatted(e){return/\n[^\S\r\n]/.test(e)}formatItem(e,t,n,r){let i=` `.repeat(2);if(!n)return i+e;let a=e.padEnd(t+e.length-r.displayWidth(e)),o=(this.helpWidth??80)-t-2-2,s;return s=o<this.minWidthToWrap||r.preformatted(n)?n:r.boxWrap(n,o).replace(/\n/g,`
3
3
  `+` `.repeat(t+2)),i+a+` `.repeat(2)+s.replace(/\n/g,`\n${i}`)}boxWrap(e,t){if(t<this.minWidthToWrap)return e;let n=e.split(/\r\n|\n/),r=/[\s]*[^\s]+/g,i=[];return n.forEach(e=>{let n=e.match(r);if(n===null){i.push(``);return}let a=[n.shift()],o=this.displayWidth(a[0]);n.forEach(e=>{let n=this.displayWidth(e);if(o+n<=t){a.push(e),o+=n;return}i.push(a.join(``));let r=e.trimStart();a=[r],o=this.displayWidth(r)}),i.push(a.join(``))}),i.join(`
4
4
  `)}};function r(e){return e.replace(/\x1b\[\d*(;\d*)*m/g,``)}e.Help=n,e.stripColor=r})),Wc=a((e=>{var{InvalidArgumentError:t}=Vc(),n=class{constructor(e,t){this.flags=e,this.description=t||``,this.required=e.includes(`<`),this.optional=e.includes(`[`),this.variadic=/\w\.\.\.[>\]]$/.test(e),this.mandatory=!1;let n=a(e);this.short=n.shortFlag,this.long=n.longFlag,this.negate=!1,this.long&&(this.negate=this.long.startsWith(`--no-`)),this.defaultValue=void 0,this.defaultValueDescription=void 0,this.presetArg=void 0,this.envVar=void 0,this.parseArg=void 0,this.hidden=!1,this.argChoices=void 0,this.conflictsWith=[],this.implied=void 0,this.helpGroupHeading=void 0}default(e,t){return this.defaultValue=e,this.defaultValueDescription=t,this}preset(e){return this.presetArg=e,this}conflicts(e){return this.conflictsWith=this.conflictsWith.concat(e),this}implies(e){let t=e;return typeof e==`string`&&(t={[e]:!0}),this.implied=Object.assign(this.implied||{},t),this}env(e){return this.envVar=e,this}argParser(e){return this.parseArg=e,this}makeOptionMandatory(e=!0){return this.mandatory=!!e,this}hideHelp(e=!0){return this.hidden=!!e,this}_collectValue(e,t){return t===this.defaultValue||!Array.isArray(t)?[e]:(t.push(e),t)}choices(e){return this.argChoices=e.slice(),this.parseArg=(e,n)=>{if(!this.argChoices.includes(e))throw new t(`Allowed choices are ${this.argChoices.join(`, `)}.`);return this.variadic?this._collectValue(e,n):e},this}name(){return this.long?this.long.replace(/^--/,``):this.short.replace(/^-/,``)}attributeName(){return this.negate?i(this.name().replace(/^no-/,``)):i(this.name())}helpGroup(e){return this.helpGroupHeading=e,this}is(e){return this.short===e||this.long===e}isBoolean(){return!this.required&&!this.optional&&!this.negate}},r=class{constructor(e){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,e.forEach(e=>{e.negate?this.negativeOptions.set(e.attributeName(),e):this.positiveOptions.set(e.attributeName(),e)}),this.negativeOptions.forEach((e,t)=>{this.positiveOptions.has(t)&&this.dualOptions.add(t)})}valueFromOption(e,t){let n=t.attributeName();if(!this.dualOptions.has(n))return!0;let r=this.negativeOptions.get(n).presetArg,i=r!==void 0&&r;return t.negate===(i===e)}};function i(e){return e.split(`-`).reduce((e,t)=>e+t[0].toUpperCase()+t.slice(1))}function a(e){let t,n,r=/^-[^-]$/,i=/^--[^-]/,a=e.split(/[ |,]+/).concat(`guard`);if(r.test(a[0])&&(t=a.shift()),i.test(a[0])&&(n=a.shift()),!t&&r.test(a[0])&&(t=a.shift()),!t&&i.test(a[0])&&(t=n,n=a.shift()),a[0].startsWith(`-`)){let t=a[0],n=`option creation failed due to '${t}' in option flags '${e}'`;throw/^-[^-][^-]/.test(t)?Error(`${n}
@@ -16,9 +16,9 @@ Expecting one of '${n.join(`', '`)}'`);return this._lifeCycleHooks[e]?this._life
16
16
  - if the default executable name is not suitable, use the executableFile option to supply a custom name or path
17
17
  - ${t?`searched for local subcommand relative to directory '${t}'`:`no directory for search for local subcommand, use .executableDir() to supply a custom directory`}`;throw Error(r)}_executeSubCommand(e,t){t=t.slice();let n=!1,s=[`.js`,`.ts`,`.tsx`,`.mjs`,`.cjs`];function c(e,t){let n=i.resolve(e,t);if(a.existsSync(n))return n;if(s.includes(i.extname(t)))return;let r=s.find(e=>a.existsSync(`${n}${e}`));if(r)return`${n}${r}`}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let u=e._executableFile||`${this._name}-${e._name}`,d=this._executableDir||``;if(this._scriptPath){let e;try{e=a.realpathSync(this._scriptPath)}catch{e=this._scriptPath}d=i.resolve(i.dirname(e),d)}if(d){let t=c(d,u);if(!t&&!e._executableFile&&this._scriptPath){let n=i.basename(this._scriptPath,i.extname(this._scriptPath));n!==this._name&&(t=c(d,`${n}-${e._name}`))}u=t||u}n=s.includes(i.extname(u));let f;o.platform===`win32`?(this._checkForMissingExecutable(u,d,e._name),t.unshift(u),t=h(o.execArgv).concat(t),f=r.spawn(o.execPath,t,{stdio:`inherit`})):n?(t.unshift(u),t=h(o.execArgv).concat(t),f=r.spawn(o.argv[0],t,{stdio:`inherit`})):f=r.spawn(u,t,{stdio:`inherit`}),f.killed||[`SIGUSR1`,`SIGUSR2`,`SIGTERM`,`SIGINT`,`SIGHUP`].forEach(e=>{o.on(e,()=>{f.killed===!1&&f.exitCode===null&&f.kill(e)})});let p=this._exitCallback;f.on(`close`,e=>{e=e??1,p?p(new l(e,`commander.executeSubCommandAsync`,`(close)`)):o.exit(e)}),f.on(`error`,t=>{if(t.code===`ENOENT`)this._checkForMissingExecutable(u,d,e._name);else if(t.code===`EACCES`)throw Error(`'${u}' not executable`);if(!p)o.exit(1);else{let e=new l(1,`commander.executeSubCommandAsync`,`(error)`);e.nestedError=t,p(e)}}),this.runningCommand=f}_dispatchSubcommand(e,t,n){let r=this._findCommand(e);r||this.help({error:!0}),r._prepareForParse();let i;return i=this._chainOrCallSubCommandHook(i,r,`preSubcommand`),i=this._chainOrCall(i,()=>{if(r._executableHandler)this._executeSubCommand(r,t.concat(n));else return r._parseCommand(t,n)}),i}_dispatchHelpCommand(e){e||this.help();let t=this._findCommand(e);return t&&!t._executableHandler&&t.help(),this._dispatchSubcommand(e,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??`--help`])}_checkNumberOfArguments(){this.registeredArguments.forEach((e,t)=>{e.required&&this.args[t]==null&&this.missingArgument(e.name())}),!(this.registeredArguments.length>0&&this.registeredArguments[this.registeredArguments.length-1].variadic)&&this.args.length>this.registeredArguments.length&&this._excessArguments(this.args)}_processArguments(){let e=(e,t,n)=>{let r=t;if(t!==null&&e.parseArg){let i=`error: command-argument value '${t}' is invalid for argument '${e.name()}'.`;r=this._callParseArg(e,t,n,i)}return r};this._checkNumberOfArguments();let t=[];this.registeredArguments.forEach((n,r)=>{let i=n.defaultValue;n.variadic?r<this.args.length?(i=this.args.slice(r),n.parseArg&&(i=i.reduce((t,r)=>e(n,r,t),n.defaultValue))):i===void 0&&(i=[]):r<this.args.length&&(i=this.args[r],n.parseArg&&(i=e(n,i,n.defaultValue))),t[r]=i}),this.processedArgs=t}_chainOrCall(e,t){return e?.then&&typeof e.then==`function`?e.then(()=>t()):t()}_chainOrCallHooks(e,t){let n=e,r=[];return this._getCommandAndAncestors().reverse().filter(e=>e._lifeCycleHooks[t]!==void 0).forEach(e=>{e._lifeCycleHooks[t].forEach(t=>{r.push({hookedCommand:e,callback:t})})}),t===`postAction`&&r.reverse(),r.forEach(e=>{n=this._chainOrCall(n,()=>e.callback(e.hookedCommand,this))}),n}_chainOrCallSubCommandHook(e,t,n){let r=e;return this._lifeCycleHooks[n]!==void 0&&this._lifeCycleHooks[n].forEach(e=>{r=this._chainOrCall(r,()=>e(this,t))}),r}_parseCommand(e,t){let n=this.parseOptions(t);if(this._parseOptionsEnv(),this._parseOptionsImplied(),e=e.concat(n.operands),t=n.unknown,this.args=e.concat(t),e&&this._findCommand(e[0]))return this._dispatchSubcommand(e[0],e.slice(1),t);if(this._getHelpCommand()&&e[0]===this._getHelpCommand().name())return this._dispatchHelpCommand(e[1]);if(this._defaultCommandName)return this._outputHelpIfRequested(t),this._dispatchSubcommand(this._defaultCommandName,e,t);this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName&&this.help({error:!0}),this._outputHelpIfRequested(n.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let r=()=>{n.unknown.length>0&&this.unknownOption(n.unknown[0])},i=`command:${this.name()}`;if(this._actionHandler){r(),this._processArguments();let n;return n=this._chainOrCallHooks(n,`preAction`),n=this._chainOrCall(n,()=>this._actionHandler(this.processedArgs)),this.parent&&(n=this._chainOrCall(n,()=>{this.parent.emit(i,e,t)})),n=this._chainOrCallHooks(n,`postAction`),n}if(this.parent?.listenerCount(i))r(),this._processArguments(),this.parent.emit(i,e,t);else if(e.length){if(this._findCommand(`*`))return this._dispatchSubcommand(`*`,e,t);this.listenerCount(`command:*`)?this.emit(`command:*`,e,t):this.commands.length?this.unknownCommand():(r(),this._processArguments())}else this.commands.length?(r(),this.help({error:!0})):(r(),this._processArguments())}_findCommand(e){if(e)return this.commands.find(t=>t._name===e||t._aliases.includes(e))}_findOption(e){return this.options.find(t=>t.is(e))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach(e=>{e.options.forEach(t=>{t.mandatory&&e.getOptionValue(t.attributeName())===void 0&&e.missingMandatoryOptionValue(t)})})}_checkForConflictingLocalOptions(){let e=this.options.filter(e=>{let t=e.attributeName();return this.getOptionValue(t)!==void 0&&this.getOptionValueSource(t)!=="default"});e.filter(e=>e.conflictsWith.length>0).forEach(t=>{let n=e.find(e=>t.conflictsWith.includes(e.attributeName()));n&&this._conflictingOption(t,n)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach(e=>{e._checkForConflictingLocalOptions()})}parseOptions(e){let t=[],n=[],r=t;function i(e){return e.length>1&&e[0]===`-`}let a=e=>/^-(\d+|\d*\.\d+)(e[+-]?\d+)?$/.test(e)?!this._getCommandAndAncestors().some(e=>e.options.map(e=>e.short).some(e=>/^-\d$/.test(e))):!1,o=null,s=null,c=0;for(;c<e.length||s;){let l=s??e[c++];if(s=null,l===`--`){r===n&&r.push(l),r.push(...e.slice(c));break}if(o&&(!i(l)||a(l))){this.emit(`option:${o.name()}`,l);continue}if(o=null,i(l)){let t=this._findOption(l);if(t){if(t.required){let n=e[c++];n===void 0&&this.optionMissingArgument(t),this.emit(`option:${t.name()}`,n)}else if(t.optional){let n=null;c<e.length&&(!i(e[c])||a(e[c]))&&(n=e[c++]),this.emit(`option:${t.name()}`,n)}else this.emit(`option:${t.name()}`);o=t.variadic?t:null;continue}}if(l.length>2&&l[0]===`-`&&l[1]!==`-`){let e=this._findOption(`-${l[1]}`);if(e){e.required||e.optional&&this._combineFlagAndOptionalValue?this.emit(`option:${e.name()}`,l.slice(2)):(this.emit(`option:${e.name()}`),s=`-${l.slice(2)}`);continue}}if(/^--[^=]+=/.test(l)){let e=l.indexOf(`=`),t=this._findOption(l.slice(0,e));if(t&&(t.required||t.optional)){this.emit(`option:${t.name()}`,l.slice(e+1));continue}}if(r===t&&i(l)&&!(this.commands.length===0&&a(l))&&(r=n),(this._enablePositionalOptions||this._passThroughOptions)&&t.length===0&&n.length===0){if(this._findCommand(l)){t.push(l),n.push(...e.slice(c));break}else if(this._getHelpCommand()&&l===this._getHelpCommand().name()){t.push(l,...e.slice(c));break}else if(this._defaultCommandName){n.push(l,...e.slice(c));break}}if(this._passThroughOptions){r.push(l,...e.slice(c));break}r.push(l)}return{operands:t,unknown:n}}opts(){if(this._storeOptionsAsProperties){let e={},t=this.options.length;for(let n=0;n<t;n++){let t=this.options[n].attributeName();e[t]=t===this._versionOptionName?this._version:this[t]}return e}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().reduce((e,t)=>Object.assign(e,t.opts()),{})}error(e,t){this._outputConfiguration.outputError(`${e}\n`,this._outputConfiguration.writeErr),typeof this._showHelpAfterError==`string`?this._outputConfiguration.writeErr(`${this._showHelpAfterError}\n`):this._showHelpAfterError&&(this._outputConfiguration.writeErr(`
18
18
  `),this.outputHelp({error:!0}));let n=t||{},r=n.exitCode||1,i=n.code||`commander.error`;this._exit(r,i,e)}_parseOptionsEnv(){this.options.forEach(e=>{if(e.envVar&&e.envVar in o.env){let t=e.attributeName();(this.getOptionValue(t)===void 0||[`default`,`config`,`env`].includes(this.getOptionValueSource(t)))&&(e.required||e.optional?this.emit(`optionEnv:${e.name()}`,o.env[e.envVar]):this.emit(`optionEnv:${e.name()}`))}})}_parseOptionsImplied(){let e=new p(this.options),t=e=>this.getOptionValue(e)!==void 0&&![`default`,`implied`].includes(this.getOptionValueSource(e));this.options.filter(n=>n.implied!==void 0&&t(n.attributeName())&&e.valueFromOption(this.getOptionValue(n.attributeName()),n)).forEach(e=>{Object.keys(e.implied).filter(e=>!t(e)).forEach(t=>{this.setOptionValueWithSource(t,e.implied[t],`implied`)})})}missingArgument(e){let t=`error: missing required argument '${e}'`;this.error(t,{code:`commander.missingArgument`})}optionMissingArgument(e){let t=`error: option '${e.flags}' argument missing`;this.error(t,{code:`commander.optionMissingArgument`})}missingMandatoryOptionValue(e){let t=`error: required option '${e.flags}' not specified`;this.error(t,{code:`commander.missingMandatoryOptionValue`})}_conflictingOption(e,t){let n=e=>{let t=e.attributeName(),n=this.getOptionValue(t),r=this.options.find(e=>e.negate&&t===e.attributeName()),i=this.options.find(e=>!e.negate&&t===e.attributeName());return r&&(r.presetArg===void 0&&n===!1||r.presetArg!==void 0&&n===r.presetArg)?r:i||e},r=e=>{let t=n(e),r=t.attributeName();return this.getOptionValueSource(r)===`env`?`environment variable '${t.envVar}'`:`option '${t.flags}'`},i=`error: ${r(e)} cannot be used with ${r(t)}`;this.error(i,{code:`commander.conflictingOption`})}unknownOption(e){if(this._allowUnknownOption)return;let t=``;if(e.startsWith(`--`)&&this._showSuggestionAfterError){let n=[],r=this;do{let e=r.createHelp().visibleOptions(r).filter(e=>e.long).map(e=>e.long);n=n.concat(e),r=r.parent}while(r&&!r._enablePositionalOptions);t=m(e,n)}let n=`error: unknown option '${e}'${t}`;this.error(n,{code:`commander.unknownOption`})}_excessArguments(e){if(this._allowExcessArguments)return;let t=this.registeredArguments.length,n=t===1?``:`s`,r=`error: too many arguments${this.parent?` for '${this.name()}'`:``}. Expected ${t} argument${n} but got ${e.length}.`;this.error(r,{code:`commander.excessArguments`})}unknownCommand(){let e=this.args[0],t=``;if(this._showSuggestionAfterError){let n=[];this.createHelp().visibleCommands(this).forEach(e=>{n.push(e.name()),e.alias()&&n.push(e.alias())}),t=m(e,n)}let n=`error: unknown command '${e}'${t}`;this.error(n,{code:`commander.unknownCommand`})}version(e,t,n){if(e===void 0)return this._version;this._version=e,t=t||`-V, --version`,n=n||`output the version number`;let r=this.createOption(t,n);return this._versionOptionName=r.attributeName(),this._registerOption(r),this.on(`option:`+r.name(),()=>{this._outputConfiguration.writeOut(`${e}\n`),this._exit(0,`commander.version`,e)}),this}description(e,t){return e===void 0&&t===void 0?this._description:(this._description=e,t&&(this._argsDescription=t),this)}summary(e){return e===void 0?this._summary:(this._summary=e,this)}alias(e){if(e===void 0)return this._aliases[0];let t=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler&&(t=this.commands[this.commands.length-1]),e===t._name)throw Error(`Command alias can't be the same as its name`);let n=this.parent?._findCommand(e);if(n){let t=[n.name()].concat(n.aliases()).join(`|`);throw Error(`cannot add alias '${e}' to command '${this.name()}' as already have command '${t}'`)}return t._aliases.push(e),this}aliases(e){return e===void 0?this._aliases:(e.forEach(e=>this.alias(e)),this)}usage(e){if(e===void 0){if(this._usage)return this._usage;let e=this.registeredArguments.map(e=>c(e));return[].concat(this.options.length||this._helpOption!==null?`[options]`:[],this.commands.length?`[command]`:[],this.registeredArguments.length?e:[]).join(` `)}return this._usage=e,this}name(e){return e===void 0?this._name:(this._name=e,this)}helpGroup(e){return e===void 0?this._helpGroupHeading??``:(this._helpGroupHeading=e,this)}commandsGroup(e){return e===void 0?this._defaultCommandGroup??``:(this._defaultCommandGroup=e,this)}optionsGroup(e){return e===void 0?this._defaultOptionGroup??``:(this._defaultOptionGroup=e,this)}_initOptionGroup(e){this._defaultOptionGroup&&!e.helpGroupHeading&&e.helpGroup(this._defaultOptionGroup)}_initCommandGroup(e){this._defaultCommandGroup&&!e.helpGroup()&&e.helpGroup(this._defaultCommandGroup)}nameFromFilename(e){return this._name=i.basename(e,i.extname(e)),this}executableDir(e){return e===void 0?this._executableDir:(this._executableDir=e,this)}helpInformation(e){let t=this.createHelp(),n=this._getOutputContext(e);t.prepareContext({error:n.error,helpWidth:n.helpWidth,outputHasColors:n.hasColors});let r=t.formatHelp(this,t);return n.hasColors?r:this._outputConfiguration.stripColor(r)}_getOutputContext(e){e=e||{};let t=!!e.error,n,r,i;return t?(n=e=>this._outputConfiguration.writeErr(e),r=this._outputConfiguration.getErrHasColors(),i=this._outputConfiguration.getErrHelpWidth()):(n=e=>this._outputConfiguration.writeOut(e),r=this._outputConfiguration.getOutHasColors(),i=this._outputConfiguration.getOutHelpWidth()),{error:t,write:e=>(r||(e=this._outputConfiguration.stripColor(e)),n(e)),hasColors:r,helpWidth:i}}outputHelp(e){let t;typeof e==`function`&&(t=e,e=void 0);let n=this._getOutputContext(e),r={error:n.error,write:n.write,command:this};this._getCommandAndAncestors().reverse().forEach(e=>e.emit(`beforeAllHelp`,r)),this.emit(`beforeHelp`,r);let i=this.helpInformation({error:n.error});if(t&&(i=t(i),typeof i!=`string`&&!Buffer.isBuffer(i)))throw Error(`outputHelp callback must return a string or a Buffer`);n.write(i),this._getHelpOption()?.long&&this.emit(this._getHelpOption().long),this.emit(`afterHelp`,r),this._getCommandAndAncestors().forEach(e=>e.emit(`afterAllHelp`,r))}helpOption(e,t){return typeof e==`boolean`?(e?(this._helpOption===null&&(this._helpOption=void 0),this._defaultOptionGroup&&this._initOptionGroup(this._getHelpOption())):this._helpOption=null,this):(this._helpOption=this.createOption(e??`-h, --help`,t??`display help for command`),(e||t)&&this._initOptionGroup(this._helpOption),this)}_getHelpOption(){return this._helpOption===void 0&&this.helpOption(void 0,void 0),this._helpOption}addHelpOption(e){return this._helpOption=e,this._initOptionGroup(e),this}help(e){this.outputHelp(e);let t=Number(o.exitCode??0);t===0&&e&&typeof e!=`function`&&e.error&&(t=1),this._exit(t,`commander.help`,`(outputHelp)`)}addHelpText(e,t){let n=[`beforeAll`,`before`,`after`,`afterAll`];if(!n.includes(e))throw Error(`Unexpected value for position to addHelpText.
19
- Expecting one of '${n.join(`', '`)}'`);let r=`${e}Help`;return this.on(r,e=>{let n;n=typeof t==`function`?t({error:e.error,command:e.command}):t,n&&e.write(`${n}\n`)}),this}_outputHelpIfRequested(e){let t=this._getHelpOption();t&&e.find(e=>t.is(e))&&(this.outputHelp(),this._exit(0,`commander.helpDisplayed`,`(outputHelp)`))}};function h(e){return e.map(e=>{if(!e.startsWith(`--inspect`))return e;let t,n=`127.0.0.1`,r=`9229`,i;return(i=e.match(/^(--inspect(-brk)?)$/))===null?(i=e.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))===null?(i=e.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(t=i[1],n=i[3],r=i[4]):(t=i[1],/^\d+$/.test(i[3])?r=i[3]:n=i[3]):t=i[1],t&&r!==`0`?`${t}=${n}:${parseInt(r)+1}`:e})}function g(){if(o.env.NO_COLOR||o.env.FORCE_COLOR===`0`||o.env.FORCE_COLOR===`false`)return!1;if(o.env.FORCE_COLOR||o.env.CLICOLOR_FORCE!==void 0)return!0}e.Command=ee,e.useColor=g})),qc=a((e=>{var{Argument:t}=Hc(),{Command:n}=Kc(),{CommanderError:r,InvalidArgumentError:i}=Vc(),{Help:a}=Uc(),{Option:o}=Wc();e.program=new n,e.createCommand=e=>new n(e),e.createOption=(e,t)=>new o(e,t),e.createArgument=(e,n)=>new t(e,n),e.Command=n,e.Option=o,e.Argument=t,e.Help=a,e.CommanderError=r,e.InvalidArgumentError=i,e.InvalidOptionArgumentError=i})),Jc=a(((e,t)=>{var n=qc();e=t.exports={},e.program=new n.Command,e.Argument=n.Argument,e.Command=n.Command,e.CommanderError=n.CommanderError,e.Help=n.Help,e.InvalidArgumentError=n.InvalidArgumentError,e.InvalidOptionArgumentError=n.InvalidArgumentError,e.Option=n.Option,e.createCommand=e=>new n.Command(e),e.createOption=(e,t)=>new n.Option(e,t),e.createArgument=(e,t)=>new n.Argument(e,t)}));s(),f(),ee(),Hi(),vi(),ia(),ua(),Xi(),aa(),Wa(),ea(),U(),po(),ma(),Go();var{program:Yc,createCommand:Xc,createArgument:Zc,createOption:Qc,CommanderError:$c,InvalidArgumentError:el,InvalidOptionArgumentError:tl,Command:nl,Argument:rl,Option:J,Help:il}=r(Jc(),1).default;te();var al=r(Yr(),1);Jr();var Y=ei();Zr(),li(),Wi(),Ka(),Qa(),no(),io(),Xa(),oo(),so(),pa(),lo(),ho(),ya(),ui(),bo(),ha(),So(),_a(),I(),Aa(),as(),Ha(),z(),Ts(),Es(),ns(),Do(),ls(),Xo(),Os(),$o(),Ao(),jo(),Zo(),wo(),Bo(),mn(),St(),Pr(),Rs(),tr(),ps(),Mt(),S(),Nr(),or(),Nt(),Ns(),Er(),Fe(),jr(),ms(),bs(),kt(),Hn(),zt(),kn(),Dr(),Qs(),_n(),rc(),vn(),jn(),C(),He(),Tt(),ut(),cr(),ze(),rt(),_(),Ne(),A(),vo(),eo();var ol=!1;function sl(){if(ol||(ol=!0,to())||d(process.env.CLAUDE_CODE_USE_BEDROCK)||d(process.env.CLAUDE_CODE_USE_VERTEX)||d(process.env.CLAUDE_CODE_USE_FOUNDRY)||process.env.HTTPS_PROXY||process.env.https_proxy||process.env.HTTP_PROXY||process.env.http_proxy||process.env.ANTHROPIC_UNIX_SOCKET||process.env.CLAUDE_CODE_CLIENT_CERT||process.env.CLAUDE_CODE_CLIENT_KEY)return;let e=process.env.ANTHROPIC_BASE_URL||go().BASE_API_URL;fetch(e,{method:`HEAD`,signal:AbortSignal.timeout(1e4)}).catch(()=>{})}function cl(){if(process.env.NODE_EXTRA_CA_CERTS)return;let e=ll();e&&(process.env.NODE_EXTRA_CA_CERTS=e,F(`CA certs: Applied NODE_EXTRA_CA_CERTS from config to process.env: ${e}`))}function ll(){try{let e=R()?.env,t=va(`userSettings`)?.env;F(`CA certs: Config fallback - globalEnv keys: ${e?Object.keys(e).join(`,`):`none`}, settingsEnv keys: ${t?Object.keys(t).join(`,`):`none`}`);let n=t?.NODE_EXTRA_CA_CERTS||e?.NODE_EXTRA_CA_CERTS;return n&&F(`CA certs: Found NODE_EXTRA_CA_CERTS in config/settings: ${n}`),n}catch(e){F(`CA certs: Config fallback failed: ${e}`,{level:`error`});return}}z(),ea(),Ws(),Fs(),f(),_c(),Us(),Hs(),tc();var ul=!1,dl=o(async()=>{let e=Date.now();V(`info`,`init_started`),G(`init_function_start`);try{let t=Date.now();za(),Vr({loadTheme:()=>R().theme,saveTheme:e=>B(t=>({...t,theme:e}))}),V(`info`,`init_configs_enabled`,{duration_ms:Date.now()-t}),G(`init_configs_enabled`);let n=Date.now();gc();try{let{restoreActiveProvider:e}=await import(`./switcher-B2CYzCC_.js`),t=await e();if(t?.warnings.length)for(let e of t.warnings)F(`[init] ${e}`)}catch(e){F(`[init] restoreActiveProvider failed: ${e instanceof Error?e.message:String(e)}`,{level:`warn`})}cl(),V(`info`,`init_safe_env_vars_applied`,{duration_ms:Date.now()-n}),G(`init_safe_env_vars_applied`),zn(),G(`init_after_graceful_shutdown`),import(`./firstPartyEventLogger-BBXEQUf0.js`).then(e=>{e.initialize1PEventLogging()}),G(`init_after_1p_event_logging`),import(`./poller-CpLBoB-N.js`).then(e=>e.startBalancePolling()),G(`init_after_balance_polling`),No(),G(`init_after_oauth_populate`),Ps(),G(`init_after_jetbrains_detection`),Gs(),uc()&&cc(),vr()&&gt(),G(`init_after_remote_settings_check`),Na();let r=Date.now();F(`[init] configureGlobalMTLS starting`),ws(),V(`info`,`init_mtls_configured`,{duration_ms:Date.now()-r}),F(`[init] configureGlobalMTLS complete`);let i=Date.now();if(F(`[init] configureGlobalAgents starting`),Ds(),V(`info`,`init_proxy_configured`,{duration_ms:Date.now()-i}),F(`[init] configureGlobalAgents complete`),G(`init_network_configured`),await $s(),sl(),d(process.env.CLAUDE_CODE_REMOTE))try{let{initUpstreamProxy:e,getUpstreamProxyEnv:t}=await import(`./upstreamproxy-DDVMwoRi.js`),{registerUpstreamProxyEnvFn:n}=await import(`./subprocessEnv-CZkA9Cdp.js`);n(t),await e()}catch(e){F(`[init] upstreamproxy init failed: ${e instanceof Error?e.message:String(e)}; continuing without proxy`,{level:`warn`})}if(co(),sa(it),x()){let e=Date.now();await Ke(),V(`info`,`init_scratchpad_created`,{duration_ms:Date.now()-e})}try{let{getRipgrepStatus:e}=await import(`./ripgrep-BisRODQ2.js`),t=e();t.note&&process.stderr.write(`[ripgrep] ${t.note}\n`)}catch{F(`[init] ripgrep status check skipped`)}V(`info`,`init_completed`,{duration_ms:Date.now()-e}),G(`init_function_end`)}catch(e){if(e instanceof na){if(Ui()){process.stderr.write(`Configuration error in ${e.filePath}: ${e.message}\n`),un(1);return}return import(`./InvalidConfigDialog-WRywkKeS.js`).then(t=>t.showInvalidConfigDialog({error:e}))}else throw e}});function fl(){uc()?(Ui()&&Bs()&&pl().catch(e=>{F(`[3P telemetry] Eager telemetry init failed (beta tracing): ${P(e)}`,{level:`error`})}),F(`[3P telemetry] Waiting for remote managed settings before telemetry init`),lc().then(async()=>{F(`[3P telemetry] Remote managed settings loaded, initializing telemetry`),vc(),await pl()}).catch(e=>{F(`[3P telemetry] Telemetry init failed (remote settings path): ${P(e)}`,{level:`error`})})):pl().catch(e=>{F(`[3P telemetry] Telemetry init failed: ${P(e)}`,{level:`error`})})}async function pl(){if(!ul){if(!d(process.env.CLAUDE_CODE_ENABLE_TELEMETRY)){ul=!0,F(`[3P telemetry] Skipped — CLAUDE_CODE_ENABLE_TELEMETRY not set`);return}ul=!0;try{await ml()}catch(e){throw ul=!1,e}}}async function ml(){let{initializeTelemetry:e}=await import(`./instrumentation-BmWotlxR.js`),t=await e();t&&(gi(t,(e,n)=>{let r=t?.createCounter(e,n);return{add(e,t={}){let n={...Vs(),...t};r?.add(e,n)}}}),Li()?.add(1))}Re();async function hl(e,t,n,r){let{App:i}=await import(`./App-DW4elk6E.js`),{REPL:a}=await import(`./REPL-oBemMXvp.js`);await r(e,(0,Y.jsx)(i,{...t,children:(0,Y.jsx)(a,{...n})}))}ic(),vo(),z(),ea(),eo();var gl=ci(()=>si({client_data:ni(N(),ti()).nullish(),additional_model_options:ai(si({model:N(),name:N(),description:N()}).transform(({model:e,name:t,description:n})=>({value:e,label:t,description:n}))).nullish()}));async function _l(){if(to())return F(`[Bootstrap] Skipped: Nonessential traffic disabled`),null;if(Vo()!==`firstParty`)return F(`[Bootstrap] Skipped: 3P provider`),null;let e=us();if(!(Mo()?.accessToken&&fs())&&!e)return F(`[Bootstrap] Skipped: no usable OAuth or API key`),null;let t=`${go().BASE_API_URL}/api/claude_cli/bootstrap`;try{return await rs(async()=>{let n=Mo()?.accessToken,r;if(n&&fs())r={Authorization:`Bearer ${n}`,"anthropic-beta":_o};else if(e)r={"x-api-key":e};else return F(`[Bootstrap] No auth available on retry, aborting`),null;F(`[Bootstrap] Fetching`);let i=await g.get(t,{headers:{"Content-Type":`application/json`,"User-Agent":ks(),...r},timeout:5e3}),a=gl().safeParse(i.data);return a.success?(F(`[Bootstrap] Fetch ok`),a.data):(F(`[Bootstrap] Response failed validation: ${a.error.message}`),null)})}catch(e){throw F(`[Bootstrap] Fetch failed: ${g.isAxiosError(e)?e.response?.status??e.code:`unknown`}`),e}}async function vl(){try{let e=await _l();if(!e)return;let t=e.client_data??null,n=e.additional_model_options??[],r=R();if(Uo(r.clientDataCache,t)&&Uo(r.additionalModelOptionsCache,n)){F(`[Bootstrap] Cache unchanged, skipping write`);return}F(`[Bootstrap] Cache updated, persisting to disk`),B(e=>({...e,clientDataCache:t,additionalModelOptionsCache:n}))}catch(e){H(e)}}qo(),hn(),ge(),ea(),f();var yl=new Map;function bl(){let e=process.argv[1]||``,t=process.execPath||process.argv[0]||``;ao()===`windows`&&(e=e.split(Ic.sep).join(Pc.sep),t=t.split(Ic.sep).join(Pc.sep));let n=[e,t],r=[`/build-ant/`,`/build-external/`,`/build-external-native/`,`/build-ant-native/`];return n.some(e=>r.some(t=>e.includes(t)))}var xl=[/MaxListenersExceededWarning.*AbortSignal/,/MaxListenersExceededWarning.*EventTarget/];function Sl(e){let t=`${e.name}: ${e.message}`;return xl.some(e=>e.test(t))}var Cl=null;function wl(){let e=process.listeners(`warning`);Cl&&e.includes(Cl)||(bl()||process.removeAllListeners(`warning`),Cl=e=>{try{let t=`${e.name}: ${e.message.slice(0,50)}`,n=yl.get(t)||0;(yl.has(t)||yl.size<1e3)&&yl.set(t,n+1);let r=Sl(e);W(`tengu_node_warning`,{is_internal:+!!r,occurrence_count:n+1,classname:e.name}),d(process.env.CLAUDE_DEBUG)&&F(`${r?`[Internal Warning]`:`[Warning]`} ${e.toString()}`,{level:`warn`})}catch{}},process.on(`warning`,Cl))}jt(),ot(),Rn(),dr(),we(),Zr();function Tl(){return(0,Y.jsxs)(Gr,{children:[`MCP servers may execute code or access system resources. All tool calls require approval. Learn more in the`,` `,(0,Y.jsx)(Wr,{url:`https://code.claude.com/docs/en/mcp`,children:`MCP documentation`}),`.`]})}U(),I(),Zr();function El({serverName:e,onDone:t}){function n(n){switch(W(`tengu_mcp_dialog_choice`,{choice:n}),n){case`yes`:case`yes_all`:{let r=(ba()||{}).enabledMcpjsonServers||[];r.includes(e)||L(`localSettings`,{enabledMcpjsonServers:[...r,e]}),n===`yes_all`&&L(`localSettings`,{enableAllProjectMcpServers:!0}),t();break}case`no`:{let n=(ba()||{}).disabledMcpjsonServers||[];n.includes(e)||L(`localSettings`,{disabledMcpjsonServers:[...n,e]}),t();break}}}return(0,Y.jsxs)($r,{title:`New MCP server found in .mcp.json: ${e}`,color:`warning`,onCancel:()=>n(`no`),children:[(0,Y.jsx)(Tl,{}),(0,Y.jsx)(ln,{options:[{label:`Use this and all future MCP servers in this project`,value:`yes_all`},{label:`Use this MCP server`,value:`yes`},{label:`Continue without using this MCP server`,value:`no`}],onChange:e=>n(e),onCancel:()=>n(`no`)})]})}Ls(),U(),Zr(),I(),mr();function Dl({serverNames:e,onDone:t}){function n(n){let r=ba()||{},i=r.enabledMcpjsonServers||[],a=r.disabledMcpjsonServers||[],[o,s]=Is(e,e=>n.includes(e));W(`tengu_mcp_multidialog_choice`,{approved:o.length,rejected:s.length}),o.length>0&&L(`localSettings`,{enabledMcpjsonServers:[...new Set([...i,...o])]}),s.length>0&&L(`localSettings`,{disabledMcpjsonServers:[...new Set([...a,...s])]}),t()}let r=(0,al.useCallback)(()=>{let n=(ba()||{}).disabledMcpjsonServers||[];L(`localSettings`,{disabledMcpjsonServers:[...new Set([...n,...e])]}),t()},[e,t]);return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)($r,{title:`${e.length} new MCP servers found in .mcp.json`,subtitle:`Select any you wish to enable.`,color:`warning`,onCancel:r,hideInputGuide:!0,children:[(0,Y.jsx)(Tl,{}),(0,Y.jsx)(Yn,{options:e.map(e=>({label:e,value:e})),defaultValue:e,onSubmit:n,onCancel:r,hideIndexes:!0})]}),(0,Y.jsx)(Ur,{paddingX:1,children:(0,Y.jsx)(Gr,{dimColor:!0,italic:!0,children:(0,Y.jsxs)(qr,{children:[(0,Y.jsx)(Hr,{shortcut:`Space`,action:`select`}),(0,Y.jsx)(Hr,{shortcut:`Enter`,action:`confirm`}),(0,Y.jsx)(D,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`reject all`})]})})})]})}Kn();async function Ol(e){let{servers:t}=re(`project`),n=Object.keys(t).filter(e=>Ut(e)===`pending`);n.length!==0&&await new Promise(t=>{let r=()=>void t();if(n.length===1&&n[0]!==void 0){let t=n[0];e.render((0,Y.jsx)(Xt,{children:(0,Y.jsx)(at,{children:(0,Y.jsx)(El,{serverName:t,onDone:r})})}))}else e.render((0,Y.jsx)(Xt,{children:(0,Y.jsx)(at,{children:(0,Y.jsx)(Dl,{serverNames:n,onDone:r})})}))})}Ca(),Pn(),yn(),Ie(),w(),Ln(),gn(),ae(),z(),ea();var kl={iterm:`iTerm`,"iterm.app":`iTerm`,ghostty:`Ghostty`,kitty:`kitty`,alacritty:`Alacritty`,wezterm:`WezTerm`,apple_terminal:`Terminal`};function Al(){if(process.platform!==`darwin`)return;let e=process.env.TERM_PROGRAM;if(!e)return;let t=kl[e.toLowerCase()];t&&R().deepLinkTerminal!==t&&(B(e=>({...e,deepLinkTerminal:t})),F(`Stored deep link terminal preference: ${t}`))}var jl=class{constructor(){h(this,`frameDurations`,[]),h(this,`firstRenderTime`,void 0),h(this,`lastRenderTime`,void 0)}record(e){let t=performance.now();this.firstRenderTime===void 0&&(this.firstRenderTime=t),this.lastRenderTime=t,this.frameDurations.push(e)}getMetrics(){if(this.frameDurations.length===0||this.firstRenderTime===void 0||this.lastRenderTime===void 0)return;let e=this.lastRenderTime-this.firstRenderTime;if(e<=0)return;let t=this.frameDurations.length/(e/1e3),n=this.frameDurations.slice().sort((e,t)=>t-e),r=n[Math.max(0,Math.ceil(n.length*.01)-1)],i=r>0?1e3/r:0;return{averageFps:Math.round(t*100)/100,low1PctFps:Math.round(i*100)/100}}};U(),_n(),vi(),Zr(),we(),Kn(),z(),f(),_c(),dc(),I();function Ml(){B(e=>({...e,hasCompletedOnboarding:!0,lastOnboardingVersion:`0.0.9`}))}function Nl(e,t){return new Promise(n=>{e.render(t(e=>void n(e)))})}async function X(e,t,n){return Pl(e,t,{color:`error`,beforeExit:n})}async function Pl(e,t,n){let{Text:r}=await import(`./src-r6ZFgWPx2.js`),i=n?.color,a=n?.exitCode??1;e.render(i?(0,Y.jsx)(r,{color:i,children:t}):(0,Y.jsx)(r,{children:t})),e.unmount(),await n?.beforeExit?.(),process.exit(a)}function Z(e,t,n){return Nl(e,e=>(0,Y.jsx)(Kr,{initialState:R().theme,onThemeSave:e=>B(t=>({...t,theme:e})),children:(0,Y.jsx)(Xt,{onChangeAppState:n?.onChangeAppState,children:(0,Y.jsx)(at,{children:t(e)})})}))}async function Fl(e,t){e.render(t),dd(),await e.waitUntilExit(),await j(0)}async function Il(e,t,n,r){if(d(!1)||process.env.IS_DEMO)return!1;let i=R(),a=!1;if(!i.theme||!i.hasCompletedOnboarding){a=!0;let{Onboarding:t}=await import(`./Onboarding-BboWs1pp.js`);await Z(e,e=>(0,Y.jsx)(t,{onDone:()=>{Ml(),e()}}),{onChangeAppState:yc})}if(!d(process.env.CLAUBBIT)){if(!Ia()){let{TrustDialog:t}=await import(`./TrustDialog-CWt-4Evl.js`);await Z(e,e=>(0,Y.jsx)(t,{commands:r,onDone:e}))}Ri(!0),pe();let{errors:t}=fc();if(t.length===0&&await Ol(e),await pt()){let t=Je(await st(!0)),{ClaudeMdExternalIncludesDialog:n}=await import(`./ClaudeMdExternalIncludesDialog-DpecRCAt.js`);await Z(e,e=>(0,Y.jsx)(n,{onDone:e,isStandaloneDialog:!0,externalIncludes:t}))}}if(wc(),Al(),vc(),setImmediate(()=>fl()),await ac()){let{GroveDialog:t}=await import(`./Grove-BmirUB6V.js`);if(await Z(e,e=>(0,Y.jsx)(t,{showIfAlreadyViewed:!1,location:a?`onboarding`:`policy_update_modal`,onDone:e}))===`escape`)return W(`tengu_grove_policy_exited`,{}),un(0),!1}if(process.env.ANTHROPIC_API_KEY&&!l()){let t=Fo(process.env.ANTHROPIC_API_KEY);if(Ba(t)===`new`){let{ApproveApiKey:n}=await import(`./ApproveApiKey-D05WywHU.js`);await Z(e,e=>(0,Y.jsx)(n,{customApiKeyTruncated:t,onDone:e}),{onChangeAppState:yc})}}if((t===`bypassPermissions`||n)&&!xa()){let{BypassPermissionsModeDialog:t}=await import(`./BypassPermissionsModeDialog-BuRFF1fQ.js`);await Z(e,e=>(0,Y.jsx)(t,{onAccept:e}))}return a}function Ll(e){let t=0,n=Cc(e);n.stdin&&W(`tengu_stdin_interactive`,{});let r=new jl,i=Sc();Pi(i);let a=process.env.CLAUDE_CODE_FRAME_TIMING_LOG;return{getFpsMetrics:()=>r.getMetrics(),stats:i,renderOptions:{...n,onFrame:e=>{if(r.record(e.durationMs),i.observe(`frame_duration_ms`,e.durationMs),a&&e.phases){let t=JSON.stringify({total:e.durationMs,...e.phases,rss:process.memoryUsage.rss(),cpu:process.cpuUsage()})+`
20
- `;Lc(a,t)}if(!Xr())for(let n of e.flickers){if(n.reason===`resize`)continue;let e=Date.now();e-t<1e3&&W(`tengu_flicker`,{desiredHeight:n.desiredHeight,actualHeight:n.availableHeight,reason:n.reason}),t=e}}}}}we();async function Rl(e,t){let{InvalidSettingsDialog:n}=await import(`./InvalidSettingsDialog-C4n3A72C.js`);return Z(e,e=>(0,Y.jsx)(n,{settingsErrors:t.settingsErrors,onContinue:e,onExit:t.onExit}))}async function zl(e){let{TeleportResumeWrapper:t}=await import(`./TeleportResumeWrapper-GptvrUdv.js`);return Z(e,e=>(0,Y.jsx)(t,{onComplete:e,onCancel:()=>e(null),source:`cliArg`}))}async function Bl(e,t){let{TeleportRepoMismatchDialog:n}=await import(`./TeleportRepoMismatchDialog-sgxNOeM_.js`);return Z(e,e=>(0,Y.jsx)(n,{targetRepo:t.targetRepo,initialPaths:t.initialPaths,onSelectPath:e,onCancel:()=>e(null)}))}async function Vl(e,t,n,r){let[i,{ResumeConversation:a},{App:o}]=await Promise.all([n,import(`./ResumeConversation-wBG8OD9P.js`),import(`./App-DW4elk6E.js`)]);await Fl(e,(0,Y.jsx)(o,{getFpsMetrics:t.getFpsMetrics,stats:t.stats,initialState:t.initialState,children:(0,Y.jsx)(at,{children:(0,Y.jsx)(a,{...r,worktreePaths:i})})}))}_s(),hs();var Hl=5,Ul=30,Wl=`After you finish implementing the change:
21
- 1. **Simplify** — Invoke the \`${ys}\` tool with \`skill: "simplify"\` to review and clean up your changes.
19
+ Expecting one of '${n.join(`', '`)}'`);let r=`${e}Help`;return this.on(r,e=>{let n;n=typeof t==`function`?t({error:e.error,command:e.command}):t,n&&e.write(`${n}\n`)}),this}_outputHelpIfRequested(e){let t=this._getHelpOption();t&&e.find(e=>t.is(e))&&(this.outputHelp(),this._exit(0,`commander.helpDisplayed`,`(outputHelp)`))}};function h(e){return e.map(e=>{if(!e.startsWith(`--inspect`))return e;let t,n=`127.0.0.1`,r=`9229`,i;return(i=e.match(/^(--inspect(-brk)?)$/))===null?(i=e.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))===null?(i=e.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(t=i[1],n=i[3],r=i[4]):(t=i[1],/^\d+$/.test(i[3])?r=i[3]:n=i[3]):t=i[1],t&&r!==`0`?`${t}=${n}:${parseInt(r)+1}`:e})}function g(){if(o.env.NO_COLOR||o.env.FORCE_COLOR===`0`||o.env.FORCE_COLOR===`false`)return!1;if(o.env.FORCE_COLOR||o.env.CLICOLOR_FORCE!==void 0)return!0}e.Command=ee,e.useColor=g})),qc=a((e=>{var{Argument:t}=Hc(),{Command:n}=Kc(),{CommanderError:r,InvalidArgumentError:i}=Vc(),{Help:a}=Uc(),{Option:o}=Wc();e.program=new n,e.createCommand=e=>new n(e),e.createOption=(e,t)=>new o(e,t),e.createArgument=(e,n)=>new t(e,n),e.Command=n,e.Option=o,e.Argument=t,e.Help=a,e.CommanderError=r,e.InvalidArgumentError=i,e.InvalidOptionArgumentError=i})),Jc=a(((e,t)=>{var n=qc();e=t.exports={},e.program=new n.Command,e.Argument=n.Argument,e.Command=n.Command,e.CommanderError=n.CommanderError,e.Help=n.Help,e.InvalidArgumentError=n.InvalidArgumentError,e.InvalidOptionArgumentError=n.InvalidArgumentError,e.Option=n.Option,e.createCommand=e=>new n.Command(e),e.createOption=(e,t)=>new n.Option(e,t),e.createArgument=(e,t)=>new n.Argument(e,t)}));s(),f(),ee(),Pi(),Si(),ra(),la(),Yi(),ia(),Ua(),$i(),W(),fo(),pa(),Wo();var{program:Yc,createCommand:Xc,createArgument:Zc,createOption:Qc,CommanderError:$c,InvalidArgumentError:el,InvalidOptionArgumentError:tl,Command:nl,Argument:rl,Option:J,Help:il}=r(Jc(),1).default;te();var al=r(Jr(),1);qr();var Y=$r();Xr(),ci(),Ui(),Ga(),Za(),to(),ro(),Ya(),ao(),oo(),fa(),co(),mo(),va(),li(),yo(),ma(),xo(),ga(),L(),ka(),is(),Va(),B(),ws(),Ts(),ts(),Eo(),cs(),Yo(),Ds(),Qo(),ko(),Ao(),Xo(),Co(),zo(),gs(),ur(),k(),Fs(),w(),It(),At(),de(),Fn(),dr(),Ke(),y(),ks(),Pn(),wr(),vs(),ys(),ve(),hr(),_(),Qt(),on(),Qs(),rr(),rc(),ir(),qt(),Se(),bt(),Yn(),oe(),Qn(),v(),xe(),he(),Le(),wn(),_o(),$a();var ol=!1;function sl(){if(ol||(ol=!0,eo())||d(process.env.CLAUDE_CODE_USE_BEDROCK)||d(process.env.CLAUDE_CODE_USE_VERTEX)||d(process.env.CLAUDE_CODE_USE_FOUNDRY)||process.env.HTTPS_PROXY||process.env.https_proxy||process.env.HTTP_PROXY||process.env.http_proxy||process.env.ANTHROPIC_UNIX_SOCKET||process.env.CLAUDE_CODE_CLIENT_CERT||process.env.CLAUDE_CODE_CLIENT_KEY)return;let e=process.env.ANTHROPIC_BASE_URL||ho().BASE_API_URL;fetch(e,{method:`HEAD`,signal:AbortSignal.timeout(1e4)}).catch(()=>{})}function cl(){if(process.env.NODE_EXTRA_CA_CERTS)return;let e=ll();e&&(process.env.NODE_EXTRA_CA_CERTS=e,I(`CA certs: Applied NODE_EXTRA_CA_CERTS from config to process.env: ${e}`))}function ll(){try{let e=z()?.env,t=_a(`userSettings`)?.env;I(`CA certs: Config fallback - globalEnv keys: ${e?Object.keys(e).join(`,`):`none`}, settingsEnv keys: ${t?Object.keys(t).join(`,`):`none`}`);let n=t?.NODE_EXTRA_CA_CERTS||e?.NODE_EXTRA_CA_CERTS;return n&&I(`CA certs: Found NODE_EXTRA_CA_CERTS in config/settings: ${n}`),n}catch(e){I(`CA certs: Config fallback failed: ${e}`,{level:`error`});return}}B(),$i(),Ws(),zs(),f(),_c(),Us(),Hs(),tc();var ul=!1,dl=o(async()=>{let e=Date.now();H(`info`,`init_started`),K(`init_function_start`);try{let t=Date.now();Ra(),Br({loadTheme:()=>z().theme,saveTheme:e=>V(t=>({...t,theme:e}))}),H(`info`,`init_configs_enabled`,{duration_ms:Date.now()-t}),K(`init_configs_enabled`);let n=Date.now();gc();try{let{restoreActiveProvider:e}=await import(`./switcher-4KzBvuKH.js`),t=await e();if(t?.warnings.length)for(let e of t.warnings)I(`[init] ${e}`)}catch(e){I(`[init] restoreActiveProvider failed: ${e instanceof Error?e.message:String(e)}`,{level:`warn`})}cl(),H(`info`,`init_safe_env_vars_applied`,{duration_ms:Date.now()-n}),K(`init_safe_env_vars_applied`),Ut(),K(`init_after_graceful_shutdown`),import(`./firstPartyEventLogger-BfCYN7lt.js`).then(e=>{e.initialize1PEventLogging()}),K(`init_after_1p_event_logging`),import(`./poller-CpLBoB-N.js`).then(e=>e.startBalancePolling()),K(`init_after_balance_polling`),Mo(),K(`init_after_oauth_populate`),Rs(),K(`init_after_jetbrains_detection`),Gs(),lc()&&sc(),gn()&&Jn(),K(`init_after_remote_settings_check`),Ma();let r=Date.now();I(`[init] configureGlobalMTLS starting`),Cs(),H(`info`,`init_mtls_configured`,{duration_ms:Date.now()-r}),I(`[init] configureGlobalMTLS complete`);let i=Date.now();if(I(`[init] configureGlobalAgents starting`),Es(),H(`info`,`init_proxy_configured`,{duration_ms:Date.now()-i}),I(`[init] configureGlobalAgents complete`),K(`init_network_configured`),await $s(),sl(),d(process.env.CLAUDE_CODE_REMOTE))try{let{initUpstreamProxy:e,getUpstreamProxyEnv:t}=await import(`./upstreamproxy-DF00RzGG.js`),{registerUpstreamProxyEnvFn:n}=await import(`./subprocessEnv-CZkA9Cdp.js`);n(t),await e()}catch(e){I(`[init] upstreamproxy init failed: ${e instanceof Error?e.message:String(e)}; continuing without proxy`,{level:`warn`})}if(so(),oa(Tt),We()){let e=Date.now();await Je(),H(`info`,`init_scratchpad_created`,{duration_ms:Date.now()-e})}try{let{getRipgrepStatus:e}=await import(`./ripgrep-e-iewvTf.js`),t=e();t.note&&process.stderr.write(`[ripgrep] ${t.note}\n`)}catch{I(`[init] ripgrep status check skipped`)}H(`info`,`init_completed`,{duration_ms:Date.now()-e}),K(`init_function_end`)}catch(e){if(e instanceof ta){if(Hi()){process.stderr.write(`Configuration error in ${e.filePath}: ${e.message}\n`),Bn(1);return}return import(`./InvalidConfigDialog-o9DF1REI.js`).then(t=>t.showInvalidConfigDialog({error:e}))}else throw e}});function fl(){lc()?(Hi()&&Bs()&&pl().catch(e=>{I(`[3P telemetry] Eager telemetry init failed (beta tracing): ${F(e)}`,{level:`error`})}),I(`[3P telemetry] Waiting for remote managed settings before telemetry init`),cc().then(async()=>{I(`[3P telemetry] Remote managed settings loaded, initializing telemetry`),vc(),await pl()}).catch(e=>{I(`[3P telemetry] Telemetry init failed (remote settings path): ${F(e)}`,{level:`error`})})):pl().catch(e=>{I(`[3P telemetry] Telemetry init failed: ${F(e)}`,{level:`error`})})}async function pl(){if(!ul){if(!d(process.env.CLAUDE_CODE_ENABLE_TELEMETRY)){ul=!0,I(`[3P telemetry] Skipped — CLAUDE_CODE_ENABLE_TELEMETRY not set`);return}ul=!0;try{await ml()}catch(e){throw ul=!1,e}}}async function ml(){let{initializeTelemetry:e}=await import(`./instrumentation-DaiPDUst.js`),t=await e();t&&(yi(t,(e,n)=>{let r=t?.createCounter(e,n);return{add(e,t={}){let n={...Vs(),...t};r?.add(e,n)}}}),Mi()?.add(1))}Rr();async function hl(e,t,n,r){let{App:i}=await import(`./App-C2yQjBgY.js`),{REPL:a}=await import(`./REPL-Bf46iQCN.js`);await r(e,(0,Y.jsx)(i,{...t,children:(0,Y.jsx)(a,{...n})}))}Ls(),_o(),B(),$i(),$a();var gl=si(()=>oi({client_data:ti(P(),ei()).nullish(),additional_model_options:ii(oi({model:P(),name:P(),description:P()}).transform(({model:e,name:t,description:n})=>({value:e,label:t,description:n}))).nullish()}));async function _l(){if(eo())return I(`[Bootstrap] Skipped: Nonessential traffic disabled`),null;if(Bo()!==`firstParty`)return I(`[Bootstrap] Skipped: 3P provider`),null;let e=ls();if(!(jo()?.accessToken&&ds())&&!e)return I(`[Bootstrap] Skipped: no usable OAuth or API key`),null;let t=`${ho().BASE_API_URL}/api/claude_cli/bootstrap`;try{return await ns(async()=>{let n=jo()?.accessToken,r;if(n&&ds())r={Authorization:`Bearer ${n}`,"anthropic-beta":go};else if(e)r={"x-api-key":e};else return I(`[Bootstrap] No auth available on retry, aborting`),null;I(`[Bootstrap] Fetching`);let i=await g.get(t,{headers:{"Content-Type":`application/json`,"User-Agent":Os(),...r},timeout:5e3}),a=gl().safeParse(i.data);return a.success?(I(`[Bootstrap] Fetch ok`),a.data):(I(`[Bootstrap] Response failed validation: ${a.error.message}`),null)})}catch(e){throw I(`[Bootstrap] Fetch failed: ${g.isAxiosError(e)?e.response?.status??e.code:`unknown`}`),e}}async function vl(){try{let e=await _l();if(!e)return;let t=e.client_data??null,n=e.additional_model_options??[],r=z();if(Ho(r.clientDataCache,t)&&Ho(r.additionalModelOptionsCache,n)){I(`[Bootstrap] Cache unchanged, skipping write`);return}I(`[Bootstrap] Cache updated, persisting to disk`),V(e=>({...e,clientDataCache:t,additionalModelOptionsCache:n}))}catch(e){U(e)}}Ko(),jt(),St(),$i(),f();var yl=new Map;function bl(){let e=process.argv[1]||``,t=process.execPath||process.argv[0]||``;io()===`windows`&&(e=e.split(Ic.sep).join(Pc.sep),t=t.split(Ic.sep).join(Pc.sep));let n=[e,t],r=[`/build-ant/`,`/build-external/`,`/build-external-native/`,`/build-ant-native/`];return n.some(e=>r.some(t=>e.includes(t)))}var xl=[/MaxListenersExceededWarning.*AbortSignal/,/MaxListenersExceededWarning.*EventTarget/];function Sl(e){let t=`${e.name}: ${e.message}`;return xl.some(e=>e.test(t))}var Cl=null;function wl(){let e=process.listeners(`warning`);Cl&&e.includes(Cl)||(bl()||process.removeAllListeners(`warning`),Cl=e=>{try{let t=`${e.name}: ${e.message.slice(0,50)}`,n=yl.get(t)||0;(yl.has(t)||yl.size<1e3)&&yl.set(t,n+1);let r=Sl(e);G(`tengu_node_warning`,{is_internal:+!!r,occurrence_count:n+1,classname:e.name}),d(process.env.CLAUDE_DEBUG)&&I(`${r?`[Internal Warning]`:`[Warning]`} ${e.toString()}`,{level:`warn`})}catch{}},process.on(`warning`,Cl))}Cr(),hn(),Ht(),pr(),Ze(),Xr();function Tl(){return(0,Y.jsxs)(Wr,{children:[`MCP servers may execute code or access system resources. All tool calls require approval. Learn more in the`,` `,(0,Y.jsx)(Ur,{url:`https://code.claude.com/docs/en/mcp`,children:`MCP documentation`}),`.`]})}W(),L(),Xr();function El({serverName:e,onDone:t}){function n(n){switch(G(`tengu_mcp_dialog_choice`,{choice:n}),n){case`yes`:case`yes_all`:{let r=(ya()||{}).enabledMcpjsonServers||[];r.includes(e)||R(`localSettings`,{enabledMcpjsonServers:[...r,e]}),n===`yes_all`&&R(`localSettings`,{enableAllProjectMcpServers:!0}),t();break}case`no`:{let n=(ya()||{}).disabledMcpjsonServers||[];n.includes(e)||R(`localSettings`,{disabledMcpjsonServers:[...n,e]}),t();break}}}return(0,Y.jsxs)(Qr,{title:`New MCP server found in .mcp.json: ${e}`,color:`warning`,onCancel:()=>n(`no`),children:[(0,Y.jsx)(Tl,{}),(0,Y.jsx)(zn,{options:[{label:`Use this and all future MCP servers in this project`,value:`yes_all`},{label:`Use this MCP server`,value:`yes`},{label:`Continue without using this MCP server`,value:`no`}],onChange:e=>n(e),onCancel:()=>n(`no`)})]})}Ps(),W(),Xr(),L(),Ge();function Dl({serverNames:e,onDone:t}){function n(n){let r=ya()||{},i=r.enabledMcpjsonServers||[],a=r.disabledMcpjsonServers||[],[o,s]=Ns(e,e=>n.includes(e));G(`tengu_mcp_multidialog_choice`,{approved:o.length,rejected:s.length}),o.length>0&&R(`localSettings`,{enabledMcpjsonServers:[...new Set([...i,...o])]}),s.length>0&&R(`localSettings`,{disabledMcpjsonServers:[...new Set([...a,...s])]}),t()}let r=(0,al.useCallback)(()=>{let n=(ya()||{}).disabledMcpjsonServers||[];R(`localSettings`,{disabledMcpjsonServers:[...new Set([...n,...e])]}),t()},[e,t]);return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(Qr,{title:`${e.length} new MCP servers found in .mcp.json`,subtitle:`Select any you wish to enable.`,color:`warning`,onCancel:r,hideInputGuide:!0,children:[(0,Y.jsx)(Tl,{}),(0,Y.jsx)(Cn,{options:e.map(e=>({label:e,value:e})),defaultValue:e,onSubmit:n,onCancel:r,hideIndexes:!0})]}),(0,Y.jsx)(Hr,{paddingX:1,children:(0,Y.jsx)(Wr,{dimColor:!0,italic:!0,children:(0,Y.jsxs)(Kr,{children:[(0,Y.jsx)(Vr,{shortcut:`Space`,action:`select`}),(0,Y.jsx)(Vr,{shortcut:`Enter`,action:`confirm`}),(0,Y.jsx)(Re,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`reject all`})]})})})]})}pe();async function Ol(e){let{servers:t}=j(`project`),n=Object.keys(t).filter(e=>ne(e)===`pending`);n.length!==0&&await new Promise(t=>{let r=()=>void t();if(n.length===1&&n[0]!==void 0){let t=n[0];e.render((0,Y.jsx)(pt,{children:(0,Y.jsx)(T,{children:(0,Y.jsx)(El,{serverName:t,onDone:r})})}))}else e.render((0,Y.jsx)(pt,{children:(0,Y.jsx)(T,{children:(0,Y.jsx)(Dl,{serverNames:n,onDone:r})})}))})}Sa(),rn(),ot(),Ft(),mn(),Vt(),nr(),le(),B(),$i();var kl={iterm:`iTerm`,"iterm.app":`iTerm`,ghostty:`Ghostty`,kitty:`kitty`,alacritty:`Alacritty`,wezterm:`WezTerm`,apple_terminal:`Terminal`};function Al(){if(process.platform!==`darwin`)return;let e=process.env.TERM_PROGRAM;if(!e)return;let t=kl[e.toLowerCase()];t&&z().deepLinkTerminal!==t&&(V(e=>({...e,deepLinkTerminal:t})),I(`Stored deep link terminal preference: ${t}`))}var jl=class{constructor(){h(this,`frameDurations`,[]),h(this,`firstRenderTime`,void 0),h(this,`lastRenderTime`,void 0)}record(e){let t=performance.now();this.firstRenderTime===void 0&&(this.firstRenderTime=t),this.lastRenderTime=t,this.frameDurations.push(e)}getMetrics(){if(this.frameDurations.length===0||this.firstRenderTime===void 0||this.lastRenderTime===void 0)return;let e=this.lastRenderTime-this.firstRenderTime;if(e<=0)return;let t=this.frameDurations.length/(e/1e3),n=this.frameDurations.slice().sort((e,t)=>t-e),r=n[Math.max(0,Math.ceil(n.length*.01)-1)],i=r>0?1e3/r:0;return{averageFps:Math.round(t*100)/100,low1PctFps:Math.round(i*100)/100}}};W(),rr(),Si(),Xr(),Ze(),pe(),B(),f(),_c(),uc(),L();function Ml(){V(e=>({...e,hasCompletedOnboarding:!0,lastOnboardingVersion:`0.0.10`}))}function Nl(e,t){return new Promise(n=>{e.render(t(e=>void n(e)))})}async function X(e,t,n){return Pl(e,t,{color:`error`,beforeExit:n})}async function Pl(e,t,n){let{Text:r}=await import(`./src-r6ZFgWPx2.js`),i=n?.color,a=n?.exitCode??1;e.render(i?(0,Y.jsx)(r,{color:i,children:t}):(0,Y.jsx)(r,{children:t})),e.unmount(),await n?.beforeExit?.(),process.exit(a)}function Z(e,t,n){return Nl(e,e=>(0,Y.jsx)(Gr,{initialState:z().theme,onThemeSave:e=>V(t=>({...t,theme:e})),children:(0,Y.jsx)(pt,{onChangeAppState:n?.onChangeAppState,children:(0,Y.jsx)(T,{children:t(e)})})}))}async function Fl(e,t){e.render(t),dd(),await e.waitUntilExit(),await M(0)}async function Il(e,t,n,r){if(d(!1)||process.env.IS_DEMO)return!1;let i=z(),a=!1;if(!i.theme||!i.hasCompletedOnboarding){a=!0;let{Onboarding:t}=await import(`./Onboarding-ClwHS5rh.js`);await Z(e,e=>(0,Y.jsx)(t,{onDone:()=>{Ml(),e()}}),{onChangeAppState:yc})}if(!d(process.env.CLAUBBIT)){if(!Fa()){let{TrustDialog:t}=await import(`./TrustDialog-Fk4m_Sy4.js`);await Z(e,e=>(0,Y.jsx)(t,{commands:r,onDone:e}))}ui(!0),jr();let{errors:t}=dc();if(t.length===0&&await Ol(e),await be()){let t=Kt(await dt(!0)),{ClaudeMdExternalIncludesDialog:n}=await import(`./ClaudeMdExternalIncludesDialog-C0-psohX.js`);await Z(e,e=>(0,Y.jsx)(n,{onDone:e,isStandaloneDialog:!0,externalIncludes:t}))}}if(wc(),Al(),vc(),setImmediate(()=>fl()),await ic()){let{GroveDialog:t}=await import(`./Grove-B9-hhkZA.js`);if(await Z(e,e=>(0,Y.jsx)(t,{showIfAlreadyViewed:!1,location:a?`onboarding`:`policy_update_modal`,onDone:e}))===`escape`)return G(`tengu_grove_policy_exited`,{}),Bn(0),!1}if(process.env.ANTHROPIC_API_KEY&&!l()){let t=Po(process.env.ANTHROPIC_API_KEY);if(za(t)===`new`){let{ApproveApiKey:n}=await import(`./ApproveApiKey-CKbv5C1x.js`);await Z(e,e=>(0,Y.jsx)(n,{customApiKeyTruncated:t,onDone:e}),{onChangeAppState:yc})}}if((t===`bypassPermissions`||n)&&!ba()){let{BypassPermissionsModeDialog:t}=await import(`./BypassPermissionsModeDialog-CLSACUmo.js`);await Z(e,e=>(0,Y.jsx)(t,{onAccept:e}))}return a}function Ll(e){let t=0,n=Cc(e);n.stdin&&G(`tengu_stdin_interactive`,{});let r=new jl,i=Sc();ki(i);let a=process.env.CLAUDE_CODE_FRAME_TIMING_LOG;return{getFpsMetrics:()=>r.getMetrics(),stats:i,renderOptions:{...n,onFrame:e=>{if(r.record(e.durationMs),i.observe(`frame_duration_ms`,e.durationMs),a&&e.phases){let t=JSON.stringify({total:e.durationMs,...e.phases,rss:process.memoryUsage.rss(),cpu:process.cpuUsage()})+`
20
+ `;Lc(a,t)}if(!Yr())for(let n of e.flickers){if(n.reason===`resize`)continue;let e=Date.now();e-t<1e3&&G(`tengu_flicker`,{desiredHeight:n.desiredHeight,actualHeight:n.availableHeight,reason:n.reason}),t=e}}}}}Ze();async function Rl(e,t){let{InvalidSettingsDialog:n}=await import(`./InvalidSettingsDialog-YyQcHocx.js`);return Z(e,e=>(0,Y.jsx)(n,{settingsErrors:t.settingsErrors,onContinue:e,onExit:t.onExit}))}async function zl(e){let{TeleportResumeWrapper:t}=await import(`./TeleportResumeWrapper-D6kpr2c6.js`);return Z(e,e=>(0,Y.jsx)(t,{onComplete:e,onCancel:()=>e(null),source:`cliArg`}))}async function Bl(e,t){let{TeleportRepoMismatchDialog:n}=await import(`./TeleportRepoMismatchDialog-B5I73j7Y.js`);return Z(e,e=>(0,Y.jsx)(n,{targetRepo:t.targetRepo,initialPaths:t.initialPaths,onSelectPath:e,onCancel:()=>e(null)}))}async function Vl(e,t,n,r){let[i,{ResumeConversation:a},{App:o}]=await Promise.all([n,import(`./ResumeConversation-Br2KsBoe.js`),import(`./App-C2yQjBgY.js`)]);await Fl(e,(0,Y.jsx)(o,{getFpsMetrics:t.getFpsMetrics,stats:t.stats,initialState:t.initialState,children:(0,Y.jsx)(T,{children:(0,Y.jsx)(a,{...r,worktreePaths:i})})}))}hs(),fs();var Hl=5,Ul=30,Wl=`After you finish implementing the change:
21
+ 1. **Simplify** — Invoke the \`${Ss}\` tool with \`skill: "simplify"\` to review and clean up your changes.
22
22
  2. **Run unit tests** — Run the project's test suite (check for package.json scripts, Makefile targets, or common commands like \`npm test\`, \`bun test\`, \`pytest\`, \`go test\`). If tests fail, fix them.
23
23
  3. **Test end-to-end** — Follow the e2e test recipe from the coordinator's prompt (below). If the recipe says to skip e2e for this unit, skip it.
24
24
  4. **Commit and push** — Commit all changes with a clear message, push the branch, and create a PR with \`gh pr create\`. Use a descriptive title. If \`gh\` is not available or the push fails, note it in your final message.
@@ -32,7 +32,7 @@ ${e}
32
32
 
33
33
  ## Phase 1: Research and Plan (Plan Mode)
34
34
 
35
- Call the \`${Ss}\` tool now to enter plan mode, then:
35
+ Call the \`${ms}\` tool now to enter plan mode, then:
36
36
 
37
37
  1. **Understand the scope.** Launch one or more subagents (in the foreground — you need their results) to deeply research what this instruction touches. Find all the files, patterns, and call sites that need to change. Understand the existing conventions so the migration is consistent.
38
38
 
@@ -49,7 +49,7 @@ Call the \`${Ss}\` tool now to enter plan mode, then:
49
49
  - A dev-server + curl pattern (for API changes: start the server, hit the affected endpoints)
50
50
  - An existing e2e/integration test suite the worker can run
51
51
 
52
- If you cannot find a concrete e2e path, use the \`${Cs}\` tool to ask the user how to verify this change end-to-end. Offer 2–3 specific options based on what you found (e.g., "Screenshot via chrome extension", "Run \`bun run dev\` and curl the endpoint", "No e2e — unit tests are sufficient"). Do not skip this — the workers cannot ask the user themselves.
52
+ If you cannot find a concrete e2e path, use the \`${ps}\` tool to ask the user how to verify this change end-to-end. Offer 2–3 specific options based on what you found (e.g., "Screenshot via chrome extension", "Run \`bun run dev\` and curl the endpoint", "No e2e — unit tests are sufficient"). Do not skip this — the workers cannot ask the user themselves.
53
53
 
54
54
  Write the recipe as a short, concrete set of steps that a worker can execute autonomously. Include any setup (start a dev server, build first) and the exact command/interaction to verify.
55
55
 
@@ -59,11 +59,11 @@ Call the \`${Ss}\` tool now to enter plan mode, then:
59
59
  - The e2e test recipe (or "skip e2e because …" if the user chose that)
60
60
  - The exact worker instructions you will give each agent (the shared template)
61
61
 
62
- 5. Call \`${gs}\` to present the plan for approval.
62
+ 5. Call \`${bs}\` to present the plan for approval.
63
63
 
64
64
  ## Phase 2: Spawn Workers (After Plan Approval)
65
65
 
66
- Once the plan is approved, spawn one background agent per work unit using the \`${fa}\` tool. **All agents must use \`isolation: "worktree"\` and \`run_in_background: true\`.** Launch them all in a single message block so they run in parallel.
66
+ Once the plan is approved, spawn one background agent per work unit using the \`${da}\` tool. **All agents must use \`isolation: "worktree"\` and \`run_in_background: true\`.** Launch them all in a single message block so they run in parallel.
67
67
 
68
68
  For each agent, the prompt must be fully self-contained. Include:
69
69
  - The overall goal (the user's instruction)
@@ -95,9 +95,9 @@ When all agents have reported, render the final table and a one-line summary (e.
95
95
  Examples:
96
96
  /batch migrate from react to vue
97
97
  /batch replace all uses of lodash with native equivalents
98
- /batch add type annotations to all untyped function parameters`;function Jl(){Wn({name:`batch`,description:`Research and plan a large-scale change, then execute it in parallel across 5–30 isolated worktree agents that each open a PR.`,whenToUse:`Use when the user wants to make a sweeping, mechanical change across many files (migrations, refactors, bulk renames) that can be decomposed into independent parallel units.`,argumentHint:`<instruction>`,userInvocable:!0,disableModelInvocation:!0,async getPromptForCommand(e){let t=e.trim();return t?await Ya()?[{type:`text`,text:Gl(t)}]:[{type:`text`,text:Kl}]:[{type:`text`,text:ql}]}})}Cn(),I(),ea(),ua(),cr();var Yl=20,Xl=64*1024;function Zl(){Wn({name:`debug`,description:`Enable debug logging for this session and help diagnose issues`,allowedTools:[`Read`,`Grep`,`Glob`],argumentHint:`[issue description]`,disableModelInvocation:!0,userInvocable:!0,async getPromptForCommand(e){let t=ra(),n=oa(),r;try{let e=await Bc(n),t=Math.min(e.size,Xl),i=e.size-t,a=await zc(n,`r`);try{let{buffer:n,bytesRead:o}=await a.read({buffer:Buffer.alloc(t),position:i}),s=n.toString(`utf-8`,0,o).split(`
98
+ /batch add type annotations to all untyped function parameters`;function Jl(){C({name:`batch`,description:`Research and plan a large-scale change, then execute it in parallel across 5–30 isolated worktree agents that each open a PR.`,whenToUse:`Use when the user wants to make a sweeping, mechanical change across many files (migrations, refactors, bulk renames) that can be decomposed into independent parallel units.`,argumentHint:`<instruction>`,userInvocable:!0,disableModelInvocation:!0,async getPromptForCommand(e){let t=e.trim();return t?await Ja()?[{type:`text`,text:Gl(t)}]:[{type:`text`,text:Kl}]:[{type:`text`,text:ql}]}})}ar(),L(),$i(),la(),Qn();var Yl=20,Xl=64*1024;function Zl(){C({name:`debug`,description:`Enable debug logging for this session and help diagnose issues`,allowedTools:[`Read`,`Grep`,`Glob`],argumentHint:`[issue description]`,disableModelInvocation:!0,userInvocable:!0,async getPromptForCommand(e){let t=na(),n=aa(),r;try{let e=await Bc(n),t=Math.min(e.size,Xl),i=e.size-t,a=await zc(n,`r`);try{let{buffer:n,bytesRead:o}=await a.read({buffer:Buffer.alloc(t),position:i}),s=n.toString(`utf-8`,0,o).split(`
99
99
  `).slice(-20).join(`
100
- `);r=`Log size: ${mo(e.size)}\n\n### Last ${Yl} lines\n\n\`\`\`\n${s}\n\`\`\``}finally{await a.close()}}catch(e){r=Zi(e)?`No debug log exists yet — logging was just enabled.`:`Failed to read last ${Yl} lines of debug log: ${P(e)}`}return[{type:`text`,text:`# Debug Skill
100
+ `);r=`Log size: ${po(e.size)}\n\n### Last ${Yl} lines\n\n\`\`\`\n${s}\n\`\`\``}finally{await a.close()}}catch(e){r=Xi(e)?`No debug log exists yet — logging was just enabled.`:`Failed to read last ${Yl} lines of debug log: ${F(e)}`}return[{type:`text`,text:`# Debug Skill
101
101
 
102
102
  Help the user debug an issue they're encountering in this current Work Mate session.
103
103
  ${t?``:`
@@ -122,30 +122,30 @@ ${e||`The user did not describe a specific issue. Read the debug log and summari
122
122
  ## Settings
123
123
 
124
124
  Remember that settings are in:
125
- * user - ${Ea(`userSettings`)}
126
- * project - ${Ea(`projectSettings`)}
127
- * local - ${Ea(`localSettings`)}
125
+ * user - ${Ta(`userSettings`)}
126
+ * project - ${Ta(`projectSettings`)}
127
+ * local - ${Ta(`localSettings`)}
128
128
 
129
129
  ## Instructions
130
130
 
131
131
  1. Review the user's issue description
132
132
  2. The last ${Yl} lines show the debug file format. Look for [ERROR] and [WARN] entries, stack traces, and failure patterns across the file
133
- 3. Consider launching the ${Bn} subagent to understand the relevant Work Mate features
133
+ 3. Consider launching the ${Hn} subagent to understand the relevant Work Mate features
134
134
  4. Explain what you found in plain language
135
135
  5. Suggest concrete fixes or next steps
136
- `}]}})}y(),ui();var Ql=[`Global`,`Chat`,`Autocomplete`,`Confirmation`,`Help`,`Transcript`,`HistorySearch`,`Task`,`ThemePicker`,`Settings`,`Tabs`,`Attachments`,`Footer`,`MessageSelector`,`DiffDialog`,`ModelPicker`,`Select`,`Plugin`],$l={Global:`Active everywhere, regardless of focus`,Chat:`When the chat input is focused`,Autocomplete:`When autocomplete menu is visible`,Confirmation:`When a confirmation/permission dialog is shown`,Help:`When the help overlay is open`,Transcript:`When viewing the transcript`,HistorySearch:`When searching command history (ctrl+r)`,Task:`When a task/agent is running in the foreground`,ThemePicker:`When the theme picker is open`,Settings:`When the settings menu is open`,Tabs:`When tab navigation is active`,Attachments:`When navigating image attachments in a select dialog`,Footer:`When footer indicators are focused`,MessageSelector:`When the message selector (rewind) is open`,DiffDialog:`When the diff dialog is open`,ModelPicker:`When the model picker is open`,Select:`When a select/list component is focused`,Plugin:`When the plugin dialog is open`},eu=`app:interrupt.app:exit.app:toggleTodos.app:toggleTranscript.app:toggleBrief.app:toggleTeammatePreview.app:toggleTerminal.app:redraw.app:globalSearch.app:quickOpen.history:search.history:previous.history:next.chat:cancel.chat:killAgents.chat:cycleMode.chat:modelPicker.chat:fastMode.chat:thinkingToggle.chat:submit.chat:newline.chat:undo.chat:externalEditor.chat:stash.chat:imagePaste.chat:messageActions.autocomplete:accept.autocomplete:dismiss.autocomplete:previous.autocomplete:next.confirm:yes.confirm:no.confirm:previous.confirm:next.confirm:nextField.confirm:previousField.confirm:cycleMode.confirm:toggle.confirm:toggleExplanation.tabs:next.tabs:previous.transcript:toggleShowAll.transcript:exit.historySearch:next.historySearch:accept.historySearch:cancel.historySearch:execute.task:background.theme:toggleSyntaxHighlighting.help:dismiss.attachments:next.attachments:previous.attachments:remove.attachments:exit.footer:up.footer:down.footer:next.footer:previous.footer:openSelected.footer:clearSelection.footer:close.messageSelector:up.messageSelector:down.messageSelector:top.messageSelector:bottom.messageSelector:select.diff:dismiss.diff:previousSource.diff:nextSource.diff:back.diff:viewDetails.diff:previousFile.diff:nextFile.modelPicker:toggle1M.select:next.select:previous.select:accept.select:cancel.plugin:toggle.plugin:install.permission:toggleDebug.settings:search.settings:retry.settings:close.select:previousValue.select:nextValue`.split(`.`),tu=ci(()=>si({context:ii(Ql).describe(`UI context where these bindings apply. Global bindings work everywhere.`),bindings:ni(N().describe(`Keystroke pattern (e.g., "ctrl+k", "shift+tab")`),ri([ii(eu),N().regex(/^command:[a-zA-Z0-9:\-_]+$/).describe(`Command binding (e.g., "command:help", "command:compact"). Executes the slash command as if typed.`),oi().describe(`Set to null to unbind a default shortcut`)]).describe(`Action to trigger, command to invoke, or null to unbind`)).describe(`Map of keystroke patterns to actions`)}).describe(`A block of keybindings for a specific context`));ci(()=>si({$schema:N().optional().describe(`JSON Schema URL for editor validation`),$docs:N().optional().describe(`Documentation URL`),bindings:ai(tu()).describe(`Array of keybinding blocks by context`)}).describe(`Work Mate keybindings configuration. Customize keyboard shortcuts by context.`)),cr();function nu(){return yu([`Context`,`Description`],Ql.map(e=>[`\`${e}\``,$l[e]]))}function ru(){let e={};for(let t of je)for(let[n,r]of Object.entries(t.bindings))r&&(e[r]||(e[r]={keys:[],context:t.context}),e[r].keys.push(n));return yu([`Action`,`Default Key(s)`,`Context`],eu.map(t=>{let n=e[t],r=n?n.keys.map(e=>`\`${e}\``).join(`, `):`(none)`,i=n?n.context:iu(t);return[`\`${t}\``,r,i]}))}function iu(e){return{app:`Global`,history:`Global or Chat`,chat:`Chat`,autocomplete:`Autocomplete`,confirm:`Confirmation`,tabs:`Tabs`,transcript:`Transcript`,historySearch:`HistorySearch`,task:`Task`,theme:`ThemePicker`,help:`Help`,attachments:`Attachments`,footer:`Footer`,messageSelector:`MessageSelector`,diff:`DiffDialog`,modelPicker:`ModelPicker`,select:`Select`,permission:`Confirmation`}[e.split(`:`)[0]??``]??`Unknown`}function au(){let e=[];e.push(`### Non-rebindable (errors)`);for(let t of ft)e.push(`- \`${t.key}\` — ${t.reason}`);e.push(``),e.push(`### Terminal reserved (errors/warnings)`);for(let t of Br)e.push(`- \`${t.key}\` — ${t.reason} (${t.severity===`error`?`will not work`:`may conflict`})`);e.push(``),e.push(`### macOS reserved (errors)`);for(let t of Ue)e.push(`- \`${t.key}\` — ${t.reason}`);return e.join(`
136
+ `}]}})}Dr(),li();var Ql=[`Global`,`Chat`,`Autocomplete`,`Confirmation`,`Help`,`Transcript`,`HistorySearch`,`Task`,`ThemePicker`,`Settings`,`Tabs`,`Attachments`,`Footer`,`MessageSelector`,`DiffDialog`,`ModelPicker`,`Select`,`Plugin`],$l={Global:`Active everywhere, regardless of focus`,Chat:`When the chat input is focused`,Autocomplete:`When autocomplete menu is visible`,Confirmation:`When a confirmation/permission dialog is shown`,Help:`When the help overlay is open`,Transcript:`When viewing the transcript`,HistorySearch:`When searching command history (ctrl+r)`,Task:`When a task/agent is running in the foreground`,ThemePicker:`When the theme picker is open`,Settings:`When the settings menu is open`,Tabs:`When tab navigation is active`,Attachments:`When navigating image attachments in a select dialog`,Footer:`When footer indicators are focused`,MessageSelector:`When the message selector (rewind) is open`,DiffDialog:`When the diff dialog is open`,ModelPicker:`When the model picker is open`,Select:`When a select/list component is focused`,Plugin:`When the plugin dialog is open`},eu=`app:interrupt.app:exit.app:toggleTodos.app:toggleTranscript.app:toggleTeammatePreview.app:toggleTerminal.app:redraw.app:globalSearch.app:quickOpen.history:search.history:previous.history:next.chat:cancel.chat:killAgents.chat:cycleMode.chat:modelPicker.chat:fastMode.chat:thinkingToggle.chat:submit.chat:newline.chat:undo.chat:externalEditor.chat:stash.chat:imagePaste.chat:messageActions.autocomplete:accept.autocomplete:dismiss.autocomplete:previous.autocomplete:next.confirm:yes.confirm:no.confirm:previous.confirm:next.confirm:nextField.confirm:previousField.confirm:cycleMode.confirm:toggle.confirm:toggleExplanation.tabs:next.tabs:previous.transcript:toggleShowAll.transcript:exit.historySearch:next.historySearch:accept.historySearch:cancel.historySearch:execute.task:background.theme:toggleSyntaxHighlighting.help:dismiss.attachments:next.attachments:previous.attachments:remove.attachments:exit.footer:up.footer:down.footer:next.footer:previous.footer:openSelected.footer:clearSelection.footer:close.messageSelector:up.messageSelector:down.messageSelector:top.messageSelector:bottom.messageSelector:select.diff:dismiss.diff:previousSource.diff:nextSource.diff:back.diff:viewDetails.diff:previousFile.diff:nextFile.modelPicker:toggle1M.select:next.select:previous.select:accept.select:cancel.plugin:toggle.plugin:install.permission:toggleDebug.settings:search.settings:retry.settings:close.select:previousValue.select:nextValue`.split(`.`),tu=si(()=>oi({context:ri(Ql).describe(`UI context where these bindings apply. Global bindings work everywhere.`),bindings:ti(P().describe(`Keystroke pattern (e.g., "ctrl+k", "shift+tab")`),ni([ri(eu),P().regex(/^command:[a-zA-Z0-9:\-_]+$/).describe(`Command binding (e.g., "command:help", "command:compact"). Executes the slash command as if typed.`),ai().describe(`Set to null to unbind a default shortcut`)]).describe(`Action to trigger, command to invoke, or null to unbind`)).describe(`Map of keystroke patterns to actions`)}).describe(`A block of keybindings for a specific context`));si(()=>oi({$schema:P().optional().describe(`JSON Schema URL for editor validation`),$docs:P().optional().describe(`Documentation URL`),bindings:ii(tu()).describe(`Array of keybinding blocks by context`)}).describe(`Work Mate keybindings configuration. Customize keyboard shortcuts by context.`)),Qn();function nu(){return yu([`Context`,`Description`],Ql.map(e=>[`\`${e}\``,$l[e]]))}function ru(){let e={};for(let t of ue)for(let[n,r]of Object.entries(t.bindings))r&&(e[r]||(e[r]={keys:[],context:t.context}),e[r].keys.push(n));return yu([`Action`,`Default Key(s)`,`Context`],eu.map(t=>{let n=e[t],r=n?n.keys.map(e=>`\`${e}\``).join(`, `):`(none)`,i=n?n.context:iu(t);return[`\`${t}\``,r,i]}))}function iu(e){return{app:`Global`,history:`Global or Chat`,chat:`Chat`,autocomplete:`Autocomplete`,confirm:`Confirmation`,tabs:`Tabs`,transcript:`Transcript`,historySearch:`HistorySearch`,task:`Task`,theme:`ThemePicker`,help:`Help`,attachments:`Attachments`,footer:`Footer`,messageSelector:`MessageSelector`,diff:`DiffDialog`,modelPicker:`ModelPicker`,select:`Select`,permission:`Confirmation`}[e.split(`:`)[0]??``]??`Unknown`}function au(){let e=[];e.push(`### Non-rebindable (errors)`);for(let t of Nr)e.push(`- \`${t.key}\` — ${t.reason}`);e.push(``),e.push(`### Terminal reserved (errors/warnings)`);for(let t of Gt)e.push(`- \`${t.key}\` — ${t.reason} (${t.severity===`error`?`will not work`:`may conflict`})`);e.push(``),e.push(`### macOS reserved (errors)`);for(let t of br)e.push(`- \`${t.key}\` — ${t.reason}`);return e.join(`
137
137
  `)}var ou={$schema:`https://www.schemastore.org/claude-code-keybindings.json`,$docs:`https://code.claude.com/docs/en/keybindings`,bindings:[{context:`Chat`,bindings:{"ctrl+e":`chat:externalEditor`}}]},su={context:`Chat`,bindings:{"ctrl+s":null}},cu={context:`Chat`,bindings:{"ctrl+g":null,"ctrl+e":`chat:externalEditor`}},lu={context:`Global`,bindings:{"ctrl+k ctrl+t":`app:toggleTodos`}},uu=[`# Keybindings Skill`,``,"Create or modify `~/.claude/keybindings.json` to customize keyboard shortcuts.",``,`## CRITICAL: Read Before Write`,``,"**Always read `~/.claude/keybindings.json` first** (it may not exist yet). Merge changes with existing bindings — never replace the entire file.",``,`- Use **Edit** tool for modifications to existing files`,`- Use **Write** tool only if the file does not exist yet`].join(`
138
- `),du=[`## File Format`,``,"```json",la(ou,null,2),"```",``,"Always include the `$schema` and `$docs` fields."].join(`
138
+ `),du=[`## File Format`,``,"```json",ca(ou,null,2),"```",``,"Always include the `$schema` and `$docs` fields."].join(`
139
139
  `),fu=[`## Keystroke Syntax`,``,"**Modifiers** (combine with `+`):","- `ctrl` (alias: `control`)","- `alt` (aliases: `opt`, `option`) — note: `alt` and `meta` are identical in terminals","- `shift`","- `meta` (aliases: `cmd`, `command`)",``,"**Special keys**: `escape`/`esc`, `enter`/`return`, `tab`, `space`, `backspace`, `delete`, `up`, `down`, `left`, `right`",``,"**Chords**: Space-separated keystrokes, e.g. `ctrl+k ctrl+s` (1-second timeout between keystrokes)",``,"**Examples**: `ctrl+shift+p`, `alt+enter`, `ctrl+k ctrl+n`"].join(`
140
- `),pu=[`## Unbinding Default Shortcuts`,``,"Set a key to `null` to remove its default binding:",``,"```json",la(su,null,2),"```"].join(`
140
+ `),pu=[`## Unbinding Default Shortcuts`,``,"Set a key to `null` to remove its default binding:",``,"```json",ca(su,null,2),"```"].join(`
141
141
  `),mu=[`## How User Bindings Interact with Defaults`,``,`- User bindings are **additive** — they are appended after the default bindings`,"- To **move** a binding to a different key: unbind the old key (`null`) AND add the new binding",`- A context only needs to appear in the user's file if they want to change something in that context`].join(`
142
- `),hu=[`## Common Patterns`,``,`### Rebind a key`,"To change the external editor shortcut from `ctrl+g` to `ctrl+e`:","```json",la(cu,null,2),"```",``,`### Add a chord binding`,"```json",la(lu,null,2),"```"].join(`
142
+ `),hu=[`## Common Patterns`,``,`### Rebind a key`,"To change the external editor shortcut from `ctrl+g` to `ctrl+e`:","```json",ca(cu,null,2),"```",``,`### Add a chord binding`,"```json",ca(lu,null,2),"```"].join(`
143
143
  `),gu=[`## Behavioral Rules`,``,`1. Only include contexts the user wants to change (minimal overrides)`,`2. Validate that actions and contexts are from the known lists below`,"3. Warn the user proactively if they choose a key that conflicts with reserved shortcuts or common tools like tmux (`ctrl+b`) and screen (`ctrl+a`)",`4. When adding a new binding for an existing action, the new binding is additive (existing default still works unless explicitly unbound)`,`5. To fully replace a default binding, unbind the old key AND add the new one`].join(`
144
144
  `),_u=[`## Validation with /doctor`,``,'The `/doctor` command includes a "Keybinding Configuration Issues" section that validates `~/.claude/keybindings.json`.',``,`### Common Issues and Fixes`,``,yu([`Issue`,`Cause`,`Fix`],[['`keybindings.json must have a "bindings" array`',`Missing wrapper object`,'Wrap bindings in `{ "bindings": [...] }`'],['`"bindings" must be an array`',"`bindings` is not an array",'Set `"bindings"` to an array: `[{ context: ..., bindings: ... }]`'],['`Unknown context "X"`',`Typo or invalid context name`,`Use exact context names from the Available Contexts table`],['`Duplicate key "X" in Y bindings`',`Same key defined twice in one context`,`Remove the duplicate; JSON uses only the last value`],['`"X" may not work: ...`',`Key conflicts with terminal/OS reserved shortcut`,`Choose a different key (see Reserved Shortcuts section)`],['`Could not parse keystroke "X"`',`Invalid key syntax`,"Check syntax: use `+` between modifiers, valid key names"],['`Invalid action for "X"`',`Action value is not a string or null`,'Actions must be strings like `"app:help"` or `null` to unbind']]),``,`### Example /doctor Output`,``,"```",`Keybinding Configuration Issues`,`Location: ~/.claude/keybindings.json`,` └ [Error] Unknown context "chat"`,` → Valid contexts: Global, Chat, Autocomplete, ...`,` └ [Warning] "ctrl+c" may not work: Terminal interrupt (SIGINT)`,"```",``,`**Errors** prevent bindings from working and must be fixed. **Warnings** indicate potential conflicts but the binding may still work.`].join(`
145
- `);function vu(){Wn({name:`keybindings-help`,description:`Use when the user wants to customize keyboard shortcuts, rebind keys, add chord bindings, or modify ~/.claude/keybindings.json. Examples: "rebind ctrl+s", "add a chord shortcut", "change the submit key", "customize keybindings".`,allowedTools:[`Read`],userInvocable:!1,isEnabled:Te,async getPromptForCommand(e){let t=nu(),n=ru(),r=[uu,du,fu,pu,mu,hu,gu,_u,`## Reserved Shortcuts\n\n${au()}`,`## Available Contexts\n\n${t}`,`## Available Actions\n\n${n}`];return e&&r.push(`## User Request\n\n${e}`),[{type:`text`,text:r.join(`
145
+ `);function vu(){C({name:`keybindings-help`,description:`Use when the user wants to customize keyboard shortcuts, rebind keys, add chord bindings, or modify ~/.claude/keybindings.json. Examples: "rebind ctrl+s", "add a chord shortcut", "change the submit key", "customize keybindings".`,allowedTools:[`Read`],userInvocable:!1,isEnabled:ln,async getPromptForCommand(e){let t=nu(),n=ru(),r=[uu,du,fu,pu,mu,hu,gu,_u,`## Reserved Shortcuts\n\n${au()}`,`## Available Contexts\n\n${t}`,`## Available Actions\n\n${n}`];return e&&r.push(`## User Request\n\n${e}`),[{type:`text`,text:r.join(`
146
146
 
147
147
  `)}]}})}function yu(e,t){let n=e.map(()=>`---`);return[`| ${e.join(` | `)} |`,`| ${n.join(` | `)} |`,...t.map(e=>`| ${e.join(` | `)} |`)].join(`
148
- `)}ha(),cr();var bu=`# Simplify: Code Review and Cleanup
148
+ `)}ma(),Qn();var bu=`# Simplify: Code Review and Cleanup
149
149
 
150
150
  Review all changed files for reuse, quality, and efficiency. Fix any issues found.
151
151
 
@@ -155,7 +155,7 @@ Run \`git diff\` (or \`git diff HEAD\` if there are staged changes) to see what
155
155
 
156
156
  ## Phase 2: Launch Three Review Agents in Parallel
157
157
 
158
- Use the ${fa} tool to launch all three agents concurrently in a single message. Pass each agent the full diff so it has the complete context.
158
+ Use the ${da} tool to launch all three agents concurrently in a single message. Pass each agent the full diff so it has the complete context.
159
159
 
160
160
  ### Agent 1: Code Reuse Review
161
161
 
@@ -194,9 +194,9 @@ Review the same changes for efficiency:
194
194
  Wait for all three agents to complete. Aggregate their findings and fix each issue directly. If a finding is a false positive or not worth addressing, note it and move on — do not argue with the finding, just skip it.
195
195
 
196
196
  When done, briefly summarize what was fixed (or confirm the code was already clean).
197
- `;function xu(){Wn({name:`simplify`,description:`Review changed code for reuse, quality, and efficiency, then fix any issues found.`,userInvocable:!0,async getPromptForCommand(e){let t=bu;return e&&(t+=`\n\n## Additional Focus\n\n${e}`),[{type:`text`,text:t}]}})}cr();var Su=`# /ultracode — Workflow Orchestration Playbook
197
+ `;function xu(){C({name:`simplify`,description:`Review changed code for reuse, quality, and efficiency, then fix any issues found.`,userInvocable:!0,async getPromptForCommand(e){let t=bu;return e&&(t+=`\n\n## Additional Focus\n\n${e}`),[{type:`text`,text:t}]}})}Qn();var Su=`# /ultracode — Workflow Orchestration Playbook
198
198
 
199
- Execute a workflow script that orchestrates multiple subagents deterministically. Workflows run in the background — this tool returns immediately with a task ID, and a \`<task-notification>\` arrives when the workflow completes. Use \`/workflows\` to watch live progress.
199
+ Execute a workflow script that orchestrates multiple subagents deterministically. Workflows run in the background — this tool returns immediately with a task ID, and a \`<task-notification>\` arrives when the workflow completes.
200
200
 
201
201
  A workflow structures work across many agents — to be comprehensive (decompose and cover in parallel), to be confident (independent perspectives and adversarial checks before committing), or to take on scale one context can't hold (migrations, audits, broad sweeps). The script is where you encode that structure: what fans out, what verifies, what synthesizes.
202
202
 
@@ -256,7 +256,7 @@ Script body hooks:
256
256
  - \`phase(title: string): void\` — start a new phase; subsequent agent() calls are grouped under this title in the progress display
257
257
  - \`args: any\` — the value passed as Workflow's \`args\` input, verbatim (undefined if not provided). Pass arrays/objects as actual JSON values in the tool call, NOT as a JSON-encoded string — \`args: ["a.ts", "b.ts"]\`, not \`args: "[\\"a.ts\\", ...]"\` (a stringified list reaches the script as one string, so \`args.filter\`/\`args.map\` throw). Use this to parameterize named workflows — e.g. pass a research question, target path, or config object directly instead of via a side-channel file.
258
258
  - \`budget: {total: number|null, spent(): number, remaining(): number}\` — the turn's token target from the user's "+500k"-style directive. \`budget.total\` is null if no target was set. \`budget.spent()\` returns output tokens spent this turn across the main loop and all workflows — the pool is shared, not per-workflow. \`budget.remaining()\` returns \`max(0, total - spent())\`, or \`Infinity\` if no target. The target is a HARD ceiling, not advisory: once \`spent()\` reaches \`total\`, further \`agent()\` calls throw. Use for dynamic loops: \`while (budget.total && budget.remaining() > 50_000) { ... }\`, or static scaling: \`const FLEET = budget.total ? Math.floor(budget.total / 100_000) : 5\`.
259
- - \`workflow(nameOrRef: string | {scriptPath: string}, args?: any): Promise<any>\` — run another workflow inline as a sub-step and return whatever it returns. Pass a name to invoke a saved workflow (same registry as {name: "..."}), or {scriptPath} to run a script file you Wrote earlier. The child shares this run's concurrency cap, agent counter, abort signal, and token budget — its agents appear under a "▸ name" group in /workflows and its tokens count toward budget.spent(). The args param becomes the child's \`args\` global. Nesting is one level only: workflow() inside a child throws. Throws on unknown name / unreadable scriptPath / child syntax error; catch to handle gracefully.
259
+ - \`workflow(nameOrRef: string | {scriptPath: string}, args?: any): Promise<any>\` — run another workflow inline as a sub-step and return whatever it returns. Pass a name to invoke a saved workflow (same registry as {name: "..."}), or {scriptPath} to run a script file you Wrote earlier. The child shares this run's concurrency cap, agent counter, abort signal, and token budget — its agents appear under a "▸ name" group in the progress tree and its tokens count toward budget.spent(). The args param becomes the child's \`args\` global. Nesting is one level only: workflow() inside a child throws. Throws on unknown name / unreadable scriptPath / child syntax error; catch to handle gracefully.
260
260
 
261
261
  Concurrent agent() calls are capped at 3 by default per workflow — excess calls queue and run as slots free up. The Workflow tool accepts an optional \`maxConcurrency\` input (1–16) to override per-run. OMIT it to use 3. To set maxConcurrency to ANY value other than 3, you MUST first ask the user via AskUserQuestion (offer 3 / 6 / 9 with 3 marked "(Recommended)") — the ONLY exception is when the user has already specified a number this session ("use 6", "maxConcurrency 9"). Never silently raise concurrency above 3 just because the workflow fans out; 3 is the recommended default. You can still pass 100 items to parallel()/pipeline() and they all complete; only the configured number run at any moment. Total agent count across a workflow's lifetime is capped at 1000 — a runaway-loop backstop set far above any real workflow. A single parallel()/pipeline() call accepts at most 4096 items; passing more is an explicit error, not a silent truncation.
262
262
 
@@ -398,28 +398,28 @@ Use this tool for multi-step orchestration where control flow should be determin
398
398
  ## Resume
399
399
 
400
400
  The tool result includes a runId. To resume after a pause, kill, or script edit, relaunch with \`Workflow({scriptPath, resumeFromRunId})\` — the longest unchanged prefix of agent() calls returns cached results instantly; the first edited/new call and everything after it runs live. Same script + same args → 100% cache hit. Date.now()/Math.random()/new Date() are unavailable in scripts (they would break this) — stamp results after the workflow returns, or pass timestamps via args. Fallback when no journal is available: Read agent-<id>.jsonl files in the transcript directory and hand-author a continuation script.
401
- `;function Cu(){Wn({name:`ultracode`,description:`Enter multi-agent workflow orchestration mode: when to use the Workflow tool, script primitives, quality patterns, determinism constraints, resume/budget, and files/commands.`,whenToUse:`When a task can be decomposed or parallelized, needs multi-perspective confidence (e.g. find then adversarially verify), exceeds a single context (large migrations, broad audits, long-tail enumeration), or needs resume/auditability — orchestrate multiple subagents with the Workflow tool.`,userInvocable:!0,async getPromptForCommand(e){let t=Su;return e&&(t+=`\n## User input\n\n${e}\n`),[{type:`text`,text:t}]}})}cr();function wu(){Wn({name:`loop`,description:`Run a prompt or slash command on a recurring interval (e.g. /loop 5m /foo, defaults to 10m)`,whenToUse:`When the user wants to set up a recurring task, poll for status, or run something repeatedly on an interval (e.g. "check the deploy every 5 minutes", "keep running /babysit-prs"). Do NOT invoke for one-off tasks.`,argumentHint:`[interval] <prompt>`,userInvocable:!1,isEnabled:()=>!1,async getPromptForCommand(){return[{type:`text`,text:`The /loop command is no longer available.`}]}})}De(),ie(),vi(),cr();var Tu=`# Dream: Memory Consolidation (manual run)
401
+ `;function Cu(){C({name:`ultracode`,description:`Enter multi-agent workflow orchestration mode: when to use the Workflow tool, script primitives, quality patterns, determinism constraints, resume/budget, and files/commands.`,whenToUse:`When a task can be decomposed or parallelized, needs multi-perspective confidence (e.g. find then adversarially verify), exceeds a single context (large migrations, broad audits, long-tail enumeration), or needs resume/auditability — orchestrate multiple subagents with the Workflow tool.`,userInvocable:!0,async getPromptForCommand(e){let t=Su;return e&&(t+=`\n## User input\n\n${e}\n`),[{type:`text`,text:t}]}})}Qn();function wu(){C({name:`loop`,description:`Run a prompt or slash command on a recurring interval (e.g. /loop 5m /foo, defaults to 10m)`,whenToUse:`When the user wants to set up a recurring task, poll for status, or run something repeatedly on an interval (e.g. "check the deploy every 5 minutes", "keep running /babysit-prs"). Do NOT invoke for one-off tasks.`,argumentHint:`[interval] <prompt>`,userInvocable:!1,isEnabled:()=>!1,async getPromptForCommand(){return[{type:`text`,text:`The /loop command is no longer available.`}]}})}Ie(),kr(),Si(),Qn();var Tu=`# Dream: Memory Consolidation (manual run)
402
402
 
403
403
  You are performing a manual dream — a reflective pass over your memory files. Unlike the automatic background dream, this run has full tool permissions and the user is watching. Synthesize what you've learned recently into durable, well-organized memories so that future sessions can orient quickly.
404
404
 
405
- `;function Eu(){Wn({name:`dream`,description:`Manually trigger memory consolidation — review, organize, and prune your auto-memory files.`,whenToUse:`Use when the user says /dream or wants to manually consolidate memories, organize memory files, or clean up stale entries.`,userInvocable:!0,isEnabled:()=>ja(),async getPromptForCommand(e){let t=Fa(),n=hr(zi());await Ge();let r=Tu+Pt(t,n,``);return e&&(r+=`\n\n## Additional context from user\n\n${e}`),[{type:`text`,text:r}]}})}var Du=i({registerScheduleRemoteAgentsSkill:()=>Fu});function Ou(e){if(!e.startsWith(`mcpsrv_`))return null;let t=e.slice(7).slice(2),n=0n;for(let e of t){let t=Iu.indexOf(e);if(t===-1)return null;n=n*58n+BigInt(t)}let r=n.toString(16).padStart(32,`0`);return`${r.slice(0,8)}-${r.slice(8,12)}-${r.slice(12,16)}-${r.slice(16,20)}-${r.slice(20,32)}`}function ku(e){let t=[];for(let n of e){if(n.type!==`connected`||n.config.type!==`claudeai-proxy`)continue;let e=Ou(n.config.id);e&&t.push({uuid:e,name:n.name,url:n.config.url})}return t}function Au(e){return e.replace(/^claude[.\s-]ai[.\s-]/i,``).replace(/[^a-zA-Z0-9_-]/g,`-`).replace(/-+/g,`-`).replace(/^-|-$/g,``)}function ju(e){if(e.length===0)return`No connected MCP connectors found. The user may need to connect servers at https://claude.ai/settings/connectors`;let t=[`Connected connectors (available for triggers):`];for(let n of e){let e=Au(n.name);t.push(`- ${n.name} (connector_uuid: ${n.uuid}, name: ${e}, url: ${n.url})`)}return t.join(`
405
+ `;function Eu(){C({name:`dream`,description:`Manually trigger memory consolidation — review, organize, and prune your auto-memory files.`,whenToUse:`Use when the user says /dream or wants to manually consolidate memories, organize memory files, or clean up stale entries.`,userInvocable:!0,isEnabled:()=>Aa(),async getPromptForCommand(e){let t=Pa(),n=nn(Ai());await fe();let r=Tu+De(t,n,``);return e&&(r+=`\n\n## Additional context from user\n\n${e}`),[{type:`text`,text:r}]}})}var Du=i({registerScheduleRemoteAgentsSkill:()=>Fu});function Ou(e){if(!e.startsWith(`mcpsrv_`))return null;let t=e.slice(7).slice(2),n=0n;for(let e of t){let t=Iu.indexOf(e);if(t===-1)return null;n=n*58n+BigInt(t)}let r=n.toString(16).padStart(32,`0`);return`${r.slice(0,8)}-${r.slice(8,12)}-${r.slice(12,16)}-${r.slice(16,20)}-${r.slice(20,32)}`}function ku(e){let t=[];for(let n of e){if(n.type!==`connected`||n.config.type!==`claudeai-proxy`)continue;let e=Ou(n.config.id);e&&t.push({uuid:e,name:n.name,url:n.config.url})}return t}function Au(e){return e.replace(/^claude[.\s-]ai[.\s-]/i,``).replace(/[^a-zA-Z0-9_-]/g,`-`).replace(/-+/g,`-`).replace(/^-|-$/g,``)}function ju(e){if(e.length===0)return`No connected MCP connectors found. The user may need to connect servers at https://claude.ai/settings/connectors`;let t=[`Connected connectors (available for triggers):`];for(let n of e){let e=Au(n.name);t.push(`- ${n.name} (connector_uuid: ${n.uuid}, name: ${e}, url: ${n.url})`)}return t.join(`
406
406
  `)}function Mu(e){return`⚠ Heads-up:\n${e.map(e=>`- ${e}`).join(`
407
- `)}`}async function Nu(){let e=await Za();if(!e)return null;let t=Ks(e);return t?`https://${t.host}/${t.owner}/${t.name}`:null}function Pu(e){let{userTimezone:t,connectorsInfo:n,gitRepoUrl:r,environmentsInfo:i,createdEnvironment:a,setupNotes:o,needsGitHubAccessReminder:s,userArgs:c}=e,l=c&&o.length>0?`\n## Setup Notes\n\n${Mu(o)}\n`:``,u=o.length>0?`${Mu(o)}\n\n${Lu}`:Lu;return`# Schedule Remote Agents
407
+ `)}`}async function Nu(){let e=await Xa();if(!e)return null;let t=Ks(e);return t?`https://${t.host}/${t.owner}/${t.name}`:null}function Pu(e){let{userTimezone:t,connectorsInfo:n,gitRepoUrl:r,environmentsInfo:i,createdEnvironment:a,setupNotes:o,needsGitHubAccessReminder:s,userArgs:c}=e,l=c&&o.length>0?`\n## Setup Notes\n\n${Mu(o)}\n`:``,u=o.length>0?`${Mu(o)}\n\n${Lu}`:Lu;return`# Schedule Remote Agents
408
408
 
409
409
  You are helping the user schedule, update, list, or run **remote** Work Mate agents. These are NOT local cron jobs — each trigger spawns a fully isolated remote session (CCR) in cloud infrastructure on a cron schedule. The agent runs in a sandboxed environment with its own git checkout, tools, and optional MCP connections.
410
410
 
411
411
  ## First Step
412
412
 
413
- ${c?`The user has already told you what they want (see User Request at the bottom). Skip the initial question and go directly to the matching workflow.`:`Your FIRST action must be a single ${Cs} tool call (no preamble). Use this EXACT string for the \`question\` field — do not paraphrase or shorten it:
413
+ ${c?`The user has already told you what they want (see User Request at the bottom). Skip the initial question and go directly to the matching workflow.`:`Your FIRST action must be a single ${ps} tool call (no preamble). Use this EXACT string for the \`question\` field — do not paraphrase or shorten it:
414
414
 
415
- ${la(u)}
415
+ ${ca(u)}
416
416
 
417
417
  Set \`header: "Action"\` and offer the four actions (create/list/update/run) as options. After the user picks, follow the matching workflow below.`}
418
418
  ${l}
419
419
 
420
420
  ## What You Can Do
421
421
 
422
- Use the \`${br}\` tool (load it first with \`SearchExtraTools select:${br}\`; auth is handled in-process — do not use curl):
422
+ Use the \`${E}\` tool (load it first with \`SearchExtraTools select:${E}\`; auth is handled in-process — do not use curl):
423
423
 
424
424
  - \`{action: "list"}\` — list all triggers
425
425
  - \`{action: "get", trigger_id: "..."}\` — fetch one trigger
@@ -526,7 +526,7 @@ Minimum interval is 1 hour. \`*/30 * * * *\` will be rejected.
526
526
  4. **Choose the model** — Default to \`claude-sonnet-4-6\`. Tell the user which model you're defaulting to and ask if they want a different one.
527
527
  5. **Validate connections** — Infer what services the agent will need from the user's description. For example, if they say "check Datadog and Slack me errors," the agent needs both Datadog and Slack MCP connectors. Cross-reference with the connectors list above. If any are missing, warn the user and link them to https://claude.ai/settings/connectors to connect first.${r?` The default git repo is already set to \`${r}\`. Ask the user if this is the right repo or if they need a different one.`:` Ask which git repos the remote agent needs cloned into its environment.`}
528
528
  6. **Review and confirm** — Show the full configuration before creating. Let them adjust.
529
- 7. **Create it** \u2014 Call \`${br}\` with \`action: "create"\` and show the result. The response includes the trigger ID. Always output a link at the end: \`https://claude.ai/code/scheduled/{TRIGGER_ID}\`
529
+ 7. **Create it** \u2014 Call \`${E}\` with \`action: "create"\` and show the result. The response includes the trigger ID. Always output a link at the end: \`https://claude.ai/code/scheduled/{TRIGGER_ID}\`
530
530
 
531
531
  ### UPDATE a trigger:
532
532
 
@@ -555,8 +555,8 @@ Minimum interval is 1 hour. \`*/30 * * * *\` will be rejected.
555
555
  - The prompt is the most important part — spend time getting it right. The remote agent starts with zero context, so the prompt must be self-contained.
556
556
  - To delete a trigger, direct users to https://claude.ai/code/scheduled
557
557
  ${s?`- If the user's request seems to require GitHub repo access (e.g. cloning a repo, opening PRs, reading code), remind them that they need the Claude GitHub App installed on the repo — otherwise the remote agent won't be able to access it.`:``}
558
- ${c?`\n## User Request\n\nThe user said: "${c}"\n\nStart by understanding their intent and working through the appropriate workflow above.`:``}`}function Fu(){Wn({name:`schedule`,description:`Create, update, list, or run scheduled remote agents (triggers) that execute on a cron schedule.`,whenToUse:`When the user wants to schedule a recurring remote agent, set up automated tasks, create a cron job for Work Mate, or manage their scheduled agents/triggers.`,userInvocable:!0,isEnabled:()=>!1,allowedTools:[br,Cs],async getPromptForCommand(e,t){if(!Mo()?.accessToken)return[{type:`text`,text:`You need to authenticate with a claude.ai account first. API accounts are not supported.`}];let n;try{n=await pr()}catch(e){return F(`[schedule] Failed to fetch environments: ${e}`,{level:`warn`}),[{type:`text`,text:`We're having trouble connecting with your remote claude.ai account to set up a scheduled task. Please try /schedule again in a few minutes.`}]}let r=null;if(n.length===0)try{r=await Gt(`claude-code-default`),n=[r]}catch(e){return F(`[schedule] Failed to create environment: ${e}`,{level:`warn`}),[{type:`text`,text:`No remote environments found, and we could not create one automatically. Visit https://claude.ai/code to set one up, then run /schedule again.`}]}let i=[],a=!1,o=await qs();if(o===null)i.push(`Not in a git repo — you'll need to specify a repo URL manually (or skip repos entirely).`);else if(o.host===`github.com`){let{hasAccess:e}=await xn(o.owner,o.name);if(!e){a=!0;let e=`Claude GitHub App not installed on ${o.owner}/${o.name} \u2014 install at https://claude.ai/code/onboarding?magic=github-app-setup if your trigger needs this repo.`;i.push(e)}}let s=ku(t.options.mcpClients);s.length===0&&i.push(`No MCP connectors — connect at https://claude.ai/settings/connectors if needed.`);let c=Intl.DateTimeFormat().resolvedOptions().timeZone,l=ju(s),u=await Nu(),d=[`Available environments:`];for(let e of n)d.push(`- ${e.name} (id: ${e.environment_id}, kind: ${e.kind})`);return[{type:`text`,text:Pu({userTimezone:c,connectorsInfo:l,gitRepoUrl:u,environmentsInfo:d.join(`
559
- `),createdEnvironment:r,setupNotes:i,needsGitHubAccessReminder:a,userArgs:e})}]}})}var Iu,Lu,Ru=n((()=>{Dr(),ms(),wt(),wo(),k(),ea(),Ws(),Xa(),Xi(),Fr(),cr(),Iu=`123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz`,Lu=`What would you like to do with scheduled remote agents?`}));function zu(){vu(),Zl(),xu(),Jl(),Cu(),wu(),Eu();{let{registerScheduleRemoteAgentsSkill:t}=(Ru(),e(Du));t()}}ar(),v(),Gn();async function Bu(){if(!await ro(`gh`))return`not_installed`;let{exitCode:e}=await $a(`gh`,[`auth`,`token`],{stdout:`ignore`,stderr:`ignore`,timeout:5e3,reject:!1});return e===0?`authenticated`:`not_authenticated`}xr(),Oe(),vt(),U(),lt();async function Vu(e,t){let n=await ke(e),r=Le(t);for(let e of n)e.type===`prompt`&&W(`tengu_skill_loaded`,{_PROTO_skill_name:e.name,skill_source:e.source,skill_loaded_from:e.loadedFrom,skill_budget:r,...e.kind&&{skill_kind:e.kind}})}Dt(),U(),S(),Nr(),f(),Xi();function Hu(e){e.command(`add <name> <commandOrUrl> [args...]`).description(`Add an MCP server to Work Mate.
558
+ ${c?`\n## User Request\n\nThe user said: "${c}"\n\nStart by understanding their intent and working through the appropriate workflow above.`:``}`}function Fu(){C({name:`schedule`,description:`Create, update, list, or run scheduled remote agents (triggers) that execute on a cron schedule.`,whenToUse:`When the user wants to schedule a recurring remote agent, set up automated tasks, create a cron job for Work Mate, or manage their scheduled agents/triggers.`,userInvocable:!0,isEnabled:()=>!1,allowedTools:[E,ps],async getPromptForCommand(e,t){if(!jo()?.accessToken)return[{type:`text`,text:`You need to authenticate with a claude.ai account first. API accounts are not supported.`}];let n;try{n=await jn()}catch(e){return I(`[schedule] Failed to fetch environments: ${e}`,{level:`warn`}),[{type:`text`,text:`We're having trouble connecting with your remote claude.ai account to set up a scheduled task. Please try /schedule again in a few minutes.`}]}let r=null;if(n.length===0)try{r=await Zt(`claude-code-default`),n=[r]}catch(e){return I(`[schedule] Failed to create environment: ${e}`,{level:`warn`}),[{type:`text`,text:`No remote environments found, and we could not create one automatically. Visit https://claude.ai/code to set one up, then run /schedule again.`}]}let i=[],a=!1,o=await qs();if(o===null)i.push(`Not in a git repo — you'll need to specify a repo URL manually (or skip repos entirely).`);else if(o.host===`github.com`){let{hasAccess:e}=await Kn(o.owner,o.name);if(!e){a=!0;let e=`Claude GitHub App not installed on ${o.owner}/${o.name} \u2014 install at https://claude.ai/code/onboarding?magic=github-app-setup if your trigger needs this repo.`;i.push(e)}}let s=ku(t.options.mcpClients);s.length===0&&i.push(`No MCP connectors — connect at https://claude.ai/settings/connectors if needed.`);let c=Intl.DateTimeFormat().resolvedOptions().timeZone,l=ju(s),u=await Nu(),d=[`Available environments:`];for(let e of n)d.push(`- ${e.name} (id: ${e.environment_id}, kind: ${e.kind})`);return[{type:`text`,text:Pu({userTimezone:c,connectorsInfo:l,gitRepoUrl:u,environmentsInfo:d.join(`
559
+ `),createdEnvironment:r,setupNotes:i,needsGitHubAccessReminder:a,userArgs:e})}]}})}var Iu,Lu,Ru=n((()=>{on(),vs(),me(),Co(),cr(),$i(),Ws(),Ya(),Yi(),gr(),Qn(),Iu=`123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz`,Lu=`What would you like to do with scheduled remote agents?`}));function zu(){vu(),Zl(),xu(),Jl(),Cu(),wu(),Eu();{let{registerScheduleRemoteAgentsSkill:t}=(Ru(),e(Du));t()}}Dt(),tt(),Wn();async function Bu(){if(!await no(`gh`))return`not_installed`;let{exitCode:e}=await Qa(`gh`,[`auth`,`token`],{stdout:`ignore`,stderr:`ignore`,timeout:5e3,reject:!1});return e===0?`authenticated`:`not_authenticated`}ke(),it(),_r(),W(),Be();async function Vu(e,t){let n=await Ue(e),r=Pe(t);for(let e of n)e.type===`prompt`&&G(`tengu_skill_loaded`,{_PROTO_skill_name:e.name,skill_source:e.source,skill_loaded_from:e.loadedFrom,skill_budget:r,...e.kind&&{skill_kind:e.kind}})}_e(),W(),Fn(),dr(),f(),Yi();function Hu(e){e.command(`add <name> <commandOrUrl> [args...]`).description(`Add an MCP server to Work Mate.
560
560
 
561
561
  Examples:
562
562
  # Add HTTP server:
@@ -569,37 +569,37 @@ Examples:
569
569
  claude mcp add -e API_KEY=xxx my-server -- npx my-mcp-server
570
570
 
571
571
  # Add stdio server with subprocess flags:
572
- claude mcp add my-server -- my-command --some-flag arg1`).option(`-s, --scope <scope>`,`Configuration scope (local, user, or project)`,`local`).option(`-t, --transport <transport>`,`Transport type (stdio, sse, http). Defaults to stdio if not specified.`).option(`-e, --env <env...>`,`Set environment variables (e.g. -e KEY=value)`).option(`-H, --header <header...>`,`Set WebSocket headers (e.g. -H "X-Api-Key: abc123" -H "X-Custom: value")`).option(`--client-id <clientId>`,`OAuth client ID for HTTP/SSE servers`).option(`--client-secret`,`Prompt for OAuth client secret (or set MCP_CLIENT_SECRET env var)`).option(`--callback-port <port>`,`Fixed port for OAuth callback (for servers requiring pre-registered redirect URIs)`).helpOption(`-h, --help`,`Display help for command`).addOption(new J(`--xaa`,`Enable XAA (SEP-990) for this server. Requires 'claude mcp xaa setup' first. Also requires --client-id and --client-secret (for the MCP server's AS).`).hideHelp(!Un())).action(async(e,t,n,r)=>{let i=t,a=n;e?i||q(`Error: Command is required when server name is provided.
572
+ claude mcp add my-server -- my-command --some-flag arg1`).option(`-s, --scope <scope>`,`Configuration scope (local, user, or project)`,`local`).option(`-t, --transport <transport>`,`Transport type (stdio, sse, http). Defaults to stdio if not specified.`).option(`-e, --env <env...>`,`Set environment variables (e.g. -e KEY=value)`).option(`-H, --header <header...>`,`Set WebSocket headers (e.g. -H "X-Api-Key: abc123" -H "X-Custom: value")`).option(`--client-id <clientId>`,`OAuth client ID for HTTP/SSE servers`).option(`--client-secret`,`Prompt for OAuth client secret (or set MCP_CLIENT_SECRET env var)`).option(`--callback-port <port>`,`Fixed port for OAuth callback (for servers requiring pre-registered redirect URIs)`).helpOption(`-h, --help`,`Display help for command`).addOption(new J(`--xaa`,`Enable XAA (SEP-990) for this server. Requires 'claude mcp xaa setup' first. Also requires --client-id and --client-secret (for the MCP server's AS).`).hideHelp(!lt())).action(async(e,t,n,r)=>{let i=t,a=n;e?i||q(`Error: Command is required when server name is provided.
573
573
  Usage: claude mcp add <name> <command> [args...]`):q(`Error: Server name is required.
574
- Usage: claude mcp add <name> <command> [args...]`);try{let t=nn(r.scope),n=Nn(r.transport);r.xaa&&!Un()&&q(`Error: --xaa requires CLAUDE_CODE_ENABLE_XAA=1 in your environment`);let o=!!r.xaa;if(o){let e=[];r.clientId||e.push(`--client-id`),r.clientSecret||e.push(`--client-secret`),fn()||e.push(`'claude mcp xaa setup' (settings.xaaIdp not configured)`),e.length&&q(`Error: --xaa requires: ${e.join(`, `)}`)}let s=r.transport!==void 0,c=i.startsWith(`http://`)||i.startsWith(`https://`)||i.startsWith(`localhost`)||i.endsWith(`/sse`)||i.endsWith(`/mcp`);if(W(`tengu_mcp_add`,{type:n,scope:t,source:`command`,transport:n,transportExplicit:s,looksLikeUrl:c}),n===`sse`){i||q(`Error: URL is required for SSE transport.`);let n=r.header?Tr(r.header):void 0,a=r.callbackPort?parseInt(r.callbackPort,10):void 0,s=r.clientId||a||o?{...r.clientId?{clientId:r.clientId}:{},...a?{callbackPort:a}:{},...o?{xaa:!0}:{}}:void 0,c=r.clientSecret&&r.clientId?await Be():void 0,l={type:`sse`,url:i,headers:n,oauth:s};await mt(e,l,t),c&&b(e,l,c),process.stdout.write(`Added SSE MCP server ${e} with URL: ${i} to ${t} config\n`),n&&process.stdout.write(`Headers: ${la(n,null,2)}\n`)}else if(n===`http`){i||q(`Error: URL is required for HTTP transport.`);let n=r.header?Tr(r.header):void 0,a=r.callbackPort?parseInt(r.callbackPort,10):void 0,s=r.clientId||a||o?{...r.clientId?{clientId:r.clientId}:{},...a?{callbackPort:a}:{},...o?{xaa:!0}:{}}:void 0,c=r.clientSecret&&r.clientId?await Be():void 0,l={type:`http`,url:i,headers:n,oauth:s};await mt(e,l,t),c&&b(e,l,c),process.stdout.write(`Added HTTP MCP server ${e} with URL: ${i} to ${t} config\n`),n&&process.stdout.write(`Headers: ${la(n,null,2)}\n`)}else(r.clientId||r.clientSecret||r.callbackPort||r.xaa)&&process.stderr.write(`Warning: --client-id, --client-secret, --callback-port, and --xaa are only supported for HTTP/SSE transports and will be ignored for stdio.
575
- `),!s&&c&&(process.stderr.write(`\nWarning: The command "${i}" looks like a URL, but is being interpreted as a stdio server as --transport was not specified.\n`),process.stderr.write(`If this is an HTTP server, use: claude mcp add --transport http ${e} ${i}\n`),process.stderr.write(`If this is an SSE server, use: claude mcp add --transport sse ${e} ${i}\n`)),await mt(e,{type:`stdio`,command:i,args:a,env:u(r.env)},t),process.stdout.write(`Added stdio MCP server ${e} with command: ${i} ${a.join(` `)} to ${t} config\n`);K(`File modified: ${rr(t)}`)}catch(e){q(e.message)}})}or(),ua(),I();function Uu(e){let t=e.command(`xaa`).description(`Manage the XAA (SEP-990) IdP connection`);t.command(`setup`).description(`Configure the IdP connection (one-time setup for all XAA-enabled servers)`).requiredOption(`--issuer <url>`,`IdP issuer URL (OIDC discovery)`).requiredOption(`--client-id <id>`,`Work Mate's client_id at the IdP`).option(`--client-secret`,`Read IdP client secret from MCP_XAA_IDP_CLIENT_SECRET env var`).option(`--callback-port <port>`,`Fixed loopback callback port (only if IdP does not honor RFC 8252 port-any matching)`).action(e=>{let t;try{t=new URL(e.issuer)}catch{return q(`Error: --issuer must be a valid URL (got "${e.issuer}")`)}if(t.protocol!==`https:`&&!(t.protocol===`http:`&&(t.hostname===`localhost`||t.hostname===`127.0.0.1`||t.hostname===`[::1]`)))return q(`Error: --issuer must use https:// (got "${t.protocol}//${t.host}")`);let n=e.callbackPort?parseInt(e.callbackPort,10):void 0;if(n!==void 0&&(!Number.isInteger(n)||n<=0))return q(`Error: --callback-port must be a positive integer`);let r=e.clientSecret?process.env.MCP_XAA_IDP_CLIENT_SECRET:void 0;if(e.clientSecret&&!r)return q(`Error: --client-secret requires MCP_XAA_IDP_CLIENT_SECRET env var`);let i=fn(),a=i?.issuer,o=i?.clientId,{error:s}=L(`userSettings`,{xaaIdp:{issuer:e.issuer,clientId:e.clientId,callbackPort:n}});if(s)return q(`Error writing settings: ${s.message}`);if(a&&(er(a)===er(e.issuer)?o!==e.clientId&&(T(a),Ft(a)):(T(a),Ft(a))),r){let{success:t,warning:n}=En(e.issuer,r);if(!t)return q(`Error: settings written but keychain save failed${n?` — ${n}`:``}. Re-run with --client-secret once keychain is available.`)}K(`XAA IdP connection configured for ${e.issuer}`)}),t.command(`login`).description(`Cache an IdP id_token so XAA-enabled MCP servers authenticate silently. Default: run the OIDC browser login. With --id-token: write a pre-obtained JWT directly (used by conformance/e2e tests where the mock IdP does not serve /authorize).`).option(`--force`,`Ignore any cached id_token and re-login (useful after IdP-side revocation)`).option(`--id-token <jwt>`,`Write this pre-obtained id_token directly to cache, skipping the OIDC browser login`).action(async e=>{let t=fn();if(!t)return q(`Error: no XAA IdP connection. Run 'claude mcp xaa setup' first.`);if(e.idToken){let n=O(t.issuer,e.idToken);return K(`id_token cached for ${t.issuer} (expires ${new Date(n).toISOString()})`)}if(e.force&&T(t.issuer),ct(t.issuer)!==void 0)return K(`Already logged in to ${t.issuer} (cached id_token still valid). Use --force to re-login.`);process.stdout.write(`Opening browser for IdP login at ${t.issuer}…\n`);try{await Rt({idpIssuer:t.issuer,idpClientId:t.clientId,idpClientSecret:ne(t.issuer),callbackPort:t.callbackPort,onAuthorizationUrl:e=>{process.stdout.write(`If the browser did not open, visit:\n ${e}\n`)}}),K(`Logged in. MCP servers with --xaa will now authenticate silently.`)}catch(e){q(`IdP login failed: ${P(e)}`)}}),t.command(`show`).description(`Show the current IdP connection config`).action(()=>{let e=fn();if(!e)return K(`No XAA IdP connection configured.`);let t=ne(e.issuer)!==void 0,n=ct(e.issuer)!==void 0;process.stdout.write(`Issuer: ${e.issuer}\n`),process.stdout.write(`Client ID: ${e.clientId}\n`),e.callbackPort!==void 0&&process.stdout.write(`Callback port: ${e.callbackPort}\n`),process.stdout.write(`Client secret: ${t?`(stored in keychain)`:`(not set — PKCE-only)`}\n`),process.stdout.write(`Logged in: ${n?`yes (id_token cached)`:`no — run 'claude mcp xaa login'`}\n`),K()}),t.command(`clear`).description(`Clear the IdP connection config and cached id_token`).action(()=>{let e=fn(),{error:t}=L(`userSettings`,{xaaIdp:void 0});if(t)return q(`Error writing settings: ${t.message}`);e&&(T(e.issuer),Ft(e.issuer)),K(`XAA IdP connection cleared`)})}Jt();function Wu(e,t=process.argv){for(let n=0;n<t.length;n++){let r=t[n];if(r?.startsWith(`${e}=`))return r.slice(e.length+1);if(r===e&&n+1<t.length)return t[n+1]}}rn(),en(),Qn(),U(),z(),no(),I();function Gu(){if(R().bypassPermissionsModeAccepted)try{xa()||L(`userSettings`,{skipDangerousModePermissionPrompt:!0}),W(`tengu_migrate_bypass_permissions_accepted`,{}),B(e=>{if(!(`bypassPermissionsModeAccepted`in e))return e;let{bypassPermissionsModeAccepted:t,...n}=e;return n})}catch(e){H(Error(`Failed to migrate bypass permissions accepted: ${e}`))}}U(),z(),no(),I();function Ku(){let e=La(),t=e.enableAllProjectMcpServers!==void 0,n=e.enabledMcpjsonServers&&e.enabledMcpjsonServers.length>0,r=e.disabledMcpjsonServers&&e.disabledMcpjsonServers.length>0;if(!(!t&&!n&&!r))try{let i=va(`localSettings`)||{},a={},o=[];if(t&&i.enableAllProjectMcpServers===void 0?(a.enableAllProjectMcpServers=e.enableAllProjectMcpServers,o.push(`enableAllProjectMcpServers`)):t&&o.push(`enableAllProjectMcpServers`),n&&e.enabledMcpjsonServers){let t=i.enabledMcpjsonServers||[];a.enabledMcpjsonServers=[...new Set([...t,...e.enabledMcpjsonServers])],o.push(`enabledMcpjsonServers`)}if(r&&e.disabledMcpjsonServers){let t=i.disabledMcpjsonServers||[];a.disabledMcpjsonServers=[...new Set([...t,...e.disabledMcpjsonServers])],o.push(`disabledMcpjsonServers`)}Object.keys(a).length>0&&L(`localSettings`,a),(o.includes(`enableAllProjectMcpServers`)||o.includes(`enabledMcpjsonServers`)||o.includes(`disabledMcpjsonServers`))&&Va(e=>{let{enableAllProjectMcpServers:t,enabledMcpjsonServers:n,disabledMcpjsonServers:r,...i}=e;return i}),W(`tengu_migrate_mcp_approval_fields_success`,{migratedCount:o.length})}catch(e){H(e),W(`tengu_migrate_mcp_approval_fields_error`,{})}}U(),z(),as(),I();function qu(){if(Vo()!==`firstParty`||!ss())return;let e=va(`userSettings`)?.model;e!==`claude-opus-4-20250514`&&e!==`claude-opus-4-1-20250805`&&e!==`claude-opus-4-0`&&e!==`claude-opus-4-1`||(L(`userSettings`,{model:`opus`}),B(e=>({...e,legacyOpusMigrationTimestamp:Date.now()})),W(`tengu_legacy_opus_migration`,{from_model:e}))}U(),Bo();function Ju(){Wo()&&W(`tengu_opus_to_opus1m_migration`,{skipped:!0})}z();function Yu(){B(e=>{let t=e.replBridgeEnabled;if(t===void 0||e.remoteControlAtStartup!==void 0)return e;let n={...e,remoteControlAtStartup:!!t};return delete n.replBridgeEnabled,n})}vi(),z(),I();function Xu(){R().sonnet1m45MigrationComplete||(va(`userSettings`)?.model===`sonnet[1m]`&&L(`userSettings`,{model:`sonnet-4-5-20250929[1m]`}),Ci()===`sonnet[1m]`&&yi(`sonnet-4-5-20250929[1m]`),B(e=>({...e,sonnet1m45MigrationComplete:!0})))}U(),wo(),z(),as(),I();function Zu(){if(Vo()!==`firstParty`||!Co()&&!Lo()&&!Ko())return;let e=va(`userSettings`)?.model;if(e!==`claude-sonnet-4-5-20250929`&&e!==`claude-sonnet-4-5-20250929[1m]`&&e!==`sonnet-4-5-20250929`&&e!==`sonnet-4-5-20250929[1m]`)return;let t=e.endsWith(`[1m]`);L(`userSettings`,{model:t?`sonnet[1m]`:`sonnet`}),R().numStartups>1&&B(e=>({...e,sonnet45To46MigrationTimestamp:Date.now()})),W(`tengu_sonnet45_to_46_migration`,{from_model:e,has_1m:t})}U(),z(),no(),I();function Qu(){if(!R().hasResetAutoModeOptInForDefaultOffer&&fr()===`enabled`)try{let e=va(`userSettings`);e?.skipAutoPermissionPrompt&&e?.permissions?.defaultMode!==`auto`&&(L(`userSettings`,{skipAutoPermissionPrompt:void 0}),W(`tengu_migrate_reset_auto_opt_in_for_default_offer`,{})),B(e=>e.hasResetAutoModeOptInForDefaultOffer?e:{...e,hasResetAutoModeOptInForDefaultOffer:!0})}catch(e){H(Error(`Failed to reset auto mode opt-in: ${e}`))}}U(),wo(),z(),as(),I();function $u(){if(!R().opusProMigrationComplete){if(Vo()!==`firstParty`||!Co()){B(e=>({...e,opusProMigrationComplete:!0})),W(`tengu_reset_pro_to_opus_default`,{skipped:!0});return}if(ba()?.model===void 0){let e=Date.now();B(t=>({...t,opusProMigrationComplete:!0,opusProMigrationTimestamp:e})),W(`tengu_reset_pro_to_opus_default`,{skipped:!1,had_custom_model:!1})}else B(e=>({...e,opusProMigrationComplete:!0})),W(`tengu_reset_pro_to_opus_default`,{skipped:!1,had_custom_model:!0})}}li(),ui();var ed=ci(()=>si({session_id:N(),ws_url:N(),work_dir:N().optional()}));ua(),Xi();var td=class extends Error{constructor(e){super(e),this.name=`DirectConnectError`}};async function nd({serverUrl:e,authToken:t,cwd:n,dangerouslySkipPermissions:r}){let i={"content-type":`application/json`};t&&(i.authorization=`Bearer ${t}`);let a;try{a=await fetch(`${e}/sessions`,{method:`POST`,headers:i,body:la({cwd:n,...r&&{dangerously_skip_permissions:!0}})})}catch(t){throw new td(`Failed to connect to server at ${e}: ${P(t)}`)}if(!a.ok)throw new td(`Failed to create session: ${a.status} ${a.statusText}`);let o=ed().safeParse(await a.json());if(!o.success)throw new td(`Invalid session response: ${o.error.message}`);let s=o.data;return{config:{serverUrl:e,sessionId:s.session_id,wsUrl:s.ws_url,authToken:t},workDir:s.work_dir}}po(),vo(),kt(),Dr(),wo(),z(),_c(),oo(),Xi(),U(),vi(),ze(),Zr(),mc(),f(),Xa(),no(),Bo(),ae(),_(),I(),S(),Nr(),or(),ia(),ea(),ua(),_n(),kn(),Ka(),Ys(),wn(),tc(),Et(),G(`main_tsx_entry`),wa(),cs();var rd=(Ht(),e(It));G(`main_tsx_imports_loaded`);function id(){try{let e=va(`policySettings`);if(e){let t=Sa(e);W(`tengu_managed_settings_loaded`,{keyCount:t.length,keys:t.join(`,`)})}}catch{}}function ad(){let e=To(pi()??es());Vu(Gi(),Io(e,ki())),he().then(({enabled:e,errors:t})=>{let n=Pe();Zn(e,n,sr()),Ve(t,n)}).catch(e=>H(e))}function od(){let e={};return process.env.NODE_EXTRA_CA_CERTS&&(e.has_node_extra_ca_certs=!0),process.env.CLAUDE_CODE_CLIENT_CERT&&(e.has_client_cert=!0),c(`--use-system-ca`)&&(e.has_use_system_ca=!0),c(`--use-openssl-ca`)&&(e.has_use_openssl_ca=!0),e}async function sd(){if(ec())return;let[e,t,n]=await Promise.all([Ya(),qa(),Bu()]);W(`tengu_startup_telemetry`,{is_git:e,worktree_count:t,gh_auth_status:n,sandbox_enabled:qt.isSandboxingEnabled(),are_unsandboxed_commands_allowed:qt.areUnsandboxedCommandsAllowed(),is_auto_bash_allowed_if_sandbox_enabled:qt.isAutoAllowBashIfSandboxedEnabled(),auto_updater_disabled:Pa(),prefers_reduced_motion:Ta().prefersReducedMotion??!1,...od()})}var cd=11;function ld(){R().migrationVersion!==cd&&(Gu(),Ku(),$u(),Xu(),qu(),Zu(),Ju(),Yu(),Qu(),B(e=>e.migrationVersion===cd?e:{...e,migrationVersion:cd}))}function ud(){if(Ui()){V(`info`,`prefetch_system_context_non_interactive`),pe();return}Ia()?(V(`info`,`prefetch_system_context_has_trust`),pe()):V(`info`,`prefetch_system_context_skipped_no_trust`)}function dd(){d(process.env.CLAUDE_CODE_EXIT_AFTER_FIRST_RENDER)||p()||($s(),wr(),ud(),Nc(),d(process.env.CLAUDE_CODE_USE_BEDROCK)&&!d(process.env.CLAUDE_CODE_SKIP_BEDROCK_AUTH)&&Yo(),d(process.env.CLAUDE_CODE_USE_VERTEX)&&!d(process.env.CLAUDE_CODE_SKIP_VERTEX_AUTH)&&Ho(),zs(Gi(),AbortSignal.timeout(3e3),[]),Ro(),qn.initialize(),p()||xc.initialize())}function fd(e){try{let t=e.trim(),n=t.startsWith(`{`)&&t.endsWith(`}`),r;if(n)uo(t)||(process.stderr.write(M.red(`Error: Invalid JSON provided to --settings
576
- `)),process.exit(1)),r=Sr(`claude-settings`,`.json`,{contentHash:t}),qi(r,t,`utf8`);else{let{resolvedPath:t}=$i(ta(),e);try{Rc(t,`utf8`)}catch(e){throw Zi(e)&&(process.stderr.write(M.red(`Error: Settings file not found: ${t}\n`)),process.exit(1)),e}r=t}Bi(r),Ti()}catch(e){e instanceof Error&&H(e),process.stderr.write(M.red(`Error processing settings: ${P(e)}\n`)),process.exit(1)}}function pd(e){try{Ei(Oa(e)),Ti()}catch(e){e instanceof Error&&H(e),process.stderr.write(M.red(`Error processing --setting-sources: ${P(e)}\n`)),process.exit(1)}}function md(){G(`eagerLoadSettings_start`);let e=Wu(`--settings`);e&&fd(e);let t=Wu(`--setting-sources`);t!==void 0&&pd(t),G(`eagerLoadSettings_end`)}function hd(e){if(process.env.CLAUDE_CODE_ENTRYPOINT)return;let t=process.argv.slice(2),n=t.indexOf(`mcp`);if(n!==-1&&t[n+1]===`serve`){process.env.CLAUDE_CODE_ENTRYPOINT=`mcp`;return}if(d(process.env.CLAUDE_CODE_ACTION)){process.env.CLAUDE_CODE_ENTRYPOINT=`claude-code-github-action`;return}process.env.CLAUDE_CODE_ENTRYPOINT=e?`sdk-cli`:`cli`}var Q={url:void 0,authToken:void 0,dangerouslySkipPermissions:!1},$={host:void 0,cwd:void 0,permissionMode:void 0,dangerouslySkipPermissions:!1,local:!1,extraCliArgs:[],remoteBin:void 0};async function gd(){G(`main_function_start`),process.env.NoDefaultCurrentDirectoryInExePath=`1`,wl(),process.on(`exit`,()=>{xd();try{let{peekWorkflowService:t}=(bn(),e(E));t()?.shutdown()}catch{}}),process.on(`SIGINT`,()=>{process.argv.includes(`-p`)||process.argv.includes(`--print`)||process.exit(0)}),G(`main_warning_handler_initialized`);{let e=process.argv.slice(2),t=e.findIndex(e=>e.startsWith(`cc://`)||e.startsWith(`cc+unix://`));if(t!==-1&&Q){let n=e[t],{parseConnectUrl:r}=await import(`./parseConnectUrl-BiyKR5-x.js`),i=r(n);if(Q.dangerouslySkipPermissions=e.includes(`--dangerously-skip-permissions`),e.includes(`-p`)||e.includes(`--print`)){let r=e.filter((e,n)=>n!==t),i=r.indexOf(`--dangerously-skip-permissions`);i!==-1&&r.splice(i,1),process.argv=[process.argv[0],process.argv[1],`open`,n,...r]}else{Q.url=i.serverUrl,Q.authToken=i.authToken;let n=e.filter((e,n)=>n!==t),r=n.indexOf(`--dangerously-skip-permissions`);r!==-1&&n.splice(r,1),process.argv=[process.argv[0],process.argv[1],...n]}}}{let e=process.argv.indexOf(`--handle-uri`);if(e!==-1&&process.argv[e+1]){let{enableConfigs:t}=await import(`./config-CVvUNkj2.js`);t();let n=process.argv[e+1],{handleDeepLinkUri:r}=await import(`./protocolHandler-ClfbHTjI.js`),i=await r(n);process.exit(i)}if(process.platform===`darwin`&&process.env.__CFBundleIdentifier===`com.anthropic.claude-code-url-handler`){let{enableConfigs:e}=await import(`./config-CVvUNkj2.js`);e();let{handleUrlSchemeLaunch:t}=await import(`./protocolHandler-ClfbHTjI.js`),n=await t();process.exit(n??1)}}if($){let e=process.argv.slice(2);if(e[0]===`ssh`){let t=e.indexOf(`--local`);t!==-1&&($.local=!0,e.splice(t,1));let n=e.indexOf(`--dangerously-skip-permissions`);n!==-1&&($.dangerouslySkipPermissions=!0,e.splice(n,1));let r=e.indexOf(`--permission-mode`);r!==-1&&e[r+1]&&!e[r+1].startsWith(`-`)&&($.permissionMode=e[r+1],e.splice(r,2));let i=e.findIndex(e=>e.startsWith(`--permission-mode=`));i!==-1&&($.permissionMode=e[i].split(`=`)[1],e.splice(i,1));let a=(t,n={})=>{let r=e.indexOf(t);if(r!==-1){$.extraCliArgs.push(n.as??t);let i=e[r+1];n.hasValue&&i&&!i.startsWith(`-`)?($.extraCliArgs.push(i),e.splice(r,2)):e.splice(r,1)}let i=e.findIndex(e=>e.startsWith(`${t}=`));i!==-1&&($.extraCliArgs.push(n.as??t,e[i].slice(t.length+1)),e.splice(i,1))},o=e.indexOf(`--remote-bin`);o!==-1&&e[o+1]&&!e[o+1].startsWith(`-`)&&($.remoteBin=e[o+1],e.splice(o,2));let s=e.findIndex(e=>e.startsWith(`--remote-bin=`));s!==-1&&($.remoteBin=e[s].split(`=`).slice(1).join(`=`),e.splice(s,1)),a(`-c`,{as:`--continue`}),a(`--continue`),a(`--resume`,{hasValue:!0}),a(`--model`,{hasValue:!0})}if(e[0]===`ssh`&&e[1]&&!e[1].startsWith(`-`)){$.host=e[1];let t=2;e[2]&&!e[2].startsWith(`-`)&&($.cwd=e[2],t=3);let n=e.slice(t);if(n.includes(`-p`)||n.includes(`--print`)){process.stderr.write(`Error: headless (-p/--print) mode is not supported with claude ssh
577
- `),un(1);return}process.argv=[process.argv[0],process.argv[1],...n]}}let t=process.argv.slice(2),n=t.includes(`-p`)||t.includes(`--print`),r=t.includes(`--init-only`),i=t.some(e=>e.startsWith(`--sdk-url`)),a=d(process.env.CLAUDE_CODE_FORCE_INTERACTIVE),o=n||r||i||!a&&!process.stdout.isTTY;o&&Dc(),Vi(!o),hd(o);let s=(()=>{if(d(process.env.GITHUB_ACTIONS))return`github-action`;if(process.env.CLAUDE_CODE_ENTRYPOINT===`sdk-ts`)return`sdk-typescript`;if(process.env.CLAUDE_CODE_ENTRYPOINT===`sdk-py`)return`sdk-python`;if(process.env.CLAUDE_CODE_ENTRYPOINT===`sdk-cli`)return`sdk-cli`;if(process.env.CLAUDE_CODE_ENTRYPOINT===`claude-vscode`)return`claude-vscode`;if(process.env.CLAUDE_CODE_ENTRYPOINT===`local-agent`)return`local-agent`;if(process.env.CLAUDE_CODE_ENTRYPOINT===`claude-desktop`)return`claude-desktop`;let e=process.env.CLAUDE_CODE_SESSION_ACCESS_TOKEN||process.env.CLAUDE_CODE_WEBSOCKET_AUTH_FILE_DESCRIPTOR;return process.env.CLAUDE_CODE_ENTRYPOINT===`remote`||e?`remote`:`cli`})();Di(s);let c=process.env.CLAUDE_CODE_QUESTION_PREVIEW_FORMAT;c===`markdown`||c===`html`?_i(c):!s.startsWith(`sdk-`)&&s!==`claude-desktop`&&s!==`local-agent`&&s!==`remote`&&_i(`markdown`),process.env.CLAUDE_CODE_ENVIRONMENT_KIND===`bridge`&&Oi(`remote-control`),G(`main_client_type_determined`),md(),G(`main_before_run`),await vd(),G(`main_after_run`)}async function _d(e,t){if(!process.stdin.isTTY&&!process.argv.includes(`mcp`)){if(t===`stream-json`)return process.stdin;process.stdin.setEncoding(`utf8`);let n=``,r=e=>{n+=e};process.stdin.on(`data`,r);let i=await Ga(process.stdin,3e3);return process.stdin.off(`data`,r),i&&process.stderr.write(`Warning: no stdin data received in 3s, proceeding without it. If piping from a slow command, redirect stdin explicitly: < /dev/null to skip, or wait longer.
574
+ Usage: claude mcp add <name> <command> [args...]`);try{let t=O(r.scope),n=b(r.transport);r.xaa&&!lt()&&q(`Error: --xaa requires CLAUDE_CODE_ENABLE_XAA=1 in your environment`);let o=!!r.xaa;if(o){let e=[];r.clientId||e.push(`--client-id`),r.clientSecret||e.push(`--client-secret`),S()||e.push(`'claude mcp xaa setup' (settings.xaaIdp not configured)`),e.length&&q(`Error: --xaa requires: ${e.join(`, `)}`)}let s=r.transport!==void 0,c=i.startsWith(`http://`)||i.startsWith(`https://`)||i.startsWith(`localhost`)||i.endsWith(`/sse`)||i.endsWith(`/mcp`);if(G(`tengu_mcp_add`,{type:n,scope:t,source:`command`,transport:n,transportExplicit:s,looksLikeUrl:c}),n===`sse`){i||q(`Error: URL is required for SSE transport.`);let n=r.header?tr(r.header):void 0,a=r.callbackPort?parseInt(r.callbackPort,10):void 0,s=r.clientId||a||o?{...r.clientId?{clientId:r.clientId}:{},...a?{callbackPort:a}:{},...o?{xaa:!0}:{}}:void 0,c=r.clientSecret&&r.clientId?await nt():void 0,l={type:`sse`,url:i,headers:n,oauth:s};await Sn(e,l,t),c&&ie(e,l,c),process.stdout.write(`Added SSE MCP server ${e} with URL: ${i} to ${t} config\n`),n&&process.stdout.write(`Headers: ${ca(n,null,2)}\n`)}else if(n===`http`){i||q(`Error: URL is required for HTTP transport.`);let n=r.header?tr(r.header):void 0,a=r.callbackPort?parseInt(r.callbackPort,10):void 0,s=r.clientId||a||o?{...r.clientId?{clientId:r.clientId}:{},...a?{callbackPort:a}:{},...o?{xaa:!0}:{}}:void 0,c=r.clientSecret&&r.clientId?await nt():void 0,l={type:`http`,url:i,headers:n,oauth:s};await Sn(e,l,t),c&&ie(e,l,c),process.stdout.write(`Added HTTP MCP server ${e} with URL: ${i} to ${t} config\n`),n&&process.stdout.write(`Headers: ${ca(n,null,2)}\n`)}else(r.clientId||r.clientSecret||r.callbackPort||r.xaa)&&process.stderr.write(`Warning: --client-id, --client-secret, --callback-port, and --xaa are only supported for HTTP/SSE transports and will be ignored for stdio.
575
+ `),!s&&c&&(process.stderr.write(`\nWarning: The command "${i}" looks like a URL, but is being interpreted as a stdio server as --transport was not specified.\n`),process.stderr.write(`If this is an HTTP server, use: claude mcp add --transport http ${e} ${i}\n`),process.stderr.write(`If this is an SSE server, use: claude mcp add --transport sse ${e} ${i}\n`)),await Sn(e,{type:`stdio`,command:i,args:a,env:u(r.env)},t),process.stdout.write(`Added stdio MCP server ${e} with command: ${i} ${a.join(` `)} to ${t} config\n`);fc(`File modified: ${D(t)}`)}catch(e){q(e.message)}})}Ke(),la(),L();function Uu(e){let t=e.command(`xaa`).description(`Manage the XAA (SEP-990) IdP connection`);t.command(`setup`).description(`Configure the IdP connection (one-time setup for all XAA-enabled servers)`).requiredOption(`--issuer <url>`,`IdP issuer URL (OIDC discovery)`).requiredOption(`--client-id <id>`,`Work Mate's client_id at the IdP`).option(`--client-secret`,`Read IdP client secret from MCP_XAA_IDP_CLIENT_SECRET env var`).option(`--callback-port <port>`,`Fixed loopback callback port (only if IdP does not honor RFC 8252 port-any matching)`).action(e=>{let t;try{t=new URL(e.issuer)}catch{return q(`Error: --issuer must be a valid URL (got "${e.issuer}")`)}if(t.protocol!==`https:`&&!(t.protocol===`http:`&&(t.hostname===`localhost`||t.hostname===`127.0.0.1`||t.hostname===`[::1]`)))return q(`Error: --issuer must use https:// (got "${t.protocol}//${t.host}")`);let n=e.callbackPort?parseInt(e.callbackPort,10):void 0;if(n!==void 0&&(!Number.isInteger(n)||n<=0))return q(`Error: --callback-port must be a positive integer`);let r=e.clientSecret?process.env.MCP_XAA_IDP_CLIENT_SECRET:void 0;if(e.clientSecret&&!r)return q(`Error: --client-secret requires MCP_XAA_IDP_CLIENT_SECRET env var`);let i=S(),a=i?.issuer,o=i?.clientId,{error:s}=R(`userSettings`,{xaaIdp:{issuer:e.issuer,clientId:e.clientId,callbackPort:n}});if(s)return q(`Error writing settings: ${s.message}`);if(a&&(zr(a)===zr(e.issuer)?o!==e.clientId&&($e(a),Ye(a)):($e(a),Ye(a))),r){let{success:t,warning:n}=ce(e.issuer,r);if(!t)return q(`Error: settings written but keychain save failed${n?` — ${n}`:``}. Re-run with --client-secret once keychain is available.`)}fc(`XAA IdP connection configured for ${e.issuer}`)}),t.command(`login`).description(`Cache an IdP id_token so XAA-enabled MCP servers authenticate silently. Default: run the OIDC browser login. With --id-token: write a pre-obtained JWT directly (used by conformance/e2e tests where the mock IdP does not serve /authorize).`).option(`--force`,`Ignore any cached id_token and re-login (useful after IdP-side revocation)`).option(`--id-token <jwt>`,`Write this pre-obtained id_token directly to cache, skipping the OIDC browser login`).action(async e=>{let t=S();if(!t)return q(`Error: no XAA IdP connection. Run 'claude mcp xaa setup' first.`);if(e.idToken){let n=kt(t.issuer,e.idToken);return fc(`id_token cached for ${t.issuer} (expires ${new Date(n).toISOString()})`)}if(e.force&&$e(t.issuer),st(t.issuer)!==void 0)return fc(`Already logged in to ${t.issuer} (cached id_token still valid). Use --force to re-login.`);process.stdout.write(`Opening browser for IdP login at ${t.issuer}…\n`);try{await Dn({idpIssuer:t.issuer,idpClientId:t.clientId,idpClientSecret:je(t.issuer),callbackPort:t.callbackPort,onAuthorizationUrl:e=>{process.stdout.write(`If the browser did not open, visit:\n ${e}\n`)}}),fc(`Logged in. MCP servers with --xaa will now authenticate silently.`)}catch(e){q(`IdP login failed: ${F(e)}`)}}),t.command(`show`).description(`Show the current IdP connection config`).action(()=>{let e=S();if(!e)return fc(`No XAA IdP connection configured.`);let t=je(e.issuer)!==void 0,n=st(e.issuer)!==void 0;process.stdout.write(`Issuer: ${e.issuer}\n`),process.stdout.write(`Client ID: ${e.clientId}\n`),e.callbackPort!==void 0&&process.stdout.write(`Callback port: ${e.callbackPort}\n`),process.stdout.write(`Client secret: ${t?`(stored in keychain)`:`(not set — PKCE-only)`}\n`),process.stdout.write(`Logged in: ${n?`yes (id_token cached)`:`no — run 'claude mcp xaa login'`}\n`),fc()}),t.command(`clear`).description(`Clear the IdP connection config and cached id_token`).action(()=>{let e=S(),{error:t}=R(`userSettings`,{xaaIdp:void 0});if(t)return q(`Error writing settings: ${t.message}`);e&&($e(e.issuer),Ye(e.issuer)),fc(`XAA IdP connection cleared`)})}Lr();function Wu(e,t=process.argv){for(let n=0;n<t.length;n++){let r=t[n];if(r?.startsWith(`${e}=`))return r.slice(e.length+1);if(r===e&&n+1<t.length)return t[n+1]}}ae(),cn(),ct(),W(),B(),to(),L();function Gu(){if(z().bypassPermissionsModeAccepted)try{ba()||R(`userSettings`,{skipDangerousModePermissionPrompt:!0}),G(`tengu_migrate_bypass_permissions_accepted`,{}),V(e=>{if(!(`bypassPermissionsModeAccepted`in e))return e;let{bypassPermissionsModeAccepted:t,...n}=e;return n})}catch(e){U(Error(`Failed to migrate bypass permissions accepted: ${e}`))}}W(),B(),to(),L();function Ku(){let e=Ia(),t=e.enableAllProjectMcpServers!==void 0,n=e.enabledMcpjsonServers&&e.enabledMcpjsonServers.length>0,r=e.disabledMcpjsonServers&&e.disabledMcpjsonServers.length>0;if(!(!t&&!n&&!r))try{let i=_a(`localSettings`)||{},a={},o=[];if(t&&i.enableAllProjectMcpServers===void 0?(a.enableAllProjectMcpServers=e.enableAllProjectMcpServers,o.push(`enableAllProjectMcpServers`)):t&&o.push(`enableAllProjectMcpServers`),n&&e.enabledMcpjsonServers){let t=i.enabledMcpjsonServers||[];a.enabledMcpjsonServers=[...new Set([...t,...e.enabledMcpjsonServers])],o.push(`enabledMcpjsonServers`)}if(r&&e.disabledMcpjsonServers){let t=i.disabledMcpjsonServers||[];a.disabledMcpjsonServers=[...new Set([...t,...e.disabledMcpjsonServers])],o.push(`disabledMcpjsonServers`)}Object.keys(a).length>0&&R(`localSettings`,a),(o.includes(`enableAllProjectMcpServers`)||o.includes(`enabledMcpjsonServers`)||o.includes(`disabledMcpjsonServers`))&&Ba(e=>{let{enableAllProjectMcpServers:t,enabledMcpjsonServers:n,disabledMcpjsonServers:r,...i}=e;return i}),G(`tengu_migrate_mcp_approval_fields_success`,{migratedCount:o.length})}catch(e){U(e),G(`tengu_migrate_mcp_approval_fields_error`,{})}}W(),B(),is(),L();function qu(){if(Bo()!==`firstParty`||!os())return;let e=_a(`userSettings`)?.model;e!==`claude-opus-4-20250514`&&e!==`claude-opus-4-1-20250805`&&e!==`claude-opus-4-0`&&e!==`claude-opus-4-1`||(R(`userSettings`,{model:`opus`}),V(e=>({...e,legacyOpusMigrationTimestamp:Date.now()})),G(`tengu_legacy_opus_migration`,{from_model:e}))}W(),zo();function Ju(){Uo()&&G(`tengu_opus_to_opus1m_migration`,{skipped:!0})}B();function Yu(){V(e=>{let t=e.replBridgeEnabled;if(t===void 0||e.remoteControlAtStartup!==void 0)return e;let n={...e,remoteControlAtStartup:!!t};return delete n.replBridgeEnabled,n})}Si(),B(),L();function Xu(){z().sonnet1m45MigrationComplete||(_a(`userSettings`)?.model===`sonnet[1m]`&&R(`userSettings`,{model:`sonnet-4-5-20250929[1m]`}),mi()===`sonnet[1m]`&&_i(`sonnet-4-5-20250929[1m]`),V(e=>({...e,sonnet1m45MigrationComplete:!0})))}W(),Co(),B(),is(),L();function Zu(){if(Bo()!==`firstParty`||!So()&&!Io()&&!Go())return;let e=_a(`userSettings`)?.model;if(e!==`claude-sonnet-4-5-20250929`&&e!==`claude-sonnet-4-5-20250929[1m]`&&e!==`sonnet-4-5-20250929`&&e!==`sonnet-4-5-20250929[1m]`)return;let t=e.endsWith(`[1m]`);R(`userSettings`,{model:t?`sonnet[1m]`:`sonnet`}),z().numStartups>1&&V(e=>({...e,sonnet45To46MigrationTimestamp:Date.now()})),G(`tengu_sonnet45_to_46_migration`,{from_model:e,has_1m:t})}W(),B(),to(),L();function Qu(){if(!z().hasResetAutoModeOptInForDefaultOffer&&yr()===`enabled`)try{let e=_a(`userSettings`);e?.skipAutoPermissionPrompt&&e?.permissions?.defaultMode!==`auto`&&(R(`userSettings`,{skipAutoPermissionPrompt:void 0}),G(`tengu_migrate_reset_auto_opt_in_for_default_offer`,{})),V(e=>e.hasResetAutoModeOptInForDefaultOffer?e:{...e,hasResetAutoModeOptInForDefaultOffer:!0})}catch(e){U(Error(`Failed to reset auto mode opt-in: ${e}`))}}W(),Co(),B(),is(),L();function $u(){if(!z().opusProMigrationComplete){if(Bo()!==`firstParty`||!So()){V(e=>({...e,opusProMigrationComplete:!0})),G(`tengu_reset_pro_to_opus_default`,{skipped:!0});return}if(ya()?.model===void 0){let e=Date.now();V(t=>({...t,opusProMigrationComplete:!0,opusProMigrationTimestamp:e})),G(`tengu_reset_pro_to_opus_default`,{skipped:!1,had_custom_model:!1})}else V(e=>({...e,opusProMigrationComplete:!0})),G(`tengu_reset_pro_to_opus_default`,{skipped:!1,had_custom_model:!0})}}ci(),li();var ed=si(()=>oi({session_id:P(),ws_url:P(),work_dir:P().optional()}));la(),Yi();var td=class extends Error{constructor(e){super(e),this.name=`DirectConnectError`}};async function nd({serverUrl:e,authToken:t,cwd:n,dangerouslySkipPermissions:r}){let i={"content-type":`application/json`};t&&(i.authorization=`Bearer ${t}`);let a;try{a=await fetch(`${e}/sessions`,{method:`POST`,headers:i,body:ca({cwd:n,...r&&{dangerously_skip_permissions:!0}})})}catch(t){throw new td(`Failed to connect to server at ${e}: ${F(t)}`)}if(!a.ok)throw new td(`Failed to create session: ${a.status} ${a.statusText}`);let o=ed().safeParse(await a.json());if(!o.success)throw new td(`Invalid session response: ${o.error.message}`);let s=o.data;return{config:{serverUrl:e,sessionId:s.session_id,wsUrl:s.ws_url,authToken:t},workDir:s.work_dir}}fo(),_o(),ve(),on(),Co(),B(),_c(),ao(),Yi(),W(),Si(),v(),Xr(),mc(),f(),Ya(),to(),zo(),le(),he(),L(),Fn(),dr(),Ke(),ra(),$i(),la(),rr(),_(),Ga(),Ys(),Xn(),tc(),xt(),K(`main_tsx_entry`),Ca(),ss();var rd=(A(),e(ze));K(`main_tsx_imports_loaded`);function id(){try{let e=_a(`policySettings`);if(e){let t=xa(e);G(`tengu_managed_settings_loaded`,{keyCount:t.length,keys:t.join(`,`)})}}catch{}}function ad(){let e=wo(pi()??$o());Vu(Wi(),Fo(e,Oi())),vn().then(({enabled:e,errors:t})=>{let n=Tr();x(e,n,Pt()),Oe(t,n)}).catch(e=>U(e))}function od(){let e={};return process.env.NODE_EXTRA_CA_CERTS&&(e.has_node_extra_ca_certs=!0),process.env.CLAUDE_CODE_CLIENT_CERT&&(e.has_client_cert=!0),c(`--use-system-ca`)&&(e.has_use_system_ca=!0),c(`--use-openssl-ca`)&&(e.has_use_openssl_ca=!0),e}async function sd(){if(ec())return;let[e,t,n]=await Promise.all([Ja(),Ka(),Bu()]);G(`tengu_startup_telemetry`,{is_git:e,worktree_count:t,gh_auth_status:n,sandbox_enabled:He.isSandboxingEnabled(),are_unsandboxed_commands_allowed:He.areUnsandboxedCommandsAllowed(),is_auto_bash_allowed_if_sandbox_enabled:He.isAutoAllowBashIfSandboxedEnabled(),auto_updater_disabled:Na(),prefers_reduced_motion:wa().prefersReducedMotion??!1,...od()})}var cd=11;function ld(){z().migrationVersion!==cd&&(Gu(),Ku(),$u(),Xu(),qu(),Zu(),Ju(),Yu(),Qu(),V(e=>e.migrationVersion===cd?e:{...e,migrationVersion:cd}))}function ud(){if(Hi()){H(`info`,`prefetch_system_context_non_interactive`),jr();return}Fa()?(H(`info`,`prefetch_system_context_has_trust`),jr()):H(`info`,`prefetch_system_context_skipped_no_trust`)}function dd(){d(process.env.CLAUDE_CODE_EXIT_AFTER_FIRST_RENDER)||p()||($s(),ht(),ud(),Nc(),d(process.env.CLAUDE_CODE_USE_BEDROCK)&&!d(process.env.CLAUDE_CODE_SKIP_BEDROCK_AUTH)&&Jo(),d(process.env.CLAUDE_CODE_USE_VERTEX)&&!d(process.env.CLAUDE_CODE_SKIP_VERTEX_AUTH)&&Vo(),Is(Wi(),AbortSignal.timeout(3e3),[]),Lo(),Me.initialize(),p()||xc.initialize())}function fd(e){try{let t=e.trim(),n=t.startsWith(`{`)&&t.endsWith(`}`),r;if(n)lo(t)||(process.stderr.write(N.red(`Error: Invalid JSON provided to --settings
576
+ `)),process.exit(1)),r=mt(`claude-settings`,`.json`,{contentHash:t}),Ki(r,t,`utf8`);else{let{resolvedPath:t}=Qi(ea(),e);try{Rc(t,`utf8`)}catch(e){throw Xi(e)&&(process.stderr.write(N.red(`Error: Settings file not found: ${t}\n`)),process.exit(1)),e}r=t}Ni(r),Ti()}catch(e){e instanceof Error&&U(e),process.stderr.write(N.red(`Error processing settings: ${F(e)}\n`)),process.exit(1)}}function pd(e){try{Ri(Da(e)),Ti()}catch(e){e instanceof Error&&U(e),process.stderr.write(N.red(`Error processing --setting-sources: ${F(e)}\n`)),process.exit(1)}}function md(){K(`eagerLoadSettings_start`);let e=Wu(`--settings`);e&&fd(e);let t=Wu(`--setting-sources`);t!==void 0&&pd(t),K(`eagerLoadSettings_end`)}function hd(e){if(process.env.CLAUDE_CODE_ENTRYPOINT)return;let t=process.argv.slice(2),n=t.indexOf(`mcp`);if(n!==-1&&t[n+1]===`serve`){process.env.CLAUDE_CODE_ENTRYPOINT=`mcp`;return}if(d(process.env.CLAUDE_CODE_ACTION)){process.env.CLAUDE_CODE_ENTRYPOINT=`claude-code-github-action`;return}process.env.CLAUDE_CODE_ENTRYPOINT=e?`sdk-cli`:`cli`}var Q={url:void 0,authToken:void 0,dangerouslySkipPermissions:!1},$={host:void 0,cwd:void 0,permissionMode:void 0,dangerouslySkipPermissions:!1,local:!1,extraCliArgs:[],remoteBin:void 0};async function gd(){K(`main_function_start`),process.env.NoDefaultCurrentDirectoryInExePath=`1`,wl(),process.on(`exit`,()=>{xd();try{let{peekWorkflowService:t}=(pn(),e(zt));t()?.shutdown()}catch{}}),process.on(`SIGINT`,()=>{process.argv.includes(`-p`)||process.argv.includes(`--print`)||process.exit(0)}),K(`main_warning_handler_initialized`);{let e=process.argv.slice(2),t=e.findIndex(e=>e.startsWith(`cc://`)||e.startsWith(`cc+unix://`));if(t!==-1&&Q){let n=e[t],{parseConnectUrl:r}=await import(`./parseConnectUrl-BiyKR5-x.js`),i=r(n);if(Q.dangerouslySkipPermissions=e.includes(`--dangerously-skip-permissions`),e.includes(`-p`)||e.includes(`--print`)){let r=e.filter((e,n)=>n!==t),i=r.indexOf(`--dangerously-skip-permissions`);i!==-1&&r.splice(i,1),process.argv=[process.argv[0],process.argv[1],`open`,n,...r]}else{Q.url=i.serverUrl,Q.authToken=i.authToken;let n=e.filter((e,n)=>n!==t),r=n.indexOf(`--dangerously-skip-permissions`);r!==-1&&n.splice(r,1),process.argv=[process.argv[0],process.argv[1],...n]}}}{let e=process.argv.indexOf(`--handle-uri`);if(e!==-1&&process.argv[e+1]){let{enableConfigs:t}=await import(`./config-CVHMRMwd.js`);t();let n=process.argv[e+1],{handleDeepLinkUri:r}=await import(`./protocolHandler-CkFaJKKo.js`),i=await r(n);process.exit(i)}if(process.platform===`darwin`&&process.env.__CFBundleIdentifier===`com.anthropic.claude-code-url-handler`){let{enableConfigs:e}=await import(`./config-CVHMRMwd.js`);e();let{handleUrlSchemeLaunch:t}=await import(`./protocolHandler-CkFaJKKo.js`),n=await t();process.exit(n??1)}}if($){let e=process.argv.slice(2);if(e[0]===`ssh`){let t=e.indexOf(`--local`);t!==-1&&($.local=!0,e.splice(t,1));let n=e.indexOf(`--dangerously-skip-permissions`);n!==-1&&($.dangerouslySkipPermissions=!0,e.splice(n,1));let r=e.indexOf(`--permission-mode`);r!==-1&&e[r+1]&&!e[r+1].startsWith(`-`)&&($.permissionMode=e[r+1],e.splice(r,2));let i=e.findIndex(e=>e.startsWith(`--permission-mode=`));i!==-1&&($.permissionMode=e[i].split(`=`)[1],e.splice(i,1));let a=(t,n={})=>{let r=e.indexOf(t);if(r!==-1){$.extraCliArgs.push(n.as??t);let i=e[r+1];n.hasValue&&i&&!i.startsWith(`-`)?($.extraCliArgs.push(i),e.splice(r,2)):e.splice(r,1)}let i=e.findIndex(e=>e.startsWith(`${t}=`));i!==-1&&($.extraCliArgs.push(n.as??t,e[i].slice(t.length+1)),e.splice(i,1))},o=e.indexOf(`--remote-bin`);o!==-1&&e[o+1]&&!e[o+1].startsWith(`-`)&&($.remoteBin=e[o+1],e.splice(o,2));let s=e.findIndex(e=>e.startsWith(`--remote-bin=`));s!==-1&&($.remoteBin=e[s].split(`=`).slice(1).join(`=`),e.splice(s,1)),a(`-c`,{as:`--continue`}),a(`--continue`),a(`--resume`,{hasValue:!0}),a(`--model`,{hasValue:!0})}if(e[0]===`ssh`&&e[1]&&!e[1].startsWith(`-`)){$.host=e[1];let t=2;e[2]&&!e[2].startsWith(`-`)&&($.cwd=e[2],t=3);let n=e.slice(t);if(n.includes(`-p`)||n.includes(`--print`)){process.stderr.write(`Error: headless (-p/--print) mode is not supported with claude ssh
577
+ `),Bn(1);return}process.argv=[process.argv[0],process.argv[1],...n]}}let t=process.argv.slice(2),n=t.includes(`-p`)||t.includes(`--print`),r=t.includes(`--init-only`),i=t.some(e=>e.startsWith(`--sdk-url`)),a=d(process.env.CLAUDE_CODE_FORCE_INTERACTIVE),o=n||r||i||!a&&!process.stdout.isTTY;o&&Dc(),xi(!o),hd(o);let s=(()=>{if(d(process.env.GITHUB_ACTIONS))return`github-action`;if(process.env.CLAUDE_CODE_ENTRYPOINT===`sdk-ts`)return`sdk-typescript`;if(process.env.CLAUDE_CODE_ENTRYPOINT===`sdk-py`)return`sdk-python`;if(process.env.CLAUDE_CODE_ENTRYPOINT===`sdk-cli`)return`sdk-cli`;if(process.env.CLAUDE_CODE_ENTRYPOINT===`claude-vscode`)return`claude-vscode`;if(process.env.CLAUDE_CODE_ENTRYPOINT===`local-agent`)return`local-agent`;if(process.env.CLAUDE_CODE_ENTRYPOINT===`claude-desktop`)return`claude-desktop`;let e=process.env.CLAUDE_CODE_SESSION_ACCESS_TOKEN||process.env.CLAUDE_CODE_WEBSOCKET_AUTH_FILE_DESCRIPTOR;return process.env.CLAUDE_CODE_ENTRYPOINT===`remote`||e?`remote`:`cli`})();Ii(s);let c=process.env.CLAUDE_CODE_QUESTION_PREVIEW_FORMAT;c===`markdown`||c===`html`?gi(c):!s.startsWith(`sdk-`)&&s!==`claude-desktop`&&s!==`local-agent`&&s!==`remote`&&gi(`markdown`),process.env.CLAUDE_CODE_ENVIRONMENT_KIND===`bridge`&&bi(`remote-control`),K(`main_client_type_determined`),md(),K(`main_before_run`),await vd(),K(`main_after_run`)}async function _d(e,t){if(!process.stdin.isTTY&&!process.argv.includes(`mcp`)){if(t===`stream-json`)return process.stdin;process.stdin.setEncoding(`utf8`);let n=``,r=e=>{n+=e};process.stdin.on(`data`,r);let i=await Wa(process.stdin,3e3);return process.stdin.off(`data`,r),i&&process.stderr.write(`Warning: no stdin data received in 3s, proceeding without it. If piping from a slow command, redirect stdin explicitly: < /dev/null to skip, or wait longer.
578
578
  `),[e,n].filter(Boolean).join(`
579
- `)}return e}async function vd(){G(`run_function_start`);function e(){let e=e=>e.long?.replace(/^--/,``)??e.short?.replace(/^-/,``)??``;return Object.assign({sortSubcommands:!0,sortOptions:!0},{compareOptions:(t,n)=>e(t).localeCompare(e(n))})}let t=new nl().configureHelp(e()).enablePositionalOptions();G(`run_commander_initialized`),t.hook(`preAction`,async e=>{G(`preAction_start`),await Promise.all([ga(),ds()]),G(`preAction_after_mdm`),await dl(),G(`preAction_after_init`),d(process.env.CLAUDE_CODE_DISABLE_TERMINAL_TITLE)||(process.title=`claude`);let{initSinks:t}=await import(`./sinks-D3bXeHlQ.js`);t(),G(`preAction_after_sinks`);let n=e.getOptionValue(`pluginDir`);Array.isArray(n)&&n.length>0&&n.every(e=>typeof e==`string`)&&(fi(n),Or(`preAction: --plugin-dir inline plugins`)),ld(),G(`preAction_after_migrations`),sc(),Ct(),G(`preAction_after_remote_settings`),G(`preAction_after_settings_sync`)}),t.name(`claude`).description(`Work Mate - starts an interactive session by default, use -p/--print for non-interactive output`).argument(`[prompt]`,`Your prompt`,String).helpOption(`-h, --help`,`Display help for command`).option(`-d, --debug [filter]`,`Enable debug mode with optional category filtering (e.g., "api,hooks" or "!1p,!file")`,e=>!0).addOption(new J(`--debug-to-stderr`,`Enable debug mode (to stderr)`).argParser(Boolean).hideHelp()).option(`--debug-file <path>`,`Write debug logs to a specific file path (implicitly enables debug mode)`,()=>!0).option(`--verbose`,`Override verbose mode setting from config`,()=>!0).option(`-p, --print`,`Print response and exit (useful for pipes). Note: The workspace trust dialog is skipped when Claude is run with the -p mode. Only use this flag in directories you trust.`,()=>!0).option(`--bare`,`Minimal mode: skip hooks, LSP, plugin sync, attribution, auto-memory, background prefetches, keychain reads, and CLAUDE.md auto-discovery. Sets CLAUDE_CODE_SIMPLE=1. Anthropic auth is strictly ANTHROPIC_API_KEY or apiKeyHelper via --settings (OAuth and keychain are never read). 3P providers (Bedrock/Vertex/Foundry) use their own credentials. Skills still resolve via /skill-name. Explicitly provide context via: --system-prompt[-file], --append-system-prompt[-file], --add-dir (CLAUDE.md dirs), --mcp-config, --settings, --agents, --plugin-dir.`,()=>!0).addOption(new J(`--init`,`Run Setup hooks with init trigger, then continue`).hideHelp()).addOption(new J(`--init-only`,`Run Setup and SessionStart:startup hooks, then exit`).hideHelp()).addOption(new J(`--maintenance`,`Run Setup hooks with maintenance trigger, then continue`).hideHelp()).addOption(new J(`--output-format <format>`,`Output format (only works with --print): "text" (default), "json" (single result), or "stream-json" (realtime streaming)`).choices([`text`,`json`,`stream-json`])).addOption(new J(`--json-schema <schema>`,`JSON Schema for structured output validation. Example: {"type":"object","properties":{"name":{"type":"string"}},"required":["name"]}`).argParser(String)).option(`--include-hook-events`,`Include all hook lifecycle events in the output stream (only works with --output-format=stream-json)`,()=>!0).option(`--include-partial-messages`,`Include partial message chunks as they arrive (only works with --print and --output-format=stream-json)`,()=>!0).addOption(new J(`--input-format <format>`,`Input format (only works with --print): "text" (default), or "stream-json" (realtime streaming input)`).choices([`text`,`stream-json`])).option(`--mcp-debug`,`[DEPRECATED. Use --debug instead] Enable MCP debug mode (shows MCP server errors)`,()=>!0).option(`--dangerously-skip-permissions`,`Bypass all permission checks. Recommended only for sandboxes with no internet access.`,()=>!0).option(`--allow-dangerously-skip-permissions`,`Enable bypassing all permission checks as an option, without it being enabled by default. Recommended only for sandboxes with no internet access.`,()=>!0).addOption(new J(`--thinking <mode>`,`Thinking mode: enabled (equivalent to adaptive), disabled`).choices([`enabled`,`adaptive`,`disabled`]).hideHelp()).addOption(new J(`--max-thinking-tokens <tokens>`,`[DEPRECATED. Use --thinking instead for newer models] Maximum number of thinking tokens (only works with --print)`).argParser(Number).hideHelp()).addOption(new J(`--max-turns <turns>`,`Maximum number of agentic turns in non-interactive mode. This will early exit the conversation after the specified number of turns. (only works with --print)`).argParser(Number).hideHelp()).addOption(new J(`--max-budget-usd <amount>`,`Maximum dollar amount to spend on API calls (only works with --print)`).argParser(e=>{let t=Number(e);if(isNaN(t)||t<=0)throw Error(`--max-budget-usd must be a positive number greater than 0`);return t})).addOption(new J(`--task-budget <tokens>`,`API-side task budget in tokens (output_config.task_budget)`).argParser(e=>{let t=Number(e);if(isNaN(t)||t<=0||!Number.isInteger(t))throw Error(`--task-budget must be a positive integer`);return t}).hideHelp()).option(`--replay-user-messages`,`Re-emit user messages from stdin back on stdout for acknowledgment (only works with --input-format=stream-json and --output-format=stream-json)`,()=>!0).addOption(new J(`--enable-auth-status`,`Enable auth status messages in SDK mode`).default(!1).hideHelp()).option(`--allowedTools, --allowed-tools <tools...>`,`Comma or space-separated list of tool names to allow (e.g. "Bash(git:*) Edit")`).option(`--tools <tools...>`,`Specify the list of available tools from the built-in set. Use "" to disable all tools, "default" to use all tools, or specify tool names (e.g. "Bash,Edit,Read").`).option(`--disallowedTools, --disallowed-tools <tools...>`,`Comma or space-separated list of tool names to deny (e.g. "Bash(git:*) Edit")`).option(`--mcp-config <configs...>`,`Load MCP servers from JSON files or strings (space-separated)`).addOption(new J(`--permission-prompt-tool <tool>`,`MCP tool to use for permission prompts (only works with --print)`).argParser(String).hideHelp()).addOption(new J(`--system-prompt <prompt>`,`System prompt to use for the session`).argParser(String)).addOption(new J(`--system-prompt-file <file>`,`Read system prompt from a file`).argParser(String).hideHelp()).addOption(new J(`--append-system-prompt <prompt>`,`Append a system prompt to the default system prompt`).argParser(String)).addOption(new J(`--append-system-prompt-file <file>`,`Read system prompt from a file and append to the default system prompt`).argParser(String).hideHelp()).addOption(new J(`--permission-mode <mode>`,`Permission mode to use for the session`).argParser(String).choices(ka)).option(`-c, --continue`,`Continue the most recent conversation in the current directory`,()=>!0).option(`-r, --resume [value]`,`Resume a conversation by session ID, or open interactive picker with optional search term`,e=>e||!0).option(`--fork-session`,`When resuming, create a new session ID instead of reusing the original (use with --resume or --continue)`,()=>!0).addOption(new J(`--prefill <text>`,`Pre-fill the prompt input with text without submitting it`).hideHelp()).addOption(new J(`--deep-link-origin`,`Signal that this session was launched from a deep link`).hideHelp()).addOption(new J(`--deep-link-repo <slug>`,`Repo slug the deep link ?repo= parameter resolved to the current cwd`).hideHelp()).addOption(new J(`--deep-link-last-fetch <ms>`,`FETCH_HEAD mtime in epoch ms, precomputed by the deep link trampoline`).argParser(e=>{let t=Number(e);return Number.isFinite(t)?t:void 0}).hideHelp()).option(`--from-pr [value]`,`Resume a session linked to a PR by PR number/URL, or open interactive picker with optional search term`,e=>e||!0).option(`--no-session-persistence`,`Disable session persistence - sessions will not be saved to disk and cannot be resumed (only works with --print)`).addOption(new J(`--resume-session-at <message id>`,`When resuming, only messages up to and including the assistant message with <message.id> (use with --resume in print mode)`).argParser(String).hideHelp()).addOption(new J(`--rewind-files <user-message-id>`,`Restore files to state at the specified user message and exit (requires --resume)`).hideHelp()).option(`--model <model>`,`Model for the current session. Provide an alias for the latest model (e.g. 'sonnet' or 'opus') or a model's full name (e.g. 'claude-sonnet-4-6').`).option(`--agent <agent>`,`Agent for the current session. Overrides the 'agent' setting.`).option(`--betas <betas...>`,`Beta headers to include in API requests (API key users only)`).option(`--fallback-model <model>`,`Enable automatic fallback to specified model when default model is overloaded (only works with --print)`).addOption(new J(`--workload <tag>`,`Workload tag for billing-header attribution (cc_workload). Process-scoped; set by SDK daemon callers that spawn subprocesses for cron work. (only works with --print)`).hideHelp()).option(`--settings <file-or-json>`,`Path to a settings JSON file or a JSON string to load additional settings from`).option(`--add-dir <directories...>`,`Additional directories to allow tool access to`).option(`--ide`,`Automatically connect to IDE on startup if exactly one valid IDE is available`,()=>!0).option(`--strict-mcp-config`,`Only use MCP servers from --mcp-config, ignoring all other MCP configurations`,()=>!0).option(`--session-id <uuid>`,`Use a specific session ID for the conversation (must be a valid UUID)`).option(`-n, --name <name>`,`Set a display name for this session (shown in /resume and terminal title)`).option(`--agents <json>`,`JSON object defining custom agents (e.g. '{"reviewer": {"description": "Reviews code", "prompt": "You are a code reviewer"}}')`).option(`--setting-sources <sources>`,`Comma-separated list of setting sources to load (user, project, local).`).option(`--plugin-dir <path>`,`Load plugins from a directory for this session only (repeatable: --plugin-dir A --plugin-dir B)`,(e,t)=>[...t,e],[]).option(`--disable-slash-commands`,`Disable all skills`,()=>!0).option(`--chrome`,`Enable Claude in Chrome integration`).option(`--no-chrome`,`Disable Claude in Chrome integration`).option(`--file <specs...>`,`File resources to download at startup. Format: file_id:relative_path (e.g., --file file_abc:doc.txt file_def:img.png)`).action(async(e,t)=>{G(`action_handler_start`),t.bare&&(process.env.CLAUDE_CODE_SIMPLE=`1`),e===`code`&&(W(`tengu_code_prompt_ignored`,{}),console.warn(M.yellow("Tip: You can launch Work Mate with just `claude`")),e=void 0),e&&typeof e==`string`&&!/\s/.test(e)&&e.length>0&&W(`tengu_single_word_prompt`,{length:e.length});let{debug:n=!1,debugToStderr:r=!1,dangerouslySkipPermissions:i,allowDangerouslySkipPermissions:a=!1,tools:o=[],allowedTools:s=[],disallowedTools:c=[],mcpConfig:l=[],permissionMode:u,addDir:f=[],fallbackModel:m,betas:ee=[],ide:h=!1,sessionId:g,includeHookEvents:te,includePartialMessages:ne}=t;t.prefill&&Oc(t.prefill);let re,ie=t.agents,_=t.agent;_&&(process.env.CLAUDE_CODE_AGENT=_);let v=t.outputFormat,y=t.inputFormat,ae=t.verbose??R().verbose,he=t.print,ge=t.init??!1,we=t.initOnly??!1,Te=t.maintenance??!1,De=t.disableSlashCommands||!1,Oe=nc()?t.worktree:void 0,ke=typeof Oe==`string`?Oe:void 0,je=Oe!==void 0,Ne;if(ke){let e=Mn(ke);e!==null&&(Ne=e,ke=void 0)}let Pe=nc()&&t.tmux===!0;Pe&&(je||(process.stderr.write(M.red(`Error: --tmux requires --worktree
580
- `)),process.exit(1)),ao()===`windows`&&(process.stderr.write(M.red(`Error: --tmux is not supported on Windows
581
- `)),process.exit(1)),await be()||(process.stderr.write(M.red(`Error: tmux is not installed.\n${ue()}\n`)),process.exit(1)));let Fe=t.sdkUrl??void 0,Ie=ne||d(process.env.CLAUDE_CODE_INCLUDE_PARTIAL_MESSAGES);(te||d(process.env.CLAUDE_CODE_REMOTE))&&Vt(!0),Fe&&(y||(y=`stream-json`),v||(v=`stream-json`),t.verbose===void 0&&(ae=!0),t.print||(he=!0));let b=t.teleport??null,Le=t.remote,Re=Le===!0?``:Le??null,ze=t.remoteControl??t.rc,Be=typeof ze==`string`&&ze.length>0?ze:void 0;if(g&&((t.continue||t.resume)&&!t.forkSession&&(process.stderr.write(M.red(`Error: --session-id can only be used with --continue or --resume if --fork-session is also specified.
582
- `)),process.exit(1)),!Fe)){let e=Lt(g);e||(process.stderr.write(M.red(`Error: Invalid session ID. Must be a valid UUID.
583
- `)),process.exit(1)),yr(e)&&(process.stderr.write(M.red(`Error: Session ID ${e} is already in use.\n`)),process.exit(1))}let Ve=t.file;if(Ve&&Ve.length>0){let e=Ms();e||(process.stderr.write(M.red(`Error: Session token required for file downloads. CLAUDE_CODE_SESSION_ACCESS_TOKEN must be set.
584
- `)),process.exit(1));let t=process.env.CLAUDE_CODE_REMOTE_SESSION_ID||Ni(),n=et(Ve);n.length>0&&(re=xe(n,{baseUrl:process.env.ANTHROPIC_BASE_URL||go().BASE_API_URL,oauthToken:e,sessionId:t}))}let x=Ui();m&&t.model&&m===t.model&&(process.stderr.write(M.red(`Error: Fallback model cannot be the same as the main model. Please specify a different model for --fallback-model.
585
- `)),process.exit(1));let He=t.systemPrompt;if(t.systemPromptFile){t.systemPrompt&&(process.stderr.write(M.red(`Error: Cannot use both --system-prompt and --system-prompt-file. Please use only one.
586
- `)),process.exit(1));try{He=Rc(Fc(t.systemPromptFile),`utf8`)}catch(e){Ji(e)===`ENOENT`&&(process.stderr.write(M.red(`Error: System prompt file not found: ${Fc(t.systemPromptFile)}\n`)),process.exit(1)),process.stderr.write(M.red(`Error reading system prompt file: ${P(e)}\n`)),process.exit(1)}}let Ue=t.appendSystemPrompt;if(t.appendSystemPromptFile){t.appendSystemPrompt&&(process.stderr.write(M.red(`Error: Cannot use both --append-system-prompt and --append-system-prompt-file. Please use only one.
587
- `)),process.exit(1));try{Ue=Rc(Fc(t.appendSystemPromptFile),`utf8`)}catch(e){Ji(e)===`ENOENT`&&(process.stderr.write(M.red(`Error: Append system prompt file not found: ${Fc(t.appendSystemPromptFile)}\n`)),process.exit(1)),process.stderr.write(M.red(`Error reading append system prompt file: ${P(e)}\n`)),process.exit(1)}}let{mode:S,notification:Ge}=gr({permissionModeCli:u,dangerouslySkipPermissions:i});wi(S===`bypassPermissions`),(t.enableAutoMode||u===`auto`||S===`auto`||!u&&Ze())&&rd?.setAutoModeFlagCli(!0);let Ke={};if(l&&l.length>0){let e=l.map(e=>e.trim()).filter(e=>e.length>0),t={},n=[];for(let r of e){let e=null,i=[],a=uo(r);if(a){let t=tt({configObject:a,filePath:`command line`,expandVars:!0,scope:`dynamic`});t.config?e=t.config.mcpServers:i=t.errors}else{let t=Ce({filePath:Fc(r),expandVars:!0,scope:`dynamic`});t.config?e=t.config.mcpServers:i=t.errors}i.length>0?n.push(...i):e&&(t={...t,...e})}if(n.length>0){let e=n.map(e=>`${e.path?e.path+`: `:``}${e.message}`).join(`
588
- `);F(`--mcp-config validation failed (${n.length} errors): ${e}`,{level:`error`}),process.stderr.write(`Error: Invalid MCP configuration:\n${e}\n`),process.exit(1)}if(Object.keys(t).length>0){let{allowed:e,blocked:n}=_e(ve(t,e=>({...e,scope:`dynamic`})));n.length>0&&process.stderr.write(`Warning: MCP ${xo(n.length,`server`)} blocked by enterprise policy: ${n.join(`, `)}\n`),Ke={...Ke,...e}}}let Je=t.strictMcpConfig||!1;xt()&&(Je&&(process.stderr.write(M.red(`You cannot use --strict-mcp-config when an enterprise MCP config is present`)),process.exit(1)),Ke&&!oe(Ke)&&(process.stderr.write(M.red(`You cannot dynamically configure MCP servers when an enterprise MCP config is present`)),process.exit(1))),Fi(f);let rt=await bt({allowedToolsCli:s,disallowedToolsCli:c,baseToolsCli:o,permissionMode:S,allowDangerouslySkipPermissions:a,addDirs:f}),it=rt.toolPermissionContext,{warnings:at,dangerousPermissions:ot}=rt;ot.length>0&&(it=We(it)),at.forEach(e=>{console.error(e)});let st=x&&!Je&&!xt()&&!p()?Lr().then(e=>{let{allowed:t,blocked:n}=_e(e);return n.length>0&&process.stderr.write(`Warning: claude.ai MCP ${xo(n.length,`server`)} blocked by enterprise policy: ${n.join(`, `)}\n`),t}):Promise.resolve({});F(`[STARTUP] Loading MCP configs...`);let ct=Date.now(),lt,ut=(Je||p()?Promise.resolve({servers:{}}):Qe(Ke)).then(e=>(lt=Date.now()-ct,e));y&&y!==`text`&&y!==`stream-json`&&(console.error(`Error: Invalid input format "${y}".`),process.exit(1)),y===`stream-json`&&v!==`stream-json`&&(console.error(`Error: --input-format=stream-json requires output-format=stream-json.`),process.exit(1)),Fe&&(y!==`stream-json`||v!==`stream-json`)&&(console.error(`Error: --sdk-url requires both --input-format=stream-json and --output-format=stream-json.`),process.exit(1)),t.replayUserMessages&&(y!==`stream-json`||v!==`stream-json`)&&(console.error(`Error: --replay-user-messages requires both --input-format=stream-json and --output-format=stream-json.`),process.exit(1)),Ie&&(!x||v!==`stream-json`)&&(Ua(`Error: --include-partial-messages requires --print and --output-format=stream-json.`),process.exit(1)),t.sessionPersistence===!1&&!x&&(Ua(`Error: --no-session-persistence can only be used with --print mode.`),process.exit(1));let C=await _d(e||``,y??`text`);G(`action_after_input_prompt`),bd(t);let ft=dn(it);G(`action_tools_loaded`);let pt;if(xs({isNonInteractiveSession:x})&&t.jsonSchema&&(pt=Ki(t.jsonSchema)),pt){let e=vs(pt);`tool`in e?(ft=[...ft,e.tool],W(`tengu_structured_output_enabled`,{schema_property_count:Object.keys(pt.properties||{}).length,has_required_fields:!!pt.required})):W(`tengu_structured_output_failure`,{error:`Invalid JSON schema`})}G(`action_before_setup`),F(`[STARTUP] Running setup()...`);let mt=Date.now(),{setup:gt}=await import(`./setup-uZ0dSekt.js`),vt=Gi();process.env.CLAUDE_CODE_ENTRYPOINT!==`local-agent`&&zu();let St=gt(vt,S,a,je,ke,Pe,g?Lt(g):void 0,Ne,void 0),Ct=je?null:At(vt),wt=je?null:Tn(vt);Ct?.catch(()=>{}),wt?.catch(()=>{}),await St,F(`[STARTUP] setup() completed in ${Date.now()-mt}ms`),G(`action_after_setup`);let Tt=!!t.replayUserMessages;Ui()&&(vc(),pe(),wr(),ko());let Et=t.name?.trim();Et&&Bt(Et);let Dt=t.model==="default"?es():t.model,kt=m==="default"?es():m,jt=je?Gi():vt;F(`[STARTUP] Loading commands and agents...`);let Mt=Date.now(),[Nt,Pt]=await Promise.all([Ct??At(jt),wt??Tn(jt)]);F(`[STARTUP] Commands and agents loaded in ${Date.now()-Mt}ms`),G(`action_commands_loaded`);let Ft=[];if(ie)try{let e=uo(ie);e&&(Ft=pn(e,`flagSettings`))}catch(e){H(e)}let It=[...Pt.allAgents,...Ft],Rt={...Pt,allAgents:It,activeAgents:$n(It)},zt=_??Ta().agent,w;if(zt&&(w=Rt.activeAgents.find(e=>e.agentType===zt),w||F(`Warning: agent "${zt}" not found. Available agents: ${Rt.activeAgents.map(e=>e.agentType).join(`, `)}. Using default behavior.`)),mi(w?.agentType),w&&W(`tengu_agent_flag`,{agentType:nr(w)?w.agentType:`custom`,..._&&{source:`cli`}}),w?.agentType&&Sn(w.agentType),x&&w&&!He&&!nr(w)){let e=w.getSystemPrompt();e&&(He=e)}w?.initialPrompt&&(typeof C==`string`?C=C?`${w.initialPrompt}\n\n${C}`:w.initialPrompt:C||(C=w.initialPrompt));let T=Dt;!T&&w?.model&&w.model!==`inherit`&&(T=To(w.model)),yi(T),bi(Jo()||null);let Ht=pi(),Ut=To(Ht??es()),Gt;if(fe()){let e=Ir()?t.advisor:void 0;e&&(F(`[AdvisorTool] --advisor ${e}`),Ot(Ut)||(process.stderr.write(M.red(`Error: The model "${Ut}" does not support the advisor tool.\n`)),process.exit(1)),Cr(Po(To(e)))||(process.stderr.write(M.red(`Error: The model "${e}" cannot be used as an advisor.\n`)),process.exit(1))),Gt=Ir()?e??tn():e,Gt&&F(`[AdvisorTool] Advisor model: ${Gt}`)}if(t.proactive||d(process.env.CLAUDE_CODE_PROACTIVE)){let e=`
579
+ `)}return e}async function vd(){K(`run_function_start`);function e(){let e=e=>e.long?.replace(/^--/,``)??e.short?.replace(/^-/,``)??``;return Object.assign({sortSubcommands:!0,sortOptions:!0},{compareOptions:(t,n)=>e(t).localeCompare(e(n))})}let t=new nl().configureHelp(e()).enablePositionalOptions();K(`run_commander_initialized`),t.hook(`preAction`,async e=>{K(`preAction_start`),await Promise.all([ha(),us()]),K(`preAction_after_mdm`),await dl(),K(`preAction_after_init`),d(process.env.CLAUDE_CODE_DISABLE_TERMINAL_TITLE)||(process.title=`claude`);let{initSinks:t}=await import(`./sinks-BJHgxz6Y.js`);t(),K(`preAction_after_sinks`);let n=e.getOptionValue(`pluginDir`);Array.isArray(n)&&n.length>0&&n.every(e=>typeof e==`string`)&&(Vi(n),Nn(`preAction: --plugin-dir inline plugins`)),ld(),K(`preAction_after_migrations`),oc(),dn(),K(`preAction_after_remote_settings`),K(`preAction_after_settings_sync`)}),t.name(`claude`).description(`Work Mate - starts an interactive session by default, use -p/--print for non-interactive output`).argument(`[prompt]`,`Your prompt`,String).helpOption(`-h, --help`,`Display help for command`).option(`-d, --debug [filter]`,`Enable debug mode with optional category filtering (e.g., "api,hooks" or "!1p,!file")`,e=>!0).addOption(new J(`--debug-to-stderr`,`Enable debug mode (to stderr)`).argParser(Boolean).hideHelp()).option(`--debug-file <path>`,`Write debug logs to a specific file path (implicitly enables debug mode)`,()=>!0).option(`--verbose`,`Override verbose mode setting from config`,()=>!0).option(`-p, --print`,`Print response and exit (useful for pipes). Note: The workspace trust dialog is skipped when Claude is run with the -p mode. Only use this flag in directories you trust.`,()=>!0).option(`--bare`,`Minimal mode: skip hooks, LSP, plugin sync, attribution, auto-memory, background prefetches, keychain reads, and CLAUDE.md auto-discovery. Sets CLAUDE_CODE_SIMPLE=1. Anthropic auth is strictly ANTHROPIC_API_KEY or apiKeyHelper via --settings (OAuth and keychain are never read). 3P providers (Bedrock/Vertex/Foundry) use their own credentials. Skills still resolve via /skill-name. Explicitly provide context via: --system-prompt[-file], --append-system-prompt[-file], --add-dir (CLAUDE.md dirs), --mcp-config, --settings, --agents, --plugin-dir.`,()=>!0).addOption(new J(`--init`,`Run Setup hooks with init trigger, then continue`).hideHelp()).addOption(new J(`--init-only`,`Run Setup and SessionStart:startup hooks, then exit`).hideHelp()).addOption(new J(`--maintenance`,`Run Setup hooks with maintenance trigger, then continue`).hideHelp()).addOption(new J(`--output-format <format>`,`Output format (only works with --print): "text" (default), "json" (single result), or "stream-json" (realtime streaming)`).choices([`text`,`json`,`stream-json`])).addOption(new J(`--json-schema <schema>`,`JSON Schema for structured output validation. Example: {"type":"object","properties":{"name":{"type":"string"}},"required":["name"]}`).argParser(String)).option(`--include-hook-events`,`Include all hook lifecycle events in the output stream (only works with --output-format=stream-json)`,()=>!0).option(`--include-partial-messages`,`Include partial message chunks as they arrive (only works with --print and --output-format=stream-json)`,()=>!0).addOption(new J(`--input-format <format>`,`Input format (only works with --print): "text" (default), or "stream-json" (realtime streaming input)`).choices([`text`,`stream-json`])).option(`--mcp-debug`,`[DEPRECATED. Use --debug instead] Enable MCP debug mode (shows MCP server errors)`,()=>!0).option(`--dangerously-skip-permissions`,`Bypass all permission checks. Recommended only for sandboxes with no internet access.`,()=>!0).option(`--allow-dangerously-skip-permissions`,`Enable bypassing all permission checks as an option, without it being enabled by default. Recommended only for sandboxes with no internet access.`,()=>!0).addOption(new J(`--thinking <mode>`,`Thinking mode: enabled (equivalent to adaptive), disabled`).choices([`enabled`,`adaptive`,`disabled`]).hideHelp()).addOption(new J(`--max-thinking-tokens <tokens>`,`[DEPRECATED. Use --thinking instead for newer models] Maximum number of thinking tokens (only works with --print)`).argParser(Number).hideHelp()).addOption(new J(`--max-turns <turns>`,`Maximum number of agentic turns in non-interactive mode. This will early exit the conversation after the specified number of turns. (only works with --print)`).argParser(Number).hideHelp()).addOption(new J(`--max-budget-usd <amount>`,`Maximum dollar amount to spend on API calls (only works with --print)`).argParser(e=>{let t=Number(e);if(isNaN(t)||t<=0)throw Error(`--max-budget-usd must be a positive number greater than 0`);return t})).addOption(new J(`--task-budget <tokens>`,`API-side task budget in tokens (output_config.task_budget)`).argParser(e=>{let t=Number(e);if(isNaN(t)||t<=0||!Number.isInteger(t))throw Error(`--task-budget must be a positive integer`);return t}).hideHelp()).option(`--replay-user-messages`,`Re-emit user messages from stdin back on stdout for acknowledgment (only works with --input-format=stream-json and --output-format=stream-json)`,()=>!0).addOption(new J(`--enable-auth-status`,`Enable auth status messages in SDK mode`).default(!1).hideHelp()).option(`--allowedTools, --allowed-tools <tools...>`,`Comma or space-separated list of tool names to allow (e.g. "Bash(git:*) Edit")`).option(`--tools <tools...>`,`Specify the list of available tools from the built-in set. Use "" to disable all tools, "default" to use all tools, or specify tool names (e.g. "Bash,Edit,Read").`).option(`--disallowedTools, --disallowed-tools <tools...>`,`Comma or space-separated list of tool names to deny (e.g. "Bash(git:*) Edit")`).option(`--mcp-config <configs...>`,`Load MCP servers from JSON files or strings (space-separated)`).addOption(new J(`--permission-prompt-tool <tool>`,`MCP tool to use for permission prompts (only works with --print)`).argParser(String).hideHelp()).addOption(new J(`--system-prompt <prompt>`,`System prompt to use for the session`).argParser(String)).addOption(new J(`--system-prompt-file <file>`,`Read system prompt from a file`).argParser(String).hideHelp()).addOption(new J(`--append-system-prompt <prompt>`,`Append a system prompt to the default system prompt`).argParser(String)).addOption(new J(`--append-system-prompt-file <file>`,`Read system prompt from a file and append to the default system prompt`).argParser(String).hideHelp()).addOption(new J(`--permission-mode <mode>`,`Permission mode to use for the session`).argParser(String).choices(Oa)).option(`-c, --continue`,`Continue the most recent conversation in the current directory`,()=>!0).option(`-r, --resume [value]`,`Resume a conversation by session ID, or open interactive picker with optional search term`,e=>e||!0).option(`--fork-session`,`When resuming, create a new session ID instead of reusing the original (use with --resume or --continue)`,()=>!0).addOption(new J(`--prefill <text>`,`Pre-fill the prompt input with text without submitting it`).hideHelp()).addOption(new J(`--deep-link-origin`,`Signal that this session was launched from a deep link`).hideHelp()).addOption(new J(`--deep-link-repo <slug>`,`Repo slug the deep link ?repo= parameter resolved to the current cwd`).hideHelp()).addOption(new J(`--deep-link-last-fetch <ms>`,`FETCH_HEAD mtime in epoch ms, precomputed by the deep link trampoline`).argParser(e=>{let t=Number(e);return Number.isFinite(t)?t:void 0}).hideHelp()).option(`--from-pr [value]`,`Resume a session linked to a PR by PR number/URL, or open interactive picker with optional search term`,e=>e||!0).option(`--no-session-persistence`,`Disable session persistence - sessions will not be saved to disk and cannot be resumed (only works with --print)`).addOption(new J(`--resume-session-at <message id>`,`When resuming, only messages up to and including the assistant message with <message.id> (use with --resume in print mode)`).argParser(String).hideHelp()).addOption(new J(`--rewind-files <user-message-id>`,`Restore files to state at the specified user message and exit (requires --resume)`).hideHelp()).option(`--model <model>`,`Model for the current session. Provide an alias for the latest model (e.g. 'sonnet' or 'opus') or a model's full name (e.g. 'claude-sonnet-4-6').`).option(`--agent <agent>`,`Agent for the current session. Overrides the 'agent' setting.`).option(`--betas <betas...>`,`Beta headers to include in API requests (API key users only)`).option(`--fallback-model <model>`,`Enable automatic fallback to specified model when default model is overloaded (only works with --print)`).addOption(new J(`--workload <tag>`,`Workload tag for billing-header attribution (cc_workload). Process-scoped; set by SDK daemon callers that spawn subprocesses for cron work. (only works with --print)`).hideHelp()).option(`--settings <file-or-json>`,`Path to a settings JSON file or a JSON string to load additional settings from`).option(`--add-dir <directories...>`,`Additional directories to allow tool access to`).option(`--ide`,`Automatically connect to IDE on startup if exactly one valid IDE is available`,()=>!0).option(`--strict-mcp-config`,`Only use MCP servers from --mcp-config, ignoring all other MCP configurations`,()=>!0).option(`--session-id <uuid>`,`Use a specific session ID for the conversation (must be a valid UUID)`).option(`-n, --name <name>`,`Set a display name for this session (shown in /resume and terminal title)`).option(`--agents <json>`,`JSON object defining custom agents (e.g. '{"reviewer": {"description": "Reviews code", "prompt": "You are a code reviewer"}}')`).option(`--setting-sources <sources>`,`Comma-separated list of setting sources to load (user, project, local).`).option(`--plugin-dir <path>`,`Load plugins from a directory for this session only (repeatable: --plugin-dir A --plugin-dir B)`,(e,t)=>[...t,e],[]).option(`--disable-slash-commands`,`Disable all skills`,()=>!0).option(`--chrome`,`Enable Claude in Chrome integration`).option(`--no-chrome`,`Disable Claude in Chrome integration`).option(`--file <specs...>`,`File resources to download at startup. Format: file_id:relative_path (e.g., --file file_abc:doc.txt file_def:img.png)`).action(async(e,t)=>{K(`action_handler_start`),t.bare&&(process.env.CLAUDE_CODE_SIMPLE=`1`),e===`code`&&(G(`tengu_code_prompt_ignored`,{}),console.warn(N.yellow("Tip: You can launch Work Mate with just `claude`")),e=void 0),e&&typeof e==`string`&&!/\s/.test(e)&&e.length>0&&G(`tengu_single_word_prompt`,{length:e.length});let{debug:n=!1,debugToStderr:r=!1,dangerouslySkipPermissions:i,allowDangerouslySkipPermissions:a=!1,tools:o=[],allowedTools:s=[],disallowedTools:c=[],mcpConfig:l=[],permissionMode:u,addDir:f=[],fallbackModel:m,betas:ee=[],ide:h=!1,sessionId:g,includeHookEvents:te,includePartialMessages:ne}=t;t.prefill&&Oc(t.prefill);let ie,ae=t.agents,oe=t.agent;oe&&(process.env.CLAUDE_CODE_AGENT=oe);let _=t.outputFormat,v=t.inputFormat,ce=t.verbose??z().verbose,le=t.print,ue=t.init??!1,de=t.initOnly??!1,fe=t.maintenance??!1,pe=t.disableSlashCommands||!1,me=nc()?t.worktree:void 0,he=typeof me==`string`?me:void 0,_e=me!==void 0,ve;if(he){let e=On(he);e!==null&&(ve=e,he=void 0)}let be=nc()&&t.tmux===!0;be&&(_e||(process.stderr.write(N.red(`Error: --tmux requires --worktree
580
+ `)),process.exit(1)),io()===`windows`&&(process.stderr.write(N.red(`Error: --tmux is not supported on Windows
581
+ `)),process.exit(1)),await Ce()||(process.stderr.write(N.red(`Error: tmux is not installed.\n${ge()}\n`)),process.exit(1)));let xe=t.sdkUrl??void 0,Se=ne||d(process.env.CLAUDE_CODE_INCLUDE_PARTIAL_MESSAGES);(te||d(process.env.CLAUDE_CODE_REMOTE))&&se(!0),xe&&(v||(v=`stream-json`),_||(_=`stream-json`),t.verbose===void 0&&(ce=!0),t.print||(le=!0));let y=t.teleport??null,De=t.remote,Oe=De===!0?``:De??null,ke=t.remoteControl??t.rc,je=typeof ke==`string`&&ke.length>0?ke:void 0;if(g&&((t.continue||t.resume)&&!t.forkSession&&(process.stderr.write(N.red(`Error: --session-id can only be used with --continue or --resume if --fork-session is also specified.
582
+ `)),process.exit(1)),!xe)){let e=Mn(g);e||(process.stderr.write(N.red(`Error: Invalid session ID. Must be a valid UUID.
583
+ `)),process.exit(1)),fn(e)&&(process.stderr.write(N.red(`Error: Session ID ${e} is already in use.\n`)),process.exit(1))}let Me=t.file;if(Me&&Me.length>0){let e=js();e||(process.stderr.write(N.red(`Error: Session token required for file downloads. CLAUDE_CODE_SESSION_ACCESS_TOKEN must be set.
584
+ `)),process.exit(1));let t=process.env.CLAUDE_CODE_REMOTE_SESSION_ID||Bi(),n=we(Me);n.length>0&&(ie=Er(n,{baseUrl:process.env.ANTHROPIC_BASE_URL||ho().BASE_API_URL,oauthToken:e,sessionId:t}))}let b=Hi();m&&t.model&&m===t.model&&(process.stderr.write(N.red(`Error: Fallback model cannot be the same as the main model. Please specify a different model for --fallback-model.
585
+ `)),process.exit(1));let Pe=t.systemPrompt;if(t.systemPromptFile){t.systemPrompt&&(process.stderr.write(N.red(`Error: Cannot use both --system-prompt and --system-prompt-file. Please use only one.
586
+ `)),process.exit(1));try{Pe=Rc(Fc(t.systemPromptFile),`utf8`)}catch(e){qi(e)===`ENOENT`&&(process.stderr.write(N.red(`Error: System prompt file not found: ${Fc(t.systemPromptFile)}\n`)),process.exit(1)),process.stderr.write(N.red(`Error reading system prompt file: ${F(e)}\n`)),process.exit(1)}}let Ie=t.appendSystemPrompt;if(t.appendSystemPromptFile){t.appendSystemPrompt&&(process.stderr.write(N.red(`Error: Cannot use both --append-system-prompt and --append-system-prompt-file. Please use only one.
587
+ `)),process.exit(1));try{Ie=Rc(Fc(t.appendSystemPromptFile),`utf8`)}catch(e){qi(e)===`ENOENT`&&(process.stderr.write(N.red(`Error: Append system prompt file not found: ${Fc(t.appendSystemPromptFile)}\n`)),process.exit(1)),process.stderr.write(N.red(`Error reading append system prompt file: ${F(e)}\n`)),process.exit(1)}}let{mode:x,notification:Le}=Sr({permissionModeCli:u,dangerouslySkipPermissions:i});Ci(x===`bypassPermissions`),(t.enableAutoMode||u===`auto`||x===`auto`||!u&&et())&&rd?.setAutoModeFlagCli(!0);let Re={};if(l&&l.length>0){let e=l.map(e=>e.trim()).filter(e=>e.length>0),t={},n=[];for(let r of e){let e=null,i=[],a=lo(r);if(a){let t=un({configObject:a,filePath:`command line`,expandVars:!0,scope:`dynamic`});t.config?e=t.config.mcpServers:i=t.errors}else{let t=Lt({filePath:Fc(r),expandVars:!0,scope:`dynamic`});t.config?e=t.config.mcpServers:i=t.errors}i.length>0?n.push(...i):e&&(t={...t,...e})}if(n.length>0){let e=n.map(e=>`${e.path?e.path+`: `:``}${e.message}`).join(`
588
+ `);I(`--mcp-config validation failed (${n.length} errors): ${e}`,{level:`error`}),process.stderr.write(`Error: Invalid MCP configuration:\n${e}\n`),process.exit(1)}if(Object.keys(t).length>0){let{allowed:e,blocked:n}=Yt(Ln(t,e=>({...e,scope:`dynamic`})));n.length>0&&process.stderr.write(`Warning: MCP ${bo(n.length,`server`)} blocked by enterprise policy: ${n.join(`, `)}\n`),Re={...Re,...e}}}let S=t.strictMcpConfig||!1;sr()&&(S&&(process.stderr.write(N.red(`You cannot use --strict-mcp-config when an enterprise MCP config is present`)),process.exit(1)),Re&&!Bt(Re)&&(process.stderr.write(N.red(`You cannot dynamically configure MCP servers when an enterprise MCP config is present`)),process.exit(1))),Fi(f);let C=await gt({allowedToolsCli:s,disallowedToolsCli:c,baseToolsCli:o,permissionMode:x,allowDangerouslySkipPermissions:a,addDirs:f}),ze=C.toolPermissionContext,{warnings:Be,dangerousPermissions:He}=C;He.length>0&&(ze=qe(ze)),Be.forEach(e=>{console.error(e)});let Ue=b&&!S&&!sr()&&!p()?Or().then(e=>{let{allowed:t,blocked:n}=Yt(e);return n.length>0&&process.stderr.write(`Warning: claude.ai MCP ${bo(n.length,`server`)} blocked by enterprise policy: ${n.join(`, `)}\n`),t}):Promise.resolve({});I(`[STARTUP] Loading MCP configs...`);let We=Date.now(),Ge,Ke=(S||p()?Promise.resolve({servers:{}}):mr(Re)).then(e=>(Ge=Date.now()-We,e));v&&v!==`text`&&v!==`stream-json`&&(console.error(`Error: Invalid input format "${v}".`),process.exit(1)),v===`stream-json`&&_!==`stream-json`&&(console.error(`Error: --input-format=stream-json requires output-format=stream-json.`),process.exit(1)),xe&&(v!==`stream-json`||_!==`stream-json`)&&(console.error(`Error: --sdk-url requires both --input-format=stream-json and --output-format=stream-json.`),process.exit(1)),t.replayUserMessages&&(v!==`stream-json`||_!==`stream-json`)&&(console.error(`Error: --replay-user-messages requires both --input-format=stream-json and --output-format=stream-json.`),process.exit(1)),Se&&(!b||_!==`stream-json`)&&(Ha(`Error: --include-partial-messages requires --print and --output-format=stream-json.`),process.exit(1)),t.sessionPersistence===!1&&!b&&(Ha(`Error: --no-session-persistence can only be used with --print mode.`),process.exit(1));let w=await _d(e||``,v??`text`);K(`action_after_input_prompt`),bd(t);let Je=Vn(ze);K(`action_tools_loaded`);let T;if(xs({isNonInteractiveSession:b})&&t.jsonSchema&&(T=Gi(t.jsonSchema)),T){let e=_s(T);`tool`in e?(Je=[...Je,e.tool],G(`tengu_structured_output_enabled`,{schema_property_count:Object.keys(T.properties||{}).length,has_required_fields:!!T.required})):G(`tengu_structured_output_failure`,{error:`Invalid JSON schema`})}K(`action_before_setup`),I(`[STARTUP] Running setup()...`);let Ye=Date.now(),{setup:Ze}=await import(`./setup-BEsBuzsk.js`),$e=Wi();process.env.CLAUDE_CODE_ENTRYPOINT!==`local-agent`&&zu();let tt=Ze($e,x,a,_e,he,be,g?Mn(g):void 0,ve,void 0),nt=_e?null:Ae($e),it=_e?null:xn($e);nt?.catch(()=>{}),it?.catch(()=>{}),await tt,I(`[STARTUP] setup() completed in ${Date.now()-Ye}ms`),K(`action_after_setup`);let ot=!!t.replayUserMessages;Hi()&&(vc(),jr(),ht(),Oo());let st=t.name?.trim();st&&Et(st);let ct=t.model==="default"?$o():t.model,lt=m==="default"?$o():m,dt=_e?Wi():$e;I(`[STARTUP] Loading commands and agents...`);let pt=Date.now(),[E,mt]=await Promise.all([nt??Ae(dt),it??xn(dt)]);I(`[STARTUP] Commands and agents loaded in ${Date.now()-pt}ms`),K(`action_commands_loaded`);let bt=[];if(ae)try{let e=lo(ae);e&&(bt=an(e,`flagSettings`))}catch(e){U(e)}let xt=[...mt.allAgents,...bt],St={...mt,allAgents:xt,activeAgents:er(xt)},Tt=oe??wa().agent,D;if(Tt&&(D=St.activeAgents.find(e=>e.agentType===Tt),D||I(`Warning: agent "${Tt}" not found. Available agents: ${St.activeAgents.map(e=>e.agentType).join(`, `)}. Using default behavior.`)),vi(D?.agentType),D&&G(`tengu_agent_flag`,{agentType:or(D)?D.agentType:`custom`,...oe&&{source:`cli`}}),D?.agentType&&lr(D.agentType),b&&D&&!Pe&&!or(D)){let e=D.getSystemPrompt();e&&(Pe=e)}D?.initialPrompt&&(typeof w==`string`?w=w?`${D.initialPrompt}\n\n${w}`:D.initialPrompt:w||(w=D.initialPrompt));let Dt=ct;!Dt&&D?.model&&D.model!==`inherit`&&(Dt=wo(D.model)),_i(Dt),Ei(qo()||null);let kt=pi(),At=wo(kt??$o()),jt;if(rt()){let e=re()?t.advisor:void 0;e&&(I(`[AdvisorTool] --advisor ${e}`),Fe(At)||(process.stderr.write(N.red(`Error: The model "${At}" does not support the advisor tool.\n`)),process.exit(1)),Ee(No(wo(e)))||(process.stderr.write(N.red(`Error: The model "${e}" cannot be used as an advisor.\n`)),process.exit(1))),jt=re()?e??Tn():e,jt&&I(`[AdvisorTool] Advisor model: ${jt}`)}if(t.proactive||d(process.env.CLAUDE_CODE_PROACTIVE)){let e=`
589
589
  # Proactive Mode
590
590
 
591
591
  You are in proactive mode. Take initiative — explore, act, and make progress without waiting for instructions.
592
592
 
593
593
  Start by briefly greeting the user.
594
594
 
595
- You will receive periodic <tick> prompts. These are check-ins. Do whatever seems most useful, or call Sleep if there's nothing to do. The user will see any text you output.`;Ue=Ue?`${Ue}\n\n${e}`:e}let E,D,O;if(!x){let t=Ll(!1);D=t.getFpsMetrics,O=t.stats;let{createRoot:n}=await import(`./src-r6ZFgWPx2.js`);E=await n(t.renderOptions),W(`tengu_timer`,{event:`startup`,durationMs:Math.round(process.uptime()*1e3)}),F(`[STARTUP] Running showSetupScreens()...`);let r=Date.now(),i=await Il(E,S,a,Nt);F(`[STARTUP] showSetupScreens() completed in ${Date.now()-r}ms`),i&&e?.trim().toLowerCase()===`/login`&&(e=``),i&&(oc(),ye(),Zs(),import(`./trustedDevice-CupLMpO8.js`).then(e=>(e.clearTrustedDeviceToken(),e.enrollTrustedDevice())));let o=await ts();o.valid||await X(E,o.message)}if(process.exitCode!==void 0){F(`Graceful shutdown initiated, skipping further initialization`);return}if(qe(),!x){let{errors:e}=Da(),t=e.filter(e=>!e.mcpErrorMetadata);t.length>0&&await Rl(E,{settingsErrors:t,onExit:()=>un(1)})}let qt=R().startupPrefetchedAt??0;p()?(F(`Skipping startup prefetches, last ran ${Math.round((Date.now()-qt)/1e3)}s ago`),os()):(F(`Starting background startup prefetches${qt>0?` last ran ${Math.round((Date.now()-qt)/1e3)}s ago`:``}`),Jn().catch(e=>H(e)),vl(),Qo()),x||Ac();let{servers:Jt}=await ut;F(`[STARTUP] MCP configs resolved in ${lt}ms (awaited at +${Date.now()-ct}ms)`);let Xt={...Jt,...Ke},en={},nn={};for(let[e,t]of Object.entries(Xt)){let n=t;n.type===`sdk`?en[e]=n:nn[e]=n}G(`action_mcp_configs_loaded`);let rn=x?Promise.resolve({clients:[],tools:[],commands:[]}):ht(nn),ln=x?Promise.resolve({clients:[],tools:[],commands:[]}):st.then(e=>Object.keys(e).length>0?ht(e):{clients:[],tools:[],commands:[]}),fn=Promise.all([rn,ln]).then(([e,t])=>({clients:[...e.clients,...t.clients],tools:Zt([...e.tools,...t.tools],`name`),commands:Zt([...e.commands,...t.commands],`name`)})),mn=we||ge||Te||x||t.continue||t.resume?null:an(`startup`,{agentType:w?.agentType,model:Ut}),hn=[];fn.catch(()=>{});let gn=[],_n=[],vn=[],yn=dt(),k=yn===!1?{type:`disabled`}:{type:`adaptive`};if(t.thinking===`adaptive`||t.thinking===`enabled`)yn=!0,k={type:`adaptive`};else if(t.thinking===`disabled`)yn=!1,k={type:`disabled`};else{let e=process.env.MAX_THINKING_TOKENS?parseInt(process.env.MAX_THINKING_TOKENS,10):t.maxThinkingTokens;e!==void 0&&(e>0?(yn=!0,k={type:`enabled`,budgetTokens:e}):e===0&&(yn=!1,k={type:`disabled`}))}V(`info`,`started`,{version:`0.0.9`,is_native_binary:yo()}),sa(async()=>{V(`info`,`exited`)}),yd({hasInitialPrompt:!!e,hasStdin:!!C,verbose:ae,debug:n,debugToStderr:r,print:he??!1,outputFormat:v??`text`,inputFormat:y??`text`,numAllowedTools:s.length,numDisallowedTools:c.length,mcpClientCount:Object.keys(Xt).length,worktreeEnabled:je,skipWebFetchPreflight:Ta().skipWebFetchPreflight,githubActionInputs:process.env.GITHUB_ACTION_INPUTS,dangerouslySkipPermissionsPassed:i??!1,permissionMode:S,modeIsBypass:S===`bypassPermissions`,allowDangerouslySkipPermissionsPassed:a,systemPromptFlag:He?t.systemPromptFile?`file`:`flag`:void 0,appendSystemPromptFlag:Ue?t.appendSystemPromptFile?`file`:`flag`:void 0,thinkingConfig:k,assistantActivationPath:void 0}),Yt(nn,it),id(),On().then(e=>{e&&(Et&&nt(Et),$e().then(e=>{e>=2&&W(`tengu_concurrent_sessions`,{num_sessions:e})}))}),p()||(x?(await zr(),G(`action_after_plugins_init`),$t().then(()=>le())):zr().then(async()=>{G(`action_after_plugins_init`),await $t(),le()}));let bn=we||ge?`init`:Te?`maintenance`:null;if(we){vc(),await Fn(`init`,{forceSyncExecution:!0}),await an(`startup`,{forceSyncExecution:!0}),un(0);return}if(x){(v===`stream-json`||v===`json`)&&ca(!0),vc(),fl();let e=t.continue||t.resume||b||bn?void 0:an(`startup`);e?.catch(()=>{}),G(`before_validateForceLoginOrg`);let n=await ts();n.valid||(process.stderr.write(n.message+`
596
- `),process.exit(1));let r=De?[]:Nt.filter(e=>e.type===`prompt`&&!e.disableNonInteractive||e.type===`local`&&e.supportsNonInteractive),i=cn(),a=Ee({...i,mcp:{...i.mcp,clients:gn,commands:vn,tools:_n},toolPermissionContext:it,...is()&&{fastMode:zo(T??null)},...fe()&&Gt&&{advisorModel:Gt}},yc);Se(it,a.getState().fastMode).then(({updateContext:e})=>{a.setState(t=>{let n=e(t.toolPermissionContext);return n===t.toolPermissionContext?t:{...t,toolPermissionContext:n}})}),t.sessionPersistence===!1&&di(!0),Si(Eo(ee));let o=(e,t)=>Object.keys(e).length===0?Promise.resolve():(a.setState(t=>({...t,mcp:{...t.mcp,clients:[...t.mcp.clients,...Object.entries(e).map(([e,t])=>({name:e,type:`pending`,config:t}))]}})),Qt(({client:e,tools:t,commands:n})=>{a.setState(r=>({...r,mcp:{...r.mcp,clients:r.mcp.clients.some(t=>t.name===e.name)?r.mcp.clients.map(t=>t.name===e.name?e:t):[...r.mcp.clients,e],tools:Zt([...r.mcp.tools,...t],`name`),commands:Zt([...r.mcp.commands,...n],`name`)}}))},e).catch(e=>F(`[MCP] ${t} connect error: ${e}`)));G(`before_connectMcp`),await o(nn,`regular`),G(`after_connectMcp`);let c=5e3,l=st.then(e=>{if(Object.keys(e).length>0){let t=new Set;for(let n of Object.values(e)){let e=Dn(n);e&&t.add(e)}let n=new Set;for(let[e,r]of Object.entries(nn)){if(!e.startsWith(`plugin:`))continue;let i=Dn(r);i&&t.has(i)&&n.add(e)}if(n.size>0){F(`[MCP] Lazy dedup: suppressing ${n.size} plugin server(s) that duplicate claude.ai connectors: ${[...n].join(`, `)}`);for(let e of a.getState().mcp.clients)!n.has(e.name)||e.type!==`connected`||(e.client.onclose=void 0,In(e.name,e.config).catch(()=>{}));a.setState(e=>{let{clients:t,tools:r,commands:i,resources:a}=e.mcp;t=t.filter(e=>!n.has(e.name)),r=r.filter(e=>!e.mcpInfo||!n.has(e.mcpInfo.serverName));for(let e of n)i=lr(i,e),a=on(a,e);return{...e,mcp:{...e.mcp,clients:t,tools:r,commands:i,resources:a}}})}}let{servers:t}=_r(e,Ma(nn,(e,t)=>!t.startsWith(`plugin:`)));return o(t,`claudeai`)}),u,d=await Promise.race([l.then(()=>!1),new Promise(e=>{u=setTimeout(e=>e(!0),c,e)})]);u&&clearTimeout(u),d&&F(`[MCP] claude.ai connectors not ready after ${c}ms — proceeding; background connection continues`),G(`after_connectMcp_claudeai`),p()||(dd(),import(`./backgroundHousekeeping-CcbHitKC.js`).then(e=>e.startBackgroundHousekeeping())),ad(),G(`before_print_import`);let{runHeadless:f}=await import(`./print-CAUvczBM.js`);G(`after_print_import`),f(C,()=>a.getState(),a.setState,r,ft,en,Rt.activeAgents,{continue:t.continue,resume:t.resume,verbose:ae,outputFormat:v,jsonSchema:pt,permissionPromptToolName:t.permissionPromptTool,allowedTools:s,thinkingConfig:k,maxTurns:t.maxTurns,maxBudgetUsd:t.maxBudgetUsd,taskBudget:t.taskBudget?{total:t.taskBudget}:void 0,systemPrompt:He,appendSystemPrompt:Ue,userSpecifiedModel:T,fallbackModel:kt,teleport:b,sdkUrl:Fe,replayUserMessages:Tt,includePartialMessages:Ie,forkSession:t.forkSession||!1,resumeSessionAt:t.resumeSessionAt||void 0,rewindFiles:t.rewindFiles,enableAuthStatus:t.enableAuthStatus,agent:_,workload:t.workload,setupTrigger:bn??void 0,sessionStartHooksPromise:e});return}W(`tengu_startup_manual_model_config`,{cli_flag:t.model,env_var:process.env.ANTHROPIC_MODEL,settings_file:(Ta()||{}).model,subscriptionType:Oo(),agent:zt});let xn=Mc(Ut),Cn=[];Ge&&Cn.push({key:`permission-mode-notification`,text:Ge,priority:`high`}),xn&&Cn.push({key:`model-deprecation-warning`,text:xn,color:`warning`,priority:`high`});let wn={...it},En=Ra()||!1,A={settings:Ta(),tasks:{},agentNameRegistry:new Map,verbose:ae??R().verbose??!1,mainLoopModel:Ht,mainLoopModelForSession:null,isBriefOnly:!1,expandedView:R().showExpandedTodos?`tasks`:`none`,selectedIPAgentIndex:-1,selectedBgAgentIndex:-1,viewSelectionMode:`none`,footerSelection:null,toolPermissionContext:wn,agent:w?.agentType,agentDefinitions:Rt,mcp:{clients:[],tools:[],commands:[],resources:{},pluginReconnectKey:0},plugins:{enabled:[],disabled:[],commands:[],errors:[],installationStatus:{marketplaces:[],plugins:[]},needsRefresh:!1},statusLineText:void 0,kairosEnabled:!1,remoteSessionUrl:void 0,remoteConnectionStatus:`connecting`,remoteBackgroundTaskCount:0,replBridgeEnabled:En||!1,replBridgeExplicit:!1,replBridgeOutboundOnly:!1,replBridgeConnected:!1,replBridgeSessionActive:!1,replBridgeReconnecting:!1,replBridgeConnectUrl:void 0,replBridgeSessionUrl:void 0,replBridgeEnvironmentId:void 0,replBridgeSessionId:void 0,replBridgeError:void 0,replBridgeInitialName:Be,showRemoteCallout:!1,notifications:{current:null,queue:Cn},elicitation:{queue:[]},todos:{},remoteAgentTaskSuggestions:[],fileHistory:{snapshots:[],trackedFiles:new Set,snapshotSequence:0},attribution:ir(),thinkingEnabled:yn,promptSuggestionEnabled:Wt(),sessionHooks:new Map,inbox:{messages:[]},promptSuggestion:{text:null,promptId:null,shownAt:0,acceptedAt:0,generationRequestId:null},speculation:ur,speculationSessionTimeSavedMs:0,skillImprovement:{suggestion:null},authVersion:0,initialMessage:C?{message:Me({content:String(C)})}:null,activeOverlays:new Set,fastMode:zo(Ut),...fe()&&Gt&&{advisorModel:Gt}};C&&Ae(String(C));let kn=_n;B(e=>({...e,numStartups:(e.numStartups??0)+1})),setImmediate(()=>{sd(),ad()});let jn={debug:n||r,commands:[...Nt,...vn],initialTools:kn,mcpClients:gn,autoConnectIdeFlag:h,mainThreadAgentDefinition:w,disableSlashCommands:De,dynamicMcpConfig:Ke,strictMcpConfig:Je,systemPrompt:He,appendSystemPrompt:Ue,thinkingConfig:k},Nn={mainThreadAgentDefinition:w,agentDefinitions:Rt,currentCwd:jt,cliAgents:Ft,initialState:A};if(t.continue){let e=!1;try{let n=performance.now(),{clearSessionCaches:r}=await import(`./caches-CB8MHqy2.js`);r();let i=await An(void 0,void 0);if(!i)return W(`tengu_continue`,{success:!1}),await X(E,`No conversation found to continue`);let a=await bc(i,{forkSession:!!t.forkSession,includeAttribution:!0,transcriptPath:i.fullPath},Nn);a.restoredAgentDef&&(w=a.restoredAgentDef),bd(t),W(`tengu_continue`,{success:!0,resume_duration_ms:Math.round(performance.now()-n)}),e=!0,await hl(E,{getFpsMetrics:D,stats:O,initialState:a.initialState},{...jn,mainThreadAgentDefinition:a.restoredAgentDef??w,initialMessages:a.messages,initialFileHistorySnapshots:a.fileHistorySnapshots,initialContentReplacements:a.contentReplacements,initialAgentName:a.agentName,initialAgentColor:a.agentColor},Fl)}catch(t){e||W(`tengu_continue`,{success:!1}),H(t),process.exit(1)}}else if(Q?.url){let e;try{let t=await nd({serverUrl:Q.url,authToken:Q.authToken,cwd:zi(),dangerouslySkipPermissions:Q.dangerouslySkipPermissions});t.workDir&&(hi(t.workDir),Ii(t.workDir)),Mi(Q.url),e=t.config}catch(e){return await X(E,e instanceof td?e.message:String(e),()=>j(1))}let t=Ye(`Connected to server at ${Q.url}\nSession: ${e.sessionId}`,`info`);await hl(E,{getFpsMetrics:D,stats:O,initialState:A},{debug:n||r,commands:Nt,initialTools:[],initialMessages:[t],mcpClients:[],autoConnectIdeFlag:h,mainThreadAgentDefinition:w,disableSlashCommands:De,directConnectConfig:e,thinkingConfig:k},Fl);return}else if($?.host){let{createSSHSession:e,createLocalSSHSession:t,SSHSessionError:i}=await import(`./createSSHSession-DP7B8yvb.js`),a;try{if($.local)process.stderr.write(`Starting local ssh-proxy test session...
597
- `),a=await t({cwd:$.cwd,permissionMode:$.permissionMode,dangerouslySkipPermissions:$.dangerouslySkipPermissions});else{process.stderr.write(`Connecting to ${$.host}…\n`);let t=process.stderr.isTTY,n=!1;a=await e({host:$.host,cwd:$.cwd,localVersion:`0.0.9`,permissionMode:$.permissionMode,dangerouslySkipPermissions:$.dangerouslySkipPermissions,extraCliArgs:$.extraCliArgs,remoteBin:$.remoteBin},t?{onProgress:e=>{n=!0,process.stderr.write(`\r ${e}\x1b[K`)}}:{}),n&&process.stderr.write(`
598
- `)}hi(a.remoteCwd),Ii(a.remoteCwd),Mi($.local?`local`:$.host)}catch(e){return await X(E,e instanceof i?e.message:String(e),()=>j(1))}let o=Ye($.local?`Local ssh-proxy test session\ncwd: ${a.remoteCwd}\nAuth: unix socket → local proxy`:`SSH session to ${$.host}\nRemote cwd: ${a.remoteCwd}\nAuth: unix socket -R → local proxy`,`info`);await hl(E,{getFpsMetrics:D,stats:O,initialState:A},{debug:n||r,commands:Nt,initialTools:[],initialMessages:[o],mcpClients:[],autoConnectIdeFlag:h,mainThreadAgentDefinition:w,disableSlashCommands:De,sshSession:a,thinkingConfig:k},Fl);return}else if(t.resume||t.fromPr||b||Re!==null){let{clearSessionCaches:e}=await import(`./caches-CB8MHqy2.js`);e();let i=null,a,o=Lt(t.resume),s,c=null,l;if(t.fromPr&&(t.fromPr===!0?l=!0:typeof t.fromPr==`string`&&(l=t.fromPr)),t.resume&&typeof t.resume==`string`&&!o){let e=t.resume.trim();if(e){let t=await ce(e,{exact:!0});t.length===1?(c=t[0],o=_t(c)??null):s=e}}if((Re!==null||b)&&(await me(),!se(`allow_remote_sessions`)))return await X(E,`Error: Remote sessions are disabled by your organization's policy.`,()=>j(1));if(Re!==null){let e=Re.length>0;if(!e)return await X(E,`Error: --remote requires a description.
599
- Usage: claude --remote "your task description"`,()=>j(1));W(`tengu_remote_create_session`,{has_initial_prompt:String(e)});let t=await Ja(),i=await kr(E,e?Re:null,new AbortController().signal,t||void 0);if(!i)return W(`tengu_remote_create_session_error`,{error:`unable_to_create_session`}),await X(E,`Error: Unable to create remote session`,()=>j(1));W(`tengu_remote_create_session_success`,{session_id:i.id}),process.stdout.write(`Created remote session: ${i.title}\n`),process.stdout.write(`View: ${sn(i.id)}?m=0\n`),process.stdout.write(`Resume with: claude --teleport ${i.id}\n`),await j(0),process.exit(0),xi(!0),ji(Xn(i.id));let a;try{a=await Js()}catch(e){return H(Qi(e)),await X(E,`Error: ${P(e)||`Failed to authenticate`}`,()=>j(1))}let{getClaudeAIOAuthTokens:o}=await import(`./auth-CnLb6RWc.js`),s=jc(i.id,()=>o()?.accessToken??a.accessToken,a.orgUUID,e),c=`${sn(i.id)}?m=0`,l=Ye(`/remote-control is active. Code in CLI or at ${c}`,`info`),u=e?Me({content:Re}):null,d={...A,remoteSessionUrl:c},f=Rr(Nt);await hl(E,{getFpsMetrics:D,stats:O,initialState:d},{debug:n||r,commands:f,initialTools:[],initialMessages:u?[l,u]:[l],mcpClients:[],autoConnectIdeFlag:h,mainThreadAgentDefinition:w,disableSlashCommands:De,remoteSessionConfig:s,thinkingConfig:k},Fl);return}else if(b){if(b===!0||b===``){W(`tengu_teleport_interactive_mode`,{}),F(`selectAndResumeTeleportTask: Starting teleport flow...`);let e=await zl(E);e||(await j(0),process.exit(0));let{branchError:t}=await Vn(e.branch);i=Kt(e.log,t)}else if(typeof b==`string`){W(`tengu_teleport_resume_session`,{mode:`direct`});try{let e=await de(await Xs(b));if(e.status===`mismatch`||e.status===`not_in_repo`){let t=e.sessionRepo;if(t){let e=await Ec(Tc(t));if(e.length>0){let n=await Bl(E,{targetRepo:t,initialPaths:e});n?(process.chdir(n),Ar(n),hi(n)):await j(0)}else throw new Yi(`You must run claude --teleport ${b} from a checkout of ${t}.`,M.red(`You must run claude --teleport ${b} from a checkout of ${M.bold(t)}.\n`))}}else if(e.status===`error`)throw new Yi(e.errorMessage||`Failed to validate session`,M.red(`Error: ${e.errorMessage||`Failed to validate session`}\n`));await yt();let{teleportWithProgress:t}=await import(`./TeleportProgress-BmgPAZAi.js`),n=await t(E,b);Ai({sessionId:b}),i=n.messages}catch(e){e instanceof Yi?process.stderr.write(e.formattedMessage+`
600
- `):(H(e),process.stderr.write(M.red(`Error: ${P(e)}\n`))),await j(1)}}}if(o){let e=o;try{let n=performance.now(),r=await An(c??e,void 0);if(!r)return W(`tengu_session_resumed`,{entrypoint:`cli_flag`,success:!1}),await X(E,`No conversation found with session ID: ${e}`);let i=c?.fullPath??r.fullPath;a=await bc(r,{forkSession:!!t.forkSession,sessionIdOverride:e,transcriptPath:i},Nn),a.restoredAgentDef&&(w=a.restoredAgentDef),W(`tengu_session_resumed`,{entrypoint:`cli_flag`,success:!0,resume_duration_ms:Math.round(performance.now()-n)})}catch(t){W(`tengu_session_resumed`,{entrypoint:`cli_flag`,success:!1}),H(t),await X(E,`Failed to resume session ${e}`)}}if(re)try{let e=await re,t=da(e,e=>!e.success);t>0&&process.stderr.write(M.yellow(`Warning: ${t}/${e.length} file(s) failed to download.\n`))}catch(e){return await X(E,`Error downloading files: ${P(e)}`)}let u=a??(Array.isArray(i)?{messages:i,fileHistorySnapshots:void 0,agentName:void 0,agentColor:void 0,restoredAgentDef:w,initialState:A,contentReplacements:void 0}:void 0);u?(bd(t),await hl(E,{getFpsMetrics:D,stats:O,initialState:u.initialState},{...jn,mainThreadAgentDefinition:u.restoredAgentDef??w,initialMessages:u.messages,initialFileHistorySnapshots:u.fileHistorySnapshots,initialContentReplacements:u.contentReplacements,initialAgentName:u.agentName,initialAgentColor:u.agentColor},Fl)):await Vl(E,{getFpsMetrics:D,stats:O,initialState:A},Xe(zi()),{...jn,initialSearchQuery:s,forkSession:t.forkSession,filterByPr:l})}else{let e=mn&&hn.length===0?mn:void 0;G(`action_after_hooks`),bd(t);let n=null;t.deepLinkOrigin?(W(`tengu_deep_link_opened`,{has_prefill:!!t.prefill,has_repo:!!t.deepLinkRepo}),n=Ye(kc({cwd:Gi(),prefillLength:t.prefill?.length,repo:t.deepLinkRepo,lastFetch:t.deepLinkLastFetch===void 0?void 0:new Date(t.deepLinkLastFetch)}),`warning`)):t.prefill&&(n=Ye(`Launched with a pre-filled prompt — review it before pressing Enter.`,`warning`));let r=n?[n,...hn]:hn.length>0?hn:void 0;await hl(E,{getFpsMetrics:D,stats:O,initialState:A},{...jn,initialMessages:r,pendingHookMessages:e},Fl)}}).version(`0.0.9 (Work Mate)`,`-v, --version`,`Output the version number`),t.option(`-w, --worktree [name]`,`Create a new git worktree for this session (optionally specify a name)`),t.option(`--tmux`,`Create a tmux session for the worktree (requires --worktree). Uses iTerm2 native panes when available; use --tmux=classic for traditional tmux.`),Ir()&&t.addOption(new J(`--advisor <model>`,`Enable the server-side advisor tool with the specified model (alias or full ID).`).hideHelp()),t.addOption(new J(`--enable-auto-mode`,`Opt in to auto mode`).hideHelp()),t.addOption(new J(`--proactive`,`Start in proactive autonomous mode`)),t.addOption(new J(`--sdk-url <url>`,`Use remote WebSocket endpoint for SDK I/O streaming (only with -p and stream-json format)`).hideHelp()),t.addOption(new J(`--teleport [session]`,`Resume a teleport session, optionally specify session ID`).hideHelp()),t.addOption(new J(`--remote [description]`,`Create a remote session with the given description`).hideHelp()),G(`run_main_options_built`);let n=process.argv.includes(`-p`)||process.argv.includes(`--print`),r=process.argv.some(e=>e.startsWith(`cc://`)||e.startsWith(`cc+unix://`));if(n&&!r)return G(`run_before_parse`),await t.parseAsync(process.argv),G(`run_after_parse`),t;let i=t.command(`mcp`).description(`Configure and manage MCP servers`).configureHelp(e()).enablePositionalOptions();i.command(`serve`).description(`Start the Work Mate MCP server`).option(`-d, --debug`,`Enable debug mode`,()=>!0).option(`--verbose`,`Override verbose mode setting from config`,()=>!0).action(async({debug:e,verbose:t})=>{let{mcpServeHandler:n}=await import(`./mcp-B_m1XBDt.js`);await n({debug:e,verbose:t})}),Hu(i),Un()&&Uu(i),i.command(`remove <name>`).description(`Remove an MCP server`).option(`-s, --scope <scope>`,`Configuration scope (local, user, or project) - if not specified, removes from whichever scope it exists in`).action(async(e,t)=>{let{mcpRemoveHandler:n}=await import(`./mcp-B_m1XBDt.js`);await n(e,t)}),i.command(`list`).description(`List configured MCP servers. Note: The workspace trust dialog is skipped and stdio servers from .mcp.json are spawned for health checks. Only use this command in directories you trust.`).action(async()=>{let{mcpListHandler:e}=await import(`./mcp-B_m1XBDt.js`);await e()}),i.command(`get <name>`).description(`Get details about an MCP server. Note: The workspace trust dialog is skipped and stdio servers from .mcp.json are spawned for health checks. Only use this command in directories you trust.`).action(async e=>{let{mcpGetHandler:t}=await import(`./mcp-B_m1XBDt.js`);await t(e)}),i.command(`add-json <name> <json>`).description(`Add an MCP server (stdio or SSE) with a JSON string`).option(`-s, --scope <scope>`,`Configuration scope (local, user, or project)`,`local`).option(`--client-secret`,`Prompt for OAuth client secret (or set MCP_CLIENT_SECRET env var)`).action(async(e,t,n)=>{let{mcpAddJsonHandler:r}=await import(`./mcp-B_m1XBDt.js`);await r(e,t,n)}),i.command(`add-from-claude-desktop`).description(`Import MCP servers from Claude Desktop (Mac and WSL only)`).option(`-s, --scope <scope>`,`Configuration scope (local, user, or project)`,`local`).action(async e=>{let{mcpAddFromDesktopHandler:t}=await import(`./mcp-B_m1XBDt.js`);await t(e)}),i.command(`reset-project-choices`).description(`Reset all approved and rejected project-scoped (.mcp.json) servers within this project`).action(async()=>{let{mcpResetChoicesHandler:e}=await import(`./mcp-B_m1XBDt.js`);await e()}),t.command(`server`).description(`Start a Work Mate session server`).option(`--port <number>`,`HTTP port`,`0`).option(`--host <string>`,`Bind address`,`0.0.0.0`).option(`--auth-token <token>`,`Bearer token for auth`).option(`--unix <path>`,`Listen on a unix domain socket`).option(`--workspace <dir>`,`Default working directory for sessions that do not specify cwd`).option(`--idle-timeout <ms>`,`Idle timeout for detached sessions in ms (0 = never expire)`,`600000`).option(`--max-sessions <n>`,`Maximum concurrent sessions (0 = unlimited)`,`32`).action(async e=>{let{randomBytes:t}=await import(`crypto`),{startServer:n}=await import(`./server-LdbAb0sV.js`),{SessionManager:r}=await import(`./sessionManager-CPa049BO.js`),{DangerousBackend:i}=await import(`./dangerousBackend-DwcP0P08.js`),{printBanner:a}=await import(`./serverBanner-BdExKFHT.js`),{createServerLogger:o}=await import(`./serverLog-BFmvyJ93.js`),{writeServerLock:s,removeServerLock:c,probeRunningServer:l}=await import(`./lockfile-D5-j7HOZ.js`),u=await l();u&&(process.stderr.write(`A claude server is already running (pid ${u.pid}) at ${u.httpUrl}\n`),process.exit(1));let d=e.authToken??`sk-ant-cc-${t(16).toString(`base64url`)}`,f={port:parseInt(e.port,10),host:e.host,authToken:d,unix:e.unix,workspace:e.workspace,idleTimeoutMs:parseInt(e.idleTimeout,10),maxSessions:parseInt(e.maxSessions,10)},p=new r(new i,{idleTimeoutMs:f.idleTimeoutMs,maxSessions:f.maxSessions}),m=n(f,p,o()),ee=m.port??f.port;a(f,d,ee),await s({pid:process.pid,port:ee,host:f.host,httpUrl:f.unix?`unix:${f.unix}`:`http://${f.host}:${ee}`,startedAt:Date.now()});let h=!1,g=async()=>{h||(h=!0,m.stop(!0),await p.destroyAll(),await c(),process.exit(0))};process.once(`SIGINT`,()=>void g()),process.once(`SIGTERM`,()=>void g())}),t.command(`ssh <host> [dir]`).description(`Run Work Mate on a remote host over SSH. Deploys the binary and tunnels API auth back through your local machine — no remote setup needed.`).option(`--permission-mode <mode>`,`Permission mode for the remote session`).option(`--dangerously-skip-permissions`,`Skip all permission prompts on the remote (dangerous)`).option(`--remote-bin <command>`,`Custom remote binary command (skips probe/deploy). Example: --remote-bin 'bun /path/to/project/dist/cli.js'`).option(`--local`,`e2e test mode — spawn the child CLI locally (skip ssh/deploy). Exercises the auth proxy and unix-socket plumbing without a remote host.`).action(async()=>{process.stderr.write(`Usage: claude ssh <user@host | ssh-config-alias> [dir]
595
+ You will receive periodic <tick> prompts. These are check-ins. Do whatever seems most useful, or call Sleep if there's nothing to do. The user will see any text you output.`;Ie=Ie?`${Ie}\n\n${e}`:e}let O,k,A;if(!b){let t=Ll(!1);k=t.getFpsMetrics,A=t.stats;let{createRoot:n}=await import(`./src-r6ZFgWPx2.js`);O=await n(t.renderOptions),G(`tengu_timer`,{event:`startup`,durationMs:Math.round(process.uptime()*1e3)}),I(`[STARTUP] Running showSetupScreens()...`);let r=Date.now(),i=await Il(O,x,a,E);I(`[STARTUP] showSetupScreens() completed in ${Date.now()-r}ms`),i&&e?.trim().toLowerCase()===`/login`&&(e=``),i&&(ac(),Rt(),Zs(),import(`./trustedDevice-CuwSv8dG.js`).then(e=>(e.clearTrustedDeviceToken(),e.enrollTrustedDevice())));let o=await es();o.valid||await X(O,o.message)}if(process.exitCode!==void 0){I(`Graceful shutdown initiated, skipping further initialization`);return}if(Ot(),!b){let{errors:e}=Ea(),t=e.filter(e=>!e.mcpErrorMetadata);t.length>0&&await Rl(O,{settingsErrors:t,onExit:()=>Bn(1)})}let Pt=z().startupPrefetchedAt??0;p()?(I(`Skipping startup prefetches, last ran ${Math.round((Date.now()-Pt)/1e3)}s ago`),as()):(I(`Starting background startup prefetches${Pt>0?` last ran ${Math.round((Date.now()-Pt)/1e3)}s ago`:``}`),tn().catch(e=>U(e)),vl(),Zo()),b||Ac();let{servers:Ft}=await Ke;I(`[STARTUP] MCP configs resolved in ${Ge}ms (awaited at +${Date.now()-We}ms)`);let It={...Ft,...Re},zt={},Vt={};for(let[e,t]of Object.entries(It)){let n=t;n.type===`sdk`?zt[e]=n:Vt[e]=n}K(`action_mcp_configs_loaded`);let Ht=b?Promise.resolve({clients:[],tools:[],commands:[]}):vr(Vt),Ut=b?Promise.resolve({clients:[],tools:[],commands:[]}):Ue.then(e=>Object.keys(e).length>0?vr(e):{clients:[],tools:[],commands:[]}),Gt=Promise.all([Ht,Ut]).then(([e,t])=>({clients:[...e.clients,...t.clients],tools:Mt([...e.tools,...t.tools],`name`),commands:Mt([...e.commands,...t.commands],`name`)})),Kt=de||ue||fe||b||t.continue||t.resume?null:Ne(`startup`,{agentType:D?.agentType,model:At}),qt=[];Gt.catch(()=>{});let Zt=[],Qt=[],nn=[],rn=Fr(),j=rn===!1?{type:`disabled`}:{type:`adaptive`};if(t.thinking===`adaptive`||t.thinking===`enabled`)rn=!0,j={type:`adaptive`};else if(t.thinking===`disabled`)rn=!1,j={type:`disabled`};else{let e=process.env.MAX_THINKING_TOKENS?parseInt(process.env.MAX_THINKING_TOKENS,10):t.maxThinkingTokens;e!==void 0&&(e>0?(rn=!0,j={type:`enabled`,budgetTokens:e}):e===0&&(rn=!1,j={type:`disabled`}))}H(`info`,`started`,{version:`0.0.10`,is_native_binary:vo()}),oa(async()=>{H(`info`,`exited`)}),yd({hasInitialPrompt:!!e,hasStdin:!!w,verbose:ce,debug:n,debugToStderr:r,print:le??!1,outputFormat:_??`text`,inputFormat:v??`text`,numAllowedTools:s.length,numDisallowedTools:c.length,mcpClientCount:Object.keys(It).length,worktreeEnabled:_e,skipWebFetchPreflight:wa().skipWebFetchPreflight,githubActionInputs:process.env.GITHUB_ACTION_INPUTS,dangerouslySkipPermissionsPassed:i??!1,permissionMode:x,modeIsBypass:x===`bypassPermissions`,allowDangerouslySkipPermissionsPassed:a,systemPromptFlag:Pe?t.systemPromptFile?`file`:`flag`:void 0,appendSystemPromptFlag:Ie?t.appendSystemPromptFile?`file`:`flag`:void 0,thinkingConfig:j,assistantActivationPath:void 0}),Wt(Vt,ze),id(),ft().then(e=>{e&&(st&&vt(st),Pr().then(e=>{e>=2&&G(`tengu_concurrent_sessions`,{num_sessions:e})}))}),p()||(b?(await ye(),K(`action_after_plugins_init`),$t().then(()=>at())):ye().then(async()=>{K(`action_after_plugins_init`),await $t(),at()}));let on=de||ue?`init`:fe?`maintenance`:null;if(de){vc(),await wt(`init`,{forceSyncExecution:!0}),await Ne(`startup`,{forceSyncExecution:!0}),Bn(0);return}if(b){(_===`stream-json`||_===`json`)&&sa(!0),vc(),fl();let e=t.continue||t.resume||y||on?void 0:Ne(`startup`);e?.catch(()=>{}),K(`before_validateForceLoginOrg`);let n=await es();n.valid||(process.stderr.write(n.message+`
596
+ `),process.exit(1));let r=pe?[]:E.filter(e=>e.type===`prompt`&&!e.disableNonInteractive||e.type===`local`&&e.supportsNonInteractive),i=Rn(),a=Qe({...i,mcp:{...i.mcp,clients:Zt,commands:nn,tools:Qt},toolPermissionContext:ze,...rs()&&{fastMode:Ro(Dt??null)},...rt()&&jt&&{advisorModel:jt}},yc);Te(ze,a.getState().fastMode).then(({updateContext:e})=>{a.setState(t=>{let n=e(t.toolPermissionContext);return n===t.toolPermissionContext?t:{...t,toolPermissionContext:n}})}),t.sessionPersistence===!1&&wi(!0),hi(To(ee));let o=(e,t)=>Object.keys(e).length===0?Promise.resolve():(a.setState(t=>({...t,mcp:{...t.mcp,clients:[...t.mcp.clients,...Object.entries(e).map(([e,t])=>({name:e,type:`pending`,config:t}))]}})),en(({client:e,tools:t,commands:n})=>{a.setState(r=>({...r,mcp:{...r.mcp,clients:r.mcp.clients.some(t=>t.name===e.name)?r.mcp.clients.map(t=>t.name===e.name?e:t):[...r.mcp.clients,e],tools:Mt([...r.mcp.tools,...t],`name`),commands:Mt([...r.mcp.commands,...n],`name`)}}))},e).catch(e=>I(`[MCP] ${t} connect error: ${e}`)));K(`before_connectMcp`),await o(Vt,`regular`),K(`after_connectMcp`);let c=5e3,l=Ue.then(e=>{if(Object.keys(e).length>0){let t=new Set;for(let n of Object.values(e)){let e=qn(n);e&&t.add(e)}let n=new Set;for(let[e,r]of Object.entries(Vt)){if(!e.startsWith(`plugin:`))continue;let i=qn(r);i&&t.has(i)&&n.add(e)}if(n.size>0){I(`[MCP] Lazy dedup: suppressing ${n.size} plugin server(s) that duplicate claude.ai connectors: ${[...n].join(`, `)}`);for(let e of a.getState().mcp.clients)!n.has(e.name)||e.type!==`connected`||(e.client.onclose=void 0,Un(e.name,e.config).catch(()=>{}));a.setState(e=>{let{clients:t,tools:r,commands:i,resources:a}=e.mcp;t=t.filter(e=>!n.has(e.name)),r=r.filter(e=>!e.mcpInfo||!n.has(e.mcpInfo.serverName));for(let e of n)i=Ve(i,e),a=$n(a,e);return{...e,mcp:{...e.mcp,clients:t,tools:r,commands:i,resources:a}}})}}let{servers:t}=Gn(e,ja(Vt,(e,t)=>!t.startsWith(`plugin:`)));return o(t,`claudeai`)}),u,d=await Promise.race([l.then(()=>!1),new Promise(e=>{u=setTimeout(e=>e(!0),c,e)})]);u&&clearTimeout(u),d&&I(`[MCP] claude.ai connectors not ready after ${c}ms — proceeding; background connection continues`),K(`after_connectMcp_claudeai`),p()||(dd(),import(`./backgroundHousekeeping-BS_8z3_x.js`).then(e=>e.startBackgroundHousekeeping())),ad(),K(`before_print_import`);let{runHeadless:f}=await import(`./print-eCRv_Li-.js`);K(`after_print_import`),f(w,()=>a.getState(),a.setState,r,Je,zt,St.activeAgents,{continue:t.continue,resume:t.resume,verbose:ce,outputFormat:_,jsonSchema:T,permissionPromptToolName:t.permissionPromptTool,allowedTools:s,thinkingConfig:j,maxTurns:t.maxTurns,maxBudgetUsd:t.maxBudgetUsd,taskBudget:t.taskBudget?{total:t.taskBudget}:void 0,systemPrompt:Pe,appendSystemPrompt:Ie,userSpecifiedModel:Dt,fallbackModel:lt,teleport:y,sdkUrl:xe,replayUserMessages:ot,includePartialMessages:Se,forkSession:t.forkSession||!1,resumeSessionAt:t.resumeSessionAt||void 0,rewindFiles:t.rewindFiles,enableAuthStatus:t.enableAuthStatus,agent:oe,workload:t.workload,setupTrigger:on??void 0,sessionStartHooksPromise:e});return}G(`tengu_startup_manual_model_config`,{cli_flag:t.model,env_var:process.env.ANTHROPIC_MODEL,settings_file:(wa()||{}).model,subscriptionType:Do(),agent:Tt});let cn=Mc(At),ln=[];Le&&ln.push({key:`permission-mode-notification`,text:Le,priority:`high`}),cn&&ln.push({key:`model-deprecation-warning`,text:cn,color:`warning`,priority:`high`});let dn={...ze},pn=La(),mn={settings:wa(),tasks:{},agentNameRegistry:new Map,verbose:ce??z().verbose??!1,mainLoopModel:kt,mainLoopModelForSession:null,expandedView:z().showExpandedTodos?`tasks`:`none`,selectedIPAgentIndex:-1,selectedBgAgentIndex:-1,viewSelectionMode:`none`,footerSelection:null,toolPermissionContext:dn,agent:D?.agentType,agentDefinitions:St,mcp:{clients:[],tools:[],commands:[],resources:{},pluginReconnectKey:0},plugins:{enabled:[],disabled:[],commands:[],errors:[],installationStatus:{marketplaces:[],plugins:[]},needsRefresh:!1},statusLineText:void 0,remoteSessionUrl:void 0,remoteConnectionStatus:`connecting`,remoteBackgroundTaskCount:0,replBridgeEnabled:pn||!1,replBridgeExplicit:!1,replBridgeOutboundOnly:!1,replBridgeConnected:!1,replBridgeSessionActive:!1,replBridgeReconnecting:!1,replBridgeConnectUrl:void 0,replBridgeSessionUrl:void 0,replBridgeEnvironmentId:void 0,replBridgeSessionId:void 0,replBridgeError:void 0,replBridgeInitialName:je,showRemoteCallout:!1,notifications:{current:null,queue:ln},elicitation:{queue:[]},todos:{},remoteAgentTaskSuggestions:[],fileHistory:{snapshots:[],trackedFiles:new Set,snapshotSequence:0},attribution:Nt(),thinkingEnabled:rn,promptSuggestionEnabled:Xt(),sessionHooks:new Map,inbox:{messages:[]},promptSuggestion:{text:null,promptId:null,shownAt:0,acceptedAt:0,generationRequestId:null},speculation:fr,speculationSessionTimeSavedMs:0,skillImprovement:{suggestion:null},authVersion:0,initialMessage:w?{message:_t({content:String(w)})}:null,activeOverlays:new Set,fastMode:Ro(At),...rt()&&jt&&{advisorModel:jt}};w&&Xe(String(w));let hn=Qt;V(e=>({...e,numStartups:(e.numStartups??0)+1})),setImmediate(()=>{sd(),ad()});let gn={debug:n||r,commands:[...E,...nn],initialTools:hn,mcpClients:Zt,autoConnectIdeFlag:h,mainThreadAgentDefinition:D,disableSlashCommands:pe,dynamicMcpConfig:Re,strictMcpConfig:S,systemPrompt:Pe,appendSystemPrompt:Ie,thinkingConfig:j},vn={mainThreadAgentDefinition:D,agentDefinitions:St,currentCwd:dt,cliAgents:bt,initialState:mn};if(t.continue){let e=!1;try{let n=performance.now(),{clearSessionCaches:r}=await import(`./caches-BVtSCnV1.js`);r();let i=await kn(void 0,void 0);if(!i)return G(`tengu_continue`,{success:!1}),await X(O,`No conversation found to continue`);let a=await bc(i,{forkSession:!!t.forkSession,includeAttribution:!0,transcriptPath:i.fullPath},vn);a.restoredAgentDef&&(D=a.restoredAgentDef),bd(t),G(`tengu_continue`,{success:!0,resume_duration_ms:Math.round(performance.now()-n)}),e=!0,await hl(O,{getFpsMetrics:k,stats:A,initialState:a.initialState},{...gn,mainThreadAgentDefinition:a.restoredAgentDef??D,initialMessages:a.messages,initialFileHistorySnapshots:a.fileHistorySnapshots,initialContentReplacements:a.contentReplacements,initialAgentName:a.agentName,initialAgentColor:a.agentColor},Fl)}catch(t){e||G(`tengu_continue`,{success:!1}),U(t),process.exit(1)}}else if(Q?.url){let e;try{let t=await nd({serverUrl:Q.url,authToken:Q.authToken,cwd:Ai(),dangerouslySkipPermissions:Q.dangerouslySkipPermissions});t.workDir&&(di(t.workDir),Di(t.workDir)),ji(Q.url),e=t.config}catch(e){return await X(O,e instanceof td?e.message:String(e),()=>M(1))}let t=ut(`Connected to server at ${Q.url}\nSession: ${e.sessionId}`,`info`);await hl(O,{getFpsMetrics:k,stats:A,initialState:mn},{debug:n||r,commands:E,initialTools:[],initialMessages:[t],mcpClients:[],autoConnectIdeFlag:h,mainThreadAgentDefinition:D,disableSlashCommands:pe,directConnectConfig:e,thinkingConfig:j},Fl);return}else if($?.host){let{createSSHSession:e,createLocalSSHSession:t,SSHSessionError:i}=await import(`./createSSHSession-CJtzNQdZ.js`),a;try{if($.local)process.stderr.write(`Starting local ssh-proxy test session...
597
+ `),a=await t({cwd:$.cwd,permissionMode:$.permissionMode,dangerouslySkipPermissions:$.dangerouslySkipPermissions});else{process.stderr.write(`Connecting to ${$.host}…\n`);let t=process.stderr.isTTY,n=!1;a=await e({host:$.host,cwd:$.cwd,localVersion:`0.0.10`,permissionMode:$.permissionMode,dangerouslySkipPermissions:$.dangerouslySkipPermissions,extraCliArgs:$.extraCliArgs,remoteBin:$.remoteBin},t?{onProgress:e=>{n=!0,process.stderr.write(`\r ${e}\x1b[K`)}}:{}),n&&process.stderr.write(`
598
+ `)}di(a.remoteCwd),Di(a.remoteCwd),ji($.local?`local`:$.host)}catch(e){return await X(O,e instanceof i?e.message:String(e),()=>M(1))}let o=ut($.local?`Local ssh-proxy test session\ncwd: ${a.remoteCwd}\nAuth: unix socket → local proxy`:`SSH session to ${$.host}\nRemote cwd: ${a.remoteCwd}\nAuth: unix socket -R → local proxy`,`info`);await hl(O,{getFpsMetrics:k,stats:A,initialState:mn},{debug:n||r,commands:E,initialTools:[],initialMessages:[o],mcpClients:[],autoConnectIdeFlag:h,mainThreadAgentDefinition:D,disableSlashCommands:pe,sshSession:a,thinkingConfig:j},Fl);return}else if(t.resume||t.fromPr||y||Oe!==null){let{clearSessionCaches:e}=await import(`./caches-BVtSCnV1.js`);e();let i=null,a,o=Mn(t.resume),s,c=null,l;if(t.fromPr&&(t.fromPr===!0?l=!0:typeof t.fromPr==`string`&&(l=t.fromPr)),t.resume&&typeof t.resume==`string`&&!o){let e=t.resume.trim();if(e){let t=await _n(e,{exact:!0});t.length===1?(c=t[0],o=yn(c)??null):s=e}}if((Oe!==null||y)&&(await xr(),!In(`allow_remote_sessions`)))return await X(O,`Error: Remote sessions are disabled by your organization's policy.`,()=>M(1));if(Oe!==null){let e=Oe.length>0;if(!e)return await X(O,`Error: --remote requires a description.
599
+ Usage: claude --remote "your task description"`,()=>M(1));G(`tengu_remote_create_session`,{has_initial_prompt:String(e)});let t=await qa(),i=await Ir(O,e?Oe:null,new AbortController().signal,t||void 0);if(!i)return G(`tengu_remote_create_session_error`,{error:`unable_to_create_session`}),await X(O,`Error: Unable to create remote session`,()=>M(1));G(`tengu_remote_create_session_success`,{session_id:i.id}),process.stdout.write(`Created remote session: ${i.title}\n`),process.stdout.write(`View: ${Ct(i.id)}?m=0\n`),process.stdout.write(`Resume with: claude --teleport ${i.id}\n`),await M(0),process.exit(0),fi(!0),zi(An(i.id));let a;try{a=await Js()}catch(e){return U(Zi(e)),await X(O,`Error: ${F(e)||`Failed to authenticate`}`,()=>M(1))}let{getClaudeAIOAuthTokens:o}=await import(`./auth-BIGJth5U.js`),s=jc(i.id,()=>o()?.accessToken??a.accessToken,a.orgUUID,e),c=`${Ct(i.id)}?m=0`,l=ut(`/remote-control is active. Code in CLI or at ${c}`,`info`),u=e?_t({content:Oe}):null,d={...mn,remoteSessionUrl:c},f=En(E);await hl(O,{getFpsMetrics:k,stats:A,initialState:d},{debug:n||r,commands:f,initialTools:[],initialMessages:u?[l,u]:[l],mcpClients:[],autoConnectIdeFlag:h,mainThreadAgentDefinition:D,disableSlashCommands:pe,remoteSessionConfig:s,thinkingConfig:j},Fl);return}else if(y){if(y===!0||y===``){G(`tengu_teleport_interactive_mode`,{}),I(`selectAndResumeTeleportTask: Starting teleport flow...`);let e=await zl(O);e||(await M(0),process.exit(0));let{branchError:t}=await sn(e.branch);i=bn(e.log,t)}else if(typeof y==`string`){G(`tengu_teleport_resume_session`,{mode:`direct`});try{let e=await Ar(await Xs(y));if(e.status===`mismatch`||e.status===`not_in_repo`){let t=e.sessionRepo;if(t){let e=await Ec(Tc(t));if(e.length>0){let n=await Bl(O,{targetRepo:t,initialPaths:e});n?(process.chdir(n),Zn(n),di(n)):await M(0)}else throw new Ji(`You must run claude --teleport ${y} from a checkout of ${t}.`,N.red(`You must run claude --teleport ${y} from a checkout of ${N.bold(t)}.\n`))}}else if(e.status===`error`)throw new Ji(e.errorMessage||`Failed to validate session`,N.red(`Error: ${e.errorMessage||`Failed to validate session`}\n`));await Jt();let{teleportWithProgress:t}=await import(`./TeleportProgress-Doucj-50.js`),n=await t(O,y);Li({sessionId:y}),i=n.messages}catch(e){e instanceof Ji?process.stderr.write(e.formattedMessage+`
600
+ `):(U(e),process.stderr.write(N.red(`Error: ${F(e)}\n`))),await M(1)}}}if(o){let e=o;try{let n=performance.now(),r=await kn(c??e,void 0);if(!r)return G(`tengu_session_resumed`,{entrypoint:`cli_flag`,success:!1}),await X(O,`No conversation found with session ID: ${e}`);let i=c?.fullPath??r.fullPath;a=await bc(r,{forkSession:!!t.forkSession,sessionIdOverride:e,transcriptPath:i},vn),a.restoredAgentDef&&(D=a.restoredAgentDef),G(`tengu_session_resumed`,{entrypoint:`cli_flag`,success:!0,resume_duration_ms:Math.round(performance.now()-n)})}catch(t){G(`tengu_session_resumed`,{entrypoint:`cli_flag`,success:!1}),U(t),await X(O,`Failed to resume session ${e}`)}}if(ie)try{let e=await ie,t=ua(e,e=>!e.success);t>0&&process.stderr.write(N.yellow(`Warning: ${t}/${e.length} file(s) failed to download.\n`))}catch(e){return await X(O,`Error downloading files: ${F(e)}`)}let u=a??(Array.isArray(i)?{messages:i,fileHistorySnapshots:void 0,agentName:void 0,agentColor:void 0,restoredAgentDef:D,initialState:mn,contentReplacements:void 0}:void 0);u?(bd(t),await hl(O,{getFpsMetrics:k,stats:A,initialState:u.initialState},{...gn,mainThreadAgentDefinition:u.restoredAgentDef??D,initialMessages:u.messages,initialFileHistorySnapshots:u.fileHistorySnapshots,initialContentReplacements:u.contentReplacements,initialAgentName:u.agentName,initialAgentColor:u.agentColor},Fl)):await Vl(O,{getFpsMetrics:k,stats:A,initialState:mn},yt(Ai()),{...gn,initialSearchQuery:s,forkSession:t.forkSession,filterByPr:l})}else{let e=Kt&&qt.length===0?Kt:void 0;K(`action_after_hooks`),bd(t);let n=null;t.deepLinkOrigin?(G(`tengu_deep_link_opened`,{has_prefill:!!t.prefill,has_repo:!!t.deepLinkRepo}),n=ut(kc({cwd:Wi(),prefillLength:t.prefill?.length,repo:t.deepLinkRepo,lastFetch:t.deepLinkLastFetch===void 0?void 0:new Date(t.deepLinkLastFetch)}),`warning`)):t.prefill&&(n=ut(`Launched with a pre-filled prompt — review it before pressing Enter.`,`warning`));let r=n?[n,...qt]:qt.length>0?qt:void 0;await hl(O,{getFpsMetrics:k,stats:A,initialState:mn},{...gn,initialMessages:r,pendingHookMessages:e},Fl)}}).version(`0.0.10 (Work Mate)`,`-v, --version`,`Output the version number`),t.option(`-w, --worktree [name]`,`Create a new git worktree for this session (optionally specify a name)`),t.option(`--tmux`,`Create a tmux session for the worktree (requires --worktree). Uses iTerm2 native panes when available; use --tmux=classic for traditional tmux.`),re()&&t.addOption(new J(`--advisor <model>`,`Enable the server-side advisor tool with the specified model (alias or full ID).`).hideHelp()),t.addOption(new J(`--enable-auto-mode`,`Opt in to auto mode`).hideHelp()),t.addOption(new J(`--proactive`,`Start in proactive autonomous mode`)),t.addOption(new J(`--sdk-url <url>`,`Use remote WebSocket endpoint for SDK I/O streaming (only with -p and stream-json format)`).hideHelp()),t.addOption(new J(`--teleport [session]`,`Resume a teleport session, optionally specify session ID`).hideHelp()),t.addOption(new J(`--remote [description]`,`Create a remote session with the given description`).hideHelp()),K(`run_main_options_built`);let n=process.argv.includes(`-p`)||process.argv.includes(`--print`),r=process.argv.some(e=>e.startsWith(`cc://`)||e.startsWith(`cc+unix://`));if(n&&!r)return K(`run_before_parse`),await t.parseAsync(process.argv),K(`run_after_parse`),t;let i=t.command(`mcp`).description(`Configure and manage MCP servers`).configureHelp(e()).enablePositionalOptions();i.command(`serve`).description(`Start the Work Mate MCP server`).option(`-d, --debug`,`Enable debug mode`,()=>!0).option(`--verbose`,`Override verbose mode setting from config`,()=>!0).action(async({debug:e,verbose:t})=>{let{mcpServeHandler:n}=await import(`./mcp-BckPBjaM.js`);await n({debug:e,verbose:t})}),Hu(i),lt()&&Uu(i),i.command(`remove <name>`).description(`Remove an MCP server`).option(`-s, --scope <scope>`,`Configuration scope (local, user, or project) - if not specified, removes from whichever scope it exists in`).action(async(e,t)=>{let{mcpRemoveHandler:n}=await import(`./mcp-BckPBjaM.js`);await n(e,t)}),i.command(`list`).description(`List configured MCP servers. Note: The workspace trust dialog is skipped and stdio servers from .mcp.json are spawned for health checks. Only use this command in directories you trust.`).action(async()=>{let{mcpListHandler:e}=await import(`./mcp-BckPBjaM.js`);await e()}),i.command(`get <name>`).description(`Get details about an MCP server. Note: The workspace trust dialog is skipped and stdio servers from .mcp.json are spawned for health checks. Only use this command in directories you trust.`).action(async e=>{let{mcpGetHandler:t}=await import(`./mcp-BckPBjaM.js`);await t(e)}),i.command(`add-json <name> <json>`).description(`Add an MCP server (stdio or SSE) with a JSON string`).option(`-s, --scope <scope>`,`Configuration scope (local, user, or project)`,`local`).option(`--client-secret`,`Prompt for OAuth client secret (or set MCP_CLIENT_SECRET env var)`).action(async(e,t,n)=>{let{mcpAddJsonHandler:r}=await import(`./mcp-BckPBjaM.js`);await r(e,t,n)}),i.command(`add-from-claude-desktop`).description(`Import MCP servers from Claude Desktop (Mac and WSL only)`).option(`-s, --scope <scope>`,`Configuration scope (local, user, or project)`,`local`).action(async e=>{let{mcpAddFromDesktopHandler:t}=await import(`./mcp-BckPBjaM.js`);await t(e)}),i.command(`reset-project-choices`).description(`Reset all approved and rejected project-scoped (.mcp.json) servers within this project`).action(async()=>{let{mcpResetChoicesHandler:e}=await import(`./mcp-BckPBjaM.js`);await e()}),t.command(`server`).description(`Start a Work Mate session server`).option(`--port <number>`,`HTTP port`,`0`).option(`--host <string>`,`Bind address`,`0.0.0.0`).option(`--auth-token <token>`,`Bearer token for auth`).option(`--unix <path>`,`Listen on a unix domain socket`).option(`--workspace <dir>`,`Default working directory for sessions that do not specify cwd`).option(`--idle-timeout <ms>`,`Idle timeout for detached sessions in ms (0 = never expire)`,`600000`).option(`--max-sessions <n>`,`Maximum concurrent sessions (0 = unlimited)`,`32`).action(async e=>{let{randomBytes:t}=await import(`crypto`),{startServer:n}=await import(`./server-LdbAb0sV.js`),{SessionManager:r}=await import(`./sessionManager-CPa049BO.js`),{DangerousBackend:i}=await import(`./dangerousBackend-DwcP0P08.js`),{printBanner:a}=await import(`./serverBanner-BdExKFHT.js`),{createServerLogger:o}=await import(`./serverLog-BFmvyJ93.js`),{writeServerLock:s,removeServerLock:c,probeRunningServer:l}=await import(`./lockfile-D5-j7HOZ.js`),u=await l();u&&(process.stderr.write(`A claude server is already running (pid ${u.pid}) at ${u.httpUrl}\n`),process.exit(1));let d=e.authToken??`sk-ant-cc-${t(16).toString(`base64url`)}`,f={port:parseInt(e.port,10),host:e.host,authToken:d,unix:e.unix,workspace:e.workspace,idleTimeoutMs:parseInt(e.idleTimeout,10),maxSessions:parseInt(e.maxSessions,10)},p=new r(new i,{idleTimeoutMs:f.idleTimeoutMs,maxSessions:f.maxSessions}),m=n(f,p,o()),ee=m.port??f.port;a(f,d,ee),await s({pid:process.pid,port:ee,host:f.host,httpUrl:f.unix?`unix:${f.unix}`:`http://${f.host}:${ee}`,startedAt:Date.now()});let h=!1,g=async()=>{h||(h=!0,m.stop(!0),await p.destroyAll(),await c(),process.exit(0))};process.once(`SIGINT`,()=>void g()),process.once(`SIGTERM`,()=>void g())}),t.command(`ssh <host> [dir]`).description(`Run Work Mate on a remote host over SSH. Deploys the binary and tunnels API auth back through your local machine — no remote setup needed.`).option(`--permission-mode <mode>`,`Permission mode for the remote session`).option(`--dangerously-skip-permissions`,`Skip all permission prompts on the remote (dangerous)`).option(`--remote-bin <command>`,`Custom remote binary command (skips probe/deploy). Example: --remote-bin 'bun /path/to/project/dist/cli.js'`).option(`--local`,`e2e test mode — spawn the child CLI locally (skip ssh/deploy). Exercises the auth proxy and unix-socket plumbing without a remote host.`).action(async()=>{process.stderr.write(`Usage: claude ssh <user@host | ssh-config-alias> [dir]
601
601
 
602
602
  Runs Work Mate on a remote Linux host. You don't need to install
603
603
  anything on the remote — the binary is
604
604
  deployed over SSH and API auth tunnels back through your local machine.
605
- `),process.exit(1)}),t.command(`open <cc-url>`).description(`Connect to a Work Mate server (internal — use cc:// URLs)`).option(`-p, --print [prompt]`,`Print mode (headless)`).option(`--output-format <format>`,`Output format: text, json, stream-json`,`text`).action(async(e,t)=>{let{parseConnectUrl:n}=await import(`./parseConnectUrl-BiyKR5-x.js`),{serverUrl:r,authToken:i}=n(e),a;try{let e=await nd({serverUrl:r,authToken:i,cwd:zi(),dangerouslySkipPermissions:Q?.dangerouslySkipPermissions});e.workDir&&(hi(e.workDir),Ii(e.workDir)),Mi(r),a=e.config}catch(e){console.error(e instanceof td?e.message:String(e)),process.exit(1)}let{runConnectHeadless:o}=await import(`./connectHeadless-CqRoEtrg.js`),s=typeof t.print==`string`?t.print:``,c=t.print===!0;await o(a,s,t.outputFormat,c)});let a=t.command(`auth`).description(`Manage authentication`).configureHelp(e());a.command(`login`).description(`Sign in`).option(`--email <email>`,`Pre-populate email address on the login page`).option(`--sso`,`Force SSO login flow`).option(`--console`,`Use Console (API usage billing) instead of Claude subscription`).option(`--claudeai`,`Use Claude subscription (default)`).action(async({email:e,sso:t,console:n,claudeai:r})=>{let{authLogin:i}=await import(`./auth-D-SGHS0K.js`);await i({email:e,sso:t,console:n,claudeai:r})}),a.command(`status`).description(`Show authentication status`).option(`--json`,`Output as JSON (default)`).option(`--text`,`Output as human-readable text`).action(async e=>{let{authStatus:t}=await import(`./auth-D-SGHS0K.js`);await t(e)});let o=()=>new J(`--cowork`,`Use cowork_plugins directory`).hideHelp(),s=t.command(`plugin`).alias(`plugins`).description(`Manage Work Mate plugins`).configureHelp(e());s.command(`validate <path>`).description(`Validate a plugin or marketplace manifest`).addOption(o()).action(async(e,t)=>{let{pluginValidateHandler:n}=await import(`./plugins-pmipe7kE.js`);await n(e,t)}),s.command(`list`).description(`List installed plugins`).option(`--json`,`Output as JSON`).option(`--available`,`Include available plugins from marketplaces (requires --json)`).addOption(o()).action(async e=>{let{pluginListHandler:t}=await import(`./plugins-pmipe7kE.js`);await t(e)});let c=s.command(`marketplace`).description(`Manage Work Mate marketplaces`).configureHelp(e());if(c.command(`add <source>`).description(`Add a marketplace from a URL, path, or GitHub repo`).addOption(o()).option(`--sparse <paths...>`,`Limit checkout to specific directories via git sparse-checkout (for monorepos). Example: --sparse .claude-plugin plugins`).option(`--scope <scope>`,`Where to declare the marketplace: user (default), project, or local`).action(async(e,t)=>{let{marketplaceAddHandler:n}=await import(`./plugins-pmipe7kE.js`);await n(e,t)}),c.command(`list`).description(`List all configured marketplaces`).option(`--json`,`Output as JSON`).addOption(o()).action(async e=>{let{marketplaceListHandler:t}=await import(`./plugins-pmipe7kE.js`);await t(e)}),c.command(`remove <name>`).alias(`rm`).description(`Remove a configured marketplace`).addOption(o()).action(async(e,t)=>{let{marketplaceRemoveHandler:n}=await import(`./plugins-pmipe7kE.js`);await n(e,t)}),c.command(`update [name]`).description(`Update marketplace(s) from their source - updates all if no name specified`).addOption(o()).action(async(e,t)=>{let{marketplaceUpdateHandler:n}=await import(`./plugins-pmipe7kE.js`);await n(e,t)}),s.command(`install <plugin>`).alias(`i`).description(`Install a plugin from available marketplaces (use plugin@marketplace for specific marketplace)`).option(`-s, --scope <scope>`,`Installation scope: user, project, or local`,`user`).addOption(o()).action(async(e,t)=>{let{pluginInstallHandler:n}=await import(`./plugins-pmipe7kE.js`);await n(e,t)}),s.command(`uninstall <plugin>`).alias(`remove`).alias(`rm`).description(`Uninstall an installed plugin`).option(`-s, --scope <scope>`,`Uninstall from scope: user, project, or local`,`user`).option(`--keep-data`,`Preserve the plugin's persistent data directory (~/.claude/plugins/data/{id}/)`).addOption(o()).action(async(e,t)=>{let{pluginUninstallHandler:n}=await import(`./plugins-pmipe7kE.js`);await n(e,t)}),s.command(`enable <plugin>`).description(`Enable a disabled plugin`).option(`-s, --scope <scope>`,`Installation scope: ${hc.join(`, `)} (default: auto-detect)`).addOption(o()).action(async(e,t)=>{let{pluginEnableHandler:n}=await import(`./plugins-pmipe7kE.js`);await n(e,t)}),s.command(`disable [plugin]`).description(`Disable an enabled plugin`).option(`-a, --all`,`Disable all enabled plugins`).option(`-s, --scope <scope>`,`Installation scope: ${hc.join(`, `)} (default: auto-detect)`).addOption(o()).action(async(e,t)=>{let{pluginDisableHandler:n}=await import(`./plugins-pmipe7kE.js`);await n(e,t)}),s.command(`update <plugin>`).description(`Update a plugin to the latest version (restart required to apply)`).option(`-s, --scope <scope>`,`Installation scope: ${pc.join(`, `)} (default: user)`).addOption(o()).action(async(e,t)=>{let{pluginUpdateHandler:n}=await import(`./plugins-pmipe7kE.js`);await n(e,t)}),t.command(`setup-token`).description(`Set up a long-lived authentication token (requires Claude subscription)`).action(async()=>{let[{setupTokenHandler:e},{createRoot:t}]=await Promise.all([import(`./util-D-X8i5Z2.js`),import(`./src-r6ZFgWPx2.js`)]);await e(await t(Cc(!1)))}),t.command(`agents`).description(`List configured agents`).option(`--setting-sources <sources>`,`Comma-separated list of setting sources to load (user, project, local).`).action(async()=>{let{agentsHandler:e}=await import(`./agents-Bz1MLp4A.js`);await e(),process.exit(0)}),Mr()!==`disabled`){let e=t.command(`auto-mode`).description(`Inspect auto mode classifier configuration`);e.command(`defaults`).description(`Print the default auto mode environment, allow, and deny rules as JSON`).action(async()=>{let{autoModeDefaultsHandler:e}=await import(`./autoMode-CQ5nqP9c.js`);e(),process.exit(0)}),e.command(`config`).description(`Print the effective auto mode config as JSON: your settings where set, defaults otherwise`).action(async()=>{let{autoModeConfigHandler:e}=await import(`./autoMode-CQ5nqP9c.js`);e(),process.exit(0)}),e.command(`critique`).description(`Get AI feedback on your custom auto mode rules`).option(`--model <model>`,`Override which model is used`).action(async e=>{let{autoModeCritiqueHandler:t}=await import(`./autoMode-CQ5nqP9c.js`);await t(e),process.exit()})}{let e=t.command(`autonomy`).description(`Inspect and manage automatic autonomy runs and flows`);e.command(`status`).description(`Print autonomy run, flow, team, pipe, and remote-control status`).option(`--deep`,`Include teams, pipes, daemon, and remote-control sections`).action(async e=>{let{autonomyStatusHandler:t}=await import(`./autonomy-CPUCe-YU.js`);await t(e),process.exit(0)}),e.command(`runs [limit]`).description(`List recent autonomy runs`).action(async e=>{let{autonomyRunsHandler:t}=await import(`./autonomy-CPUCe-YU.js`);await t(e),process.exit(0)}),e.command(`flows [limit]`).description(`List recent autonomy flows`).action(async e=>{let{autonomyFlowsHandler:t}=await import(`./autonomy-CPUCe-YU.js`);await t(e),process.exit(0)});let n=e.command(`flow <flowId>`).description(`Inspect a single autonomy flow`).action(async e=>{let{autonomyFlowHandler:t}=await import(`./autonomy-CPUCe-YU.js`);await t(e),process.exit(0)});n.command(`cancel <flowId>`).description(`Cancel a queued, waiting, or running autonomy flow`).action(async e=>{let{autonomyFlowCancelHandler:t}=await import(`./autonomy-CPUCe-YU.js`);await t(e),process.exit(0)}),n.command(`resume <flowId>`).description(`Resume a waiting autonomy flow`).action(async e=>{let{autonomyFlowResumeHandler:t}=await import(`./autonomy-CPUCe-YU.js`);await t(e),process.exit(0)})}return t.command(`doctor`).description(`Check the health of your Work Mate auto-updater. Note: The workspace trust dialog is skipped and stdio servers from .mcp.json are spawned for health checks. Only use this command in directories you trust.`).action(async()=>{let[{doctorHandler:e},{createRoot:t}]=await Promise.all([import(`./util-D-X8i5Z2.js`),import(`./src-r6ZFgWPx2.js`)]);await e(await t(Cc(!1)))}),t.command(`install [target]`).description(`Install Work Mate native build. Use [target] to specify version (stable, latest, or specific version)`).option(`--force`,`Force installation even if already installed`).action(async(e,t)=>{let{installHandler:n}=await import(`./util-D-X8i5Z2.js`);await n(e,t)}),t.command(`update`).description(`Update workmate (ccb) to the latest version`).action(async()=>{let{updateCCB:e}=await import(`./updateCCB-BlUAU2Vp.js`);await e()}),G(`run_before_parse`),await t.parseAsync(process.argv),G(`run_after_parse`),G(`main_after_run`),fo(),t}async function yd({hasInitialPrompt:e,hasStdin:t,verbose:n,debug:r,debugToStderr:i,print:a,outputFormat:o,inputFormat:s,numAllowedTools:c,numDisallowedTools:l,mcpClientCount:u,worktreeEnabled:d,skipWebFetchPreflight:f,githubActionInputs:ee,dangerouslySkipPermissionsPassed:h,permissionMode:g,modeIsBypass:te,allowDangerouslySkipPermissionsPassed:ne,systemPromptFlag:re,appendSystemPromptFlag:ie,thinkingConfig:_,assistantActivationPath:v}){try{W(`tengu_init`,{entrypoint:`claude`,hasInitialPrompt:e,hasStdin:t,verbose:n,debug:r,debugToStderr:i,print:a,outputFormat:o,inputFormat:s,numAllowedTools:c,numDisallowedTools:l,mcpClientCount:u,worktree:d,skipWebFetchPreflight:f,...ee&&{githubActionInputs:ee},dangerouslySkipPermissionsPassed:h,permissionMode:g,modeIsBypass:te,inProtectedNamespace:m(),allowDangerouslySkipPermissionsPassed:ne,thinkingType:_.type,..._.type===`enabled`&&{thinkingBudgetTokens:_.budgetTokens},...re&&{systemPromptFlag:re},...ie&&{appendSystemPromptFlag:ie},is_simple:p()||void 0,...v&&{assistantActivationPath:v},autoUpdatesChannel:Ta().autoUpdatesChannel??`latest`})}catch(e){H(e)}}function bd(t){if(t.proactive||d(process.env.CLAUDE_CODE_PROACTIVE)){let t=(As(),e(js));t.isProactiveActive()||t.activateProactive(`command`)}}function xd(){(process.stderr.isTTY?process.stderr:process.stdout.isTTY?process.stdout:void 0)?.write(Qr)}export{gd as main};
605
+ `),process.exit(1)}),t.command(`open <cc-url>`).description(`Connect to a Work Mate server (internal — use cc:// URLs)`).option(`-p, --print [prompt]`,`Print mode (headless)`).option(`--output-format <format>`,`Output format: text, json, stream-json`,`text`).action(async(e,t)=>{let{parseConnectUrl:n}=await import(`./parseConnectUrl-BiyKR5-x.js`),{serverUrl:r,authToken:i}=n(e),a;try{let e=await nd({serverUrl:r,authToken:i,cwd:Ai(),dangerouslySkipPermissions:Q?.dangerouslySkipPermissions});e.workDir&&(di(e.workDir),Di(e.workDir)),ji(r),a=e.config}catch(e){console.error(e instanceof td?e.message:String(e)),process.exit(1)}let{runConnectHeadless:o}=await import(`./connectHeadless-CqRoEtrg.js`),s=typeof t.print==`string`?t.print:``,c=t.print===!0;await o(a,s,t.outputFormat,c)});let a=t.command(`auth`).description(`Manage authentication`).configureHelp(e());a.command(`login`).description(`Sign in`).option(`--email <email>`,`Pre-populate email address on the login page`).option(`--sso`,`Force SSO login flow`).option(`--console`,`Use Console (API usage billing) instead of Claude subscription`).option(`--claudeai`,`Use Claude subscription (default)`).action(async({email:e,sso:t,console:n,claudeai:r})=>{let{authLogin:i}=await import(`./auth-CDQMhIZP.js`);await i({email:e,sso:t,console:n,claudeai:r})}),a.command(`status`).description(`Show authentication status`).option(`--json`,`Output as JSON (default)`).option(`--text`,`Output as human-readable text`).action(async e=>{let{authStatus:t}=await import(`./auth-CDQMhIZP.js`);await t(e)});let o=()=>new J(`--cowork`,`Use cowork_plugins directory`).hideHelp(),s=t.command(`plugin`).alias(`plugins`).description(`Manage Work Mate plugins`).configureHelp(e());s.command(`validate <path>`).description(`Validate a plugin or marketplace manifest`).addOption(o()).action(async(e,t)=>{let{pluginValidateHandler:n}=await import(`./plugins-B9eSjLSA.js`);await n(e,t)}),s.command(`list`).description(`List installed plugins`).option(`--json`,`Output as JSON`).option(`--available`,`Include available plugins from marketplaces (requires --json)`).addOption(o()).action(async e=>{let{pluginListHandler:t}=await import(`./plugins-B9eSjLSA.js`);await t(e)});let c=s.command(`marketplace`).description(`Manage Work Mate marketplaces`).configureHelp(e());if(c.command(`add <source>`).description(`Add a marketplace from a URL, path, or GitHub repo`).addOption(o()).option(`--sparse <paths...>`,`Limit checkout to specific directories via git sparse-checkout (for monorepos). Example: --sparse .claude-plugin plugins`).option(`--scope <scope>`,`Where to declare the marketplace: user (default), project, or local`).action(async(e,t)=>{let{marketplaceAddHandler:n}=await import(`./plugins-B9eSjLSA.js`);await n(e,t)}),c.command(`list`).description(`List all configured marketplaces`).option(`--json`,`Output as JSON`).addOption(o()).action(async e=>{let{marketplaceListHandler:t}=await import(`./plugins-B9eSjLSA.js`);await t(e)}),c.command(`remove <name>`).alias(`rm`).description(`Remove a configured marketplace`).addOption(o()).action(async(e,t)=>{let{marketplaceRemoveHandler:n}=await import(`./plugins-B9eSjLSA.js`);await n(e,t)}),c.command(`update [name]`).description(`Update marketplace(s) from their source - updates all if no name specified`).addOption(o()).action(async(e,t)=>{let{marketplaceUpdateHandler:n}=await import(`./plugins-B9eSjLSA.js`);await n(e,t)}),s.command(`install <plugin>`).alias(`i`).description(`Install a plugin from available marketplaces (use plugin@marketplace for specific marketplace)`).option(`-s, --scope <scope>`,`Installation scope: user, project, or local`,`user`).addOption(o()).action(async(e,t)=>{let{pluginInstallHandler:n}=await import(`./plugins-B9eSjLSA.js`);await n(e,t)}),s.command(`uninstall <plugin>`).alias(`remove`).alias(`rm`).description(`Uninstall an installed plugin`).option(`-s, --scope <scope>`,`Uninstall from scope: user, project, or local`,`user`).option(`--keep-data`,`Preserve the plugin's persistent data directory (~/.claude/plugins/data/{id}/)`).addOption(o()).action(async(e,t)=>{let{pluginUninstallHandler:n}=await import(`./plugins-B9eSjLSA.js`);await n(e,t)}),s.command(`enable <plugin>`).description(`Enable a disabled plugin`).option(`-s, --scope <scope>`,`Installation scope: ${hc.join(`, `)} (default: auto-detect)`).addOption(o()).action(async(e,t)=>{let{pluginEnableHandler:n}=await import(`./plugins-B9eSjLSA.js`);await n(e,t)}),s.command(`disable [plugin]`).description(`Disable an enabled plugin`).option(`-a, --all`,`Disable all enabled plugins`).option(`-s, --scope <scope>`,`Installation scope: ${hc.join(`, `)} (default: auto-detect)`).addOption(o()).action(async(e,t)=>{let{pluginDisableHandler:n}=await import(`./plugins-B9eSjLSA.js`);await n(e,t)}),s.command(`update <plugin>`).description(`Update a plugin to the latest version (restart required to apply)`).option(`-s, --scope <scope>`,`Installation scope: ${pc.join(`, `)} (default: user)`).addOption(o()).action(async(e,t)=>{let{pluginUpdateHandler:n}=await import(`./plugins-B9eSjLSA.js`);await n(e,t)}),t.command(`setup-token`).description(`Set up a long-lived authentication token (requires Claude subscription)`).action(async()=>{let[{setupTokenHandler:e},{createRoot:t}]=await Promise.all([import(`./util-VO98TdOz.js`),import(`./src-r6ZFgWPx2.js`)]);await e(await t(Cc(!1)))}),t.command(`agents`).description(`List configured agents`).option(`--setting-sources <sources>`,`Comma-separated list of setting sources to load (user, project, local).`).action(async()=>{let{agentsHandler:e}=await import(`./agents-CIvP8l0s.js`);await e(),process.exit(0)}),Mr()!==`disabled`){let e=t.command(`auto-mode`).description(`Inspect auto mode classifier configuration`);e.command(`defaults`).description(`Print the default auto mode environment, allow, and deny rules as JSON`).action(async()=>{let{autoModeDefaultsHandler:e}=await import(`./autoMode-BnUiK9Cu.js`);e(),process.exit(0)}),e.command(`config`).description(`Print the effective auto mode config as JSON: your settings where set, defaults otherwise`).action(async()=>{let{autoModeConfigHandler:e}=await import(`./autoMode-BnUiK9Cu.js`);e(),process.exit(0)}),e.command(`critique`).description(`Get AI feedback on your custom auto mode rules`).option(`--model <model>`,`Override which model is used`).action(async e=>{let{autoModeCritiqueHandler:t}=await import(`./autoMode-BnUiK9Cu.js`);await t(e),process.exit()})}{let e=t.command(`autonomy`).description(`Inspect and manage automatic autonomy runs and flows`);e.command(`status`).description(`Print autonomy run, flow, team, pipe, and remote-control status`).option(`--deep`,`Include teams, pipes, daemon, and remote-control sections`).action(async e=>{let{autonomyStatusHandler:t}=await import(`./autonomy-C1aSgWPQ.js`);await t(e),process.exit(0)}),e.command(`runs [limit]`).description(`List recent autonomy runs`).action(async e=>{let{autonomyRunsHandler:t}=await import(`./autonomy-C1aSgWPQ.js`);await t(e),process.exit(0)}),e.command(`flows [limit]`).description(`List recent autonomy flows`).action(async e=>{let{autonomyFlowsHandler:t}=await import(`./autonomy-C1aSgWPQ.js`);await t(e),process.exit(0)});let n=e.command(`flow <flowId>`).description(`Inspect a single autonomy flow`).action(async e=>{let{autonomyFlowHandler:t}=await import(`./autonomy-C1aSgWPQ.js`);await t(e),process.exit(0)});n.command(`cancel <flowId>`).description(`Cancel a queued, waiting, or running autonomy flow`).action(async e=>{let{autonomyFlowCancelHandler:t}=await import(`./autonomy-C1aSgWPQ.js`);await t(e),process.exit(0)}),n.command(`resume <flowId>`).description(`Resume a waiting autonomy flow`).action(async e=>{let{autonomyFlowResumeHandler:t}=await import(`./autonomy-C1aSgWPQ.js`);await t(e),process.exit(0)})}return t.command(`doctor`).description(`Check the health of your Work Mate auto-updater. Note: The workspace trust dialog is skipped and stdio servers from .mcp.json are spawned for health checks. Only use this command in directories you trust.`).action(async()=>{let[{doctorHandler:e},{createRoot:t}]=await Promise.all([import(`./util-VO98TdOz.js`),import(`./src-r6ZFgWPx2.js`)]);await e(await t(Cc(!1)))}),t.command(`install [target]`).description(`Install Work Mate native build. Use [target] to specify version (stable, latest, or specific version)`).option(`--force`,`Force installation even if already installed`).action(async(e,t)=>{let{installHandler:n}=await import(`./util-VO98TdOz.js`);await n(e,t)}),t.command(`update`).description(`Update workmate to the latest version`).action(async()=>{let{updateCCB:e}=await import(`./updateCCB-BPe9_FW6.js`);await e()}),K(`run_before_parse`),await t.parseAsync(process.argv),K(`run_after_parse`),K(`main_after_run`),uo(),t}async function yd({hasInitialPrompt:e,hasStdin:t,verbose:n,debug:r,debugToStderr:i,print:a,outputFormat:o,inputFormat:s,numAllowedTools:c,numDisallowedTools:l,mcpClientCount:u,worktreeEnabled:d,skipWebFetchPreflight:f,githubActionInputs:ee,dangerouslySkipPermissionsPassed:h,permissionMode:g,modeIsBypass:te,allowDangerouslySkipPermissionsPassed:ne,systemPromptFlag:re,appendSystemPromptFlag:ie,thinkingConfig:ae,assistantActivationPath:oe}){try{G(`tengu_init`,{entrypoint:`claude`,hasInitialPrompt:e,hasStdin:t,verbose:n,debug:r,debugToStderr:i,print:a,outputFormat:o,inputFormat:s,numAllowedTools:c,numDisallowedTools:l,mcpClientCount:u,worktree:d,skipWebFetchPreflight:f,...ee&&{githubActionInputs:ee},dangerouslySkipPermissionsPassed:h,permissionMode:g,modeIsBypass:te,inProtectedNamespace:m(),allowDangerouslySkipPermissionsPassed:ne,thinkingType:ae.type,...ae.type===`enabled`&&{thinkingBudgetTokens:ae.budgetTokens},...re&&{systemPromptFlag:re},...ie&&{appendSystemPromptFlag:ie},is_simple:p()||void 0,...oe&&{assistantActivationPath:oe},autoUpdatesChannel:wa().autoUpdatesChannel??`latest`})}catch(e){U(e)}}function bd(t){if(t.proactive||d(process.env.CLAUDE_CODE_PROACTIVE)){let t=(As(),e(Ms));t.isProactiveActive()||t.activateProactive(`command`)}}function xd(){(process.stderr.isTTY?process.stderr:process.stdout.isTTY?process.stdout:void 0)?.write(Zr)}export{gd as main};