MessageCapRelief typedef
gh-1680: emergency relief for the message-cap self-heal. Called at most
once per response when the provider refused the request because the
message ARRAY exceeded its per-request cap (array length N exceeds limit M). The host runs ONE synchronous compaction pass over the live
transcript (the summary is the real message-count reducer; the loop's
own coalesce only merges whole tool pairs on the outbound payload) and
returns the relieved transcript to retry with — or null when nothing
hideable remains (the retry then rides the coalesced payload alone;
a second refusal surfaces the terminal error). The argument is the
loop's live transcript; the returned list REPLACES it for the rest of
the run. null = no relief configured: the retry still runs once with
the coalesced payload (then the refusal is terminal).
Implementation
typedef MessageCapRelief =
Future<List<Message>?> Function(List<Message> overCapMessages);