mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-21 02:24:09 -07:00
refactor(core): consolidate execute() arguments into ExecuteOptions (#25101)
This commit is contained in:
@@ -23,7 +23,12 @@ import {
|
||||
TRACKER_UPDATE_TASK_TOOL_NAME,
|
||||
TRACKER_VISUALIZE_TOOL_NAME,
|
||||
} from './tool-names.js';
|
||||
import type { ToolResult, TodoList, TodoStatus } from './tools.js';
|
||||
import type {
|
||||
ToolResult,
|
||||
TodoList,
|
||||
TodoStatus,
|
||||
ExecuteOptions,
|
||||
} from './tools.js';
|
||||
import { BaseDeclarativeTool, BaseToolInvocation, Kind } from './tools.js';
|
||||
import { ToolErrorType } from './tool-error.js';
|
||||
import type { TrackerTask, TaskType } from '../services/trackerTypes.js';
|
||||
@@ -135,7 +140,9 @@ class TrackerCreateTaskInvocation extends BaseToolInvocation<
|
||||
return `Creating task: ${this.params.title}`;
|
||||
}
|
||||
|
||||
override async execute(_signal: AbortSignal): Promise<ToolResult> {
|
||||
override async execute({
|
||||
abortSignal: _signal,
|
||||
}: ExecuteOptions): Promise<ToolResult> {
|
||||
try {
|
||||
const task = await this.service.createTask({
|
||||
title: this.params.title,
|
||||
@@ -225,7 +232,9 @@ class TrackerUpdateTaskInvocation extends BaseToolInvocation<
|
||||
return `Updating task ${this.params.id}`;
|
||||
}
|
||||
|
||||
override async execute(_signal: AbortSignal): Promise<ToolResult> {
|
||||
override async execute({
|
||||
abortSignal: _signal,
|
||||
}: ExecuteOptions): Promise<ToolResult> {
|
||||
const { id, ...updates } = this.params;
|
||||
try {
|
||||
const task = await this.service.updateTask(id, updates);
|
||||
@@ -305,7 +314,9 @@ class TrackerGetTaskInvocation extends BaseToolInvocation<
|
||||
return `Retrieving task ${this.params.id}`;
|
||||
}
|
||||
|
||||
override async execute(_signal: AbortSignal): Promise<ToolResult> {
|
||||
override async execute({
|
||||
abortSignal: _signal,
|
||||
}: ExecuteOptions): Promise<ToolResult> {
|
||||
const task = await this.service.getTask(this.params.id);
|
||||
if (!task) {
|
||||
return {
|
||||
@@ -379,7 +390,9 @@ class TrackerListTasksInvocation extends BaseToolInvocation<
|
||||
return 'Listing tasks.';
|
||||
}
|
||||
|
||||
override async execute(_signal: AbortSignal): Promise<ToolResult> {
|
||||
override async execute({
|
||||
abortSignal: _signal,
|
||||
}: ExecuteOptions): Promise<ToolResult> {
|
||||
let tasks = await this.service.listTasks();
|
||||
if (this.params.status) {
|
||||
tasks = tasks.filter((t) => t.status === this.params.status);
|
||||
@@ -466,7 +479,9 @@ class TrackerAddDependencyInvocation extends BaseToolInvocation<
|
||||
return `Adding dependency: ${this.params.taskId} depends on ${this.params.dependencyId}`;
|
||||
}
|
||||
|
||||
override async execute(_signal: AbortSignal): Promise<ToolResult> {
|
||||
override async execute({
|
||||
abortSignal: _signal,
|
||||
}: ExecuteOptions): Promise<ToolResult> {
|
||||
if (this.params.taskId === this.params.dependencyId) {
|
||||
return {
|
||||
llmContent: `Error: Task ${this.params.taskId} cannot depend on itself.`,
|
||||
@@ -576,7 +591,9 @@ class TrackerVisualizeInvocation extends BaseToolInvocation<
|
||||
return 'Visualizing the task graph.';
|
||||
}
|
||||
|
||||
override async execute(_signal: AbortSignal): Promise<ToolResult> {
|
||||
override async execute({
|
||||
abortSignal: _signal,
|
||||
}: ExecuteOptions): Promise<ToolResult> {
|
||||
const tasks = await this.service.listTasks();
|
||||
if (tasks.length === 0) {
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user