export interface TruncatedText { readonly text: string; readonly truncated: boolean; readonly originalLength: number; } /** * Longest single log line body any tool returns, in prose or structuredContent. Window budgets * keep at least one entry, so without this a single enormous line would be that entry. */ export declare const MAX_LOG_LINE_CHARS = 2000; export declare function truncateText(value: string, limit: number): TruncatedText; export interface WindowResult { readonly kept: T[]; readonly dropped: number; } /** Keep as many trailing entries as fit in `charBudget`; log tails are where failures live. */ export declare function keepTailWithinBudget(entries: readonly T[], charBudget: number, sizeOf: (entry: T) => number): WindowResult; /** Keep as many leading entries as fit in `charBudget`; used when paging forward. */ export declare function keepHeadWithinBudget(entries: readonly T[], charBudget: number, sizeOf: (entry: T) => number): WindowResult; /** * Accumulates the human-readable summary text for a tool result and stops accepting lines once * the character budget is spent, so no tool can return unbounded prose to the model. * * Overflow is terminal: the line that overflows is cut down to whatever room remains (or dropped * when that room is too small to be useful) and every later push is refused, so the rendered * text is always a prefix of what was pushed rather than a prefix with holes in it. */ export declare class TextBudget { private readonly limit; private readonly lines; private used; private overflowed; constructor(limit: number); push(...lines: string[]): this; get didOverflow(): boolean; render(): string; } export declare function formatCount(count: number, singular: string, plural?: string): string; //# sourceMappingURL=budget.d.ts.map