@readmagic/workmate 0.0.4 → 0.0.5

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 (402) hide show
  1. package/dist/chunks/{AddWorkspaceDirectory-BTC7FPqM.js → AddWorkspaceDirectory-DJRkEz7o.js} +1 -1
  2. package/dist/chunks/{App-DOm71vtY.js → App-iJu5qyiF.js} +1 -1
  3. package/dist/chunks/ApproveApiKey-CKfn7U1R.js +1 -0
  4. package/dist/chunks/{ApproveApiKey-9YQzwrrC.js → ApproveApiKey-CRejTHUw.js} +1 -1
  5. package/dist/chunks/{AssistantSessionChooser-CnYfFWrx.js → AssistantSessionChooser-CBLQ1v-J.js} +1 -1
  6. package/dist/chunks/BackgroundTasksDialog-CyoLEYWH.js +2 -0
  7. package/dist/chunks/{BypassPermissionsModeDialog-DAq-qbqC.js → BypassPermissionsModeDialog-D1FCKVOi.js} +1 -1
  8. package/dist/chunks/{ClaudeMdExternalIncludesDialog-CyvidoR3.js → ClaudeMdExternalIncludesDialog-CI0yF6sZ.js} +1 -1
  9. package/dist/chunks/ClaudeMdExternalIncludesDialog-TypH-X8e.js +1 -0
  10. package/dist/chunks/ConsoleOAuthFlow-wGQuFt41.js +1 -0
  11. package/dist/chunks/{DesktopHandoff-gRvy-WlW.js → DesktopHandoff-D1rrMxeP.js} +1 -1
  12. package/dist/chunks/{DiffDialog-CdfVTgOx.js → DiffDialog-BKcfKx7O.js} +2 -2
  13. package/dist/chunks/Doctor-CcJUwSQn.js +1 -0
  14. package/dist/chunks/Doctor-Yco1McrL.js +3 -0
  15. package/dist/chunks/ExitFlow-D3csukbB.js +2 -0
  16. package/dist/chunks/{Feedback-gGpjUC_F.js → Feedback-bEUtrHia.js} +2 -2
  17. package/dist/chunks/Grove-DPkIjqg8.js +1 -0
  18. package/dist/chunks/{Grove-CD769Wvw.js → Grove-Dsd7F39b.js} +1 -1
  19. package/dist/chunks/{HybridTransport-kN1jmg26.js → HybridTransport-9fTBC2Pv.js} +1 -1
  20. package/dist/chunks/{InvalidConfigDialog-BpJub73a.js → InvalidConfigDialog-9M-1nfZ6.js} +1 -1
  21. package/dist/chunks/{InvalidSettingsDialog-DzOp3Ihx.js → InvalidSettingsDialog-B2F6pryH.js} +1 -1
  22. package/dist/chunks/MCPConnectionManager-MWpKjeZT.js +1 -0
  23. package/dist/chunks/{McpParsingWarnings-Cc6FWyU4.js → McpParsingWarnings-BPBb7Npe.js} +1 -1
  24. package/dist/chunks/MessageSelector-DsQmqFt2.js +3 -0
  25. package/dist/chunks/Messages-B3sGRx5A.js +11 -0
  26. package/dist/chunks/{Onboarding-D00lTweB.js → Onboarding-cHcnsBGp.js} +1 -1
  27. package/dist/chunks/{OverageCreditUpsell-B-Bf_-UX.js → OverageCreditUpsell-CWCD_RpM.js} +1 -1
  28. package/dist/chunks/PluginSettings-B0jbwB2M.js +17 -0
  29. package/dist/chunks/{PromptInputFooterSuggestions-MwS_cExV.js → PromptInputFooterSuggestions-D5sAO6y-.js} +1 -1
  30. package/dist/chunks/{PromptInputHelpMenu-V2dEpzhC.js → PromptInputHelpMenu-n6hAdsto.js} +1 -1
  31. package/dist/chunks/QueryEngine-cwdsr4dr.js +1 -0
  32. package/dist/chunks/REPL-CJzScgbZ.js +142 -0
  33. package/dist/chunks/REPL-DlBJIPCw.js +1 -0
  34. package/dist/chunks/{RemoteCallout-ChCjmgw1.js → RemoteCallout-CiA4rCEs.js} +1 -1
  35. package/dist/chunks/RemoteSessionManager-zdHfmvfj.js +2 -0
  36. package/dist/chunks/ResumeConversation-Rxwd6HAJ.js +1 -0
  37. package/dist/chunks/{SSETransport-h43pQVlJ.js → SSETransport-BPbhCa2f.js} +3 -3
  38. package/dist/chunks/SearchExtraToolsTool-VP87ErGx.js +1 -0
  39. package/dist/chunks/Settings-CxI_KHUj.js +2 -0
  40. package/dist/chunks/{TeleportProgress-QtJrXSCX.js → TeleportProgress-DrulEQ7z.js} +1 -1
  41. package/dist/chunks/{TeleportRepoMismatchDialog-D-HVj-A6.js → TeleportRepoMismatchDialog-D3FOLr0P.js} +1 -1
  42. package/dist/chunks/{TeleportResumeWrapper-C6sbzJsJ.js → TeleportResumeWrapper-DI5iRFND.js} +1 -1
  43. package/dist/chunks/{ThemePicker-CqPCp5Hs.js → ThemePicker-CQ7dfFtv.js} +1 -1
  44. package/dist/chunks/{TrustDialog-CeVwxDlZ.js → TrustDialog-CnVKrdxQ.js} +1 -1
  45. package/dist/chunks/{ValidationErrorsList-Bl68E-2-.js → ValidationErrorsList-CPYeuppg.js} +1 -1
  46. package/dist/chunks/{WelcomeV2-DNiXQ5ES.js → WelcomeV2-C-UXdIng.js} +1 -1
  47. package/dist/chunks/{add-dir-V3xjklnJ.js → add-dir-xTz4COgn.js} +1 -1
  48. package/dist/chunks/{agentDisplay-BuiwcrQi.js → agentDisplay-BuSReYxu.js} +1 -1
  49. package/dist/chunks/{agents-ZY6IaVE7.js → agents-CiLlKN2I.js} +1 -1
  50. package/dist/chunks/agents-Du9KYHqN.js +103 -0
  51. package/dist/chunks/allErrors-P3utlEeA.js +1 -0
  52. package/dist/chunks/{ant-D66LZCap.js → ant-CBIfqmAb.js} +1 -1
  53. package/dist/chunks/api-B-5jqiMg.js +1 -0
  54. package/dist/chunks/api-BiwZmmsh.js +1 -0
  55. package/dist/chunks/{assistant-CYF7ch7C.js → assistant-XOnU01yl.js} +1 -1
  56. package/dist/chunks/auth-BQa4kzQo.js +1 -0
  57. package/dist/chunks/auth-DT2yxy94.js +15 -0
  58. package/dist/chunks/auth-UAJhZNmZ.js +1 -0
  59. package/dist/chunks/{autoMode-TysBQkU_.js → autoMode-CEMflt3g.js} +1 -1
  60. package/dist/chunks/{autonomy-CNEbT-t_.js → autonomy-Cg5zweUa.js} +7 -7
  61. package/dist/chunks/{autonomy-k3QPea5z.js → autonomy-_N8aDaA8.js} +1 -1
  62. package/dist/chunks/{autonomyPanel-DiztRblF.js → autonomyPanel-I4yCy3Fr.js} +1 -1
  63. package/dist/chunks/backgroundHousekeeping-BUUZ7Csq.js +1 -0
  64. package/dist/chunks/backgroundHousekeeping-DhF2lrQ9.js +17 -0
  65. package/dist/chunks/{branch-_NBgDfrK.js → branch-BIX-pyHp.js} +1 -1
  66. package/dist/chunks/{bridge-DpmFl8p8.js → bridge-CYskzVt8.js} +2 -2
  67. package/dist/chunks/{bridgeConfig-DMBOO3gW.js → bridgeConfig-5p_w4s5r.js} +1 -1
  68. package/dist/chunks/bridgeConfig-DWEqKbXk.js +1 -0
  69. package/dist/chunks/bridgeEnabled-CjVCMwnq.js +1 -0
  70. package/dist/chunks/bridgeEnabled-DhFrLTbG.js +1 -0
  71. package/dist/chunks/bridgeMain-6lollTtZ.js +1 -0
  72. package/dist/chunks/bridgeMain-BX2AkLPs.js +68 -0
  73. package/dist/chunks/{bridgeMessaging-N5zlzCCr.js → bridgeMessaging-B5Lbzr8e.js} +1 -1
  74. package/dist/chunks/{btw-BFRje_Zi.js → btw-CWWFO7u8.js} +1 -1
  75. package/dist/chunks/caches-C46fa77L.js +1 -0
  76. package/dist/chunks/{caches-CcfPJ4_A.js → caches-DPqPIogk.js} +2 -2
  77. package/dist/chunks/{ccrClient-q2JCVCU2.js → ccrClient-CTLnU9Y1.js} +1 -1
  78. package/dist/chunks/{clear-CxY7W5Wt.js → clear-DCAgZwc4.js} +1 -1
  79. package/dist/chunks/client-Bup0Sgcn.js +1 -0
  80. package/dist/chunks/{color-DOWhfjnA.js → color-CmJGInHL.js} +1 -1
  81. package/dist/chunks/commands-BdB1eFvP.js +1 -0
  82. package/dist/chunks/{commitAttribution-CLbEIaRJ.js → commitAttribution-CGZr7XNO.js} +2 -2
  83. package/dist/chunks/commitAttribution-D6J3NuhB.js +1 -0
  84. package/dist/chunks/compact-C6-lMHgn.js +2 -0
  85. package/dist/chunks/{config-DiT2Z8dY.js → config-3m_9zSrj.js} +1 -1
  86. package/dist/chunks/config-Bxt1UH1T.js +1 -0
  87. package/dist/chunks/config-CjjXZfNi.js +1 -0
  88. package/dist/chunks/{context-B2OvKo2t.js → context-C9V4GF0n.js} +1 -1
  89. package/dist/chunks/{context-noninteractive-BuGxX3YL.js → context-noninteractive-BmC4o5xo.js} +2 -2
  90. package/dist/chunks/context-noninteractive-DvGo1l7b.js +1 -0
  91. package/dist/chunks/conversation-CH9ouFai.js +1 -0
  92. package/dist/chunks/conversation-CYqqk0o7.js +1 -0
  93. package/dist/chunks/{createSSHSession-C-c7I5iJ.js → createSSHSession-BL6j0AU5.js} +1 -1
  94. package/dist/chunks/createSession-DUfOAeyE.js +1 -0
  95. package/dist/chunks/{createSession-D_fIDqgc.js → createSession-D_sgO1Xy.js} +1 -1
  96. package/dist/chunks/crossProjectResume-D5hTOfnE.js +40 -0
  97. package/dist/chunks/{datadog-Ed8emSFA.js → datadog-UkGdjL8-.js} +1 -1
  98. package/dist/chunks/{desktop-D_ofPlyi.js → desktop-HbYKh-VK.js} +1 -1
  99. package/dist/chunks/{diff-CUAgBDu1.js → diff-nTV17iWX.js} +1 -1
  100. package/dist/chunks/doctor-7fgVhEKL.js +1 -0
  101. package/dist/chunks/{entry-Bh0gPOAo.js → entry-CCFI6-gM.js} +3 -3
  102. package/dist/chunks/envLessBridgeConfig-B2HYnEKo.js +1 -0
  103. package/dist/chunks/{envLessBridgeConfig-DJHZAlU-.js → envLessBridgeConfig-DXd10GXD.js} +1 -1
  104. package/dist/chunks/{esm-B62dCLgf.js → esm-CGoYrggU.js} +1 -1
  105. package/dist/chunks/exit-ropaQiOr.js +1 -0
  106. package/dist/chunks/extra-usage-CLhv1Z4g.js +1 -0
  107. package/dist/chunks/{extra-usage-core-B6ga8Rni.js → extra-usage-core-DLYHAInT.js} +1 -1
  108. package/dist/chunks/{extra-usage-CjaHpu8y.js → extra-usage-g2Pw4zt_.js} +1 -1
  109. package/dist/chunks/{extra-usage-noninteractive-Dc9AndId.js → extra-usage-noninteractive-D8iszH3c.js} +1 -1
  110. package/dist/chunks/extraUsage-C2Ylufhj.js +1 -0
  111. package/dist/chunks/extractMemories-B2IAvbXM.js +1 -0
  112. package/dist/chunks/{fast-CW_NsL0x.js → fast-Dx2fTmWr.js} +1 -1
  113. package/dist/chunks/fast-_G6zcFye.js +1 -0
  114. package/dist/chunks/{feedback-BpRorTAC.js → feedback-DCQ4pJ3v.js} +1 -1
  115. package/dist/chunks/{firstPartyEventLogger-CuUiNdj8.js → firstPartyEventLogger-BNGPPBNP.js} +2 -2
  116. package/dist/chunks/firstPartyEventLogger-C9LzVy6y.js +1 -0
  117. package/dist/chunks/{flushGate-BltVae97.js → flushGate-XaheIZZT.js} +1 -1
  118. package/dist/chunks/{gemini-YyIxfveQ.js → gemini-BCCLHK3K.js} +1 -1
  119. package/dist/chunks/{generateRecap-tx4wLIkI.js → generateRecap-BhvbixY2.js} +1 -1
  120. package/dist/chunks/{generateSessionName-BkDigIN8.js → generateSessionName-CN1oh7Fa.js} +1 -1
  121. package/dist/chunks/{githubRepoPathMapping-C4umZ1oC.js → githubRepoPathMapping-B4AM8luI.js} +1 -1
  122. package/dist/chunks/{goal-DZrD4puM.js → goal-Bp6fyGqo.js} +3 -3
  123. package/dist/chunks/{grok-BZf7W_hL.js → grok-ax26ju8y.js} +1 -1
  124. package/dist/chunks/{grove-CFBPplP6.js → grove-DrBVaZSN.js} +2 -2
  125. package/dist/chunks/{heapdump-DWc3Z2NO.js → heapdump-JseysNDr.js} +1 -1
  126. package/dist/chunks/{help-pap9jNUJ.js → help-DR9hKneR.js} +1 -1
  127. package/dist/chunks/hooks-BUJLxdFJ.js +1 -0
  128. package/dist/chunks/{hooks-Bmat0L6A.js → hooks-C5n23H1E.js} +2 -2
  129. package/dist/chunks/inboundAttachments-C0nMTtCi.js +1 -0
  130. package/dist/chunks/{inboundAttachments-DkfNHtF9.js → inboundAttachments-Cp8XvLMZ.js} +1 -1
  131. package/dist/chunks/initReplBridge-DJs28ZkI.js +1 -0
  132. package/dist/chunks/{install-D4jmHjmk.js → install-C7qTB0V5.js} +1 -1
  133. package/dist/chunks/{instrumentation-Nqgm1SMw.js → instrumentation-CLZttr_u.js} +4 -4
  134. package/dist/chunks/{job-CT9bcgPb.js → job-BhiazwPH.js} +1 -1
  135. package/dist/chunks/keybindings-CkL8BzUt.js +2 -0
  136. package/dist/chunks/{language-BA5WprZv.js → language-DIw2871r.js} +1 -1
  137. package/dist/chunks/language-DfOAuDFc.js +1 -0
  138. package/dist/chunks/launchAgentsPlatform-j-mWpwW1.js +1 -0
  139. package/dist/chunks/{launchLocalMemory-CRMqifzn.js → launchLocalMemory-DmoXp0Xo.js} +2 -2
  140. package/dist/chunks/{launchLocalVault-DlKX_oDE.js → launchLocalVault-1uKe0HjA.js} +3 -3
  141. package/dist/chunks/launchMemoryStores-SxDKjHJ3.js +1 -0
  142. package/dist/chunks/{launchOnboarding-DTdUA_wE.js → launchOnboarding-CTtpnXcs.js} +1 -1
  143. package/dist/chunks/launchSchedule-BDVnGhaL.js +1 -0
  144. package/dist/chunks/launchSkillStore-SmMLxp4K.js +1 -0
  145. package/dist/chunks/{launchTeleport-CXFRPVMR.js → launchTeleport-B472ZSGz.js} +3 -3
  146. package/dist/chunks/launchVault-CsyBgxle.js +1 -0
  147. package/dist/chunks/{loadAgentsDir-BURvZNN6.js → loadAgentsDir-Clu7Uk6a.js} +629 -629
  148. package/dist/chunks/loadAgentsDir-DTbJJff-.js +1 -0
  149. package/dist/chunks/loadPluginHooks-Cvd5VdjQ.js +1 -0
  150. package/dist/chunks/localSearch-DKv8PRLD.js +1 -0
  151. package/dist/chunks/{localSearch-D2Rs8wQP.js → localSearch-iA6JTk19.js} +1 -1
  152. package/dist/chunks/{logoV2Utils-DN9nzdX-.js → logoV2Utils-YHBJLIrC.js} +1 -1
  153. package/dist/chunks/{magicDocs-DIeTcwAA.js → magicDocs-Bf1fqnHN.js} +3 -3
  154. package/dist/chunks/{main-CI54PZrG.js → main-gtV_TqXP.js} +84 -84
  155. package/dist/chunks/{mappers-Q_Z3Kjo-.js → mappers-C8lYERPX.js} +1 -1
  156. package/dist/chunks/{mcp-RvwPC7FB.js → mcp-CNuhEGP6.js} +4 -4
  157. package/dist/chunks/mcp-Ci0OPVrR.js +1 -0
  158. package/dist/chunks/mcp-CwIYauZl.js +2 -0
  159. package/dist/chunks/memory-DCGqfQ1U.js +1 -0
  160. package/dist/chunks/{mode-Jl_Boaym.js → mode-DO6g7nkX.js} +2 -2
  161. package/dist/chunks/model-BQF64tZx.js +1 -0
  162. package/dist/chunks/model-DLXL0CNu.js +1 -0
  163. package/dist/chunks/model-DvrvG6BB.js +1 -0
  164. package/dist/chunks/{nativeInstaller-8arnRiUO.js → nativeInstaller-OPuO2sm_.js} +1 -1
  165. package/dist/chunks/{onChangeAppState-DBantDJ6.js → onChangeAppState-CHhRDkM7.js} +1 -1
  166. package/dist/chunks/openai-HOebt-8k.js +10 -0
  167. package/dist/chunks/{overageCreditGrant-CN_sVURL.js → overageCreditGrant-Bi1CTBAx.js} +1 -1
  168. package/dist/chunks/{panelCall-CPKC6VR5.js → panelCall-D0eURklm.js} +1 -1
  169. package/dist/chunks/{partition-CW0BJ881.js → partition-C8RSL3SQ.js} +1 -1
  170. package/dist/chunks/{passes-DOm9ukdK.js → passes-BJci5SM_.js} +1 -1
  171. package/dist/chunks/permissions-JU9CGHgI.js +3 -0
  172. package/dist/chunks/{pidLock-C69HNTTb.js → pidLock-Bd2e6xuT.js} +2 -2
  173. package/dist/chunks/{plan-B0rEs32a.js → plan-D4gMsK7i.js} +1 -1
  174. package/dist/chunks/{plugin-BSEMgcGu.js → plugin-CwCo5Kik.js} +1 -1
  175. package/dist/chunks/{pluginAutoupdate-CTByPD8J.js → pluginAutoupdate-CO-n9bqe.js} +1 -1
  176. package/dist/chunks/{pluginBlocklist-mogKaK0p.js → pluginBlocklist-5qbaTRbV.js} +1 -1
  177. package/dist/chunks/pluginCliCommands-I-lsw_us.js +1 -0
  178. package/dist/chunks/{pluginFlagging-mHNff1t9.js → pluginFlagging-DNPBbJZo.js} +1 -1
  179. package/dist/chunks/{pluginOperations-JEedVzfS.js → pluginOperations-Cz6eQ0Vu.js} +2 -2
  180. package/dist/chunks/pluginStartupCheck-CoW7073W.js +1 -0
  181. package/dist/chunks/{pluginStartupCheck-RscVZDi4.js → pluginStartupCheck-DJ9fslCK.js} +1 -1
  182. package/dist/chunks/plugins-CzJIuPfb.js +4 -0
  183. package/dist/chunks/policyLimits-BkjgMQD0.js +1 -0
  184. package/dist/chunks/{poor-DekfGNT7.js → poor-Dha9p9RF.js} +1 -1
  185. package/dist/chunks/{poorMode-CtcqaiwD.js → poorMode-1NLYiS3Y.js} +1 -1
  186. package/dist/chunks/poorMode-qlxqU8Hm.js +1 -0
  187. package/dist/chunks/print-BL4EUT5Z.js +23 -0
  188. package/dist/chunks/{privacy-settings-CwJ1H8Ua.js → privacy-settings-6ZWxR4Qt.js} +1 -1
  189. package/dist/chunks/processBashCommand-BZs9wggV.js +1 -0
  190. package/dist/chunks/processSlashCommand-D8lKLNzM.js +5 -0
  191. package/dist/chunks/{prompt-DNDgGM9q.js → prompt-Bg_1U0gO.js} +1 -1
  192. package/dist/chunks/prompt-CN7gBNKS.js +1 -0
  193. package/dist/chunks/prompt-D-zHhqp8.js +1 -0
  194. package/dist/chunks/{promptEditor-DMJyosKj.js → promptEditor-BhYDmwdS.js} +2 -2
  195. package/dist/chunks/{protocolHandler-z2zxAtB1.js → protocolHandler-Dnb7lITm.js} +1 -1
  196. package/dist/chunks/rate-limit-options-DVzT3eWH.js +1 -0
  197. package/dist/chunks/{rcDebugLog-DoL1FpGJ.js → rcDebugLog-VKwMl0yg.js} +1 -1
  198. package/dist/chunks/reconciler-BdRXZTJf.js +4 -0
  199. package/dist/chunks/{referral-UKJv23_5.js → referral-BlrMpBAV.js} +1 -1
  200. package/dist/chunks/{refresh-ul_i5R1a.js → refresh-jwqnoK2h.js} +1 -1
  201. package/dist/chunks/{registerProtocol-CukLQuxJ.js → registerProtocol-CuKZAiCc.js} +1 -1
  202. package/dist/chunks/{release-notes-CGv_6MMt.js → release-notes-BgP8u7NE.js} +1 -1
  203. package/dist/chunks/{releaseNotes-BKZNuDLD.js → releaseNotes-CunqVlbU.js} +2 -2
  204. package/dist/chunks/{reload-plugins-2W11dpLQ.js → reload-plugins-CD9TzvFm.js} +1 -1
  205. package/dist/chunks/{remote-env-D9xsoBfx.js → remote-env-QaP_W_sv.js} +1 -1
  206. package/dist/chunks/{remoteBridgeCore-asY9JAXU.js → remoteBridgeCore-9-HVMo63.js} +1 -1
  207. package/dist/chunks/{remoteManagedSettings-Bxo3bv1U.js → remoteManagedSettings-jZ6u8ZBT.js} +1 -1
  208. package/dist/chunks/{rename-CHsHMWpO.js → rename-29qxHf8W.js} +1 -1
  209. package/dist/chunks/{resume-NduOaghx.js → resume-D-SpOy_1.js} +2 -2
  210. package/dist/chunks/{runtimeObserver-Bo80nWQf.js → runtimeObserver-DOEcrylu.js} +1 -1
  211. package/dist/chunks/{runtimeObserver-BXbjibFk.js → runtimeObserver-Dm3LIUMp.js} +3 -3
  212. package/dist/chunks/sandbox-adapter-LzTcKwBp.js +1 -0
  213. package/dist/chunks/{sandbox-toggle-C-WCDRN4.js → sandbox-toggle-B61AeBor.js} +1 -1
  214. package/dist/chunks/searchExtraTools-CbJJQqzH.js +1 -0
  215. package/dist/chunks/{session-pDd13-wE.js → session-RwJCIIcs.js} +2 -2
  216. package/dist/chunks/{sessionDiscovery-CSUnpsCy.js → sessionDiscovery-dkFeWcA3.js} +1 -1
  217. package/dist/chunks/sessionFileAccessHooks-B_nNW0zE.js +1 -0
  218. package/dist/chunks/sessionMemory-C4JAUZ6V.js +1 -0
  219. package/dist/chunks/sessionMemory-btARBn8H.js +1 -0
  220. package/dist/chunks/sessionMemoryUtils-BlqAy8oR.js +1 -0
  221. package/dist/chunks/{sessionObserver-Ur7PqKl_.js → sessionObserver-CSOYgsvH.js} +1 -1
  222. package/dist/chunks/sessionObserver-DMvWci8-.js +1 -0
  223. package/dist/chunks/sessionStorage-Diyuvt20.js +1 -0
  224. package/dist/chunks/{sessionTitle-pWMaI79N.js → sessionTitle-CLOlPZ_M.js} +1 -1
  225. package/dist/chunks/{sessionTracing-CCPRzOvy.js → sessionTracing-D8wr9j4X.js} +1 -1
  226. package/dist/chunks/{settings-DfWP5y6X.js → settings-Dlp5JTa_.js} +1 -1
  227. package/dist/chunks/settingsSync-QWA0VZSu.js +1 -0
  228. package/dist/chunks/setup-UI9uv2-K.js +3 -0
  229. package/dist/chunks/{shadowedRuleDetection-Chi3afMR.js → shadowedRuleDetection-CXsmUY2o.js} +1 -1
  230. package/dist/chunks/{sideQuestion-D03MXdE2.js → sideQuestion-CHpOVzY5.js} +1 -1
  231. package/dist/chunks/{sinks-B4_pw0Gb.js → sinks-1hFrW9HK.js} +2 -2
  232. package/dist/chunks/sinks-CXq8-7Qn.js +1 -0
  233. package/dist/chunks/{skill-learning-7ZQF5JvA.js → skill-learning-Ck17rwH8.js} +1 -1
  234. package/dist/chunks/skillChangeDetector-s0F9Yf9a.js +1 -0
  235. package/dist/chunks/{skillGapStore-BND2Lq0Z.js → skillGapStore-BJ1h2LVr.js} +1 -1
  236. package/dist/chunks/{skillGapStore-z3LP64O-.js → skillGapStore-DyqNKuNy.js} +2 -2
  237. package/dist/chunks/{skillGenerator-DaNb-yKH.js → skillGenerator-BT8NGzXT.js} +2 -2
  238. package/dist/chunks/skillLearning-1ZfYIzfL.js +1 -0
  239. package/dist/chunks/{skillLearning-rMX1bSBa.js → skillLearning-Cn9Uw0Kd.js} +1 -1
  240. package/dist/chunks/{skillPanel-q7GPSQ6_.js → skillPanel-N0GoWjIi.js} +3 -3
  241. package/dist/chunks/{skillSearchPanel-oj8gy1ZL.js → skillSearchPanel-CTwtgTzy.js} +3 -3
  242. package/dist/chunks/{skills-QqbeFP0s.js → skills-Bv3lH-aA.js} +1 -1
  243. package/dist/chunks/{stats-DmFubHpI.js → stats-C1Ff6w4i.js} +1 -1
  244. package/dist/chunks/{status-DW3Z_7xa.js → status-DyXiBa0m.js} +2 -2
  245. package/dist/chunks/{status-BEIsLmfj.js → status-FD7HVYS7.js} +1 -1
  246. package/dist/chunks/{statusNoticeHelpers-CaHS8xig.js → statusNoticeHelpers-kTp9Rdk6.js} +1 -1
  247. package/dist/chunks/{tag-CRg93Die.js → tag-RzOSA5T0.js} +2 -2
  248. package/dist/chunks/{tasks-BEohK1ij.js → tasks-eJrOcdhB.js} +1 -1
  249. package/dist/chunks/teleport-ABA-hdmP.js +1 -0
  250. package/dist/chunks/{templateJobs-DYP1fjYU.js → templateJobs-BnOBSFtq.js} +1 -1
  251. package/dist/chunks/{terminalSetup-RDKg8dVa.js → terminalSetup-BfvmoJaK.js} +1 -1
  252. package/dist/chunks/{terminalSetup-BNs9nLbT.js → terminalSetup-D_P5iZmq.js} +1 -1
  253. package/dist/chunks/{theme-kNL4kl_3.js → theme-S0kVMVt4.js} +1 -1
  254. package/dist/chunks/thinkback-C6gV2LpU.js +1 -0
  255. package/dist/chunks/thinkback-HyW_R_88.js +1 -0
  256. package/dist/chunks/{thinkback-play-BpWMqbgJ.js → thinkback-play-H6md4czq.js} +1 -1
  257. package/dist/chunks/{toolEventObserver-ar5NDa0M.js → toolEventObserver--Z6jENks.js} +1 -1
  258. package/dist/chunks/{toolEventObserver-C98uraqD.js → toolEventObserver-BAFzvePj.js} +1 -1
  259. package/dist/chunks/toolPool-CR61XXm3.js +1 -0
  260. package/dist/chunks/trustedDevice-DUrFWupL.js +1 -0
  261. package/dist/chunks/{trustedDevice-BBKUhCCL.js → trustedDevice-Dn4rXbxT.js} +1 -1
  262. package/dist/chunks/types-Bh9S_JG5.js +3 -0
  263. package/dist/chunks/types-DHkZVzJe.js +1 -0
  264. package/dist/chunks/{ultrareviewCommand-yXlFsMnv.js → ultrareviewCommand-mYDTBCFD.js} +2 -2
  265. package/dist/chunks/{undercover-BTIRVF1t.js → undercover-CdapzvNH.js} +1 -1
  266. package/dist/chunks/undercover-k3JoOKAb.js +1 -0
  267. package/dist/chunks/{updateCCB-B2xAJ4Nr.js → updateCCB-DPShheOr.js} +1 -1
  268. package/dist/chunks/upgrade-BOeakAP6.js +1 -0
  269. package/dist/chunks/upgrade-D7iGU0PQ.js +1 -0
  270. package/dist/chunks/{upload-BWVIHmMB.js → upload-BXQsDtLW.js} +1 -1
  271. package/dist/chunks/usage-DbRdMJog.js +1 -0
  272. package/dist/chunks/usage-iNQzY960.js +1 -0
  273. package/dist/chunks/{useExitOnCtrlCDWithKeybindings-CV4GZ-sq.js → useExitOnCtrlCDWithKeybindings-CntByfTQ.js} +1 -1
  274. package/dist/chunks/useMainLoopModel-DHkRIgNs.js +1 -0
  275. package/dist/chunks/useManagePlugins-B8HD0RUh.js +1 -0
  276. package/dist/chunks/{useMergedTools-CRLWSGDl.js → useMergedTools-DfchLQZC.js} +1 -1
  277. package/dist/chunks/{useSearchInput-BzGq4t7t.js → useSearchInput-H-8hJeFD.js} +1 -1
  278. package/dist/chunks/useSettingsErrors-BF5i5Xju.js +1 -0
  279. package/dist/chunks/{util-BnReK81E.js → util-CoicMvOv.js} +1 -1
  280. package/dist/chunks/validatePlugin-z2fcngf8.js +1 -0
  281. package/dist/chunks/{vim-C0KTnJJs.js → vim-DdvQlLDm.js} +1 -1
  282. package/dist/chunks/{workerRegistry-CUXbNyL9.js → workerRegistry-CzqQwCHC.js} +1 -1
  283. package/dist/chunks/worktree-DMhP5T0p.js +1 -0
  284. package/dist/cli.js +1 -1
  285. package/package.json +1 -1
  286. package/dist/chunks/ApproveApiKey-LPrZMlgU.js +0 -1
  287. package/dist/chunks/BackgroundTasksDialog-D_UHm7xo.js +0 -2
  288. package/dist/chunks/ClaudeMdExternalIncludesDialog--w2zWWEn.js +0 -1
  289. package/dist/chunks/ConsoleOAuthFlow-BXdC6j3_.js +0 -1
  290. package/dist/chunks/Doctor-BuiYwjAS.js +0 -1
  291. package/dist/chunks/Doctor-DKlHJBXq.js +0 -3
  292. package/dist/chunks/ExitFlow-rExuBL3w.js +0 -2
  293. package/dist/chunks/Grove-ENfM8hC6.js +0 -1
  294. package/dist/chunks/MCPConnectionManager-CaBvO7NB.js +0 -1
  295. package/dist/chunks/MessageSelector-DOB1S2-O.js +0 -3
  296. package/dist/chunks/Messages-Clihwd2F.js +0 -11
  297. package/dist/chunks/PluginSettings-DUxj_oAg.js +0 -17
  298. package/dist/chunks/QueryEngine-BLcPQYq_.js +0 -1
  299. package/dist/chunks/REPL-B_E07dnf.js +0 -142
  300. package/dist/chunks/REPL-BhURgntS.js +0 -1
  301. package/dist/chunks/RemoteSessionManager-B43isWQs.js +0 -2
  302. package/dist/chunks/ResumeConversation-DaQ9n8_C.js +0 -1
  303. package/dist/chunks/SearchExtraToolsTool-DSq7beKs.js +0 -1
  304. package/dist/chunks/Settings-CNsaWv8g.js +0 -2
  305. package/dist/chunks/agents-D7um1IXM.js +0 -103
  306. package/dist/chunks/allErrors-CHVdQ3fT.js +0 -1
  307. package/dist/chunks/api-C-rOQY-l.js +0 -1
  308. package/dist/chunks/api-Dmn7DUgU.js +0 -1
  309. package/dist/chunks/auth-C4Rvit2q.js +0 -1
  310. package/dist/chunks/auth-Cj7EX1eG.js +0 -1
  311. package/dist/chunks/auth-DAxGNCIR.js +0 -15
  312. package/dist/chunks/backgroundHousekeeping-C9m4tiFi.js +0 -17
  313. package/dist/chunks/backgroundHousekeeping-DQjzXBe0.js +0 -1
  314. package/dist/chunks/bridgeConfig-DsI5d0s7.js +0 -1
  315. package/dist/chunks/bridgeEnabled-DZzlF2d8.js +0 -1
  316. package/dist/chunks/bridgeEnabled-FjPuA7zx.js +0 -1
  317. package/dist/chunks/bridgeMain-BppY0KW3.js +0 -68
  318. package/dist/chunks/bridgeMain-BrY4tkF6.js +0 -1
  319. package/dist/chunks/caches-BBLH8G1I.js +0 -1
  320. package/dist/chunks/client-CtVu3BLD.js +0 -1
  321. package/dist/chunks/commands-BWw1sQeH.js +0 -1
  322. package/dist/chunks/commitAttribution-DIT_s0vY.js +0 -1
  323. package/dist/chunks/compact-CaOnQVkH.js +0 -2
  324. package/dist/chunks/config-DmPGzNmi.js +0 -1
  325. package/dist/chunks/config-HHTwEsWp.js +0 -1
  326. package/dist/chunks/context-noninteractive-BilCSCV1.js +0 -1
  327. package/dist/chunks/conversation-BWXf3un9.js +0 -1
  328. package/dist/chunks/conversation-awh8AwwL.js +0 -1
  329. package/dist/chunks/createSession-Hvpx3Le7.js +0 -1
  330. package/dist/chunks/crossProjectResume-_XjvSXA3.js +0 -40
  331. package/dist/chunks/doctor-CkdQ7Fv7.js +0 -1
  332. package/dist/chunks/effort-DCgooYMY.js +0 -9
  333. package/dist/chunks/envLessBridgeConfig-sxodu0xO.js +0 -1
  334. package/dist/chunks/exit-CFJR3NfE.js +0 -1
  335. package/dist/chunks/extra-usage-D1Y-3OWQ.js +0 -1
  336. package/dist/chunks/extraUsage-2DwLEr26.js +0 -1
  337. package/dist/chunks/extractMemories-C3qrwpu2.js +0 -1
  338. package/dist/chunks/fast-D3CPmUX4.js +0 -1
  339. package/dist/chunks/firstPartyEventLogger-DPUQnc6J.js +0 -1
  340. package/dist/chunks/hooks-cCAzfabs.js +0 -1
  341. package/dist/chunks/inboundAttachments-DZgSqDwY.js +0 -1
  342. package/dist/chunks/initReplBridge-myzllvlk.js +0 -1
  343. package/dist/chunks/keybindings-DETOn3qJ.js +0 -2
  344. package/dist/chunks/language-BbaOTWm3.js +0 -1
  345. package/dist/chunks/launchAgentsPlatform-CuRQgd2Q.js +0 -1
  346. package/dist/chunks/launchMemoryStores-CN0ecWpP.js +0 -1
  347. package/dist/chunks/launchSchedule-psiSLmTA.js +0 -1
  348. package/dist/chunks/launchSkillStore-CQQ00Ads.js +0 -1
  349. package/dist/chunks/launchVault-Dn6jq0Rc.js +0 -1
  350. package/dist/chunks/loadAgentsDir-Db9UTm45.js +0 -1
  351. package/dist/chunks/loadPluginHooks-C9A9oS-w.js +0 -1
  352. package/dist/chunks/localSearch-hBh1ATr2.js +0 -1
  353. package/dist/chunks/mcp-CtbhGaLC.js +0 -2
  354. package/dist/chunks/mcp-DMacvhqZ.js +0 -1
  355. package/dist/chunks/memory-BPN8gW7n.js +0 -1
  356. package/dist/chunks/model-BIVmcl_N.js +0 -1
  357. package/dist/chunks/model-CWBwPvTH.js +0 -1
  358. package/dist/chunks/model-DlVpqR0P.js +0 -1
  359. package/dist/chunks/openai-yin1iDG8.js +0 -10
  360. package/dist/chunks/permissions-CxDJ__l6.js +0 -3
  361. package/dist/chunks/pluginCliCommands-DQQ7C7kk.js +0 -1
  362. package/dist/chunks/pluginStartupCheck-D7ts2V3p.js +0 -1
  363. package/dist/chunks/plugins-Cr03lISA.js +0 -4
  364. package/dist/chunks/policyLimits-DWtLyJ4n.js +0 -1
  365. package/dist/chunks/poorMode-AE4WNYZo.js +0 -1
  366. package/dist/chunks/print-CZUmAzmt.js +0 -23
  367. package/dist/chunks/processBashCommand-aKNneP2u.js +0 -1
  368. package/dist/chunks/processSlashCommand-BcPnWNxZ.js +0 -5
  369. package/dist/chunks/prompt-CIyhCdkE.js +0 -1
  370. package/dist/chunks/prompt-DRhjinu2.js +0 -1
  371. package/dist/chunks/rate-limit-options--Y3oF1g0.js +0 -1
  372. package/dist/chunks/reconciler-CJcSh6xo.js +0 -4
  373. package/dist/chunks/sandbox-adapter-DDfVl_2V.js +0 -1
  374. package/dist/chunks/searchExtraTools-BHWzsbNO.js +0 -1
  375. package/dist/chunks/sessionFileAccessHooks-BZvxeufx.js +0 -1
  376. package/dist/chunks/sessionMemory-CAmpw2yb.js +0 -1
  377. package/dist/chunks/sessionMemory-DT0IkiA1.js +0 -1
  378. package/dist/chunks/sessionMemoryUtils-B4kGNH4j.js +0 -1
  379. package/dist/chunks/sessionObserver-oIkwTidC.js +0 -1
  380. package/dist/chunks/sessionStorage-DqARUj0K.js +0 -1
  381. package/dist/chunks/settingsSync-D_4P3Esd.js +0 -1
  382. package/dist/chunks/setup-JHvhWKh9.js +0 -3
  383. package/dist/chunks/sinks-Cro1Y8C2.js +0 -1
  384. package/dist/chunks/skillChangeDetector-uCaYrerZ.js +0 -1
  385. package/dist/chunks/skillLearning-GZxYPlyl.js +0 -1
  386. package/dist/chunks/teleport-4Srg5vcP.js +0 -1
  387. package/dist/chunks/thinkback-gV-sKkMM.js +0 -1
  388. package/dist/chunks/thinkback-hc5eJ9ul.js +0 -1
  389. package/dist/chunks/toolPool-CNYKDRq5.js +0 -1
  390. package/dist/chunks/trustedDevice-0dehm9qz.js +0 -1
  391. package/dist/chunks/types-BUyOCzUt.js +0 -1
  392. package/dist/chunks/types-Czs-_G1S.js +0 -3
  393. package/dist/chunks/undercover-CG_269xD.js +0 -1
  394. package/dist/chunks/upgrade-J7lKLkD2.js +0 -1
  395. package/dist/chunks/upgrade-yNl7EO4e.js +0 -1
  396. package/dist/chunks/usage-B2PbCUMi.js +0 -1
  397. package/dist/chunks/usage-Ck8Cu45g.js +0 -1
  398. package/dist/chunks/useMainLoopModel-CO4yBjRM.js +0 -1
  399. package/dist/chunks/useManagePlugins-BzFKIDrD.js +0 -1
  400. package/dist/chunks/useSettingsErrors-CSemUjj1.js +0 -1
  401. package/dist/chunks/validatePlugin-D6sPqea1.js +0 -1
  402. package/dist/chunks/worktree-89ttIVxH.js +0 -1
