| 5 | const bigLog = 'line\n'.repeat(12_000) + 'ERROR: build failed at src/App.tsx:42'; |
| 6 | |
| 7 | const mkHistory = (): Message[] => ([ |
| 8 | { role: 'user', content: 'fix the build' }, |
| 9 | { role: 'assistant', content: 'running build' }, |
| 10 | { role: 'tool', tool_call_id: '1', name: 'shell', content: bigLog } as any, |
| 11 | { role: 'assistant', content: 'reading file' }, |
| 12 | { role: 'tool', tool_call_id: '2', name: 'read_file', content: 'x'.repeat(20_000) } as any, |
| 13 | { role: 'assistant', content: 'editing' }, |
| 14 | { role: 'tool', tool_call_id: '3', name: 'shell', content: 'y'.repeat(9_000) } as any, |
| 15 | { role: 'assistant', content: 'done?' }, |
| 16 | ]); |
| 17 | |
| 18 | describe('ageToolResults', () => { |
| 19 | it('ages a large old shell log to a head+tail stub, preserving the trailing error', () => { |