app: show the reset history of each long limit window (#16)
The developer asked for a detailed breakdown of every reset (feedback of 2026-10-18). Limits do not only reset at the end of their week: most Codex weeks in the local history ended early. - Core: a limit's samples form a window series (provider, limit name and length), so the history follows Codex's week across slots (D7). Instance spans are built once. One backward walk gives each instance, real or inferred, the start of the instance after it. The hour that holds a boundary goes to the instance that starts in it, or else to the one that ends in it (#9). A stale sample that would put its instance after a later one is ignored. The reset history lists the real instances with their figures, totals and early-reset hours (D12). API value uses a dated list price table; unknown models stay unpriced (D13). - App: a Resets section per long window with totals, a timeline of burn-ups side by side with skipped time in lanes below, early resets by hour and weekday, and a sortable table (D8). The reset tooltip lists every model with its tokens and API value. Tall tooltips open beside the pointer, and Fluent's 320 px tooltip cap no longer wraps data values. - Docs: D12 and D13 are new; D7 and D8 cover window series, boundary hours and the Resets section. Closes #14 Closes #9
This commit was merged in pull request #16.
This commit is contained in:
@@ -21,6 +21,8 @@ public sealed class PanelWindow : Window
|
||||
private bool wide;
|
||||
private int limitColumns;
|
||||
private readonly Dictionary<Provider, string> selectedDailyWindow = [];
|
||||
private readonly Dictionary<Provider, WindowSeries> selectedResetWindow = [];
|
||||
private readonly Dictionary<WindowSeries, TableState<ResetColumn>> resetTables = [];
|
||||
private readonly BreakdownState modelBreakdown = new(), projectBreakdown = new();
|
||||
|
||||
public PanelWindow(PanelViewModel model, Action refresh, Action settings, Action quit, Action reload, TimeProvider? clock = null)
|
||||
@@ -177,6 +179,38 @@ public sealed class PanelWindow : Window
|
||||
Ui.Text("Measured · dashed: estimated · faint: previous · dotted: forecast", 12, "Muted"), new BurnUpChart(limit with { Now = now }, clock),
|
||||
Ui.Text("Past instances · peak use", 12, "Muted"), new InstancePeaks(limit.Analysis!.Past, limit.Provider, clock)))), wide));
|
||||
}
|
||||
var resetHistories = h.Resets.Where(r => model.ProviderFilter is null || r.Window.Provider == model.ProviderFilter).ToArray();
|
||||
if (resetHistories.Length > 0)
|
||||
{
|
||||
content.Add(Ui.Text("Resets", 20));
|
||||
foreach (var group in resetHistories.GroupBy(r => r.Window.Provider))
|
||||
{
|
||||
var entries = group.ToArray();
|
||||
var index = Array.FindIndex(entries, r => WindowSeries.For(r.Window) == selectedResetWindow.GetValueOrDefault(group.Key));
|
||||
if (index < 0) index = 0;
|
||||
var title = Ui.Text(group.Key + " · " + entries[index].Window.Label, 15);
|
||||
Control View(ResetHistory history)
|
||||
{
|
||||
var key = WindowSeries.For(history.Window);
|
||||
if (!resetTables.TryGetValue(key, out var state)) resetTables[key] = state = new(ResetColumn.Start);
|
||||
return new ResetCard(history, state, clock);
|
||||
}
|
||||
var view = new Border { Child = View(entries[index]) };
|
||||
var stack = Ui.Stack(title);
|
||||
if (entries.Length > 1)
|
||||
{
|
||||
var selector = new WindowSelector { Name = "ResetWindowSelector", ItemsSource = entries.Select(r => r.Window.Label).ToArray(), SelectedIndex = index };
|
||||
selector.SelectionChanged += (_, _) =>
|
||||
{
|
||||
if (selector.SelectedIndex < 0) return;
|
||||
var history = entries[selector.SelectedIndex]; selectedResetWindow[group.Key] = WindowSeries.For(history.Window);
|
||||
title.Text = group.Key + " · " + history.Window.Label; view.Child = View(history);
|
||||
};
|
||||
stack.Children.Add(selector);
|
||||
}
|
||||
stack.Children.Add(view); content.Add(Ui.Card(stack));
|
||||
}
|
||||
}
|
||||
content.Add(Ui.Text("Breakdown", 20));
|
||||
content.Add(Ui.Card(new BreakdownTable("By model", h.Models, false, model.ProviderFilter, modelBreakdown)));
|
||||
content.Add(Ui.Card(new BreakdownTable("By project", h.Projects, true, model.ProviderFilter, projectBreakdown)));
|
||||
|
||||
Reference in New Issue
Block a user