/** * Usage Logger * Logs GLM API usage to JSON Lines format for statistics * - Chat logs: ~/.glm/logs/chat-{timestamp}.jsonl (detailed, per-run) * - Token usage: ~/.glm/usage.jsonl (statistics, centralized) */ import { GlmUsage } from './types.js'; /** * Chat log entry (complete data) */ export interface ChatLogEntry { timestamp: string; profile: string | null; prompt: string; code: string; model: string; stream: boolean; usage: { prompt_tokens: number; completion_tokens: number; total_tokens: number; } | null; success: boolean; error?: string; } /** * Token usage log entry (stats optimized) */ export interface TokenUsageEntry { timestamp: string; profile: string | null; model: string; stream: boolean; usage: { prompt_tokens: number; completion_tokens: number; total_tokens: number; } | null; success: boolean; promptLength: number; codeLength: number; error?: string; } /** * Log successful code generation */ export declare function logUsage(params: { profile: string | null; prompt: string; code: string; model: string; stream: boolean; usage: GlmUsage | null; }): Promise; /** * Log failed code generation */ export declare function logError(params: { profile: string | null; prompt: string; model: string; stream: boolean; error: string; }): Promise;