toto-agent
Version:
Chatbot agent and reusable components for Toto platform
84 lines (83 loc) • 2.25 kB
TypeScript
export interface LogEntry {
timestamp: string;
level: 'info' | 'warn' | 'error' | 'debug';
component: string;
message: string;
data?: any;
userId?: string;
sessionId?: string;
}
export interface OnboardingSession {
sessionId: string;
userId?: string;
startTime: string;
endTime?: string;
steps: LogEntry[];
validationHistory: any[];
aiResponses: string[];
userMessages: string[];
completionStatus: 'in_progress' | 'completed' | 'failed';
totalDuration?: number;
}
export declare class OnboardingLogger {
private sessions;
private logs;
private maxLogs;
/**
* Start a new onboarding session
*/
startSession(sessionId: string, userId?: string): void;
/**
* End an onboarding session
*/
endSession(sessionId: string, status?: 'completed' | 'failed'): void;
/**
* Log a message with context
*/
log(level: 'info' | 'warn' | 'error' | 'debug', component: string, message: string, data?: any, sessionId?: string, userId?: string): void;
/**
* Log AI response
*/
logAiResponse(sessionId: string, userMessage: string, aiResponse: string, context: any, validation: any): void;
/**
* Log validation result
*/
logValidation(sessionId: string, validation: any, currentData: any): void;
/**
* Log user interaction
*/
logUserInteraction(sessionId: string, userMessage: string, extractedData: any): void;
/**
* Get session details
*/
getSession(sessionId: string): OnboardingSession | undefined;
/**
* Get all sessions
*/
getAllSessions(): OnboardingSession[];
/**
* Get recent logs
*/
getRecentLogs(limit?: number): LogEntry[];
/**
* Get logs by level
*/
getLogsByLevel(level: 'info' | 'warn' | 'error' | 'debug'): LogEntry[];
/**
* Get logs by component
*/
getLogsByComponent(component: string): LogEntry[];
/**
* Get onboarding analytics
*/
getAnalytics(): any;
/**
* Clear all logs and sessions
*/
clear(): void;
/**
* Export logs for debugging
*/
exportLogs(): string;
}
export declare const onboardingLogger: OnboardingLogger;