mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-03-12 15:10:59 -07:00
fix(patch): cherry-pick ee6556c to release/v0.21.0-preview.1-pr-14691 to patch version v0.21.0-preview.1 and create version 0.21.0-preview.2 (#14908)
Co-authored-by: Jack Wotherspoon <jackwoth@google.com>
This commit is contained in:
@@ -498,6 +498,20 @@ export async function main() {
|
||||
|
||||
// Handle --list-sessions flag
|
||||
if (config.getListSessions()) {
|
||||
// Attempt auth for summary generation (gracefully skips if not configured)
|
||||
const authType = settings.merged.security?.auth?.selectedType;
|
||||
if (authType) {
|
||||
try {
|
||||
await config.refreshAuth(authType);
|
||||
} catch (e) {
|
||||
// Auth failed - continue without summary generation capability
|
||||
debugLogger.debug(
|
||||
'Auth failed for --list-sessions, summaries may not be generated:',
|
||||
e,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
await listSessions(config);
|
||||
await runExitCleanup();
|
||||
process.exit(ExitCodes.SUCCESS);
|
||||
|
||||
@@ -63,7 +63,7 @@ import {
|
||||
SessionEndReason,
|
||||
fireSessionStartHook,
|
||||
fireSessionEndHook,
|
||||
generateAndSaveSummary,
|
||||
generateSummary,
|
||||
} from '@google/gemini-cli-core';
|
||||
import { validateAuthMethod } from '../config/auth.js';
|
||||
import process from 'node:process';
|
||||
@@ -312,9 +312,13 @@ export const AppContainer = (props: AppContainerProps) => {
|
||||
: SessionStartSource.Startup;
|
||||
await fireSessionStartHook(hookMessageBus, sessionStartSource);
|
||||
}
|
||||
|
||||
// Fire-and-forget: generate summary for previous session in background
|
||||
generateSummary(config).catch((e) => {
|
||||
debugLogger.warn('Background summary generation failed:', e);
|
||||
});
|
||||
})();
|
||||
registerCleanup(async () => {
|
||||
await generateAndSaveSummary(config);
|
||||
// Turn off mouse scroll.
|
||||
disableMouseEvents();
|
||||
const ideClient = await IdeClient.getInstance();
|
||||
|
||||
@@ -21,6 +21,7 @@ vi.mock('@google/gemini-cli-core', async () => {
|
||||
return {
|
||||
...actual,
|
||||
ChatRecordingService: vi.fn(),
|
||||
generateSummary: vi.fn().mockResolvedValue(undefined),
|
||||
};
|
||||
});
|
||||
|
||||
|
||||
@@ -4,7 +4,11 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
import { ChatRecordingService, type Config } from '@google/gemini-cli-core';
|
||||
import {
|
||||
ChatRecordingService,
|
||||
generateSummary,
|
||||
type Config,
|
||||
} from '@google/gemini-cli-core';
|
||||
import {
|
||||
formatRelativeTime,
|
||||
SessionSelector,
|
||||
@@ -12,6 +16,9 @@ import {
|
||||
} from './sessionUtils.js';
|
||||
|
||||
export async function listSessions(config: Config): Promise<void> {
|
||||
// Generate summary for most recent session if needed
|
||||
await generateSummary(config);
|
||||
|
||||
const sessionSelector = new SessionSelector(config);
|
||||
const sessions = await sessionSelector.listSessions();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user