/** * Writing Session Manager * Tracks writing sessions, streaks, velocity, and motivation metrics */ import type { MCPClient } from '../core/database.js'; export interface WritingSession { id: number; projectId: number; sessionDate: string; startTime?: string; endTime?: string; wordsWritten: number; chaptersTouched?: number[]; sessionType: 'drafting' | 'revising' | 'planning' | 'editing'; notes?: string; moodBefore?: number; moodAfter?: number; createdAt: string; } export interface SessionSummary { totalSessions: number; totalWords: number; totalMinutes: number; averageWordsPerSession: number; averageWordsPerMinute: number; currentStreak: number; longestStreak: number; lastSessionDate?: string; sessionsThisWeek: number; sessionsThisMonth: number; wordsThisWeek: number; wordsThisMonth: number; } export interface SessionMetrics { sessionId: number; duration: number; wordsWritten: number; wordsPerMinute: number; chapterCount: number; moodChange?: number; } export interface Streak { current: number; longest: number; lastSessionDate?: string; streakStartDate?: string; } export declare class SessionManager { private mcpClient; private projectId; constructor(mcpClient: MCPClient, projectId: number); /** * Start a new writing session */ startSession(options: { sessionType: WritingSession['sessionType']; moodBefore?: number; notes?: string; }): Promise; /** * End current writing session */ endSession(options: { moodAfter?: number; notes?: string; chaptersPath?: string; }): Promise; /** * Get session summary statistics */ getSummary(days?: number): Promise; /** * Calculate current and longest streaks */ calculateStreak(): Promise; /** * Get recent sessions */ getRecentSessions(limit?: number): Promise; /** * Calculate words written by checking chapter files modified since session start */ private calculateWordsWritten; /** * Mark a session as having completed the pre-writing ritual checklist. * * Sets `ritual_completed = 1` on the session record identified by `sessionId`. * * @param sessionId - ID of the writing_sessions row to update. */ markRitualCompleted(sessionId: number): Promise; /** * Store the Pomodoro-style focus timer duration on a session. * * @param sessionId - ID of the writing_sessions row to update. * @param timerMinutes - Timer duration in minutes. */ setTimerMinutes(sessionId: number, timerMinutes: number): Promise; /** * End a session by ID, optionally recording a stop note. * * This is the SPEC-06 variant that takes a session ID directly rather than * always looking up today's session. * * @param sessionId - ID of the writing_sessions row to close. * @param stopNote - Optional "where I left off" note saved in stop_note. */ endSessionById(sessionId: number, stopNote?: string): Promise; /** * Return the most recent stop_note for this project, or null if none exists. */ getLastStopNote(): Promise; /** * Return the last `wordCount` words from the most recently modified chapter * file in `/chapters/`. * * @param projectPath - Root path of the novel project. * @param wordCount - Number of words to return (default 200). */ getLastChapterText(projectPath: string, wordCount?: number): Promise; /** * Count words in text */ private countWords; /** * Calculate duration in minutes */ private calculateDuration; /** * Get today's date in YYYY-MM-DD format */ private getTodayDate; /** * Get date N days ago in YYYY-MM-DD format */ private getDateDaysAgo; /** * Add days to date string */ private addDays; } //# sourceMappingURL=session-manager.d.ts.map