donsole
u0-ani-nya/donsole
Shared terminal for the human and the agent, where commands the agent runs appear in the pty you are watching, it reads the screen and the raw output stream, and it types into foreground programs such as ssh or vim so it can help inside a session you already opened.
Instalar
dsh plugin --profile web add github:u0-ani-nya/donsoleREADME
donsole — 人和 agent 共用的终端
本项目完全由 DeepSeek Harness 编写。
从第一行 bash 到 Qt6 终端窗口、socket 协议、测试和文档,全部是在与用户的对话里, 由 DeepSeek Harness 的 agent 写出来并验证的。人只负责提需求、看效果、指出哪里不对。
目的很直接:用户照常在自己熟悉的 CLI 里干活时,DeepSeek 这样的 LLM 能顺手把活干了—— 在同一个终端里跑命令、看输出、盯着进度;需要钻到服务器里时,直接在用户开着的
ssh会话里操作,不用另起一套环境。
你敲 ls · agent 敲 pytest · 同一块屏幕 · 同一个 pty
它解决什么
普通 agent 干活是这样的:它在一个你看不见的 shell 里跑命令,跑完把输出贴给你。 你要么信任它,要么自己重跑一遍。而 SSH 场景更糟:agent 根本进不去你那个已经登录的会话, 只能另开连接、另配密钥。
donsole 换了一个前提:终端只有一个,人和 agent 都往里敲。
- 你敲的命令它看得见(
donsole look/donsole output)。 - 它敲的命令你看得见,而且能随时接管。
- 你
ssh进服务器之后,它能把命令直接打进这个 ssh 会话——就像坐在你旁边。 - 高权限操作(
sudo、装包、删数据)默认走这里:你看着它执行,密码你自己输。
架构
你 ── 键盘 ──► 窗口/客户端 ──┐ ┌── bash(pty,守护进程持有)
├── Unix socket(JSON)── 守护进程 ──┤
agent ── CLI / 任意客户端 ───┘ 屏幕网格 / 输出流 / 注入 └── 你的命令(含 ssh)
- 守护进程:
bin/donsole-d.py serve,持有 pty,维护屏幕网格和原始输出流(带 seq), 在/tmp/donsole-<hash>.sock(0600)上提供 API。 - 客户端:
bin/donsole-d.py attach(文本,真彩色)或build/donsole-t(Qt6 原生窗口)。 - 原生窗口自己画壁纸(QPixmap 全分辨率)+ 文字,支持鼠标选中、双击选词、右键菜单、
Ctrl+Shift+C/V/A。参考了 Konsole 的ColorSchemeWallpaper::draw()的做法。
API(逐行 JSON)
| 类别 | op |
|---|---|
| 查 | info(含 busy)、screen/dump、output {since}、ping |
| 改 | type/send、resize、clear、exec {cmd,timeout} |
| 订阅 | subscribe → 持续推 output 帧、unsubscribe |
| 删 | stop |
exec 有两种模式:bash 提示符下走 bind -x(F5)拿精确输出和退出码;前台是
ssh/vim 时把命令打进去,从输出流收结果(退出码未知)。任何 op 出错只回 error 帧,
不会带走服务端。
安装
作为 DSH 插件(自动注册技能):
dsh plugin install <repo 目录或 npm 包>
只用 CLI:
git clone https://github.com/u0-ani-nya/donsole
cd donsole
./install.sh # 软链到 ~/.dsh/skills/donsole 与 ~/.local/bin/donsole
原生窗口(可选,需要 Qt6 + cmake):
./build.sh
donsole # 检测到 build/donsole-t 就开窗口
用法
cd 你的项目
donsole # 开窗口 / 进会话
donsole run 'pytest -q' # agent 在同一个终端里执行,返回输出+退出码
donsole look # agent 抓屏
donsole output --since 0 # agent 读原始输出流
donsole info # busy / seq / 尺寸
donsole prog 60 --msg 生成报告 # 进度
donsole ask "覆盖吗?" --opt 覆盖 --opt 另存
测试
python3 tests/session_test.py # 26 项:API、注入、前台程序、客户端、崩溃恢复
python3 tests/tui_test.py # 17 项:看板 / watch
限制
- Linux 已验证;macOS 用
forkpty(源码就绪),Windows 用 ConPTY(源码就绪,未实测)。 - 需要 bash 4.4+、python3、jq。
- 仓库不附带壁纸:
--wallpaper指定你自己的图片,tools/make_mosaic.py生成文本客户端的背景。 - 一个状态目录一个会话。
License
MIT。见 LICENSE。
Plugins relacionados
archify (deepseek-harness)
tt-a1i/archify
WeKnora (dsh-weknora)
tencent/weknora
next-ai-draw-io (dsh-plugin)
dayuanjiang/next-ai-draw-io
AiToEarn (dsh-plugin-aitoearn)
yikart/aitoearn