The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
feat(desktop): git-installed plugins get an Update button and a security-scan override dialog
alt-glitch17aab768ece4
diff --git a/apps/desktop/src/app/capabilities/plugins/plugin-update.test.ts b/apps/desktop/src/app/capabilities/plugins/plugin-update.test.tsnew file mode 100644index 00000000000..43b967c210a--- /dev/null+++ b/apps/desktop/src/app/capabilities/plugins/plugin-update.test.ts@@ -0,0 +1,57 @@+import { afterEach, describe, expect, it, vi } from 'vitest'++import { en } from '@/i18n/en'+import { $confirmRequest, settleConfirm } from '@/store/confirm'++import { runPluginUpdate } from './plugin-update'++const p = en.skills.plugins+const tern = { catalog_name: undefined, name: 'hermes-tern' }++const caution = {+ ok: false,+ scan_blocked: true,+ scan_verdict: 'caution',+ scan_findings: [{ category: 'execution', description: 'eval', file: 'helper.py', line: 1, severity: 'high' }]+}++afterEach(() => settleConfirm(false))++describe('runPluginUpdate scan override', () => {+ it('shows a caution finding, and only "Update anyway" retries the update with force', async () => {+ const request = vi.fn().mockResolvedValueOnce(caution).mockResolvedValueOnce({ ok: true, unchanged: false })++ const done = runPluginUpdate(request, tern, null, p)++ await vi.waitFor(() => expect($confirmRequest.get()?.title).toBe(p.updateScanTitle('hermes-tern')))+ expect($confirmRequest.get()?.description).toContain('HIGH execution helper.py:1')+ expect($confirmRequest.get()?.destructive).toBe(true)+ expect(request).toHaveBeenCalledTimes(1)++ settleConfirm(true)++ expect(await done).toEqual({ kind: 'applied' })+ expect(request).toHaveBeenNthCalledWith(+ 2,+ 'plugins.manage',+ expect.objectContaining({ action: 'update', force: true, name: 'hermes-tern' }),+ expect.any(Number)+ )+ })++ it('cancel leaves the plugin alone, and a dangerous verdict never offers the override', async () => {+ const cancelled = vi.fn().mockResolvedValue(caution)+ const done = runPluginUpdate(cancelled, tern, null, p)++ await vi.waitFor(() => expect($confirmRequest.get()).not.toBeNull())+ settleConfirm(false)+ expect((await done).kind).toBe('scan')+ expect(cancelled).toHaveBeenCalledTimes(1)++ const dangerous = vi.fn().mockResolvedValue({ ...caution, scan_verdict: 'dangerous' })++ expect((await runPluginUpdate(dangerous, tern, null, p)).kind).toBe('scan')+ expect($confirmRequest.get()).toBeNull()+ expect(dangerous).toHaveBeenCalledTimes(1)+ })+})diff --git a/apps/desktop/src/app/capabilities/plugins/plugin-update.ts b/apps/desktop/src/app/capabilities/plugins/plugin-update.tsnew file mode 100644index 00000000000..8fc2709b544--- /dev/null+++ b/apps/desktop/src/app/capabilities/plugins/plugin-update.ts@@ -0,0 +1,95 @@+import type { Translations } from '@/i18n/types'+import {+ type AgentPluginRow,+ type AgentPluginScanFinding,+ type AgentPluginUpdateOptions,+ type AgentPluginUpdateOutcome,+ type GatewayRequest,+ updateAgentPlugin+} from '@/store/agent-plugins'+import { confirm } from '@/store/confirm'+import { notify, notifyError } from '@/store/notifications'++type PluginsCopy = Translations['skills']['plugins']++const SEVERITY_ORDER = ['critical', 'high', 'medium', 'low']++const severityRank = (severity: string) => {+ const rank = SEVERITY_ORDER.indexOf(severity)++ return rank === -1 ? SEVERITY_ORDER.length : rank+}++/** The findings a caution scan blocked an update on, one line each, worst first; capped so the dialog stays readable. */+export function scanFindingLines(findings: AgentPluginScanFinding[], more: (n: number) => string, cap = 8): string[] {+ const sorted = [...findings].sort((a, b) => severityRank(a.severity) - severityRank(b.severity))++ const lines = sorted+ .slice(0, cap)+ .map(f => `${f.severity.toUpperCase()} ${f.category} ${f.file}:${f.line}`)++ return sorted.length > cap ? [...lines, more(sorted.length - cap)] : lines+}++/** Update one plugin, asking the user before each override the backend asks for: a catalog pin that widens+ * the plugin, or new code the security scan flagged as caution. Each question is asked at most once; a+ * dangerous verdict is reported and never offered. Resolves with the final outcome. */+export async function runPluginUpdate(+ request: GatewayRequest,+ row: Pick<AgentPluginRow, 'catalog_name' | 'name'>,+ scope: null | string,+ p: PluginsCopy+): Promise<AgentPluginUpdateOutcome> {+ const { name } = row+ const gitInstall = !row.catalog_name+ const options: AgentPluginUpdateOptions = {}++ for (;;) {+ const outcome = await updateAgentPlugin(request, name, p.updateFailed(name), scope, options)++ if (outcome.kind === 'consent' && !options.acceptCapabilities) {+ // The new pin widens the plugin (tools, hooks, deps, capabilities, a Desktop half); the backend+ // changed nothing until the user confirms the delta.+ const ok = await confirm({+ confirmLabel: p.updateConsentConfirm,+ description: [p.updateConsentBody(name, outcome.sha), ...outcome.deltaLines].join('\n'),+ title: p.updateConsentTitle(name)+ })++ if (!ok) {+ return outcome+ }++ options.acceptCapabilities = true++ continue+ }++ if (outcome.kind === 'scan' && outcome.verdict === 'caution' && !options.force) {+ const ok = await confirm({+ confirmLabel: p.updateScanConfirm,+ description: [p.updateScanBody(name, outcome.findings.length), ...scanFindingLines(outcome.findings, p.updateScanMore)].join(+ '\n'+ ),+ destructive: true,+ title: p.updateScanTitle(name)+ })++ if (!ok) {+ return outcome+ }++ options.force = true++ continue+ }++ if (outcome.kind === 'scan') {+ notifyError(new Error(p.updateScanBlocked(name)), p.updateFailed(name))+ } else if (outcome.kind === 'applied') {+ notify({ kind: 'success', message: gitInstall ? p.updatedGit(name) : p.updated(name) })+ }++ return outcome+ }+}diff --git a/apps/desktop/src/app/capabilities/plugins/plugins-tab.test.tsx b/apps/desktop/src/app/capabilities/plugins/plugins-tab.test.tsxindex 11c0ddaaa34..5ec61e92657 100644--- a/apps/desktop/src/app/capabilities/plugins/plugins-tab.test.tsx+++ b/apps/desktop/src/app/capabilities/plugins/plugins-tab.test.tsx@@ -628,7 +628,8 @@ describe('PluginsTab catalog UX', () => {await waitFor(() =>expect(requestGateway).toHaveBeenCalledWith('plugins.manage',- expect.objectContaining({ action: 'update', name: 'demo-weather', profile: 'workbot' })+ expect.objectContaining({ action: 'update', name: 'demo-weather', profile: 'workbot' }),+ expect.any(Number)))})diff --git a/apps/desktop/src/app/capabilities/plugins/plugins-tab.tsx b/apps/desktop/src/app/capabilities/plugins/plugins-tab.tsxindex 2c582e7fee3..071799aa3bf 100644--- a/apps/desktop/src/app/capabilities/plugins/plugins-tab.tsx+++ b/apps/desktop/src/app/capabilities/plugins/plugins-tab.tsx@@ -34,13 +34,11 @@ import {$agentPluginsStatus,type AgentPluginRow,type AgentPluginServerState,- type AgentPluginUpdateOutcome,type GatewayRequest,isDesktopRelevantPlugin,loadAgentPlugins,removeAgentPlugin,- toggleAgentPlugin,- updateAgentPlugin+ toggleAgentPlugin} from '@/store/agent-plugins'import { confirm } from '@/store/confirm'import { notify, notifyError } from '@/store/notifications'@@ -55,6 +53,7 @@ import { useDeepLinkHighlight } from '../../settings/use-deep-link-highlight'import { TOOLSETS_QUERY_KEY } from '../toolsets/toolsets-data'import { mergePluginPackages, type PackageKind, type PluginPackage } from './plugin-packages'+import { runPluginUpdate } from './plugin-update'// The REAL Plugin Catalog page (docs site) embedded as a one-click picker —// the same pattern as the Skills tab's EmbeddedHubPicker. `?embed=picker`@@ -165,6 +164,10 @@ const SERVER_TONE = {unsupported_gpu: 'destructive'} as const satisfies Record<AgentPluginServerState, 'destructive' | 'success' | 'warn'>+/** What the Update button moves to: the catalog's version label, else the short catalog pin or remote commit. */+const updateTargetLabel = (agent: AgentPluginRow) =>+ agent.catalog_version ?? (agent.catalog_sha ?? agent.latest_sha)?.slice(0, 8) ?? ''+function KindBadge({ kind }: { kind: PackageKind }) {const { t } = useI18n()const p = t.skills.plugins@@ -491,7 +494,7 @@ function PackageRow({size="xs"variant="outline">- {p.updateToPin(agent.catalog_version ?? agent.catalog_sha?.slice(0, 8) ?? '')}+ {p.updateToPin(updateTargetLabel(agent))}</Button>)}{busy && <Loader2 className="size-3.5 animate-spin text-(--ui-text-tertiary)" />}@@ -773,34 +776,11 @@ export const PluginsTab = memo(function PluginsTab({})}}onAgentUpdate={row => {- const finish = (outcome: AgentPluginUpdateOutcome) => {+ void runPluginUpdate(requestGateway, row, scope, p).then(outcome => {if (outcome.kind === 'applied') {- notify({ kind: 'success', message: p.updated(row.name) })void rescanAll(requestGateway, scope)}- }-- void updateAgentPlugin(requestGateway, row.name, p.updateFailed(row.name), scope).then(- async outcome => {- if (outcome.kind !== 'consent') {- finish(outcome)-- return- }-- // The new pin widens the plugin (tools, hooks, deps, capabilities, a Desktop- // half); the backend changed nothing until the user confirms the delta.- const ok = await confirm({- confirmLabel: p.updateConsentConfirm,- description: [p.updateConsentBody(row.name, outcome.sha), ...outcome.deltaLines].join('\n'),- title: p.updateConsentTitle(row.name)- })-- if (ok) {- finish(await updateAgentPlugin(requestGateway, row.name, p.updateFailed(row.name), scope, true))- }- }- )+ })}}onDesktopRemove={record => {void confirm({diff --git a/apps/desktop/src/i18n/de.ts b/apps/desktop/src/i18n/de.tsindex 9b2a7a43540..3a883e57c26 100644--- a/apps/desktop/src/i18n/de.ts+++ b/apps/desktop/src/i18n/de.ts@@ -10,6 +10,7 @@ import { deModelMenu } from './de_model_menu'import { deModelSettings } from './de_model_settings'import { deNotices } from './de_notices'import { deOnboarding } from './de_onboarding'+import { dePluginUpdate } from './de_plugin_update'import { deProjects } from './de_projects'import { deSharedMetrics } from './de_shared_metrics'import { deThemePicker } from './de_theme_picker'@@ -2523,14 +2524,7 @@ export const deOverrides = {pinnedProvenance: sha =>`An Commit ${sha} gepinnt. Updates werden abgelehnt, bis es mit einem neuen Pin neu installiert wird.`,pinnedBadge: sha => `gepinnt @ ${sha}`,- updateToPin: sha => `Auf ${sha} aktualisieren`,- updateFailed: name => `${name} konnte nicht aktualisiert werden`,- updated: name =>- `${name} wurde auf den aktuellen Katalog-Pin aktualisiert. Starten Sie das Gateway neu, damit es wirksam wird.`,- updateConsentTitle: (name: string) => `${name} fordert mehr an`,- updateConsentBody: (name: string, sha: string) =>- `Der neue Katalog-Pin von ${name} (${sha}) fügt Oberflächen hinzu, die die installierte Version nicht hat. Wenden Sie ihn nur an, wenn Sie ihnen vertrauen:`,- updateConsentConfirm: 'Update anwenden',+ ...dePluginUpdate,uninstall: 'Deinstallieren',uninstallTip: (name: string, profile: string) => `${name} aus ${profile} deinstallieren`,uninstallConfirmTitle: (name: string) => `${name} deinstallieren?`,diff --git a/apps/desktop/src/i18n/de_plugin_update.ts b/apps/desktop/src/i18n/de_plugin_update.tsnew file mode 100644index 00000000000..29da9034b3f--- /dev/null+++ b/apps/desktop/src/i18n/de_plugin_update.ts@@ -0,0 +1,21 @@+import type { PluginUpdateTranslations } from './types_plugin_update'++/** Copy for updating an installed plugin (Plugins tab): catalog re-pin consent and the security-scan override. */+export const dePluginUpdate: PluginUpdateTranslations = {+ updateToPin: sha => `Auf ${sha} aktualisieren`,+ updateFailed: name => `${name} konnte nicht aktualisiert werden`,+ updated: name =>+ `${name} wurde auf den aktuellen Katalog-Pin aktualisiert. Starten Sie das Gateway neu, damit es wirksam wird.`,+ updateConsentTitle: (name: string) => `${name} fordert mehr an`,+ updateConsentBody: (name: string, sha: string) =>+ `Der neue Katalog-Pin von ${name} (${sha}) fügt Oberflächen hinzu, die die installierte Version nicht hat. Wenden Sie ihn nur an, wenn Sie ihnen vertrauen:`,+ updateConsentConfirm: 'Update anwenden',+ updateScanTitle: name => `Sicherheitsprüfung hat ${name} markiert`,+ updateScanBody: (name, count) =>+ `Das Update von ${name} erhielt das Urteil „Vorsicht“ (${count} ${count === 1 ? 'Fund' : 'Funde'}). Jedes Update wird geprüft. Wenden Sie es nur an, wenn Sie der Quelle vertrauen:`,+ updateScanMore: count => `+ ${count} weitere`,+ updateScanConfirm: 'Trotzdem aktualisieren',+ updateScanBlocked: name =>+ `Die Sicherheitsprüfung hat das Update von ${name} blockiert (Urteil „gefährlich“). Das lässt sich nicht übergehen.`,+ updatedGit: name => `${name} wurde auf den neuesten Commit aktualisiert.`,+}diff --git a/apps/desktop/src/i18n/en.ts b/apps/desktop/src/i18n/en.tsindex 964947b17e6..b6834749ee5 100644--- a/apps/desktop/src/i18n/en.ts+++ b/apps/desktop/src/i18n/en.ts@@ -14,6 +14,7 @@ import { enModelMenu } from './en_model_menu'import { enModelSettings } from './en_model_settings'import { enNotices } from './en_notices'import { enOnboarding } from './en_onboarding'+import { enPluginUpdate } from './en_plugin_update'import { enProjects } from './en_projects'import { enSharedMetrics } from './en_shared_metrics'import { enThemePicker } from './en_theme_picker'@@ -2158,13 +2159,7 @@ export const en: Translations = {pinnedProvenance: (sha: string) =>`Pinned to commit ${sha}. Updates are refused until it is reinstalled with a new pin.`,pinnedBadge: (sha: string) => `pinned @ ${sha}`,- 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.`,- updateConsentTitle: (name: string) => `${name} asks for more`,- updateConsentBody: (name: string, sha: string) =>- `The new catalog pin of ${name} (${sha}) adds surfaces the installed version does not have. Apply it only if you trust them:`,- updateConsentConfirm: 'Apply update',+ ...enPluginUpdate,uninstall: 'Uninstall',uninstallTip: (name: string, profile: string) => `Uninstall ${name} from ${profile}`,uninstallConfirmTitle: (name: string) => `Uninstall ${name}?`,diff --git a/apps/desktop/src/i18n/en_plugin_update.ts b/apps/desktop/src/i18n/en_plugin_update.tsnew file mode 100644index 00000000000..c8e964f5ec4--- /dev/null+++ b/apps/desktop/src/i18n/en_plugin_update.ts@@ -0,0 +1,20 @@+import type { PluginUpdateTranslations } from './types_plugin_update'++/** Copy for updating an installed plugin (Plugins tab): catalog re-pin consent and the security-scan override. */+export const enPluginUpdate: PluginUpdateTranslations = {+ 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.`,+ updateConsentTitle: (name: string) => `${name} asks for more`,+ updateConsentBody: (name: string, sha: string) =>+ `The new catalog pin of ${name} (${sha}) adds surfaces the installed version does not have. Apply it only if you trust them:`,+ updateConsentConfirm: 'Apply update',+ updateScanTitle: (name: string) => `Security scan flagged ${name}`,+ updateScanBody: (name: string, count: number) =>+ `The update to ${name} got a caution verdict (${count} ${count === 1 ? 'finding' : 'findings'}). Every update is scanned. Apply it only if you trust the source:`,+ updateScanMore: (count: number) => `+ ${count} more`,+ updateScanConfirm: 'Update anyway',+ updateScanBlocked: (name: string) =>+ `The security scan blocked the update to ${name} (dangerous verdict). It cannot be overridden.`,+ updatedGit: (name: string) => `${name} updated to the latest commit.`,+}diff --git a/apps/desktop/src/i18n/es.ts b/apps/desktop/src/i18n/es.tsindex ee9e8b61d5e..2708dfef2a5 100644--- a/apps/desktop/src/i18n/es.ts+++ b/apps/desktop/src/i18n/es.ts@@ -11,6 +11,7 @@ import { esModelMenu } from './es_model_menu'import { esModelSettings } from './es_model_settings'import { esNotices } from './es_notices'import { esOnboarding } from './es_onboarding'+import { esPluginUpdate } from './es_plugin_update'import { esProjects } from './es_projects'import { esSharedMetrics } from './es_shared_metrics'import { esThemePicker } from './es_theme_picker'@@ -2518,14 +2519,7 @@ export const esOverrides = {pinnedProvenance: (sha: string) =>`Fijado al commit ${sha}. Las actualizaciones se rechazan hasta que se reinstale con un nuevo commit fijado.`,pinnedBadge: (sha: string) => `fijado @ ${sha}`,- updateToPin: (sha: string) => `Actualizar a ${sha}`,- updateFailed: (name: string) => `No se pudo actualizar ${name}`,- updated: (name: string) =>- `${name} se actualizó al commit fijado actual del catálogo. Reinicia el gateway para aplicarlo.`,- updateConsentTitle: (name: string) => `${name} pide más`,- updateConsentBody: (name: string, sha: string) =>- `El nuevo commit fijado de ${name} en el catálogo (${sha}) añade superficies que la versión instalada no tiene. Aplícalo solo si confías en ellas:`,- updateConsentConfirm: 'Aplicar actualización',+ ...esPluginUpdate,uninstall: 'Desinstalar',uninstallTip: (name: string, profile: string) => `Desinstalar ${name} de ${profile}`,uninstallConfirmTitle: (name: string) => `¿Desinstalar ${name}?`,diff --git a/apps/desktop/src/i18n/es_plugin_update.ts b/apps/desktop/src/i18n/es_plugin_update.tsnew file mode 100644index 00000000000..0f529b0b0b1--- /dev/null+++ b/apps/desktop/src/i18n/es_plugin_update.ts@@ -0,0 +1,21 @@+import type { PluginUpdateTranslations } from './types_plugin_update'++/** Copy for updating an installed plugin (Plugins tab): catalog re-pin consent and the security-scan override. */+export const esPluginUpdate: PluginUpdateTranslations = {+ updateToPin: (sha: string) => `Actualizar a ${sha}`,+ updateFailed: (name: string) => `No se pudo actualizar ${name}`,+ updated: (name: string) =>+ `${name} se actualizó al commit fijado actual del catálogo. Reinicia el gateway para aplicarlo.`,+ updateConsentTitle: (name: string) => `${name} pide más`,+ updateConsentBody: (name: string, sha: string) =>+ `El nuevo commit fijado de ${name} en el catálogo (${sha}) añade superficies que la versión instalada no tiene. Aplícalo solo si confías en ellas:`,+ updateConsentConfirm: 'Aplicar actualización',+ updateScanTitle: (name: string) => `El análisis de seguridad marcó ${name}`,+ updateScanBody: (name: string, count: number) =>+ `La actualización de ${name} recibió el veredicto «precaución» (${count} ${count === 1 ? 'hallazgo' : 'hallazgos'}). Se analiza cada actualización. Aplícala solo si confías en la fuente:`,+ updateScanMore: (count: number) => `+ ${count} más`,+ updateScanConfirm: 'Actualizar de todos modos',+ updateScanBlocked: (name: string) =>+ `El análisis de seguridad bloqueó la actualización de ${name} (veredicto «peligroso»). No se puede omitir.`,+ updatedGit: (name: string) => `${name} se actualizó al último commit.`,+}diff --git a/apps/desktop/src/i18n/fr.ts b/apps/desktop/src/i18n/fr.tsindex 2dbd8993ce9..3c67a4b4342 100644--- a/apps/desktop/src/i18n/fr.ts+++ b/apps/desktop/src/i18n/fr.ts@@ -11,6 +11,7 @@ import { frModelMenu } from './fr_model_menu'import { frModelSettings } from './fr_model_settings'import { frNotices } from './fr_notices'import { frOnboarding } from './fr_onboarding'+import { frPluginUpdate } from './fr_plugin_update'import { frProjects } from './fr_projects'import { frSharedMetrics } from './fr_shared_metrics'import { frThemePicker } from './fr_theme_picker'@@ -2530,14 +2531,7 @@ export const frOverrides = {pinnedProvenance: (sha: string) =>`Épinglé au commit ${sha}. Les mises à jour sont refusées tant qu’il n’est pas réinstallé avec un nouvel épinglage.`,pinnedBadge: (sha: string) => `épinglé @ ${sha}`,- updateToPin: (sha: string) => `Mettre à jour vers ${sha}`,- updateFailed: (name: string) => `Impossible de mettre à jour ${name}`,- updated: (name: string) =>- `${name} mis à jour vers l’épinglage actuel du catalogue. Redémarrez le gateway pour l’appliquer.`,- updateConsentTitle: (name: string) => `${name} demande davantage`,- updateConsentBody: (name: string, sha: string) =>- `Le nouvel épinglage de ${name} dans le catalogue (${sha}) ajoute des surfaces que la version installée n’a pas. Appliquez-le uniquement si vous leur faites confiance :`,- updateConsentConfirm: 'Appliquer la mise à jour',+ ...frPluginUpdate,uninstall: 'Désinstaller',uninstallTip: (name: string, profile: string) => `Désinstaller ${name} de ${profile}`,uninstallConfirmTitle: (name: string) => `Désinstaller ${name} ?`,diff --git a/apps/desktop/src/i18n/fr_plugin_update.ts b/apps/desktop/src/i18n/fr_plugin_update.tsnew file mode 100644index 00000000000..d460a500ed8--- /dev/null+++ b/apps/desktop/src/i18n/fr_plugin_update.ts@@ -0,0 +1,21 @@+import type { PluginUpdateTranslations } from './types_plugin_update'++/** Copy for updating an installed plugin (Plugins tab): catalog re-pin consent and the security-scan override. */+export const frPluginUpdate: PluginUpdateTranslations = {+ updateToPin: (sha: string) => `Mettre à jour vers ${sha}`,+ updateFailed: (name: string) => `Impossible de mettre à jour ${name}`,+ updated: (name: string) =>+ `${name} mis à jour vers l’épinglage actuel du catalogue. Redémarrez le gateway pour l’appliquer.`,+ updateConsentTitle: (name: string) => `${name} demande davantage`,+ updateConsentBody: (name: string, sha: string) =>+ `Le nouvel épinglage de ${name} dans le catalogue (${sha}) ajoute des surfaces que la version installée n’a pas. Appliquez-le uniquement si vous leur faites confiance :`,+ updateConsentConfirm: 'Appliquer la mise à jour',+ updateScanTitle: (name: string) => `L’analyse de sécurité a signalé ${name}`,+ updateScanBody: (name: string, count: number) =>+ `La mise à jour de ${name} a reçu le verdict « prudence » (${count} ${count === 1 ? 'constat' : 'constats'}). Chaque mise à jour est analysée. Ne l’appliquez que si vous faites confiance à la source :`,+ updateScanMore: (count: number) => `+ ${count} de plus`,+ updateScanConfirm: 'Mettre à jour quand même',+ updateScanBlocked: (name: string) =>+ `L’analyse de sécurité a bloqué la mise à jour de ${name} (verdict « dangereux »). Impossible de passer outre.`,+ updatedGit: (name: string) => `${name} a été mis à jour vers le dernier commit.`,+}diff --git a/apps/desktop/src/i18n/overlay-gaps.json b/apps/desktop/src/i18n/overlay-gaps.jsonindex e4ca7785d0e..8b0c8ee7d7b 100644--- a/apps/desktop/src/i18n/overlay-gaps.json+++ b/apps/desktop/src/i18n/overlay-gaps.json@@ -2087,8 +2087,14 @@"skills.plugins.updateConsentConfirm": ["ar","ja","ru","zh","zh-hant"],"skills.plugins.updateConsentTitle": ["ar","ja","ru","zh","zh-hant"],"skills.plugins.updateFailed": ["ar","ja","ru","zh-hant"],+ "skills.plugins.updateScanBlocked": ["ar","ja","ru","zh","zh-hant"],+ "skills.plugins.updateScanBody": ["ar","ja","ru","zh","zh-hant"],+ "skills.plugins.updateScanConfirm": ["ar","ja","ru","zh","zh-hant"],+ "skills.plugins.updateScanMore": ["ar","ja","ru","zh","zh-hant"],+ "skills.plugins.updateScanTitle": ["ar","ja","ru","zh","zh-hant"],"skills.plugins.updateToPin": ["ar","ja","ru","zh-hant"],"skills.plugins.updated": ["ar","ja","ru","zh-hant"],+ "skills.plugins.updatedGit": ["ar","ja","ru","zh","zh-hant"],"skills.provenance.agent": ["ar"],"skills.provenance.bundled": ["ar"],"skills.provenance.hub": ["ar"],diff --git a/apps/desktop/src/i18n/types.ts b/apps/desktop/src/i18n/types.tsindex 32591c7c8d1..bee21d90ddc 100644--- a/apps/desktop/src/i18n/types.ts+++ b/apps/desktop/src/i18n/types.ts@@ -20,6 +20,7 @@ import type { ModelMenuTranslations } from './types_model_menu'import type { ModelSettingsTranslations } from './types_model_settings'import type { NoticeTranslations } from './types_notices'import type { OnboardingTranslations } from './types_onboarding'+import type { PluginUpdateTranslations } from './types_plugin_update'import type { SidebarProjectsTranslations } from './types_projects'import type { SharedMetricsTranslations } from './types_shared_metrics'import type { ThemePickerCopy } from './types_theme_picker'@@ -1882,7 +1883,7 @@ export interface Translations extends NoticeTranslations {skillArchivedTitle: stringskillArchivedMessage: stringtabPlugins: string- plugins: {+ plugins: PluginUpdateTranslations & {agentTitle: stringagentBlurb: stringpageBlurb: string@@ -1930,12 +1931,6 @@ export interface Translations extends NoticeTranslations {catalogProvenance: (sha: string) => stringpinnedProvenance: (sha: string) => stringpinnedBadge: (sha: string) => string- updateToPin: (sha: string) => string- updateFailed: (name: string) => string- updated: (name: string) => string- updateConsentTitle: (name: string) => string- updateConsentBody: (name: string, sha: string) => string- updateConsentConfirm: stringuninstall: stringuninstallTip: (name: string, profile: string) => stringuninstallConfirmTitle: (name: string) => stringdiff --git a/apps/desktop/src/i18n/types_plugin_update.ts b/apps/desktop/src/i18n/types_plugin_update.tsnew file mode 100644index 00000000000..2e587b47212--- /dev/null+++ b/apps/desktop/src/i18n/types_plugin_update.ts@@ -0,0 +1,15 @@+/** Copy for updating an installed plugin (Plugins tab): catalog re-pin consent and the security-scan override. */+export interface PluginUpdateTranslations {+ updateToPin: (sha: string) => string+ updateFailed: (name: string) => string+ updated: (name: string) => string+ updateConsentTitle: (name: string) => string+ updateConsentBody: (name: string, sha: string) => string+ updateConsentConfirm: string+ updateScanTitle: (name: string) => string+ updateScanBody: (name: string, count: number) => string+ updateScanMore: (count: number) => string+ updateScanConfirm: string+ updateScanBlocked: (name: string) => string+ updatedGit: (name: string) => string+}diff --git a/apps/desktop/src/store/agent-plugins.ts b/apps/desktop/src/store/agent-plugins.tsindex 41a048a3bd5..d2636ec9902 100644--- a/apps/desktop/src/store/agent-plugins.ts+++ b/apps/desktop/src/store/agent-plugins.ts@@ -1,3 +1,4 @@+import type { PluginsManageParams } from '@hermes/shared'import { atom } from 'nanostores'import { notifyError } from '@/store/notifications'@@ -51,8 +52,11 @@ export interface AgentPluginRow {catalog_sha?: string/** Human label the catalog attaches to that pin ("1.4.0"); shown on the Update button when present. */catalog_version?: string | null- /** Installed SHA differs from the catalog pin — an update is available. */+ /** An update is available: the catalog pin moved past the installed SHA, or (git installs) the last+ * update check found a newer remote commit. */update_available?: boolean+ /** Git installs: the remote commit the last update check found. */+ latest_sha?: string/** Full commit SHA a `--ref` install is pinned to (custom sources; refuses `update`). */pinned_sha?: string/** The package folder also ships `desktop/plugin.js` (unified agent+desktop package). */@@ -361,26 +365,54 @@ export async function installAgentPlugin(}}-/** Outcome of `updateAgentPlugin`: `applied` when the re-pin landed, `unchanged`- * when already at pin, `consent` when the new pin widens the plugin — the- * backend changed nothing and waits for `acceptCapabilities`. */+/** One security-scan finding on an update the scan blocked. */+export interface AgentPluginScanFinding {+ severity: string+ category: string+ file: string+ line: number+ description: string+}++/** Outcome of `updateAgentPlugin`: `applied` when the update landed, `unchanged`+ * when already current, `consent` when a new catalog pin widens the plugin+ * (retry with `acceptCapabilities`), `scan` when the security scan blocked the+ * new code (a `caution` verdict can be retried with `force`). The backend+ * changed nothing for `consent` and `scan`. */export type AgentPluginUpdateOutcome =- { kind: 'applied' | 'unchanged' | 'failed' } | { kind: 'consent'; sha: string; deltaLines: string[] }+ | { kind: 'applied' | 'unchanged' | 'failed' }+ | { kind: 'consent'; sha: string; deltaLines: string[] }+ | { kind: 'scan'; verdict: string; findings: AgentPluginScanFinding[] }++export interface AgentPluginUpdateOptions {+ /** Apply a catalog re-pin the user confirmed after a `consent` outcome. */+ acceptCapabilities?: boolean+ /** Apply an update whose scan returned caution, after the user saw the findings. */+ force?: boolean+}-/** Re-pin a catalog-installed plugin to the current catalog SHA (backend- * `plugins.manage update`; catalog installs only). Refreshes the list on- * success. A pin that adds tools / hooks / deps / capabilities / a Desktop half- * comes back as `consent` with the delta; the caller confirms and retries with- * `acceptCapabilities`. */+/** Update an installed plugin (backend `plugins.manage update`): a catalog install+ * re-pins to the current catalog SHA, a git install pulls. Refreshes the list on+ * success. */export async function updateAgentPlugin(request: GatewayRequest,name: string,failMessage: string,profile?: string | null,- acceptCapabilities = false+ options: AgentPluginUpdateOptions = {}): Promise<AgentPluginUpdateOutcome> {$agentPluginBusy.set(name)+ const params: PluginsManageParams = { action: 'update', name }++ if (options.acceptCapabilities) {+ params.accept_capabilities = true+ }++ if (options.force) {+ params.force = true+ }+try {const result = await request<{ok?: boolean@@ -388,15 +420,19 @@ export async function updateAgentPlugin(consent_required?: booleansha?: stringdelta_lines?: string[]- }>(- 'plugins.manage',- withProfile({ action: 'update', name, ...(acceptCapabilities ? { accept_capabilities: true } : {}) }, profile)- )+ scan_blocked?: boolean+ scan_verdict?: string+ scan_findings?: AgentPluginScanFinding[]+ }>('plugins.manage', withProfile({ ...params }, profile), PLUGIN_INSTALL_REQUEST_TIMEOUT_MS)if (result?.consent_required) {return { kind: 'consent', sha: (result.sha ?? '').slice(0, 8), deltaLines: result.delta_lines ?? [] }}+ if (result?.scan_blocked) {+ return { kind: 'scan', verdict: result.scan_verdict ?? 'dangerous', findings: result.scan_findings ?? [] }+ }+if (!result?.ok) {throw new Error(failMessage)}