The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
feat(skills): add the scan-blocked install prompt with Block install as the default (#7082)
oxoxDev459258ffdb9b
diff --git a/app/src/components/skills/ScanBlockedDialog.tsx b/app/src/components/skills/ScanBlockedDialog.tsxnew file mode 100644index 0000000000..a13c5f7011--- /dev/null+++ b/app/src/components/skills/ScanBlockedDialog.tsx@@ -0,0 +1,120 @@+/**+ * ScanBlockedDialog+ * -----------------+ *+ * Shown when an install comes back `scan_blocked`: the core fetched and+ * scanned the SKILL.md twice and the supply-chain scan still blocks it, so+ * nothing was written. The user chooses:+ *+ * - "Block install" (default, focused): keep it uninstalled. Escape, the+ * backdrop and the close button mean the same.+ * - "Install anyway": the caller re-runs the install with+ * `acknowledgeScanFindings: true`.+ */+import debug from 'debug';++import { useT } from '../../lib/i18n/I18nContext';+import type { ScanBlocked } from '../../services/api/skillRegistryApi';+import { ModalShell } from '../ui';+import Button from '../ui/Button';++const log = debug('skills:scan-blocked-dialog');++interface Props {+ skillName: string;+ scan: ScanBlocked;+ installing: boolean;+ error?: string | null;+ onBlock: () => void;+ onInstallAnyway: () => void;+}++export default function ScanBlockedDialog({+ skillName,+ scan,+ installing,+ error,+ onBlock,+ onInstallAnyway,+}: Props) {+ const { t } = useT();++ const block = () => {+ if (installing) return;+ log('block: name=%s findings=%d', skillName, scan.findings.length);+ onBlock();+ };++ const installAnyway = () => {+ log('install-anyway: name=%s findings=%d', skillName, scan.findings.length);+ onInstallAnyway();+ };++ return (+ <ModalShell+ onClose={block}+ title={t('skills.scan.title')}+ titleId="scan-blocked-title"+ describedBy="scan-blocked-description"+ maxWidthClassName="max-w-[480px]"+ contentClassName="max-h-[60vh] overflow-y-auto px-5 py-4"+ closePolicy={installing ? { escape: false, backdrop: false, button: false } : undefined}+ testId="scan-blocked-dialog"+ footer={+ <div className="flex items-center justify-end gap-2">+ <Button+ variant="secondary"+ tone="danger"+ size="sm"+ disabled={installing}+ onClick={installAnyway}+ data-testid="scan-blocked-install-anyway">+ {installing ? t('skills.install.installing') : t('skills.scan.installAnyway')}+ </Button>+ <Button+ variant="primary"+ size="sm"+ autoFocus+ disabled={installing}+ onClick={block}+ data-testid="scan-blocked-block">+ {t('skills.scan.block')}+ </Button>+ </div>+ }>+ <p id="scan-blocked-description" className="text-sm text-content-secondary">+ {t('skills.scan.description').replace('{name}', skillName)}+ </p>+ <p className="mt-3 text-xs font-medium text-content-secondary">+ {t('skills.scan.findingsLabel')}+ </p>+ <ul className="mt-1 space-y-1.5" data-testid="scan-blocked-findings">+ {scan.findings.map((finding, index) => (+ <li+ key={`${finding.check}-${index}`}+ className="flex items-start gap-2 rounded-lg bg-surface-muted px-3 py-2 text-xs text-content-secondary">+ <span+ className={+ finding.verdict === 'block'+ ? 'shrink-0 rounded bg-coral-50 px-1.5 py-0.5 font-medium text-coral-700'+ : 'shrink-0 rounded bg-amber-50 px-1.5 py-0.5 font-medium text-amber-700'+ }>+ {finding.verdict === 'block'+ ? t('skills.scan.verdictBlock')+ : t('skills.scan.verdictWarn')}+ </span>+ <span className="wrap-break-word">{finding.message}</span>+ </li>+ ))}+ </ul>+ <p className="mt-3 text-xs text-content-muted">{t('skills.scan.warning')}</p>+ {error ? (+ <div+ role="alert"+ className="mt-3 rounded-lg border border-coral-200 bg-coral-50 px-3 py-2 text-xs text-coral-700">+ {error}+ </div>+ ) : null}+ </ModalShell>+ );+}diff --git a/app/src/components/skills/__tests__/ScanBlockedDialog.test.tsx b/app/src/components/skills/__tests__/ScanBlockedDialog.test.tsxnew file mode 100644index 0000000000..019e110a75--- /dev/null+++ b/app/src/components/skills/__tests__/ScanBlockedDialog.test.tsx@@ -0,0 +1,86 @@+import { fireEvent, render, screen } from '@testing-library/react';+import { describe, expect, it, vi } from 'vitest';++import type { ScanBlocked } from '../../../services/api/skillRegistryApi';+import ScanBlockedDialog from '../ScanBlockedDialog';++const scan: ScanBlocked = {+ target: 'poisoned',+ fetchedFrom: 'https://example.com/SKILL.md',+ slug: 'poisoned',+ findings: [+ {+ check: 'invisible_code_points',+ verdict: 'block',+ field: 'the document body',+ message: 'an invisible character (U+200B) in the document body',+ },+ {+ check: 'instruction_shaped',+ verdict: 'warn',+ field: 'description',+ message: 'text addressed to the agent in description',+ },+ ],+ message: 'blocked',+};++function renderDialog(overrides: Partial<Parameters<typeof ScanBlockedDialog>[0]> = {}) {+ const onBlock = vi.fn();+ const onInstallAnyway = vi.fn();+ render(+ <ScanBlockedDialog+ skillName="Poisoned"+ scan={scan}+ installing={false}+ onBlock={onBlock}+ onInstallAnyway={onInstallAnyway}+ {...overrides}+ />+ );+ return { onBlock, onInstallAnyway };+}++describe('ScanBlockedDialog', () => {+ it('lists every finding with its verdict and names the skill', () => {+ renderDialog();+ expect(screen.getByText('Security scan blocked this skill')).toBeInTheDocument();+ expect(screen.getByText(/scanned Poisoned twice/)).toBeInTheDocument();+ expect(screen.getByText(/invisible character \(U\+200B\)/)).toBeInTheDocument();+ expect(screen.getByText(/text addressed to the agent/)).toBeInTheDocument();+ expect(screen.getByText('Blocked')).toBeInTheDocument();+ expect(screen.getByText('Warning')).toBeInTheDocument();+ });++ it('focuses Block install by default', () => {+ renderDialog();+ expect(screen.getByTestId('scan-blocked-block')).toHaveFocus();+ expect(screen.getByTestId('scan-blocked-block')).toHaveTextContent('Block install');+ });++ it('Block install and Escape both keep the skill uninstalled', () => {+ const { onBlock, onInstallAnyway } = renderDialog();+ fireEvent.click(screen.getByTestId('scan-blocked-block'));+ expect(onBlock).toHaveBeenCalledTimes(1);++ fireEvent.keyDown(screen.getByTestId('scan-blocked-dialog'), { key: 'Escape' });+ expect(onBlock).toHaveBeenCalledTimes(2);+ expect(onInstallAnyway).not.toHaveBeenCalled();+ });++ it('Install anyway asks the caller to install', () => {+ const { onBlock, onInstallAnyway } = renderDialog();+ fireEvent.click(screen.getByTestId('scan-blocked-install-anyway'));+ expect(onInstallAnyway).toHaveBeenCalledTimes(1);+ expect(onBlock).not.toHaveBeenCalled();+ });++ it('locks both choices while installing and shows an install error', () => {+ const { onBlock } = renderDialog({ installing: true, error: 'write failed: disk full' });+ expect(screen.getByTestId('scan-blocked-block')).toBeDisabled();+ expect(screen.getByTestId('scan-blocked-install-anyway')).toBeDisabled();+ expect(screen.getByRole('alert')).toHaveTextContent('write failed: disk full');+ fireEvent.keyDown(screen.getByTestId('scan-blocked-dialog'), { key: 'Escape' });+ expect(onBlock).not.toHaveBeenCalled();+ });+});