@readmagic/workmate 0.0.8 → 0.0.9

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 (501) hide show
  1. package/dist/chunks/AddWorkspaceDirectory-qFZy3FOD.js +1 -0
  2. package/dist/chunks/App-DW4elk6E.js +1 -0
  3. package/dist/chunks/ApproveApiKey-D05WywHU.js +1 -0
  4. package/dist/chunks/ApproveApiKey-DHAbdwkC.js +1 -0
  5. package/dist/chunks/BackgroundTasksDialog-QgFwoaaC.js +2 -0
  6. package/dist/chunks/BypassPermissionsModeDialog-BuRFF1fQ.js +1 -0
  7. package/dist/chunks/ClaudeMdExternalIncludesDialog-CDrArsSX.js +1 -0
  8. package/dist/chunks/ClaudeMdExternalIncludesDialog-DpecRCAt.js +1 -0
  9. package/dist/chunks/ConsoleOAuthFlow-D1MYL1dJ.js +1 -0
  10. package/dist/chunks/DiffDialog-BIcwpgSr.js +6 -0
  11. package/dist/chunks/Doctor-D160J8Ad.js +3 -0
  12. package/dist/chunks/Doctor-VhJi2cmL.js +1 -0
  13. package/dist/chunks/ExitFlow-CoWHhKHJ.js +2 -0
  14. package/dist/chunks/Grove-BmirUB6V.js +11 -0
  15. package/dist/chunks/{HybridTransport-BJPOG2wl.js → HybridTransport-BVmSUHf0.js} +1 -1
  16. package/dist/chunks/InvalidConfigDialog-WRywkKeS.js +1 -0
  17. package/dist/chunks/InvalidSettingsDialog-C4n3A72C.js +1 -0
  18. package/dist/chunks/MCPConnectionManager-DPFe4hPh.js +1 -0
  19. package/dist/chunks/MCPToolListView-BPmE0C2o.js +1 -0
  20. package/dist/chunks/McpParsingWarnings-CH4yyMAL.js +1 -0
  21. package/dist/chunks/MessageSelector-kOn2GaU-.js +3 -0
  22. package/dist/chunks/Messages-4EnHFeh1.js +11 -0
  23. package/dist/chunks/Onboarding-BboWs1pp.js +1 -0
  24. package/dist/chunks/{PermissionDialog-0ya1CU5k.js → PermissionDialog-Cb3z8OUP.js} +1 -1
  25. package/dist/chunks/{PressEnterToContinue-Dl9Hg9Mf.js → PressEnterToContinue-Dq0Imo9c.js} +1 -1
  26. package/dist/chunks/PromptInputFooterSuggestions-BpC9COmh.js +1 -0
  27. package/dist/chunks/PromptInputHelpMenu-BvcAzbSi.js +1 -0
  28. package/dist/chunks/QueryEngine-J6ElcO16.js +1 -0
  29. package/dist/chunks/REPL-DBjbAJsm.js +133 -0
  30. package/dist/chunks/REPL-oBemMXvp.js +1 -0
  31. package/dist/chunks/RemoteSessionManager-CoIyFKKa.js +2 -0
  32. package/dist/chunks/ResumeConversation-wBG8OD9P.js +1 -0
  33. package/dist/chunks/{SSETransport-CrwbKuVt.js → SSETransport-1KBBUikF.js} +1 -1
  34. package/dist/chunks/{SearchBox-vfLXEPed.js → SearchBox-C9vUA4IM.js} +1 -1
  35. package/dist/chunks/SearchExtraToolsTool-BugrzImr.js +1 -0
  36. package/dist/chunks/Settings-DptKuJE7.js +2 -0
  37. package/dist/chunks/TeleportProgress-BmgPAZAi.js +1 -0
  38. package/dist/chunks/TeleportRepoMismatchDialog-sgxNOeM_.js +1 -0
  39. package/dist/chunks/TeleportResumeWrapper-GptvrUdv.js +1 -0
  40. package/dist/chunks/ThemePicker-gAMqqD1P.js +1 -0
  41. package/dist/chunks/{TrustDialog-BukWGvHZ.js → TrustDialog-CWt-4Evl.js} +1 -1
  42. package/dist/chunks/{ValidationErrorsList-DokTJQwi.js → ValidationErrorsList-De3kzHtz.js} +1 -1
  43. package/dist/chunks/{WelcomeV2-Ci9VwPYh.js → WelcomeV2-BWF-cJOu.js} +1 -1
  44. package/dist/chunks/add-dir-DBVT1cEK.js +1 -0
  45. package/dist/chunks/{agentDisplay-DBQYOaOh.js → agentDisplay-5gnCQwUY.js} +1 -1
  46. package/dist/chunks/{agents-HlKk68Qc.js → agents-Bz1MLp4A.js} +1 -1
  47. package/dist/chunks/agents-CnwTOlqO.js +103 -0
  48. package/dist/chunks/allErrors-DYw_q14e.js +1 -0
  49. package/dist/chunks/analytics-DJobLaWP.js +1 -0
  50. package/dist/chunks/api-DXDXTFGa.js +1 -0
  51. package/dist/chunks/{api-CF5IVtj0.js → api-DzccRM_z.js} +1 -1
  52. package/dist/chunks/auth-Cjnyy10u.js +15 -0
  53. package/dist/chunks/auth-CnLb6RWc.js +1 -0
  54. package/dist/chunks/auth-D-SGHS0K.js +1 -0
  55. package/dist/chunks/{autoMode-Cr0AhS1G.js → autoMode-CQ5nqP9c.js} +4 -4
  56. package/dist/chunks/{autonomy-ARUQt-Lu.js → autonomy-CPUCe-YU.js} +1 -1
  57. package/dist/chunks/autonomy-dSJl0hN1.js +15 -0
  58. package/dist/chunks/{autonomyPanel-BQK9MoeB.js → autonomyPanel-Ccr9ilei.js} +1 -1
  59. package/dist/chunks/backgroundHousekeeping--cs5crp7.js +17 -0
  60. package/dist/chunks/backgroundHousekeeping-CcbHitKC.js +1 -0
  61. package/dist/chunks/{banner-Ca7rki2V.js → banner-BJZNMppT.js} +1 -1
  62. package/dist/chunks/bg-DWloqGwk.js +1 -0
  63. package/dist/chunks/{bg-DxRHF1yn.js → bg-w3Vlsm3Y.js} +2 -2
  64. package/dist/chunks/branch-CG0AKS1J.js +3 -0
  65. package/dist/chunks/{break-cache-BKvoMOZx.js → break-cache-DXV0brco.js} +2 -2
  66. package/dist/chunks/bridgeConfig-Dmc1ZDev.js +1 -0
  67. package/dist/chunks/{bridgeConfig-jDEva6Eh.js → bridgeConfig-vORehbGG.js} +1 -1
  68. package/dist/chunks/{bridgeMessaging-YqYdl6ej.js → bridgeMessaging-DlczTV9X.js} +1 -1
  69. package/dist/chunks/{bridgePointer-DIM0sj0x.js → bridgePointer-D4W9GpWw.js} +1 -1
  70. package/dist/chunks/btw-DDUC_t0w.js +1 -0
  71. package/dist/chunks/caches-1IFb6_M_.js +1 -0
  72. package/dist/chunks/caches-CB8MHqy2.js +1 -0
  73. package/dist/chunks/{capacityWake-CKOiRELo.js → capacityWake-L7b1mMft.js} +1 -1
  74. package/dist/chunks/{ccrClient-BC2q3k44.js → ccrClient-CG6HTv_n.js} +1 -1
  75. package/dist/chunks/{claudeDesktop-DQXL5bGm.js → claudeDesktop-CAmnheYx.js} +1 -1
  76. package/dist/chunks/{clear-1etSJhdg.js → clear-DdWexxbM.js} +1 -1
  77. package/dist/chunks/{cliLaunch-CQjLYRzM.js → cliLaunch-BWWOgBFh.js} +1 -1
  78. package/dist/chunks/{client-DQwf_b9o.js → client-CoXtVRzi.js} +1 -1
  79. package/dist/chunks/client-Crrwkw7g.js +1 -0
  80. package/dist/chunks/client-D8hKghba.js +1 -0
  81. package/dist/chunks/color-Cuq0c6xy.js +1 -0
  82. package/dist/chunks/commands-D3sESsTp.js +1 -0
  83. package/dist/chunks/compact-DIpwuBDq.js +2 -0
  84. package/dist/chunks/config-CVvUNkj2.js +1 -0
  85. package/dist/chunks/config-D4G8_MqJ.js +3 -0
  86. package/dist/chunks/config-q9D4hFiK.js +1 -0
  87. package/dist/chunks/context-BWcfhhDj.js +1 -0
  88. package/dist/chunks/context-noninteractive-Bwt9A3XD.js +1 -0
  89. package/dist/chunks/{context-noninteractive-Ct_ttQfP.js → context-noninteractive-c7jGVWHQ.js} +2 -2
  90. package/dist/chunks/conversation-Bjo_8kia.js +1 -0
  91. package/dist/chunks/conversation-DrHZIQX2.js +1 -0
  92. package/dist/chunks/{createSSHSession-BmHXA2me.js → createSSHSession-DP7B8yvb.js} +1 -1
  93. package/dist/chunks/{createSession-C4rukWkv.js → createSession-CPo6GBSb.js} +1 -1
  94. package/dist/chunks/createSession-DnykRoia.js +1 -0
  95. package/dist/chunks/crossProjectResume-D2A-qjgP.js +40 -0
  96. package/dist/chunks/cwd--q1ONL7P.js +1 -0
  97. package/dist/chunks/{cwd-C5ce-7WB.js → cwd-L4wygFqJ.js} +1 -1
  98. package/dist/chunks/{daemon-ZtpTZWgQ.js → daemon-D2vFIVOz.js} +1 -1
  99. package/dist/chunks/datadog-DrmHyl3_.js +1 -0
  100. package/dist/chunks/{debug-RZ4NuXyS.js → debug-BdqxZ7rV.js} +4 -4
  101. package/dist/chunks/{debugUtils-D30M1cbN.js → debugUtils-CezNYZ-4.js} +1 -1
  102. package/dist/chunks/{detached-jrVP11oU.js → detached-CkPpYMJj.js} +1 -1
  103. package/dist/chunks/detectRepository-DA1Q_Skc.js +1 -0
  104. package/dist/chunks/{detectRepository-CFiHe6Rv.js → detectRepository-DvxoaPlk.js} +1 -1
  105. package/dist/chunks/{diff-BKiK3xHv.js → diff-DHzz9WAp.js} +1 -1
  106. package/dist/chunks/directoryCompletion-D5AvL7TF.js +1 -0
  107. package/dist/chunks/doctor-PWqB46xd.js +1 -0
  108. package/dist/chunks/entry-4JtoJONR.js +14 -0
  109. package/dist/chunks/envUtils-BDhHQY0-.js +1 -0
  110. package/dist/chunks/{esm-BLPbfHQd.js → esm-DcIr7tVd.js} +1 -1
  111. package/dist/chunks/{execFileNoThrow-CCX-JY8h.js → execFileNoThrow-5SylUnAI.js} +1 -1
  112. package/dist/chunks/{execSyncWrapper-dhRSYGFW.js → execSyncWrapper-DKuxVTaf.js} +1 -1
  113. package/dist/chunks/exit-OW9g7b9A.js +1 -0
  114. package/dist/chunks/extraUsage-Dt5mw35U.js +1 -0
  115. package/dist/chunks/extractMemories-1VlmCGwa.js +1 -0
  116. package/dist/chunks/fast-ClYQcEv5.js +1 -0
  117. package/dist/chunks/fast-CrvLdpy3.js +1 -0
  118. package/dist/chunks/fileSuggestions-fNxREjpe.js +3 -0
  119. package/dist/chunks/firstPartyEventLogger-BBXEQUf0.js +1 -0
  120. package/dist/chunks/firstPartyEventLogger-DhEPWcit.js +5 -0
  121. package/dist/chunks/{flushGate-Cnsu4HET.js → flushGate-ch-Tvwjj.js} +1 -1
  122. package/dist/chunks/{fpsMetrics-Cf_hdtiJ.js → fpsMetrics-DffAomdg.js} +1 -1
  123. package/dist/chunks/{gemini-Cudre91e.js → gemini-fZ0VPU2A.js} +1 -1
  124. package/dist/chunks/generateRecap-BIBVlB__.js +1 -0
  125. package/dist/chunks/generateSessionName-nZj_VvKZ.js +1 -0
  126. package/dist/chunks/{genericProcessUtils-DVfMHhfy.js → genericProcessUtils-BmDSLcMf.js} +1 -1
  127. package/dist/chunks/{git-BerW9bId.js → git-B9uvt96d.js} +1 -1
  128. package/dist/chunks/git-BfS5Hk4S.js +1 -0
  129. package/dist/chunks/githubRepoPathMapping-Cqx3pSfc.js +1 -0
  130. package/dist/chunks/goal-IasZVqKh.js +3 -0
  131. package/dist/chunks/grok-Dk3LyzMa.js +1 -0
  132. package/dist/chunks/grove-BE4fQ6tG.js +7 -0
  133. package/dist/chunks/help-D2-v9Ug9.js +1 -0
  134. package/dist/chunks/{hooks-BZJTWD07.js → hooks-BrKy5XWQ.js} +2 -2
  135. package/dist/chunks/hooks-DGd02IKF.js +1 -0
  136. package/dist/chunks/initReplBridge-RhCAlmHE.js +1 -0
  137. package/dist/chunks/{install-BI---dv0.js → install-CVGZ55wV.js} +1 -1
  138. package/dist/chunks/{instrumentation-CcWzhGfE.js → instrumentation-BmWotlxR.js} +4 -4
  139. package/dist/chunks/{job-B0ftcqPF.js → job-DEXxW_Zo.js} +1 -1
  140. package/dist/chunks/{jwtUtils-C0cE-1Ey.js → jwtUtils-C9sdGhvT.js} +1 -1
  141. package/dist/chunks/keybindings-BRdSOSUD.js +2 -0
  142. package/dist/chunks/language-C0cIpKE2.js +1 -0
  143. package/dist/chunks/{language-s-dLbdVz.js → language-CxThoWRC.js} +1 -1
  144. package/dist/chunks/launchLocalMemory-CLSSVFoj.js +3 -0
  145. package/dist/chunks/launchOnboarding-BkJfKviO.js +8 -0
  146. package/dist/chunks/loadAgentsDir-8UprzS4w.js +1 -0
  147. package/dist/chunks/{loadAgentsDir-ByO8eJqU.js → loadAgentsDir-CKSb56Gp.js} +673 -759
  148. package/dist/chunks/loadPluginHooks-LbaURHVH.js +1 -0
  149. package/dist/chunks/{localSearch-CHHCH16D.js → localSearch-CPOnyi8I.js} +1 -1
  150. package/dist/chunks/localSearch-DNjbr4S9.js +1 -0
  151. package/dist/chunks/{log-CZ0zYP_c.js → log-CTFl4qpD.js} +1 -1
  152. package/dist/chunks/logoV2Utils-we1sfJvf.js +1 -0
  153. package/dist/chunks/{magicDocs-C5i5ruuU.js → magicDocs-DmKlTQvK.js} +3 -3
  154. package/dist/chunks/main-BIiwW4mM.js +605 -0
  155. package/dist/chunks/{main-BLD4QAQg.js → main-ClXu1ilx.js} +2 -2
  156. package/dist/chunks/{managedEnv-C-9XSN14.js → managedEnv-Cl7YbYzf.js} +1 -1
  157. package/dist/chunks/managedEnv-CpiiQx_v.js +1 -0
  158. package/dist/chunks/{mappers-CHRFic5q.js → mappers-xQC-Z4-h.js} +1 -1
  159. package/dist/chunks/mcp-B_m1XBDt.js +6 -0
  160. package/dist/chunks/mcp-BiyfH9Sd.js +1 -0
  161. package/dist/chunks/mcp-BjlaPUWX.js +2 -0
  162. package/dist/chunks/{memoize-B8hfb1JN.js → memoize-FJv2HV1u.js} +1 -1
  163. package/dist/chunks/memory-LN8f_p2b.js +1 -0
  164. package/dist/chunks/{modalContext-DFjKLCB6.js → modalContext-CUThy6Ph.js} +1 -1
  165. package/dist/chunks/mode-lYTs0XHs.js +2 -0
  166. package/dist/chunks/model-C2e73CJD.js +1 -0
  167. package/dist/chunks/model-CvmS-Esk.js +1 -0
  168. package/dist/chunks/model-DJ8mFfuR.js +1 -0
  169. package/dist/chunks/modelOptions-efCGKnXT.js +1 -0
  170. package/dist/chunks/nativeInstaller-DQIFwdat.js +1 -0
  171. package/dist/chunks/oauth-BN2I0_jl.js +1 -0
  172. package/dist/chunks/oauth-C9VBDB0Y.js +1 -0
  173. package/dist/chunks/omit-CLPZGevl.js +1 -0
  174. package/dist/chunks/onChangeAppState-DhBO34OK.js +1 -0
  175. package/dist/chunks/{openai-DPH6rXOZ.js → openai-DJLYqiRl.js} +2 -2
  176. package/dist/chunks/{panel-mD094ALT.js → panel-q0_iT9cg.js} +1 -1
  177. package/dist/chunks/panelCall-sum-3zvi.js +1 -0
  178. package/dist/chunks/parser-BcdhBGx0.js +1 -0
  179. package/dist/chunks/{parser-dbHRgXb8.js → parser-BdCj2GrE.js} +1 -1
  180. package/dist/chunks/partition-CpfoVrg1.js +1 -0
  181. package/dist/chunks/permissions-DTb9wkAP.js +3 -0
  182. package/dist/chunks/pidLock-BR5M6RQw.js +3 -0
  183. package/dist/chunks/{pipeTransport-DVOKR4c_.js → pipeTransport-B3TIkTAp.js} +1 -1
  184. package/dist/chunks/plan-BeoIjNPv.js +1 -0
  185. package/dist/chunks/{platform-DCXXznJg.js → platform-D6IMiyqT.js} +1 -1
  186. package/dist/chunks/plugin-D_dHjTud.js +17 -0
  187. package/dist/chunks/pluginAutoupdate-BHKlOOXI.js +1 -0
  188. package/dist/chunks/pluginBlocklist-D93Hd1GF.js +1 -0
  189. package/dist/chunks/pluginCliCommands-vv0wNt4O.js +1 -0
  190. package/dist/chunks/{pluginFlagging-pBxSselw.js → pluginFlagging-CxuRF2Vc.js} +1 -1
  191. package/dist/chunks/pluginOperations-BTq4AjYB.js +2 -0
  192. package/dist/chunks/{pluginStartupCheck-Di4LjHXf.js → pluginStartupCheck-B6leNWq9.js} +1 -1
  193. package/dist/chunks/pluginStartupCheck-DBOCHUHQ.js +1 -0
  194. package/dist/chunks/plugins-pmipe7kE.js +4 -0
  195. package/dist/chunks/{poorMode-CYXmr_mU.js → poorMode-BxsyllUK.js} +1 -1
  196. package/dist/chunks/poorMode-iV1NwC5L.js +1 -0
  197. package/dist/chunks/print-CAUvczBM.js +23 -0
  198. package/dist/chunks/processBashCommand-CdeQg_c6.js +1 -0
  199. package/dist/chunks/processSlashCommand-CbkshIC6.js +5 -0
  200. package/dist/chunks/{projectContext-D9MDwJUF.js → projectContext-CIxul6vA.js} +1 -1
  201. package/dist/chunks/{projectContext-BaDZBAoK.js → projectContext-RUMJB798.js} +1 -1
  202. package/dist/chunks/prompt-CybUvG8G.js +139 -0
  203. package/dist/chunks/prompt-RBn4JdEg.js +1 -0
  204. package/dist/chunks/prompt-Rb8zXlDo.js +1 -0
  205. package/dist/chunks/promptEditor-0Ug93P2I.js +4 -0
  206. package/dist/chunks/{protocolHandler-RNKkhq91.js → protocolHandler-ClfbHTjI.js} +1 -1
  207. package/dist/chunks/{proxy-BmtEnJ02.js → proxy-Blq4W6Ox.js} +1 -1
  208. package/dist/chunks/reconciler-Drq3HSkj.js +4 -0
  209. package/dist/chunks/refresh-D8TLHO_T.js +1 -0
  210. package/dist/chunks/{registerProtocol-DoKqmqu2.js → registerProtocol-3_ozAuDK.js} +1 -1
  211. package/dist/chunks/reload-plugins-Dn1ibOiI.js +1 -0
  212. package/dist/chunks/{remoteBridgeCore-Cddqv2WW.js → remoteBridgeCore-Dpg6Se9C.js} +1 -1
  213. package/dist/chunks/remoteManagedSettings-CCrq-qL-.js +1 -0
  214. package/dist/chunks/rename-CKsSc7Z3.js +1 -0
  215. package/dist/chunks/{renderOptions-ChLwxtVu.js → renderOptions-CLcco6fc.js} +1 -1
  216. package/dist/chunks/replBridgeHandle-DNC797_T.js +1 -0
  217. package/dist/chunks/resume-B1a5gLVR.js +2 -0
  218. package/dist/chunks/ripgrep-BisRODQ2.js +1 -0
  219. package/dist/chunks/{ripgrep-gaT9Njwi.js → ripgrep-DkL2S7-I.js} +1 -1
  220. package/dist/chunks/{runtimeObserver-CsIwinzh.js → runtimeObserver-B0xfyLiA.js} +1 -1
  221. package/dist/chunks/{runtimeObserver-Dbxxw4ls.js → runtimeObserver-DonWCJOx.js} +4 -4
  222. package/dist/chunks/sandbox-adapter-BnBOSkKJ.js +1 -0
  223. package/dist/chunks/sandbox-toggle-CSdnHWp-.js +1 -0
  224. package/dist/chunks/searchExtraTools-DbgfnQkH.js +1 -0
  225. package/dist/chunks/session-BbQlh2S5.js +2 -0
  226. package/dist/chunks/sessionFileAccessHooks-Xfr1NiXG.js +1 -0
  227. package/dist/chunks/sessionMemory-7UOFdp29.js +1 -0
  228. package/dist/chunks/sessionMemory-fAzgAS7Q.js +1 -0
  229. package/dist/chunks/sessionMemoryUtils-DVjFw5Bd.js +1 -0
  230. package/dist/chunks/sessionObserver-Cl26OdaW.js +1 -0
  231. package/dist/chunks/{sessionObserver-DoYc0ZOP.js → sessionObserver-XV6N0XER.js} +2 -2
  232. package/dist/chunks/{sessionState-CjNY991n.js → sessionState-BvECKycx.js} +1 -1
  233. package/dist/chunks/sessionStorage-DSj9yZkl.js +1 -0
  234. package/dist/chunks/{sessionStoragePortable-Cx6JQ5Ye.js → sessionStoragePortable-JZnGwqUM.js} +1 -1
  235. package/dist/chunks/sessionTitle-E1FvsKM9.js +14 -0
  236. package/dist/chunks/sessionTracing-ClGQ08jM.js +11 -0
  237. package/dist/chunks/settings-B-R9ZJNY.js +1 -0
  238. package/dist/chunks/settings-Xbq6AaD-.js +20 -0
  239. package/dist/chunks/settingsSync-NCN0a4sc.js +1 -0
  240. package/dist/chunks/setup-uZ0dSekt.js +3 -0
  241. package/dist/chunks/shadowedRuleDetection-B9iSx6mB.js +1 -0
  242. package/dist/chunks/{shellQuote-BUVKMu_P.js → shellQuote-Bth6IZgX.js} +1 -1
  243. package/dist/chunks/{sideQuestion-C780iYwd.js → sideQuestion-D2dPToW8.js} +3 -3
  244. package/dist/chunks/sinks-C7q46rvE.js +2 -0
  245. package/dist/chunks/sinks-D3bXeHlQ.js +1 -0
  246. package/dist/chunks/skillChangeDetector-C1EJ7rUL.js +1 -0
  247. package/dist/chunks/{skillGapStore-Dc1arohs.js → skillGapStore-DylpOKJ6.js} +2 -2
  248. package/dist/chunks/{skillLifecycle-DP6mY1Kp.js → skillLifecycle-GK-8eyyn.js} +2 -2
  249. package/dist/chunks/{skillSearchPanel-CpLTImaL.js → skillSearchPanel-mpaC62y4.js} +4 -4
  250. package/dist/chunks/skills-t6krW8GZ.js +1 -0
  251. package/dist/chunks/{src-CDCSSo0U2.js → src-P_wYS_NJ2.js} +1 -1
  252. package/dist/chunks/{src-CST_jFnT.js → src-r6ZFgWPx2.js} +1 -1
  253. package/dist/chunks/startupProfiler-BaiXZ9tr.js +1 -0
  254. package/dist/chunks/{startupProfiler-DCn_NxMH.js → startupProfiler-jeId9f2i.js} +2 -2
  255. package/dist/chunks/state-B4HwLt8i.js +1 -0
  256. package/dist/chunks/{state-Cn_m2NOf.js → state-BAGmpVBn.js} +1 -1
  257. package/dist/chunks/state-Bs5xweDL.js +1 -0
  258. package/dist/chunks/{staticRender-BIxpgNUq.js → staticRender-DrU6eWoq.js} +1 -1
  259. package/dist/chunks/{stats-Duk7_xjQ.js → stats-BJBhl-Lc.js} +1 -1
  260. package/dist/chunks/{status-peiVB_2j.js → status-BtsnKNVY.js} +1 -1
  261. package/dist/chunks/status-nZQEar7T.js +2 -0
  262. package/dist/chunks/{statusNoticeHelpers-B5U5c9PE.js → statusNoticeHelpers-DMqRGFOh.js} +1 -1
  263. package/dist/chunks/{stringUtils-B6FudhoZ.js → stringUtils-CbS6OkmE.js} +1 -1
  264. package/dist/chunks/subprocessEnv-CZkA9Cdp.js +1 -0
  265. package/dist/chunks/{subprocessEnv-vrwzMgKn.js → subprocessEnv-Ci8VV_bi.js} +1 -1
  266. package/dist/chunks/{switcher-BAMqSX7Z.js → switcher-77h2J5HC.js} +1 -1
  267. package/dist/chunks/switcher-B2CYzCC_.js +1 -0
  268. package/dist/chunks/{syncCache-Zl9kZRRl.js → syncCache-By_-buUC.js} +1 -1
  269. package/dist/chunks/tasks-BNrdmF9p.js +1 -0
  270. package/dist/chunks/teleport-mdnhIZBj.js +1 -0
  271. package/dist/chunks/{templateJobs-DR5fKFiO.js → templateJobs-Dkv4I9c1.js} +1 -1
  272. package/dist/chunks/{terminalSetup-DgRBt-JJ.js → terminalSetup-DQopnSPR.js} +1 -1
  273. package/dist/chunks/terminalSetup-DTGm1Eo2.js +33 -0
  274. package/dist/chunks/{theme-Bz6esfST.js → theme-BjpBVRf5.js} +1 -1
  275. package/dist/chunks/{tmux-DSU9tYIo.js → tmux-CMRiI6CD.js} +1 -1
  276. package/dist/chunks/{toolEventObserver-BSekCkM2.js → toolEventObserver-D-sNBvOe.js} +1 -1
  277. package/dist/chunks/toolPool-Di30gn_Y.js +1 -0
  278. package/dist/chunks/trustedDevice-CupLMpO8.js +1 -0
  279. package/dist/chunks/{trustedDevice-B0x9X0fb.js → trustedDevice-j1u2TG5U.js} +1 -1
  280. package/dist/chunks/{types-D7_37tP2.js → types-DWRxAH0E.js} +1 -1
  281. package/dist/chunks/{udsClient-CHoMMH28.js → udsClient-Cm3HqYUu.js} +1 -1
  282. package/dist/chunks/{updateCCB-D_kGQKPT.js → updateCCB-BlUAU2Vp.js} +8 -8
  283. package/dist/chunks/{upstreamproxy-Hmq-n8fw.js → upstreamproxy-DDVMwoRi.js} +1 -1
  284. package/dist/chunks/useExitOnCtrlCDWithKeybindings-D2FvHieH.js +1 -0
  285. package/dist/chunks/useMainLoopModel-ylPQNj7Z.js +1 -0
  286. package/dist/chunks/useManagePlugins-BbWJNLe8.js +1 -0
  287. package/dist/chunks/useMergedTools-B-Z9XQ6U.js +1 -0
  288. package/dist/chunks/useSearchInput-C6d6nt9S.js +1 -0
  289. package/dist/chunks/useSettingsErrors-DKh4rkGi.js +1 -0
  290. package/dist/chunks/{userAgent-BxTG7IMk.js → userAgent-Ng_TTjWr.js} +1 -1
  291. package/dist/chunks/util-D-X8i5Z2.js +1 -0
  292. package/dist/chunks/validatePlugin-DSw08u76.js +1 -0
  293. package/dist/chunks/vim-3mUqsEJm.js +1 -0
  294. package/dist/chunks/{which-CHLNJmtJ.js → which-DznMOwny.js} +1 -1
  295. package/dist/chunks/windowsPaths-1mgenSWa.js +1 -0
  296. package/dist/chunks/{windowsPaths-o62uq6LF.js → windowsPaths-BVztIhXM.js} +1 -1
  297. package/dist/chunks/{workSecret-DG9shvG0.js → workSecret-DtiFreRl.js} +1 -1
  298. package/dist/chunks/workerRegistry-DdOYjLm3.js +6 -0
  299. package/dist/chunks/worktree-BX1ULzrw.js +1 -0
  300. package/dist/cli.js +1 -1
  301. package/package.json +1 -1
  302. package/dist/chunks/AddWorkspaceDirectory-CwLtQld4.js +0 -1
  303. package/dist/chunks/App-Ba52HvYC.js +0 -1
  304. package/dist/chunks/ApproveApiKey-CEIfuUh0.js +0 -1
  305. package/dist/chunks/ApproveApiKey-D2MLQu2P.js +0 -1
  306. package/dist/chunks/BackgroundTasksDialog-IGDrkbWl.js +0 -2
  307. package/dist/chunks/BypassPermissionsModeDialog-GYhq--JR.js +0 -1
  308. package/dist/chunks/ClaudeMdExternalIncludesDialog-C-CTa-95.js +0 -1
  309. package/dist/chunks/ClaudeMdExternalIncludesDialog-Catv6BCJ.js +0 -1
  310. package/dist/chunks/ConsoleOAuthFlow-BeQXqUtX.js +0 -1
  311. package/dist/chunks/DiffDialog-AC5DSJrq.js +0 -6
  312. package/dist/chunks/Doctor-B9Rxsoy0.js +0 -1
  313. package/dist/chunks/Doctor-lhUBhEy5.js +0 -3
  314. package/dist/chunks/ExitFlow-Cu8SoQHs.js +0 -2
  315. package/dist/chunks/Grove-Bc4CofEj.js +0 -11
  316. package/dist/chunks/InvalidConfigDialog-BI13il58.js +0 -1
  317. package/dist/chunks/InvalidSettingsDialog-CtOheV1K.js +0 -1
  318. package/dist/chunks/MCPConnectionManager-ao-P3xSA.js +0 -1
  319. package/dist/chunks/MCPToolListView-dkofcJs4.js +0 -1
  320. package/dist/chunks/McpParsingWarnings-BS4JoR5l.js +0 -1
  321. package/dist/chunks/MessageSelector-B88b2ypw.js +0 -3
  322. package/dist/chunks/Messages-BPeI7lLV.js +0 -11
  323. package/dist/chunks/Onboarding-c2fQ8Io_.js +0 -1
  324. package/dist/chunks/PromptInputFooterSuggestions-D1cH9sDX.js +0 -1
  325. package/dist/chunks/PromptInputHelpMenu-DDD5WuK0.js +0 -1
  326. package/dist/chunks/QueryEngine-Cv_meCam.js +0 -1
  327. package/dist/chunks/REPL-BXhAQOXb.js +0 -139
  328. package/dist/chunks/REPL-YqjLnr3A.js +0 -1
  329. package/dist/chunks/RemoteSessionManager-CT7T8BaR.js +0 -2
  330. package/dist/chunks/ResumeConversation-CIZCjms9.js +0 -1
  331. package/dist/chunks/SearchExtraToolsTool-Dx6093yw.js +0 -1
  332. package/dist/chunks/Settings-CyUm0AtU.js +0 -2
  333. package/dist/chunks/TeleportProgress-C3qyp5zy.js +0 -1
  334. package/dist/chunks/TeleportRepoMismatchDialog-BV--nyYn.js +0 -1
  335. package/dist/chunks/TeleportResumeWrapper-Blo2cZg-.js +0 -1
  336. package/dist/chunks/ThemePicker-EQ6hPUeI.js +0 -1
  337. package/dist/chunks/add-dir-DPQV0qml.js +0 -1
  338. package/dist/chunks/agents-DmybpgDN.js +0 -103
  339. package/dist/chunks/allErrors-BPn_2TrB.js +0 -1
  340. package/dist/chunks/analytics-CkYUHW_U.js +0 -1
  341. package/dist/chunks/ant-DjdvlLOo.js +0 -1
  342. package/dist/chunks/api-AMgj1zf_.js +0 -1
  343. package/dist/chunks/asciicast-BJNYO5sh.js +0 -4
  344. package/dist/chunks/asciicast-CH6hdK0a.js +0 -1
  345. package/dist/chunks/auth-CNjDn1VY.js +0 -15
  346. package/dist/chunks/auth-CZzP483s.js +0 -1
  347. package/dist/chunks/auth-DDSBm_Yj.js +0 -1
  348. package/dist/chunks/autonomy-D4xZLOdJ.js +0 -15
  349. package/dist/chunks/backgroundHousekeeping--eBgphcg.js +0 -17
  350. package/dist/chunks/backgroundHousekeeping-VV1V_Y2Z.js +0 -1
  351. package/dist/chunks/bg-BK_9J6F6.js +0 -1
  352. package/dist/chunks/branch-BYq0zpzT.js +0 -3
  353. package/dist/chunks/bridgeConfig-C82un7rJ.js +0 -1
  354. package/dist/chunks/btw-CUV3nRrE.js +0 -1
  355. package/dist/chunks/caches-BZ59_En6.js +0 -1
  356. package/dist/chunks/caches-Cg-HtWKG.js +0 -1
  357. package/dist/chunks/client-DQXvVKND.js +0 -1
  358. package/dist/chunks/client-DkgC-mFB.js +0 -1
  359. package/dist/chunks/color-CBsNbt1s.js +0 -1
  360. package/dist/chunks/commands-qM5z_Uld.js +0 -1
  361. package/dist/chunks/compact-BclJiRJe.js +0 -2
  362. package/dist/chunks/completionCache-BMHAktkM.js +0 -1
  363. package/dist/chunks/config-CE058cvr.js +0 -3
  364. package/dist/chunks/config-D81avYye.js +0 -1
  365. package/dist/chunks/config-DpOOllGk.js +0 -1
  366. package/dist/chunks/context-noninteractive-DJb8H_hN.js +0 -1
  367. package/dist/chunks/context-sR9fJmXE.js +0 -1
  368. package/dist/chunks/conversation-D48Kt3ar.js +0 -1
  369. package/dist/chunks/conversation-fOFTa7k5.js +0 -1
  370. package/dist/chunks/createSession-CSwlW2T2.js +0 -1
  371. package/dist/chunks/crossProjectResume-lDFB2ZcY.js +0 -40
  372. package/dist/chunks/cwd-5Xr-Qka6.js +0 -1
  373. package/dist/chunks/datadog-BJn5ECIu.js +0 -1
  374. package/dist/chunks/detectRepository-DqQvyj_a.js +0 -1
  375. package/dist/chunks/directoryCompletion-BagQcynj.js +0 -1
  376. package/dist/chunks/doctor-BEHYm34V.js +0 -1
  377. package/dist/chunks/entry-BzL1MFQG.js +0 -14
  378. package/dist/chunks/envUtils-DSxRz_kt.js +0 -1
  379. package/dist/chunks/eventLoopStallDetector-Cg_RXU1q.js +0 -1
  380. package/dist/chunks/exit-DE2YiAhQ.js +0 -1
  381. package/dist/chunks/extraUsage-Dw7AXiH7.js +0 -1
  382. package/dist/chunks/extractMemories-DxTUMiv3.js +0 -1
  383. package/dist/chunks/fast-CHmMkIpE.js +0 -1
  384. package/dist/chunks/fast-uQASHWqR.js +0 -1
  385. package/dist/chunks/fileSuggestions-Dyu2kQtE.js +0 -3
  386. package/dist/chunks/firstPartyEventLogger-D5ohKbIe.js +0 -5
  387. package/dist/chunks/firstPartyEventLogger-LsNY6yOt.js +0 -1
  388. package/dist/chunks/generateRecap-CiFxXlmH.js +0 -1
  389. package/dist/chunks/generateSessionName-DitoBxJT.js +0 -1
  390. package/dist/chunks/git-D6dOU2mT.js +0 -1
  391. package/dist/chunks/githubRepoPathMapping-DGr0kJ8D.js +0 -1
  392. package/dist/chunks/goal-DuUayfDg.js +0 -3
  393. package/dist/chunks/grok-tRbmZzEh.js +0 -1
  394. package/dist/chunks/grove-Cv19v6Sv.js +0 -7
  395. package/dist/chunks/help-DkqxbFDM.js +0 -1
  396. package/dist/chunks/hooks-CsP42iOp.js +0 -1
  397. package/dist/chunks/initReplBridge-DdsSWVqN.js +0 -1
  398. package/dist/chunks/keybindings-DZU3vwo3.js +0 -2
  399. package/dist/chunks/language-DHhXLb_Y.js +0 -1
  400. package/dist/chunks/launchLocalMemory-twLxpPvg.js +0 -3
  401. package/dist/chunks/launchOnboarding-BWz2XSb9.js +0 -8
  402. package/dist/chunks/lib-rQZENxQg.js +0 -8
  403. package/dist/chunks/loadAgentsDir-CMNFLt7R.js +0 -1
  404. package/dist/chunks/loadPluginHooks-BPnxcgrL.js +0 -1
  405. package/dist/chunks/localSearch-DzQODFap.js +0 -1
  406. package/dist/chunks/logoV2Utils-CGUJ-5gY.js +0 -1
  407. package/dist/chunks/main-D4Uk-WUs.js +0 -862
  408. package/dist/chunks/managedEnv-DLVRBaA9.js +0 -1
  409. package/dist/chunks/mcp-BMVdGknC.js +0 -1
  410. package/dist/chunks/mcp-COS5RJFS.js +0 -6
  411. package/dist/chunks/mcp-tGsOW1GN.js +0 -2
  412. package/dist/chunks/memory-DR6poqeH.js +0 -1
  413. package/dist/chunks/mode-QV-NW1Wd.js +0 -2
  414. package/dist/chunks/model-BF_4ebyl.js +0 -1
  415. package/dist/chunks/model-BNU_ulDJ.js +0 -1
  416. package/dist/chunks/model-CwO-g1RW.js +0 -1
  417. package/dist/chunks/nativeInstaller-B-lNJjM-.js +0 -1
  418. package/dist/chunks/oauth-BqJqV-2M.js +0 -1
  419. package/dist/chunks/oauth-C8X_p8Gc.js +0 -1
  420. package/dist/chunks/omit-DZCEXri5.js +0 -1
  421. package/dist/chunks/onChangeAppState-BmfM5g-D.js +0 -1
  422. package/dist/chunks/p-map-B1EeBuI8.js +0 -1
  423. package/dist/chunks/p-map-HKDr3iDo.js +0 -1
  424. package/dist/chunks/panelCall-SbffM7G4.js +0 -1
  425. package/dist/chunks/parser-DrBC8nWp.js +0 -1
  426. package/dist/chunks/partition-DKuAFJkc.js +0 -1
  427. package/dist/chunks/path-Cv9QMBAX.js +0 -1
  428. package/dist/chunks/permissions-ey-bfanE.js +0 -3
  429. package/dist/chunks/pidLock-DJnS_38v.js +0 -3
  430. package/dist/chunks/plan-Brg9XnRr.js +0 -1
  431. package/dist/chunks/plugin-CRwa39Y1.js +0 -17
  432. package/dist/chunks/pluginAutoupdate-D0LIP7cy.js +0 -1
  433. package/dist/chunks/pluginBlocklist-PwHHD3nj.js +0 -1
  434. package/dist/chunks/pluginCliCommands-BJM5Bdpf.js +0 -1
  435. package/dist/chunks/pluginOperations-C7p_Qr2r.js +0 -2
  436. package/dist/chunks/pluginStartupCheck-C0HqhG6D.js +0 -1
  437. package/dist/chunks/plugins-DUKNjLq6.js +0 -4
  438. package/dist/chunks/poorMode-CejPNCp-.js +0 -1
  439. package/dist/chunks/print-gyTOCJzk.js +0 -23
  440. package/dist/chunks/processBashCommand-Cze9vCm6.js +0 -1
  441. package/dist/chunks/processSlashCommand-BRajh1v7.js +0 -5
  442. package/dist/chunks/prompt-B7joRiqj.js +0 -139
  443. package/dist/chunks/prompt-DqSMh2x9.js +0 -1
  444. package/dist/chunks/prompt-Eysh8Et_.js +0 -1
  445. package/dist/chunks/promptEditor-R_acDAgI.js +0 -4
  446. package/dist/chunks/reconciler-BfkO6X2X.js +0 -4
  447. package/dist/chunks/refresh-C1X3sptR.js +0 -1
  448. package/dist/chunks/reload-plugins-C0osFcNh.js +0 -1
  449. package/dist/chunks/remoteManagedSettings-B1mnRDmA.js +0 -1
  450. package/dist/chunks/rename-B3tf-YiD.js +0 -1
  451. package/dist/chunks/replBridgeHandle-CNwNIijW.js +0 -1
  452. package/dist/chunks/resume-Be1G_GBL.js +0 -2
  453. package/dist/chunks/ripgrep-C2PhTJDh.js +0 -1
  454. package/dist/chunks/rollback-BPWRKlIZ.js +0 -11
  455. package/dist/chunks/sandbox-adapter-C6GBuJPB.js +0 -1
  456. package/dist/chunks/sandbox-toggle-jEySONTW.js +0 -1
  457. package/dist/chunks/sdkHeapDumpMonitor-WdXUV7DV.js +0 -1
  458. package/dist/chunks/searchExtraTools-C_UTryh_.js +0 -1
  459. package/dist/chunks/session-DDI1Eb2x.js +0 -2
  460. package/dist/chunks/sessionDataUploader-CaCjwsA2.js +0 -1
  461. package/dist/chunks/sessionFileAccessHooks-DfJ7Htfl.js +0 -1
  462. package/dist/chunks/sessionMemory-CQBxPkTQ.js +0 -1
  463. package/dist/chunks/sessionMemory-s0ALUHvc.js +0 -1
  464. package/dist/chunks/sessionMemoryUtils-xt7dTHGC.js +0 -1
  465. package/dist/chunks/sessionObserver-C2sYqWL3.js +0 -1
  466. package/dist/chunks/sessionStorage-DqsY-7pi.js +0 -1
  467. package/dist/chunks/sessionTitle-B0OYf5nM.js +0 -14
  468. package/dist/chunks/sessionTracing-CwsXt_uA.js +0 -11
  469. package/dist/chunks/settings-BWtOA9A7.js +0 -1
  470. package/dist/chunks/settings-hQDLwPVj.js +0 -20
  471. package/dist/chunks/settingsSync-DdFagwHV.js +0 -1
  472. package/dist/chunks/setup-DzC22EkN.js +0 -3
  473. package/dist/chunks/shadowedRuleDetection-C86PTj1m.js +0 -1
  474. package/dist/chunks/sinks-5G_xhc1Q.js +0 -1
  475. package/dist/chunks/sinks-Cftq7Es0.js +0 -2
  476. package/dist/chunks/skillChangeDetector-plLveEbf.js +0 -1
  477. package/dist/chunks/skills-zGYaYfFV.js +0 -1
  478. package/dist/chunks/startupProfiler-JbpAkfNE.js +0 -1
  479. package/dist/chunks/state-C2OSZkV1.js +0 -1
  480. package/dist/chunks/state-DU9lRJ9x.js +0 -1
  481. package/dist/chunks/status-CFw-FpZM.js +0 -2
  482. package/dist/chunks/subprocessEnv-BSQSomcK.js +0 -1
  483. package/dist/chunks/switcher-hgBgVzLb.js +0 -1
  484. package/dist/chunks/tasks-BxpyRhmD.js +0 -1
  485. package/dist/chunks/teleport-CwxeD5vL.js +0 -1
  486. package/dist/chunks/terminalSetup-DlaFWI81.js +0 -33
  487. package/dist/chunks/toolPool-B7SIoDw5.js +0 -1
  488. package/dist/chunks/trustedDevice-CjHQtVkO.js +0 -1
  489. package/dist/chunks/up-B8wBSpLg.js +0 -12
  490. package/dist/chunks/useExitOnCtrlCDWithKeybindings-Cce612uS.js +0 -1
  491. package/dist/chunks/useMainLoopModel-BICP6_Fi.js +0 -1
  492. package/dist/chunks/useManagePlugins-DtbY_vPL.js +0 -1
  493. package/dist/chunks/useMergedTools-Ckx2IEhF.js +0 -1
  494. package/dist/chunks/useSearchInput-BAgljZUl.js +0 -1
  495. package/dist/chunks/useSettingsErrors-CAJR_wpd.js +0 -1
  496. package/dist/chunks/util-DDtmyq_r.js +0 -1
  497. package/dist/chunks/validatePlugin-AHl-g4ct.js +0 -1
  498. package/dist/chunks/vim-kg-mRVbu.js +0 -1
  499. package/dist/chunks/windowsPaths-Pmx8LDR6.js +0 -1
  500. package/dist/chunks/workerRegistry-C7H_lsQX.js +0 -6
  501. package/dist/chunks/worktree-O2p-mJdF.js +0 -1
