Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
fix(desktop): 重启提示不再列出伙伴未启用的任务
Dash52fbbe654dfb
diff --git a/apps/desktop/src/main/localDb/__tests__/sessionActiveTurn.test.ts b/apps/desktop/src/main/localDb/__tests__/sessionActiveTurn.test.tsindex 53a1595687..c37518f758 100644--- a/apps/desktop/src/main/localDb/__tests__/sessionActiveTurn.test.ts+++ b/apps/desktop/src/main/localDb/__tests__/sessionActiveTurn.test.ts@@ -79,6 +79,11 @@ describe('sessionActiveTurn', () => {CREATE INDEX idx_messages_active_error_tail ON messages (session_id, created_at)WHERE role = 'error' AND rewind_at IS NULL;+ CREATE TABLE bot_profiles (+ id TEXT PRIMARY KEY,+ status TEXT NOT NULL DEFAULT 'active'+ );+CREATE TABLE bot_session_links (id TEXT PRIMARY KEY,bot_id TEXT NOT NULL,@@ -566,6 +571,7 @@ describe('sessionActiveTurn', () => {const { listInterruptedPendingSessionIds } = await import('../sessionActiveTurn.js');const client = createTestDbClient();const startedAt = Date.now() - 10_000;+ await client.exec("INSERT INTO bot_profiles (id, status) VALUES ('bot-1', 'active'), ('bot-paused', 'paused')");await seedSession(client, 's-desktop', { startedAt });for (const role of ['canonical', 'delegation', 'routine', 'channel', 'history', 'group', 'thread']) {await seedSession(client, `bot-${role}`, { startedAt, source: 'bot' });@@ -574,6 +580,12 @@ describe('sessionActiveTurn', () => {[`link-${role}`, 'bot-1', `bot-${role}`, role, startedAt],);}+ // 伙伴未启用时继续会被 botSessionInputGuard 拒绝,不提示。+ await seedSession(client, 'bot-paused-canonical', { startedAt, source: 'bot' });+ await client.exec(+ 'INSERT INTO bot_session_links (id, bot_id, session_id, role, created_at) VALUES (?, ?, ?, ?, ?)',+ ['link-paused', 'bot-paused', 'bot-paused-canonical', 'canonical', startedAt],+ );// 没有伙伴关联的 bot 来源会话无处打开,不提示。await seedSession(client, 'bot-unlinked', { startedAt, source: 'bot' });diff --git a/apps/desktop/src/main/localDb/sessionActiveTurn.ts b/apps/desktop/src/main/localDb/sessionActiveTurn.tsindex 65d20f5055..f49503be94 100644--- a/apps/desktop/src/main/localDb/sessionActiveTurn.ts+++ b/apps/desktop/src/main/localDb/sessionActiveTurn.ts@@ -57,7 +57,7 @@ import {getSessionInterruptionBootAt,setSessionInterruptionBootAtForTests,} from './sessionInterruptionBoot';-import { botSessionLinks, messages, sessions } from './schema';+import { botProfiles, botSessionLinks, messages, sessions } from './schema';import { createLogger } from '../logger';import { DESKTOP_TASK_LIST_SESSION_SOURCES } from '../../shared/sessionSource.js';import { boundedSummary } from '../maker-ipc/recoveryCoordinator.js';@@ -392,13 +392,15 @@ export async function listInterruptedPendingRows(? or(listedSource,// 能走普通「继续」路径的伙伴任务:主对话、委派任务有自己的页面,例行与渠道- // 专线列在普通任务列表里。history 只读(botSessionInputGuard 拒绝发送),群与+ // 专线列在普通任务列表里。history 只读、伙伴未启用(botSessionInputGuard 拒绝发送),群与// 私聊话题专线是隐藏专线,由群聊 / 私聊收口,都不提示。and(eq(sessions.source, 'bot'),sql`EXISTS (SELECT 1 FROM ${botSessionLinks}+ JOIN ${botProfiles} ON ${botProfiles.id} = ${botSessionLinks.botId}WHERE ${botSessionLinks.sessionId} = ${sessions.id}- AND ${botSessionLinks.role} IN ('canonical', 'delegation', 'routine', 'channel'))`,+ AND ${botSessionLinks.role} IN ('canonical', 'delegation', 'routine', 'channel')+ AND ${botProfiles.status} = 'active')`,),): listedSource,