-
Notifications
You must be signed in to change notification settings - Fork 14.5k
feat: enable Computer Use on Windows and Linux #145
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,19 +18,25 @@ export type { | |
|
|
||
| import type { ResolvePrepareCaptureResult } from './backends/darwin.js' | ||
|
|
||
| function loadDarwin() { | ||
| if (process.platform !== 'darwin') return null | ||
| function loadBackend() { | ||
| try { | ||
| return require('./backends/darwin.js') | ||
| if (process.platform === 'darwin') { | ||
| return require('./backends/darwin.js') | ||
| } else if (process.platform === 'win32') { | ||
| return require('./backends/win32.js') | ||
| } else if (process.platform === 'linux') { | ||
| return require('./backends/linux.js') | ||
| } | ||
| } catch { | ||
| return null | ||
| } | ||
| return null | ||
|
Comment on lines
+21
to
+33
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Keep the Linux branch out of this loader for now. Lines 27-28 expand this package's contract to Linux, but the current Computer Use support matrix still treats that backend as unfinished. Shipping the branch here makes direct consumers think Suggested change function loadBackend() {
try {
if (process.platform === 'darwin') {
return require('./backends/darwin.js')
} else if (process.platform === 'win32') {
return require('./backends/win32.js')
- } else if (process.platform === 'linux') {
- return require('./backends/linux.js')
}
} catch {
return null
}
return null
}As per coding guidelines, 🤖 Prompt for AI Agents |
||
| } | ||
|
|
||
| const darwin = loadDarwin() | ||
| const backend = loadBackend() | ||
|
|
||
| export class ComputerUseAPI { | ||
| apps = darwin?.apps ?? { | ||
| apps = backend?.apps ?? { | ||
| async prepareDisplay() { return { activated: '', hidden: [] } }, | ||
| async previewHideSet() { return [] }, | ||
| async findWindowDisplays(ids: string[]) { return ids.map((b: string) => ({ bundleId: b, displayIds: [] as number[] })) }, | ||
|
|
@@ -42,12 +48,12 @@ export class ComputerUseAPI { | |
| async unhide() {}, | ||
| } | ||
|
|
||
| display = darwin?.display ?? { | ||
| display = backend?.display ?? { | ||
| getSize() { throw new Error('@ant/computer-use-swift: macOS only') }, | ||
| listAll() { throw new Error('@ant/computer-use-swift: macOS only') }, | ||
| } | ||
|
|
||
| screenshot = darwin?.screenshot ?? { | ||
| screenshot = backend?.screenshot ?? { | ||
| async captureExcluding() { throw new Error('@ant/computer-use-swift: macOS only') }, | ||
| async captureRegion() { throw new Error('@ant/computer-use-swift: macOS only') }, | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2434,7 +2434,7 @@ async function run(): Promise<CommanderCommand> { | |
| // shipped without incident; chicago places itself correctly. | ||
| if ( | ||
| feature('CHICAGO_MCP') && | ||
| getPlatform() === 'macos' && | ||
| getPlatform() !== 'unknown' && | ||
| !getIsNonInteractiveSession() | ||
|
Comment on lines
2436
to
2438
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Use an explicit platform allowlist here. Line 2437 now includes Suggested change if (
feature('CHICAGO_MCP') &&
- getPlatform() !== 'unknown' &&
+ (getPlatform() === 'macos' || getPlatform() === 'windows') &&
!getIsNonInteractiveSession()
) {🤖 Prompt for AI Agents |
||
| ) { | ||
| try { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't flip
isSupportedon for Linux yet.Line 31 feeds the Linux backend into
loadBackend(), and line 41 turns that intoisSupported = true. That widens the public support contract before Linux is declared ready.Suggested change
function loadBackend(): InputBackend | null { try { if (process.platform === 'darwin') { return require('./backends/darwin.js') as InputBackend } else if (process.platform === 'win32') { return require('./backends/win32.js') as InputBackend - } else if (process.platform === 'linux') { - return require('./backends/linux.js') as InputBackend } } catch { return null } return null }As per coding guidelines,
packages/@ant/computer-use-*/**/*.{ts,tsx}: Computer Use feature (CHICAGO_MCP flag) supports macOS and Windows; Linux backend implementation is pending.📝 Committable suggestion
🤖 Prompt for AI Agents