getBudgetContinuationMessage function
Build the continuation message for a token budget.
Implementation
String getBudgetContinuationMessage(int pct, int turnTokens, int budget) {
String fmt(int n) {
// Format number with commas.
final str = n.toString();
final buffer = StringBuffer();
for (int i = 0; i < str.length; i++) {
if (i > 0 && (str.length - i) % 3 == 0) buffer.write(',');
buffer.write(str[i]);
}
return buffer.toString();
}
return 'Stopped at $pct% of token target (${fmt(turnTokens)} / ${fmt(budget)}). '
'Keep working \u2014 do not summarize.';
}