mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-16 16:21:27 -07:00
refactor(core): consolidate execute() arguments into ExecuteOptions (#25101)
This commit is contained in:
@@ -60,7 +60,9 @@ describe('SdkTool Execution', () => {
|
||||
mockMessageBus,
|
||||
undefined,
|
||||
);
|
||||
const result = await invocation.execute(new AbortController().signal);
|
||||
const result = await invocation.execute({
|
||||
abortSignal: new AbortController().signal,
|
||||
});
|
||||
|
||||
expect(result.llmContent).toBe('Success: test');
|
||||
expect(result.error).toBeUndefined();
|
||||
@@ -86,7 +88,7 @@ describe('SdkTool Execution', () => {
|
||||
);
|
||||
|
||||
await expect(
|
||||
invocation.execute(new AbortController().signal),
|
||||
invocation.execute({ abortSignal: new AbortController().signal }),
|
||||
).rejects.toThrow('Standard error');
|
||||
});
|
||||
|
||||
@@ -108,7 +110,9 @@ describe('SdkTool Execution', () => {
|
||||
mockMessageBus,
|
||||
undefined,
|
||||
);
|
||||
const result = await invocation.execute(new AbortController().signal);
|
||||
const result = await invocation.execute({
|
||||
abortSignal: new AbortController().signal,
|
||||
});
|
||||
|
||||
expect(result.error).toBeDefined();
|
||||
expect(result.error?.message).toBe('Visible error');
|
||||
@@ -134,7 +138,9 @@ describe('SdkTool Execution', () => {
|
||||
mockMessageBus,
|
||||
undefined,
|
||||
);
|
||||
const result = await invocation.execute(new AbortController().signal);
|
||||
const result = await invocation.execute({
|
||||
abortSignal: new AbortController().signal,
|
||||
});
|
||||
|
||||
expect(result.error).toBeDefined();
|
||||
expect(result.error?.message).toBe('Standard error');
|
||||
|
||||
@@ -11,6 +11,7 @@ import {
|
||||
BaseToolInvocation,
|
||||
type ToolResult,
|
||||
type ToolInvocation,
|
||||
type ExecuteOptions,
|
||||
Kind,
|
||||
type MessageBus,
|
||||
} from '@google/gemini-cli-core';
|
||||
@@ -58,10 +59,10 @@ class SdkToolInvocation<T extends z.ZodTypeAny> extends BaseToolInvocation<
|
||||
return `Executing ${this._toolName}...`;
|
||||
}
|
||||
|
||||
async execute(
|
||||
_signal: AbortSignal,
|
||||
_updateOutput?: (output: string) => void,
|
||||
): Promise<ToolResult> {
|
||||
async execute({
|
||||
abortSignal: _abortSignal,
|
||||
updateOutput: _updateOutput,
|
||||
}: ExecuteOptions): Promise<ToolResult> {
|
||||
try {
|
||||
const result = await this.action(this.params, this.context);
|
||||
const output =
|
||||
|
||||
Reference in New Issue
Block a user