/** * GitHub Copilot Session Management * * Handles session ID discovery via log file polling. * Copilot CLI creates log files named .log in the specified directory. * * @module execution-engine/agents/copilot */ /** * Default polling configuration */ export declare const SESSION_DISCOVERY_CONFIG: { /** Polling interval in milliseconds */ readonly POLL_INTERVAL_MS: 200; /** Timeout in milliseconds (10 minutes) */ readonly TIMEOUT_MS: 600000; }; /** * Create a unique temporary log directory for Copilot session logs * * Directory structure: /copilot_logs/// * * @param workDir - Working directory path (used for naming) * @returns Absolute path to created log directory * * @example * ```typescript * const logDir = await createTempLogDir('/path/to/project'); * // Returns: /tmp/copilot_logs/project/a1b2c3d4-.../ * ``` */ export declare function createTempLogDir(workDir: string): Promise; /** * Validate if a string is a valid UUID format * * @param str - String to validate * @returns True if string matches UUID format * * @example * ```typescript * isValidUUID('550e8400-e29b-41d4-a716-446655440000'); // true * isValidUUID('not-a-uuid'); // false * ``` */ export declare function isValidUUID(str: string): boolean; /** * Watch log directory for session ID file creation * * Polls the directory every 200ms looking for a .log file with a UUID filename. * Times out after 10 minutes if no session file is found. * * **How it works**: * 1. Read directory contents * 2. Look for files ending in .log * 3. Extract filename without extension * 4. Validate it's a UUID * 5. Return the UUID as session ID * * @param logDir - Directory to watch for session log files * @param options - Optional polling configuration * @returns Promise that resolves with session ID * @throws Error if no session file found within timeout * * @example * ```typescript * const logDir = await createTempLogDir('/path/to/project'); * * // Start watching (this will poll until file appears) * const sessionId = await watchSessionId(logDir); * console.log('Session ID:', sessionId); * ``` */ export declare function watchSessionId(logDir: string, options?: { pollIntervalMs?: number; timeoutMs?: number; }): Promise; /** * Extract session ID from Copilot log filename * * Helper function to extract and validate session ID from a log filename. * Handles both formats: * - `.log` (older format) * - `session-.log` (current format) * * @param filename - Log filename (e.g., "session-550e8400-e29b-41d4-a716-446655440000.log") * @returns Session ID if valid, null otherwise * * @example * ```typescript * extractSessionId('session-550e8400-e29b-41d4-a716-446655440000.log'); * // Returns: '550e8400-e29b-41d4-a716-446655440000' * * extractSessionId('550e8400-e29b-41d4-a716-446655440000.log'); * // Returns: '550e8400-e29b-41d4-a716-446655440000' * * extractSessionId('invalid.log'); * // Returns: null * ``` */ export declare function extractSessionId(filename: string): string | null; /** * Format session ID for stdout injection * * Creates the special marker line that gets injected into stdout * for downstream processing. * * @param sessionId - Session UUID * @returns Formatted session line with newline * * @example * ```typescript * formatSessionLine('550e8400-e29b-41d4-a716-446655440000'); * // Returns: '[copilot-session] 550e8400-e29b-41d4-a716-446655440000\n' * ``` */ export declare function formatSessionLine(sessionId: string): string; /** * Parse session ID from stdout line * * Checks if a line contains a session ID marker and extracts it. * * @param line - Output line from Copilot * @returns Session ID if line contains marker, null otherwise * * @example * ```typescript * parseSessionLine('[copilot-session] 550e8400-e29b-41d4-a716-446655440000\n'); * // Returns: '550e8400-e29b-41d4-a716-446655440000' * * parseSessionLine('Regular output line'); * // Returns: null * ``` */ export declare function parseSessionLine(line: string): string | null; //# sourceMappingURL=session.d.ts.map