test(memory): cover getSystemPrompt session context
This commit is contained in:
@@ -608,6 +608,39 @@ describe('AgentOrchestrator', () => {
|
||||
|
||||
rmSync(tempDir, { recursive: true, force: true });
|
||||
});
|
||||
|
||||
it('injects session context via getSystemPrompt() before process()', () => {
|
||||
const tempDir = mkdtempSync(join(tmpdir(), 'flynn-orchestrator-session-context-prompt-'));
|
||||
const memoryStore = new MemoryStore({ dir: tempDir, maxContextTokens: 2000 });
|
||||
memoryStore.write('user/profile', 'Name: Will', 'replace');
|
||||
writeWorkingMemory(memoryStore, 'user/working', 'Recent task: build feature X', 14, 1000);
|
||||
|
||||
const orchestrator = new AgentOrchestrator({
|
||||
modelRouter: mockRouter,
|
||||
systemPrompt: 'You are a helpful agent.',
|
||||
primaryTier: 'default',
|
||||
delegation: {
|
||||
compaction: 'fast',
|
||||
memory_extraction: 'default',
|
||||
classification: 'complex',
|
||||
tool_summarisation: 'default',
|
||||
complex_reasoning: 'complex',
|
||||
},
|
||||
maxDelegationDepth: 10,
|
||||
memoryStore,
|
||||
userNamespace: 'user',
|
||||
workingMemoryTtlDays: 14,
|
||||
workingMemoryMaxTokens: 1000,
|
||||
});
|
||||
|
||||
const prompt = orchestrator.getSystemPrompt('Hello');
|
||||
expect(prompt).toContain('--- Who you\'re talking to ---');
|
||||
expect(prompt).toContain('Name: Will');
|
||||
expect(prompt).toContain('--- Recent context ---');
|
||||
expect(prompt).toContain('Recent task: build feature X');
|
||||
|
||||
rmSync(tempDir, { recursive: true, force: true });
|
||||
});
|
||||
});
|
||||
|
||||
describe('compact()', () => {
|
||||
|
||||
Reference in New Issue
Block a user