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(queue): preserve intentionally empty visible content

Zhao Dengfengcb814b2ea5bb
diff --git a/packages/maker-shared/src/__tests__/queue.test.ts b/packages/maker-shared/src/__tests__/queue.test.ts
index 1c741f5da6..d75320a73f 100644
--- a/packages/maker-shared/src/__tests__/queue.test.ts
+++ b/packages/maker-shared/src/__tests__/queue.test.ts
@@ -336,6 +336,14 @@ describe('queueItemVisibleText', () => {
})).toBe('heartbeat prompt');
});
+ it('keeps an intentionally empty persisted body instead of exposing agent instructions', () => {
+ expect(queueItemVisibleText({
+ text: '[silent-run protocol] internal agent instructions',
+ persistedContent: '',
+ origin: { kind: 'session', senderSessionId: 'bot-task' },
+ })).toBe('');
+ });
+
it('unwraps the host attachment envelope only when files are attached', () => {
const origin = { kind: 'session', senderSessionId: 'caller' };
expect(queueItemVisibleText({
diff --git a/packages/maker-shared/src/queue.ts b/packages/maker-shared/src/queue.ts
index 3b9dcc8993..e383c48b25 100644
--- a/packages/maker-shared/src/queue.ts
+++ b/packages/maker-shared/src/queue.ts
@@ -225,7 +225,7 @@ export function queueItemVisibleText(item: {
}): string {
const text = item.text ?? '';
if (!isAutoSentQueueItem(item)) return text;
- const persisted = item.persistedContent || text;
+ const persisted = item.persistedContent ?? text;
if (!item.files?.length) return persisted;
try {
const envelope = JSON.parse(persisted) as unknown;