import { Box, Text, useInput } from "ink"; import { memo, useState } from "react"; import { colors } from "./colors"; type Props = { onApprove: () => void; onReject: () => void; }; export const EnterPlanModeDialog = memo(({ onApprove, onReject }: Props) => { const [selectedOption, setSelectedOption] = useState(0); const options = [ { label: "Yes, enter plan mode", action: onApprove }, { label: "No, start implementing now", action: onReject }, ]; useInput((input, key) => { if (key.upArrow) { setSelectedOption((prev) => Math.max(0, prev - 1)); } else if (key.downArrow) { setSelectedOption((prev) => Math.min(options.length - 1, prev + 1)); } else if (key.return) { options[selectedOption]?.action(); } else if (input === "1") { onApprove(); } else if (input === "2") { onReject(); } }); return ( Enter plan mode? Letta wants to enter plan mode to explore and design an implementation approach. In plan mode, Letta will: • Explore the codebase thoroughly • Identify existing patterns • Design an implementation strategy • Present a plan for your approval No code changes will be made until you approve the plan. {options.map((option, index) => { const isSelected = index === selectedOption; const color = isSelected ? colors.approval.header : undefined; return ( {isSelected ? ">" : " "} {index + 1}. {option.label} ); })} ); }); EnterPlanModeDialog.displayName = "EnterPlanModeDialog";