feat(FN-1045): add clickable agent run history with inline log viewer

- Add backend API endpoint for time-range filtered agent log retrieval (GET /api/agents/:id/logs)
- Add fetchAgentRunLogs API function in dashboard client
- Make RunsTab run cards clickable with inline log viewer accordion
- Make AgentRunHistory run rows clickable to expand and view logs
- Enhance AgentDetailView with collapsible log sections and time-range filtering
- Add comprehensive tests for store, routes, and component click behavior
This commit is contained in:
gsxdsm
2026-04-07 12:55:05 -07:00
parent 5646a03d83
commit 4e220d0287
8 changed files with 635 additions and 43 deletions

View File

@@ -2625,6 +2625,30 @@ export class TaskStore extends EventEmitter<TaskStoreEvents> {
return entries;
}
/**
* Get agent log entries for a task filtered by a time range.
*
* Returns all log entries whose `timestamp` falls within [startIso, endIso]
* (inclusive on both ends). If endIso is null (active run), the current
* time is used as the upper bound.
*
* @param taskId - The task ID (e.g. "KB-001")
* @param startIso - ISO-8601 start timestamp (inclusive)
* @param endIso - ISO-8601 end timestamp (inclusive), or null for "now"
* @returns Filtered array of agent log entries
*/
async getAgentLogsByTimeRange(
taskId: string,
startIso: string,
endIso: string | null,
): Promise<AgentLogEntry[]> {
const allEntries = await this.getAgentLogs(taskId);
const end = endIso ?? new Date().toISOString();
return allEntries.filter((entry) => {
return entry.timestamp >= startIso && entry.timestamp <= end;
});
}
// ── Archive Cleanup Methods ─────────────────────────────────────────
/**