UNPKG

automagik-cli

Version:

Automagik CLI - A powerful command-line interface for interacting with Automagik Hive multi-agent AI systems

26 lines (25 loc) 1.57 kB
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime"; import { Box, Text, useInput } from 'ink'; import { RadioButtonSelect } from './RadioButtonSelect.js'; export function TargetSelectionDialog({ targetType, targets, onSelect, onBack, }) { const items = targets.map((target) => ({ label: target.name || target.agent_id || target.team_id || target.workflow_id || 'Unknown', value: target, })); const handleSelect = (target) => { const id = target.agent_id || target.team_id || target.workflow_id; const name = target.name || id || 'Unknown'; onSelect({ type: targetType, id, name, }); }; useInput((input, key) => { if (key.escape) { onBack(); } }); const targetTypeDisplay = targetType.charAt(0).toUpperCase() + targetType.slice(1); return (_jsxs(Box, { borderStyle: "round", borderColor: "#666666", flexDirection: "column", padding: 1, width: "100%", children: [_jsxs(Text, { bold: true, children: ["Select ", targetTypeDisplay] }), _jsx(Box, { marginTop: 1, children: _jsxs(Text, { children: ["Choose which ", targetType, " you want to interact with:"] }) }), _jsx(Box, { marginTop: 1, children: _jsx(RadioButtonSelect, { items: items, initialIndex: 0, onSelect: handleSelect, isFocused: true, showScrollArrows: items.length > 10, maxItemsToShow: 10 }) }), _jsx(Box, { marginTop: 1, children: _jsx(Text, { color: "#666666", children: "(Use \u2191/\u2193 arrows and Enter to select, Esc to go back)" }) })] })); }