@@ -0,0 +1 @@
1
+ import{l as e,u as t}from"./oauth-C9VBDB0Y.js";t();export{e as getOauthConfig};
@@ -0,0 +1 @@
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";function t(){return process.env.CLAUDE_CODE_CUSTOM_OAUTH_URL?`-custom-oauth`:``}function n(){let e=u,t=process.env.CLAUDE_CODE_CUSTOM_OAUTH_URL;if(t){let n=t.replace(/\/$/,``);if(!f.includes(n))throw Error(`CLAUDE_CODE_CUSTOM_OAUTH_URL is not an approved endpoint.`);e={...e,BASE_API_URL:n,CONSOLE_AUTHORIZE_URL:`${n}/oauth/authorize`,CLAUDE_AI_AUTHORIZE_URL:`${n}/oauth/authorize`,CLAUDE_AI_ORIGIN:n,TOKEN_URL:`${n}/v1/oauth/token`,API_KEY_URL:`${n}/api/oauth/claude_cli/create_api_key`,ROLES_URL:`${n}/api/oauth/claude_cli/roles`,CONSOLE_SUCCESS_URL:`${n}/oauth/code/success?app=claude-code`,CLAUDEAI_SUCCESS_URL:`${n}/oauth/code/success?app=claude-code`,MANUAL_REDIRECT_URL:`${n}/oauth/code/callback`,OAUTH_FILE_SUFFIX:`-custom-oauth`}}let n=process.env.CLAUDE_CODE_OAUTH_CLIENT_ID;return n&&(e={...e,CLIENT_ID:n}),e}var r,i,a,o,s,c,l,u,d,f,p=e((()=>{r=`user:inference`,i=`user:profile`,a=`org:create_api_key`,o=`oauth-2025-04-20`,s=[a,i],c=[i,r,`user:sessions:claude_code`,`user:mcp_servers`,`user:file_upload`],l=Array.from(new Set([...s,...c])),u={BASE_API_URL:`https://api.anthropic.com`,CONSOLE_AUTHORIZE_URL:`https://platform.claude.com/oauth/authorize`,CLAUDE_AI_AUTHORIZE_URL:`https://claude.com/cai/oauth/authorize`,CLAUDE_AI_ORIGIN:`https://claude.ai`,TOKEN_URL:`https://platform.claude.com/v1/oauth/token`,API_KEY_URL:`https://api.anthropic.com/api/oauth/claude_cli/create_api_key`,ROLES_URL:`https://api.anthropic.com/api/oauth/claude_cli/roles`,CONSOLE_SUCCESS_URL:`https://platform.claude.com/buy_credits?returnUrl=/oauth/code/success%3Fapp%3Dclaude-code`,CLAUDEAI_SUCCESS_URL:`https://platform.claude.com/oauth/code/success?app=claude-code`,MANUAL_REDIRECT_URL:`https://platform.claude.com/oauth/code/callback`,CLIENT_ID:`9d1c250a-e61b-44d9-88ed-5944d1962f5e`,OAUTH_FILE_SUFFIX:``,MCP_PROXY_URL:`https://mcp-proxy.anthropic.com`,MCP_PROXY_PATH:`/v1/mcp/{server_id}`},d=`https://claude.ai/oauth/claude-code-client-metadata`,f=[`https://beacon.claude-ai.staging.ant.dev`,`https://claude.fedstart.com`,`https://claude-staging.fedstart.com`]}));export{s as a,t as c,i,n as l,r as n,d as o,c as r,o as s,l as t,p as u};
@@ -0,0 +1 @@
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{a as t,o as n}from"./isObject-C6qM3WEW.js";import{ME as r,aD as i,iD as a,jE as o,vD as s,yD as c}from"./loadAgentsDir-CKSb56Gp.js";import{Ar as l,Ci as u,Ei as d,Lr as f,Mr as p,Nr as m,Pr as h,Rr as g,Ti as _,jr as v,kr as y,mi as b,pi as x,wi as S}from"./state-Bs5xweDL.js";import{$n as C,Qn as w,Tr as T,Xn as E,Zn as D,er as O,tr as k,wr as A}from"./settings-Xbq6AaD-.js";import{I as j,L as M}from"./config-D4G8_MqJ.js";function N(e){return S(e)||b(e)||!!(P&&e&&e[P])}var P,F=e((()=>{n(),x(),u(),P=t?t.isConcatSpreadable:void 0}));function I(e,t,n,r,i){var a=-1,o=e.length;for(n||(n=N),i||(i=[]);++a<o;){var s=e[a];t>0&&n(s)?t>1?I(s,t-1,n,r,i):_(i,s):r||(i[i.length]=s)}return i}var L=e((()=>{d(),F()}));function R(e){return e!=null&&e.length?I(e,1):[]}var z=e((()=>{L()}));function B(e){return D(C(e,void 0,R),e+``)}var V=e((()=>{z(),w(),E()}));function H(e,t){return t.length<2?e:y(e,o(t,0,-1))}var U=e((()=>{l(),r()}));function W(e,t){t=m(t,e);var n=-1,r=t.length;if(!r)return!0;for(;++n<r;){var a=p(t[n]);if(a===`__proto__`&&!G.call(e,`__proto__`)||(a===`constructor`||a===`prototype`)&&n<r-1)return!1}var o=H(e,t);return o==null||delete o[p(i(t))]}var G,K=e((()=>{h(),a(),U(),v(),G=Object.prototype.hasOwnProperty}));function q(e){return k(e)?void 0:e}var J=e((()=>{O()})),Y,X,Z,Q,$=e((()=>{g(),c(),K(),h(),T(),J(),V(),M(),Y=1,X=2,Z=4,Q=B(function(e,t){var n={};if(e==null)return n;var r=!1;t=f(t,function(t){return t=m(t,e),r||(r=t.length>1),t}),A(e,j(e),n),r&&(n=s(n,Y|X|Z,q));for(var i=t.length;i--;)W(n,t[i]);return n})}));export{Q as n,$ as t};
@@ -0,0 +1 @@
1
+ import{Kt as e,Pn as t}from"./state-Bs5xweDL.js";import{W as n,z as r}from"./debug-BdqxZ7rV.js";import{Pt as i,Rt as a,jt as o}from"./settings-Xbq6AaD-.js";import{c as s,h as c,y as l}from"./config-D4G8_MqJ.js";import{o as u,s as d}from"./log-CTFl4qpD.js";import{Bt as f,_t as p,gt as m,vt as h}from"./model-C2e73CJD.js";import{a as g,i as _,n as v}from"./sessionState-BvECKycx.js";import{r as y,t as b}from"./managedEnv-Cl7YbYzf.js";e(),f(),c(),r(),u(),y(),o(),v();function x(e){return t=>({...t,...typeof e.permission_mode==`string`?{toolPermissionContext:{...t.toolPermissionContext,mode:i(e.permission_mode)}}:{}})}function S({newState:e,oldState:r}){let i=r.toolPermissionContext.mode,o=e.toolPermissionContext.mode;if(i!==o){let e=a(i),t=a(o);e!==t&&g({permission_mode:t}),_(o)}if(e.mainLoopModel!==r.mainLoopModel&&t(e.mainLoopModel),e.expandedView!==r.expandedView){let t=e.expandedView===`tasks`;s().showExpandedTodos!==t&&l(e=>({...e,showExpandedTodos:t}))}if(e.verbose!==r.verbose&&s().verbose!==e.verbose){let t=e.verbose;l(e=>({...e,verbose:t}))}if(e.settings!==r.settings)try{m(),p(),h(),e.settings.env!==r.settings.env&&b()}catch(e){d(n(e))}}export{S as n,x as t};
@@ -1,4 +1,4 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{c as t,l as n,o as r}from"./envUtils-DSxRz_kt.js";import{Ig as i,La as a,Lg as o,Oa as s,Rg as c,at as l,ct as u,dx as d,eo as f,lo as ee,so as p,sx as m}from"./loadAgentsDir-ByO8eJqU.js";import{a as h,l as g}from"./debug-RZ4NuXyS.js";import{Kn as _,Un as te,V as v,W as y}from"./model-CwO-g1RW.js";import{Sn as ne,bn as re,i as ie,r as b,t as x,xn as S}from"./prompt-B7joRiqj.js";import{K as C,U as w,W as T,Y as E,ht as D,q as ae}from"./sessionState-CjNY991n.js";import{n as oe,r as O}from"./client-DQwf_b9o.js";import{n as se,t as k}from"./openaiShared-G2-w4gJt.js";import{homedir as A}from"os";import{join as j}from"path";import{randomUUID as M}from"crypto";import{chmod as ce,mkdir as N,readFile as P,writeFile as F}from"fs/promises";function I(){return j(L(),J)}function L(){return(process.env.CLAUDE_CONFIG_DIR??j(A(),`.claude`)).normalize(`NFC`)}function R(){return j(process.env.CODEX_HOME??j(process.env.HOME??``,`.codex`),`auth.json`)}function z(e){return typeof e==`string`&&e.length>0?e:void 0}function B(e){try{let t=JSON.parse(e);return t&&typeof t==`object`?t:null}catch{return null}}function V(e){let[,t]=e.split(`.`);if(!t)return null;try{let e=t.replace(/-/g,`+`).replace(/_/g,`/`),n=e.padEnd(e.length+(4-e.length%4)%4,`=`);return B(Buffer.from(n,`base64`).toString(`utf8`))}catch{return null}}function H(e){let t=V(e),n=t?.[`https://api.openai.com/auth`];return n&&typeof n==`object`?n:t??{}}function U(e){let t=V(e)?.exp;return typeof t==`number`?t*1e3:null}function W(e){if(e.accountId)return e.accountId;for(let t of[e.idToken,e.accessToken]){if(!t)continue;let e=H(t),n=z(e.chatgpt_account_id)??z(e.chatgpt_account_user_id)??z(e.account_id);if(n)return n}}async function G(e){try{let t=await P(e,`utf8`),n=JSON.parse(t),r=n.tokens,i=r?.id_token,a=r?.access_token,o=r?.refresh_token;return!i||!a||!o?null:{idToken:i,accessToken:a,refreshToken:o,accountId:W({idToken:i,accessToken:a,accountId:r.account_id}),lastRefresh:n.last_refresh}}catch{return null}}async function le(e){let t=I();await N(L(),{recursive:!0});let n={auth_mode:`chatgpt`,tokens:{id_token:e.idToken,access_token:e.accessToken,refresh_token:e.refreshToken,account_id:W(e)},last_refresh:new Date().toISOString()};await F(t,`${JSON.stringify(n,null,2)}\n`,{mode:384}),await ce(t,384).catch(()=>void 0)}async function ue(e,t){let n=await fetch(e,{method:`POST`,headers:{"Content-Type":`application/x-www-form-urlencoded`},body:t});if(!n.ok){let e=await n.text().catch(()=>``);throw Error(`ChatGPT token request failed (${n.status})${e?`: ${e}`:``}`)}return await n.json()}async function de(e){let t=new URLSearchParams({grant_type:`refresh_token`,refresh_token:e.refreshToken,client_id:q,scope:`openid profile email offline_access api.connectors.read api.connectors.invoke`}),n=await ue(`${K}/oauth/token`,t);return{idToken:n.id_token,accessToken:n.access_token,refreshToken:n.refresh_token??e.refreshToken,accountId:W({idToken:n.id_token,accessToken:n.access_token,accountId:e.accountId})}}function fe(){return process.env.OPENAI_AUTH_MODE===`chatgpt`}async function pe(){let e=await G(I());if(e||(e=await G(R()),e&&g(`[OpenAI] Using ChatGPT auth from Codex auth.json`)),!e)throw Error(`ChatGPT account is not logged in.`);let t=U(e.accessToken);return t!==null&&t<=Date.now()+Y&&(e=await de(e),await le(e)),{accessToken:e.accessToken,accountId:e.accountId??W(e)}}var K,q,J,Y,X=e((()=>{h(),K=`https://auth.openai.com`,q=`app_EMoamEEZ73f0CkXaXp7hrann`,J=`openai-chatgpt-auth.json`,Y=300*1e3}));function Z(e){return typeof e==`string`?e:Array.isArray(e)?e.map(e=>{if(!e||typeof e!=`object`)return``;let t=e;return typeof t.text==`string`?t.text:``}).filter(Boolean).join(`
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{c as t,l as n,o as r}from"./envUtils-BDhHQY0-.js";import{$b as i,Da as a,Dg as o,Eg as s,Ia as c,Og as l,Qa as u,ao as d,it as f,rx as p,so as ee,st as m}from"./loadAgentsDir-CKSb56Gp.js";import{a as h,l as g}from"./debug-BdqxZ7rV.js";import{Kn as _,Un as te,V as ne,W as v}from"./model-C2e73CJD.js";import{bn as y,i as re,r as b,t as x,xn as ie,yn as S}from"./prompt-CybUvG8G.js";import{K as C,U as w,W as T,Y as E,ht as D,q as ae}from"./sessionState-BvECKycx.js";import{n as oe,r as O}from"./client-CoXtVRzi.js";import{n as se,t as k}from"./openaiShared-G2-w4gJt.js";import{homedir as A}from"os";import{join as j}from"path";import{randomUUID as M}from"crypto";import{chmod as ce,mkdir as N,readFile as P,writeFile as F}from"fs/promises";function I(){return j(L(),J)}function L(){return(process.env.CLAUDE_CONFIG_DIR??j(A(),`.claude`)).normalize(`NFC`)}function R(){return j(process.env.CODEX_HOME??j(process.env.HOME??``,`.codex`),`auth.json`)}function z(e){return typeof e==`string`&&e.length>0?e:void 0}function B(e){try{let t=JSON.parse(e);return t&&typeof t==`object`?t:null}catch{return null}}function V(e){let[,t]=e.split(`.`);if(!t)return null;try{let e=t.replace(/-/g,`+`).replace(/_/g,`/`),n=e.padEnd(e.length+(4-e.length%4)%4,`=`);return B(Buffer.from(n,`base64`).toString(`utf8`))}catch{return null}}function H(e){let t=V(e),n=t?.[`https://api.openai.com/auth`];return n&&typeof n==`object`?n:t??{}}function U(e){let t=V(e)?.exp;return typeof t==`number`?t*1e3:null}function W(e){if(e.accountId)return e.accountId;for(let t of[e.idToken,e.accessToken]){if(!t)continue;let e=H(t),n=z(e.chatgpt_account_id)??z(e.chatgpt_account_user_id)??z(e.account_id);if(n)return n}}async function G(e){try{let t=await P(e,`utf8`),n=JSON.parse(t),r=n.tokens,i=r?.id_token,a=r?.access_token,o=r?.refresh_token;return!i||!a||!o?null:{idToken:i,accessToken:a,refreshToken:o,accountId:W({idToken:i,accessToken:a,accountId:r.account_id}),lastRefresh:n.last_refresh}}catch{return null}}async function le(e){let t=I();await N(L(),{recursive:!0});let n={auth_mode:`chatgpt`,tokens:{id_token:e.idToken,access_token:e.accessToken,refresh_token:e.refreshToken,account_id:W(e)},last_refresh:new Date().toISOString()};await F(t,`${JSON.stringify(n,null,2)}\n`,{mode:384}),await ce(t,384).catch(()=>void 0)}async function ue(e,t){let n=await fetch(e,{method:`POST`,headers:{"Content-Type":`application/x-www-form-urlencoded`},body:t});if(!n.ok){let e=await n.text().catch(()=>``);throw Error(`ChatGPT token request failed (${n.status})${e?`: ${e}`:``}`)}return await n.json()}async function de(e){let t=new URLSearchParams({grant_type:`refresh_token`,refresh_token:e.refreshToken,client_id:q,scope:`openid profile email offline_access api.connectors.read api.connectors.invoke`}),n=await ue(`${K}/oauth/token`,t);return{idToken:n.id_token,accessToken:n.access_token,refreshToken:n.refresh_token??e.refreshToken,accountId:W({idToken:n.id_token,accessToken:n.access_token,accountId:e.accountId})}}function fe(){return process.env.OPENAI_AUTH_MODE===`chatgpt`}async function pe(){let e=await G(I());if(e||(e=await G(R()),e&&g(`[OpenAI] Using ChatGPT auth from Codex auth.json`)),!e)throw Error(`ChatGPT account is not logged in.`);let t=U(e.accessToken);return t!==null&&t<=Date.now()+Y&&(e=await de(e),await le(e)),{accessToken:e.accessToken,accountId:e.accountId??W(e)}}var K,q,J,Y,X=e((()=>{h(),K=`https://auth.openai.com`,q=`app_EMoamEEZ73f0CkXaXp7hrann`,J=`openai-chatgpt-auth.json`,Y=300*1e3}));function Z(e){return typeof e==`string`?e:Array.isArray(e)?e.map(e=>{if(!e||typeof e!=`object`)return``;let t=e;return typeof t.text==`string`?t.text:``}).filter(Boolean).join(`
2
2
  `):``}function me(e){if(typeof e==`string`)return e;if(!Array.isArray(e))return Z(e);let t=[];for(let n of e){if(!n||typeof n!=`object`)continue;let e=n;if(e.type===`text`&&typeof e.text==`string`)t.push({type:`input_text`,text:e.text});else if(e.type===`image_url`){let n=e.image_url;typeof n?.url==`string`&&t.push({type:`input_image`,image_url:n.url})}}return t.length>0?t:Z(e)}function he(e){let t=[],n=[];for(let r of e){if(!r||typeof r!=`object`)continue;let e=r,i=e.role;if(i===`system`||i===`developer`){let t=Z(e.content);t&&n.push(t);continue}if(i===`tool`){let n=e.tool_call_id;typeof n==`string`&&t.push({type:`function_call_output`,call_id:n,output:Z(e.content)});continue}if(i===`assistant`){let n=Z(e.content);n&&t.push({role:`assistant`,content:n});let r=e.tool_calls;if(Array.isArray(r))for(let e of r){if(!e||typeof e!=`object`)continue;let n=e,r=n.function,i=typeof n.id==`string`?n.id:void 0,a=typeof r?.name==`string`?r.name:void 0;!i||!a||t.push({type:`function_call`,call_id:i,name:a,arguments:typeof r?.arguments==`string`?r.arguments:`{}`})}continue}i===`user`&&t.push({role:`user`,content:me(e.content)})}return{input:t,instructions:n.length>0?n.join(`
3
3
 
4
4
  `):void 0}}function ge(e){let t=[];for(let n of e){if(!n||typeof n!=`object`)continue;let e=n.function,r=typeof e?.name==`string`?e.name:void 0;r&&t.push({type:`function`,name:r,description:typeof e?.description==`string`?e.description:``,parameters:e?.parameters&&typeof e.parameters==`object`?e.parameters:{type:`object`,properties:{}},strict:!1})}return t}function _e(e){if(e===`required`)return`required`;if(e===`auto`)return`auto`;if(!e||typeof e!=`object`)return e;let t=e,n=t.function;return t.type===`function`&&typeof n?.name==`string`?{type:`function`,name:n.name}:e}function ve(e){let{input:t,instructions:n}=he(e.messages),r=ge(e.tools);return{model:e.model,stream:!0,store:!1,input:t,...n?{instructions:n}:{},...r.length>0?{tools:r}:{},...e.toolChoice?{tool_choice:_e(e.toolChoice)}:{},parallel_tool_calls:!0}}async function*ye(e){if(!e.body)throw Error(`ChatGPT response did not include a body`);let t=e.body.getReader(),n=new TextDecoder,r=``;for(;;){let{done:e,value:i}=await t.read();if(e)break;r+=n.decode(i,{stream:!0});let a=r.indexOf(`
@@ -7,4 +7,4 @@ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{c as t,l as n,o as r}f
7
7
  `);if(t&&t!==`[DONE]`){let e=JSON.parse(t);e&&typeof e==`object`&&(yield e)}a=r.indexOf(`
8
8
 
9
9
  `)}}}function be(e){let t=e?.usage,n=t?.input_tokens_details;return{input_tokens:typeof t?.input_tokens==`number`?t.input_tokens:0,output_tokens:typeof t?.output_tokens==`number`?t.output_tokens:0,cache_creation_input_tokens:0,cache_read_input_tokens:typeof n?.cached_tokens==`number`?n.cached_tokens:0}}function xe(e){return e?.status===`incomplete`?`max_tokens`:`end_turn`}async function*Q(e,t){let n=`msg_${M().replace(/-/g,``).slice(0,24)}`,r=new Map,i=!1,a=-1,o=!1,s=!1,c=async function*(){i||(i=!0,yield{type:`message_start`,message:{id:n,type:`message`,role:`assistant`,content:[],model:t,stop_reason:null,stop_sequence:null,usage:{input_tokens:0,output_tokens:0,cache_creation_input_tokens:0,cache_read_input_tokens:0}}})};for await(let t of e){for await(let e of c())yield e;let e=t.type;if(e===`response.output_text.delta`){o||(s&&(yield{type:`content_block_stop`,index:a},s=!1),a++,o=!0,yield{type:`content_block_start`,index:a,content_block:{type:`text`,text:``}}),yield{type:`content_block_delta`,index:a,delta:{type:`text_delta`,text:String(t.delta??``)}};continue}if(e===`response.reasoning_text.delta`){s||(o&&(yield{type:`content_block_stop`,index:a},o=!1),a++,s=!0,yield{type:`content_block_start`,index:a,content_block:{type:`thinking`,thinking:``,signature:``}}),yield{type:`content_block_delta`,index:a,delta:{type:`thinking_delta`,thinking:String(t.delta??``)}};continue}if(e===`response.output_item.added`){let e=t.item,n=typeof t.output_index==`number`?t.output_index:-1;if(e?.type===`function_call`&&n>=0){o&&(yield{type:`content_block_stop`,index:a},o=!1),s&&(yield{type:`content_block_stop`,index:a},s=!1),a++;let t=String(e.call_id??e.id??`call_${n}`),i=String(e.name??``);r.set(n,{contentIndex:a,open:!0,name:i,id:t}),yield{type:`content_block_start`,index:a,content_block:{type:`tool_use`,id:t,name:i,input:{}}}}continue}if(e===`response.function_call_arguments.delta`){let e=typeof t.output_index==`number`?t.output_index:-1,n=r.get(e);n&&(yield{type:`content_block_delta`,index:n.contentIndex,delta:{type:`input_json_delta`,partial_json:String(t.delta??``)}});continue}if(e===`response.output_item.done`){let e=typeof t.output_index==`number`?t.output_index:-1,n=r.get(e);n?.open&&(yield{type:`content_block_stop`,index:n.contentIndex},n.open=!1);continue}if(e===`response.error`){let e=t.error;throw Error(String(e?.message??`ChatGPT Responses API error`))}if(e===`response.failed`){let e=t.response?.error;throw Error(String(e?.message??`ChatGPT Responses API failed`))}if(e===`response.completed`||e===`response.incomplete`){o&&(yield{type:`content_block_stop`,index:a},o=!1),s&&(yield{type:`content_block_stop`,index:a},s=!1);let e=t.response;yield{type:`message_delta`,delta:{stop_reason:xe(e),stop_sequence:null},usage:be(e)},yield{type:`message_stop`}}}}async function Se(e){let t=await pe(),n=e.fetchOverride??globalThis.fetch,r={Authorization:`Bearer ${t.accessToken}`,"Content-Type":`application/json`,Accept:`text/event-stream`,"OpenAI-Beta":`responses=experimental`,Origin:`https://chatgpt.com`,Referer:`https://chatgpt.com/`,originator:`workmate`};t.accountId&&(r[`ChatGPT-Account-Id`]=t.accountId);let i=await n(`https://chatgpt.com/backend-api/codex/responses`,{method:`POST`,headers:r,body:JSON.stringify(e.request),signal:e.signal});if(!i.ok){let e=await i.text().catch(()=>``);throw Error(`ChatGPT Responses API request failed (${i.status})${e?`: ${e.slice(0,500)}`:``}`)}return ye(i)}var Ce=e((()=>{X()}));function we(e){if(t(process.env.OPENAI_ENABLE_THINKING))return!1;if(n(process.env.OPENAI_ENABLE_THINKING))return!0;let r=e.toLowerCase();return r.includes(`deepseek`)||r.includes(`mimo`)}function Te(e,t){return t??(process.env.OPENAI_MAX_TOKENS&&parseInt(process.env.OPENAI_MAX_TOKENS,10)||void 0)??(process.env.CLAUDE_CODE_MAX_OUTPUT_TOKENS&&parseInt(process.env.CLAUDE_CODE_MAX_OUTPUT_TOKENS,10)||void 0)??e}function Ee(e){let{model:t,messages:n,tools:r,toolChoice:i,enableThinking:a,maxTokens:o,temperatureOverride:s}=e;return{model:t,messages:n,max_tokens:o,...r.length>0&&{tools:r,...i&&{tool_choice:i}},stream:!0,stream_options:{include_usage:!0},...a&&{thinking:{type:`enabled`},enable_thinking:!0,chat_template_kwargs:{thinking:!0,enable_thinking:!0}},...!a&&s!==void 0&&{temperature:s}}}var De=e((()=>{r()}));function Oe(e,t,n,r){if(!r||o())return e;let i=t.filter(e=>n.has(e.name)).map(x).sort().join(`
10
- `);return i?[a({content:`<available-deferred-tools>\n${i}\n</available-deferred-tools>`,isMeta:!0}),...e]:e}function ke(e){return e.type===`assistant`||e.type===`user`}function $(e){let{partialMessage:t,contentBlocks:n,tools:r,agentId:i,usage:a,stopReason:o,maxTokens:c}=e,l=[],u=Object.keys(n).sort((e,t)=>Number(e)-Number(t)).map(e=>n[Number(e)]).filter(Boolean);return u.length>0&&t&&l.push({message:{...t,content:p(u,r,i),usage:a,stop_reason:o,stop_sequence:null},requestId:void 0,type:`assistant`,uuid:M(),timestamp:new Date().toISOString()}),o===`max_tokens`&&l.push(s({content:`Output truncated: response exceeded the ${c} token limit. Set OPENAI_MAX_TOKENS or CLAUDE_CODE_MAX_OUTPUT_TOKENS to override.`,apiError:`max_output_tokens`,error:`max_output_tokens`})),l}async function*Ae(e,t,n,r,i){try{let a=D(i.model),o=ee(e,n),s=await c(i.model,n,i.getToolPermissionContext||(async()=>re()),i.agents||[],i.querySource),l=new Set;if(s)for(let e of n)ie(e)&&l.add(e.name);let d=n;s&&l.size>0&&(d=n.filter(e=>!!(!l.has(e.name)||ne(e,`SearchExtraTools`))));let f=(await Promise.all(d.map(e=>u(e,{getToolPermissionContext:i.getToolPermissionContext,tools:n,agents:i.agents,allowedAgentTypes:i.allowedAgentTypes,model:i.model,deferLoading:s&&l.has(e.name)})))).filter(e=>{let t=e;return t.type!==`advisor_20260301`&&t.type!==`computer_20250124`}),p=we(a),h=E(Oe(o.filter(ke),n,l,s),t,{enableThinking:p}),_=ae(f),y=C(i.toolChoice);if(s){let e=d.filter(e=>l.has(e.name)).length;g(`[OpenAI] Tool search enabled: ${e}/${l.size} deferred tools included, total tools=${_.length}`)}else g(`[OpenAI] Tool search disabled, total tools=${_.length}`);let{upperLimit:b}=te(a),x=Te(b,i.maxOutputTokensOverride);g(`[OpenAI] Calling model=${a}, messages=${h.length}, tools=${_.length}, thinking=${p}`);let S=fe()?Q(await Se({request:ve({model:a,messages:h,tools:_,toolChoice:y}),signal:r,fetchOverride:i.fetchOverride}),a):T(await oe({maxRetries:0,fetchOverride:i.fetchOverride,source:i.querySource}).chat.completions.create(Ee({model:a,messages:h,tools:_,toolChoice:y,enableThinking:p,maxTokens:x,temperatureOverride:i.temperatureOverride}),{signal:r}),a),w={},O=null,k=null,A={input_tokens:0,output_tokens:0,cache_creation_input_tokens:0,cache_read_input_tokens:0},j=0,M=Date.now();for await(let e of S){switch(e.type){case`message_start`:O=e.message,j=Date.now()-M,e.message.usage&&(A={...A,...e.message.usage});break;case`content_block_start`:{let t=e.index,n=e.content_block;n.type===`tool_use`?w[t]={...n,input:``}:n.type===`text`?w[t]={...n,text:``}:n.type===`thinking`?w[t]={...n,thinking:``,signature:``}:w[t]={...n};break}case`content_block_delta`:{let t=e.index,n=e.delta,r=w[t];if(!r)break;n.type===`text_delta`?r.text=(r.text||``)+n.text:n.type===`input_json_delta`?r.input=(r.input||``)+n.partial_json:n.type===`thinking_delta`?r.thinking=(r.thinking||``)+n.thinking:n.type===`signature_delta`&&(r.signature=n.signature);break}case`content_block_stop`:break;case`message_delta`:{let t=e.usage;t&&(A=se(A,t)),e.delta.stop_reason!=null&&(k=e.delta.stop_reason);break}case`message_stop`:if(O){for(let e of $({partialMessage:O,contentBlocks:w,tools:n,agentId:i.agentId,usage:A,stopReason:k,maxTokens:x}))yield e;O=null}A.input_tokens+A.output_tokens>0&&m(v(a,A),A,i.model);break}yield{type:`stream_event`,event:e,...e.type===`message_start`?{ttftMs:j}:void 0}}if(O)for(let e of $({partialMessage:O,contentBlocks:w,tools:n,agentId:i.agentId,usage:A,stopReason:k,maxTokens:x}))yield e}catch(e){let t=e instanceof Error?e.message:String(e);g(`[OpenAI] Error: ${t}`,{level:`error`}),yield s({content:`API Error: ${t}`,apiError:`api_error`,error:e instanceof Error?e:Error(String(e))})}}e((()=>{O(),k(),w(),X(),Ce(),f(),l(),S(),h(),d(),y(),De(),_(),i(),b()}))();export{Ae as queryModelOpenAI};
10
+ `);return i?[c({content:`<available-deferred-tools>\n${i}\n</available-deferred-tools>`,isMeta:!0}),...e]:e}function ke(e){return e.type===`assistant`||e.type===`user`}function $(e){let{partialMessage:t,contentBlocks:n,tools:r,agentId:i,usage:o,stopReason:s,maxTokens:c}=e,l=[],u=Object.keys(n).sort((e,t)=>Number(e)-Number(t)).map(e=>n[Number(e)]).filter(Boolean);return u.length>0&&t&&l.push({message:{...t,content:d(u,r,i),usage:o,stop_reason:s,stop_sequence:null},requestId:void 0,type:`assistant`,uuid:M(),timestamp:new Date().toISOString()}),s===`max_tokens`&&l.push(a({content:`Output truncated: response exceeded the ${c} token limit. Set OPENAI_MAX_TOKENS or CLAUDE_CODE_MAX_OUTPUT_TOKENS to override.`,apiError:`max_output_tokens`,error:`max_output_tokens`})),l}async function*Ae(e,t,n,r,o){try{let a=D(o.model),s=ee(e,n),c=await l(o.model,n,o.getToolPermissionContext||(async()=>S()),o.agents||[],o.querySource),u=new Set;if(c)for(let e of n)re(e)&&u.add(e.name);let d=n;c&&u.size>0&&(d=n.filter(e=>!!(!u.has(e.name)||ie(e,`SearchExtraTools`))));let f=(await Promise.all(d.map(e=>m(e,{getToolPermissionContext:o.getToolPermissionContext,tools:n,agents:o.agents,allowedAgentTypes:o.allowedAgentTypes,model:o.model,deferLoading:c&&u.has(e.name)})))).filter(e=>{let t=e;return t.type!==`advisor_20260301`&&t.type!==`computer_20250124`}),p=we(a),h=E(Oe(s.filter(ke),n,u,c),t,{enableThinking:p}),_=ae(f),v=C(o.toolChoice);if(c){let e=d.filter(e=>u.has(e.name)).length;g(`[OpenAI] Tool search enabled: ${e}/${u.size} deferred tools included, total tools=${_.length}`)}else g(`[OpenAI] Tool search disabled, total tools=${_.length}`);let{upperLimit:y}=te(a),b=Te(y,o.maxOutputTokensOverride);g(`[OpenAI] Calling model=${a}, messages=${h.length}, tools=${_.length}, thinking=${p}`);let x=fe()?Q(await Se({request:ve({model:a,messages:h,tools:_,toolChoice:v}),signal:r,fetchOverride:o.fetchOverride}),a):T(await oe({maxRetries:0,fetchOverride:o.fetchOverride,source:o.querySource}).chat.completions.create(Ee({model:a,messages:h,tools:_,toolChoice:v,enableThinking:p,maxTokens:b,temperatureOverride:o.temperatureOverride}),{signal:r}),a),w={},O=null,k=null,A={input_tokens:0,output_tokens:0,cache_creation_input_tokens:0,cache_read_input_tokens:0},j=0,M=Date.now();for await(let e of x){switch(e.type){case`message_start`:O=e.message,j=Date.now()-M,e.message.usage&&(A={...A,...e.message.usage});break;case`content_block_start`:{let t=e.index,n=e.content_block;n.type===`tool_use`?w[t]={...n,input:``}:n.type===`text`?w[t]={...n,text:``}:n.type===`thinking`?w[t]={...n,thinking:``,signature:``}:w[t]={...n};break}case`content_block_delta`:{let t=e.index,n=e.delta,r=w[t];if(!r)break;n.type===`text_delta`?r.text=(r.text||``)+n.text:n.type===`input_json_delta`?r.input=(r.input||``)+n.partial_json:n.type===`thinking_delta`?r.thinking=(r.thinking||``)+n.thinking:n.type===`signature_delta`&&(r.signature=n.signature);break}case`content_block_stop`:break;case`message_delta`:{let t=e.usage;t&&(A=se(A,t)),e.delta.stop_reason!=null&&(k=e.delta.stop_reason);break}case`message_stop`:if(O){for(let e of $({partialMessage:O,contentBlocks:w,tools:n,agentId:o.agentId,usage:A,stopReason:k,maxTokens:b}))yield e;O=null}A.input_tokens+A.output_tokens>0&&i(ne(a,A),A,o.model);break}yield{type:`stream_event`,event:e,...e.type===`message_start`?{ttftMs:j}:void 0}}if(O)for(let e of $({partialMessage:O,contentBlocks:w,tools:n,agentId:o.agentId,usage:A,stopReason:k,maxTokens:b}))yield e}catch(e){let t=e instanceof Error?e.message:String(e);g(`[OpenAI] Error: ${t}`,{level:`error`}),yield a({content:`API Error: ${t}`,apiError:`api_error`,error:e instanceof Error?e:Error(String(e))})}}e((()=>{O(),k(),w(),X(),Ce(),u(),f(),y(),h(),p(),v(),De(),_(),s(),b()}))();export{Ae as queryModelOpenAI};
@@ -1 +1 @@
1
- import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{I as n,P as r,fi as i,hn as a,t as o,y as s}from"./src-CDCSSo0U2.js";import{t as c}from"./jsx-runtime-Bb4Xn-E0.js";import{o as l,r as u}from"./break-cache-BKvoMOZx.js";async function d(e,t){let n=await u(e);n.type===`text`&&t(n.value,{display:`system`})}function f({onDone:e}){let[t,i]=(0,m.useState)(0),o=(0,m.useMemo)(()=>[{label:`Status`,description:`Show pending marker, always mode, and break count`,run:()=>void d(`status`,e)},{label:`Once`,description:`Break prompt cache on the next API call only`,run:()=>void d(`once`,e)},{label:`Always`,description:`Break prompt cache on every API call`,run:()=>void d(`always`,e)},{label:`Off`,description:`Disable always mode and clear pending once marker`,run:()=>void d(`off`,e)},{label:`Clear Once`,description:`Cancel the pending one-time cache break`,run:()=>void d(`--clear`,e)}],[e]),c=()=>{let e=o[t];e&&e.run()};return a((e,t)=>{if(t.upArrow){i(e=>Math.max(0,e-1));return}if(t.downArrow){i(e=>Math.min(o.length-1,e+1));return}t.return&&c()}),(0,h.jsx)(s,{title:`Break Cache`,subtitle:`${o.length} actions`,onCancel:()=>e(`Break-cache panel dismissed`,{display:`system`}),color:`background`,hideInputGuide:!0,children:(0,h.jsxs)(n,{flexDirection:`column`,children:[o.map((e,i)=>(0,h.jsxs)(n,{flexDirection:`row`,children:[(0,h.jsx)(r,{children:`${i===t?`›`:` `} ${e.label}`.padEnd(g)}),(0,h.jsx)(r,{dimColor:!0,children:e.description})]},e.label)),(0,h.jsx)(n,{marginTop:1,children:(0,h.jsx)(r,{dimColor:!0,children:`↑/↓ select · Enter run · Esc close`})})]})})}async function p(e,t,n){let r=n?.trim()??``;return r?(await d(r,e),null):(0,h.jsx)(f,{onDone:e})}var m,h,g;e((()=>{m=t(i(),1),o(),l(),h=c(),g=28}))();export{p as call};
1
+ import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{I as n,P as r,fi as i,hn as a,t as o,y as s}from"./src-P_wYS_NJ2.js";import{t as c}from"./jsx-runtime-Bb4Xn-E0.js";import{o as l,r as u}from"./break-cache-DXV0brco.js";async function d(e,t){let n=await u(e);n.type===`text`&&t(n.value,{display:`system`})}function f({onDone:e}){let[t,i]=(0,m.useState)(0),o=(0,m.useMemo)(()=>[{label:`Status`,description:`Show pending marker, always mode, and break count`,run:()=>void d(`status`,e)},{label:`Once`,description:`Break prompt cache on the next API call only`,run:()=>void d(`once`,e)},{label:`Always`,description:`Break prompt cache on every API call`,run:()=>void d(`always`,e)},{label:`Off`,description:`Disable always mode and clear pending once marker`,run:()=>void d(`off`,e)},{label:`Clear Once`,description:`Cancel the pending one-time cache break`,run:()=>void d(`--clear`,e)}],[e]),c=()=>{let e=o[t];e&&e.run()};return a((e,t)=>{if(t.upArrow){i(e=>Math.max(0,e-1));return}if(t.downArrow){i(e=>Math.min(o.length-1,e+1));return}t.return&&c()}),(0,h.jsx)(s,{title:`Break Cache`,subtitle:`${o.length} actions`,onCancel:()=>e(`Break-cache panel dismissed`,{display:`system`}),color:`background`,hideInputGuide:!0,children:(0,h.jsxs)(n,{flexDirection:`column`,children:[o.map((e,i)=>(0,h.jsxs)(n,{flexDirection:`row`,children:[(0,h.jsx)(r,{children:`${i===t?`›`:` `} ${e.label}`.padEnd(g)}),(0,h.jsx)(r,{dimColor:!0,children:e.description})]},e.label)),(0,h.jsx)(n,{marginTop:1,children:(0,h.jsx)(r,{dimColor:!0,children:`↑/↓ select · Enter run · Esc close`})})]})})}async function p(e,t,n){let r=n?.trim()??``;return r?(await d(r,e),null):(0,h.jsx)(f,{onDone:e})}var m,h,g;e((()=>{m=t(i(),1),o(),l(),h=c(),g=28}))();export{p as call};
@@ -0,0 +1 @@
1
+ import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{gl as n,hl as r}from"./loadAgentsDir-CKSb56Gp.js";import{I as i,P as a,fi as o,hn as s,mt as c,t as l,y as u}from"./src-P_wYS_NJ2.js";import{t as d}from"./jsx-runtime-Bb4Xn-E0.js";function f(e){return e.status===`running`?{mark:`●`,color:`warning`}:e.resultKind===`dead`?{mark:`✗`,color:`error`}:{mark:`✓`,color:`success`}}function p(e){return e?e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e):`0`}function m(e){let t=[];return e.model&&t.push(e.model),t.push(`${p(e.tokenCount)} tok`),t.push(`${e.toolCount??0} tool`),t.join(` · `)}var h,g,_,v,y,b=e((()=>{h={running:`●`,completed:`✓`,failed:`✗`,killed:`■`},g={running:`warning`,completed:`success`,failed:`error`,killed:`subtle`},_={running:`running`,completed:`done`,failed:`failed`,killed:`killed`},v={running:`●`,done:`✓`,pending:`○`},y={running:`warning`,done:`success`,pending:`subtle`}}));function x(e,t){if(e.length<=t)return e;let n=e.match(/#\d+$/);if(!n)return e.slice(0,t);let r=n[0],i=e.slice(0,e.length-r.length),a=t-r.length-1;return`${i.slice(0,a)}…${r}`}function S({agents:e,selectedIndex:t,focused:n}){let[r,o]=c(T),s=w[Math.floor(o/T)%w.length];return e.length===0?(0,C.jsx)(a,{color:`subtle`,children:`(no agents in this phase)`}):(0,C.jsx)(i,{ref:r,flexDirection:`column`,children:e.map((e,r)=>{let o=f(e),c=r===t&&n,l=e.status===`running`?s:o.mark,u=x(e.label??`agent-${e.id}`,E);return(0,C.jsxs)(i,{backgroundColor:c?`selectionBg`:void 0,justifyContent:`space-between`,children:[(0,C.jsxs)(i,{children:[(0,C.jsx)(a,{color:o.color,children:l}),(0,C.jsxs)(a,{children:[` `,u]})]}),(0,C.jsx)(a,{color:`subtle`,children:m(e)})]},e.id)})})}var C,w,T,E,D=e((()=>{o(),l(),b(),C=d(),w=[`·`,`✢`,`✱`,`✶`,`✻`,`✽`],T=120,E=18}));function O(e,t){return e?.status===`done`?`done`:t.length>0?t.every(e=>e.status===`done`)?`done`:`running`:e?.status===`running`?`running`:`pending`}function k(e){let t=new Map(e.phases.map(e=>[e.title,e])),n=new Set,r=[],i=i=>{if(n.has(i))return;n.add(i);let a=t.get(i),o=e.agents.filter(e=>e.phase===i);r.push({title:i,status:O(a,o),done:o.filter(e=>e.status===`done`).length,total:o.length})};for(let t of e.declaredPhases)i(t);for(let t of e.phases)i(t.title);for(let t of e.agents)t.phase&&i(t.phase);return r}function ee(e,t){return t===void 0||t===`All`?e:e.filter(e=>e.phase===t)}function A(e){return e.filter(e=>e.status===`running`)}function j(e,t){let n=Math.max(0,Math.trunc(t)),r=e.slice(0,n);return{runs:r,overflow:Math.max(0,e.length-r.length)}}function M(e,t){return`${e}#${t.slice(-4)}`}function N(e){let t=Math.floor(e/1e3);if(t<60)return`${t}s`;let n=Math.floor(t/60),r=t%60;return n<60?`${n}m${String(r).padStart(2,`0`)}s`:`${Math.floor(n/60)}h${String(n%60).padStart(2,`0`)}m`}var P=e((()=>{}));function te({phases:e,agents:t,selectedIndex:n,focused:r}){let[o,s]=c(L),l=I[Math.floor(s/L)%I.length],u=t.length;return(0,F.jsx)(i,{ref:o,flexDirection:`column`,children:[{title:`All`,done:t.filter(e=>e.status===`done`).length,total:u},...e].map((e,t)=>{let o=t===n,s=o&&r,c=e.status===`running`?l:e.status?v[e.status]:` `,u=e.status?y[e.status]:`subtle`;return(0,F.jsxs)(i,{backgroundColor:s?`selectionBg`:void 0,justifyContent:`space-between`,children:[(0,F.jsxs)(i,{children:[(0,F.jsx)(a,{color:o?`claude`:void 0,children:s?`>`:` `}),(0,F.jsx)(a,{children:` `}),(0,F.jsx)(a,{color:u,children:c}),(0,F.jsxs)(a,{children:[` `,e.title]})]}),(0,F.jsxs)(a,{color:`subtle`,children:[e.done,`/`,e.total]})]},e.title)})})}var F,I,L,R=e((()=>{o(),l(),b(),P(),F=d(),I=[`·`,`✢`,`✱`,`✶`,`✻`,`✽`],L=120}));function z({runs:e,activeRunId:t}){if(e.length===0)return(0,B.jsx)(a,{color:`subtle`,children:`(no runs)`});let{runs:n,overflow:r}=j(e,H);return(0,B.jsxs)(i,{children:[n.map(e=>{let n=e.runId===t,r=x(M(e.workflowName,e.runId),V),o=`═`.repeat(r.length+2);return(0,B.jsxs)(i,{flexDirection:`column`,marginRight:2,children:[(0,B.jsxs)(i,{children:[(0,B.jsx)(a,{color:g[e.status],children:h[e.status]}),(0,B.jsx)(a,{children:` `}),(0,B.jsx)(a,{color:n?`claude`:void 0,bold:n,children:r})]}),(0,B.jsx)(a,{color:n?`claude`:void 0,children:n?o:``})]},e.runId)}),r>0?(0,B.jsxs)(i,{flexDirection:`column`,marginRight:2,children:[(0,B.jsxs)(a,{color:`subtle`,children:[`+`,r]}),(0,B.jsx)(a,{children:` `})]}):null]})}var B,V,H,U=e((()=>{o(),l(),b(),P(),D(),B=d(),V=18,H=6}));function W(e,t,n=`normal`){return n===`confirm`?e===`y`||e===`Y`||t.return?`confirmYes`:e===`n`||e===`N`||t.escape||e===`q`?`confirmNo`:null:t.tab||e===` `?t.shift?`prevTab`:`nextTab`:t.escape||e===`q`?`quit`:e===`K`?`killWorkflow`:e===`x`?`killAgent`:e===`r`?`resume`:e===`n`?`newRun`:t.leftArrow?`focusLeft`:t.rightArrow?`focusRight`:t.upArrow?`moveUp`:t.downArrow?`moveDown`:null}function G(e,t=`normal`){s((n,r)=>{let i=W(n,r,t);if(i!==null)switch(i){case`nextTab`:e.nextTab();break;case`prevTab`:e.prevTab();break;case`focusLeft`:e.focusLeft();break;case`focusRight`:e.focusRight();break;case`moveUp`:e.moveUp();break;case`moveDown`:e.moveDown();break;case`killAgent`:e.killAgent();break;case`killWorkflow`:e.killWorkflow();break;case`resume`:e.resumeFocused();break;case`newRun`:e.newRun();break;case`quit`:e.quit();break;case`confirmYes`:e.confirmYes();break;case`confirmNo`:e.confirmNo();break}})}var K=e((()=>{l()}));function q(e,t){if(t===0)return 0;let n=Math.trunc(e);return Number.isNaN(n)||n<0?0:Math.min(n,t-1)}function J(e,t){return!e||!t||e.runId!==t.runId||e.status!==`running`?!1:t.status===`completed`||t.status===`failed`||t.status===`killed`}function Y({onDone:e,context:t}){let n=r(),o=(0,X.useSyncExternalStore)(n.subscribe,()=>n.listRuns(),()=>[]),s=A(o),[l,d]=(0,X.useState)(null),[f,p]=(0,X.useState)(`phases`),[m,h]=(0,X.useState)(0),[v,y]=(0,X.useState)(0),[b,x]=(0,X.useState)(null);(0,X.useEffect)(()=>{n.loadPersistedRuns()},[n]),(0,X.useEffect)(()=>{if(s.length===0){l!==null&&d(null);return}s.some(e=>e.runId===l)||d(s[0].runId)},[s,l]);let C=s.find(e=>e.runId===l),w=C?k(C):[],T=w.length+1,E=q(m,T),D=(0,X.useRef)(null);(0,X.useEffect)(()=>{let t=C?{runId:C.runId,status:C.status}:null,n=D.current;if(D.current=t,!J(n,t))return;let r=setTimeout(()=>e(),800);return()=>{clearTimeout(r)}},[C?.runId,C?.status,e]);let O=E===0?void 0:w[E-1]?.title,j=C?ee(C.agents,O):[],M=q(v,j.length),P=e=>{d(e),p(`phases`),h(0),y(0)};G({nextTab:()=>{if(s.length===0)return;let e=s.findIndex(e=>e.runId===l),t=s[(e+1)%s.length];P(t.runId)},prevTab:()=>{if(s.length===0)return;let e=s.findIndex(e=>e.runId===l),t=s[(e-1+s.length)%s.length];P(t.runId)},focusLeft:()=>p(`phases`),focusRight:()=>p(`agents`),moveUp:()=>{f===`phases`?h(e=>q(e-1,T)):y(e=>q(e-1,j.length))},moveDown:()=>{f===`phases`?h(e=>q(e+1,T)):y(e=>q(e+1,j.length))},killAgent:()=>{f!==`agents`||!C||j[M]&&x(`agent`)},killWorkflow:()=>{C&&x(`workflow`)},resumeFocused:()=>{if(!C)return;let r=t.canUseTool;if(!r){e(`resume needs canUseTool context; run /<name> resume from the main session.`);return}n.launch({resumeFromRunId:C.runId,name:C.workflowName},t,r).catch(t=>e(`resume failed: ${t.message}`))},newRun:()=>e(`Tip: start a named workflow with /<name>, or pass name via the Workflow tool.`),quit:()=>{if(b!==null){x(null);return}e()},confirmYes:()=>{if(b===`workflow`&&C){n.kill(C.runId),x(null),e();return}else if(b===`agent`&&C){let e=j[M];e&&n.killAgent(C.runId,e.id)}x(null)},confirmNo:()=>x(null)},b===null?`normal`:`confirm`);let F=o.filter(e=>e.status===`running`).length,I=o.length-F,L=O??`All`,R=C?C.agents.filter(e=>e.status===`done`).length:0,[B]=c(1e3),V=C?Date.now()-C.startedAt:0;return(0,Z.jsxs)(i,{ref:B,flexDirection:`column`,borderStyle:`round`,borderColor:`claude`,paddingX:1,children:[(0,Z.jsxs)(i,{justifyContent:`space-between`,children:[(0,Z.jsx)(a,{bold:!0,children:C?.workflowName??`Workflows`}),C?(0,Z.jsxs)(a,{color:`subtle`,children:[R,`/`,C.agentCount,` agents · `,N(V),` ·`,` `,(0,Z.jsx)(a,{color:g[C.status],children:_[C.status]})]}):(0,Z.jsxs)(a,{color:`subtle`,children:[F,` running · `,I,` done`]})]}),C?.description?(0,Z.jsx)(a,{color:`subtle`,children:C.description}):null,s.length>1?(0,Z.jsx)(i,{marginTop:1,children:(0,Z.jsx)(z,{runs:s,activeRunId:l})}):null,(0,Z.jsxs)(i,{flexDirection:`row`,marginTop:1,children:[(0,Z.jsxs)(i,{width:`25%`,flexDirection:`column`,children:[(0,Z.jsx)(a,{color:f===`phases`?`claude`:`subtle`,bold:!0,children:`Phases`}),(0,Z.jsx)(te,{phases:w,agents:C?.agents??[],selectedIndex:E,focused:f===`phases`})]}),(0,Z.jsx)(a,{color:`subtle`,children:`│`}),(0,Z.jsxs)(i,{flexGrow:1,flexDirection:`column`,children:[(0,Z.jsxs)(a,{color:f===`agents`?`claude`:`subtle`,bold:!0,children:[L,` · `,j.length,` agents`]}),(0,Z.jsx)(S,{agents:j,selectedIndex:M,focused:f===`agents`})]})]}),(0,Z.jsx)(i,{marginTop:1,children:(0,Z.jsx)(a,{color:`subtle`,children:b===null?`Tab switch run · ←/→ focus · ↑/↓ move · x kill agent · K kill workflow · r resume · q quit`:`Confirm: y kill · n/Esc cancel`})}),b===null?null:(0,Z.jsx)(u,{title:b===`workflow`?`Kill workflow "${C?.workflowName??``}"?`:`Kill agent "${j[M]?.label??``}"?`,subtitle:b===`workflow`?`All in-flight agents will be aborted. Resume will replay from journal.`:`Only this agent aborts; other agents in the workflow keep running.`,onCancel:()=>x(null),color:`warning`,children:(0,Z.jsx)(a,{color:`subtle`,children:`Press y to confirm, or n/Esc to cancel.`})})]})}var X,Z,ne=e((()=>{X=t(o(),1),l(),n(),D(),R(),U(),b(),K(),P(),Z=d()})),Q,$;e((()=>{ne(),Q=d(),$=async(e,t,n)=>(0,Q.jsx)(Y,{onDone:e,context:t})}))();export{$ as call};
@@ -0,0 +1 @@
1
+ import{i as e,r as t}from"./parser-BdCj2GrE.js";t();export{e as parseCommand};
@@ -1 +1 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{a as t}from"./debug-RZ4NuXyS.js";var n,r=e((()=>{Promise.resolve(),n=new Set([`if`,`then`,`elif`,`else`,`fi`,`while`,`until`,`for`,`in`,`do`,`done`,`case`,`esac`,`function`,`select`])}));async function i(e){return!e||e.length,null}async function a(e){return!e||e.length,null}function o(e){if(e.type===`declaration_command`){let t=e.children[0];return t&&c.has(t.text)?[t.text]:[]}let t=[],n=!1;for(let r of e.children)if(r.type!==`variable_assignment`){if(r.type===`command_name`||!n&&r.type===`word`){n=!0,t.push(r.text);continue}if(l.has(r.type))t.push(s(r.text));else if(u.has(r.type))break}return t}function s(e){return e.length>=2&&(e[0]===`"`&&e.at(-1)===`"`||e[0]===`'`&&e.at(-1)===`'`)?e.slice(1,-1):e}var c,l,u,d,f=e((()=>{t(),r(),c=new Set([`export`,`declare`,`typeset`,`readonly`,`local`,`unset`,`unsetenv`]),l=new Set([`word`,`string`,`raw_string`,`number`]),u=new Set([`command_substitution`,`process_substitution`]),d=Symbol(`parse-aborted`)}));export{a,i,o as n,n as o,f as r,r as s,d as t};
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{a as t}from"./debug-BdqxZ7rV.js";var n,r=e((()=>{Promise.resolve(),n=new Set([`if`,`then`,`elif`,`else`,`fi`,`while`,`until`,`for`,`in`,`do`,`done`,`case`,`esac`,`function`,`select`])}));async function i(e){return!e||e.length,null}async function a(e){return!e||e.length,null}function o(e){if(e.type===`declaration_command`){let t=e.children[0];return t&&c.has(t.text)?[t.text]:[]}let t=[],n=!1;for(let r of e.children)if(r.type!==`variable_assignment`){if(r.type===`command_name`||!n&&r.type===`word`){n=!0,t.push(r.text);continue}if(l.has(r.type))t.push(s(r.text));else if(u.has(r.type))break}return t}function s(e){return e.length>=2&&(e[0]===`"`&&e.at(-1)===`"`||e[0]===`'`&&e.at(-1)===`'`)?e.slice(1,-1):e}var c,l,u,d,f=e((()=>{t(),r(),c=new Set([`export`,`declare`,`typeset`,`readonly`,`local`,`unset`,`unsetenv`]),l=new Set([`word`,`string`,`raw_string`,`number`]),u=new Set([`command_substitution`,`process_substitution`]),d=Symbol(`parse-aborted`)}));export{a,i,o as n,n as o,f as r,r as s,d as t};
@@ -0,0 +1 @@
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{DE as t,OE as n}from"./loadAgentsDir-CKSb56Gp.js";import{Ci as r,Er as i,Tr as a,wi as o}from"./state-Bs5xweDL.js";function s(e,t,n,r){for(var i=-1,a=e==null?0:e.length;++i<a;){var o=e[i];t(r,o,n(o),e)}return r}var c=e((()=>{}));function l(e,n,r,i){return t(e,function(e,t,a){n(i,e,r(e),a)}),i}var u=e((()=>{n()}));function d(e,t){return function(n,r){var i=o(n)?s:l,c=t?t():{};return i(n,e,a(r,2),c)}}var f=e((()=>{c(),u(),i(),r()})),p,m=e((()=>{f(),p=d(function(e,t,n){e[+!n].push(t)},function(){return[[],[]]})}));export{p as n,m as t};
@@ -0,0 +1,3 @@
1
+ import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{n,t as r}from"./figures-5ThXQEtq.js";import{B as i,Ew as a,G as o,H as s,Qa as c,Sd as l,T_ as u,V as d,W as f,aE as p,cE as ee,dd as m,fd as h,ja as g,lv as te,n_ as _,ov as ne,pw as re,r_ as v,sv as ie,w_ as y,x_ as ae,xd as b,z as oe}from"./loadAgentsDir-CKSb56Gp.js";import{I as x,P as S,Wt as se,Xn as ce,a as C,di as w,fi as T,hn as E,k as D,kt as O,n as k,o as A,ot as le,r as ue,s as de,t as j,ui as M,x as fe,y as N}from"./src-P_wYS_NJ2.js";import{t as P}from"./jsx-runtime-Bb4Xn-E0.js";import{Kt as pe,tt as F}from"./state-Bs5xweDL.js";import{S as me,w as I}from"./debug-BdqxZ7rV.js";import{H as L,V as R,cn as he,g as z,nn as B,o as ge,z as V}from"./settings-Xbq6AaD-.js";import{l as _e,o as ve}from"./stringUtils-CbS6OkmE.js";import{n as ye,t as be}from"./useExitOnCtrlCDWithKeybindings-D2FvHieH.js";import{n as xe,t as Se}from"./AddWorkspaceDirectory-qFZy3FOD.js";import{t as Ce}from"./SearchBox-C9vUA4IM.js";import{n as we,t as Te}from"./useSearchInput-C6d6nt9S.js";import{n as Ee,t as De}from"./shadowedRuleDetection-B9iSx6mB.js";import{n as H,t as Oe}from"./autoModeDenials-BxNzGJdR.js";function ke({ruleValue:e}){switch(e.toolName){case _.name:return e.ruleContent?e.ruleContent.endsWith(`:*`)?(0,U.jsxs)(S,{dimColor:!0,children:[`Any Bash command starting with `,(0,U.jsx)(S,{bold:!0,children:e.ruleContent.slice(0,-2)})]}):(0,U.jsxs)(S,{dimColor:!0,children:[`The Bash command `,(0,U.jsx)(S,{bold:!0,children:e.ruleContent})]}):(0,U.jsx)(S,{dimColor:!0,children:`Any Bash command`});default:return e.ruleContent?null:(0,U.jsxs)(S,{dimColor:!0,children:[`Any use of the `,(0,U.jsx)(S,{bold:!0,children:e.toolName}),` tool`]})}}var U,Ae=e((()=>{T(),j(),v(),U=P()}));function je(e){switch(e){case`localSettings`:return{label:`Project settings (local)`,description:`Saved in ${ge(`localSettings`)}`,value:e};case`projectSettings`:return{label:`Project settings`,description:`Checked in at ${ge(`projectSettings`)}`,value:e};case`userSettings`:return{label:`User settings`,description:`Saved in at ~/.claude/settings.json`,value:e}}}function Me({onAddRules:e,onCancel:t,ruleValues:n,ruleBehavior:r,initialContext:i,setToolPermissionContext:a}){let o=B.map(je),s=(0,Ne.useCallback)(o=>{if(o===`cancel`){t();return}else if(B.includes(o)){let t=o,s=ae(i,{type:`addRules`,rules:n,behavior:r,destination:t});u({type:`addRules`,rules:n,behavior:r,destination:t}),a(s);let c=n.map(e=>({ruleValue:e,ruleBehavior:r,source:t})),l=De(s,{sandboxAutoAllowEnabled:p.isSandboxingEnabled()&&p.isAutoAllowBashIfSandboxedEnabled()}).filter(e=>n.some(t=>t.toolName===e.rule.ruleValue.toolName&&t.ruleContent===e.rule.ruleValue.ruleContent));e(c,l.length>0?l:void 0)}},[e,t,n,r,i,a]);return(0,W.jsxs)(N,{title:`Add ${r} permission ${_e(n.length,`rule`)}`,onCancel:t,color:`permission`,children:[(0,W.jsx)(x,{flexDirection:`column`,paddingX:2,children:n.map(e=>(0,W.jsxs)(x,{flexDirection:`column`,children:[(0,W.jsx)(S,{bold:!0,children:L(e)}),(0,W.jsx)(ke,{ruleValue:e})]},L(e)))}),(0,W.jsxs)(x,{flexDirection:`column`,marginY:1,children:[(0,W.jsx)(S,{children:n.length===1?`Where should this rule be saved?`:`Where should these rules be saved?`}),(0,W.jsx)(m,{options:o,onChange:s})]})]})}var Ne,W,Pe=e((()=>{T(),Ne=t(T(),1),h(),j(),y(),V(),Ee(),ee(),he(),z(),ve(),Ae(),W=P()}));function Fe({onCancel:e,onSubmit:t,ruleBehavior:n}){let[i,a]=(0,Ie.useState)(``),[o,s]=(0,Ie.useState)(0),c=ye();se(`confirm:no`,e,{context:`Settings`});let{columns:l}=le(),u=l-6;return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(x,{flexDirection:`column`,gap:1,borderStyle:`round`,paddingLeft:1,paddingRight:1,borderColor:`permission`,children:[(0,G.jsxs)(S,{bold:!0,color:`permission`,children:[`Add `,n,` permission rule`]}),(0,G.jsxs)(x,{flexDirection:`column`,children:[(0,G.jsxs)(S,{children:[`Permission rules are a tool name, optionally followed by a specifier in parentheses.`,(0,G.jsx)(O,{}),`e.g., `,(0,G.jsx)(S,{bold:!0,children:L({toolName:_.name})}),(0,G.jsx)(S,{bold:!1,children:` or `}),(0,G.jsx)(S,{bold:!0,children:L({toolName:_.name,ruleContent:`ls:*`})})]}),(0,G.jsx)(x,{borderDimColor:!0,borderStyle:`round`,marginY:1,paddingLeft:1,children:(0,G.jsx)(b,{showCursor:!0,value:i,onChange:a,onSubmit:e=>{let r=e.trim();r.length!==0&&t(R(r),n)},placeholder:`Enter permission rule${r.ellipsis}`,columns:u,cursorOffset:o,onChangeCursorOffset:s})})]})]}),(0,G.jsx)(x,{marginLeft:3,children:c.pending?(0,G.jsxs)(S,{dimColor:!0,children:[`Press `,c.keyName,` again to exit`]}):(0,G.jsx)(S,{dimColor:!0,children:`Enter to submit · Esc to cancel`})})]})}var Ie,G,Le=e((()=>{n(),T(),Ie=t(T(),1),l(),be(),re(),j(),a(),v(),V(),G=P()}));function Re({onHeaderFocusChange:e,onStateChange:t}){let{headerFocused:n,focusHeader:r}=C();(0,K.useEffect)(()=>{e?.(n)},[n,e]);let[i]=(0,K.useState)(()=>Oe()),[a,o]=(0,K.useState)(()=>new Set),[s,c]=(0,K.useState)(()=>new Set),[l,u]=(0,K.useState)(0);(0,K.useEffect)(()=>{t({approved:a,retry:s,denials:i})},[a,s,i,t]);let d=(0,K.useCallback)(e=>{let t=Number(e);o(e=>{let n=new Set(e);return n.has(t)?n.delete(t):n.add(t),n})},[]),f=(0,K.useCallback)(e=>{u(Number(e))},[]);if(E((e,t)=>{e===`r`&&(c(e=>{let t=new Set(e);return t.has(l)?t.delete(l):t.add(l),t}),o(e=>{if(e.has(l))return e;let t=new Set(e);return t.add(l),t}))},{isActive:i.length>0}),i.length===0)return(0,q.jsx)(S,{dimColor:!0,children:`No recent denials. Commands denied by the auto mode classifier will appear here.`});let p=i.map((e,t)=>{let n=a.has(t),r=s.has(t)?` (retry)`:``;return{label:(0,q.jsxs)(S,{children:[(0,q.jsx)(de,{status:n?`success`:`error`,withSpace:!0}),e.display,(0,q.jsx)(S,{dimColor:!0,children:r})]}),value:String(t)}});return(0,q.jsxs)(x,{flexDirection:`column`,children:[(0,q.jsx)(S,{children:`Commands recently denied by the auto mode classifier.`}),(0,q.jsx)(x,{marginTop:1,children:(0,q.jsx)(m,{options:p,onChange:d,onFocus:f,visibleOptionCount:Math.min(10,p.length),isDisabled:n,onUpFromFirstItem:r})})]})}var K,q,ze=e((()=>{T(),K=t(T(),1),j(),H(),h(),q=P()}));function Be({directoryPath:e,onRemove:t,onCancel:n,permissionContext:r,setPermissionContext:i}){let a=(0,Ve.useCallback)(()=>{i(ae(r,{type:`removeDirectories`,directories:[e],destination:`session`})),t()},[e,r,i,t]),o=(0,Ve.useCallback)(e=>{e===`yes`?a():n()},[a,n]);return(0,J.jsxs)(N,{title:`Remove directory from workspace?`,onCancel:n,color:`error`,children:[(0,J.jsx)(x,{marginX:2,flexDirection:`column`,children:(0,J.jsx)(S,{bold:!0,children:e})}),(0,J.jsx)(S,{children:`Claude Code will no longer have access to files in this directory.`}),(0,J.jsx)(m,{onChange:o,onCancel:n,options:[{label:`Yes`,value:`yes`},{label:`No`,value:`no`}]})]})}var Ve,J,He=e((()=>{T(),Ve=t(T(),1),h(),j(),y(),J=P()}));function Ue({onExit:e,toolPermissionContext:t,onRequestAddDirectory:n,onRequestRemoveDirectory:i,onHeaderFocusChange:a}){let{headerFocused:o,focusHeader:s}=C();(0,Y.useEffect)(()=>{a?.(o)},[o,a]);let c=We.useMemo(()=>Array.from(t.additionalWorkingDirectories.keys()).map(e=>({path:e,isCurrent:!1,isDeletable:!0})),[t.additionalWorkingDirectories]),l=(0,Y.useCallback)(e=>{if(e===`add-directory`){n();return}let t=c.find(t=>t.path===e);t&&t.isDeletable&&i(t.path)},[c,n,i]),u=(0,Y.useCallback)(()=>e(`Workspace dialog dismissed`,{display:`system`}),[e]),d=We.useMemo(()=>{let e=c.map(e=>({label:e.path,value:e.path}));return e.push({label:`Add directory${r.ellipsis}`,value:`add-directory`}),e},[c]);return(0,X.jsxs)(x,{flexDirection:`column`,marginBottom:1,children:[(0,X.jsxs)(x,{flexDirection:`row`,marginTop:1,marginLeft:2,gap:1,children:[(0,X.jsx)(S,{children:`- ${F()}`}),(0,X.jsx)(S,{dimColor:!0,children:`(Original working directory)`})]}),(0,X.jsx)(m,{options:d,onChange:l,onCancel:u,visibleOptionCount:Math.min(10,d.length),onUpFromFirstItem:s,isDisabled:o})]})}var We,Y,X,Ge=e((()=>{n(),We=t(T(),1),Y=t(T(),1),pe(),h(),j(),X=P()}));function Ke({rule:e}){return(0,$.jsx)(S,{dimColor:!0,children:`From ${o(e.source)}`})}function qe(e){switch(e){case`allow`:return`allowed`;case`deny`:return`denied`;case`ask`:return`ask`}}function Je({rule:e,onDelete:t,onCancel:n}){let r=ye();se(`confirm:no`,n,{context:`Confirmation`});let i=(0,$.jsxs)(x,{flexDirection:`column`,marginX:2,children:[(0,$.jsx)(S,{bold:!0,children:L(e.ruleValue)}),(0,$.jsx)(ke,{ruleValue:e.ruleValue}),(0,$.jsx)(Ke,{rule:e})]}),a=(0,$.jsx)(x,{marginLeft:3,children:r.pending?(0,$.jsxs)(S,{dimColor:!0,children:[`Press `,r.keyName,` again to exit`]}):(0,$.jsx)(S,{dimColor:!0,children:`Esc to cancel`})});return e.source===`policySettings`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(x,{flexDirection:`column`,gap:1,borderStyle:`round`,paddingLeft:1,paddingRight:1,borderColor:`permission`,children:[(0,$.jsx)(S,{bold:!0,color:`permission`,children:`Rule details`}),i,(0,$.jsxs)(S,{italic:!0,children:[`This rule is configured by managed settings and cannot be modified.`,`
2
+ `,`Contact your system administrator for more information.`]})]}),a]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(x,{flexDirection:`column`,gap:1,borderStyle:`round`,paddingLeft:1,paddingRight:1,borderColor:`error`,children:[(0,$.jsxs)(S,{bold:!0,color:`error`,children:[`Delete `,qe(e.ruleBehavior),` tool?`]}),i,(0,$.jsx)(S,{children:`Are you sure you want to delete this permission rule?`}),(0,$.jsx)(m,{onChange:e=>e===`yes`?t():n(),onCancel:n,options:[{label:`Yes`,value:`yes`},{label:`No`,value:`no`}]})]}),a]})}function Ye(e){let{options:t,searchQuery:n,isSearchMode:r,isFocused:i,onSelect:a,onCancel:o,lastFocusedRuleKey:s,cursorOffset:c,onHeaderFocusChange:l}=e,u=A(),{headerFocused:d,focusHeader:f,blurHeader:p}=C();return(0,Q.useEffect)(()=>{r&&d&&p()},[r,d,p]),(0,Q.useEffect)(()=>{l?.(d)},[d,l]),(0,$.jsxs)(x,{flexDirection:`column`,children:[(0,$.jsx)(x,{marginBottom:1,flexDirection:`column`,children:(0,$.jsx)(D,{query:n,isFocused:r&&!d,isTerminalFocused:i,width:u,cursorOffset:c})}),(0,$.jsx)(m,{options:t,onChange:a,onCancel:o,visibleOptionCount:Math.min(10,t.length),isDisabled:r||d,defaultFocusValue:s,onUpFromFirstItem:f})]})}function Z({tab:e,getRulesOptions:t,handleToolSelect:n,...r}){return(0,$.jsxs)(x,{flexDirection:`column`,flexShrink:e===`allow`?0:void 0,children:[(0,$.jsx)(S,{children:{allow:`Claude Code won't ask before using allowed tools.`,ask:`Claude Code will always ask for confirmation before using these tools.`,deny:`Claude Code will always reject requests to use denied tools.`}[e]}),(0,$.jsx)(Ye,{options:t(e,r.searchQuery).options,onSelect:t=>n(t,e),...r})]})}function Xe({onExit:e,initialTab:t,onRetryDenials:n}){let a=Oe().length>0,o=t??(a?`recent`:`allow`),[c,l]=(0,Q.useState)([]),f=ie(e=>e.toolPermissionContext),p=te(),ee=ce(),m=(0,Q.useRef)({approved:new Set,retry:new Set,denials:[]}),h=(0,Q.useCallback)(e=>{m.current=e},[]),[g,_]=(0,Q.useState)(),[ne,re]=(0,Q.useState)(),[v,y]=(0,Q.useState)(null),[b,C]=(0,Q.useState)(null),[w,T]=(0,Q.useState)(!1),[E,D]=(0,Q.useState)(null),[O,A]=(0,Q.useState)(!1),[le,de]=(0,Q.useState)(!0),j=(0,Q.useCallback)(e=>{de(e)},[]),N=(0,Q.useMemo)(()=>{let e=new Map;return i(f).forEach(t=>{e.set(I(t),t)}),e},[f]),P=(0,Q.useMemo)(()=>{let e=new Map;return s(f).forEach(t=>{e.set(I(t),t)}),e},[f]),pe=(0,Q.useMemo)(()=>{let e=new Map;return d(f).forEach(t=>{e.set(I(t),t)}),e},[f]),F=(0,Q.useCallback)((e,t=``)=>{let n=(()=>{switch(e){case`allow`:return N;case`deny`:return P;case`ask`:return pe;case`workspace`:case`recent`:return new Map}})(),i=[];e!==`workspace`&&e!==`recent`&&!t&&i.push({label:`Add a new rule${r.ellipsis}`,value:`add-new-rule`});let a=Array.from(n.keys()).sort((e,t)=>{let r=n.get(e),i=n.get(t);if(r&&i){let e=L(r.ruleValue).toLowerCase(),t=L(i.ruleValue).toLowerCase();return e.localeCompare(t)}return 0}),o=t.toLowerCase();for(let e of a){let r=n.get(e);if(r){let n=L(r.ruleValue);if(t&&!n.toLowerCase().includes(o))continue;i.push({label:n,value:e})}}return{options:i,rulesByKey:n}},[N,P,pe]),me=ye(),R=!g&&!v&&!b&&!w&&!E,{query:he,setQuery:z,cursorOffset:B}=we({isActive:R&&O,onExit:()=>{A(!1)}}),ge=(0,Q.useCallback)(e=>{R&&(O||e.ctrl||e.meta||(e.key===`/`?(e.preventDefault(),A(!0),z(``)):e.key.length===1&&e.key!==`j`&&e.key!==`k`&&e.key!==`m`&&e.key!==`i`&&e.key!==`r`&&e.key!==` `&&(e.preventDefault(),A(!0),z(e.key))))},[R,O,z]),V=(0,Q.useCallback)((e,t)=>{let{rulesByKey:n}=F(t);if(e===`add-new-rule`){y(t);return}else{_(n.get(e));return}},[F]),_e=(0,Q.useCallback)(()=>{y(null)},[]),ve=(0,Q.useCallback)((e,t)=>{C({ruleValue:e,ruleBehavior:t}),y(null)},[]),be=(0,Q.useCallback)((e,t)=>{C(null);for(let t of e)l(e=>[...e,`Added ${t.ruleBehavior} rule ${M.bold(L(t.ruleValue))}`]);if(t&&t.length>0)for(let e of t){let t=e.shadowType===`deny`?`blocked`:`shadowed`;l(n=>[...n,M.yellow(`${r.warning} Warning: ${L(e.rule.ruleValue)} is ${t}`),M.dim(` ${e.reason}`),M.dim(` Fix: ${e.fix}`)])}},[]),xe=(0,Q.useCallback)(()=>{C(null)},[]),Ce=(0,Q.useCallback)(()=>T(!0),[]),Te=(0,Q.useCallback)(e=>D(e),[]),Ee=(0,Q.useCallback)(()=>{let t=m.current,r=e=>Array.from(e).map(e=>t.denials[e]).filter(e=>e!==void 0),i=r(t.retry);if(i.length>0){let t=i.map(e=>e.display);n?.(t),e(void 0,{shouldQuery:!0,metaMessages:[`Permission granted for: ${t.join(`, `)}. You may now retry ${t.length===1?`this command`:`these commands`} if you would like.`]});return}let a=r(t.approved);a.length>0||c.length>0?e([...a.length>0?[`Approved ${a.map(e=>M.bold(e.display)).join(`, `)}`]:[],...c].join(`
3
+ `)):e(`Permissions dialog dismissed`,{display:`system`})},[c,e,n]);se(`confirm:no`,Ee,{context:`Settings`,isActive:R&&!O});let De=()=>{if(!g)return;let{options:e}=F(g.ruleBehavior),t=I(g),n=e.filter(e=>e.value!==`add-new-rule`).map(e=>e.value),r=n.indexOf(t),i;r!==-1&&(r<n.length-1?i=n[r+1]:r>0&&(i=n[r-1])),re(i),oe({rule:g,initialContext:f,setToolPermissionContext(e){p(t=>({...t,toolPermissionContext:e}))}}),l(e=>[...e,`Deleted ${g.ruleBehavior} rule ${M.bold(L(g.ruleValue))}`]),_(void 0)};if(g)return(0,$.jsx)(Je,{rule:g,onDelete:De,onCancel:()=>_(void 0)});if(v&&v!==`workspace`&&v!==`recent`)return(0,$.jsx)(Fe,{onCancel:_e,onSubmit:ve,ruleBehavior:v});if(b)return(0,$.jsx)(Me,{onAddRules:be,onCancel:xe,ruleValues:[b.ruleValue],ruleBehavior:b.ruleBehavior,initialContext:f,setToolPermissionContext:e=>{p(t=>({...t,toolPermissionContext:e}))}});if(w)return(0,$.jsx)(Se,{onAddDirectory:(e,t)=>{let n={type:`addDirectories`,directories:[e],destination:t?`localSettings`:`session`},r=ae(f,n);p(e=>({...e,toolPermissionContext:r})),t&&u(n),l(n=>[...n,`Added directory ${M.bold(e)} to workspace${t?` and saved to local settings`:` for this session`}`]),T(!1)},onCancel:()=>T(!1),permissionContext:f});if(E)return(0,$.jsx)(Be,{directoryPath:E,onRemove:()=>{l(e=>[...e,`Removed directory ${M.bold(E)} from workspace`]),D(null)},onCancel:()=>D(null),permissionContext:f,setPermissionContext:e=>{p(t=>({...t,toolPermissionContext:e}))}});let H={searchQuery:he,isSearchMode:O,isFocused:ee,onCancel:Ee,lastFocusedRuleKey:ne,cursorOffset:B,getRulesOptions:F,handleToolSelect:V,onHeaderFocusChange:j};return(0,$.jsx)(x,{flexDirection:`column`,onKeyDown:ge,children:(0,$.jsxs)(fe,{color:`permission`,children:[(0,$.jsxs)(ue,{title:`Permissions:`,color:`permission`,defaultTab:o,hidden:!!g||!!v||!!b||w||!!E,initialHeaderFocused:!a,navFromContent:!O,children:[(0,$.jsx)(k,{id:`recent`,title:`Recently denied`,children:(0,$.jsx)(Re,{onHeaderFocusChange:j,onStateChange:h})}),(0,$.jsx)(k,{id:`allow`,title:`Allow`,children:(0,$.jsx)(Z,{tab:`allow`,...H})}),(0,$.jsx)(k,{id:`ask`,title:`Ask`,children:(0,$.jsx)(Z,{tab:`ask`,...H})}),(0,$.jsx)(k,{id:`deny`,title:`Deny`,children:(0,$.jsx)(Z,{tab:`deny`,...H})}),(0,$.jsx)(k,{id:`workspace`,title:`Workspace`,children:(0,$.jsxs)(x,{flexDirection:`column`,children:[(0,$.jsx)(S,{children:`Work Mate can read files in the workspace, and make edits when auto-accept edits is on.`}),(0,$.jsx)(Ue,{onExit:e,toolPermissionContext:f,onRequestAddDirectory:Ce,onRequestRemoveDirectory:Te,onHeaderFocusChange:j})]})})]}),(0,$.jsx)(x,{marginTop:1,paddingLeft:1,children:(0,$.jsx)(S,{dimColor:!0,children:me.pending?(0,$.jsxs)($.Fragment,{children:[`Press `,me.keyName,` again to exit`]}):le?(0,$.jsx)($.Fragment,{children:`←/→ tab switch · ↓ return · Esc cancel`}):O?(0,$.jsx)($.Fragment,{children:`Type to filter · Enter/↓ select · ↑ tabs · Esc clear`}):a&&o===`recent`?(0,$.jsx)($.Fragment,{children:`Enter approve · r retry · ↑↓ navigate · ←/→ switch · Esc cancel`}):(0,$.jsx)($.Fragment,{children:`↑↓ navigate · Enter select · Type to search · ←/→ switch · Esc cancel`})})})]})})}var Q,$,Ze=e((()=>{w(),n(),T(),Q=t(T(),1),ne(),y(),h(),be(),Te(),j(),a(),H(),V(),f(),me(),Ce(),Pe(),xe(),Ae(),Le(),ze(),He(),Ge(),$=P()})),Qe,$e;e((()=>{Ze(),c(),Qe=P(),$e=async(e,t)=>(0,Qe.jsx)(Xe,{onExit:e,onRetryDenials:e=>{t.setMessages(t=>[...t,g(e)])}})}))();export{$e as call};
@@ -0,0 +1,3 @@
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{n as t,t as n}from"./memoize-BK3gG5ob.js";import{c as r,l as i,n as a,o}from"./envUtils-BDhHQY0-.js";import{n as s,t as c}from"./axios-DaWTGg7G.js";import{aE as ee,cE as te,ff as ne}from"./loadAgentsDir-CKSb56Gp.js";import{n as re}from"./cwd-L4wygFqJ.js";import{C as l,E as ie,H as ae,O as oe,S as u,V as se,W as ce,a as d,d as f,l as p,p as m,w as le,z as h}from"./debug-BdqxZ7rV.js";import{Gt as ue,Jt as de,M as g,P as fe,Yt as pe,Zt as me,g as he,n as ge}from"./settings-Xbq6AaD-.js";import{a as _e,c as _,h as v,i as ve}from"./config-D4G8_MqJ.js";import{c as ye,n as y,o as be,r as b,t as x}from"./execFileNoThrow-5SylUnAI.js";import{o as S,s as C}from"./log-CTFl4qpD.js";import{n as xe,t as Se}from"./which-DznMOwny.js";import{i as w,o as T}from"./platform-D6IMiyqT.js";import{n as E,t as Ce}from"./bundledMode--fG1S62b.js";import{B as we,z as Te}from"./sessionState-BvECKycx.js";import{i as Ee,r as De}from"./genericProcessUtils-BmDSLcMf.js";import{a as Oe,i as ke}from"./ripgrep-DkL2S7-I.js";import{homedir as D}from"os";import{basename as Ae,delimiter as je,join as O,posix as k,win32 as A}from"path";import{constants as Me}from"fs";import{access as j,open as Ne,readFile as M,realpath as N,stat as Pe}from"fs/promises";function P(){return O(a(),`local`)}function Fe(){return O(P(),`claude`)}function Ie(){return(process.argv[1]||``).includes(`/.claude/local/node_modules/`)}async function F(){try{return await j(O(P(),`node_modules`,`.bin`,`claude`)),!0}catch{return!1}}function I(){let e=process.env.SHELL||``;return e.includes(`zsh`)?`zsh`:e.includes(`bash`)?`bash`:e.includes(`fish`)?`fish`:`unknown`}var L=e((()=>{v(),o(),h(),b(),m(),S(),u()}));function R(e){let t=e?.homedir??D();return{zsh:O((e?.env??process.env).ZDOTDIR||t,`.zshrc`),bash:O(t,`.bashrc`),fish:O(t,`.config/fish/config.fish`)}}function Le(e){let t=!1;return{filtered:e.filter(e=>{if(V.test(e)){let n=e.match(/alias\s+claude\s*=\s*["']([^"']+)["']/);if(n||(n=e.match(/alias\s+claude\s*=\s*([^#\n]+)/)),n&&n[1]&&n[1].trim()===Fe())return t=!0,!1}return!0}),hadAlias:t}}async function z(e){try{return(await M(e,{encoding:`utf8`})).split(`
2
+ `)}catch(e){if(ae(e))return null;throw e}}async function Re(e,t){let n=await Ne(e,`w`);try{await n.writeFile(t.join(`
3
+ `),{encoding:`utf8`}),await n.datasync()}finally{await n.close()}}async function B(e){let t=R(e);for(let e of Object.values(t)){let t=await z(e);if(t){for(let e of t)if(V.test(e)){let t=e.match(/alias\s+claude=["']?([^"'\s]+)/);if(t&&t[1])return t[1]}}}return null}async function ze(e){let t=await B(e);if(!t)return null;let n=e?.homedir??D(),r=t.startsWith(`~`)?t.replace(`~`,n):t;try{let e=await Pe(r);if(e.isFile()||e.isSymbolicLink())return t}catch{}return null}var V,H=e((()=>{h(),L(),V=/^\s*alias\s+claude\s*=/}));async function Be(){}function Ve(e){let t=ge()?.minimumVersion;if(!t)return!1;let n=!Te(e,t);return n&&p(`Skipping update to ${e} - below minimumVersion ${t}`),n}async function He(){let e=ue.isRunningWithBun(),t=null;return t=e?await y(`bun`,[`pm`,`bin`,`-g`],{cwd:D()}):await y(`npm`,[`-g`,`config`,`get`,`prefix`],{cwd:D()}),t.code===0?t.stdout.trim():(C(Error(`Failed to check ${e?`bun`:`npm`} permissions`)),null)}async function Ue(){try{let e=await He();if(!e)return{hasPermissions:!1,npmPrefix:null};try{return await j(e,Me.W_OK),{hasPermissions:!0,npmPrefix:e}}catch{return C(new Je(`Insufficient permissions for global npm install.`)),{hasPermissions:!1,npmPrefix:e}}}catch(e){return C(e),{hasPermissions:!1,npmPrefix:null}}}async function We(){let e=await y(`npm`,[`view`,``,`dist-tags`,`--json`,`--prefer-online`],{abortSignal:AbortSignal.timeout(5e3),cwd:D()});if(e.code!==0)return p(`npm view dist-tags failed with code ${e.code}`),{latest:null,stable:null};try{let t=l(e.stdout.trim());return{latest:typeof t.latest==`string`?t.latest:null,stable:typeof t.stable==`string`?t.stable:null}}catch(e){return p(`Failed to parse dist-tags: ${e}`),{latest:null,stable:null}}}async function Ge(e){try{return(await s.get(`${qe}/${e}`,{timeout:5e3,responseType:`text`})).data.trim()}catch(t){return p(`Failed to fetch ${e} from GCS: ${t}`),null}}async function Ke(){let[e,t]=await Promise.all([Ge(`latest`),Ge(`stable`)]);return{latest:e,stable:t}}var qe,Je,Ye=e((()=>{c(),v(),d(),de(),o(),h(),b(),m(),ne(),S(),we(),he(),H(),u(),qe=`https://storage.googleapis.com/claude-code-dist-86c565f3-f756-42ad-8dfa-d59b1c096819/claude-code-releases`,Je=class extends oe{}}));function U(e,t){return t.includes(e.id)||e.idLike.some(e=>t.includes(e))}function Xe(){let e=process.execPath||process.argv[0]||``;return/[/\\]mise[/\\]installs[/\\]/i.test(e)?(p(`Detected mise installation: ${e}`),!0):!1}function Ze(){let e=process.execPath||process.argv[0]||``;return/[/\\]\.?asdf[/\\]installs[/\\]/i.test(e)?(p(`Detected asdf installation: ${e}`),!0):!1}function W(){let e=w();if(e!==`macos`&&e!==`linux`&&e!==`wsl`)return!1;let t=process.execPath||process.argv[0]||``;return t.includes(`/Caskroom/`)?(p(`Detected Homebrew cask installation: ${t}`),!0):!1}function Qe(){if(w()!==`windows`)return!1;let e=process.execPath||process.argv[0]||``;for(let t of[/Microsoft[/\\]WinGet[/\\]Packages/i,/Microsoft[/\\]WinGet[/\\]Links/i])if(t.test(e))return p(`Detected winget installation: ${e}`),!0;return!1}var G,K,q,J,Y,$e,et=e((()=>{n(),d(),b(),T(),G=t(async()=>{try{let e=await M(`/etc/os-release`,`utf8`),t=e.match(/^ID=["']?(\S+?)["']?\s*$/m),n=e.match(/^ID_LIKE=["']?(.+?)["']?\s*$/m);return{id:t?.[1]??``,idLike:n?.[1]?.split(` `)??[]}}catch{return null}}),K=t(async()=>{if(w()!==`linux`)return!1;let e=await G();if(e&&!U(e,[`arch`]))return!1;let t=await x(`pacman`,[`-Qo`,process.execPath||process.argv[0]||``],{timeout:5e3,useCwd:!1});return t.code===0&&t.stdout?(p(`Detected pacman installation: ${t.stdout.trim()}`),!0):!1}),q=t(async()=>{if(w()!==`linux`)return!1;let e=await G();if(e&&!U(e,[`debian`]))return!1;let t=await x(`dpkg`,[`-S`,process.execPath||process.argv[0]||``],{timeout:5e3,useCwd:!1});return t.code===0&&t.stdout?(p(`Detected deb installation: ${t.stdout.trim()}`),!0):!1}),J=t(async()=>{if(w()!==`linux`)return!1;let e=await G();if(e&&!U(e,[`fedora`,`rhel`,`suse`]))return!1;let t=await x(`rpm`,[`-qf`,process.execPath||process.argv[0]||``],{timeout:5e3,useCwd:!1});return t.code===0&&t.stdout?(p(`Detected rpm installation: ${t.stdout.trim()}`),!0):!1}),Y=t(async()=>{if(w()!==`linux`)return!1;let e=await G();if(e&&!U(e,[`alpine`]))return!1;let t=await x(`apk`,[`info`,`--who-owns`,process.execPath||process.argv[0]||``],{timeout:5e3,useCwd:!1});return t.code===0&&t.stdout?(p(`Detected apk installation: ${t.stdout.trim()}`),!0):!1}),$e=t(async()=>W()?`homebrew`:Qe()?`winget`:Xe()?`mise`:Ze()?`asdf`:await K()?`pacman`:await Y()?`apk`:await q()?`deb`:await J()?`rpm`:`unknown`)}));function tt(){let e=process.argv[1]||``,t=process.execPath||process.argv[0]||``;return w()===`windows`&&(e=e.split(A.sep).join(k.sep),t=t.split(A.sep).join(k.sep)),[e,t]}async function nt(){let[e]=tt();if(E())return W()||Qe()||Xe()||Ze()||await K()||await q()||await J()||await Y()?`package-manager`:`native`;if(Ie())return`npm-local`;if([`/usr/local/lib/node_modules`,`/usr/lib/node_modules`,`/opt/homebrew/lib/node_modules`,`/opt/homebrew/bin`,`/usr/local/bin`,`/.nvm/versions/node/`].some(t=>e.includes(t))||e.includes(`/npm/`)||e.includes(`/nvm/`))return`npm-global`;let t=await be(`npm config get prefix`,{shell:!0,reject:!1}),n=t.exitCode===0?t.stdout.trim():null;return n&&e.startsWith(n)?`npm-global`:`unknown`}async function rt(){if(E()){try{return await N(process.execPath)}catch{}try{let e=await xe(`claude`);if(e)return e}catch{}try{return await f().stat(O(D(),`.local/bin/claude`)),O(D(),`.local/bin/claude`)}catch{}return`native`}try{return process.argv[0]||`unknown`}catch{return`unknown`}}function it(){try{return E()?process.execPath||`unknown`:process.argv[1]||`unknown`}catch{return`unknown`}}async function at(){let e=f(),t=[],n=O(D(),`.claude`,`local`);await F()&&t.push({type:`npm-local`,path:n});let r=[`@anthropic-ai/claude-code`],i=await x(`npm`,[`-g`,`config`,`get`,`prefix`]);if(i.code===0&&i.stdout){let n=i.stdout.trim(),a=w()===`windows`,o=a?O(n,`claude`):O(n,`bin`,`claude`),s=!1;try{await e.stat(o),s=!0}catch{}if(s){let e=!1;try{(await N(o)).includes(`/Caskroom/`)&&(e=W())}catch{}e||t.push({type:`npm-global`,path:o})}else for(let i of r){let r=a?O(n,`node_modules`,i):O(n,`lib`,`node_modules`,i);try{await e.stat(r),t.push({type:`npm-global-orphan`,path:r})}catch{}}}let a=O(D(),`.local`,`bin`,`claude`);try{await e.stat(a),t.push({type:`native`,path:a})}catch{}if(_().installMethod===`native`){let n=O(D(),`.local`,`share`,`claude`);try{await e.stat(n),t.some(e=>e.type===`native`)||t.push({type:`native`,path:n})}catch{}}return t}async function ot(e){let t=[];try{let e=l(await M(O(pe(),`managed-settings.json`),`utf-8`)),n=e&&typeof e==`object`?e.strictPluginOnlyCustomization:void 0;if(n!==void 0&&typeof n!=`boolean`)if(!Array.isArray(n))t.push({issue:`managed-settings.json: strictPluginOnlyCustomization has an invalid value (expected true or an array, got ${typeof n})`,fix:`The field is silently ignored (schema .catch rescues it). Set it to true, or an array of: ${g.join(`, `)}.`});else{let e=n.filter(e=>typeof e==`string`&&!g.includes(e));e.length>0&&t.push({issue:`managed-settings.json: strictPluginOnlyCustomization has ${e.length} value(s) this client doesn't recognize: ${e.map(String).join(`, `)}`,fix:`These are silently ignored (forwards-compat). Known surfaces for this version: ${g.join(`, `)}. Either remove them, or this client is older than the managed-settings intended.`})}}catch{}let n=_();if(e===`development`)return t;if(e===`native`){let e=(process.env.PATH||``).split(je),n=O(D(),`.local`,`bin`),r=n;if(w()===`windows`&&(r=n.split(A.sep).join(k.sep)),!e.some(e=>{let t=e;w()===`windows`&&(t=e.split(A.sep).join(k.sep));let n=t.replace(/\/+$/,``),i=e.replace(/[/\\]+$/,``);return n===r||i===`~/.local/bin`||i===`$HOME/.local/bin`}))if(w()===`windows`){let e=n.split(k.sep).join(A.sep);t.push({issue:`Native installation exists but ${e} is not in your PATH`,fix:`Add it by opening: System Properties → Environment Variables → Edit User PATH → New → Add the path above. Then restart your terminal.`})}else{let e=I(),n=R()[e],r=n?n.replace(D(),`~`):`your shell config file`;t.push({issue:`Native installation exists but ~/.local/bin is not in your PATH`,fix:`Run: echo 'export PATH="$HOME/.local/bin:$PATH"' >> ${r} then open a new terminal or run: source ${r}`})}}i(process.env.DISABLE_INSTALLATION_CHECKS)||(e===`npm-local`&&n.installMethod!==`local`&&t.push({issue:`Running from local installation but config install method is '${n.installMethod}'`,fix:`Consider using native installation: claude install`}),e===`native`&&n.installMethod!==`native`&&t.push({issue:`Running native installation but config install method is '${n.installMethod}'`,fix:`Run claude install to update configuration`})),e===`npm-global`&&await F()&&t.push({issue:`Local installation exists but not being used`,fix:`Consider using native installation: claude install`});let r=await B(),a=await ze();return e===`npm-local`&&!await xe(`claude`)&&!a&&(r?t.push({issue:`Local installation not accessible`,fix:`Alias exists but points to invalid target: ${r}. Update alias: alias claude="~/.claude/local/claude"`}):t.push({issue:`Local installation not accessible`,fix:`Create alias: alias claude="~/.claude/local/claude"`})),t}function st(){if(w()!==`linux`)return[];let e=[],t=ee.getLinuxGlobPatternWarnings();if(t.length>0){let n=t.slice(0,3).join(`, `),r=t.length-3,i=r>0?`${n} (${r} more)`:n;e.push({issue:`Glob patterns in sandbox permission rules are not fully supported on Linux`,fix:`Found ${t.length} pattern(s): ${i}. On Linux, glob patterns in Edit/Read rules will be ignored.`})}return e}async function ct(){let e=await nt(),t=typeof MACRO<`u`?`0.0.9`:`unknown`,n=await rt(),r=it(),i=await at(),a=await ot(e);if(a.push(...st()),e===`native`){let e=i.filter(e=>e.type===`npm-global`||e.type===`npm-global-orphan`||e.type===`npm-local`),t=w()===`windows`;for(let n of e)n.type===`npm-global`?a.push({issue:`Leftover npm global installation at ${n.path}`,fix:`Run: npm -g uninstall @anthropic-ai/claude-code`}):n.type===`npm-global-orphan`?a.push({issue:`Orphaned npm global package at ${n.path}`,fix:t?`Run: rmdir /s /q "${n.path}"`:`Run: rm -rf ${n.path}`}):n.type===`npm-local`&&a.push({issue:`Leftover npm local installation at ${n.path}`,fix:t?`Run: rmdir /s /q "${n.path}"`:`Run: rm -rf ${n.path}`})}let o=_().installMethod||`not set`,s=null;e===`npm-global`&&(s=(await Ue()).hasPermissions,!s&&!_e()&&a.push({issue:`Insufficient permissions for auto-updates`,fix:"Do one of: (1) Re-install node without sudo, or (2) Use `claude install` for native installation"}));let c=ke(),ee={working:c.working??!0,mode:c.mode,systemPath:c.mode===`system`?c.path:null,note:c.note??null},te=e===`package-manager`?await $e():void 0;return{installationType:e,version:t,installationPath:n,invokedBinary:r,configInstallMethod:o,autoUpdates:(()=>{let e=_e();return e?`disabled (${ve(e)})`:`enabled`})(),hasUpdatePermissions:s,multipleInstallations:i,warnings:a,packageManager:te,ripgrepStatus:ee}}var lt=e((()=>{ye(),Ye(),Ce(),v(),re(),o(),b(),m(),L(),et(),T(),Oe(),te(),me(),fe(),H(),u(),Se()}));function ut(){let e=process.env.ENABLE_PID_BASED_VERSION_LOCKING;return i(e)?!0:(r(e),!1)}function X(e){if(e<=1)return!1;try{return process.kill(e,0),!0}catch{return!1}}function dt(e,t){if(!X(e))return!1;if(e===process.pid)return!0;try{let n=De(e);if(!n)return!0;let r=n.toLowerCase(),i=t.toLowerCase();return r.includes(`claude`)||r.includes(i)}catch{return!0}}function Z(e){let t=f();try{let n=t.readFileSync(e,{encoding:`utf8`});if(!n||n.trim()===``)return null;let r=l(n);return typeof r.pid!=`number`||!r.version||!r.execPath?null:r}catch{return null}}function Q(e){let t=Z(e);if(!t)return!1;let{pid:n,execPath:r}=t;if(!X(n))return!1;if(!dt(n,r))return p(`Lock PID ${n} is running but does not appear to be Claude - treating as stale`),!1;let i=f();try{let t=i.statSync(e);if(Date.now()-t.mtimeMs>$&&!X(n))return!1}catch{}return!0}function ft(e,t){let n=f(),r=`${e}.tmp.${process.pid}.${Date.now()}`;try{ie(r,le(t,null,2),{encoding:`utf8`,flush:!0}),n.renameSync(r,e)}catch(e){try{n.unlinkSync(r)}catch{}throw e}}async function pt(e,t){let n=f(),r=Ae(e);if(Q(t))return p(`Cannot acquire lock for ${r} - held by PID ${Z(t)?.pid}`),null;let i={pid:process.pid,version:r,execPath:process.execPath,acquiredAt:Date.now()};try{return ft(t,i),Z(t)?.pid===process.pid?(p(`Acquired PID lock for ${r} (PID ${process.pid})`),()=>{try{Z(t)?.pid===process.pid&&(n.unlinkSync(t),p(`Released PID lock for ${r}`))}catch(e){p(`Failed to release lock for ${r}: ${e}`)}}):null}catch(e){return p(`Failed to acquire lock for ${r}: ${e}`),null}}async function mt(e,t){let n=await pt(e,t);if(!n)return!1;let r=()=>{try{n()}catch{}};return process.on(`exit`,r),process.on(`SIGINT`,r),process.on(`SIGTERM`,r),!0}async function ht(e,t,n){let r=await pt(e,t);if(!r)return!1;try{return await n(),!0}finally{r()}}function gt(e){let t=f(),n=[];try{let r=t.readdirStringSync(e).filter(e=>e.endsWith(`.lock`));for(let t of r){let r=O(e,t),i=Z(r);i&&n.push({version:i.version,pid:i.pid,isProcessRunning:X(i.pid),execPath:i.execPath,acquiredAt:new Date(i.acquiredAt),lockFilePath:r})}}catch(e){if(se(e))return n;C(ce(e))}return n}function _t(e){let t=f(),n=0;try{let r=t.readdirStringSync(e).filter(e=>e.endsWith(`.lock`));for(let i of r){let r=O(e,i);try{t.lstatSync(r).isDirectory()?(t.rmSync(r,{recursive:!0,force:!0}),n++,p(`Cleaned up legacy directory lock: ${i}`)):Q(r)||(t.unlinkSync(r),n++,p(`Cleaned up stale lock: ${i}`))}catch{}}}catch(e){if(se(e))return 0;C(ce(e))}return n}var $,vt=e((()=>{d(),o(),h(),m(),Ee(),S(),u(),$=7200*1e3}));export{L as C,I as S,Le as _,Q as a,z as b,ht as c,lt as d,Ke as f,Ve as g,Ye as h,vt as i,nt as l,We as m,_t as n,ut as o,Be as p,gt as r,Z as s,mt as t,ct as u,R as v,Re as x,H as y};
@@ -1 +1 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{n as t,o as n}from"./envUtils-DSxRz_kt.js";import{o as r}from"./log-CZ0zYP_c.js";import{join as i}from"path";import"fs/promises";import"net";import"events";function a(){return i(t(),`pipes`)}function o(e){return e?.pipeIpc??s}var s,c=e((()=>{n(),r(),s={role:`main`,subIndex:null,displayRole:`main`,serverName:null,attachedBy:null,localIp:null,hostname:null,machineId:null,mac:null,statusVisible:!1,selectorOpen:!1,selectedPipes:[],routeMode:`selected`,slaves:{},discoveredPipes:[]}}));export{a as n,c as r,o as t};
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{n as t,o as n}from"./envUtils-BDhHQY0-.js";import{o as r}from"./log-CTFl4qpD.js";import{join as i}from"path";import"fs/promises";import"net";import"events";function a(){return i(t(),`pipes`)}function o(e){return e?.pipeIpc??s}var s,c=e((()=>{n(),r(),s={role:`main`,subIndex:null,displayRole:`main`,serverName:null,attachedBy:null,localIp:null,hostname:null,machineId:null,mac:null,statusVisible:!1,selectorOpen:!1,selectedPipes:[],routeMode:`selected`,slaves:{},discoveredPipes:[]}}));export{a as n,c as r,o as t};
@@ -0,0 +1 @@
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{$x as t,A as n,C as r,FT as i,MT as a,jT as o,sS as s,w_ as c,x_ as l}from"./loadAgentsDir-CKSb56Gp.js";import{I as u,P as d,fi as f,t as p}from"./src-P_wYS_NJ2.js";import{t as m}from"./jsx-runtime-Bb4Xn-E0.js";import{Kt as h,Vt as g}from"./state-Bs5xweDL.js";import{a as _,i as v,r as y,t as b}from"./promptEditor-0Ug93P2I.js";import{r as x,t as S}from"./staticRender-DrU6eWoq.js";function C({planContent:e,planPath:t,editorName:n}){return(0,T.jsxs)(u,{flexDirection:`column`,children:[(0,T.jsx)(d,{bold:!0,children:`Current Plan`}),(0,T.jsx)(d,{dimColor:!0,children:t}),(0,T.jsx)(u,{marginTop:1,children:(0,T.jsx)(d,{children:e})}),n&&(0,T.jsxs)(u,{marginTop:1,children:[(0,T.jsx)(d,{dimColor:!0,children:`"/plan open"`}),(0,T.jsx)(d,{dimColor:!0,children:` to edit this plan in `}),(0,T.jsx)(d,{bold:!0,dimColor:!0,children:n})]})]})}async function w(e,t,r){let{getAppState:i,setAppState:c}=t,u=i().toolPermissionContext.mode;if(u!==`plan`){g(u,`plan`),c(e=>({...e,toolPermissionContext:l(n(e.toolPermissionContext),{type:`setMode`,mode:`plan`,destination:`session`})}));let t=r.trim();return t&&t!==`open`?e(`Enabled plan mode`,{shouldQuery:!0}):e(`Enabled plan mode`),null}let d=o(),f=a();if(!d)return e(`Already in plan mode. No plan written yet.`),null;if(r.trim().split(/\s+/)[0]===`open`){let t=await b(f);return t.error?e(`Failed to open plan in editor: ${t.error}`):e(`Opened plan in editor: ${f}`),null}let p=v();return e(await x((0,T.jsx)(C,{planContent:d,planPath:f,editorName:p?s(p):void 0}))),null}var T;e((()=>{f(),h(),p(),_(),t(),c(),r(),i(),y(),S(),T=m()}))();export{w as call};
@@ -1,2 +1,2 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{n as t,t as n}from"./memoize-BK3gG5ob.js";import{d as r,p as i}from"./debug-RZ4NuXyS.js";import{o as a,s as o}from"./log-CZ0zYP_c.js";import{release as s}from"os";import{readFile as c,readdir as l}from"fs/promises";async function u(e){let t=new Set;process.env.P4PORT&&t.add(`perforce`);try{let n=e??r().cwd(),i=new Set(await l(n));for(let[e,n]of h)i.has(e)&&t.add(n)}catch{}return[...t]}var d,f,p,m,h,g=e((()=>{n(),i(),a(),d=[`macos`,`wsl`],f=t(()=>{try{if(process.platform===`darwin`)return`macos`;if(process.platform===`win32`)return`windows`;if(process.platform===`linux`){try{let e=r().readFileSync(`/proc/version`,{encoding:`utf8`});if(e.toLowerCase().includes(`microsoft`)||e.toLowerCase().includes(`wsl`))return`wsl`}catch(e){o(e)}return`linux`}return`unknown`}catch(e){return o(e),`unknown`}}),p=t(()=>{if(process.platform===`linux`)try{let e=r().readFileSync(`/proc/version`,{encoding:`utf8`}),t=e.match(/WSL(\d+)/i);return t&&t[1]?t[1]:e.toLowerCase().includes(`microsoft`)?`1`:void 0}catch(e){o(e);return}}),m=t(async()=>{if(process.platform!==`linux`)return;let e={linuxKernel:s()};try{let t=await c(`/etc/os-release`,`utf8`);for(let n of t.split(`
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{n as t,t as n}from"./memoize-BK3gG5ob.js";import{d as r,p as i}from"./debug-BdqxZ7rV.js";import{o as a,s as o}from"./log-CTFl4qpD.js";import{release as s}from"os";import{readFile as c,readdir as l}from"fs/promises";async function u(e){let t=new Set;process.env.P4PORT&&t.add(`perforce`);try{let n=e??r().cwd(),i=new Set(await l(n));for(let[e,n]of h)i.has(e)&&t.add(n)}catch{}return[...t]}var d,f,p,m,h,g=e((()=>{n(),i(),a(),d=[`macos`,`wsl`],f=t(()=>{try{if(process.platform===`darwin`)return`macos`;if(process.platform===`win32`)return`windows`;if(process.platform===`linux`){try{let e=r().readFileSync(`/proc/version`,{encoding:`utf8`});if(e.toLowerCase().includes(`microsoft`)||e.toLowerCase().includes(`wsl`))return`wsl`}catch(e){o(e)}return`linux`}return`unknown`}catch(e){return o(e),`unknown`}}),p=t(()=>{if(process.platform===`linux`)try{let e=r().readFileSync(`/proc/version`,{encoding:`utf8`}),t=e.match(/WSL(\d+)/i);return t&&t[1]?t[1]:e.toLowerCase().includes(`microsoft`)?`1`:void 0}catch(e){o(e);return}}),m=t(async()=>{if(process.platform!==`linux`)return;let e={linuxKernel:s()};try{let t=await c(`/etc/os-release`,`utf8`);for(let n of t.split(`
2
2
  `)){let t=n.match(/^(ID|VERSION_ID)=(.*)$/);if(t&&t[1]&&t[2]){let n=t[2].replace(/^"|"$/g,``);t[1]===`ID`?e.linuxDistroId=n:e.linuxDistroVersion=n}}}catch{}return e}),h=[[`.git`,`git`],[`.hg`,`mercurial`],[`.svn`,`svn`],[`.p4config`,`perforce`],[`$tf`,`tfs`],[`.tfvc`,`tfs`],[`.jj`,`jujutsu`],[`.sl`,`sapling`]]}));export{p as a,f as i,u as n,g as o,m as r,d as t};
@@ -0,0 +1,17 @@
1
+ import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{l as n,o as r}from"./envUtils-BDhHQY0-.js";import{n as i,t as a}from"./figures-5ThXQEtq.js";import{$C as o,$o as s,Eo as c,Ew as l,GC as u,GE as d,Ho as f,Hv as p,KC as m,Mo as h,QC as g,QE as _,Ro as v,Sd as y,Ss as b,To as x,VE as ee,Vo as te,Vu as S,Vv as C,Wo as w,XC as T,Xo as ne,YC as E,ZC as D,ZE as O,_m as k,_s as re,as as ie,aw as ae,cs as A,ds as oe,eD as j,eE as se,es as ce,ew as M,fs as le,gC as ue,gs as de,hs as fe,iE as pe,iw as me,jo as N,lv as P,ms as he,nw as ge,ov as _e,ps as ve,pw as ye,qE as be,qo as xe,rE as F,rs as Se,rw as I,ss as Ce,sv as we,tD as Te,tw as Ee,vm as De,xd as Oe,xs as ke,yC as Ae,ys as je,zu as Me}from"./loadAgentsDir-CKSb56Gp.js";import{D as Ne,Gr as Pe,Gt as L,H as Fe,I as R,P as z,T as B,Wt as Ie,Xn as Le,fi as V,hn as Re,j as ze,k as Be,n as Ve,ot as He,r as Ue,t as We,x as Ge,y as Ke}from"./src-P_wYS_NJ2.js";import{t as qe}from"./jsx-runtime-Bb4Xn-E0.js";import{C as Je,F as Ye,S as Xe,W as Ze,a as Qe,l as $e,z as et}from"./debug-BdqxZ7rV.js";import{In as tt,Ln as nt,c as rt,f as it,g as at,vt as ot,x as st,xt as ct}from"./settings-Xbq6AaD-.js";import{b as lt,h as ut}from"./config-D4G8_MqJ.js";import{o as dt,s as ft}from"./log-CTFl4qpD.js";import{n as pt,r as mt}from"./analytics-DJobLaWP.js";import{C as ht,y as gt}from"./startupProfiler-jeId9f2i.js";import{l as H,o as _t}from"./stringUtils-CbS6OkmE.js";import{n as vt,t as yt}from"./pluginStartupCheck-B6leNWq9.js";import{a as bt,d as xt,f as St,i as Ct,l as wt,o as Tt,s as Et,u as Dt}from"./pluginOperations-BTq4AjYB.js";import{a as Ot,c as kt,i as At,n as jt,o as Mt,s as Nt,t as Pt}from"./validatePlugin-DSw08u76.js";import{a as Ft,n as It,o as Lt,r as Rt}from"./pluginFlagging-CxuRF2Vc.js";import{i as zt,n as Bt}from"./MCPConnectionManager-DPFe4hPh.js";import{n as Vt,t as Ht}from"./useExitOnCtrlCDWithKeybindings-D2FvHieH.js";import{t as Ut}from"./SearchBox-C9vUA4IM.js";import{n as Wt,t as Gt}from"./useSearchInput-C6d6nt9S.js";import{a as Kt,c as qt,i as Jt,n as Yt,o as Xt,r as Zt,s as Qt,t as $t}from"./MCPToolListView-BPmE0C2o.js";import{i as en,n as tn}from"./pluginAutoupdate-BHKlOOXI.js";import*as nn from"path";import*as rn from"fs/promises";function an({inputValue:e,setInputValue:t,cursorOffset:n,setCursorOffset:r,error:i,setError:a,result:o,setResult:s,setViewState:c,onAddComplete:l,cliMode:u=!1}){let d=(0,on.useRef)(!1),[f,p]=(0,on.useState)(!1),[m,h]=(0,on.useState)(``),g=async()=>{let t=e.trim();if(!t){a(`Please enter a marketplace source`);return}let n=await Ot(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{p(!0),h(``);let{name:e,resolvedSource:t}=await xe(n,e=>{h(e)});Ce(e,{source:t}),ke();let r=n.source;n.source===`github`&&(r=n.repo),mt(`tengu_marketplace_added`,{source_type:r}),l&&await l(),h(``),p(!1),u?s(`Successfully added marketplace: ${e}`):c({type:`browse-marketplace`,targetMarketplace:e})}catch(e){let t=Ze(e);ft(t),a(t.message),h(``),p(!1),s(u?`Error: ${t.message}`:null)}};return(0,on.useEffect)(()=>{e&&!d.current&&!i&&!o&&(d.current=!0,g())},[]),(0,U.jsxs)(R,{flexDirection:`column`,children:[(0,U.jsxs)(R,{flexDirection:`column`,paddingX:1,borderStyle:`round`,children:[(0,U.jsx)(R,{marginBottom:1,children:(0,U.jsx)(z,{bold:!0,children:`Add Marketplace`})}),(0,U.jsxs)(R,{flexDirection:`column`,children:[(0,U.jsx)(z,{children:`Enter marketplace source:`}),(0,U.jsx)(z,{dimColor:!0,children:`Examples:`}),(0,U.jsx)(z,{dimColor:!0,children:` · owner/repo (GitHub)`}),(0,U.jsx)(z,{dimColor:!0,children:` · git@github.com:owner/repo.git (SSH)`}),(0,U.jsx)(z,{dimColor:!0,children:` · https://example.com/marketplace.json`}),(0,U.jsx)(z,{dimColor:!0,children:` · ./path/to/marketplace`}),(0,U.jsx)(R,{marginTop:1,children:(0,U.jsx)(Oe,{value:e,onChange:t,onSubmit:g,columns:80,cursorOffset:n,onChangeCursorOffset:r,focus:!0,showCursor:!0})})]}),f&&(0,U.jsxs)(R,{marginTop:1,children:[(0,U.jsx)(Me,{}),(0,U.jsx)(z,{children:m||`Adding marketplace to configuration…`})]}),i&&(0,U.jsx)(R,{marginTop:1,children:(0,U.jsx)(z,{color:`error`,children:i})}),o&&(0,U.jsx)(R,{marginTop:1,children:(0,U.jsx)(z,{children:o})})]}),(0,U.jsx)(R,{marginLeft:3,children:(0,U.jsx)(z,{dimColor:!0,italic:!0,children:(0,U.jsxs)(B,{children:[(0,U.jsx)(Ne,{shortcut:`Enter`,action:`add`}),(0,U.jsx)(k,{action:`confirm:no`,context:`Settings`,fallback:`Esc`,description:`cancel`})]})})})]})}var on,U,sn=e((()=>{V(),on=t(V(),1),pt(),De(),We(),S(),y(),et(),dt(),b(),s(),At(),U=qe()}));function cn(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 ln({title:e,subtitle:t,configSchema:n,initialValues:r,onSave:i,onCancel:o}){let s=Object.keys(n),c=(0,un.useCallback)(e=>{if(n[e]?.sensitive===!0)return``;let t=r?.[e];return t===void 0?``:String(t)},[n,r]),[l,u]=(0,un.useState)(0),[d,f]=(0,un.useState)({}),[p,m]=(0,un.useState)(()=>s[0]?c(s[0]):``),h=s[l],g=h?n[h]:null;if(Ie(`confirm:no`,o,{context:`Settings`}),L({"confirm:nextField":(0,un.useCallback)(()=>{if(l<s.length-1&&h){f(e=>({...e,[h]:p})),u(e=>e+1);let e=s[l+1];m(e?c(e):``)}},[l,s,h,p,c]),"confirm:yes":(0,un.useCallback)(()=>{if(!h)return;let e={...d,[h]:p};if(l===s.length-1)i(cn(s,e,n,r));else{f(e),u(e=>e+1);let t=s[l+1];m(t?c(t):``)}},[h,d,p,l,s,n,i,c,r])},{context:`Confirmation`}),Re((e,t)=>{if(t.backspace||t.delete){m(e=>e.slice(0,-1));return}e&&!t.ctrl&&!t.meta&&!t.tab&&!t.return&&m(t=>t+e)}),!g||!h)return null;let _=g.sensitive===!0,v=g.required===!0,y=_?`*`.repeat(Pe(p)):p;return(0,dn.jsxs)(Ke,{title:e,subtitle:t,onCancel:o,isCancelActive:!1,children:[(0,dn.jsxs)(R,{flexDirection:`column`,children:[(0,dn.jsxs)(z,{bold:!0,children:[g.title||h,v&&(0,dn.jsx)(z,{color:`error`,children:` *`})]}),g.description&&(0,dn.jsx)(z,{dimColor:!0,children:g.description}),(0,dn.jsxs)(R,{marginTop:1,children:[(0,dn.jsxs)(z,{children:[a.pointerSmall,` `]}),(0,dn.jsx)(z,{children:y}),(0,dn.jsx)(z,{children:`█`})]})]}),(0,dn.jsxs)(R,{flexDirection:`column`,children:[(0,dn.jsxs)(z,{dimColor:!0,children:[`Field `,l+1,` of `,s.length]}),l<s.length-1&&(0,dn.jsx)(z,{dimColor:!0,children:`Tab: Next field · Enter: Save and continue`}),l===s.length-1&&(0,dn.jsx)(z,{dimColor:!0,children:`Enter: Save configuration`})]})]})}var un,dn,fn=e((()=>{i(),un=t(V(),1),We(),l(),r(),dn=qe()}));async function pn(e){let{enabled:t,disabled:n}=await c();return[...t,...n].find(t=>t.repository===e||t.source===e)}function mn({plugin:e,pluginId:t,onDone:n}){let[r]=hn.useState(()=>{let n=[],r=E(e);Object.keys(r).length>0&&n.push({key:`top-level`,title:`Configure ${e.name}`,subtitle:`Plugin options`,schema:r,load:()=>D(t),save:n=>g(t,n,e.manifest.userConfig)});let i=u(e);for(let r of i)n.push({key:`channel:${r.server}`,title:`Configure ${r.displayName}`,subtitle:`Plugin: ${e.name}`,schema:r.configSchema,load:()=>Ee(t,r.server)??void 0,save:e=>I(t,r.server,e,r.configSchema)});return n}),[i,a]=hn.useState(0),o=hn.useRef(n);if(o.current=n,hn.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`,Ye(e));return}let t=i+1;t<r.length?a(t):n(`configured`)}return(0,gn.jsx)(ln,{title:s.title,subtitle:s.subtitle,configSchema:s.schema,initialValues:s.load(),onSave:c,onCancel:()=>n(`skipped`)},s.key)}var hn,gn,_n=e((()=>{hn=t(V(),1),et(),o(),m(),x(),T(),fn(),gn=qe()}));function vn(){let e=de();return(0,yn.jsxs)(R,{marginBottom:1,children:[(0,yn.jsxs)(z,{color:`claude`,children:[a.warning,` `]}),(0,yn.jsxs)(z,{dimColor:!0,italic:!0,children:[`Make sure you trust a plugin before installing, updating, or using it. We do 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 yn,bn=e((()=>{i(),V(),We(),re(),yn=qe()}));function xn(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 Sn(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 Cn({hasSelection:e}){return(0,wn.jsx)(R,{marginTop:1,children:(0,wn.jsx)(z,{dimColor:!0,italic:!0,children:(0,wn.jsxs)(B,{children:[e&&(0,wn.jsx)(k,{action:`plugin:install`,context:`Plugin`,fallback:`i`,description:`install`,bold:!0}),(0,wn.jsx)(k,{action:`plugin:toggle`,context:`Plugin`,fallback:`Space`,description:`toggle`}),(0,wn.jsx)(k,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`details`}),(0,wn.jsx)(k,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]})})})}var wn,Tn=e((()=>{V(),De(),We(),wn=qe()}));function En({totalItems:e,maxVisible:t=On,selectedIndex:n=0}){let r=e>t,i=(0,Dn.useRef)(0),a=(0,Dn.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,Dn.useCallback)(e=>r?e.slice(o,s):e,[r,o,s]),l=(0,Dn.useCallback)(e=>o+e,[o]),u=(0,Dn.useCallback)(e=>e>=o&&e<s,[o,s]),d=(0,Dn.useCallback)(e=>{},[]),f=(0,Dn.useCallback)(()=>{},[]),p=(0,Dn.useCallback)(()=>{},[]),m=(0,Dn.useCallback)((t,n)=>{n(Math.max(0,Math.min(t,e-1)))},[e]),h=(0,Dn.useCallback)((e,t)=>!1,[]),g=Math.max(1,Math.ceil(e/t));return{currentPage:Math.floor(a/t),totalPages:g,startIndex:o,endIndex:s,needsPagination:r,pageSize:t,getVisibleItems:c,toActualIndex:l,isOnCurrentPage:u,goToPage:d,nextPage:f,prevPage:p,handleSelectionChange:m,handlePageNavigation:h,scrollPosition:{current:n+1,total:e,canScrollUp:a>0,canScrollDown:a+t<e}}}var Dn,On,kn=e((()=>{Dn=t(V(),1),On=5}));function An({error:e,setError:t,result:n,setResult:r,setViewState:i,onInstallComplete:o,targetMarketplace:s,targetPlugin:c}){let[l,u]=(0,W.useState)(`marketplace-list`),[d,m]=(0,W.useState)(null),[g,_]=(0,W.useState)(null),[v,y]=(0,W.useState)([]),[b,x]=(0,W.useState)([]),[ee,S]=(0,W.useState)(!0),[C,w]=(0,W.useState)(null),[T,E]=(0,W.useState)(0),[D,O]=(0,W.useState)(new Set),[re,ie]=(0,W.useState)(new Set),A=En({totalItems:b.length,selectedIndex:T}),[j,se]=(0,W.useState)(0),[M,le]=(0,W.useState)(!1),[ue,de]=(0,W.useState)(null),[pe,me]=(0,W.useState)(null);Ie(`confirm:no`,jn.useCallback(()=>{l===`plugin-list`?s?i({type:`manage-marketplaces`,targetMarketplace:s}):v.length===1?i({type:`menu`}):(u(`marketplace-list`),m(null),O(new Set)):l===`plugin-details`?(u(`plugin-list`),_(null)):i({type:`menu`})},[l,s,i,v.length]),{context:`Confirmation`}),(0,W.useEffect)(()=>{async function e(){try{let e=await ce(),{marketplaces:n,failures:r}=await je(e),i=[];for(let{name:e,config:t,data:r}of n)if(r){let n=tt(r.plugins,t=>f(oe(t.name,e)));i.push({name:e,totalPlugins:r.plugins.length,installedCount:n,source:fe(t.source)})}i.sort((e,t)=>e.name===`claude-plugin-directory`?-1:+(t.name===`claude-plugin-directory`)),y(i);let a=he(r,tt(n,e=>e.data!==null));if(a)if(a.type===`warning`)me(a.message+`. Showing available marketplaces.`);else throw Error(a.message);if(i.length===1&&!s&&!c){let e=i[0];e&&(m(e.name),u(`plugin-list`))}if(c){let n=null,r=null;for(let[t]of Object.entries(e)){let e=await ne(t);if(e){let i=e.plugins.find(e=>e.name===c);if(i){let e=oe(i.name,t);n={entry:i,marketplaceName:t,pluginId:e,isInstalled:te(e)},r=t;break}}}if(n&&r){let e=n.pluginId;te(e)?t(`Plugin '${e}' is already installed globally. Use '/plugin' to manage existing plugins.`):(m(r),_(n),u(`plugin-details`))}else t(`Plugin "${c}" not found in any marketplace`)}else s&&(i.some(e=>e.name===s)?(m(s),u(`plugin-list`)):t(`Marketplace "${s}" not found`))}catch(e){t(e instanceof Error?e.message:`Failed to load marketplaces`)}finally{S(!1)}}e()},[t,s,c]),(0,W.useEffect)(()=>{if(!d)return;let e=!1;async function n(n){S(!0);try{let t=await ne(n);if(e)return;if(!t)throw Error(`Failed to load marketplace: ${n}`);let r=[];for(let e of t.plugins){let t=oe(e.name,n);p(t)||r.push({entry:e,marketplaceName:n,pluginId:t,isInstalled:te(t)})}try{let t=await Nt();if(e)return;w(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;$e(`Failed to fetch install counts: ${Ye(t)}`),r.sort((e,t)=>e.entry.name.localeCompare(t.entry.name))}x(r),E(0),O(new Set)}catch(n){if(e)return;t(n instanceof Error?n.message:`Failed to load plugins`)}finally{S(!1)}}return n(d),()=>{e=!0}},[d,t]);let N=async()=>{if(D.size===0)return;let e=b.filter(e=>D.has(e.pluginId));ie(new Set(e.map(e=>e.pluginId)));let n=0,a=0,s=[];for(let t of e){let e=await h({pluginId:t.pluginId,entry:t.entry,marketplaceName:t.marketplaceName,scope:`user`});e.success?n++:(a++,s.push({name:t.entry.name,reason:e.error}))}ie(new Set),O(new Set),ke(),a===0?r(`✓ Installed ${n} ${H(n,`plugin`)}. Run /reload-plugins to activate.`):n===0?t(`Failed to install: ${ve(s,!0)}`):r(`✓ Installed ${n} of ${n+a} plugins. Failed: ${ve(s,!1)}. Run /reload-plugins to activate successfully installed plugins.`),n>0&&o&&await o(),i({type:`menu`})},P=async(e,t=`user`)=>{le(!0),de(null);let n=await h({pluginId:e.pluginId,entry:e.entry,marketplaceName:e.marketplaceName,scope:t});if(n.success){let t=await pn(e.pluginId);if(t){le(!1),u({type:`plugin-options`,plugin:t,pluginId:e.pluginId});return}r(n.message),o&&await o(),i({type:`menu`})}else le(!1),de(n.error)};(0,W.useEffect)(()=>{e&&r(e)},[e,r]),L({"select:previous":()=>{T>0&&E(T-1)},"select:next":()=>{T<v.length-1&&E(T+1)},"select:accept":()=>{let e=v[T];e&&(m(e.name),u(`plugin-list`))}},{context:`Select`,isActive:l===`marketplace-list`}),L({"select:previous":()=>{T>0&&A.handleSelectionChange(T-1,E)},"select:next":()=>{T<b.length-1&&A.handleSelectionChange(T+1,E)},"select:accept":()=>{if(T===b.length&&D.size>0)N();else if(T<b.length){let e=b[T];e&&(e.isInstalled?i({type:`manage-plugins`,targetPlugin:e.entry.name,targetMarketplace:e.marketplaceName}):(_(e),u(`plugin-details`),se(0),de(null)))}}},{context:`Select`,isActive:l===`plugin-list`}),L({"plugin:toggle":()=>{if(T<b.length){let e=b[T];if(e&&!e.isInstalled){let t=new Set(D);t.has(e.pluginId)?t.delete(e.pluginId):t.add(e.pluginId),O(t)}}},"plugin:install":()=>{D.size>0&&N()}},{context:`Plugin`,isActive:l===`plugin-list`});let ge=jn.useMemo(()=>{if(!g)return[];let e=g.entry.homepage;return Sn(e,xn(g))},[g]);if(L({"select:previous":()=>{j>0&&se(j-1)},"select:next":()=>{j<ge.length-1&&se(j+1)},"select:accept":()=>{if(!g)return;let e=ge[j]?.action,t=g.entry.homepage,n=xn(g);e===`install-user`?P(g,`user`):e===`install-project`?P(g,`project`):e===`install-local`?P(g,`local`):e===`homepage`&&t?ae(t):e===`github`&&n?ae(`https://github.com/${n}`):e===`back`&&(u(`plugin-list`),_(null))}},{context:`Select`,isActive:l===`plugin-details`&&!!g}),typeof l==`object`&&l.type===`plugin-options`){let{plugin:e,pluginId:t}=l;function n(e){r(e),o&&o(),i({type:`menu`})}return(0,G.jsx)(mn,{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(ee)return(0,G.jsx)(z,{children:`Loading…`});if(e)return(0,G.jsx)(z,{color:`error`,children:e});if(l===`marketplace-list`)return v.length===0?(0,G.jsxs)(R,{flexDirection:`column`,children:[(0,G.jsx)(R,{marginBottom:1,children:(0,G.jsx)(z,{bold:!0,children:`Select marketplace`})}),(0,G.jsx)(z,{children:`No marketplaces configured.`}),(0,G.jsxs)(z,{dimColor:!0,children:[`Add a marketplace first using `,`'Add marketplace'`,`.`]}),(0,G.jsx)(R,{marginTop:1,paddingLeft:1,children:(0,G.jsx)(z,{dimColor:!0,children:(0,G.jsx)(k,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`})})})]}):(0,G.jsxs)(R,{flexDirection:`column`,children:[(0,G.jsx)(R,{marginBottom:1,children:(0,G.jsx)(z,{bold:!0,children:`Select marketplace`})}),pe&&(0,G.jsx)(R,{marginBottom:1,flexDirection:`column`,children:(0,G.jsxs)(z,{color:`warning`,children:[a.warning,` `,pe]})}),v.map((e,t)=>(0,G.jsxs)(R,{flexDirection:`column`,marginBottom:+(t<v.length-1),children:[(0,G.jsx)(R,{children:(0,G.jsxs)(z,{color:T===t?`suggestion`:void 0,children:[T===t?a.pointer:` `,` `,e.name]})}),(0,G.jsx)(R,{marginLeft:2,children:(0,G.jsxs)(z,{dimColor:!0,children:[e.totalPlugins,` `,H(e.totalPlugins,`plugin`),` available`,e.installedCount>0&&` · ${e.installedCount} already installed`,e.source&&` · ${e.source}`]})})]},e.name)),(0,G.jsx)(R,{marginTop:1,children:(0,G.jsx)(z,{dimColor:!0,italic:!0,children:(0,G.jsxs)(B,{children:[(0,G.jsx)(k,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`select`}),(0,G.jsx)(k,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`})]})})})]});if(l===`plugin-details`&&g){let e=g.entry.homepage,t=Sn(e,xn(g));return(0,G.jsxs)(R,{flexDirection:`column`,children:[(0,G.jsx)(R,{marginBottom:1,children:(0,G.jsx)(z,{bold:!0,children:`Plugin Details`})}),(0,G.jsxs)(R,{flexDirection:`column`,marginBottom:1,children:[(0,G.jsx)(z,{bold:!0,children:g.entry.name}),g.entry.version&&(0,G.jsxs)(z,{dimColor:!0,children:[`Version: `,g.entry.version]}),g.entry.description&&(0,G.jsx)(R,{marginTop:1,children:(0,G.jsx)(z,{children:g.entry.description})}),g.entry.author&&(0,G.jsx)(R,{marginTop:1,children:(0,G.jsxs)(z,{dimColor:!0,children:[`By:`,` `,typeof g.entry.author==`string`?g.entry.author:g.entry.author.name]})})]}),(0,G.jsxs)(R,{flexDirection:`column`,marginBottom:1,children:[(0,G.jsx)(z,{bold:!0,children:`Will install:`}),g.entry.commands&&(0,G.jsxs)(z,{dimColor:!0,children:[`· Commands:`,` `,Array.isArray(g.entry.commands)?g.entry.commands.join(`, `):Object.keys(g.entry.commands).join(`, `)]}),g.entry.agents&&(0,G.jsxs)(z,{dimColor:!0,children:[`· Agents:`,` `,Array.isArray(g.entry.agents)?g.entry.agents.join(`, `):Object.keys(g.entry.agents).join(`, `)]}),g.entry.hooks&&(0,G.jsxs)(z,{dimColor:!0,children:[`· Hooks: `,Object.keys(g.entry.hooks).join(`, `)]}),g.entry.mcpServers&&(0,G.jsxs)(z,{dimColor:!0,children:[`· MCP Servers:`,` `,Array.isArray(g.entry.mcpServers)?g.entry.mcpServers.join(`, `):typeof g.entry.mcpServers==`object`?Object.keys(g.entry.mcpServers).join(`, `):`configured`]}),!g.entry.commands&&!g.entry.agents&&!g.entry.hooks&&!g.entry.mcpServers&&(0,G.jsx)(G.Fragment,{children:typeof g.entry.source==`object`&&`source`in g.entry.source&&(g.entry.source.source===`github`||g.entry.source.source===`url`||g.entry.source.source===`npm`||g.entry.source.source===`pip`)?(0,G.jsx)(z,{dimColor:!0,children:`· Component summary not available for remote plugin`}):(0,G.jsx)(z,{dimColor:!0,children:`· Components will be discovered at installation`})})]}),(0,G.jsx)(vn,{}),ue&&(0,G.jsx)(R,{marginBottom:1,children:(0,G.jsxs)(z,{color:`error`,children:[`Error: `,ue]})}),(0,G.jsx)(R,{flexDirection:`column`,children:t.map((e,t)=>(0,G.jsxs)(R,{children:[j===t&&(0,G.jsx)(z,{children:`> `}),j!==t&&(0,G.jsx)(z,{children:` `}),(0,G.jsx)(z,{bold:j===t,children:M&&e.action===`install`?`Installing…`:e.label})]},e.action))}),(0,G.jsx)(R,{marginTop:1,paddingLeft:1,children:(0,G.jsx)(z,{dimColor:!0,children:(0,G.jsxs)(B,{children:[(0,G.jsx)(k,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`select`}),(0,G.jsx)(k,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]})})})]})}if(b.length===0)return(0,G.jsxs)(R,{flexDirection:`column`,children:[(0,G.jsx)(R,{marginBottom:1,children:(0,G.jsx)(z,{bold:!0,children:`Install plugins`})}),(0,G.jsx)(z,{dimColor:!0,children:`No new plugins available to install.`}),(0,G.jsx)(z,{dimColor:!0,children:`All plugins from this marketplace are already installed.`}),(0,G.jsx)(R,{marginLeft:3,children:(0,G.jsx)(z,{dimColor:!0,italic:!0,children:(0,G.jsx)(k,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`})})})]});let _e=A.getVisibleItems(b);return(0,G.jsxs)(R,{flexDirection:`column`,children:[(0,G.jsx)(R,{marginBottom:1,children:(0,G.jsx)(z,{bold:!0,children:`Install Plugins`})}),A.scrollPosition.canScrollUp&&(0,G.jsx)(R,{children:(0,G.jsxs)(z,{dimColor:!0,children:[` `,a.arrowUp,` more above`]})}),_e.map((t,n)=>{let r=A.toActualIndex(n),i=T===r,o=D.has(t.pluginId),s=re.has(t.pluginId);return(0,G.jsxs)(R,{flexDirection:`column`,marginBottom:n===_e.length-1&&!e?0:1,children:[(0,G.jsxs)(R,{children:[(0,G.jsxs)(z,{color:i?`suggestion`:void 0,children:[i?a.pointer:` `,` `]}),(0,G.jsxs)(z,{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)(z,{dimColor:!0,children:[` [`,t.entry.category,`]`]}),t.entry.tags?.includes(`community-managed`)&&(0,G.jsx)(z,{dimColor:!0,children:` [Community Managed]`}),t.isInstalled&&(0,G.jsx)(z,{dimColor:!0,children:` (installed)`}),C&&d===`claude-plugins-official`&&(0,G.jsxs)(z,{dimColor:!0,children:[` · `,Mt(C.get(t.pluginId)??0),` installs`]})]})]}),t.entry.description&&(0,G.jsxs)(R,{marginLeft:4,children:[(0,G.jsx)(z,{dimColor:!0,children:ht(t.entry.description,60)}),t.entry.version&&(0,G.jsxs)(z,{dimColor:!0,children:[` · v`,t.entry.version]})]})]},t.pluginId)}),A.scrollPosition.canScrollDown&&(0,G.jsx)(R,{children:(0,G.jsxs)(z,{dimColor:!0,children:[` `,a.arrowDown,` more below`]})}),e&&(0,G.jsx)(R,{marginTop:1,children:(0,G.jsxs)(z,{color:`error`,children:[a.cross,` `,e]})}),(0,G.jsx)(Cn,{hasSelection:D.size>0})]})}var jn,W,G,Mn=e((()=>{i(),jn=t(V(),1),W=t(V(),1),De(),We(),l(),nt(),me(),Qe(),et(),b(),kt(),v(),re(),s(),ee(),N(),C(),_t(),gt(),_n(),bn(),Tn(),kn(),G=qe()}));function Nn({error:e,setError:t,result:n,setResult:r,setViewState:i,onInstallComplete:o,onSearchModeChange:s,targetPlugin:c}){let[l,u]=(0,K.useState)(`plugin-list`),[d,f]=(0,K.useState)(null),[m,g]=(0,K.useState)([]),[_,v]=(0,K.useState)(!0),[y,b]=(0,K.useState)(null),[x,ee]=(0,K.useState)(!1),S=(0,K.useCallback)(e=>{ee(e),s?.(e)},[s]),{query:C,setQuery:w,cursorOffset:T}=Wt({isActive:l===`plugin-list`&&x&&!_,onExit:()=>{S(!1)}}),ne=Le(),{columns:E}=He(),D=(0,K.useMemo)(()=>{if(!C)return m;let e=C.toLowerCase();return m.filter(t=>t.entry.name.toLowerCase().includes(e)||t.entry.description?.toLowerCase().includes(e)||t.marketplaceName.toLowerCase().includes(e))},[m,C]),[O,re]=(0,K.useState)(0),[ie,A]=(0,K.useState)(new Set),[j,se]=(0,K.useState)(new Set),M=En({totalItems:D.length,selectedIndex:O});(0,K.useEffect)(()=>{re(0)},[C]);let[ue,de]=(0,K.useState)(0),[fe,pe]=(0,K.useState)(!1),[me,N]=(0,K.useState)(null),[P,ge]=(0,K.useState)(null),[_e,ye]=(0,K.useState)(null);(0,K.useEffect)(()=>{async function e(){try{let e=await ce(),{marketplaces:n,failures:r}=await je(e),i=[];for(let{name:e,data:t}of n)if(t)for(let n of t.plugins){let t=oe(n.name,e);i.push({entry:n,marketplaceName:e,pluginId:t,isInstalled:te(t)})}let a=i.filter(e=>!e.isInstalled&&!p(e.pluginId));try{let e=await Nt();b(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){$e(`Failed to fetch install counts: ${Ye(e)}`),a.sort((e,t)=>e.entry.name.localeCompare(t.entry.name))}g(a);let o=Object.keys(e).length;if(a.length===0){let e=await le({configuredMarketplaceCount:o,failedMarketplaceCount:r.length});ye(e)}let s=he(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(c){let e=i.find(e=>e.entry.name===c);e?e.isInstalled?t(`Plugin '${e.pluginId}' is already installed. Use '/plugin' to manage existing plugins.`):(f(e),u(`plugin-details`)):t(`Plugin "${c}" not found in any marketplace`)}}catch(e){t(e instanceof Error?e.message:`Failed to load plugins`)}finally{v(!1)}}e()},[t,c]);let be=async()=>{if(ie.size===0)return;let e=m.filter(e=>ie.has(e.pluginId));se(new Set(e.map(e=>e.pluginId)));let n=0,a=0,s=[];for(let t of e){let e=await h({pluginId:t.pluginId,entry:t.entry,marketplaceName:t.marketplaceName,scope:`user`});e.success?n++:(a++,s.push({name:t.entry.name,reason:e.error}))}se(new Set),A(new Set),ke(),a===0?r(`✓ Installed ${n} ${H(n,`plugin`)}. Run /reload-plugins to activate.`):n===0?t(`Failed to install: ${ve(s,!0)}`):r(`✓ Installed ${n} of ${n+a} plugins. Failed: ${ve(s,!1)}. Run /reload-plugins to activate successfully installed plugins.`),n>0&&o&&await o(),i({type:`menu`})},xe=async(e,t=`user`)=>{pe(!0),N(null);let n=await h({pluginId:e.pluginId,entry:e.entry,marketplaceName:e.marketplaceName,scope:t});if(n.success){let t=await pn(e.pluginId);if(t){pe(!1),u({type:`plugin-options`,plugin:t,pluginId:e.pluginId});return}r(n.message),o&&await o(),i({type:`menu`})}else pe(!1),N(n.error)};(0,K.useEffect)(()=>{e&&r(e)},[e,r]),Ie(`confirm:no`,()=>{u(`plugin-list`),f(null)},{context:`Confirmation`,isActive:l===`plugin-details`}),Ie(`confirm:no`,()=>{i({type:`menu`})},{context:`Confirmation`,isActive:l===`plugin-list`&&!x}),Re((e,t)=>{let n=!t.ctrl&&!t.meta;x||(e===`/`&&n?(S(!0),w(``)):n&&e.length>0&&!/^\s+$/.test(e)&&e!==`j`&&e!==`k`&&e!==`i`&&(S(!0),w(e)))},{isActive:l===`plugin-list`&&!_}),L({"select:previous":()=>{O===0?S(!0):M.handleSelectionChange(O-1,re)},"select:next":()=>{O<D.length-1&&M.handleSelectionChange(O+1,re)},"select:accept":()=>{if(O===D.length&&ie.size>0)be();else if(O<D.length){let e=D[O];e&&(e.isInstalled?i({type:`manage-plugins`,targetPlugin:e.entry.name,targetMarketplace:e.marketplaceName}):(f(e),u(`plugin-details`),de(0),N(null)))}}},{context:`Select`,isActive:l===`plugin-list`&&!x}),L({"plugin:toggle":()=>{if(O<D.length){let e=D[O];if(e&&!e.isInstalled){let t=new Set(ie);t.has(e.pluginId)?t.delete(e.pluginId):t.add(e.pluginId),A(t)}}},"plugin:install":()=>{ie.size>0&&be()}},{context:`Plugin`,isActive:l===`plugin-list`&&!x});let F=In.useMemo(()=>{if(!d)return[];let e=d.entry.homepage;return Sn(e,xn(d))},[d]);if(L({"select:previous":()=>{ue>0&&de(ue-1)},"select:next":()=>{ue<F.length-1&&de(ue+1)},"select:accept":()=>{if(!d)return;let e=F[ue]?.action,t=d.entry.homepage,n=xn(d);e===`install-user`?xe(d,`user`):e===`install-project`?xe(d,`project`):e===`install-local`?xe(d,`local`):e===`homepage`&&t?ae(t):e===`github`&&n?ae(`https://github.com/${n}`):e===`back`&&(u(`plugin-list`),f(null))}},{context:`Select`,isActive:l===`plugin-details`&&!!d}),typeof l==`object`&&l.type===`plugin-options`){let{plugin:e,pluginId:t}=l;function n(e){r(e),o&&o(),i({type:`menu`})}return(0,q.jsx)(mn,{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(_)return(0,q.jsx)(z,{children:`Loading…`});if(e)return(0,q.jsx)(z,{color:`error`,children:e});if(l===`plugin-details`&&d){let e=d.entry.homepage,t=Sn(e,xn(d));return(0,q.jsxs)(R,{flexDirection:`column`,children:[(0,q.jsx)(R,{marginBottom:1,children:(0,q.jsx)(z,{bold:!0,children:`Plugin details`})}),(0,q.jsxs)(R,{flexDirection:`column`,marginBottom:1,children:[(0,q.jsx)(z,{bold:!0,children:d.entry.name}),(0,q.jsxs)(z,{dimColor:!0,children:[`from `,d.marketplaceName]}),d.entry.version&&(0,q.jsxs)(z,{dimColor:!0,children:[`Version: `,d.entry.version]}),d.entry.description&&(0,q.jsx)(R,{marginTop:1,children:(0,q.jsx)(z,{children:d.entry.description})}),d.entry.author&&(0,q.jsx)(R,{marginTop:1,children:(0,q.jsxs)(z,{dimColor:!0,children:[`By:`,` `,typeof d.entry.author==`string`?d.entry.author:d.entry.author.name]})})]}),(0,q.jsx)(vn,{}),me&&(0,q.jsx)(R,{marginBottom:1,children:(0,q.jsxs)(z,{color:`error`,children:[`Error: `,me]})}),(0,q.jsx)(R,{flexDirection:`column`,children:t.map((e,t)=>(0,q.jsxs)(R,{children:[ue===t&&(0,q.jsx)(z,{children:`> `}),ue!==t&&(0,q.jsx)(z,{children:` `}),(0,q.jsx)(z,{bold:ue===t,children:fe&&e.action.startsWith(`install-`)?`Installing…`:e.label})]},e.action))}),(0,q.jsx)(R,{marginTop:1,children:(0,q.jsx)(z,{dimColor:!0,children:(0,q.jsxs)(B,{children:[(0,q.jsx)(k,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`select`}),(0,q.jsx)(k,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]})})})]})}if(m.length===0)return(0,q.jsxs)(R,{flexDirection:`column`,children:[(0,q.jsx)(R,{marginBottom:1,children:(0,q.jsx)(z,{bold:!0,children:`Discover plugins`})}),(0,q.jsx)(Fn,{reason:_e}),(0,q.jsx)(R,{marginTop:1,children:(0,q.jsx)(z,{dimColor:!0,italic:!0,children:`Esc to go back`})})]});let Se=M.getVisibleItems(D);return(0,q.jsxs)(R,{flexDirection:`column`,children:[(0,q.jsxs)(R,{children:[(0,q.jsx)(z,{bold:!0,children:`Discover plugins`}),M.needsPagination&&(0,q.jsxs)(z,{dimColor:!0,children:[` `,`(`,M.scrollPosition.current,`/`,M.scrollPosition.total,`)`]})]}),(0,q.jsx)(R,{marginBottom:1,children:(0,q.jsx)(Be,{query:C,isFocused:x,isTerminalFocused:ne,width:E-4,cursorOffset:T})}),P&&(0,q.jsx)(R,{marginBottom:1,children:(0,q.jsxs)(z,{color:`warning`,children:[a.warning,` `,P]})}),D.length===0&&C&&(0,q.jsx)(R,{marginBottom:1,children:(0,q.jsxs)(z,{dimColor:!0,children:[`No plugins match "`,C,`"`]})}),M.scrollPosition.canScrollUp&&(0,q.jsx)(R,{children:(0,q.jsxs)(z,{dimColor:!0,children:[` `,a.arrowUp,` more above`]})}),Se.map((t,n)=>{let r=M.toActualIndex(n),i=O===r,o=ie.has(t.pluginId),s=j.has(t.pluginId);return(0,q.jsxs)(R,{flexDirection:`column`,marginBottom:n===Se.length-1&&!e?0:1,children:[(0,q.jsxs)(R,{children:[(0,q.jsxs)(z,{color:i&&!x?`suggestion`:void 0,children:[i&&!x?a.pointer:` `,` `]}),(0,q.jsxs)(z,{children:[s?a.ellipsis:o?a.radioOn:a.radioOff,` `,t.entry.name,(0,q.jsxs)(z,{dimColor:!0,children:[` · `,t.marketplaceName]}),t.entry.tags?.includes(`community-managed`)&&(0,q.jsx)(z,{dimColor:!0,children:` [Community Managed]`}),y&&t.marketplaceName===`claude-plugins-official`&&(0,q.jsxs)(z,{dimColor:!0,children:[` · `,Mt(y.get(t.pluginId)??0),` installs`]})]})]}),t.entry.description&&(0,q.jsx)(R,{marginLeft:4,children:(0,q.jsx)(z,{dimColor:!0,children:ht(t.entry.description,60)})})]},`${M.startIndex}-${t.pluginId}`)}),M.scrollPosition.canScrollDown&&(0,q.jsx)(R,{children:(0,q.jsxs)(z,{dimColor:!0,children:[` `,a.arrowDown,` more below`]})}),e&&(0,q.jsx)(R,{marginTop:1,children:(0,q.jsxs)(z,{color:`error`,children:[a.cross,` `,e]})}),(0,q.jsx)(Pn,{hasSelection:ie.size>0,canToggle:O<D.length&&!D[O]?.isInstalled})]})}function Pn({hasSelection:e,canToggle:t}){return(0,q.jsx)(R,{marginTop:1,children:(0,q.jsx)(z,{dimColor:!0,italic:!0,children:(0,q.jsxs)(B,{children:[e&&(0,q.jsx)(k,{action:`plugin:install`,context:`Plugin`,fallback:`i`,description:`install`,bold:!0}),(0,q.jsx)(z,{children:`type to search`}),t&&(0,q.jsx)(k,{action:`plugin:toggle`,context:`Plugin`,fallback:`Space`,description:`toggle`}),(0,q.jsx)(k,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`details`}),(0,q.jsx)(k,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]})})})}function Fn({reason:e}){switch(e){case`git-not-installed`:return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(z,{dimColor:!0,children:`Git is required to install marketplaces.`}),(0,q.jsx)(z,{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)(z,{dimColor:!0,children:`Your organization policy does not allow any external marketplaces.`}),(0,q.jsx)(z,{dimColor:!0,children:`Contact your administrator.`})]});case`policy-restricts-sources`:return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(z,{dimColor:!0,children:`Your organization restricts which marketplaces can be added.`}),(0,q.jsx)(z,{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)(z,{dimColor:!0,children:`Failed to load marketplace data.`}),(0,q.jsx)(z,{dimColor:!0,children:`Check your network connection.`})]});case`all-plugins-installed`:return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(z,{dimColor:!0,children:`All available plugins are already installed.`}),(0,q.jsx)(z,{dimColor:!0,children:`Check for new plugins later or add more marketplaces.`})]});default:return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(z,{dimColor:!0,children:`No plugins available.`}),(0,q.jsx)(z,{dimColor:!0,children:`Add a marketplace first using the Marketplaces tab.`})]})}}var In,K,q,Ln=e((()=>{i(),In=t(V(),1),K=t(V(),1),De(),Ut(),We(),Gt(),ye(),l(),nt(),me(),Qe(),et(),b(),kt(),v(),re(),s(),ee(),N(),C(),_t(),gt(),_n(),bn(),Tn(),kn(),q=qe()}));function Rn({setViewState:e,error:t,setError:n,setResult:r,exitState:i,onManageComplete:o,targetMarketplace:s,action:l}){let[u,d]=(0,Bn.useState)([]),[f,p]=(0,Bn.useState)(!0),[m,h]=(0,Bn.useState)(0),[g,_]=(0,Bn.useState)(!1),[v,y]=(0,Bn.useState)(null),[b,x]=(0,Bn.useState)(null),[ee,te]=(0,Bn.useState)(null),[S,C]=(0,Bn.useState)(`list`),[w,T]=(0,Bn.useState)(null),[ne,E]=(0,Bn.useState)(0),D=(0,Bn.useRef)(!1);(0,Bn.useEffect)(()=>{async function e(){try{let e=await ce(),{enabled:r,disabled:i}=await c(),a=[...r,...i],{marketplaces:o,failures:u}=await je(e),f=[];for(let{name:e,config:t,data:n}of o){let r=a.filter(t=>t.source.endsWith(`@${e}`));f.push({name:e,source:fe(t.source),lastUpdated:t.lastUpdated,pluginCount:n?.plugins.length,installedPlugins:r,pendingUpdate:!1,pendingRemove:!1,autoUpdate:ct(e,t)})}f.sort((e,t)=>e.name===`claude-plugin-directory`?-1:t.name===`claude-plugin-directory`?1:e.name.localeCompare(t.name)),d(f);let p=he(u,tt(o,e=>e.data!==null));if(p)if(p.type===`warning`)y(p.message);else throw Error(p.message);if(s&&!D.current&&!t){D.current=!0;let e=f.findIndex(e=>e.name===s);if(e>=0){let t=f[e];if(l){h(e+1);let t=[...f];l===`update`?t[e].pendingUpdate=!0:l===`remove`&&(t[e].pendingRemove=!0),d(t),setTimeout(ae,100,t)}else t&&(h(e+1),T(t),C(`details`))}else n&&n(`Marketplace not found: ${s}`)}}catch(e){n&&n(e instanceof Error?e.message:`Failed to load marketplaces`),y(e instanceof Error?e.message:`Failed to load marketplaces`)}finally{p(!1)}}e()},[s,l,t]);let O=()=>u.some(e=>e.pendingUpdate||e.pendingRemove),re=()=>({updateCount:tt(u,e=>e.pendingUpdate),removeCount:tt(u,e=>e.pendingRemove)}),ae=async t=>{let i=t||u,s=S===`details`;_(!0),y(null),x(null),te(null);try{let t=rt(`userSettings`),n=0,l=0,u=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=oe(t.name,e.name);n[r]=!1}st(`userSettings`,{enabledPlugins:n})}await ie(e.name),l++,mt(`tengu_marketplace_removed`,{marketplace_name:e.name,plugins_uninstalled:e.installedPlugins?.length||0});continue}e.pendingUpdate&&(await Se(e.name,e=>{te(e)}),n++,u.add(e.name.toLowerCase()),mt(`tengu_marketplace_updated`,{marketplace_name:e.name}))}let f=0;u.size>0&&(f=(await en(u)).length),ke(),o&&await o();let p=await ce(),{enabled:m,disabled:h}=await c(),g=[...m,...h],{marketplaces:_}=await je(p),v=[];for(let{name:e,config:t,data:n}of _){let r=g.filter(t=>t.source.endsWith(`@${e}`));v.push({name:e,source:fe(t.source),lastUpdated:t.lastUpdated,pluginCount:n?.plugins.length,installedPlugins:r,pendingUpdate:!1,pendingRemove:!1,autoUpdate:ct(e,t)})}if(v.sort((e,t)=>e.name===`claude-plugin-directory`?-1:t.name===`claude-plugin-directory`?1:e.name.localeCompare(t.name)),d(v),s&&w){let e=v.find(e=>e.name===w.name);e&&T(e)}let y=[];if(n>0){let e=f>0?` (${f} ${H(f,`plugin`)} bumped)`:``;y.push(`Updated ${n} ${H(n,`marketplace`)}${e}`)}if(l>0&&y.push(`Removed ${l} ${H(l,`marketplace`)}`),y.length>0){let t=`${a.tick} ${y.join(`, `)}`;s?x(t):(r(t),setTimeout(e,2e3,{type:`menu`}))}else s||e({type:`menu`})}catch(e){let t=Ye(e);y(t),n&&n(t)}finally{_(!1),te(null)}},j=async()=>{if(!w)return;let e=u.map(e=>e.name===w.name?{...e,pendingRemove:!0}:e);d(e),await ae(e)},se=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 lt()||t.push({label:e.autoUpdate?`Disable auto-update`:`Enable auto-update`,value:`toggle-auto-update`}),t.push({label:`Remove marketplace`,value:`remove`}),t},M=async e=>{let t=!e.autoUpdate;try{await A(e.name,t),d(n=>n.map(n=>n.name===e.name?{...n,autoUpdate:t}:n)),T(e=>e&&{...e,autoUpdate:t})}catch(e){y(e instanceof Error?e.message:`Failed to update setting`)}};if(Ie(`confirm:no`,()=>{C(`list`),E(0)},{context:`Confirmation`,isActive:!g&&(S===`details`||S===`confirm-remove`)}),Ie(`confirm:no`,()=>{d(e=>e.map(e=>({...e,pendingUpdate:!1,pendingRemove:!1}))),h(0)},{context:`Confirmation`,isActive:!g&&S===`list`&&O()}),Ie(`confirm:no`,()=>{e({type:`menu`})},{context:`Confirmation`,isActive:!g&&S===`list`&&!O()}),L({"select:previous":()=>h(e=>Math.max(0,e-1)),"select:next":()=>{let e=u.length+1;h(t=>Math.min(e-1,t+1))},"select:accept":()=>{let t=m-1;if(m===0)e({type:`add-marketplace`});else if(O())ae();else{let e=u[t];e&&(T(e),C(`details`),E(0))}}},{context:`Select`,isActive:!g&&S===`list`}),Re(e=>{let t=m-1;if((e===`u`||e===`U`)&&t>=0)d(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=u[t];e&&(T(e),C(`confirm-remove`))}},{isActive:!g&&S===`list`}),L({"select:previous":()=>E(e=>Math.max(0,e-1)),"select:next":()=>{let e=se(w);E(t=>Math.min(e.length-1,t+1))},"select:accept":()=>{if(!w)return;let t=se(w)[ne];if(t?.value===`browse`)e({type:`browse-marketplace`,targetMarketplace:w.name});else if(t?.value===`update`){let e=u.map(e=>e.name===w.name?{...e,pendingUpdate:!0}:e);d(e),ae(e)}else t?.value===`toggle-auto-update`?M(w):t?.value===`remove`&&C(`confirm-remove`)}},{context:`Select`,isActive:!g&&S===`details`}),Re(e=>{e===`y`||e===`Y`?j():(e===`n`||e===`N`)&&(C(`list`),T(null))},{isActive:!g&&S===`confirm-remove`}),f)return(0,J.jsx)(z,{children:`Loading marketplaces…`});if(u.length===0)return(0,J.jsxs)(R,{flexDirection:`column`,children:[(0,J.jsx)(R,{marginBottom:1,children:(0,J.jsx)(z,{bold:!0,children:`Manage marketplaces`})}),(0,J.jsxs)(R,{flexDirection:`row`,gap:1,children:[(0,J.jsxs)(z,{color:`suggestion`,children:[a.pointer,` +`]}),(0,J.jsx)(z,{bold:!0,color:`suggestion`,children:`Add Marketplace`})]}),(0,J.jsx)(R,{marginLeft:3,children:(0,J.jsx)(z,{dimColor:!0,italic:!0,children:i.pending?(0,J.jsxs)(J.Fragment,{children:[`Press `,i.keyName,` again to go back`]}):(0,J.jsxs)(B,{children:[(0,J.jsx)(k,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`select`}),(0,J.jsx)(k,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`})]})})})]});if(S===`confirm-remove`&&w){let e=w.installedPlugins?.length||0;return(0,J.jsxs)(R,{flexDirection:`column`,children:[(0,J.jsxs)(z,{bold:!0,color:`warning`,children:[`Remove marketplace `,(0,J.jsx)(z,{italic:!0,children:w.name}),`?`]}),(0,J.jsxs)(R,{flexDirection:`column`,children:[e>0&&(0,J.jsx)(R,{marginTop:1,children:(0,J.jsxs)(z,{color:`warning`,children:[`This will also uninstall `,e,` `,H(e,`plugin`),` from this marketplace:`]})}),w.installedPlugins&&w.installedPlugins.length>0&&(0,J.jsx)(R,{flexDirection:`column`,marginTop:1,marginLeft:2,children:w.installedPlugins.map(e=>(0,J.jsxs)(z,{dimColor:!0,children:[`• `,e.name]},e.name))}),(0,J.jsx)(R,{marginTop:1,children:(0,J.jsxs)(z,{children:[`Press `,(0,J.jsx)(z,{bold:!0,children:`y`}),` to confirm or `,(0,J.jsx)(z,{bold:!0,children:`n`}),` to cancel`]})})]})]})}if(S===`details`&&w){let e=w.pendingUpdate||g,t=se(w);return(0,J.jsxs)(R,{flexDirection:`column`,children:[(0,J.jsx)(z,{bold:!0,children:w.name}),(0,J.jsx)(z,{dimColor:!0,children:w.source}),(0,J.jsx)(R,{marginTop:1,children:(0,J.jsxs)(z,{children:[w.pluginCount||0,` available `,H(w.pluginCount||0,`plugin`)]})}),w.installedPlugins&&w.installedPlugins.length>0&&(0,J.jsxs)(R,{flexDirection:`column`,marginTop:1,children:[(0,J.jsxs)(z,{bold:!0,children:[`Installed plugins (`,w.installedPlugins.length,`):`]}),(0,J.jsx)(R,{flexDirection:`column`,marginLeft:1,children:w.installedPlugins.map(e=>(0,J.jsxs)(R,{flexDirection:`row`,gap:1,children:[(0,J.jsx)(z,{children:a.bullet}),(0,J.jsxs)(R,{flexDirection:`column`,children:[(0,J.jsx)(z,{children:e.name}),(0,J.jsx)(z,{dimColor:!0,children:e.manifest.description})]})]},e.name))})]}),e&&(0,J.jsxs)(R,{marginTop:1,flexDirection:`column`,children:[(0,J.jsx)(z,{color:`claude`,children:`Updating marketplace…`}),ee&&(0,J.jsx)(z,{dimColor:!0,children:ee})]}),!e&&b&&(0,J.jsx)(R,{marginTop:1,children:(0,J.jsx)(z,{color:`claude`,children:b})}),!e&&v&&(0,J.jsx)(R,{marginTop:1,children:(0,J.jsx)(z,{color:`error`,children:v})}),!e&&(0,J.jsx)(R,{flexDirection:`column`,marginTop:1,children:t.map((e,t)=>{if(!e)return null;let n=t===ne;return(0,J.jsxs)(R,{children:[(0,J.jsxs)(z,{color:n?`suggestion`:void 0,children:[n?a.pointer:` `,` `,e.label]}),e.secondaryLabel&&(0,J.jsxs)(z,{dimColor:!0,children:[` `,e.secondaryLabel]})]},e.value)})}),!e&&!lt()&&w.autoUpdate&&(0,J.jsx)(R,{marginTop:1,children:(0,J.jsx)(z,{dimColor:!0,children:`Auto-update enabled. Work Mate will automatically update this marketplace and its installed plugins.`})}),(0,J.jsx)(R,{marginLeft:3,children:(0,J.jsx)(z,{dimColor:!0,italic:!0,children:e?(0,J.jsx)(J.Fragment,{children:`Please wait…`}):(0,J.jsxs)(B,{children:[(0,J.jsx)(k,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`select`}),(0,J.jsx)(k,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`})]})})})]})}let{updateCount:le,removeCount:ue}=re();return(0,J.jsxs)(R,{flexDirection:`column`,children:[(0,J.jsx)(R,{marginBottom:1,children:(0,J.jsx)(z,{bold:!0,children:`Manage marketplaces`})}),(0,J.jsxs)(R,{flexDirection:`row`,gap:1,marginBottom:1,children:[(0,J.jsxs)(z,{color:m===0?`suggestion`:void 0,children:[m===0?a.pointer:` `,` +`]}),(0,J.jsx)(z,{bold:!0,color:m===0?`suggestion`:void 0,children:`Add Marketplace`})]}),(0,J.jsx)(R,{flexDirection:`column`,children:u.map((e,t)=>{let n=t+1===m,r=[];return e.pendingUpdate&&r.push(`UPDATE`),e.pendingRemove&&r.push(`REMOVE`),(0,J.jsxs)(R,{flexDirection:`row`,gap:1,marginBottom:1,children:[(0,J.jsxs)(z,{color:n?`suggestion`:void 0,children:[n?a.pointer:` `,` `,e.pendingRemove?a.cross:a.bullet]}),(0,J.jsxs)(R,{flexDirection:`column`,flexGrow:1,children:[(0,J.jsxs)(R,{flexDirection:`row`,gap:1,children:[(0,J.jsxs)(z,{bold:!0,strikethrough:e.pendingRemove,dimColor:e.pendingRemove,children:[e.name===`claude-plugins-official`&&(0,J.jsx)(z,{color:`claude`,children:`✻ `}),e.name,e.name===`claude-plugins-official`&&(0,J.jsx)(z,{color:`claude`,children:` ✻`})]}),r.length>0&&(0,J.jsxs)(z,{color:`warning`,children:[`[`,r.join(`, `),`]`]})]}),(0,J.jsx)(z,{dimColor:!0,children:e.source}),(0,J.jsxs)(z,{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)})}),O()&&(0,J.jsxs)(R,{marginTop:1,flexDirection:`column`,children:[(0,J.jsxs)(z,{children:[(0,J.jsx)(z,{bold:!0,children:`Pending changes:`}),` `,(0,J.jsx)(z,{dimColor:!0,children:`Enter to apply`})]}),le>0&&(0,J.jsxs)(z,{children:[`• Update `,le,` `,H(le,`marketplace`)]}),ue>0&&(0,J.jsxs)(z,{color:`warning`,children:[`• Remove `,ue,` `,H(ue,`marketplace`)]})]}),g&&(0,J.jsx)(R,{marginTop:1,children:(0,J.jsx)(z,{color:`claude`,children:`Processing changes…`})}),v&&(0,J.jsx)(R,{marginTop:1,children:(0,J.jsx)(z,{color:`error`,children:v})}),(0,J.jsx)(zn,{exitState:i,hasPendingActions:O()})]})}function zn({exitState:e,hasPendingActions:t}){return e.pending?(0,J.jsx)(R,{marginTop:1,children:(0,J.jsxs)(z,{dimColor:!0,italic:!0,children:[`Press `,e.keyName,` again to go back`]})}):(0,J.jsx)(R,{marginTop:1,children:(0,J.jsx)(z,{dimColor:!0,italic:!0,children:(0,J.jsxs)(B,{children:[t&&(0,J.jsx)(k,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`apply changes`}),!t&&(0,J.jsx)(k,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`select`}),!t&&(0,J.jsx)(Ne,{shortcut:`u`,action:`update`}),!t&&(0,J.jsx)(Ne,{shortcut:`r`,action:`remove`}),(0,J.jsx)(k,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:t?`cancel`:`go back`})]})})})}var Bn,J,Vn=e((()=>{i(),V(),Bn=t(V(),1),pt(),De(),We(),l(),nt(),ut(),et(),b(),re(),s(),tn(),x(),ot(),at(),_t(),J=qe()}));function Hn(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 j(e)}function Un(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 Wn=e((()=>{Te()}));function Gn({item:e,isSelected:t}){let[n]=Fe();if(e.type===`plugin`){let r,i;return e.pendingToggle?(r=ze(`suggestion`,n)(a.arrowRight),i=e.pendingToggle===`will-enable`?`will enable`:`will disable`):e.errorCount>0?(r=ze(`error`,n)(a.cross),i=`${e.errorCount} ${H(e.errorCount,`error`)}`):e.isEnabled?(r=ze(`success`,n)(a.tick),i=`enabled`):(r=ze(`inactive`,n)(a.radioOff),i=`disabled`),(0,Y.jsxs)(R,{children:[(0,Y.jsx)(z,{color:t?`suggestion`:void 0,children:t?`${a.pointer} `:` `}),(0,Y.jsx)(z,{color:t?`suggestion`:void 0,children:e.name}),(0,Y.jsxs)(z,{dimColor:!t,children:[` `,(0,Y.jsx)(z,{backgroundColor:`userMessageBackground`,children:`Plugin`})]}),(0,Y.jsxs)(z,{dimColor:!0,children:[` · `,e.marketplace]}),(0,Y.jsxs)(z,{dimColor:!t,children:[` · `,r,` `]}),(0,Y.jsx)(z,{dimColor:!t,children:i})]})}if(e.type===`flagged-plugin`){let r=ze(`warning`,n)(a.warning);return(0,Y.jsxs)(R,{children:[(0,Y.jsx)(z,{color:t?`suggestion`:void 0,children:t?`${a.pointer} `:` `}),(0,Y.jsx)(z,{color:t?`suggestion`:void 0,children:e.name}),(0,Y.jsxs)(z,{dimColor:!t,children:[` `,(0,Y.jsx)(z,{backgroundColor:`userMessageBackground`,children:`Plugin`})]}),(0,Y.jsxs)(z,{dimColor:!0,children:[` · `,e.marketplace]}),(0,Y.jsxs)(z,{dimColor:!t,children:[` · `,r,` `]}),(0,Y.jsx)(z,{dimColor:!t,children:`removed`})]})}if(e.type===`failed-plugin`){let r=ze(`error`,n)(a.cross),i=`failed to load · ${e.errorCount} ${H(e.errorCount,`error`)}`;return(0,Y.jsxs)(R,{children:[(0,Y.jsx)(z,{color:t?`suggestion`:void 0,children:t?`${a.pointer} `:` `}),(0,Y.jsx)(z,{color:t?`suggestion`:void 0,children:e.name}),(0,Y.jsxs)(z,{dimColor:!t,children:[` `,(0,Y.jsx)(z,{backgroundColor:`userMessageBackground`,children:`Plugin`})]}),(0,Y.jsxs)(z,{dimColor:!0,children:[` · `,e.marketplace]}),(0,Y.jsxs)(z,{dimColor:!t,children:[` · `,r,` `]}),(0,Y.jsx)(z,{dimColor:!t,children:i})]})}let r,i;return e.status===`connected`?(r=ze(`success`,n)(a.tick),i=`connected`):e.status===`disabled`?(r=ze(`inactive`,n)(a.radioOff),i=`disabled`):e.status===`pending`?(r=ze(`inactive`,n)(a.radioOff),i=`connecting…`):e.status===`needs-auth`?(r=ze(`warning`,n)(a.triangleUpOutline),i=`Enter to auth`):(r=ze(`error`,n)(a.cross),i=`failed`),e.indented?(0,Y.jsxs)(R,{children:[(0,Y.jsx)(z,{color:t?`suggestion`:void 0,children:t?`${a.pointer} `:` `}),(0,Y.jsx)(z,{dimColor:!t,children:`└ `}),(0,Y.jsx)(z,{color:t?`suggestion`:void 0,children:e.name}),(0,Y.jsxs)(z,{dimColor:!t,children:[` `,(0,Y.jsx)(z,{backgroundColor:`userMessageBackground`,children:`MCP`})]}),(0,Y.jsxs)(z,{dimColor:!t,children:[` · `,r,` `]}),(0,Y.jsx)(z,{dimColor:!t,children:i})]}):(0,Y.jsxs)(R,{children:[(0,Y.jsx)(z,{color:t?`suggestion`:void 0,children:t?`${a.pointer} `:` `}),(0,Y.jsx)(z,{color:t?`suggestion`:void 0,children:e.name}),(0,Y.jsxs)(z,{dimColor:!t,children:[` `,(0,Y.jsx)(z,{backgroundColor:`userMessageBackground`,children:`MCP`})]}),(0,Y.jsxs)(z,{dimColor:!t,children:[` · `,r,` `]}),(0,Y.jsx)(z,{dimColor:!t,children:i})]})}var Y,Kn=e((()=>{i(),V(),We(),_t(),Y=qe()}));async function qn(e){try{return(await rn.readdir(e,{withFileTypes:!0})).filter(e=>e.isFile()&&e.name.endsWith(`.md`)).map(e=>nn.basename(e.name,`.md`))}catch(t){return $e(`Failed to read plugin components from ${e}: ${Ye(t)}`,{level:`error`}),ft(Ze(t)),[]}}async function Jn(e){try{let t=await rn.readdir(e,{withFileTypes:!0}),n=[];for(let r of t)if(r.isDirectory()||r.isSymbolicLink()){let t=nn.join(e,r.name,`SKILL.md`);try{(await rn.stat(t)).isFile()&&n.push(r.name)}catch{}}return n}catch(t){return $e(`Failed to read skill directories from ${e}: ${Ye(t)}`,{level:`error`}),ft(Ze(t)),[]}}function Yn({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=O(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 ne(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 qn(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 qn(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 Jn(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)(R,{flexDirection:`column`,marginBottom:1,children:[(0,Z.jsx)(z,{bold:!0,children:`Components:`}),(0,Z.jsxs)(z,{dimColor:!0,children:[`Error: `,o]})]}):!n||!(n.commands||n.agents||n.skills||n.hooks||n.mcpServers)?null:(0,Z.jsxs)(R,{flexDirection:`column`,marginBottom:1,children:[(0,Z.jsx)(z,{bold:!0,children:`Installed components:`}),n.commands?(0,Z.jsxs)(z,{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)(z,{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)(z,{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)(z,{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)(z,{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 Xn(e,t){let n=(await ne(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 Zn(e){return e.filter(e=>{let t=e.source.split(`@`)[1]||`local`;return!p(`${e.name}@${t}`)})}function Qn({setViewState:e,setResult:t,onManageComplete:n,onSearchModeChange:r,targetPlugin:i,targetMarketplace:o,action:s}){let l=we(e=>e.mcp.clients),u=we(e=>e.mcp.tools),d=we(e=>e.plugins.errors),f=It(),[p,m]=(0,X.useState)(!1),h=(0,X.useCallback)(e=>{m(e),r?.(e)},[r]),_=Le(),{columns:v}=He(),[y,b]=(0,X.useState)(`plugin-list`),{query:x,setQuery:ee,cursorOffset:te}=Wt({isActive:y===`plugin-list`&&p,onExit:()=>{h(!1)}}),[S,C]=(0,X.useState)(null),[T,ne]=(0,X.useState)([]),[E,O]=(0,X.useState)([]),[re,ie]=(0,X.useState)(!0),[A,oe]=(0,X.useState)(new Map),j=(0,X.useRef)(!1),ce=(0,X.useRef)(void 0),le=zt();Ie(`confirm:no`,$n.useCallback(()=>{if(y===`plugin-details`)b(`plugin-list`),C(null),I(null);else if(typeof y==`object`&&y.type===`failed-plugin-details`)b(`plugin-list`),I(null);else if(y===`configuring`)b(`plugin-details`),Te(null);else if(typeof y==`object`&&(y.type===`plugin-options`||y.type===`configuring-options`))b(`plugin-list`),C(null),t(`Plugin enabled. Configuration skipped — run /reload-plugins to apply.`),n&&n();else if(typeof y==`object`&&y.type===`flagged-detail`)b(`plugin-list`),I(null);else if(typeof y==`object`&&y.type===`mcp-detail`)b(`plugin-list`),I(null);else if(typeof y==`object`&&y.type===`mcp-tools`)b({type:`mcp-detail`,client:y.client});else if(typeof y==`object`&&y.type===`mcp-tool-detail`)b({type:`mcp-tools`,client:y.client});else{if(A.size>0){t(`Run /reload-plugins to apply plugin changes.`);return}e({type:`menu`})}},[y,e,A,t]),{context:`Confirmation`,isActive:(y!==`plugin-list`||!p)&&y!==`confirm-project-uninstall`&&!(typeof y==`object`&&y.type===`confirm-data-cleanup`)});let de=e=>e.type===`connected`?`connected`:e.type===`disabled`?`disabled`:e.type===`pending`?`pending`:e.type===`needs-auth`?`needs-auth`:`failed`,fe=(0,X.useMemo)(()=>{let e=it(),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 E){let i=`${r.plugin.name}@${r.marketplace}`,a=e?.enabledPlugins?.[i]!==!1,o=d.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:A.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 d){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=yt(),s=[];for(let[e,t]of a){if(e in f)continue;let n=be(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:de(e),client:e}));let u={flagged:-1,project:0,local:1,user:2,enterprise:3,managed:4,dynamic:5,builtin:6},p=[],m=new Map;for(let{item:e,originalScope:t,childMcps:r}of n){let n=e.scope;m.has(n)||m.set(n,[]),m.get(n).push(e);for(let{displayName:e,client:n}of r){let r=t===`builtin`?`user`:t;m.has(r)||m.set(r,[]),m.get(r).push({type:`mcp`,id:`mcp:${n.name}`,name:e,description:void 0,scope:r,status:de(n),client:n,indented:!0})}}for(let e of c){let t=e.scope;m.has(t)||m.set(t,[]),m.get(t).push(e)}for(let e of s){let t=e.scope;m.has(t)||m.set(t,[]),m.get(t).push(e)}for(let[e,t]of Object.entries(f)){let n=be(e),r=n.name||e,i=n.marketplace||`unknown`;m.has(`flagged`)||m.set(`flagged`,[]),m.get(`flagged`).push({type:`flagged-plugin`,id:e,name:r,marketplace:i,scope:`flagged`,reason:`delisted`,text:`Removed from marketplace`,flaggedAt:t.flaggedAt})}let h=[...m.keys()].sort((e,t)=>(u[e]??99)-(u[t]??99));for(let e of h){let t=m.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)p.push(...e);p.push(...r)}return p},[E,l,d,A,f]),me=(0,X.useMemo)(()=>fe.filter(e=>e.type===`flagged-plugin`).map(e=>e.id),[fe]);(0,X.useEffect)(()=>{me.length>0&&Ft(me)},[me]);let N=(0,X.useMemo)(()=>{if(!x)return fe;let e=x.toLowerCase();return fe.filter(t=>t.name.toLowerCase().includes(e)||`description`in t&&t.description?.toLowerCase().includes(e))},[fe,x]),[P,he]=(0,X.useState)(0),_e=En({totalItems:N.length,selectedIndex:P,maxVisible:8}),[ve,ye]=(0,X.useState)(0),[xe,F]=(0,X.useState)(!1),[Se,I]=(0,X.useState)(null),[Ce,Te]=(0,X.useState)(null),[Ee,De]=(0,X.useState)(!1),[Oe,Ae]=(0,X.useState)(!1);(0,X.useEffect)(()=>{if(!S){Ae(!1);return}async function e(){let e=S.plugin.manifest.mcpServers,t=!1;if(e&&(t=typeof e==`string`&&M(e)||Array.isArray(e)&&e.some(e=>typeof e==`string`&&M(e))),!t)try{let e=nn.join(S.plugin.path,`..`),n=nn.join(e,`.claude-plugin`,`marketplace.json`),r=Je(await rn.readFile(n,`utf-8`)).plugins?.find(e=>e.name===S.plugin.name);if(r?.mcpServers){let e=r.mcpServers;t=typeof e==`string`&&M(e)||Array.isArray(e)&&e.some(e=>typeof e==`string`&&M(e))}}catch(e){$e(`Failed to read raw marketplace.json: ${e}`)}Ae(t)}e()},[S]),(0,X.useEffect)(()=>{async function e(){ie(!0);try{let{enabled:e,disabled:t}=await c(),n=it(),r=Zn([...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)),ne(a);let o=[];for(let e of a)for(let t of e.installedPlugins){let n=`${t.name}@${e.name}`,r=t.isBuiltin?`builtin`:Tt(n).scope;o.push({plugin:t,marketplace:e.name,scope:r,pendingEnable:void 0,pendingUpdate:!1})}O(o),he(0)}finally{ie(!1)}}e()},[]),(0,X.useEffect)(()=>{if(!j.current&&i&&T.length>0&&!re){let{name:e,marketplace:n}=be(i),r=o??n,a=r?T.filter(e=>e.name===r):T;for(let t of a){let n=t.installedPlugins.find(t=>t.name===e);if(n){let{scope:e}=Tt(`${n.name}@${t.name}`),r={plugin:n,marketplace:t.name,scope:e,pendingEnable:void 0,pendingUpdate:!1};C(r),b(`plugin-details`),ce.current=s,j.current=!0;return}}let c=fe.find(t=>t.type===`failed-plugin`&&t.name===e);c&&c.type===`failed-plugin`&&(b({type:`failed-plugin-details`,plugin:{id:c.id,name:c.name,marketplace:c.marketplace,errors:c.errors,scope:c.scope}}),j.current=!0),!j.current&&s&&(j.current=!0,t(`Plugin "${i}" is not installed in this project`))}},[i,o,T,re,fe,s,t]);let je=async r=>{if(!S)return;let i=S.scope||`user`,a=i===`builtin`;if(a&&(r===`update`||r===`uninstall`)){I(`Built-in plugins cannot be updated or uninstalled.`);return}if(!a&&!wt(i)&&r!==`update`){I(`This plugin is managed by your organization. Contact your admin to disable it.`);return}F(!0),I(null);try{let o=`${S.plugin.name}@${S.marketplace}`,s;switch(r){case`enable`:{let e=await bt(o);if(!e.success)throw Error(e.message);break}case`disable`:{let e=await Ct(o);if(!e.success)throw Error(e.message);s=e.reverseDependents;break}case`uninstall`:{if(a||!wt(i))break;if(Dt(o)){F(!1),b(`confirm-project-uninstall`);return}let e=w().plugins[o],t=!e||e.length<=1?await se(o):null;if(t){F(!1),b({type:`confirm-data-cleanup`,size:t});return}let n=await xt(o,i);if(!n.success)throw Error(n.message);s=n.reverseDependents;break}case`update`:{if(a)break;let r=await St(o,i);if(!r.success)throw Error(r.message);if(r.alreadyUpToDate){t(`${S.plugin.name} is already at the latest version (${r.newVersion}).`),n&&await n(),e({type:`menu`});return}break}}ke();let c=`${S.plugin.name}@${S.marketplace}`;if(it()?.enabledPlugins?.[c]!==!1){F(!1),b({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} ${S.plugin.name}${u}. Run /reload-plugins to apply.`),n&&await n(),e({type:`menu`})}catch(e){F(!1);let t=e instanceof Error?e.message:String(e);I(`Failed to ${r}: ${t}`),ft(Ze(e))}},Me=(0,X.useRef)(je);Me.current=je,(0,X.useEffect)(()=>{if(y===`plugin-details`&&S&&ce.current){let e=ce.current;ce.current=void 0,Me.current(e)}},[y,S]);let Ne=$n.useCallback(()=>{if(P>=N.length)return;let e=N[P];if(e?.type!==`flagged-plugin`)if(e?.type===`plugin`){let t=`${e.plugin.name}@${e.marketplace}`,n=it(),r=A.get(t),i=n?.enabledPlugins?.[t]!==!1,a=e.scope;if(a===`builtin`||wt(a)){let e=new Map(A);r?(e.delete(t),(async()=>{try{r===`will-disable`?await bt(t):await Ct(t),ke()}catch(e){ft(e)}})()):(e.set(t,i?`will-disable`:`will-enable`),(async()=>{try{i?await Ct(t):await bt(t),ke()}catch(e){ft(e)}})()),oe(e)}}else e?.type===`mcp`&&le(e.client.name)},[P,N,A,E,le]);L({"select:previous":()=>{P===0?h(!0):_e.handleSelectionChange(P-1,he)},"select:next":()=>{P<N.length-1&&_e.handleSelectionChange(P+1,he)},"select:accept":$n.useCallback(()=>{if(P>=N.length)return;let e=N[P];if(e?.type===`plugin`){let t=E.find(t=>t.plugin.name===e.plugin.name&&t.marketplace===e.marketplace);t&&(C(t),b(`plugin-details`),ye(0),I(null))}else e?.type===`flagged-plugin`?(b({type:`flagged-detail`,plugin:{id:e.id,name:e.name,marketplace:e.marketplace,reason:e.reason,text:e.text,flaggedAt:e.flaggedAt}}),I(null)):e?.type===`failed-plugin`?(b({type:`failed-plugin-details`,plugin:{id:e.id,name:e.name,marketplace:e.marketplace,errors:e.errors,scope:e.scope}}),ye(0),I(null)):e?.type===`mcp`&&(b({type:`mcp-detail`,client:e.client}),I(null))},[P,N,E])},{context:`Select`,isActive:y===`plugin-list`&&!p}),L({"plugin:toggle":Ne},{context:`Plugin`,isActive:y===`plugin-list`&&!p}),L({"select:accept":$n.useCallback(()=>{typeof y!=`object`||y.type!==`flagged-detail`||(Lt(y.plugin.id),b(`plugin-list`))},[y])},{context:`Select`,isActive:typeof y==`object`&&y.type===`flagged-detail`});let Pe=$n.useMemo(()=>{if(y!==`plugin-details`||!S)return[];let e=it(),t=`${S.plugin.name}@${S.marketplace}`,n=e?.enabledPlugins?.[t]!==!1,r=S.marketplace===`builtin`,i=[];return i.push({label:n?`Disable plugin`:`Enable plugin`,action:()=>void je(n?`disable`:`enable`)}),r||(i.push({label:S.pendingUpdate?`Unmark for update`:`Mark for update`,action:async()=>{try{let e=await Xn(S.plugin.name,S.marketplace);if(e){I(e);return}let t=[...E],n=t.findIndex(e=>e.plugin.name===S.plugin.name&&e.marketplace===S.marketplace);n!==-1&&(t[n].pendingUpdate=!S.pendingUpdate,O(t),C({...S,pendingUpdate:!S.pendingUpdate}))}catch(e){I(e instanceof Error?e.message:`Failed to check plugin update availability`)}}}),Oe&&i.push({label:`Configure`,action:async()=>{De(!0);try{let e=S.plugin.manifest.mcpServers,t=null;if(typeof e==`string`&&M(e))t=e;else if(Array.isArray(e)){for(let n of e)if(typeof n==`string`&&M(n)){t=n;break}}if(!t){I(`No MCPB file found in plugin`),De(!1);return}let n=`${S.plugin.name}@${S.marketplace}`,r=await ge(t,S.plugin.path,n,void 0,void 0,!0);`status`in r&&r.status===`needs-config`?(Te(r),b(`configuring`)):I(`Failed to load MCPB for configuration`)}catch(e){let t=Ye(e);I(`Failed to load configuration: ${t}`)}finally{De(!1)}}}),S.plugin.manifest.userConfig&&Object.keys(S.plugin.manifest.userConfig).length>0&&i.push({label:`Configure options`,action:()=>{b({type:`configuring-options`,schema:S.plugin.manifest.userConfig})}}),i.push({label:`Update now`,action:()=>void je(`update`)}),i.push({label:`Uninstall`,action:()=>void je(`uninstall`)})),S.plugin.manifest.homepage&&i.push({label:`Open homepage`,action:()=>void ae(S.plugin.manifest.homepage)}),S.plugin.manifest.repository&&i.push({label:`View repository`,action:()=>void ae(S.plugin.manifest.repository)}),i.push({label:`Back to plugin list`,action:()=>{b(`plugin-list`),C(null),I(null)}}),i},[y,S,Oe,E]);if(L({"select:previous":()=>{ve>0&&ye(ve-1)},"select:next":()=>{ve<Pe.length-1&&ye(ve+1)},"select:accept":()=>{Pe[ve]&&Pe[ve].action()}},{context:`Select`,isActive:y===`plugin-details`&&!!S}),L({"select:accept":()=>{typeof y==`object`&&y.type===`failed-plugin-details`&&(async()=>{F(!0),I(null);let e=y.plugin.id,t=y.plugin.scope,r=wt(t)?await xt(e,t,!1):await xt(e,`user`,!1),i=r.success;if(!i){for(let t of[`userSettings`,`projectSettings`,`localSettings`]){let n=rt(t);n?.enabledPlugins?.[e]!==void 0&&(st(t,{enabledPlugins:{...n.enabledPlugins,[e]:void 0}}),i=!0)}ke()}i?(n&&await n(),F(!1),b(`plugin-list`)):(F(!1),I(r.message))})()}},{context:`Select`,isActive:typeof y==`object`&&y.type===`failed-plugin-details`&&y.plugin.scope!==`managed`}),L({"confirm:yes":()=>{if(!S)return;F(!0),I(null);let r=`${S.plugin.name}@${S.marketplace}`,{error:i}=st(`localSettings`,{enabledPlugins:{...rt(`localSettings`)?.enabledPlugins,[r]:!1}});if(i){F(!1),I(`Failed to write settings: ${i.message}`);return}ke(),t(`✓ Disabled ${S.plugin.name} in .claude/settings.local.json. Run /reload-plugins to apply.`),n&&n(),e({type:`menu`})},"confirm:no":()=>{b(`plugin-details`),I(null)}},{context:`Confirmation`,isActive:y===`confirm-project-uninstall`&&!!S&&!xe}),Re((r,i)=>{if(!S)return;let o=`${S.plugin.name}@${S.marketplace}`,s=S.scope;if(!s||s===`builtin`||!wt(s))return;let c=async r=>{F(!0),I(null);try{let i=await xt(o,s,r);if(!i.success)throw Error(i.message);ke();let c=r?``:` · data preserved`;t(`${a.tick} ${i.message}${c}`),n&&n(),e({type:`menu`})}catch(e){F(!1),I(e instanceof Error?e.message:String(e))}};r===`y`||r===`Y`?c(!0):r===`n`||r===`N`?c(!1):i.escape&&(b(`plugin-details`),I(null))},{isActive:typeof y==`object`&&y.type===`confirm-data-cleanup`&&!!S&&!xe}),$n.useEffect(()=>{he(0)},[x]),Re((e,t)=>{let n=!t.ctrl&&!t.meta;p||(e===`/`&&n?(h(!0),ee(``),he(0)):n&&e.length>0&&!/^\s+$/.test(e)&&e!==`j`&&e!==`k`&&e!==` `&&(h(!0),ee(e),he(0)))},{isActive:y===`plugin-list`}),re)return(0,Z.jsx)(z,{children:`Loading installed plugins…`});if(fe.length===0)return(0,Z.jsxs)(R,{flexDirection:`column`,children:[(0,Z.jsx)(R,{marginBottom:1,children:(0,Z.jsx)(z,{bold:!0,children:`Manage plugins`})}),(0,Z.jsx)(z,{children:`No plugins or MCP servers installed.`}),(0,Z.jsx)(R,{marginTop:1,children:(0,Z.jsx)(z,{dimColor:!0,children:`Esc to go back`})})]});if(typeof y==`object`&&y.type===`plugin-options`&&S){let r=`${S.plugin.name}@${S.marketplace}`;function i(r){t(r),n&&n(),e({type:`menu`})}return(0,Z.jsx)(mn,{plugin:S.plugin,pluginId:r,onDone:(e,t)=>{switch(e){case`configured`:i(`✓ Enabled and configured ${S.plugin.name}. Run /reload-plugins to apply.`);break;case`skipped`:i(`✓ Enabled ${S.plugin.name}. Run /reload-plugins to apply.`);break;case`error`:i(`Failed to save configuration: ${t}`);break}}})}if(typeof y==`object`&&y.type===`configuring-options`&&S){let e=`${S.plugin.name}@${S.marketplace}`;return(0,Z.jsx)(ln,{title:`Configure ${S.plugin.name}`,subtitle:`Plugin options`,configSchema:y.schema,initialValues:D(e),onSave:n=>{try{g(e,n,y.schema),ke(),t(`Configuration saved. Run /reload-plugins for changes to take effect.`)}catch(e){I(`Failed to save configuration: ${Ye(e)}`)}b(`plugin-details`)},onCancel:()=>b(`plugin-details`)})}if(y===`configuring`&&Ce&&S){let e=`${S.plugin.name}@${S.marketplace}`;async function n(n){if(!(!Ce||!S))try{let r=S.plugin.manifest.mcpServers,i=null;if(typeof r==`string`&&M(r))i=r;else if(Array.isArray(r)){for(let e of r)if(typeof e==`string`&&M(e)){i=e;break}}if(!i){I(`No MCPB file found`),b(`plugin-details`);return}await ge(i,S.plugin.path,e,void 0,n),I(null),Te(null),b(`plugin-details`),t(`Configuration saved. Run /reload-plugins for changes to take effect.`)}catch(e){let t=Ye(e);I(`Failed to save configuration: ${t}`),b(`plugin-details`)}}function r(){Te(null),b(`plugin-details`)}return(0,Z.jsx)(ln,{title:`Configure ${Ce.manifest.name}`,subtitle:`Plugin: ${S.plugin.name}`,configSchema:Ce.configSchema,initialValues:Ce.existingConfig,onSave:n,onCancel:r})}if(typeof y==`object`&&y.type===`flagged-detail`){let e=y.plugin;return(0,Z.jsxs)(R,{flexDirection:`column`,children:[(0,Z.jsx)(R,{children:(0,Z.jsxs)(z,{bold:!0,children:[e.name,` @ `,e.marketplace]})}),(0,Z.jsxs)(R,{marginBottom:1,children:[(0,Z.jsx)(z,{dimColor:!0,children:`Status: `}),(0,Z.jsx)(z,{color:`error`,children:`Removed`})]}),(0,Z.jsxs)(R,{marginBottom:1,flexDirection:`column`,children:[(0,Z.jsxs)(z,{color:`error`,children:[`Removed from marketplace · reason: `,e.reason]}),(0,Z.jsx)(z,{children:e.text}),(0,Z.jsxs)(z,{dimColor:!0,children:[`Flagged on `,new Date(e.flaggedAt).toLocaleDateString()]})]}),(0,Z.jsx)(R,{marginTop:1,flexDirection:`column`,children:(0,Z.jsxs)(R,{children:[(0,Z.jsxs)(z,{children:[a.pointer,` `]}),(0,Z.jsx)(z,{color:`suggestion`,children:`Dismiss`})]})}),(0,Z.jsxs)(B,{children:[(0,Z.jsx)(k,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`dismiss`}),(0,Z.jsx)(k,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]})]})}if(y===`confirm-project-uninstall`&&S)return(0,Z.jsxs)(R,{flexDirection:`column`,children:[(0,Z.jsxs)(z,{bold:!0,color:`warning`,children:[S.plugin.name,` is enabled in .claude/settings.json (shared with your team)`]}),(0,Z.jsxs)(R,{marginTop:1,flexDirection:`column`,children:[(0,Z.jsx)(z,{children:`Disable it just for you in .claude/settings.local.json?`}),(0,Z.jsx)(z,{dimColor:!0,children:`This has the same effect as uninstalling, without affecting other contributors.`})]}),Se&&(0,Z.jsx)(R,{marginTop:1,children:(0,Z.jsx)(z,{color:`error`,children:Se})}),(0,Z.jsx)(R,{marginTop:1,children:xe?(0,Z.jsx)(z,{dimColor:!0,children:`Disabling…`}):(0,Z.jsxs)(B,{children:[(0,Z.jsx)(k,{action:`confirm:yes`,context:`Confirmation`,fallback:`y`,description:`disable`}),(0,Z.jsx)(k,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})]})})]});if(typeof y==`object`&&y.type===`confirm-data-cleanup`&&S)return(0,Z.jsxs)(R,{flexDirection:`column`,children:[(0,Z.jsxs)(z,{bold:!0,children:[S.plugin.name,` has `,y.size.human,` of persistent data`]}),(0,Z.jsxs)(R,{marginTop:1,flexDirection:`column`,children:[(0,Z.jsx)(z,{children:`Delete it along with the plugin?`}),(0,Z.jsx)(z,{dimColor:!0,children:pe(`${S.plugin.name}@${S.marketplace}`)})]}),Se&&(0,Z.jsx)(R,{marginTop:1,children:(0,Z.jsx)(z,{color:`error`,children:Se})}),(0,Z.jsx)(R,{marginTop:1,children:xe?(0,Z.jsx)(z,{dimColor:!0,children:`Uninstalling…`}):(0,Z.jsxs)(z,{children:[(0,Z.jsx)(z,{bold:!0,children:`y`}),` to delete · `,(0,Z.jsx)(z,{bold:!0,children:`n`}),` to keep · `,(0,Z.jsx)(z,{bold:!0,children:`esc`}),` to cancel`]})})]});if(y===`plugin-details`&&S){let e=it(),t=`${S.plugin.name}@${S.marketplace}`,n=e?.enabledPlugins?.[t]!==!1,r=d.filter(e=>`plugin`in e&&e.plugin===S.plugin.name||e.source===t||e.source.startsWith(`${S.plugin.name}@`)),i=r.length===0?null:(0,Z.jsxs)(R,{flexDirection:`column`,marginBottom:1,children:[(0,Z.jsxs)(z,{bold:!0,color:`error`,children:[r.length,` `,H(r.length,`error`),`:`]}),r.map((e,t)=>{let n=Un(e);return(0,Z.jsxs)(R,{flexDirection:`column`,marginLeft:2,children:[(0,Z.jsx)(z,{color:`error`,children:Hn(e)}),n&&(0,Z.jsxs)(z,{dimColor:!0,italic:!0,children:[a.arrowRight,` `,n]})]},t)})]});return(0,Z.jsxs)(R,{flexDirection:`column`,children:[(0,Z.jsx)(R,{children:(0,Z.jsxs)(z,{bold:!0,children:[S.plugin.name,` @ `,S.marketplace]})}),(0,Z.jsxs)(R,{children:[(0,Z.jsx)(z,{dimColor:!0,children:`Scope: `}),(0,Z.jsx)(z,{children:S.scope||`user`})]}),S.plugin.manifest.version&&(0,Z.jsxs)(R,{children:[(0,Z.jsx)(z,{dimColor:!0,children:`Version: `}),(0,Z.jsx)(z,{children:S.plugin.manifest.version})]}),S.plugin.manifest.description&&(0,Z.jsx)(R,{marginBottom:1,children:(0,Z.jsx)(z,{children:S.plugin.manifest.description})}),S.plugin.manifest.author&&(0,Z.jsxs)(R,{children:[(0,Z.jsx)(z,{dimColor:!0,children:`Author: `}),(0,Z.jsx)(z,{children:S.plugin.manifest.author.name})]}),(0,Z.jsxs)(R,{marginBottom:1,children:[(0,Z.jsx)(z,{dimColor:!0,children:`Status: `}),(0,Z.jsx)(z,{color:n?`success`:`warning`,children:n?`Enabled`:`Disabled`}),S.pendingUpdate&&(0,Z.jsx)(z,{color:`suggestion`,children:` · Marked for update`})]}),(0,Z.jsx)(Yn,{plugin:S.plugin,marketplace:S.marketplace}),i,(0,Z.jsx)(R,{marginTop:1,flexDirection:`column`,children:Pe.map((e,t)=>{let n=t===ve;return(0,Z.jsxs)(R,{children:[n&&(0,Z.jsxs)(z,{children:[a.pointer,` `]}),!n&&(0,Z.jsx)(z,{children:` `}),(0,Z.jsx)(z,{bold:n,color:e.label.includes(`Uninstall`)?`error`:e.label.includes(`Update`)?`suggestion`:void 0,children:e.label})]},t)})}),xe&&(0,Z.jsx)(R,{marginTop:1,children:(0,Z.jsx)(z,{children:`Processing…`})}),Se&&(0,Z.jsx)(R,{marginTop:1,children:(0,Z.jsx)(z,{color:`error`,children:Se})}),(0,Z.jsx)(R,{marginTop:1,children:(0,Z.jsx)(z,{dimColor:!0,italic:!0,children:(0,Z.jsxs)(B,{children:[(0,Z.jsx)(k,{action:`select:previous`,context:`Select`,fallback:`↑`,description:`navigate`}),(0,Z.jsx)(k,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`select`}),(0,Z.jsx)(k,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]})})})]})}if(typeof y==`object`&&y.type===`failed-plugin-details`){let e=y.plugin,t=e.errors[0],n=t?Hn(t):`Failed to load`;return(0,Z.jsxs)(R,{flexDirection:`column`,children:[(0,Z.jsxs)(z,{children:[(0,Z.jsx)(z,{bold:!0,children:e.name}),(0,Z.jsxs)(z,{dimColor:!0,children:[` @ `,e.marketplace]}),(0,Z.jsxs)(z,{dimColor:!0,children:[` (`,e.scope,`)`]})]}),(0,Z.jsx)(z,{color:`error`,children:n}),e.scope===`managed`?(0,Z.jsx)(R,{marginTop:1,children:(0,Z.jsx)(z,{dimColor:!0,children:`Managed by your organization — contact your admin`})}):(0,Z.jsxs)(R,{marginTop:1,children:[(0,Z.jsxs)(z,{color:`suggestion`,children:[a.pointer,` `]}),(0,Z.jsx)(z,{bold:!0,children:`Remove`})]}),xe&&(0,Z.jsx)(z,{children:`Processing…`}),Se&&(0,Z.jsx)(z,{color:`error`,children:Se}),(0,Z.jsx)(R,{marginTop:1,children:(0,Z.jsx)(z,{dimColor:!0,italic:!0,children:(0,Z.jsxs)(B,{children:[e.scope!==`managed`&&(0,Z.jsx)(k,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`remove`}),(0,Z.jsx)(k,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]})})})]})}if(typeof y==`object`&&y.type===`mcp-detail`){let e=y.client,n=ue(u,e.name).length,r=()=>{b({type:`mcp-tools`,client:e})},i=()=>{b(`plugin-list`)},a=e=>{e&&t(e),b(`plugin-list`)},o=e.config.scope,s=e.config.type;return s===`stdio`?(0,Z.jsx)(Kt,{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)(Qt,{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)(Qt,{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)(Qt,{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}):(b(`plugin-list`),null)}if(typeof y==`object`&&y.type===`mcp-tools`){let e=y.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)($t,{server:r,onSelectTool:t=>{b({type:`mcp-tool-detail`,client:e,tool:t})},onBack:()=>b({type:`mcp-detail`,client:e})})}if(typeof y==`object`&&y.type===`mcp-tool-detail`){let{client:e,tool:t}=y,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)(Zt,{tool:t,server:i,onBack:()=>b({type:`mcp-tools`,client:e})})}let Fe=_e.getVisibleItems(N);return(0,Z.jsxs)(R,{flexDirection:`column`,children:[(0,Z.jsx)(R,{marginBottom:1,children:(0,Z.jsx)(Be,{query:x,isFocused:p,isTerminalFocused:_,width:v-4,cursorOffset:te})}),N.length===0&&x&&(0,Z.jsx)(R,{marginBottom:1,children:(0,Z.jsxs)(z,{dimColor:!0,children:[`No items match "`,x,`"`]})}),_e.scrollPosition.canScrollUp&&(0,Z.jsx)(R,{children:(0,Z.jsxs)(z,{dimColor:!0,children:[` `,a.arrowUp,` more above`]})}),Fe.map((e,t)=>{let n=_e.toActualIndex(t)===P&&!p,r=t>0?Fe[t-1]:null,i=!r||r.scope!==e.scope;return(0,Z.jsxs)($n.Fragment,{children:[i&&(0,Z.jsx)(R,{marginTop:+(t>0),paddingLeft:2,children:(0,Z.jsx)(z,{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)(Gn,{item:e,isSelected:n})]},e.id)}),_e.scrollPosition.canScrollDown&&(0,Z.jsx)(R,{children:(0,Z.jsxs)(z,{dimColor:!0,children:[` `,a.arrowDown,` more below`]})}),(0,Z.jsx)(R,{marginTop:1,marginLeft:1,children:(0,Z.jsx)(z,{dimColor:!0,italic:!0,children:(0,Z.jsxs)(B,{children:[(0,Z.jsx)(z,{children:`type to search`}),(0,Z.jsx)(k,{action:`plugin:toggle`,context:`Plugin`,fallback:`Space`,description:`toggle`}),(0,Z.jsx)(k,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`details`}),(0,Z.jsx)(k,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]})})}),A.size>0&&(0,Z.jsx)(R,{marginLeft:1,children:(0,Z.jsx)(z,{dimColor:!0,italic:!0,children:`Run /reload-plugins to apply changes`})})]})}var $n,X,Z,er=e((()=>{i(),$n=t(V(),1),X=t(V(),1),De(),We(),qt(),Xt(),Jt(),Yt(),Ut(),Gt(),ye(),l(),_(),Bt(),Ae(),Et(),_e(),nt(),me(),Qe(),et(),dt(),b(),v(),s(),o(),F(),Rt(),d(),x(),T(),C(),vt(),at(),Xe(),_t(),Wn(),fn(),_n(),Kn(),kn(),Z=qe()}));function tr(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 nr=e((()=>{}));function rr({onComplete:e,path:t}){return(0,ir.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 jt(t),r=``;r+=`Validating ${n.fileType} manifest: ${n.filePath}\n\n`,n.errors.length>0&&(r+=`${a.cross} Found ${n.errors.length} ${H(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} ${H(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,ft(t),e(`${a.cross} Unexpected error during validation: ${Ye(t)}`)}}n()},[e,t]),(0,ar.jsx)(R,{flexDirection:`column`,children:(0,ar.jsx)(z,{children:`Running validation...`})})}var ir,ar,or=e((()=>{i(),V(),ir=t(V(),1),We(),et(),dt(),Pt(),_t(),ar=qe()}));function sr({onComplete:e}){return(0,Q.useEffect)(()=>{async function t(){try{let t=await ce(),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: ${Ye(t)}`)}}t()},[e]),(0,$.jsx)(z,{children:`Loading marketplaces...`})}function cr(e){let t=[];for(let{source:n,scope:r}of[{source:`userSettings`,scope:`user`},{source:`projectSettings`,scope:`project`},{source:`localSettings`,scope:`local`}])rt(n)?.extraKnownMarketplaces?.[e]&&t.push({source:n,scope:r});return{editableSources:t,isInPolicy:!!rt(`policySettings`)?.extraKnownMarketplaces?.[e]}}function lr(e){let{editableSources:t,isInPolicy:n}=cr(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 ur(e){return{kind:`navigate`,tab:`installed`,viewState:{type:`manage-plugins`,targetPlugin:e,action:`uninstall`}}}function dr(e){return yr.has(e.type)}function fr(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 pr(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:Hn(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=lr(t.name),n=cr(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=lr(t),r=cr(t),i=r.isInPolicy?`managed`:r.editableSources[0]?.scope;s.push({label:t,message:Hn(e),guidance:n.kind===`managed-only`?`Managed by your organization — contact your admin`:Un(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=fr(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:Hn(e),guidance:Un(e),action:t?ur(t):{kind:`none`},scope:r})}for(let e of r)s.push({label:e.source,message:Hn(e),guidance:Un(e),action:{kind:`none`}});return s}function mr(e,t){for(let{source:n}of t){let t=rt(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&&st(n,r)}}function hr({setViewState:e,setActiveTab:t,markPluginsChanged:n}){let r=we(e=>e.plugins.errors),i=we(e=>e.plugins.installationStatus),o=P(),[s,c]=(0,Q.useState)(0),[l,u]=(0,Q.useState)(null),[d,f]=(0,Q.useState)([]);(0,Q.useEffect)(()=>{(async()=>{try{let{failures:e}=await je(await ce());f(e)}catch{}})()},[]);let p=i.marketplaces.filter(e=>e.status===`failed`),m=new Set(p.map(e=>e.name)),h=r.filter(dr),g=pr(p,r.filter(e=>(e.type===`marketplace-not-found`||e.type===`marketplace-load-failed`||e.type===`marketplace-blocked-by-policy`)&&!m.has(e.marketplace)),r.filter(e=>dr(e)||e.type===`marketplace-not-found`||e.type===`marketplace-load-failed`||e.type===`marketplace-blocked-by-policy`?!1:fr(e)!==void 0),r.filter(e=>dr(e)||e.type===`marketplace-not-found`||e.type===`marketplace-load-failed`||e.type===`marketplace-blocked-by-policy`?!1:fr(e)===void 0),d,h,yt());Ie(`confirm:no`,()=>{e({type:`menu`})},{context:`Confirmation`}),L({"select:previous":()=>c(e=>Math.max(0,e-1)),"select:next":()=>c(e=>Math.min(g.length-1,e+1)),"select:accept":()=>{let r=g[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(`, `);mr(i.name,i.sources),ke(),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)}}})),u(`${a.tick} Removed "${i.name}" from ${e} settings`),n();break}case`remove-installed-marketplace`:(async()=>{try{await ie(i.name),ke(),f(e=>e.filter(e=>e.name!==i.name)),u(`${a.tick} Removed marketplace "${i.name}"`),n()}catch(e){u(`Failed to remove "${i.name}": ${e instanceof Error?e.message:String(e)}`)}})();break;case`managed-only`:break;case`none`:break}}},{context:`Select`,isActive:g.length>0});let _=Math.min(s,Math.max(0,g.length-1));_!==s&&c(_);let v=g[_]?.action,y=v&&v.kind!==`none`&&v.kind!==`managed-only`;return g.length===0?(0,$.jsxs)(R,{flexDirection:`column`,children:[(0,$.jsx)(R,{marginLeft:1,children:(0,$.jsx)(z,{dimColor:!0,children:`No plugin errors`})}),(0,$.jsx)(R,{marginTop:1,children:(0,$.jsx)(z,{dimColor:!0,italic:!0,children:(0,$.jsx)(k,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})})})]}):(0,$.jsxs)(R,{flexDirection:`column`,children:[g.map((e,t)=>{let n=t===_;return(0,$.jsxs)(R,{marginLeft:1,flexDirection:`column`,marginBottom:1,children:[(0,$.jsxs)(z,{children:[(0,$.jsxs)(z,{color:n?`suggestion`:`error`,children:[n?a.pointer:a.cross,` `]}),(0,$.jsx)(z,{bold:n,children:e.label}),e.scope&&(0,$.jsxs)(z,{dimColor:!0,children:[` (`,e.scope,`)`]})]}),(0,$.jsx)(R,{marginLeft:3,children:(0,$.jsx)(z,{color:`error`,children:e.message})}),e.guidance&&(0,$.jsx)(R,{marginLeft:3,children:(0,$.jsx)(z,{dimColor:!0,italic:!0,children:e.guidance})})]},t)}),l&&(0,$.jsx)(R,{marginTop:1,marginLeft:1,children:(0,$.jsx)(z,{color:`claude`,children:l})}),(0,$.jsx)(R,{marginTop:1,children:(0,$.jsx)(z,{dimColor:!0,italic:!0,children:(0,$.jsxs)(B,{children:[(0,$.jsx)(k,{action:`select:previous`,context:`Select`,fallback:`↑`,description:`navigate`}),y&&(0,$.jsx)(k,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`resolve`}),(0,$.jsx)(k,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]})})})]})}function gr(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 _r(e){return e.type===`manage-plugins`?`installed`:e.type===`manage-marketplaces`?`marketplaces`:`discover`}function vr({onComplete:e,args:t}){let n=tr(t),r=gr(n),[i,a]=(0,Q.useState)(r),[o,s]=(0,Q.useState)(_r(r)),[c,l]=(0,Q.useState)(i.type===`add-marketplace`&&i.initialValue||``),[u,d]=(0,Q.useState)(0),[f,p]=(0,Q.useState)(null),[m,h]=(0,Q.useState)(null),[g,_]=(0,Q.useState)(!1),v=P(),y=we(e=>{let t=e.plugins.errors.length;for(let n of e.plugins.installationStatus.marketplaces)n.status===`failed`&&t++;return t}),b=y>0?`Errors (${y})`:`Errors`,x=Vt(),ee=n.type===`marketplace`&&n.action===`add`&&n.target!==void 0,te=(0,Q.useCallback)(()=>{v(e=>e.plugins.needsRefresh?e:{...e,plugins:{...e.plugins,needsRefresh:!0}})},[v]),S=(0,Q.useCallback)(e=>{let t=e;switch(s(t),p(null),t){case`discover`:a({type:`discover-plugins`});break;case`installed`:a({type:`manage-plugins`});break;case`marketplaces`:a({type:`manage-marketplaces`});break;case`errors`:break}},[]);return(0,Q.useEffect)(()=>{i.type===`menu`&&!m&&e()},[i.type,m,e]),(0,Q.useEffect)(()=>{i.type===`browse-marketplace`&&o!==`discover`&&s(`discover`)},[i.type,o]),Ie(`confirm:no`,(0,Q.useCallback)(()=>{s(`marketplaces`),a({type:`manage-marketplaces`}),l(``),p(null)},[]),{context:`Settings`,isActive:i.type===`add-marketplace`}),(0,Q.useEffect)(()=>{m&&e(m)},[m,e]),(0,Q.useEffect)(()=>{i.type===`help`&&e()},[i.type,e]),i.type===`help`?(0,$.jsxs)(R,{flexDirection:`column`,children:[(0,$.jsx)(z,{bold:!0,children:`Plugin Command Usage:`}),(0,$.jsx)(z,{children:` `}),(0,$.jsx)(z,{dimColor:!0,children:`Installation:`}),(0,$.jsx)(z,{children:` /plugin install - Browse and install plugins`}),(0,$.jsx)(z,{children:` /plugin install <marketplace> - Install from specific marketplace`}),(0,$.jsx)(z,{children:` /plugin install <plugin> - Install specific plugin`}),(0,$.jsx)(z,{children:` /plugin install <plugin>@<market> - Install plugin from marketplace`}),(0,$.jsx)(z,{children:` `}),(0,$.jsx)(z,{dimColor:!0,children:`Management:`}),(0,$.jsx)(z,{children:` /plugin manage - Manage installed plugins`}),(0,$.jsx)(z,{children:` /plugin enable <plugin> - Enable a plugin`}),(0,$.jsx)(z,{children:` /plugin disable <plugin> - Disable a plugin`}),(0,$.jsx)(z,{children:` /plugin uninstall <plugin> - Uninstall a plugin`}),(0,$.jsx)(z,{children:` `}),(0,$.jsx)(z,{dimColor:!0,children:`Marketplaces:`}),(0,$.jsx)(z,{children:` /plugin marketplace - Marketplace management menu`}),(0,$.jsx)(z,{children:` /plugin marketplace add - Add a marketplace`}),(0,$.jsx)(z,{children:` /plugin marketplace add <path/url> - Add marketplace directly`}),(0,$.jsx)(z,{children:` /plugin marketplace update - Update marketplaces`}),(0,$.jsx)(z,{children:` /plugin marketplace update <name> - Update specific marketplace`}),(0,$.jsx)(z,{children:` /plugin marketplace remove - Remove a marketplace`}),(0,$.jsx)(z,{children:` /plugin marketplace remove <name> - Remove specific marketplace`}),(0,$.jsx)(z,{children:` /plugin marketplace list - List all marketplaces`}),(0,$.jsx)(z,{children:` `}),(0,$.jsx)(z,{dimColor:!0,children:`Validation:`}),(0,$.jsx)(z,{children:` /plugin validate <path> - Validate a manifest file or directory`}),(0,$.jsx)(z,{children:` `}),(0,$.jsx)(z,{dimColor:!0,children:`Other:`}),(0,$.jsx)(z,{children:` /plugin - Main plugin menu`}),(0,$.jsx)(z,{children:` /plugin help - Show this help`}),(0,$.jsx)(z,{children:` /plugins - Alias for /plugin`})]}):i.type===`validate`?(0,$.jsx)(rr,{onComplete:e,path:i.path}):i.type===`marketplace-menu`?(a({type:`menu`}),null):i.type===`marketplace-list`?(0,$.jsx)(sr,{onComplete:e}):i.type===`add-marketplace`?(0,$.jsx)(an,{inputValue:c,setInputValue:l,cursorOffset:u,setCursorOffset:d,error:f,setError:p,result:m,setResult:h,setViewState:a,onAddComplete:te,cliMode:ee}):(0,$.jsx)(Ge,{color:`suggestion`,children:(0,$.jsxs)(Ue,{title:`Plugins`,selectedTab:o,onTabChange:S,color:`suggestion`,disableNavigation:g,children:[(0,$.jsx)(Ve,{id:`discover`,title:`Discover`,children:i.type===`browse-marketplace`?(0,$.jsx)(An,{error:f,setError:p,result:m,setResult:h,setViewState:a,onInstallComplete:te,targetMarketplace:i.targetMarketplace,targetPlugin:i.targetPlugin}):(0,$.jsx)(Nn,{error:f,setError:p,result:m,setResult:h,setViewState:a,onInstallComplete:te,onSearchModeChange:_,targetPlugin:i.type===`discover-plugins`?i.targetPlugin:void 0})}),(0,$.jsx)(Ve,{id:`installed`,title:`Installed`,children:(0,$.jsx)(Qn,{setViewState:a,setResult:h,onManageComplete:te,onSearchModeChange:_,targetPlugin:i.type===`manage-plugins`?i.targetPlugin:void 0,targetMarketplace:i.type===`manage-plugins`?i.targetMarketplace:void 0,action:i.type===`manage-plugins`?i.action:void 0})}),(0,$.jsx)(Ve,{id:`marketplaces`,title:`Marketplaces`,children:(0,$.jsx)(Rn,{setViewState:a,error:f,setError:p,setResult:h,exitState:x,onManageComplete:te,targetMarketplace:i.type===`manage-marketplaces`?i.targetMarketplace:void 0,action:i.type===`manage-marketplaces`?i.action:void 0})}),(0,$.jsx)(Ve,{id:`errors`,title:b,children:(0,$.jsx)(hr,{setViewState:a,setActiveTab:s,markPluginsChanged:te})})]})})}var Q,$,yr,br=e((()=>{i(),V(),Q=t(V(),1),De(),We(),Ht(),l(),_e(),et(),b(),re(),s(),vt(),at(),sn(),Mn(),Ln(),Vn(),er(),Wn(),nr(),or(),$=qe(),yr=new Set([`git-auth-failed`,`git-timeout`,`network-error`])}));async function xr(e,t,n){return(0,Sr.jsx)(vr,{onComplete:e,args:n})}var Sr;e((()=>{V(),br(),Sr=qe()}))();export{xr as call};
@@ -0,0 +1 @@
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{$o as t,Bo as n,GE as r,Ro as i,Uo as a,Yo as o,es as s,qE as c,rs as l}from"./loadAgentsDir-CKSb56Gp.js";import{F as u,a as d,l as f,z as p}from"./debug-BdqxZ7rV.js";import{vt as m,xt as h}from"./settings-Xbq6AaD-.js";import{b as g,h as _}from"./config-D4G8_MqJ.js";import{o as v,s as y}from"./log-CTFl4qpD.js";import{f as b,s as x}from"./pluginOperations-BTq4AjYB.js";function S(e){return O=e,k!==null&&k.length>0&&(e(k),k=null),()=>{O=null}}async function C(){let e=await s(),t=o(),n=new Set;for(let[r,i]of Object.entries(e)){let e=t[r]?.autoUpdate;(e===void 0?h(r,i):e)&&n.add(r.toLowerCase())}return n}async function w(e,t){let n=!1;for(let{scope:r}of t)try{let t=await b(e,r);t.success&&!t.alreadyUpToDate?(n=!0,f(`Plugin autoupdate: updated ${e} from ${t.oldVersion} to ${t.newVersion}`)):t.alreadyUpToDate||f(`Plugin autoupdate: failed to update ${e}: ${t.message}`,{level:`warn`})}catch(t){f(`Plugin autoupdate: error updating ${e}: ${u(t)}`,{level:`warn`})}return n?e:null}async function T(e){let t=a(),r=Object.keys(t.plugins);return r.length===0?[]:(await Promise.allSettled(r.map(async r=>{let{marketplace:i}=c(r);if(!i||!e.has(i.toLowerCase()))return null;let a=t.plugins[r];if(!a||a.length===0)return null;let o=a.filter(n);return o.length===0?null:w(r,o)}))).filter(e=>e.status===`fulfilled`&&e.value!==null).map(e=>e.value)}async function E(e){return T(e)}function D(){(async()=>{if(g()){f(`Plugin autoupdate: skipped (auto-updater disabled)`);return}try{let e=await C();if(e.size===0)return;let t=(await Promise.allSettled(Array.from(e).map(async e=>{try{await l(e,void 0,{disableCredentialHelper:!0})}catch(t){f(`Plugin autoupdate: failed to refresh marketplace ${e}: ${u(t)}`,{level:`warn`})}}))).filter(e=>e.status===`rejected`);t.length>0&&f(`Plugin autoupdate: ${t.length} marketplace refresh(es) failed`,{level:`warn`}),f(`Plugin autoupdate: checking installed plugins`);let n=await E(e);n.length>0&&(O?O(n):k=n)}catch(e){y(e)}})()}var O,k,A=e((()=>{x(),_(),d(),p(),v(),i(),t(),r(),m(),O=null,k=null}));export{T as i,A as n,S as r,D as t};
@@ -0,0 +1 @@
1
+ import{$o as e,Ro as t,Wo as n,Xo as r,ts as i}from"./loadAgentsDir-CKSb56Gp.js";import{F as a,a as o,l as s,z as c}from"./debug-BdqxZ7rV.js";import{d as l,s as u}from"./pluginOperations-BTq4AjYB.js";import{i as d,n as f,r as p,t as m}from"./pluginFlagging-CxuRF2Vc.js";u(),o(),c(),t(),e(),p();function h(e,t,n){let r=new Set(t.plugins.map(e=>e.name)),i=`@${n}`,a=[];for(let t of Object.keys(e.plugins)){if(!t.endsWith(i))continue;let e=t.slice(0,-i.length);r.has(e)||a.push(t)}return a}async function g(){await d();let e=n(),t=f(),o=await i(),c=[];for(let n of Object.keys(o))try{let i=await r(n);if(!i.forceRemoveDeletedPlugins)continue;let o=h(e,i,n);for(let n of o){if(n in t)continue;let r=e.plugins[n]??[];if(r.some(e=>e.scope===`user`||e.scope===`project`||e.scope===`local`)){for(let e of r){let{scope:t}=e;if(!(t!==`user`&&t!==`project`&&t!==`local`))try{await l(n,t)}catch(e){s(`Failed to auto-uninstall delisted plugin ${n} from ${t}: ${a(e)}`,{level:`error`})}}await m(n),c.push(n)}}}catch(e){s(`Failed to check for delisted plugins in "${n}": ${a(e)}`,{level:`warn`})}return c}export{g as t};
@@ -0,0 +1 @@
1
+ import{n as e,t}from"./figures-5ThXQEtq.js";import{GE as n,Gf as r,Io as i,Lo as a,Uf as o,Wf as s,ff as c,qE as l,uf as u}from"./loadAgentsDir-CKSb56Gp.js";import{F as d,z as f}from"./debug-BdqxZ7rV.js";import{n as p,o as m}from"./process-gEbdy6uY.js";import{o as h,s as g}from"./log-CTFl4qpD.js";import{n as _,r as v}from"./analytics-DJobLaWP.js";import{a as y,c as b,d as x,f as S,i as C,r as w,s as T}from"./pluginOperations-BTq4AjYB.js";e(),f(),c(),h(),a(),n(),p(),r(),_(),T();function E(e,n,r){g(e);let a=r?`${n} plugin "${r}"`:n===`disable-all`?`disable all plugins`:`${n} plugins`;console.error(`${t.cross} Failed to ${a}: ${d(e)}`);let c=r?(()=>{let{name:e,marketplace:t}=l(r);return{_PROTO_plugin_name:e,...t&&{_PROTO_marketplace_name:t},...o(e,t,i())}})():{};v(`tengu_plugin_command_failed`,{command:n,error_category:s(e),...c}),process.exit(1)}async function D(e,n=`user`){try{console.log(`Installing plugin "${e}"...`);let r=await b(e,n);if(!r.success)throw Error(r.message);console.log(`${t.tick} ${r.message}`);let{name:a,marketplace:s}=l(r.pluginId||e);v(`tengu_plugin_installed_cli`,{_PROTO_plugin_name:a,...s&&{_PROTO_marketplace_name:s},scope:r.scope||n,install_source:`cli-explicit`,...o(a,s,i())}),process.exit(0)}catch(t){E(t,`install`,e)}}async function O(e,n=`user`,r=!1){try{let a=await x(e,n,!r);if(!a.success)throw Error(a.message);console.log(`${t.tick} ${a.message}`);let{name:s,marketplace:c}=l(a.pluginId||e);v(`tengu_plugin_uninstalled_cli`,{_PROTO_plugin_name:s,...c&&{_PROTO_marketplace_name:c},scope:a.scope||n,...o(s,c,i())}),process.exit(0)}catch(t){E(t,`uninstall`,e)}}async function k(e,n){try{let r=await y(e,n);if(!r.success)throw Error(r.message);console.log(`${t.tick} ${r.message}`);let{name:a,marketplace:s}=l(r.pluginId||e);v(`tengu_plugin_enabled_cli`,{_PROTO_plugin_name:a,...s&&{_PROTO_marketplace_name:s},scope:r.scope,...o(a,s,i())}),process.exit(0)}catch(t){E(t,`enable`,e)}}async function A(e,n){try{let r=await C(e,n);if(!r.success)throw Error(r.message);console.log(`${t.tick} ${r.message}`);let{name:a,marketplace:s}=l(r.pluginId||e);v(`tengu_plugin_disabled_cli`,{_PROTO_plugin_name:a,...s&&{_PROTO_marketplace_name:s},scope:r.scope,...o(a,s,i())}),process.exit(0)}catch(t){E(t,`disable`,e)}}async function j(){try{let e=await w();if(!e.success)throw Error(e.message);console.log(`${t.tick} ${e.message}`),v(`tengu_plugin_disabled_all_cli`,{}),process.exit(0)}catch(e){E(e,`disable-all`)}}async function M(e,n){try{m(`Checking for updates for plugin "${e}" at ${n} scope…\n`);let r=await S(e,n);if(!r.success)throw Error(r.message);if(m(`${t.tick} ${r.message}\n`),!r.alreadyUpToDate){let{name:t,marketplace:n}=l(r.pluginId||e);v(`tengu_plugin_updated_cli`,{_PROTO_plugin_name:t,...n&&{_PROTO_marketplace_name:n},old_version:r.oldVersion||`unknown`,new_version:r.newVersion||`unknown`,...o(t,n,i())})}await u(0)}catch(t){E(t,`update`,e)}}export{O as a,D as i,A as n,M as o,k as r,j as t};
@@ -1 +1 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{bE as t,yE as n}from"./loadAgentsDir-ByO8eJqU.js";import{C as r,S as i,a,d as o,l as s,p as c,w as l}from"./debug-RZ4NuXyS.js";import{o as u,s as d}from"./log-CZ0zYP_c.js";import{join as f}from"path";import{randomBytes as p}from"crypto";import{readFile as m,rename as h,unlink as g,writeFile as _}from"fs/promises";function v(){return f(n(),D)}function y(e){let t=r(e);if(typeof t!=`object`||!t||!(`plugins`in t)||typeof t.plugins!=`object`||t.plugins===null)return{};let n=t.plugins,i={};for(let[e,t]of Object.entries(n))if(t&&typeof t==`object`&&`flaggedAt`in t&&typeof t.flaggedAt==`string`){let n={flaggedAt:t.flaggedAt};`seenAt`in t&&typeof t.seenAt==`string`&&(n.seenAt=t.seenAt),i[e]=n}return i}async function b(){try{return y(await m(v(),{encoding:`utf-8`}))}catch{return{}}}async function x(e){let t=v(),r=`${t}.${p(8).toString(`hex`)}.tmp`;try{await o().mkdir(n()),await _(r,l({plugins:e},null,2),{encoding:`utf-8`,mode:384}),await h(r,t),k=e}catch(e){d(e);try{await g(r)}catch{}}}async function S(){let e=await b(),t=Date.now(),n=!1;for(let[r,i]of Object.entries(e))i.seenAt&&t-new Date(i.seenAt).getTime()>=O&&(delete e[r],n=!0);k=e,n&&await x(e)}function C(){return k??{}}async function w(e){k===null&&(k=await b()),await x({...k,[e]:{flaggedAt:new Date().toISOString()}}),s(`Flagged plugin: ${e}`)}async function T(e){k===null&&(k=await b());let t=new Date().toISOString(),n=!1,r={...k};for(let i of e){let e=r[i];e&&!e.seenAt&&(r[i]={...e,seenAt:t},n=!0)}n&&await x(r)}async function E(e){if(k===null&&(k=await b()),!(e in k))return;let{[e]:t,...n}=k;k=n,await x(n)}var D,O,k,A=e((()=>{a(),c(),u(),i(),t(),D=`flagged-plugins.json`,O=2880*60*1e3,k=null}));export{T as a,S as i,C as n,E as o,A as r,w as t};
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{nE as t,rE as n}from"./loadAgentsDir-CKSb56Gp.js";import{C as r,S as i,a,d as o,l as s,p as c,w as l}from"./debug-BdqxZ7rV.js";import{o as u,s as d}from"./log-CTFl4qpD.js";import{join as f}from"path";import{randomBytes as p}from"crypto";import{readFile as m,rename as h,unlink as g,writeFile as _}from"fs/promises";function v(){return f(t(),D)}function y(e){let t=r(e);if(typeof t!=`object`||!t||!(`plugins`in t)||typeof t.plugins!=`object`||t.plugins===null)return{};let n=t.plugins,i={};for(let[e,t]of Object.entries(n))if(t&&typeof t==`object`&&`flaggedAt`in t&&typeof t.flaggedAt==`string`){let n={flaggedAt:t.flaggedAt};`seenAt`in t&&typeof t.seenAt==`string`&&(n.seenAt=t.seenAt),i[e]=n}return i}async function b(){try{return y(await m(v(),{encoding:`utf-8`}))}catch{return{}}}async function x(e){let n=v(),r=`${n}.${p(8).toString(`hex`)}.tmp`;try{await o().mkdir(t()),await _(r,l({plugins:e},null,2),{encoding:`utf-8`,mode:384}),await h(r,n),k=e}catch(e){d(e);try{await g(r)}catch{}}}async function S(){let e=await b(),t=Date.now(),n=!1;for(let[r,i]of Object.entries(e))i.seenAt&&t-new Date(i.seenAt).getTime()>=O&&(delete e[r],n=!0);k=e,n&&await x(e)}function C(){return k??{}}async function w(e){k===null&&(k=await b()),await x({...k,[e]:{flaggedAt:new Date().toISOString()}}),s(`Flagged plugin: ${e}`)}async function T(e){k===null&&(k=await b());let t=new Date().toISOString(),n=!1,r={...k};for(let i of e){let e=r[i];e&&!e.seenAt&&(r[i]={...e,seenAt:t},n=!0)}n&&await x(r)}async function E(e){if(k===null&&(k=await b()),!(e in k))return;let{[e]:t,...n}=k;k=n,await x(n)}var D,O,k,A=e((()=>{a(),c(),u(),i(),n(),D=`flagged-plugins.json`,O=2880*60*1e3,k=null}));export{T as a,S as i,C as n,E as o,A as r,w as t};
@@ -0,0 +1,2 @@
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{$E as t,$T as n,$o as r,Ao as i,Co as a,Cs as o,Eo as s,Fo as c,GE as l,Go as u,HE as d,Hv as f,JC as p,JE as m,Ko as h,No as g,Oo as _,Po as v,QE as y,Qo as b,Ro as x,So as S,Ss as C,To as w,UE as T,Uo as E,Vv as D,WE as O,Wo as k,XC as ee,Xo as te,bo as ne,es as A,jo as j,qE as M,rE as re,wo as ie,xs as N}from"./loadAgentsDir-CKSb56Gp.js";import{Kt as ae,tt as P}from"./state-Bs5xweDL.js";import{V as F,W as oe,d as se,p as ce,z as I}from"./debug-BdqxZ7rV.js";import{c as L,g as R,x as z}from"./settings-Xbq6AaD-.js";import{o as B,s as V}from"./log-CTFl4qpD.js";import{l as H,o as U}from"./stringUtils-CbS6OkmE.js";import{n as W,t as G}from"./pluginStartupCheck-B6leNWq9.js";import{dirname as le,join as K}from"path";function q(e){if(!Q.includes(e))throw Error(`Invalid scope "${e}". Must be one of: ${Q.join(`, `)}`)}function ue(e){return Q.includes(e)}function J(e){return e===`project`||e===`local`?P():void 0}function de(e){return L(`projectSettings`)?.enabledPlugins?.[e]===!0}function fe(e){let t=e.includes(`@`);for(let n of[`local`,`project`,`user`]){let r=L(m(n))?.enabledPlugins;if(r){for(let i of Object.keys(r))if(t?i===e:i.startsWith(`${e}@`))return{pluginId:i,scope:n}}}return null}function pe(e,t){let{name:n,marketplace:r}=M(e);return t.find(t=>t.name===e||t.name===n?!0:r&&t.source?t.name===n&&t.source.includes(`@${r}`):!1)}function me(e){let{name:t}=M(e),n=k();if(n.plugins[e]?.length)return{pluginId:e,pluginName:t};let r=Object.keys(n.plugins).find(e=>{let{name:r}=M(e);return r===t&&(n.plugins[e]?.length??0)>0});return r?{pluginId:r,pluginName:t}:null}function Y(e){let t=k().plugins[e];if(!t||t.length===0)return{scope:`user`};let n=P(),r=t.find(e=>e.scope===`local`&&e.projectPath===n);if(r)return{scope:r.scope,projectPath:r.projectPath};let i=t.find(e=>e.scope===`project`&&e.projectPath===n);if(i)return{scope:i.scope,projectPath:i.projectPath};let a=t.find(e=>e.scope===`user`);return a?{scope:a.scope}:{scope:t[0].scope,projectPath:t[0].projectPath}}async function he(e,t=`user`){q(t);let{name:n,marketplace:r}=M(e),a,o,s;if(r){let t=await b(e);t&&(a=t.entry,o=r,s=t.marketplaceInstallLocation)}else{let e=await A();for(let[t,r]of Object.entries(e))try{let e=(await te(t)).plugins.find(e=>e.name===n);if(e){a=e,o=t,s=r.installLocation;break}}catch(e){V(oe(e))}}if(!a||!o)return{success:!1,message:`Plugin "${n}" not found in ${r?`marketplace "${r}"`:`any configured marketplace`}`};let c=a,l=`${c.name}@${o}`,u=await g({pluginId:l,entry:c,scope:t,marketplaceInstallLocation:s});if(!u.ok){let e=u;switch(e.reason){case`local-source-no-location`:return{success:!1,message:`Cannot install local plugin "${e.pluginName}" without marketplace install location`};case`settings-write-failed`:return{success:!1,message:`Failed to update settings: ${e.message}`};case`resolution-failed`:return{success:!1,message:i(e.resolution)};case`blocked-by-policy`:return{success:!1,message:`Plugin "${e.pluginName}" is blocked by your organization's policy and cannot be installed`};case`dependency-blocked-by-policy`:return{success:!1,message:`Plugin "${e.pluginName}" depends on "${e.blockedDependency}", which is blocked by your organization's policy`}}}return{success:!0,message:`Successfully installed plugin: ${l} (scope: ${t})${u.depNote}`,pluginId:l,pluginName:c.name,scope:t}}async function ge(e,t=`user`,r=!0){q(t);let{enabled:i,disabled:a}=await s(),c=[...i,...a],l=pe(e,c),f=m(t),h=L(f),g,_;if(l)g=Object.keys(h?.enabledPlugins??{}).find(t=>t===e||t===l.name||t.startsWith(`${l.name}@`))??(e.includes(`@`)?e:l.name),_=l.name;else{let t=me(e);if(!t)return{success:!1,message:`Plugin "${e}" not found in installed plugins`};g=t.pluginId,_=t.pluginName}let v=J(t),y=k().plugins[g],b=y?.find(e=>e.scope===t&&e.projectPath===v);if(!b){let{scope:n}=Y(g);return n!==t&&y&&y.length>0?n===`project`?{success:!1,message:`Plugin "${e}" is enabled at project scope (.claude/settings.json, shared with your team). To disable just for you: claude plugin disable ${e} --scope local`}:{success:!1,message:`Plugin "${e}" is installed in ${n} scope, not ${t}. Use --scope ${n} to uninstall.`}:{success:!1,message:`Plugin "${e}" is not installed in ${t} scope. Use --scope to specify the correct scope.`}}let x=b.installPath,S={...h?.enabledPlugins};S[g]=void 0,z(f,{enabledPlugins:S}),N(),u(g,t,v);let C=k().plugins[g],w=!C||C.length===0;w&&x&&await o(x),w&&(p(g),r&&await n(g));let E=d(g,c),D=T(E);return{success:!0,message:`Successfully uninstalled plugin: ${_} (scope: ${t})${D}`,pluginId:g,pluginName:_,scope:t,reverseDependents:E.length>0?E:void 0}}async function X(e,n,r){let i=n?`enable`:`disable`;if(t(e)){let{error:t}=z(`userSettings`,{enabledPlugins:{...L(`userSettings`)?.enabledPlugins,[e]:n}});if(t)return{success:!1,message:`Failed to ${i} built-in plugin: ${t.message}`};N();let{name:r}=M(e);return{success:!0,message:`Successfully ${i}d built-in plugin: ${r}`,pluginId:e,pluginName:r,scope:`user`}}r&&q(r);let a,o,c=fe(e);if(r)if(o=r,c)a=c.pluginId;else if(e.includes(`@`))a=e;else return{success:!1,message:`Plugin "${e}" not found in settings. Use plugin@marketplace format.`};else if(c)a=c.pluginId,o=c.scope;else if(e.includes(`@`))a=e,o=`user`;else return{success:!1,message:`Plugin "${e}" not found in any editable settings scope. Use plugin@marketplace format.`};if(n&&f(a))return{success:!1,message:`Plugin "${a}" is blocked by your organization's policy and cannot be enabled`};let l=m(o),u=L(l)?.enabledPlugins?.[a],p={user:0,project:1,local:2},h=r&&c&&p[r]>p[c.scope];if(r&&u===void 0&&c&&c.scope!==r&&!h)return{success:!1,message:`Plugin "${e}" is installed at ${c.scope} scope, not ${r}. Use --scope ${c.scope} or omit --scope to auto-detect.`};if(n===(r&&!h?u===!0:G().has(a)))return{success:!1,message:`Plugin "${e}" is already ${n?`enabled`:`disabled`}${r?` at ${r} scope`:``}`};let g;if(!n){let{enabled:e,disabled:t}=await s(),n=d(a,[...e,...t]);n.length>0&&(g=n)}let{error:_}=z(l,{enabledPlugins:{...L(l)?.enabledPlugins,[a]:n}});if(_)return{success:!1,message:`Failed to ${i} plugin: ${_.message}`};N();let{name:v}=M(a),y=T(g);return{success:!0,message:`Successfully ${i}d plugin: ${v} (scope: ${o})${y}`,pluginId:a,pluginName:v,scope:o,reverseDependents:g}}async function _e(e,t){return X(e,!0,t)}async function ve(e,t){return X(e,!1,t)}async function Z(){let e=G();if(e.size===0)return{success:!0,message:`No enabled plugins to disable`};let t=[],n=[];for(let[r]of e){let e=await X(r,!1);e.success?t.push(r):n.push(`${r}: ${e.message}`)}return n.length>0?{success:!1,message:`Disabled ${t.length} ${H(t.length,`plugin`)}, ${n.length} failed:\n${n.join(`
2
+ `)}`}:{success:!0,message:`Disabled ${t.length} ${H(t.length,`plugin`)}`}}async function ye(e,t){let{name:n,marketplace:r}=M(e),i=r?`${n}@${r}`:e,a=await b(e);if(!a)return{success:!1,message:`Plugin "${n}" not found`,pluginId:i,scope:t};let{entry:o,marketplaceInstallLocation:s}=a,c=E().plugins[i];if(!c||c.length===0)return{success:!1,message:`Plugin "${n}" is not installed`,pluginId:i,scope:t};let l=J(t),u=c.find(e=>e.scope===t&&e.projectPath===l);return u?be({pluginId:i,pluginName:n,entry:o,marketplaceInstallLocation:s,installation:u,scope:t,projectPath:l}):{success:!1,message:`Plugin "${n}" is not installed at scope ${l?`${t} (${l})`:t}`,pluginId:i,scope:t}}async function be({pluginId:e,pluginName:t,entry:n,marketplaceInstallLocation:r,installation:i,scope:s,projectPath:c}){let l=se(),u=i.version,d,f,p=!1,m;if(typeof n.source!=`string`){let t=await ne(n.source,{manifest:{name:n.name}});d=t.path,p=!0,m=t.gitCommitSha,f=await v(e,n.source,t.manifest,t.path,n.version,t.gitCommitSha)}else{let t;try{t=await l.stat(r)}catch(t){if(F(t))return{success:!1,message:`Marketplace directory not found at ${r}`,pluginId:e,scope:s};throw t}d=K(t.isDirectory()?r:le(r),n.source);try{await l.stat(d)}catch(t){if(F(t))return{success:!1,message:`Plugin source not found at ${d}`,pluginId:e,scope:s};throw t}let i,a=K(d,`.claude-plugin`,`plugin.json`);try{i=await _(a,n.name,n.source)}catch{}f=await v(e,n.source,i,d,n.version)}try{let r=a(e,f),l=ie(e,f);if(i.version===f||i.installPath===r||i.installPath===l)return{success:!0,message:`${t} is already at the latest version (${f}).`,pluginId:e,newVersion:f,oldVersion:u,alreadyUpToDate:!0,scope:s};r=await S(d,e,f,n);let p=i.installPath;if(h(e,s,c,r,f,m),p&&p!==r){let e=E();Object.values(e.plugins).some(e=>e.some(e=>e.installPath===p))||await o(p)}let g=c?`${s} (${c})`:s;return{success:!0,message:`Plugin "${t}" updated from ${u||`unknown`} to ${f} for scope ${g}. Restart to apply changes.`,pluginId:e,newVersion:f,oldVersion:u,scope:s}}finally{p&&d!==a(e,f)&&await l.rm(d,{recursive:!0,force:!0})}}var Q,$,xe=e((()=>{ae(),y(),I(),ce(),B(),C(),O(),x(),r(),re(),l(),j(),w(),ee(),D(),W(),c(),R(),U(),Q=[`user`,`project`,`local`],$=[`user`,`project`,`local`,`managed`]}));export{_e as a,he as c,ge as d,ye as f,ve as i,ue as l,$ as n,Y as o,Z as r,xe as s,Q as t,de as u};