( host: SlashCommandHost, panel: PluginsPanelComponent, source: string, label: string, official: boolean, )
| 294 | } |
| 295 | |
| 296 | async function installFromPanel( |
| 297 | host: SlashCommandHost, |
| 298 | panel: PluginsPanelComponent, |
| 299 | source: string, |
| 300 | label: string, |
| 301 | official: boolean, |
| 302 | ): Promise<void> { |
| 303 | if (!(await confirmInstallTrust(host, label, official))) { |
| 304 | host.showStatus(`Install cancelled: ${label}.`); |
| 305 | host.restoreEditor(); |
| 306 | return; |
| 307 | } |
| 308 | // Official installs keep the panel mounted and show the inline installing |
| 309 | // state; third-party installs pass through a trust prompt that replaces the |
| 310 | // panel, so fall back to a transcript status for those. |
| 311 | if (official) { |
| 312 | panel.setInstalling(truncateForStatus(label)); |
| 313 | } else { |
| 314 | host.showStatus(`Installing or updating ${label} from marketplace...`); |
| 315 | } |
| 316 | host.state.ui.requestRender(); |
| 317 | try { |
| 318 | await installPluginFromSource(host, source); |
| 319 | } catch (error) { |
| 320 | if (official) { |
| 321 | panel.clearInstalling(); |
| 322 | host.state.ui.requestRender(); |
| 323 | } else { |
| 324 | // The trust prompt replaced the panel; re-mount it so the user can retry |
| 325 | // instead of being dropped back at the editor. |
| 326 | host.mountEditorReplacement(panel); |
| 327 | } |
| 328 | host.showError(`Failed to install ${label}: ${formatErrorMessage(error)}`); |
| 329 | return; |
| 330 | } |
| 331 | // Close the panel after installing so the result status and the |
| 332 | // "/reload or /new" tip are visible in the transcript. |
| 333 | host.restoreEditor(); |
| 334 | } |
| 335 | |
| 336 | async function applyPluginEnabled( |
| 337 | host: SlashCommandHost, |
no test coverage detected