mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-03-16 00:51:25 -07:00
Remove unused modelHooks and toolHooks (#17115)
Co-authored-by: Tommaso Sciortino <sciortino@gmail.com>
This commit is contained in:
@@ -27,15 +27,56 @@ import type { AggregatedHookResult } from './hookAggregator.js';
|
||||
import type {
|
||||
GenerateContentParameters,
|
||||
GenerateContentResponse,
|
||||
GenerateContentConfig,
|
||||
ContentListUnion,
|
||||
ToolConfig,
|
||||
ToolListUnion,
|
||||
} from '@google/genai';
|
||||
import type {
|
||||
AfterModelHookResult,
|
||||
BeforeModelHookResult,
|
||||
BeforeToolSelectionHookResult,
|
||||
} from '../core/geminiChatHookTriggers.js';
|
||||
|
||||
/**
|
||||
* Main hook system that coordinates all hook-related functionality
|
||||
*/
|
||||
|
||||
export interface BeforeModelHookResult {
|
||||
/** Whether the model call was blocked */
|
||||
blocked: boolean;
|
||||
/** Whether the execution should be stopped entirely */
|
||||
stopped?: boolean;
|
||||
/** Reason for blocking (if blocked) */
|
||||
reason?: string;
|
||||
/** Synthetic response to return instead of calling the model (if blocked) */
|
||||
syntheticResponse?: GenerateContentResponse;
|
||||
/** Modified config (if not blocked) */
|
||||
modifiedConfig?: GenerateContentConfig;
|
||||
/** Modified contents (if not blocked) */
|
||||
modifiedContents?: ContentListUnion;
|
||||
}
|
||||
|
||||
/**
|
||||
* Result from firing the BeforeToolSelection hook.
|
||||
*/
|
||||
export interface BeforeToolSelectionHookResult {
|
||||
/** Modified tool config */
|
||||
toolConfig?: ToolConfig;
|
||||
/** Modified tools */
|
||||
tools?: ToolListUnion;
|
||||
}
|
||||
|
||||
/**
|
||||
* Result from firing the AfterModel hook.
|
||||
* Contains either a modified response or indicates to use the original chunk.
|
||||
*/
|
||||
export interface AfterModelHookResult {
|
||||
/** The response to yield (either modified or original) */
|
||||
response: GenerateContentResponse;
|
||||
/** Whether the execution should be stopped entirely */
|
||||
stopped?: boolean;
|
||||
/** Whether the model call was blocked */
|
||||
blocked?: boolean;
|
||||
/** Reason for blocking or stopping */
|
||||
reason?: string;
|
||||
}
|
||||
|
||||
export class HookSystem {
|
||||
private readonly hookRegistry: HookRegistry;
|
||||
private readonly hookRunner: HookRunner;
|
||||
|
||||
Reference in New Issue
Block a user