import type { TrackedSession, SessionSummary } from "./types"; /** * SessionTracker tracks tool usage and delegations across sessions, * producing SessionSummary records when sessions end. * * Usage: * - Call `startSession()` when a session begins (or lazily on first tool call) * - Call `trackToolStart()` / `trackToolEnd()` on tool.execute.before/after * - Call `endSession()` when the session ends → writes summary to JSONL */ export declare class SessionTracker { private sessions; private directory; constructor(directory: string); /** * Start tracking a session. Idempotent — if already tracking, returns existing. */ startSession(sessionId: string): TrackedSession; /** * Track a tool execution start. Lazily starts the session if needed. */ trackToolStart(sessionId: string, toolName: string, callId: string, agent?: string): void; /** * Track a tool execution end. Records delegation if it was a task tool. */ trackToolEnd(sessionId: string, toolName: string, callId: string, agent?: string): void; /** * Set the agent name for a session. Only sets on first call (captures primary agent). */ setAgentName(sessionId: string, agentName: string): void; /** * Set the model ID for a session. Only sets on first call (captures primary model). * Safe to call for untracked sessions (no-op, no throw). */ trackModel(sessionId: string, modelId: string): void; /** * Accumulate dollar cost from a message into the session total. */ trackCost(sessionId: string, cost: number): void; /** * Track token usage from a message.updated event. * Accumulates all token fields into the session's running totals. * Lazily starts the session if needed. */ trackTokenUsage(sessionId: string, tokens: { input?: number; output?: number; reasoning?: number; cacheRead?: number; cacheWrite?: number; }): void; /** * End a session and persist the summary. Removes the session from tracking. * Returns the generated summary, or null if the session wasn't being tracked. */ endSession(sessionId: string): SessionSummary | null; /** * Check if a session is currently being tracked. */ isTracking(sessionId: string): boolean; /** * Get the current tracked session data (for inspection/testing). */ getSession(sessionId: string): TrackedSession | undefined; /** * Get the number of sessions currently being tracked. */ get activeSessionCount(): number; } /** * Create a new SessionTracker instance. */ export declare function createSessionTracker(directory: string): SessionTracker;