Skip to content

feat: add visible Tauri PTY terminal - #10

Draft
Nothing1596 wants to merge 6 commits into
feat/terminal-agent-corefrom
feat/terminal-tauri
Draft

Nothing1596 wants to merge 6 commits into
feat/terminal-agent-corefrom
feat/terminal-tauri

Conversation

@Nothing1596

Copy link
Copy Markdown
Owner

概要

为终端核心增加可见的 Tauri + xterm.js 前端,以及由 Rust portable-pty 管理的跨平台 PTY 宿主。

改动

  • Python 使用 UI 线程拥有的 QProcess 和 queued signal 桥接 worker 请求
  • Rust portable-pty 宿主管理单会话、持续排空、1 MiB 环形缓冲和超时停止
  • WebView 只能读写/resize/stop 现有会话,不能 spawn 新进程
  • nonce + version JSONL 协议限制 Python 父进程入口
  • 设置页新增默认关闭的终端开关和默认 cwd;活跃会话禁止直接关闭功能
  • vendored xterm.js 6.0.0 / addon-fit 0.11.0 及许可证,不依赖发布环境 Node
  • macOS/Windows 打包流程加入 sakura-terminal

验证

  • focused Python tests: 115 passed
  • terminal/confirmation UI tests: 56 passed
  • Cargo fmt/test/check passed for terminal and settings apps
  • macOS release builds passed for sakura-terminal and sakura-settings
  • real PTY smoke passed for printf and interactive cat; no residual process

已知基线问题

完整 UI 批跑会在 macOS _set_macos_window_topmost 中段错误;同一问题已在未修改的 origin/dev 临时 worktree 复现,不是本 PR 引入。Windows 真机 ConPTY smoke 仍是合并前门禁。

@Nothing1596

Copy link
Copy Markdown
Owner Author

已按复审意见在 2ee86f5 修复并推送:

  • stdin EOF、读取错误和显式 shutdown 现在统一在 host_loop 末尾调用 app.exit(0),保证 Tauri 宿主跟随 Python 父进程退出。
  • timeout waiter 改为 Condvar::wait_timeout_while;自然退出、stop 和 timeout 都会更新状态并 notify_all,短命命令不再留下最长 30 分钟的睡眠线程。
  • QProcess graceful/terminate/kill 共用一个总 deadline;设置页禁用空闲终端的总等待预算降为 250ms,应用退出仍保留 3 秒确定性回收。
  • 设置页明确提示无 OS 沙箱且后台衍生进程可能继续运行;Rust 代码注明 Windows Job Object 是保证进程树回收所需的后续实现。

验证:Rust fmt/test/check 通过(5 tests);终端相关 Python 定向 70 tests 通过,完整相关 focused 117 tests 通过;release EOF smoke 在约 839ms 内退出码 0;交互式 cat spawn/write/read/stop/shutdown 闭环通过且无残留进程。Windows Job Object/ConPTY 真机验证仍保留为合并门禁。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant