feat(ai): report Anthropic extra usage

This commit is contained in:
LunarECL
2026-07-23 21:25:15 +09:00
parent f833810d0e
commit e7fdc99afd
13 changed files with 860 additions and 12 deletions
+10 -1
View File
@@ -208,14 +208,23 @@ function describeAmount(limit: UsageLimit): string {
const amount = limit.amount;
const parts: string[] = [];
const absoluteUnit = amount.unit !== "percent" && amount.unit !== "unknown";
const fraction = resolveUsedFraction(limit);
if (absoluteUnit && amount.used !== undefined && amount.limit !== undefined) {
parts.push(
`${formatUnitValue(amount.used, amount.unit)} / ${formatUnitValue(amount.limit, amount.unit)}${UNIT_SUFFIX[amount.unit]}`,
);
} else if (absoluteUnit && amount.remaining !== undefined) {
parts.push(`${formatUnitValue(amount.remaining, amount.unit)}${UNIT_SUFFIX[amount.unit]} left`);
} else if (
absoluteUnit &&
amount.used !== undefined &&
Number.isFinite(amount.used) &&
amount.limit === undefined &&
amount.remaining === undefined &&
fraction === undefined
) {
parts.push(`${formatUnitValue(amount.used, amount.unit)}${UNIT_SUFFIX[amount.unit]} used`);
}
const fraction = resolveUsedFraction(limit);
if (fraction !== undefined) {
parts.push(`${(fraction * 100).toFixed(1)}% used`);
} else if (amount.remainingFraction !== undefined) {