mirror of
https://github.com/lWolvesl/antigravity-usage-monitor.git
synced 2026-11-26 17:09:28 +08:00
feat(panel): filter family-group and external usage from quota reservation
This commit is contained in:
@@ -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(),
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user