@claytondcruze/chat-sdk
Version:
TypeScript SDK for AgentStable Chat System with CRUD operations and AI streaming
298 lines • 7.53 kB
TypeScript
export interface Chat {
id: string;
title: string;
userId: string;
createdAt: string;
updatedAt: string;
lastMessageAt?: string;
messageCount: number;
metadata?: {
model?: string;
systemPrompt?: string;
tags?: string[];
archived?: boolean;
};
}
export interface ClassificationMetadata {
complexity: "SIMPLE" | "COMPLEX_INFORMATIONAL" | "COMPLEX_ACTIONABLE";
reasoning: string;
confidence: number;
topics: string[];
intent_indicators: string[];
}
export interface Message {
id: string;
chatId: string;
userId: string;
role: "user" | "assistant" | "system";
content: string;
timestamp: string;
metadata?: {
model?: string;
tokens?: number;
processingTime?: number;
error?: string;
streaming?: boolean;
classification?: ClassificationMetadata;
functionUsed?: string;
};
}
export interface CreateChatRequest {
title: string;
systemPrompt?: string;
model?: string;
tags?: string[];
}
export interface UpdateChatRequest {
title?: string;
systemPrompt?: string;
tags?: string[];
archived?: boolean;
}
export interface CreateMessageRequest {
chatId: string;
role: "user" | "assistant" | "system";
content: string;
metadata?: Message["metadata"];
}
export interface ApiResponse<T = any> {
success: boolean;
data?: T;
error?: string;
timestamp: string;
}
export interface ChatListResponse {
chats: Chat[];
hasMore: boolean;
nextCursor?: string;
total: number;
}
export interface MessageListResponse {
messages: Message[];
hasMore: boolean;
nextCursor?: string;
total: number;
}
export interface StreamingChatRequest {
chatId: string;
message: string;
model?: string;
includeHistory?: boolean;
maxHistoryMessages?: number;
}
export interface SDKConfig {
baseUrl: string;
userId: string;
apiKey?: string;
timeout?: number;
}
export interface StreamingResponse {
stream: ReadableStream<string>;
cancel: () => void;
}
export interface FileSystemMetadata {
size?: number;
mime_type?: string;
encoding?: string;
tags: string[];
total_files?: number;
total_folders?: number;
last_accessed?: string;
created_by?: string;
permissions?: string[];
}
export interface FileSystem {
id: string;
name: string;
description: string;
user_id: string;
created_at: string;
updated_at: string;
metadata: FileSystemMetadata;
permissions: {
read: string[];
write: string[];
admin: string[];
};
}
export interface Folder {
id: string;
name: string;
description: string;
path: string;
filesystem_id: string;
parent_folder_id?: string;
created_at: string;
updated_at: string;
metadata: FileSystemMetadata;
}
export interface File {
id: string;
name: string;
description: string;
path: string;
content: string;
filesystem_id: string;
folder_id: string;
created_at: string;
updated_at: string;
metadata: FileSystemMetadata;
}
export interface CreateFileSystemRequest {
name: string;
description: string;
tags?: string[];
permissions?: {
read?: string[];
write?: string[];
admin?: string[];
};
}
export interface UpdateFileSystemRequest {
name?: string;
description?: string;
tags?: string[];
permissions?: {
read?: string[];
write?: string[];
admin?: string[];
};
}
export interface CreateFolderRequest {
name: string;
description: string;
filesystem_id: string;
parent_folder_id?: string;
tags?: string[];
}
export interface UpdateFolderRequest {
name?: string;
description?: string;
tags?: string[];
}
export interface CreateFileRequest {
name: string;
description: string;
content: string;
filesystem_id: string;
folder_id: string;
mime_type?: string;
tags?: string[];
}
export interface UpdateFileRequest {
name?: string;
description?: string;
content?: string;
mime_type?: string;
tags?: string[];
}
export interface UserPreferences {
prefers_quick_execution: boolean;
detail_level: "brief" | "detailed" | "comprehensive";
default_organization: "by_topic" | "by_date" | "by_type" | "custom";
}
export interface FileSystemIntent {
description: string;
project_type: "research" | "business" | "personal" | "creative" | "academic" | "technical";
complexity: "SIMPLE" | "MEDIUM" | "COMPLEX";
suggested_filesystem_name: string;
suggested_structure: {
filesystem_name: string;
description: string;
folders: Array<{
name: string;
description: string;
path: string;
parent_path?: string;
expected_file_types: string[];
tags: string[];
}>;
estimated_files_count: number;
};
expected_files: Array<{
name: string;
type: string;
content_description: string;
estimated_size: "small" | "medium" | "large";
}>;
tags: string[];
confidence: number;
}
export interface SemanticMatch {
type: "filesystem" | "folder" | "file";
item_id: string;
item_name: string;
item_path: string;
similarity: number;
reasoning: string;
suggested_action: "use_existing" | "extend_existing" | "create_new";
}
export interface SemanticMatches {
matches: SemanticMatch[];
best_match?: SemanticMatch;
recommendation: {
action: "use_existing" | "create_new" | "hybrid";
target_filesystem_id?: string;
target_folder_id?: string;
reasoning: string;
confidence: number;
};
}
export interface ClarificationResponse {
message: string;
recommended_action: "use_existing" | "create_new" | "hybrid";
proposed_structure?: {
filesystem_name: string;
description: string;
folders: Array<{
name: string;
description: string;
path: string;
parent_folder_name?: string;
tags: string[];
}>;
files?: Array<{
name: string;
description: string;
folder_path: string;
content_template: string;
mime_type: string;
tags: string[];
}>;
tags: string[];
};
existing_matches: Array<{
type: string;
name: string;
path: string;
similarity: number;
reason_for_match: string;
}>;
next_steps: string[];
requires_confirmation: boolean;
}
export interface AIFilesystemPipelineRequest {
message: string;
auto_execute?: boolean;
user_preferences?: UserPreferences;
}
export interface AIFilesystemPipelineResponse {
pipeline_results: {
intent_analysis: FileSystemIntent;
context_analysis: {
existing_filesystems: number;
semantic_matches: number;
recommendation: string;
best_match?: SemanticMatch;
};
clarification: ClarificationResponse;
proposed_structure?: ClarificationResponse["proposed_structure"];
existing_matches: SemanticMatch[];
};
execution_results?: {
filesystem_created?: FileSystem;
folders_created?: Folder[];
files_created?: File[];
};
}
//# sourceMappingURL=types.d.ts.map