diff --git a/src/lib/types.ts b/src/lib/types.ts index a96c7ca..824aea0 100644 --- a/src/lib/types.ts +++ b/src/lib/types.ts @@ -1,4 +1,4 @@ -type Message = { +type ChatTurnMessage = { role: 'user' | 'assistant' | 'system'; content: string; }; @@ -8,8 +8,64 @@ type Chunk = { metadata: Record; }; -type Artifact = { +type TextBlock = { id: string; - type: string; - data: any; + type: 'text'; + data: string; }; + +type SourceBlock = { + id: string; + type: 'source'; + data: Chunk[]; +}; + +type SuggestionBlock = { + id: string; + type: 'suggestion'; + data: string[]; +}; + +type WidgetBlock = { + id: string; + type: 'widget'; + data: { + widgetType: string; + params: Record; + }; +}; + +type ReasoningResearchBlock = { + id: string; + reasoning: string; +}; + +type SearchingResearchBlock = { + id: string; + searching: string[]; +}; + +type ReadingResearchBlock = { + id: string; + reading: Chunk[]; +}; + +type ResearchBlockSubStep = + | ReasoningResearchBlock + | SearchingResearchBlock + | ReadingResearchBlock; + +type ResearchBlock = { + id: string; + type: 'research'; + data: { + subSteps: ResearchBlockSubStep[]; + }; +}; + +type Block = + | TextBlock + | SourceBlock + | SuggestionBlock + | WidgetBlock + | ResearchBlock;