feat: 实现 @ant/computer-use-input — macOS 键鼠模拟

使用 AppleScript + JXA (JavaScript for Automation) 实现完整 API:
- moveMouse: CGEvent 鼠标移动
- key/keys: System Events 键盘输入(支持修饰键组合)
- mouseLocation: CGEvent 查询当前鼠标位置
- mouseButton: CGEvent 鼠标点击/按下/释放
- mouseScroll: CGEvent 滚轮事件
- typeText: System Events 文本输入
- getFrontmostAppInfo: 获取前台应用 bundleId + 名称

兼容 require() 调用方式(所有方法作为命名导出)。

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
claude-code-best
2026-04-01 08:27:08 +08:00
parent 30e863c9b8
commit 975b4876cc
3 changed files with 168 additions and 30 deletions

View File

@@ -11,9 +11,9 @@
- [x] `image-processor-napi` — 图像处理 NAPI 模块 (sharp + osascript 剪贴板)
<!-- - [ ] `@ant/computer-use-swift` — Computer Use Swift 原生模块
- [ ] `@ant/computer-use-mcp` — Computer Use MCP 服务
- [ ] `@ant/computer-use-input` — Computer Use 输入模块
- [ ] `@ant/claude-for-chrome-mcp` — Chrome MCP 扩展 -->
- [ ] `@ant/computer-use-mcp` — Computer Use MCP 服务 -->
- [x] `@ant/computer-use-input` — Computer Use 输入模块 (macOS AppleScript/JXA 实现)
<!-- - [ ] `@ant/claude-for-chrome-mcp` — Chrome MCP 扩展 -->
## 工程化能力