messagePredicates.ts
1 import 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. 6 export function isHumanTurn(m: Message): m is UserMessage { 7 return m.type === 'user' && !m.isMeta && m.toolUseResult === undefined 8 }