Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
Merge origin/main before pushing Cindy Make
MagicLizi77209ed50171
diff --cc apps/desktop/src/main/devStartupStatus.tsindex 58e69e82ee,58e69e82ee..ea9e184b80--- a/apps/desktop/src/main/devStartupStatus.ts+++ b/apps/desktop/src/main/devStartupStatus.ts@@@ -70,6 -70,6 +70,25 @@@ let trackedInstance: { filePath: stringlet mainWindowReady = false;let applicationReady = false;let startupSettled = false;++let startupResult: boolean | undefined;++const startupResultListeners = new Set<(ready: boolean) => void>();++/** Local version handoff consumes the existing auth + database + window readiness contract. */++export function observeDesktopStartupResult(listener: (ready: boolean) => void): () => void {++ if (startupResult !== undefined) listener(startupResult);++ else startupResultListeners.add(listener);++ return () => startupResultListeners.delete(listener);++}++function publishDesktopStartupResult(ready: boolean): void {++ startupResult = ready;++ for (const listener of startupResultListeners) {++ try {++ listener(ready);++ } catch {++ // A diagnostic observer must never affect startup.++ }++ }++ startupResultListeners.clear();++}function atomicWriteJson(filePath: string, value: unknown): void {atomicWriteFileSync(filePath, `${JSON.stringify(value)}\n`);@@@ -132,6 -132,6 +151,7 @@@ export async function beginDesktopDevInmainWindowReady = false;applicationReady = false;startupSettled = false;++ startupResult = undefined;const pid = options.pid ?? process.pid;const startedAtMs = options.startedAtMs ?? Date.now();const record: DesktopDevInstanceRecord = {@@@ -204,6 -204,6 +224,7 @@@ function settleDesktopDevReadyIfPossiblupdateExternalStartupStatus('ready', {instance: trackedInstance?.record ?? null,});++ publishDesktopStartupResult(true);}/** Record that the main BrowserWindow can render, without claiming the database is ready. */@@@ -287,4 -287,4 +308,5 @@@ export function markDesktopDevStartupFaconst failure = { code, message, ...(detail ? { detail } : {}) };updateTrackedInstance('failed', failure);updateExternalStartupStatus('failed', { code, message, ...(detail ? { detail } : {}) });++ publishDesktopStartupResult(false);}diff --cc apps/desktop/src/main/relaunchBusyActivityIpc.tsindex e71d342f37,e71d342f37..e98aa0b5b1--- a/apps/desktop/src/main/relaunchBusyActivityIpc.ts+++ b/apps/desktop/src/main/relaunchBusyActivityIpc.ts@@@ -20,6 -20,6 +20,14 @@@ import { assertTrustedAppRendererEventexport const RELAUNCH_BLOCKING_ACTIVITY_CHANNEL = 'update-relaunch:blocking-activity';const log = createLogger('relaunch-activity');++let currentSources: (() => RelaunchBusyActivitySources) | undefined;++++/** Shared by local version switching; unknown activity must not permit a restart. */++export async function readRelaunchBlockingActivity() {++ return currentSources++ ? evaluateRelaunchBusyActivity(currentSources())++ : { busy: true, reasons: ['not-ready'] };++}/*** 横幅延后轮询会反复问同一条探针,但不能把每次 busy 都打成「manual relaunch」INFO。@@@ -39,6 -39,6 +47,7 @@@ function isSilentBusyProbe(payload: unkexport function registerRelaunchBusyActivityIpc(resolveSources: () => RelaunchBusyActivitySources,): void {++ currentSources = resolveSources;// **幂等注册**,不是防御性冗余:调用点(bootstrap-electron 的 registerMakerIpcsAfterSplash)// 在它之后还有会抛的初始化,而那个 try 的 catch 明写「下次 splash retry 再尝试」,重试时// makerIpcsRegistered 仍是 false —— 于是这行会被执行第二次。ipcMain.handle 对同一 channeldiff --cc apps/desktop/src/renderer/__tests__/mainListModel.test.tsindex 2c5d13f5e7,d0683d1a70..2e8e3292e5--- a/apps/desktop/src/renderer/__tests__/mainListModel.test.ts+++ b/apps/desktop/src/renderer/__tests__/mainListModel.test.ts@@@ -71,7 -71,7 +71,9 @@@ function labels(entries: MainListEntry[? `auto:${entry.group.title}`: entry.kind === 'bot-group'? `bot:${entry.bot.displayName}`-- : `s:${entry.session.title}`,++ : entry.kind === 'cindy-make-group'++ ? 'cindy-make-group'++ : `s:${entry.session.title}`,);}diff --cc apps/desktop/src/renderer/components/chat/MessageStream.tsxindex 983e0fe731,ca983cacc9..b53ddbd0bb--- a/apps/desktop/src/renderer/components/chat/MessageStream.tsx+++ b/apps/desktop/src/renderer/components/chat/MessageStream.tsx@@@ -42,6 -42,6 +42,7 @@@ importmakerChatStore,type HistoryChatMessage,} from '@/lib/makerChatStore';++import { isCindyMakeCompletionMessage, isCindyMakePreparationMessage } from '@/lib/cindyMakeComposer';import { getDataOwnerGeneration } from '@/contexts/dataOwnerGeneration';import { createPortal } from 'react-dom';import { GitFork } from 'lucide-react';@@@ -425,6 -425,6 +426,9 @@@ interface MessageStreamProps/** Bot read position captured before entry marks the conversation read. */botUnreadBoundaryAt?: number | null;messages: ChatMessage[];++ /** This task's preparation card is shown in the composer, including after history reload. */++ cindyMakeSessionId?: string;++ cindyMakeCompletionInComposer?: boolean;historyLoaded: boolean;/** The task shell remains, but all prior message content was intentionally cleared. */historyCleared?: boolean;@@@ -1494,6 -1494,6 +1498,9 @@@ export function buildRenderItemsbotSessionId?: string;/** Reuse image Markdown extraction for completed assistant messages across stream batches. */markdownImageTargetCache?: MarkdownImageTargetCache;++ /** Keep the stored preparation report out of its own task's visible timeline. */++ cindyMakeSessionId?: string;++ cindyMakeCompletionInComposer?: boolean;},): {items: RenderItem[];@@@ -1501,7 -1501,7 +1508,12 @@@} {// Modal-only Cindy Make cards are transient UI state. They stay in the// shared store for the dialog to observe, but never enter the chat timeline.-- allMessages = allMessages.filter((message) => message.systemCardData?.modalOnly !== true);++ allMessages = allMessages.filter(++ (message) =>++ message.systemCardData?.modalOnly !== true &&++ !(opts?.cindyMakeCompletionInComposer && isCindyMakeCompletionMessage(message)) &&++ !isCindyMakePreparationMessage(message, opts?.cindyMakeSessionId),++ );if (opts?.botSessionId) {allMessages = placeBotTaskCardsAfterIntroduction(allMessages, (message) => {if (message.role === 'user') {@@@ -2572,6 -2572,6 +2584,8 @@@ export function MessageStream(simplifiedBotConversation = false,botUnreadBoundaryAt = null,messages,++ cindyMakeSessionId,++ cindyMakeCompletionInComposer,historyLoaded,historyCleared = false,taskUpdates,@@@ -2828,6 -2828,6 +2842,8 @@@workingDir,botSessionId: simplifiedBotConversation ? sessionId : undefined,markdownImageTargetCache: markdownImageTargetCacheRef.current,++ cindyMakeSessionId,++ cindyMakeCompletionInComposer,});if (historyView && historySnapshot?.ready) {const results = new Map(built.singleResultMap);@@@ -2850,6 -2850,6 +2866,8 @@@workingDir,botSessionId: simplifiedBotConversation ? sessionId : undefined,markdownImageTargetCache: markdownImageTargetCacheRef.current,++ cindyMakeSessionId,++ cindyMakeCompletionInComposer,});for (const [key, value] of chunk.singleResultMap) results.set(key, value);return groupWorkRuns(chunk.items, isSessionStreaming);@@@ -2897,6 -2897,6 +2915,8 @@@};}, [displayMessages,++ cindyMakeSessionId,++ cindyMakeCompletionInComposer,historyView,historySnapshot,historyLiveMessages,diff --cc apps/desktop/src/renderer/features/cc-agent/lib/mainListModel.tsindex 46ff729a9c,5230498548..a959c7f7ad--- a/apps/desktop/src/renderer/features/cc-agent/lib/mainListModel.ts+++ b/apps/desktop/src/renderer/features/cc-agent/lib/mainListModel.ts@@@ -229,21 -233,15 +229,28 @@@ export function sortSessionsForMainListsortBy: FilterSortBy,ctx: MainListPriorityContext = EMPTY_PRIORITY_CONTEXT,): Session[] {- // Compute numeric keys once per call, never retain them across session updates.- return sessions.map((session) => ({- session,- rank: sortBy === 'priority' ? sessionPriorityRank(session, ctx) : 0,- time: sortBy === 'priority' ? sessionPriorityRecencyMs(session, ctx)- : sortBy === 'created' ? sessionCreatedMs(session) : sessionActivityMs(session),- })).sort((a, b) => a.rank - b.rank || b.time - a.time ||- (sortBy === 'created' ? a.session.id.localeCompare(b.session.id) : 0))+ if (sortBy === 'priority') {+ return sessions+ .slice()+ .sort(+ (a, b) =>+ sessionPriorityRank(a, ctx) - sessionPriorityRank(b, ctx) ||+ sessionPriorityRecencyMs(b, ctx) - sessionPriorityRecencyMs(a, ctx),+ );+ }+ if (sortBy === 'created') {+ return sessions- .slice()- .sort((a, b) => sessionCreatedMs(b) - sessionCreatedMs(a) || a.id.localeCompare(b.id));++ .map((session, index) => ({ session, index, createdAt: sessionCreatedMs(session) }))++ .sort(++ (a, b) =>++ b.createdAt - a.createdAt || a.session.id.localeCompare(b.session.id) || a.index - b.index,++ )++ .map(({ session }) => session);+ }- return sessions.slice().sort((a, b) => sessionActivityMs(b) - sessionActivityMs(a));++ return sessions++ .map((session, index) => ({ session, index, activityAt: sessionActivityMs(session) }))++ .sort((a, b) => b.activityAt - a.activityAt || a.index - b.index)+ .map(({ session }) => session);}export interface BuildMainListEntriesInput {@@@ -515,10 -455,10 +520,14 @@@ export function splitEntriesByDevicepriorityContext?: MainListPriorityContext;} = {},): MainListDeviceSection[] {- // 先把跨设备对话组拆开(组内成员可能来自不同设备)。+ // 先把跨设备会话组拆开,再按每个片段的成员计算排序和设备聚合灯。const flattened: MainListEntry[] = [];for (const entry of entries) {- if (entry.kind !== 'dialogue-group' && entry.kind !== 'cindy-make-group') {- if (entry.kind !== 'dialogue-group' && entry.kind !== 'bot-group') {++ if (++ entry.kind !== 'dialogue-group' &&++ entry.kind !== 'cindy-make-group' &&++ entry.kind !== 'bot-group'++ ) {flattened.push(entry);continue;}@@@ -530,7 -470,9 +539,9 @@@else byDevice.set(key, [s]);}for (const sessions of byDevice.values()) {- flattened.push({ kind: entry.kind, sessions });- flattened.push(entry.kind === 'bot-group'- ? { kind: 'bot-group', bot: { ...entry.bot, sessions } }- : { kind: 'dialogue-group', sessions });++ if (entry.kind === 'bot-group')++ flattened.push({ kind: 'bot-group', bot: { ...entry.bot, sessions } });++ else flattened.push({ kind: entry.kind, sessions });}}diff --cc apps/desktop/src/renderer/features/cc-agent/lib/sessionSourceLabel.tsindex 0e596c565f,948e5dc9a8..2cee914cfb--- a/apps/desktop/src/renderer/features/cc-agent/lib/sessionSourceLabel.ts+++ b/apps/desktop/src/renderer/features/cc-agent/lib/sessionSourceLabel.ts@@@ -22,20 -17,11 +22,21 @@@ importexport function buildSessionSourceLabelMap(sessions: readonly Session[],allKnownProjects: readonly ProjectNode[],- dialogueLabel: string,++ dialogueLabel = '',+ cindyMakeLabel?: string,): Map<string, string> {const nameByKey = new Map(allKnownProjects.map((p) => [p.projectKey, p.displayName]));const map = new Map<string, string>();for (const s of sessions) {+ if (isCindyMakeFamilySource(s.source) && cindyMakeLabel) {+ map.set(s.id, cindyMakeLabel);+ continue;+ }- if (s.workspaceKind === 'dialogue') {++ if (s.workspaceKind === 'dialogue' && dialogueLabel) {+ map.set(s.id, dialogueLabel);+ continue;+ }+ if (s.workspaceKind === 'dialogue') continue;const key = projectIdentityKeyForSession(s);const name = key ? nameByKey.get(key) : undefined;if (name) {diff --cc apps/desktop/src/renderer/features/cc-agent/sidebar/sections/ProjectsSection.tsxindex 62b420d6aa,9ef2a111cd..2f2ffa31ed--- a/apps/desktop/src/renderer/features/cc-agent/sidebar/sections/ProjectsSection.tsx+++ b/apps/desktop/src/renderer/features/cc-agent/sidebar/sections/ProjectsSection.tsx@@@ -491,6 -516,24 +502,23 @@@ export function ProjectsSection([naturalPriorityContext, hold],);+ // 聚合灯(2026-08 用户反馈:未读点只亮在最底层会话行,项目层与设备层没有+ // 灯,多设备下找未读要逐层展开翻找)——项目行 / 对话组行 / 设备段头都从+ // 各自下方**实际渲染的行集合**聚合灯语(sessionLampAggregation,rail 同源):+ // running → 图标呼吸橙;未读 → AttentionDot(红 error > 蓝 awaiting > 绿 done)。+ // remoteActivityRevision 已在上方订阅,依赖注释同 priorityContext。+ const lampAgg = useCallback(+ (list: readonly Session[]): SessionLampAggregate =>+ aggregateSessionLamps(list, {+ runningSessionIds,+ notifications,+ attentionKinds,+ urgentSessionIds: urgentSet,+ }),+ // eslint-disable-next-line react-hooks/exhaustive-deps -- remoteActivityRevision 代表 remoteLampOf 读到的整表内容+ [runningSessionIds, notifications, attentionKinds, urgentSet, remoteActivityRevision],+ );+ const sortingPriorityContext = filter.sortBy === 'priority' ? priorityContext : undefined;-// starting 只让位给真实 in-flight:本地 isRunning(见 useStartingSessionIds),// 远程 running / needs-interaction。终态 attention 不再吸收 —— 旧终态会误伤// 新发送,新终态又要代次才能和旧的区分,两边补丁会来回打。没经过 running@@@ -694,20 -721,16 +728,19 @@@// 组层 = 项目行 + 自动任务组 + 「对话」组行。项目侧复用 ProjectNode 折叠状态,// 自动任务组复用 owner-scoped 持久化状态,对话组沿用本地显示偏好。const hasGroupLayer = mixedEntries.some((entry) => entry.kind !== 'session');- // 当前可见的对话/伙伴组 key:设备分组下按段记忆;否则保留单段 key。+ // 对话与 Cindy Make 分组按各自命名空间、设备段记忆折叠。// 「收起/展开所有分组」只作用于这些可见 key,不动其它模式下的记忆。- const visibleDialogueGroupKeys = useMemo<string[]>(() => {- const keysFor = (entries: readonly MainListEntry[], sectionKey: string) =>+ const visibleSessionGroupKeys = useMemo<string[]>(() => {+ const keysFor = (entries: readonly MainListEntry[], scope: string) =>- entries.flatMap((entry) =>- entry.kind === 'dialogue-group'- ? [scope]- : entry.kind === 'cindy-make-group'- ? [`${CINDY_MAKE_GROUP_KEY}:${scope}`]- : [],- );+ entries.flatMap((entry) => {- if (entry.kind === 'dialogue-group') return [sectionKey];- if (entry.kind === 'bot-group') return [botGroupKey(entry.bot.botId, sectionKey)];++ if (entry.kind === 'dialogue-group') return [scope];++ if (entry.kind === 'cindy-make-group') return [`${CINDY_MAKE_GROUP_KEY}:${scope}`];++ if (entry.kind === 'bot-group') return [botGroupKey(entry.bot.botId, scope)];+ return [];+ });- if (!deviceGroupingActive) return keysFor(visibleMixedEntries, DIALOGUE_GROUP_ALL_KEY);+ if (!deviceGroupingActive) {+ return keysFor(visibleMixedEntries, DIALOGUE_GROUP_ALL_KEY);+ }return deviceSections.flatMap((section) =>keysFor(section.entries, deviceSectionKey(section.deviceId)),);@@@ -972,15 -994,13 +1012,17 @@@targetDeviceOffline;return (<SessionGroupNode- key={`dialogue-group:${dialogueGroupKey}`}+ key={`${entry.kind}:${dialogueGroupKey}`}sessions={entry.sessions}+ lamp={lampAgg(entry.sessions)}+ foldExemptSessionIds={lampFoldExemptIds}+ groupTitle={isMake ? t('settings.cindyMake.title') : undefined}+ groupIcon={+ isMake ? <Hammer size={15} strokeWidth={1.8} className="shrink-0" aria-hidden /> : undefined+ }collapsed={isCollapsed}- onToggle={() => setDialogueCollapsed([dialogueGroupKey], !isCollapsed)}- onCreateDialogue={() => onCreateDialogue(dialogueDeviceTarget)}+ onToggle={() => setDialogueCollapsed([groupKey], !isCollapsed)}+ onCreateDialogue={isMake ? undefined : () => onCreateDialogue(dialogueDeviceTarget)}isCreateDisabled={createDisabled}createDisabledReason={targetDeviceOffline ? t('ccAgent.remoteSession.actionsUnavailable') : undefined@@@ -1223,8 -1261,10 +1283,10 @@@* 「收起所有分组」的批量收起/展开。* 标题「对话」是归属分类名(task-and-conversation-naming §2.3)。*/-function SessionGroupNode({+export function SessionGroupNode({sessions,+ lamp,+ foldExemptSessionIds,collapsed,onToggle,onCreateDialogue,