mirror of
https://github.com/getpaseo/paseo.git
synced 2026-11-06 16:34:36 +00:00
27 lines
694 B
TypeScript
27 lines
694 B
TypeScript
interface ShouldClearAgentAttentionOnViewInput {
|
|
agentId: string | null | undefined;
|
|
focusedAgentId: string | null | undefined;
|
|
isConnected: boolean;
|
|
requiresAttention: boolean | null | undefined;
|
|
attentionReason?: "finished" | "error" | "permission" | null | undefined;
|
|
}
|
|
|
|
export function shouldClearAgentAttentionOnView(
|
|
input: ShouldClearAgentAttentionOnViewInput
|
|
): boolean {
|
|
const agentId = input.agentId?.trim();
|
|
if (!agentId) {
|
|
return false;
|
|
}
|
|
if (!input.isConnected) {
|
|
return false;
|
|
}
|
|
if (!input.requiresAttention) {
|
|
return false;
|
|
}
|
|
if (input.attentionReason === "permission") {
|
|
return false;
|
|
}
|
|
return input.focusedAgentId === agentId;
|
|
}
|