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:
@@ -121,6 +121,11 @@ export type BotHookWithNames = Omit<BUN_SQLITE_COBBLE_BOT_HOOKS, "token_hash" |
|
||||
* For browser notifications: the watched computer's name.
|
||||
*/
|
||||
watch_computer_name?: string | null;
|
||||
/**
|
||||
* The title of the session its runs land in, when it has one of its
|
||||
* own (`session_id`).
|
||||
*/
|
||||
session_title?: string | null;
|
||||
bot_name?: string | null;
|
||||
bot_kind?: string | null;
|
||||
bot_hue?: string | null;
|
||||
@@ -162,6 +167,22 @@ export type BotHookWithToken = {
|
||||
watch?: NotifyWatchSync;
|
||||
};
|
||||
|
||||
/**
|
||||
* Which session a hook's runs land in: `current` follows the
|
||||
* conversation's active session, `new` starts one of its own beside it,
|
||||
* a number is one of the conversation's sessions.
|
||||
*/
|
||||
export type HookSessionChoice = "current" | "new" | number;
|
||||
|
||||
/**
|
||||
* Where a hook can run, for the picker: its bot's own chat
|
||||
* (`workspace_id` null) or one of the bot's workspaces.
|
||||
*/
|
||||
export type HookPlace = {
|
||||
workspace_id: number | null;
|
||||
name: string;
|
||||
};
|
||||
|
||||
/**
|
||||
* A task with what a list shows beside it: the bot and workspace it belongs
|
||||
* to, and its latest note.
|
||||
|
||||
Reference in New Issue
Block a user