/** * Transcript facts for a work record (#1349). * * Reads a bounded tail of the doer's Claude Code transcript and keeps only * what happened inside the task window: failed tool calls (with whether the * same call later succeeded), files written, PR / commit references and * messages posted. Only the main chain counts (`isSidechain` entries belong * to subagents). Tool results are read for their error flag and the first * line of an exit code, never copied. * * Codex rollouts are not read (their shape differs; the trace covers them). * * @module services/wiki/work-record-transcript */ import type { WorkRecordError } from './work-record.js'; /** What the transcript slice says about a task. */ export interface TranscriptWindowFacts { errors: WorkRecordError[]; filesWritten: string[]; urls: string[]; commits: string[]; /** Messages the agent posted through a reply / post skill. */ posts: number; /** Tool calls seen inside the window. */ toolCalls: number; } /** Task window. */ export interface TranscriptWindow { fromMs: number; toMs: number; } /** * Read the end of a file as whole lines (the first partial line is dropped). * * @param file - Path * @param maxBytes - Bytes from the end * @returns Text, '' when the file cannot be read */ export declare function readTranscriptTail(file: string, maxBytes?: number): Promise; /** * Facts from whole Claude transcript lines inside a window. * * @param text - JSONL text (whole lines) * @param window - Task window (epoch ms); entries outside it are ignored * @param roots - Project roots to make file paths relative to * @returns Facts (empty when nothing fell in the window) * * @example * ```typescript * const facts = parseClaudeTranscriptWindow(await readTranscriptTail(file), { fromMs, toMs }, [projectPath]); * facts.errors; // [{ what: 'Bash `npm test` exit 1', resolved: 'fixed' }] * ``` */ export declare function parseClaudeTranscriptWindow(text: string, window: TranscriptWindow, roots?: readonly string[]): TranscriptWindowFacts; /** * Whether a transcript is worth reading for an item that ended at `endedMs`: * the tail only holds recent turns. * * @param endedMs - When the item ended (epoch ms) * @param now - Clock * @returns True when the window may still be in the tail */ export declare function transcriptWorthReading(endedMs: number, now?: number): boolean; //# sourceMappingURL=work-record-transcript.d.ts.map