import { LocalTaskComment } from '../../api';

export function isThinkingComment(c: LocalTaskComment): boolean {
  if (c.kind !== 'progress') return false;
  try {
    const data = JSON.parse(c.body);
    return data && data.type === 'thinking';
  } catch {
    return false;
  }
}

export function hasTrailingThinking(comments: LocalTaskComment[]): boolean {
  const last = comments[comments.length - 1];
  return !!last && isThinkingComment(last);
}
