Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
merge: 同步主干并保留两端文字回归用例
Dash67d14eeb8f09
diff --cc apps/desktop/src/renderer/__tests__/makerChatStoreTextDeltaBatching.test.tsindex d8c62567ed,75309f8d25..742a0e167d--- a/apps/desktop/src/renderer/__tests__/makerChatStoreTextDeltaBatching.test.ts+++ b/apps/desktop/src/renderer/__tests__/makerChatStoreTextDeltaBatching.test.ts@@@ -571,21 -544,44 +572,59 @@@ describe('makerChatStore text delta batvi.useRealTimers();});+ it.each([false, true])('updates the SDK id mirror but persists only in the primary window (sidebar=%s)', async (sidebar) => {+ Object.defineProperty(window, 'location', {+ configurable: true,+ value: { search: sidebar ? '?sidebarWindow=1' : '' },+ });+ const event = { sessionId: SESSION_ID, event: { type: 'session_id', source: 'claude-code', data: 'sdk-live-1' } };+ onEvent?.(event);+ await flushPromises();+ expect(makerChatStore.getSnapshot(SESSION_ID).sdkSessionId).toBe('sdk-live-1');+ onEvent?.(event);+ await flushPromises();+ expect(sessionService.update).toHaveBeenCalledTimes(sidebar ? 0 : 1);+ if (!sidebar) expect(sessionService.update).toHaveBeenCalledWith(SESSION_ID, { sdkSessionId: 'sdk-live-1' });+ });++ it.each([true, false])('keeps the Pi reply through early persistence and history reload (DB first=%s)', async (dbFirst) => {+ const persisted = [+ serverMessage({+ id: 'pi-thinking-row', clientId: 'pi-thinking', sessionId: SESSION_ID, role: 'thinking',+ content: { kind: 'thinking', text: piReplyThinking, durationMs: 20_000, isRedacted: false },+ createdAt: '2026-08-31T12:34:19.000Z',+ }),+ serverMessage({+ id: 'pi-text-row', clientId: 'pi-text', sessionId: SESSION_ID, role: 'assistant', content: piReplyText,+ agentMeta: { model: 'z-ai/glm-5.3-flash', stopReason: 'stop' },+ createdAt: '2026-08-31T12:34:19.001Z',+ }),+ ];+ const echo = () => persisted.forEach((message) => onDbMessageCreated?.({ sessionId: SESSION_ID, message }));+ if (dbFirst) echo();+ onEvent?.({ sessionId: SESSION_ID, event: {+ type: 'thinking', source: 'pi', data: { stage: 'final', blockId: 'pi-thinking', text: piReplyThinking, durationMs: 20_000 },+ } });+ onEvent?.({ sessionId: SESSION_ID, persistId: 'pi-text', event: {+ type: 'text', source: 'pi', data: { text: piReplyText.slice(0, 5), isFinal: false },+ } });+ onEvent?.({ sessionId: SESSION_ID, persistId: 'pi-text', event: {+ type: 'text', source: 'pi', data: { text: piReplyText, isFinal: true, isFullText: true },+ } });+ if (!dbFirst) echo();+ vi.advanceTimersByTime(32);+ const assertReply = () => expect(makerChatStore.getSnapshot(SESSION_ID).messages.map(({ role, content }) => ({ role, content })))+ .toEqual([{ role: 'thinking', content: piReplyThinking }, { role: 'assistant', content: piReplyText }]);+ assertReply();+ onEvent?.({ sessionId: SESSION_ID, event: { type: 'done', source: 'pi', data: { status: 'completed', result: piReplyText } } });+ assertReply();+ makerChatStore.purgeSession(SESSION_ID);+ vi.mocked(messageService.list).mockResolvedValueOnce(persisted);+ makerChatStore.ensureInitialMessages(SESSION_ID);+ await flushPromises();+ assertReply();+ });+it('coalesces consecutive text deltas into one store notification', () => {let notifyCount = 0;const unsubscribe = makerChatStore.subscribe(SESSION_ID, () => {