mirror of
https://github.com/lWolvesl/antigravity-usage-monitor.git
synced 2026-11-26 17:09:28 +08:00
fix(panel): support Orchestrator (Neon) and prevent future variants from falling back to Carbon
# Conflicts: # sidecars/panel/index.html # sidecars/panel/test/backend-harness.mjs
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"schemaVersion": 1,
|
||||
"catalogVersion": "2026.11.19.2",
|
||||
"updatedAt": "2026-11-19T09:35:00+09:00",
|
||||
"catalogVersion": "2026.11.20.1",
|
||||
"updatedAt": "2026-11-20T02:00:00+09:00",
|
||||
"latestPluginVersion": "1.5.2",
|
||||
"releaseUrl": "https://github.com/yuhuan-dev/antigravity-usage-monitor/releases/latest",
|
||||
"downloadUrl": "https://github.com/yuhuan-dev/antigravity-usage-monitor/releases/latest/download/usage-monitor.zip",
|
||||
@@ -165,7 +165,9 @@
|
||||
"placeholders": {
|
||||
"MODEL_PLACEHOLDER_M667": { "modelId": "gemini-pro-orchestrator", "label": "Orchestrator (Carbon)" },
|
||||
"MODEL_PLACEHOLDER_M681": { "modelId": "gemini-pro-orchestrator-argon", "label": "Orchestrator (Argon)" },
|
||||
"MODEL_PLACEHOLDER_M537": { "modelId": "gemini-pro-orchestrator-neon", "label": "Orchestrator (Neon)" },
|
||||
"MODEL_PLACEHOLDER_M669": { "modelId": "gemini-flash-worker-agy", "label": "Orchestrator Worker (Hydrogen)" },
|
||||
"MODEL_PLACEHOLDER_M535": { "modelId": "gemini-4-neon-xhigh", "label": "Gemini 4 Neon (XHigh)" },
|
||||
"MODEL_PLACEHOLDER_M429": { "modelId": "gemini-4-carbon-high", "label": "Gemini 4 Carbon (High)" },
|
||||
"MODEL_PLACEHOLDER_M427": { "modelId": "gemini-4-carbon-high", "label": "Gemini 4 Carbon (High)" },
|
||||
"MODEL_PLACEHOLDER_M437": { "modelId": "gemini-4-carbon-medium", "label": "Gemini 4 Carbon (Medium)" },
|
||||
|
||||
+58
-24
@@ -3729,8 +3729,8 @@ const normalizeOrchestratorIdDisplayMode = normalizeOrchestratorIdMode;
|
||||
* 统一解析步骤、会话摘要或模型汇总行面向用户的模型显示文本与悬停提示。
|
||||
*
|
||||
* 规则:
|
||||
* - Orchestrator 系列(`Orchestrator (Carbon)`、`Orchestrator (Argon)`、`gemini-flash-worker-agy` / `M669`)
|
||||
* 独立遵循 `orchestratorIdMode`(`'compact'` 显示 `orchestrator-carbon` / `orchestrator-argon` / `worker-agy-hydrogen`;
|
||||
* - Orchestrator 系列(`Orchestrator (Carbon)`、`Orchestrator (Argon)`、`Orchestrator (Neon)`、`gemini-flash-worker-agy` / `M669`)
|
||||
* 独立遵循 `orchestratorIdMode`(`'compact'` 显示 `orchestrator-carbon` / `orchestrator-argon` / `orchestrator-neon` / `worker-agy-hydrogen`;
|
||||
* `'full'` 显示带括号标注的完整上游 ID),不受普通模型显示模式影响;
|
||||
* - 其余普通模型遵循 `modelDisplayMode`(`'short'` | `'upstream_compact'` | `'upstream'`,兼容旧版布尔 `showUpstreamModel`);
|
||||
* - 独立拆分 `baseText` 与 `compactionSuffix`(`·压缩`),供步骤表单独保护压缩尾标永不截断。
|
||||
@@ -3803,37 +3803,71 @@ function resolveModelDisplayInfo(target, settings = {}, options = {}) {
|
||||
/\bMODEL_PLACEHOLDER_M669\b|\b[a-z0-9.-]*worker-agy\b|\bworker-agy-hydrogen\b|\bOrchestrator\s+Worker\b/i.test(
|
||||
combined
|
||||
);
|
||||
const isKnownOrchCarbonPh = /\bMODEL_PLACEHOLDER_M667\b/i.test(combined);
|
||||
const isKnownOrchArgonPh = /\bMODEL_PLACEHOLDER_M681\b/i.test(combined);
|
||||
const isKnownOrchNeonPh = /\bMODEL_PLACEHOLDER_M537\b/i.test(combined);
|
||||
const dynamicOrchVariantMatch =
|
||||
combined.match(/\bOrchestrator\s*\(\s*([a-z0-9-]+)\s*\)/i) ||
|
||||
combined.match(/\bgemini-pro-orchestrator-([a-z0-9-]+)\b/i) ||
|
||||
combined.match(/\b(?:orchestrator|orch)-([a-z0-9]+)(?=·|\s|$)/i);
|
||||
const dynamicOrchVariant =
|
||||
dynamicOrchVariantMatch && dynamicOrchVariantMatch[1].toLowerCase() !== 'worker'
|
||||
? dynamicOrchVariantMatch[1].toLowerCase()
|
||||
: '';
|
||||
const hasBareProOrch = /\bgemini-pro-orchestrator\b(?![-_][a-z0-9])/i.test(combined);
|
||||
const isOrchSeries =
|
||||
isOrchWorker ||
|
||||
/\bgemini-pro-orchestrator(?:-argon)?\b|\borchestrator-(?:carbon|argon)\b|\borch-(?:carbon|argon)(?:·压缩)?(?=\s|$)|Orchestrator\s*\((?:Carbon|Argon)\)|\bMODEL_PLACEHOLDER_M(?:667|681)\b/i.test(
|
||||
combined
|
||||
);
|
||||
Boolean(dynamicOrchVariant) ||
|
||||
isKnownOrchNeonPh ||
|
||||
isKnownOrchArgonPh ||
|
||||
isKnownOrchCarbonPh ||
|
||||
hasBareProOrch;
|
||||
|
||||
if (isOrchSeries) {
|
||||
let compactId = 'orchestrator-carbon';
|
||||
let fullId = 'gemini-pro-orchestrator (carbon-4)';
|
||||
let compactId = '';
|
||||
let fullId = '';
|
||||
if (isOrchWorker) {
|
||||
compactId = 'worker-agy-hydrogen';
|
||||
fullId = 'gemini-flash-worker-agy (hydrogen-4)';
|
||||
} else if (/\bargon\b|\bMODEL_PLACEHOLDER_M681\b|\borch-argon\b/i.test(combined)) {
|
||||
} else if (isKnownOrchNeonPh || dynamicOrchVariant === 'neon') {
|
||||
compactId = 'orchestrator-neon';
|
||||
fullId = 'gemini-pro-orchestrator-neon (neon-4)';
|
||||
} else if (isKnownOrchArgonPh || dynamicOrchVariant === 'argon') {
|
||||
compactId = 'orchestrator-argon';
|
||||
fullId = 'gemini-pro-orchestrator-argon (argon-4)';
|
||||
} else if (
|
||||
isKnownOrchCarbonPh ||
|
||||
dynamicOrchVariant === 'carbon' ||
|
||||
(hasBareProOrch && !dynamicOrchVariant)
|
||||
) {
|
||||
compactId = 'orchestrator-carbon';
|
||||
fullId = 'gemini-pro-orchestrator (carbon-4)';
|
||||
} else if (dynamicOrchVariant) {
|
||||
compactId = `orchestrator-${dynamicOrchVariant}`;
|
||||
const cleanUpstream = stripCompactionMarker(upstreamText || responseText || '').trim();
|
||||
fullId = cleanUpstream
|
||||
? cleanUpstream.toLowerCase().includes(dynamicOrchVariant)
|
||||
? cleanUpstream
|
||||
: `${cleanUpstream} (${dynamicOrchVariant})`
|
||||
: `gemini-pro-orchestrator-${dynamicOrchVariant}`;
|
||||
}
|
||||
if (compactId) {
|
||||
const baseText = orchestratorMode === 'full' ? fullId : compactId;
|
||||
const text = `${baseText}${compactionSuffix}`;
|
||||
const multiUpstream =
|
||||
Array.isArray(target.upstreamModels) && target.upstreamModels.length > 1
|
||||
? target.upstreamModels.join(' / ')
|
||||
: '';
|
||||
const title = multiUpstream || `${fullId}${compactionSuffix}`;
|
||||
return {
|
||||
text,
|
||||
baseText,
|
||||
compactionSuffix,
|
||||
isCompaction,
|
||||
title,
|
||||
isOrchestratorSeries: true,
|
||||
};
|
||||
}
|
||||
const baseText = orchestratorMode === 'full' ? fullId : compactId;
|
||||
const text = `${baseText}${compactionSuffix}`;
|
||||
const multiUpstream =
|
||||
Array.isArray(target.upstreamModels) && target.upstreamModels.length > 1
|
||||
? target.upstreamModels.join(' / ')
|
||||
: '';
|
||||
const title = multiUpstream || `${fullId}${compactionSuffix}`;
|
||||
return {
|
||||
text,
|
||||
baseText,
|
||||
compactionSuffix,
|
||||
isCompaction,
|
||||
title,
|
||||
isOrchestratorSeries: true,
|
||||
};
|
||||
}
|
||||
|
||||
const rawSelected =
|
||||
@@ -24797,7 +24831,7 @@ function findHostTitlebar() {
|
||||
const COMPOSER_EXCLUDED_ANCESTOR_SELECTOR =
|
||||
'.part.titlebar, .part.statusbar, .quick-input-widget, .suggest-widget, .find-widget, .scm-editor, .search-view, [class*="@container/titlebar"]';
|
||||
const COMPOSER_MODEL_LABEL_RE =
|
||||
/\b(?:gemini|claude|gpt|argon|carbon|hydrogen|helix|flash|sonnet|opus|haiku|orchestrator|llama|deepseek|qwen|mistral|model_placeholder|placeholder_m\d+|o[134](?:-\w+)?)\b/i;
|
||||
/\b(?:gemini|claude|gpt|argon|carbon|neon|hydrogen|helix|flash|sonnet|opus|haiku|orchestrator|llama|deepseek|qwen|mistral|model_placeholder|placeholder_m\d+|o[134](?:-\w+)?)\b/i;
|
||||
const COMPOSER_MODEL_ATTR_RE =
|
||||
/\bmodel[-_\s]?(?:select|picker|switch|selector|menu|name)\b|选择模型|切换模型/i;
|
||||
const COMPOSER_MODE_EXACT_RE = /^(?:auto|自动)$/i;
|
||||
|
||||
@@ -49,6 +49,7 @@ function inferFamilyFromProviderOrKey(rawModelKey = '', modelId = '', apiProvide
|
||||
combined.includes('GEMINI') ||
|
||||
combined.includes('CARBON') ||
|
||||
combined.includes('ARGON') ||
|
||||
combined.includes('NEON') ||
|
||||
combined.includes('HYDROGEN') ||
|
||||
combined.includes('ORCHESTRATOR') ||
|
||||
combined.includes('HELIX') ||
|
||||
@@ -60,6 +61,23 @@ function inferFamilyFromProviderOrKey(rawModelKey = '', modelId = '', apiProvide
|
||||
return 'Other';
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断一组模型标识字段是否指向 Gemini 4 Neon 系列模型(含 M535 及 M537 Orchestrator (Neon))。
|
||||
*
|
||||
* @param {...string} parts 待检测的标识片段
|
||||
* @returns {boolean}
|
||||
*/
|
||||
export function isNeonModelIdentifier(...parts) {
|
||||
const text = parts.filter(Boolean).join(' ');
|
||||
if (
|
||||
/\bhydrogen\b|\bgemini-flash-worker-agy\b|MODEL_PLACEHOLDER_M(?:669|52[5678])\b/i.test(text) &&
|
||||
!/\bneon\b|MODEL_PLACEHOLDER_M53[57]\b/i.test(text)
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
return /\bneon\b|gemini-(?:4-)?neon|MODEL_PLACEHOLDER_M53[57]\b/i.test(text);
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断一组模型标识字段是否指向 Gemini 4 Argon 系列模型(含 M417/M418/M419 及 M681 Orchestrator (Argon))。
|
||||
*
|
||||
@@ -77,8 +95,27 @@ export function isArgonModelIdentifier(...parts) {
|
||||
return /argon|MODEL_PLACEHOLDER_M(?:41[789]|681)\b/i.test(text);
|
||||
}
|
||||
|
||||
/**
|
||||
* 从一组标识字段中提取显式的非通用 Orchestrator 变体代号(如 `Orchestrator (Xenon)` -> `'xenon'`、
|
||||
* `gemini-pro-orchestrator-neon` -> `'neon'`)。未命中时返回空字符串。
|
||||
*
|
||||
* @param {string} text
|
||||
* @returns {string}
|
||||
*/
|
||||
function extractExplicitOrchestratorVariant(text = '') {
|
||||
const parenMatch = text.match(/\bOrchestrator\s*\(\s*([a-z0-9-]+)\s*\)/i);
|
||||
if (parenMatch) return parenMatch[1].toLowerCase();
|
||||
const slugMatch = text.match(/\b(?:gemini-pro-orchestrator|orchestrator|orch)-([a-z0-9]+)\b/i);
|
||||
if (slugMatch && slugMatch[1].toLowerCase() !== 'worker') {
|
||||
return slugMatch[1].toLowerCase();
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断一组模型标识字段是否指向 Gemini 4 Carbon 系列模型(含 M427/M429/M437/M438 及 M667 Orchestrator (Carbon))。
|
||||
* 仅当显式命中 Carbon 标识,或裸 `gemini-pro-orchestrator` 不携带任何其他变体代号时才判定为 Carbon,
|
||||
* 防止未来新增 `Orchestrator (<新代号>)` 被静默误判为 Carbon。
|
||||
*
|
||||
* @param {...string} parts 待检测的标识片段
|
||||
* @returns {boolean}
|
||||
@@ -88,15 +125,23 @@ export function isCarbonModelIdentifier(...parts) {
|
||||
if (/\bcarbon\b|gemini-4-carbon|MODEL_PLACEHOLDER_M(?:42[79]|43[78]|667)\b/i.test(text)) {
|
||||
return true;
|
||||
}
|
||||
if (/\bhydrogen\b|\bgemini-flash-worker-agy\b|MODEL_PLACEHOLDER_M(?:669|52[5678])\b/i.test(text)) {
|
||||
if (
|
||||
/\bhydrogen\b|\bgemini-flash-worker-agy\b|MODEL_PLACEHOLDER_M(?:669|52[5678])\b/i.test(text) ||
|
||||
/\bneon\b|gemini-(?:4-)?neon|MODEL_PLACEHOLDER_M53[57]\b/i.test(text) ||
|
||||
/\bargon\b|MODEL_PLACEHOLDER_M(?:41[789]|681)\b/i.test(text)
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
return /\bgemini-pro-orchestrator\b(?!-argon)/i.test(text);
|
||||
const explicitVariant = extractExplicitOrchestratorVariant(text);
|
||||
if (explicitVariant && explicitVariant !== 'carbon') {
|
||||
return false;
|
||||
}
|
||||
return /\bgemini-pro-orchestrator\b(?![-_][a-z0-9])/i.test(text);
|
||||
}
|
||||
|
||||
/**
|
||||
* 剥离模型展示名称末尾的思考档位后缀(如 `(XHigh)`、`(High)`、`(Medium)`、`(Thinking)`),提取基础模型族名。
|
||||
* 保留 `(Carbon)` / `(Argon)` 后缀,以便 `Orchestrator (Carbon)` 与 `Orchestrator (Argon)` 在汇总表中保持分列。
|
||||
* 保留 `(Carbon)` / `(Argon)` / `(Neon)` 后缀,以便不同 Orchestrator 系列在汇总表中保持分列。
|
||||
*
|
||||
* @param {string} [label='']
|
||||
* @returns {string}
|
||||
@@ -138,7 +183,7 @@ export function formatGenericModelSlug(slug = '') {
|
||||
if (/^gemini-3-flash-c$/i.test(s)) return 'Gemini 3 Flash';
|
||||
if (/^gemini-pro-(?:default|agent|b)$/i.test(s)) return 'Gemini 3.1 Pro';
|
||||
const m = s.match(
|
||||
/^gemini-(\d+(?:\.\d+)?)-(pro|flash|argon|carbon|hydrogen|helix)(?:-(lite))?(?:-(xhigh|high|medium|low|extra-low|tiered|preview))?$/i
|
||||
/^gemini-(\d+(?:\.\d+)?)-(pro|flash|argon|carbon|neon|hydrogen|helix)(?:-(lite))?(?:-(xhigh|high|medium|low|extra-low|tiered|preview))?$/i
|
||||
);
|
||||
if (m) {
|
||||
const ver = m[1];
|
||||
@@ -148,12 +193,18 @@ export function formatGenericModelSlug(slug = '') {
|
||||
const tierSuffix = SLUG_TIER_LABELS[suffixKey] ? ` (${SLUG_TIER_LABELS[suffixKey]})` : '';
|
||||
return `Gemini ${ver} ${tier}${lite}${tierSuffix}`;
|
||||
}
|
||||
const codenameMatch = s.match(/^gemini-(hydrogen|helix)$/i);
|
||||
const codenameMatch = s.match(/^gemini-(hydrogen|helix|neon)$/i);
|
||||
if (codenameMatch) {
|
||||
const codename =
|
||||
codenameMatch[1].charAt(0).toUpperCase() + codenameMatch[1].slice(1).toLowerCase();
|
||||
return `Gemini ${codename}`;
|
||||
}
|
||||
const orchVariantMatch = s.match(/^gemini-pro-orchestrator-([a-z0-9]+)$/i);
|
||||
if (orchVariantMatch) {
|
||||
const variant =
|
||||
orchVariantMatch[1].charAt(0).toUpperCase() + orchVariantMatch[1].slice(1).toLowerCase();
|
||||
return `Orchestrator (${variant})`;
|
||||
}
|
||||
if (/^gemini-flash-worker-agy$/i.test(s)) {
|
||||
return 'Orchestrator Worker (Hydrogen)';
|
||||
}
|
||||
@@ -298,6 +349,11 @@ function resolveModelCatalogEntry(
|
||||
const isOpaqueOrchestratorResp = Boolean(
|
||||
cleanResponseModel && /\borchestrator\b/i.test(cleanResponseModel)
|
||||
);
|
||||
const isBareOpaqueOrchestratorResp = /^gemini-pro-orchestrator$/i.test(cleanResponseModel);
|
||||
const allowOpaqueOrchestratorFallback =
|
||||
isOpaqueOrchestratorResp &&
|
||||
(!isBareOpaqueOrchestratorResp ||
|
||||
isCarbonModelIdentifier(rawModelKey, modelId, derivedDisplay, cleanResponseModel));
|
||||
const explicitPricing =
|
||||
MODEL_PRICING[modelId] ||
|
||||
MODEL_PRICING[rawModelKey] ||
|
||||
@@ -308,9 +364,7 @@ function resolveModelCatalogEntry(
|
||||
MODEL_PRICING[tieredDashedSlug] ||
|
||||
MODEL_PRICING[canonicalSlug] ||
|
||||
MODEL_PRICING[dashedSlug] ||
|
||||
(cleanResponseModel && isOpaqueOrchestratorResp
|
||||
? MODEL_PRICING[cleanResponseModel]
|
||||
: null);
|
||||
(allowOpaqueOrchestratorFallback ? MODEL_PRICING[cleanResponseModel] : null);
|
||||
|
||||
if (explicitPricing) {
|
||||
return {
|
||||
@@ -469,6 +523,9 @@ export function formatUpstreamModelId(rawUpstream = '', mInfo = null) {
|
||||
) {
|
||||
return `${s} (hydrogen-4)`;
|
||||
}
|
||||
if (isNeonModelIdentifier(mInfo?.rawModel, mInfo?.modelId, mInfo?.label, s)) {
|
||||
return `${s} (neon-4)`;
|
||||
}
|
||||
if (isArgonModelIdentifier(mInfo?.rawModel, mInfo?.modelId, mInfo?.label, s)) {
|
||||
return `${s} (argon-4)`;
|
||||
}
|
||||
|
||||
@@ -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=1795146059865">
|
||||
<link rel="stylesheet" href="/styles.css?v=1795159546122">
|
||||
<script src="/preload.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="app-root"></div>
|
||||
<script src="/app.js?v=1795146059865"></script>
|
||||
<script src="/app.js?v=1795159546122"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -169,7 +169,7 @@ function findHostTitlebar() {
|
||||
const COMPOSER_EXCLUDED_ANCESTOR_SELECTOR =
|
||||
'.part.titlebar, .part.statusbar, .quick-input-widget, .suggest-widget, .find-widget, .scm-editor, .search-view, [class*="@container/titlebar"]';
|
||||
const COMPOSER_MODEL_LABEL_RE =
|
||||
/\b(?:gemini|claude|gpt|argon|carbon|hydrogen|helix|flash|sonnet|opus|haiku|orchestrator|llama|deepseek|qwen|mistral|model_placeholder|placeholder_m\d+|o[134](?:-\w+)?)\b/i;
|
||||
/\b(?:gemini|claude|gpt|argon|carbon|neon|hydrogen|helix|flash|sonnet|opus|haiku|orchestrator|llama|deepseek|qwen|mistral|model_placeholder|placeholder_m\d+|o[134](?:-\w+)?)\b/i;
|
||||
const COMPOSER_MODEL_ATTR_RE =
|
||||
/\bmodel[-_\s]?(?:select|picker|switch|selector|menu|name)\b|选择模型|切换模型/i;
|
||||
const COMPOSER_MODE_EXACT_RE = /^(?:auto|自动)$/i;
|
||||
|
||||
@@ -317,8 +317,8 @@ export const normalizeOrchestratorIdDisplayMode = normalizeOrchestratorIdMode;
|
||||
* 统一解析步骤、会话摘要或模型汇总行面向用户的模型显示文本与悬停提示。
|
||||
*
|
||||
* 规则:
|
||||
* - Orchestrator 系列(`Orchestrator (Carbon)`、`Orchestrator (Argon)`、`gemini-flash-worker-agy` / `M669`)
|
||||
* 独立遵循 `orchestratorIdMode`(`'compact'` 显示 `orchestrator-carbon` / `orchestrator-argon` / `worker-agy-hydrogen`;
|
||||
* - Orchestrator 系列(`Orchestrator (Carbon)`、`Orchestrator (Argon)`、`Orchestrator (Neon)`、`gemini-flash-worker-agy` / `M669`)
|
||||
* 独立遵循 `orchestratorIdMode`(`'compact'` 显示 `orchestrator-carbon` / `orchestrator-argon` / `orchestrator-neon` / `worker-agy-hydrogen`;
|
||||
* `'full'` 显示带括号标注的完整上游 ID),不受普通模型显示模式影响;
|
||||
* - 其余普通模型遵循 `modelDisplayMode`(`'short'` | `'upstream_compact'` | `'upstream'`,兼容旧版布尔 `showUpstreamModel`);
|
||||
* - 独立拆分 `baseText` 与 `compactionSuffix`(`·压缩`),供步骤表单独保护压缩尾标永不截断。
|
||||
@@ -391,37 +391,71 @@ export function resolveModelDisplayInfo(target, settings = {}, options = {}) {
|
||||
/\bMODEL_PLACEHOLDER_M669\b|\b[a-z0-9.-]*worker-agy\b|\bworker-agy-hydrogen\b|\bOrchestrator\s+Worker\b/i.test(
|
||||
combined
|
||||
);
|
||||
const isKnownOrchCarbonPh = /\bMODEL_PLACEHOLDER_M667\b/i.test(combined);
|
||||
const isKnownOrchArgonPh = /\bMODEL_PLACEHOLDER_M681\b/i.test(combined);
|
||||
const isKnownOrchNeonPh = /\bMODEL_PLACEHOLDER_M537\b/i.test(combined);
|
||||
const dynamicOrchVariantMatch =
|
||||
combined.match(/\bOrchestrator\s*\(\s*([a-z0-9-]+)\s*\)/i) ||
|
||||
combined.match(/\bgemini-pro-orchestrator-([a-z0-9-]+)\b/i) ||
|
||||
combined.match(/\b(?:orchestrator|orch)-([a-z0-9]+)(?=·|\s|$)/i);
|
||||
const dynamicOrchVariant =
|
||||
dynamicOrchVariantMatch && dynamicOrchVariantMatch[1].toLowerCase() !== 'worker'
|
||||
? dynamicOrchVariantMatch[1].toLowerCase()
|
||||
: '';
|
||||
const hasBareProOrch = /\bgemini-pro-orchestrator\b(?![-_][a-z0-9])/i.test(combined);
|
||||
const isOrchSeries =
|
||||
isOrchWorker ||
|
||||
/\bgemini-pro-orchestrator(?:-argon)?\b|\borchestrator-(?:carbon|argon)\b|\borch-(?:carbon|argon)(?:·压缩)?(?=\s|$)|Orchestrator\s*\((?:Carbon|Argon)\)|\bMODEL_PLACEHOLDER_M(?:667|681)\b/i.test(
|
||||
combined
|
||||
);
|
||||
Boolean(dynamicOrchVariant) ||
|
||||
isKnownOrchNeonPh ||
|
||||
isKnownOrchArgonPh ||
|
||||
isKnownOrchCarbonPh ||
|
||||
hasBareProOrch;
|
||||
|
||||
if (isOrchSeries) {
|
||||
let compactId = 'orchestrator-carbon';
|
||||
let fullId = 'gemini-pro-orchestrator (carbon-4)';
|
||||
let compactId = '';
|
||||
let fullId = '';
|
||||
if (isOrchWorker) {
|
||||
compactId = 'worker-agy-hydrogen';
|
||||
fullId = 'gemini-flash-worker-agy (hydrogen-4)';
|
||||
} else if (/\bargon\b|\bMODEL_PLACEHOLDER_M681\b|\borch-argon\b/i.test(combined)) {
|
||||
} else if (isKnownOrchNeonPh || dynamicOrchVariant === 'neon') {
|
||||
compactId = 'orchestrator-neon';
|
||||
fullId = 'gemini-pro-orchestrator-neon (neon-4)';
|
||||
} else if (isKnownOrchArgonPh || dynamicOrchVariant === 'argon') {
|
||||
compactId = 'orchestrator-argon';
|
||||
fullId = 'gemini-pro-orchestrator-argon (argon-4)';
|
||||
} else if (
|
||||
isKnownOrchCarbonPh ||
|
||||
dynamicOrchVariant === 'carbon' ||
|
||||
(hasBareProOrch && !dynamicOrchVariant)
|
||||
) {
|
||||
compactId = 'orchestrator-carbon';
|
||||
fullId = 'gemini-pro-orchestrator (carbon-4)';
|
||||
} else if (dynamicOrchVariant) {
|
||||
compactId = `orchestrator-${dynamicOrchVariant}`;
|
||||
const cleanUpstream = stripCompactionMarker(upstreamText || responseText || '').trim();
|
||||
fullId = cleanUpstream
|
||||
? cleanUpstream.toLowerCase().includes(dynamicOrchVariant)
|
||||
? cleanUpstream
|
||||
: `${cleanUpstream} (${dynamicOrchVariant})`
|
||||
: `gemini-pro-orchestrator-${dynamicOrchVariant}`;
|
||||
}
|
||||
if (compactId) {
|
||||
const baseText = orchestratorMode === 'full' ? fullId : compactId;
|
||||
const text = `${baseText}${compactionSuffix}`;
|
||||
const multiUpstream =
|
||||
Array.isArray(target.upstreamModels) && target.upstreamModels.length > 1
|
||||
? target.upstreamModels.join(' / ')
|
||||
: '';
|
||||
const title = multiUpstream || `${fullId}${compactionSuffix}`;
|
||||
return {
|
||||
text,
|
||||
baseText,
|
||||
compactionSuffix,
|
||||
isCompaction,
|
||||
title,
|
||||
isOrchestratorSeries: true,
|
||||
};
|
||||
}
|
||||
const baseText = orchestratorMode === 'full' ? fullId : compactId;
|
||||
const text = `${baseText}${compactionSuffix}`;
|
||||
const multiUpstream =
|
||||
Array.isArray(target.upstreamModels) && target.upstreamModels.length > 1
|
||||
? target.upstreamModels.join(' / ')
|
||||
: '';
|
||||
const title = multiUpstream || `${fullId}${compactionSuffix}`;
|
||||
return {
|
||||
text,
|
||||
baseText,
|
||||
compactionSuffix,
|
||||
isCompaction,
|
||||
title,
|
||||
isOrchestratorSeries: true,
|
||||
};
|
||||
}
|
||||
|
||||
const rawSelected =
|
||||
|
||||
@@ -207,6 +207,6 @@ export function backendHarness({
|
||||
return {ok:true,json:async()=>data};
|
||||
},
|
||||
};
|
||||
vm.runInNewContext(source+'\n globalThis.api={buildTelemetryPayloadInternal,executeTelemetryAction,dispatchBridgeApiRequest,executeAccountCredentialAction,callLsRpc,computeStepCost,resolveModelInfo,resolvePricingAt,inferFamilyFromProviderOrKey,isArgonModelIdentifier,isCarbonModelIdentifier,getBaseModelLabel,formatUpstreamModelId,PLACEHOLDER_MAP,normalizeQuotaFraction,classifyOfficialBucketWindow,classifyQuotaPoolIdentity,buildOfficialQuotaPools,resolveTimeWindow,sanitizeCatalogPayload,rebuildActiveCatalog,getPricingPhaseEpoch,detectCustomGitForkRepo,persistTrajectoryCacheIfNeeded,flushTrajectoryCacheNow,getCachedTrajectory,listCachedTrajectoryEntries,hasPendingTrajectoryCacheSave,syncCloudCatalog,getCloudStatus,isValidSemver,compareSemver,performPluginUpdate,resolveMigratedGitRemoteUrl,loadSettings,executeSettingsAction,executeModelContextWindowAction,executeResetSettingsAction,executeRebuildCacheAction,clearRuntimeCaches,normalizeTopbarCapsuleSlots,normalizeHoverModules,normalizeOverviewModules,normalizeOverviewMetrics,normalizeStepTableColumns,normalizeStepTokenComboFormat,parseStepTokenComboSegments,normalizeModelDisplayMode,normalizePopoverWidthMode,normalizePopoverWidth,normalizeStandalonePort,setStandalonePortListener,parseAnnotationPbtxtTitle,readLocalSummarySnapshot,readLocalSqliteTrajectory,computeSqliteWalSig,buildCliStatusSnapshot,buildCliStatusLineCommand,isManagedCliStatusLineCommand,applyCliStatusLineToSettingsObject,cliDisplayWidth,parseCliModelAndEffort,formatCliStatusLineCapsule,registerRemoteEndpoint,getRegisteredRemoteEndpoint,resolveEndpointContext,clearRemoteEndpointCaches,clearRemoteEndpointRegistry,setRemoteWindowRpcInvoker,setLoopbackHttpsRequester,getEndpointCacheStore,pruneStaleRemoteEndpoints,trackEndpointRequestStart,trackEndpointRequestEnd,shouldRemoteEndpointPreferTier2,markRemoteEndpointPreferTier2};',ctx);
|
||||
vm.runInNewContext(source+'\n globalThis.api={buildTelemetryPayloadInternal,executeTelemetryAction,dispatchBridgeApiRequest,executeAccountCredentialAction,callLsRpc,computeStepCost,resolveModelInfo,resolvePricingAt,inferFamilyFromProviderOrKey,isNeonModelIdentifier,isArgonModelIdentifier,isCarbonModelIdentifier,getBaseModelLabel,formatUpstreamModelId,PLACEHOLDER_MAP,normalizeQuotaFraction,classifyOfficialBucketWindow,classifyQuotaPoolIdentity,buildOfficialQuotaPools,resolveTimeWindow,sanitizeCatalogPayload,rebuildActiveCatalog,getPricingPhaseEpoch,detectCustomGitForkRepo,persistTrajectoryCacheIfNeeded,flushTrajectoryCacheNow,getCachedTrajectory,listCachedTrajectoryEntries,hasPendingTrajectoryCacheSave,syncCloudCatalog,getCloudStatus,isValidSemver,compareSemver,performPluginUpdate,resolveMigratedGitRemoteUrl,loadSettings,executeSettingsAction,executeModelContextWindowAction,executeResetSettingsAction,executeRebuildCacheAction,clearRuntimeCaches,normalizeTopbarCapsuleSlots,normalizeHoverModules,normalizeOverviewModules,normalizeOverviewMetrics,normalizeStepTableColumns,normalizeStepTokenComboFormat,parseStepTokenComboSegments,normalizeModelDisplayMode,normalizePopoverWidthMode,normalizePopoverWidth,normalizeStandalonePort,setStandalonePortListener,parseAnnotationPbtxtTitle,readLocalSummarySnapshot,readLocalSqliteTrajectory,computeSqliteWalSig,buildCliStatusSnapshot,buildCliStatusLineCommand,isManagedCliStatusLineCommand,applyCliStatusLineToSettingsObject,cliDisplayWidth,parseCliModelAndEffort,formatCliStatusLineCapsule,registerRemoteEndpoint,getRegisteredRemoteEndpoint,resolveEndpointContext,clearRemoteEndpointCaches,clearRemoteEndpointRegistry,setRemoteWindowRpcInvoker,setLoopbackHttpsRequester,getEndpointCacheStore,pruneStaleRemoteEndpoints,trackEndpointRequestStart,trackEndpointRequestEnd,shouldRemoteEndpointPreferTier2,markRemoteEndpointPreferTier2};',ctx);
|
||||
return {...ctx.api,state};
|
||||
}
|
||||
|
||||
@@ -199,6 +199,7 @@ test('frontend considers a model-only correction a real telemetry update', () =>
|
||||
|
||||
const ORCH_CARBON = 'MODEL_PLACEHOLDER_M667';
|
||||
const ORCH_ARGON = 'MODEL_PLACEHOLDER_M681';
|
||||
const ORCH_NEON = 'MODEL_PLACEHOLDER_M537';
|
||||
const ORCH_EXEC_HYDROGEN = 'MODEL_PLACEHOLDER_M669';
|
||||
|
||||
test('Orchestrator (Carbon) direct/planning and inferred compaction steps resolve to orch-carbon and annotate upstream ID', async () => {
|
||||
@@ -285,6 +286,148 @@ test('Orchestrator (Argon) resolves to orch-argon, annotates upstream ID, and is
|
||||
assert.equal(h.isCarbonModelIdentifier(ORCH_ARGON, 'gemini-pro-orchestrator-argon', 'Orchestrator (Argon)'), false);
|
||||
});
|
||||
|
||||
test('Orchestrator (Neon) resolves to orch-neon, annotates upstream ID, uses Neon pricing, and is not misclassified as Carbon', async () => {
|
||||
const rows = [step(1, ORCH_NEON), step(2, ORCH_EXEC_HYDROGEN)];
|
||||
const h = backendHarness({
|
||||
clock: () => PROMO_CLOCK_MS,
|
||||
summaries: { test: { stepCount: 2 } },
|
||||
trajectories: {
|
||||
test: {
|
||||
trajectory: {
|
||||
steps: rows,
|
||||
generatorMetadata: [
|
||||
{
|
||||
stepIndices: [1],
|
||||
chatModel: {
|
||||
model: ORCH_NEON,
|
||||
responseModel: 'gemini-pro-orchestrator-neon',
|
||||
modelDisplayName: 'Orchestrator (Neon)',
|
||||
},
|
||||
plannerConfig: {
|
||||
planModel: ORCH_NEON,
|
||||
modelName: 'gemini-pro-orchestrator-neon',
|
||||
planExecuteConfig: { executionModel: ORCH_EXEC_HYDROGEN },
|
||||
},
|
||||
},
|
||||
{
|
||||
stepIndices: [2],
|
||||
chatModel: {
|
||||
model: ORCH_EXEC_HYDROGEN,
|
||||
responseModel: 'gemini-flash-worker-agy',
|
||||
modelDisplayName: 'Gemini Flash',
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
const p = await h.buildTelemetryPayloadInternal('test');
|
||||
const s1 = p.activeConversation.recentSteps.find((s) => s.stepIndex === 1);
|
||||
const s2 = p.activeConversation.recentSteps.find((s) => s.stepIndex === 2);
|
||||
assert.equal(s1.modelShort, 'orch-neon');
|
||||
assert.equal(s1.modelLabel, 'Orchestrator (Neon)');
|
||||
assert.equal(s1.modelUpstream, 'gemini-pro-orchestrator-neon (neon-4)');
|
||||
// step() fixture: 1000 input ($3/M = 0.003) + 9000 cache ($0.15/M = 0.00135) + 1000 output ($15/M = 0.015) = 0.01935 -> 0.0193 (4-decimal payload rounding)
|
||||
assert.equal(s1.costUsd, 0.0193);
|
||||
assert.equal(s2.modelShort, 'hydrogen-4');
|
||||
assert.equal(s2.modelLabel, 'Orchestrator Worker (Hydrogen)');
|
||||
assert.equal(s2.modelUpstream, 'gemini-flash-worker-agy (hydrogen-4)');
|
||||
|
||||
const neonRow = p.modelBreakdown.find((m) => m.label === 'Orchestrator (Neon)');
|
||||
assert.ok(neonRow, 'modelBreakdown keeps Orchestrator (Neon) separate');
|
||||
assert.equal(neonRow.upstreamName, 'gemini-pro-orchestrator-neon (neon-4)');
|
||||
assert.equal(h.isNeonModelIdentifier(ORCH_NEON, 'gemini-pro-orchestrator-neon', 'Orchestrator (Neon)'), true);
|
||||
assert.equal(h.isCarbonModelIdentifier(ORCH_NEON, 'gemini-pro-orchestrator-neon', 'Orchestrator (Neon)'), false);
|
||||
assert.equal(h.isCarbonModelIdentifier(ORCH_NEON, 'gemini-pro-orchestrator', 'Orchestrator (Neon)'), false);
|
||||
assert.equal(h.isArgonModelIdentifier(ORCH_NEON, 'gemini-pro-orchestrator-neon', 'Orchestrator (Neon)'), false);
|
||||
|
||||
// Pure placeholder lookup without modelDisplayName / responseModel
|
||||
const neonOrchInfo = h.resolveModelInfo(ORCH_NEON);
|
||||
assert.equal(neonOrchInfo.shortName, 'orch-neon');
|
||||
assert.equal(neonOrchInfo.label, 'Orchestrator (Neon)');
|
||||
assert.equal(neonOrchInfo.pricing.input, 3.0);
|
||||
assert.equal(neonOrchInfo.pricing.output, 15.0);
|
||||
|
||||
const neonXhighInfo = h.resolveModelInfo('MODEL_PLACEHOLDER_M535');
|
||||
assert.equal(neonXhighInfo.shortName, 'neon-4-xhigh');
|
||||
assert.equal(neonXhighInfo.baseLabel, 'Gemini 4 Neon');
|
||||
assert.equal(neonXhighInfo.pricing.input, 3.0);
|
||||
assert.equal(neonXhighInfo.pricing.output, 15.0);
|
||||
});
|
||||
|
||||
test('future uncatalogued Orchestrator variants never fall back to Carbon identity, pricing, or display', async () => {
|
||||
const FUTURE_ORCH_1 = 'MODEL_PLACEHOLDER_M991';
|
||||
const FUTURE_ORCH_2 = 'MODEL_PLACEHOLDER_M992';
|
||||
const rows = [step(1, FUTURE_ORCH_1), step(2, FUTURE_ORCH_2)];
|
||||
const h = backendHarness({
|
||||
clock: () => PROMO_CLOCK_MS,
|
||||
summaries: { test: { stepCount: 2 } },
|
||||
trajectories: {
|
||||
test: {
|
||||
trajectory: {
|
||||
steps: rows,
|
||||
generatorMetadata: [
|
||||
{
|
||||
stepIndices: [1],
|
||||
chatModel: {
|
||||
model: FUTURE_ORCH_1,
|
||||
responseModel: 'gemini-pro-orchestrator-xenon',
|
||||
modelDisplayName: 'Orchestrator (Xenon)',
|
||||
},
|
||||
},
|
||||
{
|
||||
stepIndices: [2],
|
||||
chatModel: {
|
||||
model: FUTURE_ORCH_2,
|
||||
responseModel: 'gemini-pro-orchestrator',
|
||||
modelDisplayName: 'Orchestrator (Helium)',
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
const p = await h.buildTelemetryPayloadInternal('test');
|
||||
const s1 = p.activeConversation.recentSteps.find((s) => s.stepIndex === 1);
|
||||
const s2 = p.activeConversation.recentSteps.find((s) => s.stepIndex === 2);
|
||||
|
||||
// Neither future variant may be misclassified as Carbon, given Carbon pricing, or stamped (carbon-4)
|
||||
assert.equal(h.isCarbonModelIdentifier(FUTURE_ORCH_1, 'gemini-pro-orchestrator-xenon', 'Orchestrator (Xenon)'), false);
|
||||
assert.equal(h.isCarbonModelIdentifier(FUTURE_ORCH_2, 'gemini-pro-orchestrator', 'Orchestrator (Helium)'), false);
|
||||
assert.equal(s1.costUsd, null);
|
||||
assert.equal(s2.costUsd, null);
|
||||
assert.equal(s1.modelUpstream, 'gemini-pro-orchestrator-xenon');
|
||||
assert.equal(s2.modelUpstream, 'gemini-pro-orchestrator');
|
||||
assert.notEqual(s1.modelShort, 'orch-carbon');
|
||||
assert.notEqual(s2.modelShort, 'orch-carbon');
|
||||
|
||||
// Frontend dynamically renders orchestrator-<variant> without silently falling back to orchestrator-carbon
|
||||
assert.equal(resolveModelDisplayInfo(s1, { orchestratorIdMode: 'compact' }).text, 'orchestrator-xenon');
|
||||
assert.equal(resolveModelDisplayInfo(s1, { orchestratorIdMode: 'full' }).text, 'gemini-pro-orchestrator-xenon');
|
||||
assert.equal(resolveModelDisplayInfo(s2, { orchestratorIdMode: 'compact' }).text, 'orchestrator-helium');
|
||||
assert.equal(resolveModelDisplayInfo(s2, { orchestratorIdMode: 'full' }).text, 'gemini-pro-orchestrator (helium)');
|
||||
|
||||
// Direct non-Orchestrator Carbon/Argon/Neon models remain unaffected
|
||||
assert.equal(
|
||||
resolveModelDisplayInfo(
|
||||
{ modelKey: 'MODEL_PLACEHOLDER_M429', modelShort: 'carbon-4-high', modelLabel: 'Gemini 4 Carbon (High)', modelUpstream: 'gemini-4-carbon-high' },
|
||||
{ showUpstreamModel: false, orchestratorIdMode: 'compact' }
|
||||
).text,
|
||||
'carbon-4-high'
|
||||
);
|
||||
assert.equal(
|
||||
resolveModelDisplayInfo(
|
||||
{ modelKey: 'MODEL_PLACEHOLDER_M535', modelShort: 'neon-4-xhigh', modelLabel: 'Gemini 4 Neon (XHigh)', modelUpstream: 'gemini-4-neon-xhigh' },
|
||||
{ showUpstreamModel: false, orchestratorIdMode: 'compact' }
|
||||
).text,
|
||||
'neon-4-xhigh'
|
||||
);
|
||||
});
|
||||
|
||||
test('real-world M669 worker steps (responseModel gemini-flash-worker-agy, displayName Gemini Flash) and uncatalogued executionModel resolve to Hydrogen', async () => {
|
||||
const FUTURE_EXEC_PH = 'MODEL_PLACEHOLDER_M799';
|
||||
const rows = [step(1, ORCH_CARBON), step(2, ORCH_EXEC_HYDROGEN), step(3, FUTURE_EXEC_PH)];
|
||||
@@ -428,6 +571,21 @@ test('orchestratorIdMode defaults to compact, persists via settings action, and
|
||||
modelUpstream: 'gemini-pro-orchestrator-argon (argon-4)',
|
||||
responseModel: 'gemini-pro-orchestrator-argon',
|
||||
};
|
||||
const orchNeon = {
|
||||
modelKey: ORCH_NEON,
|
||||
modelShort: 'orch-neon',
|
||||
modelLabel: 'Orchestrator (Neon)',
|
||||
modelUpstream: 'gemini-pro-orchestrator-neon (neon-4)',
|
||||
responseModel: 'gemini-pro-orchestrator-neon',
|
||||
};
|
||||
const orchNeonCompaction = {
|
||||
modelKey: ORCH_NEON,
|
||||
modelShort: 'orch-neon·压缩',
|
||||
modelLabel: 'Orchestrator (Neon) [自动压缩]',
|
||||
modelUpstream: 'gemini-pro-orchestrator-neon (neon-4)·压缩',
|
||||
responseModel: 'gemini-pro-orchestrator-neon',
|
||||
isCompactionStep: true,
|
||||
};
|
||||
const orchWorkerCompaction = {
|
||||
modelKey: ORCH_EXEC_HYDROGEN,
|
||||
modelShort: 'hydrogen-4·压缩',
|
||||
@@ -452,6 +610,14 @@ test('orchestratorIdMode defaults to compact, persists via settings action, and
|
||||
resolveModelDisplayInfo(orchArgon, { showUpstreamModel, orchestratorIdMode: 'compact' }).text,
|
||||
'orchestrator-argon'
|
||||
);
|
||||
assert.equal(
|
||||
resolveModelDisplayInfo(orchNeon, { showUpstreamModel, orchestratorIdMode: 'compact' }).text,
|
||||
'orchestrator-neon'
|
||||
);
|
||||
assert.equal(
|
||||
resolveModelDisplayInfo(orchNeonCompaction, { showUpstreamModel, orchestratorIdMode: 'compact' }).text,
|
||||
'orchestrator-neon·压缩'
|
||||
);
|
||||
assert.equal(
|
||||
resolveModelDisplayInfo(orchWorkerCompaction, { showUpstreamModel, orchestratorIdMode: 'compact' }).text,
|
||||
'worker-agy-hydrogen·压缩'
|
||||
@@ -464,6 +630,14 @@ test('orchestratorIdMode defaults to compact, persists via settings action, and
|
||||
resolveModelDisplayInfo(orchArgon, { showUpstreamModel, orchestratorIdMode: 'full' }).text,
|
||||
'gemini-pro-orchestrator-argon (argon-4)'
|
||||
);
|
||||
assert.equal(
|
||||
resolveModelDisplayInfo(orchNeon, { showUpstreamModel, orchestratorIdMode: 'full' }).text,
|
||||
'gemini-pro-orchestrator-neon (neon-4)'
|
||||
);
|
||||
assert.equal(
|
||||
resolveModelDisplayInfo(orchNeonCompaction, { showUpstreamModel, orchestratorIdMode: 'full' }).text,
|
||||
'gemini-pro-orchestrator-neon (neon-4)·压缩'
|
||||
);
|
||||
assert.equal(
|
||||
resolveModelDisplayInfo(orchWorkerCompaction, { showUpstreamModel, orchestratorIdMode: 'full' }).text,
|
||||
'gemini-flash-worker-agy (hydrogen-4)·压缩'
|
||||
|
||||
@@ -887,7 +887,7 @@ export function extractModelSteps(rawSteps = [], generatorMetadata = []) {
|
||||
if (
|
||||
typeof execModel === 'string' &&
|
||||
execModel.trim() &&
|
||||
/orchestrator|MODEL_PLACEHOLDER_M(?:667|681)\b/i.test(
|
||||
/orchestrator|MODEL_PLACEHOLDER_M(?:667|681|537)\b/i.test(
|
||||
`${pc?.modelName || ''} ${pc?.planModel || ''}`
|
||||
)
|
||||
) {
|
||||
|
||||
Reference in New Issue
Block a user