claude-code-best 2.6.11 → 2.6.13

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 (484) hide show
  1. package/dist/chunks/{AddWorkspaceDirectory-CGKtPsTK.js → AddWorkspaceDirectory-BKIYdg96.js} +1 -1
  2. package/dist/chunks/{App-DF28Bpg9.js → App-BAwWP3iN.js} +1 -1
  3. package/dist/chunks/ApproveApiKey-CJFvgVKS.js +1 -0
  4. package/dist/chunks/{ApproveApiKey-D21kbmQj.js → ApproveApiKey-da08NX2f.js} +1 -1
  5. package/dist/chunks/{AssistantSessionChooser-CDfwNVi5.js → AssistantSessionChooser-DQMKGO_q.js} +1 -1
  6. package/dist/chunks/BackgroundTasksDialog-Jtiqm4k2.js +2 -0
  7. package/dist/chunks/{BypassPermissionsModeDialog-BDWFw61G.js → BypassPermissionsModeDialog-D7TJ4Qn1.js} +1 -1
  8. package/dist/chunks/{ClaudeInChromeOnboarding-CpN0yIU_.js → ClaudeInChromeOnboarding-CuPz5Xfi.js} +1 -1
  9. package/dist/chunks/ClaudeMdExternalIncludesDialog-CRC6kEV1.js +1 -0
  10. package/dist/chunks/{ClaudeMdExternalIncludesDialog-CWRHpy22.js → ClaudeMdExternalIncludesDialog-J0uv5XzG.js} +1 -1
  11. package/dist/chunks/ConsoleOAuthFlow-CE4OlAHo.js +1 -0
  12. package/dist/chunks/{DesktopHandoff-CKHLXiwc.js → DesktopHandoff-B_vNnZS5.js} +1 -1
  13. package/dist/chunks/{DevChannelsDialog-BwMFW7Wt.js → DevChannelsDialog-kjRnWtNf.js} +1 -1
  14. package/dist/chunks/{DiffDialog-oA1v0BMo.js → DiffDialog-CSBWOnXJ.js} +2 -2
  15. package/dist/chunks/Doctor-DhK599q8.js +1 -0
  16. package/dist/chunks/Doctor-VJ5ZGb8g.js +3 -0
  17. package/dist/chunks/{ExitFlow-DJLYN-Bd.js → ExitFlow-M5XPGBHL.js} +2 -2
  18. package/dist/chunks/{Feedback-CpfhqIEv.js → Feedback-FHvqI2bu.js} +2 -2
  19. package/dist/chunks/Grove-68muTpx6.js +1 -0
  20. package/dist/chunks/{Grove-BugC6ssx.js → Grove-BC2IZIhN.js} +1 -1
  21. package/dist/chunks/{HybridTransport-PeXWuYfl.js → HybridTransport-Df_FceV2.js} +1 -1
  22. package/dist/chunks/{ITermBackend-dcs68DGS.js → ITermBackend-DkpK9X1H.js} +1 -1
  23. package/dist/chunks/{InvalidConfigDialog-DdB9_Ve0.js → InvalidConfigDialog-Cm6Yvt00.js} +1 -1
  24. package/dist/chunks/{InvalidSettingsDialog-BL8nxwWQ.js → InvalidSettingsDialog-Ai3D8AL1.js} +1 -1
  25. package/dist/chunks/MCPConnectionManager-BqNXYQEr.js +1 -0
  26. package/dist/chunks/{McpParsingWarnings-BYPXpmte.js → McpParsingWarnings-BZcVbGhE.js} +1 -1
  27. package/dist/chunks/MessageSelector-BXOoEogr.js +3 -0
  28. package/dist/chunks/Messages-F6OIAv8C.js +11 -0
  29. package/dist/chunks/{Onboarding-ByLnHSnW.js → Onboarding-n1aA7tmN.js} +1 -1
  30. package/dist/chunks/{OverageCreditUpsell-CVNfTSKG.js → OverageCreditUpsell-Bt23I92r.js} +1 -1
  31. package/dist/chunks/{PluginSettings-h9Lj0vW6.js → PluginSettings-Dgu23nzv.js} +3 -3
  32. package/dist/chunks/{PromptInputFooterSuggestions-CYWSLCgA.js → PromptInputFooterSuggestions-uiV23aG4.js} +1 -1
  33. package/dist/chunks/{PromptInputHelpMenu-BsYNhZCw.js → PromptInputHelpMenu-D84vnNKM.js} +1 -1
  34. package/dist/chunks/QueryEngine-CEodAvI2.js +1 -0
  35. package/dist/chunks/{REPL-CV12-ns7.js → REPL-CTTa9BK0.js} +34 -34
  36. package/dist/chunks/REPL-IO7wsKaQ.js +1 -0
  37. package/dist/chunks/{RemoteCallout-WWO84za-.js → RemoteCallout-BYKqws96.js} +1 -1
  38. package/dist/chunks/{RemoteSessionManager-Dx2skKnM.js → RemoteSessionManager-Dq0W_fcj.js} +2 -2
  39. package/dist/chunks/ResumeConversation-CxzeCdL8.js +1 -0
  40. package/dist/chunks/{SSETransport-BHdzk1HO.js → SSETransport-CJrrD1ln.js} +1 -1
  41. package/dist/chunks/SearchExtraToolsTool-DI-36R5p.js +1 -0
  42. package/dist/chunks/SentryErrorBoundary-BKPxEWOf.js +1 -0
  43. package/dist/chunks/{SentryErrorBoundary-CmewX8Dv.js → SentryErrorBoundary-CcI0kkLW.js} +1 -1
  44. package/dist/chunks/Settings-CGcBR9CD.js +2 -0
  45. package/dist/chunks/{TeleportProgress-BmbhZlOg.js → TeleportProgress-C7muqjDw.js} +1 -1
  46. package/dist/chunks/TeleportRepoMismatchDialog-B3pUiRc2.js +1 -0
  47. package/dist/chunks/{TeleportResumeWrapper-BlkvOdYn.js → TeleportResumeWrapper-ClyBQR3K.js} +1 -1
  48. package/dist/chunks/{ThemePicker-v_3lh136.js → ThemePicker-CGIB6YiW.js} +1 -1
  49. package/dist/chunks/{TmuxBackend-B7Nabc5t.js → TmuxBackend-m2ldrneQ.js} +1 -1
  50. package/dist/chunks/{TrustDialog-CHu5eoeR.js → TrustDialog-o5kqmn6m.js} +1 -1
  51. package/dist/chunks/{ValidationErrorsList-BSMetgqr.js → ValidationErrorsList-D7bXMb0U.js} +1 -1
  52. package/dist/chunks/{WelcomeV2-DZfBSTu5.js → WelcomeV2-Ckp3JPnA.js} +1 -1
  53. package/dist/chunks/{WindowsTerminalBackend-CeSoQ_Nk.js → WindowsTerminalBackend-DsDqNWSP.js} +2 -2
  54. package/dist/chunks/{add-dir-7UeFZkdv.js → add-dir-DTP3NrLy.js} +1 -1
  55. package/dist/chunks/{agentDisplay-DJgsfIlm.js → agentDisplay-BEn43jMP.js} +1 -1
  56. package/dist/chunks/{agents-DD7gQVZD.js → agents-3ii2LyeQ.js} +1 -1
  57. package/dist/chunks/{agents-DK0y9jId.js → agents-g0PDZl_l.js} +7 -7
  58. package/dist/chunks/{ant-PhgMZT08.js → ant-PZvt_t1G.js} +1 -1
  59. package/dist/chunks/{api-nHsRf03G.js → api-BRckHGQ5.js} +1 -1
  60. package/dist/chunks/api-DBvyymX6.js +1 -0
  61. package/dist/chunks/{assistant-DO7RAhd3.js → assistant-BBmaU8-A.js} +1 -1
  62. package/dist/chunks/{assistant-BJbeizyH.js → assistant-CMaN0QzY.js} +1 -1
  63. package/dist/chunks/assistant-CVhvOfqJ.js +1 -0
  64. package/dist/chunks/auth-BXzbkJcE.js +1 -0
  65. package/dist/chunks/{auth-DxRiJwZ-.js → auth-Cud9tPJB.js} +1 -1
  66. package/dist/chunks/{autoMode-BswSpjo5.js → autoMode-BREcJLYf.js} +6 -6
  67. package/dist/chunks/{autonomy-CNJQwoAQ.js → autonomy-CuQizTZi.js} +1 -1
  68. package/dist/chunks/{autonomy-Lc78acHX.js → autonomy-h9vver1r.js} +12 -12
  69. package/dist/chunks/{autonomyPanel-DxcumRp-.js → autonomyPanel-DVyrTxfP.js} +1 -1
  70. package/dist/chunks/backgroundHousekeeping-DwA5WO9N.js +1 -0
  71. package/dist/chunks/backgroundHousekeeping-Ij_q7KN8.js +17 -0
  72. package/dist/chunks/{branch-BPsUW1dk.js → branch-B9AQFFTX.js} +2 -2
  73. package/dist/chunks/{bridge-DcOGvDbb.js → bridge-BkL7g0ua.js} +2 -2
  74. package/dist/chunks/bridgeConfig-BPP3lJRh.js +1 -0
  75. package/dist/chunks/{bridgeConfig-CvKdNJOg.js → bridgeConfig-BZQBBfap.js} +1 -1
  76. package/dist/chunks/{bridgeEnabled-D01faWms.js → bridgeEnabled-Bkmqv-2V.js} +1 -1
  77. package/dist/chunks/bridgeEnabled-BwBjPmEE.js +1 -0
  78. package/dist/chunks/bridgeMain-CbGj0plH.js +68 -0
  79. package/dist/chunks/bridgeMain-DpQRGiMo.js +1 -0
  80. package/dist/chunks/{bridgeMessaging-BZMDSZAN.js → bridgeMessaging-C-ZFPTiZ.js} +1 -1
  81. package/dist/chunks/{btw-B8s-X_cm.js → btw-BSme4Kzi.js} +1 -1
  82. package/dist/chunks/{buddy-DkB1xU1o.js → buddy-DX94yYTy.js} +1 -1
  83. package/dist/chunks/{bypassPermissionsKillswitch-B9Qz9zKO.js → bypassPermissionsKillswitch-Crl2aipx.js} +1 -1
  84. package/dist/chunks/{caches-BuSzLvN9.js → caches-DeXmHls9.js} +2 -2
  85. package/dist/chunks/caches-U1iFQIc7.js +1 -0
  86. package/dist/chunks/{ccrClient-CMZXfu9P.js → ccrClient-BYD1ONzC.js} +1 -1
  87. package/dist/chunks/changeDetector-PaQPe1HQ.js +1 -0
  88. package/dist/chunks/channelNotification-Aq0p9f-W.js +1 -0
  89. package/dist/chunks/{channelNotification-t6Kgu-vX.js → channelNotification-B0QskFjB.js} +1 -1
  90. package/dist/chunks/{chrome-Cvkozg2F.js → chrome-B8ByN3u6.js} +1 -1
  91. package/dist/chunks/clear-CeJ5tgg8.js +1 -0
  92. package/dist/chunks/client-B7AdqRap.js +1 -0
  93. package/dist/chunks/color-OlMWmMnJ.js +1 -0
  94. package/dist/chunks/commands-BwfOl3fk.js +1 -0
  95. package/dist/chunks/{commitAttribution-CUqUEjsh.js → commitAttribution-C479aqmn.js} +1 -1
  96. package/dist/chunks/commitAttribution-CZ1OOh8F.js +1 -0
  97. package/dist/chunks/compact-Dq-J7j1C.js +3 -0
  98. package/dist/chunks/{companion-Cf_kYtOD.js → companion-CtJjyD3N.js} +1 -1
  99. package/dist/chunks/{config-45GLd-lt.js → config-DcnYYwCy.js} +1 -1
  100. package/dist/chunks/{config-JGm0O-ZQ.js → config-_KcvL7RX.js} +1 -1
  101. package/dist/chunks/{context-Bl5VUX5M.js → context-CShSBp-i.js} +1 -1
  102. package/dist/chunks/{context-noninteractive-DdPFYYO9.js → context-noninteractive-BApFNncX.js} +2 -2
  103. package/dist/chunks/context-noninteractive-uMvPKhng.js +1 -0
  104. package/dist/chunks/conversation-BlUHkj1_.js +1 -0
  105. package/dist/chunks/conversation-CCzL-eYb.js +1 -0
  106. package/dist/chunks/{copy-CbhxPqw4.js → copy-DIMR3Q3S.js} +2 -2
  107. package/dist/chunks/{createSSHSession-Dq2nMChz.js → createSSHSession-DvSnUdsD.js} +1 -1
  108. package/dist/chunks/createSession-D8tcktmP.js +1 -0
  109. package/dist/chunks/{createSession-DTHPUie-.js → createSession-DaT4x1E6.js} +1 -1
  110. package/dist/chunks/{cronJitterConfig-IGWCRDrv.js → cronJitterConfig-C2a-Ybqm.js} +3 -3
  111. package/dist/chunks/crossProjectResume-B3Chhiwf.js +40 -0
  112. package/dist/chunks/{daemon-VYRit6Aq.js → daemon-CCtZ9wY3.js} +1 -1
  113. package/dist/chunks/datadog-BYNSi8R3.js +1 -0
  114. package/dist/chunks/{datadog-FKvRNyFi.js → datadog-DCukMGn4.js} +1 -1
  115. package/dist/chunks/{desktop-ZASE3YWy.js → desktop-BXj3JEMV.js} +1 -1
  116. package/dist/chunks/{diff-QP-TbxuD.js → diff-D3Xuv_4J.js} +1 -1
  117. package/dist/chunks/{doctor-DVkgmkRb.js → doctor-B5-jh6lS.js} +1 -1
  118. package/dist/chunks/earlyInput-RoVleNEN.js +1 -0
  119. package/dist/chunks/{effort-DbryQCua.js → effort-CpHnXRxJ.js} +2 -2
  120. package/dist/chunks/{entry-D8y42iuM.js → entry-YXnIL7B7.js} +8 -8
  121. package/dist/chunks/envLessBridgeConfig-CcgSiwvA.js +1 -0
  122. package/dist/chunks/{envLessBridgeConfig-D4bSwf7w.js → envLessBridgeConfig-MaElAFPV.js} +1 -1
  123. package/dist/chunks/exit-DKG0r57m.js +1 -0
  124. package/dist/chunks/{export-C9A9nOA1.js → export-BNbcpW3p.js} +1 -1
  125. package/dist/chunks/{exportRenderer-CyTuZFFF.js → exportRenderer-pYMIcnO4.js} +1 -1
  126. package/dist/chunks/extra-usage-DTXphHAD.js +1 -0
  127. package/dist/chunks/{extra-usage-C6s5mXW0.js → extra-usage-H-U38bGx.js} +1 -1
  128. package/dist/chunks/{extra-usage-core-BFCwz3XM.js → extra-usage-core-N4VLj0ye.js} +1 -1
  129. package/dist/chunks/{extra-usage-noninteractive-IHq7s6wm.js → extra-usage-noninteractive-BGUiGr3a.js} +1 -1
  130. package/dist/chunks/{extraUsage-CIrG_Lbw.js → extraUsage-X6CmSsdg.js} +1 -1
  131. package/dist/chunks/extractMemories-C8R4DJVc.js +1 -0
  132. package/dist/chunks/{fast-NEKXVZqQ.js → fast-BJwQnvAP.js} +1 -1
  133. package/dist/chunks/fast-DMkPYQmQ.js +1 -0
  134. package/dist/chunks/{feedback-D5iWO16P.js → feedback-DLcYu4id.js} +1 -1
  135. package/dist/chunks/{firstPartyEventLogger-Dr3TK3IU.js → firstPartyEventLogger-C00GfHTl.js} +1 -1
  136. package/dist/chunks/{flushGate-DygHyqmB.js → flushGate-0DZFLUEb.js} +1 -1
  137. package/dist/chunks/{gates-Dyz_t5zJ.js → gates-DP4JyL5e.js} +1 -1
  138. package/dist/chunks/gates-DeLWne9R.js +1 -0
  139. package/dist/chunks/gemini-CnKaXUJJ.js +1 -0
  140. package/dist/chunks/{generateRecap-DZiXeYWn.js → generateRecap-BUS2DEdj.js} +1 -1
  141. package/dist/chunks/{generateSessionName-EbB2vl9t.js → generateSessionName-CnPPgvyy.js} +1 -1
  142. package/dist/chunks/{githubRepoPathMapping-dky2fPeU.js → githubRepoPathMapping-CnXpQRPY.js} +1 -1
  143. package/dist/chunks/grok-C2BUbWJR.js +1 -0
  144. package/dist/chunks/{growthbook-JD-WW3yV.js → growthbook-CPTqwUyC.js} +1 -1
  145. package/dist/chunks/{heapdump-8vyFTWly.js → heapdump-pamjtM2a.js} +1 -1
  146. package/dist/chunks/{help-C2DM0p8U.js → help-z7XnNKDT.js} +1 -1
  147. package/dist/chunks/hooks-BEAaBqmd.js +1 -0
  148. package/dist/chunks/{hooks-CMh0a2pT.js → hooks-iTfSDH96.js} +2 -2
  149. package/dist/chunks/{hostAdapter-CmbGfgNV.js → hostAdapter-DWD430of.js} +1 -1
  150. package/dist/chunks/{ide-Bn8R7397.js → ide-BK8Td_CD.js} +2 -2
  151. package/dist/chunks/{inboundAttachments-BweY9sYo.js → inboundAttachments-DQ4Czsr5.js} +1 -1
  152. package/dist/chunks/inboundAttachments-Dq3IYudc.js +1 -0
  153. package/dist/chunks/initReplBridge-BeGirV3Q.js +1 -0
  154. package/dist/chunks/{insights-NOl_PxhN.js → insights-DfD6PMkd.js} +64 -64
  155. package/dist/chunks/{install-BoT2GIcz.js → install-CNq--Fit.js} +1 -1
  156. package/dist/chunks/{install-github-app-SD4PvrTR.js → install-github-app-Dhq_T_EJ.js} +2 -2
  157. package/dist/chunks/{install-slack-app-DLQXpOCt.js → install-slack-app-mz5O3xo_.js} +1 -1
  158. package/dist/chunks/{instrumentation-BXJk0mxI.js → instrumentation-CM0poWjx.js} +3 -3
  159. package/dist/chunks/{job-CnlMlm3t.js → job-CKI1I_Va.js} +1 -1
  160. package/dist/chunks/{keybindings-BjaRqcbD.js → keybindings-5qahtcNc.js} +2 -2
  161. package/dist/chunks/{lang-BI8CzjL6.js → lang-BMNwfSRv.js} +1 -1
  162. package/dist/chunks/{language-CRIdgj2F.js → language-DXpi4083.js} +1 -1
  163. package/dist/chunks/language-GlWQb4l9.js +1 -0
  164. package/dist/chunks/{launchAgentsPlatform-Bg9guiqy.js → launchAgentsPlatform-BU4bAPan.js} +1 -1
  165. package/dist/chunks/{launchAutofixPr-BMfXGXwN.js → launchAutofixPr-B80p6iq-.js} +3 -3
  166. package/dist/chunks/{launchLocalMemory-lgnXOi6U.js → launchLocalMemory-CDAa9B30.js} +2 -2
  167. package/dist/chunks/{launchLocalVault-C0Oz-lto.js → launchLocalVault-B19lF8tP.js} +3 -3
  168. package/dist/chunks/{launchMemoryStores-Bw11ruRi.js → launchMemoryStores-C6wJI-8V.js} +1 -1
  169. package/dist/chunks/{launchOnboarding-WEW34cnl.js → launchOnboarding-BIlwEdkk.js} +1 -1
  170. package/dist/chunks/{launchSchedule-X0rcM_kM.js → launchSchedule-DjMh3--x.js} +1 -1
  171. package/dist/chunks/{launchSkillStore-DpxSlMCU.js → launchSkillStore-Bs5thijU.js} +1 -1
  172. package/dist/chunks/{launchTeleport-uOtMsYcI.js → launchTeleport-CDlWx4xC.js} +2 -2
  173. package/dist/chunks/{launchVault-CJyJaPqH.js → launchVault-C40NAyOp.js} +1 -1
  174. package/dist/chunks/loadAgentsDir-BYqiLHDS.js +1 -0
  175. package/dist/chunks/{loadAgentsDir-D-xcJ22-.js → loadAgentsDir-C9Ee_fs1.js} +793 -749
  176. package/dist/chunks/loadPluginHooks-DaETszNq.js +1 -0
  177. package/dist/chunks/{localSearch-B6Ho7Vfj.js → localSearch-B3zijtEM.js} +1 -1
  178. package/dist/chunks/localSearch-BTGnGPVi.js +1 -0
  179. package/dist/chunks/{login-uOvq1xN_.js → login-B3IQj5YQ.js} +1 -1
  180. package/dist/chunks/login-CUM0odSh.js +1 -0
  181. package/dist/chunks/{logoV2Utils-C2cdcgtp.js → logoV2Utils-CW73xjcW.js} +1 -1
  182. package/dist/chunks/logout-B3hPrJSX.js +1 -0
  183. package/dist/chunks/{magicDocs-BBjAhGN1.js → magicDocs-BysWdjbO.js} +2 -2
  184. package/dist/chunks/{main-DGsAUuG_.js → main-CnAyCMYQ.js} +48 -48
  185. package/dist/chunks/{mappers-CO6koWDa.js → mappers-D1SAyuKF.js} +1 -1
  186. package/dist/chunks/mcp-BIiXcANN.js +1 -0
  187. package/dist/chunks/mcp-BLcZi9zs.js +2 -0
  188. package/dist/chunks/mcp-nOKz2_By.js +6 -0
  189. package/dist/chunks/{mcpServer-C-0K3Azg.js → mcpServer-CJOTyq3O.js} +1 -1
  190. package/dist/chunks/{mcpServer-C_aDoLMg.js → mcpServer-DaiouIKs.js} +1 -1
  191. package/dist/chunks/memory-DtFuXZHl.js +1 -0
  192. package/dist/chunks/mode-BPNUYCpk.js +2 -0
  193. package/dist/chunks/model-Cky6xlFt.js +1 -0
  194. package/dist/chunks/{model-CrAPXYZA.js → model-DC5bOhtE.js} +1 -1
  195. package/dist/chunks/{onChangeAppState-C6ZIU1SD.js → onChangeAppState-pafR88Yw.js} +1 -1
  196. package/dist/chunks/{openai-Cm4gozk8.js → openai-BOxlfR-k.js} +3 -3
  197. package/dist/chunks/{overageCreditGrant-Pe7C_4Qi.js → overageCreditGrant-BmmOYjTh.js} +1 -1
  198. package/dist/chunks/{panel-Bz_8td5D.js → panel-s9fbCKfl.js} +1 -1
  199. package/dist/chunks/{passes-BpI6azLG.js → passes-CqiFdifM.js} +1 -1
  200. package/dist/chunks/{paths-D9CVAtXU.js → paths-C2JRlUsH.js} +3 -3
  201. package/dist/chunks/permissions-BHJUxNga.js +3 -0
  202. package/dist/chunks/{pipeTransport-wjeyTgon.js → pipeTransport-BTYiqf9e.js} +1 -1
  203. package/dist/chunks/{plan-DA8IRpHQ.js → plan-CF_ClJlj.js} +1 -1
  204. package/dist/chunks/{plugin-N2pTkzOz.js → plugin-Bz3RKbru.js} +1 -1
  205. package/dist/chunks/{pluginAutoupdate-DCc5qDvo.js → pluginAutoupdate-Ck0wWoNE.js} +1 -1
  206. package/dist/chunks/pluginBlocklist-7dlesHcW.js +1 -0
  207. package/dist/chunks/{pluginCliCommands-BN7loc5T.js → pluginCliCommands-D502zE25.js} +1 -1
  208. package/dist/chunks/{pluginFlagging-Dpu1cvMo.js → pluginFlagging-DfHARfd-.js} +1 -1
  209. package/dist/chunks/pluginOperations-BBRf8tuH.js +2 -0
  210. package/dist/chunks/{pluginStartupCheck-DvWHwNnD.js → pluginStartupCheck-BKEhWQR2.js} +1 -1
  211. package/dist/chunks/pluginStartupCheck-ZcaocOSL.js +1 -0
  212. package/dist/chunks/plugins-JnZ3lNqG.js +4 -0
  213. package/dist/chunks/policyLimits-CtOjYdHx.js +1 -0
  214. package/dist/chunks/{pollConfig-xYxAmuXi.js → pollConfig-Duecunu0.js} +1 -1
  215. package/dist/chunks/{poor-C0KwfFF0.js → poor-CUwZAV9z.js} +1 -1
  216. package/dist/chunks/poorMode-DOoZ0U-8.js +1 -0
  217. package/dist/chunks/{poorMode-D7WXWZtJ.js → poorMode-DRcH1fuh.js} +1 -1
  218. package/dist/chunks/print-D9IhN66j.js +39 -0
  219. package/dist/chunks/{privacy-settings-DT3LGgsH.js → privacy-settings-DmbuvR-R.js} +1 -1
  220. package/dist/chunks/processBashCommand-Cg8we9vS.js +1 -0
  221. package/dist/chunks/processSlashCommand-BBQQEGZd.js +6 -0
  222. package/dist/chunks/{projectContext-0fpRKUeH.js → projectContext-D5FgyE-d.js} +1 -1
  223. package/dist/chunks/prompt-7Vt8FUX_.js +1 -0
  224. package/dist/chunks/prompt-Cj0hg3CU.js +1 -0
  225. package/dist/chunks/{prompt-C69iv9cI.js → prompt-thBQB2X5.js} +1 -1
  226. package/dist/chunks/{promptEditor-BZqpLrcZ.js → promptEditor-C8B2TEXp.js} +2 -2
  227. package/dist/chunks/{protocolHandler-CfmBTg36.js → protocolHandler-BUKWgksO.js} +1 -1
  228. package/dist/chunks/rate-limit-options-PruvKAQt.js +1 -0
  229. package/dist/chunks/{rcDebugLog-CTOZ2K3E.js → rcDebugLog-CIS3PU-H.js} +1 -1
  230. package/dist/chunks/{referral-D26orIXE.js → referral-CXmDvb7V.js} +1 -1
  231. package/dist/chunks/refresh-C_FDHRT7.js +1 -0
  232. package/dist/chunks/{registerProtocol-DSQh-I21.js → registerProtocol-WxQUBybC.js} +1 -1
  233. package/dist/chunks/registry-CeBTik9J.js +1 -0
  234. package/dist/chunks/{release-notes-Cg85UVo8.js → release-notes-aZ6QUVnT.js} +1 -1
  235. package/dist/chunks/{releaseNotes-Dps4SeVh.js → releaseNotes-2GPd_O_r.js} +2 -2
  236. package/dist/chunks/{reload-plugins-Bo-R1CF3.js → reload-plugins-BDh4ZhHi.js} +1 -1
  237. package/dist/chunks/{remote-env-ChQuV3rO.js → remote-env-BIOFHNQC.js} +1 -1
  238. package/dist/chunks/{remoteBridgeCore-BXtygJA-.js → remoteBridgeCore-DyA_2GrL.js} +1 -1
  239. package/dist/chunks/{remoteControlServer-sqW_JLwC.js → remoteControlServer-BjW9GsPd.js} +2 -2
  240. package/dist/chunks/rename-CKlAeppY.js +1 -0
  241. package/dist/chunks/{resume-CtOI2pOJ.js → resume-Dm71Aeni.js} +2 -2
  242. package/dist/chunks/{runtimeObserver-DojpbVgU.js → runtimeObserver-BYOo5dT0.js} +1 -1
  243. package/dist/chunks/{runtimeObserver-CJ955XSo.js → runtimeObserver-CA7pdBvT.js} +3 -3
  244. package/dist/chunks/sandbox-adapter-C7TBAehE.js +1 -0
  245. package/dist/chunks/{sandbox-toggle-B9dn09gt.js → sandbox-toggle-fHc9E9xW.js} +1 -1
  246. package/dist/chunks/searchExtraTools-CpFsg_tS.js +1 -0
  247. package/dist/chunks/{sentry-B6tWUNGj.js → sentry-B1g5Tgp2.js} +1 -1
  248. package/dist/chunks/{session-C5yIf_zV.js → session-C46oy7nX.js} +2 -2
  249. package/dist/chunks/{sessionDiscovery-CQ3iMN4s.js → sessionDiscovery-CtrJ2Bfr.js} +1 -1
  250. package/dist/chunks/sessionFileAccessHooks-dwF5SFoS.js +1 -0
  251. package/dist/chunks/sessionMemory-BqCsLnFl.js +1 -0
  252. package/dist/chunks/sessionMemory-D4-Ymn0Q.js +1 -0
  253. package/dist/chunks/sessionMemoryUtils-BKdYMir6.js +1 -0
  254. package/dist/chunks/sessionObserver-Bfu8q0_K.js +1 -0
  255. package/dist/chunks/{sessionObserver-MQA9_wZw.js → sessionObserver-DoBuLaCJ.js} +1 -1
  256. package/dist/chunks/sessionStorage-CUUU_J4D.js +1 -0
  257. package/dist/chunks/{sessionTitle-BafqFHLc.js → sessionTitle-BOM0LQlq.js} +1 -1
  258. package/dist/chunks/{sessionTracing-_obALZbi.js → sessionTracing-BEKULg2L.js} +1 -1
  259. package/dist/chunks/{settingsSync-DBWi-NXU.js → settingsSync-BIsGiZhM.js} +1 -1
  260. package/dist/chunks/{setup-DIxsjw17.js → setup-C3FOTg1s.js} +1 -1
  261. package/dist/chunks/{setup-C_GrS0Rd.js → setup-ChF37I92.js} +1 -1
  262. package/dist/chunks/setup-DvFPFV-3.js +2 -0
  263. package/dist/chunks/{shadowedRuleDetection-CwMwv9uM.js → shadowedRuleDetection-spwhhTXF.js} +1 -1
  264. package/dist/chunks/{sideQuestion-CI5pyoQF.js → sideQuestion-iy7kJEkr.js} +2 -2
  265. package/dist/chunks/{sink-BSTUubjl.js → sink-D6dxOYIw.js} +1 -1
  266. package/dist/chunks/sink-FeQonv8-.js +1 -0
  267. package/dist/chunks/sinks-DKMqKJ66.js +1 -0
  268. package/dist/chunks/{sinks-B9EsWFeb.js → sinks-zNh_PVeS.js} +2 -2
  269. package/dist/chunks/{skill-learning-DThetLpo.js → skill-learning-ChAFwJf0.js} +1 -1
  270. package/dist/chunks/skillChangeDetector-8LVraP0Y.js +1 -0
  271. package/dist/chunks/{skillGapStore-BmjCK9ZR.js → skillGapStore-CUws9CQ6.js} +2 -2
  272. package/dist/chunks/{skillGapStore-ax0GuSmd.js → skillGapStore-CdPgIARS.js} +1 -1
  273. package/dist/chunks/{skillGenerator-Dj3xInwG.js → skillGenerator-CLtTRIjy.js} +2 -2
  274. package/dist/chunks/skillLearning-CBosoKl-.js +1 -0
  275. package/dist/chunks/skillLearning-f7-aknmS.js +1 -0
  276. package/dist/chunks/{skillPanel-CJ4tvX7A.js → skillPanel-Cd0AFEZf.js} +3 -3
  277. package/dist/chunks/{skillSearchPanel-hwZvXKZ4.js → skillSearchPanel-VWiAbmdr.js} +3 -3
  278. package/dist/chunks/{skills-BVWDDcD9.js → skills-oQtI4eDn.js} +1 -1
  279. package/dist/chunks/{sprites-B-V9otkt.js → sprites-Cp4_DJUI.js} +1 -1
  280. package/dist/chunks/{stats-DcS6ZnsX.js → stats-B1X-nxO8.js} +1 -1
  281. package/dist/chunks/{status-DZKjK9CE.js → status-BtCnWZEv.js} +1 -1
  282. package/dist/chunks/statusNoticeHelpers-B6GW2gMe.js +1 -0
  283. package/dist/chunks/{tag-B5b-waIf.js → tag-B6WpuUE_.js} +2 -2
  284. package/dist/chunks/{tasks-vXM-vULI.js → tasks-DIOPZDoF.js} +1 -1
  285. package/dist/chunks/{teamHelpers-CbFFdvPw.js → teamHelpers-9p7wPcXj.js} +1 -1
  286. package/dist/chunks/teamHelpers-PLGwYL4x.js +1 -0
  287. package/dist/chunks/teammateModeSnapshot-DO-3AkNP.js +1 -0
  288. package/dist/chunks/{teammateModeSnapshot-DkkMv2-b.js → teammateModeSnapshot-DU8JCRRs.js} +1 -1
  289. package/dist/chunks/teleport-DPUoWpD4.js +1 -0
  290. package/dist/chunks/{templateJobs-BLQqrGjb.js → templateJobs-DOSQvjx0.js} +1 -1
  291. package/dist/chunks/{terminalSetup-BLU99dau.js → terminalSetup-DdHkyElj.js} +1 -1
  292. package/dist/chunks/{terminalSetup-BKfVYk3w.js → terminalSetup-tSFJeCVl.js} +1 -1
  293. package/dist/chunks/{theme-BM2CXWYE.js → theme-Hf1fhR3q.js} +1 -1
  294. package/dist/chunks/thinkback-5QYAbr0P.js +1 -0
  295. package/dist/chunks/thinkback-B5IraP81.js +1 -0
  296. package/dist/chunks/thinkback-play-Bqv85sjY.js +1 -0
  297. package/dist/chunks/{toolEventObserver-71WYUega.js → toolEventObserver-B-mqmRv0.js} +1 -1
  298. package/dist/chunks/{toolEventObserver-nxcfjaur.js → toolEventObserver-_Fk1dSYg.js} +1 -1
  299. package/dist/chunks/toolPool-C2KLBvek.js +1 -0
  300. package/dist/chunks/toolPool-CiEaFfxq.js +1 -0
  301. package/dist/chunks/{trustedDevice-C0KJ0qiK.js → trustedDevice-BowIKqqC.js} +1 -1
  302. package/dist/chunks/{trustedDevice-Brc9B8cZ.js → trustedDevice-f8HslQu2.js} +1 -1
  303. package/dist/chunks/{tui-BVc2q4Xv.js → tui-geoc3zxu.js} +1 -1
  304. package/dist/chunks/{ultrareviewCommand-BY0T8Pzl.js → ultrareviewCommand-DbmRN6Lg.js} +2 -2
  305. package/dist/chunks/{undercover-j27F8p49.js → undercover-Ch9wnIbk.js} +1 -1
  306. package/dist/chunks/undercover-X6-EJ_7K.js +1 -0
  307. package/dist/chunks/{updateCCB-Dgb2ed9v.js → updateCCB-DFHrOTEX.js} +1 -1
  308. package/dist/chunks/{upgrade-zs7K9UkG.js → upgrade-B6Ih-Ubj.js} +1 -1
  309. package/dist/chunks/upgrade-CC4cnsnt.js +1 -0
  310. package/dist/chunks/{upload-Df84yCBz.js → upload-DSTB33ZR.js} +1 -1
  311. package/dist/chunks/{usage-DKENFl_k.js → usage-CNqpSfd2.js} +1 -1
  312. package/dist/chunks/{usage-lTILrQJV.js → usage-DiZsjcMM.js} +1 -1
  313. package/dist/chunks/useMainLoopModel-Bo6iEtB3.js +1 -0
  314. package/dist/chunks/{useManagePlugins-DDKeDfIv.js → useManagePlugins-Cvj0XfLp.js} +1 -1
  315. package/dist/chunks/useMergedTools-BEpwy0Ec.js +1 -0
  316. package/dist/chunks/{useSearchInput-DNpNG36H.js → useSearchInput-YiO4crrI.js} +1 -1
  317. package/dist/chunks/useSettingsErrors-BE-PITl4.js +1 -0
  318. package/dist/chunks/{useVoice-DmObXoAh.js → useVoice-D1sKPiqb.js} +1 -1
  319. package/dist/chunks/{util-9vJ9WIeZ.js → util-C8_5375U.js} +1 -1
  320. package/dist/chunks/utils-Dmh9vBcg.js +1 -0
  321. package/dist/chunks/validatePlugin-BQA60S_J.js +1 -0
  322. package/dist/chunks/{vim-CK7lReJi.js → vim-oNiLgw0C.js} +1 -1
  323. package/dist/chunks/{voice-BLVF7E3Q.js → voice-CGsMzVaA.js} +2 -2
  324. package/dist/chunks/voiceModeEnabled-DprM_JSH.js +1 -0
  325. package/dist/chunks/{voiceModeEnabled-BpLBjY2-.js → voiceModeEnabled-Dpx-sP8V.js} +1 -1
  326. package/dist/chunks/voiceStreamSTT-CASv4SGl.js +1 -0
  327. package/dist/chunks/{voiceStreamSTT-i4tUq3Hu.js → voiceStreamSTT-CaI5Uz-7.js} +1 -1
  328. package/dist/chunks/{workerRegistry-Bg7dWLHf.js → workerRegistry-CCYrYthd.js} +1 -1
  329. package/dist/chunks/worktree-C9WNXNFR.js +1 -0
  330. package/dist/chunks/{xml-K_hNNh2b.js → xml-BW5T-oW-.js} +1 -1
  331. package/dist/cli.js +1 -1
  332. package/package.json +1 -1
  333. package/dist/chunks/ApproveApiKey-BtiWOryM.js +0 -1
  334. package/dist/chunks/BackgroundTasksDialog-5RpkAbJz.js +0 -2
  335. package/dist/chunks/ClaudeMdExternalIncludesDialog-Dje7A0F2.js +0 -1
  336. package/dist/chunks/ConsoleOAuthFlow-DQf3dmj6.js +0 -1
  337. package/dist/chunks/Doctor-ButdpAkf.js +0 -1
  338. package/dist/chunks/Doctor-QVMo0fIh.js +0 -3
  339. package/dist/chunks/Grove-CmdRVv9F.js +0 -1
  340. package/dist/chunks/MCPConnectionManager-D2eAGUME.js +0 -1
  341. package/dist/chunks/MessageSelector-Bzq8CYAH.js +0 -3
  342. package/dist/chunks/Messages-uRxxAMW-.js +0 -11
  343. package/dist/chunks/QueryEngine-CxP2S3qi.js +0 -1
  344. package/dist/chunks/REPL-h1bwm8ee.js +0 -1
  345. package/dist/chunks/ResumeConversation-CagiCg7-.js +0 -1
  346. package/dist/chunks/SearchExtraToolsTool-BJ2d8mtx.js +0 -1
  347. package/dist/chunks/SentryErrorBoundary-CYiFofRZ.js +0 -1
  348. package/dist/chunks/Settings-BcgtW60l.js +0 -2
  349. package/dist/chunks/TeleportRepoMismatchDialog-BAwtgUhR.js +0 -1
  350. package/dist/chunks/api-D4aCzJS-.js +0 -1
  351. package/dist/chunks/assistant-Dvx-UrTi.js +0 -1
  352. package/dist/chunks/auth-Cp7Nt0ik.js +0 -1
  353. package/dist/chunks/backgroundHousekeeping-BkfWgzIP.js +0 -17
  354. package/dist/chunks/backgroundHousekeeping-BxBI2KkX.js +0 -1
  355. package/dist/chunks/bridgeConfig-Dkn5GGec.js +0 -1
  356. package/dist/chunks/bridgeEnabled-CjaYKTo5.js +0 -1
  357. package/dist/chunks/bridgeMain-Bu2oOX31.js +0 -68
  358. package/dist/chunks/bridgeMain-CEpOBx8Z.js +0 -1
  359. package/dist/chunks/caches-Bvl2jdxF.js +0 -1
  360. package/dist/chunks/changeDetector-DTXMv7gH.js +0 -1
  361. package/dist/chunks/channelNotification-B7s1OoRK.js +0 -1
  362. package/dist/chunks/clear-C9pufI6F.js +0 -1
  363. package/dist/chunks/client-CqJ5gRGj.js +0 -1
  364. package/dist/chunks/color-AYeAYKyq.js +0 -1
  365. package/dist/chunks/commands-LcLR5Vgx.js +0 -1
  366. package/dist/chunks/commitAttribution-BZupnGMc.js +0 -1
  367. package/dist/chunks/compact-BF0-0_qh.js +0 -3
  368. package/dist/chunks/context-noninteractive-BtzPsJ8k.js +0 -1
  369. package/dist/chunks/conversation-C3NWyOB3.js +0 -1
  370. package/dist/chunks/conversation-oX932vBQ.js +0 -1
  371. package/dist/chunks/createSession-1ewHG3eq.js +0 -1
  372. package/dist/chunks/crossProjectResume-WmabPBTO.js +0 -40
  373. package/dist/chunks/datadog-Da7KYZNF.js +0 -1
  374. package/dist/chunks/earlyInput-JGJo1zcC.js +0 -1
  375. package/dist/chunks/envLessBridgeConfig-CpW0G4Eh.js +0 -1
  376. package/dist/chunks/exit-BsNW67F9.js +0 -1
  377. package/dist/chunks/extra-usage-DL2C0_BM.js +0 -1
  378. package/dist/chunks/extractMemories-CA2eJwHy.js +0 -1
  379. package/dist/chunks/fast-B01NO2uA.js +0 -1
  380. package/dist/chunks/gates-BSpXbh9s.js +0 -1
  381. package/dist/chunks/gemini-BEmbnRQR.js +0 -1
  382. package/dist/chunks/grok-BM6ZJ4w2.js +0 -1
  383. package/dist/chunks/hooks-QXGwOfWj.js +0 -1
  384. package/dist/chunks/inboundAttachments-N5DKbZSl.js +0 -1
  385. package/dist/chunks/initReplBridge-3CfmzjJL.js +0 -1
  386. package/dist/chunks/language-DmbRGIs8.js +0 -1
  387. package/dist/chunks/loadAgentsDir-ILQxk_4G.js +0 -1
  388. package/dist/chunks/loadPluginHooks-BC1Ea7_D.js +0 -1
  389. package/dist/chunks/localSearch-COyJeP9E.js +0 -1
  390. package/dist/chunks/login-Cf89biEK.js +0 -1
  391. package/dist/chunks/logout-CEXwTlEX.js +0 -1
  392. package/dist/chunks/mcp-BrN_Tbq5.js +0 -6
  393. package/dist/chunks/mcp-CZltNml5.js +0 -1
  394. package/dist/chunks/mcp-D6JOqdT8.js +0 -2
  395. package/dist/chunks/memory-BYYOgo4e.js +0 -1
  396. package/dist/chunks/model-CHgqwg6N.js +0 -1
  397. package/dist/chunks/permissions-C7wcAYOc.js +0 -3
  398. package/dist/chunks/pluginBlocklist-C_Veew3p.js +0 -1
  399. package/dist/chunks/pluginOperations-CP6NFNog.js +0 -2
  400. package/dist/chunks/pluginStartupCheck-BF0xUEJG.js +0 -1
  401. package/dist/chunks/plugins-BHoniP5f.js +0 -4
  402. package/dist/chunks/policyLimits-sh7ywop0.js +0 -1
  403. package/dist/chunks/poorMode-DZQXZ_zu.js +0 -1
  404. package/dist/chunks/print-BcRG8gkQ.js +0 -39
  405. package/dist/chunks/processBashCommand-DPfJ9lrj.js +0 -1
  406. package/dist/chunks/processSlashCommand-DyPCeZux.js +0 -6
  407. package/dist/chunks/prompt-DaIJzI1P.js +0 -1
  408. package/dist/chunks/prompt-DnLsyywj.js +0 -1
  409. package/dist/chunks/rate-limit-options-P7oQuwrl.js +0 -1
  410. package/dist/chunks/refresh-BeSXaVya.js +0 -1
  411. package/dist/chunks/registry-Dp5W2V8B.js +0 -1
  412. package/dist/chunks/rename-Bigaipiq.js +0 -1
  413. package/dist/chunks/sandbox-adapter-BbrJOJNZ.js +0 -1
  414. package/dist/chunks/searchExtraTools-Denn1c1E.js +0 -1
  415. package/dist/chunks/sessionFileAccessHooks-1IAwziOQ.js +0 -1
  416. package/dist/chunks/sessionMemory-3TAJyNuJ.js +0 -1
  417. package/dist/chunks/sessionMemory-HZNzEOLd.js +0 -1
  418. package/dist/chunks/sessionMemoryUtils-BAkA4sGG.js +0 -1
  419. package/dist/chunks/sessionObserver-DqLMFMLM.js +0 -1
  420. package/dist/chunks/sessionStorage-CFfMypMQ.js +0 -1
  421. package/dist/chunks/setup-D1sQnli9.js +0 -2
  422. package/dist/chunks/sink-fGBOXJab.js +0 -1
  423. package/dist/chunks/sinks-BCl9slVM.js +0 -1
  424. package/dist/chunks/skillChangeDetector-BOH-fyEn.js +0 -1
  425. package/dist/chunks/skillLearning-BDsjN-u-.js +0 -1
  426. package/dist/chunks/skillLearning-CXUsWxdi.js +0 -1
  427. package/dist/chunks/statusNoticeHelpers-reCcymMR.js +0 -1
  428. package/dist/chunks/teamHelpers-BBhol4dD.js +0 -1
  429. package/dist/chunks/teammateModeSnapshot-W5G22rwQ.js +0 -1
  430. package/dist/chunks/teleport-Da0rKwCo.js +0 -1
  431. package/dist/chunks/thinkback-Cd1g_2A9.js +0 -1
  432. package/dist/chunks/thinkback-ChP6pvCS.js +0 -1
  433. package/dist/chunks/thinkback-play-Cg8Ys2dq.js +0 -1
  434. package/dist/chunks/toolPool-CN1cPGQz.js +0 -1
  435. package/dist/chunks/toolPool-CygNb5cr.js +0 -1
  436. package/dist/chunks/undercover-bx8TwG9W.js +0 -1
  437. package/dist/chunks/upgrade-BkHztwGA.js +0 -1
  438. package/dist/chunks/useMainLoopModel-X1PW9z5A.js +0 -1
  439. package/dist/chunks/useMergedTools-CC3XwtOR.js +0 -1
  440. package/dist/chunks/useSettingsErrors-vGzCYpIA.js +0 -1
  441. package/dist/chunks/utils-Dg0S2Vfn.js +0 -1
  442. package/dist/chunks/validatePlugin-_Z4zhjSx.js +0 -1
  443. package/dist/chunks/voiceModeEnabled-BqFYzoXw.js +0 -1
  444. package/dist/chunks/voiceStreamSTT-C0pkuXGm.js +0 -1
  445. package/dist/chunks/worktree-Cg4p1J__.js +0 -1
  446. /package/dist/chunks/{InProcessTransport-DB52dh4f.js → InProcessTransport-gJLr5CIx.js} +0 -0
  447. /package/dist/chunks/{attributionHooks-PygdohOh.js → attributionHooks-Br5LZ6bk.js} +0 -0
  448. /package/dist/chunks/{attributionTrailer-BpvhXgRP.js → attributionTrailer-BMTuK4Ax.js} +0 -0
  449. /package/dist/chunks/{autoModeDenials-Cp6VFdsm.js → autoModeDenials-D8eQ1CoM.js} +0 -0
  450. /package/dist/chunks/{banner-CVXH2xts.js → banner-32EBTKI7.js} +0 -0
  451. /package/dist/chunks/{bedrockClient-qi1-JCOK.js → bedrockClient-Ci523Btx.js} +0 -0
  452. /package/dist/chunks/{ccshareResume-DWLjTF22.js → ccshareResume-CqNm2k-J.js} +0 -0
  453. /package/dist/chunks/{chromeNativeHost-4U39yLtd.js → chromeNativeHost-DX8f9Y2L.js} +0 -0
  454. /package/dist/chunks/{claudeDesktop-D0S1eq1F.js → claudeDesktop-C1qQs6os.js} +0 -0
  455. /package/dist/chunks/{cleanup-Bg_gFgcj.js → cleanup-Pv6U3HiI.js} +0 -0
  456. /package/dist/chunks/{connectHeadless-CwsFt-Mh.js → connectHeadless-DFCrE6O4.js} +0 -0
  457. /package/dist/chunks/{dangerousBackend-BU_PHGR2.js → dangerousBackend-Du0K4q5Z.js} +0 -0
  458. /package/dist/chunks/{earlyInput-tRkbxFv2.js → earlyInput-feVuZGzR.js} +0 -0
  459. /package/dist/chunks/{eventLoopStallDetector-Dnh1fc31.js → eventLoopStallDetector-XfubcyMN.js} +0 -0
  460. /package/dist/chunks/{fpsMetrics-DeezdcwV.js → fpsMetrics-CEQt6Tk1.js} +0 -0
  461. /package/dist/chunks/{fuse-Ch_OAlm3.js → fuse-TM-TeOo_.js} +0 -0
  462. /package/dist/chunks/{instinctParser-DHMa8xa0.js → instinctParser-CJPM8VjX.js} +0 -0
  463. /package/dist/chunks/{lockfile-DBwdlC3K.js → lockfile-Y1hwdHrQ.js} +0 -0
  464. /package/dist/chunks/{main-C6be1KFk.js → main-D9fUXJiD.js} +0 -0
  465. /package/dist/chunks/{observationStore-tvkldXUo.js → observationStore-gFvWXJmc.js} +0 -0
  466. /package/dist/chunks/{openaiShared-Bjrci9n8.js → openaiShared-Dy78YERG.js} +0 -0
  467. /package/dist/chunks/{output-style-XDb9-2Kk.js → output-style-BmEQscMd.js} +0 -0
  468. /package/dist/chunks/{parseConnectUrl-BS6i9JPo.js → parseConnectUrl-C6cvMkkH.js} +0 -0
  469. /package/dist/chunks/{poller-Ds0Y6Cir.js → poller-Dbo07OEA.js} +0 -0
  470. /package/dist/chunks/{postCommitAttribution-Ehmwzzuq.js → postCommitAttribution-DhFkZMxJ.js} +0 -0
  471. /package/dist/chunks/{projectContext-eXMSfgdZ.js → projectContext-iWPqcl0Z.js} +0 -0
  472. /package/dist/chunks/{renderOptions-BiyC2rj1.js → renderOptions-rmj4Mkls.js} +0 -0
  473. /package/dist/chunks/{rewind-CXplHgh_.js → rewind-DAn-nNs-.js} +0 -0
  474. /package/dist/chunks/{sanitization-CYp-9DbE.js → sanitization-JYRkZFrK.js} +0 -0
  475. /package/dist/chunks/{sdkHeapDumpMonitor--fevrC5z.js → sdkHeapDumpMonitor-DKtfJW5o.js} +0 -0
  476. /package/dist/chunks/{server-C5XZSlto.js → server-CswFAYwN.js} +0 -0
  477. /package/dist/chunks/{serverBanner-WlSYP-f8.js → serverBanner-CImTYGhY.js} +0 -0
  478. /package/dist/chunks/{serverLog-DtsUvDiY.js → serverLog-Bwt7XEmk.js} +0 -0
  479. /package/dist/chunks/{sessionDataUploader-Ctjo1bgR.js → sessionDataUploader-CKRXCBxI.js} +0 -0
  480. /package/dist/chunks/{sessionManager-Dw72ZUTg.js → sessionManager-Ca2O821f.js} +0 -0
  481. /package/dist/chunks/{stickers-2K05wjSp.js → stickers-BMh2qjgF.js} +0 -0
  482. /package/dist/chunks/{udsClient-BvG_Jip0.js → udsClient-BdPOrL1H.js} +0 -0
  483. /package/dist/chunks/{upstreamproxy-DcLeL2XX.js → upstreamproxy-Ci5T_JCo.js} +0 -0
  484. /package/dist/chunks/{voice-DXiiy8HX.js → voice-BcA5h8ya.js} +0 -0
