feat(commands,audit): add /context command and proactive compaction audit events
This commit is contained in:
@@ -82,6 +82,25 @@ describe('createAgentHandlers command fast-path', () => {
|
||||
expect((event.data as { content: string }).content).toContain('Token Usage');
|
||||
});
|
||||
|
||||
it('handles /context command via fast-path', async () => {
|
||||
const sent: OutboundMessage[] = [];
|
||||
const send = vi.fn((msg: OutboundMessage) => sent.push(msg));
|
||||
const req: GatewayRequest = {
|
||||
id: 8,
|
||||
method: 'agent.send',
|
||||
params: { message: '/context', connectionId: 'conn-1' },
|
||||
};
|
||||
|
||||
await handlers['agent.send'](req, send);
|
||||
|
||||
expect(mockAgent.process).not.toHaveBeenCalled();
|
||||
expect(sent).toHaveLength(1);
|
||||
const event = sent[0] as GatewayEvent;
|
||||
expect(event.event).toBe('done');
|
||||
expect((event.data as { content: string }).content).toContain('Context Usage');
|
||||
expect((event.data as { content: string }).content).toContain('Compaction threshold');
|
||||
});
|
||||
|
||||
it('handles metadata commands via fast-path', async () => {
|
||||
const sent: OutboundMessage[] = [];
|
||||
const send = vi.fn((msg: OutboundMessage) => sent.push(msg));
|
||||
|
||||
Reference in New Issue
Block a user