mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-24 12:04:56 -07:00
fix(hooks): support 'ask' decision for BeforeTool hooks (#21146)
This commit is contained in:
committed by
GitHub
parent
d3766875f8
commit
d1dc4902fd
@@ -115,10 +115,25 @@ export class ToolExecutor {
|
||||
{ shellExecutionConfig, setExecutionIdCallback },
|
||||
this.config,
|
||||
request.originalRequestName,
|
||||
true, // skipBeforeHook
|
||||
);
|
||||
|
||||
const toolResult: ToolResult = await promise;
|
||||
|
||||
if (call.request.inputModifiedByHook) {
|
||||
const modificationMsg = `\n\n[System] Tool input parameters were modified by a hook before execution.`;
|
||||
if (typeof toolResult.llmContent === 'string') {
|
||||
toolResult.llmContent += modificationMsg;
|
||||
} else if (Array.isArray(toolResult.llmContent)) {
|
||||
toolResult.llmContent.push({ text: modificationMsg });
|
||||
} else if (toolResult.llmContent) {
|
||||
toolResult.llmContent = [
|
||||
toolResult.llmContent,
|
||||
{ text: modificationMsg },
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
if (signal.aborted) {
|
||||
completedToolCall = await this.createCancelledResult(
|
||||
call,
|
||||
|
||||
Reference in New Issue
Block a user