fix: restore computer use setup for python 3.8

This commit is contained in:
Relakkes Yang 2026-04-22 14:23:56 +08:00
parent de736c49f7
commit 4bc6e135dd
4 changed files with 24 additions and 20 deletions

View File

@ -1,4 +1,4 @@
mss>=10.1.0
mss>=9.0.2,<10
Pillow>=11.3.0
pyautogui>=0.9.54
pywin32>=306

View File

@ -1,4 +1,4 @@
mss>=10.1.0
mss>=9.0.2,<10
Pillow>=11.3.0
pyautogui>=0.9.54
pyobjc-core>=11.1

View File

@ -0,0 +1,18 @@
import { describe, expect, test } from 'bun:test'
import darwinRequirements from '../../../runtime/requirements.txt' with { type: 'text' }
import win32Requirements from '../../../runtime/requirements-win.txt' with { type: 'text' }
function findRequirement(requirements: string, packageName: string): string | undefined {
return requirements
.split(/\r?\n/)
.map(line => line.trim())
.find(line => line.startsWith(`${packageName}`))
}
describe('computer use requirements', () => {
test('pins mss to the last Python 3.8-compatible major version', () => {
expect(findRequirement(darwinRequirements, 'mss')).toBe('mss>=9.0.2,<10')
expect(findRequirement(win32Requirements, 'mss')).toBe('mss>=9.0.2,<10')
})
})

View File

@ -21,6 +21,10 @@ import { DEFAULT_DESKTOP_GRANT_FLAGS } from '../../utils/computerUse/preauthoriz
import MAC_HELPER_CONTENT from '../../../runtime/mac_helper.py' with { type: 'text' }
// @ts-ignore — Bun text import
import WIN_HELPER_CONTENT from '../../../runtime/win_helper.py' with { type: 'text' }
// @ts-ignore — Bun text import
import REQUIREMENTS_DARWIN from '../../../runtime/requirements.txt' with { type: 'text' }
// @ts-ignore — Bun text import
import REQUIREMENTS_WIN32 from '../../../runtime/requirements-win.txt' with { type: 'text' }
const __dirname = path.dirname(fileURLToPath(import.meta.url))
const projectRoot = path.resolve(__dirname, '../../..')
@ -30,24 +34,6 @@ const runtimeStateRoot = join(claudeHome, '.runtime')
const venvRoot = join(runtimeStateRoot, 'venv')
const installStampPath = join(runtimeStateRoot, 'requirements.sha256')
// Embedded content of requirements — platform-specific.
const REQUIREMENTS_DARWIN = `mss>=10.1.0
Pillow>=11.3.0
pyautogui>=0.9.54
pyobjc-core>=11.1
pyobjc-framework-Cocoa>=11.1
pyobjc-framework-Quartz>=11.1
`
const REQUIREMENTS_WIN32 = `mss>=10.1.0
Pillow>=11.3.0
pyautogui>=0.9.54
pywin32>=306
psutil>=5.9.0
pyperclip>=1.8.2
screeninfo>=0.8.1
`
const isWindows = process.platform === 'win32'
const REQUIREMENTS_CONTENT = isWindows ? REQUIREMENTS_WIN32 : REQUIREMENTS_DARWIN