Files
llmx/codex-cli/src/components/approval-mode-overlay.tsx
Ilan Bigio 59a180ddec Initial commit
Signed-off-by: Ilan Bigio <ilan@openai.com>
2025-04-16 12:56:08 -04:00

48 lines
1.1 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import TypeaheadOverlay from "./typeahead-overlay.js";
import { AutoApprovalMode } from "../utils/auto-approval-mode.js";
import { Text } from "ink";
import React from "react";
type Props = {
currentMode: string;
onSelect: (mode: string) => void;
onExit: () => void;
};
/**
* Overlay to switch between the different automaticapproval policies.
*
* The list of available modes is derived from the AutoApprovalMode enum so we
* stay in sync with the core agent behaviour. It reuses the generic
* TypeaheadOverlay component for the actual UI/UX.
*/
export default function ApprovalModeOverlay({
currentMode,
onSelect,
onExit,
}: Props): JSX.Element {
const items = React.useMemo(
() =>
Object.values(AutoApprovalMode).map((m) => ({
label: m,
value: m,
})),
[],
);
return (
<TypeaheadOverlay
title="Switch approval mode"
description={
<Text>
Current mode: <Text color="greenBright">{currentMode}</Text>
</Text>
}
initialItems={items}
currentValue={currentMode}
onSelect={onSelect}
onExit={onExit}
/>
);
}