From 1b22b05e24a273d3613a46912e9fe3f0af8c2917 Mon Sep 17 00:00:00 2001 From: fish <1770968958@qq.com> Date: Thu, 12 Nov 2026 10:03:58 +0900 Subject: [PATCH 1/6] fix(updater): migrate cloud catalog sync and auto-update URLs to yuhuan-dev --- pricing-catalog.json | 10 +- sidecars/panel/backend/config.mjs | 12 ++- sidecars/panel/backend/plugin-updater.mjs | 59 +++++++++- sidecars/panel/backend/pricing-catalog.mjs | 38 ++++++- sidecars/panel/test/backend-harness.mjs | 2 +- .../panel/test/cloud-sync-and-update.test.mjs | 102 +++++++++++++++++- 6 files changed, 203 insertions(+), 20 deletions(-) diff --git a/pricing-catalog.json b/pricing-catalog.json index dda1f5c..5a36e99 100644 --- a/pricing-catalog.json +++ b/pricing-catalog.json @@ -1,11 +1,11 @@ { "schemaVersion": 1, - "catalogVersion": "2026.11.11.4", - "updatedAt": "2026-11-11T23:20:00+09:00", + "catalogVersion": "2026.11.12.1", + "updatedAt": "2026-11-12T09:38:00+09:00", "latestPluginVersion": "1.4.4", - "releaseUrl": "https://github.com/yuhuan2498281558/antigravity-usage-monitor/releases/latest", - "downloadUrl": "https://github.com/yuhuan2498281558/antigravity-usage-monitor/releases/latest/download/usage-monitor.zip", - "archiveFallbackUrl": "https://codeload.github.com/yuhuan2498281558/antigravity-usage-monitor/zip/refs/heads/main", + "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", + "archiveFallbackUrl": "https://codeload.github.com/yuhuan-dev/antigravity-usage-monitor/zip/refs/heads/main", "pricing": { "gemini-4-carbon-high": { "input": 2.00, "cache": 0.10, "output": 10.0, "short": "carbon-4-high", "family": "Gemini" }, "gemini-4-carbon-medium": { "input": 2.00, "cache": 0.10, "output": 10.0, "short": "carbon-4", "family": "Gemini" }, diff --git a/sidecars/panel/backend/config.mjs b/sidecars/panel/backend/config.mjs index b87db0a..8fee696 100644 --- a/sidecars/panel/backend/config.mjs +++ b/sidecars/panel/backend/config.mjs @@ -57,15 +57,19 @@ export const CSRF_TOKEN = process.env.ANTIGRAVITY_CSRF_TOKEN; /** * GitHub 官方云端价格目录与插件发布包地址配置。 */ +export const OFFICIAL_GITHUB_REPO = 'yuhuan-dev/antigravity-usage-monitor'; +export const LEGACY_GITHUB_REPOS = Object.freeze([ + 'yuhuan2498281558/antigravity-usage-monitor', +]); export const CLOUD_CATALOG_URLS = [ - 'https://raw.githubusercontent.com/yuhuan2498281558/antigravity-usage-monitor/main/pricing-catalog.json', + `https://raw.githubusercontent.com/${OFFICIAL_GITHUB_REPO}/main/pricing-catalog.json`, ]; export const DEFAULT_RELEASE_URL = - 'https://github.com/yuhuan2498281558/antigravity-usage-monitor/releases/latest'; + `https://github.com/${OFFICIAL_GITHUB_REPO}/releases/latest`; export const DEFAULT_DOWNLOAD_URL = - 'https://github.com/yuhuan2498281558/antigravity-usage-monitor/releases/latest/download/usage-monitor.zip'; + `https://github.com/${OFFICIAL_GITHUB_REPO}/releases/latest/download/usage-monitor.zip`; export const DEFAULT_ARCHIVE_FALLBACK_URL = - 'https://codeload.github.com/yuhuan2498281558/antigravity-usage-monitor/zip/refs/heads/main'; + `https://codeload.github.com/${OFFICIAL_GITHUB_REPO}/zip/refs/heads/main`; /** 云端目录常规自动检查间隔(6 小时)与失败冷却时间(5 分钟)。 */ export const CLOUD_SYNC_TTL_MS = 6 * 3600 * 1000; diff --git a/sidecars/panel/backend/plugin-updater.mjs b/sidecars/panel/backend/plugin-updater.mjs index dacae34..41a2a5c 100644 --- a/sidecars/panel/backend/plugin-updater.mjs +++ b/sidecars/panel/backend/plugin-updater.mjs @@ -26,7 +26,9 @@ import { DATA_DIR, DEFAULT_ARCHIVE_FALLBACK_URL, DEFAULT_DOWNLOAD_URL, + LEGACY_GITHUB_REPOS, LS_ADDR, + OFFICIAL_GITHUB_REPO, PLUGIN_ROOT, REMOTE_CATALOG_CACHE_FILE, cloudSyncState, @@ -158,6 +160,31 @@ function pruneExtraneousFiles(targetDir, referenceDir) { } } +/** + * 若本地 Git 仓库的 `origin` 仍指向已迁移的旧官方仓库地址,返回同协议的新官方仓库地址; + * 对于非旧官方仓库(如已是新地址或用户自建 Fork)返回空字符串,不做改动。 + * + * @param {string} rawUrl + * @returns {string} + */ +export function resolveMigratedGitRemoteUrl(rawUrl) { + const trimmed = String(rawUrl || '').trim(); + if (!trimmed) return ''; + for (const legacyRepo of LEGACY_GITHUB_REPOS) { + const escaped = legacyRepo.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); + if (new RegExp(`^https://github\\.com/${escaped}(?:\\.git)?/?$`, 'i').test(trimmed)) { + return `https://github.com/${OFFICIAL_GITHUB_REPO}.git`; + } + if (new RegExp(`^git@github\\.com:${escaped}(?:\\.git)?/?$`, 'i').test(trimmed)) { + return `git@github.com:${OFFICIAL_GITHUB_REPO}.git`; + } + if (new RegExp(`^ssh://git@github\\.com/${escaped}(?:\\.git)?/?$`, 'i').test(trimmed)) { + return `ssh://git@github.com/${OFFICIAL_GITHUB_REPO}.git`; + } + } + return ''; +} + /** * 在真实运行环境下对目标目录的核心 JS 文件执行 `node --check` 语法预检。 * @@ -277,7 +304,31 @@ export async function performPluginUpdate({ isAuto = false } = {}) { const targetBranch = currentBranch || 'main'; const remoteRef = `origin/${targetBranch}`; - // 3. 只读拉取远端分支引用,并严格从 origin/:plugin.json 读取远端版本号(严禁回退使用缓存版本) + // 3. 存量旧仓库远程地址平滑迁移:若 origin 仍指向已更换的旧官方仓库,自动切换至新仓库地址 + try { + const remoteUrlRes = await runExecFile('git', [ + '-C', + PLUGIN_ROOT, + 'remote', + 'get-url', + 'origin', + ]); + const migratedRemoteUrl = resolveMigratedGitRemoteUrl(remoteUrlRes.stdout); + if (migratedRemoteUrl) { + await runExecFile('git', [ + '-C', + PLUGIN_ROOT, + 'remote', + 'set-url', + 'origin', + migratedRemoteUrl, + ]); + } + } catch { + // 忽略非标准 remote 配置异常,不阻断常规拉取 + } + + // 4. 只读拉取远端分支引用,并严格从 origin/:plugin.json 读取远端版本号(严禁回退使用缓存版本) await runExecFile('git', ['-C', PLUGIN_ROOT, 'fetch', 'origin', targetBranch, '--tags']); let remoteVersion = ''; @@ -298,7 +349,7 @@ export async function performPluginUpdate({ isAuto = false } = {}) { remoteVersion = ''; } - // 4. 强制版本门禁:远端版本无法确认或不高于当前版本时,严禁执行 git pull 降级/覆盖 + // 5. 强制版本门禁:远端版本无法确认或不高于当前版本时,严禁执行 git pull 降级/覆盖 if (!remoteVersion || compareSemver(remoteVersion, previousVersion) <= 0) { const msg = `当前已是最新版本 (v${previousVersion})`; const result = { @@ -317,7 +368,7 @@ export async function performPluginUpdate({ isAuto = false } = {}) { return result; } - // 5. 提交拓扑预检:确保当前 HEAD 是远端分支的祖先提交(无本地超前或分叉提交) + // 6. 提交拓扑预检:确保当前 HEAD 是远端分支的祖先提交(无本地超前或分叉提交) try { await runExecFile('git', [ '-C', @@ -343,7 +394,7 @@ export async function performPluginUpdate({ isAuto = false } = {}) { return pluginUpdateState.lastResult; } - // 6. 确认全部门禁通过后,执行快进合并并校验 JS 语法 + // 7. 确认全部门禁通过后,执行快进合并并校验 JS 语法 await runExecFile('git', ['-C', PLUGIN_ROOT, 'pull', '--ff-only', 'origin', targetBranch]); await verifyPluginJsSyntax(PLUGIN_ROOT); rebuildActiveCatalog(); diff --git a/sidecars/panel/backend/pricing-catalog.mjs b/sidecars/panel/backend/pricing-catalog.mjs index 7bedf78..6973592 100644 --- a/sidecars/panel/backend/pricing-catalog.mjs +++ b/sidecars/panel/backend/pricing-catalog.mjs @@ -16,7 +16,9 @@ import { DEFAULT_ARCHIVE_FALLBACK_URL, DEFAULT_DOWNLOAD_URL, DEFAULT_RELEASE_URL, + LEGACY_GITHUB_REPOS, LOCAL_CATALOG_FILE, + OFFICIAL_GITHUB_REPO, PLUGIN_MANIFEST_FILE, PLUGIN_ROOT, REMOTE_CATALOG_CACHE_FILE, @@ -44,7 +46,35 @@ export function isValidSemver(v) { ); } -const OFFICIAL_REPO_PATH_PREFIX = '/yuhuan2498281558/antigravity-usage-monitor'; +const OFFICIAL_REPO_PATH_PREFIX = `/${OFFICIAL_GITHUB_REPO.toLowerCase()}`; +const LEGACY_REPO_PATH_PREFIXES = LEGACY_GITHUB_REPOS.map((repo) => `/${repo.toLowerCase()}`); + +/** + * 判断来源 URL 是否属于已迁移的旧官方 GitHub 仓库地址。 + * + * @param {*} rawUrl + * @returns {boolean} + */ +function isLegacyGithubRepoUrl(rawUrl) { + if (typeof rawUrl !== 'string' || !rawUrl.trim()) return false; + try { + const parsed = new URL(rawUrl.trim()); + const host = parsed.hostname.toLowerCase(); + const pathname = parsed.pathname.toLowerCase(); + if ( + host !== 'github.com' && + host !== 'raw.githubusercontent.com' && + host !== 'codeload.github.com' + ) { + return false; + } + return LEGACY_REPO_PATH_PREFIXES.some( + (prefix) => pathname === prefix || pathname.startsWith(`${prefix}/`) + ); + } catch { + return false; + } +} /** * 校验更新/下载链接是否属于可信的 GitHub 官方仓库与 HTTPS 域名白名单。 @@ -245,6 +275,8 @@ export function sanitizeCatalogPayload(raw) { const explicitReleaseUrl = sanitizeTrustedGithubUrl(raw.releaseUrl, ''); const explicitDownloadUrl = sanitizeTrustedGithubUrl(raw.downloadUrl, ''); const explicitArchiveUrl = sanitizeTrustedGithubUrl(raw.archiveFallbackUrl, ''); + const rawSourceUrl = typeof raw.sourceUrl === 'string' ? raw.sourceUrl.trim() : ''; + const isLegacySource = isLegacyGithubRepoUrl(rawSourceUrl); return { schemaVersion: Number(raw.schemaVersion || 1), @@ -261,8 +293,8 @@ export function sanitizeCatalogPayload(raw) { hasReleaseUrl: Boolean(explicitReleaseUrl), hasDownloadUrl: Boolean(explicitDownloadUrl), hasArchiveFallbackUrl: Boolean(explicitArchiveUrl), - fetchedAtMs: Number(raw.fetchedAtMs || 0), - sourceUrl: typeof raw.sourceUrl === 'string' ? raw.sourceUrl : '', + fetchedAtMs: isLegacySource ? 0 : Number(raw.fetchedAtMs || 0), + sourceUrl: isLegacySource ? '' : rawSourceUrl, pricing, placeholders, }; diff --git a/sidecars/panel/test/backend-harness.mjs b/sidecars/panel/test/backend-harness.mjs index e3a5693..44ce65e 100644 --- a/sidecars/panel/test/backend-harness.mjs +++ b/sidecars/panel/test/backend-harness.mjs @@ -144,6 +144,6 @@ export function backendHarness({ return {ok:true,json:async()=>data}; }, }; - vm.runInNewContext(source+'\n globalThis.api={buildTelemetryPayloadInternal,computeStepCost,resolveModelInfo,inferFamilyFromProviderOrKey,isCarbonModelIdentifier,PLACEHOLDER_MAP,normalizeQuotaFraction,classifyOfficialBucketWindow,classifyQuotaPoolIdentity,buildOfficialQuotaPools,resolveTimeWindow,sanitizeCatalogPayload,rebuildActiveCatalog,syncCloudCatalog,getCloudStatus,isValidSemver,compareSemver,performPluginUpdate,loadSettings,executeSettingsAction};',ctx); + vm.runInNewContext(source+'\n globalThis.api={buildTelemetryPayloadInternal,computeStepCost,resolveModelInfo,inferFamilyFromProviderOrKey,isCarbonModelIdentifier,PLACEHOLDER_MAP,normalizeQuotaFraction,classifyOfficialBucketWindow,classifyQuotaPoolIdentity,buildOfficialQuotaPools,resolveTimeWindow,sanitizeCatalogPayload,rebuildActiveCatalog,syncCloudCatalog,getCloudStatus,isValidSemver,compareSemver,performPluginUpdate,resolveMigratedGitRemoteUrl,loadSettings,executeSettingsAction};',ctx); return {...ctx.api,state}; } diff --git a/sidecars/panel/test/cloud-sync-and-update.test.mjs b/sidecars/panel/test/cloud-sync-and-update.test.mjs index 55bd3cf..a0112da 100644 --- a/sidecars/panel/test/cloud-sync-and-update.test.mjs +++ b/sidecars/panel/test/cloud-sync-and-update.test.mjs @@ -52,7 +52,7 @@ test('sanitizeCatalogPayload filters malformed/null/zero entries, untrusted URLs assert.ok(sanitized); assert.equal(sanitized.catalogVersion, '2026.11.03.9'); assert.equal(sanitized.latestPluginVersion, '1.5.0'); - assert.ok(sanitized.downloadUrl.startsWith('https://github.com/yuhuan2498281558/')); + assert.ok(sanitized.downloadUrl.startsWith('https://github.com/yuhuan-dev/')); assert.deepEqual(Object.keys(sanitized.pricing), ['gemini-4.5-ultra']); assert.deepEqual(Object.keys(sanitized.placeholders), ['MODEL_PLACEHOLDER_M999']); }); @@ -94,7 +94,7 @@ test('cloud catalog sync fetches from GitHub raw URL and dynamically prices newl // Sync cloud catalog from GitHub const syncStatus = await h.syncCloudCatalog({ force: true }); - assert.ok(fetchedUrl.startsWith('https://raw.githubusercontent.com/yuhuan2498281558/antigravity-usage-monitor/main/pricing-catalog.json')); + assert.ok(fetchedUrl.startsWith('https://raw.githubusercontent.com/yuhuan-dev/antigravity-usage-monitor/main/pricing-catalog.json')); assert.equal(syncStatus.source, 'remote'); assert.equal(syncStatus.catalogVersion, '2026.11.03.2'); assert.equal(syncStatus.latestPluginVersion, '1.5.0'); @@ -273,7 +273,103 @@ test('performPluginUpdate pulls fast-forward when git worktree is clean, on main assert.equal(res.mode, 'git'); assert.equal(res.previousVersion, '1.3.1'); assert.equal(res.currentVersion, '1.4.0'); - assert.equal(gitCalls.length, 6); // status, rev-parse, fetch, show, merge-base, pull + assert.equal(gitCalls.length, 7); // status, rev-parse, remote get-url, fetch, show, merge-base, pull +}); + +test('repository migration: scrubs legacy yuhuan2498281558 cache URLs/TTL and migrates git origin remote to yuhuan-dev', async () => { + let fetchedNewRepoUrl = ''; + const cacheH = backendHarness({ + pluginManifest: { name: 'usage-monitor', version: '1.4.4' }, + remoteCatalog: { + schemaVersion: 1, + catalogVersion: '2026.11.11.4', + updatedAt: '2026-11-11T23:20:00+09:00', + latestPluginVersion: '1.4.4', + releaseUrl: 'https://github.com/yuhuan2498281558/antigravity-usage-monitor/releases/latest', + downloadUrl: 'https://github.com/yuhuan2498281558/antigravity-usage-monitor/releases/latest/download/usage-monitor.zip', + archiveFallbackUrl: 'https://codeload.github.com/yuhuan2498281558/antigravity-usage-monitor/zip/refs/heads/main', + sourceUrl: 'https://raw.githubusercontent.com/yuhuan2498281558/antigravity-usage-monitor/main/pricing-catalog.json', + fetchedAtMs: Date.now() - 60_000, // 1 min ago from old repo -> must NOT block non-forced sync to yuhuan-dev + pricing: { + 'gemini-4-carbon-high': { input: 2.0, cache: 0.1, output: 10.0, short: 'carbon-4-high', family: 'Gemini' }, + }, + }, + remoteFetch: async (url) => { + fetchedNewRepoUrl = String(url); + return { + ok: true, + json: async () => ({ + schemaVersion: 1, + catalogVersion: '2026.11.12.1', + updatedAt: '2026-11-12T10:00:00+09:00', + latestPluginVersion: '1.4.5', + pricing: { + 'gemini-4-carbon-high': { input: 2.0, cache: 0.1, output: 10.0, short: 'carbon-4-high', family: 'Gemini' }, + }, + }), + }; + }, + }); + + const initialStatus = cacheH.getCloudStatus(); + assert.equal(initialStatus.releaseUrl, 'https://github.com/yuhuan-dev/antigravity-usage-monitor/releases/latest'); + assert.equal(initialStatus.downloadUrl, 'https://github.com/yuhuan-dev/antigravity-usage-monitor/releases/latest/download/usage-monitor.zip'); + assert.equal(initialStatus.lastSyncedAtMs, 0, 'legacy repo cache TTL must be invalidated so new repo syncs immediately'); + + const synced = await cacheH.syncCloudCatalog({ force: false }); + assert.equal( + fetchedNewRepoUrl, + 'https://raw.githubusercontent.com/yuhuan-dev/antigravity-usage-monitor/main/pricing-catalog.json' + ); + assert.equal(synced.catalogVersion, '2026.11.12.1'); + assert.equal(synced.latestPluginVersion, '1.4.5'); + + assert.equal( + cacheH.resolveMigratedGitRemoteUrl('https://github.com/yuhuan2498281558/antigravity-usage-monitor.git'), + 'https://github.com/yuhuan-dev/antigravity-usage-monitor.git' + ); + assert.equal( + cacheH.resolveMigratedGitRemoteUrl('git@github.com:yuhuan2498281558/antigravity-usage-monitor.git'), + 'git@github.com:yuhuan-dev/antigravity-usage-monitor.git' + ); + assert.equal( + cacheH.resolveMigratedGitRemoteUrl('https://github.com/custom-fork/antigravity-usage-monitor.git'), + '' + ); + + const gitCalls = []; + const migrateH = backendHarness({ + hasGitDir: true, + pluginRootPath: '/Users/test/.gemini/config/plugins/usage-monitor', + pluginManifest: { name: 'usage-monitor', version: '1.4.3' }, + execFileImpl: (_cmd, args, opts, cb) => { + const fn = typeof opts === 'function' ? opts : cb; + gitCalls.push(args); + if (args.includes('rev-parse')) { + fn(null, 'main\n', ''); + return; + } + if (args.includes('remote') && args.includes('get-url')) { + fn(null, 'https://github.com/yuhuan2498281558/antigravity-usage-monitor.git\n', ''); + return; + } + if (args.includes('show')) { + fn(null, JSON.stringify({ name: 'usage-monitor', version: '1.4.4' }), ''); + return; + } + if (args.includes('pull')) { + migrateH.state.pluginManifest = { name: 'usage-monitor', version: '1.4.4' }; + } + fn(null, '', ''); + }, + }); + + const updRes = await migrateH.performPluginUpdate({ isAuto: false }); + assert.equal(updRes.ok, true); + assert.equal(updRes.currentVersion, '1.4.4'); + const setUrlCall = gitCalls.find((args) => args.includes('remote') && args.includes('set-url')); + assert.ok(setUrlCall, 'must run git remote set-url origin before fetching'); + assert.equal(setUrlCall[setUrlCall.length - 1], 'https://github.com/yuhuan-dev/antigravity-usage-monitor.git'); }); test('pluginUpdateMode supports manual (default), auto, and off with legacy autoUpdatePlugin compatibility', async () => { From 07a320411e31ddc7715b23e9af6f50d9d0d8d8ad Mon Sep 17 00:00:00 2001 From: fish <1770968958@qq.com> Date: Thu, 12 Nov 2026 10:21:03 +0900 Subject: [PATCH 2/6] Create LICENSE --- LICENSE | 674 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 674 insertions(+) create mode 100644 LICENSE diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..f288702 --- /dev/null +++ b/LICENSE @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. From b9c7ef488898cac8d84938eac295b6a9fa91b6c6 Mon Sep 17 00:00:00 2001 From: fish <1770968958@qq.com> Date: Thu, 12 Nov 2026 10:22:42 +0900 Subject: [PATCH 3/6] Update LICENSE --- LICENSE | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/LICENSE b/LICENSE index f288702..2dc6eae 100644 --- a/LICENSE +++ b/LICENSE @@ -672,3 +672,12 @@ may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read . + + +## License + +Copyright (C) 2026 yuhuan-dev. + +This project is licensed under the GNU General Public License v3.0 only (GPL-3.0-only). + +See the [LICENSE](LICENSE) file for details. From 0d3286742caf80f8e814f75d390456ff3c5387ac Mon Sep 17 00:00:00 2001 From: fish <1770968958@qq.com> Date: Fri, 13 Nov 2026 13:14:36 +0900 Subject: [PATCH 4/6] Update pricing-catalog.json --- pricing-catalog.json | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/pricing-catalog.json b/pricing-catalog.json index dda1f5c..7263b29 100644 --- a/pricing-catalog.json +++ b/pricing-catalog.json @@ -1,7 +1,7 @@ { "schemaVersion": 1, "catalogVersion": "2026.11.11.4", - "updatedAt": "2026-11-11T23:20:00+09:00", + "updatedAt": "2026-11-13T13:20:00+09:00", "latestPluginVersion": "1.4.4", "releaseUrl": "https://github.com/yuhuan2498281558/antigravity-usage-monitor/releases/latest", "downloadUrl": "https://github.com/yuhuan2498281558/antigravity-usage-monitor/releases/latest/download/usage-monitor.zip", @@ -20,11 +20,11 @@ "gemini-4-hydrogen-low": { "input": 0.30, "cache": 0.03, "output": 2.50, "short": "hydrogen-4-low", "family": "Gemini" }, "gemini-4-hydrogen-tiered": { "input": 0.75, "cache": 0.075, "output": 3.75, "short": "hydrogen-4", "family": "Gemini" }, "gemini-4-hydrogen": { "input": 0.75, "cache": 0.075, "output": 3.75, "short": "hydrogen-4", "family": "Gemini" }, - "gemini-hydrogen-high": { "input": 0.75, "cache": 0.075, "output": 3.75, "short": "hydrogen-high", "family": "Gemini" }, - "gemini-hydrogen-medium": { "input": 0.75, "cache": 0.075, "output": 3.75, "short": "hydrogen", "family": "Gemini" }, - "gemini-hydrogen-low": { "input": 0.30, "cache": 0.03, "output": 2.50, "short": "hydrogen-low", "family": "Gemini" }, - "gemini-hydrogen-tiered": { "input": 0.75, "cache": 0.075, "output": 3.75, "short": "hydrogen", "family": "Gemini" }, - "gemini-hydrogen": { "input": 0.75, "cache": 0.075, "output": 3.75, "short": "hydrogen", "family": "Gemini" }, + "gemini-hydrogen-high": { "input": 1.5, "cache": 0.15, "output": 7.5, "short": "hydrogen-high", "family": "Gemini" }, + "gemini-hydrogen-medium": { "input": 1.5, "cache": 0.15, "output": 7.5, "short": "hydrogen", "family": "Gemini" }, + "gemini-hydrogen-low": { "input": 1.5, "cache": 0.15, "output": 7.5, "short": "hydrogen-low", "family": "Gemini" }, + "gemini-hydrogen-tiered": { "input": 1.5, "cache": 0.15, "output": 7.5, "short": "hydrogen", "family": "Gemini" }, + "gemini-hydrogen": { "input": 1.5, "cache": 0.15, "output": 7.5, "short": "hydrogen", "family": "Gemini" }, "gemini-4-helix-high": { "input": 0.30, "cache": 0.03, "output": 2.50, "short": "helix-4-high", "family": "Gemini" }, "gemini-4-helix-medium": { "input": 0.30, "cache": 0.03, "output": 2.50, "short": "helix-4", "family": "Gemini" }, "gemini-4-helix-low": { "input": 0.30, "cache": 0.03, "output": 2.50, "short": "helix-4-low", "family": "Gemini" }, From 3ac42681565a126a00c423eb63309b86455d3d8e Mon Sep 17 00:00:00 2001 From: fish <1770968958@qq.com> Date: Fri, 13 Nov 2026 17:26:27 +0900 Subject: [PATCH 5/6] feat(panel): Orchestrator compatibility, ID display toggle, and Hydrogen pricing (v1.4.5) --- README.md | 2 +- README.zh-CN.md | 2 +- plugin.json | 2 +- pricing-catalog.json | 43 ++- sidecars/panel/app.js | 256 +++++++++++++--- sidecars/panel/backend/config.mjs | 16 + sidecars/panel/backend/model-pricing.mjs | 93 +++++- sidecars/panel/backend/telemetry-builder.mjs | 9 +- sidecars/panel/backend/usage-aggregator.mjs | 16 +- sidecars/panel/index.html | 4 +- sidecars/panel/main.mjs | 5 + sidecars/panel/package.json | 2 +- sidecars/panel/speed-metrics.mjs | 36 ++- .../components/layout/WindowOverlayShell.js | 9 +- sidecars/panel/src/core/formatters.js | 99 ++++++ sidecars/panel/src/store/telemetryStore.js | 20 +- sidecars/panel/src/views/ConsumptionView.js | 34 ++- sidecars/panel/src/views/LiveOverviewView.js | 17 +- sidecars/panel/src/views/SettingsView.js | 41 ++- sidecars/panel/src/views/StepsDetailView.js | 43 +-- sidecars/panel/test/audit-fixes.test.mjs | 9 +- sidecars/panel/test/backend-harness.mjs | 2 +- sidecars/panel/test/model-identity.test.mjs | 289 +++++++++++++++++- sidecars/panel/test/quota-pools.test.mjs | 88 ++++++ sidecars/panel/test/window-bridge.test.mjs | 28 +- 25 files changed, 1021 insertions(+), 144 deletions(-) diff --git a/README.md b/README.md index 8341ce5..f511b7c 100644 --- a/README.md +++ b/README.md @@ -51,7 +51,7 @@ The dashboard is organized into four tabs, with a top header to switch conversat - **Preferences** - **Mount Mode**: Dual-mount (Top Bar + Sidebar) or Sidebar only. - **Top-Bar Customization**: Independently toggle the live running-sessions indicator, and customize the content and left-to-right order of the three metric slots in the capsule. - - **Model Name Format**: Compact short alias (e.g. `argon-4-high`) or raw upstream model ID (e.g. `gemini-3.8-flash-n`). + - **Model Name Format**: Compact short alias (e.g. `argon-4-high`) or raw upstream model ID (e.g. `gemini-3.8-flash-n`), plus an independent Orchestrator series ID selector (`orchestrator-argon` / `worker-agy-hydrogen` compact mode by default, or full annotated IDs). - **Version Updates & Pricing Sync**: Dynamically sync [`pricing-catalog.json`](pricing-catalog.json) from GitHub, with three update modes: *Notify only, manual update* (default), *Auto update*, and *Off*. ## Model Identification & Cost Accounting diff --git a/README.zh-CN.md b/README.zh-CN.md index c184a83..0cb66d7 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -51,7 +51,7 @@ - **偏好设置** - 选择面板挂载方式:双栖挂载(顶部栏 + 侧边栏)或仅侧边栏。 - 顶部栏定制:独立开关实时运行会话入口,并自由定义右侧三个指标槽位的显示内容与排列顺序。 - - 选择模型名称格式:精简代号或原始模型 ID。 + - 选择模型名称格式:精简代号或原始模型 ID,并可独立设置 Orchestrator 系列显示精简代号(如 `orchestrator-argon`、`worker-agy-hydrogen`)或原始完整 ID。 - 版本更新与价格表同步:支持从云端 [`pricing-catalog.json`](pricing-catalog.json) 动态同步最新模型价格表,并提供「仅提示新版本,手动更新」(默认)、「自动更新」与「关闭更新」三档更新方式。 ## 模型识别与费用口径 diff --git a/plugin.json b/plugin.json index c051043..807c685 100644 --- a/plugin.json +++ b/plugin.json @@ -1,7 +1,7 @@ { "name": "usage-monitor", "displayName": "Usage & Speed Monitor", - "version": "1.4.4", + "version": "1.4.5", "description": "实时查看生成速度、首字延迟、上下文占用、可用额度及历史用量。", "logo": "assets/logo.svg", "suggestedPrompts": [ diff --git a/pricing-catalog.json b/pricing-catalog.json index cf1d598..5ef8298 100644 --- a/pricing-catalog.json +++ b/pricing-catalog.json @@ -1,12 +1,16 @@ { "schemaVersion": 1, - "catalogVersion": "2026.11.12.1", - "updatedAt": "2026-11-13T13:20:00+09:00", - "latestPluginVersion": "1.4.4", + "catalogVersion": "2026.11.13.3", + "updatedAt": "2026-11-13T17:10:00+09:00", + "latestPluginVersion": "1.4.5", "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", "archiveFallbackUrl": "https://codeload.github.com/yuhuan-dev/antigravity-usage-monitor/zip/refs/heads/main", "pricing": { + "gemini-pro-orchestrator": { "input": 2.00, "cache": 0.10, "output": 10.0, "short": "orch-carbon", "family": "Gemini" }, + "orchestrator-carbon": { "input": 2.00, "cache": 0.10, "output": 10.0, "short": "orch-carbon", "family": "Gemini" }, + "gemini-pro-orchestrator-argon": { "input": 2.00, "cache": 0.10, "output": 10.0, "short": "orch-argon", "family": "Gemini" }, + "orchestrator-argon": { "input": 2.00, "cache": 0.10, "output": 10.0, "short": "orch-argon", "family": "Gemini" }, "gemini-4-carbon-high": { "input": 2.00, "cache": 0.10, "output": 10.0, "short": "carbon-4-high", "family": "Gemini" }, "gemini-4-carbon-medium": { "input": 2.00, "cache": 0.10, "output": 10.0, "short": "carbon-4", "family": "Gemini" }, "gemini-4-carbon-low": { "input": 2.00, "cache": 0.10, "output": 10.0, "short": "carbon-4-low", "family": "Gemini" }, @@ -15,16 +19,19 @@ "gemini-4-argon-medium": { "input": 2.00, "cache": 0.10, "output": 10.0, "short": "argon-4", "family": "Gemini" }, "gemini-4-argon-low": { "input": 2.00, "cache": 0.10, "output": 10.0, "short": "argon-4-low", "family": "Gemini" }, "gemini-4-argon": { "input": 2.00, "cache": 0.10, "output": 10.0, "short": "argon-4", "family": "Gemini" }, - "gemini-4-hydrogen-high": { "input": 0.75, "cache": 0.075, "output": 3.75, "short": "hydrogen-4-high", "family": "Gemini" }, - "gemini-4-hydrogen-medium": { "input": 0.75, "cache": 0.075, "output": 3.75, "short": "hydrogen-4", "family": "Gemini" }, - "gemini-4-hydrogen-low": { "input": 0.30, "cache": 0.03, "output": 2.50, "short": "hydrogen-4-low", "family": "Gemini" }, - "gemini-4-hydrogen-tiered": { "input": 0.75, "cache": 0.075, "output": 3.75, "short": "hydrogen-4", "family": "Gemini" }, - "gemini-4-hydrogen": { "input": 0.75, "cache": 0.075, "output": 3.75, "short": "hydrogen-4", "family": "Gemini" }, - "gemini-hydrogen-high": { "input": 1.5, "cache": 0.15, "output": 7.5, "short": "hydrogen-high", "family": "Gemini" }, - "gemini-hydrogen-medium": { "input": 1.5, "cache": 0.15, "output": 7.5, "short": "hydrogen", "family": "Gemini" }, - "gemini-hydrogen-low": { "input": 1.5, "cache": 0.15, "output": 7.5, "short": "hydrogen-low", "family": "Gemini" }, - "gemini-hydrogen-tiered": { "input": 1.5, "cache": 0.15, "output": 7.5, "short": "hydrogen", "family": "Gemini" }, - "gemini-hydrogen": { "input": 1.5, "cache": 0.15, "output": 7.5, "short": "hydrogen", "family": "Gemini" }, + "gemini-4-hydrogen-xhigh": { "input": 1.50, "cache": 0.15, "output": 7.50, "short": "hydrogen-4-xhigh", "family": "Gemini" }, + "gemini-4-hydrogen-high": { "input": 1.50, "cache": 0.15, "output": 7.50, "short": "hydrogen-4-high", "family": "Gemini" }, + "gemini-4-hydrogen-medium": { "input": 1.50, "cache": 0.15, "output": 7.50, "short": "hydrogen-4", "family": "Gemini" }, + "gemini-4-hydrogen-low": { "input": 1.50, "cache": 0.15, "output": 7.50, "short": "hydrogen-4-low", "family": "Gemini" }, + "gemini-4-hydrogen-tiered": { "input": 1.50, "cache": 0.15, "output": 7.50, "short": "hydrogen-4", "family": "Gemini" }, + "gemini-4-hydrogen": { "input": 1.50, "cache": 0.15, "output": 7.50, "short": "hydrogen-4", "family": "Gemini" }, + "gemini-flash-worker-agy": { "input": 1.50, "cache": 0.15, "output": 7.50, "short": "hydrogen-4", "family": "Gemini" }, + "gemini-hydrogen-xhigh": { "input": 1.50, "cache": 0.15, "output": 7.50, "short": "hydrogen-xhigh", "family": "Gemini" }, + "gemini-hydrogen-high": { "input": 1.50, "cache": 0.15, "output": 7.50, "short": "hydrogen-high", "family": "Gemini" }, + "gemini-hydrogen-medium": { "input": 1.50, "cache": 0.15, "output": 7.50, "short": "hydrogen", "family": "Gemini" }, + "gemini-hydrogen-low": { "input": 1.50, "cache": 0.15, "output": 7.50, "short": "hydrogen-low", "family": "Gemini" }, + "gemini-hydrogen-tiered": { "input": 1.50, "cache": 0.15, "output": 7.50, "short": "hydrogen", "family": "Gemini" }, + "gemini-hydrogen": { "input": 1.50, "cache": 0.15, "output": 7.50, "short": "hydrogen", "family": "Gemini" }, "gemini-4-helix-high": { "input": 0.30, "cache": 0.03, "output": 2.50, "short": "helix-4-high", "family": "Gemini" }, "gemini-4-helix-medium": { "input": 0.30, "cache": 0.03, "output": 2.50, "short": "helix-4", "family": "Gemini" }, "gemini-4-helix-low": { "input": 0.30, "cache": 0.03, "output": 2.50, "short": "helix-4-low", "family": "Gemini" }, @@ -128,7 +135,17 @@ "gpt-oss-120b-medium": { "input": 0.80, "cache": 0.10, "output": 2.40, "short": "gpt-oss", "family": "GPT" } }, "placeholders": { + "MODEL_PLACEHOLDER_M667": { "modelId": "gemini-pro-orchestrator", "label": "Orchestrator (Carbon)" }, + "MODEL_PLACEHOLDER_M681": { "modelId": "gemini-pro-orchestrator-argon", "label": "Orchestrator (Argon)" }, + "MODEL_PLACEHOLDER_M669": { "modelId": "gemini-flash-worker-agy", "label": "Orchestrator Worker (Hydrogen)" }, "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)" }, + "MODEL_PLACEHOLDER_M438": { "modelId": "gemini-4-carbon-low", "label": "Gemini 4 Carbon (Low)" }, + "MODEL_PLACEHOLDER_M528": { "modelId": "gemini-4-hydrogen-xhigh", "label": "Gemini 4 Hydrogen (XHigh)" }, + "MODEL_PLACEHOLDER_M525": { "modelId": "gemini-4-hydrogen-high", "label": "Gemini 4 Hydrogen (High)" }, + "MODEL_PLACEHOLDER_M526": { "modelId": "gemini-4-hydrogen-medium", "label": "Gemini 4 Hydrogen (Medium)" }, + "MODEL_PLACEHOLDER_M527": { "modelId": "gemini-4-hydrogen-low", "label": "Gemini 4 Hydrogen (Low)" }, "MODEL_PLACEHOLDER_M417": { "modelId": "gemini-4-argon-high", "label": "Gemini 4 Argon (High)" }, "MODEL_PLACEHOLDER_M418": { "modelId": "gemini-4-argon-medium", "label": "Gemini 4 Argon (Medium)" }, "MODEL_PLACEHOLDER_M419": { "modelId": "gemini-4-argon-low", "label": "Gemini 4 Argon (Low)" }, diff --git a/sidecars/panel/app.js b/sidecars/panel/app.js index 3b92f8b..f1b011d 100644 --- a/sidecars/panel/app.js +++ b/sidecars/panel/app.js @@ -632,6 +632,105 @@ function formatElapsedSec(seconds) { return `${h}h ${remM}m`; } +/** + * 归一化 Orchestrator 系列 ID 显示格式枚举(`'compact'` 精简代号 vs `'full'` 原始完整 ID,默认 `'compact'`)。 + * + * @param {unknown} mode + * @returns {'compact'|'full'} + */ +function normalizeOrchestratorIdDisplayMode(mode) { + return String(mode ?? '').trim().toLowerCase() === 'full' ? 'full' : 'compact'; +} + +/** + * 统一解析步骤、会话摘要或模型汇总行面向用户的模型显示文本与悬停提示。 + * + * 规则: + * - Orchestrator 系列(`Orchestrator (Carbon)`、`Orchestrator (Argon)`、`gemini-flash-worker-agy` / `M669`) + * 独立遵循 `orchestratorIdMode`(`'compact'` 显示 `orchestrator-carbon` / `orchestrator-argon` / `worker-agy-hydrogen`; + * `'full'` 显示带括号标注的完整上游 ID),不受普通模型“精简代号 / 原始模型 ID”切换影响; + * - 其余普通模型继续按 `showUpstreamModel` 与视图选项切换。 + * + * @param {object|null|undefined} target + * @param {{ showUpstreamModel?: boolean, orchestratorIdMode?: string }|boolean} [settings] + * @param {{ preferLabelInShort?: boolean, fallback?: string }} [options] + * @returns {{ text: string, title: string, isOrchestratorSeries: boolean }} + */ +function resolveModelDisplayInfo(target, settings = {}, options = {}) { + const showUpstream = + typeof settings === 'boolean' ? settings : Boolean(settings?.showUpstreamModel); + const orchestratorMode = normalizeOrchestratorIdDisplayMode( + typeof settings === 'object' && settings ? settings.orchestratorIdMode : 'compact' + ); + const preferLabelInShort = Boolean(options?.preferLabelInShort); + const fallback = options?.fallback ?? '模型未知'; + + if (!target || typeof target !== 'object') { + return { text: fallback, title: fallback, isOrchestratorSeries: false }; + } + + const shortText = String( + target.activeModelShort ?? target.modelShort ?? target.shortName ?? '' + ).trim(); + const labelText = String( + target.activeModelLabel ?? target.modelLabel ?? target.label ?? '' + ).trim(); + const upstreamText = String( + target.activeModelUpstream ?? target.modelUpstream ?? target.upstreamName ?? '' + ).trim(); + const responseText = String(target.responseModel ?? '').trim(); + const modelKeyText = String(target.modelKey ?? '').trim(); + + const isCompaction = + Boolean(target.isCompactionStep) || + /·压缩\s*$/.test(shortText) || + /·压缩\s*$/.test(upstreamText) || + /·压缩\s*$/.test(labelText); + + const combined = `${modelKeyText} ${shortText} ${labelText} ${upstreamText} ${responseText}`; + const isOrchWorker = + /\bMODEL_PLACEHOLDER_M669\b|\b[a-z0-9.-]*worker-agy\b|\bworker-agy-hydrogen\b|\bOrchestrator\s+Worker\b/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 + ); + + if (isOrchSeries) { + let compactId = 'orchestrator-carbon'; + let fullId = 'gemini-pro-orchestrator (carbon-4)'; + 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)) { + compactId = 'orchestrator-argon'; + fullId = 'gemini-pro-orchestrator-argon (argon-4)'; + } + const suffix = isCompaction ? '·压缩' : ''; + const text = `${orchestratorMode === 'full' ? fullId : compactId}${suffix}`; + const multiUpstream = + Array.isArray(target.upstreamModels) && target.upstreamModels.length > 1 + ? target.upstreamModels.join(' / ') + : ''; + const title = multiUpstream || `${fullId}${suffix}`; + return { text, title, isOrchestratorSeries: true }; + } + + const standardText = + (showUpstream + ? upstreamText || responseText || shortText || labelText + : preferLabelInShort + ? labelText || shortText + : shortText || labelText) || fallback; + const standardTitle = + showUpstream && Array.isArray(target.upstreamModels) && target.upstreamModels.length > 1 + ? target.upstreamModels.join(' / ') + : standardText; + return { text: standardText, title: standardTitle, isOrchestratorSeries: false }; +} + // --- src/core/httpClient.js --- /** * @fileoverview Async HTTP client with AbortController cancellation for stale @@ -951,14 +1050,29 @@ function normalizeClientUpdateMode(mode, legacyAutoUpdate) { return 'manual'; } +function normalizeClientOrchestratorIdMode(mode) { + return String(mode ?? '').trim().toLowerCase() === 'full' ? 'full' : 'compact'; +} + function isEquivalentTelemetry(prev, next) { if (!prev || !next) return false; if (prev === next) return true; - // 1. 比对系统设置项(模型显示策略、周预算模式与额度、插件更新策略、双栖与顶栏槽位配置) + // 1. 比对系统设置项(模型显示策略、Orchestrator ID 显示风格、周预算模式与额度、插件更新策略、双栖与顶栏槽位配置) const pAct = prev.activeConversation; const nAct = next.activeConversation; if (prev.settings?.showUpstreamModel !== next.settings?.showUpstreamModel) return false; + const prevOrchIdMode = + String(prev.settings?.orchestratorIdMode ?? 'compact').trim().toLowerCase() === 'full' + ? 'full' + : 'compact'; + const nextOrchIdMode = + String(next.settings?.orchestratorIdMode ?? 'compact').trim().toLowerCase() === 'full' + ? 'full' + : 'compact'; + if (prevOrchIdMode !== nextOrchIdMode) { + return false; + } if (prev.settings?.weeklyLimitMode !== next.settings?.weeklyLimitMode) return false; if (prev.settings?.weeklyTokenBudget !== next.settings?.weeklyTokenBudget) return false; if (prev.settings?.weeklyCostBudget !== next.settings?.weeklyCostBudget) return false; @@ -1470,6 +1584,9 @@ async function saveSettingsPatch(patch) { safePatch.weeklyLimitMode = mode === 'custom_tokens' || mode === 'custom_cost' ? mode : 'official'; } + if (Object.prototype.hasOwnProperty.call(safePatch, 'orchestratorIdMode')) { + safePatch.orchestratorIdMode = normalizeClientOrchestratorIdMode(safePatch.orchestratorIdMode); + } if (Object.prototype.hasOwnProperty.call(safePatch, 'showTopbarMultiSession')) { safePatch.showTopbarMultiSession = Boolean(safePatch.showTopbarMultiSession); } @@ -4244,12 +4361,10 @@ const LiveOverviewView = defineComponent({ ensureLiveTicker(); } - // 1. 更新 4 格实时测速矩阵(展示当前会话全局汇总指标,遵循模型名称格式设置) - const showUpstream = Boolean(data.settings?.showUpstreamModel); - const activeModelDisplay = - (showUpstream - ? active.activeModelUpstream || active.activeModelShort - : active.activeModelShort) || '模型未知'; + // 1. 更新 4 格实时测速矩阵(展示当前会话全局汇总指标,遵循模型名称格式与 Orchestrator ID 格式设置) + const activeModelDisplay = resolveModelDisplayInfo(active, data.settings, { + fallback: '模型未知', + }).text; patchClasses(pulseDot, { 'is-pulsing': Boolean(active.isRunning) }); patchText(tpsVal, formatMetric(active.latestTokPerSec, ' tok/s')); const reason = speedReasonText(active.latestSpeedReason); @@ -4298,9 +4413,9 @@ const LiveOverviewView = defineComponent({ const allAgentPills = agents.map((ag) => { const agPct = ag.context?.usedPct ?? 0; - const agModelDisplay = - (showUpstream ? ag.activeModelUpstream || ag.activeModelShort : ag.activeModelShort) || - '模型未知'; + const agModelDisplay = resolveModelDisplayInfo(ag, data.settings, { + fallback: '模型未知', + }).text; return { key: ag.agentId, label: `${ag.badgeText || ag.shortLabel} ${agPct}%`, @@ -4922,7 +5037,9 @@ const ConsumptionView = defineComponent({ * 增量更新热门模型或数据来源单行的指标文本与 4 段比例条宽度。 */ function updateBreakdownItemRow(refs, item, grandTotalTokens, showTokensInHeader = true) { - patchText(refs.nameEl, item.label || item.name || item.shortName || '—'); + const displayLabel = item.label || item.name || item.shortName || '—'; + patchText(refs.nameEl, displayLabel); + patchAttr(refs.nameEl, 'title', item.title || displayLabel); const total = Number(item.totalTokens || 0); const share = grandTotalTokens > 0 ? +((total / grandTotalTokens) * 100).toFixed(1) : 0; patchText(refs.pctBadge, `${share.toFixed(1)}%`); @@ -5053,8 +5170,11 @@ const ConsumptionView = defineComponent({ ); trendChart.update(trendSeries); - // 3. 同步热门模型列表(按总 Token 数降序排列并执行键值增量对账,遵循模型名称显示格式设置) - const showUpstream = Boolean(slice.showUpstreamModel); + // 3. 同步热门模型列表(按总 Token 数降序排列并执行键值增量对账,遵循模型名称与 Orchestrator ID 格式设置) + const displaySettings = { + showUpstreamModel: Boolean(slice.showUpstreamModel), + orchestratorIdMode: slice.orchestratorIdMode, + }; const models = (slice.modelBreakdown || []) .slice() .sort((a, b) => (b.totalTokens || 0) - (a.totalTokens || 0)); @@ -5062,18 +5182,20 @@ const ConsumptionView = defineComponent({ patchKeyedList(modelsListEl, models, { keyFn: (m) => m.label || m.shortName, - sigFn: (m) => - `${showUpstream}:${m.label}:${m.upstreamName || ''}:${m.totalTokens}:${m.costUsd}:${m.unpricedCalls}:${m.calls}:${modelsTotalTok}`, + sigFn: (m) => { + const disp = resolveModelDisplayInfo(m, displaySettings, { preferLabelInShort: true }); + return `${disp.text}:${disp.title}:${m.totalTokens}:${m.costUsd}:${m.unpricedCalls}:${m.calls}:${modelsTotalTok}`; + }, createRow: createBreakdownItemRow, - updateRow: (refs, m) => - updateBreakdownItemRow( + updateRow: (refs, m) => { + const disp = resolveModelDisplayInfo(m, displaySettings, { preferLabelInShort: true }); + return updateBreakdownItemRow( refs, - showUpstream - ? { ...m, label: m.upstreamName || m.label || m.shortName } - : m, + { ...m, label: disp.text, title: disp.title }, modelsTotalTok, true - ), + ); + }, }); // 4. 同步数据来源列表 @@ -5143,6 +5265,9 @@ const ConsumptionView = defineComponent({ consumption: st.telemetry?.consumption, modelBreakdown: st.telemetry?.modelBreakdown, showUpstreamModel: Boolean(st.telemetry?.settings?.showUpstreamModel), + orchestratorIdMode: normalizeOrchestratorIdDisplayMode( + st.telemetry?.settings?.orchestratorIdMode + ), }), (slice) => { latestSlice = slice; @@ -5364,7 +5489,10 @@ const StepsDetailView = defineComponent({ (Array.isArray(scopedConv?.modelBreakdown) && scopedConv.modelBreakdown.length > 0 ? scopedConv.modelBreakdown : slice.sessionModelBreakdown || slice.modelBreakdown) || []; - const showUpstream = Boolean(slice.showUpstreamModel); + const displaySettings = { + showUpstreamModel: Boolean(slice.showUpstreamModel), + orchestratorIdMode: slice.orchestratorIdMode, + }; const modelsTabBadge = hasSubagents ? effectiveScope === 'all' ? '本会话汇总' @@ -5381,8 +5509,10 @@ const StepsDetailView = defineComponent({ // 1. 单步测速表增量对账:以 `-` 为稳定行键,仅在签名变化时刷新单元格 patchKeyedList(stepsTbody, steps, { keyFn: (st) => `${st.agentCascadeId || slice.cascadeId || 'conv'}-${st.stepIndex}`, - sigFn: (st) => - `${hasSubagents}:${effectiveScope}:${st.agentId || 'main'}:${st.stepIndex}:${showUpstream ? st.modelUpstream || st.responseModel || st.modelShort : st.modelShort}:${st.tokPerSec}:${st.ttftSec}:${st.contextTokens}:${st.outputTokens}:${st.cacheHitPct}:${st.costUsd}:${st.selectedSpeedReason}`, + sigFn: (st) => { + const disp = resolveModelDisplayInfo(st, displaySettings, { fallback: '—' }); + return `${hasSubagents}:${effectiveScope}:${st.agentId || 'main'}:${st.stepIndex}:${disp.text}:${disp.title}:${st.tokPerSec}:${st.ttftSec}:${st.contextTokens}:${st.outputTokens}:${st.cacheHitPct}:${st.costUsd}:${st.selectedSpeedReason}`; + }, createRow: () => { const agentBadgeEl = h('span', { className: 'agent-badge is-clickable', @@ -5449,12 +5579,9 @@ const StepsDetailView = defineComponent({ }; } patchText(refs.stepNumText, `#${Number(st.stepIndex)}`); - const modelText = - (showUpstream ? st.modelUpstream || st.responseModel : st.modelShort) || - st.modelShort || - '—'; - patchText(refs.tdModel, modelText); - patchAttr(refs.tdModel, 'title', modelText); + const modelDisplay = resolveModelDisplayInfo(st, displaySettings, { fallback: '—' }); + patchText(refs.tdModel, modelDisplay.text); + patchAttr(refs.tdModel, 'title', modelDisplay.title); patchText(refs.speedMain, formatMetric(st.tokPerSec, ' tok/s')); const reason = speedReasonText(st.selectedSpeedReason); @@ -5477,8 +5604,10 @@ const StepsDetailView = defineComponent({ // 2. 按模型汇总表增量对账:以模型标识为稳定行键,展示调用次数、加权均速、有效样本比与总费用 patchKeyedList(modelsTbody, models, { keyFn: (m) => m.label || m.shortName, - sigFn: (m) => - `${showUpstream ? m.upstreamName || m.shortName : m.shortName}:${m.calls}:${m.avgTokPerSec}:${m.totalTokens}:${m.costUsd}:${m.unpricedCalls}:${m.speedSummary?.sampleCount}`, + sigFn: (m) => { + const disp = resolveModelDisplayInfo(m, displaySettings, { fallback: '—' }); + return `${disp.text}:${disp.title}:${m.calls}:${m.avgTokPerSec}:${m.totalTokens}:${m.costUsd}:${m.unpricedCalls}:${m.speedSummary?.sampleCount}`; + }, createRow: () => { const tdName = h('td', { style: 'font-weight: 600; max-width: 165px; overflow: hidden; text-overflow: ellipsis;', @@ -5496,15 +5625,9 @@ const StepsDetailView = defineComponent({ }; }, updateRow: (refs, m) => { - const nameText = showUpstream - ? m.upstreamName || m.shortName || m.label - : m.shortName || m.label; - patchText(refs.tdName, nameText); - const fullUpstreamTitle = - showUpstream && Array.isArray(m.upstreamModels) && m.upstreamModels.length > 1 - ? m.upstreamModels.join(' / ') - : nameText; - patchAttr(refs.tdName, 'title', fullUpstreamTitle); + const modelDisplay = resolveModelDisplayInfo(m, displaySettings, { fallback: '—' }); + patchText(refs.tdName, modelDisplay.text); + patchAttr(refs.tdName, 'title', modelDisplay.title); patchText(refs.tdCalls, String(Number(m.calls || 0))); patchText(refs.speedMain, formatMetric(m.avgTokPerSec, ' tok/s')); patchText(refs.speedSub, `有效 ${sampleSummary(m.speedSummary)}`); @@ -5528,6 +5651,9 @@ const StepsDetailView = defineComponent({ sessionModelBreakdown: st.telemetry?.activeConversation?.modelBreakdown, modelBreakdown: st.telemetry?.modelBreakdown, showUpstreamModel: Boolean(st.telemetry?.settings?.showUpstreamModel), + orchestratorIdMode: normalizeOrchestratorIdDisplayMode( + st.telemetry?.settings?.orchestratorIdMode + ), }), (slice) => { latestSlice = slice; @@ -5589,7 +5715,7 @@ const StepsDetailView = defineComponent({ /** * @fileoverview View 4: SettingsView (系统设置视图). * 采用定制的 `CustomSelect` 与 `SegmentedControl` 替代所有原生表单控件,分为三个单层细线设置面板: - * 1. 常规设置:配置面板挂载方式(双栖挂载 / 仅右侧辅助栏)与模型名称格式(精简代号 / 原始模型 ID); + * 1. 常规设置:配置面板挂载方式(双栖挂载 / 仅右侧辅助栏)、模型名称格式(精简代号 / 原始模型 ID)与 Orchestrator 系列 ID 格式; * 2. 顶部栏定制:控制左侧「实时运行会话」入口开关,以及自由定义右侧精简胶囊三个数值槽位的显示内容与左右顺序; * 3. 版本更新:配置插件自动更新策略、手动同步云端模型价格表,以及检查并执行 Git/ZIP 双模式插件升级。 */ @@ -5601,6 +5727,12 @@ const STEP_MODEL_DISPLAY_OPTIONS = [ { value: 'upstream', label: '原始模型 ID (如 gemini-3.8-flash-n)' }, ]; +/** Orchestrator 系列模型 ID 显示方式可选项(独立于普通模型名称格式) */ +const ORCHESTRATOR_ID_DISPLAY_OPTIONS = [ + { value: 'compact', label: '精简代号 (如 orchestrator-argon)' }, + { value: 'full', label: '原始完整 ID (如 gemini-pro-orchestrator)' }, +]; + /** 面板挂载模式可选项(顶部栏 + 侧边栏 vs 仅侧边栏) */ const WINDOW_MOUNT_OPTIONS = [ { value: 'dual', label: '双栖挂载 (顶部栏 + 侧边栏)' }, @@ -5653,6 +5785,7 @@ const SettingsView = defineComponent({ name: 'SettingsView', setup({ onCleanup }) { let draftShowUpstreamModel = false; + let draftOrchestratorIdMode = 'compact'; let draftPluginUpdateMode = 'manual'; let draftEnableWindowOverlay = true; let draftShowTopbarMulti = true; @@ -5757,6 +5890,29 @@ const SettingsView = defineComponent({ }, }); + const orchestratorIdSelect = CustomSelect({ + modelValue: 'compact', + icon: 'layers', + options: ORCHESTRATOR_ID_DISPLAY_OPTIONS, + onUpdateModelValue: async (val) => { + const nextMode = normalizeClientOrchestratorIdMode(val); + draftOrchestratorIdMode = nextMode; + orchestratorIdSelect.setValue(nextMode); + showSaveFeedback('保存中…'); + try { + await saveSettingsPatch({ + orchestratorIdMode: nextMode, + }); + showSaveFeedback('已保存'); + } catch { + if (latestSettings) { + renderSettings(latestSettings); + } + showSaveFeedback('保存失败'); + } + }, + }); + const generalPanel = h('section', { className: 'panel' }, [ h('div', { className: 'panel-header' }, [ h('span', { className: 'panel-title' }, [ @@ -5773,6 +5929,10 @@ const SettingsView = defineComponent({ h('span', { className: 'form-label', text: '模型名称格式' }), stepModelSelect.el, ]), + h('div', { className: 'form-row' }, [ + h('span', { className: 'form-label', text: 'Orchestrator 系列 ID' }), + orchestratorIdSelect.el, + ]), ]); // --- 面板 2:顶部栏定制(实时运行会话开关 + 右侧三槽位指标与顺序自定义) --- @@ -6104,6 +6264,7 @@ const SettingsView = defineComponent({ function renderSettings(settings) { if (!settings) return; draftShowUpstreamModel = Boolean(settings.showUpstreamModel); + draftOrchestratorIdMode = normalizeClientOrchestratorIdMode(settings.orchestratorIdMode); draftPluginUpdateMode = normalizeClientUpdateMode( settings.pluginUpdateMode, settings.autoUpdatePlugin @@ -6114,6 +6275,7 @@ const SettingsView = defineComponent({ windowMountSelect.setValue(draftEnableWindowOverlay ? 'dual' : 'sidebar'); stepModelSelect.setValue(draftShowUpstreamModel ? 'upstream' : 'short'); + orchestratorIdSelect.setValue(draftOrchestratorIdMode); autoUpdateSelect.setValue(draftPluginUpdateMode); syncTopbarControls(); viewScrollbar.refresh(); @@ -6195,6 +6357,7 @@ const SettingsView = defineComponent({ unsubView(); windowMountSelect.destroy(); stepModelSelect.destroy(); + orchestratorIdSelect.destroy(); multiSessionToggle.destroy(); for (const sel of slotSelects) { sel.destroy(); @@ -6208,6 +6371,7 @@ const SettingsView = defineComponent({ refs: { windowMountSelect, stepModelSelect, + orchestratorIdSelect, multiSessionToggle, slotSelects, resetTopbarBtn, @@ -8291,11 +8455,9 @@ function mountWindowOverlay() { } // --- 同步悬停三卡片全景概览(与 LiveOverviewView 保持完全一致的数据口径与视觉呈现) --- - const showUpstream = Boolean(telemetry.settings?.showUpstreamModel); - const activeModelDisplay = - (showUpstream - ? overviewActive.activeModelUpstream || overviewActive.activeModelShort - : overviewActive.activeModelShort) || '模型未知'; + const activeModelDisplay = resolveModelDisplayInfo(overviewActive, telemetry.settings, { + fallback: '模型未知', + }).text; patchClasses(hoverPulseDot, { 'is-pulsing': Boolean(overviewActive.isRunning || isRunning) }); patchText(hoverTpsVal, formatMetric(overviewActive.latestTokPerSec, ' tok/s')); diff --git a/sidecars/panel/backend/config.mjs b/sidecars/panel/backend/config.mjs index 8fee696..89dca50 100644 --- a/sidecars/panel/backend/config.mjs +++ b/sidecars/panel/backend/config.mjs @@ -95,6 +95,19 @@ export const DEFAULT_TOPBAR_SLOTS = Object.freeze(['context', 'tps', 'quota_auto export const PLUGIN_UPDATE_MODES = Object.freeze(['off', 'manual', 'auto']); +export const ORCHESTRATOR_ID_MODES = Object.freeze(['compact', 'full']); + +/** + * 归一化 Orchestrator 系列模型 ID 显示风格(`'compact'` 精简代号 vs `'full'` 完整模型 ID,默认 `'compact'`)。 + * + * @param {unknown} mode + * @returns {'compact'|'full'} + */ +export function normalizeOrchestratorIdMode(mode) { + const m = String(mode ?? '').trim().toLowerCase(); + return m === 'full' ? 'full' : 'compact'; +} + /** * 归一化插件更新策略枚举(兼容历史 `autoUpdatePlugin` 布尔开关,默认 `'manual'`)。 * @@ -135,6 +148,7 @@ const DEFAULT_SETTINGS = { weeklyCostBudget: 100, // 自定义每周美元费用预算默认值 ($100,保留底层兼容) weeklyLimitMode: 'official', // 'official' | 'custom_tokens' | 'custom_cost' showUpstreamModel: false, // 是否显示上游真实 responseModel 名称 + orchestratorIdMode: 'compact', // 'compact' | 'full'(Orchestrator 系列显示精简 ID 或完整 ID) pluginUpdateMode: 'manual', // 'off' | 'manual' | 'auto'(默认仅提示新版本,手动更新) autoUpdatePlugin: false, // 派生自 pluginUpdateMode === 'auto',保留底层兼容 enableWindowOverlay: true, // 是否启用双栖模式(自动通过 CDP 在主窗口顶栏挂载胶囊与悬浮面板) @@ -233,6 +247,7 @@ export function loadSettings() { ), weeklyLimitMode: normalizeWeeklyLimitMode(merged.weeklyLimitMode), showUpstreamModel: merged.showUpstreamModel === true, + orchestratorIdMode: normalizeOrchestratorIdMode(merged.orchestratorIdMode), pluginUpdateMode, autoUpdatePlugin: pluginUpdateMode === 'auto', enableWindowOverlay: merged.enableWindowOverlay !== false, @@ -263,6 +278,7 @@ export function computeRuntimeCodeVersion() { join(HERE, 'styles.css'), join(HERE, 'main.mjs'), join(HERE, 'speed-metrics.mjs'), + LOCAL_CATALOG_FILE, ]; const backendDir = join(HERE, 'backend'); try { diff --git a/sidecars/panel/backend/model-pricing.mjs b/sidecars/panel/backend/model-pricing.mjs index 21a6493..b551d7f 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('CARBON') || combined.includes('ARGON') || combined.includes('HYDROGEN') || + combined.includes('ORCHESTRATOR') || combined.includes('HELIX') || combined.includes('FLASH') || combined.includes('GOOGLE') @@ -59,29 +60,42 @@ function inferFamilyFromProviderOrKey(rawModelKey = '', modelId = '', apiProvide } /** - * 判断一组模型标识字段是否指向 Gemini 4 Argon 系列模型(含 M417/M418/M419 枚举)。 + * 判断一组模型标识字段是否指向 Gemini 4 Argon 系列模型(含 M417/M418/M419 及 M681 Orchestrator (Argon))。 * * @param {...string} parts 待检测的标识片段 * @returns {boolean} */ export function isArgonModelIdentifier(...parts) { - return /argon|MODEL_PLACEHOLDER_M41[789]\b/i.test(parts.filter(Boolean).join(' ')); + const text = parts.filter(Boolean).join(' '); + if ( + /\bhydrogen\b|\bgemini-flash-worker-agy\b|MODEL_PLACEHOLDER_M(?:669|52[5678])\b/i.test(text) && + !/\bargon\b|MODEL_PLACEHOLDER_M(?:41[789]|681)\b/i.test(text) + ) { + return false; + } + return /argon|MODEL_PLACEHOLDER_M(?:41[789]|681)\b/i.test(text); } /** - * 判断一组模型标识字段是否指向 Gemini 4 Carbon 系列模型(含 M429 枚举)。 + * 判断一组模型标识字段是否指向 Gemini 4 Carbon 系列模型(含 M427/M429/M437/M438 及 M667 Orchestrator (Carbon))。 * * @param {...string} parts 待检测的标识片段 * @returns {boolean} */ export function isCarbonModelIdentifier(...parts) { - return /\bcarbon\b|gemini-4-carbon|MODEL_PLACEHOLDER_M429\b/i.test( - parts.filter(Boolean).join(' ') - ); + const text = parts.filter(Boolean).join(' '); + 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)) { + return false; + } + return /\bgemini-pro-orchestrator\b(?!-argon)/i.test(text); } /** - * 剥离模型展示名称末尾的思考档位后缀(如 `(High)`、`(Medium)`、`(Thinking)`),提取基础模型族名。 + * 剥离模型展示名称末尾的思考档位后缀(如 `(XHigh)`、`(High)`、`(Medium)`、`(Thinking)`),提取基础模型族名。 + * 保留 `(Carbon)` / `(Argon)` 后缀,以便 `Orchestrator (Carbon)` 与 `Orchestrator (Argon)` 在汇总表中保持分列。 * * @param {string} [label=''] * @returns {string} @@ -89,7 +103,7 @@ export function isCarbonModelIdentifier(...parts) { export function getBaseModelLabel(label = '') { return ( String(label || '') - .replace(/\s*\((?:Max|High|Medium|Low|Thinking|Extra Low|Tiered)\)\s*$/i, '') + .replace(/\s*\((?:Max|XHigh|High|Medium|Low|Thinking|Extra Low|Tiered)\)\s*$/i, '') .trim() || String(label || 'Unknown Model') ); } @@ -121,6 +135,9 @@ export function formatGenericModelSlug(slug = '') { codenameMatch[1].charAt(0).toUpperCase() + codenameMatch[1].slice(1).toLowerCase(); return `Gemini ${codename}`; } + if (/^gemini-flash-worker-agy$/i.test(s)) { + return 'Orchestrator Worker (Hydrogen)'; + } return ''; } @@ -156,8 +173,24 @@ export function resolveModelInfo( responseModel && responseModel !== 'unknown' ? String(responseModel).trim() : ''; const cleanRawFallback = rawModelKey && rawModelKey !== 'unknown' ? rawModelKey : cleanResponseModel; + const isWorkerSlot = + rawModelKey === 'MODEL_PLACEHOLDER_M669' || + /^gemini-flash-worker-agy$/i.test(cleanResponseModel); + const isVagueGenericDisplay = Boolean( + modelDisplayName && + (/^gemini\s+(?:flash|pro)(?:\s+worker)?$/i.test(modelDisplayName.trim()) || + (isWorkerSlot && /^gemini\s+4\s+hydrogen$/i.test(modelDisplayName.trim()))) + ); + const effectiveDisplayName = + modelDisplayName && + ((mergedLabel && + (/\borchestrator\b/i.test(modelDisplayName) || isVagueGenericDisplay) && + !/\borchestrator\b/i.test(mergedLabel)) || + (isVagueGenericDisplay && /^gemini-flash-worker-agy$/i.test(cleanResponseModel))) + ? '' + : modelDisplayName; const derivedDisplay = - modelDisplayName || + effectiveDisplayName || mergedLabel || formatGenericModelSlug(rawModelKey) || formatGenericModelSlug(cleanResponseModel) || @@ -181,14 +214,22 @@ export function resolveModelInfo( (rawModelKey && rawModelKey !== 'unknown' ? rawModelKey : cleanResponseModel) || 'unknown'; + const isOpaqueOrchestratorResp = Boolean( + cleanResponseModel && /\borchestrator\b/i.test(cleanResponseModel) + ); const explicitPricing = MODEL_PRICING[modelId] || MODEL_PRICING[rawModelKey] || - (cleanResponseModel ? MODEL_PRICING[cleanResponseModel] : null) || + (cleanResponseModel && !isOpaqueOrchestratorResp + ? MODEL_PRICING[cleanResponseModel] + : null) || MODEL_PRICING[tieredSlug] || MODEL_PRICING[tieredDashedSlug] || MODEL_PRICING[canonicalSlug] || - MODEL_PRICING[dashedSlug]; + MODEL_PRICING[dashedSlug] || + (cleanResponseModel && isOpaqueOrchestratorResp + ? MODEL_PRICING[cleanResponseModel] + : null); if (explicitPricing) { return { @@ -216,6 +257,36 @@ export function resolveModelInfo( }; } +/** + * 为不透明的 Orchestrator 路由模型 ID 补充底层实际模型代号标注(如 `gemini-pro-orchestrator (carbon-4)`), + * 普通透明上游模型 ID(如 `gemini-3.8-flash-n`、`gemini-4-hydrogen`)原样返回。 + * + * @param {string} [rawUpstream=''] + * @param {ReturnType|null} [mInfo=null] + * @returns {string} + */ +export function formatUpstreamModelId(rawUpstream = '', mInfo = null) { + const s = String(rawUpstream || '').trim(); + if (!s || !/(?:orchestrator|-worker-agy\b)/i.test(s) || /\([^)]+\)\s*$/.test(s)) { + return s; + } + const metaText = `${mInfo?.rawModel || ''} ${mInfo?.modelId || ''} ${mInfo?.shortName || ''} ${mInfo?.label || ''} ${s}`; + if ( + /\bhydrogen\b|\bgemini-flash-worker-agy\b|MODEL_PLACEHOLDER_M(?:669|52[5678])\b/i.test( + metaText + ) + ) { + return `${s} (hydrogen-4)`; + } + if (isArgonModelIdentifier(mInfo?.rawModel, mInfo?.modelId, mInfo?.label, s)) { + return `${s} (argon-4)`; + } + if (isCarbonModelIdentifier(mInfo?.rawModel, mInfo?.modelId, mInfo?.label, s)) { + return `${s} (carbon-4)`; + } + return s; +} + /** * 计算单个步骤的 API 等效美元成本;若模型未定价(`pricing === null`)则返回 `null`。 * 对负数、NaN 或非有限数值统一安全钳制为 0。 diff --git a/sidecars/panel/backend/telemetry-builder.mjs b/sidecars/panel/backend/telemetry-builder.mjs index 1704e02..bdda9f6 100644 --- a/sidecars/panel/backend/telemetry-builder.mjs +++ b/sidecars/panel/backend/telemetry-builder.mjs @@ -28,6 +28,7 @@ import { enumerateAndSyncConversations } from './local-scanner.mjs'; import { callLsRpc, getOfficialQuotaSummary } from './ls-rpc.mjs'; import { computeStepCost, + formatUpstreamModelId, isArgonModelIdentifier, isCarbonModelIdentifier, resolveModelInfo, @@ -135,7 +136,10 @@ function enrichActiveConversationSteps( const rawUpstreamModel = resolvedResponseModel || (mInfo.modelId && mInfo.modelId !== 'unknown' ? mInfo.modelId : mInfo.shortName); - const modelUpstream = st.isCompactionStep ? `${rawUpstreamModel}·压缩` : rawUpstreamModel; + const annotatedUpstreamModel = formatUpstreamModelId(rawUpstreamModel, mInfo); + const modelUpstream = st.isCompactionStep + ? `${annotatedUpstreamModel}·压缩` + : annotatedUpstreamModel; const { viewableDelaySec: _viewableDelaySec, @@ -898,10 +902,11 @@ export async function buildTelemetryPayloadInternal( ? knownUpstreamByModelKey.get(bestMetricStep.modelKey) || '' : ''); modelShort = mInfo.shortName || ''; - modelUpstream = + const rawQuickUpstream = resolvedResp || (mInfo.modelId && mInfo.modelId !== 'unknown' ? mInfo.modelId : mInfo.shortName) || ''; + modelUpstream = formatUpstreamModelId(rawQuickUpstream, mInfo); latestTokPerSec = roundMetric(speedMetric(bestMetricStep).value); } diff --git a/sidecars/panel/backend/usage-aggregator.mjs b/sidecars/panel/backend/usage-aggregator.mjs index d61f252..da70bc0 100644 --- a/sidecars/panel/backend/usage-aggregator.mjs +++ b/sidecars/panel/backend/usage-aggregator.mjs @@ -13,7 +13,11 @@ import { } from '../speed-metrics.mjs'; import { roundMetric, trajectoryCache } from './config.mjs'; import { loadExternalDeepStatsCache } from './local-scanner.mjs'; -import { computeStepCost, resolveModelInfo } from './model-pricing.mjs'; +import { + computeStepCost, + formatUpstreamModelId, + resolveModelInfo, +} from './model-pricing.mjs'; function safeTok(val) { const n = Number(val); @@ -260,7 +264,10 @@ function accumulateStepIntoModelMap(perModelStats, st, mInfo, stepCost) { perModelStats.set(modelGroupKey, { label: modelGroupKey, shortName: mInfo.shortName, - fallbackModelId: mInfo.modelId && mInfo.modelId !== 'unknown' ? mInfo.modelId : '', + fallbackModelId: + mInfo.modelId && mInfo.modelId !== 'unknown' + ? formatUpstreamModelId(mInfo.modelId, mInfo) + : '', upstreamModelCounts: new Map(), family: mInfo.family, calls: 0, @@ -276,9 +283,10 @@ function accumulateStepIntoModelMap(perModelStats, st, mInfo, stepCost) { } const agg = perModelStats.get(modelGroupKey); if (st.responseModel) { + const formattedResp = formatUpstreamModelId(st.responseModel, mInfo); agg.upstreamModelCounts.set( - st.responseModel, - (agg.upstreamModelCounts.get(st.responseModel) || 0) + 1 + formattedResp, + (agg.upstreamModelCounts.get(formattedResp) || 0) + 1 ); } accumulateSpeed(agg.speedAccumulator, st); diff --git a/sidecars/panel/index.html b/sidecars/panel/index.html index 9a6f525..4c12b5b 100644 --- a/sidecars/panel/index.html +++ b/sidecars/panel/index.html @@ -4,11 +4,11 @@ 用量监控 - +
- + diff --git a/sidecars/panel/main.mjs b/sidecars/panel/main.mjs index 7172e6d..c82b4ce 100644 --- a/sidecars/panel/main.mjs +++ b/sidecars/panel/main.mjs @@ -22,6 +22,7 @@ import { computeRuntimeCodeVersion, isPlainObject, loadSettings, + normalizeOrchestratorIdMode, normalizePluginUpdateMode, normalizeTopbarCapsuleSlots, normalizeWeeklyLimitMode, @@ -212,6 +213,10 @@ function executeSettingsAction(data) { typeof payload.showUpstreamModel === 'boolean' ? payload.showUpstreamModel : Boolean(current.showUpstreamModel), + orchestratorIdMode: + payload.orchestratorIdMode !== undefined + ? normalizeOrchestratorIdMode(payload.orchestratorIdMode) + : normalizeOrchestratorIdMode(current.orchestratorIdMode), pluginUpdateMode: nextPluginUpdateMode, autoUpdatePlugin: nextPluginUpdateMode === 'auto', enableWindowOverlay: diff --git a/sidecars/panel/package.json b/sidecars/panel/package.json index 7c079e6..b926566 100644 --- a/sidecars/panel/package.json +++ b/sidecars/panel/package.json @@ -1,6 +1,6 @@ { "name": "usage-monitor-panel", - "version": "1.4.4", + "version": "1.4.5", "private": true, "type": "module", "description": "Sidecar backend and web UI for Antigravity Usage & Speed Monitor.", diff --git a/sidecars/panel/speed-metrics.mjs b/sidecars/panel/speed-metrics.mjs index 3b4824b..db5ada0 100644 --- a/sidecars/panel/speed-metrics.mjs +++ b/sidecars/panel/speed-metrics.mjs @@ -573,10 +573,24 @@ export function extractContextBreakdown(chat) { */ export function extractModelSteps(rawSteps = [], generatorMetadata = []) { const genByStep = new Map(); + const orchestratorExecModels = new Set(); + const collectOrchestratorExecModel = (pc) => { + const execModel = pc?.planExecuteConfig?.executionModel; + if ( + typeof execModel === 'string' && + execModel.trim() && + /orchestrator|MODEL_PLACEHOLDER_M(?:667|681)\b/i.test( + `${pc?.modelName || ''} ${pc?.planModel || ''}` + ) + ) { + orchestratorExecModels.add(execModel.trim()); + } + }; let latestBreakdownChat = null; let latestBreakdownStepIdx = -1; for (const gm of generatorMetadata || []) { + collectOrchestratorExecModel(gm?.plannerConfig); if (!gm?.chatModel) { continue; } @@ -605,6 +619,11 @@ export function extractModelSteps(rawSteps = [], generatorMetadata = []) { } const stepIndex = m.sourceTrajectoryStepInfo?.stepIndex ?? index; + if (Array.isArray(m.generatorMetadata)) { + for (const g of m.generatorMetadata) { + collectOrchestratorExecModel(g?.plannerConfig); + } + } const inlineChat = Array.isArray(m.generatorMetadata) ? m.generatorMetadata.find((g) => g?.chatModel) : null; @@ -708,14 +727,27 @@ export function extractModelSteps(rawSteps = [], generatorMetadata = []) { m?.responseModel, ].find(isValidModelValue); + const resolvedModelKey = identity ? identity[1].trim() : 'unknown'; + const rawDisplayName = chat?.modelDisplayName || ''; + const isGenericWorkerDisplay = + !rawDisplayName || + /\borchestrator\b/i.test(rawDisplayName) || + /^gemini\s+(?:flash|pro)(?:\s+worker)?$/i.test(rawDisplayName.trim()); + const resolvedDisplayName = + (orchestratorExecModels.has(resolvedModelKey) || + /^gemini-flash-worker-agy$/i.test(rawResponseModel || '')) && + isGenericWorkerDisplay + ? 'Orchestrator Worker (Hydrogen)' + : rawDisplayName; + result.push({ stepIndex, isCompactionStep, - modelKey: identity ? identity[1].trim() : 'unknown', + modelKey: resolvedModelKey, modelSource: identity?.[0] || 'unavailable', responseModel: rawResponseModel ? rawResponseModel.trim() : '', modelIdentityVersion: MODEL_IDENTITY_VERSION, - modelDisplayName: chat?.modelDisplayName || '', + modelDisplayName: resolvedDisplayName, apiProvider: u.apiProvider || chat?.usage?.apiProvider || '', createdAt: m.createdAt || null, createdAtMs: Math.floor(start), diff --git a/sidecars/panel/src/components/layout/WindowOverlayShell.js b/sidecars/panel/src/components/layout/WindowOverlayShell.js index f8a9699..6e8f068 100644 --- a/sidecars/panel/src/components/layout/WindowOverlayShell.js +++ b/sidecars/panel/src/components/layout/WindowOverlayShell.js @@ -23,6 +23,7 @@ import { formatMetric, formatTokens, formatUsd, + resolveModelDisplayInfo, sampleSummary, speedReasonText, } from '../../core/formatters.js'; @@ -1990,11 +1991,9 @@ export function mountWindowOverlay() { } // --- 同步悬停三卡片全景概览(与 LiveOverviewView 保持完全一致的数据口径与视觉呈现) --- - const showUpstream = Boolean(telemetry.settings?.showUpstreamModel); - const activeModelDisplay = - (showUpstream - ? overviewActive.activeModelUpstream || overviewActive.activeModelShort - : overviewActive.activeModelShort) || '模型未知'; + const activeModelDisplay = resolveModelDisplayInfo(overviewActive, telemetry.settings, { + fallback: '模型未知', + }).text; patchClasses(hoverPulseDot, { 'is-pulsing': Boolean(overviewActive.isRunning || isRunning) }); patchText(hoverTpsVal, formatMetric(overviewActive.latestTokPerSec, ' tok/s')); diff --git a/sidecars/panel/src/core/formatters.js b/sidecars/panel/src/core/formatters.js index baf0e7d..f16e524 100644 --- a/sidecars/panel/src/core/formatters.js +++ b/sidecars/panel/src/core/formatters.js @@ -100,3 +100,102 @@ export function formatElapsedSec(seconds) { const remM = m % 60; return `${h}h ${remM}m`; } + +/** + * 归一化 Orchestrator 系列 ID 显示格式枚举(`'compact'` 精简代号 vs `'full'` 原始完整 ID,默认 `'compact'`)。 + * + * @param {unknown} mode + * @returns {'compact'|'full'} + */ +export function normalizeOrchestratorIdDisplayMode(mode) { + return String(mode ?? '').trim().toLowerCase() === 'full' ? 'full' : 'compact'; +} + +/** + * 统一解析步骤、会话摘要或模型汇总行面向用户的模型显示文本与悬停提示。 + * + * 规则: + * - Orchestrator 系列(`Orchestrator (Carbon)`、`Orchestrator (Argon)`、`gemini-flash-worker-agy` / `M669`) + * 独立遵循 `orchestratorIdMode`(`'compact'` 显示 `orchestrator-carbon` / `orchestrator-argon` / `worker-agy-hydrogen`; + * `'full'` 显示带括号标注的完整上游 ID),不受普通模型“精简代号 / 原始模型 ID”切换影响; + * - 其余普通模型继续按 `showUpstreamModel` 与视图选项切换。 + * + * @param {object|null|undefined} target + * @param {{ showUpstreamModel?: boolean, orchestratorIdMode?: string }|boolean} [settings] + * @param {{ preferLabelInShort?: boolean, fallback?: string }} [options] + * @returns {{ text: string, title: string, isOrchestratorSeries: boolean }} + */ +export function resolveModelDisplayInfo(target, settings = {}, options = {}) { + const showUpstream = + typeof settings === 'boolean' ? settings : Boolean(settings?.showUpstreamModel); + const orchestratorMode = normalizeOrchestratorIdDisplayMode( + typeof settings === 'object' && settings ? settings.orchestratorIdMode : 'compact' + ); + const preferLabelInShort = Boolean(options?.preferLabelInShort); + const fallback = options?.fallback ?? '模型未知'; + + if (!target || typeof target !== 'object') { + return { text: fallback, title: fallback, isOrchestratorSeries: false }; + } + + const shortText = String( + target.activeModelShort ?? target.modelShort ?? target.shortName ?? '' + ).trim(); + const labelText = String( + target.activeModelLabel ?? target.modelLabel ?? target.label ?? '' + ).trim(); + const upstreamText = String( + target.activeModelUpstream ?? target.modelUpstream ?? target.upstreamName ?? '' + ).trim(); + const responseText = String(target.responseModel ?? '').trim(); + const modelKeyText = String(target.modelKey ?? '').trim(); + + const isCompaction = + Boolean(target.isCompactionStep) || + /·压缩\s*$/.test(shortText) || + /·压缩\s*$/.test(upstreamText) || + /·压缩\s*$/.test(labelText); + + const combined = `${modelKeyText} ${shortText} ${labelText} ${upstreamText} ${responseText}`; + const isOrchWorker = + /\bMODEL_PLACEHOLDER_M669\b|\b[a-z0-9.-]*worker-agy\b|\bworker-agy-hydrogen\b|\bOrchestrator\s+Worker\b/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 + ); + + if (isOrchSeries) { + let compactId = 'orchestrator-carbon'; + let fullId = 'gemini-pro-orchestrator (carbon-4)'; + 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)) { + compactId = 'orchestrator-argon'; + fullId = 'gemini-pro-orchestrator-argon (argon-4)'; + } + const suffix = isCompaction ? '·压缩' : ''; + const text = `${orchestratorMode === 'full' ? fullId : compactId}${suffix}`; + const multiUpstream = + Array.isArray(target.upstreamModels) && target.upstreamModels.length > 1 + ? target.upstreamModels.join(' / ') + : ''; + const title = multiUpstream || `${fullId}${suffix}`; + return { text, title, isOrchestratorSeries: true }; + } + + const standardText = + (showUpstream + ? upstreamText || responseText || shortText || labelText + : preferLabelInShort + ? labelText || shortText + : shortText || labelText) || fallback; + const standardTitle = + showUpstream && Array.isArray(target.upstreamModels) && target.upstreamModels.length > 1 + ? target.upstreamModels.join(' / ') + : standardText; + return { text: standardText, title: standardTitle, isOrchestratorSeries: false }; +} diff --git a/sidecars/panel/src/store/telemetryStore.js b/sidecars/panel/src/store/telemetryStore.js index d7a42d1..43287b3 100644 --- a/sidecars/panel/src/store/telemetryStore.js +++ b/sidecars/panel/src/store/telemetryStore.js @@ -88,14 +88,29 @@ export function normalizeClientUpdateMode(mode, legacyAutoUpdate) { return 'manual'; } +export function normalizeClientOrchestratorIdMode(mode) { + return String(mode ?? '').trim().toLowerCase() === 'full' ? 'full' : 'compact'; +} + function isEquivalentTelemetry(prev, next) { if (!prev || !next) return false; if (prev === next) return true; - // 1. 比对系统设置项(模型显示策略、周预算模式与额度、插件更新策略、双栖与顶栏槽位配置) + // 1. 比对系统设置项(模型显示策略、Orchestrator ID 显示风格、周预算模式与额度、插件更新策略、双栖与顶栏槽位配置) const pAct = prev.activeConversation; const nAct = next.activeConversation; if (prev.settings?.showUpstreamModel !== next.settings?.showUpstreamModel) return false; + const prevOrchIdMode = + String(prev.settings?.orchestratorIdMode ?? 'compact').trim().toLowerCase() === 'full' + ? 'full' + : 'compact'; + const nextOrchIdMode = + String(next.settings?.orchestratorIdMode ?? 'compact').trim().toLowerCase() === 'full' + ? 'full' + : 'compact'; + if (prevOrchIdMode !== nextOrchIdMode) { + return false; + } if (prev.settings?.weeklyLimitMode !== next.settings?.weeklyLimitMode) return false; if (prev.settings?.weeklyTokenBudget !== next.settings?.weeklyTokenBudget) return false; if (prev.settings?.weeklyCostBudget !== next.settings?.weeklyCostBudget) return false; @@ -607,6 +622,9 @@ export async function saveSettingsPatch(patch) { safePatch.weeklyLimitMode = mode === 'custom_tokens' || mode === 'custom_cost' ? mode : 'official'; } + if (Object.prototype.hasOwnProperty.call(safePatch, 'orchestratorIdMode')) { + safePatch.orchestratorIdMode = normalizeClientOrchestratorIdMode(safePatch.orchestratorIdMode); + } if (Object.prototype.hasOwnProperty.call(safePatch, 'showTopbarMultiSession')) { safePatch.showTopbarMultiSession = Boolean(safePatch.showTopbarMultiSession); } diff --git a/sidecars/panel/src/views/ConsumptionView.js b/sidecars/panel/src/views/ConsumptionView.js index e7c9fe2..fb83292 100644 --- a/sidecars/panel/src/views/ConsumptionView.js +++ b/sidecars/panel/src/views/ConsumptionView.js @@ -23,6 +23,8 @@ import { formatDateSpanBadge, formatTokensPrecise, formatUsd, + normalizeOrchestratorIdDisplayMode, + resolveModelDisplayInfo, } from '../core/formatters.js'; import { createSvgIcon } from '../icons/SvgIcon.js'; import { fetchTelemetry, telemetryStore } from '../store/telemetryStore.js'; @@ -411,7 +413,9 @@ export const ConsumptionView = defineComponent({ * 增量更新热门模型或数据来源单行的指标文本与 4 段比例条宽度。 */ function updateBreakdownItemRow(refs, item, grandTotalTokens, showTokensInHeader = true) { - patchText(refs.nameEl, item.label || item.name || item.shortName || '—'); + const displayLabel = item.label || item.name || item.shortName || '—'; + patchText(refs.nameEl, displayLabel); + patchAttr(refs.nameEl, 'title', item.title || displayLabel); const total = Number(item.totalTokens || 0); const share = grandTotalTokens > 0 ? +((total / grandTotalTokens) * 100).toFixed(1) : 0; patchText(refs.pctBadge, `${share.toFixed(1)}%`); @@ -542,8 +546,11 @@ export const ConsumptionView = defineComponent({ ); trendChart.update(trendSeries); - // 3. 同步热门模型列表(按总 Token 数降序排列并执行键值增量对账,遵循模型名称显示格式设置) - const showUpstream = Boolean(slice.showUpstreamModel); + // 3. 同步热门模型列表(按总 Token 数降序排列并执行键值增量对账,遵循模型名称与 Orchestrator ID 格式设置) + const displaySettings = { + showUpstreamModel: Boolean(slice.showUpstreamModel), + orchestratorIdMode: slice.orchestratorIdMode, + }; const models = (slice.modelBreakdown || []) .slice() .sort((a, b) => (b.totalTokens || 0) - (a.totalTokens || 0)); @@ -551,18 +558,20 @@ export const ConsumptionView = defineComponent({ patchKeyedList(modelsListEl, models, { keyFn: (m) => m.label || m.shortName, - sigFn: (m) => - `${showUpstream}:${m.label}:${m.upstreamName || ''}:${m.totalTokens}:${m.costUsd}:${m.unpricedCalls}:${m.calls}:${modelsTotalTok}`, + sigFn: (m) => { + const disp = resolveModelDisplayInfo(m, displaySettings, { preferLabelInShort: true }); + return `${disp.text}:${disp.title}:${m.totalTokens}:${m.costUsd}:${m.unpricedCalls}:${m.calls}:${modelsTotalTok}`; + }, createRow: createBreakdownItemRow, - updateRow: (refs, m) => - updateBreakdownItemRow( + updateRow: (refs, m) => { + const disp = resolveModelDisplayInfo(m, displaySettings, { preferLabelInShort: true }); + return updateBreakdownItemRow( refs, - showUpstream - ? { ...m, label: m.upstreamName || m.label || m.shortName } - : m, + { ...m, label: disp.text, title: disp.title }, modelsTotalTok, true - ), + ); + }, }); // 4. 同步数据来源列表 @@ -632,6 +641,9 @@ export const ConsumptionView = defineComponent({ consumption: st.telemetry?.consumption, modelBreakdown: st.telemetry?.modelBreakdown, showUpstreamModel: Boolean(st.telemetry?.settings?.showUpstreamModel), + orchestratorIdMode: normalizeOrchestratorIdDisplayMode( + st.telemetry?.settings?.orchestratorIdMode + ), }), (slice) => { latestSlice = slice; diff --git a/sidecars/panel/src/views/LiveOverviewView.js b/sidecars/panel/src/views/LiveOverviewView.js index 9d21297..4222d0e 100644 --- a/sidecars/panel/src/views/LiveOverviewView.js +++ b/sidecars/panel/src/views/LiveOverviewView.js @@ -23,6 +23,7 @@ import { formatMetric, formatTokens, formatUsd, + resolveModelDisplayInfo, sampleSummary, speedReasonText, } from '../core/formatters.js'; @@ -860,12 +861,10 @@ export const LiveOverviewView = defineComponent({ ensureLiveTicker(); } - // 1. 更新 4 格实时测速矩阵(展示当前会话全局汇总指标,遵循模型名称格式设置) - const showUpstream = Boolean(data.settings?.showUpstreamModel); - const activeModelDisplay = - (showUpstream - ? active.activeModelUpstream || active.activeModelShort - : active.activeModelShort) || '模型未知'; + // 1. 更新 4 格实时测速矩阵(展示当前会话全局汇总指标,遵循模型名称格式与 Orchestrator ID 格式设置) + const activeModelDisplay = resolveModelDisplayInfo(active, data.settings, { + fallback: '模型未知', + }).text; patchClasses(pulseDot, { 'is-pulsing': Boolean(active.isRunning) }); patchText(tpsVal, formatMetric(active.latestTokPerSec, ' tok/s')); const reason = speedReasonText(active.latestSpeedReason); @@ -914,9 +913,9 @@ export const LiveOverviewView = defineComponent({ const allAgentPills = agents.map((ag) => { const agPct = ag.context?.usedPct ?? 0; - const agModelDisplay = - (showUpstream ? ag.activeModelUpstream || ag.activeModelShort : ag.activeModelShort) || - '模型未知'; + const agModelDisplay = resolveModelDisplayInfo(ag, data.settings, { + fallback: '模型未知', + }).text; return { key: ag.agentId, label: `${ag.badgeText || ag.shortLabel} ${agPct}%`, diff --git a/sidecars/panel/src/views/SettingsView.js b/sidecars/panel/src/views/SettingsView.js index 06180f2..f00bb2c 100644 --- a/sidecars/panel/src/views/SettingsView.js +++ b/sidecars/panel/src/views/SettingsView.js @@ -1,7 +1,7 @@ /** * @fileoverview View 4: SettingsView (系统设置视图). * 采用定制的 `CustomSelect` 与 `SegmentedControl` 替代所有原生表单控件,分为三个单层细线设置面板: - * 1. 常规设置:配置面板挂载方式(双栖挂载 / 仅右侧辅助栏)与模型名称格式(精简代号 / 原始模型 ID); + * 1. 常规设置:配置面板挂载方式(双栖挂载 / 仅右侧辅助栏)、模型名称格式(精简代号 / 原始模型 ID)与 Orchestrator 系列 ID 格式; * 2. 顶部栏定制:控制左侧「实时运行会话」入口开关,以及自由定义右侧精简胶囊三个数值槽位的显示内容与左右顺序; * 3. 版本更新:配置插件自动更新策略、手动同步云端模型价格表,以及检查并执行 Git/ZIP 双模式插件升级。 */ @@ -11,6 +11,7 @@ import { h, patchAttr, patchClasses, patchText } from '../core/domPatch.js'; import { createSvgIcon } from '../icons/SvgIcon.js'; import { DEFAULT_CLIENT_TOPBAR_SLOTS, + normalizeClientOrchestratorIdMode, normalizeClientTopbarSlots, normalizeClientUpdateMode, saveSettingsPatch, @@ -29,6 +30,12 @@ const STEP_MODEL_DISPLAY_OPTIONS = [ { value: 'upstream', label: '原始模型 ID (如 gemini-3.8-flash-n)' }, ]; +/** Orchestrator 系列模型 ID 显示方式可选项(独立于普通模型名称格式) */ +const ORCHESTRATOR_ID_DISPLAY_OPTIONS = [ + { value: 'compact', label: '精简代号 (如 orchestrator-argon)' }, + { value: 'full', label: '原始完整 ID (如 gemini-pro-orchestrator)' }, +]; + /** 面板挂载模式可选项(顶部栏 + 侧边栏 vs 仅侧边栏) */ const WINDOW_MOUNT_OPTIONS = [ { value: 'dual', label: '双栖挂载 (顶部栏 + 侧边栏)' }, @@ -81,6 +88,7 @@ export const SettingsView = defineComponent({ name: 'SettingsView', setup({ onCleanup }) { let draftShowUpstreamModel = false; + let draftOrchestratorIdMode = 'compact'; let draftPluginUpdateMode = 'manual'; let draftEnableWindowOverlay = true; let draftShowTopbarMulti = true; @@ -185,6 +193,29 @@ export const SettingsView = defineComponent({ }, }); + const orchestratorIdSelect = CustomSelect({ + modelValue: 'compact', + icon: 'layers', + options: ORCHESTRATOR_ID_DISPLAY_OPTIONS, + onUpdateModelValue: async (val) => { + const nextMode = normalizeClientOrchestratorIdMode(val); + draftOrchestratorIdMode = nextMode; + orchestratorIdSelect.setValue(nextMode); + showSaveFeedback('保存中…'); + try { + await saveSettingsPatch({ + orchestratorIdMode: nextMode, + }); + showSaveFeedback('已保存'); + } catch { + if (latestSettings) { + renderSettings(latestSettings); + } + showSaveFeedback('保存失败'); + } + }, + }); + const generalPanel = h('section', { className: 'panel' }, [ h('div', { className: 'panel-header' }, [ h('span', { className: 'panel-title' }, [ @@ -201,6 +232,10 @@ export const SettingsView = defineComponent({ h('span', { className: 'form-label', text: '模型名称格式' }), stepModelSelect.el, ]), + h('div', { className: 'form-row' }, [ + h('span', { className: 'form-label', text: 'Orchestrator 系列 ID' }), + orchestratorIdSelect.el, + ]), ]); // --- 面板 2:顶部栏定制(实时运行会话开关 + 右侧三槽位指标与顺序自定义) --- @@ -532,6 +567,7 @@ export const SettingsView = defineComponent({ function renderSettings(settings) { if (!settings) return; draftShowUpstreamModel = Boolean(settings.showUpstreamModel); + draftOrchestratorIdMode = normalizeClientOrchestratorIdMode(settings.orchestratorIdMode); draftPluginUpdateMode = normalizeClientUpdateMode( settings.pluginUpdateMode, settings.autoUpdatePlugin @@ -542,6 +578,7 @@ export const SettingsView = defineComponent({ windowMountSelect.setValue(draftEnableWindowOverlay ? 'dual' : 'sidebar'); stepModelSelect.setValue(draftShowUpstreamModel ? 'upstream' : 'short'); + orchestratorIdSelect.setValue(draftOrchestratorIdMode); autoUpdateSelect.setValue(draftPluginUpdateMode); syncTopbarControls(); viewScrollbar.refresh(); @@ -623,6 +660,7 @@ export const SettingsView = defineComponent({ unsubView(); windowMountSelect.destroy(); stepModelSelect.destroy(); + orchestratorIdSelect.destroy(); multiSessionToggle.destroy(); for (const sel of slotSelects) { sel.destroy(); @@ -636,6 +674,7 @@ export const SettingsView = defineComponent({ refs: { windowMountSelect, stepModelSelect, + orchestratorIdSelect, multiSessionToggle, slotSelects, resetTopbarBtn, diff --git a/sidecars/panel/src/views/StepsDetailView.js b/sidecars/panel/src/views/StepsDetailView.js index 093e0a2..9180427 100644 --- a/sidecars/panel/src/views/StepsDetailView.js +++ b/sidecars/panel/src/views/StepsDetailView.js @@ -18,6 +18,8 @@ import { formatMetric, formatTokens, formatUsd, + normalizeOrchestratorIdDisplayMode, + resolveModelDisplayInfo, sampleSummary, speedReasonText, } from '../core/formatters.js'; @@ -204,7 +206,10 @@ export const StepsDetailView = defineComponent({ (Array.isArray(scopedConv?.modelBreakdown) && scopedConv.modelBreakdown.length > 0 ? scopedConv.modelBreakdown : slice.sessionModelBreakdown || slice.modelBreakdown) || []; - const showUpstream = Boolean(slice.showUpstreamModel); + const displaySettings = { + showUpstreamModel: Boolean(slice.showUpstreamModel), + orchestratorIdMode: slice.orchestratorIdMode, + }; const modelsTabBadge = hasSubagents ? effectiveScope === 'all' ? '本会话汇总' @@ -221,8 +226,10 @@ export const StepsDetailView = defineComponent({ // 1. 单步测速表增量对账:以 `-` 为稳定行键,仅在签名变化时刷新单元格 patchKeyedList(stepsTbody, steps, { keyFn: (st) => `${st.agentCascadeId || slice.cascadeId || 'conv'}-${st.stepIndex}`, - sigFn: (st) => - `${hasSubagents}:${effectiveScope}:${st.agentId || 'main'}:${st.stepIndex}:${showUpstream ? st.modelUpstream || st.responseModel || st.modelShort : st.modelShort}:${st.tokPerSec}:${st.ttftSec}:${st.contextTokens}:${st.outputTokens}:${st.cacheHitPct}:${st.costUsd}:${st.selectedSpeedReason}`, + sigFn: (st) => { + const disp = resolveModelDisplayInfo(st, displaySettings, { fallback: '—' }); + return `${hasSubagents}:${effectiveScope}:${st.agentId || 'main'}:${st.stepIndex}:${disp.text}:${disp.title}:${st.tokPerSec}:${st.ttftSec}:${st.contextTokens}:${st.outputTokens}:${st.cacheHitPct}:${st.costUsd}:${st.selectedSpeedReason}`; + }, createRow: () => { const agentBadgeEl = h('span', { className: 'agent-badge is-clickable', @@ -289,12 +296,9 @@ export const StepsDetailView = defineComponent({ }; } patchText(refs.stepNumText, `#${Number(st.stepIndex)}`); - const modelText = - (showUpstream ? st.modelUpstream || st.responseModel : st.modelShort) || - st.modelShort || - '—'; - patchText(refs.tdModel, modelText); - patchAttr(refs.tdModel, 'title', modelText); + const modelDisplay = resolveModelDisplayInfo(st, displaySettings, { fallback: '—' }); + patchText(refs.tdModel, modelDisplay.text); + patchAttr(refs.tdModel, 'title', modelDisplay.title); patchText(refs.speedMain, formatMetric(st.tokPerSec, ' tok/s')); const reason = speedReasonText(st.selectedSpeedReason); @@ -317,8 +321,10 @@ export const StepsDetailView = defineComponent({ // 2. 按模型汇总表增量对账:以模型标识为稳定行键,展示调用次数、加权均速、有效样本比与总费用 patchKeyedList(modelsTbody, models, { keyFn: (m) => m.label || m.shortName, - sigFn: (m) => - `${showUpstream ? m.upstreamName || m.shortName : m.shortName}:${m.calls}:${m.avgTokPerSec}:${m.totalTokens}:${m.costUsd}:${m.unpricedCalls}:${m.speedSummary?.sampleCount}`, + sigFn: (m) => { + const disp = resolveModelDisplayInfo(m, displaySettings, { fallback: '—' }); + return `${disp.text}:${disp.title}:${m.calls}:${m.avgTokPerSec}:${m.totalTokens}:${m.costUsd}:${m.unpricedCalls}:${m.speedSummary?.sampleCount}`; + }, createRow: () => { const tdName = h('td', { style: 'font-weight: 600; max-width: 165px; overflow: hidden; text-overflow: ellipsis;', @@ -336,15 +342,9 @@ export const StepsDetailView = defineComponent({ }; }, updateRow: (refs, m) => { - const nameText = showUpstream - ? m.upstreamName || m.shortName || m.label - : m.shortName || m.label; - patchText(refs.tdName, nameText); - const fullUpstreamTitle = - showUpstream && Array.isArray(m.upstreamModels) && m.upstreamModels.length > 1 - ? m.upstreamModels.join(' / ') - : nameText; - patchAttr(refs.tdName, 'title', fullUpstreamTitle); + const modelDisplay = resolveModelDisplayInfo(m, displaySettings, { fallback: '—' }); + patchText(refs.tdName, modelDisplay.text); + patchAttr(refs.tdName, 'title', modelDisplay.title); patchText(refs.tdCalls, String(Number(m.calls || 0))); patchText(refs.speedMain, formatMetric(m.avgTokPerSec, ' tok/s')); patchText(refs.speedSub, `有效 ${sampleSummary(m.speedSummary)}`); @@ -368,6 +368,9 @@ export const StepsDetailView = defineComponent({ sessionModelBreakdown: st.telemetry?.activeConversation?.modelBreakdown, modelBreakdown: st.telemetry?.modelBreakdown, showUpstreamModel: Boolean(st.telemetry?.settings?.showUpstreamModel), + orchestratorIdMode: normalizeOrchestratorIdDisplayMode( + st.telemetry?.settings?.orchestratorIdMode + ), }), (slice) => { latestSlice = slice; diff --git a/sidecars/panel/test/audit-fixes.test.mjs b/sidecars/panel/test/audit-fixes.test.mjs index 6133837..a3c970b 100644 --- a/sidecars/panel/test/audit-fixes.test.mjs +++ b/sidecars/panel/test/audit-fixes.test.mjs @@ -70,7 +70,7 @@ test('BUG-01 & INCON-01: Google-proxied Claude/GPT/o-series never misclassify as const m20 = h.resolveModelInfo('MODEL_PLACEHOLDER_M20', new Map(), 'API_PROVIDER_GOOGLE_GEMINI'); assert.equal(m20.modelId, 'gemini-3.5-flash'); - // Gemini Hydrogen (3.8 Flash pricing) & Helix (3.5 Flash Lite pricing), shared Gemini pool + // Gemini Hydrogen ($1.50/$0.15/$7.50 unified pricing) & Helix (3.5 Flash Lite pricing), shared Gemini pool const dynHydrogenMap = new Map([ ['MODEL_PLACEHOLDER_M480', { modelId: '', label: 'Gemini 4 Hydrogen (High)' }], ['MODEL_PLACEHOLDER_M481', { modelId: '', label: 'Gemini 4 Hydrogen (Low)' }], @@ -81,18 +81,19 @@ test('BUG-01 & INCON-01: Google-proxied Claude/GPT/o-series never misclassify as assert.equal(hydroHigh.shortName, 'hydrogen-4-high'); assert.deepEqual( { i: hydroHigh.pricing?.input, c: hydroHigh.pricing?.cache, o: hydroHigh.pricing?.output }, - { i: 0.75, c: 0.075, o: 3.75 } + { i: 1.5, c: 0.15, o: 7.5 } ); const hydroLow = h.resolveModelInfo('MODEL_PLACEHOLDER_M481', dynHydrogenMap); assert.equal(hydroLow.shortName, 'hydrogen-4-low'); assert.deepEqual( { i: hydroLow.pricing?.input, c: hydroLow.pricing?.cache, o: hydroLow.pricing?.output }, - { i: 0.3, c: 0.03, o: 2.5 } + { i: 1.5, c: 0.15, o: 7.5 } ); const hydroCodename = h.resolveModelInfo('gemini-hydrogen'); assert.equal(hydroCodename.family, 'Gemini'); assert.equal(hydroCodename.label, 'Gemini Hydrogen'); - assert.equal(hydroCodename.pricing?.input, 0.75); + assert.equal(hydroCodename.pricing?.input, 1.5); + assert.equal(hydroCodename.pricing?.output, 7.5); const helixInfo = h.resolveModelInfo('MODEL_PLACEHOLDER_M482', dynHydrogenMap); assert.equal(helixInfo.family, 'Gemini'); diff --git a/sidecars/panel/test/backend-harness.mjs b/sidecars/panel/test/backend-harness.mjs index 44ce65e..4688529 100644 --- a/sidecars/panel/test/backend-harness.mjs +++ b/sidecars/panel/test/backend-harness.mjs @@ -144,6 +144,6 @@ export function backendHarness({ return {ok:true,json:async()=>data}; }, }; - vm.runInNewContext(source+'\n globalThis.api={buildTelemetryPayloadInternal,computeStepCost,resolveModelInfo,inferFamilyFromProviderOrKey,isCarbonModelIdentifier,PLACEHOLDER_MAP,normalizeQuotaFraction,classifyOfficialBucketWindow,classifyQuotaPoolIdentity,buildOfficialQuotaPools,resolveTimeWindow,sanitizeCatalogPayload,rebuildActiveCatalog,syncCloudCatalog,getCloudStatus,isValidSemver,compareSemver,performPluginUpdate,resolveMigratedGitRemoteUrl,loadSettings,executeSettingsAction};',ctx); + vm.runInNewContext(source+'\n globalThis.api={buildTelemetryPayloadInternal,computeStepCost,resolveModelInfo,inferFamilyFromProviderOrKey,isArgonModelIdentifier,isCarbonModelIdentifier,getBaseModelLabel,formatUpstreamModelId,PLACEHOLDER_MAP,normalizeQuotaFraction,classifyOfficialBucketWindow,classifyQuotaPoolIdentity,buildOfficialQuotaPools,resolveTimeWindow,sanitizeCatalogPayload,rebuildActiveCatalog,syncCloudCatalog,getCloudStatus,isValidSemver,compareSemver,performPluginUpdate,resolveMigratedGitRemoteUrl,loadSettings,executeSettingsAction};',ctx); return {...ctx.api,state}; } diff --git a/sidecars/panel/test/model-identity.test.mjs b/sidecars/panel/test/model-identity.test.mjs index b678d7a..00da1b3 100644 --- a/sidecars/panel/test/model-identity.test.mjs +++ b/sidecars/panel/test/model-identity.test.mjs @@ -3,7 +3,7 @@ import assert from 'node:assert/strict'; import fs from 'node:fs'; import vm from 'node:vm'; import { extractModelSteps, normalizeCachedStep, MODEL_IDENTITY_VERSION } from '../speed-metrics.mjs'; -import { formatUsd } from '../src/core/formatters.js'; +import { formatUsd, resolveModelDisplayInfo } from '../src/core/formatters.js'; import { backendHarness } from './backend-harness.mjs'; const FLASH = 'MODEL_PLACEHOLDER_M318', ARGON = 'MODEL_PLACEHOLDER_M418'; @@ -195,3 +195,290 @@ test('frontend considers a model-only correction a real telemetry update', () => const b=structuredClone(a); b.activeConversation.recentSteps[0].modelShort='new-model'; assert.equal(ctx.compare(a,b),false); assert.equal(ctx.compare(a,structuredClone(a)),true); }); + +const ORCH_CARBON = 'MODEL_PLACEHOLDER_M667'; +const ORCH_ARGON = 'MODEL_PLACEHOLDER_M681'; +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 () => { + const rows = [step(1, ORCH_CARBON), step(2, undefined, true), step(3, ORCH_CARBON)]; + const raw = { + trajectory: { + steps: rows, + generatorMetadata: [ + { + stepIndices: [1], + chatModel: { + model: ORCH_CARBON, + responseModel: 'gemini-pro-orchestrator', + modelDisplayName: 'Orchestrator (Carbon)', + }, + plannerConfig: { + planModel: ORCH_CARBON, + modelName: 'gemini-pro-orchestrator', + planExecuteConfig: { executionModel: ORCH_EXEC_HYDROGEN }, + }, + }, + { + stepIndices: [3], + chatModel: { + model: ORCH_CARBON, + responseModel: 'gemini-pro-orchestrator', + modelDisplayName: 'Orchestrator (Carbon)', + }, + }, + ], + }, + }; + const p = await payload(rows, { trajectories: { test: raw } }); + const s1 = p.activeConversation.recentSteps.find((s) => s.stepIndex === 1); + const cp = p.activeConversation.recentSteps.find((s) => s.stepIndex === 2); + + assert.equal(s1.modelShort, 'orch-carbon'); + assert.equal(s1.modelUpstream, 'gemini-pro-orchestrator (carbon-4)'); + assert.equal(s1.costUsd, 0.0129); + assert.equal(cp.modelKey, ORCH_CARBON); + assert.equal(cp.modelSource, 'inferred_compaction'); + assert.equal(cp.modelShort, 'orch-carbon·压缩'); + assert.equal(cp.modelUpstream, 'gemini-pro-orchestrator (carbon-4)·压缩'); + assert.equal(p.activeConversation.activeModelShort, 'orch-carbon'); + assert.equal(p.activeConversation.activeModelUpstream, 'gemini-pro-orchestrator (carbon-4)'); + assert.equal(p.consumption.account.unpricedCalls, 0); + assert.equal(p.modelBreakdown.length, 1); + assert.equal(p.modelBreakdown[0].label, 'Orchestrator (Carbon)'); + assert.equal(p.modelBreakdown[0].upstreamName, 'gemini-pro-orchestrator (carbon-4)'); + assert.equal(p.modelBreakdown[0].calls, 3); +}); + +test('Orchestrator (Argon) resolves to orch-argon, annotates upstream ID, and is not misclassified as Carbon', async () => { + const h = backendHarness({ + summaries: { test: { stepCount: 1 } }, + trajectories: { + test: { + trajectory: { + steps: [step(1, ORCH_ARGON)], + generatorMetadata: [ + { + stepIndices: [1], + chatModel: { + model: ORCH_ARGON, + responseModel: 'gemini-pro-orchestrator-argon', + modelDisplayName: 'Orchestrator (Argon)', + }, + }, + ], + }, + }, + }, + }); + + const p = await h.buildTelemetryPayloadInternal('test'); + const s1 = p.activeConversation.recentSteps[0]; + assert.equal(s1.modelShort, 'orch-argon'); + assert.equal(s1.modelUpstream, 'gemini-pro-orchestrator-argon (argon-4)'); + assert.equal(s1.costUsd, 0.0129); + assert.equal(p.modelBreakdown[0].label, 'Orchestrator (Argon)'); + assert.equal(p.modelBreakdown[0].upstreamName, 'gemini-pro-orchestrator-argon (argon-4)'); + assert.equal(h.isArgonModelIdentifier(ORCH_ARGON, 'gemini-pro-orchestrator-argon', 'Orchestrator (Argon)'), true); + assert.equal(h.isCarbonModelIdentifier(ORCH_ARGON, 'gemini-pro-orchestrator-argon', 'Orchestrator (Argon)'), false); +}); + +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)]; + const raw = { + trajectory: { + steps: rows, + generatorMetadata: [ + { + stepIndices: [1], + chatModel: { + model: ORCH_CARBON, + responseModel: 'gemini-pro-orchestrator', + modelDisplayName: 'Orchestrator (Carbon)', + }, + plannerConfig: { + planModel: ORCH_CARBON, + modelName: 'gemini-pro-orchestrator', + planExecuteConfig: { executionModel: FUTURE_EXEC_PH }, + }, + }, + { + stepIndices: [2], + chatModel: { + model: ORCH_EXEC_HYDROGEN, + responseModel: 'gemini-flash-worker-agy', + modelDisplayName: 'Gemini Flash', + }, + }, + { + stepIndices: [3], + chatModel: { + model: FUTURE_EXEC_PH, + responseModel: 'gemini-flash-worker-agy', + modelDisplayName: 'Gemini Flash', + }, + }, + ], + }, + }; + + const p = await payload(rows, { trajectories: { test: raw } }); + 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); + + assert.equal(s1.modelShort, 'orch-carbon'); + assert.equal(s1.modelUpstream, 'gemini-pro-orchestrator (carbon-4)'); + assert.equal(s1.costUsd, 0.0129); + + assert.equal(s2.modelShort, 'hydrogen-4'); + assert.equal(s2.modelLabel, 'Orchestrator Worker (Hydrogen)'); + assert.equal(s2.modelUpstream, 'gemini-flash-worker-agy (hydrogen-4)'); + assert.equal(s2.costUsd, 0.0103); + + assert.equal(s3.modelShort, 'hydrogen-4'); + assert.equal(s3.modelLabel, 'Orchestrator Worker (Hydrogen)'); + assert.equal(s3.modelUpstream, 'gemini-flash-worker-agy (hydrogen-4)'); + assert.equal(s3.costUsd, 0.0103); + + assert.equal(p.consumption.account.unpricedCalls, 0); + const orchRow = p.modelBreakdown.find((m) => m.label === 'Orchestrator (Carbon)'); + const hydroRow = p.modelBreakdown.find((m) => m.label === 'Orchestrator Worker (Hydrogen)'); + assert.ok(orchRow && hydroRow, 'modelBreakdown keeps orchestrator planning separate from Hydrogen worker'); + assert.equal(p.modelBreakdown.some((m) => m.label === 'Gemini Flash'), false); + assert.equal(orchRow.calls, 1); + assert.equal(hydroRow.calls, 2); + assert.equal(hydroRow.upstreamName, 'gemini-flash-worker-agy (hydrogen-4)'); + + // Also verify already-cached M669 worker steps carrying vague "Gemini Flash" or transitional "Gemini 4 Hydrogen" resolve cleanly + const cachedStep = { + ...extractModelSteps([step(10, ORCH_EXEC_HYDROGEN)])[0], + responseModel: 'gemini-flash-worker-agy', + modelDisplayName: 'Gemini Flash', + }; + const cachedTransitionalDirect = { + ...extractModelSteps([step(11, 'MODEL_PLACEHOLDER_M528')])[0], + modelDisplayName: 'Gemini 4 Hydrogen (XHigh)', + }; + const hCached = backendHarness({ + cache: { test: { signature: 'v13-clean:2:', steps: [cachedStep, cachedTransitionalDirect] } }, + trajectories: { test: new Error('offline') }, + }); + const pCached = await hCached.buildTelemetryPayloadInternal('test'); + assert.equal(pCached.activeConversation.activeModelShort, 'hydrogen-4-xhigh'); + assert.equal( + pCached.modelBreakdown.find((m) => m.label === 'Orchestrator Worker (Hydrogen)')?.upstreamName, + 'gemini-flash-worker-agy (hydrogen-4)' + ); + assert.ok( + pCached.modelBreakdown.find((m) => m.label === 'Gemini 4 Hydrogen'), + 'direct Gemini 4 Hydrogen remains in its own breakdown bucket separate from worker-agy' + ); +}); + +test('new Carbon (M427/M437/M438) and Hydrogen XHigh/High/Medium/Low (M525-M528) placeholders resolve and group cleanly', () => { + const { resolveModelInfo, getBaseModelLabel } = backendHarness(); + + assert.equal(resolveModelInfo('MODEL_PLACEHOLDER_M427').shortName, 'carbon-4-high'); + assert.equal(resolveModelInfo('MODEL_PLACEHOLDER_M437').shortName, 'carbon-4'); + assert.equal(resolveModelInfo('MODEL_PLACEHOLDER_M438').shortName, 'carbon-4-low'); + + const xhigh = resolveModelInfo('MODEL_PLACEHOLDER_M528'); + assert.equal(xhigh.shortName, 'hydrogen-4-xhigh'); + assert.equal(xhigh.baseLabel, 'Gemini 4 Hydrogen'); + assert.equal(xhigh.pricing.input, 1.5); + assert.equal(xhigh.pricing.cache, 0.15); + assert.equal(xhigh.pricing.output, 7.5); + assert.equal(resolveModelInfo('MODEL_PLACEHOLDER_M525').shortName, 'hydrogen-4-high'); + assert.equal(resolveModelInfo('MODEL_PLACEHOLDER_M526').shortName, 'hydrogen-4'); + assert.equal(resolveModelInfo('MODEL_PLACEHOLDER_M527').shortName, 'hydrogen-4-low'); + assert.equal(resolveModelInfo('MODEL_PLACEHOLDER_M527').pricing.input, 1.5); + assert.equal(resolveModelInfo('MODEL_PLACEHOLDER_M527').pricing.output, 7.5); + + assert.equal(getBaseModelLabel('Orchestrator (Carbon)'), 'Orchestrator (Carbon)'); + assert.equal(getBaseModelLabel('Orchestrator (Argon)'), 'Orchestrator (Argon)'); + assert.equal(getBaseModelLabel('Orchestrator Worker (Hydrogen)'), 'Orchestrator Worker (Hydrogen)'); +}); + +test('orchestratorIdMode defaults to compact, persists via settings action, and controls Orchestrator series independently of showUpstreamModel', () => { + const h = backendHarness(); + assert.equal(h.loadSettings().orchestratorIdMode, 'compact'); + + const resFull = h.executeSettingsAction({ orchestratorIdMode: 'full' }); + assert.equal(resFull.ok, true); + assert.equal(resFull.updated.orchestratorIdMode, 'full'); + + const resInvalid = h.executeSettingsAction({ orchestratorIdMode: 'unexpected' }); + assert.equal(resInvalid.updated.orchestratorIdMode, 'compact'); + + const orchCarbon = { + modelKey: ORCH_CARBON, + modelShort: 'orch-carbon', + modelLabel: 'Orchestrator (Carbon)', + modelUpstream: 'gemini-pro-orchestrator (carbon-4)', + responseModel: 'gemini-pro-orchestrator', + }; + const orchArgon = { + modelKey: ORCH_ARGON, + modelShort: 'orch-argon', + modelLabel: 'Orchestrator (Argon)', + modelUpstream: 'gemini-pro-orchestrator-argon (argon-4)', + responseModel: 'gemini-pro-orchestrator-argon', + }; + const orchWorkerCompaction = { + modelKey: ORCH_EXEC_HYDROGEN, + modelShort: 'hydrogen-4·压缩', + modelLabel: 'Orchestrator Worker (Hydrogen) [自动压缩]', + modelUpstream: 'gemini-flash-worker-agy (hydrogen-4)·压缩', + responseModel: 'gemini-flash-worker-agy', + isCompactionStep: true, + }; + const directHydrogen = { + modelKey: 'MODEL_PLACEHOLDER_M528', + modelShort: 'hydrogen-4-xhigh', + modelLabel: 'Gemini 4 Hydrogen (XHigh)', + modelUpstream: 'gemini-4-hydrogen-xhigh', + }; + + for (const showUpstreamModel of [false, true]) { + assert.equal( + resolveModelDisplayInfo(orchCarbon, { showUpstreamModel, orchestratorIdMode: 'compact' }).text, + 'orchestrator-carbon' + ); + assert.equal( + resolveModelDisplayInfo(orchArgon, { showUpstreamModel, orchestratorIdMode: 'compact' }).text, + 'orchestrator-argon' + ); + assert.equal( + resolveModelDisplayInfo(orchWorkerCompaction, { showUpstreamModel, orchestratorIdMode: 'compact' }).text, + 'worker-agy-hydrogen·压缩' + ); + assert.equal( + resolveModelDisplayInfo(orchCarbon, { showUpstreamModel, orchestratorIdMode: 'full' }).text, + 'gemini-pro-orchestrator (carbon-4)' + ); + assert.equal( + resolveModelDisplayInfo(orchArgon, { showUpstreamModel, orchestratorIdMode: 'full' }).text, + 'gemini-pro-orchestrator-argon (argon-4)' + ); + assert.equal( + resolveModelDisplayInfo(orchWorkerCompaction, { showUpstreamModel, orchestratorIdMode: 'full' }).text, + 'gemini-flash-worker-agy (hydrogen-4)·压缩' + ); + } + + // Non-Orchestrator direct Hydrogen still follows showUpstreamModel regardless of orchestratorIdMode + assert.equal( + resolveModelDisplayInfo(directHydrogen, { showUpstreamModel: false, orchestratorIdMode: 'compact' }).text, + 'hydrogen-4-xhigh' + ); + assert.equal( + resolveModelDisplayInfo(directHydrogen, { showUpstreamModel: true, orchestratorIdMode: 'compact' }).text, + 'gemini-4-hydrogen-xhigh' + ); + assert.equal( + resolveModelDisplayInfo(directHydrogen, { showUpstreamModel: false, orchestratorIdMode: 'full' }, { preferLabelInShort: true }).text, + 'Gemini 4 Hydrogen (XHigh)' + ); +}); diff --git a/sidecars/panel/test/quota-pools.test.mjs b/sidecars/panel/test/quota-pools.test.mjs index f2f09e5..2c23184 100644 --- a/sidecars/panel/test/quota-pools.test.mjs +++ b/sidecars/panel/test/quota-pools.test.mjs @@ -395,3 +395,91 @@ test('switching accounts within 10s immediately invalidates quotaSummaryCache', ); assert.equal(second.quotas.pools[0].weeklyRemainingPct, 8.7); }); + +test('Orchestrator quota pool binding follows active phase: Carbon/Argon while planning, Gemini when offloaded to Hydrogen', async () => { + const ORCH_CARBON = 'MODEL_PLACEHOLDER_M667'; + const ORCH_ARGON = 'MODEL_PLACEHOLDER_M681'; + const ORCH_EXEC_HYDROGEN = 'MODEL_PLACEHOLDER_M669'; + const geminiReset = new Date(Date.now() + 24 * 3600_000).toISOString(); + const argonReset = new Date(Date.now() + 48 * 3600_000).toISOString(); + const carbonReset = new Date(Date.now() + 72 * 3600_000).toISOString(); + const fiveHourReset = new Date(Date.now() + 2 * 3600_000).toISOString(); + + const h = backendHarness({ + summaries: { + orchCarbonPlan: { stepCount: 1 }, + orchArgonPlan: { stepCount: 1 }, + orchHydrogenExec: { stepCount: 2 }, + }, + trajectories: { + orchCarbonPlan: { trajectory: { steps: [makeStep(1, ORCH_CARBON)] } }, + orchArgonPlan: { trajectory: { steps: [makeStep(1, ORCH_ARGON)] } }, + orchHydrogenExec: { + trajectory: { steps: [makeStep(1, ORCH_CARBON), makeStep(2, ORCH_EXEC_HYDROGEN)] }, + }, + }, + userStatus: { + userTier: { id: 'g1-pro-tier', name: 'Google AI Pro' }, + cascadeModelConfigData: { + clientModelConfigs: [ + { + label: 'Orchestrator (Carbon)', + modelId: 'gemini-pro-orchestrator', + modelOrAlias: { model: ORCH_CARBON }, + quotaInfo: { remainingFraction: 0.4, resetTime: carbonReset }, + }, + { + label: 'Orchestrator (Argon)', + modelId: 'gemini-pro-orchestrator-argon', + modelOrAlias: { model: ORCH_ARGON }, + quotaInfo: { remainingFraction: 0.6, resetTime: argonReset }, + }, + { + label: 'Gemini 3.8 Flash (High)', + modelId: 'gemini-3.8-flash-high', + modelOrAlias: { model: FLASH }, + quotaInfo: { remainingFraction: 0.9, resetTime: geminiReset }, + }, + ], + }, + }, + quotaSummary: { + groups: [ + { + displayName: 'Gemini Models', + buckets: [ + { bucketId: 'gemini-5h', window: '5h', remainingFraction: 0.95, resetTime: fiveHourReset }, + { bucketId: 'gemini-weekly', window: 'weekly', remainingFraction: 0.9, resetTime: geminiReset }, + ], + }, + { + displayName: 'Gemini 4 Argon', + buckets: [ + { bucketId: 'argon-weekly', window: 'weekly', remainingFraction: 0.6, resetTime: argonReset }, + ], + }, + { + displayName: 'Gemini 4 Carbon', + buckets: [ + { bucketId: 'carbon-weekly', window: 'weekly', remainingFraction: 0.4, resetTime: carbonReset }, + ], + }, + ], + }, + }); + + const pCarbon = await h.buildTelemetryPayloadInternal('orchCarbonPlan'); + assert.equal(pCarbon.quotas.activePool.family, 'Carbon'); + assert.equal(pCarbon.quotas.weekly.poolFamily, 'Carbon'); + assert.equal(pCarbon.quotas.weekly.remainingPct, 40); + + const pArgon = await h.buildTelemetryPayloadInternal('orchArgonPlan'); + assert.equal(pArgon.quotas.activePool.family, 'Argon'); + assert.equal(pArgon.quotas.weekly.poolFamily, 'Argon'); + assert.equal(pArgon.quotas.weekly.remainingPct, 60); + + const pExec = await h.buildTelemetryPayloadInternal('orchHydrogenExec'); + assert.equal(pExec.quotas.activePool.family, 'Gemini'); + assert.equal(pExec.quotas.weekly.poolFamily, 'Gemini'); + assert.equal(pExec.quotas.weekly.remainingPct, 90); +}); diff --git a/sidecars/panel/test/window-bridge.test.mjs b/sidecars/panel/test/window-bridge.test.mjs index 2c84241..ca136f9 100644 --- a/sidecars/panel/test/window-bridge.test.mjs +++ b/sidecars/panel/test/window-bridge.test.mjs @@ -654,6 +654,7 @@ test('Compiled app.js mounts dual Shadow DOM hosts, tracks /c/ routes, pro weeklyTokenBudget: 150000000, weeklyCostBudget: 100, showUpstreamModel: false, + orchestratorIdMode: 'compact', autoUpdatePlugin: false, enableWindowOverlay: true, showTopbarMultiSession: true, @@ -1023,14 +1024,15 @@ test('Compiled app.js mounts dual Shadow DOM hosts, tracks /c/ routes, pro const settingsSelects = settingsPane.querySelectorAll('.custom-select'); assert.equal( settingsSelects.length, - 6, - 'SettingsView renders 6 CustomSelect controls (mount, modelFormat, 3 topbar slots, autoUpdate)' + 7, + 'SettingsView renders 7 CustomSelect controls (mount, modelFormat, orchestratorIdFormat, 3 topbar slots, autoUpdate)' ); const mountSelectEl = settingsSelects[0]; const modelFormatSelectEl = settingsSelects[1]; - const slot0SelectEl = settingsSelects[2]; - const slot1SelectEl = settingsSelects[3]; - const slot2SelectEl = settingsSelects[4]; + const orchestratorIdSelectEl = settingsSelects[2]; + const slot0SelectEl = settingsSelects[3]; + const slot1SelectEl = settingsSelects[4]; + const slot2SelectEl = settingsSelects[5]; // Toggle windowMountSelect: dual -> sidebar -> dual assert.ok(mountSelectEl.querySelector('.select-label').textContent.includes('顶部栏 + 侧边栏')); @@ -1060,6 +1062,20 @@ test('Compiled app.js mounts dual Shadow DOM hosts, tracks /c/ routes, pro assert.equal(mockSettings.showUpstreamModel, false); assert.ok(modelFormatSelectEl.querySelector('.select-label').textContent.includes('精简代号')); + // Toggle orchestratorIdSelect: compact -> full -> compact + assert.ok(orchestratorIdSelectEl.querySelector('.select-label').textContent.includes('精简代号')); + orchestratorIdSelectEl.querySelector('.select-trigger').dispatchEvent({ type: 'click', stopPropagation() {} }); + orchestratorIdSelectEl.querySelectorAll('.select-option')[1].dispatchEvent({ type: 'click', stopPropagation() {} }); + await new Promise((r) => setTimeout(r, 30)); + assert.equal(mockSettings.orchestratorIdMode, 'full'); + assert.ok(orchestratorIdSelectEl.querySelector('.select-label').textContent.includes('原始完整 ID')); + + orchestratorIdSelectEl.querySelector('.select-trigger').dispatchEvent({ type: 'click', stopPropagation() {} }); + orchestratorIdSelectEl.querySelectorAll('.select-option')[0].dispatchEvent({ type: 'click', stopPropagation() {} }); + await new Promise((r) => setTimeout(r, 30)); + assert.equal(mockSettings.orchestratorIdMode, 'compact'); + assert.ok(orchestratorIdSelectEl.querySelector('.select-label').textContent.includes('精简代号')); + // Toggle topbar multi-session switch: show -> hide -> show const topbarSegBtns = settingsPane.querySelectorAll('.seg-btn'); assert.equal(topbarSegBtns.length, 2, 'Topbar multi-session toggle has 显示 / 隐藏 buttons'); @@ -1165,7 +1181,7 @@ test('Compiled app.js mounts dual Shadow DOM hosts, tracks /c/ routes, pro ); assert.equal(headerUpdateBtn.hasAttribute('hidden'), false); - const updateModeSelectEl = settingsSelects[5]; + const updateModeSelectEl = settingsSelects[6]; assert.equal(updateModeSelectEl.querySelector('.select-label').textContent, '仅提示新版本,手动更新'); updateModeSelectEl.querySelector('.select-trigger').dispatchEvent({ type: 'click', stopPropagation() {} }); const updateOpts = updateModeSelectEl.querySelectorAll('.select-option'); From cb66de55785518d7c025fbe45f63841a9d460768 Mon Sep 17 00:00:00 2001 From: yuhuan2498281558 Date: Fri, 13 Nov 2026 18:20:01 +0800 Subject: [PATCH 6/6] chore(release): prepare v1.4.5 package --- sidecars/panel/index.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sidecars/panel/index.html b/sidecars/panel/index.html index 4c12b5b..4c04979 100644 --- a/sidecars/panel/index.html +++ b/sidecars/panel/index.html @@ -4,11 +4,11 @@ 用量监控 - +
- +