import { normalizeAgentName as normalizeManifestAgentName } from "../../agents/manifest.js";
import { truncateCells } from "../design/textLayout.js";
export function normalizeAgentComponentName(value) {
    return normalizeManifestAgentName(value);
}
export function agentScopeTone(scope) {
    if (scope === "project")
        return "success";
    if (scope === "user")
        return "brand";
    if (scope === "plugin")
        return "warning";
    if (scope === "cache" || scope === "built-in")
        return "muted";
    return "default";
}
export function agentScopeLabel(scope) {
    if (scope === "project")
        return "project";
    if (scope === "user")
        return "user";
    if (scope === "plugin")
        return "plugin";
    if (scope === "cache")
        return "cache";
    if (scope === "built-in")
        return "built-in";
    return scope || "agent";
}
export function agentDisplayName(agent) {
    const scope = agentScopeLabel(agent.scope);
    return `${agent.name} (${scope})`;
}
export function agentRowId(agent) {
    return `${agent.scope}:${agent.name}`;
}
export function summarizeAgentTools(tools, max = 4) {
    if (!tools?.length)
        return "all tools";
    const visible = tools.slice(0, max);
    const suffix = tools.length > visible.length ? ` +${tools.length - visible.length}` : "";
    return `${visible.join(", ")}${suffix}`;
}
export function compactAgentDescription(value, width = 88) {
    const compact = (value ?? "")
        .replace(/\s+/g, " ")
        .trim();
    return compact ? truncateCells(compact, width) : "No description";
}
