()
| 58 | router: {} as any, registry: {} as any, permissions: {} as any, config: {} as any, cwd: '/tmp', |
| 59 | }); |
| 60 | |
| 61 | function singleTurnHistory(): Message[] { |
| 62 | // One user turn ("the task") + many assistant/tool turns — never splits into >2 groups, |
| 63 | // so the OLD group-only pruner was a no-op and context grew unbounded. |
| 64 | const msgs: Message[] = [ |
| 65 | { role: 'system', content: 'SYSTEM PROMPT' }, |
| 66 | { role: 'user', content: 'find the bugs' }, |
| 67 | ]; |
| 68 | for (let i = 0; i < 6; i++) { |
| 69 | msgs.push({ |
| 70 | role: 'assistant', content: null, |
| 71 | tool_calls: [{ id: 't' + i, type: 'function', function: { name: 'read_file', arguments: JSON.stringify({ path: 'f' + i }) } }], |
| 72 | }); |
| 73 | msgs.push({ role: 'tool', tool_call_id: 't' + i, name: 'read_file', content: ('FILE_' + i + '_CONTENT ').repeat(60) }); |
| 74 | } |
| 75 | return msgs; |
| 76 | } |
| 77 | |
| 78 | function assertInvariants(out: Message[]): void { |
no test coverage detected