import path from 'node:path';
export function truncateOutput(text, maxChars = 30_000) {
    if (text.length <= maxChars)
        return text;
    const head = text.slice(0, maxChars / 2);
    const tail = text.slice(-maxChars / 2);
    return `${head}\n\n... [output truncated: ${text.length} chars total] ...\n\n${tail}`;
}
export function resolveInCwd(cwd, p) {
    return path.isAbsolute(p) ? p : path.resolve(cwd, p);
}
