feat: P1功能增强 - 3命令+代码高亮+状态行
新增3个命令: - /resume: 恢复已保存的对话(支持list/序号选择) - /export: 导出对话为Markdown文件 - /commit: 创建Git commit(支持AI生成commit message) 代码语法高亮(MarkdownRenderer增强): - 支持Java/JS/TS/Python/Bash/SQL关键字着色 - 字符串字面量黄色、数字紫色、注释灰色斜体 - 注解(@Annotation)亮黄色 - true/false/null 红色 - 新增引用块、有序列表、复选框、链接渲染 - 代码块边框对齐 底部状态行(StatusLine): - 模型名、Token用量、费用、API调用次数、工作目录 - 非dumb终端自动启用 - 每次Agent循环后刷新显示 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -51,6 +51,7 @@ public class ReplSession {
|
||||
private final MarkdownRenderer markdownRenderer;
|
||||
private final SpinnerAnimation spinner;
|
||||
private final ThinkingRenderer thinkingRenderer;
|
||||
private final StatusLine statusLine;
|
||||
|
||||
/** 对话摘要(取第一次用户输入的前40字) */
|
||||
private String conversationSummary = "";
|
||||
@@ -76,6 +77,7 @@ public class ReplSession {
|
||||
this.markdownRenderer = new MarkdownRenderer(out);
|
||||
this.spinner = new SpinnerAnimation(out);
|
||||
this.thinkingRenderer = new ThinkingRenderer(out);
|
||||
this.statusLine = new StatusLine(out);
|
||||
|
||||
setupAgentCallbacks();
|
||||
setupToolContextCallbacks();
|
||||
@@ -178,6 +180,12 @@ public class ReplSession {
|
||||
// 设置活跃的 reader,供 AskUser 和权限确认使用
|
||||
this.activeReader = reader;
|
||||
|
||||
// 非 dumb 终端启用底部状态行
|
||||
boolean isDumb2 = "dumb".equals(terminal.getType());
|
||||
if (!isDumb2) {
|
||||
statusLine.enable(providerInfo.model(), agentLoop.getTokenTracker());
|
||||
}
|
||||
|
||||
CommandContext cmdContext = new CommandContext(agentLoop, toolRegistry, out, () -> running = false);
|
||||
|
||||
while (running) {
|
||||
@@ -299,6 +307,11 @@ public class ReplSession {
|
||||
|
||||
spinner.stop();
|
||||
out.println(); // 流式输出结束后换行
|
||||
|
||||
// 刷新底部状态行(显示最新 token 用量)
|
||||
if (statusLine.isEnabled()) {
|
||||
out.println(statusLine.renderInline());
|
||||
}
|
||||
out.println();
|
||||
} catch (Exception e) {
|
||||
spinner.stop();
|
||||
|
||||
Reference in New Issue
Block a user