import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { Box, Text } from "ink";
import { SelectList } from "../design/SelectList.js";
import { agentPathLabel } from "./agentFileUtils.js";
import { agentRowId, agentScopeTone, compactAgentDescription } from "./utils.js";
export function agentsListOptions(input) {
    return input.agents.map((agent) => {
        const id = agentRowId(agent);
        return {
            id,
            label: agent.name,
            detail: `${agent.scope} | ${agentPathLabel(agent.path, input.projectPath)}`,
            description: compactAgentDescription(agent.description),
            selected: id === input.selectedId,
            tone: agentScopeTone(agent.scope),
        };
    });
}
export function AgentsList(props) {
    const options = agentsListOptions(props);
    return (_jsxs(Box, { flexDirection: "column", children: [_jsx(Text, { color: "cyan", children: "Agents" }), _jsx(SelectList, { options: options, selectedIndex: props.selectedIndex, visibleCount: 8, width: props.width })] }));
}
