claude-code-best/src/utils/computerUse/swiftLoader.ts
yi7503 522a1a366d
feat: enable Computer Use on Windows and Linux (#145)
Remove macOS-only guards so Computer Use works cross-platform:
- main.tsx: allow CHICAGO_MCP on any known platform (not just macos)
- swiftLoader.ts: remove darwin-only throw, let the backend handle it
- computer-use-input: dispatch to darwin/win32/linux backends
- computer-use-swift: rename loadDarwin→loadBackend, dispatch all platforms

Co-authored-by: yi7503 <yi7503@gmail.com>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-06 09:57:55 +08:00

22 lines
671 B
TypeScript

import type { ComputerUseAPI } from '@ant/computer-use-swift'
let cached: ComputerUseAPI | undefined
/**
* macOS-only loader for @ant/computer-use-swift.
* Non-darwin platforms should use src/utils/computerUse/platforms/ instead.
*/
export function requireComputerUseSwift(): ComputerUseAPI {
if (cached) return cached
// eslint-disable-next-line @typescript-eslint/no-require-imports
const mod = require('@ant/computer-use-swift')
if (mod.ComputerUseAPI && typeof mod.ComputerUseAPI === 'function') {
cached = new mod.ComputerUseAPI() as ComputerUseAPI
} else {
cached = mod as ComputerUseAPI
}
return cached
}
export type { ComputerUseAPI }