openhands / src /utils /agent-state-emoji.ts
SaylorTwift's picture
SaylorTwift HF Staff
Add files using upload-large-folder tool
a070805 verified
Raw History Blame Contribute Delete
1.01 kB
import { ExecutionStatus } from "#/types/agent-server/core/base/common";
/**
* Maps a conversation's execution status to a single emoji that visually
* conveys the agent's state in the browser tab title.
*
* βœ… green check β€” agent finished or is otherwise waiting on the user
* 🟒 green circle β€” agent is actively running
* βšͺ gray circle β€” agent is paused/stopped
* πŸ”΄ red circle β€” agent is in an error state
*
* Returns null when the status is unknown so callers can omit the prefix.
*/
export function getAgentStateEmoji(
status: ExecutionStatus | null | undefined,
): string | null {
switch (status) {
case ExecutionStatus.RUNNING:
return "🟒";
case ExecutionStatus.FINISHED:
case ExecutionStatus.IDLE:
case ExecutionStatus.WAITING_FOR_CONFIRMATION:
return "βœ…";
case ExecutionStatus.PAUSED:
return "βšͺ";
case ExecutionStatus.ERROR:
case ExecutionStatus.STUCK:
return "πŸ”΄";
default:
return null;
}
}