feat: enable Computer Use with Windows support#96
feat: enable Computer Use with Windows support#96amDosion wants to merge 1 commit intoclaude-code-best:mainfrom
Conversation
Phase 1: Replace @ant/computer-use-mcp stub with full implementation (12 files, 6517 lines from reference project). Phase 2-3: Refactor @ant/computer-use-input and @ant/computer-use-swift from single-file to dispatcher + backends/ architecture: - backends/darwin.ts — existing macOS AppleScript (unchanged logic) - backends/win32.ts — new Windows PowerShell (SetCursorPos, SendInput, CopyFromScreen, GetForegroundWindow) Add CHICAGO_MCP to default build features. Verified on Windows x64: mouse control, dual-monitor detection, full-screen screenshot, foreground app info, running process list. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
Caution Review failedPull request was closed or merged during review 📝 WalkthroughWalkthroughThis pull request implements cross-platform computer use functionality, replacing the MCP server stub with a full implementation, restructuring input and display backends into platform-agnostic dispatchers supporting both macOS and Windows, enabling the Changes
Sequence DiagramssequenceDiagram
participant Client
participant MCP Server
participant Session Ctx
participant Lock Gate
participant Tool Handler
participant Computer Executor
participant Screenshot Cache
Client->>MCP Server: CallTool(toolName, args)
MCP Server->>Session Ctx: bindSessionContext dispatcher
Session Ctx->>Lock Gate: checkCuLock()
alt Lock Held
Lock Gate-->>Session Ctx: { error: "cu_lock_held" }
Session Ctx-->>Client: error response
else Lock Available
Lock Gate->>Lock Gate: acquireCuLock() if needed
Session Ctx->>Tool Handler: handleToolCall(toolName, args, overrides)
Tool Handler->>Computer Executor: Execute operation<br/>(screenshot/click/type/etc)
Computer Executor-->>Tool Handler: result + ScreenshotResult
alt Screenshot Returned
Tool Handler->>Screenshot Cache: cache lastScreenshot
Session Ctx->>Session Ctx: onScreenshotCaptured(dims)
end
Tool Handler-->>Session Ctx: CuCallToolResult
Session Ctx->>Session Ctx: Strip internal fields
Session Ctx-->>MCP Server: ToolResult
MCP Server-->>Client: Tool response
Session Ctx->>Lock Gate: Release lock in finally
end
sequenceDiagram
participant Model
participant Tool Handler
participant Permission Dialog
participant App Grant Callback
participant Computer Executor
Model->>Tool Handler: request_access(bundleIds, tiers)
Tool Handler->>Tool Handler: Check policy:<br/>isDenied? sentinel? denied_tier?
alt Policy Denied
Tool Handler-->>Model: { denied: [...] }
else Needs User Input
Tool Handler->>Permission Dialog: onPermissionRequest(request)
Permission Dialog-->>Tool Handler: { granted, denied, flags }
Tool Handler->>App Grant Callback: Merge with existing bundles
App Grant Callback->>Tool Handler: Updated AppGrant[]
Tool Handler-->>Model: permission_response
else Already Granted
Tool Handler-->>Model: { granted: [...] }
end
sequenceDiagram
participant Module Load
participant Platform Check
participant Darwin Backend
participant Win32 Backend
participant API Instance
Module Load->>Platform Check: process.platform?
alt darwin
Platform Check->>Darwin Backend: import ./backends/darwin.js
Darwin Backend-->>Module Load: InputBackend impl<br/>(AppleScript/JXA)
else win32
Platform Check->>Win32 Backend: import ./backends/win32.js
Win32 Backend-->>Module Load: InputBackend impl<br/>(PowerShell/Win32 P/Invoke)
else other
Module Load-->>Module Load: backend = null
end
Module Load->>API Instance: Create API facade
API Instance->>API Instance: Delegate to backend?<br/>or unsupported stub
API Instance-->>Module Load: Ready for use
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
需要修正:fallback 显示器尺寸应动态获取,open 应直接启动 exe |
Summary
@ant/computer-use-mcpstub 为完整实现(12 文件,6517 行)@ant/computer-use-input和@ant/computer-use-swift为 dispatcher + backends/ 架构CHICAGO_MCP加入默认编译开关Architecture
Windows verification (x64)
isSupported: truebun run build成功(463 files)Test plan
bun run dev启动无报错🤖 Generated with Claude Code
Summary by CodeRabbit