mirror of
https://github.com/lWolvesl/antigravity-usage-monitor.git
synced 2026-11-26 17:09:28 +08:00
feat(panel): support Opus 5.5 Orchestrator and Neon/multi-model execution workers
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"schemaVersion": 1,
|
"schemaVersion": 1,
|
||||||
"catalogVersion": "2026.11.21.2",
|
"catalogVersion": "2026.11.21.3",
|
||||||
"updatedAt": "2026-11-21T13:45:00+09:00",
|
"updatedAt": "2026-11-21T14:35:00+09:00",
|
||||||
"latestPluginVersion": "1.5.4",
|
"latestPluginVersion": "1.5.4",
|
||||||
"releaseUrl": "https://github.com/yuhuan-dev/antigravity-usage-monitor/releases/latest",
|
"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",
|
"downloadUrl": "https://github.com/yuhuan-dev/antigravity-usage-monitor/releases/latest/download/usage-monitor.zip",
|
||||||
@@ -13,6 +13,12 @@
|
|||||||
"orchestrator-argon": { "input": 2.00, "cache": 0.10, "output": 10.0, "short": "orch-argon", "family": "Gemini", "phases": [{ "until": "2026-12-01T00:00:00Z", "input": 2.00, "cache": 0.10, "output": 10.0 }, { "from": "2026-12-01T00:00:00Z", "input": 4.00, "cache": 0.20, "output": 20.0 }] },
|
"orchestrator-argon": { "input": 2.00, "cache": 0.10, "output": 10.0, "short": "orch-argon", "family": "Gemini", "phases": [{ "until": "2026-12-01T00:00:00Z", "input": 2.00, "cache": 0.10, "output": 10.0 }, { "from": "2026-12-01T00:00:00Z", "input": 4.00, "cache": 0.20, "output": 20.0 }] },
|
||||||
"gemini-pro-orchestrator-neon": { "input": 3.00, "cache": 0.15, "output": 15.0, "short": "orch-neon", "family": "Gemini" },
|
"gemini-pro-orchestrator-neon": { "input": 3.00, "cache": 0.15, "output": 15.0, "short": "orch-neon", "family": "Gemini" },
|
||||||
"orchestrator-neon": { "input": 3.00, "cache": 0.15, "output": 15.0, "short": "orch-neon", "family": "Gemini" },
|
"orchestrator-neon": { "input": 3.00, "cache": 0.15, "output": 15.0, "short": "orch-neon", "family": "Gemini" },
|
||||||
|
"orchestrator-worker-neon": { "input": 3.00, "cache": 0.15, "output": 15.0, "short": "neon-4", "family": "Gemini" },
|
||||||
|
"gemini-neon-worker-agy": { "input": 3.00, "cache": 0.15, "output": 15.0, "short": "neon-4", "family": "Gemini" },
|
||||||
|
"gemini-4-neon-worker-agy": { "input": 3.00, "cache": 0.15, "output": 15.0, "short": "neon-4", "family": "Gemini" },
|
||||||
|
"orchestrator-opus-5-5": { "input": 4.00, "cache": 0.20, "output": 20.0, "short": "orch-opus-5.5", "family": "Claude" },
|
||||||
|
"orchestrator-claude-opus-5-5": { "input": 4.00, "cache": 0.20, "output": 20.0, "short": "orch-opus-5.5", "family": "Claude" },
|
||||||
|
"claude-opus-5-5-orchestrator": { "input": 4.00, "cache": 0.20, "output": 20.0, "short": "orch-opus-5.5", "family": "Claude" },
|
||||||
"gemini-4-carbon-high": { "input": 2.00, "cache": 0.10, "output": 10.0, "short": "carbon-4-high", "family": "Gemini", "phases": [{ "until": "2026-12-01T00:00:00Z", "input": 2.00, "cache": 0.10, "output": 10.0 }, { "from": "2026-12-01T00:00:00Z", "input": 4.00, "cache": 0.20, "output": 20.0 }] },
|
"gemini-4-carbon-high": { "input": 2.00, "cache": 0.10, "output": 10.0, "short": "carbon-4-high", "family": "Gemini", "phases": [{ "until": "2026-12-01T00:00:00Z", "input": 2.00, "cache": 0.10, "output": 10.0 }, { "from": "2026-12-01T00:00:00Z", "input": 4.00, "cache": 0.20, "output": 20.0 }] },
|
||||||
"gemini-4-carbon-medium": { "input": 2.00, "cache": 0.10, "output": 10.0, "short": "carbon-4", "family": "Gemini", "phases": [{ "until": "2026-12-01T00:00:00Z", "input": 2.00, "cache": 0.10, "output": 10.0 }, { "from": "2026-12-01T00:00:00Z", "input": 4.00, "cache": 0.20, "output": 20.0 }] },
|
"gemini-4-carbon-medium": { "input": 2.00, "cache": 0.10, "output": 10.0, "short": "carbon-4", "family": "Gemini", "phases": [{ "until": "2026-12-01T00:00:00Z", "input": 2.00, "cache": 0.10, "output": 10.0 }, { "from": "2026-12-01T00:00:00Z", "input": 4.00, "cache": 0.20, "output": 20.0 }] },
|
||||||
"gemini-4-carbon-low": { "input": 2.00, "cache": 0.10, "output": 10.0, "short": "carbon-4-low", "family": "Gemini", "phases": [{ "until": "2026-12-01T00:00:00Z", "input": 2.00, "cache": 0.10, "output": 10.0 }, { "from": "2026-12-01T00:00:00Z", "input": 4.00, "cache": 0.20, "output": 20.0 }] },
|
"gemini-4-carbon-low": { "input": 2.00, "cache": 0.10, "output": 10.0, "short": "carbon-4-low", "family": "Gemini", "phases": [{ "until": "2026-12-01T00:00:00Z", "input": 2.00, "cache": 0.10, "output": 10.0 }, { "from": "2026-12-01T00:00:00Z", "input": 4.00, "cache": 0.20, "output": 20.0 }] },
|
||||||
|
|||||||
+145
-16
@@ -3894,15 +3894,105 @@ function stripCompactionMarker(rawText) {
|
|||||||
|
|
||||||
const normalizeOrchestratorIdDisplayMode = normalizeOrchestratorIdMode;
|
const normalizeOrchestratorIdDisplayMode = normalizeOrchestratorIdMode;
|
||||||
|
|
||||||
|
function normalizeOrchVariantToken(raw = '') {
|
||||||
|
let s = String(raw || '')
|
||||||
|
.trim()
|
||||||
|
.toLowerCase()
|
||||||
|
.replace(/\s+/g, '-')
|
||||||
|
.replace(/[^a-z0-9.-]+/g, '-')
|
||||||
|
.replace(/-+/g, '-')
|
||||||
|
.replace(/^-+|-+$/g, '');
|
||||||
|
if (!s || /^worker(?:$|-)/.test(s)) return '';
|
||||||
|
s = s.replace(/([a-z]-)(\d+)-(\d+)(?=$|-)/g, '$1$2.$3');
|
||||||
|
s = s
|
||||||
|
.replace(/^(?:claude|anthropic|openai)-(?=.+)/, '')
|
||||||
|
.replace(/^gemini-(?:4-)?(?=(?:carbon|argon|neon|hydrogen|helix)(?:$|-))/, '');
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
|
||||||
|
function extractOrchWorkerVariant(fields = [], combinedText = '') {
|
||||||
|
for (const rawField of fields) {
|
||||||
|
const field = String(rawField || '').trim();
|
||||||
|
if (!field) continue;
|
||||||
|
const parenMatch = field.match(/\bOrchestrator\s+Worker\s*\(\s*([^)]+?)\s*\)/i);
|
||||||
|
if (parenMatch) {
|
||||||
|
const v = normalizeOrchVariantToken(parenMatch[1]);
|
||||||
|
if (v) return v;
|
||||||
|
}
|
||||||
|
const compactMatch = field.match(/\bworker-agy-([a-z0-9]+(?:[.-][a-z0-9]+)*)(?=·|\s|$)/i);
|
||||||
|
if (compactMatch) {
|
||||||
|
const v = normalizeOrchVariantToken(compactMatch[1]);
|
||||||
|
if (v) return v;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (/\bMODEL_PLACEHOLDER_M669\b|\bgemini-flash-worker-agy\b/i.test(combinedText)) {
|
||||||
|
return 'hydrogen';
|
||||||
|
}
|
||||||
|
const upstreamMatch = combinedText.match(/\b([a-z0-9][a-z0-9.-]*?)-worker-agy\b/i);
|
||||||
|
if (upstreamMatch) {
|
||||||
|
const rawPrefix = upstreamMatch[1].toLowerCase();
|
||||||
|
if (rawPrefix === 'gemini-flash') return 'hydrogen';
|
||||||
|
if (/^gemini-(?:4-)?neon$/i.test(rawPrefix)) return 'neon';
|
||||||
|
if (/^gemini-(?:4-)?argon$/i.test(rawPrefix)) return 'argon';
|
||||||
|
if (/^gemini-(?:4-)?carbon$/i.test(rawPrefix)) return 'carbon';
|
||||||
|
const v = normalizeOrchVariantToken(rawPrefix);
|
||||||
|
if (v && v !== 'gemini-pro') return v;
|
||||||
|
}
|
||||||
|
if (/\bneon\b/i.test(combinedText)) return 'neon';
|
||||||
|
if (/\bhydrogen\b/i.test(combinedText)) return 'hydrogen';
|
||||||
|
if (/\bargon\b/i.test(combinedText)) return 'argon';
|
||||||
|
if (/\bcarbon\b/i.test(combinedText)) return 'carbon';
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
function extractDynamicOrchVariant(fields = []) {
|
||||||
|
for (const rawField of fields) {
|
||||||
|
const field = String(rawField || '').trim();
|
||||||
|
if (!field) continue;
|
||||||
|
const parenAfter = field.match(/\bOrchestrator\s*\(\s*([^)]+?)\s*\)/i);
|
||||||
|
if (parenAfter) {
|
||||||
|
const v = normalizeOrchVariantToken(parenAfter[1]);
|
||||||
|
if (v) return v;
|
||||||
|
}
|
||||||
|
const parenBefore = field.match(
|
||||||
|
/^([a-z0-9][a-z0-9.\s-]{0,40}?)\s*\(\s*Orchestrator\s*\)(?:\s*\[[^\]]+\])?$/i
|
||||||
|
);
|
||||||
|
if (parenBefore) {
|
||||||
|
const v = normalizeOrchVariantToken(parenBefore[1]);
|
||||||
|
if (v) return v;
|
||||||
|
}
|
||||||
|
const geminiProSlug = field.match(
|
||||||
|
/\bgemini-pro-orchestrator-([a-z0-9]+(?:[.-][a-z0-9]+)*)(?=·|\s|$)/i
|
||||||
|
);
|
||||||
|
if (geminiProSlug) {
|
||||||
|
const v = normalizeOrchVariantToken(geminiProSlug[1]);
|
||||||
|
if (v) return v;
|
||||||
|
}
|
||||||
|
const prefixSlug = field.match(
|
||||||
|
/\b(?:orchestrator|orch)-([a-z0-9]+(?:[.-][a-z0-9]+)*)(?=·|\s|$)/i
|
||||||
|
);
|
||||||
|
if (prefixSlug) {
|
||||||
|
const v = normalizeOrchVariantToken(prefixSlug[1]);
|
||||||
|
if (v) return v;
|
||||||
|
}
|
||||||
|
const suffixSlug = field.match(/\b([a-z0-9]+(?:[.-][a-z0-9]+)*)-orchestrator(?=·|\s|$)/i);
|
||||||
|
if (suffixSlug && !/^gemini-pro$/i.test(suffixSlug[1])) {
|
||||||
|
const v = normalizeOrchVariantToken(suffixSlug[1]);
|
||||||
|
if (v) return v;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 统一解析步骤、会话摘要或模型汇总行面向用户的模型显示文本与悬停提示。
|
* 统一解析步骤、会话摘要或模型汇总行面向用户的模型显示文本及悬停提示。
|
||||||
*
|
*
|
||||||
* 规则:
|
* 规则:
|
||||||
* - Orchestrator 系列(`Orchestrator (Carbon)`、`Orchestrator (Argon)`、`Orchestrator (Neon)`、`gemini-flash-worker-agy` / `M669`)
|
* - Orchestrator 系列(如 `Orchestrator (Carbon / Argon / Neon / Opus 5.5)`、`Orchestrator Worker (Hydrogen / Neon / ...)`)
|
||||||
* 独立遵循 `orchestratorIdMode`(`'compact'` 显示 `orchestrator-carbon` / `orchestrator-argon` / `orchestrator-neon` / `worker-agy-hydrogen`;
|
* 独立遵循 `orchestratorIdMode`(`'compact'` 显示 `orchestrator-<variant>` / `worker-agy-<variant>`;
|
||||||
* `'full'` 显示带括号标注的完整上游 ID),不受普通模型显示模式影响;
|
* `'full'` 显示带括号标注的完整上游 ID),不受普通模型显示模式影响;
|
||||||
* - 其余普通模型遵循 `modelDisplayMode`(`'short'` | `'upstream_compact'` | `'upstream'`,兼容旧版布尔 `showUpstreamModel`);
|
* - 其余普通模型遵循 `modelDisplayMode`(`'short'` | `'upstream_compact'` | `'upstream'`,兼容旧版布尔 `showUpstreamModel`);
|
||||||
* - 独立拆分 `baseText` 与 `compactionSuffix`(`·压缩`),供步骤表单独保护压缩尾标永不截断。
|
* - 独立拆分 `baseText` 及 `compactionSuffix`(`·压缩`),供步骤表单独保护压缩尾标永不截断。
|
||||||
*
|
*
|
||||||
* @param {object|null|undefined} target
|
* @param {object|null|undefined} target
|
||||||
* @param {{ modelDisplayMode?: string, showUpstreamModel?: boolean, orchestratorIdMode?: string }|boolean} [settings]
|
* @param {{ modelDisplayMode?: string, showUpstreamModel?: boolean, orchestratorIdMode?: string }|boolean} [settings]
|
||||||
@@ -3967,22 +4057,16 @@ function resolveModelDisplayInfo(target, settings = {}, options = {}) {
|
|||||||
|
|
||||||
const compactionSuffix = isCompaction ? t('fmt.compactionSuffix') : '';
|
const compactionSuffix = isCompaction ? t('fmt.compactionSuffix') : '';
|
||||||
|
|
||||||
|
const fields = [labelText, shortText, upstreamText, responseText, modelKeyText];
|
||||||
const combined = `${modelKeyText} ${shortText} ${labelText} ${upstreamText} ${responseText}`;
|
const combined = `${modelKeyText} ${shortText} ${labelText} ${upstreamText} ${responseText}`;
|
||||||
const isOrchWorker =
|
const isOrchWorker =
|
||||||
/\bMODEL_PLACEHOLDER_M669\b|\b[a-z0-9.-]*worker-agy\b|\bworker-agy-hydrogen\b|\bOrchestrator\s+Worker\b/i.test(
|
/\bMODEL_PLACEHOLDER_M669\b|\b[a-z0-9.-]*worker-agy\b|\bworker-agy-[a-z0-9.-]+\b|\bOrchestrator\s+Worker\b/i.test(
|
||||||
combined
|
combined
|
||||||
);
|
);
|
||||||
const isKnownOrchCarbonPh = /\bMODEL_PLACEHOLDER_M667\b/i.test(combined);
|
const isKnownOrchCarbonPh = /\bMODEL_PLACEHOLDER_M667\b/i.test(combined);
|
||||||
const isKnownOrchArgonPh = /\bMODEL_PLACEHOLDER_M681\b/i.test(combined);
|
const isKnownOrchArgonPh = /\bMODEL_PLACEHOLDER_M681\b/i.test(combined);
|
||||||
const isKnownOrchNeonPh = /\bMODEL_PLACEHOLDER_M537\b/i.test(combined);
|
const isKnownOrchNeonPh = /\bMODEL_PLACEHOLDER_M537\b/i.test(combined);
|
||||||
const dynamicOrchVariantMatch =
|
const dynamicOrchVariant = isOrchWorker ? '' : extractDynamicOrchVariant(fields);
|
||||||
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 hasBareProOrch = /\bgemini-pro-orchestrator\b(?![-_][a-z0-9])/i.test(combined);
|
||||||
const isOrchSeries =
|
const isOrchSeries =
|
||||||
isOrchWorker ||
|
isOrchWorker ||
|
||||||
@@ -3996,8 +4080,41 @@ function resolveModelDisplayInfo(target, settings = {}, options = {}) {
|
|||||||
let compactId = '';
|
let compactId = '';
|
||||||
let fullId = '';
|
let fullId = '';
|
||||||
if (isOrchWorker) {
|
if (isOrchWorker) {
|
||||||
|
const workerVariant = extractOrchWorkerVariant(fields, combined);
|
||||||
|
const cleanUpstream = stripCompactionMarker(upstreamText || responseText || '').trim();
|
||||||
|
if (workerVariant === 'hydrogen') {
|
||||||
compactId = 'worker-agy-hydrogen';
|
compactId = 'worker-agy-hydrogen';
|
||||||
fullId = 'gemini-flash-worker-agy (hydrogen-4)';
|
fullId = 'gemini-flash-worker-agy (hydrogen-4)';
|
||||||
|
} else if (workerVariant === 'neon') {
|
||||||
|
compactId = 'worker-agy-neon';
|
||||||
|
if (cleanUpstream) {
|
||||||
|
if (/\([^)]+\)\s*$/.test(cleanUpstream)) {
|
||||||
|
fullId = cleanUpstream;
|
||||||
|
} else if (/(?:worker-agy)/i.test(cleanUpstream)) {
|
||||||
|
fullId = `${cleanUpstream} (neon-4)`;
|
||||||
|
} else if (/\bneon\b/i.test(cleanUpstream)) {
|
||||||
|
fullId = cleanUpstream;
|
||||||
|
} else {
|
||||||
|
fullId = `${cleanUpstream} (neon-4)`;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
fullId = 'gemini-neon-worker-agy (neon-4)';
|
||||||
|
}
|
||||||
|
} else if (workerVariant) {
|
||||||
|
compactId = `worker-agy-${workerVariant}`;
|
||||||
|
const variantDashed = workerVariant.replace(/\./g, '-');
|
||||||
|
const upstreamLower = cleanUpstream.toLowerCase();
|
||||||
|
const mentionsVariant =
|
||||||
|
upstreamLower.includes(workerVariant) || upstreamLower.includes(variantDashed);
|
||||||
|
fullId = cleanUpstream
|
||||||
|
? mentionsVariant || /\([^)]+\)\s*$/.test(cleanUpstream)
|
||||||
|
? cleanUpstream
|
||||||
|
: `${cleanUpstream} (${workerVariant})`
|
||||||
|
: `worker-agy-${workerVariant}`;
|
||||||
|
} else {
|
||||||
|
compactId = 'worker-agy';
|
||||||
|
fullId = cleanUpstream || 'worker-agy';
|
||||||
|
}
|
||||||
} else if (isKnownOrchNeonPh || dynamicOrchVariant === 'neon') {
|
} else if (isKnownOrchNeonPh || dynamicOrchVariant === 'neon') {
|
||||||
compactId = 'orchestrator-neon';
|
compactId = 'orchestrator-neon';
|
||||||
fullId = 'gemini-pro-orchestrator-neon (neon-4)';
|
fullId = 'gemini-pro-orchestrator-neon (neon-4)';
|
||||||
@@ -4014,12 +4131,24 @@ function resolveModelDisplayInfo(target, settings = {}, options = {}) {
|
|||||||
} else if (dynamicOrchVariant) {
|
} else if (dynamicOrchVariant) {
|
||||||
compactId = `orchestrator-${dynamicOrchVariant}`;
|
compactId = `orchestrator-${dynamicOrchVariant}`;
|
||||||
const cleanUpstream = stripCompactionMarker(upstreamText || responseText || '').trim();
|
const cleanUpstream = stripCompactionMarker(upstreamText || responseText || '').trim();
|
||||||
fullId = cleanUpstream
|
const variantDashed = dynamicOrchVariant.replace(/\./g, '-');
|
||||||
? cleanUpstream.toLowerCase().includes(dynamicOrchVariant)
|
const upstreamLower = cleanUpstream.toLowerCase();
|
||||||
|
const mentionsVariant =
|
||||||
|
upstreamLower.includes(dynamicOrchVariant) || upstreamLower.includes(variantDashed);
|
||||||
|
if (cleanUpstream) {
|
||||||
|
fullId =
|
||||||
|
mentionsVariant || /\([^)]+\)\s*$/.test(cleanUpstream)
|
||||||
? cleanUpstream
|
? cleanUpstream
|
||||||
: `${cleanUpstream} (${dynamicOrchVariant})`
|
: `${cleanUpstream} (${dynamicOrchVariant})`;
|
||||||
|
} else {
|
||||||
|
const isNonGeminiOrch = /\b(?:claude|anthropic|opus|sonnet|haiku|fable|gpt|openai)\b/i.test(
|
||||||
|
`${combined} ${dynamicOrchVariant}`
|
||||||
|
);
|
||||||
|
fullId = isNonGeminiOrch
|
||||||
|
? `orchestrator-${dynamicOrchVariant}`
|
||||||
: `gemini-pro-orchestrator-${dynamicOrchVariant}`;
|
: `gemini-pro-orchestrator-${dynamicOrchVariant}`;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (compactId) {
|
if (compactId) {
|
||||||
const baseText = orchestratorMode === 'full' ? fullId : compactId;
|
const baseText = orchestratorMode === 'full' ? fullId : compactId;
|
||||||
const text = `${baseText}${compactionSuffix}`;
|
const text = `${baseText}${compactionSuffix}`;
|
||||||
|
|||||||
@@ -19,15 +19,21 @@ import { MODEL_PRICING, PLACEHOLDER_MAP } from './pricing-catalog.mjs';
|
|||||||
* @param {string} [rawModelKey=''] 原始模型键名或占位符
|
* @param {string} [rawModelKey=''] 原始模型键名或占位符
|
||||||
* @param {string} [modelId=''] 规范化模型 ID
|
* @param {string} [modelId=''] 规范化模型 ID
|
||||||
* @param {string} [apiProvider=''] 上游 API 提供商枚举字符串
|
* @param {string} [apiProvider=''] 上游 API 提供商枚举字符串
|
||||||
|
* @param {string} [displayLabel=''] 已解析的模型展示标签
|
||||||
* @returns {'Gemini'|'Claude'|'GPT'|'Other'}
|
* @returns {'Gemini'|'Claude'|'GPT'|'Other'}
|
||||||
*/
|
*/
|
||||||
function inferFamilyFromProviderOrKey(rawModelKey = '', modelId = '', apiProvider = '') {
|
function inferFamilyFromProviderOrKey(
|
||||||
|
rawModelKey = '',
|
||||||
|
modelId = '',
|
||||||
|
apiProvider = '',
|
||||||
|
displayLabel = ''
|
||||||
|
) {
|
||||||
const prov = String(apiProvider || '').toUpperCase();
|
const prov = String(apiProvider || '').toUpperCase();
|
||||||
if (prov.includes('ANTHROPIC') || prov.includes('CLAUDE')) return 'Claude';
|
if (prov.includes('ANTHROPIC') || prov.includes('CLAUDE')) return 'Claude';
|
||||||
if (prov.includes('OPENAI') || prov.includes('GPT')) return 'GPT';
|
if (prov.includes('OPENAI') || prov.includes('GPT')) return 'GPT';
|
||||||
if (prov.includes('GEMINI') || prov.includes('GOOGLE')) return 'Gemini';
|
if (prov.includes('GEMINI') || prov.includes('GOOGLE')) return 'Gemini';
|
||||||
|
|
||||||
const combined = `${rawModelKey} ${modelId}`.toUpperCase();
|
const combined = `${rawModelKey} ${modelId} ${displayLabel}`.toUpperCase();
|
||||||
if (
|
if (
|
||||||
combined.includes('ANTHROPIC') ||
|
combined.includes('ANTHROPIC') ||
|
||||||
combined.includes('CLAUDE') ||
|
combined.includes('CLAUDE') ||
|
||||||
@@ -96,18 +102,62 @@ export function isArgonModelIdentifier(...parts) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 从一组标识字段中提取显式的非通用 Orchestrator 变体代号(如 `Orchestrator (Xenon)` -> `'xenon'`、
|
* 将 Orchestrator 变体标签或路由后缀归一化为紧凑代号(如 `"Claude Opus 5.5"` -> `"opus-5.5"`、`"Xenon"` -> `"xenon"`)。
|
||||||
* `gemini-pro-orchestrator-neon` -> `'neon'`)。未命中时返回空字符串。
|
|
||||||
*
|
*
|
||||||
* @param {string} text
|
* @param {string} [raw='']
|
||||||
* @returns {string}
|
* @returns {string}
|
||||||
*/
|
*/
|
||||||
function extractExplicitOrchestratorVariant(text = '') {
|
function normalizeOrchestratorVariantSlug(raw = '') {
|
||||||
const parenMatch = text.match(/\bOrchestrator\s*\(\s*([a-z0-9-]+)\s*\)/i);
|
let s = String(raw || '')
|
||||||
if (parenMatch) return parenMatch[1].toLowerCase();
|
.trim()
|
||||||
const slugMatch = text.match(/\b(?:gemini-pro-orchestrator|orchestrator|orch)-([a-z0-9]+)\b/i);
|
.toLowerCase()
|
||||||
if (slugMatch && slugMatch[1].toLowerCase() !== 'worker') {
|
.replace(/\s+/g, '-')
|
||||||
return slugMatch[1].toLowerCase();
|
.replace(/[^a-z0-9.-]+/g, '-')
|
||||||
|
.replace(/-+/g, '-')
|
||||||
|
.replace(/^-+|-+$/g, '');
|
||||||
|
if (!s || /^worker(?:$|-)/.test(s)) return '';
|
||||||
|
s = s.replace(/([a-z]-)(\d+)-(\d+)(?=$|-)/g, '$1$2.$3');
|
||||||
|
s = s
|
||||||
|
.replace(/^(?:claude|anthropic|openai)-(?=.+)/, '')
|
||||||
|
.replace(/^gemini-(?:4-)?(?=(?:carbon|argon|neon|hydrogen|helix)(?:$|-))/, '');
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 从一组标识字段中提取显式的非通用 Orchestrator 变体代号(如 `Orchestrator (Opus 5.5)` -> `'opus-5.5'`、
|
||||||
|
* `Orchestrator (Xenon)` -> `'xenon'`、`claude-opus-5-5-orchestrator` -> `'opus-5.5'`)。未命中时返回空字符串。
|
||||||
|
*
|
||||||
|
* @param {...string} parts
|
||||||
|
* @returns {string}
|
||||||
|
*/
|
||||||
|
function extractExplicitOrchestratorVariant(...parts) {
|
||||||
|
for (const rawPart of parts) {
|
||||||
|
const part = String(rawPart || '').trim();
|
||||||
|
if (!part) continue;
|
||||||
|
const parenAfter = part.match(/\bOrchestrator\s*\(\s*([^)]+?)\s*\)/i);
|
||||||
|
if (parenAfter) {
|
||||||
|
const v = normalizeOrchestratorVariantSlug(parenAfter[1]);
|
||||||
|
if (v) return v;
|
||||||
|
}
|
||||||
|
const parenBefore = part.match(
|
||||||
|
/^([a-z0-9][a-z0-9.\s-]{0,40}?)\s*\(\s*Orchestrator\s*\)(?:\s*\[[^\]]+\])?$/i
|
||||||
|
);
|
||||||
|
if (parenBefore) {
|
||||||
|
const v = normalizeOrchestratorVariantSlug(parenBefore[1]);
|
||||||
|
if (v) return v;
|
||||||
|
}
|
||||||
|
const prefixSlug = part.match(
|
||||||
|
/\b(?:gemini-pro-orchestrator|orchestrator|orch)-([a-z0-9]+(?:[.-][a-z0-9]+)*)(?=·|\s|$)/i
|
||||||
|
);
|
||||||
|
if (prefixSlug) {
|
||||||
|
const v = normalizeOrchestratorVariantSlug(prefixSlug[1]);
|
||||||
|
if (v) return v;
|
||||||
|
}
|
||||||
|
const suffixSlug = part.match(/\b([a-z0-9]+(?:[.-][a-z0-9]+)*)-orchestrator(?=·|\s|$)/i);
|
||||||
|
if (suffixSlug && !/^gemini-pro$/i.test(suffixSlug[1])) {
|
||||||
|
const v = normalizeOrchestratorVariantSlug(suffixSlug[1]);
|
||||||
|
if (v) return v;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
@@ -128,11 +178,13 @@ export function isCarbonModelIdentifier(...parts) {
|
|||||||
if (
|
if (
|
||||||
/\bhydrogen\b|\bgemini-flash-worker-agy\b|MODEL_PLACEHOLDER_M(?:669|52[5678])\b/i.test(text) ||
|
/\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) ||
|
/\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)
|
/\bargon\b|MODEL_PLACEHOLDER_M(?:41[789]|681)\b/i.test(text) ||
|
||||||
|
/\b(?:claude|anthropic|opus|sonnet|haiku|fable|gpt|openai)\b/i.test(text) ||
|
||||||
|
/\bOrchestrator\s+Worker\b|-worker-agy\b/i.test(text)
|
||||||
) {
|
) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
const explicitVariant = extractExplicitOrchestratorVariant(text);
|
const explicitVariant = extractExplicitOrchestratorVariant(...parts);
|
||||||
if (explicitVariant && explicitVariant !== 'carbon') {
|
if (explicitVariant && explicitVariant !== 'carbon') {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -205,9 +257,15 @@ export function formatGenericModelSlug(slug = '') {
|
|||||||
orchVariantMatch[1].charAt(0).toUpperCase() + orchVariantMatch[1].slice(1).toLowerCase();
|
orchVariantMatch[1].charAt(0).toUpperCase() + orchVariantMatch[1].slice(1).toLowerCase();
|
||||||
return `Orchestrator (${variant})`;
|
return `Orchestrator (${variant})`;
|
||||||
}
|
}
|
||||||
|
if (/^(?:claude-opus-5[.-]5-orchestrator|orchestrator-(?:claude-)?opus-5[.-]5)$/i.test(s)) {
|
||||||
|
return 'Orchestrator (Opus 5.5)';
|
||||||
|
}
|
||||||
if (/^gemini-flash-worker-agy$/i.test(s)) {
|
if (/^gemini-flash-worker-agy$/i.test(s)) {
|
||||||
return 'Orchestrator Worker (Hydrogen)';
|
return 'Orchestrator Worker (Hydrogen)';
|
||||||
}
|
}
|
||||||
|
if (/^gemini-(?:4-)?neon-worker-agy$/i.test(s)) {
|
||||||
|
return 'Orchestrator Worker (Neon)';
|
||||||
|
}
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -305,20 +363,26 @@ function resolveModelCatalogEntry(
|
|||||||
responseModel && responseModel !== 'unknown' ? String(responseModel).trim() : '';
|
responseModel && responseModel !== 'unknown' ? String(responseModel).trim() : '';
|
||||||
const cleanRawFallback =
|
const cleanRawFallback =
|
||||||
rawModelKey && rawModelKey !== 'unknown' ? rawModelKey : cleanResponseModel;
|
rawModelKey && rawModelKey !== 'unknown' ? rawModelKey : cleanResponseModel;
|
||||||
const isWorkerSlot =
|
const isHydrogenWorkerSlot =
|
||||||
rawModelKey === 'MODEL_PLACEHOLDER_M669' ||
|
rawModelKey === 'MODEL_PLACEHOLDER_M669' ||
|
||||||
/^gemini-flash-worker-agy$/i.test(cleanResponseModel);
|
/^gemini-flash-worker-agy$/i.test(cleanResponseModel);
|
||||||
|
const isNeonWorkerSlot = /^gemini-(?:4-)?neon-worker-agy$/i.test(cleanResponseModel);
|
||||||
const isVagueGenericDisplay = Boolean(
|
const isVagueGenericDisplay = Boolean(
|
||||||
modelDisplayName &&
|
modelDisplayName &&
|
||||||
(/^gemini\s+(?:flash|pro)(?:\s+worker)?$/i.test(modelDisplayName.trim()) ||
|
(/^gemini\s+(?:flash|pro)(?:\s+worker)?$/i.test(modelDisplayName.trim()) ||
|
||||||
(isWorkerSlot && /^gemini\s+4\s+hydrogen$/i.test(modelDisplayName.trim())))
|
(isHydrogenWorkerSlot && /^gemini\s+4\s+hydrogen$/i.test(modelDisplayName.trim())) ||
|
||||||
|
(isNeonWorkerSlot && /^gemini\s+(?:4\s+)?neon$/i.test(modelDisplayName.trim())))
|
||||||
|
);
|
||||||
|
const isNamedWorkerDisplay = Boolean(
|
||||||
|
modelDisplayName && /\bOrchestrator\s+Worker\s*\([^)]+\)/i.test(modelDisplayName)
|
||||||
);
|
);
|
||||||
const effectiveDisplayName =
|
const effectiveDisplayName =
|
||||||
modelDisplayName &&
|
modelDisplayName &&
|
||||||
((mergedLabel &&
|
((mergedLabel &&
|
||||||
(/\borchestrator\b/i.test(modelDisplayName) || isVagueGenericDisplay) &&
|
((/\borchestrator\b/i.test(modelDisplayName) && !isNamedWorkerDisplay) ||
|
||||||
|
isVagueGenericDisplay) &&
|
||||||
!/\borchestrator\b/i.test(mergedLabel)) ||
|
!/\borchestrator\b/i.test(mergedLabel)) ||
|
||||||
(isVagueGenericDisplay && /^gemini-flash-worker-agy$/i.test(cleanResponseModel)))
|
(isVagueGenericDisplay && (isHydrogenWorkerSlot || isNeonWorkerSlot)))
|
||||||
? ''
|
? ''
|
||||||
: modelDisplayName;
|
: modelDisplayName;
|
||||||
const derivedDisplay =
|
const derivedDisplay =
|
||||||
@@ -341,11 +405,34 @@ function resolveModelCatalogEntry(
|
|||||||
const baseLabel = getBaseModelLabel(derivedDisplay);
|
const baseLabel = getBaseModelLabel(derivedDisplay);
|
||||||
const canonicalSlug = baseLabel.toLowerCase().replace(/\s+/g, '-');
|
const canonicalSlug = baseLabel.toLowerCase().replace(/\s+/g, '-');
|
||||||
const dashedSlug = canonicalSlug.replace(/\./g, '-');
|
const dashedSlug = canonicalSlug.replace(/\./g, '-');
|
||||||
|
const baseTierlessSlug = baseLabel
|
||||||
|
.toLowerCase()
|
||||||
|
.replace(/[()]/g, ' ')
|
||||||
|
.trim()
|
||||||
|
.replace(/[^a-z0-9.]+/g, '-')
|
||||||
|
.replace(/^-+|-+$/g, '');
|
||||||
|
const baseTierlessDashedSlug = baseTierlessSlug.replace(/\./g, '-');
|
||||||
const modelId =
|
const modelId =
|
||||||
mergedModelId ||
|
mergedModelId ||
|
||||||
(rawModelKey && rawModelKey !== 'unknown' ? rawModelKey : cleanResponseModel) ||
|
(rawModelKey && rawModelKey !== 'unknown' ? rawModelKey : cleanResponseModel) ||
|
||||||
'unknown';
|
'unknown';
|
||||||
|
|
||||||
|
const isExplicitOrchestratorDisplay = /\borchestrator\b/i.test(derivedDisplay);
|
||||||
|
const orchEffortStrippedSlug = isExplicitOrchestratorDisplay
|
||||||
|
? tieredDashedSlug.replace(
|
||||||
|
/-(?:max|xhigh|high|medium|low|thinking|extra-low|tiered|preview)$/,
|
||||||
|
''
|
||||||
|
)
|
||||||
|
: '';
|
||||||
|
const displayOrchestratorPricing = isExplicitOrchestratorDisplay
|
||||||
|
? MODEL_PRICING[tieredSlug] ||
|
||||||
|
MODEL_PRICING[tieredDashedSlug] ||
|
||||||
|
MODEL_PRICING[baseTierlessSlug] ||
|
||||||
|
MODEL_PRICING[baseTierlessDashedSlug] ||
|
||||||
|
(orchEffortStrippedSlug ? MODEL_PRICING[orchEffortStrippedSlug] : null) ||
|
||||||
|
null
|
||||||
|
: null;
|
||||||
|
|
||||||
const isOpaqueOrchestratorResp = Boolean(
|
const isOpaqueOrchestratorResp = Boolean(
|
||||||
cleanResponseModel && /\borchestrator\b/i.test(cleanResponseModel)
|
cleanResponseModel && /\borchestrator\b/i.test(cleanResponseModel)
|
||||||
);
|
);
|
||||||
@@ -357,6 +444,7 @@ function resolveModelCatalogEntry(
|
|||||||
const explicitPricing =
|
const explicitPricing =
|
||||||
MODEL_PRICING[modelId] ||
|
MODEL_PRICING[modelId] ||
|
||||||
MODEL_PRICING[rawModelKey] ||
|
MODEL_PRICING[rawModelKey] ||
|
||||||
|
displayOrchestratorPricing ||
|
||||||
(cleanResponseModel && !isOpaqueOrchestratorResp
|
(cleanResponseModel && !isOpaqueOrchestratorResp
|
||||||
? MODEL_PRICING[cleanResponseModel]
|
? MODEL_PRICING[cleanResponseModel]
|
||||||
: null) ||
|
: null) ||
|
||||||
@@ -364,6 +452,8 @@ function resolveModelCatalogEntry(
|
|||||||
MODEL_PRICING[tieredDashedSlug] ||
|
MODEL_PRICING[tieredDashedSlug] ||
|
||||||
MODEL_PRICING[canonicalSlug] ||
|
MODEL_PRICING[canonicalSlug] ||
|
||||||
MODEL_PRICING[dashedSlug] ||
|
MODEL_PRICING[dashedSlug] ||
|
||||||
|
MODEL_PRICING[baseTierlessSlug] ||
|
||||||
|
MODEL_PRICING[baseTierlessDashedSlug] ||
|
||||||
(allowOpaqueOrchestratorFallback ? MODEL_PRICING[cleanResponseModel] : null);
|
(allowOpaqueOrchestratorFallback ? MODEL_PRICING[cleanResponseModel] : null);
|
||||||
|
|
||||||
if (explicitPricing) {
|
if (explicitPricing) {
|
||||||
@@ -382,7 +472,12 @@ function resolveModelCatalogEntry(
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
const inferredFamily = inferFamilyFromProviderOrKey(rawModelKey, modelId, apiProvider);
|
const inferredFamily = inferFamilyFromProviderOrKey(
|
||||||
|
rawModelKey,
|
||||||
|
modelId,
|
||||||
|
apiProvider,
|
||||||
|
derivedDisplay
|
||||||
|
);
|
||||||
return {
|
return {
|
||||||
catalogPricing: null,
|
catalogPricing: null,
|
||||||
info: {
|
info: {
|
||||||
@@ -532,6 +627,9 @@ export function formatUpstreamModelId(rawUpstream = '', mInfo = null) {
|
|||||||
if (isCarbonModelIdentifier(mInfo?.rawModel, mInfo?.modelId, mInfo?.label, s)) {
|
if (isCarbonModelIdentifier(mInfo?.rawModel, mInfo?.modelId, mInfo?.label, s)) {
|
||||||
return `${s} (carbon-4)`;
|
return `${s} (carbon-4)`;
|
||||||
}
|
}
|
||||||
|
if (/\bopus(?:[\s_-]*5[.-]5)\b/i.test(metaText)) {
|
||||||
|
return `${s} (opus-5.5)`;
|
||||||
|
}
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,11 +4,11 @@
|
|||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
<title>用量监控</title>
|
<title>用量监控</title>
|
||||||
<link rel="stylesheet" href="/styles.css?v=1795236425946">
|
<link rel="stylesheet" href="/styles.css?v=1795239492319">
|
||||||
<script src="/preload.js"></script>
|
<script src="/preload.js"></script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="app-root"></div>
|
<div id="app-root"></div>
|
||||||
<script src="/app.js?v=1795236425946"></script>
|
<script src="/app.js?v=1795239492319"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@@ -349,15 +349,105 @@ function stripCompactionMarker(rawText) {
|
|||||||
|
|
||||||
export const normalizeOrchestratorIdDisplayMode = normalizeOrchestratorIdMode;
|
export const normalizeOrchestratorIdDisplayMode = normalizeOrchestratorIdMode;
|
||||||
|
|
||||||
|
function normalizeOrchVariantToken(raw = '') {
|
||||||
|
let s = String(raw || '')
|
||||||
|
.trim()
|
||||||
|
.toLowerCase()
|
||||||
|
.replace(/\s+/g, '-')
|
||||||
|
.replace(/[^a-z0-9.-]+/g, '-')
|
||||||
|
.replace(/-+/g, '-')
|
||||||
|
.replace(/^-+|-+$/g, '');
|
||||||
|
if (!s || /^worker(?:$|-)/.test(s)) return '';
|
||||||
|
s = s.replace(/([a-z]-)(\d+)-(\d+)(?=$|-)/g, '$1$2.$3');
|
||||||
|
s = s
|
||||||
|
.replace(/^(?:claude|anthropic|openai)-(?=.+)/, '')
|
||||||
|
.replace(/^gemini-(?:4-)?(?=(?:carbon|argon|neon|hydrogen|helix)(?:$|-))/, '');
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
|
||||||
|
function extractOrchWorkerVariant(fields = [], combinedText = '') {
|
||||||
|
for (const rawField of fields) {
|
||||||
|
const field = String(rawField || '').trim();
|
||||||
|
if (!field) continue;
|
||||||
|
const parenMatch = field.match(/\bOrchestrator\s+Worker\s*\(\s*([^)]+?)\s*\)/i);
|
||||||
|
if (parenMatch) {
|
||||||
|
const v = normalizeOrchVariantToken(parenMatch[1]);
|
||||||
|
if (v) return v;
|
||||||
|
}
|
||||||
|
const compactMatch = field.match(/\bworker-agy-([a-z0-9]+(?:[.-][a-z0-9]+)*)(?=·|\s|$)/i);
|
||||||
|
if (compactMatch) {
|
||||||
|
const v = normalizeOrchVariantToken(compactMatch[1]);
|
||||||
|
if (v) return v;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (/\bMODEL_PLACEHOLDER_M669\b|\bgemini-flash-worker-agy\b/i.test(combinedText)) {
|
||||||
|
return 'hydrogen';
|
||||||
|
}
|
||||||
|
const upstreamMatch = combinedText.match(/\b([a-z0-9][a-z0-9.-]*?)-worker-agy\b/i);
|
||||||
|
if (upstreamMatch) {
|
||||||
|
const rawPrefix = upstreamMatch[1].toLowerCase();
|
||||||
|
if (rawPrefix === 'gemini-flash') return 'hydrogen';
|
||||||
|
if (/^gemini-(?:4-)?neon$/i.test(rawPrefix)) return 'neon';
|
||||||
|
if (/^gemini-(?:4-)?argon$/i.test(rawPrefix)) return 'argon';
|
||||||
|
if (/^gemini-(?:4-)?carbon$/i.test(rawPrefix)) return 'carbon';
|
||||||
|
const v = normalizeOrchVariantToken(rawPrefix);
|
||||||
|
if (v && v !== 'gemini-pro') return v;
|
||||||
|
}
|
||||||
|
if (/\bneon\b/i.test(combinedText)) return 'neon';
|
||||||
|
if (/\bhydrogen\b/i.test(combinedText)) return 'hydrogen';
|
||||||
|
if (/\bargon\b/i.test(combinedText)) return 'argon';
|
||||||
|
if (/\bcarbon\b/i.test(combinedText)) return 'carbon';
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
function extractDynamicOrchVariant(fields = []) {
|
||||||
|
for (const rawField of fields) {
|
||||||
|
const field = String(rawField || '').trim();
|
||||||
|
if (!field) continue;
|
||||||
|
const parenAfter = field.match(/\bOrchestrator\s*\(\s*([^)]+?)\s*\)/i);
|
||||||
|
if (parenAfter) {
|
||||||
|
const v = normalizeOrchVariantToken(parenAfter[1]);
|
||||||
|
if (v) return v;
|
||||||
|
}
|
||||||
|
const parenBefore = field.match(
|
||||||
|
/^([a-z0-9][a-z0-9.\s-]{0,40}?)\s*\(\s*Orchestrator\s*\)(?:\s*\[[^\]]+\])?$/i
|
||||||
|
);
|
||||||
|
if (parenBefore) {
|
||||||
|
const v = normalizeOrchVariantToken(parenBefore[1]);
|
||||||
|
if (v) return v;
|
||||||
|
}
|
||||||
|
const geminiProSlug = field.match(
|
||||||
|
/\bgemini-pro-orchestrator-([a-z0-9]+(?:[.-][a-z0-9]+)*)(?=·|\s|$)/i
|
||||||
|
);
|
||||||
|
if (geminiProSlug) {
|
||||||
|
const v = normalizeOrchVariantToken(geminiProSlug[1]);
|
||||||
|
if (v) return v;
|
||||||
|
}
|
||||||
|
const prefixSlug = field.match(
|
||||||
|
/\b(?:orchestrator|orch)-([a-z0-9]+(?:[.-][a-z0-9]+)*)(?=·|\s|$)/i
|
||||||
|
);
|
||||||
|
if (prefixSlug) {
|
||||||
|
const v = normalizeOrchVariantToken(prefixSlug[1]);
|
||||||
|
if (v) return v;
|
||||||
|
}
|
||||||
|
const suffixSlug = field.match(/\b([a-z0-9]+(?:[.-][a-z0-9]+)*)-orchestrator(?=·|\s|$)/i);
|
||||||
|
if (suffixSlug && !/^gemini-pro$/i.test(suffixSlug[1])) {
|
||||||
|
const v = normalizeOrchVariantToken(suffixSlug[1]);
|
||||||
|
if (v) return v;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 统一解析步骤、会话摘要或模型汇总行面向用户的模型显示文本与悬停提示。
|
* 统一解析步骤、会话摘要或模型汇总行面向用户的模型显示文本及悬停提示。
|
||||||
*
|
*
|
||||||
* 规则:
|
* 规则:
|
||||||
* - Orchestrator 系列(`Orchestrator (Carbon)`、`Orchestrator (Argon)`、`Orchestrator (Neon)`、`gemini-flash-worker-agy` / `M669`)
|
* - Orchestrator 系列(如 `Orchestrator (Carbon / Argon / Neon / Opus 5.5)`、`Orchestrator Worker (Hydrogen / Neon / ...)`)
|
||||||
* 独立遵循 `orchestratorIdMode`(`'compact'` 显示 `orchestrator-carbon` / `orchestrator-argon` / `orchestrator-neon` / `worker-agy-hydrogen`;
|
* 独立遵循 `orchestratorIdMode`(`'compact'` 显示 `orchestrator-<variant>` / `worker-agy-<variant>`;
|
||||||
* `'full'` 显示带括号标注的完整上游 ID),不受普通模型显示模式影响;
|
* `'full'` 显示带括号标注的完整上游 ID),不受普通模型显示模式影响;
|
||||||
* - 其余普通模型遵循 `modelDisplayMode`(`'short'` | `'upstream_compact'` | `'upstream'`,兼容旧版布尔 `showUpstreamModel`);
|
* - 其余普通模型遵循 `modelDisplayMode`(`'short'` | `'upstream_compact'` | `'upstream'`,兼容旧版布尔 `showUpstreamModel`);
|
||||||
* - 独立拆分 `baseText` 与 `compactionSuffix`(`·压缩`),供步骤表单独保护压缩尾标永不截断。
|
* - 独立拆分 `baseText` 及 `compactionSuffix`(`·压缩`),供步骤表单独保护压缩尾标永不截断。
|
||||||
*
|
*
|
||||||
* @param {object|null|undefined} target
|
* @param {object|null|undefined} target
|
||||||
* @param {{ modelDisplayMode?: string, showUpstreamModel?: boolean, orchestratorIdMode?: string }|boolean} [settings]
|
* @param {{ modelDisplayMode?: string, showUpstreamModel?: boolean, orchestratorIdMode?: string }|boolean} [settings]
|
||||||
@@ -422,22 +512,16 @@ export function resolveModelDisplayInfo(target, settings = {}, options = {}) {
|
|||||||
|
|
||||||
const compactionSuffix = isCompaction ? t('fmt.compactionSuffix') : '';
|
const compactionSuffix = isCompaction ? t('fmt.compactionSuffix') : '';
|
||||||
|
|
||||||
|
const fields = [labelText, shortText, upstreamText, responseText, modelKeyText];
|
||||||
const combined = `${modelKeyText} ${shortText} ${labelText} ${upstreamText} ${responseText}`;
|
const combined = `${modelKeyText} ${shortText} ${labelText} ${upstreamText} ${responseText}`;
|
||||||
const isOrchWorker =
|
const isOrchWorker =
|
||||||
/\bMODEL_PLACEHOLDER_M669\b|\b[a-z0-9.-]*worker-agy\b|\bworker-agy-hydrogen\b|\bOrchestrator\s+Worker\b/i.test(
|
/\bMODEL_PLACEHOLDER_M669\b|\b[a-z0-9.-]*worker-agy\b|\bworker-agy-[a-z0-9.-]+\b|\bOrchestrator\s+Worker\b/i.test(
|
||||||
combined
|
combined
|
||||||
);
|
);
|
||||||
const isKnownOrchCarbonPh = /\bMODEL_PLACEHOLDER_M667\b/i.test(combined);
|
const isKnownOrchCarbonPh = /\bMODEL_PLACEHOLDER_M667\b/i.test(combined);
|
||||||
const isKnownOrchArgonPh = /\bMODEL_PLACEHOLDER_M681\b/i.test(combined);
|
const isKnownOrchArgonPh = /\bMODEL_PLACEHOLDER_M681\b/i.test(combined);
|
||||||
const isKnownOrchNeonPh = /\bMODEL_PLACEHOLDER_M537\b/i.test(combined);
|
const isKnownOrchNeonPh = /\bMODEL_PLACEHOLDER_M537\b/i.test(combined);
|
||||||
const dynamicOrchVariantMatch =
|
const dynamicOrchVariant = isOrchWorker ? '' : extractDynamicOrchVariant(fields);
|
||||||
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 hasBareProOrch = /\bgemini-pro-orchestrator\b(?![-_][a-z0-9])/i.test(combined);
|
||||||
const isOrchSeries =
|
const isOrchSeries =
|
||||||
isOrchWorker ||
|
isOrchWorker ||
|
||||||
@@ -451,8 +535,41 @@ export function resolveModelDisplayInfo(target, settings = {}, options = {}) {
|
|||||||
let compactId = '';
|
let compactId = '';
|
||||||
let fullId = '';
|
let fullId = '';
|
||||||
if (isOrchWorker) {
|
if (isOrchWorker) {
|
||||||
|
const workerVariant = extractOrchWorkerVariant(fields, combined);
|
||||||
|
const cleanUpstream = stripCompactionMarker(upstreamText || responseText || '').trim();
|
||||||
|
if (workerVariant === 'hydrogen') {
|
||||||
compactId = 'worker-agy-hydrogen';
|
compactId = 'worker-agy-hydrogen';
|
||||||
fullId = 'gemini-flash-worker-agy (hydrogen-4)';
|
fullId = 'gemini-flash-worker-agy (hydrogen-4)';
|
||||||
|
} else if (workerVariant === 'neon') {
|
||||||
|
compactId = 'worker-agy-neon';
|
||||||
|
if (cleanUpstream) {
|
||||||
|
if (/\([^)]+\)\s*$/.test(cleanUpstream)) {
|
||||||
|
fullId = cleanUpstream;
|
||||||
|
} else if (/(?:worker-agy)/i.test(cleanUpstream)) {
|
||||||
|
fullId = `${cleanUpstream} (neon-4)`;
|
||||||
|
} else if (/\bneon\b/i.test(cleanUpstream)) {
|
||||||
|
fullId = cleanUpstream;
|
||||||
|
} else {
|
||||||
|
fullId = `${cleanUpstream} (neon-4)`;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
fullId = 'gemini-neon-worker-agy (neon-4)';
|
||||||
|
}
|
||||||
|
} else if (workerVariant) {
|
||||||
|
compactId = `worker-agy-${workerVariant}`;
|
||||||
|
const variantDashed = workerVariant.replace(/\./g, '-');
|
||||||
|
const upstreamLower = cleanUpstream.toLowerCase();
|
||||||
|
const mentionsVariant =
|
||||||
|
upstreamLower.includes(workerVariant) || upstreamLower.includes(variantDashed);
|
||||||
|
fullId = cleanUpstream
|
||||||
|
? mentionsVariant || /\([^)]+\)\s*$/.test(cleanUpstream)
|
||||||
|
? cleanUpstream
|
||||||
|
: `${cleanUpstream} (${workerVariant})`
|
||||||
|
: `worker-agy-${workerVariant}`;
|
||||||
|
} else {
|
||||||
|
compactId = 'worker-agy';
|
||||||
|
fullId = cleanUpstream || 'worker-agy';
|
||||||
|
}
|
||||||
} else if (isKnownOrchNeonPh || dynamicOrchVariant === 'neon') {
|
} else if (isKnownOrchNeonPh || dynamicOrchVariant === 'neon') {
|
||||||
compactId = 'orchestrator-neon';
|
compactId = 'orchestrator-neon';
|
||||||
fullId = 'gemini-pro-orchestrator-neon (neon-4)';
|
fullId = 'gemini-pro-orchestrator-neon (neon-4)';
|
||||||
@@ -469,12 +586,24 @@ export function resolveModelDisplayInfo(target, settings = {}, options = {}) {
|
|||||||
} else if (dynamicOrchVariant) {
|
} else if (dynamicOrchVariant) {
|
||||||
compactId = `orchestrator-${dynamicOrchVariant}`;
|
compactId = `orchestrator-${dynamicOrchVariant}`;
|
||||||
const cleanUpstream = stripCompactionMarker(upstreamText || responseText || '').trim();
|
const cleanUpstream = stripCompactionMarker(upstreamText || responseText || '').trim();
|
||||||
fullId = cleanUpstream
|
const variantDashed = dynamicOrchVariant.replace(/\./g, '-');
|
||||||
? cleanUpstream.toLowerCase().includes(dynamicOrchVariant)
|
const upstreamLower = cleanUpstream.toLowerCase();
|
||||||
|
const mentionsVariant =
|
||||||
|
upstreamLower.includes(dynamicOrchVariant) || upstreamLower.includes(variantDashed);
|
||||||
|
if (cleanUpstream) {
|
||||||
|
fullId =
|
||||||
|
mentionsVariant || /\([^)]+\)\s*$/.test(cleanUpstream)
|
||||||
? cleanUpstream
|
? cleanUpstream
|
||||||
: `${cleanUpstream} (${dynamicOrchVariant})`
|
: `${cleanUpstream} (${dynamicOrchVariant})`;
|
||||||
|
} else {
|
||||||
|
const isNonGeminiOrch = /\b(?:claude|anthropic|opus|sonnet|haiku|fable|gpt|openai)\b/i.test(
|
||||||
|
`${combined} ${dynamicOrchVariant}`
|
||||||
|
);
|
||||||
|
fullId = isNonGeminiOrch
|
||||||
|
? `orchestrator-${dynamicOrchVariant}`
|
||||||
: `gemini-pro-orchestrator-${dynamicOrchVariant}`;
|
: `gemini-pro-orchestrator-${dynamicOrchVariant}`;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (compactId) {
|
if (compactId) {
|
||||||
const baseText = orchestratorMode === 'full' ? fullId : compactId;
|
const baseText = orchestratorMode === 'full' ? fullId : compactId;
|
||||||
const text = `${baseText}${compactionSuffix}`;
|
const text = `${baseText}${compactionSuffix}`;
|
||||||
|
|||||||
@@ -428,6 +428,240 @@ test('future uncatalogued Orchestrator variants never fall back to Carbon identi
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('Orchestrator (Opus 5.5) resolves Claude family, Opus 5.5 pricing, distinct display, and Claude & GPT quota pool across label variants', async () => {
|
||||||
|
const OPUS_ORCH_PH = 'MODEL_PLACEHOLDER_M940';
|
||||||
|
const OPUS_ORCH_PH_2 = 'MODEL_PLACEHOLDER_M941';
|
||||||
|
const OPUS_ORCH_PH_3 = 'MODEL_PLACEHOLDER_M942';
|
||||||
|
const rows = [
|
||||||
|
step(1, OPUS_ORCH_PH),
|
||||||
|
step(2, OPUS_ORCH_PH_2),
|
||||||
|
step(3, OPUS_ORCH_PH_3),
|
||||||
|
step(4, 'MODEL_PLACEHOLDER_M368'),
|
||||||
|
];
|
||||||
|
const h = backendHarness({
|
||||||
|
clock: () => PROMO_CLOCK_MS,
|
||||||
|
summaries: { test: { stepCount: 4 } },
|
||||||
|
trajectories: {
|
||||||
|
test: {
|
||||||
|
trajectory: {
|
||||||
|
steps: rows,
|
||||||
|
generatorMetadata: [
|
||||||
|
{
|
||||||
|
stepIndices: [1],
|
||||||
|
chatModel: {
|
||||||
|
model: OPUS_ORCH_PH,
|
||||||
|
responseModel: 'claude-opus-5-5',
|
||||||
|
modelDisplayName: 'Orchestrator (Opus 5.5)',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
stepIndices: [2],
|
||||||
|
chatModel: {
|
||||||
|
model: OPUS_ORCH_PH_2,
|
||||||
|
responseModel: 'claude-opus-5-5-orchestrator',
|
||||||
|
modelDisplayName: 'Orchestrator (Claude Opus 5.5)',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
stepIndices: [3],
|
||||||
|
chatModel: {
|
||||||
|
model: OPUS_ORCH_PH_3,
|
||||||
|
responseModel: 'claude-orchestrator',
|
||||||
|
modelDisplayName: 'Claude Opus 5.5 (Orchestrator)',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
stepIndices: [4],
|
||||||
|
chatModel: {
|
||||||
|
model: 'MODEL_PLACEHOLDER_M368',
|
||||||
|
responseModel: 'claude-opus-5-5',
|
||||||
|
modelDisplayName: 'Claude Opus 5.5',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
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);
|
||||||
|
const s3 = p.activeConversation.recentSteps.find((s) => s.stepIndex === 3);
|
||||||
|
const s4 = p.activeConversation.recentSteps.find((s) => s.stepIndex === 4);
|
||||||
|
|
||||||
|
// step() fixture: 1000 input ($4/M = 0.004) + 9000 cache ($0.20/M = 0.0018) + 1000 output ($20/M = 0.02) = 0.0258
|
||||||
|
for (const st of [s1, s2, s3]) {
|
||||||
|
assert.equal(st.modelShort, 'orch-opus-5.5');
|
||||||
|
assert.equal(st.family, 'Claude');
|
||||||
|
assert.equal(st.costUsd, 0.0258);
|
||||||
|
}
|
||||||
|
assert.equal(s1.modelUpstream, 'claude-opus-5-5');
|
||||||
|
assert.equal(s2.modelUpstream, 'claude-opus-5-5-orchestrator (opus-5.5)');
|
||||||
|
assert.equal(s3.modelUpstream, 'claude-orchestrator (opus-5.5)');
|
||||||
|
assert.equal(s4.modelShort, 'opus-5.5');
|
||||||
|
assert.equal(s4.costUsd, 0.0258);
|
||||||
|
assert.equal(p.consumption.account.unpricedCalls, 0);
|
||||||
|
|
||||||
|
// Never misclassified as Carbon/Argon/Neon even if paired with an opaque upstream id
|
||||||
|
assert.equal(h.isCarbonModelIdentifier(OPUS_ORCH_PH, 'gemini-pro-orchestrator', 'Orchestrator (Opus 5.5)'), false);
|
||||||
|
assert.equal(h.isArgonModelIdentifier(OPUS_ORCH_PH, 'claude-opus-5-5-orchestrator', 'Orchestrator (Opus 5.5)'), false);
|
||||||
|
assert.equal(h.isNeonModelIdentifier(OPUS_ORCH_PH, 'claude-opus-5-5-orchestrator', 'Orchestrator (Opus 5.5)'), false);
|
||||||
|
|
||||||
|
// GetUserStatus clientModelConfig without apiProvider and with opaque modelId still classifies as Claude & GPT pool
|
||||||
|
const { quotaPoolsMap, modelQuotas } = h.buildOfficialQuotaPools(null, [
|
||||||
|
{
|
||||||
|
modelOrAlias: { model: 'MODEL_PLACEHOLDER_M949' },
|
||||||
|
modelId: 'orchestrator-v2',
|
||||||
|
label: 'Orchestrator (Opus 5.5)',
|
||||||
|
quotaInfo: { remainingFraction: 0.75, resetTime: '2026-11-25T00:00:00Z' },
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
const opusQuotaEntry = modelQuotas.find((m) => m.rawKey === 'MODEL_PLACEHOLDER_M949');
|
||||||
|
assert.equal(opusQuotaEntry?.family, 'Claude & GPT');
|
||||||
|
assert.ok(quotaPoolsMap.get('Claude & GPT').models.includes('Orchestrator (Opus 5.5)'));
|
||||||
|
assert.equal(quotaPoolsMap.get('Gemini').models.includes('Orchestrator (Opus 5.5)'), false);
|
||||||
|
|
||||||
|
// Frontend compact/full Orchestrator display works cleanly and stays separate from standalone Opus 5.5
|
||||||
|
assert.equal(resolveModelDisplayInfo(s1, { orchestratorIdMode: 'compact' }).text, 'orchestrator-opus-5.5');
|
||||||
|
assert.equal(resolveModelDisplayInfo(s1, { orchestratorIdMode: 'full' }).text, 'claude-opus-5-5');
|
||||||
|
assert.equal(resolveModelDisplayInfo(s2, { orchestratorIdMode: 'compact' }).text, 'orchestrator-opus-5.5');
|
||||||
|
assert.equal(resolveModelDisplayInfo(s2, { orchestratorIdMode: 'full' }).text, 'claude-opus-5-5-orchestrator (opus-5.5)');
|
||||||
|
assert.equal(resolveModelDisplayInfo(s3, { orchestratorIdMode: 'compact' }).text, 'orchestrator-opus-5.5');
|
||||||
|
assert.equal(resolveModelDisplayInfo(s3, { orchestratorIdMode: 'full' }).text, 'claude-orchestrator (opus-5.5)');
|
||||||
|
assert.equal(
|
||||||
|
resolveModelDisplayInfo(
|
||||||
|
{ modelKey: OPUS_ORCH_PH, modelLabel: 'Orchestrator (Opus 5.5)' },
|
||||||
|
{ orchestratorIdMode: 'full' }
|
||||||
|
).text,
|
||||||
|
'orchestrator-opus-5.5',
|
||||||
|
'Non-Gemini Orchestrator without upstream never fabricates gemini-pro-orchestrator-*'
|
||||||
|
);
|
||||||
|
const mergedCompact = mergeModelsByDisplayName(
|
||||||
|
p.modelBreakdown,
|
||||||
|
{ modelDisplayMode: 'short', orchestratorIdMode: 'compact' },
|
||||||
|
{ preferLabelInShort: true }
|
||||||
|
);
|
||||||
|
assert.ok(mergedCompact.some((m) => m.displayText === 'orchestrator-opus-5.5'));
|
||||||
|
assert.ok(mergedCompact.some((m) => m.displayText === 'Claude Opus 5.5'));
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Orchestrator executionModel supports Neon and Claude workers without hijacking them into Hydrogen', async () => {
|
||||||
|
const OPUS_ORCH_PH = 'MODEL_PLACEHOLDER_M940';
|
||||||
|
const NEON_WORKER_PH = 'MODEL_PLACEHOLDER_M945';
|
||||||
|
const SONNET_WORKER_PH = 'MODEL_PLACEHOLDER_M946';
|
||||||
|
const UNKNOWN_WORKER_PH = 'MODEL_PLACEHOLDER_M947';
|
||||||
|
const rows = [
|
||||||
|
step(1, OPUS_ORCH_PH),
|
||||||
|
step(2, NEON_WORKER_PH),
|
||||||
|
step(3, 'MODEL_PLACEHOLDER_M535'),
|
||||||
|
step(4, SONNET_WORKER_PH),
|
||||||
|
step(5, UNKNOWN_WORKER_PH),
|
||||||
|
];
|
||||||
|
const h = backendHarness({
|
||||||
|
clock: () => PROMO_CLOCK_MS,
|
||||||
|
summaries: { test: { stepCount: 5 } },
|
||||||
|
trajectories: {
|
||||||
|
test: {
|
||||||
|
trajectory: {
|
||||||
|
steps: rows,
|
||||||
|
generatorMetadata: [
|
||||||
|
{
|
||||||
|
stepIndices: [1],
|
||||||
|
chatModel: {
|
||||||
|
model: OPUS_ORCH_PH,
|
||||||
|
responseModel: 'claude-opus-5-5',
|
||||||
|
modelDisplayName: 'Orchestrator (Opus 5.5)',
|
||||||
|
},
|
||||||
|
plannerConfig: {
|
||||||
|
planModel: OPUS_ORCH_PH,
|
||||||
|
modelName: 'claude-opus-5-5',
|
||||||
|
planExecuteConfig: { executionModel: 'MODEL_PLACEHOLDER_M535' },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
stepIndices: [2],
|
||||||
|
chatModel: {
|
||||||
|
model: NEON_WORKER_PH,
|
||||||
|
responseModel: 'gemini-neon-worker-agy',
|
||||||
|
modelDisplayName: 'Gemini Pro',
|
||||||
|
},
|
||||||
|
plannerConfig: {
|
||||||
|
planModel: OPUS_ORCH_PH,
|
||||||
|
modelName: 'claude-opus-5-5-orchestrator',
|
||||||
|
planExecuteConfig: { executionModel: NEON_WORKER_PH },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
stepIndices: [3],
|
||||||
|
chatModel: {
|
||||||
|
model: 'MODEL_PLACEHOLDER_M535',
|
||||||
|
responseModel: 'gemini-4-neon',
|
||||||
|
modelDisplayName: 'Orchestrator (Opus 5.5)',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
stepIndices: [4],
|
||||||
|
chatModel: {
|
||||||
|
model: SONNET_WORKER_PH,
|
||||||
|
responseModel: 'claude-sonnet-5-5',
|
||||||
|
modelDisplayName: 'Orchestrator Worker (Sonnet 5.5)',
|
||||||
|
},
|
||||||
|
plannerConfig: {
|
||||||
|
planModel: OPUS_ORCH_PH,
|
||||||
|
modelName: 'claude-opus-5-5-orchestrator',
|
||||||
|
planExecuteConfig: { executionModel: SONNET_WORKER_PH },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
stepIndices: [5],
|
||||||
|
chatModel: {
|
||||||
|
model: UNKNOWN_WORKER_PH,
|
||||||
|
responseModel: 'mystery-worker-agy',
|
||||||
|
modelDisplayName: 'Orchestrator Worker (Krypton)',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const p = await h.buildTelemetryPayloadInternal('test');
|
||||||
|
const s2 = p.activeConversation.recentSteps.find((s) => s.stepIndex === 2);
|
||||||
|
const s3 = p.activeConversation.recentSteps.find((s) => s.stepIndex === 3);
|
||||||
|
const s4 = p.activeConversation.recentSteps.find((s) => s.stepIndex === 4);
|
||||||
|
const s5 = p.activeConversation.recentSteps.find((s) => s.stepIndex === 5);
|
||||||
|
|
||||||
|
// Dedicated Neon worker (gemini-neon-worker-agy) resolves to Neon Worker with Neon pricing ($3/$0.15/$15 -> 0.0193)
|
||||||
|
assert.equal(s2.modelLabel, 'Orchestrator Worker (Neon)');
|
||||||
|
assert.equal(s2.modelShort, 'neon-4');
|
||||||
|
assert.equal(s2.modelUpstream, 'gemini-neon-worker-agy (neon-4)');
|
||||||
|
assert.equal(s2.family, 'Gemini');
|
||||||
|
assert.equal(s2.costUsd, 0.0193);
|
||||||
|
assert.equal(resolveModelDisplayInfo(s2, { orchestratorIdMode: 'compact' }).text, 'worker-agy-neon');
|
||||||
|
assert.equal(resolveModelDisplayInfo(s2, { orchestratorIdMode: 'full' }).text, 'gemini-neon-worker-agy (neon-4)');
|
||||||
|
|
||||||
|
// Direct M535 Neon execution step with leaked planner name clears leaked label and resolves as Gemini 4 Neon (XHigh)
|
||||||
|
assert.equal(s3.modelLabel, 'Gemini 4 Neon (XHigh)');
|
||||||
|
assert.equal(s3.modelShort, 'neon-4-xhigh');
|
||||||
|
assert.equal(s3.family, 'Gemini');
|
||||||
|
assert.equal(s3.costUsd, 0.0193);
|
||||||
|
|
||||||
|
// Claude Sonnet 5.5 worker keeps Claude family & Sonnet 5.5 pricing ($2/$0.10/$10 -> 0.0129), never Hydrogen
|
||||||
|
assert.equal(s4.modelLabel, 'Orchestrator Worker (Sonnet 5.5)');
|
||||||
|
assert.equal(s4.family, 'Claude');
|
||||||
|
assert.equal(s4.costUsd, 0.0129);
|
||||||
|
assert.equal(resolveModelDisplayInfo(s4, { orchestratorIdMode: 'compact' }).text, 'worker-agy-sonnet-5.5');
|
||||||
|
assert.equal(resolveModelDisplayInfo(s4, { orchestratorIdMode: 'full' }).text, 'claude-sonnet-5-5');
|
||||||
|
|
||||||
|
// Unknown future worker remains unpriced and renders worker-agy-krypton instead of worker-agy-hydrogen
|
||||||
|
assert.equal(s5.modelLabel, 'Orchestrator Worker (Krypton)');
|
||||||
|
assert.equal(s5.costUsd, null);
|
||||||
|
assert.equal(resolveModelDisplayInfo(s5, { orchestratorIdMode: 'compact' }).text, 'worker-agy-krypton');
|
||||||
|
assert.equal(resolveModelDisplayInfo(s5, { orchestratorIdMode: 'full' }).text, 'mystery-worker-agy (krypton)');
|
||||||
|
});
|
||||||
|
|
||||||
test('real-world M669 worker steps (responseModel gemini-flash-worker-agy, displayName Gemini Flash) and uncatalogued executionModel resolve to Hydrogen', async () => {
|
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 FUTURE_EXEC_PH = 'MODEL_PLACEHOLDER_M799';
|
||||||
const rows = [step(1, ORCH_CARBON), step(2, ORCH_EXEC_HYDROGEN), step(3, FUTURE_EXEC_PH)];
|
const rows = [step(1, ORCH_CARBON), step(2, ORCH_EXEC_HYDROGEN), step(3, FUTURE_EXEC_PH)];
|
||||||
|
|||||||
@@ -884,14 +884,18 @@ export function extractModelSteps(rawSteps = [], generatorMetadata = []) {
|
|||||||
const orchestratorExecModels = new Set();
|
const orchestratorExecModels = new Set();
|
||||||
const collectOrchestratorExecModel = (pc) => {
|
const collectOrchestratorExecModel = (pc) => {
|
||||||
const execModel = pc?.planExecuteConfig?.executionModel;
|
const execModel = pc?.planExecuteConfig?.executionModel;
|
||||||
|
if (typeof execModel !== 'string' || !execModel.trim()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const cleanExec = execModel.trim();
|
||||||
|
const cleanPlan = String(pc?.planModel || '').trim();
|
||||||
if (
|
if (
|
||||||
typeof execModel === 'string' &&
|
|
||||||
execModel.trim() &&
|
|
||||||
/orchestrator|MODEL_PLACEHOLDER_M(?:667|681|537)\b/i.test(
|
/orchestrator|MODEL_PLACEHOLDER_M(?:667|681|537)\b/i.test(
|
||||||
`${pc?.modelName || ''} ${pc?.planModel || ''}`
|
`${pc?.modelName || ''} ${cleanPlan}`
|
||||||
)
|
) ||
|
||||||
|
(cleanPlan && cleanExec !== cleanPlan)
|
||||||
) {
|
) {
|
||||||
orchestratorExecModels.add(execModel.trim());
|
orchestratorExecModels.add(cleanExec);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
let latestBreakdownChat = null;
|
let latestBreakdownChat = null;
|
||||||
@@ -1319,17 +1323,31 @@ export function extractModelSteps(rawSteps = [], generatorMetadata = []) {
|
|||||||
].find(isValidModelValue);
|
].find(isValidModelValue);
|
||||||
|
|
||||||
const resolvedModelKey = identity ? identity[1].trim() : 'unknown';
|
const resolvedModelKey = identity ? identity[1].trim() : 'unknown';
|
||||||
const rawDisplayName = chat?.modelDisplayName || '';
|
const rawDisplayName = String(chat?.modelDisplayName || '').trim();
|
||||||
|
const isExplicitNamedWorker = /\bOrchestrator\s+Worker\s*\([^)]+\)/i.test(rawDisplayName);
|
||||||
|
const isLeakedPlannerOrchDisplay =
|
||||||
|
Boolean(rawDisplayName) &&
|
||||||
|
/\borchestrator\b/i.test(rawDisplayName) &&
|
||||||
|
!isExplicitNamedWorker;
|
||||||
const isGenericWorkerDisplay =
|
const isGenericWorkerDisplay =
|
||||||
!rawDisplayName ||
|
!rawDisplayName ||
|
||||||
/\borchestrator\b/i.test(rawDisplayName) ||
|
isLeakedPlannerOrchDisplay ||
|
||||||
/^gemini\s+(?:flash|pro)(?:\s+worker)?$/i.test(rawDisplayName.trim());
|
/^gemini\s+(?:flash|pro)(?:\s+worker)?$/i.test(rawDisplayName);
|
||||||
const resolvedDisplayName =
|
const isHydrogenWorkerStep =
|
||||||
(orchestratorExecModels.has(resolvedModelKey) ||
|
resolvedModelKey === 'MODEL_PLACEHOLDER_M669' ||
|
||||||
/^gemini-flash-worker-agy$/i.test(rawResponseModel || '')) &&
|
/^gemini-flash-worker-agy$/i.test(rawResponseModel || '');
|
||||||
isGenericWorkerDisplay
|
const isNeonWorkerStep = /^gemini-(?:4-)?neon-worker-agy$/i.test(rawResponseModel || '');
|
||||||
? 'Orchestrator Worker (Hydrogen)'
|
const isExecWorkerStep = orchestratorExecModels.has(resolvedModelKey);
|
||||||
: rawDisplayName;
|
|
||||||
|
let resolvedDisplayName = rawDisplayName;
|
||||||
|
if (isHydrogenWorkerStep && isGenericWorkerDisplay) {
|
||||||
|
resolvedDisplayName = 'Orchestrator Worker (Hydrogen)';
|
||||||
|
} else if (isNeonWorkerStep && isGenericWorkerDisplay) {
|
||||||
|
resolvedDisplayName = 'Orchestrator Worker (Neon)';
|
||||||
|
} else if (isExecWorkerStep && isLeakedPlannerOrchDisplay) {
|
||||||
|
// 非 Hydrogen 执行模型(如 Neon / Claude Worker)若继承了主编排器展示名,清空以交由自身模型身份解析
|
||||||
|
resolvedDisplayName = '';
|
||||||
|
}
|
||||||
|
|
||||||
const anomalyRec = buildStepAnomalyRecord(s, m, chat, stepPendingErrors);
|
const anomalyRec = buildStepAnomalyRecord(s, m, chat, stepPendingErrors);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user