feat(tui): agent Bash 超时自动后台化 + Windows 命令引号修复 + Ctrl+B 交互优化#114
Merged
Conversation
agent Bash 注册、后台化和退出会改变底部状态栏与工具块可见状态,Windows 终端偶发物理屏幕和 ratatui diff buffer 不同步,导致页面残影。新增一次性终端清屏重绘标记,只在 agent Bash 生命周期切换后触发。 修改内容: - UiState 新增一次性终端清屏重绘标记 - shell_command.rs 在 agent Bash 注册、后台化和退出后请求清屏重绘 - main.rs 在 draw_app 渲染前消费标记并调用 Terminal::clear() - shell_command_test.rs 覆盖 agent Bash 注册、后台化、退出三类状态切换 特性/影响: - 只影响 agent Bash 工具路径,不改变 Read/Grep 等普通工具渲染 - 清屏只在状态切换后的下一帧触发,避免每帧全量重绘 Co-Authored-By: Codex gpt-5 <noreply@openai.com>
BashTool 超时时不再无条件杀进程,支持通过 auto_background_tx 通知 TUI 将仍在运行的前台任务自动转后台继续运行;同步修复 Windows cmd /C 使用 raw_arg 保留命令内层引号,解决带引号绝对路径命令失败的问题;Ctrl+B 后台化 后先聚焦底部 shell 入口而非直接打开面板,改善交互层级。 修改内容: - AgentShellHandle 新增 background_rx / auto_background_tx 字段,BashTool 通过 wait_for_shell_result 同时监听进程结果、手动后台化和超时三个信号 - terminal.rs 实现 ShellWaitResult 三路 select 等待,超时且宿主支持时发送 auto_background_tx 并返回后台任务占位串而非 kill - terminal_inline_executor.rs 不再 drop background_rx,留给 BashTool select - process/mod.rs 移除 has_cmd_special_chars,改用 raw_arg 传递 cmd /C 命令 - agent_shell_executor.rs / shell_command.rs 新增 auto_background_rx 处理逻辑 - shortcuts.rs Ctrl+B 统一聚焦 background_tasks_bar_focused,Enter 才打开面板 特性/影响: - TUI 场景下 BashTool 超时不再杀进程,进程转后台继续运行 - Windows 上带引号绝对路径的命令(如 python "D:/x.py")不再引号泄漏 - Ctrl+B 后台化流程从"直接打开面板"改为"先聚焦底部入口" Co-Authored-By: mimo-v2.5-pro <XiaomiMiMo@cc-code>
66d88b4 to
4ca5910
Compare
移除 terminal.rs 中不再使用的 timeout 导入(已被 wait_for_shell_result 中的 tokio::time::sleep 替代),去掉三处 format_background_task_started 调用中 command 参数的多余 & 引用(command 本身已是 &str,&&str 触发 clippy::needless_borrow)。 修改内容: - terminal.rs:13 移除 unused import timeout - terminal.rs:450/466/474 去掉 &command 多余引用 Co-Authored-By: mimo-v2.5-pro <XiaomiMiMo@cc-code>
4ca5910 to
7695bbc
Compare
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.
$(cat <<'EOF'