mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-20 10:10:56 -07:00
feat(cli): resume session after CLI restart/relaunch
This commit is contained in:
@@ -791,7 +791,7 @@ export const AppContainer = (props: AppContainerProps) => {
|
||||
Logging in with Google... Restarting Gemini CLI to continue.
|
||||
----------------------------------------------------------------
|
||||
`);
|
||||
await relaunchApp();
|
||||
await relaunchApp(config.getSessionId());
|
||||
}
|
||||
}
|
||||
setAuthState(AuthState.Authenticated);
|
||||
@@ -2466,7 +2466,7 @@ Logging in with Google... Restarting Gemini CLI to continue.
|
||||
});
|
||||
}
|
||||
}
|
||||
await relaunchApp();
|
||||
await relaunchApp(config.getSessionId());
|
||||
},
|
||||
handleNewAgentsSelect: async (choice: NewAgentsChoice) => {
|
||||
if (newAgents && choice === NewAgentsChoice.ACKNOWLEDGE) {
|
||||
|
||||
@@ -35,7 +35,7 @@ export const LoginWithGoogleRestartDialog = ({
|
||||
});
|
||||
}
|
||||
}
|
||||
await relaunchApp();
|
||||
await relaunchApp(config.getSessionId());
|
||||
}, 100);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -230,7 +230,7 @@ export const DialogManager = ({
|
||||
<Box flexDirection="column">
|
||||
<SettingsDialog
|
||||
onSelect={() => uiActions.closeSettingsDialog()}
|
||||
onRestartRequest={relaunchApp}
|
||||
onRestartRequest={() => relaunchApp(config.getSessionId())}
|
||||
availableTerminalHeight={terminalHeight - staticExtraHeight}
|
||||
/>
|
||||
</Box>
|
||||
|
||||
@@ -8,6 +8,7 @@ import { Box, Text } from 'ink';
|
||||
import { theme } from '../semantic-colors.js';
|
||||
import { useKeypress } from '../hooks/useKeypress.js';
|
||||
import { relaunchApp } from '../../utils/processUtils.js';
|
||||
import { useConfig } from '../contexts/ConfigContext.js';
|
||||
import { type RestartReason } from '../hooks/useIdeTrustListener.js';
|
||||
import { debugLogger } from '@google/gemini-cli-core';
|
||||
|
||||
@@ -16,11 +17,12 @@ interface IdeTrustChangeDialogProps {
|
||||
}
|
||||
|
||||
export const IdeTrustChangeDialog = ({ reason }: IdeTrustChangeDialogProps) => {
|
||||
const config = useConfig();
|
||||
useKeypress(
|
||||
(key) => {
|
||||
if (key.name === 'r' || key.name === 'R') {
|
||||
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
||||
relaunchApp();
|
||||
relaunchApp(config.getSessionId());
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
@@ -11,6 +11,7 @@ import * as path from 'node:path';
|
||||
import { TrustLevel } from '../../config/trustedFolders.js';
|
||||
import { useKeypress } from '../hooks/useKeypress.js';
|
||||
import { usePermissionsModifyTrust } from '../hooks/usePermissionsModifyTrust.js';
|
||||
import { useConfig } from '../contexts/ConfigContext.js';
|
||||
import { theme } from '../semantic-colors.js';
|
||||
import { RadioButtonSelect } from './shared/RadioButtonSelect.js';
|
||||
import { relaunchApp } from '../../utils/processUtils.js';
|
||||
@@ -33,6 +34,7 @@ export function PermissionsModifyTrustDialog({
|
||||
const currentDirectory = targetDirectory ?? process.cwd();
|
||||
const dirName = path.basename(currentDirectory);
|
||||
const parentFolder = path.basename(path.dirname(currentDirectory));
|
||||
const config = useConfig();
|
||||
|
||||
const TRUST_LEVEL_ITEMS = [
|
||||
{
|
||||
@@ -72,7 +74,7 @@ export function PermissionsModifyTrustDialog({
|
||||
void (async () => {
|
||||
const success = await commitTrustLevelChange();
|
||||
if (success) {
|
||||
void relaunchApp();
|
||||
void relaunchApp(config.getSessionId());
|
||||
} else {
|
||||
onExit();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user