/** * @license * Copyright 2026 Google LLC * SPDX-License-Identifier: Apache-2.0 */ import { Box, Text } from 'ink'; import type React from 'react'; import { theme } from '../semantic-colors.js'; import type { RadioSelectItem } from './shared/RadioButtonSelect.js'; import { RadioButtonSelect } from './shared/RadioButtonSelect.js'; import { useKeypress } from '../hooks/useKeypress.js'; export enum PolicyUpdateChoice { ACCEPT = 'accept', IGNORE = 'ignore', } interface PolicyUpdateDialogProps { onSelect: (choice: PolicyUpdateChoice) => void; scope: string; identifier: string; isRestarting?: boolean; } export const PolicyUpdateDialog: React.FC = ({ onSelect, scope, identifier, isRestarting, }) => { useKeypress( (key) => { if (key.name === 'escape') { onSelect(PolicyUpdateChoice.IGNORE); return true; } return false; }, { isActive: !isRestarting }, ); const options: Array> = [ { label: 'Accept and Load (Requires Restart)', value: PolicyUpdateChoice.ACCEPT, key: 'accept', }, { label: 'Ignore (Use Default Policies)', value: PolicyUpdateChoice.IGNORE, key: 'ignore', }, ]; return ( New or changed {scope} policies detected Location: {identifier} Do you want to accept and load these policies? {isRestarting && ( Gemini CLI is restarting to apply the policy changes... )} ); };