UNPKG

@aichatkit/types

Version:

Shared TypeScript types for Hypermode ChatKit

114 lines (100 loc) 1.92 kB
/** * Core message type definitions for the chat application */ /** * Base response item type */ export type ResponseItemType = 'message' | 'tool_call' | 'card' /** * Tool call data structure */ export interface ToolCall { id: string name: string arguments: Record<string, any> status: 'pending' | 'executing' | 'completed' | 'error' result?: any error?: string } /** * Card data structure for rich content */ export interface Card { id: string type: string title?: string content: Record<string, any> actions?: CardAction[] } export interface CardAction { id: string label: string type: 'button' | 'link' action: string data?: Record<string, any> } /** * Base response item */ export interface ResponseItem { id: string | number type: ResponseItemType timestamp?: string } /** * Message response item */ export interface MessageItem extends ResponseItem { type: 'message' content: string role: 'user' | 'assistant' } /** * Tool call response item */ export interface ToolCallItem extends ResponseItem { type: 'tool_call' toolCall: ToolCall } /** * Card response item */ export interface CardItem extends ResponseItem { type: 'card' card: Card } /** * Union type for all response items */ export type ChatResponseItem = MessageItem | ToolCallItem | CardItem /** * Represents a single chat message */ export interface Message { id: string | number content: string role: 'user' | 'assistant' timestamp?: string } /** * Represents a conversation consisting of multiple response items */ export interface Conversation { id: string title: string items: ChatResponseItem[] } /** * Response from the chat API */ export interface ChatResponse { items: ChatResponseItem[] conversationId: string } /** * Simple message structure to handle chat history */ export interface ChatMessage { role: string content: string }