@@ -1,17 +0,0 @@
1
- import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{l as n,o as r}from"./envUtils-DSxRz_kt.js";import{n as i,t as a}from"./figures-5ThXQEtq.js";import{D as o,Gr as s,Gt as c,H as l,I as u,Lt as d,P as f,T as p,Wt as ee,Xn as m,dr as h,fi as g,hn as _,j as v,k as y,n as b,ot as x,r as S,t as C,x as te,y as w}from"./src-CDCSSo0U2.js";import{t as T}from"./jsx-runtime-Bb4Xn-E0.js";import{$D as E,$s as ne,As as D,C_ as O,E_ as k,Es as A,Ex as j,Fs as re,G_ as ie,Gs as M,H_ as N,Hs as ae,JS as oe,Lb as P,M_ as se,Ms as ce,O_ as le,Qg as ue,Rs as F,Rx as de,Tx as I,Vs as fe,XS as pe,Xs as L,Ys as me,_x as he,aO as ge,ac as _e,am as ve,av as ye,b_ as be,cv as xe,dg as Se,dv as R,ec as Ce,fD as we,fO as Te,fs as Ee,fv as De,gD as Oe,gx as ke,hD as Ae,i_ as je,ic as Me,ig as Ne,k_ as Pe,ks as Fe,lC as Ie,lO as Le,lc as z,lv as Re,nc as ze,nv as Be,o_ as Ve,om as He,ov as Ue,pO as We,ps as Ge,pv as Ke,qS as qe,qs as Je,rO as Ye,r_ as Xe,rc as Ze,sc as Qe,sv as $e,tc as et,tv as tt,uO as nt,uc as rt,uv as it,vs as at,w_ as ot,ys as st,zb as ct,zx as lt}from"./loadAgentsDir-BURvZNN6.js";import{C as ut,F as dt,S as ft,W as pt,a as mt,l as ht,z as gt}from"./debug-BrXObCdR.js";import{St as _t,Tt as vt,_n as yt,at as bt,c as xt,ct as St,f as Ct,g as wt,gn as Tt,it as Et,y as Dt}from"./settings-DfWP5y6X.js";import{g as Ot,x as kt}from"./config-DiT2Z8dY.js";import{c as At,o as jt,s as Mt}from"./log-BMCygSzM.js";import{n as Nt,r as Pt}from"./analytics-BotDBGh0.js";import{T as Ft,x as It}from"./startupProfiler-xa3NmN7Z.js";import{l as Lt,u as Rt}from"./oauth-BqJqV-2M.js";import{l as zt,n as Bt,o as Vt}from"./stringUtils-DGLPkqJ4.js";import{Mt as Ht,Vt as Ut}from"./model-BIVmcl_N.js";import{a as Wt,n as Gt,o as Kt,r as qt}from"./pluginFlagging-mHNff1t9.js";import{u as Jt}from"./referral-UKJv23_5.js";import{n as Yt,t as Xt}from"./browser-BmZuQom6.js";import{n as Zt,t as Qt}from"./pluginStartupCheck-RscVZDi4.js";import{a as $t,d as en,f as tn,i as nn,l as rn,o as an,s as on,u as sn}from"./pluginOperations-JEedVzfS.js";import{a as cn,c as ln,i as un,n as dn,o as fn,s as pn,t as mn}from"./validatePlugin-D6sPqea1.js";import{i as hn,n as gn,r as _n}from"./MCPConnectionManager-CaBvO7NB.js";import{n as vn,t as yn}from"./useExitOnCtrlCDWithKeybindings-CV4GZ-sq.js";import{t as bn}from"./SearchBox-vfLXEPed.js";import{n as xn,t as Sn}from"./useSearchInput-BzGq4t7t.js";import{i as Cn,n as wn}from"./pluginAutoupdate-CTByPD8J.js";import*as Tn from"path";import*as En from"fs/promises";function Dn({serverToolsCount:e,serverPromptsCount:t,serverResourcesCount:n}){let r=[];return e>0&&r.push(`tools`),n>0&&r.push(`resources`),t>0&&r.push(`prompts`),(0,On.jsxs)(u,{children:[(0,On.jsx)(f,{bold:!0,children:`Capabilities: `}),(0,On.jsx)(f,{color:`text`,children:r.length>0?(0,On.jsx)(p,{children:r}):`none`})]})}var On,kn=e((()=>{g(),C(),On=T()}));function An(e,t){switch(e.client.type){case`connected`:return{message:`Reconnected to ${t}.`,success:!0};case`needs-auth`:return{message:`${t} requires authentication. Use the 'Authenticate' option.`,success:!1};case`failed`:return{message:`Failed to reconnect to ${t}.`,success:!1};default:return{message:`Unknown result when reconnecting to ${t}.`,success:!1}}}function jn(e,t){return`Error reconnecting to ${t}: ${e instanceof Error?e.message:String(e)}`}var Mn=e((()=>{}));function Nn({server:e,serverToolsCount:t,onViewTools:n,onCancel:r,onComplete:i,borderless:s=!1}){let[c]=l(),m=vn(),{columns:g}=x(),[y,b]=B.useState(!1),[S,C]=B.useState(null),te=oe(e=>e.mcp),w=pe(),[T,E]=B.useState(null),[ne,D]=(0,B.useState)(!1),A=(0,B.useRef)(null),[j,re]=(0,B.useState)(!1),[ie,M]=(0,B.useState)(null),[N,ae]=(0,B.useState)(!1),[se,ce]=(0,B.useState)(null),[F,fe]=(0,B.useState)(!1),[L,me]=(0,B.useState)(!1),ge=(0,B.useRef)(void 0),_e=(0,B.useRef)(!1),[ve,ye]=(0,B.useState)(``),[xe,Se]=(0,B.useState)(0),[R,Ce]=(0,B.useState)(null);(0,B.useEffect)(()=>()=>{_e.current=!0,A.current?.abort(),ge.current!==void 0&&clearTimeout(ge.current)},[]);let we=e.isAuthenticated||e.client.type===`connected`&&t>0,Te=_n(),Ee=B.useCallback(async()=>{re(!1),M(null),D(!0);try{let t=await Te(e.name),n=t.client.type===`connected`;Pt(`tengu_claudeai_mcp_auth_completed`,{success:n}),n?i?.(`Authentication successful. Connected to ${e.name}.`):t.client.type===`needs-auth`?i?.(`Authentication successful, but server still requires authentication. You may need to manually restart Claude Code.`):i?.(`Authentication successful, but server reconnection failed. You may need to manually restart Claude Code for the changes to take effect.`)}catch(t){Pt(`tengu_claudeai_mcp_auth_completed`,{success:!1}),i?.(jn(t,e.name))}finally{D(!1)}},[Te,e.name,i]),De=B.useCallback(async()=>{await Ne(e.name,{...e.config,scope:e.scope}),w(t=>{let n=t.mcp.clients.map(t=>t.name===e.name?{...t,type:`needs-auth`}:t),r=k(t.mcp.tools,e.name),i=O(t.mcp.commands,e.name),a=ot(t.mcp.resources,e.name);return{...t,mcp:{...t.mcp,clients:n,tools:r,commands:i,resources:a}}}),Pt(`tengu_claudeai_mcp_clear_auth_completed`,{}),i?.(`Disconnected from ${e.name}.`),ae(!1),ce(null),fe(!1)},[e.name,e.config,e.scope,w,i]);ee(`confirm:no`,()=>{A.current?.abort(),A.current=null,b(!1),E(null)},{context:`Confirmation`,isActive:y}),ee(`confirm:no`,()=>{re(!1),M(null)},{context:`Confirmation`,isActive:j}),ee(`confirm:no`,()=>{ae(!1),ce(null),fe(!1)},{context:`Confirmation`,isActive:N}),_((e,t)=>{if(t.return&&j&&Ee(),t.return&&N)if(F)De();else{let e=`${Lt().CLAUDE_AI_ORIGIN}/settings/connectors`;ce(e),fe(!0),Yt(e)}if(e===`c`&&!L){let e=T||ie||se;e&&h(e).then(e=>{_e.current||(e&&process.stdout.write(e),me(!0),ge.current!==void 0&&clearTimeout(ge.current),ge.current=setTimeout(me,2e3,!1))})}});let Oe=Bt(String(e.name)),ke=le(te.commands,e.name).length,Ae=hn(),Me=B.useCallback(async()=>{let t=Lt().CLAUDE_AI_ORIGIN,n=Ht()?.organizationUuid,r;r=n&&e.config.type===`claudeai-proxy`&&e.config.id?`${t}/api/organizations/${n}/mcp/start-auth/${e.config.id.startsWith(`mcprs`)?`mcpsrv`+e.config.id.slice(5):e.config.id}?product_surface=${encodeURIComponent(process.env.CLAUDE_CODE_ENTRYPOINT||`cli`)}`:`${t}/settings/connectors`,M(r),re(!0),Pt(`tengu_claudeai_mcp_auth_started`,{}),await Yt(r)},[e.config]),Pe=B.useCallback(()=>{ae(!0),Pt(`tengu_claudeai_mcp_clear_auth_started`,{})},[]),Fe=B.useCallback(async()=>{let t=e.client.type!==`disabled`;try{await Ae(e.name),e.config.type===`claudeai-proxy`&&Pt(`tengu_claudeai_mcp_toggle`,{new_state:t?`disabled`:`enabled`}),r()}catch(n){i?.(`Failed to ${t?`disable`:`enable`} MCP server '${e.name}': ${dt(n)}`)}},[e.client.type,e.config.type,e.name,Ae,r,i]),Ie=B.useCallback(async()=>{if(e.config.type===`claudeai-proxy`)return;b(!0),C(null);let t=new AbortController;A.current=t;try{if(e.isAuthenticated&&e.config&&await Ve(e.name,e.config,{preserveStepUpState:!0}),e.config){await je(e.name,e.config,E,t.signal,{onWaitingForCallback:e=>{Ce(()=>e)}}),Pt(`tengu_mcp_auth_config_authenticate`,{wasAuthenticated:e.isAuthenticated});let n=await Te(e.name);if(n.client.type===`connected`){let t=we?`Authentication successful. Reconnected to ${e.name}.`:`Authentication successful. Connected to ${e.name}.`;i?.(t)}else n.client.type===`needs-auth`?i?.(`Authentication successful, but server still requires authentication. You may need to manually restart Claude Code.`):(At(e.name,`Reconnection failed after authentication`),i?.(`Authentication successful, but server reconnection failed. You may need to manually restart Claude Code for the changes to take effect.`))}}catch(e){e instanceof Error&&!(e instanceof ue)&&C(e.message)}finally{b(!1),A.current=null,Ce(null),ye(``)}},[e.isAuthenticated,e.config,e.name,i,Te,we]),Le=async()=>{e.config.type!==`claudeai-proxy`&&e.config&&(await Ve(e.name,e.config),Pt(`tengu_mcp_auth_config_clear`,{}),await Ne(e.name,{...e.config,scope:e.scope}),w(t=>{let n=t.mcp.clients.map(t=>t.name===e.name?{...t,type:`failed`}:t),r=k(t.mcp.tools,e.name),i=O(t.mcp.commands,e.name),a=ot(t.mcp.resources,e.name);return{...t,mcp:{...t.mcp,clients:n,tools:r,commands:i,resources:a}}}),i?.(`Authentication cleared for ${e.name}.`))};if(y){let t=e.config.type!==`claudeai-proxy`&&e.config.oauth?.xaa?` Authenticating via your identity provider`:` A browser window will open for authentication`;return(0,V.jsxs)(u,{flexDirection:`column`,gap:1,padding:1,children:[(0,V.jsxs)(f,{color:`claude`,children:[`Authenticating with `,e.name,`…`]}),(0,V.jsxs)(u,{children:[(0,V.jsx)(P,{}),(0,V.jsx)(f,{children:t})]}),T&&(0,V.jsxs)(u,{flexDirection:`column`,children:[(0,V.jsxs)(u,{children:[(0,V.jsx)(f,{dimColor:!0,children:`If your browser doesn't open automatically, copy this URL manually `}),L?(0,V.jsx)(f,{color:`success`,children:`(Copied!)`}):(0,V.jsx)(f,{dimColor:!0,children:(0,V.jsx)(o,{shortcut:`c`,action:`copy`,parens:!0})})]}),(0,V.jsx)(d,{url:T})]}),y&&T&&R&&(0,V.jsxs)(u,{flexDirection:`column`,marginTop:1,children:[(0,V.jsx)(f,{dimColor:!0,children:`If the redirect page shows a connection error, paste the URL from your browser's address bar:`}),(0,V.jsxs)(u,{children:[(0,V.jsxs)(f,{dimColor:!0,children:[`URL `,`>`,` `]}),(0,V.jsx)(de,{value:ve,onChange:ye,onSubmit:e=>{R(e.trim()),ye(``)},cursorOffset:xe,onChangeCursorOffset:Se,columns:g-8})]})]}),(0,V.jsx)(u,{marginLeft:3,children:(0,V.jsx)(f,{dimColor:!0,children:`Return here after authenticating in your browser. Press Esc to go back.`})})]})}if(j)return(0,V.jsxs)(u,{flexDirection:`column`,gap:1,padding:1,children:[(0,V.jsxs)(f,{color:`claude`,children:[`Authenticating with `,e.name,`…`]}),(0,V.jsxs)(u,{children:[(0,V.jsx)(P,{}),(0,V.jsx)(f,{children:` A browser window will open for authentication`})]}),ie&&(0,V.jsxs)(u,{flexDirection:`column`,children:[(0,V.jsxs)(u,{children:[(0,V.jsx)(f,{dimColor:!0,children:`If your browser doesn't open automatically, copy this URL manually `}),L?(0,V.jsx)(f,{color:`success`,children:`(Copied!)`}):(0,V.jsx)(f,{dimColor:!0,children:(0,V.jsx)(o,{shortcut:`c`,action:`copy`,parens:!0})})]}),(0,V.jsx)(d,{url:ie})]}),(0,V.jsxs)(u,{marginLeft:3,flexDirection:`column`,children:[(0,V.jsxs)(f,{color:`permission`,children:[`Press `,(0,V.jsx)(f,{bold:!0,children:`Enter`}),` after authenticating in your browser.`]}),(0,V.jsx)(f,{dimColor:!0,italic:!0,children:(0,V.jsx)(I,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})})]})]});if(N)return(0,V.jsxs)(u,{flexDirection:`column`,gap:1,padding:1,children:[(0,V.jsxs)(f,{color:`claude`,children:[`Clear authentication for `,e.name]}),F?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(f,{children:`Find the MCP server in the browser and click "Disconnect".`}),se&&(0,V.jsxs)(u,{flexDirection:`column`,children:[(0,V.jsxs)(u,{children:[(0,V.jsx)(f,{dimColor:!0,children:`If your browser didn't open automatically, copy this URL manually `}),L?(0,V.jsx)(f,{color:`success`,children:`(Copied!)`}):(0,V.jsx)(f,{dimColor:!0,children:(0,V.jsx)(o,{shortcut:`c`,action:`copy`,parens:!0})})]}),(0,V.jsx)(d,{url:se})]}),(0,V.jsxs)(u,{marginLeft:3,flexDirection:`column`,children:[(0,V.jsxs)(f,{color:`permission`,children:[`Press `,(0,V.jsx)(f,{bold:!0,children:`Enter`}),` when done.`]}),(0,V.jsx)(f,{dimColor:!0,italic:!0,children:(0,V.jsx)(I,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})})]})]}):(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(f,{children:`This will open claude.ai in the browser. Find the MCP server in the list and click "Disconnect".`}),(0,V.jsxs)(u,{marginLeft:3,flexDirection:`column`,children:[(0,V.jsxs)(f,{color:`permission`,children:[`Press `,(0,V.jsx)(f,{bold:!0,children:`Enter`}),` to open the browser.`]}),(0,V.jsx)(f,{dimColor:!0,italic:!0,children:(0,V.jsx)(I,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})})]})]})]});if(ne)return(0,V.jsxs)(u,{flexDirection:`column`,gap:1,padding:1,children:[(0,V.jsxs)(f,{color:`text`,children:[`Connecting to `,(0,V.jsx)(f,{bold:!0,children:e.name}),`…`]}),(0,V.jsxs)(u,{children:[(0,V.jsx)(P,{}),(0,V.jsx)(f,{children:` Establishing connection to MCP server`})]}),(0,V.jsx)(f,{dimColor:!0,children:`This may take a few moments.`})]});let z=[];return e.client.type===`disabled`&&z.push({label:`Enable`,value:`toggle-enabled`}),e.client.type===`connected`&&t>0&&z.push({label:`View tools`,value:`tools`}),e.config.type===`claudeai-proxy`?e.client.type===`connected`?z.push({label:`Clear authentication`,value:`claudeai-clear-auth`}):e.client.type!==`disabled`&&z.push({label:`Authenticate`,value:`claudeai-auth`}):(we&&(z.push({label:`Re-authenticate`,value:`reauth`}),z.push({label:`Clear authentication`,value:`clear-auth`})),we||z.push({label:`Authenticate`,value:`auth`})),e.client.type!==`disabled`&&(e.client.type!==`needs-auth`&&z.push({label:`Reconnect`,value:`reconnectMcpServer`}),z.push({label:`Disable`,value:`toggle-enabled`})),z.length===0&&z.push({label:`Back`,value:`back`}),(0,V.jsxs)(u,{flexDirection:`column`,children:[(0,V.jsxs)(u,{flexDirection:`column`,paddingX:1,borderStyle:s?void 0:`round`,children:[(0,V.jsx)(u,{marginBottom:1,children:(0,V.jsxs)(f,{bold:!0,children:[Oe,` MCP Server`]})}),(0,V.jsxs)(u,{flexDirection:`column`,gap:0,children:[(0,V.jsxs)(u,{children:[(0,V.jsx)(f,{bold:!0,children:`Status: `}),e.client.type===`disabled`?(0,V.jsxs)(f,{children:[v(`inactive`,c)(a.radioOff),` disabled`]}):e.client.type===`connected`?(0,V.jsxs)(f,{children:[v(`success`,c)(a.tick),` connected`]}):e.client.type===`pending`?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(f,{dimColor:!0,children:a.radioOff}),(0,V.jsx)(f,{children:` connecting…`})]}):e.client.type===`needs-auth`?(0,V.jsxs)(f,{children:[v(`warning`,c)(a.triangleUpOutline),` needs authentication`]}):(0,V.jsxs)(f,{children:[v(`error`,c)(a.cross),` failed`]})]}),e.transport!==`claudeai-proxy`&&(0,V.jsxs)(u,{children:[(0,V.jsx)(f,{bold:!0,children:`Auth: `}),we?(0,V.jsxs)(f,{children:[v(`success`,c)(a.tick),` authenticated`]}):(0,V.jsxs)(f,{children:[v(`error`,c)(a.cross),` not authenticated`]})]}),(0,V.jsxs)(u,{children:[(0,V.jsx)(f,{bold:!0,children:`URL: `}),(0,V.jsx)(f,{dimColor:!0,children:e.config.url})]}),(0,V.jsxs)(u,{children:[(0,V.jsx)(f,{bold:!0,children:`Config location: `}),(0,V.jsx)(f,{dimColor:!0,children:be(e.scope)})]}),e.client.type===`connected`&&(0,V.jsx)(Dn,{serverToolsCount:t,serverPromptsCount:ke,serverResourcesCount:te.resources[e.name]?.length||0}),e.client.type===`connected`&&t>0&&(0,V.jsxs)(u,{children:[(0,V.jsx)(f,{bold:!0,children:`Tools: `}),(0,V.jsxs)(f,{dimColor:!0,children:[t,` tools`]})]})]}),S&&(0,V.jsx)(u,{marginTop:1,children:(0,V.jsxs)(f,{color:`error`,children:[`Error: `,S]})}),z.length>0&&(0,V.jsx)(u,{marginTop:1,children:(0,V.jsx)(he,{options:z,onChange:async t=>{switch(t){case`tools`:n();break;case`auth`:case`reauth`:await Ie();break;case`clear-auth`:await Le();break;case`claudeai-auth`:await Me();break;case`claudeai-clear-auth`:Pe();break;case`reconnectMcpServer`:D(!0);try{let t=await Te(e.name);e.config.type===`claudeai-proxy`&&Pt(`tengu_claudeai_mcp_reconnect`,{success:t.client.type===`connected`});let{message:n}=An(t,e.name);i?.(n)}catch(t){e.config.type===`claudeai-proxy`&&Pt(`tengu_claudeai_mcp_reconnect`,{success:!1}),i?.(jn(t,e.name))}finally{D(!1)}break;case`toggle-enabled`:await Fe();break;case`back`:r();break}},onCancel:r})})]}),(0,V.jsx)(u,{marginTop:1,children:(0,V.jsx)(f,{dimColor:!0,italic:!0,children:m.pending?(0,V.jsxs)(V.Fragment,{children:[`Press `,m.keyName,` again to exit`]}):(0,V.jsxs)(p,{children:[(0,V.jsx)(o,{shortcut:`↑↓`,action:`navigate`}),(0,V.jsx)(o,{shortcut:`Enter`,action:`select`}),(0,V.jsx)(I,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]})})})]})}var B,V,Pn=e((()=>{i(),B=t(g(),1),Nt(),Rt(),yn(),Ie(),C(),Jt(),Xe(),Se(),gn(),se(),qe(),Ut(),Xt(),gt(),jt(),Vt(),j(),ke(),ct(),lt(),kn(),Mn(),V=T()}));function Fn({server:e,serverToolsCount:t,onViewTools:n,onCancel:r,onComplete:i,borderless:s=!1}){let[c]=l(),d=vn(),ee=oe(e=>e.mcp),m=_n(),h=hn(),[g,_]=(0,In.useState)(!1),y=In.useCallback(async()=>{let t=e.client.type!==`disabled`;try{await h(e.name),r()}catch(n){i(`Failed to ${t?`disable`:`enable`} MCP server '${e.name}': ${dt(n)}`)}},[e.client.type,e.name,h,r,i]),b=Bt(String(e.name)),x=le(ee.commands,e.name).length,S=[];return e.client.type!==`disabled`&&t>0&&S.push({label:`View tools`,value:`tools`}),e.client.type!==`disabled`&&S.push({label:`Reconnect`,value:`reconnectMcpServer`}),S.push({label:e.client.type===`disabled`?`Enable`:`Disable`,value:`toggle-enabled`}),S.length===0&&S.push({label:`Back`,value:`back`}),g?(0,H.jsxs)(u,{flexDirection:`column`,gap:1,padding:1,children:[(0,H.jsxs)(f,{color:`text`,children:[`Reconnecting to `,(0,H.jsx)(f,{bold:!0,children:e.name})]}),(0,H.jsxs)(u,{children:[(0,H.jsx)(P,{}),(0,H.jsx)(f,{children:` Restarting MCP server process`})]}),(0,H.jsx)(f,{dimColor:!0,children:`This may take a few moments.`})]}):(0,H.jsxs)(u,{flexDirection:`column`,children:[(0,H.jsxs)(u,{flexDirection:`column`,paddingX:1,borderStyle:s?void 0:`round`,children:[(0,H.jsx)(u,{marginBottom:1,children:(0,H.jsxs)(f,{bold:!0,children:[b,` MCP Server`]})}),(0,H.jsxs)(u,{flexDirection:`column`,gap:0,children:[(0,H.jsxs)(u,{children:[(0,H.jsx)(f,{bold:!0,children:`Status: `}),e.client.type===`disabled`?(0,H.jsxs)(f,{children:[v(`inactive`,c)(a.radioOff),` disabled`]}):e.client.type===`connected`?(0,H.jsxs)(f,{children:[v(`success`,c)(a.tick),` connected`]}):e.client.type===`pending`?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(f,{dimColor:!0,children:a.radioOff}),(0,H.jsx)(f,{children:` connecting…`})]}):(0,H.jsxs)(f,{children:[v(`error`,c)(a.cross),` failed`]})]}),(0,H.jsxs)(u,{children:[(0,H.jsx)(f,{bold:!0,children:`Command: `}),(0,H.jsx)(f,{dimColor:!0,children:e.config.command})]}),e.config.args&&e.config.args.length>0&&(0,H.jsxs)(u,{children:[(0,H.jsx)(f,{bold:!0,children:`Args: `}),(0,H.jsx)(f,{dimColor:!0,children:e.config.args.join(` `)})]}),(0,H.jsxs)(u,{children:[(0,H.jsx)(f,{bold:!0,children:`Config location: `}),(0,H.jsx)(f,{dimColor:!0,children:be(N(e.name)?.scope??`dynamic`)})]}),e.client.type===`connected`&&(0,H.jsx)(Dn,{serverToolsCount:t,serverPromptsCount:x,serverResourcesCount:ee.resources[e.name]?.length||0}),e.client.type===`connected`&&t>0&&(0,H.jsxs)(u,{children:[(0,H.jsx)(f,{bold:!0,children:`Tools: `}),(0,H.jsxs)(f,{dimColor:!0,children:[t,` tools`]})]})]}),S.length>0&&(0,H.jsx)(u,{marginTop:1,children:(0,H.jsx)(he,{options:S,onChange:async t=>{if(t===`tools`)n();else if(t===`reconnectMcpServer`){_(!0);try{let{message:t}=An(await m(e.name),e.name);i?.(t)}catch(t){i?.(jn(t,e.name))}finally{_(!1)}}else t===`toggle-enabled`?await y():t===`back`&&r()},onCancel:r})})]}),(0,H.jsx)(u,{marginTop:1,children:(0,H.jsx)(f,{dimColor:!0,italic:!0,children:d.pending?(0,H.jsxs)(H.Fragment,{children:[`Press `,d.keyName,` again to exit`]}):(0,H.jsxs)(p,{children:[(0,H.jsx)(o,{shortcut:`↑↓`,action:`navigate`}),(0,H.jsx)(o,{shortcut:`Enter`,action:`select`}),(0,H.jsx)(I,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]})})})]})}var In,H,Ln=e((()=>{i(),In=t(g(),1),yn(),C(),ie(),gn(),se(),qe(),gt(),Vt(),j(),ke(),ct(),kn(),Mn(),H=T()}));function Rn({tool:e,server:t,onBack:n}){let[r,i]=zn.useState(``),a=bt(e.name,t.name),o=Et(e.userFacingName?e.userFacingName({}):a),s=e.isReadOnly?.({})??!1,c=e.isDestructive?.({})??!1,l=e.isOpenWorld?.({})??!1;return zn.useEffect(()=>{async function t(){try{let t=await e.description({},{isNonInteractiveSession:!1,toolPermissionContext:{mode:`default`,additionalWorkingDirectories:new Map,alwaysAllowRules:{},alwaysDenyRules:{},alwaysAskRules:{},isBypassPermissionsModeAvailable:!1},tools:[]});i(t)}catch{i(`Failed to load description`)}}t()},[e]),(0,U.jsx)(w,{title:(0,U.jsxs)(U.Fragment,{children:[o,s&&(0,U.jsx)(f,{color:`success`,children:` [read-only]`}),c&&(0,U.jsx)(f,{color:`error`,children:` [destructive]`}),l&&(0,U.jsx)(f,{dimColor:!0,children:` [open-world]`})]}),subtitle:t.name,onCancel:n,inputGuide:e=>e.pending?(0,U.jsxs)(f,{children:[`Press `,e.keyName,` again to exit`]}):(0,U.jsx)(I,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`}),children:(0,U.jsxs)(u,{flexDirection:`column`,children:[(0,U.jsxs)(u,{children:[(0,U.jsx)(f,{bold:!0,children:`Tool name: `}),(0,U.jsx)(f,{dimColor:!0,children:a})]}),(0,U.jsxs)(u,{children:[(0,U.jsx)(f,{bold:!0,children:`Full name: `}),(0,U.jsx)(f,{dimColor:!0,children:e.name})]}),r&&(0,U.jsxs)(u,{flexDirection:`column`,marginTop:1,children:[(0,U.jsx)(f,{bold:!0,children:`Description:`}),(0,U.jsx)(f,{wrap:`wrap`,children:r})]}),e.inputJSONSchema&&e.inputJSONSchema.properties&&Object.keys(e.inputJSONSchema.properties).length>0&&(0,U.jsxs)(u,{flexDirection:`column`,marginTop:1,children:[(0,U.jsx)(f,{bold:!0,children:`Parameters:`}),(0,U.jsx)(u,{marginLeft:2,flexDirection:`column`,children:Object.entries(e.inputJSONSchema.properties).map(([t,n])=>{let r=(e.inputJSONSchema?.required)?.includes(t);return(0,U.jsxs)(f,{children:[`• `,t,r&&(0,U.jsx)(f,{dimColor:!0,children:` (required)`}),`:`,` `,(0,U.jsx)(f,{dimColor:!0,children:typeof n==`object`&&n&&`type`in n?String(n.type):`unknown`}),typeof n==`object`&&n&&`description`in n&&(0,U.jsxs)(f,{dimColor:!0,children:[` - `,String(n.description)]})]},t)})})]})]})})}var zn,U,Bn=e((()=>{zn=t(g(),1),C(),St(),j(),U=T()}));function Vn({server:e,onSelectTool:t,onBack:n}){let r=oe(e=>e.mcp.tools),i=Hn.useMemo(()=>e.client.type===`connected`?Pe(r,e.name):[],[e,r]),a=i.map((t,n)=>{let r=bt(t.name,e.name),i=Et(t.userFacingName?t.userFacingName({}):r),a=t.isReadOnly?.({})??!1,o=t.isDestructive?.({})??!1,s=t.isOpenWorld?.({})??!1,c=[];return a&&c.push(`read-only`),o&&c.push(`destructive`),s&&c.push(`open-world`),{label:i,value:n.toString(),description:c.length>0?c.join(`, `):void 0,descriptionColor:o?`error`:a?`success`:void 0}});return(0,Un.jsx)(w,{title:`Tools for ${e.name}`,subtitle:`${i.length} ${zt(i.length,`tool`)}`,onCancel:n,inputGuide:e=>e.pending?(0,Un.jsxs)(f,{children:[`Press `,e.keyName,` again to exit`]}):(0,Un.jsxs)(p,{children:[(0,Un.jsx)(o,{shortcut:`↑↓`,action:`navigate`}),(0,Un.jsx)(o,{shortcut:`Enter`,action:`select`}),(0,Un.jsx)(I,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]}),children:i.length===0?(0,Un.jsx)(f,{dimColor:!0,children:`No tools available`}):(0,Un.jsx)(he,{options:a,onChange:e=>{let n=parseInt(e,10),r=i[n];r&&t(r,n)},onCancel:n})})}var Hn,Un,Wn=e((()=>{Hn=t(g(),1),C(),St(),se(),qe(),Vt(),j(),ke(),Un=T()}));function Gn({inputValue:e,setInputValue:t,cursorOffset:n,setCursorOffset:r,error:i,setError:a,result:s,setResult:c,setViewState:l,onAddComplete:d,cliMode:ee=!1}){let m=(0,Kn.useRef)(!1),[h,g]=(0,Kn.useState)(!1),[_,v]=(0,Kn.useState)(``),y=async()=>{let t=e.trim();if(!t){a(`Please enter a marketplace source`);return}let n=await cn(t);if(!n){a(`Invalid marketplace source format. Try: owner/repo, https://..., or ./path`);return}if(`error`in n){a(n.error);return}a(null);try{g(!0),v(``);let{name:e,resolvedSource:t}=await re(n,e=>{v(e)});me(e,{source:t}),z();let r=n.source;n.source===`github`&&(r=n.repo),Pt(`tengu_marketplace_added`,{source_type:r}),d&&await d(),v(``),g(!1),ee?c(`Successfully added marketplace: ${e}`):l({type:`browse-marketplace`,targetMarketplace:e})}catch(e){let t=pt(e);Mt(t),a(t.message),v(``),g(!1),c(ee?`Error: ${t.message}`:null)}};return(0,Kn.useEffect)(()=>{e&&!m.current&&!i&&!s&&(m.current=!0,y())},[]),(0,W.jsxs)(u,{flexDirection:`column`,children:[(0,W.jsxs)(u,{flexDirection:`column`,paddingX:1,borderStyle:`round`,children:[(0,W.jsx)(u,{marginBottom:1,children:(0,W.jsx)(f,{bold:!0,children:`Add Marketplace`})}),(0,W.jsxs)(u,{flexDirection:`column`,children:[(0,W.jsx)(f,{children:`Enter marketplace source:`}),(0,W.jsx)(f,{dimColor:!0,children:`Examples:`}),(0,W.jsx)(f,{dimColor:!0,children:` · owner/repo (GitHub)`}),(0,W.jsx)(f,{dimColor:!0,children:` · git@github.com:owner/repo.git (SSH)`}),(0,W.jsx)(f,{dimColor:!0,children:` · https://example.com/marketplace.json`}),(0,W.jsx)(f,{dimColor:!0,children:` · ./path/to/marketplace`}),(0,W.jsx)(u,{marginTop:1,children:(0,W.jsx)(de,{value:e,onChange:t,onSubmit:y,columns:80,cursorOffset:n,onChangeCursorOffset:r,focus:!0,showCursor:!0})})]}),h&&(0,W.jsxs)(u,{marginTop:1,children:[(0,W.jsx)(P,{}),(0,W.jsx)(f,{children:_||`Adding marketplace to configuration…`})]}),i&&(0,W.jsx)(u,{marginTop:1,children:(0,W.jsx)(f,{color:`error`,children:i})}),s&&(0,W.jsx)(u,{marginTop:1,children:(0,W.jsx)(f,{children:s})})]}),(0,W.jsx)(u,{marginLeft:3,children:(0,W.jsx)(f,{dimColor:!0,italic:!0,children:(0,W.jsxs)(p,{children:[(0,W.jsx)(o,{shortcut:`Enter`,action:`add`}),(0,W.jsx)(I,{action:`confirm:no`,context:`Settings`,fallback:`Esc`,description:`cancel`})]})})})]})}var Kn,W,qn=e((()=>{g(),Kn=t(g(),1),Nt(),j(),C(),ct(),lt(),gt(),jt(),rt(),fe(),un(),W=T()}));function Jn(e,t,r,i){let a={};for(let o of e){let e=r[o],s=t[o]??``;if(!(e?.sensitive===!0&&s===``&&i?.[o]!==void 0))if(e?.type===`number`){if(s.trim()===``)continue;let e=Number(s);a[o]=Number.isNaN(e)?s:e}else e?.type===`boolean`?a[o]=n(s):a[o]=s}return a}function Yn({title:e,subtitle:t,configSchema:n,initialValues:r,onSave:i,onCancel:o}){let l=Object.keys(n),d=(0,Xn.useCallback)(e=>{if(n[e]?.sensitive===!0)return``;let t=r?.[e];return t===void 0?``:String(t)},[n,r]),[p,m]=(0,Xn.useState)(0),[h,g]=(0,Xn.useState)({}),[v,y]=(0,Xn.useState)(()=>l[0]?d(l[0]):``),b=l[p],x=b?n[b]:null;if(ee(`confirm:no`,o,{context:`Settings`}),c({"confirm:nextField":(0,Xn.useCallback)(()=>{if(p<l.length-1&&b){g(e=>({...e,[b]:v})),m(e=>e+1);let e=l[p+1];y(e?d(e):``)}},[p,l,b,v,d]),"confirm:yes":(0,Xn.useCallback)(()=>{if(!b)return;let e={...h,[b]:v};if(p===l.length-1)i(Jn(l,e,n,r));else{g(e),m(e=>e+1);let t=l[p+1];y(t?d(t):``)}},[b,h,v,p,l,n,i,d,r])},{context:`Confirmation`}),_((e,t)=>{if(t.backspace||t.delete){y(e=>e.slice(0,-1));return}e&&!t.ctrl&&!t.meta&&!t.tab&&!t.return&&y(t=>t+e)}),!x||!b)return null;let S=x.sensitive===!0,C=x.required===!0,te=S?`*`.repeat(s(v)):v;return(0,Zn.jsxs)(w,{title:e,subtitle:t,onCancel:o,isCancelActive:!1,children:[(0,Zn.jsxs)(u,{flexDirection:`column`,children:[(0,Zn.jsxs)(f,{bold:!0,children:[x.title||b,C&&(0,Zn.jsx)(f,{color:`error`,children:` *`})]}),x.description&&(0,Zn.jsx)(f,{dimColor:!0,children:x.description}),(0,Zn.jsxs)(u,{marginTop:1,children:[(0,Zn.jsxs)(f,{children:[a.pointerSmall,` `]}),(0,Zn.jsx)(f,{children:te}),(0,Zn.jsx)(f,{children:`█`})]})]}),(0,Zn.jsxs)(u,{flexDirection:`column`,children:[(0,Zn.jsxs)(f,{dimColor:!0,children:[`Field `,p+1,` of `,l.length]}),p<l.length-1&&(0,Zn.jsx)(f,{dimColor:!0,children:`Tab: Next field · Enter: Save and continue`}),p===l.length-1&&(0,Zn.jsx)(f,{dimColor:!0,children:`Enter: Save configuration`})]})]})}var Xn,Zn,Qn=e((()=>{i(),Xn=t(g(),1),C(),Jt(),r(),Zn=T()}));async function $n(e){let{enabled:t,disabled:n}=await Ge();return[...t,...n].find(t=>t.repository===e||t.source===e)}function er({plugin:e,pluginId:t,onDone:n}){let[r]=tr.useState(()=>{let n=[],r=ye(e);Object.keys(r).length>0&&n.push({key:`top-level`,title:`Configure ${e.name}`,subtitle:`Plugin options`,schema:r,load:()=>$e(t),save:n=>xe(t,n,e.manifest.userConfig)});let i=tt(e);for(let r of i)n.push({key:`channel:${r.server}`,title:`Configure ${r.displayName}`,subtitle:`Plugin: ${e.name}`,schema:r.configSchema,load:()=>R(t,r.server)??void 0,save:e=>Ke(t,r.server,e,r.configSchema)});return n}),[i,a]=tr.useState(0),o=tr.useRef(n);if(o.current=n,tr.useEffect(()=>{r.length===0&&o.current(`skipped`)},[r.length]),r.length===0)return null;let s=r[i];function c(e){try{s.save(e)}catch(e){n(`error`,dt(e));return}let t=i+1;t<r.length?a(t):n(`configured`)}return(0,nr.jsx)(Yn,{title:s.title,subtitle:s.subtitle,configSchema:s.schema,initialValues:s.load(),onSave:c,onCancel:()=>n(`skipped`)},s.key)}var tr,nr,rr=e((()=>{tr=t(g(),1),gt(),Re(),Be(),Ee(),Ue(),Qn(),nr=T()}));function ir(){let e=Me();return(0,ar.jsxs)(u,{marginBottom:1,children:[(0,ar.jsxs)(f,{color:`claude`,children:[a.warning,` `]}),(0,ar.jsxs)(f,{dimColor:!0,italic:!0,children:[`Make sure you trust a plugin before installing, updating, or using it. Anthropic does not control what MCP servers, files, or other software are included in plugins and cannot verify that they will work as intended or that they won't change. See each plugin's homepage for more information.`,e?` ${e}`:``]})]})}var ar,or=e((()=>{i(),g(),C(),_e(),ar=T()}));function sr(e){return e.entry.source&&typeof e.entry.source==`object`&&`source`in e.entry.source&&e.entry.source.source===`github`&&typeof e.entry.source==`object`&&`repo`in e.entry.source?e.entry.source.repo:null}function cr(e,t){let n=[{label:`Install for you (user scope)`,action:`install-user`},{label:`Install for all collaborators on this repository (project scope)`,action:`install-project`},{label:`Install for you, in this repo only (local scope)`,action:`install-local`}];return e&&n.push({label:`Open homepage`,action:`homepage`}),t&&n.push({label:`View on GitHub`,action:`github`}),n.push({label:`Back to plugin list`,action:`back`}),n}function lr({hasSelection:e}){return(0,ur.jsx)(u,{marginTop:1,children:(0,ur.jsx)(f,{dimColor:!0,italic:!0,children:(0,ur.jsxs)(p,{children:[e&&(0,ur.jsx)(I,{action:`plugin:install`,context:`Plugin`,fallback:`i`,description:`install`,bold:!0}),(0,ur.jsx)(I,{action:`plugin:toggle`,context:`Plugin`,fallback:`Space`,description:`toggle`}),(0,ur.jsx)(I,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`details`}),(0,ur.jsx)(I,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]})})})}var ur,dr=e((()=>{g(),j(),C(),ur=T()}));function fr({totalItems:e,maxVisible:t=mr,selectedIndex:n=0}){let r=e>t,i=(0,pr.useRef)(0),a=(0,pr.useMemo)(()=>{if(!r)return 0;let a=i.current;if(n<a)return i.current=n,n;if(n>=a+t){let e=n-t+1;return i.current=e,e}let o=Math.max(0,e-t),s=Math.min(a,o);return i.current=s,s},[n,t,r,e]),o=a,s=Math.min(a+t,e),c=(0,pr.useCallback)(e=>r?e.slice(o,s):e,[r,o,s]),l=(0,pr.useCallback)(e=>o+e,[o]),u=(0,pr.useCallback)(e=>e>=o&&e<s,[o,s]),d=(0,pr.useCallback)(e=>{},[]),f=(0,pr.useCallback)(()=>{},[]),p=(0,pr.useCallback)(()=>{},[]),ee=(0,pr.useCallback)((t,n)=>{n(Math.max(0,Math.min(t,e-1)))},[e]),m=(0,pr.useCallback)((e,t)=>!1,[]),h=Math.max(1,Math.ceil(e/t));return{currentPage:Math.floor(a/t),totalPages:h,startIndex:o,endIndex:s,needsPagination:r,pageSize:t,getVisibleItems:c,toActualIndex:l,isOnCurrentPage:u,goToPage:d,nextPage:f,prevPage:p,handleSelectionChange:ee,handlePageNavigation:m,scrollPosition:{current:n+1,total:e,canScrollUp:a>0,canScrollDown:a+t<e}}}var pr,mr,hr=e((()=>{pr=t(g(),1),mr=5}));function gr({error:e,setError:t,result:n,setResult:r,setViewState:i,onInstallComplete:o,targetMarketplace:s,targetPlugin:l}){let[d,m]=(0,vr.useState)(`marketplace-list`),[h,g]=(0,vr.useState)(null),[_,v]=(0,vr.useState)(null),[y,b]=(0,vr.useState)([]),[x,S]=(0,vr.useState)([]),[C,te]=(0,vr.useState)(!0),[w,T]=(0,vr.useState)(null),[E,O]=(0,vr.useState)(0),[k,A]=(0,vr.useState)(new Set),[j,re]=(0,vr.useState)(new Set),ie=fr({totalItems:x.length,selectedIndex:E}),[M,N]=(0,vr.useState)(0),[oe,P]=(0,vr.useState)(!1),[se,ce]=(0,vr.useState)(null),[le,ue]=(0,vr.useState)(null);ee(`confirm:no`,_r.useCallback(()=>{d===`plugin-list`?s?i({type:`manage-marketplaces`,targetMarketplace:s}):y.length===1?i({type:`menu`}):(m(`marketplace-list`),g(null),A(new Set)):d===`plugin-details`?(m(`plugin-list`),v(null)):i({type:`menu`})},[d,s,i,y.length]),{context:`Confirmation`}),(0,vr.useEffect)(()=>{async function e(){try{let e=await ae(),{marketplaces:n,failures:r}=await Qe(e),i=[];for(let{name:e,config:t,data:r}of n)if(r){let n=Tt(r.plugins,t=>D(ne(t.name,e)));i.push({name:e,totalPlugins:r.plugins.length,installedCount:n,source:Ze(t.source)})}i.sort((e,t)=>e.name===`claude-plugin-directory`?-1:+(t.name===`claude-plugin-directory`)),b(i);let a=ze(r,Tt(n,e=>e.data!==null));if(a)if(a.type===`warning`)ue(a.message+`. Showing available marketplaces.`);else throw Error(a.message);if(i.length===1&&!s&&!l){let e=i[0];e&&(g(e.name),m(`plugin-list`))}if(l){let n=null,r=null;for(let[t]of Object.entries(e)){let e=await F(t);if(e){let i=e.plugins.find(e=>e.name===l);if(i){let e=ne(i.name,t);n={entry:i,marketplaceName:t,pluginId:e,isInstalled:Fe(e)},r=t;break}}}if(n&&r){let e=n.pluginId;Fe(e)?t(`Plugin '${e}' is already installed globally. Use '/plugin' to manage existing plugins.`):(g(r),v(n),m(`plugin-details`))}else t(`Plugin "${l}" not found in any marketplace`)}else s&&(i.some(e=>e.name===s)?(g(s),m(`plugin-list`)):t(`Marketplace "${s}" not found`))}catch(e){t(e instanceof Error?e.message:`Failed to load marketplaces`)}finally{te(!1)}}e()},[t,s,l]),(0,vr.useEffect)(()=>{if(!h)return;let e=!1;async function n(n){te(!0);try{let t=await F(n);if(e)return;if(!t)throw Error(`Failed to load marketplace: ${n}`);let r=[];for(let e of t.plugins){let t=ne(e.name,n);He(t)||r.push({entry:e,marketplaceName:n,pluginId:t,isInstalled:Fe(t)})}try{let t=await pn();if(e)return;T(t),t?r.sort((e,n)=>{let r=t.get(e.pluginId)??0,i=t.get(n.pluginId)??0;return r===i?e.entry.name.localeCompare(n.entry.name):i-r}):r.sort((e,t)=>e.entry.name.localeCompare(t.entry.name))}catch(t){if(e)return;ht(`Failed to fetch install counts: ${dt(t)}`),r.sort((e,t)=>e.entry.name.localeCompare(t.entry.name))}S(r),O(0),A(new Set)}catch(n){if(e)return;t(n instanceof Error?n.message:`Failed to load plugins`)}finally{te(!1)}}return n(h),()=>{e=!0}},[h,t]);let de=async()=>{if(k.size===0)return;let e=x.filter(e=>k.has(e.pluginId));re(new Set(e.map(e=>e.pluginId)));let n=0,a=0,s=[];for(let t of e){let e=await st({pluginId:t.pluginId,entry:t.entry,marketplaceName:t.marketplaceName,scope:`user`});e.success?n++:(a++,s.push({name:t.entry.name,reason:e.error}))}re(new Set),A(new Set),z(),a===0?r(`✓ Installed ${n} ${zt(n,`plugin`)}. Run /reload-plugins to activate.`):n===0?t(`Failed to install: ${et(s,!0)}`):r(`✓ Installed ${n} of ${n+a} plugins. Failed: ${et(s,!1)}. Run /reload-plugins to activate successfully installed plugins.`),n>0&&o&&await o(),i({type:`menu`})},fe=async(e,t=`user`)=>{P(!0),ce(null);let n=await st({pluginId:e.pluginId,entry:e.entry,marketplaceName:e.marketplaceName,scope:t});if(n.success){let t=await $n(e.pluginId);if(t){P(!1),m({type:`plugin-options`,plugin:t,pluginId:e.pluginId});return}r(n.message),o&&await o(),i({type:`menu`})}else P(!1),ce(n.error)};(0,vr.useEffect)(()=>{e&&r(e)},[e,r]),c({"select:previous":()=>{E>0&&O(E-1)},"select:next":()=>{E<y.length-1&&O(E+1)},"select:accept":()=>{let e=y[E];e&&(g(e.name),m(`plugin-list`))}},{context:`Select`,isActive:d===`marketplace-list`}),c({"select:previous":()=>{E>0&&ie.handleSelectionChange(E-1,O)},"select:next":()=>{E<x.length-1&&ie.handleSelectionChange(E+1,O)},"select:accept":()=>{if(E===x.length&&k.size>0)de();else if(E<x.length){let e=x[E];e&&(e.isInstalled?i({type:`manage-plugins`,targetPlugin:e.entry.name,targetMarketplace:e.marketplaceName}):(v(e),m(`plugin-details`),N(0),ce(null)))}}},{context:`Select`,isActive:d===`plugin-list`}),c({"plugin:toggle":()=>{if(E<x.length){let e=x[E];if(e&&!e.isInstalled){let t=new Set(k);t.has(e.pluginId)?t.delete(e.pluginId):t.add(e.pluginId),A(t)}}},"plugin:install":()=>{k.size>0&&de()}},{context:`Plugin`,isActive:d===`plugin-list`});let pe=_r.useMemo(()=>{if(!_)return[];let e=_.entry.homepage;return cr(e,sr(_))},[_]);if(c({"select:previous":()=>{M>0&&N(M-1)},"select:next":()=>{M<pe.length-1&&N(M+1)},"select:accept":()=>{if(!_)return;let e=pe[M]?.action,t=_.entry.homepage,n=sr(_);e===`install-user`?fe(_,`user`):e===`install-project`?fe(_,`project`):e===`install-local`?fe(_,`local`):e===`homepage`&&t?Yt(t):e===`github`&&n?Yt(`https://github.com/${n}`):e===`back`&&(m(`plugin-list`),v(null))}},{context:`Select`,isActive:d===`plugin-details`&&!!_}),typeof d==`object`&&d.type===`plugin-options`){let{plugin:e,pluginId:t}=d;function n(e){r(e),o&&o(),i({type:`menu`})}return(0,G.jsx)(er,{plugin:e,pluginId:t,onDone:(t,r)=>{switch(t){case`configured`:n(`✓ Installed and configured ${e.name}. Run /reload-plugins to apply.`);break;case`skipped`:n(`✓ Installed ${e.name}. Run /reload-plugins to apply.`);break;case`error`:n(`Installed but failed to save config: ${r}`);break}}})}if(C)return(0,G.jsx)(f,{children:`Loading…`});if(e)return(0,G.jsx)(f,{color:`error`,children:e});if(d===`marketplace-list`)return y.length===0?(0,G.jsxs)(u,{flexDirection:`column`,children:[(0,G.jsx)(u,{marginBottom:1,children:(0,G.jsx)(f,{bold:!0,children:`Select marketplace`})}),(0,G.jsx)(f,{children:`No marketplaces configured.`}),(0,G.jsxs)(f,{dimColor:!0,children:[`Add a marketplace first using `,`'Add marketplace'`,`.`]}),(0,G.jsx)(u,{marginTop:1,paddingLeft:1,children:(0,G.jsx)(f,{dimColor:!0,children:(0,G.jsx)(I,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`})})})]}):(0,G.jsxs)(u,{flexDirection:`column`,children:[(0,G.jsx)(u,{marginBottom:1,children:(0,G.jsx)(f,{bold:!0,children:`Select marketplace`})}),le&&(0,G.jsx)(u,{marginBottom:1,flexDirection:`column`,children:(0,G.jsxs)(f,{color:`warning`,children:[a.warning,` `,le]})}),y.map((e,t)=>(0,G.jsxs)(u,{flexDirection:`column`,marginBottom:+(t<y.length-1),children:[(0,G.jsx)(u,{children:(0,G.jsxs)(f,{color:E===t?`suggestion`:void 0,children:[E===t?a.pointer:` `,` `,e.name]})}),(0,G.jsx)(u,{marginLeft:2,children:(0,G.jsxs)(f,{dimColor:!0,children:[e.totalPlugins,` `,zt(e.totalPlugins,`plugin`),` available`,e.installedCount>0&&` · ${e.installedCount} already installed`,e.source&&` · ${e.source}`]})})]},e.name)),(0,G.jsx)(u,{marginTop:1,children:(0,G.jsx)(f,{dimColor:!0,italic:!0,children:(0,G.jsxs)(p,{children:[(0,G.jsx)(I,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`select`}),(0,G.jsx)(I,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`})]})})})]});if(d===`plugin-details`&&_){let e=_.entry.homepage,t=cr(e,sr(_));return(0,G.jsxs)(u,{flexDirection:`column`,children:[(0,G.jsx)(u,{marginBottom:1,children:(0,G.jsx)(f,{bold:!0,children:`Plugin Details`})}),(0,G.jsxs)(u,{flexDirection:`column`,marginBottom:1,children:[(0,G.jsx)(f,{bold:!0,children:_.entry.name}),_.entry.version&&(0,G.jsxs)(f,{dimColor:!0,children:[`Version: `,_.entry.version]}),_.entry.description&&(0,G.jsx)(u,{marginTop:1,children:(0,G.jsx)(f,{children:_.entry.description})}),_.entry.author&&(0,G.jsx)(u,{marginTop:1,children:(0,G.jsxs)(f,{dimColor:!0,children:[`By:`,` `,typeof _.entry.author==`string`?_.entry.author:_.entry.author.name]})})]}),(0,G.jsxs)(u,{flexDirection:`column`,marginBottom:1,children:[(0,G.jsx)(f,{bold:!0,children:`Will install:`}),_.entry.commands&&(0,G.jsxs)(f,{dimColor:!0,children:[`· Commands:`,` `,Array.isArray(_.entry.commands)?_.entry.commands.join(`, `):Object.keys(_.entry.commands).join(`, `)]}),_.entry.agents&&(0,G.jsxs)(f,{dimColor:!0,children:[`· Agents:`,` `,Array.isArray(_.entry.agents)?_.entry.agents.join(`, `):Object.keys(_.entry.agents).join(`, `)]}),_.entry.hooks&&(0,G.jsxs)(f,{dimColor:!0,children:[`· Hooks: `,Object.keys(_.entry.hooks).join(`, `)]}),_.entry.mcpServers&&(0,G.jsxs)(f,{dimColor:!0,children:[`· MCP Servers:`,` `,Array.isArray(_.entry.mcpServers)?_.entry.mcpServers.join(`, `):typeof _.entry.mcpServers==`object`?Object.keys(_.entry.mcpServers).join(`, `):`configured`]}),!_.entry.commands&&!_.entry.agents&&!_.entry.hooks&&!_.entry.mcpServers&&(0,G.jsx)(G.Fragment,{children:typeof _.entry.source==`object`&&`source`in _.entry.source&&(_.entry.source.source===`github`||_.entry.source.source===`url`||_.entry.source.source===`npm`||_.entry.source.source===`pip`)?(0,G.jsx)(f,{dimColor:!0,children:`· Component summary not available for remote plugin`}):(0,G.jsx)(f,{dimColor:!0,children:`· Components will be discovered at installation`})})]}),(0,G.jsx)(ir,{}),se&&(0,G.jsx)(u,{marginBottom:1,children:(0,G.jsxs)(f,{color:`error`,children:[`Error: `,se]})}),(0,G.jsx)(u,{flexDirection:`column`,children:t.map((e,t)=>(0,G.jsxs)(u,{children:[M===t&&(0,G.jsx)(f,{children:`> `}),M!==t&&(0,G.jsx)(f,{children:` `}),(0,G.jsx)(f,{bold:M===t,children:oe&&e.action===`install`?`Installing…`:e.label})]},e.action))}),(0,G.jsx)(u,{marginTop:1,paddingLeft:1,children:(0,G.jsx)(f,{dimColor:!0,children:(0,G.jsxs)(p,{children:[(0,G.jsx)(I,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`select`}),(0,G.jsx)(I,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]})})})]})}if(x.length===0)return(0,G.jsxs)(u,{flexDirection:`column`,children:[(0,G.jsx)(u,{marginBottom:1,children:(0,G.jsx)(f,{bold:!0,children:`Install plugins`})}),(0,G.jsx)(f,{dimColor:!0,children:`No new plugins available to install.`}),(0,G.jsx)(f,{dimColor:!0,children:`All plugins from this marketplace are already installed.`}),(0,G.jsx)(u,{marginLeft:3,children:(0,G.jsx)(f,{dimColor:!0,italic:!0,children:(0,G.jsx)(I,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`})})})]});let L=ie.getVisibleItems(x);return(0,G.jsxs)(u,{flexDirection:`column`,children:[(0,G.jsx)(u,{marginBottom:1,children:(0,G.jsx)(f,{bold:!0,children:`Install Plugins`})}),ie.scrollPosition.canScrollUp&&(0,G.jsx)(u,{children:(0,G.jsxs)(f,{dimColor:!0,children:[` `,a.arrowUp,` more above`]})}),L.map((t,n)=>{let r=ie.toActualIndex(n),i=E===r,o=k.has(t.pluginId),s=j.has(t.pluginId);return(0,G.jsxs)(u,{flexDirection:`column`,marginBottom:n===L.length-1&&!e?0:1,children:[(0,G.jsxs)(u,{children:[(0,G.jsxs)(f,{color:i?`suggestion`:void 0,children:[i?a.pointer:` `,` `]}),(0,G.jsxs)(f,{color:t.isInstalled?`success`:void 0,children:[t.isInstalled?a.tick:s?a.ellipsis:o?a.radioOn:a.radioOff,` `,t.entry.name,t.entry.category&&(0,G.jsxs)(f,{dimColor:!0,children:[` [`,t.entry.category,`]`]}),t.entry.tags?.includes(`community-managed`)&&(0,G.jsx)(f,{dimColor:!0,children:` [Community Managed]`}),t.isInstalled&&(0,G.jsx)(f,{dimColor:!0,children:` (installed)`}),w&&h===`claude-plugins-official`&&(0,G.jsxs)(f,{dimColor:!0,children:[` · `,fn(w.get(t.pluginId)??0),` installs`]})]})]}),t.entry.description&&(0,G.jsxs)(u,{marginLeft:4,children:[(0,G.jsx)(f,{dimColor:!0,children:Ft(t.entry.description,60)}),t.entry.version&&(0,G.jsxs)(f,{dimColor:!0,children:[` · v`,t.entry.version]})]})]},t.pluginId)}),ie.scrollPosition.canScrollDown&&(0,G.jsx)(u,{children:(0,G.jsxs)(f,{dimColor:!0,children:[` `,a.arrowDown,` more below`]})}),e&&(0,G.jsx)(u,{marginTop:1,children:(0,G.jsxs)(f,{color:`error`,children:[a.cross,` `,e]})}),(0,G.jsx)(lr,{hasSelection:k.size>0})]})}var _r,vr,G,yr=e((()=>{i(),_r=t(g(),1),vr=t(g(),1),j(),C(),Jt(),yt(),Xt(),mt(),gt(),rt(),ln(),A(),_e(),fe(),E(),at(),ve(),Vt(),It(),rr(),or(),dr(),hr(),G=T()}));function br({error:e,setError:t,result:n,setResult:r,setViewState:i,onInstallComplete:o,onSearchModeChange:s,targetPlugin:l}){let[d,h]=(0,K.useState)(`plugin-list`),[g,v]=(0,K.useState)(null),[b,S]=(0,K.useState)([]),[C,te]=(0,K.useState)(!0),[w,T]=(0,K.useState)(null),[E,D]=(0,K.useState)(!1),O=(0,K.useCallback)(e=>{D(e),s?.(e)},[s]),{query:k,setQuery:A,cursorOffset:j}=xn({isActive:d===`plugin-list`&&E&&!C,onExit:()=>{O(!1)}}),re=m(),{columns:ie}=x(),M=(0,K.useMemo)(()=>{if(!k)return b;let e=k.toLowerCase();return b.filter(t=>t.entry.name.toLowerCase().includes(e)||t.entry.description?.toLowerCase().includes(e)||t.marketplaceName.toLowerCase().includes(e))},[b,k]),[N,oe]=(0,K.useState)(0),[P,se]=(0,K.useState)(new Set),[ce,le]=(0,K.useState)(new Set),ue=fr({totalItems:M.length,selectedIndex:N});(0,K.useEffect)(()=>{oe(0)},[k]);let[F,de]=(0,K.useState)(0),[fe,pe]=(0,K.useState)(!1),[L,me]=(0,K.useState)(null),[he,ge]=(0,K.useState)(null),[_e,ve]=(0,K.useState)(null);(0,K.useEffect)(()=>{async function e(){try{let e=await ae(),{marketplaces:n,failures:r}=await Qe(e),i=[];for(let{name:e,data:t}of n)if(t)for(let n of t.plugins){let t=ne(n.name,e);i.push({entry:n,marketplaceName:e,pluginId:t,isInstalled:Fe(t)})}let a=i.filter(e=>!e.isInstalled&&!He(e.pluginId));try{let e=await pn();T(e),e?a.sort((t,n)=>{let r=e.get(t.pluginId)??0,i=e.get(n.pluginId)??0;return r===i?t.entry.name.localeCompare(n.entry.name):i-r}):a.sort((e,t)=>e.entry.name.localeCompare(t.entry.name))}catch(e){ht(`Failed to fetch install counts: ${dt(e)}`),a.sort((e,t)=>e.entry.name.localeCompare(t.entry.name))}S(a);let o=Object.keys(e).length;if(a.length===0){let e=await Ce({configuredMarketplaceCount:o,failedMarketplaceCount:r.length});ve(e)}let s=ze(r,Tt(n,e=>e.data!==null));if(s)if(s.type===`warning`)ge(s.message+`. Showing available plugins.`);else throw Error(s.message);if(l){let e=i.find(e=>e.entry.name===l);e?e.isInstalled?t(`Plugin '${e.pluginId}' is already installed. Use '/plugin' to manage existing plugins.`):(v(e),h(`plugin-details`)):t(`Plugin "${l}" not found in any marketplace`)}}catch(e){t(e instanceof Error?e.message:`Failed to load plugins`)}finally{te(!1)}}e()},[t,l]);let ye=async()=>{if(P.size===0)return;let e=b.filter(e=>P.has(e.pluginId));le(new Set(e.map(e=>e.pluginId)));let n=0,a=0,s=[];for(let t of e){let e=await st({pluginId:t.pluginId,entry:t.entry,marketplaceName:t.marketplaceName,scope:`user`});e.success?n++:(a++,s.push({name:t.entry.name,reason:e.error}))}le(new Set),se(new Set),z(),a===0?r(`✓ Installed ${n} ${zt(n,`plugin`)}. Run /reload-plugins to activate.`):n===0?t(`Failed to install: ${et(s,!0)}`):r(`✓ Installed ${n} of ${n+a} plugins. Failed: ${et(s,!1)}. Run /reload-plugins to activate successfully installed plugins.`),n>0&&o&&await o(),i({type:`menu`})},be=async(e,t=`user`)=>{pe(!0),me(null);let n=await st({pluginId:e.pluginId,entry:e.entry,marketplaceName:e.marketplaceName,scope:t});if(n.success){let t=await $n(e.pluginId);if(t){pe(!1),h({type:`plugin-options`,plugin:t,pluginId:e.pluginId});return}r(n.message),o&&await o(),i({type:`menu`})}else pe(!1),me(n.error)};(0,K.useEffect)(()=>{e&&r(e)},[e,r]),ee(`confirm:no`,()=>{h(`plugin-list`),v(null)},{context:`Confirmation`,isActive:d===`plugin-details`}),ee(`confirm:no`,()=>{i({type:`menu`})},{context:`Confirmation`,isActive:d===`plugin-list`&&!E}),_((e,t)=>{let n=!t.ctrl&&!t.meta;E||(e===`/`&&n?(O(!0),A(``)):n&&e.length>0&&!/^\s+$/.test(e)&&e!==`j`&&e!==`k`&&e!==`i`&&(O(!0),A(e)))},{isActive:d===`plugin-list`&&!C}),c({"select:previous":()=>{N===0?O(!0):ue.handleSelectionChange(N-1,oe)},"select:next":()=>{N<M.length-1&&ue.handleSelectionChange(N+1,oe)},"select:accept":()=>{if(N===M.length&&P.size>0)ye();else if(N<M.length){let e=M[N];e&&(e.isInstalled?i({type:`manage-plugins`,targetPlugin:e.entry.name,targetMarketplace:e.marketplaceName}):(v(e),h(`plugin-details`),de(0),me(null)))}}},{context:`Select`,isActive:d===`plugin-list`&&!E}),c({"plugin:toggle":()=>{if(N<M.length){let e=M[N];if(e&&!e.isInstalled){let t=new Set(P);t.has(e.pluginId)?t.delete(e.pluginId):t.add(e.pluginId),se(t)}}},"plugin:install":()=>{P.size>0&&ye()}},{context:`Plugin`,isActive:d===`plugin-list`&&!E});let xe=Cr.useMemo(()=>{if(!g)return[];let e=g.entry.homepage;return cr(e,sr(g))},[g]);if(c({"select:previous":()=>{F>0&&de(F-1)},"select:next":()=>{F<xe.length-1&&de(F+1)},"select:accept":()=>{if(!g)return;let e=xe[F]?.action,t=g.entry.homepage,n=sr(g);e===`install-user`?be(g,`user`):e===`install-project`?be(g,`project`):e===`install-local`?be(g,`local`):e===`homepage`&&t?Yt(t):e===`github`&&n?Yt(`https://github.com/${n}`):e===`back`&&(h(`plugin-list`),v(null))}},{context:`Select`,isActive:d===`plugin-details`&&!!g}),typeof d==`object`&&d.type===`plugin-options`){let{plugin:e,pluginId:t}=d;function n(e){r(e),o&&o(),i({type:`menu`})}return(0,q.jsx)(er,{plugin:e,pluginId:t,onDone:(t,r)=>{switch(t){case`configured`:n(`✓ Installed and configured ${e.name}. Run /reload-plugins to apply.`);break;case`skipped`:n(`✓ Installed ${e.name}. Run /reload-plugins to apply.`);break;case`error`:n(`Installed but failed to save config: ${r}`);break}}})}if(C)return(0,q.jsx)(f,{children:`Loading…`});if(e)return(0,q.jsx)(f,{color:`error`,children:e});if(d===`plugin-details`&&g){let e=g.entry.homepage,t=cr(e,sr(g));return(0,q.jsxs)(u,{flexDirection:`column`,children:[(0,q.jsx)(u,{marginBottom:1,children:(0,q.jsx)(f,{bold:!0,children:`Plugin details`})}),(0,q.jsxs)(u,{flexDirection:`column`,marginBottom:1,children:[(0,q.jsx)(f,{bold:!0,children:g.entry.name}),(0,q.jsxs)(f,{dimColor:!0,children:[`from `,g.marketplaceName]}),g.entry.version&&(0,q.jsxs)(f,{dimColor:!0,children:[`Version: `,g.entry.version]}),g.entry.description&&(0,q.jsx)(u,{marginTop:1,children:(0,q.jsx)(f,{children:g.entry.description})}),g.entry.author&&(0,q.jsx)(u,{marginTop:1,children:(0,q.jsxs)(f,{dimColor:!0,children:[`By:`,` `,typeof g.entry.author==`string`?g.entry.author:g.entry.author.name]})})]}),(0,q.jsx)(ir,{}),L&&(0,q.jsx)(u,{marginBottom:1,children:(0,q.jsxs)(f,{color:`error`,children:[`Error: `,L]})}),(0,q.jsx)(u,{flexDirection:`column`,children:t.map((e,t)=>(0,q.jsxs)(u,{children:[F===t&&(0,q.jsx)(f,{children:`> `}),F!==t&&(0,q.jsx)(f,{children:` `}),(0,q.jsx)(f,{bold:F===t,children:fe&&e.action.startsWith(`install-`)?`Installing…`:e.label})]},e.action))}),(0,q.jsx)(u,{marginTop:1,children:(0,q.jsx)(f,{dimColor:!0,children:(0,q.jsxs)(p,{children:[(0,q.jsx)(I,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`select`}),(0,q.jsx)(I,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]})})})]})}if(b.length===0)return(0,q.jsxs)(u,{flexDirection:`column`,children:[(0,q.jsx)(u,{marginBottom:1,children:(0,q.jsx)(f,{bold:!0,children:`Discover plugins`})}),(0,q.jsx)(Sr,{reason:_e}),(0,q.jsx)(u,{marginTop:1,children:(0,q.jsx)(f,{dimColor:!0,italic:!0,children:`Esc to go back`})})]});let Se=ue.getVisibleItems(M);return(0,q.jsxs)(u,{flexDirection:`column`,children:[(0,q.jsxs)(u,{children:[(0,q.jsx)(f,{bold:!0,children:`Discover plugins`}),ue.needsPagination&&(0,q.jsxs)(f,{dimColor:!0,children:[` `,`(`,ue.scrollPosition.current,`/`,ue.scrollPosition.total,`)`]})]}),(0,q.jsx)(u,{marginBottom:1,children:(0,q.jsx)(y,{query:k,isFocused:E,isTerminalFocused:re,width:ie-4,cursorOffset:j})}),he&&(0,q.jsx)(u,{marginBottom:1,children:(0,q.jsxs)(f,{color:`warning`,children:[a.warning,` `,he]})}),M.length===0&&k&&(0,q.jsx)(u,{marginBottom:1,children:(0,q.jsxs)(f,{dimColor:!0,children:[`No plugins match "`,k,`"`]})}),ue.scrollPosition.canScrollUp&&(0,q.jsx)(u,{children:(0,q.jsxs)(f,{dimColor:!0,children:[` `,a.arrowUp,` more above`]})}),Se.map((t,n)=>{let r=ue.toActualIndex(n),i=N===r,o=P.has(t.pluginId),s=ce.has(t.pluginId);return(0,q.jsxs)(u,{flexDirection:`column`,marginBottom:n===Se.length-1&&!e?0:1,children:[(0,q.jsxs)(u,{children:[(0,q.jsxs)(f,{color:i&&!E?`suggestion`:void 0,children:[i&&!E?a.pointer:` `,` `]}),(0,q.jsxs)(f,{children:[s?a.ellipsis:o?a.radioOn:a.radioOff,` `,t.entry.name,(0,q.jsxs)(f,{dimColor:!0,children:[` · `,t.marketplaceName]}),t.entry.tags?.includes(`community-managed`)&&(0,q.jsx)(f,{dimColor:!0,children:` [Community Managed]`}),w&&t.marketplaceName===`claude-plugins-official`&&(0,q.jsxs)(f,{dimColor:!0,children:[` · `,fn(w.get(t.pluginId)??0),` installs`]})]})]}),t.entry.description&&(0,q.jsx)(u,{marginLeft:4,children:(0,q.jsx)(f,{dimColor:!0,children:Ft(t.entry.description,60)})})]},`${ue.startIndex}-${t.pluginId}`)}),ue.scrollPosition.canScrollDown&&(0,q.jsx)(u,{children:(0,q.jsxs)(f,{dimColor:!0,children:[` `,a.arrowDown,` more below`]})}),e&&(0,q.jsx)(u,{marginTop:1,children:(0,q.jsxs)(f,{color:`error`,children:[a.cross,` `,e]})}),(0,q.jsx)(xr,{hasSelection:P.size>0,canToggle:N<M.length&&!M[N]?.isInstalled})]})}function xr({hasSelection:e,canToggle:t}){return(0,q.jsx)(u,{marginTop:1,children:(0,q.jsx)(f,{dimColor:!0,italic:!0,children:(0,q.jsxs)(p,{children:[e&&(0,q.jsx)(I,{action:`plugin:install`,context:`Plugin`,fallback:`i`,description:`install`,bold:!0}),(0,q.jsx)(f,{children:`type to search`}),t&&(0,q.jsx)(I,{action:`plugin:toggle`,context:`Plugin`,fallback:`Space`,description:`toggle`}),(0,q.jsx)(I,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`details`}),(0,q.jsx)(I,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]})})})}function Sr({reason:e}){switch(e){case`git-not-installed`:return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(f,{dimColor:!0,children:`Git is required to install marketplaces.`}),(0,q.jsx)(f,{dimColor:!0,children:`Please install git and restart Work Mate.`})]});case`all-blocked-by-policy`:return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(f,{dimColor:!0,children:`Your organization policy does not allow any external marketplaces.`}),(0,q.jsx)(f,{dimColor:!0,children:`Contact your administrator.`})]});case`policy-restricts-sources`:return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(f,{dimColor:!0,children:`Your organization restricts which marketplaces can be added.`}),(0,q.jsx)(f,{dimColor:!0,children:`Switch to the Marketplaces tab to view allowed sources.`})]});case`all-marketplaces-failed`:return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(f,{dimColor:!0,children:`Failed to load marketplace data.`}),(0,q.jsx)(f,{dimColor:!0,children:`Check your network connection.`})]});case`all-plugins-installed`:return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(f,{dimColor:!0,children:`All available plugins are already installed.`}),(0,q.jsx)(f,{dimColor:!0,children:`Check for new plugins later or add more marketplaces.`})]});default:return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(f,{dimColor:!0,children:`No plugins available.`}),(0,q.jsx)(f,{dimColor:!0,children:`Add a marketplace first using the Marketplaces tab.`})]})}}var Cr,K,q,wr=e((()=>{i(),Cr=t(g(),1),K=t(g(),1),j(),bn(),C(),Sn(),Ie(),Jt(),yt(),Xt(),mt(),gt(),rt(),ln(),A(),_e(),fe(),E(),at(),ve(),Vt(),It(),rr(),or(),dr(),hr(),q=T()}));function Tr({setViewState:e,error:t,setError:n,setResult:r,exitState:i,onManageComplete:o,targetMarketplace:s,action:l}){let[d,m]=(0,Dr.useState)([]),[h,g]=(0,Dr.useState)(!0),[v,y]=(0,Dr.useState)(0),[b,x]=(0,Dr.useState)(!1),[S,C]=(0,Dr.useState)(null),[te,w]=(0,Dr.useState)(null),[T,E]=(0,Dr.useState)(null),[D,O]=(0,Dr.useState)(`list`),[k,A]=(0,Dr.useState)(null),[j,re]=(0,Dr.useState)(0),ie=(0,Dr.useRef)(!1);(0,Dr.useEffect)(()=>{async function e(){try{let e=await ae(),{enabled:r,disabled:i}=await Ge(),a=[...r,...i],{marketplaces:o,failures:c}=await Qe(e),u=[];for(let{name:e,config:t,data:n}of o){let r=a.filter(t=>t.source.endsWith(`@${e}`));u.push({name:e,source:Ze(t.source),lastUpdated:t.lastUpdated,pluginCount:n?.plugins.length,installedPlugins:r,pendingUpdate:!1,pendingRemove:!1,autoUpdate:vt(e,t)})}u.sort((e,t)=>e.name===`claude-plugin-directory`?-1:t.name===`claude-plugin-directory`?1:e.name.localeCompare(t.name)),m(u);let d=ze(c,Tt(o,e=>e.data!==null));if(d)if(d.type===`warning`)C(d.message);else throw Error(d.message);if(s&&!ie.current&&!t){ie.current=!0;let e=u.findIndex(e=>e.name===s);if(e>=0){let t=u[e];if(l){y(e+1);let t=[...u];l===`update`?t[e].pendingUpdate=!0:l===`remove`&&(t[e].pendingRemove=!0),m(t),setTimeout(P,100,t)}else t&&(y(e+1),A(t),O(`details`))}else n&&n(`Marketplace not found: ${s}`)}}catch(e){n&&n(e instanceof Error?e.message:`Failed to load marketplaces`),C(e instanceof Error?e.message:`Failed to load marketplaces`)}finally{g(!1)}}e()},[s,l,t]);let N=()=>d.some(e=>e.pendingUpdate||e.pendingRemove),oe=()=>({updateCount:Tt(d,e=>e.pendingUpdate),removeCount:Tt(d,e=>e.pendingRemove)}),P=async t=>{let i=t||d,s=D===`details`;x(!0),C(null),w(null),E(null);try{let t=xt(`userSettings`),n=0,c=0,l=new Set;for(let e of i){if(e.pendingRemove){if(e.installedPlugins&&e.installedPlugins.length>0){let n={...t?.enabledPlugins};for(let t of e.installedPlugins){let r=ne(t.name,e.name);n[r]=!1}Dt(`userSettings`,{enabledPlugins:n})}await Je(e.name),c++,Pt(`tengu_marketplace_removed`,{marketplace_name:e.name,plugins_uninstalled:e.installedPlugins?.length||0});continue}e.pendingUpdate&&(await M(e.name,e=>{E(e)}),n++,l.add(e.name.toLowerCase()),Pt(`tengu_marketplace_updated`,{marketplace_name:e.name}))}let u=0;l.size>0&&(u=(await Cn(l)).length),z(),o&&await o();let d=await ae(),{enabled:f,disabled:p}=await Ge(),ee=[...f,...p],{marketplaces:h}=await Qe(d),g=[];for(let{name:e,config:t,data:n}of h){let r=ee.filter(t=>t.source.endsWith(`@${e}`));g.push({name:e,source:Ze(t.source),lastUpdated:t.lastUpdated,pluginCount:n?.plugins.length,installedPlugins:r,pendingUpdate:!1,pendingRemove:!1,autoUpdate:vt(e,t)})}if(g.sort((e,t)=>e.name===`claude-plugin-directory`?-1:t.name===`claude-plugin-directory`?1:e.name.localeCompare(t.name)),m(g),s&&k){let e=g.find(e=>e.name===k.name);e&&A(e)}let _=[];if(n>0){let e=u>0?` (${u} ${zt(u,`plugin`)} bumped)`:``;_.push(`Updated ${n} ${zt(n,`marketplace`)}${e}`)}if(c>0&&_.push(`Removed ${c} ${zt(c,`marketplace`)}`),_.length>0){let t=`${a.tick} ${_.join(`, `)}`;s?w(t):(r(t),setTimeout(e,2e3,{type:`menu`}))}else s||e({type:`menu`})}catch(e){let t=dt(e);C(t),n&&n(t)}finally{x(!1),E(null)}},se=async()=>{if(!k)return;let e=d.map(e=>e.name===k.name?{...e,pendingRemove:!0}:e);m(e),await P(e)},ce=e=>{if(!e)return[];let t=[{label:`Browse plugins (${e.pluginCount??0})`,value:`browse`},{label:`Update marketplace`,secondaryLabel:e.lastUpdated?`(last updated ${new Date(e.lastUpdated).toLocaleDateString()})`:void 0,value:`update`}];return kt()||t.push({label:e.autoUpdate?`Disable auto-update`:`Enable auto-update`,value:`toggle-auto-update`}),t.push({label:`Remove marketplace`,value:`remove`}),t},le=async e=>{let t=!e.autoUpdate;try{await L(e.name,t),m(n=>n.map(n=>n.name===e.name?{...n,autoUpdate:t}:n)),A(e=>e&&{...e,autoUpdate:t})}catch(e){C(e instanceof Error?e.message:`Failed to update setting`)}};if(ee(`confirm:no`,()=>{O(`list`),re(0)},{context:`Confirmation`,isActive:!b&&(D===`details`||D===`confirm-remove`)}),ee(`confirm:no`,()=>{m(e=>e.map(e=>({...e,pendingUpdate:!1,pendingRemove:!1}))),y(0)},{context:`Confirmation`,isActive:!b&&D===`list`&&N()}),ee(`confirm:no`,()=>{e({type:`menu`})},{context:`Confirmation`,isActive:!b&&D===`list`&&!N()}),c({"select:previous":()=>y(e=>Math.max(0,e-1)),"select:next":()=>{let e=d.length+1;y(t=>Math.min(e-1,t+1))},"select:accept":()=>{let t=v-1;if(v===0)e({type:`add-marketplace`});else if(N())P();else{let e=d[t];e&&(A(e),O(`details`),re(0))}}},{context:`Select`,isActive:!b&&D===`list`}),_(e=>{let t=v-1;if((e===`u`||e===`U`)&&t>=0)m(e=>e.map((e,n)=>n===t?{...e,pendingUpdate:!e.pendingUpdate,pendingRemove:e.pendingUpdate?e.pendingRemove:!1}:e));else if((e===`r`||e===`R`)&&t>=0){let e=d[t];e&&(A(e),O(`confirm-remove`))}},{isActive:!b&&D===`list`}),c({"select:previous":()=>re(e=>Math.max(0,e-1)),"select:next":()=>{let e=ce(k);re(t=>Math.min(e.length-1,t+1))},"select:accept":()=>{if(!k)return;let t=ce(k)[j];if(t?.value===`browse`)e({type:`browse-marketplace`,targetMarketplace:k.name});else if(t?.value===`update`){let e=d.map(e=>e.name===k.name?{...e,pendingUpdate:!0}:e);m(e),P(e)}else t?.value===`toggle-auto-update`?le(k):t?.value===`remove`&&O(`confirm-remove`)}},{context:`Select`,isActive:!b&&D===`details`}),_(e=>{e===`y`||e===`Y`?se():(e===`n`||e===`N`)&&(O(`list`),A(null))},{isActive:!b&&D===`confirm-remove`}),h)return(0,J.jsx)(f,{children:`Loading marketplaces…`});if(d.length===0)return(0,J.jsxs)(u,{flexDirection:`column`,children:[(0,J.jsx)(u,{marginBottom:1,children:(0,J.jsx)(f,{bold:!0,children:`Manage marketplaces`})}),(0,J.jsxs)(u,{flexDirection:`row`,gap:1,children:[(0,J.jsxs)(f,{color:`suggestion`,children:[a.pointer,` +`]}),(0,J.jsx)(f,{bold:!0,color:`suggestion`,children:`Add Marketplace`})]}),(0,J.jsx)(u,{marginLeft:3,children:(0,J.jsx)(f,{dimColor:!0,italic:!0,children:i.pending?(0,J.jsxs)(J.Fragment,{children:[`Press `,i.keyName,` again to go back`]}):(0,J.jsxs)(p,{children:[(0,J.jsx)(I,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`select`}),(0,J.jsx)(I,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`})]})})})]});if(D===`confirm-remove`&&k){let e=k.installedPlugins?.length||0;return(0,J.jsxs)(u,{flexDirection:`column`,children:[(0,J.jsxs)(f,{bold:!0,color:`warning`,children:[`Remove marketplace `,(0,J.jsx)(f,{italic:!0,children:k.name}),`?`]}),(0,J.jsxs)(u,{flexDirection:`column`,children:[e>0&&(0,J.jsx)(u,{marginTop:1,children:(0,J.jsxs)(f,{color:`warning`,children:[`This will also uninstall `,e,` `,zt(e,`plugin`),` from this marketplace:`]})}),k.installedPlugins&&k.installedPlugins.length>0&&(0,J.jsx)(u,{flexDirection:`column`,marginTop:1,marginLeft:2,children:k.installedPlugins.map(e=>(0,J.jsxs)(f,{dimColor:!0,children:[`• `,e.name]},e.name))}),(0,J.jsx)(u,{marginTop:1,children:(0,J.jsxs)(f,{children:[`Press `,(0,J.jsx)(f,{bold:!0,children:`y`}),` to confirm or `,(0,J.jsx)(f,{bold:!0,children:`n`}),` to cancel`]})})]})]})}if(D===`details`&&k){let e=k.pendingUpdate||b,t=ce(k);return(0,J.jsxs)(u,{flexDirection:`column`,children:[(0,J.jsx)(f,{bold:!0,children:k.name}),(0,J.jsx)(f,{dimColor:!0,children:k.source}),(0,J.jsx)(u,{marginTop:1,children:(0,J.jsxs)(f,{children:[k.pluginCount||0,` available `,zt(k.pluginCount||0,`plugin`)]})}),k.installedPlugins&&k.installedPlugins.length>0&&(0,J.jsxs)(u,{flexDirection:`column`,marginTop:1,children:[(0,J.jsxs)(f,{bold:!0,children:[`Installed plugins (`,k.installedPlugins.length,`):`]}),(0,J.jsx)(u,{flexDirection:`column`,marginLeft:1,children:k.installedPlugins.map(e=>(0,J.jsxs)(u,{flexDirection:`row`,gap:1,children:[(0,J.jsx)(f,{children:a.bullet}),(0,J.jsxs)(u,{flexDirection:`column`,children:[(0,J.jsx)(f,{children:e.name}),(0,J.jsx)(f,{dimColor:!0,children:e.manifest.description})]})]},e.name))})]}),e&&(0,J.jsxs)(u,{marginTop:1,flexDirection:`column`,children:[(0,J.jsx)(f,{color:`claude`,children:`Updating marketplace…`}),T&&(0,J.jsx)(f,{dimColor:!0,children:T})]}),!e&&te&&(0,J.jsx)(u,{marginTop:1,children:(0,J.jsx)(f,{color:`claude`,children:te})}),!e&&S&&(0,J.jsx)(u,{marginTop:1,children:(0,J.jsx)(f,{color:`error`,children:S})}),!e&&(0,J.jsx)(u,{flexDirection:`column`,marginTop:1,children:t.map((e,t)=>{if(!e)return null;let n=t===j;return(0,J.jsxs)(u,{children:[(0,J.jsxs)(f,{color:n?`suggestion`:void 0,children:[n?a.pointer:` `,` `,e.label]}),e.secondaryLabel&&(0,J.jsxs)(f,{dimColor:!0,children:[` `,e.secondaryLabel]})]},e.value)})}),!e&&!kt()&&k.autoUpdate&&(0,J.jsx)(u,{marginTop:1,children:(0,J.jsx)(f,{dimColor:!0,children:`Auto-update enabled. Work Mate will automatically update this marketplace and its installed plugins.`})}),(0,J.jsx)(u,{marginLeft:3,children:(0,J.jsx)(f,{dimColor:!0,italic:!0,children:e?(0,J.jsx)(J.Fragment,{children:`Please wait…`}):(0,J.jsxs)(p,{children:[(0,J.jsx)(I,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`select`}),(0,J.jsx)(I,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`})]})})})]})}let{updateCount:ue,removeCount:F}=oe();return(0,J.jsxs)(u,{flexDirection:`column`,children:[(0,J.jsx)(u,{marginBottom:1,children:(0,J.jsx)(f,{bold:!0,children:`Manage marketplaces`})}),(0,J.jsxs)(u,{flexDirection:`row`,gap:1,marginBottom:1,children:[(0,J.jsxs)(f,{color:v===0?`suggestion`:void 0,children:[v===0?a.pointer:` `,` +`]}),(0,J.jsx)(f,{bold:!0,color:v===0?`suggestion`:void 0,children:`Add Marketplace`})]}),(0,J.jsx)(u,{flexDirection:`column`,children:d.map((e,t)=>{let n=t+1===v,r=[];return e.pendingUpdate&&r.push(`UPDATE`),e.pendingRemove&&r.push(`REMOVE`),(0,J.jsxs)(u,{flexDirection:`row`,gap:1,marginBottom:1,children:[(0,J.jsxs)(f,{color:n?`suggestion`:void 0,children:[n?a.pointer:` `,` `,e.pendingRemove?a.cross:a.bullet]}),(0,J.jsxs)(u,{flexDirection:`column`,flexGrow:1,children:[(0,J.jsxs)(u,{flexDirection:`row`,gap:1,children:[(0,J.jsxs)(f,{bold:!0,strikethrough:e.pendingRemove,dimColor:e.pendingRemove,children:[e.name===`claude-plugins-official`&&(0,J.jsx)(f,{color:`claude`,children:`✻ `}),e.name,e.name===`claude-plugins-official`&&(0,J.jsx)(f,{color:`claude`,children:` ✻`})]}),r.length>0&&(0,J.jsxs)(f,{color:`warning`,children:[`[`,r.join(`, `),`]`]})]}),(0,J.jsx)(f,{dimColor:!0,children:e.source}),(0,J.jsxs)(f,{dimColor:!0,children:[e.pluginCount!==void 0&&(0,J.jsxs)(J.Fragment,{children:[e.pluginCount,` available`]}),e.installedPlugins&&e.installedPlugins.length>0&&(0,J.jsxs)(J.Fragment,{children:[` • `,e.installedPlugins.length,` installed`]}),e.lastUpdated&&(0,J.jsxs)(J.Fragment,{children:[` • Updated `,new Date(e.lastUpdated).toLocaleDateString()]})]})]})]},e.name)})}),N()&&(0,J.jsxs)(u,{marginTop:1,flexDirection:`column`,children:[(0,J.jsxs)(f,{children:[(0,J.jsx)(f,{bold:!0,children:`Pending changes:`}),` `,(0,J.jsx)(f,{dimColor:!0,children:`Enter to apply`})]}),ue>0&&(0,J.jsxs)(f,{children:[`• Update `,ue,` `,zt(ue,`marketplace`)]}),F>0&&(0,J.jsxs)(f,{color:`warning`,children:[`• Remove `,F,` `,zt(F,`marketplace`)]})]}),b&&(0,J.jsx)(u,{marginTop:1,children:(0,J.jsx)(f,{color:`claude`,children:`Processing changes…`})}),S&&(0,J.jsx)(u,{marginTop:1,children:(0,J.jsx)(f,{color:`error`,children:S})}),(0,J.jsx)(Er,{exitState:i,hasPendingActions:N()})]})}function Er({exitState:e,hasPendingActions:t}){return e.pending?(0,J.jsx)(u,{marginTop:1,children:(0,J.jsxs)(f,{dimColor:!0,italic:!0,children:[`Press `,e.keyName,` again to go back`]})}):(0,J.jsx)(u,{marginTop:1,children:(0,J.jsx)(f,{dimColor:!0,italic:!0,children:(0,J.jsxs)(p,{children:[t&&(0,J.jsx)(I,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`apply changes`}),!t&&(0,J.jsx)(I,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`select`}),!t&&(0,J.jsx)(o,{shortcut:`u`,action:`update`}),!t&&(0,J.jsx)(o,{shortcut:`r`,action:`remove`}),(0,J.jsx)(I,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:t?`cancel`:`go back`})]})})})}var Dr,J,Or=e((()=>{i(),g(),Dr=t(g(),1),Nt(),j(),C(),Jt(),yt(),Ot(),gt(),rt(),_e(),fe(),wn(),Ee(),_t(),wt(),Vt(),J=T()}));function kr(e){switch(e.type){case`path-not-found`:return`${e.component} path not found: ${e.path}`;case`git-auth-failed`:return`Git ${e.authType.toUpperCase()} authentication failed for ${e.gitUrl}`;case`git-timeout`:return`Git ${e.operation} timed out for ${e.gitUrl}`;case`network-error`:return`Network error accessing ${e.url}${e.details?`: ${e.details}`:``}`;case`manifest-parse-error`:return`Failed to parse manifest at ${e.manifestPath}: ${e.parseError}`;case`manifest-validation-error`:return`Invalid manifest at ${e.manifestPath}: ${e.validationErrors.join(`, `)}`;case`plugin-not-found`:return`Plugin "${e.pluginId}" not found in marketplace "${e.marketplace}"`;case`marketplace-not-found`:return`Marketplace "${e.marketplace}" not found`;case`marketplace-load-failed`:return`Failed to load marketplace "${e.marketplace}": ${e.reason}`;case`mcp-config-invalid`:return`Invalid MCP server config for "${e.serverName}": ${e.validationError}`;case`mcp-server-suppressed-duplicate`:{let t=e.duplicateOf.startsWith(`plugin:`)?`server provided by plugin "${e.duplicateOf.split(`:`)[1]??`?`}"`:`already-configured "${e.duplicateOf}"`;return`MCP server "${e.serverName}" skipped — same command/URL as ${t}`}case`hook-load-failed`:return`Failed to load hooks from ${e.hookPath}: ${e.reason}`;case`component-load-failed`:return`Failed to load ${e.component} from ${e.path}: ${e.reason}`;case`mcpb-download-failed`:return`Failed to download MCPB from ${e.url}: ${e.reason}`;case`mcpb-extract-failed`:return`Failed to extract MCPB ${e.mcpbPath}: ${e.reason}`;case`mcpb-invalid-manifest`:return`MCPB manifest invalid at ${e.mcpbPath}: ${e.validationError}`;case`marketplace-blocked-by-policy`:return e.blockedByBlocklist?`Marketplace "${e.marketplace}" is blocked by enterprise policy`:`Marketplace "${e.marketplace}" is not in the allowed marketplace list`;case`dependency-unsatisfied`:return e.reason===`not-enabled`?`Dependency "${e.dependency}" is disabled`:`Dependency "${e.dependency}" is not installed`;case`lsp-config-invalid`:return`Invalid LSP server config for "${e.serverName}": ${e.validationError}`;case`lsp-server-start-failed`:return`LSP server "${e.serverName}" failed to start: ${e.reason}`;case`lsp-server-crashed`:return e.signal?`LSP server "${e.serverName}" crashed with signal ${e.signal}`:`LSP server "${e.serverName}" crashed with exit code ${e.exitCode??`unknown`}`;case`lsp-request-timeout`:return`LSP server "${e.serverName}" timed out on ${e.method} after ${e.timeoutMs}ms`;case`lsp-request-failed`:return`LSP server "${e.serverName}" ${e.method} failed: ${e.error}`;case`plugin-cache-miss`:return`Plugin "${e.plugin}" not cached at ${e.installPath}`;case`generic-error`:return e.error}return Te(e)}function Ar(e){switch(e.type){case`path-not-found`:return`Check that the path in your manifest or marketplace config is correct`;case`git-auth-failed`:return e.authType===`ssh`?`Configure SSH keys or use HTTPS URL instead`:`Configure credentials or use SSH URL instead`;case`git-timeout`:case`network-error`:return`Check your internet connection and try again`;case`manifest-parse-error`:return`Check manifest file syntax in the plugin directory`;case`manifest-validation-error`:return`Check manifest file follows the required schema`;case`plugin-not-found`:return`Plugin may not exist in marketplace "${e.marketplace}"`;case`marketplace-not-found`:return e.availableMarketplaces.length>0?`Available marketplaces: ${e.availableMarketplaces.join(`, `)}`:`Add the marketplace first using /plugin marketplace add`;case`mcp-config-invalid`:return`Check MCP server configuration in .mcp.json or manifest`;case`mcp-server-suppressed-duplicate`:return e.duplicateOf.startsWith(`plugin:`)?`Disable plugin "${e.duplicateOf.split(`:`)[1]??`the other plugin`}" if you want this plugin's version instead`:`Remove "${e.duplicateOf}" from your MCP config if you want the plugin's version instead`;case`hook-load-failed`:return`Check hooks.json file syntax and structure`;case`component-load-failed`:return`Check ${e.component} directory structure and file permissions`;case`mcpb-download-failed`:return`Check your internet connection and URL accessibility`;case`mcpb-extract-failed`:return`Verify the MCPB file is valid and not corrupted`;case`mcpb-invalid-manifest`:return`Contact the plugin author about the invalid manifest`;case`marketplace-blocked-by-policy`:return e.blockedByBlocklist?`This marketplace source is explicitly blocked by your administrator`:e.allowedSources.length>0?`Allowed sources: ${e.allowedSources.join(`, `)}`:`Contact your administrator to configure allowed marketplace sources`;case`dependency-unsatisfied`:return e.reason===`not-enabled`?`Enable "${e.dependency}" or uninstall "${e.plugin}"`:`Install "${e.dependency}" or uninstall "${e.plugin}"`;case`lsp-config-invalid`:return`Check LSP server configuration in the plugin manifest`;case`lsp-server-start-failed`:case`lsp-server-crashed`:case`lsp-request-timeout`:case`lsp-request-failed`:return`Check LSP server logs with --debug for details`;case`plugin-cache-miss`:return`Run /plugins to refresh the plugin cache`;case`marketplace-load-failed`:case`generic-error`:return null}return null}var jr=e((()=>{We()}));function Mr({item:e,isSelected:t}){let[n]=l();if(e.type===`plugin`){let r,i;return e.pendingToggle?(r=v(`suggestion`,n)(a.arrowRight),i=e.pendingToggle===`will-enable`?`will enable`:`will disable`):e.errorCount>0?(r=v(`error`,n)(a.cross),i=`${e.errorCount} ${zt(e.errorCount,`error`)}`):e.isEnabled?(r=v(`success`,n)(a.tick),i=`enabled`):(r=v(`inactive`,n)(a.radioOff),i=`disabled`),(0,Y.jsxs)(u,{children:[(0,Y.jsx)(f,{color:t?`suggestion`:void 0,children:t?`${a.pointer} `:` `}),(0,Y.jsx)(f,{color:t?`suggestion`:void 0,children:e.name}),(0,Y.jsxs)(f,{dimColor:!t,children:[` `,(0,Y.jsx)(f,{backgroundColor:`userMessageBackground`,children:`Plugin`})]}),(0,Y.jsxs)(f,{dimColor:!0,children:[` · `,e.marketplace]}),(0,Y.jsxs)(f,{dimColor:!t,children:[` · `,r,` `]}),(0,Y.jsx)(f,{dimColor:!t,children:i})]})}if(e.type===`flagged-plugin`){let r=v(`warning`,n)(a.warning);return(0,Y.jsxs)(u,{children:[(0,Y.jsx)(f,{color:t?`suggestion`:void 0,children:t?`${a.pointer} `:` `}),(0,Y.jsx)(f,{color:t?`suggestion`:void 0,children:e.name}),(0,Y.jsxs)(f,{dimColor:!t,children:[` `,(0,Y.jsx)(f,{backgroundColor:`userMessageBackground`,children:`Plugin`})]}),(0,Y.jsxs)(f,{dimColor:!0,children:[` · `,e.marketplace]}),(0,Y.jsxs)(f,{dimColor:!t,children:[` · `,r,` `]}),(0,Y.jsx)(f,{dimColor:!t,children:`removed`})]})}if(e.type===`failed-plugin`){let r=v(`error`,n)(a.cross),i=`failed to load · ${e.errorCount} ${zt(e.errorCount,`error`)}`;return(0,Y.jsxs)(u,{children:[(0,Y.jsx)(f,{color:t?`suggestion`:void 0,children:t?`${a.pointer} `:` `}),(0,Y.jsx)(f,{color:t?`suggestion`:void 0,children:e.name}),(0,Y.jsxs)(f,{dimColor:!t,children:[` `,(0,Y.jsx)(f,{backgroundColor:`userMessageBackground`,children:`Plugin`})]}),(0,Y.jsxs)(f,{dimColor:!0,children:[` · `,e.marketplace]}),(0,Y.jsxs)(f,{dimColor:!t,children:[` · `,r,` `]}),(0,Y.jsx)(f,{dimColor:!t,children:i})]})}let r,i;return e.status===`connected`?(r=v(`success`,n)(a.tick),i=`connected`):e.status===`disabled`?(r=v(`inactive`,n)(a.radioOff),i=`disabled`):e.status===`pending`?(r=v(`inactive`,n)(a.radioOff),i=`connecting…`):e.status===`needs-auth`?(r=v(`warning`,n)(a.triangleUpOutline),i=`Enter to auth`):(r=v(`error`,n)(a.cross),i=`failed`),e.indented?(0,Y.jsxs)(u,{children:[(0,Y.jsx)(f,{color:t?`suggestion`:void 0,children:t?`${a.pointer} `:` `}),(0,Y.jsx)(f,{dimColor:!t,children:`└ `}),(0,Y.jsx)(f,{color:t?`suggestion`:void 0,children:e.name}),(0,Y.jsxs)(f,{dimColor:!t,children:[` `,(0,Y.jsx)(f,{backgroundColor:`userMessageBackground`,children:`MCP`})]}),(0,Y.jsxs)(f,{dimColor:!t,children:[` · `,r,` `]}),(0,Y.jsx)(f,{dimColor:!t,children:i})]}):(0,Y.jsxs)(u,{children:[(0,Y.jsx)(f,{color:t?`suggestion`:void 0,children:t?`${a.pointer} `:` `}),(0,Y.jsx)(f,{color:t?`suggestion`:void 0,children:e.name}),(0,Y.jsxs)(f,{dimColor:!t,children:[` `,(0,Y.jsx)(f,{backgroundColor:`userMessageBackground`,children:`MCP`})]}),(0,Y.jsxs)(f,{dimColor:!t,children:[` · `,r,` `]}),(0,Y.jsx)(f,{dimColor:!t,children:i})]})}var Y,Nr=e((()=>{i(),g(),C(),Vt(),Y=T()}));async function Pr(e){try{return(await En.readdir(e,{withFileTypes:!0})).filter(e=>e.isFile()&&e.name.endsWith(`.md`)).map(e=>Tn.basename(e.name,`.md`))}catch(t){return ht(`Failed to read plugin components from ${e}: ${dt(t)}`,{level:`error`}),Mt(pt(t)),[]}}async function Fr(e){try{let t=await En.readdir(e,{withFileTypes:!0}),n=[];for(let r of t)if(r.isDirectory()||r.isSymbolicLink()){let t=Tn.join(e,r.name,`SKILL.md`);try{(await En.stat(t)).isFile()&&n.push(r.name)}catch{}}return n}catch(t){return ht(`Failed to read skill directories from ${e}: ${dt(t)}`,{level:`error`}),Mt(pt(t)),[]}}function Ir({plugin:e,marketplace:t}){let[n,r]=(0,X.useState)(null),[i,a]=(0,X.useState)(!0),[o,s]=(0,X.useState)(null);return(0,X.useEffect)(()=>{async function n(){try{if(t===`builtin`){let t=Le(e.name);if(t){let e=t.skills?.map(e=>e.name)??[],n=t.hooks?Object.keys(t.hooks):[],i=t.mcpServers?Object.keys(t.mcpServers):[];r({commands:null,agents:null,skills:e.length>0?e:null,hooks:n.length>0?n:null,mcpServers:i.length>0?i:null})}else s(`Built-in plugin ${e.name} not found`);a(!1);return}let n=(await F(t)).plugins.find(t=>t.name===e.name);if(n){let t=[];e.commandsPath&&t.push(e.commandsPath),e.commandsPaths&&t.push(...e.commandsPaths);let i=[];for(let e of t)if(typeof e==`string`){let t=await Pr(e);i.push(...t)}let a=[];e.agentsPath&&a.push(e.agentsPath),e.agentsPaths&&a.push(...e.agentsPaths);let o=[];for(let e of a)if(typeof e==`string`){let t=await Pr(e);o.push(...t)}let s=[];e.skillsPath&&s.push(e.skillsPath),e.skillsPaths&&s.push(...e.skillsPaths);let c=[];for(let e of s)if(typeof e==`string`){let t=await Fr(e);c.push(...t)}let l=[];e.hooksConfig&&l.push(Object.keys(e.hooksConfig)),n.hooks&&l.push(n.hooks);let u=[];e.mcpServers&&u.push(Object.keys(e.mcpServers)),n.mcpServers&&u.push(n.mcpServers),r({commands:i.length>0?i:null,agents:o.length>0?o:null,skills:c.length>0?c:null,hooks:l.length>0?l:null,mcpServers:u.length>0?u:null})}else s(`Plugin ${e.name} not found in marketplace`)}catch(e){s(e instanceof Error?e.message:`Failed to load components`)}finally{a(!1)}}n()},[e.name,e.commandsPath,e.commandsPaths,e.agentsPath,e.agentsPaths,e.skillsPath,e.skillsPaths,e.hooksConfig,e.mcpServers,t]),i?null:o?(0,Z.jsxs)(u,{flexDirection:`column`,marginBottom:1,children:[(0,Z.jsx)(f,{bold:!0,children:`Components:`}),(0,Z.jsxs)(f,{dimColor:!0,children:[`Error: `,o]})]}):!n||!(n.commands||n.agents||n.skills||n.hooks||n.mcpServers)?null:(0,Z.jsxs)(u,{flexDirection:`column`,marginBottom:1,children:[(0,Z.jsx)(f,{bold:!0,children:`Installed components:`}),n.commands?(0,Z.jsxs)(f,{dimColor:!0,children:[`• Commands:`,` `,typeof n.commands==`string`?n.commands:Array.isArray(n.commands)?n.commands.join(`, `):Object.keys(n.commands).join(`, `)]}):null,n.agents?(0,Z.jsxs)(f,{dimColor:!0,children:[`• Agents:`,` `,typeof n.agents==`string`?n.agents:Array.isArray(n.agents)?n.agents.join(`, `):Object.keys(n.agents).join(`, `)]}):null,n.skills?(0,Z.jsxs)(f,{dimColor:!0,children:[`• Skills:`,` `,typeof n.skills==`string`?n.skills:Array.isArray(n.skills)?n.skills.join(`, `):Object.keys(n.skills).join(`, `)]}):null,n.hooks?(0,Z.jsxs)(f,{dimColor:!0,children:[`• Hooks:`,` `,typeof n.hooks==`string`?n.hooks:Array.isArray(n.hooks)?n.hooks.map(String).join(`, `):typeof n.hooks==`object`&&n.hooks!==null?Object.keys(n.hooks).join(`, `):String(n.hooks)]}):null,n.mcpServers?(0,Z.jsxs)(f,{dimColor:!0,children:[`• MCP Servers:`,` `,typeof n.mcpServers==`string`?n.mcpServers:Array.isArray(n.mcpServers)?n.mcpServers.map(String).join(`, `):typeof n.mcpServers==`object`&&n.mcpServers!==null?Object.keys(n.mcpServers).join(`, `):String(n.mcpServers)]}):null]})}async function Lr(e,t){let n=(await F(t))?.plugins.find(t=>t.name===e);return n&&typeof n.source==`string`?`Local plugins cannot be updated remotely. To update, modify the source at: ${n.source}`:null}function Rr(e){return e.filter(e=>{let t=e.source.split(`@`)[1]||`local`;return!He(`${e.name}@${t}`)})}function zr({setViewState:e,setResult:t,onManageComplete:n,onSearchModeChange:r,targetPlugin:i,targetMarketplace:o,action:s}){let l=oe(e=>e.mcp.clients),d=oe(e=>e.mcp.tools),h=oe(e=>e.plugins.errors),g=Gt(),[v,b]=(0,X.useState)(!1),S=(0,X.useCallback)(e=>{b(e),r?.(e)},[r]),C=m(),{columns:te}=x(),[w,T]=(0,X.useState)(`plugin-list`),{query:E,setQuery:ne,cursorOffset:D}=xn({isActive:w===`plugin-list`&&v,onExit:()=>{S(!1)}}),[O,k]=(0,X.useState)(null),[A,j]=(0,X.useState)([]),[re,ie]=(0,X.useState)([]),[M,N]=(0,X.useState)(!0),[ae,P]=(0,X.useState)(new Map),se=(0,X.useRef)(!1),le=(0,X.useRef)(void 0),ue=hn();ee(`confirm:no`,Br.useCallback(()=>{if(w===`plugin-details`)T(`plugin-list`),k(null),R(null);else if(typeof w==`object`&&w.type===`failed-plugin-details`)T(`plugin-list`),R(null);else if(w===`configuring`)T(`plugin-details`),Te(null);else if(typeof w==`object`&&(w.type===`plugin-options`||w.type===`configuring-options`))T(`plugin-list`),k(null),t(`Plugin enabled. Configuration skipped — run /reload-plugins to apply.`),n&&n();else if(typeof w==`object`&&w.type===`flagged-detail`)T(`plugin-list`),R(null);else if(typeof w==`object`&&w.type===`mcp-detail`)T(`plugin-list`),R(null);else if(typeof w==`object`&&w.type===`mcp-tools`)T({type:`mcp-detail`,client:w.client});else if(typeof w==`object`&&w.type===`mcp-tool-detail`)T({type:`mcp-tools`,client:w.client});else{if(ae.size>0){t(`Run /reload-plugins to apply plugin changes.`);return}e({type:`menu`})}},[w,e,ae,t]),{context:`Confirmation`,isActive:(w!==`plugin-list`||!v)&&w!==`confirm-project-uninstall`&&!(typeof w==`object`&&w.type===`confirm-data-cleanup`)});let F=e=>e.type===`connected`?`connected`:e.type===`disabled`?`disabled`:e.type===`pending`?`pending`:e.type===`needs-auth`?`needs-auth`:`failed`,de=(0,X.useMemo)(()=>{let e=Ct(),t=new Map;for(let e of l)if(e.name.startsWith(`plugin:`)){let n=e.name.split(`:`);if(n.length>=3){let r=n[1],i=n.slice(2).join(`:`),a=t.get(r)||[];a.push({displayName:i,client:e}),t.set(r,a)}}let n=[];for(let r of re){let i=`${r.plugin.name}@${r.marketplace}`,a=e?.enabledPlugins?.[i]!==!1,o=h.filter(e=>`plugin`in e&&e.plugin===r.plugin.name||e.source===i||e.source.startsWith(`${r.plugin.name}@`)),s=r.plugin.isBuiltin?`builtin`:r.scope||`user`;n.push({item:{type:`plugin`,id:i,name:r.plugin.name,description:r.plugin.manifest.description,marketplace:r.marketplace,scope:s,isEnabled:a,errorCount:o.length,errors:o,plugin:r.plugin,pendingEnable:r.pendingEnable,pendingUpdate:r.pendingUpdate,pendingToggle:ae.get(i)},originalScope:s,childMcps:t.get(r.plugin.name)||[]})}let r=new Set(n.map(({item:e})=>e.id)),i=new Set(n.map(({item:e})=>e.name)),a=new Map;for(let e of h){if(r.has(e.source)||`plugin`in e&&typeof e.plugin==`string`&&i.has(e.plugin))continue;let t=a.get(e.source)||[];t.push(e),a.set(e.source,t)}let o=Qt(),s=[];for(let[e,t]of a){if(e in g)continue;let n=ge(e),r=n.name||e,i=n.marketplace||`unknown`,a=o.get(e),c=a===`flag`||a===void 0?`user`:a;s.push({type:`failed-plugin`,id:e,name:r,marketplace:i,scope:c,errorCount:t.length,errors:t})}let c=[];for(let e of l)e.name!==`ide`&&(e.name.startsWith(`plugin:`)||c.push({type:`mcp`,id:`mcp:${e.name}`,name:e.name,description:void 0,scope:e.config.scope,status:F(e),client:e}));let u={flagged:-1,project:0,local:1,user:2,enterprise:3,managed:4,dynamic:5,builtin:6},d=[],f=new Map;for(let{item:e,originalScope:t,childMcps:r}of n){let n=e.scope;f.has(n)||f.set(n,[]),f.get(n).push(e);for(let{displayName:e,client:n}of r){let r=t===`builtin`?`user`:t;f.has(r)||f.set(r,[]),f.get(r).push({type:`mcp`,id:`mcp:${n.name}`,name:e,description:void 0,scope:r,status:F(n),client:n,indented:!0})}}for(let e of c){let t=e.scope;f.has(t)||f.set(t,[]),f.get(t).push(e)}for(let e of s){let t=e.scope;f.has(t)||f.set(t,[]),f.get(t).push(e)}for(let[e,t]of Object.entries(g)){let n=ge(e),r=n.name||e,i=n.marketplace||`unknown`;f.has(`flagged`)||f.set(`flagged`,[]),f.get(`flagged`).push({type:`flagged-plugin`,id:e,name:r,marketplace:i,scope:`flagged`,reason:`delisted`,text:`Removed from marketplace`,flaggedAt:t.flaggedAt})}let p=[...f.keys()].sort((e,t)=>(u[e]??99)-(u[t]??99));for(let e of p){let t=f.get(e),n=[],r=[],i=0;for(;i<t.length;){let e=t[i];if(e.type===`plugin`||e.type===`failed-plugin`||e.type===`flagged-plugin`){let r=[e];i++;let a=t[i];for(;a?.type===`mcp`&&a.indented;)r.push(a),i++,a=t[i];n.push(r)}else e.type===`mcp`&&!e.indented&&r.push(e),i++}n.sort((e,t)=>e[0].name.localeCompare(t[0].name)),r.sort((e,t)=>e.name.localeCompare(t.name));for(let e of n)d.push(...e);d.push(...r)}return d},[re,l,h,ae,g]),fe=(0,X.useMemo)(()=>de.filter(e=>e.type===`flagged-plugin`).map(e=>e.id),[de]);(0,X.useEffect)(()=>{fe.length>0&&Wt(fe)},[fe]);let pe=(0,X.useMemo)(()=>{if(!E)return de;let e=E.toLowerCase();return de.filter(t=>t.name.toLowerCase().includes(e)||`description`in t&&t.description?.toLowerCase().includes(e))},[de,E]),[L,me]=(0,X.useState)(0),he=fr({totalItems:pe.length,selectedIndex:L,maxVisible:8}),[_e,ve]=(0,X.useState)(0),[ye,be]=(0,X.useState)(!1),[Se,R]=(0,X.useState)(null),[Ce,Te]=(0,X.useState)(null),[Ee,ke]=(0,X.useState)(!1),[Ae,je]=(0,X.useState)(!1);(0,X.useEffect)(()=>{if(!O){je(!1);return}async function e(){let e=O.plugin.manifest.mcpServers,t=!1;if(e&&(t=typeof e==`string`&&it(e)||Array.isArray(e)&&e.some(e=>typeof e==`string`&&it(e))),!t)try{let e=Tn.join(O.plugin.path,`..`),n=Tn.join(e,`.claude-plugin`,`marketplace.json`),r=ut(await En.readFile(n,`utf-8`)).plugins?.find(e=>e.name===O.plugin.name);if(r?.mcpServers){let e=r.mcpServers;t=typeof e==`string`&&it(e)||Array.isArray(e)&&e.some(e=>typeof e==`string`&&it(e))}}catch(e){ht(`Failed to read raw marketplace.json: ${e}`)}je(t)}e()},[O]),(0,X.useEffect)(()=>{async function e(){N(!0);try{let{enabled:e,disabled:t}=await Ge(),n=Ct(),r=Rr([...e,...t]),i={};for(let e of r){let t=e.source.split(`@`)[1]||`local`;i[t]||(i[t]=[]),i[t].push(e)}let a=[];for(let[e,t]of Object.entries(i)){let r=Tt(t,t=>{let r=`${t.name}@${e}`;return n?.enabledPlugins?.[r]!==!1}),i=t.length-r;a.push({name:e,installedPlugins:t,enabledCount:r,disabledCount:i})}a.sort((e,t)=>e.name===`claude-plugin-directory`?-1:t.name===`claude-plugin-directory`?1:e.name.localeCompare(t.name)),j(a);let o=[];for(let e of a)for(let t of e.installedPlugins){let n=`${t.name}@${e.name}`,r=t.isBuiltin?`builtin`:an(n).scope;o.push({plugin:t,marketplace:e.name,scope:r,pendingEnable:void 0,pendingUpdate:!1})}ie(o),me(0)}finally{N(!1)}}e()},[]),(0,X.useEffect)(()=>{if(!se.current&&i&&A.length>0&&!M){let{name:e,marketplace:n}=ge(i),r=o??n,a=r?A.filter(e=>e.name===r):A;for(let t of a){let n=t.installedPlugins.find(t=>t.name===e);if(n){let{scope:e}=an(`${n.name}@${t.name}`),r={plugin:n,marketplace:t.name,scope:e,pendingEnable:void 0,pendingUpdate:!1};k(r),T(`plugin-details`),le.current=s,se.current=!0;return}}let c=de.find(t=>t.type===`failed-plugin`&&t.name===e);c&&c.type===`failed-plugin`&&(T({type:`failed-plugin-details`,plugin:{id:c.id,name:c.name,marketplace:c.marketplace,errors:c.errors,scope:c.scope}}),se.current=!0),!se.current&&s&&(se.current=!0,t(`Plugin "${i}" is not installed in this project`))}},[i,o,A,M,de,s,t]);let Me=async r=>{if(!O)return;let i=O.scope||`user`,a=i===`builtin`;if(a&&(r===`update`||r===`uninstall`)){R(`Built-in plugins cannot be updated or uninstalled.`);return}if(!a&&!rn(i)&&r!==`update`){R(`This plugin is managed by your organization. Contact your admin to disable it.`);return}be(!0),R(null);try{let o=`${O.plugin.name}@${O.marketplace}`,s;switch(r){case`enable`:{let e=await $t(o);if(!e.success)throw Error(e.message);break}case`disable`:{let e=await nn(o);if(!e.success)throw Error(e.message);s=e.reverseDependents;break}case`uninstall`:{if(a||!rn(i))break;if(sn(o)){be(!1),T(`confirm-project-uninstall`);return}let e=ce().plugins[o],t=!e||e.length<=1?await we(o):null;if(t){be(!1),T({type:`confirm-data-cleanup`,size:t});return}let n=await en(o,i);if(!n.success)throw Error(n.message);s=n.reverseDependents;break}case`update`:{if(a)break;let r=await tn(o,i);if(!r.success)throw Error(r.message);if(r.alreadyUpToDate){t(`${O.plugin.name} is already at the latest version (${r.newVersion}).`),n&&await n(),e({type:`menu`});return}break}}z();let c=`${O.plugin.name}@${O.marketplace}`;if(Ct()?.enabledPlugins?.[c]!==!1){be(!1),T({type:`plugin-options`});return}let l=r===`enable`?`Enabled`:r===`disable`?`Disabled`:r===`update`?`Updated`:`Uninstalled`,u=s&&s.length>0?` · required by ${s.join(`, `)}`:``;t(`✓ ${l} ${O.plugin.name}${u}. Run /reload-plugins to apply.`),n&&await n(),e({type:`menu`})}catch(e){be(!1);let t=e instanceof Error?e.message:String(e);R(`Failed to ${r}: ${t}`),Mt(pt(e))}},Ne=(0,X.useRef)(Me);Ne.current=Me,(0,X.useEffect)(()=>{if(w===`plugin-details`&&O&&le.current){let e=le.current;le.current=void 0,Ne.current(e)}},[w,O]);let Fe=Br.useCallback(()=>{if(L>=pe.length)return;let e=pe[L];if(e?.type!==`flagged-plugin`)if(e?.type===`plugin`){let t=`${e.plugin.name}@${e.marketplace}`,n=Ct(),r=ae.get(t),i=n?.enabledPlugins?.[t]!==!1,a=e.scope;if(a===`builtin`||rn(a)){let e=new Map(ae);r?(e.delete(t),(async()=>{try{r===`will-disable`?await $t(t):await nn(t),z()}catch(e){Mt(e)}})()):(e.set(t,i?`will-disable`:`will-enable`),(async()=>{try{i?await nn(t):await $t(t),z()}catch(e){Mt(e)}})()),P(e)}}else e?.type===`mcp`&&ue(e.client.name)},[L,pe,ae,re,ue]);c({"select:previous":()=>{L===0?S(!0):he.handleSelectionChange(L-1,me)},"select:next":()=>{L<pe.length-1&&he.handleSelectionChange(L+1,me)},"select:accept":Br.useCallback(()=>{if(L>=pe.length)return;let e=pe[L];if(e?.type===`plugin`){let t=re.find(t=>t.plugin.name===e.plugin.name&&t.marketplace===e.marketplace);t&&(k(t),T(`plugin-details`),ve(0),R(null))}else e?.type===`flagged-plugin`?(T({type:`flagged-detail`,plugin:{id:e.id,name:e.name,marketplace:e.marketplace,reason:e.reason,text:e.text,flaggedAt:e.flaggedAt}}),R(null)):e?.type===`failed-plugin`?(T({type:`failed-plugin-details`,plugin:{id:e.id,name:e.name,marketplace:e.marketplace,errors:e.errors,scope:e.scope}}),ve(0),R(null)):e?.type===`mcp`&&(T({type:`mcp-detail`,client:e.client}),R(null))},[L,pe,re])},{context:`Select`,isActive:w===`plugin-list`&&!v}),c({"plugin:toggle":Fe},{context:`Plugin`,isActive:w===`plugin-list`&&!v}),c({"select:accept":Br.useCallback(()=>{typeof w!=`object`||w.type!==`flagged-detail`||(Kt(w.plugin.id),T(`plugin-list`))},[w])},{context:`Select`,isActive:typeof w==`object`&&w.type===`flagged-detail`});let Ie=Br.useMemo(()=>{if(w!==`plugin-details`||!O)return[];let e=Ct(),t=`${O.plugin.name}@${O.marketplace}`,n=e?.enabledPlugins?.[t]!==!1,r=O.marketplace===`builtin`,i=[];return i.push({label:n?`Disable plugin`:`Enable plugin`,action:()=>void Me(n?`disable`:`enable`)}),r||(i.push({label:O.pendingUpdate?`Unmark for update`:`Mark for update`,action:async()=>{try{let e=await Lr(O.plugin.name,O.marketplace);if(e){R(e);return}let t=[...re],n=t.findIndex(e=>e.plugin.name===O.plugin.name&&e.marketplace===O.marketplace);n!==-1&&(t[n].pendingUpdate=!O.pendingUpdate,ie(t),k({...O,pendingUpdate:!O.pendingUpdate}))}catch(e){R(e instanceof Error?e.message:`Failed to check plugin update availability`)}}}),Ae&&i.push({label:`Configure`,action:async()=>{ke(!0);try{let e=O.plugin.manifest.mcpServers,t=null;if(typeof e==`string`&&it(e))t=e;else if(Array.isArray(e)){for(let n of e)if(typeof n==`string`&&it(n)){t=n;break}}if(!t){R(`No MCPB file found in plugin`),ke(!1);return}let n=`${O.plugin.name}@${O.marketplace}`,r=await De(t,O.plugin.path,n,void 0,void 0,!0);`status`in r&&r.status===`needs-config`?(Te(r),T(`configuring`)):R(`Failed to load MCPB for configuration`)}catch(e){let t=dt(e);R(`Failed to load configuration: ${t}`)}finally{ke(!1)}}}),O.plugin.manifest.userConfig&&Object.keys(O.plugin.manifest.userConfig).length>0&&i.push({label:`Configure options`,action:()=>{T({type:`configuring-options`,schema:O.plugin.manifest.userConfig})}}),i.push({label:`Update now`,action:()=>void Me(`update`)}),i.push({label:`Uninstall`,action:()=>void Me(`uninstall`)})),O.plugin.manifest.homepage&&i.push({label:`Open homepage`,action:()=>void Yt(O.plugin.manifest.homepage)}),O.plugin.manifest.repository&&i.push({label:`View repository`,action:()=>void Yt(O.plugin.manifest.repository)}),i.push({label:`Back to plugin list`,action:()=>{T(`plugin-list`),k(null),R(null)}}),i},[w,O,Ae,re]);if(c({"select:previous":()=>{_e>0&&ve(_e-1)},"select:next":()=>{_e<Ie.length-1&&ve(_e+1)},"select:accept":()=>{Ie[_e]&&Ie[_e].action()}},{context:`Select`,isActive:w===`plugin-details`&&!!O}),c({"select:accept":()=>{typeof w==`object`&&w.type===`failed-plugin-details`&&(async()=>{be(!0),R(null);let e=w.plugin.id,t=w.plugin.scope,r=rn(t)?await en(e,t,!1):await en(e,`user`,!1),i=r.success;if(!i){for(let t of[`userSettings`,`projectSettings`,`localSettings`]){let n=xt(t);n?.enabledPlugins?.[e]!==void 0&&(Dt(t,{enabledPlugins:{...n.enabledPlugins,[e]:void 0}}),i=!0)}z()}i?(n&&await n(),be(!1),T(`plugin-list`)):(be(!1),R(r.message))})()}},{context:`Select`,isActive:typeof w==`object`&&w.type===`failed-plugin-details`&&w.plugin.scope!==`managed`}),c({"confirm:yes":()=>{if(!O)return;be(!0),R(null);let r=`${O.plugin.name}@${O.marketplace}`,{error:i}=Dt(`localSettings`,{enabledPlugins:{...xt(`localSettings`)?.enabledPlugins,[r]:!1}});if(i){be(!1),R(`Failed to write settings: ${i.message}`);return}z(),t(`✓ Disabled ${O.plugin.name} in .claude/settings.local.json. Run /reload-plugins to apply.`),n&&n(),e({type:`menu`})},"confirm:no":()=>{T(`plugin-details`),R(null)}},{context:`Confirmation`,isActive:w===`confirm-project-uninstall`&&!!O&&!ye}),_((r,i)=>{if(!O)return;let o=`${O.plugin.name}@${O.marketplace}`,s=O.scope;if(!s||s===`builtin`||!rn(s))return;let c=async r=>{be(!0),R(null);try{let i=await en(o,s,r);if(!i.success)throw Error(i.message);z();let c=r?``:` · data preserved`;t(`${a.tick} ${i.message}${c}`),n&&n(),e({type:`menu`})}catch(e){be(!1),R(e instanceof Error?e.message:String(e))}};r===`y`||r===`Y`?c(!0):r===`n`||r===`N`?c(!1):i.escape&&(T(`plugin-details`),R(null))},{isActive:typeof w==`object`&&w.type===`confirm-data-cleanup`&&!!O&&!ye}),Br.useEffect(()=>{me(0)},[E]),_((e,t)=>{let n=!t.ctrl&&!t.meta;v||(e===`/`&&n?(S(!0),ne(``),me(0)):n&&e.length>0&&!/^\s+$/.test(e)&&e!==`j`&&e!==`k`&&e!==` `&&(S(!0),ne(e),me(0)))},{isActive:w===`plugin-list`}),M)return(0,Z.jsx)(f,{children:`Loading installed plugins…`});if(de.length===0)return(0,Z.jsxs)(u,{flexDirection:`column`,children:[(0,Z.jsx)(u,{marginBottom:1,children:(0,Z.jsx)(f,{bold:!0,children:`Manage plugins`})}),(0,Z.jsx)(f,{children:`No plugins or MCP servers installed.`}),(0,Z.jsx)(u,{marginTop:1,children:(0,Z.jsx)(f,{dimColor:!0,children:`Esc to go back`})})]});if(typeof w==`object`&&w.type===`plugin-options`&&O){let r=`${O.plugin.name}@${O.marketplace}`;function i(r){t(r),n&&n(),e({type:`menu`})}return(0,Z.jsx)(er,{plugin:O.plugin,pluginId:r,onDone:(e,t)=>{switch(e){case`configured`:i(`✓ Enabled and configured ${O.plugin.name}. Run /reload-plugins to apply.`);break;case`skipped`:i(`✓ Enabled ${O.plugin.name}. Run /reload-plugins to apply.`);break;case`error`:i(`Failed to save configuration: ${t}`);break}}})}if(typeof w==`object`&&w.type===`configuring-options`&&O){let e=`${O.plugin.name}@${O.marketplace}`;return(0,Z.jsx)(Yn,{title:`Configure ${O.plugin.name}`,subtitle:`Plugin options`,configSchema:w.schema,initialValues:$e(e),onSave:n=>{try{xe(e,n,w.schema),z(),t(`Configuration saved. Run /reload-plugins for changes to take effect.`)}catch(e){R(`Failed to save configuration: ${dt(e)}`)}T(`plugin-details`)},onCancel:()=>T(`plugin-details`)})}if(w===`configuring`&&Ce&&O){let e=`${O.plugin.name}@${O.marketplace}`;async function n(n){if(!(!Ce||!O))try{let r=O.plugin.manifest.mcpServers,i=null;if(typeof r==`string`&&it(r))i=r;else if(Array.isArray(r)){for(let e of r)if(typeof e==`string`&&it(e)){i=e;break}}if(!i){R(`No MCPB file found`),T(`plugin-details`);return}await De(i,O.plugin.path,e,void 0,n),R(null),Te(null),T(`plugin-details`),t(`Configuration saved. Run /reload-plugins for changes to take effect.`)}catch(e){let t=dt(e);R(`Failed to save configuration: ${t}`),T(`plugin-details`)}}function r(){Te(null),T(`plugin-details`)}return(0,Z.jsx)(Yn,{title:`Configure ${Ce.manifest.name}`,subtitle:`Plugin: ${O.plugin.name}`,configSchema:Ce.configSchema,initialValues:Ce.existingConfig,onSave:n,onCancel:r})}if(typeof w==`object`&&w.type===`flagged-detail`){let e=w.plugin;return(0,Z.jsxs)(u,{flexDirection:`column`,children:[(0,Z.jsx)(u,{children:(0,Z.jsxs)(f,{bold:!0,children:[e.name,` @ `,e.marketplace]})}),(0,Z.jsxs)(u,{marginBottom:1,children:[(0,Z.jsx)(f,{dimColor:!0,children:`Status: `}),(0,Z.jsx)(f,{color:`error`,children:`Removed`})]}),(0,Z.jsxs)(u,{marginBottom:1,flexDirection:`column`,children:[(0,Z.jsxs)(f,{color:`error`,children:[`Removed from marketplace · reason: `,e.reason]}),(0,Z.jsx)(f,{children:e.text}),(0,Z.jsxs)(f,{dimColor:!0,children:[`Flagged on `,new Date(e.flaggedAt).toLocaleDateString()]})]}),(0,Z.jsx)(u,{marginTop:1,flexDirection:`column`,children:(0,Z.jsxs)(u,{children:[(0,Z.jsxs)(f,{children:[a.pointer,` `]}),(0,Z.jsx)(f,{color:`suggestion`,children:`Dismiss`})]})}),(0,Z.jsxs)(p,{children:[(0,Z.jsx)(I,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`dismiss`}),(0,Z.jsx)(I,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]})]})}if(w===`confirm-project-uninstall`&&O)return(0,Z.jsxs)(u,{flexDirection:`column`,children:[(0,Z.jsxs)(f,{bold:!0,color:`warning`,children:[O.plugin.name,` is enabled in .claude/settings.json (shared with your team)`]}),(0,Z.jsxs)(u,{marginTop:1,flexDirection:`column`,children:[(0,Z.jsx)(f,{children:`Disable it just for you in .claude/settings.local.json?`}),(0,Z.jsx)(f,{dimColor:!0,children:`This has the same effect as uninstalling, without affecting other contributors.`})]}),Se&&(0,Z.jsx)(u,{marginTop:1,children:(0,Z.jsx)(f,{color:`error`,children:Se})}),(0,Z.jsx)(u,{marginTop:1,children:ye?(0,Z.jsx)(f,{dimColor:!0,children:`Disabling…`}):(0,Z.jsxs)(p,{children:[(0,Z.jsx)(I,{action:`confirm:yes`,context:`Confirmation`,fallback:`y`,description:`disable`}),(0,Z.jsx)(I,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})]})})]});if(typeof w==`object`&&w.type===`confirm-data-cleanup`&&O)return(0,Z.jsxs)(u,{flexDirection:`column`,children:[(0,Z.jsxs)(f,{bold:!0,children:[O.plugin.name,` has `,w.size.human,` of persistent data`]}),(0,Z.jsxs)(u,{marginTop:1,flexDirection:`column`,children:[(0,Z.jsx)(f,{children:`Delete it along with the plugin?`}),(0,Z.jsx)(f,{dimColor:!0,children:Oe(`${O.plugin.name}@${O.marketplace}`)})]}),Se&&(0,Z.jsx)(u,{marginTop:1,children:(0,Z.jsx)(f,{color:`error`,children:Se})}),(0,Z.jsx)(u,{marginTop:1,children:ye?(0,Z.jsx)(f,{dimColor:!0,children:`Uninstalling…`}):(0,Z.jsxs)(f,{children:[(0,Z.jsx)(f,{bold:!0,children:`y`}),` to delete · `,(0,Z.jsx)(f,{bold:!0,children:`n`}),` to keep · `,(0,Z.jsx)(f,{bold:!0,children:`esc`}),` to cancel`]})})]});if(w===`plugin-details`&&O){let e=Ct(),t=`${O.plugin.name}@${O.marketplace}`,n=e?.enabledPlugins?.[t]!==!1,r=h.filter(e=>`plugin`in e&&e.plugin===O.plugin.name||e.source===t||e.source.startsWith(`${O.plugin.name}@`)),i=r.length===0?null:(0,Z.jsxs)(u,{flexDirection:`column`,marginBottom:1,children:[(0,Z.jsxs)(f,{bold:!0,color:`error`,children:[r.length,` `,zt(r.length,`error`),`:`]}),r.map((e,t)=>{let n=Ar(e);return(0,Z.jsxs)(u,{flexDirection:`column`,marginLeft:2,children:[(0,Z.jsx)(f,{color:`error`,children:kr(e)}),n&&(0,Z.jsxs)(f,{dimColor:!0,italic:!0,children:[a.arrowRight,` `,n]})]},t)})]});return(0,Z.jsxs)(u,{flexDirection:`column`,children:[(0,Z.jsx)(u,{children:(0,Z.jsxs)(f,{bold:!0,children:[O.plugin.name,` @ `,O.marketplace]})}),(0,Z.jsxs)(u,{children:[(0,Z.jsx)(f,{dimColor:!0,children:`Scope: `}),(0,Z.jsx)(f,{children:O.scope||`user`})]}),O.plugin.manifest.version&&(0,Z.jsxs)(u,{children:[(0,Z.jsx)(f,{dimColor:!0,children:`Version: `}),(0,Z.jsx)(f,{children:O.plugin.manifest.version})]}),O.plugin.manifest.description&&(0,Z.jsx)(u,{marginBottom:1,children:(0,Z.jsx)(f,{children:O.plugin.manifest.description})}),O.plugin.manifest.author&&(0,Z.jsxs)(u,{children:[(0,Z.jsx)(f,{dimColor:!0,children:`Author: `}),(0,Z.jsx)(f,{children:O.plugin.manifest.author.name})]}),(0,Z.jsxs)(u,{marginBottom:1,children:[(0,Z.jsx)(f,{dimColor:!0,children:`Status: `}),(0,Z.jsx)(f,{color:n?`success`:`warning`,children:n?`Enabled`:`Disabled`}),O.pendingUpdate&&(0,Z.jsx)(f,{color:`suggestion`,children:` · Marked for update`})]}),(0,Z.jsx)(Ir,{plugin:O.plugin,marketplace:O.marketplace}),i,(0,Z.jsx)(u,{marginTop:1,flexDirection:`column`,children:Ie.map((e,t)=>{let n=t===_e;return(0,Z.jsxs)(u,{children:[n&&(0,Z.jsxs)(f,{children:[a.pointer,` `]}),!n&&(0,Z.jsx)(f,{children:` `}),(0,Z.jsx)(f,{bold:n,color:e.label.includes(`Uninstall`)?`error`:e.label.includes(`Update`)?`suggestion`:void 0,children:e.label})]},t)})}),ye&&(0,Z.jsx)(u,{marginTop:1,children:(0,Z.jsx)(f,{children:`Processing…`})}),Se&&(0,Z.jsx)(u,{marginTop:1,children:(0,Z.jsx)(f,{color:`error`,children:Se})}),(0,Z.jsx)(u,{marginTop:1,children:(0,Z.jsx)(f,{dimColor:!0,italic:!0,children:(0,Z.jsxs)(p,{children:[(0,Z.jsx)(I,{action:`select:previous`,context:`Select`,fallback:`↑`,description:`navigate`}),(0,Z.jsx)(I,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`select`}),(0,Z.jsx)(I,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]})})})]})}if(typeof w==`object`&&w.type===`failed-plugin-details`){let e=w.plugin,t=e.errors[0],n=t?kr(t):`Failed to load`;return(0,Z.jsxs)(u,{flexDirection:`column`,children:[(0,Z.jsxs)(f,{children:[(0,Z.jsx)(f,{bold:!0,children:e.name}),(0,Z.jsxs)(f,{dimColor:!0,children:[` @ `,e.marketplace]}),(0,Z.jsxs)(f,{dimColor:!0,children:[` (`,e.scope,`)`]})]}),(0,Z.jsx)(f,{color:`error`,children:n}),e.scope===`managed`?(0,Z.jsx)(u,{marginTop:1,children:(0,Z.jsx)(f,{dimColor:!0,children:`Managed by your organization — contact your admin`})}):(0,Z.jsxs)(u,{marginTop:1,children:[(0,Z.jsxs)(f,{color:`suggestion`,children:[a.pointer,` `]}),(0,Z.jsx)(f,{bold:!0,children:`Remove`})]}),ye&&(0,Z.jsx)(f,{children:`Processing…`}),Se&&(0,Z.jsx)(f,{color:`error`,children:Se}),(0,Z.jsx)(u,{marginTop:1,children:(0,Z.jsx)(f,{dimColor:!0,italic:!0,children:(0,Z.jsxs)(p,{children:[e.scope!==`managed`&&(0,Z.jsx)(I,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`remove`}),(0,Z.jsx)(I,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]})})})]})}if(typeof w==`object`&&w.type===`mcp-detail`){let e=w.client,n=Pe(d,e.name).length,r=()=>{T({type:`mcp-tools`,client:e})},i=()=>{T(`plugin-list`)},a=e=>{e&&t(e),T(`plugin-list`)},o=e.config.scope,s=e.config.type;return s===`stdio`?(0,Z.jsx)(Fn,{server:{name:e.name,client:e,scope:o,transport:`stdio`,config:e.config},serverToolsCount:n,onViewTools:r,onCancel:i,onComplete:a,borderless:!0}):s===`sse`?(0,Z.jsx)(Nn,{server:{name:e.name,client:e,scope:o,transport:`sse`,isAuthenticated:void 0,config:e.config},serverToolsCount:n,onViewTools:r,onCancel:i,onComplete:a,borderless:!0}):s===`http`?(0,Z.jsx)(Nn,{server:{name:e.name,client:e,scope:o,transport:`http`,isAuthenticated:void 0,config:e.config},serverToolsCount:n,onViewTools:r,onCancel:i,onComplete:a,borderless:!0}):s===`claudeai-proxy`?(0,Z.jsx)(Nn,{server:{name:e.name,client:e,scope:o,transport:`claudeai-proxy`,isAuthenticated:void 0,config:e.config},serverToolsCount:n,onViewTools:r,onCancel:i,onComplete:a,borderless:!0}):(T(`plugin-list`),null)}if(typeof w==`object`&&w.type===`mcp-tools`){let e=w.client,t=e.config.scope,n=e.config.type,r;return r=n===`stdio`?{name:e.name,client:e,scope:t,transport:`stdio`,config:e.config}:n===`sse`?{name:e.name,client:e,scope:t,transport:`sse`,isAuthenticated:void 0,config:e.config}:n===`http`?{name:e.name,client:e,scope:t,transport:`http`,isAuthenticated:void 0,config:e.config}:{name:e.name,client:e,scope:t,transport:`claudeai-proxy`,isAuthenticated:void 0,config:e.config},(0,Z.jsx)(Vn,{server:r,onSelectTool:t=>{T({type:`mcp-tool-detail`,client:e,tool:t})},onBack:()=>T({type:`mcp-detail`,client:e})})}if(typeof w==`object`&&w.type===`mcp-tool-detail`){let{client:e,tool:t}=w,n=e.config.scope,r=e.config.type,i;return i=r===`stdio`?{name:e.name,client:e,scope:n,transport:`stdio`,config:e.config}:r===`sse`?{name:e.name,client:e,scope:n,transport:`sse`,isAuthenticated:void 0,config:e.config}:r===`http`?{name:e.name,client:e,scope:n,transport:`http`,isAuthenticated:void 0,config:e.config}:{name:e.name,client:e,scope:n,transport:`claudeai-proxy`,isAuthenticated:void 0,config:e.config},(0,Z.jsx)(Rn,{tool:t,server:i,onBack:()=>T({type:`mcp-tools`,client:e})})}let Le=he.getVisibleItems(pe);return(0,Z.jsxs)(u,{flexDirection:`column`,children:[(0,Z.jsx)(u,{marginBottom:1,children:(0,Z.jsx)(y,{query:E,isFocused:v,isTerminalFocused:C,width:te-4,cursorOffset:D})}),pe.length===0&&E&&(0,Z.jsx)(u,{marginBottom:1,children:(0,Z.jsxs)(f,{dimColor:!0,children:[`No items match "`,E,`"`]})}),he.scrollPosition.canScrollUp&&(0,Z.jsx)(u,{children:(0,Z.jsxs)(f,{dimColor:!0,children:[` `,a.arrowUp,` more above`]})}),Le.map((e,t)=>{let n=he.toActualIndex(t)===L&&!v,r=t>0?Le[t-1]:null,i=!r||r.scope!==e.scope;return(0,Z.jsxs)(Br.Fragment,{children:[i&&(0,Z.jsx)(u,{marginTop:+(t>0),paddingLeft:2,children:(0,Z.jsx)(f,{dimColor:e.scope!==`flagged`,color:e.scope===`flagged`?`warning`:void 0,bold:e.scope===`flagged`,children:(e=>{switch(e){case`flagged`:return`Flagged`;case`project`:return`Project`;case`local`:return`Local`;case`user`:return`User`;case`enterprise`:return`Enterprise`;case`managed`:return`Managed`;case`builtin`:return`Built-in`;case`dynamic`:return`Built-in`;default:return e}})(e.scope)})}),(0,Z.jsx)(Mr,{item:e,isSelected:n})]},e.id)}),he.scrollPosition.canScrollDown&&(0,Z.jsx)(u,{children:(0,Z.jsxs)(f,{dimColor:!0,children:[` `,a.arrowDown,` more below`]})}),(0,Z.jsx)(u,{marginTop:1,marginLeft:1,children:(0,Z.jsx)(f,{dimColor:!0,italic:!0,children:(0,Z.jsxs)(p,{children:[(0,Z.jsx)(f,{children:`type to search`}),(0,Z.jsx)(I,{action:`plugin:toggle`,context:`Plugin`,fallback:`Space`,description:`toggle`}),(0,Z.jsx)(I,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`details`}),(0,Z.jsx)(I,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]})})}),ae.size>0&&(0,Z.jsx)(u,{marginLeft:1,children:(0,Z.jsx)(f,{dimColor:!0,italic:!0,children:`Run /reload-plugins to apply changes`})})]})}var Br,X,Z,Vr=e((()=>{i(),Br=t(g(),1),X=t(g(),1),j(),C(),Pn(),Ln(),Bn(),Wn(),bn(),Sn(),Ie(),Jt(),nt(),gn(),se(),on(),qe(),yt(),Xt(),mt(),gt(),jt(),rt(),A(),fe(),Re(),Ae(),qt(),Ye(),Ee(),Ue(),ve(),Zt(),wt(),ft(),Vt(),jr(),Qn(),rr(),Nr(),hr(),Z=T()}));function Hr(e){if(!e)return{type:`menu`};let t=e.trim().split(/\s+/);switch(t[0]?.toLowerCase()){case`help`:case`--help`:case`-h`:return{type:`help`};case`install`:case`i`:{let e=t[1];if(!e)return{type:`install`};if(e.includes(`@`)){let[t,n]=e.split(`@`);return{type:`install`,plugin:t,marketplace:n}}return e.startsWith(`http://`)||e.startsWith(`https://`)||e.startsWith(`file://`)||e.includes(`/`)||e.includes(`\\`)?{type:`install`,marketplace:e}:{type:`install`,plugin:e}}case`manage`:return{type:`manage`};case`uninstall`:return{type:`uninstall`,plugin:t[1]};case`enable`:return{type:`enable`,plugin:t[1]};case`disable`:return{type:`disable`,plugin:t[1]};case`validate`:return{type:`validate`,path:t.slice(1).join(` `).trim()||void 0};case`marketplace`:case`market`:{let e=t[1]?.toLowerCase(),n=t.slice(2).join(` `);switch(e){case`add`:return{type:`marketplace`,action:`add`,target:n};case`remove`:case`rm`:return{type:`marketplace`,action:`remove`,target:n};case`update`:return{type:`marketplace`,action:`update`,target:n};case`list`:return{type:`marketplace`,action:`list`};default:return{type:`marketplace`}}}default:return{type:`menu`}}}var Ur=e((()=>{}));function Wr({onComplete:e,path:t}){return(0,Gr.useEffect)(()=>{async function n(){if(!t){e(`Usage: /plugin validate <path>
2
-
3
- Validate a plugin or marketplace manifest file or directory.
4
-
5
- Examples:
6
- /plugin validate .claude-plugin/plugin.json
7
- /plugin validate /path/to/plugin-directory
8
- /plugin validate .
9
-
10
- When given a directory, automatically validates .claude-plugin/marketplace.json
11
- or .claude-plugin/plugin.json (prefers marketplace if both exist).
12
-
13
- Or from the command line:
14
- claude plugin validate <path>`);return}try{let n=await dn(t),r=``;r+=`Validating ${n.fileType} manifest: ${n.filePath}\n\n`,n.errors.length>0&&(r+=`${a.cross} Found ${n.errors.length} ${zt(n.errors.length,`error`)}:\n\n`,n.errors.forEach(e=>{r+=` ${a.pointer} ${e.path}: ${e.message}\n`}),r+=`
15
- `),n.warnings.length>0&&(r+=`${a.warning} Found ${n.warnings.length} ${zt(n.warnings.length,`warning`)}:\n\n`,n.warnings.forEach(e=>{r+=` ${a.pointer} ${e.path}: ${e.message}\n`}),r+=`
16
- `),n.success?(n.warnings.length>0?r+=`${a.tick} Validation passed with warnings\n`:r+=`${a.tick} Validation passed\n`,process.exitCode=0):(r+=`${a.cross} Validation failed\n`,process.exitCode=1),e(r)}catch(t){process.exitCode=2,Mt(t),e(`${a.cross} Unexpected error during validation: ${dt(t)}`)}}n()},[e,t]),(0,Kr.jsx)(u,{flexDirection:`column`,children:(0,Kr.jsx)(f,{children:`Running validation...`})})}var Gr,Kr,qr=e((()=>{i(),g(),Gr=t(g(),1),C(),gt(),jt(),mn(),Vt(),Kr=T()}));function Jr({onComplete:e}){return(0,Q.useEffect)(()=>{async function t(){try{let t=await ae(),n=Object.keys(t);n.length===0?e(`No marketplaces configured`):e(`Configured marketplaces:\n${n.map(e=>` • ${e}`).join(`
17
- `)}`)}catch(t){e(`Error loading marketplaces: ${dt(t)}`)}}t()},[e]),(0,$.jsx)(f,{children:`Loading marketplaces...`})}function Yr(){return process.env.USER_TYPE===`ant`?(0,$.jsxs)(u,{flexDirection:`row`,alignItems:`flex-start`,paddingLeft:1,marginTop:1,borderLeft:!0,borderRight:!1,borderTop:!1,borderBottom:!1,borderColor:`permission`,borderStyle:`single`,children:[(0,$.jsx)(u,{flexShrink:0,children:(0,$.jsxs)(f,{bold:!0,italic:!0,color:`permission`,children:[`i`,` `]})}),(0,$.jsx)(f,{children:`[ANT-ONLY] MCP servers are now managed in /plugins. Use /mcp no-redirect to test old UI`})]}):null}function Xr(e){let t=[];for(let{source:n,scope:r}of[{source:`userSettings`,scope:`user`},{source:`projectSettings`,scope:`project`},{source:`localSettings`,scope:`local`}])xt(n)?.extraKnownMarketplaces?.[e]&&t.push({source:n,scope:r});return{editableSources:t,isInPolicy:!!xt(`policySettings`)?.extraKnownMarketplaces?.[e]}}function Zr(e){let{editableSources:t,isInPolicy:n}=Xr(e);return t.length>0?{kind:`remove-extra-marketplace`,name:e,sources:t}:n?{kind:`managed-only`,name:e}:{kind:`navigate`,tab:`marketplaces`,viewState:{type:`manage-marketplaces`,targetMarketplace:e,action:`remove`}}}function Qr(e){return{kind:`navigate`,tab:`installed`,viewState:{type:`manage-plugins`,targetPlugin:e,action:`uninstall`}}}function $r(e){return si.has(e.type)}function ei(e){if(`pluginId`in e&&e.pluginId)return e.pluginId;if(`plugin`in e&&e.plugin)return e.plugin;if(e.source.includes(`@`))return e.source.split(`@`)[0]}function ti(e,t,n,r,i,a,o){let s=[];for(let e of a){let t=`pluginId`in e?e.pluginId:`plugin`in e?e.plugin:void 0;s.push({label:t??e.source,message:kr(e),guidance:`Restart to retry loading plugins`,action:{kind:`none`}})}let c=new Set;for(let t of e){c.add(t.name);let e=Zr(t.name),n=Xr(t.name),r=n.isInPolicy?`managed`:n.editableSources[0]?.scope;s.push({label:t.name,message:t.error??`Installation failed`,guidance:e.kind===`managed-only`?`Managed by your organization — contact your admin`:void 0,action:e,scope:r})}for(let e of t){let t=`marketplace`in e?e.marketplace:e.source;if(c.has(t))continue;c.add(t);let n=Zr(t),r=Xr(t),i=r.isInPolicy?`managed`:r.editableSources[0]?.scope;s.push({label:t,message:kr(e),guidance:n.kind===`managed-only`?`Managed by your organization — contact your admin`:Ar(e),action:n,scope:i})}for(let e of i)c.has(e.name)||(c.add(e.name),s.push({label:e.name,message:e.error,action:{kind:`remove-installed-marketplace`,name:e.name}}));let l=new Set;for(let e of n){let t=ei(e);if(t&&l.has(t))continue;t&&l.add(t);let n=`marketplace`in e?e.marketplace:void 0,r=t?o.get(e.source)??o.get(t):void 0;s.push({label:t?n?`${t} @ ${n}`:t:e.source,message:kr(e),guidance:Ar(e),action:t?Qr(t):{kind:`none`},scope:r})}for(let e of r)s.push({label:e.source,message:kr(e),guidance:Ar(e),action:{kind:`none`}});return s}function ni(e,t){for(let{source:n}of t){let t=xt(n);if(!t)continue;let r={};if(t.extraKnownMarketplaces?.[e]&&(r.extraKnownMarketplaces={...t.extraKnownMarketplaces,[e]:void 0}),t.enabledPlugins){let n=`@${e}`,i=!1,a={...t.enabledPlugins};for(let e in a)e.endsWith(n)&&(a[e]=void 0,i=!0);i&&(r.enabledPlugins=a)}Object.keys(r).length>0&&Dt(n,r)}}function ri({setViewState:e,setActiveTab:t,markPluginsChanged:n}){let r=oe(e=>e.plugins.errors),i=oe(e=>e.plugins.installationStatus),o=pe(),[s,l]=(0,Q.useState)(0),[d,m]=(0,Q.useState)(null),[h,g]=(0,Q.useState)([]);(0,Q.useEffect)(()=>{(async()=>{try{let{failures:e}=await Qe(await ae());g(e)}catch{}})()},[]);let _=i.marketplaces.filter(e=>e.status===`failed`),v=new Set(_.map(e=>e.name)),y=r.filter($r),b=ti(_,r.filter(e=>(e.type===`marketplace-not-found`||e.type===`marketplace-load-failed`||e.type===`marketplace-blocked-by-policy`)&&!v.has(e.marketplace)),r.filter(e=>$r(e)||e.type===`marketplace-not-found`||e.type===`marketplace-load-failed`||e.type===`marketplace-blocked-by-policy`?!1:ei(e)!==void 0),r.filter(e=>$r(e)||e.type===`marketplace-not-found`||e.type===`marketplace-load-failed`||e.type===`marketplace-blocked-by-policy`?!1:ei(e)===void 0),h,y,Qt());ee(`confirm:no`,()=>{e({type:`menu`})},{context:`Confirmation`}),c({"select:previous":()=>l(e=>Math.max(0,e-1)),"select:next":()=>l(e=>Math.min(b.length-1,e+1)),"select:accept":()=>{let r=b[s];if(!r)return;let{action:i}=r;switch(i.kind){case`navigate`:t(i.tab),e(i.viewState);break;case`remove-extra-marketplace`:{let e=i.sources.map(e=>e.scope).join(`, `);ni(i.name,i.sources),z(),o(e=>({...e,plugins:{...e.plugins,errors:e.plugins.errors.filter(e=>!(`marketplace`in e&&e.marketplace===i.name)),installationStatus:{...e.plugins.installationStatus,marketplaces:e.plugins.installationStatus.marketplaces.filter(e=>e.name!==i.name)}}})),m(`${a.tick} Removed "${i.name}" from ${e} settings`),n();break}case`remove-installed-marketplace`:(async()=>{try{await Je(i.name),z(),g(e=>e.filter(e=>e.name!==i.name)),m(`${a.tick} Removed marketplace "${i.name}"`),n()}catch(e){m(`Failed to remove "${i.name}": ${e instanceof Error?e.message:String(e)}`)}})();break;case`managed-only`:break;case`none`:break}}},{context:`Select`,isActive:b.length>0});let x=Math.min(s,Math.max(0,b.length-1));x!==s&&l(x);let S=b[x]?.action,C=S&&S.kind!==`none`&&S.kind!==`managed-only`;return b.length===0?(0,$.jsxs)(u,{flexDirection:`column`,children:[(0,$.jsx)(u,{marginLeft:1,children:(0,$.jsx)(f,{dimColor:!0,children:`No plugin errors`})}),(0,$.jsx)(u,{marginTop:1,children:(0,$.jsx)(f,{dimColor:!0,italic:!0,children:(0,$.jsx)(I,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})})})]}):(0,$.jsxs)(u,{flexDirection:`column`,children:[b.map((e,t)=>{let n=t===x;return(0,$.jsxs)(u,{marginLeft:1,flexDirection:`column`,marginBottom:1,children:[(0,$.jsxs)(f,{children:[(0,$.jsxs)(f,{color:n?`suggestion`:`error`,children:[n?a.pointer:a.cross,` `]}),(0,$.jsx)(f,{bold:n,children:e.label}),e.scope&&(0,$.jsxs)(f,{dimColor:!0,children:[` (`,e.scope,`)`]})]}),(0,$.jsx)(u,{marginLeft:3,children:(0,$.jsx)(f,{color:`error`,children:e.message})}),e.guidance&&(0,$.jsx)(u,{marginLeft:3,children:(0,$.jsx)(f,{dimColor:!0,italic:!0,children:e.guidance})})]},t)}),d&&(0,$.jsx)(u,{marginTop:1,marginLeft:1,children:(0,$.jsx)(f,{color:`claude`,children:d})}),(0,$.jsx)(u,{marginTop:1,children:(0,$.jsx)(f,{dimColor:!0,italic:!0,children:(0,$.jsxs)(p,{children:[(0,$.jsx)(I,{action:`select:previous`,context:`Select`,fallback:`↑`,description:`navigate`}),C&&(0,$.jsx)(I,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`resolve`}),(0,$.jsx)(I,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]})})})]})}function ii(e){switch(e.type){case`help`:return{type:`help`};case`validate`:return{type:`validate`,path:e.path};case`install`:return e.marketplace?{type:`browse-marketplace`,targetMarketplace:e.marketplace,targetPlugin:e.plugin}:e.plugin?{type:`discover-plugins`,targetPlugin:e.plugin}:{type:`discover-plugins`};case`manage`:return{type:`manage-plugins`};case`uninstall`:return{type:`manage-plugins`,targetPlugin:e.plugin,action:`uninstall`};case`enable`:return{type:`manage-plugins`,targetPlugin:e.plugin,action:`enable`};case`disable`:return{type:`manage-plugins`,targetPlugin:e.plugin,action:`disable`};case`marketplace`:return e.action===`list`?{type:`marketplace-list`}:e.action===`add`?{type:`add-marketplace`,initialValue:e.target}:e.action===`remove`?{type:`manage-marketplaces`,targetMarketplace:e.target,action:`remove`}:e.action===`update`?{type:`manage-marketplaces`,targetMarketplace:e.target,action:`update`}:{type:`marketplace-menu`};default:return{type:`discover-plugins`}}}function ai(e){return e.type===`manage-plugins`?`installed`:e.type===`manage-marketplaces`?`marketplaces`:`discover`}function oi({onComplete:e,args:t,showMcpRedirectMessage:n}){let r=Hr(t),i=ii(r),[a,o]=(0,Q.useState)(i),[s,c]=(0,Q.useState)(ai(i)),[l,d]=(0,Q.useState)(a.type===`add-marketplace`&&a.initialValue||``),[p,m]=(0,Q.useState)(0),[h,g]=(0,Q.useState)(null),[_,v]=(0,Q.useState)(null),[y,x]=(0,Q.useState)(!1),C=pe(),w=oe(e=>{let t=e.plugins.errors.length;for(let n of e.plugins.installationStatus.marketplaces)n.status===`failed`&&t++;return t}),T=w>0?`Errors (${w})`:`Errors`,E=vn(),ne=r.type===`marketplace`&&r.action===`add`&&r.target!==void 0,D=(0,Q.useCallback)(()=>{C(e=>e.plugins.needsRefresh?e:{...e,plugins:{...e.plugins,needsRefresh:!0}})},[C]),O=(0,Q.useCallback)(e=>{let t=e;switch(c(t),g(null),t){case`discover`:o({type:`discover-plugins`});break;case`installed`:o({type:`manage-plugins`});break;case`marketplaces`:o({type:`manage-marketplaces`});break;case`errors`:break}},[]);return(0,Q.useEffect)(()=>{a.type===`menu`&&!_&&e()},[a.type,_,e]),(0,Q.useEffect)(()=>{a.type===`browse-marketplace`&&s!==`discover`&&c(`discover`)},[a.type,s]),ee(`confirm:no`,(0,Q.useCallback)(()=>{c(`marketplaces`),o({type:`manage-marketplaces`}),d(``),g(null)},[]),{context:`Settings`,isActive:a.type===`add-marketplace`}),(0,Q.useEffect)(()=>{_&&e(_)},[_,e]),(0,Q.useEffect)(()=>{a.type===`help`&&e()},[a.type,e]),a.type===`help`?(0,$.jsxs)(u,{flexDirection:`column`,children:[(0,$.jsx)(f,{bold:!0,children:`Plugin Command Usage:`}),(0,$.jsx)(f,{children:` `}),(0,$.jsx)(f,{dimColor:!0,children:`Installation:`}),(0,$.jsx)(f,{children:` /plugin install - Browse and install plugins`}),(0,$.jsx)(f,{children:` /plugin install <marketplace> - Install from specific marketplace`}),(0,$.jsx)(f,{children:` /plugin install <plugin> - Install specific plugin`}),(0,$.jsx)(f,{children:` /plugin install <plugin>@<market> - Install plugin from marketplace`}),(0,$.jsx)(f,{children:` `}),(0,$.jsx)(f,{dimColor:!0,children:`Management:`}),(0,$.jsx)(f,{children:` /plugin manage - Manage installed plugins`}),(0,$.jsx)(f,{children:` /plugin enable <plugin> - Enable a plugin`}),(0,$.jsx)(f,{children:` /plugin disable <plugin> - Disable a plugin`}),(0,$.jsx)(f,{children:` /plugin uninstall <plugin> - Uninstall a plugin`}),(0,$.jsx)(f,{children:` `}),(0,$.jsx)(f,{dimColor:!0,children:`Marketplaces:`}),(0,$.jsx)(f,{children:` /plugin marketplace - Marketplace management menu`}),(0,$.jsx)(f,{children:` /plugin marketplace add - Add a marketplace`}),(0,$.jsx)(f,{children:` /plugin marketplace add <path/url> - Add marketplace directly`}),(0,$.jsx)(f,{children:` /plugin marketplace update - Update marketplaces`}),(0,$.jsx)(f,{children:` /plugin marketplace update <name> - Update specific marketplace`}),(0,$.jsx)(f,{children:` /plugin marketplace remove - Remove a marketplace`}),(0,$.jsx)(f,{children:` /plugin marketplace remove <name> - Remove specific marketplace`}),(0,$.jsx)(f,{children:` /plugin marketplace list - List all marketplaces`}),(0,$.jsx)(f,{children:` `}),(0,$.jsx)(f,{dimColor:!0,children:`Validation:`}),(0,$.jsx)(f,{children:` /plugin validate <path> - Validate a manifest file or directory`}),(0,$.jsx)(f,{children:` `}),(0,$.jsx)(f,{dimColor:!0,children:`Other:`}),(0,$.jsx)(f,{children:` /plugin - Main plugin menu`}),(0,$.jsx)(f,{children:` /plugin help - Show this help`}),(0,$.jsx)(f,{children:` /plugins - Alias for /plugin`})]}):a.type===`validate`?(0,$.jsx)(Wr,{onComplete:e,path:a.path}):a.type===`marketplace-menu`?(o({type:`menu`}),null):a.type===`marketplace-list`?(0,$.jsx)(Jr,{onComplete:e}):a.type===`add-marketplace`?(0,$.jsx)(Gn,{inputValue:l,setInputValue:d,cursorOffset:p,setCursorOffset:m,error:h,setError:g,result:_,setResult:v,setViewState:o,onAddComplete:D,cliMode:ne}):(0,$.jsx)(te,{color:`suggestion`,children:(0,$.jsxs)(S,{title:`Plugins`,selectedTab:s,onTabChange:O,color:`suggestion`,disableNavigation:y,banner:n&&s===`installed`?(0,$.jsx)(Yr,{}):void 0,children:[(0,$.jsx)(b,{id:`discover`,title:`Discover`,children:a.type===`browse-marketplace`?(0,$.jsx)(gr,{error:h,setError:g,result:_,setResult:v,setViewState:o,onInstallComplete:D,targetMarketplace:a.targetMarketplace,targetPlugin:a.targetPlugin}):(0,$.jsx)(br,{error:h,setError:g,result:_,setResult:v,setViewState:o,onInstallComplete:D,onSearchModeChange:x,targetPlugin:a.type===`discover-plugins`?a.targetPlugin:void 0})}),(0,$.jsx)(b,{id:`installed`,title:`Installed`,children:(0,$.jsx)(zr,{setViewState:o,setResult:v,onManageComplete:D,onSearchModeChange:x,targetPlugin:a.type===`manage-plugins`?a.targetPlugin:void 0,targetMarketplace:a.type===`manage-plugins`?a.targetMarketplace:void 0,action:a.type===`manage-plugins`?a.action:void 0})}),(0,$.jsx)(b,{id:`marketplaces`,title:`Marketplaces`,children:(0,$.jsx)(Tr,{setViewState:o,error:h,setError:g,setResult:v,exitState:E,onManageComplete:D,targetMarketplace:a.type===`manage-marketplaces`?a.targetMarketplace:void 0,action:a.type===`manage-marketplaces`?a.action:void 0})}),(0,$.jsx)(b,{id:`errors`,title:T,children:(0,$.jsx)(ri,{setViewState:o,setActiveTab:c,markPluginsChanged:D})})]})})}var Q,$,si,ci=e((()=>{i(),g(),Q=t(g(),1),j(),C(),yn(),Jt(),qe(),gt(),rt(),_e(),fe(),Zt(),wt(),qn(),yr(),wr(),Or(),Vr(),jr(),Ur(),qr(),$=T(),si=new Set([`git-auth-failed`,`git-timeout`,`network-error`])}));export{Rn as a,Ln as c,Wn as i,Nn as l,ci as n,Bn as o,Vn as r,Fn as s,oi as t,Pn as u};
@@ -1 +0,0 @@
1
- import{a as e}from"./rolldown-runtime-DaDcL9Zw.js";import{l as t,o as n,s as r}from"./envUtils-DSxRz_kt.js";import{n as i,t as a}from"./defineProperty-C-QyHrDq.js";import{Kr as o,qr as s}from"./src-CDCSSo0U2.js";import{Tt as c,en as l,et as u,ht as d,kt as f,tn as p}from"./state-ix0xIunV.js";import{$ as m,AE as h,BT as g,Cb as _,Eb as v,Gn as y,Gp as ee,Hw as b,KO as te,Kn as ne,Nl as re,Pl as ie,Qi as x,Sn as ae,UO as S,Uw as C,Wp as w,Xi as oe,YT as T,Yw as E,Zw as D,_O as se,et as O,ew as ce,fs as k,gO as le,jE as ue,jr as A,kE as de,kb as fe,lo as pe,lr as j,lt as M,ms as me,nw as he,oo as ge,op as N,rt as _e,rw as P,si as F,tw as ve,ut as I,xn as L,zT as ye,zo as R}from"./loadAgentsDir-BURvZNN6.js";import{n as z,t as be}from"./cwd-CYmmnQVS.js";import{N as xe,P as Se,c as Ce,g as we}from"./config-DiT2Z8dY.js";import{Y as Te,i as Ee,o as De}from"./log-BMCygSzM.js";import{C as Oe,X as B,_ as V,tt as ke,u as Ae}from"./model-BIVmcl_N.js";import{En as je,Tn as Me,ct as H,dt as U}from"./prompt-DNDgGM9q.js";import{i as W,o as Ne}from"./fileStateCache-DDW5toIs.js";import{P as Pe,lt as G,st as Fe}from"./rcDebugLog-DoL1FpGJ.js";import{a as Ie,n as Le,r as Re}from"./mappers-Q_Z3Kjo-.js";import{c as ze,n as Be,o as Ve,r as K,s as He}from"./MessageSelector-DOB1S2-O.js";import{n as Ue,t as We}from"./systemTheme-Ceakddth.js";import{randomUUID as q}from"crypto";n(),i(),o(),l(),z(),Te(),De(),Se(),we(),ke(),Me(),le(),U(),Ne(),Pe(),g(),D(),fe(),N(),re(),k(),R(),x(),A(),y(),L(),O(),I(),ue(),C(),V(),T(),S();async function Ge({tools:e,mainLoopModel:t,additionalWorkingDirectories:n,mcpClients:r,customSystemPrompt:i}){let[a,o,s]=await Promise.all([i===void 0?M(e,t,n,r):Promise.resolve([]),h(),i===void 0?de():Promise.resolve({})]);return{defaultSystemPrompt:a,userContext:o,systemContext:s}}async function Ke({tools:e,commands:t,mcpClients:n,messages:r,readFileState:i,getAppState:a,setAppState:o,customSystemPrompt:s,appendSystemPrompt:c,thinkingConfig:l,agents:u}){let d=Ae(),f=a(),{defaultSystemPrompt:p,userContext:m,systemContext:h}=await Ge({tools:e,mainLoopModel:d,additionalWorkingDirectories:Array.from(f.toolPermissionContext.additionalWorkingDirectories.keys()),mcpClients:n,customSystemPrompt:s}),g=Fe([...s===void 0?p:[s],...c?[c]:[]]),_=r.at(-1),v=_?.type===`assistant`&&_.message.stop_reason===null?r.slice(0,-1):r;return{systemPrompt:g,userContext:m,systemContext:h,toolUseContext:{options:{commands:t,debug:!1,mainLoopModel:d,tools:e,verbose:!1,thinkingConfig:l??(te()===!1?{type:`disabled`}:{type:`adaptive`}),mcpClients:n,mcpResources:{},isNonInteractiveSession:!0,agentDefinitions:{activeAgents:u,allAgents:[]},customSystemPrompt:s,appendSystemPrompt:c},abortController:b(),readFileState:i,getAppState:a,setAppState:o,messages:v,setInProgressToolUseIDs:()=>{},setResponseLength:()=>{},updateFileHistoryState:()=>{},updateAttributionState:()=>{}},forkContextMessages:v}}C(),V(),w(),T(),We(),S(),Le(),ve();var qe=()=>{try{return K(),e(Be)}catch{return null}},J=class{constructor(e){a(this,`config`,void 0),a(this,`mutableMessages`,void 0),a(this,`abortController`,void 0),a(this,`permissionDenials`,void 0),a(this,`totalUsage`,void 0),a(this,`hasHandledOrphanedPermission`,!1),a(this,`readFileState`,void 0),a(this,`discoveredSkillNames`,new Set),a(this,`loadedNestedMemoryPaths`,new Set),this.config=e,this.mutableMessages=e.initialMessages??[],this.abortController=e.abortController??b(),this.permissionDenials=[],this.readFileState=e.readFileCache,this.totalUsage=G}async*submitMessage(e,n){let{cwd:i,commands:a,tools:o,mcpClients:l,verbose:h=!1,thinkingConfig:g,maxTurns:y,maxBudgetUsd:b,taskBudget:re,canUseTool:x,customSystemPrompt:S,appendSystemPrompt:C,userSpecifiedModel:w,fallbackModel:T,jsonSchema:D,getAppState:O,setAppState:k,replayUserMessages:le=!1,includePartialMessages:ue=!1,agents:A=[],setSDKStatus:de,orphanedPermission:fe}=this.config;this.discoveredSkillNames.clear(),this.permissionDenials=[],ee(i);let M=!p(),N=Date.now(),ve=async(e,t,n,r,i,a)=>{let o=await x(e,t,n,r,i,a);return o.behavior!==`allow`&&this.permissionDenials.push({type:`permission_denial`,tool_name:He(e.name),tool_use_id:i,tool_input:t}),o},I=O(),L=w?Oe(w):Ae(),R=g||(te()===!1?{type:`disabled`}:{type:`adaptive`});E(`before_getSystemPrompt`);let z=typeof S==`string`?S:void 0,{defaultSystemPrompt:Se,userContext:we,systemContext:Te}=await Ge({tools:o,mainLoopModel:L,additionalWorkingDirectories:Array.from(I.toolPermissionContext.additionalWorkingDirectories.keys()),mcpClients:l,customSystemPrompt:z});E(`after_getSystemPrompt`);let De={...we},V=z!==void 0&&xe()?await ne():null,ke=Fe([...z===void 0?Se:[z],...V?[V]:[],...C?[C]:[]]),Me=o.some(e=>je(e,H));D&&Me&&ae(k,d());let U={messages:this.mutableMessages,setMessages:e=>{this.mutableMessages=e(this.mutableMessages)},onChangeAPIKey:()=>{},handleElicitation:this.config.handleElicitation,options:{commands:a,debug:!1,tools:o,verbose:h,mainLoopModel:L,thinkingConfig:R,mcpClients:l,mcpResources:{},ideInstallationStatus:null,isNonInteractiveSession:!0,customSystemPrompt:S,appendSystemPrompt:C,agentDefinitions:{activeAgents:A,allAgents:[]},theme:Ue(Ce().theme),maxBudgetUsd:b},getAppState:O,setAppState:k,abortController:this.abortController,readFileState:this.readFileState,nestedMemoryAttachmentTriggers:new Set,loadedNestedMemoryPaths:this.loadedNestedMemoryPaths,dynamicSkillDirTriggers:new Set,discoveredSkillNames:this.discoveredSkillNames,setInProgressToolUseIDs:()=>{},setResponseLength:()=>{},updateFileHistoryState:e=>{k(t=>{let n=e(t.fileHistory);return n===t.fileHistory?t:{...t,fileHistory:n}})},updateAttributionState:e=>{k(t=>{let n=e(t.attribution);return n===t.attribution?t:{...t,attribution:n}})},setSDKStatus:de};if(fe&&!this.hasHandledOrphanedPermission){this.hasHandledOrphanedPermission=!0;for await(let e of ce(fe,o,this.mutableMessages,U))yield e}let{messages:W,shouldQuery:Ne,allowedTools:Pe,model:Le,resultText:Be}=await ze({input:e,mode:`prompt`,setToolJSX:()=>{},context:{...U,messages:this.mutableMessages},messages:this.mutableMessages,uuid:n?.uuid,isMeta:n?.isMeta,querySource:`sdk`});this.mutableMessages.push(...W);let K=[...this.mutableMessages];if(M&&W.length>0){let e=F(K);r()||(await e,(t(process.env.CLAUDE_CODE_EAGER_FLUSH)||t(process.env.CLAUDE_CODE_IS_COWORK))&&await j())}let We=qe(),Ke=W.filter(e=>e.type===`user`&&!e.isMeta&&!e.toolUseResult&&(We?.selectableUserMessagesFilter(e)??!0)||e.type===`system`&&e.subtype===`compact_boundary`),J=le?Ke:[];k(e=>({...e,toolPermissionContext:{...e.toolPermissionContext,alwaysAllowRules:{...e.toolPermissionContext.alwaysAllowRules,command:Pe}}}));let Y=Le??L;U={messages:K,setMessages:()=>{},onChangeAPIKey:()=>{},handleElicitation:this.config.handleElicitation,options:{commands:a,debug:!1,tools:o,verbose:h,mainLoopModel:Y,thinkingConfig:R,mcpClients:l,mcpResources:{},ideInstallationStatus:null,isNonInteractiveSession:!0,customSystemPrompt:S,appendSystemPrompt:C,theme:Ue(Ce().theme),agentDefinitions:{activeAgents:A,allAgents:[]},maxBudgetUsd:b},getAppState:O,setAppState:k,abortController:this.abortController,readFileState:this.readFileState,nestedMemoryAttachmentTriggers:new Set,loadedNestedMemoryPaths:this.loadedNestedMemoryPaths,dynamicSkillDirTriggers:new Set,discoveredSkillNames:this.discoveredSkillNames,setInProgressToolUseIDs:()=>{},setResponseLength:()=>{},updateFileHistoryState:U.updateFileHistoryState,updateAttributionState:U.updateAttributionState,setSDKStatus:de},E(`before_skills_plugins`);let[Je,{enabled:Ye}]=await Promise.all([oe(be()),me()]);if(E(`after_skills_plugins`),yield Ve({tools:o,mcpClients:l,model:Y,permissionMode:I.toolPermissionContext.mode,commands:a,agents:A,skills:Je,plugins:Ye,fastMode:I.fastMode}),E(`system_message_yielded`),!Ne){for(let e of W)if(e.type===`user`&&typeof e.message.content==`string`&&(e.message.content.includes(`<local-command-stdout>`)||e.message.content.includes(`<local-command-stderr>`)||e.isCompactSummary)&&(yield{type:`user`,message:{...e.message,content:s(e.message.content)},session_id:d(),parent_tool_use_id:null,uuid:e.uuid,timestamp:e.timestamp,isReplay:!e.isCompactSummary,isSynthetic:e.isMeta||e.isVisibleInTranscriptOnly}),e.type===`system`&&e.subtype===`local_command`&&typeof e.content==`string`&&(e.content.includes(`<local-command-stdout>`)||e.content.includes(`<local-command-stderr>`))&&(yield Re(e.content,e.uuid)),e.type===`system`&&e.subtype===`compact_boundary`){let t=e;yield{type:`system`,subtype:`compact_boundary`,session_id:d(),uuid:e.uuid,compact_metadata:Ie(t.compactMetadata)}}M&&(await F(K),(t(process.env.CLAUDE_CODE_EAGER_FLUSH)||t(process.env.CLAUDE_CODE_IS_COWORK))&&await j()),yield{type:`result`,subtype:`success`,is_error:!1,duration_ms:Date.now()-N,duration_api_ms:c(),num_turns:K.length-1,result:Be??``,stop_reason:null,session_id:d(),total_cost_usd:f(),usage:this.totalUsage,modelUsage:u(),permission_denials:this.permissionDenials,fast_mode_state:B(Y,I.fastMode),uuid:q()};return}if(_()&&M){let e=qe()?.selectableUserMessagesFilter??(e=>!0);W.filter(e).forEach(e=>{v(e=>{k(t=>({...t,fileHistory:e(t.fileHistory)}))},e.uuid)})}let X=G,Z=1,Xe=!1,Ze,Q=null,Qe=Ee().at(-1),$e=D?pe(this.mutableMessages,H):0;for await(let e of ie({messages:K,systemPrompt:ke,userContext:De,systemContext:Te,canUseTool:ve,toolUseContext:U,fallbackModel:T,querySource:`sdk`,maxTurns:y,taskBudget:re})){if(e.type===`assistant`||e.type===`user`||e.type===`system`&&e.subtype===`compact_boundary`){if(M&&e.type===`system`&&e.subtype===`compact_boundary`){let t=e.compactMetadata?.preservedSegment?.tailUuid;if(t){let e=this.mutableMessages.findLastIndex(e=>e.uuid===t);e!==-1&&await F(this.mutableMessages.slice(0,e+1))}}if(K.push(e),M&&(e.type===`assistant`?F(K):await F(K)),!Xe&&J.length>0){Xe=!0;for(let e of J)e.type===`user`&&(yield{type:`user`,message:e.message,session_id:d(),parent_tool_use_id:null,uuid:e.uuid,timestamp:e.timestamp,isReplay:!0})}}switch(e.type===`user`&&Z++,e.type){case`tombstone`:break;case`assistant`:{let t=e,n=t.message?.stop_reason;n!=null&&(Q=n),this.mutableMessages.push(t),yield*P(t);break}case`progress`:{let t=e;this.mutableMessages.push(t),M&&(K.push(t),F(K)),yield*P(t);break}case`user`:{let t=e;this.mutableMessages.push(t),yield*P(t);break}case`stream_event`:{let t=e.event;if(t.type===`message_start`){X=G;let e=t.message;X=_e(X,e.usage)}if(t.type===`message_delta`){X=_e(X,t.usage);let e=t.delta;e.stop_reason!=null&&(Q=e.stop_reason)}t.type===`message_stop`&&(this.totalUsage=m(this.totalUsage,X)),ue&&(yield{type:`stream_event`,event:t,session_id:d(),parent_tool_use_id:null,uuid:q()});break}case`attachment`:{let n=e;this.mutableMessages.push(n),M&&(K.push(n),F(K));let r=n.attachment;if(r.type===`structured_output`)Ze=r.data;else if(r.type===`max_turns_reached`){M&&(t(process.env.CLAUDE_CODE_EAGER_FLUSH)||t(process.env.CLAUDE_CODE_IS_COWORK))&&await j(),yield{type:`result`,subtype:`error_max_turns`,duration_ms:Date.now()-N,duration_api_ms:c(),is_error:!0,num_turns:r.turnCount,stop_reason:Q,session_id:d(),total_cost_usd:f(),usage:this.totalUsage,modelUsage:u(),permission_denials:this.permissionDenials,fast_mode_state:B(Y,I.fastMode),uuid:q(),errors:[`Reached maximum number of turns (${r.maxTurns})`]};return}else le&&r.type===`queued_command`&&(yield{type:`user`,message:{role:`user`,content:r.prompt},session_id:d(),parent_tool_use_id:null,uuid:r.source_uuid||n.uuid,timestamp:n.timestamp,isReplay:!0});break}case`stream_request_start`:break;case`system`:{let t=e,n=this.config.snipReplay?.(t,this.mutableMessages);if(n!==void 0){n.executed&&(this.mutableMessages.length=0,this.mutableMessages.push(...n.messages));break}if(this.mutableMessages.push(t),t.subtype===`compact_boundary`&&t.compactMetadata){let e=t,n=this.mutableMessages.length-1;n>0&&this.mutableMessages.splice(0,n);let r=K.length-1;r>0&&K.splice(0,r),yield{type:`system`,subtype:`compact_boundary`,session_id:d(),uuid:t.uuid,compact_metadata:Ie(e.compactMetadata)}}if(t.subtype===`api_error`){let e=t;yield{type:`system`,subtype:`api_retry`,attempt:e.retryAttempt,max_retries:e.maxRetries,retry_delay_ms:e.retryInMs,error_status:e.error.status??null,error:ye(e.error),session_id:d(),uuid:t.uuid}}break}case`tool_use_summary`:{let t=e;yield{type:`tool_use_summary`,summary:t.summary,preceding_tool_use_ids:t.precedingToolUseIds,session_id:d(),uuid:t.uuid};break}}if(b!==void 0&&f()>=b){M&&(t(process.env.CLAUDE_CODE_EAGER_FLUSH)||t(process.env.CLAUDE_CODE_IS_COWORK))&&await j(),yield{type:`result`,subtype:`error_max_budget_usd`,duration_ms:Date.now()-N,duration_api_ms:c(),is_error:!0,num_turns:Z,stop_reason:Q,session_id:d(),total_cost_usd:f(),usage:this.totalUsage,modelUsage:u(),permission_denials:this.permissionDenials,fast_mode_state:B(Y,I.fastMode),uuid:q(),errors:[`Reached maximum budget ($${b}). Increase the limit with --max-budget-usd or start a new session.`]};return}if(e.type===`user`&&D){let e=pe(this.mutableMessages,H)-$e,n=parseInt(process.env.MAX_STRUCTURED_OUTPUT_RETRIES||`5`,10);if(e>=n){M&&(t(process.env.CLAUDE_CODE_EAGER_FLUSH)||t(process.env.CLAUDE_CODE_IS_COWORK))&&await j(),yield{type:`result`,subtype:`error_max_structured_output_retries`,duration_ms:Date.now()-N,duration_api_ms:c(),is_error:!0,num_turns:Z,stop_reason:Q,session_id:d(),total_cost_usd:f(),usage:this.totalUsage,modelUsage:u(),permission_denials:this.permissionDenials,fast_mode_state:B(Y,I.fastMode),uuid:q(),errors:[`Failed to provide valid structured output after ${n} attempts`]};return}}}let $=K.findLast(e=>e.type===`assistant`||e.type===`user`),et=$?.type??`undefined`,tt=$?.type===`assistant`?se($.message.content)?.type??`none`:`n/a`;if(M&&(t(process.env.CLAUDE_CODE_EAGER_FLUSH)||t(process.env.CLAUDE_CODE_IS_COWORK))&&await j(),!he($,Q)){yield{type:`result`,subtype:`error_during_execution`,duration_ms:Date.now()-N,duration_api_ms:c(),is_error:!0,num_turns:Z,stop_reason:Q,session_id:d(),total_cost_usd:f(),usage:this.totalUsage,modelUsage:u(),permission_denials:this.permissionDenials,fast_mode_state:B(Y,I.fastMode),uuid:q(),errors:(()=>{let e=Ee(),t=Qe?e.lastIndexOf(Qe)+1:0;return[`[ede_diagnostic] result_type=${et} last_content_type=${tt} stop_reason=${Q}`,...e.slice(t).map(e=>e.error)]})()};return}let nt=``,rt=!1;if($.type===`assistant`){let e=se($.message.content);e?.type===`text`&&!ge.has(e.text)&&(nt=e.text),rt=!!$.isApiErrorMessage}yield{type:`result`,subtype:`success`,is_error:rt,duration_ms:Date.now()-N,duration_api_ms:c(),num_turns:Z,result:nt,stop_reason:Q,session_id:d(),total_cost_usd:f(),usage:this.totalUsage,modelUsage:u(),permission_denials:this.permissionDenials,structured_output:Ze,fast_mode_state:B(Y,I.fastMode),uuid:q()}}interrupt(){this.abortController.abort()}resetAbortController(){this.abortController=b()}getAbortSignal(){return this.abortController.signal}getMessages(){return this.mutableMessages}getReadFileState(){return this.readFileState}getSessionId(){return d()}setModel(e){this.config.userSpecifiedModel=e}};async function*Y({commands:e,prompt:t,promptUuid:n,isMeta:r,cwd:i,tools:a,mcpClients:o,verbose:s=!1,thinkingConfig:c,maxTurns:l,maxBudgetUsd:u,taskBudget:d,canUseTool:f,mutableMessages:p=[],getReadFileCache:m,setReadFileCache:h,customSystemPrompt:g,appendSystemPrompt:_,userSpecifiedModel:v,fallbackModel:y,jsonSchema:ee,getAppState:b,setAppState:te,abortController:ne,replayUserMessages:re=!1,includePartialMessages:ie=!1,handleElicitation:x,agents:ae=[],setSDKStatus:S,orphanedPermission:C}){let w=new J({cwd:i,tools:a,commands:e,mcpClients:o,agents:ae??[],canUseTool:f,getAppState:b,setAppState:te,initialMessages:p,readFileCache:W(m()),customSystemPrompt:g,appendSystemPrompt:_,userSpecifiedModel:v,fallbackModel:y,thinkingConfig:c,maxTurns:l,maxBudgetUsd:u,taskBudget:d,jsonSchema:ee,verbose:s,handleElicitation:x,replayUserMessages:re,includePartialMessages:ie,setSDKStatus:S,abortController:ne,orphanedPermission:C});try{yield*w.submitMessage(t,{uuid:n,isMeta:r})}finally{h(w.getReadFileState())}}export{Y as n,Ke as r,J as t};