fix(computer-use): harden Windows desktop automation

This commit is contained in:
Relakkes Yang
2026-08-24 02:32:23 +08:00
parent dd4edc0efe
commit e5d385dac2
16 changed files with 1357 additions and 188 deletions
@@ -178,4 +178,25 @@ describe('ComputerUsePermissionModal', () => {
expect(openSettingsMock).toHaveBeenCalledWith('Privacy_Accessibility')
})
it('discloses that Windows screenshots include ungranted visible apps', () => {
render(
<ComputerUsePermissionModal
sessionId="session-1"
request={{
requestId: 'cu-windows',
reason: 'Inspect Explorer',
apps: [],
requestedFlags: {},
screenshotFiltering: 'none',
}}
/>,
)
const disclosure = screen.getByRole('note').textContent ?? ''
expect(disclosure).toContain(
'screenshots can include every visible window on this display',
)
expect(disclosure).toContain('Input remains limited to the apps you allow')
})
})
@@ -179,6 +179,15 @@ export function ComputerUsePermissionModal({ sessionId, request }: Props) {
</div>
) : (
<div className="space-y-4">
{request.screenshotFiltering === 'none' ? (
<div
role="note"
className="rounded-[var(--radius-lg)] border border-[var(--color-warning)] bg-[var(--color-warning-container)] p-3 text-sm text-[var(--color-on-warning-container)]"
>
{t('computerUseApproval.unfilteredScreenshots')}
</div>
) : null}
{request.reason ? (
<div className="rounded-[var(--radius-lg)] border border-[var(--color-border)] bg-[var(--color-surface-container-low)] p-3">
<div className="text-xs font-semibold uppercase tracking-wide text-[var(--color-text-tertiary)]">