⚠️ 已废弃 — 功能已整合到 money-tracker/server/cursor.py
本仓库不再维护。ACP 虚拟终端功能已整合进 money-tracker 的 Cursor 模块。
A virtual terminal based on Cursor's Agent Control Protocol (ACP), solving the TUI screen refresh issues of the native Cursor CLI.
- No TUI flickering - Pure streaming output, works with tmux/screen
- Color support - ANSI colors to distinguish different output types
- Diff display - Git-style file modification preview
- Auto permissions - Automatically handles tool permission requests
| Color | Meaning |
|---|---|
| Cyan | AI response |
| Gray italic | AI thinking process |
Green + |
Added lines |
Red - |
Removed lines |
| Yellow | Tool calls / file modifications |
| Magenta | Command execution results |
python3 acp_terminal.pyType exit, quit, or q to exit.
The program communicates with Cursor Agent via ACP protocol:
- Starts
agent acpprocess - Sends/receives messages via JSON-RPC
- Parses different message types in
session/update:agent_thought_chunk- AI thinking (gray)agent_message_chunk- AI response (cyan)tool_call- Tool call starttool_call_update- Tool call result (including diff)
ACP mode doesn't directly support CURSOR_API_KEY. Initialize login state first:
CURSOR_API_KEY=your_key agent --trust --print "hello"After success, credentials are cached and ACP mode can use them.
When using in docs-desiner CLI container:
- Container is configured to run as
coderuser CURSOR_API_KEYenv var is invalid for ACP mode, script handles it automatically- Credentials stored in
~/.cursor/cli-config.json
- Python 3.6+ (no external dependencies)
- Cursor CLI (
agent) installed and logged in
基于 Cursor Agent Control Protocol (ACP) 的虚拟终端,解决原生 Cursor CLI 的 TUI 刷屏问题。
- 无 TUI 刷屏 - 纯流式输出,支持 tmux/screen
- 颜色支持 - ANSI 颜色区分不同类型的输出
- Diff 显示 - 类似
git diff的文件修改预览 - 自动权限 - 自动处理工具调用权限请求
| 颜色 | 含义 |
|---|---|
| 青色 | AI 回复内容 |
| 灰色斜体 | AI 思考过程 |
绿色 + |
新增的代码行 |
红色 - |
删除的代码行 |
| 黄色 | 工具调用/文件修改 |
| 洋红色 | 命令执行结果 |
python3 acp_terminal.py输入 exit、quit 或 q 退出。
程序通过 ACP 协议与 Cursor Agent 通信:
- 启动
agent acp进程 - 通过 JSON-RPC 发送/接收消息
- 解析
session/update中的不同消息类型:agent_thought_chunk- AI 思考(灰色)agent_message_chunk- AI 回复(青色)tool_call- 工具调用开始tool_call_update- 工具调用结果(包含 diff)
ACP 模式不直接支持 CURSOR_API_KEY,需要先初始化登录状态:
CURSOR_API_KEY=你的key agent --trust --print "hello"执行成功后,凭据会被缓存,ACP 模式即可使用。
在 docs-desiner CLI 容器中使用时:
- 容器已配置为
coder用户运行 CURSOR_API_KEY环境变量对 ACP 模式无效,脚本会自动清理- 认证凭据存储在
~/.cursor/cli-config.json
- Python 3.6+(无外部依赖)
- Cursor CLI (
agent) 已安装并登录
MIT