/** * Public helpers for aggregating cost/token usage from an event stream or * a stored session transcript. These mirror the internal accumulators in * run-handle-cost.ts but accept any iterable of AgentEvent — so callers can * use them on live streams (`handle.events()`) and on session files read * back later (`sessions.read(id).events`) with the same shape. */ import type { AgentEvent } from './events.js'; export interface EventCostSummary { totalUsd: number; inputTokens: number; outputTokens: number; thinkingTokens: number; cachedTokens: number; totalTokens: number; costEventCount: number; } /** Fold every `cost` event in a collection into a single summary. */ export declare function sumCost(events: Iterable): EventCostSummary; /** Async variant — fold cost events as they arrive on a live stream. */ export declare function sumCostAsync(events: AsyncIterable): Promise; /** * Filter an event iterable to a single event type, with correct narrowing. * `for (const ev of filterEvents(events, 'text_delta')) ev.delta ...` */ export declare function filterEvents(events: Iterable, type: T): Generator>; export declare function filterEventsAsync(events: AsyncIterable, type: T): AsyncGenerator>;