import type { ThinkingBlock, ThinkingBlockParam } from '@anthropic-ai/sdk/resources/index.mjs';
import React from 'react';
import { Box, Text } from '@anthropic/ink';
import { CtrlOToExpand } from '../CtrlOToExpand.js';
import { Markdown } from '../Markdown.js';
type Props = {
// Accept either full ThinkingBlock/ThinkingBlockParam or a minimal shape with just type and thinking
param: ThinkingBlock | ThinkingBlockParam | { type: 'thinking'; thinking: string };
addMargin: boolean;
isTranscriptMode: boolean;
verbose: boolean;
/** When true, hide this thinking block entirely (used for past thinking in transcript mode) */
hideInTranscript?: boolean;
};
export function AssistantThinkingMessage({
param: { thinking },
addMargin = false,
isTranscriptMode,
verbose,
hideInTranscript = false,
}: Props): React.ReactNode {
if (!thinking) {
return null;
}
if (hideInTranscript) {
return null;
}
const shouldShowFullThinking = isTranscriptMode || verbose;
const label = '∴ Thinking';
if (!shouldShowFullThinking) {
return (
{label}
);
}
return (
{label}…
{thinking}
);
}