Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
Merge remote-tracking branch 'origin/main' into cindy/thoughtful-leakey
DavidShen0cc5142ab58c
diff --cc apps/desktop/src/renderer/__tests__/newMakerCreateAgentVisualContract.test.tsindex 99ae952eb4,99ae952eb4..7ce0d5037a--- a/apps/desktop/src/renderer/__tests__/newMakerCreateAgentVisualContract.test.ts+++ b/apps/desktop/src/renderer/__tests__/newMakerCreateAgentVisualContract.test.ts@@@ -354,8 -354,8 +354,8 @@@ describe('NewMakerDraftRoute CREATE AGEexpect(modelSelectorSource).toContain("? 'truncate'");expect(modelSelectorSource).toContain('<ChevronDown');expect(modelSelectorSource).toContain("'shrink-0'");-- expect(chatInputSource).toContain(-- "className={isCreateAgentVariant && !useNarrowToolbar ? 'ml-[7px]' : undefined}",++ expect(chatInputSource).toMatch(++ /className=\{\s*isCreateAgentVariant && !useNarrowToolbar\s*\? 'ml-\[7px\]' : undefined\s*\}/,);// 本机会话可选附件,但远程或身份尚未回流的已建会话不能摄入控制端绝对路径。expect(chatInputSource).toContain('const localAttachmentPickerEnabled =');diff --cc apps/desktop/src/renderer/__tests__/voiceInputButtonAnchor.test.tsindex 9cb6e58832,9cb6e58832..525c5e73e4--- a/apps/desktop/src/renderer/__tests__/voiceInputButtonAnchor.test.ts+++ b/apps/desktop/src/renderer/__tests__/voiceInputButtonAnchor.test.ts@@@ -43,10 -43,10 +43,10 @@@ describe('ChatInput voice button ancho// 只在录音态挪 Stop 是不够的:录音结束且草稿非空时 Stop 会跳回右边,语音按钮同样// 左移一格,只是把误点风险推迟到「刚点完停止录音」那一刻。expect(chatInputSource).toContain(-- 'const showSecondaryStop =\n showStopButton && (canSend || voiceBusyOnCurrentComposer) && !sendDispatchInFlight;',++ 'const showSecondaryStop =\n !queueEditActive &&\n showStopButton && (canSend || voiceBusyOnCurrentComposer) && !sendDispatchInFlight;',);expect(chatInputSource).toContain(-- 'const mainSlotIsStop =\n showStopButton && (sendDispatchInFlight || (!canSend && !voiceBusyOnCurrentComposer));',++ 'const mainSlotIsStop =\n !queueEditActive &&\n showStopButton && (sendDispatchInFlight || (!canSend && !voiceBusyOnCurrentComposer));',);});@@@ -57,7 -57,7 +57,7 @@@const slotDecisionBlock = extractBetween(chatInputSource,'const mainSlotIsStop =',-- 'useEffect(() => {\n voiceInputCanStopAndSendRef.current = !sendButtonDisabled;',++ 'useEffect(() => {\n voiceInputCanStopAndSendRef.current = !queueEditActive && !sendButtonDisabled;',);expect(slotDecisionBlock).not.toContain('voiceInput.isListening');@@@ -69,8 -69,8 +69,8 @@@// shortcut that is needed to end the active recording.expect(chatInputSource).toContain('const disabledRef = useRef(composerEditorLocked);');expect(chatInputSource).toContain('disabledRef.current = composerEditorLocked;');-- expect(chatInputSource).toContain(-- 'disabled={\n composerEditorLocked ||\n !editor ||\n (voiceInput.isBusy && !voiceBusyOnCurrentComposer)\n }',++ expect(chatInputSource).toMatch(++ /disabled=\{\s*composerEditorLocked \|\|\s*!editor \|\|\s*\(voiceInput\.isBusy && !voiceBusyOnCurrentComposer\)\s*\}/,);expect(chatInputSource).not.toContain('disabled={composerMutationLocked || !editor}');});diff --cc apps/desktop/src/renderer/__tests__/voiceInputEnterToSend.test.tsindex 74e68b7fc4,74e68b7fc4..2d67a69c73--- a/apps/desktop/src/renderer/__tests__/voiceInputEnterToSend.test.ts+++ b/apps/desktop/src/renderer/__tests__/voiceInputEnterToSend.test.ts@@@ -24,7 -24,7 +24,9 @@@ describe('ChatInput voice input Enter-t);expect(chatInputSource).toContain('const voiceInputCanStopAndSendRef = useRef(false);');expect(chatInputSource).toContain('voiceInputStopAndSendRef.current = handleClickSend;');-- expect(chatInputSource).toContain('voiceInputCanStopAndSendRef.current = !sendButtonDisabled;');++ expect(chatInputSource).toContain(++ 'voiceInputCanStopAndSendRef.current = !queueEditActive && !sendButtonDisabled;',++ );expect(keydownBlock).toContain("currentState === 'listening'");expect(keydownBlock).toContain('voiceInputCanStopAndSendRef.current');expect(keydownBlock).toContain('isVoiceInputEnterTarget(event.target)');diff --cc apps/desktop/src/renderer/components/new-chat/ChatInput.tsxindex 3cd5e814ae,99bb71fa84..c2d5fd2a1e--- a/apps/desktop/src/renderer/components/new-chat/ChatInput.tsx+++ b/apps/desktop/src/renderer/components/new-chat/ChatInput.tsx@@@ -5934,41 -5906,6 +5934,41 @@@ export function ChatInput([onQueueSteer],);+ const queueEditActive = Boolean(queueEditingClientId && onQueueEditSubmit);+ const submitQueueEdit = useCallback(async () => {+ if (+ !editor ||+ editor.isDestroyed ||+ !queueEditingClientId ||+ !onQueueEditSubmit ||+ disabled ||+ sendDispatchInFlight+ ) {+ return;+ }+ const content = serializeEditorContent(editor);+ if (content.text.trim().length === 0 && attachments.length === 0) return;++ setSendDispatchInFlight(true);+ try {+ const saved = await onQueueEditSubmit(queueEditingClientId, content, [...attachments]);- if (!saved) toast.error(t('errors.INTERNAL'));++ if (!saved) toast.error(t('ipcError.INTERNAL'));+ } catch (error) {+ log.warn('queue edit rejected:', error instanceof Error ? error.message : String(error));- toast.error(t(mapIpcErrorToI18nKey(error, { fallback: 'errors.INTERNAL' })));++ toast.error(t(mapIpcErrorToI18nKey(error, { fallback: 'ipcError.INTERNAL' })));+ } finally {+ setSendDispatchInFlight(false);+ }+ }, [+ attachments,+ disabled,+ editor,+ onQueueEditSubmit,+ queueEditingClientId,+ sendDispatchInFlight,+ t,+ ]);+const acceptPromptRecommendation = useCallback((): boolean => {if (!editor ||diff --cc apps/desktop/src/renderer/features/cc-agent/CCAgentSessionView.tsxindex 9af8782486,9146c1d8f5..0395d452fe--- a/apps/desktop/src/renderer/features/cc-agent/CCAgentSessionView.tsx+++ b/apps/desktop/src/renderer/features/cc-agent/CCAgentSessionView.tsx@@@ -1797,110 -1780,19 +1801,120 @@@ export function CCAgentSessionView(setQueueInteractionLock,setQueueEditLock,removeFromQueue,- updateQueueItem,+ updateQueueItemContent,chatDisplaySnapshot,} = useCCAgentChat(sessionId, handleTitleUpdate, { chatRealtime });-+ const clearQueueComposerEditDraft = useCallback(+ (edit: NonNullable<typeof queueComposerEdit>, files: readonly AttachedFile[]) => {+ const originalIds = new Set(edit.originalAttachmentIds);+ const addedFiles = files.filter((file) => !originalIds.has(file.id));+ for (const file of addedFiles) cleanupRemovedCachedImage(file);+ cleanupStagedChatAttachmentFiles(addedFiles);+ discardComposerDraft(edit.draftKey);+ },+ [],+ );++ const beginQueueComposerEdit = useCallback(+ (entry: QueuedMessage) => {+ if (!sessionId || activeQueueComposerEdit) return;+ const prepared = queueMessageToComposerEditDraft(sessionId, entry);+ const nextEdit = {+ sessionId,+ clientId: entry.clientId,+ draftKey: prepared.draftKey,+ originalAttachmentIds: prepared.originalAttachmentIds,+ };+ saveComposerDraft(prepared.draftKey, prepared.draft);+ queueComposerEditRef.current = nextEdit;+ setQueueComposerEdit(nextEdit);+ },+ [activeQueueComposerEdit, sessionId],+ );++ const cancelQueueComposerEdit = useCallback(() => {+ if (queueComposerEditSavingRef.current) return;+ const edit = activeQueueComposerEdit;+ if (!edit) return;+ clearQueueComposerEditDraft(edit, attachmentState.attachments);+ attachmentState.clearFiles();+ queueComposerEditRef.current = null;+ setQueueComposerEdit(null);+ }, [activeQueueComposerEdit, attachmentState, clearQueueComposerEditDraft]);++ const submitQueueComposerEdit = useCallback(+ async (clientId: string, content: SerializedComposerContent, files: AttachedFile[]) => {+ const edit = activeQueueComposerEdit;+ if (!edit || edit.clientId !== clientId || queueComposerEditSavingRef.current) return false;+ queueComposerEditSavingRef.current = true;+ let rowDisappeared = false;+ try {+ const updated = await updateQueueItemContent(clientId, { content, files });+ if (!updated) {+ rowDisappeared = !makerChatStore+ .getSnapshot(edit.sessionId)+ .pendingQueue.some((entry) => entry.clientId === clientId);+ return false;+ }+ attachmentState.clearFiles();+ clearComposerDraftAndNotify(edit.draftKey);+ queueComposerEditRef.current = null;+ setQueueComposerEdit(null);+ return true;+ } finally {+ queueComposerEditSavingRef.current = false;+ if (rowDisappeared) queueMicrotask(cancelQueueComposerEdit);+ }+ },+ [+ activeQueueComposerEdit,+ attachmentState,+ cancelQueueComposerEdit,+ updateQueueItemContent,+ ],+ );++ useEffect(() => {+ return () => {+ if (queueComposerEditSavingRef.current) return;+ const edit = queueComposerEditRef.current;+ if (!edit || edit.sessionId !== sessionId) return;+ const filesById = new Map(+ queueComposerEditAttachmentsRef.current.map((file) => [file.id, file]),+ );+ for (const file of getComposerDraft(edit.draftKey)?.attachments ?? []) {+ filesById.set(file.id, file);+ }+ clearQueueComposerEditDraft(edit, [...filesById.values()]);+ queueComposerEditRef.current = null;+ };+ }, [clearQueueComposerEditDraft, sessionId]);++ useEffect(() => {+ if (queueComposerEdit && queueComposerEdit.sessionId !== sessionId) {+ setQueueComposerEdit(null);+ }+ }, [queueComposerEdit, sessionId]);++ useEffect(() => {+ if (+ activeQueueComposerEdit &&+ !pendingQueue.some((entry) => entry.clientId === activeQueueComposerEdit.clientId)+ ) {+ cancelQueueComposerEdit();+ }+ }, [activeQueueComposerEdit, cancelQueueComposerEdit, pendingQueue]);+++ const remoteMakeCards = useSessionResourceCards({+ deviceId: session?.source === 'cindy-make' && session.status === 'active' && !session.clearedAt+ ? remoteDeviceId : undefined,+ sessionId,+ source: session?.source,+ connected: remoteConn === 'connected',+ active: chatRealtime,+ readOnly,+ running: isAgentBusy,+ });const makeState = useCindyMakeState();const cindyMakePreparation = useMemo(() =>