core: publish self-hosted weekly dashboard and Proxmox deployment (#20)

Reuse existing weekly/reset analysis in an authenticated dashboard and local official CLI workers. Add safe Proxmox installation and updates, account-attributed history, and MIT distribution. Provider credentials stay owned by each CLI.

Closes #19
This commit was merged in pull request #20.
This commit is contained in:
2026-11-15 11:24:55 +01:00
parent c02829e2e1
commit c75446008c
59 changed files with 4208 additions and 30 deletions
@@ -9,7 +9,7 @@ public sealed record ScanResult(int AddedEvents, IReadOnlyList<LimitWindow> Code
/// <summary>Only opens transcript/rollout jsonl paths. Offsets advance through complete lines only.
/// Prefix and consumed-tail fingerprints detect replacements without rereading whole files.</summary>
public sealed class IncrementalScanner(HistoryStore history, DiagnosticLog diagnostics,
string claudeDirectory, string codexDirectory)
string claudeDirectory, string codexDirectory, Action<UsageEvent, string?>? observe = null)
{
private static readonly UTF8Encoding StrictUtf8 = new(false, true);
public async Task<ScanResult> ScanAsync(CancellationToken cancellationToken = default,
@@ -93,12 +93,20 @@ public sealed class IncrementalScanner(HistoryStore history, DiagnosticLog diagn
var text = StrictUtf8.GetString(line.GetBuffer(), 0, (int)line.Length).TrimEnd('\r');
if (text.Length > 0 && provider == Provider.Claude)
{
if (TranscriptParser.Parse(text, diagnostics) is { } usage && history.Add(usage)) added++;
if (TranscriptParser.Parse(text, diagnostics) is { } usage)
{
observe?.Invoke(usage, cursor.SessionId);
if (history.Add(usage)) added++;
}
}
else if (text.Length > 0)
{
var entry = RolloutParser.Parse(text, cursor, DateTimeOffset.UtcNow, diagnostics);
if (entry.CumulativeUsage is { } usage && history.AddCodex(cursor.SessionId!, usage)) added++;
if (entry.CumulativeUsage is { } usage)
{
observe?.Invoke(usage, cursor.SessionId);
if (history.AddCodex(cursor.SessionId!, usage)) added++;
}
if (entry.Limits.Count > 0)
{
latestLimits.Clear(); latestLimits.AddRange(entry.Limits);