| 963 | }; |
| 964 | // Builders for the event shapes Claude Code actually emits. |
| 965 | const req = (ctx, id, blocks) => blocks.map((b) => JSON.stringify({ |
| 966 | type: 'assistant', |
| 967 | message: { id, content: [b], usage: { input_tokens: ctx, cache_read_input_tokens: 0, cache_creation_input_tokens: 0, output_tokens: 2 } }, |
| 968 | })); |
| 969 | const use = (id, name, input = {}) => ({ type: 'tool_use', id, name, input }); |
| 970 | const res = (id, chars) => JSON.stringify({ |
| 971 | type: 'user', message: { content: [{ type: 'tool_result', tool_use_id: id, content: [{ type: 'text', text: 'x'.repeat(chars) }] }] }, |