mirror of
https://github.com/QwenLM/qwen-code.git
synced 2025-12-20 08:47:44 +00:00
Migrate EditTool, GrepTool, and GlobTool to DeclarativeTool (#5744)
This commit is contained in:
@@ -53,6 +53,34 @@ export interface ToolInvocation<
|
||||
): Promise<TResult>;
|
||||
}
|
||||
|
||||
/**
|
||||
* A convenience base class for ToolInvocation.
|
||||
*/
|
||||
export abstract class BaseToolInvocation<
|
||||
TParams extends object,
|
||||
TResult extends ToolResult,
|
||||
> implements ToolInvocation<TParams, TResult>
|
||||
{
|
||||
constructor(readonly params: TParams) {}
|
||||
|
||||
abstract getDescription(): string;
|
||||
|
||||
toolLocations(): ToolLocation[] {
|
||||
return [];
|
||||
}
|
||||
|
||||
shouldConfirmExecute(
|
||||
_abortSignal: AbortSignal,
|
||||
): Promise<ToolCallConfirmationDetails | false> {
|
||||
return Promise.resolve(false);
|
||||
}
|
||||
|
||||
abstract execute(
|
||||
signal: AbortSignal,
|
||||
updateOutput?: (output: string) => void,
|
||||
): Promise<TResult>;
|
||||
}
|
||||
|
||||
/**
|
||||
* A type alias for a tool invocation where the specific parameter and result types are not known.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user