feat(gateway): expose context usage and warning events
This commit is contained in:
@@ -308,5 +308,30 @@ describe('protocol', () => {
|
||||
data,
|
||||
});
|
||||
});
|
||||
|
||||
it('creates a context warning event message', () => {
|
||||
const data = {
|
||||
level: 'warning',
|
||||
message: 'Context usage is 76.0%',
|
||||
budget: {
|
||||
estimatedTokens: 76000,
|
||||
contextWindow: 100000,
|
||||
remainingTokens: 24000,
|
||||
usagePct: 76,
|
||||
thresholdPct: 80,
|
||||
thresholdTokens: 80000,
|
||||
shouldCompact: false,
|
||||
},
|
||||
actions: {
|
||||
checkpointSaved: false,
|
||||
autoCompacted: false,
|
||||
},
|
||||
};
|
||||
expect(makeEvent(3, 'context_warning', data)).toEqual({
|
||||
id: 3,
|
||||
event: 'context_warning',
|
||||
data,
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user