@webdevtoday/grok-cli
Version:
A sophisticated CLI tool for interacting with xAI Grok 4, featuring conversation history, file reference, custom commands, memory system, and genetic development workflows
93 lines • 2.5 kB
TypeScript
/**
* Conversation history management for Grok CLI
* Handles conversation persistence, loading, and continuation
*/
import type { Session, ChatMessage } from '../types';
export interface ConversationHistory {
id: string;
startTime: Date;
lastUpdateTime: Date;
cwd: string;
messageCount: number;
firstMessage: string;
lastMessage: string;
filePath: string;
}
export interface HistorySession {
session: Session;
messages: ChatMessage[];
metadata: {
totalMessages: number;
startTime: Date;
lastUpdateTime: Date;
cwd: string;
};
}
/**
* History manager for conversation persistence
*/
export declare class HistoryManager {
private historyDir;
private historyIndex;
private conversations;
constructor();
/**
* Initialize history directory and load conversation index
*/
initialize(): Promise<void>;
/**
* Save a conversation session to history
*/
saveConversation(session: Session, messages: ChatMessage[]): Promise<void>;
/**
* Load a conversation from history
*/
loadConversation(sessionId: string): Promise<HistorySession | null>;
/**
* Get the most recent conversation
*/
getLastConversation(): Promise<ConversationHistory | null>;
/**
* List recent conversations
*/
getRecentConversations(limit?: number): Promise<ConversationHistory[]>;
/**
* Search conversations by content
*/
searchConversations(query: string, limit?: number): Promise<ConversationHistory[]>;
/**
* Delete a conversation from history
*/
deleteConversation(sessionId: string): Promise<boolean>;
/**
* Get conversation statistics
*/
getStatistics(): Promise<{
totalConversations: number;
totalMessages: number;
oldestConversation: Date | null;
newestConversation: Date | null;
avgMessagesPerConversation: number;
}>;
/**
* Clean up old conversations
*/
cleanupOldConversations(maxAge?: number): Promise<number>;
/**
* Export conversation history
*/
exportConversations(outputPath: string): Promise<void>;
/**
* Load conversation index from disk
*/
private loadConversationIndex;
/**
* Save conversation index to disk
*/
private saveConversationIndex;
/**
* Get history directory path
*/
getHistoryDir(): string;
}
//# sourceMappingURL=history.d.ts.map