Skip to content

JiuwenSwarm is an intelligent AI Agent built on openJiuwen. It extends the powerful capabilities of large language models directly to your fingertips through various communication apps you use daily.

Python

fix:1.todo可以折叠展开2. in_progress时新增spinner 动画

openJiuwen-botd8779dbb41c9
diff --git a/jiuwenclaw/channels/tui/frontend/src/ui/app-screen.ts b/jiuwenclaw/channels/tui/frontend/src/ui/app-screen.ts
index 8980c419a2..7344b3be47 100644
--- a/jiuwenclaw/channels/tui/frontend/src/ui/app-screen.ts
+++ b/jiuwenclaw/channels/tui/frontend/src/ui/app-screen.ts
@@ -459,7 +459,7 @@ export class AppScreen implements Component, Focusable {
private configEditorState: ConfigEditorState | null = null;
private statusViewState: StatusViewState | null = null;
private startupPromptList: SelectList | null = null;
- private showTodos = true;
+ private todosCollapsed = false;
private showTeamPanel = false;
private selectedTeamMemberId: string | null = null;
private viewedTeamMemberId: string | null = null;
@@ -616,7 +616,7 @@ export class AppScreen implements Component, Focusable {
interruptTask: () => this.interruptTask(),
exitApp: () => this.exit(),
toggleTodos: () => {
- this.showTodos = !this.showTodos;
+ this.todosCollapsed = !this.todosCollapsed;
this.tui.requestRender();
},
toggleTeamPanel: () => {
@@ -945,7 +945,7 @@ export class AppScreen implements Component, Focusable {
showFullThinking: snapshot.transcriptMode === "detailed",
showToolDetails: snapshot.transcriptMode === "detailed",
showShortcutHelp: false,
- showTodos: this.showTodos,
+ todosCollapsed: this.todosCollapsed,
showTeamPanel: this.showTeamPanel,
selectedTeamMemberId: this.selectedTeamMemberId,
viewedTeamMemberId: this.viewedTeamMemberId,
diff --git a/jiuwenclaw/channels/tui/frontend/src/ui/components/todo-list.ts b/jiuwenclaw/channels/tui/frontend/src/ui/components/todo-list.ts
index 21e61e268c..bf74b777d2 100644
--- a/jiuwenclaw/channels/tui/frontend/src/ui/components/todo-list.ts
+++ b/jiuwenclaw/channels/tui/frontend/src/ui/components/todo-list.ts
@@ -25,14 +25,40 @@ function normalizeTodoText(text: string): string {
.replace(/(?:\.\.\.|…)\s*$/u, "");
}
-function todoLabel(todo: TodoItem): string {
- const prefix = todo.status === "in_progress" ? "●" : todo.status === "completed" ? "✓" : "○";
+function todoLabel(todo: TodoItem, animationPhase: number = 0): string {
+ const spinner = ["◐", "◓", "◑", "◒"][animationPhase % 4]!;
+ const prefix = todo.status === "in_progress" ? spinner : todo.status === "completed" ? "✓" : "○";
return `${prefix} ${normalizeTodoText(todo.activeForm || todo.content)}`;
}
-export function renderTodoList(todos: TodoItem[], width: number): string[] {
+export function renderTodoList(
+ todos: TodoItem[],
+ width: number,
+ collapsed: boolean = false,
+ animationPhase: number = 0
+): string[] {
+ const pendingCount = todos.filter((t) => t.status === "pending").length;
+ const inProgressCount = todos.filter((t) => t.status === "in_progress").length;
+ const completedCount = todos.filter((t) => t.status === "completed").length;
+
+ const statusText = [
+ inProgressCount > 0 ? `${inProgressCount} in progress` : "",
+ pendingCount > 0 ? `${pendingCount} pending` : "",
+ completedCount > 0 ? `${completedCount} completed` : "",
+ ]
+ .filter(Boolean)
+ .join(", ");
+
+ const headerLine = collapsed
+ ? `Todo [${statusText}] ▸`
+ : palette.text.secondary("Todo") + ` [${statusText}]`;
+
+ if (collapsed) {
+ return [padToWidth(headerLine, width), " ".repeat(width)];
+ }
+
if (todos.every((todo) => todo.status === "completed")) {
- return [];
+ return [padToWidth(palette.text.secondary("Todo"), width), " ".repeat(width)];
}
const ordered = [
@@ -44,14 +70,14 @@ export function renderTodoList(todos: TodoItem[], width: number): string[] {
const list = new SelectList(
ordered.map((todo) => ({
value: todo.id,
- label: todoLabel(todo),
+ label: todoLabel(todo, animationPhase),
})),
Math.min(Math.max(ordered.length, 1), 8),
selectListTheme,
);
return [
- padToWidth(palette.text.secondary("Todo"), width),
+ padToWidth(headerLine, width),
...list.render(width),
" ".repeat(width),
];
diff --git a/jiuwenclaw/channels/tui/frontend/src/ui/screen-layout.ts b/jiuwenclaw/channels/tui/frontend/src/ui/screen-layout.ts
index b99bcb243f..99f2ef0830 100644
--- a/jiuwenclaw/channels/tui/frontend/src/ui/screen-layout.ts
+++ b/jiuwenclaw/channels/tui/frontend/src/ui/screen-layout.ts
@@ -20,7 +20,7 @@ export interface ScreenLayoutOptions {
showFullThinking: boolean;
showToolDetails: boolean;
showShortcutHelp: boolean;
- showTodos: boolean;
+ todosCollapsed: boolean;
showTeamPanel: boolean;
selectedTeamMemberId: string | null;
viewedTeamMemberId: string | null;
@@ -181,7 +181,7 @@ export function buildAppScreenLines(snapshot: AppSnapshot, options: ScreenLayout
options.pendingInput,
options.pendingInputBaseline,
);
- const todoLines = options.showTodos ? renderTodoList(snapshot.todos, options.width) : [];
+ const todoLines = renderTodoList(snapshot.todos, options.width, options.todosCollapsed, options.animationPhase);
const hasTeamActivity =
isTeamMode(snapshot.mode) ||
snapshot.teamMemberEvents.length > 0 ||