Skip to content

feat(web): show what bots are doing on their avatars - #150

Merged
lauragarden merged 5 commits into
mainfrom
feat/avatar-states
Nov 20, 2026
Merged

lauragarden merged 5 commits into
mainfrom
feat/avatar-states

Conversation

@lauragarden

@lauragarden lauragarden commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Upgrades open-bot-avatar from 0.2.0 to 0.3.0 and maps what a bot is doing to the library's new avatar states. Live avatars now mount once per look and switch state with update(), so they ease between states instead of being destroyed and remounted.

Bot activity Avatar state
thinking thinking (three hopping dots)
writing, searching, remembering, tinkering working
struggling (retrying) blocked (exclamation mark)
busy → idle done for 4 s, then idle
failed, idle idle
group member queued waiting
bot disabled, automation disabled idle (the dimmed sleeping avatar is removed)

done plays only on a busy → idle transition seen by the client: not after a failed run, not when a page loads with an idle bot, and it stops as soon as the bot is busy again. Group chats don't celebrate. The /avatars page previews all six states.

Why

Before this change, every busy bot showed the same thinking animation, whatever it was doing, and each state change rebuilt the avatar. 0.3.0 adds states that match the activity the server already reports.

Evidence

  • bun run check passes: lint, format, typecheck, openapi:check, and tests (1323 pass, 0 fail). The pre-push suite and the apps/docs build also pass.
  • Manual: on /avatars in Chrome, all seven states (including the since-removed sleeping) render and animate, working and done draw their ribbons, switching gallery shapes redraws every preview, and the console shows no errors.
  • Not verified by hand: a live avatar easing between states, or done after a real reply. The test account had no bots.
  • Server side: validateAvatar and examples are the same in 0.2.0 and 0.3.0 (diffed the published sources), so stored definitions still validate.

Risk and rollback

Reversibility: Reversible

Blast radius: Web bot avatars (home, sidebar, bot chat header and details, group chat header, /avatars). The server only uses the validator and examples, which didn't change.

open-bot-avatar 0.3.0 was published on 2026-11-20. It installs only because bunfig.toml already exempts this package from minimumReleaseAge.

Upgrade open-bot-avatar to 0.3.0 and map bot activity to its new avatar states: thinking, working, waiting, blocked, and a short done celebration after a reply. Live avatars ease between states instead of remounting.
@github-actions

github-actions Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

React Doctor found no new issues. 🎉

Reviewed by React Doctor for commit 57fa407.

Comment thread apps/web/features/avatars/avatars.tsx Outdated
{(["idle", "working", "sleeping"] satisfies BotState[]).map((state) => (
<div className="mx-auto flex max-w-92 flex-wrap justify-center gap-4">
{(
[

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isnt there a cleaner way to do this?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved the list to a top-level PREVIEW_STATES: BotState[] constant, so the .map no longer needs the inline satisfies. Fixed in 85f1412.

Comment thread apps/web/features/bot-chat/avatar.tsx Outdated
import { isBusy, useWorking } from "./working";
import { type Working, isBusy, useWorking, workingAvatar } from "./working";

/** How long an avatar celebrates after a reply finishes. */

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No comments allowed.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed in 85f1412.

Comment thread apps/web/features/bot-chat/avatar.tsx Outdated
/** How long an avatar celebrates after a reply finishes. */
const DONE_MS = 4000;

/** True for a few seconds after a run ends well; never for a bot that was already idle on load. */

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No comments allowed

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed in 85f1412, along with the other comments this PR added.

Comment thread apps/web/features/bot-chat/working.ts Outdated
Comment on lines +23 to +28
/** Thinking shows the dots, a retry the warning mark; a finished or failed run rests. */
export const workingAvatar: Record<Working, BotState> = {
idle: "idle",
thinking: "thinking",
writing: "working",
searching: "working",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There has to be a cleaner way for this aswell. Also, no comments allowed

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replaced the table with a function, workingAvatar(working): thinking → thinking, struggling → blocked, otherwise isBusy picks working or idle. Comment removed too. Fixed in 85f1412.

idle: "is here",
};

const MEMBER_AVATAR = {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There has to be a cleaner way than this weird typescript magic

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replaced it with a plain function, memberAvatar(status): running → working, queued → waiting, anything else → idle. Fixed in 85f1412.

Comment thread apps/web/features/avatars/avatars.tsx Outdated
Comment on lines +51 to +63
const PREVIEW_STATES: BotState[] = [
"idle",
"thinking",
"working",
"waiting",
"blocked",
"done",
];

function AvatarStatePreviews({ value }: { value: BotAvatarDefinition }) {
return (
<div className="grid grid-cols-3 gap-4">
{(["idle", "working", "sleeping"] satisfies BotState[]).map((state) => (
<div className="mx-auto flex max-w-92 flex-wrap justify-center gap-4">
{PREVIEW_STATES.map((state) => (

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is PREVIEW_STATES needed here? Cant we just use BotState[] directly or something else? I feel like we are going to forget to update this arry in the future

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. The library exports STATES, its own list of every avatar state, so the preview now maps over that and the local list is gone. New states from a future open-bot-avatar version show up without a change here. Fixed in 57fa407.

@lauragarden
lauragarden merged commit bd87f32 into main Nov 20, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants