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): send the blocked document's digest as the install acknowledgement (#7082)
oxoxDev99297bc8dfe2
diff --git a/app/src/components/skills/InstallSkillDialog.tsx b/app/src/components/skills/InstallSkillDialog.tsxindex aa8f4e2b95..8066b3ec0d 100644--- a/app/src/components/skills/InstallSkillDialog.tsx+++ b/app/src/components/skills/InstallSkillDialog.tsx@@ -183,17 +183,17 @@ export default function InstallSkillDialog({ onClose, onInstalled }: Props) {}, []);const submitInstall = useCallback(- async (acknowledgeScanFindings: boolean) => {+ async (acknowledgedDigest?: string) => {const payload = {url: url.trim(),...(timeoutSecs.trim() ? { timeoutSecs: Number(timeoutSecs) } : {}),- ...(acknowledgeScanFindings ? { acknowledgeScanFindings: true } : {}),+ ...(acknowledgedDigest ? { acknowledgedDigest } : {}),};log(- 'submit url=%s timeout=%s acknowledge=%s',+ 'submit url=%s timeout=%s acknowledged=%s',payload.url,payload.timeoutSecs ?? 'default',- acknowledgeScanFindings+ Boolean(acknowledgedDigest));setSubmitting(true);setError(null);@@ -222,7 +222,7 @@ export default function InstallSkillDialog({ onClose, onInstalled }: Props) {} catch (err) {const message = err instanceof Error ? err.message : String(err);log('submit-err %s', message);- if (acknowledgeScanFindings) setScanOverrideError(message);+ if (acknowledgedDigest) setScanOverrideError(message);else setError(message);} finally {setSubmitting(false);@@ -235,7 +235,7 @@ export default function InstallSkillDialog({ onClose, onInstalled }: Props) {async (e: React.FormEvent) => {e.preventDefault();if (!formValid) return;- await submitInstall(false);+ await submitInstall();},[formValid, submitInstall]);@@ -453,7 +453,7 @@ export default function InstallSkillDialog({ onClose, onInstalled }: Props) {setScanOverrideError(null);setScanDeclined(true);}}- onInstallAnyway={() => void submitInstall(true)}+ onInstallAnyway={() => void submitInstall(scanBlocked.digest)}/>) : null}</ModalShell>diff --git a/app/src/components/skills/SkillsExplorerTab.tsx b/app/src/components/skills/SkillsExplorerTab.tsxindex 282231bf6b..626a47f4f1 100644--- a/app/src/components/skills/SkillsExplorerTab.tsx+++ b/app/src/components/skills/SkillsExplorerTab.tsx@@ -796,16 +796,16 @@ export default function SkillsExplorerTab({ onToast, view }: SkillsExplorerTabPr);const runRegistryInstall = useCallback(- async (entry: CatalogEntry, acknowledgeScanFindings: boolean): Promise<boolean> => {+ async (entry: CatalogEntry, acknowledgedDigest?: string): Promise<boolean> => {log(- 'runRegistryInstall: id=%s source=%s acknowledge=%s',+ 'runRegistryInstall: id=%s source=%s acknowledged=%s',entry.id,entry.source,- acknowledgeScanFindings+ Boolean(acknowledgedDigest));setInstallingId(entry.id);try {- const result = await skillRegistryApi.install(entry.id, { acknowledgeScanFindings });+ const result = await skillRegistryApi.install(entry.id, { acknowledgedDigest });if (result.status === 'scan_blocked') {log('runRegistryInstall: scan_blocked findings=%d', result.scan.findings.length);setScanOverrideError(null);@@ -834,7 +834,7 @@ export default function SkillsExplorerTab({ onToast, view }: SkillsExplorerTabPrconst handleRegistryInstall = useCallback(async (entry: CatalogEntry) => {try {- await runRegistryInstall(entry, false);+ await runRegistryInstall(entry);} catch (err) {onToast?.({type: 'error',@@ -859,9 +859,9 @@ export default function SkillsExplorerTab({ onToast, view }: SkillsExplorerTabPrconst handleScanInstallAnyway = useCallback(async () => {if (!scanBlocked) return;- const { entry } = scanBlocked;+ const { entry, scan } = scanBlocked;try {- const installed = await runRegistryInstall(entry, true);+ const installed = await runRegistryInstall(entry, scan.digest);if (installed) setScanBlocked(null);} catch (err) {setScanOverrideError(registryInstallErrorMessage(entry, err));diff --git a/app/src/components/skills/__tests__/InstallSkillDialog.test.tsx b/app/src/components/skills/__tests__/InstallSkillDialog.test.tsxindex 29eed19064..0082ac45a8 100644--- a/app/src/components/skills/__tests__/InstallSkillDialog.test.tsx+++ b/app/src/components/skills/__tests__/InstallSkillDialog.test.tsx@@ -207,6 +207,7 @@ describe('InstallSkillDialog', () => {target: 'https://example.com/SKILL.md',fetchedFrom: 'https://example.com/SKILL.md',slug: 'pasted',+ digest: 'digest-one',findings: [{check: 'hardcoded_credential',@@ -240,6 +241,7 @@ describe('InstallSkillDialog', () => {target: 'https://example.com/SKILL.md',fetchedFrom: 'https://example.com/SKILL.md',slug: 'pasted',+ digest: 'digest-two',findings: [],message: 'blocked',},@@ -262,7 +264,7 @@ describe('InstallSkillDialog', () => {await waitFor(() => expect(onInstalled).toHaveBeenCalledTimes(1));expect(vi.mocked(skillsApi.installWorkflowFromUrl).mock.calls.at(-1)?.[0]).toEqual({url: 'https://example.com/SKILL.md',- acknowledgeScanFindings: true,+ acknowledgedDigest: 'digest-two',});expect(onInstalled.mock.calls[0][0]).toEqual({url: 'https://example.com/SKILL.md',diff --git a/app/src/components/skills/__tests__/SkillsExplorerTab.test.tsx b/app/src/components/skills/__tests__/SkillsExplorerTab.test.tsxindex fe471bfc83..78e045a379 100644--- a/app/src/components/skills/__tests__/SkillsExplorerTab.test.tsx+++ b/app/src/components/skills/__tests__/SkillsExplorerTab.test.tsx@@ -548,7 +548,7 @@ describe('SkillsExplorerTab', () => {expect(within(tile).getByText('Installed')).toBeInTheDocument();});expect(skillRegistryApi.install).toHaveBeenCalledWith('built-in/apple-notes', {- acknowledgeScanFindings: false,+ acknowledgedDigest: undefined,});expect(within(tile).queryByTestId('registry-install-built-in/apple-notes')@@ -768,7 +768,7 @@ describe('SkillsExplorerTab', () => {await waitFor(() => {expect(skillRegistryApi.install).toHaveBeenCalledWith('registry-skill-1', {- acknowledgeScanFindings: false,+ acknowledgedDigest: undefined,});});await waitFor(() => {@@ -776,7 +776,7 @@ describe('SkillsExplorerTab', () => {});});- it('prompts on a scan block, keeps Block as the default and installs only on Install anyway', async () => {+ it('prompts on a scan block, keeps Block as the default and installs only the reviewed document', async () => {const { skillsApi } = await import('../../../services/api/skillsApi');const { skillRegistryApi } = await import('../../../services/api/skillRegistryApi');const onToast = vi.fn();@@ -786,6 +786,7 @@ describe('SkillsExplorerTab', () => {target: 'registry-skill-1',fetchedFrom: 'https://example.com/SKILL.md',slug: 'registry-skill-1',+ digest: 'digest-seen',findings: [{check: 'invisible_code_points',@@ -825,6 +826,31 @@ describe('SkillsExplorerTab', () => {fireEvent.click(screen.getByTestId('registry-install-registry-skill-1'));});await screen.findByTestId('scan-blocked-dialog');+ vi.mocked(skillRegistryApi.install).mockResolvedValueOnce({+ status: 'scan_blocked',+ scan: {+ ...scan,+ digest: 'digest-changed',+ findings: [+ {+ check: 'hardcoded_credential',+ verdict: 'block' as const,+ field: 'the document body',+ message: 'a hard-coded credential in the document body',+ },+ ],+ },+ });+ await act(async () => {+ fireEvent.click(screen.getByTestId('scan-blocked-install-anyway'));+ });+ expect(skillRegistryApi.install).toHaveBeenLastCalledWith('registry-skill-1', {+ acknowledgedDigest: 'digest-seen',+ });+ await waitFor(() => {+ expect(screen.getByText(/hard-coded credential/)).toBeInTheDocument();+ });+ expect(screen.getByTestId('scan-blocked-dialog')).toBeInTheDocument();vi.mocked(skillRegistryApi.install).mockResolvedValueOnce({status: 'installed',url: 'https://example.com/SKILL.md',@@ -838,7 +864,7 @@ describe('SkillsExplorerTab', () => {await waitFor(() => {expect(skillRegistryApi.install).toHaveBeenLastCalledWith('registry-skill-1', {- acknowledgeScanFindings: true,+ acknowledgedDigest: 'digest-changed',});});await waitFor(() => {@@ -1225,7 +1251,7 @@ describe('SkillsExplorerTab', () => {await waitFor(() => {expect(skillRegistryApi.install).toHaveBeenCalledWith('registry-skill-1', {- acknowledgeScanFindings: false,+ acknowledgedDigest: undefined,});});});diff --git a/app/src/services/api/__tests__/skillsApi.test.ts b/app/src/services/api/__tests__/skillsApi.test.tsindex 6a2251654d..56c0346de1 100644--- a/app/src/services/api/__tests__/skillsApi.test.ts+++ b/app/src/services/api/__tests__/skillsApi.test.ts@@ -143,6 +143,7 @@ describe('skillsApi.installWorkflowFromUrl', () => {target: 'https://example.com/SKILL.md',fetched_from: 'https://example.com/SKILL.md',slug: 'bad',+ digest: 'abc',findings: [{ check: 'invisible_code_points', verdict: 'block', field: 'body', message: 'm' }],message: 'blocked',});@@ -154,6 +155,7 @@ describe('skillsApi.installWorkflowFromUrl', () => {target: 'https://example.com/SKILL.md',fetchedFrom: 'https://example.com/SKILL.md',slug: 'bad',+ digest: 'abc',findings: [{ check: 'invisible_code_points', verdict: 'block', field: 'body', message: 'm' },],@@ -170,11 +172,11 @@ describe('skillsApi.installWorkflowFromUrl', () => {});await skillsApi.installWorkflowFromUrl({url: 'https://example.com/SKILL.md',- acknowledgeScanFindings: true,+ acknowledgedDigest: 'abc',});expect(vi.mocked(callCoreRpc).mock.calls[1][0].params).toEqual({url: 'https://example.com/SKILL.md',- acknowledge_scan_findings: true,+ acknowledged_digest: 'abc',});});diff --git a/app/src/services/api/skillRegistryApi.test.ts b/app/src/services/api/skillRegistryApi.test.tsindex 10b27cad58..968ff72179 100644--- a/app/src/services/api/skillRegistryApi.test.ts+++ b/app/src/services/api/skillRegistryApi.test.ts@@ -35,12 +35,14 @@ describe('skillRegistryApi', () => {target: 'demo',fetched_from: 'https://example.com/SKILL.md',slug: 'demo',+ digest: 'abc123',findings: [{ check: 'hardcoded_credential', verdict: 'block', field: 'body', message: 'm' }],message: 'blocked',});const blocked = await skillRegistryApi.install('demo');expect(blocked.status).toBe('scan_blocked');expect(blocked.status === 'scan_blocked' && blocked.scan.findings).toHaveLength(1);+ expect(blocked.status === 'scan_blocked' && blocked.scan.digest).toBe('abc123');expect(mockCallCoreRpc.mock.calls[0][0].params).toEqual({ entry_id: 'demo' });mockCallCoreRpc.mockResolvedValueOnce({@@ -50,11 +52,11 @@ describe('skillRegistryApi', () => {stderr: '',new_skills: ['demo'],});- const installed = await skillRegistryApi.install('demo', { acknowledgeScanFindings: true });+ const installed = await skillRegistryApi.install('demo', { acknowledgedDigest: 'abc123' });expect(installed.status).toBe('installed');expect(mockCallCoreRpc.mock.calls[1][0].params).toEqual({entry_id: 'demo',- acknowledge_scan_findings: true,+ acknowledged_digest: 'abc123',});});diff --git a/app/src/services/api/skillRegistryApi.ts b/app/src/services/api/skillRegistryApi.tsindex d0bac59fd0..5e657c1f48 100644--- a/app/src/services/api/skillRegistryApi.ts+++ b/app/src/services/api/skillRegistryApi.ts@@ -144,6 +144,8 @@ export interface ScanBlocked {target: string;fetchedFrom: string;slug: string;+ /** Digest of the blocked document; sent back to install exactly this one. */+ digest: string;findings: ScanFinding[];message: string;}@@ -153,6 +155,7 @@ export interface RawScanBlocked {target?: string;fetched_from?: string;slug?: string;+ digest?: string;findings?: ScanFinding[];message?: string;}@@ -162,6 +165,7 @@ export function normalizeScanBlocked(raw: RawScanBlocked): ScanBlocked {target: raw.target ?? '',fetchedFrom: raw.fetched_from ?? '',slug: raw.slug ?? '',+ digest: raw.digest ?? '',findings: raw.findings ?? [],message: raw.message ?? '',};@@ -187,8 +191,11 @@ export type RegistryInstallOutcome =| { status: 'scan_blocked'; scan: ScanBlocked };export interface InstallOptions {- /** Set only after the user chose "Install anyway" on the scan findings. */- acknowledgeScanFindings?: boolean;+ /**+ * The `digest` of the blocked document the user chose "Install anyway" on.+ * It installs that document only; a changed one comes back `scan_blocked`.+ */+ acknowledgedDigest?: string;}interface RawRegistryInstallResult {@@ -310,10 +317,10 @@ export const skillRegistryApi = {entryId: string,options: InstallOptions = {}): Promise<RegistryInstallOutcome> => {- const acknowledge = Boolean(options.acknowledgeScanFindings);- log('install: entryId=%s acknowledge=%s', entryId, acknowledge);+ const digest = options.acknowledgedDigest?.trim();+ log('install: entryId=%s acknowledged=%s', entryId, Boolean(digest));const params: Record<string, unknown> = { entry_id: entryId };- if (acknowledge) params.acknowledge_scan_findings = true;+ if (digest) params.acknowledged_digest = digest;const response = await callCoreRpc<| Envelope<RawRegistryInstallResult | RawScanBlocked>| RawRegistryInstallResultdiff --git a/app/src/services/api/skillsApi.ts b/app/src/services/api/skillsApi.tsindex ef35a421e4..0a23ffc7f5 100644--- a/app/src/services/api/skillsApi.ts+++ b/app/src/services/api/skillsApi.ts@@ -153,8 +153,8 @@ interface RawWorkflowsCreateResult {interface InstallWorkflowFromUrlInput {url: string;timeoutSecs?: number;- /** Set only after the user chose "Install anyway" on the scan findings. */- acknowledgeScanFindings?: boolean;+ /** The `digest` of the blocked document the user chose "Install anyway" on. */+ acknowledgedDigest?: string;}/**@@ -395,8 +395,8 @@ export const skillsApi = {installWorkflowFromUrl: async (input: InstallWorkflowFromUrlInput): Promise<InstallWorkflowFromUrlOutcome> => {- const acknowledge = Boolean(input.acknowledgeScanFindings);- log('installWorkflowFromUrl: request url=%s acknowledge=%s', input.url, acknowledge);+ const digest = input.acknowledgedDigest?.trim();+ log('installWorkflowFromUrl: request url=%s acknowledged=%s', input.url, Boolean(digest));const response = await callCoreRpc<| Envelope<RawInstallWorkflowFromUrlResult | RawScanBlocked>| RawInstallWorkflowFromUrlResult@@ -406,7 +406,7 @@ export const skillsApi = {params: {url: input.url,...(input.timeoutSecs !== undefined ? { timeout_secs: input.timeoutSecs } : {}),- ...(acknowledge ? { acknowledge_scan_findings: true } : {}),+ ...(digest ? { acknowledged_digest: digest } : {}),},});const raw = unwrapEnvelope(response);