Show a newly created bot in the rail at once

The rail was built from page props and only knew bots it already had, so a
bot the coordinator created did not appear until a reload.

create_bot and add_bot_to_workspace now push server:bot-created
(BotCreatedData) to everyone who sees the bot: its rail row, the
workspaces it is in, and whether it belongs in that user's own chat list.
useLiveBots inserts it, after the pinned coordinator outside a workspace
and only when the open workspace is one it joined. liveRelay pushes created
bots too, so a bot added by another process still shows.
This commit is contained in:
2026-10-19 12:17:56 +01:00
parent c1cb313bd0
commit fccaa6e280
9 changed files with 180 additions and 3 deletions
+15
View File
@@ -124,6 +124,16 @@ export type BotJobUpdateData = BUN_SQLITE_COBBLE_BOTS_QUEUE_UPDATES & {
session_id: number | null;
};
/**
* `server:bot-created` data: a bot the user can now see, the workspaces
* it's in, and whether it belongs in their own chat list (the main rail).
*/
export type BotCreatedData = {
bot: BotWithLastMessage;
workspace_ids: number[];
in_own_chat: boolean;
};
/**
* `server:bot-updated` data: the bot's new face and status line, and its
* active task (null when there is none).
@@ -535,6 +545,11 @@ export const WebSocketEvents = [
* `bot_messages` row)
*/
"server:bot-message",
/**
* A bot joined the crew or one of the user's workspaces (`data`:
* `BotCreatedData`)
*/
"server:bot-created",
/**
* A bot's face or status line changed (`data`: `BotUpdatedData`)
*/