@readmagic/workmate 0.0.27 → 0.0.29

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 (255) hide show
  1. package/dist/chunks/{AddWorkspaceDirectory-DqlPtsVK.js → AddWorkspaceDirectory-C0lrhffT.js} +1 -1
  2. package/dist/chunks/AgentsMdExternalIncludesDialog-DIahWLha.js +1 -0
  3. package/dist/chunks/{AgentsMdExternalIncludesDialog-rJS5l6yk.js → AgentsMdExternalIncludesDialog-Dmjjx4ql.js} +1 -1
  4. package/dist/chunks/App-COz7knHS.js +1 -0
  5. package/dist/chunks/{BackgroundTasksDialog-CBhSmdz_.js → BackgroundTasksDialog-5IkCQ8lN.js} +2 -2
  6. package/dist/chunks/{BypassPermissionsModeDialog-zz-lnmJt.js → BypassPermissionsModeDialog-g1FMGfQF.js} +1 -1
  7. package/dist/chunks/{CustomSelect-CYmc4vRh.js → CustomSelect-BsEd2To5.js} +1 -1
  8. package/dist/chunks/{DiffDialog-CTUIAcEE.js → DiffDialog-Cwf8CdxZ.js} +5 -5
  9. package/dist/chunks/Doctor-CcLoI7tF.js +1 -0
  10. package/dist/chunks/Doctor-GmT5aeAc.js +3 -0
  11. package/dist/chunks/ExitFlow-DPgUFqeC.js +2 -0
  12. package/dist/chunks/{InvalidConfigDialog-B-9Z58oD.js → InvalidConfigDialog-Di6HZYDV.js} +1 -1
  13. package/dist/chunks/{InvalidSettingsDialog-B4EWjbp7.js → InvalidSettingsDialog-BHL-MERJ.js} +1 -1
  14. package/dist/chunks/{KeybindingProviderSetup-Dzg77_Xn.js → KeybindingProviderSetup-eE3o0bfp.js} +1 -1
  15. package/dist/chunks/MCPConnectionManager-D-qpUJLV.js +1 -0
  16. package/dist/chunks/MCPToolListView-DtHRw4jQ.js +1 -0
  17. package/dist/chunks/{McpParsingWarnings-Dj_Fu5o-.js → McpParsingWarnings-ByyErvR3.js} +1 -1
  18. package/dist/chunks/MessageSelector-CFz30wBL.js +3 -0
  19. package/dist/chunks/Messages-CfY-Oj3M.js +10 -0
  20. package/dist/chunks/{Onboarding-BRSXxc2E.js → Onboarding-BfWLRx3n.js} +1 -1
  21. package/dist/chunks/{PromptInputFooterSuggestions-ChpyD9B7.js → PromptInputFooterSuggestions-BRyJj7XR.js} +1 -1
  22. package/dist/chunks/{PromptInputHelpMenu-CrTT8MKE.js → PromptInputHelpMenu-DLuRCXVS.js} +1 -1
  23. package/dist/chunks/{ProviderSetup-BEV95bnz.js → ProviderSetup-CKZGG2B9.js} +1 -1
  24. package/dist/chunks/QueryEngine-B27MOtBA.js +1 -0
  25. package/dist/chunks/{REPL-BDnZnm__.js → REPL-DMRD5wSN.js} +23 -23
  26. package/dist/chunks/REPL-gzolQvzu.js +1 -0
  27. package/dist/chunks/ResumeConversation-7eURPHmQ.js +1 -0
  28. package/dist/chunks/SearchExtraToolsTool-BINZTstr.js +1 -0
  29. package/dist/chunks/Settings-4TNYpfUs.js +2 -0
  30. package/dist/chunks/Spinner-BgjmQLjw.js +1 -0
  31. package/dist/chunks/{TextInput-ZKU-x_FD.js → TextInput-BVEWdRz9.js} +5 -5
  32. package/dist/chunks/{ThemePicker-B69oDgXN.js → ThemePicker-th2jdUjh.js} +1 -1
  33. package/dist/chunks/{TrustDialog-BSG8Ibh8.js → TrustDialog-YsYqHyRR.js} +1 -1
  34. package/dist/chunks/{ValidationErrorsList-BUYHEft4.js → ValidationErrorsList-CKeHoN2Z.js} +1 -1
  35. package/dist/chunks/{_baseEach-P0u1zIx6.js → _baseEach-Bz5fQbIq.js} +1 -1
  36. package/dist/chunks/{add-dir-C8RmmyQK.js → add-dir-BsO6l8Ue.js} +1 -1
  37. package/dist/chunks/{agentDisplay-np7CH47m.js → agentDisplay-ChkgiTIH.js} +1 -1
  38. package/dist/chunks/{agents-DedoH0Q4.js → agents-BV1nan6b.js} +6 -6
  39. package/dist/chunks/{agents-DRQlR5M1.js → agents-DqEB6iwV.js} +1 -1
  40. package/dist/chunks/allErrors-CkdguCDv.js +1 -0
  41. package/dist/chunks/{appleTerminalBackup-Bemd4RXh.js → appleTerminalBackup-CN8kS74J.js} +1 -1
  42. package/dist/chunks/{backgroundHousekeeping-BtEJ6TeC.js → backgroundHousekeeping-1VsWy8xd.js} +1 -1
  43. package/dist/chunks/backgroundHousekeeping-pMtrl4K2.js +1 -0
  44. package/dist/chunks/{banner-CuoceXzz.js → banner-BKOzHotb.js} +1 -1
  45. package/dist/chunks/{branch-ClhlS7f8.js → branch-CTIHtpwz.js} +2 -2
  46. package/dist/chunks/bridgeControl-C8xaGuwO.js +2 -0
  47. package/dist/chunks/{btw-B-FLxlx-.js → btw-BA39Zrhm.js} +1 -1
  48. package/dist/chunks/caches-DHZHqVhf.js +1 -0
  49. package/dist/chunks/caches-fqs-Y-kW.js +1 -0
  50. package/dist/chunks/channel-B5FkNSZ3.js +1 -0
  51. package/dist/chunks/channel-C5yKM1wf.js +1 -0
  52. package/dist/chunks/{clear-BnWv0i65.js → clear-BmlaYYrD.js} +1 -1
  53. package/dist/chunks/commands-EUcHifS4.js +1 -0
  54. package/dist/chunks/compact-D3uePeI7.js +2 -0
  55. package/dist/chunks/{config-BDn2YIjC.js → config-Bio2EjUK.js} +1 -1
  56. package/dist/chunks/config-C_AEhZrn.js +1 -0
  57. package/dist/chunks/config-GgGdlJ9h.js +1 -0
  58. package/dist/chunks/{context-BvDBAyJ9.js → context-CBEWyVpE.js} +1 -1
  59. package/dist/chunks/{context-noninteractive-CuHHniJn.js → context-noninteractive-B03nuxfN.js} +2 -2
  60. package/dist/chunks/context-noninteractive-BLCyyyGL.js +1 -0
  61. package/dist/chunks/conversation-BFL0rEIx.js +1 -0
  62. package/dist/chunks/conversation-D-ker4RO.js +1 -0
  63. package/dist/chunks/{conversationRecovery-NL05oJb1.js → conversationRecovery-Bt84CYO6.js} +1 -1
  64. package/dist/chunks/crossProjectResume-DwlYY6lV.js +40 -0
  65. package/dist/chunks/{diff--6gQCx_x.js → diff-CewYzu3Y.js} +1 -1
  66. package/dist/chunks/doctor-CrQ0UfG2.js +1 -0
  67. package/dist/chunks/{entry-DWYOrkFS.js → entry-DdVUdGWV.js} +3 -3
  68. package/dist/chunks/exit-QwCo2aJo.js +1 -0
  69. package/dist/chunks/{extraUsage-Dr0YXm1w.js → extraUsage-Cu0aV35i.js} +1 -1
  70. package/dist/chunks/extractMemories-DHlbRc5g.js +1 -0
  71. package/dist/chunks/{fast-C5-lNCQi.js → fast-BlhpCQ2f.js} +1 -1
  72. package/dist/chunks/fast-C3JeBy3A.js +1 -0
  73. package/dist/chunks/{fetchModelList-9w1E4Ue8.js → fetchModelList-DjFCMjVN.js} +1 -1
  74. package/dist/chunks/fetchModelList-L2XarfAj.js +1 -0
  75. package/dist/chunks/{fileSuggestions-BYD78vcF.js → fileSuggestions-BRwKV_KA.js} +2 -2
  76. package/dist/chunks/{gemini-BNBptTET.js → gemini-I-M5_sUA.js} +2 -2
  77. package/dist/chunks/{generateSessionName-CO2484aJ.js → generateSessionName-CJ0sh6HD.js} +1 -1
  78. package/dist/chunks/{goal-j0wdadwM.js → goal-DIrBBT5J.js} +3 -3
  79. package/dist/chunks/{grok-BpO1ZwK_.js → grok-ZLjJN6b9.js} +1 -1
  80. package/dist/chunks/{help-DwhA0qQ6.js → help-CDMjVOl6.js} +1 -1
  81. package/dist/chunks/{hooks-DG4_WdZ2.js → hooks-BNKCE023.js} +2 -2
  82. package/dist/chunks/hooks-ERYtmuNW.js +1 -0
  83. package/dist/chunks/{install-BbmCNCuM.js → install-xlfTw1j6.js} +1 -1
  84. package/dist/chunks/{instrumentation-DpPmDyNF.js → instrumentation-DSt0UvGn.js} +3 -3
  85. package/dist/chunks/{job-GcmX1ALd.js → job-BVElGsu0.js} +1 -1
  86. package/dist/chunks/{launchLocalMemory-CDgT5lst.js → launchLocalMemory-DUkJCKmd.js} +2 -2
  87. package/dist/chunks/{launchOnboarding-uQ_ux9sS.js → launchOnboarding-BvD-E_jC.js} +1 -1
  88. package/dist/chunks/loadAgentsDir-BImZsKrh.js +1 -0
  89. package/dist/chunks/{loadAgentsDir-uuZYOgKn.js → loadAgentsDir-BfLCckVj.js} +343 -343
  90. package/dist/chunks/loadPluginHooks-BPwWtBzO.js +1 -0
  91. package/dist/chunks/{localSearch-yVCDrVrf.js → localSearch-BHG8sp8p.js} +1 -1
  92. package/dist/chunks/localSearch-D3rvcRRC.js +1 -0
  93. package/dist/chunks/{logoUtils-B4wCDKs9.js → logoUtils-BsNLv-qi.js} +1 -1
  94. package/dist/chunks/{magicDocs-D53lV8b5.js → magicDocs-Bue9vxzY.js} +2 -2
  95. package/dist/chunks/{main-fy_XSXGj.js → main-U71X4Thd.js} +22 -22
  96. package/dist/chunks/managedEnv-DCGLDTP_.js +1 -0
  97. package/dist/chunks/{managedEnv-B8YWmM4A.js → managedEnv-EZ2IirNa.js} +1 -1
  98. package/dist/chunks/{mcp-CZUVaPb3.js → mcp-C4CxCMwJ.js} +3 -3
  99. package/dist/chunks/mcp-D9HFARDy.js +1 -0
  100. package/dist/chunks/mcp-De3QGKvT.js +2 -0
  101. package/dist/chunks/memory-DVRdJFfI.js +1 -0
  102. package/dist/chunks/{mode-Bteqe2QG.js → mode-Bd5w-RBX.js} +2 -2
  103. package/dist/chunks/{model-CHDU5yqH.js → model-BCIcUhrc.js} +1 -1
  104. package/dist/chunks/{model-CcHyMyBv.js → model-BIf2i1is.js} +1 -1
  105. package/dist/chunks/{modelOptions-CJV1R3Jt.js → modelOptions-COIU5U3w.js} +1 -1
  106. package/dist/chunks/{nativeInstaller-CIUYh1aD.js → nativeInstaller-CGSNzGNn.js} +1 -1
  107. package/dist/chunks/{notifications-GLnjirCl.js → notifications-B5gzCmPC.js} +1 -1
  108. package/dist/chunks/{onChangeAppState-CxGW2d-l.js → onChangeAppState-NWwSE-I4.js} +1 -1
  109. package/dist/chunks/{openai-BpGQT2Iv.js → openai-CyJ3m4dI.js} +2 -2
  110. package/dist/chunks/{overlayContext-7wgLio1O.js → overlayContext-DYrGDe63.js} +1 -1
  111. package/dist/chunks/{partition-djFY9gGI.js → partition-BavNaw1S.js} +1 -1
  112. package/dist/chunks/permissions-CLYcBXIu.js +3 -0
  113. package/dist/chunks/{pidLock-CFUBtZck.js → pidLock-Bao7SU6Z.js} +2 -2
  114. package/dist/chunks/{plan-DI0n7LIV.js → plan-Dwj_ZX8G.js} +1 -1
  115. package/dist/chunks/plugin-Cscvf8st.js +17 -0
  116. package/dist/chunks/{pluginAutoupdate-CNrHb4RJ.js → pluginAutoupdate-D5XyiZrP.js} +1 -1
  117. package/dist/chunks/pluginBlocklist-CpkjXXKQ.js +1 -0
  118. package/dist/chunks/pluginCliCommands-DmLsxs1M.js +1 -0
  119. package/dist/chunks/{pluginFlagging-CUvkKGOB.js → pluginFlagging-CRuX6sHR.js} +1 -1
  120. package/dist/chunks/pluginOperations-orq3bOCp.js +2 -0
  121. package/dist/chunks/{pluginStartupCheck-DftTiXct.js → pluginStartupCheck-DGDl1WOZ.js} +1 -1
  122. package/dist/chunks/pluginStartupCheck-GHO77nmg.js +1 -0
  123. package/dist/chunks/plugins-Cq5c-Qs1.js +4 -0
  124. package/dist/chunks/{print-DSHypGJa.js → print-zo7Z--Ll.js} +9 -9
  125. package/dist/chunks/processBashCommand-C7oVqf0B.js +1 -0
  126. package/dist/chunks/processSlashCommand-CPQB5_0w.js +5 -0
  127. package/dist/chunks/{projectOnboardingState-nTCycGCD.js → projectOnboardingState-D-_ijZnG.js} +1 -1
  128. package/dist/chunks/prompt-CAzFDybL.js +1 -0
  129. package/dist/chunks/prompt-Cm8SKZXY.js +1 -0
  130. package/dist/chunks/{prompt-BfXryFt-.js → prompt-DaYH88Oe.js} +1 -1
  131. package/dist/chunks/{protocolHandler-VigBkAQQ.js → protocolHandler-CJO3CRYW.js} +1 -1
  132. package/dist/chunks/{reconciler-B9XFdL4f.js → reconciler-B5Kr4do0.js} +1 -1
  133. package/dist/chunks/refresh-DurNMJeS.js +1 -0
  134. package/dist/chunks/{reject-CBxnwckZ.js → reject-CzjtO3fU.js} +1 -1
  135. package/dist/chunks/{reload-plugins-5eFWrQlL.js → reload-plugins-C38i_Eb3.js} +1 -1
  136. package/dist/chunks/rename-BV-3ZpFx.js +1 -0
  137. package/dist/chunks/{resume-U2D0ybfU.js → resume-CUzQIor4.js} +2 -2
  138. package/dist/chunks/{runtimeObserver-CWaYMJG8.js → runtimeObserver-BKoQ5IEO.js} +4 -4
  139. package/dist/chunks/{runtimeObserver-DOYlxx9H.js → runtimeObserver-Ess1Cn8Y.js} +1 -1
  140. package/dist/chunks/sandbox-adapter-ClRO21Ci.js +1 -0
  141. package/dist/chunks/{sandbox-toggle-BtiPyjT3.js → sandbox-toggle-Bp6Xpjh3.js} +1 -1
  142. package/dist/chunks/searchExtraTools-CV_fkuD6.js +1 -0
  143. package/dist/chunks/{select-BuTJbu_Q.js → select-Bm29ymsI.js} +1 -1
  144. package/dist/chunks/sessionFileAccessHooks-B5kAD4ol.js +1 -0
  145. package/dist/chunks/{sessionObserver-cfwD8pV8.js → sessionObserver-CBlzrJt1.js} +1 -1
  146. package/dist/chunks/sessionObserver-CayxkuxO.js +1 -0
  147. package/dist/chunks/sessionStorage-vLxCo1Mh.js +1 -0
  148. package/dist/chunks/{sessionTracing-DsdcOqvc.js → sessionTracing-TDsq54Uc.js} +1 -1
  149. package/dist/chunks/setup-BbyfyeQk.js +3 -0
  150. package/dist/chunks/{shadowedRuleDetection-DiZUDzxU.js → shadowedRuleDetection-BG3jtA9Y.js} +1 -1
  151. package/dist/chunks/{sideQuestion-CdgUarC2.js → sideQuestion-C8GNVo4R.js} +3 -3
  152. package/dist/chunks/{sinks-Cy3NqVbk.js → sinks-BafJR6Fw.js} +1 -1
  153. package/dist/chunks/sinks-CHtjg7sn.js +1 -0
  154. package/dist/chunks/skillChangeDetector-CY17weG4.js +1 -0
  155. package/dist/chunks/{skillGapStore-BJV8ZIB1.js → skillGapStore-Cl4J1WoZ.js} +2 -2
  156. package/dist/chunks/{skillLifecycle-iO_3s9Ff.js → skillLifecycle-DdfeUHBf.js} +2 -2
  157. package/dist/chunks/{skillSearchPanel-BL5gXTHU.js → skillSearchPanel-DtQYF9gN.js} +4 -4
  158. package/dist/chunks/{skills-BEp3_RyT.js → skills-Fd12LJal.js} +1 -1
  159. package/dist/chunks/status-CGEMRiPI.js +1 -0
  160. package/dist/chunks/statusNoticeHelpers-D0tonVy0.js +1 -0
  161. package/dist/chunks/{switcher-DSt2cVjA.js → switcher-BCq9Az_q.js} +1 -1
  162. package/dist/chunks/switcher-DQMr6Anx.js +1 -0
  163. package/dist/chunks/{tasks-DyBUXnQb.js → tasks-DQmkY_xD.js} +1 -1
  164. package/dist/chunks/{templateJobs-BBnReWWj.js → templateJobs-CEDUbFAY.js} +1 -1
  165. package/dist/chunks/{terminalSetup-CDpFfqqV.js → terminalSetup-CaGbEVjB.js} +1 -1
  166. package/dist/chunks/{terminalSetup-DedaY1P7.js → terminalSetup-xe_P98fY.js} +1 -1
  167. package/dist/chunks/{theme-BZOy9Iqh.js → theme-DQjJ4R0o.js} +1 -1
  168. package/dist/chunks/tipRegistry-BwxZ_G0j.js +2 -0
  169. package/dist/chunks/{toolEventObserver-ClwWmVbH.js → toolEventObserver-DdZ30on9.js} +1 -1
  170. package/dist/chunks/toolPool-CWIXwdX7.js +1 -0
  171. package/dist/chunks/{useExitOnCtrlCDWithKeybindings-ClN4NJnB.js → useExitOnCtrlCDWithKeybindings-ClrtNKJ6.js} +1 -1
  172. package/dist/chunks/useMainLoopModel-CULw8pB_.js +1 -0
  173. package/dist/chunks/{useManagePlugins-CxHz-gUP.js → useManagePlugins-CmsPSHor.js} +1 -1
  174. package/dist/chunks/useMergedTools-C8PxReh0.js +1 -0
  175. package/dist/chunks/{useSearchInput-BIQN_-Hm.js → useSearchInput-BZhTzjgN.js} +1 -1
  176. package/dist/chunks/useSettingsErrors-GWIxCYyd.js +1 -0
  177. package/dist/chunks/{util-BHr5l6Bx.js → util-Bih2g-pV.js} +1 -1
  178. package/dist/chunks/validatePlugin-BwcC_Wbr.js +1 -0
  179. package/dist/chunks/{vim-CYjMtnwH.js → vim-BlO9V5_5.js} +1 -1
  180. package/dist/chunks/worktree-BB9lFWBB.js +1 -0
  181. package/dist/chunks/wrapper-B-Q3Illb.js +1 -0
  182. package/dist/chunks/{wrapper-K8ZapJVu.js → wrapper-DVKxC5fR.js} +1 -1
  183. package/dist/cli.js +1 -1
  184. package/package.json +2 -1
  185. package/dist/chunks/AgentsMdExternalIncludesDialog-CgSethgo.js +0 -1
  186. package/dist/chunks/App-DzRQpRKr.js +0 -1
  187. package/dist/chunks/Doctor-CLOYkPRR.js +0 -3
  188. package/dist/chunks/Doctor-CiZNe_qx.js +0 -1
  189. package/dist/chunks/ExitFlow-CATwJC4c.js +0 -2
  190. package/dist/chunks/MCPConnectionManager-CBY8nqdU.js +0 -1
  191. package/dist/chunks/MCPToolListView-C7HT6rrl.js +0 -1
  192. package/dist/chunks/MessageSelector-Dw_ERK_Z.js +0 -3
  193. package/dist/chunks/Messages-RBfRELKn.js +0 -10
  194. package/dist/chunks/QueryEngine-BBBkZWu2.js +0 -1
  195. package/dist/chunks/REPL-BHk0vZDf.js +0 -1
  196. package/dist/chunks/ResumeConversation-BuSqBrm1.js +0 -1
  197. package/dist/chunks/SearchExtraToolsTool-CdWB9sO8.js +0 -1
  198. package/dist/chunks/Settings-DYKmPdbd.js +0 -2
  199. package/dist/chunks/Spinner-DOI8qqZi.js +0 -1
  200. package/dist/chunks/allErrors-DvcU0w0F.js +0 -1
  201. package/dist/chunks/backgroundHousekeeping-B56nFTzq.js +0 -1
  202. package/dist/chunks/caches-D7arwhaa.js +0 -1
  203. package/dist/chunks/caches-Dn8yrJmL.js +0 -1
  204. package/dist/chunks/commands-AcfFLgl5.js +0 -1
  205. package/dist/chunks/compact-Banc-SNk.js +0 -2
  206. package/dist/chunks/config-BhBcadjZ.js +0 -1
  207. package/dist/chunks/config-Bm5pVdCq.js +0 -1
  208. package/dist/chunks/context-noninteractive-BK2IDLSS.js +0 -1
  209. package/dist/chunks/conversation-B2dX3X4Z.js +0 -1
  210. package/dist/chunks/conversation-Cjaftrrw.js +0 -1
  211. package/dist/chunks/crossProjectResume-BzltC4NJ.js +0 -40
  212. package/dist/chunks/doctor-CQf8xPZH.js +0 -1
  213. package/dist/chunks/exit-uKtXb5U3.js +0 -1
  214. package/dist/chunks/extractMemories-8yvMGZ1J.js +0 -1
  215. package/dist/chunks/fast-aNkj6WvB.js +0 -1
  216. package/dist/chunks/fetchModelList-D2quBF6M.js +0 -1
  217. package/dist/chunks/hooks-B5Wq-KxE.js +0 -1
  218. package/dist/chunks/loadAgentsDir-BBbIAiay.js +0 -1
  219. package/dist/chunks/loadPluginHooks-QoVXsBjy.js +0 -1
  220. package/dist/chunks/localSearch-D6MhwvnR.js +0 -1
  221. package/dist/chunks/managedEnv-ulQBH73B.js +0 -1
  222. package/dist/chunks/mcp--LmEVBRg.js +0 -1
  223. package/dist/chunks/mcp-DCl-Tz-C.js +0 -2
  224. package/dist/chunks/memory-Bu5ku7y9.js +0 -1
  225. package/dist/chunks/permissions-DNedQyLg.js +0 -3
  226. package/dist/chunks/plugin-BQ8gRVYF.js +0 -17
  227. package/dist/chunks/pluginBlocklist-CKCsgWdY.js +0 -1
  228. package/dist/chunks/pluginCliCommands-CACeyIwz.js +0 -1
  229. package/dist/chunks/pluginOperations-Ca_T-HYn.js +0 -2
  230. package/dist/chunks/pluginStartupCheck-Du9yx2P8.js +0 -1
  231. package/dist/chunks/plugins-Divl-P-X.js +0 -4
  232. package/dist/chunks/processBashCommand-BLcFmbyG.js +0 -1
  233. package/dist/chunks/processSlashCommand-Caif46Gi.js +0 -5
  234. package/dist/chunks/prompt-BZmu5CeK.js +0 -1
  235. package/dist/chunks/prompt-Cogr_WZr.js +0 -1
  236. package/dist/chunks/refresh-CBHbWTGg.js +0 -1
  237. package/dist/chunks/rename-Cw7cMerG.js +0 -1
  238. package/dist/chunks/sandbox-adapter-Df7Wpt77.js +0 -1
  239. package/dist/chunks/searchExtraTools-CbJVb_Zk.js +0 -1
  240. package/dist/chunks/sessionFileAccessHooks-_mxyfQmn.js +0 -1
  241. package/dist/chunks/sessionObserver-BZVgzp3W.js +0 -1
  242. package/dist/chunks/sessionStorage-SC5RfnUP.js +0 -1
  243. package/dist/chunks/setup-DR-KEmxL.js +0 -3
  244. package/dist/chunks/sinks-D41OiGE4.js +0 -1
  245. package/dist/chunks/skillChangeDetector-CVFCJcG7.js +0 -1
  246. package/dist/chunks/status-6JMz8jmM.js +0 -1
  247. package/dist/chunks/statusNoticeHelpers-BoloSeXY.js +0 -1
  248. package/dist/chunks/switcher-95d4TrQH.js +0 -1
  249. package/dist/chunks/tipRegistry-Cl5sdLRX.js +0 -2
  250. package/dist/chunks/toolPool-DSTbgGmX.js +0 -1
  251. package/dist/chunks/useMainLoopModel-Bgxpmn2Q.js +0 -1
  252. package/dist/chunks/useMergedTools-BUuWew0-.js +0 -1
  253. package/dist/chunks/useSettingsErrors-BDJCLei_.js +0 -1
  254. package/dist/chunks/validatePlugin-fx1Y8vam.js +0 -1
  255. package/dist/chunks/worktree-CGu_58ue.js +0 -1
