core: plan the daily budget per day, start forecasts at 2 % and follow the limit week
agent-review agent review: fail

The budget was the rest of the week over the time left, so each use today
lowered it and a partial first day was held to a full day. Now each day of
the instance has its share, its even pace and its budget. Today's budget
starts from the use at the day start and does not move with today's use
(D7). Forecasts start at 2 % of a window, so an early reset no longer hides
them for most of a day.

Limit tiles of one kind show the same rows, with placeholders that say why
a value is missing. The week chart draws per-day steps and marks the
instance start and reset (D8). Week token totals follow the provider's
limit week and say since when, with the calendar week as fallback (D9).

Refs #13
This commit is contained in:
Florian Schmidt
2026-10-18 09:55:41 +02:00
parent a8785fa453
commit 941a597680
22 changed files with 422 additions and 66 deletions
+2 -2
View File
@@ -2,10 +2,10 @@ namespace FinalToken.Core;
public static class Pace
{
// D7: use ticks at the boundary so exactly 10% is eligible despite floating-point rounding.
// D7: use ticks at the boundary so exactly 2% is eligible despite floating-point rounding.
public static DateTimeOffset? ForecastStartsAt(LimitWindow window) =>
window.Length is { Ticks: > 0 } length && window.ResetsAt is { } reset
? reset - TimeSpan.FromTicks(length.Ticks - length.Ticks / 10) : null;
? reset - TimeSpan.FromTicks(length.Ticks - length.Ticks / 50) : null;
public static bool CanForecast(LimitWindow window, DateTimeOffset now, double threshold = 10) =>
CanForecast(window, now, Calculate(window, now, threshold));