feat(panel): filter family-group and external usage from quota reservation

This commit is contained in:
fish
2026-11-24 01:34:39 +09:00
parent 942a09ab8e
commit b57c5d5987
10 changed files with 1110 additions and 77 deletions
@@ -1729,11 +1729,57 @@ export async function buildTelemetryPayloadInternal(
poolObj.cycleWeekly = pStats?.cycleWeekly || createEmptyCycleSummary();
}
const runningPoolKeys = new Set();
let hasUnknownRunningPool = false;
for (const rootConv of conversations) {
const isMainRunning = rootConv?.status === 'CASCADE_RUN_STATUS_RUNNING';
const rawSubs = Array.isArray(rootConv?.subagents) ? rootConv.subagents : [];
const runningSubs = rawSubs.filter((s) => s?.status === 'CASCADE_RUN_STATUS_RUNNING');
if (!isMainRunning && runningSubs.length === 0) continue;
const recordRunningPool = (cid) => {
const entry = findTrajectoryCacheEntry(cid, cacheStore);
const steps = Array.isArray(entry?.steps) ? entry.steps : [];
const lastStep = steps.length > 0 ? steps[steps.length - 1] : null;
if (!lastStep) {
if (activePoolKey && activePoolKey !== 'Unknown') {
runningPoolKeys.add(activePoolKey);
} else {
hasUnknownRunningPool = true;
}
return;
}
const mInfo = resolveStepModel(lastStep);
const { activePoolKey: pKey } = resolveActivePoolKeyFromStep(
{
modelKey: lastStep.modelKey || mInfo.modelId || 'unknown',
family: mInfo.family,
modelLabel: mInfo.label,
modelShort: mInfo.shortName,
modelUpstream: mInfo.modelId,
},
quotaPoolsMap
);
if (pKey && pKey !== 'Unknown') {
runningPoolKeys.add(pKey);
} else {
hasUnknownRunningPool = true;
}
};
if (isMainRunning) recordRunningPool(rootConv.cascadeId);
for (const sub of runningSubs) {
recordRunningPool(sub.cascadeId);
}
}
updatePoolQuotaReservationEstimates({
endpointId,
accountScope: accountScope || '',
quotaPoolsMap,
poolCycleStats,
runningPoolKeys,
hasUnknownRunningPool,
quotaFetchedAtMs: officialQuotaInfo?.fetchedAtMs || 0,
nowMs: Date.now(),
});