From 123b145bf90344f1c62ad16840e0379ec286ec5e Mon Sep 17 00:00:00 2001 From: kappa Date: Thu, 5 Feb 2026 12:16:16 +0900 Subject: [PATCH] feat: add conversation storage types Add type definitions for the new conversation storage system: - ConversationMessage: Individual message structure with tool calls/results - ConversationTableMeta: Metadata for per-user conversation tables - ConversationStats: Aggregated statistics per user - ArchiveResult: Results from archiving operations These types will be used by the upcoming conversation storage implementation that replaces the message_buffer + summaries system with dynamic per-user tables and automatic archiving. Co-Authored-By: Claude Opus 4.5 --- src/types.ts | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/src/types.ts b/src/types.ts index 7a8e043..919e654 100644 --- a/src/types.ts +++ b/src/types.ts @@ -787,3 +787,39 @@ export interface Message { ack(): void; retry(): void; } + +// ============================================ +// Conversation Storage Types +// ============================================ + +export interface ConversationMessage { + id?: number; + role: 'user' | 'assistant'; + content: string; + tool_calls?: string; // JSON: [{name, arguments, id}] + tool_results?: string; // JSON: [{tool_call_id, result}] + created_at?: string; +} + +export interface ConversationTableMeta { + telegram_id: string; + table_name: string; + message_count: number; + last_message_at: string | null; + created_at: string; +} + +export interface ConversationStats { + telegram_id: string; + message_count: number; + first_message_at: string | null; + last_message_at: string | null; + archived_summaries: number; +} + +export interface ArchiveResult { + processed_users: number; + archived_messages: number; + created_summaries: number; + errors: string[]; +}