/** * Backfills `turn.completed` events with model + token usage by tail-reading * the Claude Code transcript JSONL named in the hook payload's * `transcript_path`. The assistant's message text itself comes straight off * the Stop hook payload (`last_assistant_message`, see normalizer.ts) — it's * available synchronously and doesn't depend on the transcript file, which * may not exist on disk yet (or at all) at the moment Stop fires. This * module only ever *supplements* that with model/usage, and falls back to * its own transcript-derived text if the hook payload somehow didn't have * one. * * Transcripts can grow to hundreds of MB over a long session, so this only * ever reads the last ~2MB from the end of the file. */ import type { AnalyticsEvent } from "../../shared/types.js"; export interface TranscriptTurn { model: string | null; assistantText: string | null; usage: { inputTokens: number | null; outputTokens: number | null; } | null; } /** * Read the last `maxBytes` of a transcript JSONL file and return the most * recent assistant turn found in it, or `null` if the file is missing, * unreadable, or has no assistant turn in the tail window. */ export declare function readLastAssistantTurn(transcriptPath: string, maxBytes?: number): Promise; /** * Enrich a `turn.completed` event's payload with transcript data (model, * usage, and a fallback assistantText). No-op for any other event type, or * when no transcript path is available, or when the transcript can't be * read (e.g. not written to disk yet) — none of that should ever clobber * the assistantText the Stop hook payload already supplied. */ export declare function enrichTurnCompleted(event: AnalyticsEvent, transcriptPath: string | undefined, maxBytes?: number): Promise; //# sourceMappingURL=transcript.d.ts.map