feat: split session and subagent cost under the context meter
This commit is contained in:
@@ -20,6 +20,20 @@ describe('computeRollup', () => {
|
||||
expect(result.subagentCount).toBe(3);
|
||||
});
|
||||
|
||||
test('splits the total into the session own cost and the subagent share', () => {
|
||||
const result = computeRollup(sessions, 'root');
|
||||
expect(result.ownCost).toBe(1);
|
||||
expect(result.subagentCost).toBe(10);
|
||||
expect(result.ownCost + result.subagentCost).toBe(result.totalCost);
|
||||
});
|
||||
|
||||
test('reports a zero subagent share for a session with no children', () => {
|
||||
const result = computeRollup(sessions, 'a1');
|
||||
expect(result.ownCost).toBe(5);
|
||||
expect(result.subagentCost).toBe(0);
|
||||
expect(result.totalCost).toBe(5);
|
||||
});
|
||||
|
||||
test('maps each direct child to its own subtree cost', () => {
|
||||
const result = computeRollup(sessions, 'root');
|
||||
expect(result.perChildCost.get('a')).toBe(7);
|
||||
|
||||
Reference in New Issue
Block a user