Repository navigation
[1338] 增加 /exit 指令退出 gf - #13
Merged
Merged
Conversation
- 重构 pi-app-run 主循环:将 /exit 退出检测从 (if ... (let ... (cond ...))) 折叠为 (let ... (cond ((pi-app-exit-requested? app) #t) ...)), 使 max-tree-depth 从 16 降回 15 以内,退出语义与 Ctrl+D 路径保持一致 - 新增 tui/tests/.../app-exit/ 单元测试目录,补齐 pi-app-exit-command? 与 pi-app-submit-exit! 的专属单元测试,满足 unit-test 规范 - 新增 pi-app-exit-requested? 单元测试,覆盖退出标志读写 - 新增 app-exit 模块 README 索引
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.
背景
gf 交互模式缺少
/exit斜杠命令,用户输入/exit会被当作普通提示发送给模型,造成无意义的 Token 消耗并违背用户直觉(主流终端交互工具普遍使用/exit退出会话)。改动
slash-command-menu.scm:在静态命令列表%commands注册exit(描述Exit gf),支持菜单模糊匹配与自动补全。app-exit.scm(新增):/exit命令识别与处理模块,结构对齐app-login等模块。/exit为无参指令,仅严格匹配"/exit"(带空格不识别,避免误吞后续文本)。app-submit.scm:分发cond中识别/exit,置位退出标志,跳过消息入队与模型调用流程。state.scm+app.scm:在<pi-app>record 增加exit-requested字段与访问器,构造器传入初值#f。run.scm:主循环每轮顶部检测退出标志,置位则离开循环,复用与 Ctrl+D 完全一致 的 dynamic-wind 退出清理路径(中止在途任务、退出备用屏、打印会话记录、关闭通道、必要时强制退出),实现统一的优雅退出语义。验收
slash-command-menu(3)app-submit(7,含新增pi-app-submit-exit-test.scm5 个用例)pi-app-run-test.scmtui/tests/liii/pi/tui/interactive/428 个测试通过gf fmt --check --changed-since=main格式门禁通过关联任务文档:devel/1338.stem