Files
kandev/apps/web/lib/task-status-summary.ts
T
2026-08-02 16:06:14 +01:00

22 lines
686 B
TypeScript

import type { TaskStatusSummary } from "./types/task-status-summary";
/**
* Returns the current task-level error only when it has not already been
* acknowledged or dismissed for the same session and stamp.
*/
export function statusSummaryActiveErrorPreview(
summary: TaskStatusSummary | null | undefined,
acknowledgedAgentErrors?: Record<string, string>,
dismissedAgentErrors?: Record<string, string>,
): string | null {
const error = summary?.active_error;
if (!error) return null;
if (
acknowledgedAgentErrors?.[error.session_id] === error.stamp ||
dismissedAgentErrors?.[error.session_id] === error.stamp
) {
return null;
}
return error.preview;
}