Skip to content

WorkBuddy、CodeBuddy 桌面端增强助手:签到猫猫旅行成长计划查询、多账号独立备份、点切即用;免打扰模式让 AI 无人值守跑长任务;跨账号会话迁移、异常中断自动续接;暂存/快捷提示词;毛玻璃主题与更多实用功能。

fix: synchronize active session and usage state

[email protected]05227279b5cb
diff --git a/scripts/credit-history-sync.js b/scripts/credit-history-sync.js
index ba4761c..7dd1fd2 100644
--- a/scripts/credit-history-sync.js
+++ b/scripts/credit-history-sync.js
@@ -5,6 +5,8 @@ const path = require('node:path');
const { randomUUID } = require('node:crypto');
const { fetchUsageSinceAnchor, startOfLocalDay } = require('./credit-request-usage.js');
+const CREDIT_HISTORY_CACHE_VERSION = 2;
+
function dateString(date) {
return `${date.getFullYear()}-${String(date.getMonth() + 1).padStart(2, '0')}-${String(date.getDate()).padStart(2, '0')}`;
}
@@ -29,7 +31,7 @@ function createCreditHistorySync(options) {
const key = (uid, date) => uid + ':' + date;
try {
const stored = JSON.parse(fs.readFileSync(options.cacheFile, 'utf8'));
- if (stored.version === 1 && Array.isArray(stored.daily)) for (const row of stored.daily) {
+ if (stored.version === CREDIT_HISTORY_CACHE_VERSION && Array.isArray(stored.daily)) for (const row of stored.daily) {
if (typeof row.uid !== 'string' || !/^\d{4}-\d\d-\d\d$/.test(row.date) ||
!Number.isFinite(row.used) || row.used < 0 || !Number.isSafeInteger(row.count) || row.count < 0 ||
!Number.isFinite(row.queriedAt) || typeof row.final !== 'boolean') continue;
@@ -42,7 +44,7 @@ function createCreditHistorySync(options) {
const tmp = options.cacheFile + '.tmp';
try {
fs.mkdirSync(path.dirname(options.cacheFile), { recursive: true, mode: 0o700 });
- fs.writeFileSync(tmp, JSON.stringify({ version: 1, daily: Array.from(cache.values()) }), { mode: 0o600 });
+ fs.writeFileSync(tmp, JSON.stringify({ version: CREDIT_HISTORY_CACHE_VERSION, daily: Array.from(cache.values()) }), { mode: 0o600 });
fs.renameSync(tmp, options.cacheFile);
} catch (_) { /* In-memory results remain usable if disk is unavailable. */ }
}
diff --git a/scripts/credit-request-usage.js b/scripts/credit-request-usage.js
index 16cd577..2dd43e3 100644
--- a/scripts/credit-request-usage.js
+++ b/scripts/credit-request-usage.js
@@ -40,6 +40,27 @@ function safeText(value, maxLength = 200) {
return String(value).replace(/\0/g, '').slice(0, maxLength);
}
+// The billing endpoint has returned model metadata in several shapes over
+// time. Keep the model key readable and stable without persisting the raw
+// upstream object.
+function modelText(value, depth = 0) {
+ if (typeof value === 'string' || typeof value === 'number') return safeText(value).trim();
+ if (!value || typeof value !== 'object' || depth > 2) return '';
+ for (const key of ['name', 'modelName', 'model_name', 'id', 'modelId', 'model_id', 'slug']) {
+ const text = modelText(value[key], depth + 1);
+ if (text) return text;
+ }
+ return '';
+}
+
+function usageModel(row) {
+ for (const key of ['model', 'modelName', 'model_name', 'modelId', 'model_id', 'modelInfo', 'model_info']) {
+ const text = modelText(row[key]);
+ if (text) return text;
+ }
+ return '';
+}
+
function normalizeUsageRow(row) {
if (!row || typeof row !== 'object') throw new Error('用量记录不是对象');
const requestId = safeText(row.requestId, 512).trim();
@@ -53,7 +74,7 @@ function normalizeUsageRow(row) {
requestTime,
usageDate: localDateString(requestTime),
credit,
- model: safeText(row.model),
+ model: usageModel(row),
client: safeText(row.client),
agentPurpose: safeText(row.agentPurpose),
};
@@ -196,6 +217,7 @@ module.exports = {
fetchUsageSinceAnchor,
formatLocalDateTime,
normalizeUsageRow,
+ usageModel,
parseRequestTime,
startOfLocalDay,
};
diff --git a/scripts/inject.js b/scripts/inject.js
index 1513532..0db2ecd 100644
--- a/scripts/inject.js
+++ b/scripts/inject.js
@@ -6456,6 +6456,10 @@ if (typeof window !== 'undefined' && typeof document !== 'undefined') {
function usageTrendGroups(days, records, dimension, names) {
var groups = new Map();
(records || []).forEach(function (row) {
+ // Credit trends share account-total and model-detail records. A row
+ // without the active dimension belongs to the other view and must not
+ // become a synthetic "未识别模型"/"未关联账号" group.
+ if (!Object.prototype.hasOwnProperty.call(row, dimension)) return;
var key = String(row[dimension] || '');
var group = groups.get(key);
if (!group) {
@@ -15296,6 +15300,7 @@ if (typeof window !== 'undefined' && typeof document !== 'undefined') {
'.wbs-session-usage-spacer{display:block;width:100%;height:28px;min-height:28px;pointer-events:none;visibility:hidden}',
'html.cb-dark .wbs-session-usage-summary,html[data-theme="dark"] .wbs-session-usage-summary,body[data-vscode-theme-name*="dark" i] .wbs-session-usage-summary{background:transparent;color:var(--wb-color-text-primary,#f2f3f5)}html.cb-dark .wbs-session-usage-main,html[data-theme="dark"] .wbs-session-usage-main,body[data-vscode-theme-name*="dark" i] .wbs-session-usage-main{color:var(--wb-color-text-secondary,#b7bbc5)}html.cb-dark .wbs-session-usage-copy,html[data-theme="dark"] .wbs-session-usage-copy,body[data-vscode-theme-name*="dark" i] .wbs-session-usage-copy{border:0;background:transparent;color:var(--wb-color-text-primary,#f2f3f5);box-shadow:none}html.cb-dark .wbs-session-usage-copy:hover,html[data-theme="dark"] .wbs-session-usage-copy:hover,body[data-vscode-theme-name*="dark" i] .wbs-session-usage-copy:hover{background:var(--wb-bg-hover,#34363b);color:var(--wb-color-text-primary,#f2f3f5);box-shadow:0 2px 8px rgba(0,0,0,.25)}',
'html.cb-dark .wbs-session-usage-popover,html[data-theme="dark"] .wbs-session-usage-popover,body[data-vscode-theme-name*="dark" i] .wbs-session-usage-popover{background:color-mix(in srgb,var(--wb-bg-popover,#202126) 92%,transparent);color:var(--wb-color-text-primary,#f2f3f5);box-shadow:0 8px 22px rgba(0,0,0,.32)}',
+ 'html[data-wbs-theme-id="nebula"] .wbs-session-usage-copy:hover,html[data-wbs-theme-id="nebula"] .wbs-session-usage-copy:focus-visible{background:color-mix(in srgb,var(--wb-bg-popover,#1a1729) 88%,transparent);color:var(--wb-color-text-primary,#e8e5ff);box-shadow:0 3px 12px rgba(0,0,0,.32);backdrop-filter:blur(12px) saturate(1.12);-webkit-backdrop-filter:blur(12px) saturate(1.12)}',
'@media(max-width:620px){.wbs-session-usage-summary{padding-left:0;padding-right:0}.wbs-session-usage-main{gap:9px}.wbs-session-usage-popover{width:calc(100vw - 16px)}}',
'.wbs-daily-rings,.wbs-status-popover{--wbs-ring-growth:var(--wbs-primary-ink);--wbs-ring-rewards:var(--wbs-primary-ink);--wbs-ring-cat:var(--wbs-primary-ink);--wbs-tip-credit:var(--wbs-primary-ink);--wbs-liquid-fill:var(--wbs-primary);--wbs-liquid-bg:color-mix(in srgb,var(--wbs-primary) 12%,var(--wb-bg-secondary,#f6f7f8));--wbs-liquid-ink:color-mix(in srgb,var(--wbs-primary-ink) 72%,var(--wb-color-text-primary,#1f1f1f))}',
'.wbs-root.wbs-no-stash .wbs-stash-inline{display:none !important}',
@@ -15599,11 +15604,13 @@ if (typeof window !== 'undefined' && typeof document !== 'undefined') {
'.wbs-explore-inline.wbs-menu-closed .wbs-explore-pop{opacity:0;visibility:hidden;pointer-events:none;transform:translateX(-50%) translateY(6px)}',
/* 弹窗卡片:适配插件主题的毛玻璃;面板整体为默认箭头,仅选项 hover 变点击手型 */
'.wbs-explore-card{position:relative;padding:8px;border-radius:12px;background:color-mix(in srgb,var(--wb-bg-popover,#fff) 62%,transparent);backdrop-filter:blur(18px) saturate(1.3);-webkit-backdrop-filter:blur(18px) saturate(1.3);border:1px solid var(--wb-border-subtle,#ececec);box-shadow:0 12px 32px rgba(0,0,0,.18);color:var(--wb-color-text-primary,#1f1f1f);cursor:default}',
+ 'html[data-wbs-theme-id="nebula"] .wbs-explore-card{background:color-mix(in srgb,var(--wb-bg-popover,#1a1729) 88%,transparent);background-color:color-mix(in srgb,var(--wb-bg-popover,#1a1729) 88%,transparent);box-shadow:0 14px 36px rgba(0,0,0,.38)}',
'.wbs-explore-item{position:relative;display:flex;align-items:center;gap:8px;padding:9px 10px;border-radius:8px;font-size:12px;color:var(--wb-color-text-primary,#1f1f1f);line-height:1.4;cursor:pointer}',
'.wbs-explore-it{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}',
'.wbs-explore-item:hover{background:color-mix(in srgb,var(--wb-bg-hover,#f3f3f3) 76%,transparent)}',
/* 选项 hover:antd 风格 tooltip(半透明毛玻璃小气泡,出现在选项左侧,完全展示文字) */
'.wbs-explore-tip{position:absolute;right:calc(100% + 10px);top:50%;transform:translateY(-50%);display:block;width:max-content;padding:5px 11px;border-radius:8px;font-size:11px;line-height:1.35;white-space:normal;word-break:break-word;max-width:240px;color:var(--wb-color-text-primary,#1f1f1f);background:var(--wb-bg-popover,#fff);border:1px solid color-mix(in srgb,var(--wb-border-subtle,#ececec) 65%,transparent);box-shadow:0 6px 20px rgba(0,0,0,.16);opacity:0;visibility:hidden;transition:opacity .15s ease;pointer-events:none;z-index:2}',
+ 'html[data-wbs-theme-id="nebula"] .wbs-explore-tip{background:color-mix(in srgb,var(--wb-bg-popover,#1a1729) 94%,transparent);background-color:color-mix(in srgb,var(--wb-bg-popover,#1a1729) 94%,transparent);border-color:var(--wb-border-strong,#3a3160);box-shadow:0 8px 24px rgba(0,0,0,.4);backdrop-filter:blur(14px) saturate(1.12);-webkit-backdrop-filter:blur(14px) saturate(1.12)}',
/* 滚动条默认透明,滚动/悬停时才出现(内容多时可上下滚动,内容少完全展示无滚动条) */
'.wbs-explore-tip-body{display:block;max-height:240px;overflow-y:auto;scrollbar-width:thin;scrollbar-color:transparent transparent;white-space:normal;word-break:break-word}',
'.wbs-explore-tip-body::-webkit-scrollbar{width:6px}',
diff --git a/scripts/theme-patches.js b/scripts/theme-patches.js
index 1e3dbf0..908b8d3 100644
--- a/scripts/theme-patches.js
+++ b/scripts/theme-patches.js
@@ -490,6 +490,24 @@ module.exports = [
desc: '毛玻璃消息正文文字阴影(默认开启,可在主题面板关闭),不影响输入框或侧栏',
css: 'body[data-vscode-theme-name] .conversation-timeline .cr-document,body[data-vscode-theme-name] .conversation-timeline .cr-document *{text-shadow:0 1px 2px rgba(0,0,0,.65),0 0 6px rgba(0,0,0,.3) !important;}',
},
+ {
+ id: 'patch-102',
+ themeId: 'nebula',
+ desc: '最新版 mac teams 布局:滚动容器与内部 gridView 的不透明底色会盖住毛玻璃背景,改为透明并移除自身模糊层',
+ css: ':is(html.cb-dark,html[data-theme="dark"]) body[data-vscode-theme-name] .teams-container.is-mac>.teams-grid-scroll-content,:is(html.cb-dark,html[data-theme="dark"]) body[data-vscode-theme-name] .teams-container.is-mac>.teams-grid-scroll-content>[class*="_grid_"]>[class*="_gridView_"],body[data-vscode-theme-name="IDE Night"] .teams-container.is-mac>.teams-grid-scroll-content,body[data-vscode-theme-name="IDE Night"] .teams-container.is-mac>.teams-grid-scroll-content>[class*="_grid_"]>[class*="_gridView_"]{background:transparent !important;background-color:transparent !important;backdrop-filter:none !important;-webkit-backdrop-filter:none !important;}',
+ },
+ {
+ id: 'patch-103',
+ themeId: 'nebula',
+ desc: '毛玻璃主题下新版 mac teams 主页与会话页发送按钮 tooltip 包装层去掉背景色,避免输入框右侧出现多余色块',
+ css: ':is(html.cb-dark,html[data-theme="dark"]) body[data-vscode-theme-name] .teams-container.is-mac .cr-input-toolbar__send>span.cr-send-button__tooltip-wrapper,body[data-vscode-theme-name="IDE Night"] .teams-container.is-mac .cr-input-toolbar__send>span.cr-send-button__tooltip-wrapper{background:transparent !important;background-color:transparent !important;backdrop-filter:none !important;-webkit-backdrop-filter:none !important;}',
+ },
+ {
+ id: 'patch-104',
+ themeId: 'nebula',
+ desc: '毛玻璃主题下左侧模板切换按钮与代码块复制提示去掉官方背景色,避免出现实心色块',
+ css: ':is(html.cb-dark,html[data-theme="dark"]) body[data-vscode-theme-name] .teams-container.is-mac .industry-template-switcher__host>button.wb-button.wb-button--secondary,:is(html.cb-dark,html[data-theme="dark"]) body[data-vscode-theme-name] .teams-container.is-mac .industry-template-switcher__host>button.wb-button.wb-button--secondary:hover,:is(html.cb-dark,html[data-theme="dark"]) body[data-vscode-theme-name] .teams-container.is-mac .industry-template-switcher__host>button.wb-button.wb-button--secondary:focus-visible,:is(html.cb-dark,html[data-theme="dark"]) body[data-vscode-theme-name] .teams-container.is-mac .industry-template-switcher__host>button.wb-button.wb-button--secondary:active,:is(html.cb-dark,html[data-theme="dark"]) body[data-vscode-theme-name] .cr-code-like-box__header>span.cr-code-block__copy-tooltip,:is(html.cb-dark,html[data-theme="dark"]) body[data-vscode-theme-name] .cr-code-like-box__header>span.cr-code-block__copy-tooltip:hover,body[data-vscode-theme-name="IDE Night"] .teams-container.is-mac .industry-template-switcher__host>button.wb-button.wb-button--secondary,body[data-vscode-theme-name="IDE Night"] .teams-container.is-mac .industry-template-switcher__host>button.wb-button.wb-button--secondary:hover,body[data-vscode-theme-name="IDE Night"] .teams-container.is-mac .industry-template-switcher__host>button.wb-button.wb-button--secondary:focus-visible,body[data-vscode-theme-name="IDE Night"] .teams-container.is-mac .industry-template-switcher__host>button.wb-button.wb-button--secondary:active,body[data-vscode-theme-name="IDE Night"] .cr-code-like-box__header>span.cr-code-block__copy-tooltip,body[data-vscode-theme-name="IDE Night"] .cr-code-like-box__header>span.cr-code-block__copy-tooltip:hover{background:transparent !important;background-color:transparent !important;backdrop-filter:none !important;-webkit-backdrop-filter:none !important;box-shadow:none !important;}',
+ },
/* 原 patch-82(AI 端快捷短语弹层 z-index 抬升)已移入 inject.js 常驻样式:
theme-patches 仅在非默认主题时注入,默认浅色主题下会失效;层级修复不依赖主题,随注入脚本常驻更可靠。 */
];
diff --git a/test/conversation-usage.test.js b/test/conversation-usage.test.js
index 6c7115d..9e9fec7 100644
--- a/test/conversation-usage.test.js
+++ b/test/conversation-usage.test.js
@@ -63,6 +63,7 @@ test('conversation usage UI uses a body-fixed mount, bottom spacer and message s
assert.doesNotMatch(source, /悬浮查看明细|Hover for details/);
assert.doesNotMatch(source, /el\('strong', 'wbs-session-usage/);
assert.match(source, /wbs-session-usage-popover\{[^}]*background:color-mix/);
+ assert.match(source, /html\[data-wbs-theme-id="nebula"\] \.wbs-session-usage-copy:hover,[^}]*\.wbs-session-usage-copy:focus-visible\{[^}]*background:color-mix\(in srgb,var\(--wb-bg-popover,/);
assert.match(source, /wbs-session-usage-summary\{[^}]*z-index:20/);
assert.match(source, /wbs-session-usage-popover\{[^}]*z-index:21/);
assert.match(source, /wbs-session-usage-summary\{[^}]*border:0[^}]*background:transparent/);
diff --git a/test/credit-history-sync.test.js b/test/credit-history-sync.test.js
index 964afca..dbb2de6 100644
--- a/test/credit-history-sync.test.js
+++ b/test/credit-history-sync.test.js
@@ -1,5 +1,8 @@
'use strict';
const test = require('node:test');
+const fs = require('node:fs');
+const os = require('node:os');
+const path = require('node:path');
const assert = require('node:assert/strict');
const { createCreditHistorySync, historyRange } = require('../scripts/credit-history-sync.js');
const { fetchUsageSinceAnchor } = require('../scripts/credit-request-usage.js');
@@ -89,6 +92,24 @@ test('historical credit results retain model totals when the official usage rows
});
});
+test('legacy cache without model details is refreshed after model normalization changes', async t => {
+ const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'wbs-credit-model-cache-'));
+ t.after(() => fs.rmSync(dir, { recursive: true, force: true }));
+ const cacheFile = path.join(dir, 'cache.json');
+ fs.writeFileSync(cacheFile, JSON.stringify({ version: 1, daily: [{
+ uid: 'one', date: '2026-09-12', used: 1, count: 1, queriedAt: now.getTime(), final: true,
+ }] }));
+ let calls = 0;
+ const sync = createCreditHistorySync({ cacheFile, now: () => now, getAccessToken: async () => 'test', fetchUsage: async () => {
+ calls++;
+ return { records: [{ usageDate: '2026-09-12', credit: 1, requestId: 'new', model: 'Recovered model' }] };
+ } });
+ sync.start({ accounts: [{ uid: 'one' }], days: 1 });
+ const result = await settle(sync);
+ assert.equal(calls, 1);
+ assert.deepEqual(result.daily[0].models, { 'Recovered model': { used: 1, count: 1 } });
+});
+
test('failed account contributes no cached values or false zero records', async () => {
const sync = createCreditHistorySync({ now: () => now, getAccessToken: async uid => uid,
fetchUsage: async o => { if (o.accessToken === 'bad') throw Error('timeout'); return { records: [] }; }
diff --git a/test/credit-request-usage.test.js b/test/credit-request-usage.test.js
index 237f72a..da66cc4 100644
--- a/test/credit-request-usage.test.js
+++ b/test/credit-request-usage.test.js
@@ -47,6 +47,15 @@ test('normalizes only non-sensitive fields from official usage records', () => {
assert.equal(Object.prototype.hasOwnProperty.call(row, 'inputTrunc'), false);
});
+test('normalizes model aliases returned by billing API variants', () => {
+ const byName = normalizeUsageRow({ ...usageRow('req-name', '2026-08-28 09:10:11'), model: '', modelName: 'claude-3-7-sonnet' });
+ const byId = normalizeUsageRow({ ...usageRow('req-id', '2026-08-28 09:10:10'), model: '', model_id: 'deepseek-v3.1' });
+ const nested = normalizeUsageRow({ ...usageRow('req-nested', '2026-08-28 09:10:09'), model: { id: 'gemini-2.5-pro', name: 'Gemini 2.5 Pro' } });
+ assert.equal(byName.model, 'claude-3-7-sonnet');
+ assert.equal(byId.model, 'deepseek-v3.1');
+ assert.equal(nested.model, 'Gemini 2.5 Pro');
+});
+
test('requests official pages newest-first and stops at the previous complete-sync anchor', async () => {
const calls = [];
const firstPage = Array.from({ length: 100 }, (_, index) =>
diff --git a/test/theme-patches.test.js b/test/theme-patches.test.js
index ee8951b..e7c7985 100644
--- a/test/theme-patches.test.js
+++ b/test/theme-patches.test.js
@@ -25,3 +25,33 @@ test('WorkBuddy widget cards use translucent theme surfaces', () => {
assert.match(patch.css, /\.cr-widget-header\{[^}]*background-color:color-mix/);
assert.doesNotMatch(patch.css, /WBS_PROFILE|workbuddy-ai/);
});
+
+test('nebula makes the latest mac teams grid containers transparent', () => {
+ const patch = patches.find((item) => item && item.id === 'patch-102');
+ assert.ok(patch, 'patch-102 must be registered');
+ assert.equal(patch.themeId, 'nebula');
+ assert.match(patch.css, /\.teams-container\.is-mac\s*>\s*\.teams-grid-scroll-content(?:,|\{)/);
+ assert.match(patch.css, /\.teams-grid-scroll-content\s*>\s*\[class\*="_grid_"\]\s*>\s*\[class\*="_gridView_"\]\{/);
+ assert.match(patch.css, /background:transparent !important/);
+ assert.match(patch.css, /background-color:transparent !important/);
+ assert.match(patch.css, /backdrop-filter:none !important/);
+});
+
+test('nebula removes the mac teams send tooltip wrapper background', () => {
+ const patch = patches.find((item) => item && item.id === 'patch-103');
+ assert.ok(patch, 'patch-103 must be registered');
+ assert.equal(patch.themeId, 'nebula');
+ assert.match(patch.css, /\.teams-container\.is-mac \.cr-input-toolbar__send>span\.cr-send-button__tooltip-wrapper/);
+ assert.match(patch.css, /background:transparent !important/);
+ assert.match(patch.css, /background-color:transparent !important/);
+});
+
+test('nebula removes backgrounds from the template switcher and code copy tooltip', () => {
+ const patch = patches.find((item) => item && item.id === 'patch-104');
+ assert.ok(patch, 'patch-104 must be registered');
+ assert.equal(patch.themeId, 'nebula');
+ assert.match(patch.css, /\.industry-template-switcher__host>button\.wb-button\.wb-button--secondary/);
+ assert.match(patch.css, /\.cr-code-like-box__header>span\.cr-code-block__copy-tooltip/);
+ assert.match(patch.css, /background:transparent !important/);
+ assert.match(patch.css, /box-shadow:none !important/);
+});
diff --git a/test/token-stats.test.js b/test/token-stats.test.js
index cfcb9c6..3e3d9df 100644
--- a/test/token-stats.test.js
+++ b/test/token-stats.test.js
@@ -5,6 +5,7 @@ const assert = require('node:assert/strict');
const fs = require('fs');
const os = require('os');
const path = require('path');
+const vm = require('vm');
const { scanTokenStats, scanTokenStatsCached, dateBounds, tokenStatsCacheReady } = require('../scripts/token-stats.js');
test('scans usage metadata without reading message semantics into the result', () => {
@@ -68,6 +69,22 @@ test('daily breakdown keeps account and model dimensions without changing totals
assert.deepEqual(scanTokenStatsCached(root, { now, days: 1, account: 'b' }).dailyBreakdown.map(row => row.account), ['b']);
});
+test('credit model trend ignores account-total records without a model dimension', () => {
+ const source = fs.readFileSync(path.join(__dirname, '..', 'scripts', 'inject.js'), 'utf8');
+ const start = source.indexOf('function usageTrendGroups');
+ const end = source.indexOf('\n function renderUsageBreakdown', start);
+ const usageTrendGroups = vm.runInNewContext('(' + source.slice(start, end).trim() + ')');
+ const groups = usageTrendGroups([{ title: '2026-09-20' }], [
+ { day: '2026-09-20', account: 'account-a', value: 1365.17 },
+ { day: '2026-09-20', model: 'kimi-k3-1', value: 1291.88 },
+ { day: '2026-09-20', model: 'deepseek-v4.1-flash', value: 73.29 },
+ ], 'model', { 'kimi-k3-1': 'kimi-k3-1', 'deepseek-v4.1-flash': 'deepseek-v4.1-flash' });
+ assert.deepEqual(JSON.parse(JSON.stringify(groups.map(group => [group.key, group.total]))), [
+ ['kimi-k3-1', 1291.88],
+ ['deepseek-v4.1-flash', 73.29],
+ ]);
+});
+
test('date range is limited to 90 days', () => {
const now = Date.parse('2026-09-11T10:00:00Z');
assert.throws(() => dateBounds(now, { from: '2026-01-01', until: '2026-09-11' }), /不能超过 90 天/);
diff --git a/test/update-layout.test.js b/test/update-layout.test.js
index 6c297f9..d480ea2 100644
--- a/test/update-layout.test.js
+++ b/test/update-layout.test.js
@@ -996,6 +996,8 @@ test('quick-phrase layering does not reposition WorkBuddy native chat toolbar',
const script = read('inject.js');
assert.match(script, /\.wbs-explore-inline\.wbs-stash-inline-inline\{position:relative;z-index:99999\}/);
assert.match(script, /\.wbs-explore-pop\{[^}]*z-index:2147483647/);
+ assert.match(script, /html\[data-wbs-theme-id="nebula"\] \.wbs-explore-card\{[^}]*background:color-mix\(in srgb,var\(--wb-bg-popover/);
+ assert.match(script, /html\[data-wbs-theme-id="nebula"\] \.wbs-explore-tip\{[^}]*background:color-mix\(in srgb,var\(--wb-bg-popover/);
assert.doesNotMatch(script, /_chatMessageBottomToolbarWrapper_\}\{position:relative;z-index:68/);
assert.doesNotMatch(script, /_chatMessageBottomToolbar_\}\{position:relative;z-index:69/);
assert.doesNotMatch(script, /_chatMessageBottomToolbarItem_\}\{position:relative;z-index:70/);