WorkBuddy、CodeBuddy 桌面端增强助手:签到猫猫旅行成长计划查询、多账号独立备份、点切即用;免打扰模式让 AI 无人值守跑长任务;跨账号会话迁移、异常中断自动续接;暂存/快捷提示词;毛玻璃主题与更多实用功能。
fix: force token refresh when account panel opens
[email protected]4244782220ef
diff --git a/scripts/daemon.js b/scripts/daemon.jsindex 59720d3..6df1e92 100644--- a/scripts/daemon.js+++ b/scripts/daemon.js@@ -487,9 +487,9 @@ const primaryAccountStore = createPrimaryAccountStore(DATA_DIR, (uid) => fs.exis// 时 launcher 发现不到已在监听的 daemon,误选备用 UI 端口后失败退出。// launcher 的 httpGet 预算同步对齐到 HTTP_GET_TIMEOUT_MS;Windows app.asar// 页面归属与 CDP 目标等待窗口也同步修复。-// 1.2.31:打开账号面板时按日保活全部备份账号 token,刷新完成后更新账号快照。-const DAEMON_VERSION = '1.2.31';-const DAEMON_BUILD_ID = 'release-1.2.31-20261012-panel-token-refresh';+// 1.2.32:打开账号面板时强制刷新全部备份账号 token,刷新完成后更新账号快照。+const DAEMON_VERSION = '1.2.32';+const DAEMON_BUILD_ID = 'release-1.2.32-20261012-panel-token-force-refresh';const usageReporter = createUsageReporter({ profile: PROFILE.id, version: DAEMON_VERSION });configureAutomationRuntime({version: DAEMON_VERSION, profileId: PROFILE.id, platform: process.platform});const automationDiscovery = createAutomationDiscovery({@@ -4157,7 +4157,7 @@ async function refreshAccountBackupToken(uid, options = {}) {const lastRefreshTime = normalizeTokenTimestamp(auth.lastRefreshTime);const dailyDue = options.dailyKeepalive === true &&(lastRefreshTime === null || now - lastRefreshTime >= TOKEN_REFRESH_DAY_MS);- if (!dailyDue && !shouldRefreshAccessToken(auth, now)) return { root, skipped: true };+ if (options.force !== true && !dailyDue && !shouldRefreshAccessToken(auth, now)) return { root, skipped: true };const result = await refreshAuthToken(auth, { apiHost: PROFILE.apiHost, fetchImpl: globalThis.fetch, now });if (!result.ok) {@@ -4199,7 +4199,7 @@ async function refreshAllAccountTokensOnPanelOpen() {const index = next++;const uid = accounts[index].uid;try {- const result = await refreshAccountBackupToken(uid, { dailyKeepalive: true });+ const result = await refreshAccountBackupToken(uid, { dailyKeepalive: true, force: true });results[index] = { refreshed: result.refreshed === true, skipped: result.skipped === true, failed: !!result.error };} catch (_) {results[index] = { refreshed: false, skipped: false, failed: true };diff --git a/test/daemon-status-nonblocking.test.js b/test/daemon-status-nonblocking.test.jsindex 5953433..a8dce23 100644--- a/test/daemon-status-nonblocking.test.js+++ b/test/daemon-status-nonblocking.test.js@@ -114,7 +114,7 @@ test('daemon behavior change ships a version and build bump so stale daemons areconst buildId = daemonSource.match(/const DAEMON_BUILD_ID = '([^']+)'/);assert.ok(version && buildId, 'DAEMON_VERSION/DAEMON_BUILD_ID not found');assert.notEqual(version[1], '1.2.28', 'DAEMON_VERSION must be incremented for a daemon behavior change');- assert.match(buildId[1], /^release-1\.2\.31-/, 'DAEMON_BUILD_ID must be rewritten for the new build');+ assert.match(buildId[1], /^release-1\.2\.32-/, 'DAEMON_BUILD_ID must be rewritten for the new build');});test('launcher httpGet uses a budget aligned with the daemon probe cost', () => {diff --git a/test/token-refresh-panel.test.js b/test/token-refresh-panel.test.jsindex 4ec1846..e1d09b5 100644--- a/test/token-refresh-panel.test.js+++ b/test/token-refresh-panel.test.js@@ -10,7 +10,8 @@ const inject = fs.readFileSync(path.join(__dirname, '..', 'scripts', 'inject.js'test('panel token refresh endpoint keeps every backup account alive', () => {assert.match(daemon, /async function refreshAllAccountTokensOnPanelOpen\(\)/);- assert.match(daemon, /refreshAccountBackupToken\(uid, \{ dailyKeepalive: true \}\)/);+ assert.match(daemon, /refreshAccountBackupToken\(uid, \{ dailyKeepalive: true, force: true \}\)/);+ assert.match(daemon, /options\.force !== true && !dailyDue && !shouldRefreshAccessToken/);const routeStart = daemon.indexOf("p === '/api/accounts/refresh-tokens'");const routeEnd = daemon.indexOf("if (req.method === 'GET' && p === '/api/accounts')", routeStart);assert.ok(routeStart >= 0 && routeEnd > routeStart);