@google/gemini-cli-core 0.7.0-preview.1 → 0.7.1-reland
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +2 -3
- package/dist/index.js +2 -3
- package/dist/index.js.map +1 -1
- package/dist/src/config/config.d.ts +0 -7
- package/dist/src/config/config.js +1 -29
- package/dist/src/config/config.js.map +1 -1
- package/dist/src/core/client.js +2 -1
- package/dist/src/core/client.js.map +1 -1
- package/dist/src/core/client.test.js +39 -0
- package/dist/src/core/client.test.js.map +1 -1
- package/dist/src/core/coreToolScheduler.js +3 -12
- package/dist/src/core/coreToolScheduler.js.map +1 -1
- package/dist/src/core/coreToolScheduler.test.js +0 -99
- package/dist/src/core/coreToolScheduler.test.js.map +1 -1
- package/dist/src/core/geminiChat.d.ts +3 -4
- package/dist/src/core/geminiChat.js +52 -44
- package/dist/src/core/geminiChat.js.map +1 -1
- package/dist/src/core/geminiChat.test.js +26 -115
- package/dist/src/core/geminiChat.test.js.map +1 -1
- package/dist/src/generated/git-commit.d.ts +2 -2
- package/dist/src/generated/git-commit.js +2 -2
- package/dist/src/generated/git-commit.js.map +1 -1
- package/dist/src/ide/detect-ide.d.ts +2 -4
- package/dist/src/ide/detect-ide.js +1 -7
- package/dist/src/ide/detect-ide.js.map +1 -1
- package/dist/src/ide/detect-ide.test.js +0 -23
- package/dist/src/ide/detect-ide.test.js.map +1 -1
- package/dist/src/ide/ide-client.d.ts +1 -2
- package/dist/src/ide/ide-client.js +17 -22
- package/dist/src/ide/ide-client.js.map +1 -1
- package/dist/src/ide/ide-client.test.js +2 -2
- package/dist/src/ide/ide-client.test.js.map +1 -1
- package/dist/src/index.d.ts +0 -1
- package/dist/src/index.js +0 -1
- package/dist/src/index.js.map +1 -1
- package/dist/src/routing/strategies/compositeStrategy.js +3 -4
- package/dist/src/routing/strategies/compositeStrategy.js.map +1 -1
- package/dist/src/telemetry/clearcut-logger/clearcut-logger.d.ts +2 -6
- package/dist/src/telemetry/clearcut-logger/clearcut-logger.js +0 -34
- package/dist/src/telemetry/clearcut-logger/clearcut-logger.js.map +1 -1
- package/dist/src/telemetry/clearcut-logger/event-metadata-key.d.ts +1 -3
- package/dist/src/telemetry/clearcut-logger/event-metadata-key.js +0 -4
- package/dist/src/telemetry/clearcut-logger/event-metadata-key.js.map +1 -1
- package/dist/src/telemetry/constants.d.ts +0 -3
- package/dist/src/telemetry/constants.js +0 -3
- package/dist/src/telemetry/constants.js.map +1 -1
- package/dist/src/telemetry/index.d.ts +1 -2
- package/dist/src/telemetry/index.js +1 -2
- package/dist/src/telemetry/index.js.map +1 -1
- package/dist/src/telemetry/loggers.d.ts +1 -3
- package/dist/src/telemetry/loggers.js +2 -36
- package/dist/src/telemetry/loggers.js.map +1 -1
- package/dist/src/telemetry/loggers.test.js +3 -31
- package/dist/src/telemetry/loggers.test.js.map +1 -1
- package/dist/src/telemetry/metrics.d.ts +1 -2
- package/dist/src/telemetry/metrics.js +1 -14
- package/dist/src/telemetry/metrics.js.map +1 -1
- package/dist/src/telemetry/sdk.js +1 -4
- package/dist/src/telemetry/sdk.js.map +1 -1
- package/dist/src/telemetry/sdk.test.js +0 -13
- package/dist/src/telemetry/sdk.test.js.map +1 -1
- package/dist/src/telemetry/types.d.ts +3 -18
- package/dist/src/telemetry/types.js +2 -28
- package/dist/src/telemetry/types.js.map +1 -1
- package/dist/src/tools/edit.js +0 -6
- package/dist/src/tools/edit.js.map +1 -1
- package/dist/src/tools/edit.test.js +0 -41
- package/dist/src/tools/edit.test.js.map +1 -1
- package/dist/src/tools/mcp-tool.js +2 -30
- package/dist/src/tools/mcp-tool.js.map +1 -1
- package/dist/src/tools/mcp-tool.test.js +0 -117
- package/dist/src/tools/mcp-tool.test.js.map +1 -1
- package/dist/src/tools/ripGrep.js +1 -1
- package/dist/src/tools/ripGrep.js.map +1 -1
- package/dist/src/tools/ripGrep.test.js +2 -2
- package/dist/src/tools/ripGrep.test.js.map +1 -1
- package/dist/src/tools/smart-edit.js +0 -6
- package/dist/src/tools/smart-edit.js.map +1 -1
- package/dist/src/tools/smart-edit.test.js +0 -45
- package/dist/src/tools/smart-edit.test.js.map +1 -1
- package/dist/src/tools/tools.d.ts +3 -11
- package/dist/src/tools/tools.js +3 -94
- package/dist/src/tools/tools.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/dist/src/telemetry/config.d.ts +0 -31
- package/dist/src/telemetry/config.js +0 -76
- package/dist/src/telemetry/config.js.map +0 -1
- package/dist/src/telemetry/config.test.d.ts +0 -6
- package/dist/src/telemetry/config.test.js +0 -124
- package/dist/src/telemetry/config.test.js.map +0 -1
- package/dist/src/tools/message-bus-integration.test.d.ts +0 -6
- package/dist/src/tools/message-bus-integration.test.js +0 -183
- package/dist/src/tools/message-bus-integration.test.js.map +0 -1
- package/dist/src/tools/write-todos.d.ts +0 -25
- package/dist/src/tools/write-todos.js +0 -150
- package/dist/src/tools/write-todos.js.map +0 -1
- package/dist/src/tools/write-todos.test.d.ts +0 -6
- package/dist/src/tools/write-todos.test.js +0 -89
- package/dist/src/tools/write-todos.test.js.map +0 -1
|
@@ -1,150 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright 2025 Google LLC
|
|
4
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
-
*/
|
|
6
|
-
import { BaseDeclarativeTool, BaseToolInvocation, Kind, } from './tools.js';
|
|
7
|
-
// Insprired by langchain/deepagents.
|
|
8
|
-
export const WRITE_TODOS_DESCRIPTION = `This tool can help you list out the current subtasks that are required to be completed for a given user request. The list of subtasks helps you keep track of the current task, organize complex queries and help ensure that you don't miss any steps. With this list, the user can also see the current progress you are making in executing a given task.
|
|
9
|
-
|
|
10
|
-
Depending on the task complexity, you should first divide a given task into subtasks and then use this tool to list out the subtasks that are required to be completed for a given user request.
|
|
11
|
-
Each of the subtasks should be clear and distinct.
|
|
12
|
-
|
|
13
|
-
Use this tool for complex queries that require multiple steps. If you find that the request is actually complex after you have started executing the user task, create a todo list and use it. If execution of the user task requires multiple steps, planning and generally is higher complexity than a simple Q&A, use this tool.
|
|
14
|
-
|
|
15
|
-
DO NOT use this tool for simple tasks that can be completed in less than 2 steps. If the user query is simple and straightforward, do not use the tool. If you can respond with an answer in a single turn then this tool is not required.
|
|
16
|
-
|
|
17
|
-
## Task state definitions
|
|
18
|
-
|
|
19
|
-
- pending: Work has not begun on a given subtask.
|
|
20
|
-
- in_progress: Marked just prior to beginning work on a given subtask. You should only have one subtask as in_progress at a time.
|
|
21
|
-
- completed: Subtask was succesfully completed with no errors or issues. If the subtask required more steps to complete, update the todo list with the subtasks. All steps should be identified as completed only when they are completed.
|
|
22
|
-
- cancelled: As you update the todo list, some tasks are not required anymore due to the dynamic nature of the task. In this case, mark the subtasks as cancelled.
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
## Methodology for using this tool
|
|
26
|
-
1. Use this todo list list as soon as you receive a user request based on the complexity of the task.
|
|
27
|
-
2. Keep track of every subtask that you update the list with.
|
|
28
|
-
3. Mark a subtask as in_progress before you begin working on it. You should only have one subtask as in_progress at a time.
|
|
29
|
-
4. Update the subtask list as you proceed in executing the task. The subtask list is not static and should reflect your progress and current plans, which may evolve as you acquire new information.
|
|
30
|
-
5. Mark a subtask as completed when you have completed it.
|
|
31
|
-
6. Mark a subtask as cancelled if the subtask is no longer needed.
|
|
32
|
-
7. You must update the todo list as soon as you start, stop or cancel a subtask. Don't batch or wait to update the todo list.
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
## Examples of When to Use the Todo List
|
|
36
|
-
|
|
37
|
-
<example>
|
|
38
|
-
User request: Create a website with a React for creating fancy logos using gemini-2.5-flash-image
|
|
39
|
-
|
|
40
|
-
ToDo list created by the agent:
|
|
41
|
-
1. Initialize a new React project environment (e.g., using Vite).
|
|
42
|
-
2. Design and build the core UI components: a text input (prompt field) for the logo description, selection controls for style parameters (if the API supports them), and an image preview area.
|
|
43
|
-
3. Implement state management (e.g., React Context or Zustand) to manage the user's input prompt, the API loading status (pending, success, error), and the resulting image data.
|
|
44
|
-
4. Create an API service module within the React app (using "fetch" or "axios") to securely format and send the prompt data via an HTTP POST request to the specified "gemini-2.5-flash-image" (Gemini model) endpoint.
|
|
45
|
-
5. Implement asynchronous logic to handle the API call: show a loading indicator while the request is pending, retrieve the generated image (e.g., as a URL or base64 string) upon success, and display any errors.
|
|
46
|
-
6. Display the returned "fancy logo" from the API response in the preview area component.
|
|
47
|
-
7. Add functionality (e.g., a "Download" button) to allow the user to save the generated image file.
|
|
48
|
-
8. Deploy the application to a web server or hosting platform.
|
|
49
|
-
|
|
50
|
-
<reasoning>
|
|
51
|
-
The agent used the todo list to break the task into distinct, manageable steps:
|
|
52
|
-
1. Building an entire interactive web application from scratch is a highly complex, multi-stage process involving setup, UI development, logic integration, and deployment.
|
|
53
|
-
2. The agent inferred the core functionality required for a "logo creator," such as UI controls for customization (Task 3) and an export feature (Task 7), which must be tracked as distinct goals.
|
|
54
|
-
3. The agent rightly inferred the requirement of an API service model for interacting with the image model endpoint.
|
|
55
|
-
</reasoning>
|
|
56
|
-
</example>
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
## Examples of When NOT to Use the Todo List
|
|
60
|
-
|
|
61
|
-
<example>
|
|
62
|
-
User request: Ensure that the test <test file> passes.
|
|
63
|
-
|
|
64
|
-
Agent:
|
|
65
|
-
<Goes into a loop of running the test, identifying errors, and updating the code until the test passes.>
|
|
66
|
-
|
|
67
|
-
<reasoning>
|
|
68
|
-
The agent did not use the todo list because this task could be completed by a tight loop of execute test->edit->execute test.
|
|
69
|
-
</reasoning>
|
|
70
|
-
</example>
|
|
71
|
-
`;
|
|
72
|
-
class WriteTodosToolInvocation extends BaseToolInvocation {
|
|
73
|
-
getDescription() {
|
|
74
|
-
const count = this.params.todos?.length ?? 0;
|
|
75
|
-
if (count === 0) {
|
|
76
|
-
return 'Cleared todo list';
|
|
77
|
-
}
|
|
78
|
-
return `Set ${count} todo(s)`;
|
|
79
|
-
}
|
|
80
|
-
async execute(_signal, _updateOutput) {
|
|
81
|
-
const todos = this.params.todos ?? [];
|
|
82
|
-
const todoListString = todos
|
|
83
|
-
.map((todo, index) => `${index + 1}. [${todo.status}] ${todo.description}`)
|
|
84
|
-
.join('\n');
|
|
85
|
-
const llmContent = todos.length > 0
|
|
86
|
-
? `Successfully updated the todo list. The current list is now:\n${todoListString}`
|
|
87
|
-
: 'Successfully cleared the todo list.';
|
|
88
|
-
return {
|
|
89
|
-
llmContent,
|
|
90
|
-
returnDisplay: llmContent,
|
|
91
|
-
};
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
export class WriteTodosTool extends BaseDeclarativeTool {
|
|
95
|
-
static Name = 'write_todos_list';
|
|
96
|
-
constructor() {
|
|
97
|
-
super(WriteTodosTool.Name, 'Write Todos', WRITE_TODOS_DESCRIPTION, Kind.Other, {
|
|
98
|
-
type: 'object',
|
|
99
|
-
properties: {
|
|
100
|
-
todos: {
|
|
101
|
-
type: 'array',
|
|
102
|
-
description: 'The complete list of todo items. This will replace the existing list.',
|
|
103
|
-
items: {
|
|
104
|
-
type: 'object',
|
|
105
|
-
description: 'A single todo item.',
|
|
106
|
-
properties: {
|
|
107
|
-
description: {
|
|
108
|
-
type: 'string',
|
|
109
|
-
description: 'The description of the task.',
|
|
110
|
-
},
|
|
111
|
-
status: {
|
|
112
|
-
type: 'string',
|
|
113
|
-
description: 'The current status of the task.',
|
|
114
|
-
enum: ['pending', 'in_progress', 'completed'],
|
|
115
|
-
},
|
|
116
|
-
},
|
|
117
|
-
required: ['description', 'status'],
|
|
118
|
-
},
|
|
119
|
-
},
|
|
120
|
-
},
|
|
121
|
-
required: ['todos'],
|
|
122
|
-
});
|
|
123
|
-
}
|
|
124
|
-
validateToolParamValues(params) {
|
|
125
|
-
const todos = params?.todos;
|
|
126
|
-
if (!params || !Array.isArray(todos)) {
|
|
127
|
-
return '`todos` parameter must be an array';
|
|
128
|
-
}
|
|
129
|
-
for (const todo of todos) {
|
|
130
|
-
if (typeof todo !== 'object' || todo === null) {
|
|
131
|
-
return 'Each todo item must be an object';
|
|
132
|
-
}
|
|
133
|
-
if (typeof todo.description !== 'string' || !todo.description.trim()) {
|
|
134
|
-
return 'Each todo must have a non-empty description string';
|
|
135
|
-
}
|
|
136
|
-
if (!['pending', 'in_progress', 'completed'].includes(todo.status)) {
|
|
137
|
-
return 'Each todo must have a valid status (pending, in_progress, or completed)';
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
const inProgressCount = todos.filter((todo) => todo.status === 'in_progress').length;
|
|
141
|
-
if (inProgressCount > 1) {
|
|
142
|
-
return 'Invalid parameters: Only one task can be "in_progress" at a time.';
|
|
143
|
-
}
|
|
144
|
-
return null;
|
|
145
|
-
}
|
|
146
|
-
createInvocation(params) {
|
|
147
|
-
return new WriteTodosToolInvocation(params);
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
//# sourceMappingURL=write-todos.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"write-todos.js","sourceRoot":"","sources":["../../../src/tools/write-todos.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EACL,mBAAmB,EACnB,kBAAkB,EAClB,IAAI,GAEL,MAAM,YAAY,CAAC;AAEpB,qCAAqC;AACrC,MAAM,CAAC,MAAM,uBAAuB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+DtC,CAAC;AAgBF,MAAM,wBAAyB,SAAQ,kBAGtC;IACC,cAAc;QACZ,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,MAAM,IAAI,CAAC,CAAC;QAC7C,IAAI,KAAK,KAAK,CAAC,EAAE,CAAC;YAChB,OAAO,mBAAmB,CAAC;QAC7B,CAAC;QACD,OAAO,OAAO,KAAK,UAAU,CAAC;IAChC,C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|
7
|
-
import { WriteTodosTool } from './write-todos.js';
|
|
8
|
-
describe('WriteTodosTool', () => {
|
|
9
|
-
const tool = new WriteTodosTool();
|
|
10
|
-
const signal = new AbortController().signal;
|
|
11
|
-
describe('validation', () => {
|
|
12
|
-
it('should not throw for valid parameters', async () => {
|
|
13
|
-
const params = {
|
|
14
|
-
todos: [
|
|
15
|
-
{ description: 'Task 1', status: 'pending' },
|
|
16
|
-
{ description: 'Task 2', status: 'in_progress' },
|
|
17
|
-
{ description: 'Task 3', status: 'completed' },
|
|
18
|
-
],
|
|
19
|
-
};
|
|
20
|
-
await expect(tool.buildAndExecute(params, signal)).resolves.toBeDefined();
|
|
21
|
-
});
|
|
22
|
-
it('should not throw for an empty list', async () => {
|
|
23
|
-
const params = {
|
|
24
|
-
todos: [],
|
|
25
|
-
};
|
|
26
|
-
await expect(tool.buildAndExecute(params, signal)).resolves.toBeDefined();
|
|
27
|
-
});
|
|
28
|
-
it('should throw an error if todos is not an array', async () => {
|
|
29
|
-
const params = {
|
|
30
|
-
todos: 'not-an-array',
|
|
31
|
-
};
|
|
32
|
-
await expect(tool.buildAndExecute(params, signal)).rejects.toThrow('params/todos must be array');
|
|
33
|
-
});
|
|
34
|
-
it('should throw an error if a todo item is not an object', async () => {
|
|
35
|
-
const params = {
|
|
36
|
-
todos: ['not-an-object'],
|
|
37
|
-
};
|
|
38
|
-
await expect(tool.buildAndExecute(params, signal)).rejects.toThrow('params/todos/0 must be object');
|
|
39
|
-
});
|
|
40
|
-
it('should throw an error if a todo description is missing or empty', async () => {
|
|
41
|
-
const params = {
|
|
42
|
-
todos: [{ description: ' ', status: 'pending' }],
|
|
43
|
-
};
|
|
44
|
-
await expect(tool.buildAndExecute(params, signal)).rejects.toThrow('Each todo must have a non-empty description string');
|
|
45
|
-
});
|
|
46
|
-
it('should throw an error if a todo status is invalid', async () => {
|
|
47
|
-
const params = {
|
|
48
|
-
todos: [{ description: 'Task 1', status: 'invalid-status' }],
|
|
49
|
-
};
|
|
50
|
-
await expect(tool.buildAndExecute(params, signal)).rejects.toThrow('params/todos/0/status must be equal to one of the allowed values');
|
|
51
|
-
});
|
|
52
|
-
it('should throw an error if more than one task is in_progress', async () => {
|
|
53
|
-
const params = {
|
|
54
|
-
todos: [
|
|
55
|
-
{ description: 'Task 1', status: 'in_progress' },
|
|
56
|
-
{ description: 'Task 2', status: 'in_progress' },
|
|
57
|
-
],
|
|
58
|
-
};
|
|
59
|
-
await expect(tool.buildAndExecute(params, signal)).rejects.toThrow('Invalid parameters: Only one task can be "in_progress" at a time.');
|
|
60
|
-
});
|
|
61
|
-
});
|
|
62
|
-
describe('execute', () => {
|
|
63
|
-
it('should return a success message for clearing the list', async () => {
|
|
64
|
-
const params = {
|
|
65
|
-
todos: [],
|
|
66
|
-
};
|
|
67
|
-
const result = await tool.buildAndExecute(params, signal);
|
|
68
|
-
expect(result.llmContent).toBe('Successfully cleared the todo list.');
|
|
69
|
-
expect(result.returnDisplay).toBe('Successfully cleared the todo list.');
|
|
70
|
-
});
|
|
71
|
-
it('should return a formatted todo list on success', async () => {
|
|
72
|
-
const params = {
|
|
73
|
-
todos: [
|
|
74
|
-
{ description: 'First task', status: 'completed' },
|
|
75
|
-
{ description: 'Second task', status: 'in_progress' },
|
|
76
|
-
{ description: 'Third task', status: 'pending' },
|
|
77
|
-
],
|
|
78
|
-
};
|
|
79
|
-
const result = await tool.buildAndExecute(params, signal);
|
|
80
|
-
const expectedOutput = `Successfully updated the todo list. The current list is now:
|
|
81
|
-
1. [completed] First task
|
|
82
|
-
2. [in_progress] Second task
|
|
83
|
-
3. [pending] Third task`;
|
|
84
|
-
expect(result.llmContent).toBe(expectedOutput);
|
|
85
|
-
expect(result.returnDisplay).toBe(expectedOutput);
|
|
86
|
-
});
|
|
87
|
-
});
|
|
88
|
-
});
|
|
89
|
-
//# sourceMappingURL=write-todos.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"write-todos.test.js","sourceRoot":"","sources":["../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