@@ -1,3 +0,0 @@
1
- import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{n,t as r}from"./figures-5ThXQEtq.js";import{I as i,P as a,Wt as o,Xn as s,a as c,ai as l,di as u,fi as d,hn as f,k as p,kt as m,n as h,o as ee,ot as g,r as te,s as ne,t as _,x as re,y as v}from"./src-BX54x08P.js";import{t as y}from"./jsx-runtime-Bb4Xn-E0.js";import{B as b,L as x,a as S,cn as C,m as w,mn as T,z as E}from"./settings-D4M13toi.js";import{Pt as D,q as O}from"./state-CXY-q5gr.js";import{Bh as ie,H as k,Hh as ae,I as oe,Ji as A,Jx as j,L as se,Mg as M,Ng as ce,R as le,V as ue,_m as N,aC as P,gm as F,kg as de,sC as fe,sb as I,tb as L,z as pe,zh as R}from"./loadAgentsDir-uuZYOgKn.js";import{C as z,x as me}from"./debug-2pVES-2G.js";import{l as B,o as he}from"./stringUtils-Cs6E5f-B.js";import{n as ge,t as _e}from"./useExitOnCtrlCDWithKeybindings-ClN4NJnB.js";import{n as ve,t as ye}from"./TextInput-ZKU-x_FD.js";import{n as V,t as H}from"./select-BuTJbu_Q.js";import{n as be,t as xe}from"./AddWorkspaceDirectory-DqlPtsVK.js";import{t as Se}from"./SearchBox-zA5QwIpO.js";import{n as Ce,t as we}from"./useSearchInput-BIQN_-Hm.js";import{n as Te,t as Ee}from"./shadowedRuleDetection-DiZUDzxU.js";function De(){return U}var U,Oe=e((()=>{U=[]}));function ke({ruleValue:e}){switch(e.toolName){case F.name:return e.ruleContent?e.ruleContent.endsWith(`:*`)?(0,W.jsxs)(a,{dimColor:!0,children:[`Any Bash command starting with `,(0,W.jsx)(a,{bold:!0,children:e.ruleContent.slice(0,-2)})]}):(0,W.jsxs)(a,{dimColor:!0,children:[`The Bash command `,(0,W.jsx)(a,{bold:!0,children:e.ruleContent})]}):(0,W.jsx)(a,{dimColor:!0,children:`Any Bash command`});default:return e.ruleContent?null:(0,W.jsxs)(a,{dimColor:!0,children:[`Any use of the `,(0,W.jsx)(a,{bold:!0,children:e.toolName}),` tool`]})}}var W,Ae=e((()=>{_(),N(),W=y()}));function je(e){switch(e){case`localSettings`:return{label:`Project settings (local)`,description:`Saved in ${S(`localSettings`)}`,value:e};case`projectSettings`:return{label:`Project settings`,description:`Checked in at ${S(`projectSettings`)}`,value:e};case`userSettings`:return{label:`User settings`,description:`Saved in at ~/.workmate/settings.json`,value:e}}}function Me({onAddRules:e,onCancel:t,ruleValues:n,ruleBehavior:r,initialContext:o,setToolPermissionContext:s}){let c=C.map(je),l=(0,Ne.useCallback)(i=>{if(i===`cancel`){t();return}else if(C.includes(i)){let t=i,a=de(o,{type:`addRules`,rules:n,behavior:r,destination:t});ce({type:`addRules`,rules:n,behavior:r,destination:t}),s(a);let c=n.map(e=>({ruleValue:e,ruleBehavior:r,source:t})),l=Ee(a,{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,o,s]);return(0,G.jsxs)(v,{title:`Add ${r} permission ${B(n.length,`rule`)}`,onCancel:t,color:`permission`,children:[(0,G.jsx)(i,{flexDirection:`column`,paddingX:2,children:n.map(e=>(0,G.jsxs)(i,{flexDirection:`column`,children:[(0,G.jsx)(a,{bold:!0,children:b(e)}),(0,G.jsx)(ke,{ruleValue:e})]},b(e)))}),(0,G.jsxs)(i,{flexDirection:`column`,marginY:1,children:[(0,G.jsx)(a,{children:n.length===1?`Where should this rule be saved?`:`Where should these rules be saved?`}),(0,G.jsx)(H,{options:c,onChange:l})]})]})}var Ne,G,Pe=e((()=>{Ne=t(l(),1),V(),_(),M(),x(),Te(),fe(),T(),w(),he(),Ae(),G=y()}));function Fe({onCancel:e,onSubmit:t,ruleBehavior:n}){let[s,c]=(0,Ie.useState)(``),[l,u]=(0,Ie.useState)(0),d=ge();o(`confirm:no`,e,{context:`Settings`});let{columns:f}=g(),p=f-6;return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(i,{flexDirection:`column`,gap:1,borderStyle:`round`,paddingLeft:1,paddingRight:1,borderColor:`permission`,children:[(0,K.jsxs)(a,{bold:!0,color:`permission`,children:[`Add `,n,` permission rule`]}),(0,K.jsxs)(i,{flexDirection:`column`,children:[(0,K.jsxs)(a,{children:[`Permission rules are a tool name, optionally followed by a specifier in parentheses.`,(0,K.jsx)(m,{}),`e.g., `,(0,K.jsx)(a,{bold:!0,children:b({toolName:F.name})}),(0,K.jsx)(a,{bold:!1,children:` or `}),(0,K.jsx)(a,{bold:!0,children:b({toolName:F.name,ruleContent:`ls:*`})})]}),(0,K.jsx)(i,{borderDimColor:!0,borderStyle:`round`,marginY:1,paddingLeft:1,children:(0,K.jsx)(ye,{showCursor:!0,value:s,onChange:c,onSubmit:e=>{let r=e.trim();r.length!==0&&t(E(r),n)},placeholder:`Enter permission rule${r.ellipsis}`,columns:p,cursorOffset:l,onChangeCursorOffset:u})})]})]}),(0,K.jsx)(i,{marginLeft:3,children:d.pending?(0,K.jsxs)(a,{dimColor:!0,children:[`Press `,d.keyName,` again to exit`]}):(0,K.jsx)(a,{dimColor:!0,children:`Enter to submit · Esc to cancel`})})]})}var Ie,K,Le=e((()=>{n(),Ie=t(l(),1),ve(),_e(),I(),_(),L(),N(),x(),K=y()}));function Re({onHeaderFocusChange:e,onStateChange:t}){let{headerFocused:n,focusHeader:r}=c();(0,q.useEffect)(()=>{e?.(n)},[n,e]);let[o]=(0,q.useState)(()=>De()),[s,l]=(0,q.useState)(()=>new Set),[u,d]=(0,q.useState)(()=>new Set),[p,m]=(0,q.useState)(0);(0,q.useEffect)(()=>{t({approved:s,retry:u,denials:o})},[s,u,o,t]);let h=(0,q.useCallback)(e=>{let t=Number(e);l(e=>{let n=new Set(e);return n.has(t)?n.delete(t):n.add(t),n})},[]),ee=(0,q.useCallback)(e=>{m(Number(e))},[]);if(f((e,t)=>{e===`r`&&(d(e=>{let t=new Set(e);return t.has(p)?t.delete(p):t.add(p),t}),l(e=>{if(e.has(p))return e;let t=new Set(e);return t.add(p),t}))},{isActive:o.length>0}),o.length===0)return(0,J.jsx)(a,{dimColor:!0,children:`No recent denials. Commands denied by the auto mode classifier will appear here.`});let g=o.map((e,t)=>{let n=s.has(t),r=u.has(t)?` (retry)`:``;return{label:(0,J.jsxs)(a,{children:[(0,J.jsx)(ne,{status:n?`success`:`error`,withSpace:!0}),e.display,(0,J.jsx)(a,{dimColor:!0,children:r})]}),value:String(t)}});return(0,J.jsxs)(i,{flexDirection:`column`,children:[(0,J.jsx)(a,{children:`Commands recently denied by the auto mode classifier.`}),(0,J.jsx)(i,{marginTop:1,children:(0,J.jsx)(H,{options:g,onChange:h,onFocus:ee,visibleOptionCount:Math.min(10,g.length),isDisabled:n,onUpFromFirstItem:r})})]})}var q,J,ze=e((()=>{q=t(l(),1),_(),Oe(),V(),J=y()}));function Be({directoryPath:e,onRemove:t,onCancel:n,permissionContext:r,setPermissionContext:o}){let s=(0,Ve.useCallback)(()=>{o(de(r,{type:`removeDirectories`,directories:[e],destination:`session`})),t()},[e,r,o,t]),c=(0,Ve.useCallback)(e=>{e===`yes`?s():n()},[s,n]);return(0,Y.jsxs)(v,{title:`Remove directory from workspace?`,onCancel:n,color:`error`,children:[(0,Y.jsx)(i,{marginX:2,flexDirection:`column`,children:(0,Y.jsx)(a,{bold:!0,children:e})}),(0,Y.jsx)(a,{children:`Work Mate will no longer have access to files in this directory.`}),(0,Y.jsx)(H,{onChange:c,onCancel:n,options:[{label:`Yes`,value:`yes`},{label:`No`,value:`no`}]})]})}var Ve,Y,He=e((()=>{Ve=t(l(),1),V(),_(),M(),Y=y()}));function Ue({onExit:e,toolPermissionContext:t,onRequestAddDirectory:n,onRequestRemoveDirectory:o,onHeaderFocusChange:s}){let{headerFocused:l,focusHeader:u}=c();(0,X.useEffect)(()=>{s?.(l)},[l,s]);let d=We.useMemo(()=>Array.from(t.additionalWorkingDirectories.keys()).map(e=>({path:e,isCurrent:!1,isDeletable:!0})),[t.additionalWorkingDirectories]),f=(0,X.useCallback)(e=>{if(e===`add-directory`){n();return}let t=d.find(t=>t.path===e);t?.isDeletable&&o(t.path)},[d,n,o]),p=(0,X.useCallback)(()=>e(`Workspace dialog dismissed`,{display:`system`}),[e]),m=We.useMemo(()=>{let e=d.map(e=>({label:e.path,value:e.path}));return e.push({label:`Add directory${r.ellipsis}`,value:`add-directory`}),e},[d]);return(0,Z.jsxs)(i,{flexDirection:`column`,marginBottom:1,children:[(0,Z.jsxs)(i,{flexDirection:`row`,marginTop:1,marginLeft:2,gap:1,children:[(0,Z.jsx)(a,{children:`- ${O()}`}),(0,Z.jsx)(a,{dimColor:!0,children:`(Original working directory)`})]}),(0,Z.jsx)(H,{options:m,onChange:f,onCancel:p,visibleOptionCount:Math.min(10,m.length),onUpFromFirstItem:u,isDisabled:l})]})}var We,X,Z,Ge=e((()=>{n(),We=t(l(),1),X=t(l(),1),D(),V(),_(),Z=y()}));function Ke({rule:e}){return(0,$.jsx)(a,{dimColor:!0,children:`From ${k(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=ge();o(`confirm:no`,n,{context:`Confirmation`});let s=(0,$.jsxs)(i,{flexDirection:`column`,marginX:2,children:[(0,$.jsx)(a,{bold:!0,children:b(e.ruleValue)}),(0,$.jsx)(ke,{ruleValue:e.ruleValue}),(0,$.jsx)(Ke,{rule:e})]}),c=(0,$.jsx)(i,{marginLeft:3,children:r.pending?(0,$.jsxs)(a,{dimColor:!0,children:[`Press `,r.keyName,` again to exit`]}):(0,$.jsx)(a,{dimColor:!0,children:`Esc to cancel`})});return e.source===`policySettings`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(i,{flexDirection:`column`,gap:1,borderStyle:`round`,paddingLeft:1,paddingRight:1,borderColor:`permission`,children:[(0,$.jsx)(a,{bold:!0,color:`permission`,children:`Rule details`}),s,(0,$.jsxs)(a,{italic:!0,children:[`This rule is configured by managed settings and cannot be modified.`,`
2
- `,`Contact your system administrator for more information.`]})]}),c]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(i,{flexDirection:`column`,gap:1,borderStyle:`round`,paddingLeft:1,paddingRight:1,borderColor:`error`,children:[(0,$.jsxs)(a,{bold:!0,color:`error`,children:[`Delete `,qe(e.ruleBehavior),` tool?`]}),s,(0,$.jsx)(a,{children:`Are you sure you want to delete this permission rule?`}),(0,$.jsx)(H,{onChange:e=>e===`yes`?t():n(),onCancel:n,options:[{label:`Yes`,value:`yes`},{label:`No`,value:`no`}]})]}),c]})}function Ye(e){let{options:t,searchQuery:n,isSearchMode:r,isFocused:a,onSelect:o,onCancel:s,lastFocusedRuleKey:l,cursorOffset:u,onHeaderFocusChange:d}=e,f=ee(),{headerFocused:m,focusHeader:h,blurHeader:g}=c();return(0,Q.useEffect)(()=>{r&&m&&g()},[r,m,g]),(0,Q.useEffect)(()=>{d?.(m)},[m,d]),(0,$.jsxs)(i,{flexDirection:`column`,children:[(0,$.jsx)(i,{marginBottom:1,flexDirection:`column`,children:(0,$.jsx)(p,{query:n,isFocused:r&&!m,isTerminalFocused:a,width:f,cursorOffset:u})}),(0,$.jsx)(H,{options:t,onChange:o,onCancel:s,visibleOptionCount:Math.min(10,t.length),isDisabled:r||m,defaultFocusValue:l,onUpFromFirstItem:h})]})}function Xe({tab:e,getRulesOptions:t,handleToolSelect:n,...r}){return(0,$.jsxs)(i,{flexDirection:`column`,flexShrink:e===`allow`?0:void 0,children:[(0,$.jsx)(a,{children:{allow:`Work Mate won't ask before using allowed tools.`,ask:`Work Mate will always ask for confirmation before using these tools.`,deny:`Work Mate 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 Ze({onExit:e,initialTab:t,onRetryDenials:n}){let c=De().length>0,l=t??(c?`recent`:`allow`),[d,f]=(0,Q.useState)([]),p=ie(e=>e.toolPermissionContext),m=ae(),ee=s(),g=(0,Q.useRef)({approved:new Set,retry:new Set,denials:[]}),ne=(0,Q.useCallback)(e=>{g.current=e},[]),[_,v]=(0,Q.useState)(),[y,x]=(0,Q.useState)(),[S,C]=(0,Q.useState)(null),[w,T]=(0,Q.useState)(null),[E,D]=(0,Q.useState)(!1),[O,k]=(0,Q.useState)(null),[A,j]=(0,Q.useState)(!1),[M,ue]=(0,Q.useState)(!0),N=(0,Q.useCallback)(e=>{ue(e)},[]),P=(0,Q.useMemo)(()=>{let e=new Map;return se(p).forEach(t=>{e.set(z(t),t)}),e},[p]),F=(0,Q.useMemo)(()=>{let e=new Map;return pe(p).forEach(t=>{e.set(z(t),t)}),e},[p]),fe=(0,Q.useMemo)(()=>{let e=new Map;return le(p).forEach(t=>{e.set(z(t),t)}),e},[p]),I=(0,Q.useCallback)((e,t=``)=>{let n=(()=>{switch(e){case`allow`:return P;case`deny`:return F;case`ask`:return fe;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=b(r.ruleValue).toLowerCase(),t=b(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=b(r.ruleValue);if(t&&!n.toLowerCase().includes(o))continue;i.push({label:n,value:e})}}return{options:i,rulesByKey:n}},[P,F,fe]),L=ge(),R=!_&&!S&&!w&&!E&&!O,{query:me,setQuery:B,cursorOffset:he}=Ce({isActive:R&&A,onExit:()=>{j(!1)}}),_e=(0,Q.useCallback)(e=>{R&&(A||e.ctrl||e.meta||(e.key===`/`?(e.preventDefault(),j(!0),B(``)):e.key.length===1&&e.key!==`j`&&e.key!==`k`&&e.key!==`m`&&e.key!==`i`&&e.key!==`r`&&e.key!==` `&&(e.preventDefault(),j(!0),B(e.key))))},[R,A,B]),ve=(0,Q.useCallback)((e,t)=>{let{rulesByKey:n}=I(t);if(e===`add-new-rule`){C(t);return}else{v(n.get(e));return}},[I]),ye=(0,Q.useCallback)(()=>{C(null)},[]),V=(0,Q.useCallback)((e,t)=>{T({ruleValue:e,ruleBehavior:t}),C(null)},[]),H=(0,Q.useCallback)((e,t)=>{T(null);for(let t of e)f(e=>[...e,`Added ${t.ruleBehavior} rule ${u.bold(b(t.ruleValue))}`]);if(t&&t.length>0)for(let e of t){let t=e.shadowType===`deny`?`blocked`:`shadowed`;f(n=>[...n,u.yellow(`${r.warning} Warning: ${b(e.rule.ruleValue)} is ${t}`),u.dim(` ${e.reason}`),u.dim(` Fix: ${e.fix}`)])}},[]),be=(0,Q.useCallback)(()=>{T(null)},[]),Se=(0,Q.useCallback)(()=>D(!0),[]),we=(0,Q.useCallback)(e=>k(e),[]),Te=(0,Q.useCallback)(()=>{let t=g.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||d.length>0?e([...a.length>0?[`Approved ${a.map(e=>u.bold(e.display)).join(`, `)}`]:[],...d].join(`
3
- `)):e(`Permissions dialog dismissed`,{display:`system`})},[d,e,n]);o(`confirm:no`,Te,{context:`Settings`,isActive:R&&!A});let Ee=()=>{if(!_)return;let{options:e}=I(_.ruleBehavior),t=z(_),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])),x(i),oe({rule:_,initialContext:p,setToolPermissionContext(e){m(t=>({...t,toolPermissionContext:e}))}}),f(e=>[...e,`Deleted ${_.ruleBehavior} rule ${u.bold(b(_.ruleValue))}`]),v(void 0)};if(_)return(0,$.jsx)(Je,{rule:_,onDelete:Ee,onCancel:()=>v(void 0)});if(S&&S!==`workspace`&&S!==`recent`)return(0,$.jsx)(Fe,{onCancel:ye,onSubmit:V,ruleBehavior:S});if(w)return(0,$.jsx)(Me,{onAddRules:H,onCancel:be,ruleValues:[w.ruleValue],ruleBehavior:w.ruleBehavior,initialContext:p,setToolPermissionContext:e=>{m(t=>({...t,toolPermissionContext:e}))}});if(E)return(0,$.jsx)(xe,{onAddDirectory:(e,t)=>{let n={type:`addDirectories`,directories:[e],destination:t?`localSettings`:`session`},r=de(p,n);m(e=>({...e,toolPermissionContext:r})),t&&ce(n),f(n=>[...n,`Added directory ${u.bold(e)} to workspace${t?` and saved to local settings`:` for this session`}`]),D(!1)},onCancel:()=>D(!1),permissionContext:p});if(O)return(0,$.jsx)(Be,{directoryPath:O,onRemove:()=>{f(e=>[...e,`Removed directory ${u.bold(O)} from workspace`]),k(null)},onCancel:()=>k(null),permissionContext:p,setPermissionContext:e=>{m(t=>({...t,toolPermissionContext:e}))}});let U={searchQuery:me,isSearchMode:A,isFocused:ee,onCancel:Te,lastFocusedRuleKey:y,cursorOffset:he,getRulesOptions:I,handleToolSelect:ve,onHeaderFocusChange:N};return(0,$.jsx)(i,{flexDirection:`column`,onKeyDown:_e,children:(0,$.jsxs)(re,{color:`permission`,children:[(0,$.jsxs)(te,{title:`Permissions:`,color:`permission`,defaultTab:l,hidden:!!_||!!S||!!w||E||!!O,initialHeaderFocused:!c,navFromContent:!A,children:[(0,$.jsx)(h,{id:`recent`,title:`Recently denied`,children:(0,$.jsx)(Re,{onHeaderFocusChange:N,onStateChange:ne})}),(0,$.jsx)(h,{id:`allow`,title:`Allow`,children:(0,$.jsx)(Xe,{tab:`allow`,...U})}),(0,$.jsx)(h,{id:`ask`,title:`Ask`,children:(0,$.jsx)(Xe,{tab:`ask`,...U})}),(0,$.jsx)(h,{id:`deny`,title:`Deny`,children:(0,$.jsx)(Xe,{tab:`deny`,...U})}),(0,$.jsx)(h,{id:`workspace`,title:`Workspace`,children:(0,$.jsxs)(i,{flexDirection:`column`,children:[(0,$.jsx)(a,{children:`Work Mate can read files in the workspace, and make edits when auto-accept edits is on.`}),(0,$.jsx)(Ue,{onExit:e,toolPermissionContext:p,onRequestAddDirectory:Se,onRequestRemoveDirectory:we,onHeaderFocusChange:N})]})})]}),(0,$.jsx)(i,{marginTop:1,paddingLeft:1,children:(0,$.jsx)(a,{dimColor:!0,children:L.pending?(0,$.jsxs)($.Fragment,{children:[`Press `,L.keyName,` again to exit`]}):M?(0,$.jsx)($.Fragment,{children:`←/→ tab switch · ↓ return · Esc cancel`}):A?(0,$.jsx)($.Fragment,{children:`Type to filter · Enter/↓ select · ↑ tabs · Esc clear`}):c&&l===`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,$,Qe=e((()=>{d(),n(),Q=t(l(),1),R(),M(),V(),_e(),we(),_(),L(),Oe(),x(),ue(),me(),Se(),Pe(),be(),Ae(),Le(),ze(),He(),Ge(),$=y()})),$e,et;e((()=>{Qe(),A(),$e=y(),et=async(e,t)=>(0,$e.jsx)(Ze,{onExit:e,onRetryDenials:e=>{t.setMessages(t=>[...t,j(e)])}})}))();export{et as call};
@@ -1,17 +0,0 @@
1
- import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{l as n,o as r}from"./envUtils-QyzA_cFM.js";import{n as i,t as a}from"./figures-5ThXQEtq.js";import{D as o,Gr as s,Gt as c,H as l,I as u,P as d,T as f,Wt as p,Xn as m,ai as h,hn as g,j as _,k as v,n as y,ot as b,r as x,t as S,x as C,y as ee}from"./src-BX54x08P.js";import{t as w}from"./jsx-runtime-Bb4Xn-E0.js";import{$n as T,Qn as te,d as ne,gt as E,m as D,s as O,y as k,yt as re}from"./settings-D4M13toi.js";import{$a as ie,$d as A,$m as j,Ao as ae,Ax as M,Ba as N,Bh as oe,Co as se,Cx as P,Do as ce,Eo as le,Fa as ue,Ga as F,Hh as I,Ka as de,Mo as fe,Mx as pe,No as me,Nx as he,Oo as ge,Pa as L,Qa as R,Qm as _e,So as ve,To as ye,Tx as be,Va as xe,Xd as Se,Xm as Ce,Ya as we,Ym as z,Zm as Te,_f as Ee,bu as De,do as B,eh as Oe,gf as ke,go as Ae,hd as je,io as Me,kx as Ne,lx as Pe,md as V,mo as Fe,nh as Ie,ox as Le,rh as Re,sb as ze,so as Be,tb as Ve,th as He,to as Ue,uo as We,ux as Ge,vo as Ke,wo as qe,yo as Je,yu as Ye,yx as Xe,zh as Ze}from"./loadAgentsDir-uuZYOgKn.js";import{I as Qe,M as $e,S as et,V as tt,c as nt,i as rt,x as it}from"./debug-2pVES-2G.js";import{d as at,g as ot}from"./config-BDn2YIjC.js";import{o as st,s as ct}from"./log-L1kqxa_P.js";import{n as lt}from"./analytics-COpjZpvd.js";import{S as ut,v as dt}from"./startupProfiler-B9Qv2QGH.js";import{l as H,o as ft}from"./stringUtils-Cs6E5f-B.js";import{n as pt,t as mt}from"./pluginStartupCheck-DftTiXct.js";import{a as ht,d as gt,f as _t,i as vt,l as yt,o as bt,s as xt,u as St}from"./pluginOperations-Ca_T-HYn.js";import{a as Ct,c as wt,i as Tt,n as Et,o as Dt,s as Ot,t as kt}from"./validatePlugin-fx1Y8vam.js";import{a as At,n as jt,o as Mt,r as Nt}from"./pluginFlagging-CUvkKGOB.js";import{i as Pt,n as Ft}from"./MCPConnectionManager-CBY8nqdU.js";import{n as It,t as Lt}from"./useExitOnCtrlCDWithKeybindings-ClN4NJnB.js";import{n as Rt,t as zt}from"./TextInput-ZKU-x_FD.js";import{r as Bt,t as Vt}from"./Spinner-DOI8qqZi.js";import{t as Ht}from"./SearchBox-zA5QwIpO.js";import{n as Ut,t as Wt}from"./useSearchInput-BIQN_-Hm.js";import{a as Gt,c as Kt,i as qt,n as Jt,o as Yt,r as Xt,s as Zt,t as Qt}from"./MCPToolListView-C7HT6rrl.js";import{i as $t,n as en}from"./pluginAutoupdate-CNrHb4RJ.js";import*as tn from"path";import*as nn from"fs/promises";function rn({inputValue:e,setInputValue:t,cursorOffset:n,setCursorOffset:r,error:i,setError:a,result:s,setResult:c,setViewState:l,onAddComplete:p,cliMode:m=!1}){let h=(0,an.useRef)(!1),[g,_]=(0,an.useState)(!1),[v,y]=(0,an.useState)(``),b=async()=>{let t=e.trim();if(!t){a(`Please enter a marketplace source`);return}let n=await Ct(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{_(!0),y(``);let{name:e,resolvedSource:t}=await Me(n,e=>{y(e)});Ke(e,{source:t}),fe(),n.source,n.source===`github`&&n.repo,p&&await p(),y(``),_(!1),m?c(`Successfully added marketplace: ${e}`):l({type:`browse-marketplace`,targetMarketplace:e})}catch(e){let t=tt(e);ct(t),a(t.message),y(``),_(!1),c(m?`Error: ${t.message}`:null)}};return(0,an.useEffect)(()=>{e&&!h.current&&!i&&!s&&(h.current=!0,b())},[]),(0,U.jsxs)(u,{flexDirection:`column`,children:[(0,U.jsxs)(u,{flexDirection:`column`,paddingX:1,borderStyle:`round`,children:[(0,U.jsx)(u,{marginBottom:1,children:(0,U.jsx)(d,{bold:!0,children:`Add Marketplace`})}),(0,U.jsxs)(u,{flexDirection:`column`,children:[(0,U.jsx)(d,{children:`Enter marketplace source:`}),(0,U.jsx)(d,{dimColor:!0,children:`Examples:`}),(0,U.jsx)(d,{dimColor:!0,children:` · owner/repo (GitHub)`}),(0,U.jsx)(d,{dimColor:!0,children:` · git@github.com:owner/repo.git (SSH)`}),(0,U.jsx)(d,{dimColor:!0,children:` · https://example.com/marketplace.json`}),(0,U.jsx)(d,{dimColor:!0,children:` · ./path/to/marketplace`}),(0,U.jsx)(u,{marginTop:1,children:(0,U.jsx)(zt,{value:e,onChange:t,onSubmit:b,columns:80,cursorOffset:n,onChangeCursorOffset:r,focus:!0,showCursor:!0})})]}),g&&(0,U.jsxs)(u,{marginTop:1,children:[(0,U.jsx)(Vt,{}),(0,U.jsx)(d,{children:v||`Adding marketplace to configuration…`})]}),i&&(0,U.jsx)(u,{marginTop:1,children:(0,U.jsx)(d,{color:`error`,children:i})}),s&&(0,U.jsx)(u,{marginTop:1,children:(0,U.jsx)(d,{children:s})})]}),(0,U.jsx)(u,{marginLeft:3,children:(0,U.jsx)(d,{dimColor:!0,italic:!0,children:(0,U.jsxs)(f,{children:[(0,U.jsx)(o,{shortcut:`Enter`,action:`add`}),(0,U.jsx)(V,{action:`confirm:no`,context:`Settings`,fallback:`Esc`,description:`cancel`})]})})})]})}var an,U,on=e((()=>{an=t(h(),1),lt(),je(),S(),Bt(),Rt(),Qe(),st(),me(),We(),Tt(),U=w()}));function sn(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 cn({title:e,subtitle:t,configSchema:n,initialValues:r,onSave:i,onCancel:o}){let l=Object.keys(n),f=(0,ln.useCallback)(e=>{if(n[e]?.sensitive===!0)return``;let t=r?.[e];return t===void 0?``:String(t)},[n,r]),[m,h]=(0,ln.useState)(0),[_,v]=(0,ln.useState)({}),[y,b]=(0,ln.useState)(()=>l[0]?f(l[0]):``),x=l[m],S=x?n[x]:null;if(p(`confirm:no`,o,{context:`Settings`}),c({"confirm:nextField":(0,ln.useCallback)(()=>{if(m<l.length-1&&x){v(e=>({...e,[x]:y})),h(e=>e+1);let e=l[m+1];b(e?f(e):``)}},[m,l,x,y,f]),"confirm:yes":(0,ln.useCallback)(()=>{if(!x)return;let e={..._,[x]:y};if(m===l.length-1)i(sn(l,e,n,r));else{v(e),h(e=>e+1);let t=l[m+1];b(t?f(t):``)}},[x,_,y,m,l,n,i,f,r])},{context:`Confirmation`}),g((e,t)=>{if(t.backspace||t.delete){b(e=>e.slice(0,-1));return}e&&!t.ctrl&&!t.meta&&!t.tab&&!t.return&&b(t=>t+e)}),!S||!x)return null;let C=S.sensitive===!0,w=S.required===!0,T=C?`*`.repeat(s(y)):y;return(0,un.jsxs)(ee,{title:e,subtitle:t,onCancel:o,isCancelActive:!1,children:[(0,un.jsxs)(u,{flexDirection:`column`,children:[(0,un.jsxs)(d,{bold:!0,children:[S.title||x,w&&(0,un.jsx)(d,{color:`error`,children:` *`})]}),S.description&&(0,un.jsx)(d,{dimColor:!0,children:S.description}),(0,un.jsxs)(u,{marginTop:1,children:[(0,un.jsxs)(d,{children:[a.pointerSmall,` `]}),(0,un.jsx)(d,{children:T}),(0,un.jsx)(d,{children:`█`})]})]}),(0,un.jsxs)(u,{flexDirection:`column`,children:[(0,un.jsxs)(d,{dimColor:!0,children:[`Field `,m+1,` of `,l.length]}),m<l.length-1&&(0,un.jsx)(d,{dimColor:!0,children:`Tab: Next field · Enter: Save and continue`}),m===l.length-1&&(0,un.jsx)(d,{dimColor:!0,children:`Enter: Save configuration`})]})]})}var ln,un,dn=e((()=>{i(),ln=t(h(),1),S(),Ve(),r(),un=w()}));async function fn(e){let{enabled:t,disabled:n}=await ue();return[...t,...n].find(t=>t.repository===e||t.source===e)}function pn({plugin:e,pluginId:t,onDone:n}){let[r]=mn.useState(()=>{let n=[],r=z(e);Object.keys(r).length>0&&n.push({key:`top-level`,title:`Configure ${e.name}`,subtitle:`Plugin options`,schema:r,load:()=>Te(t),save:n=>_e(t,n,e.manifest.userConfig)});let i=ke(e);for(let r of i)n.push({key:`channel:${r.server}`,title:`Configure ${r.displayName}`,subtitle:`Plugin: ${e.name}`,schema:r.configSchema,load:()=>He(t,r.server)??void 0,save:e=>Re(t,r.server,e,r.configSchema)});return n}),[i,a]=mn.useState(0),o=mn.useRef(n);if(o.current=n,mn.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`,$e(e));return}let t=i+1;t<r.length?a(t):n(`configured`)}return(0,hn.jsx)(cn,{title:s.title,subtitle:s.subtitle,configSchema:s.schema,initialValues:s.load(),onSave:c,onCancel:()=>n(`skipped`)},s.key)}var mn,hn,gn=e((()=>{mn=t(h(),1),Qe(),j(),Ee(),L(),Ce(),dn(),hn=w()}));function _n(){let e=ce();return(0,vn.jsxs)(u,{marginBottom:1,children:[(0,vn.jsxs)(d,{color:`claude`,children:[a.warning,` `]}),(0,vn.jsxs)(d,{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 vn,yn=e((()=>{i(),S(),ge(),vn=w()}));function bn(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 xn(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 Sn({hasSelection:e}){return(0,Cn.jsx)(u,{marginTop:1,children:(0,Cn.jsx)(d,{dimColor:!0,italic:!0,children:(0,Cn.jsxs)(f,{children:[e&&(0,Cn.jsx)(V,{action:`plugin:install`,context:`Plugin`,fallback:`i`,description:`install`,bold:!0}),(0,Cn.jsx)(V,{action:`plugin:toggle`,context:`Plugin`,fallback:`Space`,description:`toggle`}),(0,Cn.jsx)(V,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`details`}),(0,Cn.jsx)(V,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]})})})}var Cn,wn=e((()=>{je(),S(),Cn=w()}));function Tn({totalItems:e,maxVisible:t=Dn,selectedIndex:n=0}){let r=e>t,i=(0,En.useRef)(0),a=(0,En.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,En.useCallback)(e=>r?e.slice(o,s):e,[r,o,s]),l=(0,En.useCallback)(e=>o+e,[o]),u=(0,En.useCallback)(e=>e>=o&&e<s,[o,s]),d=(0,En.useCallback)(e=>{},[]),f=(0,En.useCallback)(()=>{},[]),p=(0,En.useCallback)(()=>{},[]),m=(0,En.useCallback)((t,n)=>{n(Math.max(0,Math.min(t,e-1)))},[e]),h=(0,En.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 En,Dn,On=e((()=>{En=t(h(),1),Dn=5}));function kn({error:e,setError:t,result:n,setResult:r,setViewState:i,onInstallComplete:o,targetMarketplace:s,targetPlugin:l}){let[m,h]=(0,W.useState)(`marketplace-list`),[g,_]=(0,W.useState)(null),[v,y]=(0,W.useState)(null),[b,x]=(0,W.useState)([]),[S,C]=(0,W.useState)([]),[ee,w]=(0,W.useState)(!0),[T,ne]=(0,W.useState)(null),[E,D]=(0,W.useState)(0),[O,k]=(0,W.useState)(new Set),[re,A]=(0,W.useState)(new Set),j=Tn({totalItems:S.length,selectedIndex:E}),[M,N]=(0,W.useState)(0),[oe,se]=(0,W.useState)(!1),[P,ce]=(0,W.useState)(null),[ue,F]=(0,W.useState)(null);p(`confirm:no`,An.useCallback(()=>{m===`plugin-list`?s?i({type:`manage-marketplaces`,targetMarketplace:s}):b.length===1?i({type:`menu`}):(h(`marketplace-list`),_(null),k(new Set)):m===`plugin-details`?(h(`plugin-list`),y(null)):i({type:`menu`})},[m,s,i,b.length]),{context:`Confirmation`}),(0,W.useEffect)(()=>{async function e(){try{let e=await B(),{marketplaces:n,failures:r}=await ae(e),i=[];for(let{name:e,config:t,data:r}of n)if(r){let n=te(r.plugins,t=>ie(ve(t.name,e)));i.push({name:e,totalPlugins:r.plugins.length,installedCount:n,source:le(t.source)})}i.sort((e,t)=>e.name===`claude-plugin-directory`?-1:+(t.name===`claude-plugin-directory`)),x(i);let a=ye(r,te(n,e=>e.data!==null));if(a)if(a.type===`warning`)F(`${a.message}. Showing available marketplaces.`);else throw Error(a.message);if(i.length===1&&!s&&!l){let e=i[0];e&&(_(e.name),h(`plugin-list`))}if(l){let n=null,r=null;for(let[t]of Object.entries(e)){let e=await Be(t);if(e){let i=e.plugins.find(e=>e.name===l);if(i){let e=ve(i.name,t);n={entry:i,marketplaceName:t,pluginId:e,isInstalled:R(e)},r=t;break}}}if(n&&r){let e=n.pluginId;R(e)?t(`Plugin '${e}' is already installed globally. Use '/plugin' to manage existing plugins.`):(_(r),y(n),h(`plugin-details`))}else t(`Plugin "${l}" not found in any marketplace`)}else s&&(i.some(e=>e.name===s)?(_(s),h(`plugin-list`)):t(`Marketplace "${s}" not found`))}catch(e){t(e instanceof Error?e.message:`Failed to load marketplaces`)}finally{w(!1)}}e()},[t,s,l]),(0,W.useEffect)(()=>{if(!g)return;let e=!1;async function n(n){w(!0);try{let t=await Be(n);if(e)return;if(!t)throw Error(`Failed to load marketplace: ${n}`);let r=[];for(let e of t.plugins){let t=ve(e.name,n);de(t)||r.push({entry:e,marketplaceName:n,pluginId:t,isInstalled:R(t)})}try{let t=await Ot();if(e)return;ne(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;nt(`Failed to fetch install counts: ${$e(t)}`),r.sort((e,t)=>e.entry.name.localeCompare(t.entry.name))}C(r),D(0),k(new Set)}catch(n){if(e)return;t(n instanceof Error?n.message:`Failed to load plugins`)}finally{w(!1)}}return n(g),()=>{e=!0}},[g,t]);let I=async()=>{if(O.size===0)return;let e=S.filter(e=>O.has(e.pluginId));A(new Set(e.map(e=>e.pluginId)));let n=0,a=0,s=[];for(let t of e){let e=await xe({pluginId:t.pluginId,entry:t.entry,marketplaceName:t.marketplaceName,scope:`user`});e.success?n++:(a++,s.push({name:t.entry.name,reason:e.error}))}A(new Set),k(new Set),fe(),a===0?r(`✓ Installed ${n} ${H(n,`plugin`)}. Run /reload-plugins to activate.`):n===0?t(`Failed to install: ${qe(s,!0)}`):r(`✓ Installed ${n} of ${n+a} plugins. Failed: ${qe(s,!1)}. Run /reload-plugins to activate successfully installed plugins.`),n>0&&o&&await o(),i({type:`menu`})},pe=async(e,t=`user`)=>{se(!0),ce(null);let n=await xe({pluginId:e.pluginId,entry:e.entry,marketplaceName:e.marketplaceName,scope:t});if(n.success){let t=await fn(e.pluginId);if(t){se(!1),h({type:`plugin-options`,plugin:t,pluginId:e.pluginId});return}r(n.message),o&&await o(),i({type:`menu`})}else se(!1),ce(n.error)};(0,W.useEffect)(()=>{e&&r(e)},[e,r]),c({"select:previous":()=>{E>0&&D(E-1)},"select:next":()=>{E<b.length-1&&D(E+1)},"select:accept":()=>{let e=b[E];e&&(_(e.name),h(`plugin-list`))}},{context:`Select`,isActive:m===`marketplace-list`}),c({"select:previous":()=>{E>0&&j.handleSelectionChange(E-1,D)},"select:next":()=>{E<S.length-1&&j.handleSelectionChange(E+1,D)},"select:accept":()=>{if(E===S.length&&O.size>0)I();else if(E<S.length){let e=S[E];e&&(e.isInstalled?i({type:`manage-plugins`,targetPlugin:e.entry.name,targetMarketplace:e.marketplaceName}):(y(e),h(`plugin-details`),N(0),ce(null)))}}},{context:`Select`,isActive:m===`plugin-list`}),c({"plugin:toggle":()=>{if(E<S.length){let e=S[E];if(e&&!e.isInstalled){let t=new Set(O);t.has(e.pluginId)?t.delete(e.pluginId):t.add(e.pluginId),k(t)}}},"plugin:install":()=>{O.size>0&&I()}},{context:`Plugin`,isActive:m===`plugin-list`});let me=An.useMemo(()=>{if(!v)return[];let e=v.entry.homepage;return xn(e,bn(v))},[v]);if(c({"select:previous":()=>{M>0&&N(M-1)},"select:next":()=>{M<me.length-1&&N(M+1)},"select:accept":()=>{if(!v)return;let e=me[M]?.action,t=v.entry.homepage,n=bn(v);e===`install-user`?pe(v,`user`):e===`install-project`?pe(v,`project`):e===`install-local`?pe(v,`local`):e===`homepage`&&t?De(t):e===`github`&&n?De(`https://github.com/${n}`):e===`back`&&(h(`plugin-list`),y(null))}},{context:`Select`,isActive:m===`plugin-details`&&!!v}),typeof m==`object`&&m.type===`plugin-options`){let{plugin:e,pluginId:t}=m;function n(e){r(e),o&&o(),i({type:`menu`})}return(0,G.jsx)(pn,{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)(d,{children:`Loading…`});if(e)return(0,G.jsx)(d,{color:`error`,children:e});if(m===`marketplace-list`)return b.length===0?(0,G.jsxs)(u,{flexDirection:`column`,children:[(0,G.jsx)(u,{marginBottom:1,children:(0,G.jsx)(d,{bold:!0,children:`Select marketplace`})}),(0,G.jsx)(d,{children:`No marketplaces configured.`}),(0,G.jsxs)(d,{dimColor:!0,children:[`Add a marketplace first using `,`'Add marketplace'`,`.`]}),(0,G.jsx)(u,{marginTop:1,paddingLeft:1,children:(0,G.jsx)(d,{dimColor:!0,children:(0,G.jsx)(V,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`})})})]}):(0,G.jsxs)(u,{flexDirection:`column`,children:[(0,G.jsx)(u,{marginBottom:1,children:(0,G.jsx)(d,{bold:!0,children:`Select marketplace`})}),ue&&(0,G.jsx)(u,{marginBottom:1,flexDirection:`column`,children:(0,G.jsxs)(d,{color:`warning`,children:[a.warning,` `,ue]})}),b.map((e,t)=>(0,G.jsxs)(u,{flexDirection:`column`,marginBottom:+(t<b.length-1),children:[(0,G.jsx)(u,{children:(0,G.jsxs)(d,{color:E===t?`suggestion`:void 0,children:[E===t?a.pointer:` `,` `,e.name]})}),(0,G.jsx)(u,{marginLeft:2,children:(0,G.jsxs)(d,{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)(u,{marginTop:1,children:(0,G.jsx)(d,{dimColor:!0,italic:!0,children:(0,G.jsxs)(f,{children:[(0,G.jsx)(V,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`select`}),(0,G.jsx)(V,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`})]})})})]});if(m===`plugin-details`&&v){let e=v.entry.homepage,t=xn(e,bn(v));return(0,G.jsxs)(u,{flexDirection:`column`,children:[(0,G.jsx)(u,{marginBottom:1,children:(0,G.jsx)(d,{bold:!0,children:`Plugin Details`})}),(0,G.jsxs)(u,{flexDirection:`column`,marginBottom:1,children:[(0,G.jsx)(d,{bold:!0,children:v.entry.name}),v.entry.version&&(0,G.jsxs)(d,{dimColor:!0,children:[`Version: `,v.entry.version]}),v.entry.description&&(0,G.jsx)(u,{marginTop:1,children:(0,G.jsx)(d,{children:v.entry.description})}),v.entry.author&&(0,G.jsx)(u,{marginTop:1,children:(0,G.jsxs)(d,{dimColor:!0,children:[`By:`,` `,typeof v.entry.author==`string`?v.entry.author:v.entry.author.name]})})]}),(0,G.jsxs)(u,{flexDirection:`column`,marginBottom:1,children:[(0,G.jsx)(d,{bold:!0,children:`Will install:`}),v.entry.commands&&(0,G.jsxs)(d,{dimColor:!0,children:[`· Commands:`,` `,Array.isArray(v.entry.commands)?v.entry.commands.join(`, `):Object.keys(v.entry.commands).join(`, `)]}),v.entry.agents&&(0,G.jsxs)(d,{dimColor:!0,children:[`· Agents:`,` `,Array.isArray(v.entry.agents)?v.entry.agents.join(`, `):Object.keys(v.entry.agents).join(`, `)]}),v.entry.hooks&&(0,G.jsxs)(d,{dimColor:!0,children:[`· Hooks: `,Object.keys(v.entry.hooks).join(`, `)]}),v.entry.mcpServers&&(0,G.jsxs)(d,{dimColor:!0,children:[`· MCP Servers:`,` `,Array.isArray(v.entry.mcpServers)?v.entry.mcpServers.join(`, `):typeof v.entry.mcpServers==`object`?Object.keys(v.entry.mcpServers).join(`, `):`configured`]}),!v.entry.commands&&!v.entry.agents&&!v.entry.hooks&&!v.entry.mcpServers&&(typeof v.entry.source==`object`&&`source`in v.entry.source&&(v.entry.source.source===`github`||v.entry.source.source===`url`||v.entry.source.source===`npm`||v.entry.source.source===`pip`)?(0,G.jsx)(d,{dimColor:!0,children:`· Component summary not available for remote plugin`}):(0,G.jsx)(d,{dimColor:!0,children:`· Components will be discovered at installation`}))]}),(0,G.jsx)(_n,{}),P&&(0,G.jsx)(u,{marginBottom:1,children:(0,G.jsxs)(d,{color:`error`,children:[`Error: `,P]})}),(0,G.jsx)(u,{flexDirection:`column`,children:t.map((e,t)=>(0,G.jsxs)(u,{children:[M===t&&(0,G.jsx)(d,{children:`> `}),M!==t&&(0,G.jsx)(d,{children:` `}),(0,G.jsx)(d,{bold:M===t,children:oe&&e.action===`install`?`Installing…`:e.label})]},e.action))}),(0,G.jsx)(u,{marginTop:1,paddingLeft:1,children:(0,G.jsx)(d,{dimColor:!0,children:(0,G.jsxs)(f,{children:[(0,G.jsx)(V,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`select`}),(0,G.jsx)(V,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]})})})]})}if(S.length===0)return(0,G.jsxs)(u,{flexDirection:`column`,children:[(0,G.jsx)(u,{marginBottom:1,children:(0,G.jsx)(d,{bold:!0,children:`Install plugins`})}),(0,G.jsx)(d,{dimColor:!0,children:`No new plugins available to install.`}),(0,G.jsx)(d,{dimColor:!0,children:`All plugins from this marketplace are already installed.`}),(0,G.jsx)(u,{marginLeft:3,children:(0,G.jsx)(d,{dimColor:!0,italic:!0,children:(0,G.jsx)(V,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`})})})]});let he=j.getVisibleItems(S);return(0,G.jsxs)(u,{flexDirection:`column`,children:[(0,G.jsx)(u,{marginBottom:1,children:(0,G.jsx)(d,{bold:!0,children:`Install Plugins`})}),j.scrollPosition.canScrollUp&&(0,G.jsx)(u,{children:(0,G.jsxs)(d,{dimColor:!0,children:[` `,a.arrowUp,` more above`]})}),he.map((t,n)=>{let r=j.toActualIndex(n),i=E===r,o=O.has(t.pluginId),s=re.has(t.pluginId);return(0,G.jsxs)(u,{flexDirection:`column`,marginBottom:n===he.length-1&&!e?0:1,children:[(0,G.jsxs)(u,{children:[(0,G.jsxs)(d,{color:i?`suggestion`:void 0,children:[i?a.pointer:` `,` `]}),(0,G.jsxs)(d,{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)(d,{dimColor:!0,children:[` [`,t.entry.category,`]`]}),t.entry.tags?.includes(`community-managed`)&&(0,G.jsx)(d,{dimColor:!0,children:` [Community Managed]`}),t.isInstalled&&(0,G.jsx)(d,{dimColor:!0,children:` (installed)`}),T&&g===`claude-plugins-official`&&(0,G.jsxs)(d,{dimColor:!0,children:[` · `,Dt(T.get(t.pluginId)??0),` installs`]})]})]}),t.entry.description&&(0,G.jsxs)(u,{marginLeft:4,children:[(0,G.jsx)(d,{dimColor:!0,children:ut(t.entry.description,60)}),t.entry.version&&(0,G.jsxs)(d,{dimColor:!0,children:[` · v`,t.entry.version]})]})]},t.pluginId)}),j.scrollPosition.canScrollDown&&(0,G.jsx)(u,{children:(0,G.jsxs)(d,{dimColor:!0,children:[` `,a.arrowDown,` more below`]})}),e&&(0,G.jsx)(u,{marginTop:1,children:(0,G.jsxs)(d,{color:`error`,children:[a.cross,` `,e]})}),(0,G.jsx)(Sn,{hasSelection:O.size>0})]})}var An,W,G,jn=e((()=>{i(),An=t(h(),1),W=t(h(),1),je(),S(),Ve(),T(),Ye(),rt(),Qe(),me(),wt(),we(),ge(),We(),Xe(),N(),F(),ft(),dt(),gn(),yn(),wn(),On(),G=w()}));function Mn({error:e,setError:t,result:n,setResult:r,setViewState:i,onInstallComplete:o,onSearchModeChange:s,targetPlugin:l}){let[h,_]=(0,K.useState)(`plugin-list`),[y,x]=(0,K.useState)(null),[S,C]=(0,K.useState)([]),[ee,w]=(0,K.useState)(!0),[T,ne]=(0,K.useState)(null),[E,D]=(0,K.useState)(!1),O=(0,K.useCallback)(e=>{D(e),s?.(e)},[s]),{query:k,setQuery:re,cursorOffset:ie}=Ut({isActive:h===`plugin-list`&&E&&!ee,onExit:()=>{O(!1)}}),A=m(),{columns:j}=b(),M=(0,K.useMemo)(()=>{if(!k)return S;let e=k.toLowerCase();return S.filter(t=>t.entry.name.toLowerCase().includes(e)||t.entry.description?.toLowerCase().includes(e)||t.marketplaceName.toLowerCase().includes(e))},[S,k]),[N,oe]=(0,K.useState)(0),[P,ce]=(0,K.useState)(new Set),[le,ue]=(0,K.useState)(new Set),F=Tn({totalItems:M.length,selectedIndex:N});(0,K.useEffect)(()=>{oe(0)},[k]);let[I,pe]=(0,K.useState)(0),[me,he]=(0,K.useState)(!1),[ge,L]=(0,K.useState)(null),[_e,be]=(0,K.useState)(null),[Se,Ce]=(0,K.useState)(null);(0,K.useEffect)(()=>{async function e(){try{let e=await B(),{marketplaces:n,failures:r}=await ae(e),i=[];for(let{name:e,data:t}of n)if(t)for(let n of t.plugins){let t=ve(n.name,e);i.push({entry:n,marketplaceName:e,pluginId:t,isInstalled:R(t)})}let a=i.filter(e=>!e.isInstalled&&!de(e.pluginId));try{let e=await Ot();ne(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){nt(`Failed to fetch install counts: ${$e(e)}`),a.sort((e,t)=>e.entry.name.localeCompare(t.entry.name))}C(a);let o=Object.keys(e).length;if(a.length===0){let e=await se({configuredMarketplaceCount:o,failedMarketplaceCount:r.length});Ce(e)}let s=ye(r,te(n,e=>e.data!==null));if(s)if(s.type===`warning`)be(`${s.message}. Showing available plugins.`);else throw Error(s.message);if(l){let e=i.find(e=>e.entry.name===l);e?e.isInstalled?t(`Plugin '${e.pluginId}' is already installed. Use '/plugin' to manage existing plugins.`):(x(e),_(`plugin-details`)):t(`Plugin "${l}" not found in any marketplace`)}}catch(e){t(e instanceof Error?e.message:`Failed to load plugins`)}finally{w(!1)}}e()},[t,l]);let we=async()=>{if(P.size===0)return;let e=S.filter(e=>P.has(e.pluginId));ue(new Set(e.map(e=>e.pluginId)));let n=0,a=0,s=[];for(let t of e){let e=await xe({pluginId:t.pluginId,entry:t.entry,marketplaceName:t.marketplaceName,scope:`user`});e.success?n++:(a++,s.push({name:t.entry.name,reason:e.error}))}ue(new Set),ce(new Set),fe(),a===0?r(`✓ Installed ${n} ${H(n,`plugin`)}. Run /reload-plugins to activate.`):n===0?t(`Failed to install: ${qe(s,!0)}`):r(`✓ Installed ${n} of ${n+a} plugins. Failed: ${qe(s,!1)}. Run /reload-plugins to activate successfully installed plugins.`),n>0&&o&&await o(),i({type:`menu`})},z=async(e,t=`user`)=>{he(!0),L(null);let n=await xe({pluginId:e.pluginId,entry:e.entry,marketplaceName:e.marketplaceName,scope:t});if(n.success){let t=await fn(e.pluginId);if(t){he(!1),_({type:`plugin-options`,plugin:t,pluginId:e.pluginId});return}r(n.message),o&&await o(),i({type:`menu`})}else he(!1),L(n.error)};(0,K.useEffect)(()=>{e&&r(e)},[e,r]),p(`confirm:no`,()=>{_(`plugin-list`),x(null)},{context:`Confirmation`,isActive:h===`plugin-details`}),p(`confirm:no`,()=>{i({type:`menu`})},{context:`Confirmation`,isActive:h===`plugin-list`&&!E}),g((e,t)=>{let n=!t.ctrl&&!t.meta;E||(e===`/`&&n?(O(!0),re(``)):n&&e.length>0&&!/^\s+$/.test(e)&&e!==`j`&&e!==`k`&&e!==`i`&&(O(!0),re(e)))},{isActive:h===`plugin-list`&&!ee}),c({"select:previous":()=>{N===0?O(!0):F.handleSelectionChange(N-1,oe)},"select:next":()=>{N<M.length-1&&F.handleSelectionChange(N+1,oe)},"select:accept":()=>{if(N===M.length&&P.size>0)we();else if(N<M.length){let e=M[N];e&&(e.isInstalled?i({type:`manage-plugins`,targetPlugin:e.entry.name,targetMarketplace:e.marketplaceName}):(x(e),_(`plugin-details`),pe(0),L(null)))}}},{context:`Select`,isActive:h===`plugin-list`&&!E}),c({"plugin:toggle":()=>{if(N<M.length){let e=M[N];if(e&&!e.isInstalled){let t=new Set(P);t.has(e.pluginId)?t.delete(e.pluginId):t.add(e.pluginId),ce(t)}}},"plugin:install":()=>{P.size>0&&we()}},{context:`Plugin`,isActive:h===`plugin-list`&&!E});let Te=Fn.useMemo(()=>{if(!y)return[];let e=y.entry.homepage;return xn(e,bn(y))},[y]);if(c({"select:previous":()=>{I>0&&pe(I-1)},"select:next":()=>{I<Te.length-1&&pe(I+1)},"select:accept":()=>{if(!y)return;let e=Te[I]?.action,t=y.entry.homepage,n=bn(y);e===`install-user`?z(y,`user`):e===`install-project`?z(y,`project`):e===`install-local`?z(y,`local`):e===`homepage`&&t?De(t):e===`github`&&n?De(`https://github.com/${n}`):e===`back`&&(_(`plugin-list`),x(null))}},{context:`Select`,isActive:h===`plugin-details`&&!!y}),typeof h==`object`&&h.type===`plugin-options`){let{plugin:e,pluginId:t}=h;function n(e){r(e),o&&o(),i({type:`menu`})}return(0,q.jsx)(pn,{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,q.jsx)(d,{children:`Loading…`});if(e)return(0,q.jsx)(d,{color:`error`,children:e});if(h===`plugin-details`&&y){let e=y.entry.homepage,t=xn(e,bn(y));return(0,q.jsxs)(u,{flexDirection:`column`,children:[(0,q.jsx)(u,{marginBottom:1,children:(0,q.jsx)(d,{bold:!0,children:`Plugin details`})}),(0,q.jsxs)(u,{flexDirection:`column`,marginBottom:1,children:[(0,q.jsx)(d,{bold:!0,children:y.entry.name}),(0,q.jsxs)(d,{dimColor:!0,children:[`from `,y.marketplaceName]}),y.entry.version&&(0,q.jsxs)(d,{dimColor:!0,children:[`Version: `,y.entry.version]}),y.entry.description&&(0,q.jsx)(u,{marginTop:1,children:(0,q.jsx)(d,{children:y.entry.description})}),y.entry.author&&(0,q.jsx)(u,{marginTop:1,children:(0,q.jsxs)(d,{dimColor:!0,children:[`By:`,` `,typeof y.entry.author==`string`?y.entry.author:y.entry.author.name]})})]}),(0,q.jsx)(_n,{}),ge&&(0,q.jsx)(u,{marginBottom:1,children:(0,q.jsxs)(d,{color:`error`,children:[`Error: `,ge]})}),(0,q.jsx)(u,{flexDirection:`column`,children:t.map((e,t)=>(0,q.jsxs)(u,{children:[I===t&&(0,q.jsx)(d,{children:`> `}),I!==t&&(0,q.jsx)(d,{children:` `}),(0,q.jsx)(d,{bold:I===t,children:me&&e.action.startsWith(`install-`)?`Installing…`:e.label})]},e.action))}),(0,q.jsx)(u,{marginTop:1,children:(0,q.jsx)(d,{dimColor:!0,children:(0,q.jsxs)(f,{children:[(0,q.jsx)(V,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`select`}),(0,q.jsx)(V,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]})})})]})}if(S.length===0)return(0,q.jsxs)(u,{flexDirection:`column`,children:[(0,q.jsx)(u,{marginBottom:1,children:(0,q.jsx)(d,{bold:!0,children:`Discover plugins`})}),(0,q.jsx)(Pn,{reason:Se}),(0,q.jsx)(u,{marginTop:1,children:(0,q.jsx)(d,{dimColor:!0,italic:!0,children:`Esc to go back`})})]});let Ee=F.getVisibleItems(M);return(0,q.jsxs)(u,{flexDirection:`column`,children:[(0,q.jsxs)(u,{children:[(0,q.jsx)(d,{bold:!0,children:`Discover plugins`}),F.needsPagination&&(0,q.jsxs)(d,{dimColor:!0,children:[` `,`(`,F.scrollPosition.current,`/`,F.scrollPosition.total,`)`]})]}),(0,q.jsx)(u,{marginBottom:1,children:(0,q.jsx)(v,{query:k,isFocused:E,isTerminalFocused:A,width:j-4,cursorOffset:ie})}),_e&&(0,q.jsx)(u,{marginBottom:1,children:(0,q.jsxs)(d,{color:`warning`,children:[a.warning,` `,_e]})}),M.length===0&&k&&(0,q.jsx)(u,{marginBottom:1,children:(0,q.jsxs)(d,{dimColor:!0,children:[`No plugins match "`,k,`"`]})}),F.scrollPosition.canScrollUp&&(0,q.jsx)(u,{children:(0,q.jsxs)(d,{dimColor:!0,children:[` `,a.arrowUp,` more above`]})}),Ee.map((t,n)=>{let r=F.toActualIndex(n),i=N===r,o=P.has(t.pluginId),s=le.has(t.pluginId);return(0,q.jsxs)(u,{flexDirection:`column`,marginBottom:n===Ee.length-1&&!e?0:1,children:[(0,q.jsxs)(u,{children:[(0,q.jsxs)(d,{color:i&&!E?`suggestion`:void 0,children:[i&&!E?a.pointer:` `,` `]}),(0,q.jsxs)(d,{children:[s?a.ellipsis:o?a.radioOn:a.radioOff,` `,t.entry.name,(0,q.jsxs)(d,{dimColor:!0,children:[` · `,t.marketplaceName]}),t.entry.tags?.includes(`community-managed`)&&(0,q.jsx)(d,{dimColor:!0,children:` [Community Managed]`}),T&&t.marketplaceName===`claude-plugins-official`&&(0,q.jsxs)(d,{dimColor:!0,children:[` · `,Dt(T.get(t.pluginId)??0),` installs`]})]})]}),t.entry.description&&(0,q.jsx)(u,{marginLeft:4,children:(0,q.jsx)(d,{dimColor:!0,children:ut(t.entry.description,60)})})]},`${F.startIndex}-${t.pluginId}`)}),F.scrollPosition.canScrollDown&&(0,q.jsx)(u,{children:(0,q.jsxs)(d,{dimColor:!0,children:[` `,a.arrowDown,` more below`]})}),e&&(0,q.jsx)(u,{marginTop:1,children:(0,q.jsxs)(d,{color:`error`,children:[a.cross,` `,e]})}),(0,q.jsx)(Nn,{hasSelection:P.size>0,canToggle:N<M.length&&!M[N]?.isInstalled})]})}function Nn({hasSelection:e,canToggle:t}){return(0,q.jsx)(u,{marginTop:1,children:(0,q.jsx)(d,{dimColor:!0,italic:!0,children:(0,q.jsxs)(f,{children:[e&&(0,q.jsx)(V,{action:`plugin:install`,context:`Plugin`,fallback:`i`,description:`install`,bold:!0}),(0,q.jsx)(d,{children:`type to search`}),t&&(0,q.jsx)(V,{action:`plugin:toggle`,context:`Plugin`,fallback:`Space`,description:`toggle`}),(0,q.jsx)(V,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`details`}),(0,q.jsx)(V,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]})})})}function Pn({reason:e}){switch(e){case`git-not-installed`:return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(d,{dimColor:!0,children:`Git is required to install marketplaces.`}),(0,q.jsx)(d,{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)(d,{dimColor:!0,children:`Your organization policy does not allow any external marketplaces.`}),(0,q.jsx)(d,{dimColor:!0,children:`Contact your administrator.`})]});case`policy-restricts-sources`:return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(d,{dimColor:!0,children:`Your organization restricts which marketplaces can be added.`}),(0,q.jsx)(d,{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)(d,{dimColor:!0,children:`Failed to load marketplace data.`}),(0,q.jsx)(d,{dimColor:!0,children:`Check your network connection.`})]});case`all-plugins-installed`:return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(d,{dimColor:!0,children:`All available plugins are already installed.`}),(0,q.jsx)(d,{dimColor:!0,children:`Check for new plugins later or add more marketplaces.`})]});default:return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(d,{dimColor:!0,children:`No plugins available.`}),(0,q.jsx)(d,{dimColor:!0,children:`Add a marketplace first using the Marketplaces tab.`})]})}}var Fn,K,q,In=e((()=>{i(),Fn=t(h(),1),K=t(h(),1),je(),Ht(),S(),Wt(),ze(),Ve(),T(),Ye(),rt(),Qe(),me(),wt(),we(),ge(),We(),Xe(),N(),F(),ft(),dt(),gn(),yn(),wn(),On(),q=w()}));function Ln({setViewState:e,error:t,setError:n,setResult:r,exitState:i,onManageComplete:o,targetMarketplace:s,action:l}){let[m,h]=(0,zn.useState)([]),[_,v]=(0,zn.useState)(!0),[y,b]=(0,zn.useState)(0),[x,S]=(0,zn.useState)(!1),[C,ee]=(0,zn.useState)(null),[w,T]=(0,zn.useState)(null),[ne,E]=(0,zn.useState)(null),[D,ie]=(0,zn.useState)(`list`),[A,j]=(0,zn.useState)(null),[M,N]=(0,zn.useState)(0),oe=(0,zn.useRef)(!1);(0,zn.useEffect)(()=>{async function e(){try{let e=await B(),{enabled:r,disabled:i}=await ue(),a=[...r,...i],{marketplaces:o,failures:c}=await ae(e),u=[];for(let{name:e,config:t,data:n}of o){let r=a.filter(t=>t.source.endsWith(`@${e}`));u.push({name:e,source:le(t.source),lastUpdated:t.lastUpdated,pluginCount:n?.plugins.length,installedPlugins:r,pendingUpdate:!1,pendingRemove:!1,autoUpdate:re(e,t)})}u.sort((e,t)=>e.name===`claude-plugin-directory`?-1:t.name===`claude-plugin-directory`?1:e.name.localeCompare(t.name)),h(u);let d=ye(c,te(o,e=>e.data!==null));if(d)if(d.type===`warning`)ee(d.message);else throw Error(d.message);if(s&&!oe.current&&!t){oe.current=!0;let e=u.findIndex(e=>e.name===s);if(e>=0){let t=u[e];if(l){b(e+1);let t=[...u];l===`update`?t[e].pendingUpdate=!0:l===`remove`&&(t[e].pendingRemove=!0),h(t),setTimeout(ce,100,t)}else t&&(b(e+1),j(t),ie(`details`))}else n&&n(`Marketplace not found: ${s}`)}}catch(e){n&&n(e instanceof Error?e.message:`Failed to load marketplaces`),ee(e instanceof Error?e.message:`Failed to load marketplaces`)}finally{v(!1)}}e()},[s,l,t]);let se=()=>m.some(e=>e.pendingUpdate||e.pendingRemove),P=()=>({updateCount:te(m,e=>e.pendingUpdate),removeCount:te(m,e=>e.pendingRemove)}),ce=async t=>{let i=t||m,s=D===`details`;S(!0),ee(null),T(null),E(null);try{let t=O(`userSettings`),n=0,c=0,l=new Set;for(let e of i){if(e.pendingRemove){if(e.installedPlugins&&e.installedPlugins.length>0){let n={...t?.enabledPlugins};for(let t of e.installedPlugins){let r=ve(t.name,e.name);n[r]=!1}k(`userSettings`,{enabledPlugins:n})}await Ae(e.name),c++,e.name,e.installedPlugins?.length;continue}e.pendingUpdate&&(await Fe(e.name,e=>{E(e)}),n++,l.add(e.name.toLowerCase()),e.name)}let u=0;l.size>0&&(u=(await $t(l)).length),fe(),o&&await o();let d=await B(),{enabled:f,disabled:p}=await ue(),m=[...f,...p],{marketplaces:g}=await ae(d),_=[];for(let{name:e,config:t,data:n}of g){let r=m.filter(t=>t.source.endsWith(`@${e}`));_.push({name:e,source:le(t.source),lastUpdated:t.lastUpdated,pluginCount:n?.plugins.length,installedPlugins:r,pendingUpdate:!1,pendingRemove:!1,autoUpdate:re(e,t)})}if(_.sort((e,t)=>e.name===`claude-plugin-directory`?-1:t.name===`claude-plugin-directory`?1:e.name.localeCompare(t.name)),h(_),s&&A){let e=_.find(e=>e.name===A.name);e&&j(e)}let v=[];if(n>0){let e=u>0?` (${u} ${H(u,`plugin`)} bumped)`:``;v.push(`Updated ${n} ${H(n,`marketplace`)}${e}`)}if(c>0&&v.push(`Removed ${c} ${H(c,`marketplace`)}`),v.length>0){let t=`${a.tick} ${v.join(`, `)}`;s?T(t):(r(t),setTimeout(e,2e3,{type:`menu`}))}else s||e({type:`menu`})}catch(e){let t=$e(e);ee(t),n&&n(t)}finally{S(!1),E(null)}},F=async()=>{if(!A)return;let e=m.map(e=>e.name===A.name?{...e,pendingRemove:!0}:e);h(e),await ce(e)},I=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 ot()||t.push({label:e.autoUpdate?`Disable auto-update`:`Enable auto-update`,value:`toggle-auto-update`}),t.push({label:`Remove marketplace`,value:`remove`}),t},de=async e=>{let t=!e.autoUpdate;try{await Je(e.name,t),h(n=>n.map(n=>n.name===e.name?{...n,autoUpdate:t}:n)),j(e=>e&&{...e,autoUpdate:t})}catch(e){ee(e instanceof Error?e.message:`Failed to update setting`)}};if(p(`confirm:no`,()=>{ie(`list`),N(0)},{context:`Confirmation`,isActive:!x&&(D===`details`||D===`confirm-remove`)}),p(`confirm:no`,()=>{h(e=>e.map(e=>({...e,pendingUpdate:!1,pendingRemove:!1}))),b(0)},{context:`Confirmation`,isActive:!x&&D===`list`&&se()}),p(`confirm:no`,()=>{e({type:`menu`})},{context:`Confirmation`,isActive:!x&&D===`list`&&!se()}),c({"select:previous":()=>b(e=>Math.max(0,e-1)),"select:next":()=>{let e=m.length+1;b(t=>Math.min(e-1,t+1))},"select:accept":()=>{let t=y-1;if(y===0)e({type:`add-marketplace`});else if(se())ce();else{let e=m[t];e&&(j(e),ie(`details`),N(0))}}},{context:`Select`,isActive:!x&&D===`list`}),g(e=>{let t=y-1;if((e===`u`||e===`U`)&&t>=0)h(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=m[t];e&&(j(e),ie(`confirm-remove`))}},{isActive:!x&&D===`list`}),c({"select:previous":()=>N(e=>Math.max(0,e-1)),"select:next":()=>{let e=I(A);N(t=>Math.min(e.length-1,t+1))},"select:accept":()=>{if(!A)return;let t=I(A)[M];if(t?.value===`browse`)e({type:`browse-marketplace`,targetMarketplace:A.name});else if(t?.value===`update`){let e=m.map(e=>e.name===A.name?{...e,pendingUpdate:!0}:e);h(e),ce(e)}else t?.value===`toggle-auto-update`?de(A):t?.value===`remove`&&ie(`confirm-remove`)}},{context:`Select`,isActive:!x&&D===`details`}),g(e=>{e===`y`||e===`Y`?F():(e===`n`||e===`N`)&&(ie(`list`),j(null))},{isActive:!x&&D===`confirm-remove`}),_)return(0,J.jsx)(d,{children:`Loading marketplaces…`});if(m.length===0)return(0,J.jsxs)(u,{flexDirection:`column`,children:[(0,J.jsx)(u,{marginBottom:1,children:(0,J.jsx)(d,{bold:!0,children:`Manage marketplaces`})}),(0,J.jsxs)(u,{flexDirection:`row`,gap:1,children:[(0,J.jsxs)(d,{color:`suggestion`,children:[a.pointer,` +`]}),(0,J.jsx)(d,{bold:!0,color:`suggestion`,children:`Add Marketplace`})]}),(0,J.jsx)(u,{marginLeft:3,children:(0,J.jsx)(d,{dimColor:!0,italic:!0,children:i.pending?(0,J.jsxs)(J.Fragment,{children:[`Press `,i.keyName,` again to go back`]}):(0,J.jsxs)(f,{children:[(0,J.jsx)(V,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`select`}),(0,J.jsx)(V,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`})]})})})]});if(D===`confirm-remove`&&A){let e=A.installedPlugins?.length||0;return(0,J.jsxs)(u,{flexDirection:`column`,children:[(0,J.jsxs)(d,{bold:!0,color:`warning`,children:[`Remove marketplace `,(0,J.jsx)(d,{italic:!0,children:A.name}),`?`]}),(0,J.jsxs)(u,{flexDirection:`column`,children:[e>0&&(0,J.jsx)(u,{marginTop:1,children:(0,J.jsxs)(d,{color:`warning`,children:[`This will also uninstall `,e,` `,H(e,`plugin`),` from this marketplace:`]})}),A.installedPlugins&&A.installedPlugins.length>0&&(0,J.jsx)(u,{flexDirection:`column`,marginTop:1,marginLeft:2,children:A.installedPlugins.map(e=>(0,J.jsxs)(d,{dimColor:!0,children:[`• `,e.name]},e.name))}),(0,J.jsx)(u,{marginTop:1,children:(0,J.jsxs)(d,{children:[`Press `,(0,J.jsx)(d,{bold:!0,children:`y`}),` to confirm or `,(0,J.jsx)(d,{bold:!0,children:`n`}),` to cancel`]})})]})]})}if(D===`details`&&A){let e=A.pendingUpdate||x,t=I(A);return(0,J.jsxs)(u,{flexDirection:`column`,children:[(0,J.jsx)(d,{bold:!0,children:A.name}),(0,J.jsx)(d,{dimColor:!0,children:A.source}),(0,J.jsx)(u,{marginTop:1,children:(0,J.jsxs)(d,{children:[A.pluginCount||0,` available `,H(A.pluginCount||0,`plugin`)]})}),A.installedPlugins&&A.installedPlugins.length>0&&(0,J.jsxs)(u,{flexDirection:`column`,marginTop:1,children:[(0,J.jsxs)(d,{bold:!0,children:[`Installed plugins (`,A.installedPlugins.length,`):`]}),(0,J.jsx)(u,{flexDirection:`column`,marginLeft:1,children:A.installedPlugins.map(e=>(0,J.jsxs)(u,{flexDirection:`row`,gap:1,children:[(0,J.jsx)(d,{children:a.bullet}),(0,J.jsxs)(u,{flexDirection:`column`,children:[(0,J.jsx)(d,{children:e.name}),(0,J.jsx)(d,{dimColor:!0,children:e.manifest.description})]})]},e.name))})]}),e&&(0,J.jsxs)(u,{marginTop:1,flexDirection:`column`,children:[(0,J.jsx)(d,{color:`claude`,children:`Updating marketplace…`}),ne&&(0,J.jsx)(d,{dimColor:!0,children:ne})]}),!e&&w&&(0,J.jsx)(u,{marginTop:1,children:(0,J.jsx)(d,{color:`claude`,children:w})}),!e&&C&&(0,J.jsx)(u,{marginTop:1,children:(0,J.jsx)(d,{color:`error`,children:C})}),!e&&(0,J.jsx)(u,{flexDirection:`column`,marginTop:1,children:t.map((e,t)=>{if(!e)return null;let n=t===M;return(0,J.jsxs)(u,{children:[(0,J.jsxs)(d,{color:n?`suggestion`:void 0,children:[n?a.pointer:` `,` `,e.label]}),e.secondaryLabel&&(0,J.jsxs)(d,{dimColor:!0,children:[` `,e.secondaryLabel]})]},e.value)})}),!e&&!ot()&&A.autoUpdate&&(0,J.jsx)(u,{marginTop:1,children:(0,J.jsx)(d,{dimColor:!0,children:`Auto-update enabled. Work Mate will automatically update this marketplace and its installed plugins.`})}),(0,J.jsx)(u,{marginLeft:3,children:(0,J.jsx)(d,{dimColor:!0,italic:!0,children:e?(0,J.jsx)(J.Fragment,{children:`Please wait…`}):(0,J.jsxs)(f,{children:[(0,J.jsx)(V,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`select`}),(0,J.jsx)(V,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`})]})})})]})}let{updateCount:pe,removeCount:me}=P();return(0,J.jsxs)(u,{flexDirection:`column`,children:[(0,J.jsx)(u,{marginBottom:1,children:(0,J.jsx)(d,{bold:!0,children:`Manage marketplaces`})}),(0,J.jsxs)(u,{flexDirection:`row`,gap:1,marginBottom:1,children:[(0,J.jsxs)(d,{color:y===0?`suggestion`:void 0,children:[y===0?a.pointer:` `,` +`]}),(0,J.jsx)(d,{bold:!0,color:y===0?`suggestion`:void 0,children:`Add Marketplace`})]}),(0,J.jsx)(u,{flexDirection:`column`,children:m.map((e,t)=>{let n=t+1===y,r=[];return e.pendingUpdate&&r.push(`UPDATE`),e.pendingRemove&&r.push(`REMOVE`),(0,J.jsxs)(u,{flexDirection:`row`,gap:1,marginBottom:1,children:[(0,J.jsxs)(d,{color:n?`suggestion`:void 0,children:[n?a.pointer:` `,` `,e.pendingRemove?a.cross:a.bullet]}),(0,J.jsxs)(u,{flexDirection:`column`,flexGrow:1,children:[(0,J.jsxs)(u,{flexDirection:`row`,gap:1,children:[(0,J.jsxs)(d,{bold:!0,strikethrough:e.pendingRemove,dimColor:e.pendingRemove,children:[e.name===`claude-plugins-official`&&(0,J.jsx)(d,{color:`claude`,children:`✻ `}),e.name,e.name===`claude-plugins-official`&&(0,J.jsx)(d,{color:`claude`,children:` ✻`})]}),r.length>0&&(0,J.jsxs)(d,{color:`warning`,children:[`[`,r.join(`, `),`]`]})]}),(0,J.jsx)(d,{dimColor:!0,children:e.source}),(0,J.jsxs)(d,{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)})}),se()&&(0,J.jsxs)(u,{marginTop:1,flexDirection:`column`,children:[(0,J.jsxs)(d,{children:[(0,J.jsx)(d,{bold:!0,children:`Pending changes:`}),` `,(0,J.jsx)(d,{dimColor:!0,children:`Enter to apply`})]}),pe>0&&(0,J.jsxs)(d,{children:[`• Update `,pe,` `,H(pe,`marketplace`)]}),me>0&&(0,J.jsxs)(d,{color:`warning`,children:[`• Remove `,me,` `,H(me,`marketplace`)]})]}),x&&(0,J.jsx)(u,{marginTop:1,children:(0,J.jsx)(d,{color:`claude`,children:`Processing changes…`})}),C&&(0,J.jsx)(u,{marginTop:1,children:(0,J.jsx)(d,{color:`error`,children:C})}),(0,J.jsx)(Rn,{exitState:i,hasPendingActions:se()})]})}function Rn({exitState:e,hasPendingActions:t}){return e.pending?(0,J.jsx)(u,{marginTop:1,children:(0,J.jsxs)(d,{dimColor:!0,italic:!0,children:[`Press `,e.keyName,` again to go back`]})}):(0,J.jsx)(u,{marginTop:1,children:(0,J.jsx)(d,{dimColor:!0,italic:!0,children:(0,J.jsxs)(f,{children:[t&&(0,J.jsx)(V,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`apply changes`}),!t&&(0,J.jsx)(V,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`select`}),!t&&(0,J.jsx)(o,{shortcut:`u`,action:`update`}),!t&&(0,J.jsx)(o,{shortcut:`r`,action:`remove`}),(0,J.jsx)(V,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:t?`cancel`:`go back`})]})})})}var zn,J,Bn=e((()=>{i(),zn=t(h(),1),lt(),je(),S(),Ve(),T(),at(),Qe(),me(),ge(),We(),en(),L(),E(),D(),ft(),J=w()}));function Vn(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 pe(e)}function Hn(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 Un=e((()=>{he()}));function Wn({item:e,isSelected:t}){let[n]=l();if(e.type===`plugin`){let r,i;return e.pendingToggle?(r=_(`suggestion`,n)(a.arrowRight),i=e.pendingToggle===`will-enable`?`will enable`:`will disable`):e.errorCount>0?(r=_(`error`,n)(a.cross),i=`${e.errorCount} ${H(e.errorCount,`error`)}`):e.isEnabled?(r=_(`success`,n)(a.tick),i=`enabled`):(r=_(`inactive`,n)(a.radioOff),i=`disabled`),(0,Y.jsxs)(u,{children:[(0,Y.jsx)(d,{color:t?`suggestion`:void 0,children:t?`${a.pointer} `:` `}),(0,Y.jsx)(d,{color:t?`suggestion`:void 0,children:e.name}),(0,Y.jsxs)(d,{dimColor:!t,children:[` `,(0,Y.jsx)(d,{backgroundColor:`userMessageBackground`,children:`Plugin`})]}),(0,Y.jsxs)(d,{dimColor:!0,children:[` · `,e.marketplace]}),(0,Y.jsxs)(d,{dimColor:!t,children:[` · `,r,` `]}),(0,Y.jsx)(d,{dimColor:!t,children:i})]})}if(e.type===`flagged-plugin`){let r=_(`warning`,n)(a.warning);return(0,Y.jsxs)(u,{children:[(0,Y.jsx)(d,{color:t?`suggestion`:void 0,children:t?`${a.pointer} `:` `}),(0,Y.jsx)(d,{color:t?`suggestion`:void 0,children:e.name}),(0,Y.jsxs)(d,{dimColor:!t,children:[` `,(0,Y.jsx)(d,{backgroundColor:`userMessageBackground`,children:`Plugin`})]}),(0,Y.jsxs)(d,{dimColor:!0,children:[` · `,e.marketplace]}),(0,Y.jsxs)(d,{dimColor:!t,children:[` · `,r,` `]}),(0,Y.jsx)(d,{dimColor:!t,children:`removed`})]})}if(e.type===`failed-plugin`){let r=_(`error`,n)(a.cross),i=`failed to load · ${e.errorCount} ${H(e.errorCount,`error`)}`;return(0,Y.jsxs)(u,{children:[(0,Y.jsx)(d,{color:t?`suggestion`:void 0,children:t?`${a.pointer} `:` `}),(0,Y.jsx)(d,{color:t?`suggestion`:void 0,children:e.name}),(0,Y.jsxs)(d,{dimColor:!t,children:[` `,(0,Y.jsx)(d,{backgroundColor:`userMessageBackground`,children:`Plugin`})]}),(0,Y.jsxs)(d,{dimColor:!0,children:[` · `,e.marketplace]}),(0,Y.jsxs)(d,{dimColor:!t,children:[` · `,r,` `]}),(0,Y.jsx)(d,{dimColor:!t,children:i})]})}let r,i;return e.status===`connected`?(r=_(`success`,n)(a.tick),i=`connected`):e.status===`disabled`?(r=_(`inactive`,n)(a.radioOff),i=`disabled`):e.status===`pending`?(r=_(`inactive`,n)(a.radioOff),i=`connecting…`):e.status===`needs-auth`?(r=_(`warning`,n)(a.triangleUpOutline),i=`Enter to auth`):(r=_(`error`,n)(a.cross),i=`failed`),e.indented?(0,Y.jsxs)(u,{children:[(0,Y.jsx)(d,{color:t?`suggestion`:void 0,children:t?`${a.pointer} `:` `}),(0,Y.jsx)(d,{dimColor:!t,children:`└ `}),(0,Y.jsx)(d,{color:t?`suggestion`:void 0,children:e.name}),(0,Y.jsxs)(d,{dimColor:!t,children:[` `,(0,Y.jsx)(d,{backgroundColor:`userMessageBackground`,children:`MCP`})]}),(0,Y.jsxs)(d,{dimColor:!t,children:[` · `,r,` `]}),(0,Y.jsx)(d,{dimColor:!t,children:i})]}):(0,Y.jsxs)(u,{children:[(0,Y.jsx)(d,{color:t?`suggestion`:void 0,children:t?`${a.pointer} `:` `}),(0,Y.jsx)(d,{color:t?`suggestion`:void 0,children:e.name}),(0,Y.jsxs)(d,{dimColor:!t,children:[` `,(0,Y.jsx)(d,{backgroundColor:`userMessageBackground`,children:`MCP`})]}),(0,Y.jsxs)(d,{dimColor:!t,children:[` · `,r,` `]}),(0,Y.jsx)(d,{dimColor:!t,children:i})]})}var Y,Gn=e((()=>{i(),S(),ft(),Y=w()}));async function Kn(e){try{return(await nn.readdir(e,{withFileTypes:!0})).filter(e=>e.isFile()&&e.name.endsWith(`.md`)).map(e=>tn.basename(e.name,`.md`))}catch(t){return nt(`Failed to read plugin components from ${e}: ${$e(t)}`,{level:`error`}),ct(tt(t)),[]}}async function qn(e){try{let t=await nn.readdir(e,{withFileTypes:!0}),n=[];for(let r of t)if(r.isDirectory()||r.isSymbolicLink()){let t=tn.join(e,r.name,`SKILL.md`);try{(await nn.stat(t)).isFile()&&n.push(r.name)}catch{}}return n}catch(t){return nt(`Failed to read skill directories from ${e}: ${$e(t)}`,{level:`error`}),ct(tt(t)),[]}}function Jn({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=Ne(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 Be(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 Kn(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 Kn(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 qn(e);c.push(...t)}let l=[];e.hooksConfig&&l.push(Object.keys(e.hooksConfig)),n.hooks&&l.push(n.hooks);let u=[];e.mcpServers&&u.push(Object.keys(e.mcpServers)),n.mcpServers&&u.push(n.mcpServers),r({commands:i.length>0?i:null,agents:o.length>0?o:null,skills:c.length>0?c:null,hooks:l.length>0?l:null,mcpServers:u.length>0?u:null})}else s(`Plugin ${e.name} not found in marketplace`)}catch(e){s(e instanceof Error?e.message:`Failed to load components`)}finally{a(!1)}}n()},[e.name,e.commandsPath,e.commandsPaths,e.agentsPath,e.agentsPaths,e.skillsPath,e.skillsPaths,e.hooksConfig,e.mcpServers,t]),i?null:o?(0,Z.jsxs)(u,{flexDirection:`column`,marginBottom:1,children:[(0,Z.jsx)(d,{bold:!0,children:`Components:`}),(0,Z.jsxs)(d,{dimColor:!0,children:[`Error: `,o]})]}):!n||!(n.commands||n.agents||n.skills||n.hooks||n.mcpServers)?null:(0,Z.jsxs)(u,{flexDirection:`column`,marginBottom:1,children:[(0,Z.jsx)(d,{bold:!0,children:`Installed components:`}),n.commands?(0,Z.jsxs)(d,{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)(d,{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)(d,{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)(d,{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)(d,{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 Yn(e,t){let n=(await Be(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 Xn(e){return e.filter(e=>{let t=e.source.split(`@`)[1]||`local`;return!de(`${e.name}@${t}`)})}function Zn({setViewState:e,setResult:t,onManageComplete:n,onSearchModeChange:r,targetPlugin:i,targetMarketplace:o,action:s}){let l=oe(e=>e.mcp.clients),h=oe(e=>e.mcp.tools),_=oe(e=>e.plugins.errors),y=jt(),[x,S]=(0,X.useState)(!1),C=(0,X.useCallback)(e=>{S(e),r?.(e)},[r]),ee=m(),{columns:w}=b(),[T,E]=(0,X.useState)(`plugin-list`),{query:D,setQuery:re,cursorOffset:ie}=Ut({isActive:T===`plugin-list`&&x,onExit:()=>{C(!1)}}),[A,j]=(0,X.useState)(null),[ae,M]=(0,X.useState)([]),[N,se]=(0,X.useState)([]),[P,ce]=(0,X.useState)(!0),[le,F]=(0,X.useState)(new Map),I=(0,X.useRef)(!1),de=(0,X.useRef)(void 0),pe=Pt();p(`confirm:no`,Qn.useCallback(()=>{if(T===`plugin-details`)E(`plugin-list`),j(null),B(null);else if(typeof T==`object`&&T.type===`failed-plugin-details`)E(`plugin-list`),B(null);else if(T===`configuring`)E(`plugin-details`),Ae(null);else if(typeof T==`object`&&(T.type===`plugin-options`||T.type===`configuring-options`))E(`plugin-list`),j(null),t(`Plugin enabled. Configuration skipped — run /reload-plugins to apply.`),n&&n();else if(typeof T==`object`&&T.type===`flagged-detail`)E(`plugin-list`),B(null);else if(typeof T==`object`&&T.type===`mcp-detail`)E(`plugin-list`),B(null);else if(typeof T==`object`&&T.type===`mcp-tools`)E({type:`mcp-detail`,client:T.client});else if(typeof T==`object`&&T.type===`mcp-tool-detail`)E({type:`mcp-tools`,client:T.client});else{if(le.size>0){t(`Run /reload-plugins to apply plugin changes.`);return}e({type:`menu`})}},[T,e,le,t]),{context:`Confirmation`,isActive:(T!==`plugin-list`||!x)&&T!==`confirm-project-uninstall`&&!(typeof T==`object`&&T.type===`confirm-data-cleanup`)});let me=e=>e.type===`connected`?`connected`:e.type===`disabled`?`disabled`:e.type===`pending`?`pending`:e.type===`needs-auth`?`needs-auth`:`failed`,he=(0,X.useMemo)(()=>{let e=ne(),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 N){let i=`${r.plugin.name}@${r.marketplace}`,a=e?.enabledPlugins?.[i]!==!1,o=_.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:le.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 _){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=mt(),s=[];for(let[e,t]of a){if(e in y)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:me(e),client:e}));let u={flagged:-1,project:0,local:1,user:2,enterprise:3,managed:4,dynamic:5,builtin:6},d=[],f=new Map;for(let{item:e,originalScope:t,childMcps:r}of n){let n=e.scope;f.has(n)||f.set(n,[]),f.get(n).push(e);for(let{displayName:e,client:n}of r){let r=t===`builtin`?`user`:t;f.has(r)||f.set(r,[]),f.get(r).push({type:`mcp`,id:`mcp:${n.name}`,name:e,description:void 0,scope:r,status:me(n),client:n,indented:!0})}}for(let e of c){let t=e.scope;f.has(t)||f.set(t,[]),f.get(t).push(e)}for(let e of s){let t=e.scope;f.has(t)||f.set(t,[]),f.get(t).push(e)}for(let[e,t]of Object.entries(y)){let n=be(e),r=n.name||e,i=n.marketplace||`unknown`;f.has(`flagged`)||f.set(`flagged`,[]),f.get(`flagged`).push({type:`flagged-plugin`,id:e,name:r,marketplace:i,scope:`flagged`,reason:`delisted`,text:`Removed from marketplace`,flaggedAt:t.flaggedAt})}let p=[...f.keys()].sort((e,t)=>(u[e]??99)-(u[t]??99));for(let e of p){let t=f.get(e),n=[],r=[],i=0;for(;i<t.length;){let e=t[i];if(e.type===`plugin`||e.type===`failed-plugin`||e.type===`flagged-plugin`){let r=[e];i++;let a=t[i];for(;a?.type===`mcp`&&a.indented;)r.push(a),i++,a=t[i];n.push(r)}else e.type===`mcp`&&!e.indented&&r.push(e),i++}n.sort((e,t)=>e[0].name.localeCompare(t[0].name)),r.sort((e,t)=>e.name.localeCompare(t.name));for(let e of n)d.push(...e);d.push(...r)}return d},[N,l,_,le,y]),ge=(0,X.useMemo)(()=>he.filter(e=>e.type===`flagged-plugin`).map(e=>e.id),[he]);(0,X.useEffect)(()=>{ge.length>0&&At(ge)},[ge]);let L=(0,X.useMemo)(()=>{if(!D)return he;let e=D.toLowerCase();return he.filter(t=>t.name.toLowerCase().includes(e)||`description`in t&&t.description?.toLowerCase().includes(e))},[he,D]),[R,ve]=(0,X.useState)(0),ye=Tn({totalItems:L.length,selectedIndex:R,maxVisible:8}),[xe,Ce]=(0,X.useState)(0),[we,z]=(0,X.useState)(!1),[Ee,B]=(0,X.useState)(null),[ke,Ae]=(0,X.useState)(null),[je,Me]=(0,X.useState)(!1),[Ne,Pe]=(0,X.useState)(!1);(0,X.useEffect)(()=>{if(!A){Pe(!1);return}async function e(){let e=A.plugin.manifest.mcpServers,t=!1;if(e&&(t=typeof e==`string`&&Oe(e)||Array.isArray(e)&&e.some(e=>typeof e==`string`&&Oe(e))),!t)try{let e=tn.join(A.plugin.path,`..`),n=tn.join(e,`.claude-plugin`,`marketplace.json`),r=et(await nn.readFile(n,`utf-8`)).plugins?.find(e=>e.name===A.plugin.name);if(r?.mcpServers){let e=r.mcpServers;t=typeof e==`string`&&Oe(e)||Array.isArray(e)&&e.some(e=>typeof e==`string`&&Oe(e))}}catch(e){nt(`Failed to read raw marketplace.json: ${e}`)}Pe(t)}e()},[A]),(0,X.useEffect)(()=>{async function e(){ce(!0);try{let{enabled:e,disabled:t}=await ue(),n=ne(),r=Xn([...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=te(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)),M(a);let o=[];for(let e of a)for(let t of e.installedPlugins){let n=`${t.name}@${e.name}`,r=t.isBuiltin?`builtin`:bt(n).scope;o.push({plugin:t,marketplace:e.name,scope:r,pendingEnable:void 0,pendingUpdate:!1})}se(o),ve(0)}finally{ce(!1)}}e()},[]),(0,X.useEffect)(()=>{if(!I.current&&i&&ae.length>0&&!P){let{name:e,marketplace:n}=be(i),r=o??n,a=r?ae.filter(e=>e.name===r):ae;for(let t of a){let n=t.installedPlugins.find(t=>t.name===e);if(n){let{scope:e}=bt(`${n.name}@${t.name}`),r={plugin:n,marketplace:t.name,scope:e,pendingEnable:void 0,pendingUpdate:!1};j(r),E(`plugin-details`),de.current=s,I.current=!0;return}}let c=he.find(t=>t.type===`failed-plugin`&&t.name===e);c&&c.type===`failed-plugin`&&(E({type:`failed-plugin-details`,plugin:{id:c.id,name:c.name,marketplace:c.marketplace,errors:c.errors,scope:c.scope}}),I.current=!0),!I.current&&s&&(I.current=!0,t(`Plugin "${i}" is not installed in this project`))}},[i,o,ae,P,he,s,t]);let Fe=async r=>{if(!A)return;let i=A.scope||`user`,a=i===`builtin`;if(a&&(r===`update`||r===`uninstall`)){B(`Built-in plugins cannot be updated or uninstalled.`);return}if(!a&&!yt(i)&&r!==`update`){B(`This plugin is managed by your organization. Contact your admin to disable it.`);return}z(!0),B(null);try{let o=`${A.plugin.name}@${A.marketplace}`,s;switch(r){case`enable`:{let e=await ht(o);if(!e.success)throw Error(e.message);break}case`disable`:{let e=await vt(o);if(!e.success)throw Error(e.message);s=e.reverseDependents;break}case`uninstall`:{if(a||!yt(i))break;if(St(o)){z(!1),E(`confirm-project-uninstall`);return}let e=Ue().plugins[o],t=!e||e.length<=1?await Le(o):null;if(t){z(!1),E({type:`confirm-data-cleanup`,size:t});return}let n=await gt(o,i);if(!n.success)throw Error(n.message);s=n.reverseDependents;break}case`update`:{if(a)break;let r=await _t(o,i);if(!r.success)throw Error(r.message);if(r.alreadyUpToDate){t(`${A.plugin.name} is already at the latest version (${r.newVersion}).`),n&&await n(),e({type:`menu`});return}break}}fe();let c=`${A.plugin.name}@${A.marketplace}`;if(ne()?.enabledPlugins?.[c]!==!1){z(!1),E({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} ${A.plugin.name}${u}. Run /reload-plugins to apply.`),n&&await n(),e({type:`menu`})}catch(e){z(!1);let t=e instanceof Error?e.message:String(e);B(`Failed to ${r}: ${t}`),ct(tt(e))}},Re=(0,X.useRef)(Fe);Re.current=Fe,(0,X.useEffect)(()=>{if(T===`plugin-details`&&A&&de.current){let e=de.current;de.current=void 0,Re.current(e)}},[T,A]);let ze=Qn.useCallback(()=>{if(R>=L.length)return;let e=L[R];if(e?.type!==`flagged-plugin`)if(e?.type===`plugin`){let t=`${e.plugin.name}@${e.marketplace}`,n=ne(),r=le.get(t),i=n?.enabledPlugins?.[t]!==!1,a=e.scope;if(a===`builtin`||yt(a)){let e=new Map(le);r?(e.delete(t),(async()=>{try{r===`will-disable`?await ht(t):await vt(t),fe()}catch(e){ct(e)}})()):(e.set(t,i?`will-disable`:`will-enable`),(async()=>{try{i?await vt(t):await ht(t),fe()}catch(e){ct(e)}})()),F(e)}}else e?.type===`mcp`&&pe(e.client.name)},[R,L,le,N,pe]);c({"select:previous":()=>{R===0?C(!0):ye.handleSelectionChange(R-1,ve)},"select:next":()=>{R<L.length-1&&ye.handleSelectionChange(R+1,ve)},"select:accept":Qn.useCallback(()=>{if(R>=L.length)return;let e=L[R];if(e?.type===`plugin`){let t=N.find(t=>t.plugin.name===e.plugin.name&&t.marketplace===e.marketplace);t&&(j(t),E(`plugin-details`),Ce(0),B(null))}else e?.type===`flagged-plugin`?(E({type:`flagged-detail`,plugin:{id:e.id,name:e.name,marketplace:e.marketplace,reason:e.reason,text:e.text,flaggedAt:e.flaggedAt}}),B(null)):e?.type===`failed-plugin`?(E({type:`failed-plugin-details`,plugin:{id:e.id,name:e.name,marketplace:e.marketplace,errors:e.errors,scope:e.scope}}),Ce(0),B(null)):e?.type===`mcp`&&(E({type:`mcp-detail`,client:e.client}),B(null))},[R,L,N])},{context:`Select`,isActive:T===`plugin-list`&&!x}),c({"plugin:toggle":ze},{context:`Plugin`,isActive:T===`plugin-list`&&!x}),c({"select:accept":Qn.useCallback(()=>{typeof T!=`object`||T.type!==`flagged-detail`||(Mt(T.plugin.id),E(`plugin-list`))},[T])},{context:`Select`,isActive:typeof T==`object`&&T.type===`flagged-detail`});let Be=Qn.useMemo(()=>{if(T!==`plugin-details`||!A)return[];let e=ne(),t=`${A.plugin.name}@${A.marketplace}`,n=e?.enabledPlugins?.[t]!==!1,r=A.marketplace===`builtin`,i=[];return i.push({label:n?`Disable plugin`:`Enable plugin`,action:()=>void Fe(n?`disable`:`enable`)}),r||(i.push({label:A.pendingUpdate?`Unmark for update`:`Mark for update`,action:async()=>{try{let e=await Yn(A.plugin.name,A.marketplace);if(e){B(e);return}let t=[...N],n=t.findIndex(e=>e.plugin.name===A.plugin.name&&e.marketplace===A.marketplace);n!==-1&&(t[n].pendingUpdate=!A.pendingUpdate,se(t),j({...A,pendingUpdate:!A.pendingUpdate}))}catch(e){B(e instanceof Error?e.message:`Failed to check plugin update availability`)}}}),Ne&&i.push({label:`Configure`,action:async()=>{Me(!0);try{let e=A.plugin.manifest.mcpServers,t=null;if(typeof e==`string`&&Oe(e))t=e;else if(Array.isArray(e)){for(let n of e)if(typeof n==`string`&&Oe(n)){t=n;break}}if(!t){B(`No MCPB file found in plugin`),Me(!1);return}let n=`${A.plugin.name}@${A.marketplace}`,r=await Ie(t,A.plugin.path,n,void 0,void 0,!0);`status`in r&&r.status===`needs-config`?(Ae(r),E(`configuring`)):B(`Failed to load MCPB for configuration`)}catch(e){let t=$e(e);B(`Failed to load configuration: ${t}`)}finally{Me(!1)}}}),A.plugin.manifest.userConfig&&Object.keys(A.plugin.manifest.userConfig).length>0&&i.push({label:`Configure options`,action:()=>{E({type:`configuring-options`,schema:A.plugin.manifest.userConfig})}}),i.push({label:`Update now`,action:()=>void Fe(`update`)}),i.push({label:`Uninstall`,action:()=>void Fe(`uninstall`)})),A.plugin.manifest.homepage&&i.push({label:`Open homepage`,action:()=>void De(A.plugin.manifest.homepage)}),A.plugin.manifest.repository&&i.push({label:`View repository`,action:()=>void De(A.plugin.manifest.repository)}),i.push({label:`Back to plugin list`,action:()=>{E(`plugin-list`),j(null),B(null)}}),i},[T,A,Ne,N]);if(c({"select:previous":()=>{xe>0&&Ce(xe-1)},"select:next":()=>{xe<Be.length-1&&Ce(xe+1)},"select:accept":()=>{Be[xe]&&Be[xe].action()}},{context:`Select`,isActive:T===`plugin-details`&&!!A}),c({"select:accept":()=>{typeof T==`object`&&T.type===`failed-plugin-details`&&(async()=>{z(!0),B(null);let e=T.plugin.id,t=T.plugin.scope,r=yt(t)?await gt(e,t,!1):await gt(e,`user`,!1),i=r.success;if(!i){for(let t of[`userSettings`,`projectSettings`,`localSettings`]){let n=O(t);n?.enabledPlugins?.[e]!==void 0&&(k(t,{enabledPlugins:{...n.enabledPlugins,[e]:void 0}}),i=!0)}fe()}i?(n&&await n(),z(!1),E(`plugin-list`)):(z(!1),B(r.message))})()}},{context:`Select`,isActive:typeof T==`object`&&T.type===`failed-plugin-details`&&T.plugin.scope!==`managed`}),c({"confirm:yes":()=>{if(!A)return;z(!0),B(null);let r=`${A.plugin.name}@${A.marketplace}`,{error:i}=k(`localSettings`,{enabledPlugins:{...O(`localSettings`)?.enabledPlugins,[r]:!1}});if(i){z(!1),B(`Failed to write settings: ${i.message}`);return}fe(),t(`✓ Disabled ${A.plugin.name} in .workmate/settings.local.json. Run /reload-plugins to apply.`),n&&n(),e({type:`menu`})},"confirm:no":()=>{E(`plugin-details`),B(null)}},{context:`Confirmation`,isActive:T===`confirm-project-uninstall`&&!!A&&!we}),g((r,i)=>{if(!A)return;let o=`${A.plugin.name}@${A.marketplace}`,s=A.scope;if(!s||s===`builtin`||!yt(s))return;let c=async r=>{z(!0),B(null);try{let i=await gt(o,s,r);if(!i.success)throw Error(i.message);fe();let c=r?``:` · data preserved`;t(`${a.tick} ${i.message}${c}`),n&&n(),e({type:`menu`})}catch(e){z(!1),B(e instanceof Error?e.message:String(e))}};r===`y`||r===`Y`?c(!0):r===`n`||r===`N`?c(!1):i.escape&&(E(`plugin-details`),B(null))},{isActive:typeof T==`object`&&T.type===`confirm-data-cleanup`&&!!A&&!we}),Qn.useEffect(()=>{ve(0)},[D]),g((e,t)=>{let n=!t.ctrl&&!t.meta;x||(e===`/`&&n?(C(!0),re(``),ve(0)):n&&e.length>0&&!/^\s+$/.test(e)&&e!==`j`&&e!==`k`&&e!==` `&&(C(!0),re(e),ve(0)))},{isActive:T===`plugin-list`}),P)return(0,Z.jsx)(d,{children:`Loading installed plugins…`});if(he.length===0)return(0,Z.jsxs)(u,{flexDirection:`column`,children:[(0,Z.jsx)(u,{marginBottom:1,children:(0,Z.jsx)(d,{bold:!0,children:`Manage plugins`})}),(0,Z.jsx)(d,{children:`No plugins or MCP servers installed.`}),(0,Z.jsx)(u,{marginTop:1,children:(0,Z.jsx)(d,{dimColor:!0,children:`Esc to go back`})})]});if(typeof T==`object`&&T.type===`plugin-options`&&A){let r=`${A.plugin.name}@${A.marketplace}`;function i(r){t(r),n&&n(),e({type:`menu`})}return(0,Z.jsx)(pn,{plugin:A.plugin,pluginId:r,onDone:(e,t)=>{switch(e){case`configured`:i(`✓ Enabled and configured ${A.plugin.name}. Run /reload-plugins to apply.`);break;case`skipped`:i(`✓ Enabled ${A.plugin.name}. Run /reload-plugins to apply.`);break;case`error`:i(`Failed to save configuration: ${t}`);break}}})}if(typeof T==`object`&&T.type===`configuring-options`&&A){let e=`${A.plugin.name}@${A.marketplace}`;return(0,Z.jsx)(cn,{title:`Configure ${A.plugin.name}`,subtitle:`Plugin options`,configSchema:T.schema,initialValues:Te(e),onSave:n=>{try{_e(e,n,T.schema),fe(),t(`Configuration saved. Run /reload-plugins for changes to take effect.`)}catch(e){B(`Failed to save configuration: ${$e(e)}`)}E(`plugin-details`)},onCancel:()=>E(`plugin-details`)})}if(T===`configuring`&&ke&&A){let e=`${A.plugin.name}@${A.marketplace}`;async function n(n){if(!(!ke||!A))try{let r=A.plugin.manifest.mcpServers,i=null;if(typeof r==`string`&&Oe(r))i=r;else if(Array.isArray(r)){for(let e of r)if(typeof e==`string`&&Oe(e)){i=e;break}}if(!i){B(`No MCPB file found`),E(`plugin-details`);return}await Ie(i,A.plugin.path,e,void 0,n),B(null),Ae(null),E(`plugin-details`),t(`Configuration saved. Run /reload-plugins for changes to take effect.`)}catch(e){let t=$e(e);B(`Failed to save configuration: ${t}`),E(`plugin-details`)}}function r(){Ae(null),E(`plugin-details`)}return(0,Z.jsx)(cn,{title:`Configure ${ke.manifest.name}`,subtitle:`Plugin: ${A.plugin.name}`,configSchema:ke.configSchema,initialValues:ke.existingConfig,onSave:n,onCancel:r})}if(typeof T==`object`&&T.type===`flagged-detail`){let e=T.plugin;return(0,Z.jsxs)(u,{flexDirection:`column`,children:[(0,Z.jsx)(u,{children:(0,Z.jsxs)(d,{bold:!0,children:[e.name,` @ `,e.marketplace]})}),(0,Z.jsxs)(u,{marginBottom:1,children:[(0,Z.jsx)(d,{dimColor:!0,children:`Status: `}),(0,Z.jsx)(d,{color:`error`,children:`Removed`})]}),(0,Z.jsxs)(u,{marginBottom:1,flexDirection:`column`,children:[(0,Z.jsxs)(d,{color:`error`,children:[`Removed from marketplace · reason: `,e.reason]}),(0,Z.jsx)(d,{children:e.text}),(0,Z.jsxs)(d,{dimColor:!0,children:[`Flagged on `,new Date(e.flaggedAt).toLocaleDateString()]})]}),(0,Z.jsx)(u,{marginTop:1,flexDirection:`column`,children:(0,Z.jsxs)(u,{children:[(0,Z.jsxs)(d,{children:[a.pointer,` `]}),(0,Z.jsx)(d,{color:`suggestion`,children:`Dismiss`})]})}),(0,Z.jsxs)(f,{children:[(0,Z.jsx)(V,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`dismiss`}),(0,Z.jsx)(V,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]})]})}if(T===`confirm-project-uninstall`&&A)return(0,Z.jsxs)(u,{flexDirection:`column`,children:[(0,Z.jsxs)(d,{bold:!0,color:`warning`,children:[A.plugin.name,` is enabled in .workmate/settings.json (shared with your team)`]}),(0,Z.jsxs)(u,{marginTop:1,flexDirection:`column`,children:[(0,Z.jsx)(d,{children:`Disable it just for you in .workmate/settings.local.json?`}),(0,Z.jsx)(d,{dimColor:!0,children:`This has the same effect as uninstalling, without affecting other contributors.`})]}),Ee&&(0,Z.jsx)(u,{marginTop:1,children:(0,Z.jsx)(d,{color:`error`,children:Ee})}),(0,Z.jsx)(u,{marginTop:1,children:we?(0,Z.jsx)(d,{dimColor:!0,children:`Disabling…`}):(0,Z.jsxs)(f,{children:[(0,Z.jsx)(V,{action:`confirm:yes`,context:`Confirmation`,fallback:`y`,description:`disable`}),(0,Z.jsx)(V,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})]})})]});if(typeof T==`object`&&T.type===`confirm-data-cleanup`&&A)return(0,Z.jsxs)(u,{flexDirection:`column`,children:[(0,Z.jsxs)(d,{bold:!0,children:[A.plugin.name,` has `,T.size.human,` of persistent data`]}),(0,Z.jsxs)(u,{marginTop:1,flexDirection:`column`,children:[(0,Z.jsx)(d,{children:`Delete it along with the plugin?`}),(0,Z.jsx)(d,{dimColor:!0,children:Ge(`${A.plugin.name}@${A.marketplace}`)})]}),Ee&&(0,Z.jsx)(u,{marginTop:1,children:(0,Z.jsx)(d,{color:`error`,children:Ee})}),(0,Z.jsx)(u,{marginTop:1,children:we?(0,Z.jsx)(d,{dimColor:!0,children:`Uninstalling…`}):(0,Z.jsxs)(d,{children:[(0,Z.jsx)(d,{bold:!0,children:`y`}),` to delete · `,(0,Z.jsx)(d,{bold:!0,children:`n`}),` to keep · `,(0,Z.jsx)(d,{bold:!0,children:`esc`}),` to cancel`]})})]});if(T===`plugin-details`&&A){let e=ne(),t=`${A.plugin.name}@${A.marketplace}`,n=e?.enabledPlugins?.[t]!==!1,r=_.filter(e=>`plugin`in e&&e.plugin===A.plugin.name||e.source===t||e.source.startsWith(`${A.plugin.name}@`)),i=r.length===0?null:(0,Z.jsxs)(u,{flexDirection:`column`,marginBottom:1,children:[(0,Z.jsxs)(d,{bold:!0,color:`error`,children:[r.length,` `,H(r.length,`error`),`:`]}),r.map((e,t)=>{let n=Hn(e);return(0,Z.jsxs)(u,{flexDirection:`column`,marginLeft:2,children:[(0,Z.jsx)(d,{color:`error`,children:Vn(e)}),n&&(0,Z.jsxs)(d,{dimColor:!0,italic:!0,children:[a.arrowRight,` `,n]})]},t)})]});return(0,Z.jsxs)(u,{flexDirection:`column`,children:[(0,Z.jsx)(u,{children:(0,Z.jsxs)(d,{bold:!0,children:[A.plugin.name,` @ `,A.marketplace]})}),(0,Z.jsxs)(u,{children:[(0,Z.jsx)(d,{dimColor:!0,children:`Scope: `}),(0,Z.jsx)(d,{children:A.scope||`user`})]}),A.plugin.manifest.version&&(0,Z.jsxs)(u,{children:[(0,Z.jsx)(d,{dimColor:!0,children:`Version: `}),(0,Z.jsx)(d,{children:A.plugin.manifest.version})]}),A.plugin.manifest.description&&(0,Z.jsx)(u,{marginBottom:1,children:(0,Z.jsx)(d,{children:A.plugin.manifest.description})}),A.plugin.manifest.author&&(0,Z.jsxs)(u,{children:[(0,Z.jsx)(d,{dimColor:!0,children:`Author: `}),(0,Z.jsx)(d,{children:A.plugin.manifest.author.name})]}),(0,Z.jsxs)(u,{marginBottom:1,children:[(0,Z.jsx)(d,{dimColor:!0,children:`Status: `}),(0,Z.jsx)(d,{color:n?`success`:`warning`,children:n?`Enabled`:`Disabled`}),A.pendingUpdate&&(0,Z.jsx)(d,{color:`suggestion`,children:` · Marked for update`})]}),(0,Z.jsx)(Jn,{plugin:A.plugin,marketplace:A.marketplace}),i,(0,Z.jsx)(u,{marginTop:1,flexDirection:`column`,children:Be.map((e,t)=>{let n=t===xe;return(0,Z.jsxs)(u,{children:[n&&(0,Z.jsxs)(d,{children:[a.pointer,` `]}),!n&&(0,Z.jsx)(d,{children:` `}),(0,Z.jsx)(d,{bold:n,color:e.label.includes(`Uninstall`)?`error`:e.label.includes(`Update`)?`suggestion`:void 0,children:e.label})]},t)})}),we&&(0,Z.jsx)(u,{marginTop:1,children:(0,Z.jsx)(d,{children:`Processing…`})}),Ee&&(0,Z.jsx)(u,{marginTop:1,children:(0,Z.jsx)(d,{color:`error`,children:Ee})}),(0,Z.jsx)(u,{marginTop:1,children:(0,Z.jsx)(d,{dimColor:!0,italic:!0,children:(0,Z.jsxs)(f,{children:[(0,Z.jsx)(V,{action:`select:previous`,context:`Select`,fallback:`↑`,description:`navigate`}),(0,Z.jsx)(V,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`select`}),(0,Z.jsx)(V,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]})})})]})}if(typeof T==`object`&&T.type===`failed-plugin-details`){let e=T.plugin,t=e.errors[0],n=t?Vn(t):`Failed to load`;return(0,Z.jsxs)(u,{flexDirection:`column`,children:[(0,Z.jsxs)(d,{children:[(0,Z.jsx)(d,{bold:!0,children:e.name}),(0,Z.jsxs)(d,{dimColor:!0,children:[` @ `,e.marketplace]}),(0,Z.jsxs)(d,{dimColor:!0,children:[` (`,e.scope,`)`]})]}),(0,Z.jsx)(d,{color:`error`,children:n}),e.scope===`managed`?(0,Z.jsx)(u,{marginTop:1,children:(0,Z.jsx)(d,{dimColor:!0,children:`Managed by your organization — contact your admin`})}):(0,Z.jsxs)(u,{marginTop:1,children:[(0,Z.jsxs)(d,{color:`suggestion`,children:[a.pointer,` `]}),(0,Z.jsx)(d,{bold:!0,children:`Remove`})]}),we&&(0,Z.jsx)(d,{children:`Processing…`}),Ee&&(0,Z.jsx)(d,{color:`error`,children:Ee}),(0,Z.jsx)(u,{marginTop:1,children:(0,Z.jsx)(d,{dimColor:!0,italic:!0,children:(0,Z.jsxs)(f,{children:[e.scope!==`managed`&&(0,Z.jsx)(V,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`remove`}),(0,Z.jsx)(V,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]})})})]})}if(typeof T==`object`&&T.type===`mcp-detail`){let e=T.client,n=Se(h,e.name).length,r=()=>{E({type:`mcp-tools`,client:e})},i=()=>{E(`plugin-list`)},a=e=>{e&&t(e),E(`plugin-list`)},o=e.config.scope,s=e.config.type;return s===`stdio`?(0,Z.jsx)(Gt,{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)(Zt,{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)(Zt,{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)(Zt,{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}):(E(`plugin-list`),null)}if(typeof T==`object`&&T.type===`mcp-tools`){let e=T.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)(Qt,{server:r,onSelectTool:t=>{E({type:`mcp-tool-detail`,client:e,tool:t})},onBack:()=>E({type:`mcp-detail`,client:e})})}if(typeof T==`object`&&T.type===`mcp-tool-detail`){let{client:e,tool:t}=T,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)(Xt,{tool:t,server:i,onBack:()=>E({type:`mcp-tools`,client:e})})}let Ve=ye.getVisibleItems(L);return(0,Z.jsxs)(u,{flexDirection:`column`,children:[(0,Z.jsx)(u,{marginBottom:1,children:(0,Z.jsx)(v,{query:D,isFocused:x,isTerminalFocused:ee,width:w-4,cursorOffset:ie})}),L.length===0&&D&&(0,Z.jsx)(u,{marginBottom:1,children:(0,Z.jsxs)(d,{dimColor:!0,children:[`No items match "`,D,`"`]})}),ye.scrollPosition.canScrollUp&&(0,Z.jsx)(u,{children:(0,Z.jsxs)(d,{dimColor:!0,children:[` `,a.arrowUp,` more above`]})}),Ve.map((e,t)=>{let n=ye.toActualIndex(t)===R&&!x,r=t>0?Ve[t-1]:null,i=!r||r.scope!==e.scope;return(0,Z.jsxs)(Qn.Fragment,{children:[i&&(0,Z.jsx)(u,{marginTop:+(t>0),paddingLeft:2,children:(0,Z.jsx)(d,{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)(Wn,{item:e,isSelected:n})]},e.id)}),ye.scrollPosition.canScrollDown&&(0,Z.jsx)(u,{children:(0,Z.jsxs)(d,{dimColor:!0,children:[` `,a.arrowDown,` more below`]})}),(0,Z.jsx)(u,{marginTop:1,marginLeft:1,children:(0,Z.jsx)(d,{dimColor:!0,italic:!0,children:(0,Z.jsxs)(f,{children:[(0,Z.jsx)(d,{children:`type to search`}),(0,Z.jsx)(V,{action:`plugin:toggle`,context:`Plugin`,fallback:`Space`,description:`toggle`}),(0,Z.jsx)(V,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`details`}),(0,Z.jsx)(V,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]})})}),le.size>0&&(0,Z.jsx)(u,{marginLeft:1,children:(0,Z.jsx)(d,{dimColor:!0,italic:!0,children:`Run /reload-plugins to apply changes`})})]})}var Qn,X,Z,$n=e((()=>{i(),Qn=t(h(),1),X=t(h(),1),je(),S(),Kt(),Yt(),qt(),Jt(),Ht(),Wt(),ze(),Ve(),M(),Ft(),A(),xt(),Ze(),T(),Ye(),rt(),Qe(),st(),me(),we(),We(),j(),Pe(),Nt(),P(),L(),Ce(),F(),pt(),D(),it(),ft(),Un(),dn(),gn(),Gn(),On(),Z=w()}));function er(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 tr=e((()=>{}));function nr({onComplete:e,path:t}){return(0,rr.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 Et(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,ct(t),e(`${a.cross} Unexpected error during validation: ${$e(t)}`)}}n()},[e,t]),(0,ir.jsx)(u,{flexDirection:`column`,children:(0,ir.jsx)(d,{children:`Running validation...`})})}var rr,ir,ar=e((()=>{i(),rr=t(h(),1),S(),Qe(),st(),kt(),ft(),ir=w()}));function or({onComplete:e}){return(0,Q.useEffect)(()=>{async function t(){try{let t=await B(),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: ${$e(t)}`)}}t()},[e]),(0,$.jsx)(d,{children:`Loading marketplaces...`})}function sr(e){let t=[];for(let{source:n,scope:r}of[{source:`userSettings`,scope:`user`},{source:`projectSettings`,scope:`project`},{source:`localSettings`,scope:`local`}])O(n)?.extraKnownMarketplaces?.[e]&&t.push({source:n,scope:r});return{editableSources:t,isInPolicy:!!O(`policySettings`)?.extraKnownMarketplaces?.[e]}}function cr(e){let{editableSources:t,isInPolicy:n}=sr(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 lr(e){return{kind:`navigate`,tab:`installed`,viewState:{type:`manage-plugins`,targetPlugin:e,action:`uninstall`}}}function ur(e){return vr.has(e.type)}function dr(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 fr(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:Vn(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=cr(t.name),n=sr(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=cr(t),r=sr(t),i=r.isInPolicy?`managed`:r.editableSources[0]?.scope;s.push({label:t,message:Vn(e),guidance:n.kind===`managed-only`?`Managed by your organization — contact your admin`:Hn(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=dr(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:Vn(e),guidance:Hn(e),action:t?lr(t):{kind:`none`},scope:r})}for(let e of r)s.push({label:e.source,message:Vn(e),guidance:Hn(e),action:{kind:`none`}});return s}function pr(e,t){for(let{source:n}of t){let t=O(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&&k(n,r)}}function mr({setViewState:e,setActiveTab:t,markPluginsChanged:n}){let r=oe(e=>e.plugins.errors),i=oe(e=>e.plugins.installationStatus),o=I(),[s,l]=(0,Q.useState)(0),[m,h]=(0,Q.useState)(null),[g,_]=(0,Q.useState)([]);(0,Q.useEffect)(()=>{(async()=>{try{let{failures:e}=await ae(await B());_(e)}catch{}})()},[]);let v=i.marketplaces.filter(e=>e.status===`failed`),y=new Set(v.map(e=>e.name)),b=r.filter(ur),x=fr(v,r.filter(e=>(e.type===`marketplace-not-found`||e.type===`marketplace-load-failed`||e.type===`marketplace-blocked-by-policy`)&&!y.has(e.marketplace)),r.filter(e=>ur(e)||e.type===`marketplace-not-found`||e.type===`marketplace-load-failed`||e.type===`marketplace-blocked-by-policy`?!1:dr(e)!==void 0),r.filter(e=>ur(e)||e.type===`marketplace-not-found`||e.type===`marketplace-load-failed`||e.type===`marketplace-blocked-by-policy`?!1:dr(e)===void 0),g,b,mt());p(`confirm:no`,()=>{e({type:`menu`})},{context:`Confirmation`}),c({"select:previous":()=>l(e=>Math.max(0,e-1)),"select:next":()=>l(e=>Math.min(x.length-1,e+1)),"select:accept":()=>{let r=x[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(`, `);pr(i.name,i.sources),fe(),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)}}})),h(`${a.tick} Removed "${i.name}" from ${e} settings`),n();break}case`remove-installed-marketplace`:(async()=>{try{await Ae(i.name),fe(),_(e=>e.filter(e=>e.name!==i.name)),h(`${a.tick} Removed marketplace "${i.name}"`),n()}catch(e){h(`Failed to remove "${i.name}": ${e instanceof Error?e.message:String(e)}`)}})();break;case`managed-only`:break;case`none`:break}}},{context:`Select`,isActive:x.length>0});let S=Math.min(s,Math.max(0,x.length-1));S!==s&&l(S);let C=x[S]?.action,ee=C&&C.kind!==`none`&&C.kind!==`managed-only`;return x.length===0?(0,$.jsxs)(u,{flexDirection:`column`,children:[(0,$.jsx)(u,{marginLeft:1,children:(0,$.jsx)(d,{dimColor:!0,children:`No plugin errors`})}),(0,$.jsx)(u,{marginTop:1,children:(0,$.jsx)(d,{dimColor:!0,italic:!0,children:(0,$.jsx)(V,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})})})]}):(0,$.jsxs)(u,{flexDirection:`column`,children:[x.map((e,t)=>{let n=t===S;return(0,$.jsxs)(u,{marginLeft:1,flexDirection:`column`,marginBottom:1,children:[(0,$.jsxs)(d,{children:[(0,$.jsxs)(d,{color:n?`suggestion`:`error`,children:[n?a.pointer:a.cross,` `]}),(0,$.jsx)(d,{bold:n,children:e.label}),e.scope&&(0,$.jsxs)(d,{dimColor:!0,children:[` (`,e.scope,`)`]})]}),(0,$.jsx)(u,{marginLeft:3,children:(0,$.jsx)(d,{color:`error`,children:e.message})}),e.guidance&&(0,$.jsx)(u,{marginLeft:3,children:(0,$.jsx)(d,{dimColor:!0,italic:!0,children:e.guidance})})]},t)}),m&&(0,$.jsx)(u,{marginTop:1,marginLeft:1,children:(0,$.jsx)(d,{color:`claude`,children:m})}),(0,$.jsx)(u,{marginTop:1,children:(0,$.jsx)(d,{dimColor:!0,italic:!0,children:(0,$.jsxs)(f,{children:[(0,$.jsx)(V,{action:`select:previous`,context:`Select`,fallback:`↑`,description:`navigate`}),ee&&(0,$.jsx)(V,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`resolve`}),(0,$.jsx)(V,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]})})})]})}function hr(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 gr(e){return e.type===`manage-plugins`?`installed`:e.type===`manage-marketplaces`?`marketplaces`:`discover`}function _r({onComplete:e,args:t}){let n=er(t),r=hr(n),[i,a]=(0,Q.useState)(r),[o,s]=(0,Q.useState)(gr(r)),[c,l]=(0,Q.useState)(i.type===`add-marketplace`&&i.initialValue||``),[f,m]=(0,Q.useState)(0),[h,g]=(0,Q.useState)(null),[_,v]=(0,Q.useState)(null),[b,S]=(0,Q.useState)(!1),ee=I(),w=oe(e=>{let t=e.plugins.errors.length;for(let n of e.plugins.installationStatus.marketplaces)n.status===`failed`&&t++;return t}),T=w>0?`Errors (${w})`:`Errors`,te=It(),ne=n.type===`marketplace`&&n.action===`add`&&n.target!==void 0,E=(0,Q.useCallback)(()=>{ee(e=>e.plugins.needsRefresh?e:{...e,plugins:{...e.plugins,needsRefresh:!0}})},[ee]),D=(0,Q.useCallback)(e=>{let t=e;switch(s(t),g(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`&&!_&&e()},[i.type,_,e]),(0,Q.useEffect)(()=>{i.type===`browse-marketplace`&&o!==`discover`&&s(`discover`)},[i.type,o]),p(`confirm:no`,(0,Q.useCallback)(()=>{s(`marketplaces`),a({type:`manage-marketplaces`}),l(``),g(null)},[]),{context:`Settings`,isActive:i.type===`add-marketplace`}),(0,Q.useEffect)(()=>{_&&e(_)},[_,e]),(0,Q.useEffect)(()=>{i.type===`help`&&e()},[i.type,e]),i.type===`help`?(0,$.jsxs)(u,{flexDirection:`column`,children:[(0,$.jsx)(d,{bold:!0,children:`Plugin Command Usage:`}),(0,$.jsx)(d,{children:` `}),(0,$.jsx)(d,{dimColor:!0,children:`Installation:`}),(0,$.jsx)(d,{children:` /plugin install - Browse and install plugins`}),(0,$.jsx)(d,{children:` /plugin install <marketplace> - Install from specific marketplace`}),(0,$.jsx)(d,{children:` /plugin install <plugin> - Install specific plugin`}),(0,$.jsx)(d,{children:` /plugin install <plugin>@<market> - Install plugin from marketplace`}),(0,$.jsx)(d,{children:` `}),(0,$.jsx)(d,{dimColor:!0,children:`Management:`}),(0,$.jsx)(d,{children:` /plugin manage - Manage installed plugins`}),(0,$.jsx)(d,{children:` /plugin enable <plugin> - Enable a plugin`}),(0,$.jsx)(d,{children:` /plugin disable <plugin> - Disable a plugin`}),(0,$.jsx)(d,{children:` /plugin uninstall <plugin> - Uninstall a plugin`}),(0,$.jsx)(d,{children:` `}),(0,$.jsx)(d,{dimColor:!0,children:`Marketplaces:`}),(0,$.jsx)(d,{children:` /plugin marketplace - Marketplace management menu`}),(0,$.jsx)(d,{children:` /plugin marketplace add - Add a marketplace`}),(0,$.jsx)(d,{children:` /plugin marketplace add <path/url> - Add marketplace directly`}),(0,$.jsx)(d,{children:` /plugin marketplace update - Update marketplaces`}),(0,$.jsx)(d,{children:` /plugin marketplace update <name> - Update specific marketplace`}),(0,$.jsx)(d,{children:` /plugin marketplace remove - Remove a marketplace`}),(0,$.jsx)(d,{children:` /plugin marketplace remove <name> - Remove specific marketplace`}),(0,$.jsx)(d,{children:` /plugin marketplace list - List all marketplaces`}),(0,$.jsx)(d,{children:` `}),(0,$.jsx)(d,{dimColor:!0,children:`Validation:`}),(0,$.jsx)(d,{children:` /plugin validate <path> - Validate a manifest file or directory`}),(0,$.jsx)(d,{children:` `}),(0,$.jsx)(d,{dimColor:!0,children:`Other:`}),(0,$.jsx)(d,{children:` /plugin - Main plugin menu`}),(0,$.jsx)(d,{children:` /plugin help - Show this help`}),(0,$.jsx)(d,{children:` /plugins - Alias for /plugin`})]}):i.type===`validate`?(0,$.jsx)(nr,{onComplete:e,path:i.path}):i.type===`marketplace-menu`?(a({type:`menu`}),null):i.type===`marketplace-list`?(0,$.jsx)(or,{onComplete:e}):i.type===`add-marketplace`?(0,$.jsx)(rn,{inputValue:c,setInputValue:l,cursorOffset:f,setCursorOffset:m,error:h,setError:g,result:_,setResult:v,setViewState:a,onAddComplete:E,cliMode:ne}):(0,$.jsx)(C,{color:`suggestion`,children:(0,$.jsxs)(x,{title:`Plugins`,selectedTab:o,onTabChange:D,color:`suggestion`,disableNavigation:b,children:[(0,$.jsx)(y,{id:`discover`,title:`Discover`,children:i.type===`browse-marketplace`?(0,$.jsx)(kn,{error:h,setError:g,result:_,setResult:v,setViewState:a,onInstallComplete:E,targetMarketplace:i.targetMarketplace,targetPlugin:i.targetPlugin}):(0,$.jsx)(Mn,{error:h,setError:g,result:_,setResult:v,setViewState:a,onInstallComplete:E,onSearchModeChange:S,targetPlugin:i.type===`discover-plugins`?i.targetPlugin:void 0})}),(0,$.jsx)(y,{id:`installed`,title:`Installed`,children:(0,$.jsx)(Zn,{setViewState:a,setResult:v,onManageComplete:E,onSearchModeChange:S,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)(y,{id:`marketplaces`,title:`Marketplaces`,children:(0,$.jsx)(Ln,{setViewState:a,error:h,setError:g,setResult:v,exitState:te,onManageComplete:E,targetMarketplace:i.type===`manage-marketplaces`?i.targetMarketplace:void 0,action:i.type===`manage-marketplaces`?i.action:void 0})}),(0,$.jsx)(y,{id:`errors`,title:T,children:(0,$.jsx)(mr,{setViewState:a,setActiveTab:s,markPluginsChanged:E})})]})})}var Q,$,vr,yr=e((()=>{i(),Q=t(h(),1),je(),S(),Lt(),Ve(),Ze(),Qe(),me(),ge(),We(),pt(),D(),on(),jn(),In(),Bn(),$n(),Un(),tr(),ar(),$=w(),vr=new Set([`git-auth-failed`,`git-timeout`,`network-error`])}));async function br(e,t,n){return(0,xr.jsx)(_r,{onComplete:e,args:n})}var xr;e((()=>{yr(),xr=w()}))();export{br as call};
@@ -1 +0,0 @@
1
- import{Ya as e,fo as t,so as n,to as r,uo as i}from"./loadAgentsDir-uuZYOgKn.js";import{I as a,M as o,c as s,i as c}from"./debug-2pVES-2G.js";import{d as l,s as u}from"./pluginOperations-Ca_T-HYn.js";import{i as d,n as f,r as p,t as m}from"./pluginFlagging-CUvkKGOB.js";u(),c(),a(),e(),i(),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=r(),i=f(),a=await t(),c=[];for(let t of Object.keys(a))try{let r=await n(t);if(!r.forceRemoveDeletedPlugins)continue;let a=h(e,r,t);for(let t of a){if(t in i)continue;let n=e.plugins[t]??[];if(n.some(e=>e.scope===`user`||e.scope===`project`||e.scope===`local`)){for(let e of n){let{scope:n}=e;if(!(n!==`user`&&n!==`project`&&n!==`local`))try{await l(t,n)}catch(e){s(`Failed to auto-uninstall delisted plugin ${t} from ${n}: ${o(e)}`,{level:`error`})}}await m(t),c.push(t)}}}catch(e){s(`Failed to check for delisted plugins in "${t}": ${o(e)}`,{level:`warn`})}return c}export{g as t};
@@ -1 +0,0 @@
1
- import{n as e,t}from"./figures-5ThXQEtq.js";import{Cx as n,Ja as r,Tx as i,au as a,gi as o,iu as s,mi as c,qa as l,ru as u}from"./loadAgentsDir-uuZYOgKn.js";import{I as d,M as f}from"./debug-2pVES-2G.js";import{n as p,o as m}from"./process-gEbdy6uY.js";import{o as h,s as g}from"./log-L1kqxa_P.js";import{n as _}from"./analytics-COpjZpvd.js";import{a as v,c as y,d as b,f as x,i as S,r as C,s as w}from"./pluginOperations-Ca_T-HYn.js";e(),d(),o(),h(),r(),n(),p(),a(),_(),w();function T(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}: ${f(e)}`);let o=r?(()=>{let{name:e,marketplace:t}=i(r);return{_PROTO_plugin_name:e,...t&&{_PROTO_marketplace_name:t},...u(e,t,l())}})():{};s(e),{...o},process.exit(1)}async function E(e,n=`user`){try{console.log(`Installing plugin "${e}"...`);let r=await y(e,n);if(!r.success)throw Error(r.message);console.log(`${t.tick} ${r.message}`);let{name:a,marketplace:o}=i(r.pluginId||e);({...o&&{_PROTO_marketplace_name:o}}),r.scope,{...u(a,o,l())},process.exit(0)}catch(t){T(t,`install`,e)}}async function D(e,n=`user`,r=!1){try{let a=await b(e,n,!r);if(!a.success)throw Error(a.message);console.log(`${t.tick} ${a.message}`);let{name:o,marketplace:s}=i(a.pluginId||e);({...s&&{_PROTO_marketplace_name:s}}),a.scope,{...u(o,s,l())},process.exit(0)}catch(t){T(t,`uninstall`,e)}}async function O(e,n){try{let r=await v(e,n);if(!r.success)throw Error(r.message);console.log(`${t.tick} ${r.message}`);let{name:a,marketplace:o}=i(r.pluginId||e);({...o&&{_PROTO_marketplace_name:o}}),r.scope,{...u(a,o,l())},process.exit(0)}catch(t){T(t,`enable`,e)}}async function k(e,n){try{let r=await S(e,n);if(!r.success)throw Error(r.message);console.log(`${t.tick} ${r.message}`);let{name:a,marketplace:o}=i(r.pluginId||e);({...o&&{_PROTO_marketplace_name:o}}),r.scope,{...u(a,o,l())},process.exit(0)}catch(t){T(t,`disable`,e)}}async function A(){try{let e=await C();if(!e.success)throw Error(e.message);console.log(`${t.tick} ${e.message}`),process.exit(0)}catch(e){T(e,`disable-all`)}}async function j(e,n){try{m(`Checking for updates for plugin "${e}" at ${n} scope…\n`);let r=await x(e,n);if(!r.success)throw Error(r.message);if(m(`${t.tick} ${r.message}\n`),!r.alreadyUpToDate){let{name:t,marketplace:n}=i(r.pluginId||e);({...n&&{_PROTO_marketplace_name:n}}),r.oldVersion,r.newVersion,{...u(t,n,l())}}await c(0)}catch(t){T(t,`update`,e)}}export{D as a,E as i,k as n,j as o,O as r,A as t};
@@ -1,2 +0,0 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{m as t,s as n,y as r}from"./settings-D4M13toi.js";import{Pt as i,q as a}from"./state-CXY-q5gr.js";import{Ax as o,Ba as s,Cx as c,Ex as l,Fa as u,Ga as d,Ha as f,Jm as p,Ka as m,La as h,Ma as g,Mo as _,Na as v,No as y,Pa as b,Po as x,Sx as S,Tx as C,Ua as w,Wa as T,Xm as E,Ya as ee,ax as te,bx as D,do as ne,eo as O,ja as k,jx as A,ka as j,lo as M,lx as re,no as ie,ro as ae,so as oe,to as N,uo as se,xx as P,za as ce}from"./loadAgentsDir-uuZYOgKn.js";import{I as F,R as I,V as L,f as R,u as z}from"./debug-2pVES-2G.js";import{o as B,s as V}from"./log-L1kqxa_P.js";import{l as H,o as U}from"./stringUtils-Cs6E5f-B.js";import{n as W,t as G}from"./pluginStartupCheck-DftTiXct.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`?a():void 0}function de(e){return n(`projectSettings`)?.enabledPlugins?.[e]===!0}function fe(e){let t=e.includes(`@`);for(let r of[`local`,`project`,`user`]){let i=n(l(r))?.enabledPlugins;if(i){for(let n of Object.keys(i))if(t?n===e:n.startsWith(`${e}@`))return{pluginId:n,scope:r}}}return null}function pe(e,t){let{name:n,marketplace:r}=C(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}=C(e),n=N();if(n.plugins[e]?.length)return{pluginId:e,pluginName:t};let r=Object.keys(n.plugins).find(e=>{let{name:r}=C(e);return r===t&&(n.plugins[e]?.length??0)>0});return r?{pluginId:r,pluginName:t}:null}function Y(e){let t=N().plugins[e];if(!t||t.length===0)return{scope:`user`};let n=a(),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 o=t.find(e=>e.scope===`user`);return o?{scope:o.scope}:{scope:t[0].scope,projectPath:t[0].projectPath}}async function he(e,t=`user`){q(t);let{name:n,marketplace:r}=C(e),i,a,o;if(r){let t=await M(e);t&&(i=t.entry,a=r,o=t.marketplaceInstallLocation)}else{let e=await ne();for(let[t,r]of Object.entries(e))try{let e=(await oe(t)).plugins.find(e=>e.name===n);if(e){i=e,a=t,o=r.installLocation;break}}catch(e){V(L(e))}}if(!i||!a)return{success:!1,message:`Plugin "${n}" not found in ${r?`marketplace "${r}"`:`any configured marketplace`}`};let s=i,c=`${s.name}@${a}`,l=await f({pluginId:c,entry:s,scope:t,marketplaceInstallLocation:o});if(!l.ok){let e=l;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:ce(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: ${c} (scope: ${t})${l.depNote}`,pluginId:c,pluginName:s.name,scope:t}}async function ge(e,t=`user`,i=!0){q(t);let{enabled:a,disabled:o}=await u(),s=[...a,...o],c=pe(e,s),d=l(t),f=n(d),m,h;if(c)m=Object.keys(f?.enabledPlugins??{}).find(t=>t===e||t===c.name||t.startsWith(`${c.name}@`))??(e.includes(`@`)?e:c.name),h=c.name;else{let t=me(e);if(!t)return{success:!1,message:`Plugin "${e}" not found in installed plugins`};m=t.pluginId,h=t.pluginName}let g=J(t),v=N().plugins[m],y=v?.find(e=>e.scope===t&&e.projectPath===g);if(!y){let{scope:n}=Y(m);return n!==t&&v&&v.length>0?n===`project`?{success:!1,message:`Plugin "${e}" is enabled at project scope (.workmate/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 b=y.installPath,S={...f?.enabledPlugins};S[m]=void 0,r(d,{enabledPlugins:S}),_(),ie(m,t,g);let C=N().plugins[m],w=!C||C.length===0;w&&b&&await x(b),w&&(p(m),i&&await te(m));let T=D(m,s),E=P(T);return{success:!0,message:`Successfully uninstalled plugin: ${h} (scope: ${t})${E}`,pluginId:m,pluginName:h,scope:t,reverseDependents:T.length>0?T:void 0}}async function X(e,t,i){let a=t?`enable`:`disable`;if(A(e)){let{error:i}=r(`userSettings`,{enabledPlugins:{...n(`userSettings`)?.enabledPlugins,[e]:t}});if(i)return{success:!1,message:`Failed to ${a} built-in plugin: ${i.message}`};_();let{name:o}=C(e);return{success:!0,message:`Successfully ${a}d built-in plugin: ${o}`,pluginId:e,pluginName:o,scope:`user`}}i&&q(i);let o,s,c=fe(e);if(i)if(s=i,c)o=c.pluginId;else if(e.includes(`@`))o=e;else return{success:!1,message:`Plugin "${e}" not found in settings. Use plugin@marketplace format.`};else if(c)o=c.pluginId,s=c.scope;else if(e.includes(`@`))o=e,s=`user`;else return{success:!1,message:`Plugin "${e}" not found in any editable settings scope. Use plugin@marketplace format.`};if(t&&m(o))return{success:!1,message:`Plugin "${o}" is blocked by your organization's policy and cannot be enabled`};let d=l(s),f=n(d)?.enabledPlugins?.[o],p={user:0,project:1,local:2},h=i&&c&&p[i]>p[c.scope];if(i&&f===void 0&&c&&c.scope!==i&&!h)return{success:!1,message:`Plugin "${e}" is installed at ${c.scope} scope, not ${i}. Use --scope ${c.scope} or omit --scope to auto-detect.`};if(t===(i&&!h?f===!0:G().has(o)))return{success:!1,message:`Plugin "${e}" is already ${t?`enabled`:`disabled`}${i?` at ${i} scope`:``}`};let g;if(!t){let{enabled:e,disabled:t}=await u(),n=D(o,[...e,...t]);n.length>0&&(g=n)}let{error:v}=r(d,{enabledPlugins:{...n(d)?.enabledPlugins,[o]:t}});if(v)return{success:!1,message:`Failed to ${a} plugin: ${v.message}`};_();let{name:y}=C(o),b=P(g);return{success:!0,message:`Successfully ${a}d plugin: ${y} (scope: ${s})${b}`,pluginId:o,pluginName:y,scope:s,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}=C(e),i=r?`${n}@${r}`:e,a=await M(e);if(!a)return{success:!1,message:`Plugin "${n}" not found`,pluginId:i,scope:t};let{entry:o,marketplaceInstallLocation:s}=a,c=O().plugins[i];if(!c||c.length===0)return{success:!1,message:`Plugin "${n}" is not installed`,pluginId:i,scope:t};let l=J(t),u=c.find(e=>e.scope===t&&e.projectPath===l);return u?be({pluginId:i,pluginName:n,entry:o,marketplaceInstallLocation:s,installation:u,scope:t,projectPath:l}):{success:!1,message:`Plugin "${n}" is not installed at scope ${l?`${t} (${l})`:t}`,pluginId:i,scope:t}}async function be({pluginId:e,pluginName:t,entry:n,marketplaceInstallLocation:r,installation:i,scope:a,projectPath:o}){let s=z(),c=i.version,l,u,d=!1,f;if(typeof n.source!=`string`){let t=await j(n.source,{manifest:{name:n.name}});l=t.path,d=!0,f=t.gitCommitSha,u=await w(e,n.source,t.manifest,t.path,n.version,t.gitCommitSha)}else{let t;try{t=await s.stat(r)}catch(t){if(I(t))return{success:!1,message:`Marketplace directory not found at ${r}`,pluginId:e,scope:a};throw t}l=K(t.isDirectory()?r:le(r),n.source);try{await s.stat(l)}catch(t){if(I(t))return{success:!1,message:`Plugin source not found at ${l}`,pluginId:e,scope:a};throw t}let i,o=K(l,`.claude-plugin`,`plugin.json`);try{i=await h(o,n.name,n.source)}catch{}u=await w(e,n.source,i,l,n.version)}try{let r=g(e,u),s=v(e,u);if(i.version===u||i.installPath===r||i.installPath===s)return{success:!0,message:`${t} is already at the latest version (${u}).`,pluginId:e,newVersion:u,oldVersion:c,alreadyUpToDate:!0,scope:a};r=await k(l,e,u,n);let d=i.installPath;if(ae(e,a,o,r,u,f),d&&d!==r){let e=O();Object.values(e.plugins).some(e=>e.some(e=>e.installPath===d))||await x(d)}let p=o?`${a} (${o})`:a;return{success:!0,message:`Plugin "${t}" updated from ${c||`unknown`} to ${u} for scope ${p}. Restart to apply changes.`,pluginId:e,newVersion:u,oldVersion:c,scope:a}}finally{d&&l!==g(e,u)&&await s.rm(l,{recursive:!0,force:!0})}}var Q,$,xe=e((()=>{i(),o(),F(),R(),B(),y(),S(),ee(),se(),re(),c(),s(),b(),E(),d(),W(),T(),t(),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};
@@ -1 +0,0 @@
1
- import{n as e,t}from"./pluginStartupCheck-DftTiXct.js";e();export{t as getPluginEditableScopes};
@@ -1,4 +0,0 @@
1
- import{n as e,t}from"./figures-5ThXQEtq.js";import{Bn as n,Pt as r}from"./state-CXY-q5gr.js";import{$a as i,Ao as a,Cx as o,Ex as s,Fa as c,Mo as l,Mx as u,No as d,Nx as f,Oo as p,Pa as m,So as h,Tx as g,Ya as _,_f as v,do as y,go as ee,io as te,mo as b,po as x,to as S,uo as C,vf as w,vo as T}from"./loadAgentsDir-uuZYOgKn.js";import{C as E,I as ne,M as D,x as re}from"./debug-2pVES-2G.js";import{o as O,s as k}from"./log-L1kqxa_P.js";import{n as A}from"./analytics-COpjZpvd.js";import{l as j,o as M}from"./stringUtils-Cs6E5f-B.js";import{n as N,t as P}from"./exit-s9XGerrH.js";import{n as F,s as I,t as L}from"./pluginOperations-Ca_T-HYn.js";import{a as R,i as z,n as B,o as V,r as H,t as U}from"./pluginCliCommands-CACeyIwz.js";import{a as ie,c as W,i as G,n as K,r as q,s as J,t as Y}from"./validatePlugin-fx1Y8vam.js";import{basename as ae,dirname as X}from"path";e(),r(),A(),I(),f(),ne(),O(),d(),W(),_(),p(),C(),v(),G(),o(),m(),Y(),re(),M();function Z(e,n){k(e),P(`${t.cross} Failed to ${n}: ${D(e)}`)}function Q(e){e.errors.length>0&&(console.log(`${t.cross} Found ${e.errors.length} ${j(e.errors.length,`error`)}:\n`),e.errors.forEach(e=>{console.log(` ${t.pointer} ${e.path}: ${e.message}`)}),console.log(``)),e.warnings.length>0&&(console.log(`${t.warning} Found ${e.warnings.length} ${j(e.warnings.length,`warning`)}:\n`),e.warnings.forEach(e=>{console.log(` ${t.pointer} ${e.path}: ${e.message}`)}),console.log(``))}async function oe(e,r){r.cowork&&n(!0);try{let n=await K(e);console.log(`Validating ${n.fileType} manifest: ${n.filePath}\n`),Q(n);let r=[];if(n.fileType===`plugin`){let e=X(n.filePath);if(ae(e)===`.claude-plugin`){r=await q(X(e));for(let e of r)console.log(`Validating ${e.fileType}: ${e.filePath}\n`),Q(e)}}let i=n.success&&r.every(e=>e.success),a=n.warnings.length>0||r.some(e=>e.warnings.length>0);i?N(a?`${t.tick} Validation passed with warnings`:`${t.tick} Validation passed`):(console.log(`${t.cross} Validation failed`),process.exit(1))}catch(e){k(e),console.error(`${t.cross} Unexpected error during validation: ${D(e)}`),process.exit(2)}}async function se(e){e.cowork&&n(!0);let r=S(),{getPluginEditableScopes:o}=await import(`./pluginStartupCheck-Du9yx2P8.js`),s=o(),l=Object.keys(r.plugins),{enabled:d,disabled:f,errors:p}=await c(),m=[...d,...f],_=m.filter(e=>e.source.endsWith(`@inline`)),v=p.filter(e=>e.source.endsWith(`@inline`)||e.source.startsWith(`inline[`));if(e.json){let t=new Map(m.map(e=>[e.source,e])),n=[];for(let e of l.sort()){let i=r.plugins[e];if(!i||i.length===0)continue;let a=g(e).name,o=p.filter(t=>t.source===e||`plugin`in t&&t.plugin===a).map(u);for(let r of i){let i=t.get(e),a;if(i){let e=i.mcpServers||await w(i);e&&Object.keys(e).length>0&&(a=e)}n.push({id:e,version:r.version||`unknown`,scope:r.scope,enabled:s.has(e),installPath:r.installPath,installedAt:r.installedAt,lastUpdated:r.lastUpdated,projectPath:r.projectPath,mcpServers:a,errors:o.length>0?o:void 0})}}for(let e of _){let t=e.mcpServers||await w(e),r=v.filter(t=>t.source===e.source||`plugin`in t&&t.plugin===e.name).map(u);n.push({id:e.source,version:e.manifest.version??`unknown`,scope:`session`,enabled:e.enabled!==!1,installPath:e.path,mcpServers:t&&Object.keys(t).length>0?t:void 0,errors:r.length>0?r:void 0})}for(let e of v.filter(e=>e.source.startsWith(`inline[`)))n.push({id:e.source,version:`unknown`,scope:`session`,enabled:!1,installPath:`path`in e?e.path:``,errors:[u(e)]});if(e.available){let e=[];try{let[t,n]=await Promise.all([y(),J()]),{marketplaces:r}=await a(t);for(let{name:t,data:a}of r)if(a)for(let r of a.plugins){let a=h(r.name,t);i(a)||e.push({pluginId:a,name:r.name,description:r.description,marketplaceName:t,version:r.version,source:r.source,installCount:n?.get(a)})}}catch{}N(E({installed:n,available:e},null,2))}else N(E(n,null,2))}l.length===0&&_.length===0&&v.length===0&&N("No plugins installed. Use `wm plugin install` to install a plugin."),l.length>0&&console.log(`Installed plugins:
2
- `);for(let e of l.sort()){let n=r.plugins[e];if(!n||n.length===0)continue;let i=g(e).name,a=p.filter(t=>t.source===e||`plugin`in t&&t.plugin===i);for(let r of n){let n=s.has(e),i=a.length>0?`${t.cross} failed to load`:n?`${t.tick} enabled`:`${t.cross} disabled`,o=r.version||`unknown`,c=r.scope;console.log(` ${t.pointer} ${e}`),console.log(` Version: ${o}`),console.log(` Scope: ${c}`),console.log(` Status: ${i}`);for(let e of a)console.log(` Error: ${u(e)}`);console.log(``)}}if(_.length>0||v.length>0){console.log(`Session-only plugins (--plugin-dir):
3
- `);for(let e of _){let n=v.filter(t=>t.source===e.source||`plugin`in t&&t.plugin===e.name),r=n.length>0?`${t.cross} loaded with errors`:`${t.tick} loaded`;console.log(` ${t.pointer} ${e.source}`),console.log(` Version: ${e.manifest.version??`unknown`}`),console.log(` Path: ${e.path}`),console.log(` Status: ${r}`);for(let e of n)console.log(` Error: ${u(e)}`);console.log(``)}for(let e of v.filter(e=>e.source.startsWith(`inline[`)))console.log(` ${t.pointer} ${e.source}: ${t.cross} ${u(e)}\n`)}N()}async function ce(e,r){r.cowork&&n(!0);try{let n=await ie(e);n||P(`${t.cross} Invalid marketplace source format. Try: owner/repo, https://..., or ./path`),`error`in n&&P(`${t.cross} ${n.error}`);let i=r.scope??`user`;i!==`user`&&i!==`project`&&i!==`local`&&P(`${t.cross} Invalid scope '${i}'. Use: user, project, or local`);let a=s(i),o=n;r.sparse&&r.sparse.length>0&&(o.source===`github`||o.source===`git`?o={...o,sparsePaths:r.sparse}:P(`${t.cross} --sparse is only supported for github and git marketplace sources (got: ${o.source})`)),console.log(`Adding marketplace...`);let{name:c,alreadyMaterialized:u,resolvedSource:d}=await te(o,e=>{console.log(e)});T(c,{source:d},a),l(),o.source,o.source===`github`&&o.repo,N(u?`${t.tick} Marketplace '${c}' already on disk — declared in ${i} settings`:`${t.tick} Successfully added marketplace: ${c} (declared in ${i} settings)`)}catch(e){Z(e,`add marketplace`)}}async function le(e){e.cowork&&n(!0);try{let n=await y(),r=Object.keys(n);e.json&&N(E(r.sort().map(e=>{let t=n[e],r=t?.source;return{name:e,source:r?.source,...r?.source===`github`&&{repo:r.repo},...r?.source===`git`&&{url:r.url},...r?.source===`url`&&{url:r.url},...r?.source===`directory`&&{path:r.path},...r?.source===`file`&&{path:r.path},installLocation:t?.installLocation}}),null,2)),r.length===0&&N(`No marketplaces configured`),console.log(`Configured marketplaces:
4
- `),r.forEach(e=>{let r=n[e];if(console.log(` ${t.pointer} ${e}`),r?.source){let e=r.source;e.source===`github`?console.log(` Source: GitHub (${e.repo})`):e.source===`git`?console.log(` Source: Git (${e.url})`):e.source===`url`?console.log(` Source: URL (${e.url})`):e.source===`directory`?console.log(` Source: Directory (${e.path})`):e.source===`file`&&console.log(` Source: File (${e.path})`)}console.log(``)}),N()}catch(e){Z(e,`list marketplaces`)}}async function $(e,r){r.cowork&&n(!0);try{await ee(e),l(),N(`${t.tick} Successfully removed marketplace: ${e}`)}catch(e){Z(e,`remove marketplace`)}}async function ue(e,r){r.cowork&&n(!0);try{if(e)console.log(`Updating marketplace: ${e}...`),await b(e,e=>{console.log(e)}),l(),N(`${t.tick} Successfully updated marketplace: ${e}`);else{let e=await y(),n=Object.keys(e);n.length===0&&N(`No marketplaces configured`),console.log(`Updating ${n.length} marketplace(s)...`),await x(),l(),n.length,N(`${t.tick} Successfully updated ${n.length} marketplace(s)`)}}catch(e){Z(e,`update marketplace(s)`)}}async function de(e,t){t.cowork&&n(!0);let r=t.scope||`user`;t.cowork&&r!==`user`&&P(`--cowork can only be used with user scope`),L.includes(r)||P(`Invalid scope: ${r}. Must be one of: ${L.join(`, `)}.`);let{name:i,marketplace:a}=g(e);({...a&&{_PROTO_marketplace_name:a}}),await z(e,r)}async function fe(e,t){t.cowork&&n(!0);let r=t.scope||`user`;t.cowork&&r!==`user`&&P(`--cowork can only be used with user scope`),L.includes(r)||P(`Invalid scope: ${r}. Must be one of: ${L.join(`, `)}.`);let{name:i,marketplace:a}=g(e);({...a&&{_PROTO_marketplace_name:a}}),await R(e,r,t.keepData)}async function pe(e,t){t.cowork&&n(!0);let r;t.scope&&(L.includes(t.scope)||P(`Invalid scope "${t.scope}". Valid scopes: ${L.join(`, `)}`),r=t.scope),t.cowork&&r!==void 0&&r!==`user`&&P(`--cowork can only be used with user scope`),t.cowork&&r===void 0&&(r=`user`);let{name:i,marketplace:a}=g(e);({...a&&{_PROTO_marketplace_name:a}}),await H(e,r)}async function me(e,t){if(t.all&&e&&P(`Cannot use --all with a specific plugin`),!t.all&&!e&&P(`Please specify a plugin name or use --all to disable all plugins`),t.cowork&&n(!0),t.all){t.scope&&P(`Cannot use --scope with --all`),await U();return}let r;t.scope&&(L.includes(t.scope)||P(`Invalid scope "${t.scope}". Valid scopes: ${L.join(`, `)}`),r=t.scope),t.cowork&&r!==void 0&&r!==`user`&&P(`--cowork can only be used with user scope`),t.cowork&&r===void 0&&(r=`user`);let{name:i,marketplace:a}=g(e);({...a&&{_PROTO_marketplace_name:a}}),await B(e,r)}async function he(e,t){t.cowork&&n(!0);let{name:r,marketplace:i}=g(e);({...i&&{_PROTO_marketplace_name:i}});let a=`user`;t.scope&&(F.includes(t.scope)||P(`Invalid scope "${t.scope}". Valid scopes: ${F.join(`, `)}`),a=t.scope),t.cowork&&a!==`user`&&P(`--cowork can only be used with user scope`),await V(e,a)}export{ce as marketplaceAddHandler,le as marketplaceListHandler,$ as marketplaceRemoveHandler,ue as marketplaceUpdateHandler,me as pluginDisableHandler,pe as pluginEnableHandler,de as pluginInstallHandler,se as pluginListHandler,fe as pluginUninstallHandler,he as pluginUpdateHandler,oe as pluginValidateHandler};
@@ -1 +0,0 @@
1
- import{a as e}from"./rolldown-runtime-DaDcL9Zw.js";import{I as t,t as n}from"./src-BX54x08P.js";import{t as r}from"./jsx-runtime-Bb4Xn-E0.js";import{m as i,t as a}from"./settings-D4M13toi.js";import{$x as o,Ac as s,Eg as c,Ji as l,Qu as u,Qx as d,Tg as f,Yx as p,Zu as m,_m as h,gm as g,kc as _,mb as v,nS as y,pb as b,vm as x,ym as S}from"./loadAgentsDir-uuZYOgKn.js";import{A as C,I as w,M as T}from"./debug-2pVES-2G.js";import{n as E}from"./analytics-COpjZpvd.js";import{St as D,xt as O}from"./prompt-BfXryFt-.js";import{randomUUID as k}from"crypto";n(),h(),u(),S();var A=r();function j({input:e,progress:n,verbose:r}){return(0,A.jsxs)(t,{flexDirection:`column`,marginTop:1,children:[(0,A.jsx)(m,{addMargin:!1,param:{text:`<bash-input>${e}</bash-input>`,type:`text`}}),n?(0,A.jsx)(x,{fullOutput:n.fullOutput,output:n.output,elapsedTimeSeconds:n.elapsedTimeSeconds,totalLines:n.totalLines,verbose:r}):g.renderToolUseProgressMessage?.([],{verbose:r,tools:[],terminalSize:void 0})]})}w(),E(),b(),l(),i();function M(){return a().defaultShell??`bash`}h(),O(),c();async function N(t,n,r,i,a){let c=D()&&M()===`powershell`,l=o({content:y({inputString:`<bash-input>${t}</bash-input>`,precedingInputBlocks:n})}),u;a({jsx:(0,A.jsx)(j,{input:t,progress:null,verbose:i.options.verbose}),shouldHidePromptInput:!1});try{let n={...i,setToolJSX:e=>{u=e?.jsx}},d=e=>{a({jsx:(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(j,{input:t,progress:e.data,verbose:i.options.verbose}),u]}),shouldHidePromptInput:!1,showSpinner:!1})},m=null;c&&(m=(s(),e(_)).PowerShellTool);let h=m??g,y=(m?await m.call({command:t,dangerouslyDisableSandbox:!0},n,void 0,void 0,d):await g.call({command:t,dangerouslyDisableSandbox:!0},n,void 0,void 0,d)).data;if(!y)throw Error(`No result received from shell command`);let b=y.stderr,x=await v(h,{...y,stderr:``},k()),S=typeof x.content==`string`?x.content:f(y.stdout);return{messages:[p(),l,...r,o({content:`<bash-stdout>${S}</bash-stdout><bash-stderr>${f(b)}</bash-stderr>`})],shouldQuery:!1}}catch(e){return e instanceof C?e.interrupted?{messages:[p(),l,d({toolUse:!1}),...r],shouldQuery:!1}:{messages:[p(),l,...r,o({content:`<bash-stdout>${f(e.stdout)}</bash-stdout><bash-stderr>${f(e.stderr)}</bash-stderr>`})],shouldQuery:!1}:{messages:[p(),l,...r,o({content:`<bash-stderr>Command failed: ${f(T(e))}</bash-stderr>`})],shouldQuery:!1}}finally{a(null)}}export{N as processBashCommand};
@@ -1,5 +0,0 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{At as t,kt as n}from"./settings-D4M13toi.js";import{An as r,Pt as i,at as a,t as o}from"./state-CXY-q5gr.js";import{$o as s,$x as c,Av as l,B as u,B_ as d,Bv as f,Ca as p,Cx as m,E as h,Ei as g,Fb as _,Gs as v,H_ as y,Hs as b,Ji as x,Kx as S,Mh as C,Mi as w,Nb as T,Ni as E,Pb as D,Qo as O,Qp as ee,Qx as te,Tp as ne,Tv as re,Tx as k,V as ie,Vx as ae,Ws as oe,Xp as se,Xx as ce,Yg as le,Yx as A,Zg as ue,Zp as de,_d as j,au as fe,b as pe,bd as me,bg as he,cu as ge,cv as M,dv as N,eS as P,eu as F,gc as I,gd as L,hc as _e,iS as ve,jh as ye,ji as be,la as xe,lu as Se,nS as R,nu as z,rS as Ce,ts as we,tu as Te,vd as Ee,wi as De,wp as Oe,wv as ke,wx as B,xg as Ae,xi as je,yd as Me,zv as Ne}from"./loadAgentsDir-uuZYOgKn.js";import{E as Pe,I as Fe,c as V,f as Ie,i as H,k as U,u as Le}from"./debug-2pVES-2G.js";import{D as W,O as G,o as Re,q as ze,s as K}from"./log-L1kqxa_P.js";import{n as Be}from"./analytics-COpjZpvd.js";import{At as Ve,kt as He}from"./model-CcHyMyBv.js";import{n as Ue,t as We}from"./sleep-xKMbXTJe.js";import{E as Ge,T as Ke,w as qe}from"./sessionTracing-DsdcOqvc.js";import{randomUUID as q}from"crypto";function Je(e,n,r,i,a){let o=0;for(let s of t){let t=r[s];if(t)for(let r of t)for(let t of r.hooks){let c=t.once?()=>{V(`Removing one-shot hook for event ${s} in skill '${i}'`),me(e,n,s,t)}:void 0;Ee(e,n,s,r.matcher||``,t,c,a),o++}}o>0&&V(`Registered ${o} hooks from skill '${i}'`)}var Ye=e((()=>{n(),H(),Me()}));function Xe(e){let t=e.trim();if(!t.startsWith(`/`))return null;let n=t.slice(1).split(` `);if(!n[0])return null;let r=n[0],i=!1,a=1;n.length>1&&n[1]===`(MCP)`&&(r=`${r} (MCP)`,i=!0,a=2);let o=n.slice(a).join(` `);return{commandName:r,args:o,isMcp:i}}var Ze=e((()=>{}));function Qe(){return!1}function $e(){if(!Qe())throw Error(`ToolUseContext.options.allowBackgroundForkedSlashCommands is test-only and cannot be enabled outside NODE_ENV=test.`)}async function J(e,t,n,r,i,a,o){let s=Oe(),l=e.pluginInfo?k(e.pluginInfo.repository).marketplace:void 0;e.name,{...e.pluginInfo&&{_PROTO_plugin_name:e.pluginInfo.pluginManifest.name,...l&&{_PROTO_marketplace_name:l},...z(e.pluginInfo)}};let{skillContent:u,modifiedGetAppState:d,baseAgent:f,promptMessages:p}=await v(e,t,n);V(`Executing forked slash command /${e.name} with agent ${f.agentType}`);let m=n.options.allowBackgroundForkedSlashCommands===!0;if(m&&$e(),m){let t=Ne(),r=E(e),i=He(),c=e=>re({value:e,mode:`prompt`,priority:`later`,isMeta:!0,skipSlashCommands:!0,workload:i}),l=async()=>{if(!o?.runId)return;let e=await se({runId:o.runId,rootDir:o.rootDir,priority:`later`,workload:i});for(let t of e)ke(t)},u=async e=>{o?.runId&&await de({runId:o.runId,rootDir:o.rootDir,error:e instanceof Error?e.message:String(e)})};return(async()=>{let i=Date.now()+$;for(;Date.now()<i&&n.getAppState().mcp.clients.some(e=>e.type===`pending`);)await Ue(Q);let o=n.options.refreshTools?.()??n.options.tools,u=[];for await(let r of j({agentDefinition:f,promptMessages:p,toolUseContext:{...n,getAppState:d,abortController:t},canUseTool:a,isAsync:!0,querySource:`agent:custom`,model:e.model,availableTools:o,override:{agentId:s}}))u.push(r);let m=b(u,`Command completed`);V(`Background forked command /${r} completed (agent ${s})`),c(`<scheduled-task-result command="/${r}">\n${m}\n</scheduled-task-result>`);try{await l()}catch(e){K(e)}})().catch(async e=>{K(e),c(`<scheduled-task-result command="/${r}" status="failed">\n${e instanceof Error?e.message:String(e)}\n</scheduled-task-result>`),await u(e)}),{messages:[],shouldQuery:!1,command:e,deferAutonomyCompletion:!!o?.runId}}let h=[],g=[],_=`forked-command-${e.name}`,y=0,x=e=>(y++,{type:`progress`,data:{message:e,type:`agent_progress`,prompt:u,agentId:s},parentToolUseID:_,toolUseID:`${_}-${y}`,timestamp:new Date().toISOString(),uuid:q()}),S=()=>{i({jsx:Se(g,{tools:n.options.tools,verbose:!1}),shouldHidePromptInput:!1,shouldContinueAnimation:!0,showSpinner:!0})};S();try{for await(let t of j({agentDefinition:f,promptMessages:p,toolUseContext:{...n,getAppState:d},canUseTool:a,isAsync:!1,querySource:`agent:custom`,model:e.model,availableTools:n.options.tools})){h.push(t);let e=xe([t]);if(t.type===`assistant`){let r=M(t);r>0&&n.setResponseLength(e=>e+r);let i=e[0];i&&i.type===`assistant`&&(g.push(x(t)),S())}if(t.type===`user`){let t=e[0];t&&t.type===`user`&&(g.push(x(t)),S())}}}finally{i(null)}let C=b(h,`Command completed`);return V(`Forked slash command /${e.name} completed with agent ${s}`),{messages:[c({content:R({inputString:`/${E(e)} ${t}`.trim(),precedingInputBlocks:r})}),c({content:`<local-command-stdout>\n${C}\n</local-command-stdout>`})],shouldQuery:!1,command:e,resultText:C}}function et(e){return!/[^a-zA-Z0-9:\-_]/.test(e)}async function tt(e,t,n,i,a,o,s,l,u,d){let f=Xe(e);if(!f){let e="Commands are in the form `/command [args]`";return{messages:[A(),...i,c({content:R({inputString:e,precedingInputBlocks:t})})],shouldQuery:!1,resultText:e}}let{commandName:m,args:h,isMcp:g}=f,_=g?`mcp`:je().has(m)?m:`custom`;if(!be(m,a.options.commands)){let n=!1;try{await Le().stat(`/${m}`),n=!0}catch{}if(et(m)&&!n){let e=`Unknown skill: ${m}`;return{messages:[A(),...i,c({content:R({inputString:e,precedingInputBlocks:t})}),...h?[ce(`Args from unknown skill: ${h}`,`warning`)]:[]],shouldQuery:!1,resultText:e}}let a=q();return r(a),Ke(`user_prompt`,{prompt_length:String(e.length),prompt:Ge(e),"prompt.id":a}),{messages:[c({content:R({inputString:e,precedingInputBlocks:t}),uuid:s}),...i],shouldQuery:!0}}let{messages:v,shouldQuery:y,allowedTools:b,model:x,command:S,resultText:C,nextInput:w,submitNextInput:T,deferAutonomyCompletion:E}=await nt(m,h,o,a,t,n,l,u,s,d);if(v.length===0){let e={input:_};if(S.type===`prompt`&&S.pluginInfo){let{pluginManifest:t,repository:n}=S.pluginInfo,{marketplace:r}=k(n),i=B(r);e._PROTO_plugin_name=t.name,r&&(e._PROTO_marketplace_name=r),e.plugin_repository=i?n:`third-party`,e.plugin_name=i?t.name:`third-party`,i&&t.version&&(e.plugin_version=t.version),Object.assign(e,z(S.pluginInfo))}return{...e},{messages:[],shouldQuery:!1,model:x,nextInput:w,submitNextInput:T,deferAutonomyCompletion:E}}if(v.length===2&&v[1].type===`user`&&typeof v[1].message.content==`string`&&v[1].message.content.startsWith(`Unknown command:`))return e.startsWith(`/var`)||e.startsWith(`/tmp`)||e.startsWith(`/private`),{messages:[A(),...v],shouldQuery:y,allowedTools:b,model:x};let D={input:_};if(S.type===`prompt`&&S.pluginInfo){let{pluginManifest:e,repository:t}=S.pluginInfo,{marketplace:n}=k(t),r=B(n);D._PROTO_plugin_name=e.name,n&&(D._PROTO_marketplace_name=n),D.plugin_repository=r?t:`third-party`,D.plugin_name=r?e.name:`third-party`,r&&e.version&&(D.plugin_version=e.version),Object.assign(D,z(S.pluginInfo))}({...D});let O=v.length>0&&v[0]&&ae(v[0]);return{messages:y||v.every(p)||O?v:[A(),...v],shouldQuery:y,allowedTools:b,model:x,resultText:C,nextInput:w,submitNextInput:T,deferAutonomyCompletion:E}}async function nt(e,t,n,r,i,a,o,s,l,d){let f=g(e,r.options.commands);if(f.type===`prompt`&&f.userInvocable!==!1&&Te(e),f.userInvocable===!1)return{messages:[c({content:R({inputString:`/${e}`,precedingInputBlocks:i})}),c({content:`This skill can only be invoked by Work Mate, not directly by users. Ask Work Mate to use the "${e}" skill for you.`})],shouldQuery:!1,command:f};try{switch(f.type){case`local-jsx`:return new Promise(e=>{let a=!1,o=(n,r)=>{if(a=!0,r?.display===`skip`){e({messages:[],shouldQuery:!1,command:f,nextInput:r?.nextInput,submitNextInput:r?.submitNextInput});return}let o=(r?.metaMessages??[]).map(e=>c({content:e,isMeta:!0})),s=C()&&typeof n==`string`&&n.endsWith(` dismissed`),l=r?.displayArgs??t;e({messages:r?.display===`system`?s?o:[S(Y(f,l)),S(`<local-command-stdout>${n}</local-command-stdout>`),...o]:[c({content:R({inputString:Y(f,l),precedingInputBlocks:i})}),c(n?{content:`<local-command-stdout>${n}</local-command-stdout>`}:{content:`<local-command-stdout>${Ce}</local-command-stdout>`}),...o],shouldQuery:r?.shouldQuery??!1,command:f,nextInput:r?.nextInput,submitNextInput:r?.submitNextInput})};f.load().then(e=>e.call(o,{...r,canUseTool:s},t)).then(t=>{if(t!=null){if(r.options.isNonInteractiveSession){e({messages:[],shouldQuery:!1,command:f});return}a||n({jsx:t,shouldHidePromptInput:!0,showSpinner:!1,isLocalJSXCommand:!0,isImmediate:f.immediate===!0})}}).catch(t=>{K(t),!a&&(a=!0,n({jsx:null,shouldHidePromptInput:!1,clearLocalJSX:!0}),e({messages:[],shouldQuery:!1,command:f}))})});case`local`:{let e=c({content:R({inputString:Y(f,f.isSensitive&&t.trim()?`***`:t),precedingInputBlocks:i})});try{let n=A(),i=await(await f.load()).call(t,r);if(i.type===`skip`)return{messages:[],shouldQuery:!1,command:f};if(i.type===`compact`){let t=[n,e,...i.displayText?[c({content:`<local-command-stdout>${i.displayText}</local-command-stdout>`,timestamp:new Date(Date.now()+100).toISOString()})]:[]],r={...i.compactionResult,messagesToKeep:[...i.compactionResult.messagesToKeep??[],...t]};return y(),{messages:le(r),shouldQuery:!1,command:f}}return{messages:[e,S(`<local-command-stdout>${i.value}</local-command-stdout>`)],shouldQuery:!1,command:f,resultText:i.value}}catch(t){return K(t),{messages:[e,S(`<local-command-stderr>${String(t)}</local-command-stderr>`)],shouldQuery:!1,command:f}}}case`prompt`:try{return f.context===`fork`?await J(f,t,r,i,n,s??u,d):await Z(f,t,r,i,a,l)}catch(e){return e instanceof Pe?{messages:[c({content:R({inputString:Y(f,t),precedingInputBlocks:i})}),te({toolUse:!1})],shouldQuery:!1,command:f}:{messages:[c({content:R({inputString:Y(f,t),precedingInputBlocks:i})}),c({content:`<local-command-stderr>${String(e)}</local-command-stderr>`})],shouldQuery:!1,command:f}}}}catch(e){if(e instanceof U)return{messages:[c({content:R({inputString:e.message,precedingInputBlocks:i})})],shouldQuery:!1,command:f};throw e}}function Y(e,t){return P(E(e),t)}function X(e,t=`loading`){return[`<${W}>${e}</${W}>`,`<${G}>${e}</${G}>`,`<skill-format>true</skill-format>`].join(`
2
- `)}function rt(e,t){return[`<${W}>${e}</${W}>`,`<${G}>/${e}</${G}>`,t?`<command-args>${t}</command-args>`:null].filter(Boolean).join(`
3
- `)}function it(e,t){return e.userInvocable===!1&&(e.loadedFrom===`skills`||e.loadedFrom===`plugin`||e.loadedFrom===`mcp`)?X(e.name,e.progressMessage):rt(e.name,t)}async function at(e,t,n,r,i=[]){let a=De(e,n);if(!a)throw new U(`Unknown command: ${e}`);if(a.type!==`prompt`)throw Error(`Unexpected ${a.type} command. Expected 'prompt' command. Use /${e} directly in the main conversation.`);return Z(a,t,r,[],i)}async function Z(e,t,n,r=[],i=[],l){let u=await e.getPromptForCommand(t,n),d=!D(`hooks`)||_(e.source);if(e.hooks&&d){let t=a();Je(n.setAppState,t,e.hooks,e.name,e.type===`prompt`?e.skillRoot:void 0)}let f=e.source?`${e.source}:${e.name}`:e.name,p=u.filter(e=>e.type===`text`).map(e=>e.text).join(`
4
-
5
- `);o(e.name,f,p,he()?.agentId??null);let m=it(e,t),g=h(e.allowedTools??[]),v=i.length>0||r.length>0?[...i,...r,...u]:u,y=await I(s(u.filter(e=>e.type===`text`).map(e=>e.text).join(` `),n,[],n.messages,`repl_main_thread`,{skipSkillDiscovery:!0}));return{messages:[c({content:m,uuid:l}),c({content:v,isMeta:!0}),...y,O({type:`command_permissions`,allowedTools:g,model:e.model})],shouldQuery:!0,allowedTools:g,model:e.model,command:e}}var Q,$;e((()=>{i(),w(),ve(),ze(),Be(),ue(),d(),L(),ge(),f(),Ae(),we(),H(),Fe(),oe(),Ie(),ye(),_e(),Ye(),Re(),l(),x(),pe(),ie(),m(),T(),Ze(),We(),F(),qe(),fe(),N(),ne(),ee(),Ve(),Q=200,$=1e4}))();export{X as formatSkillLoadingMetadata,at as processPromptSlashCommand,tt as processSlashCommand};
@@ -1 +0,0 @@
1
- import{Qb as e,ix as t}from"./loadAgentsDir-uuZYOgKn.js";t();export{e as clearPromptCache};
@@ -1 +0,0 @@
1
- import{i as e,r as t}from"./prompt-BfXryFt-.js";t();export{e as isDeferredTool};
@@ -1 +0,0 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{Pt as t,q as n}from"./state-CXY-q5gr.js";import{Fa as r,Fm as i,Go as a,Hm as o,Km as s,Ko as c,Lm as l,Mo as u,No as d,Pa as f,Wm as p,_f as m,c_ as h,i as g,o as _,qm as v,s_ as y,vf as b}from"./loadAgentsDir-uuZYOgKn.js";import{I as x,M as S,c as C,i as w}from"./debug-2pVES-2G.js";import{o as T,s as E}from"./log-L1kqxa_P.js";async function D(e){C(`refreshActivePlugins: clearing all plugin caches`),u(),i();let t=await r(),[o,s]=await Promise.all([a(),g(n())]),{enabled:c,disabled:l,errors:d}=t,[f,m]=await Promise.all([Promise.all(c.map(async e=>{if(e.mcpServers)return Object.keys(e.mcpServers).length;let t=await b(e,d);return t&&(e.mcpServers=t),t?Object.keys(t).length:0})),Promise.all(c.map(async e=>{if(e.lspServers)return Object.keys(e.lspServers).length;let t=await v(e,d);return t&&(e.lspServers=t),t?Object.keys(t).length:0}))]),_=f.reduce((e,t)=>e+t,0),y=m.reduce((e,t)=>e+t,0);e(e=>({...e,plugins:{...e.plugins,enabled:c,disabled:l,commands:o,errors:O(e.plugins.errors,d),needsRefresh:!1},agentDefinitions:s,mcp:{...e.mcp,pluginReconnectKey:e.mcp.pluginReconnectKey+1}})),p();let x=!1;try{await h()}catch(e){x=!0,E(e),C(`refreshActivePlugins: loadPluginHooks failed: ${S(e)}`)}let w=c.reduce((e,t)=>t.hooksConfig?e+Object.values(t.hooksConfig).reduce((e,t)=>e+(t?.reduce((e,t)=>e+t.hooks.length,0)??0),0):e,0);return C(`refreshActivePlugins: ${c.length} enabled, ${o.length} commands, ${s.allAgents.length} agents, ${w} hooks, ${_} MCP, ${y} LSP`),{enabled_count:c.length,disabled_count:l.length,command_count:o.length,agent_count:s.allAgents.length,hook_count:w,mcp_count:_,lsp_count:y,error_count:d.length+ +!!x,agentDefinitions:s,pluginCommands:o}}function O(e,t){let n=e.filter(e=>e.source===`lsp-manager`||e.source.startsWith(`plugin:`)),r=new Set(t.map(k));return[...n.filter(e=>!r.has(k(e))),...t]}function k(e){return e.type===`generic-error`?`generic-error:${e.source}:${e.error}`:`${e.type}:${e.source}`}var A=e((()=>{t(),o(),_(),w(),x(),T(),d(),c(),y(),s(),m(),l(),f()}));export{D as n,A as t};
@@ -1 +0,0 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{Pt as t,at as n}from"./state-CXY-q5gr.js";import{Ji as r,Rx as i,Zr as a,ei as o,fr as s,gr as c}from"./loadAgentsDir-uuZYOgKn.js";import{n as l,t as u}from"./generateSessionName-CO2484aJ.js";async function d(e,t,r){let c;if(!r||r.trim()===``){let n=await u(i(t.messages),t.abortController.signal);if(!n)return e(`Could not generate a name: no conversation context yet. Usage: /rename <name>`,{display:`system`}),null;c=n}else c=r.trim();let l=n(),d=s();return await o(l,c,d),await a(l,c,d),t.setAppState(e=>({...e,standaloneAgentContext:{...e.standaloneAgentContext,name:c}})),e(`Session renamed to: ${c}`,{display:`system`}),null}e((()=>{t(),r(),c(),l()}))();export{d as call};
@@ -1 +0,0 @@
1
- import{aC as e,sC as t}from"./loadAgentsDir-uuZYOgKn.js";t();export{e as SandboxManager};
@@ -1 +0,0 @@
1
- import{S_ as e,b_ as t}from"./loadAgentsDir-uuZYOgKn.js";t();export{e as isSearchExtraToolsEnabled};
@@ -1 +0,0 @@
1
- import{Am as e,km as t}from"./loadAgentsDir-uuZYOgKn.js";t();export{e as registerSessionFileAccessHooks};
@@ -1 +0,0 @@
1
- import{n as e,r as t}from"./sessionObserver-cfwD8pV8.js";t();export{e as heuristicObserverBackend};
@@ -1 +0,0 @@
1
- import{Cr as e,Wr as t,gr as n}from"./loadAgentsDir-uuZYOgKn.js";n();export{e as linkSessionToPR,t as recordTranscript};
@@ -1,3 +0,0 @@
1
- import{n as e,t}from"./memoize-BK3gG5ob.js";import{l as n,o as r,s as i}from"./envUtils-QyzA_cFM.js";import{di as a,fi as o}from"./src-BX54x08P.js";import{$n as s,Qn as c,Rr as l,Ur as ee,Xt as u,di as d,qr as f,qt as te,ui as p,zr as ne}from"./settings-D4M13toi.js";import{Dn as re,F as m,Hn as h,Pt as g,Tn as ie,X as ae,at as oe}from"./state-CXY-q5gr.js";import{$_ as _,$x as v,Ab as se,An as ce,At as y,Bs as le,By as ue,Cg as de,Db as fe,Di as pe,J_ as b,Ji as x,Ks as S,Lp as C,Mb as w,Mi as T,Ob as E,Q_ as D,Rp as O,St as k,Vs as A,Ws as j,X_ as M,Y_ as N,Z_ as P,ai as F,am as I,av as L,bb as R,cw as z,dv as B,em as me,ev as he,gr as ge,gt as _e,ht as ve,im as ye,iv as be,jb as xe,jn as Se,kn as Ce,ky as we,mn as Te,nv as Ee,om as De,ov as Oe,ow as ke,pn as Ae,pv as V,rv as je,tm as Me,tv as Ne,uv as Pe,vt as H,wg as Fe,wy as Ie,xb as U,ya as W,zy as Le}from"./loadAgentsDir-uuZYOgKn.js";import{n as Re,t as G}from"./cwd-DrEEb4f5.js";import{I as K,M as ze,N as Be,f as Ve,u as He}from"./debug-2pVES-2G.js";import{a as Ue,d as We}from"./config-BDn2YIjC.js";import{o as Ge,s as Ke}from"./log-L1kqxa_P.js";import{n as q}from"./analytics-COpjZpvd.js";import{n as qe,r as J}from"./startupProfiler-B9Qv2QGH.js";import{X as Je,Y as Ye}from"./model-CcHyMyBv.js";import{ln as Y,pn as Xe}from"./prompt-BfXryFt-.js";import{a as Ze,r as Qe}from"./projectOnboardingState-nTCycGCD.js";import{j as $e,k as X}from"./sessionTracing-DsdcOqvc.js";import{i as et,n as tt}from"./appleTerminalBackup-Bemd4RXh.js";import{c as nt,t as rt}from"./nativeInstaller-CIUYh1aD.js";import{l as Z,s as it}from"./logoUtils-B4wCDKs9.js";import{i as at,r as ot}from"./runtimeObserver-CWaYMJG8.js";import{t as st}from"./sinks-Cy3NqVbk.js";import{writeFile as Q}from"fs/promises";r(),o(),g(),Re(),p(),Ge(),f(),u(),We(),z(),xe(),fe(),R(),Fe(),T(),ge(),Te(),t(),Xe(),ue(),s(),j(),Ve(),C(),x(),Se(),Ye(),B(),q(),me(),I(),_(),K();function ct(){return!1}function lt(){return{}}var $;function ut(e,t){let n=0,r=t==null;for(let i of e){if(!r){i.uuid===t&&(r=!0);continue}if(i.type===`assistant`){let e=i.message.content;Array.isArray(e)&&(n+=c(e,e=>e.type===`tool_use`))}}return n}function dt(e){let t=V(e);if(!he()){if(!P(t))return!1;je()}let n=D(t),r=ut(e,$)>=M(),i=W(e);if(n&&r||n&&!i){let t=e[e.length-1];return t?.uuid&&($=t.uuid),!0}return!1}async function ft(e){let t=He(),n=Ce();await t.mkdir(n,{mode:448});let r=ce();try{await Q(r,``,{encoding:`utf-8`,mode:384,flag:`wx`}),await Q(r,await De(),{encoding:`utf-8`,mode:384})}catch(e){if(Be(e)!==`EEXIST`)throw e}e.readFileState.delete(r);let i=await Le.call({file_path:r},e),a=``,o=i.data;return o.type===`text`&&(a=o.file.content),a.length,{memoryPath:r,currentMemory:a}}var pt=e(()=>{let e=lt();Oe({minimumMessageTokensToInit:e.minimumMessageTokensToInit&&e.minimumMessageTokensToInit>0?e.minimumMessageTokensToInit:b.minimumMessageTokensToInit,minimumTokensBetweenUpdate:e.minimumTokensBetweenUpdate&&e.minimumTokensBetweenUpdate>0?e.minimumTokensBetweenUpdate:b.minimumTokensBetweenUpdate,toolCallsBetweenUpdates:e.toolCallsBetweenUpdates&&e.toolCallsBetweenUpdates>0?e.toolCallsBetweenUpdates:b.toolCallsBetweenUpdates})}),mt=Je(async e=>{let{messages:t,toolUseContext:n,querySource:r}=e;if(r!==`repl_main_thread`||!ct()||(pt(),!dt(t)))return;Ee();let i=A(n),{memoryPath:a,currentMemory:o}=await ft(i);await S({promptMessages:[v({content:await ye(o,a)})],cacheSafeParams:le(e),canUseTool:gt(a),querySource:`session_memory`,forkLabel:`session_memory`,overrides:{readFileState:i.readFileState}});let s=t[t.length-1],c=s?Pe(s):void 0,l=N();c?.input_tokens,c?.output_tokens,c?.cache_read_input_tokens,c?.cache_creation_input_tokens,l.minimumMessageTokensToInit,l.minimumTokensBetweenUpdate,l.toolCallsBetweenUpdates,be(V(t)),_t(t),Ne()});function ht(){Me()&&O(mt)}function gt(e){return async(t,n)=>{if(t.name===`Edit`&&typeof n==`object`&&n&&`file_path`in n){let t=n.file_path;if(typeof t==`string`&&t===e)return{behavior:`allow`,updatedInput:n}}return{behavior:`deny`,message:`only ${Y} on ${e} is allowed`,decisionReason:{type:`other`,reason:`only ${Y} on ${e} is allowed`}}}}function _t(e){if(!W(e)){let t=e[e.length-1];t?.uuid&&L(t.uuid)}}q(),at(),et(),we(),$e(),K(),Z(),rt(),Qe(),qe(),k();async function vt(e,t,r,o,s,c,u,f){d(`info`,`setup_started`);let p=process.version.match(/^v(\d+)\./)?.[1];if((!p||parseInt(p,10)<18)&&(console.error(a.bold.red(`Error: Work Mate requires Node.js version 18 or higher.`)),process.exit(1)),u&&h(de(u)),!m())try{let e=await tt();e.status===`restored`?console.log(a.yellow(`Detected an interrupted Terminal.app setup. Your original settings have been restored. You may need to restart Terminal.app for the changes to take effect.`)):e.status===`failed`&&console.error(a.red(`Failed to restore Terminal.app settings. Please manually restore your original settings with: defaults import com.apple.Terminal ${e.backupPath}.`))}catch(e){Ke(e)}U(e);let g=Date.now();if(se(),d(`info`,`setup_hooks_captured`,{duration_ms:Date.now()-g}),E(e),o){let t=Ae(),n=await ee();!t&&!n&&(process.stderr.write(a.red(`Error: Can only use --worktree in a git repository, but ${a.bold(e)} is not a git repository. Configure a WorktreeCreate hook in settings.json to use --worktree with other VCS systems.\n`)),process.exit(1));let r=f?`pr-${f}`:s??ke(),i;if(n){let e=l(G());e||(process.stderr.write(a.red(`Error: Could not determine the main git repository root.
2
- `)),process.exit(1)),e!==(ne(G())??G())&&(d(`info`,`worktree_resolved_to_main_repo`),process.chdir(e),U(e)),i=c?H(e,y(r)):void 0}else i=c?H(G(),y(r)):void 0;let o;try{o=await _e(oe(),r,i,f?{prNumber:f}:void 0)}catch(e){process.stderr.write(a.red(`Error creating worktree: ${ze(e)}\n`)),process.exit(1)}if(c&&i){let e=await ve(i,o.worktreePath);e.created?console.log(a.green(`Created tmux session: ${a.bold(i)}\nTo attach: ${a.bold(`tmux attach -t ${i}`)}`)):console.error(a.yellow(`Warning: Failed to create tmux session: ${e.error}`))}process.chdir(o.worktreePath),U(o.worktreePath),ie(G()),re(G()),F(o),Ie(),w()}d(`info`,`setup_background_jobs_starting`),i()||(ht(),ot()),nt(),d(`info`,`setup_background_jobs_launched`),J(`setup_before_prefetch`),d(`info`,`setup_prefetch_starting`);let _=m()&&n(process.env.WORKMATE_SYNC_PLUGIN_INSTALL)||i();if(_||pe(ae()),import(`./loadPluginHooks-QoVXsBjy.js`).then(e=>{_||(e.loadPluginHooks(),e.setupPluginHookHotReload())}),i()||import(`./sessionFileAccessHooks-_mxyfQmn.js`).then(e=>e.registerSessionFileAccessHooks()),st(),J(`setup_after_prefetch`),!i()&&Ze()&&await it(),t===`bypassPermissions`||r){if(process.platform!==`win32`&&typeof process.getuid==`function`&&process.getuid()===0&&process.env.IS_SANDBOX!==`1`&&!n(process.env.WORKMATE_BUBBLEWRAP))if(process.stdin.isTTY){console.error(a.bold.red(`WARNING: Running as root/sudo with bypass permissions mode is dangerous.`)),console.error(a.yellow(`Bypass mode skips ALL permission checks. Combined with root, any command (rm -rf /, chmod, dd) executes without review.`));let e=(await import(`readline`)).createInterface({input:process.stdin,output:process.stdout}),t=await new Promise(t=>{e.question(`
3
- I understand the risks. Continue? [y/N] `,t)});e.close(),t.trim().toLowerCase()!==`y`&&(console.error(`Aborted.`),process.exit(1))}else console.error(`--dangerously-skip-permissions cannot be used with root/sudo privileges for security reasons`),process.exit(1);if(process.env.WORKMATE_ENTRYPOINT!==`local-agent`&&process.env.WORKMATE_ENTRYPOINT!==`claude-desktop`){let[e,t]=await Promise.all([X.getIsDocker(),te.hasInternetAccess()]),n=X.getIsBubblewrapSandbox(),r=process.env.IS_SANDBOX===`1`;(!(e||n||r)||t)&&(console.error(`--dangerously-skip-permissions can only be used in Docker/sandbox containers with no internet access but got Docker: ${e}, Bubblewrap: ${n}, IS_SANDBOX: ${r}, hasInternet: ${t}`),process.exit(1))}}let v=Ue();v.lastCost!==void 0&&v.lastDuration!==void 0&&(v.lastCost,v.lastAPIDuration,v.lastToolDuration,v.lastDuration,v.lastLinesAdded,v.lastLinesRemoved,v.lastTotalInputTokens,v.lastTotalOutputTokens,v.lastTotalCacheCreationInputTokens,v.lastTotalCacheReadInputTokens,v.lastFpsAverage,v.lastFpsLow1Pct,v.lastSessionId,{...v.lastSessionMetrics})}export{vt as setup};
@@ -1 +0,0 @@
1
- import{t as e}from"./sinks-Cy3NqVbk.js";export{e as initSinks};
@@ -1 +0,0 @@
1
- import{Gn as e,Hn as t,Kn as n,Pt as r,Tn as i,U as a,at as o,h as s,vn as c,yn as l}from"./state-CXY-q5gr.js";import{Cg as ee,Ci as te,Dm as ne,Fy as re,Gg as u,Gi as ie,In as ae,Kg as oe,Mi as se,Nt as ce,Om as le,Ot as d,Py as f,Rr as p,Si as m,St as h,Ui as g,Vi as ue,Wi as de,Xr as fe,Xs as pe,Yr as me,ag as he,ai as _,bb as ge,cw as _e,dn as v,dy as y,ec as b,fy as x,gr as S,ky as C,mn as w,ni as T,ns as E,ph as D,rg as O,sw as k,ts as A,wg as j,wy as M,xb as N,yt as P}from"./loadAgentsDir-uuZYOgKn.js";import{n as F,t as I}from"./cwd-DrEEb4f5.js";import{$ as ve,c as L,et as ye,f as be,i as R,u as xe}from"./debug-2pVES-2G.js";import{n as z}from"./analytics-COpjZpvd.js";import{f as Se,v as Ce}from"./model-CcHyMyBv.js";import{Gt as we}from"./prompt-BfXryFt-.js";import{S as Te,x as Ee}from"./sleep-xKMbXTJe.js";import*as B from"path";import{dirname as De}from"path";r(),oe(),y(),we(),j(),C(),D(),pe(),F(),R(),he(),Se(),_e(),ge(),S(),f(),le(),h();function Oe(e){for(let t=e.length-1;t>=0;t--){let n=e[t];if(n?.type!==`assistant`)continue;let r=n.message.content.find(e=>e.type===`tool_use`&&e.name===`TodoWrite`);if(r?.type!==`tool_use`)continue;let i=r.input;if(typeof i!=`object`||!i)return[];let a=ne().safeParse(i.todos);return a.success?a.data:[]}return[]}function ke(e,t){if(e.fileHistorySnapshots&&e.fileHistorySnapshots.length>0&&O(e.fileHistorySnapshots,e=>{t(t=>({...t,fileHistory:e}))}),!re()&&e.messages&&e.messages.length>0){let n=Oe(e.messages);if(n.length>0){let e=o();t(t=>({...t,todos:{...t.todos,[e]:n}}))}}}function V(e,t){if(!(!e&&!t))return{name:e??``,color:t==="default"?void 0:t}}function H(e,t,n){if(t)return{agentDefinition:t,agentType:void 0};if(!e)return l(void 0),{agentDefinition:void 0,agentType:void 0};let r=n.activeAgents.find(t=>t.agentType===e);return r?(l(r.agentType),!a()&&r.model&&r.model!==`inherit`&&c(Ce(r.model)),{agentDefinition:r,agentType:r.agentType}):(L(`Resumed session had agent "${e}" but it is no longer available. Using default behavior.`),l(void 0),{agentDefinition:void 0,agentType:void 0})}function U(e){let t=P();if(t){_(t);return}if(e){try{process.chdir(e.worktreePath)}catch{_(null);return}N(e.worktreePath),i(I()),d(e),M(),u(),k.cache.clear?.()}}function Ae(){let e=P();if(e){d(null),M(),u(),k.cache.clear?.();try{process.chdir(e.originalCwd)}catch{return}N(e.originalCwd),i(I())}}async function je(e,n,r){if(n.forkSession)e.contentReplacements?.length&&await p(e.contentReplacements);else{let r=n.sessionIdOverride??e.sessionId;r&&(t(ee(r),n.transcriptPath?De(n.transcriptPath):null),await me(),x(r))}fe(n.forkSession?{...e,worktreeSession:void 0}:e),n.forkSession||(U(e.worktreeSession),ae());let{agentDefinition:i,agentType:a}=H(e.agentSetting,r.mainThreadAgentDefinition,r.agentDefinitions);T(`normal`),n.includeAttribution;let o=V(e.agentName,e.agentColor);b(e.agentName);let s=r.agentDefinitions;return{messages:e.messages,fileHistorySnapshots:e.fileHistorySnapshots,contentReplacements:e.contentReplacements,agentName:e.agentName,agentColor:e.agentColor==="default"?void 0:e.agentColor,restoredAgentDef:i,initialState:{...r.initialState,...a&&{agent:a},...o&&{standaloneAgentContext:o},agentDefinitions:s}}}Te(),r(),se(),z(),de(),A(),ve(),R(),be(),w(),n();var Me=1e3,Ne=500,Pe=300,Fe=2e3,Ie=typeof Bun<`u`,W=null,G=null,K=new Set,q=!1,J=!1,Y=!1,X=null,Z=e();async function Le(){if(q||J)return;q=!0,Y||(Y=!0,ie(()=>{m(),Z.emit()}));let e=await ze();e.length!==0&&(L(`Watching for changes in skill/command directories: ${e.join(`, `)}...`),W=Ee.watch(e,{persistent:!0,ignoreInitial:!0,depth:2,awaitWriteFinish:{stabilityThreshold:Me,pollInterval:Ne},ignored:(e,t)=>t&&!t.isFile()&&!t.isDirectory()?!0:e.split(B.sep).some(e=>e===`.git`),ignorePermissionErrors:!0,usePolling:Ie,interval:Fe,atomic:!0}),W.on(`add`,$),W.on(`change`,$),W.on(`unlink`,$),X=ye(async()=>{await Q()}))}function Q(){J=!0,X&&(X(),X=null);let e=Promise.resolve();return W&&(e=W.close(),W=null),G&&(clearTimeout(G),G=null),K.clear(),Z.clear(),e}var Re=Z.subscribe;async function ze(){let e=xe(),t=[],n=g(`userSettings`,`skills`);if(n)try{await e.stat(n),t.push(n)}catch{}let r=g(`userSettings`,`commands`);if(r)try{await e.stat(r),t.push(r)}catch{}let i=g(`projectSettings`,`skills`);if(i)try{let n=B.resolve(i);await e.stat(n),t.push(n)}catch{}let a=g(`projectSettings`,`commands`);if(a)try{let n=B.resolve(a);await e.stat(n),t.push(n)}catch{}for(let n of s()){let r=B.join(n,`.workmate`,`skills`);try{await e.stat(r),t.push(r)}catch{}}return t}function $(e){L(`Detected skill change: ${e}`),Be(e)}function Be(e){K.add(e),G&&clearTimeout(G),G=setTimeout(async()=>{G=null;let e=[...K];if(K.clear(),v(await ce(`skills`,e[0]))){L(`ConfigChange hook blocked skill reload (${e.length} paths)`);return}ue(),te(),E(),Z.emit()},Pe)}var Ve={initialize:Le,dispose:Q,subscribe:Re};export{H as a,je as i,V as n,ke as o,Ae as r,U as s,Ve as t};
@@ -1 +0,0 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{t}from"./jsx-runtime-Bb4Xn-E0.js";import{n,t as r}from"./Settings-DYKmPdbd.js";async function i(e,t){return(0,a.jsx)(r,{onClose:e,context:t,defaultTab:`Status`})}var a;e((()=>{n(),a=t()}))();export{i as call};
@@ -1 +0,0 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{Ki as t,qi as n}from"./loadAgentsDir-uuZYOgKn.js";function r(e){return e?e.activeAgents.filter(e=>e.source!==`built-in`).reduce((e,t)=>e+n(`${t.agentType}: ${t.whenToUse}`),0):0}var i,a=e((()=>{t(),i=15e3}));export{r as n,a as r,i as t};
@@ -1 +0,0 @@
1
- import{a as e,r as t}from"./switcher-DSt2cVjA.js";t();export{e as restoreActiveProvider};
@@ -1,2 +0,0 @@
1
- import{n as e,t}from"./memoize-BK3gG5ob.js";import{l as n,o as r}from"./envUtils-QyzA_cFM.js";import{di as i,fi as a,j as o,t as s}from"./src-BX54x08P.js";import{Gr as c,Jt as l,Kr as u,Ur as d,Xt as f,d as p,m,qr as h,qt as g,t as _}from"./settings-D4M13toi.js";import{Pt as v,at as y}from"./state-CXY-q5gr.js";import{$a as b,$h as x,Gv as S,Hv as C,Ya as w,_x as T,ab as E,ag as ee,fo as te,gr as ne,mC as D,ob as O,pC as k,uo as A,vr as j,yx as M}from"./loadAgentsDir-uuZYOgKn.js";import{n as N,t as P}from"./cwd-DrEEb4f5.js";import{c as F,i as I}from"./debug-2pVES-2G.js";import{a as L,d as R,h as z,l as B,m as V,o as H}from"./config-BDn2YIjC.js";import{r as U,t as W}from"./execa-CBhG1doD.js";import{o as G,s as K}from"./log-L1kqxa_P.js";import{i as q,n as J}from"./execFileNoThrow-DXSEj8ZO.js";import{i as Y,o as re}from"./bundledMode-D9omqD3L.js";import{Mt as X,Pt as ie}from"./model-CcHyMyBv.js";import{c as ae,i as oe}from"./terminalSetup-DedaY1P7.js";I(),G(),q(),h(),k(),U(),t(),v(),R(),N(),f(),r();async function se(){}e(e=>({deviceId:B(),sessionId:y(),email:void 0,appVersion:`0.0.27`,platform:l(),userType:process.env.USER_TYPE,...n(process.env.GITHUB_ACTIONS)&&{githubActionsMetadata:{actor:process.env.GITHUB_ACTOR,actorId:process.env.GITHUB_ACTOR_ID,repository:process.env.GITHUB_REPOSITORY,repositoryId:process.env.GITHUB_REPOSITORY_ID,repositoryOwner:process.env.GITHUB_REPOSITORY_OWNER,repositoryOwnerId:process.env.GITHUB_REPOSITORY_OWNER_ID}}}));var ce=e(async()=>{let e=await W(`git config --get user.email`,{shell:!0,reject:!1,cwd:P()});return e.exitCode===0&&e.stdout?e.stdout.trim():void 0});t(),N(),R(),f();var le=[/(?:^|\/)(?:package-lock\.json|yarn\.lock|bun\.lock|bun\.lockb|pnpm-lock\.yaml|Pipfile\.lock|poetry\.lock|Cargo\.lock|Gemfile\.lock|go\.sum|composer\.lock|uv\.lock)$/,/\.generated\./,/(?:^|\/)(?:dist|build|out|target|node_modules|\.next|__pycache__)\//,/\.(?:min\.js|min\.css|map|pyc|pyo)$/,/\.(?:json|ya?ml|toml|xml|ini|cfg|conf|env|lock|txt|md|mdx|rst|csv|log|svg)$/i,/(?:^|\/)\.?(?:eslintrc|prettierrc|babelrc|editorconfig|gitignore|gitattributes|dockerignore|npmrc)/,/(?:^|\/)(?:tsconfig|jsconfig|biome|vitest\.config|jest\.config|webpack\.config|vite\.config|rollup\.config)\.[a-z]+$/,/(?:^|\/)\.(?:github|vscode|idea|claude)\//,/(?:^|\/)(?:CHANGELOG|LICENSE|CONTRIBUTING|CODEOWNERS|README)(?:\.[a-z]+)?$/i];function ue(e){return!le.some(t=>t.test(e))}function de(e,t){let n=[],r=new Set,i=new Map;for(let a=1;n.length<t&&a<=t;a++)for(let o of e){if(n.length>=t)break;if(!ue(o))continue;let e=Math.max(o.lastIndexOf(`/`),o.lastIndexOf(`\\`)),s=e>=0?o.slice(e+1):o;if(!s||r.has(s))continue;let c=e>=0?o.slice(0,e):`.`;(i.get(c)??0)>=a||(n.push(s),r.add(s),i.set(c,(i.get(c)??0)+1))}return n.length>=t?n:[]}async function fe(){if(g.platform===`win32`||!await d())return[];try{let e=await ce(),t=[`log`,`-n`,`1000`,`--pretty=format:`,`--name-only`,`--diff-filter=M`],n=new Map,r=e=>{for(let t of e.split(`
2
- `)){let e=t.trim();e&&n.set(e,(n.get(e)??0)+1)}};if(e){let{stdout:n}=await J(`git`,[...t,`--author=${e}`],{cwd:P()});r(n)}if(n.size<10){let{stdout:e}=await J(u(),t,{cwd:P()});r(e)}return de(Array.from(n.entries()).sort((e,t)=>t[1]-e[1]).map(([e])=>e),5)}catch(e){return K(e),[]}}var pe=10080*60*1e3,me=e(()=>{let e=L(),t=e.exampleFiles?.length?D(e.exampleFiles):`<filepath>`;return`Try "${D([`fix lint errors`,`fix typecheck errors`,`how does ${t} work?`,`refactor ${t}`,`how do I log an error?`,`edit ${t} to...`,`write a test for ${t}`,`create a util logging.py that...`])}"`}),he=e(async()=>{let e=L();Date.now()-(e.exampleFilesGeneratedAt??0)>pe&&(e.exampleFiles=[]),e.exampleFiles?.length||fe().then(e=>{e.length&&V(t=>({...t,exampleFiles:e,exampleFilesGeneratedAt:Date.now()}))})});ie();var ge={"claude-3-opus":{modelName:`Work Mate 3 Opus`,retirementDates:{firstParty:`January 5, 2026`,bedrock:`January 15, 2026`,vertex:`January 5, 2026`,foundry:`January 5, 2026`}},"claude-3-7-sonnet":{modelName:`Work Mate 3.7 Sonnet`,retirementDates:{firstParty:`February 19, 2026`,bedrock:`April 28, 2026`,vertex:`May 11, 2026`,foundry:`February 19, 2026`}},"claude-3-5-haiku":{modelName:`Work Mate 3.5 Haiku`,retirementDates:{firstParty:`February 19, 2026`,bedrock:null,vertex:null,foundry:null}}};function _e(e){let t=e.toLowerCase(),n=X();for(let[e,r]of Object.entries(ge)){let i=r.retirementDates[n];if(!(!t.includes(e)||!i))return{isDeprecated:!0,modelName:r.modelName,retirementDate:i}}return{isDeprecated:!1}}function ve(e){if(!e)return null;let t=_e(e);return t.isDeprecated?`⚠ ${t.modelName} will be retired on ${t.retirementDate}. Consider switching to a newer model.`:null}a(),s(),re(),m(),M(),O(),S(),ee(),A(),w(),ne(),oe(),R();function ye(e){let t=H().numStartups;z(n=>{let r=n.tipsHistory??{};return r[e]===t?n:{...n,tipsHistory:{...r,[e]:t}}})}function Z(e){let t=H(),n=t.tipsHistory?.[e];return n?t.numStartups-n:1/0}R(),f(),h();var Q;async function be(){return Q===void 0&&(Q=T in await te()),Q}async function $(e,t,n){if(!await be()||b(`${e}@claude-plugins-official`))return!1;let{bashTools:r}=t??{};return!!(n.cli&&r?.size&&n.cli.some(e=>r.has(e))||n.filePath&&t?.readFileState&&C(t.readFileState).some(e=>n.filePath.test(e)))}var xe=[{id:`new-user-warmup`,content:async()=>`Start with small features or bug fixes, tell Work Mate to propose a plan, and verify its suggested edits`,cooldownSessions:3,async isRelevant(){return H().numStartups<10}},{id:`plan-mode-for-complex-tasks`,content:async()=>`Use Plan Mode to prepare for a complex request before making changes. Press ${E(`chat:cycleMode`,`Chat`,`shift+tab`)} twice to enable.`,cooldownSessions:5,isRelevant:async()=>{let e=H();return(e.lastPlanModeUse?(Date.now()-e.lastPlanModeUse)/(1e3*60*60*24):1/0)>7}},{id:`default-permission-mode-config`,content:async()=>`Use /config to change your default permission mode (including Plan Mode)`,cooldownSessions:10,isRelevant:async()=>{try{let e=H(),t=p(),n=!!e.lastPlanModeUse,r=!!t?.permissions?.defaultMode;return n&&!r}catch(e){return F(`Failed to check default-permission-mode-config tip relevance: ${e}`,{level:`warn`}),!1}}},{id:`git-worktrees`,content:async()=>`Use git worktrees to run multiple Work Mate sessions in parallel.`,cooldownSessions:10,isRelevant:async()=>{try{let e=H();return await c()<=1&&e.numStartups>50}catch{return!1}}},{id:`terminal-setup`,content:async()=>g.terminal===`Apple_Terminal`?`Run /terminal-setup to enable convenient terminal integration like Option + Enter for new line and more`:`Run /terminal-setup to enable convenient terminal integration like Shift + Enter for new line and more`,cooldownSessions:10,async isRelevant(){let e=H();return g.terminal===`Apple_Terminal`?!e.optionAsMetaKeyInstalled:!e.shiftEnterKeyBindingInstalled}},{id:`shift-enter`,content:async()=>g.terminal===`Apple_Terminal`?`Press Option+Enter to send a multi-line message`:`Press Shift+Enter to send a multi-line message`,cooldownSessions:10,async isRelevant(){let e=H();return!!((g.terminal===`Apple_Terminal`?e.optionAsMetaKeyInstalled:e.shiftEnterKeyBindingInstalled)&&e.numStartups>3)}},{id:`shift-enter-setup`,content:async()=>g.terminal===`Apple_Terminal`?`Run /terminal-setup to enable Option+Enter for new lines`:`Run /terminal-setup to enable Shift+Enter for new lines`,cooldownSessions:10,async isRelevant(){if(!ae())return!1;let e=H();return!(g.terminal===`Apple_Terminal`?e.optionAsMetaKeyInstalled:e.shiftEnterKeyBindingInstalled)}},{id:`memory-command`,content:async()=>`Use /memory to view and manage Work Mate memory`,cooldownSessions:15,async isRelevant(){return H().memoryUsageCount<=0}},{id:`theme-command`,content:async()=>`Use /theme to change the color theme`,cooldownSessions:20,isRelevant:async()=>!0},{id:`colorterm-truecolor`,content:async()=>`Try setting environment variable COLORTERM=truecolor for richer colors`,cooldownSessions:30,isRelevant:async()=>!process.env.COLORTERM&&i.level<3},{id:`powershell-tool-env`,content:async()=>`Set WORKMATE_USE_POWERSHELL_TOOL=1 to enable the PowerShell tool (preview)`,cooldownSessions:10,isRelevant:async()=>Y()===`windows`&&process.env.WORKMATE_USE_POWERSHELL_TOOL===void 0},{id:`status-line`,content:async()=>`Use /statusline to set up a custom status line that will display beneath the input box`,cooldownSessions:25,isRelevant:async()=>p().statusLine===void 0},{id:`prompt-queue`,content:async()=>`Hit Enter to queue up additional messages while Work Mate is working.`,cooldownSessions:5,async isRelevant(){return H().promptQueueUseCount<=3}},{id:`enter-to-steer-in-relatime`,content:async()=>`Send messages to Work Mate while it works to steer Work Mate in real-time`,cooldownSessions:20,isRelevant:async()=>!0},{id:`todo-list`,content:async()=>`Ask Work Mate to create a todo list when working on complex tasks to track progress and remain on track`,cooldownSessions:20,isRelevant:async()=>!0},{id:`permissions`,content:async()=>`Use /permissions to pre-approve and pre-deny bash, edit, and MCP tools`,cooldownSessions:10,async isRelevant(){return H().numStartups>10}},{id:`drag-and-drop-images`,content:async()=>`Did you know you can drag and drop image files into your terminal?`,cooldownSessions:10,isRelevant:async()=>!g.isSSH()},{id:`paste-images-mac`,content:async()=>`Paste images into Work Mate using control+v (not cmd+v!)`,cooldownSessions:10,isRelevant:async()=>Y()===`macos`},{id:`double-esc`,content:async()=>`Double-tap esc to rewind the conversation to a previous point in time`,cooldownSessions:10,isRelevant:async()=>!x()},{id:`double-esc-code-restore`,content:async()=>`Double-tap esc to rewind the code and/or conversation to a previous point in time`,cooldownSessions:10,isRelevant:async()=>x()},{id:`continue`,content:async()=>`Run claude --continue or claude --resume to resume a conversation`,cooldownSessions:10,isRelevant:async()=>!0},{id:`rename-conversation`,content:async()=>`Name your conversations with /rename to find them easily in /resume later`,cooldownSessions:15,isRelevant:async()=>j()&&H().numStartups>10},{id:`custom-commands`,content:async()=>`Create skills by adding .md files to .workmate/skills/ in your project or ~/.workmate/skills/ for skills that work in any project`,cooldownSessions:15,async isRelevant(){return H().numStartups>10}},{id:`shift-tab`,content:async()=>`Hit ${E(`chat:cycleMode`,`Chat`,`shift+tab`)} to cycle between default, accept edits, plan, auto, and bypass modes`,cooldownSessions:10,isRelevant:async()=>!0},{id:`image-paste`,content:async()=>`Use ${E(`chat:imagePaste`,`Chat`,`ctrl+v`)} to paste images from your clipboard`,cooldownSessions:20,isRelevant:async()=>!0},{id:`custom-agents`,content:async()=>`Use /agents to optimize specific tasks. Eg. Software Architect, Code Writer, Code Reviewer`,cooldownSessions:15,async isRelevant(){return H().numStartups>5}},{id:`agent-flag`,content:async()=>`Use --agent <agent_name> to directly start a conversation with a subagent`,cooldownSessions:15,async isRelevant(){return H().numStartups>5}},{id:`frontend-design-plugin`,content:async e=>`Working with HTML/CSS? Install the frontend-design plugin:\n${o(`suggestion`,e?.theme??`dark`)(`/plugin install frontend-design@${T}`)}`,cooldownSessions:3,isRelevant:async e=>$(`frontend-design`,e,{filePath:/\.(html|css|htm)$/i})},{id:`vercel-plugin`,content:async e=>`Working with Vercel? Install the vercel plugin:\n${o(`suggestion`,e?.theme??`dark`)(`/plugin install vercel@${T}`)}`,cooldownSessions:3,isRelevant:async e=>$(`vercel`,e,{filePath:/(?:^|[/\\])vercel\.json$/i,cli:[`vercel`]})},{id:`subagent-fanout-nudge`,content:async e=>`Say ${o(`suggestion`,e?.theme??`dark`)(`"fan out subagents"`)} and Work Mate sends a team. Each one digs deep so nothing gets missed.`,cooldownSessions:3,isRelevant:async()=>!1}],Se=[];function Ce(){let e=_().spinnerTipsOverride;return e?.tips?.length?e.tips.map((e,t)=>({id:`custom-tip-${t}`,content:async()=>e,cooldownSessions:0,isRelevant:async()=>!0})):[]}async function we(e){let t=_().spinnerTipsOverride,n=Ce();if(t?.excludeDefault&&n.length>0)return n;let r=[...xe,...Se],i=await Promise.all(r.map(t=>t.isRelevant?.(e)??Promise.resolve(!0)));return[...r.filter((e,t)=>i[t]).filter(e=>Z(e.id)>=e.cooldownSessions),...n]}export{me as a,ve as i,Z as n,he as o,ye as r,se as s,we as t};
@@ -1 +0,0 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{$d as t,dC as n,ef as r,fC as i}from"./loadAgentsDir-uuZYOgKn.js";import{n as a,t as o}from"./partition-djFY9gGI.js";function s(e,t,n){let[o,s]=a(i([...e,...t],`name`),r),c=(e,t)=>e.name.localeCompare(t.name);return[...s.sort(c),...o.sort(c)]}var c=e((()=>{o(),n(),t()}));export{s as n,c as t};
@@ -1 +0,0 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{Bh as t,zh as n}from"./loadAgentsDir-uuZYOgKn.js";import{f as r,i,v as a}from"./model-CcHyMyBv.js";function o(){let e=t(e=>e.mainLoopModel);return a(t(e=>e.mainLoopModelForSession)??e??i())}var s=e((()=>{n(),r()}));export{o as n,s as t};
@@ -1 +0,0 @@
1
- import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{ai as n}from"./src-BX54x08P.js";import{Cc as r,Dc as i}from"./loadAgentsDir-uuZYOgKn.js";import{n as a,t as o}from"./toolPool-DSTbgGmX.js";function s(e,t,n){return(0,c.useMemo)(()=>a(e,r(n,t),n.mode),[e,t,n,!1,!1])}var c,l=e((()=>{c=t(n(),1),i(),o()}));export{s as n,l as t};
@@ -1 +0,0 @@
1
- import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{ai as n}from"./src-BX54x08P.js";import{Gh as r,Kh as i}from"./loadAgentsDir-uuZYOgKn.js";import{n as a,t as o}from"./notifications-GLnjirCl.js";import{n as s,t as c}from"./allErrors-DvcU0w0F.js";function l(){let{addNotification:e,removeNotification:t}=a(),[n,r]=(0,u.useState)(()=>{let{errors:e}=c();return e});return i((0,u.useCallback)(()=>{let{errors:e}=c();r(e)},[])),(0,u.useEffect)(()=>{if(n.length>0){let t=`Found ${n.length} settings ${n.length===1?`issue`:`issues`} · /doctor for details`;e({key:d,text:t,color:`warning`,priority:`high`,timeoutMs:6e4})}else t(d)},[n,e,t]),n}var u,d,f=e((()=>{u=t(n(),1),o(),s(),r(),d=`settings-errors`}));export{l as n,f as t};