/** * [WHO]: Public exports from this file (see implementation below). * [FROM]: See the import block immediately after this header. * [TO]: sparkdesign package consumers; output of CLI `add` when applicable. * [HERE]: registry/chat/response/types.ts — Spark Design source; keep aligned with the main library. * * [PROTOCOL]: * 1. Keep this P3 header in sync when the public contract changes. * 2. Update module AGENTS.md (P2) and root AGENTS.md (P1) when boundaries change. * 3. Follow design tokens and explicit type exports. */ import type { HTMLAttributes, ReactNode } from 'react'; import type { ReasoningStepDetail } from '../reasoning-step'; export type ResponsePhase = 'thinking' | 'streaming' | 'done' | 'imageGenerating'; export type ResponseStepToolType = 'read' | 'edit' | 'search'; export interface ResponseStep { text: string; description?: string; details?: ReasoningStepDetail[]; toolType?: ResponseStepToolType; } export interface ResponseRound { step: ResponseStep; simpleMd: string; } export type BlockType = 'think' | 'composer' | 'md'; export interface ResponseBlock { type: BlockType; step?: ResponseStep; md?: string; } export interface ResponseRootProps { /** 是否启用流式模拟 */ simulate?: boolean; /** 当前阶段 */ phase?: ResponsePhase; /** 响应轮次数据 */ rounds?: ResponseRound[]; /** 最终 Markdown 内容 */ finalMarkdown?: string; /** 模拟完成回调 */ onSimulateComplete?: () => void; /** 步骤变化回调 */ onStepChange?: (text: string, toolType?: ResponseStepToolType) => void; /** 自定义 ThinkingIndicator(主库注入 Lottie) */ thinkingIndicator?: ReactNode; /** 自定义 className */ className?: string; /** 子组件 */ children?: ReactNode; } export interface ResponseProps extends Omit, 'children'>, ResponseRootProps { } export interface ResponseThinkingProps { className?: string; } export interface ResponseStepsProps { className?: string; children?: ReactNode; } export interface ResponseStepProps { step: ResponseStep; status?: 'completed' | 'in-progress'; } export interface ResponseContentProps { /** Markdown 内容 */ markdown?: string; /** 是否流式渲染 */ streaming?: boolean; /** 流式渲染完成回调 */ onStreamComplete?: () => void; className?: string; } export interface ResponseImageGeneratingProps { width?: string; height?: string; className?: string; } export interface ResponseDefaultLayoutProps { className?: string; } export interface ResponseContextValue { phase: ResponsePhase; simulate: boolean; rounds: ResponseRound[]; finalMarkdown: string; blocks: ResponseBlock[]; visibleIndex: number; setVisibleIndex: React.Dispatch>; isSimDone: boolean; currentBlock: ResponseBlock | null; showThink: boolean; onSimulateComplete?: () => void; onStepChange?: (text: string, toolType?: ResponseStepToolType) => void; thinkingIndicator: ReactNode; } export interface ResponseCompound { Root: React.FC; Thinking: React.FC; Steps: React.FC; Step: React.FC; Content: React.FC; ImageGenerating: React.FC; DefaultLayout: React.FC; }