Keep every hook call's response, searchable by the user and the bot

A hook call used to record only how it was taken; its run's answer went
to the chat alone and was lost to the call once the job was pruned. Now
`bot_hook_events` keeps `response`, `response_message_id` and
`responded_at`, written on every call a run took in when that run ends
(completed, failed, lost, stopped or cancelled) by
`recordHookCallResponse` in the job helpers, and calls turn done or
failed. The Calls view searches what calls sent and what runs answered,
filters by status and pages; Show all loads one call whole. Bots get
`search_hook_calls` and `read_hook_call` for their own hooks (never in a
hook call's own run), with payloads always marked as outside data.
Calls are kept for the app setting `hook_events_keep_days` (Settings >
General, default now 30 days). The caller still only gets 202 Queued.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
2026-10-25 17:47:28 +01:00
co-authored by Claude Opus 5.5
parent fb4c89fca1
commit 0e59559ea9
43 changed files with 1182 additions and 84 deletions
+27
View File
@@ -9,6 +9,7 @@ import type {
BUN_SQLITE_COBBLE_COMPUTERS,
BUN_SQLITE_COBBLE_CRON_JOBS,
BUN_SQLITE_COBBLE_BOT_HOOKS,
BUN_SQLITE_COBBLE_BOT_HOOK_EVENTS,
BUN_SQLITE_COBBLE_MEDIA,
BUN_SQLITE_COBBLE_TASK_MEDIA,
BUN_SQLITE_COBBLE_TASK_NOTES,
@@ -136,6 +137,17 @@ export type BotHookWithNames = Omit<BUN_SQLITE_COBBLE_BOT_HOOKS, "token_hash" |
workspace_name?: string | null;
};
/**
* One call to a hook with its hook's name and bot, as searches list it
* (`searchHookCallsSql`): payload and response are previews there, whole
* in `grabBotHookEvent`.
*/
export type BotHookCall = BUN_SQLITE_COBBLE_BOT_HOOK_EVENTS & {
hook_title?: string | null;
bot_id?: number | null;
workspace_id?: number | null;
};
/**
* What syncing a computer's notification watcher did
* (`syncComputerNotifyWatch`).
@@ -985,6 +997,16 @@ export type McpServersOverviewPayload = ExtensionTargets & {
servers: PublicMcpServer[];
};
/**
* How long hook calls are kept (Settings > General,
* `grab-hook-events-keep-days.ts`).
*/
export type HookCallRetentionOverview = {
keep_days: number;
default_days: number;
max: number;
};
/**
* The install's skill limits (Settings > General, `grab-skill-limits.ts`).
*/
@@ -1664,6 +1686,11 @@ export type PagePropsType = {
* at once, with the code's defaults (the General settings page).
*/
skill_limits?: SkillLimitsOverview | null;
/**
* How many days hook calls are kept, with the code's default (the
* General settings page).
*/
hook_call_retention?: HookCallRetentionOverview | null;
/**
* The name the install goes by as an installed app (Settings >
* General, and the root's head tags). Empty when never named.