The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
feat(desktop): Uninstall action with confirm on Plugins hub rows
teknium1dd482928ee61
diff --git a/apps/desktop/src/app/capabilities/plugins/plugins-tab.test.tsx b/apps/desktop/src/app/capabilities/plugins/plugins-tab.test.tsxindex 219ea3686af..faa47cd5387 100644--- a/apps/desktop/src/app/capabilities/plugins/plugins-tab.test.tsx+++ b/apps/desktop/src/app/capabilities/plugins/plugins-tab.test.tsx@@ -3,6 +3,7 @@ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'import { $pluginRecords } from '@/contrib/plugins-store'import { $agentPlugins, $agentPluginsStatus } from '@/store/agent-plugins'+import { $confirmRequest, settleConfirm } from '@/store/confirm'import { $paneHeightOverride, setPaneHeightOverride } from '@/store/panes'import { $pluginInstallRequest, closePluginInstallRequest } from '@/store/plugin-install-request'import { $connection } from '@/store/session'@@ -390,6 +391,49 @@ describe('PluginsTab catalog UX', () => {)})+ it('uninstalls through plugins.manage remove only after the confirm dialog is accepted', async () => {+ $agentPlugins.set([+ {+ description: '',+ key: 'demo-weather',+ name: 'demo-weather',+ source: 'git',+ status: 'enabled',+ version: '1.0.0'+ }+ ])+ requestGateway.mockResolvedValue({ ok: true, name: 'demo-weather', plugins: [] } as never)++ render(<PluginsTab profile="workbot" />)++ screen.getByRole('button', { name: 'Uninstall: demo-weather' }).click()++ // The click only asks; nothing is deleted until the destructive confirm is answered.+ await waitFor(() => expect($confirmRequest.get()?.title).toBe('Uninstall demo-weather?'))+ expect(requestGateway).not.toHaveBeenCalledWith('plugins.manage', expect.objectContaining({ action: 'remove' }))++ settleConfirm(true)++ await waitFor(() =>+ expect(requestGateway).toHaveBeenCalledWith(+ 'plugins.manage',+ expect.objectContaining({ action: 'remove', name: 'demo-weather', profile: 'workbot' })+ )+ )+ await waitFor(() => expect(screen.queryByText('demo-weather')).toBeNull())+ })++ it('offers no Uninstall for a pip-installed (entrypoint) agent plugin', () => {+ $agentPlugins.set([+ { description: '', key: 'demo-tool', name: 'demo-tool', source: 'entrypoint', status: 'enabled', version: '' }+ ])++ render(<PluginsTab profile={null} />)++ expect(screen.getByText('demo-tool')).toBeTruthy()+ expect(screen.queryByRole('button', { name: 'Uninstall: demo-tool' })).toBeNull()+ })+it('refuses a catalog pick that is already installed and current', async () => {$agentPlugins.set([{diff --git a/apps/desktop/src/app/capabilities/plugins/plugins-tab.tsx b/apps/desktop/src/app/capabilities/plugins/plugins-tab.tsxindex aeca3e7fae6..63293908a51 100644--- a/apps/desktop/src/app/capabilities/plugins/plugins-tab.tsx+++ b/apps/desktop/src/app/capabilities/plugins/plugins-tab.tsx@@ -19,7 +19,7 @@ import { discoverRuntimePlugins } from '@/contrib/runtime-loader'import type { ProfileScope } from '@/hermes'import { useI18n } from '@/i18n'import { triggerHaptic } from '@/lib/haptics'-import { FolderOpen, Loader2, Monitor, Package, RefreshCw } from '@/lib/icons'+import { FolderOpen, Loader2, Monitor, Package, RefreshCw, Trash2 } from '@/lib/icons'import { CATALOG_ORIGIN, CATALOG_PICKER_URL } from '@/lib/plugin-catalog'import { cn } from '@/lib/utils'import {@@ -31,9 +31,11 @@ import {type GatewayRequest,isDesktopRelevantPlugin,loadAgentPlugins,+ removeAgentPlugin,toggleAgentPlugin,updateAgentPlugin} from '@/store/agent-plugins'+import { confirm } from '@/store/confirm'import { notify, notifyError } from '@/store/notifications'import { $paneHeightOverride, setPaneHeightOverride } from '@/store/panes'import { openCatalogPluginInstall } from '@/store/plugin-catalog-install'@@ -222,7 +224,8 @@ function PackageRow({scopeLabel,busy,onAgentToggle,- onAgentUpdate+ onAgentUpdate,+ onAgentRemove}: {pkg: PluginPackagescope: null | string@@ -230,6 +233,7 @@ function PackageRow({busy: booleanonAgentToggle: (row: AgentPluginRow, enable: boolean) => voidonAgentUpdate: (row: AgentPluginRow) => void+ onAgentRemove: (row: AgentPluginRow) => void}) {const { t } = useI18n()const p = t.skills.plugins@@ -239,6 +243,10 @@ function PackageRow({const desktopOn = desktop ? desktop.status !== 'disabled' : falseconst agentOn = agent?.status === 'enabled'const agentToggleable = Boolean(agent?.key)+ // Only what lives under the profile's plugins dir ("user", or "git" when it+ // was cloned there) can be uninstalled here: bundled plugins are refused by+ // the backend and entrypoint (pip-installed) ones go with their package.+ const agentRemovable = agent?.source === 'user' || agent?.source === 'git'// Electron's desktop-half reconcile only walks THIS machine's homes, so a// package installed on a remote backend can never materialize here (#114079).const remoteBackend = useStore($connection)?.mode === 'remote'@@ -282,6 +290,24 @@ function PackageRow({</Tip>)}</span>+ {/* Same fixed-slot treatment for Uninstall: present on every row so the+ halves line up, populated only when the agent half is a user install. */}+ <span className="flex size-7 shrink-0 items-center justify-center">+ {agent && agentRemovable && (+ <Tip label={p.uninstallTip(pkg.name, scopeLabel)}>+ <Button+ aria-label={`${p.uninstall}: ${pkg.name}`}+ className="text-(--ui-text-tertiary) hover:text-(--ui-danger,#f87171)"+ disabled={busy}+ onClick={() => onAgentRemove(agent)}+ size="icon"+ variant="ghost"+ >+ <Trash2 className="size-3.5" />+ </Button>+ </Tip>+ )}+ </span></div>{/* The two halves. Desktop is app-level and reads the same whichever@@ -565,6 +591,24 @@ export const PluginsTab = memo(function PluginsTab({<PackageRowbusy={pkg.agent ? agentBusy(pkg.agent) : false}key={pkg.key}+ onAgentRemove={row => {+ void confirm({+ confirmLabel: p.uninstall,+ description: p.uninstallConfirmBody(row.name, label),+ destructive: true,+ title: p.uninstallConfirmTitle(row.name)+ }).then(async ok => {+ if (!ok) {+ return+ }++ if (await removeAgentPlugin(requestGateway, row.name, p.uninstallFailed(row.name), scope)) {+ notify({ kind: 'success', message: p.uninstalled(row.name) })+ // Prunes the app-level desktop half whose source package just went away.+ void rescanAll(requestGateway, scope)+ }+ })+ }}onAgentToggle={(row, enable) => {if (!row.key) {returndiff --git a/apps/desktop/src/i18n/en.ts b/apps/desktop/src/i18n/en.tsindex 63ce4d26936..7a01fabe3f8 100644--- a/apps/desktop/src/i18n/en.ts+++ b/apps/desktop/src/i18n/en.ts@@ -1849,6 +1849,13 @@ export const en: Translations = {updateToPin: (sha: string) => `Update to ${sha}`,updateFailed: (name: string) => `Could not update ${name}`,updated: (name: string) => `${name} updated to the current catalog pin. Restart the gateway to apply.`,+ uninstall: 'Uninstall',+ uninstallTip: (name: string, profile: string) => `Uninstall ${name} from ${profile}`,+ uninstallConfirmTitle: (name: string) => `Uninstall ${name}?`,+ uninstallConfirmBody: (name: string, profile: string) =>+ `This deletes the plugin's files from the ${profile} profile. Any desktop half it shipped is removed with it. Reinstall it from the catalog or from Git at any time.`,+ uninstallFailed: (name: string) => `Could not uninstall ${name}`,+ uninstalled: (name: string) => `${name} uninstalled. Restart the gateway to unload it.`,deepLinkErrorTitle: 'Plugin install link rejected',deepLinkCatalogInvalidName: 'The link\u2019s catalog name is missing or invalid.',deepLinkCatalogUnknown: (name: string) =>diff --git a/apps/desktop/src/i18n/types.ts b/apps/desktop/src/i18n/types.tsindex 164167a0411..33b25bda1fb 100644--- a/apps/desktop/src/i18n/types.ts+++ b/apps/desktop/src/i18n/types.ts@@ -1590,6 +1590,12 @@ export interface Translations {updateToPin: (sha: string) => stringupdateFailed: (name: string) => stringupdated: (name: string) => string+ uninstall: string+ uninstallTip: (name: string, profile: string) => string+ uninstallConfirmTitle: (name: string) => string+ uninstallConfirmBody: (name: string, profile: string) => string+ uninstallFailed: (name: string) => string+ uninstalled: (name: string) => stringdeepLinkErrorTitle: stringdeepLinkCatalogInvalidName: stringdeepLinkCatalogUnknown: (name: string) => stringdiff --git a/apps/desktop/src/i18n/zh.ts b/apps/desktop/src/i18n/zh.tsindex 568e397e9f7..57115aa2402 100644--- a/apps/desktop/src/i18n/zh.ts+++ b/apps/desktop/src/i18n/zh.ts@@ -2022,6 +2022,13 @@ export const zh = defineLocale({updateToPin: (sha: string) => `更新到 ${sha}`,updateFailed: (name: string) => `无法更新 ${name}`,updated: (name: string) => `${name} 已更新到当前目录固定提交。重启网关后生效。`,+ uninstall: '卸载',+ uninstallTip: (name: string, profile: string) => `从 ${profile} 卸载 ${name}`,+ uninstallConfirmTitle: (name: string) => `卸载 ${name}?`,+ uninstallConfirmBody: (name: string, profile: string) =>+ `这将从 ${profile} 配置中删除该插件的文件。它附带的桌面部分也会一并移除。之后可随时从目录或 Git 重新安装。`,+ uninstallFailed: (name: string) => `无法卸载 ${name}`,+ uninstalled: (name: string) => `${name} 已卸载。重启网关后完全卸载。`,deepLinkErrorTitle: '插件安装链接已拒绝',deepLinkCatalogInvalidName: '链接中的目录名称缺失或无效。',deepLinkCatalogUnknown: (name: string) => `“${name}”不在 Hermes 插件目录中。未安装任何内容。`,diff --git a/apps/desktop/src/store/agent-plugins.ts b/apps/desktop/src/store/agent-plugins.tsindex 60e73de860c..4f474b7b61b 100644--- a/apps/desktop/src/store/agent-plugins.ts+++ b/apps/desktop/src/store/agent-plugins.ts@@ -280,3 +280,34 @@ export async function updateAgentPlugin($agentPluginBusy.set(null)}}++/** Uninstall a user-installed agent plugin (backend `plugins.manage remove`;+ * deletes `<HERMES_HOME>/plugins/<name>` and its install metadata). Drops the+ * row locally on success — callers rescan so a unified package's desktop half+ * is pruned too. Returns whether the plugin was removed. */+export async function removeAgentPlugin(+ request: GatewayRequest,+ name: string,+ failMessage: string,+ profile?: string | null+): Promise<boolean> {+ $agentPluginBusy.set(name)++ try {+ const result = await request<{ ok?: boolean }>('plugins.manage', withProfile({ action: 'remove', name }, profile))++ if (!result?.ok) {+ throw new Error(failMessage)+ }++ $agentPlugins.set($agentPlugins.get().filter(row => row.name !== name))++ return true+ } catch (e) {+ notifyError(e, failMessage)++ return false+ } finally {+ $agentPluginBusy.set(null)+ }+}