/** * Structured run logger. * * Provides a common logging facility that writes structured log lines to * contextual log files under `~/.a5c/logs/`. Each log type maps to a * specific file name within the run directory or the global log root: * * - `process` → `/process.log` (ctx.log in process definitions) * - `hook` → `/hooks.log` (hook execution, per-run) * - `hook` → `hooks.log` (hook execution, no runId) * - `cli` → `cli.log` (CLI command operations) * * Log lines are append-only, one JSON object per line (JSONL), making them * easy to parse, grep, and stream. */ export type RunLogLevel = "debug" | "info" | "warn" | "error"; /** Determines which log file receives the entry. */ export type LogType = "process" | "hook" | "cli"; export interface RunLogEntry { timestamp: string; level: RunLogLevel; /** Log type — controls which file the entry is written to. */ type?: LogType; label?: string; message: string; runId?: string; processId?: string; source?: string; context?: Record; } export interface RunLoggerOptions { runId: string; processId?: string; /** Override the default log root (`~/.a5c/logs`). */ logDir?: string; /** Source tag (e.g. "ctx.log", "hook:run", "hook:stop"). */ source?: string; /** Default log type for all entries from this logger. */ type?: LogType; } export declare function getDefaultLogDir(): string; /** * Resolve the log file path for a given entry. * * - With `runId`: `//.log` * - Without `runId`: `/.log` */ export declare function resolveLogPath(logDir: string, logType: LogType, runId?: string): string; /** @deprecated Use resolveLogPath instead. Kept for backwards compat. */ export declare function getRunLogPath(logDir: string, runId: string): string; /** @deprecated Use resolveLogPath instead. Kept for backwards compat. */ export declare function getGlobalLogPath(logDir: string): string; export declare function formatLogLine(entry: RunLogEntry): string; /** * Append a single structured log entry to the appropriate log file. * * File selection uses the entry's `type` field (defaults to "process"): * - With `runId`: `//.log` * - Without `runId`: `/.log` * * Creates parent directories on first write. Returns the resolved log * file path. */ export declare function appendRunLog(entry: RunLogEntry, options?: { logDir?: string; }): Promise; /** * Create a bound logger for a specific run. * * The returned object provides level-specific methods (`info`, `warn`, etc.) * that automatically populate `runId`, `processId`, `source`, and `type` on * every entry. Each method is fire-and-forget: errors are swallowed so * logging never breaks orchestration. */ export declare function createRunLogger(options: RunLoggerOptions): { debug: (label: string, message: string, context?: Record) => void; info: (label: string, message: string, context?: Record) => void; warn: (label: string, message: string, context?: Record) => void; error: (label: string, message: string, context?: Record) => void; /** Raw write — lets callers specify the level explicitly. */ log: (level: RunLogLevel, label: string, message: string, context?: Record) => void; /** Returns a promise that resolves when all queued writes have completed. */ flush: () => Promise; }; //# sourceMappingURL=runLogger.d.ts.map