feat: 添加可见终端与受控 PTY 能力 - #142
Open
Nothing1596 wants to merge 8 commits into
Open
Nothing1596 wants to merge 8 commits into
Nothing1596 wants to merge 8 commits into
Conversation
Nothing1596
marked this pull request as ready for review
July 14, 2026 05:39
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
背景
这个 PR 为 Sakura 增加一项默认关闭的可见终端能力,让桌宠可以在用户明确授权后执行和继续操作终端进程。
该功能定位为桌宠的可选增强能力,不是独立的 Agent CLI 或终端产品。首版优先保证权限边界、进程生命周期和跨线程稳定性,不提供 OS 级沙箱。
主要改动
权限契约
ONCE/PROCESS两种授权范围。terminal_exec命令都必须确认,即使开启了完整访问权限。session_id的读取、写入和停止。终端工具与 Python 接线
terminal_exec、terminal_read、terminal_write、terminal_stop四个模型工具。zsh -lc、powershell -Command等,并按高风险处理。TerminalManager统一管理设置、会话、输出清洗、长度限制和授权状态。QProcess,worker 通过 queued signal 和请求 ID 通信,避免跨线程操作 Qt process/socket。可见 PTY 宿主
sakura-terminalTauri 程序,Rust 端使用portable-pty 0.9.0,前端使用固定版本的 xterm.js 构建产物。确认体验
设置与打包
用户流程
terminal_exec,Sakura 打开独立终端确认窗口。安全边界
验证
1283 passed, 1 skipped。7 passed。8 passed。sakura-terminal二进制完成协议 v2 初始化、确认显示、确认清除和正常退出 smoke。已知限制与后续