source dump of claude code
1import type { Message, UserMessage } from '../types/message.js'
2
3// tool_result messages share type:'user' with human turns; the discriminant
4// is the optional toolUseResult field. Four PRs (#23977, #24016, #24022,
5// #24025) independently fixed miscounts from checking type==='user' alone.
6export function isHumanTurn(m: Message): m is UserMessage {
7 return m.type === 'user' && !m.isMeta && m.toolUseResult === undefined
8}