( host: SlashCommandHost, id: string, enabled: boolean, showStatus = true, )
| 334 | } |
| 335 | |
| 336 | async function applyPluginEnabled( |
| 337 | host: SlashCommandHost, |
| 338 | id: string, |
| 339 | enabled: boolean, |
| 340 | showStatus = true, |
| 341 | ): Promise<string> { |
| 342 | const session = host.requireSession(); |
| 343 | await session.setPluginEnabled(id, enabled); |
| 344 | let info: PluginInfo | undefined; |
| 345 | try { |
| 346 | info = await session.getPluginInfo(id); |
| 347 | } catch { |
| 348 | info = undefined; |
| 349 | } |
| 350 | const mcpHint = |
| 351 | enabled && info !== undefined && info.mcpServerCount > info.enabledMcpServerCount |
| 352 | ? ` Some MCP servers are disabled; re-enable with /plugins mcp enable ${id} <server>.` |
| 353 | : ''; |
| 354 | if (showStatus) { |
| 355 | host.showStatus(`${enabled ? 'Enabled' : 'Disabled'} ${id}. Run /reload or /new to apply.${mcpHint}`); |
| 356 | } |
| 357 | const inlineMcpHint = mcpHint.length > 0 ? ' · MCP servers disabled' : ''; |
| 358 | return `${pluginInlineChangeHint()}${inlineMcpHint}`; |
| 359 | } |
| 360 | |
| 361 | async function handlePluginsPanelSelection( |
| 362 | host: SlashCommandHost, |
no test coverage detected