feat(agents): improve session ID extraction and JSONL file handling

- Fix session ID extraction to use correct field name "session_id" instead of "sessionId"
- Add comprehensive database update logging with error handling
- Implement cross-project session file search in get_session_output
- Add new load_agent_session_history command for robust JSONL loading
- Update UI components to prioritize JSONL file loading over fallback methods
- Improve error handling and logging throughout the session management flow
- Fix BufReader imports and alias conflicts in Tauri backend

This enhances the reliability of agent session tracking and output retrieval
by properly handling Claude Code's actual JSON structure and implementing
better fallback mechanisms for session data access.
This commit is contained in:
Mufeed VH
2025-07-04 19:12:47 +05:30
parent 9eeb336a8b
commit 7a2372dcde
6 changed files with 320 additions and 29 deletions

View File

@@ -925,6 +925,21 @@ export const api = {
return invoke("load_session_history", { sessionId, projectId });
},
/**
* Loads the JSONL history for a specific agent session
* Similar to loadSessionHistory but searches across all project directories
* @param sessionId - The session ID (UUID)
* @returns Promise resolving to array of session messages
*/
async loadAgentSessionHistory(sessionId: string): Promise<any[]> {
try {
return await invoke<any[]>('load_agent_session_history', { sessionId });
} catch (error) {
console.error("Failed to load agent session history:", error);
throw error;
}
},
/**
* Executes a new interactive Claude Code session with streaming output
*/