mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-07-08 09:06:48 -07:00
refactor(core): move background injection wiring from UI to backend
Wire ExecutionLifecycleService.setInjectionService() in Config constructor so backgrounded executions inject directly via settleExecution instead of routing through a useEffect bridge in AppContainer.
This commit is contained in:
@@ -85,8 +85,6 @@ import {
|
||||
buildUserSteeringHintPrompt,
|
||||
logBillingEvent,
|
||||
ApiKeyUpdatedEvent,
|
||||
ExecutionLifecycleService,
|
||||
type BackgroundCompletionInfo,
|
||||
type InjectionSource,
|
||||
} from '@google/gemini-cli-core';
|
||||
import { validateAuthMethod } from '../config/auth.js';
|
||||
@@ -1119,28 +1117,6 @@ Logging in with Google... Restarting Gemini CLI to continue.
|
||||
};
|
||||
}, [config]);
|
||||
|
||||
// Wire background completion events from ExecutionLifecycleService into the
|
||||
// injection service so completed backgrounded executions are reinjected.
|
||||
useEffect(() => {
|
||||
const bgListener = (info: BackgroundCompletionInfo) => {
|
||||
// Use the execution creator's custom injection text if provided.
|
||||
let text = info.injectionText;
|
||||
if (text === null || text === undefined) {
|
||||
// Fallback: generic format for executions without a custom formatter.
|
||||
const header = info.error
|
||||
? `[Background execution (ID: ${info.executionId}) completed with error: ${info.error.message}]`
|
||||
: `[Background execution (ID: ${info.executionId}) completed]`;
|
||||
const body = info.output ? `\n${info.output}` : '';
|
||||
text = `${header}${body}`;
|
||||
}
|
||||
config.injectionService.addInjection(text, 'background_completion');
|
||||
};
|
||||
ExecutionLifecycleService.onBackgroundComplete(bgListener);
|
||||
return () => {
|
||||
ExecutionLifecycleService.offBackgroundComplete(bgListener);
|
||||
};
|
||||
}, [config]);
|
||||
|
||||
const {
|
||||
streamingState,
|
||||
submitQuery,
|
||||
|
||||
Reference in New Issue
Block a user