/**
 * Session management utilities
 */
import type { SessionLog, NdjsonRecord } from '../../shared/utils/index.js';
export type { SessionLog, NdjsonWorkflowStart, NdjsonStepStart, NdjsonStepComplete, NdjsonWorkflowComplete, NdjsonWorkflowAbort, NdjsonPhaseStart, NdjsonPhaseComplete, NdjsonPhaseJudgeStage, NdjsonInteractiveStart, NdjsonInteractiveEnd, NdjsonRecord, } from '../../shared/utils/index.js';
/** Failure information extracted from session log */
export interface FailureInfo {
    /** Last step that completed successfully */
    lastCompletedStep: string | null;
    /** Step that was in progress when failure occurred */
    failedStep: string | null;
    /** Total iterations consumed */
    iterations: number;
    /** Error message from workflow_abort record */
    errorMessage: string | null;
    /** Session ID extracted from log file name */
    sessionId: string | null;
}
/**
 * Manages session lifecycle: ID generation, NDJSON logging,
 * and session log creation/loading.
 */
export declare class SessionManager {
    /** Append a single NDJSON line to a log file */
    appendNdjsonLine(filepath: string, record: NdjsonRecord): void;
    /** Initialize an NDJSON log file with the workflow_start record */
    initNdjsonLog(sessionId: string, task: string, workflowName: string, options: {
        logsDir: string;
    }): string;
    /** Load an NDJSON log file and convert it to a SessionLog */
    loadNdjsonLog(filepath: string): SessionLog | null;
    /** Generate a session ID */
    generateSessionId(): string;
    /** Generate report directory name from task and timestamp */
    generateReportDir(task: string): string;
    /** Create a new session log */
    createSessionLog(task: string, projectDir: string, workflowName: string): SessionLog;
    /** Create a finalized copy of a session log (immutable) */
    finalizeSessionLog(log: SessionLog, status: 'completed' | 'aborted'): SessionLog;
    /** Load session log from a .jsonl file */
    loadSessionLog(filepath: string): SessionLog | null;
}
export declare function appendNdjsonLine(filepath: string, record: NdjsonRecord): void;
export declare function initNdjsonLog(sessionId: string, task: string, workflowName: string, options: {
    logsDir: string;
}): string;
export declare function loadNdjsonLog(filepath: string): SessionLog | null;
export declare function generateSessionId(): string;
export declare function generateReportDir(task: string): string;
export declare function createSessionLog(task: string, projectDir: string, workflowName: string): SessionLog;
export declare function finalizeSessionLog(log: SessionLog, status: 'completed' | 'aborted'): SessionLog;
export declare function loadSessionLog(filepath: string): SessionLog | null;
/**
 * Extract failure information from an NDJSON session log file.
 *
 * @param filepath - Path to the .jsonl session log file
 * @returns FailureInfo or null if file doesn't exist or is invalid
 */
export declare function extractFailureInfo(filepath: string): FailureInfo | null;
//# sourceMappingURL=session.d.ts.map