mirror of
https://github.com/lWolvesl/antigravity-usage-monitor.git
synced 2026-11-26 17:09:28 +08:00
feat(panel): upgrade topbar quota ring indicators, unify structure previews, and polish quota panel
This commit is contained in:
+179
-118
@@ -1807,7 +1807,6 @@ const I18N_MESSAGES_ZH_CN = Object.freeze({
|
||||
'settings.str.popoverWidthHint': '自适应模式下在调用明细等宽表格视图自动撑宽免水平滚动;指定宽度范围 440~1080 px',
|
||||
'settings.str.multiToggle': '实时运行会话入口',
|
||||
'settings.str.contextAgentModeLabel': '胶囊及悬浮上下文',
|
||||
'settings.str.contextAgentModeHint': '锁定主代理时,顶栏百分比及悬停速览始终展示主代理;完整面板内仍可随时点选子代理明细',
|
||||
'settings.str.contextAgentMain': '锁定主代理',
|
||||
'settings.str.contextAgentAuto': '跟随活跃',
|
||||
'settings.str.cliCapsuleToggle': 'CLI 底部状态胶囊',
|
||||
@@ -2668,7 +2667,6 @@ const I18N_MESSAGES_EN_US = Object.freeze({
|
||||
'settings.str.popoverWidthHint': 'Auto Fit widens wide tables like Step Records to avoid horizontal scroll; Custom accepts 440–1080 px',
|
||||
'settings.str.multiToggle': 'Active Sessions Pill',
|
||||
'settings.str.contextAgentModeLabel': 'Capsule & Hover Context',
|
||||
'settings.str.contextAgentModeHint': 'Lock to Main Agent keeps the topbar percentage and hover HUD on Main Agent; you can still inspect subagents inside the full panel',
|
||||
'settings.str.contextAgentMain': 'Lock Main Agent',
|
||||
'settings.str.contextAgentAuto': 'Follow Active',
|
||||
'settings.str.cliCapsuleToggle': 'CLI Bottom Capsule',
|
||||
@@ -4518,6 +4516,7 @@ function resolveModelDisplayInfo(target, settings = {}, options = {}) {
|
||||
target.baseModelUpstream ??
|
||||
target.activeModelUpstream ??
|
||||
target.modelUpstream ??
|
||||
target.upstreamModel ??
|
||||
target.upstreamName ??
|
||||
''
|
||||
).trim();
|
||||
@@ -16786,9 +16785,22 @@ function resolveQuotaCapsuleSummary(quotas) {
|
||||
? `${tightest.label} ${tightest.windowTag} · ${runnerUp.windowTag} ${runnerPct}%`
|
||||
: `${tightest.label} ${tightest.windowTag} · ${runnerUp.label} ${runnerUp.windowTag} ${runnerPct}%`
|
||||
: `${tightest.label} · ${tightest.windowTag}`;
|
||||
const tightestIsClaude = /claude|gpt|fable|oss|third/i.test(String(tightest.label || ''));
|
||||
const tightestIsGemini = !tightestIsClaude && /gemini|argon|carbon|neon|flash|pro/i.test(String(tightest.label || ''));
|
||||
const tightestWinShort = tightest.windowTag === '5h' ? '5h' : isEnglishLocale() ? 'w' : '周';
|
||||
const poolPrefix = tightestIsClaude
|
||||
? `C${tightestWinShort}`
|
||||
: tightestIsGemini
|
||||
? `G${tightestWinShort}`
|
||||
: tightest.windowTag === '5h'
|
||||
? '5h'
|
||||
: isEnglishLocale()
|
||||
? 'Wk'
|
||||
: '周';
|
||||
return {
|
||||
roundedPct: rounded,
|
||||
shortText: t('capsule.quotaLeft', { pct: rounded }),
|
||||
poolPrefix,
|
||||
subLabelText,
|
||||
detailText: candidates
|
||||
.map((c) => {
|
||||
@@ -16799,6 +16811,16 @@ function resolveQuotaCapsuleSummary(quotas) {
|
||||
};
|
||||
}
|
||||
|
||||
function resolveQuotaCapsulePrefix(metricKey, quotaSum) {
|
||||
const isEn = isEnglishLocale();
|
||||
if (metricKey === 'gemini_5h') return 'G5h';
|
||||
if (metricKey === 'gemini_weekly') return isEn ? 'Gw' : 'G周';
|
||||
if (metricKey === 'claude_5h') return 'C5h';
|
||||
if (metricKey === 'claude_weekly') return isEn ? 'Cw' : 'C周';
|
||||
if (quotaSum?.poolPrefix) return quotaSum.poolPrefix;
|
||||
return isEn ? 'Q' : '余';
|
||||
}
|
||||
|
||||
/**
|
||||
* 解析指定模型池(Gemini 或 Claude & GPT)与指定时间窗口(5h 或周额度)的剩余百分比摘要。
|
||||
*
|
||||
@@ -17018,17 +17040,25 @@ function resolveCapsuleMetricPresentation(metricKey, slotCtx, ringCircumference)
|
||||
: metricKey === 'quota_auto'
|
||||
? resolveQuotaCapsuleSummary(slotCtx.quotas)
|
||||
: resolveSpecificQuotaSlotSummary(slotCtx.quotas, metricKey);
|
||||
const isDanger = Boolean(quotaSum && quotaSum.roundedPct <= 15);
|
||||
const isWarn = Boolean(quotaSum && !isDanger && quotaSum.roundedPct <= 30);
|
||||
const hasQuotaPct = Boolean(quotaSum && Number.isFinite(quotaSum.roundedPct));
|
||||
const clampedPct = hasQuotaPct ? Math.max(0, Math.min(100, quotaSum.roundedPct)) : 0;
|
||||
const quotaDashOffset = hasQuotaPct
|
||||
? +(ringCircumference * (1 - clampedPct / 100)).toFixed(2)
|
||||
: ringCircumference;
|
||||
const isDanger = Boolean(hasQuotaPct && clampedPct <= 15);
|
||||
const isWarn = Boolean(hasQuotaPct && !isDanger && clampedPct <= 30);
|
||||
const toneClass = isDanger ? 'tone-danger' : isWarn ? 'tone-warn' : '';
|
||||
return {
|
||||
hidden: false,
|
||||
metric: metricKey,
|
||||
segClass: 'wm-cap-slot wm-seg-quota',
|
||||
textClass: 'wm-slot-text wm-quota-text',
|
||||
showRing: false,
|
||||
dashOffset: ringCircumference,
|
||||
text: quotaSum ? quotaSum.shortText : t('capsule.quotaUnknown'),
|
||||
showRing: true,
|
||||
ringKind: 'quota',
|
||||
ringEmpty: !hasQuotaPct,
|
||||
dashOffset: quotaDashOffset,
|
||||
prefix: resolveQuotaCapsulePrefix(metricKey, quotaSum),
|
||||
text: hasQuotaPct ? `${clampedPct}%` : '--%',
|
||||
toneClass,
|
||||
running: false,
|
||||
warn: isWarn,
|
||||
@@ -18057,7 +18087,7 @@ function createPoolQuotaRow() {
|
||||
h('div', { className: 'progress-track' }, [fillWk]),
|
||||
]);
|
||||
|
||||
const el = h('div', { style: 'display: flex; flex-direction: column; gap: 8px;' }, [
|
||||
const el = h('div', { className: 'quota-pool-row' }, [
|
||||
row5h,
|
||||
rowWk,
|
||||
]);
|
||||
@@ -18107,13 +18137,7 @@ function formatQuotaSummaryFooter(quotas, account) {
|
||||
*/
|
||||
function syncPoolQuotaRow(refs, item, idx, rowEl) {
|
||||
const { poolData, poolLabel, fallbackWeekly, isActivePool, isPending } = item;
|
||||
patchAttr(
|
||||
rowEl,
|
||||
'style',
|
||||
idx === 0
|
||||
? 'display: flex; flex-direction: column; gap: 8px;'
|
||||
: 'display: flex; flex-direction: column; gap: 8px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border-hairline);'
|
||||
);
|
||||
patchClasses(rowEl, { 'quota-pool-row': true, 'has-divider': idx > 0 });
|
||||
|
||||
const has5h = poolData?.usedPct != null && poolData?.remainingPct != null;
|
||||
const used5hVal = has5h ? Number(poolData.usedPct) : 0;
|
||||
@@ -18258,13 +18282,6 @@ const QuotaPoolsWidget = defineComponent({
|
||||
});
|
||||
}
|
||||
|
||||
const initFoot = formatQuotaSummaryFooter(null, null);
|
||||
const wkFootLeft = h('span', { className: 'text-muted', text: initFoot.leftText });
|
||||
const wkFootRight = h('span', {
|
||||
className: 'text-muted',
|
||||
text: compactHover ? initFoot.rightText : '',
|
||||
});
|
||||
|
||||
const quotaPanel = h('section', { className: 'panel' }, [
|
||||
h('div', { className: 'panel-header' }, [
|
||||
h('span', { className: 'panel-title' }, [
|
||||
@@ -18274,13 +18291,6 @@ const QuotaPoolsWidget = defineComponent({
|
||||
tierBadge,
|
||||
]),
|
||||
poolsListEl,
|
||||
h(
|
||||
'div',
|
||||
compactHover
|
||||
? { className: 'panel-header wm-hover-quota-foot' }
|
||||
: { className: 'panel-header', style: 'font-size: var(--fs-md); padding-top: 2px;' },
|
||||
[wkFootLeft, wkFootRight]
|
||||
),
|
||||
]);
|
||||
|
||||
function update({ data, minuteTick } = {}) {
|
||||
@@ -18293,9 +18303,6 @@ const QuotaPoolsWidget = defineComponent({
|
||||
createRow: createPoolQuotaRow,
|
||||
updateRow: syncPoolQuotaRow,
|
||||
});
|
||||
const pendingFoot = formatQuotaSummaryFooter(null, null);
|
||||
patchText(wkFootLeft, pendingFoot.leftText);
|
||||
patchText(wkFootRight, pendingFoot.rightText);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -18312,12 +18319,6 @@ const QuotaPoolsWidget = defineComponent({
|
||||
createRow: createPoolQuotaRow,
|
||||
updateRow: syncPoolQuotaRow,
|
||||
});
|
||||
|
||||
const footSummary = formatQuotaSummaryFooter(quotas, data.account);
|
||||
patchText(wkFootLeft, footSummary.leftText);
|
||||
patchText(wkFootRight, footSummary.rightText);
|
||||
patchAttr(wkFootLeft, 'title', footSummary.tooltip);
|
||||
patchAttr(wkFootRight, 'title', footSummary.tooltip);
|
||||
}
|
||||
|
||||
return {
|
||||
@@ -20186,6 +20187,7 @@ function createCapsuleSlotNode(slotIndex, initialMetric) {
|
||||
|
||||
const isNone = initialMetric === 'none';
|
||||
const isCtx = initialMetric === 'context';
|
||||
const prefixSpan = h('span', { className: 'wm-slot-prefix' });
|
||||
const textSpan = h('span', {
|
||||
className: isCtx ? 'wm-slot-text wm-ctx-pct' : 'wm-slot-text',
|
||||
text: isNone
|
||||
@@ -20196,7 +20198,7 @@ function createCapsuleSlotNode(slotIndex, initialMetric) {
|
||||
? '-- t/s'
|
||||
: initialMetric === 'ttft'
|
||||
? '--s'
|
||||
: t('capsule.quotaUnknown'),
|
||||
: '--%',
|
||||
});
|
||||
const el = h(
|
||||
'span',
|
||||
@@ -20222,8 +20224,10 @@ function createCapsuleSlotNode(slotIndex, initialMetric) {
|
||||
el,
|
||||
ringSvg,
|
||||
ringFill,
|
||||
prefixSpan,
|
||||
textSpan,
|
||||
ringMounted: isCtx,
|
||||
prefixMounted: false,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -20250,13 +20254,25 @@ function syncCapsuleSlotNodes(capsuleSlots, capsuleSeps, slotKeys, slotCtx) {
|
||||
patchAttr(slot.el, 'data-vis-rank', String(visRank));
|
||||
|
||||
if (pres.showRing && !slot.ringMounted) {
|
||||
slot.el.insertBefore(slot.ringSvg, slot.textSpan);
|
||||
slot.el.insertBefore(slot.ringSvg, slot.el.firstChild || slot.textSpan);
|
||||
slot.ringMounted = true;
|
||||
} else if (!pres.showRing && slot.ringMounted) {
|
||||
slot.ringSvg.remove();
|
||||
slot.ringMounted = false;
|
||||
}
|
||||
|
||||
const prefixText = String(pres.prefix || '');
|
||||
if (prefixText) {
|
||||
patchText(slot.prefixSpan, prefixText);
|
||||
if (!slot.prefixMounted) {
|
||||
slot.el.insertBefore(slot.prefixSpan, slot.textSpan);
|
||||
slot.prefixMounted = true;
|
||||
}
|
||||
} else if (slot.prefixMounted) {
|
||||
slot.prefixSpan.remove();
|
||||
slot.prefixMounted = false;
|
||||
}
|
||||
|
||||
const toneCls =
|
||||
pres.toneClass || (pres.danger ? 'tone-danger' : pres.warn ? 'tone-warn' : '');
|
||||
const fullSegClass = `${pres.segClass}${pres.running ? ' state-running' : ''}${toneCls ? ` ${toneCls}` : ''}`;
|
||||
@@ -20267,7 +20283,12 @@ function syncCapsuleSlotNodes(capsuleSlots, capsuleSeps, slotKeys, slotCtx) {
|
||||
|
||||
if (pres.showRing) {
|
||||
slot.ringFill.setAttribute('stroke-dashoffset', String(pres.dashOffset));
|
||||
patchClasses(slot.ringFill, { 'tone-warn': pres.warn, 'tone-danger': pres.danger });
|
||||
patchClasses(slot.ringFill, {
|
||||
'is-quota': pres.ringKind === 'quota',
|
||||
'is-empty': pres.ringEmpty === true,
|
||||
'tone-warn': pres.warn,
|
||||
'tone-danger': pres.danger,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22417,10 +22438,12 @@ function buildStructurePreviewTelemetry(baseSettings = {}, draftOverrides = {})
|
||||
isSubagent: false,
|
||||
agentBadge: '主',
|
||||
agentLabel: t('fmt.mainAgent'),
|
||||
modelLabel: 'Gemini 4 Carbon (High)',
|
||||
modelShort: 'gemini-4-carbon',
|
||||
rawModel: 'MODEL_PLACEHOLDER_M37',
|
||||
upstreamModel: 'gemini-4-carbon-high',
|
||||
modelKey: 'MODEL_PLACEHOLDER_M667',
|
||||
modelLabel: 'Gemini Pro Orchestrator (Carbon)',
|
||||
modelShort: 'orchestrator-carbon',
|
||||
rawModel: 'MODEL_PLACEHOLDER_M667',
|
||||
modelUpstream: 'gemini-pro-orchestrator',
|
||||
upstreamModel: 'gemini-pro-orchestrator',
|
||||
tokPerSec: 17.8,
|
||||
ttftSec: 19.4,
|
||||
totalDurationSec: 31.2,
|
||||
@@ -22474,18 +22497,19 @@ function buildStructurePreviewTelemetry(baseSettings = {}, draftOverrides = {})
|
||||
outputTokens: 22100,
|
||||
totalTokens: 1434500,
|
||||
latestModelLabel: 'Gemini 4 Carbon (High)',
|
||||
latestModelShort: 'gemini-4-carbon',
|
||||
latestModelShort: 'carbon-4-high',
|
||||
latestRawModel: 'MODEL_PLACEHOLDER_M37',
|
||||
latestUpstreamModel: 'gemini-4-carbon-high',
|
||||
activeModelLabel: 'Gemini 4 Carbon (High)',
|
||||
activeModelShort: 'gemini-4-carbon',
|
||||
activeModelShort: 'carbon-4-high',
|
||||
activeModelUpstream: 'gemini-4-carbon-high',
|
||||
sessionUnpricedCalls: 0,
|
||||
modelBreakdown: [
|
||||
{
|
||||
modelKey: 'MODEL_PLACEHOLDER_M37',
|
||||
modelShort: 'gemini-4-carbon',
|
||||
modelShort: 'carbon-4-high',
|
||||
modelLabel: 'Gemini 4 Carbon (High)',
|
||||
modelUpstream: 'gemini-4-carbon-high',
|
||||
upstreamModel: 'gemini-4-carbon-high',
|
||||
calls: 16,
|
||||
inputTokens: 152400,
|
||||
@@ -22505,6 +22529,8 @@ function buildStructurePreviewTelemetry(baseSettings = {}, draftOverrides = {})
|
||||
agentId: 'sub-1',
|
||||
cascadeId: 'mock-sub-1',
|
||||
isMain: false,
|
||||
agentKind: 'subagent',
|
||||
agentOrdinal: 1,
|
||||
index: 1,
|
||||
badgeText: '子1',
|
||||
shortLabel: `${t('fmt.subAgent')} #1`,
|
||||
@@ -22528,18 +22554,19 @@ function buildStructurePreviewTelemetry(baseSettings = {}, draftOverrides = {})
|
||||
outputTokens: 6300,
|
||||
totalTokens: 320300,
|
||||
latestModelLabel: 'Gemini 3.8 Flash',
|
||||
latestModelShort: 'gemini-3.8-flash',
|
||||
latestModelShort: 'flash-3.8',
|
||||
latestRawModel: 'MODEL_PLACEHOLDER_M42',
|
||||
latestUpstreamModel: 'gemini-3.8-flash-n',
|
||||
activeModelLabel: 'Gemini 3.8 Flash',
|
||||
activeModelShort: 'gemini-3.8-flash',
|
||||
activeModelShort: 'flash-3.8',
|
||||
activeModelUpstream: 'gemini-3.8-flash-n',
|
||||
sessionUnpricedCalls: 0,
|
||||
modelBreakdown: [
|
||||
{
|
||||
modelKey: 'MODEL_PLACEHOLDER_M42',
|
||||
modelShort: 'gemini-3.8-flash',
|
||||
modelShort: 'flash-3.8',
|
||||
modelLabel: 'Gemini 3.8 Flash',
|
||||
modelUpstream: 'gemini-3.8-flash-n',
|
||||
upstreamModel: 'gemini-3.8-flash-n',
|
||||
calls: 8,
|
||||
inputTokens: 34000,
|
||||
@@ -22562,9 +22589,9 @@ function buildStructurePreviewTelemetry(baseSettings = {}, draftOverrides = {})
|
||||
agentKind: 'all',
|
||||
agentOrdinal: 0,
|
||||
badgeText: t('header.scopeAllShort'),
|
||||
activeAgentId: 'main',
|
||||
activeAgentKind: 'main',
|
||||
activeAgentOrdinal: 0,
|
||||
activeAgentId: 'sub-1',
|
||||
activeAgentKind: 'subagent',
|
||||
activeAgentOrdinal: 1,
|
||||
stepCount: 24,
|
||||
speedSampleCount: 23,
|
||||
speedSummary: { sampleCount: 23, excludedCount: 1 },
|
||||
@@ -22578,7 +22605,7 @@ function buildStructurePreviewTelemetry(baseSettings = {}, draftOverrides = {})
|
||||
cacheReadTokens: 1540000,
|
||||
outputTokens: 28400,
|
||||
totalTokens: 1754800,
|
||||
activeAgentBadge: t('fmt.mainBadge'),
|
||||
activeAgentBadge: '子1',
|
||||
modelBreakdown: [...mainAgent.modelBreakdown, ...subAgent1.modelBreakdown],
|
||||
recentSteps: mockSteps,
|
||||
};
|
||||
@@ -25137,75 +25164,113 @@ function isSameList(a, b) {
|
||||
return true;
|
||||
}
|
||||
|
||||
function formatCliPreviewSlot(slotKey, isEn) {
|
||||
function formatCliPreviewSlot(slotKey, slotCtx, isEn) {
|
||||
const safeCtx = slotCtx || {};
|
||||
const quotas = safeCtx.quotas || {};
|
||||
const quotaPct = (key, fallback) => {
|
||||
const summary = resolveSpecificQuotaSlotSummary(quotas, key);
|
||||
return summary && Number.isFinite(summary.roundedPct) ? summary.roundedPct : fallback;
|
||||
};
|
||||
switch (slotKey) {
|
||||
case 'tps':
|
||||
return { prefix: '', text: '68.4 t/s', tone: 'good', pillPct: null };
|
||||
case 'avg_tps':
|
||||
case 'tps': {
|
||||
const val = Number.isFinite(Number(safeCtx.tps)) ? Number(safeCtx.tps).toFixed(1) : '68.4';
|
||||
return { prefix: '', text: `${val} t/s`, tone: 'good', pillPct: null };
|
||||
}
|
||||
case 'avg_tps': {
|
||||
const val = Number.isFinite(Number(safeCtx.avgTps)) ? Number(safeCtx.avgTps).toFixed(1) : '59.6';
|
||||
return {
|
||||
prefix: '',
|
||||
text: isEn ? 'avg 54.0' : '均 54.0',
|
||||
text: isEn ? `avg ${val}` : `均 ${val}`,
|
||||
tone: 'info',
|
||||
pillPct: null,
|
||||
};
|
||||
case 'ttft':
|
||||
return { prefix: '', text: '1.1s', tone: 'good', pillPct: null };
|
||||
case 'cost':
|
||||
return { prefix: '', text: '$0.040', tone: 'normal', pillPct: null };
|
||||
case 'session_cost':
|
||||
return { prefix: '', text: '$0.42', tone: 'normal', pillPct: null };
|
||||
case 'cache_hit':
|
||||
}
|
||||
case 'ttft': {
|
||||
const val = Number.isFinite(Number(safeCtx.ttft)) ? formatMetric(Number(safeCtx.ttft), 's') : '1.1s';
|
||||
return { prefix: '', text: val, tone: 'good', pillPct: null };
|
||||
}
|
||||
case 'cost': {
|
||||
const num = Number.isFinite(Number(safeCtx.stepCost)) ? Number(safeCtx.stepCost) : 0.042;
|
||||
return { prefix: '', text: `$${num.toFixed(3)}`, tone: 'normal', pillPct: null };
|
||||
}
|
||||
case 'session_cost': {
|
||||
const num = Number.isFinite(Number(safeCtx.sessionCost)) ? Number(safeCtx.sessionCost) : 1.28;
|
||||
return { prefix: '', text: formatUsd(num), tone: 'normal', pillPct: null };
|
||||
}
|
||||
case 'cache_hit': {
|
||||
const pct = Number.isFinite(Number(safeCtx.cacheHitPct))
|
||||
? Math.round(Number(safeCtx.cacheHitPct))
|
||||
: 95;
|
||||
return {
|
||||
prefix: '',
|
||||
text: isEn ? 'cache 92%' : '缓 92%',
|
||||
text: isEn ? `cache ${pct}%` : `缓 ${pct}%`,
|
||||
tone: 'good',
|
||||
pillPct: null,
|
||||
};
|
||||
case 'session_tokens':
|
||||
return { prefix: '', text: '142K tok', tone: 'muted', pillPct: null };
|
||||
case 'quota_auto':
|
||||
}
|
||||
case 'session_tokens': {
|
||||
const tokStr = Number.isFinite(Number(safeCtx.sessionTokens))
|
||||
? formatTokens(Number(safeCtx.sessionTokens))
|
||||
: '1.8M';
|
||||
return { prefix: '', text: `${tokStr} tok`, tone: 'muted', pillPct: null };
|
||||
}
|
||||
case 'quota_auto': {
|
||||
const pct = quotaPct('quota_auto', 64);
|
||||
return {
|
||||
prefix: isEn ? '5h ' : '余 ',
|
||||
text: '64%',
|
||||
text: `${pct}%`,
|
||||
tone: 'good',
|
||||
pillPct: 64,
|
||||
pillPct: pct,
|
||||
};
|
||||
case 'gemini_5h':
|
||||
}
|
||||
case 'gemini_5h': {
|
||||
const pct = quotaPct('gemini_5h', 64);
|
||||
return {
|
||||
prefix: 'G5h ',
|
||||
text: '64%',
|
||||
text: `${pct}%`,
|
||||
tone: 'good',
|
||||
pillPct: 64,
|
||||
pillPct: pct,
|
||||
};
|
||||
case 'gemini_weekly':
|
||||
}
|
||||
case 'gemini_weekly': {
|
||||
const pct = quotaPct('gemini_weekly', 52);
|
||||
return {
|
||||
prefix: isEn ? 'Gw ' : 'G周 ',
|
||||
text: '88%',
|
||||
text: `${pct}%`,
|
||||
tone: 'good',
|
||||
pillPct: 88,
|
||||
pillPct: pct,
|
||||
};
|
||||
case 'claude_5h':
|
||||
}
|
||||
case 'claude_5h': {
|
||||
const pct = quotaPct('claude_5h', 32);
|
||||
return {
|
||||
prefix: 'C5h ',
|
||||
text: '96%',
|
||||
text: `${pct}%`,
|
||||
tone: 'good',
|
||||
pillPct: 96,
|
||||
pillPct: pct,
|
||||
};
|
||||
case 'claude_weekly':
|
||||
}
|
||||
case 'claude_weekly': {
|
||||
const pct = quotaPct('claude_weekly', 59);
|
||||
return {
|
||||
prefix: isEn ? 'Cw ' : 'C周 ',
|
||||
text: '99%',
|
||||
text: `${pct}%`,
|
||||
tone: 'good',
|
||||
pillPct: 99,
|
||||
pillPct: pct,
|
||||
};
|
||||
}
|
||||
case 'context':
|
||||
default:
|
||||
default: {
|
||||
const pct = Number.isFinite(Number(safeCtx.usedPct))
|
||||
? Math.round(Number(safeCtx.usedPct))
|
||||
: 56;
|
||||
return {
|
||||
prefix: isEn ? 'Ctx ' : '上下文 ',
|
||||
text: '56%',
|
||||
text: `${pct}%`,
|
||||
tone: 'accent',
|
||||
pillPct: 56,
|
||||
pillPct: pct,
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25364,10 +25429,6 @@ const SettingsStructureTab = defineComponent({
|
||||
className: 'form-label',
|
||||
text: t('settings.str.popoverWidthLabel'),
|
||||
});
|
||||
const popoverWidthHintEl = h('span', {
|
||||
className: 'settings-hint-text',
|
||||
text: t('settings.str.popoverWidthHint'),
|
||||
});
|
||||
const multiToggleLabelEl = h('span', {
|
||||
className: 'form-label',
|
||||
text: t('settings.str.multiToggle'),
|
||||
@@ -25376,10 +25437,6 @@ const SettingsStructureTab = defineComponent({
|
||||
className: 'form-label',
|
||||
text: t('settings.str.contextAgentModeLabel'),
|
||||
});
|
||||
const contextAgentModeHintEl = h('span', {
|
||||
className: 'settings-hint-text',
|
||||
text: t('settings.str.contextAgentModeHint'),
|
||||
});
|
||||
const cliCapsuleLabelEl = h('span', {
|
||||
className: 'form-label',
|
||||
text: t('settings.str.cliCapsuleToggle'),
|
||||
@@ -25532,7 +25589,7 @@ const SettingsStructureTab = defineComponent({
|
||||
});
|
||||
|
||||
const cliPreviewMultiTextEl = h('span', {
|
||||
text: t('settings.str.cliPreviewRunning', { count: 2 }),
|
||||
text: t('settings.str.cliPreviewRunning', { count: 1 }),
|
||||
});
|
||||
const cliPreviewMultiEl = h('span', { className: 'cli-preview-multi' }, [
|
||||
h('span', { className: 'cli-preview-dot', 'aria-hidden': 'true', text: '●' }),
|
||||
@@ -25660,37 +25717,42 @@ const SettingsStructureTab = defineComponent({
|
||||
h('div', { className: 'settings-divider' }),
|
||||
h('div', { className: 'form-row' }, [mountModeLabelEl, windowMountSelect.el]),
|
||||
mountBridgeNotice.el,
|
||||
h('div', { className: 'form-row' }, [
|
||||
h('div', { className: 'settings-inline-row' }, [
|
||||
popoverWidthLabelEl,
|
||||
h('div', { className: 'settings-inline-controls' }, [
|
||||
popoverWidthModeToggle.el,
|
||||
popoverWidthNumWrap,
|
||||
]),
|
||||
h('div', { className: 'settings-inline-row' }, [
|
||||
popoverWidthLabelEl,
|
||||
h('div', { className: 'settings-inline-controls' }, [
|
||||
popoverWidthModeToggle.el,
|
||||
popoverWidthNumWrap,
|
||||
]),
|
||||
popoverWidthHintEl,
|
||||
]),
|
||||
h('div', { className: 'settings-inline-row' }, [
|
||||
multiToggleLabelEl,
|
||||
multiSessionToggle.el,
|
||||
]),
|
||||
h('div', { className: 'form-row' }, [
|
||||
h('div', { className: 'settings-inline-row' }, [
|
||||
contextAgentModeLabelEl,
|
||||
contextAgentModeToggle.el,
|
||||
]),
|
||||
contextAgentModeHintEl,
|
||||
h('div', { className: 'settings-inline-row' }, [
|
||||
contextAgentModeLabelEl,
|
||||
contextAgentModeToggle.el,
|
||||
]),
|
||||
h('div', { className: 'form-row' }, [capsuleSlotsLabelEl, topbarSlotsList.el]),
|
||||
cliStatusGroupEl,
|
||||
],
|
||||
});
|
||||
|
||||
function refreshCliPreview() {
|
||||
function refreshCliPreview(previewData = null) {
|
||||
const effectiveSlots = getEffectiveDraftCliSlots();
|
||||
const isEn = getEffectiveLocale() === 'en-US';
|
||||
const mockData = previewData || buildDraftTelemetry();
|
||||
const { scopedConv, ctxAgent, aggregated } = resolveScopedConversation(
|
||||
mockData,
|
||||
'all',
|
||||
resolveOverlayCtxInspectorAgentId(mockData, 'auto')
|
||||
);
|
||||
const slotCtx = buildCapsuleSlotContext(mockData, { scopedConv, ctxAgent, aggregated });
|
||||
const runningCount = Math.max(
|
||||
1,
|
||||
Array.isArray(mockData?.runningConversations) ? mockData.runningConversations.length : 1
|
||||
);
|
||||
patchAttr(cliPreviewMultiEl, 'hidden', !draftShowTopbarMulti);
|
||||
patchText(cliPreviewMultiTextEl, t('settings.str.cliPreviewRunning', { count: 2 }));
|
||||
patchText(cliPreviewMultiTextEl, t('settings.str.cliPreviewRunning', { count: runningCount }));
|
||||
for (let i = 0; i < cliPreviewSlotParts.length; i += 1) {
|
||||
const parts = cliPreviewSlotParts[i];
|
||||
const sepEl = i > 0 ? cliPreviewSepEls[i - 1] : null;
|
||||
@@ -25699,7 +25761,7 @@ const SettingsStructureTab = defineComponent({
|
||||
patchAttr(parts.slotEl, 'hidden', !visible);
|
||||
if (sepEl) patchAttr(sepEl, 'hidden', !visible);
|
||||
if (visible) {
|
||||
const item = formatCliPreviewSlot(key, isEn);
|
||||
const item = formatCliPreviewSlot(key, slotCtx, isEn);
|
||||
const isPill = Number.isFinite(item.pillPct);
|
||||
patchAttr(parts.slotEl, 'data-metric', key);
|
||||
patchText(parts.prefixEl, item.prefix || '');
|
||||
@@ -25718,8 +25780,9 @@ const SettingsStructureTab = defineComponent({
|
||||
|
||||
function refreshMountPreview() {
|
||||
if (!isStructureVisible() || activeThirdTab !== 'mount') return;
|
||||
capsulePreviewWidget.refs.update({ data: buildDraftTelemetry() });
|
||||
refreshCliPreview();
|
||||
const mockData = buildDraftTelemetry();
|
||||
capsulePreviewWidget.refs.update({ data: mockData });
|
||||
refreshCliPreview(mockData);
|
||||
}
|
||||
|
||||
function syncMountSectionMeta() {
|
||||
@@ -26460,11 +26523,9 @@ const SettingsStructureTab = defineComponent({
|
||||
mountSection.refs.setResetLabel(t('settings.resetBtn'));
|
||||
patchText(mountModeLabelEl, t('settings.str.mountMode'));
|
||||
patchText(popoverWidthLabelEl, t('settings.str.popoverWidthLabel'));
|
||||
patchText(popoverWidthHintEl, t('settings.str.popoverWidthHint'));
|
||||
popoverWidthStepper.setProps({ ariaLabel: t('settings.str.popoverWidthLabel') });
|
||||
patchText(multiToggleLabelEl, t('settings.str.multiToggle'));
|
||||
patchText(contextAgentModeLabelEl, t('settings.str.contextAgentModeLabel'));
|
||||
patchText(contextAgentModeHintEl, t('settings.str.contextAgentModeHint'));
|
||||
patchText(cliCapsuleLabelEl, t('settings.str.cliCapsuleToggle'));
|
||||
patchText(cliSlotsLabelEl, t('settings.str.cliSlotsLabel'));
|
||||
patchText(capsuleSlotsLabelEl, t('settings.str.capsuleSlotsLabel'));
|
||||
|
||||
@@ -4,11 +4,11 @@
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>用量监控</title>
|
||||
<link rel="stylesheet" href="/styles.css?v=1795334334959">
|
||||
<link rel="stylesheet" href="/styles.css?v=1795336545749">
|
||||
<script src="/preload.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="app-root"></div>
|
||||
<script src="/app.js?v=1795334334959"></script>
|
||||
<script src="/app.js?v=1795336545749"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -186,10 +186,12 @@ export function buildStructurePreviewTelemetry(baseSettings = {}, draftOverrides
|
||||
isSubagent: false,
|
||||
agentBadge: '主',
|
||||
agentLabel: t('fmt.mainAgent'),
|
||||
modelLabel: 'Gemini 4 Carbon (High)',
|
||||
modelShort: 'gemini-4-carbon',
|
||||
rawModel: 'MODEL_PLACEHOLDER_M37',
|
||||
upstreamModel: 'gemini-4-carbon-high',
|
||||
modelKey: 'MODEL_PLACEHOLDER_M667',
|
||||
modelLabel: 'Gemini Pro Orchestrator (Carbon)',
|
||||
modelShort: 'orchestrator-carbon',
|
||||
rawModel: 'MODEL_PLACEHOLDER_M667',
|
||||
modelUpstream: 'gemini-pro-orchestrator',
|
||||
upstreamModel: 'gemini-pro-orchestrator',
|
||||
tokPerSec: 17.8,
|
||||
ttftSec: 19.4,
|
||||
totalDurationSec: 31.2,
|
||||
@@ -243,18 +245,19 @@ export function buildStructurePreviewTelemetry(baseSettings = {}, draftOverrides
|
||||
outputTokens: 22100,
|
||||
totalTokens: 1434500,
|
||||
latestModelLabel: 'Gemini 4 Carbon (High)',
|
||||
latestModelShort: 'gemini-4-carbon',
|
||||
latestModelShort: 'carbon-4-high',
|
||||
latestRawModel: 'MODEL_PLACEHOLDER_M37',
|
||||
latestUpstreamModel: 'gemini-4-carbon-high',
|
||||
activeModelLabel: 'Gemini 4 Carbon (High)',
|
||||
activeModelShort: 'gemini-4-carbon',
|
||||
activeModelShort: 'carbon-4-high',
|
||||
activeModelUpstream: 'gemini-4-carbon-high',
|
||||
sessionUnpricedCalls: 0,
|
||||
modelBreakdown: [
|
||||
{
|
||||
modelKey: 'MODEL_PLACEHOLDER_M37',
|
||||
modelShort: 'gemini-4-carbon',
|
||||
modelShort: 'carbon-4-high',
|
||||
modelLabel: 'Gemini 4 Carbon (High)',
|
||||
modelUpstream: 'gemini-4-carbon-high',
|
||||
upstreamModel: 'gemini-4-carbon-high',
|
||||
calls: 16,
|
||||
inputTokens: 152400,
|
||||
@@ -274,6 +277,8 @@ export function buildStructurePreviewTelemetry(baseSettings = {}, draftOverrides
|
||||
agentId: 'sub-1',
|
||||
cascadeId: 'mock-sub-1',
|
||||
isMain: false,
|
||||
agentKind: 'subagent',
|
||||
agentOrdinal: 1,
|
||||
index: 1,
|
||||
badgeText: '子1',
|
||||
shortLabel: `${t('fmt.subAgent')} #1`,
|
||||
@@ -297,18 +302,19 @@ export function buildStructurePreviewTelemetry(baseSettings = {}, draftOverrides
|
||||
outputTokens: 6300,
|
||||
totalTokens: 320300,
|
||||
latestModelLabel: 'Gemini 3.8 Flash',
|
||||
latestModelShort: 'gemini-3.8-flash',
|
||||
latestModelShort: 'flash-3.8',
|
||||
latestRawModel: 'MODEL_PLACEHOLDER_M42',
|
||||
latestUpstreamModel: 'gemini-3.8-flash-n',
|
||||
activeModelLabel: 'Gemini 3.8 Flash',
|
||||
activeModelShort: 'gemini-3.8-flash',
|
||||
activeModelShort: 'flash-3.8',
|
||||
activeModelUpstream: 'gemini-3.8-flash-n',
|
||||
sessionUnpricedCalls: 0,
|
||||
modelBreakdown: [
|
||||
{
|
||||
modelKey: 'MODEL_PLACEHOLDER_M42',
|
||||
modelShort: 'gemini-3.8-flash',
|
||||
modelShort: 'flash-3.8',
|
||||
modelLabel: 'Gemini 3.8 Flash',
|
||||
modelUpstream: 'gemini-3.8-flash-n',
|
||||
upstreamModel: 'gemini-3.8-flash-n',
|
||||
calls: 8,
|
||||
inputTokens: 34000,
|
||||
@@ -331,9 +337,9 @@ export function buildStructurePreviewTelemetry(baseSettings = {}, draftOverrides
|
||||
agentKind: 'all',
|
||||
agentOrdinal: 0,
|
||||
badgeText: t('header.scopeAllShort'),
|
||||
activeAgentId: 'main',
|
||||
activeAgentKind: 'main',
|
||||
activeAgentOrdinal: 0,
|
||||
activeAgentId: 'sub-1',
|
||||
activeAgentKind: 'subagent',
|
||||
activeAgentOrdinal: 1,
|
||||
stepCount: 24,
|
||||
speedSampleCount: 23,
|
||||
speedSummary: { sampleCount: 23, excludedCount: 1 },
|
||||
@@ -347,7 +353,7 @@ export function buildStructurePreviewTelemetry(baseSettings = {}, draftOverrides
|
||||
cacheReadTokens: 1540000,
|
||||
outputTokens: 28400,
|
||||
totalTokens: 1754800,
|
||||
activeAgentBadge: t('fmt.mainBadge'),
|
||||
activeAgentBadge: '子1',
|
||||
modelBreakdown: [...mainAgent.modelBreakdown, ...subAgent1.modelBreakdown],
|
||||
recentSteps: mockSteps,
|
||||
};
|
||||
|
||||
@@ -310,6 +310,7 @@ export function createCapsuleSlotNode(slotIndex, initialMetric) {
|
||||
|
||||
const isNone = initialMetric === 'none';
|
||||
const isCtx = initialMetric === 'context';
|
||||
const prefixSpan = h('span', { className: 'wm-slot-prefix' });
|
||||
const textSpan = h('span', {
|
||||
className: isCtx ? 'wm-slot-text wm-ctx-pct' : 'wm-slot-text',
|
||||
text: isNone
|
||||
@@ -320,7 +321,7 @@ export function createCapsuleSlotNode(slotIndex, initialMetric) {
|
||||
? '-- t/s'
|
||||
: initialMetric === 'ttft'
|
||||
? '--s'
|
||||
: t('capsule.quotaUnknown'),
|
||||
: '--%',
|
||||
});
|
||||
const el = h(
|
||||
'span',
|
||||
@@ -346,8 +347,10 @@ export function createCapsuleSlotNode(slotIndex, initialMetric) {
|
||||
el,
|
||||
ringSvg,
|
||||
ringFill,
|
||||
prefixSpan,
|
||||
textSpan,
|
||||
ringMounted: isCtx,
|
||||
prefixMounted: false,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -374,13 +377,25 @@ export function syncCapsuleSlotNodes(capsuleSlots, capsuleSeps, slotKeys, slotCt
|
||||
patchAttr(slot.el, 'data-vis-rank', String(visRank));
|
||||
|
||||
if (pres.showRing && !slot.ringMounted) {
|
||||
slot.el.insertBefore(slot.ringSvg, slot.textSpan);
|
||||
slot.el.insertBefore(slot.ringSvg, slot.el.firstChild || slot.textSpan);
|
||||
slot.ringMounted = true;
|
||||
} else if (!pres.showRing && slot.ringMounted) {
|
||||
slot.ringSvg.remove();
|
||||
slot.ringMounted = false;
|
||||
}
|
||||
|
||||
const prefixText = String(pres.prefix || '');
|
||||
if (prefixText) {
|
||||
patchText(slot.prefixSpan, prefixText);
|
||||
if (!slot.prefixMounted) {
|
||||
slot.el.insertBefore(slot.prefixSpan, slot.textSpan);
|
||||
slot.prefixMounted = true;
|
||||
}
|
||||
} else if (slot.prefixMounted) {
|
||||
slot.prefixSpan.remove();
|
||||
slot.prefixMounted = false;
|
||||
}
|
||||
|
||||
const toneCls =
|
||||
pres.toneClass || (pres.danger ? 'tone-danger' : pres.warn ? 'tone-warn' : '');
|
||||
const fullSegClass = `${pres.segClass}${pres.running ? ' state-running' : ''}${toneCls ? ` ${toneCls}` : ''}`;
|
||||
@@ -391,7 +406,12 @@ export function syncCapsuleSlotNodes(capsuleSlots, capsuleSeps, slotKeys, slotCt
|
||||
|
||||
if (pres.showRing) {
|
||||
slot.ringFill.setAttribute('stroke-dashoffset', String(pres.dashOffset));
|
||||
patchClasses(slot.ringFill, { 'tone-warn': pres.warn, 'tone-danger': pres.danger });
|
||||
patchClasses(slot.ringFill, {
|
||||
'is-quota': pres.ringKind === 'quota',
|
||||
'is-empty': pres.ringEmpty === true,
|
||||
'tone-warn': pres.warn,
|
||||
'tone-danger': pres.danger,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -88,7 +88,7 @@ export function createPoolQuotaRow() {
|
||||
h('div', { className: 'progress-track' }, [fillWk]),
|
||||
]);
|
||||
|
||||
const el = h('div', { style: 'display: flex; flex-direction: column; gap: 8px;' }, [
|
||||
const el = h('div', { className: 'quota-pool-row' }, [
|
||||
row5h,
|
||||
rowWk,
|
||||
]);
|
||||
@@ -138,13 +138,7 @@ export function formatQuotaSummaryFooter(quotas, account) {
|
||||
*/
|
||||
export function syncPoolQuotaRow(refs, item, idx, rowEl) {
|
||||
const { poolData, poolLabel, fallbackWeekly, isActivePool, isPending } = item;
|
||||
patchAttr(
|
||||
rowEl,
|
||||
'style',
|
||||
idx === 0
|
||||
? 'display: flex; flex-direction: column; gap: 8px;'
|
||||
: 'display: flex; flex-direction: column; gap: 8px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border-hairline);'
|
||||
);
|
||||
patchClasses(rowEl, { 'quota-pool-row': true, 'has-divider': idx > 0 });
|
||||
|
||||
const has5h = poolData?.usedPct != null && poolData?.remainingPct != null;
|
||||
const used5hVal = has5h ? Number(poolData.usedPct) : 0;
|
||||
@@ -289,13 +283,6 @@ export const QuotaPoolsWidget = defineComponent({
|
||||
});
|
||||
}
|
||||
|
||||
const initFoot = formatQuotaSummaryFooter(null, null);
|
||||
const wkFootLeft = h('span', { className: 'text-muted', text: initFoot.leftText });
|
||||
const wkFootRight = h('span', {
|
||||
className: 'text-muted',
|
||||
text: compactHover ? initFoot.rightText : '',
|
||||
});
|
||||
|
||||
const quotaPanel = h('section', { className: 'panel' }, [
|
||||
h('div', { className: 'panel-header' }, [
|
||||
h('span', { className: 'panel-title' }, [
|
||||
@@ -305,13 +292,6 @@ export const QuotaPoolsWidget = defineComponent({
|
||||
tierBadge,
|
||||
]),
|
||||
poolsListEl,
|
||||
h(
|
||||
'div',
|
||||
compactHover
|
||||
? { className: 'panel-header wm-hover-quota-foot' }
|
||||
: { className: 'panel-header', style: 'font-size: var(--fs-md); padding-top: 2px;' },
|
||||
[wkFootLeft, wkFootRight]
|
||||
),
|
||||
]);
|
||||
|
||||
function update({ data, minuteTick } = {}) {
|
||||
@@ -324,9 +304,6 @@ export const QuotaPoolsWidget = defineComponent({
|
||||
createRow: createPoolQuotaRow,
|
||||
updateRow: syncPoolQuotaRow,
|
||||
});
|
||||
const pendingFoot = formatQuotaSummaryFooter(null, null);
|
||||
patchText(wkFootLeft, pendingFoot.leftText);
|
||||
patchText(wkFootRight, pendingFoot.rightText);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -343,12 +320,6 @@ export const QuotaPoolsWidget = defineComponent({
|
||||
createRow: createPoolQuotaRow,
|
||||
updateRow: syncPoolQuotaRow,
|
||||
});
|
||||
|
||||
const footSummary = formatQuotaSummaryFooter(quotas, data.account);
|
||||
patchText(wkFootLeft, footSummary.leftText);
|
||||
patchText(wkFootRight, footSummary.rightText);
|
||||
patchAttr(wkFootLeft, 'title', footSummary.tooltip);
|
||||
patchAttr(wkFootRight, 'title', footSummary.tooltip);
|
||||
}
|
||||
|
||||
return {
|
||||
|
||||
@@ -616,6 +616,7 @@ export function resolveModelDisplayInfo(target, settings = {}, options = {}) {
|
||||
target.baseModelUpstream ??
|
||||
target.activeModelUpstream ??
|
||||
target.modelUpstream ??
|
||||
target.upstreamModel ??
|
||||
target.upstreamName ??
|
||||
''
|
||||
).trim();
|
||||
|
||||
@@ -618,7 +618,6 @@ export const I18N_MESSAGES_EN_US = Object.freeze({
|
||||
'settings.str.popoverWidthHint': 'Auto Fit widens wide tables like Step Records to avoid horizontal scroll; Custom accepts 440–1080 px',
|
||||
'settings.str.multiToggle': 'Active Sessions Pill',
|
||||
'settings.str.contextAgentModeLabel': 'Capsule & Hover Context',
|
||||
'settings.str.contextAgentModeHint': 'Lock to Main Agent keeps the topbar percentage and hover HUD on Main Agent; you can still inspect subagents inside the full panel',
|
||||
'settings.str.contextAgentMain': 'Lock Main Agent',
|
||||
'settings.str.contextAgentAuto': 'Follow Active',
|
||||
'settings.str.cliCapsuleToggle': 'CLI Bottom Capsule',
|
||||
|
||||
@@ -618,7 +618,6 @@ export const I18N_MESSAGES_ZH_CN = Object.freeze({
|
||||
'settings.str.popoverWidthHint': '自适应模式下在调用明细等宽表格视图自动撑宽免水平滚动;指定宽度范围 440~1080 px',
|
||||
'settings.str.multiToggle': '实时运行会话入口',
|
||||
'settings.str.contextAgentModeLabel': '胶囊及悬浮上下文',
|
||||
'settings.str.contextAgentModeHint': '锁定主代理时,顶栏百分比及悬停速览始终展示主代理;完整面板内仍可随时点选子代理明细',
|
||||
'settings.str.contextAgentMain': '锁定主代理',
|
||||
'settings.str.contextAgentAuto': '跟随活跃',
|
||||
'settings.str.cliCapsuleToggle': 'CLI 底部状态胶囊',
|
||||
|
||||
@@ -96,9 +96,22 @@ export function resolveQuotaCapsuleSummary(quotas) {
|
||||
? `${tightest.label} ${tightest.windowTag} · ${runnerUp.windowTag} ${runnerPct}%`
|
||||
: `${tightest.label} ${tightest.windowTag} · ${runnerUp.label} ${runnerUp.windowTag} ${runnerPct}%`
|
||||
: `${tightest.label} · ${tightest.windowTag}`;
|
||||
const tightestIsClaude = /claude|gpt|fable|oss|third/i.test(String(tightest.label || ''));
|
||||
const tightestIsGemini = !tightestIsClaude && /gemini|argon|carbon|neon|flash|pro/i.test(String(tightest.label || ''));
|
||||
const tightestWinShort = tightest.windowTag === '5h' ? '5h' : isEnglishLocale() ? 'w' : '周';
|
||||
const poolPrefix = tightestIsClaude
|
||||
? `C${tightestWinShort}`
|
||||
: tightestIsGemini
|
||||
? `G${tightestWinShort}`
|
||||
: tightest.windowTag === '5h'
|
||||
? '5h'
|
||||
: isEnglishLocale()
|
||||
? 'Wk'
|
||||
: '周';
|
||||
return {
|
||||
roundedPct: rounded,
|
||||
shortText: t('capsule.quotaLeft', { pct: rounded }),
|
||||
poolPrefix,
|
||||
subLabelText,
|
||||
detailText: candidates
|
||||
.map((c) => {
|
||||
@@ -109,6 +122,16 @@ export function resolveQuotaCapsuleSummary(quotas) {
|
||||
};
|
||||
}
|
||||
|
||||
function resolveQuotaCapsulePrefix(metricKey, quotaSum) {
|
||||
const isEn = isEnglishLocale();
|
||||
if (metricKey === 'gemini_5h') return 'G5h';
|
||||
if (metricKey === 'gemini_weekly') return isEn ? 'Gw' : 'G周';
|
||||
if (metricKey === 'claude_5h') return 'C5h';
|
||||
if (metricKey === 'claude_weekly') return isEn ? 'Cw' : 'C周';
|
||||
if (quotaSum?.poolPrefix) return quotaSum.poolPrefix;
|
||||
return isEn ? 'Q' : '余';
|
||||
}
|
||||
|
||||
/**
|
||||
* 解析指定模型池(Gemini 或 Claude & GPT)与指定时间窗口(5h 或周额度)的剩余百分比摘要。
|
||||
*
|
||||
@@ -328,17 +351,25 @@ export function resolveCapsuleMetricPresentation(metricKey, slotCtx, ringCircumf
|
||||
: metricKey === 'quota_auto'
|
||||
? resolveQuotaCapsuleSummary(slotCtx.quotas)
|
||||
: resolveSpecificQuotaSlotSummary(slotCtx.quotas, metricKey);
|
||||
const isDanger = Boolean(quotaSum && quotaSum.roundedPct <= 15);
|
||||
const isWarn = Boolean(quotaSum && !isDanger && quotaSum.roundedPct <= 30);
|
||||
const hasQuotaPct = Boolean(quotaSum && Number.isFinite(quotaSum.roundedPct));
|
||||
const clampedPct = hasQuotaPct ? Math.max(0, Math.min(100, quotaSum.roundedPct)) : 0;
|
||||
const quotaDashOffset = hasQuotaPct
|
||||
? +(ringCircumference * (1 - clampedPct / 100)).toFixed(2)
|
||||
: ringCircumference;
|
||||
const isDanger = Boolean(hasQuotaPct && clampedPct <= 15);
|
||||
const isWarn = Boolean(hasQuotaPct && !isDanger && clampedPct <= 30);
|
||||
const toneClass = isDanger ? 'tone-danger' : isWarn ? 'tone-warn' : '';
|
||||
return {
|
||||
hidden: false,
|
||||
metric: metricKey,
|
||||
segClass: 'wm-cap-slot wm-seg-quota',
|
||||
textClass: 'wm-slot-text wm-quota-text',
|
||||
showRing: false,
|
||||
dashOffset: ringCircumference,
|
||||
text: quotaSum ? quotaSum.shortText : t('capsule.quotaUnknown'),
|
||||
showRing: true,
|
||||
ringKind: 'quota',
|
||||
ringEmpty: !hasQuotaPct,
|
||||
dashOffset: quotaDashOffset,
|
||||
prefix: resolveQuotaCapsulePrefix(metricKey, quotaSum),
|
||||
text: hasQuotaPct ? `${clampedPct}%` : '--%',
|
||||
toneClass,
|
||||
running: false,
|
||||
warn: isWarn,
|
||||
|
||||
@@ -650,6 +650,7 @@ html[data-standalone="true"][data-modern-ui="true"] .app-shell {
|
||||
[data-modern-ui="true"] .structure-preview-empty,
|
||||
[data-modern-ui="true"] .preview-sidebar-note,
|
||||
[data-modern-ui="true"] .preview-capsule-bar,
|
||||
[data-modern-ui="true"] .cli-status-preview,
|
||||
[data-modern-ui="true"] .preview-capsule-bar.is-composer .wm-multi-btn,
|
||||
[data-modern-ui="true"] .preview-capsule-bar.is-composer .wm-capsule-btn,
|
||||
[data-modern-ui="true"] .preview-composer-chip {
|
||||
@@ -657,6 +658,10 @@ html[data-standalone="true"][data-modern-ui="true"] .app-shell {
|
||||
background: var(--modern-surface-subtle);
|
||||
}
|
||||
|
||||
[data-modern-ui="true"][data-color-scheme="light"] .quota-pool-row.has-divider {
|
||||
border-top-color: hsl(216 24% 92%);
|
||||
}
|
||||
|
||||
[data-modern-ui="true"] .slot-add-btn,
|
||||
[data-modern-ui="true"] .settings-bridge-relaunch-btn {
|
||||
border: none;
|
||||
@@ -940,8 +945,10 @@ html[data-standalone="true"][data-modern-ui="true"] .app-shell {
|
||||
}
|
||||
|
||||
:host([data-modern-ui="true"]) .wm-slot-text.wm-ctx-pct[data-od-active="1"],
|
||||
:host([data-modern-ui="true"]) .wm-slot-text.wm-quota-text[data-od-active="1"],
|
||||
:host([data-modern-ui="true"]) .wm-multi-label[data-od-active="1"],
|
||||
[data-modern-ui="true"] .wm-slot-text.wm-ctx-pct[data-od-active="1"],
|
||||
[data-modern-ui="true"] .wm-slot-text.wm-quota-text[data-od-active="1"],
|
||||
[data-modern-ui="true"] .wm-multi-label[data-od-active="1"] {
|
||||
justify-content: flex-start;
|
||||
}
|
||||
|
||||
@@ -262,6 +262,14 @@
|
||||
stroke var(--dur-fast) var(--ease-fast);
|
||||
}
|
||||
|
||||
.wm-ring-fill.is-quota {
|
||||
stroke: var(--metric-ok);
|
||||
}
|
||||
|
||||
.wm-ring-fill.is-empty {
|
||||
stroke: transparent;
|
||||
}
|
||||
|
||||
.wm-ring-fill.tone-warn {
|
||||
stroke: var(--metric-warn);
|
||||
}
|
||||
@@ -324,14 +332,35 @@
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
/* 配额槽位(固定预占宽度 52px 居中对齐,完整容纳 余 100% / 余 --% 且在任意槽位对称) */
|
||||
/* 配额槽位(环形剩余进度圈 + 池/窗口短标 + 清晰百分比,零嵌套边框) */
|
||||
.wm-seg-quota {
|
||||
width: 52px;
|
||||
justify-content: center;
|
||||
gap: 4px;
|
||||
width: auto;
|
||||
min-width: 68px;
|
||||
padding: 0 2px;
|
||||
}
|
||||
|
||||
.wm-slot-prefix {
|
||||
display: inline-block;
|
||||
font-size: inherit;
|
||||
font-weight: 500;
|
||||
color: var(--text-secondary);
|
||||
line-height: 18px;
|
||||
letter-spacing: 0.015em;
|
||||
font-variant-numeric: tabular-nums;
|
||||
white-space: nowrap;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.wm-quota-text {
|
||||
width: 52px;
|
||||
text-align: center;
|
||||
min-width: 28px;
|
||||
max-width: none;
|
||||
overflow: visible;
|
||||
text-overflow: clip;
|
||||
text-align: left;
|
||||
font-weight: 500;
|
||||
color: var(--text-primary);
|
||||
}
|
||||
|
||||
/* 缓存命中率槽位(固定预占宽度 44px 居中对齐) */
|
||||
@@ -504,6 +533,8 @@
|
||||
:host(.wm-capsule-host[data-layout="ring-only"]) .wm-sep[data-sep-for-rank="4"],
|
||||
:host(.wm-capsule-host[data-layout="ring-only"]) .wm-sep[data-sep-for-rank="5"],
|
||||
:host(.wm-capsule-host[data-layout="ring-only"]) .wm-cap-slot[data-vis-rank="1"] .wm-ctx-pct,
|
||||
:host(.wm-capsule-host[data-layout="ring-only"]) .wm-cap-slot[data-vis-rank="1"] .wm-slot-prefix,
|
||||
:host(.wm-capsule-host[data-layout="ring-only"]) .wm-cap-slot[data-vis-rank="1"] .wm-quota-text,
|
||||
:host(.wm-capsule-host[data-layout="ring-only"]) .wm-multi-label {
|
||||
display: none !important;
|
||||
}
|
||||
@@ -512,8 +543,11 @@
|
||||
padding: 0 6px;
|
||||
}
|
||||
|
||||
:host(.wm-capsule-host[data-layout="ring-only"]) .wm-cap-slot[data-vis-rank="1"].wm-ctx-seg {
|
||||
:host(.wm-capsule-host[data-layout="ring-only"]) .wm-cap-slot[data-vis-rank="1"].wm-ctx-seg,
|
||||
:host(.wm-capsule-host[data-layout="ring-only"]) .wm-cap-slot[data-vis-rank="1"].wm-seg-quota {
|
||||
width: 14px;
|
||||
min-width: 14px;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
/* --- 2. 顶层浮层传送门宿主 (Body Portal Host: Multi-Session HUD, Tooltip & Full 4-Tab Popover) --- */
|
||||
|
||||
@@ -53,6 +53,25 @@
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
/* 配额池分组行及池间分隔线(暗黑模式保留原分割色,浅色模式使用柔和细线) */
|
||||
.quota-pool-row {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.quota-pool-row.has-divider {
|
||||
margin-top: 10px;
|
||||
padding-top: 10px;
|
||||
border-top: 1px solid var(--border-hairline);
|
||||
}
|
||||
|
||||
:root[data-color-scheme="light"] .quota-pool-row.has-divider,
|
||||
:host([data-color-scheme="light"]) .quota-pool-row.has-divider,
|
||||
[data-color-scheme="light"] .quota-pool-row.has-divider {
|
||||
border-top-color: color-mix(in srgb, var(--text-primary) 7%, transparent);
|
||||
}
|
||||
|
||||
/* 配额池窗口行头:标题 + 周期用量内联(窄栏自适应截断,零额外纵向行高) */
|
||||
.quota-win-head {
|
||||
gap: 8px;
|
||||
|
||||
@@ -1453,6 +1453,7 @@
|
||||
.cli-preview-prefix {
|
||||
color: var(--text-secondary);
|
||||
font-weight: 400;
|
||||
white-space: pre;
|
||||
}
|
||||
|
||||
.cli-preview-val {
|
||||
@@ -1472,8 +1473,8 @@
|
||||
}
|
||||
|
||||
.cli-preview-slot.is-pill {
|
||||
--cli-pill-track: color-mix(in srgb, var(--text-primary) 10%, var(--surface-panel));
|
||||
--cli-pill-fill: color-mix(in srgb, var(--accent-primary) 34%, var(--surface-panel));
|
||||
--cli-pill-track: color-mix(in srgb, var(--text-primary) 7%, transparent);
|
||||
--cli-pill-fill: color-mix(in srgb, var(--accent-primary) 24%, transparent);
|
||||
padding: 1px 6px;
|
||||
border-radius: 3px;
|
||||
background: linear-gradient(
|
||||
@@ -1486,11 +1487,11 @@
|
||||
}
|
||||
|
||||
.cli-preview-slot.is-pill.tone-good {
|
||||
--cli-pill-fill: color-mix(in srgb, var(--metric-ok) 32%, var(--surface-panel));
|
||||
--cli-pill-fill: color-mix(in srgb, var(--metric-ok) 22%, transparent);
|
||||
}
|
||||
|
||||
.cli-preview-slot.is-pill.tone-accent {
|
||||
--cli-pill-fill: color-mix(in srgb, var(--accent-primary) 34%, var(--surface-panel));
|
||||
--cli-pill-fill: color-mix(in srgb, var(--accent-primary) 24%, transparent);
|
||||
}
|
||||
|
||||
.cli-preview-slot.is-pill .cli-preview-prefix {
|
||||
|
||||
@@ -8,11 +8,13 @@
|
||||
|
||||
import { defineComponent } from '../../core/component.js';
|
||||
import { h, patchAttr, patchClasses, patchStyleVar, patchText } from '../../core/domPatch.js';
|
||||
import { formatMetric, formatTokens, formatUsd } from '../../core/formatters.js';
|
||||
import { getEffectiveLocale, t } from '../../i18n/index.js';
|
||||
import { createSvgIcon } from '../../icons/SvgIcon.js';
|
||||
import {
|
||||
getCapsuleMetricOptions,
|
||||
getOverviewMetricOptions,
|
||||
resolveSpecificQuotaSlotSummary,
|
||||
} from '../../registries/metricRegistry.js';
|
||||
import { getStepColumnOptions } from '../../registries/stepColumnRegistry.js';
|
||||
import {
|
||||
@@ -43,6 +45,7 @@ import {
|
||||
normalizeClientWindowMountMode,
|
||||
resolveEffectiveClientCliStatusLineSlots,
|
||||
resolveOverlayCtxInspectorAgentId,
|
||||
resolveScopedConversation,
|
||||
saveSettingsPatch,
|
||||
triggerCliStatusLineAction,
|
||||
} from '../../store/telemetryStore.js';
|
||||
@@ -54,7 +57,10 @@ import { buildStructurePreviewTelemetry } from '../../components/settings/struct
|
||||
import { CustomNumberInput } from '../../components/ui/CustomNumberInput.js';
|
||||
import { CustomSelect } from '../../components/ui/CustomSelect.js';
|
||||
import { SegmentedControl } from '../../components/ui/SegmentedControl.js';
|
||||
import { CapsuleBarWidget } from '../../components/widgets/CapsuleBarWidget.js';
|
||||
import {
|
||||
CapsuleBarWidget,
|
||||
buildCapsuleSlotContext,
|
||||
} from '../../components/widgets/CapsuleBarWidget.js';
|
||||
import { StepTableWidget } from '../../components/widgets/StepTableWidget.js';
|
||||
|
||||
const STRUCTURE_THIRD_TABS = Object.freeze([
|
||||
@@ -113,75 +119,113 @@ function isSameList(a, b) {
|
||||
return true;
|
||||
}
|
||||
|
||||
function formatCliPreviewSlot(slotKey, isEn) {
|
||||
function formatCliPreviewSlot(slotKey, slotCtx, isEn) {
|
||||
const safeCtx = slotCtx || {};
|
||||
const quotas = safeCtx.quotas || {};
|
||||
const quotaPct = (key, fallback) => {
|
||||
const summary = resolveSpecificQuotaSlotSummary(quotas, key);
|
||||
return summary && Number.isFinite(summary.roundedPct) ? summary.roundedPct : fallback;
|
||||
};
|
||||
switch (slotKey) {
|
||||
case 'tps':
|
||||
return { prefix: '', text: '68.4 t/s', tone: 'good', pillPct: null };
|
||||
case 'avg_tps':
|
||||
case 'tps': {
|
||||
const val = Number.isFinite(Number(safeCtx.tps)) ? Number(safeCtx.tps).toFixed(1) : '68.4';
|
||||
return { prefix: '', text: `${val} t/s`, tone: 'good', pillPct: null };
|
||||
}
|
||||
case 'avg_tps': {
|
||||
const val = Number.isFinite(Number(safeCtx.avgTps)) ? Number(safeCtx.avgTps).toFixed(1) : '59.6';
|
||||
return {
|
||||
prefix: '',
|
||||
text: isEn ? 'avg 54.0' : '均 54.0',
|
||||
text: isEn ? `avg ${val}` : `均 ${val}`,
|
||||
tone: 'info',
|
||||
pillPct: null,
|
||||
};
|
||||
case 'ttft':
|
||||
return { prefix: '', text: '1.1s', tone: 'good', pillPct: null };
|
||||
case 'cost':
|
||||
return { prefix: '', text: '$0.040', tone: 'normal', pillPct: null };
|
||||
case 'session_cost':
|
||||
return { prefix: '', text: '$0.42', tone: 'normal', pillPct: null };
|
||||
case 'cache_hit':
|
||||
}
|
||||
case 'ttft': {
|
||||
const val = Number.isFinite(Number(safeCtx.ttft)) ? formatMetric(Number(safeCtx.ttft), 's') : '1.1s';
|
||||
return { prefix: '', text: val, tone: 'good', pillPct: null };
|
||||
}
|
||||
case 'cost': {
|
||||
const num = Number.isFinite(Number(safeCtx.stepCost)) ? Number(safeCtx.stepCost) : 0.042;
|
||||
return { prefix: '', text: `$${num.toFixed(3)}`, tone: 'normal', pillPct: null };
|
||||
}
|
||||
case 'session_cost': {
|
||||
const num = Number.isFinite(Number(safeCtx.sessionCost)) ? Number(safeCtx.sessionCost) : 1.28;
|
||||
return { prefix: '', text: formatUsd(num), tone: 'normal', pillPct: null };
|
||||
}
|
||||
case 'cache_hit': {
|
||||
const pct = Number.isFinite(Number(safeCtx.cacheHitPct))
|
||||
? Math.round(Number(safeCtx.cacheHitPct))
|
||||
: 95;
|
||||
return {
|
||||
prefix: '',
|
||||
text: isEn ? 'cache 92%' : '缓 92%',
|
||||
text: isEn ? `cache ${pct}%` : `缓 ${pct}%`,
|
||||
tone: 'good',
|
||||
pillPct: null,
|
||||
};
|
||||
case 'session_tokens':
|
||||
return { prefix: '', text: '142K tok', tone: 'muted', pillPct: null };
|
||||
case 'quota_auto':
|
||||
}
|
||||
case 'session_tokens': {
|
||||
const tokStr = Number.isFinite(Number(safeCtx.sessionTokens))
|
||||
? formatTokens(Number(safeCtx.sessionTokens))
|
||||
: '1.8M';
|
||||
return { prefix: '', text: `${tokStr} tok`, tone: 'muted', pillPct: null };
|
||||
}
|
||||
case 'quota_auto': {
|
||||
const pct = quotaPct('quota_auto', 64);
|
||||
return {
|
||||
prefix: isEn ? '5h ' : '余 ',
|
||||
text: '64%',
|
||||
text: `${pct}%`,
|
||||
tone: 'good',
|
||||
pillPct: 64,
|
||||
pillPct: pct,
|
||||
};
|
||||
case 'gemini_5h':
|
||||
}
|
||||
case 'gemini_5h': {
|
||||
const pct = quotaPct('gemini_5h', 64);
|
||||
return {
|
||||
prefix: 'G5h ',
|
||||
text: '64%',
|
||||
text: `${pct}%`,
|
||||
tone: 'good',
|
||||
pillPct: 64,
|
||||
pillPct: pct,
|
||||
};
|
||||
case 'gemini_weekly':
|
||||
}
|
||||
case 'gemini_weekly': {
|
||||
const pct = quotaPct('gemini_weekly', 52);
|
||||
return {
|
||||
prefix: isEn ? 'Gw ' : 'G周 ',
|
||||
text: '88%',
|
||||
text: `${pct}%`,
|
||||
tone: 'good',
|
||||
pillPct: 88,
|
||||
pillPct: pct,
|
||||
};
|
||||
case 'claude_5h':
|
||||
}
|
||||
case 'claude_5h': {
|
||||
const pct = quotaPct('claude_5h', 32);
|
||||
return {
|
||||
prefix: 'C5h ',
|
||||
text: '96%',
|
||||
text: `${pct}%`,
|
||||
tone: 'good',
|
||||
pillPct: 96,
|
||||
pillPct: pct,
|
||||
};
|
||||
case 'claude_weekly':
|
||||
}
|
||||
case 'claude_weekly': {
|
||||
const pct = quotaPct('claude_weekly', 59);
|
||||
return {
|
||||
prefix: isEn ? 'Cw ' : 'C周 ',
|
||||
text: '99%',
|
||||
text: `${pct}%`,
|
||||
tone: 'good',
|
||||
pillPct: 99,
|
||||
pillPct: pct,
|
||||
};
|
||||
}
|
||||
case 'context':
|
||||
default:
|
||||
default: {
|
||||
const pct = Number.isFinite(Number(safeCtx.usedPct))
|
||||
? Math.round(Number(safeCtx.usedPct))
|
||||
: 56;
|
||||
return {
|
||||
prefix: isEn ? 'Ctx ' : '上下文 ',
|
||||
text: '56%',
|
||||
text: `${pct}%`,
|
||||
tone: 'accent',
|
||||
pillPct: 56,
|
||||
pillPct: pct,
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -340,10 +384,6 @@ export const SettingsStructureTab = defineComponent({
|
||||
className: 'form-label',
|
||||
text: t('settings.str.popoverWidthLabel'),
|
||||
});
|
||||
const popoverWidthHintEl = h('span', {
|
||||
className: 'settings-hint-text',
|
||||
text: t('settings.str.popoverWidthHint'),
|
||||
});
|
||||
const multiToggleLabelEl = h('span', {
|
||||
className: 'form-label',
|
||||
text: t('settings.str.multiToggle'),
|
||||
@@ -352,10 +392,6 @@ export const SettingsStructureTab = defineComponent({
|
||||
className: 'form-label',
|
||||
text: t('settings.str.contextAgentModeLabel'),
|
||||
});
|
||||
const contextAgentModeHintEl = h('span', {
|
||||
className: 'settings-hint-text',
|
||||
text: t('settings.str.contextAgentModeHint'),
|
||||
});
|
||||
const cliCapsuleLabelEl = h('span', {
|
||||
className: 'form-label',
|
||||
text: t('settings.str.cliCapsuleToggle'),
|
||||
@@ -508,7 +544,7 @@ export const SettingsStructureTab = defineComponent({
|
||||
});
|
||||
|
||||
const cliPreviewMultiTextEl = h('span', {
|
||||
text: t('settings.str.cliPreviewRunning', { count: 2 }),
|
||||
text: t('settings.str.cliPreviewRunning', { count: 1 }),
|
||||
});
|
||||
const cliPreviewMultiEl = h('span', { className: 'cli-preview-multi' }, [
|
||||
h('span', { className: 'cli-preview-dot', 'aria-hidden': 'true', text: '●' }),
|
||||
@@ -636,37 +672,42 @@ export const SettingsStructureTab = defineComponent({
|
||||
h('div', { className: 'settings-divider' }),
|
||||
h('div', { className: 'form-row' }, [mountModeLabelEl, windowMountSelect.el]),
|
||||
mountBridgeNotice.el,
|
||||
h('div', { className: 'form-row' }, [
|
||||
h('div', { className: 'settings-inline-row' }, [
|
||||
popoverWidthLabelEl,
|
||||
h('div', { className: 'settings-inline-controls' }, [
|
||||
popoverWidthModeToggle.el,
|
||||
popoverWidthNumWrap,
|
||||
]),
|
||||
h('div', { className: 'settings-inline-row' }, [
|
||||
popoverWidthLabelEl,
|
||||
h('div', { className: 'settings-inline-controls' }, [
|
||||
popoverWidthModeToggle.el,
|
||||
popoverWidthNumWrap,
|
||||
]),
|
||||
popoverWidthHintEl,
|
||||
]),
|
||||
h('div', { className: 'settings-inline-row' }, [
|
||||
multiToggleLabelEl,
|
||||
multiSessionToggle.el,
|
||||
]),
|
||||
h('div', { className: 'form-row' }, [
|
||||
h('div', { className: 'settings-inline-row' }, [
|
||||
contextAgentModeLabelEl,
|
||||
contextAgentModeToggle.el,
|
||||
]),
|
||||
contextAgentModeHintEl,
|
||||
h('div', { className: 'settings-inline-row' }, [
|
||||
contextAgentModeLabelEl,
|
||||
contextAgentModeToggle.el,
|
||||
]),
|
||||
h('div', { className: 'form-row' }, [capsuleSlotsLabelEl, topbarSlotsList.el]),
|
||||
cliStatusGroupEl,
|
||||
],
|
||||
});
|
||||
|
||||
function refreshCliPreview() {
|
||||
function refreshCliPreview(previewData = null) {
|
||||
const effectiveSlots = getEffectiveDraftCliSlots();
|
||||
const isEn = getEffectiveLocale() === 'en-US';
|
||||
const mockData = previewData || buildDraftTelemetry();
|
||||
const { scopedConv, ctxAgent, aggregated } = resolveScopedConversation(
|
||||
mockData,
|
||||
'all',
|
||||
resolveOverlayCtxInspectorAgentId(mockData, 'auto')
|
||||
);
|
||||
const slotCtx = buildCapsuleSlotContext(mockData, { scopedConv, ctxAgent, aggregated });
|
||||
const runningCount = Math.max(
|
||||
1,
|
||||
Array.isArray(mockData?.runningConversations) ? mockData.runningConversations.length : 1
|
||||
);
|
||||
patchAttr(cliPreviewMultiEl, 'hidden', !draftShowTopbarMulti);
|
||||
patchText(cliPreviewMultiTextEl, t('settings.str.cliPreviewRunning', { count: 2 }));
|
||||
patchText(cliPreviewMultiTextEl, t('settings.str.cliPreviewRunning', { count: runningCount }));
|
||||
for (let i = 0; i < cliPreviewSlotParts.length; i += 1) {
|
||||
const parts = cliPreviewSlotParts[i];
|
||||
const sepEl = i > 0 ? cliPreviewSepEls[i - 1] : null;
|
||||
@@ -675,7 +716,7 @@ export const SettingsStructureTab = defineComponent({
|
||||
patchAttr(parts.slotEl, 'hidden', !visible);
|
||||
if (sepEl) patchAttr(sepEl, 'hidden', !visible);
|
||||
if (visible) {
|
||||
const item = formatCliPreviewSlot(key, isEn);
|
||||
const item = formatCliPreviewSlot(key, slotCtx, isEn);
|
||||
const isPill = Number.isFinite(item.pillPct);
|
||||
patchAttr(parts.slotEl, 'data-metric', key);
|
||||
patchText(parts.prefixEl, item.prefix || '');
|
||||
@@ -694,8 +735,9 @@ export const SettingsStructureTab = defineComponent({
|
||||
|
||||
function refreshMountPreview() {
|
||||
if (!isStructureVisible() || activeThirdTab !== 'mount') return;
|
||||
capsulePreviewWidget.refs.update({ data: buildDraftTelemetry() });
|
||||
refreshCliPreview();
|
||||
const mockData = buildDraftTelemetry();
|
||||
capsulePreviewWidget.refs.update({ data: mockData });
|
||||
refreshCliPreview(mockData);
|
||||
}
|
||||
|
||||
function syncMountSectionMeta() {
|
||||
@@ -1436,11 +1478,9 @@ export const SettingsStructureTab = defineComponent({
|
||||
mountSection.refs.setResetLabel(t('settings.resetBtn'));
|
||||
patchText(mountModeLabelEl, t('settings.str.mountMode'));
|
||||
patchText(popoverWidthLabelEl, t('settings.str.popoverWidthLabel'));
|
||||
patchText(popoverWidthHintEl, t('settings.str.popoverWidthHint'));
|
||||
popoverWidthStepper.setProps({ ariaLabel: t('settings.str.popoverWidthLabel') });
|
||||
patchText(multiToggleLabelEl, t('settings.str.multiToggle'));
|
||||
patchText(contextAgentModeLabelEl, t('settings.str.contextAgentModeLabel'));
|
||||
patchText(contextAgentModeHintEl, t('settings.str.contextAgentModeHint'));
|
||||
patchText(cliCapsuleLabelEl, t('settings.str.cliCapsuleToggle'));
|
||||
patchText(cliSlotsLabelEl, t('settings.str.cliSlotsLabel'));
|
||||
patchText(capsuleSlotsLabelEl, t('settings.str.capsuleSlotsLabel'));
|
||||
|
||||
@@ -1731,6 +1731,25 @@ html[data-standalone="true"] .app-shell {
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
/* 配额池分组行及池间分隔线(暗黑模式保留原分割色,浅色模式使用柔和细线) */
|
||||
.quota-pool-row {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.quota-pool-row.has-divider {
|
||||
margin-top: 10px;
|
||||
padding-top: 10px;
|
||||
border-top: 1px solid var(--border-hairline);
|
||||
}
|
||||
|
||||
:root[data-color-scheme="light"] .quota-pool-row.has-divider,
|
||||
:host([data-color-scheme="light"]) .quota-pool-row.has-divider,
|
||||
[data-color-scheme="light"] .quota-pool-row.has-divider {
|
||||
border-top-color: color-mix(in srgb, var(--text-primary) 7%, transparent);
|
||||
}
|
||||
|
||||
/* 配额池窗口行头:标题 + 周期用量内联(窄栏自适应截断,零额外纵向行高) */
|
||||
.quota-win-head {
|
||||
gap: 8px;
|
||||
@@ -6833,6 +6852,7 @@ html[data-standalone="true"] .app-shell {
|
||||
.cli-preview-prefix {
|
||||
color: var(--text-secondary);
|
||||
font-weight: 400;
|
||||
white-space: pre;
|
||||
}
|
||||
|
||||
.cli-preview-val {
|
||||
@@ -6852,8 +6872,8 @@ html[data-standalone="true"] .app-shell {
|
||||
}
|
||||
|
||||
.cli-preview-slot.is-pill {
|
||||
--cli-pill-track: color-mix(in srgb, var(--text-primary) 10%, var(--surface-panel));
|
||||
--cli-pill-fill: color-mix(in srgb, var(--accent-primary) 34%, var(--surface-panel));
|
||||
--cli-pill-track: color-mix(in srgb, var(--text-primary) 7%, transparent);
|
||||
--cli-pill-fill: color-mix(in srgb, var(--accent-primary) 24%, transparent);
|
||||
padding: 1px 6px;
|
||||
border-radius: 3px;
|
||||
background: linear-gradient(
|
||||
@@ -6866,11 +6886,11 @@ html[data-standalone="true"] .app-shell {
|
||||
}
|
||||
|
||||
.cli-preview-slot.is-pill.tone-good {
|
||||
--cli-pill-fill: color-mix(in srgb, var(--metric-ok) 32%, var(--surface-panel));
|
||||
--cli-pill-fill: color-mix(in srgb, var(--metric-ok) 22%, transparent);
|
||||
}
|
||||
|
||||
.cli-preview-slot.is-pill.tone-accent {
|
||||
--cli-pill-fill: color-mix(in srgb, var(--accent-primary) 34%, var(--surface-panel));
|
||||
--cli-pill-fill: color-mix(in srgb, var(--accent-primary) 24%, transparent);
|
||||
}
|
||||
|
||||
.cli-preview-slot.is-pill .cli-preview-prefix {
|
||||
@@ -7204,6 +7224,14 @@ html[data-standalone="true"] .app-shell {
|
||||
stroke var(--dur-fast) var(--ease-fast);
|
||||
}
|
||||
|
||||
.wm-ring-fill.is-quota {
|
||||
stroke: var(--metric-ok);
|
||||
}
|
||||
|
||||
.wm-ring-fill.is-empty {
|
||||
stroke: transparent;
|
||||
}
|
||||
|
||||
.wm-ring-fill.tone-warn {
|
||||
stroke: var(--metric-warn);
|
||||
}
|
||||
@@ -7266,14 +7294,35 @@ html[data-standalone="true"] .app-shell {
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
/* 配额槽位(固定预占宽度 52px 居中对齐,完整容纳 余 100% / 余 --% 且在任意槽位对称) */
|
||||
/* 配额槽位(环形剩余进度圈 + 池/窗口短标 + 清晰百分比,零嵌套边框) */
|
||||
.wm-seg-quota {
|
||||
width: 52px;
|
||||
justify-content: center;
|
||||
gap: 4px;
|
||||
width: auto;
|
||||
min-width: 68px;
|
||||
padding: 0 2px;
|
||||
}
|
||||
|
||||
.wm-slot-prefix {
|
||||
display: inline-block;
|
||||
font-size: inherit;
|
||||
font-weight: 500;
|
||||
color: var(--text-secondary);
|
||||
line-height: 18px;
|
||||
letter-spacing: 0.015em;
|
||||
font-variant-numeric: tabular-nums;
|
||||
white-space: nowrap;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.wm-quota-text {
|
||||
width: 52px;
|
||||
text-align: center;
|
||||
min-width: 28px;
|
||||
max-width: none;
|
||||
overflow: visible;
|
||||
text-overflow: clip;
|
||||
text-align: left;
|
||||
font-weight: 500;
|
||||
color: var(--text-primary);
|
||||
}
|
||||
|
||||
/* 缓存命中率槽位(固定预占宽度 44px 居中对齐) */
|
||||
@@ -7446,6 +7495,8 @@ html[data-standalone="true"] .app-shell {
|
||||
:host(.wm-capsule-host[data-layout="ring-only"]) .wm-sep[data-sep-for-rank="4"],
|
||||
:host(.wm-capsule-host[data-layout="ring-only"]) .wm-sep[data-sep-for-rank="5"],
|
||||
:host(.wm-capsule-host[data-layout="ring-only"]) .wm-cap-slot[data-vis-rank="1"] .wm-ctx-pct,
|
||||
:host(.wm-capsule-host[data-layout="ring-only"]) .wm-cap-slot[data-vis-rank="1"] .wm-slot-prefix,
|
||||
:host(.wm-capsule-host[data-layout="ring-only"]) .wm-cap-slot[data-vis-rank="1"] .wm-quota-text,
|
||||
:host(.wm-capsule-host[data-layout="ring-only"]) .wm-multi-label {
|
||||
display: none !important;
|
||||
}
|
||||
@@ -7454,8 +7505,11 @@ html[data-standalone="true"] .app-shell {
|
||||
padding: 0 6px;
|
||||
}
|
||||
|
||||
:host(.wm-capsule-host[data-layout="ring-only"]) .wm-cap-slot[data-vis-rank="1"].wm-ctx-seg {
|
||||
:host(.wm-capsule-host[data-layout="ring-only"]) .wm-cap-slot[data-vis-rank="1"].wm-ctx-seg,
|
||||
:host(.wm-capsule-host[data-layout="ring-only"]) .wm-cap-slot[data-vis-rank="1"].wm-seg-quota {
|
||||
width: 14px;
|
||||
min-width: 14px;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
/* --- 2. 顶层浮层传送门宿主 (Body Portal Host: Multi-Session HUD, Tooltip & Full 4-Tab Popover) --- */
|
||||
@@ -8410,6 +8464,7 @@ html[data-standalone="true"][data-modern-ui="true"] .app-shell {
|
||||
[data-modern-ui="true"] .structure-preview-empty,
|
||||
[data-modern-ui="true"] .preview-sidebar-note,
|
||||
[data-modern-ui="true"] .preview-capsule-bar,
|
||||
[data-modern-ui="true"] .cli-status-preview,
|
||||
[data-modern-ui="true"] .preview-capsule-bar.is-composer .wm-multi-btn,
|
||||
[data-modern-ui="true"] .preview-capsule-bar.is-composer .wm-capsule-btn,
|
||||
[data-modern-ui="true"] .preview-composer-chip {
|
||||
@@ -8417,6 +8472,10 @@ html[data-standalone="true"][data-modern-ui="true"] .app-shell {
|
||||
background: var(--modern-surface-subtle);
|
||||
}
|
||||
|
||||
[data-modern-ui="true"][data-color-scheme="light"] .quota-pool-row.has-divider {
|
||||
border-top-color: hsl(216 24% 92%);
|
||||
}
|
||||
|
||||
[data-modern-ui="true"] .slot-add-btn,
|
||||
[data-modern-ui="true"] .settings-bridge-relaunch-btn {
|
||||
border: none;
|
||||
@@ -8700,8 +8759,10 @@ html[data-standalone="true"][data-modern-ui="true"] .app-shell {
|
||||
}
|
||||
|
||||
:host([data-modern-ui="true"]) .wm-slot-text.wm-ctx-pct[data-od-active="1"],
|
||||
:host([data-modern-ui="true"]) .wm-slot-text.wm-quota-text[data-od-active="1"],
|
||||
:host([data-modern-ui="true"]) .wm-multi-label[data-od-active="1"],
|
||||
[data-modern-ui="true"] .wm-slot-text.wm-ctx-pct[data-od-active="1"],
|
||||
[data-modern-ui="true"] .wm-slot-text.wm-quota-text[data-od-active="1"],
|
||||
[data-modern-ui="true"] .wm-multi-label[data-od-active="1"] {
|
||||
justify-content: flex-start;
|
||||
}
|
||||
|
||||
@@ -1345,9 +1345,16 @@ test('Compiled app.js mounts dual Shadow DOM hosts, tracks /c/<uuid> routes, pro
|
||||
const claudeHoverUsages = hoverQuotaPools.children[1].querySelectorAll('.quota-win-usage');
|
||||
assert.equal(claudeHoverUsages[0].textContent, '· 0 ($0.00)');
|
||||
assert.equal(claudeHoverUsages[1].textContent, '· 7.3M ($3.82)');
|
||||
const hoverFootSpans = hoverTipEl.querySelector('.wm-hover-quota-foot').children;
|
||||
assert.equal(hoverFootSpans[0].textContent, '周期累计: 25.5M ($9.22)');
|
||||
assert.equal(hoverFootSpans[1].textContent, '周期调用: 160 次');
|
||||
assert.equal(
|
||||
hoverTipEl.querySelector('.wm-hover-quota-foot'),
|
||||
null,
|
||||
'Redundant quota cycle summary footer removed now that each pool displays inline cycle usage'
|
||||
);
|
||||
assert.equal(
|
||||
hoverQuotaPools.children[1].classList.contains('has-divider'),
|
||||
true,
|
||||
'Secondary quota pool uses CSS class divider for light/dark polarity control'
|
||||
);
|
||||
|
||||
// Verify clicking multi-session button pins open multi-session panel, and clicking capsule switches to 4-tab panel
|
||||
multiBtn.dispatchEvent({ type: 'click', stopPropagation() {} });
|
||||
@@ -1689,9 +1696,12 @@ test('Compiled app.js mounts dual Shadow DOM hosts, tracks /c/<uuid> routes, pro
|
||||
capRowSelects[0].querySelectorAll('.select-option')[9].dispatchEvent({ type: 'click', stopPropagation() {} });
|
||||
await new Promise((r) => setTimeout(r, 30));
|
||||
assert.equal(capSlots[0].getAttribute('data-metric'), 'gemini_5h');
|
||||
assert.equal(readCapVal(capSlots[0].children[0]), '余 44%');
|
||||
assert.equal(capSlots[0].querySelector('.wm-slot-prefix')?.textContent, 'G5h');
|
||||
assert.equal(readCapVal(capSlots[0].querySelector('.wm-quota-text')), '44%');
|
||||
assert.equal(capSlots[0].querySelector('.wm-ring-fill')?.classList.contains('is-quota'), true);
|
||||
assert.equal(previewCapsuleSlots[0].getAttribute('data-metric'), 'gemini_5h', 'Preview slot 0 mirrors gemini_5h');
|
||||
assert.equal(readCapVal(previewCapsuleSlots[0].children[0]), '余 64%', 'Preview slot 0 renders simulated gemini_5h');
|
||||
assert.equal(previewCapsuleSlots[0].querySelector('.wm-slot-prefix')?.textContent, 'G5h');
|
||||
assert.equal(readCapVal(previewCapsuleSlots[0].querySelector('.wm-quota-text')), '64%', 'Preview slot 0 renders simulated gemini_5h');
|
||||
assert.equal(capSlots[1].getAttribute('data-metric'), 'ttft');
|
||||
assert.equal(readCapVal(capSlots[1].children[0]), '0.85s');
|
||||
|
||||
@@ -1708,7 +1718,8 @@ test('Compiled app.js mounts dual Shadow DOM hosts, tracks /c/<uuid> routes, pro
|
||||
await new Promise((r) => setTimeout(r, 30));
|
||||
assert.deepEqual(mockSettings.topbarCapsuleSlots, ['ttft', 'gemini_5h', 'cost']);
|
||||
assert.equal(readCapVal(capSlots[0].children[0]), '0.85s');
|
||||
assert.equal(readCapVal(capSlots[1].children[0]), '余 44%');
|
||||
assert.equal(capSlots[1].querySelector('.wm-slot-prefix')?.textContent, 'G5h');
|
||||
assert.equal(readCapVal(capSlots[1].querySelector('.wm-quota-text')), '44%');
|
||||
|
||||
// Mouse drag-and-drop reorder: drag Row 0 ('ttft') down below Row 2 ('cost') -> ['gemini_5h', 'cost', 'ttft']
|
||||
const capSlotListEl = capSlotWrap.querySelector('.editable-slot-list');
|
||||
@@ -5946,7 +5957,12 @@ test('SettingsStructureTab CLI statusLine controls stay hidden unless CLI is det
|
||||
.querySelectorAll('.cli-preview-slot')
|
||||
.filter((el) => !el.hasAttribute('hidden'))
|
||||
.map((el) => el.textContent);
|
||||
assert.deepEqual(visibleSlots(), ['68.4 t/s', '1.1s', '$0.42', '余 64%', '上下文 56%']);
|
||||
assert.deepEqual(visibleSlots(), ['68.4 t/s', '1.1s', '$1.28', '余 52%', '上下文 56%']);
|
||||
assert.equal(
|
||||
previewEl.querySelector('.cli-preview-multi')?.textContent,
|
||||
'●1 运行中',
|
||||
'CLI preview shares the exact same running count (1) as the top Antigravity preview bar'
|
||||
);
|
||||
const pillSlots1 = previewEl
|
||||
.querySelectorAll('.cli-preview-slot.is-pill')
|
||||
.filter((el) => !el.hasAttribute('hidden'));
|
||||
@@ -5964,9 +5980,9 @@ test('SettingsStructureTab CLI statusLine controls stay hidden unless CLI is det
|
||||
);
|
||||
assert.deepEqual(visibleSlots(), [
|
||||
'G5h 64%',
|
||||
'G周 88%',
|
||||
'C5h 96%',
|
||||
'C周 99%',
|
||||
'G周 52%',
|
||||
'C5h 32%',
|
||||
'C周 59%',
|
||||
'上下文 56%',
|
||||
]);
|
||||
const pillSlots2 = previewEl
|
||||
|
||||
Reference in New Issue
Block a user