From e1c3134e724cc9601d95f58fe553e1227b2924d5 Mon Sep 17 00:00:00 2001 From: fish <1770968958@qq.com> Date: Fri, 20 Nov 2026 16:30:37 +0900 Subject: [PATCH] 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 --- pricing-catalog.json | 6 +- sidecars/panel/app.js | 82 ++++++--- sidecars/panel/backend/model-pricing.mjs | 73 +++++++- sidecars/panel/index.html | 4 +- .../components/layout/WindowOverlayShell.js | 2 +- sidecars/panel/src/core/formatters.js | 80 +++++--- sidecars/panel/test/backend-harness.mjs | 2 +- sidecars/panel/test/model-identity.test.mjs | 174 ++++++++++++++++++ sidecars/panel/trajectory-metrics.mjs | 2 +- 9 files changed, 363 insertions(+), 62 deletions(-) diff --git a/pricing-catalog.json b/pricing-catalog.json index d2d403a..46b7f8e 100644 --- a/pricing-catalog.json +++ b/pricing-catalog.json @@ -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)" }, diff --git a/sidecars/panel/app.js b/sidecars/panel/app.js index 930c2c4..5ab5a05 100644 --- a/sidecars/panel/app.js +++ b/sidecars/panel/app.js @@ -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; diff --git a/sidecars/panel/backend/model-pricing.mjs b/sidecars/panel/backend/model-pricing.mjs index d8c3493..34c551d 100644 --- a/sidecars/panel/backend/model-pricing.mjs +++ b/sidecars/panel/backend/model-pricing.mjs @@ -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)`; } diff --git a/sidecars/panel/index.html b/sidecars/panel/index.html index 9524768..5f0132e 100644 --- a/sidecars/panel/index.html +++ b/sidecars/panel/index.html @@ -4,11 +4,11 @@