/** * Session Manager - manages Claude Code terminal sessions * * Handles the full lifecycle including: * - Spawning Claude Code processes * - Creating Flow automations for reply routing * - Cleaning up Flows when sessions end */ import { Session, SessionResponse, PermissionResponse } from './types'; interface SpawnOptions { workingDir: string; initialPrompt: string; groupId: string; } export declare class SessionManager { private sessions; private sdk; private apiKey; private maxSessions; private pcResourceId?; private routerScriptId?; private routerScriptIdPromise?; constructor(apiKey: string, pcResourceId?: string); /** * Get the Claude Code router script ID from the server * Uses listMarketplaceScripts with system filter to find it * Caches the result for subsequent calls */ private getRouterScriptId; /** * Generate a unique session ID */ private generateSessionId; /** * Create a Flow for routing replies back to this session */ private createSessionFlow; /** * Delete the Flow for a session */ private deleteSessionFlow; /** * Send Claude's output directly to Mirra * This is a fallback when hooks aren't working */ private sendOutputToMirra; /** * Send a session status message to Mirra * Used for immediate feedback when sessions start/stop * Returns the messageId for subsequent updates */ private sendSessionStatus; /** * Spawn a new Claude Code session */ spawnSession(options: SpawnOptions): Promise; /** * Send input to a session * * For child_process sessions (using -p mode), this spawns a new Claude * with --resume to maintain conversation context using Claude's session ID. * For pty sessions, this writes directly to the terminal. */ sendInput(sessionId: string, input: string): Promise; /** * Send user response to a permission prompt * * Writes the user's selection (allow/deny) to Claude Code's stdin. * Claude Code interprets single key inputs for permission prompts: * - 'y' or Enter = allow * - 'a' = allow always (for this session) * - 'n' or Escape = deny */ sendUserResponse(sessionId: string, response: PermissionResponse): Promise; /** * Kill a session */ killSession(sessionId: string): Promise; /** * Get a session by ID */ getSession(sessionId: string): Session | undefined; /** * List all sessions */ listSessions(): SessionResponse[]; /** * Kill all sessions */ killAllSessions(): Promise; /** * Get count of active sessions */ getActiveCount(): number; } export {}; //# sourceMappingURL=session-manager.d.ts.map