/** * CLI Session Manager - Handles session lifecycle and management for CLI commands */ import type { SessionContextManager } from '../session/context.js'; import type { SessionLifecycle } from '../session/lifecycle.js'; import type { ContextWindowUsage } from '../types/session.types.js'; import type { CommandExecutionOptions } from './command-executor.js'; /** * Result of session acquisition with resume status */ export interface SessionAcquisitionResult { /** Whether the session was resumed from an existing session */ isResumed: boolean; /** The session context manager */ sessionManager: SessionContextManager; } export declare class CLISessionManager { private sessionLifecycle; /** Track whether last session was resumed */ private lastSessionResumed; /** Worktree stats tracker for the current session */ private worktreeStatsTracker; constructor(sessionLifecycle: SessionLifecycle); /** * Get or create appropriate session for command execution * Returns both the session manager and whether it was resumed */ getOrCreateSession(options: CommandExecutionOptions): Promise; /** * Get or create session with detailed status about whether it was resumed */ getOrCreateSessionWithStatus(options: CommandExecutionOptions): Promise; /** * Set up worktree stats tracker for the current session */ private setupWorktreeStatsTracker; /** * Check if the last session was resumed (vs newly created) */ wasLastSessionResumed(): boolean; /** * Add token usage to session and return total session tokens */ addTokenUsage(tokensUsed: number): number; /** * Get current session token total */ getTotalSessionTokens(): number; /** * Update context window usage for the session * @param model The model being used * @param promptTokens Tokens used in the prompt/context */ updateContextWindowUsage(model: string, promptTokens: number): ContextWindowUsage | null; /** * Get current context window usage */ getContextWindowUsage(): ContextWindowUsage | null; /** * Persist session after command execution */ persistSession(result: { success: boolean; }): Promise; /** * Check if there's an active session */ hasActiveSession(): boolean; /** * Complete the active session */ completeSession(): Promise; } //# sourceMappingURL=session-manager.d.ts.map