/** * Session Detector * * Tracks Claude Code sessions and agents by watching .jsonl files. * * HOW IT WORKS: * 1. Starts monitoring ALL .jsonl files immediately when created * 2. Every tool response includes "pid:XXXXX" (added in index.ts) * 3. After first tool, verify(pid) sets the PID to filter for * 4. Detects session changes, agent activity, and tracks entry counts * * STREAMS: * - session$: Emits when main session changes (PID in different {uuid}.jsonl) * - agents$: Emits when agent list changes (PID in agent-{uuid}.jsonl files) * - entryCount$: Emits running count of entries in current session file */ import { Observable } from 'rxjs'; export interface SessionInfo { sessionId: string; shortId: string; sessionFile: string; detectedAt: number; } export interface AgentInfo { agentId: string; shortId: string; agentFile: string; startedAt: number; } export interface SessionState { mainSession: SessionInfo | null; activeAgents: AgentInfo[]; entryCount: number; } export interface SessionDetector { session$: Observable; agents$: Observable; entryCount$: Observable; getState(): SessionState; verify(pid: number): void; stop(): void; } /** * Create a session detector that tracks sessions and agents */ export declare function createSessionDetector(cwd: string): SessionDetector; //# sourceMappingURL=session-detector.d.ts.map