Skip to content

armgit / cindy

Public Imported from GitHub
0

Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。

fix(desktop): 保留队列引用设备提示

DavidShen44a45f7a56a4
diff --git a/apps/desktop/src/renderer/__tests__/pendingQueueDefer.test.ts b/apps/desktop/src/renderer/__tests__/pendingQueueDefer.test.ts
index 3c70bcf86d..946c758788 100644
--- a/apps/desktop/src/renderer/__tests__/pendingQueueDefer.test.ts
+++ b/apps/desktop/src/renderer/__tests__/pendingQueueDefer.test.ts
@@ -905,6 +905,44 @@ describe('renderer input queue facade', () => {
}]);
});
+ it('preserves queued source device hints in composer queue edits', async () => {
+ const sid = `content-ref-${Math.random().toString(36).slice(2, 8)}`;
+ const item = queued('q-content-ref', 'compare cindy://session/source?message=old-anchor');
+ item.sessionRefs = [
+ { sessionId: 'source', messageClientId: 'old-anchor', deviceId: 'source-device' },
+ ];
+
+ makerChatStore.initGlobalListeners();
+ projectionHandler?.(projection(sid, { pendingQueue: [item] }));
+
+ const saved = await makerChatStore.updateQueueItemContent(sid, item.clientId, {
+ content: {
+ text: 'edited cindy://session/source?message=new-anchor',
+ mentions: [],
+ hasQuotes: false,
+ agentReferences: [],
+ pastedTextRanges: [],
+ slashCommandRanges: [],
+ },
+ files: [],
+ });
+
+ expect(saved).toBe(true);
+ expect(input.updateContent).toHaveBeenCalledWith(
+ sid,
+ item.clientId,
+ expect.objectContaining({
+ sessionRefs: [
+ {
+ sessionId: 'source',
+ messageClientId: 'new-anchor',
+ deviceId: 'source-device',
+ },
+ ],
+ }),
+ );
+ });
+
it('delegates composer steer, stop, resume and retry to main input intents', async () => {
const sid = `intents-${Math.random().toString(36).slice(2, 8)}`;
diff --git a/apps/desktop/src/renderer/lib/makerChatStore.ts b/apps/desktop/src/renderer/lib/makerChatStore.ts
index c71601c60d..66a2a64b6c 100644
--- a/apps/desktop/src/renderer/lib/makerChatStore.ts
+++ b/apps/desktop/src/renderer/lib/makerChatStore.ts
@@ -13860,6 +13860,9 @@ async function updateQueueItemContent(
createdAt: queued.chatMessage.createdAt ?? new Date().toISOString(),
},
);
+ const replacementSessionRefs = extractSessionRefs(content.text, queued.sessionRefs);
+ if (replacementSessionRefs.length > 0) replacement.sessionRefs = replacementSessionRefs;
+ else delete replacement.sessionRefs;
const boundaryOpts = getRemoteInputClearBoundaryOpts(sessionId);
let projection: AgentInputProjection;
try {