mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-27 21:44:25 -07:00
Improve rendering of ToDo lists. (#11315)
This commit is contained in:
committed by
GitHub
parent
c71b749185
commit
9a4211b610
@@ -541,7 +541,18 @@ export function hasCycleInSchema(schema: object): boolean {
|
||||
return traverse(schema, new Set<string>(), new Set<string>());
|
||||
}
|
||||
|
||||
export type ToolResultDisplay = string | FileDiff | AnsiOutput;
|
||||
export interface TodoList {
|
||||
todos: Todo[];
|
||||
}
|
||||
|
||||
export type ToolResultDisplay = string | FileDiff | AnsiOutput | TodoList;
|
||||
|
||||
export type TodoStatus = 'pending' | 'in_progress' | 'completed' | 'cancelled';
|
||||
|
||||
export interface Todo {
|
||||
description: string;
|
||||
status: TodoStatus;
|
||||
}
|
||||
|
||||
export interface FileDiff {
|
||||
fileDiff: string;
|
||||
|
||||
@@ -86,7 +86,7 @@ describe('WriteTodosTool', () => {
|
||||
};
|
||||
const result = await tool.buildAndExecute(params, signal);
|
||||
expect(result.llmContent).toBe('Successfully cleared the todo list.');
|
||||
expect(result.returnDisplay).toBe('Successfully cleared the todo list.');
|
||||
expect(result.returnDisplay).toEqual({ todos: [] });
|
||||
});
|
||||
|
||||
it('should return a formatted todo list on success', async () => {
|
||||
@@ -103,7 +103,7 @@ describe('WriteTodosTool', () => {
|
||||
2. [in_progress] Second task
|
||||
3. [pending] Third task`;
|
||||
expect(result.llmContent).toBe(expectedOutput);
|
||||
expect(result.returnDisplay).toBe(expectedOutput);
|
||||
expect(result.returnDisplay).toEqual(params);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -9,6 +9,7 @@ import {
|
||||
BaseDeclarativeTool,
|
||||
BaseToolInvocation,
|
||||
Kind,
|
||||
type Todo,
|
||||
type ToolResult,
|
||||
} from './tools.js';
|
||||
import { WRITE_TODOS_TOOL_NAME } from './tool-names.js';
|
||||
@@ -79,13 +80,6 @@ The agent did not use the todo list because this task could be completed by a ti
|
||||
</example>
|
||||
`;
|
||||
|
||||
export type TodoStatus = 'pending' | 'in_progress' | 'completed' | 'cancelled';
|
||||
|
||||
export interface Todo {
|
||||
description: string;
|
||||
status: TodoStatus;
|
||||
}
|
||||
|
||||
export interface WriteTodosToolParams {
|
||||
/**
|
||||
* The full list of todos. This will overwrite any existing list.
|
||||
@@ -123,7 +117,7 @@ class WriteTodosToolInvocation extends BaseToolInvocation<
|
||||
|
||||
return {
|
||||
llmContent,
|
||||
returnDisplay: llmContent,
|
||||
returnDisplay: { todos },
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user