import { AGENT_HISTORY_DEFAULT_LIMIT } from './history-limit.js';
/** Resolve socket/HTTP `agents:history` tail size. */
export function resolveHistoryLimit(opts) {
    const base = opts?.limit && opts.limit > 0 ? opts.limit : AGENT_HISTORY_DEFAULT_LIMIT;
    const min = opts?.minMessages && opts.minMessages > 0 ? opts.minMessages : 0;
    return Math.min(500, Math.max(base, min));
}
