/** * Cost tracking journal helpers for Babysitter SDK. * * Provides functions to append COST_TRACKED events to the run journal, * extract cost events from a journal, and compute aggregated cost statistics. */ import type { AppendEventResult, JournalEvent } from "../storage/types"; import type { CostEventData, RunCostStats } from "./types"; /** Journal event type constant for cost tracking events. */ export declare const COST_TRACKED_EVENT_TYPE = "COST_TRACKED"; /** * Append a COST_TRACKED event to a run's journal. * * Computes the USD cost (if not already set) before persisting so that the * journal record is self-contained. * * @param runDir - Absolute path to the run directory. * @param costData - Token usage and metadata for the cost event. * @returns The append result with seq, ulid, filename, checksum, path, and recordedAt. */ export declare function appendCostEvent(runDir: string, costData: CostEventData): Promise; export declare function appendCostEventOnce(runDir: string, costData: CostEventData): Promise; /** * Filter journal events to only COST_TRACKED entries. * * @param events - Full journal event list (as returned by `loadJournal`). * @returns Subset of events whose type is COST_TRACKED. */ export declare function extractCostEvents(events: JournalEvent[]): JournalEvent[]; /** * Compute aggregated cost statistics for a run from its journal events. * * Extracts COST_TRACKED events, then accumulates totals with per-model and * per-task-kind breakdowns. * * @param runId - The run identifier (included in the returned stats object). * @param events - Full journal event list for the run. * @returns Aggregated cost stats for the run. */ export declare function computeRunCostStats(runId: string, events: JournalEvent[]): RunCostStats; //# sourceMappingURL=journal.d.ts.map