import type { UsageSource } from "./source.js"; import { PerformanceMonitor } from "./performance.js"; import type { PerformanceSummary } from "./performance.js"; import type { RuntimeSummary } from "./runtime.js"; import { RuntimeMonitor } from "./runtime-monitor.js"; import type { ContextSources } from "./context-sources.js"; import type { ContextUsage, ModelCost, RequestDetails, Summary } from "./usage.js"; export interface UsageState { status: "loading" | "ready" | "stale" | "unavailable"; summary?: Summary; context?: ContextUsage | undefined; details?: { request?: RequestDetails | undefined; models: readonly ModelCost[]; sources?: ContextSources | undefined; sessionTitle?: string | undefined; }; performance?: PerformanceSummary; runtime?: RuntimeSummary; model?: string; } export interface UsageEvent { type: string; data: unknown; id?: string; created?: number; } export type Subscribe = (listener: (event: UsageEvent) => void) => () => void; /** Owns snapshot refreshes and throttled in-memory performance updates for one mounted view. */ export declare class UsageController { private readonly source; private readonly publish; private readonly delay; private readonly retryDelay; private readonly performanceDelay; private readonly detailed; private state; private snapshot; private sessionID; private generation; private request; private timer; private retry; private performanceTimer; private sessions; private changed; private fullScan; private prepared; private pending; private disposed; private unsubscribe; private readonly unsubscribePerformance; private readonly performance; private readonly ownsPerformance; private readonly runtime; private readonly ownsRuntime; private readonly unsubscribeRuntime; private stopRuntimeTick; private preparedRuntime; private running; private runtimeFresh; constructor(source: UsageSource, subscribe: Subscribe, publish: (state: UsageState) => void, delay?: number, retryDelay?: number, performanceDelay?: number, performance?: PerformanceMonitor, detailed?: boolean, runtime?: RuntimeMonitor); select(sessionID: string): void; refresh(): void; /** The TUI supplies the viewed session's reactive native status, never its children's status. */ setRunning(running: boolean): void; private schedule; dispose(): void; private update; private stopRuntime; private runtimeSummary; private refreshRuntime; private refreshPerformance; private run; }