/** * lib.ts — Public library API for @statforge/claudestat * * @experimental v1.13.0 — Surface may change in any minor/patch release until v2.0.0. * See docs/LIBRARY.md for usage examples. * * Re-exports pure analysis/pricing modules and the read-only dbOps namespace. * dbOps is proxied via lib-guard so that the first read triggers a daemon * health check (configurable via configure()). */ export declare const dbOps: { upsertSession(s: import("./db").SessionRow): void; insertEvent(e: import("./db").EventRow): number; insertOcEvent(sessionId: string, toolName: string, ts: number, durationMs: number, externalId: string): void; insertSessionIfAbsent(s: import("./db").SessionRow): void; pairPostWithPre(sessionId: string, toolName: string, response: string, postTs: number): number | null; updateSessionCost(sessionId: string, cost: import("./db").CostUpdate, efficiencyScore: number, loopsDetected: number, exactRetries?: number, errorRate?: number, fileChurnScore?: number, seqCycleCount?: number): void; getSessionEvents(sessionId: string): import("./db").EventRow[]; getSession(sessionId: string): import("./db").SessionRow | undefined; getLatestSession(): import("./db").SessionRow | undefined; getLatestClaudeSession(): import("./db").SessionRow | undefined; getLatestOpencodeSession(): import("./db").SessionRow | undefined; getAllSessions(limit?: number): import("./db").SessionRow[]; getSessionsInRange(startMs: number, endMs: number): import("./db").SessionRow[]; getSessionEventsRecent(sessionId: string, limit?: number): import("./db").EventRow[]; getLastRealEventTimes(): Map; updateSessionProject(sessionId: string, projectPath: string): void; touchSession(sessionId: string, now?: number): void; getRecentSessions(days: number): any[]; getProjectAggregates(): any[]; getProjectToolCounts(projectPath: string): { tool_name: string; count: number; }[]; getProjectSessionStats(projectPath: string): any; getProjectCliHours(): { project_path: string; source: string; total_ms: number; }[]; getProjectStatsBySource(projectPath: string): { source: string; session_count: number; total_cost_usd: number; total_tokens: number; avg_efficiency: number | null; avg_loops: number; last_active: number | null; dominant_model: string | null; }[]; getProjectRecentExtremes(projectPath: string): { heavy_loop_sessions: number; recent_sessions: number; max_session_cost: number; }; updateSessionSummary(sessionId: string, summary: string): void; updateSessionParent(sessionId: string, parentId: string): void; getChildSessions(parentSessionId: string): { id: string; dominant_model?: string; total_cost_usd?: number; started_at: number; }[]; getHiddenCostStats(days: number): { loop_waste_usd: number; total_cost_usd: number; loop_sessions: number; total_loops: number; total_sessions: number; }; insertWeeklyReport(date: string, markdown: string): void; deleteWeeklyReport(date: string): void; listWeeklyReports(): { id: number; date: string; preview: string; created_at: string; }[]; getWeeklyReportByDate(date: string): { id: number; date: string; report_markdown: string; created_at: string; } | undefined; getQuotaStats(since: number): Array<{ total_tokens: number; total_cost_usd: number; }>; getModeDistribution(days: number): { direct: number; mini: number; pipeline: number; total: number; }; getAnalyticsDaily(since: number): any[]; getAnalyticsByModel(since: number): any[]; getProjectHours(since: number): any[]; getCoachEvents(sessionIds: string[]): { session_id: string; type: string; tool_name: string | null; tool_input: string | null; ts: number; }[]; getTopTools(days?: number, by?: "cost" | "count" | "duration", limit?: number, source?: "all" | "claude-code" | "opencode"): { tool_name: string; source: string; count: number; total_duration_ms: number; total_cost_usd: number; }[]; getToolCountsForSession(sessionId: string): Record | null; getToolCountsByRange(startMs: number, endMs: number, source?: "claude-code" | "opencode" | "all"): Record | null; getWeeklyInsight(days?: number): { total_sessions: number; total_cost: number; input_tokens: number; output_tokens: number; cache_read: number; total_loops: number; avg_efficiency: number; week_start: number; week_end: number; }; getPrevWeekInsight(): { total_sessions: any; total_cost: any; input_tokens: any; output_tokens: any; cache_read: any; total_loops: any; avg_efficiency: any; week_start: any; week_end: any; }; setMeta(key: string, value: string): void; getMeta(key: string): string | undefined; getCostProjection(days?: number): { total_cost_usd: number; earliest: number; latest: number; }; getProjectCosts(days?: number): { project: string; session_count: number; total_cost: number; }[]; getHourlyDistribution(days?: number): { hour: number; session_count: number; }[]; updateSessionSemantic(sessionId: string, avgOutputChars: number, errorBlockCount: number, semanticLoopCount?: number): void; upsertAssistantTurns(sessionId: string, turns: import("./db").AssistantTurnRow[]): void; getAssistantTurns(sessionId: string): import("./db").AssistantTurnRow[]; getCacheReadByModel(days: number): { model: string; cache_read: number; }[]; getModelBreakdown(days: number): { model: string; total_cost: number; session_count: number; }[]; insertIntent(tool: string, sessionId: string, taskDesc: string | undefined): number; insertIntentFile(intentId: number, filePath: string, operation: string, lineStart?: number, lineEnd?: number): void; getWriteConflicts(filePaths: string[], excludeTool: string): { file_path: string; tool: string; session_id: string; task_desc: string | null; acquired_at: number; }[]; getIntent(id: number): { tool: string; session_id: string; task_desc: string | null; } | undefined; releaseIntent(id: number): void; heartbeatIntent(id: number): void; getIntentFiles(id: number): { file_path: string; operation: string; }[]; getActiveToolsInProject(projectPath: string, excludeTool: string): { source: string; last_event_at: number; }[]; releaseOrphanedIntents(): void; markStaleIntents(): { id: number; tool: string; task_desc: string | null; }[]; deleteOldStaleIntents(): void; hasActiveIntent(tool: string, filePath: string): boolean; getActiveIntents(): { id: number; tool: string; file_path: string; }[]; getBillingBlocks(limit?: number): import("./db").BillingBlock[]; getDailyActivity(days?: number): import("./db").DailyActivity[]; getToolSparklines(tools: string[], days: number): Record; getDbStats(): { sizeKb: number; oldestEventAt: number | null; totalEvents: number; }; getDailySummary(): import("./db").DailySummary; upsertOrchRun(row: Omit): void; getOrchRuns(projectPath: string): import("./db").OrchRunRow[]; getOrchRun(runKey: string): import("./db").OrchRunRow | undefined; upsertOrchCycleTrace(runKey: string, cycleIndex: number, traceJson: string): void; getOrchCycleTrace(runKey: string, cycleIndex: number): string | null; getOrchAggregates(projectPath: string): { avg_cost_per_cycle: number; avg_duration_secs: number; avg_error_rate: number; avg_verify_pass_rate: number; total_runs: number; }; }; export { configure } from './lib-guard'; export { DaemonNotRunningError } from './lib-guard'; export type { SessionRow, AssistantTurnRow, EventRow, BlockCostEntry, CostUpdate, BillingBlock, DailyActivity, DailySummary, OrchRunRow, } from './db'; export { findPricing, estimateCost, estimateTokensFromToolCounts, MODEL_PRICING, } from './model-pricing'; export type { ModelPrice } from './model-pricing'; export { getContextWindow, KNOWN_CONTEXT_WINDOWS, PRICING, } from './pricing'; export type { ModelPricing } from './pricing'; export { analyzeSession, detectLoops, calcEfficiencyScore, detectExactRetries, computeErrorRate, computeFileChurn, detectSeqCycles, predictSaturation, } from './intelligence'; export type { LoopAlert, LoopContext, IntelligenceReport, SaturationPrediction, } from './intelligence'; export { analyzePatterns } from './pattern-analyzer'; export type { PatternInsight, SessionStats, RecentExtremes, SourceStat, } from './pattern-analyzer'; export { computeProjection } from './cost-projector'; export type { CostProjection, PeriodProjection, DayPoint, } from './cost-projector'; export { getWeeklyInsightData, getUsageInsights, } from './insights'; export type { WeeklyInsightData, UsageInsightsData, } from './insights'; export { computeQuota } from './quota-tracker'; export type { QuotaData } from './quota-tracker'; export { createMcpServer } from './mcp-factory'; export type { ToolDefinition, McpServer, McpServerOptions } from './mcp-factory';