export type TerminalGraphicRenderQueueMetric = Readonly<{ type: "cache-hit"; key: string; }> | Readonly<{ type: "cache-store"; key: string; bytes: number; }> | Readonly<{ type: "evict"; key: string; bytes: number; }> | Readonly<{ type: "queue-wait"; key: string; waitMs: number; }> | Readonly<{ type: "render-abort"; key: string; }>; export type TerminalGraphicRenderQueueOptions = Readonly<{ maxConcurrency?: number; maxEntries?: number; maxBytes?: number; ttlMs?: number; /** * Share in-flight renders for equal cache keys. * * Keep this disabled when render work observes a caller AbortSignal. This is * the safe default for viewport-bound graphics in virtual scrollers: an * offscreen row may abort while another still-visible row with the same cache * key is still valid. Duplicate queued renders are still cheap because each * task re-checks the cache after acquiring a concurrency slot, so a render * completed by an earlier row is reused instead of rendering again. */ dedupeInflight?: boolean; onMetric?: (metric: TerminalGraphicRenderQueueMetric) => void; }>; export type TerminalGraphicRenderQueue = Readonly<{ cached: (key: string, signal: AbortSignal | undefined, render: () => Promise, estimateBytes?: (value: T) => number, options?: Readonly<{ dedupeInflight?: boolean; }>) => Promise; clear: () => void; stats: () => Readonly<{ active: number; waiting: number; cacheEntries: number; cacheBytes: number; }>; }>; export declare function createTerminalGraphicRenderQueue(options?: TerminalGraphicRenderQueueOptions): TerminalGraphicRenderQueue;