3838import org .noear .solon .ai .harness .HarnessFlags ;
3939import org .noear .solon .ai .harness .agent .TaskSkill ;
4040import org .noear .solon .ai .harness .command .Command ;
41+ import org .noear .solon .ai .skills .cli .TodoSkill ;
4142import org .noear .solon .ai .skills .memory .MemorySkill ;
4243import org .noear .solon .codecli .command .CliCommandContext ;
4344import org .noear .solon .codecli .config .AgentFlags ;
@@ -525,10 +526,11 @@ private void onActionEndChunk(ActionEndChunk action, AtomicBoolean isFirstReason
525526 });
526527 }
527528
529+ boolean isTodo = TodoSkill .TOOL_TODOREAD .equals (action .getToolName ()) || TodoSkill .TOOL_TODOWRITE .equals (action .getToolName ());
528530 String argsStr = argsBuilder .toString ().replace ("\n " , " " );
529531 boolean hasBigArgs = argsStr .length () > 100 || (args != null && args .values ().stream ().anyMatch (v -> v instanceof String && ((String ) v ).contains ("\n " )));
530532
531- if (agentProps .isCliPrintSimplified ()) {
533+ if (agentProps .isCliPrintSimplified () && isTodo == false ) {
532534 // --- 简化风格:单行摘要模式 ---
533535 String content = action .getContent () == null ? "" : action .getContent ().trim ();
534536 String summary ;
@@ -555,22 +557,29 @@ private void onActionEndChunk(ActionEndChunk action, AtomicBoolean isFirstReason
555557 // --- 全量风格 ---
556558 // 1. 打印指令行
557559 terminal .writer ().println ();
558- if (!hasBigArgs ) {
559- // 短参数直接跟在后面
560+ if (TodoSkill .TOOL_TODOWRITE .equals (action .getToolName ())) {
561+ //优化 todowrite 打印
562+ argsStr = "\n " + ((String ) args .get ("todos" )).trim ();
560563 terminal .writer ().println (YELLOW + "❯ " + RESET + BOLD + fullToolName + RESET + " " + DIM + argsStr + RESET );
561564 } else {
562- // 大参数块,指令名独占一行,参数作为缩进内容打印(类似 write_file 的 content 部分)
563- terminal .writer ().println (YELLOW + "❯ " + RESET + BOLD + fullToolName + RESET );
564- if (args != null ) {
565- args .forEach ((k , v ) -> {
566- String val = String .valueOf (v ).trim ();
567- if ("content" .equals (k ) && val .split ("\n " ).length > 10 ) {
568- // 如果是写文件,且内容太长,只显示头尾
569- String [] lines = val .split ("\n " );
570- val = lines [0 ] + "\n ...\n " + lines [lines .length - 1 ];
571- }
572- terminal .writer ().println (DIM + " [" + k + "]: " + val .replace ("\n " , "\n " ) + RESET );
573- });
565+
566+ if (!hasBigArgs ) {
567+ // 短参数直接跟在后面
568+ terminal .writer ().println (YELLOW + "❯ " + RESET + BOLD + fullToolName + RESET + " " + DIM + argsStr + RESET );
569+ } else {
570+ // 大参数块,指令名独占一行,参数作为缩进内容打印(类似 write_file 的 content 部分)
571+ terminal .writer ().println (YELLOW + "❯ " + RESET + BOLD + fullToolName + RESET );
572+ if (args != null ) {
573+ args .forEach ((k , v ) -> {
574+ String val = String .valueOf (v ).trim ();
575+ if ("content" .equals (k ) && val .split ("\n " ).length > 10 ) {
576+ // 如果是写文件,且内容太长,只显示头尾
577+ String [] lines = val .split ("\n " );
578+ val = lines [0 ] + "\n ...\n " + lines [lines .length - 1 ];
579+ }
580+ terminal .writer ().println (DIM + " [" + k + "]: " + val .replace ("\n " , "\n " ) + RESET );
581+ });
582+ }
574583 }
575584 }
576585
0 commit comments