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:
@@ -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`)
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user