mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-06-12 12:26:57 -07:00
refactor(core): unify InjectionService API to single onInjection interface
Remove legacy onUserHint/offUserHint/addUserHint methods. All callers now use addInjection(text, source) and onInjection/offInjection with source-based filtering where needed.
This commit is contained in:
@@ -85,6 +85,7 @@ import {
|
||||
buildUserSteeringHintPrompt,
|
||||
logBillingEvent,
|
||||
ApiKeyUpdatedEvent,
|
||||
type InjectionSource,
|
||||
} from '@google/gemini-cli-core';
|
||||
import { validateAuthMethod } from '../config/auth.js';
|
||||
import process from 'node:process';
|
||||
@@ -1089,13 +1090,16 @@ Logging in with Google... Restarting Gemini CLI to continue.
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
const hintListener = (hint: string) => {
|
||||
pendingHintsRef.current.push(hint);
|
||||
const hintListener = (text: string, source: InjectionSource) => {
|
||||
if (source !== 'user_steering') {
|
||||
return;
|
||||
}
|
||||
pendingHintsRef.current.push(text);
|
||||
setPendingHintCount((prev) => prev + 1);
|
||||
};
|
||||
config.injectionService.onUserHint(hintListener);
|
||||
config.injectionService.onInjection(hintListener);
|
||||
return () => {
|
||||
config.injectionService.offUserHint(hintListener);
|
||||
config.injectionService.offInjection(hintListener);
|
||||
};
|
||||
}, [config]);
|
||||
|
||||
@@ -1259,7 +1263,7 @@ Logging in with Google... Restarting Gemini CLI to continue.
|
||||
if (!trimmed) {
|
||||
return;
|
||||
}
|
||||
config.injectionService.addUserHint(trimmed);
|
||||
config.injectionService.addInjection(trimmed, 'user_steering');
|
||||
// Render hints with a distinct style.
|
||||
historyManager.addItem({
|
||||
type: 'hint',
|
||||
|
||||
Reference in New Issue
Block a user