| 2839 | // both streams, so a latestStream flip is observable only on the result |
| 2840 | // itself — the render must still re-run from a fresh memo entry. |
| 2841 | const latestStream = () => { |
| 2842 | const tool = state.entries.find((entry) => entry.kind === 'tool'); |
| 2843 | return tool?.kind === 'tool' && |
| 2844 | tool.result?.kind === 'shell_run' && |
| 2845 | tool.result.output?.mode === 'pipes' |
| 2846 | ? tool.result.output.latestStream |
| 2847 | : undefined; |
| 2848 | }; |
| 2849 | assert.equal(latestStream(), 'stderr'); |
| 2850 | |
| 2851 | applyShellRunUpdateToTranscript( |