@@ -0,0 +1,3 @@
1
+ import{n as e,o as t}from"./chunk-DR8-3Aex.js";import{n,t as r}from"./figures-gfT9mM8P.js";import{F as i,In as a,J as o,Ln as s,Rn as c,Ut as l,_ as u,a as d,b as f,f as p,i as m,n as h,o as g,p as ee,r as te,t as _,tt as ne,x as v,xt as y}from"./src-Di342QoJ.js";import{t as b}from"./jsx-runtime-D-D469L8.js";import{cn as re,ot as x}from"./state-sIHsFpDu.js";import{Bo as S,Po as C,Ro as w,Vo as T,Xa as E,Xs as D,jo as O,nc as k,oo as A}from"./paths-C2JRlUsH.js";import{E as j,w as M}from"./debug-UI3T040K.js";import{H as ie,HS as ae,K as oe,Lx as N,Rx as P,U as se,Ux as ce,V as le,VS as ue,Vo as de,W as fe,WS as pe,Wx as F,dA as I,hD as me,mA as L,mD as R,q as z,qw as he,uD as B,vo as ge,vp as _e,vu as V,yp as ve,yu as ye}from"./loadAgentsDir-C9Ee_fs1.js";import{t as be}from"./useKeybinding-FsOnjW6T.js";import{l as xe,u as Se}from"./referral-CXmDvb7V.js";import{n as Ce,t as we}from"./AddWorkspaceDirectory-BKIYdg96.js";import{t as Te}from"./SearchBox-DfOmUoaI.js";import{n as Ee,t as De}from"./useSearchInput-YiO4crrI.js";import{n as H,t as Oe}from"./shadowedRuleDetection-spwhhTXF.js";import{n as ke,t as Ae}from"./autoModeDenials-D8eQ1CoM.js";function je({ruleValue:e}){switch(e.toolName){case V.name:return e.ruleContent?e.ruleContent.endsWith(`:*`)?(0,U.jsxs)(f,{dimColor:!0,children:[`Any Bash command starting with `,(0,U.jsx)(f,{bold:!0,children:e.ruleContent.slice(0,-2)})]}):(0,U.jsxs)(f,{dimColor:!0,children:[`The Bash command `,(0,U.jsx)(f,{bold:!0,children:e.ruleContent})]}):(0,U.jsx)(f,{dimColor:!0,children:`Any Bash command`});default:return e.ruleContent?null:(0,U.jsxs)(f,{dimColor:!0,children:[`Any use of the `,(0,U.jsx)(f,{bold:!0,children:e.toolName}),` tool`]})}}var U,Me=e((()=>{c(),_(),ye(),U=b()}));function Ne(e){switch(e){case`localSettings`:return{label:`Project settings (local)`,description:`Saved in ${E(`localSettings`)}`,value:e};case`projectSettings`:return{label:`Project settings`,description:`Checked in at ${E(`projectSettings`)}`,value:e};case`userSettings`:return{label:`User settings`,description:`Saved in at ~/.claude/settings.json`,value:e}}}function Pe({onAddRules:e,onCancel:t,ruleValues:n,ruleBehavior:r,initialContext:i,setToolPermissionContext:a}){let o=D.map(Ne),s=(0,Fe.useCallback)(o=>{if(o===`cancel`){t();return}else if(D.includes(o)){let t=o,s=B(i,{type:`addRules`,rules:n,behavior:r,destination:t});me({type:`addRules`,rules:n,behavior:r,destination:t}),a(s);let c=n.map(e=>({ruleValue:e,ruleBehavior:r,source:t})),l=Oe(s,{sandboxAutoAllowEnabled:I.isSandboxingEnabled()&&I.isAutoAllowBashIfSandboxedEnabled()}).filter(e=>n.some(t=>t.toolName===e.rule.ruleValue.toolName&&t.ruleContent===e.rule.ruleValue.ruleContent));e(c,l.length>0?l:void 0)}},[e,t,n,r,i,a]);return(0,W.jsxs)(p,{title:`Add ${r} permission ${C(n.length,`rule`)}`,onCancel:t,color:`permission`,children:[(0,W.jsx)(v,{flexDirection:`column`,paddingX:2,children:n.map(e=>(0,W.jsxs)(v,{flexDirection:`column`,children:[(0,W.jsx)(f,{bold:!0,children:T(e)}),(0,W.jsx)(je,{ruleValue:e})]},T(e)))}),(0,W.jsxs)(v,{flexDirection:`column`,marginY:1,children:[(0,W.jsx)(f,{children:n.length===1?`Where should this rule be saved?`:`Where should these rules be saved?`}),(0,W.jsx)(N,{options:o,onChange:s})]})]})}var Fe,W,Ie=e((()=>{c(),Fe=t(c(),1),P(),_(),R(),w(),H(),L(),k(),A(),O(),Me(),W=b()}));function Le({onCancel:e,onSubmit:t,ruleBehavior:n}){let[a,s]=(0,Re.useState)(``),[c,l]=(0,Re.useState)(0),u=Se();ne(`confirm:no`,e,{context:`Settings`});let{columns:d}=i(),p=d-6;return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(v,{flexDirection:`column`,gap:1,borderStyle:`round`,paddingLeft:1,paddingRight:1,borderColor:`permission`,children:[(0,G.jsxs)(f,{bold:!0,color:`permission`,children:[`Add `,n,` permission rule`]}),(0,G.jsxs)(v,{flexDirection:`column`,children:[(0,G.jsxs)(f,{children:[`Permission rules are a tool name, optionally followed by a specifier in parentheses.`,(0,G.jsx)(o,{}),`e.g., `,(0,G.jsx)(f,{bold:!0,children:T({toolName:_e.name})}),(0,G.jsx)(f,{bold:!1,children:` or `}),(0,G.jsx)(f,{bold:!0,children:T({toolName:V.name,ruleContent:`ls:*`})})]}),(0,G.jsx)(v,{borderDimColor:!0,borderStyle:`round`,marginY:1,paddingLeft:1,children:(0,G.jsx)(ce,{showCursor:!0,value:a,onChange:s,onSubmit:e=>{let r=e.trim();r.length!==0&&t(S(r),n)},placeholder:`Enter permission rule${r.ellipsis}`,columns:p,cursorOffset:c,onChangeCursorOffset:l})})]})]}),(0,G.jsx)(v,{marginLeft:3,children:u.pending?(0,G.jsxs)(f,{dimColor:!0,children:[`Press `,u.keyName,` again to exit`]}):(0,G.jsx)(f,{dimColor:!0,children:`Enter to submit · Esc to cancel`})})]})}var Re,G,ze=e((()=>{n(),c(),Re=t(c(),1),F(),xe(),he(),_(),be(),ye(),ve(),w(),G=b()}));function Be({onHeaderFocusChange:e,onStateChange:t}){let{headerFocused:n,focusHeader:r}=m();(0,K.useEffect)(()=>{e?.(n)},[n,e]);let[i]=(0,K.useState)(()=>Ae()),[a,o]=(0,K.useState)(()=>new Set),[s,c]=(0,K.useState)(()=>new Set),[l,u]=(0,K.useState)(0);(0,K.useEffect)(()=>{t({approved:a,retry:s,denials:i})},[a,s,i,t]);let d=(0,K.useCallback)(e=>{let t=Number(e);o(e=>{let n=new Set(e);return n.has(t)?n.delete(t):n.add(t),n})},[]),p=(0,K.useCallback)(e=>{u(Number(e))},[]);if(y((e,t)=>{e===`r`&&(c(e=>{let t=new Set(e);return t.has(l)?t.delete(l):t.add(l),t}),o(e=>{if(e.has(l))return e;let t=new Set(e);return t.add(l),t}))},{isActive:i.length>0}),i.length===0)return(0,q.jsx)(f,{dimColor:!0,children:`No recent denials. Commands denied by the auto mode classifier will appear here.`});let h=i.map((e,t)=>{let n=a.has(t),r=s.has(t)?` (retry)`:``;return{label:(0,q.jsxs)(f,{children:[(0,q.jsx)(g,{status:n?`success`:`error`,withSpace:!0}),e.display,(0,q.jsx)(f,{dimColor:!0,children:r})]}),value:String(t)}});return(0,q.jsxs)(v,{flexDirection:`column`,children:[(0,q.jsx)(f,{children:`Commands recently denied by the auto mode classifier.`}),(0,q.jsx)(v,{marginTop:1,children:(0,q.jsx)(N,{options:h,onChange:d,onFocus:p,visibleOptionCount:Math.min(10,h.length),isDisabled:n,onUpFromFirstItem:r})})]})}var K,q,Ve=e((()=>{c(),K=t(c(),1),_(),ke(),P(),q=b()}));function He({directoryPath:e,onRemove:t,onCancel:n,permissionContext:r,setPermissionContext:i}){let a=(0,J.useCallback)(()=>{i(B(r,{type:`removeDirectories`,directories:[e],destination:`session`})),t()},[e,r,i,t]),o=(0,J.useCallback)(e=>{e===`yes`?a():n()},[a,n]);return(0,Y.jsxs)(p,{title:`Remove directory from workspace?`,onCancel:n,color:`error`,children:[(0,Y.jsx)(v,{marginX:2,flexDirection:`column`,children:(0,Y.jsx)(f,{bold:!0,children:e})}),(0,Y.jsx)(f,{children:`Claude Code will no longer have access to files in this directory.`}),(0,Y.jsx)(N,{onChange:o,onCancel:n,options:[{label:`Yes`,value:`yes`},{label:`No`,value:`no`}]})]})}var J,Y,Ue=e((()=>{c(),J=t(c(),1),P(),_(),R(),Y=b()}));function We({onExit:e,toolPermissionContext:t,onRequestAddDirectory:n,onRequestRemoveDirectory:i,onHeaderFocusChange:a}){let{headerFocused:o,focusHeader:s}=m();(0,X.useEffect)(()=>{a?.(o)},[o,a]);let c=Ge.useMemo(()=>Array.from(t.additionalWorkingDirectories.keys()).map(e=>({path:e,isCurrent:!1,isDeletable:!0})),[t.additionalWorkingDirectories]),l=(0,X.useCallback)(e=>{if(e===`add-directory`){n();return}let t=c.find(t=>t.path===e);t&&t.isDeletable&&i(t.path)},[c,n,i]),u=(0,X.useCallback)(()=>e(`Workspace dialog dismissed`,{display:`system`}),[e]),d=Ge.useMemo(()=>{let e=c.map(e=>({label:e.path,value:e.path}));return e.push({label:`Add directory${r.ellipsis}`,value:`add-directory`}),e},[c]);return(0,Z.jsxs)(v,{flexDirection:`column`,marginBottom:1,children:[(0,Z.jsxs)(v,{flexDirection:`row`,marginTop:1,marginLeft:2,gap:1,children:[(0,Z.jsx)(f,{children:`- ${x()}`}),(0,Z.jsx)(f,{dimColor:!0,children:`(Original working directory)`})]}),(0,Z.jsx)(N,{options:d,onChange:l,onCancel:u,visibleOptionCount:Math.min(10,d.length),onUpFromFirstItem:s,isDisabled:o})]})}var Ge,X,Z,Ke=e((()=>{n(),Ge=t(c(),1),X=t(c(),1),re(),P(),_(),Z=b()}));function qe({rule:e}){return(0,$.jsx)(f,{dimColor:!0,children:`From ${z(e.source)}`})}function Je(e){switch(e){case`allow`:return`allowed`;case`deny`:return`denied`;case`ask`:return`ask`}}function Ye({rule:e,onDelete:t,onCancel:n}){let r=Se();ne(`confirm:no`,n,{context:`Confirmation`});let i=(0,$.jsxs)(v,{flexDirection:`column`,marginX:2,children:[(0,$.jsx)(f,{bold:!0,children:T(e.ruleValue)}),(0,$.jsx)(je,{ruleValue:e.ruleValue}),(0,$.jsx)(qe,{rule:e})]}),a=(0,$.jsx)(v,{marginLeft:3,children:r.pending?(0,$.jsxs)(f,{dimColor:!0,children:[`Press `,r.keyName,` again to exit`]}):(0,$.jsx)(f,{dimColor:!0,children:`Esc to cancel`})});return e.source===`policySettings`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(v,{flexDirection:`column`,gap:1,borderStyle:`round`,paddingLeft:1,paddingRight:1,borderColor:`permission`,children:[(0,$.jsx)(f,{bold:!0,color:`permission`,children:`Rule details`}),i,(0,$.jsxs)(f,{italic:!0,children:[`This rule is configured by managed settings and cannot be modified.`,`
2
+ `,`Contact your system administrator for more information.`]})]}),a]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(v,{flexDirection:`column`,gap:1,borderStyle:`round`,paddingLeft:1,paddingRight:1,borderColor:`error`,children:[(0,$.jsxs)(f,{bold:!0,color:`error`,children:[`Delete `,Je(e.ruleBehavior),` tool?`]}),i,(0,$.jsx)(f,{children:`Are you sure you want to delete this permission rule?`}),(0,$.jsx)(N,{onChange:e=>e===`yes`?t():n(),onCancel:n,options:[{label:`Yes`,value:`yes`},{label:`No`,value:`no`}]})]}),a]})}function Xe(e){let{options:t,searchQuery:n,isSearchMode:r,isFocused:i,onSelect:a,onCancel:o,lastFocusedRuleKey:s,cursorOffset:c,onHeaderFocusChange:l}=e,f=d(),{headerFocused:p,focusHeader:h,blurHeader:g}=m();return(0,Q.useEffect)(()=>{r&&p&&g()},[r,p,g]),(0,Q.useEffect)(()=>{l?.(p)},[p,l]),(0,$.jsxs)(v,{flexDirection:`column`,children:[(0,$.jsx)(v,{marginBottom:1,flexDirection:`column`,children:(0,$.jsx)(u,{query:n,isFocused:r&&!p,isTerminalFocused:i,width:f,cursorOffset:c})}),(0,$.jsx)(N,{options:t,onChange:a,onCancel:o,visibleOptionCount:Math.min(10,t.length),isDisabled:r||p,defaultFocusValue:s,onUpFromFirstItem:h})]})}function Ze({tab:e,getRulesOptions:t,handleToolSelect:n,...r}){return(0,$.jsxs)(v,{flexDirection:`column`,flexShrink:e===`allow`?0:void 0,children:[(0,$.jsx)(f,{children:{allow:`Claude Code won't ask before using allowed tools.`,ask:`Claude Code will always ask for confirmation before using these tools.`,deny:`Claude Code will always reject requests to use denied tools.`}[e]}),(0,$.jsx)(Xe,{options:t(e,r.searchQuery).options,onSelect:t=>n(t,e),...r})]})}function Qe({onExit:e,initialTab:t,onRetryDenials:n}){let i=Ae().length>0,o=t??(i?`recent`:`allow`),[s,c]=(0,Q.useState)([]),u=ae(e=>e.toolPermissionContext),d=pe(),p=l(),m=(0,Q.useRef)({approved:new Set,retry:new Set,denials:[]}),g=(0,Q.useCallback)(e=>{m.current=e},[]),[_,y]=(0,Q.useState)(),[b,re]=(0,Q.useState)(),[x,S]=(0,Q.useState)(null),[C,w]=(0,Q.useState)(null),[E,D]=(0,Q.useState)(!1),[O,k]=(0,Q.useState)(null),[A,M]=(0,Q.useState)(!1),[oe,N]=(0,Q.useState)(!0),P=(0,Q.useCallback)(e=>{N(e)},[]),ce=(0,Q.useMemo)(()=>{let e=new Map;return ie(u).forEach(t=>{e.set(j(t),t)}),e},[u]),ue=(0,Q.useMemo)(()=>{let e=new Map;return fe(u).forEach(t=>{e.set(j(t),t)}),e},[u]),de=(0,Q.useMemo)(()=>{let e=new Map;return se(u).forEach(t=>{e.set(j(t),t)}),e},[u]),F=(0,Q.useCallback)((e,t=``)=>{let n=(()=>{switch(e){case`allow`:return ce;case`deny`:return ue;case`ask`:return de;case`workspace`:case`recent`:return new Map}})(),i=[];e!==`workspace`&&e!==`recent`&&!t&&i.push({label:`Add a new rule${r.ellipsis}`,value:`add-new-rule`});let a=Array.from(n.keys()).sort((e,t)=>{let r=n.get(e),i=n.get(t);if(r&&i){let e=T(r.ruleValue).toLowerCase(),t=T(i.ruleValue).toLowerCase();return e.localeCompare(t)}return 0}),o=t.toLowerCase();for(let e of a){let r=n.get(e);if(r){let n=T(r.ruleValue);if(t&&!n.toLowerCase().includes(o))continue;i.push({label:n,value:e})}}return{options:i,rulesByKey:n}},[ce,ue,de]),I=Se(),L=!_&&!x&&!C&&!E&&!O,{query:R,setQuery:z,cursorOffset:he}=Ee({isActive:L&&A,onExit:()=>{M(!1)}}),ge=(0,Q.useCallback)(e=>{L&&(A||e.ctrl||e.meta||(e.key===`/`?(e.preventDefault(),M(!0),z(``)):e.key.length===1&&e.key!==`j`&&e.key!==`k`&&e.key!==`m`&&e.key!==`i`&&e.key!==`r`&&e.key!==` `&&(e.preventDefault(),M(!0),z(e.key))))},[L,A,z]),_e=(0,Q.useCallback)((e,t)=>{let{rulesByKey:n}=F(t);if(e===`add-new-rule`){S(t);return}else{y(n.get(e));return}},[F]),V=(0,Q.useCallback)(()=>{S(null)},[]),ve=(0,Q.useCallback)((e,t)=>{w({ruleValue:e,ruleBehavior:t}),S(null)},[]),ye=(0,Q.useCallback)((e,t)=>{w(null);for(let t of e)c(e=>[...e,`Added ${t.ruleBehavior} rule ${a.bold(T(t.ruleValue))}`]);if(t&&t.length>0)for(let e of t){let t=e.shadowType===`deny`?`blocked`:`shadowed`;c(n=>[...n,a.yellow(`${r.warning} Warning: ${T(e.rule.ruleValue)} is ${t}`),a.dim(` ${e.reason}`),a.dim(` Fix: ${e.fix}`)])}},[]),be=(0,Q.useCallback)(()=>{w(null)},[]),xe=(0,Q.useCallback)(()=>D(!0),[]),Ce=(0,Q.useCallback)(e=>k(e),[]),Te=(0,Q.useCallback)(()=>{let t=m.current,r=e=>Array.from(e).map(e=>t.denials[e]).filter(e=>e!==void 0),i=r(t.retry);if(i.length>0){let t=i.map(e=>e.display);n?.(t),e(void 0,{shouldQuery:!0,metaMessages:[`Permission granted for: ${t.join(`, `)}. You may now retry ${t.length===1?`this command`:`these commands`} if you would like.`]});return}let o=r(t.approved);o.length>0||s.length>0?e([...o.length>0?[`Approved ${o.map(e=>a.bold(e.display)).join(`, `)}`]:[],...s].join(`
3
+ `)):e(`Permissions dialog dismissed`,{display:`system`})},[s,e,n]);ne(`confirm:no`,Te,{context:`Settings`,isActive:L&&!A});let De=()=>{if(!_)return;let{options:e}=F(_.ruleBehavior),t=j(_),n=e.filter(e=>e.value!==`add-new-rule`).map(e=>e.value),r=n.indexOf(t),i;r!==-1&&(r<n.length-1?i=n[r+1]:r>0&&(i=n[r-1])),re(i),le({rule:_,initialContext:u,setToolPermissionContext(e){d(t=>({...t,toolPermissionContext:e}))}}),c(e=>[...e,`Deleted ${_.ruleBehavior} rule ${a.bold(T(_.ruleValue))}`]),y(void 0)};if(_)return(0,$.jsx)(Ye,{rule:_,onDelete:De,onCancel:()=>y(void 0)});if(x&&x!==`workspace`&&x!==`recent`)return(0,$.jsx)(Le,{onCancel:V,onSubmit:ve,ruleBehavior:x});if(C)return(0,$.jsx)(Pe,{onAddRules:ye,onCancel:be,ruleValues:[C.ruleValue],ruleBehavior:C.ruleBehavior,initialContext:u,setToolPermissionContext:e=>{d(t=>({...t,toolPermissionContext:e}))}});if(E)return(0,$.jsx)(we,{onAddDirectory:(e,t)=>{let n={type:`addDirectories`,directories:[e],destination:t?`localSettings`:`session`},r=B(u,n);d(e=>({...e,toolPermissionContext:r})),t&&me(n),c(n=>[...n,`Added directory ${a.bold(e)} to workspace${t?` and saved to local settings`:` for this session`}`]),D(!1)},onCancel:()=>D(!1),permissionContext:u});if(O)return(0,$.jsx)(He,{directoryPath:O,onRemove:()=>{c(e=>[...e,`Removed directory ${a.bold(O)} from workspace`]),k(null)},onCancel:()=>k(null),permissionContext:u,setPermissionContext:e=>{d(t=>({...t,toolPermissionContext:e}))}});let H={searchQuery:R,isSearchMode:A,isFocused:p,onCancel:Te,lastFocusedRuleKey:b,cursorOffset:he,getRulesOptions:F,handleToolSelect:_e,onHeaderFocusChange:P};return(0,$.jsx)(v,{flexDirection:`column`,onKeyDown:ge,children:(0,$.jsxs)(ee,{color:`permission`,children:[(0,$.jsxs)(te,{title:`Permissions:`,color:`permission`,defaultTab:o,hidden:!!_||!!x||!!C||E||!!O,initialHeaderFocused:!i,navFromContent:!A,children:[(0,$.jsx)(h,{id:`recent`,title:`Recently denied`,children:(0,$.jsx)(Be,{onHeaderFocusChange:P,onStateChange:g})}),(0,$.jsx)(h,{id:`allow`,title:`Allow`,children:(0,$.jsx)(Ze,{tab:`allow`,...H})}),(0,$.jsx)(h,{id:`ask`,title:`Ask`,children:(0,$.jsx)(Ze,{tab:`ask`,...H})}),(0,$.jsx)(h,{id:`deny`,title:`Deny`,children:(0,$.jsx)(Ze,{tab:`deny`,...H})}),(0,$.jsx)(h,{id:`workspace`,title:`Workspace`,children:(0,$.jsxs)(v,{flexDirection:`column`,children:[(0,$.jsx)(f,{children:`Claude Code can read files in the workspace, and make edits when auto-accept edits is on.`}),(0,$.jsx)(We,{onExit:e,toolPermissionContext:u,onRequestAddDirectory:xe,onRequestRemoveDirectory:Ce,onHeaderFocusChange:P})]})})]}),(0,$.jsx)(v,{marginTop:1,paddingLeft:1,children:(0,$.jsx)(f,{dimColor:!0,children:I.pending?(0,$.jsxs)($.Fragment,{children:[`Press `,I.keyName,` again to exit`]}):oe?(0,$.jsx)($.Fragment,{children:`←/→ tab switch · ↓ return · Esc cancel`}):A?(0,$.jsx)($.Fragment,{children:`Type to filter · Enter/↓ select · ↑ tabs · Esc clear`}):i&&o===`recent`?(0,$.jsx)($.Fragment,{children:`Enter approve · r retry · ↑↓ navigate · ←/→ switch · Esc cancel`}):(0,$.jsx)($.Fragment,{children:`↑↓ navigate · Enter select · Type to search · ←/→ switch · Esc cancel`})})})]})})}var Q,$,$e=e((()=>{s(),n(),c(),Q=t(c(),1),ue(),R(),P(),xe(),De(),_(),be(),ke(),w(),oe(),M(),Te(),Ie(),Ce(),Me(),ze(),Ve(),Ue(),Ke(),$=b()})),et,tt;e((()=>{$e(),de(),et=b(),tt=async(e,t)=>(0,et.jsx)(Qe,{onExit:e,onRetryDenials:e=>{t.setMessages(t=>[...t,ge(e)])}})}))();export{tt as call};
@@ -1 +1 @@
1
- import{n as e}from"./chunk-DR8-3Aex.js";import{n as t,s as n}from"./envUtils-BWeoiL4Y.js";import{o as r}from"./log-CzsijfHZ.js";import{a as i,o as a}from"./teamHelpers-CbFFdvPw.js";import{join as o}from"path";import"fs/promises";import"net";import"events";function s(e){let t=a(e);if(!t)return[];let n=new Set(t.hiddenPaneIds??[]),r=[];for(let e of t.members){if(e.name===`team-lead`)continue;let t=e.isActive===!1?`idle`:`running`;r.push({name:e.name,agentId:e.agentId,agentType:e.agentType,model:e.model,prompt:e.prompt,status:t,color:e.color,tmuxPaneId:e.tmuxPaneId,cwd:e.cwd,worktreePath:e.worktreePath,isHidden:n.has(e.tmuxPaneId),backendType:e.backendType,mode:e.mode})}return r}var c=e((()=>{i()}));function l(){return o(t(),`pipes`)}function u(e){return e?.pipeIpc??d}var d,f=e((()=>{n(),r(),d={role:`main`,subIndex:null,displayRole:`main`,serverName:null,attachedBy:null,localIp:null,hostname:null,machineId:null,mac:null,statusVisible:!1,selectorOpen:!1,selectedPipes:[],routeMode:`selected`,slaves:{},discoveredPipes:[]}}));export{c as a,s as i,l as n,f as r,u as t};
1
+ import{n as e}from"./chunk-DR8-3Aex.js";import{n as t,s as n}from"./envUtils-BWeoiL4Y.js";import{o as r}from"./log-CzsijfHZ.js";import{a as i,o as a}from"./teamHelpers-9p7wPcXj.js";import{join as o}from"path";import"fs/promises";import"net";import"events";function s(e){let t=a(e);if(!t)return[];let n=new Set(t.hiddenPaneIds??[]),r=[];for(let e of t.members){if(e.name===`team-lead`)continue;let t=e.isActive===!1?`idle`:`running`;r.push({name:e.name,agentId:e.agentId,agentType:e.agentType,model:e.model,prompt:e.prompt,status:t,color:e.color,tmuxPaneId:e.tmuxPaneId,cwd:e.cwd,worktreePath:e.worktreePath,isHidden:n.has(e.tmuxPaneId),backendType:e.backendType,mode:e.mode})}return r}var c=e((()=>{i()}));function l(){return o(t(),`pipes`)}function u(e){return e?.pipeIpc??d}var d,f=e((()=>{n(),r(),d={role:`main`,subIndex:null,displayRole:`main`,serverName:null,attachedBy:null,localIp:null,hostname:null,machineId:null,mac:null,statusVisible:!1,selectorOpen:!1,selectedPipes:[],routeMode:`selected`,slaves:{},discoveredPipes:[]}}));export{c as a,s as i,l as n,f as r,u as t};
@@ -1 +1 @@
1
- import{n as e}from"./chunk-DR8-3Aex.js";import{Rn as t,b as n,t as r,x as i}from"./src-Di342QoJ.js";import{t as a}from"./jsx-runtime-D-D469L8.js";import{cn as o,rn as s}from"./state-sIHsFpDu.js";import{Gv as c,Jv as l,Wv as u,ix as d,j as f,oD as p,px as m,uD as h,w as g}from"./loadAgentsDir-D-xcJ22-.js";import{a as _,i as v,r as y,t as b}from"./promptEditor-BZqpLrcZ.js";import{r as x,t as S}from"./staticRender-Br64h1E1.js";function C({planContent:e,planPath:t,editorName:r}){return(0,T.jsxs)(i,{flexDirection:`column`,children:[(0,T.jsx)(n,{bold:!0,children:`Current Plan`}),(0,T.jsx)(n,{dimColor:!0,children:t}),(0,T.jsx)(i,{marginTop:1,children:(0,T.jsx)(n,{children:e})}),r&&(0,T.jsxs)(i,{marginTop:1,children:[(0,T.jsx)(n,{dimColor:!0,children:`"/plan open"`}),(0,T.jsx)(n,{dimColor:!0,children:` to edit this plan in `}),(0,T.jsx)(n,{bold:!0,dimColor:!0,children:r})]})]})}async function w(e,t,n){let{getAppState:r,setAppState:i}=t,a=r().toolPermissionContext.mode;if(a!==`plan`){s(a,`plan`),i(e=>({...e,toolPermissionContext:p(f(e.toolPermissionContext),{type:`setMode`,mode:`plan`,destination:`session`})}));let t=n.trim();return t&&t!==`open`?e(`Enabled plan mode`,{shouldQuery:!0}):e(`Enabled plan mode`),null}let o=u(),l=c();if(!o)return e(`Already in plan mode. No plan written yet.`),null;if(n.trim().split(/\s+/)[0]===`open`){let t=await b(l);return t.error?e(`Failed to open plan in editor: ${t.error}`):e(`Opened plan in editor: ${l}`),null}let d=v();return e(await x((0,T.jsx)(C,{planContent:o,planPath:l,editorName:d?m(d):void 0}))),null}var T;e((()=>{t(),o(),r(),_(),d(),h(),g(),l(),y(),S(),T=a()}))();export{w as call};
1
+ import{n as e}from"./chunk-DR8-3Aex.js";import{Rn as t,b as n,t as r,x as i}from"./src-Di342QoJ.js";import{t as a}from"./jsx-runtime-D-D469L8.js";import{cn as o,rn as s}from"./state-sIHsFpDu.js";import{Jv as c,Qv as l,Yv as u,_x as d,cx as f,j as p,mD as m,uD as h,w as g}from"./loadAgentsDir-C9Ee_fs1.js";import{a as _,i as v,r as y,t as b}from"./promptEditor-C8B2TEXp.js";import{r as x,t as S}from"./staticRender-Br64h1E1.js";function C({planContent:e,planPath:t,editorName:r}){return(0,T.jsxs)(i,{flexDirection:`column`,children:[(0,T.jsx)(n,{bold:!0,children:`Current Plan`}),(0,T.jsx)(n,{dimColor:!0,children:t}),(0,T.jsx)(i,{marginTop:1,children:(0,T.jsx)(n,{children:e})}),r&&(0,T.jsxs)(i,{marginTop:1,children:[(0,T.jsx)(n,{dimColor:!0,children:`"/plan open"`}),(0,T.jsx)(n,{dimColor:!0,children:` to edit this plan in `}),(0,T.jsx)(n,{bold:!0,dimColor:!0,children:r})]})]})}async function w(e,t,n){let{getAppState:r,setAppState:i}=t,a=r().toolPermissionContext.mode;if(a!==`plan`){s(a,`plan`),i(e=>({...e,toolPermissionContext:h(p(e.toolPermissionContext),{type:`setMode`,mode:`plan`,destination:`session`})}));let t=n.trim();return t&&t!==`open`?e(`Enabled plan mode`,{shouldQuery:!0}):e(`Enabled plan mode`),null}let o=c(),l=u();if(!o)return e(`Already in plan mode. No plan written yet.`),null;if(n.trim().split(/\s+/)[0]===`open`){let t=await b(l);return t.error?e(`Failed to open plan in editor: ${t.error}`):e(`Opened plan in editor: ${l}`),null}let f=v();return e(await x((0,T.jsx)(C,{planContent:o,planPath:l,editorName:f?d(f):void 0}))),null}var T;e((()=>{t(),o(),r(),_(),f(),m(),g(),l(),y(),S(),T=a()}))();export{w as call};
@@ -1 +1 @@
1
- import{n as e}from"./chunk-DR8-3Aex.js";import{Rn as t}from"./src-Di342QoJ.js";import{t as n}from"./jsx-runtime-D-D469L8.js";import{n as r,t as i}from"./PluginSettings-h9Lj0vW6.js";async function a(e,t,n){return(0,o.jsx)(i,{onComplete:e,args:n})}var o;e((()=>{t(),r(),o=n()}))();export{a as call};
1
+ import{n as e}from"./chunk-DR8-3Aex.js";import{Rn as t}from"./src-Di342QoJ.js";import{t as n}from"./jsx-runtime-D-D469L8.js";import{n as r,t as i}from"./PluginSettings-Dgu23nzv.js";async function a(e,t,n){return(0,o.jsx)(i,{onComplete:e,args:n})}var o;e((()=>{t(),r(),o=n()}))();export{a as call};
@@ -1 +1 @@
1
- import{n as e}from"./chunk-DR8-3Aex.js";import{Ac as t,Fc as n,ws as r,xs as i}from"./paths-D9CVAtXU.js";import{L as a,V as o,d as s,s as c}from"./debug-UI3T040K.js";import{o as l,s as u}from"./log-CzsijfHZ.js";import{Es as d,Gs as f,Hs as p,Ls as m,Os as h,Vs as g,js as _}from"./loadAgentsDir-D-xcJ22-.js";import{i as v,o as y}from"./xml-K_hNNh2b.js";import{f as b,s as x}from"./pluginOperations-CP6NFNog.js";function S(e){return O=e,k!==null&&k.length>0&&(e(k),k=null),()=>{O=null}}async function C(){let e=await p(),t=m(),n=new Set;for(let[i,a]of Object.entries(e)){let e=t[i]?.autoUpdate;(e===void 0?r(i,a):e)&&n.add(i.toLowerCase())}return n}async function w(e,t){let n=!1;for(let{scope:r}of t)try{let t=await b(e,r);t.success&&!t.alreadyUpToDate?(n=!0,s(`Plugin autoupdate: updated ${e} from ${t.oldVersion} to ${t.newVersion}`)):t.alreadyUpToDate||s(`Plugin autoupdate: failed to update ${e}: ${t.message}`,{level:`warn`})}catch(t){s(`Plugin autoupdate: error updating ${e}: ${a(t)}`,{level:`warn`})}return n?e:null}async function T(e){let t=_(),n=Object.keys(t.plugins);return n.length===0?[]:(await Promise.allSettled(n.map(async n=>{let{marketplace:r}=y(n);if(!r||!e.has(r.toLowerCase()))return null;let i=t.plugins[n];if(!i||i.length===0)return null;let a=i.filter(h);return a.length===0?null:w(n,a)}))).filter(e=>e.status===`fulfilled`&&e.value!==null).map(e=>e.value)}async function E(e){return T(e)}function D(){(async()=>{if(n()){s(`Plugin autoupdate: skipped (auto-updater disabled)`);return}try{let e=await C();if(e.size===0)return;let t=(await Promise.allSettled(Array.from(e).map(async e=>{try{await f(e,void 0,{disableCredentialHelper:!0})}catch(t){s(`Plugin autoupdate: failed to refresh marketplace ${e}: ${a(t)}`,{level:`warn`})}}))).filter(e=>e.status===`rejected`);t.length>0&&s(`Plugin autoupdate: ${t.length} marketplace refresh(es) failed`,{level:`warn`}),s(`Plugin autoupdate: checking installed plugins`);let n=await E(e);n.length>0&&(O?O(n):k=n)}catch(e){u(e)}})()}var O,k,A=e((()=>{x(),t(),c(),o(),l(),d(),g(),v(),i(),O=null,k=null}));export{T as i,A as n,S as r,D as t};
1
+ import{n as e}from"./chunk-DR8-3Aex.js";import{Ac as t,Fc as n,ws as r,xs as i}from"./paths-C2JRlUsH.js";import{L as a,V as o,d as s,s as c}from"./debug-UI3T040K.js";import{o as l,s as u}from"./log-CzsijfHZ.js";import{As as d,Fs as f,Gs as p,Ks as m,Ms as h,Vs as g,Ys as _}from"./loadAgentsDir-C9Ee_fs1.js";import{i as v,o as y}from"./xml-BW5T-oW-.js";import{f as b,s as x}from"./pluginOperations-BBRf8tuH.js";function S(e){return O=e,k!==null&&k.length>0&&(e(k),k=null),()=>{O=null}}async function C(){let e=await m(),t=g(),n=new Set;for(let[i,a]of Object.entries(e)){let e=t[i]?.autoUpdate;(e===void 0?r(i,a):e)&&n.add(i.toLowerCase())}return n}async function w(e,t){let n=!1;for(let{scope:r}of t)try{let t=await b(e,r);t.success&&!t.alreadyUpToDate?(n=!0,s(`Plugin autoupdate: updated ${e} from ${t.oldVersion} to ${t.newVersion}`)):t.alreadyUpToDate||s(`Plugin autoupdate: failed to update ${e}: ${t.message}`,{level:`warn`})}catch(t){s(`Plugin autoupdate: error updating ${e}: ${a(t)}`,{level:`warn`})}return n?e:null}async function T(e){let t=f(),n=Object.keys(t.plugins);return n.length===0?[]:(await Promise.allSettled(n.map(async n=>{let{marketplace:r}=y(n);if(!r||!e.has(r.toLowerCase()))return null;let i=t.plugins[n];if(!i||i.length===0)return null;let a=i.filter(h);return a.length===0?null:w(n,a)}))).filter(e=>e.status===`fulfilled`&&e.value!==null).map(e=>e.value)}async function E(e){return T(e)}function D(){(async()=>{if(n()){s(`Plugin autoupdate: skipped (auto-updater disabled)`);return}try{let e=await C();if(e.size===0)return;let t=(await Promise.allSettled(Array.from(e).map(async e=>{try{await _(e,void 0,{disableCredentialHelper:!0})}catch(t){s(`Plugin autoupdate: failed to refresh marketplace ${e}: ${a(t)}`,{level:`warn`})}}))).filter(e=>e.status===`rejected`);t.length>0&&s(`Plugin autoupdate: ${t.length} marketplace refresh(es) failed`,{level:`warn`}),s(`Plugin autoupdate: checking installed plugins`);let n=await E(e);n.length>0&&(O?O(n):k=n)}catch(e){u(e)}})()}var O,k,A=e((()=>{x(),t(),c(),o(),l(),d(),p(),v(),i(),O=null,k=null}));export{T as i,A as n,S as r,D as t};
@@ -0,0 +1 @@
1
+ import{L as e,V as t,d as n,s as r}from"./debug-UI3T040K.js";import{As as i,Gs as a,Hs as o,Is as s,qs as c}from"./loadAgentsDir-C9Ee_fs1.js";import{d as l,s as u}from"./pluginOperations-BBRf8tuH.js";import{i as d,n as f,r as p,t as m}from"./pluginFlagging-DfHARfd-.js";u(),r(),t(),i(),a(),p();function h(e,t,n){let r=new Set(t.plugins.map(e=>e.name)),i=`@${n}`,a=[];for(let t of Object.keys(e.plugins)){if(!t.endsWith(i))continue;let e=t.slice(0,-i.length);r.has(e)||a.push(t)}return a}async function g(){await d();let t=s(),r=f(),i=await c(),a=[];for(let s of Object.keys(i))try{let i=await o(s);if(!i.forceRemoveDeletedPlugins)continue;let c=h(t,i,s);for(let i of c){if(i in r)continue;let o=t.plugins[i]??[];if(o.some(e=>e.scope===`user`||e.scope===`project`||e.scope===`local`)){for(let t of o){let{scope:r}=t;if(!(r!==`user`&&r!==`project`&&r!==`local`))try{await l(i,r)}catch(t){n(`Failed to auto-uninstall delisted plugin ${i} from ${r}: ${e(t)}`,{level:`error`})}}await m(i),a.push(i)}}}catch(t){n(`Failed to check for delisted plugins in "${s}": ${e(t)}`,{level:`warn`})}return a}export{g as t};
@@ -1 +1 @@
1
- import{n as e,t}from"./figures-gfT9mM8P.js";import{L as n,V as r}from"./debug-UI3T040K.js";import{n as i,r as a}from"./analytics-DqMQntaB.js";import{n as o,o as s}from"./process-DMKLUQIO.js";import{o as c,s as l}from"./log-CzsijfHZ.js";import{$T as u,J_ as d,K_ as f,Ts as p,ZT as m,q_ as h,ws as g}from"./loadAgentsDir-D-xcJ22-.js";import{i as _,o as v}from"./xml-K_hNNh2b.js";import{a as y,c as b,d as x,f as S,i as C,r as w,s as T}from"./pluginOperations-CP6NFNog.js";e(),r(),u(),c(),p(),_(),o(),d(),i(),T();function E(e,r,i){l(e);let o=i?`${r} plugin "${i}"`:r===`disable-all`?`disable all plugins`:`${r} plugins`;console.error(`${t.cross} Failed to ${o}: ${n(e)}`);let s=i?(()=>{let{name:e,marketplace:t}=v(i);return{_PROTO_plugin_name:e,...t&&{_PROTO_marketplace_name:t},...f(e,t,g())}})():{};a(`tengu_plugin_command_failed`,{command:r,error_category:h(e),...s}),process.exit(1)}async function D(e,n=`user`){try{console.log(`Installing plugin "${e}"...`);let r=await b(e,n);if(!r.success)throw Error(r.message);console.log(`${t.tick} ${r.message}`);let{name:i,marketplace:o}=v(r.pluginId||e);a(`tengu_plugin_installed_cli`,{_PROTO_plugin_name:i,...o&&{_PROTO_marketplace_name:o},scope:r.scope||n,install_source:`cli-explicit`,...f(i,o,g())}),process.exit(0)}catch(t){E(t,`install`,e)}}async function O(e,n=`user`,r=!1){try{let i=await x(e,n,!r);if(!i.success)throw Error(i.message);console.log(`${t.tick} ${i.message}`);let{name:o,marketplace:s}=v(i.pluginId||e);a(`tengu_plugin_uninstalled_cli`,{_PROTO_plugin_name:o,...s&&{_PROTO_marketplace_name:s},scope:i.scope||n,...f(o,s,g())}),process.exit(0)}catch(t){E(t,`uninstall`,e)}}async function k(e,n){try{let r=await y(e,n);if(!r.success)throw Error(r.message);console.log(`${t.tick} ${r.message}`);let{name:i,marketplace:o}=v(r.pluginId||e);a(`tengu_plugin_enabled_cli`,{_PROTO_plugin_name:i,...o&&{_PROTO_marketplace_name:o},scope:r.scope,...f(i,o,g())}),process.exit(0)}catch(t){E(t,`enable`,e)}}async function A(e,n){try{let r=await C(e,n);if(!r.success)throw Error(r.message);console.log(`${t.tick} ${r.message}`);let{name:i,marketplace:o}=v(r.pluginId||e);a(`tengu_plugin_disabled_cli`,{_PROTO_plugin_name:i,...o&&{_PROTO_marketplace_name:o},scope:r.scope,...f(i,o,g())}),process.exit(0)}catch(t){E(t,`disable`,e)}}async function j(){try{let e=await w();if(!e.success)throw Error(e.message);console.log(`${t.tick} ${e.message}`),a(`tengu_plugin_disabled_all_cli`,{}),process.exit(0)}catch(e){E(e,`disable-all`)}}async function M(e,n){try{s(`Checking for updates for plugin "${e}" at ${n} scope…\n`);let r=await S(e,n);if(!r.success)throw Error(r.message);if(s(`${t.tick} ${r.message}\n`),!r.alreadyUpToDate){let{name:t,marketplace:n}=v(r.pluginId||e);a(`tengu_plugin_updated_cli`,{_PROTO_plugin_name:t,...n&&{_PROTO_marketplace_name:n},old_version:r.oldVersion||`unknown`,new_version:r.newVersion||`unknown`,...f(t,n,g())})}await m(0)}catch(t){E(t,`update`,e)}}export{O as a,D as i,A as n,M as o,k as r,j as t};
1
+ import{n as e,t}from"./figures-gfT9mM8P.js";import{L as n,V as r}from"./debug-UI3T040K.js";import{n as i,r as a}from"./analytics-DqMQntaB.js";import{n as o,o as s}from"./process-DMKLUQIO.js";import{o as c,s as l}from"./log-CzsijfHZ.js";import{Os as u,Q_ as d,X_ as f,Z_ as p,ks as m,rE as h,tE as g}from"./loadAgentsDir-C9Ee_fs1.js";import{i as _,o as v}from"./xml-BW5T-oW-.js";import{a as y,c as b,d as x,f as S,i as C,r as w,s as T}from"./pluginOperations-BBRf8tuH.js";e(),r(),h(),c(),m(),_(),o(),d(),i(),T();function E(e,r,i){l(e);let o=i?`${r} plugin "${i}"`:r===`disable-all`?`disable all plugins`:`${r} plugins`;console.error(`${t.cross} Failed to ${o}: ${n(e)}`);let s=i?(()=>{let{name:e,marketplace:t}=v(i);return{_PROTO_plugin_name:e,...t&&{_PROTO_marketplace_name:t},...f(e,t,u())}})():{};a(`tengu_plugin_command_failed`,{command:r,error_category:p(e),...s}),process.exit(1)}async function D(e,n=`user`){try{console.log(`Installing plugin "${e}"...`);let r=await b(e,n);if(!r.success)throw Error(r.message);console.log(`${t.tick} ${r.message}`);let{name:i,marketplace:o}=v(r.pluginId||e);a(`tengu_plugin_installed_cli`,{_PROTO_plugin_name:i,...o&&{_PROTO_marketplace_name:o},scope:r.scope||n,install_source:`cli-explicit`,...f(i,o,u())}),process.exit(0)}catch(t){E(t,`install`,e)}}async function O(e,n=`user`,r=!1){try{let i=await x(e,n,!r);if(!i.success)throw Error(i.message);console.log(`${t.tick} ${i.message}`);let{name:o,marketplace:s}=v(i.pluginId||e);a(`tengu_plugin_uninstalled_cli`,{_PROTO_plugin_name:o,...s&&{_PROTO_marketplace_name:s},scope:i.scope||n,...f(o,s,u())}),process.exit(0)}catch(t){E(t,`uninstall`,e)}}async function k(e,n){try{let r=await y(e,n);if(!r.success)throw Error(r.message);console.log(`${t.tick} ${r.message}`);let{name:i,marketplace:o}=v(r.pluginId||e);a(`tengu_plugin_enabled_cli`,{_PROTO_plugin_name:i,...o&&{_PROTO_marketplace_name:o},scope:r.scope,...f(i,o,u())}),process.exit(0)}catch(t){E(t,`enable`,e)}}async function A(e,n){try{let r=await C(e,n);if(!r.success)throw Error(r.message);console.log(`${t.tick} ${r.message}`);let{name:i,marketplace:o}=v(r.pluginId||e);a(`tengu_plugin_disabled_cli`,{_PROTO_plugin_name:i,...o&&{_PROTO_marketplace_name:o},scope:r.scope,...f(i,o,u())}),process.exit(0)}catch(t){E(t,`disable`,e)}}async function j(){try{let e=await w();if(!e.success)throw Error(e.message);console.log(`${t.tick} ${e.message}`),a(`tengu_plugin_disabled_all_cli`,{}),process.exit(0)}catch(e){E(e,`disable-all`)}}async function M(e,n){try{s(`Checking for updates for plugin "${e}" at ${n} scope…\n`);let r=await S(e,n);if(!r.success)throw Error(r.message);if(s(`${t.tick} ${r.message}\n`),!r.alreadyUpToDate){let{name:t,marketplace:n}=v(r.pluginId||e);a(`tengu_plugin_updated_cli`,{_PROTO_plugin_name:t,...n&&{_PROTO_marketplace_name:n},old_version:r.oldVersion||`unknown`,new_version:r.newVersion||`unknown`,...f(t,n,u())})}await g(0)}catch(t){E(t,`update`,e)}}export{O as a,D as i,A as n,M as o,k as r,j as t};
@@ -1 +1 @@
1
- import{n as e}from"./chunk-DR8-3Aex.js";import{E as t,T as n,d as r,h as i,p as a,s as o,w as s}from"./debug-UI3T040K.js";import{o as c,s as l}from"./log-CzsijfHZ.js";import{aA as u,iA as d}from"./loadAgentsDir-D-xcJ22-.js";import{join as f}from"path";import{randomBytes as p}from"crypto";import{readFile as m,rename as h,unlink as g,writeFile as _}from"fs/promises";function v(){return f(d(),D)}function y(e){let t=n(e);if(typeof t!=`object`||!t||!(`plugins`in t)||typeof t.plugins!=`object`||t.plugins===null)return{};let r=t.plugins,i={};for(let[e,t]of Object.entries(r))if(t&&typeof t==`object`&&`flaggedAt`in t&&typeof t.flaggedAt==`string`){let n={flaggedAt:t.flaggedAt};`seenAt`in t&&typeof t.seenAt==`string`&&(n.seenAt=t.seenAt),i[e]=n}return i}async function b(){try{return y(await m(v(),{encoding:`utf-8`}))}catch{return{}}}async function x(e){let n=v(),r=`${n}.${p(8).toString(`hex`)}.tmp`;try{await a().mkdir(d()),await _(r,t({plugins:e},null,2),{encoding:`utf-8`,mode:384}),await h(r,n),k=e}catch(e){l(e);try{await g(r)}catch{}}}async function S(){let e=await b(),t=Date.now(),n=!1;for(let[r,i]of Object.entries(e))i.seenAt&&t-new Date(i.seenAt).getTime()>=O&&(delete e[r],n=!0);k=e,n&&await x(e)}function C(){return k??{}}async function w(e){k===null&&(k=await b()),await x({...k,[e]:{flaggedAt:new Date().toISOString()}}),r(`Flagged plugin: ${e}`)}async function T(e){k===null&&(k=await b());let t=new Date().toISOString(),n=!1,r={...k};for(let i of e){let e=r[i];e&&!e.seenAt&&(r[i]={...e,seenAt:t},n=!0)}n&&await x(r)}async function E(e){if(k===null&&(k=await b()),!(e in k))return;let{[e]:t,...n}=k;k=n,await x(n)}var D,O,k,A=e((()=>{o(),i(),c(),s(),u(),D=`flagged-plugins.json`,O=2880*60*1e3,k=null}));export{T as a,S as i,C as n,E as o,A as r,w as t};
1
+ import{n as e}from"./chunk-DR8-3Aex.js";import{E as t,T as n,d as r,h as i,p as a,s as o,w as s}from"./debug-UI3T040K.js";import{o as c,s as l}from"./log-CzsijfHZ.js";import{cA as u,lA as d}from"./loadAgentsDir-C9Ee_fs1.js";import{join as f}from"path";import{randomBytes as p}from"crypto";import{readFile as m,rename as h,unlink as g,writeFile as _}from"fs/promises";function v(){return f(u(),D)}function y(e){let t=n(e);if(typeof t!=`object`||!t||!(`plugins`in t)||typeof t.plugins!=`object`||t.plugins===null)return{};let r=t.plugins,i={};for(let[e,t]of Object.entries(r))if(t&&typeof t==`object`&&`flaggedAt`in t&&typeof t.flaggedAt==`string`){let n={flaggedAt:t.flaggedAt};`seenAt`in t&&typeof t.seenAt==`string`&&(n.seenAt=t.seenAt),i[e]=n}return i}async function b(){try{return y(await m(v(),{encoding:`utf-8`}))}catch{return{}}}async function x(e){let n=v(),r=`${n}.${p(8).toString(`hex`)}.tmp`;try{await a().mkdir(u()),await _(r,t({plugins:e},null,2),{encoding:`utf-8`,mode:384}),await h(r,n),k=e}catch(e){l(e);try{await g(r)}catch{}}}async function S(){let e=await b(),t=Date.now(),n=!1;for(let[r,i]of Object.entries(e))i.seenAt&&t-new Date(i.seenAt).getTime()>=O&&(delete e[r],n=!0);k=e,n&&await x(e)}function C(){return k??{}}async function w(e){k===null&&(k=await b()),await x({...k,[e]:{flaggedAt:new Date().toISOString()}}),r(`Flagged plugin: ${e}`)}async function T(e){k===null&&(k=await b());let t=new Date().toISOString(),n=!1,r={...k};for(let i of e){let e=r[i];e&&!e.seenAt&&(r[i]={...e,seenAt:t},n=!0)}n&&await x(r)}async function E(e){if(k===null&&(k=await b()),!(e in k))return;let{[e]:t,...n}=k;k=n,await x(n)}var D,O,k,A=e((()=>{o(),i(),c(),s(),d(),D=`flagged-plugins.json`,O=2880*60*1e3,k=null}));export{T as a,S as i,C as n,E as o,A as r,w as t};
@@ -0,0 +1,2 @@
1
+ import{n as e}from"./chunk-DR8-3Aex.js";import{cn as t,ot as n}from"./state-sIHsFpDu.js";import{Po as r,Qa as i,jo as a,lo as o,oo as s}from"./paths-C2JRlUsH.js";import{K as c,U as l,V as u,h as d,p as f}from"./debug-UI3T040K.js";import{o as p,s as m}from"./log-CzsijfHZ.js";import{As as h,BA as g,Ds as _,Es as v,Fs as y,Fw as ee,Gs as b,Hs as x,Is as S,Ks as C,Ls as w,Lw as te,RA as T,Rs as ne,Ss as E,Ws as D,_s as O,aA as k,ds as re,gs as ie,hc as A,hs as ae,lA as oe,mc as se,ms as j,oh as ce,pc as M,ps as N,sh as P,ws as F,xs as I,ys as L,zA as R}from"./loadAgentsDir-C9Ee_fs1.js";import{i as z,m as B,o as V,p as H,s as U}from"./xml-BW5T-oW-.js";import{n as W,t as G}from"./pluginStartupCheck-BKEhWQR2.js";import{dirname as le,join as K}from"path";function q(e){if(!Q.includes(e))throw Error(`Invalid scope "${e}". Must be one of: ${Q.join(`, `)}`)}function ue(e){return Q.includes(e)}function J(e){return e===`project`||e===`local`?n():void 0}function de(e){return i(`projectSettings`)?.enabledPlugins?.[e]===!0}function fe(e){let t=e.includes(`@`);for(let n of[`local`,`project`,`user`]){let r=i(U(n))?.enabledPlugins;if(r){for(let i of Object.keys(r))if(t?i===e:i.startsWith(`${e}@`))return{pluginId:i,scope:n}}}return null}function pe(e,t){let{name:n,marketplace:r}=V(e);return t.find(t=>t.name===e||t.name===n?!0:r&&t.source?t.name===n&&t.source.includes(`@${r}`):!1)}function me(e){let{name:t}=V(e),n=S();if(n.plugins[e]?.length)return{pluginId:e,pluginName:t};let r=Object.keys(n.plugins).find(e=>{let{name:r}=V(e);return r===t&&(n.plugins[e]?.length??0)>0});return r?{pluginId:r,pluginName:t}:null}function Y(e){let t=S().plugins[e];if(!t||t.length===0)return{scope:`user`};let r=n(),i=t.find(e=>e.scope===`local`&&e.projectPath===r);if(i)return{scope:i.scope,projectPath:i.projectPath};let a=t.find(e=>e.scope===`project`&&e.projectPath===r);if(a)return{scope:a.scope,projectPath:a.projectPath};let o=t.find(e=>e.scope===`user`);return o?{scope:o.scope}:{scope:t[0].scope,projectPath:t[0].projectPath}}async function he(e,t=`user`){q(t);let{name:n,marketplace:r}=V(e),i,a,o;if(r){let t=await D(e);t&&(i=t.entry,a=r,o=t.marketplaceInstallLocation)}else{let e=await C();for(let[t,r]of Object.entries(e))try{let e=(await x(t)).plugins.find(e=>e.name===n);if(e){i=e,a=t,o=r.installLocation;break}}catch(e){m(c(e))}}if(!i||!a)return{success:!1,message:`Plugin "${n}" not found in ${r?`marketplace "${r}"`:`any configured marketplace`}`};let s=i,l=`${s.name}@${a}`,u=await F({pluginId:l,entry:s,scope:t,marketplaceInstallLocation:o});if(!u.ok){let e=u;switch(e.reason){case`local-source-no-location`:return{success:!1,message:`Cannot install local plugin "${e.pluginName}" without marketplace install location`};case`settings-write-failed`:return{success:!1,message:`Failed to update settings: ${e.message}`};case`resolution-failed`:return{success:!1,message:I(e.resolution)};case`blocked-by-policy`:return{success:!1,message:`Plugin "${e.pluginName}" is blocked by your organization's policy and cannot be installed`};case`dependency-blocked-by-policy`:return{success:!1,message:`Plugin "${e.pluginName}" depends on "${e.blockedDependency}", which is blocked by your organization's policy`}}}return{success:!0,message:`Successfully installed plugin: ${l} (scope: ${t})${u.depNote}`,pluginId:l,pluginName:s.name,scope:t}}async function ge(e,t=`user`,n=!0){q(t);let{enabled:r,disabled:a}=await O(),s=[...r,...a],c=pe(e,s),l=U(t),u=i(l),d,f;if(c)d=Object.keys(u?.enabledPlugins??{}).find(t=>t===e||t===c.name||t.startsWith(`${c.name}@`))??(e.includes(`@`)?e:c.name),f=c.name;else{let t=me(e);if(!t)return{success:!1,message:`Plugin "${e}" not found in installed plugins`};d=t.pluginId,f=t.pluginName}let p=J(t),m=S().plugins[d],h=m?.find(e=>e.scope===t&&e.projectPath===p);if(!h){let{scope:n}=Y(d);return n!==t&&m&&m.length>0?n===`project`?{success:!1,message:`Plugin "${e}" is enabled at project scope (.claude/settings.json, shared with your team). To disable just for you: claude plugin disable ${e} --scope local`}:{success:!1,message:`Plugin "${e}" is installed in ${n} scope, not ${t}. Use --scope ${n} to uninstall.`}:{success:!1,message:`Plugin "${e}" is not installed in ${t} scope. Use --scope to specify the correct scope.`}}let g=h.installPath,_={...u?.enabledPlugins};_[d]=void 0,o(l,{enabledPlugins:_}),M(),w(d,t,p);let v=S().plugins[d],y=!v||v.length===0;y&&g&&await A(g),y&&(ee(d),n&&await k(d));let b=T(d,s),x=R(b);return{success:!0,message:`Successfully uninstalled plugin: ${f} (scope: ${t})${x}`,pluginId:d,pluginName:f,scope:t,reverseDependents:b.length>0?b:void 0}}async function X(e,t,n){let r=t?`enable`:`disable`;if(B(e)){let{error:n}=o(`userSettings`,{enabledPlugins:{...i(`userSettings`)?.enabledPlugins,[e]:t}});if(n)return{success:!1,message:`Failed to ${r} built-in plugin: ${n.message}`};M();let{name:a}=V(e);return{success:!0,message:`Successfully ${r}d built-in plugin: ${a}`,pluginId:e,pluginName:a,scope:`user`}}n&&q(n);let a,s,c=fe(e);if(n)if(s=n,c)a=c.pluginId;else if(e.includes(`@`))a=e;else return{success:!1,message:`Plugin "${e}" not found in settings. Use plugin@marketplace format.`};else if(c)a=c.pluginId,s=c.scope;else if(e.includes(`@`))a=e,s=`user`;else return{success:!1,message:`Plugin "${e}" not found in any editable settings scope. Use plugin@marketplace format.`};if(t&&P(a))return{success:!1,message:`Plugin "${a}" is blocked by your organization's policy and cannot be enabled`};let l=U(s),u=i(l)?.enabledPlugins?.[a],d={user:0,project:1,local:2},f=n&&c&&d[n]>d[c.scope];if(n&&u===void 0&&c&&c.scope!==n&&!f)return{success:!1,message:`Plugin "${e}" is installed at ${c.scope} scope, not ${n}. Use --scope ${c.scope} or omit --scope to auto-detect.`};if(t===(n&&!f?u===!0:G().has(a)))return{success:!1,message:`Plugin "${e}" is already ${t?`enabled`:`disabled`}${n?` at ${n} scope`:``}`};let p;if(!t){let{enabled:e,disabled:t}=await O(),n=T(a,[...e,...t]);n.length>0&&(p=n)}let{error:m}=o(l,{enabledPlugins:{...i(l)?.enabledPlugins,[a]:t}});if(m)return{success:!1,message:`Failed to ${r} plugin: ${m.message}`};M();let{name:h}=V(a),g=R(p);return{success:!0,message:`Successfully ${r}d plugin: ${h} (scope: ${s})${g}`,pluginId:a,pluginName:h,scope:s,reverseDependents:p}}async function _e(e,t){return X(e,!0,t)}async function ve(e,t){return X(e,!1,t)}async function Z(){let e=G();if(e.size===0)return{success:!0,message:`No enabled plugins to disable`};let t=[],n=[];for(let[r]of e){let e=await X(r,!1);e.success?t.push(r):n.push(`${r}: ${e.message}`)}return n.length>0?{success:!1,message:`Disabled ${t.length} ${r(t.length,`plugin`)}, ${n.length} failed:\n${n.join(`
2
+ `)}`}:{success:!0,message:`Disabled ${t.length} ${r(t.length,`plugin`)}`}}async function ye(e,t){let{name:n,marketplace:r}=V(e),i=r?`${n}@${r}`:e,a=await D(e);if(!a)return{success:!1,message:`Plugin "${n}" not found`,pluginId:i,scope:t};let{entry:o,marketplaceInstallLocation:s}=a,c=y().plugins[i];if(!c||c.length===0)return{success:!1,message:`Plugin "${n}" is not installed`,pluginId:i,scope:t};let l=J(t),u=c.find(e=>e.scope===t&&e.projectPath===l);return u?be({pluginId:i,pluginName:n,entry:o,marketplaceInstallLocation:s,installation:u,scope:t,projectPath:l}):{success:!1,message:`Plugin "${n}" is not installed at scope ${l?`${t} (${l})`:t}`,pluginId:i,scope:t}}async function be({pluginId:e,pluginName:t,entry:n,marketplaceInstallLocation:r,installation:i,scope:a,projectPath:o}){let s=f(),c=i.version,u,d,p=!1,m;if(typeof n.source!=`string`){let t=await re(n.source,{manifest:{name:n.name}});u=t.path,p=!0,m=t.gitCommitSha,d=await v(e,n.source,t.manifest,t.path,n.version,t.gitCommitSha)}else{let t;try{t=await s.stat(r)}catch(t){if(l(t))return{success:!1,message:`Marketplace directory not found at ${r}`,pluginId:e,scope:a};throw t}u=K(t.isDirectory()?r:le(r),n.source);try{await s.stat(u)}catch(t){if(l(t))return{success:!1,message:`Plugin source not found at ${u}`,pluginId:e,scope:a};throw t}let i,o=K(u,`.claude-plugin`,`plugin.json`);try{i=await L(o,n.name,n.source)}catch{}d=await v(e,n.source,i,u,n.version)}try{let r=j(e,d),s=ae(e,d);if(i.version===d||i.installPath===r||i.installPath===s)return{success:!0,message:`${t} is already at the latest version (${d}).`,pluginId:e,newVersion:d,oldVersion:c,alreadyUpToDate:!0,scope:a};r=await N(u,e,d,n);let l=i.installPath;if(ne(e,a,o,r,d,m),l&&l!==r){let e=y();Object.values(e.plugins).some(e=>e.some(e=>e.installPath===l))||await A(l)}let f=o?`${a} (${o})`:a;return{success:!0,message:`Plugin "${t}" updated from ${c||`unknown`} to ${d} for scope ${f}. Restart to apply changes.`,pluginId:e,newVersion:d,oldVersion:c,scope:a}}finally{p&&u!==j(e,d)&&await s.rm(u,{recursive:!0,force:!0})}}var Q,$,xe=e((()=>{t(),H(),u(),d(),p(),se(),g(),h(),b(),oe(),z(),E(),ie(),te(),ce(),W(),_(),s(),a(),Q=[`user`,`project`,`local`],$=[`user`,`project`,`local`,`managed`]}));export{_e as a,he as c,ge as d,ye as f,ve as i,ue as l,$ as n,Y as o,Z as r,xe as s,Q as t,de as u};
@@ -1 +1 @@
1
- import{n as e}from"./chunk-DR8-3Aex.js";import{Cs as t,Qa as n,lo as r,oo as i,xs as a}from"./paths-D9CVAtXU.js";import{d as o,s}from"./debug-UI3T040K.js";import{n as c,t as l}from"./cwd--iizewsn.js";import{o as u,s as d}from"./log-CzsijfHZ.js";import{Bs as f,Es as p,LA as m,RA as h,Vs as g,gs as _,vs as v,xs as y}from"./loadAgentsDir-D-xcJ22-.js";import{i as b,s as x}from"./xml-K_hNNh2b.js";import{join as S}from"path";function C(){let e=new Map,t=m();for(let[n,r]of Object.entries(t))n.includes(`@`)&&(r===!0?e.set(n,`flag`):r===!1&&e.delete(n));for(let{scope:r,source:i}of[{scope:`managed`,source:`policySettings`},{scope:`user`,source:`userSettings`},{scope:`project`,source:`projectSettings`},{scope:`local`,source:`localSettings`},{scope:`flag`,source:`flagSettings`}]){let a=n(i);if(a?.enabledPlugins)for(let[n,s]of Object.entries(a.enabledPlugins))n.includes(`@`)&&(n in t&&t[n]!==s&&o(`Plugin ${n} from --add-dir (${t[n]}) overridden by ${i} (${s})`),s===!0?e.set(n,r):s===!1&&e.delete(n))}return o(`Found ${e.size} enabled plugins with scopes: ${Array.from(e.entries()).map(([e,t])=>`${e}(${t})`).join(`, `)}`),e}async function w(e,i,a=`user`){let o=a===`user`?void 0:l(),s=x(a),c=n(s),u={...c?.enabledPlugins},p=[],m=[];for(let n=0;n<e.length;n++){let r=e[n];if(r){i&&i(r,n+1,e.length);try{let e=await f(r);if(!e){m.push({name:r,error:`Plugin not found in any marketplace`});continue}let{entry:n,marketplaceInstallLocation:i}=e;t(n.source)?y({pluginId:r,installPath:S(i,n.source),version:n.version},a,o):await _(r,n,a,o),u[r]=!0,p.push(r)}catch(e){let t=e instanceof Error?e.message:String(e);m.push({name:r,error:t}),d(e)}}}return r(s,{...c,enabledPlugins:u}),{installed:p,failed:m}}var T=e((()=>{c(),s(),u(),i(),h(),p(),g(),b(),v(),a()}));export{T as n,w as r,C as t};
1
+ import{n as e}from"./chunk-DR8-3Aex.js";import{Cs as t,Qa as n,lo as r,oo as i,xs as a}from"./paths-C2JRlUsH.js";import{d as o,s}from"./debug-UI3T040K.js";import{n as c,t as l}from"./cwd--iizewsn.js";import{o as u,s as d}from"./log-CzsijfHZ.js";import{As as f,Gs as p,HA as m,Ss as h,Ts as g,VA as _,Ws as v,bs as y}from"./loadAgentsDir-C9Ee_fs1.js";import{i as b,s as x}from"./xml-BW5T-oW-.js";import{join as S}from"path";function C(){let e=new Map,t=_();for(let[n,r]of Object.entries(t))n.includes(`@`)&&(r===!0?e.set(n,`flag`):r===!1&&e.delete(n));for(let{scope:r,source:i}of[{scope:`managed`,source:`policySettings`},{scope:`user`,source:`userSettings`},{scope:`project`,source:`projectSettings`},{scope:`local`,source:`localSettings`},{scope:`flag`,source:`flagSettings`}]){let a=n(i);if(a?.enabledPlugins)for(let[n,s]of Object.entries(a.enabledPlugins))n.includes(`@`)&&(n in t&&t[n]!==s&&o(`Plugin ${n} from --add-dir (${t[n]}) overridden by ${i} (${s})`),s===!0?e.set(n,r):s===!1&&e.delete(n))}return o(`Found ${e.size} enabled plugins with scopes: ${Array.from(e.entries()).map(([e,t])=>`${e}(${t})`).join(`, `)}`),e}async function w(e,i,a=`user`){let o=a===`user`?void 0:l(),s=x(a),c=n(s),u={...c?.enabledPlugins},f=[],p=[];for(let n=0;n<e.length;n++){let r=e[n];if(r){i&&i(r,n+1,e.length);try{let e=await v(r);if(!e){p.push({name:r,error:`Plugin not found in any marketplace`});continue}let{entry:n,marketplaceInstallLocation:i}=e;t(n.source)?g({pluginId:r,installPath:S(i,n.source),version:n.version},a,o):await y(r,n,a,o),u[r]=!0,f.push(r)}catch(e){let t=e instanceof Error?e.message:String(e);p.push({name:r,error:t}),d(e)}}}return r(s,{...c,enabledPlugins:u}),{installed:f,failed:p}}var T=e((()=>{c(),s(),u(),i(),m(),f(),p(),b(),h(),a()}));export{T as n,w as r,C as t};
@@ -0,0 +1 @@
1
+ import{n as e,t}from"./pluginStartupCheck-BKEhWQR2.js";e();export{t as getPluginEditableScopes};
@@ -0,0 +1,4 @@
1
+ import{n as e,t}from"./figures-gfT9mM8P.js";import{Or as n,cn as r}from"./state-sIHsFpDu.js";import{Po as i,jo as a}from"./paths-C2JRlUsH.js";import{E as o,L as s,V as c,w as l}from"./debug-UI3T040K.js";import{n as u,r as d}from"./analytics-DqMQntaB.js";import{o as f,s as p}from"./log-CzsijfHZ.js";import{$s as m,As as h,Gs as g,Is as _,Js as v,Ks as y,Nw as ee,Ps as b,Pw as x,UA as S,WA as C,Ys as w,Zs as te,_s as ne,dc as T,gs as E,lc as D,mc as O,pc as k,rc as A,zs as j}from"./loadAgentsDir-C9Ee_fs1.js";import{i as M,o as N,s as P}from"./xml-BW5T-oW-.js";import{n as F,t as I}from"./exit-_obETqBv.js";import{n as L,t as R}from"./pluginOperations-BBRf8tuH.js";import{a as z,i as B,n as V,o as H,r as U,t as W}from"./pluginCliCommands-D502zE25.js";import{a as re,c as G,i as K,n as q,r as J,s as Y,t as X}from"./validatePlugin-BQA60S_J.js";import{basename as ie,dirname as Z}from"path";e(),r(),u(),C(),c(),f(),O(),G(),h(),D(),g(),ee(),K(),M(),E(),X(),l(),a();function Q(e,n){p(e),I(`${t.cross} Failed to ${n}: ${s(e)}`)}function $(e){e.errors.length>0&&(console.log(`${t.cross} Found ${e.errors.length} ${i(e.errors.length,`error`)}:\n`),e.errors.forEach(e=>{console.log(` ${t.pointer} ${e.path}: ${e.message}`)}),console.log(``)),e.warnings.length>0&&(console.log(`${t.warning} Found ${e.warnings.length} ${i(e.warnings.length,`warning`)}:\n`),e.warnings.forEach(e=>{console.log(` ${t.pointer} ${e.path}: ${e.message}`)}),console.log(``))}async function ae(e,r){r.cowork&&n(!0);try{let n=await q(e);console.log(`Validating ${n.fileType} manifest: ${n.filePath}\n`),$(n);let r=[];if(n.fileType===`plugin`){let e=Z(n.filePath);if(ie(e)===`.claude-plugin`){r=await J(Z(e));for(let e of r)console.log(`Validating ${e.fileType}: ${e.filePath}\n`),$(e)}}let i=n.success&&r.every(e=>e.success),a=n.warnings.length>0||r.some(e=>e.warnings.length>0);i?F(a?`${t.tick} Validation passed with warnings`:`${t.tick} Validation passed`):(console.log(`${t.cross} Validation failed`),process.exit(1))}catch(e){p(e),console.error(`${t.cross} Unexpected error during validation: ${s(e)}`),process.exit(2)}}async function oe(e){e.cowork&&n(!0),d(`tengu_plugin_list_command`,{});let r=_(),{getPluginEditableScopes:i}=await import(`./pluginStartupCheck-ZcaocOSL.js`),a=i(),s=Object.keys(r.plugins),{enabled:c,disabled:l,errors:u}=await ne(),f=[...c,...l],p=f.filter(e=>e.source.endsWith(`@inline`)),m=u.filter(e=>e.source.endsWith(`@inline`)||e.source.startsWith(`inline[`));if(e.json){let t=new Map(f.map(e=>[e.source,e])),n=[];for(let e of s.sort()){let i=r.plugins[e];if(!i||i.length===0)continue;let o=N(e).name,s=u.filter(t=>t.source===e||`plugin`in t&&t.plugin===o).map(S);for(let r of i){let i=t.get(e),o;if(i){let e=i.mcpServers||await x(i);e&&Object.keys(e).length>0&&(o=e)}n.push({id:e,version:r.version||`unknown`,scope:r.scope,enabled:a.has(e),installPath:r.installPath,installedAt:r.installedAt,lastUpdated:r.lastUpdated,projectPath:r.projectPath,mcpServers:o,errors:s.length>0?s:void 0})}}for(let e of p){let t=e.mcpServers||await x(e),r=m.filter(t=>t.source===e.source||`plugin`in t&&t.plugin===e.name).map(S);n.push({id:e.source,version:e.manifest.version??`unknown`,scope:`session`,enabled:e.enabled!==!1,installPath:e.path,mcpServers:t&&Object.keys(t).length>0?t:void 0,errors:r.length>0?r:void 0})}for(let e of m.filter(e=>e.source.startsWith(`inline[`)))n.push({id:e.source,version:`unknown`,scope:`session`,enabled:!1,installPath:`path`in e?e.path:``,errors:[S(e)]});if(e.available){let e=[];try{let[t,n]=await Promise.all([y(),Y()]),{marketplaces:r}=await T(t);for(let{name:t,data:i}of r)if(i)for(let r of i.plugins){let i=A(r.name,t);b(i)||e.push({pluginId:i,name:r.name,description:r.description,marketplaceName:t,version:r.version,source:r.source,installCount:n?.get(i)})}}catch{}F(o({installed:n,available:e},null,2))}else F(o(n,null,2))}s.length===0&&p.length===0&&m.length===0&&F("No plugins installed. Use `claude plugin install` to install a plugin."),s.length>0&&console.log(`Installed plugins:
2
+ `);for(let e of s.sort()){let n=r.plugins[e];if(!n||n.length===0)continue;let i=N(e).name,o=u.filter(t=>t.source===e||`plugin`in t&&t.plugin===i);for(let r of n){let n=a.has(e),i=o.length>0?`${t.cross} failed to load`:n?`${t.tick} enabled`:`${t.cross} disabled`,s=r.version||`unknown`,c=r.scope;console.log(` ${t.pointer} ${e}`),console.log(` Version: ${s}`),console.log(` Scope: ${c}`),console.log(` Status: ${i}`);for(let e of o)console.log(` Error: ${S(e)}`);console.log(``)}}if(p.length>0||m.length>0){console.log(`Session-only plugins (--plugin-dir):
3
+ `);for(let e of p){let n=m.filter(t=>t.source===e.source||`plugin`in t&&t.plugin===e.name),r=n.length>0?`${t.cross} loaded with errors`:`${t.tick} loaded`;console.log(` ${t.pointer} ${e.source}`),console.log(` Version: ${e.manifest.version??`unknown`}`),console.log(` Path: ${e.path}`),console.log(` Status: ${r}`);for(let e of n)console.log(` Error: ${S(e)}`);console.log(``)}for(let e of m.filter(e=>e.source.startsWith(`inline[`)))console.log(` ${t.pointer} ${e.source}: ${t.cross} ${S(e)}\n`)}F()}async function se(e,r){r.cowork&&n(!0);try{let n=await re(e);n||I(`${t.cross} Invalid marketplace source format. Try: owner/repo, https://..., or ./path`),`error`in n&&I(`${t.cross} ${n.error}`);let i=r.scope??`user`;i!==`user`&&i!==`project`&&i!==`local`&&I(`${t.cross} Invalid scope '${i}'. Use: user, project, or local`);let a=P(i),o=n;r.sparse&&r.sparse.length>0&&(o.source===`github`||o.source===`git`?o={...o,sparsePaths:r.sparse}:I(`${t.cross} --sparse is only supported for github and git marketplace sources (got: ${o.source})`)),console.log(`Adding marketplace...`);let{name:s,alreadyMaterialized:c,resolvedSource:l}=await j(o,e=>{console.log(e)});m(s,{source:l},a),k();let u=o.source;o.source===`github`&&(u=o.repo),d(`tengu_marketplace_added`,{source_type:u}),F(c?`${t.tick} Marketplace '${s}' already on disk — declared in ${i} settings`:`${t.tick} Successfully added marketplace: ${s} (declared in ${i} settings)`)}catch(e){Q(e,`add marketplace`)}}async function ce(e){e.cowork&&n(!0);try{let n=await y(),r=Object.keys(n);e.json&&F(o(r.sort().map(e=>{let t=n[e],r=t?.source;return{name:e,source:r?.source,...r?.source===`github`&&{repo:r.repo},...r?.source===`git`&&{url:r.url},...r?.source===`url`&&{url:r.url},...r?.source===`directory`&&{path:r.path},...r?.source===`file`&&{path:r.path},installLocation:t?.installLocation}}),null,2)),r.length===0&&F(`No marketplaces configured`),console.log(`Configured marketplaces:
4
+ `),r.forEach(e=>{let r=n[e];if(console.log(` ${t.pointer} ${e}`),r?.source){let e=r.source;e.source===`github`?console.log(` Source: GitHub (${e.repo})`):e.source===`git`?console.log(` Source: Git (${e.url})`):e.source===`url`?console.log(` Source: URL (${e.url})`):e.source===`directory`?console.log(` Source: Directory (${e.path})`):e.source===`file`&&console.log(` Source: File (${e.path})`)}console.log(``)}),F()}catch(e){Q(e,`list marketplaces`)}}async function le(e,r){r.cowork&&n(!0);try{await te(e),k(),d(`tengu_marketplace_removed`,{marketplace_name:e}),F(`${t.tick} Successfully removed marketplace: ${e}`)}catch(e){Q(e,`remove marketplace`)}}async function ue(e,r){r.cowork&&n(!0);try{if(e)console.log(`Updating marketplace: ${e}...`),await w(e,e=>{console.log(e)}),k(),d(`tengu_marketplace_updated`,{marketplace_name:e}),F(`${t.tick} Successfully updated marketplace: ${e}`);else{let e=await y(),n=Object.keys(e);n.length===0&&F(`No marketplaces configured`),console.log(`Updating ${n.length} marketplace(s)...`),await v(),k(),d(`tengu_marketplace_updated_all`,{count:n.length}),F(`${t.tick} Successfully updated ${n.length} marketplace(s)`)}}catch(e){Q(e,`update marketplace(s)`)}}async function de(e,t){t.cowork&&n(!0);let r=t.scope||`user`;t.cowork&&r!==`user`&&I(`--cowork can only be used with user scope`),R.includes(r)||I(`Invalid scope: ${r}. Must be one of: ${R.join(`, `)}.`);let{name:i,marketplace:a}=N(e);d(`tengu_plugin_install_command`,{_PROTO_plugin_name:i,...a&&{_PROTO_marketplace_name:a},scope:r}),await B(e,r)}async function fe(e,t){t.cowork&&n(!0);let r=t.scope||`user`;t.cowork&&r!==`user`&&I(`--cowork can only be used with user scope`),R.includes(r)||I(`Invalid scope: ${r}. Must be one of: ${R.join(`, `)}.`);let{name:i,marketplace:a}=N(e);d(`tengu_plugin_uninstall_command`,{_PROTO_plugin_name:i,...a&&{_PROTO_marketplace_name:a},scope:r}),await z(e,r,t.keepData)}async function pe(e,t){t.cowork&&n(!0);let r;t.scope&&(R.includes(t.scope)||I(`Invalid scope "${t.scope}". Valid scopes: ${R.join(`, `)}`),r=t.scope),t.cowork&&r!==void 0&&r!==`user`&&I(`--cowork can only be used with user scope`),t.cowork&&r===void 0&&(r=`user`);let{name:i,marketplace:a}=N(e);d(`tengu_plugin_enable_command`,{_PROTO_plugin_name:i,...a&&{_PROTO_marketplace_name:a},scope:r??`auto`}),await U(e,r)}async function me(e,t){if(t.all&&e&&I(`Cannot use --all with a specific plugin`),!t.all&&!e&&I(`Please specify a plugin name or use --all to disable all plugins`),t.cowork&&n(!0),t.all){t.scope&&I(`Cannot use --scope with --all`),d(`tengu_plugin_disable_command`,{}),await W();return}let r;t.scope&&(R.includes(t.scope)||I(`Invalid scope "${t.scope}". Valid scopes: ${R.join(`, `)}`),r=t.scope),t.cowork&&r!==void 0&&r!==`user`&&I(`--cowork can only be used with user scope`),t.cowork&&r===void 0&&(r=`user`);let{name:i,marketplace:a}=N(e);d(`tengu_plugin_disable_command`,{_PROTO_plugin_name:i,...a&&{_PROTO_marketplace_name:a},scope:r??`auto`}),await V(e,r)}async function he(e,t){t.cowork&&n(!0);let{name:r,marketplace:i}=N(e);d(`tengu_plugin_update_command`,{_PROTO_plugin_name:r,...i&&{_PROTO_marketplace_name:i}});let a=`user`;t.scope&&(L.includes(t.scope)||I(`Invalid scope "${t.scope}". Valid scopes: ${L.join(`, `)}`),a=t.scope),t.cowork&&a!==`user`&&I(`--cowork can only be used with user scope`),await H(e,a)}export{se as marketplaceAddHandler,ce as marketplaceListHandler,le as marketplaceRemoveHandler,ue as marketplaceUpdateHandler,me as pluginDisableHandler,pe as pluginEnableHandler,de as pluginInstallHandler,oe as pluginListHandler,fe as pluginUninstallHandler,he as pluginUpdateHandler,ae as pluginValidateHandler};
@@ -0,0 +1 @@
1
+ import{Ha as e,Wa as t,Xa as n}from"./loadAgentsDir-C9Ee_fs1.js";e();export{t as isPolicyAllowed,n as waitForPolicyLimitsToLoad};
@@ -1 +1 @@
1
- import{Cn as e,wn as t}from"./schemas-BGAvj1T4.js";import{t as n}from"./v4-f1i_CNUT.js";import{S as r,v as i}from"./paths-D9CVAtXU.js";import{n as a,t as o}from"./lazySchema-2sOku3cX.js";n(),o(),r();var s=2e3,c=6e5,l={poll_interval_ms_not_at_capacity:s,poll_interval_ms_at_capacity:c,non_exclusive_heartbeat_interval_ms:0,multisession_poll_interval_ms_not_at_capacity:s,multisession_poll_interval_ms_partial_capacity:s,multisession_poll_interval_ms_at_capacity:c,reclaim_older_than_ms:5e3,session_keepalive_interval_v2_ms:12e4},u={message:`must be 0 (disabled) or ≥100ms`},d=a(()=>t({poll_interval_ms_not_at_capacity:e().int().min(100),poll_interval_ms_at_capacity:e().int().refine(e=>e===0||e>=100,u),non_exclusive_heartbeat_interval_ms:e().int().min(0).default(0),multisession_poll_interval_ms_not_at_capacity:e().int().min(100).default(l.multisession_poll_interval_ms_not_at_capacity),multisession_poll_interval_ms_partial_capacity:e().int().min(100).default(l.multisession_poll_interval_ms_partial_capacity),multisession_poll_interval_ms_at_capacity:e().int().refine(e=>e===0||e>=100,u).default(l.multisession_poll_interval_ms_at_capacity),reclaim_older_than_ms:e().int().min(1).default(5e3),session_keepalive_interval_v2_ms:e().int().min(0).default(12e4)}).refine(e=>e.non_exclusive_heartbeat_interval_ms>0||e.poll_interval_ms_at_capacity>0,{message:`at-capacity liveness requires non_exclusive_heartbeat_interval_ms > 0 or poll_interval_ms_at_capacity > 0`}).refine(e=>e.non_exclusive_heartbeat_interval_ms>0||e.multisession_poll_interval_ms_at_capacity>0,{message:`at-capacity liveness requires non_exclusive_heartbeat_interval_ms > 0 or multisession_poll_interval_ms_at_capacity > 0`}));function f(){let e=i(`tengu_bridge_poll_interval_config`,l,300*1e3),t=d().safeParse(e);return t.success?t.data:l}export{l as n,f as t};
1
+ import{Cn as e,wn as t}from"./schemas-BGAvj1T4.js";import{t as n}from"./v4-f1i_CNUT.js";import{S as r,v as i}from"./paths-C2JRlUsH.js";import{n as a,t as o}from"./lazySchema-2sOku3cX.js";n(),o(),r();var s=2e3,c=6e5,l={poll_interval_ms_not_at_capacity:s,poll_interval_ms_at_capacity:c,non_exclusive_heartbeat_interval_ms:0,multisession_poll_interval_ms_not_at_capacity:s,multisession_poll_interval_ms_partial_capacity:s,multisession_poll_interval_ms_at_capacity:c,reclaim_older_than_ms:5e3,session_keepalive_interval_v2_ms:12e4},u={message:`must be 0 (disabled) or ≥100ms`},d=a(()=>t({poll_interval_ms_not_at_capacity:e().int().min(100),poll_interval_ms_at_capacity:e().int().refine(e=>e===0||e>=100,u),non_exclusive_heartbeat_interval_ms:e().int().min(0).default(0),multisession_poll_interval_ms_not_at_capacity:e().int().min(100).default(l.multisession_poll_interval_ms_not_at_capacity),multisession_poll_interval_ms_partial_capacity:e().int().min(100).default(l.multisession_poll_interval_ms_partial_capacity),multisession_poll_interval_ms_at_capacity:e().int().refine(e=>e===0||e>=100,u).default(l.multisession_poll_interval_ms_at_capacity),reclaim_older_than_ms:e().int().min(1).default(5e3),session_keepalive_interval_v2_ms:e().int().min(0).default(12e4)}).refine(e=>e.non_exclusive_heartbeat_interval_ms>0||e.poll_interval_ms_at_capacity>0,{message:`at-capacity liveness requires non_exclusive_heartbeat_interval_ms > 0 or poll_interval_ms_at_capacity > 0`}).refine(e=>e.non_exclusive_heartbeat_interval_ms>0||e.multisession_poll_interval_ms_at_capacity>0,{message:`at-capacity liveness requires non_exclusive_heartbeat_interval_ms > 0 or multisession_poll_interval_ms_at_capacity > 0`}));function f(){let e=i(`tengu_bridge_poll_interval_config`,l,300*1e3),t=d().safeParse(e);return t.success?t.data:l}export{l as n,f as t};
@@ -1 +1 @@
1
- import{n as e}from"./chunk-DR8-3Aex.js";import{i as t,n,t as r}from"./poorMode-D7WXWZtJ.js";var i;e((()=>{r(),i=async(e,r)=>{let i=!n();return t(i),i?r.setAppState(e=>({...e,promptSuggestionEnabled:!1})):r.setAppState(e=>({...e,promptSuggestionEnabled:!0})),{type:`text`,value:`Poor mode ${i?`ON`:`OFF`} — ${i?`extract_memories and prompt_suggestion are disabled`:`extract_memories and prompt_suggestion are restored`}`}}}))();export{i as call};
1
+ import{n as e}from"./chunk-DR8-3Aex.js";import{i as t,n,t as r}from"./poorMode-DRcH1fuh.js";var i;e((()=>{r(),i=async(e,r)=>{let i=!n();return t(i),i?r.setAppState(e=>({...e,promptSuggestionEnabled:!1})):r.setAppState(e=>({...e,promptSuggestionEnabled:!0})),{type:`text`,value:`Poor mode ${i?`ON`:`OFF`} — ${i?`extract_memories and prompt_suggestion are disabled`:`extract_memories and prompt_suggestion are restored`}`}}}))();export{i as call};
@@ -0,0 +1 @@
1
+ import{n as e,t}from"./poorMode-DRcH1fuh.js";t();export{e as isPoorModeActive};
@@ -1 +1 @@
1
- import{n as e,r as t}from"./chunk-DR8-3Aex.js";import{Ka as n,lo as r,oo as i}from"./paths-D9CVAtXU.js";var a=t({isPoorModeActive:()=>o,setPoorMode:()=>s});function o(){return c===null&&(c=n().poorMode===!0),c}function s(e){c=e,r(`userSettings`,{poorMode:e||void 0})}var c,l=e((()=>{i(),c=null}));export{s as i,o as n,a as r,l as t};
1
+ import{n as e,r as t}from"./chunk-DR8-3Aex.js";import{Ka as n,lo as r,oo as i}from"./paths-C2JRlUsH.js";var a=t({isPoorModeActive:()=>o,setPoorMode:()=>s});function o(){return c===null&&(c=n().poorMode===!0),c}function s(e){c=e,r(`userSettings`,{poorMode:e||void 0})}var c,l=e((()=>{i(),c=null}));export{s as i,o as n,a as r,l as t};
@@ -0,0 +1,39 @@
1
+ import{a as e}from"./chunk-DR8-3Aex.js";import{c as t,l as n,s as r,u as i}from"./envUtils-BWeoiL4Y.js";import{n as a,t as o}from"./defineProperty-80gRi2ZW.js";import{B as s,b as c,v as l}from"./server-DzOdtq8A.js";import{Ct as u,F as d,In as f,R as p,Tn as m,Vn as h,_n as g,_r as ee,cn as _,jr as te,ln as v,nr as y,tr as b,tt as x,y as S}from"./state-sIHsFpDu.js";import{Aa as C,Br as w,Bt as ne,C as re,Cr as ie,Dr as ae,El as T,Et as oe,Fa as se,Ki as ce,Ma as E,Ml as le,Na as ue,Ot as D,Pr as O,Rr as de,S as fe,Si as pe,Tl as me,Xn as he,Xo as k,Yn as ge,_ as _e,a as ve,bl as ye,c as be,jl as xe,kt as Se,ls as Ce,ms as we,no as A,on as Te,oo as Ee,pi as De,qi as Oe,ss as ke,to as Ae,vi as j,xi as je,xs as M,yi as Me,yl as Ne}from"./paths-C2JRlUsH.js";import{E as N,K as Pe,L as P,T as Fe,V as Ie,X as Le,Y as Re,c as ze,d as F,h as Be,p as Ve,s as I,w as L}from"./debug-UI3T040K.js";import{n as He,r as R}from"./analytics-DqMQntaB.js";import{n as Ue,t as We}from"./cwd--iizewsn.js";import{i as Ge,n as z,o as B}from"./process-DMKLUQIO.js";import{F as Ke,I as qe,P as V}from"./git-CN3qtTb_.js";import{J as Je,K as Ye,c as H,et as U,i as Xe,o as Ze,s as W}from"./log-CzsijfHZ.js";import{i as Qe,n as $e}from"./path-B3lx7yHn.js";import{s as et,u as tt}from"./types-Csi32ZXh.js";import{C as nt,c as rt,d as it,l as at,m as ot,s as st,x as G}from"./teammate-DMYOtLTK.js";import{n as ct,t as lt}from"./sleep-8Eb9j_Ly.js";import{Ai as ut,Ax as dt,BD as ft,Bc as pt,Bs as mt,CO as ht,Cc as gt,Cn as _t,D as vt,Db as yt,Dn as bt,Dx as xt,EA as St,EE as Ct,Ex as wt,F as Tt,FE as Et,Fl as Dt,Fv as Ot,Fx as kt,G as At,GD as jt,GS as Mt,G_ as Nt,Gs as Pt,Gt as Ft,HD as It,Ha as Lt,Hy as Rt,Il as zt,Ix as Bt,JD as Vt,JE as Ht,JT as Ut,Ju as Wt,K as Gt,KD as Kt,KS as qt,KT as Jt,Ki as Yt,LE as Xt,LO as Zt,Lc as Qt,MC as $t,MD as en,MT as tn,Mf as nn,Mr as rn,Mv as an,ND as on,NT as sn,Nf as cn,Nr as ln,Nv as un,Nx as dn,O as fn,OE as pn,OO as mn,Ob as hn,On as gn,Ov as _n,PC as vn,Pr as yn,Pv as bn,QA as xn,QD as Sn,QT as Cn,RO as wn,Rc as Tn,S as En,SA as Dn,Sc as On,Si as kn,TE as An,TO as jn,Tc as Mn,Tv as Nn,UD as Pn,Ui as Fn,VD as In,VT as Ln,Vo as Rn,Vs as zn,Vy as Bn,WD as Vn,W_ as Hn,Wa as Un,Xs as Wn,YD as Gn,YE as Kn,Yi as qn,ZD as Jn,ZT as Yn,Zu as Xn,_C as Zn,_E as Qn,_O as $n,_c as er,_o as tr,aD as nr,ag as rr,ay as ir,bc as ar,bi as or,bj as sr,bw as cr,cp as lr,cr as ur,dA as dr,dy as fr,ea as pr,fs as mr,gC as hr,gE as gr,gO as _r,gc as vr,gi as yr,gs as br,gw as xr,hE as Sr,hb as Cr,hi as wr,iE as Tr,ig as Er,iy as Dr,jC as Or,jO as kr,ji as Ar,kE as jr,kv as Mr,lj as Nr,ls as Pr,lu as Fr,mA as Ir,mC as Lr,mw as Rr,nD as zr,nE as K,ny as Br,o as Vr,oD as Hr,oO as Ur,ou as Wr,ow as Gr,oy as Kr,p as qr,pa as Jr,pj as Yr,pr as Xr,pw as Zr,qC as Qr,qD as $r,qh as ei,qs as ti,qu as ni,rD as ri,rE as ii,rO as ai,ri as oi,rw as si,s as ci,sD as li,sj as ui,sp as di,su as fi,tD as pi,tE as mi,tg as hi,u as gi,uj as _i,us as vi,uy as yi,vE as bi,vO as q,vc as xi,vj as Si,vs as Ci,w as wi,wO as Ti,wc as Ei,ww as Di,wx as Oi,x as ki,xc as Ai,yb as ji,yc as Mi,yi as Ni,yw as Pi,zD as J,zc as Fi}from"./loadAgentsDir-C9Ee_fs1.js";import{F as Ii,Hn as Li,Ht as Ri,M as zi,Nt as Bi,Pt as Vi,Vn as Hi,_t as Ui,pn as Wi,vt as Gi,xn as Ki}from"./prompt-thBQB2X5.js";import{i as qi,o as Ji}from"./xml-BW5T-oW-.js";import{a as Yi,o as Xi,s as Zi}from"./fileStateCache-C7-TxF8G.js";import{A as Qi,C as $i,D as ea,N as ta,O as na,P as ra,Z as ia,_ as aa,d as oa,g as sa,h as ca,m as la,u as ua,v as da,y as fa}from"./rcDebugLog-CIS3PU-H.js";import{c as pa,l as ma}from"./commitAttribution-C479aqmn.js";import{P as ha,V as ga,a as _a,d as va}from"./teamHelpers-9p7wPcXj.js";import{t as ya}from"./pollConfig-Duecunu0.js";import{r as ba}from"./inboundAttachments-DQ4Czsr5.js";import{i as xa,n as Sa,s as Ca}from"./mappers-D1SAyuKF.js";import{n as wa,r as Ta}from"./sessionTitle-BOM0LQlq.js";import{n as Ea,t as Da}from"./ccrClient-BYD1ONzC.js";import{n as Oa,t as ka}from"./HybridTransport-Df_FceV2.js";import{n as Aa,t as ja}from"./SSETransport-CJrrD1ln.js";import{t as Ma}from"./pluginBlocklist-7dlesHcW.js";import{c as Na,d as Pa,f as Fa,l as Ia,o as La,r as Ra,s as za,u as Ba}from"./channelNotification-B0QskFjB.js";import{t as Va}from"./onChangeAppState-pafR88Yw.js";import{t as Ha}from"./settingsSync-BIsGiZhM.js";import{a as Ua,c as Wa,d as Ga,f as Ka,l as qa,m as Ja,o as Ya,p as Xa,r as Za,t as Qa}from"./cronJitterConfig-C2a-Ybqm.js";import{i as $a,n as eo}from"./toolPool-CiEaFfxq.js";import{n as to,r as no}from"./QueryEngine-CEodAvI2.js";import{n as ro,r as io}from"./sideQuestion-iy7kJEkr.js";import{n as ao,r as oo}from"./context-noninteractive-BApFNncX.js";import{a as so,o as co,t as lo}from"./skillChangeDetector-8LVraP0Y.js";import{n as uo,t as fo}from"./refresh-C_FDHRT7.js";import{dirname as po,join as mo}from"path";import{PassThrough as ho}from"stream";import{randomUUID as Y}from"crypto";import{readFile as go,stat as _o}from"fs/promises";import{URL as vo}from"url";import{cwd as X}from"process";a(),_(),Ue(),Re(),Ie(),L(),Be(),z(),I(),V(),U(),Ze(),Qe(),et(),G(),M(),Ee(),se(),E(),Oe(),O(),ge(),lt(),Te(),at(),fe(),ve(),Hi(),Ki(),Dn(),Ir(),jn(),Pn(),on(),Kn(),ta(),Ct(),ha(),ii(),Ln(),na(),Hn(),oa(),Fi(),Tn(),vi(),Rn(),pr(),yn(),gn(),_t(),Ha(),r(),Aa();function yo(e,t={},n,r){if(i(process.env.CLAUDE_CODE_USE_CCR_V2)){let i=new vo(e.href);return i.protocol===`wss:`?i.protocol=`https:`:i.protocol===`ws:`&&(i.protocol=`http:`),i.pathname=i.pathname.replace(/\/$/,``)+`/worker/events/stream`,new ja(i,t,n,r)}if(e.protocol===`ws:`||e.protocol===`wss:`)return i(process.env.CLAUDE_CODE_POST_FOR_SESSION_INGRESS_V2)?new ka(e,t,n,r):new Oa(e,t,n,r);throw Error(`Unsupported protocol: ${e.protocol}`)}r(),Aa();var bo=class extends Ga{constructor(e,t,n){let r=new ho({encoding:`utf8`});super(r,n),o(this,`url`,void 0),o(this,`transport`,void 0),o(this,`inputStream`,void 0),o(this,`isBridge`,!1),o(this,`isDebug`,!1),o(this,`ccrClient`,null),o(this,`keepAliveTimer`,null),this.inputStream=r,this.url=new vo(e);let a={},s=ea();s?a.Authorization=`Bearer ${s}`:F(`[remote-io] No session ingress token available`,{level:`error`});let c=process.env.CLAUDE_CODE_ENVIRONMENT_RUNNER_VERSION;if(c&&(a[`x-environment-runner-version`]=c),this.transport=yo(this.url,a,u(),()=>{let e={},t=ea();t&&(e.Authorization=`Bearer ${t}`);let n=process.env.CLAUDE_CODE_ENVIRONMENT_RUNNER_VERSION;return n&&(e[`x-environment-runner-version`]=n),e}),this.isBridge=process.env.CLAUDE_CODE_ENVIRONMENT_KIND===`bridge`,this.isDebug=ze(),this.transport.setOnData(e=>{this.inputStream.write(e),this.isBridge&&this.isDebug&&B(e.endsWith(`
2
+ `)?e:e+`
3
+ `)}),this.transport.setOnClose(()=>{this.inputStream.end()}),i(process.env.CLAUDE_CODE_USE_CCR_V2)){if(!(this.transport instanceof ja))throw Error(`CCR v2 requires SSETransport; check getTransportForUrl`);this.ccrClient=new Da(this.transport,this.url);let e=this.ccrClient.initialize();this.restoredWorkerState=e.catch(()=>null),e.catch(e=>{Ke(`error`,`cli_worker_lifecycle_init_failed`,{reason:e instanceof Ea?e.reason:`unknown`}),W(Error(`CCRClient initialization failed: ${P(e)}`)),mi(1,`other`)}),Le(async()=>this.ccrClient?.close()),Ar((e,t,n)=>this.ccrClient.writeInternalEvent(e,t,n)),ut(()=>this.ccrClient.readInternalEvents(),()=>this.ccrClient.readSubagentInternalEvents());let t={started:`processing`,completed:`processed`};jt((e,n)=>{this.ccrClient?.reportDelivery(e,t[n])}),da((e,t)=>{this.ccrClient?.reportState(e,t)}),aa(e=>{this.ccrClient?.reportMetadata(e)},{replayCurrent:!0})}this.transport.connect();let l=ya().session_keepalive_interval_v2_ms;if(this.isBridge&&l>0&&(this.keepAliveTimer=setInterval(()=>{F(`[remote-io] keep_alive sent`),this.write({type:`keep_alive`}).catch(e=>{F(`[remote-io] keep_alive write failed: ${P(e)}`)})},l),this.keepAliveTimer.unref?.()),Le(async()=>this.close()),t){let e=this.inputStream;(async()=>{for await(let n of t)e.write(String(n).replace(/\n$/,``)+`
4
+ `)})()}}flushInternalEvents(){return this.ccrClient?.flushInternalEvents()??Promise.resolve()}get internalEventsPending(){return this.ccrClient?.internalEventsPending??0}async write(e){this.ccrClient?await this.ccrClient.writeEvent(e):await this.transport.write(e),this.isBridge&&(e.type===`control_request`||this.isDebug)&&B(Ka(e)+`
5
+ `)}close(){this.keepAliveTimer&&(clearInterval(this.keepAliveTimer),this.keepAliveTimer=null),this.transport.close(),this.inputStream.end()}};Wi(),k(),Ri(),Vi(),[...Bi],Re(),I();var xo=`[stdout-guard]`,So=!1,Z=``,Co=null;function wo(e){if(e.length===0)return!0;try{return JSON.parse(e),!0}catch{return!1}}function To(){So||(So=!0,Co=process.stdout.write.bind(process.stdout),process.stdout.write=function(e,t,n){let r=typeof e==`string`?e:Buffer.from(e).toString(`utf-8`);Z+=r;let i,a=!0;for(;(i=Z.indexOf(`
6
+ `))!==-1;){let e=Z.slice(0,i);Z=Z.slice(i+1),wo(e)?a=Co(e+`
7
+ `):(process.stderr.write(`${xo} ${e}\n`),F(`streamJsonStdoutGuard diverted non-JSON stdout line: ${e.slice(0,200)}`))}let o=typeof t==`function`?t:n;return o&&queueMicrotask(()=>o()),a},Le(async()=>{Z.length>0&&(Co&&wo(Z)?Co(Z+`
8
+ `):process.stderr.write(`${xo} ${Z}\n`),Z=``),Co&&(process.stdout.write=Co,Co=null),So=!1}))}Ne(),Ce(),Si(),ui(),qi(),Gi(),Xi(),ra(),Hr(),Xt(),Pi(),Gr(),fr(),an(),_n(),Xn(),gt(),Pt(),br(),Gt(),Vr(),Ba(),Na(),eo(),Nn(),Ie(),Ze(),na(),Br(),I(),ii();function Eo(e){let t=process.env.CLAUDE_CODE_EXIT_AFTER_STOP_DELAY,n=t?parseInt(t,10):null,r=n&&!isNaN(n)&&n>0,i=null,a=0;return{start(){i&&(clearTimeout(i),i=null),r&&(a=Date.now(),i=setTimeout(()=>{let t=Date.now()-a;e()&&t>=n&&(F(`Exiting after ${n}ms of idle time`),K())},n))},stop(){i&&(clearTimeout(i),i=null)}}}xe(),me(),j(),Zt(),pi(),gr(),sn(),qt(),yt(),ji(),zt(),Lt(),wi(),Ta(),ro();function Do(e){if(e.toLowerCase().endsWith(`.jsonl`))return{sessionId:Y(),ingressUrl:null,isUrl:!1,jsonlFile:e,isJsonlFile:!0};if(Nt(e))return{sessionId:e,ingressUrl:null,isUrl:!1,jsonlFile:null,isJsonlFile:!1};try{let t=new URL(e);return{sessionId:Y(),ingressUrl:t.href,isUrl:!0,jsonlFile:null,isJsonlFile:!1}}catch{}return null}s(),D(),ai(),Gn(),In(),ma(),Yn(),Or(),Lr(),dn(),cn(),Wr(),Sa(),oo(),I();async function Oo(){try{let e=await go(ar(),`utf-8`),t=we().safeParse(Fe(e));return t.success?t.data:(F(`Invalid known_marketplaces.json in zip cache: ${t.error.message}`,{level:`error`}),{})}catch{return{}}}async function ko(e){await vr(ar(),N(e,null,2))}async function Ao(e,t){let n=Mi();if(!n)return;let r=await jo(t);r!==null&&await vr(mo(n,xi(e)),r)}async function jo(e){let t=[mo(e,`.claude-plugin`,`marketplace.json`),mo(e,`marketplace.json`),e];for(let e of t)try{return await go(e,`utf-8`)}catch{}return null}async function Mo(){let e=await ti();for(let[t,n]of Object.entries(e))if(n.installLocation)try{await Ao(t,n.installLocation)}catch(e){F(`Failed to save marketplace JSON for ${t}: ${e}`)}await ko({...await Oo(),...e})}He(),Re(),I(),V(),Ze(),Pt(),gt();async function No(){let e=Mn();F(`installPluginsForHeadless: starting${e?` (zip cache mode)`:``}`);let t=await Wn();t&&(mt(),mr(`headlessPluginInstall: seed marketplaces registered`)),e&&(await Ve().mkdir(Ai()),await Ve().mkdir(On()));let n=Object.keys(zn()).length,r={marketplaces_installed:0,delisted_count:0},i=t;try{if(n===0)F(`installPluginsForHeadless: no marketplaces declared`);else{let t=await qe(`headless_marketplace_reconcile`,()=>Wa({skip:e?(e,t)=>!Ei(t):void 0,onProgress:e=>{e.type===`installed`?F(`installPluginsForHeadless: installed marketplace ${e.name}`):e.type===`failed`&&F(`installPluginsForHeadless: failed to install marketplace ${e.name}: ${e.error}`)}}),e=>({installed_count:e.installed.length,updated_count:e.updated.length,failed_count:e.failed.length,skipped_count:e.skipped.length}));t.skipped.length>0&&F(`installPluginsForHeadless: skipped ${t.skipped.length} marketplace(s) unsupported by zip cache: ${t.skipped.join(`, `)}`);let n=t.installed.length+t.updated.length;n>0&&(mt(),mr(`headlessPluginInstall: marketplaces reconciled`),i=!0),r.marketplaces_installed=n}e&&await Mo();let t=await Ma();return r.delisted_count=t.length,t.length>0&&(i=!0),i&&mr(`headlessPluginInstall: plugins changed`),e&&Le(er),i}catch(e){return W(e),!1}finally{R(`tengu_headless_plugin_install`,r)}}He(),I(),V(),Pn(),oa(),Ze(),z(),Hn(),ii(),Re(),Ue(),_(),yn(),Rn(),L(),r(),fo(),br(),ei(),_a(),jr(),Bn(),di(),Ie();var Q=(bi(),e(Qn)),$=(fa(),e($i)),Po=(Ya(),e(Ua)),Fo=(Za(),e(Qa)),Io=(zi(),e(Ii)),Lo=`<system-reminder>
9
+ You are running in non-interactive mode and cannot return a response to the user until your team is shut down.
10
+
11
+ You MUST shut down your team before preparing your final response:
12
+ 1. Use requestShutdown to ask each team member to shut down gracefully
13
+ 2. Wait for shutdown approvals
14
+ 3. Use the cleanup operation to clean up the team
15
+ 4. Only then provide your final response to the user
16
+
17
+ The user cannot receive your response until the team is completely shut down.
18
+ </system-reminder>
19
+
20
+ Shut down your team and prepare your final response for the user.`,Ro=1e4,zo=new Set,Bo=[];function Vo(e){if(zo.has(e))return!1;if(zo.add(e),Bo.push(e),Bo.length>Ro){let e=Bo.splice(0,Bo.length-Ro);for(let t of e)zo.delete(t)}return!0}function Ho(e){return typeof e==`string`?[{type:`text`,text:e}]:e}function Uo(e){return e.length===1?e[0]:e.every(e=>typeof e==`string`)?e.join(`
21
+ `):e.flatMap(Ho)}function Wo(e,t){return t!==void 0&&t.mode===`prompt`&&t.workload===e.workload&&t.isMeta===e.isMeta}async function Go(e,t,n,r,a,o,s,c){if(process.env.USER_TYPE===`ant`&&i(process.env.CLAUDE_CODE_EXIT_AFTER_FIRST_RENDER)&&(process.stderr.write(`\nStartup time: ${Math.round(process.uptime()*1e3)}ms\n`),process.exit(0)),St.subscribe(e=>{Mt(e,n),je()&&n(e=>{let t=e.settings,n=t.fastMode===!0&&!t.fastModePerSessionOptIn;return{...e,fastMode:n}})}),$&&!$.isProactiveActive()&&i(process.env.CLAUDE_CODE_PROACTIVE)&&$.activateProactive(`command`),typeof Bun<`u`&&setInterval(()=>{process.memoryUsage.rss()>350*1024*1024?Bun.gc(!0):Bun.gc(!1)},1e3).unref(),ft(),J(`runHeadless_entry`),await Cn()&&await Ut(),J(`after_grove_check`),re(),c.resumeSessionAt&&!c.resume){process.stderr.write(`Error: --resume-session-at requires --resume
22
+ `),K(1);return}if(c.rewindFiles&&!c.resume){process.stderr.write(`Error: --rewind-files requires --resume
23
+ `),K(1);return}if(c.rewindFiles&&e){process.stderr.write(`Error: --rewind-files is a standalone operation and cannot be used with a prompt
24
+ `),K(1);return}let l=rs(e,c);c.outputFormat===`stream-json`&&To();let d=dr.getSandboxUnavailableReason();if(d){if(dr.isSandboxRequired()){process.stderr.write(`\nError: sandbox required but unavailable: ${d}\n sandbox.failIfUnavailable is set — refusing to start without a working sandbox.\n\n`),K(1);return}process.stderr.write(`\n⚠ Sandbox disabled: ${d}\n Commands will run WITHOUT sandboxing. Network and filesystem restrictions will NOT be enforced.\n\n`)}else if(dr.isSandboxingEnabled())try{await dr.initialize(l.createSandboxAskCallback())}catch(e){process.stderr.write(`\n❌ Sandbox Error: ${P(e)}\n`),K(1,`other`);return}c.outputFormat===`stream-json`&&c.verbose&&pt(e=>{let t=(()=>{switch(e.type){case`started`:return{type:`system`,subtype:`hook_started`,hook_id:e.hookId,hook_name:e.hookName,hook_event:e.hookEvent,uuid:Y(),session_id:u()};case`progress`:return{type:`system`,subtype:`hook_progress`,hook_id:e.hookId,hook_name:e.hookName,hook_event:e.hookEvent,stdout:e.stdout,stderr:e.stderr,output:e.output,uuid:Y(),session_id:u()};case`response`:return{type:`system`,subtype:`hook_response`,hook_id:e.hookId,hook_name:e.hookName,hook_event:e.hookEvent,output:e.output,stdout:e.stdout,stderr:e.stderr,exit_code:e.exitCode,outcome:e.outcome,uuid:Y(),session_id:u()}}})();l.write(t)}),c.setupTrigger&&await bn(c.setupTrigger),J(`before_loadInitialMessages`);let f=t(),{messages:p,turnInterruptionState:m,agentSetting:h}=await ns(n,{continue:c.continue,teleport:c.teleport,resume:c.resume,resumeSessionAt:c.resumeSessionAt,forkSession:c.forkSession,outputFormat:c.outputFormat,sessionStartHooksPromise:c.sessionStartHooksPromise,restoredWorkerState:l.restoredWorkerState}),g=Ot();if(g&&l.prependUserMessage(g),!c.agent&&!x()&&h){let{agentDefinition:e}=so(h,void 0,{activeAgents:s,allAgents:s});if(e){if(n(t=>({...t,agent:e.agentType})),!c.systemPrompt&&!ci(e)){let t=e.getSystemPrompt();t&&(c.systemPrompt=t)}Ni(e.agentType)}}if(p.length===0&&process.exitCode!==void 0)return;if(c.rewindFiles){let e=p.find(e=>e.uuid===c.rewindFiles);if(!e||e.type!==`user`){process.stderr.write(`Error: --rewind-files requires a user message UUID, but ${c.rewindFiles} is not a user message in this session\n`),K(1);return}let r=t(),i=await Xo(c.rewindFiles,r,n,!1);if(!i.canRewind){process.stderr.write(`Error: ${i.error||`Unexpected error`}\n`),K(1);return}process.stdout.write(`Files rewound to state at message ${c.rewindFiles}\n`),K(0);return}let ee=typeof c.resume==`string`&&(!!Nt(c.resume)||c.resume.endsWith(`.jsonl`)),_=!!c.sdkUrl;if(!e&&!ee&&!_){process.stderr.write(`Error: Input must be provided either through stdin or as a prompt argument when using --print
25
+ `),K(1);return}if(c.outputFormat===`stream-json`&&!c.verbose){process.stderr.write(`Error: When using --print, --output-format=stream-json requires --verbose
26
+ `),K(1);return}let te=Wt(f.mcp.tools,f.toolPermissionContext),v=[...a,...te],y=Jo(c.sdkUrl?`stdio`:c.permissionPromptToolName,l,()=>t().mcp.tools,e=>{n(e=>({...e,attribution:{...e.attribution,permissionPromptCount:e.attribution.permissionPromptCount+1}})),ca(`requires_action`,e)});c.permissionPromptToolName&&(v=v.filter(e=>!Li(e,c.permissionPromptToolName))),Ge(),J(`after_loadInitialMessages`),await C(),J(`after_modelStrings`);let b=c.outputFormat===`json`&&c.verbose,S=[],w;J(`before_runHeadlessStreaming`);for await(let e of Ko(l,f.mcp.clients,[...r,...f.mcp.commands],v,p,y,o,t,n,s,c,m))c.outputFormat===`stream-json`&&c.verbose&&await l.write(e),e.type!==`control_response`&&e.type!==`control_request`&&e.type!==`control_cancel_request`&&!(e.type===`system`&&(e.subtype===`session_state_changed`||e.subtype===`task_notification`||e.subtype===`task_started`||e.subtype===`task_progress`||e.subtype===`post_turn_summary`))&&e.type!==`stream_event`&&e.type!==`keep_alive`&&e.type!==`streamlined_text`&&e.type!==`streamlined_tool_use_summary`&&e.type!==`prompt_suggestion`&&(b&&S.push(e),w=e);switch(c.outputFormat){case`json`:if(!w||w.type!==`result`)throw Error(`No messages returned`);if(c.verbose){B(N(S)+`
27
+ `);break}B(N(w)+`
28
+ `);break;case`stream-json`:break;default:if(!w||w.type!==`result`)throw Error(`No messages returned`);switch(w.subtype){case`success`:B(w.result.endsWith(`
29
+ `)?w.result:w.result+`
30
+ `);break;case`error_during_execution`:B(`Execution error`);break;case`error_max_turns`:B(`Error: Reached max turns (${c.maxTurns}).\nTip: Increase the limit with --max-turns or continue in a new session.`);break;case`error_max_budget_usd`:B(`Error: Exceeded USD budget ($${c.maxBudgetUsd}).\nTip: Increase the limit with --max-budget-usd or start a new session to continue.`);break;case`error_max_structured_output_retries`:B(`Error: Failed to provide valid structured output after maximum retries.
31
+ Tip: Simplify your schema or check if the output format matches the expected structure.`)}}if(It(),be())try{let{drainPendingExtraction:e}=await import(`./extractMemories-C8R4DJVc.js`);await e()}catch{}K(w?.type===`result`&&w?.is_error?1:0)}function Ko(e,r,a,o,s,m,h,g,_,te,v,y){let x=!1,S,C=!1,re=!1,se=null,E,D=e.outbound;process.on(`SIGINT`,()=>{Ke(`info`,`shutdown_signal`,{signal:`SIGINT`}),E&&!E.signal.aborted&&E.abort(),mi(0)}),Le(async()=>{let t={};for(let e of pn(g()))Rt(e)&&(t[e.type]=(t[e.type]??0)+1);Ke(`info`,`run_state_at_shutdown`,{run_active:x,run_phase:S,worker_status:ua(),internal_events_pending:e.internalEventsPending,bg_tasks:t})}),sa(e=>{(e===`default`||e===`acceptEdits`||e===`bypassPermissions`||e===`plan`||e===`auto`||e===`dontAsk`)&&D.enqueue({type:`system`,subtype:`status`,status:null,permissionMode:e,uuid:Y(),session_id:u()})});let O={abortController:null,inflightPromise:null,lastEmitted:null,pendingSuggestion:null,pendingLastEmittedEntry:null},fe;v.enableAuthStatus&&(fe=ce.getInstance().subscribe(e=>{D.enqueue({type:`auth_status`,isAuthenticating:e.isAuthenticating,output:e.output,error:e.error,uuid:Y(),session_id:u()})}));let me=e=>{let t=Ca(e);t&&D.enqueue({type:`rate_limit_event`,rate_limit_info:t,uuid:Y(),session_id:u()})};wn.add(me);let k=s,ge=Et(s,X(),100),ve=Yi(100),be=process.env.CLAUDE_CODE_RESUME_INTERRUPTED_TURN;y&&y.kind!==`none`&&be&&(F(`[print.ts] Auto-resuming interrupted turn (kind: ${y.kind})`),ts(k,y.message),q({mode:`prompt`,value:y.message.message.content,uuid:Y()}));let xe=nn().map(e=>{let t=e.value===null?`default`:e.value,n=t===`default`?ie():w(t),r=Nr(n),i=sr(n),a=pe(e.value),o=he(n);return{name:t,value:t,displayName:e.label,description:e.description,...r&&{supportsEffort:!0,supportedEffortLevels:_i(n)?[...xn]:xn.filter(e=>e!==`max`)},...i&&{supportsAdaptiveThinking:!0},...a&&{supportsFastMode:!0},...o&&{supportsAutoMode:!0}}}),Ce=v.userSpecifiedModel;function we(e,t){let n=tr(e,de(t));k.push(...n);for(let e of n)typeof e.message.content==`string`&&e.message.content.includes(`<local-command-stdout>`)&&D.enqueue({type:`user`,content:e.message.content,message:e.message,session_id:u(),parent_tool_use_id:null,uuid:e.uuid,timestamp:e.timestamp,isReplay:!0})}let A=[],Te=[],Ee=new Set;function De(t){for(let n of t){if(n.type!==`connected`||Ee.has(n.name)||n.config.type===`sdk`)continue;let t=n.name;try{n.client.setRequestHandler(l,async(n,r)=>{H(t,`Elicitation request received in print mode: ${N(n)}`);let i=n.params.mode===`url`?`url`:`form`;R(`tengu_mcp_elicitation_shown`,{mode:i});let a=await hr(t,n.params,r.signal);if(a)return H(t,`Elicitation resolved by hook: ${N(a)}`),R(`tengu_mcp_elicitation_response`,{mode:i,action:a.action}),a;let o=`url`in n.params?n.params.url:void 0,s=`requestedSchema`in n.params?n.params.requestedSchema:void 0,c=`elicitationId`in n.params?n.params.elicitationId:void 0,l=await Zn(t,await e.handleElicitation(t,n.params.message,s,r.signal,i,o,c),r.signal,i,c);return R(`tengu_mcp_elicitation_response`,{mode:i,action:l.action}),l}),n.client.setNotificationHandler(c,e=>{let{elicitationId:n}=e.params;H(t,`Elicitation completion notification: ${n}`),Ft({message:`MCP server "${t}" confirmed elicitation ${n} complete`,notificationType:`elicitation_complete`}),D.enqueue({type:`system`,subtype:`elicitation_complete`,mcp_server_name:t,elicitation_id:n,uuid:Y(),session_id:u()})}),Ee.add(t)}catch{}}}async function Oe(){let t=new Set(Object.keys(h)),n=new Set(A.map(e=>e.name)),r=Array.from(t).some(e=>!n.has(e)),i=Array.from(n).some(e=>!t.has(e)),a=A.some(e=>e.type===`pending`),o=A.some(e=>e.type===`failed`);if(r||i||a||o){for(let e of A)t.has(e.name)||e.type===`connected`&&await e.cleanup();let r=await Bt(h,(t,n)=>e.sendMcpMessage(t,n));A=r.clients,Te=r.tools;let i=nt([...n,...t]);_(e=>({...e,mcp:{...e.mcp,tools:[...e.mcp.tools.filter(e=>!i.some(t=>e.name.startsWith(ke(t)))),...Te]}})),li(A)}}Oe();let j={clients:[],tools:[],configs:{}},je=e=>{let t=ni(e.toolPermissionContext,e.mcp.tools),n=ye($a([...o,...Te,...j.tools],t,e.toolPermissionContext.mode),`name`);v.permissionPromptToolName&&(n=n.filter(e=>!Li(e,v.permissionPromptToolName)));let r=p();if(r&&!v.jsonSchema){let e=Ui(r);`tool`in e&&(n=[...n,e.tool])}return n},M=null,Me=0;function Ne(){if(!M)return;let e=Math.min(Me,k.length),t=k.slice(e).filter(e=>e.type===`user`||e.type===`assistant`);Me=k.length,t.length>0&&M.writeMessages(t)}let Fe=Promise.resolve({response:{added:[],removed:[],errors:{}},sdkServersChanged:!1});function Ie(e){let t=async()=>{let t=new Set(A.map(e=>e.name)),n=await os(e,{configs:h,clients:A,tools:Te},j,_);for(let e of Object.keys(h))delete h[e];if(Object.assign(h,n.newSdkState.configs),A=n.newSdkState.clients,Te=n.newSdkState.tools,j=n.newDynamicState,n.sdkServersChanged){let e=new Set(A.map(e=>e.name)),n=nt([...t,...e]);_(e=>({...e,mcp:{...e.mcp,tools:[...e.mcp.tools.filter(e=>!n.some(t=>e.name.startsWith(ke(t)))),...Te]}}))}return{response:n.response,sdkServersChanged:n.sdkServersChanged}};return Fe=Fe.then(t,t),Fe}function Re(){let e=g(),t=e.mcp.clients,n=ye([...e.mcp.tools,...j.tools],`name`),r=new Set([...t.map(e=>e.name),...A.map(e=>e.name)]);return[...t,...A,...j.clients.filter(e=>!r.has(e.name))].map(e=>{let t;if(e.config.type===`sse`||e.config.type===`http`)t={type:e.config.type,url:e.config.url,headers:e.config.headers,oauth:e.config.oauth};else if(e.config.type===`claudeai-proxy`)t={type:`claudeai-proxy`,url:e.config.url,id:e.config.id};else if(e.config.type===`stdio`||e.config.type===void 0){let n=e.config;t={type:`stdio`,command:n.command,args:n.args}}let r=e.type===`connected`?si(n,e.name).map(e=>({name:e.mcpInfo?.toolName??e.name,annotations:{readOnly:e.isReadOnly({})||void 0,destructive:e.isDestructive?.({})||void 0,openWorld:e.isOpenWorld?.({})||void 0}})):void 0,i;if(e.type===`connected`&&e.capabilities.experimental){let t={...e.capabilities.experimental};t[`claude/channel`]&&(!Fa()||!Pa(e.config.pluginSource))&&delete t[`claude/channel`],Object.keys(t).length>0&&(i={experimental:t})}return{name:e.name,status:e.type,serverInfo:e.type===`connected`?e.serverInfo:void 0,error:e.type===`failed`?e.error:void 0,config:t,scope:e.config.scope,tools:r,capabilities:i}})}async function ze(){try{await Promise.all([Promise.resolve(),qe(`headless_managed_settings_wait`,()=>Jt())]),await No()&&await Ue()}catch(e){W(e)}}let Be=null;t()||(i(process.env.CLAUDE_CODE_SYNC_PLUGIN_INSTALL)?Be=ze():ze());let Ve=Eo(()=>!x),I=a,L=te;async function He(){let{agentDefinitions:e}=await uo(_);I=await qn(X());let t=L.filter(e=>e.source===`flagSettings`);L=[...e.allAgents,...t]}async function Ue(){let{servers:e}=await Rr(),t={};for(let[n,r]of Object.entries(e)){let e=r.type;(e===void 0||e===`stdio`||e===`sse`||e===`http`||e===`sdk`)&&(t[n]=r)}for(let[e,n]of Object.entries(h))n.type===`sdk`&&!(e in t)&&(t[e]=n);let{response:n,sdkServersChanged:r}=await Ie(t);r&&Oe(),F(`Headless MCP refresh: added=${n.added.length}, removed=${n.removed.length}`)}let We=lo.subscribe(()=>{Fn(),qn(X()).then(e=>{I=e})}),Ge=()=>{setTimeout(()=>{!$?.isProactiveActive()||$.isProactivePaused()||C||(async()=>{let e=await Sn({basePrompt:`<${Je}>${new Date().toLocaleTimeString()}</${Je}>`,currentDir:X(),shouldCreate:()=>!C});if(C){await Kt({commands:e});return}for(let t of e)q({...t,uuid:Y()});z()})().catch(e=>{W(e),F(`[Proactive] failed to create headless tick: ${e}`,{level:`error`})})},0)};kr(()=>{E&&ht(`now`).length>0&&E.abort(`interrupt`)});let z=async()=>{if(x)return;if(x=!0,S=void 0,ca(`running`),Ve.stop(),J(`run_entry`),await Oe(),J(`after_updateSdkMcp`),Be){let e=parseInt(process.env.CLAUDE_CODE_SYNC_PLUGIN_INSTALL_TIMEOUT_MS||``,10);if(e>0){let t=ct(e).then(()=>`timeout`);await Promise.race([Be,t])===`timeout`&&(W(Error(`CLAUDE_CODE_SYNC_PLUGIN_INSTALL: plugin installation timed out after ${e}ms`)),R(`tengu_sync_plugin_install_timeout`,{timeout_ms:e}))}else await Be;Be=null,await He();let{setupPluginHookHotReload:t}=await import(`./loadPluginHooks-DaETszNq.js`);t()}let t=e=>e.agentId===void 0;try{let r,i=!1,a=async()=>{for(;r=_r(t);){if(r.mode!==`prompt`&&r.mode!==`orphaned-permission`&&r.mode!==`task-notification`)throw Error(`only prompt commands are supported in streaming mode`);let i=[r];if(r.mode===`prompt`)for(;Wo(r,mn(t));)i.push(_r(t));let a=await $r(i);if(i=a.attachmentCommands,i.length===0)continue;r=i[0],r.mode===`prompt`&&i.length>1&&(r={...r,value:Uo(i.map(e=>e.value)),uuid:i.findLast(e=>e.uuid)?.uuid??r.uuid});let o=i.map(e=>e.uuid).filter(e=>e!==void 0);if(v.replayUserMessages&&i.length>1)for(let e of i)e.uuid&&e.uuid!==r.uuid&&D.enqueue({type:`user`,content:e.value,message:{role:`user`,content:e.value},session_id:u(),parent_tool_use_id:null,uuid:e.uuid,isReplay:!0});let s=g(),c=[...s.mcp.clients,...A,...j.clients];De(c);for(let e of c)$o(e);let l=je(s);for(let e of o)Vn(e,`started`);if(r.mode===`task-notification`){let e=typeof r.value==`string`?r.value:``,t=e.match(/<task-id>([^<]+)<\/task-id>/),n=e.match(/<tool-use-id>([^<]+)<\/tool-use-id>/),i=e.match(/<output-file>([^<]+)<\/output-file>/),a=e.match(/<status>([^<]+)<\/status>/),o=e.match(/<summary>([^<]+)<\/summary>/),s=e=>e===`completed`||e===`failed`||e===`stopped`||e===`killed`,c=a?.[1],l=s(c)?c===`killed`?`stopped`:c:`completed`,d=e.match(/<usage>([\s\S]*?)<\/usage>/)?.[1]??``,f=d.match(/<total_tokens>(\d+)<\/total_tokens>/),p=d.match(/<tool_uses>(\d+)<\/tool_uses>/),m=d.match(/<duration_ms>(\d+)<\/duration_ms>/);a&&D.enqueue({type:`system`,subtype:`task_notification`,task_id:t?.[1]??``,tool_use_id:n?.[1],status:l,output_file:i?.[1]??``,summary:o?.[1]??``,usage:f&&p?{total_tokens:parseInt(f[1],10),tool_uses:parseInt(p[1],10),duration_ms:m?parseInt(m[1],10):0}:void 0,session_id:u(),uuid:Y()})}let d=r.value,f=a.claimedCommands;if(e instanceof bo&&r.mode===`prompt`&&R(`tengu_bridge_message_received`,{is_repl:!1}),O.abortController?.abort(),O.abortController=null,O.pendingSuggestion=null,O.pendingLastEmittedEntry=null,O.lastEmitted&&r.mode===`prompt`){let e=typeof d==`string`?d:d.find(e=>e.type===`text`)?.text;typeof e==`string`&&zr(O.lastEmitted.text,e,O.lastEmitted.emittedAt,O.lastEmitted.promptId,O.lastEmitted.generationRequestId),O.lastEmitted=null}E=en(),J(`before_ask`),Fr();let h=r,ee=!1;try{if(await Se(h.workload??v.workload,async()=>{for await(let t of to({commands:ye([...I,...s.mcp.commands],`name`),prompt:d,promptUuid:h.uuid,isMeta:h.isMeta,cwd:X(),tools:l,verbose:v.verbose,mcpClients:c,thinkingConfig:v.thinkingConfig,maxTurns:v.maxTurns,maxBudgetUsd:v.maxBudgetUsd,taskBudget:v.taskBudget,canUseTool:m,userSpecifiedModel:Ce,fallbackModel:v.fallbackModel,jsonSchema:p()??v.jsonSchema,mutableMessages:k,getReadFileCache:()=>ve.size===0?ge:Zi(ge,ve),setReadFileCache:e=>{ge=e;for(let[e,t]of ve.entries()){let n=ge.get(e);(!n||t.timestamp>n.timestamp)&&ge.set(e,t)}ve.clear()},customSystemPrompt:v.systemPrompt,appendSystemPrompt:v.appendSystemPrompt,getAppState:g,setAppState:_,abortController:E,replayUserMessages:v.replayUserMessages,includePartialMessages:v.includePartialMessages,handleElicitation:(t,n,r)=>e.handleElicitation(t,n.message,void 0,r,n.mode,n.url,`elicitationId`in n?n.elicitationId:void 0),agents:L,orphanedPermission:h.orphanedPermission,setSDKStatus:e=>{D.enqueue({type:`system`,subtype:`status`,status:e,session_id:u(),uuid:Y()})}}))if(Ne(),t.type===`result`){ee=!!t.is_error;for(let e of Qi())D.enqueue(e);pn(g()).some(e=>(e.type===`local_agent`||e.type===`local_workflow`)&&Rt(e))?se=t:(se=null,D.enqueue(t))}else{for(let e of Qi())D.enqueue(e);D.enqueue(t)}}),ee)await Vt({commands:f,outcome:{type:`failed`,message:`ask() returned an error result`},currentDir:X(),priority:`later`,workload:h.workload??v.workload});else{let e=await Vt({commands:f,outcome:{type:`completed`},currentDir:X(),priority:`later`,workload:h.workload??v.workload});for(let t of e)q({...t,uuid:Y()})}}catch(e){throw await Vt({commands:f,outcome:{type:`failed`,error:e},currentDir:X(),priority:`later`,workload:h.workload??v.workload}),e}for(let e of o)Vn(e,`completed`);if(Ne(),M?.sendResult(),v.promptSuggestions&&!n(process.env.CLAUDE_CODE_ENABLE_PROMPT_SUGGESTION)){O.abortController?.abort();let e=new AbortController;O.abortController=e;let t=Dt();if(!t)ri(`sdk_no_params`,void 0,void 0,`sdk`);else{let n={promise:null};n.promise=(async()=>{try{let n=await nr(e,k,g,t,`sdk`);if(!n||e.signal.aborted)return;let r={type:`prompt_suggestion`,suggestion:n.suggestion,uuid:Y(),session_id:u()},i={text:n.suggestion,emittedAt:Date.now(),promptId:n.promptId,generationRequestId:n.generationRequestId};se?(O.pendingSuggestion=r,O.pendingLastEmittedEntry={text:i.text,promptId:i.promptId,generationRequestId:i.generationRequestId}):(O.lastEmitted=i,D.enqueue(r))}catch(e){if(e instanceof Error&&(e.name===`AbortError`||e.name===`APIUserAbortError`)){ri(`aborted`,void 0,void 0,`sdk`);return}W(Pe(e))}finally{O.inflightPromise===n.promise&&(O.inflightPromise=null)}})(),O.inflightPromise=n.promise}}It(),fi(),ft()}};do{for(let e of Qi())D.enqueue(e);S=`draining_commands`,await a(),i=!1;{let e=pn(g()).some(e=>Rt(e)&&e.type!==`in_process_teammate`),n=mn(t)!==void 0;(e||n)&&(i=!0,n||(S=`waiting_for_agents`,await ct(100)))}}while(i);se&&(D.enqueue(se),se=null,O.pendingSuggestion&&(D.enqueue(O.pendingSuggestion),O.pendingLastEmittedEntry&&(O.lastEmitted={...O.pendingLastEmittedEntry,emittedAt:Date.now()},O.pendingLastEmittedEntry=null),O.pendingSuggestion=null))}catch(t){try{await e.write({type:`result`,subtype:`error_during_execution`,duration_ms:0,duration_api_ms:0,is_error:!0,num_turns:0,stop_reason:null,session_id:u(),total_cost_usd:0,usage:ia,modelUsage:{},permission_denials:[],uuid:Y(),errors:[P(t),...Xe().map(e=>e.error)]})}catch{}O.abortController?.abort(),K(1);return}finally{if(S=`finally_flush`,await e.flushInternalEvents(),S=`finally_post_flush`,!Tr()){ca(`idle`);for(let e of Qi())D.enqueue(e)}x=!1,Ve.start()}if($?.isProactiveActive()&&!$.isProactivePaused()&&mn(t)===void 0&&!C){Ge();return}if(mn(t)!==void 0){z();return}{let e=g().teamContext;if(e&&it(e)){let e=`team-lead`;for(;;){let t=g();if(!(st(t)||t.teamContext&&Object.keys(t.teamContext.teammates).length>0)){F(`[print.ts] No more active teammates, stopping poll`);break}let n=await rr(e,t.teamContext?.teamName);if(n.length>0){F(`[print.ts] Team-lead found ${n.length} unread messages`),await Er(e,t.teamContext?.teamName);let r=t.teamContext?.teamName;for(let e of n){let n=hi(e.text);if(n&&r){let e=n.from;F(`[print.ts] Processing shutdown_approved from ${e}`);let i=t.teamContext?.teammates?Object.entries(t.teamContext.teammates).find(([,t])=>t.name===e)?.[0]:void 0;i&&(va(r,{agentId:i,name:e}),F(`[print.ts] Removed ${e} from team file`),await ga(r,i,e,`shutdown`),_(e=>{if(!e.teamContext?.teammates||!(i in e.teamContext.teammates))return e;let{[i]:t,...n}=e.teamContext.teammates;return{...e,teamContext:{...e.teamContext,teammates:n}}}))}}q({mode:`prompt`,value:n.map(e=>`<${Ye} teammate_id="${e.from}"${e.color?` color="${e.color}"`:``}>\n${e.text}\n</${Ye}>`).join(`
32
+
33
+ `),uuid:Y()}),z();return}if(C&&!re){re=!0,F(`[print.ts] Input closed with active teammates, injecting shutdown prompt`),q({mode:`prompt`,value:Lo,uuid:Y()}),z();return}await ct(500)}}}C&&(await(async()=>{let e=g();rt(e)&&await ot(_,e);let t=g(),n=t.teamContext;return n&&Object.keys(n.teammates).length>0||st(t)})()?(q({mode:`prompt`,value:Lo,uuid:Y()}),z()):(O.inflightPromise&&await Promise.race([O.inflightPromise,ct(5e3)]),O.abortController?.abort(),O.abortController=null,await Qt(),We(),fe?.(),wn.delete(me),D.done()))},B=null;if(Io.isKairosCronEnabled()){let e=e=>{C||(async()=>{let t=await Jn({basePrompt:e.basePrompt,trigger:`scheduled-task`,currentDir:X(),sourceId:e.sourceId,sourceLabel:e.sourceLabel,workload:oe,shouldCreate:()=>!C});if(t){if(C){await Kt({commands:[t]});return}await e.onSuccess(t)}})().catch(t=>{W(t),F(`[ScheduledTasks] failed to enqueue headless task${e.logSuffix}: ${t}`,{level:`error`})})},t=e=>{q({...e,uuid:Y()}),z()};B=Po.createCronScheduler({onFire:n=>{e({basePrompt:n,sourceId:n,sourceLabel:n,logSuffix:``,onSuccess:t})},onFireTask:n=>{if(n.agentId){e({basePrompt:n.prompt,sourceId:n.id,sourceLabel:n.prompt,logSuffix:` ${n.id}`,onSuccess:async e=>{await Ur(e.autonomy.runId,`No teammate runtime available for scheduled task owner ${n.agentId} in headless mode.`,e.autonomy.rootDir)}});return}e({basePrompt:n.prompt,sourceId:n.id,sourceLabel:n.prompt,logSuffix:` ${n.id}`,onSuccess:t})},isLoading:()=>x||C,getJitterConfig:Fo?.getCronJitterConfig,isKilled:()=>!Io?.isKairosCronEnabled()}),B.start()}let V=function(e,t){D.enqueue({type:`control_response`,response:{subtype:`success`,request_id:e.request_id,response:t}})},U=function(e,t){D.enqueue({type:`control_response`,response:{subtype:`error`,request_id:e.request_id,error:t}})},Ze=new Set;e.setUnexpectedResponseCallback(async e=>{await is({message:e,setAppState:_,handledToolUseIds:Ze,onEnqueued:()=>{z()}})});let Qe=new Map,et=new Map,tt=new Set,at=new Map,G=null;return(async()=>{let t=!1;Ke(`info`,`cli_message_loop_started`);for await(let n of e.structuredInput){let i=`uuid`in n?n.uuid:void 0;if(i&&n.type!==`user`&&n.type!==`control_response`&&Vn(i,`completed`),n.type===`control_request`){let i=n,o=i.request;if(i.request.subtype===`interrupt`)_(e=>({...e,attribution:{...e.attribution,escapeCount:e.attribution.escapeCount+1}})),E&&E.abort(),O.abortController?.abort(),O.abortController=null,O.lastEmitted=null,O.pendingSuggestion=null,V(i);else if(o.subtype===`end_session`){F(`[print.ts] end_session received, reason=${o.reason??`unspecified`}`),E&&E.abort(),O.abortController?.abort(),O.abortController=null,O.lastEmitted=null,O.pendingSuggestion=null,V(i);break}else if(i.request.subtype===`initialize`){if(i.request.sdkMcpServers&&i.request.sdkMcpServers.length>0)for(let e of i.request.sdkMcpServers)h[e]={type:`sdk`,name:e};await Yo(i.request,i.request_id,t,D,a,xe,e,!!v.enableAuthStatus,v,te,g),i.request.promptSuggestions&&_(e=>e.promptSuggestionEnabled?e:{...e,promptSuggestionEnabled:!0}),i.request.agentProgressSummaries&&_e(`tengu_slate_prism`,!0)&&ee(!0),t=!0,Ti()&&z()}else if(i.request.subtype===`set_permission_mode`){let e=i.request;_(t=>({...t,toolPermissionContext:Zo(e,i.request_id,t.toolPermissionContext,D),isUltraplanMode:e.ultraplan??t.isUltraplanMode}))}else if(i.request.subtype===`set_model`){let e=i.request.model??`default`,t=e===`default`?ie():e;Ce=t,b(t),la({model:t}),we(e,t),V(i)}else if(i.request.subtype===`set_max_thinking_tokens`)i.request.max_thinking_tokens===null?v.thinkingConfig=void 0:i.request.max_thinking_tokens===0?v.thinkingConfig={type:`disabled`}:v.thinkingConfig={type:`enabled`,budgetTokens:i.request.max_thinking_tokens},V(i);else if(i.request.subtype===`mcp_status`)V(i,{mcpServers:Re()});else if(i.request.subtype===`get_context_usage`)try{let e=g();V(i,{...await ao({messages:k,getAppState:g,options:{mainLoopModel:ae(),tools:je(e),agentDefinitions:e.agentDefinitions,customSystemPrompt:v.systemPrompt,appendSystemPrompt:v.appendSystemPrompt}})})}catch(e){U(i,P(e))}else if(i.request.subtype===`mcp_message`){let e=i.request,t=A.find(t=>t.name===e.server_name);t&&t.type===`connected`&&t.client?.transport?.onmessage&&t.client.transport.onmessage(e.message),V(i)}else if(i.request.subtype===`rewind_files`){let e=g(),t=await Xo(i.request.user_message_id,e,_,i.request.dry_run??!1);t.canRewind||i.request.dry_run?V(i,t):U(i,t.error??`Unexpected error`)}else if(i.request.subtype===`cancel_async_message`){let e=i.request.message_uuid;V(i,{cancelled:$n(t=>t.uuid===e).length>0})}else if(i.request.subtype===`seed_read_state`){try{let e=$e(i.request.path),t=Math.floor((await _o(e)).mtimeMs);if(t<=i.request.mtime){let n=await go(e,`utf-8`),r=(n.charCodeAt(0)===65279?n.slice(1):n).replaceAll(`\r
34
+ `,`
35
+ `);ve.set(e,{content:r,timestamp:t,offset:void 0,limit:void 0})}}catch{}V(i)}else if(i.request.subtype===`mcp_set_servers`){let{response:e,sdkServersChanged:t}=await Ie(i.request.servers);V(i,e),t&&Oe()}else if(i.request.subtype===`reload_plugins`)try{let e=await uo(_),t=L.filter(e=>e.source===`flagSettings`);L=[...e.agentDefinitions.allAgents,...t];let n=[],[r,a,o]=await Promise.allSettled([qn(X()),Ue(),Ci()]);r.status===`fulfilled`?I=r.value:W(r.reason),a.status===`rejected`&&W(a.reason),o.status===`fulfilled`?n=o.value.enabled.map(e=>({name:e.name,path:e.path,source:e.source})):W(o.reason),V(i,{commands:I.filter(e=>e.userInvocable!==!1).map(e=>({name:Jr(e),description:Yt(e),argumentHint:e.argumentHint||``})),agents:L.map(e=>({name:e.agentType,description:e.whenToUse,model:e.model===`inherit`?void 0:e.model})),plugins:n,mcpServers:Re(),error_count:e.error_count})}catch(e){U(i,P(e))}else if(i.request.subtype===`mcp_reconnect`){let e=g(),{serverName:t}=i.request;Ee.delete(t);let n=xr(t)??r.find(e=>e.name===t)?.config??A.find(e=>e.name===t)?.config??j.clients.find(e=>e.name===t)?.config??e.mcp.clients.find(e=>e.name===t)?.config??null;if(!n)U(i,`Server not found: ${t}`);else{let e=await kt(t,n),r=ke(t);_(n=>({...n,mcp:{...n.mcp,clients:n.mcp.clients.map(n=>n.name===t?e.client:n),tools:[...T(n.mcp.tools,e=>e.name?.startsWith(r)),...e.tools],commands:[...T(n.mcp.commands,e=>Qr(e,t)),...e.commands],resources:e.resources&&e.resources.length>0?{...n.mcp.resources,[t]:e.resources}:le(n.mcp.resources,t)}})),j={...j,clients:[...j.clients.filter(e=>e.name!==t),e.client],tools:[...j.tools.filter(e=>!e.name?.startsWith(r)),...e.tools]},e.client.type===`connected`?(De([e.client]),$o(e.client),V(i)):U(i,e.client.type===`failed`?e.client.error??`Connection failed`:`Server status: ${e.client.type}`)}}else if(i.request.subtype===`mcp_toggle`){let e=g(),{serverName:t,enabled:n}=i.request;Ee.delete(t);let a=xr(t)??r.find(e=>e.name===t)?.config??A.find(e=>e.name===t)?.config??j.clients.find(e=>e.name===t)?.config??e.mcp.clients.find(e=>e.name===t)?.config??null;if(!a)U(i,`Server not found: ${t}`);else if(n){Di(t,!0);let e=await kt(t,a),n=ke(t);_(r=>({...r,mcp:{...r.mcp,clients:r.mcp.clients.map(n=>n.name===t?e.client:n),tools:[...T(r.mcp.tools,e=>e.name?.startsWith(n)),...e.tools],commands:[...T(r.mcp.commands,e=>Qr(e,t)),...e.commands],resources:e.resources&&e.resources.length>0?{...r.mcp.resources,[t]:e.resources}:le(r.mcp.resources,t)}})),e.client.type===`connected`?(De([e.client]),$o(e.client),V(i)):U(i,e.client.type===`failed`?e.client.error??`Connection failed`:`Server status: ${e.client.type}`)}else{Di(t,!1);let n=[...r,...A,...j.clients,...e.mcp.clients].find(e=>e.name===t);n&&n.type===`connected`&&await wt(t,a);let o=ke(t);_(e=>({...e,mcp:{...e.mcp,clients:e.mcp.clients.map(e=>e.name===t?{name:t,type:`disabled`,config:a}:e),tools:T(e.mcp.tools,e=>e.name?.startsWith(o)),commands:T(e.mcp.commands,e=>Qr(e,t)),resources:le(e.mcp.resources,t)}})),V(i)}}else if(o.subtype===`channel_enable`){let e=g();Qo(i.request_id,o.serverName,[...e.mcp.clients,...A,...j.clients],D)}else if(o.subtype===`mcp_authenticate`){let e=o.serverName,t=g(),n=xr(e)??r.find(t=>t.name===e)?.config??t.mcp.clients.find(t=>t.name===e)?.config??null;if(!n)U(i,`Server not found: ${e}`);else if(n.type!==`sse`&&n.type!==`http`)U(i,`Server type "${n.type}" does not support OAuth authentication`);else try{Qe.get(e)?.abort();let t=new AbortController;Qe.set(e,t);let r,a=new Promise(e=>{r=e}),o=$t(e,n,e=>r(e),t.signal,{skipBrowserOpen:!0,onWaitingForCallback:t=>{et.set(e,t)}}),s=await Promise.race([a,o.then(()=>null)]);s?V(i,{authUrl:s,requiresUserAction:!0}):V(i,{requiresUserAction:!1}),at.set(e,o),o.then(async()=>{if(cr(e)||tt.has(e))return;let t=await kt(e,n),r=ke(e);_(n=>({...n,mcp:{...n.mcp,clients:n.mcp.clients.map(n=>n.name===e?t.client:n),tools:[...T(n.mcp.tools,e=>e.name?.startsWith(r)),...t.tools],commands:[...T(n.mcp.commands,t=>Qr(t,e)),...t.commands],resources:t.resources&&t.resources.length>0?{...n.mcp.resources,[e]:t.resources}:le(n.mcp.resources,e)}})),j={...j,clients:[...j.clients.filter(t=>t.name!==e),t.client],tools:[...j.tools.filter(e=>!e.name?.startsWith(r)),...t.tools]}}).catch(t=>{F(`MCP OAuth failed for ${e}: ${t}`,{level:`error`})}).finally(()=>{Qe.get(e)===t&&(Qe.delete(e),et.delete(e),tt.delete(e),at.delete(e))})}catch(e){U(i,P(e))}}else if(o.subtype===`mcp_oauth_callback_url`){let e=o.serverName,t=o.callbackUrl,n=et.get(e);if(n){let r=!1;try{let e=new URL(t);r=e.searchParams.has(`code`)||e.searchParams.has(`error`)}catch{}if(!r)U(i,`Invalid callback URL: missing authorization code. Please paste the full redirect URL including the code parameter.`);else{tt.add(e),n(t);let r=at.get(e);if(r)try{await r,V(i)}catch(e){U(i,e instanceof Error?e.message:`OAuth authentication failed`)}else V(i)}}else U(i,`No active OAuth flow for server: ${e}`)}else if(o.subtype===`claude_authenticate`){let e=o.loginWithClaudeAi;G?.service.cleanup(),R(`tengu_oauth_flow_start`,{loginWithClaudeAi:e??!0});let t=new tn,n,r=new Promise(e=>{n=e}),a=t.startOAuthFlow(async(e,t)=>{n({manualUrl:e,automaticUrl:t})},{loginWithClaudeAi:e??!0,skipBrowserOpen:!0}).then(async t=>{await hn(t),R(`tengu_oauth_success`,{loginWithClaudeAi:e??!0})}).finally(()=>{t.cleanup(),G?.service===t&&(G=null)});G={service:t,flow:a},a.catch(e=>F(`claude_authenticate flow ended: ${e}`,{level:`info`}));try{let{manualUrl:e,automaticUrl:t}=await Promise.race([r,a.then(()=>{throw Error(`OAuth flow completed without producing auth URLs`)})]);V(i,{manualUrl:e,automaticUrl:t})}catch(e){U(i,P(e))}}else if(o.subtype===`claude_oauth_callback`||o.subtype===`claude_oauth_wait_for_completion`)if(!G)U(i,`No active claude_authenticate flow`);else{o.subtype===`claude_oauth_callback`&&G.service.handleManualAuthCodeInput({authorizationCode:o.authorizationCode,state:o.state});let{flow:e}=G;e.then(()=>{let e=ne();V(i,{account:{email:e?.email,organization:e?.organization,subscriptionType:e?.subscription,tokenSource:e?.tokenSource,apiKeySource:e?.apiKeySource,apiProvider:ue()}})},e=>U(i,P(e)))}else if(o.subtype===`mcp_clear_auth`){let e=o.serverName,t=g(),n=xr(e)??r.find(t=>t.name===e)?.config??t.mcp.clients.find(t=>t.name===e)?.config??null;if(!n)U(i,`Server not found: ${e}`);else if(n.type!==`sse`&&n.type!==`http`)U(i,`Cannot clear auth for server type "${n.type}"`);else{await vn(e,n);let t=await kt(e,n),r=ke(e);_(n=>({...n,mcp:{...n.mcp,clients:n.mcp.clients.map(n=>n.name===e?t.client:n),tools:[...T(n.mcp.tools,e=>e.name?.startsWith(r)),...t.tools],commands:[...T(n.mcp.commands,t=>Qr(t,e)),...t.commands],resources:t.resources&&t.resources.length>0?{...n.mcp.resources,[e]:t.resources}:le(n.mcp.resources,e)}})),V(i,{})}}else if(i.request.subtype===`apply_flag_settings`){let e=ae(),t=d()??{},n=i.request.settings,r={...t,...n};for(let e of Object.keys(r))r[e]===null&&delete r[e];f(r),St.notifyChange(`flagSettings`),`model`in n&&(n.model==null?b(void 0):b(String(n.model)));let a=ae();if(a!==e){Ce=a;let e=n.model?String(n.model):`default`;la({model:a}),we(e,a)}V(i)}else if(i.request.subtype===`get_settings`){let e=g(),t=ae(),n=Nr(t)?Yr(t,e.effortValue):void 0;V(i,{...Ae(),applied:{model:t,effort:typeof n==`string`?n:null}})}else if(i.request.subtype===`stop_task`){let{task_id:e}=i.request;try{await lr(e,{getAppState:g,setAppState:_}),V(i,{})}catch(e){U(i,P(e))}}else if(o.subtype===`generate_session_title`){let e=o.description,t=o.persist,n=(E&&!E.signal.aborted?E:en()).signal;(async()=>{try{let r=await wa(e,n);if(r&&t)try{or(u(),r)}catch(e){W(e)}V(i,{title:r})}catch(e){U(i,P(e))}})()}else if(o.subtype===`side_question`){let e=o.question;(async()=>{try{let t=Dt();V(i,{response:(await io({question:e,cacheSafeParams:t?{...t,toolUseContext:{...t.toolUseContext,abortController:en()}}:await no({tools:je(g()),commands:I,mcpClients:[...g().mcp.clients,...A,...j.clients],messages:k,readFileState:ge,getAppState:g,setAppState:_,customSystemPrompt:v.systemPrompt,appendSystemPrompt:v.appendSystemPrompt,thinkingConfig:v.thinkingConfig,agents:L})})).response})}catch(e){U(i,P(e))}})()}else if(i.request.subtype===`set_proactive`)i.request.enabled?$.isProactiveActive()||($.activateProactive(`command`),Ge()):$.deactivateProactive(),V(i);else if(o.subtype===`remote_control`)if(o.enabled)if(M)V(i,{session_url:Sr(M.bridgeSessionId,M.sessionIngressUrl),connect_url:Cr(M.environmentId,M.sessionIngressUrl),environment_id:M.environmentId});else{let t;try{let{initReplBridge:n}=await import(`./initReplBridge-BeGirV3Q.js`),r=await n({onInboundMessage(e){let t=qa(e);if(!t)return;let{content:n,uuid:r}=t;q({value:n,mode:`prompt`,uuid:r,skipSlashCommands:!0}),z()},onPermissionResponse(t){e.injectControlResponse(t)},onInterrupt(){E?.abort()},onSetModel(e){let t=e===`default`?ie():e;Ce=t,b(t)},onSetMaxThinkingTokens(e){e===null?v.thinkingConfig=void 0:e===0?v.thinkingConfig={type:`disabled`}:v.thinkingConfig={type:`enabled`,budgetTokens:e}},onStateChange(e,n){e===`failed`&&(t=n),F(`[bridge:sdk] State change: ${e}${n?` — ${n}`:``}`),D.enqueue({type:`system`,subtype:`bridge_state`,state:e,detail:n,uuid:Y(),session_id:u()})},initialMessages:k.length>0?k:void 0});r?(M=r,Me=k.length,e.setOnControlRequestSent(e=>{r.sendControlRequest(e)}),e.setOnControlRequestResolved(e=>{r.sendControlCancelRequest(e)}),V(i,{session_url:Sr(r.bridgeSessionId,r.sessionIngressUrl),connect_url:Cr(r.environmentId,r.sessionIngressUrl),environment_id:r.environmentId})):U(i,t??`Remote Control initialization failed`)}catch(e){U(i,P(e))}}else M&&(e.setOnControlRequestSent(void 0),e.setOnControlRequestResolved(void 0),await M.teardown(),M=null),V(i);else U(i,`Unsupported control request subtype: ${i.request.subtype}`);continue}else if(n.type===`control_response`){v.replayUserMessages&&D.enqueue(n);continue}else if(n.type===`keep_alive`)continue;else if(n.type===`update_environment_variables`)continue;else if(n.type===`assistant`||n.type===`system`){let e=xa([n]);k.push(...e),n.type===`assistant`&&v.replayUserMessages&&D.enqueue(n);continue}if(n.type!==`user`)continue;let o=n;if(t=!0,o.uuid){let e=u(),t=await ur(e,o.uuid);if(t||zo.has(o.uuid)){F(`Skipping duplicate user message: ${o.uuid}`),v.replayUserMessages&&(F(`Sending acknowledgment for duplicate user message: ${o.uuid}`),D.enqueue({type:`user`,content:o.message?.content??``,message:o.message,session_id:e,parent_tool_use_id:null,uuid:o.uuid,timestamp:o.timestamp,isReplay:!0})),t&&Vn(o.uuid,`completed`);continue}Vo(o.uuid)}q({mode:`prompt`,value:await ba(o,o.message.content),uuid:o.uuid,priority:o.priority}),_(e=>({...e,attribution:pa(e.attribution,e=>{oi(e).catch(e=>{F(`Attribution: Failed to save snapshot: ${e}`)})})})),z()}C=!0,B?.stop(),x||(O.inflightPromise&&await Promise.race([O.inflightPromise,ct(5e3)]),O.abortController?.abort(),O.abortController=null,await Qt(),We(),fe?.(),wn.delete(me),D.done())})(),D}function qo(e){let t=async(n,r,i,a,o,s)=>{let c=s??await At(n,r,i,a,o);if(c.behavior===`allow`||c.behavior===`deny`)return c;let{signal:l,cleanup:u}=bt(i.abortController.signal);if(l.aborted)return u(),{behavior:`deny`,message:`Permission prompt was aborted.`,decisionReason:{type:`permissionPromptTool`,permissionPromptToolName:n.name,toolResult:void 0}};let d=new Promise(e=>{l.addEventListener(`abort`,()=>e(`aborted`),{once:!0})}),f=e.call({tool_name:n.name,input:r,tool_use_id:o},i,t,a),p=await Promise.race([f,d]);if(u(),p===`aborted`||l.aborted)return{behavior:`deny`,message:`Permission prompt was aborted.`,decisionReason:{type:`permissionPromptTool`,permissionPromptToolName:n.name,toolResult:void 0}};let m=p,h=e.mapToolResultToToolResultBlockParam(m.data,`1`);if(!h.content||!Array.isArray(h.content)||!h.content[0]||h.content[0].type!==`text`||typeof h.content[0].text!=`string`)throw Error(`Permission prompt tool returned an invalid result. Expected a single text block param with type="text" and a string text value.`);return Ja(Xa().parse(tt(h.content[0].text)),e,r,i)};return t}function Jo(e,t,n,r){if(e===`stdio`)return t.createCanUseTool(r);if(!e)return async(e,t,n,r,i,a)=>a??await At(e,t,n,r,i);let i=null;return async(t,r,a,o,s,c)=>{if(!i){let t=n(),r=t.find(t=>Li(t,e));if(!r){let n=`Error: MCP tool ${e} (passed via --permission-prompt-tool) not found. Available MCP tools: ${t.map(e=>e.name).join(`, `)||`none`}`;throw process.stderr.write(`${n}\n`),K(1),Error(n)}if(!r.inputJSONSchema){let t=`Error: tool ${e} (passed via --permission-prompt-tool) must be an MCP tool`;throw process.stderr.write(`${t}\n`),K(1),Error(t)}i=qo(r)}return i(t,r,a,o,s,c)}}async function Yo(e,t,n,r,i,a,o,s,c,l,d){if(n){r.enqueue({type:`control_response`,response:{subtype:`error`,error:`Already initialized`,request_id:t,pending_permission_requests:o.getPendingPermissionRequests()}});return}if(e.systemPrompt!==void 0&&(c.systemPrompt=e.systemPrompt),e.appendSystemPrompt!==void 0&&(c.appendSystemPrompt=e.appendSystemPrompt),e.promptSuggestions!==void 0&&(c.promptSuggestions=e.promptSuggestions),e.agents){let t=qr(e.agents,`flagSettings`);l.push(...t)}if(c.agent){let e=x()===c.agent,t=l.find(e=>e.agentType===c.agent);if(t&&!e){if(y(t.agentType),!c.systemPrompt&&!ci(t)){let e=t.getSystemPrompt();e&&(c.systemPrompt=e)}!c.userSpecifiedModel&&t.model&&t.model!==`inherit`&&b(w(t.model)),t.initialPrompt&&o.prependUserMessage(t.initialPrompt)}else t?.initialPrompt&&o.prependUserMessage(t.initialPrompt)}let f=A()?.outputStyle||`default`,p=await Pr(We()),m=ne();if(e.hooks){let t={};for(let[n,r]of Object.entries(e.hooks))t[n]=r.map(e=>{let t=e.hookCallbackIds.map(t=>o.createHookCallback(t,e.timeout));return{matcher:e.matcher,hooks:t}});g(t)}e.jsonSchema&&h(e.jsonSchema);let ee={commands:i.filter(e=>e.userInvocable!==!1).map(e=>({name:Jr(e),description:Yt(e),argumentHint:e.argumentHint||``})),agents:l.map(e=>({name:e.agentType,description:e.whenToUse,model:e.model===`inherit`?void 0:e.model})),output_style:f,available_output_styles:Object.keys(p),models:a,account:{email:m?.email,organization:m?.organization,subscriptionType:m?.subscription,tokenSource:m?.tokenSource,apiKeySource:m?.apiKeySource,apiProvider:ue()},pid:process.pid};if(je()&&Me()){let e=d();ee.fast_mode_state=De(c.userSpecifiedModel??null,e.fastMode)}if(r.enqueue({type:`control_response`,response:{subtype:`success`,request_id:t,response:ee}}),s){let e=ce.getInstance().getStatus();e&&r.enqueue({type:`auth_status`,isAuthenticating:e.isAuthenticating,output:e.output,error:e.error,uuid:Y(),session_id:u()})}}async function Xo(e,t,n,r){if(!ir())return{canRewind:!1,error:`File rewinding is not enabled.`,filesChanged:[]};if(!Dr(t.fileHistory,e))return{canRewind:!1,error:`No file checkpoint found for this message.`,filesChanged:[]};if(r){let n=await Kr(t.fileHistory,e);return{canRewind:!0,filesChanged:n?.filesChanged??[],insertions:n?.insertions,deletions:n?.deletions}}try{await yi(e=>n(t=>({...t,fileHistory:e(t.fileHistory)})),e)}catch(e){return{canRewind:!1,error:`Failed to rewind: ${P(e)}`,filesChanged:[]}}return{canRewind:!0,filesChanged:[]}}function Zo(e,t,n,r){if(e.mode===`bypassPermissions`){if(fn())return r.enqueue({type:`control_response`,response:{subtype:`error`,request_id:t,error:`Cannot set permission mode to bypassPermissions because it is disabled by settings or configuration`}}),n;if(!n.isBypassPermissionsModeAvailable)return r.enqueue({type:`control_response`,response:{subtype:`error`,request_id:t,error:`Cannot set permission mode to bypassPermissions because the session was not launched with --dangerously-skip-permissions`}}),n}if(e.mode===`auto`&&!vt()){let e=En();return r.enqueue({type:`control_response`,response:{subtype:`error`,request_id:t,error:e?`Cannot set permission mode to auto: ${ki(e)}`:`Cannot set permission mode to auto`}}),n}return r.enqueue({type:`control_response`,response:{subtype:`success`,request_id:t,response:{mode:e.mode}}}),{...Tt(n.mode,e.mode,n),mode:e.mode}}function Qo(e,t,n,r){let i=t=>r.enqueue({type:`control_response`,response:{subtype:`error`,request_id:e,error:t}}),a=n.find(e=>e.name===t&&e.type===`connected`);if(!a||a.type!==`connected`)return i(`server ${t} is not connected`);let o=a.config.pluginSource,s=o?Ji(o):void 0;if(!s?.marketplace)return i(`server ${t} is not plugin-sourced; channel_enable requires a marketplace plugin`);let c={kind:`plugin`,name:s.name,marketplace:s.marketplace},l=S(),u=l.some(e=>e.kind===`plugin`&&e.name===c.name&&e.marketplace===c.marketplace);u||m([...l,c]);let d=za(t,a.capabilities,o);if(d.action===`skip`)return u||m(l),i(d.reason);let f=`${c.name}@${c.marketplace}`;H(t,`Channel notifications registered`),R(`tengu_mcp_channel_enable`,{plugin:f}),a.client.setNotificationHandler(Ra(),async e=>{let{content:n,meta:r}=e.params;H(t,`notifications/claude/channel: ${n.slice(0,80)}`),R(`tengu_mcp_channel_message`,{content_length:n.length,meta_key_count:Object.keys(r??{}).length,entry_kind:`plugin`,is_dev:!1,plugin:f}),q({mode:`prompt`,value:Ia(t,n,r),priority:`next`,isMeta:!0,origin:{kind:`channel`,server:t},skipSlashCommands:!0})}),r.enqueue({type:`control_response`,response:{subtype:`success`,request_id:e,response:void 0}})}function $o(e){if(e.type!==`connected`||za(e.name,e.capabilities,e.config.pluginSource).action!==`register`)return;let t=La(e.name,S()),n=t?.kind===`plugin`?`${t.name}@${t.marketplace}`:void 0;H(e.name,`Channel notifications re-registered after reconnect`),e.client.setNotificationHandler(Ra(),async r=>{let{content:i,meta:a}=r.params;H(e.name,`notifications/claude/channel: ${i.slice(0,80)}`),R(`tengu_mcp_channel_message`,{content_length:i.length,meta_key_count:Object.keys(a??{}).length,entry_kind:t?.kind,is_dev:t?.dev??!1,plugin:n}),q({mode:`prompt`,value:Ia(e.name,i,a),priority:`next`,isMeta:!0,origin:{kind:`channel`,server:e.name},skipSlashCommands:!0})})}function es(e,t){if(t===`stream-json`){let t={type:`result`,subtype:`error_during_execution`,duration_ms:0,duration_api_ms:0,is_error:!0,num_turns:0,stop_reason:null,session_id:u(),total_cost_usd:0,usage:ia,modelUsage:{},permission_denials:[],uuid:Y(),errors:[e]};process.stdout.write(N(t)+`
36
+ `)}else process.stderr.write(e+`
37
+ `)}function ts(e,t){let n=e.findIndex(e=>e.uuid===t.uuid);n!==-1&&e.splice(n,2)}async function ns(t,n){let r=!v();if(n.continue)try{R(`tengu_continue_print`,{});let i=await Mr(void 0,void 0);if(i){if(Q){let n=Q.matchSessionMode(i.mode);if(n){process.stderr.write(n+`
38
+ `);let{getAgentDefinitionsWithOverrides:r,getActiveAgentsFromList:i}=(Vr(),e(gi));r.cache.clear?.();let a=await r(We());t(e=>({...e,agentDefinitions:{...a,allAgents:a.allAgents,activeAgents:i(a.allAgents)}}))}}return n.forkSession||i.sessionId&&(te(An(i.sessionId),i.fullPath?po(i.fullPath):null),r&&await wr()),co(i,t),yr(n.forkSession?{...i,worktreeSession:void 0}:i),Q&&kn(Q.isCoordinatorMode()?`coordinator`:`normal`),{messages:i.messages,turnInterruptionState:i.turnInterruptionState,agentSetting:i.agentSetting}}}catch(e){return W(e),K(1),{messages:[]}}if(n.teleport)try{if(!Un(`allow_remote_sessions`))throw Error(`Remote sessions are disabled by your organization's policy.`);if(R(`tengu_teleport_print`,{}),typeof n.teleport!=`string`)throw Error(`No session ID provided for teleport`);let{checkOutTeleportedSessionBranch:e,processMessagesForTeleportResume:t,teleportResumeCodeSession:r,validateGitState:i}=await import(`./teleport-DPUoWpD4.js`);await i();let a=await r(n.teleport),{branchError:o}=await e(a.branch);return{messages:t(a.log,o)}}catch(e){return W(e),K(1),{messages:[]}}if(n.resume)try{R(`tengu_resume_print`,{});let a=Do(typeof n.resume==`string`?n.resume:``);if(!a){let e=`Error: --resume requires a valid session ID when used with --print. Usage: claude -p --resume <session-id>`;return typeof n.resume==`string`&&(e+=`. Session IDs must be in UUID format (e.g., 550e8400-e29b-41d4-a716-446655440000). Provided value "${n.resume}" is not a valid UUID`),es(e,n.outputFormat),K(1),{messages:[]}}if(i(process.env.CLAUDE_CODE_USE_CCR_V2)){let[,e]=await Promise.all([rn(a.sessionId),n.restoredWorkerState]);e&&(t(Va(e)),typeof e.model==`string`&&b(e.model))}else a.isUrl&&a.ingressUrl&&i(process.env.ENABLE_SESSION_PERSISTENCE)&&await ln(a.sessionId,a.ingressUrl);let o=await Mr(a.sessionId,a.jsonlFile||void 0);if(!o||o.messages.length===0)return a.isUrl||i(process.env.CLAUDE_CODE_USE_CCR_V2)?{messages:await(n.sessionStartHooksPromise??un(`startup`))}:(es(`No conversation found with session ID: ${a.sessionId}`,n.outputFormat),K(1),{messages:[]});if(n.resumeSessionAt){let e=o.messages.findIndex(e=>e.uuid===n.resumeSessionAt);if(e<0)return es(`No message found with message.uuid of: ${n.resumeSessionAt}`,n.outputFormat),K(1),{messages:[]};o.messages=e>=0?o.messages.slice(0,e+1):[]}if(Q){let n=Q.matchSessionMode(o.mode);if(n){process.stderr.write(n+`
39
+ `);let{getAgentDefinitionsWithOverrides:r,getActiveAgentsFromList:i}=(Vr(),e(gi));r.cache.clear?.();let a=await r(We());t(e=>({...e,agentDefinitions:{...a,allAgents:a.allAgents,activeAgents:i(a.allAgents)}}))}}return!n.forkSession&&o.sessionId&&(te(An(o.sessionId),o.fullPath?po(o.fullPath):null),r&&await wr()),co(o,t),yr(n.forkSession?{...o,worktreeSession:void 0}:o),Q&&kn(Q.isCoordinatorMode()?`coordinator`:`normal`),{messages:o.messages,turnInterruptionState:o.turnInterruptionState,agentSetting:o.agentSetting}}catch(e){return W(e),es(e instanceof Error?`Failed to resume session: ${e.message}`:`Failed to resume session with --print mode`,n.outputFormat),K(1),{messages:[]}}return{messages:await(n.sessionStartHooksPromise??un(`startup`))}}function rs(e,t){let n;return n=typeof e==`string`?e.trim()===``?Ht([]):Ht([N({type:`user`,content:e,uuid:``,session_id:``,message:{role:`user`,content:e},parent_tool_use_id:null})]):e,t.sdkUrl?new bo(t.sdkUrl,n,t.replayUserMessages):new Ga(n,t.replayUserMessages)}async function is({message:e,setAppState:t,onEnqueued:n,handledToolUseIds:r}){let i=e.response;if(i?.subtype===`success`&&i.response?.toolUseID&&typeof i.response.toolUseID==`string`){let e=i.response,t=e.toolUseID;if(!t)return!1;if(F(`handleOrphanedPermissionResponse: received orphaned control_response for toolUseID=${t} request_id=${i.request_id}`),r.has(t))return F(`handleOrphanedPermissionResponse: skipping duplicate orphaned permission for toolUseID=${t} (already handled)`),!1;let a=await Xr(t);return a?(r.add(t),F(`handleOrphanedPermissionResponse: enqueuing orphaned permission for toolUseID=${t} messageID=${a.message.id}`),q({mode:`orphaned-permission`,value:[],orphanedPermission:{permissionResult:e,assistantMessage:a}}),n?.(),!0):(F(`handleOrphanedPermissionResponse: no unresolved tool_use found for toolUseID=${t} (already resolved in transcript)`),!1)}return!1}function as(e){return{...e,scope:`dynamic`}}async function os(e,t,n,r){let{allowed:i,blocked:a}=Zr(e),o={};for(let e of a)o[e]=`Blocked by enterprise policy (allowedMcpServers/deniedMcpServers)`;let s={},c={};for(let[e,t]of Object.entries(i))t.type===`sdk`?s[e]=t:c[e]=t;let l=new Set(Object.keys(t.configs)),u=new Set(Object.keys(s)),d=[],f=[],p={...t.configs},m=[...t.clients],h=[...t.tools];for(let e of l)if(!u.has(e)){let t=m.find(t=>t.name===e);t&&t.type===`connected`&&await t.cleanup(),m=m.filter(t=>t.name!==e);let n=`mcp__${e}__`;h=h.filter(e=>!e.name.startsWith(n)),delete p[e],f.push(e)}for(let[e,t]of Object.entries(s))if(!l.has(e)){p[e]=t;let n={type:`pending`,name:e,config:{...t,scope:`dynamic`}};m=[...m,n],d.push(e)}let g=await ss(c,n,r);return{response:{added:[...d,...g.response.added],removed:[...f,...g.response.removed],errors:{...o,...g.response.errors}},newSdkState:{configs:p,clients:m,tools:h},newDynamicState:g.newState,sdkServersChanged:d.length>0||f.length>0}}async function ss(e,t,n){let r=new Set(Object.keys(t.configs)),i=new Set(Object.keys(e)),a=[...r].filter(e=>!i.has(e)),o=[...i].filter(e=>!r.has(e)),s=[...r].filter(e=>i.has(e)).filter(n=>{let r=t.configs[n],i=e[n];return!r||!i?!0:!Oi(r,as(i))}),c=[],l=[],u={},d=[...t.clients],f=[...t.tools];for(let e of[...a,...s]){let n=d.find(t=>t.name===e),r=t.configs[e];if(n&&r){if(n.type===`connected`)try{await n.cleanup()}catch(e){W(e)}await wt(e,r)}let i=`mcp__${e}__`;f=f.filter(e=>!e.name.startsWith(i)),d=d.filter(t=>t.name!==e),a.includes(e)&&c.push(e)}for(let t of[...o,...s]){let n=e[t];if(!n)continue;let r=as(n);if(n.type===`sdk`){l.push(t);continue}try{let e=await xt(t,r);if(d.push(e),e.type===`connected`){let t=await dt(e);f.push(...t)}else e.type===`failed`&&(u[t]=e.error||`Connection failed`);l.push(t)}catch(e){let n=Pe(e);u[t]=n.message,W(n)}}let p={};for(let t of i){let n=e[t];n&&(p[t]=as(n))}let m={clients:d,tools:f,configs:p};return n(e=>{let n=new Set([...Object.keys(t.configs),...Object.keys(p)]),r=e.mcp.tools.filter(e=>{for(let t of n)if(e.name.startsWith(`mcp__${t}__`))return!1;return!0}),i=e.mcp.clients.filter(e=>!n.has(e.name));return{...e,mcp:{...e.mcp,tools:[...r,...f],clients:[...i,...d]}}}),{response:{added:l,removed:c,errors:u},newState:m}}export{Go as runHeadless};
@@ -1 +1 @@
1
- import{n as e}from"./chunk-DR8-3Aex.js";import{Rn as t}from"./src-Di342QoJ.js";import{t as n}from"./jsx-runtime-D-D469L8.js";import{n as r,r as i}from"./analytics-DqMQntaB.js";import{GT as a,JT as o,KT as s,qT as c}from"./loadAgentsDir-D-xcJ22-.js";import{n as l,r as u,t as d}from"./Grove-BugC6ssx.js";async function f(e){if(!await o())return e(m),null;let[t,n]=await Promise.all([s(),a()]);if(!t.success)return e(m),null;let r=t.data,c=n.success?n.data:null;async function u(t){if(t===`escape`||t===`defer`){e(`Privacy settings dialog dismissed`,{display:`system`});return}await f()}async function f(){let t=await s();if(!t.success){e(`Unable to retrieve updated privacy settings`,{display:`system`});return}let n=t.data;e(`"Help improve Claude" set to ${n.grove_enabled?`true`:`false`}.`),r.grove_enabled!==null&&r.grove_enabled!==n.grove_enabled&&i(`tengu_grove_policy_toggled`,{state:n.grove_enabled,location:`settings`})}return r.grove_enabled===null?(0,p.jsx)(d,{showIfAlreadyViewed:!0,onDone:u,location:`settings`}):(0,p.jsx)(l,{settings:r,domainExcluded:c?.domain_excluded,onDone:f})}var p,m;e((()=>{t(),u(),r(),c(),p=n(),m=`Review and manage your privacy settings at https://claude.ai/settings/data-privacy-controls`}))();export{f as call};
1
+ import{n as e}from"./chunk-DR8-3Aex.js";import{Rn as t}from"./src-Di342QoJ.js";import{t as n}from"./jsx-runtime-D-D469L8.js";import{n as r,r as i}from"./analytics-DqMQntaB.js";import{QT as a,XT as o,YT as s,ZT as c}from"./loadAgentsDir-C9Ee_fs1.js";import{n as l,r as u,t as d}from"./Grove-BC2IZIhN.js";async function f(e){if(!await a())return e(m),null;let[t,n]=await Promise.all([o(),s()]);if(!t.success)return e(m),null;let r=t.data,c=n.success?n.data:null;async function u(t){if(t===`escape`||t===`defer`){e(`Privacy settings dialog dismissed`,{display:`system`});return}await f()}async function f(){let t=await o();if(!t.success){e(`Unable to retrieve updated privacy settings`,{display:`system`});return}let n=t.data;e(`"Help improve Claude" set to ${n.grove_enabled?`true`:`false`}.`),r.grove_enabled!==null&&r.grove_enabled!==n.grove_enabled&&i(`tengu_grove_policy_toggled`,{state:n.grove_enabled,location:`settings`})}return r.grove_enabled===null?(0,p.jsx)(d,{showIfAlreadyViewed:!0,onDone:u,location:`settings`}):(0,p.jsx)(l,{settings:r,domainExcluded:c?.domain_excluded,onDone:f})}var p,m;e((()=>{t(),u(),r(),c(),p=n(),m=`Review and manage your privacy settings at https://claude.ai/settings/data-privacy-controls`}))();export{f as call};
@@ -0,0 +1 @@
1
+ import{a as e}from"./chunk-DR8-3Aex.js";import{Rn as t,t as n,x as r}from"./src-Di342QoJ.js";import{t as i}from"./jsx-runtime-D-D469L8.js";import{Ka as a,oo as o}from"./paths-C2JRlUsH.js";import{L as s,N as c,V as l}from"./debug-UI3T040K.js";import{n as u,r as d}from"./analytics-DqMQntaB.js";import{Ag as f,Am as p,CC as m,Co as h,Hm as g,SC as _,Um as v,Vo as y,Zo as b,bo as x,jg as S,jm as C,vu as w,wo as T,yu as E}from"./loadAgentsDir-C9Ee_fs1.js";import{Ft as D,Pt as O}from"./prompt-thBQB2X5.js";import{r as k,t as A}from"./xml-BW5T-oW-.js";import{randomUUID as j}from"crypto";t(),n(),E(),S(),v();var M=i();function N({input:e,progress:t,verbose:n}){return(0,M.jsxs)(r,{flexDirection:`column`,marginTop:1,children:[(0,M.jsx)(f,{addMargin:!1,param:{text:`<bash-input>${e}</bash-input>`,type:`text`}}),t?(0,M.jsx)(g,{fullOutput:t.fullOutput,output:t.output,elapsedTimeSeconds:t.elapsedTimeSeconds,totalLines:t.totalLines,verbose:n}):w.renderToolUseProgressMessage?.([],{verbose:n,tools:[],terminalSize:void 0})]})}u(),l(),_(),y(),o();function P(){return a().defaultShell??`bash`}E(),O(),k();async function F(t,n,r,i,a){let o=D()&&P()===`powershell`;d(`tengu_input_bash`,{powershell:o});let l=T({content:b({inputString:`<bash-input>${t}</bash-input>`,precedingInputBlocks:n})}),u;a({jsx:(0,M.jsx)(N,{input:t,progress:null,verbose:i.options.verbose}),shouldHidePromptInput:!1});try{let n={...i,setToolJSX:e=>{u=e?.jsx}},s=e=>{a({jsx:(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(N,{input:t,progress:e.data,verbose:i.options.verbose}),u]}),shouldHidePromptInput:!1,showSpinner:!1})},c=null;o&&(c=(C(),e(p)).PowerShellTool);let d=c??w,f=(c?await c.call({command:t,dangerouslyDisableSandbox:!0},n,void 0,void 0,s):await w.call({command:t,dangerouslyDisableSandbox:!0},n,void 0,void 0,s)).data;if(!f)throw Error(`No result received from shell command`);let h=f.stderr,g=await m(d,{...f,stderr:``},j()),_=typeof g.content==`string`?g.content:A(f.stdout);return{messages:[x(),l,...r,T({content:`<bash-stdout>${_}</bash-stdout><bash-stderr>${A(h)}</bash-stderr>`})],shouldQuery:!1}}catch(e){return e instanceof c?e.interrupted?{messages:[x(),l,h({toolUse:!1}),...r],shouldQuery:!1}:{messages:[x(),l,...r,T({content:`<bash-stdout>${A(e.stdout)}</bash-stdout><bash-stderr>${A(e.stderr)}</bash-stderr>`})],shouldQuery:!1}:{messages:[x(),l,...r,T({content:`<bash-stderr>Command failed: ${A(s(e))}</bash-stderr>`})],shouldQuery:!1}}finally{a(null)}}export{F as processBashCommand};
@@ -0,0 +1,6 @@
1
+ import{n as e}from"./chunk-DR8-3Aex.js";import{s as t,u as n}from"./envUtils-BWeoiL4Y.js";import{Ct as r,cn as i,mr as a,t as o}from"./state-sIHsFpDu.js";import{$ as s,As as c,Dt as l,Ot as u,Zc as d,el as f,ks as p,tt as m}from"./paths-C2JRlUsH.js";import{M as h,V as g,d as _,h as v,k as y,p as b,s as x}from"./debug-UI3T040K.js";import{n as S,r as C}from"./analytics-DqMQntaB.js";import{O as w,et as T,k as E,o as D,s as O}from"./log-CzsijfHZ.js";import{n as k,t as ee}from"./sleep-8Eb9j_Ly.js";import{$D as te,$f as ne,$i as re,A as ie,Ac as ae,Aw as oe,Co as se,Dl as ce,FD as le,G as ue,GA as de,Gi as fe,Ho as pe,ID as me,Ik as he,Il as ge,J_ as _e,Ji as ve,K as A,KA as j,Ko as M,Ll as N,MD as P,M_ as F,ND as ye,N_ as be,Nc as xe,Oo as Se,Pl as I,Q_ as Ce,Qf as we,Rk as Te,TO as Ee,Tl as De,U_ as Oe,Vi as ke,Vo as Ae,W_ as je,XE as Me,YE as Ne,Y_ as L,Yo as Pe,Zo as R,_k as Fe,bo as z,eO as Ie,ea as Le,go as B,j_ as Re,jc as ze,jw as Be,kw as Ve,mk as He,o_ as Ue,pa as V,q_ as We,rO as Ge,rS as Ke,s_ as H,tS as qe,vO as Je,w as Ye,wo as U,xo as Xe,yO as Ze}from"./loadAgentsDir-C9Ee_fs1.js";import{a as W,i as Qe,o as G}from"./xml-BW5T-oW-.js";import{E as $e,T as et,w as tt}from"./sessionTracing-BEKULg2L.js";import{n as nt,t as rt}from"./slashCommandParsing-Cari0pNg.js";import{randomUUID as K}from"crypto";function it(e,t,n,r,i){let a=0;for(let o of p){let s=n[o];if(s)for(let n of s)for(let s of n.hooks){let c=s.once?()=>{_(`Removing one-shot hook for event ${o} in skill '${r}'`),be(e,t,o,s)}:void 0;Re(e,t,o,n.matcher||``,s,c,i),a++}}a>0&&_(`Registered ${a} hooks from skill '${r}'`)}var at=e((()=>{c(),x(),F()}));function ot(){return!1}function st(){if(!ot())throw Error(`ToolUseContext.options.allowBackgroundForkedSlashCommands is test-only and cannot be enabled outside NODE_ENV=test.`)}async function q(e,t,n,r,i,a,o){let s=Oe(),c=e.pluginInfo?G(e.pluginInfo.repository).marketplace:void 0;C(`tengu_slash_command_forked`,{command_name:e.name,invocation_trigger:`user-slash`,...e.pluginInfo&&{_PROTO_plugin_name:e.pluginInfo.pluginManifest.name,...c&&{_PROTO_marketplace_name:c},...L(e.pluginInfo)}});let{skillContent:u,modifiedGetAppState:f,baseAgent:p,promptMessages:m}=await N(e,t,n),h=e.effort===void 0?p:{...p,effort:e.effort};_(`Executing forked slash command /${e.name} with agent ${h.agentType}`);let g=await n.getAppState();n.options.allowBackgroundForkedSlashCommands===!0&&st();let v=!1;if(g.kairosEnabled&&(v=!0),v){let t=P(),r=V(e),i=l(),c=e=>Ze({value:e,mode:`prompt`,priority:`later`,isMeta:!0,skipSlashCommands:!0,workload:i}),u=async()=>{if(!o?.runId)return;let e=await te({runId:o.runId,rootDir:o.rootDir,priority:`later`,workload:i});for(let t of e)Je(t)},d=async e=>{o?.runId&&await Ie({runId:o.runId,rootDir:o.rootDir,error:e instanceof Error?e.message:String(e)})};return(async()=>{let i=Date.now()+$;for(;Date.now()<i&&n.getAppState().mcp.clients.some(e=>e.type===`pending`);)await k(Q);let o=n.options.refreshTools?.()??n.options.tools,l=[];for await(let r of H({agentDefinition:h,promptMessages:m,toolUseContext:{...n,getAppState:f,abortController:t},canUseTool:a,isAsync:!0,querySource:`agent:custom`,model:e.model,availableTools:o,override:{agentId:s}}))l.push(r);let d=I(l,`Command completed`);_(`Background forked command /${r} completed (agent ${s})`),c(`<scheduled-task-result command="/${r}">\n${d}\n</scheduled-task-result>`);try{await u()}catch(e){O(e)}})().catch(async e=>{O(e),c(`<scheduled-task-result command="/${r}" status="failed">\n${e instanceof Error?e.message:String(e)}\n</scheduled-task-result>`),await d(e)}),{messages:[],shouldQuery:!1,command:e,deferAutonomyCompletion:!!o?.runId}}let y=[],b=[],x=`forked-command-${e.name}`,S=0,w=e=>(S++,{type:`progress`,data:{message:e,type:`agent_progress`,prompt:u,agentId:s},parentToolUseID:x,toolUseID:`${x}-${S}`,timestamp:new Date().toISOString(),uuid:K()}),T=()=>{i({jsx:ne(b,{tools:n.options.tools,verbose:!1}),shouldHidePromptInput:!1,shouldContinueAnimation:!0,showSpinner:!0})};T();try{for await(let t of H({agentDefinition:h,promptMessages:m,toolUseContext:{...n,getAppState:f},canUseTool:a,isAsync:!1,querySource:`agent:custom`,model:e.model,availableTools:n.options.tools})){y.push(t);let e=Pe([t]);if(t.type===`assistant`){let r=He(t);r>0&&n.setResponseLength(e=>e+r);let i=e[0];i&&i.type===`assistant`&&(b.push(w(t)),T())}if(t.type===`user`){let t=e[0];t&&t.type===`user`&&(b.push(w(t)),T())}}}finally{i(null)}let E=I(y,`Command completed`);return _(`Forked slash command /${e.name} completed with agent ${s}`),process.env.USER_TYPE===`ant`&&(E=`[ANT-ONLY] API calls: ${d(le(s))}\n${E}`),{messages:[U({content:R({inputString:`/${V(e)} ${t}`.trim(),precedingInputBlocks:r})}),U({content:`<local-command-stdout>\n${E}\n</local-command-stdout>`})],shouldQuery:!1,command:e,resultText:E}}function ct(e){return!/[^a-zA-Z0-9:\-_]/.test(e)}async function lt(e,t,n,r,i,o,s,c,l,u){let d=nt(e);if(!d){C(`tengu_input_slash_missing`,{});let e="Commands are in the form `/command [args]`";return{messages:[z(),...r,U({content:R({inputString:e,precedingInputBlocks:t})})],shouldQuery:!1,resultText:e}}let{commandName:f,args:p,isMcp:m}=d,h=m?`mcp`:ke().has(f)?f:`custom`;if(!re(f,i.options.commands)){let n=!1;try{await b().stat(`/${f}`),n=!0}catch{}if(ct(f)&&!n){C(`tengu_input_slash_invalid`,{input:f});let e=`Unknown skill: ${f}`;return{messages:[z(),...r,U({content:R({inputString:e,precedingInputBlocks:t})}),...p?[Xe(`Args from unknown skill: ${p}`,`warning`)]:[]],shouldQuery:!1,resultText:e}}let i=K();return a(i),C(`tengu_input_prompt`,{}),et(`user_prompt`,{prompt_length:String(e.length),prompt:$e(e),"prompt.id":i}),{messages:[U({content:R({inputString:e,precedingInputBlocks:t}),uuid:s}),...r],shouldQuery:!0}}let{messages:g,shouldQuery:_,allowedTools:v,model:y,effort:x,command:S,resultText:w,nextInput:T,submitNextInput:E,deferAutonomyCompletion:D}=await ut(f,p,o,i,t,n,c,l,s,u);if(g.length===0){let e={input:h};if(S.type===`prompt`&&S.pluginInfo){let{pluginManifest:t,repository:n}=S.pluginInfo,{marketplace:r}=G(n),i=W(r);e._PROTO_plugin_name=t.name,r&&(e._PROTO_marketplace_name=r),e.plugin_repository=i?n:`third-party`,e.plugin_name=i?t.name:`third-party`,i&&t.version&&(e.plugin_version=t.version),Object.assign(e,L(S.pluginInfo))}return C(`tengu_input_command`,{...e,invocation_trigger:`user-slash`,...process.env.USER_TYPE===`ant`&&{skill_name:f,...S.type===`prompt`&&{skill_source:S.source},...S.loadedFrom&&{skill_loaded_from:S.loadedFrom},...S.kind&&{skill_kind:S.kind}}}),{messages:[],shouldQuery:!1,model:y,nextInput:T,submitNextInput:E,deferAutonomyCompletion:D}}if(g.length===2&&g[1].type===`user`&&typeof g[1].message.content==`string`&&g[1].message.content.startsWith(`Unknown command:`))return e.startsWith(`/var`)||e.startsWith(`/tmp`)||e.startsWith(`/private`)||C(`tengu_input_slash_invalid`,{input:f}),{messages:[z(),...g],shouldQuery:_,allowedTools:v,model:y};let O={input:h};if(S.type===`prompt`&&S.pluginInfo){let{pluginManifest:e,repository:t}=S.pluginInfo,{marketplace:n}=G(t),r=W(n);O._PROTO_plugin_name=e.name,n&&(O._PROTO_marketplace_name=n),O.plugin_repository=r?t:`third-party`,O.plugin_name=r?e.name:`third-party`,r&&e.version&&(O.plugin_version=e.version),Object.assign(O,L(S.pluginInfo))}C(`tengu_input_command`,{...O,invocation_trigger:`user-slash`,...process.env.USER_TYPE===`ant`&&{skill_name:f,...S.type===`prompt`&&{skill_source:S.source},...S.loadedFrom&&{skill_loaded_from:S.loadedFrom},...S.kind&&{skill_kind:S.kind}}});let k=g.length>0&&g[0]&&pe(g[0]);return{messages:_||g.every(M)||k?g:[z(),...g],shouldQuery:_,allowedTools:v,model:y,effort:x,resultText:w,nextInput:T,submitNextInput:E,deferAutonomyCompletion:D}}async function ut(e,t,n,r,i,a,o,s,c,l){let u=ve(e,r.options.commands);if(u.type===`prompt`&&u.userInvocable!==!1&&_e(e),u.userInvocable===!1)return{messages:[U({content:R({inputString:`/${e}`,precedingInputBlocks:i})}),U({content:`This skill can only be invoked by Claude, not directly by users. Ask Claude to use the "${e}" skill for you.`})],shouldQuery:!1,command:u};try{switch(u.type){case`local-jsx`:return new Promise(e=>{let a=!1,o=(n,r)=>{if(a=!0,r?.display===`skip`){e({messages:[],shouldQuery:!1,command:u,nextInput:r?.nextInput,submitNextInput:r?.submitNextInput});return}let o=(r?.metaMessages??[]).map(e=>U({content:e,isMeta:!0})),s=Ke()&&typeof n==`string`&&n.endsWith(` dismissed`);e({messages:r?.display===`system`?s?o:[B(J(u,t)),B(`<local-command-stdout>${n}</local-command-stdout>`),...o]:[U({content:R({inputString:J(u,t),precedingInputBlocks:i})}),U(n?{content:`<local-command-stdout>${n}</local-command-stdout>`}:{content:`<local-command-stdout>${de}</local-command-stdout>`}),...o],shouldQuery:r?.shouldQuery??!1,command:u,nextInput:r?.nextInput,submitNextInput:r?.submitNextInput})};u.load().then(e=>e.call(o,{...r,canUseTool:s},t)).then(t=>{if(t!=null){if(r.options.isNonInteractiveSession){e({messages:[],shouldQuery:!1,command:u});return}a||n({jsx:t,shouldHidePromptInput:!0,showSpinner:!1,isLocalJSXCommand:!0,isImmediate:u.immediate===!0})}}).catch(t=>{O(t),!a&&(a=!0,n({jsx:null,shouldHidePromptInput:!1,clearLocalJSX:!0}),e({messages:[],shouldQuery:!1,command:u}))})});case`local`:{let e=U({content:R({inputString:J(u,u.isSensitive&&t.trim()?`***`:t),precedingInputBlocks:i})});try{let n=z(),i=await(await u.load()).call(t,r);if(i.type===`skip`)return{messages:[],shouldQuery:!1,command:u};if(i.type===`compact`){let t=[n,e,...i.displayText?[U({content:`<local-command-stdout>${i.displayText}</local-command-stdout>`,timestamp:new Date(Date.now()+100).toISOString()})]:[]],r={...i.compactionResult,messagesToKeep:[...i.compactionResult.messagesToKeep??[],...t]};return Te(),{messages:De(r),shouldQuery:!1,command:u}}return{messages:[e,B(`<local-command-stdout>${i.value}</local-command-stdout>`)],shouldQuery:!1,command:u,resultText:i.value}}catch(t){return O(t),{messages:[e,B(`<local-command-stderr>${String(t)}</local-command-stderr>`)],shouldQuery:!1,command:u}}}case`prompt`:try{return u.context===`fork`?await q(u,t,r,i,n,s??ue,l):await Z(u,t,r,i,a,c)}catch(e){return e instanceof y?{messages:[U({content:R({inputString:J(u,t),precedingInputBlocks:i})}),se({toolUse:!1})],shouldQuery:!1,command:u}:{messages:[U({content:R({inputString:J(u,t),precedingInputBlocks:i})}),U({content:`<local-command-stderr>${String(e)}</local-command-stderr>`})],shouldQuery:!1,command:u}}}}catch(e){if(e instanceof h)return{messages:[U({content:R({inputString:e.message,precedingInputBlocks:i})})],shouldQuery:!1,command:u};throw e}}function J(e,t){return Se(V(e),t)}function Y(e,t=`loading`){return[`<${w}>${e}</${w}>`,`<${E}>${e}</${E}>`,`<skill-format>true</skill-format>`].join(`
2
+ `)}function dt(e,t){return[`<${w}>${e}</${w}>`,`<${E}>/${e}</${E}>`,t?`<command-args>${t}</command-args>`:null].filter(Boolean).join(`
3
+ `)}function X(e,t){return e.userInvocable===!1&&(e.loadedFrom===`skills`||e.loadedFrom===`plugin`||e.loadedFrom===`mcp`)?Y(e.name,e.progressMessage):dt(e.name,t)}async function ft(e,t,n,r,i=[]){let a=fe(e,n);if(!a)throw new h(`Unknown command: ${e}`);if(a.type!==`prompt`)throw Error(`Unexpected ${a.type} command. Expected 'prompt' command. Use /${e} directly in the main conversation.`);return Z(a,t,r,[],i)}async function Z(e,t,i,a=[],c=[],l){if(n(process.env.CLAUDE_CODE_COORDINATOR_MODE)&&!i.agentId){let n=X(e,t),r=[`Skill "/${e.name}" is available for workers.`];e.description&&r.push(`Description: ${e.description}`),e.whenToUse&&r.push(`When to use: ${e.whenToUse}`);let i=e.allowedTools??[];i.length>0&&r.push(`This skill grants workers additional tool permissions: ${i.join(`, `)}`),r.push(`\nInstruct a worker to use this skill by including "Use the /${e.name} skill" in your Agent prompt. The worker has access to the Skill tool and will receive the skill's content and permissions when it invokes it.`);let a=[{type:`text`,text:r.join(`
4
+ `)}];return{messages:[U({content:n,uuid:l}),U({content:a,isMeta:!0})],shouldQuery:!0,model:e.model,effort:e.effort,command:e}}let u=await e.getPromptForCommand(t,i),d=!oe(`hooks`)||Be(e.source);if(e.hooks&&d){let t=r();it(i.setAppState,t,e.hooks,e.name,e.type===`prompt`?e.skillRoot:void 0)}let f=e.source?`${e.source}:${e.name}`:e.name,p=u.filter(e=>e.type===`text`).map(e=>e.text).join(`
5
+
6
+ `);o(e.name,f,p,s()?.agentId??null);let m=X(e,t),h=ie(e.allowedTools??[]),g=c.length>0||a.length>0?[...c,...a,...u]:u,_=await Me(ze(u.filter(e=>e.type===`text`).map(e=>e.text).join(` `),i,null,[],i.messages,`repl_main_thread`,{skipSkillDiscovery:!0}));return{messages:[U({content:m,uuid:l}),U({content:g,isMeta:!0}),..._,ae({type:`command_permissions`,allowedTools:h,model:e.model})],shouldQuery:!0,allowedTools:h,model:e.model,effort:e.effort,command:e}}var Q,$;e((()=>{i(),Le(),j(),T(),S(),me(),ce(),he(),Ue(),we(),ye(),m(),xe(),x(),t(),g(),f(),ge(),v(),qe(),Ne(),at(),D(),Ee(),Ae(),Ye(),A(),Qe(),Ve(),rt(),ee(),We(),tt(),Ce(),Fe(),je(),Ge(),u(),Q=200,$=1e4}))();export{Y as formatSkillLoadingMetadata,ft as processPromptSlashCommand,lt as processSlashCommand};
@@ -1 +1 @@
1
- import{a as e,c as t,i as n,n as r,o as i,r as a,s as o,t as s}from"./projectContext-eXMSfgdZ.js";e();export{s as getProjectContextPath,r as getProjectStorageDir,a as getProjectsRegistryPath,n as getSkillLearningRootDir,i as listKnownProjects,o as resetProjectContextCacheForTest,t as resolveProjectContext};
1
+ import{a as e,c as t,i as n,n as r,o as i,r as a,s as o,t as s}from"./projectContext-iWPqcl0Z.js";e();export{s as getProjectContextPath,r as getProjectStorageDir,a as getProjectsRegistryPath,n as getSkillLearningRootDir,i as listKnownProjects,o as resetProjectContextCacheForTest,t as resolveProjectContext};
@@ -0,0 +1 @@
1
+ import{i as e,r as t}from"./prompt-thBQB2X5.js";t();export{e as isDeferredTool};
@@ -0,0 +1 @@
1
+ import{Qk as e,iA as t}from"./loadAgentsDir-C9Ee_fs1.js";t();export{e as clearPromptCache};
@@ -1,4 +1,4 @@
1
- import{n as e,o as t,r as n}from"./chunk-DR8-3Aex.js";import{n as r,t as i}from"./memoize-DNnuA2aU.js";import{l as a,s as o,u as s}from"./envUtils-BWeoiL4Y.js";import{Ln as ee,wn as te}from"./schemas-BGAvj1T4.js";import{t as ne}from"./v4-f1i_CNUT.js";import{t as re}from"./ajv-B_OpU_Uh.js";import{St as ie,cn as ae,n as oe,ut as se,vn as ce}from"./state-sIHsFpDu.js";import{$o as c,Dr as le,Pr as ue,Qo as de,S as fe,Xo as pe,Yo as l,Zo as me,_ as he,rs as ge,v as _e}from"./paths-D9CVAtXU.js";import{E as ve,P as ye,V as be,W as xe,d as Se,h as Ce,p as we,s as Te,w as Ee}from"./debug-UI3T040K.js";import{J as De,et as Oe,o as ke,s as Ae}from"./log-CzsijfHZ.js";import{i as je,o as Me}from"./platform-CuyedWpe.js";import{s as Ne,u as Pe}from"./types-Csi32ZXh.js";import{n as Fe,t as Ie}from"./lazySchema-2sOku3cX.js";import{i as Le,r as Re,t as ze}from"./cron-DiW7eIPP.js";import{join as u}from"path";import{readFileSync as Be}from"fs";import{randomUUID as Ve}from"crypto";import{mkdir as He,writeFile as Ue}from"fs/promises";function We(e){return e.filter(e=>e.data?.type!==`hook_progress`)}function Ge(e,t){return e.name===t||(e.aliases?.includes(t)??!1)}function Ke(e,t){return e.find(e=>Ge(e,t))}function qe(e){return{...Ye,userFacingName:()=>e.name,...e}}var Je,Ye,Xe=e((()=>{Je=()=>({mode:`default`,additionalWorkingDirectories:new Map,alwaysAllowRules:{},alwaysDenyRules:{},alwaysAskRules:{},isBypassPermissionsModeAvailable:!0}),Ye={isEnabled:()=>!0,isConcurrencySafe:e=>!1,isReadOnly:e=>!1,isDestructive:e=>!1,checkPermissions:(e,t)=>Promise.resolve({behavior:`allow`,updatedInput:e}),toAutoClassifierInput:e=>``,userFacingName:e=>``}})),d,f=e((()=>{d=`Bash`}));function Ze(){return`A powerful search tool built on ripgrep
1
+ import{n as e,o as t,r as n}from"./chunk-DR8-3Aex.js";import{n as r,t as i}from"./memoize-DNnuA2aU.js";import{l as a,s as o,u as s}from"./envUtils-BWeoiL4Y.js";import{Ln as ee,wn as te}from"./schemas-BGAvj1T4.js";import{t as ne}from"./v4-f1i_CNUT.js";import{t as re}from"./ajv-B_OpU_Uh.js";import{St as ie,cn as ae,n as oe,ut as se,vn as ce}from"./state-sIHsFpDu.js";import{$o as c,Dr as le,Pr as ue,Qo as de,S as fe,Xo as pe,Yo as l,Zo as me,_ as he,rs as ge,v as _e}from"./paths-C2JRlUsH.js";import{E as ve,P as ye,V as be,W as xe,d as Se,h as Ce,p as we,s as Te,w as Ee}from"./debug-UI3T040K.js";import{J as De,et as Oe,o as ke,s as Ae}from"./log-CzsijfHZ.js";import{i as je,o as Me}from"./platform-CuyedWpe.js";import{s as Ne,u as Pe}from"./types-Csi32ZXh.js";import{n as Fe,t as Ie}from"./lazySchema-2sOku3cX.js";import{i as Le,r as Re,t as ze}from"./cron-DiW7eIPP.js";import{join as u}from"path";import{readFileSync as Be}from"fs";import{randomUUID as Ve}from"crypto";import{mkdir as He,writeFile as Ue}from"fs/promises";function We(e){return e.filter(e=>e.data?.type!==`hook_progress`)}function Ge(e,t){return e.name===t||(e.aliases?.includes(t)??!1)}function Ke(e,t){return e.find(e=>Ge(e,t))}function qe(e){return{...Ye,userFacingName:()=>e.name,...e}}var Je,Ye,Xe=e((()=>{Je=()=>({mode:`default`,additionalWorkingDirectories:new Map,alwaysAllowRules:{},alwaysDenyRules:{},alwaysAskRules:{},isBypassPermissionsModeAvailable:!0}),Ye={isEnabled:()=>!0,isConcurrencySafe:e=>!1,isReadOnly:e=>!1,isDestructive:e=>!1,checkPermissions:(e,t)=>Promise.resolve({behavior:`allow`,updatedInput:e}),toAutoClassifierInput:e=>``,userFacingName:e=>``}})),d,f=e((()=>{d=`Bash`}));function Ze(){return`A powerful search tool built on ripgrep
2
2
 
3
3
  Usage:
4
4
  - ALWAYS use ${p} for search tasks. NEVER invoke \`grep\` or \`rg\` as a ${d} command. The ${p} tool has been optimized for correct permissions and access.
@@ -1,4 +1,4 @@
1
- import{n as e}from"./chunk-DR8-3Aex.js";import{n as t,t as n}from"./memoize-DNnuA2aU.js";import{Lt as r,t as i}from"./src-Di342QoJ.js";import{O as a,d as o,h as s,p as c,s as l,w as u}from"./debug-UI3T040K.js";import{n as d,t as f}from"./execSyncWrapper-C2XQnFVo.js";import{r as p,t as m}from"./which-DqSAIvp2.js";import{_S as h,bS as g,hS as _,ix as v,px as y,vv as b,yS as x,yv as S}from"./loadAgentsDir-D-xcJ22-.js";import{basename as C}from"path";import{spawn as w,spawnSync as T}from"child_process";function E(e){return!!p(e)}function D(e){let t=C(e.split(` `)[0]??``);return A.find(e=>t.includes(e))}function O(e,t,n){return n?M.has(e)?[`-g`,`${t}:${n}`]:e===`subl`?[`${t}:${n}`]:[t]:[t]}function k(e,t){let n=N();if(!n)return!1;let i=n.split(` `),a=i[0]??n,s=i.slice(1),c=D(n);if(c){let r=O(c,e,t),i={detached:!0,stdio:`ignore`},l;return l=process.platform===`win32`?w(`${n} ${r.map(e=>`"${e}"`).join(` `)}`,{...i,shell:!0}):w(a,[...s,...r],i),l.on(`error`,e=>o(`editor spawn failed: ${e}`,{level:`error`})),l.unref(),!0}let l=r.get(process.stdout);if(!l)return!1;let u=t&&j.test(C(a));l.enterAlternateScreen();try{let r={stdio:`inherit`},i;return i=process.platform===`win32`?T(`${n} ${u?`+${t} `:``}"${e}"`,{...r,shell:!0}):T(a,[...s,...u?[`+${t}`,e]:[e]],r),i.error?(o(`editor spawn failed: ${i.error}`,{level:`error`}),!1):!0}finally{l.exitAlternateScreen()}}var A,j,M,N,P=e((()=>{n(),i(),l(),m(),A=[`code`,`cursor`,`windsurf`,`codium`,`subl`,`atom`,`gedit`,`notepad++`,`notepad`],j=/\b(vi|vim|nvim|nano|emacs|pico|micro|helix|hx)\b/,M=new Set([`code`,`cursor`,`windsurf`,`codium`]),N=t(()=>process.env.VISUAL?.trim()?process.env.VISUAL.trim():process.env.EDITOR?.trim()?process.env.EDITOR.trim():process.platform===`win32`?`start /wait notepad`:[`code`,`vi`,`nano`].find(e=>E(e)))}));function F(e){return D(e)!==void 0}function I(e){let t=c(),n=r.get(process.stdout);if(!n)throw Error(`Ink instance not found - cannot pause rendering`);let i=N();if(!i)return{content:null};try{t.statSync(e)}catch{return{content:null}}let a=!F(i);a?n.enterAlternateScreen():(n.pause(),n.suspendStdin());try{return f(`${z[i]??i} "${e}"`,{stdio:`inherit`}),{content:t.readFileSync(e,{encoding:`utf-8`})}}catch(e){if(typeof e==`object`&&e&&`status`in e&&typeof e.status==`number`){let t=e.status;if(t!==0)return{content:null,error:`${y(i)} exited with code ${t}`}}return{content:null}}finally{a?n.exitAlternateScreen():(n.resumeStdin(),n.resume())}}function L(e,t,n){let r=e;for(let[e,t]of Object.entries(n))if(t.type===`text`){let n=parseInt(e,10),i=t.content,a=r.indexOf(i);if(a!==-1){let e=h(n,x(i));r=r.slice(0,a)+e+r.slice(a+i.length)}}return r}function R(e,t){let n=c(),r=b();try{a(r,t?_(e,t):e,{encoding:`utf-8`,flush:!0});let n=I(r);if(n.content===null)return n;let i=n.content;return i.endsWith(`
1
+ import{n as e}from"./chunk-DR8-3Aex.js";import{n as t,t as n}from"./memoize-DNnuA2aU.js";import{Lt as r,t as i}from"./src-Di342QoJ.js";import{O as a,d as o,h as s,p as c,s as l,w as u}from"./debug-UI3T040K.js";import{n as d,t as f}from"./execSyncWrapper-C2XQnFVo.js";import{r as p,t as m}from"./which-DqSAIvp2.js";import{CS as h,Cv as g,Sv as _,_x as v,cx as y,wS as b,xS as x,yS as S}from"./loadAgentsDir-C9Ee_fs1.js";import{basename as C}from"path";import{spawn as w,spawnSync as T}from"child_process";function E(e){return!!p(e)}function D(e){let t=C(e.split(` `)[0]??``);return A.find(e=>t.includes(e))}function O(e,t,n){return n?M.has(e)?[`-g`,`${t}:${n}`]:e===`subl`?[`${t}:${n}`]:[t]:[t]}function k(e,t){let n=N();if(!n)return!1;let i=n.split(` `),a=i[0]??n,s=i.slice(1),c=D(n);if(c){let r=O(c,e,t),i={detached:!0,stdio:`ignore`},l;return l=process.platform===`win32`?w(`${n} ${r.map(e=>`"${e}"`).join(` `)}`,{...i,shell:!0}):w(a,[...s,...r],i),l.on(`error`,e=>o(`editor spawn failed: ${e}`,{level:`error`})),l.unref(),!0}let l=r.get(process.stdout);if(!l)return!1;let u=t&&j.test(C(a));l.enterAlternateScreen();try{let r={stdio:`inherit`},i;return i=process.platform===`win32`?T(`${n} ${u?`+${t} `:``}"${e}"`,{...r,shell:!0}):T(a,[...s,...u?[`+${t}`,e]:[e]],r),i.error?(o(`editor spawn failed: ${i.error}`,{level:`error`}),!1):!0}finally{l.exitAlternateScreen()}}var A,j,M,N,P=e((()=>{n(),i(),l(),m(),A=[`code`,`cursor`,`windsurf`,`codium`,`subl`,`atom`,`gedit`,`notepad++`,`notepad`],j=/\b(vi|vim|nvim|nano|emacs|pico|micro|helix|hx)\b/,M=new Set([`code`,`cursor`,`windsurf`,`codium`]),N=t(()=>process.env.VISUAL?.trim()?process.env.VISUAL.trim():process.env.EDITOR?.trim()?process.env.EDITOR.trim():process.platform===`win32`?`start /wait notepad`:[`code`,`vi`,`nano`].find(e=>E(e)))}));function F(e){return D(e)!==void 0}function I(e){let t=c(),n=r.get(process.stdout);if(!n)throw Error(`Ink instance not found - cannot pause rendering`);let i=N();if(!i)return{content:null};try{t.statSync(e)}catch{return{content:null}}let a=!F(i);a?n.enterAlternateScreen():(n.pause(),n.suspendStdin());try{return f(`${z[i]??i} "${e}"`,{stdio:`inherit`}),{content:t.readFileSync(e,{encoding:`utf-8`})}}catch(e){if(typeof e==`object`&&e&&`status`in e&&typeof e.status==`number`){let t=e.status;if(t!==0)return{content:null,error:`${v(i)} exited with code ${t}`}}return{content:null}}finally{a?n.exitAlternateScreen():(n.resumeStdin(),n.resume())}}function L(e,t,n){let r=e;for(let[e,t]of Object.entries(n))if(t.type===`text`){let n=parseInt(e,10),i=t.content,a=r.indexOf(i);if(a!==-1){let e=x(n,h(i));r=r.slice(0,a)+e+r.slice(a+i.length)}}return r}function R(e,t){let n=c(),r=_();try{a(r,t?S(e,t):e,{encoding:`utf-8`,flush:!0});let n=I(r);if(n.content===null)return n;let i=n.content;return i.endsWith(`
2
2
  `)&&!i.endsWith(`
3
3
 
4
- `)&&(i=i.slice(0,-1)),t&&(i=L(i,e,t)),{content:i}}finally{try{n.unlinkSync(r)}catch{}}}var z,B=e((()=>{g(),i(),P(),d(),s(),v(),u(),S(),z={code:`code -w`,subl:`subl --wait`}}));export{P as a,N as i,R as n,k as o,B as r,I as t};
4
+ `)&&(i=i.slice(0,-1)),t&&(i=L(i,e,t)),{content:i}}finally{try{n.unlinkSync(r)}catch{}}}var z,B=e((()=>{b(),i(),P(),d(),s(),y(),u(),g(),z={code:`code -w`,subl:`subl --wait`}}));export{P as a,N as i,R as n,k as o,B as r,I as t};
@@ -1,4 +1,4 @@
1
- import{Ac as e,Sc as t}from"./paths-D9CVAtXU.js";import{E as n,d as r,s as i,w as a}from"./debug-UI3T040K.js";import{n as o,t as s}from"./which-DqSAIvp2.js";import{r as c,t as l}from"./execFileNoThrow-CuQN1sz8.js";import{n as u,t as d}from"./githubRepoPathMapping-dky2fPeU.js";import{n as f}from"./banner-CVXH2xts.js";import{a as p,i as m,n as h}from"./registerProtocol-DSQh-I21.js";import{homedir as g}from"os";import{basename as _}from"path";import{spawn as v}from"child_process";a(),m(),h(),e(),i(),c(),s();var y=[{name:`iTerm2`,bundleId:`com.googlecode.iterm2`,app:`iTerm`},{name:`Ghostty`,bundleId:`com.mitchellh.ghostty`,app:`Ghostty`},{name:`Kitty`,bundleId:`net.kovidgoyal.kitty`,app:`kitty`},{name:`Alacritty`,bundleId:`org.alacritty`,app:`Alacritty`},{name:`WezTerm`,bundleId:`com.github.wez.wezterm`,app:`WezTerm`},{name:`Terminal.app`,bundleId:`com.apple.Terminal`,app:`Terminal`}],b=[`ghostty`,`kitty`,`alacritty`,`wezterm`,`gnome-terminal`,`konsole`,`xfce4-terminal`,`mate-terminal`,`tilix`,`xterm`];async function x(){let e=t().deepLinkTerminal;if(e){let t=y.find(t=>t.app===e);if(t)return{name:t.name,command:t.app}}let n=process.env.TERM_PROGRAM;if(n){let e=n.replace(/\.app$/i,``).toLowerCase(),t=y.find(t=>t.app.toLowerCase()===e||t.name.toLowerCase()===e);if(t)return{name:t.name,command:t.app}}for(let e of y){let{code:t,stdout:n}=await l(`mdfind`,[`kMDItemCFBundleIdentifier == "${e.bundleId}"`],{timeout:5e3,useCwd:!1});if(t===0&&n.trim().length>0)return{name:e.name,command:e.app}}for(let e of y){let{code:t}=await l(`ls`,[`/Applications/${e.app}.app`],{timeout:1e3,useCwd:!1});if(t===0)return{name:e.name,command:e.app}}return{name:`Terminal.app`,command:`Terminal`}}async function S(){let e=process.env.TERMINAL;if(e){let t=await o(e);if(t)return{name:_(e),command:t}}let t=await o(`x-terminal-emulator`);if(t)return{name:`x-terminal-emulator`,command:t};for(let e of b){let t=await o(e);if(t)return{name:e,command:t}}return null}async function C(){let e=await o(`wt.exe`);if(e)return{name:`Windows Terminal`,command:e};let t=await o(`pwsh.exe`);if(t)return{name:`PowerShell`,command:t};let n=await o(`powershell.exe`);return n?{name:`PowerShell`,command:n}:{name:`Command Prompt`,command:`cmd.exe`}}async function w(){switch(process.platform){case`darwin`:return x();case`linux`:return S();case`win32`:return C();default:return null}}async function T(e,t){let n=await w();if(!n)return r(`No terminal emulator detected`,{level:`error`}),!1;r(`Launching in terminal: ${n.name} (${n.command})`);let i=[`--deep-link-origin`];switch(t.repo&&(i.push(`--deep-link-repo`,t.repo),t.lastFetchMs!==void 0&&i.push(`--deep-link-last-fetch`,String(t.lastFetchMs))),t.query&&i.push(`--prefill`,t.query),process.platform){case`darwin`:return E(n,e,i,t.cwd);case`linux`:return D(n,e,i,t.cwd);case`win32`:return O(n,e,i,t.cwd);default:return!1}}async function E(e,t,n,i){switch(e.command){case`iTerm`:{let{code:e}=await l(`osascript`,[`-e`,`tell application "iTerm"
1
+ import{Ac as e,Sc as t}from"./paths-C2JRlUsH.js";import{E as n,d as r,s as i,w as a}from"./debug-UI3T040K.js";import{n as o,t as s}from"./which-DqSAIvp2.js";import{r as c,t as l}from"./execFileNoThrow-CuQN1sz8.js";import{n as u,t as d}from"./githubRepoPathMapping-CnXpQRPY.js";import{n as f}from"./banner-32EBTKI7.js";import{a as p,i as m,n as h}from"./registerProtocol-WxQUBybC.js";import{homedir as g}from"os";import{basename as _}from"path";import{spawn as v}from"child_process";a(),m(),h(),e(),i(),c(),s();var y=[{name:`iTerm2`,bundleId:`com.googlecode.iterm2`,app:`iTerm`},{name:`Ghostty`,bundleId:`com.mitchellh.ghostty`,app:`Ghostty`},{name:`Kitty`,bundleId:`net.kovidgoyal.kitty`,app:`kitty`},{name:`Alacritty`,bundleId:`org.alacritty`,app:`Alacritty`},{name:`WezTerm`,bundleId:`com.github.wez.wezterm`,app:`WezTerm`},{name:`Terminal.app`,bundleId:`com.apple.Terminal`,app:`Terminal`}],b=[`ghostty`,`kitty`,`alacritty`,`wezterm`,`gnome-terminal`,`konsole`,`xfce4-terminal`,`mate-terminal`,`tilix`,`xterm`];async function x(){let e=t().deepLinkTerminal;if(e){let t=y.find(t=>t.app===e);if(t)return{name:t.name,command:t.app}}let n=process.env.TERM_PROGRAM;if(n){let e=n.replace(/\.app$/i,``).toLowerCase(),t=y.find(t=>t.app.toLowerCase()===e||t.name.toLowerCase()===e);if(t)return{name:t.name,command:t.app}}for(let e of y){let{code:t,stdout:n}=await l(`mdfind`,[`kMDItemCFBundleIdentifier == "${e.bundleId}"`],{timeout:5e3,useCwd:!1});if(t===0&&n.trim().length>0)return{name:e.name,command:e.app}}for(let e of y){let{code:t}=await l(`ls`,[`/Applications/${e.app}.app`],{timeout:1e3,useCwd:!1});if(t===0)return{name:e.name,command:e.app}}return{name:`Terminal.app`,command:`Terminal`}}async function S(){let e=process.env.TERMINAL;if(e){let t=await o(e);if(t)return{name:_(e),command:t}}let t=await o(`x-terminal-emulator`);if(t)return{name:`x-terminal-emulator`,command:t};for(let e of b){let t=await o(e);if(t)return{name:e,command:t}}return null}async function C(){let e=await o(`wt.exe`);if(e)return{name:`Windows Terminal`,command:e};let t=await o(`pwsh.exe`);if(t)return{name:`PowerShell`,command:t};let n=await o(`powershell.exe`);return n?{name:`PowerShell`,command:n}:{name:`Command Prompt`,command:`cmd.exe`}}async function w(){switch(process.platform){case`darwin`:return x();case`linux`:return S();case`win32`:return C();default:return null}}async function T(e,t){let n=await w();if(!n)return r(`No terminal emulator detected`,{level:`error`}),!1;r(`Launching in terminal: ${n.name} (${n.command})`);let i=[`--deep-link-origin`];switch(t.repo&&(i.push(`--deep-link-repo`,t.repo),t.lastFetchMs!==void 0&&i.push(`--deep-link-last-fetch`,String(t.lastFetchMs))),t.query&&i.push(`--prefill`,t.query),process.platform){case`darwin`:return E(n,e,i,t.cwd);case`linux`:return D(n,e,i,t.cwd);case`win32`:return O(n,e,i,t.cwd);default:return!1}}async function E(e,t,n,i){switch(e.command){case`iTerm`:{let{code:e}=await l(`osascript`,[`-e`,`tell application "iTerm"
2
2
  if running then
3
3
  create window with default profile
4
4
  else
@@ -0,0 +1 @@
1
+ import{n as e,o as t}from"./chunk-DR8-3Aex.js";import{Rn as n,f as r,t as i}from"./src-Di342QoJ.js";import{t as a}from"./jsx-runtime-D-D469L8.js";import{$t as o,Da as s,S as c,Zt as l,_ as u,ka as d,on as f,tn as p}from"./paths-C2JRlUsH.js";import{n as m,r as h}from"./analytics-DqMQntaB.js";import{Bg as g,Hg as _,Lx as v,Rx as y,Vg as b,ga as x,ha as S,zg as C}from"./loadAgentsDir-C9Ee_fs1.js";import{n as w,t as T}from"./extra-usage-H-U38bGx.js";import{n as E,t as D}from"./upgrade-B6Ih-Ubj.js";function O({onDone:e,context:t}){let[n,i]=(0,A.useState)(null),a=g(),c=p(),d=o(),f=l()?.hasExtraUsageEnabled===!0,m=c===`max`&&d===`default_claude_max_20x`,_=c===`team`||c===`enterprise`,y=u(`tengu_jade_anvil_4`,!1),S=(0,A.useMemo)(()=>{let e=[];if(b.isEnabled()){let t=s(),n=_&&!t,r=a.overageDisabledReason===`out_of_credits`||a.overageDisabledReason===`org_level_disabled_until`||a.overageDisabledReason===`org_service_zero_credit_limit`;if(!(n&&r)){let t=a.overageStatus===`rejected`||a.overageStatus===`allowed_warning`,r;r=n?t?`Request more`:`Request extra usage`:f?`Add funds to continue with extra usage`:`Switch to extra usage`,e.push({label:r,value:`extra-usage`})}}!m&&!_&&x.isEnabled()&&e.push({label:`Upgrade your plan`,value:`upgrade`});let t={label:`Stop and wait for limit to reset`,value:`cancel`};return y?[...e,t]:[t,...e]},[y,m,_,f,a.overageStatus,a.overageDisabledReason]);function C(){h(`tengu_rate_limit_options_menu_cancel`,{}),e(void 0,{display:`skip`})}function w(n){n===`upgrade`?(h(`tengu_rate_limit_options_menu_select_upgrade`,{}),D(e,t).then(e=>{e&&i(e)})):n===`extra-usage`?(h(`tengu_rate_limit_options_menu_select_extra_usage`,{}),T(e,t).then(e=>{e&&i(e)})):n===`cancel`&&C()}return n||(0,j.jsx)(r,{title:`What do you want to do?`,onCancel:C,color:`suggestion`,children:(0,j.jsx)(v,{options:S,onChange:w,visibleOptionCount:S.length})})}async function k(e,t){return(0,j.jsx)(O,{onDone:e,context:t})}var A,j;e((()=>{A=t(n(),1),y(),i(),c(),m(),C(),f(),d(),w(),_(),S(),E(),j=a()}))();export{k as call};