M3 Motore: Governatore con tetti da action_log, interruttore con fermi 1/6/24 ore e ripresa manuale, fascia giornaliera spostata a caso e salvata, sessioni con pause log-normali e pavimento, composizione delle sessioni sulla coda persistente, «Controlla ora» con conferma fuori fascia, cruscotto per l'interfaccia e calcolatore «Con queste impostazioni», simulazione con orologio virtuale e comando --simula; prove del motore e dell'interruttore
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Mzbb6zeFTjT6Rp8b92AVkA
This commit is contained in:
38 files changed
+9308
No files matched your search
@@ -0,0 +1,60 @@
|
||||
namespace Febe.Core.Engine;
|
||||
|
||||
/// <summary>One recipe run, as shown in «Appena fatto» (mockup 06).</summary>
|
||||
/// <param name="At">When it ended.</param>
|
||||
/// <param name="Recipe">Recipe.</param>
|
||||
/// <param name="AccountId">Account, when the recipe has one.</param>
|
||||
/// <param name="Title">«@marta.demo» or «Giro dei profili che segui».</param>
|
||||
/// <param name="Detail">«2 storie nuove», «Nessuna novità».</param>
|
||||
/// <param name="Status">How it ended.</param>
|
||||
/// <param name="NewEntries">New entries found.</param>
|
||||
public sealed record RecentAction(
|
||||
DateTimeOffset At,
|
||||
RecipeKind Recipe,
|
||||
long? AccountId,
|
||||
string Title,
|
||||
string Detail,
|
||||
RecipeStatus Status,
|
||||
int NewEntries)
|
||||
{
|
||||
/// <summary>Short label of the outcome for a badge («Scaricato», «Rimandato»...); null when nothing to say.</summary>
|
||||
public string? Badge => Status switch
|
||||
{
|
||||
RecipeStatus.Completed => NewEntries > 0 ? "Scaricato" : null,
|
||||
RecipeStatus.Denied => "Rimandato",
|
||||
RecipeStatus.StoppedBySignal => "Tutto fermo",
|
||||
RecipeStatus.TargetNotFound => "Da controllare",
|
||||
RecipeStatus.UnrecognizedFormat => "Formato nuovo",
|
||||
RecipeStatus.AccountUnreachable => "Non raggiungibile",
|
||||
RecipeStatus.Cancelled => "Interrotto",
|
||||
RecipeStatus.Failed => "Errore",
|
||||
_ => null,
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>The last recipe runs, newest first, in memory (the timeline keeps the full history).</summary>
|
||||
internal sealed class RecentActions(int capacity = 50)
|
||||
{
|
||||
private readonly Lock _gate = new();
|
||||
private readonly LinkedList<RecentAction> _items = new();
|
||||
|
||||
public void Add(RecentAction action)
|
||||
{
|
||||
lock (_gate)
|
||||
{
|
||||
_items.AddFirst(action);
|
||||
while (_items.Count > capacity)
|
||||
{
|
||||
_items.RemoveLast();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public IReadOnlyList<RecentAction> Snapshot(int limit)
|
||||
{
|
||||
lock (_gate)
|
||||
{
|
||||
return [.. _items.Take(limit)];
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user