import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { Box, Text } from "ink";
import { SelectList } from "../design/SelectList.js";
import { normalizeAgentComponentName } from "./utils.js";
export function toolSelectorOptions(tools, selectedTools = []) {
    const selected = new Set(selectedTools.map(normalizeAgentComponentName));
    return tools
        .map((tool) => normalizeAgentComponentName(tool))
        .filter(Boolean)
        .sort((a, b) => a.localeCompare(b))
        .map((tool) => ({
        id: tool,
        label: tool,
        detail: selected.has(tool) ? "enabled" : "available",
        selected: selected.has(tool),
        tone: selected.has(tool) ? "success" : "default",
    }));
}
export function ToolSelector(props) {
    return (_jsxs(Box, { flexDirection: "column", children: [_jsx(Text, { color: "cyan", children: "Agent tools" }), _jsx(SelectList, { options: toolSelectorOptions(props.tools, props.selectedTools), selectedIndex: props.selectedIndex, visibleCount: 8, width: props.width })] }));
}
