feat: added Codex saved reset-credit redemption flow to usage tooling
- Added Codex reset-credit models, endpoints, and redemption methods. - Added reset-credit usage data and cache invalidation for successful redemption. - Added `/reset-usage` slash command and interactive account selector flow. - Added contract tests for reset-credit listing, fallback, and consume outcomes.
This commit is contained in:
@@ -1528,6 +1528,29 @@ function renderUsageReports(
|
||||
lines.push(` ${uiTheme.fg("accent", "in use by this session:")} ${activeAccountLabel}`);
|
||||
}
|
||||
|
||||
const resetAccountLines: string[] = [];
|
||||
for (const report of providerReports) {
|
||||
const count = report.resetCredits?.availableCount ?? 0;
|
||||
if (count <= 0) continue;
|
||||
const label =
|
||||
(report.metadata?.email as string | undefined) ??
|
||||
(report.metadata?.accountId as string | undefined) ??
|
||||
"account";
|
||||
const isActive =
|
||||
!!activeAccount &&
|
||||
((!!activeAccount.accountId && activeAccount.accountId === report.metadata?.accountId) ||
|
||||
(!!activeAccount.email && activeAccount.email === report.metadata?.email));
|
||||
resetAccountLines.push(
|
||||
` • ${label}: ${count} saved reset${count === 1 ? "" : "s"}${isActive ? " (active)" : ""}`,
|
||||
);
|
||||
}
|
||||
if (resetAccountLines.length > 0) {
|
||||
lines.push(
|
||||
` ${uiTheme.fg("accent", "Saved rate-limit resets")} ${uiTheme.fg("dim", "(/reset-usage to spend)")}`,
|
||||
);
|
||||
for (const line of resetAccountLines) lines.push(uiTheme.fg("dim", line));
|
||||
}
|
||||
|
||||
const renderableGroups = Array.from(limitGroups.values()).map(group => {
|
||||
const entries = group.limits.map((limit, index) => ({
|
||||
limit,
|
||||
|
||||
Reference in New Issue
Block a user