import React from 'react' import { useExitOnCtrlCDWithKeybindings } from '../../hooks/useExitOnCtrlCDWithKeybindings.js' import { Box, Text } from '@anthropic/ink' import { useKeybinding } from '../../keybindings/useKeybinding.js' import type { SettingsJson } from '../../utils/settings/types.js' import { Select } from '../CustomSelect/index.js' import { PermissionDialog } from '../permissions/PermissionDialog.js' import { extractDangerousSettings, formatDangerousSettingsList, } from './utils.js' type Props = { settings: SettingsJson onAccept: () => void onReject: () => void } export function ManagedSettingsSecurityDialog({ settings, onAccept, onReject, }: Props): React.ReactNode { const dangerous = extractDangerousSettings(settings) const settingsList = formatDangerousSettingsList(dangerous) const exitState = useExitOnCtrlCDWithKeybindings() useKeybinding('confirm:no', onReject, { context: 'Confirmation' }) function onChange(value: 'accept' | 'exit'): void { if (value === 'exit') { onReject() return } onAccept() } return ( Your organization has configured managed settings that could allow execution of arbitrary code or interception of your prompts and responses. Settings requiring approval: {settingsList.map((item, index) => ( · {item} ))} Only accept if you trust your organization's IT administration and expect these settings to be configured.