Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

test(conversations): cover chat memory chips rendering

Steven Enamakel9c30fbbe717d
diff --git a/app/src/features/conversations/aui/ChatMemoryChips.test.tsx b/app/src/features/conversations/aui/ChatMemoryChips.test.tsx
index 9194b9db60..0c8a771b95 100644
--- a/app/src/features/conversations/aui/ChatMemoryChips.test.tsx
+++ b/app/src/features/conversations/aui/ChatMemoryChips.test.tsx
@@ -26,6 +26,32 @@ function toolCallProps(toolName: string, args: unknown, result: unknown): ToolCa
}
describe('memoryToolChips', () => {
+ it('builds an "added" chip for a memory learn call', () => {
+ expect(
+ memoryToolChips('memory', { action: 'learn', text: 'Prefers tea' }, '{"id":"l1"}')
+ ).toEqual([{ id: 'learn:Prefers tea', text: 'Prefers tea', change: 'added' }]);
+ });
+
+ it('builds "existing" chips from memory recall citations and fetch hits', () => {
+ const recall = memoryToolChips(
+ 'memory',
+ { action: 'recall', question: 'q' },
+ JSON.stringify({ answer: 'a', citations: [{ id: 'c1', snippet: 'Launch is Friday' }] })
+ );
+ expect(recall.map(c => c.text)).toEqual(['Launch is Friday']);
+ const fetch = memoryToolChips(
+ 'memory',
+ { action: 'fetch', query: 'q' },
+ { hits: [{ id: 'h1', text: 'Atlas notes' }] }
+ );
+ expect(fetch.map(c => c.change)).toEqual(['existing']);
+ });
+
+ it('shows nothing for a memory forget call or an unparsable result', () => {
+ expect(memoryToolChips('memory', { action: 'forget', ids: ['a'] }, '{}')).toEqual([]);
+ expect(memoryToolChips('memory', { action: 'recall' }, 'not json')).toEqual([]);
+ });
+
it('builds one "added" chip for a memory_store call, keyed by its key', () => {
const chips = memoryToolChips(
'memory_store',
diff --git a/app/src/features/conversations/aui/toolkit.tsx b/app/src/features/conversations/aui/toolkit.tsx
index eba1aab837..5b30c7e374 100644
--- a/app/src/features/conversations/aui/toolkit.tsx
+++ b/app/src/features/conversations/aui/toolkit.tsx
@@ -5,7 +5,12 @@ import {
} from '@assistant-ui/react';
import { useMemo } from 'react';
-import { MemoryHybridSearchCall, MemoryRecallCall, MemoryStoreCall } from './ChatMemoryChips';
+import {
+ MemoryHybridSearchCall,
+ MemoryRecallCall,
+ MemoryStoreCall,
+ MemoryToolCall,
+} from './ChatMemoryChips';
import { CronAddOrUpdateCall, CronListCall, CronRunsCall } from './ChatScheduleCard';
import { GoalToolLine } from './GoalToolLine';
import { DocumentArtifactCall, MediaGenerationCall } from './MediaAndDocumentCalls';