feat(account): add quota trend chart and multi-account risk gate

- Gate multi-account login, import, switch, backup quota polling, and vault controls behind explicit risk consent (accountSwitchRiskAccepted), restricting unaccepted sessions to active-account quota viewing
- Add collinear-compressed per-account quota history tracking and a full-bleed 184px AccountQuotaTrendCard supporting cycle, preset, all-time, and custom ranges with cycle-boundary pre-reset filtering and isolated impulse spike sanitization
- Unify Account tab controls onto shared SegmentedControl, CustomSelect, CustomDateTimePicker, .ctx-risk-mask, and global status/button primitives while removing bespoke .account-* CSS and balancing card padding
This commit is contained in:
fish
2026-11-25 03:42:33 +09:00
parent 1330b31ef7
commit e520efe84e
20 changed files with 4103 additions and 1235 deletions
@@ -45,6 +45,7 @@ import {
} from './model-pricing.mjs';
import { getCloudStatus, getPricingPhaseEpoch, pricingCatalogRevision } from './pricing-catalog.mjs';
import { buildOfficialQuotaPools } from './quota-pools.mjs';
import { recordAccountQuotaSnapshot } from './account-quota-history.mjs';
import { updatePoolQuotaReservationEstimates } from './quota-reservation.mjs';
import { getDefaultCloudCodeProxyStatus } from './cloudcode-proxy.mjs';
import { getDefaultWindowBridgeStatus } from './window-bridge.mjs';
@@ -2293,6 +2294,20 @@ export async function buildTelemetryPayloadInternal(
const order = { Gemini: 0, Argon: 1, Carbon: 2, 'Claude & GPT': 3 };
return (order[a.family] ?? 99) - (order[b.family] ?? 99);
});
if (
!isRemote &&
accountStatus === 'signedIn' &&
userStatus?.email &&
officialQuotaInfo?.data &&
!officialQuotaInfo.isStale
) {
recordAccountQuotaSnapshot(
userStatus.email,
sortedQuotaPools,
officialQuotaInfo.fetchedAtMs || Date.now(),
{ isActiveHost: true }
);
}
const weeklyCapacityEstimate = buildWeeklyCapacityEstimate({
sortedPools: sortedQuotaPools,
isCustomWeeklyMode,