内容
# 应用适配器 — 通过命令控制任何软件
**人工智能到应用的桥梁。** 给予任何人工智能代理控制真实软件的能力 —
并让代理为共享的生态系统做出贡献。
```
"zoom.send_chat|||text=你好" → 消息输入到 Zoom
"weibo.trends" → 实时趋势话题
"terminal.run|||cmd=dir" → shell 命令执行
```
## 为什么
当前的人工智能代理被困在浏览器中。它们可以读取网页,但不能在真正的应用程序中执行操作。Codex 的记录和回放会监视您的屏幕 — 视觉的、缓慢的、脆弱的。
**应用适配器将人类 GUI 操作转换为机器可执行的命令。**
无需屏幕录制。无需像素匹配。只需 `app_do("app.action", params)`。
**这是一个活跃的生态系统。** 代理不仅使用适配器 — 它们发现、学习、测试并将它们发布回社区。
## 工作原理
```
┌──────────┐ ┌──────────────┐ ┌──────────┐
│ 任意代理 │ ──▶ │ 应用适配器 │ ──▶ │ 真实应用 │
│ (Claude, │ │ (MCP 服务器) │ │ (Zoom, │
│ Codex, │ │ │ │ 微信, │
│ Cursor) │ │ 策略: │ │ Excel, │
│ │ │ • http/api │ │ 等) │
│ │ │ • cdp/browser│ │ │
│ │ │ • uia/desktop│ │ │
│ │ │ • shell/cmd │ │ │
└──────────┘ └──────────────┘ └──────────┘
```
### 策略优先级
| 策略 | 使用场景 | 速度 | 可靠性 |
|----------|----------|-------|-------------|
| `http` | 应用有 REST API | 快 | 高 |
| `cdp` | 应用有网页界面 | 中 | 中 |
| `uia` | 仅限桌面应用,无 API | 慢 | 低 |
| `shell` | CLI 工具或脚本 | 快 | 高 |
| `startfile` | 只需打开应用 | 即时 | 高 |
**优先选择 `http` 而非视觉策略。** 视觉自动化是最后的手段。
## 快速开始
```bash
# 一行安装(推荐)
pip install git+https://github.com/codenoob-jacky/app-adapter.git
# 或克隆 + 开发安装
git clone https://github.com/codenoob-jacky/app-adapter.git
cd app-adapter
pip install -e .
# 包含所有可选依赖(浏览器 + 桌面自动化):
pip install "app-adapter[all] @ git+https://github.com/codenoob-jacky/app-adapter.git"
# Windows: scripts\install.bat | Mac/Linux: bash scripts/install.sh
```
### 命令行界面(CLI)(安装一次,随处使用)
```bash
app-adapter # 快速概览
app-adapter list # 列出所有 26 个应用
app-adapter scan # 查找可安装的应用
app-adapter do "zoom.send_chat|||text=你好"
app-adapter prompt --style brief # 获取代理的贡献提示
app-adapter server --port 8080 # 启动 HTTP 服务器
app-adapter server --mcp # 启动 MCP 标准输入/输出服务器
```
### Python
```python
from app_adapter import app_do, app_list, app_scan, get_agent_prompt
print(app_list())
app_do("terminal.run|||cmd=echo 来自 Python 的问候")
print(get_agent_prompt("brief")) # 将此注入您的代理
```
### HTTP 服务器
```bash
app-adapter server --port 8080
-d '{"tool":"app_do","arguments":{"action":"zoom.send_chat|||text=来自 AI 的问候"}}'
```
## 代理生态系统
这不仅仅是一个工具 — 代理可以**发现、学习和贡献**:
```python
# 1. 发现系统上有哪些应用
app_scan() # → "发现 Zoom, Slack, VS Code, Spotify..."
# 2. 注册新应用
app_register("spotify|||Spotify|||https://open.spotify.com|||cdp|||entertainment")
# 3. 教它执行操作
app_learn("spotify|||search|||搜索曲目|||cdp|||input[data-testid='search-input']|||fill")
app_learn("spotify|||play|||播放/暂停|||cdp|||button[data-testid='play-button']|||click")
# 4. 在分享前测试
app_test("spotify.search|||query=波希米亚狂想曲")
# 5. 发布到社区
app_publish("spotify")
# 其他代理可以发现并安装它:
app_search("spotify") # → 在注册表中找到
app_install("spotify") # → 下载并合并
app_do("spotify.play")
```
### 完整 API
| 函数 | 描述 | 示例 |
|----------|-------------|---------|
| `app_do(spec)` | 执行操作 | `app_do("zoom.send_chat\|\|\|text=嗨")` |
| `app_list(category?)` | 列出所有应用和操作 | `app_list("social")` |
| `app_register(spec)` | 注册新应用 | `app_register("slack\|\|\|Slack\|\|\|https://slack.com\|\|\|cdp\|\|\|communication")` |
| `app_learn(spec)` | 教应用新操作 | `app_learn("slack\|\|\|send\|\|\|发送消息\|\|\|cdp\|\|\|selector\|\|\|fill_then_click")` |
| `app_scan()` | 发现已安装的应用 | `app_scan()` |
| `app_search(query?)` | 搜索社区注册表 | `app_search("discord")` |
| `app_install(name)` | 从注册表安装 | `app_install("spotify")` |
| `app_publish(name)` | 发布到注册表 | `app_publish("my_slack_adapter")` |
| `app_export(name?)` | 以 JSON 导出适配器 | `app_export("zoom")` |
| `app_import(json)` | 从 JSON 导入适配器 | `app_import('{"app":{...}}')` |
| `app_test(spec)` | 测试操作并报告 | `app_test("zoom.send_chat\|\|\|text=测试")` |
## 内置应用(26 个应用,80+ 操作)
| 类别 | 应用 |
|----------|------|
| **通信** | Zoom, Slack, Discord, Teams, Outlook |
| **社交媒体** | 微信公众号, 微博, 知乎, Bilibili, 小红书, 抖音, X/Twitter |
| **生产力** | Excel, Word, PowerPoint, PDF, Notion, GitHub |
| **开发** | VS Code, 终端, Postman |
| **设计** | Figma, Canva |
| **金融** | TradingView |
| **实用工具** | 浏览器(导航,搜索,截图) |
## 让您的代理成为贡献者
杀手级功能:**自主改进** 生态系统。
```bash
# 获取贡献提示
app-adapter prompt --style full
# 将其注入您的代理的系统消息中。
# 现在您的代理将:
# - 使用 app_scan() 发现未注册的应用
# - 使用 app_search() 检查注册表
# - 自主注册 + 教导 + 测试 + 发布
```
每次贡献都帮助全球的 AI 代理。注册表呈指数级增长。
## 连接到您的代理
### Claude 桌面版
```json
{
"mcpServers": {
"app-adapter": {
"command": "app-adapter",
"args": ["server", "--mcp"]
}
}
}
```
### Codex
```yaml
# codex.yaml 或 .codex/config.json
mcp:
app-adapter:
type: stdio
command: app-adapter
args: [server, --mcp]
```
### Cursor
```json
// .cursor/mcp.json
{
"mcpServers": {
"app-adapter": {
"command": "app-adapter",
"args": ["server", "--mcp"]
}
}
}
```
### LangChain / OpenAI 代理 SDK
```python
from app_adapter import app_do, get_agent_prompt
# 注入提示 + 包装工具。有关完整示例,请参见 docs/INTEGRATION.md。
```
> 完整集成指南:[docs/INTEGRATION.md](docs/INTEGRATION.md)
## 社区注册表
此存储库中的 `registry/` 文件夹是社区适配器注册表。
任何人(人类或代理)都可以贡献:
1. 使用 `app_register()` + `app_learn()` 创建适配器
2. 使用 `app_test()` 测试
3. 使用 `app_export("your_app")` 导出
4. 将 JSON 保存到 `registry/your_app.json`
5. 对此存储库打开 PR
代理通过 `app_search()` → `app_install()` 发现这些。
### 当前社区适配器
| 适配器 | 操作 |
|---------|---------|
| **Slack** | open, send_message, search, jump_to_channel |
| **Discord** | open, send_message, mute_toggle |
| **Spotify** | open, search, play, next_track, get_current |
**成为下一个贡献者。** → [registry/](registry/)
## 设计哲学
> 人类使用 GUI。机器需要命令。
> 适配器是翻译层。
> 不要让 AI 学习看 — 教应用听。
> 然后让代理分享它们学到的东西。
## 许可证
MIT