Name sessions with the model and keep the rail list live

Sessions no longer take their title from the first message: once the first exchange is sent, the text model writes the title and summary, which the rail and sessions list show. The summary records how many messages it covers so a stale one is rewritten before it is carried into the next session.

The sessions hook now reloads on live message and session events, so a session started by the first message, a rollover or another tab appears without a reload. New sessions are pushed as server:bot-session, both from the process that changed them and through the live relay.
This commit is contained in:
2026-10-19 18:05:57 +01:00
parent 9293a55032
commit 4d5195447b
19 changed files with 420 additions and 38 deletions
+15
View File
@@ -164,6 +164,16 @@ export type BotJobUpdateData = BUN_SQLITE_COBBLE_BOTS_QUEUE_UPDATES & {
session_id: number | null;
};
/**
* `server:bot-session` data: one of the user's conversation sessions was
* started, named or otherwise changed.
*/
export type BotSessionChangedData = {
session_id: number;
bot_id: number;
workspace_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).
@@ -812,6 +822,11 @@ export const WebSocketEvents = [
* `bot_messages` row)
*/
"server:bot-message",
/**
* A session in one of the user's bot conversations started, was named
* or otherwise changed (`data`: `BotSessionChangedData`)
*/
"server:bot-session",
/**
* A bot joined the crew or one of the user's workspaces (`data`:
* `BotCreatedData`)