feat: Ctrl+C 中断 Agent 运行(而非退出应用)

- 使用 Ink.render(component, false) 禁用默认 Ctrl+C 退出
- Ctrl+C 在 Agent 运行中触发 cancel(),停止当前循环
- Ctrl+C 在空闲时清空输入
- 保留 Ctrl+D 作为退出快捷键

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
abel533
2026-04-04 17:38:14 +08:00
co-authored by Copilot
parent ffb94bb2f7
commit 1b53357ded
@@ -93,8 +93,8 @@ public class JinkReplSession {
conversationSummary = text.length() > 40 ? text.substring(0, 40) : text; conversationSummary = text.length() > 40 ? text.substring(0, 40) : text;
}); });
// 启动 jink 渲染 // 启动 jink 渲染exitOnCtrlC=false,让组件处理 Ctrl+C
inkApp = Ink.render(component); inkApp = Ink.render(component, false);
// 拦截 System.out/err,防止日志干扰 TUI // 拦截 System.out/err,防止日志干扰 TUI
inkApp.patchConsole(); inkApp.patchConsole();