/** * Fitting a tool result into a budget without destroying it. * * Cutting a serialized payload at a character count leaves the model invalid * JSON ending mid-token. Observed with `list_commits`: 12,063 characters cut at * 12,000, so the model received a broken document and reported "I can only see * one commit" — accurate about what survived, useless as an answer. * * Most oversized results are a list of similar things. Keeping whole items and * saying how many were dropped preserves both validity and the fact that more * exists, which is what the model needs to be honest about coverage. */ export interface TruncationResult { text: string; truncated: boolean; /** Items kept, when the payload was a list. */ keptItems?: number; /** Items dropped, when the payload was a list. */ droppedItems?: number; } /** * Trims a tool result to `limit` characters. * * When the payload holds a list, drops whole items from the end until it fits, * so the result stays parseable. Otherwise falls back to a character cut, which * is still better than silence for prose. */ export declare const truncateToolResult: (raw: unknown, serialized: string, limit: number) => TruncationResult; //# sourceMappingURL=TruncateResult.d.ts.map