import type { RuntimeLogStore } from './types'; /** * Structured record emitted for every log line. Consumers (e.g. the editor * server) use this to stream process-level detail into UIs alongside the * on-disk pipeline.log. `taskId` is extracted from a `[task:]` prefix * when the call site passes one, or overridden explicitly via the optional * `taskId` argument on `section`/`quiet` (which carry no prefix). */ export type LogLevel = 'info' | 'warn' | 'error' | 'debug' | 'section' | 'quiet'; export interface LogRecord { readonly level: LogLevel; readonly taskId: string | null; readonly timestamp: string; readonly text: string; } export type LogListener = (record: LogRecord) => void; /** * Dual-channel logger. * * - `info/warn/error` → console AND file (brief, user-visible events) * - `debug` → file ONLY (verbose diagnostics) * - `section` → file ONLY (visual separators) * - `quiet` → file ONLY (bulk payload like full stdout dumps) * * Log file path: /.tagma/logs//pipeline.log (one file per pipeline run, * truncated on construction). Every line is also forwarded to the optional * `onLine` callback as a structured `LogRecord`, so callers that want to * stream the run process over IPC/SSE don't need to tail the file. */ export declare class Logger { private readonly sink; private readonly onLine; constructor(workDir: string, runId: string, logStore: RuntimeLogStore, onLine?: LogListener); info(prefix: string, message: string): void; warn(prefix: string, message: string): void; error(prefix: string, message: string): void; /** File-only diagnostic log line. */ debug(prefix: string, message: string): void; /** File-only visual separator with title. */ section(title: string, taskId?: string | null): void; /** File-only bulk payload (e.g. full stdout / stderr dumps). */ quiet(message: string, taskId?: string | null): void; private append; /** Close the persistent file handle. Called by the engine at run completion. */ close(): void; private emit; get path(): string; /** Directory that holds all artifacts for this run (pipeline.log, *.stderr, etc.). */ get dir(): string; } export declare function redactLogText(text: string): string; /** Return the last `n` non-empty lines of `text`, joined with newlines. */ export declare function tailLines(text: string, n: number): string; /** * Truncate a blob to at most `maxBytes` UTF-8 bytes for log embedding, * appending a marker when truncation occurred. * Uses TextEncoder so CJK and emoji (multi-byte) characters are counted correctly. */ export declare function clip(text: string, maxBytes?: number): string; //# sourceMappingURL=logger.d.ts.map