Stufe 4c (#764): Kommentare in C#, WebUI-Skripten, CSS und HTML auf Englisch
Rund 2.600 Kommentarblöcke in 310 C#-Dateien übersetzt, Begründungen vollständig erhalten: blockweise gleiche Anzahl wie vorher, kein Block unter 60 % seiner Länge, der Code außerhalb der Kommentare per Tokenizer byte-identisch geprüft. Zitate deutscher Oberflächentexte und Testdaten bleiben deutsch. WebUI: Kommentare in JS/CSS/HTML übersetzt, JSDoc-@param an die in 4b umbenannten Parameter angeglichen. Dabei behoben: - 4b hatte "tag" (HTML-Tag) als deutsches "Tag" gelesen und zu "dayValue" gemacht (makeElement, svg, Tagesübersicht) - zurück auf tag/day. - Aufgaben "InProgress" bekamen die Plakettenart "laufend", für die es nie eine CSS-Klasse gab - jetzt "success" wie laufende Instanzen. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
da4ceac7d5
commit
837a634a22
@@ -3,7 +3,7 @@ using ClawdDotNet.Core.Accounting;
|
||||
|
||||
namespace ClawdDotNet.Core.Budget;
|
||||
|
||||
/// <summary>Welche Grenze überschritten wurde.</summary>
|
||||
/// <summary>Which limit was exceeded.</summary>
|
||||
public enum BudgetLimit
|
||||
{
|
||||
None,
|
||||
@@ -26,15 +26,15 @@ public sealed record BudgetStatus(bool IsAllowed, BudgetLimit Limit, string? Rea
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Wacht über das Tagesbudget.
|
||||
/// Guards the daily budget.
|
||||
///
|
||||
/// Hintergrund (K5): Es gab keine Obergrenze. Ein Agent in einer Schleife — etwa durch
|
||||
/// gegenseitige send_message-Aufrufe — konnte unbeaufsichtigt Guthaben verbrennen; die
|
||||
/// Credits-Anzeige war rein informativ.
|
||||
/// Background (K5): there was no upper limit. An agent in a loop — for example through
|
||||
/// mutual send_message calls — could burn credit unsupervised; the
|
||||
/// credits display was purely informational.
|
||||
///
|
||||
/// Zwei Arten von Grenzen, weil sich Kosten nicht immer beziffern lassen: Liefert der
|
||||
/// Anbieter für ein Modell keine Preise, greift die Kostengrenze nicht — die
|
||||
/// Token-Grenze dagegen immer. Wer sich absichern will, setzt beide.
|
||||
/// Two kinds of limits, because costs cannot always be quantified: if the
|
||||
/// provider delivers no prices for a model, the cost limit does not apply — the
|
||||
/// token limit, on the other hand, always does. Whoever wants to be safe sets both.
|
||||
/// </summary>
|
||||
public sealed class BudgetGuard
|
||||
{
|
||||
@@ -64,7 +64,7 @@ public sealed class BudgetGuard
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Prüft, ob der Agent heute noch laufen darf.
|
||||
/// Checks whether the agent may still run today.
|
||||
/// </summary>
|
||||
public Task<BudgetStatus> CheckAsync(
|
||||
AgentConfig agent, InstanceBudget instanceBudget, CancellationToken ct)
|
||||
@@ -219,7 +219,7 @@ public sealed class BudgetGuard
|
||||
{
|
||||
var today = DateOnly.FromDateTime(_now());
|
||||
|
||||
// Agentengrenze
|
||||
// Agent limit
|
||||
var agentBudget = agent.Budget;
|
||||
if (agentBudget.HasAnyLimit)
|
||||
{
|
||||
@@ -243,7 +243,7 @@ public sealed class BudgetGuard
|
||||
}
|
||||
}
|
||||
|
||||
// Instanzgrenze — gilt für alle Agenten zusammen
|
||||
// Instance limit — applies to all agents together
|
||||
if (instanceBudget.HasAnyLimit)
|
||||
{
|
||||
var used = await _usage.GetDailyForBudgetAsync(today, agentId: "", ct);
|
||||
@@ -269,7 +269,7 @@ public sealed class BudgetGuard
|
||||
return BudgetStatus.Allowed;
|
||||
}
|
||||
|
||||
/// <summary>Verbleibendes Kostenbudget des Agenten für heute; null bei fehlender Grenze.</summary>
|
||||
/// <summary>Remaining cost budget of the agent for today; null if there is no limit.</summary>
|
||||
public async Task<decimal?> GetRemainingCostAsync(AgentConfig agent, CancellationToken ct)
|
||||
{
|
||||
if (agent.Budget.DailyCostUsd <= 0)
|
||||
@@ -279,7 +279,7 @@ public sealed class BudgetGuard
|
||||
return Math.Max(0m, agent.Budget.DailyCostUsd - used.CostUsd);
|
||||
}
|
||||
|
||||
/// <summary>0 oder kleiner bedeutet: keine Grenze gesetzt.</summary>
|
||||
/// <summary>0 or less means: no limit set.</summary>
|
||||
private static bool Exceeds(decimal limit, decimal used) => limit > 0 && used >= limit;
|
||||
|
||||
private static bool Exceeds(long limit, long used) => limit > 0 && used >= limit;
|
||||
@@ -292,8 +292,8 @@ public sealed class BudgetGuard
|
||||
=> reserved > 0 ? $" Weitere {reserved:N0} Tokens sind für laufende Läufe reserviert." : "";
|
||||
|
||||
/// <summary>
|
||||
/// Ohne Preisangaben ist die verbrauchte Summe unvollständig — sonst wirkte ein
|
||||
/// niedriger Wert wie ein noch offener Spielraum.
|
||||
/// Without price information the consumed sum is incomplete — otherwise a
|
||||
/// low value would look like room still left.
|
||||
/// </summary>
|
||||
private static string UnpricedHint(DailyUsage used)
|
||||
=> used.CostIsComplete
|
||||
|
||||
Reference in New Issue
Block a user