/**
 * Claude Session Token Reader
 *
 * Reads per-turn token usage from Claude Code's session JSONL files.
 * Claude Code stores conversations at:
 *   ~/.claude/projects/{path-slug}/{sessionId}.jsonl
 *
 * Each assistant message includes an API `usage` object with exact
 * token counts (input_tokens, output_tokens, cache tokens).
 *
 * Used as the primary token source for claude-code agents because
 * Claude Code's TUI status bar is not capturable from PTY scrollback.
 *
 * @module services/monitoring/claude-session-tokens
 */
/** Aggregated token usage for a time window. */
export interface SessionTokenSummary {
    inputTokens: number;
    outputTokens: number;
    cacheReadTokens: number;
    cacheCreateTokens: number;
    cost: number;
    model: string;
    turnCount: number;
}
/**
 * Encodes an absolute path into the slug format used by Claude Code
 * for its projects directory. Replaces `/` with `-`.
 *
 * @param projectPath - Absolute path (e.g. /Users/alice/.crewly)
 * @returns Encoded slug (e.g. -Users-alice--crewly)
 */
export declare function encodeProjectSlug(projectPath: string): string;
/**
 * Returns the path to a Claude Code session JSONL file.
 *
 * @param projectPath - The agent's working directory
 * @param sessionId - Claude Code conversation UUID
 * @returns Absolute path to the .jsonl file
 */
export declare function getSessionJsonlPath(projectPath: string, sessionId: string): string;
/**
 * Finds the most recently modified .jsonl session file in a Claude Code
 * project directory. Used as a fallback when the session ID is not known
 * (e.g. the orchestrator session, which may not have been persisted yet).
 *
 * @param projectPath - The agent's working directory
 * @returns The session UUID, or null if no JSONL files found
 */
export declare function findLatestSessionId(projectPath: string): Promise<string | null>;
/**
 * Reads token usage from a Claude Code session JSONL, summing all
 * assistant turns whose timestamp is at or after `since`.
 *
 * Reads the file from the end backwards for efficiency — recent
 * entries are at the tail.
 *
 * @param projectPath - The agent's working directory
 * @param sessionId - Claude Code conversation UUID (if null, auto-detects latest)
 * @param since - Only count turns at or after this time
 * @param until - Only count turns before this time (defaults to now)
 * @returns Aggregated token summary, or null if the file doesn't exist
 */
export declare function getTokensSince(projectPath: string, sessionId: string | null, since: Date, until?: Date): Promise<SessionTokenSummary | null>;
/**
 * Scans all Claude Code session JSONL files for a project and feeds
 * aggregated per-session token data into TokenUsageService.
 *
 * This bridges the gap between Claude Code's file-based token tracking
 * and the in-memory TokenUsageService that powers the Usage dashboard.
 * Should be called once during server startup.
 *
 * Only processes sessions modified in the last `maxAgeDays` to avoid
 * scanning hundreds of old session files.
 *
 * @param projectPath - The project's working directory
 * @param maxAgeDays - Only process sessions modified within this many days (default: 7)
 * @returns Number of sessions loaded
 */
export declare function syncSessionsToTokenUsageService(projectPath: string, maxAgeDays?: number): Promise<number>;
//# sourceMappingURL=claude-session-tokens.service.d.ts.map