Tie each hook to a session, picked in the hook form

A hook's calls used to run in whatever session was active at the time.
Now `bot_hooks.session_id` pins them to one session, open or closed
(null still follows the active one). The hook form picks where it runs
(the bot's own chat or one of its workspaces) and a session there, or a
new one of its own started beside the active one so the chat on screen
stays. A bot's proposed hook gets the session it was proposed in, and a
missing session is replaced on the next call. Changing place or session
is refused while a run is open; the computer stays only if reachable.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
2026-10-25 17:08:12 +01:00
co-authored by Claude Opus 5.5
parent 69988e08fc
commit fb4c89fca1
26 changed files with 630 additions and 19 deletions
+4
View File
@@ -742,6 +742,10 @@ export type BUN_SQLITE_COBBLE_BOT_HOOKS = {
* The workspace it runs in (context, computers, models, and the conversation its results go to); null for the bot's own chat
*/
workspace_id?: number | "";
/**
* The session (of this user, bot and place) its runs and results land in, open or closed; null follows the conversation's active session. A bot's proposed hook gets the session it was proposed in. Not a foreign key: a missing one is replaced by a new session on the next call
*/
session_id?: number | "";
title?: string;
/**
* The brief each run gets (markdown); the call's payload is added below it as data